@veltdev/sdk-staging 5.0.2-beta.17 → 5.0.2-beta.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/velt.js +9 -9
package/velt.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var SNIPPYLY_VERSION = '5.0.2-beta.
|
|
1
|
+
var SNIPPYLY_VERSION = '5.0.2-beta.18';
|
|
2
2
|
(function(c,E){"use strict";function U(){var e=X.splice(0,X.length);for(ue=0;e.length;)e.shift().call(null,e.shift())}function fe(e,t){for(var n=0,r=e.length;n<r;n++)Le(e[n],t)}function ot(e){for(var t,n=0,r=e.length;n<r;n++)t=e[n],_(t,B[pe(t)])}function de(e){return function(t){Lt(t)&&(Le(t,e),L.length&&fe(t.querySelectorAll(L),e))}}function pe(e){var t=ae.call(e,"is"),n=e.nodeName.toUpperCase(),r=H.call(D,t?J+t.toUpperCase():q+n);return t&&-1<r&&!Ie(n,t)?-1:r}function Ie(e,t){return-1<L.indexOf(e+'[is="'+t+'"]')}function Fe(e){var t=e.currentTarget,n=e.attrChange,r=e.attrName,o=e.target,l=e[Y]||2,a=e[ge]||3;!se||o&&o!==t||!t[C]||r==="style"||e.prevValue===e.newValue&&(e.newValue!==""||n!==l&&n!==a)||t[C](r,n===l?null:e.prevValue,n===a?null:e.newValue)}function Se(e){var t=de(e);return function(n){X.push(t,n.target),ue&&clearTimeout(ue),ue=setTimeout(U,1)}}function he(e){rt&&(rt=!1,e.currentTarget.removeEventListener(Ze,he)),L.length&&fe((e.target||u).querySelectorAll(L),e.detail===v?v:y),R&&at()}function lt(e,t){var n=this;Je.call(n,e,t),Ee.call(n,{target:n})}function Pe(e,t,n){var r=t.apply(e,n),o=pe(r);return-1<o&&_(r,B[o]),n.pop()&&L.length&&ot(r.querySelectorAll(L)),r}function Te(e,t){Tt(e,t),Q?Q.observe(e,gt):(ce&&(e.setAttribute=lt,e[g]=ve(e),e[b](st,Ee)),e[b](N,Fe)),e[x]&&se&&(e.created=!0,e[x](),e.created=!1)}function at(){for(var e,t=0,n=z.length;t<n;t++)e=z[t],P.contains(e)||(n--,z.splice(t--,1),Le(e,v))}function Ve(e){throw new Error("A "+e+" type is already registered")}function Le(e,t){var n,r,o=pe(e);-1<o&&!Mt.call(e,"TEMPLATE")&&(W(e,B[o]),o=0,t!==y||e[y]?t!==v||e[v]||(e[y]=!1,e[v]=!0,r="disconnected",o=1):(e[v]=!1,e[y]=!0,r="connected",o=1,R&&H.call(z,e)<0&&z.push(e)),o&&(n=e[t+O]||e[r+O])&&n.call(e))}function K(){}function Re(e,t,n){var r=n&&n[k]||"",o=t.prototype,l=we(o),a=t.observedAttributes||Ce,m={prototype:l};le(l,x,{value:function(){if(ne)ne=!1;else if(!this[j]){this[j]=!0,new t(this),o[x]&&o[x].call(this);var i=G[re.get(t)];(!Z||i.create.length>1)&&ke(this)}}}),le(l,C,{value:function(i){-1<H.call(a,i)&&o[C]&&o[C].apply(this,arguments)}}),o[Be]&&le(l,ut,{value:o[Be]}),o[je]&&le(l,ct,{value:o[je]}),r&&(m[k]=r),e=e.toUpperCase(),G[e]={constructor:t,create:r?[r,oe(e)]:[e]},re.set(t,e),u[S](e.toLowerCase(),m),Me(e),V[e].r()}function Ue(e){var t=G[e.toUpperCase()];return t&&t.constructor}function _e(e){return typeof e=="string"?e:e&&e.is||""}function ke(e){for(var t,n=e[C],r=n?e.attributes:Ce,o=r.length;o--;)t=r[o],n.call(e,t.name||t.nodeName,null,t.value||t.nodeValue)}function Me(e){return e=e.toUpperCase(),e in V||(V[e]={},V[e].p=new $e(function(t){V[e].r=t})),V[e].p}function xe(){w&&delete c.customElements,I(c,"customElements",{configurable:!0,value:new K}),I(c,"CustomElementRegistry",{configurable:!0,value:K});for(var e=it.get(/^HTML[A-Z]*[a-z]/),t=e.length;t--;(function(n){var r=c[n];if(r){c[n]=function(o){var l,a;return o||(o=this),o[j]||(ne=!0,l=G[re.get(o.constructor)],a=Z&&l.create.length===1,o=a?Reflect.construct(r,Ce,l.constructor):u.createElement.apply(u,l.create),o[j]=!0,ne=!1,a||ke(o)),o},c[n].prototype=r.prototype;try{r.prototype.constructor=c[n]}catch{pt=!0,I(r,j,{value:c[n]})}}})(e[t]));u.createElement=function(n,r){var o=_e(r);return o?Oe.call(this,n,oe(o)):Oe.call(this,n)},tt||(Ne=!0,u[S](""))}var u=c.document,T=c.Object,it=(function(e){var t,n,r,o,l=/^[A-Z]+[a-z]/,a=function(d){var f,h=[];for(f in i)d.test(f)&&h.push(f);return h},m=function(d,f){(f=f.toLowerCase())in i||(i[d]=(i[d]||[]).concat(f),i[f]=i[f.toUpperCase()]=d)},i=(T.create||T)(null),s={};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 s.get=function(d){return typeof d=="string"?i[d]||(l.test(d)?[]:""):a(d)},s.set=function(d,f){return l.test(d)?m(d,f):m(f,d),s},s})({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 E!="object"&&(E={type:E||"auto"});var X,Ee,$,ve,Q,He,W,_,A,S="registerElement",qe=1e5*c.Math.random()>>0,g="__"+S+qe,b="addEventListener",y="attached",O="Callback",v="detached",k="extends",C="attributeChanged"+O,ut=y+O,Be="connected"+O,je="disconnected"+O,x="created"+O,ct=v+O,Y="ADDITION",ge="REMOVAL",N="DOMAttrModified",Ze="DOMContentLoaded",st="DOMSubtreeModified",q="<",J="=",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=[],B=[],L="",P=u.documentElement,H=D.indexOf||function(e){for(var t=this.length;t--&&this[t]!==e;);return t},be=T.prototype,ye=be.hasOwnProperty,ee=be.isPrototypeOf,I=T.defineProperty,Ce=[],te=T.getOwnPropertyDescriptor,Ge=T.getOwnPropertyNames,dt=T.getPrototypeOf,ze=T.setPrototypeOf,Ke=!!T.__proto__,pt=!1,j="__dreCEv1",w=c.customElements,Z=!/^force/.test(E.type)&&!!(w&&w.define&&w.get&&w.whenDefined),Xe=T.create||T,ht=c.Map||function(){var e,t=[],n=[];return{get:function(r){return n[H.call(t,r)]},set:function(r,o){e=H.call(t,r),e<0?n[t.push(r)-1]=o:n[e]=o}}},$e=c.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},ne=!1,G=Xe(null),V=Xe(null),re=new ht,oe=function(e){return e.toLowerCase()},we=T.create||function e(t){return t?(e.prototype=t,new e):this},Tt=ze||(Ke?function(e,t){return e.__proto__=t,e}:Ge&&te?(function(){function e(t,n){for(var r,o=Ge(n),l=0,a=o.length;l<a;l++)r=o[l],ye.call(t,r)||I(t,r,te(n,r))}return function(t,n){do e(t,n);while((n=dt(n))&&!ee.call(n,t));return t}})():function(e,t){for(var n in t)e[n]=t[n];return e}),F=c.MutationObserver||c.WebKitMutationObserver,Qe=c.HTMLAnchorElement,p=(c.HTMLElement||c.Element||c.Node).prototype,R=!ee.call(p,P),le=R?function(e,t,n){return e[t]=n.value,e}:I,Lt=R?function(e){return e.nodeType===1}:function(e){return ee.call(p,e)},z=R&&[],We=p.attachShadow,Ye=p.cloneNode,Mt=p.closest||function(e){for(var t=this;t&&t.nodeName!==e;)t=t.parentNode;return t},Ae=p.dispatchEvent,ae=p.getAttribute,Et=p.hasAttribute,vt=p.removeAttribute,Je=p.setAttribute,ie=u.createElement,Ht=u.importNode,Oe=ie,gt=F&&{attributes:!0,characterData:!0,attributeOldValue:!0},et=F||function(e){ce=!1,P.removeEventListener(N,et)},ue=0,tt=S in u&&!/^force-all/.test(E.type),nt=!0,Ne=!1,ce=!0,rt=!0,se=!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=te(p,"innerHTML");var n=A&&A.set;n&&I(p,"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=""),tt||(ze||Ke?(W=function(e,t){ee.call(t,e)||Te(e,t)},_=Te):(W=function(e,t){e[g]||(e[g]=T(!0),Te(e,t))},_=W),R?(ce=!1,(function(){var e=te(p,b),t=e.value,n=function(l){var a=new CustomEvent(N,{bubbles:!0});a.attrName=l,a.prevValue=ae.call(this,l),a.newValue=null,a[ge]=a.attrChange=2,vt.call(this,l),Ae.call(this,a)},r=function(l,a){var m=Et.call(this,l),i=m&&ae.call(this,l),s=new CustomEvent(N,{bubbles:!0});Je.call(this,l,a),s.attrName=l,s.prevValue=m?i:null,s.newValue=a,m?s.MODIFICATION=s.attrChange=1:s[Y]=s.attrChange=0,Ae.call(this,s)},o=function(l){var a,m=l.currentTarget,i=m[g],s=l.propertyName;i.hasOwnProperty(s)&&(i=i[s],a=new CustomEvent(N,{bubbles:!0}),a.attrName=i.name,a.prevValue=i.value||null,a.newValue=i.value=m[s]||null,a.prevValue==null?a[Y]=a.attrChange=0:a.MODIFICATION=a.attrChange=1,Ae.call(m,a))};e.value=function(l,a,m){l===N&&this[C]&&this.setAttribute!==r&&(this[g]={className:{name:"class",value:this.className}},this.setAttribute=r,this.removeAttribute=n,t.call(this,"propertychange",o)),t.call(this,l,a,m)},I(p,b,e)})()):F||(P[b](N,et),P.setAttribute(g,1),P.removeAttribute(g),ce&&(Ee=function(e){var t,n,r,o=this;if(o===e.target){t=o[g],o[g]=n=ve(o);for(r in n){if(!(r in t))return $(0,o,r,t[r],n[r],Y);if(n[r]!==t[r])return $(1,o,r,t[r],n[r],"MODIFICATION")}for(r in t)if(!(r in n))return $(2,o,r,t[r],n[r],ge)}},$=function(e,t,n,r,o,l){var a={attrChange:e,currentTarget:t,attrName:n,prevValue:r,newValue:o};a[l]=e,Fe(a)},ve=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(),nt&&(nt=!1,F?(Q=(function(i,s){function d(f,h){for(var M=0,me=f.length;M<me;h(f[M++]));}return new F(function(f){for(var h,M,me,De=0,bt=f.length;De<bt;De++)h=f[De],h.type==="childList"?(d(h.addedNodes,i),d(h.removedNodes,s)):(M=h.target,se&&M[C]&&h.attributeName!=="style"&&(me=ae.call(M,h.attributeName))!==h.oldValue&&M[C](h.attributeName,h.oldValue,me))})})(de(y),de(v)),He=function(i){return Q.observe(i,{childList:!0,subtree:!0}),i},He(u),We&&(p.attachShadow=function(){return He(We.apply(this,arguments))})):(X=[],u[b]("DOMNodeInserted",Se(y)),u[b]("DOMNodeRemoved",Se(v))),u[b](Ze,he),u[b]("readystatechange",he),u.importNode=function(i,s){switch(i.nodeType){case 1:return Pe(u,Ht,[i,!!s]);case 11:for(var d=u.createDocumentFragment(),f=i.childNodes,h=f.length,M=0;M<h;M++)d.appendChild(u.importNode(f[M],!!s));return d;default:return Ye.call(i,!!s)}},p.cloneNode=function(i){return Pe(this,Ye,[!!i])}),Ne)return Ne=!1;if(-2<H.call(D,J+n)+H.call(D,q+n)&&Ve(e),!mt.test(n)||-1<H.call(ft,n))throw new Error("The type "+e+" is invalid");var n,r,o=function(){return a?u.createElement(m,n):u.createElement(m)},l=t||be,a=ye.call(l,k),m=a?t[k].toUpperCase():n;return a&&-1<H.call(D,q+m)&&Ve(m),r=D.push((a?J:q)+n)-1,L=L.concat(L.length?",":"",a?m+'[is="'+e.toLowerCase()+'"]':m),o.prototype=B[r]=ye.call(l,"prototype")?l.prototype:we(p),L.length&&fe(u.querySelectorAll(L),y),o},u.createElement=Oe=function(e,t){var n=_e(t),r=n?ie.call(u,e,oe(n)):ie.call(u,e),o=""+e,l=H.call(D,(n?J:q)+(n||o).toUpperCase()),a=-1<l;return n&&(r.setAttribute("is",n=n.toLowerCase()),a&&(a=Ie(o.toUpperCase(),n))),se=!u.createElement.innerHTMLHelper,a&&_(r,B[l]),r}),addEventListener("beforeunload",function(){delete u.createElement,delete u.importNode,delete u[S]},!1),K.prototype={constructor:K,define:Z?function(e,t,n){if(n)Re(e,t,n);else{var r=e.toUpperCase();G[r]={constructor:t,create:[r]},re.set(t,r),w.define(e,t)}}:Re,get:Z?function(e){return w.get(e)||Ue(e)}:Ue,whenDefined:Z?function(e){return $e.race([w.whenDefined(e),Me(e)])}:Me},!w||/^force/.test(E.type))xe();else if(!E.noBuiltIn)try{(function(e,t,n){var r=new RegExp(`^<a\\s+is=('|")`+n+"\\1></a>$");if(t[k]="a",e.prototype=we(Qe.prototype),e.prototype.constructor=e,c.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(Qe,[],e)},{},"document-register-element-a"+qe)}catch{xe()}if(!E.noBuiltIn)try{if(ie.call(u,"a","a").outerHTML.indexOf("is")<0)throw{}}catch{oe=function(t){return{is:t.toLowerCase()}}}})(window);Promise.allSettled||(Promise.allSettled=function(c){return Promise.all(c.map(function(E){return Promise.resolve(E).then(function(U){return{status:"fulfilled",value:U}}).catch(function(U){return{status:"rejected",reason:U}})}))});
|
|
3
3
|
|
|
4
4
|
var bIe=Object.create;var _4=Object.defineProperty,SIe=Object.defineProperties,yIe=Object.getOwnPropertyDescriptor,xIe=Object.getOwnPropertyDescriptors,IIe=Object.getOwnPropertyNames,C4=Object.getOwnPropertySymbols,kZ=Object.getPrototypeOf,WN=Object.prototype.hasOwnProperty,TZ=Object.prototype.propertyIsEnumerable,EIe=Reflect.get;var EZ=(n,r,i)=>r in n?_4(n,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[r]=i,b=(n,r)=>{for(var i in r||={})WN.call(r,i)&&EZ(n,i,r[i]);if(C4)for(var i of C4(r))TZ.call(r,i)&&EZ(n,i,r[i]);return n},E=(n,r)=>SIe(n,xIe(r));var Op=(n,r)=>{var i={};for(var e in n)WN.call(n,e)&&r.indexOf(e)<0&&(i[e]=n[e]);if(n!=null&&C4)for(var e of C4(n))r.indexOf(e)<0&&TZ.call(n,e)&&(i[e]=n[e]);return i};var kIe=(n,r)=>()=>(r||n((r={exports:{}}).exports,r),r.exports),b4=(n,r)=>{for(var i in r)_4(n,i,{get:r[i],enumerable:!0})},TIe=(n,r,i,e)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of IIe(r))!WN.call(n,t)&&t!==i&&_4(n,t,{get:()=>r[t],enumerable:!(e=yIe(r,t))||e.enumerable});return n};var wZ=(n,r,i)=>(i=n!=null?bIe(kZ(n)):{},TIe(r||!n||!n.__esModule?_4(i,"default",{value:n,enumerable:!0}):i,n));var av=(n,r,i)=>EIe(kZ(n),i,r);var X=(n,r,i)=>new Promise((e,t)=>{var o=s=>{try{l(i.next(s))}catch(d){t(d)}},a=s=>{try{l(i.throw(s))}catch(d){t(d)}},l=s=>s.done?e(s.value):Promise.resolve(s.value).then(o,a);l((i=i.apply(n,r)).next())});var GK=kIe((EHr,zK)=>{"use strict";var Pt={};Pt.generateIdentifier=function(){return Math.random().toString(36).substring(2,12)};Pt.localCName=Pt.generateIdentifier();Pt.splitLines=function(n){return n.trim().split(`
|
|
@@ -219,7 +219,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
219
219
|
<img src="${r||this.thumbnailWithPlayIconUrl||this.thumbnailUrl}" />
|
|
220
220
|
</a>
|
|
221
221
|
`}};var yu=class{constructor(){this.type="recorder",this.recordingType="audio",this.mode="floating",this.attachment=null,this.attachments=[],this.pageInfo=new kr}};var fR=class{constructor(){this.type="rewriter",this.rewriterType="copywriter",this.pageInfo=new kr}};var JE=class{constructor(){this.screenWidth=0,this.screenHeight=0,this.screenScrollHeight=0}};var xu=class{constructor(){this.pageInfo=new kr}},QE=(function(n){return n.Start="start",n.End="end",n})(QE||{}),o_=(function(n){return n.Avatar="avatar",n.Label="label",n})(o_||{});var CR=class{constructor(){this.sources=[],this.playerState=new ek}},ek=class{constructor(){this.volume=1}};var tk=class{constructor(){this.to=[],this.resolved=!1,this.type="tag",this.pageInfo=new kr}};var xd=class{constructor(){this.visibility="private"}};var _R=class{constructor(){this.reactions=[],this.type="reaction",this.pageInfo=new kr,this.isReactionResolverUsed=!1}};var bR=class{};var gs=(function(n){return n.EDITOR="editor",n.VIEWER="viewer",n})(gs||{}),qr=(function(n){return n.DOES_NOT_EXIST="does_not_exist",n.PERMISSION_DENIED="permission_denied",n.SOMETHING_WENT_WRONG="something_went_wrong",n})(qr||{});var aY=(function(n){return n.INTERNAL="internal",n.EXTERNAL="external",n})(aY||{}),lY=(function(n){return n.UPDATE_DATA="updateData",n})(lY||{});var Lt=(()=>{let r=class r{constructor(e,t){this.loggingService=e,this.analyticsService=t,this.config$=new be(null),this.disableLogsConfig$=new be({warnings:!0,suppressAll:!1}),this.apiKey$=new be(""),this.baseFeatureAllowList=[],this.sf$=new be(!1),this.sdkType$=new be("core"),this.logsEnabled$=new be(!0),this.safeEval$=new be(!1),this.encryptionProvider$=new be(null);try{this.analyticsService.setConfigService(this),this.sdkType$.subscribe(o=>{this.analyticsService.updateDefaultProperties({sdkType:o})},o=>{this.loggingService.catch("Error in ConfigService sdkType$: ",o)}),this.logsEnabled$.subscribe(o=>{o?this.loggingService.enableLogs():this.loggingService.disableLogs(),tt.logsEnabled=o},o=>{this.loggingService.catch("Error in ConfigService logsEnabled$: ",o)})}catch(o){this.loggingService.catch("Error in ConfigService constructor: ",o)}}initConfig(e){try{e.featureAllowList?.length||(e.featureAllowList=Object.values(Be)),this.baseFeatureAllowList=e.featureAllowList?.slice(),this.config$.next(e)}catch(t){this.loggingService.catch("Error in ConfigService initConfig: ",t)}}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 t=this.config$.value;t&&(e?.length?t.featureAllowList=this.baseFeatureAllowList.filter(o=>!e.includes(o)):t.featureAllowList=this.baseFeatureAllowList.slice()),this.config$.next(t)}catch(t){this.loggingService.catch("Error in ConfigService disableFeatures: ",t)}}setSF(e){try{this.sf$.next(e),this.analyticsService.setSF(e)}catch(t){this.loggingService.catch("Error in ConfigService setSF: ",t)}}getSF(){try{return this.sf$.value}catch(e){return this.loggingService.catch("Error in ConfigService getSF: ",e),!1}}getSF$(){try{return this.sf$.asObservable().pipe(xt(Qt))}catch(e){return this.loggingService.catch("Error in ConfigService getSF$: ",e),ce(!1)}}setSdkType(e){try{this.sdkType$.next(e)}catch(t){this.loggingService.catch("Error in ConfigService setSdkType: ",t)}}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),ce("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(t){this.loggingService.catch("Error in ConfigService disableLogs: ",t)}}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}}enableSafeEval(){try{this.safeEval$.next(!0)}catch(e){this.loggingService.catch("Error in ConfigService enableSafeEval: ",e)}}disableSafeEval(){try{this.safeEval$.next(!1)}catch(e){this.loggingService.catch("Error in ConfigService disableSafeEval: ",e)}}getSafeEval(){try{return this.safeEval$.value}catch(e){return this.loggingService.catch("Error in ConfigService getSafeEval: ",e),!1}}getSafeEval$(){try{return this.safeEval$.asObservable()}catch(e){return this.loggingService.catch("Error in ConfigService getSafeEval$: ",e),ce(!1)}}setEncryptionProvider(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setEncryptionProvider","color: green;"),this.encryptionProvider$.next(e)}catch(t){this.loggingService.catch("Error in ConfigService setEncryptionProvider: ",t)}}getEncryptionProvider(){try{return this.encryptionProvider$.value}catch(e){return this.loggingService.catch("Error in ConfigService getEncryptionProvider: ",e),null}}getEncryptionProvider$(){try{return this.encryptionProvider$.asObservable()}catch(e){return this.loggingService.catch("Error in ConfigService getEncryptionProvider$: ",e),ce(null)}}};r.\u0275fac=function(t){return new(t||r)(J(x),J(rt))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var Zve=(()=>{let r=class r{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(V.LOCALSTORAGE_DATA_ID);if(e)return JSON.parse(e);{let t=new _f;return this.setLocalStorageData(t),t}}catch(e){return this.loggingService.catch("Error in getLocalStorageData:",e),new _f}}setLocalStorageData(e){this.loggingService.log("%c[WB] Calling FUNCTION: setLocalStorageData","color: green;");try{if(e){let t=JSON.stringify(e);localStorage?.setItem(V.LOCALSTORAGE_DATA_ID,t)}}catch(t){this.loggingService.catch("Error in setLocalStorageData:",t)}}deleteLocalStorageData(){this.loggingService.log("%c[WB] Calling FUNCTION: deleteLocalStorageData","color: green;"),localStorage?.removeItem(V.LOCALSTORAGE_DATA_ID)}getSessionStorageData(){this.loggingService.log("%c[WB] Calling FUNCTION: getSessionStorageData","color: green;");try{let e=sessionStorage?.getItem(V.LOCALSTORAGE_DATA_ID);if(e)return JSON.parse(e);{let t=new _f;return this.setSessionStorageData(t),t}}catch(e){return this.loggingService.catch("Error in getSessionStorageData:",e),new _f}}setSessionStorageData(e){this.loggingService.log("%c[WB] Calling FUNCTION: setSessionStorageData","color: green;");try{if(e){let t=JSON.stringify(e);sessionStorage?.setItem(V.LOCALSTORAGE_DATA_ID,t)}}catch(t){this.loggingService.catch("Error in setSessionStorageData:",t)}}deleteSessionStorageData(){this.loggingService.log("%c[WB] Calling FUNCTION: deleteSessionStorageData","color: green;");try{sessionStorage?.removeItem(V.LOCALSTORAGE_DATA_ID)}catch(e){this.loggingService.catch("Error in deleteSessionStorageData:",e)}}};r.\u0275fac=function(t){return new(t||r)(J(x))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var Om=(()=>{let r=class r{constructor(e,t){this.localStorageService=e,this.loggingService=t,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 Vo,t=this.localStorageService.getSessionStorageData();if(t.snippylyAvatar)e=t.snippylyAvatar;else{let o=this.generateUserAvatar();t.snippylyAvatar=o,this.localStorageService.setSessionStorageData(t)}return e}catch(e){return this.loggingService.catch("Error in getSessionAvatar:",e),new Vo}}generateUserAvatar(){this.loggingService.log("%c[WB] Calling FUNCTION: generateUserAvatar","color: green;");try{let e=Math.floor(Math.random()*this.avatarList.length),t=this.avatarList[e];return t.color=this.generateUserColor(),t}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 V.AVATAR_COLOR_LIST[e%V.AVATAR_COLOR_LIST.length];let t=Math.floor(Math.random()*V.AVATAR_COLOR_LIST.length);return V.AVATAR_COLOR_LIST[t]}catch(t){return this.loggingService.catch("Error in generateUserColor:",t),""}}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),""}}};r.\u0275fac=function(t){return new(t||r)(J(Zve),J(x))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var pi=(()=>{let r=class r{constructor(e){this.loggingService=e,this.actionSubjects=new Map,this.subscriptions=[]}triggerAction(e,t){try{this.actionSubjects.has(e)||this.actionSubjects.set(e,new nt),this.actionSubjects.get(e)?.next(t)}catch(o){this.loggingService.catch("Error in CoreActionsService triggerAction: ",o)}}onAction(e){try{this.actionSubjects.has(e)||this.actionSubjects.set(e,new nt);let t=this.actionSubjects.get(e);return t?t.asObservable():ce(null)}catch(t){return this.loggingService.catch("Error in CoreActionsService onAction: ",t),ce(null)}}};r.\u0275fac=function(t){return new(t||r)(J(x))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var{entries:oue,setPrototypeOf:Xve,isFrozen:bUe,getPrototypeOf:SUe,getOwnPropertyDescriptor:yUe}=Object,{freeze:jl,seal:Ec,create:uY}=Object,{apply:pY,construct:hY}=typeof Reflect<"u"&&Reflect;jl||(jl=function(r){return r});Ec||(Ec=function(r){return r});pY||(pY=function(r,i){for(var e=arguments.length,t=new Array(e>2?e-2:0),o=2;o<e;o++)t[o-2]=arguments[o];return r.apply(i,t)});hY||(hY=function(r){for(var i=arguments.length,e=new Array(i>1?i-1:0),t=1;t<i;t++)e[t-1]=arguments[t];return new r(...e)});var SR=$l(Array.prototype.forEach),xUe=$l(Array.prototype.lastIndexOf),Jve=$l(Array.prototype.pop),ik=$l(Array.prototype.push),IUe=$l(Array.prototype.splice),xR=$l(String.prototype.toLowerCase),sY=$l(String.prototype.toString),cY=$l(String.prototype.match),rk=$l(String.prototype.replace),EUe=$l(String.prototype.indexOf),kUe=$l(String.prototype.trim),Id=$l(Object.prototype.hasOwnProperty),Vl=$l(RegExp.prototype.test),ok=TUe(TypeError);function $l(n){return function(r){r instanceof RegExp&&(r.lastIndex=0);for(var i=arguments.length,e=new Array(i>1?i-1:0),t=1;t<i;t++)e[t-1]=arguments[t];return pY(n,r,e)}}function TUe(n){return function(){for(var r=arguments.length,i=new Array(r),e=0;e<r;e++)i[e]=arguments[e];return hY(n,i)}}function Di(n,r){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:xR;Xve&&Xve(n,null);let e=r.length;for(;e--;){let t=r[e];if(typeof t=="string"){let o=i(t);o!==t&&(bUe(r)||(r[e]=o),t=o)}n[t]=!0}return n}function wUe(n){for(let r=0;r<n.length;r++)Id(n,r)||(n[r]=null);return n}function Yg(n){let r=uY(null);for(let[i,e]of oue(n))Id(n,i)&&(Array.isArray(e)?r[i]=wUe(e):e&&typeof e=="object"&&e.constructor===Object?r[i]=Yg(e):r[i]=e);return r}function ak(n,r){for(;n!==null;){let e=yUe(n,r);if(e){if(e.get)return $l(e.get);if(typeof e.value=="function")return $l(e.value)}n=SUe(n)}function i(){return null}return i}var Qve=jl(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),dY=jl(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),mY=jl(["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"]),DUe=jl(["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"]),gY=jl(["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"]),OUe=jl(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),eue=jl(["#text"]),tue=jl(["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","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),vY=jl(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),nue=jl(["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"]),yR=jl(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),AUe=Ec(/\{\{[\w\W]*|[\w\W]*\}\}/gm),PUe=Ec(/<%[\w\W]*|[\w\W]*%>/gm),MUe=Ec(/\$\{[\w\W]*/gm),RUe=Ec(/^data-[\-\w.\u00B7-\uFFFF]+$/),NUe=Ec(/^aria-[\-\w]+$/),aue=Ec(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),FUe=Ec(/^(?:\w+script|data):/i),LUe=Ec(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),lue=Ec(/^html$/i),UUe=Ec(/^[a-z][.\w]*(-[.\w]+)+$/i),iue=Object.freeze({__proto__:null,ARIA_ATTR:NUe,ATTR_WHITESPACE:LUe,CUSTOM_ELEMENT:UUe,DATA_ATTR:RUe,DOCTYPE_NAME:lue,ERB_EXPR:PUe,IS_ALLOWED_URI:aue,IS_SCRIPT_OR_DATA:FUe,MUSTACHE_EXPR:AUe,TMPLIT_EXPR:MUe}),lk={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},BUe=function(){return typeof window>"u"?null:window},VUe=function(r,i){if(typeof r!="object"||typeof r.createPolicy!="function")return null;let e=null,t="data-tt-policy-suffix";i&&i.hasAttribute(t)&&(e=i.getAttribute(t));let o="dompurify"+(e?"#"+e:"");try{return r.createPolicy(o,{createHTML(a){return a},createScriptURL(a){return a}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},rue=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function sue(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:BUe(),r=vn=>sue(vn);if(r.version="3.3.0",r.removed=[],!n||!n.document||n.document.nodeType!==lk.document||!n.Element)return r.isSupported=!1,r;let{document:i}=n,e=i,t=e.currentScript,{DocumentFragment:o,HTMLTemplateElement:a,Node:l,Element:s,NodeFilter:d,NamedNodeMap:v=n.NamedNodeMap||n.MozNamedAttrMap,HTMLFormElement:u,DOMParser:S,trustedTypes:k}=n,A=s.prototype,P=ak(A,"cloneNode"),U=ak(A,"remove"),W=ak(A,"nextSibling"),te=ak(A,"childNodes"),ye=ak(A,"parentNode");if(typeof a=="function"){let vn=i.createElement("template");vn.content&&vn.content.ownerDocument&&(i=vn.content.ownerDocument)}let me,ke="",{implementation:De,createNodeIterator:Ie,createDocumentFragment:xe,getElementsByTagName:Re}=i,{importNode:Le}=e,Ue=rue();r.isSupported=typeof oue=="function"&&typeof ye=="function"&&De&&De.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:He,ERB_EXPR:$e,TMPLIT_EXPR:br,DATA_ATTR:Dt,ARIA_ATTR:wt,IS_SCRIPT_OR_DATA:Ze,ATTR_WHITESPACE:Bt,CUSTOM_ELEMENT:Xt}=iue,{IS_ALLOWED_URI:ei}=iue,Fi=null,sr=Di({},[...Qve,...dY,...mY,...gY,...eue]),$n=null,cr=Di({},[...tue,...vY,...nue,...yR]),zi=Object.seal(uY(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}})),bn=null,dn=null,Yr=Object.seal(uY(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Yi=!0,$o=!0,Pc=!1,o0=!0,Rd=!1,tv=!0,Mc=!1,a0=!1,l0=!1,nv=!1,Cp=!1,_p=!1,s0=!0,rx=!1,UN="user-content-",bp=!0,Zm=!1,Nd={},co=null,_a=Di({},["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"]),Sp=null,ox=Di({},["audio","video","img","source","image","track"]),c0=null,n4=Di({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Fd="http://www.w3.org/1998/Math/MathML",yp="http://www.w3.org/2000/svg",Zs="http://www.w3.org/1999/xhtml",Ld=Zs,ax=!1,lx=null,sx=Di({},[Fd,yp,Zs],sY),xp=Di({},["mi","mo","mn","ms","mtext"]),Ip=Di({},["annotation-xml"]),Ep=Di({},["title","style","font","a","script"]),Xm=null,cx=["application/xhtml+xml","text/html"],Jm="text/html",Oo=null,Rc=null,i4=i.createElement("form"),iv=function(We){return We instanceof RegExp||We instanceof Function},d0=function(){let We=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Rc&&Rc===We)){if((!We||typeof We!="object")&&(We={}),We=Yg(We),Xm=cx.indexOf(We.PARSER_MEDIA_TYPE)===-1?Jm:We.PARSER_MEDIA_TYPE,Oo=Xm==="application/xhtml+xml"?sY:xR,Fi=Id(We,"ALLOWED_TAGS")?Di({},We.ALLOWED_TAGS,Oo):sr,$n=Id(We,"ALLOWED_ATTR")?Di({},We.ALLOWED_ATTR,Oo):cr,lx=Id(We,"ALLOWED_NAMESPACES")?Di({},We.ALLOWED_NAMESPACES,sY):sx,c0=Id(We,"ADD_URI_SAFE_ATTR")?Di(Yg(n4),We.ADD_URI_SAFE_ATTR,Oo):n4,Sp=Id(We,"ADD_DATA_URI_TAGS")?Di(Yg(ox),We.ADD_DATA_URI_TAGS,Oo):ox,co=Id(We,"FORBID_CONTENTS")?Di({},We.FORBID_CONTENTS,Oo):_a,bn=Id(We,"FORBID_TAGS")?Di({},We.FORBID_TAGS,Oo):Yg({}),dn=Id(We,"FORBID_ATTR")?Di({},We.FORBID_ATTR,Oo):Yg({}),Nd=Id(We,"USE_PROFILES")?We.USE_PROFILES:!1,Yi=We.ALLOW_ARIA_ATTR!==!1,$o=We.ALLOW_DATA_ATTR!==!1,Pc=We.ALLOW_UNKNOWN_PROTOCOLS||!1,o0=We.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Rd=We.SAFE_FOR_TEMPLATES||!1,tv=We.SAFE_FOR_XML!==!1,Mc=We.WHOLE_DOCUMENT||!1,nv=We.RETURN_DOM||!1,Cp=We.RETURN_DOM_FRAGMENT||!1,_p=We.RETURN_TRUSTED_TYPE||!1,l0=We.FORCE_BODY||!1,s0=We.SANITIZE_DOM!==!1,rx=We.SANITIZE_NAMED_PROPS||!1,bp=We.KEEP_CONTENT!==!1,Zm=We.IN_PLACE||!1,ei=We.ALLOWED_URI_REGEXP||aue,Ld=We.NAMESPACE||Zs,xp=We.MATHML_TEXT_INTEGRATION_POINTS||xp,Ip=We.HTML_INTEGRATION_POINTS||Ip,zi=We.CUSTOM_ELEMENT_HANDLING||{},We.CUSTOM_ELEMENT_HANDLING&&iv(We.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(zi.tagNameCheck=We.CUSTOM_ELEMENT_HANDLING.tagNameCheck),We.CUSTOM_ELEMENT_HANDLING&&iv(We.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(zi.attributeNameCheck=We.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),We.CUSTOM_ELEMENT_HANDLING&&typeof We.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(zi.allowCustomizedBuiltInElements=We.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Rd&&($o=!1),Cp&&(nv=!0),Nd&&(Fi=Di({},eue),$n=[],Nd.html===!0&&(Di(Fi,Qve),Di($n,tue)),Nd.svg===!0&&(Di(Fi,dY),Di($n,vY),Di($n,yR)),Nd.svgFilters===!0&&(Di(Fi,mY),Di($n,vY),Di($n,yR)),Nd.mathMl===!0&&(Di(Fi,gY),Di($n,nue),Di($n,yR))),We.ADD_TAGS&&(typeof We.ADD_TAGS=="function"?Yr.tagCheck=We.ADD_TAGS:(Fi===sr&&(Fi=Yg(Fi)),Di(Fi,We.ADD_TAGS,Oo))),We.ADD_ATTR&&(typeof We.ADD_ATTR=="function"?Yr.attributeCheck=We.ADD_ATTR:($n===cr&&($n=Yg($n)),Di($n,We.ADD_ATTR,Oo))),We.ADD_URI_SAFE_ATTR&&Di(c0,We.ADD_URI_SAFE_ATTR,Oo),We.FORBID_CONTENTS&&(co===_a&&(co=Yg(co)),Di(co,We.FORBID_CONTENTS,Oo)),bp&&(Fi["#text"]=!0),Mc&&Di(Fi,["html","head","body"]),Fi.table&&(Di(Fi,["tbody"]),delete bn.tbody),We.TRUSTED_TYPES_POLICY){if(typeof We.TRUSTED_TYPES_POLICY.createHTML!="function")throw ok('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof We.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw ok('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');me=We.TRUSTED_TYPES_POLICY,ke=me.createHTML("")}else me===void 0&&(me=VUe(k,t)),me!==null&&typeof ke=="string"&&(ke=me.createHTML(""));jl&&jl(We),Rc=We}},ba=Di({},[...dY,...mY,...DUe]),dx=Di({},[...gY,...OUe]),kp=function(We){let Rt=ye(We);(!Rt||!Rt.tagName)&&(Rt={namespaceURI:Ld,tagName:"template"});let an=xR(We.tagName),Dr=xR(Rt.tagName);return lx[We.namespaceURI]?We.namespaceURI===yp?Rt.namespaceURI===Zs?an==="svg":Rt.namespaceURI===Fd?an==="svg"&&(Dr==="annotation-xml"||xp[Dr]):!!ba[an]:We.namespaceURI===Fd?Rt.namespaceURI===Zs?an==="math":Rt.namespaceURI===yp?an==="math"&&Ip[Dr]:!!dx[an]:We.namespaceURI===Zs?Rt.namespaceURI===yp&&!Ip[Dr]||Rt.namespaceURI===Fd&&!xp[Dr]?!1:!dx[an]&&(Ep[an]||!ba[an]):!!(Xm==="application/xhtml+xml"&&lx[We.namespaceURI]):!1},il=function(We){ik(r.removed,{element:We});try{ye(We).removeChild(We)}catch{U(We)}},Qm=function(We,Rt){try{ik(r.removed,{attribute:Rt.getAttributeNode(We),from:Rt})}catch{ik(r.removed,{attribute:null,from:Rt})}if(Rt.removeAttribute(We),We==="is")if(nv||Cp)try{il(Rt)}catch{}else try{Rt.setAttribute(We,"")}catch{}},r4=function(We){let Rt=null,an=null;if(l0)We="<remove></remove>"+We;else{let Kr=cY(We,/^[\r\n\t ]+/);an=Kr&&Kr[0]}Xm==="application/xhtml+xml"&&Ld===Zs&&(We='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+We+"</body></html>");let Dr=me?me.createHTML(We):We;if(Ld===Zs)try{Rt=new S().parseFromString(Dr,Xm)}catch{}if(!Rt||!Rt.documentElement){Rt=De.createDocument(Ld,"template",null);try{Rt.documentElement.innerHTML=ax?ke:Dr}catch{}}let Sa=Rt.body||Rt.documentElement;return We&&an&&Sa.insertBefore(i.createTextNode(an),Sa.childNodes[0]||null),Ld===Zs?Re.call(Rt,Mc?"html":"body")[0]:Mc?Rt.documentElement:Sa},eg=function(We){return Ie.call(We.ownerDocument||We,We,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},mx=function(We){return We instanceof u&&(typeof We.nodeName!="string"||typeof We.textContent!="string"||typeof We.removeChild!="function"||!(We.attributes instanceof v)||typeof We.removeAttribute!="function"||typeof We.setAttribute!="function"||typeof We.namespaceURI!="string"||typeof We.insertBefore!="function"||typeof We.hasChildNodes!="function")},o4=function(We){return typeof l=="function"&&We instanceof l};function Kl(vn,We,Rt){SR(vn,an=>{an.call(r,We,Rt,Rc)})}let gx=function(We){let Rt=null;if(Kl(Ue.beforeSanitizeElements,We,null),mx(We))return il(We),!0;let an=Oo(We.nodeName);if(Kl(Ue.uponSanitizeElement,We,{tagName:an,allowedTags:Fi}),tv&&We.hasChildNodes()&&!o4(We.firstElementChild)&&Vl(/<[/\w!]/g,We.innerHTML)&&Vl(/<[/\w!]/g,We.textContent)||We.nodeType===lk.progressingInstruction||tv&&We.nodeType===lk.comment&&Vl(/<[/\w]/g,We.data))return il(We),!0;if(!(Yr.tagCheck instanceof Function&&Yr.tagCheck(an))&&(!Fi[an]||bn[an])){if(!bn[an]&&Tp(an)&&(zi.tagNameCheck instanceof RegExp&&Vl(zi.tagNameCheck,an)||zi.tagNameCheck instanceof Function&&zi.tagNameCheck(an)))return!1;if(bp&&!co[an]){let Dr=ye(We)||We.parentNode,Sa=te(We)||We.childNodes;if(Sa&&Dr){let Kr=Sa.length;for(let $a=Kr-1;$a>=0;--$a){let Cs=P(Sa[$a],!0);Cs.__removalCount=(We.__removalCount||0)+1,Dr.insertBefore(Cs,W(We))}}}return il(We),!0}return We instanceof s&&!kp(We)||(an==="noscript"||an==="noembed"||an==="noframes")&&Vl(/<\/no(script|embed|frames)/i,We.innerHTML)?(il(We),!0):(Rd&&We.nodeType===lk.text&&(Rt=We.textContent,SR([He,$e,br],Dr=>{Rt=rk(Rt,Dr," ")}),We.textContent!==Rt&&(ik(r.removed,{element:We.cloneNode()}),We.textContent=Rt)),Kl(Ue.afterSanitizeElements,We,null),!1)},m0=function(We,Rt,an){if(s0&&(Rt==="id"||Rt==="name")&&(an in i||an in i4))return!1;if(!($o&&!dn[Rt]&&Vl(Dt,Rt))){if(!(Yi&&Vl(wt,Rt))){if(!(Yr.attributeCheck instanceof Function&&Yr.attributeCheck(Rt,We))){if(!$n[Rt]||dn[Rt]){if(!(Tp(We)&&(zi.tagNameCheck instanceof RegExp&&Vl(zi.tagNameCheck,We)||zi.tagNameCheck instanceof Function&&zi.tagNameCheck(We))&&(zi.attributeNameCheck instanceof RegExp&&Vl(zi.attributeNameCheck,Rt)||zi.attributeNameCheck instanceof Function&&zi.attributeNameCheck(Rt,We))||Rt==="is"&&zi.allowCustomizedBuiltInElements&&(zi.tagNameCheck instanceof RegExp&&Vl(zi.tagNameCheck,an)||zi.tagNameCheck instanceof Function&&zi.tagNameCheck(an))))return!1}else if(!c0[Rt]){if(!Vl(ei,rk(an,Bt,""))){if(!((Rt==="src"||Rt==="xlink:href"||Rt==="href")&&We!=="script"&&EUe(an,"data:")===0&&Sp[We])){if(!(Pc&&!Vl(Ze,rk(an,Bt,"")))){if(an)return!1}}}}}}}return!0},Tp=function(We){return We!=="annotation-xml"&&cY(We,Xt)},Nc=function(We){Kl(Ue.beforeSanitizeAttributes,We,null);let{attributes:Rt}=We;if(!Rt||mx(We))return;let an={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:$n,forceKeepAttr:void 0},Dr=Rt.length;for(;Dr--;){let Sa=Rt[Dr],{name:Kr,namespaceURI:$a,value:Cs}=Sa,Xs=Oo(Kr),Fc=Cs,Ao=Kr==="value"?Fc:kUe(Fc);if(an.attrName=Xs,an.attrValue=Ao,an.keepAttr=!0,an.forceKeepAttr=void 0,Kl(Ue.uponSanitizeAttribute,We,an),Ao=an.attrValue,rx&&(Xs==="id"||Xs==="name")&&(Qm(Kr,We),Ao=UN+Ao),tv&&Vl(/((--!?|])>)|<\/(style|title|textarea)/i,Ao)){Qm(Kr,We);continue}if(Xs==="attributename"&&cY(Ao,"href")){Qm(Kr,We);continue}if(an.forceKeepAttr)continue;if(!an.keepAttr){Qm(Kr,We);continue}if(!o0&&Vl(/\/>/i,Ao)){Qm(Kr,We);continue}Rd&&SR([He,$e,br],vx=>{Ao=rk(Ao,vx," ")});let l4=Oo(We.nodeName);if(!m0(l4,Xs,Ao)){Qm(Kr,We);continue}if(me&&typeof k=="object"&&typeof k.getAttributeType=="function"&&!$a)switch(k.getAttributeType(l4,Xs)){case"TrustedHTML":{Ao=me.createHTML(Ao);break}case"TrustedScriptURL":{Ao=me.createScriptURL(Ao);break}}if(Ao!==Fc)try{$a?We.setAttributeNS($a,Kr,Ao):We.setAttribute(Kr,Ao),mx(We)?il(We):Jve(r.removed)}catch{Qm(Kr,We)}}Kl(Ue.afterSanitizeAttributes,We,null)},a4=function vn(We){let Rt=null,an=eg(We);for(Kl(Ue.beforeSanitizeShadowDOM,We,null);Rt=an.nextNode();)Kl(Ue.uponSanitizeShadowNode,Rt,null),gx(Rt),Nc(Rt),Rt.content instanceof o&&vn(Rt.content);Kl(Ue.afterSanitizeShadowDOM,We,null)};return r.sanitize=function(vn){let We=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Rt=null,an=null,Dr=null,Sa=null;if(ax=!vn,ax&&(vn="<!-->"),typeof vn!="string"&&!o4(vn))if(typeof vn.toString=="function"){if(vn=vn.toString(),typeof vn!="string")throw ok("dirty is not a string, aborting")}else throw ok("toString is not a function");if(!r.isSupported)return vn;if(a0||d0(We),r.removed=[],typeof vn=="string"&&(Zm=!1),Zm){if(vn.nodeName){let Cs=Oo(vn.nodeName);if(!Fi[Cs]||bn[Cs])throw ok("root node is forbidden and cannot be sanitized in-place")}}else if(vn instanceof l)Rt=r4("<!---->"),an=Rt.ownerDocument.importNode(vn,!0),an.nodeType===lk.element&&an.nodeName==="BODY"||an.nodeName==="HTML"?Rt=an:Rt.appendChild(an);else{if(!nv&&!Rd&&!Mc&&vn.indexOf("<")===-1)return me&&_p?me.createHTML(vn):vn;if(Rt=r4(vn),!Rt)return nv?null:_p?ke:""}Rt&&l0&&il(Rt.firstChild);let Kr=eg(Zm?vn:Rt);for(;Dr=Kr.nextNode();)gx(Dr),Nc(Dr),Dr.content instanceof o&&a4(Dr.content);if(Zm)return vn;if(nv){if(Cp)for(Sa=xe.call(Rt.ownerDocument);Rt.firstChild;)Sa.appendChild(Rt.firstChild);else Sa=Rt;return($n.shadowroot||$n.shadowrootmode)&&(Sa=Le.call(e,Sa,!0)),Sa}let $a=Mc?Rt.outerHTML:Rt.innerHTML;return Mc&&Fi["!doctype"]&&Rt.ownerDocument&&Rt.ownerDocument.doctype&&Rt.ownerDocument.doctype.name&&Vl(lue,Rt.ownerDocument.doctype.name)&&($a="<!DOCTYPE "+Rt.ownerDocument.doctype.name+`>
|
|
222
|
-
`+$a),Rd&&SR([He,$e,br],Cs=>{$a=rk($a,Cs," ")}),me&&_p?me.createHTML($a):$a},r.setConfig=function(){let vn=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};d0(vn),a0=!0},r.clearConfig=function(){Rc=null,a0=!1},r.isValidAttribute=function(vn,We,Rt){Rc||d0({});let an=Oo(vn),Dr=Oo(We);return m0(an,Dr,Rt)},r.addHook=function(vn,We){typeof We=="function"&&ik(Ue[vn],We)},r.removeHook=function(vn,We){if(We!==void 0){let Rt=xUe(Ue[vn],We);return Rt===-1?void 0:IUe(Ue[vn],Rt,1)[0]}return Jve(Ue[vn])},r.removeHooks=function(vn){Ue[vn]=[]},r.removeAllHooks=function(){Ue=rue()},r}var sk=sue();var cue={ADD_TAGS:["velt-skeleton-loader"],ADD_ATTR:["border-radius","target"]},Ve=(()=>{let r=class r{constructor(e,t,o,a){this.analyticsService=e,this.rendererFactory2=t,this.loggingService=o,this.sanitizer=a,this.isVideoEditorHandlingDelete=!1,this.pageScrollHeight=0,this.enableRectSelectionSubject$=new be(!1),this.enableRectSelection$=this.enableRectSelectionSubject$.asObservable(),this.scrollableElementsIds$=new be([]),this.mousedown=!1,this.windowMouseDown$=new nt,this.windowPointerMove$=new be(null),this.windowPointerUp$=new be(null),this.documentSelectionChange$=new be(null),this.windowClick$=new be(null),this.windowScroll$=new be(null),this.windowResize$=new be(null),this.windowKeyupBackspace$=new be(null),this.windowKeyupDelete$=new be(null),this.windowKeyupEsc$=new be(null),this.windowPopState$=new be(null),this.documentClick$=new be(null),this.documentClickSubject$=new nt,this.documentFocus$=new be(null),this.windowKeydownShift$=new be(null),this.windowKeyupShift$=new be(null),this.mutation$=new be(null),this.childListMutation$=new be(null),this.networkStatus$=new be(!1),this.xpathCache=new Map,this.xpathCacheId=new Map,this.selectedAnnotationsMap$=new be({}),this.selectedAnnotationsLocationMap$=new be({}),this.recordingInProgress$=new be({}),this.deleteAnnotations$=new be([]),this.pinHighlighterClass$=new be(null),this.dialogOpenedInSidebar$=new be(!1),this.textHighlighterClass$=new be(null),this.commentPinHighlighter$=new be(!1),this.deviceInfo$=new be(new ii),this.customCss$=new be(null),this.mutationObserver=null,this.animationFilterEnabled=!1,this.animationLibraryDetected=null,this.staticAnimationCache=new WeakMap,this.ANIMATION_LIBRARY_SELECTOR=["[data-gsap]",".gsap-marker-start",".gsap-marker-end","[data-gsap-id]",".swiper-slide",".swiper-wrapper",".swiper-pagination",".swiper-pagination-bullet","[data-aos]"].join(", "),this.previousMousePosition={pageX:0,pageY:0,clientX:0,clientY:0},this.currentMousePosition={pageX:0,pageY:0,clientX:0,clientY:0,element:{xpath:"",topPercentage:0,leftPercentage:0}},this.nodeMap={},this.unlistenElementScroll={},this.tabId=null,this.dynamicIdPatterns=[/^yui_[a-z0-9_]+$/i],this.excludeClassList=["show-pin-cursor"],this.filterSnippylyNodes=l=>{try{let s=[];return l.forEach(d=>{if(!lr(d))if(d instanceof HTMLElement){if(d.className.includes("cdk-overlay-container")||d.className.includes("cdk-overlay-connected-position-bounding-box"))return;if(d.className.includes("cdk-overlay")){let v=!1;d.childNodes.forEach(u=>{lr(u)&&(v=!0)}),v||s.push(d)}else s.push(d)}else s.push(d)}),s}catch(s){return this.loggingService.catch("Error in DomService filterSnippylyNodes: ",s),[]}},this.loggingService.log("%c[WB] Creating CLASS: DomService","color: blue;");try{this.analyticsService.setDomService(this),this.renderer=this.rendererFactory2.createRenderer(null,null);let l=this.calculateScreenSize();this.currentScreenSize$=new be(l),this.currentMousePosition$=new be(this.currentMousePosition),this.detectNetworkStatusChange(),this.getScrollableElementsIds$().pipe(Vi(),rn(([s,d])=>{try{let v=d.filter(S=>!s.includes(S)),u=s.filter(S=>!d.includes(S));u.length&&u.map(k=>document.getElementById(k)).filter(k=>k).forEach(k=>{this.unlistenElementScroll&&this.unlistenElementScroll[k.id]&&this.unlistenElementScroll[k.id]()}),v.length&&v.map(k=>document.getElementById(k)).filter(k=>k).forEach(k=>{this.unlistenElementScroll[k.id]=this.renderer.listen(k,"scroll",A=>{let P=this.calculateScreenSize();this.currentScreenSize$.next(P)})})}catch(v){this.loggingService.catch("Error in DomService getScrollableElementsIds subscription: ",v)}})).subscribe(()=>{},s=>{this.loggingService.catch("Error in DomService getScrollableElementsIds subscription: ",s)}),this.getSelectedAnnotationsMap$().subscribe(s=>{Object.keys(s||{})?.length?Mde("snippylyUserScalableNo","viewport","width=device-width, user-scalable=no"):Rde("snippylyUserScalableNo")},s=>{this.loggingService.catch("Error in DomService getSelectedAnnotationsMap$ subscription: ",s)})}catch(l){this.loggingService.catch("Error in DomService constructor: ",l)}}setDocService(e){try{this.docService=e,this.subscribeToDomEvents()}catch(t){this.loggingService.catch("Error in DomService setDocService: ",t)}}setDynamicIdPatterns(e){try{let t=e.map(o=>typeof o=="string"?new RegExp(o):o).filter(Boolean);t.length&&(this.dynamicIdPatterns=t)}catch(t){this.loggingService.catch("Error in DomService setDynamicIdPatterns: ",t)}}isLikelyDynamicId(e){try{return e?this.dynamicIdPatterns.some(t=>t.test(e)):!1}catch{return!1}}getStableAttributes(e){try{let t={};if(!e.getAttributeNames)return t;let o=new Set(["id","class","style"]);return e.getAttributeNames().forEach(l=>{if(o.has(l)||l.includes("snippyly")||l.includes("velt"))return;let s=e.getAttribute(l);s&&s.length<=256&&(t[l]=s)}),t}catch{return{}}}buildStableElementSelector(e,t){try{if(Object.keys(t).length===0)return;let a=[e.tagName?.toLowerCase()],l=["data-","aria-","role","name","title","type"];return Object.keys(t).sort((d,v)=>{let u=l.findIndex(k=>d.startsWith(k)),S=l.findIndex(k=>v.startsWith(k));return(u===-1?99:u)-(S===-1?99:S)}).slice(0,4).forEach(d=>{let v=CSS.escape(t[d]);a.push(`[${d}="${v}"]`)}),a.join("")}catch{return}}getVisibleText(e,t=400){try{let o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null),a="",l,s=0;for(;(l=o.nextNode())&&a.length<t;){let d=(l.textContent||"").replace(/\s+/g," ").trim();if(d&&(a+=(a?" ":"")+d),s++,s>100)break}return a.slice(0,t)}catch{return""}}hashText(e){try{return Sde(e)}catch{return}}generateRobustXPath(e,t){try{let o=t?.maxDepth||10,a=t?.useAbsolutePath||!1,l=[],s=e,d=0;for(;s&&s!==document.documentElement&&d<o;){let k=this.buildRobustXPathSegment(s);if(k&&(l.unshift(k),this.isStrongAnchorSegment(k)))break;s=s.parentElement,d++}if(l.length===0)return;let u=(a?"/":"//")+l.join("/");return l.some(k=>k.includes("[@")||k.includes("[contains(@class"))?u:void 0}catch{return}}buildRobustXPathSegment(e){try{let t=e.tagName.toLowerCase(),o=e.id;if(o&&!this.isLikelyDynamicId(o)&&document.querySelectorAll(`[id="${CSS.escape(o)}"]`).length===1)return`*[@id=${this.escapeXPathValue(o)}]`;let a=["data-region","data-instanceid","data-action","data-key","data-block","data-activityid"];for(let k of a){let A=e.getAttribute(k);if(A)return`${t}[@${k}=${this.escapeXPathValue(A)}]`}let l=Array.from(e.attributes).filter(k=>k.name.startsWith("data-")&&!k.name.includes("snippyly")&&!k.name.includes("velt")&&k.value.length<100).sort((k,A)=>k.value.length-A.value.length);if(l.length>0){let k=l[0];return`${t}[@${k.name}=${this.escapeXPathValue(k.value)}]`}let s=e.getAttribute("role");if(s)return`${t}[@role=${this.escapeXPathValue(s)}]`;let d=e.getAttribute("aria-label");if(d&&d.length<50)return`${t}[@aria-label=${this.escapeXPathValue(d)}]`;let v=e.getAttribute("name");if(v)return`${t}[@name=${this.escapeXPathValue(v)}]`;let u=e.getAttribute("type");if(u)return`${t}[@type=${this.escapeXPathValue(u)}]`;let S=Array.from(e.classList||[]).filter(k=>k.length>0&&k.length<40&&!k.includes("yui")&&!k.includes("velt")&&!k.includes("snippyly")&&!this.excludeClassList.includes(k)).slice(0,2);if(S.length>0){let k=S.map(A=>`contains(@class, ${this.escapeXPathValue(A)})`).join(" and ");return`${t}[${k}]`}if(e.parentElement){let k=Array.from(e.parentElement.children).filter(A=>A.tagName===e.tagName);if(k.length>1){let A=k.indexOf(e)+1;return`${t}[${A}]`}}return t}catch{return}}isStrongAnchorSegment(e){try{return!!(e.includes("[@id=")||["main","navigation","banner","contentinfo","complementary","search"].some(a=>e.includes(`[@role='${a}']`))||["data-region","data-instanceid","data-activityid"].some(a=>e.includes(`[@${a}=`)))}catch{return!1}}escapeXPathValue(e,t=!0){try{return e.includes("'")?e.includes('"')?`concat(${e.split("'").map(l=>`'${l}'`).join(`,"'",`)})`:t?`"${e}"`:e:t?`'${e}'`:e}catch{try{return`concat(${e.split("'").map(s=>`'${s}'`).join(`,"'",`)})`}catch{return t?`'${e}'`:e}}}getElementFromRobustXPath(e){try{return document.evaluate(e,document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue}catch{return null}}getAllElementsFromRobustXPath(e){try{let t=document.evaluate(e,document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null),o=[];for(let a=0;a<t.snapshotLength;a++){let l=t.snapshotItem(a);l instanceof Element&&o.push(l)}return o}catch{return[]}}generateAnchorRecord(e,t){try{let o=this.generateAnchorRecordForElement(e,t),a=null;if(e.parentElement&&e.parentElement instanceof HTMLElement&&$i(e.parentElement)&&e.parentElement!==document.body&&(a=e.parentElement),o&&a){let l=this.generateAnchorRecordForElement(a,t);l&&(o.parent=l)}return o}catch(o){return this.loggingService.catch("Error in DomService generateAnchorRecord: ",o),null}}generateAnchorRecordForElement(e,t){try{if(!e)return null;let o=e,a=o.tagName?.toUpperCase();if(!a)return null;let l=o.id&&!this.isLikelyDynamicId(o.id)?o.id:void 0,s=this.getStableAttributes(o),d=this.buildStableElementSelector(o,s),v=this.getVisibleText(o),u=this.hashText(v||""),S=this.generateRobustXPath(o),k=this.getXPath(o),A=this.getXPath(o,!0),P=this.getXPath(o,!0,!0);return{version:"1.0",id:l,tagName:a,elementSelector:d,robustXPath:S||void 0,xPath:k||void 0,fXPath:A||void 0,cfXPath:P||void 0,contentHash:u?{value:u,algorithm:"md5",source:"textContent"}:void 0,createdAt:Date.now()}}catch(o){return this.loggingService.catch("Error in DomService generateAnchorRecordForElement: ",o),null}}resolveAnchorRecord(e){try{let t=[],o=null,a=(u,S,k=0)=>{let A=[],P=k;if(A.push({method:S,score:k}),e.tagName&&u.tagName?.toUpperCase()===e.tagName&&(P+=10,A.push({method:"tagName-match",score:10})),e.contentHash?.value){let U=this.getVisibleText(u);this.hashText(U)===e.contentHash.value&&(P+=30,A.push({method:"contentHash-match",score:30}))}t.push({el:u,score:P,by:S,scoreBreakdown:A})};if(e.id){let u=document.querySelectorAll(`#${CSS.escape(e.id)}`);if(u.length===1)return{element:u[0],matchedBy:"id",score:90};u.length>1&&u.forEach(S=>a(S,"id-duplicate",70))}if(e.elementSelector){let u=document.querySelectorAll(e.elementSelector);if(u.length===1)return{element:u[0],matchedBy:"element-selector",score:80};u.forEach(S=>a(S,"element-selector-duplicate",60))}e.robustXPath&&this.getAllElementsFromRobustXPath(e.robustXPath).slice(0,20).forEach(A=>a(A,"robustXPath",50)),e?.parent&&(o=this.resolveAnchorRecord(e.parent),o.element&&o.element.querySelectorAll(e.tagName?.toLowerCase()||"*").forEach(S=>a(S,"parent+tag",40)));let l=(u,S,k)=>{if(!u)return;let A=this.getElementFromXPath(u);A&&a(A,S||"xpath",k||30)};if(l(e.xPath,"xPath",30),l(e.cfXPath,"cfXPath",30),l(e.fXPath,"fXPath",30),e.contentHash?.value&&t.length===0){let S=k=>{let A=0;for(let P=0;P<k.length&&A<400;P++){let U=k[P];if(A++,!this.isElementVisible(U))continue;let W=this.getVisibleText(U),te=this.hashText(W);te&&te===e.contentHash?.value&&a(U,"contentHash",15)}};if(o?.element&&o?.element instanceof Element){let k=o?.element?.querySelectorAll("*");S(k)}}if(!t.length)return{element:null};t.sort((u,S)=>S.score-u.score);let s=t[0].score,d=t.filter(u=>u.score===s);if(d.length>1){let u=[{path:e.xPath,label:"xPath"},{path:e.cfXPath,label:"cfXPath"},{path:e.fXPath,label:"fXPath"}];for(let S of u)if(S.path){let k=this.getElementFromXPath(S.path);if(k){let A=d.find(P=>P.el===k);if(A)return{element:A.el,matchedBy:`${A.by}+position`,score:A.score,scoreBreakdown:A.scoreBreakdown}}}}let v=t[0];return{element:v.el,matchedBy:v.by,score:v.score,scoreBreakdown:v.scoreBreakdown}}catch(t){return this.loggingService.catch("Error in DomService resolveAnchorRecord: ",t),{element:null}}}subscribeToDomEvents(){try{this.docService?.getDocumentPaths$().pipe(ge(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.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.unsubscribeFromDocumentFocus(),this.unsetMutationObserver())})).subscribe(),this.onDocumentClick()}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(t){this.loggingService.catch("Error in DomService setScrollableElementsIds: ",t)}}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.animationFilterEnabled=this.detectAnimationLibraries(),this.loggingService.log("%c[WB] Animation filter:","color: green;",this.animationFilterEnabled?"ENABLED (library detected)":"DISABLED (no library)"),this.mutationObserver=new MutationObserver(t=>{try{if(t?.find(a=>a?.attributeName===V.VELT_IGNORE_CHANGE_DETECTION))return;let o=t.filter(a=>a.type==="childList").filter(a=>{let l=a.target;return a.removedNodes.forEach(s=>{let d=s;if(typeof d.getAttribute=="function"){let v=d.getAttribute(V.ATTRIBUTES.VELT_ELEMENT_CACHE_ID);if(v!==null&&v!==""){let u=this.xpathCacheId.get(v);u!==void 0&&(this.xpathCacheId.delete(v),this.xpathCache.delete(u))}}}),lr(l)?!1:!!(this.filterSnippylyNodes(a.addedNodes).length||this.filterSnippylyNodes(a.removedNodes).length)});this.animationFilterEnabled?this.childListMutation$.next(o.filter(a=>!this.isAnimatingElement(a.target))):this.childListMutation$.next(o),o.push(...t.filter(a=>a.type==="attributes").filter(a=>!lr(a.target)).filter(a=>this.filterSnippylyNodes([a.target]).length).filter(a=>{if(a){let l=a.target;return l?.classList?.contains("snippyly-sidebar-panel")?!1:l?!l.getAttribute(V.VELT_IGNORE_CHANGE_DETECTION):!0}return!0})),o=o.filter(a=>{let l=!0;return Object.keys(V.INGNORE_MUTATION_OBSERVER_CHANGE_TAGS).forEach(s=>{a.target?.closest(s)&&(l=!1)}),l}),o=o.filter(a=>a.target&&$i(a.target)),this.animationFilterEnabled&&(o=o.filter(a=>!this.isAnimatingElement(a.target))),o.length&&this.mutation$.next(o)}catch(o){this.loggingService.catch("Error in DomService change detection: ",o)}}),this.mutationObserver.observe(document.body,{childList:!0,subtree:!0,attributes:!0}))}catch(t){this.loggingService.catch("Error in DomService change detection: ",t)}}detectAnimationLibraries(){try{if(this.animationLibraryDetected!==null)return this.animationLibraryDetected;let e=window;return e.gsap||e.TweenMax||e.TweenLite||e.TimelineMax||e.TimelineLite?(this.loggingService.log("%c[WB] Detected animation library: GSAP","color: green;"),this.animationLibraryDetected=!0,!0):e.Swiper?(this.loggingService.log("%c[WB] Detected animation library: Swiper","color: green;"),this.animationLibraryDetected=!0,!0):e.AOS?(this.loggingService.log("%c[WB] Detected animation library: AOS","color: green;"),this.animationLibraryDetected=!0,!0):e.anime?(this.loggingService.log("%c[WB] Detected animation library: Anime.js","color: green;"),this.animationLibraryDetected=!0,!0):e.lottie||e.Lottie||e.bodymovin?(this.loggingService.log("%c[WB] Detected animation library: Lottie","color: green;"),this.animationLibraryDetected=!0,!0):document.querySelector("[data-framer-component-type]")?(this.loggingService.log("%c[WB] Detected animation library: Framer Motion","color: green;"),this.animationLibraryDetected=!0,!0):document.querySelector(this.ANIMATION_LIBRARY_SELECTOR)?(this.loggingService.log("%c[WB] Detected animation library: DOM markers","color: green;"),this.animationLibraryDetected=!0,!0):(this.loggingService.log("%c[WB] No animation library detected","color: green;"),this.animationLibraryDetected=!1,!1)}catch{return this.animationLibraryDetected=!1,!1}}isAnimatingElement(e){try{if(!e||typeof e.closest!="function")return!1;let t=window;if(t.gsap&&typeof t.gsap.isTweening=="function"){if(t.gsap.isTweening(e))return!0;if(typeof t.gsap.getTweensOf=="function")try{if(t.gsap.getTweensOf(e).length>0)return!0}catch{}}else if(t.TweenMax&&typeof t.TweenMax.isTweening=="function"){if(t.TweenMax.isTweening(e))return!0;if(typeof t.TweenMax.getTweensOf=="function")try{if(t.TweenMax.getTweensOf(e).length>0)return!0}catch{}}let o=e.style?.cssText||"";if(o){let d=o.includes("transform")||o.includes("translate3d")||o.includes("translate(")||o.includes("scale3d")||o.includes("rotate"),v=o.includes("will-change")&&o.includes("transform"),u=o.includes("transform-style")&&o.includes("preserve-3d");if(d&&(v||u))return!0}if(e.style&&(e.style.animation!==""&&e.style.animation!=="none"||e.style.transition!==""&&e.style.transition!=="none")||e.classList?.contains("animate")||e.classList?.contains("animating")||e.classList?.contains("animated")||e.classList?.contains("animation"))return!0;let a=this.staticAnimationCache.get(e);if(a!==void 0)return a;let l=!1,s=e.className||"";return typeof s=="string"&&(s.includes("slider")&&(s.includes("bullet")||s.includes("pagination"))&&(l=!0),s.includes("swiper-pagination")&&(l=!0)),!l&&(e.hasAttribute("data-aos")||e.hasAttribute("data-motion"))&&(l=!0),!l&&e.closest(this.ANIMATION_LIBRARY_SELECTOR)&&(l=!0),this.staticAnimationCache.set(e,l),l}catch{return!1}}unsetMutationObserver(){try{this.mutationObserver&&(this.mutationObserver.disconnect(),this.mutationObserver=null,this.staticAnimationCache=new WeakMap,this.animationLibraryDetected=null,this.animationFilterEnabled=!1)}catch(e){this.loggingService.catch("Error in DomService unsetMutationObserver: ",e)}}detectNetworkStatusChange(){this.loggingService.log("%c[WB] Calling FUNCTION: detectNetworkStatusChange","color: green;");try{Sr(Oi(window,"offline").pipe(ge(()=>!1)),Oi(window,"online").pipe(ge(()=>!0)),new Gt(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 t=this.calculateScreenSize();this.deviceInfo$.next(new ii),this.currentScreenSize$.next(t)})}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 t=this.calculateScreenSize();this.currentScreenSize$.next(t)})}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()!==V.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 Oi(window,"keydown")}catch(e){return this.loggingService.catch("Error in DomService onWindowKeydown$: ",e),Js}}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 t=this.getXPath(e.target),o=e.target;if(t?.includes("name()='svg'")){let u=this.getXPath(t);u&&(o=u.iterateNext()||e.target)}let a=o.getBoundingClientRect(),l=e.clientX-a.x,s=e.clientY-a.y,d=l*100/(a.width||1),v=s*100/(a.height||1);this.currentMousePosition.element={xpath:t,topPercentage:v,leftPercentage:d}}else this.currentMousePosition.element=null;this.currentMousePosition$.next(this.currentMousePosition)}catch(t){this.loggingService.catch("Error in DomService updateCurrentMousePosition: ",t)}}getTargetElementForCursorPosition(e,t=!0,o=!1,a=!0,l,s=!0,d){try{let v=e,u=v?.touches?.length?v.touches[0]?.clientX:v?.clientX,S=v?.touches?.length?v.touches[0]?.clientY:v?.clientY;d&&(u=d.clientX,S=d.clientY);let k=this.getBackgroundElement(u,S,t,o);if(k&&l&&typeof l=="function"&&(k=l(k)),k){let A=this.getXPath(k),P=this.getXPath(k,!0),U=k.getBoundingClientRect(),W=u-U.x,te=S-U.y,ye=W*100/(U.width||1),me=te*100/(U.height||1),ke={xpath:A,fXpath:P,leftPercentage:ye,topPercentage:me};if(a){let De=this.getXPath(k,!0,!0);ke.cfXpath=De}if(s){let De=this.generateAnchorRecord(k);De&&(ke.anchor=De)}return ke}else return null}catch(v){return this.loggingService.catch("Error in DomService getTargetElementForCommentPinAnnotation: ",v),null}}getBackgroundElement(e,t,o=!0,a=!1){try{let l=document.elementsFromPoint(e,t),s=[];l.forEach(v=>{lr(v)?s=[]:$i(v)&&s.push(v)}),a&&(s=s.filter(v=>this.isElementVisibleOnScreen(v)));let d=0;return o||s?.forEach((v,u)=>{v.tagName.toLowerCase()==="svg"&&(d=u)}),s[d]}catch(l){return this.loggingService.catch("Error in DomService getBackgroundElement: ",l),null}}getBackgroundVeltElement(e,t){try{let o=document.elementsFromPoint(e,t),a=[];return o.forEach(l=>{lr(l)&&$i(l)&&a.push(l)}),a[0]}catch(o){return this.loggingService.catch("Error in DomService getBackgroundSnippylyElement: ",o),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(t){this.loggingService.catch("Error in DomService setPointerPosition: ",t)}}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(),t=this.currentMousePosition?.pageX||e.x+200,o=Math.min(t,e.width/2),a=Math.abs(e.y),l=e.y-20;return a>50&&(l=Math.abs(e.y)+180),this.loggingService.log(e),this.loggingService.log(o),this.loggingService.log(l),{topPositionX:o,topPositionY:l}}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,t,o){if(e){if(!o&&this.getCommentPinHighlighter()&&(this.pinHighlighterClass$.value?this.addClassToElement(e,this.pinHighlighterClass$.value):this.addClassToElement(e,V.SNIPPYLY_HIGHLIGHT)),t&&!e.hasAttribute(V.ATTRIBUTES.DEFAULT_CURSOR)){let a=e.style.getPropertyValue("cursor"),l=e.style.getPropertyPriority("cursor"),s=a?{defaultCursorValue:a,defaultCursorPriority:l}:"";e.setAttribute(V.ATTRIBUTES.DEFAULT_CURSOR,s?JSON.stringify(s):""),e.style.setProperty("cursor",t,"important")}e.setAttribute(V.SNIPPYLY_HIGHLIGHT,"true"),e.setAttribute(V.VELT_IGNORE_CHANGE_DETECTION,"true")}}removeHighlightFromElement(e){if(e&&(this.pinHighlighterClass$.value&&this.removeClassFromElement(e,this.pinHighlighterClass$.value),this.removeClassFromElement(e,V.SNIPPYLY_HIGHLIGHT),e.removeAttribute(V.SNIPPYLY_HIGHLIGHT),e.removeAttribute(V.VELT_IGNORE_CHANGE_DETECTION),e.hasAttribute(V.ATTRIBUTES.DEFAULT_CURSOR))){try{if(e.style.removeProperty("cursor"),e.getAttribute(V.ATTRIBUTES.DEFAULT_CURSOR)){let t=JSON.parse(e.getAttribute(V.ATTRIBUTES.DEFAULT_CURSOR));e.style.setProperty("cursor",t.defaultCursorValue,t.defaultCursorPriority)}}catch{}e.removeAttribute(V.ATTRIBUTES.DEFAULT_CURSOR)}}highlightUserElement(e,t,o,a=!1){try{e&&(this.addClassToElement(e,V.VELT_LIVE_SELECTION_ON_ELEMENT),a&&this.addClassToElement(e,V.VELT_LIVE_SELECTION_ON_ELEMENT_DEFAULT),e.setAttribute(V.SNIPPYLY_HIGHLIGHT,"true"),e.setAttribute(V.VELT_IGNORE_CHANGE_DETECTION,"true"),t&&!e.style.getPropertyValue(V.VELT_SELECTION_COLOR)&&e.style.setProperty(V.VELT_SELECTION_COLOR,t),o&&e.setAttribute(V.SNIPPYLY_HIGHLIGHT_USER_NAME,o))}catch(l){this.loggingService.catch("Error in DomService highlightUserElement: ",l)}}removeHighlightUserFromElement(e){try{e&&(this.removeClassFromElement(e,V.VELT_LIVE_SELECTION_ON_ELEMENT),this.removeClassFromElement(e,V.VELT_LIVE_SELECTION_ON_ELEMENT_DEFAULT),e.removeAttribute(V.SNIPPYLY_HIGHLIGHT),e.removeAttribute(V.VELT_IGNORE_CHANGE_DETECTION),e.removeAttribute(V.VELT_SELECTION_COLOR),e.removeAttribute(V.SNIPPYLY_HIGHLIGHT_USER_NAME),e.style.removeProperty(V.VELT_SELECTION_COLOR))}catch(t){this.loggingService.catch("Error in DomService removeHighlightUserFromElement: ",t)}}previewHighlightElement(e){e&&e.setAttribute(V.SNIPPYLY_HIGHLIGHT_PREVIEW,"true")}removePreviewHighlightFromElement(e){e&&e.removeAttribute(V.SNIPPYLY_HIGHLIGHT_PREVIEW)}getXPath(e,t=!1,o=!1,a){try{let l=this.calculateXPath(e,t,o,a);if(l&&typeof l=="string"&&l.includes("/svg")){let s=l.split("/"),d=!1;s.forEach((v,u)=>{v.includes("svg")&&(d=!0),d&&(s[u]="svg:"+v)}),l=s.join("/")}return l}catch(l){this.loggingService.catch("Error in DomService getXPath:",l)}}namespaceResolver(e){return e==="svg"?"http://www.w3.org/2000/svg":null}calculateXPath(e,t,o,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&&!t)return"//*[@id='"+e.id+"']";if(o&&e.className&&e.className.split){let s=e.className?.split(" ")?.filter(d=>!d?.includes("snippyly")&&!d?.includes("velt")&&!["show-pin-cursor"].includes(d))[0];if(s){let d=this.calculateXPath(e.parentNode,t,o,a)+"/"+e.tagName.toLowerCase(),v=Array.from(e.parentNode?.children||[]).filter(u=>u.nodeType===1&&u.tagName===e.tagName?u.className?.split(" ")?.filter(k=>k?.includes("snippyly")||k?.includes("velt")||["show-pin-cursor"].includes(k))[0]===s:!1);if(v.length>1){let u=v.indexOf(e)+1;d+=`[contains(concat(' ', normalize-space(@class), ' '), ' ${s} ')][${u}]`}else d+=`[contains(concat(' ', normalize-space(@class), ' '), ' ${s} ')]`;return d}}let l=[].filter.call(e.parentNode?.children?e.parentNode?.children:[],function(s){return s.tagName==e.tagName});return this.calculateXPath(e.parentNode,t,o)+"/"+e.tagName.toLowerCase()+(l.length>1?"["+([].indexOf.call(l,e)+1)+"]":"")}}catch(l){this.loggingService.catch("Error in DomService calculateXPath:",l)}}getElementFromXPath(e,t=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 o=this.getXPath(e,!1,!1,t);if(o){let a=o?.iterateNext();if(a!==null&&typeof a.setAttribute=="function"){let l=St();a.setAttribute(V.ATTRIBUTES.VELT_ELEMENT_CACHE_ID,l),this.xpathCacheId.set(l,e)}return this.xpathCache.set(e,a),a}return null}catch(o){return this.loggingService.catch("Error in DomService getElementFromXPath:",o),null}}getElementFromTargetElement(e){try{let t=null;if(e?.anchor){let o=this.resolveAnchorRecord(e.anchor);o?.element&&(t=o.element)}else e?.xpath?t=this.getElementFromXPath(e.xpath):e?.cfXpath?t=this.getElementFromXPath(e.cfXpath):e?.fXpath&&(t=this.getElementFromXPath(e.fXpath));return t}catch(t){return this.loggingService.catch("Error in DomService getElementFromTargetElement:",t),null}}getElementFromTargetTextRange(e){try{let t=null;if(e?.commonAncestorContainerAnchor){let o=this.resolveAnchorRecord(e.commonAncestorContainerAnchor);o?.element&&(t=o.element)}else e?.commonAncestorContainer&&(t=this.getElementFromXPath(e.commonAncestorContainer));return t}catch(t){return this.loggingService.catch("Error in DomService getElementFromTargetTextRange:",t),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],t=[document?.body?.clientWidth||0,document?.documentElement?.clientWidth||0,window?.innerWidth||0];this.calculatePageScrollHeight(),this.loggingService.log(this.pageScrollHeight),this.loggingService.log(this.nodeMap),this.highestNode=this.nodeMap[this.pageScrollHeight];let o=new JE;return o.screenWidth=Math.max(...t),o.screenHeight=Math.max(...e),o.screenScrollHeight=this.pageScrollHeight,o}catch(e){return this.loggingService.catch("Error in DomService calculateScreenSize:",e),new JE}}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 o=new DOMParser().parseFromString(e,"text/html");o.querySelectorAll("[data-snippyly-cache-id]").forEach(S=>{S.removeAttribute("data-snippyly-cache-id")}),o.querySelectorAll("[data-velt-cache-id]").forEach(S=>{S.removeAttribute("data-velt-cache-id")}),o.querySelectorAll(".comment-text-highlight").forEach(S=>{S?.parentNode?.insertBefore(document.createTextNode(S?.textContent),S),S.remove()});let d=document.createNodeIterator(o,NodeFilter.SHOW_COMMENT),v;for(;v=d.nextNode();)v?.remove();return this.mergeAdjacentTextNodes(o.body),this.sanitizeHtml(o.body.innerHTML)}catch(t){return this.loggingService.catch("Error in DomService removeSnippylyContent: ",t),e}}mergeAdjacentTextNodes(e){try{let t=e.firstChild;for(;t;){if(t.nodeType===Node.TEXT_NODE){let o=t.nextSibling;for(;o&&o.nodeType===Node.TEXT_NODE;)t.textContent+=o.textContent,o.remove(),o=t.nextSibling}t=t.nextSibling}}catch(t){this.loggingService.catch("Error in DomService mergeAdjacentTextNodes: ",t)}}findLongestNode(e){try{for(let t=e.length-1;t>=0;t--){if(e[t]?.scrollHeight&&e[t]?.clientHeight){let o=Math.max(e[t]?.scrollHeight,e[t]?.clientHeight);this.pageScrollHeight=Math.max(o,this.pageScrollHeight),this.nodeMap[o]=e[t]}e[t]?.childNodes?.length&&this.findLongestNode(e[t]?.childNodes)}}catch(t){this.loggingService.catch("Error in DomService findLongestNode: ",t)}}resetSelectedAnnotationsMap(e=!0,t){try{let o=Array.from(document.querySelectorAll(`[${V.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`)),a=this.getDraftCommentAnnotationDialogs()||[];o.push(...a),o=Array.from(new Set(o));let l=o.map(u=>u.classList.contains("velt-annotation-draft-checked")?(u.classList.remove("velt-annotation-draft-checked"),null):(this.removeClassFromElement(u,"velt-comment-dialog-shake"),setTimeout(()=>{this.addClassToElement(u,"velt-comment-dialog-shake"),u.getAttribute(V.ATTRIBUTES.VELT_ANNOTATION_EDIT_COMMENT)||u.classList.contains("velt-annotation-draft-checked")||this.addClassToElement(u,"velt-annotation-draft-checked")},100),u.getAttribute(V.ATTRIBUTES.VELT_ANNOTATION_DRAFT))).filter(u=>u),s=Object.keys(this.getRecordingInProgress()||{});l=[...l,...s];let d=this.selectedAnnotationsMap$.value;if(e&&this.selectedAnnotationsMap$.value&&Object.keys(this.selectedAnnotationsMap$.value).length){let u=[];Object.keys(d).forEach(S=>{if(d[S]?.type==="tag"){let k=d[S];k?.to?.length||l.includes(S)||u.push(k)}else d[S]?.comments?.length||l.includes(S)||u.push(d[S])}),this.deleteAnnotations$.next(u),this.deleteAnnotations$.next([])}let v={};Object.keys(d).forEach(u=>{if(l.includes(u)&&(v[u]=d[u]),t)switch(t){case"comment":["comment","videoPin"].includes(d[u]?.type)||(v[u]=d[u]);break;default:d[u]?.type!==t&&(v[u]=d[u]);break}}),Object.keys(v).forEach(u=>{let S=v[u]?.multiThreadAnnotationId;S&&!v[S]&&(v[S]={annotationId:S,type:"multiThread"})}),JSON.stringify(this.selectedAnnotationsMap$.value)!==JSON.stringify(v)&&this.selectedAnnotationsMap$.next(v),this.setDialogOpenedInSidebar(!1)}catch(o){this.loggingService.catch("Error in DomService resetSelectedAnnotationsMap: ",o)}}setRecordingInProgress(e,t){try{if(t)this.recordingInProgress$.next(E(b({},this.recordingInProgress$.value),{[e]:t}));else{let o=this.recordingInProgress$.value;delete o[e],this.recordingInProgress$.next(o)}}catch(o){this.loggingService.catch("Error in DomService setRecordingInProgress: ",o)}}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=[],t=Array.from(document.querySelectorAll(`${V.TAGS.SNIPPYLY_COMMENT_DIALOG}`)),o=Array.from(document.querySelectorAll(`${V.TAGS.VELT_COMMENT_DIALOG}`));return[...t,...o].forEach(l=>{if(l?.shadowRoot){let s=l.shadowRoot.querySelector(`[${V.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);s&&e.push(s)}else{let s=l.querySelector(`${V.TAGS.VELT_SHADOW_DOM_INTERNAL}`);if(s?.shadowRoot){let d=s.shadowRoot?.querySelector(`[${V.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);d&&e.push(d)}else{let d=l.querySelector(`[${V.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);d&&e.push(d)}}}),e}catch(e){return this.loggingService.catch("Error in DomService getDraftCommentAnnotationDialogs: ",e),[]}}getSelectedAnnotationsMap(e){try{let t=this.selectedAnnotationsMap$.value;if(e){let o={};return Object.keys(t).forEach(a=>{switch(e){case"comment":["comment","videoPin"].includes(t[a].type)&&(o[a]=t[a]);break;default:t[a].type===e&&(o[a]=t[a]);break}}),o}else return t}catch(t){return this.loggingService.catch("Error in DomService getSelectedAnnotationsMap: ",t),{}}}getSelectedAnnotationsMap$(e){return this.selectedAnnotationsMap$.asObservable().pipe(ge(t=>{if(e){let o={};return Object.keys(t).forEach(a=>{t[a].type===e&&(o[a]=t[a])}),o}else return t}))}getSelectedComments$(){return this.selectedAnnotationsMap$.asObservable().pipe(ge(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,t,o,a=!1,l){try{o==="sidebarShowReplies"?this.setDialogOpenedInSidebar(!0):this.setDialogOpenedInSidebar(!1);let s=JSON.parse(JSON.stringify(this.selectedAnnotationsMap$.value||{})),d=JSON.parse(JSON.stringify(this.selectedAnnotationsLocationMap$.value||{}));s[e.annotationId]&&!a?delete s[e.annotationId]:((!this.windowKeydownShift$.value||a)&&(s={}),s[e.annotationId]=e,d[e.annotationId]=t,l=e?.multiThreadAnnotationId||l,l&&(s[l]={annotationId:l,type:"multiThread"},d[l]=t)),this.selectedAnnotationsMap$.next(s),Object.keys(d).forEach(v=>{s[v]||delete d[v]}),this.selectedAnnotationsLocationMap$.next(d)}catch(s){this.loggingService.catch("Error in DomService toggleAnnotationSelection: ",s)}}setSelectedAnnotationLocation(e,t){try{let o=JSON.parse(JSON.stringify(this.getSelectedAnnotationsLocationMap()||{}));o?.[e]!==t&&(o[e]=t,this.selectedAnnotationsLocationMap$.next(o))}catch(o){this.loggingService.catch("Error in DomService setSelectedAnnotationLocation: ",o)}}updateSelectedAnnotationInMap(e){try{let t=this.selectedAnnotationsMap$.value;e.forEach(o=>{t[o.annotationId]&&(t[o.annotationId]=o)}),this.selectedAnnotationsMap$.next(t)}catch(t){this.loggingService.catch("Error in DomService updateSelectedAnnotationInMap: ",t)}}getDeleteCommmentAnnotations$(){try{return this.deleteAnnotations$.asObservable()}catch(e){return this.loggingService.catch("Error in DomService getDeleteCommmentAnnotations$: ",e),ce([])}}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(t){return this.loggingService.catch("Error in DomService onDomChange$: ",t),ce([])}}getChildListMutation$(){return this.childListMutation$.asObservable()}onNetworkStatusChange$(){return this.networkStatus$.asObservable()}getNetworkStatus(){return this.networkStatus$.value}getElementOffset(e,t){try{let o={offsetTop:0,offsetLeft:0},a=e;if(a===t){let l=window.getComputedStyle(e);l.position==="static"&&l.transformStyle!="preserve-3d"&&l.transform=="none"&&(o.offsetLeft=e?.offsetLeft||0,o.offsetTop=e?.offsetTop||0)}if(a!==t)if(e?.closest("svg"))for(;a&&a!==t;){let s=window.getComputedStyle(a);if(a.tagName.toLowerCase()==="svg"||a instanceof SVGElement){let d=a.parentElement;if(d){let v=d.getBoundingClientRect(),u=a.getBoundingClientRect();o.offsetLeft+=u.left-v.left,o.offsetTop+=u.top-v.top}}else s.position==="static"?s.transformStyle!="preserve-3d"&&s.transform=="none"&&(o.offsetLeft+=a?.offsetLeft||0,o.offsetTop+=a?.offsetTop||0):(o.offsetLeft+=a.offsetLeft,o.offsetTop+=a.offsetTop);if(a=a.parentElement,e instanceof SVGElement&&a===t){let d=window.getComputedStyle(a);d.position==="static"&&d.transformStyle!="preserve-3d"&&d.transform=="none"&&(o.offsetLeft+=a?.offsetLeft||0,o.offsetTop+=a?.offsetTop||0)}}else{let s=window.getComputedStyle(a);s.position==="static"?s.transformStyle!="preserve-3d"&&s.transform=="none"&&(o.offsetLeft+=a?.offsetLeft||0,o.offsetTop+=a?.offsetTop||0):(o.offsetLeft+=a.offsetLeft,o.offsetTop+=a.offsetTop)}return o}catch(o){return this.loggingService.catch("Error in DomService getElementOffset: ",o),{offsetTop:0,offsetLeft:0}}}isElementVisible(e){try{if(typeof e?.getBoundingClientRect=="function"){let{width:t,height:o,top:a,bottom:l}=e?.getBoundingClientRect();return t>0||o>0||a<window.innerHeight&&l>0}else return!1}catch(t){return this.loggingService.catch("Error in DomService isElementVisible: ",t),!1}}isElementVisibleOnScreen(e){try{if(e){if(!(e instanceof Element))return!1;let t=e,o=window.getComputedStyle(t);return!(o.display==="none"||o.visibility==="hidden"||parseFloat(o.opacity)===0)}return!1}catch(t){return this.loggingService.catch("Error in DomService isElementVisibleOnScreen: ",t),!1}}getClickAndDragPointsObservable(){return new Gt(e=>{let t=Oi(document,"mousedown").pipe(ge(d=>({type:d.type,x:d.clientX+window.scrollX,y:d.clientY+window.scrollY,event:d}))),o=Oi(document,"mousemove").pipe(ge(d=>({type:d.type,x:d.clientX+window.scrollX,y:d.clientY+window.scrollY,event:d}))),a=Oi(document,"mouseup").pipe(ge(d=>({type:d.type,x:d.clientX+window.scrollX,y:d.clientY+window.scrollY,event:d}))),s=t.pipe(fe(d=>o.pipe(Vi(),ge(([v,u])=>({startPoint:d,prevPoint:v,curPoint:u})),Ar(a)))).subscribe(e);return()=>s.unsubscribe()})}drawRectangle(e,t){let o=document.querySelector(".rectangle");o||(o=document.createElement("div"),this.addClassToElement(o,"rectangle"),o.setAttribute(V.ATTRIBUTES.VELT_COMMENT_DISABLED,"true"),o.setAttribute(V.VELT_IGNORE_CHANGE_DETECTION,"true"),document.body.appendChild(o));let a=Math.abs(t.x-e.x),l=Math.abs(t.y-e.y),s=Math.min(e.x,t.x),d=Math.min(e.y,t.y);return o.style.width=`${a}px`,o.style.height=`${l}px`,o.style.left=`${s}px`,o.style.top=`${d}px`,o.style.position="absolute",o.style.border="2px dashed #f00",o.style.pointerEvents="none",o.style.zIndex="2147483577",o}getRange(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: getRange","color: green;"),window.getSelection()?.toString()){let 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 t={},o=e.commonAncestorContainer;o?.nodeType===Node.TEXT_NODE&&(o=o.parentElement);let a=document.body;if(o){let s=this.getTextXPath(o);this.isXpathWithId(s)&&(a=o)}let l=this.getAdditionalLocationContainer(o);if(l&&(a=l),t.commonAncestorContainer=this.getTextXPath(a),t.commonAncestorContainer){let s=this.getElementFromXPath(t.commonAncestorContainer);if(s){t.commonAncestorContainerFXpath=this.getXPath(s,!0),t.commonAncestorContainerCFXpath=this.getXPath(s,!0,!0);let d=this.generateAnchorRecord(s);d&&(t.commonAncestorContainerAnchor=d)}}return t.text=e.toString(),t.occurrence=tf(a,0,e.startContainer,e.startOffset,e.toString())+1,t}catch(t){this.loggingService.catch("Error in DomService getTargetTextRangeFromSelectionRange: ",t);return}}getTextXPath(e){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: getTextXPath","color: green;"),e.nodeType===Node.TEXT_NODE){let t=1,o=e.previousSibling;for(;o;)o.nodeType===Node.TEXT_NODE&&t++,o=o.previousSibling;return this.getXPath(e.parentElement)}else return this.getXPath(e)}catch(t){this.loggingService.catch("Error in DomService getTextXPath: ",t);return}}getHostElement(e){try{if(V.NON_NESTABLE_ELEMENTS[e?.tagName?.toLowerCase()]){let o=e?.closest("picture");return o?o?.parentElement:e.parentElement}let t=e.closest("svg");return t?t?.parentElement:e}catch(t){return this.loggingService.catch("Error in DomService getHostElement: ",t),e}}isElementInsideAdditionalLocationContainer(e){try{return!!e?.closest(`[${V.ATTRIBUTES.VELT_LOCATION}], [${V.ATTRIBUTES.VELT_LOCATION_ID}]`)}catch(t){return this.loggingService.catch("Error in DomService isElementInsideAdditionalLocationContainer: ",t),!1}}getAdditionalLocationContainer(e){try{return e?.closest(`[${V.ATTRIBUTES.VELT_LOCATION}], [${V.ATTRIBUTES.VELT_LOCATION_ID}]`)||null}catch(t){return this.loggingService.catch("Error in DomService getAdditionalLocationContainer: ",t),null}}isXpathWithId(e){try{return typeof e=="string"?!!e?.includes("[@id="):!1}catch(t){return this.loggingService.catch("Error in DomService isXpathWithId: ",t),!1}}getListedElements({elementIds:e,elementClassNames:t,elementQuerySelectors:o}){try{let a=[];if(e?.length)for(let l=0;l<e.length;l++){let s=document.getElementById(e[l]);s&&a.push(s)}if(t?.length)for(let l=0;l<t.length;l++){let s=document.getElementsByClassName(t[l]);for(let d=0;d<s.length;d++){let v=s[d];v&&v instanceof HTMLElement&&a.push(v)}}if(o?.length)for(let l=0;l<o.length;l++){let s=document.querySelectorAll(o[l]);for(let d=0;d<s.length;d++){let v=s[d];v&&v instanceof HTMLElement&&a.push(v)}}return a}catch(a){return this.loggingService.catch("Error in DomService getListedElements: ",a),[]}}isElementInsideListedElementIds(e,t){try{if(t?.length){for(let o=0;o<t.length;o++){let a=document.getElementById(t[o]);if(a&&a.contains(e))return!0}return!1}return!0}catch(o){return this.loggingService.catch("Error in DomService isElementInsideListedElementIds: ",o),!1}}isElementInsideListedElementClassNames(e,t){try{if(t?.length){for(let o=0;o<t.length;o++){let a=document.getElementsByClassName(t[o]);for(let l=0;l<a.length;l++)if(a[l].contains(e))return!0}return!1}return!0}catch(o){return this.loggingService.catch("Error in DomService isElementInsideListedElementClassNames: ",o),!1}}isElementInsideListedElementQuerySelectors(e,t){try{if(t?.length){for(let o=0;o<t.length;o++){let a=document.querySelectorAll(t[o]);for(let l=0;l<a.length;l++)if(a[l].contains(e))return!0}return!1}return!0}catch(o){return this.loggingService.catch("Error in DomService isElementInsideListedElementQuerySelectors: ",o),!1}}addClassToElement(e,t){try{this.loggingService.log("%c[WB] Calling FUNCTION: addClassToElement","color: green;"),e&&(e.classList?.contains(t)||e.classList?.add(t))}catch(o){this.loggingService.catch("Error in DomService addClassToElement: ",o)}}removeClassFromElement(e,t){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeClassFromElement","color: green;"),e&&e.classList?.contains(t)&&e.classList?.remove(t)}catch(o){this.loggingService.catch("Error in DomService removeClassFromElement: ",o)}}isElementInsideParentWithAttribute(e,t,o){try{let a=e;for(;a&&a!==document.body;){if(a?.getAttribute&&a?.getAttribute(t)===o)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(t){this.loggingService.catch("Error in DomService setVideoEditorHandlingDelete: ",t)}}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(t){this.loggingService.catch("Error in DomService setCustomCss: ",t)}}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),ce(null)}}injectCustomCss(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: injectCustomCss","color: green;");let t=this.customCss$.value;if(t){let o=e?.shadowRoot?.querySelector(`[${V.VELT_CUSTOM_CSS}]`);if(o&&o.remove(),t?.type==="link"){let a=document.createElement("link");a.href=t?.value,a.rel="stylesheet",a.setAttribute(V.VELT_CUSTOM_CSS,"true"),e?.shadowRoot?.appendChild(a)}else{let a=document.createElement("style");a.innerHTML=this.sanitizeHtml(t?.value),a.setAttribute(V.VELT_CUSTOM_CSS,"true"),e?.shadowRoot?.appendChild(a)}}}catch(t){this.loggingService.catch("Error in DomService injectCustomCss: ",t)}}trimCommentHtml(e){try{let t=document.createElement("div");t.innerHTML=e,this.removeEmptyElements(t);let o=t.innerHTML;return o=o.replace(r.MULTIPLE_NBSP_REGEX," ").replace(r.TRIM_NBSP_REGEX,"").trim(),o}catch(t){return this.loggingService.catch("Error in DomService trimCommentHtml: ",t),e}}removeEmptyElements(e){try{let a=function(l){return o.test(l.innerHTML)};var t=a;let o=/^\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(o){this.loggingService.catch("Error in DomService removeEmptyElements: ",o)}}normalizeWhitespace(e){try{e.childNodes.forEach(t=>{t.nodeType===Node.TEXT_NODE?t.nodeValue=t.nodeValue?.replace(/\s+/g," ").trim()??"":t.nodeType===Node.ELEMENT_NODE&&this.normalizeWhitespace(t)})}catch(t){this.loggingService.catch("Error in DomService normalizeWhitespace: ",t)}}sanitizeHtml(e){try{return this.loggingService.log("%c[WB] Calling FUNCTION: sanitizeHtml","color: green;"),sk.sanitize(e,cue)}catch(t){return this.loggingService.catch("Error in DomService sanitizeHtml: ",t),""}}sanitizeSvg(e){try{return sk.sanitize(e,cue)}catch(t){return this.loggingService.catch("Error in DomService sanitizeSvg: ",t),e}}setDeviceInfo(){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDeviceInfo","color: green;");let e=new ii;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),ce(new ii)}}getTabId(){try{let e=sessionStorage.getItem(V.SESSION_STORAGE.VELT_TAB_ID);!e&&this.tabId&&(e=this.tabId,sessionStorage.setItem(V.SESSION_STORAGE.VELT_TAB_ID,e)),!this.tabId&&e&&(this.tabId=e);let t=this.getTabIdFromWindowName();return(!e||e!==t)&&(e=St(),this.tabId=e,sessionStorage.setItem(V.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(t){this.loggingService.catch("Error in DomService setTabIdToWindowName: ",t)}}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 ii}}isMobileDevice(){try{return new ii().getDeviceType()===To.MOBILE}catch(e){return this.loggingService.catch("Error in DomService isMobileDevice: ",e),!1}}isTabletDevice(){try{return new ii().getDeviceType()===To.TABLET}catch(e){return this.loggingService.catch("Error in DomService isTabletDevice: ",e),!1}}isDesktopDevice(){try{return new ii().getDeviceType()===To.DESKTOP}catch(e){return this.loggingService.catch("Error in DomService isDesktopDevice: ",e),!1}}deepCloneElement(e){try{var t=document.createElement(e?.tagName);return Array.from(e.attributes).forEach(o=>{t.setAttribute(o.nodeName,o.nodeValue)}),e.childNodes.forEach(o=>{o.nodeType===Node.ELEMENT_NODE?t.appendChild(this.deepCloneElement(o)):o.nodeType===Node.TEXT_NODE&&t.appendChild(document.createTextNode(o.nodeValue))}),t}catch(o){return this.loggingService.catch("Error in DomService deepCloneElement: ",o),e}}setRandomNumberToElementRecursive(e){try{if(!e)return;let t=Math.random().toString(36).substring(7);e&&e.setAttribute&&typeof e.setAttribute=="function"&&(e.getAttribute("velt-wireframe-id")||e.setAttribute("velt-wireframe-id",t)),Array.from(e.children).forEach(a=>{this.setRandomNumberToElementRecursive(a)})}catch(t){this.loggingService.catch("Error in DomService setRandomNumberToElementRecursive: ",t)}}setDialogOpenedInSidebar(e){this.dialogOpenedInSidebar$.next(e)}getDialogOpenedInSidebar(){return this.dialogOpenedInSidebar$.asObservable()}removeWireframeSuffixFromTags(e){if(!e)return;Array.from(e.children).forEach(o=>{if(this.removeWireframeSuffixFromTags(o),o.tagName.toLowerCase().endsWith("-wireframe")){let a=o.tagName.toLowerCase().replace("-wireframe",""),l=document.createElement(a);for(Array.from(o.attributes).forEach(s=>{l.setAttribute(s.name,s.value)});o.firstChild;)l.appendChild(o.firstChild);o.parentNode.replaceChild(l,o)}})}isMonitorDevice(){try{return new ii().getDeviceType()===To.MONITOR}catch(e){return this.loggingService.catch("Error in DomService isMonitorDevice: ",e),!1}}};r.MULTIPLE_NBSP_REGEX=/(?: \s*){2,}/g,r.TRIM_NBSP_REGEX=/^(?: \s*)+|(?: \s*)+$/g,r.\u0275fac=function(t){return new(t||r)(J(rt),J(go),J(x),J(Jc))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var Ge=(()=>{let r=class r{constructor(e,t,o,a,l,s,d,v){this.afAuth=e,this.configService=t,this.avatarService=o,this.coreActionsService=a,this.domService=l,this.functions=s,this.analyticsService=d,this.loggingService=v,this.user$=new be(null),this.userOptions$=new be(null),this.userContacts$=new be(null),this.userOrganization$=new be(null),this.isPrivateCommentsEnabled$=new be(!1),this.providedUser=new Vo,this.firebaseConfig$=new be(null),this.advancedQueries$=new be(null),this.planDetails$=new be(null),this.signOutPreviousUser$=new be(null),this.preSignOutFunctions=new Map,this.autoLoginCalled=!1,this.autoLoginRequired=!0,this.config=null,this.getPlanDetailsCalled=!1,this.forceReLoggedIn=!1,this.lastLoggedInUserData=null,this.sessionReLoginCount=0,this.SESSION_RE_LOGIN_COUNT_LIMIT=10,this.sessionReLoginSubscription=null,this.onRetrySubscription=null,this.TOKEN_EXPIRED_ERROR_COUNT_LIMIT=3,this.tokenExpiredErrorCount=0,this.loggingService.log("%c[WB] Creating CLASS: AuthService","color: blue;");try{this.analyticsService.setAuthService(this),this.configService.getConfig$().subscribe(u=>{this.config=u}),this.forceReLoggedIn=localStorage.getItem(V.LOCAL_STORAGE.VELT_USER_FORCE_RE_LOGGED_IN)==="true",this.sessionReLoginSubscription=mi(this.afAuth).pipe(yr(this.afAuth.currentUser),Vi(),fe(([u,S])=>this.domService.onNetworkStatusChange$().pipe(je(k=>k),st(1),ge(()=>({previousUser:u,currentUser:S}))))).subscribe(k=>X(this,[k],function*({previousUser:u,currentUser:S}){if(!S&&u){let A=u?.stsTokenManager?.expirationTime,P=new Date().getTime(),U=A-P;P>A&&(this.analyticsService.trackEvent(Y.Events.Core.SDK_SESSION_TOKEN_EXPIRED,{apiKey:this.apiKey,user:this.user$.value,lastLoggedInUserData:this.lastLoggedInUserData,timeLeft:U,forceReset:this.userOptions$.value?.forceReset,sessionReLoginCount:this.sessionReLoginCount},!0,this.user$.value?.userSnippylyId),this.user$.value&&u?.uid===this.user$.value?.userSnippylyId&&this.lastLoggedInUserData?.user?.userSnippylyId===this.user$.value?.userSnippylyId&&(this.sessionReLoginCount>this.SESSION_RE_LOGIN_COUNT_LIMIT?(this.analyticsService.trackEvent(Y.Events.Core.SDK_SESSION_RE_LOGIN_COUNT_EXCEEDED,{apiKey:this.apiKey,clientUserId:this.lastLoggedInUserData.user.userId,snippylyUserId:this.lastLoggedInUserData.user.userSnippylyId,timeLeft:U,forceReset:this.userOptions$.value?.forceReset,sessionReLoginCount:this.sessionReLoginCount},!0,this.user$.value?.userSnippylyId),this.sessionReLoginSubscription?.unsubscribe()):(this.sessionReLoginCount++,this.analyticsService.trackEvent(Y.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:U,forceReset:this.userOptions$.value?.forceReset,sessionReLoginCount:this.sessionReLoginCount},!0,this.lastLoggedInUserData.user.userSnippylyId),this.lastLoggedInUserData.user=yield this.updateUserWithColorAndTextColor(this.lastLoggedInUserData.user),this.initializeClient(this.lastLoggedInUserData.user,this.lastLoggedInUserData.userOptions,this.lastLoggedInUserData.initializeClientToken,this.lastLoggedInUserData.autoLogin,"internal-sessionReLogin"))))}}),u=>{this.loggingService.catch("Error in AuthService sessionReLoginSubscription: ",u)}),this.getUser$().pipe(xt(Qt)).subscribe(u=>{let S=Co(u);this.coreActionsService.triggerAction(ut.USER_UPDATE,S),this.coreActionsService.triggerAction(ut.INIT_UPDATE,{event:ut.USER_UPDATE,payload:{user:S}})})}catch(u){this.loggingService.catch("Error in AuthService constructor: ",u)}}setApiKey(e,t){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),t||(t=new lR),this.configService.initConfig(t),t.debugMode?sessionStorage.setItem("debugMode","true"):sessionStorage.removeItem("debugMode"),this.autoLoginCalled||mi(this.afAuth).pipe(st(1)).subscribe(o=>X(this,null,function*(){if(this.autoLoginCalled=!0,o){let a=yield gm(o,!0).catch(l=>null);if(a){let{user:l}=a?.claims;this.autoLoginRequired&&(l=yield this.updateUserWithColorAndTextColor(l),this.initializeClient(l,this.userOptions$?.value?E(b({},this.userOptions$?.value),{replaceContacts:!1,replaceGroupContacts:!1,replacePrivateContacts:!1}):{},new Date().getTime(),!0,"internal-autoLogin"))}}}))}catch(o){this.loggingService.catch("Error in setApiKey: ",o)}}setUsersService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setUsersService","color: green;"),this.usersService=e}catch(t){this.loggingService.catch("Error in setUsersService: ",t)}}setUserPermissionService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setUserPermissionService","color: green;"),this.userPermissionService=e}catch(t){this.loggingService.catch("Error in setUserPermissionService: ",t)}}setDocService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocService","color: green;"),this.docService=e}catch(t){this.loggingService.catch("Error in setDocService: ",t)}}setContactService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setContactService","color: green;"),this.contactService=e}catch(t){this.loggingService.catch("Error in setContactService: ",t)}}setIamService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setIamService","color: green;"),this.iamService=e}catch(t){this.loggingService.catch("Error in setIamService: ",t)}}setAreaService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setAreaService","color: green;"),this.areaService=e}catch(t){this.loggingService.catch("Error in setAreaService: ",t)}}setCommentService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setCommentService","color: green;"),this.commentService=e}catch(t){this.loggingService.catch("Error in setCommentService: ",t)}}setReactionService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setReactionService","color: green;"),this.reactionService=e}catch(t){this.loggingService.catch("Error in setReactionService: ",t)}}setRecorderAnnotationService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setRecorderAnnotationService","color: green;"),this.recorderAnnotationService=e}catch(t){this.loggingService.catch("Error in setRecorderAnnotationService: ",t)}}setViewsService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setViewsService","color: green;"),this.viewsService=e}catch(t){this.loggingService.catch("Error in setViewsService: ",t)}}setCommonDbService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setCommonDbService","color: green;"),this.commonDbService=e}catch(t){this.loggingService.catch("Error in setCommonDbService: ",t)}}validateOrganizationId(e){if(this.isVersionGreaterThanOrEqualTo4()&&!e?.organizationId)if(this.analyticsService.trackEvent(Y.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")}setVeltAuthProvider(e){return X(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: setVeltAuthProvider","color: green;");try{this.onRetrySubscription?.unsubscribe();let t=null;if(!e.user)return null;e.generateToken&&typeof e.generateToken=="function"&&(t=yield e.generateToken());let o=yield AG(()=>window.Velt.identify(e.user,b(b({},e.options||{}),t&&{authToken:t}),{fromProvider:!0}).catch(a=>(e.onError&&typeof e.onError=="function"&&e.onError(a),Promise.reject(a))),e.retryConfig||{retryCount:0,retryDelay:0});return o&&e.generateToken&&typeof e.generateToken=="function"&&(this.onRetrySubscription=this.coreActionsService.onAction(ut.ERROR).pipe(je(a=>a.code==="token_expired"),st(10)).subscribe(a=>X(this,null,function*(){if(a.code==="token_expired"){let l=this.docService?.getDocumentIds()?.map(k=>({id:k.clientDocumentId}))??[],s=this.docService?.getOptionsFromDocumentPaths()??void 0,d=[],v=this.docService?.getLocation();v&&d.push(v.location);let u=this.docService?.getLocations();u&&Object.values(u).forEach(k=>{d.push(k.location)}),(yield AG(()=>X(this,null,function*(){try{let k=yield e.generateToken?.();return k?window.Velt.identify(e.user,b(b({},e.options||{}),k&&{authToken:k}),{fromProvider:!0}):!0}catch{return!1}}),e.retryConfig||{retryCount:0,retryDelay:0}))&&(yield this.docService?.setDocuments({documents:l,options:s,source:"internal"}),yield this.docService?.setLocations({locations:d,source:"internal",options:{appendLocation:!v}}))}}))),o}catch(t){return this.loggingService.catch("Error in setVeltAuthProvider: ",t),null}})}setUserToStorage(e){return X(this,null,function*(){try{if(e){let t=yield Us(e,e?.userId??"");localStorage.setItem(V.LOCAL_STORAGE.VELT_IDENTIFY_USER,t)}}catch(t){this.loggingService.catch("Error in setUserToStorage: ",t)}})}getUserFromStorage(e){return X(this,null,function*(){try{let t=localStorage.getItem(V.LOCAL_STORAGE.VELT_IDENTIFY_USER);return t?yield _1(t,e?.userId??""):null}catch(t){return this.loggingService.catch("Error in getUserFromStorage: ",t),null}})}setIsPrivateCommentsEnabled(e){try{this.isPrivateCommentsEnabled$.next(e)}catch(t){this.loggingService.catch("Error in setIsPrivateCommentsEnabled: ",t)}}getIsPrivateCommentsEnabled(){return this.isPrivateCommentsEnabled$.value}getIsPrivateCommentsEnabled$(){return this.isPrivateCommentsEnabled$.asObservable()}updateUserWithColorAndTextColor(e){return X(this,null,function*(){try{let t=JSON.parse(JSON.stringify(e??{})),o=yield this.getUserFromStorage(t);return!o||Object.keys(o).length===0?(delete t?.color,delete t?.textColor,t):(o?.color&&(t.color=o?.color),o?.textColor&&(t.textColor=o?.textColor),t)}catch(t){return this.loggingService.catch("Error in updateUserWithColorAndTextColor: ",t),e}})}updateUserIfRequired(e){return X(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: updateUserIfRequired","color: green;");try{let t=yield this.getUserFromStorage(e),o={};e.color&&e.color!==t?.color&&(o.color=e.color),e.textColor&&e.textColor!==t?.textColor&&(o.textColor=e.textColor),Object.keys(o).length>0&&e.clientOrganizationId&&this.docService?.addUserInfoToOrganization({organizationId:e.clientOrganizationId,user:E(b({},o),{userId:e.userId})})}catch(t){this.loggingService.catch("Error in updateUserIfRequired: ",t)}})}initializeClient(e,t,o,a,l){return X(this,null,function*(){try{if(this.autoLoginRequired=!1,this.userOptions$.next(t),this.initializeClientToken)this.pendingUserLogin=e,this.pendingUserLoginSource=l;else{e.userSnippylyId=ym(this.configService.getApiKey(),e.userId),this.pendingUserLogin=void 0,this.pendingUserLoginSource=void 0,this.initializeClientToken=o;let s=yield mi(this.afAuth).pipe(st(1)).toPromise().catch(v=>null),d=!0;if(this.providedUser=JSON.parse(JSON.stringify(e)),s){let v=yield gm(s,!0).catch(A=>null);if(!v)return;let{user:u,firebaseConfig:S,advancedQueries:k}=v.claims;s?.uid!==e?.userSnippylyId||e?.groupId!==u?.groupId||e?.organizationId!==u?.organizationId||t?.forceReset||!a&&e?.organizationId&&!this.forceReLoggedIn||this.forceReLoginRequiredForAdvancedQueries(e)||this.forceReLoginRequiredForRegion(e,S)||this.forceReLoginRequiredForCommentViews(e)?(localStorage.setItem(V.LOCAL_STORAGE.VELT_USER_FORCE_RE_LOGGED_IN,"true"),localStorage.setItem(V.LOCAL_STORAGE.VELT_COMMENT_VIEWS_MIGRATED,"true"),this.forceReLoggedIn=!0,yield this.signOutUser("internal")):(this.loggingService.log("%c[WB] Calling FUNCTION: reinitializeCurrentUser","color: green;"),this.loggingService.log("Keeping user"),yield this.updateUserIfRequired(e),this.validateOrganizationId(e),this.setFirebaseConfig(S),this.setAdvancedQueries(k),u&&(this.providedUser.isAdmin=!!u.isAdmin),this.initializeSignedInUser(s,a,e),d=!1,this.analyticsService.trackEvent(Y.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:l}))}if(d){this.analyticsService.trackEvent(Y.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:l},!0,e.userSnippylyId,e.userId);let v=mr(this.functions,gr({url:wn.cloudFunction.validateClient,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:1200*1e3}),u=Ra(),S=(yield v({apiKey:this.apiKey,user:e,version:u,authToken:t?.authToken}))?.data;if(S.error){if(this.analyticsService.trackEvent(Y.Events.Core.SDK_VALIDATE_CLIENT_FAILED,E(b({apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,message:S.error,forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e)},S),{source:l}),!0,e.userSnippylyId,e.userId),S.error&&typeof S.error=="string")if(S.error?.toLowerCase()?.includes("token expired"))if(this.tokenExpiredErrorCount++,this.tokenExpiredErrorCount<=this.TOKEN_EXPIRED_ERROR_COUNT_LIMIT){let k={code:"token_expired",message:"Token expired",error:S?.error,source:S?.source};this.coreActionsService.triggerAction(ut.ERROR,k)}else{let k={code:"too_many_retries",message:"Token expired. Too many retries.",error:S?.error,source:S?.source};this.coreActionsService.triggerAction(ut.ERROR,k),this.analyticsService.trackEvent(Y.Events.Core.SDK_JWT_EXPIRED_RETRY_EXCEEDED,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,forceReset:this.userOptions$.value?.forceReset,source:l},!0,e.userSnippylyId,e.userId)}else{let k=S;this.coreActionsService.triggerAction(ut.ERROR,k)}throw S}else this.tokenExpiredErrorCount=0;if(this.analyticsService.trackEvent(Y.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:l},!0,e.userSnippylyId,e.userId),this.validateOrganizationId(e),S.firebaseConfig){this.setFirebaseConfig(S.firebaseConfig),yield this.signInWithCustomToken(e,S.token),this.loggingService.log("new signed in user",this.afAuth.currentUser);let k=yield gm(this.afAuth.currentUser,!0).catch(U=>null);if(!k)return;let{user:A,advancedQueries:P}=k.claims;this.setAdvancedQueries(P),this.providedUser.isAdmin=!!A?.isAdmin,this.initializeSignedInUser(this.afAuth.currentUser,a,e)}}this.initializeClientToken=0,this.lastLoggedInUserData={user:e,userOptions:t,initializeClientToken:o,autoLogin:a},this.checkForPendingLogin()}return e}catch(s){return this.initializeClientToken=0,this.checkForPendingLogin(),this.loggingService.catch("Error in initializeClient: ",s),t?.throwError?Promise.reject(s):Promise.resolve(null)}})}isVersionGreaterThanOrEqualTo4(){try{let e=Ra();return(e?parseInt(e.split(".")?.[0]||"0"):0)>=4}catch(e){return this.loggingService.catch("Error in isVersionGreaterThanOrEqualTo4: ",e),!1}}isVersion4Point5(){try{let e=Ra();if(e){let t=e.split("."),o=parseInt(t[0]||"0"),a=parseInt(t[1]||"0"),l=parseInt(t[2]||"0");if(o>=4&&a>=5)return o===4&&a===5&&l===0?!e.toLowerCase().includes("beta"):!0}return!1}catch(e){return this.loggingService.catch("Error in isVersion4Point5: ",e),!1}}forceReLoginRequiredForAdvancedQueries(e){try{let t=this.isVersionGreaterThanOrEqualTo4(),o=!1;try{let a=localStorage.getItem(V.LOCAL_STORAGE.VELT_ADVANCED_QUERIES);a&&(o=JSON.parse(a)?.advancedQueriesEnabled)}catch(a){this.loggingService.catch("Error in forceReLoginRequiredForAdvancedQueries: ",a)}return!!(t&&e.organizationId&&!o)}catch(t){return this.loggingService.catch("Error in forceReLoginRequiredForAdvancedQueries: ",t),!1}}forceReLoginRequiredForCommentViews(e){try{let t=this.isVersion4Point5(),o=!1;try{let a=localStorage.getItem(V.LOCAL_STORAGE.VELT_COMMENT_VIEWS_MIGRATED);a&&(o=JSON.parse(a))}catch(a){this.loggingService.catch("Error in forceReLoginRequiredForCommentViews: ",a)}return!!(t&&e.organizationId&&!o)}catch(t){return this.loggingService.catch("Error in forceReLoginRequiredForCommentViews: ",t),!1}}forceReLoginRequiredForRegion(e,t){try{return!!(this.isVersionGreaterThanOrEqualTo4()&&e.organizationId&&!t?.region)}catch(o){return this.loggingService.catch("Error in forceReLoginRequiredForRegion: ",o),!1}}checkForPendingLogin(){this.pendingUserLogin&&this.initializeClient(this.pendingUserLogin,this.userOptions$?.value||{},new Date().getTime(),void 0,this.pendingUserLoginSource)}setFirebaseConfig(e){this.loggingService.log("%c[WB] Calling FUNCTION: setFirebaseConfig","color: green;");try{this.firebaseConfig$.value||this.firebaseConfig$.next({firebaseOptions:b(b({},wn.firebaseConfig),e)})}catch(t){this.loggingService.catch("Error in setFirebaseConfig: ",t)}}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(V.LOCAL_STORAGE.VELT_ADVANCED_QUERIES,JSON.stringify(e)),this.advancedQueries$.next(e)}catch(t){this.loggingService.catch("Error in setAdvancedQueries: ",t)}}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 un([this.configService.getConfig$(),this.getAdvancedQueries$()]).pipe(ge(()=>this.getAdvancedQueriesEnabled()),Hn(()=>ce(!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;"),mi(this.afAuth).pipe(fe(e=>e?this.user$.asObservable():ce(null)),xt(Qt))}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 t=this.user$.value;if(e.userId&&e.userId!==t?.userId||e?.groupId&&e?.groupId!==t?.groupId||e?.organizationId&&e?.organizationId!==t?.organizationId)this.providedUser=e,this.initializeClient(e,this.userOptions$?.value||{},new Date().getTime(),void 0,"internal-updateUser");else if(this.providedUser=b(b({},this.providedUser),e),t){let o=b(b({},t),e);this.updateUserInternally(o)}}catch(t){this.loggingService.catch("Error in updateUser: ",t)}}signInWithCustomToken(e,t,o="manual"){this.loggingService.log("%c[WB] Calling FUNCTION: signInWithCustomToken","color: green;");try{return Kre(this.afAuth,t).then(a=>(this.analyticsService.trackEvent(Y.Events.Core.SDK_USER_AUTH_SUCCESS,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,authType:o,forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e)}),a)).catch(a=>(this.analyticsService.trackEvent(Y.Events.Core.SDK_USER_AUTH_FAILED,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,authType:o,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)}}clearCache(){this.loggingService.log("%c[WB] Calling FUNCTION: clearCache","color: green;");try{this.isPrivateCommentsEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in clearCache: ",e)}}resetServicesCache(){this.loggingService.log("%c[WB] Calling FUNCTION: resetServicesCache in AuthService","color: green;");try{this.clearCache(),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,t,o){this.loggingService.log("%c[WB] Calling FUNCTION: initializeSignedInUser","color: green;");try{let a=new Vo;a.userSnippylyId=e.uid,a.type="signedIn",o&&(a=b(b({},a),o)),this.setUserToStorage(a),this.mergeUserWithProvidedUserData(a,t)}catch(a){this.loggingService.catch("Error in initializeSignedInUser: ",a)}}mergeUserWithProvidedUserData(e,t){return X(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: mergeUserWithProvidedUserData","color: green;");try{e.userId=this.providedUser?.userId||e.userId;let o=null;if(this.usersService?.externalUserDataProviderAvailable()){let a=St(),l=Gs.IDENTIFY;this.coreActionsService.triggerAction(ut.USER_RESOLVER,{event:Y.Events.Resolver.USER_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:a,methodName:eo.MERGE_USER_WITH_PROVIDED_USER_DATA,moduleName:l,source:"internal",payload:{userIds:[e.userId],organizationId:this.providedUser?.organizationId||e.organizationId}});let s=yield this.usersService.resolveUsers({userIds:[e.userId],organizationId:this.providedUser?.organizationId||e.organizationId,skipUserCheck:!0,uniqueId:a,moduleName:l});s&&s[e.userId]&&(o=JSON.parse(JSON.stringify(s[e.userId]||{}))),e=b(b({},e),o||{})}e.name=o?o?.name:this.providedUser?.name||e.name,e.clientUserName=o?o?.clientUserName:this.providedUser?.clientUserName||e.clientUserName,e.photoUrl=o?o?.photoUrl:this.providedUser?.photoUrl||e.photoUrl,e?.photoUrl===void 0&&(e.photoUrl=null),e.email=o?o?.email:this.providedUser?.email||e.email,e.color=o?.color||this.providedUser?.color||this.getUserAvatarColor(e.userId),e.textColor=o?.textColor||this.providedUser?.textColor||this.getUserTextColor(e.userId),e.initial=o?.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(o){this.loggingService.catch("Error in mergeUserWithProvidedUserData: ",o)}})}updateUserInternally(e){return X(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: updateUserInternally","color: green;");try{let t=Object.assign({},e);delete t.contacts,this.analyticsService.identifyUser(e.userSnippylyId,t,{forceReset:this.userOptions$.value?.forceReset}),this.getPlanDetailsCalled||this.getPlanDetailsFromDb();let o=mr(this.functions,gr({url:wn?.cloudFunction?.sdkProxy,apiProxyDomain:this.configService?.getApiProxyDomain()})),a=Cd({methodName:"updateUserInternally",data:{type:"getProjectConfig"},getSdkProxy:o,userId:e?.userId??""}),l=Promise.resolve();if(this.userPermissionService?.isPermissionProviderAvailable()&&e.clientOrganizationId){let v=[{userId:e.userId,resource:{id:e.clientOrganizationId,type:Wr.ORGANIZATION,source:tr.IDENTIFY,organizationId:e.clientOrganizationId}}],u=St();this.coreActionsService.triggerAction(ut.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.RESOURCE_ACCESS_REQUEST_FORMED,methodName:tr.IDENTIFY,uniqueId:u,timestamp:new Date().getTime(),source:"internal",payload:{requests:v}}),l=this.userPermissionService?.onResourceAccessRequired({requests:v,uniqueId:u,userId:e.userId,methodName:tr.IDENTIFY,fromCache:!1})??Promise.resolve()}let[s,d]=yield Promise.allSettled([a,l]);s.status==="fulfilled"&&this.setIsPrivateCommentsEnabled(!!s.value?.data?.isPrivateCommentsEnabled),this.afAuth.currentUser&&(this.user$.next(e),this.updateUserToFirebase(e))}catch(t){this.loggingService.catch("Error in updateUserInternally: ",t)}})}updateUserToFirebase(e){this.loggingService.log("%c[WB] Calling FUNCTION: updateUserToFirebase","color: green;");try{let t=JSON.parse(JSON.stringify(e)),o=E(b({},t),{lastUpdated:new Date})}catch(t){this.loggingService.catch("Error in updateUserToFirebase: ",t)}}getPlanDetailsFromDb(){return X(this,null,function*(){try{this.getPlanDetailsCalled=!0;let t=yield mr(this.functions,gr({url:wn.cloudFunction.getPlanDetails,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:1200*1e3})({apiKey:this.configService.getApiKey(),sdkVersion:Ra(),sdkType:this.configService.getSdkType()});return t?.data?.isPlanExpired&&(this.analyticsService.trackEvent(Y.Events.Core.SDK_PLAN_EXPIRED),this.configService.getSF()||console.warn("Velt SDK plan has expired.")),this.planDetails$.next(t?.data||{planInfo:null,isPlanExpired:!1}),t}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(je(e=>!!e),ge(e=>!!e?.isPlanExpired))}isPlanExpired(){return this.planDetails$.getValue()?.isPlanExpired}addPreSignOutFuction(e,t){try{this.preSignOutFunctions.set(e,t)}catch(o){this.loggingService.catch("Error in addPreSignOutFuction: ",o)}}setUserOrganization(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setUserOrganization","color: green;");let t=JSON.parse(JSON.stringify(this.userOrganization$.value||{}));this.getUser()?.organizationId===e?.organizationId?(t.metadata=e,this.userOrganization$.next(t)):this.userOrganization$.next(null)}catch(t){this.loggingService.catch("Error in setUserOrganization: ",t)}}setOrganizationUserGroups(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setUserOrganizationGroups","color: green;");let t=JSON.parse(JSON.stringify(this.userOrganization$.value||{}));this.getUser()?.organizationId===t?.metadata?.organizationId&&(t.groups=e,this.userOrganization$.next(t))}catch(t){this.loggingService.catch("Error in setUserOrganizationGroups: ",t)}}getUserOrganization$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getUserOrganization$","color: green;"),this.getUser$().pipe(fe(e=>e?this.userOrganization$.asObservable().pipe(ge(t=>t?.metadata?.organizationId===e.organizationId?t:null)):ce(null)))}signOutUser(e="internal"){return X(this,null,function*(){try{e==="external"&&this.onRetrySubscription?.unsubscribe(),this.userPermissionService?.revokeAccessOnUserLogout(),this.analyticsService.trackEvent(Y.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 t=yield mi(this.afAuth).pipe(st(1)).toPromise().catch(o=>null);if(t){this.resetServicesCache(),this.user$.next(null);for(let[o,a]of this.preSignOutFunctions)try{yield a(t)}catch(l){this.loggingService.catch(`Error in signOutUser ${o} function: `,l)}return this.user$.next(null),yield lu(1e3),Zre(this.afAuth).catch(o=>{this.loggingService.catch("Error in signOutUser:",o)})}else return Promise.resolve()}catch(t){this.loggingService.catch("Error in signOutUser: ",t)}})}isFeatureAllowed(e){return Cr(this.config,this.user$.value,e)}getUserWithoutContacts(e){try{if(e){let t=JSON.parse(JSON.stringify(e));return delete t.contacts,t}else return null}catch(t){return this.loggingService.catch("Error in getUserWithoutContacts: ",t),null}}getUserForClient(e){try{return Co(e)}catch(t){return this.loggingService.catch("Error in getUserForClient: ",t),null}}getUserAvatarColor(e){try{return e?this.avatarService.generateUserColor(Gn(e)):"#625DF5"}catch{return"#625DF5"}}getUserTextColor(e){try{return"#FFFFFF"}catch{return"#FFFFFF"}}setOptionalPropertiesToUsers(e){try{e.forEach(t=>{try{t?.color||(t.color=this.getUserAvatarColor(t?.userId)),t?.textColor||(t.textColor=this.getUserTextColor(t?.userId)),!t?.initial&&(t?.name||t?.email)&&(t.initial=t.name?.charAt(0).toUpperCase()||t.email?.charAt(0).toUpperCase())}catch{}})}catch{}}};r.\u0275fac=function(t){return new(t||r)(J(Gi),J(Lt),J(Om),J(pi),J(Ve),J(Lr),J(rt),J(x))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var Am=class{constructor({apiKey:r,documentId:i,organizationId:e,folderId:t,veltFolderId:o,clientDocumentId:a,clientOrganizationId:l}){this.paths={},this.apiKey=r,this.documentId=i,this.organizationId=e,this.folderId=t,this.veltFolderId=o,this.clientDocumentId=a,this.clientOrganizationId=l,a&&(this.documentId=Bo(a)),l&&(this.organizationId=Xa(l)),t&&(this.folderId=t,this.veltFolderId=Mi(t)),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 r=`${this.apiKey}`;this.organizationId&&(r=`${r}/${V.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${this.paths.organizationId}`),this.documentId&&(this.paths.docs=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/`,this.paths.folder=`${r}/${V.FIREBASE_PARTIAL_PATH_FOLDERS}/`,this.paths.presence=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_PRESENCE}/`,this.paths.cursor=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_CURSOR}/`,this.paths.comment=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_COMMENT}/`,this.paths.multiThread=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_MULTI_THREAD}/`,this.paths.tag=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_TAG}/`,this.paths.area=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_AREA}/`,this.paths.arrow=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_ARROW}/`,this.paths.selection=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_SELECTION}/`,this.paths.audioHuddle=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_AUDIO_HUDDLE}/`,this.paths.huddle=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_HUDDLE}/`,this.paths.recorder=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_RECORDER}/`,this.paths.flock=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_FOLLOW_ALONG}/`,this.paths.syncVideoPlayer=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_SYNC_VIDEO_PLAYER}/`,this.paths.liveState=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_LIVE_STATE}/`,this.paths.liveStateSingleEditorMode=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_LIVE_STATE}/default/singleEditorMode`,this.paths.reaction=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_REACTION}/`,this.paths.crdt=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_CRDT}/`,this.paths.views=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_VIEWS}/`,this.paths.notifications=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_NOTIFICATIONS}/`,this.paths.metadata=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_METADATA}/`,this.paths.users=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_USERS}/`,this.paths.documentIam=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_IAM}/`,this.paths.userConfig=`${r}/${V.FIREBASE_PARTIAL_PATH_USERS}`),this.paths.customerMetadata=`${r}/${V.FIREBASE_PARTIAL_PATH_CUSTOMER_METADATA}/`,this.paths.groupContacts=`${r}/${V.FIREBASE_PARTIAL_PATH_CONTACTS}/${V.FIREBASE_PARTIAL_PATH_GROUPS}/`,this.paths.globalContacts=`${r}/${V.FIREBASE_PARTIAL_PATH_CONTACTS}/${V.FIREBASE_PARTIAL_PATH_GLOBAL}/`,this.paths.logins=`${r}/${V.FIREBASE_PARTIAL_PATH_CONTACTS}/${V.FIREBASE_PARTIAL_PATH_LOGINS}/`,this.paths.userFeedback=`${r}/${V.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${V.FIREBASE_PARTIAL_PATH_FEEDBACK}/`,this.paths.userReportBugs=`${r}/${V.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${V.FIREBASE_PARTIAL_PATH_BUGS}/`,this.paths.userContactUs=`${r}/${V.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${V.FIREBASE_PARTIAL_PATH_CONTACT_US}/`,this.organizationId&&(this.paths.organizationMetadata=`${r}/${V.FIREBASE_PARTIAL_PATH_ORGANIZATION_METADATA}/`,this.paths.organizationIam=`${r}/${V.FIREBASE_PARTIAL_PATH_IAM}/`,this.paths.organizationGroups=`${r}/${V.FIREBASE_PARTIAL_PATH_ORGANIZATION_GROUPS}/`,this.paths.organizationNotifications=`${r}/${V.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/`,this.documentId&&(this.paths.organizationNotificationsWithDocumentId=`${r}/${V.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/`,this.paths.heartbeatByDocument=`${r}/${V.FIREBASE_PARTIAL_PATH_HEARTBEAT_BY_DOCUMENT}/${this.documentId}/`),this.paths.organizationNotificationsLastNotificationTimestamp=`${r}/${V.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${V.FIREBASE_PARTIAL_PATH_LAST_NOTIFICATION_TIMESTAMP}/${V.FIREBASE_PARTIAL_PATH_DOCS}/`,this.paths.organizationNotificationsUsers=`${r}/${V.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${V.FIREBASE_PARTIAL_PATH_USERS}/`,this.paths.heartbeat=`${r}/${V.FIREBASE_PARTIAL_PATH_HEARTBEAT}/`),this.paths.workspaceIam=`${this.apiKey}/${V.FIREBASE_PARTIAL_PATH_IAM}/`}}catch{}}get folder(){return this.paths.folder?this.paths.folder:this.throwError("Folder path is not available.")}get userConfig(){return this.paths.userConfig?this.paths.userConfig:this.throwError("User config path is not available.")}get workspaceIam(){return this.paths.workspaceIam?this.paths.workspaceIam:this.throwError("Workspace IAM path is not available.")}get docs(){return this.paths.docs?this.paths.docs:this.throwError("Docs path is not available.")}get presence(){return this.paths.presence?this.paths.presence:this.throwError("Presence path is not available.")}get cursor(){return this.paths.cursor?this.paths.cursor:this.throwError("Cursor path is not available.")}get area(){return this.paths.area?this.paths.area:this.throwError("Area path is not available.")}get arrow(){return this.paths.arrow?this.paths.arrow:this.throwError("Arrow path is not available.")}get comment(){return this.paths.comment?this.paths.comment:this.throwError("Comment path is not available.")}get multiThread(){return this.paths.multiThread?this.paths.multiThread:this.throwError("Multi thread path is not available.")}get tag(){return this.paths.tag?this.paths.tag:this.throwError("Tag path is not available.")}get selection(){return this.paths.selection?this.paths.selection:this.throwError("Selection path is not available.")}get audioHuddle(){return this.paths.audioHuddle?this.paths.audioHuddle:this.throwError("Audio huddle path is not available.")}get huddle(){return this.paths.huddle?this.paths.huddle:this.throwError("Huddle path is not available.")}get recorder(){return this.paths.recorder?this.paths.recorder:this.throwError("Recorder path is not available.")}get flock(){return this.paths.flock?this.paths.flock:this.throwError("Flock path is not available.")}get syncVideoPlayer(){return this.paths.syncVideoPlayer?this.paths.syncVideoPlayer:this.throwError("Sync video player path is not available.")}get liveState(){return this.paths.liveState?this.paths.liveState:this.throwError("Live state path is not available.")}get liveStateSingleEditorMode(){return this.paths.liveStateSingleEditorMode?this.paths.liveStateSingleEditorMode:this.throwError("Live state single editor mode path is not available.")}get reaction(){return this.paths.reaction?this.paths.reaction:this.throwError("Reaction path is not available.")}get crdt(){return this.paths.crdt?this.paths.crdt:this.throwError("CRDT path is not available.")}get views(){return this.paths.views?this.paths.views:this.throwError("Views path is not available.")}get notifications(){return this.paths.notifications?this.paths.notifications:this.throwError("Notifications path is not available.")}get metadata(){return this.paths.metadata?this.paths.metadata:this.throwError("Metadata path is not available.")}get users(){return this.paths.users?this.paths.users:this.throwError("Users path is not available.")}get documentIam(){return this.paths.documentIam?this.paths.documentIam:this.throwError("Document IAM path is not available.")}get organizationMetadata(){return this.paths.organizationMetadata?this.paths.organizationMetadata:this.throwError("Organization metadata path is not available.")}get organizationIam(){return this.paths.organizationIam?this.paths.organizationIam:this.throwError("Organization IAM path is not available.")}get customerMetadata(){return this.paths.customerMetadata?this.paths.customerMetadata:this.throwError("Customer metadata path is not available.")}get groupContacts(){return this.paths.groupContacts?this.paths.groupContacts:this.throwError("Group contacts path is not available.")}get globalContacts(){return this.paths.globalContacts?this.paths.globalContacts:this.throwError("Global contacts path is not available.")}get logins(){return this.paths.logins?this.paths.logins:this.throwError("Logins path is not available.")}get userFeedback(){return this.paths.userFeedback?this.paths.userFeedback:this.throwError("User feedback path is not available.")}get userReportBugs(){return this.paths.userReportBugs?this.paths.userReportBugs:this.throwError("User report bugs path is not available.")}get userContactUs(){return this.paths.userContactUs?this.paths.userContactUs:this.throwError("User contact us path is not available.")}get organizationGroups(){return this.paths.organizationGroups?this.paths.organizationGroups:this.throwError("Organization groups path is not available.")}get heartbeat(){return this.paths.heartbeat?this.paths.heartbeat:this.throwError("Heartbeat path is not available.")}get heartbeatByDocument(){return this.paths.heartbeatByDocument?this.paths.heartbeatByDocument:this.throwError("Heartbeat by document path is not available.")}get organizationNotifications(){return this.paths.organizationNotifications?this.paths.organizationNotifications:this.throwError("Organization notifications path is not available.")}get organizationNotificationsWithDocumentId(){return this.paths.organizationNotificationsWithDocumentId?this.paths.organizationNotificationsWithDocumentId:this.throwError("Organization notifications with document id path is not available.")}get organizationNotificationsUsers(){return this.paths.organizationNotificationsUsers?this.paths.organizationNotificationsUsers:this.throwError("Organization notifications users path is not available.")}get organizationNotificationsLastNotificationTimestamp(){return this.paths.organizationNotificationsLastNotificationTimestamp?this.paths.organizationNotificationsLastNotificationTimestamp:this.throwError("Organization notifications last notification timestamp path is not available.")}throwError(r){throw{type:"DocumentPaths",message:r,metadata:{apiKey:this.apiKey,documentId:this.documentId,organizationId:this.organizationId}}}};var IR=class{constructor({apiKey:r,documentId:i,organizationId:e,clientDocumentId:t,clientOrganizationId:o,folderId:a,veltFolderId:l}){this.paths={},this.apiKey=r,this.documentId=i,this.organizationId=e,this.veltFolderId=l,t&&(this.documentId=Bo(t)),o&&(this.organizationId=Xa(o)),a&&(this.folderId=a,this.veltFolderId=Mi(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 r=`apiKey/${this.apiKey}`;this.organizationId&&(r=`${r}/${V.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${this.paths.organizationId}`,this.paths.organization=r,this.paths.folder=`${r}/${V.FIREBASE_PARTIAL_PATH_FOLDERS}`,this.paths.organizationUsers=`${r}/${V.FIREBASE_PARTIAL_PATH_ORGANIZATION_USERS}`,this.paths.users=`${r}/${V.FIREBASE_PARTIAL_PATH_CENTRAL_USERS}`,this.paths.notificationDocs=`${r}/${V.FIREBASE_PARTIAL_PATH_NOTIFICATION_DOCS}`,this.paths.notificationUsers=`${r}/${V.FIREBASE_PARTIAL_PATH_NOTIFICATION_USERS}`,this.paths.organizationGroups=`${r}/${V.FIREBASE_PARTIAL_PATH_GROUPS}`,this.paths.lastNotificationTimestamp=`${r}/${V.FIREBASE_PARTIAL_PATH_LAST_NOTIFICATION_TIMESTAMP}`,this.paths.userConfig=`${r}/${V.FIREBASE_PARTIAL_PATH_USERS}`,this.paths.permissionsUsers=`${r}/${V.FIREBASE_PARTIAL_PATH_PERMISSIONS_USERS}`),this.veltFolderId&&(this.paths.folderUsers=`${r}/${V.FIREBASE_PARTIAL_PATH_FOLDERS}/${this.veltFolderId}/${V.FIREBASE_PARTIAL_PATH_FOLDER_USERS}`),this.documentId&&(this.paths.document=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}`,this.paths.comment=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_COMMENT}`,this.paths.location=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_LOCATION}`,this.paths.multiThread=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_MULTI_THREAD}`,this.paths.area=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_AREA}`,this.paths.recorder=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_RECORDER}`,this.paths.reaction=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_REACTION}`,this.paths.crdt=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_CRDT}`,this.paths.notificationViews=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_NOTIFICATION_VIEWS}`,this.paths.documentViews=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_DOCUMENT_VIEWS}`,this.paths.locationViews=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_LOCATION_VIEWS}`,this.paths.documentUsers=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_DOCUMENT_USERS}`,this.paths.docNotification=`${this.paths.notificationDocs}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_DOC_NOTIFICATION}`)}}catch{}}get permissionsUsers(){return this.paths.permissionsUsers?this.paths.permissionsUsers:this.throwError("PermissionsUsers path is not available.")}get users(){return this.paths.users?this.paths.users:this.throwError("Users path is not available.")}get userConfig(){return this.paths.userConfig?this.paths.userConfig:this.throwError("UserConfig path is not available.")}get folder(){return this.paths.folder?this.paths.folder:this.throwError("Folder path is not available.")}get lastNotificationTimestamp(){return this.paths.lastNotificationTimestamp?this.paths.lastNotificationTimestamp:this.throwError("LastNotificationTimestamp path is not available.")}get organizationGroups(){return this.paths.organizationGroups?this.paths.organizationGroups:this.throwError("organizationGroups path is not available.")}get docNotification(){return this.paths.docNotification?this.paths.docNotification:this.throwError("DocNotification path is not available.")}get organization(){return this.paths.organization?this.paths.organization:this.throwError("Organization path is not available.")}get document(){return this.paths.document?this.paths.document:this.throwError("Document path is not available.")}get location(){return this.paths.location?this.paths.location:this.throwError("Location path is not available.")}get area(){return this.paths.area?this.paths.area:this.throwError("Area path is not available.")}get comment(){return this.paths.comment?this.paths.comment:this.throwError("Comment path is not available.")}get documentViews(){return this.paths.documentViews?this.paths.documentViews:this.throwError("DocumentViews path is not available.")}get locationViews(){return this.paths.locationViews?this.paths.locationViews:this.throwError("LocationViews path is not available.")}get notificationViews(){return this.paths.notificationViews?this.paths.notificationViews:this.throwError("NotificationViews path is not available.")}get documentUsers(){return this.paths.documentUsers?this.paths.documentUsers:this.throwError("DocumentUsers path is not available.")}get folderUsers(){return this.paths.folderUsers?this.paths.folderUsers:this.throwError("FolderUsers path is not available.")}get organizationUsers(){return this.paths.organizationUsers?this.paths.organizationUsers:this.throwError("OrganizationUsers path is not available.")}get notificationDocs(){return this.paths.notificationDocs?this.paths.notificationDocs:this.throwError("NotificationDocs path is not available.")}get notificationUsers(){return this.paths.notificationUsers?this.paths.notificationUsers:this.throwError("NotificationUsers path is not available.")}get multiThread(){return this.paths.multiThread?this.paths.multiThread:this.throwError("Multi thread path is not available.")}get recorder(){return this.paths.recorder?this.paths.recorder:this.throwError("Recorder path is not available.")}get reaction(){return this.paths.reaction?this.paths.reaction:this.throwError("Reaction path is not available.")}get crdt(){return this.paths.crdt?this.paths.crdt:this.throwError("CRDT path is not available.")}throwError(r){throw{type:"DocumentPaths",message:r,metadata:{apiKey:this.apiKey,documentId:this.documentId,organizationId:this.organizationId}}}};var ER=class{};var On=(()=>{let r=class r{constructor(e,t){this.authService=e,this.loggingService=t,this.db$=new be(null);try{this.authService.getFirebaseConfig$().subscribe(o=>{o&&this.db$.next(NM(void 0,o.firebaseOptions.databaseURL))},o=>{this.loggingService.catch("Error in DatabaseService constructor: ",o)})}catch(o){this.loggingService.catch("Error in DatabaseService constructor:",o)}}getDb(){return this.db$.asObservable()}getDbValue(){return this.db$.getValue()}};r.\u0275fac=function(t){return new(t||r)(J(Ge),J(x))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var vs=(()=>{let r=class r{constructor(e,t,o){this.coreActionsService=e,this.loggingService=t,this.analyticsService=o,this.resolveTimeout=60*1e3,this.retrySaveConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryDeleteConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryGetConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.commentAnnotationDataProvider$=new be(null),this.commentAnnotationById$=new be({}),this.fieldsToRemove=[],this.getCommentAnnotationById=a=>{try{return this.commentAnnotationDataProviderAvailable()?this.commentAnnotationById$.value?.[a]:void 0}catch(l){this.loggingService.catch("Error in CommentAnnotationsResolverService getCommentAnnotationById:",l);return}};try{this.loggingService.log("CommentAnnotationsResolverService initialized"),this.commentAnnotationDataProvider$.subscribe(a=>{a&&(a.config?.resolveTimeout&&(this.resolveTimeout=a.config.resolveTimeout),a.config?.saveRetryConfig&&(this.retrySaveConfig=a.config.saveRetryConfig),a.config?.deleteRetryConfig&&(this.retryDeleteConfig=a.config.deleteRetryConfig),a.config?.getRetryConfig&&(this.retryGetConfig=a.config.getRetryConfig),a.config?.fieldsToRemove&&(this.fieldsToRemove=a.config.fieldsToRemove))})}catch(a){this.loggingService.catch("Error in CommentAnnotationsResolverService constructor:",a)}}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(a){return X(this,arguments,function*({request:e,uniqueId:t,moduleName:o}){try{if(this.loggingService.log("%c[WB] Calling CommentAnnotationsResolverService FUNCTION: resolveCommentAnnotations","color: green;"),!this.commentAnnotationDataProviderAvailable())return{};let l,s=!1,d=!1,v=()=>{l&&(clearTimeout(l),l=void 0,d=!0)};return new Promise((u,S)=>{l=setTimeout(()=>{if(!d){s=!0,v();let te=t||St();this.coreActionsService.triggerAction(ut.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:te,methodName:Gr.RESOLVE_COMMENT_ANNOTATIONS,moduleName:o,source:"internal",payload:{error:new Error("Comment annotation resolution timeout"),request:e}}),S(new Error("Comment annotation resolution timeout"))}},this.commentAnnotationDataProvider$.value?.config?.resolveTimeout||this.resolveTimeout);let k=this.getProvider();if(!k)return v(),u({});let A={},P=[...new Set(e.commentAnnotationIds||[])],U=E(b({},e),{commentAnnotationIds:P});X(this,null,function*(){try{if(P.length>0||e.documentIds?.length||e.folderId){let te=t||St();this.coreActionsService.triggerAction(ut.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_RESOLUTION_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:te,methodName:Gr.RESOLVE_COMMENT_ANNOTATIONS,moduleName:o,source:"internal",payload:{request:U}});let ye=Bs(()=>k?.config?.getConfig?.url?Sc(k.config.getConfig.url,k.config.getConfig.headers,U,!0):k?.get(U)||Promise.resolve(void 0),"getCommentAnnotations",this.retryGetConfig).then(me=>s?{}:(v(),me&&me.statusCode!==200?(this.coreActionsService.triggerAction(ut.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:te,methodName:Gr.RESOLVE_COMMENT_ANNOTATIONS,moduleName:o,source:"internal",payload:{result:me,request:U}}),this.loggingService.catch(me?.message??"Error in CommentAnnotationsResolverService resolveCommentAnnotations:"),{}):me?.data)).catch(me=>{throw v(),me});try{A=(yield ye)||{},this.analyticsService.trackEvent(Y.Events.Resolver.COMMENT_RESOLVER_GET,{sourceMethod:"resolveCommentAnnotations",source:"sdk",commentAnnotationIds:P});let me={};Object.entries(A).forEach(([ke,De])=>{let Ie=this.commentAnnotationById$.value?.[ke];Ie?Ie&&JSON.stringify(Ie)!==JSON.stringify(De)&&(me[ke]=De):me[ke]=De}),Object.keys(me).length>0&&this.commentAnnotationById$.next(b(b({},this.commentAnnotationById$.getValue()),me)),this.coreActionsService.triggerAction(ut.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_RESOLUTION_RESULT,timestamp:new Date().getTime(),uniqueId:te,methodName:Gr.RESOLVE_COMMENT_ANNOTATIONS,moduleName:o,source:"internal",payload:{result:me,request:U}}),u(me)}catch(me){let ke=t||St();this.coreActionsService.triggerAction(ut.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:ke,methodName:Gr.RESOLVE_COMMENT_ANNOTATIONS,moduleName:o,source:"internal",payload:{error:me,request:U}}),s||S(me),u(A)}}else v(),u({})}catch(te){v();let ye=t||St();this.coreActionsService.triggerAction(ut.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:ye,methodName:Gr.RESOLVE_COMMENT_ANNOTATIONS,moduleName:o,source:"internal",payload:{error:te,request:U}}),S(te)}})})}catch(l){this.loggingService.catch("Error in CommentAnnotationsResolverService resolveCommentAnnotations:",l);let s=t||St();return this.coreActionsService.triggerAction(ut.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:s,methodName:Gr.RESOLVE_COMMENT_ANNOTATIONS,moduleName:o,source:"internal",payload:{error:l,request:e}}),{}}})}saveCommentAnnotation(e,t){return X(this,null,function*(){try{this.loggingService.log("%c[WB] Calling CommentAnnotationsResolverService FUNCTION: saveCommentAnnotation","color: green;");let o=this.getProvider();if(!this.commentAnnotationDataProviderAvailable())throw new Error("Comment annotation save data provider not available");let a=t||St();this.coreActionsService.triggerAction(ut.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_SAVE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:a,methodName:Gr.SAVE_COMMENT_ANNOTATION,source:"internal",payload:{request:e}});let l=JSON.parse(JSON.stringify(this.commentAnnotationById$.getValue()));this.commentAnnotationById$._value=b(b({},l),e.commentAnnotation);let s=yield Bs(()=>{if(o?.config?.saveConfig?.url){let d={commentAnnotation:e.commentAnnotation,event:e.eventType,commentId:e.commentId,metadata:Object.values(e.commentAnnotation??{})?.[0]?.metadata};return Sc(o.config.saveConfig.url,o.config.saveConfig.headers,d,!1)}return o?.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 s&&s.statusCode!==200?(this.retrySaveConfig.revertOnFailure&&(this.commentAnnotationById$._value=l),this.loggingService.catch(s?.message??"Error in CommentAnnotationsResolverService saveCommentAnnotation:"),this.coreActionsService.triggerAction(ut.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:Gr.SAVE_COMMENT_ANNOTATION,source:"internal",payload:{error:s,request:e}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(Y.Events.Resolver.COMMENT_RESOLVER_SAVE,{sourceMethod:"saveCommentAnnotation",source:"sdk",commentAnnotationIds:Object.keys(e.commentAnnotation),eventType:e.eventType,commentId:e.commentId}),this.coreActionsService.triggerAction(ut.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_SAVE_RESULT,timestamp:new Date().getTime(),uniqueId:a,methodName:Gr.SAVE_COMMENT_ANNOTATION,source:"internal",payload:{result:{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0},request:e}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0})}catch(o){this.loggingService.warn("Error in CommentAnnotationsResolverService saveCommentAnnotation:",o);let a=t||St();return this.coreActionsService.triggerAction(ut.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:Gr.SAVE_COMMENT_ANNOTATION,source:"internal",payload:{error:o,request:e}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0}}})}deleteCommentAnnotation(e,t,o){return X(this,null,function*(){try{this.loggingService.log("%c[WB] Calling CommentAnnotationsResolverService FUNCTION: deleteCommentAnnotation","color: green;");let a=this.getProvider();if(!this.commentAnnotationDataProviderAvailable())throw new Error("Comment annotation delete data provider not available");let l=o||St();this.coreActionsService.triggerAction(ut.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_DELETE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:l,methodName:Gr.DELETE_COMMENT_ANNOTATION,source:"internal",payload:{commentAnnotationId:e.toString(),metadata:t}});let s=this.commentAnnotationById$.getValue(),d=b({},s);delete d?.[e],this.commentAnnotationById$._value=d;let v=yield Bs(()=>{if(a?.config?.deleteConfig?.url){let u={commentAnnotationId:e.toString(),metadata:t,event:Uo.COMMENT_ANNOTATION_DELETE};return Sc(a.config.deleteConfig.url,a.config.deleteConfig.headers,u,!1)}return a?.delete({commentAnnotationId:e.toString(),metadata:t,event:Uo.COMMENT_ANNOTATION_DELETE})||Promise.resolve(void 0)},"deleteCommentAnnotation",this.retryDeleteConfig);return v&&v.statusCode!==200?(this.retryDeleteConfig.revertOnFailure&&(this.commentAnnotationById$._value=s),this.loggingService.catch(v?.message??"Error in CommentAnnotationsResolverService deleteCommentAnnotation:"),this.coreActionsService.triggerAction(ut.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:l,methodName:Gr.DELETE_COMMENT_ANNOTATION,source:"internal",payload:{error:v,commentAnnotationId:e.toString(),metadata:t}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(Y.Events.Resolver.COMMENT_RESOLVER_DELETE,{sourceMethod:"deleteCommentAnnotation",source:"sdk",commentAnnotationId:e.toString()}),this.coreActionsService.triggerAction(ut.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_DELETE_RESULT,timestamp:new Date().getTime(),uniqueId:l,methodName:Gr.DELETE_COMMENT_ANNOTATION,source:"internal",payload:{result:{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0},commentAnnotationId:e.toString(),metadata:t}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0})}catch(a){this.loggingService.warn("Error in CommentAnnotationsResolverService deleteCommentAnnotation:",a);let l=o||St();return this.coreActionsService.triggerAction(ut.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:l,methodName:Gr.DELETE_COMMENT_ANNOTATION,source:"internal",payload:{error:a,commentAnnotationId:e.toString(),metadata:t}}),{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()):ce(void 0)}catch(e){return this.loggingService.catch("Error in CommentAnnotationsResolverService getCommentAnnotationsById$:",e),ce(void 0)}}getAnnotationById(e){try{return this.commentAnnotationDataProviderAvailable()?this.commentAnnotationById$.getValue()?.[e]:void 0}catch(t){this.loggingService.catch("Error in CommentAnnotationsResolverService getAnnotationById:",t);return}}getFieldsToRemove(){try{return this.fieldsToRemove}catch(e){return this.loggingService.catch("Error in CommentAnnotationsResolverService getFieldsToRemove:",e),this.fieldsToRemove}}setCommentAnnotationDataProvider(e){try{if(e){this.loggingService.log("Setting comment annotation data provider");let t=e.config,o=[{method:"get",configKey:"getConfig"},{method:"save",configKey:"saveConfig"},{method:"delete",configKey:"deleteConfig"}],a=[];if(o.forEach(({method:l,configKey:s})=>{let d=t?.[s]?.url,v=l in e&&typeof e[l]=="function";!d&&!v&&a.push(l)}),a.length>0){let l=`DataProviders.comment is invalid. The following methods are missing or are not functions (and no corresponding config provided): ${a.join(", ")}.`;this.loggingService.catch(l);return}else this.commentAnnotationDataProvider$.next(e)}}catch(t){this.loggingService.catch("Error in CommentAnnotationsResolverService setCommentAnnotationDataProvider:",t)}}commentAnnotationDataProviderAvailable(){try{return!!this.commentAnnotationDataProvider$.getValue()}catch(e){return this.loggingService.catch("Error in CommentAnnotationsResolverService commentAnnotationDataProviderAvailable:",e),!1}}};r.\u0275fac=function(t){return new(t||r)(J(pi),J(x),J(rt))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var Pm=(()=>{let r=class r{constructor(e,t,o){this.coreActionsService=e,this.loggingService=t,this.analyticsService=o,this.resolveTimeout=60*1e3,this.retrySaveConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryDeleteConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryGetConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.reactionAnnotationDataProvider$=new be(null),this.reactionAnnotationById$=new be({}),this.getReactionAnnotationById=a=>{try{return this.reactionAnnotationDataProviderAvailable()?this.reactionAnnotationById$.value?.[a]:void 0}catch(l){this.loggingService.catch("Error in ReactionAnnotationsResolverService getReactionAnnotationById:",l);return}};try{this.loggingService.log("ReactionAnnotationsResolverService initialized"),this.reactionAnnotationDataProvider$.subscribe(a=>{a&&(a.config?.resolveTimeout&&(this.resolveTimeout=a.config.resolveTimeout),a.config?.saveRetryConfig&&(this.retrySaveConfig=a.config.saveRetryConfig),a.config?.deleteRetryConfig&&(this.retryDeleteConfig=a.config.deleteRetryConfig),a.config?.getRetryConfig&&(this.retryGetConfig=a.config.getRetryConfig))})}catch(a){this.loggingService.catch("Error in ReactionAnnotationsResolverService constructor:",a)}}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(a){return X(this,arguments,function*({request:e,uniqueId:t,moduleName:o}){try{if(this.loggingService.log("%c[WB] Calling ReactionAnnotationsResolverService FUNCTION: resolveReactionAnnotations","color: green;"),!this.reactionAnnotationDataProviderAvailable())return{};let l,s=!1,d=!1,v=()=>{l&&(clearTimeout(l),l=void 0,d=!0)};return new Promise((u,S)=>{l=setTimeout(()=>{if(!d){s=!0,v();let te=t||St();this.coreActionsService.triggerAction(ut.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:te,methodName:to.RESOLVE_REACTION_ANNOTATIONS,moduleName:o,source:"internal",payload:{error:new Error("Reaction annotation resolution timeout"),request:e}}),S(new Error("Reaction annotation resolution timeout"))}},this.reactionAnnotationDataProvider$.value?.config?.resolveTimeout||this.resolveTimeout);let k=this.getProvider();if(!k)return v(),u({});let A={},P=[...new Set(e.reactionAnnotationIds||[])],U=E(b({},e),{reactionAnnotationIds:P});X(this,null,function*(){try{if(P.length>0||e.documentIds?.length||e.folderId){let te=t||St();this.coreActionsService.triggerAction(ut.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_RESOLUTION_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:te,methodName:to.RESOLVE_REACTION_ANNOTATIONS,moduleName:o,source:"internal",payload:{request:U}});let ye=Bs(()=>k?.config?.getConfig?.url?Sc(k.config.getConfig.url,k.config.getConfig.headers,U,!0):k?.get(U)||Promise.resolve(void 0),"getReactionAnnotations",this.retryGetConfig).then(me=>s?{}:(v(),me&&me.statusCode!==200?(this.coreActionsService.triggerAction(ut.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:te,methodName:to.RESOLVE_REACTION_ANNOTATIONS,moduleName:o,source:"internal",payload:{result:me,request:U}}),this.loggingService.catch(me?.message??"Error in ReactionAnnotationsResolverService resolveReactionAnnotations:"),{}):me?.data)).catch(me=>{throw v(),me});try{A=(yield ye)||{},this.analyticsService.trackEvent(Y.Events.Resolver.REACTION_RESOLVER_GET,{sourceMethod:"resolveReactionAnnotations",source:"sdk",reactionAnnotationIds:P});let me={};Object.entries(A).forEach(([ke,De])=>{let Ie=this.reactionAnnotationById$.value?.[ke];Ie?Ie&&JSON.stringify(Ie)!==JSON.stringify(De)&&(me[ke]=De):me[ke]=De}),Object.keys(me).length>0&&this.reactionAnnotationById$.next(b(b({},this.reactionAnnotationById$.getValue()),me)),this.coreActionsService.triggerAction(ut.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_RESOLUTION_RESULT,timestamp:new Date().getTime(),uniqueId:te,methodName:to.RESOLVE_REACTION_ANNOTATIONS,moduleName:o,source:"internal",payload:{result:me,request:U}}),u(me)}catch(me){let ke=t||St();this.coreActionsService.triggerAction(ut.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:ke,methodName:to.RESOLVE_REACTION_ANNOTATIONS,moduleName:o,source:"internal",payload:{error:me,request:U}}),s||S(me),u(A)}}else v(),u({})}catch(te){v();let ye=t||St();this.coreActionsService.triggerAction(ut.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:ye,methodName:to.RESOLVE_REACTION_ANNOTATIONS,moduleName:o,source:"internal",payload:{error:te,request:U}}),S(te)}})})}catch(l){this.loggingService.catch("Error in ReactionAnnotationsResolverService resolveReactionAnnotations:",l);let s=t||St();return this.coreActionsService.triggerAction(ut.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:s,methodName:to.RESOLVE_REACTION_ANNOTATIONS,moduleName:o,source:"internal",payload:{error:l,request:e}}),{}}})}saveReactionAnnotation(e,t){return X(this,null,function*(){try{this.loggingService.log("%c[WB] Calling ReactionAnnotationsResolverService FUNCTION: saveReactionAnnotation","color: green;");let o=this.getProvider();if(!this.reactionAnnotationDataProviderAvailable())throw new Error("Reaction annotation save data provider not available");let a=t||St();this.coreActionsService.triggerAction(ut.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_SAVE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:a,methodName:to.SAVE_REACTION_ANNOTATION,source:"internal",payload:{request:e}});let l=JSON.parse(JSON.stringify(this.reactionAnnotationById$.getValue()));this.reactionAnnotationById$._value=b(b({},l),e);let s={reactionAnnotation:e,event:Uo.REACTION_ADD,metadata:Object.values(e??{})?.[0]?.metadata},d=yield Bs(()=>o?.config?.saveConfig?.url?Sc(o.config.saveConfig.url,o.config.saveConfig.headers,s,!1):o?.save(s)||Promise.resolve(void 0),"saveReactionAnnotation",this.retrySaveConfig);return d&&d.statusCode!==200?(this.retrySaveConfig.revertOnFailure&&(this.reactionAnnotationById$._value=l),this.loggingService.catch(d?.message??"Error in ReactionAnnotationsResolverService saveReactionAnnotation:"),this.coreActionsService.triggerAction(ut.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:to.SAVE_REACTION_ANNOTATION,source:"internal",payload:{error:d,request:e}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(Y.Events.Resolver.REACTION_RESOLVER_SAVE,{sourceMethod:"saveReactionAnnotation",source:"sdk",reactionAnnotationIds:Object.keys(e),eventType:s.event}),this.coreActionsService.triggerAction(ut.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_SAVE_RESULT,timestamp:new Date().getTime(),uniqueId:a,methodName:to.SAVE_REACTION_ANNOTATION,source:"internal",payload:{result:{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0},request:e}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0})}catch(o){this.loggingService.warn("Error in ReactionAnnotationsResolverService saveReactionAnnotation:",o);let a=t||St();return this.coreActionsService.triggerAction(ut.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:to.SAVE_REACTION_ANNOTATION,source:"internal",payload:{error:o,request:e}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0}}})}deleteReactionAnnotation(e,t,o){return X(this,null,function*(){try{this.loggingService.log("%c[WB] Calling ReactionAnnotationsResolverService FUNCTION: deleteReactionAnnotation","color: green;");let a=this.getProvider();if(!this.reactionAnnotationDataProviderAvailable())throw new Error("Reaction annotation delete data provider not available");let l=o||St();this.coreActionsService.triggerAction(ut.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_DELETE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:l,methodName:to.DELETE_REACTION_ANNOTATION,source:"internal",payload:{reactionAnnotationId:e.toString(),metadata:t}});let s=JSON.parse(JSON.stringify(this.reactionAnnotationById$.getValue())),d=b({},s);delete d?.[e],this.reactionAnnotationById$._value=d;let v=yield Bs(()=>{if(a?.config?.deleteConfig?.url){let u={reactionAnnotationId:e.toString(),metadata:t,event:Uo.REACTION_DELETE};return Sc(a.config.deleteConfig.url,a.config.deleteConfig.headers,u,!1)}return a?.delete({reactionAnnotationId:e.toString(),metadata:t,event:Uo.REACTION_DELETE})||Promise.resolve(void 0)},"deleteReactionAnnotation",this.retryDeleteConfig);return v&&v.statusCode!==200?(this.retryDeleteConfig.revertOnFailure&&(this.reactionAnnotationById$._value=s),this.loggingService.catch(v?.message??"Error in ReactionAnnotationsResolverService deleteReactionAnnotation:"),this.coreActionsService.triggerAction(ut.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:l,methodName:to.DELETE_REACTION_ANNOTATION,source:"internal",payload:{error:v,reactionAnnotationId:e.toString(),metadata:t}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(Y.Events.Resolver.REACTION_RESOLVER_DELETE,{sourceMethod:"deleteReactionAnnotation",source:"sdk",reactionAnnotationId:e.toString()}),this.coreActionsService.triggerAction(ut.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_DELETE_RESULT,timestamp:new Date().getTime(),uniqueId:l,methodName:to.DELETE_REACTION_ANNOTATION,source:"internal",payload:{result:{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0},reactionAnnotationId:e.toString(),metadata:t}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0})}catch(a){this.loggingService.warn("Error in ReactionAnnotationsResolverService deleteReactionAnnotation:",a);let l=o||St();return this.coreActionsService.triggerAction(ut.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:l,methodName:to.DELETE_REACTION_ANNOTATION,source:"internal",payload:{error:a,reactionAnnotationId:e.toString(),metadata:t}}),{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()):ce(void 0)}catch(e){return this.loggingService.catch("Error in ReactionAnnotationsResolverService getReactionAnnotationsById$:",e),ce(void 0)}}getAnnotationById(e){try{return this.reactionAnnotationDataProviderAvailable()?this.reactionAnnotationById$.getValue()?.[e]:void 0}catch(t){this.loggingService.catch("Error in ReactionAnnotationsResolverService getAnnotationById:",t);return}}setReactionAnnotationDataProvider(e){try{if(e){this.loggingService.log("Setting reaction annotation data provider");let t=e.config,o=[{method:"get",configKey:"getConfig"},{method:"save",configKey:"saveConfig"},{method:"delete",configKey:"deleteConfig"}],a=[];if(o.forEach(({method:l,configKey:s})=>{let d=t?.[s]?.url,v=l in e&&typeof e[l]=="function";!d&&!v&&a.push(l)}),a.length>0){let l=`DataProviders.reaction is invalid. The following methods are missing or are not functions (and no corresponding config provided): ${a.join(", ")}.`;this.loggingService.catch(l);return}else this.reactionAnnotationDataProvider$.next(e)}}catch(t){this.loggingService.catch("Error in ReactionAnnotationsResolverService setReactionAnnotationDataProvider:",t)}}reactionAnnotationDataProviderAvailable(){try{return!!this.reactionAnnotationDataProvider$.getValue()}catch(e){return this.loggingService.catch("Error in ReactionAnnotationsResolverService reactionAnnotationDataProviderAvailable:",e),!1}}};r.\u0275fac=function(t){return new(t||r)(J(pi),J(x),J(rt))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var lt=(()=>{let r=class r{constructor(e,t,o,a,l,s,d,v,u,S){this.analyticsService=e,this.authService=t,this.databaseService=o,this.domService=a,this.configService=l,this.loggingService=s,this.commentResolverService=d,this.reactionResolverService=v,this.coreActionsService=u,this.functions=S,this.documentPaths$=new be(null),this.docContext$=new be(null),this.documentIds$=new be([]),this.organizationConfig$=new be(null),this.firestorePaths$=new be(null),this.location$=new be(null),this.excludedLocationIds$=new be([]),this.organizationMetadata$=new be(null),this.documentMetadata$=new be(null),this.locationMetadata$=new be(null),this.customerMetadata$=new be(null),this.currentDocumentId=null,this.isCustomDocId=!1,this.locations$=new be({}),this.preDocumentIdChangeFunctions=new Map,this.draftDocuments=[],this.clientDocumentMetadataMap={},this.uiState=new be({}),this.lastSetDocumentIdExecutionTime=0,this.lastSetDocumentIdCallTime=0,this.setDocumentIdSubject=new nt,this.DEBOUNCE_TIME=5e3,this.MAX_QUEUE_SIZE=100,this.queueSize=0,this.isDocumentIdInDebounceQueue=!1,this.currentValidationToken=null,this.pendingDocumentIds=[],this.pendingOptions={},this.draftLocationMap={locations:[],options:void 0};try{this.loggingService.log("%c[WB] Creating CLASS: DocService","color: blue;"),this.domService.setDocService(this),this.authService.setDocService(this),this.setDocumentIdSubject.pipe(Zi(this.DEBOUNCE_TIME)).subscribe({next:k=>X(this,null,function*(){try{yield this.setDocumentIdImpl(k.documentId,k.clientOrganizationId,k.options),this.lastSetDocumentIdExecutionTime=Date.now(),this.isDocumentIdInDebounceQueue=!1,this.draftLocationMap.locations.length&&(yield this.setLocations({locations:this.draftLocationMap.locations,options:this.draftLocationMap.options,source:"internal"})),this.draftLocationMap={locations:[],options:void 0}}finally{this.queueSize--}}),error:k=>{this.loggingService.catch("Error in setDocumentId subscription:",k),this.queueSize--}}),this.databaseService.getDb().pipe(je(k=>!!k),st(1)).subscribe(k=>{k&&(this.db=k)}),this.configService.getApiKey$().subscribe(k=>{if(this.apiKey=k,this.apiKey){if(!this.isCustomDocId){let A=X9(window.location.href);this.currentUrl=A}this.analyticsService.updateDefaultProperties({apiKey:k})}}),this.authService.getUser$().subscribe(k=>X(this,null,function*(){if(k&&(this.analyticsService.updateDefaultProperties({organizationId:k?.organizationId,clientOrganizationId:k?.clientOrganizationId}),this.draftDocuments?.length?(yield this.setDocuments({documents:this.draftDocuments,options:this.draftOptions??void 0,source:"internal"}),this.draftDocuments=[],this.draftOptions=void 0,this.draftLocationMap.locations.length&&(yield this.setLocations({locations:this.draftLocationMap.locations,options:this.draftLocationMap.options,source:"internal"}).then(()=>this.draftLocationMap={locations:[],options:void 0}))):this.documentPaths$?.value&&k?.organizationId&&this.documentPaths$.value?.organizationId!==k?.organizationId&&(yield this.setDocuments({documents:this.documentIds$.value.length?this.documentIds$.value.map(A=>({id:A.clientDocumentId})):[{id:this.documentPaths$.value?.clientDocumentId}],options:void 0,source:"internal"})),setTimeout(()=>{this.documentPaths$.value||this.loggingService.catch("Error in DocService constructor:","Please set document id to continue.")},1e4),k?.organizationId&&k?.clientOrganizationId)){let A={organizationId:k?.organizationId,clientOrganizationId:k?.clientOrganizationId};this.getOrganizationConfig()||this.organizationConfig$.next({organizationId:k?.organizationId,clientOrganizationId:k?.clientOrganizationId}),yield this.updateOrganizationMetadata(A)}})),this.documentPaths$.subscribe(k=>{let A={documentId:k?.documentId,clientDocumentId:k?.clientDocumentId,folderId:k?.folderId,allDocuments:k?.allDocuments,veltFolderId:k?.veltFolderId};k?.organizationId&&(A.organizationId=k.organizationId,A.clientOrganizationId=k.clientOrganizationId),this.analyticsService.updateDefaultProperties(A),this.domService.resetSelectedAnnotationsMap()}),this.location$.subscribe(k=>{this.analyticsService.updateDefaultProperties({clientLocation:k?.location,locationId:k?.locationId})}),this.organizationMetadata$.subscribe(k=>{this.authService.setUserOrganization(k?.[this.documentPaths$.value?.organizationId])}),this.documentPaths$.pipe(je(k=>!!k),st(1)).subscribe(()=>{try{this.subscribeToCustomerMetadata()}catch(k){this.loggingService.catch("Error in DocService subscribeToCustomerMetadata:",k)}},k=>{this.loggingService.catch("Error in DocService subscribeToCustomerMetadata:",k)}),this.loggingService.log("%c[WB] Creating CLASS: DocService 2","color: blue;"),this.onWindowPopstate(),this.onWindowClick()}catch(k){this.loggingService.catch("Error in DocService constructor:",k)}}getOptionsFromDocumentPaths(){try{return this.documentPaths$.value?{folderId:this.documentPaths$.value?.folderId,allDocuments:this.documentPaths$.value?.allDocuments,locationId:this.documentPaths$.value?.locationId}:null}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.customerMetadata$.next(null),this.customerMetadataSubscription?.unsubscribe(),this.documentPaths$.value&&(this.draftOptions=this.getOptionsFromDocumentPaths(),this.draftDocuments=this.documentIds$.value.map(e=>({id:e.clientDocumentId})),this.draftLocationMap={locations:[this.location$.value?.location??null,...Object.values(this.locations$.value||{}).map(e=>e.location)].filter(e=>e!==null),options:{rootLocationId:this.location$.value?.location?.id}},this.currentDocumentId=null,this.documentPaths$.next(null),this.firestorePaths$.next(null)),this.unsetDocuments({source:"internal"})}catch(e){this.loggingService.catch("Error in DocService clearCacheOnUserCascade: ",e)}}setUsersService(e){try{this.usersService=e}catch(t){this.loggingService.catch("Error in setUsersService:",t)}}setCommonDbService(e){try{this.commonDbService=e}catch(t){this.loggingService.catch("Error in setCommonDbService:",t)}}setUserPermissionService(e){try{this.userPermissionService=e}catch(t){this.loggingService.catch("Error in setUserPermissionService:",t)}}setCommentService(e){try{this.commentService=e}catch(t){this.loggingService.catch("Error in setCommentService:",t)}}onWindowPopstate(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowPopstate","color: green;");try{this.domService.onWindowPopState$().subscribe(()=>{this.loggingService.log("location",location.href);let e=X9(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=X9(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(l){return X(this,arguments,function*({documentId:e,documentMetadata:t,options:o,source:a="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocument","color: green;"),a==="internal"&&this.analyticsService.trackEvent(Y.Events.Core.SET_DOCUMENTS_TRIGGERED,{payload:{id:e,documentMetadata:t,methodName:"setDocument",source:a}}),this.coreActionsService.triggerAction(ut.INIT_UPDATE,{event:Y.Events.Core.SET_DOCUMENTS_TRIGGERED,methodName:Ja.SET_DOCUMENTS,source:a,payload:{documentId:e,documentMetadata:t,options:o}}),yield this.setDocumentsImpl({documents:[{id:e,metadata:t}],options:b({organizationId:t?.organizationId},o??{}),source:a})}catch(s){this.loggingService.catch("Error in DocService setDocument:",s)}})}shouldSetDocumentsAgain(e,t={}){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: shouldSetDocumentsAgain","color: green;"),this.pendingDocumentIds.length>0&&e.length===this.pendingDocumentIds.length&&e.every(u=>this.pendingDocumentIds.includes(u.id))&&Ei(t,this.pendingOptions))return!1;let o=this.documentPaths$.value?.clientDocumentId,a=t?.rootDocumentId??e[0]?.id,l=this.documentIds$.value.map(v=>v.clientDocumentId),s=Z9(this.getOptionsFromDocumentPaths()??{})??{};return!e.every(v=>l.includes(v.id))||!Ei(s,t)||o!==a}catch(o){return this.loggingService.catch("Error in DocService shouldSetDocumentsAgain:",o),!0}}getDocumentIdsFromDocuments({documents:e,setClientDocumentMetadataMap:t=!1}){try{let o=[];return e.forEach(a=>{let l=a.id,s=`${Gn(l)}`;t&&a?.metadata&&typeof a.metadata=="object"&&(this.clientDocumentMetadataMap[l]=a.metadata),o.push({documentId:s,clientDocumentId:l})}),o}catch(o){return this.loggingService.catch("Error in DocService getDocumentIdsFromDocuments:",o),[]}}setDocuments(l){return X(this,arguments,function*({documents:e,options:t,source:o="internal",skipPermissionValidation:a=!1}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocuments","color: green;"),o==="internal"&&this.analyticsService.trackEvent(Y.Events.Core.SET_DOCUMENTS_TRIGGERED,{payload:{documents:e,options:t,methodName:"setDocuments",source:o}}),this.coreActionsService.triggerAction(ut.INIT_UPDATE,{event:Y.Events.Core.SET_DOCUMENTS_TRIGGERED,methodName:Ja.SET_DOCUMENTS,source:o,payload:{documents:e,options:t}}),yield this.setDocumentsImpl({documents:e,options:t??{},source:o,skipPermissionValidation:a})}catch(s){this.loggingService.catch("Error in DocService setDocuments:",s)}})}setRootDocument(o){return X(this,arguments,function*({document:e,source:t="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setRootDocument","color: green;"),this.coreActionsService.triggerAction(ut.INIT_UPDATE,{event:Y.Events.Core.SET_ROOT_DOCUMENT_TRIGGERED,methodName:Ja.SET_ROOT_DOCUMENT,source:t,payload:{document:e}});let a=this.getOptionsFromDocumentPaths()??{},l=this.documentIds$.value.map(s=>s.clientDocumentId);if(!l.includes(e.id)){let s=[...l.map(v=>({id:v})),{id:e.id}],d=this.getDocumentIdsFromDocuments({documents:s,setClientDocumentMetadataMap:!0});this.documentIds$.next(d)}yield this.setDocumentIdImpl(e.id,this.documentPaths$.value?.clientOrganizationId,a)}catch(a){this.loggingService.catch("Error in DocService setRootDocument:",a)}})}setDocContext(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocContext","color: green;");let t=JSON.parse(JSON.stringify(e??null));this.docContext$.next(t)}catch(t){this.loggingService.catch("Error in setDocContext: ",t)}}getDocContext(){return this.docContext$.getValue()}getDocContext$(){return this.docContext$.asObservable().pipe(xt(Qt))}getProcessedDocContext(){return Wde(this.getDocContext())}filterRelevantDocuments(a){return X(this,arguments,function*({options:e,documentIds:t,skipPermissionValidation:o=!1}){try{let l=this.authService.getUser();return!l||!this.commonDbService?.shouldUseFirestore()||(t=yield this.fetchDocumentsFromFolder(e,t,l),yield this.handlePermissionProvider(e,t,l),t=yield this.filterDocumentsByPermissions(e,t,l,o),t=t.slice(0,50)),t}catch(l){return this.loggingService.catch("Error in DocService filterRelevantDocuments:",l),t}})}fetchDocumentsFromFolder(e,t,o){return X(this,null,function*(){if(!e?.folderId||!e?.allDocuments)return t;try{let a=mr(this.functions,gr({url:wn?.cloudFunction?.sdkProxy,apiProxyDomain:this.configService?.getApiProxyDomain()}));(yield Cd({methodName:"getDocuments",data:{type:"getDocuments",metadata:{organizationId:e?.organizationId??o?.clientOrganizationId,folderId:e?.folderId}},getSdkProxy:a,userId:o?.userId??""}))?.data?.forEach(s=>{t.find(d=>d.clientDocumentId===s.id)||t.push({documentId:Bo(s.id),clientDocumentId:s.id})})}catch(a){this.loggingService.warn("Error in DocService fetchDocumentsFromFolder:",a)}return t})}buildPermissionRequests(e,t,o){try{let a=[];return e.organizationId&&e.organizationId!==o.clientOrganizationId&&a.push({userId:o.userId,resource:{id:e.organizationId,type:Wr.ORGANIZATION,source:tr.SET_DOCUMENTS,organizationId:e.organizationId,context:e?.context}}),e.folderId&&a.push({userId:o.userId,resource:{id:e.folderId,type:Wr.FOLDER,source:tr.SET_DOCUMENTS,organizationId:e?.organizationId??o?.clientOrganizationId??"",context:e?.context}}),t&&t.forEach(l=>{a.push({userId:o.userId,resource:{id:l.clientDocumentId,type:Wr.DOCUMENT,source:tr.SET_DOCUMENTS,organizationId:e?.organizationId??o?.clientOrganizationId??"",context:e?.context}})}),e?.context&&this.userPermissionService?.getIsContextEnabled()&&qde({input:e?.context}).forEach(s=>{let d=JSON.stringify(s.access);a.push({userId:o.userId,resource:{id:d,type:Wr.CONTEXT,source:tr.SET_DOCUMENTS,organizationId:e?.organizationId??o?.clientOrganizationId??"",context:s}})}),a}catch(a){return this.loggingService.catch("Error in buildPermissionRequests:",a),[]}}processAccessibleContexts(e,t){try{if(!e?.success||!e?.data?.length||!this.userPermissionService?.getIsContextEnabled())return;let o=e.data.filter(a=>a.type===Wr.CONTEXT&&a.hasAccess).map(a=>a.resourceId);if(this.loggingService.logContext("[CONTEXT] processAccessibleContexts called with accessibleContextIds:",JSON.parse(JSON.stringify(o??"nil"))),o?.length){let a=t.filter(s=>o.includes(s.resource.id)).map(s=>s.resource.context).filter(s=>!!s),l=Yde({input:a});this.loggingService.logContext("[CONTEXT] processAccessibleContexts called with accessibleContext:",JSON.parse(JSON.stringify(l??"nil"))),l?.access&&(this.loggingService.logContext("[CONTEXT] setting accessibleContext in docContext:",JSON.parse(JSON.stringify(l??"nil"))),this.setDocContext(l))}}catch(o){this.loggingService.catch("Error in processAccessibleContexts:",o)}}handlePermissionProvider(e,t,o){return X(this,null,function*(){if(this.userPermissionService?.isPermissionProviderAvailable())try{this.loggingService.logContext("[CONTEXT] handlePermissionProvider called with options:",JSON.parse(JSON.stringify(e??"nil")),"documentIds:",JSON.parse(JSON.stringify(t??"nil")),"user:",JSON.parse(JSON.stringify(o??"nil")));let a=this.buildPermissionRequests(e,t,o),l=St();this.coreActionsService.triggerAction(ut.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.RESOURCE_ACCESS_REQUEST_FORMED,methodName:tr.SET_DOCUMENTS,uniqueId:l,timestamp:new Date().getTime(),source:"internal",payload:{requests:a}});let s=yield this.userPermissionService?.onResourceAccessRequired({requests:a,uniqueId:l,methodName:tr.SET_DOCUMENTS,fromCache:!1});this.loggingService.logContext("[CONTEXT] handlePermissionProvider called with res:",JSON.parse(JSON.stringify(s??"nil")),"requests:",JSON.parse(JSON.stringify(a??"nil"))),this.processAccessibleContexts(s,a)}catch(a){this.loggingService.catch("Error in handlePermissionProvider:",a)}})}filterDocumentsByPermissions(e,t,o,a=!1){return X(this,null,function*(){if(a)return t;this.loggingService.logContext("[CONTEXT] filterDocumentsByPermissions called with options:",JSON.parse(JSON.stringify(e??"nil")),"documentIds:",JSON.parse(JSON.stringify(t??"nil")),"user:",JSON.parse(JSON.stringify(o??"nil")));let l=this.currentValidationToken,s=[...t];return l&&this.validatePermissionsInBackground(e,t,o,l),s})}validatePermissionsInBackground(e,t,o,a){let l=e?.organizationId??o?.clientOrganizationId;this.userPermissionService?.getUserPermissions({organizationId:l,documentIds:t.map(s=>s.clientDocumentId),folderIds:e?.folderId?[e?.folderId]:[]}).then(s=>{if(this.currentValidationToken===a&&s){this.userPermissionService?.setCurrentUserPermissions(s);let d=[];Object.entries(s?.[o.userId]?.documents??{}).forEach(([v,u])=>{u?.errorCode===qr.PERMISSION_DENIED&&d.push(v)}),l&&s?.[o.userId]?.organization?.[l]?.errorCode===qr.PERMISSION_DENIED&&this.loggingService.catch(`User does not have access to organization: ${l}`,void 0,void 0,!0),e?.folderId&&s?.[o.userId]?.folders?.[e?.folderId]?.errorCode===qr.PERMISSION_DENIED&&this.loggingService.catch(`User does not have access to folder: ${e?.folderId}`,void 0,void 0,!0),d.length>0&&(this.loggingService.catch(`User does not have access to documents: ${d.join(", ")}`,void 0,void 0,!0),this.handleDeniedDocumentAccess(d,o,a))}}).catch(s=>{this.loggingService.catch("Error in background permission validation:",s)})}handleDeniedDocumentAccess(e,t,o){try{if(this.currentValidationToken!==o)return;let a=this.documentPaths$.value;this.coreActionsService.triggerAction(ut.ERROR,{event:Y.Events.Core.SDK_ERROR,sourceMethod:"handleDeniedDocumentAccess",message:"Access denied to document after optimistic load",documentIds:e,userId:t.userId,timestamp:new Date().getTime()});let l=this.documentIds$.value||[],s=l.filter(d=>!e.includes(d.clientDocumentId));s.length!==l.length&&(s.length>0?this.setDocuments({documents:s.map(d=>({id:d.clientDocumentId})),options:{organizationId:a?.clientOrganizationId},source:"internal",skipPermissionValidation:!0}):(this.loggingService.catch("Error in DocService handleDeniedDocumentAccess: Documents provided are all denied"),this.coreActionsService.triggerAction(ut.ERROR,{event:Y.Events.Core.SDK_ERROR,sourceMethod:"handleDeniedDocumentAccess",message:"All documents provided are denied",documentIds:e,userId:t.userId,timestamp:new Date().getTime()}),this.unsetDocuments({source:"internal"})))}catch(a){this.loggingService.catch("Error in handleDeniedDocumentAccess:",a)}}addUserInfoToOrganization(l){return X(this,arguments,function*({organizationId:e,user:t,notificationsConfig:o,currentUserId:a}){try{let s=mr(this.functions,gr({url:wn?.cloudFunction?.sdkProxy,apiProxyDomain:this.configService?.getApiProxyDomain()}));yield Cd({data:b({type:"addUserInfoToOrganization",metadata:{organizationId:e},user:this.usersService?.externalUserDataProviderAvailable()?{userId:t?.userId}:t},o&&{notificationsConfig:o}),getSdkProxy:s,userId:a??t?.userId??""})}catch(s){this.loggingService.warn("Error in DocService addUserInfoToOrganization:",s)}})}setDocumentsImpl(l){return X(this,arguments,function*({documents:e,options:t,source:o,skipPermissionValidation:a=!1}){try{if(this.loggingService.logContext("[CONTEXT] setDocumentsImpl called with documents:",JSON.parse(JSON.stringify(e??"nil")),"options:",JSON.parse(JSON.stringify(t??"nil"))),!this.shouldSetDocumentsAgain(e,Z9(t))){o==="external"&&this.loggingService.catch("setDocuments called with previous request");return}let s=St();this.currentValidationToken=s;let d=this.getDocumentIdsFromDocuments({documents:e,setClientDocumentMetadataMap:!0});if(d?.length===0){this.loggingService.warn("Minimum one document must be set in setDocuments");return}let v=this.authService.getUser();if(!v){this.draftDocuments=e,this.draftOptions=t;return}this.pendingDocumentIds=e.map(S=>S.id),this.pendingOptions=Z9(t)??{},this.documentPaths$.value?.organizationId&&t?.organizationId&&this.documentPaths$.value?.organizationId!==t?.organizationId?this.authService.resetServicesCache():this.unsetDocuments({source:"internal",unsetDocumentPaths:!1});let u=t?.organizationId??v?.clientOrganizationId;if(u&&this.addUserInfoToOrganization({organizationId:u,user:v}),d=yield this.filterRelevantDocuments({options:t,documentIds:d,skipPermissionValidation:a}),this.documentIds$.next(d),d?.length){let S=d[0]?.clientDocumentId;t?.rootDocumentId&&d.find(k=>k.clientDocumentId===t?.rootDocumentId)&&(S=t?.rootDocumentId),yield this.debounceSetDocuments({documentId:S,clientOrganizationId:t?.organizationId,options:t})}this.pendingDocumentIds=[],this.pendingOptions={};return}catch(s){this.pendingDocumentIds=[],this.pendingOptions={},this.loggingService.catch("Error in DocService setDocumentsImpl:",s)}})}setDocumentId(a){return X(this,arguments,function*({documentId:e,clientOrganizationId:t,source:o="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocumentId","color: green;"),o==="internal"&&this.analyticsService.trackEvent(Y.Events.Core.SET_DOCUMENTS_TRIGGERED,{payload:{id:e,clientOrganizationId:t,methodName:"setDocumentId",source:o}}),this.coreActionsService.triggerAction(ut.INIT_UPDATE,{event:Y.Events.Core.SET_DOCUMENTS_TRIGGERED,methodName:Ja.SET_DOCUMENT_ID,source:o,payload:{documentId:e,clientOrganizationId:t}}),yield this.setDocumentsImpl({documents:[{id:e}],options:{organizationId:t},source:o})}catch(l){this.loggingService.catch("Error in setDocumentId:",l);return}})}debounceSetDocuments(a){return X(this,arguments,function*({documentId:e,clientOrganizationId:t,options:o}){try{this.loggingService.log("%c[WB] Calling FUNCTION: debounceSetDocuments","color: green;");let l=Date.now(),s=l-this.lastSetDocumentIdCallTime,d=l-this.lastSetDocumentIdExecutionTime;if(this.lastSetDocumentIdCallTime=l,this.queueSize>=this.MAX_QUEUE_SIZE){this.loggingService.warn("SetDocumentId queue size exceeded limit");return}if(!this.documentPaths$.value&&!this.isDocumentIdInDebounceQueue||s>this.DEBOUNCE_TIME&&d>this.DEBOUNCE_TIME){yield this.setDocumentIdImpl(e,t,o),this.lastSetDocumentIdExecutionTime=l;return}this.documentPaths$.next(null),this.isDocumentIdInDebounceQueue=!0,this.draftLocationMap={locations:[],options:void 0},this.queueSize++,this.setDocumentIdSubject.next({documentId:e,clientOrganizationId:t,options:o??void 0});return}catch(l){this.loggingService.catch("Error in debounceSetDocuments:",l)}})}setDocumentIdImpl(e,t,o){return X(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: setDocumentIdImpl","color: green;");try{let a=this.authService.getUser();if(!a)return;this.currentDocumentId&&this.documentPaths$.value&&(yield this.callPreDocumentIdChangeFunctions(this.documentPaths$.value));let l=this.currentDocumentId;if(this.apiKey){let s=`${Gn(e)}`,d=o?.folderId,v=o?.folderId?Mi(o?.folderId):void 0,u=o?.locationId,S=o?.allDocuments,k=a?.organizationId?t?Et(t):a?.organizationId:void 0,A=St(),P=Q1.SET_DOCUMENTS;this.coreActionsService.triggerAction(ut.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:A,methodName:Gr.INIT_DOCUMENTS,moduleName:P,source:"internal",payload:{documentIds:this.documentIds$.value.map(te=>te.clientDocumentId),organizationId:t??a?.clientOrganizationId??""}});let U=St(),W=ZE.SET_DOCUMENTS;if(this.coreActionsService.triggerAction(ut.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:U,moduleName:W,methodName:to.INIT_DOCUMENTS,source:"internal",payload:{documentIds:this.documentIds$.value.map(te=>te.clientDocumentId),organizationId:t??a?.clientOrganizationId??""}}),yield Promise.allSettled([this.commentResolverService.resolveCommentAnnotations({request:{documentIds:this.documentIds$.value.map(te=>te.clientDocumentId),organizationId:t??a?.clientOrganizationId??""},uniqueId:A,moduleName:P}),this.reactionResolverService.resolveReactionAnnotations({request:{documentIds:this.documentIds$.value.map(te=>te.clientDocumentId),organizationId:t??a?.clientOrganizationId??""},uniqueId:U,moduleName:W})]),this.currentDocumentId!==s||this.documentPaths$.value?.organizationId!==k){this.loggingService.log("setting new docid"),this.currentDocumentId=s;let te=new dR,ye=new ER;te.clientDocumentId=e,ye.clientDocumentId=e,te.folderId=d,ye.folderId=d,te.locationId=u,ye.locationId=u,te.allDocuments=S,ye.allDocuments=S,te.veltFolderId=v,ye.veltFolderId=v,te.documentId=s,ye.documentId=s,k&&(te.organizationId=k,te.clientOrganizationId=t??a?.clientOrganizationId,ye.organizationId=k,ye.clientOrganizationId=t??a?.clientOrganizationId);let me=`${this.apiKey}`,ke=`apiKey/${this.apiKey}`;k&&(me=`${me}/${V.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${te.organizationId}`,ke=`${ke}/${V.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${te.organizationId}`),ye.organization=`apiKey/${this.apiKey}/${V.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}`,ye.document=`${ke}/${V.FIREBASE_PARTIAL_PATH_DOCS}`,te.presence=`${me}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_PRESENCE}/`,te.cursor=`${me}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_CURSOR}/`,te.comment=`${me}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_COMMENT}/`,ye.comment=`${ke}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_COMMENT}`,te.multiThread=`${me}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_MULTI_THREAD}/`,ye.multiThread=`${ke}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_MULTI_THREAD}`,te.tag=`${me}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_TAG}/`,te.area=`${me}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_AREA}/`,ye.area=`${ke}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_AREA}`,te.arrow=`${me}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_ARROW}/`,te.selection=`${me}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_SELECTION}/`,te.audioHuddle=`${me}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_AUDIO_HUDDLE}/`,te.huddle=`${me}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_HUDDLE}/`,te.recorder=`${me}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_RECORDER}/`,ye.recorder=`${ke}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_RECORDER}`,te.flock=`${me}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_FOLLOW_ALONG}/`,te.syncVideoPlayer=`${me}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_SYNC_VIDEO_PLAYER}/`,te.liveState=`${me}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_LIVE_STATE}/`,te.liveStateSingleEditorMode=`${me}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_LIVE_STATE}/default/singleEditorMode`,te.reaction=`${me}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_REACTION}/`,ye.reaction=`${ke}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_REACTION}`,te.crdt=`${me}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_CRDT}/`,ye.crdt=`${ke}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_CRDT}`,te.customerMetadata=`${this.apiKey}/${V.FIREBASE_PARTIAL_PATH_CUSTOMER_METADATA}/`,te.views=`${me}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_VIEWS}/`,ye.notificationViews=`${ke}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_NOTIFICATION_VIEWS}`,ye.documentViews=`${ke}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_DOCUMENT_VIEWS}`,ye.locationViews=`${ke}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_LOCATION_VIEWS}`,te.notifications=`${me}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_NOTIFICATIONS}/`,te.metadata=`${me}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_METADATA}/`,te.users=`${me}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_USERS}/`,te.documentIam=`${me}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_IAM}/`,te.workspaceIam=`${this.apiKey}/${V.FIREBASE_PARTIAL_PATH_IAM}/`,te.groupContacts=`${me}/${V.FIREBASE_PARTIAL_PATH_CONTACTS}/${V.FIREBASE_PARTIAL_PATH_GROUPS}/`,te.globalContacts=`${me}/${V.FIREBASE_PARTIAL_PATH_CONTACTS}/${V.FIREBASE_PARTIAL_PATH_GLOBAL}/`,te.logins=`${me}/${V.FIREBASE_PARTIAL_PATH_CONTACTS}/${V.FIREBASE_PARTIAL_PATH_LOGINS}/`,te.userFeedback=`${me}/${V.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${V.FIREBASE_PARTIAL_PATH_FEEDBACK}/`,te.userReportBugs=`${me}/${V.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${V.FIREBASE_PARTIAL_PATH_BUGS}/`,te.userContactUs=`${me}/${V.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${V.FIREBASE_PARTIAL_PATH_CONTACT_US}/`,k&&(te.organizationMetadata=`${me}/${V.FIREBASE_PARTIAL_PATH_ORGANIZATION_METADATA}/`,te.organizationIam=`${me}/${V.FIREBASE_PARTIAL_PATH_IAM}/`,te.organizationGroups=`${me}/${V.FIREBASE_PARTIAL_PATH_ORGANIZATION_GROUPS}/`,te.organizationNotifications=`${me}/${V.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/`,s&&(te.organizationNotificationsWithDocumentId=`${me}/${V.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/`,te.heartbeatByDocument=`${me}/${V.FIREBASE_PARTIAL_PATH_HEARTBEAT_BY_DOCUMENT}/${s}/`),te.organizationNotificationsLastNotificationTimestamp=`${me}/${V.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${V.FIREBASE_PARTIAL_PATH_LAST_NOTIFICATION_TIMESTAMP}/${V.FIREBASE_PARTIAL_PATH_DOCS}/`,te.organizationNotificationsUsers=`${me}/${V.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${V.FIREBASE_PARTIAL_PATH_USERS}/`,te.heartbeat=`${me}/${V.FIREBASE_PARTIAL_PATH_HEARTBEAT}/`),ye.organizationUsers=`${ke}/${V.FIREBASE_PARTIAL_PATH_ORGANIZATION_USERS}`,ye.users=`${ke}/${V.FIREBASE_PARTIAL_PATH_CENTRAL_USERS}`,ye.documentUsers=`${ke}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_DOCUMENT_USERS}`,ye.notificationDocs=`${ke}/${V.FIREBASE_PARTIAL_PATH_NOTIFICATION_DOCS}`,ye.notificationUsers=`${ke}/${V.FIREBASE_PARTIAL_PATH_NOTIFICATION_USERS}`,this.documentPaths$.next(te),this.firestorePaths$.next(ye),te?.clientOrganizationId&&te?.organizationId&&!(te?.clientOrganizationId===this.getOrganizationConfig()?.clientOrganizationId&&te?.organizationId===this.getOrganizationConfig()?.organizationId)&&this.organizationConfig$.next({organizationId:te?.organizationId,clientOrganizationId:te?.clientOrganizationId}),Promise.allSettled([this.updateFolderMetadata(),this.updateDocumentMetadata(),this.fetchLocationMetadata(),this.updateOrganizationMetadata()]),l&&this.location$.value&&this.removeLocation({}),this.coreActionsService.triggerAction(ut.INIT_UPDATE,{event:Y.Events.Doc.SET_DOCUMENTS_SUCCESS,payload:{documentId:s,clientDocumentId:e}}),this.analyticsService.trackEvent(Y.Events.Doc.SET_DOCUMENTS_SUCCESS,{documentId:s,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:t}){this.loggingService.log("%c[WB] Calling FUNCTION: unsetDocumentId","color: green;");try{e==="internal"&&this.analyticsService.trackEvent(Y.Events.Core.UNSET_DOCUMENTS_TRIGGERED,{payload:{methodName:"unsetDocumentId",source:e}}),this.coreActionsService.triggerAction(ut.INIT_UPDATE,{event:Y.Events.Doc.UNSET_DOCUMENTS_TRIGGERED,methodName:Ja.UNSET_DOCUMENT_ID,source:e}),this.unsetDocumentImpl({source:e,unsetDocumentPaths:t})}catch(o){this.loggingService.catch("Error in unsetDocumentId: ",o)}}unsetDocumentImpl({source:e,unsetDocumentPaths:t}){this.loggingService.log("%c[WB] Calling FUNCTION: unsetDocumentImpl","color: green;");try{let o=JSON.parse(JSON.stringify(this.documentIds$.value??[])),a=JSON.parse(JSON.stringify(this.documentPaths$.value?.folderId??""));this.currentDocumentId&&this.documentPaths$.value&&this.callPreDocumentIdChangeFunctions(this.documentPaths$.value),t&&(this.documentPaths$.next(null),this.firestorePaths$.next(null)),this.currentDocumentId=null,this.location$.next(null),this.excludedLocationIds$.next([]),this.documentMetadata$.next(null),this.locationMetadata$.next(null),this.locations$.next({}),this.documentIds$.next([]),this.userPermissionService?.revokeAccessOnDocumentUnset({documentIds:o,folderId:a}),this.coreActionsService.triggerAction(ut.INIT_UPDATE,{event:Y.Events.Doc.UNSET_DOCUMENTS_SUCCESS,source:e}),this.analyticsService.trackEvent(Y.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(o){this.loggingService.catch("Error in unsetDocumentImpl: ",o)}}unsetDocuments({source:e,unsetDocumentPaths:t=!0}){this.loggingService.log("%c[WB] Calling FUNCTION: unsetDocuments","color: green;");try{e==="internal"&&this.analyticsService.trackEvent(Y.Events.Core.UNSET_DOCUMENTS_TRIGGERED,{payload:{methodName:"unsetDocuments",source:e}}),this.coreActionsService.triggerAction(ut.INIT_UPDATE,{event:Y.Events.Doc.UNSET_DOCUMENTS_TRIGGERED,source:e,methodName:Ja.UNSET_DOCUMENTS}),this.unsetDocumentImpl({source:e,unsetDocumentPaths:t})}catch(o){this.loggingService.catch("Error in unsetDocuments: ",o)}}addPreDocumentIdChangeFunction(e,t){try{this.loggingService.log("%c[WB] Calling FUNCTION: addPreDocumentIdChangeFunction","color: green;"),this.preDocumentIdChangeFunctions.set(e,t)}catch(o){this.loggingService.catch("Error in addPreDocumentIdChangeFunction: ",o)}}callPreDocumentIdChangeFunctions(e){return X(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: callPreDocumentIdChangeFunctions","color: green;");for(let[t,o]of this.preDocumentIdChangeFunctions)try{yield o(e)}catch(a){this.loggingService.catch("Error in callPreDocumentIdChangeFunctions: ",a)}}catch(t){this.loggingService.catch("Error in callPreDocumentIdChangeFunctions: ",t)}})}fetchOrganizationMetadata(e){return X(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: fetchOrganizationMetadata","color: green;");try{if(!e&&this.getOrganizationConfig()&&(e=this.getOrganizationConfig()),this.db&&e?.organizationId){let t=e?.organizationId;yield this.commonDbService?.getData({feature:"organizationMetadata",properties:{apiKey:this.apiKey??"",organizationId:t,field:"metadata"}}).then(o=>{o&&!o?.errorCode&&this.organizationMetadata$.next(E(b({},this.organizationMetadata$.value),{[t]:o}))}).catch(o=>{this.loggingService.catch("Error in fetchOrganizationMetadata: ",o)})}}catch(t){this.loggingService.catch("Error in fetchOrganizationMetadata: ",t)}})}fetchDocumentMetadata(e){return X(this,null,function*(){try{if(this.db&&this.authService.getUser()){let t=this.documentPaths$.value,o=this.documentMetadata$.value;if(e=e.filter(a=>!o?.[a.documentId]),e?.some(a=>!a?.documentId||!a?.clientDocumentId)||!t)return;if(this.commonDbService?.shouldUseFirestore()){let a=t?.folderId,l=[],s={organizationId:t?.clientOrganizationId,folderId:a},d=[],v=20;for(let S=0;S<e.length;S+=v)d.push(e.slice(S,S+v));d.forEach(S=>{let k=JSON.parse(JSON.stringify(s));k.documentIds=S.map(A=>A.clientDocumentId),l.push(this.fetchDocuments(k))});let u={};l.length>0&&(yield Promise.all(l).then(S=>{S?.forEach(k=>{k?.forEach(A=>{A?.metadata?.documentId&&(u[A.metadata.documentId]=A.metadata)})}),this.setAllDocumentMetadata(b(b({},this.documentMetadata$.value),u))}).catch(S=>{this.loggingService.catch("Error in fetchDocumentMetadata: ",S)}))}else o?.[t?.documentId??e?.[0]?.documentId]||this.commonDbService?.queryData({feature:"allDocuments",properties:{apiKey:this.apiKey??"",organizationId:t?.organizationId,documentId:t?.documentId??e?.[0]?.documentId,skipObjectValues:!0}}).then(a=>{a?.documentId&&this.setDocumentMetadata(a.documentId,a)}).catch(a=>{this.loggingService.catch("Error in fetchDocumentMetadata: ",a)})}}catch(t){this.loggingService.catch("Error in fetchDocumentMetadata: ",t)}})}fetchLocationMetadata(){return X(this,null,function*(){try{if(this.db&&this.authService.getUser()){let e=this.documentPaths$.value,t=this.documentIds$.value,o=e?.folderId,a=e?.allDocuments,l=[],s={organizationId:e?.clientOrganizationId,folderId:o,allDocuments:a},d=[],v=20;for(let S=0;S<t.length;S+=v)d.push(t.slice(S,S+v));d.forEach(S=>{let k=JSON.parse(JSON.stringify(s));k.documentIds=S.map(A=>A.clientDocumentId),l.push(this.fetchLocations(k))});let u=this.locationMetadata$.value??{};l.length>0&&Promise.all(l).then(S=>{S?.forEach(k=>{k?.forEach(A=>{A?.metadata?.documentId&&(u[A.metadata.documentId]=E(b({},u?.[A.metadata.documentId]??{}),{[A.location.id]:A}))})}),Object.keys(u||{}).length>0&&this.locationMetadata$.next(u)}).catch(S=>{this.loggingService.catch("Error in fetchLocationMetadata: ",S)})}}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(Hn(t=>ce(null))).subscribe(t=>{this.customerMetadata$.next(t?.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(ge(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`${Gn(e)}`}catch(t){return this.loggingService.catch("Error in generateDocumentId: ",t),""}}generateOrganizationId(e){try{return`${Et(e)}`}catch(t){return this.loggingService.catch("Error in generateOrganizationId: ",t),""}}getFirestorePaths(){return this.loggingService.log("%c[WB] Calling FUNCTION: getFirestorePaths","color: green;"),this.firestorePaths$.value}setLocation(o){return X(this,arguments,function*({location:e,source:t="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setLocation","color: green;"),t==="internal"&&this.analyticsService.trackEvent(Y.Events.Core.SET_LOCATIONS_TRIGGERED,{payload:{locations:[e],options:void 0,methodName:"setLocation",source:t}}),this.coreActionsService.triggerAction(ut.INIT_UPDATE,{event:Y.Events.Core.SET_LOCATIONS_TRIGGERED,source:t,methodName:Ja.SET_LOCATION,payload:{locations:[e],options:void 0}}),this.setLocationsImpl({locations:[e]})}catch(a){this.loggingService.catch("Error in setLocation: ",a)}})}setLocations(a){return X(this,arguments,function*({locations:e,options:t,source:o="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setLocations","color: green;"),o==="internal"&&this.analyticsService.trackEvent(Y.Events.Core.SET_LOCATIONS_TRIGGERED,{payload:{locations:e,options:t,methodName:"setLocations",source:o}}),this.coreActionsService.triggerAction(ut.INIT_UPDATE,{event:Y.Events.Core.SET_LOCATIONS_TRIGGERED,methodName:Ja.SET_LOCATIONS,source:o,payload:{locations:e,options:t}}),this.setLocationsImpl({locations:e,options:t})}catch(l){this.loggingService.catch("Error in setLocations: ",l)}})}getValidLocations(e){try{let t=[];return e&&Array.isArray(e)&&e.forEach(o=>{if(o&&typeof o=="object"){let a=!0;o?.version&&(!o?.version?.id||!o?.version?.name)&&(this.loggingService.catch(`Error in setting location for locationId: ${o?.id}, If you're setting version then add id and name fields to version object.`),a=!1),a&&t.push(o)}}),t}catch(t){this.loggingService.catch("Error in getValidLocations: ",t)}return e}setRootLocation(o){return X(this,arguments,function*({location:e,source:t="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setRootLocation","color: green;"),t==="internal"&&this.analyticsService.trackEvent(Y.Events.Core.SET_ROOT_LOCATION_TRIGGERED,{payload:{location:e,methodName:"setRootLocation",source:t}}),this.coreActionsService.triggerAction(ut.INIT_UPDATE,{event:Y.Events.Core.SET_ROOT_LOCATION_TRIGGERED,methodName:Ja.SET_ROOT_LOCATION,source:t,payload:{location:e}});let a=Object.values(this.locations$.value).map(l=>l.location).filter(l=>String(l.id)!==String(e.id));this.setLocationsImpl({locations:[e,...a],options:{rootLocationId:e.id}})}catch(a){this.loggingService.catch("Error in DocService setRootLocation:",a)}})}setLocationsImpl({locations:e,options:t}){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: setLocationsImpl","color: green;"),e.length===0)return;if(!this.authService.getUser()){!t?.appendLocation&&e.length>0&&(this.draftLocationMap.options=E(b(b({},this.draftLocationMap.options??{}),t??{}),{rootLocationId:e[0].id})),this.draftLocationMap.locations=[...this.draftLocationMap.locations,...e],this.draftLocationMap.options=b(b({},this.draftLocationMap.options),t);return}let a=this.getValidLocations(e),l=[],s=[];this.location$.value?.location.id&&s.push(this.location$.value?.location.id),s=[...s,...Object.values(this.locations$.value).map(u=>u.location.id)].filter(u=>u!==void 0);let d;if(t?.rootLocationId&&t?.rootLocationId!==this.location$.value?.location.id&&(d=a.find(u=>u.id===t?.rootLocationId),!d)){this.loggingService.catch(`Error in setting locations, rootLocationId: ${t?.rootLocationId} not found in locations.`);return}if(t?.appendLocation){if(d){let u=fo(d),S=Gn(JSON.stringify(u));u.id&&l.push({locationId:S,location:u}),this.location$.next({locationId:S,location:u})}}else{d||(d=a[0]);let u=fo(d),S=Gn(JSON.stringify(u));u.id&&l.push({locationId:S,location:u}),this.location$.next({locationId:S,location:u})}let v=[];return a.slice(t?.appendLocation?0:1).forEach(u=>{if(u.id!==this.location$.value?.location.id){let S=b({},u),k=this.locations$.value;u?.id&&Object.keys(k).forEach(W=>{let te=k[W];te.location?.id===u.id&&(S=b(b({},te.location),u),delete k?.[W])});let A=this.genarateLocationId(S),P={locationId:A,location:S};S.id&&l.push({locationId:A,location:S}),v.push(P);let U=E(b({},k),{[A]:P});this.locations$.next(U)}}),this.updateDocumentLocationMetadata(l),this.coreActionsService.triggerAction(ut.INIT_UPDATE,{event:Y.Events.Doc.SET_LOCATIONS_SUCCESS,methodName:Ja.SET_LOCATIONS,payload:{locations:a,options:t}}),this.analyticsService.trackEvent(Y.Events.Doc.SET_LOCATIONS_SUCCESS,{locations:a,options:t},!0,this.getUserIdForAnalytics()),v}catch(o){this.loggingService.catch("Error in setLocationImpl: ",o);return}}addLocation({location:e,source:t="internal"}){try{return this.loggingService.log("%c[WB] Calling FUNCTION: addLocation","color: green;"),t==="internal"&&this.analyticsService.trackEvent(Y.Events.Core.SET_LOCATIONS_TRIGGERED,{payload:{locations:[e],options:{appendLocation:!0},methodName:"addLocation",source:t}}),this.coreActionsService.triggerAction(ut.INIT_UPDATE,{event:Y.Events.Core.SET_LOCATIONS_TRIGGERED,methodName:Ja.ADD_LOCATION,source:t,payload:{locations:[e],options:{appendLocation:!0}}}),this.setLocationsImpl({locations:[e],options:{appendLocation:!0}})}catch(o){this.loggingService.catch("Error in DocService addLocation:",o);return}}removeLocation({location:e,source:t="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeLocation","color: green;"),t==="internal"&&this.analyticsService.trackEvent(Y.Events.Core.REMOVE_LOCATIONS_TRIGGERED,{payload:{locations:[e],methodName:"removeLocation",source:t}}),this.coreActionsService.triggerAction(ut.INIT_UPDATE,{event:Y.Events.Core.REMOVE_LOCATIONS_TRIGGERED,source:t,methodName:Ja.REMOVE_LOCATION,payload:{locations:[e]}}),e&&this.removeLocationsImpl([e],t)}catch(o){this.loggingService.catch("Error in removeLocation: ",o)}}removeLocations({locations:e,source:t="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeLocations","color: green;"),t==="internal"&&this.analyticsService.trackEvent(Y.Events.Core.REMOVE_LOCATIONS_TRIGGERED,{payload:{locations:e,methodName:"removeLocations",source:t}}),this.coreActionsService.triggerAction(ut.INIT_UPDATE,{event:Y.Events.Core.REMOVE_LOCATIONS_TRIGGERED,methodName:Ja.REMOVE_LOCATIONS,source:t,payload:{locations:e}}),this.removeLocationsImpl(e,t)}catch(o){this.loggingService.catch("Error in removeLocations: ",o)}}removeLocationsImpl(e,t="internal"){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeLocations","color: green;"),t==="internal"&&this.analyticsService.trackEvent(Y.Events.Core.REMOVE_LOCATIONS_TRIGGERED,{payload:{locations:e},methodName:"removeLocations",message:"System removed locations",source:t},!0,this.getUserIdForAnalytics()),e?e.forEach(o=>{let a=this.genarateLocationId(o);this.getLocation()?.locationId===a&&(this.location$.next(null),t!=="internal"&&(this.draftLocationMap.locations=this.draftLocationMap.locations.filter(l=>l.id!==o.id))),this.removeCustomLocation(o)}):(this.location$.next(null),this.locations$.next({}),t!=="internal"&&(this.draftLocationMap.options=void 0,this.draftLocationMap.locations=[])),this.analyticsService.trackEvent(Y.Events.Doc.REMOVE_LOCATIONS_SUCCESS,{payload:{locations:e},source:t},!0,this.getUserIdForAnalytics())}catch(o){this.loggingService.catch("Error in removeLocation: ",o)}}unsetLocationIds(e,t="internal"){try{this.loggingService.log("%c[WB] Calling FUNCTION: unsetLocationIds","color: green;"),this.coreActionsService.triggerAction(ut.INIT_UPDATE,{event:Y.Events.Core.UNSET_LOCATIONS_TRIGGERED,methodName:Ja.UNSET_LOCATION_IDS,source:t,payload:{locationIds:e}}),t==="internal"&&this.analyticsService.trackEvent(Y.Events.Core.UNSET_LOCATIONS_TRIGGERED,{payload:{locationIds:e},methodName:"unsetLocationIds",message:"System unset location ids",source:t},!0,this.getUserIdForAnalytics()),e?.length?e.forEach(o=>{this.getLocation()?.location.id===o&&(this.location$.next(null),t!=="internal"&&(this.draftLocationMap.locations=this.draftLocationMap.locations.filter(a=>a.id!==o))),this.removeCustomLocationId(o)}):(this.location$.next(null),this.locations$.next({}),t!=="internal"&&(this.draftLocationMap.options=void 0,this.draftLocationMap.locations=[])),this.coreActionsService.triggerAction(ut.INIT_UPDATE,{event:Y.Events.Doc.REMOVE_LOCATIONS_SUCCESS,methodName:Ja.REMOVE_LOCATIONS_SUCCESS,source:t,payload:{locationIds:e}}),this.analyticsService.trackEvent(Y.Events.Doc.REMOVE_LOCATIONS_SUCCESS,{payload:{locationIds:e},source:t},!0,this.getUserIdForAnalytics())}catch(o){this.loggingService.catch("Error in unsetLocationIds: ",o)}}getLocation$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getLocation$","color: green;"),this.location$.asObservable()}getLocation(){return this.loggingService.log("%c[WB] Calling FUNCTION: getLocation$","color: green;"),this.location$.value?JSON.parse(JSON.stringify(this.location$.value)):null}excludeLocationIds(e){try{this.excludedLocationIds$.next([...e])}catch(t){this.loggingService.catch("Error in excludeLocationIds: ",t)}}getExcludedLocationIds$(){try{return this.excludedLocationIds$.asObservable()}catch(e){return this.loggingService.catch("Error in getExcludedLocationIds$: ",e),ce([])}}updateOrganizationMetadata(e){return X(this,null,function*(){try{!e&&this.getOrganizationConfig()&&(e=this.getOrganizationConfig());let t=e?.organizationId,o=this.documentPaths$.value;if(this.db&&t&&o?.documentId){if(this.organizationMetadata$.value?.[t])return;let l=new bR;l.apiKey=this.configService?.getApiKey()??"",l.organizationId=t,l.clientOrganizationId=e?.clientOrganizationId,this.userPermissionService?.hasEditAccess({organizationId:t})&&(yield this.commonDbService?.updateData({feature:"organizationMetadata",data:JSON.parse(JSON.stringify(l)),properties:{organizationId:t,documentId:o?.documentId??""}})),yield this.fetchOrganizationMetadata(e)}}catch(t){this.loggingService.catch("Error in updateOrganizationMetadata: ",t)}})}updateFolderMetadata(){return X(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(!e?.veltFolderId||!e?.organizationId)return;if(!(yield this.commonDbService?.getData({feature:"folderMetadata",properties:{organizationId:e?.organizationId??"",folderId:e?.veltFolderId??""}}))?.metadata){let o={folderId:this.documentPaths$.value?.folderId,clientOrganizationId:e?.clientOrganizationId,parentFolderId:"root"};if(this.userPermissionService?.hasEditAccess({folderId:this.documentPaths$.value?.veltFolderId??""})){let a=mr(this.functions,gr({url:wn?.cloudFunction?.sdkProxy,apiProxyDomain:this.configService?.getApiProxyDomain()}));yield Cd({methodName:"createFolder",data:{type:"createFolder",metadata:o},getSdkProxy:a,userId:this.authService.getUser()?.userId??""})}}}}catch(e){this.loggingService.catch("Error in updateFolderMetadata: ",e)}})}updateDocumentMetadata(){return X(this,null,function*(){try{if(this.db&&this.authService.getUser()){let e=this.documentPaths$.value;if(e){let t=this.getDocumentIds();t.find(a=>a.documentId===e.documentId)||t.push({documentId:e.documentId??"",clientDocumentId:e.clientDocumentId??""});let o=t.map(a=>X(this,null,function*(){let l=new cR;this.clientDocumentMetadataMap?.[a.clientDocumentId]&&(l=b(b({},this.clientDocumentMetadataMap[a.clientDocumentId]),l)),l.apiKey=this.configService?.getApiKey()??"",l.documentId=a.documentId,l.clientDocumentId=a.clientDocumentId,l.organizationId=e.organizationId,l.clientOrganizationId=e.clientOrganizationId,l.pageInfo=Wi();let s=e?.folderId,d=e?.veltFolderId;l?.pageInfo?.deviceInfo&&delete l?.pageInfo?.deviceInfo;let v=!0,u=this.documentMetadata$.value?.[a.documentId];if(s&&d){let S=this.getDocumentMetadata(a?.documentId??"")??(yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:a?.documentId??"",organizationId:e?.organizationId??"",field:"metadata"}}));S?.clientDocumentId&&!S?.errorCode?S?.folderId&&(S?.folderId!==s||S?.veltFolderId!==d)?(this.loggingService.catch(`Folder id mismatch for document ${a?.clientDocumentId??""}`),v=!1):S?.folderId===s?(s&&(l.folderId=s),d&&(l.veltFolderId=d)):(this.loggingService.catch(`Document ${a?.clientDocumentId??""} is not in the folder ${s??""}`),v=!1):(s&&(l.folderId=s),d&&(l.veltFolderId=d))}if(u){let S={};Object.entries(l).forEach(([k,A])=>{S[k]=A}),Ei(S,u)&&(v=!1)}v&&this.userPermissionService?.hasEditAccess({documentId:a?.documentId??"",folderId:e?.allDocuments&&e?.veltFolderId?e?.veltFolderId:void 0})&&(yield this.commonDbService?.updateData({feature:"documentMetadata",data:JSON.parse(JSON.stringify(l)),properties:{organizationId:e?.organizationId??"",documentId:a?.documentId??""}}))}));yield Promise.allSettled(o),yield this.fetchDocumentMetadata(t)}}}catch(e){this.loggingService.catch("Error in updateDocumentMetadata: ",e)}})}updateDocumentLocationMetadata(e){return X(this,null,function*(){try{if(this.db&&this.authService.getUser()){let t=this.documentPaths$.value;if(t){let o=this.getDocumentIds();o.find(a=>a.documentId===t.documentId)||o.push({documentId:t.documentId??"",clientDocumentId:t.clientDocumentId??""});for(let a of o){let l=yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:a?.documentId??"",organizationId:t?.organizationId??"",field:"metadata"}});l?.errorCode&&(l={});let s=[];for(let d of e){let v=new uR;v.locationId=d?.locationId,v.veltLocationId=_G(d?.location?.id??""),v.location=d?.location,v.pageInfo=Wi(),v?.pageInfo?.deviceInfo&&delete v?.pageInfo?.deviceInfo;let u=E(b({},l),{[V.FIREBASE_PARTIAL_PATH_LOCATIONS]:E(b({},l[V.FIREBASE_PARTIAL_PATH_LOCATIONS]??{}),{[d?.locationId]:v})});this.commonDbService?.shouldUseFirestore()||s.push(this.commonDbService?.updateData({feature:"documentMetadata",data:JSON.parse(JSON.stringify(u)),properties:{documentId:a?.documentId??"",organizationId:t?.organizationId??""}}));let S=this.locationMetadata$.value;if(S||(S={}),d?.location?.id){let k=S?.[a.documentId],A=k?.[d?.location?.id??""];S&&(k||(S[a.documentId]={}),A||(S[a.documentId][d?.location?.id??""]={}),S[a.documentId][d?.location?.id??""]=E(b({},A),{location:d?.location})),Object.keys(S||{}).length>0&&this.locationMetadata$.next(S)}}yield Promise.allSettled(s)}}}}catch(t){this.loggingService.catch("Error in updateDocumentLocationMetadata: ",t)}})}genarateLocationId(e){try{return e&&typeof e=="object"?Gn(JSON.stringify(fo(e))):0}catch(t){return this.loggingService.catch("Error in genarateLocationId: ",t),0}}removeCustomLocation(e,t="internal"){try{let o=this.genarateLocationId(e),a=this.locations$.value;a[o]&&(delete a[o],this.locations$.next(b({},a)),t!=="internal"&&this.isDocumentIdInDebounceQueue&&(this.draftLocationMap.locations=this.draftLocationMap.locations.filter(l=>l.id!==e.id)))}catch(o){this.loggingService.catch("Error in DocService removeLocation:",o)}}removeCustomLocationId(e,t="internal"){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeCustomLocationId","color: green;");let o=this.locations$.value;Object.entries(o).forEach(([a,l])=>{l.location.id===e&&(delete o[a],this.locations$.next(b({},o)),t!=="internal"&&this.isDocumentIdInDebounceQueue&&(this.draftLocationMap.locations=this.draftLocationMap.locations.filter(s=>s.id!==e)))})}catch(o){this.loggingService.catch("Error in DocService removeCustomLocationId:",o)}}getLocationByClientLocationId(e){try{let t=this.getLocation()?.location;if(t?.id===e)return t;{let o=this.getLocations();Object.keys(o).forEach(a=>{let l=o[a];l.location?.id===e&&(t=l.location)})}return t}catch(t){this.loggingService.catch("Error in DocService getLocationByClientLocationId:",t);return}}removeLocationIfNotInDom(){try{let e=this.locations$.value,t=document.querySelectorAll(`[${V.ATTRIBUTES.VELT_LOCATION}]`),o=[];t.forEach(a=>{let l=a.getAttribute(V.ATTRIBUTES.VELT_LOCATION);if(l){let s=JSON.parse(l),d=this.genarateLocationId(s);o.push(d)}}),Object.keys(e).forEach(a=>{let l=e[a];o.includes(l.locationId)||delete e[a]}),this.locations$.next(b({},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),ce({})}}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 t=null;if(e?.getAttribute(V.ATTRIBUTES.VELT_LOCATION)?t=e:t=e.closest(`[${V.ATTRIBUTES.VELT_LOCATION}]`),t){let o=t?.getAttribute(V.ATTRIBUTES.VELT_LOCATION);if(o){let a=JSON.parse(o);return{locationId:this.genarateLocationId(a),location:a}}}return null}catch(t){return this.loggingService.catch("Error in DocService getLocationFromElement:",t),null}}getElementMapWithLocation(){try{this.loggingService.log("%c[WB] Calling FUNCTION: getElementMapWithLocation","color: green;");let e={};return document.querySelectorAll(`[${V.ATTRIBUTES.VELT_LOCATION}], [${V.ATTRIBUTES.VELT_LOCATION_ID}]`).forEach(o=>{if(o.getAttribute(V.ATTRIBUTES.VELT_LOCATION)){let a=this.getLocationFromElement(o);a?.locationId&&(e[a.locationId]={element:o,location:a})}else if(o.getAttribute(V.ATTRIBUTES.VELT_LOCATION_ID)){let a=o.getAttribute(V.ATTRIBUTES.VELT_LOCATION_ID);if(a){let l=this.getLocationByClientLocationId(a);l?.locationId&&(e[l.locationId]={element:o,location:l});let s={id:a},d=this.genarateLocationId(s);e[a]={element:o,location:{locationId:d,location:s}}}}}),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 t;if(t=e?.closest(`[${V.ATTRIBUTES.VELT_LOCATION}], [${V.ATTRIBUTES.VELT_LOCATION_ID}]`),t){if(t?.getAttribute(V.ATTRIBUTES.VELT_LOCATION)){let o=t?.getAttribute(V.ATTRIBUTES.VELT_LOCATION);if(o)return JSON.parse(o)}else if(t?.getAttribute(V.ATTRIBUTES.VELT_LOCATION_ID)){let o=t?.getAttribute(V.ATTRIBUTES.VELT_LOCATION_ID);if(o)return{id:o}}}return null}catch(t){return this.loggingService.catch("Error in DocService getAdditionLocationFromElement:",t),null}}getAdditionalDocumentIdFromElement(e){try{return e?.closest(`[${V.ATTRIBUTES.VELT_DOCUMENT_ID}]`)?.getAttribute(V.ATTRIBUTES.VELT_DOCUMENT_ID)||null}catch(t){return this.loggingService.catch("Error in DocService getAdditionalDocumentIdFromElement:",t),null}}getDocumentMetadata(e){try{return e?this.documentMetadata$.value?.[e]||null:this.documentMetadata$.value?.[this.documentPaths$.value?.documentId??""]||null}catch(t){return this.loggingService.catch("Error in DocService getDocumentMetadata:",t),null}}getAllDocumentMetadata$(e){return this.getAllDocumentMetadataMap$().pipe(ge(t=>t?.[e??this.documentPaths$.value?.documentId??""]||null),xt(Qt))}getAllDocumentMetadata(){try{return Object.values(this.documentMetadata$.value||{})}catch(e){return this.loggingService.catch("Error in DocService getAllDocumentMetadata:",e),[]}}getAllDocumentMetadataMap$(){return this.documentMetadata$.asObservable().pipe(ge(e=>e||{}),xt(Qt))}getAllDocumentMetadataMap(){try{return 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||{},t={},o=this.documentPaths$.value?.veltFolderId,a=this.documentPaths$.value?.allDocuments;if(o&&a)Object.values(e).forEach(l=>{l?.documentId&&l?.veltFolderId===o&&(t[l.documentId]=l)});else{let l=this.documentIds$.value;if(l?.length)l.forEach(s=>{let d=e?.[s.documentId];d&&(t[s.documentId]=d)});else if(this.documentPaths$.value?.documentId){let s=e?.[this.documentPaths$.value?.documentId];s&&(t[this.documentPaths$.value?.documentId]=s)}}return Object.values(t)}catch(e){return this.loggingService.catch("Error in DocService getDocumentMetadataOfAvailableDocuments:",e),[]}}getDocumentMetadata$(e){return this.documentMetadata$.asObservable().pipe(ge(t=>t?.[e??this.documentPaths$.value?.documentId??""]||null),xt(Qt))}setDocumentMetadata(e,t){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocumentMetadata","color: green;");let o=JSON.parse(JSON.stringify(this.documentMetadata$.value??{}));o[e]=t,this.documentMetadata$.next(o)}catch(o){this.loggingService.catch("Error in DocService setDocumentMetadata:",o)}}setAllDocumentMetadata(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setAllDocumentMetadata","color: green;"),this.documentMetadata$.next(e)}catch(t){this.loggingService.catch("Error in DocService setAllDocumentMetadata:",t)}}getOrganizationMetadata(e){return this.organizationMetadata$.value?.[e]||null}getOrganizationMetadata$(e){return this.organizationMetadata$.asObservable().pipe(ge(t=>t?.[e]||null))}getOrganizationMetadataMap$(){return this.organizationMetadata$.asObservable().pipe(ge(e=>e||{}),xt(Qt))}getCustomerMetadata(){return this.customerMetadata$.value}getCustomerMetadata$(){return this.customerMetadata$.asObservable()}getOrganizationConfig$(){return this.organizationConfig$.asObservable().pipe(xt(Qt))}getOrganizationConfig(){return this.organizationConfig$.value}getMetadataFromType(e,t){try{switch(e){case"area":return;case"comment":return t?.multiThreadAnnotationId?this.commentService?.getMultiThreadAnnotationById(t.multiThreadAnnotationId)?.metadata:void 0;case"reaction":case"recorder":return t?.commentAnnotationId?this.commentService?.getAnnotationById(t.commentAnnotationId)?.metadata:void 0;default:return}}catch(o){this.loggingService.catch("Error in DocService getMetadataFromType:",o);return}}getDefaultMetadata({clientDocumentId:e,documentId:t}){try{let o=this.documentPaths$.value;if(!o)return;let a=e||o.clientDocumentId,l=t||o.documentId,s=this.getDocumentMetadata(l);if(!s)return;let d=s?.folderId,v=s?.veltFolderId;return b(b({apiKey:this.configService.getApiKey()??void 0,clientDocumentId:a,clientOrganizationId:o.clientOrganizationId,documentId:l,organizationId:o.organizationId},d?{folderId:d}:{}),v?{veltFolderId:v}:{})}catch(o){this.loggingService.catch("Error in DocService getDefaultMetadata:",o);return}}getBaseMetadata(e,t){try{let o,a;t?.element?o=this.getAdditionalDocumentIdFromElement(t.element)||void 0:t?.clientDocumentId&&(o=t.clientDocumentId),o&&(a=this.generateDocumentId(o));let l=this.getMetadataFromType(e,t),s=this.getDefaultMetadata({clientDocumentId:o,documentId:a});return l||s||{}}catch(o){return this.loggingService.catch("Error in DocService getBaseMetadata:",o),{}}}getServerId({documentId:e,organizationId:t}){try{return e&&(e=this.generateDocumentId(e)),t&&(t=this.generateOrganizationId(t)),{documentId:e,organizationId:t}}catch(o){return this.loggingService.catch("Error in DocService getServerId:",o),null}}fetchDocuments(e){return X(this,null,function*(){try{if(!this.authService.getUser())return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),[];let o=[];if(!e?.organizationId)return this.loggingService.catch("Error in fetchDocuments: organizationId is required"),[];if(e?.folderId){let l=Mi(e?.folderId);o.push(vt("metadata.veltFolderId","==",l))}return e?.documentIds?.length&&!e?.allDocuments&&o.push(vt("metadata.documentId","in",e?.documentIds?.map(l=>this.generateDocumentId(l)).slice(0,30))),yield this.commonDbService?.queryData({feature:"allDocuments",properties:{firestoreQuery:o,apiKey:this.apiKey??"",organizationId:this.generateOrganizationId(e?.organizationId)??this.documentPaths$.value?.organizationId,documentId:this.documentPaths$.value?.documentId}})}catch(t){return this.loggingService.catch("Error in DocService fetchDocuments:",t),[]}})}fetchLocations(e){return X(this,null,function*(){try{if(!this.authService.getUser())return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),[];let o=[];if(!e?.organizationId)return this.commonDbService?.shouldUseFirestore()&&this.loggingService.catch("Error in fetchLocations: organizationId is required"),[];if(e?.folderId){let l=Mi(e?.folderId);o.push(vt("metadata.veltFolderId","==",l))}return e?.documentIds?.length&&!e?.allDocuments&&o.push(vt("metadata.documentId","in",e?.documentIds?.map(l=>this.generateDocumentId(l)).slice(0,30))),yield this.commonDbService?.queryData({feature:"allLocations",properties:{firestoreQuery:o,apiKey:this.apiKey??"",organizationId:this.generateOrganizationId(e?.organizationId)??this.documentPaths$.value?.organizationId,documentId:this.documentPaths$.value?.documentId}})}catch(t){return this.loggingService.catch("Error in DocService fetchLocations:",t),[]}})}updateDocuments(e){return X(this,null,function*(){try{if(typeof e=="object"&&(e=JSON.parse(JSON.stringify(e??{}))),!this.authService.getUser())return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),[];let{organizationId:o,documents:a,folderId:l}=e;if(!o&&(o=this.documentPaths$.value?.clientOrganizationId,!o))return this.loggingService.catch("Error in updateDocuments: organizationId is required"),[];let s=Xa(o);if(!a||a.length===0)return this.loggingService.catch("Error in updateDocuments: documents is required"),[];let d=[],v=this.documentMetadata$.value??{};for(let u of a)if(u?.documentId){u.organizationId=s,u.clientOrganizationId=o,u.clientDocumentId=u.documentId;let S=Bo(u.documentId);u.documentId=S,u.apiKey=this.configService.getApiKey()??void 0,(l||this.documentPaths$.value?.folderId)&&(u.folderId=l||this.documentPaths$.value?.folderId,u.veltFolderId=Mi(l||this.documentPaths$.value?.folderId||""));let k=()=>{if(l&&this.documentPaths$.value?.folderId&&l!==this.documentPaths$.value?.folderId)return;let P=v?.[S];P?v[S]=b(b({},P),u):v[S]=u},A=yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:S,organizationId:s,field:"metadata"}});if(A?.errorCode&&(A={}),A&&A.apiKey&&A.folderId&&l&&A.folderId!=u.folderId){this.loggingService.catch(`Error in updateDocuments: document ${u.clientDocumentId} already exists with different folderId: ${A.folderId}`);continue}if(A&&A.apiKey&&!A.folderId&&u.folderId){this.loggingService.catch(`Error in updateDocuments: document ${u.clientDocumentId} already exists, move this document to folder with REST API`);continue}k(),u&&this.commonDbService&&this.userPermissionService?.hasEditAccess({documentId:u?.documentId??""})&&d.push(this.commonDbService.updateData({feature:"documentMetadata",data:JSON.parse(JSON.stringify(u)),properties:{organizationId:s,documentId:S}}))}yield Promise.all(d),this.setAllDocumentMetadata(v)}catch(t){return this.loggingService.catch("Error in DocService updateDocuments:",t),[]}})}updateLocations(e){return X(this,null,function*(){try{if(!this.authService.getUser())return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),[];let{organizationId:o,locations:a,documentIds:l}=e;if((!l||l.length===0)&&(l=this.documentIds$.value.map(u=>u.clientDocumentId)??[],l.length===0))return this.loggingService.catch("Error in updateLocations: documentId is required"),[];if(!o&&(o=this.documentPaths$.value?.clientOrganizationId,!o))return this.loggingService.catch("Error in updateLocations: organizationId is required"),[];if(!a||a.length===0)return this.loggingService.catch("Error in updateLocations: locations is required"),[];let s=l.map(u=>Bo(u)),d=[],v=this.locationMetadata$.value;v||(v={}),s.forEach(u=>{a.forEach(S=>{let k=this.location$.value;if(S?.id===k?.location?.id&&this.location$.next({locationId:k?.locationId,location:S}),S?.id){delete S?.metadata;let A=_G(S.id),P=v?.[u],U=P?.[S.id];v&&(P||(v[u]={}),U||(v[u][S.id]={}),v[u][S.id]=E(b({},U),{location:S})),S&&this.commonDbService&&d.push(this.commonDbService.updateData({feature:"locationMetadata",data:JSON.parse(JSON.stringify({location:S})),properties:{organizationId:Xa(o),documentId:u,id:A}}))}})}),yield Promise.all(d),Object.keys(v||{}).length>0&&this.locationMetadata$.next(v)}catch(t){return this.loggingService.catch("Error in DocService updateLocations:",t),[]}})}fetchFolders(e){return X(this,null,function*(){try{if(!this.authService.getUser())return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),[];let o=[];if(!e?.organizationId)return this.loggingService.catch("Error in fetchFolders: organizationId is required"),{data:[],parentFolders:[]};let a=[],l=this.generateOrganizationId(e?.organizationId);if(e?.folderId){let s=Mi(e?.folderId);o=yield this.commonDbService?.getData({feature:"folder",properties:{folderId:s,apiKey:this.apiKey??"",organizationId:l,documentId:this.documentPaths$.value?.documentId}}),o&&(o=[o]),a=yield this.commonDbService?.queryData({feature:"allFolders",properties:{firestoreQuery:[vt("metadata.veltParentFolderId","==",s)],folderId:s,apiKey:this.apiKey??"",organizationId:l,documentId:this.documentPaths$.value?.documentId}})}else o=yield this.commonDbService?.queryData({feature:"allFolders",properties:{apiKey:this.apiKey??"",organizationId:l,documentId:this.documentPaths$.value?.documentId}});return{data:o,parentFolders:a}}catch(t){return this.loggingService.catch("Error in DocService getFoldersRequest:",t),{data:[],parentFolders:[]}}})}getDocumentIam$(){return this.authService.getUser$().pipe(fe(e=>e?this.documentPaths$.pipe(fe(t=>t?.documentIam?this.commonDbService?.dbListener({feature:"documentIam",properties:{documentId:t.documentId,organizationId:t.organizationId,isCollection:!1}}).pipe(ge(o=>o?.data?.docIamConfig??o?.data),xt((o,a)=>JSON.stringify(o??{})===JSON.stringify(a??{}))):ce(null))):ce(null)))}getDocumentAccessType(e){try{return e&&e.features&&e.features.all?e.features.all.restricted?Ui.RESTRICTED:Ui.PUBLIC:e&&e.documentAccessType?e.documentAccessType:Ui.PUBLIC}catch(t){return this.loggingService.catch("Error in DocService getDocumentAccessType:",t),Ui.PUBLIC}}changeDocumentAccessType(e){return X(this,null,function*(){try{let t=this.documentPaths$.value;if(t){let o=yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:t?.documentId??"",organizationId:t?.organizationId??"",field:"docIamConfig"}});if(o?.errorCode)return;switch(delete o.documentAccessType,o.features||(o.features={}),o.features.all||(o.features.all={}),e){case Ui.PUBLIC:o.features.all.restricted=!1;break;case Ui.RESTRICTED:o.features.all.restricted=!0,o.features.all.guestMode=!1;break;default:break}this.commonDbService?.updateData({feature:"documentAccessType",data:JSON.parse(JSON.stringify(o)),properties:{documentId:t?.documentId??"",organizationId:t?.organizationId??""}})}}catch(t){this.loggingService.catch("Error in DocService changeDocumentAccessType:",t)}})}getUserIdForAnalytics(){try{return this.authService?.getAuthUser()?.uid||""}catch(e){return this.loggingService.catch("Error in DocService getUserIdForAnalytics:",e),""}}setUIState(e){try{this.uiState.next(b(b({},this.uiState.value),e))}catch(t){this.loggingService.catch("Error in DocService setUIState:",t)}}getUIState$(){return this.uiState.asObservable()}};r.\u0275fac=function(t){return new(t||r)(J(rt),J(Ge),J(On),J(Ve),J(Lt),J(x),J(vs),J(Pm),J(pi),J(Lr))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var Dn=(()=>{let r=class r{constructor(e,t,o,a,l){this.analyticsService=e,this.authService=t,this.coreActionsService=o,this.docService=a,this.loggingService=l,this.resolveOrganizationUsers=new be(!0),this.resolveFolderUsers=new be(!0),this.resolveDocumentUsers=new be(!0),this.unresolvedUsers=new be([]),this.resolveTimeout=60*1e3,this.resolveAttempts=new Map,this.subscriptions=new Fn,this.userDataProvider$=new be(null),this.anonymousUserDataProvider$=new be(null),this.userIdByEmailCache={},this.userById$=new be({}),this.userByIdCalled$=new be({}),this.pendingResolutions=new Set,this.getUserById=s=>{try{return this.userById$.value?.[s]}catch(d){this.loggingService.catch("Error in UsersService getUserById:",d);return}};try{this.docService.setUsersService(this),this.analyticsService.setUserService(this),this.authService.setUsersService(this),this.docService.getDocumentPaths$().pipe(je(s=>!!s),fe(()=>this.getUnresolvedUsers$().pipe(je(s=>s.length>0),Zi(300),st(20),fe(s=>{let d=this.docService.getOrganizationConfig()?.organizationId;return this.commonDbService?this.commonDbService?.dbListener({feature:"allOrganizationUsers",properties:{organizationId:d,isCollection:!0,useQuery:!0,firestoreQuery:[yi(vt("user.userId","in",s.slice(0,20)))]}}).pipe(ge(v=>v?.data),rn(v=>{if(v&&typeof v=="object"){delete v.undefined,delete v.null;let u=Object.values(v??{});this.setUserByIds(u.map(k=>k.user));let S=s.filter(k=>!u.some(A=>A.user.userId===k));S.length!==s.length&&this.setUnresolvedUsers(S)}})):ce([])})))).subscribe()}catch(s){this.loggingService.catch("Error in UsersService constructor:",s)}}setCommonDbService(e){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setCommonDbService","color: green;"),this.commonDbService=e}catch(t){this.loggingService.catch("Error in UsersService setCommonDbService:",t)}}setContactService(e){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setContactService","color: green;"),this.contactService=e}catch(t){this.loggingService.catch("Error in UsersService setContactService:",t)}}ngOnDestroy(){try{this.subscriptions.unsubscribe(),this.pendingResolutions.clear(),this.resolveAttempts.clear()}catch(e){this.loggingService.catch("Error in UsersService ngOnDestroy:",e)}}isResolverForFeatureDisabled(e){let t=this.userDataProvider$.getValue();try{switch(e){case"allOrganizationUsers":return t?!this.resolveOrganizationUsers.value:!0;case"allFolderUsers":return t?!this.resolveFolderUsers.value:!0;case"allDocumentUsers":return t?!this.resolveDocumentUsers.value:!0;default:return!1}}catch(o){return this.loggingService.catch("Error in UsersService isResolverForFeatureDisabled:",o),!1}}resolveUsers(v){return X(this,arguments,function*({userIds:e,forceResolve:t,feature:o,organizationId:a,skipUserCheck:l=!1,uniqueId:s,moduleName:d}){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: resolveUsers","color: green;");let u=!1;if(o&&(u=this.isResolverForFeatureDisabled(o)),u)return{};{let S={},k=[],A={};if(e?.forEach(P=>{let U=this.getUserById(P);U?S[P]=U:this.userByIdCalled$.getValue()[P]?t&&k.push(P):(k.push(P),this.userByIdCalled$.next(E(b({},this.userByIdCalled$.getValue()),{[P]:!0})))}),k.length>0){let P=s||St();this.coreActionsService.triggerAction(ut.USER_RESOLVER,{event:Y.Events.Resolver.USER_RESOLUTION_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:P,moduleName:d,methodName:eo.RESOLVE_USERS,source:"internal",payload:{userIds:k,organizationId:a,feature:o,forceResolve:t,skipUserCheck:l,externalUserDataProviderAvailable:this.externalUserDataProviderAvailable()}});let U={};try{let W,te=new Promise((ye,me)=>{W=setTimeout(()=>{me(new Error("User resolution timeout"))},this.userDataProvider$.getValue()?.config?.resolveTimeout||this.userDataProvider$.getValue()?.resolveTimeout||this.resolveTimeout)});U=yield Promise.race([this.getUsersFromDB({userIds:k,organizationId:a,skipUserCheck:l}).finally(()=>{clearTimeout(W)}),te]),this.analyticsService.trackEvent(Y.Events.Resolver.USER_RESOLVER_GET,{sourceMethod:"resolveUsers",source:"sdk",userIds:k}),this.coreActionsService.triggerAction(ut.USER_RESOLVER,{event:Y.Events.Resolver.USER_RESOLUTION_RESULT,timestamp:new Date().getTime(),uniqueId:P,methodName:eo.RESOLVE_USERS,moduleName:d,source:"internal",payload:{result:U,userIds:k,externalUserDataProviderAvailable:this.externalUserDataProviderAvailable()}})}catch(W){this.loggingService.catch("Error in UsersService resolveUsers getUsers:",W,{userIds:k}),this.coreActionsService.triggerAction(ut.USER_RESOLVER,{event:Y.Events.Resolver.USER_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:P,methodName:eo.RESOLVE_USERS,moduleName:d,source:"internal",payload:{error:W,userIds:k,externalUserDataProviderAvailable:this.externalUserDataProviderAvailable()}})}finally{k?.forEach(W=>{if(!U[W]){let te=new Set([...this.getUnresolvedUsers(),W]);this.unresolvedUsers.next(Array.from(te)),U[W]={userId:W,name:`User ${W}`}}})}Object.entries(U).forEach(([W,te])=>{te&&(S[W]=U?.[W],A[W]=U?.[W])})}return Object.keys(A).length>0&&(this.authService.setOptionalPropertiesToUsers(Object.values(A)),this.userById$.next(b(b({},this.userById$.getValue()),A))),S}}catch(u){this.loggingService.catch("Error in UsersService resolveUsers:",u);let S=s||St();return this.coreActionsService.triggerAction(ut.USER_RESOLVER,{event:Y.Events.Resolver.USER_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:S,methodName:eo.RESOLVE_USERS,moduleName:d,source:"internal",payload:{error:u,userIds:e,externalUserDataProviderAvailable:this.externalUserDataProviderAvailable()}}),{}}})}getUnresolvedUsers$(){return this.unresolvedUsers.asObservable()}getUnresolvedUsers(){this.loggingService.log("%c[WB] Calling UsersService FUNCTION: getUnresolvedUsers","color: green;");try{return JSON.parse(JSON.stringify(this.unresolvedUsers.getValue()))}catch(e){return this.loggingService.catch("Error in UsersService getUnresolvedUsers:",e),[]}}setUnresolvedUsers(e){this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setUnresolvedUsers","color: green;");try{if(Array.isArray(e)){let t=JSON.parse(JSON.stringify(e));this.unresolvedUsers.next(t)}}catch(t){this.loggingService.catch("Error in UsersService setUnresolvedUsers:",t)}}getUsersFromDB(a){return X(this,arguments,function*({userIds:e,organizationId:t,skipUserCheck:o=!1}){this.loggingService.log("%c[WB] Calling UsersService FUNCTION: getUsersFromDB","color: green;");try{let l=this.userDataProvider$.getValue();if(l){if(l.config?.getConfig?.url){if(t||(t=this.docService.getOrganizationConfig()?.organizationId),!t)return this.loggingService.catch("Error in getUsersFromDB: organizationId is required when using getConfig"),{};let u={organizationId:t,userIds:e},S=yield Sc(l.config.getConfig.url,l.config.getConfig.headers,u,!0);return S.statusCode!==200?(this.loggingService.catch(`Error in getUsersFromDB: config-based request failed with statusCode ${S.statusCode}. Message: ${S.message||"Unknown error"}`),{}):S.data??{}}let v=yield l.get(e);if(v&&typeof v=="object"&&"success"in v&&"statusCode"in v&&typeof v.success=="boolean"&&typeof v.statusCode=="number"){let u=v;return u.statusCode===200&&u.data?u.data:(this.loggingService.catch(`Error in getUsersFromDB: provider returned error response with statusCode ${u.statusCode}`),{})}return v}if(t||(t=this.docService.getOrganizationConfig()?.organizationId),!t)return{};let s=(yield this.getUsersFromDBWithBatching({userIds:e,organizationId:t,skipUserCheck:o}))??[];this.contactService?.setResolvedUsers(s.flat());let d={};return s.forEach(v=>{v.forEach(u=>{u?.user?.userId&&(d[u.user.userId]=u.user)})}),d}catch(l){return this.loggingService.catch("Error in UsersService getUsersFromDB:",l),{}}})}getUsersFromDBWithBatching(a){return X(this,arguments,function*({userIds:e,organizationId:t,skipUserCheck:o=!1}){try{if(!e?.length)return[];let l=[];for(let v=0;v<e.length;v+=30)l.push(e.slice(v,v+30));let s=l.map((v,u)=>X(this,null,function*(){try{return(yield this.commonDbService?.queryData({feature:"allOrganizationUsers",properties:{organizationId:t,useCollectionGroup:!1,isCollection:!0,firestoreQuery:[vt("user.userId","in",v)],skipUserCheck:o}}))||[]}catch(S){return this.loggingService.catch(`Error in batch ${u+1}:`,S),[]}}));return yield Promise.all(s)}catch(l){return this.loggingService.catch("Error in getUsersFromDBWithBatching:",l),[]}})}getTemporaryUsersFromDBWithBatching(a){return X(this,arguments,function*({userIds:e,organizationId:t,resourceIds:o}){try{if(!e?.length||!o?.length)return[];let l=[];for(let P=0;P<e.length;P+=30)l.push(e.slice(P,P+30));let s=[];for(let P=0;P<o.length;P+=30)s.push(o.slice(P,P+30));let d=[],v=0,u=(P,U)=>X(this,null,function*(){try{return((yield this.commonDbService?.queryData({feature:"allPermissionsUsers",properties:{organizationId:t,useCollectionGroup:!1,isCollection:!0,firestoreQuery:[yi(vt("userId","in",P),vt("veltResourceId","in",U))]}}))??[])||[]}catch(W){return this.loggingService.catch(`Error in batch ${v+1}:`,W),[]}});for(let P of l)for(let U of s)d.push(u(P,U)),v++;return(yield Promise.all(d)).flat().filter((P,U,W)=>U===W.findIndex(te=>te.userId===P.userId&&te.resourceId===P.resourceId))}catch(l){return this.loggingService.catch("Error in getTemporaryUsersFromDBWithBatching:",l),[]}})}getResolveOrganizationUsers$(){return this.resolveOrganizationUsers.asObservable()}getResolveFolderUsers$(){return this.resolveFolderUsers.asObservable()}getResolveDocumentUsers$(){return this.resolveDocumentUsers.asObservable()}getUserById$(){try{return this.loggingService.log("%c[WB] Calling UsersService FUNCTION: getUserById$","color: green;"),this.userById$.asObservable().pipe(xt(Qt))}catch(e){return this.loggingService.catch("Error in UsersService getUserById$:",e),ce({})}}setUserByIds(e){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setUserByIds","color: green;");let t=JSON.parse(JSON.stringify(this.userById$.getValue()??{}));e.forEach(o=>{t[o.userId]=b(b({},t?.[o.userId]??{}),o)}),this.userById$.next(t)}catch(t){this.loggingService.catch("Error in UsersService setUserByIds:",t)}}setUserDataProvider(e){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setUserDataProvider","color: green;");let t=e.config?.getConfig?.url,o="get"in e&&typeof e.get=="function";if(!t&&!o){this.loggingService.catch("DataProviders.user is invalid. The get method is missing or is not a function (and no getConfig provided).");return}this.userDataProvider$.next(e),e.config?.resolveUsersConfig?.organization===!1?this.resolveOrganizationUsers.next(!1):this.resolveOrganizationUsers.next(!0),e.config?.resolveUsersConfig?.folder===!1?this.resolveFolderUsers.next(!1):this.resolveFolderUsers.next(!0),e.config?.resolveUsersConfig?.document===!1?this.resolveDocumentUsers.next(!1):this.resolveDocumentUsers.next(!0)}catch(t){this.loggingService.catch("Error in UsersService setUserDataProvider:",t)}}setAnonymousUserDataProvider(e){try{if(this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setAnonymousUserDataProvider","color: green;"),!("resolveUserIdsByEmail"in e)||typeof e.resolveUserIdsByEmail!="function"){this.loggingService.catch("setAnonymousUserDataProvider is invalid. The resolveUserIdsByEmail method is missing or is not a function.");return}this.anonymousUserDataProvider$.next(e)}catch(t){this.loggingService.catch("Error in UsersService setAnonymousUserDataProvider:",t)}}resolveUserIdsByEmail(o){return X(this,arguments,function*({emails:e,uniqueId:t}){try{if(this.loggingService.log("%c[WB] Calling UsersService FUNCTION: resolveUserIdsByEmail","color: green;"),!e?.length)return{};let a=this.anonymousUserDataProvider$.getValue();if(!a||typeof a.resolveUserIdsByEmail!="function")return{};let l=[...new Set(e.filter(me=>!!me))];if(l.length===0)return{};let s={},d=[];if(l.forEach(me=>{let ke=this.userIdByEmailCache[me];ke?s[me]=ke:d.push(me)}),d.length===0)return s;let v=this.docService.getOrganizationConfig()?.clientOrganizationId||"",u=this.docService.getDocumentPaths()?.clientDocumentId||"",S=this.docService.getDocumentPaths()?.folderId||"",k={organizationId:v,documentId:u,folderId:S,emails:d},A=t||St();this.coreActionsService.triggerAction(ut.USER_RESOLVER,{event:Y.Events.Resolver.EMAIL_USER_ID_RESOLUTION_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:A,methodName:eo.RESOLVE_USER_IDS_BY_EMAIL,source:"internal",payload:{emails:d,organizationId:v,documentId:u,folderId:S}});let P=a.config?.resolveTimeout||this.resolveTimeout,U,W=new Promise((me,ke)=>{U=setTimeout(()=>{ke(new Error("resolveUserIdsByEmail timeout"))},P)}),te=a.config?.getRetryConfig||{retryCount:0,retryDelay:0},ye=X(this,null,function*(){try{let me=yield Bs(()=>a.resolveUserIdsByEmail(k),"resolveUserIdsByEmail",te);return me?.statusCode===200&&me?.data?me.data:(this.loggingService.catch(`Error in resolveUserIdsByEmail: provider returned statusCode ${me?.statusCode}. Message: ${me?.message||"Unknown error"}`),{})}finally{clearTimeout(U)}});try{let me=yield Promise.race([ye,W]);return Object.entries(me).forEach(([ke,De])=>{De&&(this.userIdByEmailCache[ke]=De,s[ke]=De,this.externalUserDataProviderAvailable()||this.docService.addUserInfoToOrganization({organizationId:this.docService.getOrganizationConfig()?.clientOrganizationId??"",user:{userId:De,name:ke,email:ke},currentUserId:this.authService.getUser()?.userId??""}).catch(Ie=>{this.loggingService.catch("Error in UsersService resolveUserIdsByEmail addUserInfoToOrganization:",Ie)}))}),this.coreActionsService.triggerAction(ut.USER_RESOLVER,{event:Y.Events.Resolver.EMAIL_USER_ID_RESOLUTION_RESULT,timestamp:new Date().getTime(),uniqueId:A,methodName:eo.RESOLVE_USER_IDS_BY_EMAIL,source:"internal",payload:{result:me,emails:d}}),s}catch(me){return this.loggingService.catch("Error in UsersService resolveUserIdsByEmail (timeout/race):",me),this.coreActionsService.triggerAction(ut.USER_RESOLVER,{event:Y.Events.Resolver.EMAIL_USER_ID_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:A,methodName:eo.RESOLVE_USER_IDS_BY_EMAIL,source:"internal",payload:{error:me,emails:d}}),s}}catch(a){return this.loggingService.catch("Error in UsersService resolveUserIdsByEmail:",a),{}}})}externalUserDataProviderAvailable(){try{return this.loggingService.log("%c[WB] Calling UsersService FUNCTION: externalUserDataProviderAvailable","color: green;"),!!this.commonDbService?.shouldUseFirestore()&&!!this.userDataProvider$.getValue()}catch(e){return this.loggingService.catch("Error in UsersService externalUserDataProviderAvailable:",e),!1}}userDataProviderAvailable(){try{return this.loggingService.log("%c[WB] Calling UsersService FUNCTION: userDataProviderAvailable","color: green;"),!!this.commonDbService?.shouldUseFirestore()}catch(e){return this.loggingService.catch("Error in UsersService userDataProviderAvailable:",e),!1}}};r.\u0275fac=function(t){return new(t||r)(J(rt),J(Ge),J(pi),J(lt),J(x))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var due=(()=>{let r=class r{constructor(e,t){this.loggingService=e,this.usersService=t}getUserIdsToResolveFromAreaAnnotations(e){try{this.loggingService.log("%c[WB] Calling AreaUtilsService FUNCTION: getUserIdsToResolveFromAreaAnnotations","color: green;");let t=new Set;for(let o of e)o?.from?.userId&&t.add(o?.from?.userId);return Array.from(t)}catch(t){return this.loggingService.catch("Error in AreaUtilsService getUserIdsToResolveFromAreaAnnotations:",t),[]}}mergeAreaWithUser(e){try{if(this.loggingService.log("%c[WB] Calling AreaUtilsService FUNCTION: mergeAreaWithUser","color: green;"),e?.from?.userId){let t=this.usersService.getUserById(e?.from?.userId);t&&(e.from=t)}return e}catch(t){return this.loggingService.catch("Error in AreaUtilsService mergeAreaWithUser:",t),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(t){return this.loggingService.catch("Error in AreaUtilsService formatAreaData:",t),e}}};r.\u0275fac=function(t){return new(t||r)(J(x),J(Dn))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var mue=(()=>{let r=class r{constructor(e,t){this.loggingService=e,this.usersService=t}getUserIdsToResolveFromArrowAnnotations(e){try{this.loggingService.log("%c[WB] Calling ArrowUtilsService FUNCTION: getUserIdsToResolveFromArrowAnnotations","color: green;");let t=new Set;for(let o of e)o?.from?.userId&&t.add(o?.from?.userId);return Array.from(t)}catch(t){return this.loggingService.catch("Error in ArrowUtilsService getUserIdsToResolveFromArrowAnnotations:",t),[]}}mergeArrowWithUser(e){try{if(this.loggingService.log("%c[WB] Calling ArrowUtilsService FUNCTION: mergeArrowWithUser","color: green;"),e?.from?.userId){let t=this.usersService.getUserById(e?.from?.userId);t&&(e.from=t)}return e}catch(t){return this.loggingService.catch("Error in ArrowUtilsService mergeArrowWithUser:",t),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(t){return this.loggingService.catch("Error in ArrowUtilsService formatArrowData:",t),e}}};r.\u0275fac=function(t){return new(t||r)(J(x),J(Dn))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var Iu=class{static getFirestoreProdDbName(r,i){return i?.databaseURL?.includes("snippyly-plugin.firebaseio.com")||i?.databaseURL?.includes("snippyly-plugin-staging.firebaseio.com")?"sfdb":i?.storeDbId??(this.isTestingDb(i?.databaseURL??"")?"sdktest":`apikey${r.toLowerCase()}`)}static isTestingDb(r){try{return r.includes("-test")}catch(i){return tt.error("Error in isTestingDb:",i),!1}}};var Eu=(()=>{let r=class r{constructor(e,t,o){this.coreActionsService=e,this.loggingService=t,this.analyticsService=o,this.retrySaveConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryDeleteConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.attachmentDataProvider$=new be(null);try{this.loggingService.log("AttachmentResolverService initialized"),this.attachmentDataProvider$.subscribe(a=>{a&&(a.config?.saveRetryConfig&&(this.retrySaveConfig=a.config.saveRetryConfig),a.config?.deleteRetryConfig&&(this.retryDeleteConfig=a.config.deleteRetryConfig))})}catch(a){this.loggingService.catch("Error in AttachmentResolverService constructor:",a)}}getProvider(){try{let e=this.attachmentDataProvider$.getValue();return e||void 0}catch(e){this.loggingService.catch("Error in AttachmentResolverService getProvider:",e);return}}makeAttachmentConfigBasedRequest(e,t,o,a){return X(this,null,function*(){try{let l=new FormData;l.append("file",o);let s={attachment:{attachmentId:a.attachment.attachmentId,name:a.attachment.name,mimeType:a.attachment.mimeType},metadata:a.metadata,event:a.event};l.append("request",JSON.stringify(s));let d={};t&&Object.entries(t).forEach(([S,k])=>{S.toLowerCase()!=="content-type"&&(d[S]=k)});let v=yield fetch(e,{method:"POST",headers:d,body:l});return v.ok?{data:(yield v.json())?.data??{},success:!0,statusCode:200}:(tt.catch(`Error in makeAttachmentConfigBasedRequest: ${v.status} ${v.statusText}`),{data:{},success:!1,statusCode:v.status})}catch(l){return tt.catch("Error in makeAttachmentConfigBasedRequest:",l),{data:{},success:!1,statusCode:500}}})}saveAttachment(e,t){return X(this,null,function*(){try{this.loggingService.log("%c[WB] Calling AttachmentResolverService FUNCTION: saveAttachment","color: green;");let o=this.getProvider();if(!this.attachmentDataProviderAvailable())throw new Error("Attachment save data provider not available");let a=t||St();this.coreActionsService.triggerAction(ut.ATTACHMENT_RESOLVER,{event:Y.Events.Resolver.ATTACHMENT_SAVE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:a,methodName:Ws.SAVE_ATTACHMENT,source:"internal",payload:{request:e}});let l=yield Bs(()=>X(this,null,function*(){if(o?.config?.saveConfig?.url){let s=e.attachment,{file:d}=s,v=Op(s,["file"]);return this.makeAttachmentConfigBasedRequest(o.config.saveConfig.url,o.config.saveConfig.headers,d,{attachment:v,event:e.eventType,metadata:e.attachment.metadata})}return o?.save({attachment:e.attachment,event:e.eventType,metadata:e.attachment.metadata})||Promise.resolve(void 0)}),"saveAttachment",this.retrySaveConfig);if(l?.statusCode!==200){this.loggingService.catch(l?.message??"Error in AttachmentResolverService saveAttachment:"),this.coreActionsService.triggerAction(ut.ATTACHMENT_RESOLVER,{event:Y.Events.Resolver.ATTACHMENT_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:Ws.SAVE_ATTACHMENT,source:"internal",payload:{error:l,request:e}});return}return this.analyticsService.trackEvent(Y.Events.Resolver.ATTACHMENT_RESOLVER_SAVE,{sourceMethod:"saveAttachment",source:"sdk",attachmentId:e.attachment.attachmentId,eventType:e.eventType}),this.coreActionsService.triggerAction(ut.ATTACHMENT_RESOLVER,{event:Y.Events.Resolver.ATTACHMENT_SAVE_RESULT,timestamp:new Date().getTime(),uniqueId:a,methodName:Ws.SAVE_ATTACHMENT,source:"internal",payload:{result:l,request:e}}),l}catch(o){this.loggingService.warn("Error in AttachmentResolverService saveAttachment:",o);let a=t||St();this.coreActionsService.triggerAction(ut.ATTACHMENT_RESOLVER,{event:Y.Events.Resolver.ATTACHMENT_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:Ws.SAVE_ATTACHMENT,source:"internal",payload:{error:o,request:e}});return}})}deleteAttachment(a,l){return X(this,arguments,function*({attachmentId:e,metadata:t},o){try{this.loggingService.log("%c[WB] Calling AttachmentResolverService FUNCTION: deleteAttachment","color: green;");let s=this.getProvider();if(!this.attachmentDataProviderAvailable())throw new Error("Attachment delete data provider not available");let d=o||St();this.coreActionsService.triggerAction(ut.ATTACHMENT_RESOLVER,{event:Y.Events.Resolver.ATTACHMENT_DELETE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:d,methodName:Ws.DELETE_ATTACHMENT,source:"internal",payload:{attachmentId:e,metadata:t}});let v=yield Bs(()=>{if(s?.config?.deleteConfig?.url){let u={attachmentId:e,metadata:t,event:Uo.ATTACHMENT_DELETE};return Sc(s.config.deleteConfig.url,s.config.deleteConfig.headers,u,!1)}return s?.delete({attachmentId:e,metadata:t,event:Uo.ATTACHMENT_DELETE})||Promise.resolve(void 0)},"deleteAttachment",this.retryDeleteConfig);return v?.statusCode!==200?(this.loggingService.catch(v?.message??"Error in AttachmentResolverService deleteAttachment:"),this.coreActionsService.triggerAction(ut.ATTACHMENT_RESOLVER,{event:Y.Events.Resolver.ATTACHMENT_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:d,methodName:Ws.DELETE_ATTACHMENT,source:"internal",payload:{error:v,attachmentId:e,metadata:t}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(Y.Events.Resolver.ATTACHMENT_RESOLVER_DELETE,{sourceMethod:"deleteAttachment",source:"sdk",attachmentId:e}),this.coreActionsService.triggerAction(ut.ATTACHMENT_RESOLVER,{event:Y.Events.Resolver.ATTACHMENT_DELETE_RESULT,timestamp:new Date().getTime(),uniqueId:d,methodName:Ws.DELETE_ATTACHMENT,source:"internal",payload:{result:{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0},attachmentId:e,metadata:t}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0})}catch(s){this.loggingService.warn("Error in AttachmentResolverService deleteAttachment:",s);let d=o||St();return this.coreActionsService.triggerAction(ut.ATTACHMENT_RESOLVER,{event:Y.Events.Resolver.ATTACHMENT_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:d,methodName:Ws.DELETE_ATTACHMENT,source:"internal",payload:{error:s,attachmentId:e,metadata:t}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0}}})}setAttachmentDataProvider(e){try{if(e){this.loggingService.log("Setting attachment data provider");let t=e.config,o=[{method:"save",configKey:"saveConfig"},{method:"delete",configKey:"deleteConfig"}],a=[];if(o.forEach(({method:l,configKey:s})=>{let d=t?.[s]?.url,v=l in e&&typeof e[l]=="function";!d&&!v&&a.push(l)}),a.length>0){let l=`DataProviders.attachment is invalid. The following methods are missing or are not functions (and no corresponding config provided): ${a.join(", ")}.`;this.loggingService.catch(l);return}else this.attachmentDataProvider$.next(e)}}catch(t){this.loggingService.catch("Error in AttachmentResolverService setAttachmentDataProvider:",t)}}attachmentDataProviderAvailable(){try{return!!this.attachmentDataProvider$.getValue()}catch(e){return this.loggingService.catch("Error in AttachmentResolverService attachmentDataProviderAvailable:",e),!1}}};r.\u0275fac=function(t){return new(t||r)(J(pi),J(x),J(rt))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var ku=(()=>{let r=class r{constructor(e,t,o,a,l,s,d,v){this.loggingService=e,this.usersService=t,this.authService=o,this.functions=a,this.configService=l,this.commentAnnotationsResolverService=s,this.attachmentResolverService=d,this.coreActionsService=v,this.notificationActionTypeMap={[Yt.NEWLY_ADDED]:Uo.COMMENT_ANNOTATION_ADD,[Yt.ADDED]:Uo.COMMENT_ADD,[Yt.UPDATED]:Uo.COMMENT_UPDATE,[Yt.DELETED]:Uo.COMMENT_DELETE}}setNotificationService(e){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: setNotificationService","color: green;"),this.notificationService=e}catch(t){this.loggingService.catch("Error in CommentUtilsService setNotificationService: ",t)}}setUserPermissionService(e){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: setUserPermissionService","color: green;"),this.userPermissionService=e}catch(t){this.loggingService.catch("Error in CommentUtilsService setUserPermissionService: ",t)}}getUserIdsToResolveFromComments(e){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: getUserIdsToResolveFromComments","color: green;");let t=new Set;for(let o of e){if(o?.from?.userId&&t.add(o?.from?.userId),o?.comments)for(let a of o?.comments){if(a?.from?.userId&&t.add(a?.from?.userId),a?.to)for(let l of a?.to)l?.userId&&t.add(l?.userId);if(a?.taggedUserContacts)for(let l of a?.taggedUserContacts)l?.userId&&t.add(l?.userId)}if(o?.assignedTo?.userId&&t.add(o?.assignedTo?.userId),o?.resolvedByUserId&&t.add(o?.resolvedByUserId),o?.subscribedUsers)for(let a of Object.values(o?.subscribedUsers))a.user.userId&&t.add(a.user.userId);if(o?.unsubscribedUsers)for(let a of Object.values(o?.unsubscribedUsers))a.user.userId&&t.add(a.user.userId)}return Array.from(t)}catch(t){return this.loggingService.catch("Error in CommentUtilsService getUserIdsToResolveFromComments:",t),[]}}mergeCommentWithUser(e){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: mergeCommentWithUser","color: green;"),e?.from?.userId){let t=this.usersService.getUserById(e?.from?.userId);t&&(e.from=t)}if(e?.comments)for(let t of e?.comments){if(t?.from?.userId){let a=this.usersService.getUserById(t?.from?.userId);a&&(t.from=a)}t?.to&&(t.to=t?.to?.map(a=>{if(a?.userId){let l=this.usersService.getUserById(a?.userId);if(l)return b(b({},a),l)}return a})),t?.taggedUserContacts&&(t.taggedUserContacts=t?.taggedUserContacts?.map(a=>{if(a?.contact){let l=this.usersService.getUserById(a?.contact?.userId);l&&(a.contact=l,(l?.name||l?.email)&&(a.text=`@${l?.name||l?.email}`))}return a})),(t?.taggedUserContacts?.filter((a,l,s)=>s.findIndex(d=>d.text===a.text)===l)||[]).forEach(a=>{if(a?.text){let l=new RegExp(bc(`{{${a.userId}}}`),"g");t.commentText?.includes(`@User ${a.userId}`)&&(l=new RegExp(bc(`@User ${a.userId}`),"g")),t.commentText=t.commentText?.replaceAll(l,a.text),t.commentHtml=t.commentHtml?.replaceAll(l,a.text)}})}if(e?.assignedTo?.userId){let t=this.usersService.getUserById(e?.assignedTo?.userId);t&&(e.assignedTo=t)}if(e?.resolvedByUserId){let t=this.usersService.getUserById(e?.resolvedByUserId);t&&(e.resolvedByUser=t)}if(e?.subscribedUsers)for(let t of Object.values(e?.subscribedUsers)){let o=this.usersService.getUserById(t.user.userId);o&&e?.subscribedUsers?.id?.user&&(e.subscribedUsers.id.user=o)}if(e?.unsubscribedUsers)for(let t of Object.values(e?.unsubscribedUsers)){let o=this.usersService.getUserById(t.user.userId);o&&e?.unsubscribedUsers?.id?.user&&(e.unsubscribedUsers.id.user=o)}return e}catch(t){return this.loggingService.catch("Error in CommentUtilsService mergeCommentWithUser:",t),e}}formatCommentData(e){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: formatCommentData","color: green;"),e?.comments?.forEach(t=>{t?.commentText&&t?.commentText?.length>0&&(t.isCommentTextAvailable=!0)}),e?.viewedBy&&delete e.viewedBy,e?.unread!==void 0&&delete e.unread,e?.resolvedByUser!==void 0&&delete e.resolvedByUser,e?.comments&&e.comments.forEach(t=>{t?.reactionAnnotations&&delete t.reactionAnnotations}),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 t of Object.keys(e?.subscribedUsers))e.subscribedUsers[t].user={userId:e?.subscribedUsers[t].user.userId};if(e?.unsubscribedUsers)for(let t of Object.keys(e?.unsubscribedUsers))e.unsubscribedUsers[t].user={userId:e?.unsubscribedUsers[t].user.userId}}return e?.comments&&(e.comments=e?.comments?.map(t=>this.formatCommentThreadData(t))),e}catch(t){return this.loggingService.catch("Error in CommentUtilsService formatCommentData:",t),e}}mergeStrippedDataWithCommentAnnotations(e){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: mergeStrippedDataWithCommentAnnotations","color: green;"),!this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable())return e;let t=this.commentAnnotationsResolverService.getAnnotationById(e?.annotationId),o=this.attachmentResolverService.attachmentDataProviderAvailable(),a=this.commentAnnotationsResolverService.getFieldsToRemove();return t&&(e?.comments?.forEach(l=>{let s=t?.comments?.[l?.commentId];if(s){l.commentHtml=s?.commentHtml,l.commentText=s?.commentText;let d=s?.attachments;o&&d&&l.attachments?.forEach(v=>{let u=v?.attachmentId;d?.[u]&&(v.name=d?.[u]?.name,v.url=d?.[u]?.url)})}}),t?.targetTextRange?.text&&e?.targetTextRange&&(e.targetTextRange.text=t?.targetTextRange?.text),a?.length>0&&a.forEach(l=>{t?.[l]&&(e[l]=t[l])})),e}catch(t){return this.loggingService.catch("Error in CommentUtilsService mergeStrippedDataWithCommentAnnotations:",t),e}}mergeLocationWithCommentAnnotations(e,t){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: mergeLocationWithCommentAnnotations","color: green;");let o=e?.location?.id,a=e?.metadata?.documentId;if(!o||!a)return e;let l=t?.[a]?.[o];return l&&(e.location=l?.location),e}catch(o){return this.loggingService.catch("Error in CommentUtilsService mergeLocationWithCommentAnnotations:",o),e}}isCommentsDataChanged(e,t){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: isCommentsDataChanged","color: green;");let o=this.commentAnnotationsResolverService.getCommentAnnotationById(t);return o?!Ei(e,o):!0}catch(o){return this.loggingService.catch("Error in CommentUtilsService isCommentsDataChanged:",o),!0}}stripCommentsFromAnnotationData({comment:e}){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: stripCommentsFromAnnotationData","color: green;");let t=this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable();if(!t)return e;let o=this.attachmentResolverService.attachmentDataProviderAvailable(),a=new yd;if(Object.assign(a,e),a.isCommentResolverUsed=t,o){let l=a.attachments?.map(s=>(s.isAttachmentResolverUsed=!0,delete s?.name,delete s?.url,s));a.attachments=l}return delete a?.commentHtml,delete a?.commentText,a}catch(t){return this.loggingService.catch("Error in CommentUtilsService stripCommentsFromAnnotationData:",t),e}}resolveTaggedUserEmails(e){return X(this,null,function*(){try{let t=new Set;if(e.comments?.forEach(o=>{o.taggedUserContacts?.forEach(a=>{a?.contact?.email&&!a?.userId&&t.add(a.contact.email)}),o.to?.forEach(a=>{a?.email&&!a?.userId&&t.add(a.email)})}),t.size>0){let o=St();this.coreActionsService.triggerAction(ut.USER_RESOLVER,{event:Y.Events.Resolver.EMAIL_USER_ID_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:o,methodName:eo.RESOLVE_USER_IDS_BY_EMAIL,source:"internal",payload:{emails:Array.from(t)}});let a=yield this.usersService.resolveUserIdsByEmail({emails:Array.from(t),uniqueId:o});Object.keys(a).length>0&&e.comments?.forEach(l=>{l.taggedUserContacts?.forEach(s=>{if(s?.contact?.email&&!s?.userId){let d=a[s.contact.email];if(d){let v=s.text;if(v){let u=bc(v),S=new RegExp(u,"g");l.commentText&&(l.commentText=l.commentText.replace(S,`{{${d}}}`)),l.commentHtml&&(l.commentHtml=l.commentHtml.replace(S,`{{${d}}}`))}s.userId=d,s.contact.userId=d,delete s.contact?.email,delete s.contact?.visibility,s.text=""}}}),l.to=l.to?.map(s=>{if(s?.email&&!s?.userId){let d=a[s.email];if(d)return delete s?.email,delete s?.visibility,E(b({},s),{userId:d})}return s})})}return e}catch(t){return this.loggingService.catch("Error in CommentUtilsService resolveTaggedUserEmails:",t),e}})}stripCommentAnnotationData(a){return X(this,arguments,function*({data:e,actionType:t,commentId:o}){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: stripCommentAnnotationData","color: green;"),e=yield this.resolveTaggedUserEmails(e),!this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable())return{originalData:e,strippedData:null};let l=this.attachmentResolverService.attachmentDataProviderAvailable(),s=this.commentAnnotationsResolverService.getFieldsToRemove(),d;t&&(d=this.notificationActionTypeMap?.[t]);let v={},u=null,S=!1;if(e&&e.annotationId){let A=e.annotationId;v[A]=b(b(b(b({annotationId:A,metadata:I1(e.metadata??{}),comments:{}},e?.from&&{from:e?.from}),e?.assignedTo&&{assignedTo:e?.assignedTo}),e?.resolvedByUserId&&{resolvedByUserId:e?.resolvedByUserId}),e?.targetTextRange?.text&&{targetTextRange:{text:e?.targetTextRange?.text}}),delete e?.targetTextRange?.text,s?.length>0&&s.forEach(U=>{e?.[U]&&(v[A][U]=e[U],delete e[U])}),e.comments?.forEach(U=>{if(U.commentId){let W;l&&(W={},U.attachments?.forEach(te=>{W[te.attachmentId]={attachmentId:te.attachmentId,name:te.name,url:te.url}})),v[A].comments[U.commentId]=b(b(b(b(b(b({commentId:U.commentId},U?.commentHtml&&{commentHtml:U?.commentHtml}),U?.commentText&&{commentText:U?.commentText}),W&&{attachments:W}),U?.from&&{from:U?.from}),U?.to&&{to:U?.to}),U?.taggedUserContacts&&{taggedUserContacts:U?.taggedUserContacts})}}),S=this.isCommentsDataChanged(v[A],A);let P=new _r;Object.assign(P,e),P.comments=e.comments?.map(U=>this.stripCommentsFromAnnotationData({comment:U}))||[],u=P}let k=u?.comments?.find(A=>A.commentId===o);return k?.isDraft&&(d=u?.comments?.length&&u?.comments?.length>0?Uo.COMMENT_ADD:Uo.COMMENT_ANNOTATION_ADD),{strippedData:S&&(t&&this.notificationActionTypeMap?.[t]||k?.isDraft)?v:null,originalData:u,eventType:d}}catch(l){return this.loggingService.catch("Error in CommentAnnotationsResolverService stripCommentAnnotationData:",l),{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(o=>o?.userId?{userId:o.userId}:o)),e?.taggedUserContacts&&(e.taggedUserContacts=e?.taggedUserContacts?.map(o=>o?.contact?.userId?E(b({},o),{contact:{userId:o.contact.userId}}):o));let t=e?.taggedUserContacts?.filter((o,a,l)=>l.findIndex(s=>s.text===o.text)===a)||[];t.forEach(o=>{if(o?.text&&o?.contact?.userId){let a=new RegExp(bc(o.text),"g");e.commentText=e.commentText?.replaceAll(a,l=>`{{${o.userId}}}`),e.commentHtml=e.commentHtml?.replaceAll(a,l=>`{{${o.userId}}}`)}}),t.forEach(o=>{o?.text&&o?.contact?.userId&&(o.text="")})}return e}catch(t){return this.loggingService.catch("Error in CommentUtilsService formatCommentThreadData:",t),e}}getDeniedForYouUsers(t){return X(this,arguments,function*({extraData:e}){try{let o=Object.values(e?.annotationData?.subscribedUsers||{}).map(l=>l.user.userId)??[],a=[];if(this.userPermissionService?.isPermissionProviderAvailable()&&o.length){let l=e?.metadata?.clientDocumentId,s=e?.annotationData?.context?.access&&this.userPermissionService?.getIsContextEnabled()?e?.annotationData?.context?.access:null,d=[];o.forEach(S=>{if(d.push({userId:S,resource:{id:l,type:Wr.DOCUMENT,source:tr.SET_NOTIFICATIONS,organizationId:e?.metadata?.clientOrganizationId??"",context:s?{access:s}:void 0}}),s){let k=JSON.stringify(s);d.push({userId:S,resource:{id:k,type:Wr.CONTEXT,source:tr.SET_NOTIFICATIONS,organizationId:e?.metadata?.clientOrganizationId??"",context:{access:s}}})}});let v=St();this.coreActionsService.triggerAction(ut.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.RESOURCE_ACCESS_REQUEST_FORMED,methodName:tr.SET_NOTIFICATIONS,uniqueId:v,timestamp:new Date().getTime(),source:"internal",payload:{requests:d}});let u=yield this.userPermissionService?.onResourceAccessRequired({requests:d,uniqueId:v,methodName:tr.SET_NOTIFICATIONS});u?.success&&u?.data?.length&&u.data.forEach(S=>{S.hasAccess||a.push(S.userId)})}return a}catch(o){return this.loggingService.catch("Error in CommentUtilsService getDeniedForYouUsers:",o),[]}})}handleCommentEncryption(s){return X(this,arguments,function*({data:e,firestorePath:t,extraData:o,eventType:a,metadata:l}){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: handleCommentEncryption","color: green;");let d=G9(this.authService.getFirebaseConfig()?.firebaseOptions),v=mr(this.functions,gr({url:wn.cloudFunction?.[d]?.setEncryptedData,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:1200*1e3});if(o){o=this.notificationService?.processNotificationData(o),o.annotationData=e;let P=o?.targetAnnotationData?.commentId;if(P){let U=e?.comments?.find(W=>W?.commentId===P);U&&(o.targetAnnotationData=U)}try{let U=yield this.stripCommentAnnotationData({data:o.annotationData,actionType:o?.actionType??Yt.NEWLY_ADDED});U?.originalData&&(o.annotationData=this.formatCommentData(U.originalData)),o?.targetAnnotationData&&(o.targetAnnotationData=this.formatCommentThreadData(this.stripCommentsFromAnnotationData({comment:o.targetAnnotationData})))}catch(U){this.loggingService.warn("Error in CommentUtilsService handleCommentEncryption:",U)}}let u=Iu.getFirestoreProdDbName(this.configService.getApiKey()??"",this.authService.getFirebaseConfig()?.firebaseOptions),S=yield this.getDeniedForYouUsers({extraData:o}),k={path:t??"",data:e??{},dbId:u??"",notificationData:o||void 0,notificationURL:wn.firebaseNotificationsDatabaseURL,feature:"comment",eventType:a??"PATCH",sdkVersion:Ra(),deniedForYouUsers:S,isPermissionProviderUsed:this.userPermissionService?.isPermissionProviderAvailable(),isCommentResolverUsed:this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable(),isSettingsConfigByOrganization:this.notificationService?.getSettingsConfigByOrganization(),metadata:l},A=yield Us(k,this.authService.getUser()?.userId??"");yield v({veltData:A})}catch(d){this.loggingService.catch("Error in CommentUtilsService handleCommentEncryption:",d)}})}};r.\u0275fac=function(t){return new(t||r)(J(x),J(Dn),J(Ge),J(Lr),J(Lt),J(vs),J(Eu),J(pi))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var gue=(()=>{let r=class r{constructor(e,t){this.loggingService=e,this.usersService=t}getUserIdsToResolveFromUserIamData(e){try{this.loggingService.log("%c[WB] Calling ContactUtilsService FUNCTION: getUserIdsToResolveFromUserIamData","color: green;");let t=new Set;if(e?.length)for(let o of e)o?.user?.userId&&t.add(o?.user?.userId);return Array.from(t)}catch(t){return this.loggingService.catch("Error in ContactUtilsService getUserIdsToResolveFromUserIamData: ",t),[]}}mergeUserIamWithUser(e){try{if(this.loggingService.log("%c[WB] Calling ContactUtilsService FUNCTION: mergeUserIamWithUser","color: green;"),e?.user?.userId){let t=this.usersService.getUserById(e?.user?.userId);if(t){let o=t;e?.user&&typeof e.user=="object"&&(o=b(b({},o),e.user)),e=E(b({},e),{user:o})}}return e}catch(t){return this.loggingService.catch("Error in ContactUtilsService mergeUserIamWithUser: ",t),e}}};r.\u0275fac=function(t){return new(t||r)(J(x),J(Dn))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var vue=(()=>{let r=class r{constructor(e,t){this.loggingService=e,this.usersService=t}getUserIdsToResolveFromCursorUsers(e){try{this.loggingService.log("%c[WB] Calling CursorUtilsService FUNCTION: getUserIdsToResolveFromCursorUsers","color: green;");let t=new Set;for(let o of e)o?.userId&&t.add(o?.userId);return Array.from(t)}catch(t){return this.loggingService.catch("Error in CursorUtilsService getUserIdsToResolveFromCursorUsers:",t),[]}}mergeCursorUserWithUser(e){try{if(this.loggingService.log("%c[WB] Calling CursorUtilsService FUNCTION: mergeCursorUserWithUser","color: green;"),this.usersService.userDataProviderAvailable()&&e?.userId){let t=this.usersService.getUserById(e?.userId);t&&(e=b(b({},e),t))}return e}catch(t){return this.loggingService.catch("Error in CursorUtilsService mergeCursorUserWithUser:",t),e}}formatCursorUserData(e){try{if(this.loggingService.log("%c[WB] Calling CursorUtilsService FUNCTION: formatCursorUserData","color: green;"),this.usersService.userDataProviderAvailable()){let t=["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(o=>{t.includes(o)||(e[o]=null)})}return e}catch(t){return this.loggingService.catch("Error in CursorUtilsService formatCursorUserData:",t),e}}};r.\u0275fac=function(t){return new(t||r)(J(x),J(Dn))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var wR=(()=>{let r=class r{constructor(e,t,o){this.coreActionsService=e,this.loggingService=t,this.usersService=o}getUserIdsToResolveFromHuddleAttendees(e){try{this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: getUserIdsToResolveFromHuddleAttendees","color: green;");let t=new Set;for(let o of e)o?.userId&&t.add(o?.userId);return Array.from(t)}catch(t){return this.loggingService.catch("Error in HuddleUtilsService getUserIdsToResolveFromHuddleAttendees:",t),[]}}mergeHuddleAttendeeWithUser(e){try{if(this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: mergeHuddleAttendeeWithUser","color: green;"),e?.userId){let t=this.usersService.getUserById(e?.userId);t&&(e=b(b({},e),t))}return e}catch(t){return this.loggingService.catch("Error in HuddleUtilsService mergeHuddleAttendeeWithUser:",t),e}}formatHuddleAttendeeData(e){try{if(this.usersService.userDataProviderAvailable()){let t=["userId","userSnippylyId","state","timestamp","initialHuddleMode","streamMetadata","initialHuddleType","huddleOnCursorMode"];Object.keys(e).forEach(o=>{t.includes(o)||(e[o]=null)})}return e}catch(t){return this.loggingService.catch("Error in HuddleUtilsService formatHuddleAttendeeData:",t),e}}getUserIdsToResolveFromHuddleMessages(e){try{this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: getUserIdsToResolveFromHuddleMessages","color: green;");let t=new Set;for(let o of e)o?.from?.userId&&t.add(o?.from?.userId);return Array.from(t)}catch(t){return this.loggingService.catch("Error in HuddleUtilsService getUserIdsToResolveFromHuddleMessages:",t),[]}}mergeHuddleMessageWithUser(e){try{if(this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: mergeHuddleMessageWithUser","color: green;"),e?.from?.userId){let t=this.usersService.getUserById(e?.from?.userId);t&&(e.from=t)}return e}catch(t){return this.loggingService.catch("Error in HuddleUtilsService mergeHuddleMessageWithUser:",t),e}}resolveUsersFromHuddleMessages(e){return X(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: resolveUsersFromHuddleMessages","color: green;"),this.usersService.userDataProviderAvailable()){let t=this.getUserIdsToResolveFromHuddleMessages(e),o=St(),a=Gs.GET_HUDDLE_USERS;this.coreActionsService.triggerAction(ut.USER_RESOLVER,{event:Y.Events.Resolver.USER_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:o,methodName:eo.RESOLVE_USERS_FROM_HUDDLE_MESSAGES,moduleName:a,source:"internal",payload:{userIds:t}});let l=yield this.usersService.resolveUsers({userIds:t,uniqueId:o,moduleName:a});for(let s of e)s?.from?.userId&&l[s.from.userId]&&(s.from=l[s.from.userId])}return e}catch(t){return this.loggingService.catch("Error in HuddleUtilsService resolveUsersFromHuddleMessages:",t),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(t){return this.loggingService.catch("Error in HuddleUtilsService formatHuddleMessageData:",t),e}}};r.\u0275fac=function(t){return new(t||r)(J(pi),J(x),J(Dn))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var DR=(()=>{let r=class r{constructor(e,t,o){this.coreActionsService=e,this.loggingService=t,this.usersService=o}getUserIdsToResolveFromLiveStateCustom(e){try{let t=new Set;return e?.updatedBy&&t.add(e?.updatedBy?.userId),Array.from(t)}catch(t){return this.loggingService.catch("Error in LiveStateUtilsService getUserIdsToResolveFromLiveStateCustom:",t),[]}}mergeLiveStateCustomWithUser(e){try{if(e?.updatedBy?.userId){let t=this.usersService.getUserById(e?.updatedBy?.userId);t&&(e.updatedBy=t)}return e}catch(t){return this.loggingService.catch("Error in LiveStateUtilsService mergeLiveStateCustomWithUser:",t),e}}formatLiveStateCustomData(e){try{return this.usersService.userDataProviderAvailable()&&e?.updatedBy&&(e.updatedBy={userId:e.updatedBy.userId}),e}catch(t){return this.loggingService.catch("Error in LiveStateUtilsService formatLiveStateCustomData:",t),e}}getUserIdsToResolveFromLiveStateCustoms(e){try{let t=new Set;for(let o of e)o?.updatedBy?.userId&&t.add(o?.updatedBy?.userId);return Array.from(t)}catch(t){return this.loggingService.catch("Error in LiveStateUtilsService getUserIdsToResolveFromLiveStateCustoms:",t),[]}}getUserIdsToResolveFromLiveStates(e){try{let t=new Set;return e?.default?.singleEditorMode?.editor?.userId&&t.add(e?.default?.singleEditorMode?.editor?.userId),Array.from(t)}catch(t){return this.loggingService.catch("Error in LiveStateUtilsService getUserIdsToResolveFromLiveStates:",t),[]}}getUserIdsToResolveFromLiveStateSingleEditorMode(e){try{let t=new Set;return e?.editor?.userId&&t.add(e?.editor?.userId),e?.requestEditorAccess?.user?.userId&&t.add(e?.requestEditorAccess?.user?.userId),Array.from(t)}catch(t){return this.loggingService.catch("Error in LiveStateUtilsService getUserIdsToResolveFromLiveStateSingleEditorMode:",t),[]}}mergeLiveStateWithUser(e){try{if(e?.default?.singleEditorMode?.editor?.userId){let t=this.usersService.getUserById(e?.default?.singleEditorMode?.editor?.userId);t&&(e.default.singleEditorMode.editor=t)}if(e?.default?.singleEditorMode?.requestEditorAccess?.user?.userId){let t=this.usersService.getUserById(e?.default?.singleEditorMode?.requestEditorAccess?.user?.userId);t&&(e.default.singleEditorMode.requestEditorAccess.user=t)}return e}catch(t){return this.loggingService.catch("Error in LiveStateUtilsService mergeLiveStateWithUser:",t),e}}mergeSingleEditorLiveStateDataWithUser(e){try{if(e?.editor?.userId){let t=this.usersService.getUserById(e?.editor?.userId);t&&(e.editor=t)}if(e?.requestEditorAccess?.user?.userId){let t=this.usersService.getUserById(e?.requestEditorAccess?.user?.userId);t&&(e.requestEditorAccess.user=t)}return e}catch(t){return this.loggingService.catch("Error in LiveStateUtilsService mergeSingleEditorLiveStateDataWithUser:",t),e}}resolveAndMergeSingleEditorLiveStateDataWithUser(e){return X(this,null,function*(){try{let t=this.getUserIdsToResolveFromLiveStates({default:{singleEditorMode:e}});if(t.length){let o=St(),a=Gs.GET_SINGLE_EDITOR_USERS;return this.coreActionsService.triggerAction(ut.USER_RESOLVER,{event:Y.Events.Resolver.USER_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:o,methodName:eo.RESOLVE_AND_MERGE_SINGLE_EDITOR_LIVE_STATE_DATA_WITH_USER,moduleName:a,source:"internal",payload:{userIds:t}}),yield this.usersService.resolveUsers({userIds:t,uniqueId:o,moduleName:a}),this.mergeSingleEditorLiveStateDataWithUser(e)}return e}catch(t){return this.loggingService.catch("Error in LiveStateUtilsService resolveAndMergeSingleEditorLiveStateDataWithUser:",t),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(t){return this.loggingService.catch("Error in LiveStateUtilsService formatLiveStateSingleEditorModeData:",t),e}}mergeLiveStateCustomsWithUsers(e){try{for(let t of e)if(t?.updatedBy?.userId){let o=this.usersService.getUserById(t?.updatedBy?.userId);o&&(t.updatedBy=o)}return e}catch(t){return this.loggingService.catch("Error in mergeLiveStateCustomsWithUsers:",t),e}}};r.\u0275fac=function(t){return new(t||r)(J(pi),J(x),J(Dn))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var hue=(()=>{let r=class r{constructor(e,t){this.loggingService=e,this.usersService=t}getUserIdsToResolveFromMultiThreads(e){try{let t=new Set;for(let o of e)o?.from?.userId&&t.add(o?.from?.userId);return Array.from(t)}catch(t){return this.loggingService.catch("Error in MultiThreadUtilsService getUserIdsToResolveFromMultiThreads:",t),[]}}mergeMultiThreadWithUser(e){try{if(e?.from?.userId){let t=this.usersService.getUserById(e?.from?.userId);t&&(e.from=t)}return e}catch(t){return this.loggingService.catch("Error in MultiThreadUtilsService mergeMultiThreadWithUser:",t),e}}formatMultiThreadData(e){try{return this.usersService.userDataProviderAvailable()&&(e?.from?.userId&&(e.from={userId:e.from.userId}),e?.commentAnnotationsMap&&(e.commentAnnotationsMap=null)),e}catch(t){return this.loggingService.catch("Error in MultiThreadUtilsService formatMultiThreadData:",t),e}}};r.\u0275fac=function(t){return new(t||r)(J(x),J(Dn))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var l_=(()=>{let r=class r{constructor(e,t,o){this.authService=e,this.loggingService=t,this.usersService=o}getUserIdsToResolveFromRecorders(e){try{let t=new Set;for(let o of e)o?.from?.userId&&t.add(o?.from?.userId),o?.transcription?.from?.userId&&t.add(o?.transcription?.from?.userId);return Array.from(t)}catch(t){return this.loggingService.catch("Error in RecorderUtilsService getUserIdsToResolveFromRecorders:",t),[]}}mergeRecorderWithUser(e){try{if(e?.from?.userId){let t=this.usersService.getUserById(e?.from?.userId);t&&(e.from=t)}if(e?.transcription?.from?.userId){let t=this.usersService.getUserById(e?.transcription?.from?.userId);t&&(e.transcription.from=t)}return e}catch(t){return this.loggingService.catch("Error in RecorderUtilsService mergeRecorderWithUser:",t),e}}formatRecorderData(e,t){try{return e.transcription=e?.transcription?E(b({},e.transcription),{lastUpdated:t}):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(o){return this.loggingService.catch("Error in RecorderUtilsService formatRecorderData:",o),e}}formatRecorderDataForWhisperTranscription(e){try{return this.usersService.userDataProviderAvailable()&&e?.fromUser?.userId&&(e.fromUser={userId:e.fromUser?.userId}),e}catch(t){return this.loggingService.catch("Error in RecorderUtilsService formatRecorderDataForWhisperTranscription:",t),e}}encryptRecorderAnnotation(e){return X(this,null,function*(){try{return yield Us(e,this.authService.getUser()?.userId??"")}catch(t){this.loggingService.catch("Error in RecorderUtilsService encryptRecorderAnnotation:",t);return}})}};r.\u0275fac=function(t){return new(t||r)(J(Ge),J(x),J(Dn))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var OR=(()=>{let r=class r{constructor(e,t,o,a,l,s){this.commentUtilsService=e,this.recorderUtilsService=t,this.loggingService=o,this.usersService=a,this.authService=l,this.commentAnnotationsResolverService=s}getUserIdsToResolveFromNotifications(e){try{let t=new Set;for(let o of e){let{notification:a}=o;switch(a?.actionUser?.userId&&t.add(a?.actionUser?.userId),a?.displayHeadlineMessageTemplateData?.actionUser?.userId&&t.add(a?.displayHeadlineMessageTemplateData?.actionUser?.userId),a?.displayHeadlineMessageTemplateData?.recipientUser?.userId&&t.add(a?.displayHeadlineMessageTemplateData?.recipientUser?.userId),a?.notificationSource){case"comment":if(a?.notificationSourceData){let l=this.commentUtilsService.getUserIdsToResolveFromComments([a?.notificationSourceData]);for(let s of l)t.add(s)}break}}return Array.from(t)}catch(t){return this.loggingService.catch("Error in ReactionUtilsService getUserIdsToResolveFromRecorders:",t),[]}}mergeStrippedDataWithNotification(e){try{if(this.loggingService.log("%c[WB] Calling NotificationUtilsService FUNCTION: mergeStrippedDataWithNotification","color: green;"),!this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable())return e;let t=this.commentAnnotationsResolverService.getAnnotationById(e?.notification?.targetAnnotationId),o=e?.raw?.targetAnnotationData?.commentId,a=t?.comments?.[o]?.commentText,l=t?.comments?.[o]?.commentHtml;return a&&l&&e?.raw?.notificationSource==="comment"&&(e.notification.displayBodyMessageTemplate=a,e.raw.targetAnnotationData.commentText=a,e.raw.targetAnnotationData.commentHtml=l),e}catch(t){return this.loggingService.catch("Error in NotificationUtilsService mergeStrippedDataWithNotification:",t),e}}mergeLocationWithNotification(e,t){try{this.loggingService.log("%c[WB] Calling NotificationUtilsService FUNCTION: mergeLocationWithNotification","color: green;");let o=e?.notification?.notificationSourceData?.location?.id,a=e?.notification?.notificationSourceData?.metadata?.documentId;if(!o||!a)return e;let l=t?.[a]?.[o];return l&&(e.notification.notificationSourceData.location=l?.location,e?.raw?.annotationData?.location&&(e.raw.annotationData.location=l?.location)),e}catch(o){return this.loggingService.catch("Error in NotificationUtilsService mergeLocationWithNotification:",o),e}}mergeNotificationWithUser(e){try{this.loggingService.log("%c[WB] Calling NotificationUtilsService FUNCTION: mergeNotificationWithUser","color: green;");let{notification:t}=e;if(t?.actionUser?.userId){let o=this.usersService.getUserById(t?.actionUser?.userId);o&&(t.actionUser=o)}if(t?.displayHeadlineMessageTemplateData?.actionUser?.userId){let o=this.usersService.getUserById(t?.displayHeadlineMessageTemplateData?.actionUser?.userId);o&&(t.displayHeadlineMessageTemplateData.actionUser=o)}if(t?.displayHeadlineMessageTemplateData?.recipientUser?.userId){let o=this.usersService.getUserById(t?.displayHeadlineMessageTemplateData?.recipientUser?.userId);o&&(t.displayHeadlineMessageTemplateData.recipientUser=o)}switch(t?.notificationSource){case"comment":t?.notificationSourceData&&this.commentUtilsService.mergeCommentWithUser(t?.notificationSourceData);break}return e}catch(t){return this.loggingService.catch("Error in NotificationUtilsService mergeNotificationWithUser:",t),e}}formatNotification(e,t){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,t);break}return e}catch(o){return this.loggingService.catch("Error in NotificationUtilsService formatNotification: ",o),e}}getTargetAnnotationIdsFromNotifications(e){try{this.loggingService.log("%c[WB] Calling NotificationUtilsService FUNCTION: getTargetAnnotationIdsFromNotifications","color: green;");let t=[];return Object.values(e).forEach(o=>{o?.notification?.targetAnnotationId&&o?.raw?.notificationSource==="comment"&&t.push(o.notification.targetAnnotationId)}),t}catch(t){return this.loggingService.catch("Error in NotificationUtilsService getTargetAnnotationIdsFromNotifications:",t),[]}}handleNotificationEncryption(t){return X(this,arguments,function*({data:e}){try{this.loggingService.log("%c[WB] Calling NotificationUtilsService FUNCTION: handleNotificationEncryption","color: green;");let o="notificationwithdocumentidstoencryptanddecryptonsdk"+(this.authService.getUser()?.userId??"");return yield Us(e,o)}catch(o){return this.loggingService.catch("Error in NotificationUtilsService handleNotificationEncryption:",o),e}})}};r.\u0275fac=function(t){return new(t||r)(J(ku),J(l_),J(x),J(Dn),J(Ge),J(vs))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var Cue=(()=>{let r=class r{constructor(e,t){this.loggingService=e,this.usersService=t}getUserIdsToResolveFromPresenceUsers(e){try{let t=new Set;for(let o of e)o?.userId&&t.add(o?.userId);return Array.from(t)}catch(t){return this.loggingService.catch("Error in PresenceUtilsService getUserIdsToResolveFromPresenceUsers:",t),[]}}mergePresenceUserWithUser(e){try{if(this.usersService.userDataProviderAvailable()&&e?.userId){let t=this.usersService.getUserById(e?.userId);t&&(e=b(b({},e),t))}return e}catch(t){return this.loggingService.catch("Error in PresenceUtilsService mergePresenceUserWithUser:",t),e}}formatPresenceUserData(e){try{if(this.usersService.userDataProviderAvailable()){let t=["userId","onlineStatus","userSnippylyId","color","textColor","timestamp","type","selections","documentParamsId","documentParams","locationId","location","isReadOnly","isAnonymous","pageInfo"];Object.keys(e).forEach(o=>{t.includes(o)||(e[o]=null)})}return e}catch(t){return this.loggingService.catch("Error in PresenceUtilsService formatPresenceUserData:",t),e}}};r.\u0275fac=function(t){return new(t||r)(J(x),J(Dn))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var _ue=(()=>{let r=class r{constructor(e,t,o,a,l,s){this.loggingService=e,this.usersService=t,this.authService=o,this.functions=a,this.configService=l,this.reactionAnnotationsResolverService=s}getUserIdsToResolveFromReactions(e){try{let t=new Set;for(let o of e)if(o?.from?.userId&&t.add(o?.from?.userId),o?.reactions?.length)for(let a of o?.reactions)a?.from?.userId&&t.add(a?.from?.userId);return Array.from(t)}catch(t){return this.loggingService.catch("Error in ReactionUtilsService getUserIdsToResolveFromRecorders:",t),[]}}handleReactionEncryption(a){return X(this,arguments,function*({data:e,firestorePath:t,eventType:o}){try{let l=G9(this.authService.getFirebaseConfig()?.firebaseOptions),s=mr(this.functions,gr({url:wn.cloudFunction?.[l]?.setEncryptedData,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:1200*1e3}),d=Iu.getFirestoreProdDbName(this.configService.getApiKey()??"",this.authService.getFirebaseConfig()?.firebaseOptions),v=this.authService.getUser()?.userId??"",u={path:t??"",data:e??{},dbId:d??"",feature:"reaction",eventType:o??"PATCH",sdkVersion:Ra()},S=yield Us(u,v);yield s({veltData:S})}catch(l){this.loggingService.catch("Error in handleReactionEncryption:",l)}})}mergeReactionWithUser(e){try{if(this.usersService.userDataProviderAvailable()){if(e?.from?.userId){let t=this.usersService.getUserById(e?.from?.userId);t&&(e.from=t)}if(e?.reactions?.length){for(let t of e?.reactions)if(t?.from?.userId){let o=this.usersService.getUserById(t?.from?.userId);o&&(t.from=o)}}}return e}catch(t){return this.loggingService.catch("Error in ReactionUtilsService mergeReactionWithUser:",t),e}}formatReactionData(e){try{return this.usersService.userDataProviderAvailable()&&e?.from?.userId&&(e.from={userId:e.from.userId}),e.reactions=e?.reactions?.map(t=>(this.usersService.userDataProviderAvailable()&&t?.from?.userId&&(t.from={userId:t.from.userId}),t)),e}catch(t){return this.loggingService.catch("Error in ReactionUtilsService formatReactionData:",t),e}}isReactionDataChanged(e,t){try{this.loggingService.log("%c[WB] Calling ReactionUtilsService FUNCTION: isReactionDataChanged","color: green;");let o=this.reactionAnnotationsResolverService.getReactionAnnotationById(t);return o?!Ei(e,o):!0}catch(o){return this.loggingService.catch("Error in ReactionUtilsService isReactionDataChanged:",o),!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 t={};if(e&&e.annotationId){let o=e.annotationId;if(t[o]=b({annotationId:o,metadata:I1(e.metadata??{}),icon:e.icon},e?.from&&{from:e?.from}),!this.isReactionDataChanged(t[o],o))return{strippedData:null,originalData:e};delete e?.icon,e.isReactionResolverUsed=!0}return{strippedData:t,originalData:e}}catch(t){return this.loggingService.catch("Error in ReactionUtilsService stripReactionAnnotationData:",t),{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 t=this.reactionAnnotationsResolverService.getReactionAnnotationById(e?.annotationId);return t&&t.icon&&(e.icon=t.icon),e}catch(t){return this.loggingService.catch("Error in ReactionUtilsService mergeStrippedDataWithReactionAnnotations:",t),e}}};r.\u0275fac=function(t){return new(t||r)(J(x),J(Dn),J(Ge),J(Lr),J(Lt),J(Pm))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var bue=(()=>{let r=class r{constructor(e,t){this.loggingService=e,this.usersService=t}getUserIdsToResolveFromSelections(e){try{let t=new Set;for(let o of e)o?.user?.userId&&t.add(o.user.userId);return Array.from(t)}catch(t){return this.loggingService.catch("Error in SelectionUtilsService getUserIdsToResolveFromSelections:",t),[]}}mergeSelectionWithUser(e){try{if(e?.user?.userId){let t=this.usersService.getUserById(e?.user?.userId);t&&(e.user=t)}return e}catch(t){return this.loggingService.catch("Error in SelectionUtilsService mergeSelectionWithUser:",t),e}}formatSelectionData(e){try{return this.usersService.userDataProviderAvailable()&&e?.user?.userId&&(e.user={userId:e.user.userId}),e}catch(t){return this.loggingService.catch("Error in SelectionUtilsService formatSelectionData:",t),e}}};r.\u0275fac=function(t){return new(t||r)(J(x),J(Dn))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var Sue=(()=>{let r=class r{constructor(e,t){this.loggingService=e,this.usersService=t}getUserIdsToResolveFromTags(e){try{let t=new Set;for(let o of e)if(o?.from?.userId&&t.add(o.from.userId),o?.to?.length)for(let a of o.to)a?.userId&&t.add(a.userId);return Array.from(t)}catch(t){return this.loggingService.catch("Error in TagUtilsService getUserIdsToResolveFromTags:",t),[]}}mergeTagWithUser(e){try{if(e?.from?.userId){let t=this.usersService.getUserById(e?.from?.userId);t&&(e.from=t)}return e?.to?.length&&(e.to=e.to.map(t=>{if(t?.userId){let o=this.usersService.getUserById(t?.userId);o&&(t=o)}return t})),e}catch(t){return this.loggingService.catch("Error in TagUtilsService mergeTagWithUser:",t),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(t=>(t?.userId&&(t={userId:t.userId}),t)))),e}catch(t){return this.loggingService.catch("Error in TagUtilsService formatTagData:",t),e}}};r.\u0275fac=function(t){return new(t||r)(J(x),J(Dn))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var Mm=(()=>{let r=class r{constructor(e,t,o,a,l,s,d,v,u,S,k,A,P,U,W,te,ye,me,ke,De){this.areaUtilsService=e,this.arrowUtilsService=t,this.commentUtilsService=o,this.contactUtilsService=a,this.coreActionsService=l,this.cursorUtilsService=s,this.huddleUtilsService=d,this.liveStateUtilsService=v,this.loggingService=u,this.multiThreadUtilsService=S,this.notificationUtilsService=k,this.presenceUtilsService=A,this.reactionUtilsService=P,this.recorderUtilsService=U,this.selectionUtilsService=W,this.tagUtilsService=te,this.usersService=ye,this.docService=me,this.commentAnnotationsResolverService=ke,this.reactionAnnotationsResolverService=De}getErrorForGetRequests({feature:e,error:t}){try{switch(e){case"organizationMetadata":case"documentMetadata":case"folderMetadata":return(t?.message??"")?.includes("Missing or insufficient permissions.")?{errorCode:"PERMISSION_DENIED"}:null;default:return null}}catch(o){return this.loggingService.catch("Error in CommonDbUtilsService getErrorForGetRequests:",o),null}}getFirestorePath({feature:e,properties:t,documentPaths:o,apiKey:a}){try{if(!a)return;let{documentId:l,organizationId:s,folderId:d}=t;s||(s=o?.organizationId);let v=new IR({apiKey:a,documentId:l?`${l}`:"",organizationId:s?`${s}`:"",veltFolderId:d?`${d}`:void 0});switch(e){case"userConfig":return t?.userId&&v?.userConfig?`${v?.userConfig}/${t?.userId}${t?.documentId?`/${V.FIREBASE_PARTIAL_PATH_DOCUMENT_CONFIGURATIONS}/${t?.documentId}`:""}`:void 0;case"allPermissionsUsers":return v?.permissionsUsers?`${v?.permissionsUsers}`:void 0;case"comment":return t?.documentId&&t?.id&&v?.comment?`${v?.comment}/${t?.id}`:void 0;case"allComments":return t?.documentId&&v?.comment?`${v?.comment}`:void 0;case"multiThread":return t?.documentId&&t?.id&&v?.multiThread?`${v?.multiThread}/${t?.id}`:void 0;case"allMultiThreads":return t?.documentId&&v?.multiThread?`${v?.multiThread}`:void 0;case"crdt":return t?.documentId&&v?.crdt&&t?.id?`${v?.crdt}/${t?.id}`:void 0;case"allLastNotificationTimestamp":return v?.lastNotificationTimestamp?`${v?.lastNotificationTimestamp}`:void 0;case"lastNotificationTimestamp":return t?.id&&v?.lastNotificationTimestamp?`${v?.lastNotificationTimestamp}/${t?.id}`:void 0;case"area":return t?.documentId&&t?.id&&v?.area?`${v?.area}/${t?.id}`:void 0;case"allAreas":return t?.documentId&&v?.area?`${v?.area}`:void 0;case"allDocuments":return v?.document?`${v?.document}`:void 0;case"allLocations":return v?.location?`${v?.location}`:void 0;case"allFolders":return v?.folder?`${v?.folder}`:void 0;case"folder":return v?.folder&&t.folderId?`${v?.folder}/${t.folderId}`:void 0;case"documentUserAccess":return t?.documentId&&t?.id&&v?.documentUsers?`${v?.documentUsers}/${t?.id}`:void 0;case"reaction":return t?.documentId&&t?.id&&v?.reaction?`${v?.reaction}/${t?.id}`:void 0;case"allReactions":return t?.documentId&&v?.reaction?`${v?.reaction}`:void 0;case"recorder":return t?.documentId&&t?.id&&v?.recorder?`${v?.recorder}/${t?.id}`:void 0;case"allRecorders":return t?.documentId&&v?.recorder?`${v?.recorder}`:void 0;case"recorderTrackEvent":return t?.documentId&&t?.id&&v?.recorder?`${v?.recorder}/${t?.id}/trackRecorderEvent`:void 0;case"documentAccessType":return t?.documentId&&v?.document?`${v?.document}/${t?.documentId}`:void 0;case"organizationMetadata":return v?.organization?`${v?.organization}`:void 0;case"documentIam":case"documentMetadata":return t?.documentId&&v?.document?`${v?.document}/${t?.documentId}`:void 0;case"folderMetadata":return t?.folderId&&v?.folder?`${v?.folder}/${t?.folderId}`:void 0;case"locationMetadata":return t?.documentId&&v?.location&&t?.id?`${v?.location}/${t?.id}`:void 0;case"documentUser":return t?.documentId&&t?.id&&v?.documentUsers?`${v?.documentUsers}/${t?.id}`:void 0;case"allDocumentUsers":return v?.users?`${v?.users}`:void 0;case"allFolderUsers":return v?.users?`${v?.users}`:void 0;case"allOrganizationGroups":return v?.organizationGroups?`${v?.organizationGroups}`:void 0;case"allOrganizationUsers":return v?.users?`${v?.users}`:void 0;case"notificationViewsTimestamp":return t?.documentId&&t?.id&&v?.notificationViews?`${v?.notificationViews}/${t?.id}`:void 0;case"allDocumentViews":return t?.documentId&&v?.documentViews?`${v?.documentViews}`:void 0;case"documentViews":case"documentMetadataViews":case"documentDayViews":case"documentUsersViews":return t?.documentId&&t?.id&&v?.documentViews?`${v?.documentViews}/${t?.id}`:void 0;case"locationDayViews":case"locationUsersViews":case"locationViews":case"locationMetadataViews":case"location":return t?.documentId&&t?.id&&v?.locationViews?`${v?.locationViews}/${t?.id}`:void 0;case"allLocationViews":return t?.documentId&&v?.locationViews?`${v?.locationViews}`:void 0;case"allDocNotifications":return t?.documentId&&v?.docNotification?`${v?.docNotification}`:void 0;case"docNotificationViews":case"docNotification":return t?.documentId&&t?.id&&v?.docNotification?`${v?.docNotification}/${t?.id}`:void 0;case"userNotificationViews":case"userNotification":return t?.userId&&t?.id&&v?.notificationUsers?`${v?.notificationUsers}/${t?.userId}/${V.FIREBASE_PARTIAL_PATH_USER_NOTIFICATION}/${t?.id}`:void 0;case"allUserNotifications":return t?.userId&&v?.notificationUsers?`${v?.notificationUsers}/${t?.userId}/${V.FIREBASE_PARTIAL_PATH_USER_NOTIFICATION}`:void 0;default:throw new Error(`Unknown feature: ${e}`)}}catch(l){this.loggingService.catch("Error in CommonDbUtilsService getFirestorePath:",l);return}}getFirestoreCollectionGroupPath(e){try{switch(e){case"allComments":return V.FIREBASE_PARTIAL_PATH_COMMENT;case"allDocuments":return V.FIREBASE_PARTIAL_PATH_DOCS;case"allLocations":return V.FIREBASE_PARTIAL_PATH_LOCATION;case"allMultiThreads":return V.FIREBASE_PARTIAL_PATH_MULTI_THREAD;case"allAreas":return V.FIREBASE_PARTIAL_PATH_AREA;case"allReactions":return V.FIREBASE_PARTIAL_PATH_REACTION;case"allRecorders":return V.FIREBASE_PARTIAL_PATH_RECORDER;case"allDocumentViews":return V.FIREBASE_PARTIAL_PATH_DOCUMENT_VIEWS;case"allLocationViews":return V.FIREBASE_PARTIAL_PATH_LOCATION_VIEWS;case"allDocumentUsers":return V.FIREBASE_PARTIAL_PATH_DOCUMENT_USERS;case"allFolderUsers":return V.FIREBASE_PARTIAL_PATH_FOLDER_USERS;default:throw new Error(`Unknown feature: ${e}`)}}catch(t){this.loggingService.catch("Error in CommonDbUtilsService getFirestoreCollectionGroupPath:",t);return}}getDocumentPath({feature:e,properties:t,defaultDocumentPaths:o,apiKey:a,useFirestore:l}){try{if(!a)return;let{documentId:s,organizationId:d}=t;d||(d=o?.organizationId);let v=new Am({apiKey:a,documentId:s?`${s}`:"",organizationId:d?`${d}`:""});switch(e){case"userConfig":return t?.userId&&t?.documentId&&v?.userConfig?`${v?.userConfig}/${t?.userId}/${V.FIREBASE_PARTIAL_PATH_DOCUMENT_CONFIGURATIONS}/${t?.documentId}`:void 0;case"allComments":return!l&&t?.documentId&&v?.comment?`${v?.comment}`:void 0;case"allGlobalContacts":return t?.documentId&&v?.globalContacts?`${v?.globalContacts}`:void 0;case"globalContacts":return t?.documentId&&t?.userId&&v?.globalContacts?`${v?.globalContacts}${t?.userId}`:void 0;case"groupContacts":return t?.documentId&&t?.groupId&&v?.groupContacts?`${v?.groupContacts}${t?.groupId}`:void 0;case"groupContactsUser":return t?.documentId&&t?.groupId&&t?.userId&&v?.groupContacts?`${v?.groupContacts}${t?.groupId}/${t?.userId}`:void 0;case"allLoginContacts":return t?.documentId&&t?.userId&&v?.logins?`${v?.logins}${t?.userId}/contacts`:void 0;case"allLogins":return t?.documentId&&v?.logins?`${v?.logins}`:void 0;case"logins":return t?.documentId&&t?.userId&&v?.logins?`${v?.logins}${t?.userId}`:void 0;case"customerMetadata":return v?.customerMetadata?`${v?.customerMetadata}`:void 0;case"allArrows":return t?.documentId&&v?.arrow?`${v?.arrow}`:void 0;case"arrow":return t?.documentId&&v?.arrow&&t.id?`${v?.arrow}${t.id}`:void 0;case"allCursors":return t?.documentId&&v?.cursor?`${v?.cursor}`:void 0;case"cursor":return t?.documentId&&v?.cursor&&t.id?`${v?.cursor}${t.id}`:void 0;case"flockUser":return t?.documentId&&v?.flock&&t.id?`${v?.flock}users/${t.id}`:void 0;case"flockSession":return t?.documentId&&v?.flock&&t.id?`${v?.flock}sessions/${t.id}`:void 0;case"allHuddleAttendees":return t?.documentId&&v?.huddle?`${v?.huddle}attendees`:void 0;case"huddleAttendee":return t?.documentId&&v?.huddle&&t.id?`${v?.huddle}attendees/${t.id}`:void 0;case"huddleAttendeeState":return t?.documentId&&v?.huddle&&t.id?`${v?.huddle}attendees/${t.id}/state`:void 0;case"allHuddleInvitees":return t?.documentId&&v?.huddle?`${v?.huddle}invitees`:void 0;case"huddleConnection":return t?.documentId&&v?.huddle&&t.id?`${v?.huddle}connections/${t.id}`:void 0;case"huddleIceCandidate":return t?.documentId&&v?.huddle&&t.id?`${v?.huddle}iceCandidates/${t.id}`:void 0;case"allHuddleIceCandidates":return t?.documentId&&v?.huddle?`${v?.huddle}iceCandidates`:void 0;case"allHuddleMessages":return t?.documentId&&v?.huddle?`${v?.huddle}messages`:void 0;case"huddleMessage":return t?.documentId&&v?.huddle&&t.id?`${v?.huddle}messages/${t.id}`:void 0;case"allLiveStates":return t?.documentId&&v?.liveState?`${v?.liveState}`:void 0;case"allLiveStateCustoms":return t?.documentId&&v?.liveState?`${v?.liveState}custom`:void 0;case"liveStateCustom":return t?.documentId&&v?.liveState&&t?.id?`${v?.liveState}custom/${t.id}`:void 0;case"liveStateSingleEditorMode":return t?.documentId&&v?.liveStateSingleEditorMode?`${v?.liveStateSingleEditorMode}`:void 0;case"liveStateAutoSyncState":return t?.documentId&&v?.liveState?`${v?.liveState}default/autoSyncState`:void 0;case"liveStateAutoSyncStateCurrent":return t?.documentId&&v?.liveState?`${v?.liveState}default/autoSyncState/current`:void 0;case"liveStateAutoSyncStateHistoryId":return t?.documentId&&v?.liveState&&t?.id?`${v?.liveState}default/autoSyncState/history/${t.id}`:void 0;case"presence":return t?.documentId&&v?.presence&&t?.userId?`${v?.presence}${t?.userId}`:void 0;case"allPresence":return t?.documentId&&v?.presence?`${v?.presence}`:void 0;case"workspaceIam":return v?.workspaceIam?`${v?.workspaceIam}`:void 0;case"selection":return t?.documentId&&v?.selection&&t?.userId?`${v?.selection}${t?.userId}`:void 0;case"allSelections":return t?.documentId&&v?.selection?`${v?.selection}`:void 0;case"syncVideoPlayer":return t?.documentId&&v?.syncVideoPlayer?`${v?.syncVideoPlayer}`:void 0;case"allTags":return t?.documentId&&v?.tag?`${v?.tag}`:void 0;case"tag":return t?.documentId&&v?.tag&&t?.id?`${v?.tag}${t?.id}`:void 0;case"userContactUs":return t?.documentId&&v?.userContactUs?`${v?.userContactUs}`:void 0;case"userFeedback":return t?.documentId&&v?.userFeedback?`${v?.userFeedback}`:void 0;case"userReportBug":return t?.documentId&&v?.userReportBugs?`${v?.userReportBugs}`:void 0;case"comment":return!l&&t?.documentId&&t?.id&&v?.comment?`${v?.comment}${t?.id}`:void 0;case"allMultiThreads":return!l&&t?.documentId&&v?.multiThread?`${v?.multiThread}`:void 0;case"crdt":return!l&&t?.documentId&&v?.crdt?`${v?.crdt}`:void 0;case"crdtData":return t?.documentId&&v?.crdt&&t?.id?`${v?.crdt}/${t?.id}/data`:void 0;case"crdtSyncState":return t?.documentId&&v?.crdt&&t?.id?`${v?.crdt}/${t?.id}/sync/state`:void 0;case"crdtSyncPresence":return t?.documentId&&t.userId&&v?.crdt&&t?.id?`${v?.crdt}/${t?.id}/sync/presence/${t.userId}`:void 0;case"allCrdtSyncPresence":return t?.documentId&&v?.crdt&&t?.id?`${v?.crdt}/${t?.id}/sync/presence`:void 0;case"crdtPresence":return t?.documentId&&t.userId&&v?.crdt&&t?.id?`${v?.crdt}/${t?.id}/presence/${t.userId}`:void 0;case"allCrdtPresence":return t?.documentId&&v?.crdt&&t?.id?`${v?.crdt}/${t?.id}/presence`:void 0;case"crdtVersion":return t?.documentId&&v?.crdt&&t?.id&&t?.versionId?`${v?.crdt}/${t?.id}/versions/${t?.versionId}`:void 0;case"crdtVersions":return t?.documentId&&v?.crdt&&t?.id?`${v?.crdt}/${t?.id}/versions`:void 0;case"multiThread":return!l&&t?.documentId&&t?.id&&v?.multiThread?`${v?.multiThread}${t?.id}`:void 0;case"allLastNotificationTimestamp":return!l&&v?.organizationNotificationsLastNotificationTimestamp?`${v?.organizationNotificationsLastNotificationTimestamp}`:void 0;case"lastNotificationTimestamp":return!l&&t?.id&&v?.organizationNotificationsLastNotificationTimestamp?`${v?.organizationNotificationsLastNotificationTimestamp}${t?.id}`:void 0;case"documentIam":return!l&&t?.documentId&&v?.documentIam?`${v?.documentIam}`:void 0;case"allDocuments":return!l&&v?.docs&&t?.documentId?`${v?.docs}/${t?.documentId}/${V.FIREBASE_PARTIAL_PATH_METADATA}`:void 0;case"allAreas":return!l&&t?.documentId&&v?.area?`${v?.area}`:void 0;case"area":return!l&&t?.id&&v?.area?`${v?.area}${t?.id}`:void 0;case"folder":return!l&&t?.folderId&&v?.folder?`${v?.folder}${t?.folderId}`:void 0;case"documentUserAccess":return!l&&t?.id&&v?.documentIam?`${v?.documentIam}users/${t?.id}`:void 0;case"documentUser":return!l&&t?.documentId&&t?.id&&v?.documentIam?`${v?.documentIam}users/${t?.id}`:void 0;case"allDocumentUsers":return!l&&t?.documentId&&v?.documentIam?`${v?.documentIam}users/`:void 0;case"allOrganizationGroups":return!l&&v?.organizationGroups?`${v?.organizationGroups}`:void 0;case"allOrganizationUsers":return!l&&v?.organizationIam?`${v?.organizationIam}users/`:void 0;case"reaction":return!l&&t?.id&&v?.reaction?`${v?.reaction}${t?.id}`:void 0;case"allReactions":return!l&&t?.documentId&&v?.reaction?`${v?.reaction}`:void 0;case"recorder":return!l&&t?.documentId&&t?.id&&v?.recorder?`${v?.recorder}${t?.id}`:void 0;case"allRecorders":return!l&&t?.documentId&&v?.recorder?`${v?.recorder}`:void 0;case"organizationMetadata":return!l&&v?.organizationMetadata?`${v?.organizationMetadata}`:void 0;case"heartbeat":return t?.id&&v?.heartbeat?`${v?.heartbeat}${t?.id}`:void 0;case"allHeartbeats":return v?.heartbeat?`${v?.heartbeat}`:void 0;case"heartbeatByDocument":return t?.id&&v?.heartbeatByDocument?`${v?.heartbeatByDocument}${t?.id}`:void 0;case"allHeartbeatsByDocument":return v?.heartbeatByDocument?`${v?.heartbeatByDocument}`:void 0;case"documentAccessType":return!l&&v?.documentIam?`${v?.documentIam}`:void 0;case"documentMetadata":return!l&&t?.documentId&&v?.metadata?`${v?.metadata}`:void 0;case"allDocumentViews":return!l&&t?.documentId&&v?.views?`${v?.views}documentViews/`:void 0;case"documentViews":return!l&&t?.documentId&&t?.id&&v?.views?`${v?.views}documentViews/${t?.id}`:void 0;case"allLocationViews":return!l&&t?.documentId&&v?.views?`${v?.views}locationViews/`:void 0;case"notificationViewsTimestamp":return!l&&t?.id&&t?.user&&v?.views?`${v?.views}notification/${t?.id}/views/${t?.user}`:void 0;case"documentUsersViews":return!l&&t?.id&&t?.user&&t?.date&&v?.views?`${v?.views}documentViews/${t?.id}/users/${t?.user}/${t?.date}`:void 0;case"documentMetadataViews":return!l&&t?.id&&v?.views?`${v?.views}documentViews/${t?.id}/metadata`:void 0;case"documentDayViews":return!l&&t?.id&&t?.date&&t?.user&&v?.views?`${v?.views}documentViews/${t?.id}/day/${t?.date}/${t?.user}`:void 0;case"locationViews":return!l&&t?.id&&v?.views?`${v?.views}locationViews/${t?.id}/location`:void 0;case"location":return!l&&t?.id&&v?.views?`${v?.views}locationViews/${t?.id}`:void 0;case"locationUsersViews":return!l&&t?.id&&t?.user&&t?.date&&v?.views?`${v?.views}locationViews/${t?.id}/users/${t?.user}/${t?.date}`:void 0;case"locationMetadataViews":return!l&&t?.id&&v?.views?`${v?.views}locationViews/${t?.id}/metadata`:void 0;case"locationDayViews":return!l&&t?.id&&t?.date&&t?.user&&v?.views?`${v?.views}locationViews/${t?.id}/day/${t?.date}/${t?.user}`:void 0;case"docNotificationViews":case"docNotification":return t?.documentId&&t?.id&&v?.organizationNotificationsWithDocumentId?`${v?.organizationNotificationsWithDocumentId}${t?.id}`:void 0;case"allDocNotifications":return t?.documentId&&v?.organizationNotificationsWithDocumentId?`${v?.organizationNotificationsWithDocumentId}`:void 0;case"allUserNotifications":return t?.userId&&v?.organizationNotificationsUsers?`${v?.organizationNotificationsUsers}${t?.userId}`:void 0;case"userNotificationViews":case"userNotification":return t?.userId&&t?.id&&v?.organizationNotificationsUsers?`${v?.organizationNotificationsUsers}${t?.userId}/${t?.id}`:void 0;case"locationMetadata":return;case"allLocations":return;case"folderMetadata":return;case"allPermissionsUsers":return;default:throw new Error(`Unknown feature: ${e}`)}}catch(s){this.loggingService.catch("Error in CommonDbUtilsService getDocumentPath:",s);return}}resolveAnnotations(o){return X(this,arguments,function*({data:e,feature:t}){try{if(e&&e?.length>0)switch(t){case"allComments":{if(this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable()){let a=St(),l=Q1.GET_COMMENT_ANNOTATIONS;this.coreActionsService.triggerAction(ut.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:a,methodName:Gr.RESOLVE_COMMENT_ANNOTATIONS,moduleName:l,source:"internal",payload:{commentAnnotationIds:e,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""}}),this.commentAnnotationsResolverService.resolveCommentAnnotations({request:{commentAnnotationIds:e,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""},uniqueId:a,moduleName:l})}break}case"allReactions":{if(this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable()){let a=St(),l=ZE.GET_REACTION_ANNOTATIONS;this.coreActionsService.triggerAction(ut.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:a,methodName:to.RESOLVE_REACTION_ANNOTATIONS,moduleName:l,source:"internal",payload:{reactionAnnotationIds:e,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""}}),this.reactionAnnotationsResolverService.resolveReactionAnnotations({request:{reactionAnnotationIds:e,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""},uniqueId:a,moduleName:l})}break}default:break}}catch(a){this.loggingService.catch(`Error in CommonDbUtilsService resolveAnnotations: ${t}`,a)}})}formatResponse(s){return X(this,arguments,function*({feature:e,data:t,shouldAwait:o=!1,forceResolve:a=!1,shouldCommentAnnotationsResolverAwait:l=!1}){try{if(this.usersService.userDataProviderAvailable()){let d=[];switch(e){case"allAreas":{t&&typeof t=="object"&&!Array.isArray(t)&&(d=this.areaUtilsService.getUserIdsToResolveFromAreaAnnotations(Object.values(t)));break}case"allArrows":{t&&typeof t=="object"&&!Array.isArray(t)&&(d=this.arrowUtilsService.getUserIdsToResolveFromArrowAnnotations(Object.values(t)));break}case"allCursors":{t&&typeof t=="object"&&!Array.isArray(t)&&(d=this.cursorUtilsService.getUserIdsToResolveFromCursorUsers(Object.values(t)));break}case"allComments":{t&&typeof t=="object"&&!Array.isArray(t)&&(d=this.commentUtilsService.getUserIdsToResolveFromComments(Object.values(t)));break}case"allDocumentUsers":{t&&typeof t=="object"&&!Array.isArray(t)&&(d=this.contactUtilsService.getUserIdsToResolveFromUserIamData(Object.values(t)));break}case"allFolderUsers":{t&&typeof t=="object"&&!Array.isArray(t)&&(d=this.contactUtilsService.getUserIdsToResolveFromUserIamData(Object.values(t)));break}case"allOrganizationUsers":{t&&typeof t=="object"&&!Array.isArray(t)&&(d=this.contactUtilsService.getUserIdsToResolveFromUserIamData(Object.values(t)));break}case"allMultiThreads":{t&&typeof t=="object"&&!Array.isArray(t)&&(d=this.multiThreadUtilsService.getUserIdsToResolveFromMultiThreads(Object.values(t)));break}case"allDocNotifications":{t&&typeof t=="object"&&(d=this.notificationUtilsService.getUserIdsToResolveFromNotifications(Array.isArray(t)?t:Object.values(t)));break}case"allUserNotifications":{t&&typeof t=="object"&&!Array.isArray(t)&&(d=this.notificationUtilsService.getUserIdsToResolveFromNotifications(Object.values(t)));break}case"allPresence":{t&&typeof t=="object"&&!Array.isArray(t)&&(d=this.presenceUtilsService.getUserIdsToResolveFromPresenceUsers(Object.values(t)));break}case"allRecorders":{t&&typeof t=="object"&&!Array.isArray(t)&&(d=this.recorderUtilsService.getUserIdsToResolveFromRecorders(Object.values(t)));break}case"allReactions":{t&&typeof t=="object"&&!Array.isArray(t)&&(d=this.reactionUtilsService.getUserIdsToResolveFromReactions(Object.values(t)));break}case"allTags":{t&&typeof t=="object"&&!Array.isArray(t)&&(d=this.tagUtilsService.getUserIdsToResolveFromTags(Object.values(t)));break}case"allHuddleAttendees":{t&&typeof t=="object"&&!Array.isArray(t)&&(d=this.huddleUtilsService.getUserIdsToResolveFromHuddleAttendees(Object.values(t)));break}case"liveStateCustom":{t&&typeof t=="object"&&!Array.isArray(t)&&(d=this.liveStateUtilsService.getUserIdsToResolveFromLiveStateCustom(t));break}case"allLiveStateCustoms":{t&&typeof t=="object"&&!Array.isArray(t)&&(d=this.liveStateUtilsService.getUserIdsToResolveFromLiveStateCustoms(Object.values(t)));break}case"allLiveStates":{t&&typeof t=="object"&&(d=this.liveStateUtilsService.getUserIdsToResolveFromLiveStates(t));break}case"liveStateSingleEditorMode":{t&&typeof t=="object"&&!Array.isArray(t)&&(d=this.liveStateUtilsService.getUserIdsToResolveFromLiveStateSingleEditorMode(t));break}case"allSelections":{t&&typeof t=="object"&&!Array.isArray(t)&&(d=this.selectionUtilsService.getUserIdsToResolveFromSelections(Object.values(t)));break}default:d=[]}if(d?.length){let v=St(),u=Gs.GET_USERS;this.coreActionsService.triggerAction(ut.USER_RESOLVER,{event:Y.Events.Resolver.USER_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:v,methodName:eo.FORMAT_RESPONSE,source:"internal",moduleName:u,payload:{userIds:d,feature:e,forceResolve:a}}),o?yield this.usersService.resolveUsers({userIds:d,forceResolve:a,feature:e,uniqueId:v,moduleName:u}):this.usersService.resolveUsers({userIds:d,forceResolve:a,feature:e,uniqueId:v,moduleName:u})}}if(this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable()){let d=[];switch(e){case"allDocNotifications":{if(t&&typeof t=="object"){let v=this.notificationUtilsService.getTargetAnnotationIdsFromNotifications(t);d=[...d,...v],d=d.filter(u=>!this.commentAnnotationsResolverService.getCommentAnnotationById(u))}break}case"allUserNotifications":{if(t&&typeof t=="object"&&!Array.isArray(t)){let v=this.notificationUtilsService.getTargetAnnotationIdsFromNotifications(t);d=[...d,...v],d=d.filter(u=>!this.commentAnnotationsResolverService.getCommentAnnotationById(u))}break}default:d=[]}if(d?.length){let v=St(),u=Q1.GET_NOTIFICATIONS;this.coreActionsService.triggerAction(ut.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:v,methodName:Gr.FORMAT_RESPONSE,moduleName:u,source:"internal",payload:{commentAnnotationIds:d,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??"",shouldCommentAnnotationsResolverAwait:l}}),l?yield this.commentAnnotationsResolverService.resolveCommentAnnotations({request:{commentAnnotationIds:d,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""},uniqueId:v,moduleName:u}):this.commentAnnotationsResolverService.resolveCommentAnnotations({request:{commentAnnotationIds:d,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""},uniqueId:v,moduleName:u})}}return t}catch(d){return this.loggingService.catch("Error in CommonDbUtilsService formatResponse:",d),t}})}mergeCommentAnnotationsWithData({data:e,feature:t}){try{if(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: mergeCommentAnnotationsWithData","color: green;"),this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable())switch(t){case"allComments":return e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).reduce((o,[a,l])=>(o[a]=this.commentUtilsService.mergeStrippedDataWithCommentAnnotations(l),o),{}):e;case"allDocNotifications":case"allUserNotifications":return e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).reduce((o,[a,l])=>(o[a]=this.notificationUtilsService.mergeStrippedDataWithNotification(l),o),{}):e;default:return e}return e}catch(o){return this.loggingService.catch("Error in CommonDbUtilsService mergeCommentAnnotationsWithData:",o),e}}mergeReactionAnnotationsWithData({data:e,feature:t}){try{if(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: mergeReactionAnnotationsWithData","color: green;"),this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable())switch(t){case"allReactions":return e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).reduce((o,[a,l])=>(o[a]=this.reactionUtilsService.mergeStrippedDataWithReactionAnnotations(l),o),{}):e;default:return e}return e}catch(o){return this.loggingService.catch("Error in CommonDbUtilsService mergeReactionAnnotationsWithData:",o),e}}mergeLocationMetadataWithData({data:e,feature:t,locationMetadata:o}){try{if(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: mergeLocationMetadataWithData","color: green;"),o&&typeof o=="object"&&!Array.isArray(o))switch(t){case"allComments":return e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).reduce((a,[l,s])=>(a[l]=this.commentUtilsService.mergeLocationWithCommentAnnotations(s,o),a),{}):e;case"allDocNotifications":case"allUserNotifications":return e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).reduce((a,[l,s])=>(a[l]=this.notificationUtilsService.mergeLocationWithNotification(s,o),a),{}):e;default:return e}return e}catch(a){return this.loggingService.catch("Error in CommonDbUtilsService mergeLocationMetadataWithData:",a),e}}mergeUsersWithData({feature:e,data:t}){try{if(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: mergeUsersWithData","color: green;"),this.usersService.userDataProviderAvailable())switch(e){case"allAreas":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((o,[a,l])=>(o[a]=this.areaUtilsService.mergeAreaWithUser(l),o),{}):t;case"allArrows":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((o,[a,l])=>(o[a]=this.arrowUtilsService.mergeArrowWithUser(l),o),{}):t;case"allCursors":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((o,[a,l])=>(o[a]=this.cursorUtilsService.mergeCursorUserWithUser(l),o),{}):t;case"allComments":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((o,[a,l])=>(o[a]=this.commentUtilsService.mergeCommentWithUser(l),o),{}):t;case"allDocumentUsers":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((o,[a,l])=>(o[a]=this.contactUtilsService.mergeUserIamWithUser(l),o),{}):t;case"allFolderUsers":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((o,[a,l])=>(o[a]=this.contactUtilsService.mergeUserIamWithUser(l),o),{}):t;case"allOrganizationUsers":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((o,[a,l])=>(o[a]=this.contactUtilsService.mergeUserIamWithUser(l),o),{}):t;case"allMultiThreads":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((o,[a,l])=>(o[a]=this.multiThreadUtilsService.mergeMultiThreadWithUser(l),o),{}):t;case"allDocNotifications":return t&&typeof t=="object"?t?.map(o=>this.notificationUtilsService.mergeNotificationWithUser(o)):t;case"allUserNotifications":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((o,[a,l])=>(o[a]=this.notificationUtilsService.mergeNotificationWithUser(l),o),{}):t;case"allPresence":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((o,[a,l])=>(o[a]=this.presenceUtilsService.mergePresenceUserWithUser(l),o),{}):t;case"allRecorders":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((o,[a,l])=>(o[a]=this.recorderUtilsService.mergeRecorderWithUser(l),o),{}):t;case"allReactions":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((o,[a,l])=>(o[a]=this.reactionUtilsService.mergeReactionWithUser(l),o),{}):t;case"allTags":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((o,[a,l])=>(o[a]=this.tagUtilsService.mergeTagWithUser(l),o),{}):t;case"allHuddleAttendees":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((o,[a,l])=>(o[a]=this.huddleUtilsService.mergeHuddleAttendeeWithUser(l),o),{}):t;case"liveStateCustom":return t&&typeof t=="object"&&!Array.isArray(t)?this.liveStateUtilsService.mergeLiveStateCustomWithUser(t):t;case"allLiveStateCustoms":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((o,[a,l])=>(o[a]=this.liveStateUtilsService.mergeLiveStateCustomWithUser(l),o),{}):t;case"allLiveStates":return t&&typeof t=="object"?this.liveStateUtilsService.mergeLiveStateWithUser(t):t;case"liveStateSingleEditorMode":return t&&typeof t=="object"&&!Array.isArray(t)?this.liveStateUtilsService.mergeSingleEditorLiveStateDataWithUser(t):t;case"allSelections":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((o,[a,l])=>(o[a]=this.selectionUtilsService.mergeSelectionWithUser(l),o),{}):t;default:return t}return t}catch(o){return this.loggingService.catch("Error in CommonDbUtilsService mergeUsersWithData:",o),t}}mergeCommentAnnotationsWithData$({data:e,feature:t}){try{return this.commentAnnotationsResolverService.getCommentAnnotationsById$().pipe(ge(()=>{let o=this.mergeCommentAnnotationsWithData({data:e?.data??{},feature:t}),a=this.mergeUsersWithData({feature:t,data:o??{}});return typeof a=="object"?{data:JSON.parse(JSON.stringify(a)),operation:e?.operation??null}:{data:a,operation:e?.operation??null}}),xt(Qt))}catch(o){return this.loggingService.catch("Error in mergeCommentAnnotationsWithData:",o),ce(e)}}mergeReactionAnnotationsWithData$({data:e,feature:t}){try{return this.reactionAnnotationsResolverService.getReactionAnnotationsById$().pipe(ge(()=>{let o=this.mergeReactionAnnotationsWithData({data:e?.data??{},feature:t}),a=this.mergeUsersWithData({feature:t,data:o??{}});return typeof a=="object"?{data:JSON.parse(JSON.stringify(a)),operation:e?.operation??null}:{data:a,operation:e?.operation??null}}),xt(Qt))}catch(o){return this.loggingService.catch("Error in mergeReactionAnnotationsWithData:",o),ce(e)}}mergeUsersWithData$({feature:e,data:t}){try{return this.usersService.getUserById$().pipe(ge(()=>{let o=this.mergeUsersWithData({feature:e,data:t?.data??{}});return typeof o=="object"?{data:JSON.parse(JSON.stringify(o)),operation:t?.operation??null}:{data:o,operation:t?.operation??null}}),xt(Qt))}catch(o){return this.loggingService.catch(`Error in mergeUsersWithData for ${e}:`,o),ce(t)}}mergeLocationMetadataWithData$({data:e,feature:t}){try{return this.docService.getLocationMetadata$().pipe(ge(o=>{let a=this.mergeLocationMetadataWithData({data:e?.data??{},feature:t,locationMetadata:o});return typeof a=="object"?{data:JSON.parse(JSON.stringify(a)),operation:e?.operation??null}:{data:a,operation:e?.operation??null}}),xt(Qt))}catch(o){return this.loggingService.catch(`Error in mergeLocationMetadataWithData for ${t}:`,o),ce(e)}}handleDataStripping(l){return X(this,arguments,function*({feature:e,data:t,actionType:o,commentId:a}){try{switch(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: handleDataStripping","color: green;"),e){case"comment":return yield this.commentUtilsService.stripCommentAnnotationData({data:t,actionType:o,commentId:a});case"reaction":return this.reactionUtilsService.stripReactionAnnotationData(t);default:return{originalData:t,strippedData:null}}}catch(s){return this.loggingService.catch("Error in CommonDbUtilsService handleDataStripping:",s),{originalData:t,strippedData:null}}})}formatData({feature:e,data:t,properties:o,offset:a,isRealtimeDb:l}){try{this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: formatData","color: green;"),typeof t=="object"&&(t=JSON.parse(JSON.stringify(t)));let s=new Date().getTime()+a;switch(e){case"documentAccessType":return delete t?.users,{docIamConfig:t};case"organizationMetadata":case"documentMetadata":return l?t:{metadata:t};case"documentCommentMetadata":return t;case"cursor":return this.cursorUtilsService.formatCursorUserData(t);case"comment":return this.commentUtilsService.formatCommentData(t);case"area":return this.areaUtilsService.formatAreaData(t);case"arrow":return this.arrowUtilsService.formatArrowData(t);case"liveStateCustom":return this.liveStateUtilsService.formatLiveStateCustomData(t);case"liveStateSingleEditorMode":return this.liveStateUtilsService.formatLiveStateSingleEditorModeData(t);case"multiThread":return this.multiThreadUtilsService.formatMultiThreadData(t);case"reaction":return this.reactionUtilsService.formatReactionData(t);case"recorder":return this.recorderUtilsService.formatRecorderData(t,s);case"notificationViewsTimestamp":return{views:{[o.user??""]:t}};case"documentUsersViews":return l?t:{users:{[o.user??""]:{[o.date??""]:t}}};case"documentDayViews":return l?t:{day:{[o.date??""]:{[o.user??""]:t}}};case"documentMetadataViews":return l?t:{metadata:t};case"huddleMessage":return this.huddleUtilsService.formatHuddleMessageData(t);case"locationMetadataViews":return l?t:{metadata:t};case"locationUsersViews":return l?t:{users:{[o.user??""]:{[o.date??""]:t}}};case"locationDayViews":return l?t:{day:{[o.date??""]:{[o.user??""]:t}}};case"locationViews":return l?t:{location:t};case"docNotificationViews":return l?t:{views:t.views};case"userNotificationViews":return l?t:{views:t.views};case"presence":return this.presenceUtilsService.formatPresenceUserData(t);case"selection":return this.selectionUtilsService.formatSelectionData(t);case"tag":return this.tagUtilsService.formatTagData(t);default:return t}}catch(s){return this.loggingService.catch("Error in CommonDbUtilsService formatData:",s),t}}modifyAndSetData(l){return X(this,arguments,function*({feature:e,data:t,subscriber:o,operation:a=null}){try{let s=yield this.modifyData({feature:e,data:t});o.next({data:s,operation:a})}catch(s){this.loggingService.catch("Error in CommonDbUtilsService modifyAndSetData:",s)}})}isDataAlreadyProcessedInLocalCache({feature:e,change:t,cache:o}){try{if(e==="allReactions"||e==="allComments"){if(t.type==="removed")return!Object.keys(o??{}).includes(t.doc.id);if(o?.[t.doc.id]){let a=t.doc.data(),l=o?.[t.doc.id];return a?.lastUpdated===l?.lastUpdated}}return!1}catch(a){return this.loggingService.catch("Error in CommonDbUtilsService isDataAlreadyProcessedInLocalCache:",a),!1}}modifyData(o){return X(this,arguments,function*({feature:e,data:t}){try{return yield this.formatResponse({feature:e,data:t})}catch(a){return this.loggingService.catch("Error in CommonDbUtilsService modifyData:",a),t}})}addMetadata(e,t){try{return e&&typeof e=="object"&&!Array.isArray(e)?E(b({},e),{metadata:e?.metadata??{documentId:t?.documentId,organizationId:t?.organizationId,apiKey:t?.apiKey}}):e}catch(o){return this.loggingService.catch("Error in CommonDbUtilsService addMetadata:",o),e}}setDataInLocal(d){return X(this,arguments,function*({feature:e,data:t,observablesCache:o,eventType:a,id:l,operation:s=null}){try{let u={comment:"allComments",reaction:"allReactions"}[e];if(!u)return null;let S=t?.metadata?.documentId,k=t?.metadata?.veltFolderId;return Object.keys(o).filter(A=>A.includes(u)&&(!S||A.includes(S)||k&&A.includes(k))).forEach(A=>{let P=o[A]?.subject?.getValue()??{};a==="DELETE"?l&&P?.data?.[l]&&(delete P?.data?.[l],o[A]?.subject&&o[A].subject.next({data:P?.data,operation:s})):o[A]?.subject?.next({data:E(b({},P?.data),{[t?.annotationId]:t}),operation:s})}),null}catch(v){return this.loggingService.catch("Error in CommonDbUtilsService setDataInLocal:",v),null}})}handleCommentEncryption(s){return X(this,arguments,function*({data:e,firestorePath:t,extraData:o,eventType:a,metadata:l}){try{return yield this.commentUtilsService.handleCommentEncryption({data:e,firestorePath:t,extraData:o,eventType:a,metadata:l})}catch(d){return this.loggingService.catch("Error in CommonDbUtilsService handleCommentEncryption:",d),e}})}handleReactionEncryption(a){return X(this,arguments,function*({data:e,firestorePath:t,eventType:o}){try{return yield this.reactionUtilsService.handleReactionEncryption({data:e,firestorePath:t,eventType:o})}catch(l){return this.loggingService.catch("Error in CommonDbUtilsService handleReactionEncryption:",l),e}})}rtdbDefaultTransactionCallback(e,t){try{let o=b({},e||{});return Object.entries(t).forEach(([a,l])=>{l==null?delete o[a]:o[a]=l}),o}catch(o){return this.loggingService.catch("Error in CommonDbUtilsService rtdbDefaultTransactionCallback:",o),e}}};r.\u0275fac=function(t){return new(t||r)(J(due),J(mue),J(ku),J(gue),J(pi),J(vue),J(wR),J(DR),J(x),J(hue),J(OR),J(Cue),J(_ue),J(l_),J(bue),J(Sue),J(Dn),J(lt),J(vs),J(Pm))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var yue=(()=>{let r=class r{constructor(e,t,o){this.configService=e,this.authService=t,this.loggingService=o,this.firestore$=new be(null);try{un([this.authService.getFirebaseConfig$(),this.configService.getApiKey$()]).pipe(je(([a,l])=>!!a&&!!l),st(1)).subscribe(([a,l])=>{if(a&&l&&a?.firebaseOptions?.storeDbId){try{let s=sessionStorage?.getItem("veltFirestoreLogLevel")||wn?.firebaseLogLevel||"silent";Dq(s)}catch(s){this.loggingService.catch("Error in FirestoreService setLogLevel: ",s)}this.firestore$.next(tR(Iu.getFirestoreProdDbName(l,a.firebaseOptions)))}},a=>{})}catch{}}getFirestore(){return this.firestore$.asObservable()}getFirestoreValue(){return this.firestore$.value}generateFirestoreDocumentId(){try{let e=this.getFirestoreValue()||tR("DocumentIdDb");if(e){let t=YE(e,"generateDocumentId");return X1(t).id}return}catch(e){this.loggingService.catch("Error in FirestoreService generateFirestoreDocumentId: ",e);return}}};r.\u0275fac=function(t){return new(t||r)(J(Lt),J(Ge),J(x))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var xn=(()=>{let r=class r{constructor(e,t,o,a,l,s,d,v,u,S,k){this.authService=e,this.commonDbUtilsService=t,this.coreActionsService=o,this.loggingService=a,this.firestoreService=l,this.databaseService=s,this.configService=d,this.docService=v,this.usersService=u,this.commentAnnotationsResolverService=S,this.reactionAnnotationsResolverService=k,this.offset=0,this.db=null,this.firestore=null,this.subscriptions=[],this.offsetListener=null,this.observablesCache={},this.firestoreSubscriptions={},this.rtdbSubscriptions={},this.loggingService.log("%c[WB] Creating CLASS: CommonDbService","color: blue;"),this.docService.setCommonDbService(this),this.authService.setCommonDbService(this),this.usersService.setCommonDbService(this),this.subscriptions.push(this.databaseService.getDb().subscribe(A=>{if(A){this.db=A;let P=Li(A,".info/serverTimeOffset");this.offsetListener=Zv(P,U=>{let W=U.val();this.offset=W})}})),this.subscriptions.push(this.firestoreService.getFirestore().subscribe(A=>{A&&(this.firestore=A)}))}unsubscribeFromObservables(){try{Object.values(this.firestoreSubscriptions??{}).forEach(e=>{e?.unsubscribe()}),Object.values(this.rtdbSubscriptions??{}).forEach(e=>{e?.unsubscribe()}),Object.entries(this.observablesCache??{}).forEach(([e,t])=>{t?.subject?.complete(),t?.subject?.unsubscribe()}),this.observablesCache={},this.firestoreSubscriptions={},this.rtdbSubscriptions={}}catch(e){this.loggingService.catch("Error in unsubscribeFromObservables:",e)}}ngOnDestroy(){this.subscriptions.forEach(e=>e.unsubscribe()),this.offsetListener&&this.offsetListener(),this.unsubscribeFromObservables()}setupOnDisconnect(e,t){return X(this,null,function*(){try{if(this.db){let o=Li(this.db,e);return Ll(o).update(t)}return Promise.resolve()}catch(o){return this.loggingService.catch("Error in setupOnDisconnect:",o),Promise.resolve()}})}getOffset(){return this.offset}getServerTimestamp(){return new Date().getTime()+this.getOffset()}subscribeToServices(e){un([this.databaseService.getDb(),this.firestoreService.getFirestore()]).pipe(je(([t,o])=>!!t),st(1),rn(([t,o])=>{e({db:t,firestore:o})})).subscribe({error:t=>{this.loggingService.catch("Error in CommonDbService subscription: ",t)}})}performDatabaseOperation(e,t,o,a,l,s){return X(this,null,function*(){try{if(!t){this.loggingService.warn(`%c[WB] No properties found for ${e}`,"color: red;");return}return this.subscribeToServices(u=>X(this,[u],function*({db:d,firestore:v}){let S;t?.skipFirestore||(S=this.commonDbUtilsService.getFirestorePath({feature:e,properties:t,documentPaths:this.docService.getDocumentPaths(),apiKey:t.apiKey??this.configService.getApiKey()}));let k=this.commonDbUtilsService.getDocumentPath({feature:e,properties:t,defaultDocumentPaths:this.docService.getDocumentPaths(),apiKey:t.apiKey??this.configService.getApiKey(),useFirestore:this.shouldUseFirestore()});if(!d){this.loggingService.warn(`%c[WB] No database or firestore found for ${e}`,"color: red;");return}try{let A,P;try{k&&(A=Li(d,`${k}`))}catch{this.loggingService.catch("Error in dbRef")}try{S?.includes("/organizations")&&v&&S&&(P=X1(v,`${S}`))}catch{this.loggingService.catch("Error in docRef")}if(!this.authService.getUser())return;yield o({dbRef:A,firestoreRef:P,data:a,firestorePath:S}),s&&s({firestoreAvailable:!!v})}catch(A){this.loggingService.catch(`Error in ${e} operation: `,A),l&&l(A)}}))}catch(d){this.loggingService.catch("Error in performDatabaseOperation:",d)}})}setData(d){return X(this,arguments,function*({feature:e,data:t,properties:o,callback:a,errorCallback:l,extraData:s}){try{return this.loggingService.log(`%c[WB] Calling FUNCTION: setData for ${e}`,"color: green;"),this.shouldUseFirestore()&&t?.metadata&&!t?.metadata?.apiKey?void 0:(this.commonDbUtilsService.setDataInLocal({feature:e,data:t,observablesCache:this.observablesCache,operation:null}),this.performDatabaseOperation(e,o,v=>X(this,null,function*(){if(v.dbRef){let u=this.commonDbUtilsService.formatData({feature:e,data:v.data,properties:o,offset:this.getOffset(),isRealtimeDb:!0});o?.rtdbTransaction?yield jh(v.dbRef,()=>JSON.parse(JSON.stringify(u))):yield HC(v.dbRef,JSON.parse(JSON.stringify(u)))}try{if(v.firestoreRef&&v.data&&!o?.skipFirestore){let u=this.commonDbUtilsService.formatData({feature:e,data:v.data,properties:o,offset:this.getOffset()});typeof u=="object"&&(u=JSON.parse(JSON.stringify(u)));let{strippedData:S,originalData:k,eventType:A}=yield this.commonDbUtilsService.handleDataStripping({feature:e,data:u,actionType:s?.actionType,commentId:s?.targetAnnotationData?.commentId??o?.targetCommentId});if(e==="comment"){let P=null,U=St();this.coreActionsService.triggerAction(ut.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:U,methodName:Gr.SET_DATA,source:"internal",payload:{strippedData:S,originalData:k,eventType:A,commentId:s?.targetAnnotationData?.commentId}}),S&&(P=yield this.commentAnnotationsResolverService.saveCommentAnnotation({commentAnnotation:S,eventType:A,commentId:s?.targetAnnotationData?.commentId},U)),k&&(P?.isSuccess||P===null)&&(yield this.commonDbUtilsService.handleCommentEncryption({data:k,firestorePath:v.firestorePath??"",extraData:s,metadata:o?.metadata}))}else if(e==="reaction"){let P=null,U=St();this.coreActionsService.triggerAction(ut.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:U,methodName:to.SET_DATA,source:"internal",payload:{strippedData:S,originalData:k}}),S&&(P=yield this.reactionAnnotationsResolverService.saveReactionAnnotation(S,U)),k&&(P?.isSuccess||P===null)&&(yield this.commonDbUtilsService.handleReactionEncryption({data:k,firestorePath:v.firestorePath??""}))}else e==="recorder"?this.firestore&&(yield Gve(this.firestore,P=>X(this,null,function*(){P.set(v.firestoreRef,u)}))):yield oY(v.firestoreRef,u)}}catch(u){this.authService.getUser()&&this.loggingService.catch(`Error in setData for ${e}`,u)}}),t,l,a))}catch(v){this.loggingService.catch(`Error in setData for ${e}`,v)}})}updateData(d){return X(this,arguments,function*({feature:e,data:t,properties:o,callback:a,errorCallback:l,extraData:s}){try{return this.loggingService.log(`%c[WB] Calling FUNCTION: updateData for ${e}`,"color: green;"),this.shouldUseFirestore()&&t?.metadata&&!t?.metadata?.apiKey?void 0:(this.commonDbUtilsService.setDataInLocal({feature:e,data:t,observablesCache:this.observablesCache,operation:null}),this.performDatabaseOperation(e,o,v=>X(this,null,function*(){if(v.dbRef&&!o?.skipRtdb){let u=this.commonDbUtilsService.formatData({feature:e,data:v.data,properties:o,offset:this.getOffset(),isRealtimeDb:!0});o?.rtdbTransaction?yield jh(v.dbRef,S=>{let k;return o?.rtdbTransactionCallback?k=o.rtdbTransactionCallback(S,u):k=this.commonDbUtilsService.rtdbDefaultTransactionCallback(S,u),JSON.parse(JSON.stringify(k))}):yield jM(v.dbRef,JSON.parse(JSON.stringify(u)))}try{if(v.firestoreRef&&v.data&&!o?.skipFirestore){let u=this.commonDbUtilsService.formatData({feature:e,data:v.data,properties:o,offset:this.getOffset()});typeof u=="object"&&(u=JSON.parse(JSON.stringify(u)));let{strippedData:S,originalData:k,eventType:A}=yield this.commonDbUtilsService.handleDataStripping({feature:e,data:u,actionType:s?.actionType,commentId:s?.targetAnnotationData?.commentId});if(e==="comment"){let P=null,U=St();this.coreActionsService.triggerAction(ut.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:U,methodName:Gr.UPDATE_DATA,source:"internal",payload:{strippedData:S,originalData:k,eventType:A,commentId:s?.targetAnnotationData?.commentId}}),S&&(P=yield this.commentAnnotationsResolverService.saveCommentAnnotation({commentAnnotation:S,eventType:A,commentId:s?.targetAnnotationData?.commentId},U)),k&&(P?.isSuccess||P===null)&&(yield this.commonDbUtilsService.handleCommentEncryption({data:k,firestorePath:v.firestorePath??"",extraData:s,metadata:o?.metadata}))}else if(e==="reaction"){let P=null,U=St();this.coreActionsService.triggerAction(ut.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:U,methodName:to.UPDATE_DATA,source:"internal",payload:{strippedData:S,originalData:k}}),S&&(P=yield this.reactionAnnotationsResolverService.saveReactionAnnotation(S,U)),k&&(P?.isSuccess||P===null)&&(yield this.commonDbUtilsService.handleReactionEncryption({data:k,firestorePath:v.firestorePath??""}))}else yield oY(v.firestoreRef,u,{merge:!0})}}catch(u){this.authService.getUser()&&this.loggingService.catch(`Error in updateDoc for ${e}`,u)}}),t,l,a))}catch(v){this.loggingService.catch(`Error in updateData for ${e}`,v)}})}deleteData(l){return X(this,arguments,function*({feature:e,properties:t,callback:o,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:t?.id,operation:{type:"removed",ids:[t?.id]}}),this.performDatabaseOperation(e,t,s=>X(this,null,function*(){s.dbRef&&(yield VM(s.dbRef));try{if(s.firestoreRef&&!t?.skipFirestore)if(e==="comment"){let d=null,v=St();this.coreActionsService.triggerAction(ut.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_DELETE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:v,methodName:Gr.DELETE_DATA,source:"internal",payload:{commentAnnotationId:t?.id??"",metadata:t?.metadata}}),d=yield this.commentAnnotationsResolverService.deleteCommentAnnotation(t?.id??"",t?.metadata,v),(d?.isSuccess||d===null)&&(yield this.commonDbUtilsService.handleCommentEncryption({firestorePath:s.firestorePath??"",eventType:"DELETE",metadata:t?.metadata}))}else if(e==="reaction"){let d=null,v=St();this.coreActionsService.triggerAction(ut.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_DELETE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:v,methodName:to.DELETE_DATA,source:"internal",payload:{reactionAnnotationId:t?.id??"",metadata:t?.metadata}}),d=yield this.reactionAnnotationsResolverService.deleteReactionAnnotation(t?.id??"",t?.metadata,v),(d?.isSuccess||d===null)&&(yield this.commonDbUtilsService.handleReactionEncryption({firestorePath:s.firestorePath??"",eventType:"DELETE"}))}else yield jve(s.firestoreRef)}catch(d){this.authService.getUser()&&this.loggingService.catch(`Error in deleteData for ${e}`,d)}}),void 0,a,o)}catch(s){this.loggingService.catch(`Error in deleteData for ${e}`,s)}})}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=St()),e||"noDocumentId"}catch(e){return this.loggingService.catch("Error in generateFirestoreDocumentId:",e),St()||"noDocumentId"}}queryData(o){return X(this,arguments,function*({feature:e,properties:t}){try{let a=this.shouldUseFirestore();return!e||!t?(this.loggingService.warn("[WB] Missing required parameters in queryData"),[]):a?yield this.handleFirestoreQuery(e,t):yield this.handleRtdbQuery(e,t)}catch(a){return this.loggingService.catch(`Error in queryData for ${e}`,a),[]}})}handleFirestoreQuery(e,t){return X(this,null,function*(){try{if(!this.firestore)return this.loggingService.warn("[WB] Firestore not initialized"),[];let o=t?.useCollectionGroup?this.commonDbUtilsService.getFirestoreCollectionGroupPath(e):this.commonDbUtilsService.getFirestorePath({feature:e,properties:t,documentPaths:this.docService.getDocumentPaths(),apiKey:t.apiKey??this.configService.getApiKey()});if(!o)return this.loggingService.warn(`[WB] No firestore path found for ${e}`),[];try{let a=YE(this.firestore,o);t?.useCollectionGroup&&(a=nY(this.firestore,o));let l=t?.firestoreQuery??[],s=rY(a,...l);if(!this.authService.getUser()&&!t?.skipUserCheck)return[];if(t?.getCount)try{let d=yield $ve(s).catch(v=>(this.authService.getUser()&&this.loggingService.catch(`Error in getCountFromServer for ${e}`,v),null));return d?d.data().count:0}catch(d){return this.authService.getUser()&&this.loggingService.catch(`Error in getCountFromServer for ${e}`,d),0}else try{let d=yield zve(s).catch(u=>(this.authService.getUser()&&this.loggingService.catch(`Error in getDocs for ${e}`,u),null));if(!d)return[];let v=d.docs.map(u=>u.data());try{return yield this.commonDbUtilsService.modifyData({feature:e,data:v})}catch(u){return this.loggingService.catch(`Error in modifyData for ${e}`,u),v}}catch(d){return this.authService.getUser()&&this.loggingService.catch(`Error in getDocs for ${e}`,d),[]}}catch(a){return this.loggingService.catch(`Error in Firestore query for ${e}:`,a),[]}}catch(o){return this.loggingService.catch(`Error in Firestore query for ${e}:`,o),[]}})}handleRtdbQuery(e,t){return X(this,null,function*(){if(!this.db)return this.loggingService.warn("[WB] Realtime Database not initialized"),[];let o=this.commonDbUtilsService.getDocumentPath({feature:e,properties:t,defaultDocumentPaths:this.docService.getDocumentPaths(),apiKey:t.apiKey??this.configService.getApiKey()});if(!o)return this.loggingService.warn(`[WB] No database path found for ${e}`),[];try{let a=Li(this.db,o),l=t?.rtdbQuery??[],s=OH(a,...l);if(!this.authService.getUser()&&!t?.skipUserCheck)return[];let d=yield wH(s).catch(u=>(this.authService.getUser()&&this.loggingService.catch(`Error in get for ${e}`,u),null));if(!d)return[];let v=d.val();return v?t?.skipObjectValues?v:Object.values(v??{}):[]}catch(a){return this.loggingService.catch(`Error in RTDB query for ${e}:`,a),[]}})}getData(o){return X(this,arguments,function*({feature:e,properties:t}){try{let a=this.shouldUseFirestore();if(t?.skipFirestore&&(a=!1),!e||!t)return this.loggingService.warn("[WB] Missing required parameters in getData"),{};if(a&&this.firestore){let l=this.commonDbUtilsService.getFirestorePath({feature:e,properties:t,documentPaths:this.docService.getDocumentPaths(),apiKey:t.apiKey??this.configService.getApiKey()});if(!l)return this.loggingService.warn(`[WB] No firestore path found for ${e}`),{};try{if(!this.authService.getUser())return this.loggingService.catch("User not set. [source: getData]",void 0,void 0,!0),{};let s=yield Hve(X1(this.firestore,l)).catch(v=>(this.authService.getUser()&&this.loggingService.catch(`Error in getDoc for ${e}`,v),this.commonDbUtilsService.getErrorForGetRequests({feature:e,error:v})));if(s){if(s?.errorCode)return s}else return this.loggingService.warn(`[WB] No document found at ${l}`),{};let d=s.data();return t?.field?d?.[t.field]??{}:d??{}}catch(s){return this.loggingService.catch(`Error fetching Firestore data for ${e}:`,s),{}}}if(this.db){let l=this.commonDbUtilsService.getDocumentPath({feature:e,properties:t,defaultDocumentPaths:this.docService.getDocumentPaths(),apiKey:t.apiKey??this.configService.getApiKey()});if(!l)return this.loggingService.warn(`[WB] No database path found for ${e}`),{};try{if(!this.authService.getUser())return{};let s=yield wH(Li(this.db,l)).catch(v=>(this.authService.getUser()&&this.loggingService.catch(`Error in get for ${e}`,v),this.commonDbUtilsService.getErrorForGetRequests({feature:e,error:v})));if(s){if(s?.errorCode)return s}else return this.loggingService.warn(`[WB] No data found at ${l}`),{};let d=s.val();return t?.field?d?.[t.field]??{}:d??{}}catch(s){return this.loggingService.catch(`Error fetching RTDB data for ${e}:`,s),{}}}return this.loggingService.warn("[WB] No database connection available"),{}}catch(a){return this.loggingService.catch("Unexpected error in getData:",a),{}}})}dbListener({feature:e,properties:t}){let o=this.shouldUseFirestore();t?.skipFirestore&&(o=!1);let a=`${e}-${JSON.stringify(t)}`;return un([this.databaseService.getDb(),this.firestoreService.getFirestore(),this.authService.getUser$().pipe(je(l=>!!l))]).pipe(je(([l,s])=>l?o&&!s?(this.loggingService.warn(`[WB] Firestore requested but not available for ${e}`),!1):!0:(this.loggingService.warn(`[WB] No database found for ${e}`),!1)),fe(([l,s])=>{try{if(o&&s){if(!!!this.observablesCache[a]){this.observablesCache[a]={subject:new be({}),count:0};let u=this.handleFirestoreListener(e,t,s).subscribe(S=>{this.observablesCache[a]?.subject?.next(S)},S=>this.observablesCache[a]?.subject?.error(S));this.firestoreSubscriptions[a]=u}return new Gt(v=>{let u=this.observablesCache[a]?.subject?.subscribe(S=>v.next(S),S=>v.error(S),()=>v.complete());return this.observablesCache[a].count+=1,()=>{u?.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(l){if(!!!this.observablesCache[a]){this.observablesCache[a]={subject:new be({}),count:0};let u=this.handleRealtimeDbListener(e,t,l).subscribe(S=>{this.observablesCache[a]?.subject?.next(S)},S=>this.observablesCache[a]?.subject?.error(S));this.rtdbSubscriptions[a]=u}return new Gt(v=>{let u=this.observablesCache[a]?.subject?.subscribe(S=>v.next(S),S=>v.error(S),()=>v.complete());return this.observablesCache[a].count+=1,()=>{u?.unsubscribe(),this.observablesCache[a]&&(this.observablesCache[a].count-=1,this.observablesCache[a].count<=0&&(this.rtdbSubscriptions[a]?.unsubscribe(),delete this.rtdbSubscriptions?.[a],this.observablesCache[a]?.subject?.complete(),delete this.observablesCache?.[a]))}})}return ce({})}catch(d){return this.loggingService.catch(`Error setting up listener for ${e}:`,d),ce({})}}),Bp(()=>{this.loggingService.log(`[WB] Cleaning up listener for ${e} and key ${a}`)}))}handleFirestoreListener(e,t,o){let a=t?.useCollectionGroup?this.commonDbUtilsService.getFirestoreCollectionGroupPath(e):this.commonDbUtilsService.getFirestorePath({feature:e,properties:t,documentPaths:this.docService.getDocumentPaths(),apiKey:t.apiKey??this.configService.getApiKey()}),l=`${e}-${JSON.stringify(t)}`;return a?new Gt(s=>{let d=t.isCollection?this.setupCollectionListener(o,a,e,s,t):this.setupDocumentListener(o,a,e,s,t);return()=>{s.complete(),s.unsubscribe(),d(),this.observablesCache[l]?.subject?.complete(),this.observablesCache[l]?.subject?.unsubscribe(),delete this.observablesCache[l]}}).pipe(fe(s=>this.commonDbUtilsService.mergeUsersWithData$({feature:e,data:s})),fe(s=>["allComments","allUserNotifications"].includes(e)?this.commonDbUtilsService.mergeCommentAnnotationsWithData$({data:s,feature:e}):ce(s)),fe(s=>["allReactions"].includes(e)?this.commonDbUtilsService.mergeReactionAnnotationsWithData$({data:s,feature:e}):ce(s)),xt(Qt)):(this.loggingService.warn(`[WB] No firestore path found for ${e} and key ${l}`),ce({}))}setupCollectionListener(e,t,o,a,l){let s=`${o}-${JSON.stringify(l)}`,d=YE(e,t);if(l?.useCollectionGroup&&(d=nY(e,t)),l?.useQuery&&l?.firestoreQuery){let S=l?.firestoreQuery??[];d=rY(d,...S)}let v=!0,u=[];return o==="allComments"&&this.loggingService.logContext("[CONTEXT] setupCollectionListener called with path:",t,"feature:",o,"properties:",JSON.stringify(l??"nil")),iY(d,S=>{try{let k=JSON.parse(JSON.stringify(this.observablesCache[s]?.subject?.getValue()?.data??{})),A=null,P=!1;S?.docChanges()?.length?S.docChanges().forEach(U=>{["allComments","allReactions"].includes(o)&&!v&&U.type!=="removed"&&u.push(U.doc.id),this.commonDbUtilsService.isDataAlreadyProcessedInLocalCache({feature:o,change:U,cache:this.observablesCache[s]?.subject?.getValue()?.data??{}})||(P=!0,Object.assign(k,this.handleCollectionChange(U,k)),U.type==="removed"&&(A||(A={type:U.type,ids:[]}),A.ids.push(U.doc.id)))}):P=!0,P&&(["allComments","allReactions"].includes(o)&&u?.length&&(this.commonDbUtilsService.resolveAnnotations({data:u,feature:o}),u=[]),this.commonDbUtilsService.modifyAndSetData({feature:o,data:k,subscriber:a,operation:A})),v=!1}catch(k){this.loggingService.logContext(`[ERROR] Firestore listener error for feature ${o}:`,k),this.loggingService.logContext(`[ERROR] Firestore listener error for properties ${JSON.stringify(l??"nil")}:`),this.loggingService.logContext(`[ERROR] Firestore listener error for user ${JSON.stringify(this.authService.getUser()??"nil")}:`),this.handleListenerError(k,o,a)}},S=>{this.loggingService.logContext(`[ERROR] Firestore listener error for feature ${o}:`,S),this.loggingService.logContext(`[ERROR] Firestore listener error for properties ${JSON.stringify(l??"nil")}:`),this.loggingService.logContext(`[ERROR] Firestore listener error for user ${JSON.stringify(this.authService.getUser()??"nil")}:`),this.handleListenerError(S,o,a)})}handleCollectionChange(e,t){switch(e.type){case"added":case"modified":t[e.doc.id]=e.doc.data();break;case"removed":delete t?.[e.doc.id];break}return t}setupDocumentListener(e,t,o,a,l){let s=X1(e,t);return iY(s,d=>{try{let v=d.data()||{};l?.field&&(v=v?.[l?.field]??{}),this.commonDbUtilsService.modifyAndSetData({feature:o,data:v,subscriber:a,operation:null})}catch(v){this.handleListenerError(v,o,a)}},d=>this.handleListenerError(d,o,a))}handleListenerError(e,t,o){this.loggingService.catch(`Firestore listener error for ${t}:`,e)}handleRealtimeDbListener(e,t,o){let a=this.commonDbUtilsService.getDocumentPath({feature:e,properties:t,defaultDocumentPaths:this.docService.getDocumentPaths(),apiKey:t.apiKey??this.configService.getApiKey()});if(!a)return this.loggingService.warn(`[WB] No database path found for ${e}`),ce({});let l=Li(o,a);if(t?.useQuery&&t?.rtdbQuery){let s=t?.rtdbQuery??[];l=OH(l,...s)}return this.objectValFromChildEvents(l,e).pipe(Hn(s=>(this.loggingService.catch(`RTDB listener error for ${e}:`,s),ce({}))),ge(s=>(s===null&&(s={}),s&&typeof s=="object"?Object.entries(s??{}).reduce((v,[u,S])=>(v[u]=this.commonDbUtilsService.addMetadata(S,t),v),{}):this.commonDbUtilsService.addMetadata(s,t))),fe(s=>this.commonDbUtilsService.modifyData({feature:e,data:s})),fe(s=>this.usersService.getUserById$().pipe(ge(()=>({data:this.commonDbUtilsService.mergeUsersWithData({feature:e,data:s}),operation:null})))))}objectValFromChildEvents(e,t){return new Gt(o=>{let a={},l=!1,s=null,d=U=>{try{this.loggingService.catch(`Realtime DB listener error for ${t}:`,U),o.error(U)}catch{}},v=U=>{try{if(!Ei(U,s)){let W=JSON.parse(JSON.stringify(U));s=W,o.next(W)}}catch{}},u=U=>{try{U.key&&(a[U.key]=U.val(),l&&v(b({},a)))}catch{}},S=U=>{try{U.key&&(a[U.key]=U.val(),l&&v(b({},a)))}catch{}},k=U=>{try{U.key&&(delete a[U.key],l&&v(b({},a)))}catch{}},A=U=>{try{if(!l){let W=a&&typeof a=="object"?JSON.parse(JSON.stringify(a)):{};s=W,o.next(W),l=!0}}catch{}};tle(e,u,d),nle(e,S,d),ile(e,k,d);let P=Zv(e,A,d,{onlyOnce:!0});return()=>{try{P&&typeof P=="function"&&P(),BM(e,"child_added",u),BM(e,"child_changed",S),BM(e,"child_removed",k)}catch{}}})}};r.\u0275fac=function(t){return new(t||r)(J(Ge),J(Mm),J(pi),J(x),J(yue),J(On),J(Lt),J(lt),J(Dn),J(vs),J(Pm))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var ln=(()=>{let r=class r{constructor(e,t,o,a,l,s,d,v,u){this.analyticsService=e,this.authService=t,this.configService=o,this.coreActionsService=a,this.databaseService=l,this.docService=s,this.loggingService=d,this.commonDbService=v,this.usersService=u,this.db=Fl(),this.internalUserContacts$=new be([]),this.userGlobalContact$=new be(!1),this.userGroupContact$=new be(null),this.users$=new be([]),this.userPersonalContacts=[],this.userGroupContacts=[],this.userGlobalContacts=[],this.users=[],this.documentPaths=null,this.userAccessFields$=new be({}),this.userOrganizationContacts$=new be([]),this.userFolderContacts$=new be([]),this.userDocumentContacts$=new be([]),this.userOrganizationGroups$=new be([]),this.onContactSelectedSubject$=new nt,this.documentAccessType=null,this.atHereEnabled$=new be(!1),this.atHereLabel$=new be("here"),this.atHereDescription$=new be(null),this.contactListScopeForOrganizationUsers$=new be([ar.ALL]),this.customUserContacts$=new be(null),this.customUserContactsConfig$=new be({merge:!1}),this.currentOrganizationUserIAM$=new be(null),this.userContacts$=new be([]),this.userSnippylyIdContacts$=new be(null),this.usersByOrganizationId$=new be({}),this.temporaryUserIds$=new be([]),this.usersByOrganizationIdAndDocumentId$=new be({}),this.usersByOrganizationIdAndFolderId$=new be({}),this.userById$=new be({}),this.searchUsersSubject$=new nt,this.searchUsersDebounceTime=300,this.pendingSearchPromises=new Map,this.authService.setContactService(this),this.usersService.setContactService(this),this.authService.getUser$().pipe(fe(S=>this.docService.getDocumentPaths$().pipe(rn(k=>{this.documentPaths=k}),ge(()=>S)))).subscribe(S=>X(this,null,function*(){if(this.user=S,S&&this.documentPaths)if(!S?.organizationId)this.getLoggedInUsers$().subscribe(),this.getUserContactsFromDb$(),yield this.migrateLoggedInUserFromEmailToUserIdPath(S),this.setLoggedInUser(S),yield this.moveGlobalContactUserFromEmailToUserIdPath(S),this.updateUserInGlobalContactsIfAvailable(S),S?.groupId&&(yield this.migrateGroupContactsFromEmailToUserIdPath(S?.groupId)),this.checkToSetLoggedInUserInGroupContacts();else{let k=this.userPermissionService?.getCurrentUserPermissions(),A=this.documentPaths.folderId,P=!0;A&&k?.[S?.userId]?.folders?.[A]?.errorCode===qr.PERMISSION_DENIED&&(P=!1),this.getOrganizationContactsFromDb$(),P&&this.getFolderContactsFromDb$(),this.getDocumentContactsFromDb$(),this.getOrganizationGroupsFromDb$(),this.getTemporaryUsers()}else 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}),S=>{this.loggingService.catch("Error in ContactService constructor getUser$: ",S)}),this.databaseService.getDb().pipe(je(S=>!!S),st(1)).subscribe(S=>{S&&(this.db=S)},S=>{this.loggingService.catch("Error in ContactService constructor getDb: ",S)}),this.getOrganizationGroups$().subscribe(S=>{this.authService.setOrganizationUserGroups(S)}),un([this.getInternalUserContacts$(),this.getCustomUserContacts$(),this.getCustomUserContactsConfig$()]).subscribe(([S,k,A])=>{k?A?.merge?this.userContacts$.next([...S||[],...k||[]]):this.userContacts$.next(k||[]):this.userContacts$.next(S||[])}),this.getUserContacts$().subscribe(S=>{try{S?.forEach(k=>{let A=k?.userSnippylyId||ym(this.configService.getApiKey(),k.userId);A&&this.userSnippylyIdContacts$.next(E(b({},this.userSnippylyIdContacts$.value),{[A]:k}))})}catch{}})}setCommentService(e){try{this.commentService=e}catch(t){this.loggingService.catch("Error in ContactService setCommentService: ",t)}}setUserPermissionService(e){try{this.userPermissionService=e}catch(t){this.loggingService.catch("Error in ContactService setUserPermissionService: ",t)}}clearCache(){this.loggingService.log("%c[WB] Calling FUNCTION: clearCache in ContactService","color: green;");try{this.documentPaths=null,this.usersByOrganizationId$.next({}),this.temporaryUserIds$.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=[],this.currentOrganizationUserIAM$.next(null)}catch(e){this.loggingService.catch("Error in ContactService clearCache: ",e)}}setDocumentAccessType(e){try{this.documentAccessType=e}catch(t){this.loggingService.catch("Error in ContactService setDocumentAccessType: ",t)}}checkIfUserGlobalContact(e){return X(this,null,function*(){try{if(e?.userId&&this.documentPaths?.globalContacts){let t=yield this.commonDbService?.getData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Et(e?.userId),skipFirestore:!0}});if(Object.keys(t??{}).length>0)return!0}if(e?.email&&this.documentPaths?.globalContacts){let t=yield this.commonDbService?.getData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Et(e?.email),skipFirestore:!0}});if(Object.keys(t??{}).length>0)return!0}return!1}catch(t){return this.loggingService.catch("Error in ContactService isUserGlobalContact: ",t),!1}})}setLoggedInUser(e){try{e?.userId&&this.documentPaths?.logins&&(this.commonDbService.updateData({feature:"logins",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Et(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(E(b({},e),{contacts:void 0})))}),this.setLoggedInUserPrivateContacts(e,e?.contacts))}catch(t){this.loggingService.catch("Error in ContactService setLoggedInUser: ",t)}}migrateLoggedInUserFromEmailToUserIdPath(e){return X(this,null,function*(){try{if(e?.email&&this.documentPaths?.logins){let t=yield this.commonDbService?.getData({feature:"logins",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Et(e?.email),skipFirestore:!0}});if(Object.keys(t??{}).length>0){let o=t;if(o){if(o?.contacts){let a={};Object.keys(o?.contacts??{})?.forEach(l=>{let s=o.contacts[l];if(s?.userId){let d=Et(s?.userId);a[d]=s}}),o.contacts=a}yield this.commonDbService.updateData({feature:"logins",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Et(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(o))}),yield this.commonDbService.deleteData({feature:"logins",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Et(e?.email),skipFirestore:!0}})}}}}catch(t){this.loggingService.catch("Error in ContactService migrateLoggedInUserFromEmailToUserIdPath: ",t)}})}addGlobalContact(e){try{e?.userId&&this.documentPaths?.globalContacts&&this.commonDbService.updateData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Et(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(e))})}catch(t){this.loggingService.catch("Error in ContactService addGlobalContact: ",t)}}getUserAccessFields(){return JSON.parse(JSON.stringify(this.userAccessFields$.value))}getUserAccessFieldsByUserId(e){return this.getUserAccessFields()?.[e]}setUserAccessFields(e){try{let t=this.getUserAccessFields();e.forEach(a=>{t[a.user.userId]=a.accessFields||[]});let o=this.authService.getUser()?.userId;if(o&&t?.[o]?.length){let a=this.userPermissionService?.getCurrentUserPermissions();a&&(a[o]||(a[o]={}),a[o].context={accessFields:t[o]},this.userPermissionService?.setCurrentUserPermissions(a))}this.userAccessFields$.next(JSON.parse(JSON.stringify(t)))}catch(t){this.loggingService.catch("Error in ContactService setUserAccessFields: ",t)}}updateUserInGlobalContactsIfAvailable(e){return X(this,null,function*(){try{if(e?.userId&&this.documentPaths?.globalContacts&&(yield this.checkIfUserGlobalContact(e))){let o=new Vo;o.userId=e?.userId,o.userSnippylyId=e?.userSnippylyId,o.email=e?.email,o.name=e?.name,o.photoUrl=e?.photoUrl,this.commonDbService.updateData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Et(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(o))})}}catch(t){this.loggingService.catch("Error in ContactService updateUserInGlobalContactsIfAvailable: ",t)}})}moveGlobalContactUserFromEmailToUserIdPath(e){return X(this,null,function*(){try{if(e?.email&&e?.userId&&this.documentPaths?.globalContacts){let t=yield this.commonDbService?.getData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Et(e?.email),skipFirestore:!0}});if(Object.keys(t??{}).length>0){let o=t;o&&(yield this.commonDbService.updateData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Et(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(o))}),yield this.commonDbService.deleteData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Et(e?.email),skipFirestore:!0}}))}}}catch(t){this.loggingService.catch("Error in ContactService removeUserFromGlobalContactsByEmail: ",t)}})}setLoggedInUserPrivateContacts(e,t){try{if(e?.userId&&this.documentPaths?.logins){let o,a=t?.filter(s=>s?.visibility!=="group"),l=!1;this.authService.getUserOptions()&&(l=!!this.authService.getUserOptions()?.replaceContacts||!!this.authService.getUserOptions()?.replacePrivateContacts),a?.length?(o={},a?.forEach(s=>{if(s?.userId){let d=Et(s?.userId);o[d]=s}}),l?this.commonDbService.setData({feature:"allLoginContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Et(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(o))}):this.commonDbService.updateData({feature:"allLoginContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Et(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(o))})):l&&this.commonDbService.deleteData({feature:"allLoginContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Et(e?.userId),skipFirestore:!0}})}}catch(o){this.loggingService.catch("Error in ContactService setLoggedInUserPrivateContacts: ",o)}}migrateGroupContactsFromEmailToUserIdPath(e){return X(this,null,function*(){try{if(this.documentPaths?.groupContacts&&e){let t=yield this.commonDbService?.getData({feature:"groupContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",groupId:e,skipFirestore:!0}});t&&Object.keys(t??{}).forEach(o=>X(this,null,function*(){let a=t[o];a?.email&&a?.userId&&Et(a?.email)===o&&(yield this.commonDbService.deleteData({feature:"groupContactsUser",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",groupId:e,userId:o,skipFirestore:!0}}),yield this.commonDbService.updateData({feature:"groupContactsUser",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",groupId:e,userId:Et(a?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(a))}))}))}}catch(t){this.loggingService.catch("Error in ContactService migrateGroupContacts: ",t)}})}checkToSetLoggedInUserInGroupContacts(){return X(this,null,function*(){try{this.user?.groupId&&this.user?.userId&&((yield this.checkIfUserGlobalContact(this.user))||this.docService.getDocumentIam$().pipe(st(1)).subscribe(t=>X(this,null,function*(){if(this.user?.groupId&&this.user?.userId){let o=!1,a=this.docService.getDocumentAccessType(t);if(!a||a===Ui.PUBLIC)o=!0;else if(a===Ui.RESTRICTED){let l=Et(this.user?.userId);if(t?.users?.[l]&&(o=!0),this.user?.email){let s=Et(this.user?.email);t?.users?.[s]&&(o=!0)}}if(o){let l=new xd;l.email=this.user.email,l.visibility="group",l.name=this.user.name,l.photoUrl=this.user.photoUrl,l.userId=this.user.userId,(this.authService.getUserOptions()?.replaceContacts||this.authService.getUserOptions()?.replaceGroupContacts)&&(yield this.removeGroupContacts(this.user?.groupId)),this.setLoggedInUserGroupContacts(this.user?.groupId,[l]),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,t){try{let o=t?.filter(a=>a?.visibility==="group");o?.length&&o.forEach(a=>X(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:Et(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:Et(a?.email),skipFirestore:!0}}))}}))}catch(o){this.loggingService.catch("Error in ContactService setLoggedInUserGroupContacts: ",o)}}removeGroupContacts(e){return X(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(t){this.loggingService.catch("Error in ContactService removeGroupContacts: ",t)}})}mergeUserContacts(){try{let e=[];this.userPersonalContacts&&e.push(...this.userPersonalContacts),this.userGroupContacts&&e.push(...this.userGroupContacts),this.userGlobalContacts&&e.push(...this.userGlobalContacts);let t={};e.forEach(o=>{o?.userId?(!o?.email||!t[o.email])&&(t[o.userId]=o):o?.email&&(!o?.userId||!t[o.userId])&&(t[o.email]=o)}),e=Object.values(t??{}),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:t,documentId:o,veltFolderId:a}=e||{};return t&&o?un([this.usersByOrganizationId$,this.usersByOrganizationIdAndFolderId$,this.usersByOrganizationIdAndDocumentId$,this.userById$,this.customUserContacts$,this.customUserContactsConfig$,this.getContactListScopeForOrganizationUsers$(),this.temporaryUserIds$]).pipe(ge(([l,s,d,v,u,S,k,A])=>{let P={},U=!1;S&&!S?.merge&&(U=!0);let W=De=>k.some(Ie=>De.includes(Ie)),te=W([ar.ALL,ar.ORGANIZATION])?Object.keys(l?.[t]||{}):[],ye=a?W([ar.ALL,ar.FOLDER])?Object.keys(s?.[t]?.[a]||{}):[]:[],me=W([ar.ALL,ar.DOCUMENT])?Object.keys(d?.[t]?.[o]||{}):[];if([...te,...ye||[],...me,...A].forEach(De=>{let Ie=v?.[De];Ie&&(P[De]=Ie)}),u){let{merge:De,options:Ie}=S||{},{organizationId:xe,documentId:Re,folderId:Le}=Ie||{},Ue=Le?Mi(Le):void 0;(!xe||xe===t)&&(!Re||Re===o)&&(!Ue||Ue===a)&&(De||(P={}),u.forEach(He=>{He?.userId&&(P[He.userId]=He)}))}return Object.values(P??{})})):this.userContacts$.asObservable().pipe(ge(l=>l))}catch(t){return this.loggingService.catch("Error in ContactService getUserContacts$ metadata: ",t),ce([])}}getUserContactsBySnippylyId$(){return this.userSnippylyIdContacts$.asObservable()}getUserBySnippylyId(e){return this.userSnippylyIdContacts$.value?.[e]}getAtHereLabel(){return this.atHereLabel$.asObservable()}getAtHereDescription(){return this.atHereDescription$.asObservable()}getUserContactsFromDb$(){this.getUserContactSubscription||(this.getUserContactSubscription=this.authService.getUser$().pipe(je(e=>!!e),fe(e=>this.docService.getDocumentPaths$().pipe(je(t=>!!t),rn(t=>{this.documentPaths=t}),ge(()=>e))),fe(e=>{if(this.userGroupContacts=[],this.userPersonalContacts=[],!e)return ce();if(!this.documentPaths)return ce();let t=[];return t.push(this.commonDbService.dbListener({feature:"allGlobalContacts",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}}).pipe(ge(o=>o?.data),rn(o=>{o?(this.userGlobalContacts=Object.values(o??{}),this.userGlobalContacts?.find(a=>a.userId===this.user?.userId)?this.userGlobalContact$.next(!0):this.userGlobalContact$.next(!1)):(this.userGlobalContacts=[],this.userGlobalContact$.next(!1))}))),t.push(this.commonDbService.dbListener({feature:"groupContacts",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0,groupId:e?.groupId}}).pipe(ge(o=>o?.data),rn(o=>{o?(this.userGroupContacts=Object.values(o??{}),this.userGroupContacts?.find(a=>a?.userId===this.user?.userId)?this.userGroupContact$.next(!0):this.userGroupContact$.next(!1)):(this.userGroupContacts=[],this.userGroupContact$.next(!1))}))),t.push(this.commonDbService.dbListener({feature:"allLoginContacts",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0,userId:Et(e?.userId)}}).pipe(ge(o=>o?.data),rn(o=>{o?this.userPersonalContacts=Object.values(o??{}):this.userPersonalContacts=[]}))),Sr(...t).pipe(Ar(this.authService.getUser$().pipe(je(o=>!o))))})).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(t){this.loggingService.catch("Error in ContactService addUserContact: ",t)}}isUserGlobalContact$(){return this.userGlobalContact$.asObservable().pipe(xt(Qt))}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(fe(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(ge(t=>t?.data),rn(t=>{t?this.users=Object.values(t??{}):this.users=[]})):(this.users=[],ce()):ce():ce())).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(fe(e=>e?.organizationId?this.userById$.pipe(ge(t=>{let o={};return Object.values(t||{}).forEach(a=>{a?.userSnippylyId&&(o[a?.userSnippylyId]=a)}),o})):this.users$.pipe(ge(t=>{let o={};return t.forEach(a=>{o[a.userSnippylyId]=a}),o}))))}getUserByEmail$(e){return this.users$.pipe(ge(t=>t.find(o=>o.email===e)))}getUserByEmail(e){return this.users?.find(t=>t.email===e)}getContactByEmail(e){return this.getInternalUserContacts().find(t=>t.email===e)}getUserByUserId$(e){return this.users$.pipe(ge(t=>t.find(o=>o.userId===e)))}getUserGroupContacts(){return this.userGroupContacts}getTemporaryUsers(){try{let e=this.authService.getUser();this.docService.getOrganizationConfig$().pipe(je(t=>!!t),ge(t=>t?.organizationId)).subscribe(t=>X(this,null,function*(){if(t&&e){let o=((yield this.commonDbService?.queryData({feature:"allPermissionsUsers",properties:{organizationId:t,useCollectionGroup:!1,isCollection:!0,firestoreQuery:[vt("expiresAt",">",new Date().getTime())]}}))??[]).filter(a=>a?.userId!==e?.userId);if(o?.length){let a=o.map(v=>v?.userId),l=St(),s=Gs.GET_TEMPORARY_USERS;this.coreActionsService.triggerAction(ut.USER_RESOLVER,{event:Y.Events.Resolver.USER_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:l,moduleName:s,methodName:eo.GET_TEMPORARY_USERS,source:"internal",payload:{userIds:a}});let d=yield this.usersService.resolveUsers({userIds:a,uniqueId:l,moduleName:s});if(d){let v={};Object.entries(d).forEach(([S,k])=>{v[S]=k}),this.userById$.next(b(b({},this.userById$.value),v));let u=new Set([...this.temporaryUserIds$.value,...Object.keys(v)]);this.temporaryUserIds$.next(Array.from(u))}}}}))}catch(e){this.loggingService.catch("Error in ContactService getTemporaryUsers: ",e)}}searchUsers(e){return X(this,null,function*(){try{if(!e||typeof e!="string"||!e.trim())return[];let t=e.trim();return this.searchUsersDebounced$||(this.searchUsersDebounced$=this.searchUsersSubject$.pipe(Zi(this.searchUsersDebounceTime),xt(),fe(o=>rr(this.performSearch(o)).pipe(ge(a=>({searchText:o,results:a})),Hn(a=>(this.loggingService.catch("Error in ContactService performSearch: ",a),ce({searchText:o,results:[]})))))),this.searchUsersDebounced$.subscribe({next:({searchText:o,results:a})=>{Array.from(this.pendingSearchPromises.keys()).forEach(d=>{if(d!==o){let v=this.pendingSearchPromises.get(d);v&&(v.forEach(({resolve:u})=>u([])),this.pendingSearchPromises.delete(d))}});let s=this.pendingSearchPromises.get(o);s&&(s.forEach(({resolve:d})=>d(a)),this.pendingSearchPromises.delete(o))},error:o=>{this.pendingSearchPromises.forEach(a=>{a.forEach(({reject:l})=>l(o))}),this.pendingSearchPromises.clear()}})),new Promise((o,a)=>{this.pendingSearchPromises.has(t)||this.pendingSearchPromises.set(t,[]),this.pendingSearchPromises.get(t).push({resolve:o,reject:a}),this.searchUsersSubject$.next(t)})}catch(t){return this.loggingService.catch("Error in ContactService searchUsers: ",t),[]}})}performSearch(e){return X(this,null,function*(){try{let t=this.docService.getOrganizationConfig()?.organizationId;if(!t)return[];let o=this.documentPaths?.veltFolderId,a=this.docService.getDocumentIds().map(W=>W?.documentId),l=e.toLowerCase().trim(),s=l+"\uF8FF",d=[],v=a?.filter(W=>!!W)||[],u=v.length>0,S=!!o;if(u){let W=[];for(let ye=0;ye<v.length;ye+=20)W.push(v.slice(ye,ye+20));W.forEach(ye=>{let me=[vt("documentIds","array-contains-any",ye),vt("viewerDocumentIds","array-contains-any",ye)],ke=[vt("organizationIds","array-contains-any",[t]),vt("viewerOrganizationIds","array-contains-any",[t]),...me];S&&ke.push(vt("folderIds","array-contains-any",[o]),vt("viewerFolderIds","array-contains-any",[o])),d.push(this.commonDbService.queryData({feature:"allDocumentUsers",properties:{organizationId:t,isCollection:!0,useCollectionGroup:!1,useQuery:!0,firestoreQuery:[yi(Cf(...ke),vt("user.name_lowercase",">=",l),vt("user.name_lowercase","<",s)),Dm(10)]}}).catch(()=>[])),d.push(this.commonDbService.queryData({feature:"allDocumentUsers",properties:{organizationId:t,isCollection:!0,useCollectionGroup:!1,useQuery:!0,firestoreQuery:[yi(Cf(...ke),vt("user.email_lowercase",">=",l),vt("user.email_lowercase","<",s)),Dm(10)]}}).catch(()=>[]))})}let k=yield Promise.all(d),A=[];k.forEach(W=>{W&&Array.isArray(W)?W.forEach(te=>{te&&te.user&&te.user.userId&&A.push(te)}):W&&typeof W=="object"&&Object.values(W).forEach(ye=>{ye&&ye.user&&ye.user.userId&&A.push(ye)})});let P=new Map;A.forEach(W=>{let te=W.user?.userId;te&&!P.has(te)&&P.set(te,W)});let U=Array.from(P.values());return this.setResolvedUsers(U,!0),U}catch(t){return this.loggingService.catch("Error in ContactService performSearch: ",t),[]}})}setResolvedUsers(e,t=!1){try{if(e?.length){let o=[],a=[],l=[],s=this.docService.getOrganizationConfig()?.organizationId,d=this.documentPaths?.veltFolderId,v=this.docService.getDocumentIds().map(k=>k?.documentId);e.forEach(k=>{this.userById$.value[k?.user?.userId]||(s&&k?.organizationIds?.includes(s)&&!o.find(A=>A?.user?.userId===k?.user?.userId)&&o.push(k),d&&k?.folderIds?.includes(d)&&!a.find(A=>A?.user?.userId===k?.user?.userId)&&a.push(k),v?.some(A=>k?.documentIds?.includes(A))&&!l.find(A=>A?.user?.userId===k?.user?.userId)&&l.push(k))}),o?.length&&this.setUserOrganizationContacts(o,s,t),a?.length&&this.setUserFolderContacts(a,t),l?.length&&this.setUserDocumentContacts(l,t);let S=[...o,...a,...l].filter((k,A,P)=>A===P.findIndex(U=>U.user.userId===k.user.userId));S?.length&&(this.setUserAccessFields(S),this.mergeOrganizationAndDocumentContacts())}}catch(o){this.loggingService.catch("Error in ContactService setResolvedUsers: ",o)}}getOrganizationContactsFromDb$(){try{this.getOrganizationContactsSubscription||(this.getOrganizationContactsSubscription=this.authService.getUser$().pipe(fe(e=>e?.organizationId?ce(e).pipe(fe(t=>this.docService.getOrganizationConfig$().pipe(je(o=>!!o),ge(()=>t))),fe(t=>this.usersService.getResolveOrganizationUsers$().pipe(je(o=>o),ge(()=>t))),fe(t=>{let o=this.docService.getOrganizationConfig()?.organizationId;return this.setUserOrganizationContacts([],o),t?o?this.commonDbService.dbListener({feature:"allOrganizationUsers",properties:{organizationId:o,isCollection:!0,useQuery:!0,firestoreQuery:[yi(Cf(vt("organizationIds","array-contains-any",[o]),vt("viewerOrganizationIds","array-contains-any",[o]))),vr("id"),...this.commentService?.getPaginatedContactList()?[Dm(10)]:[]]}}).pipe(ge(a=>a?.data),fe(a=>this.commentService?.getPaginatedContactList()&&!Object.values(a??{}).find(l=>l?.user?.userId===this.authService.getUser()?.userId)?rr(this.commonDbService.queryData({feature:"allOrganizationUsers",properties:{organizationId:o,isCollection:!0,useQuery:!0,firestoreQuery:[yi(Cf(vt("organizationIds","array-contains-any",[o]),vt("viewerOrganizationIds","array-contains-any",[o])),vt("user.userId","==",this.authService.getUser()?.userId))]}})).pipe(ge(l=>{if(l&&l.length>0){let s=l[0],d=s?.user?.userId||s?.id;if(d&&a){let v=Et(d);return E(b({},a),{[v]:s})}}return a})):ce(a)),ge(a=>{if(a){typeof a=="object"&&(a?.undefined&&delete a.undefined,a?.null&&delete a.null);let l=Object.values(a??{});this.setUserAccessFields(l),this.setUserOrganizationContacts(l,o)}else this.setUserOrganizationContacts([],o)})):ce():ce()}),fe(()=>this.getContactListScopeForOrganizationUsers$())):(this.setUserOrganizationContacts([]),ce()))).subscribe(()=>{this.mergeOrganizationAndDocumentContacts()},e=>{this.loggingService.catch("Error in ContactService getOrganizationContactsFromDb$ subscription: ",e)}))}catch{}}getFolderContactsFromDb$(){try{this.getFolderContactsSubscription||(this.getFolderContactsSubscription=this.authService.getUser$().pipe(fe(e=>e?ce(e).pipe(fe(t=>this.docService.getOrganizationConfig$().pipe(je(o=>!!o),ge(()=>t))),fe(t=>this.usersService.getResolveFolderUsers$().pipe(je(o=>o),ge(()=>t))),fe(t=>{let o=this.docService.getOrganizationConfig()?.organizationId;if(this.setUserFolderContacts([]),!t)return ce();if(!this.commonDbService.shouldUseFirestore())return ce();if(!this.documentPaths?.veltFolderId)return ce();let a=ce([]);return a=this.commonDbService.dbListener({feature:"allFolderUsers",properties:{organizationId:o,folderId:this.documentPaths?.veltFolderId,isCollection:!0,useQuery:!0,firestoreQuery:[yi(Cf(vt("folderIds","array-contains-any",[this.documentPaths?.veltFolderId]),vt("viewerFolderIds","array-contains-any",[this.documentPaths?.veltFolderId]))),vr("id"),...this.commentService?.getPaginatedContactList()?[Dm(10)]:[]]}}).pipe(ge(l=>l?.data)),a.pipe(ge(l=>{if(l){typeof l=="object"&&(l?.undefined&&delete l.undefined,l?.null&&delete l.null);let s=Object.values(l??{});this.setUserAccessFields(s),this.setUserFolderContacts(s)}else this.setUserFolderContacts([])}))}),fe(()=>this.getContactListScopeForOrganizationUsers$())):(this.setUserFolderContacts([]),ce()))).subscribe(()=>{this.mergeOrganizationAndDocumentContacts()},e=>{this.loggingService.catch("Error in ContactService getFolderContactsFromDb$ subscription: ",e)}))}catch{}}getDocumentContactsFromDb$(){try{this.getDocumentContactsSubscription||(this.getDocumentContactsSubscription=this.authService.getUser$().pipe(fe(e=>e?ce(e).pipe(fe(t=>this.docService.getDocumentPaths$().pipe(je(o=>!!o),rn(o=>{this.documentPaths=o}),ge(()=>t))),fe(t=>this.usersService.getResolveDocumentUsers$().pipe(je(o=>o),ge(()=>t))),fe(t=>(this.setUserDocumentContacts([]),t?this.documentPaths?this.docService.getDocumentIds$().pipe(fe(o=>{let a=o?.length>0?o.map(v=>v.documentId):[this.documentPaths?.documentId??""];if(a.some(v=>!v)||!this.documentPaths)return ce();let l=ce([]),s={isCollection:!0,useQuery:!0};this.commonDbService.shouldUseFirestore()||(s.documentId=a?.length?a[0]:void 0,s.organizationId=this.documentPaths?.organizationId);let d=[];for(let v=0;v<a.length;v+=V.LISTENER_BATCH_SIZE)d.push(a.slice(v,v+V.LISTENER_BATCH_SIZE));return l=un(d.map(v=>this.commonDbService.dbListener({feature:"allDocumentUsers",properties:E(b({},s),{firestoreQuery:[yi(Cf(vt("documentIds","array-contains-any",v),vt("viewerDocumentIds","array-contains-any",v))),vr("id"),...this.commentService?.getPaginatedContactList()?[Dm(10)]:[]]})}).pipe(Ho()))).pipe(ge(v=>ha(v)?.data)),l.pipe(ge(v=>{if(v){typeof v=="object"&&(v?.undefined&&delete v.undefined,v?.null&&delete v.null);let u=Object.values(v??{});this.setUserAccessFields(u),this.setUserDocumentContacts(u)}else this.setUserDocumentContacts([])}))})):ce():ce())),fe(()=>this.getContactListScopeForOrganizationUsers$())):(this.setUserDocumentContacts([]),ce()))).subscribe(()=>{this.mergeOrganizationAndDocumentContacts()},e=>{this.loggingService.catch("Error in ContactService getDocumentContactsFromDb$ subscription: ",e)}))}catch{}}setUserOrganizationContacts(e,t,o=!0){try{let a=e.find(s=>s.user.userId===this.user?.userId);a&&this.setCurrentOrganizationUserIAM(a);let l=e.map(s=>s.user)?.filter(s=>!this.userOrganizationContacts$.value.find(d=>d.userId===s.userId));if(this.userOrganizationContacts$.next([...this.userOrganizationContacts$.value,...l]),o&&this.usersService.setUserByIds(l),t){let s={};s[t]={};let d={};e.forEach(u=>{s[t][u.user.userId]=u,d[u.user.userId]=u.user}),this.userById$.next(b(b({},this.userById$.value),d));let v=this.usersByOrganizationId$.value?.[t];v&&(s[t]=b(b({},v),s[t])),this.usersByOrganizationId$.next(E(b({},this.usersByOrganizationId$.value),{[t]:s[t]}))}else this.usersByOrganizationId$.next({})}catch(a){this.loggingService.catch("Error in ContactService setUserOrganizationContacts: ",a)}}getUserOrganizationContacts$(){return this.getContactListScopeForOrganizationUsers$().pipe(fe(()=>this.checkContactListScopeForOrganizationUsers([ar.ALL,ar.ORGANIZATION])?this.userOrganizationContacts$.asObservable():ce([])))}getUserOrganizationContacts(){return this.checkContactListScopeForOrganizationUsers([ar.ALL,ar.ORGANIZATION])?this.userOrganizationContacts$.value:[]}setUserFolderContacts(e,t=!0){try{let o=e?.map(d=>d?.user)?.filter(d=>!this.userFolderContacts$.value.find(v=>v.userId===d.userId));this.userFolderContacts$.next([...this.userFolderContacts$.value,...o]),t&&this.usersService.setUserByIds(o);let a=this.usersByOrganizationIdAndFolderId$.value||{},l=b({},a),s={};e?.forEach(d=>{let{organizationId:v}=d?.metadata||{};v&&(l[v]||(l[v]={}),d.folderIds?.forEach(u=>{l[v][u]||(l[v][u]={}),l[v][u]=E(b({},l[v][u]),{[d.user.userId]:d}),s[d.user.userId]=d.user}))}),this.userById$.next(b(b({},this.userById$.value),s)),this.usersByOrganizationIdAndFolderId$.next(l)}catch(o){this.loggingService.catch("Error in ContactService updateUserFolderContacts: ",o)}}getUserFolderContacts$(){return this.getContactListScopeForOrganizationUsers$().pipe(fe(()=>this.checkContactListScopeForOrganizationUsers([ar.ALL,ar.FOLDER])?this.userFolderContacts$.asObservable():ce([])))}getUserFolderContacts(){return this.checkContactListScopeForOrganizationUsers([ar.ALL,ar.FOLDER])?this.userFolderContacts$.value:[]}setUserDocumentContacts(e,t=!0){try{let o=e?.map(d=>d?.user)?.filter(d=>!this.userDocumentContacts$.value.find(v=>v.userId===d.userId));this.userDocumentContacts$.next([...this.userDocumentContacts$.value,...o]),t&&this.usersService.setUserByIds(o);let a=this.usersByOrganizationIdAndDocumentId$.value||{},l=b({},a),s={};e?.forEach(d=>{let{organizationId:v}=d?.metadata||{};v&&(l[v]||(l[v]={}),d.documentIds?.forEach(u=>{l[v][u]||(l[v][u]={}),l[v][u]=E(b({},l[v][u]),{[d.user.userId]:d}),s[d.user.userId]=d.user}))}),this.userById$.next(b(b({},this.userById$.value),s)),this.usersByOrganizationIdAndDocumentId$.next(l)}catch(o){this.loggingService.catch("Error in ContactService updateUserDocumentContacts: ",o)}}getUserDocumentContacts$(){return this.getContactListScopeForOrganizationUsers$().pipe(fe(()=>this.checkContactListScopeForOrganizationUsers([ar.ALL,ar.DOCUMENT])?this.userDocumentContacts$.asObservable():ce([])))}getUserDocumentContacts(){return this.checkContactListScopeForOrganizationUsers([ar.ALL,ar.DOCUMENT])?this.userDocumentContacts$.value:[]}setCurrentOrganizationUserIAM(e){try{this.currentOrganizationUserIAM$.next(JSON.parse(JSON.stringify(e)))}catch(t){this.loggingService.catch("Error in ContactService setCurrentOrganizationUserIAM: ",t)}}getCurrentOrganizationUserIAM$(){return this.currentOrganizationUserIAM$.asObservable().pipe(xt(Qt))}getCurrentOrganizationUserIAM(){return this.currentOrganizationUserIAM$.value}mergeOrganizationAndDocumentContacts(){try{this.mergeContactsDebounceTimer&&clearTimeout(this.mergeContactsDebounceTimer),this.mergeContactsDebounceTimer=setTimeout(()=>{this.executeMergeContacts()},200)}catch(e){this.loggingService.catch("Error in ContactService mergeOrganizationAndDocumentContacts: ",e)}}executeMergeContacts(){try{let e=this.getContactListScopeForOrganizationUsers(),t=[];e.includes(ar.ALL)?t=[...this.getUserOrganizationContacts(),...this.getUserFolderContacts(),...this.getUserDocumentContacts()]:e.includes(ar.ORGANIZATION)?t=[...this.getUserOrganizationContacts()]:e.includes(ar.FOLDER)?t=[...this.getUserFolderContacts()]:e.includes(ar.DOCUMENT)&&(t=[...this.getUserDocumentContacts()]);let o=[...new Map(t.filter(a=>a?.userId).map(a=>[a.userId,a])).values()];this.internalUserContacts$.next(o)}catch(e){this.loggingService.catch("Error in ContactService mergeOrganizationAndDocumentContacts: ",e)}}getOrganizationGroupsFromDb$(){try{this.getOrganizationGroupsSubscription||(this.getOrganizationGroupsSubscription=this.authService.getUser$().pipe(fe(e=>e?.organizationId?ce(e).pipe(fe(t=>this.docService.getOrganizationConfig$().pipe(je(o=>!!o),ge(()=>t))),fe(t=>{if(this.setUserOrganizationGroups([]),!t)return ce();let o=this.docService.getOrganizationConfig()?.organizationId;return o?this.commonDbService.dbListener({feature:"allOrganizationGroups",properties:{organizationId:o,isCollection:!0}}).pipe(ge(a=>a?.data),ge(a=>{a?(typeof a=="object"&&(a?.undefined&&delete a.undefined,a?.null&&delete a.null),this.setUserOrganizationGroups(Object.values(a??{}))):this.setUserOrganizationGroups([])})):ce()})):(this.setUserOrganizationGroups([]),ce()))).subscribe(()=>{},e=>{this.loggingService.catch("Error in ContactService getOrganizationGroupsFromDb$ subscription: ",e)}))}catch{}}setUserOrganizationGroups(e){try{this.userOrganizationGroups$.next(e)}catch(t){this.loggingService.catch("Error in ContactService setUserOrganizationGroups: ",t)}}onContactSelected(e){try{if(e?.userId){let t=!!this.getUserDocumentContacts().find(a=>a.userId===e.userId),o=!!this.getUserOrganizationContacts().find(a=>a.userId===e.userId);switch(this.documentAccessType){case Ui.RESTRICTED:if(!t){let a={contact:e,isOrganizationContact:o,isDocumentContact:t,documentAccessType:this.documentAccessType};this.onContactSelectedSubject$.next(a)}break}}else{let t={contact:e,isOrganizationContact:!1,isDocumentContact:!1,documentAccessType:this.documentAccessType};this.onContactSelectedSubject$.next(t)}}catch(t){this.loggingService.catch("Error in ContactService onContactSelected: ",t)}}onContactSelected$(){return this.onContactSelectedSubject$.asObservable()}getOrganizationGroups$(){return this.getContactListScopeForOrganizationUsers$().pipe(fe(()=>this.checkContactListScopeForOrganizationUsers([ar.ALL,ar.ORGANIZATION_USER_GROUP])?this.userOrganizationGroups$.asObservable():ce([])))}enableAtHere(){try{if(this.analyticsService.setFeatureConfig({feature:Be.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:Be.COMMENT,config:{atHereLabel:e}}),e&&this.atHereLabel$.next(e)}catch(t){this.loggingService.catch("Error in ContactService setAtHereLabel: ",t)}}setAtHereDescription(e){try{this.analyticsService.setFeatureConfig({feature:Be.COMMENT,config:{atHereDescription:e}}),e&&this.atHereDescription$.next(e)}catch(t){this.loggingService.catch("Error in ContactService setAtHereDescription: ",t)}}disableAtHere(){try{if(this.analyticsService.setFeatureConfig({feature:Be.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(fe(()=>this.checkContactListScopeForOrganizationUsers([ar.ALL,ar.DOCUMENT])?this.atHereEnabled$.asObservable():ce(!1)))}getAtHereEnabled(){return this.checkContactListScopeForOrganizationUsers([ar.ALL,ar.DOCUMENT])?this.atHereEnabled$.value:!1}updateContactListScopeForOrganizationUsers(e){try{this.contactListScopeForOrganizationUsers$.next(e)}catch(t){this.loggingService.catch("Error in ContactService updateContactListScopeForOrganizationUsers: ",t)}}getContactListScopeForOrganizationUsers$(){return this.contactListScopeForOrganizationUsers$.asObservable()}getContactListScopeForOrganizationUsers(){return this.contactListScopeForOrganizationUsers$.value}checkContactListScopeForOrganizationUsers(e){return this.getContactListScopeForOrganizationUsers().some(t=>e.includes(t))}updateContactList(e,t){return X(this,null,function*(){try{this.analyticsService.trackEvent(Y.Events.Contact.UPDATE_CONTACT_LIST_TRIGGERED,{contactsCount:e?.length,config:t}),this.usersService.setUserByIds(e),this.customUserContacts$.next(e),this.customUserContactsConfig$.next(t)}catch(o){this.loggingService.catch("Error in CommentService updateContactList: ",o)}})}convert(e){try{if(e?.options){let{documentId:t,organizationId:o}=this.docService.getServerId(e?.options);e.options=E(b({},e?.options),{documentId:t,organizationId:o})}return this}catch(t){return this.loggingService.catch("Error in ContactService convert: ",t),this}}getContactList$(){try{return this.authService.getUser$().pipe(fe(e=>e?un([this.userOrganizationContacts$.asObservable(),this.userFolderContacts$.asObservable(),this.userDocumentContacts$.asObservable(),this.userOrganizationGroups$.asObservable(),this.customUserContacts$.asObservable()]).pipe(ge(([t,o,a,l,s])=>{let d={};d.organizationUsers=t?.map(u=>this.convertToClientUser(u)),d.folderUsers=o?.map(u=>this.convertToClientUser(u)),d.documentUsers=a?.map(u=>this.convertToClientUser(u)),d.updatedContactList=s?.map(u=>this.convertToClientUser(u));let v=[];return l?.forEach(u=>{let S=this.convertToClientUserGroup(u,d.organizationUsers||[]);S&&v.push(S)}),d.userGroups=v,d}),xt(Qt)):ce(null)),Hn(e=>(this.loggingService.catch("Error in ContactService getContactList$: ",e),ce(null))))}catch(e){return this.loggingService.catch("Error in ContactService getContactList$: ",e),ce(null)}}convertToClientUserGroup(e,t){try{let o={groupId:e?.metadata?.clientGroupId,groupName:e?.metadata?.groupName,users:[]},a={};return t?.forEach(l=>{if(l?.userId){let s=Et(l.userId);a[s]=l}}),Object.keys(e?.users??{}).forEach(l=>{a[l]&&o.users?.push(a[l])}),o}catch(o){return this.loggingService.catch("Error in ContactService convertToClientUserGroup: ",o),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(t){return this.loggingService.catch("Error in ContactService convertToClientUser: ",t),e}}getCustomUserContacts(){return this.customUserContacts$.value}getCustomUserContacts$(){return this.customUserContacts$.asObservable()}getCustomUserContactsConfig(){return this.customUserContactsConfig$.value}getCustomUserContactsConfig$(){return this.customUserContactsConfig$.asObservable()}};r.\u0275fac=function(t){return new(t||r)(J(rt),J(Ge),J(Lt),J(pi),J(On),J(lt),J(x),J(xn),J(Dn))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var xue=n=>{try{let r={USE_PROFILES:{svg:!0,svgFilters:!0},FORBID_ATTR:["onerror","onload","onclick","onmouseover","onmouseout","onmouseenter","onmouseleave","onmousemove","onmousedown","onmouseup","onwheel","onscroll","onkeydown","onkeyup","onkeypress","onfocus","onblur","onchange","onsubmit","on*"],FORBID_TAGS:["script","style","iframe","object","embed","form"]};return sk.sanitize(n,r)}catch(r){return tt.catch("Error in File utils sanitizeSvg: ",r),""}},Iue=n=>{try{return n.name.split(".").slice(0,-1).join(".")}catch(r){tt.catch("Error in File utils getFileName: ",r);return}},_Y=n=>{try{return/(?:\.([^.]+))?$/.exec(n?.name)[1]}catch(r){tt.catch("Error in File utils getFileExtension: ",r);return}},Eue=(n,r)=>{try{let i=n.slice(0,-1,n.type);return new File([i],r+"."+_Y(n),{type:n.type})}catch(i){tt.catch("Error in File utils updateFile: ",i);return}};var bY={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 Tu=(()=>{let r=class r{constructor(e,t,o,a,l){this.authService=e,this.configService=t,this.coreActionsService=o,this.loggingService=a,this.attachmentResolverService=l,this.storage=V2();try{this.configService.getApiKey$().subscribe(s=>{this.apiKey=s}),this.authService.getFirebaseConfig$().subscribe(s=>{s&&s.firebaseOptions?.storageBucket&&(this.storage=V2(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:t}){try{let o=new J1;o.name=t.name;let a=Eue(t,`${o.attachmentId}_${Iue(t)}`),l=`${this.apiKey}/${e}/${a?.name}`;return o.bucketPath=l,o.size=t.size,o.type=_Y(t),o?.type&&(o.mimeType=bY[o?.type]),o}catch(o){return this.loggingService.catch("Error in StorageService createAttachment: ",o),null}}sanitizeSvgFile(e){return X(this,null,function*(){if(e.type===bY.svg)try{let t=yield e.text(),o=xue(t);return new File([o],e.name,{type:e.type})}catch(t){return this.loggingService.catch("Error in StorageService sanitizeSvgFile: ",t),e}return e})}uploadAttachmentToStorage(l){return X(this,arguments,function*({attachment:e,file:t,resolve:o,reject:a}){try{let s=j2(this.storage,e.bucketPath),d=nz(s,t,{cacheControl:"public,max-age=3600"});d.on("state_changed",v=>{let u=v.bytesTransferred/v.totalBytes*100},v=>{a(v)},()=>{tz(d.snapshot.ref).then(v=>{e.url=v,o(e)})})}catch(s){this.loggingService.catch("Error in StorageService uploadAttachmentToStorage: ",s),a(s)}})}uploadToResolver(s){return X(this,arguments,function*({file:e,attachment:t,metadata:o,resolve:a,reject:l}){try{o.attachmentId=t.attachmentId;let d={attachmentId:t.attachmentId,name:t.name,file:e,metadata:o,mimeType:t.mimeType},v=St();this.coreActionsService.triggerAction(ut.ATTACHMENT_RESOLVER,{event:Y.Events.Resolver.ATTACHMENT_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:v,methodName:Ws.UPLOAD_TO_RESOLVER,source:"internal",payload:{attachment:d,eventType:Uo.ATTACHMENT_ADD}});let u=yield this.attachmentResolverService.saveAttachment({attachment:d,eventType:Uo.ATTACHMENT_ADD},v);u&&u.data?.url?(t.url=u.data?.url,a(t)):l(new Error("Failed to upload attachment to resolver"))}catch(d){this.loggingService.catch("Error in StorageService uploadToResolver: ",d),l(d)}})}uploadFile({path:e,file:t,useAttachmentResolver:o,metadata:a}){return new Promise((l,s)=>X(this,null,function*(){try{if(!this.apiKey)throw new Error("API key not configured");let d=yield this.sanitizeSvgFile(t),v=this.createAttachment({path:e,file:d});if(!v)throw new Error("Attachment not created");o?this.uploadToResolver({file:d,attachment:v,metadata:a,resolve:l,reject:s}):this.uploadAttachmentToStorage({attachment:v,file:d,resolve:l,reject:s})}catch(d){this.loggingService.catch("Error in StorageService uploadFile:",d),s(d)}}))}uploadChunk(e,t,o){return new Promise((a,l)=>{try{if(this.apiKey){let s=`${this.apiKey}/${e}/${t.name}`,d=j2(this.storage,s),v=nz(d,t,{cacheControl:"public,max-age=3600"});v.on("state_changed",u=>{let S=u.bytesTransferred/u.totalBytes*100},u=>{l(u)},()=>{tz(v.snapshot.ref).then(u=>{a(u)}).catch(u=>{this.loggingService.catch(`[uploadChunk] Error getting download URL for chunk ${o}:`,u),l(u)})})}else{let s=new Error("API key not available");this.loggingService.catch("[uploadChunk] API key not available",s),l(s)}}catch(s){this.loggingService.catch(`[uploadChunk] Error in StorageService uploadChunk for chunk ${o}: `,s),l(s)}})}downloadAttachment(e){try{if(e.url){let t=new XMLHttpRequest;t.responseType="blob",t.onload=()=>{let o=t.response,a=document.createElement("a"),l=window.URL.createObjectURL(o);a.setAttribute("type","hidden"),a.setAttribute(V.ATTRIBUTES.VELT_DOWNLOAD_BUTTON,"true"),a.classList.add("snippyly-overlay-panel"),a.href=l,e?.name&&(a.download=e?.name),document.body.appendChild(a);let s=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!1});a.dispatchEvent(s),window.URL.revokeObjectURL(l),a.remove()},t.onerror=()=>{window.open(e.url,"_blank")},t.open("GET",e.url),t.send()}}catch(t){this.loggingService.catch("Error in StorageService downloadAttachment: ",t)}}deleteAttachment({attachment:e,metadata:t,useAttachmentResolver:o}){return new Promise((a,l)=>{if(o){let s=St();this.coreActionsService.triggerAction(ut.ATTACHMENT_RESOLVER,{event:Y.Events.Resolver.ATTACHMENT_DELETE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:s,methodName:Ws.DELETE_ATTACHMENT,source:"internal",payload:{attachmentId:e.attachmentId,metadata:t}}),this.attachmentResolverService.deleteAttachment({attachmentId:e.attachmentId,metadata:t},s).then(()=>{a(null)}).catch(d=>{l(d)})}else{let s=j2(this.storage,e.bucketPath);ez(s).then(()=>{a(null)}).catch(d=>{a(null)})}})}deleteFileFromPath(e){return new Promise((t,o)=>{let a=j2(this.storage,e);ez(a).then(()=>{t(null)}).catch(l=>{o(l)})})}};r.\u0275fac=function(t){return new(t||r)(J(Ge),J(Lt),J(pi),J(x),J(Eu))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var An=(()=>{let r=class r{constructor(e,t,o,a,l,s,d,v){this.analyticsService=e,this.authService=t,this.contactService=o,this.databaseService=a,this.docService=l,this.configService=s,this.loggingService=d,this.commonDbService=v,this.documentIAM$=new be(null),this.workspaceIAM$=new be(null),this.roles$=new be([]),this.getDocumentIamSubscription=null,this.getOrganizationIamSubscription=null,this.getWorkspaceIamSubscription=null;try{this.authService.setIamService(this),this.databaseService.getDb().pipe(je(u=>!!u),st(1)).subscribe(u=>{u&&(this.getUser(),this.getDocumentPaths())},u=>{this.loggingService.catch("Error in CommentService getDb subscription: ",u)}),this.getRole$().pipe(st(1)).subscribe(u=>{this.authService?.getUser()&&!u&&this.analyticsService.trackEvent(Y.Events.Iam.USER_ACCESS_DENIED)}),this.documentIAM$.subscribe(u=>{u?.accessType&&this.contactService.setDocumentAccessType(u.accessType)})}catch(u){this.loggingService.catch("Error in IamService constructor: ",u)}}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(je(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(je(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 t=e||new sR;this.documentIAM$.next(t)},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(Hn(e=>ce(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(ge(e=>!!e),xt())}getDocumentIAM$(){return this.documentIAM$.asObservable()}getRoles$(){return this.roles$.asObservable().pipe(ge(e=>e?.length?e:V.WorkspaceRoles))}getFeaturesAccessLevel$(){return this.documentIAM$.asObservable().pipe(ge(e=>e?.features),fe(e=>this.getRole$().pipe(ge(t=>(t===Er.ADMIN&&(e=e&&JSON.parse(JSON.stringify(e||{})),e?.all?.disabled&&(e.all.disabled=!1)),e)))))}hasRole(e){try{return e===this.getRole()}catch(t){return this.loggingService.catch("Error in IamService hasRole: ",t),!1}}hasRoleAny(e=[]){try{return e?.includes(this.getRole()||"")}catch(t){return this.loggingService.catch("Error in IamService hasRoleAny: ",t),!1}}hasRole$(e){try{return this.authService.getUser$().pipe(fe(()=>this.documentIAM$.pipe(je(t=>!!t),fe(()=>this.workspaceIAM$.pipe(ge(()=>e===this.getRole()))))))}catch(t){return this.loggingService.catch("Error in IamService hasRole$: ",t),ce(!1)}}getRole$(){try{return this.authService.getUser$().pipe(fe(()=>this.configService.getSF$()),fe(()=>this.configService.getSF()?this.contactService.isUserGlobalContact$():ce(null)),fe(()=>this.configService.getSF()?this.documentIAM$.pipe(je(e=>!!e),xt(Qt)):ce(null)),fe(()=>this.workspaceIAM$.pipe(xt(Qt))),ge(()=>this.getRole()))}catch(e){return this.loggingService.catch("Error in IamService getRole$: ",e),ce(null)}}getRole(){try{let e=this.configService.getSF();if(e&&this.contactService.isUserGlobalContact())return Er.ADMIN;if(!e)return this.user?.isAdmin?Er.ADMIN:Er.COMMENTER;let t=null,o;if(this.user)switch((this.documentIAM$.value?this.documentIAM$.value?.features?.all?.restricted:!1)?Ui.RESTRICTED:this.documentIAM$.value?this.documentIAM$.value?.documentAccessType||Ui.PUBLIC:null){case Ui.PUBLIC:o=this.getUserFromDocumentIAM(this.user?.email,this.user?.userId),o||(o=this.getUserFromWorkspaceIAM(this.user?.email,this.user?.userId)),t=o?.role?.name||Er.COMMENTER;break;case Ui.RESTRICTED:o=this.getUserFromDocumentIAM(this.user?.email,this.user?.userId),o||(o=this.getUserFromWorkspaceIAM(this.user?.email,this.user?.userId)),t=o?.role?.name||null;break;default:break}return t}catch(e){this.loggingService.catch("Error in IamService getRole: ",e)}return null}isUserAdmin$(){return this.getRole$().pipe(ge(e=>e===Er.ADMIN),xt())}isUserAdmin(){try{return this.getRole()===Er.ADMIN}catch(e){return this.loggingService.catch("Error in IamService isUserAdmin: ",e),!1}}getUserFromDocumentIAM(e,t){try{if(e||t){let o;return e&&(o=this.documentIAM$.value?.users?.[Et(e)]),!o&&t&&(o=this.documentIAM$.value?.users?.[Et(t)]),o}else return}catch(o){this.loggingService.catch("Error in IamService getUserFromDocumentIAM: ",o)}}getUserFromWorkspaceIAM(e,t){try{if(e||t){let o;return e&&(o=this.workspaceIAM$.value?.users?.[Et(e)]),!o&&t&&(o=this.workspaceIAM$.value?.users?.[Et(t)]),o}else return}catch(o){this.loggingService.catch("Error in IamService getUserFromWorkspaceIAM: ",o)}}};r.\u0275fac=function(t){return new(t||r)(J(rt),J(Ge),J(ln),J(On),J(lt),J(Lt),J(x),J(xn))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var bl=(()=>{let r=class r{constructor(e,t,o,a,l,s,d,v,u,S){this.authService=e,this.docService=t,this.loggingService=o,this.commonDbService=a,this.usersService=l,this.commentUtilsService=s,this.coreActionsService=d,this.functions=v,this.configService=u,this.contactService=S,this.currentUserPermissions$=new be(null),this.permissionsCache$=new be(null),this.permissionProvider$=new be(null);try{this.docService.setUserPermissionService(this),this.authService.setUserPermissionService(this),this.commentUtilsService.setUserPermissionService(this),this.contactService.setUserPermissionService(this)}catch(k){this.loggingService.catch("Error in UserPermissionService constructor:",k)}}hasUserContextAccess({userId:e,accessFields:t}){try{if(!this.getIsContextEnabled()||t.includes(V.DEFAULT_VELT_CONTEXT))return!0;let o=this.contactService.getUserAccessFieldsByUserId(e);return o?t.every(a=>o.includes(a)):!0}catch(o){return this.loggingService.catch("Error in UserPermissionService hasUserContextAccess:",o),!1}}organizationDetails(e){return X(this,null,function*(){try{let t=yield this.commonDbService?.getData({feature:"organizationMetadata",properties:{organizationId:e}});return t&&t?.errorCode?{errorCode:qr.PERMISSION_DENIED,error:!0}:t&&!t?.metadata?{errorCode:qr.DOES_NOT_EXIST,error:!0}:{error:!1}}catch(t){return this.loggingService.catch("Error in UserPermissionService organizationDetails:",t),{errorCode:qr.SOMETHING_WENT_WRONG,error:!0}}})}documentDetails(o){return X(this,arguments,function*({documentId:e,organizationId:t}){try{let a=yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:e,organizationId:t}});if(a&&a?.errorCode)return{errorCode:qr.PERMISSION_DENIED,error:!0};if(a&&!a?.metadata)return{errorCode:qr.DOES_NOT_EXIST,error:!0};let l=this.docService.getDocumentMetadata(e)??{};return this.docService.setDocumentMetadata(e,b(b({},l),a?.metadata??{})),{error:!1}}catch(a){return this.loggingService.catch("Error in UserPermissionService documentDetails:",a),{errorCode:qr.SOMETHING_WENT_WRONG,error:!0}}})}folderDetails(o){return X(this,arguments,function*({folderId:e,organizationId:t}){try{let a=yield this.commonDbService?.getData({feature:"folderMetadata",properties:{folderId:e,organizationId:t}});return a&&a?.errorCode?{errorCode:qr.PERMISSION_DENIED,error:!0}:a&&!a?.metadata?{errorCode:qr.DOES_NOT_EXIST,error:!0}:{error:!1}}catch(a){return this.loggingService.catch("Error in UserPermissionService folderDetails:",a),{errorCode:qr.SOMETHING_WENT_WRONG,error:!0}}})}getUserPermissions(e){return X(this,null,function*(){try{if(!this.authService.getUser())return this.loggingService.catch("User not set. [source: getUserPermissions]",void 0,void 0,!0),{};let t=this.extractResourceIds(e);if(!t.clientOrganizationId||!t.organizationId)return this.loggingService.catch("Client organization id or organization id not set during getUserPermissions",void 0,void 0,!0),{};let o=yield this.validateResources(t),[a,l]=yield this.fetchUserPermissionsFromDB(t),s=this.buildPermissionsResponse(t,o,a,l);return!e&&Object.keys(s).length>0&&this.setCurrentUserPermissions(s),s}catch(t){return this.loggingService.catch("Error in UserPermissionService getUserPermissions:",t),{}}})}extractResourceIds(e){let t=this.docService.getDocumentPaths(),o=this.docService.getDocumentIds();return{folderIds:e?.folderIds?.length?e.folderIds:t?.folderId?[t.folderId]:[],documentIds:e?.documentIds?.length?e.documentIds:o.map(a=>a.clientDocumentId),clientOrganizationId:e?.organizationId??t?.clientOrganizationId,organizationId:e?.organizationId??t?.clientOrganizationId?Xa(e?.organizationId??t?.clientOrganizationId??""):void 0}}validateResources(e){return X(this,null,function*(){let{folderIds:t,documentIds:o,organizationId:a,clientOrganizationId:l}=e,s=[],d=[];a&&(s.push(this.organizationDetails(a)),d.push({id:l??"",type:"organization"})),t.forEach(u=>{s.push(this.folderDetails({folderId:Mi(u),organizationId:a??""})),d.push({id:u,type:"folder"})}),o.forEach(u=>{s.push(this.documentDetails({documentId:Bo(u),organizationId:a??""})),d.push({id:u,type:"document"})});let v=yield Promise.allSettled(s);return this.processValidationResults(v,d)})}processValidationResults(e,t){let o=[],a=[],l,s=e.map((d,v)=>({result:d,metadata:t[v]})).filter(({result:d})=>d.status==="rejected"||d.status==="fulfilled"&&d.value.error);for(let{result:d,metadata:v}of s){let u=d.status==="fulfilled"?d.value.errorCode??qr.SOMETHING_WENT_WRONG:qr.SOMETHING_WENT_WRONG,S={id:v.id,errorCode:u};switch(v.type){case"organization":if(l=S,u===qr.DOES_NOT_EXIST)throw new Error(`Organization with id '${v.id}' does not exist`);break;case"folder":o.push(S);break;case"document":a.push(S);break}}return{failedFolderIds:o,failedDocumentIds:a,failedOrganizationId:l}}fetchUserPermissionsFromDB(e){return X(this,null,function*(){let{folderIds:t,documentIds:o,organizationId:a}=e,l=[this.authService.getUser()?.userId??""],s=[...t.map(u=>Mi(u)),...o.map(u=>Bo(u)),a??""],[d,v]=yield Promise.allSettled([this.usersService.getUsersFromDBWithBatching({userIds:l,organizationId:a}),this.usersService.getTemporaryUsersFromDBWithBatching({userIds:l,organizationId:a,resourceIds:s})]);return[d.status==="fulfilled"?d.value:[],v.status==="fulfilled"?v.value:[]]})}buildPermissionsResponse(e,t,o,a){let{folderIds:l,documentIds:s,clientOrganizationId:d,organizationId:v}=e,{failedFolderIds:u,failedDocumentIds:S,failedOrganizationId:k}=t,A={};return this.processRegularUserPermissions(A,o,l,s,d??"",v??"",u,S,k),this.processTemporaryUserPermissions(A,a),this.processContextPermissions(A),A}processContextPermissions(e){try{let t=this.authService.getUser()?.userId;if(t){let o=this.contactService.getUserAccessFieldsByUserId(t);o?.length&&(e[t]||(e[t]={}),e[t].context={accessFields:o})}}catch(t){this.loggingService.catch("Error in UserPermissionService processContextPermissions:",t);return}}processRegularUserPermissions(e,t,o,a,l,s,d,v,u){for(let S of t)for(let k of S)k?.user?.userId&&(e[k.user.userId]=E(b({},o.length&&{folders:this.buildFolderPermissions(o,k,d)}),{documents:this.buildDocumentPermissions(a,k,v),organization:{[l]:this.buildOrganizationPermission(s,k,u)}}))}getErrorMessage(e,t){try{switch(this.loggingService.log(`Error in UserPermissionService getErrorMessage: ${e} ${t}`),e){case qr.DOES_NOT_EXIST:return`${t} does not exist`;case qr.PERMISSION_DENIED:return`User does not have access to ${t}`;case qr.SOMETHING_WENT_WRONG:return"Something went wrong";default:return"Something went wrong"}}catch(o){return this.loggingService.catch("Error in UserPermissionService getErrorMessage:",o),"Something went wrong"}}buildFolderPermissions(e,t,o){return e.reduce((a,l)=>{let s=o.find(d=>d.id===l);return s?a[l]={error:this.getErrorMessage(s.errorCode,"folder"),errorCode:s.errorCode}:a[l]={accessRole:t.viewerFolderIds?.includes(Mi(l))?gs.VIEWER:gs.EDITOR},a},{})}buildDocumentPermissions(e,t,o){return e.reduce((a,l)=>{let s=o.find(d=>d.id===l);return s?a[l]={error:this.getErrorMessage(s.errorCode,"document"),errorCode:s.errorCode}:a[l]={accessRole:t.viewerDocumentIds?.includes(Bo(l))?gs.VIEWER:gs.EDITOR},a},{})}buildOrganizationPermission(e,t,o){return o?{error:this.getErrorMessage(o.errorCode,"organization"),errorCode:o.errorCode}:{accessRole:t.viewerOrganizationIds?.includes(e)?gs.VIEWER:gs.EDITOR}}processTemporaryUserPermissions(e,t){for(let o of t)if(o?.userId)switch(this.ensureUserPermissionStructure(e,o.userId),o.type){case"folder":this.addTemporaryFolderPermission(e,o);break;case"document":this.addTemporaryDocumentPermission(e,o);break;case"organization":this.addTemporaryOrganizationPermission(e,o);break}}ensureUserPermissionStructure(e,t){e[t]||(e[t]={})}addTemporaryFolderPermission(e,t){let{userId:o,resourceId:a,role:l,expiresAt:s}=t;e[o].folders||(e[o].folders={}),e[o].folders[a]||(e[o].folders[a]={accessRole:l??gs.EDITOR,expiresAt:s})}addTemporaryDocumentPermission(e,t){let{userId:o,resourceId:a,role:l,expiresAt:s}=t;e[o].documents||(e[o].documents={}),e[o].documents[a]={accessRole:l??gs.EDITOR,expiresAt:s}}addTemporaryOrganizationPermission(e,t){let{userId:o,resourceId:a,role:l,expiresAt:s}=t;e[o].organization||(e[o].organization={}),e[o].organization[a]={accessRole:l??gs.EDITOR,expiresAt:s}}hasEditAccess({organizationId:e,folderId:t,documentId:o}){try{let a=!0,l=this.getCurrentUserPermissionsWithServerIds(),s=this.authService.getUser()?.userId??"";return l&&(e&&typeof e=="string"&&l?.[s]?.organization?.[e]&&(l?.[s]?.organization?.[e]?.accessRole===gs.VIEWER||l?.[s]?.organization?.[e]?.errorCode===qr.PERMISSION_DENIED)&&(a=!1),t&&typeof t=="string"&&l?.[s]?.folders?.[t]&&(l?.[s]?.folders?.[t]?.accessRole===gs.VIEWER||l?.[s]?.folders?.[t]?.errorCode===qr.PERMISSION_DENIED)&&(a=!1),o&&typeof o=="string"&&l?.[s]?.documents?.[o]&&(l?.[s]?.documents?.[o]?.accessRole===gs.VIEWER||l?.[s]?.documents?.[o]?.errorCode===qr.PERMISSION_DENIED)&&(a=!1)),a}catch{return!0}}getCurrentUserPermissions$(){return this.currentUserPermissions$.asObservable().pipe(xt(Qt))}getCurrentUserPermissions(){return this.currentUserPermissions$.value}refactorPermissionsWithServerIds(e){try{let t=JSON.parse(JSON.stringify(e??{})),o=this.authService.getUser()?.userId??"";if(t?.[o]){let a=this.docService.getDocumentPaths()?.clientOrganizationId??"";if(t?.[o]?.organization?.[a]){let l=Xa(a);t[o].organization&&(t[o].organization[l]=t[o].organization[a],delete t[o].organization[a])}t?.[o]?.folders&&(t[o].folders=Object.fromEntries(Object.entries(t?.[o]?.folders??{}).map(([l,s])=>[Mi(l),s]))),t?.[o]?.documents&&(t[o].documents=Object.fromEntries(Object.entries(t?.[o]?.documents??{}).map(([l,s])=>[Bo(l),s])))}return t}catch(t){return this.loggingService.catch("Error in UsersPermissionService refactorPermissionsWithServerIds:",t),e}}getCurrentUserPermissionsWithServerIds$(){return this.currentUserPermissions$.asObservable().pipe(ge(e=>this.refactorPermissionsWithServerIds(e)),xt(Qt))}getCurrentUserPermissionsWithServerIds(){return this.refactorPermissionsWithServerIds(this.currentUserPermissions$.value)}setCurrentUserPermissions(e){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setCurrentUserPermissions","color: green;");let t=null;e&&(t=JSON.parse(JSON.stringify(e))),this.currentUserPermissions$.next(t)}catch(t){this.loggingService.catch("Error in UsersPermissionService setCurrentUserPermissions:",t)}}getIsContextEnabled(){return this.loggingService.log("%c[WB] Calling FUNCTION: getIsContextEnabled","color: green;"),this.permissionProvider$.value?.isContextEnabled??!1}setPermissionProvider(e){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setPermissionProvider","color: green;"),this.permissionProvider$.next(e)}catch(t){this.loggingService.catch("Error in UsersPermissionService setPermissionProvider:",t)}}get isRevokeAccessOnDocumentUnsetEnabled(){return this.permissionProvider$.value?.revokeAccessOn?.some(e=>e.type===t_.DOCUMENT_UNSET)??!1}get isRevokeAccessOnUserLogoutEnabled(){return this.permissionProvider$.value?.revokeAccessOn?.some(e=>e.type===t_.USER_LOGOUT)??!1}get isRevokeOrganizationAccessOnUserLogoutEnabled(){return this.permissionProvider$.value?.revokeAccessOn?.some(e=>e.type===t_.USER_LOGOUT&&e.revokeOrganizationAccess)??!1}get isRevokeOrganizationAccessOnDocumentUnsetEnabled(){return this.permissionProvider$.value?.revokeAccessOn?.some(e=>e.type===t_.DOCUMENT_UNSET&&e.revokeOrganizationAccess)??!1}getPermissionProviderRetryConfig(){return this.permissionProvider$.value?.retryConfig??{retryCount:0,retryDelay:0}}revokeAccessOnUserLogout(){return X(this,null,function*(){let e=St();try{if(this.isRevokeAccessOnUserLogoutEnabled){let t=[],o=this.authService.getUser()?.userId??"";if((this.getPermissionsCache()??[]).forEach(l=>{l.userId===o&&l.hasAccess&&(l.type===Wr.ORGANIZATION?this.isRevokeOrganizationAccessOnUserLogoutEnabled&&t.push(E(b({},l),{hasAccess:!1})):t.push(E(b({},l),{hasAccess:!1})))}),t.length>0){this.coreActionsService.triggerAction(ut.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_USER_LOGOUT_FORMED,timestamp:new Date().getTime(),uniqueId:e,methodName:tr.REVOKE_ACCESS_ON_USER_LOGOUT,source:"internal",payload:{requests:t}}),this.setPermissionsCache([]),this.coreActionsService.triggerAction(ut.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_USER_LOGOUT_TRIGGERED,timestamp:new Date().getTime(),uniqueId:e,methodName:tr.REVOKE_ACCESS_ON_USER_LOGOUT,source:"internal",payload:{requests:t}});let l=yield this.revokeAccess({requests:t,userId:this.authService.getUser()?.userId??""});l.success?this.coreActionsService.triggerAction(ut.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_USER_LOGOUT_RESULT,timestamp:new Date().getTime(),uniqueId:e,methodName:tr.REVOKE_ACCESS_ON_USER_LOGOUT,source:"internal",payload:{result:{data:l,success:!0,statusCode:200}}}):this.coreActionsService.triggerAction(ut.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_USER_LOGOUT_ERROR,timestamp:new Date().getTime(),uniqueId:e,methodName:tr.REVOKE_ACCESS_ON_USER_LOGOUT,source:"internal",payload:{result:{data:l,success:!1,statusCode:500}}})}}}catch(t){this.coreActionsService.triggerAction(ut.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_USER_LOGOUT_ERROR,timestamp:new Date().getTime(),uniqueId:e,methodName:tr.REVOKE_ACCESS_ON_USER_LOGOUT,source:"internal",payload:{error:t}}),this.loggingService.catch("Error in UsersPermissionService revokeAccessOnUserLogout:",t)}})}revokeAccessOnDocumentUnset(o){return X(this,arguments,function*({documentIds:e,folderId:t}){let a=St();try{if(this.isRevokeAccessOnDocumentUnsetEnabled){let l=[],s=this.docService.getOrganizationConfig()?.clientOrganizationId??"",d=this.authService.getUser()?.userId??"",v=this.getPermissionsCache()??[];if(e.forEach(u=>{v.find(S=>S.resourceId===u.clientDocumentId&&S.type===Wr.DOCUMENT&&S.organizationId===s&&S.userId===d)&&(l.push({userId:d,resourceId:u.clientDocumentId,organizationId:s,type:Wr.DOCUMENT,hasAccess:!1}),v=v.filter(S=>!(S.resourceId===u.clientDocumentId&&S.type===Wr.DOCUMENT&&S.organizationId===s&&S.userId===d)))}),t&&v.find(u=>u.resourceId===t&&u.type===Wr.FOLDER&&u.organizationId===s&&u.userId===d)&&(l.push({userId:d,resourceId:t,organizationId:s,type:Wr.FOLDER,hasAccess:!1}),v=v.filter(u=>!(u.resourceId===t&&u.type===Wr.FOLDER&&u.organizationId===s&&u.userId===d))),s&&this.isRevokeOrganizationAccessOnDocumentUnsetEnabled&&v.find(u=>u.resourceId===s&&u.type===Wr.ORGANIZATION&&u.organizationId===s&&u.userId===d)&&(l.push({userId:d,resourceId:s,organizationId:s,type:Wr.ORGANIZATION,hasAccess:!1}),v=v.filter(u=>!(u.resourceId===s&&u.type===Wr.ORGANIZATION&&u.organizationId===s&&u.userId===d))),this.setPermissionsCache(v),l.length>0){this.coreActionsService.triggerAction(ut.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_FORMED,timestamp:new Date().getTime(),uniqueId:a,methodName:tr.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{requests:l}}),this.coreActionsService.triggerAction(ut.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_TRIGGERED,timestamp:new Date().getTime(),uniqueId:a,methodName:tr.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{requests:l}});let u=yield this.revokeAccess({requests:l,userId:d});u.success?this.coreActionsService.triggerAction(ut.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_RESULT,timestamp:new Date().getTime(),uniqueId:a,methodName:tr.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{result:{data:u,success:!0,statusCode:200}}}):this.coreActionsService.triggerAction(ut.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:tr.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{result:{data:u,success:!1,statusCode:500}}})}}}catch(l){this.coreActionsService.triggerAction(ut.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:tr.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{error:l}}),this.loggingService.catch("Error in UsersPermissionService revokeAccessOnDocumentUnset:",l)}})}getAccess(o){return X(this,arguments,function*({requests:e,userId:t}){let a=mr(this.functions,gr({url:wn?.cloudFunction?.sdkProxy,apiProxyDomain:this.configService?.getApiProxyDomain()}));return yield Cd({methodName:"getAccess",data:{type:"getAccess",data:e,metadata:{retryConfig:this.getPermissionProviderRetryConfig()}},getSdkProxy:a,userId:t})})}revokeAccess(o){return X(this,arguments,function*({requests:e,userId:t}){let a=mr(this.functions,gr({url:wn?.cloudFunction?.sdkProxy,apiProxyDomain:this.configService?.getApiProxyDomain()}));return yield Cd({methodName:"revokeAccess",data:{type:"revokeAccess",data:e,metadata:{retryConfig:this.getPermissionProviderRetryConfig()}},getSdkProxy:a,userId:t})})}onResourceAccessRequired(s){return X(this,arguments,function*({requests:e,uniqueId:t,methodName:o,userId:a,fromCache:l=!0}){try{if(!e?.length)return;let d=[],v=this.getPermissionsCache()??[];if(!this.forceRefreshPermissions()&&l&&(e.forEach(u=>{let S=v?.find(k=>k.resourceId===u.resource.id&&k.type===u.resource.type&&k.userId===u.userId&&k.organizationId===u.resource.organizationId);S&&d.push(S)}),d.length>0&&(e=e.filter(u=>!d.find(S=>S.resourceId===u.resource.id&&S.type===u.resource.type&&S.userId===u.userId&&S.organizationId===u.resource.organizationId)))),e.length>0){this.coreActionsService.triggerAction(ut.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.RESOURCE_ACCESS_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:t,methodName:o,source:"internal",payload:{requests:e,fromCache:l}});let u=yield this.getAccess({requests:e,userId:this.authService.getUser()?.userId??a??""});return this.coreActionsService.triggerAction(ut.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.RESOURCE_ACCESS_RESULT,timestamp:new Date().getTime(),uniqueId:t,methodName:o,source:"internal",payload:{result:u}}),u?.success&&u?.data?.length&&(this.setPermissionsCache([...v,...u.data]),u.data=[...d,...u.data]),u}else if(d.length>0)return this.coreActionsService.triggerAction(ut.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.RESOURCE_ACCESS_RESULT_FROM_CACHE,timestamp:new Date().getTime(),methodName:o,source:"internal",uniqueId:t,payload:{results:{data:d,success:!0,statusCode:200}}}),{data:d,success:!0,statusCode:200};return}catch(d){this.loggingService.catch("Error in UsersPermissionService onResourceAccessRequired:",d),this.coreActionsService.triggerAction(ut.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.RESOURCE_ACCESS_ERROR,timestamp:new Date().getTime(),methodName:o,source:"internal",uniqueId:t,payload:{error:d,requests:e,fromCache:l}});return}})}getPermissionsCache(){return this.forceRefreshPermissions()?[]:this.permissionsCache$.getValue()}forceRefreshPermissions(){return this.getPermissionProvider()?.forceRefresh??!1}setPermissionsCache(e){try{let t=new Map;e.forEach(a=>{let l=`${a.userId}_${a.resourceId}_${a.organizationId}_${a.type}`;t.set(l,a)});let o=JSON.parse(JSON.stringify(Array.from(t.values())));this.permissionsCache$.next(o)}catch(t){this.loggingService.catch("Error in UsersPermissionService setPermissionsCache:",t)}}isPermissionProviderAvailable(){try{return!!this.permissionProvider$.getValue()}catch(e){return this.loggingService.catch("Error in UsersPermissionService isPermissionProviderAvailable:",e),!1}}getPermissionProvider(){try{return this.permissionProvider$.getValue()}catch(e){return this.loggingService.catch("Error in UsersPermissionService getPermissionProvider:",e),null}}getPermissionProvider$(){return this.permissionProvider$.asObservable()}};r.\u0275fac=function(t){return new(t||r)(J(Ge),J(lt),J(x),J(xn),J(Dn),J(ku),J(pi),J(Lr),J(Lt),J(ln))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var hn=(()=>{let r=class r{constructor(e,t,o,a,l,s,d,v,u,S,k,A,P,U,W,te,ye,me){this.afAuth=e,this.analyticsService=t,this.authService=o,this.configService=a,this.commonDbService=l,this.commonDbUtilsService=s,this.commentUtilsService=d,this.commentAnnotationsResolverService=v,this.databaseService=u,this.docService=S,this.domService=k,this.iamService=A,this.loggingService=P,this.notificationUtilsService=U,this.usersService=W,this.functions=te,this.userPermissionService=ye,this.coreActionsService=me,this.db=Fl(),this.notificationsDb=Fl(void 0,wn.firebaseNotificationsDatabaseURL),this.documentPaths=null,this.notifications$=new be([]),this.rawNotificationsByIdMap$=new be(new Map),this.processedNotifications$=new be([]),this.userNotificationsFromServer$=new be(null),this.readNotificationsOnForYouTab$=new be(!1),this.currentDocumentOnly$=new be(!1),this.notificationViews$=new be({}),this.notificationsByIdMap$=new be(new Map),this.historyPanelVisible$=new be(!1),this.notificationsForYou$=new be(null),this.notificationsByDocumentIdMap$=new be(null),this.notificationsByDocumentIdSubscription={},this.allowedDocumentMetadataMap$=new be(null),this.maxNotificationDays$=new be(15),this.tabConfig$=new be({people:{enable:!1}}),this.settingsConfig$=new be(null),this.setSettingsConfigByOrganization$=new be(!1),this.muteAllNotifications$=new be(!1),this.enableSettings$=new be(!1),this.selfNotifications$=new be(!1),this.settingsInitialConfig$=new be([{name:"Inbox",id:"inbox",default:"ALL",enable:!0,values:[{name:"All",id:"ALL"},{name:"Only Involved",id:"MINE"},{name:"None",id:"NONE"}]},{name:"Email",id:"email",default:"MINE",enable:!0,values:[{name:"All",id:"ALL"},{name:"Only Involved",id:"MINE"},{name:"None",id:"NONE"}]}]),this.settingsConfigGeneration=0,this.notificationsPanelVisible$=new be(!1);try{this.subscribeNotificationsData().subscribe(),this.commentUtilsService.setNotificationService(this),this.databaseService.getDb().pipe(je(ke=>!!ke),st(1)).subscribe(ke=>{ke&&(this.db=ke,this.getDocumentIds(),this.subscribeGetNotificationsForYou())},ke=>{this.loggingService.catch("Error in NotificationService getDb subscription: ",ke)}),this.authService.getUser$().subscribe(ke=>{ke?(this.subscribeGetNotificationsForYou(),this.getDocumentIds(),this.subscribeToUserSettings()):(Object.keys(this.notificationsByDocumentIdSubscription).forEach(De=>{this.notificationsByDocumentIdSubscription[De]?.unsubscribe()}),this.notificationForYouSubscription?.unsubscribe(),this.documentIdsSubscription?.unsubscribe(),this.resetCacheData())}),this.docService.getLocationMetadata$().subscribe(ke=>{if(ke){let De=this.notificationsByDocumentIdMap$.getValue()?JSON.parse(JSON.stringify(this.notificationsByDocumentIdMap$.getValue())):null;Object.keys(ke||{}).forEach(Ie=>{let xe=De?.[Ie]?.notifications;xe?.length&&xe.forEach(Re=>{this.notificationUtilsService.mergeLocationWithNotification({notification:Re},ke)?.notification})}),this.notificationsByDocumentIdMap$.next(De)}})}catch(ke){this.loggingService.catch("Error in NotificationService constructor: ",ke)}}setDBConfigDataToInitialConfig(e){try{let t=JSON.parse(JSON.stringify(this.settingsConfig$.getValue()??{}));Object.entries(e||{}).forEach(([o,a])=>{t[o]=a}),this.settingsConfig$.next(t)}catch(t){this.loggingService.catch("Error in NotificationService setDBConfigDataToInitialConfig: ",t)}}getInitialConfigFromDB(e){return X(this,null,function*(){try{this.loggingService.log("%c[WB] Calling NotificationService FUNCTION: getInitialConfigFromDB","color: green;");let t=++this.settingsConfigGeneration,o=Et(this.authService.getUser()?.userId??""),a=yield this.commonDbService.getData({feature:"userConfig",properties:{useCollectionGroup:!1,isCollection:!1,documentId:this.getSettingsConfigByOrganization()?void 0:e?.documentId,organizationId:e?.organizationId??this.docService.getOrganizationConfig()?.organizationId,userId:o}});if(t!==this.settingsConfigGeneration)return;if(a?.notificationsConfig)this.setDBConfigDataToInitialConfig(a?.notificationsConfig);else{this.setSettingsInitialConfig(this.settingsInitialConfig$.getValue());let l={};this.settingsInitialConfig$.getValue().forEach(d=>{if(d.enable){let v=d?.values?.find(u=>u.id===d.default);l[d.id]=v||d?.values?.[0]||{id:"NONE",name:"None"}}});let s={};Object.keys(l).forEach(d=>{s[d]=l[d].id}),yield this.updateSettingsConfigToDb(s)}}catch(t){this.loggingService.catch("Error in NotificationService getInitialConfigFromDB: ",t)}})}subscribeToUserSettings(){try{this.loggingService.log("%c[WB] Calling NotificationService FUNCTION: subscribeToUserSettings","color: green;"),this.userSettingsSubscription&&this.userSettingsSubscription.unsubscribe();let e=Et(this.authService.getUser()?.userId??"");this.userSettingsSubscription=this.enableSettings$.pipe(je(t=>t===!0),fe(()=>un([this.docService.getDocumentPaths$(),this.getSettingsConfigByOrganization$(),this.docService.getOrganizationConfig$()]).pipe(je(([t,o,a])=>(o||!!t)&&!!a?.organizationId),fe(([t,o,a])=>rr(this.getInitialConfigFromDB(t)).pipe(fe(()=>this.commonDbService.dbListener({feature:"userConfig",properties:{useCollectionGroup:!1,isCollection:!1,documentId:o?void 0:t?.documentId,organizationId:t?.organizationId??a?.organizationId,userId:e}}).pipe(ge(l=>{l?.data?.notificationsConfig&&!Ei(l?.data?.notificationsConfig??{},this.settingsConfig$.getValue()??{})&&this.setDBConfigDataToInitialConfig(l?.data?.notificationsConfig)})))))))).subscribe()}catch(e){this.loggingService.catch("Error in NotificationService subscribeToUserSettings: ",e)}}resetCacheData(){try{this.loggingService.log("%c[WB] Calling NotificationService FUNCTION: resetCacheData","color: green;"),this.setUserNotificationsFromServer(null),this.notificationsByDocumentIdMap$.next(null),this.notificationsForYou$.next(null),this.settingsConfig$.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(t){this.loggingService.catch("Error in NotificationService setCommentService: ",t)}}getDocumentIds(){try{this.documentIdsSubscription&&this.documentIdsSubscription.unsubscribe(),this.documentIdsSubscription=this.selfNotifications$.pipe(fe(()=>this.getCurrentDocumentOnly$().pipe(fe(e=>e?this.docService.getDocumentPaths$().pipe(ge(t=>{})):ce(void 0)))),rn(()=>{this.notificationsByDocumentIdMap$.next(null)}),fe(()=>this.getDocumentIdsByLastNotificationTimestamp().pipe(Vi(),ge(([e,t])=>{let o=e?.map(v=>v.documentId),a=t?.map(v=>v.documentId),l=o?.filter(v=>!a?.includes(v)),s=a?.map(v=>({documentId:v,timestamp:t?.find(u=>u.documentId===v)?.timestamp})).filter(v=>!o?.includes(v.documentId)),d=a?.map(v=>{let u=t?.find(S=>S.documentId===v)?.timestamp;return{documentId:v,timestamp:u}}).filter(v=>{let u=e?.find(S=>S.documentId===v.documentId)?.timestamp;return u&&v.timestamp&&u!==v.timestamp});s?.length&&this.fetchNotificationsForDocumentIds(s),d?.length&&this.fetchNotificationsForDocumentIds(d,1),l?.forEach(v=>{this.removeNotificationsForDocumentId(v)}),t&&!t?.length&&!this.notificationsByDocumentIdMap$.getValue()&&(this.notificationsByDocumentIdMap$.next({}),this.setUserNotificationsFromServer([]))})))).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(fe(t=>this.docService.getOrganizationConfig$().pipe(ge(o=>{let a=null,l=this.configService.getApiKey(),s=o?.organizationId||t?.organizationId;return l&&s&&(a=new Am({apiKey:l,organizationId:s})),{user:t,documentPaths:a}}))),fe(t=>{let{user:o,documentPaths:a}=t;if(this.getCurrentDocumentOnly()&&!this.docService?.getDocumentPaths()?.documentId)return ce(null);if(o&&a?.organizationNotificationsLastNotificationTimestamp){let l=new Date,s=this.maxNotificationDays$.getValue()>0?this.maxNotificationDays$.getValue():15;l.setDate(l.getDate()-s);let d=l.getTime(),v=[yi(vt("timestamp",">=",d),...this.getCurrentDocumentOnly()&&this.docService.getDocumentPaths()?.documentId?[vt("metadata.documentId","==",this.docService.getDocumentPaths()?.documentId)]:[])];return this.getCurrentDocumentOnly()||(v.push(vr("timestamp","desc")),v.push(Dm(e))),this.commonDbService.dbListener({feature:"allLastNotificationTimestamp",properties:{organizationId:a?.organizationId,isCollection:!0,useQuery:!0,firestoreQuery:v}}).pipe(ge(u=>u?.data),ge(u=>{let S=[];return Object.keys(u||{}).forEach(k=>{let A=this.commonDbService.shouldUseFirestore()?u[k]?.timestamp??0:u[k],P=this.commonDbService.shouldUseFirestore()?u[k]?.deletedNotification??!1:!1;if(P&&P.id&&P?.timestamp===A){let U=P.id,W=u[k]?.metadata?.documentId,te=JSON.parse(JSON.stringify(this.notificationsByDocumentIdMap$.getValue()??{})),ye=te?.[W]??{documentMetadata:null,notifications:[]},me=ye.notifications??[],ke=me?.findIndex(De=>De.id===U);ke!==-1&&(me.splice(ke,1),this.notificationsByDocumentIdMap$.next(E(b({},te),{[W]:E(b({},ye),{notifications:me})})))}S.push({documentId:k,timestamp:A})}),S}),Hn(u=>(this.loggingService.catch("Error in NotificationService getDocumentIdsByLastNotificationTimestamp: ",u),ce([]))))}return ce(null)}))}catch(t){return this.loggingService.catch("Error in NotificationService getDocumentIdsByLastNotificationTimestamp: ",t),ce([])}}resolveAndUpdateDocumentNotifications(e,t){try{Object.keys(e).forEach(o=>{let a=e[o]?.documentMetadata||{},l;if(t==="user")l=this.commonDbUtilsService.mergeUsersWithData({feature:"allDocNotifications",data:e[o]?.notifications||[]});else{let s=e[o]?.notifications?.reduce((v,u)=>(v[u.notificationId]=u,v),{}),d=this.commonDbUtilsService.mergeCommentAnnotationsWithData({feature:"allDocNotifications",data:s});l=Object.values(d??{})}l.forEach(s=>{s.notification=this.getClientNotificationObject(s)}),this.setNotificationForDocumentIdInCache(o,a,l)})}catch(o){this.loggingService.catch("Error in NotificationService resolveAndUpdateDocumentNotifications: ",o)}}resolveAndMergeUserNotifications(e,t,o=!1){try{let a=e;if(o&&t==="comment"){let u=this.getUserNotificationsFromServer()??[],S=new Set(e.map(k=>k.notificationId));a=u.filter(k=>S.has(k.notificationId)).concat(e.filter(k=>!u.some(A=>A.notificationId===k.notificationId)))}let l=a.reduce((u,S)=>(u[S.notificationId]=S,u),{}),s;if(t==="user"){let u=this.commonDbUtilsService.mergeUsersWithData({feature:"allUserNotifications",data:l});s=Object.values(u??{})}else{let u=this.commonDbUtilsService.mergeCommentAnnotationsWithData({feature:"allUserNotifications",data:l});s=Object.values(u??{})}s.forEach(u=>{u.notification=this.getClientNotificationObject(u)});let d=this.getUserNotificationsFromServer()??[],v=new Map(d.map(u=>[u.notificationId,u]));s.forEach(u=>{v.set(u.notificationId,u)}),this.setUserNotificationsFromServer(Array.from(v.values()))}catch(a){this.loggingService.catch("Error in NotificationService resolveAndMergeUserNotifications: ",a)}}fetchNotificationsForDocumentIds(e,t=15){return X(this,null,function*(){try{if(e?.length){let o=mr(this.functions,gr({url:wn.cloudFunction.getNotificationsForDocuments,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:12e5}),a=this.docService.getOrganizationConfig()?.organizationId??"";if(!a)return[];let l=this.getStartAtTimestamp(),s={};if(e.forEach(me=>{if(me?.documentId){let ke=this.getAllowedDocumentMetadataByDocumentId(me.documentId);ke&&(s[me.documentId]=ke)}}),this.userPermissionService?.isPermissionProviderAvailable())try{let me=[];if(e.forEach(Re=>{this.docService.getDocumentMetadata(Re.documentId)||me.push(Re.documentId)}),me.length){let Re=this.authService.getUser(),Le=mr(this.functions,gr({url:wn?.cloudFunction?.sdkProxy,apiProxyDomain:this.configService?.getApiProxyDomain()}));try{let Ue=yield Cd({methodName:"getDocumentMetadataFromIds",data:{type:"getDocumentMetadataFromIds",metadata:{organizationId:Re?.clientOrganizationId,folderId:this.documentPaths?.folderId},documentIds:me},getSdkProxy:Le,userId:Re?.userId??""});if(Ue?.data?.length){let He={};Ue.data.forEach($e=>{$e?.documentId&&(He[$e.documentId]=$e)}),this.docService.setAllDocumentMetadata(b(b({},this.docService.getAllDocumentMetadataMap()),He))}}catch(Ue){this.loggingService.warn("Error in NotificationService fetchNotificationsForDocumentIds: ",Ue)}}let ke=[],De=[];e.forEach(Re=>{let Le=this.docService.getDocumentMetadata(Re.documentId);Le?.clientDocumentId?ke.push({userId:this.authService.getUser()?.userId??"",resource:{id:Le.clientDocumentId,type:Wr.DOCUMENT,source:tr.GET_NOTIFICATIONS,organizationId:this.docService.getOrganizationConfig()?.clientOrganizationId??""}}):De.push(Re.documentId)}),De.length&&(e=e.filter(Re=>!De.includes(Re.documentId)));let Ie=St();this.coreActionsService.triggerAction(ut.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.RESOURCE_ACCESS_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:Ie,methodName:tr.GET_NOTIFICATIONS,source:"internal",payload:{requests:ke}});let xe=yield this.userPermissionService?.onResourceAccessRequired({requests:ke,uniqueId:Ie,methodName:tr.GET_NOTIFICATIONS});xe?.success&&xe?.data?.length?xe.data.forEach(Re=>{!Re.hasAccess&&Re.resourceId&&(e=e.filter(Le=>Le.documentId!==Bo(Re.resourceId)))}):e=[]}catch(me){this.loggingService.warn("Error in NotificationService fetchNotificationsForDocumentIds: ",me),e=[]}if(!e.length)return[];let d=this.userPermissionService?.getPermissionsCache()?.filter(me=>me.type===Wr.CONTEXT),v={organizationId:a,documentIds:e.filter(me=>!!me.documentId&&!!me.timestamp).map(me=>({documentId:me.documentId,timestamp:me.timestamp??0})),timestamp:l,limitToLast:t,selfNotifications:this.selfNotifications$.value,isPermissionProviderUsed:this.userPermissionService?.isPermissionProviderAvailable(),getUserNotifications:!0,isContextEnabled:this.userPermissionService?.getIsContextEnabled(),cachedData:d,isSettingsConfigByOrganization:this.getSettingsConfigByOrganization(),retryConfig:this.userPermissionService?.getPermissionProviderRetryConfig()},u=yield this.notificationUtilsService.handleNotificationEncryption({data:v}),S=yield o({veltData:u}),k=S?.data?.data?.veltData||{},A=S?.data?.data?.veltAdditionalData||{},P="notificationwithdocumentidstoencryptanddecryptonsdk"+(this.authService.getUser()?.userId??""),U=yield _1(k,P),{userNotifications:W=[],userNotificationIdsInDocNotifications:te=[],permissionResults:ye=[]}=yield _1(A,P);if(this.userPermissionService?.getIsContextEnabled()){let me=[...this.userPermissionService?.getPermissionsCache()??[],...ye??[]];this.userPermissionService?.setPermissionsCache(me)}if(U&&typeof U=="object"){let me=this.usersService.userDataProviderAvailable(),ke=this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable(),De=[],Ie=[];Object.keys(U).forEach((Re,Le)=>{let Ue=U[Re].documentMetadata;if(Ue){let $e=this.allowedDocumentMetadataMap$.value||{};(!$e?.[Re]||!Ei($e?.[Re],Ue))&&this.allowedDocumentMetadataMap$.next(E(b({},$e),{[Re]:Ue}))}let He=U[Re].notifications||[];He.forEach($e=>{te.includes($e.notificationId)&&!W.find(br=>br.notificationId===$e.notificationId)&&W.push(JSON.parse(JSON.stringify($e))),$e.notification=this.getClientNotificationObject($e)}),this.setNotificationForDocumentIdInCache(Re,Ue,He),me&&(De.push(this.commonDbUtilsService.formatResponse({feature:"allDocNotifications",data:He,shouldAwait:!0,forceResolve:!0})),De.push(this.commonDbUtilsService.formatResponse({feature:"allUserNotifications",data:W,shouldAwait:!0,forceResolve:!0}))),ke&&(Ie.push(this.commonDbUtilsService.formatResponse({feature:"allDocNotifications",data:He,shouldCommentAnnotationsResolverAwait:!0})),Ie.push(this.commonDbUtilsService.formatResponse({feature:"allUserNotifications",data:W,shouldCommentAnnotationsResolverAwait:!0})))});let xe=JSON.parse(JSON.stringify(W));this.setUserNotificationsFromServer([...this.getUserNotificationsFromServer()??[],...W]),me&&ke?Promise.allSettled(De).then(()=>{this.resolveAndUpdateDocumentNotifications(U,"user"),this.resolveAndMergeUserNotifications(xe,"user")}).then(()=>Promise.allSettled(Ie)).then(()=>{this.resolveAndUpdateDocumentNotifications(U,"comment"),this.resolveAndMergeUserNotifications(xe,"comment",!0)}):me?Promise.allSettled(De).then(()=>{this.resolveAndUpdateDocumentNotifications(U,"user"),this.resolveAndMergeUserNotifications(xe,"user")}):ke&&Promise.allSettled(Ie).then(()=>{this.resolveAndUpdateDocumentNotifications(U,"comment"),this.resolveAndMergeUserNotifications(xe,"comment",!1)})}}}catch(o){return this.loggingService.catch("Error in NotificationService fetchNotificationsForDocumentIds: ",o),[]}})}getUserNotificationsFromServer$(){return this.userNotificationsFromServer$.asObservable()}setUserNotificationsFromServer(e){try{let t=JSON.parse(JSON.stringify(e));t=t?.filter((o,a,l)=>a===l.findIndex(s=>s.notificationId===o.notificationId)),this.userNotificationsFromServer$.next(t)}catch(t){this.loggingService.catch("Error in NotificationService setUserNotificationsFromServer: ",t)}}getUserNotificationsFromServer(){return this.userNotificationsFromServer$.getValue()}setNotificationForDocumentIdInCache(e,t,o,a){try{let l=this.docService.getOrganizationConfig()?.organizationId??"",s=this.docService.getOrganizationMetadata(l);t||(t=JSON.parse(JSON.stringify(this.docService.getDocumentMetadata()||{}))),s||(s=JSON.parse(JSON.stringify(this.docService.getOrganizationMetadata(l)||{})));let d=this.notificationsByDocumentIdMap$.getValue(),v=d?.[e]?.notifications||[],u=this.docService.getLocationMetadatas(),S=o?.map(P=>{let U=P?.notification;return U?(U.metadata&&(U.metadata.documentName=t?.documentName||U.metadata.documentName,U.metadata.organizationMetadata=s||U.metadata.organizationMetadata,U.metadata.documentMetadata=t||U.metadata.documentMetadata),u&&(U=this.notificationUtilsService.mergeLocationWithNotification({notification:U},u)?.notification),U):null})?.filter(P=>!!P)||[],k=new Map(v.map(P=>[P.id,P]));S.forEach(P=>{k.set(P.id,P)});let A=Array.from(k.values()).sort((P,U)=>(U.timestamp||0)-(P.timestamp||0));this.notificationsByDocumentIdMap$.next(E(b({},d),{[e]:{notifications:A,documentMetadata:t}}))}catch(l){this.loggingService.catch("Error in NotificationService setNotificationForDocumentIdInCache: ",l)}}removeNotificationsForDocumentId(e){try{this.notificationsByDocumentIdSubscription[e]&&this.notificationsByDocumentIdSubscription[e].unsubscribe();let t=this.notificationsByDocumentIdMap$.getValue();delete t?.[e],this.notificationsByDocumentIdMap$.next(t)}catch(t){this.loggingService.catch("Error in NotificationService removeNotificationsForDocumentId: ",t)}}getStartAtTimestamp(){try{let e=new Date,t=this.maxNotificationDays$.getValue()>0?this.maxNotificationDays$.getValue():15;return e.setDate(e.getDate()-t),e.getTime()}catch(e){return this.loggingService.catch("Error in NotificationService getStartAtTimestamp: ",e),0}}getNotificationsForYou(){try{return this.getUserNotificationsFromServer$().pipe(fe(e=>ce(e).pipe(je(t=>!!t),ge(t=>{let o=this.usersService.userDataProviderAvailable(),a=this.commentAnnotationsResolverService?.commentAnnotationDataProviderAvailable();if(o||a){let s=t?.reduce((d,v)=>(d[v.notificationId]=v,d),{});o&&(s=this.commonDbUtilsService.mergeUsersWithData({feature:"allUserNotifications",data:s||[]})),a&&(s=this.commonDbUtilsService.mergeCommentAnnotationsWithData({feature:"allUserNotifications",data:s||[]})),t=Object.values(s??{})}return t.forEach(s=>{s.notification=this.getClientNotificationObject(s)}),t.sort((s,d)=>d.timestamp-s.timestamp),t.map(s=>s.notification).filter(s=>!!s)}),fe(t=>{let o={data:t?.reduce((a,l)=>(a[l.id]={notification:l},a),{}),operation:null};return this.commonDbUtilsService.mergeLocationMetadataWithData$({data:o,feature:"allUserNotifications"}).pipe(ge(a=>Object.values(a?.data||{}).map(l=>l?.notification)))}))),fe(e=>{let t=this.docService.getOrganizationConfig()?.organizationId??"";return this.docService.getOrganizationMetadata$(t).pipe(ge(()=>e))}),fe(e=>this.allowedDocumentMetadataMap$.pipe(ge(()=>e))),ge(e=>(e?.length&&(e=e.map(t=>{if(t?.metadata){let o=this.docService.getOrganizationConfig()?.organizationId??"",a=this.getAllowedDocumentMetadataByDocumentId(t.metadata.documentId),l=this.docService.getOrganizationMetadata(o);a||(a=JSON.parse(JSON.stringify(this.docService.getDocumentMetadata()||{}))),l||(l=JSON.parse(JSON.stringify(this.docService.getOrganizationMetadata(o)||{}))),t.metadata.documentName=a?.documentName||t.metadata.documentName,t.metadata.organizationMetadata=l||t.metadata.organizationMetadata,t.metadata.documentMetadata=a||t.metadata.documentMetadata}return t})),e===null?this.notificationsForYou$.next(null):e?.length?this.notificationsForYou$.next(JSON.parse(JSON.stringify(e))):this.notificationsForYou$.next([]),ce(e))))}catch(e){return this.loggingService.catch("Error in NotificationService getNotificationsForYou: ",e),ce({})}}subscribeNotificationsData(e,t){this.loggingService.log("%c[WB] Calling FUNCTION: subscribeViewsData","color: green;");let o,a;try{if(e&&(a=Gn(e)),t&&typeof t=="object"){let l=fo(t);o=Gn(JSON.stringify(l))}}catch(l){this.loggingService.catch("Error in ViewsService subscribeViewsData: ",l)}return mi(this.afAuth).pipe(je(l=>!!l),fe(l=>this.isFeatureAllowed({firebaseUser:l})),fe(l=>l.featureAllowed?this.iamService.isUserAllowed$().pipe(ge(s=>(l.featureAllowed=s,l))):ce(l)),fe(l=>!l.featureAllowed||l?.user?.organizationId?(this.notifications$.next([]),this.rawNotificationsByIdMap$.next(new Map),this.processedNotifications$.next([]),this.notificationsByIdMap$.next(new Map),this.notificationViews$.next({}),this.setNotificationsByIdMap(),ce([])):ce(l).pipe(fe(s=>this.docService.getDocumentPaths$().pipe(ge(d=>(this.documentPaths=d,s.documentPaths=d,s)))),fe(s=>this.getDataFromDocumentId(a)))))}isFeatureAllowed(e){return this.configService.getConfig$().pipe(je(t=>!!t),ge(t=>E(b({},e),{config:t})),fe(t=>this.authService.getUser$().pipe(ge(o=>E(b({},t),{user:o})))),fe(t=>Cr(t.config,t.user,Be.NOTIFICATION)?ce(E(b({},t),{featureAllowed:!0})):(this.loggingService.warn("Notification feature is not allowed."),ce(E(b({},t),{featureAllowed:!1})))))}getDataFromDocumentId(e){return this.databaseService.getDb().pipe(je(t=>!!t),fe(t=>{if(this.db=t,this.loggingService.log(this.db),this.configService?.getApiKey()&&this.documentPaths?.views){let o=`${this.configService.getApiKey()}`;this.documentPaths?.organizationId&&(o+=`/${V.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${this.documentPaths.organizationId}`);let a=Li(this.db,`${e?o+"/"+V.FIREBASE_PARTIAL_PATH_DOCS+"/"+e+"/"+V.FIREBASE_PARTIAL_PATH_VIEWS+"/":this.documentPaths?.notifications}`);return UM(a).pipe(Hn(l=>(this.loggingService.catch("Error in NotificationService getDataFromDocumentId: ",l),ce(null))),ge(l=>{let s=[],d=new Map;l?.raw&&(Object.keys(l?.raw||{}).forEach(u=>{let S=l?.raw[u];S?.id&&s.push(S)}),s.forEach(u=>{u.id&&d.set(u.id,u)})),this.notifications$.next(s),this.rawNotificationsByIdMap$.next(d);let v=[];l?.processed&&Object.keys(l?.processed||{}).forEach(u=>{let S=l?.processed[u];S?.id&&v.push(S)}),this.processedNotifications$.next(v),this.setNotificationsByIdMap()}))}else return ce(null)}))}setNotificationsByIdMap(){try{let e=this.authService.getUser();if(e){let t=this.notificationViews$.getValue(),o;e?.email&&(o=Et(e?.email));let a;e?.userId&&(a=Et(e?.userId));let l=new Map;this.processedNotifications$.getValue().forEach(d=>{if(d.id&&d?.displayHeadlineMessageTemplate){let v=!1;(o&&d.notifyUsers?.[o]||a&&d.notifyUsers?.[a])&&(v=!0);let u={id:d.id,notificationSource:d.notificationSource,actionType:d.actionType,actionUser:d.actionUser,timestamp:d.timestamp,targetAnnotationId:d.targetAnnotationId,displayHeadlineMessage:this.getNotificationHeadlineMessage(d),displayBodyMessage:this.getNotificationBodyMessage(d),forYou:v,notificationSourceData:d.notificationSourceData},S=this.getRawNotificationById(u.id);if(S?.metadata&&(u.metadata={apiKey:S.metadata.apiKey,organizationId:S.metadata.organizationId,clientOrganizationId:S.metadata.clientOrganizationId,documentId:S.metadata.documentId,clientDocumentId:S.metadata.clientDocumentId,location:S?.location,locationId:S?.locationId}),u?.notificationSource==="comment"&&u?.targetAnnotationId){let k=this.commentService?.getAnnotationById(u.targetAnnotationId);k||S?.annotationData&&(k=S.annotationData),k&&(u.notificationSourceData=this.commentService?.getCommentAnnotationForClient(k))}l.set(d.id,u)}}),l.forEach((d,v)=>{d.isUnread=d?.actionUser?.userSnippylyId!==e?.userSnippylyId&&!t?.notification?.[v]?.views?.[e?.userSnippylyId],l.set(v,d)}),this.notificationsByIdMap$.next(l)}}catch(e){this.loggingService.catch("Error in NotificationService setNotificationsByIdMap: ",e)}}getClientNotificationObject({processed:e,raw:t,metadata:o,views:a,notification:l}){try{let s=this.authService.getUser(),d=l||e;if(d.id&&d?.displayHeadlineMessageTemplate&&s){let v=null;s?.email&&(v=Et(s?.email));let u=null;s?.userId&&(u=Et(s?.userId));let S=!1,k=!0;(v&&d.notifyUsers?.[v]||u&&d.notifyUsersByUserId?.[u])&&(S=!0),u&&a?.[u]&&(k=!1);let A={id:d.id};if(l?A=E(b(b({},A),l),{displayHeadlineMessage:this.getNotificationHeadlineMessage(l),displayBodyMessage:this.getNotificationBodyMessage(l),forYou:S,isUnread:k}):A={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:S,isUnread:k,metadata:o},A?.notificationSource==="comment"&&A?.targetAnnotationId){let P=this.commentService?.getAnnotationById(A.targetAnnotationId);P||l?.notificationSourceData&&(P=l?.notificationSourceData),P||t?.annotationData&&(P=t.annotationData),P&&(A.notificationSourceData=this.commentService?.getCommentAnnotationForClient(P))}return t?.targetAnnotationData?.isCommentResolverUsed&&(A.isCommentResolverUsed=t?.targetAnnotationData?.isCommentResolverUsed),A}return}catch(s){this.loggingService.catch("Error in NotificationService getClientNotificationObject: ",s);return}}getNotificationsForYou$(){return this.notificationsForYou$.asObservable()}getNotificationsByDocumentId$(){return this.notificationsByDocumentIdMap$.asObservable().pipe(ge(e=>e?Object.keys(e??{}).map(t=>{let o=e[t].notifications||[],a=o.filter(s=>s.isUnread).length,l=o.length>0&&o[0]?.timestamp||0;return{documentId:t,notifications:e[t]?.notifications,unreadNotificationsCount:a,latestNotificationTimestamp:l,documentMetadata:e[t]?.documentMetadata}}).filter(t=>t.notifications?.length>0).sort((t,o)=>o.latestNotificationTimestamp-t.latestNotificationTimestamp):null))}getAllNotifications$(){return this.getNotificationsByDocumentId$().pipe(ge(e=>{let t=null;return e?(t=[],e.forEach(o=>{o.notifications.forEach(a=>{t?.push(a)})}),t?.sort((o,a)=>a.timestamp-o.timestamp)):null}))}processNotificationData(e){try{let t=e?.annotationData?.metadata,o=this.docService.getOrganizationConfig()?.organizationId;e.metadata=JSON.parse(JSON.stringify(this.docService.getDocumentMetadata(t?.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(t?.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(o?this.docService.getOrganizationMetadata(o)||{}:{})),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 l=t?.documentId?new Am({apiKey:a,documentId:t.documentId,organizationId:t?.organizationId}):this.docService.getDocumentPaths();e?.actionUser?.organizationId&&(e.metadata.organizationId=l?.organizationId||e.actionUser.organizationId,e.metadata.clientOrganizationId=l?.clientOrganizationId||e.actionUser.clientOrganizationId);let s=this.docService.getLocation();s&&(e.location=s?.location,e.locationId=s?.locationId),this.loggingService.log(`[NOTIFICATION] ${e?.notificationSource} ${e?.actionType}`,e);let d=this.commonDbService.getServerTimestamp(),v=this.notificationUtilsService.formatNotification(e,d);return JSON.parse(JSON.stringify(v))}catch(t){return this.loggingService.catch("Error in NotificationService processNotificationData: ",t),null}}updateNotificationDatabase(e){try{let t=Li(this.notificationsDb),o=this.processNotificationData(e);wM(t,JSON.parse(JSON.stringify(o)))}catch(t){this.loggingService.catch("Error in NotificationService updateNotificationDatabase: ",t)}}getRawNotifications$(){return this.notifications$.asObservable()}getProcessedNotifications$(){return this.processedNotifications$.asObservable()}getNotifications$(e){return this.authService.getUser$().pipe(fe(t=>t?t.organizationId?this.getAllNotifications$().pipe(fe(o=>this.notificationsForYou$.pipe(ge(a=>{if(o||a){let l=new Map;return(!e?.type||["all","documents"].includes(e.type))&&(o||[]).forEach(s=>{s.id&&l.set(s.id,s)}),(!e?.type||["all","forYou"].includes(e.type))&&(a||[]).forEach(s=>{s.id&&!l.has(s.id)&&l.set(s.id,s)}),Array.from(l.values()).sort((s,d)=>(d.timestamp||0)-(s.timestamp||0))}else return null})))):this.notificationsByIdMap$.asObservable().pipe(ge(o=>Array.from(o.values())),ge(o=>o.sort((a,l)=>l.timestamp-a.timestamp)),Vp()):ce(null)),xt(Qt))}getRawNotificationById(e){try{return this.rawNotificationsByIdMap$.getValue()?.get(e)}catch(t){this.loggingService.catch("Error in NotificationService getRawNotificationById: ",t);return}}setNotificationViews(e){try{this.notificationViews$.next(e),this.setNotificationsByIdMap()}catch(t){this.loggingService.catch("Error in NotificationService setNotificationViews: ",t)}}getNotificationHeadlineMessage(e){try{let t=this.authService.getUser();if(e?.displayHeadlineMessageTemplate&&e?.displayHeadlineMessageTemplateData){let o=e.displayHeadlineMessageTemplate,a=e.displayHeadlineMessageTemplateData,l=/\{(\w+)\}/g,s=o.replace(l,(d,v)=>(v==="actionUser"||v==="recipientUser")&&a[v]?t?.email&&a[v].email===t?.email||t?.userId&&a[v]?.userId===t?.userId?"You":a[v].name||a[v].email||' <velt-skeleton-loader width="50px" height="20px" border-radius="4px"></velt-skeleton-loader> ':a[v]?a[v]:d);return this.domService.sanitizeHtml(s)}return this.domService.sanitizeHtml(e.displayHeadlineMessageTemplate||"")}catch(t){return this.loggingService.catch("Error in NotificationService getNotificationHeadlineMessage: ",t),""}}getNotificationBodyMessage(e){try{if(e?.displayBodyMessageTemplate&&e?.displayBodyMessageTemplateData){let t=e?.displayBodyMessageTemplate;return e?.displayBodyMessageTemplateData&&e?.displayBodyMessageTemplateData?.users?.forEach(o=>{if(o?.userId){let a=this.usersService.getUserById(o?.userId);t=t?.replaceAll(`{{${o.userId}}}`,a?.name||a?.email||'<velt-skeleton-loader width="50px" height="20px" border-radius="4px"></velt-skeleton-loader>'),t=t?.replaceAll(`@User ${o.userId}`,a?.name||a?.email||'<velt-skeleton-loader width="50px" height="20px" border-radius="4px"></velt-skeleton-loader>')}}),this.domService.sanitizeHtml(t)}return this.domService.sanitizeHtml(e.displayBodyMessage||"")}catch(t){return this.loggingService.catch("Error in NotificationService getNotificationBodyMessage: ",t),""}}setHistoryPanelVisibility(e,t=!1,o=!1){try{e?document.querySelector(V.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL)?this.historyPanelVisible$.next(e):this.loggingService.catch("Error in NotificationService setHistoryPanelVisibility: ",`<${V.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL}> tag is not added.`):this.historyPanelVisible$.next(e),e?this.analyticsService.trackEvent(Y.Events.Notifications.NOTIFICATION_HISTORY_PANEL_OPENED):this.analyticsService.trackEvent(Y.Events.Notifications.NOTIFICATION_HISTORY_PANEL_CLOSED)}catch{this.loggingService.catch("Error in NotificationService setHistoryPanelVisibility: ",`<${V.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL}> tag is not added.`)}}toggleHistoryPanelVisibility(e=!1,t=!1){try{this.historyPanelVisible$.value?this.historyPanelVisible$.next(!this.historyPanelVisible$.value):document.querySelector(V.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL)?(this.historyPanelVisible$.next(!this.historyPanelVisible$.value),this.historyPanelVisible$.value?this.analyticsService.trackEvent(Y.Events.Notifications.NOTIFICATION_HISTORY_PANEL_TOGGLED,{action:"closed"}):this.analyticsService.trackEvent(Y.Events.Notifications.NOTIFICATION_HISTORY_PANEL_TOGGLED,{action:"opened"})):this.loggingService.catch("Error in NotificationService toggleHistoryPanelVisibility: ",`<${V.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL}> tag is not added.`)}catch{this.loggingService.catch("Error in NotificationService toggleHistoryPanelVisibility: ",`<${V.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL}> tag is not added.`)}}getHistoryPanelVisibility$(){return this.historyPanelVisible$.asObservable()}setNotificationsAsRead(e){return X(this,null,function*(){try{let t=JSON.parse(JSON.stringify(this.getUserNotificationsFromServer()??[]));if(e?.length){for(let s=0;s<e.length;s+=50){let v=e.slice(s,s+50).filter(k=>k?.id),u=v.map(k=>this.setNotificationAsRead({notification:k,userNotifications:JSON.parse(JSON.stringify(t))})),S=yield Promise.all(u);v.forEach((k,A)=>{let P=S[A];if(!P.some(W=>W.notificationId===k.id))t=t.filter(W=>W.notificationId!==k.id);else{let W=t.find(ye=>ye.notificationId===k.id),te=P.find(ye=>ye.notificationId===k.id);W&&te?.views&&(W.views=te.views)}})}let a=JSON.parse(JSON.stringify(this.notificationsByDocumentIdMap$.getValue()||{}));e.forEach(s=>{let d=s.metadata?.documentId;if(d&&a?.[d]){let v=a?.[d]?.notifications||[],u=v.find(S=>S.id===s.id);u&&(u.isUnread=!1),a[d].notifications=v}}),this.notificationsByDocumentIdMap$.next(a),!Ei(t,this.getUserNotificationsFromServer())&&this.setUserNotificationsFromServer(t)}}catch(t){this.loggingService.catch("Error in NotificationService setNotificationsAsRead: ",t)}})}setAllNotificationsAsRead(e){return X(this,null,function*(){try{if(e?.tabId==="for-you"){let t=this.notificationsForYou$.value||[];this.setNotificationsAsRead(t)}else this.getNotifications$().pipe(st(1)).subscribe(t=>{t&&this.setNotificationsAsRead(t)})}catch(t){this.loggingService.catch("Error in NotificationService setAllNotificationsAsRead: ",t)}})}getUnreadNotificationsCount$(){try{return this.notificationsForYou$.pipe(ge(e=>e?.filter(o=>o?.isUnread)?.length??null),fe(e=>this.getNotifications$().pipe(ge(t=>{let o=t?.filter(a=>a?.isUnread)?.length??null;return{forYou:e,all:o}}))))}catch(e){return this.loggingService.catch("Error in NotificationService getUnreadNotificationsCount$: ",e),ce({forYou:null,all:null})}}setNotificationAsRead(o){return X(this,arguments,function*({notification:e,userNotifications:t}){try{let a=this.authService.getUser();if(a&&e?.id){let l=Et(a?.userId),{metadata:s}=e;if(s){let{apiKey:d,organizationId:v,documentId:u}=s;if(d&&v&&u&&l){let S=yield this.commonDbService.getData({feature:"docNotification",properties:{id:e.id,organizationId:v,documentId:u,apiKey:d}});S?.notificationId&&(S?.views?.[l]||(S.views||(S.views={}),S.views[l]={timestamp:Date.now()},this.commonDbService.updateData({feature:"docNotificationViews",properties:{id:e.id,organizationId:v,documentId:u,apiKey:d},data:S})));let k=yield this.commonDbService.getData({feature:"userNotification",properties:{id:e.id,userId:l,documentId:u,organizationId:v}});if(k?.notificationId){if(!this.getReadNotificationsOnForYouTab())yield this.commonDbService.deleteData({feature:"userNotification",properties:{id:e.id,userId:l,documentId:u,organizationId:v}}),t=t.filter(A=>A.notificationId!==e.id);else if(!k?.views?.[l]){k.views||(k.views={}),k.views[l]={timestamp:Date.now()};let A=t.find(P=>P.notificationId===e.id);A&&(A.views=k.views),this.commonDbService.updateData({feature:"userNotificationViews",properties:{id:e.id,userId:l,documentId:u,organizationId:v},data:k})}}}}}return t}catch(a){return this.loggingService.catch("Error in NotificationService setNotificationAsRead: ",a),t}})}setMaxDays(e){try{e>0?this.maxNotificationDays$.next(e):this.maxNotificationDays$.next(15)}catch(t){this.loggingService.catch("Error in NotificationService setMaxDays: ",t)}}setTabConfig(e){try{e&&this.tabConfig$.next(e)}catch(t){this.loggingService.catch("Error in NotificationService setTabConfig: ",t)}}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}enableCurrentDocumentOnly(){try{if(this.currentDocumentOnly$.value===!0)return;this.currentDocumentOnly$.next(!0)}catch(e){this.loggingService.catch("Error in NotificationService enableCurrentDocumentOnly: ",e)}}disableCurrentDocumentOnly(){try{if(this.currentDocumentOnly$.value===!1)return;this.currentDocumentOnly$.next(!1)}catch(e){this.loggingService.catch("Error in NotificationService disableCurrentDocumentOnly: ",e)}}getCurrentDocumentOnly$(){return this.currentDocumentOnly$.asObservable()}getCurrentDocumentOnly(){return this.currentDocumentOnly$.value}markNotificationAsReadById(e){return X(this,null,function*(){try{this.getNotifications$().pipe(st(1)).subscribe(t=>{if(t){let o=t.filter(a=>a.id===e);this.setNotificationsAsRead(o)}})}catch(t){this.loggingService.catch("Error in NotificationService markNotificationAsReadById: ",t)}})}getAllowedDocumentMetadataByDocumentId(e){try{return this.allowedDocumentMetadataMap$.value?.[e]||null}catch(t){return this.loggingService.catch("Error in NotificationService getAllowedDocumentMetadataByDocumentId: ",t),null}}setSettingsConfig(e){try{this.enableSettings$.value&&this.settingsConfig$.next(e)}catch(t){this.loggingService.catch("Error in NotificationService setSettingsConfig: ",t)}}setSettingsConfigWithDB(e){try{this.enableSettings$.value&&(this.settingsConfig$.next(e),this.updateSettingsConfigToDb())}catch(t){this.loggingService.catch("Error in NotificationService setSettingsConfigWithDB: ",t)}}getSettingsConfig$(){return this.settingsConfig$.asObservable()}getSettingsConfig(){return this.settingsConfig$.value}setMuteAllNotifications(){try{this.muteAllNotifications$.value!==!0&&this.muteAllNotifications$.next(!0)}catch(e){this.loggingService.catch("Error in NotificationService setSettingsMuteAll: ",e)}}getMuteAllNotifications$(){return this.muteAllNotifications$.asObservable()}getMuteAllNotifications(){return this.muteAllNotifications$.value}enableSettings(){try{this.enableSettings$.value!==!0&&this.enableSettings$.next(!0)}catch(e){this.loggingService.catch("Error in NotificationService enableSettings: ",e)}}enableSettingsConfigByOrganization(){try{this.getSettingsConfigByOrganization()!==!0&&this.setSettingsConfigByOrganization$.next(!0)}catch(e){this.loggingService.catch("Error in NotificationService enableSettingsConfigByOrganization: ",e)}}disableSettingsConfigByOrganization(){try{this.getSettingsConfigByOrganization()!==!1&&this.setSettingsConfigByOrganization$.next(!1)}catch(e){this.loggingService.catch("Error in NotificationService disableSettingsConfigByOrganization: ",e)}}getSettingsConfigByOrganization$(){return this.setSettingsConfigByOrganization$.asObservable()}getSettingsConfigByOrganization(){return this.setSettingsConfigByOrganization$.value}enableSelfNotifications(){try{this.selfNotifications$.value!==!0&&this.selfNotifications$.next(!0)}catch(e){this.loggingService.catch("Error in NotificationService enableSelfNotifications: ",e)}}disableSelfNotifications(){try{this.selfNotifications$.value!==!1&&this.selfNotifications$.next(!1)}catch(e){this.loggingService.catch("Error in NotificationService disableSelfNotifications: ",e)}}disableSettings(){try{this.enableSettings$.value!==!1&&this.enableSettings$.next(!1)}catch(e){this.loggingService.catch("Error in NotificationService disableSettings: ",e)}}getEnableSettings$(){return this.enableSettings$.asObservable()}getEnableSettings(){return this.enableSettings$.value}setSettingsInitialConfig(e){try{let t=!1;if(e.forEach(o=>{["email","inbox"].includes(o.id)&&(t=!o.values?.every(a=>["ALL","NONE","MINE"].includes(a.id)))}),t){this.loggingService.catch("Invalid config values for email or inbox, It should have only ALL, NONE, MINE values");return}this.settingsInitialConfig$.next(e)}catch(t){this.loggingService.catch("Error in NotificationService setSettingsInitialConfig: ",t)}}getSettingsInitialConfig$(){return this.settingsInitialConfig$.asObservable()}getSettingsInitialConfig(){return this.settingsInitialConfig$.value}updateSettingsConfigToDb(e){return X(this,null,function*(){try{let t=this.authService.getUser(),o=Et(t?.userId??""),a=this.docService.getDocumentPaths(),l=this.docService.getOrganizationConfig(),s=a?.organizationId??l?.organizationId,d=a?.clientOrganizationId??l?.clientOrganizationId,v={apiKey:this.configService.getApiKey(),organizationId:s,documentId:a?.documentId,clientOrganizationId:d,clientDocumentId:a?.clientDocumentId,userId:o,clientUserId:this.authService.getUser()?.userId};o&&this.getEnableSettings()&&this.enableSettings$.value&&(this.getSettingsConfigByOrganization()?this.docService.addUserInfoToOrganization({organizationId:d??t?.clientOrganizationId??"",user:{userId:t?.userId??""},notificationsConfig:e||this.settingsConfig$.getValue()}):a?.documentId&&(yield this.commonDbService.updateData({feature:"userConfig",properties:{documentId:a?.documentId,userId:o},data:{id:a?.documentId,notificationsConfig:e||this.settingsConfig$.getValue(),metadata:v}})))}catch(t){this.loggingService.catch("Error in NotificationService updateSettingsConfigToDb: ",t)}})}openNotificationsPanel(){try{this.notificationsPanelVisible$.next(!0)}catch(e){this.loggingService.catch("Error in NotificationService openNotificationsPanel: ",e)}}closeNotificationsPanel(){try{this.notificationsPanelVisible$.next(!1)}catch(e){this.loggingService.catch("Error in NotificationService closeNotificationsPanel: ",e)}}getNotificationsPanelVisible$(){return this.notificationsPanelVisible$.asObservable()}getNotificationsPanelVisible(){return this.notificationsPanelVisible$.value}};r.\u0275fac=function(t){return new(t||r)(J(Gi),J(rt),J(Ge),J(Lt),J(xn),J(Mm),J(ku),J(vs),J(On),J(lt),J(Ve),J(An),J(x),J(OR),J(Dn),J(Lr),J(bl),J(pi))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var nr=(()=>{let r=class r{constructor(e){this.loggingService=e,this._customStatusMap=new be(V.CommentAnnotationStatusMap),this._customPriorityMap=new be(V.CommentAnnotationPriorityMap),this._customCategoryMap=new be(V.CommentCategoryMap);try{let t=sessionStorage.getItem(V.SESSION_STORAGE.VELT_CUSTOM_PRIORITY_MAP);t&&this._customPriorityMap.next(JSON.parse(t));let o=sessionStorage.getItem(V.SESSION_STORAGE.VELT_CUSTOM_STATUS_MAP);o&&this._customStatusMap.next(JSON.parse(o));let a=sessionStorage.getItem(V.SESSION_STORAGE.VELT_CUSTOM_CATEGORY_MAP);a&&this._customCategoryMap.next(JSON.parse(a))}catch(t){this.loggingService.catch("Error in CustomFilterService constructor: ",t)}}setCustomStatusFilters(e){try{if(e.length<2){this._customStatusMap.next(V.CommentAnnotationStatusMap),sessionStorage.setItem(V.SESSION_STORAGE.VELT_CUSTOM_STATUS_MAP,JSON.stringify(V.CommentAnnotationStatusMap)),this.loggingService.catch("Custom status filters must have at least 2 filters");return}let t={};e.forEach(o=>{t[o.id]=o,o.type||(o.type="ongoing")}),this._customStatusMap.next(t),sessionStorage.setItem(V.SESSION_STORAGE.VELT_CUSTOM_STATUS_MAP,JSON.stringify(t))}catch(t){this.loggingService.catch("Error in CustomFilterService setCustomStatusFilters: ",t)}}setCustomPriorityFilters(e){try{if(e.length<2){this._customPriorityMap.next(V.CommentAnnotationPriorityMap),sessionStorage.setItem(V.SESSION_STORAGE.VELT_CUSTOM_PRIORITY_MAP,JSON.stringify(V.CommentAnnotationPriorityMap)),this.loggingService.catch("Custom priority filters must have at least 2 filters");return}let t={};e.forEach(o=>{t[o.id]=o}),this._customPriorityMap.next(t),sessionStorage.setItem(V.SESSION_STORAGE.VELT_CUSTOM_PRIORITY_MAP,JSON.stringify(t))}catch(t){this.loggingService.catch("Error in CustomFilterService setCustomPriorityFilters: ",t)}}setCustomCategories(e){try{let t={};e.forEach(o=>{t[o.id]=o}),this._customCategoryMap.next(t),sessionStorage.setItem(V.SESSION_STORAGE.VELT_CUSTOM_CATEGORY_MAP,JSON.stringify(t))}catch(t){this.loggingService.catch("Error in CustomFilterService setCustomCategories: ",t)}}get customStatusMap$(){return this._customStatusMap.asObservable()}get customPriorityMap$(){return this._customPriorityMap.asObservable()}get customCategoryMap$(){return this._customCategoryMap.asObservable()}get defaultStatus(){try{let t=Object.entries(this._customStatusMap.value).find(([o,a])=>a.type==="default");if(t)return t[1]}catch(e){this.loggingService.catch("Error in CustomFilterService defaultStatus: ",e)}return V.CommentAnnotationStatusMap.OPEN}get resolvedStatus(){try{let t=Object.entries(this._customStatusMap.value).find(([o,a])=>a.type==="terminal");if(t)return t[1]}catch(e){this.loggingService.catch("Error in CustomFilterService resolvedStatus: ",e)}return V.CommentAnnotationStatusMap.OPEN}get ongoingStatuses(){try{let t=Object.entries(this._customStatusMap.value).filter(([o,a])=>a.type==="ongoing");if(t)return t.map(o=>o[1])}catch(e){this.loggingService.catch("Error in CustomFilterService ongoingStatuses: ",e)}return[V.CommentAnnotationStatusMap.IN_PROGRESS]}convertLegacyAnnotationStatus(e){try{if(typeof e.status=="string"||e.status===void 0){let t=Object.entries(this._customStatusMap.value),o=t.find(([a,l])=>l.type==="default");switch(e.status){case"open":o&&(e.status=o[1]);break;case"inProgress":let a=t.find(([s,d])=>d.type==="ongoing");a&&(e.status=a[1]);break;case"resolved":let l=t.find(([s,d])=>d.type==="terminal");l&&(e.status=l[1]);break;default:o&&(e.status=o[1]);break}}return e}catch(t){return this.loggingService.catch("Error in CustomFilterService convertLegacyAnnotation: ",t),e}}convertLegacyPriority(e){try{typeof e.priority=="string"&&(e.priority=V.CommentAnnotationPriorityMap[e.priority])}catch(t){this.loggingService.catch("Error in CustomFilterService convertLegacyPriority: ",t)}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(t=>V.CommentCategoryMap[t]))}catch(t){this.loggingService.catch("Error in CustomFilterService convertLegacyCategory: ",t)}return e}};r.\u0275fac=function(t){return new(t||r)(J(x))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var Rm=(()=>{let r=class r{static uniquifySvgIds(e){let t=`v${++r.idCounter}`,o=/\bid="([^"]+)"/g,a=[],l;for(;(l=o.exec(e))!==null;)a.push(l[1]);let s=e;for(let d of a){let v=d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),u=`${d}_${t}`;s=s.replace(new RegExp(`\\bid="${v}"`,"g"),`id="${u}"`),s=s.replace(new RegExp(`url\\(#${v}\\)`,"g"),`url(#${u})`),s=s.replace(new RegExp(`href="#${v}"`,"g"),`href="#${u}"`)}return s}constructor(e,t,o){this.domService=e,this.loggingService=t,this.sanitizer=o,this.emojis={},this.emojisSignal=Oe({}),this.rawSvgs={};try{this.loggingService.log("%c[WB] Creating CLASS: EmojiService","color: blue;"),Object.keys(r.Icons).forEach(a=>{let l=r.Icons[a];this.rawSvgs[a]=l,this.emojis[a]=this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeSvg(r.uniquifySvgIds(l)))}),Object.keys(r.GIF_PATHS).forEach(a=>{let l=`<img src="${r.GIF_PATHS[a]}" alt="${a}" />`;this.emojis[a]=this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeHtml(l))}),this.emojisSignal.set(b({},this.emojis))}catch(a){this.loggingService.catch("Error in EmojiService constructor: ",a)}}getEmoji(e){try{let t=this.rawSvgs[e];return t?this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeSvg(r.uniquifySvgIds(t))):this.emojis[e]}catch{return""}}getEmojiFromIconUrl(e){try{return this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeHtml(`<img src="${e}" alt="emoji" />`))}catch{return""}}getEmojiFromIconEmoji(e,t){try{let o=`<span class="velt-emoji-icon velt-emoji-icon--emoji">${e}</span>`;return t&&(o=`<span class="velt-emoji-icon velt-emoji-icon--emoji" emoji-id=${t}>${e}</span>`),this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeHtml(o))}catch{return""}}setEmojiList(e){try{this.emojis={},this.rawSvgs={},Object.keys(e).forEach(t=>{let o=e[t];if(o.svg)this.rawSvgs[t]=o.svg,this.emojis[t]=this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeSvg(r.uniquifySvgIds(o.svg)));else if(o.url){let a=`<img src="${o.url}" alt="${t}" />`;this.emojis[t]=this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeHtml(a))}else o.emoji&&(this.emojis[t]=this.getEmojiFromIconEmoji(this.domService.sanitizeHtml(o.emoji)))}),this.emojisSignal.set(b({},this.emojis))}catch(t){this.loggingService.catch("Error in EmojiService setEmojiList: ",t)}}};r.idCounter=0,r.Icons={RAISED_HANDS:`<svg width="58" height="57" viewBox="0 0 58 57" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
222
|
+
`+$a),Rd&&SR([He,$e,br],Cs=>{$a=rk($a,Cs," ")}),me&&_p?me.createHTML($a):$a},r.setConfig=function(){let vn=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};d0(vn),a0=!0},r.clearConfig=function(){Rc=null,a0=!1},r.isValidAttribute=function(vn,We,Rt){Rc||d0({});let an=Oo(vn),Dr=Oo(We);return m0(an,Dr,Rt)},r.addHook=function(vn,We){typeof We=="function"&&ik(Ue[vn],We)},r.removeHook=function(vn,We){if(We!==void 0){let Rt=xUe(Ue[vn],We);return Rt===-1?void 0:IUe(Ue[vn],Rt,1)[0]}return Jve(Ue[vn])},r.removeHooks=function(vn){Ue[vn]=[]},r.removeAllHooks=function(){Ue=rue()},r}var sk=sue();var cue={ADD_TAGS:["velt-skeleton-loader"],ADD_ATTR:["border-radius","target"]},Ve=(()=>{let r=class r{constructor(e,t,o,a){this.analyticsService=e,this.rendererFactory2=t,this.loggingService=o,this.sanitizer=a,this.isVideoEditorHandlingDelete=!1,this.pageScrollHeight=0,this.enableRectSelectionSubject$=new be(!1),this.enableRectSelection$=this.enableRectSelectionSubject$.asObservable(),this.scrollableElementsIds$=new be([]),this.mousedown=!1,this.windowMouseDown$=new nt,this.windowPointerMove$=new be(null),this.windowPointerUp$=new be(null),this.documentSelectionChange$=new be(null),this.windowClick$=new be(null),this.windowScroll$=new be(null),this.windowResize$=new be(null),this.windowKeyupBackspace$=new be(null),this.windowKeyupDelete$=new be(null),this.windowKeyupEsc$=new be(null),this.windowPopState$=new be(null),this.documentClick$=new be(null),this.documentClickSubject$=new nt,this.documentFocus$=new be(null),this.windowKeydownShift$=new be(null),this.windowKeyupShift$=new be(null),this.mutation$=new be(null),this.childListMutation$=new be(null),this.networkStatus$=new be(!1),this.xpathCache=new Map,this.xpathCacheId=new Map,this.selectedAnnotationsMap$=new be({}),this.selectedAnnotationsLocationMap$=new be({}),this.recordingInProgress$=new be({}),this.deleteAnnotations$=new be([]),this.pinHighlighterClass$=new be(null),this.dialogOpenedInSidebar$=new be(!1),this.textHighlighterClass$=new be(null),this.commentPinHighlighter$=new be(!1),this.deviceInfo$=new be(new ii),this.customCss$=new be(null),this.mutationObserver=null,this.animationFilterEnabled=!1,this.animationLibraryDetected=null,this.staticAnimationCache=new WeakMap,this.ANIMATION_LIBRARY_SELECTOR=["[data-gsap]",".gsap-marker-start",".gsap-marker-end","[data-gsap-id]",".swiper-slide",".swiper-wrapper",".swiper-pagination",".swiper-pagination-bullet","[data-aos]"].join(", "),this.previousMousePosition={pageX:0,pageY:0,clientX:0,clientY:0},this.currentMousePosition={pageX:0,pageY:0,clientX:0,clientY:0,element:{xpath:"",topPercentage:0,leftPercentage:0}},this.nodeMap={},this.unlistenElementScroll={},this.tabId=null,this.dynamicIdPatterns=[/^yui_[a-z0-9_]+$/i],this.excludeClassList=["show-pin-cursor"],this.filterSnippylyNodes=l=>{try{let s=[];return l.forEach(d=>{if(!lr(d))if(d instanceof HTMLElement){if(d.className.includes("cdk-overlay-container")||d.className.includes("cdk-overlay-connected-position-bounding-box"))return;if(d.className.includes("cdk-overlay")){let v=!1;d.childNodes.forEach(u=>{lr(u)&&(v=!0)}),v||s.push(d)}else s.push(d)}else s.push(d)}),s}catch(s){return this.loggingService.catch("Error in DomService filterSnippylyNodes: ",s),[]}},this.loggingService.log("%c[WB] Creating CLASS: DomService","color: blue;");try{this.analyticsService.setDomService(this),this.renderer=this.rendererFactory2.createRenderer(null,null);let l=this.calculateScreenSize();this.currentScreenSize$=new be(l),this.currentMousePosition$=new be(this.currentMousePosition),this.detectNetworkStatusChange(),this.getScrollableElementsIds$().pipe(Vi(),rn(([s,d])=>{try{let v=d.filter(S=>!s.includes(S)),u=s.filter(S=>!d.includes(S));u.length&&u.map(k=>document.getElementById(k)).filter(k=>k).forEach(k=>{this.unlistenElementScroll&&this.unlistenElementScroll[k.id]&&this.unlistenElementScroll[k.id]()}),v.length&&v.map(k=>document.getElementById(k)).filter(k=>k).forEach(k=>{this.unlistenElementScroll[k.id]=this.renderer.listen(k,"scroll",A=>{let P=this.calculateScreenSize();this.currentScreenSize$.next(P)})})}catch(v){this.loggingService.catch("Error in DomService getScrollableElementsIds subscription: ",v)}})).subscribe(()=>{},s=>{this.loggingService.catch("Error in DomService getScrollableElementsIds subscription: ",s)}),this.getSelectedAnnotationsMap$().subscribe(s=>{Object.keys(s||{})?.length?Mde("snippylyUserScalableNo","viewport","width=device-width, user-scalable=no"):Rde("snippylyUserScalableNo")},s=>{this.loggingService.catch("Error in DomService getSelectedAnnotationsMap$ subscription: ",s)})}catch(l){this.loggingService.catch("Error in DomService constructor: ",l)}}setDocService(e){try{this.docService=e,this.subscribeToDomEvents()}catch(t){this.loggingService.catch("Error in DomService setDocService: ",t)}}setDynamicIdPatterns(e){try{let t=e.map(o=>typeof o=="string"?new RegExp(o):o).filter(Boolean);t.length&&(this.dynamicIdPatterns=t)}catch(t){this.loggingService.catch("Error in DomService setDynamicIdPatterns: ",t)}}isLikelyDynamicId(e){try{return e?this.dynamicIdPatterns.some(t=>t.test(e)):!1}catch{return!1}}getStableAttributes(e){try{let t={};if(!e.getAttributeNames)return t;let o=new Set(["id","class","style"]);return e.getAttributeNames().forEach(l=>{if(o.has(l)||l.includes("snippyly")||l.includes("velt"))return;let s=e.getAttribute(l);s&&s.length<=256&&(t[l]=s)}),t}catch{return{}}}buildStableElementSelector(e,t){try{if(Object.keys(t).length===0)return;let a=[e.tagName?.toLowerCase()],l=["data-","aria-","role","name","title","type"];return Object.keys(t).sort((d,v)=>{let u=l.findIndex(k=>d.startsWith(k)),S=l.findIndex(k=>v.startsWith(k));return(u===-1?99:u)-(S===-1?99:S)}).slice(0,4).forEach(d=>{let v=CSS.escape(t[d]);a.push(`[${d}="${v}"]`)}),a.join("")}catch{return}}getVisibleText(e,t=400){try{let o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null),a="",l,s=0;for(;(l=o.nextNode())&&a.length<t;){let d=(l.textContent||"").replace(/\s+/g," ").trim();if(d&&(a+=(a?" ":"")+d),s++,s>100)break}return a.slice(0,t)}catch{return""}}hashText(e){try{return Sde(e)}catch{return}}generateRobustXPath(e,t){try{let o=t?.maxDepth||10,a=t?.useAbsolutePath||!1,l=[],s=e,d=0;for(;s&&s!==document.documentElement&&d<o;){let k=this.buildRobustXPathSegment(s);if(k&&(l.unshift(k),this.isStrongAnchorSegment(k)))break;s=s.parentElement,d++}if(l.length===0)return;let u=(a?"/":"//")+l.join("/");return l.some(k=>k.includes("[@")||k.includes("[contains(@class"))?u:void 0}catch{return}}buildRobustXPathSegment(e){try{let t=e.tagName.toLowerCase(),o=e.id;if(o&&!this.isLikelyDynamicId(o)&&document.querySelectorAll(`[id="${CSS.escape(o)}"]`).length===1)return`*[@id=${this.escapeXPathValue(o)}]`;let a=["data-region","data-instanceid","data-action","data-key","data-block","data-activityid"];for(let k of a){let A=e.getAttribute(k);if(A)return`${t}[@${k}=${this.escapeXPathValue(A)}]`}let l=Array.from(e.attributes).filter(k=>k.name.startsWith("data-")&&!k.name.includes("snippyly")&&!k.name.includes("velt")&&k.value.length<100).sort((k,A)=>k.value.length-A.value.length);if(l.length>0){let k=l[0];return`${t}[@${k.name}=${this.escapeXPathValue(k.value)}]`}let s=e.getAttribute("role");if(s)return`${t}[@role=${this.escapeXPathValue(s)}]`;let d=e.getAttribute("aria-label");if(d&&d.length<50)return`${t}[@aria-label=${this.escapeXPathValue(d)}]`;let v=e.getAttribute("name");if(v)return`${t}[@name=${this.escapeXPathValue(v)}]`;let u=e.getAttribute("type");if(u)return`${t}[@type=${this.escapeXPathValue(u)}]`;let S=Array.from(e.classList||[]).filter(k=>k.length>0&&k.length<40&&!k.includes("yui")&&!k.includes("velt")&&!k.includes("snippyly")&&!this.excludeClassList.includes(k)).slice(0,2);if(S.length>0){let k=S.map(A=>`contains(@class, ${this.escapeXPathValue(A)})`).join(" and ");return`${t}[${k}]`}if(e.parentElement){let k=Array.from(e.parentElement.children).filter(A=>A.tagName===e.tagName);if(k.length>1){let A=k.indexOf(e)+1;return`${t}[${A}]`}}return t}catch{return}}isStrongAnchorSegment(e){try{return!!(e.includes("[@id=")||["main","navigation","banner","contentinfo","complementary","search"].some(a=>e.includes(`[@role='${a}']`))||["data-region","data-instanceid","data-activityid"].some(a=>e.includes(`[@${a}=`)))}catch{return!1}}escapeXPathValue(e,t=!0){try{return e.includes("'")?e.includes('"')?`concat(${e.split("'").map(l=>`'${l}'`).join(`,"'",`)})`:t?`"${e}"`:e:t?`'${e}'`:e}catch{try{return`concat(${e.split("'").map(s=>`'${s}'`).join(`,"'",`)})`}catch{return t?`'${e}'`:e}}}getElementFromRobustXPath(e){try{return document.evaluate(e,document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue}catch{return null}}getAllElementsFromRobustXPath(e){try{let t=document.evaluate(e,document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null),o=[];for(let a=0;a<t.snapshotLength;a++){let l=t.snapshotItem(a);l instanceof Element&&o.push(l)}return o}catch{return[]}}generateAnchorRecord(e,t){try{let o=this.generateAnchorRecordForElement(e,t),a=null;if(e.parentElement&&e.parentElement instanceof HTMLElement&&$i(e.parentElement)&&e.parentElement!==document.body&&(a=e.parentElement),o&&a){let l=this.generateAnchorRecordForElement(a,t);l&&(o.parent=l)}return o}catch(o){return this.loggingService.catch("Error in DomService generateAnchorRecord: ",o),null}}generateAnchorRecordForElement(e,t){try{if(!e)return null;let o=e,a=o.tagName?.toUpperCase();if(!a)return null;let l=o.id&&!this.isLikelyDynamicId(o.id)?o.id:void 0,s=this.getStableAttributes(o),d=this.buildStableElementSelector(o,s),v=this.getVisibleText(o),u=this.hashText(v||""),S=this.generateRobustXPath(o),k=this.getXPath(o),A=this.getXPath(o,!0),P=this.getXPath(o,!0,!0);return{version:"1.0",id:l,tagName:a,elementSelector:d,robustXPath:S||void 0,xPath:k||void 0,fXPath:A||void 0,cfXPath:P||void 0,contentHash:u?{value:u,algorithm:"md5",source:"textContent"}:void 0,createdAt:Date.now()}}catch(o){return this.loggingService.catch("Error in DomService generateAnchorRecordForElement: ",o),null}}resolveAnchorRecord(e){try{let t=[],o=null,a=(u,S,k=0)=>{let A=[],P=k;if(A.push({method:S,score:k}),e.tagName&&u.tagName?.toUpperCase()===e.tagName&&(P+=10,A.push({method:"tagName-match",score:10})),e.contentHash?.value){let U=this.getVisibleText(u);this.hashText(U)===e.contentHash.value&&(P+=30,A.push({method:"contentHash-match",score:30}))}t.push({el:u,score:P,by:S,scoreBreakdown:A})};if(e.id){let u=document.querySelectorAll(`#${CSS.escape(e.id)}`);if(u.length===1)return{element:u[0],matchedBy:"id",score:90};u.length>1&&u.forEach(S=>a(S,"id-duplicate",70))}if(e.elementSelector){let u=document.querySelectorAll(e.elementSelector);if(u.length===1)return{element:u[0],matchedBy:"element-selector",score:80};u.forEach(S=>a(S,"element-selector-duplicate",60))}e.robustXPath&&this.getAllElementsFromRobustXPath(e.robustXPath).slice(0,20).forEach(A=>a(A,"robustXPath",50)),e?.parent&&(o=this.resolveAnchorRecord(e.parent),o.element&&o.element.querySelectorAll(e.tagName?.toLowerCase()||"*").forEach(S=>a(S,"parent+tag",40)));let l=(u,S,k)=>{if(!u)return;let A=this.getElementFromXPath(u);A&&a(A,S||"xpath",k||30)};if(l(e.xPath,"xPath",30),l(e.cfXPath,"cfXPath",30),l(e.fXPath,"fXPath",30),e.contentHash?.value&&t.length===0){let S=k=>{let A=0;for(let P=0;P<k.length&&A<400;P++){let U=k[P];if(A++,!this.isElementVisible(U))continue;let W=this.getVisibleText(U),te=this.hashText(W);te&&te===e.contentHash?.value&&a(U,"contentHash",15)}};if(o?.element&&o?.element instanceof Element){let k=o?.element?.querySelectorAll("*");S(k)}}if(!t.length)return{element:null};t.sort((u,S)=>S.score-u.score);let s=t[0].score,d=t.filter(u=>u.score===s);if(d.length>1){let u=[{path:e.xPath,label:"xPath"},{path:e.cfXPath,label:"cfXPath"},{path:e.fXPath,label:"fXPath"}];for(let S of u)if(S.path){let k=this.getElementFromXPath(S.path);if(k){let A=d.find(P=>P.el===k);if(A)return{element:A.el,matchedBy:`${A.by}+position`,score:A.score,scoreBreakdown:A.scoreBreakdown}}}}let v=t[0];return{element:v.el,matchedBy:v.by,score:v.score,scoreBreakdown:v.scoreBreakdown}}catch(t){return this.loggingService.catch("Error in DomService resolveAnchorRecord: ",t),{element:null}}}subscribeToDomEvents(){try{this.docService?.getDocumentPaths$().pipe(ge(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.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.unsubscribeFromDocumentFocus(),this.unsetMutationObserver())})).subscribe(),this.onDocumentClick()}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(t){this.loggingService.catch("Error in DomService setScrollableElementsIds: ",t)}}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.animationFilterEnabled=this.detectAnimationLibraries(),this.loggingService.log("%c[WB] Animation filter:","color: green;",this.animationFilterEnabled?"ENABLED (library detected)":"DISABLED (no library)"),this.mutationObserver=new MutationObserver(t=>{try{if(t?.find(a=>a?.attributeName===V.VELT_IGNORE_CHANGE_DETECTION))return;let o=t.filter(a=>a.type==="childList").filter(a=>{let l=a.target;return a.removedNodes.forEach(s=>{let d=s;if(typeof d.getAttribute=="function"){let v=d.getAttribute(V.ATTRIBUTES.VELT_ELEMENT_CACHE_ID);if(v!==null&&v!==""){let u=this.xpathCacheId.get(v);u!==void 0&&(this.xpathCacheId.delete(v),this.xpathCache.delete(u))}}}),lr(l)?!1:!!(this.filterSnippylyNodes(a.addedNodes).length||this.filterSnippylyNodes(a.removedNodes).length)});this.animationFilterEnabled?this.childListMutation$.next(o.filter(a=>!this.isAnimatingElement(a.target))):this.childListMutation$.next(o),o.push(...t.filter(a=>a.type==="attributes").filter(a=>!lr(a.target)).filter(a=>this.filterSnippylyNodes([a.target]).length).filter(a=>{if(a){let l=a.target;return l?.classList?.contains("snippyly-sidebar-panel")?!1:l?!l.getAttribute(V.VELT_IGNORE_CHANGE_DETECTION):!0}return!0})),o=o.filter(a=>{let l=!0;return Object.keys(V.INGNORE_MUTATION_OBSERVER_CHANGE_TAGS).forEach(s=>{a.target?.closest(s)&&(l=!1)}),l}),o=o.filter(a=>a.target&&$i(a.target)),this.animationFilterEnabled&&(o=o.filter(a=>!this.isAnimatingElement(a.target))),o.length&&this.mutation$.next(o)}catch(o){this.loggingService.catch("Error in DomService change detection: ",o)}}),this.mutationObserver.observe(document.body,{childList:!0,subtree:!0,attributes:!0}))}catch(t){this.loggingService.catch("Error in DomService change detection: ",t)}}detectAnimationLibraries(){try{if(this.animationLibraryDetected!==null)return this.animationLibraryDetected;let e=window;return e.gsap||e.TweenMax||e.TweenLite||e.TimelineMax||e.TimelineLite?(this.loggingService.log("%c[WB] Detected animation library: GSAP","color: green;"),this.animationLibraryDetected=!0,!0):e.Swiper?(this.loggingService.log("%c[WB] Detected animation library: Swiper","color: green;"),this.animationLibraryDetected=!0,!0):e.AOS?(this.loggingService.log("%c[WB] Detected animation library: AOS","color: green;"),this.animationLibraryDetected=!0,!0):e.anime?(this.loggingService.log("%c[WB] Detected animation library: Anime.js","color: green;"),this.animationLibraryDetected=!0,!0):e.lottie||e.Lottie||e.bodymovin?(this.loggingService.log("%c[WB] Detected animation library: Lottie","color: green;"),this.animationLibraryDetected=!0,!0):document.querySelector("[data-framer-component-type]")?(this.loggingService.log("%c[WB] Detected animation library: Framer Motion","color: green;"),this.animationLibraryDetected=!0,!0):document.querySelector(this.ANIMATION_LIBRARY_SELECTOR)?(this.loggingService.log("%c[WB] Detected animation library: DOM markers","color: green;"),this.animationLibraryDetected=!0,!0):(this.loggingService.log("%c[WB] No animation library detected","color: green;"),this.animationLibraryDetected=!1,!1)}catch{return this.animationLibraryDetected=!1,!1}}isAnimatingElement(e){try{if(!e||typeof e.closest!="function")return!1;let t=window;if(t.gsap&&typeof t.gsap.isTweening=="function"){if(t.gsap.isTweening(e))return!0;if(typeof t.gsap.getTweensOf=="function")try{if(t.gsap.getTweensOf(e).length>0)return!0}catch{}}else if(t.TweenMax&&typeof t.TweenMax.isTweening=="function"){if(t.TweenMax.isTweening(e))return!0;if(typeof t.TweenMax.getTweensOf=="function")try{if(t.TweenMax.getTweensOf(e).length>0)return!0}catch{}}let o=e.style?.cssText||"";if(o){let d=o.includes("transform")||o.includes("translate3d")||o.includes("translate(")||o.includes("scale3d")||o.includes("rotate"),v=o.includes("will-change")&&o.includes("transform"),u=o.includes("transform-style")&&o.includes("preserve-3d");if(d&&(v||u))return!0}if(e.style&&(e.style.animation!==""&&e.style.animation!=="none"||e.style.transition!==""&&e.style.transition!=="none")||e.classList?.contains("animate")||e.classList?.contains("animating")||e.classList?.contains("animated")||e.classList?.contains("animation"))return!0;let a=this.staticAnimationCache.get(e);if(a!==void 0)return a;let l=!1,s=e.className||"";return typeof s=="string"&&(s.includes("slider")&&(s.includes("bullet")||s.includes("pagination"))&&(l=!0),s.includes("swiper-pagination")&&(l=!0)),!l&&(e.hasAttribute("data-aos")||e.hasAttribute("data-motion"))&&(l=!0),!l&&e.closest(this.ANIMATION_LIBRARY_SELECTOR)&&(l=!0),this.staticAnimationCache.set(e,l),l}catch{return!1}}unsetMutationObserver(){try{this.mutationObserver&&(this.mutationObserver.disconnect(),this.mutationObserver=null,this.staticAnimationCache=new WeakMap,this.animationLibraryDetected=null,this.animationFilterEnabled=!1)}catch(e){this.loggingService.catch("Error in DomService unsetMutationObserver: ",e)}}detectNetworkStatusChange(){this.loggingService.log("%c[WB] Calling FUNCTION: detectNetworkStatusChange","color: green;");try{Sr(Oi(window,"offline").pipe(ge(()=>!1)),Oi(window,"online").pipe(ge(()=>!0)),new Gt(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 t=this.calculateScreenSize();this.deviceInfo$.next(new ii),this.currentScreenSize$.next(t)})}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 t=this.calculateScreenSize();this.currentScreenSize$.next(t)})}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()!==V.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 Oi(window,"keydown")}catch(e){return this.loggingService.catch("Error in DomService onWindowKeydown$: ",e),Js}}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 t=this.getXPath(e.target),o=e.target;if(t?.includes("name()='svg'")){let u=this.getXPath(t);u&&(o=u.iterateNext()||e.target)}let a=o.getBoundingClientRect(),l=e.clientX-a.x,s=e.clientY-a.y,d=l*100/(a.width||1),v=s*100/(a.height||1);this.currentMousePosition.element={xpath:t,topPercentage:v,leftPercentage:d}}else this.currentMousePosition.element=null;this.currentMousePosition$.next(this.currentMousePosition)}catch(t){this.loggingService.catch("Error in DomService updateCurrentMousePosition: ",t)}}getTargetElementForCursorPosition(e,t=!0,o=!1,a=!0,l,s=!0,d){try{let v=e,u=v?.touches?.length?v.touches[0]?.clientX:v?.clientX,S=v?.touches?.length?v.touches[0]?.clientY:v?.clientY;d&&(u=d.clientX,S=d.clientY);let k=this.getBackgroundElement(u,S,t,o);if(k&&l&&typeof l=="function"&&(k=l(k)),k){let A=this.getXPath(k),P=this.getXPath(k,!0),U=k.getBoundingClientRect(),W=u-U.x,te=S-U.y,ye=W*100/(U.width||1),me=te*100/(U.height||1),ke={xpath:A,fXpath:P,leftPercentage:ye,topPercentage:me};if(a){let De=this.getXPath(k,!0,!0);ke.cfXpath=De}if(s){let De=this.generateAnchorRecord(k);De&&(ke.anchor=De)}return ke}else return null}catch(v){return this.loggingService.catch("Error in DomService getTargetElementForCommentPinAnnotation: ",v),null}}getBackgroundElement(e,t,o=!0,a=!1){try{let l=document.elementsFromPoint(e,t),s=[];l.forEach(v=>{lr(v)?s=[]:$i(v)&&s.push(v)}),a&&(s=s.filter(v=>this.isElementVisibleOnScreen(v)));let d=0;return o||s?.forEach((v,u)=>{v.tagName.toLowerCase()==="svg"&&(d=u)}),s[d]}catch(l){return this.loggingService.catch("Error in DomService getBackgroundElement: ",l),null}}getBackgroundVeltElement(e,t){try{let o=document.elementsFromPoint(e,t),a=[];return o.forEach(l=>{lr(l)&&$i(l)&&a.push(l)}),a[0]}catch(o){return this.loggingService.catch("Error in DomService getBackgroundSnippylyElement: ",o),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(t){this.loggingService.catch("Error in DomService setPointerPosition: ",t)}}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(),t=this.currentMousePosition?.pageX||e.x+200,o=Math.min(t,e.width/2),a=Math.abs(e.y),l=e.y-20;return a>50&&(l=Math.abs(e.y)+180),this.loggingService.log(e),this.loggingService.log(o),this.loggingService.log(l),{topPositionX:o,topPositionY:l}}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,t,o){if(e){if(!o&&this.getCommentPinHighlighter()&&(this.pinHighlighterClass$.value?this.addClassToElement(e,this.pinHighlighterClass$.value):this.addClassToElement(e,V.SNIPPYLY_HIGHLIGHT)),t&&!e.hasAttribute(V.ATTRIBUTES.DEFAULT_CURSOR)){let a=e.style.getPropertyValue("cursor"),l=e.style.getPropertyPriority("cursor"),s=a?{defaultCursorValue:a,defaultCursorPriority:l}:"";e.setAttribute(V.ATTRIBUTES.DEFAULT_CURSOR,s?JSON.stringify(s):""),e.style.setProperty("cursor",t,"important")}e.setAttribute(V.SNIPPYLY_HIGHLIGHT,"true"),e.setAttribute(V.VELT_IGNORE_CHANGE_DETECTION,"true")}}removeHighlightFromElement(e){if(e&&(this.pinHighlighterClass$.value&&this.removeClassFromElement(e,this.pinHighlighterClass$.value),this.removeClassFromElement(e,V.SNIPPYLY_HIGHLIGHT),e.removeAttribute(V.SNIPPYLY_HIGHLIGHT),e.removeAttribute(V.VELT_IGNORE_CHANGE_DETECTION),e.hasAttribute(V.ATTRIBUTES.DEFAULT_CURSOR))){try{if(e.style.removeProperty("cursor"),e.getAttribute(V.ATTRIBUTES.DEFAULT_CURSOR)){let t=JSON.parse(e.getAttribute(V.ATTRIBUTES.DEFAULT_CURSOR));e.style.setProperty("cursor",t.defaultCursorValue,t.defaultCursorPriority)}}catch{}e.removeAttribute(V.ATTRIBUTES.DEFAULT_CURSOR)}}highlightUserElement(e,t,o,a=!1){try{e&&(this.addClassToElement(e,V.VELT_LIVE_SELECTION_ON_ELEMENT),a&&this.addClassToElement(e,V.VELT_LIVE_SELECTION_ON_ELEMENT_DEFAULT),e.setAttribute(V.SNIPPYLY_HIGHLIGHT,"true"),e.setAttribute(V.VELT_IGNORE_CHANGE_DETECTION,"true"),t&&!e.style.getPropertyValue(V.VELT_SELECTION_COLOR)&&e.style.setProperty(V.VELT_SELECTION_COLOR,t),o&&e.setAttribute(V.SNIPPYLY_HIGHLIGHT_USER_NAME,o))}catch(l){this.loggingService.catch("Error in DomService highlightUserElement: ",l)}}removeHighlightUserFromElement(e){try{e&&(this.removeClassFromElement(e,V.VELT_LIVE_SELECTION_ON_ELEMENT),this.removeClassFromElement(e,V.VELT_LIVE_SELECTION_ON_ELEMENT_DEFAULT),e.removeAttribute(V.SNIPPYLY_HIGHLIGHT),e.removeAttribute(V.VELT_IGNORE_CHANGE_DETECTION),e.removeAttribute(V.VELT_SELECTION_COLOR),e.removeAttribute(V.SNIPPYLY_HIGHLIGHT_USER_NAME),e.style.removeProperty(V.VELT_SELECTION_COLOR))}catch(t){this.loggingService.catch("Error in DomService removeHighlightUserFromElement: ",t)}}previewHighlightElement(e){e&&e.setAttribute(V.SNIPPYLY_HIGHLIGHT_PREVIEW,"true")}removePreviewHighlightFromElement(e){e&&e.removeAttribute(V.SNIPPYLY_HIGHLIGHT_PREVIEW)}getXPath(e,t=!1,o=!1,a){try{let l=this.calculateXPath(e,t,o,a);if(l&&typeof l=="string"&&l.includes("/svg")){let s=l.split("/"),d=!1;s.forEach((v,u)=>{v.includes("svg")&&(d=!0),d&&(s[u]="svg:"+v)}),l=s.join("/")}return l}catch(l){this.loggingService.catch("Error in DomService getXPath:",l)}}namespaceResolver(e){return e==="svg"?"http://www.w3.org/2000/svg":null}calculateXPath(e,t,o,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&&!t)return"//*[@id='"+e.id+"']";if(o&&e.className&&e.className.split){let s=e.className?.split(" ")?.filter(d=>!d?.includes("snippyly")&&!d?.includes("velt")&&!["show-pin-cursor"].includes(d))[0];if(s){let d=this.calculateXPath(e.parentNode,t,o,a)+"/"+e.tagName.toLowerCase(),v=Array.from(e.parentNode?.children||[]).filter(u=>u.nodeType===1&&u.tagName===e.tagName?u.className?.split(" ")?.filter(k=>k?.includes("snippyly")||k?.includes("velt")||["show-pin-cursor"].includes(k))[0]===s:!1);if(v.length>1){let u=v.indexOf(e)+1;d+=`[contains(concat(' ', normalize-space(@class), ' '), ' ${s} ')][${u}]`}else d+=`[contains(concat(' ', normalize-space(@class), ' '), ' ${s} ')]`;return d}}let l=[].filter.call(e.parentNode?.children?e.parentNode?.children:[],function(s){return s.tagName==e.tagName});return this.calculateXPath(e.parentNode,t,o)+"/"+e.tagName.toLowerCase()+(l.length>1?"["+([].indexOf.call(l,e)+1)+"]":"")}}catch(l){this.loggingService.catch("Error in DomService calculateXPath:",l)}}getElementFromXPath(e,t=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 o=this.getXPath(e,!1,!1,t);if(o){let a=o?.iterateNext();if(a!==null&&typeof a.setAttribute=="function"){let l=St();a.setAttribute(V.ATTRIBUTES.VELT_ELEMENT_CACHE_ID,l),this.xpathCacheId.set(l,e)}return this.xpathCache.set(e,a),a}return null}catch(o){return this.loggingService.catch("Error in DomService getElementFromXPath:",o),null}}getElementFromTargetElement(e){try{let t=null;if(e?.anchor){let o=this.resolveAnchorRecord(e.anchor);o?.element&&(t=o.element)}else e?.xpath?t=this.getElementFromXPath(e.xpath):e?.cfXpath?t=this.getElementFromXPath(e.cfXpath):e?.fXpath&&(t=this.getElementFromXPath(e.fXpath));return t}catch(t){return this.loggingService.catch("Error in DomService getElementFromTargetElement:",t),null}}getElementFromTargetTextRange(e){try{let t=null;if(e?.commonAncestorContainerAnchor){let o=this.resolveAnchorRecord(e.commonAncestorContainerAnchor);o?.element&&(t=o.element)}else e?.commonAncestorContainer&&(t=this.getElementFromXPath(e.commonAncestorContainer));return t}catch(t){return this.loggingService.catch("Error in DomService getElementFromTargetTextRange:",t),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],t=[document?.body?.clientWidth||0,document?.documentElement?.clientWidth||0,window?.innerWidth||0];this.calculatePageScrollHeight(),this.loggingService.log(this.pageScrollHeight),this.loggingService.log(this.nodeMap),this.highestNode=this.nodeMap[this.pageScrollHeight];let o=new JE;return o.screenWidth=Math.max(...t),o.screenHeight=Math.max(...e),o.screenScrollHeight=this.pageScrollHeight,o}catch(e){return this.loggingService.catch("Error in DomService calculateScreenSize:",e),new JE}}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 o=new DOMParser().parseFromString(e,"text/html");o.querySelectorAll("[data-snippyly-cache-id]").forEach(S=>{S.removeAttribute("data-snippyly-cache-id")}),o.querySelectorAll("[data-velt-cache-id]").forEach(S=>{S.removeAttribute("data-velt-cache-id")}),o.querySelectorAll(".comment-text-highlight").forEach(S=>{S?.parentNode?.insertBefore(document.createTextNode(S?.textContent),S),S.remove()});let d=document.createNodeIterator(o,NodeFilter.SHOW_COMMENT),v;for(;v=d.nextNode();)v?.remove();return this.mergeAdjacentTextNodes(o.body),this.sanitizeHtml(o.body.innerHTML)}catch(t){return this.loggingService.catch("Error in DomService removeSnippylyContent: ",t),e}}mergeAdjacentTextNodes(e){try{let t=e.firstChild;for(;t;){if(t.nodeType===Node.TEXT_NODE){let o=t.nextSibling;for(;o&&o.nodeType===Node.TEXT_NODE;)t.textContent+=o.textContent,o.remove(),o=t.nextSibling}t=t.nextSibling}}catch(t){this.loggingService.catch("Error in DomService mergeAdjacentTextNodes: ",t)}}findLongestNode(e){try{for(let t=e.length-1;t>=0;t--){if(e[t]?.scrollHeight&&e[t]?.clientHeight){let o=Math.max(e[t]?.scrollHeight,e[t]?.clientHeight);this.pageScrollHeight=Math.max(o,this.pageScrollHeight),this.nodeMap[o]=e[t]}e[t]?.childNodes?.length&&this.findLongestNode(e[t]?.childNodes)}}catch(t){this.loggingService.catch("Error in DomService findLongestNode: ",t)}}resetSelectedAnnotationsMap(e=!0,t){try{let o=Array.from(document.querySelectorAll(`[${V.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`)),a=this.getDraftCommentAnnotationDialogs()||[];o.push(...a),o=Array.from(new Set(o));let l=o.map(u=>u.classList.contains("velt-annotation-draft-checked")?(u.classList.remove("velt-annotation-draft-checked"),null):(this.removeClassFromElement(u,"velt-comment-dialog-shake"),setTimeout(()=>{this.addClassToElement(u,"velt-comment-dialog-shake"),u.getAttribute(V.ATTRIBUTES.VELT_ANNOTATION_EDIT_COMMENT)||u.classList.contains("velt-annotation-draft-checked")||this.addClassToElement(u,"velt-annotation-draft-checked")},100),u.getAttribute(V.ATTRIBUTES.VELT_ANNOTATION_DRAFT))).filter(u=>u),s=Object.keys(this.getRecordingInProgress()||{});l=[...l,...s];let d=this.selectedAnnotationsMap$.value;if(e&&this.selectedAnnotationsMap$.value&&Object.keys(this.selectedAnnotationsMap$.value).length){let u=[];Object.keys(d).forEach(S=>{if(d[S]?.type==="tag"){let k=d[S];k?.to?.length||l.includes(S)||u.push(k)}else d[S]?.comments?.length||l.includes(S)||u.push(d[S])}),this.deleteAnnotations$.next(u),this.deleteAnnotations$.next([])}let v={};Object.keys(d).forEach(u=>{if(l.includes(u)&&(v[u]=d[u]),t)switch(t){case"comment":["comment","videoPin"].includes(d[u]?.type)||(v[u]=d[u]);break;default:d[u]?.type!==t&&(v[u]=d[u]);break}}),Object.keys(v).forEach(u=>{let S=v[u]?.multiThreadAnnotationId;S&&!v[S]&&(v[S]={annotationId:S,type:"multiThread"})}),JSON.stringify(this.selectedAnnotationsMap$.value)!==JSON.stringify(v)&&this.selectedAnnotationsMap$.next(v),this.setDialogOpenedInSidebar(!1)}catch(o){this.loggingService.catch("Error in DomService resetSelectedAnnotationsMap: ",o)}}setRecordingInProgress(e,t){try{if(t)this.recordingInProgress$.next(E(b({},this.recordingInProgress$.value),{[e]:t}));else{let o=this.recordingInProgress$.value;delete o[e],this.recordingInProgress$.next(o)}}catch(o){this.loggingService.catch("Error in DomService setRecordingInProgress: ",o)}}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=[],t=Array.from(document.querySelectorAll(`${V.TAGS.SNIPPYLY_COMMENT_DIALOG}`)),o=Array.from(document.querySelectorAll(`${V.TAGS.VELT_COMMENT_DIALOG}`));return[...t,...o].forEach(l=>{if(l?.shadowRoot){let s=l.shadowRoot.querySelector(`[${V.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);s&&e.push(s)}else{let s=l.querySelector(`${V.TAGS.VELT_SHADOW_DOM_INTERNAL}`);if(s?.shadowRoot){let d=s.shadowRoot?.querySelector(`[${V.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);d&&e.push(d)}else{let d=l.querySelector(`[${V.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);d&&e.push(d)}}}),e}catch(e){return this.loggingService.catch("Error in DomService getDraftCommentAnnotationDialogs: ",e),[]}}getSelectedAnnotationsMap(e){try{let t=this.selectedAnnotationsMap$.value;if(e){let o={};return Object.keys(t).forEach(a=>{switch(e){case"comment":["comment","videoPin"].includes(t[a].type)&&(o[a]=t[a]);break;default:t[a].type===e&&(o[a]=t[a]);break}}),o}else return t}catch(t){return this.loggingService.catch("Error in DomService getSelectedAnnotationsMap: ",t),{}}}getSelectedAnnotationsMap$(e){return this.selectedAnnotationsMap$.asObservable().pipe(ge(t=>{if(e){let o={};return Object.keys(t).forEach(a=>{t[a].type===e&&(o[a]=t[a])}),o}else return t}))}getSelectedComments$(){return this.selectedAnnotationsMap$.asObservable().pipe(ge(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,t,o,a=!1,l){try{o==="sidebarShowReplies"?this.setDialogOpenedInSidebar(!0):this.setDialogOpenedInSidebar(!1);let s=JSON.parse(JSON.stringify(this.selectedAnnotationsMap$.value||{})),d=JSON.parse(JSON.stringify(this.selectedAnnotationsLocationMap$.value||{}));s[e.annotationId]&&!a?delete s[e.annotationId]:((!this.windowKeydownShift$.value||a)&&(s={}),s[e.annotationId]=e,d[e.annotationId]=t,l=e?.multiThreadAnnotationId||l,l&&(s[l]={annotationId:l,type:"multiThread"},d[l]=t)),this.selectedAnnotationsMap$.next(s),Object.keys(d).forEach(v=>{s[v]||delete d[v]}),this.selectedAnnotationsLocationMap$.next(d)}catch(s){this.loggingService.catch("Error in DomService toggleAnnotationSelection: ",s)}}setSelectedAnnotationLocation(e,t){try{let o=JSON.parse(JSON.stringify(this.getSelectedAnnotationsLocationMap()||{}));o?.[e]!==t&&(o[e]=t,this.selectedAnnotationsLocationMap$.next(o))}catch(o){this.loggingService.catch("Error in DomService setSelectedAnnotationLocation: ",o)}}updateSelectedAnnotationInMap(e){try{let t=this.selectedAnnotationsMap$.value;e.forEach(o=>{t[o.annotationId]&&(t[o.annotationId]=o)}),this.selectedAnnotationsMap$.next(t)}catch(t){this.loggingService.catch("Error in DomService updateSelectedAnnotationInMap: ",t)}}getDeleteCommmentAnnotations$(){try{return this.deleteAnnotations$.asObservable()}catch(e){return this.loggingService.catch("Error in DomService getDeleteCommmentAnnotations$: ",e),ce([])}}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(t){return this.loggingService.catch("Error in DomService onDomChange$: ",t),ce([])}}getChildListMutation$(){return this.childListMutation$.asObservable()}onNetworkStatusChange$(){return this.networkStatus$.asObservable()}getNetworkStatus(){return this.networkStatus$.value}getElementOffset(e,t){try{let o={offsetTop:0,offsetLeft:0},a=e;if(a===t){let l=window.getComputedStyle(e);l.position==="static"&&l.transformStyle!="preserve-3d"&&l.transform=="none"&&(o.offsetLeft=e?.offsetLeft||0,o.offsetTop=e?.offsetTop||0)}if(a!==t)if(e?.closest("svg"))for(;a&&a!==t;){let s=window.getComputedStyle(a);if(a.tagName.toLowerCase()==="svg"||a instanceof SVGElement){let d=a.parentElement;if(d){let v=d.getBoundingClientRect(),u=a.getBoundingClientRect();o.offsetLeft+=u.left-v.left,o.offsetTop+=u.top-v.top}}else s.position==="static"?s.transformStyle!="preserve-3d"&&s.transform=="none"&&(o.offsetLeft+=a?.offsetLeft||0,o.offsetTop+=a?.offsetTop||0):(o.offsetLeft+=a.offsetLeft,o.offsetTop+=a.offsetTop);if(a=a.parentElement,e instanceof SVGElement&&a===t){let d=window.getComputedStyle(a);d.position==="static"&&d.transformStyle!="preserve-3d"&&d.transform=="none"&&(o.offsetLeft+=a?.offsetLeft||0,o.offsetTop+=a?.offsetTop||0)}}else{let s=window.getComputedStyle(a);s.position==="static"?s.transformStyle!="preserve-3d"&&s.transform=="none"&&(o.offsetLeft+=a?.offsetLeft||0,o.offsetTop+=a?.offsetTop||0):(o.offsetLeft+=a.offsetLeft,o.offsetTop+=a.offsetTop)}return o}catch(o){return this.loggingService.catch("Error in DomService getElementOffset: ",o),{offsetTop:0,offsetLeft:0}}}isElementVisible(e){try{if(typeof e?.getBoundingClientRect=="function"){let{width:t,height:o,top:a,bottom:l}=e?.getBoundingClientRect();return t>0||o>0||a<window.innerHeight&&l>0}else return!1}catch(t){return this.loggingService.catch("Error in DomService isElementVisible: ",t),!1}}isElementVisibleOnScreen(e){try{if(e){if(!(e instanceof Element))return!1;let t=e,o=window.getComputedStyle(t);return!(o.display==="none"||o.visibility==="hidden"||parseFloat(o.opacity)===0)}return!1}catch(t){return this.loggingService.catch("Error in DomService isElementVisibleOnScreen: ",t),!1}}getClickAndDragPointsObservable(){return new Gt(e=>{let t=Oi(document,"mousedown").pipe(ge(d=>({type:d.type,x:d.clientX+window.scrollX,y:d.clientY+window.scrollY,event:d}))),o=Oi(document,"mousemove").pipe(ge(d=>({type:d.type,x:d.clientX+window.scrollX,y:d.clientY+window.scrollY,event:d}))),a=Oi(document,"mouseup").pipe(ge(d=>({type:d.type,x:d.clientX+window.scrollX,y:d.clientY+window.scrollY,event:d}))),s=t.pipe(fe(d=>o.pipe(Vi(),ge(([v,u])=>({startPoint:d,prevPoint:v,curPoint:u})),Ar(a)))).subscribe(e);return()=>s.unsubscribe()})}drawRectangle(e,t){let o=document.querySelector(".rectangle");o||(o=document.createElement("div"),this.addClassToElement(o,"rectangle"),o.setAttribute(V.ATTRIBUTES.VELT_COMMENT_DISABLED,"true"),o.setAttribute(V.VELT_IGNORE_CHANGE_DETECTION,"true"),document.body.appendChild(o));let a=Math.abs(t.x-e.x),l=Math.abs(t.y-e.y),s=Math.min(e.x,t.x),d=Math.min(e.y,t.y);return o.style.width=`${a}px`,o.style.height=`${l}px`,o.style.left=`${s}px`,o.style.top=`${d}px`,o.style.position="absolute",o.style.border="2px dashed #f00",o.style.pointerEvents="none",o.style.zIndex="2147483577",o}getRange(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: getRange","color: green;"),window.getSelection()?.toString()){let 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 t={},o=e.commonAncestorContainer;o?.nodeType===Node.TEXT_NODE&&(o=o.parentElement);let a=document.body;if(o){let s=this.getTextXPath(o);this.isXpathWithId(s)&&(a=o)}let l=this.getAdditionalLocationContainer(o);if(l&&(a=l),t.commonAncestorContainer=this.getTextXPath(a),t.commonAncestorContainer){let s=this.getElementFromXPath(t.commonAncestorContainer);if(s){t.commonAncestorContainerFXpath=this.getXPath(s,!0),t.commonAncestorContainerCFXpath=this.getXPath(s,!0,!0);let d=this.generateAnchorRecord(s);d&&(t.commonAncestorContainerAnchor=d)}}return t.text=e.toString(),t.occurrence=tf(a,0,e.startContainer,e.startOffset,e.toString())+1,t}catch(t){this.loggingService.catch("Error in DomService getTargetTextRangeFromSelectionRange: ",t);return}}getTextXPath(e){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: getTextXPath","color: green;"),e.nodeType===Node.TEXT_NODE){let t=1,o=e.previousSibling;for(;o;)o.nodeType===Node.TEXT_NODE&&t++,o=o.previousSibling;return this.getXPath(e.parentElement)}else return this.getXPath(e)}catch(t){this.loggingService.catch("Error in DomService getTextXPath: ",t);return}}getHostElement(e){try{if(V.NON_NESTABLE_ELEMENTS[e?.tagName?.toLowerCase()]){let o=e?.closest("picture");return o?o?.parentElement:e.parentElement}let t=e.closest("svg");return t?t?.parentElement:e}catch(t){return this.loggingService.catch("Error in DomService getHostElement: ",t),e}}isElementInsideAdditionalLocationContainer(e){try{return!!e?.closest(`[${V.ATTRIBUTES.VELT_LOCATION}], [${V.ATTRIBUTES.VELT_LOCATION_ID}]`)}catch(t){return this.loggingService.catch("Error in DomService isElementInsideAdditionalLocationContainer: ",t),!1}}getAdditionalLocationContainer(e){try{return e?.closest(`[${V.ATTRIBUTES.VELT_LOCATION}], [${V.ATTRIBUTES.VELT_LOCATION_ID}]`)||null}catch(t){return this.loggingService.catch("Error in DomService getAdditionalLocationContainer: ",t),null}}isXpathWithId(e){try{return typeof e=="string"?!!e?.includes("[@id="):!1}catch(t){return this.loggingService.catch("Error in DomService isXpathWithId: ",t),!1}}getListedElements({elementIds:e,elementClassNames:t,elementQuerySelectors:o}){try{let a=[];if(e?.length)for(let l=0;l<e.length;l++){let s=document.getElementById(e[l]);s&&a.push(s)}if(t?.length)for(let l=0;l<t.length;l++){let s=document.getElementsByClassName(t[l]);for(let d=0;d<s.length;d++){let v=s[d];v&&v instanceof HTMLElement&&a.push(v)}}if(o?.length)for(let l=0;l<o.length;l++){let s=document.querySelectorAll(o[l]);for(let d=0;d<s.length;d++){let v=s[d];v&&v instanceof HTMLElement&&a.push(v)}}return a}catch(a){return this.loggingService.catch("Error in DomService getListedElements: ",a),[]}}isElementInsideListedElementIds(e,t){try{if(t?.length){for(let o=0;o<t.length;o++){let a=document.getElementById(t[o]);if(a&&a.contains(e))return!0}return!1}return!0}catch(o){return this.loggingService.catch("Error in DomService isElementInsideListedElementIds: ",o),!1}}isElementInsideListedElementClassNames(e,t){try{if(t?.length){for(let o=0;o<t.length;o++){let a=document.getElementsByClassName(t[o]);for(let l=0;l<a.length;l++)if(a[l].contains(e))return!0}return!1}return!0}catch(o){return this.loggingService.catch("Error in DomService isElementInsideListedElementClassNames: ",o),!1}}isElementInsideListedElementQuerySelectors(e,t){try{if(t?.length){for(let o=0;o<t.length;o++){let a=document.querySelectorAll(t[o]);for(let l=0;l<a.length;l++)if(a[l].contains(e))return!0}return!1}return!0}catch(o){return this.loggingService.catch("Error in DomService isElementInsideListedElementQuerySelectors: ",o),!1}}addClassToElement(e,t){try{this.loggingService.log("%c[WB] Calling FUNCTION: addClassToElement","color: green;"),e&&(e.classList?.contains(t)||e.classList?.add(t))}catch(o){this.loggingService.catch("Error in DomService addClassToElement: ",o)}}removeClassFromElement(e,t){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeClassFromElement","color: green;"),e&&e.classList?.contains(t)&&e.classList?.remove(t)}catch(o){this.loggingService.catch("Error in DomService removeClassFromElement: ",o)}}isElementInsideParentWithAttribute(e,t,o){try{let a=e;for(;a&&a!==document.body;){if(a?.getAttribute&&a?.getAttribute(t)===o)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(t){this.loggingService.catch("Error in DomService setVideoEditorHandlingDelete: ",t)}}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(t){this.loggingService.catch("Error in DomService setCustomCss: ",t)}}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),ce(null)}}injectCustomCss(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: injectCustomCss","color: green;");let t=this.customCss$.value;if(t){let o=e?.shadowRoot?.querySelector(`[${V.VELT_CUSTOM_CSS}]`);if(o&&o.remove(),t?.type==="link"){let a=document.createElement("link");a.href=t?.value,a.rel="stylesheet",a.setAttribute(V.VELT_CUSTOM_CSS,"true"),e?.shadowRoot?.appendChild(a)}else{let a=document.createElement("style");a.innerHTML=this.sanitizeHtml(t?.value),a.setAttribute(V.VELT_CUSTOM_CSS,"true"),e?.shadowRoot?.appendChild(a)}}}catch(t){this.loggingService.catch("Error in DomService injectCustomCss: ",t)}}trimCommentHtml(e){try{let t=document.createElement("div");t.innerHTML=e,this.removeEmptyElements(t);let o=t.innerHTML;return o=o.replace(r.MULTIPLE_NBSP_REGEX," ").replace(r.TRIM_NBSP_REGEX,"").trim(),o}catch(t){return this.loggingService.catch("Error in DomService trimCommentHtml: ",t),e}}removeEmptyElements(e){try{let a=function(l){return o.test(l.innerHTML)};var t=a;let o=/^\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(o){this.loggingService.catch("Error in DomService removeEmptyElements: ",o)}}normalizeWhitespace(e){try{e.childNodes.forEach(t=>{t.nodeType===Node.TEXT_NODE?t.nodeValue=t.nodeValue?.replace(/\s+/g," ").trim()??"":t.nodeType===Node.ELEMENT_NODE&&this.normalizeWhitespace(t)})}catch(t){this.loggingService.catch("Error in DomService normalizeWhitespace: ",t)}}sanitizeHtml(e){try{return this.loggingService.log("%c[WB] Calling FUNCTION: sanitizeHtml","color: green;"),sk.sanitize(e,cue)}catch(t){return this.loggingService.catch("Error in DomService sanitizeHtml: ",t),""}}sanitizeSvg(e){try{return sk.sanitize(e,cue)}catch(t){return this.loggingService.catch("Error in DomService sanitizeSvg: ",t),e}}setDeviceInfo(){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDeviceInfo","color: green;");let e=new ii;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),ce(new ii)}}getTabId(){try{let e=sessionStorage.getItem(V.SESSION_STORAGE.VELT_TAB_ID);!e&&this.tabId&&(e=this.tabId,sessionStorage.setItem(V.SESSION_STORAGE.VELT_TAB_ID,e)),!this.tabId&&e&&(this.tabId=e);let t=this.getTabIdFromWindowName();return(!e||e!==t)&&(e=St(),this.tabId=e,sessionStorage.setItem(V.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(t){this.loggingService.catch("Error in DomService setTabIdToWindowName: ",t)}}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 ii}}isMobileDevice(){try{return new ii().getDeviceType()===To.MOBILE}catch(e){return this.loggingService.catch("Error in DomService isMobileDevice: ",e),!1}}isTabletDevice(){try{return new ii().getDeviceType()===To.TABLET}catch(e){return this.loggingService.catch("Error in DomService isTabletDevice: ",e),!1}}isDesktopDevice(){try{return new ii().getDeviceType()===To.DESKTOP}catch(e){return this.loggingService.catch("Error in DomService isDesktopDevice: ",e),!1}}deepCloneElement(e){try{var t=document.createElement(e?.tagName);return Array.from(e.attributes).forEach(o=>{t.setAttribute(o.nodeName,o.nodeValue)}),e.childNodes.forEach(o=>{o.nodeType===Node.ELEMENT_NODE?t.appendChild(this.deepCloneElement(o)):o.nodeType===Node.TEXT_NODE&&t.appendChild(document.createTextNode(o.nodeValue))}),t}catch(o){return this.loggingService.catch("Error in DomService deepCloneElement: ",o),e}}setRandomNumberToElementRecursive(e){try{if(!e)return;let t=Math.random().toString(36).substring(7);e&&e.setAttribute&&typeof e.setAttribute=="function"&&(e.getAttribute("velt-wireframe-id")||e.setAttribute("velt-wireframe-id",t)),Array.from(e.children).forEach(a=>{this.setRandomNumberToElementRecursive(a)})}catch(t){this.loggingService.catch("Error in DomService setRandomNumberToElementRecursive: ",t)}}setDialogOpenedInSidebar(e){this.dialogOpenedInSidebar$.next(e)}getDialogOpenedInSidebar(){return this.dialogOpenedInSidebar$.asObservable()}removeWireframeSuffixFromTags(e){if(!e)return;Array.from(e.children).forEach(o=>{if(this.removeWireframeSuffixFromTags(o),o.tagName.toLowerCase().endsWith("-wireframe")){let a=o.tagName.toLowerCase().replace("-wireframe",""),l=document.createElement(a);for(Array.from(o.attributes).forEach(s=>{l.setAttribute(s.name,s.value)});o.firstChild;)l.appendChild(o.firstChild);o.parentNode.replaceChild(l,o)}})}isMonitorDevice(){try{return new ii().getDeviceType()===To.MONITOR}catch(e){return this.loggingService.catch("Error in DomService isMonitorDevice: ",e),!1}}};r.MULTIPLE_NBSP_REGEX=/(?: \s*){2,}/g,r.TRIM_NBSP_REGEX=/^(?: \s*)+|(?: \s*)+$/g,r.\u0275fac=function(t){return new(t||r)(J(rt),J(go),J(x),J(Jc))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var Ge=(()=>{let r=class r{constructor(e,t,o,a,l,s,d,v){this.afAuth=e,this.configService=t,this.avatarService=o,this.coreActionsService=a,this.domService=l,this.functions=s,this.analyticsService=d,this.loggingService=v,this.user$=new be(null),this.userOptions$=new be(null),this.userContacts$=new be(null),this.userOrganization$=new be(null),this.isPrivateCommentsEnabled$=new be(!1),this.providedUser=new Vo,this.firebaseConfig$=new be(null),this.advancedQueries$=new be(null),this.planDetails$=new be(null),this.signOutPreviousUser$=new be(null),this.preSignOutFunctions=new Map,this.autoLoginCalled=!1,this.autoLoginRequired=!0,this.config=null,this.getPlanDetailsCalled=!1,this.forceReLoggedIn=!1,this.lastLoggedInUserData=null,this.sessionReLoginCount=0,this.SESSION_RE_LOGIN_COUNT_LIMIT=10,this.sessionReLoginSubscription=null,this.onRetrySubscription=null,this.TOKEN_EXPIRED_ERROR_COUNT_LIMIT=3,this.tokenExpiredErrorCount=0,this.loggingService.log("%c[WB] Creating CLASS: AuthService","color: blue;");try{this.analyticsService.setAuthService(this),this.configService.getConfig$().subscribe(u=>{this.config=u}),this.forceReLoggedIn=localStorage.getItem(V.LOCAL_STORAGE.VELT_USER_FORCE_RE_LOGGED_IN)==="true",this.sessionReLoginSubscription=mi(this.afAuth).pipe(yr(this.afAuth.currentUser),Vi(),fe(([u,S])=>this.domService.onNetworkStatusChange$().pipe(je(k=>k),st(1),ge(()=>({previousUser:u,currentUser:S}))))).subscribe(k=>X(this,[k],function*({previousUser:u,currentUser:S}){if(!S&&u){let A=u?.stsTokenManager?.expirationTime,P=new Date().getTime(),U=A-P;P>A&&(this.analyticsService.trackEvent(Y.Events.Core.SDK_SESSION_TOKEN_EXPIRED,{apiKey:this.apiKey,user:this.user$.value,lastLoggedInUserData:this.lastLoggedInUserData,timeLeft:U,forceReset:this.userOptions$.value?.forceReset,sessionReLoginCount:this.sessionReLoginCount},!0,this.user$.value?.userSnippylyId),this.user$.value&&u?.uid===this.user$.value?.userSnippylyId&&this.lastLoggedInUserData?.user?.userSnippylyId===this.user$.value?.userSnippylyId&&(this.sessionReLoginCount>this.SESSION_RE_LOGIN_COUNT_LIMIT?(this.analyticsService.trackEvent(Y.Events.Core.SDK_SESSION_RE_LOGIN_COUNT_EXCEEDED,{apiKey:this.apiKey,clientUserId:this.lastLoggedInUserData.user.userId,snippylyUserId:this.lastLoggedInUserData.user.userSnippylyId,timeLeft:U,forceReset:this.userOptions$.value?.forceReset,sessionReLoginCount:this.sessionReLoginCount},!0,this.user$.value?.userSnippylyId),this.sessionReLoginSubscription?.unsubscribe()):(this.sessionReLoginCount++,this.analyticsService.trackEvent(Y.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:U,forceReset:this.userOptions$.value?.forceReset,sessionReLoginCount:this.sessionReLoginCount},!0,this.lastLoggedInUserData.user.userSnippylyId),this.lastLoggedInUserData.user=yield this.updateUserWithColorAndTextColor(this.lastLoggedInUserData.user),this.initializeClient(this.lastLoggedInUserData.user,this.lastLoggedInUserData.userOptions,this.lastLoggedInUserData.initializeClientToken,this.lastLoggedInUserData.autoLogin,"internal-sessionReLogin"))))}}),u=>{this.loggingService.catch("Error in AuthService sessionReLoginSubscription: ",u)}),this.getUser$().pipe(xt(Qt)).subscribe(u=>{let S=Co(u);this.coreActionsService.triggerAction(ut.USER_UPDATE,S),this.coreActionsService.triggerAction(ut.INIT_UPDATE,{event:ut.USER_UPDATE,payload:{user:S}})})}catch(u){this.loggingService.catch("Error in AuthService constructor: ",u)}}setApiKey(e,t){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),t||(t=new lR),this.configService.initConfig(t),t.debugMode?sessionStorage.setItem("debugMode","true"):sessionStorage.removeItem("debugMode"),this.autoLoginCalled||mi(this.afAuth).pipe(st(1)).subscribe(o=>X(this,null,function*(){if(this.autoLoginCalled=!0,o){let a=yield gm(o,!0).catch(l=>null);if(a){let{user:l}=a?.claims;this.autoLoginRequired&&(l=yield this.updateUserWithColorAndTextColor(l),this.initializeClient(l,this.userOptions$?.value?E(b({},this.userOptions$?.value),{replaceContacts:!1,replaceGroupContacts:!1,replacePrivateContacts:!1}):{},new Date().getTime(),!0,"internal-autoLogin"))}}}))}catch(o){this.loggingService.catch("Error in setApiKey: ",o)}}setUsersService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setUsersService","color: green;"),this.usersService=e}catch(t){this.loggingService.catch("Error in setUsersService: ",t)}}setUserPermissionService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setUserPermissionService","color: green;"),this.userPermissionService=e}catch(t){this.loggingService.catch("Error in setUserPermissionService: ",t)}}setDocService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocService","color: green;"),this.docService=e}catch(t){this.loggingService.catch("Error in setDocService: ",t)}}setContactService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setContactService","color: green;"),this.contactService=e}catch(t){this.loggingService.catch("Error in setContactService: ",t)}}setIamService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setIamService","color: green;"),this.iamService=e}catch(t){this.loggingService.catch("Error in setIamService: ",t)}}setAreaService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setAreaService","color: green;"),this.areaService=e}catch(t){this.loggingService.catch("Error in setAreaService: ",t)}}setCommentService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setCommentService","color: green;"),this.commentService=e}catch(t){this.loggingService.catch("Error in setCommentService: ",t)}}setReactionService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setReactionService","color: green;"),this.reactionService=e}catch(t){this.loggingService.catch("Error in setReactionService: ",t)}}setRecorderAnnotationService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setRecorderAnnotationService","color: green;"),this.recorderAnnotationService=e}catch(t){this.loggingService.catch("Error in setRecorderAnnotationService: ",t)}}setViewsService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setViewsService","color: green;"),this.viewsService=e}catch(t){this.loggingService.catch("Error in setViewsService: ",t)}}setCommonDbService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setCommonDbService","color: green;"),this.commonDbService=e}catch(t){this.loggingService.catch("Error in setCommonDbService: ",t)}}validateOrganizationId(e){if(this.isVersionGreaterThanOrEqualTo4()&&!e?.organizationId)if(this.analyticsService.trackEvent(Y.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")}setVeltAuthProvider(e){return X(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: setVeltAuthProvider","color: green;");try{this.onRetrySubscription?.unsubscribe();let t=null;if(!e.user)return null;e.generateToken&&typeof e.generateToken=="function"&&(t=yield e.generateToken());let o=yield AG(()=>window.Velt.identify(e.user,b(b({},e.options||{}),t&&{authToken:t}),{fromProvider:!0}).catch(a=>(e.onError&&typeof e.onError=="function"&&e.onError(a),Promise.reject(a))),e.retryConfig||{retryCount:0,retryDelay:0});return o&&e.generateToken&&typeof e.generateToken=="function"&&(this.onRetrySubscription=this.coreActionsService.onAction(ut.ERROR).pipe(je(a=>a.code==="token_expired"),st(10)).subscribe(a=>X(this,null,function*(){if(a.code==="token_expired"){let l=this.docService?.getDocumentIds()?.map(k=>({id:k.clientDocumentId}))??[],s=this.docService?.getOptionsFromDocumentPaths()??void 0,d=[],v=this.docService?.getLocation();v&&d.push(v.location);let u=this.docService?.getLocations();u&&Object.values(u).forEach(k=>{d.push(k.location)}),(yield AG(()=>X(this,null,function*(){try{let k=yield e.generateToken?.();return k?window.Velt.identify(e.user,b(b({},e.options||{}),k&&{authToken:k}),{fromProvider:!0}):!0}catch{return!1}}),e.retryConfig||{retryCount:0,retryDelay:0}))&&(yield this.docService?.setDocuments({documents:l,options:s,source:"internal"}),yield this.docService?.setLocations({locations:d,source:"internal",options:{appendLocation:!v}}))}}))),o}catch(t){return this.loggingService.catch("Error in setVeltAuthProvider: ",t),null}})}setUserToStorage(e){return X(this,null,function*(){try{if(e){let t=yield Us(e,e?.userId??"");localStorage.setItem(V.LOCAL_STORAGE.VELT_IDENTIFY_USER,t)}}catch(t){this.loggingService.catch("Error in setUserToStorage: ",t)}})}getUserFromStorage(e){return X(this,null,function*(){try{let t=localStorage.getItem(V.LOCAL_STORAGE.VELT_IDENTIFY_USER);return t?yield _1(t,e?.userId??""):null}catch(t){return this.loggingService.catch("Error in getUserFromStorage: ",t),null}})}setIsPrivateCommentsEnabled(e){try{this.isPrivateCommentsEnabled$.next(e)}catch(t){this.loggingService.catch("Error in setIsPrivateCommentsEnabled: ",t)}}getIsPrivateCommentsEnabled(){return this.isPrivateCommentsEnabled$.value}getIsPrivateCommentsEnabled$(){return this.isPrivateCommentsEnabled$.asObservable()}updateUserWithColorAndTextColor(e){return X(this,null,function*(){try{let t=JSON.parse(JSON.stringify(e??{})),o=yield this.getUserFromStorage(t);return!o||Object.keys(o).length===0?(delete t?.color,delete t?.textColor,t):(o?.color&&(t.color=o?.color),o?.textColor&&(t.textColor=o?.textColor),t)}catch(t){return this.loggingService.catch("Error in updateUserWithColorAndTextColor: ",t),e}})}updateUserIfRequired(e){return X(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: updateUserIfRequired","color: green;");try{let t=yield this.getUserFromStorage(e),o={};e.color&&e.color!==t?.color&&(o.color=e.color),e.textColor&&e.textColor!==t?.textColor&&(o.textColor=e.textColor),Object.keys(o).length>0&&e.clientOrganizationId&&this.docService?.addUserInfoToOrganization({organizationId:e.clientOrganizationId,user:E(b({},o),{userId:e.userId})})}catch(t){this.loggingService.catch("Error in updateUserIfRequired: ",t)}})}initializeClient(e,t,o,a,l){return X(this,null,function*(){try{if(this.autoLoginRequired=!1,this.userOptions$.next(t),this.initializeClientToken)this.pendingUserLogin=e,this.pendingUserLoginSource=l;else{e.userSnippylyId=ym(this.configService.getApiKey(),e.userId),this.pendingUserLogin=void 0,this.pendingUserLoginSource=void 0,this.initializeClientToken=o;let s=yield mi(this.afAuth).pipe(st(1)).toPromise().catch(v=>null),d=!0;if(this.providedUser=JSON.parse(JSON.stringify(e)),s){let v=yield gm(s,!0).catch(A=>null);if(!v)return;let{user:u,firebaseConfig:S,advancedQueries:k}=v.claims;s?.uid!==e?.userSnippylyId||e?.groupId!==u?.groupId||e?.organizationId!==u?.organizationId||t?.forceReset||!a&&e?.organizationId&&!this.forceReLoggedIn||this.forceReLoginRequiredForAdvancedQueries(e)||this.forceReLoginRequiredForRegion(e,S)||this.forceReLoginRequiredForCommentViews(e)?(localStorage.setItem(V.LOCAL_STORAGE.VELT_USER_FORCE_RE_LOGGED_IN,"true"),localStorage.setItem(V.LOCAL_STORAGE.VELT_COMMENT_VIEWS_MIGRATED,"true"),this.forceReLoggedIn=!0,yield this.signOutUser("internal")):(this.loggingService.log("%c[WB] Calling FUNCTION: reinitializeCurrentUser","color: green;"),this.loggingService.log("Keeping user"),yield this.updateUserIfRequired(e),this.validateOrganizationId(e),this.setFirebaseConfig(S),this.setAdvancedQueries(k),u&&(this.providedUser.isAdmin=!!u.isAdmin),this.initializeSignedInUser(s,a,e),d=!1,this.analyticsService.trackEvent(Y.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:l}))}if(d){this.analyticsService.trackEvent(Y.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:l},!0,e.userSnippylyId,e.userId);let v=mr(this.functions,gr({url:wn.cloudFunction.validateClient,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:1200*1e3}),u=Ra(),S=(yield v({apiKey:this.apiKey,user:e,version:u,authToken:t?.authToken}))?.data;if(S.error){if(this.analyticsService.trackEvent(Y.Events.Core.SDK_VALIDATE_CLIENT_FAILED,E(b({apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,message:S.error,forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e)},S),{source:l}),!0,e.userSnippylyId,e.userId),S.error&&typeof S.error=="string")if(S.error?.toLowerCase()?.includes("token expired"))if(this.tokenExpiredErrorCount++,this.tokenExpiredErrorCount<=this.TOKEN_EXPIRED_ERROR_COUNT_LIMIT){let k={code:"token_expired",message:"Token expired",error:S?.error,source:S?.source};this.coreActionsService.triggerAction(ut.ERROR,k)}else{let k={code:"too_many_retries",message:"Token expired. Too many retries.",error:S?.error,source:S?.source};this.coreActionsService.triggerAction(ut.ERROR,k),this.analyticsService.trackEvent(Y.Events.Core.SDK_JWT_EXPIRED_RETRY_EXCEEDED,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,forceReset:this.userOptions$.value?.forceReset,source:l},!0,e.userSnippylyId,e.userId)}else{let k=S;this.coreActionsService.triggerAction(ut.ERROR,k)}throw S}else this.tokenExpiredErrorCount=0;if(this.analyticsService.trackEvent(Y.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:l},!0,e.userSnippylyId,e.userId),this.validateOrganizationId(e),S.firebaseConfig){this.setFirebaseConfig(S.firebaseConfig),yield this.signInWithCustomToken(e,S.token),this.loggingService.log("new signed in user",this.afAuth.currentUser);let k=yield gm(this.afAuth.currentUser,!0).catch(U=>null);if(!k)return;let{user:A,advancedQueries:P}=k.claims;this.setAdvancedQueries(P),this.providedUser.isAdmin=!!A?.isAdmin,this.initializeSignedInUser(this.afAuth.currentUser,a,e)}}this.initializeClientToken=0,this.lastLoggedInUserData={user:e,userOptions:t,initializeClientToken:o,autoLogin:a},this.checkForPendingLogin()}return e}catch(s){return this.initializeClientToken=0,this.checkForPendingLogin(),this.loggingService.catch("Error in initializeClient: ",s),t?.throwError?Promise.reject(s):Promise.resolve(null)}})}isVersionGreaterThanOrEqualTo4(){try{let e=Ra();return(e?parseInt(e.split(".")?.[0]||"0"):0)>=4}catch(e){return this.loggingService.catch("Error in isVersionGreaterThanOrEqualTo4: ",e),!1}}isVersion4Point5(){try{let e=Ra();if(e){let t=e.split("."),o=parseInt(t[0]||"0"),a=parseInt(t[1]||"0"),l=parseInt(t[2]||"0");if(o>=4&&a>=5)return o===4&&a===5&&l===0?!e.toLowerCase().includes("beta"):!0}return!1}catch(e){return this.loggingService.catch("Error in isVersion4Point5: ",e),!1}}forceReLoginRequiredForAdvancedQueries(e){try{let t=this.isVersionGreaterThanOrEqualTo4(),o=!1;try{let a=localStorage.getItem(V.LOCAL_STORAGE.VELT_ADVANCED_QUERIES);a&&(o=JSON.parse(a)?.advancedQueriesEnabled)}catch(a){this.loggingService.catch("Error in forceReLoginRequiredForAdvancedQueries: ",a)}return!!(t&&e.organizationId&&!o)}catch(t){return this.loggingService.catch("Error in forceReLoginRequiredForAdvancedQueries: ",t),!1}}forceReLoginRequiredForCommentViews(e){try{let t=this.isVersion4Point5(),o=!1;try{let a=localStorage.getItem(V.LOCAL_STORAGE.VELT_COMMENT_VIEWS_MIGRATED);a&&(o=JSON.parse(a))}catch(a){this.loggingService.catch("Error in forceReLoginRequiredForCommentViews: ",a)}return!!(t&&e.organizationId&&!o)}catch(t){return this.loggingService.catch("Error in forceReLoginRequiredForCommentViews: ",t),!1}}forceReLoginRequiredForRegion(e,t){try{return!!(this.isVersionGreaterThanOrEqualTo4()&&e.organizationId&&!t?.region)}catch(o){return this.loggingService.catch("Error in forceReLoginRequiredForRegion: ",o),!1}}checkForPendingLogin(){this.pendingUserLogin&&this.initializeClient(this.pendingUserLogin,this.userOptions$?.value||{},new Date().getTime(),void 0,this.pendingUserLoginSource)}setFirebaseConfig(e){this.loggingService.log("%c[WB] Calling FUNCTION: setFirebaseConfig","color: green;");try{this.firebaseConfig$.value||this.firebaseConfig$.next({firebaseOptions:b(b({},wn.firebaseConfig),e)})}catch(t){this.loggingService.catch("Error in setFirebaseConfig: ",t)}}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(V.LOCAL_STORAGE.VELT_ADVANCED_QUERIES,JSON.stringify(e)),this.advancedQueries$.next(e)}catch(t){this.loggingService.catch("Error in setAdvancedQueries: ",t)}}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 un([this.configService.getConfig$(),this.getAdvancedQueries$()]).pipe(ge(()=>this.getAdvancedQueriesEnabled()),Hn(()=>ce(!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;"),mi(this.afAuth).pipe(fe(e=>e?this.user$.asObservable():ce(null)),xt(Qt))}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 t=this.user$.value;if(e.userId&&e.userId!==t?.userId||e?.groupId&&e?.groupId!==t?.groupId||e?.organizationId&&e?.organizationId!==t?.organizationId)this.providedUser=e,this.initializeClient(e,this.userOptions$?.value||{},new Date().getTime(),void 0,"internal-updateUser");else if(this.providedUser=b(b({},this.providedUser),e),t){let o=b(b({},t),e);this.updateUserInternally(o)}}catch(t){this.loggingService.catch("Error in updateUser: ",t)}}signInWithCustomToken(e,t,o="manual"){this.loggingService.log("%c[WB] Calling FUNCTION: signInWithCustomToken","color: green;");try{return Kre(this.afAuth,t).then(a=>(this.analyticsService.trackEvent(Y.Events.Core.SDK_USER_AUTH_SUCCESS,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,authType:o,forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e)}),a)).catch(a=>(this.analyticsService.trackEvent(Y.Events.Core.SDK_USER_AUTH_FAILED,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,authType:o,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)}}clearCache(){this.loggingService.log("%c[WB] Calling FUNCTION: clearCache","color: green;");try{this.isPrivateCommentsEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in clearCache: ",e)}}resetServicesCache(){this.loggingService.log("%c[WB] Calling FUNCTION: resetServicesCache in AuthService","color: green;");try{this.clearCache(),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,t,o){this.loggingService.log("%c[WB] Calling FUNCTION: initializeSignedInUser","color: green;");try{let a=new Vo;a.userSnippylyId=e.uid,a.type="signedIn",o&&(a=b(b({},a),o)),this.setUserToStorage(a),this.mergeUserWithProvidedUserData(a,t)}catch(a){this.loggingService.catch("Error in initializeSignedInUser: ",a)}}mergeUserWithProvidedUserData(e,t){return X(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: mergeUserWithProvidedUserData","color: green;");try{e.userId=this.providedUser?.userId||e.userId;let o=null;if(this.usersService?.externalUserDataProviderAvailable()){let a=St(),l=Gs.IDENTIFY;this.coreActionsService.triggerAction(ut.USER_RESOLVER,{event:Y.Events.Resolver.USER_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:a,methodName:eo.MERGE_USER_WITH_PROVIDED_USER_DATA,moduleName:l,source:"internal",payload:{userIds:[e.userId],organizationId:this.providedUser?.organizationId||e.organizationId}});let s=yield this.usersService.resolveUsers({userIds:[e.userId],organizationId:this.providedUser?.organizationId||e.organizationId,skipUserCheck:!0,uniqueId:a,moduleName:l});s&&s[e.userId]&&(o=JSON.parse(JSON.stringify(s[e.userId]||{}))),e=b(b({},e),o||{})}e.name=o?o?.name:this.providedUser?.name||e.name,e.clientUserName=o?o?.clientUserName:this.providedUser?.clientUserName||e.clientUserName,e.photoUrl=o?o?.photoUrl:this.providedUser?.photoUrl||e.photoUrl,e?.photoUrl===void 0&&(e.photoUrl=null),e.email=o?o?.email:this.providedUser?.email||e.email,e.color=o?.color||this.providedUser?.color||this.getUserAvatarColor(e.userId),e.textColor=o?.textColor||this.providedUser?.textColor||this.getUserTextColor(e.userId),e.initial=o?.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(o){this.loggingService.catch("Error in mergeUserWithProvidedUserData: ",o)}})}updateUserInternally(e){return X(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: updateUserInternally","color: green;");try{let t=Object.assign({},e);delete t.contacts,this.analyticsService.identifyUser(e.userSnippylyId,t,{forceReset:this.userOptions$.value?.forceReset}),this.getPlanDetailsCalled||this.getPlanDetailsFromDb();let o=mr(this.functions,gr({url:wn?.cloudFunction?.sdkProxy,apiProxyDomain:this.configService?.getApiProxyDomain()})),a=Cd({methodName:"updateUserInternally",data:{type:"getProjectConfig"},getSdkProxy:o,userId:e?.userId??""}),l=Promise.resolve();if(this.userPermissionService?.isPermissionProviderAvailable()&&e.clientOrganizationId){let v=[{userId:e.userId,resource:{id:e.clientOrganizationId,type:Wr.ORGANIZATION,source:tr.IDENTIFY,organizationId:e.clientOrganizationId}}],u=St();this.coreActionsService.triggerAction(ut.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.RESOURCE_ACCESS_REQUEST_FORMED,methodName:tr.IDENTIFY,uniqueId:u,timestamp:new Date().getTime(),source:"internal",payload:{requests:v}}),l=this.userPermissionService?.onResourceAccessRequired({requests:v,uniqueId:u,userId:e.userId,methodName:tr.IDENTIFY,fromCache:!1})??Promise.resolve()}let[s,d]=yield Promise.allSettled([a,l]);s.status==="fulfilled"&&this.setIsPrivateCommentsEnabled(!!s.value?.data?.isPrivateCommentsEnabled),this.afAuth.currentUser&&(this.user$.next(e),this.updateUserToFirebase(e))}catch(t){this.loggingService.catch("Error in updateUserInternally: ",t)}})}updateUserToFirebase(e){this.loggingService.log("%c[WB] Calling FUNCTION: updateUserToFirebase","color: green;");try{let t=JSON.parse(JSON.stringify(e)),o=E(b({},t),{lastUpdated:new Date})}catch(t){this.loggingService.catch("Error in updateUserToFirebase: ",t)}}getPlanDetailsFromDb(){return X(this,null,function*(){try{this.getPlanDetailsCalled=!0;let t=yield mr(this.functions,gr({url:wn.cloudFunction.getPlanDetails,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:1200*1e3})({apiKey:this.configService.getApiKey(),sdkVersion:Ra(),sdkType:this.configService.getSdkType()});return t?.data?.isPlanExpired&&(this.analyticsService.trackEvent(Y.Events.Core.SDK_PLAN_EXPIRED),this.configService.getSF()||console.warn("Velt SDK plan has expired.")),this.planDetails$.next(t?.data||{planInfo:null,isPlanExpired:!1}),t}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(je(e=>!!e),ge(e=>!!e?.isPlanExpired))}isPlanExpired(){return this.planDetails$.getValue()?.isPlanExpired}addPreSignOutFuction(e,t){try{this.preSignOutFunctions.set(e,t)}catch(o){this.loggingService.catch("Error in addPreSignOutFuction: ",o)}}setUserOrganization(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setUserOrganization","color: green;");let t=JSON.parse(JSON.stringify(this.userOrganization$.value||{}));this.getUser()?.organizationId===e?.organizationId?(t.metadata=e,this.userOrganization$.next(t)):this.userOrganization$.next(null)}catch(t){this.loggingService.catch("Error in setUserOrganization: ",t)}}setOrganizationUserGroups(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setUserOrganizationGroups","color: green;");let t=JSON.parse(JSON.stringify(this.userOrganization$.value||{}));this.getUser()?.organizationId===t?.metadata?.organizationId&&(t.groups=e,this.userOrganization$.next(t))}catch(t){this.loggingService.catch("Error in setUserOrganizationGroups: ",t)}}getUserOrganization$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getUserOrganization$","color: green;"),this.getUser$().pipe(fe(e=>e?this.userOrganization$.asObservable().pipe(ge(t=>t?.metadata?.organizationId===e.organizationId?t:null)):ce(null)))}signOutUser(e="internal"){return X(this,null,function*(){try{e==="external"&&this.onRetrySubscription?.unsubscribe(),this.userPermissionService?.revokeAccessOnUserLogout(),this.analyticsService.trackEvent(Y.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 t=yield mi(this.afAuth).pipe(st(1)).toPromise().catch(o=>null);if(t){this.resetServicesCache(),this.user$.next(null);for(let[o,a]of this.preSignOutFunctions)try{yield a(t)}catch(l){this.loggingService.catch(`Error in signOutUser ${o} function: `,l)}return this.user$.next(null),yield lu(1e3),Zre(this.afAuth).catch(o=>{this.loggingService.catch("Error in signOutUser:",o)})}else return Promise.resolve()}catch(t){this.loggingService.catch("Error in signOutUser: ",t)}})}isFeatureAllowed(e){return Cr(this.config,this.user$.value,e)}getUserWithoutContacts(e){try{if(e){let t=JSON.parse(JSON.stringify(e));return delete t.contacts,t}else return null}catch(t){return this.loggingService.catch("Error in getUserWithoutContacts: ",t),null}}getUserForClient(e){try{return Co(e)}catch(t){return this.loggingService.catch("Error in getUserForClient: ",t),null}}getUserAvatarColor(e){try{return e?this.avatarService.generateUserColor(Gn(e)):"#625DF5"}catch{return"#625DF5"}}getUserTextColor(e){try{return"#FFFFFF"}catch{return"#FFFFFF"}}setOptionalPropertiesToUsers(e){try{e.forEach(t=>{try{t?.color||(t.color=this.getUserAvatarColor(t?.userId)),t?.textColor||(t.textColor=this.getUserTextColor(t?.userId)),!t?.initial&&(t?.name||t?.email)&&(t.initial=t.name?.charAt(0).toUpperCase()||t.email?.charAt(0).toUpperCase())}catch{}})}catch{}}};r.\u0275fac=function(t){return new(t||r)(J(Gi),J(Lt),J(Om),J(pi),J(Ve),J(Lr),J(rt),J(x))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var Am=class{constructor({apiKey:r,documentId:i,organizationId:e,folderId:t,veltFolderId:o,clientDocumentId:a,clientOrganizationId:l}){this.paths={},this.apiKey=r,this.documentId=i,this.organizationId=e,this.folderId=t,this.veltFolderId=o,this.clientDocumentId=a,this.clientOrganizationId=l,a&&(this.documentId=Bo(a)),l&&(this.organizationId=Xa(l)),t&&(this.folderId=t,this.veltFolderId=Mi(t)),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 r=`${this.apiKey}`;this.organizationId&&(r=`${r}/${V.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${this.paths.organizationId}`),this.documentId&&(this.paths.docs=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/`,this.paths.folder=`${r}/${V.FIREBASE_PARTIAL_PATH_FOLDERS}/`,this.paths.presence=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_PRESENCE}/`,this.paths.cursor=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_CURSOR}/`,this.paths.comment=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_COMMENT}/`,this.paths.multiThread=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_MULTI_THREAD}/`,this.paths.tag=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_TAG}/`,this.paths.area=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_AREA}/`,this.paths.arrow=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_ARROW}/`,this.paths.selection=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_SELECTION}/`,this.paths.audioHuddle=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_AUDIO_HUDDLE}/`,this.paths.huddle=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_HUDDLE}/`,this.paths.recorder=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_RECORDER}/`,this.paths.flock=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_FOLLOW_ALONG}/`,this.paths.syncVideoPlayer=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_SYNC_VIDEO_PLAYER}/`,this.paths.liveState=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_LIVE_STATE}/`,this.paths.liveStateSingleEditorMode=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_LIVE_STATE}/default/singleEditorMode`,this.paths.reaction=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_REACTION}/`,this.paths.crdt=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_CRDT}/`,this.paths.views=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_VIEWS}/`,this.paths.notifications=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_NOTIFICATIONS}/`,this.paths.metadata=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_METADATA}/`,this.paths.users=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_USERS}/`,this.paths.documentIam=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_IAM}/`,this.paths.userConfig=`${r}/${V.FIREBASE_PARTIAL_PATH_USERS}`),this.paths.customerMetadata=`${r}/${V.FIREBASE_PARTIAL_PATH_CUSTOMER_METADATA}/`,this.paths.groupContacts=`${r}/${V.FIREBASE_PARTIAL_PATH_CONTACTS}/${V.FIREBASE_PARTIAL_PATH_GROUPS}/`,this.paths.globalContacts=`${r}/${V.FIREBASE_PARTIAL_PATH_CONTACTS}/${V.FIREBASE_PARTIAL_PATH_GLOBAL}/`,this.paths.logins=`${r}/${V.FIREBASE_PARTIAL_PATH_CONTACTS}/${V.FIREBASE_PARTIAL_PATH_LOGINS}/`,this.paths.userFeedback=`${r}/${V.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${V.FIREBASE_PARTIAL_PATH_FEEDBACK}/`,this.paths.userReportBugs=`${r}/${V.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${V.FIREBASE_PARTIAL_PATH_BUGS}/`,this.paths.userContactUs=`${r}/${V.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${V.FIREBASE_PARTIAL_PATH_CONTACT_US}/`,this.organizationId&&(this.paths.organizationMetadata=`${r}/${V.FIREBASE_PARTIAL_PATH_ORGANIZATION_METADATA}/`,this.paths.organizationIam=`${r}/${V.FIREBASE_PARTIAL_PATH_IAM}/`,this.paths.organizationGroups=`${r}/${V.FIREBASE_PARTIAL_PATH_ORGANIZATION_GROUPS}/`,this.paths.organizationNotifications=`${r}/${V.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/`,this.documentId&&(this.paths.organizationNotificationsWithDocumentId=`${r}/${V.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/`,this.paths.heartbeatByDocument=`${r}/${V.FIREBASE_PARTIAL_PATH_HEARTBEAT_BY_DOCUMENT}/${this.documentId}/`),this.paths.organizationNotificationsLastNotificationTimestamp=`${r}/${V.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${V.FIREBASE_PARTIAL_PATH_LAST_NOTIFICATION_TIMESTAMP}/${V.FIREBASE_PARTIAL_PATH_DOCS}/`,this.paths.organizationNotificationsUsers=`${r}/${V.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${V.FIREBASE_PARTIAL_PATH_USERS}/`,this.paths.heartbeat=`${r}/${V.FIREBASE_PARTIAL_PATH_HEARTBEAT}/`),this.paths.workspaceIam=`${this.apiKey}/${V.FIREBASE_PARTIAL_PATH_IAM}/`}}catch{}}get folder(){return this.paths.folder?this.paths.folder:this.throwError("Folder path is not available.")}get userConfig(){return this.paths.userConfig?this.paths.userConfig:this.throwError("User config path is not available.")}get workspaceIam(){return this.paths.workspaceIam?this.paths.workspaceIam:this.throwError("Workspace IAM path is not available.")}get docs(){return this.paths.docs?this.paths.docs:this.throwError("Docs path is not available.")}get presence(){return this.paths.presence?this.paths.presence:this.throwError("Presence path is not available.")}get cursor(){return this.paths.cursor?this.paths.cursor:this.throwError("Cursor path is not available.")}get area(){return this.paths.area?this.paths.area:this.throwError("Area path is not available.")}get arrow(){return this.paths.arrow?this.paths.arrow:this.throwError("Arrow path is not available.")}get comment(){return this.paths.comment?this.paths.comment:this.throwError("Comment path is not available.")}get multiThread(){return this.paths.multiThread?this.paths.multiThread:this.throwError("Multi thread path is not available.")}get tag(){return this.paths.tag?this.paths.tag:this.throwError("Tag path is not available.")}get selection(){return this.paths.selection?this.paths.selection:this.throwError("Selection path is not available.")}get audioHuddle(){return this.paths.audioHuddle?this.paths.audioHuddle:this.throwError("Audio huddle path is not available.")}get huddle(){return this.paths.huddle?this.paths.huddle:this.throwError("Huddle path is not available.")}get recorder(){return this.paths.recorder?this.paths.recorder:this.throwError("Recorder path is not available.")}get flock(){return this.paths.flock?this.paths.flock:this.throwError("Flock path is not available.")}get syncVideoPlayer(){return this.paths.syncVideoPlayer?this.paths.syncVideoPlayer:this.throwError("Sync video player path is not available.")}get liveState(){return this.paths.liveState?this.paths.liveState:this.throwError("Live state path is not available.")}get liveStateSingleEditorMode(){return this.paths.liveStateSingleEditorMode?this.paths.liveStateSingleEditorMode:this.throwError("Live state single editor mode path is not available.")}get reaction(){return this.paths.reaction?this.paths.reaction:this.throwError("Reaction path is not available.")}get crdt(){return this.paths.crdt?this.paths.crdt:this.throwError("CRDT path is not available.")}get views(){return this.paths.views?this.paths.views:this.throwError("Views path is not available.")}get notifications(){return this.paths.notifications?this.paths.notifications:this.throwError("Notifications path is not available.")}get metadata(){return this.paths.metadata?this.paths.metadata:this.throwError("Metadata path is not available.")}get users(){return this.paths.users?this.paths.users:this.throwError("Users path is not available.")}get documentIam(){return this.paths.documentIam?this.paths.documentIam:this.throwError("Document IAM path is not available.")}get organizationMetadata(){return this.paths.organizationMetadata?this.paths.organizationMetadata:this.throwError("Organization metadata path is not available.")}get organizationIam(){return this.paths.organizationIam?this.paths.organizationIam:this.throwError("Organization IAM path is not available.")}get customerMetadata(){return this.paths.customerMetadata?this.paths.customerMetadata:this.throwError("Customer metadata path is not available.")}get groupContacts(){return this.paths.groupContacts?this.paths.groupContacts:this.throwError("Group contacts path is not available.")}get globalContacts(){return this.paths.globalContacts?this.paths.globalContacts:this.throwError("Global contacts path is not available.")}get logins(){return this.paths.logins?this.paths.logins:this.throwError("Logins path is not available.")}get userFeedback(){return this.paths.userFeedback?this.paths.userFeedback:this.throwError("User feedback path is not available.")}get userReportBugs(){return this.paths.userReportBugs?this.paths.userReportBugs:this.throwError("User report bugs path is not available.")}get userContactUs(){return this.paths.userContactUs?this.paths.userContactUs:this.throwError("User contact us path is not available.")}get organizationGroups(){return this.paths.organizationGroups?this.paths.organizationGroups:this.throwError("Organization groups path is not available.")}get heartbeat(){return this.paths.heartbeat?this.paths.heartbeat:this.throwError("Heartbeat path is not available.")}get heartbeatByDocument(){return this.paths.heartbeatByDocument?this.paths.heartbeatByDocument:this.throwError("Heartbeat by document path is not available.")}get organizationNotifications(){return this.paths.organizationNotifications?this.paths.organizationNotifications:this.throwError("Organization notifications path is not available.")}get organizationNotificationsWithDocumentId(){return this.paths.organizationNotificationsWithDocumentId?this.paths.organizationNotificationsWithDocumentId:this.throwError("Organization notifications with document id path is not available.")}get organizationNotificationsUsers(){return this.paths.organizationNotificationsUsers?this.paths.organizationNotificationsUsers:this.throwError("Organization notifications users path is not available.")}get organizationNotificationsLastNotificationTimestamp(){return this.paths.organizationNotificationsLastNotificationTimestamp?this.paths.organizationNotificationsLastNotificationTimestamp:this.throwError("Organization notifications last notification timestamp path is not available.")}throwError(r){throw{type:"DocumentPaths",message:r,metadata:{apiKey:this.apiKey,documentId:this.documentId,organizationId:this.organizationId}}}};var IR=class{constructor({apiKey:r,documentId:i,organizationId:e,clientDocumentId:t,clientOrganizationId:o,folderId:a,veltFolderId:l}){this.paths={},this.apiKey=r,this.documentId=i,this.organizationId=e,this.veltFolderId=l,t&&(this.documentId=Bo(t)),o&&(this.organizationId=Xa(o)),a&&(this.folderId=a,this.veltFolderId=Mi(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 r=`apiKey/${this.apiKey}`;this.organizationId&&(r=`${r}/${V.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${this.paths.organizationId}`,this.paths.organization=r,this.paths.folder=`${r}/${V.FIREBASE_PARTIAL_PATH_FOLDERS}`,this.paths.organizationUsers=`${r}/${V.FIREBASE_PARTIAL_PATH_ORGANIZATION_USERS}`,this.paths.users=`${r}/${V.FIREBASE_PARTIAL_PATH_CENTRAL_USERS}`,this.paths.notificationDocs=`${r}/${V.FIREBASE_PARTIAL_PATH_NOTIFICATION_DOCS}`,this.paths.notificationUsers=`${r}/${V.FIREBASE_PARTIAL_PATH_NOTIFICATION_USERS}`,this.paths.organizationGroups=`${r}/${V.FIREBASE_PARTIAL_PATH_GROUPS}`,this.paths.lastNotificationTimestamp=`${r}/${V.FIREBASE_PARTIAL_PATH_LAST_NOTIFICATION_TIMESTAMP}`,this.paths.userConfig=`${r}/${V.FIREBASE_PARTIAL_PATH_USERS}`,this.paths.permissionsUsers=`${r}/${V.FIREBASE_PARTIAL_PATH_PERMISSIONS_USERS}`),this.veltFolderId&&(this.paths.folderUsers=`${r}/${V.FIREBASE_PARTIAL_PATH_FOLDERS}/${this.veltFolderId}/${V.FIREBASE_PARTIAL_PATH_FOLDER_USERS}`),this.documentId&&(this.paths.document=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}`,this.paths.comment=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_COMMENT}`,this.paths.location=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_LOCATION}`,this.paths.multiThread=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_MULTI_THREAD}`,this.paths.area=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_AREA}`,this.paths.recorder=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_RECORDER}`,this.paths.reaction=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_REACTION}`,this.paths.crdt=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_CRDT}`,this.paths.notificationViews=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_NOTIFICATION_VIEWS}`,this.paths.documentViews=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_DOCUMENT_VIEWS}`,this.paths.locationViews=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_LOCATION_VIEWS}`,this.paths.documentUsers=`${r}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_DOCUMENT_USERS}`,this.paths.docNotification=`${this.paths.notificationDocs}/${this.documentId}/${V.FIREBASE_PARTIAL_PATH_DOC_NOTIFICATION}`)}}catch{}}get permissionsUsers(){return this.paths.permissionsUsers?this.paths.permissionsUsers:this.throwError("PermissionsUsers path is not available.")}get users(){return this.paths.users?this.paths.users:this.throwError("Users path is not available.")}get userConfig(){return this.paths.userConfig?this.paths.userConfig:this.throwError("UserConfig path is not available.")}get folder(){return this.paths.folder?this.paths.folder:this.throwError("Folder path is not available.")}get lastNotificationTimestamp(){return this.paths.lastNotificationTimestamp?this.paths.lastNotificationTimestamp:this.throwError("LastNotificationTimestamp path is not available.")}get organizationGroups(){return this.paths.organizationGroups?this.paths.organizationGroups:this.throwError("organizationGroups path is not available.")}get docNotification(){return this.paths.docNotification?this.paths.docNotification:this.throwError("DocNotification path is not available.")}get organization(){return this.paths.organization?this.paths.organization:this.throwError("Organization path is not available.")}get document(){return this.paths.document?this.paths.document:this.throwError("Document path is not available.")}get location(){return this.paths.location?this.paths.location:this.throwError("Location path is not available.")}get area(){return this.paths.area?this.paths.area:this.throwError("Area path is not available.")}get comment(){return this.paths.comment?this.paths.comment:this.throwError("Comment path is not available.")}get documentViews(){return this.paths.documentViews?this.paths.documentViews:this.throwError("DocumentViews path is not available.")}get locationViews(){return this.paths.locationViews?this.paths.locationViews:this.throwError("LocationViews path is not available.")}get notificationViews(){return this.paths.notificationViews?this.paths.notificationViews:this.throwError("NotificationViews path is not available.")}get documentUsers(){return this.paths.documentUsers?this.paths.documentUsers:this.throwError("DocumentUsers path is not available.")}get folderUsers(){return this.paths.folderUsers?this.paths.folderUsers:this.throwError("FolderUsers path is not available.")}get organizationUsers(){return this.paths.organizationUsers?this.paths.organizationUsers:this.throwError("OrganizationUsers path is not available.")}get notificationDocs(){return this.paths.notificationDocs?this.paths.notificationDocs:this.throwError("NotificationDocs path is not available.")}get notificationUsers(){return this.paths.notificationUsers?this.paths.notificationUsers:this.throwError("NotificationUsers path is not available.")}get multiThread(){return this.paths.multiThread?this.paths.multiThread:this.throwError("Multi thread path is not available.")}get recorder(){return this.paths.recorder?this.paths.recorder:this.throwError("Recorder path is not available.")}get reaction(){return this.paths.reaction?this.paths.reaction:this.throwError("Reaction path is not available.")}get crdt(){return this.paths.crdt?this.paths.crdt:this.throwError("CRDT path is not available.")}throwError(r){throw{type:"DocumentPaths",message:r,metadata:{apiKey:this.apiKey,documentId:this.documentId,organizationId:this.organizationId}}}};var ER=class{};var On=(()=>{let r=class r{constructor(e,t){this.authService=e,this.loggingService=t,this.db$=new be(null);try{this.authService.getFirebaseConfig$().subscribe(o=>{o&&this.db$.next(NM(void 0,o.firebaseOptions.databaseURL))},o=>{this.loggingService.catch("Error in DatabaseService constructor: ",o)})}catch(o){this.loggingService.catch("Error in DatabaseService constructor:",o)}}getDb(){return this.db$.asObservable()}getDbValue(){return this.db$.getValue()}};r.\u0275fac=function(t){return new(t||r)(J(Ge),J(x))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var vs=(()=>{let r=class r{constructor(e,t,o){this.coreActionsService=e,this.loggingService=t,this.analyticsService=o,this.resolveTimeout=60*1e3,this.retrySaveConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryDeleteConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryGetConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.commentAnnotationDataProvider$=new be(null),this.commentAnnotationById$=new be({}),this.fieldsToRemove=[],this.getCommentAnnotationById=a=>{try{return this.commentAnnotationDataProviderAvailable()?this.commentAnnotationById$.value?.[a]:void 0}catch(l){this.loggingService.catch("Error in CommentAnnotationsResolverService getCommentAnnotationById:",l);return}};try{this.loggingService.log("CommentAnnotationsResolverService initialized"),this.commentAnnotationDataProvider$.subscribe(a=>{a&&(a.config?.resolveTimeout&&(this.resolveTimeout=a.config.resolveTimeout),a.config?.saveRetryConfig&&(this.retrySaveConfig=a.config.saveRetryConfig),a.config?.deleteRetryConfig&&(this.retryDeleteConfig=a.config.deleteRetryConfig),a.config?.getRetryConfig&&(this.retryGetConfig=a.config.getRetryConfig),a.config?.fieldsToRemove&&(this.fieldsToRemove=a.config.fieldsToRemove))})}catch(a){this.loggingService.catch("Error in CommentAnnotationsResolverService constructor:",a)}}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(a){return X(this,arguments,function*({request:e,uniqueId:t,moduleName:o}){try{if(this.loggingService.log("%c[WB] Calling CommentAnnotationsResolverService FUNCTION: resolveCommentAnnotations","color: green;"),!this.commentAnnotationDataProviderAvailable())return{};let l,s=!1,d=!1,v=()=>{l&&(clearTimeout(l),l=void 0,d=!0)};return new Promise((u,S)=>{l=setTimeout(()=>{if(!d){s=!0,v();let te=t||St();this.coreActionsService.triggerAction(ut.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:te,methodName:Gr.RESOLVE_COMMENT_ANNOTATIONS,moduleName:o,source:"internal",payload:{error:new Error("Comment annotation resolution timeout"),request:e}}),S(new Error("Comment annotation resolution timeout"))}},this.commentAnnotationDataProvider$.value?.config?.resolveTimeout||this.resolveTimeout);let k=this.getProvider();if(!k)return v(),u({});let A={},P=[...new Set(e.commentAnnotationIds||[])],U=E(b({},e),{commentAnnotationIds:P});X(this,null,function*(){try{if(P.length>0||e.documentIds?.length||e.folderId){let te=t||St();this.coreActionsService.triggerAction(ut.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_RESOLUTION_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:te,methodName:Gr.RESOLVE_COMMENT_ANNOTATIONS,moduleName:o,source:"internal",payload:{request:U}});let ye=Bs(()=>k?.config?.getConfig?.url?Sc(k.config.getConfig.url,k.config.getConfig.headers,U,!0):k?.get(U)||Promise.resolve(void 0),"getCommentAnnotations",this.retryGetConfig).then(me=>s?{}:(v(),me&&me.statusCode!==200?(this.coreActionsService.triggerAction(ut.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:te,methodName:Gr.RESOLVE_COMMENT_ANNOTATIONS,moduleName:o,source:"internal",payload:{result:me,request:U}}),this.loggingService.catch(me?.message??"Error in CommentAnnotationsResolverService resolveCommentAnnotations:"),{}):me?.data)).catch(me=>{throw v(),me});try{A=(yield ye)||{},this.analyticsService.trackEvent(Y.Events.Resolver.COMMENT_RESOLVER_GET,{sourceMethod:"resolveCommentAnnotations",source:"sdk",commentAnnotationIds:P});let me={};Object.entries(A).forEach(([ke,De])=>{let Ie=this.commentAnnotationById$.value?.[ke];Ie?Ie&&JSON.stringify(Ie)!==JSON.stringify(De)&&(me[ke]=De):me[ke]=De}),Object.keys(me).length>0&&this.commentAnnotationById$.next(b(b({},this.commentAnnotationById$.getValue()),me)),this.coreActionsService.triggerAction(ut.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_RESOLUTION_RESULT,timestamp:new Date().getTime(),uniqueId:te,methodName:Gr.RESOLVE_COMMENT_ANNOTATIONS,moduleName:o,source:"internal",payload:{result:me,request:U}}),u(me)}catch(me){let ke=t||St();this.coreActionsService.triggerAction(ut.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:ke,methodName:Gr.RESOLVE_COMMENT_ANNOTATIONS,moduleName:o,source:"internal",payload:{error:me,request:U}}),s||S(me),u(A)}}else v(),u({})}catch(te){v();let ye=t||St();this.coreActionsService.triggerAction(ut.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:ye,methodName:Gr.RESOLVE_COMMENT_ANNOTATIONS,moduleName:o,source:"internal",payload:{error:te,request:U}}),S(te)}})})}catch(l){this.loggingService.catch("Error in CommentAnnotationsResolverService resolveCommentAnnotations:",l);let s=t||St();return this.coreActionsService.triggerAction(ut.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:s,methodName:Gr.RESOLVE_COMMENT_ANNOTATIONS,moduleName:o,source:"internal",payload:{error:l,request:e}}),{}}})}saveCommentAnnotation(e,t){return X(this,null,function*(){try{this.loggingService.log("%c[WB] Calling CommentAnnotationsResolverService FUNCTION: saveCommentAnnotation","color: green;");let o=this.getProvider();if(!this.commentAnnotationDataProviderAvailable())throw new Error("Comment annotation save data provider not available");let a=t||St();this.coreActionsService.triggerAction(ut.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_SAVE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:a,methodName:Gr.SAVE_COMMENT_ANNOTATION,source:"internal",payload:{request:e}});let l=JSON.parse(JSON.stringify(this.commentAnnotationById$.getValue()));this.commentAnnotationById$._value=b(b({},l),e.commentAnnotation);let s=yield Bs(()=>{if(o?.config?.saveConfig?.url){let d={commentAnnotation:e.commentAnnotation,event:e.eventType,commentId:e.commentId,metadata:Object.values(e.commentAnnotation??{})?.[0]?.metadata};return Sc(o.config.saveConfig.url,o.config.saveConfig.headers,d,!1)}return o?.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 s&&s.statusCode!==200?(this.retrySaveConfig.revertOnFailure&&(this.commentAnnotationById$._value=l),this.loggingService.catch(s?.message??"Error in CommentAnnotationsResolverService saveCommentAnnotation:"),this.coreActionsService.triggerAction(ut.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:Gr.SAVE_COMMENT_ANNOTATION,source:"internal",payload:{error:s,request:e}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(Y.Events.Resolver.COMMENT_RESOLVER_SAVE,{sourceMethod:"saveCommentAnnotation",source:"sdk",commentAnnotationIds:Object.keys(e.commentAnnotation),eventType:e.eventType,commentId:e.commentId}),this.coreActionsService.triggerAction(ut.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_SAVE_RESULT,timestamp:new Date().getTime(),uniqueId:a,methodName:Gr.SAVE_COMMENT_ANNOTATION,source:"internal",payload:{result:{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0},request:e}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0})}catch(o){this.loggingService.warn("Error in CommentAnnotationsResolverService saveCommentAnnotation:",o);let a=t||St();return this.coreActionsService.triggerAction(ut.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:Gr.SAVE_COMMENT_ANNOTATION,source:"internal",payload:{error:o,request:e}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0}}})}deleteCommentAnnotation(e,t,o){return X(this,null,function*(){try{this.loggingService.log("%c[WB] Calling CommentAnnotationsResolverService FUNCTION: deleteCommentAnnotation","color: green;");let a=this.getProvider();if(!this.commentAnnotationDataProviderAvailable())throw new Error("Comment annotation delete data provider not available");let l=o||St();this.coreActionsService.triggerAction(ut.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_DELETE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:l,methodName:Gr.DELETE_COMMENT_ANNOTATION,source:"internal",payload:{commentAnnotationId:e.toString(),metadata:t}});let s=this.commentAnnotationById$.getValue(),d=b({},s);delete d?.[e],this.commentAnnotationById$._value=d;let v=yield Bs(()=>{if(a?.config?.deleteConfig?.url){let u={commentAnnotationId:e.toString(),metadata:t,event:Uo.COMMENT_ANNOTATION_DELETE};return Sc(a.config.deleteConfig.url,a.config.deleteConfig.headers,u,!1)}return a?.delete({commentAnnotationId:e.toString(),metadata:t,event:Uo.COMMENT_ANNOTATION_DELETE})||Promise.resolve(void 0)},"deleteCommentAnnotation",this.retryDeleteConfig);return v&&v.statusCode!==200?(this.retryDeleteConfig.revertOnFailure&&(this.commentAnnotationById$._value=s),this.loggingService.catch(v?.message??"Error in CommentAnnotationsResolverService deleteCommentAnnotation:"),this.coreActionsService.triggerAction(ut.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:l,methodName:Gr.DELETE_COMMENT_ANNOTATION,source:"internal",payload:{error:v,commentAnnotationId:e.toString(),metadata:t}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(Y.Events.Resolver.COMMENT_RESOLVER_DELETE,{sourceMethod:"deleteCommentAnnotation",source:"sdk",commentAnnotationId:e.toString()}),this.coreActionsService.triggerAction(ut.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_DELETE_RESULT,timestamp:new Date().getTime(),uniqueId:l,methodName:Gr.DELETE_COMMENT_ANNOTATION,source:"internal",payload:{result:{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0},commentAnnotationId:e.toString(),metadata:t}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0})}catch(a){this.loggingService.warn("Error in CommentAnnotationsResolverService deleteCommentAnnotation:",a);let l=o||St();return this.coreActionsService.triggerAction(ut.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:l,methodName:Gr.DELETE_COMMENT_ANNOTATION,source:"internal",payload:{error:a,commentAnnotationId:e.toString(),metadata:t}}),{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()):ce(void 0)}catch(e){return this.loggingService.catch("Error in CommentAnnotationsResolverService getCommentAnnotationsById$:",e),ce(void 0)}}getAnnotationById(e){try{return this.commentAnnotationDataProviderAvailable()?this.commentAnnotationById$.getValue()?.[e]:void 0}catch(t){this.loggingService.catch("Error in CommentAnnotationsResolverService getAnnotationById:",t);return}}getFieldsToRemove(){try{return this.fieldsToRemove}catch(e){return this.loggingService.catch("Error in CommentAnnotationsResolverService getFieldsToRemove:",e),this.fieldsToRemove}}setCommentAnnotationDataProvider(e){try{if(e){this.loggingService.log("Setting comment annotation data provider");let t=e.config,o=[{method:"get",configKey:"getConfig"},{method:"save",configKey:"saveConfig"},{method:"delete",configKey:"deleteConfig"}],a=[];if(o.forEach(({method:l,configKey:s})=>{let d=t?.[s]?.url,v=l in e&&typeof e[l]=="function";!d&&!v&&a.push(l)}),a.length>0){let l=`DataProviders.comment is invalid. The following methods are missing or are not functions (and no corresponding config provided): ${a.join(", ")}.`;this.loggingService.catch(l);return}else this.commentAnnotationDataProvider$.next(e)}}catch(t){this.loggingService.catch("Error in CommentAnnotationsResolverService setCommentAnnotationDataProvider:",t)}}commentAnnotationDataProviderAvailable(){try{return!!this.commentAnnotationDataProvider$.getValue()}catch(e){return this.loggingService.catch("Error in CommentAnnotationsResolverService commentAnnotationDataProviderAvailable:",e),!1}}};r.\u0275fac=function(t){return new(t||r)(J(pi),J(x),J(rt))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var Pm=(()=>{let r=class r{constructor(e,t,o){this.coreActionsService=e,this.loggingService=t,this.analyticsService=o,this.resolveTimeout=60*1e3,this.retrySaveConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryDeleteConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryGetConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.reactionAnnotationDataProvider$=new be(null),this.reactionAnnotationById$=new be({}),this.getReactionAnnotationById=a=>{try{return this.reactionAnnotationDataProviderAvailable()?this.reactionAnnotationById$.value?.[a]:void 0}catch(l){this.loggingService.catch("Error in ReactionAnnotationsResolverService getReactionAnnotationById:",l);return}};try{this.loggingService.log("ReactionAnnotationsResolverService initialized"),this.reactionAnnotationDataProvider$.subscribe(a=>{a&&(a.config?.resolveTimeout&&(this.resolveTimeout=a.config.resolveTimeout),a.config?.saveRetryConfig&&(this.retrySaveConfig=a.config.saveRetryConfig),a.config?.deleteRetryConfig&&(this.retryDeleteConfig=a.config.deleteRetryConfig),a.config?.getRetryConfig&&(this.retryGetConfig=a.config.getRetryConfig))})}catch(a){this.loggingService.catch("Error in ReactionAnnotationsResolverService constructor:",a)}}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(a){return X(this,arguments,function*({request:e,uniqueId:t,moduleName:o}){try{if(this.loggingService.log("%c[WB] Calling ReactionAnnotationsResolverService FUNCTION: resolveReactionAnnotations","color: green;"),!this.reactionAnnotationDataProviderAvailable())return{};let l,s=!1,d=!1,v=()=>{l&&(clearTimeout(l),l=void 0,d=!0)};return new Promise((u,S)=>{l=setTimeout(()=>{if(!d){s=!0,v();let te=t||St();this.coreActionsService.triggerAction(ut.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:te,methodName:to.RESOLVE_REACTION_ANNOTATIONS,moduleName:o,source:"internal",payload:{error:new Error("Reaction annotation resolution timeout"),request:e}}),S(new Error("Reaction annotation resolution timeout"))}},this.reactionAnnotationDataProvider$.value?.config?.resolveTimeout||this.resolveTimeout);let k=this.getProvider();if(!k)return v(),u({});let A={},P=[...new Set(e.reactionAnnotationIds||[])],U=E(b({},e),{reactionAnnotationIds:P});X(this,null,function*(){try{if(P.length>0||e.documentIds?.length||e.folderId){let te=t||St();this.coreActionsService.triggerAction(ut.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_RESOLUTION_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:te,methodName:to.RESOLVE_REACTION_ANNOTATIONS,moduleName:o,source:"internal",payload:{request:U}});let ye=Bs(()=>k?.config?.getConfig?.url?Sc(k.config.getConfig.url,k.config.getConfig.headers,U,!0):k?.get(U)||Promise.resolve(void 0),"getReactionAnnotations",this.retryGetConfig).then(me=>s?{}:(v(),me&&me.statusCode!==200?(this.coreActionsService.triggerAction(ut.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:te,methodName:to.RESOLVE_REACTION_ANNOTATIONS,moduleName:o,source:"internal",payload:{result:me,request:U}}),this.loggingService.catch(me?.message??"Error in ReactionAnnotationsResolverService resolveReactionAnnotations:"),{}):me?.data)).catch(me=>{throw v(),me});try{A=(yield ye)||{},this.analyticsService.trackEvent(Y.Events.Resolver.REACTION_RESOLVER_GET,{sourceMethod:"resolveReactionAnnotations",source:"sdk",reactionAnnotationIds:P});let me={};Object.entries(A).forEach(([ke,De])=>{let Ie=this.reactionAnnotationById$.value?.[ke];Ie?Ie&&JSON.stringify(Ie)!==JSON.stringify(De)&&(me[ke]=De):me[ke]=De}),Object.keys(me).length>0&&this.reactionAnnotationById$.next(b(b({},this.reactionAnnotationById$.getValue()),me)),this.coreActionsService.triggerAction(ut.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_RESOLUTION_RESULT,timestamp:new Date().getTime(),uniqueId:te,methodName:to.RESOLVE_REACTION_ANNOTATIONS,moduleName:o,source:"internal",payload:{result:me,request:U}}),u(me)}catch(me){let ke=t||St();this.coreActionsService.triggerAction(ut.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:ke,methodName:to.RESOLVE_REACTION_ANNOTATIONS,moduleName:o,source:"internal",payload:{error:me,request:U}}),s||S(me),u(A)}}else v(),u({})}catch(te){v();let ye=t||St();this.coreActionsService.triggerAction(ut.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:ye,methodName:to.RESOLVE_REACTION_ANNOTATIONS,moduleName:o,source:"internal",payload:{error:te,request:U}}),S(te)}})})}catch(l){this.loggingService.catch("Error in ReactionAnnotationsResolverService resolveReactionAnnotations:",l);let s=t||St();return this.coreActionsService.triggerAction(ut.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:s,methodName:to.RESOLVE_REACTION_ANNOTATIONS,moduleName:o,source:"internal",payload:{error:l,request:e}}),{}}})}saveReactionAnnotation(e,t){return X(this,null,function*(){try{this.loggingService.log("%c[WB] Calling ReactionAnnotationsResolverService FUNCTION: saveReactionAnnotation","color: green;");let o=this.getProvider();if(!this.reactionAnnotationDataProviderAvailable())throw new Error("Reaction annotation save data provider not available");let a=t||St();this.coreActionsService.triggerAction(ut.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_SAVE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:a,methodName:to.SAVE_REACTION_ANNOTATION,source:"internal",payload:{request:e}});let l=JSON.parse(JSON.stringify(this.reactionAnnotationById$.getValue()));this.reactionAnnotationById$._value=b(b({},l),e);let s={reactionAnnotation:e,event:Uo.REACTION_ADD,metadata:Object.values(e??{})?.[0]?.metadata},d=yield Bs(()=>o?.config?.saveConfig?.url?Sc(o.config.saveConfig.url,o.config.saveConfig.headers,s,!1):o?.save(s)||Promise.resolve(void 0),"saveReactionAnnotation",this.retrySaveConfig);return d&&d.statusCode!==200?(this.retrySaveConfig.revertOnFailure&&(this.reactionAnnotationById$._value=l),this.loggingService.catch(d?.message??"Error in ReactionAnnotationsResolverService saveReactionAnnotation:"),this.coreActionsService.triggerAction(ut.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:to.SAVE_REACTION_ANNOTATION,source:"internal",payload:{error:d,request:e}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(Y.Events.Resolver.REACTION_RESOLVER_SAVE,{sourceMethod:"saveReactionAnnotation",source:"sdk",reactionAnnotationIds:Object.keys(e),eventType:s.event}),this.coreActionsService.triggerAction(ut.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_SAVE_RESULT,timestamp:new Date().getTime(),uniqueId:a,methodName:to.SAVE_REACTION_ANNOTATION,source:"internal",payload:{result:{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0},request:e}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0})}catch(o){this.loggingService.warn("Error in ReactionAnnotationsResolverService saveReactionAnnotation:",o);let a=t||St();return this.coreActionsService.triggerAction(ut.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:to.SAVE_REACTION_ANNOTATION,source:"internal",payload:{error:o,request:e}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0}}})}deleteReactionAnnotation(e,t,o){return X(this,null,function*(){try{this.loggingService.log("%c[WB] Calling ReactionAnnotationsResolverService FUNCTION: deleteReactionAnnotation","color: green;");let a=this.getProvider();if(!this.reactionAnnotationDataProviderAvailable())throw new Error("Reaction annotation delete data provider not available");let l=o||St();this.coreActionsService.triggerAction(ut.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_DELETE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:l,methodName:to.DELETE_REACTION_ANNOTATION,source:"internal",payload:{reactionAnnotationId:e.toString(),metadata:t}});let s=JSON.parse(JSON.stringify(this.reactionAnnotationById$.getValue())),d=b({},s);delete d?.[e],this.reactionAnnotationById$._value=d;let v=yield Bs(()=>{if(a?.config?.deleteConfig?.url){let u={reactionAnnotationId:e.toString(),metadata:t,event:Uo.REACTION_DELETE};return Sc(a.config.deleteConfig.url,a.config.deleteConfig.headers,u,!1)}return a?.delete({reactionAnnotationId:e.toString(),metadata:t,event:Uo.REACTION_DELETE})||Promise.resolve(void 0)},"deleteReactionAnnotation",this.retryDeleteConfig);return v&&v.statusCode!==200?(this.retryDeleteConfig.revertOnFailure&&(this.reactionAnnotationById$._value=s),this.loggingService.catch(v?.message??"Error in ReactionAnnotationsResolverService deleteReactionAnnotation:"),this.coreActionsService.triggerAction(ut.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:l,methodName:to.DELETE_REACTION_ANNOTATION,source:"internal",payload:{error:v,reactionAnnotationId:e.toString(),metadata:t}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(Y.Events.Resolver.REACTION_RESOLVER_DELETE,{sourceMethod:"deleteReactionAnnotation",source:"sdk",reactionAnnotationId:e.toString()}),this.coreActionsService.triggerAction(ut.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_DELETE_RESULT,timestamp:new Date().getTime(),uniqueId:l,methodName:to.DELETE_REACTION_ANNOTATION,source:"internal",payload:{result:{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0},reactionAnnotationId:e.toString(),metadata:t}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0})}catch(a){this.loggingService.warn("Error in ReactionAnnotationsResolverService deleteReactionAnnotation:",a);let l=o||St();return this.coreActionsService.triggerAction(ut.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:l,methodName:to.DELETE_REACTION_ANNOTATION,source:"internal",payload:{error:a,reactionAnnotationId:e.toString(),metadata:t}}),{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()):ce(void 0)}catch(e){return this.loggingService.catch("Error in ReactionAnnotationsResolverService getReactionAnnotationsById$:",e),ce(void 0)}}getAnnotationById(e){try{return this.reactionAnnotationDataProviderAvailable()?this.reactionAnnotationById$.getValue()?.[e]:void 0}catch(t){this.loggingService.catch("Error in ReactionAnnotationsResolverService getAnnotationById:",t);return}}setReactionAnnotationDataProvider(e){try{if(e){this.loggingService.log("Setting reaction annotation data provider");let t=e.config,o=[{method:"get",configKey:"getConfig"},{method:"save",configKey:"saveConfig"},{method:"delete",configKey:"deleteConfig"}],a=[];if(o.forEach(({method:l,configKey:s})=>{let d=t?.[s]?.url,v=l in e&&typeof e[l]=="function";!d&&!v&&a.push(l)}),a.length>0){let l=`DataProviders.reaction is invalid. The following methods are missing or are not functions (and no corresponding config provided): ${a.join(", ")}.`;this.loggingService.catch(l);return}else this.reactionAnnotationDataProvider$.next(e)}}catch(t){this.loggingService.catch("Error in ReactionAnnotationsResolverService setReactionAnnotationDataProvider:",t)}}reactionAnnotationDataProviderAvailable(){try{return!!this.reactionAnnotationDataProvider$.getValue()}catch(e){return this.loggingService.catch("Error in ReactionAnnotationsResolverService reactionAnnotationDataProviderAvailable:",e),!1}}};r.\u0275fac=function(t){return new(t||r)(J(pi),J(x),J(rt))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var lt=(()=>{let r=class r{constructor(e,t,o,a,l,s,d,v,u,S){this.analyticsService=e,this.authService=t,this.databaseService=o,this.domService=a,this.configService=l,this.loggingService=s,this.commentResolverService=d,this.reactionResolverService=v,this.coreActionsService=u,this.functions=S,this.documentPaths$=new be(null),this.docContext$=new be(null),this.documentIds$=new be([]),this.organizationConfig$=new be(null),this.firestorePaths$=new be(null),this.location$=new be(null),this.excludedLocationIds$=new be([]),this.organizationMetadata$=new be(null),this.documentMetadata$=new be(null),this.locationMetadata$=new be(null),this.customerMetadata$=new be(null),this.currentDocumentId=null,this.isCustomDocId=!1,this.locations$=new be({}),this.preDocumentIdChangeFunctions=new Map,this.draftDocuments=[],this.clientDocumentMetadataMap={},this.uiState=new be({}),this.lastSetDocumentIdExecutionTime=0,this.lastSetDocumentIdCallTime=0,this.setDocumentIdSubject=new nt,this.DEBOUNCE_TIME=5e3,this.MAX_QUEUE_SIZE=100,this.queueSize=0,this.isDocumentIdInDebounceQueue=!1,this.currentValidationToken=null,this.pendingDocumentIds=[],this.pendingOptions={},this.draftLocationMap={locations:[],options:void 0};try{this.loggingService.log("%c[WB] Creating CLASS: DocService","color: blue;"),this.domService.setDocService(this),this.authService.setDocService(this),this.setDocumentIdSubject.pipe(Zi(this.DEBOUNCE_TIME)).subscribe({next:k=>X(this,null,function*(){try{yield this.setDocumentIdImpl(k.documentId,k.clientOrganizationId,k.options),this.lastSetDocumentIdExecutionTime=Date.now(),this.isDocumentIdInDebounceQueue=!1,this.draftLocationMap.locations.length&&(yield this.setLocations({locations:this.draftLocationMap.locations,options:this.draftLocationMap.options,source:"internal"})),this.draftLocationMap={locations:[],options:void 0}}finally{this.queueSize--}}),error:k=>{this.loggingService.catch("Error in setDocumentId subscription:",k),this.queueSize--}}),this.databaseService.getDb().pipe(je(k=>!!k),st(1)).subscribe(k=>{k&&(this.db=k)}),this.configService.getApiKey$().subscribe(k=>{if(this.apiKey=k,this.apiKey){if(!this.isCustomDocId){let A=X9(window.location.href);this.currentUrl=A}this.analyticsService.updateDefaultProperties({apiKey:k})}}),this.authService.getUser$().subscribe(k=>X(this,null,function*(){if(k&&(this.analyticsService.updateDefaultProperties({organizationId:k?.organizationId,clientOrganizationId:k?.clientOrganizationId}),this.draftDocuments?.length?(yield this.setDocuments({documents:this.draftDocuments,options:this.draftOptions??void 0,source:"internal"}),this.draftDocuments=[],this.draftOptions=void 0,this.draftLocationMap.locations.length&&(yield this.setLocations({locations:this.draftLocationMap.locations,options:this.draftLocationMap.options,source:"internal"}).then(()=>this.draftLocationMap={locations:[],options:void 0}))):this.documentPaths$?.value&&k?.organizationId&&this.documentPaths$.value?.organizationId!==k?.organizationId&&(yield this.setDocuments({documents:this.documentIds$.value.length?this.documentIds$.value.map(A=>({id:A.clientDocumentId})):[{id:this.documentPaths$.value?.clientDocumentId}],options:void 0,source:"internal"})),setTimeout(()=>{this.documentPaths$.value||this.loggingService.catch("Error in DocService constructor:","Please set document id to continue.")},1e4),k?.organizationId&&k?.clientOrganizationId)){let A={organizationId:k?.organizationId,clientOrganizationId:k?.clientOrganizationId};this.getOrganizationConfig()||this.organizationConfig$.next({organizationId:k?.organizationId,clientOrganizationId:k?.clientOrganizationId}),yield this.updateOrganizationMetadata(A)}})),this.documentPaths$.subscribe(k=>{let A={documentId:k?.documentId,clientDocumentId:k?.clientDocumentId,folderId:k?.folderId,allDocuments:k?.allDocuments,veltFolderId:k?.veltFolderId};k?.organizationId&&(A.organizationId=k.organizationId,A.clientOrganizationId=k.clientOrganizationId),this.analyticsService.updateDefaultProperties(A),this.domService.resetSelectedAnnotationsMap()}),this.location$.subscribe(k=>{this.analyticsService.updateDefaultProperties({clientLocation:k?.location,locationId:k?.locationId})}),this.organizationMetadata$.subscribe(k=>{this.authService.setUserOrganization(k?.[this.documentPaths$.value?.organizationId])}),this.documentPaths$.pipe(je(k=>!!k),st(1)).subscribe(()=>{try{this.subscribeToCustomerMetadata()}catch(k){this.loggingService.catch("Error in DocService subscribeToCustomerMetadata:",k)}},k=>{this.loggingService.catch("Error in DocService subscribeToCustomerMetadata:",k)}),this.loggingService.log("%c[WB] Creating CLASS: DocService 2","color: blue;"),this.onWindowPopstate(),this.onWindowClick()}catch(k){this.loggingService.catch("Error in DocService constructor:",k)}}getOptionsFromDocumentPaths(){try{return this.documentPaths$.value?{folderId:this.documentPaths$.value?.folderId,allDocuments:this.documentPaths$.value?.allDocuments,locationId:this.documentPaths$.value?.locationId}:null}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.customerMetadata$.next(null),this.customerMetadataSubscription?.unsubscribe(),this.documentPaths$.value&&(this.draftOptions=this.getOptionsFromDocumentPaths(),this.draftDocuments=this.documentIds$.value.map(e=>({id:e.clientDocumentId})),this.draftLocationMap={locations:[this.location$.value?.location??null,...Object.values(this.locations$.value||{}).map(e=>e.location)].filter(e=>e!==null),options:{rootLocationId:this.location$.value?.location?.id}},this.currentDocumentId=null,this.documentPaths$.next(null),this.firestorePaths$.next(null)),this.unsetDocuments({source:"internal"})}catch(e){this.loggingService.catch("Error in DocService clearCacheOnUserCascade: ",e)}}setUsersService(e){try{this.usersService=e}catch(t){this.loggingService.catch("Error in setUsersService:",t)}}setCommonDbService(e){try{this.commonDbService=e}catch(t){this.loggingService.catch("Error in setCommonDbService:",t)}}setUserPermissionService(e){try{this.userPermissionService=e}catch(t){this.loggingService.catch("Error in setUserPermissionService:",t)}}setCommentService(e){try{this.commentService=e}catch(t){this.loggingService.catch("Error in setCommentService:",t)}}onWindowPopstate(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowPopstate","color: green;");try{this.domService.onWindowPopState$().subscribe(()=>{this.loggingService.log("location",location.href);let e=X9(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=X9(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(l){return X(this,arguments,function*({documentId:e,documentMetadata:t,options:o,source:a="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocument","color: green;"),a==="internal"&&this.analyticsService.trackEvent(Y.Events.Core.SET_DOCUMENTS_TRIGGERED,{payload:{id:e,documentMetadata:t,methodName:"setDocument",source:a}}),this.coreActionsService.triggerAction(ut.INIT_UPDATE,{event:Y.Events.Core.SET_DOCUMENTS_TRIGGERED,methodName:Ja.SET_DOCUMENTS,source:a,payload:{documentId:e,documentMetadata:t,options:o}}),yield this.setDocumentsImpl({documents:[{id:e,metadata:t}],options:b({organizationId:t?.organizationId},o??{}),source:a})}catch(s){this.loggingService.catch("Error in DocService setDocument:",s)}})}shouldSetDocumentsAgain(e,t={}){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: shouldSetDocumentsAgain","color: green;"),this.pendingDocumentIds.length>0&&e.length===this.pendingDocumentIds.length&&e.every(u=>this.pendingDocumentIds.includes(u.id))&&Ei(t,this.pendingOptions))return!1;let o=this.documentPaths$.value?.clientDocumentId,a=t?.rootDocumentId??e[0]?.id,l=this.documentIds$.value.map(v=>v.clientDocumentId),s=Z9(this.getOptionsFromDocumentPaths()??{})??{};return!e.every(v=>l.includes(v.id))||!Ei(s,t)||o!==a}catch(o){return this.loggingService.catch("Error in DocService shouldSetDocumentsAgain:",o),!0}}getDocumentIdsFromDocuments({documents:e,setClientDocumentMetadataMap:t=!1}){try{let o=[];return e.forEach(a=>{let l=a.id,s=`${Gn(l)}`;t&&a?.metadata&&typeof a.metadata=="object"&&(this.clientDocumentMetadataMap[l]=a.metadata),o.push({documentId:s,clientDocumentId:l})}),o}catch(o){return this.loggingService.catch("Error in DocService getDocumentIdsFromDocuments:",o),[]}}setDocuments(l){return X(this,arguments,function*({documents:e,options:t,source:o="internal",skipPermissionValidation:a=!1}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocuments","color: green;"),o==="internal"&&this.analyticsService.trackEvent(Y.Events.Core.SET_DOCUMENTS_TRIGGERED,{payload:{documents:e,options:t,methodName:"setDocuments",source:o}}),this.coreActionsService.triggerAction(ut.INIT_UPDATE,{event:Y.Events.Core.SET_DOCUMENTS_TRIGGERED,methodName:Ja.SET_DOCUMENTS,source:o,payload:{documents:e,options:t}}),yield this.setDocumentsImpl({documents:e,options:t??{},source:o,skipPermissionValidation:a})}catch(s){this.loggingService.catch("Error in DocService setDocuments:",s)}})}setRootDocument(o){return X(this,arguments,function*({document:e,source:t="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setRootDocument","color: green;"),this.coreActionsService.triggerAction(ut.INIT_UPDATE,{event:Y.Events.Core.SET_ROOT_DOCUMENT_TRIGGERED,methodName:Ja.SET_ROOT_DOCUMENT,source:t,payload:{document:e}});let a=this.getOptionsFromDocumentPaths()??{},l=this.documentIds$.value.map(s=>s.clientDocumentId);if(!l.includes(e.id)){let s=[...l.map(v=>({id:v})),{id:e.id}],d=this.getDocumentIdsFromDocuments({documents:s,setClientDocumentMetadataMap:!0});this.documentIds$.next(d)}yield this.setDocumentIdImpl(e.id,this.documentPaths$.value?.clientOrganizationId,a)}catch(a){this.loggingService.catch("Error in DocService setRootDocument:",a)}})}setDocContext(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocContext","color: green;");let t=JSON.parse(JSON.stringify(e??null));this.docContext$.next(t)}catch(t){this.loggingService.catch("Error in setDocContext: ",t)}}getDocContext(){return this.docContext$.getValue()}getDocContext$(){return this.docContext$.asObservable().pipe(xt(Qt))}getProcessedDocContext(){return Wde(this.getDocContext())}filterRelevantDocuments(a){return X(this,arguments,function*({options:e,documentIds:t,skipPermissionValidation:o=!1}){try{let l=this.authService.getUser();return!l||!this.commonDbService?.shouldUseFirestore()||(t=yield this.fetchDocumentsFromFolder(e,t,l),yield this.handlePermissionProvider(e,t,l),t=yield this.filterDocumentsByPermissions(e,t,l,o),t=t.slice(0,50)),t}catch(l){return this.loggingService.catch("Error in DocService filterRelevantDocuments:",l),t}})}fetchDocumentsFromFolder(e,t,o){return X(this,null,function*(){if(!e?.folderId||!e?.allDocuments)return t;try{let a=mr(this.functions,gr({url:wn?.cloudFunction?.sdkProxy,apiProxyDomain:this.configService?.getApiProxyDomain()}));(yield Cd({methodName:"getDocuments",data:{type:"getDocuments",metadata:{organizationId:e?.organizationId??o?.clientOrganizationId,folderId:e?.folderId}},getSdkProxy:a,userId:o?.userId??""}))?.data?.forEach(s=>{t.find(d=>d.clientDocumentId===s.id)||t.push({documentId:Bo(s.id),clientDocumentId:s.id})})}catch(a){this.loggingService.warn("Error in DocService fetchDocumentsFromFolder:",a)}return t})}buildPermissionRequests(e,t,o){try{let a=[];return e.organizationId&&e.organizationId!==o.clientOrganizationId&&a.push({userId:o.userId,resource:{id:e.organizationId,type:Wr.ORGANIZATION,source:tr.SET_DOCUMENTS,organizationId:e.organizationId,context:e?.context}}),e.folderId&&a.push({userId:o.userId,resource:{id:e.folderId,type:Wr.FOLDER,source:tr.SET_DOCUMENTS,organizationId:e?.organizationId??o?.clientOrganizationId??"",context:e?.context}}),t&&t.forEach(l=>{a.push({userId:o.userId,resource:{id:l.clientDocumentId,type:Wr.DOCUMENT,source:tr.SET_DOCUMENTS,organizationId:e?.organizationId??o?.clientOrganizationId??"",context:e?.context}})}),e?.context&&this.userPermissionService?.getIsContextEnabled()&&qde({input:e?.context}).forEach(s=>{let d=JSON.stringify(s.access);a.push({userId:o.userId,resource:{id:d,type:Wr.CONTEXT,source:tr.SET_DOCUMENTS,organizationId:e?.organizationId??o?.clientOrganizationId??"",context:s}})}),a}catch(a){return this.loggingService.catch("Error in buildPermissionRequests:",a),[]}}processAccessibleContexts(e,t){try{if(!e?.success||!e?.data?.length||!this.userPermissionService?.getIsContextEnabled())return;let o=e.data.filter(a=>a.type===Wr.CONTEXT&&a.hasAccess).map(a=>a.resourceId);if(this.loggingService.logContext("[CONTEXT] processAccessibleContexts called with accessibleContextIds:",JSON.parse(JSON.stringify(o??"nil"))),o?.length){let a=t.filter(s=>o.includes(s.resource.id)).map(s=>s.resource.context).filter(s=>!!s),l=Yde({input:a});this.loggingService.logContext("[CONTEXT] processAccessibleContexts called with accessibleContext:",JSON.parse(JSON.stringify(l??"nil"))),l?.access&&(this.loggingService.logContext("[CONTEXT] setting accessibleContext in docContext:",JSON.parse(JSON.stringify(l??"nil"))),this.setDocContext(l))}}catch(o){this.loggingService.catch("Error in processAccessibleContexts:",o)}}handlePermissionProvider(e,t,o){return X(this,null,function*(){if(this.userPermissionService?.isPermissionProviderAvailable())try{this.loggingService.logContext("[CONTEXT] handlePermissionProvider called with options:",JSON.parse(JSON.stringify(e??"nil")),"documentIds:",JSON.parse(JSON.stringify(t??"nil")),"user:",JSON.parse(JSON.stringify(o??"nil")));let a=this.buildPermissionRequests(e,t,o),l=St();this.coreActionsService.triggerAction(ut.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.RESOURCE_ACCESS_REQUEST_FORMED,methodName:tr.SET_DOCUMENTS,uniqueId:l,timestamp:new Date().getTime(),source:"internal",payload:{requests:a}});let s=yield this.userPermissionService?.onResourceAccessRequired({requests:a,uniqueId:l,methodName:tr.SET_DOCUMENTS,fromCache:!1});this.loggingService.logContext("[CONTEXT] handlePermissionProvider called with res:",JSON.parse(JSON.stringify(s??"nil")),"requests:",JSON.parse(JSON.stringify(a??"nil"))),this.processAccessibleContexts(s,a)}catch(a){this.loggingService.catch("Error in handlePermissionProvider:",a)}})}filterDocumentsByPermissions(e,t,o,a=!1){return X(this,null,function*(){if(a)return t;this.loggingService.logContext("[CONTEXT] filterDocumentsByPermissions called with options:",JSON.parse(JSON.stringify(e??"nil")),"documentIds:",JSON.parse(JSON.stringify(t??"nil")),"user:",JSON.parse(JSON.stringify(o??"nil")));let l=this.currentValidationToken,s=[...t];return l&&this.validatePermissionsInBackground(e,t,o,l),s})}validatePermissionsInBackground(e,t,o,a){let l=e?.organizationId??o?.clientOrganizationId;this.userPermissionService?.getUserPermissions({organizationId:l,documentIds:t.map(s=>s.clientDocumentId),folderIds:e?.folderId?[e?.folderId]:[]}).then(s=>{if(this.currentValidationToken===a&&s){this.userPermissionService?.setCurrentUserPermissions(s);let d=[];Object.entries(s?.[o.userId]?.documents??{}).forEach(([v,u])=>{u?.errorCode===qr.PERMISSION_DENIED&&d.push(v)}),l&&s?.[o.userId]?.organization?.[l]?.errorCode===qr.PERMISSION_DENIED&&this.loggingService.catch(`User does not have access to organization: ${l}`,void 0,void 0,!0),e?.folderId&&s?.[o.userId]?.folders?.[e?.folderId]?.errorCode===qr.PERMISSION_DENIED&&this.loggingService.catch(`User does not have access to folder: ${e?.folderId}`,void 0,void 0,!0),d.length>0&&(this.loggingService.catch(`User does not have access to documents: ${d.join(", ")}`,void 0,void 0,!0),this.handleDeniedDocumentAccess(d,o,a))}}).catch(s=>{this.loggingService.catch("Error in background permission validation:",s)})}handleDeniedDocumentAccess(e,t,o){try{if(this.currentValidationToken!==o)return;let a=this.documentPaths$.value;this.coreActionsService.triggerAction(ut.ERROR,{event:Y.Events.Core.SDK_ERROR,sourceMethod:"handleDeniedDocumentAccess",message:"Access denied to document after optimistic load",documentIds:e,userId:t.userId,timestamp:new Date().getTime()});let l=this.documentIds$.value||[],s=l.filter(d=>!e.includes(d.clientDocumentId));s.length!==l.length&&(s.length>0?this.setDocuments({documents:s.map(d=>({id:d.clientDocumentId})),options:{organizationId:a?.clientOrganizationId},source:"internal",skipPermissionValidation:!0}):(this.loggingService.catch("Error in DocService handleDeniedDocumentAccess: Documents provided are all denied"),this.coreActionsService.triggerAction(ut.ERROR,{event:Y.Events.Core.SDK_ERROR,sourceMethod:"handleDeniedDocumentAccess",message:"All documents provided are denied",documentIds:e,userId:t.userId,timestamp:new Date().getTime()}),this.unsetDocuments({source:"internal"})))}catch(a){this.loggingService.catch("Error in handleDeniedDocumentAccess:",a)}}addUserInfoToOrganization(l){return X(this,arguments,function*({organizationId:e,user:t,notificationsConfig:o,currentUserId:a}){try{let s=mr(this.functions,gr({url:wn?.cloudFunction?.sdkProxy,apiProxyDomain:this.configService?.getApiProxyDomain()}));yield Cd({data:b({type:"addUserInfoToOrganization",metadata:{organizationId:e},user:this.usersService?.externalUserDataProviderAvailable()?{userId:t?.userId}:t},o&&{notificationsConfig:o}),getSdkProxy:s,userId:a??t?.userId??""})}catch(s){this.loggingService.warn("Error in DocService addUserInfoToOrganization:",s)}})}setDocumentsImpl(l){return X(this,arguments,function*({documents:e,options:t,source:o,skipPermissionValidation:a=!1}){try{if(this.loggingService.logContext("[CONTEXT] setDocumentsImpl called with documents:",JSON.parse(JSON.stringify(e??"nil")),"options:",JSON.parse(JSON.stringify(t??"nil"))),!this.shouldSetDocumentsAgain(e,Z9(t))){o==="external"&&this.loggingService.catch("setDocuments called with previous request");return}let s=St();this.currentValidationToken=s;let d=this.getDocumentIdsFromDocuments({documents:e,setClientDocumentMetadataMap:!0});if(d?.length===0){this.loggingService.warn("Minimum one document must be set in setDocuments");return}let v=this.authService.getUser();if(!v){this.draftDocuments=e,this.draftOptions=t;return}this.pendingDocumentIds=e.map(S=>S.id),this.pendingOptions=Z9(t)??{},this.documentPaths$.value?.organizationId&&t?.organizationId&&this.documentPaths$.value?.organizationId!==t?.organizationId?this.authService.resetServicesCache():this.unsetDocuments({source:"internal",unsetDocumentPaths:!1});let u=t?.organizationId??v?.clientOrganizationId;if(u&&this.addUserInfoToOrganization({organizationId:u,user:v}),d=yield this.filterRelevantDocuments({options:t,documentIds:d,skipPermissionValidation:a}),this.documentIds$.next(d),d?.length){let S=d[0]?.clientDocumentId;t?.rootDocumentId&&d.find(k=>k.clientDocumentId===t?.rootDocumentId)&&(S=t?.rootDocumentId),yield this.debounceSetDocuments({documentId:S,clientOrganizationId:t?.organizationId,options:t})}this.pendingDocumentIds=[],this.pendingOptions={};return}catch(s){this.pendingDocumentIds=[],this.pendingOptions={},this.loggingService.catch("Error in DocService setDocumentsImpl:",s)}})}setDocumentId(a){return X(this,arguments,function*({documentId:e,clientOrganizationId:t,source:o="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocumentId","color: green;"),o==="internal"&&this.analyticsService.trackEvent(Y.Events.Core.SET_DOCUMENTS_TRIGGERED,{payload:{id:e,clientOrganizationId:t,methodName:"setDocumentId",source:o}}),this.coreActionsService.triggerAction(ut.INIT_UPDATE,{event:Y.Events.Core.SET_DOCUMENTS_TRIGGERED,methodName:Ja.SET_DOCUMENT_ID,source:o,payload:{documentId:e,clientOrganizationId:t}}),yield this.setDocumentsImpl({documents:[{id:e}],options:{organizationId:t},source:o})}catch(l){this.loggingService.catch("Error in setDocumentId:",l);return}})}debounceSetDocuments(a){return X(this,arguments,function*({documentId:e,clientOrganizationId:t,options:o}){try{this.loggingService.log("%c[WB] Calling FUNCTION: debounceSetDocuments","color: green;");let l=Date.now(),s=l-this.lastSetDocumentIdCallTime,d=l-this.lastSetDocumentIdExecutionTime;if(this.lastSetDocumentIdCallTime=l,this.queueSize>=this.MAX_QUEUE_SIZE){this.loggingService.warn("SetDocumentId queue size exceeded limit");return}if(!this.documentPaths$.value&&!this.isDocumentIdInDebounceQueue||s>this.DEBOUNCE_TIME&&d>this.DEBOUNCE_TIME){yield this.setDocumentIdImpl(e,t,o),this.lastSetDocumentIdExecutionTime=l;return}this.documentPaths$.next(null),this.isDocumentIdInDebounceQueue=!0,this.draftLocationMap={locations:[],options:void 0},this.queueSize++,this.setDocumentIdSubject.next({documentId:e,clientOrganizationId:t,options:o??void 0});return}catch(l){this.loggingService.catch("Error in debounceSetDocuments:",l)}})}setDocumentIdImpl(e,t,o){return X(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: setDocumentIdImpl","color: green;");try{let a=this.authService.getUser();if(!a)return;this.currentDocumentId&&this.documentPaths$.value&&(yield this.callPreDocumentIdChangeFunctions(this.documentPaths$.value));let l=this.currentDocumentId;if(this.apiKey){let s=`${Gn(e)}`,d=o?.folderId,v=o?.folderId?Mi(o?.folderId):void 0,u=o?.locationId,S=o?.allDocuments,k=a?.organizationId?t?Et(t):a?.organizationId:void 0,A=St(),P=Q1.SET_DOCUMENTS;this.coreActionsService.triggerAction(ut.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:A,methodName:Gr.INIT_DOCUMENTS,moduleName:P,source:"internal",payload:{documentIds:this.documentIds$.value.map(te=>te.clientDocumentId),organizationId:t??a?.clientOrganizationId??""}});let U=St(),W=ZE.SET_DOCUMENTS;if(this.coreActionsService.triggerAction(ut.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:U,moduleName:W,methodName:to.INIT_DOCUMENTS,source:"internal",payload:{documentIds:this.documentIds$.value.map(te=>te.clientDocumentId),organizationId:t??a?.clientOrganizationId??""}}),yield Promise.allSettled([this.commentResolverService.resolveCommentAnnotations({request:{documentIds:this.documentIds$.value.map(te=>te.clientDocumentId),organizationId:t??a?.clientOrganizationId??""},uniqueId:A,moduleName:P}),this.reactionResolverService.resolveReactionAnnotations({request:{documentIds:this.documentIds$.value.map(te=>te.clientDocumentId),organizationId:t??a?.clientOrganizationId??""},uniqueId:U,moduleName:W})]),this.currentDocumentId!==s||this.documentPaths$.value?.organizationId!==k){this.loggingService.log("setting new docid"),this.currentDocumentId=s;let te=new dR,ye=new ER;te.clientDocumentId=e,ye.clientDocumentId=e,te.folderId=d,ye.folderId=d,te.locationId=u,ye.locationId=u,te.allDocuments=S,ye.allDocuments=S,te.veltFolderId=v,ye.veltFolderId=v,te.documentId=s,ye.documentId=s,k&&(te.organizationId=k,te.clientOrganizationId=t??a?.clientOrganizationId,ye.organizationId=k,ye.clientOrganizationId=t??a?.clientOrganizationId);let me=`${this.apiKey}`,ke=`apiKey/${this.apiKey}`;k&&(me=`${me}/${V.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${te.organizationId}`,ke=`${ke}/${V.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${te.organizationId}`),ye.organization=`apiKey/${this.apiKey}/${V.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}`,ye.document=`${ke}/${V.FIREBASE_PARTIAL_PATH_DOCS}`,te.presence=`${me}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_PRESENCE}/`,te.cursor=`${me}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_CURSOR}/`,te.comment=`${me}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_COMMENT}/`,ye.comment=`${ke}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_COMMENT}`,te.multiThread=`${me}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_MULTI_THREAD}/`,ye.multiThread=`${ke}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_MULTI_THREAD}`,te.tag=`${me}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_TAG}/`,te.area=`${me}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_AREA}/`,ye.area=`${ke}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_AREA}`,te.arrow=`${me}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_ARROW}/`,te.selection=`${me}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_SELECTION}/`,te.audioHuddle=`${me}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_AUDIO_HUDDLE}/`,te.huddle=`${me}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_HUDDLE}/`,te.recorder=`${me}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_RECORDER}/`,ye.recorder=`${ke}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_RECORDER}`,te.flock=`${me}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_FOLLOW_ALONG}/`,te.syncVideoPlayer=`${me}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_SYNC_VIDEO_PLAYER}/`,te.liveState=`${me}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_LIVE_STATE}/`,te.liveStateSingleEditorMode=`${me}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_LIVE_STATE}/default/singleEditorMode`,te.reaction=`${me}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_REACTION}/`,ye.reaction=`${ke}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_REACTION}`,te.crdt=`${me}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_CRDT}/`,ye.crdt=`${ke}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_CRDT}`,te.customerMetadata=`${this.apiKey}/${V.FIREBASE_PARTIAL_PATH_CUSTOMER_METADATA}/`,te.views=`${me}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_VIEWS}/`,ye.notificationViews=`${ke}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_NOTIFICATION_VIEWS}`,ye.documentViews=`${ke}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_DOCUMENT_VIEWS}`,ye.locationViews=`${ke}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_LOCATION_VIEWS}`,te.notifications=`${me}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_NOTIFICATIONS}/`,te.metadata=`${me}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_METADATA}/`,te.users=`${me}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_USERS}/`,te.documentIam=`${me}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_IAM}/`,te.workspaceIam=`${this.apiKey}/${V.FIREBASE_PARTIAL_PATH_IAM}/`,te.groupContacts=`${me}/${V.FIREBASE_PARTIAL_PATH_CONTACTS}/${V.FIREBASE_PARTIAL_PATH_GROUPS}/`,te.globalContacts=`${me}/${V.FIREBASE_PARTIAL_PATH_CONTACTS}/${V.FIREBASE_PARTIAL_PATH_GLOBAL}/`,te.logins=`${me}/${V.FIREBASE_PARTIAL_PATH_CONTACTS}/${V.FIREBASE_PARTIAL_PATH_LOGINS}/`,te.userFeedback=`${me}/${V.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${V.FIREBASE_PARTIAL_PATH_FEEDBACK}/`,te.userReportBugs=`${me}/${V.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${V.FIREBASE_PARTIAL_PATH_BUGS}/`,te.userContactUs=`${me}/${V.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${V.FIREBASE_PARTIAL_PATH_CONTACT_US}/`,k&&(te.organizationMetadata=`${me}/${V.FIREBASE_PARTIAL_PATH_ORGANIZATION_METADATA}/`,te.organizationIam=`${me}/${V.FIREBASE_PARTIAL_PATH_IAM}/`,te.organizationGroups=`${me}/${V.FIREBASE_PARTIAL_PATH_ORGANIZATION_GROUPS}/`,te.organizationNotifications=`${me}/${V.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/`,s&&(te.organizationNotificationsWithDocumentId=`${me}/${V.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/`,te.heartbeatByDocument=`${me}/${V.FIREBASE_PARTIAL_PATH_HEARTBEAT_BY_DOCUMENT}/${s}/`),te.organizationNotificationsLastNotificationTimestamp=`${me}/${V.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${V.FIREBASE_PARTIAL_PATH_LAST_NOTIFICATION_TIMESTAMP}/${V.FIREBASE_PARTIAL_PATH_DOCS}/`,te.organizationNotificationsUsers=`${me}/${V.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${V.FIREBASE_PARTIAL_PATH_USERS}/`,te.heartbeat=`${me}/${V.FIREBASE_PARTIAL_PATH_HEARTBEAT}/`),ye.organizationUsers=`${ke}/${V.FIREBASE_PARTIAL_PATH_ORGANIZATION_USERS}`,ye.users=`${ke}/${V.FIREBASE_PARTIAL_PATH_CENTRAL_USERS}`,ye.documentUsers=`${ke}/${V.FIREBASE_PARTIAL_PATH_DOCS}/${s}/${V.FIREBASE_PARTIAL_PATH_DOCUMENT_USERS}`,ye.notificationDocs=`${ke}/${V.FIREBASE_PARTIAL_PATH_NOTIFICATION_DOCS}`,ye.notificationUsers=`${ke}/${V.FIREBASE_PARTIAL_PATH_NOTIFICATION_USERS}`,this.documentPaths$.next(te),this.firestorePaths$.next(ye),te?.clientOrganizationId&&te?.organizationId&&!(te?.clientOrganizationId===this.getOrganizationConfig()?.clientOrganizationId&&te?.organizationId===this.getOrganizationConfig()?.organizationId)&&this.organizationConfig$.next({organizationId:te?.organizationId,clientOrganizationId:te?.clientOrganizationId}),Promise.allSettled([this.updateFolderMetadata(),this.updateDocumentMetadata(),this.fetchLocationMetadata(),this.updateOrganizationMetadata()]),l&&this.location$.value&&this.removeLocation({}),this.coreActionsService.triggerAction(ut.INIT_UPDATE,{event:Y.Events.Doc.SET_DOCUMENTS_SUCCESS,payload:{documentId:s,clientDocumentId:e}}),this.analyticsService.trackEvent(Y.Events.Doc.SET_DOCUMENTS_SUCCESS,{documentId:s,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:t}){this.loggingService.log("%c[WB] Calling FUNCTION: unsetDocumentId","color: green;");try{e==="internal"&&this.analyticsService.trackEvent(Y.Events.Core.UNSET_DOCUMENTS_TRIGGERED,{payload:{methodName:"unsetDocumentId",source:e}}),this.coreActionsService.triggerAction(ut.INIT_UPDATE,{event:Y.Events.Doc.UNSET_DOCUMENTS_TRIGGERED,methodName:Ja.UNSET_DOCUMENT_ID,source:e}),this.unsetDocumentImpl({source:e,unsetDocumentPaths:t})}catch(o){this.loggingService.catch("Error in unsetDocumentId: ",o)}}unsetDocumentImpl({source:e,unsetDocumentPaths:t}){this.loggingService.log("%c[WB] Calling FUNCTION: unsetDocumentImpl","color: green;");try{let o=JSON.parse(JSON.stringify(this.documentIds$.value??[])),a=JSON.parse(JSON.stringify(this.documentPaths$.value?.folderId??""));this.currentDocumentId&&this.documentPaths$.value&&this.callPreDocumentIdChangeFunctions(this.documentPaths$.value),t&&(this.documentPaths$.next(null),this.firestorePaths$.next(null)),this.currentDocumentId=null,this.location$.next(null),this.excludedLocationIds$.next([]),this.documentMetadata$.next(null),this.locationMetadata$.next(null),this.locations$.next({}),this.documentIds$.next([]),this.userPermissionService?.revokeAccessOnDocumentUnset({documentIds:o,folderId:a}),this.coreActionsService.triggerAction(ut.INIT_UPDATE,{event:Y.Events.Doc.UNSET_DOCUMENTS_SUCCESS,source:e}),this.analyticsService.trackEvent(Y.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(o){this.loggingService.catch("Error in unsetDocumentImpl: ",o)}}unsetDocuments({source:e,unsetDocumentPaths:t=!0}){this.loggingService.log("%c[WB] Calling FUNCTION: unsetDocuments","color: green;");try{e==="internal"&&this.analyticsService.trackEvent(Y.Events.Core.UNSET_DOCUMENTS_TRIGGERED,{payload:{methodName:"unsetDocuments",source:e}}),this.coreActionsService.triggerAction(ut.INIT_UPDATE,{event:Y.Events.Doc.UNSET_DOCUMENTS_TRIGGERED,source:e,methodName:Ja.UNSET_DOCUMENTS}),this.unsetDocumentImpl({source:e,unsetDocumentPaths:t})}catch(o){this.loggingService.catch("Error in unsetDocuments: ",o)}}addPreDocumentIdChangeFunction(e,t){try{this.loggingService.log("%c[WB] Calling FUNCTION: addPreDocumentIdChangeFunction","color: green;"),this.preDocumentIdChangeFunctions.set(e,t)}catch(o){this.loggingService.catch("Error in addPreDocumentIdChangeFunction: ",o)}}callPreDocumentIdChangeFunctions(e){return X(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: callPreDocumentIdChangeFunctions","color: green;");for(let[t,o]of this.preDocumentIdChangeFunctions)try{yield o(e)}catch(a){this.loggingService.catch("Error in callPreDocumentIdChangeFunctions: ",a)}}catch(t){this.loggingService.catch("Error in callPreDocumentIdChangeFunctions: ",t)}})}fetchOrganizationMetadata(e){return X(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: fetchOrganizationMetadata","color: green;");try{if(!e&&this.getOrganizationConfig()&&(e=this.getOrganizationConfig()),this.db&&e?.organizationId){let t=e?.organizationId;yield this.commonDbService?.getData({feature:"organizationMetadata",properties:{apiKey:this.apiKey??"",organizationId:t,field:"metadata"}}).then(o=>{o&&!o?.errorCode&&this.organizationMetadata$.next(E(b({},this.organizationMetadata$.value),{[t]:o}))}).catch(o=>{this.loggingService.catch("Error in fetchOrganizationMetadata: ",o)})}}catch(t){this.loggingService.catch("Error in fetchOrganizationMetadata: ",t)}})}fetchDocumentMetadata(e){return X(this,null,function*(){try{if(this.db&&this.authService.getUser()){let t=this.documentPaths$.value,o=this.documentMetadata$.value;if(e=e.filter(a=>!o?.[a.documentId]),e?.some(a=>!a?.documentId||!a?.clientDocumentId)||!t)return;if(this.commonDbService?.shouldUseFirestore()){let a=t?.folderId,l=[],s={organizationId:t?.clientOrganizationId,folderId:a},d=[],v=20;for(let S=0;S<e.length;S+=v)d.push(e.slice(S,S+v));d.forEach(S=>{let k=JSON.parse(JSON.stringify(s));k.documentIds=S.map(A=>A.clientDocumentId),l.push(this.fetchDocuments(k))});let u={};l.length>0&&(yield Promise.all(l).then(S=>{S?.forEach(k=>{k?.forEach(A=>{A?.metadata?.documentId&&(u[A.metadata.documentId]=A.metadata)})}),this.setAllDocumentMetadata(b(b({},this.documentMetadata$.value),u))}).catch(S=>{this.loggingService.catch("Error in fetchDocumentMetadata: ",S)}))}else o?.[t?.documentId??e?.[0]?.documentId]||this.commonDbService?.queryData({feature:"allDocuments",properties:{apiKey:this.apiKey??"",organizationId:t?.organizationId,documentId:t?.documentId??e?.[0]?.documentId,skipObjectValues:!0}}).then(a=>{a?.documentId&&this.setDocumentMetadata(a.documentId,a)}).catch(a=>{this.loggingService.catch("Error in fetchDocumentMetadata: ",a)})}}catch(t){this.loggingService.catch("Error in fetchDocumentMetadata: ",t)}})}fetchLocationMetadata(){return X(this,null,function*(){try{if(this.db&&this.authService.getUser()){let e=this.documentPaths$.value,t=this.documentIds$.value,o=e?.folderId,a=e?.allDocuments,l=[],s={organizationId:e?.clientOrganizationId,folderId:o,allDocuments:a},d=[],v=20;for(let S=0;S<t.length;S+=v)d.push(t.slice(S,S+v));d.forEach(S=>{let k=JSON.parse(JSON.stringify(s));k.documentIds=S.map(A=>A.clientDocumentId),l.push(this.fetchLocations(k))});let u=this.locationMetadata$.value??{};l.length>0&&Promise.all(l).then(S=>{S?.forEach(k=>{k?.forEach(A=>{A?.metadata?.documentId&&(u[A.metadata.documentId]=E(b({},u?.[A.metadata.documentId]??{}),{[A.location.id]:A}))})}),Object.keys(u||{}).length>0&&this.locationMetadata$.next(u)}).catch(S=>{this.loggingService.catch("Error in fetchLocationMetadata: ",S)})}}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(Hn(t=>ce(null))).subscribe(t=>{this.customerMetadata$.next(t?.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(ge(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`${Gn(e)}`}catch(t){return this.loggingService.catch("Error in generateDocumentId: ",t),""}}generateOrganizationId(e){try{return`${Et(e)}`}catch(t){return this.loggingService.catch("Error in generateOrganizationId: ",t),""}}getFirestorePaths(){return this.loggingService.log("%c[WB] Calling FUNCTION: getFirestorePaths","color: green;"),this.firestorePaths$.value}setLocation(o){return X(this,arguments,function*({location:e,source:t="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setLocation","color: green;"),t==="internal"&&this.analyticsService.trackEvent(Y.Events.Core.SET_LOCATIONS_TRIGGERED,{payload:{locations:[e],options:void 0,methodName:"setLocation",source:t}}),this.coreActionsService.triggerAction(ut.INIT_UPDATE,{event:Y.Events.Core.SET_LOCATIONS_TRIGGERED,source:t,methodName:Ja.SET_LOCATION,payload:{locations:[e],options:void 0}}),this.setLocationsImpl({locations:[e]})}catch(a){this.loggingService.catch("Error in setLocation: ",a)}})}setLocations(a){return X(this,arguments,function*({locations:e,options:t,source:o="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setLocations","color: green;"),o==="internal"&&this.analyticsService.trackEvent(Y.Events.Core.SET_LOCATIONS_TRIGGERED,{payload:{locations:e,options:t,methodName:"setLocations",source:o}}),this.coreActionsService.triggerAction(ut.INIT_UPDATE,{event:Y.Events.Core.SET_LOCATIONS_TRIGGERED,methodName:Ja.SET_LOCATIONS,source:o,payload:{locations:e,options:t}}),this.setLocationsImpl({locations:e,options:t})}catch(l){this.loggingService.catch("Error in setLocations: ",l)}})}getValidLocations(e){try{let t=[];return e&&Array.isArray(e)&&e.forEach(o=>{if(o&&typeof o=="object"){let a=!0;o?.version&&(!o?.version?.id||!o?.version?.name)&&(this.loggingService.catch(`Error in setting location for locationId: ${o?.id}, If you're setting version then add id and name fields to version object.`),a=!1),a&&t.push(o)}}),t}catch(t){this.loggingService.catch("Error in getValidLocations: ",t)}return e}setRootLocation(o){return X(this,arguments,function*({location:e,source:t="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setRootLocation","color: green;"),t==="internal"&&this.analyticsService.trackEvent(Y.Events.Core.SET_ROOT_LOCATION_TRIGGERED,{payload:{location:e,methodName:"setRootLocation",source:t}}),this.coreActionsService.triggerAction(ut.INIT_UPDATE,{event:Y.Events.Core.SET_ROOT_LOCATION_TRIGGERED,methodName:Ja.SET_ROOT_LOCATION,source:t,payload:{location:e}});let a=Object.values(this.locations$.value).map(l=>l.location).filter(l=>String(l.id)!==String(e.id));this.setLocationsImpl({locations:[e,...a],options:{rootLocationId:e.id}})}catch(a){this.loggingService.catch("Error in DocService setRootLocation:",a)}})}setLocationsImpl({locations:e,options:t}){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: setLocationsImpl","color: green;"),e.length===0)return;if(!this.authService.getUser()){!t?.appendLocation&&e.length>0&&(this.draftLocationMap.options=E(b(b({},this.draftLocationMap.options??{}),t??{}),{rootLocationId:e[0].id})),this.draftLocationMap.locations=[...this.draftLocationMap.locations,...e],this.draftLocationMap.options=b(b({},this.draftLocationMap.options),t);return}let a=this.getValidLocations(e),l=[],s=[];this.location$.value?.location.id&&s.push(this.location$.value?.location.id),s=[...s,...Object.values(this.locations$.value).map(u=>u.location.id)].filter(u=>u!==void 0);let d;if(t?.rootLocationId&&t?.rootLocationId!==this.location$.value?.location.id&&(d=a.find(u=>u.id===t?.rootLocationId),!d)){this.loggingService.catch(`Error in setting locations, rootLocationId: ${t?.rootLocationId} not found in locations.`);return}if(t?.appendLocation){if(d){let u=fo(d),S=Gn(JSON.stringify(u));u.id&&l.push({locationId:S,location:u}),this.location$.next({locationId:S,location:u})}}else{d||(d=a[0]);let u=fo(d),S=Gn(JSON.stringify(u));u.id&&l.push({locationId:S,location:u}),this.location$.next({locationId:S,location:u})}let v=[];return a.slice(t?.appendLocation?0:1).forEach(u=>{if(u.id!==this.location$.value?.location.id){let S=b({},u),k=this.locations$.value;u?.id&&Object.keys(k).forEach(W=>{let te=k[W];te.location?.id===u.id&&(S=b(b({},te.location),u),delete k?.[W])});let A=this.genarateLocationId(S),P={locationId:A,location:S};S.id&&l.push({locationId:A,location:S}),v.push(P);let U=E(b({},k),{[A]:P});this.locations$.next(U)}}),this.updateDocumentLocationMetadata(l),this.coreActionsService.triggerAction(ut.INIT_UPDATE,{event:Y.Events.Doc.SET_LOCATIONS_SUCCESS,methodName:Ja.SET_LOCATIONS,payload:{locations:a,options:t}}),this.analyticsService.trackEvent(Y.Events.Doc.SET_LOCATIONS_SUCCESS,{locations:a,options:t},!0,this.getUserIdForAnalytics()),v}catch(o){this.loggingService.catch("Error in setLocationImpl: ",o);return}}addLocation({location:e,source:t="internal"}){try{return this.loggingService.log("%c[WB] Calling FUNCTION: addLocation","color: green;"),t==="internal"&&this.analyticsService.trackEvent(Y.Events.Core.SET_LOCATIONS_TRIGGERED,{payload:{locations:[e],options:{appendLocation:!0},methodName:"addLocation",source:t}}),this.coreActionsService.triggerAction(ut.INIT_UPDATE,{event:Y.Events.Core.SET_LOCATIONS_TRIGGERED,methodName:Ja.ADD_LOCATION,source:t,payload:{locations:[e],options:{appendLocation:!0}}}),this.setLocationsImpl({locations:[e],options:{appendLocation:!0}})}catch(o){this.loggingService.catch("Error in DocService addLocation:",o);return}}removeLocation({location:e,source:t="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeLocation","color: green;"),t==="internal"&&this.analyticsService.trackEvent(Y.Events.Core.REMOVE_LOCATIONS_TRIGGERED,{payload:{locations:[e],methodName:"removeLocation",source:t}}),this.coreActionsService.triggerAction(ut.INIT_UPDATE,{event:Y.Events.Core.REMOVE_LOCATIONS_TRIGGERED,source:t,methodName:Ja.REMOVE_LOCATION,payload:{locations:[e]}}),e&&this.removeLocationsImpl([e],t)}catch(o){this.loggingService.catch("Error in removeLocation: ",o)}}removeLocations({locations:e,source:t="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeLocations","color: green;"),t==="internal"&&this.analyticsService.trackEvent(Y.Events.Core.REMOVE_LOCATIONS_TRIGGERED,{payload:{locations:e,methodName:"removeLocations",source:t}}),this.coreActionsService.triggerAction(ut.INIT_UPDATE,{event:Y.Events.Core.REMOVE_LOCATIONS_TRIGGERED,methodName:Ja.REMOVE_LOCATIONS,source:t,payload:{locations:e}}),this.removeLocationsImpl(e,t)}catch(o){this.loggingService.catch("Error in removeLocations: ",o)}}removeLocationsImpl(e,t="internal"){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeLocations","color: green;"),t==="internal"&&this.analyticsService.trackEvent(Y.Events.Core.REMOVE_LOCATIONS_TRIGGERED,{payload:{locations:e},methodName:"removeLocations",message:"System removed locations",source:t},!0,this.getUserIdForAnalytics()),e?e.forEach(o=>{let a=this.genarateLocationId(o);this.getLocation()?.locationId===a&&(this.location$.next(null),t!=="internal"&&(this.draftLocationMap.locations=this.draftLocationMap.locations.filter(l=>l.id!==o.id))),this.removeCustomLocation(o)}):(this.location$.next(null),this.locations$.next({}),t!=="internal"&&(this.draftLocationMap.options=void 0,this.draftLocationMap.locations=[])),this.analyticsService.trackEvent(Y.Events.Doc.REMOVE_LOCATIONS_SUCCESS,{payload:{locations:e},source:t},!0,this.getUserIdForAnalytics())}catch(o){this.loggingService.catch("Error in removeLocation: ",o)}}unsetLocationIds(e,t="internal"){try{this.loggingService.log("%c[WB] Calling FUNCTION: unsetLocationIds","color: green;"),this.coreActionsService.triggerAction(ut.INIT_UPDATE,{event:Y.Events.Core.UNSET_LOCATIONS_TRIGGERED,methodName:Ja.UNSET_LOCATION_IDS,source:t,payload:{locationIds:e}}),t==="internal"&&this.analyticsService.trackEvent(Y.Events.Core.UNSET_LOCATIONS_TRIGGERED,{payload:{locationIds:e},methodName:"unsetLocationIds",message:"System unset location ids",source:t},!0,this.getUserIdForAnalytics()),e?.length?e.forEach(o=>{this.getLocation()?.location.id===o&&(this.location$.next(null),t!=="internal"&&(this.draftLocationMap.locations=this.draftLocationMap.locations.filter(a=>a.id!==o))),this.removeCustomLocationId(o)}):(this.location$.next(null),this.locations$.next({}),t!=="internal"&&(this.draftLocationMap.options=void 0,this.draftLocationMap.locations=[])),this.coreActionsService.triggerAction(ut.INIT_UPDATE,{event:Y.Events.Doc.REMOVE_LOCATIONS_SUCCESS,methodName:Ja.REMOVE_LOCATIONS_SUCCESS,source:t,payload:{locationIds:e}}),this.analyticsService.trackEvent(Y.Events.Doc.REMOVE_LOCATIONS_SUCCESS,{payload:{locationIds:e},source:t},!0,this.getUserIdForAnalytics())}catch(o){this.loggingService.catch("Error in unsetLocationIds: ",o)}}getLocation$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getLocation$","color: green;"),this.location$.asObservable()}getLocation(){return this.loggingService.log("%c[WB] Calling FUNCTION: getLocation$","color: green;"),this.location$.value?JSON.parse(JSON.stringify(this.location$.value)):null}excludeLocationIds(e){try{this.excludedLocationIds$.next([...e])}catch(t){this.loggingService.catch("Error in excludeLocationIds: ",t)}}getExcludedLocationIds$(){try{return this.excludedLocationIds$.asObservable()}catch(e){return this.loggingService.catch("Error in getExcludedLocationIds$: ",e),ce([])}}updateOrganizationMetadata(e){return X(this,null,function*(){try{!e&&this.getOrganizationConfig()&&(e=this.getOrganizationConfig());let t=e?.organizationId,o=this.documentPaths$.value;if(this.db&&t&&o?.documentId){if(this.organizationMetadata$.value?.[t])return;let l=new bR;l.apiKey=this.configService?.getApiKey()??"",l.organizationId=t,l.clientOrganizationId=e?.clientOrganizationId,this.userPermissionService?.hasEditAccess({organizationId:t})&&(yield this.commonDbService?.updateData({feature:"organizationMetadata",data:JSON.parse(JSON.stringify(l)),properties:{organizationId:t,documentId:o?.documentId??""}})),yield this.fetchOrganizationMetadata(e)}}catch(t){this.loggingService.catch("Error in updateOrganizationMetadata: ",t)}})}updateFolderMetadata(){return X(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(!e?.veltFolderId||!e?.organizationId)return;if(!(yield this.commonDbService?.getData({feature:"folderMetadata",properties:{organizationId:e?.organizationId??"",folderId:e?.veltFolderId??""}}))?.metadata){let o={folderId:this.documentPaths$.value?.folderId,clientOrganizationId:e?.clientOrganizationId,parentFolderId:"root"};if(this.userPermissionService?.hasEditAccess({folderId:this.documentPaths$.value?.veltFolderId??""})){let a=mr(this.functions,gr({url:wn?.cloudFunction?.sdkProxy,apiProxyDomain:this.configService?.getApiProxyDomain()}));yield Cd({methodName:"createFolder",data:{type:"createFolder",metadata:o},getSdkProxy:a,userId:this.authService.getUser()?.userId??""})}}}}catch(e){this.loggingService.catch("Error in updateFolderMetadata: ",e)}})}updateDocumentMetadata(){return X(this,null,function*(){try{if(this.db&&this.authService.getUser()){let e=this.documentPaths$.value;if(e){let t=this.getDocumentIds();t.find(a=>a.documentId===e.documentId)||t.push({documentId:e.documentId??"",clientDocumentId:e.clientDocumentId??""});let o=t.map(a=>X(this,null,function*(){let l=new cR;this.clientDocumentMetadataMap?.[a.clientDocumentId]&&(l=b(b({},this.clientDocumentMetadataMap[a.clientDocumentId]),l)),l.apiKey=this.configService?.getApiKey()??"",l.documentId=a.documentId,l.clientDocumentId=a.clientDocumentId,l.organizationId=e.organizationId,l.clientOrganizationId=e.clientOrganizationId,l.pageInfo=Wi();let s=e?.folderId,d=e?.veltFolderId;l?.pageInfo?.deviceInfo&&delete l?.pageInfo?.deviceInfo;let v=!0,u=this.documentMetadata$.value?.[a.documentId];if(s&&d){let S=this.getDocumentMetadata(a?.documentId??"")??(yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:a?.documentId??"",organizationId:e?.organizationId??"",field:"metadata"}}));S?.clientDocumentId&&!S?.errorCode?S?.folderId&&(S?.folderId!==s||S?.veltFolderId!==d)?(this.loggingService.catch(`Folder id mismatch for document ${a?.clientDocumentId??""}`),v=!1):S?.folderId===s?(s&&(l.folderId=s),d&&(l.veltFolderId=d)):(this.loggingService.catch(`Document ${a?.clientDocumentId??""} is not in the folder ${s??""}`),v=!1):(s&&(l.folderId=s),d&&(l.veltFolderId=d))}if(u){let S={};Object.entries(l).forEach(([k,A])=>{S[k]=A}),Ei(S,u)&&(v=!1)}v&&this.userPermissionService?.hasEditAccess({documentId:a?.documentId??"",folderId:e?.allDocuments&&e?.veltFolderId?e?.veltFolderId:void 0})&&(yield this.commonDbService?.updateData({feature:"documentMetadata",data:JSON.parse(JSON.stringify(l)),properties:{organizationId:e?.organizationId??"",documentId:a?.documentId??""}}))}));yield Promise.allSettled(o),yield this.fetchDocumentMetadata(t)}}}catch(e){this.loggingService.catch("Error in updateDocumentMetadata: ",e)}})}updateDocumentLocationMetadata(e){return X(this,null,function*(){try{if(this.db&&this.authService.getUser()){let t=this.documentPaths$.value;if(t){let o=this.getDocumentIds();o.find(a=>a.documentId===t.documentId)||o.push({documentId:t.documentId??"",clientDocumentId:t.clientDocumentId??""});for(let a of o){let l=yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:a?.documentId??"",organizationId:t?.organizationId??"",field:"metadata"}});l?.errorCode&&(l={});let s=[];for(let d of e){let v=new uR;v.locationId=d?.locationId,v.veltLocationId=_G(d?.location?.id??""),v.location=d?.location,v.pageInfo=Wi(),v?.pageInfo?.deviceInfo&&delete v?.pageInfo?.deviceInfo;let u=E(b({},l),{[V.FIREBASE_PARTIAL_PATH_LOCATIONS]:E(b({},l[V.FIREBASE_PARTIAL_PATH_LOCATIONS]??{}),{[d?.locationId]:v})});this.commonDbService?.shouldUseFirestore()||s.push(this.commonDbService?.updateData({feature:"documentMetadata",data:JSON.parse(JSON.stringify(u)),properties:{documentId:a?.documentId??"",organizationId:t?.organizationId??""}}));let S=this.locationMetadata$.value;if(S||(S={}),d?.location?.id){let k=S?.[a.documentId],A=k?.[d?.location?.id??""];S&&(k||(S[a.documentId]={}),A||(S[a.documentId][d?.location?.id??""]={}),S[a.documentId][d?.location?.id??""]=E(b({},A),{location:d?.location})),Object.keys(S||{}).length>0&&this.locationMetadata$.next(S)}}yield Promise.allSettled(s)}}}}catch(t){this.loggingService.catch("Error in updateDocumentLocationMetadata: ",t)}})}genarateLocationId(e){try{return e&&typeof e=="object"?Gn(JSON.stringify(fo(e))):0}catch(t){return this.loggingService.catch("Error in genarateLocationId: ",t),0}}removeCustomLocation(e,t="internal"){try{let o=this.genarateLocationId(e),a=this.locations$.value;a[o]&&(delete a[o],this.locations$.next(b({},a)),t!=="internal"&&this.isDocumentIdInDebounceQueue&&(this.draftLocationMap.locations=this.draftLocationMap.locations.filter(l=>l.id!==e.id)))}catch(o){this.loggingService.catch("Error in DocService removeLocation:",o)}}removeCustomLocationId(e,t="internal"){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeCustomLocationId","color: green;");let o=this.locations$.value;Object.entries(o).forEach(([a,l])=>{l.location.id===e&&(delete o[a],this.locations$.next(b({},o)),t!=="internal"&&this.isDocumentIdInDebounceQueue&&(this.draftLocationMap.locations=this.draftLocationMap.locations.filter(s=>s.id!==e)))})}catch(o){this.loggingService.catch("Error in DocService removeCustomLocationId:",o)}}getLocationByClientLocationId(e){try{let t=this.getLocation()?.location;if(t?.id===e)return t;{let o=this.getLocations();Object.keys(o).forEach(a=>{let l=o[a];l.location?.id===e&&(t=l.location)})}return t}catch(t){this.loggingService.catch("Error in DocService getLocationByClientLocationId:",t);return}}removeLocationIfNotInDom(){try{let e=this.locations$.value,t=document.querySelectorAll(`[${V.ATTRIBUTES.VELT_LOCATION}]`),o=[];t.forEach(a=>{let l=a.getAttribute(V.ATTRIBUTES.VELT_LOCATION);if(l){let s=JSON.parse(l),d=this.genarateLocationId(s);o.push(d)}}),Object.keys(e).forEach(a=>{let l=e[a];o.includes(l.locationId)||delete e[a]}),this.locations$.next(b({},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),ce({})}}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 t=null;if(e?.getAttribute(V.ATTRIBUTES.VELT_LOCATION)?t=e:t=e.closest(`[${V.ATTRIBUTES.VELT_LOCATION}]`),t){let o=t?.getAttribute(V.ATTRIBUTES.VELT_LOCATION);if(o){let a=JSON.parse(o);return{locationId:this.genarateLocationId(a),location:a}}}return null}catch(t){return this.loggingService.catch("Error in DocService getLocationFromElement:",t),null}}getElementMapWithLocation(){try{this.loggingService.log("%c[WB] Calling FUNCTION: getElementMapWithLocation","color: green;");let e={};return document.querySelectorAll(`[${V.ATTRIBUTES.VELT_LOCATION}], [${V.ATTRIBUTES.VELT_LOCATION_ID}]`).forEach(o=>{if(o.getAttribute(V.ATTRIBUTES.VELT_LOCATION)){let a=this.getLocationFromElement(o);a?.locationId&&(e[a.locationId]={element:o,location:a})}else if(o.getAttribute(V.ATTRIBUTES.VELT_LOCATION_ID)){let a=o.getAttribute(V.ATTRIBUTES.VELT_LOCATION_ID);if(a){let l=this.getLocationByClientLocationId(a);l?.locationId&&(e[l.locationId]={element:o,location:l});let s={id:a},d=this.genarateLocationId(s);e[a]={element:o,location:{locationId:d,location:s}}}}}),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 t;if(t=e?.closest(`[${V.ATTRIBUTES.VELT_LOCATION}], [${V.ATTRIBUTES.VELT_LOCATION_ID}]`),t){if(t?.getAttribute(V.ATTRIBUTES.VELT_LOCATION)){let o=t?.getAttribute(V.ATTRIBUTES.VELT_LOCATION);if(o)return JSON.parse(o)}else if(t?.getAttribute(V.ATTRIBUTES.VELT_LOCATION_ID)){let o=t?.getAttribute(V.ATTRIBUTES.VELT_LOCATION_ID);if(o)return{id:o}}}return null}catch(t){return this.loggingService.catch("Error in DocService getAdditionLocationFromElement:",t),null}}getAdditionalDocumentIdFromElement(e){try{return e?.closest(`[${V.ATTRIBUTES.VELT_DOCUMENT_ID}]`)?.getAttribute(V.ATTRIBUTES.VELT_DOCUMENT_ID)||null}catch(t){return this.loggingService.catch("Error in DocService getAdditionalDocumentIdFromElement:",t),null}}getDocumentMetadata(e){try{return e?this.documentMetadata$.value?.[e]||null:this.documentMetadata$.value?.[this.documentPaths$.value?.documentId??""]||null}catch(t){return this.loggingService.catch("Error in DocService getDocumentMetadata:",t),null}}getAllDocumentMetadata$(e){return this.getAllDocumentMetadataMap$().pipe(ge(t=>t?.[e??this.documentPaths$.value?.documentId??""]||null),xt(Qt))}getAllDocumentMetadata(){try{return Object.values(this.documentMetadata$.value||{})}catch(e){return this.loggingService.catch("Error in DocService getAllDocumentMetadata:",e),[]}}getAllDocumentMetadataMap$(){return this.documentMetadata$.asObservable().pipe(ge(e=>e||{}),xt(Qt))}getAllDocumentMetadataMap(){try{return 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||{},t={},o=this.documentPaths$.value?.veltFolderId,a=this.documentPaths$.value?.allDocuments;if(o&&a)Object.values(e).forEach(l=>{l?.documentId&&l?.veltFolderId===o&&(t[l.documentId]=l)});else{let l=this.documentIds$.value;if(l?.length)l.forEach(s=>{let d=e?.[s.documentId];d&&(t[s.documentId]=d)});else if(this.documentPaths$.value?.documentId){let s=e?.[this.documentPaths$.value?.documentId];s&&(t[this.documentPaths$.value?.documentId]=s)}}return Object.values(t)}catch(e){return this.loggingService.catch("Error in DocService getDocumentMetadataOfAvailableDocuments:",e),[]}}getDocumentMetadata$(e){return this.documentMetadata$.asObservable().pipe(ge(t=>t?.[e??this.documentPaths$.value?.documentId??""]||null),xt(Qt))}setDocumentMetadata(e,t){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocumentMetadata","color: green;");let o=JSON.parse(JSON.stringify(this.documentMetadata$.value??{}));o[e]=t,this.documentMetadata$.next(o)}catch(o){this.loggingService.catch("Error in DocService setDocumentMetadata:",o)}}setAllDocumentMetadata(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setAllDocumentMetadata","color: green;"),this.documentMetadata$.next(e)}catch(t){this.loggingService.catch("Error in DocService setAllDocumentMetadata:",t)}}getOrganizationMetadata(e){return this.organizationMetadata$.value?.[e]||null}getOrganizationMetadata$(e){return this.organizationMetadata$.asObservable().pipe(ge(t=>t?.[e]||null))}getOrganizationMetadataMap$(){return this.organizationMetadata$.asObservable().pipe(ge(e=>e||{}),xt(Qt))}getCustomerMetadata(){return this.customerMetadata$.value}getCustomerMetadata$(){return this.customerMetadata$.asObservable()}getOrganizationConfig$(){return this.organizationConfig$.asObservable().pipe(xt(Qt))}getOrganizationConfig(){return this.organizationConfig$.value}getMetadataFromType(e,t){try{switch(e){case"area":return;case"comment":return t?.multiThreadAnnotationId?this.commentService?.getMultiThreadAnnotationById(t.multiThreadAnnotationId)?.metadata:void 0;case"reaction":case"recorder":return t?.commentAnnotationId?this.commentService?.getAnnotationById(t.commentAnnotationId)?.metadata:void 0;default:return}}catch(o){this.loggingService.catch("Error in DocService getMetadataFromType:",o);return}}getDefaultMetadata({clientDocumentId:e,documentId:t}){try{let o=this.documentPaths$.value;if(!o)return;let a=e||o.clientDocumentId,l=t||o.documentId,s=this.getDocumentMetadata(l);if(!s)return;let d=s?.folderId,v=s?.veltFolderId;return b(b({apiKey:this.configService.getApiKey()??void 0,clientDocumentId:a,clientOrganizationId:o.clientOrganizationId,documentId:l,organizationId:o.organizationId},d?{folderId:d}:{}),v?{veltFolderId:v}:{})}catch(o){this.loggingService.catch("Error in DocService getDefaultMetadata:",o);return}}getBaseMetadata(e,t){try{let o,a;t?.element?o=this.getAdditionalDocumentIdFromElement(t.element)||void 0:t?.clientDocumentId&&(o=t.clientDocumentId),o&&(a=this.generateDocumentId(o));let l=this.getMetadataFromType(e,t),s=this.getDefaultMetadata({clientDocumentId:o,documentId:a});return l||s||{}}catch(o){return this.loggingService.catch("Error in DocService getBaseMetadata:",o),{}}}getServerId({documentId:e,organizationId:t}){try{return e&&(e=this.generateDocumentId(e)),t&&(t=this.generateOrganizationId(t)),{documentId:e,organizationId:t}}catch(o){return this.loggingService.catch("Error in DocService getServerId:",o),null}}fetchDocuments(e){return X(this,null,function*(){try{if(!this.authService.getUser())return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),[];let o=[];if(!e?.organizationId)return this.loggingService.catch("Error in fetchDocuments: organizationId is required"),[];if(e?.folderId){let l=Mi(e?.folderId);o.push(vt("metadata.veltFolderId","==",l))}return e?.documentIds?.length&&!e?.allDocuments&&o.push(vt("metadata.documentId","in",e?.documentIds?.map(l=>this.generateDocumentId(l)).slice(0,30))),yield this.commonDbService?.queryData({feature:"allDocuments",properties:{firestoreQuery:o,apiKey:this.apiKey??"",organizationId:this.generateOrganizationId(e?.organizationId)??this.documentPaths$.value?.organizationId,documentId:this.documentPaths$.value?.documentId}})}catch(t){return this.loggingService.catch("Error in DocService fetchDocuments:",t),[]}})}fetchLocations(e){return X(this,null,function*(){try{if(!this.authService.getUser())return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),[];let o=[];if(!e?.organizationId)return this.commonDbService?.shouldUseFirestore()&&this.loggingService.catch("Error in fetchLocations: organizationId is required"),[];if(e?.folderId){let l=Mi(e?.folderId);o.push(vt("metadata.veltFolderId","==",l))}return e?.documentIds?.length&&!e?.allDocuments&&o.push(vt("metadata.documentId","in",e?.documentIds?.map(l=>this.generateDocumentId(l)).slice(0,30))),yield this.commonDbService?.queryData({feature:"allLocations",properties:{firestoreQuery:o,apiKey:this.apiKey??"",organizationId:this.generateOrganizationId(e?.organizationId)??this.documentPaths$.value?.organizationId,documentId:this.documentPaths$.value?.documentId}})}catch(t){return this.loggingService.catch("Error in DocService fetchLocations:",t),[]}})}updateDocuments(e){return X(this,null,function*(){try{if(typeof e=="object"&&(e=JSON.parse(JSON.stringify(e??{}))),!this.authService.getUser())return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),[];let{organizationId:o,documents:a,folderId:l}=e;if(!o&&(o=this.documentPaths$.value?.clientOrganizationId,!o))return this.loggingService.catch("Error in updateDocuments: organizationId is required"),[];let s=Xa(o);if(!a||a.length===0)return this.loggingService.catch("Error in updateDocuments: documents is required"),[];let d=[],v=this.documentMetadata$.value??{};for(let u of a)if(u?.documentId){u.organizationId=s,u.clientOrganizationId=o,u.clientDocumentId=u.documentId;let S=Bo(u.documentId);u.documentId=S,u.apiKey=this.configService.getApiKey()??void 0,(l||this.documentPaths$.value?.folderId)&&(u.folderId=l||this.documentPaths$.value?.folderId,u.veltFolderId=Mi(l||this.documentPaths$.value?.folderId||""));let k=()=>{if(l&&this.documentPaths$.value?.folderId&&l!==this.documentPaths$.value?.folderId)return;let P=v?.[S];P?v[S]=b(b({},P),u):v[S]=u},A=yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:S,organizationId:s,field:"metadata"}});if(A?.errorCode&&(A={}),A&&A.apiKey&&A.folderId&&l&&A.folderId!=u.folderId){this.loggingService.catch(`Error in updateDocuments: document ${u.clientDocumentId} already exists with different folderId: ${A.folderId}`);continue}if(A&&A.apiKey&&!A.folderId&&u.folderId){this.loggingService.catch(`Error in updateDocuments: document ${u.clientDocumentId} already exists, move this document to folder with REST API`);continue}k(),u&&this.commonDbService&&this.userPermissionService?.hasEditAccess({documentId:u?.documentId??""})&&d.push(this.commonDbService.updateData({feature:"documentMetadata",data:JSON.parse(JSON.stringify(u)),properties:{organizationId:s,documentId:S}}))}yield Promise.all(d),this.setAllDocumentMetadata(v)}catch(t){return this.loggingService.catch("Error in DocService updateDocuments:",t),[]}})}updateLocations(e){return X(this,null,function*(){try{if(!this.authService.getUser())return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),[];let{organizationId:o,locations:a,documentIds:l}=e;if((!l||l.length===0)&&(l=this.documentIds$.value.map(u=>u.clientDocumentId)??[],l.length===0))return this.loggingService.catch("Error in updateLocations: documentId is required"),[];if(!o&&(o=this.documentPaths$.value?.clientOrganizationId,!o))return this.loggingService.catch("Error in updateLocations: organizationId is required"),[];if(!a||a.length===0)return this.loggingService.catch("Error in updateLocations: locations is required"),[];let s=l.map(u=>Bo(u)),d=[],v=this.locationMetadata$.value;v||(v={}),s.forEach(u=>{a.forEach(S=>{let k=this.location$.value;if(S?.id===k?.location?.id&&this.location$.next({locationId:k?.locationId,location:S}),S?.id){delete S?.metadata;let A=_G(S.id),P=v?.[u],U=P?.[S.id];v&&(P||(v[u]={}),U||(v[u][S.id]={}),v[u][S.id]=E(b({},U),{location:S})),S&&this.commonDbService&&d.push(this.commonDbService.updateData({feature:"locationMetadata",data:JSON.parse(JSON.stringify({location:S})),properties:{organizationId:Xa(o),documentId:u,id:A}}))}})}),yield Promise.all(d),Object.keys(v||{}).length>0&&this.locationMetadata$.next(v)}catch(t){return this.loggingService.catch("Error in DocService updateLocations:",t),[]}})}fetchFolders(e){return X(this,null,function*(){try{if(!this.authService.getUser())return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),[];let o=[];if(!e?.organizationId)return this.loggingService.catch("Error in fetchFolders: organizationId is required"),{data:[],parentFolders:[]};let a=[],l=this.generateOrganizationId(e?.organizationId);if(e?.folderId){let s=Mi(e?.folderId);o=yield this.commonDbService?.getData({feature:"folder",properties:{folderId:s,apiKey:this.apiKey??"",organizationId:l,documentId:this.documentPaths$.value?.documentId}}),o&&(o=[o]),a=yield this.commonDbService?.queryData({feature:"allFolders",properties:{firestoreQuery:[vt("metadata.veltParentFolderId","==",s)],folderId:s,apiKey:this.apiKey??"",organizationId:l,documentId:this.documentPaths$.value?.documentId}})}else o=yield this.commonDbService?.queryData({feature:"allFolders",properties:{apiKey:this.apiKey??"",organizationId:l,documentId:this.documentPaths$.value?.documentId}});return{data:o,parentFolders:a}}catch(t){return this.loggingService.catch("Error in DocService getFoldersRequest:",t),{data:[],parentFolders:[]}}})}getDocumentIam$(){return this.authService.getUser$().pipe(fe(e=>e?this.documentPaths$.pipe(fe(t=>t?.documentIam?this.commonDbService?.dbListener({feature:"documentIam",properties:{documentId:t.documentId,organizationId:t.organizationId,isCollection:!1}}).pipe(ge(o=>o?.data?.docIamConfig??o?.data),xt((o,a)=>JSON.stringify(o??{})===JSON.stringify(a??{}))):ce(null))):ce(null)))}getDocumentAccessType(e){try{return e&&e.features&&e.features.all?e.features.all.restricted?Ui.RESTRICTED:Ui.PUBLIC:e&&e.documentAccessType?e.documentAccessType:Ui.PUBLIC}catch(t){return this.loggingService.catch("Error in DocService getDocumentAccessType:",t),Ui.PUBLIC}}changeDocumentAccessType(e){return X(this,null,function*(){try{let t=this.documentPaths$.value;if(t){let o=yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:t?.documentId??"",organizationId:t?.organizationId??"",field:"docIamConfig"}});if(o?.errorCode)return;switch(delete o.documentAccessType,o.features||(o.features={}),o.features.all||(o.features.all={}),e){case Ui.PUBLIC:o.features.all.restricted=!1;break;case Ui.RESTRICTED:o.features.all.restricted=!0,o.features.all.guestMode=!1;break;default:break}this.commonDbService?.updateData({feature:"documentAccessType",data:JSON.parse(JSON.stringify(o)),properties:{documentId:t?.documentId??"",organizationId:t?.organizationId??""}})}}catch(t){this.loggingService.catch("Error in DocService changeDocumentAccessType:",t)}})}getUserIdForAnalytics(){try{return this.authService?.getAuthUser()?.uid||""}catch(e){return this.loggingService.catch("Error in DocService getUserIdForAnalytics:",e),""}}setUIState(e){try{this.uiState.next(b(b({},this.uiState.value),e))}catch(t){this.loggingService.catch("Error in DocService setUIState:",t)}}getUIState$(){return this.uiState.asObservable()}};r.\u0275fac=function(t){return new(t||r)(J(rt),J(Ge),J(On),J(Ve),J(Lt),J(x),J(vs),J(Pm),J(pi),J(Lr))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var Dn=(()=>{let r=class r{constructor(e,t,o,a,l){this.analyticsService=e,this.authService=t,this.coreActionsService=o,this.docService=a,this.loggingService=l,this.resolveOrganizationUsers=new be(!0),this.resolveFolderUsers=new be(!0),this.resolveDocumentUsers=new be(!0),this.unresolvedUsers=new be([]),this.resolveTimeout=60*1e3,this.resolveAttempts=new Map,this.subscriptions=new Fn,this.userDataProvider$=new be(null),this.anonymousUserDataProvider$=new be(null),this.userIdByEmailCache={},this.userById$=new be({}),this.userByIdCalled$=new be({}),this.pendingResolutions=new Set,this.getUserById=s=>{try{return this.userById$.value?.[s]}catch(d){this.loggingService.catch("Error in UsersService getUserById:",d);return}};try{this.docService.setUsersService(this),this.analyticsService.setUserService(this),this.authService.setUsersService(this),this.docService.getDocumentPaths$().pipe(je(s=>!!s),fe(()=>this.getUnresolvedUsers$().pipe(je(s=>s.length>0),Zi(300),st(20),fe(s=>{let d=this.docService.getOrganizationConfig()?.organizationId;return this.commonDbService?this.commonDbService?.dbListener({feature:"allOrganizationUsers",properties:{organizationId:d,isCollection:!0,useQuery:!0,firestoreQuery:[yi(vt("user.userId","in",s.slice(0,20)))]}}).pipe(ge(v=>v?.data),rn(v=>{if(v&&typeof v=="object"){delete v.undefined,delete v.null;let u=Object.values(v??{});this.setUserByIds(u.map(k=>k.user));let S=s.filter(k=>!u.some(A=>A.user.userId===k));S.length!==s.length&&this.setUnresolvedUsers(S)}})):ce([])})))).subscribe()}catch(s){this.loggingService.catch("Error in UsersService constructor:",s)}}setCommonDbService(e){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setCommonDbService","color: green;"),this.commonDbService=e}catch(t){this.loggingService.catch("Error in UsersService setCommonDbService:",t)}}setContactService(e){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setContactService","color: green;"),this.contactService=e}catch(t){this.loggingService.catch("Error in UsersService setContactService:",t)}}ngOnDestroy(){try{this.subscriptions.unsubscribe(),this.pendingResolutions.clear(),this.resolveAttempts.clear()}catch(e){this.loggingService.catch("Error in UsersService ngOnDestroy:",e)}}isResolverForFeatureDisabled(e){let t=this.userDataProvider$.getValue();try{switch(e){case"allOrganizationUsers":return t?!this.resolveOrganizationUsers.value:!0;case"allFolderUsers":return t?!this.resolveFolderUsers.value:!0;case"allDocumentUsers":return t?!this.resolveDocumentUsers.value:!0;default:return!1}}catch(o){return this.loggingService.catch("Error in UsersService isResolverForFeatureDisabled:",o),!1}}resolveUsers(v){return X(this,arguments,function*({userIds:e,forceResolve:t,feature:o,organizationId:a,skipUserCheck:l=!1,uniqueId:s,moduleName:d}){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: resolveUsers","color: green;");let u=!1;if(o&&(u=this.isResolverForFeatureDisabled(o)),u)return{};{let S={},k=[],A={};if(e?.forEach(P=>{let U=this.getUserById(P);U?S[P]=U:this.userByIdCalled$.getValue()[P]?t&&k.push(P):(k.push(P),this.userByIdCalled$.next(E(b({},this.userByIdCalled$.getValue()),{[P]:!0})))}),k.length>0){let P=s||St();this.coreActionsService.triggerAction(ut.USER_RESOLVER,{event:Y.Events.Resolver.USER_RESOLUTION_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:P,moduleName:d,methodName:eo.RESOLVE_USERS,source:"internal",payload:{userIds:k,organizationId:a,feature:o,forceResolve:t,skipUserCheck:l,externalUserDataProviderAvailable:this.externalUserDataProviderAvailable()}});let U={};try{let W,te=new Promise((ye,me)=>{W=setTimeout(()=>{me(new Error("User resolution timeout"))},this.userDataProvider$.getValue()?.config?.resolveTimeout||this.userDataProvider$.getValue()?.resolveTimeout||this.resolveTimeout)});U=yield Promise.race([this.getUsersFromDB({userIds:k,organizationId:a,skipUserCheck:l}).finally(()=>{clearTimeout(W)}),te]),this.analyticsService.trackEvent(Y.Events.Resolver.USER_RESOLVER_GET,{sourceMethod:"resolveUsers",source:"sdk",userIds:k}),this.coreActionsService.triggerAction(ut.USER_RESOLVER,{event:Y.Events.Resolver.USER_RESOLUTION_RESULT,timestamp:new Date().getTime(),uniqueId:P,methodName:eo.RESOLVE_USERS,moduleName:d,source:"internal",payload:{result:U,userIds:k,externalUserDataProviderAvailable:this.externalUserDataProviderAvailable()}})}catch(W){this.loggingService.catch("Error in UsersService resolveUsers getUsers:",W,{userIds:k}),this.coreActionsService.triggerAction(ut.USER_RESOLVER,{event:Y.Events.Resolver.USER_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:P,methodName:eo.RESOLVE_USERS,moduleName:d,source:"internal",payload:{error:W,userIds:k,externalUserDataProviderAvailable:this.externalUserDataProviderAvailable()}})}finally{k?.forEach(W=>{if(!U[W]){let te=new Set([...this.getUnresolvedUsers(),W]);this.unresolvedUsers.next(Array.from(te)),U[W]={userId:W,name:`User ${W}`}}})}Object.entries(U).forEach(([W,te])=>{te&&(S[W]=U?.[W],A[W]=U?.[W])})}return Object.keys(A).length>0&&(this.authService.setOptionalPropertiesToUsers(Object.values(A)),this.userById$.next(b(b({},this.userById$.getValue()),A))),S}}catch(u){this.loggingService.catch("Error in UsersService resolveUsers:",u);let S=s||St();return this.coreActionsService.triggerAction(ut.USER_RESOLVER,{event:Y.Events.Resolver.USER_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:S,methodName:eo.RESOLVE_USERS,moduleName:d,source:"internal",payload:{error:u,userIds:e,externalUserDataProviderAvailable:this.externalUserDataProviderAvailable()}}),{}}})}getUnresolvedUsers$(){return this.unresolvedUsers.asObservable()}getUnresolvedUsers(){this.loggingService.log("%c[WB] Calling UsersService FUNCTION: getUnresolvedUsers","color: green;");try{return JSON.parse(JSON.stringify(this.unresolvedUsers.getValue()))}catch(e){return this.loggingService.catch("Error in UsersService getUnresolvedUsers:",e),[]}}setUnresolvedUsers(e){this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setUnresolvedUsers","color: green;");try{if(Array.isArray(e)){let t=JSON.parse(JSON.stringify(e));this.unresolvedUsers.next(t)}}catch(t){this.loggingService.catch("Error in UsersService setUnresolvedUsers:",t)}}getUsersFromDB(a){return X(this,arguments,function*({userIds:e,organizationId:t,skipUserCheck:o=!1}){this.loggingService.log("%c[WB] Calling UsersService FUNCTION: getUsersFromDB","color: green;");try{let l=this.userDataProvider$.getValue();if(l){if(l.config?.getConfig?.url){if(t||(t=this.docService.getOrganizationConfig()?.organizationId),!t)return this.loggingService.catch("Error in getUsersFromDB: organizationId is required when using getConfig"),{};let u={organizationId:t,userIds:e},S=yield Sc(l.config.getConfig.url,l.config.getConfig.headers,u,!0);return S.statusCode!==200?(this.loggingService.catch(`Error in getUsersFromDB: config-based request failed with statusCode ${S.statusCode}. Message: ${S.message||"Unknown error"}`),{}):S.data??{}}let v=yield l.get(e);if(v&&typeof v=="object"&&"success"in v&&"statusCode"in v&&typeof v.success=="boolean"&&typeof v.statusCode=="number"){let u=v;return u.statusCode===200&&u.data?u.data:(this.loggingService.catch(`Error in getUsersFromDB: provider returned error response with statusCode ${u.statusCode}`),{})}return v}if(t||(t=this.docService.getOrganizationConfig()?.organizationId),!t)return{};let s=(yield this.getUsersFromDBWithBatching({userIds:e,organizationId:t,skipUserCheck:o}))??[];this.contactService?.setResolvedUsers(s.flat());let d={};return s.forEach(v=>{v.forEach(u=>{u?.user?.userId&&(d[u.user.userId]=u.user)})}),d}catch(l){return this.loggingService.catch("Error in UsersService getUsersFromDB:",l),{}}})}getUsersFromDBWithBatching(a){return X(this,arguments,function*({userIds:e,organizationId:t,skipUserCheck:o=!1}){try{if(!e?.length)return[];let l=[];for(let v=0;v<e.length;v+=30)l.push(e.slice(v,v+30));let s=l.map((v,u)=>X(this,null,function*(){try{return(yield this.commonDbService?.queryData({feature:"allOrganizationUsers",properties:{organizationId:t,useCollectionGroup:!1,isCollection:!0,firestoreQuery:[vt("user.userId","in",v)],skipUserCheck:o}}))||[]}catch(S){return this.loggingService.catch(`Error in batch ${u+1}:`,S),[]}}));return yield Promise.all(s)}catch(l){return this.loggingService.catch("Error in getUsersFromDBWithBatching:",l),[]}})}getTemporaryUsersFromDBWithBatching(a){return X(this,arguments,function*({userIds:e,organizationId:t,resourceIds:o}){try{if(!e?.length||!o?.length)return[];let l=[];for(let P=0;P<e.length;P+=30)l.push(e.slice(P,P+30));let s=[];for(let P=0;P<o.length;P+=30)s.push(o.slice(P,P+30));let d=[],v=0,u=(P,U)=>X(this,null,function*(){try{return((yield this.commonDbService?.queryData({feature:"allPermissionsUsers",properties:{organizationId:t,useCollectionGroup:!1,isCollection:!0,firestoreQuery:[yi(vt("userId","in",P),vt("veltResourceId","in",U))]}}))??[])||[]}catch(W){return this.loggingService.catch(`Error in batch ${v+1}:`,W),[]}});for(let P of l)for(let U of s)d.push(u(P,U)),v++;return(yield Promise.all(d)).flat().filter((P,U,W)=>U===W.findIndex(te=>te.userId===P.userId&&te.resourceId===P.resourceId))}catch(l){return this.loggingService.catch("Error in getTemporaryUsersFromDBWithBatching:",l),[]}})}getResolveOrganizationUsers$(){return this.resolveOrganizationUsers.asObservable()}getResolveFolderUsers$(){return this.resolveFolderUsers.asObservable()}getResolveDocumentUsers$(){return this.resolveDocumentUsers.asObservable()}getUserById$(){try{return this.loggingService.log("%c[WB] Calling UsersService FUNCTION: getUserById$","color: green;"),this.userById$.asObservable().pipe(xt(Qt))}catch(e){return this.loggingService.catch("Error in UsersService getUserById$:",e),ce({})}}setUserByIds(e){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setUserByIds","color: green;");let t=JSON.parse(JSON.stringify(this.userById$.getValue()??{}));e.forEach(o=>{t[o.userId]=b(b({},t?.[o.userId]??{}),o)}),this.userById$.next(t)}catch(t){this.loggingService.catch("Error in UsersService setUserByIds:",t)}}setUserDataProvider(e){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setUserDataProvider","color: green;");let t=e.config?.getConfig?.url,o="get"in e&&typeof e.get=="function";if(!t&&!o){this.loggingService.catch("DataProviders.user is invalid. The get method is missing or is not a function (and no getConfig provided).");return}this.userDataProvider$.next(e),e.config?.resolveUsersConfig?.organization===!1?this.resolveOrganizationUsers.next(!1):this.resolveOrganizationUsers.next(!0),e.config?.resolveUsersConfig?.folder===!1?this.resolveFolderUsers.next(!1):this.resolveFolderUsers.next(!0),e.config?.resolveUsersConfig?.document===!1?this.resolveDocumentUsers.next(!1):this.resolveDocumentUsers.next(!0)}catch(t){this.loggingService.catch("Error in UsersService setUserDataProvider:",t)}}setAnonymousUserDataProvider(e){try{if(this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setAnonymousUserDataProvider","color: green;"),!("resolveUserIdsByEmail"in e)||typeof e.resolveUserIdsByEmail!="function"){this.loggingService.catch("setAnonymousUserDataProvider is invalid. The resolveUserIdsByEmail method is missing or is not a function.");return}this.anonymousUserDataProvider$.next(e)}catch(t){this.loggingService.catch("Error in UsersService setAnonymousUserDataProvider:",t)}}resolveUserIdsByEmail(o){return X(this,arguments,function*({emails:e,uniqueId:t}){try{if(this.loggingService.log("%c[WB] Calling UsersService FUNCTION: resolveUserIdsByEmail","color: green;"),!e?.length)return{};let a=this.anonymousUserDataProvider$.getValue();if(!a||typeof a.resolveUserIdsByEmail!="function")return{};let l=[...new Set(e.filter(me=>!!me))];if(l.length===0)return{};let s={},d=[];if(l.forEach(me=>{let ke=this.userIdByEmailCache[me];ke?s[me]=ke:d.push(me)}),d.length===0)return s;let v=this.docService.getOrganizationConfig()?.clientOrganizationId||"",u=this.docService.getDocumentPaths()?.clientDocumentId||"",S=this.docService.getDocumentPaths()?.folderId||"",k={organizationId:v,documentId:u,folderId:S,emails:d},A=t||St();this.coreActionsService.triggerAction(ut.USER_RESOLVER,{event:Y.Events.Resolver.EMAIL_USER_ID_RESOLUTION_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:A,methodName:eo.RESOLVE_USER_IDS_BY_EMAIL,source:"internal",payload:{emails:d,organizationId:v,documentId:u,folderId:S}});let P=a.config?.resolveTimeout||this.resolveTimeout,U,W=new Promise((me,ke)=>{U=setTimeout(()=>{ke(new Error("resolveUserIdsByEmail timeout"))},P)}),te=a.config?.getRetryConfig||{retryCount:0,retryDelay:0},ye=X(this,null,function*(){try{let me=yield Bs(()=>a.resolveUserIdsByEmail(k),"resolveUserIdsByEmail",te);return me?.statusCode===200&&me?.data?me.data:(this.loggingService.catch(`Error in resolveUserIdsByEmail: provider returned statusCode ${me?.statusCode}. Message: ${me?.message||"Unknown error"}`),{})}finally{clearTimeout(U)}});try{let me=yield Promise.race([ye,W]);return Object.entries(me).forEach(([ke,De])=>{De&&(this.userIdByEmailCache[ke]=De,s[ke]=De,this.externalUserDataProviderAvailable()||this.docService.addUserInfoToOrganization({organizationId:this.docService.getOrganizationConfig()?.clientOrganizationId??"",user:{userId:De,name:ke,email:ke},currentUserId:this.authService.getUser()?.userId??""}).catch(Ie=>{this.loggingService.catch("Error in UsersService resolveUserIdsByEmail addUserInfoToOrganization:",Ie)}))}),this.coreActionsService.triggerAction(ut.USER_RESOLVER,{event:Y.Events.Resolver.EMAIL_USER_ID_RESOLUTION_RESULT,timestamp:new Date().getTime(),uniqueId:A,methodName:eo.RESOLVE_USER_IDS_BY_EMAIL,source:"internal",payload:{result:me,emails:d}}),s}catch(me){return this.loggingService.catch("Error in UsersService resolveUserIdsByEmail (timeout/race):",me),this.coreActionsService.triggerAction(ut.USER_RESOLVER,{event:Y.Events.Resolver.EMAIL_USER_ID_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:A,methodName:eo.RESOLVE_USER_IDS_BY_EMAIL,source:"internal",payload:{error:me,emails:d}}),s}}catch(a){return this.loggingService.catch("Error in UsersService resolveUserIdsByEmail:",a),{}}})}externalUserDataProviderAvailable(){try{return this.loggingService.log("%c[WB] Calling UsersService FUNCTION: externalUserDataProviderAvailable","color: green;"),!!this.commonDbService?.shouldUseFirestore()&&!!this.userDataProvider$.getValue()}catch(e){return this.loggingService.catch("Error in UsersService externalUserDataProviderAvailable:",e),!1}}userDataProviderAvailable(){try{return this.loggingService.log("%c[WB] Calling UsersService FUNCTION: userDataProviderAvailable","color: green;"),!!this.commonDbService?.shouldUseFirestore()}catch(e){return this.loggingService.catch("Error in UsersService userDataProviderAvailable:",e),!1}}};r.\u0275fac=function(t){return new(t||r)(J(rt),J(Ge),J(pi),J(lt),J(x))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var due=(()=>{let r=class r{constructor(e,t){this.loggingService=e,this.usersService=t}getUserIdsToResolveFromAreaAnnotations(e){try{this.loggingService.log("%c[WB] Calling AreaUtilsService FUNCTION: getUserIdsToResolveFromAreaAnnotations","color: green;");let t=new Set;for(let o of e)o?.from?.userId&&t.add(o?.from?.userId);return Array.from(t)}catch(t){return this.loggingService.catch("Error in AreaUtilsService getUserIdsToResolveFromAreaAnnotations:",t),[]}}mergeAreaWithUser(e){try{if(this.loggingService.log("%c[WB] Calling AreaUtilsService FUNCTION: mergeAreaWithUser","color: green;"),e?.from?.userId){let t=this.usersService.getUserById(e?.from?.userId);t&&(e.from=t)}return e}catch(t){return this.loggingService.catch("Error in AreaUtilsService mergeAreaWithUser:",t),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(t){return this.loggingService.catch("Error in AreaUtilsService formatAreaData:",t),e}}};r.\u0275fac=function(t){return new(t||r)(J(x),J(Dn))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var mue=(()=>{let r=class r{constructor(e,t){this.loggingService=e,this.usersService=t}getUserIdsToResolveFromArrowAnnotations(e){try{this.loggingService.log("%c[WB] Calling ArrowUtilsService FUNCTION: getUserIdsToResolveFromArrowAnnotations","color: green;");let t=new Set;for(let o of e)o?.from?.userId&&t.add(o?.from?.userId);return Array.from(t)}catch(t){return this.loggingService.catch("Error in ArrowUtilsService getUserIdsToResolveFromArrowAnnotations:",t),[]}}mergeArrowWithUser(e){try{if(this.loggingService.log("%c[WB] Calling ArrowUtilsService FUNCTION: mergeArrowWithUser","color: green;"),e?.from?.userId){let t=this.usersService.getUserById(e?.from?.userId);t&&(e.from=t)}return e}catch(t){return this.loggingService.catch("Error in ArrowUtilsService mergeArrowWithUser:",t),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(t){return this.loggingService.catch("Error in ArrowUtilsService formatArrowData:",t),e}}};r.\u0275fac=function(t){return new(t||r)(J(x),J(Dn))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var Iu=class{static getFirestoreProdDbName(r,i){return i?.databaseURL?.includes("snippyly-plugin.firebaseio.com")||i?.databaseURL?.includes("snippyly-plugin-staging.firebaseio.com")?"sfdb":i?.storeDbId??(this.isTestingDb(i?.databaseURL??"")?"sdktest":`apikey${r.toLowerCase()}`)}static isTestingDb(r){try{return r.includes("-test")}catch(i){return tt.error("Error in isTestingDb:",i),!1}}};var Eu=(()=>{let r=class r{constructor(e,t,o){this.coreActionsService=e,this.loggingService=t,this.analyticsService=o,this.retrySaveConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryDeleteConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.attachmentDataProvider$=new be(null);try{this.loggingService.log("AttachmentResolverService initialized"),this.attachmentDataProvider$.subscribe(a=>{a&&(a.config?.saveRetryConfig&&(this.retrySaveConfig=a.config.saveRetryConfig),a.config?.deleteRetryConfig&&(this.retryDeleteConfig=a.config.deleteRetryConfig))})}catch(a){this.loggingService.catch("Error in AttachmentResolverService constructor:",a)}}getProvider(){try{let e=this.attachmentDataProvider$.getValue();return e||void 0}catch(e){this.loggingService.catch("Error in AttachmentResolverService getProvider:",e);return}}makeAttachmentConfigBasedRequest(e,t,o,a){return X(this,null,function*(){try{let l=new FormData;l.append("file",o);let s={attachment:{attachmentId:a.attachment.attachmentId,name:a.attachment.name,mimeType:a.attachment.mimeType},metadata:a.metadata,event:a.event};l.append("request",JSON.stringify(s));let d={};t&&Object.entries(t).forEach(([S,k])=>{S.toLowerCase()!=="content-type"&&(d[S]=k)});let v=yield fetch(e,{method:"POST",headers:d,body:l});return v.ok?{data:(yield v.json())?.data??{},success:!0,statusCode:200}:(tt.catch(`Error in makeAttachmentConfigBasedRequest: ${v.status} ${v.statusText}`),{data:{},success:!1,statusCode:v.status})}catch(l){return tt.catch("Error in makeAttachmentConfigBasedRequest:",l),{data:{},success:!1,statusCode:500}}})}saveAttachment(e,t){return X(this,null,function*(){try{this.loggingService.log("%c[WB] Calling AttachmentResolverService FUNCTION: saveAttachment","color: green;");let o=this.getProvider();if(!this.attachmentDataProviderAvailable())throw new Error("Attachment save data provider not available");let a=t||St();this.coreActionsService.triggerAction(ut.ATTACHMENT_RESOLVER,{event:Y.Events.Resolver.ATTACHMENT_SAVE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:a,methodName:Ws.SAVE_ATTACHMENT,source:"internal",payload:{request:e}});let l=yield Bs(()=>X(this,null,function*(){if(o?.config?.saveConfig?.url){let s=e.attachment,{file:d}=s,v=Op(s,["file"]);return this.makeAttachmentConfigBasedRequest(o.config.saveConfig.url,o.config.saveConfig.headers,d,{attachment:v,event:e.eventType,metadata:e.attachment.metadata})}return o?.save({attachment:e.attachment,event:e.eventType,metadata:e.attachment.metadata})||Promise.resolve(void 0)}),"saveAttachment",this.retrySaveConfig);if(l?.statusCode!==200){this.loggingService.catch(l?.message??"Error in AttachmentResolverService saveAttachment:"),this.coreActionsService.triggerAction(ut.ATTACHMENT_RESOLVER,{event:Y.Events.Resolver.ATTACHMENT_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:Ws.SAVE_ATTACHMENT,source:"internal",payload:{error:l,request:e}});return}return this.analyticsService.trackEvent(Y.Events.Resolver.ATTACHMENT_RESOLVER_SAVE,{sourceMethod:"saveAttachment",source:"sdk",attachmentId:e.attachment.attachmentId,eventType:e.eventType}),this.coreActionsService.triggerAction(ut.ATTACHMENT_RESOLVER,{event:Y.Events.Resolver.ATTACHMENT_SAVE_RESULT,timestamp:new Date().getTime(),uniqueId:a,methodName:Ws.SAVE_ATTACHMENT,source:"internal",payload:{result:l,request:e}}),l}catch(o){this.loggingService.warn("Error in AttachmentResolverService saveAttachment:",o);let a=t||St();this.coreActionsService.triggerAction(ut.ATTACHMENT_RESOLVER,{event:Y.Events.Resolver.ATTACHMENT_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:Ws.SAVE_ATTACHMENT,source:"internal",payload:{error:o,request:e}});return}})}deleteAttachment(a,l){return X(this,arguments,function*({attachmentId:e,metadata:t},o){try{this.loggingService.log("%c[WB] Calling AttachmentResolverService FUNCTION: deleteAttachment","color: green;");let s=this.getProvider();if(!this.attachmentDataProviderAvailable())throw new Error("Attachment delete data provider not available");let d=o||St();this.coreActionsService.triggerAction(ut.ATTACHMENT_RESOLVER,{event:Y.Events.Resolver.ATTACHMENT_DELETE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:d,methodName:Ws.DELETE_ATTACHMENT,source:"internal",payload:{attachmentId:e,metadata:t}});let v=yield Bs(()=>{if(s?.config?.deleteConfig?.url){let u={attachmentId:e,metadata:t,event:Uo.ATTACHMENT_DELETE};return Sc(s.config.deleteConfig.url,s.config.deleteConfig.headers,u,!1)}return s?.delete({attachmentId:e,metadata:t,event:Uo.ATTACHMENT_DELETE})||Promise.resolve(void 0)},"deleteAttachment",this.retryDeleteConfig);return v?.statusCode!==200?(this.loggingService.catch(v?.message??"Error in AttachmentResolverService deleteAttachment:"),this.coreActionsService.triggerAction(ut.ATTACHMENT_RESOLVER,{event:Y.Events.Resolver.ATTACHMENT_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:d,methodName:Ws.DELETE_ATTACHMENT,source:"internal",payload:{error:v,attachmentId:e,metadata:t}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(Y.Events.Resolver.ATTACHMENT_RESOLVER_DELETE,{sourceMethod:"deleteAttachment",source:"sdk",attachmentId:e}),this.coreActionsService.triggerAction(ut.ATTACHMENT_RESOLVER,{event:Y.Events.Resolver.ATTACHMENT_DELETE_RESULT,timestamp:new Date().getTime(),uniqueId:d,methodName:Ws.DELETE_ATTACHMENT,source:"internal",payload:{result:{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0},attachmentId:e,metadata:t}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0})}catch(s){this.loggingService.warn("Error in AttachmentResolverService deleteAttachment:",s);let d=o||St();return this.coreActionsService.triggerAction(ut.ATTACHMENT_RESOLVER,{event:Y.Events.Resolver.ATTACHMENT_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:d,methodName:Ws.DELETE_ATTACHMENT,source:"internal",payload:{error:s,attachmentId:e,metadata:t}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0}}})}setAttachmentDataProvider(e){try{if(e){this.loggingService.log("Setting attachment data provider");let t=e.config,o=[{method:"save",configKey:"saveConfig"},{method:"delete",configKey:"deleteConfig"}],a=[];if(o.forEach(({method:l,configKey:s})=>{let d=t?.[s]?.url,v=l in e&&typeof e[l]=="function";!d&&!v&&a.push(l)}),a.length>0){let l=`DataProviders.attachment is invalid. The following methods are missing or are not functions (and no corresponding config provided): ${a.join(", ")}.`;this.loggingService.catch(l);return}else this.attachmentDataProvider$.next(e)}}catch(t){this.loggingService.catch("Error in AttachmentResolverService setAttachmentDataProvider:",t)}}attachmentDataProviderAvailable(){try{return!!this.attachmentDataProvider$.getValue()}catch(e){return this.loggingService.catch("Error in AttachmentResolverService attachmentDataProviderAvailable:",e),!1}}};r.\u0275fac=function(t){return new(t||r)(J(pi),J(x),J(rt))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var ku=(()=>{let r=class r{constructor(e,t,o,a,l,s,d,v){this.loggingService=e,this.usersService=t,this.authService=o,this.functions=a,this.configService=l,this.commentAnnotationsResolverService=s,this.attachmentResolverService=d,this.coreActionsService=v,this.notificationActionTypeMap={[Yt.NEWLY_ADDED]:Uo.COMMENT_ANNOTATION_ADD,[Yt.ADDED]:Uo.COMMENT_ADD,[Yt.UPDATED]:Uo.COMMENT_UPDATE,[Yt.DELETED]:Uo.COMMENT_DELETE}}setNotificationService(e){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: setNotificationService","color: green;"),this.notificationService=e}catch(t){this.loggingService.catch("Error in CommentUtilsService setNotificationService: ",t)}}setUserPermissionService(e){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: setUserPermissionService","color: green;"),this.userPermissionService=e}catch(t){this.loggingService.catch("Error in CommentUtilsService setUserPermissionService: ",t)}}getUserIdsToResolveFromComments(e){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: getUserIdsToResolveFromComments","color: green;");let t=new Set;for(let o of e){if(o?.from?.userId&&t.add(o?.from?.userId),o?.comments)for(let a of o?.comments){if(a?.from?.userId&&t.add(a?.from?.userId),a?.to)for(let l of a?.to)l?.userId&&t.add(l?.userId);if(a?.taggedUserContacts)for(let l of a?.taggedUserContacts)l?.userId&&t.add(l?.userId)}if(o?.assignedTo?.userId&&t.add(o?.assignedTo?.userId),o?.resolvedByUserId&&t.add(o?.resolvedByUserId),o?.subscribedUsers)for(let a of Object.values(o?.subscribedUsers))a.user.userId&&t.add(a.user.userId);if(o?.unsubscribedUsers)for(let a of Object.values(o?.unsubscribedUsers))a.user.userId&&t.add(a.user.userId)}return Array.from(t)}catch(t){return this.loggingService.catch("Error in CommentUtilsService getUserIdsToResolveFromComments:",t),[]}}mergeCommentWithUser(e){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: mergeCommentWithUser","color: green;"),e?.from?.userId){let t=this.usersService.getUserById(e?.from?.userId);t&&(e.from=t)}if(e?.comments)for(let t of e?.comments){if(t?.from?.userId){let a=this.usersService.getUserById(t?.from?.userId);a&&(t.from=a)}t?.to&&(t.to=t?.to?.map(a=>{if(a?.userId){let l=this.usersService.getUserById(a?.userId);if(l)return b(b({},a),l)}return a})),t?.taggedUserContacts&&(t.taggedUserContacts=t?.taggedUserContacts?.map(a=>{if(a?.contact){let l=this.usersService.getUserById(a?.contact?.userId);l&&(a.contact=l,(l?.name||l?.email)&&(a.text=`@${l?.name||l?.email}`))}return a}));let o=t?.taggedUserContacts?.filter((a,l,s)=>s.findIndex(d=>d.text===a.text)===l)||[];o.sort((a,l)=>(l.text?.length||0)-(a.text?.length||0)),o.forEach(a=>{if(a?.text){let l=new RegExp(bc(`{{${a.userId}}}`),"g");t.commentText?.includes(`@User ${a.userId}`)&&(l=new RegExp(bc(`@User ${a.userId}`),"g")),t.commentText=t.commentText?.replaceAll(l,a.text),t.commentHtml=t.commentHtml?.replaceAll(l,a.text)}})}if(e?.assignedTo?.userId){let t=this.usersService.getUserById(e?.assignedTo?.userId);t&&(e.assignedTo=t)}if(e?.resolvedByUserId){let t=this.usersService.getUserById(e?.resolvedByUserId);t&&(e.resolvedByUser=t)}if(e?.subscribedUsers)for(let t of Object.values(e?.subscribedUsers)){let o=this.usersService.getUserById(t.user.userId);o&&e?.subscribedUsers?.id?.user&&(e.subscribedUsers.id.user=o)}if(e?.unsubscribedUsers)for(let t of Object.values(e?.unsubscribedUsers)){let o=this.usersService.getUserById(t.user.userId);o&&e?.unsubscribedUsers?.id?.user&&(e.unsubscribedUsers.id.user=o)}return e}catch(t){return this.loggingService.catch("Error in CommentUtilsService mergeCommentWithUser:",t),e}}formatCommentData(e){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: formatCommentData","color: green;"),e?.comments?.forEach(t=>{t?.commentText&&t?.commentText?.length>0&&(t.isCommentTextAvailable=!0)}),e?.viewedBy&&delete e.viewedBy,e?.unread!==void 0&&delete e.unread,e?.resolvedByUser!==void 0&&delete e.resolvedByUser,e?.comments&&e.comments.forEach(t=>{t?.reactionAnnotations&&delete t.reactionAnnotations}),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 t of Object.keys(e?.subscribedUsers))e.subscribedUsers[t].user={userId:e?.subscribedUsers[t].user.userId};if(e?.unsubscribedUsers)for(let t of Object.keys(e?.unsubscribedUsers))e.unsubscribedUsers[t].user={userId:e?.unsubscribedUsers[t].user.userId}}return e?.comments&&(e.comments=e?.comments?.map(t=>this.formatCommentThreadData(t))),e}catch(t){return this.loggingService.catch("Error in CommentUtilsService formatCommentData:",t),e}}mergeStrippedDataWithCommentAnnotations(e){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: mergeStrippedDataWithCommentAnnotations","color: green;"),!this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable())return e;let t=this.commentAnnotationsResolverService.getAnnotationById(e?.annotationId),o=this.attachmentResolverService.attachmentDataProviderAvailable(),a=this.commentAnnotationsResolverService.getFieldsToRemove();return t&&(e?.comments?.forEach(l=>{let s=t?.comments?.[l?.commentId];if(s){l.commentHtml=s?.commentHtml,l.commentText=s?.commentText;let d=s?.attachments;o&&d&&l.attachments?.forEach(v=>{let u=v?.attachmentId;d?.[u]&&(v.name=d?.[u]?.name,v.url=d?.[u]?.url)})}}),t?.targetTextRange?.text&&e?.targetTextRange&&(e.targetTextRange.text=t?.targetTextRange?.text),a?.length>0&&a.forEach(l=>{t?.[l]&&(e[l]=t[l])})),e}catch(t){return this.loggingService.catch("Error in CommentUtilsService mergeStrippedDataWithCommentAnnotations:",t),e}}mergeLocationWithCommentAnnotations(e,t){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: mergeLocationWithCommentAnnotations","color: green;");let o=e?.location?.id,a=e?.metadata?.documentId;if(!o||!a)return e;let l=t?.[a]?.[o];return l&&(e.location=l?.location),e}catch(o){return this.loggingService.catch("Error in CommentUtilsService mergeLocationWithCommentAnnotations:",o),e}}isCommentsDataChanged(e,t){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: isCommentsDataChanged","color: green;");let o=this.commentAnnotationsResolverService.getCommentAnnotationById(t);return o?!Ei(e,o):!0}catch(o){return this.loggingService.catch("Error in CommentUtilsService isCommentsDataChanged:",o),!0}}stripCommentsFromAnnotationData({comment:e}){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: stripCommentsFromAnnotationData","color: green;");let t=this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable();if(!t)return e;let o=this.attachmentResolverService.attachmentDataProviderAvailable(),a=new yd;if(Object.assign(a,e),a.isCommentResolverUsed=t,o){let l=a.attachments?.map(s=>(s.isAttachmentResolverUsed=!0,delete s?.name,delete s?.url,s));a.attachments=l}return delete a?.commentHtml,delete a?.commentText,a}catch(t){return this.loggingService.catch("Error in CommentUtilsService stripCommentsFromAnnotationData:",t),e}}resolveTaggedUserEmails(e){return X(this,null,function*(){try{let t=new Set;if(e.comments?.forEach(o=>{o.taggedUserContacts?.forEach(a=>{a?.contact?.email&&!a?.userId&&t.add(a.contact.email)}),o.to?.forEach(a=>{a?.email&&!a?.userId&&t.add(a.email)})}),t.size>0){let o=St();this.coreActionsService.triggerAction(ut.USER_RESOLVER,{event:Y.Events.Resolver.EMAIL_USER_ID_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:o,methodName:eo.RESOLVE_USER_IDS_BY_EMAIL,source:"internal",payload:{emails:Array.from(t)}});let a=yield this.usersService.resolveUserIdsByEmail({emails:Array.from(t),uniqueId:o});Object.keys(a).length>0&&e.comments?.forEach(l=>{l.taggedUserContacts?.forEach(s=>{if(s?.contact?.email&&!s?.userId){let d=a[s.contact.email];if(d){let v=s.text;if(v){let u=bc(v),S=new RegExp(u,"g");l.commentText&&(l.commentText=l.commentText.replace(S,`{{${d}}}`)),l.commentHtml&&(l.commentHtml=l.commentHtml.replace(S,`{{${d}}}`))}s.userId=d,s.contact.userId=d,delete s.contact?.email,delete s.contact?.visibility,s.text=""}}}),l.to=l.to?.map(s=>{if(s?.email&&!s?.userId){let d=a[s.email];if(d)return delete s?.email,delete s?.visibility,E(b({},s),{userId:d})}return s})})}return e}catch(t){return this.loggingService.catch("Error in CommentUtilsService resolveTaggedUserEmails:",t),e}})}stripCommentAnnotationData(a){return X(this,arguments,function*({data:e,actionType:t,commentId:o}){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: stripCommentAnnotationData","color: green;"),e=yield this.resolveTaggedUserEmails(e),!this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable())return{originalData:e,strippedData:null};let l=this.attachmentResolverService.attachmentDataProviderAvailable(),s=this.commentAnnotationsResolverService.getFieldsToRemove(),d;t&&(d=this.notificationActionTypeMap?.[t]);let v={},u=null,S=!1;if(e&&e.annotationId){let A=e.annotationId;v[A]=b(b(b(b({annotationId:A,metadata:I1(e.metadata??{}),comments:{}},e?.from&&{from:e?.from}),e?.assignedTo&&{assignedTo:e?.assignedTo}),e?.resolvedByUserId&&{resolvedByUserId:e?.resolvedByUserId}),e?.targetTextRange?.text&&{targetTextRange:{text:e?.targetTextRange?.text}}),delete e?.targetTextRange?.text,s?.length>0&&s.forEach(U=>{e?.[U]&&(v[A][U]=e[U],delete e[U])}),e.comments?.forEach(U=>{if(U.commentId){let W;l&&(W={},U.attachments?.forEach(te=>{W[te.attachmentId]={attachmentId:te.attachmentId,name:te.name,url:te.url}})),v[A].comments[U.commentId]=b(b(b(b(b(b({commentId:U.commentId},U?.commentHtml&&{commentHtml:U?.commentHtml}),U?.commentText&&{commentText:U?.commentText}),W&&{attachments:W}),U?.from&&{from:U?.from}),U?.to&&{to:U?.to}),U?.taggedUserContacts&&{taggedUserContacts:U?.taggedUserContacts})}}),S=this.isCommentsDataChanged(v[A],A);let P=new _r;Object.assign(P,e),P.comments=e.comments?.map(U=>this.stripCommentsFromAnnotationData({comment:U}))||[],u=P}let k=u?.comments?.find(A=>A.commentId===o);return k?.isDraft&&(d=u?.comments?.length&&u?.comments?.length>0?Uo.COMMENT_ADD:Uo.COMMENT_ANNOTATION_ADD),{strippedData:S&&(t&&this.notificationActionTypeMap?.[t]||k?.isDraft)?v:null,originalData:u,eventType:d}}catch(l){return this.loggingService.catch("Error in CommentAnnotationsResolverService stripCommentAnnotationData:",l),{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(o=>o?.userId?{userId:o.userId}:o)),e?.taggedUserContacts&&(e.taggedUserContacts=e?.taggedUserContacts?.map(o=>o?.contact?.userId?E(b({},o),{contact:{userId:o.contact.userId}}):o));let t=e?.taggedUserContacts?.filter((o,a,l)=>l.findIndex(s=>s.text===o.text)===a)||[];t.sort((o,a)=>(a.text?.length||0)-(o.text?.length||0)),t.forEach(o=>{if(o?.text&&o?.contact?.userId){let a=new RegExp(bc(o.text),"g");e.commentText=e.commentText?.replaceAll(a,l=>`{{${o.userId}}}`),e.commentHtml=e.commentHtml?.replaceAll(a,l=>`{{${o.userId}}}`)}}),t.forEach(o=>{o?.text&&o?.contact?.userId&&(o.text="")})}return e}catch(t){return this.loggingService.catch("Error in CommentUtilsService formatCommentThreadData:",t),e}}getDeniedForYouUsers(t){return X(this,arguments,function*({extraData:e}){try{let o=Object.values(e?.annotationData?.subscribedUsers||{}).map(l=>l.user.userId)??[],a=[];if(this.userPermissionService?.isPermissionProviderAvailable()&&o.length){let l=e?.metadata?.clientDocumentId,s=e?.annotationData?.context?.access&&this.userPermissionService?.getIsContextEnabled()?e?.annotationData?.context?.access:null,d=[];o.forEach(S=>{if(d.push({userId:S,resource:{id:l,type:Wr.DOCUMENT,source:tr.SET_NOTIFICATIONS,organizationId:e?.metadata?.clientOrganizationId??"",context:s?{access:s}:void 0}}),s){let k=JSON.stringify(s);d.push({userId:S,resource:{id:k,type:Wr.CONTEXT,source:tr.SET_NOTIFICATIONS,organizationId:e?.metadata?.clientOrganizationId??"",context:{access:s}}})}});let v=St();this.coreActionsService.triggerAction(ut.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.RESOURCE_ACCESS_REQUEST_FORMED,methodName:tr.SET_NOTIFICATIONS,uniqueId:v,timestamp:new Date().getTime(),source:"internal",payload:{requests:d}});let u=yield this.userPermissionService?.onResourceAccessRequired({requests:d,uniqueId:v,methodName:tr.SET_NOTIFICATIONS});u?.success&&u?.data?.length&&u.data.forEach(S=>{S.hasAccess||a.push(S.userId)})}return a}catch(o){return this.loggingService.catch("Error in CommentUtilsService getDeniedForYouUsers:",o),[]}})}handleCommentEncryption(s){return X(this,arguments,function*({data:e,firestorePath:t,extraData:o,eventType:a,metadata:l}){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: handleCommentEncryption","color: green;");let d=G9(this.authService.getFirebaseConfig()?.firebaseOptions),v=mr(this.functions,gr({url:wn.cloudFunction?.[d]?.setEncryptedData,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:1200*1e3});if(o){o=this.notificationService?.processNotificationData(o),o.annotationData=e;let P=o?.targetAnnotationData?.commentId;if(P){let U=e?.comments?.find(W=>W?.commentId===P);U&&(o.targetAnnotationData=U)}try{let U=yield this.stripCommentAnnotationData({data:o.annotationData,actionType:o?.actionType??Yt.NEWLY_ADDED});U?.originalData&&(o.annotationData=this.formatCommentData(U.originalData)),o?.targetAnnotationData&&(o.targetAnnotationData=this.formatCommentThreadData(this.stripCommentsFromAnnotationData({comment:o.targetAnnotationData})))}catch(U){this.loggingService.warn("Error in CommentUtilsService handleCommentEncryption:",U)}}let u=Iu.getFirestoreProdDbName(this.configService.getApiKey()??"",this.authService.getFirebaseConfig()?.firebaseOptions),S=yield this.getDeniedForYouUsers({extraData:o}),k={path:t??"",data:e??{},dbId:u??"",notificationData:o||void 0,notificationURL:wn.firebaseNotificationsDatabaseURL,feature:"comment",eventType:a??"PATCH",sdkVersion:Ra(),deniedForYouUsers:S,isPermissionProviderUsed:this.userPermissionService?.isPermissionProviderAvailable(),isCommentResolverUsed:this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable(),isSettingsConfigByOrganization:this.notificationService?.getSettingsConfigByOrganization(),metadata:l},A=yield Us(k,this.authService.getUser()?.userId??"");yield v({veltData:A})}catch(d){this.loggingService.catch("Error in CommentUtilsService handleCommentEncryption:",d)}})}};r.\u0275fac=function(t){return new(t||r)(J(x),J(Dn),J(Ge),J(Lr),J(Lt),J(vs),J(Eu),J(pi))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var gue=(()=>{let r=class r{constructor(e,t){this.loggingService=e,this.usersService=t}getUserIdsToResolveFromUserIamData(e){try{this.loggingService.log("%c[WB] Calling ContactUtilsService FUNCTION: getUserIdsToResolveFromUserIamData","color: green;");let t=new Set;if(e?.length)for(let o of e)o?.user?.userId&&t.add(o?.user?.userId);return Array.from(t)}catch(t){return this.loggingService.catch("Error in ContactUtilsService getUserIdsToResolveFromUserIamData: ",t),[]}}mergeUserIamWithUser(e){try{if(this.loggingService.log("%c[WB] Calling ContactUtilsService FUNCTION: mergeUserIamWithUser","color: green;"),e?.user?.userId){let t=this.usersService.getUserById(e?.user?.userId);if(t){let o=t;e?.user&&typeof e.user=="object"&&(o=b(b({},o),e.user)),e=E(b({},e),{user:o})}}return e}catch(t){return this.loggingService.catch("Error in ContactUtilsService mergeUserIamWithUser: ",t),e}}};r.\u0275fac=function(t){return new(t||r)(J(x),J(Dn))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var vue=(()=>{let r=class r{constructor(e,t){this.loggingService=e,this.usersService=t}getUserIdsToResolveFromCursorUsers(e){try{this.loggingService.log("%c[WB] Calling CursorUtilsService FUNCTION: getUserIdsToResolveFromCursorUsers","color: green;");let t=new Set;for(let o of e)o?.userId&&t.add(o?.userId);return Array.from(t)}catch(t){return this.loggingService.catch("Error in CursorUtilsService getUserIdsToResolveFromCursorUsers:",t),[]}}mergeCursorUserWithUser(e){try{if(this.loggingService.log("%c[WB] Calling CursorUtilsService FUNCTION: mergeCursorUserWithUser","color: green;"),this.usersService.userDataProviderAvailable()&&e?.userId){let t=this.usersService.getUserById(e?.userId);t&&(e=b(b({},e),t))}return e}catch(t){return this.loggingService.catch("Error in CursorUtilsService mergeCursorUserWithUser:",t),e}}formatCursorUserData(e){try{if(this.loggingService.log("%c[WB] Calling CursorUtilsService FUNCTION: formatCursorUserData","color: green;"),this.usersService.userDataProviderAvailable()){let t=["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(o=>{t.includes(o)||(e[o]=null)})}return e}catch(t){return this.loggingService.catch("Error in CursorUtilsService formatCursorUserData:",t),e}}};r.\u0275fac=function(t){return new(t||r)(J(x),J(Dn))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var wR=(()=>{let r=class r{constructor(e,t,o){this.coreActionsService=e,this.loggingService=t,this.usersService=o}getUserIdsToResolveFromHuddleAttendees(e){try{this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: getUserIdsToResolveFromHuddleAttendees","color: green;");let t=new Set;for(let o of e)o?.userId&&t.add(o?.userId);return Array.from(t)}catch(t){return this.loggingService.catch("Error in HuddleUtilsService getUserIdsToResolveFromHuddleAttendees:",t),[]}}mergeHuddleAttendeeWithUser(e){try{if(this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: mergeHuddleAttendeeWithUser","color: green;"),e?.userId){let t=this.usersService.getUserById(e?.userId);t&&(e=b(b({},e),t))}return e}catch(t){return this.loggingService.catch("Error in HuddleUtilsService mergeHuddleAttendeeWithUser:",t),e}}formatHuddleAttendeeData(e){try{if(this.usersService.userDataProviderAvailable()){let t=["userId","userSnippylyId","state","timestamp","initialHuddleMode","streamMetadata","initialHuddleType","huddleOnCursorMode"];Object.keys(e).forEach(o=>{t.includes(o)||(e[o]=null)})}return e}catch(t){return this.loggingService.catch("Error in HuddleUtilsService formatHuddleAttendeeData:",t),e}}getUserIdsToResolveFromHuddleMessages(e){try{this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: getUserIdsToResolveFromHuddleMessages","color: green;");let t=new Set;for(let o of e)o?.from?.userId&&t.add(o?.from?.userId);return Array.from(t)}catch(t){return this.loggingService.catch("Error in HuddleUtilsService getUserIdsToResolveFromHuddleMessages:",t),[]}}mergeHuddleMessageWithUser(e){try{if(this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: mergeHuddleMessageWithUser","color: green;"),e?.from?.userId){let t=this.usersService.getUserById(e?.from?.userId);t&&(e.from=t)}return e}catch(t){return this.loggingService.catch("Error in HuddleUtilsService mergeHuddleMessageWithUser:",t),e}}resolveUsersFromHuddleMessages(e){return X(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: resolveUsersFromHuddleMessages","color: green;"),this.usersService.userDataProviderAvailable()){let t=this.getUserIdsToResolveFromHuddleMessages(e),o=St(),a=Gs.GET_HUDDLE_USERS;this.coreActionsService.triggerAction(ut.USER_RESOLVER,{event:Y.Events.Resolver.USER_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:o,methodName:eo.RESOLVE_USERS_FROM_HUDDLE_MESSAGES,moduleName:a,source:"internal",payload:{userIds:t}});let l=yield this.usersService.resolveUsers({userIds:t,uniqueId:o,moduleName:a});for(let s of e)s?.from?.userId&&l[s.from.userId]&&(s.from=l[s.from.userId])}return e}catch(t){return this.loggingService.catch("Error in HuddleUtilsService resolveUsersFromHuddleMessages:",t),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(t){return this.loggingService.catch("Error in HuddleUtilsService formatHuddleMessageData:",t),e}}};r.\u0275fac=function(t){return new(t||r)(J(pi),J(x),J(Dn))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var DR=(()=>{let r=class r{constructor(e,t,o){this.coreActionsService=e,this.loggingService=t,this.usersService=o}getUserIdsToResolveFromLiveStateCustom(e){try{let t=new Set;return e?.updatedBy&&t.add(e?.updatedBy?.userId),Array.from(t)}catch(t){return this.loggingService.catch("Error in LiveStateUtilsService getUserIdsToResolveFromLiveStateCustom:",t),[]}}mergeLiveStateCustomWithUser(e){try{if(e?.updatedBy?.userId){let t=this.usersService.getUserById(e?.updatedBy?.userId);t&&(e.updatedBy=t)}return e}catch(t){return this.loggingService.catch("Error in LiveStateUtilsService mergeLiveStateCustomWithUser:",t),e}}formatLiveStateCustomData(e){try{return this.usersService.userDataProviderAvailable()&&e?.updatedBy&&(e.updatedBy={userId:e.updatedBy.userId}),e}catch(t){return this.loggingService.catch("Error in LiveStateUtilsService formatLiveStateCustomData:",t),e}}getUserIdsToResolveFromLiveStateCustoms(e){try{let t=new Set;for(let o of e)o?.updatedBy?.userId&&t.add(o?.updatedBy?.userId);return Array.from(t)}catch(t){return this.loggingService.catch("Error in LiveStateUtilsService getUserIdsToResolveFromLiveStateCustoms:",t),[]}}getUserIdsToResolveFromLiveStates(e){try{let t=new Set;return e?.default?.singleEditorMode?.editor?.userId&&t.add(e?.default?.singleEditorMode?.editor?.userId),Array.from(t)}catch(t){return this.loggingService.catch("Error in LiveStateUtilsService getUserIdsToResolveFromLiveStates:",t),[]}}getUserIdsToResolveFromLiveStateSingleEditorMode(e){try{let t=new Set;return e?.editor?.userId&&t.add(e?.editor?.userId),e?.requestEditorAccess?.user?.userId&&t.add(e?.requestEditorAccess?.user?.userId),Array.from(t)}catch(t){return this.loggingService.catch("Error in LiveStateUtilsService getUserIdsToResolveFromLiveStateSingleEditorMode:",t),[]}}mergeLiveStateWithUser(e){try{if(e?.default?.singleEditorMode?.editor?.userId){let t=this.usersService.getUserById(e?.default?.singleEditorMode?.editor?.userId);t&&(e.default.singleEditorMode.editor=t)}if(e?.default?.singleEditorMode?.requestEditorAccess?.user?.userId){let t=this.usersService.getUserById(e?.default?.singleEditorMode?.requestEditorAccess?.user?.userId);t&&(e.default.singleEditorMode.requestEditorAccess.user=t)}return e}catch(t){return this.loggingService.catch("Error in LiveStateUtilsService mergeLiveStateWithUser:",t),e}}mergeSingleEditorLiveStateDataWithUser(e){try{if(e?.editor?.userId){let t=this.usersService.getUserById(e?.editor?.userId);t&&(e.editor=t)}if(e?.requestEditorAccess?.user?.userId){let t=this.usersService.getUserById(e?.requestEditorAccess?.user?.userId);t&&(e.requestEditorAccess.user=t)}return e}catch(t){return this.loggingService.catch("Error in LiveStateUtilsService mergeSingleEditorLiveStateDataWithUser:",t),e}}resolveAndMergeSingleEditorLiveStateDataWithUser(e){return X(this,null,function*(){try{let t=this.getUserIdsToResolveFromLiveStates({default:{singleEditorMode:e}});if(t.length){let o=St(),a=Gs.GET_SINGLE_EDITOR_USERS;return this.coreActionsService.triggerAction(ut.USER_RESOLVER,{event:Y.Events.Resolver.USER_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:o,methodName:eo.RESOLVE_AND_MERGE_SINGLE_EDITOR_LIVE_STATE_DATA_WITH_USER,moduleName:a,source:"internal",payload:{userIds:t}}),yield this.usersService.resolveUsers({userIds:t,uniqueId:o,moduleName:a}),this.mergeSingleEditorLiveStateDataWithUser(e)}return e}catch(t){return this.loggingService.catch("Error in LiveStateUtilsService resolveAndMergeSingleEditorLiveStateDataWithUser:",t),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(t){return this.loggingService.catch("Error in LiveStateUtilsService formatLiveStateSingleEditorModeData:",t),e}}mergeLiveStateCustomsWithUsers(e){try{for(let t of e)if(t?.updatedBy?.userId){let o=this.usersService.getUserById(t?.updatedBy?.userId);o&&(t.updatedBy=o)}return e}catch(t){return this.loggingService.catch("Error in mergeLiveStateCustomsWithUsers:",t),e}}};r.\u0275fac=function(t){return new(t||r)(J(pi),J(x),J(Dn))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var hue=(()=>{let r=class r{constructor(e,t){this.loggingService=e,this.usersService=t}getUserIdsToResolveFromMultiThreads(e){try{let t=new Set;for(let o of e)o?.from?.userId&&t.add(o?.from?.userId);return Array.from(t)}catch(t){return this.loggingService.catch("Error in MultiThreadUtilsService getUserIdsToResolveFromMultiThreads:",t),[]}}mergeMultiThreadWithUser(e){try{if(e?.from?.userId){let t=this.usersService.getUserById(e?.from?.userId);t&&(e.from=t)}return e}catch(t){return this.loggingService.catch("Error in MultiThreadUtilsService mergeMultiThreadWithUser:",t),e}}formatMultiThreadData(e){try{return this.usersService.userDataProviderAvailable()&&(e?.from?.userId&&(e.from={userId:e.from.userId}),e?.commentAnnotationsMap&&(e.commentAnnotationsMap=null)),e}catch(t){return this.loggingService.catch("Error in MultiThreadUtilsService formatMultiThreadData:",t),e}}};r.\u0275fac=function(t){return new(t||r)(J(x),J(Dn))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var l_=(()=>{let r=class r{constructor(e,t,o){this.authService=e,this.loggingService=t,this.usersService=o}getUserIdsToResolveFromRecorders(e){try{let t=new Set;for(let o of e)o?.from?.userId&&t.add(o?.from?.userId),o?.transcription?.from?.userId&&t.add(o?.transcription?.from?.userId);return Array.from(t)}catch(t){return this.loggingService.catch("Error in RecorderUtilsService getUserIdsToResolveFromRecorders:",t),[]}}mergeRecorderWithUser(e){try{if(e?.from?.userId){let t=this.usersService.getUserById(e?.from?.userId);t&&(e.from=t)}if(e?.transcription?.from?.userId){let t=this.usersService.getUserById(e?.transcription?.from?.userId);t&&(e.transcription.from=t)}return e}catch(t){return this.loggingService.catch("Error in RecorderUtilsService mergeRecorderWithUser:",t),e}}formatRecorderData(e,t){try{return e.transcription=e?.transcription?E(b({},e.transcription),{lastUpdated:t}):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(o){return this.loggingService.catch("Error in RecorderUtilsService formatRecorderData:",o),e}}formatRecorderDataForWhisperTranscription(e){try{return this.usersService.userDataProviderAvailable()&&e?.fromUser?.userId&&(e.fromUser={userId:e.fromUser?.userId}),e}catch(t){return this.loggingService.catch("Error in RecorderUtilsService formatRecorderDataForWhisperTranscription:",t),e}}encryptRecorderAnnotation(e){return X(this,null,function*(){try{return yield Us(e,this.authService.getUser()?.userId??"")}catch(t){this.loggingService.catch("Error in RecorderUtilsService encryptRecorderAnnotation:",t);return}})}};r.\u0275fac=function(t){return new(t||r)(J(Ge),J(x),J(Dn))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var OR=(()=>{let r=class r{constructor(e,t,o,a,l,s){this.commentUtilsService=e,this.recorderUtilsService=t,this.loggingService=o,this.usersService=a,this.authService=l,this.commentAnnotationsResolverService=s}getUserIdsToResolveFromNotifications(e){try{let t=new Set;for(let o of e){let{notification:a}=o;switch(a?.actionUser?.userId&&t.add(a?.actionUser?.userId),a?.displayHeadlineMessageTemplateData?.actionUser?.userId&&t.add(a?.displayHeadlineMessageTemplateData?.actionUser?.userId),a?.displayHeadlineMessageTemplateData?.recipientUser?.userId&&t.add(a?.displayHeadlineMessageTemplateData?.recipientUser?.userId),a?.notificationSource){case"comment":if(a?.notificationSourceData){let l=this.commentUtilsService.getUserIdsToResolveFromComments([a?.notificationSourceData]);for(let s of l)t.add(s)}break}}return Array.from(t)}catch(t){return this.loggingService.catch("Error in ReactionUtilsService getUserIdsToResolveFromRecorders:",t),[]}}mergeStrippedDataWithNotification(e){try{if(this.loggingService.log("%c[WB] Calling NotificationUtilsService FUNCTION: mergeStrippedDataWithNotification","color: green;"),!this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable())return e;let t=this.commentAnnotationsResolverService.getAnnotationById(e?.notification?.targetAnnotationId),o=e?.raw?.targetAnnotationData?.commentId,a=t?.comments?.[o]?.commentText,l=t?.comments?.[o]?.commentHtml;return a&&l&&e?.raw?.notificationSource==="comment"&&(e.notification.displayBodyMessageTemplate=a,e.raw.targetAnnotationData.commentText=a,e.raw.targetAnnotationData.commentHtml=l),e}catch(t){return this.loggingService.catch("Error in NotificationUtilsService mergeStrippedDataWithNotification:",t),e}}mergeLocationWithNotification(e,t){try{this.loggingService.log("%c[WB] Calling NotificationUtilsService FUNCTION: mergeLocationWithNotification","color: green;");let o=e?.notification?.notificationSourceData?.location?.id,a=e?.notification?.notificationSourceData?.metadata?.documentId;if(!o||!a)return e;let l=t?.[a]?.[o];return l&&(e.notification.notificationSourceData.location=l?.location,e?.raw?.annotationData?.location&&(e.raw.annotationData.location=l?.location)),e}catch(o){return this.loggingService.catch("Error in NotificationUtilsService mergeLocationWithNotification:",o),e}}mergeNotificationWithUser(e){try{this.loggingService.log("%c[WB] Calling NotificationUtilsService FUNCTION: mergeNotificationWithUser","color: green;");let{notification:t}=e;if(t?.actionUser?.userId){let o=this.usersService.getUserById(t?.actionUser?.userId);o&&(t.actionUser=o)}if(t?.displayHeadlineMessageTemplateData?.actionUser?.userId){let o=this.usersService.getUserById(t?.displayHeadlineMessageTemplateData?.actionUser?.userId);o&&(t.displayHeadlineMessageTemplateData.actionUser=o)}if(t?.displayHeadlineMessageTemplateData?.recipientUser?.userId){let o=this.usersService.getUserById(t?.displayHeadlineMessageTemplateData?.recipientUser?.userId);o&&(t.displayHeadlineMessageTemplateData.recipientUser=o)}switch(t?.notificationSource){case"comment":t?.notificationSourceData&&this.commentUtilsService.mergeCommentWithUser(t?.notificationSourceData);break}return e}catch(t){return this.loggingService.catch("Error in NotificationUtilsService mergeNotificationWithUser:",t),e}}formatNotification(e,t){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,t);break}return e}catch(o){return this.loggingService.catch("Error in NotificationUtilsService formatNotification: ",o),e}}getTargetAnnotationIdsFromNotifications(e){try{this.loggingService.log("%c[WB] Calling NotificationUtilsService FUNCTION: getTargetAnnotationIdsFromNotifications","color: green;");let t=[];return Object.values(e).forEach(o=>{o?.notification?.targetAnnotationId&&o?.raw?.notificationSource==="comment"&&t.push(o.notification.targetAnnotationId)}),t}catch(t){return this.loggingService.catch("Error in NotificationUtilsService getTargetAnnotationIdsFromNotifications:",t),[]}}handleNotificationEncryption(t){return X(this,arguments,function*({data:e}){try{this.loggingService.log("%c[WB] Calling NotificationUtilsService FUNCTION: handleNotificationEncryption","color: green;");let o="notificationwithdocumentidstoencryptanddecryptonsdk"+(this.authService.getUser()?.userId??"");return yield Us(e,o)}catch(o){return this.loggingService.catch("Error in NotificationUtilsService handleNotificationEncryption:",o),e}})}};r.\u0275fac=function(t){return new(t||r)(J(ku),J(l_),J(x),J(Dn),J(Ge),J(vs))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var Cue=(()=>{let r=class r{constructor(e,t){this.loggingService=e,this.usersService=t}getUserIdsToResolveFromPresenceUsers(e){try{let t=new Set;for(let o of e)o?.userId&&t.add(o?.userId);return Array.from(t)}catch(t){return this.loggingService.catch("Error in PresenceUtilsService getUserIdsToResolveFromPresenceUsers:",t),[]}}mergePresenceUserWithUser(e){try{if(this.usersService.userDataProviderAvailable()&&e?.userId){let t=this.usersService.getUserById(e?.userId);t&&(e=b(b({},e),t))}return e}catch(t){return this.loggingService.catch("Error in PresenceUtilsService mergePresenceUserWithUser:",t),e}}formatPresenceUserData(e){try{if(this.usersService.userDataProviderAvailable()){let t=["userId","onlineStatus","userSnippylyId","color","textColor","timestamp","type","selections","documentParamsId","documentParams","locationId","location","isReadOnly","isAnonymous","pageInfo"];Object.keys(e).forEach(o=>{t.includes(o)||(e[o]=null)})}return e}catch(t){return this.loggingService.catch("Error in PresenceUtilsService formatPresenceUserData:",t),e}}};r.\u0275fac=function(t){return new(t||r)(J(x),J(Dn))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var _ue=(()=>{let r=class r{constructor(e,t,o,a,l,s){this.loggingService=e,this.usersService=t,this.authService=o,this.functions=a,this.configService=l,this.reactionAnnotationsResolverService=s}getUserIdsToResolveFromReactions(e){try{let t=new Set;for(let o of e)if(o?.from?.userId&&t.add(o?.from?.userId),o?.reactions?.length)for(let a of o?.reactions)a?.from?.userId&&t.add(a?.from?.userId);return Array.from(t)}catch(t){return this.loggingService.catch("Error in ReactionUtilsService getUserIdsToResolveFromRecorders:",t),[]}}handleReactionEncryption(a){return X(this,arguments,function*({data:e,firestorePath:t,eventType:o}){try{let l=G9(this.authService.getFirebaseConfig()?.firebaseOptions),s=mr(this.functions,gr({url:wn.cloudFunction?.[l]?.setEncryptedData,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:1200*1e3}),d=Iu.getFirestoreProdDbName(this.configService.getApiKey()??"",this.authService.getFirebaseConfig()?.firebaseOptions),v=this.authService.getUser()?.userId??"",u={path:t??"",data:e??{},dbId:d??"",feature:"reaction",eventType:o??"PATCH",sdkVersion:Ra()},S=yield Us(u,v);yield s({veltData:S})}catch(l){this.loggingService.catch("Error in handleReactionEncryption:",l)}})}mergeReactionWithUser(e){try{if(this.usersService.userDataProviderAvailable()){if(e?.from?.userId){let t=this.usersService.getUserById(e?.from?.userId);t&&(e.from=t)}if(e?.reactions?.length){for(let t of e?.reactions)if(t?.from?.userId){let o=this.usersService.getUserById(t?.from?.userId);o&&(t.from=o)}}}return e}catch(t){return this.loggingService.catch("Error in ReactionUtilsService mergeReactionWithUser:",t),e}}formatReactionData(e){try{return this.usersService.userDataProviderAvailable()&&e?.from?.userId&&(e.from={userId:e.from.userId}),e.reactions=e?.reactions?.map(t=>(this.usersService.userDataProviderAvailable()&&t?.from?.userId&&(t.from={userId:t.from.userId}),t)),e}catch(t){return this.loggingService.catch("Error in ReactionUtilsService formatReactionData:",t),e}}isReactionDataChanged(e,t){try{this.loggingService.log("%c[WB] Calling ReactionUtilsService FUNCTION: isReactionDataChanged","color: green;");let o=this.reactionAnnotationsResolverService.getReactionAnnotationById(t);return o?!Ei(e,o):!0}catch(o){return this.loggingService.catch("Error in ReactionUtilsService isReactionDataChanged:",o),!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 t={};if(e&&e.annotationId){let o=e.annotationId;if(t[o]=b({annotationId:o,metadata:I1(e.metadata??{}),icon:e.icon},e?.from&&{from:e?.from}),!this.isReactionDataChanged(t[o],o))return{strippedData:null,originalData:e};delete e?.icon,e.isReactionResolverUsed=!0}return{strippedData:t,originalData:e}}catch(t){return this.loggingService.catch("Error in ReactionUtilsService stripReactionAnnotationData:",t),{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 t=this.reactionAnnotationsResolverService.getReactionAnnotationById(e?.annotationId);return t&&t.icon&&(e.icon=t.icon),e}catch(t){return this.loggingService.catch("Error in ReactionUtilsService mergeStrippedDataWithReactionAnnotations:",t),e}}};r.\u0275fac=function(t){return new(t||r)(J(x),J(Dn),J(Ge),J(Lr),J(Lt),J(Pm))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var bue=(()=>{let r=class r{constructor(e,t){this.loggingService=e,this.usersService=t}getUserIdsToResolveFromSelections(e){try{let t=new Set;for(let o of e)o?.user?.userId&&t.add(o.user.userId);return Array.from(t)}catch(t){return this.loggingService.catch("Error in SelectionUtilsService getUserIdsToResolveFromSelections:",t),[]}}mergeSelectionWithUser(e){try{if(e?.user?.userId){let t=this.usersService.getUserById(e?.user?.userId);t&&(e.user=t)}return e}catch(t){return this.loggingService.catch("Error in SelectionUtilsService mergeSelectionWithUser:",t),e}}formatSelectionData(e){try{return this.usersService.userDataProviderAvailable()&&e?.user?.userId&&(e.user={userId:e.user.userId}),e}catch(t){return this.loggingService.catch("Error in SelectionUtilsService formatSelectionData:",t),e}}};r.\u0275fac=function(t){return new(t||r)(J(x),J(Dn))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var Sue=(()=>{let r=class r{constructor(e,t){this.loggingService=e,this.usersService=t}getUserIdsToResolveFromTags(e){try{let t=new Set;for(let o of e)if(o?.from?.userId&&t.add(o.from.userId),o?.to?.length)for(let a of o.to)a?.userId&&t.add(a.userId);return Array.from(t)}catch(t){return this.loggingService.catch("Error in TagUtilsService getUserIdsToResolveFromTags:",t),[]}}mergeTagWithUser(e){try{if(e?.from?.userId){let t=this.usersService.getUserById(e?.from?.userId);t&&(e.from=t)}return e?.to?.length&&(e.to=e.to.map(t=>{if(t?.userId){let o=this.usersService.getUserById(t?.userId);o&&(t=o)}return t})),e}catch(t){return this.loggingService.catch("Error in TagUtilsService mergeTagWithUser:",t),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(t=>(t?.userId&&(t={userId:t.userId}),t)))),e}catch(t){return this.loggingService.catch("Error in TagUtilsService formatTagData:",t),e}}};r.\u0275fac=function(t){return new(t||r)(J(x),J(Dn))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var Mm=(()=>{let r=class r{constructor(e,t,o,a,l,s,d,v,u,S,k,A,P,U,W,te,ye,me,ke,De){this.areaUtilsService=e,this.arrowUtilsService=t,this.commentUtilsService=o,this.contactUtilsService=a,this.coreActionsService=l,this.cursorUtilsService=s,this.huddleUtilsService=d,this.liveStateUtilsService=v,this.loggingService=u,this.multiThreadUtilsService=S,this.notificationUtilsService=k,this.presenceUtilsService=A,this.reactionUtilsService=P,this.recorderUtilsService=U,this.selectionUtilsService=W,this.tagUtilsService=te,this.usersService=ye,this.docService=me,this.commentAnnotationsResolverService=ke,this.reactionAnnotationsResolverService=De}getErrorForGetRequests({feature:e,error:t}){try{switch(e){case"organizationMetadata":case"documentMetadata":case"folderMetadata":return(t?.message??"")?.includes("Missing or insufficient permissions.")?{errorCode:"PERMISSION_DENIED"}:null;default:return null}}catch(o){return this.loggingService.catch("Error in CommonDbUtilsService getErrorForGetRequests:",o),null}}getFirestorePath({feature:e,properties:t,documentPaths:o,apiKey:a}){try{if(!a)return;let{documentId:l,organizationId:s,folderId:d}=t;s||(s=o?.organizationId);let v=new IR({apiKey:a,documentId:l?`${l}`:"",organizationId:s?`${s}`:"",veltFolderId:d?`${d}`:void 0});switch(e){case"userConfig":return t?.userId&&v?.userConfig?`${v?.userConfig}/${t?.userId}${t?.documentId?`/${V.FIREBASE_PARTIAL_PATH_DOCUMENT_CONFIGURATIONS}/${t?.documentId}`:""}`:void 0;case"allPermissionsUsers":return v?.permissionsUsers?`${v?.permissionsUsers}`:void 0;case"comment":return t?.documentId&&t?.id&&v?.comment?`${v?.comment}/${t?.id}`:void 0;case"allComments":return t?.documentId&&v?.comment?`${v?.comment}`:void 0;case"multiThread":return t?.documentId&&t?.id&&v?.multiThread?`${v?.multiThread}/${t?.id}`:void 0;case"allMultiThreads":return t?.documentId&&v?.multiThread?`${v?.multiThread}`:void 0;case"crdt":return t?.documentId&&v?.crdt&&t?.id?`${v?.crdt}/${t?.id}`:void 0;case"allLastNotificationTimestamp":return v?.lastNotificationTimestamp?`${v?.lastNotificationTimestamp}`:void 0;case"lastNotificationTimestamp":return t?.id&&v?.lastNotificationTimestamp?`${v?.lastNotificationTimestamp}/${t?.id}`:void 0;case"area":return t?.documentId&&t?.id&&v?.area?`${v?.area}/${t?.id}`:void 0;case"allAreas":return t?.documentId&&v?.area?`${v?.area}`:void 0;case"allDocuments":return v?.document?`${v?.document}`:void 0;case"allLocations":return v?.location?`${v?.location}`:void 0;case"allFolders":return v?.folder?`${v?.folder}`:void 0;case"folder":return v?.folder&&t.folderId?`${v?.folder}/${t.folderId}`:void 0;case"documentUserAccess":return t?.documentId&&t?.id&&v?.documentUsers?`${v?.documentUsers}/${t?.id}`:void 0;case"reaction":return t?.documentId&&t?.id&&v?.reaction?`${v?.reaction}/${t?.id}`:void 0;case"allReactions":return t?.documentId&&v?.reaction?`${v?.reaction}`:void 0;case"recorder":return t?.documentId&&t?.id&&v?.recorder?`${v?.recorder}/${t?.id}`:void 0;case"allRecorders":return t?.documentId&&v?.recorder?`${v?.recorder}`:void 0;case"recorderTrackEvent":return t?.documentId&&t?.id&&v?.recorder?`${v?.recorder}/${t?.id}/trackRecorderEvent`:void 0;case"documentAccessType":return t?.documentId&&v?.document?`${v?.document}/${t?.documentId}`:void 0;case"organizationMetadata":return v?.organization?`${v?.organization}`:void 0;case"documentIam":case"documentMetadata":return t?.documentId&&v?.document?`${v?.document}/${t?.documentId}`:void 0;case"folderMetadata":return t?.folderId&&v?.folder?`${v?.folder}/${t?.folderId}`:void 0;case"locationMetadata":return t?.documentId&&v?.location&&t?.id?`${v?.location}/${t?.id}`:void 0;case"documentUser":return t?.documentId&&t?.id&&v?.documentUsers?`${v?.documentUsers}/${t?.id}`:void 0;case"allDocumentUsers":return v?.users?`${v?.users}`:void 0;case"allFolderUsers":return v?.users?`${v?.users}`:void 0;case"allOrganizationGroups":return v?.organizationGroups?`${v?.organizationGroups}`:void 0;case"allOrganizationUsers":return v?.users?`${v?.users}`:void 0;case"notificationViewsTimestamp":return t?.documentId&&t?.id&&v?.notificationViews?`${v?.notificationViews}/${t?.id}`:void 0;case"allDocumentViews":return t?.documentId&&v?.documentViews?`${v?.documentViews}`:void 0;case"documentViews":case"documentMetadataViews":case"documentDayViews":case"documentUsersViews":return t?.documentId&&t?.id&&v?.documentViews?`${v?.documentViews}/${t?.id}`:void 0;case"locationDayViews":case"locationUsersViews":case"locationViews":case"locationMetadataViews":case"location":return t?.documentId&&t?.id&&v?.locationViews?`${v?.locationViews}/${t?.id}`:void 0;case"allLocationViews":return t?.documentId&&v?.locationViews?`${v?.locationViews}`:void 0;case"allDocNotifications":return t?.documentId&&v?.docNotification?`${v?.docNotification}`:void 0;case"docNotificationViews":case"docNotification":return t?.documentId&&t?.id&&v?.docNotification?`${v?.docNotification}/${t?.id}`:void 0;case"userNotificationViews":case"userNotification":return t?.userId&&t?.id&&v?.notificationUsers?`${v?.notificationUsers}/${t?.userId}/${V.FIREBASE_PARTIAL_PATH_USER_NOTIFICATION}/${t?.id}`:void 0;case"allUserNotifications":return t?.userId&&v?.notificationUsers?`${v?.notificationUsers}/${t?.userId}/${V.FIREBASE_PARTIAL_PATH_USER_NOTIFICATION}`:void 0;default:throw new Error(`Unknown feature: ${e}`)}}catch(l){this.loggingService.catch("Error in CommonDbUtilsService getFirestorePath:",l);return}}getFirestoreCollectionGroupPath(e){try{switch(e){case"allComments":return V.FIREBASE_PARTIAL_PATH_COMMENT;case"allDocuments":return V.FIREBASE_PARTIAL_PATH_DOCS;case"allLocations":return V.FIREBASE_PARTIAL_PATH_LOCATION;case"allMultiThreads":return V.FIREBASE_PARTIAL_PATH_MULTI_THREAD;case"allAreas":return V.FIREBASE_PARTIAL_PATH_AREA;case"allReactions":return V.FIREBASE_PARTIAL_PATH_REACTION;case"allRecorders":return V.FIREBASE_PARTIAL_PATH_RECORDER;case"allDocumentViews":return V.FIREBASE_PARTIAL_PATH_DOCUMENT_VIEWS;case"allLocationViews":return V.FIREBASE_PARTIAL_PATH_LOCATION_VIEWS;case"allDocumentUsers":return V.FIREBASE_PARTIAL_PATH_DOCUMENT_USERS;case"allFolderUsers":return V.FIREBASE_PARTIAL_PATH_FOLDER_USERS;default:throw new Error(`Unknown feature: ${e}`)}}catch(t){this.loggingService.catch("Error in CommonDbUtilsService getFirestoreCollectionGroupPath:",t);return}}getDocumentPath({feature:e,properties:t,defaultDocumentPaths:o,apiKey:a,useFirestore:l}){try{if(!a)return;let{documentId:s,organizationId:d}=t;d||(d=o?.organizationId);let v=new Am({apiKey:a,documentId:s?`${s}`:"",organizationId:d?`${d}`:""});switch(e){case"userConfig":return t?.userId&&t?.documentId&&v?.userConfig?`${v?.userConfig}/${t?.userId}/${V.FIREBASE_PARTIAL_PATH_DOCUMENT_CONFIGURATIONS}/${t?.documentId}`:void 0;case"allComments":return!l&&t?.documentId&&v?.comment?`${v?.comment}`:void 0;case"allGlobalContacts":return t?.documentId&&v?.globalContacts?`${v?.globalContacts}`:void 0;case"globalContacts":return t?.documentId&&t?.userId&&v?.globalContacts?`${v?.globalContacts}${t?.userId}`:void 0;case"groupContacts":return t?.documentId&&t?.groupId&&v?.groupContacts?`${v?.groupContacts}${t?.groupId}`:void 0;case"groupContactsUser":return t?.documentId&&t?.groupId&&t?.userId&&v?.groupContacts?`${v?.groupContacts}${t?.groupId}/${t?.userId}`:void 0;case"allLoginContacts":return t?.documentId&&t?.userId&&v?.logins?`${v?.logins}${t?.userId}/contacts`:void 0;case"allLogins":return t?.documentId&&v?.logins?`${v?.logins}`:void 0;case"logins":return t?.documentId&&t?.userId&&v?.logins?`${v?.logins}${t?.userId}`:void 0;case"customerMetadata":return v?.customerMetadata?`${v?.customerMetadata}`:void 0;case"allArrows":return t?.documentId&&v?.arrow?`${v?.arrow}`:void 0;case"arrow":return t?.documentId&&v?.arrow&&t.id?`${v?.arrow}${t.id}`:void 0;case"allCursors":return t?.documentId&&v?.cursor?`${v?.cursor}`:void 0;case"cursor":return t?.documentId&&v?.cursor&&t.id?`${v?.cursor}${t.id}`:void 0;case"flockUser":return t?.documentId&&v?.flock&&t.id?`${v?.flock}users/${t.id}`:void 0;case"flockSession":return t?.documentId&&v?.flock&&t.id?`${v?.flock}sessions/${t.id}`:void 0;case"allHuddleAttendees":return t?.documentId&&v?.huddle?`${v?.huddle}attendees`:void 0;case"huddleAttendee":return t?.documentId&&v?.huddle&&t.id?`${v?.huddle}attendees/${t.id}`:void 0;case"huddleAttendeeState":return t?.documentId&&v?.huddle&&t.id?`${v?.huddle}attendees/${t.id}/state`:void 0;case"allHuddleInvitees":return t?.documentId&&v?.huddle?`${v?.huddle}invitees`:void 0;case"huddleConnection":return t?.documentId&&v?.huddle&&t.id?`${v?.huddle}connections/${t.id}`:void 0;case"huddleIceCandidate":return t?.documentId&&v?.huddle&&t.id?`${v?.huddle}iceCandidates/${t.id}`:void 0;case"allHuddleIceCandidates":return t?.documentId&&v?.huddle?`${v?.huddle}iceCandidates`:void 0;case"allHuddleMessages":return t?.documentId&&v?.huddle?`${v?.huddle}messages`:void 0;case"huddleMessage":return t?.documentId&&v?.huddle&&t.id?`${v?.huddle}messages/${t.id}`:void 0;case"allLiveStates":return t?.documentId&&v?.liveState?`${v?.liveState}`:void 0;case"allLiveStateCustoms":return t?.documentId&&v?.liveState?`${v?.liveState}custom`:void 0;case"liveStateCustom":return t?.documentId&&v?.liveState&&t?.id?`${v?.liveState}custom/${t.id}`:void 0;case"liveStateSingleEditorMode":return t?.documentId&&v?.liveStateSingleEditorMode?`${v?.liveStateSingleEditorMode}`:void 0;case"liveStateAutoSyncState":return t?.documentId&&v?.liveState?`${v?.liveState}default/autoSyncState`:void 0;case"liveStateAutoSyncStateCurrent":return t?.documentId&&v?.liveState?`${v?.liveState}default/autoSyncState/current`:void 0;case"liveStateAutoSyncStateHistoryId":return t?.documentId&&v?.liveState&&t?.id?`${v?.liveState}default/autoSyncState/history/${t.id}`:void 0;case"presence":return t?.documentId&&v?.presence&&t?.userId?`${v?.presence}${t?.userId}`:void 0;case"allPresence":return t?.documentId&&v?.presence?`${v?.presence}`:void 0;case"workspaceIam":return v?.workspaceIam?`${v?.workspaceIam}`:void 0;case"selection":return t?.documentId&&v?.selection&&t?.userId?`${v?.selection}${t?.userId}`:void 0;case"allSelections":return t?.documentId&&v?.selection?`${v?.selection}`:void 0;case"syncVideoPlayer":return t?.documentId&&v?.syncVideoPlayer?`${v?.syncVideoPlayer}`:void 0;case"allTags":return t?.documentId&&v?.tag?`${v?.tag}`:void 0;case"tag":return t?.documentId&&v?.tag&&t?.id?`${v?.tag}${t?.id}`:void 0;case"userContactUs":return t?.documentId&&v?.userContactUs?`${v?.userContactUs}`:void 0;case"userFeedback":return t?.documentId&&v?.userFeedback?`${v?.userFeedback}`:void 0;case"userReportBug":return t?.documentId&&v?.userReportBugs?`${v?.userReportBugs}`:void 0;case"comment":return!l&&t?.documentId&&t?.id&&v?.comment?`${v?.comment}${t?.id}`:void 0;case"allMultiThreads":return!l&&t?.documentId&&v?.multiThread?`${v?.multiThread}`:void 0;case"crdt":return!l&&t?.documentId&&v?.crdt?`${v?.crdt}`:void 0;case"crdtData":return t?.documentId&&v?.crdt&&t?.id?`${v?.crdt}/${t?.id}/data`:void 0;case"crdtSyncState":return t?.documentId&&v?.crdt&&t?.id?`${v?.crdt}/${t?.id}/sync/state`:void 0;case"crdtSyncPresence":return t?.documentId&&t.userId&&v?.crdt&&t?.id?`${v?.crdt}/${t?.id}/sync/presence/${t.userId}`:void 0;case"allCrdtSyncPresence":return t?.documentId&&v?.crdt&&t?.id?`${v?.crdt}/${t?.id}/sync/presence`:void 0;case"crdtPresence":return t?.documentId&&t.userId&&v?.crdt&&t?.id?`${v?.crdt}/${t?.id}/presence/${t.userId}`:void 0;case"allCrdtPresence":return t?.documentId&&v?.crdt&&t?.id?`${v?.crdt}/${t?.id}/presence`:void 0;case"crdtVersion":return t?.documentId&&v?.crdt&&t?.id&&t?.versionId?`${v?.crdt}/${t?.id}/versions/${t?.versionId}`:void 0;case"crdtVersions":return t?.documentId&&v?.crdt&&t?.id?`${v?.crdt}/${t?.id}/versions`:void 0;case"multiThread":return!l&&t?.documentId&&t?.id&&v?.multiThread?`${v?.multiThread}${t?.id}`:void 0;case"allLastNotificationTimestamp":return!l&&v?.organizationNotificationsLastNotificationTimestamp?`${v?.organizationNotificationsLastNotificationTimestamp}`:void 0;case"lastNotificationTimestamp":return!l&&t?.id&&v?.organizationNotificationsLastNotificationTimestamp?`${v?.organizationNotificationsLastNotificationTimestamp}${t?.id}`:void 0;case"documentIam":return!l&&t?.documentId&&v?.documentIam?`${v?.documentIam}`:void 0;case"allDocuments":return!l&&v?.docs&&t?.documentId?`${v?.docs}/${t?.documentId}/${V.FIREBASE_PARTIAL_PATH_METADATA}`:void 0;case"allAreas":return!l&&t?.documentId&&v?.area?`${v?.area}`:void 0;case"area":return!l&&t?.id&&v?.area?`${v?.area}${t?.id}`:void 0;case"folder":return!l&&t?.folderId&&v?.folder?`${v?.folder}${t?.folderId}`:void 0;case"documentUserAccess":return!l&&t?.id&&v?.documentIam?`${v?.documentIam}users/${t?.id}`:void 0;case"documentUser":return!l&&t?.documentId&&t?.id&&v?.documentIam?`${v?.documentIam}users/${t?.id}`:void 0;case"allDocumentUsers":return!l&&t?.documentId&&v?.documentIam?`${v?.documentIam}users/`:void 0;case"allOrganizationGroups":return!l&&v?.organizationGroups?`${v?.organizationGroups}`:void 0;case"allOrganizationUsers":return!l&&v?.organizationIam?`${v?.organizationIam}users/`:void 0;case"reaction":return!l&&t?.id&&v?.reaction?`${v?.reaction}${t?.id}`:void 0;case"allReactions":return!l&&t?.documentId&&v?.reaction?`${v?.reaction}`:void 0;case"recorder":return!l&&t?.documentId&&t?.id&&v?.recorder?`${v?.recorder}${t?.id}`:void 0;case"allRecorders":return!l&&t?.documentId&&v?.recorder?`${v?.recorder}`:void 0;case"organizationMetadata":return!l&&v?.organizationMetadata?`${v?.organizationMetadata}`:void 0;case"heartbeat":return t?.id&&v?.heartbeat?`${v?.heartbeat}${t?.id}`:void 0;case"allHeartbeats":return v?.heartbeat?`${v?.heartbeat}`:void 0;case"heartbeatByDocument":return t?.id&&v?.heartbeatByDocument?`${v?.heartbeatByDocument}${t?.id}`:void 0;case"allHeartbeatsByDocument":return v?.heartbeatByDocument?`${v?.heartbeatByDocument}`:void 0;case"documentAccessType":return!l&&v?.documentIam?`${v?.documentIam}`:void 0;case"documentMetadata":return!l&&t?.documentId&&v?.metadata?`${v?.metadata}`:void 0;case"allDocumentViews":return!l&&t?.documentId&&v?.views?`${v?.views}documentViews/`:void 0;case"documentViews":return!l&&t?.documentId&&t?.id&&v?.views?`${v?.views}documentViews/${t?.id}`:void 0;case"allLocationViews":return!l&&t?.documentId&&v?.views?`${v?.views}locationViews/`:void 0;case"notificationViewsTimestamp":return!l&&t?.id&&t?.user&&v?.views?`${v?.views}notification/${t?.id}/views/${t?.user}`:void 0;case"documentUsersViews":return!l&&t?.id&&t?.user&&t?.date&&v?.views?`${v?.views}documentViews/${t?.id}/users/${t?.user}/${t?.date}`:void 0;case"documentMetadataViews":return!l&&t?.id&&v?.views?`${v?.views}documentViews/${t?.id}/metadata`:void 0;case"documentDayViews":return!l&&t?.id&&t?.date&&t?.user&&v?.views?`${v?.views}documentViews/${t?.id}/day/${t?.date}/${t?.user}`:void 0;case"locationViews":return!l&&t?.id&&v?.views?`${v?.views}locationViews/${t?.id}/location`:void 0;case"location":return!l&&t?.id&&v?.views?`${v?.views}locationViews/${t?.id}`:void 0;case"locationUsersViews":return!l&&t?.id&&t?.user&&t?.date&&v?.views?`${v?.views}locationViews/${t?.id}/users/${t?.user}/${t?.date}`:void 0;case"locationMetadataViews":return!l&&t?.id&&v?.views?`${v?.views}locationViews/${t?.id}/metadata`:void 0;case"locationDayViews":return!l&&t?.id&&t?.date&&t?.user&&v?.views?`${v?.views}locationViews/${t?.id}/day/${t?.date}/${t?.user}`:void 0;case"docNotificationViews":case"docNotification":return t?.documentId&&t?.id&&v?.organizationNotificationsWithDocumentId?`${v?.organizationNotificationsWithDocumentId}${t?.id}`:void 0;case"allDocNotifications":return t?.documentId&&v?.organizationNotificationsWithDocumentId?`${v?.organizationNotificationsWithDocumentId}`:void 0;case"allUserNotifications":return t?.userId&&v?.organizationNotificationsUsers?`${v?.organizationNotificationsUsers}${t?.userId}`:void 0;case"userNotificationViews":case"userNotification":return t?.userId&&t?.id&&v?.organizationNotificationsUsers?`${v?.organizationNotificationsUsers}${t?.userId}/${t?.id}`:void 0;case"locationMetadata":return;case"allLocations":return;case"folderMetadata":return;case"allPermissionsUsers":return;default:throw new Error(`Unknown feature: ${e}`)}}catch(s){this.loggingService.catch("Error in CommonDbUtilsService getDocumentPath:",s);return}}resolveAnnotations(o){return X(this,arguments,function*({data:e,feature:t}){try{if(e&&e?.length>0)switch(t){case"allComments":{if(this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable()){let a=St(),l=Q1.GET_COMMENT_ANNOTATIONS;this.coreActionsService.triggerAction(ut.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:a,methodName:Gr.RESOLVE_COMMENT_ANNOTATIONS,moduleName:l,source:"internal",payload:{commentAnnotationIds:e,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""}}),this.commentAnnotationsResolverService.resolveCommentAnnotations({request:{commentAnnotationIds:e,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""},uniqueId:a,moduleName:l})}break}case"allReactions":{if(this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable()){let a=St(),l=ZE.GET_REACTION_ANNOTATIONS;this.coreActionsService.triggerAction(ut.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:a,methodName:to.RESOLVE_REACTION_ANNOTATIONS,moduleName:l,source:"internal",payload:{reactionAnnotationIds:e,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""}}),this.reactionAnnotationsResolverService.resolveReactionAnnotations({request:{reactionAnnotationIds:e,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""},uniqueId:a,moduleName:l})}break}default:break}}catch(a){this.loggingService.catch(`Error in CommonDbUtilsService resolveAnnotations: ${t}`,a)}})}formatResponse(s){return X(this,arguments,function*({feature:e,data:t,shouldAwait:o=!1,forceResolve:a=!1,shouldCommentAnnotationsResolverAwait:l=!1}){try{if(this.usersService.userDataProviderAvailable()){let d=[];switch(e){case"allAreas":{t&&typeof t=="object"&&!Array.isArray(t)&&(d=this.areaUtilsService.getUserIdsToResolveFromAreaAnnotations(Object.values(t)));break}case"allArrows":{t&&typeof t=="object"&&!Array.isArray(t)&&(d=this.arrowUtilsService.getUserIdsToResolveFromArrowAnnotations(Object.values(t)));break}case"allCursors":{t&&typeof t=="object"&&!Array.isArray(t)&&(d=this.cursorUtilsService.getUserIdsToResolveFromCursorUsers(Object.values(t)));break}case"allComments":{t&&typeof t=="object"&&!Array.isArray(t)&&(d=this.commentUtilsService.getUserIdsToResolveFromComments(Object.values(t)));break}case"allDocumentUsers":{t&&typeof t=="object"&&!Array.isArray(t)&&(d=this.contactUtilsService.getUserIdsToResolveFromUserIamData(Object.values(t)));break}case"allFolderUsers":{t&&typeof t=="object"&&!Array.isArray(t)&&(d=this.contactUtilsService.getUserIdsToResolveFromUserIamData(Object.values(t)));break}case"allOrganizationUsers":{t&&typeof t=="object"&&!Array.isArray(t)&&(d=this.contactUtilsService.getUserIdsToResolveFromUserIamData(Object.values(t)));break}case"allMultiThreads":{t&&typeof t=="object"&&!Array.isArray(t)&&(d=this.multiThreadUtilsService.getUserIdsToResolveFromMultiThreads(Object.values(t)));break}case"allDocNotifications":{t&&typeof t=="object"&&(d=this.notificationUtilsService.getUserIdsToResolveFromNotifications(Array.isArray(t)?t:Object.values(t)));break}case"allUserNotifications":{t&&typeof t=="object"&&!Array.isArray(t)&&(d=this.notificationUtilsService.getUserIdsToResolveFromNotifications(Object.values(t)));break}case"allPresence":{t&&typeof t=="object"&&!Array.isArray(t)&&(d=this.presenceUtilsService.getUserIdsToResolveFromPresenceUsers(Object.values(t)));break}case"allRecorders":{t&&typeof t=="object"&&!Array.isArray(t)&&(d=this.recorderUtilsService.getUserIdsToResolveFromRecorders(Object.values(t)));break}case"allReactions":{t&&typeof t=="object"&&!Array.isArray(t)&&(d=this.reactionUtilsService.getUserIdsToResolveFromReactions(Object.values(t)));break}case"allTags":{t&&typeof t=="object"&&!Array.isArray(t)&&(d=this.tagUtilsService.getUserIdsToResolveFromTags(Object.values(t)));break}case"allHuddleAttendees":{t&&typeof t=="object"&&!Array.isArray(t)&&(d=this.huddleUtilsService.getUserIdsToResolveFromHuddleAttendees(Object.values(t)));break}case"liveStateCustom":{t&&typeof t=="object"&&!Array.isArray(t)&&(d=this.liveStateUtilsService.getUserIdsToResolveFromLiveStateCustom(t));break}case"allLiveStateCustoms":{t&&typeof t=="object"&&!Array.isArray(t)&&(d=this.liveStateUtilsService.getUserIdsToResolveFromLiveStateCustoms(Object.values(t)));break}case"allLiveStates":{t&&typeof t=="object"&&(d=this.liveStateUtilsService.getUserIdsToResolveFromLiveStates(t));break}case"liveStateSingleEditorMode":{t&&typeof t=="object"&&!Array.isArray(t)&&(d=this.liveStateUtilsService.getUserIdsToResolveFromLiveStateSingleEditorMode(t));break}case"allSelections":{t&&typeof t=="object"&&!Array.isArray(t)&&(d=this.selectionUtilsService.getUserIdsToResolveFromSelections(Object.values(t)));break}default:d=[]}if(d?.length){let v=St(),u=Gs.GET_USERS;this.coreActionsService.triggerAction(ut.USER_RESOLVER,{event:Y.Events.Resolver.USER_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:v,methodName:eo.FORMAT_RESPONSE,source:"internal",moduleName:u,payload:{userIds:d,feature:e,forceResolve:a}}),o?yield this.usersService.resolveUsers({userIds:d,forceResolve:a,feature:e,uniqueId:v,moduleName:u}):this.usersService.resolveUsers({userIds:d,forceResolve:a,feature:e,uniqueId:v,moduleName:u})}}if(this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable()){let d=[];switch(e){case"allDocNotifications":{if(t&&typeof t=="object"){let v=this.notificationUtilsService.getTargetAnnotationIdsFromNotifications(t);d=[...d,...v],d=d.filter(u=>!this.commentAnnotationsResolverService.getCommentAnnotationById(u))}break}case"allUserNotifications":{if(t&&typeof t=="object"&&!Array.isArray(t)){let v=this.notificationUtilsService.getTargetAnnotationIdsFromNotifications(t);d=[...d,...v],d=d.filter(u=>!this.commentAnnotationsResolverService.getCommentAnnotationById(u))}break}default:d=[]}if(d?.length){let v=St(),u=Q1.GET_NOTIFICATIONS;this.coreActionsService.triggerAction(ut.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:v,methodName:Gr.FORMAT_RESPONSE,moduleName:u,source:"internal",payload:{commentAnnotationIds:d,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??"",shouldCommentAnnotationsResolverAwait:l}}),l?yield this.commentAnnotationsResolverService.resolveCommentAnnotations({request:{commentAnnotationIds:d,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""},uniqueId:v,moduleName:u}):this.commentAnnotationsResolverService.resolveCommentAnnotations({request:{commentAnnotationIds:d,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""},uniqueId:v,moduleName:u})}}return t}catch(d){return this.loggingService.catch("Error in CommonDbUtilsService formatResponse:",d),t}})}mergeCommentAnnotationsWithData({data:e,feature:t}){try{if(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: mergeCommentAnnotationsWithData","color: green;"),this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable())switch(t){case"allComments":return e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).reduce((o,[a,l])=>(o[a]=this.commentUtilsService.mergeStrippedDataWithCommentAnnotations(l),o),{}):e;case"allDocNotifications":case"allUserNotifications":return e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).reduce((o,[a,l])=>(o[a]=this.notificationUtilsService.mergeStrippedDataWithNotification(l),o),{}):e;default:return e}return e}catch(o){return this.loggingService.catch("Error in CommonDbUtilsService mergeCommentAnnotationsWithData:",o),e}}mergeReactionAnnotationsWithData({data:e,feature:t}){try{if(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: mergeReactionAnnotationsWithData","color: green;"),this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable())switch(t){case"allReactions":return e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).reduce((o,[a,l])=>(o[a]=this.reactionUtilsService.mergeStrippedDataWithReactionAnnotations(l),o),{}):e;default:return e}return e}catch(o){return this.loggingService.catch("Error in CommonDbUtilsService mergeReactionAnnotationsWithData:",o),e}}mergeLocationMetadataWithData({data:e,feature:t,locationMetadata:o}){try{if(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: mergeLocationMetadataWithData","color: green;"),o&&typeof o=="object"&&!Array.isArray(o))switch(t){case"allComments":return e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).reduce((a,[l,s])=>(a[l]=this.commentUtilsService.mergeLocationWithCommentAnnotations(s,o),a),{}):e;case"allDocNotifications":case"allUserNotifications":return e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).reduce((a,[l,s])=>(a[l]=this.notificationUtilsService.mergeLocationWithNotification(s,o),a),{}):e;default:return e}return e}catch(a){return this.loggingService.catch("Error in CommonDbUtilsService mergeLocationMetadataWithData:",a),e}}mergeUsersWithData({feature:e,data:t}){try{if(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: mergeUsersWithData","color: green;"),this.usersService.userDataProviderAvailable())switch(e){case"allAreas":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((o,[a,l])=>(o[a]=this.areaUtilsService.mergeAreaWithUser(l),o),{}):t;case"allArrows":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((o,[a,l])=>(o[a]=this.arrowUtilsService.mergeArrowWithUser(l),o),{}):t;case"allCursors":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((o,[a,l])=>(o[a]=this.cursorUtilsService.mergeCursorUserWithUser(l),o),{}):t;case"allComments":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((o,[a,l])=>(o[a]=this.commentUtilsService.mergeCommentWithUser(l),o),{}):t;case"allDocumentUsers":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((o,[a,l])=>(o[a]=this.contactUtilsService.mergeUserIamWithUser(l),o),{}):t;case"allFolderUsers":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((o,[a,l])=>(o[a]=this.contactUtilsService.mergeUserIamWithUser(l),o),{}):t;case"allOrganizationUsers":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((o,[a,l])=>(o[a]=this.contactUtilsService.mergeUserIamWithUser(l),o),{}):t;case"allMultiThreads":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((o,[a,l])=>(o[a]=this.multiThreadUtilsService.mergeMultiThreadWithUser(l),o),{}):t;case"allDocNotifications":return t&&typeof t=="object"?t?.map(o=>this.notificationUtilsService.mergeNotificationWithUser(o)):t;case"allUserNotifications":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((o,[a,l])=>(o[a]=this.notificationUtilsService.mergeNotificationWithUser(l),o),{}):t;case"allPresence":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((o,[a,l])=>(o[a]=this.presenceUtilsService.mergePresenceUserWithUser(l),o),{}):t;case"allRecorders":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((o,[a,l])=>(o[a]=this.recorderUtilsService.mergeRecorderWithUser(l),o),{}):t;case"allReactions":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((o,[a,l])=>(o[a]=this.reactionUtilsService.mergeReactionWithUser(l),o),{}):t;case"allTags":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((o,[a,l])=>(o[a]=this.tagUtilsService.mergeTagWithUser(l),o),{}):t;case"allHuddleAttendees":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((o,[a,l])=>(o[a]=this.huddleUtilsService.mergeHuddleAttendeeWithUser(l),o),{}):t;case"liveStateCustom":return t&&typeof t=="object"&&!Array.isArray(t)?this.liveStateUtilsService.mergeLiveStateCustomWithUser(t):t;case"allLiveStateCustoms":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((o,[a,l])=>(o[a]=this.liveStateUtilsService.mergeLiveStateCustomWithUser(l),o),{}):t;case"allLiveStates":return t&&typeof t=="object"?this.liveStateUtilsService.mergeLiveStateWithUser(t):t;case"liveStateSingleEditorMode":return t&&typeof t=="object"&&!Array.isArray(t)?this.liveStateUtilsService.mergeSingleEditorLiveStateDataWithUser(t):t;case"allSelections":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((o,[a,l])=>(o[a]=this.selectionUtilsService.mergeSelectionWithUser(l),o),{}):t;default:return t}return t}catch(o){return this.loggingService.catch("Error in CommonDbUtilsService mergeUsersWithData:",o),t}}mergeCommentAnnotationsWithData$({data:e,feature:t}){try{return this.commentAnnotationsResolverService.getCommentAnnotationsById$().pipe(ge(()=>{let o=this.mergeCommentAnnotationsWithData({data:e?.data??{},feature:t}),a=this.mergeUsersWithData({feature:t,data:o??{}});return typeof a=="object"?{data:JSON.parse(JSON.stringify(a)),operation:e?.operation??null}:{data:a,operation:e?.operation??null}}),xt(Qt))}catch(o){return this.loggingService.catch("Error in mergeCommentAnnotationsWithData:",o),ce(e)}}mergeReactionAnnotationsWithData$({data:e,feature:t}){try{return this.reactionAnnotationsResolverService.getReactionAnnotationsById$().pipe(ge(()=>{let o=this.mergeReactionAnnotationsWithData({data:e?.data??{},feature:t}),a=this.mergeUsersWithData({feature:t,data:o??{}});return typeof a=="object"?{data:JSON.parse(JSON.stringify(a)),operation:e?.operation??null}:{data:a,operation:e?.operation??null}}),xt(Qt))}catch(o){return this.loggingService.catch("Error in mergeReactionAnnotationsWithData:",o),ce(e)}}mergeUsersWithData$({feature:e,data:t}){try{return this.usersService.getUserById$().pipe(ge(()=>{let o=this.mergeUsersWithData({feature:e,data:t?.data??{}});return typeof o=="object"?{data:JSON.parse(JSON.stringify(o)),operation:t?.operation??null}:{data:o,operation:t?.operation??null}}),xt(Qt))}catch(o){return this.loggingService.catch(`Error in mergeUsersWithData for ${e}:`,o),ce(t)}}mergeLocationMetadataWithData$({data:e,feature:t}){try{return this.docService.getLocationMetadata$().pipe(ge(o=>{let a=this.mergeLocationMetadataWithData({data:e?.data??{},feature:t,locationMetadata:o});return typeof a=="object"?{data:JSON.parse(JSON.stringify(a)),operation:e?.operation??null}:{data:a,operation:e?.operation??null}}),xt(Qt))}catch(o){return this.loggingService.catch(`Error in mergeLocationMetadataWithData for ${t}:`,o),ce(e)}}handleDataStripping(l){return X(this,arguments,function*({feature:e,data:t,actionType:o,commentId:a}){try{switch(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: handleDataStripping","color: green;"),e){case"comment":return yield this.commentUtilsService.stripCommentAnnotationData({data:t,actionType:o,commentId:a});case"reaction":return this.reactionUtilsService.stripReactionAnnotationData(t);default:return{originalData:t,strippedData:null}}}catch(s){return this.loggingService.catch("Error in CommonDbUtilsService handleDataStripping:",s),{originalData:t,strippedData:null}}})}formatData({feature:e,data:t,properties:o,offset:a,isRealtimeDb:l}){try{this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: formatData","color: green;"),typeof t=="object"&&(t=JSON.parse(JSON.stringify(t)));let s=new Date().getTime()+a;switch(e){case"documentAccessType":return delete t?.users,{docIamConfig:t};case"organizationMetadata":case"documentMetadata":return l?t:{metadata:t};case"documentCommentMetadata":return t;case"cursor":return this.cursorUtilsService.formatCursorUserData(t);case"comment":return this.commentUtilsService.formatCommentData(t);case"area":return this.areaUtilsService.formatAreaData(t);case"arrow":return this.arrowUtilsService.formatArrowData(t);case"liveStateCustom":return this.liveStateUtilsService.formatLiveStateCustomData(t);case"liveStateSingleEditorMode":return this.liveStateUtilsService.formatLiveStateSingleEditorModeData(t);case"multiThread":return this.multiThreadUtilsService.formatMultiThreadData(t);case"reaction":return this.reactionUtilsService.formatReactionData(t);case"recorder":return this.recorderUtilsService.formatRecorderData(t,s);case"notificationViewsTimestamp":return{views:{[o.user??""]:t}};case"documentUsersViews":return l?t:{users:{[o.user??""]:{[o.date??""]:t}}};case"documentDayViews":return l?t:{day:{[o.date??""]:{[o.user??""]:t}}};case"documentMetadataViews":return l?t:{metadata:t};case"huddleMessage":return this.huddleUtilsService.formatHuddleMessageData(t);case"locationMetadataViews":return l?t:{metadata:t};case"locationUsersViews":return l?t:{users:{[o.user??""]:{[o.date??""]:t}}};case"locationDayViews":return l?t:{day:{[o.date??""]:{[o.user??""]:t}}};case"locationViews":return l?t:{location:t};case"docNotificationViews":return l?t:{views:t.views};case"userNotificationViews":return l?t:{views:t.views};case"presence":return this.presenceUtilsService.formatPresenceUserData(t);case"selection":return this.selectionUtilsService.formatSelectionData(t);case"tag":return this.tagUtilsService.formatTagData(t);default:return t}}catch(s){return this.loggingService.catch("Error in CommonDbUtilsService formatData:",s),t}}modifyAndSetData(l){return X(this,arguments,function*({feature:e,data:t,subscriber:o,operation:a=null}){try{let s=yield this.modifyData({feature:e,data:t});o.next({data:s,operation:a})}catch(s){this.loggingService.catch("Error in CommonDbUtilsService modifyAndSetData:",s)}})}isDataAlreadyProcessedInLocalCache({feature:e,change:t,cache:o}){try{if(e==="allReactions"||e==="allComments"){if(t.type==="removed")return!Object.keys(o??{}).includes(t.doc.id);if(o?.[t.doc.id]){let a=t.doc.data(),l=o?.[t.doc.id];return a?.lastUpdated===l?.lastUpdated}}return!1}catch(a){return this.loggingService.catch("Error in CommonDbUtilsService isDataAlreadyProcessedInLocalCache:",a),!1}}modifyData(o){return X(this,arguments,function*({feature:e,data:t}){try{return yield this.formatResponse({feature:e,data:t})}catch(a){return this.loggingService.catch("Error in CommonDbUtilsService modifyData:",a),t}})}addMetadata(e,t){try{return e&&typeof e=="object"&&!Array.isArray(e)?E(b({},e),{metadata:e?.metadata??{documentId:t?.documentId,organizationId:t?.organizationId,apiKey:t?.apiKey}}):e}catch(o){return this.loggingService.catch("Error in CommonDbUtilsService addMetadata:",o),e}}setDataInLocal(d){return X(this,arguments,function*({feature:e,data:t,observablesCache:o,eventType:a,id:l,operation:s=null}){try{let u={comment:"allComments",reaction:"allReactions"}[e];if(!u)return null;let S=t?.metadata?.documentId,k=t?.metadata?.veltFolderId;return Object.keys(o).filter(A=>A.includes(u)&&(!S||A.includes(S)||k&&A.includes(k))).forEach(A=>{let P=o[A]?.subject?.getValue()??{};a==="DELETE"?l&&P?.data?.[l]&&(delete P?.data?.[l],o[A]?.subject&&o[A].subject.next({data:P?.data,operation:s})):o[A]?.subject?.next({data:E(b({},P?.data),{[t?.annotationId]:t}),operation:s})}),null}catch(v){return this.loggingService.catch("Error in CommonDbUtilsService setDataInLocal:",v),null}})}handleCommentEncryption(s){return X(this,arguments,function*({data:e,firestorePath:t,extraData:o,eventType:a,metadata:l}){try{return yield this.commentUtilsService.handleCommentEncryption({data:e,firestorePath:t,extraData:o,eventType:a,metadata:l})}catch(d){return this.loggingService.catch("Error in CommonDbUtilsService handleCommentEncryption:",d),e}})}handleReactionEncryption(a){return X(this,arguments,function*({data:e,firestorePath:t,eventType:o}){try{return yield this.reactionUtilsService.handleReactionEncryption({data:e,firestorePath:t,eventType:o})}catch(l){return this.loggingService.catch("Error in CommonDbUtilsService handleReactionEncryption:",l),e}})}rtdbDefaultTransactionCallback(e,t){try{let o=b({},e||{});return Object.entries(t).forEach(([a,l])=>{l==null?delete o[a]:o[a]=l}),o}catch(o){return this.loggingService.catch("Error in CommonDbUtilsService rtdbDefaultTransactionCallback:",o),e}}};r.\u0275fac=function(t){return new(t||r)(J(due),J(mue),J(ku),J(gue),J(pi),J(vue),J(wR),J(DR),J(x),J(hue),J(OR),J(Cue),J(_ue),J(l_),J(bue),J(Sue),J(Dn),J(lt),J(vs),J(Pm))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var yue=(()=>{let r=class r{constructor(e,t,o){this.configService=e,this.authService=t,this.loggingService=o,this.firestore$=new be(null);try{un([this.authService.getFirebaseConfig$(),this.configService.getApiKey$()]).pipe(je(([a,l])=>!!a&&!!l),st(1)).subscribe(([a,l])=>{if(a&&l&&a?.firebaseOptions?.storeDbId){try{let s=sessionStorage?.getItem("veltFirestoreLogLevel")||wn?.firebaseLogLevel||"silent";Dq(s)}catch(s){this.loggingService.catch("Error in FirestoreService setLogLevel: ",s)}this.firestore$.next(tR(Iu.getFirestoreProdDbName(l,a.firebaseOptions)))}},a=>{})}catch{}}getFirestore(){return this.firestore$.asObservable()}getFirestoreValue(){return this.firestore$.value}generateFirestoreDocumentId(){try{let e=this.getFirestoreValue()||tR("DocumentIdDb");if(e){let t=YE(e,"generateDocumentId");return X1(t).id}return}catch(e){this.loggingService.catch("Error in FirestoreService generateFirestoreDocumentId: ",e);return}}};r.\u0275fac=function(t){return new(t||r)(J(Lt),J(Ge),J(x))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var xn=(()=>{let r=class r{constructor(e,t,o,a,l,s,d,v,u,S,k){this.authService=e,this.commonDbUtilsService=t,this.coreActionsService=o,this.loggingService=a,this.firestoreService=l,this.databaseService=s,this.configService=d,this.docService=v,this.usersService=u,this.commentAnnotationsResolverService=S,this.reactionAnnotationsResolverService=k,this.offset=0,this.db=null,this.firestore=null,this.subscriptions=[],this.offsetListener=null,this.observablesCache={},this.firestoreSubscriptions={},this.rtdbSubscriptions={},this.loggingService.log("%c[WB] Creating CLASS: CommonDbService","color: blue;"),this.docService.setCommonDbService(this),this.authService.setCommonDbService(this),this.usersService.setCommonDbService(this),this.subscriptions.push(this.databaseService.getDb().subscribe(A=>{if(A){this.db=A;let P=Li(A,".info/serverTimeOffset");this.offsetListener=Zv(P,U=>{let W=U.val();this.offset=W})}})),this.subscriptions.push(this.firestoreService.getFirestore().subscribe(A=>{A&&(this.firestore=A)}))}unsubscribeFromObservables(){try{Object.values(this.firestoreSubscriptions??{}).forEach(e=>{e?.unsubscribe()}),Object.values(this.rtdbSubscriptions??{}).forEach(e=>{e?.unsubscribe()}),Object.entries(this.observablesCache??{}).forEach(([e,t])=>{t?.subject?.complete(),t?.subject?.unsubscribe()}),this.observablesCache={},this.firestoreSubscriptions={},this.rtdbSubscriptions={}}catch(e){this.loggingService.catch("Error in unsubscribeFromObservables:",e)}}ngOnDestroy(){this.subscriptions.forEach(e=>e.unsubscribe()),this.offsetListener&&this.offsetListener(),this.unsubscribeFromObservables()}setupOnDisconnect(e,t){return X(this,null,function*(){try{if(this.db){let o=Li(this.db,e);return Ll(o).update(t)}return Promise.resolve()}catch(o){return this.loggingService.catch("Error in setupOnDisconnect:",o),Promise.resolve()}})}getOffset(){return this.offset}getServerTimestamp(){return new Date().getTime()+this.getOffset()}subscribeToServices(e){un([this.databaseService.getDb(),this.firestoreService.getFirestore()]).pipe(je(([t,o])=>!!t),st(1),rn(([t,o])=>{e({db:t,firestore:o})})).subscribe({error:t=>{this.loggingService.catch("Error in CommonDbService subscription: ",t)}})}performDatabaseOperation(e,t,o,a,l,s){return X(this,null,function*(){try{if(!t){this.loggingService.warn(`%c[WB] No properties found for ${e}`,"color: red;");return}return this.subscribeToServices(u=>X(this,[u],function*({db:d,firestore:v}){let S;t?.skipFirestore||(S=this.commonDbUtilsService.getFirestorePath({feature:e,properties:t,documentPaths:this.docService.getDocumentPaths(),apiKey:t.apiKey??this.configService.getApiKey()}));let k=this.commonDbUtilsService.getDocumentPath({feature:e,properties:t,defaultDocumentPaths:this.docService.getDocumentPaths(),apiKey:t.apiKey??this.configService.getApiKey(),useFirestore:this.shouldUseFirestore()});if(!d){this.loggingService.warn(`%c[WB] No database or firestore found for ${e}`,"color: red;");return}try{let A,P;try{k&&(A=Li(d,`${k}`))}catch{this.loggingService.catch("Error in dbRef")}try{S?.includes("/organizations")&&v&&S&&(P=X1(v,`${S}`))}catch{this.loggingService.catch("Error in docRef")}if(!this.authService.getUser())return;yield o({dbRef:A,firestoreRef:P,data:a,firestorePath:S}),s&&s({firestoreAvailable:!!v})}catch(A){this.loggingService.catch(`Error in ${e} operation: `,A),l&&l(A)}}))}catch(d){this.loggingService.catch("Error in performDatabaseOperation:",d)}})}setData(d){return X(this,arguments,function*({feature:e,data:t,properties:o,callback:a,errorCallback:l,extraData:s}){try{return this.loggingService.log(`%c[WB] Calling FUNCTION: setData for ${e}`,"color: green;"),this.shouldUseFirestore()&&t?.metadata&&!t?.metadata?.apiKey?void 0:(this.commonDbUtilsService.setDataInLocal({feature:e,data:t,observablesCache:this.observablesCache,operation:null}),this.performDatabaseOperation(e,o,v=>X(this,null,function*(){if(v.dbRef){let u=this.commonDbUtilsService.formatData({feature:e,data:v.data,properties:o,offset:this.getOffset(),isRealtimeDb:!0});o?.rtdbTransaction?yield jh(v.dbRef,()=>JSON.parse(JSON.stringify(u))):yield HC(v.dbRef,JSON.parse(JSON.stringify(u)))}try{if(v.firestoreRef&&v.data&&!o?.skipFirestore){let u=this.commonDbUtilsService.formatData({feature:e,data:v.data,properties:o,offset:this.getOffset()});typeof u=="object"&&(u=JSON.parse(JSON.stringify(u)));let{strippedData:S,originalData:k,eventType:A}=yield this.commonDbUtilsService.handleDataStripping({feature:e,data:u,actionType:s?.actionType,commentId:s?.targetAnnotationData?.commentId??o?.targetCommentId});if(e==="comment"){let P=null,U=St();this.coreActionsService.triggerAction(ut.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:U,methodName:Gr.SET_DATA,source:"internal",payload:{strippedData:S,originalData:k,eventType:A,commentId:s?.targetAnnotationData?.commentId}}),S&&(P=yield this.commentAnnotationsResolverService.saveCommentAnnotation({commentAnnotation:S,eventType:A,commentId:s?.targetAnnotationData?.commentId},U)),k&&(P?.isSuccess||P===null)&&(yield this.commonDbUtilsService.handleCommentEncryption({data:k,firestorePath:v.firestorePath??"",extraData:s,metadata:o?.metadata}))}else if(e==="reaction"){let P=null,U=St();this.coreActionsService.triggerAction(ut.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:U,methodName:to.SET_DATA,source:"internal",payload:{strippedData:S,originalData:k}}),S&&(P=yield this.reactionAnnotationsResolverService.saveReactionAnnotation(S,U)),k&&(P?.isSuccess||P===null)&&(yield this.commonDbUtilsService.handleReactionEncryption({data:k,firestorePath:v.firestorePath??""}))}else e==="recorder"?this.firestore&&(yield Gve(this.firestore,P=>X(this,null,function*(){P.set(v.firestoreRef,u)}))):yield oY(v.firestoreRef,u)}}catch(u){this.authService.getUser()&&this.loggingService.catch(`Error in setData for ${e}`,u)}}),t,l,a))}catch(v){this.loggingService.catch(`Error in setData for ${e}`,v)}})}updateData(d){return X(this,arguments,function*({feature:e,data:t,properties:o,callback:a,errorCallback:l,extraData:s}){try{return this.loggingService.log(`%c[WB] Calling FUNCTION: updateData for ${e}`,"color: green;"),this.shouldUseFirestore()&&t?.metadata&&!t?.metadata?.apiKey?void 0:(this.commonDbUtilsService.setDataInLocal({feature:e,data:t,observablesCache:this.observablesCache,operation:null}),this.performDatabaseOperation(e,o,v=>X(this,null,function*(){if(v.dbRef&&!o?.skipRtdb){let u=this.commonDbUtilsService.formatData({feature:e,data:v.data,properties:o,offset:this.getOffset(),isRealtimeDb:!0});o?.rtdbTransaction?yield jh(v.dbRef,S=>{let k;return o?.rtdbTransactionCallback?k=o.rtdbTransactionCallback(S,u):k=this.commonDbUtilsService.rtdbDefaultTransactionCallback(S,u),JSON.parse(JSON.stringify(k))}):yield jM(v.dbRef,JSON.parse(JSON.stringify(u)))}try{if(v.firestoreRef&&v.data&&!o?.skipFirestore){let u=this.commonDbUtilsService.formatData({feature:e,data:v.data,properties:o,offset:this.getOffset()});typeof u=="object"&&(u=JSON.parse(JSON.stringify(u)));let{strippedData:S,originalData:k,eventType:A}=yield this.commonDbUtilsService.handleDataStripping({feature:e,data:u,actionType:s?.actionType,commentId:s?.targetAnnotationData?.commentId});if(e==="comment"){let P=null,U=St();this.coreActionsService.triggerAction(ut.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:U,methodName:Gr.UPDATE_DATA,source:"internal",payload:{strippedData:S,originalData:k,eventType:A,commentId:s?.targetAnnotationData?.commentId}}),S&&(P=yield this.commentAnnotationsResolverService.saveCommentAnnotation({commentAnnotation:S,eventType:A,commentId:s?.targetAnnotationData?.commentId},U)),k&&(P?.isSuccess||P===null)&&(yield this.commonDbUtilsService.handleCommentEncryption({data:k,firestorePath:v.firestorePath??"",extraData:s,metadata:o?.metadata}))}else if(e==="reaction"){let P=null,U=St();this.coreActionsService.triggerAction(ut.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:U,methodName:to.UPDATE_DATA,source:"internal",payload:{strippedData:S,originalData:k}}),S&&(P=yield this.reactionAnnotationsResolverService.saveReactionAnnotation(S,U)),k&&(P?.isSuccess||P===null)&&(yield this.commonDbUtilsService.handleReactionEncryption({data:k,firestorePath:v.firestorePath??""}))}else yield oY(v.firestoreRef,u,{merge:!0})}}catch(u){this.authService.getUser()&&this.loggingService.catch(`Error in updateDoc for ${e}`,u)}}),t,l,a))}catch(v){this.loggingService.catch(`Error in updateData for ${e}`,v)}})}deleteData(l){return X(this,arguments,function*({feature:e,properties:t,callback:o,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:t?.id,operation:{type:"removed",ids:[t?.id]}}),this.performDatabaseOperation(e,t,s=>X(this,null,function*(){s.dbRef&&(yield VM(s.dbRef));try{if(s.firestoreRef&&!t?.skipFirestore)if(e==="comment"){let d=null,v=St();this.coreActionsService.triggerAction(ut.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_DELETE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:v,methodName:Gr.DELETE_DATA,source:"internal",payload:{commentAnnotationId:t?.id??"",metadata:t?.metadata}}),d=yield this.commentAnnotationsResolverService.deleteCommentAnnotation(t?.id??"",t?.metadata,v),(d?.isSuccess||d===null)&&(yield this.commonDbUtilsService.handleCommentEncryption({firestorePath:s.firestorePath??"",eventType:"DELETE",metadata:t?.metadata}))}else if(e==="reaction"){let d=null,v=St();this.coreActionsService.triggerAction(ut.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_DELETE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:v,methodName:to.DELETE_DATA,source:"internal",payload:{reactionAnnotationId:t?.id??"",metadata:t?.metadata}}),d=yield this.reactionAnnotationsResolverService.deleteReactionAnnotation(t?.id??"",t?.metadata,v),(d?.isSuccess||d===null)&&(yield this.commonDbUtilsService.handleReactionEncryption({firestorePath:s.firestorePath??"",eventType:"DELETE"}))}else yield jve(s.firestoreRef)}catch(d){this.authService.getUser()&&this.loggingService.catch(`Error in deleteData for ${e}`,d)}}),void 0,a,o)}catch(s){this.loggingService.catch(`Error in deleteData for ${e}`,s)}})}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=St()),e||"noDocumentId"}catch(e){return this.loggingService.catch("Error in generateFirestoreDocumentId:",e),St()||"noDocumentId"}}queryData(o){return X(this,arguments,function*({feature:e,properties:t}){try{let a=this.shouldUseFirestore();return!e||!t?(this.loggingService.warn("[WB] Missing required parameters in queryData"),[]):a?yield this.handleFirestoreQuery(e,t):yield this.handleRtdbQuery(e,t)}catch(a){return this.loggingService.catch(`Error in queryData for ${e}`,a),[]}})}handleFirestoreQuery(e,t){return X(this,null,function*(){try{if(!this.firestore)return this.loggingService.warn("[WB] Firestore not initialized"),[];let o=t?.useCollectionGroup?this.commonDbUtilsService.getFirestoreCollectionGroupPath(e):this.commonDbUtilsService.getFirestorePath({feature:e,properties:t,documentPaths:this.docService.getDocumentPaths(),apiKey:t.apiKey??this.configService.getApiKey()});if(!o)return this.loggingService.warn(`[WB] No firestore path found for ${e}`),[];try{let a=YE(this.firestore,o);t?.useCollectionGroup&&(a=nY(this.firestore,o));let l=t?.firestoreQuery??[],s=rY(a,...l);if(!this.authService.getUser()&&!t?.skipUserCheck)return[];if(t?.getCount)try{let d=yield $ve(s).catch(v=>(this.authService.getUser()&&this.loggingService.catch(`Error in getCountFromServer for ${e}`,v),null));return d?d.data().count:0}catch(d){return this.authService.getUser()&&this.loggingService.catch(`Error in getCountFromServer for ${e}`,d),0}else try{let d=yield zve(s).catch(u=>(this.authService.getUser()&&this.loggingService.catch(`Error in getDocs for ${e}`,u),null));if(!d)return[];let v=d.docs.map(u=>u.data());try{return yield this.commonDbUtilsService.modifyData({feature:e,data:v})}catch(u){return this.loggingService.catch(`Error in modifyData for ${e}`,u),v}}catch(d){return this.authService.getUser()&&this.loggingService.catch(`Error in getDocs for ${e}`,d),[]}}catch(a){return this.loggingService.catch(`Error in Firestore query for ${e}:`,a),[]}}catch(o){return this.loggingService.catch(`Error in Firestore query for ${e}:`,o),[]}})}handleRtdbQuery(e,t){return X(this,null,function*(){if(!this.db)return this.loggingService.warn("[WB] Realtime Database not initialized"),[];let o=this.commonDbUtilsService.getDocumentPath({feature:e,properties:t,defaultDocumentPaths:this.docService.getDocumentPaths(),apiKey:t.apiKey??this.configService.getApiKey()});if(!o)return this.loggingService.warn(`[WB] No database path found for ${e}`),[];try{let a=Li(this.db,o),l=t?.rtdbQuery??[],s=OH(a,...l);if(!this.authService.getUser()&&!t?.skipUserCheck)return[];let d=yield wH(s).catch(u=>(this.authService.getUser()&&this.loggingService.catch(`Error in get for ${e}`,u),null));if(!d)return[];let v=d.val();return v?t?.skipObjectValues?v:Object.values(v??{}):[]}catch(a){return this.loggingService.catch(`Error in RTDB query for ${e}:`,a),[]}})}getData(o){return X(this,arguments,function*({feature:e,properties:t}){try{let a=this.shouldUseFirestore();if(t?.skipFirestore&&(a=!1),!e||!t)return this.loggingService.warn("[WB] Missing required parameters in getData"),{};if(a&&this.firestore){let l=this.commonDbUtilsService.getFirestorePath({feature:e,properties:t,documentPaths:this.docService.getDocumentPaths(),apiKey:t.apiKey??this.configService.getApiKey()});if(!l)return this.loggingService.warn(`[WB] No firestore path found for ${e}`),{};try{if(!this.authService.getUser())return this.loggingService.catch("User not set. [source: getData]",void 0,void 0,!0),{};let s=yield Hve(X1(this.firestore,l)).catch(v=>(this.authService.getUser()&&this.loggingService.catch(`Error in getDoc for ${e}`,v),this.commonDbUtilsService.getErrorForGetRequests({feature:e,error:v})));if(s){if(s?.errorCode)return s}else return this.loggingService.warn(`[WB] No document found at ${l}`),{};let d=s.data();return t?.field?d?.[t.field]??{}:d??{}}catch(s){return this.loggingService.catch(`Error fetching Firestore data for ${e}:`,s),{}}}if(this.db){let l=this.commonDbUtilsService.getDocumentPath({feature:e,properties:t,defaultDocumentPaths:this.docService.getDocumentPaths(),apiKey:t.apiKey??this.configService.getApiKey()});if(!l)return this.loggingService.warn(`[WB] No database path found for ${e}`),{};try{if(!this.authService.getUser())return{};let s=yield wH(Li(this.db,l)).catch(v=>(this.authService.getUser()&&this.loggingService.catch(`Error in get for ${e}`,v),this.commonDbUtilsService.getErrorForGetRequests({feature:e,error:v})));if(s){if(s?.errorCode)return s}else return this.loggingService.warn(`[WB] No data found at ${l}`),{};let d=s.val();return t?.field?d?.[t.field]??{}:d??{}}catch(s){return this.loggingService.catch(`Error fetching RTDB data for ${e}:`,s),{}}}return this.loggingService.warn("[WB] No database connection available"),{}}catch(a){return this.loggingService.catch("Unexpected error in getData:",a),{}}})}dbListener({feature:e,properties:t}){let o=this.shouldUseFirestore();t?.skipFirestore&&(o=!1);let a=`${e}-${JSON.stringify(t)}`;return un([this.databaseService.getDb(),this.firestoreService.getFirestore(),this.authService.getUser$().pipe(je(l=>!!l))]).pipe(je(([l,s])=>l?o&&!s?(this.loggingService.warn(`[WB] Firestore requested but not available for ${e}`),!1):!0:(this.loggingService.warn(`[WB] No database found for ${e}`),!1)),fe(([l,s])=>{try{if(o&&s){if(!!!this.observablesCache[a]){this.observablesCache[a]={subject:new be({}),count:0};let u=this.handleFirestoreListener(e,t,s).subscribe(S=>{this.observablesCache[a]?.subject?.next(S)},S=>this.observablesCache[a]?.subject?.error(S));this.firestoreSubscriptions[a]=u}return new Gt(v=>{let u=this.observablesCache[a]?.subject?.subscribe(S=>v.next(S),S=>v.error(S),()=>v.complete());return this.observablesCache[a].count+=1,()=>{u?.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(l){if(!!!this.observablesCache[a]){this.observablesCache[a]={subject:new be({}),count:0};let u=this.handleRealtimeDbListener(e,t,l).subscribe(S=>{this.observablesCache[a]?.subject?.next(S)},S=>this.observablesCache[a]?.subject?.error(S));this.rtdbSubscriptions[a]=u}return new Gt(v=>{let u=this.observablesCache[a]?.subject?.subscribe(S=>v.next(S),S=>v.error(S),()=>v.complete());return this.observablesCache[a].count+=1,()=>{u?.unsubscribe(),this.observablesCache[a]&&(this.observablesCache[a].count-=1,this.observablesCache[a].count<=0&&(this.rtdbSubscriptions[a]?.unsubscribe(),delete this.rtdbSubscriptions?.[a],this.observablesCache[a]?.subject?.complete(),delete this.observablesCache?.[a]))}})}return ce({})}catch(d){return this.loggingService.catch(`Error setting up listener for ${e}:`,d),ce({})}}),Bp(()=>{this.loggingService.log(`[WB] Cleaning up listener for ${e} and key ${a}`)}))}handleFirestoreListener(e,t,o){let a=t?.useCollectionGroup?this.commonDbUtilsService.getFirestoreCollectionGroupPath(e):this.commonDbUtilsService.getFirestorePath({feature:e,properties:t,documentPaths:this.docService.getDocumentPaths(),apiKey:t.apiKey??this.configService.getApiKey()}),l=`${e}-${JSON.stringify(t)}`;return a?new Gt(s=>{let d=t.isCollection?this.setupCollectionListener(o,a,e,s,t):this.setupDocumentListener(o,a,e,s,t);return()=>{s.complete(),s.unsubscribe(),d(),this.observablesCache[l]?.subject?.complete(),this.observablesCache[l]?.subject?.unsubscribe(),delete this.observablesCache[l]}}).pipe(fe(s=>this.commonDbUtilsService.mergeUsersWithData$({feature:e,data:s})),fe(s=>["allComments","allUserNotifications"].includes(e)?this.commonDbUtilsService.mergeCommentAnnotationsWithData$({data:s,feature:e}):ce(s)),fe(s=>["allReactions"].includes(e)?this.commonDbUtilsService.mergeReactionAnnotationsWithData$({data:s,feature:e}):ce(s)),xt(Qt)):(this.loggingService.warn(`[WB] No firestore path found for ${e} and key ${l}`),ce({}))}setupCollectionListener(e,t,o,a,l){let s=`${o}-${JSON.stringify(l)}`,d=YE(e,t);if(l?.useCollectionGroup&&(d=nY(e,t)),l?.useQuery&&l?.firestoreQuery){let S=l?.firestoreQuery??[];d=rY(d,...S)}let v=!0,u=[];return o==="allComments"&&this.loggingService.logContext("[CONTEXT] setupCollectionListener called with path:",t,"feature:",o,"properties:",JSON.stringify(l??"nil")),iY(d,S=>{try{let k=JSON.parse(JSON.stringify(this.observablesCache[s]?.subject?.getValue()?.data??{})),A=null,P=!1;S?.docChanges()?.length?S.docChanges().forEach(U=>{["allComments","allReactions"].includes(o)&&!v&&U.type!=="removed"&&u.push(U.doc.id),this.commonDbUtilsService.isDataAlreadyProcessedInLocalCache({feature:o,change:U,cache:this.observablesCache[s]?.subject?.getValue()?.data??{}})||(P=!0,Object.assign(k,this.handleCollectionChange(U,k)),U.type==="removed"&&(A||(A={type:U.type,ids:[]}),A.ids.push(U.doc.id)))}):P=!0,P&&(["allComments","allReactions"].includes(o)&&u?.length&&(this.commonDbUtilsService.resolveAnnotations({data:u,feature:o}),u=[]),this.commonDbUtilsService.modifyAndSetData({feature:o,data:k,subscriber:a,operation:A})),v=!1}catch(k){this.loggingService.logContext(`[ERROR] Firestore listener error for feature ${o}:`,k),this.loggingService.logContext(`[ERROR] Firestore listener error for properties ${JSON.stringify(l??"nil")}:`),this.loggingService.logContext(`[ERROR] Firestore listener error for user ${JSON.stringify(this.authService.getUser()??"nil")}:`),this.handleListenerError(k,o,a)}},S=>{this.loggingService.logContext(`[ERROR] Firestore listener error for feature ${o}:`,S),this.loggingService.logContext(`[ERROR] Firestore listener error for properties ${JSON.stringify(l??"nil")}:`),this.loggingService.logContext(`[ERROR] Firestore listener error for user ${JSON.stringify(this.authService.getUser()??"nil")}:`),this.handleListenerError(S,o,a)})}handleCollectionChange(e,t){switch(e.type){case"added":case"modified":t[e.doc.id]=e.doc.data();break;case"removed":delete t?.[e.doc.id];break}return t}setupDocumentListener(e,t,o,a,l){let s=X1(e,t);return iY(s,d=>{try{let v=d.data()||{};l?.field&&(v=v?.[l?.field]??{}),this.commonDbUtilsService.modifyAndSetData({feature:o,data:v,subscriber:a,operation:null})}catch(v){this.handleListenerError(v,o,a)}},d=>this.handleListenerError(d,o,a))}handleListenerError(e,t,o){this.loggingService.catch(`Firestore listener error for ${t}:`,e)}handleRealtimeDbListener(e,t,o){let a=this.commonDbUtilsService.getDocumentPath({feature:e,properties:t,defaultDocumentPaths:this.docService.getDocumentPaths(),apiKey:t.apiKey??this.configService.getApiKey()});if(!a)return this.loggingService.warn(`[WB] No database path found for ${e}`),ce({});let l=Li(o,a);if(t?.useQuery&&t?.rtdbQuery){let s=t?.rtdbQuery??[];l=OH(l,...s)}return this.objectValFromChildEvents(l,e).pipe(Hn(s=>(this.loggingService.catch(`RTDB listener error for ${e}:`,s),ce({}))),ge(s=>(s===null&&(s={}),s&&typeof s=="object"?Object.entries(s??{}).reduce((v,[u,S])=>(v[u]=this.commonDbUtilsService.addMetadata(S,t),v),{}):this.commonDbUtilsService.addMetadata(s,t))),fe(s=>this.commonDbUtilsService.modifyData({feature:e,data:s})),fe(s=>this.usersService.getUserById$().pipe(ge(()=>({data:this.commonDbUtilsService.mergeUsersWithData({feature:e,data:s}),operation:null})))))}objectValFromChildEvents(e,t){return new Gt(o=>{let a={},l=!1,s=null,d=U=>{try{this.loggingService.catch(`Realtime DB listener error for ${t}:`,U),o.error(U)}catch{}},v=U=>{try{if(!Ei(U,s)){let W=JSON.parse(JSON.stringify(U));s=W,o.next(W)}}catch{}},u=U=>{try{U.key&&(a[U.key]=U.val(),l&&v(b({},a)))}catch{}},S=U=>{try{U.key&&(a[U.key]=U.val(),l&&v(b({},a)))}catch{}},k=U=>{try{U.key&&(delete a[U.key],l&&v(b({},a)))}catch{}},A=U=>{try{if(!l){let W=a&&typeof a=="object"?JSON.parse(JSON.stringify(a)):{};s=W,o.next(W),l=!0}}catch{}};tle(e,u,d),nle(e,S,d),ile(e,k,d);let P=Zv(e,A,d,{onlyOnce:!0});return()=>{try{P&&typeof P=="function"&&P(),BM(e,"child_added",u),BM(e,"child_changed",S),BM(e,"child_removed",k)}catch{}}})}};r.\u0275fac=function(t){return new(t||r)(J(Ge),J(Mm),J(pi),J(x),J(yue),J(On),J(Lt),J(lt),J(Dn),J(vs),J(Pm))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var ln=(()=>{let r=class r{constructor(e,t,o,a,l,s,d,v,u){this.analyticsService=e,this.authService=t,this.configService=o,this.coreActionsService=a,this.databaseService=l,this.docService=s,this.loggingService=d,this.commonDbService=v,this.usersService=u,this.db=Fl(),this.internalUserContacts$=new be([]),this.userGlobalContact$=new be(!1),this.userGroupContact$=new be(null),this.users$=new be([]),this.userPersonalContacts=[],this.userGroupContacts=[],this.userGlobalContacts=[],this.users=[],this.documentPaths=null,this.userAccessFields$=new be({}),this.userOrganizationContacts$=new be([]),this.userFolderContacts$=new be([]),this.userDocumentContacts$=new be([]),this.userOrganizationGroups$=new be([]),this.onContactSelectedSubject$=new nt,this.documentAccessType=null,this.atHereEnabled$=new be(!1),this.atHereLabel$=new be("here"),this.atHereDescription$=new be(null),this.contactListScopeForOrganizationUsers$=new be([ar.ALL]),this.customUserContacts$=new be(null),this.customUserContactsConfig$=new be({merge:!1}),this.currentOrganizationUserIAM$=new be(null),this.userContacts$=new be([]),this.userSnippylyIdContacts$=new be(null),this.usersByOrganizationId$=new be({}),this.temporaryUserIds$=new be([]),this.usersByOrganizationIdAndDocumentId$=new be({}),this.usersByOrganizationIdAndFolderId$=new be({}),this.userById$=new be({}),this.searchUsersSubject$=new nt,this.searchUsersDebounceTime=300,this.pendingSearchPromises=new Map,this.authService.setContactService(this),this.usersService.setContactService(this),this.authService.getUser$().pipe(fe(S=>this.docService.getDocumentPaths$().pipe(rn(k=>{this.documentPaths=k}),ge(()=>S)))).subscribe(S=>X(this,null,function*(){if(this.user=S,S&&this.documentPaths)if(!S?.organizationId)this.getLoggedInUsers$().subscribe(),this.getUserContactsFromDb$(),yield this.migrateLoggedInUserFromEmailToUserIdPath(S),this.setLoggedInUser(S),yield this.moveGlobalContactUserFromEmailToUserIdPath(S),this.updateUserInGlobalContactsIfAvailable(S),S?.groupId&&(yield this.migrateGroupContactsFromEmailToUserIdPath(S?.groupId)),this.checkToSetLoggedInUserInGroupContacts();else{let k=this.userPermissionService?.getCurrentUserPermissions(),A=this.documentPaths.folderId,P=!0;A&&k?.[S?.userId]?.folders?.[A]?.errorCode===qr.PERMISSION_DENIED&&(P=!1),this.getOrganizationContactsFromDb$(),P&&this.getFolderContactsFromDb$(),this.getDocumentContactsFromDb$(),this.getOrganizationGroupsFromDb$(),this.getTemporaryUsers()}else 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}),S=>{this.loggingService.catch("Error in ContactService constructor getUser$: ",S)}),this.databaseService.getDb().pipe(je(S=>!!S),st(1)).subscribe(S=>{S&&(this.db=S)},S=>{this.loggingService.catch("Error in ContactService constructor getDb: ",S)}),this.getOrganizationGroups$().subscribe(S=>{this.authService.setOrganizationUserGroups(S)}),un([this.getInternalUserContacts$(),this.getCustomUserContacts$(),this.getCustomUserContactsConfig$()]).subscribe(([S,k,A])=>{k?A?.merge?this.userContacts$.next([...S||[],...k||[]]):this.userContacts$.next(k||[]):this.userContacts$.next(S||[])}),this.getUserContacts$().subscribe(S=>{try{S?.forEach(k=>{let A=k?.userSnippylyId||ym(this.configService.getApiKey(),k.userId);A&&this.userSnippylyIdContacts$.next(E(b({},this.userSnippylyIdContacts$.value),{[A]:k}))})}catch{}})}setCommentService(e){try{this.commentService=e}catch(t){this.loggingService.catch("Error in ContactService setCommentService: ",t)}}setUserPermissionService(e){try{this.userPermissionService=e}catch(t){this.loggingService.catch("Error in ContactService setUserPermissionService: ",t)}}clearCache(){this.loggingService.log("%c[WB] Calling FUNCTION: clearCache in ContactService","color: green;");try{this.documentPaths=null,this.usersByOrganizationId$.next({}),this.temporaryUserIds$.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=[],this.currentOrganizationUserIAM$.next(null)}catch(e){this.loggingService.catch("Error in ContactService clearCache: ",e)}}setDocumentAccessType(e){try{this.documentAccessType=e}catch(t){this.loggingService.catch("Error in ContactService setDocumentAccessType: ",t)}}checkIfUserGlobalContact(e){return X(this,null,function*(){try{if(e?.userId&&this.documentPaths?.globalContacts){let t=yield this.commonDbService?.getData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Et(e?.userId),skipFirestore:!0}});if(Object.keys(t??{}).length>0)return!0}if(e?.email&&this.documentPaths?.globalContacts){let t=yield this.commonDbService?.getData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Et(e?.email),skipFirestore:!0}});if(Object.keys(t??{}).length>0)return!0}return!1}catch(t){return this.loggingService.catch("Error in ContactService isUserGlobalContact: ",t),!1}})}setLoggedInUser(e){try{e?.userId&&this.documentPaths?.logins&&(this.commonDbService.updateData({feature:"logins",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Et(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(E(b({},e),{contacts:void 0})))}),this.setLoggedInUserPrivateContacts(e,e?.contacts))}catch(t){this.loggingService.catch("Error in ContactService setLoggedInUser: ",t)}}migrateLoggedInUserFromEmailToUserIdPath(e){return X(this,null,function*(){try{if(e?.email&&this.documentPaths?.logins){let t=yield this.commonDbService?.getData({feature:"logins",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Et(e?.email),skipFirestore:!0}});if(Object.keys(t??{}).length>0){let o=t;if(o){if(o?.contacts){let a={};Object.keys(o?.contacts??{})?.forEach(l=>{let s=o.contacts[l];if(s?.userId){let d=Et(s?.userId);a[d]=s}}),o.contacts=a}yield this.commonDbService.updateData({feature:"logins",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Et(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(o))}),yield this.commonDbService.deleteData({feature:"logins",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Et(e?.email),skipFirestore:!0}})}}}}catch(t){this.loggingService.catch("Error in ContactService migrateLoggedInUserFromEmailToUserIdPath: ",t)}})}addGlobalContact(e){try{e?.userId&&this.documentPaths?.globalContacts&&this.commonDbService.updateData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Et(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(e))})}catch(t){this.loggingService.catch("Error in ContactService addGlobalContact: ",t)}}getUserAccessFields(){return JSON.parse(JSON.stringify(this.userAccessFields$.value))}getUserAccessFieldsByUserId(e){return this.getUserAccessFields()?.[e]}setUserAccessFields(e){try{let t=this.getUserAccessFields();e.forEach(a=>{t[a.user.userId]=a.accessFields||[]});let o=this.authService.getUser()?.userId;if(o&&t?.[o]?.length){let a=this.userPermissionService?.getCurrentUserPermissions();a&&(a[o]||(a[o]={}),a[o].context={accessFields:t[o]},this.userPermissionService?.setCurrentUserPermissions(a))}this.userAccessFields$.next(JSON.parse(JSON.stringify(t)))}catch(t){this.loggingService.catch("Error in ContactService setUserAccessFields: ",t)}}updateUserInGlobalContactsIfAvailable(e){return X(this,null,function*(){try{if(e?.userId&&this.documentPaths?.globalContacts&&(yield this.checkIfUserGlobalContact(e))){let o=new Vo;o.userId=e?.userId,o.userSnippylyId=e?.userSnippylyId,o.email=e?.email,o.name=e?.name,o.photoUrl=e?.photoUrl,this.commonDbService.updateData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Et(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(o))})}}catch(t){this.loggingService.catch("Error in ContactService updateUserInGlobalContactsIfAvailable: ",t)}})}moveGlobalContactUserFromEmailToUserIdPath(e){return X(this,null,function*(){try{if(e?.email&&e?.userId&&this.documentPaths?.globalContacts){let t=yield this.commonDbService?.getData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Et(e?.email),skipFirestore:!0}});if(Object.keys(t??{}).length>0){let o=t;o&&(yield this.commonDbService.updateData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Et(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(o))}),yield this.commonDbService.deleteData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Et(e?.email),skipFirestore:!0}}))}}}catch(t){this.loggingService.catch("Error in ContactService removeUserFromGlobalContactsByEmail: ",t)}})}setLoggedInUserPrivateContacts(e,t){try{if(e?.userId&&this.documentPaths?.logins){let o,a=t?.filter(s=>s?.visibility!=="group"),l=!1;this.authService.getUserOptions()&&(l=!!this.authService.getUserOptions()?.replaceContacts||!!this.authService.getUserOptions()?.replacePrivateContacts),a?.length?(o={},a?.forEach(s=>{if(s?.userId){let d=Et(s?.userId);o[d]=s}}),l?this.commonDbService.setData({feature:"allLoginContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Et(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(o))}):this.commonDbService.updateData({feature:"allLoginContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Et(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(o))})):l&&this.commonDbService.deleteData({feature:"allLoginContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Et(e?.userId),skipFirestore:!0}})}}catch(o){this.loggingService.catch("Error in ContactService setLoggedInUserPrivateContacts: ",o)}}migrateGroupContactsFromEmailToUserIdPath(e){return X(this,null,function*(){try{if(this.documentPaths?.groupContacts&&e){let t=yield this.commonDbService?.getData({feature:"groupContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",groupId:e,skipFirestore:!0}});t&&Object.keys(t??{}).forEach(o=>X(this,null,function*(){let a=t[o];a?.email&&a?.userId&&Et(a?.email)===o&&(yield this.commonDbService.deleteData({feature:"groupContactsUser",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",groupId:e,userId:o,skipFirestore:!0}}),yield this.commonDbService.updateData({feature:"groupContactsUser",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",groupId:e,userId:Et(a?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(a))}))}))}}catch(t){this.loggingService.catch("Error in ContactService migrateGroupContacts: ",t)}})}checkToSetLoggedInUserInGroupContacts(){return X(this,null,function*(){try{this.user?.groupId&&this.user?.userId&&((yield this.checkIfUserGlobalContact(this.user))||this.docService.getDocumentIam$().pipe(st(1)).subscribe(t=>X(this,null,function*(){if(this.user?.groupId&&this.user?.userId){let o=!1,a=this.docService.getDocumentAccessType(t);if(!a||a===Ui.PUBLIC)o=!0;else if(a===Ui.RESTRICTED){let l=Et(this.user?.userId);if(t?.users?.[l]&&(o=!0),this.user?.email){let s=Et(this.user?.email);t?.users?.[s]&&(o=!0)}}if(o){let l=new xd;l.email=this.user.email,l.visibility="group",l.name=this.user.name,l.photoUrl=this.user.photoUrl,l.userId=this.user.userId,(this.authService.getUserOptions()?.replaceContacts||this.authService.getUserOptions()?.replaceGroupContacts)&&(yield this.removeGroupContacts(this.user?.groupId)),this.setLoggedInUserGroupContacts(this.user?.groupId,[l]),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,t){try{let o=t?.filter(a=>a?.visibility==="group");o?.length&&o.forEach(a=>X(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:Et(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:Et(a?.email),skipFirestore:!0}}))}}))}catch(o){this.loggingService.catch("Error in ContactService setLoggedInUserGroupContacts: ",o)}}removeGroupContacts(e){return X(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(t){this.loggingService.catch("Error in ContactService removeGroupContacts: ",t)}})}mergeUserContacts(){try{let e=[];this.userPersonalContacts&&e.push(...this.userPersonalContacts),this.userGroupContacts&&e.push(...this.userGroupContacts),this.userGlobalContacts&&e.push(...this.userGlobalContacts);let t={};e.forEach(o=>{o?.userId?(!o?.email||!t[o.email])&&(t[o.userId]=o):o?.email&&(!o?.userId||!t[o.userId])&&(t[o.email]=o)}),e=Object.values(t??{}),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:t,documentId:o,veltFolderId:a}=e||{};return t&&o?un([this.usersByOrganizationId$,this.usersByOrganizationIdAndFolderId$,this.usersByOrganizationIdAndDocumentId$,this.userById$,this.customUserContacts$,this.customUserContactsConfig$,this.getContactListScopeForOrganizationUsers$(),this.temporaryUserIds$]).pipe(ge(([l,s,d,v,u,S,k,A])=>{let P={},U=!1;S&&!S?.merge&&(U=!0);let W=De=>k.some(Ie=>De.includes(Ie)),te=W([ar.ALL,ar.ORGANIZATION])?Object.keys(l?.[t]||{}):[],ye=a?W([ar.ALL,ar.FOLDER])?Object.keys(s?.[t]?.[a]||{}):[]:[],me=W([ar.ALL,ar.DOCUMENT])?Object.keys(d?.[t]?.[o]||{}):[];if([...te,...ye||[],...me,...A].forEach(De=>{let Ie=v?.[De];Ie&&(P[De]=Ie)}),u){let{merge:De,options:Ie}=S||{},{organizationId:xe,documentId:Re,folderId:Le}=Ie||{},Ue=Le?Mi(Le):void 0;(!xe||xe===t)&&(!Re||Re===o)&&(!Ue||Ue===a)&&(De||(P={}),u.forEach(He=>{He?.userId&&(P[He.userId]=He)}))}return Object.values(P??{})})):this.userContacts$.asObservable().pipe(ge(l=>l))}catch(t){return this.loggingService.catch("Error in ContactService getUserContacts$ metadata: ",t),ce([])}}getUserContactsBySnippylyId$(){return this.userSnippylyIdContacts$.asObservable()}getUserBySnippylyId(e){return this.userSnippylyIdContacts$.value?.[e]}getAtHereLabel(){return this.atHereLabel$.asObservable()}getAtHereDescription(){return this.atHereDescription$.asObservable()}getUserContactsFromDb$(){this.getUserContactSubscription||(this.getUserContactSubscription=this.authService.getUser$().pipe(je(e=>!!e),fe(e=>this.docService.getDocumentPaths$().pipe(je(t=>!!t),rn(t=>{this.documentPaths=t}),ge(()=>e))),fe(e=>{if(this.userGroupContacts=[],this.userPersonalContacts=[],!e)return ce();if(!this.documentPaths)return ce();let t=[];return t.push(this.commonDbService.dbListener({feature:"allGlobalContacts",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}}).pipe(ge(o=>o?.data),rn(o=>{o?(this.userGlobalContacts=Object.values(o??{}),this.userGlobalContacts?.find(a=>a.userId===this.user?.userId)?this.userGlobalContact$.next(!0):this.userGlobalContact$.next(!1)):(this.userGlobalContacts=[],this.userGlobalContact$.next(!1))}))),t.push(this.commonDbService.dbListener({feature:"groupContacts",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0,groupId:e?.groupId}}).pipe(ge(o=>o?.data),rn(o=>{o?(this.userGroupContacts=Object.values(o??{}),this.userGroupContacts?.find(a=>a?.userId===this.user?.userId)?this.userGroupContact$.next(!0):this.userGroupContact$.next(!1)):(this.userGroupContacts=[],this.userGroupContact$.next(!1))}))),t.push(this.commonDbService.dbListener({feature:"allLoginContacts",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0,userId:Et(e?.userId)}}).pipe(ge(o=>o?.data),rn(o=>{o?this.userPersonalContacts=Object.values(o??{}):this.userPersonalContacts=[]}))),Sr(...t).pipe(Ar(this.authService.getUser$().pipe(je(o=>!o))))})).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(t){this.loggingService.catch("Error in ContactService addUserContact: ",t)}}isUserGlobalContact$(){return this.userGlobalContact$.asObservable().pipe(xt(Qt))}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(fe(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(ge(t=>t?.data),rn(t=>{t?this.users=Object.values(t??{}):this.users=[]})):(this.users=[],ce()):ce():ce())).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(fe(e=>e?.organizationId?this.userById$.pipe(ge(t=>{let o={};return Object.values(t||{}).forEach(a=>{a?.userSnippylyId&&(o[a?.userSnippylyId]=a)}),o})):this.users$.pipe(ge(t=>{let o={};return t.forEach(a=>{o[a.userSnippylyId]=a}),o}))))}getUserByEmail$(e){return this.users$.pipe(ge(t=>t.find(o=>o.email===e)))}getUserByEmail(e){return this.users?.find(t=>t.email===e)}getContactByEmail(e){return this.getInternalUserContacts().find(t=>t.email===e)}getUserByUserId$(e){return this.users$.pipe(ge(t=>t.find(o=>o.userId===e)))}getUserGroupContacts(){return this.userGroupContacts}getTemporaryUsers(){try{let e=this.authService.getUser();this.docService.getOrganizationConfig$().pipe(je(t=>!!t),ge(t=>t?.organizationId)).subscribe(t=>X(this,null,function*(){if(t&&e){let o=((yield this.commonDbService?.queryData({feature:"allPermissionsUsers",properties:{organizationId:t,useCollectionGroup:!1,isCollection:!0,firestoreQuery:[vt("expiresAt",">",new Date().getTime())]}}))??[]).filter(a=>a?.userId!==e?.userId);if(o?.length){let a=o.map(v=>v?.userId),l=St(),s=Gs.GET_TEMPORARY_USERS;this.coreActionsService.triggerAction(ut.USER_RESOLVER,{event:Y.Events.Resolver.USER_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:l,moduleName:s,methodName:eo.GET_TEMPORARY_USERS,source:"internal",payload:{userIds:a}});let d=yield this.usersService.resolveUsers({userIds:a,uniqueId:l,moduleName:s});if(d){let v={};Object.entries(d).forEach(([S,k])=>{v[S]=k}),this.userById$.next(b(b({},this.userById$.value),v));let u=new Set([...this.temporaryUserIds$.value,...Object.keys(v)]);this.temporaryUserIds$.next(Array.from(u))}}}}))}catch(e){this.loggingService.catch("Error in ContactService getTemporaryUsers: ",e)}}searchUsers(e){return X(this,null,function*(){try{if(!e||typeof e!="string"||!e.trim())return[];let t=e.trim();return this.searchUsersDebounced$||(this.searchUsersDebounced$=this.searchUsersSubject$.pipe(Zi(this.searchUsersDebounceTime),xt(),fe(o=>rr(this.performSearch(o)).pipe(ge(a=>({searchText:o,results:a})),Hn(a=>(this.loggingService.catch("Error in ContactService performSearch: ",a),ce({searchText:o,results:[]})))))),this.searchUsersDebounced$.subscribe({next:({searchText:o,results:a})=>{Array.from(this.pendingSearchPromises.keys()).forEach(d=>{if(d!==o){let v=this.pendingSearchPromises.get(d);v&&(v.forEach(({resolve:u})=>u([])),this.pendingSearchPromises.delete(d))}});let s=this.pendingSearchPromises.get(o);s&&(s.forEach(({resolve:d})=>d(a)),this.pendingSearchPromises.delete(o))},error:o=>{this.pendingSearchPromises.forEach(a=>{a.forEach(({reject:l})=>l(o))}),this.pendingSearchPromises.clear()}})),new Promise((o,a)=>{this.pendingSearchPromises.has(t)||this.pendingSearchPromises.set(t,[]),this.pendingSearchPromises.get(t).push({resolve:o,reject:a}),this.searchUsersSubject$.next(t)})}catch(t){return this.loggingService.catch("Error in ContactService searchUsers: ",t),[]}})}performSearch(e){return X(this,null,function*(){try{let t=this.docService.getOrganizationConfig()?.organizationId;if(!t)return[];let o=this.documentPaths?.veltFolderId,a=this.docService.getDocumentIds().map(W=>W?.documentId),l=e.toLowerCase().trim(),s=l+"\uF8FF",d=[],v=a?.filter(W=>!!W)||[],u=v.length>0,S=!!o;if(u){let W=[];for(let ye=0;ye<v.length;ye+=20)W.push(v.slice(ye,ye+20));W.forEach(ye=>{let me=[vt("documentIds","array-contains-any",ye),vt("viewerDocumentIds","array-contains-any",ye)],ke=[vt("organizationIds","array-contains-any",[t]),vt("viewerOrganizationIds","array-contains-any",[t]),...me];S&&ke.push(vt("folderIds","array-contains-any",[o]),vt("viewerFolderIds","array-contains-any",[o])),d.push(this.commonDbService.queryData({feature:"allDocumentUsers",properties:{organizationId:t,isCollection:!0,useCollectionGroup:!1,useQuery:!0,firestoreQuery:[yi(Cf(...ke),vt("user.name_lowercase",">=",l),vt("user.name_lowercase","<",s)),Dm(10)]}}).catch(()=>[])),d.push(this.commonDbService.queryData({feature:"allDocumentUsers",properties:{organizationId:t,isCollection:!0,useCollectionGroup:!1,useQuery:!0,firestoreQuery:[yi(Cf(...ke),vt("user.email_lowercase",">=",l),vt("user.email_lowercase","<",s)),Dm(10)]}}).catch(()=>[]))})}let k=yield Promise.all(d),A=[];k.forEach(W=>{W&&Array.isArray(W)?W.forEach(te=>{te&&te.user&&te.user.userId&&A.push(te)}):W&&typeof W=="object"&&Object.values(W).forEach(ye=>{ye&&ye.user&&ye.user.userId&&A.push(ye)})});let P=new Map;A.forEach(W=>{let te=W.user?.userId;te&&!P.has(te)&&P.set(te,W)});let U=Array.from(P.values());return this.setResolvedUsers(U,!0),U}catch(t){return this.loggingService.catch("Error in ContactService performSearch: ",t),[]}})}setResolvedUsers(e,t=!1){try{if(e?.length){let o=[],a=[],l=[],s=this.docService.getOrganizationConfig()?.organizationId,d=this.documentPaths?.veltFolderId,v=this.docService.getDocumentIds().map(k=>k?.documentId);e.forEach(k=>{this.userById$.value[k?.user?.userId]||(s&&k?.organizationIds?.includes(s)&&!o.find(A=>A?.user?.userId===k?.user?.userId)&&o.push(k),d&&k?.folderIds?.includes(d)&&!a.find(A=>A?.user?.userId===k?.user?.userId)&&a.push(k),v?.some(A=>k?.documentIds?.includes(A))&&!l.find(A=>A?.user?.userId===k?.user?.userId)&&l.push(k))}),o?.length&&this.setUserOrganizationContacts(o,s,t),a?.length&&this.setUserFolderContacts(a,t),l?.length&&this.setUserDocumentContacts(l,t);let S=[...o,...a,...l].filter((k,A,P)=>A===P.findIndex(U=>U.user.userId===k.user.userId));S?.length&&(this.setUserAccessFields(S),this.mergeOrganizationAndDocumentContacts())}}catch(o){this.loggingService.catch("Error in ContactService setResolvedUsers: ",o)}}getOrganizationContactsFromDb$(){try{this.getOrganizationContactsSubscription||(this.getOrganizationContactsSubscription=this.authService.getUser$().pipe(fe(e=>e?.organizationId?ce(e).pipe(fe(t=>this.docService.getOrganizationConfig$().pipe(je(o=>!!o),ge(()=>t))),fe(t=>this.usersService.getResolveOrganizationUsers$().pipe(je(o=>o),ge(()=>t))),fe(t=>{let o=this.docService.getOrganizationConfig()?.organizationId;return this.setUserOrganizationContacts([],o),t?o?this.commonDbService.dbListener({feature:"allOrganizationUsers",properties:{organizationId:o,isCollection:!0,useQuery:!0,firestoreQuery:[yi(Cf(vt("organizationIds","array-contains-any",[o]),vt("viewerOrganizationIds","array-contains-any",[o]))),vr("id"),...this.commentService?.getPaginatedContactList()?[Dm(10)]:[]]}}).pipe(ge(a=>a?.data),fe(a=>this.commentService?.getPaginatedContactList()&&!Object.values(a??{}).find(l=>l?.user?.userId===this.authService.getUser()?.userId)?rr(this.commonDbService.queryData({feature:"allOrganizationUsers",properties:{organizationId:o,isCollection:!0,useQuery:!0,firestoreQuery:[yi(Cf(vt("organizationIds","array-contains-any",[o]),vt("viewerOrganizationIds","array-contains-any",[o])),vt("user.userId","==",this.authService.getUser()?.userId))]}})).pipe(ge(l=>{if(l&&l.length>0){let s=l[0],d=s?.user?.userId||s?.id;if(d&&a){let v=Et(d);return E(b({},a),{[v]:s})}}return a})):ce(a)),ge(a=>{if(a){typeof a=="object"&&(a?.undefined&&delete a.undefined,a?.null&&delete a.null);let l=Object.values(a??{});this.setUserAccessFields(l),this.setUserOrganizationContacts(l,o)}else this.setUserOrganizationContacts([],o)})):ce():ce()}),fe(()=>this.getContactListScopeForOrganizationUsers$())):(this.setUserOrganizationContacts([]),ce()))).subscribe(()=>{this.mergeOrganizationAndDocumentContacts()},e=>{this.loggingService.catch("Error in ContactService getOrganizationContactsFromDb$ subscription: ",e)}))}catch{}}getFolderContactsFromDb$(){try{this.getFolderContactsSubscription||(this.getFolderContactsSubscription=this.authService.getUser$().pipe(fe(e=>e?ce(e).pipe(fe(t=>this.docService.getOrganizationConfig$().pipe(je(o=>!!o),ge(()=>t))),fe(t=>this.usersService.getResolveFolderUsers$().pipe(je(o=>o),ge(()=>t))),fe(t=>{let o=this.docService.getOrganizationConfig()?.organizationId;if(this.setUserFolderContacts([]),!t)return ce();if(!this.commonDbService.shouldUseFirestore())return ce();if(!this.documentPaths?.veltFolderId)return ce();let a=ce([]);return a=this.commonDbService.dbListener({feature:"allFolderUsers",properties:{organizationId:o,folderId:this.documentPaths?.veltFolderId,isCollection:!0,useQuery:!0,firestoreQuery:[yi(Cf(vt("folderIds","array-contains-any",[this.documentPaths?.veltFolderId]),vt("viewerFolderIds","array-contains-any",[this.documentPaths?.veltFolderId]))),vr("id"),...this.commentService?.getPaginatedContactList()?[Dm(10)]:[]]}}).pipe(ge(l=>l?.data)),a.pipe(ge(l=>{if(l){typeof l=="object"&&(l?.undefined&&delete l.undefined,l?.null&&delete l.null);let s=Object.values(l??{});this.setUserAccessFields(s),this.setUserFolderContacts(s)}else this.setUserFolderContacts([])}))}),fe(()=>this.getContactListScopeForOrganizationUsers$())):(this.setUserFolderContacts([]),ce()))).subscribe(()=>{this.mergeOrganizationAndDocumentContacts()},e=>{this.loggingService.catch("Error in ContactService getFolderContactsFromDb$ subscription: ",e)}))}catch{}}getDocumentContactsFromDb$(){try{this.getDocumentContactsSubscription||(this.getDocumentContactsSubscription=this.authService.getUser$().pipe(fe(e=>e?ce(e).pipe(fe(t=>this.docService.getDocumentPaths$().pipe(je(o=>!!o),rn(o=>{this.documentPaths=o}),ge(()=>t))),fe(t=>this.usersService.getResolveDocumentUsers$().pipe(je(o=>o),ge(()=>t))),fe(t=>(this.setUserDocumentContacts([]),t?this.documentPaths?this.docService.getDocumentIds$().pipe(fe(o=>{let a=o?.length>0?o.map(v=>v.documentId):[this.documentPaths?.documentId??""];if(a.some(v=>!v)||!this.documentPaths)return ce();let l=ce([]),s={isCollection:!0,useQuery:!0};this.commonDbService.shouldUseFirestore()||(s.documentId=a?.length?a[0]:void 0,s.organizationId=this.documentPaths?.organizationId);let d=[];for(let v=0;v<a.length;v+=V.LISTENER_BATCH_SIZE)d.push(a.slice(v,v+V.LISTENER_BATCH_SIZE));return l=un(d.map(v=>this.commonDbService.dbListener({feature:"allDocumentUsers",properties:E(b({},s),{firestoreQuery:[yi(Cf(vt("documentIds","array-contains-any",v),vt("viewerDocumentIds","array-contains-any",v))),vr("id"),...this.commentService?.getPaginatedContactList()?[Dm(10)]:[]]})}).pipe(Ho()))).pipe(ge(v=>ha(v)?.data)),l.pipe(ge(v=>{if(v){typeof v=="object"&&(v?.undefined&&delete v.undefined,v?.null&&delete v.null);let u=Object.values(v??{});this.setUserAccessFields(u),this.setUserDocumentContacts(u)}else this.setUserDocumentContacts([])}))})):ce():ce())),fe(()=>this.getContactListScopeForOrganizationUsers$())):(this.setUserDocumentContacts([]),ce()))).subscribe(()=>{this.mergeOrganizationAndDocumentContacts()},e=>{this.loggingService.catch("Error in ContactService getDocumentContactsFromDb$ subscription: ",e)}))}catch{}}setUserOrganizationContacts(e,t,o=!0){try{let a=e.find(s=>s.user.userId===this.user?.userId);a&&this.setCurrentOrganizationUserIAM(a);let l=e.map(s=>s.user)?.filter(s=>!this.userOrganizationContacts$.value.find(d=>d.userId===s.userId));if(this.userOrganizationContacts$.next([...this.userOrganizationContacts$.value,...l]),o&&this.usersService.setUserByIds(l),t){let s={};s[t]={};let d={};e.forEach(u=>{s[t][u.user.userId]=u,d[u.user.userId]=u.user}),this.userById$.next(b(b({},this.userById$.value),d));let v=this.usersByOrganizationId$.value?.[t];v&&(s[t]=b(b({},v),s[t])),this.usersByOrganizationId$.next(E(b({},this.usersByOrganizationId$.value),{[t]:s[t]}))}else this.usersByOrganizationId$.next({})}catch(a){this.loggingService.catch("Error in ContactService setUserOrganizationContacts: ",a)}}getUserOrganizationContacts$(){return this.getContactListScopeForOrganizationUsers$().pipe(fe(()=>this.checkContactListScopeForOrganizationUsers([ar.ALL,ar.ORGANIZATION])?this.userOrganizationContacts$.asObservable():ce([])))}getUserOrganizationContacts(){return this.checkContactListScopeForOrganizationUsers([ar.ALL,ar.ORGANIZATION])?this.userOrganizationContacts$.value:[]}setUserFolderContacts(e,t=!0){try{let o=e?.map(d=>d?.user)?.filter(d=>!this.userFolderContacts$.value.find(v=>v.userId===d.userId));this.userFolderContacts$.next([...this.userFolderContacts$.value,...o]),t&&this.usersService.setUserByIds(o);let a=this.usersByOrganizationIdAndFolderId$.value||{},l=b({},a),s={};e?.forEach(d=>{let{organizationId:v}=d?.metadata||{};v&&(l[v]||(l[v]={}),d.folderIds?.forEach(u=>{l[v][u]||(l[v][u]={}),l[v][u]=E(b({},l[v][u]),{[d.user.userId]:d}),s[d.user.userId]=d.user}))}),this.userById$.next(b(b({},this.userById$.value),s)),this.usersByOrganizationIdAndFolderId$.next(l)}catch(o){this.loggingService.catch("Error in ContactService updateUserFolderContacts: ",o)}}getUserFolderContacts$(){return this.getContactListScopeForOrganizationUsers$().pipe(fe(()=>this.checkContactListScopeForOrganizationUsers([ar.ALL,ar.FOLDER])?this.userFolderContacts$.asObservable():ce([])))}getUserFolderContacts(){return this.checkContactListScopeForOrganizationUsers([ar.ALL,ar.FOLDER])?this.userFolderContacts$.value:[]}setUserDocumentContacts(e,t=!0){try{let o=e?.map(d=>d?.user)?.filter(d=>!this.userDocumentContacts$.value.find(v=>v.userId===d.userId));this.userDocumentContacts$.next([...this.userDocumentContacts$.value,...o]),t&&this.usersService.setUserByIds(o);let a=this.usersByOrganizationIdAndDocumentId$.value||{},l=b({},a),s={};e?.forEach(d=>{let{organizationId:v}=d?.metadata||{};v&&(l[v]||(l[v]={}),d.documentIds?.forEach(u=>{l[v][u]||(l[v][u]={}),l[v][u]=E(b({},l[v][u]),{[d.user.userId]:d}),s[d.user.userId]=d.user}))}),this.userById$.next(b(b({},this.userById$.value),s)),this.usersByOrganizationIdAndDocumentId$.next(l)}catch(o){this.loggingService.catch("Error in ContactService updateUserDocumentContacts: ",o)}}getUserDocumentContacts$(){return this.getContactListScopeForOrganizationUsers$().pipe(fe(()=>this.checkContactListScopeForOrganizationUsers([ar.ALL,ar.DOCUMENT])?this.userDocumentContacts$.asObservable():ce([])))}getUserDocumentContacts(){return this.checkContactListScopeForOrganizationUsers([ar.ALL,ar.DOCUMENT])?this.userDocumentContacts$.value:[]}setCurrentOrganizationUserIAM(e){try{this.currentOrganizationUserIAM$.next(JSON.parse(JSON.stringify(e)))}catch(t){this.loggingService.catch("Error in ContactService setCurrentOrganizationUserIAM: ",t)}}getCurrentOrganizationUserIAM$(){return this.currentOrganizationUserIAM$.asObservable().pipe(xt(Qt))}getCurrentOrganizationUserIAM(){return this.currentOrganizationUserIAM$.value}mergeOrganizationAndDocumentContacts(){try{this.mergeContactsDebounceTimer&&clearTimeout(this.mergeContactsDebounceTimer),this.mergeContactsDebounceTimer=setTimeout(()=>{this.executeMergeContacts()},200)}catch(e){this.loggingService.catch("Error in ContactService mergeOrganizationAndDocumentContacts: ",e)}}executeMergeContacts(){try{let e=this.getContactListScopeForOrganizationUsers(),t=[];e.includes(ar.ALL)?t=[...this.getUserOrganizationContacts(),...this.getUserFolderContacts(),...this.getUserDocumentContacts()]:e.includes(ar.ORGANIZATION)?t=[...this.getUserOrganizationContacts()]:e.includes(ar.FOLDER)?t=[...this.getUserFolderContacts()]:e.includes(ar.DOCUMENT)&&(t=[...this.getUserDocumentContacts()]);let o=[...new Map(t.filter(a=>a?.userId).map(a=>[a.userId,a])).values()];this.internalUserContacts$.next(o)}catch(e){this.loggingService.catch("Error in ContactService mergeOrganizationAndDocumentContacts: ",e)}}getOrganizationGroupsFromDb$(){try{this.getOrganizationGroupsSubscription||(this.getOrganizationGroupsSubscription=this.authService.getUser$().pipe(fe(e=>e?.organizationId?ce(e).pipe(fe(t=>this.docService.getOrganizationConfig$().pipe(je(o=>!!o),ge(()=>t))),fe(t=>{if(this.setUserOrganizationGroups([]),!t)return ce();let o=this.docService.getOrganizationConfig()?.organizationId;return o?this.commonDbService.dbListener({feature:"allOrganizationGroups",properties:{organizationId:o,isCollection:!0}}).pipe(ge(a=>a?.data),ge(a=>{a?(typeof a=="object"&&(a?.undefined&&delete a.undefined,a?.null&&delete a.null),this.setUserOrganizationGroups(Object.values(a??{}))):this.setUserOrganizationGroups([])})):ce()})):(this.setUserOrganizationGroups([]),ce()))).subscribe(()=>{},e=>{this.loggingService.catch("Error in ContactService getOrganizationGroupsFromDb$ subscription: ",e)}))}catch{}}setUserOrganizationGroups(e){try{this.userOrganizationGroups$.next(e)}catch(t){this.loggingService.catch("Error in ContactService setUserOrganizationGroups: ",t)}}onContactSelected(e){try{if(e?.userId){let t=!!this.getUserDocumentContacts().find(a=>a.userId===e.userId),o=!!this.getUserOrganizationContacts().find(a=>a.userId===e.userId);switch(this.documentAccessType){case Ui.RESTRICTED:if(!t){let a={contact:e,isOrganizationContact:o,isDocumentContact:t,documentAccessType:this.documentAccessType};this.onContactSelectedSubject$.next(a)}break}}else{let t={contact:e,isOrganizationContact:!1,isDocumentContact:!1,documentAccessType:this.documentAccessType};this.onContactSelectedSubject$.next(t)}}catch(t){this.loggingService.catch("Error in ContactService onContactSelected: ",t)}}onContactSelected$(){return this.onContactSelectedSubject$.asObservable()}getOrganizationGroups$(){return this.getContactListScopeForOrganizationUsers$().pipe(fe(()=>this.checkContactListScopeForOrganizationUsers([ar.ALL,ar.ORGANIZATION_USER_GROUP])?this.userOrganizationGroups$.asObservable():ce([])))}enableAtHere(){try{if(this.analyticsService.setFeatureConfig({feature:Be.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:Be.COMMENT,config:{atHereLabel:e}}),e&&this.atHereLabel$.next(e)}catch(t){this.loggingService.catch("Error in ContactService setAtHereLabel: ",t)}}setAtHereDescription(e){try{this.analyticsService.setFeatureConfig({feature:Be.COMMENT,config:{atHereDescription:e}}),e&&this.atHereDescription$.next(e)}catch(t){this.loggingService.catch("Error in ContactService setAtHereDescription: ",t)}}disableAtHere(){try{if(this.analyticsService.setFeatureConfig({feature:Be.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(fe(()=>this.checkContactListScopeForOrganizationUsers([ar.ALL,ar.DOCUMENT])?this.atHereEnabled$.asObservable():ce(!1)))}getAtHereEnabled(){return this.checkContactListScopeForOrganizationUsers([ar.ALL,ar.DOCUMENT])?this.atHereEnabled$.value:!1}updateContactListScopeForOrganizationUsers(e){try{this.contactListScopeForOrganizationUsers$.next(e)}catch(t){this.loggingService.catch("Error in ContactService updateContactListScopeForOrganizationUsers: ",t)}}getContactListScopeForOrganizationUsers$(){return this.contactListScopeForOrganizationUsers$.asObservable()}getContactListScopeForOrganizationUsers(){return this.contactListScopeForOrganizationUsers$.value}checkContactListScopeForOrganizationUsers(e){return this.getContactListScopeForOrganizationUsers().some(t=>e.includes(t))}updateContactList(e,t){return X(this,null,function*(){try{this.analyticsService.trackEvent(Y.Events.Contact.UPDATE_CONTACT_LIST_TRIGGERED,{contactsCount:e?.length,config:t}),this.usersService.setUserByIds(e),this.customUserContacts$.next(e),this.customUserContactsConfig$.next(t)}catch(o){this.loggingService.catch("Error in CommentService updateContactList: ",o)}})}convert(e){try{if(e?.options){let{documentId:t,organizationId:o}=this.docService.getServerId(e?.options);e.options=E(b({},e?.options),{documentId:t,organizationId:o})}return this}catch(t){return this.loggingService.catch("Error in ContactService convert: ",t),this}}getContactList$(){try{return this.authService.getUser$().pipe(fe(e=>e?un([this.userOrganizationContacts$.asObservable(),this.userFolderContacts$.asObservable(),this.userDocumentContacts$.asObservable(),this.userOrganizationGroups$.asObservable(),this.customUserContacts$.asObservable()]).pipe(ge(([t,o,a,l,s])=>{let d={};d.organizationUsers=t?.map(u=>this.convertToClientUser(u)),d.folderUsers=o?.map(u=>this.convertToClientUser(u)),d.documentUsers=a?.map(u=>this.convertToClientUser(u)),d.updatedContactList=s?.map(u=>this.convertToClientUser(u));let v=[];return l?.forEach(u=>{let S=this.convertToClientUserGroup(u,d.organizationUsers||[]);S&&v.push(S)}),d.userGroups=v,d}),xt(Qt)):ce(null)),Hn(e=>(this.loggingService.catch("Error in ContactService getContactList$: ",e),ce(null))))}catch(e){return this.loggingService.catch("Error in ContactService getContactList$: ",e),ce(null)}}convertToClientUserGroup(e,t){try{let o={groupId:e?.metadata?.clientGroupId,groupName:e?.metadata?.groupName,users:[]},a={};return t?.forEach(l=>{if(l?.userId){let s=Et(l.userId);a[s]=l}}),Object.keys(e?.users??{}).forEach(l=>{a[l]&&o.users?.push(a[l])}),o}catch(o){return this.loggingService.catch("Error in ContactService convertToClientUserGroup: ",o),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(t){return this.loggingService.catch("Error in ContactService convertToClientUser: ",t),e}}getCustomUserContacts(){return this.customUserContacts$.value}getCustomUserContacts$(){return this.customUserContacts$.asObservable()}getCustomUserContactsConfig(){return this.customUserContactsConfig$.value}getCustomUserContactsConfig$(){return this.customUserContactsConfig$.asObservable()}};r.\u0275fac=function(t){return new(t||r)(J(rt),J(Ge),J(Lt),J(pi),J(On),J(lt),J(x),J(xn),J(Dn))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var xue=n=>{try{let r={USE_PROFILES:{svg:!0,svgFilters:!0},FORBID_ATTR:["onerror","onload","onclick","onmouseover","onmouseout","onmouseenter","onmouseleave","onmousemove","onmousedown","onmouseup","onwheel","onscroll","onkeydown","onkeyup","onkeypress","onfocus","onblur","onchange","onsubmit","on*"],FORBID_TAGS:["script","style","iframe","object","embed","form"]};return sk.sanitize(n,r)}catch(r){return tt.catch("Error in File utils sanitizeSvg: ",r),""}},Iue=n=>{try{return n.name.split(".").slice(0,-1).join(".")}catch(r){tt.catch("Error in File utils getFileName: ",r);return}},_Y=n=>{try{return/(?:\.([^.]+))?$/.exec(n?.name)[1]}catch(r){tt.catch("Error in File utils getFileExtension: ",r);return}},Eue=(n,r)=>{try{let i=n.slice(0,-1,n.type);return new File([i],r+"."+_Y(n),{type:n.type})}catch(i){tt.catch("Error in File utils updateFile: ",i);return}};var bY={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 Tu=(()=>{let r=class r{constructor(e,t,o,a,l){this.authService=e,this.configService=t,this.coreActionsService=o,this.loggingService=a,this.attachmentResolverService=l,this.storage=V2();try{this.configService.getApiKey$().subscribe(s=>{this.apiKey=s}),this.authService.getFirebaseConfig$().subscribe(s=>{s&&s.firebaseOptions?.storageBucket&&(this.storage=V2(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:t}){try{let o=new J1;o.name=t.name;let a=Eue(t,`${o.attachmentId}_${Iue(t)}`),l=`${this.apiKey}/${e}/${a?.name}`;return o.bucketPath=l,o.size=t.size,o.type=_Y(t),o?.type&&(o.mimeType=bY[o?.type]),o}catch(o){return this.loggingService.catch("Error in StorageService createAttachment: ",o),null}}sanitizeSvgFile(e){return X(this,null,function*(){if(e.type===bY.svg)try{let t=yield e.text(),o=xue(t);return new File([o],e.name,{type:e.type})}catch(t){return this.loggingService.catch("Error in StorageService sanitizeSvgFile: ",t),e}return e})}uploadAttachmentToStorage(l){return X(this,arguments,function*({attachment:e,file:t,resolve:o,reject:a}){try{let s=j2(this.storage,e.bucketPath),d=nz(s,t,{cacheControl:"public,max-age=3600"});d.on("state_changed",v=>{let u=v.bytesTransferred/v.totalBytes*100},v=>{a(v)},()=>{tz(d.snapshot.ref).then(v=>{e.url=v,o(e)})})}catch(s){this.loggingService.catch("Error in StorageService uploadAttachmentToStorage: ",s),a(s)}})}uploadToResolver(s){return X(this,arguments,function*({file:e,attachment:t,metadata:o,resolve:a,reject:l}){try{o.attachmentId=t.attachmentId;let d={attachmentId:t.attachmentId,name:t.name,file:e,metadata:o,mimeType:t.mimeType},v=St();this.coreActionsService.triggerAction(ut.ATTACHMENT_RESOLVER,{event:Y.Events.Resolver.ATTACHMENT_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:v,methodName:Ws.UPLOAD_TO_RESOLVER,source:"internal",payload:{attachment:d,eventType:Uo.ATTACHMENT_ADD}});let u=yield this.attachmentResolverService.saveAttachment({attachment:d,eventType:Uo.ATTACHMENT_ADD},v);u&&u.data?.url?(t.url=u.data?.url,a(t)):l(new Error("Failed to upload attachment to resolver"))}catch(d){this.loggingService.catch("Error in StorageService uploadToResolver: ",d),l(d)}})}uploadFile({path:e,file:t,useAttachmentResolver:o,metadata:a}){return new Promise((l,s)=>X(this,null,function*(){try{if(!this.apiKey)throw new Error("API key not configured");let d=yield this.sanitizeSvgFile(t),v=this.createAttachment({path:e,file:d});if(!v)throw new Error("Attachment not created");o?this.uploadToResolver({file:d,attachment:v,metadata:a,resolve:l,reject:s}):this.uploadAttachmentToStorage({attachment:v,file:d,resolve:l,reject:s})}catch(d){this.loggingService.catch("Error in StorageService uploadFile:",d),s(d)}}))}uploadChunk(e,t,o){return new Promise((a,l)=>{try{if(this.apiKey){let s=`${this.apiKey}/${e}/${t.name}`,d=j2(this.storage,s),v=nz(d,t,{cacheControl:"public,max-age=3600"});v.on("state_changed",u=>{let S=u.bytesTransferred/u.totalBytes*100},u=>{l(u)},()=>{tz(v.snapshot.ref).then(u=>{a(u)}).catch(u=>{this.loggingService.catch(`[uploadChunk] Error getting download URL for chunk ${o}:`,u),l(u)})})}else{let s=new Error("API key not available");this.loggingService.catch("[uploadChunk] API key not available",s),l(s)}}catch(s){this.loggingService.catch(`[uploadChunk] Error in StorageService uploadChunk for chunk ${o}: `,s),l(s)}})}downloadAttachment(e){try{if(e.url){let t=new XMLHttpRequest;t.responseType="blob",t.onload=()=>{let o=t.response,a=document.createElement("a"),l=window.URL.createObjectURL(o);a.setAttribute("type","hidden"),a.setAttribute(V.ATTRIBUTES.VELT_DOWNLOAD_BUTTON,"true"),a.classList.add("snippyly-overlay-panel"),a.href=l,e?.name&&(a.download=e?.name),document.body.appendChild(a);let s=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!1});a.dispatchEvent(s),window.URL.revokeObjectURL(l),a.remove()},t.onerror=()=>{window.open(e.url,"_blank")},t.open("GET",e.url),t.send()}}catch(t){this.loggingService.catch("Error in StorageService downloadAttachment: ",t)}}deleteAttachment({attachment:e,metadata:t,useAttachmentResolver:o}){return new Promise((a,l)=>{if(o){let s=St();this.coreActionsService.triggerAction(ut.ATTACHMENT_RESOLVER,{event:Y.Events.Resolver.ATTACHMENT_DELETE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:s,methodName:Ws.DELETE_ATTACHMENT,source:"internal",payload:{attachmentId:e.attachmentId,metadata:t}}),this.attachmentResolverService.deleteAttachment({attachmentId:e.attachmentId,metadata:t},s).then(()=>{a(null)}).catch(d=>{l(d)})}else{let s=j2(this.storage,e.bucketPath);ez(s).then(()=>{a(null)}).catch(d=>{a(null)})}})}deleteFileFromPath(e){return new Promise((t,o)=>{let a=j2(this.storage,e);ez(a).then(()=>{t(null)}).catch(l=>{o(l)})})}};r.\u0275fac=function(t){return new(t||r)(J(Ge),J(Lt),J(pi),J(x),J(Eu))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var An=(()=>{let r=class r{constructor(e,t,o,a,l,s,d,v){this.analyticsService=e,this.authService=t,this.contactService=o,this.databaseService=a,this.docService=l,this.configService=s,this.loggingService=d,this.commonDbService=v,this.documentIAM$=new be(null),this.workspaceIAM$=new be(null),this.roles$=new be([]),this.getDocumentIamSubscription=null,this.getOrganizationIamSubscription=null,this.getWorkspaceIamSubscription=null;try{this.authService.setIamService(this),this.databaseService.getDb().pipe(je(u=>!!u),st(1)).subscribe(u=>{u&&(this.getUser(),this.getDocumentPaths())},u=>{this.loggingService.catch("Error in CommentService getDb subscription: ",u)}),this.getRole$().pipe(st(1)).subscribe(u=>{this.authService?.getUser()&&!u&&this.analyticsService.trackEvent(Y.Events.Iam.USER_ACCESS_DENIED)}),this.documentIAM$.subscribe(u=>{u?.accessType&&this.contactService.setDocumentAccessType(u.accessType)})}catch(u){this.loggingService.catch("Error in IamService constructor: ",u)}}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(je(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(je(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 t=e||new sR;this.documentIAM$.next(t)},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(Hn(e=>ce(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(ge(e=>!!e),xt())}getDocumentIAM$(){return this.documentIAM$.asObservable()}getRoles$(){return this.roles$.asObservable().pipe(ge(e=>e?.length?e:V.WorkspaceRoles))}getFeaturesAccessLevel$(){return this.documentIAM$.asObservable().pipe(ge(e=>e?.features),fe(e=>this.getRole$().pipe(ge(t=>(t===Er.ADMIN&&(e=e&&JSON.parse(JSON.stringify(e||{})),e?.all?.disabled&&(e.all.disabled=!1)),e)))))}hasRole(e){try{return e===this.getRole()}catch(t){return this.loggingService.catch("Error in IamService hasRole: ",t),!1}}hasRoleAny(e=[]){try{return e?.includes(this.getRole()||"")}catch(t){return this.loggingService.catch("Error in IamService hasRoleAny: ",t),!1}}hasRole$(e){try{return this.authService.getUser$().pipe(fe(()=>this.documentIAM$.pipe(je(t=>!!t),fe(()=>this.workspaceIAM$.pipe(ge(()=>e===this.getRole()))))))}catch(t){return this.loggingService.catch("Error in IamService hasRole$: ",t),ce(!1)}}getRole$(){try{return this.authService.getUser$().pipe(fe(()=>this.configService.getSF$()),fe(()=>this.configService.getSF()?this.contactService.isUserGlobalContact$():ce(null)),fe(()=>this.configService.getSF()?this.documentIAM$.pipe(je(e=>!!e),xt(Qt)):ce(null)),fe(()=>this.workspaceIAM$.pipe(xt(Qt))),ge(()=>this.getRole()))}catch(e){return this.loggingService.catch("Error in IamService getRole$: ",e),ce(null)}}getRole(){try{let e=this.configService.getSF();if(e&&this.contactService.isUserGlobalContact())return Er.ADMIN;if(!e)return this.user?.isAdmin?Er.ADMIN:Er.COMMENTER;let t=null,o;if(this.user)switch((this.documentIAM$.value?this.documentIAM$.value?.features?.all?.restricted:!1)?Ui.RESTRICTED:this.documentIAM$.value?this.documentIAM$.value?.documentAccessType||Ui.PUBLIC:null){case Ui.PUBLIC:o=this.getUserFromDocumentIAM(this.user?.email,this.user?.userId),o||(o=this.getUserFromWorkspaceIAM(this.user?.email,this.user?.userId)),t=o?.role?.name||Er.COMMENTER;break;case Ui.RESTRICTED:o=this.getUserFromDocumentIAM(this.user?.email,this.user?.userId),o||(o=this.getUserFromWorkspaceIAM(this.user?.email,this.user?.userId)),t=o?.role?.name||null;break;default:break}return t}catch(e){this.loggingService.catch("Error in IamService getRole: ",e)}return null}isUserAdmin$(){return this.getRole$().pipe(ge(e=>e===Er.ADMIN),xt())}isUserAdmin(){try{return this.getRole()===Er.ADMIN}catch(e){return this.loggingService.catch("Error in IamService isUserAdmin: ",e),!1}}getUserFromDocumentIAM(e,t){try{if(e||t){let o;return e&&(o=this.documentIAM$.value?.users?.[Et(e)]),!o&&t&&(o=this.documentIAM$.value?.users?.[Et(t)]),o}else return}catch(o){this.loggingService.catch("Error in IamService getUserFromDocumentIAM: ",o)}}getUserFromWorkspaceIAM(e,t){try{if(e||t){let o;return e&&(o=this.workspaceIAM$.value?.users?.[Et(e)]),!o&&t&&(o=this.workspaceIAM$.value?.users?.[Et(t)]),o}else return}catch(o){this.loggingService.catch("Error in IamService getUserFromWorkspaceIAM: ",o)}}};r.\u0275fac=function(t){return new(t||r)(J(rt),J(Ge),J(ln),J(On),J(lt),J(Lt),J(x),J(xn))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var bl=(()=>{let r=class r{constructor(e,t,o,a,l,s,d,v,u,S){this.authService=e,this.docService=t,this.loggingService=o,this.commonDbService=a,this.usersService=l,this.commentUtilsService=s,this.coreActionsService=d,this.functions=v,this.configService=u,this.contactService=S,this.currentUserPermissions$=new be(null),this.permissionsCache$=new be(null),this.permissionProvider$=new be(null);try{this.docService.setUserPermissionService(this),this.authService.setUserPermissionService(this),this.commentUtilsService.setUserPermissionService(this),this.contactService.setUserPermissionService(this)}catch(k){this.loggingService.catch("Error in UserPermissionService constructor:",k)}}hasUserContextAccess({userId:e,accessFields:t}){try{if(!this.getIsContextEnabled()||t.includes(V.DEFAULT_VELT_CONTEXT))return!0;let o=this.contactService.getUserAccessFieldsByUserId(e);return o?t.every(a=>o.includes(a)):!0}catch(o){return this.loggingService.catch("Error in UserPermissionService hasUserContextAccess:",o),!1}}organizationDetails(e){return X(this,null,function*(){try{let t=yield this.commonDbService?.getData({feature:"organizationMetadata",properties:{organizationId:e}});return t&&t?.errorCode?{errorCode:qr.PERMISSION_DENIED,error:!0}:t&&!t?.metadata?{errorCode:qr.DOES_NOT_EXIST,error:!0}:{error:!1}}catch(t){return this.loggingService.catch("Error in UserPermissionService organizationDetails:",t),{errorCode:qr.SOMETHING_WENT_WRONG,error:!0}}})}documentDetails(o){return X(this,arguments,function*({documentId:e,organizationId:t}){try{let a=yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:e,organizationId:t}});if(a&&a?.errorCode)return{errorCode:qr.PERMISSION_DENIED,error:!0};if(a&&!a?.metadata)return{errorCode:qr.DOES_NOT_EXIST,error:!0};let l=this.docService.getDocumentMetadata(e)??{};return this.docService.setDocumentMetadata(e,b(b({},l),a?.metadata??{})),{error:!1}}catch(a){return this.loggingService.catch("Error in UserPermissionService documentDetails:",a),{errorCode:qr.SOMETHING_WENT_WRONG,error:!0}}})}folderDetails(o){return X(this,arguments,function*({folderId:e,organizationId:t}){try{let a=yield this.commonDbService?.getData({feature:"folderMetadata",properties:{folderId:e,organizationId:t}});return a&&a?.errorCode?{errorCode:qr.PERMISSION_DENIED,error:!0}:a&&!a?.metadata?{errorCode:qr.DOES_NOT_EXIST,error:!0}:{error:!1}}catch(a){return this.loggingService.catch("Error in UserPermissionService folderDetails:",a),{errorCode:qr.SOMETHING_WENT_WRONG,error:!0}}})}getUserPermissions(e){return X(this,null,function*(){try{if(!this.authService.getUser())return this.loggingService.catch("User not set. [source: getUserPermissions]",void 0,void 0,!0),{};let t=this.extractResourceIds(e);if(!t.clientOrganizationId||!t.organizationId)return this.loggingService.catch("Client organization id or organization id not set during getUserPermissions",void 0,void 0,!0),{};let o=yield this.validateResources(t),[a,l]=yield this.fetchUserPermissionsFromDB(t),s=this.buildPermissionsResponse(t,o,a,l);return!e&&Object.keys(s).length>0&&this.setCurrentUserPermissions(s),s}catch(t){return this.loggingService.catch("Error in UserPermissionService getUserPermissions:",t),{}}})}extractResourceIds(e){let t=this.docService.getDocumentPaths(),o=this.docService.getDocumentIds();return{folderIds:e?.folderIds?.length?e.folderIds:t?.folderId?[t.folderId]:[],documentIds:e?.documentIds?.length?e.documentIds:o.map(a=>a.clientDocumentId),clientOrganizationId:e?.organizationId??t?.clientOrganizationId,organizationId:e?.organizationId??t?.clientOrganizationId?Xa(e?.organizationId??t?.clientOrganizationId??""):void 0}}validateResources(e){return X(this,null,function*(){let{folderIds:t,documentIds:o,organizationId:a,clientOrganizationId:l}=e,s=[],d=[];a&&(s.push(this.organizationDetails(a)),d.push({id:l??"",type:"organization"})),t.forEach(u=>{s.push(this.folderDetails({folderId:Mi(u),organizationId:a??""})),d.push({id:u,type:"folder"})}),o.forEach(u=>{s.push(this.documentDetails({documentId:Bo(u),organizationId:a??""})),d.push({id:u,type:"document"})});let v=yield Promise.allSettled(s);return this.processValidationResults(v,d)})}processValidationResults(e,t){let o=[],a=[],l,s=e.map((d,v)=>({result:d,metadata:t[v]})).filter(({result:d})=>d.status==="rejected"||d.status==="fulfilled"&&d.value.error);for(let{result:d,metadata:v}of s){let u=d.status==="fulfilled"?d.value.errorCode??qr.SOMETHING_WENT_WRONG:qr.SOMETHING_WENT_WRONG,S={id:v.id,errorCode:u};switch(v.type){case"organization":if(l=S,u===qr.DOES_NOT_EXIST)throw new Error(`Organization with id '${v.id}' does not exist`);break;case"folder":o.push(S);break;case"document":a.push(S);break}}return{failedFolderIds:o,failedDocumentIds:a,failedOrganizationId:l}}fetchUserPermissionsFromDB(e){return X(this,null,function*(){let{folderIds:t,documentIds:o,organizationId:a}=e,l=[this.authService.getUser()?.userId??""],s=[...t.map(u=>Mi(u)),...o.map(u=>Bo(u)),a??""],[d,v]=yield Promise.allSettled([this.usersService.getUsersFromDBWithBatching({userIds:l,organizationId:a}),this.usersService.getTemporaryUsersFromDBWithBatching({userIds:l,organizationId:a,resourceIds:s})]);return[d.status==="fulfilled"?d.value:[],v.status==="fulfilled"?v.value:[]]})}buildPermissionsResponse(e,t,o,a){let{folderIds:l,documentIds:s,clientOrganizationId:d,organizationId:v}=e,{failedFolderIds:u,failedDocumentIds:S,failedOrganizationId:k}=t,A={};return this.processRegularUserPermissions(A,o,l,s,d??"",v??"",u,S,k),this.processTemporaryUserPermissions(A,a),this.processContextPermissions(A),A}processContextPermissions(e){try{let t=this.authService.getUser()?.userId;if(t){let o=this.contactService.getUserAccessFieldsByUserId(t);o?.length&&(e[t]||(e[t]={}),e[t].context={accessFields:o})}}catch(t){this.loggingService.catch("Error in UserPermissionService processContextPermissions:",t);return}}processRegularUserPermissions(e,t,o,a,l,s,d,v,u){for(let S of t)for(let k of S)k?.user?.userId&&(e[k.user.userId]=E(b({},o.length&&{folders:this.buildFolderPermissions(o,k,d)}),{documents:this.buildDocumentPermissions(a,k,v),organization:{[l]:this.buildOrganizationPermission(s,k,u)}}))}getErrorMessage(e,t){try{switch(this.loggingService.log(`Error in UserPermissionService getErrorMessage: ${e} ${t}`),e){case qr.DOES_NOT_EXIST:return`${t} does not exist`;case qr.PERMISSION_DENIED:return`User does not have access to ${t}`;case qr.SOMETHING_WENT_WRONG:return"Something went wrong";default:return"Something went wrong"}}catch(o){return this.loggingService.catch("Error in UserPermissionService getErrorMessage:",o),"Something went wrong"}}buildFolderPermissions(e,t,o){return e.reduce((a,l)=>{let s=o.find(d=>d.id===l);return s?a[l]={error:this.getErrorMessage(s.errorCode,"folder"),errorCode:s.errorCode}:a[l]={accessRole:t.viewerFolderIds?.includes(Mi(l))?gs.VIEWER:gs.EDITOR},a},{})}buildDocumentPermissions(e,t,o){return e.reduce((a,l)=>{let s=o.find(d=>d.id===l);return s?a[l]={error:this.getErrorMessage(s.errorCode,"document"),errorCode:s.errorCode}:a[l]={accessRole:t.viewerDocumentIds?.includes(Bo(l))?gs.VIEWER:gs.EDITOR},a},{})}buildOrganizationPermission(e,t,o){return o?{error:this.getErrorMessage(o.errorCode,"organization"),errorCode:o.errorCode}:{accessRole:t.viewerOrganizationIds?.includes(e)?gs.VIEWER:gs.EDITOR}}processTemporaryUserPermissions(e,t){for(let o of t)if(o?.userId)switch(this.ensureUserPermissionStructure(e,o.userId),o.type){case"folder":this.addTemporaryFolderPermission(e,o);break;case"document":this.addTemporaryDocumentPermission(e,o);break;case"organization":this.addTemporaryOrganizationPermission(e,o);break}}ensureUserPermissionStructure(e,t){e[t]||(e[t]={})}addTemporaryFolderPermission(e,t){let{userId:o,resourceId:a,role:l,expiresAt:s}=t;e[o].folders||(e[o].folders={}),e[o].folders[a]||(e[o].folders[a]={accessRole:l??gs.EDITOR,expiresAt:s})}addTemporaryDocumentPermission(e,t){let{userId:o,resourceId:a,role:l,expiresAt:s}=t;e[o].documents||(e[o].documents={}),e[o].documents[a]={accessRole:l??gs.EDITOR,expiresAt:s}}addTemporaryOrganizationPermission(e,t){let{userId:o,resourceId:a,role:l,expiresAt:s}=t;e[o].organization||(e[o].organization={}),e[o].organization[a]={accessRole:l??gs.EDITOR,expiresAt:s}}hasEditAccess({organizationId:e,folderId:t,documentId:o}){try{let a=!0,l=this.getCurrentUserPermissionsWithServerIds(),s=this.authService.getUser()?.userId??"";return l&&(e&&typeof e=="string"&&l?.[s]?.organization?.[e]&&(l?.[s]?.organization?.[e]?.accessRole===gs.VIEWER||l?.[s]?.organization?.[e]?.errorCode===qr.PERMISSION_DENIED)&&(a=!1),t&&typeof t=="string"&&l?.[s]?.folders?.[t]&&(l?.[s]?.folders?.[t]?.accessRole===gs.VIEWER||l?.[s]?.folders?.[t]?.errorCode===qr.PERMISSION_DENIED)&&(a=!1),o&&typeof o=="string"&&l?.[s]?.documents?.[o]&&(l?.[s]?.documents?.[o]?.accessRole===gs.VIEWER||l?.[s]?.documents?.[o]?.errorCode===qr.PERMISSION_DENIED)&&(a=!1)),a}catch{return!0}}getCurrentUserPermissions$(){return this.currentUserPermissions$.asObservable().pipe(xt(Qt))}getCurrentUserPermissions(){return this.currentUserPermissions$.value}refactorPermissionsWithServerIds(e){try{let t=JSON.parse(JSON.stringify(e??{})),o=this.authService.getUser()?.userId??"";if(t?.[o]){let a=this.docService.getDocumentPaths()?.clientOrganizationId??"";if(t?.[o]?.organization?.[a]){let l=Xa(a);t[o].organization&&(t[o].organization[l]=t[o].organization[a],delete t[o].organization[a])}t?.[o]?.folders&&(t[o].folders=Object.fromEntries(Object.entries(t?.[o]?.folders??{}).map(([l,s])=>[Mi(l),s]))),t?.[o]?.documents&&(t[o].documents=Object.fromEntries(Object.entries(t?.[o]?.documents??{}).map(([l,s])=>[Bo(l),s])))}return t}catch(t){return this.loggingService.catch("Error in UsersPermissionService refactorPermissionsWithServerIds:",t),e}}getCurrentUserPermissionsWithServerIds$(){return this.currentUserPermissions$.asObservable().pipe(ge(e=>this.refactorPermissionsWithServerIds(e)),xt(Qt))}getCurrentUserPermissionsWithServerIds(){return this.refactorPermissionsWithServerIds(this.currentUserPermissions$.value)}setCurrentUserPermissions(e){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setCurrentUserPermissions","color: green;");let t=null;e&&(t=JSON.parse(JSON.stringify(e))),this.currentUserPermissions$.next(t)}catch(t){this.loggingService.catch("Error in UsersPermissionService setCurrentUserPermissions:",t)}}getIsContextEnabled(){return this.loggingService.log("%c[WB] Calling FUNCTION: getIsContextEnabled","color: green;"),this.permissionProvider$.value?.isContextEnabled??!1}setPermissionProvider(e){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setPermissionProvider","color: green;"),this.permissionProvider$.next(e)}catch(t){this.loggingService.catch("Error in UsersPermissionService setPermissionProvider:",t)}}get isRevokeAccessOnDocumentUnsetEnabled(){return this.permissionProvider$.value?.revokeAccessOn?.some(e=>e.type===t_.DOCUMENT_UNSET)??!1}get isRevokeAccessOnUserLogoutEnabled(){return this.permissionProvider$.value?.revokeAccessOn?.some(e=>e.type===t_.USER_LOGOUT)??!1}get isRevokeOrganizationAccessOnUserLogoutEnabled(){return this.permissionProvider$.value?.revokeAccessOn?.some(e=>e.type===t_.USER_LOGOUT&&e.revokeOrganizationAccess)??!1}get isRevokeOrganizationAccessOnDocumentUnsetEnabled(){return this.permissionProvider$.value?.revokeAccessOn?.some(e=>e.type===t_.DOCUMENT_UNSET&&e.revokeOrganizationAccess)??!1}getPermissionProviderRetryConfig(){return this.permissionProvider$.value?.retryConfig??{retryCount:0,retryDelay:0}}revokeAccessOnUserLogout(){return X(this,null,function*(){let e=St();try{if(this.isRevokeAccessOnUserLogoutEnabled){let t=[],o=this.authService.getUser()?.userId??"";if((this.getPermissionsCache()??[]).forEach(l=>{l.userId===o&&l.hasAccess&&(l.type===Wr.ORGANIZATION?this.isRevokeOrganizationAccessOnUserLogoutEnabled&&t.push(E(b({},l),{hasAccess:!1})):t.push(E(b({},l),{hasAccess:!1})))}),t.length>0){this.coreActionsService.triggerAction(ut.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_USER_LOGOUT_FORMED,timestamp:new Date().getTime(),uniqueId:e,methodName:tr.REVOKE_ACCESS_ON_USER_LOGOUT,source:"internal",payload:{requests:t}}),this.setPermissionsCache([]),this.coreActionsService.triggerAction(ut.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_USER_LOGOUT_TRIGGERED,timestamp:new Date().getTime(),uniqueId:e,methodName:tr.REVOKE_ACCESS_ON_USER_LOGOUT,source:"internal",payload:{requests:t}});let l=yield this.revokeAccess({requests:t,userId:this.authService.getUser()?.userId??""});l.success?this.coreActionsService.triggerAction(ut.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_USER_LOGOUT_RESULT,timestamp:new Date().getTime(),uniqueId:e,methodName:tr.REVOKE_ACCESS_ON_USER_LOGOUT,source:"internal",payload:{result:{data:l,success:!0,statusCode:200}}}):this.coreActionsService.triggerAction(ut.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_USER_LOGOUT_ERROR,timestamp:new Date().getTime(),uniqueId:e,methodName:tr.REVOKE_ACCESS_ON_USER_LOGOUT,source:"internal",payload:{result:{data:l,success:!1,statusCode:500}}})}}}catch(t){this.coreActionsService.triggerAction(ut.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_USER_LOGOUT_ERROR,timestamp:new Date().getTime(),uniqueId:e,methodName:tr.REVOKE_ACCESS_ON_USER_LOGOUT,source:"internal",payload:{error:t}}),this.loggingService.catch("Error in UsersPermissionService revokeAccessOnUserLogout:",t)}})}revokeAccessOnDocumentUnset(o){return X(this,arguments,function*({documentIds:e,folderId:t}){let a=St();try{if(this.isRevokeAccessOnDocumentUnsetEnabled){let l=[],s=this.docService.getOrganizationConfig()?.clientOrganizationId??"",d=this.authService.getUser()?.userId??"",v=this.getPermissionsCache()??[];if(e.forEach(u=>{v.find(S=>S.resourceId===u.clientDocumentId&&S.type===Wr.DOCUMENT&&S.organizationId===s&&S.userId===d)&&(l.push({userId:d,resourceId:u.clientDocumentId,organizationId:s,type:Wr.DOCUMENT,hasAccess:!1}),v=v.filter(S=>!(S.resourceId===u.clientDocumentId&&S.type===Wr.DOCUMENT&&S.organizationId===s&&S.userId===d)))}),t&&v.find(u=>u.resourceId===t&&u.type===Wr.FOLDER&&u.organizationId===s&&u.userId===d)&&(l.push({userId:d,resourceId:t,organizationId:s,type:Wr.FOLDER,hasAccess:!1}),v=v.filter(u=>!(u.resourceId===t&&u.type===Wr.FOLDER&&u.organizationId===s&&u.userId===d))),s&&this.isRevokeOrganizationAccessOnDocumentUnsetEnabled&&v.find(u=>u.resourceId===s&&u.type===Wr.ORGANIZATION&&u.organizationId===s&&u.userId===d)&&(l.push({userId:d,resourceId:s,organizationId:s,type:Wr.ORGANIZATION,hasAccess:!1}),v=v.filter(u=>!(u.resourceId===s&&u.type===Wr.ORGANIZATION&&u.organizationId===s&&u.userId===d))),this.setPermissionsCache(v),l.length>0){this.coreActionsService.triggerAction(ut.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_FORMED,timestamp:new Date().getTime(),uniqueId:a,methodName:tr.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{requests:l}}),this.coreActionsService.triggerAction(ut.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_TRIGGERED,timestamp:new Date().getTime(),uniqueId:a,methodName:tr.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{requests:l}});let u=yield this.revokeAccess({requests:l,userId:d});u.success?this.coreActionsService.triggerAction(ut.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_RESULT,timestamp:new Date().getTime(),uniqueId:a,methodName:tr.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{result:{data:u,success:!0,statusCode:200}}}):this.coreActionsService.triggerAction(ut.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:tr.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{result:{data:u,success:!1,statusCode:500}}})}}}catch(l){this.coreActionsService.triggerAction(ut.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:tr.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{error:l}}),this.loggingService.catch("Error in UsersPermissionService revokeAccessOnDocumentUnset:",l)}})}getAccess(o){return X(this,arguments,function*({requests:e,userId:t}){let a=mr(this.functions,gr({url:wn?.cloudFunction?.sdkProxy,apiProxyDomain:this.configService?.getApiProxyDomain()}));return yield Cd({methodName:"getAccess",data:{type:"getAccess",data:e,metadata:{retryConfig:this.getPermissionProviderRetryConfig()}},getSdkProxy:a,userId:t})})}revokeAccess(o){return X(this,arguments,function*({requests:e,userId:t}){let a=mr(this.functions,gr({url:wn?.cloudFunction?.sdkProxy,apiProxyDomain:this.configService?.getApiProxyDomain()}));return yield Cd({methodName:"revokeAccess",data:{type:"revokeAccess",data:e,metadata:{retryConfig:this.getPermissionProviderRetryConfig()}},getSdkProxy:a,userId:t})})}onResourceAccessRequired(s){return X(this,arguments,function*({requests:e,uniqueId:t,methodName:o,userId:a,fromCache:l=!0}){try{if(!e?.length)return;let d=[],v=this.getPermissionsCache()??[];if(!this.forceRefreshPermissions()&&l&&(e.forEach(u=>{let S=v?.find(k=>k.resourceId===u.resource.id&&k.type===u.resource.type&&k.userId===u.userId&&k.organizationId===u.resource.organizationId);S&&d.push(S)}),d.length>0&&(e=e.filter(u=>!d.find(S=>S.resourceId===u.resource.id&&S.type===u.resource.type&&S.userId===u.userId&&S.organizationId===u.resource.organizationId)))),e.length>0){this.coreActionsService.triggerAction(ut.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.RESOURCE_ACCESS_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:t,methodName:o,source:"internal",payload:{requests:e,fromCache:l}});let u=yield this.getAccess({requests:e,userId:this.authService.getUser()?.userId??a??""});return this.coreActionsService.triggerAction(ut.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.RESOURCE_ACCESS_RESULT,timestamp:new Date().getTime(),uniqueId:t,methodName:o,source:"internal",payload:{result:u}}),u?.success&&u?.data?.length&&(this.setPermissionsCache([...v,...u.data]),u.data=[...d,...u.data]),u}else if(d.length>0)return this.coreActionsService.triggerAction(ut.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.RESOURCE_ACCESS_RESULT_FROM_CACHE,timestamp:new Date().getTime(),methodName:o,source:"internal",uniqueId:t,payload:{results:{data:d,success:!0,statusCode:200}}}),{data:d,success:!0,statusCode:200};return}catch(d){this.loggingService.catch("Error in UsersPermissionService onResourceAccessRequired:",d),this.coreActionsService.triggerAction(ut.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.RESOURCE_ACCESS_ERROR,timestamp:new Date().getTime(),methodName:o,source:"internal",uniqueId:t,payload:{error:d,requests:e,fromCache:l}});return}})}getPermissionsCache(){return this.forceRefreshPermissions()?[]:this.permissionsCache$.getValue()}forceRefreshPermissions(){return this.getPermissionProvider()?.forceRefresh??!1}setPermissionsCache(e){try{let t=new Map;e.forEach(a=>{let l=`${a.userId}_${a.resourceId}_${a.organizationId}_${a.type}`;t.set(l,a)});let o=JSON.parse(JSON.stringify(Array.from(t.values())));this.permissionsCache$.next(o)}catch(t){this.loggingService.catch("Error in UsersPermissionService setPermissionsCache:",t)}}isPermissionProviderAvailable(){try{return!!this.permissionProvider$.getValue()}catch(e){return this.loggingService.catch("Error in UsersPermissionService isPermissionProviderAvailable:",e),!1}}getPermissionProvider(){try{return this.permissionProvider$.getValue()}catch(e){return this.loggingService.catch("Error in UsersPermissionService getPermissionProvider:",e),null}}getPermissionProvider$(){return this.permissionProvider$.asObservable()}};r.\u0275fac=function(t){return new(t||r)(J(Ge),J(lt),J(x),J(xn),J(Dn),J(ku),J(pi),J(Lr),J(Lt),J(ln))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var hn=(()=>{let r=class r{constructor(e,t,o,a,l,s,d,v,u,S,k,A,P,U,W,te,ye,me){this.afAuth=e,this.analyticsService=t,this.authService=o,this.configService=a,this.commonDbService=l,this.commonDbUtilsService=s,this.commentUtilsService=d,this.commentAnnotationsResolverService=v,this.databaseService=u,this.docService=S,this.domService=k,this.iamService=A,this.loggingService=P,this.notificationUtilsService=U,this.usersService=W,this.functions=te,this.userPermissionService=ye,this.coreActionsService=me,this.db=Fl(),this.notificationsDb=Fl(void 0,wn.firebaseNotificationsDatabaseURL),this.documentPaths=null,this.notifications$=new be([]),this.rawNotificationsByIdMap$=new be(new Map),this.processedNotifications$=new be([]),this.userNotificationsFromServer$=new be(null),this.readNotificationsOnForYouTab$=new be(!1),this.currentDocumentOnly$=new be(!1),this.notificationViews$=new be({}),this.notificationsByIdMap$=new be(new Map),this.historyPanelVisible$=new be(!1),this.notificationsForYou$=new be(null),this.notificationsByDocumentIdMap$=new be(null),this.notificationsByDocumentIdSubscription={},this.allowedDocumentMetadataMap$=new be(null),this.maxNotificationDays$=new be(15),this.tabConfig$=new be({people:{enable:!1}}),this.settingsConfig$=new be(null),this.setSettingsConfigByOrganization$=new be(!1),this.muteAllNotifications$=new be(!1),this.enableSettings$=new be(!1),this.selfNotifications$=new be(!1),this.settingsInitialConfig$=new be([{name:"Inbox",id:"inbox",default:"ALL",enable:!0,values:[{name:"All",id:"ALL"},{name:"Only Involved",id:"MINE"},{name:"None",id:"NONE"}]},{name:"Email",id:"email",default:"MINE",enable:!0,values:[{name:"All",id:"ALL"},{name:"Only Involved",id:"MINE"},{name:"None",id:"NONE"}]}]),this.settingsConfigGeneration=0,this.notificationsPanelVisible$=new be(!1);try{this.subscribeNotificationsData().subscribe(),this.commentUtilsService.setNotificationService(this),this.databaseService.getDb().pipe(je(ke=>!!ke),st(1)).subscribe(ke=>{ke&&(this.db=ke,this.getDocumentIds(),this.subscribeGetNotificationsForYou())},ke=>{this.loggingService.catch("Error in NotificationService getDb subscription: ",ke)}),this.authService.getUser$().subscribe(ke=>{ke?(this.subscribeGetNotificationsForYou(),this.getDocumentIds(),this.subscribeToUserSettings()):(Object.keys(this.notificationsByDocumentIdSubscription).forEach(De=>{this.notificationsByDocumentIdSubscription[De]?.unsubscribe()}),this.notificationForYouSubscription?.unsubscribe(),this.documentIdsSubscription?.unsubscribe(),this.resetCacheData())}),this.docService.getLocationMetadata$().subscribe(ke=>{if(ke){let De=this.notificationsByDocumentIdMap$.getValue()?JSON.parse(JSON.stringify(this.notificationsByDocumentIdMap$.getValue())):null;Object.keys(ke||{}).forEach(Ie=>{let xe=De?.[Ie]?.notifications;xe?.length&&xe.forEach(Re=>{this.notificationUtilsService.mergeLocationWithNotification({notification:Re},ke)?.notification})}),this.notificationsByDocumentIdMap$.next(De)}})}catch(ke){this.loggingService.catch("Error in NotificationService constructor: ",ke)}}setDBConfigDataToInitialConfig(e){try{let t=JSON.parse(JSON.stringify(this.settingsConfig$.getValue()??{}));Object.entries(e||{}).forEach(([o,a])=>{t[o]=a}),this.settingsConfig$.next(t)}catch(t){this.loggingService.catch("Error in NotificationService setDBConfigDataToInitialConfig: ",t)}}getInitialConfigFromDB(e){return X(this,null,function*(){try{this.loggingService.log("%c[WB] Calling NotificationService FUNCTION: getInitialConfigFromDB","color: green;");let t=++this.settingsConfigGeneration,o=Et(this.authService.getUser()?.userId??""),a=yield this.commonDbService.getData({feature:"userConfig",properties:{useCollectionGroup:!1,isCollection:!1,documentId:this.getSettingsConfigByOrganization()?void 0:e?.documentId,organizationId:e?.organizationId??this.docService.getOrganizationConfig()?.organizationId,userId:o}});if(t!==this.settingsConfigGeneration)return;if(a?.notificationsConfig)this.setDBConfigDataToInitialConfig(a?.notificationsConfig);else{this.setSettingsInitialConfig(this.settingsInitialConfig$.getValue());let l={};this.settingsInitialConfig$.getValue().forEach(d=>{if(d.enable){let v=d?.values?.find(u=>u.id===d.default);l[d.id]=v||d?.values?.[0]||{id:"NONE",name:"None"}}});let s={};Object.keys(l).forEach(d=>{s[d]=l[d].id}),yield this.updateSettingsConfigToDb(s)}}catch(t){this.loggingService.catch("Error in NotificationService getInitialConfigFromDB: ",t)}})}subscribeToUserSettings(){try{this.loggingService.log("%c[WB] Calling NotificationService FUNCTION: subscribeToUserSettings","color: green;"),this.userSettingsSubscription&&this.userSettingsSubscription.unsubscribe();let e=Et(this.authService.getUser()?.userId??"");this.userSettingsSubscription=this.enableSettings$.pipe(je(t=>t===!0),fe(()=>un([this.docService.getDocumentPaths$(),this.getSettingsConfigByOrganization$(),this.docService.getOrganizationConfig$()]).pipe(je(([t,o,a])=>(o||!!t)&&!!a?.organizationId),fe(([t,o,a])=>rr(this.getInitialConfigFromDB(t)).pipe(fe(()=>this.commonDbService.dbListener({feature:"userConfig",properties:{useCollectionGroup:!1,isCollection:!1,documentId:o?void 0:t?.documentId,organizationId:t?.organizationId??a?.organizationId,userId:e}}).pipe(ge(l=>{l?.data?.notificationsConfig&&!Ei(l?.data?.notificationsConfig??{},this.settingsConfig$.getValue()??{})&&this.setDBConfigDataToInitialConfig(l?.data?.notificationsConfig)})))))))).subscribe()}catch(e){this.loggingService.catch("Error in NotificationService subscribeToUserSettings: ",e)}}resetCacheData(){try{this.loggingService.log("%c[WB] Calling NotificationService FUNCTION: resetCacheData","color: green;"),this.setUserNotificationsFromServer(null),this.notificationsByDocumentIdMap$.next(null),this.notificationsForYou$.next(null),this.settingsConfig$.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(t){this.loggingService.catch("Error in NotificationService setCommentService: ",t)}}getDocumentIds(){try{this.documentIdsSubscription&&this.documentIdsSubscription.unsubscribe(),this.documentIdsSubscription=this.selfNotifications$.pipe(fe(()=>this.getCurrentDocumentOnly$().pipe(fe(e=>e?this.docService.getDocumentPaths$().pipe(ge(t=>{})):ce(void 0)))),rn(()=>{this.notificationsByDocumentIdMap$.next(null)}),fe(()=>this.getDocumentIdsByLastNotificationTimestamp().pipe(Vi(),ge(([e,t])=>{let o=e?.map(v=>v.documentId),a=t?.map(v=>v.documentId),l=o?.filter(v=>!a?.includes(v)),s=a?.map(v=>({documentId:v,timestamp:t?.find(u=>u.documentId===v)?.timestamp})).filter(v=>!o?.includes(v.documentId)),d=a?.map(v=>{let u=t?.find(S=>S.documentId===v)?.timestamp;return{documentId:v,timestamp:u}}).filter(v=>{let u=e?.find(S=>S.documentId===v.documentId)?.timestamp;return u&&v.timestamp&&u!==v.timestamp});s?.length&&this.fetchNotificationsForDocumentIds(s),d?.length&&this.fetchNotificationsForDocumentIds(d,1),l?.forEach(v=>{this.removeNotificationsForDocumentId(v)}),t&&!t?.length&&!this.notificationsByDocumentIdMap$.getValue()&&(this.notificationsByDocumentIdMap$.next({}),this.setUserNotificationsFromServer([]))})))).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(fe(t=>this.docService.getOrganizationConfig$().pipe(ge(o=>{let a=null,l=this.configService.getApiKey(),s=o?.organizationId||t?.organizationId;return l&&s&&(a=new Am({apiKey:l,organizationId:s})),{user:t,documentPaths:a}}))),fe(t=>{let{user:o,documentPaths:a}=t;if(this.getCurrentDocumentOnly()&&!this.docService?.getDocumentPaths()?.documentId)return ce(null);if(o&&a?.organizationNotificationsLastNotificationTimestamp){let l=new Date,s=this.maxNotificationDays$.getValue()>0?this.maxNotificationDays$.getValue():15;l.setDate(l.getDate()-s);let d=l.getTime(),v=[yi(vt("timestamp",">=",d),...this.getCurrentDocumentOnly()&&this.docService.getDocumentPaths()?.documentId?[vt("metadata.documentId","==",this.docService.getDocumentPaths()?.documentId)]:[])];return this.getCurrentDocumentOnly()||(v.push(vr("timestamp","desc")),v.push(Dm(e))),this.commonDbService.dbListener({feature:"allLastNotificationTimestamp",properties:{organizationId:a?.organizationId,isCollection:!0,useQuery:!0,firestoreQuery:v}}).pipe(ge(u=>u?.data),ge(u=>{let S=[];return Object.keys(u||{}).forEach(k=>{let A=this.commonDbService.shouldUseFirestore()?u[k]?.timestamp??0:u[k],P=this.commonDbService.shouldUseFirestore()?u[k]?.deletedNotification??!1:!1;if(P&&P.id&&P?.timestamp===A){let U=P.id,W=u[k]?.metadata?.documentId,te=JSON.parse(JSON.stringify(this.notificationsByDocumentIdMap$.getValue()??{})),ye=te?.[W]??{documentMetadata:null,notifications:[]},me=ye.notifications??[],ke=me?.findIndex(De=>De.id===U);ke!==-1&&(me.splice(ke,1),this.notificationsByDocumentIdMap$.next(E(b({},te),{[W]:E(b({},ye),{notifications:me})})))}S.push({documentId:k,timestamp:A})}),S}),Hn(u=>(this.loggingService.catch("Error in NotificationService getDocumentIdsByLastNotificationTimestamp: ",u),ce([]))))}return ce(null)}))}catch(t){return this.loggingService.catch("Error in NotificationService getDocumentIdsByLastNotificationTimestamp: ",t),ce([])}}resolveAndUpdateDocumentNotifications(e,t){try{Object.keys(e).forEach(o=>{let a=e[o]?.documentMetadata||{},l;if(t==="user")l=this.commonDbUtilsService.mergeUsersWithData({feature:"allDocNotifications",data:e[o]?.notifications||[]});else{let s=e[o]?.notifications?.reduce((v,u)=>(v[u.notificationId]=u,v),{}),d=this.commonDbUtilsService.mergeCommentAnnotationsWithData({feature:"allDocNotifications",data:s});l=Object.values(d??{})}l.forEach(s=>{s.notification=this.getClientNotificationObject(s)}),this.setNotificationForDocumentIdInCache(o,a,l)})}catch(o){this.loggingService.catch("Error in NotificationService resolveAndUpdateDocumentNotifications: ",o)}}resolveAndMergeUserNotifications(e,t,o=!1){try{let a=e;if(o&&t==="comment"){let u=this.getUserNotificationsFromServer()??[],S=new Set(e.map(k=>k.notificationId));a=u.filter(k=>S.has(k.notificationId)).concat(e.filter(k=>!u.some(A=>A.notificationId===k.notificationId)))}let l=a.reduce((u,S)=>(u[S.notificationId]=S,u),{}),s;if(t==="user"){let u=this.commonDbUtilsService.mergeUsersWithData({feature:"allUserNotifications",data:l});s=Object.values(u??{})}else{let u=this.commonDbUtilsService.mergeCommentAnnotationsWithData({feature:"allUserNotifications",data:l});s=Object.values(u??{})}s.forEach(u=>{u.notification=this.getClientNotificationObject(u)});let d=this.getUserNotificationsFromServer()??[],v=new Map(d.map(u=>[u.notificationId,u]));s.forEach(u=>{v.set(u.notificationId,u)}),this.setUserNotificationsFromServer(Array.from(v.values()))}catch(a){this.loggingService.catch("Error in NotificationService resolveAndMergeUserNotifications: ",a)}}fetchNotificationsForDocumentIds(e,t=15){return X(this,null,function*(){try{if(e?.length){let o=mr(this.functions,gr({url:wn.cloudFunction.getNotificationsForDocuments,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:12e5}),a=this.docService.getOrganizationConfig()?.organizationId??"";if(!a)return[];let l=this.getStartAtTimestamp(),s={};if(e.forEach(me=>{if(me?.documentId){let ke=this.getAllowedDocumentMetadataByDocumentId(me.documentId);ke&&(s[me.documentId]=ke)}}),this.userPermissionService?.isPermissionProviderAvailable())try{let me=[];if(e.forEach(Re=>{this.docService.getDocumentMetadata(Re.documentId)||me.push(Re.documentId)}),me.length){let Re=this.authService.getUser(),Le=mr(this.functions,gr({url:wn?.cloudFunction?.sdkProxy,apiProxyDomain:this.configService?.getApiProxyDomain()}));try{let Ue=yield Cd({methodName:"getDocumentMetadataFromIds",data:{type:"getDocumentMetadataFromIds",metadata:{organizationId:Re?.clientOrganizationId,folderId:this.documentPaths?.folderId},documentIds:me},getSdkProxy:Le,userId:Re?.userId??""});if(Ue?.data?.length){let He={};Ue.data.forEach($e=>{$e?.documentId&&(He[$e.documentId]=$e)}),this.docService.setAllDocumentMetadata(b(b({},this.docService.getAllDocumentMetadataMap()),He))}}catch(Ue){this.loggingService.warn("Error in NotificationService fetchNotificationsForDocumentIds: ",Ue)}}let ke=[],De=[];e.forEach(Re=>{let Le=this.docService.getDocumentMetadata(Re.documentId);Le?.clientDocumentId?ke.push({userId:this.authService.getUser()?.userId??"",resource:{id:Le.clientDocumentId,type:Wr.DOCUMENT,source:tr.GET_NOTIFICATIONS,organizationId:this.docService.getOrganizationConfig()?.clientOrganizationId??""}}):De.push(Re.documentId)}),De.length&&(e=e.filter(Re=>!De.includes(Re.documentId)));let Ie=St();this.coreActionsService.triggerAction(ut.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.RESOURCE_ACCESS_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:Ie,methodName:tr.GET_NOTIFICATIONS,source:"internal",payload:{requests:ke}});let xe=yield this.userPermissionService?.onResourceAccessRequired({requests:ke,uniqueId:Ie,methodName:tr.GET_NOTIFICATIONS});xe?.success&&xe?.data?.length?xe.data.forEach(Re=>{!Re.hasAccess&&Re.resourceId&&(e=e.filter(Le=>Le.documentId!==Bo(Re.resourceId)))}):e=[]}catch(me){this.loggingService.warn("Error in NotificationService fetchNotificationsForDocumentIds: ",me),e=[]}if(!e.length)return[];let d=this.userPermissionService?.getPermissionsCache()?.filter(me=>me.type===Wr.CONTEXT),v={organizationId:a,documentIds:e.filter(me=>!!me.documentId&&!!me.timestamp).map(me=>({documentId:me.documentId,timestamp:me.timestamp??0})),timestamp:l,limitToLast:t,selfNotifications:this.selfNotifications$.value,isPermissionProviderUsed:this.userPermissionService?.isPermissionProviderAvailable(),getUserNotifications:!0,isContextEnabled:this.userPermissionService?.getIsContextEnabled(),cachedData:d,isSettingsConfigByOrganization:this.getSettingsConfigByOrganization(),retryConfig:this.userPermissionService?.getPermissionProviderRetryConfig()},u=yield this.notificationUtilsService.handleNotificationEncryption({data:v}),S=yield o({veltData:u}),k=S?.data?.data?.veltData||{},A=S?.data?.data?.veltAdditionalData||{},P="notificationwithdocumentidstoencryptanddecryptonsdk"+(this.authService.getUser()?.userId??""),U=yield _1(k,P),{userNotifications:W=[],userNotificationIdsInDocNotifications:te=[],permissionResults:ye=[]}=yield _1(A,P);if(this.userPermissionService?.getIsContextEnabled()){let me=[...this.userPermissionService?.getPermissionsCache()??[],...ye??[]];this.userPermissionService?.setPermissionsCache(me)}if(U&&typeof U=="object"){let me=this.usersService.userDataProviderAvailable(),ke=this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable(),De=[],Ie=[];Object.keys(U).forEach((Re,Le)=>{let Ue=U[Re].documentMetadata;if(Ue){let $e=this.allowedDocumentMetadataMap$.value||{};(!$e?.[Re]||!Ei($e?.[Re],Ue))&&this.allowedDocumentMetadataMap$.next(E(b({},$e),{[Re]:Ue}))}let He=U[Re].notifications||[];He.forEach($e=>{te.includes($e.notificationId)&&!W.find(br=>br.notificationId===$e.notificationId)&&W.push(JSON.parse(JSON.stringify($e))),$e.notification=this.getClientNotificationObject($e)}),this.setNotificationForDocumentIdInCache(Re,Ue,He),me&&(De.push(this.commonDbUtilsService.formatResponse({feature:"allDocNotifications",data:He,shouldAwait:!0,forceResolve:!0})),De.push(this.commonDbUtilsService.formatResponse({feature:"allUserNotifications",data:W,shouldAwait:!0,forceResolve:!0}))),ke&&(Ie.push(this.commonDbUtilsService.formatResponse({feature:"allDocNotifications",data:He,shouldCommentAnnotationsResolverAwait:!0})),Ie.push(this.commonDbUtilsService.formatResponse({feature:"allUserNotifications",data:W,shouldCommentAnnotationsResolverAwait:!0})))});let xe=JSON.parse(JSON.stringify(W));this.setUserNotificationsFromServer([...this.getUserNotificationsFromServer()??[],...W]),me&&ke?Promise.allSettled(De).then(()=>{this.resolveAndUpdateDocumentNotifications(U,"user"),this.resolveAndMergeUserNotifications(xe,"user")}).then(()=>Promise.allSettled(Ie)).then(()=>{this.resolveAndUpdateDocumentNotifications(U,"comment"),this.resolveAndMergeUserNotifications(xe,"comment",!0)}):me?Promise.allSettled(De).then(()=>{this.resolveAndUpdateDocumentNotifications(U,"user"),this.resolveAndMergeUserNotifications(xe,"user")}):ke&&Promise.allSettled(Ie).then(()=>{this.resolveAndUpdateDocumentNotifications(U,"comment"),this.resolveAndMergeUserNotifications(xe,"comment",!1)})}}}catch(o){return this.loggingService.catch("Error in NotificationService fetchNotificationsForDocumentIds: ",o),[]}})}getUserNotificationsFromServer$(){return this.userNotificationsFromServer$.asObservable()}setUserNotificationsFromServer(e){try{let t=JSON.parse(JSON.stringify(e));t=t?.filter((o,a,l)=>a===l.findIndex(s=>s.notificationId===o.notificationId)),this.userNotificationsFromServer$.next(t)}catch(t){this.loggingService.catch("Error in NotificationService setUserNotificationsFromServer: ",t)}}getUserNotificationsFromServer(){return this.userNotificationsFromServer$.getValue()}setNotificationForDocumentIdInCache(e,t,o,a){try{let l=this.docService.getOrganizationConfig()?.organizationId??"",s=this.docService.getOrganizationMetadata(l);t||(t=JSON.parse(JSON.stringify(this.docService.getDocumentMetadata()||{}))),s||(s=JSON.parse(JSON.stringify(this.docService.getOrganizationMetadata(l)||{})));let d=this.notificationsByDocumentIdMap$.getValue(),v=d?.[e]?.notifications||[],u=this.docService.getLocationMetadatas(),S=o?.map(P=>{let U=P?.notification;return U?(U.metadata&&(U.metadata.documentName=t?.documentName||U.metadata.documentName,U.metadata.organizationMetadata=s||U.metadata.organizationMetadata,U.metadata.documentMetadata=t||U.metadata.documentMetadata),u&&(U=this.notificationUtilsService.mergeLocationWithNotification({notification:U},u)?.notification),U):null})?.filter(P=>!!P)||[],k=new Map(v.map(P=>[P.id,P]));S.forEach(P=>{k.set(P.id,P)});let A=Array.from(k.values()).sort((P,U)=>(U.timestamp||0)-(P.timestamp||0));this.notificationsByDocumentIdMap$.next(E(b({},d),{[e]:{notifications:A,documentMetadata:t}}))}catch(l){this.loggingService.catch("Error in NotificationService setNotificationForDocumentIdInCache: ",l)}}removeNotificationsForDocumentId(e){try{this.notificationsByDocumentIdSubscription[e]&&this.notificationsByDocumentIdSubscription[e].unsubscribe();let t=this.notificationsByDocumentIdMap$.getValue();delete t?.[e],this.notificationsByDocumentIdMap$.next(t)}catch(t){this.loggingService.catch("Error in NotificationService removeNotificationsForDocumentId: ",t)}}getStartAtTimestamp(){try{let e=new Date,t=this.maxNotificationDays$.getValue()>0?this.maxNotificationDays$.getValue():15;return e.setDate(e.getDate()-t),e.getTime()}catch(e){return this.loggingService.catch("Error in NotificationService getStartAtTimestamp: ",e),0}}getNotificationsForYou(){try{return this.getUserNotificationsFromServer$().pipe(fe(e=>ce(e).pipe(je(t=>!!t),ge(t=>{let o=this.usersService.userDataProviderAvailable(),a=this.commentAnnotationsResolverService?.commentAnnotationDataProviderAvailable();if(o||a){let s=t?.reduce((d,v)=>(d[v.notificationId]=v,d),{});o&&(s=this.commonDbUtilsService.mergeUsersWithData({feature:"allUserNotifications",data:s||[]})),a&&(s=this.commonDbUtilsService.mergeCommentAnnotationsWithData({feature:"allUserNotifications",data:s||[]})),t=Object.values(s??{})}return t.forEach(s=>{s.notification=this.getClientNotificationObject(s)}),t.sort((s,d)=>d.timestamp-s.timestamp),t.map(s=>s.notification).filter(s=>!!s)}),fe(t=>{let o={data:t?.reduce((a,l)=>(a[l.id]={notification:l},a),{}),operation:null};return this.commonDbUtilsService.mergeLocationMetadataWithData$({data:o,feature:"allUserNotifications"}).pipe(ge(a=>Object.values(a?.data||{}).map(l=>l?.notification)))}))),fe(e=>{let t=this.docService.getOrganizationConfig()?.organizationId??"";return this.docService.getOrganizationMetadata$(t).pipe(ge(()=>e))}),fe(e=>this.allowedDocumentMetadataMap$.pipe(ge(()=>e))),ge(e=>(e?.length&&(e=e.map(t=>{if(t?.metadata){let o=this.docService.getOrganizationConfig()?.organizationId??"",a=this.getAllowedDocumentMetadataByDocumentId(t.metadata.documentId),l=this.docService.getOrganizationMetadata(o);a||(a=JSON.parse(JSON.stringify(this.docService.getDocumentMetadata()||{}))),l||(l=JSON.parse(JSON.stringify(this.docService.getOrganizationMetadata(o)||{}))),t.metadata.documentName=a?.documentName||t.metadata.documentName,t.metadata.organizationMetadata=l||t.metadata.organizationMetadata,t.metadata.documentMetadata=a||t.metadata.documentMetadata}return t})),e===null?this.notificationsForYou$.next(null):e?.length?this.notificationsForYou$.next(JSON.parse(JSON.stringify(e))):this.notificationsForYou$.next([]),ce(e))))}catch(e){return this.loggingService.catch("Error in NotificationService getNotificationsForYou: ",e),ce({})}}subscribeNotificationsData(e,t){this.loggingService.log("%c[WB] Calling FUNCTION: subscribeViewsData","color: green;");let o,a;try{if(e&&(a=Gn(e)),t&&typeof t=="object"){let l=fo(t);o=Gn(JSON.stringify(l))}}catch(l){this.loggingService.catch("Error in ViewsService subscribeViewsData: ",l)}return mi(this.afAuth).pipe(je(l=>!!l),fe(l=>this.isFeatureAllowed({firebaseUser:l})),fe(l=>l.featureAllowed?this.iamService.isUserAllowed$().pipe(ge(s=>(l.featureAllowed=s,l))):ce(l)),fe(l=>!l.featureAllowed||l?.user?.organizationId?(this.notifications$.next([]),this.rawNotificationsByIdMap$.next(new Map),this.processedNotifications$.next([]),this.notificationsByIdMap$.next(new Map),this.notificationViews$.next({}),this.setNotificationsByIdMap(),ce([])):ce(l).pipe(fe(s=>this.docService.getDocumentPaths$().pipe(ge(d=>(this.documentPaths=d,s.documentPaths=d,s)))),fe(s=>this.getDataFromDocumentId(a)))))}isFeatureAllowed(e){return this.configService.getConfig$().pipe(je(t=>!!t),ge(t=>E(b({},e),{config:t})),fe(t=>this.authService.getUser$().pipe(ge(o=>E(b({},t),{user:o})))),fe(t=>Cr(t.config,t.user,Be.NOTIFICATION)?ce(E(b({},t),{featureAllowed:!0})):(this.loggingService.warn("Notification feature is not allowed."),ce(E(b({},t),{featureAllowed:!1})))))}getDataFromDocumentId(e){return this.databaseService.getDb().pipe(je(t=>!!t),fe(t=>{if(this.db=t,this.loggingService.log(this.db),this.configService?.getApiKey()&&this.documentPaths?.views){let o=`${this.configService.getApiKey()}`;this.documentPaths?.organizationId&&(o+=`/${V.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${this.documentPaths.organizationId}`);let a=Li(this.db,`${e?o+"/"+V.FIREBASE_PARTIAL_PATH_DOCS+"/"+e+"/"+V.FIREBASE_PARTIAL_PATH_VIEWS+"/":this.documentPaths?.notifications}`);return UM(a).pipe(Hn(l=>(this.loggingService.catch("Error in NotificationService getDataFromDocumentId: ",l),ce(null))),ge(l=>{let s=[],d=new Map;l?.raw&&(Object.keys(l?.raw||{}).forEach(u=>{let S=l?.raw[u];S?.id&&s.push(S)}),s.forEach(u=>{u.id&&d.set(u.id,u)})),this.notifications$.next(s),this.rawNotificationsByIdMap$.next(d);let v=[];l?.processed&&Object.keys(l?.processed||{}).forEach(u=>{let S=l?.processed[u];S?.id&&v.push(S)}),this.processedNotifications$.next(v),this.setNotificationsByIdMap()}))}else return ce(null)}))}setNotificationsByIdMap(){try{let e=this.authService.getUser();if(e){let t=this.notificationViews$.getValue(),o;e?.email&&(o=Et(e?.email));let a;e?.userId&&(a=Et(e?.userId));let l=new Map;this.processedNotifications$.getValue().forEach(d=>{if(d.id&&d?.displayHeadlineMessageTemplate){let v=!1;(o&&d.notifyUsers?.[o]||a&&d.notifyUsers?.[a])&&(v=!0);let u={id:d.id,notificationSource:d.notificationSource,actionType:d.actionType,actionUser:d.actionUser,timestamp:d.timestamp,targetAnnotationId:d.targetAnnotationId,displayHeadlineMessage:this.getNotificationHeadlineMessage(d),displayBodyMessage:this.getNotificationBodyMessage(d),forYou:v,notificationSourceData:d.notificationSourceData},S=this.getRawNotificationById(u.id);if(S?.metadata&&(u.metadata={apiKey:S.metadata.apiKey,organizationId:S.metadata.organizationId,clientOrganizationId:S.metadata.clientOrganizationId,documentId:S.metadata.documentId,clientDocumentId:S.metadata.clientDocumentId,location:S?.location,locationId:S?.locationId}),u?.notificationSource==="comment"&&u?.targetAnnotationId){let k=this.commentService?.getAnnotationById(u.targetAnnotationId);k||S?.annotationData&&(k=S.annotationData),k&&(u.notificationSourceData=this.commentService?.getCommentAnnotationForClient(k))}l.set(d.id,u)}}),l.forEach((d,v)=>{d.isUnread=d?.actionUser?.userSnippylyId!==e?.userSnippylyId&&!t?.notification?.[v]?.views?.[e?.userSnippylyId],l.set(v,d)}),this.notificationsByIdMap$.next(l)}}catch(e){this.loggingService.catch("Error in NotificationService setNotificationsByIdMap: ",e)}}getClientNotificationObject({processed:e,raw:t,metadata:o,views:a,notification:l}){try{let s=this.authService.getUser(),d=l||e;if(d.id&&d?.displayHeadlineMessageTemplate&&s){let v=null;s?.email&&(v=Et(s?.email));let u=null;s?.userId&&(u=Et(s?.userId));let S=!1,k=!0;(v&&d.notifyUsers?.[v]||u&&d.notifyUsersByUserId?.[u])&&(S=!0),u&&a?.[u]&&(k=!1);let A={id:d.id};if(l?A=E(b(b({},A),l),{displayHeadlineMessage:this.getNotificationHeadlineMessage(l),displayBodyMessage:this.getNotificationBodyMessage(l),forYou:S,isUnread:k}):A={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:S,isUnread:k,metadata:o},A?.notificationSource==="comment"&&A?.targetAnnotationId){let P=this.commentService?.getAnnotationById(A.targetAnnotationId);P||l?.notificationSourceData&&(P=l?.notificationSourceData),P||t?.annotationData&&(P=t.annotationData),P&&(A.notificationSourceData=this.commentService?.getCommentAnnotationForClient(P))}return t?.targetAnnotationData?.isCommentResolverUsed&&(A.isCommentResolverUsed=t?.targetAnnotationData?.isCommentResolverUsed),A}return}catch(s){this.loggingService.catch("Error in NotificationService getClientNotificationObject: ",s);return}}getNotificationsForYou$(){return this.notificationsForYou$.asObservable()}getNotificationsByDocumentId$(){return this.notificationsByDocumentIdMap$.asObservable().pipe(ge(e=>e?Object.keys(e??{}).map(t=>{let o=e[t].notifications||[],a=o.filter(s=>s.isUnread).length,l=o.length>0&&o[0]?.timestamp||0;return{documentId:t,notifications:e[t]?.notifications,unreadNotificationsCount:a,latestNotificationTimestamp:l,documentMetadata:e[t]?.documentMetadata}}).filter(t=>t.notifications?.length>0).sort((t,o)=>o.latestNotificationTimestamp-t.latestNotificationTimestamp):null))}getAllNotifications$(){return this.getNotificationsByDocumentId$().pipe(ge(e=>{let t=null;return e?(t=[],e.forEach(o=>{o.notifications.forEach(a=>{t?.push(a)})}),t?.sort((o,a)=>a.timestamp-o.timestamp)):null}))}processNotificationData(e){try{let t=e?.annotationData?.metadata,o=this.docService.getOrganizationConfig()?.organizationId;e.metadata=JSON.parse(JSON.stringify(this.docService.getDocumentMetadata(t?.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(t?.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(o?this.docService.getOrganizationMetadata(o)||{}:{})),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 l=t?.documentId?new Am({apiKey:a,documentId:t.documentId,organizationId:t?.organizationId}):this.docService.getDocumentPaths();e?.actionUser?.organizationId&&(e.metadata.organizationId=l?.organizationId||e.actionUser.organizationId,e.metadata.clientOrganizationId=l?.clientOrganizationId||e.actionUser.clientOrganizationId);let s=this.docService.getLocation();s&&(e.location=s?.location,e.locationId=s?.locationId),this.loggingService.log(`[NOTIFICATION] ${e?.notificationSource} ${e?.actionType}`,e);let d=this.commonDbService.getServerTimestamp(),v=this.notificationUtilsService.formatNotification(e,d);return JSON.parse(JSON.stringify(v))}catch(t){return this.loggingService.catch("Error in NotificationService processNotificationData: ",t),null}}updateNotificationDatabase(e){try{let t=Li(this.notificationsDb),o=this.processNotificationData(e);wM(t,JSON.parse(JSON.stringify(o)))}catch(t){this.loggingService.catch("Error in NotificationService updateNotificationDatabase: ",t)}}getRawNotifications$(){return this.notifications$.asObservable()}getProcessedNotifications$(){return this.processedNotifications$.asObservable()}getNotifications$(e){return this.authService.getUser$().pipe(fe(t=>t?t.organizationId?this.getAllNotifications$().pipe(fe(o=>this.notificationsForYou$.pipe(ge(a=>{if(o||a){let l=new Map;return(!e?.type||["all","documents"].includes(e.type))&&(o||[]).forEach(s=>{s.id&&l.set(s.id,s)}),(!e?.type||["all","forYou"].includes(e.type))&&(a||[]).forEach(s=>{s.id&&!l.has(s.id)&&l.set(s.id,s)}),Array.from(l.values()).sort((s,d)=>(d.timestamp||0)-(s.timestamp||0))}else return null})))):this.notificationsByIdMap$.asObservable().pipe(ge(o=>Array.from(o.values())),ge(o=>o.sort((a,l)=>l.timestamp-a.timestamp)),Vp()):ce(null)),xt(Qt))}getRawNotificationById(e){try{return this.rawNotificationsByIdMap$.getValue()?.get(e)}catch(t){this.loggingService.catch("Error in NotificationService getRawNotificationById: ",t);return}}setNotificationViews(e){try{this.notificationViews$.next(e),this.setNotificationsByIdMap()}catch(t){this.loggingService.catch("Error in NotificationService setNotificationViews: ",t)}}getNotificationHeadlineMessage(e){try{let t=this.authService.getUser();if(e?.displayHeadlineMessageTemplate&&e?.displayHeadlineMessageTemplateData){let o=e.displayHeadlineMessageTemplate,a=e.displayHeadlineMessageTemplateData,l=/\{(\w+)\}/g,s=o.replace(l,(d,v)=>(v==="actionUser"||v==="recipientUser")&&a[v]?t?.email&&a[v].email===t?.email||t?.userId&&a[v]?.userId===t?.userId?"You":a[v].name||a[v].email||' <velt-skeleton-loader width="50px" height="20px" border-radius="4px"></velt-skeleton-loader> ':a[v]?a[v]:d);return this.domService.sanitizeHtml(s)}return this.domService.sanitizeHtml(e.displayHeadlineMessageTemplate||"")}catch(t){return this.loggingService.catch("Error in NotificationService getNotificationHeadlineMessage: ",t),""}}getNotificationBodyMessage(e){try{if(e?.displayBodyMessageTemplate&&e?.displayBodyMessageTemplateData){let t=e?.displayBodyMessageTemplate;return e?.displayBodyMessageTemplateData&&e?.displayBodyMessageTemplateData?.users?.forEach(o=>{if(o?.userId){let a=this.usersService.getUserById(o?.userId);t=t?.replaceAll(`{{${o.userId}}}`,a?.name||a?.email||'<velt-skeleton-loader width="50px" height="20px" border-radius="4px"></velt-skeleton-loader>'),t=t?.replaceAll(`@User ${o.userId}`,a?.name||a?.email||'<velt-skeleton-loader width="50px" height="20px" border-radius="4px"></velt-skeleton-loader>')}}),this.domService.sanitizeHtml(t)}return this.domService.sanitizeHtml(e.displayBodyMessage||"")}catch(t){return this.loggingService.catch("Error in NotificationService getNotificationBodyMessage: ",t),""}}setHistoryPanelVisibility(e,t=!1,o=!1){try{e?document.querySelector(V.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL)?this.historyPanelVisible$.next(e):this.loggingService.catch("Error in NotificationService setHistoryPanelVisibility: ",`<${V.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL}> tag is not added.`):this.historyPanelVisible$.next(e),e?this.analyticsService.trackEvent(Y.Events.Notifications.NOTIFICATION_HISTORY_PANEL_OPENED):this.analyticsService.trackEvent(Y.Events.Notifications.NOTIFICATION_HISTORY_PANEL_CLOSED)}catch{this.loggingService.catch("Error in NotificationService setHistoryPanelVisibility: ",`<${V.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL}> tag is not added.`)}}toggleHistoryPanelVisibility(e=!1,t=!1){try{this.historyPanelVisible$.value?this.historyPanelVisible$.next(!this.historyPanelVisible$.value):document.querySelector(V.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL)?(this.historyPanelVisible$.next(!this.historyPanelVisible$.value),this.historyPanelVisible$.value?this.analyticsService.trackEvent(Y.Events.Notifications.NOTIFICATION_HISTORY_PANEL_TOGGLED,{action:"closed"}):this.analyticsService.trackEvent(Y.Events.Notifications.NOTIFICATION_HISTORY_PANEL_TOGGLED,{action:"opened"})):this.loggingService.catch("Error in NotificationService toggleHistoryPanelVisibility: ",`<${V.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL}> tag is not added.`)}catch{this.loggingService.catch("Error in NotificationService toggleHistoryPanelVisibility: ",`<${V.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL}> tag is not added.`)}}getHistoryPanelVisibility$(){return this.historyPanelVisible$.asObservable()}setNotificationsAsRead(e){return X(this,null,function*(){try{let t=JSON.parse(JSON.stringify(this.getUserNotificationsFromServer()??[]));if(e?.length){for(let s=0;s<e.length;s+=50){let v=e.slice(s,s+50).filter(k=>k?.id),u=v.map(k=>this.setNotificationAsRead({notification:k,userNotifications:JSON.parse(JSON.stringify(t))})),S=yield Promise.all(u);v.forEach((k,A)=>{let P=S[A];if(!P.some(W=>W.notificationId===k.id))t=t.filter(W=>W.notificationId!==k.id);else{let W=t.find(ye=>ye.notificationId===k.id),te=P.find(ye=>ye.notificationId===k.id);W&&te?.views&&(W.views=te.views)}})}let a=JSON.parse(JSON.stringify(this.notificationsByDocumentIdMap$.getValue()||{}));e.forEach(s=>{let d=s.metadata?.documentId;if(d&&a?.[d]){let v=a?.[d]?.notifications||[],u=v.find(S=>S.id===s.id);u&&(u.isUnread=!1),a[d].notifications=v}}),this.notificationsByDocumentIdMap$.next(a),!Ei(t,this.getUserNotificationsFromServer())&&this.setUserNotificationsFromServer(t)}}catch(t){this.loggingService.catch("Error in NotificationService setNotificationsAsRead: ",t)}})}setAllNotificationsAsRead(e){return X(this,null,function*(){try{if(e?.tabId==="for-you"){let t=this.notificationsForYou$.value||[];this.setNotificationsAsRead(t)}else this.getNotifications$().pipe(st(1)).subscribe(t=>{t&&this.setNotificationsAsRead(t)})}catch(t){this.loggingService.catch("Error in NotificationService setAllNotificationsAsRead: ",t)}})}getUnreadNotificationsCount$(){try{return this.notificationsForYou$.pipe(ge(e=>e?.filter(o=>o?.isUnread)?.length??null),fe(e=>this.getNotifications$().pipe(ge(t=>{let o=t?.filter(a=>a?.isUnread)?.length??null;return{forYou:e,all:o}}))))}catch(e){return this.loggingService.catch("Error in NotificationService getUnreadNotificationsCount$: ",e),ce({forYou:null,all:null})}}setNotificationAsRead(o){return X(this,arguments,function*({notification:e,userNotifications:t}){try{let a=this.authService.getUser();if(a&&e?.id){let l=Et(a?.userId),{metadata:s}=e;if(s){let{apiKey:d,organizationId:v,documentId:u}=s;if(d&&v&&u&&l){let S=yield this.commonDbService.getData({feature:"docNotification",properties:{id:e.id,organizationId:v,documentId:u,apiKey:d}});S?.notificationId&&(S?.views?.[l]||(S.views||(S.views={}),S.views[l]={timestamp:Date.now()},this.commonDbService.updateData({feature:"docNotificationViews",properties:{id:e.id,organizationId:v,documentId:u,apiKey:d},data:S})));let k=yield this.commonDbService.getData({feature:"userNotification",properties:{id:e.id,userId:l,documentId:u,organizationId:v}});if(k?.notificationId){if(!this.getReadNotificationsOnForYouTab())yield this.commonDbService.deleteData({feature:"userNotification",properties:{id:e.id,userId:l,documentId:u,organizationId:v}}),t=t.filter(A=>A.notificationId!==e.id);else if(!k?.views?.[l]){k.views||(k.views={}),k.views[l]={timestamp:Date.now()};let A=t.find(P=>P.notificationId===e.id);A&&(A.views=k.views),this.commonDbService.updateData({feature:"userNotificationViews",properties:{id:e.id,userId:l,documentId:u,organizationId:v},data:k})}}}}}return t}catch(a){return this.loggingService.catch("Error in NotificationService setNotificationAsRead: ",a),t}})}setMaxDays(e){try{e>0?this.maxNotificationDays$.next(e):this.maxNotificationDays$.next(15)}catch(t){this.loggingService.catch("Error in NotificationService setMaxDays: ",t)}}setTabConfig(e){try{e&&this.tabConfig$.next(e)}catch(t){this.loggingService.catch("Error in NotificationService setTabConfig: ",t)}}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}enableCurrentDocumentOnly(){try{if(this.currentDocumentOnly$.value===!0)return;this.currentDocumentOnly$.next(!0)}catch(e){this.loggingService.catch("Error in NotificationService enableCurrentDocumentOnly: ",e)}}disableCurrentDocumentOnly(){try{if(this.currentDocumentOnly$.value===!1)return;this.currentDocumentOnly$.next(!1)}catch(e){this.loggingService.catch("Error in NotificationService disableCurrentDocumentOnly: ",e)}}getCurrentDocumentOnly$(){return this.currentDocumentOnly$.asObservable()}getCurrentDocumentOnly(){return this.currentDocumentOnly$.value}markNotificationAsReadById(e){return X(this,null,function*(){try{this.getNotifications$().pipe(st(1)).subscribe(t=>{if(t){let o=t.filter(a=>a.id===e);this.setNotificationsAsRead(o)}})}catch(t){this.loggingService.catch("Error in NotificationService markNotificationAsReadById: ",t)}})}getAllowedDocumentMetadataByDocumentId(e){try{return this.allowedDocumentMetadataMap$.value?.[e]||null}catch(t){return this.loggingService.catch("Error in NotificationService getAllowedDocumentMetadataByDocumentId: ",t),null}}setSettingsConfig(e){try{this.enableSettings$.value&&this.settingsConfig$.next(e)}catch(t){this.loggingService.catch("Error in NotificationService setSettingsConfig: ",t)}}setSettingsConfigWithDB(e){try{this.enableSettings$.value&&(this.settingsConfig$.next(e),this.updateSettingsConfigToDb())}catch(t){this.loggingService.catch("Error in NotificationService setSettingsConfigWithDB: ",t)}}getSettingsConfig$(){return this.settingsConfig$.asObservable()}getSettingsConfig(){return this.settingsConfig$.value}setMuteAllNotifications(){try{this.muteAllNotifications$.value!==!0&&this.muteAllNotifications$.next(!0)}catch(e){this.loggingService.catch("Error in NotificationService setSettingsMuteAll: ",e)}}getMuteAllNotifications$(){return this.muteAllNotifications$.asObservable()}getMuteAllNotifications(){return this.muteAllNotifications$.value}enableSettings(){try{this.enableSettings$.value!==!0&&this.enableSettings$.next(!0)}catch(e){this.loggingService.catch("Error in NotificationService enableSettings: ",e)}}enableSettingsConfigByOrganization(){try{this.getSettingsConfigByOrganization()!==!0&&this.setSettingsConfigByOrganization$.next(!0)}catch(e){this.loggingService.catch("Error in NotificationService enableSettingsConfigByOrganization: ",e)}}disableSettingsConfigByOrganization(){try{this.getSettingsConfigByOrganization()!==!1&&this.setSettingsConfigByOrganization$.next(!1)}catch(e){this.loggingService.catch("Error in NotificationService disableSettingsConfigByOrganization: ",e)}}getSettingsConfigByOrganization$(){return this.setSettingsConfigByOrganization$.asObservable()}getSettingsConfigByOrganization(){return this.setSettingsConfigByOrganization$.value}enableSelfNotifications(){try{this.selfNotifications$.value!==!0&&this.selfNotifications$.next(!0)}catch(e){this.loggingService.catch("Error in NotificationService enableSelfNotifications: ",e)}}disableSelfNotifications(){try{this.selfNotifications$.value!==!1&&this.selfNotifications$.next(!1)}catch(e){this.loggingService.catch("Error in NotificationService disableSelfNotifications: ",e)}}disableSettings(){try{this.enableSettings$.value!==!1&&this.enableSettings$.next(!1)}catch(e){this.loggingService.catch("Error in NotificationService disableSettings: ",e)}}getEnableSettings$(){return this.enableSettings$.asObservable()}getEnableSettings(){return this.enableSettings$.value}setSettingsInitialConfig(e){try{let t=!1;if(e.forEach(o=>{["email","inbox"].includes(o.id)&&(t=!o.values?.every(a=>["ALL","NONE","MINE"].includes(a.id)))}),t){this.loggingService.catch("Invalid config values for email or inbox, It should have only ALL, NONE, MINE values");return}this.settingsInitialConfig$.next(e)}catch(t){this.loggingService.catch("Error in NotificationService setSettingsInitialConfig: ",t)}}getSettingsInitialConfig$(){return this.settingsInitialConfig$.asObservable()}getSettingsInitialConfig(){return this.settingsInitialConfig$.value}updateSettingsConfigToDb(e){return X(this,null,function*(){try{let t=this.authService.getUser(),o=Et(t?.userId??""),a=this.docService.getDocumentPaths(),l=this.docService.getOrganizationConfig(),s=a?.organizationId??l?.organizationId,d=a?.clientOrganizationId??l?.clientOrganizationId,v={apiKey:this.configService.getApiKey(),organizationId:s,documentId:a?.documentId,clientOrganizationId:d,clientDocumentId:a?.clientDocumentId,userId:o,clientUserId:this.authService.getUser()?.userId};o&&this.getEnableSettings()&&this.enableSettings$.value&&(this.getSettingsConfigByOrganization()?this.docService.addUserInfoToOrganization({organizationId:d??t?.clientOrganizationId??"",user:{userId:t?.userId??""},notificationsConfig:e||this.settingsConfig$.getValue()}):a?.documentId&&(yield this.commonDbService.updateData({feature:"userConfig",properties:{documentId:a?.documentId,userId:o},data:{id:a?.documentId,notificationsConfig:e||this.settingsConfig$.getValue(),metadata:v}})))}catch(t){this.loggingService.catch("Error in NotificationService updateSettingsConfigToDb: ",t)}})}openNotificationsPanel(){try{this.notificationsPanelVisible$.next(!0)}catch(e){this.loggingService.catch("Error in NotificationService openNotificationsPanel: ",e)}}closeNotificationsPanel(){try{this.notificationsPanelVisible$.next(!1)}catch(e){this.loggingService.catch("Error in NotificationService closeNotificationsPanel: ",e)}}getNotificationsPanelVisible$(){return this.notificationsPanelVisible$.asObservable()}getNotificationsPanelVisible(){return this.notificationsPanelVisible$.value}};r.\u0275fac=function(t){return new(t||r)(J(Gi),J(rt),J(Ge),J(Lt),J(xn),J(Mm),J(ku),J(vs),J(On),J(lt),J(Ve),J(An),J(x),J(OR),J(Dn),J(Lr),J(bl),J(pi))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var nr=(()=>{let r=class r{constructor(e){this.loggingService=e,this._customStatusMap=new be(V.CommentAnnotationStatusMap),this._customPriorityMap=new be(V.CommentAnnotationPriorityMap),this._customCategoryMap=new be(V.CommentCategoryMap);try{let t=sessionStorage.getItem(V.SESSION_STORAGE.VELT_CUSTOM_PRIORITY_MAP);t&&this._customPriorityMap.next(JSON.parse(t));let o=sessionStorage.getItem(V.SESSION_STORAGE.VELT_CUSTOM_STATUS_MAP);o&&this._customStatusMap.next(JSON.parse(o));let a=sessionStorage.getItem(V.SESSION_STORAGE.VELT_CUSTOM_CATEGORY_MAP);a&&this._customCategoryMap.next(JSON.parse(a))}catch(t){this.loggingService.catch("Error in CustomFilterService constructor: ",t)}}setCustomStatusFilters(e){try{if(e.length<2){this._customStatusMap.next(V.CommentAnnotationStatusMap),sessionStorage.setItem(V.SESSION_STORAGE.VELT_CUSTOM_STATUS_MAP,JSON.stringify(V.CommentAnnotationStatusMap)),this.loggingService.catch("Custom status filters must have at least 2 filters");return}let t={};e.forEach(o=>{t[o.id]=o,o.type||(o.type="ongoing")}),this._customStatusMap.next(t),sessionStorage.setItem(V.SESSION_STORAGE.VELT_CUSTOM_STATUS_MAP,JSON.stringify(t))}catch(t){this.loggingService.catch("Error in CustomFilterService setCustomStatusFilters: ",t)}}setCustomPriorityFilters(e){try{if(e.length<2){this._customPriorityMap.next(V.CommentAnnotationPriorityMap),sessionStorage.setItem(V.SESSION_STORAGE.VELT_CUSTOM_PRIORITY_MAP,JSON.stringify(V.CommentAnnotationPriorityMap)),this.loggingService.catch("Custom priority filters must have at least 2 filters");return}let t={};e.forEach(o=>{t[o.id]=o}),this._customPriorityMap.next(t),sessionStorage.setItem(V.SESSION_STORAGE.VELT_CUSTOM_PRIORITY_MAP,JSON.stringify(t))}catch(t){this.loggingService.catch("Error in CustomFilterService setCustomPriorityFilters: ",t)}}setCustomCategories(e){try{let t={};e.forEach(o=>{t[o.id]=o}),this._customCategoryMap.next(t),sessionStorage.setItem(V.SESSION_STORAGE.VELT_CUSTOM_CATEGORY_MAP,JSON.stringify(t))}catch(t){this.loggingService.catch("Error in CustomFilterService setCustomCategories: ",t)}}get customStatusMap$(){return this._customStatusMap.asObservable()}get customPriorityMap$(){return this._customPriorityMap.asObservable()}get customCategoryMap$(){return this._customCategoryMap.asObservable()}get defaultStatus(){try{let t=Object.entries(this._customStatusMap.value).find(([o,a])=>a.type==="default");if(t)return t[1]}catch(e){this.loggingService.catch("Error in CustomFilterService defaultStatus: ",e)}return V.CommentAnnotationStatusMap.OPEN}get resolvedStatus(){try{let t=Object.entries(this._customStatusMap.value).find(([o,a])=>a.type==="terminal");if(t)return t[1]}catch(e){this.loggingService.catch("Error in CustomFilterService resolvedStatus: ",e)}return V.CommentAnnotationStatusMap.OPEN}get ongoingStatuses(){try{let t=Object.entries(this._customStatusMap.value).filter(([o,a])=>a.type==="ongoing");if(t)return t.map(o=>o[1])}catch(e){this.loggingService.catch("Error in CustomFilterService ongoingStatuses: ",e)}return[V.CommentAnnotationStatusMap.IN_PROGRESS]}convertLegacyAnnotationStatus(e){try{if(typeof e.status=="string"||e.status===void 0){let t=Object.entries(this._customStatusMap.value),o=t.find(([a,l])=>l.type==="default");switch(e.status){case"open":o&&(e.status=o[1]);break;case"inProgress":let a=t.find(([s,d])=>d.type==="ongoing");a&&(e.status=a[1]);break;case"resolved":let l=t.find(([s,d])=>d.type==="terminal");l&&(e.status=l[1]);break;default:o&&(e.status=o[1]);break}}return e}catch(t){return this.loggingService.catch("Error in CustomFilterService convertLegacyAnnotation: ",t),e}}convertLegacyPriority(e){try{typeof e.priority=="string"&&(e.priority=V.CommentAnnotationPriorityMap[e.priority])}catch(t){this.loggingService.catch("Error in CustomFilterService convertLegacyPriority: ",t)}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(t=>V.CommentCategoryMap[t]))}catch(t){this.loggingService.catch("Error in CustomFilterService convertLegacyCategory: ",t)}return e}};r.\u0275fac=function(t){return new(t||r)(J(x))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var Rm=(()=>{let r=class r{static uniquifySvgIds(e){let t=`v${++r.idCounter}`,o=/\bid="([^"]+)"/g,a=[],l;for(;(l=o.exec(e))!==null;)a.push(l[1]);let s=e;for(let d of a){let v=d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),u=`${d}_${t}`;s=s.replace(new RegExp(`\\bid="${v}"`,"g"),`id="${u}"`),s=s.replace(new RegExp(`url\\(#${v}\\)`,"g"),`url(#${u})`),s=s.replace(new RegExp(`href="#${v}"`,"g"),`href="#${u}"`)}return s}constructor(e,t,o){this.domService=e,this.loggingService=t,this.sanitizer=o,this.emojis={},this.emojisSignal=Oe({}),this.rawSvgs={};try{this.loggingService.log("%c[WB] Creating CLASS: EmojiService","color: blue;"),Object.keys(r.Icons).forEach(a=>{let l=r.Icons[a];this.rawSvgs[a]=l,this.emojis[a]=this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeSvg(r.uniquifySvgIds(l)))}),Object.keys(r.GIF_PATHS).forEach(a=>{let l=`<img src="${r.GIF_PATHS[a]}" alt="${a}" />`;this.emojis[a]=this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeHtml(l))}),this.emojisSignal.set(b({},this.emojis))}catch(a){this.loggingService.catch("Error in EmojiService constructor: ",a)}}getEmoji(e){try{let t=this.rawSvgs[e];return t?this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeSvg(r.uniquifySvgIds(t))):this.emojis[e]}catch{return""}}getEmojiFromIconUrl(e){try{return this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeHtml(`<img src="${e}" alt="emoji" />`))}catch{return""}}getEmojiFromIconEmoji(e,t){try{let o=`<span class="velt-emoji-icon velt-emoji-icon--emoji">${e}</span>`;return t&&(o=`<span class="velt-emoji-icon velt-emoji-icon--emoji" emoji-id=${t}>${e}</span>`),this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeHtml(o))}catch{return""}}setEmojiList(e){try{this.emojis={},this.rawSvgs={},Object.keys(e).forEach(t=>{let o=e[t];if(o.svg)this.rawSvgs[t]=o.svg,this.emojis[t]=this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeSvg(r.uniquifySvgIds(o.svg)));else if(o.url){let a=`<img src="${o.url}" alt="${t}" />`;this.emojis[t]=this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeHtml(a))}else o.emoji&&(this.emojis[t]=this.getEmojiFromIconEmoji(this.domService.sanitizeHtml(o.emoji)))}),this.emojisSignal.set(b({},this.emojis))}catch(t){this.loggingService.catch("Error in EmojiService setEmojiList: ",t)}}};r.idCounter=0,r.Icons={RAISED_HANDS:`<svg width="58" height="57" viewBox="0 0 58 57" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
223
223
|
<path d="M35.8477 11.6603L40.4962 5.23427" stroke="#B0BEC5" stroke-width="1.92685" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
|
|
224
224
|
<path d="M21.8298 11.617L17.4655 6.02428" stroke="#B0BEC5" stroke-width="1.92685" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
|
|
225
225
|
<path d="M28.7568 9.77682L28.7761 1" stroke="#B0BEC5" stroke-width="1.92685" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
|
|
@@ -553,13 +553,13 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
553
553
|
`],encapsulation:3,changeDetection:0});let n=r;return n})();var Wye=(()=>{let r=class r{constructor(e,t,o,a,l,s,d,v){this.analyticsService=e,this.authService=t,this.configService=o,this.docService=a,this.databaseService=l,this.loggingService=s,this.notificationService=d,this.commonDbService=v}sendFeedback(e){try{let t=this.authService.getUser(),o=this.docService.getDocumentPaths();if(t&&o&&this.databaseService.getDbValue()){e.from=t?.isAnonymous?null:t,e.lastUpdated=this.serverTimestamp,e.apiKey=this.configService.getApiKey(),e.metadata=this.docService.getDocumentMetadata(),e.pageInfo=Wi(),e.id=this.commonDbService.generateDocumentId();let a=JSON.parse(JSON.stringify(e));this.commonDbService.setData({feature:"userFeedback",properties:{documentId:o?.documentId??"",organizationId:o?.organizationId??"",skipFirestore:!0},data:a}),this.updateNotificationsDatabase(a)}}catch(t){this.loggingService.catch("Error in UserFeedbackService sendFeedback: ",t)}}updateNotificationsDatabase(e){try{let t={notificationSource:"userFeedback",userFeedback:e};this.notificationService.updateNotificationDatabase(t)}catch(t){this.loggingService.catch("Error in UserFeedbackService updateNotificationsDatabase: ",t)}}get serverTimestamp(){return this.commonDbService.getServerTimestamp()}};r.\u0275fac=function(t){return new(t||r)(J(rt),J(Ge),J(Lt),J(lt),J(On),J(x),J(hn),J(xn))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();function jhn(n,r){if(n&1){let i=K();_(0,"input",14),M(1,"translate"),qo("ngModelChange",function(t){N(i);let o=c();return ma(o.feedbackForm.emailId,t)||(o.feedbackForm.emailId=t),F(t)}),y()}if(n&2){let i=c();g("placeholder",R(1,2,"Your email address")),Wo("ngModel",i.feedbackForm.emailId)}}var tK=(()=>{let r=class r{constructor(e,t,o,a,l,s,d){this.analyticsService=e,this.authService=t,this.loggingService=o,this.toastService=a,this.userFeedbackService=l,this.matDialogRef=s,this.matBottomSheetRef=d,this.subscriptions=[],this.feedbackForm={},this.veltElement=!0;try{this.subscriptions.push(this.authService.getUser$().subscribe(v=>{v?.email&&!v?.isAnonymous?this.user=v:this.user=null}))}catch(v){this.loggingService.catch("Error in FeedbackDialogComponent constructor: ",v)}}ngOnInit(){try{this.matDialogRef&&this.matDialogRef?.addPanelClass("snippyly-feedback-dialog")}catch(e){this.loggingService.catch("Error in FeedbackDialogComponent ngOnInit: ",e)}}submitFeedback(){try{this.user&&(this.feedbackForm.emailId=this.user.email),this.feedbackForm.emailId&&this.feedbackForm.message&&(this.userFeedbackService.sendFeedback({emailId:this.feedbackForm.emailId,message:this.feedbackForm.message}),this.analyticsService.trackEvent(Y.Events.Feedback.FEEDBACK_SUBMITTED),this.toastService.setToast({message:"Thank you for your feedback!",type:"success",duration:2e3}),this.closeDialog())}catch(e){this.loggingService.catch("Error in FeedbackDialogComponent submitFeedback: ",e)}}closeDialog(){try{this.matBottomSheetRef&&this.matBottomSheetRef?.dismiss(),this.matDialogRef&&this.matDialogRef?.close()}catch(e){this.loggingService.catch("Error in FeedbackDialogComponent closeDialog: ",e)}}ngOnDestroy(){try{this.subscriptions.forEach(e=>{e.unsubscribe()})}catch(e){this.loggingService.catch("Error in FeedbackDialogComponent ngOnDestroy: ",e)}}};r.\u0275fac=function(t){return new(t||r)(C(rt),C(Ge),C(x),C(Lm),C(Wye),C(ko,8),C(fm,8))},r.\u0275cmp=O({type:r,selectors:[["app-feedback-dialog"]],hostVars:1,hostBindings:function(t,o){t&2&&T("data-velt-element",o.veltElement)},standalone:!1,decls:22,vars:16,consts:[["feedbackFormRef","ngForm"],[1,"s-feedback-modal"],[1,"s-feedback-header"],[1,"s-feedback-header-title"],[1,"s-feedback-header-description"],[1,"s-feedback-modal-close",3,"click"],["width","20","height","20","viewBox","0 0 20 20","fill","none","xmlns","http://www.w3.org/2000/svg"],["fill-rule","evenodd","clip-rule","evenodd","d","M4.41009 4.41107C4.73553 4.08563 5.26317 4.08563 5.5886 4.41107L9.99935 8.82181L14.4101 4.41107C14.7355 4.08563 15.2632 4.08563 15.5886 4.41107C15.914 4.73651 15.914 5.26414 15.5886 5.58958L11.1779 10.0003L15.5886 14.4111C15.914 14.7365 15.914 15.2641 15.5886 15.5896C15.2632 15.915 14.7355 15.915 14.4101 15.5896L9.99935 11.1788L5.5886 15.5896C5.26317 15.915 4.73553 15.915 4.41009 15.5896C4.08466 15.2641 4.08466 14.7365 4.41009 14.4111L8.82084 10.0003L4.41009 5.58958C4.08466 5.26414 4.08466 4.73651 4.41009 4.41107Z","fill","#80808A"],[1,"s-feedback-body"],[1,"s-feedback-form"],["class","s-feedback-input","name","emailId","required","","email","",3,"placeholder","ngModel","ngModelChange",4,"ngIf"],["rows","5","name","message","required","",1,"s-feedback-input",3,"ngModelChange","placeholder","ngModel"],[1,"s-feedback-footer"],[1,"s-button","s-primary",3,"click"],["name","emailId","required","","email","",1,"s-feedback-input",3,"ngModelChange","placeholder","ngModel"]],template:function(t,o){if(t&1){let a=K();_(0,"div",1)(1,"div",2)(2,"div")(3,"div",3),ne(4),M(5,"translate"),y(),_(6,"div",4),ne(7),M(8,"translate"),y()(),_(9,"div",5),G("click",function(){return N(a),F(o.closeDialog())}),de(),_(10,"svg",6),D(11,"path",7),y()()(),bt(),_(12,"div",8)(13,"form",9,0),p(15,jhn,2,4,"input",10),_(16,"textarea",11),M(17,"translate"),qo("ngModelChange",function(s){return N(a),ma(o.feedbackForm.message,s)||(o.feedbackForm.message=s),F(s)}),y()()(),_(18,"div",12)(19,"div",13),G("click",function(){N(a);let s=Ce(14);return F(s!=null&&s.valid?o.submitFeedback():null)}),ne(20),M(21,"translate"),y()()()}if(t&2){let a=Ce(14);m(4),Ee(" ",R(5,8,"Feedback")," "),m(3),Ee(" ",R(8,10,"Provide feedback on your Superflow experience.")," "),m(8),g("ngIf",!o.user),m(),g("placeholder",R(17,12,"Tell us the details...")),Wo("ngModel",o.feedbackForm.message),m(3),ve("s-disabled",!(a!=null&&a.valid)),m(),Ee(" ",R(21,14,"Send")," ")}},dependencies:[se,n1,Ya,Ul,t1,zh,Gh,hl,Hh,ue],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}*[_ngcontent-%COMP%]{box-sizing:border-box;-webkit-tap-highlight-color:rgba(255,255,255,0)!important;outline:none!important;margin:0!important;padding:0!important;line-height:1.5!important;color:#000!important;font-size:calc((1rem + 0px) * var(--velt-base-rem-unit))}*[_ngcontent-%COMP%]:not(svg,rect,circle,ellipse,line,polyline,polygon,path,text,g,use,image,defs,hr){height:unset;width:unset}*[_ngcontent-%COMP%]:empty:not(svg,rect,circle,ellipse,line,polyline,polygon,path,text,g,use,image,defs,hr){display:revert!important}.s-feedback-modal[_ngcontent-%COMP%]{width:500px!important;background:#141416!important;padding:calc((2rem + 0px) * var(--velt-base-rem-unit))!important;gap:calc((2rem + 0px) * var(--velt-base-rem-unit))!important;display:flex;flex-direction:column;border-radius:20px!important;box-shadow:0 calc((4rem + 0px) * var(--velt-base-rem-unit)) calc((4rem + 0px) * var(--velt-base-rem-unit)) calc((-3rem + 0px) * var(--velt-base-rem-unit)) #1f2f461f}.s-feedback-modal[_ngcontent-%COMP%] .s-feedback-header[_ngcontent-%COMP%]{display:flex!important;justify-content:space-between!important}.s-feedback-modal[_ngcontent-%COMP%] .s-feedback-header[_ngcontent-%COMP%] .s-feedback-header-title[_ngcontent-%COMP%]{font-size:calc((1.5rem + 0px) * var(--velt-base-rem-unit))!important;font-weight:600!important;line-height:calc((2rem + 0px) * var(--velt-base-rem-unit))!important;color:#f4f5f6!important;margin-bottom:calc((1rem + 0px) * var(--velt-base-rem-unit))!important}.s-feedback-modal[_ngcontent-%COMP%] .s-feedback-header[_ngcontent-%COMP%] .s-feedback-header-description[_ngcontent-%COMP%]{font-size:calc((1rem + 0px) * var(--velt-base-rem-unit))!important;font-weight:400!important;line-height:calc((1.5rem + 0px) * var(--velt-base-rem-unit))!important;color:#80808a!important}.s-feedback-modal[_ngcontent-%COMP%] .s-feedback-header[_ngcontent-%COMP%] .s-feedback-modal-close[_ngcontent-%COMP%]{cursor:pointer!important}.s-feedback-modal[_ngcontent-%COMP%] .s-feedback-body[_ngcontent-%COMP%], .s-feedback-modal[_ngcontent-%COMP%] .s-feedback-body[_ngcontent-%COMP%] .s-feedback-form[_ngcontent-%COMP%]{display:flex!important;flex-direction:column!important;gap:calc((2rem + 0px) * var(--velt-base-rem-unit))!important}.s-feedback-modal[_ngcontent-%COMP%] .s-feedback-body[_ngcontent-%COMP%] .s-feedback-form[_ngcontent-%COMP%] textarea[_ngcontent-%COMP%]{resize:none!important}.s-feedback-modal[_ngcontent-%COMP%] .s-feedback-body[_ngcontent-%COMP%] .s-feedback-input[_ngcontent-%COMP%]{border-radius:calc((.75rem + 0px) * var(--velt-base-rem-unit))!important;border:2px solid #303034;background:transparent;font-family:inherit;padding:calc((.75rem + 0px) * var(--velt-base-rem-unit)) calc((1rem + 0px) * var(--velt-base-rem-unit))!important;color:#fff!important}.s-feedback-modal[_ngcontent-%COMP%] .s-feedback-footer[_ngcontent-%COMP%]{display:flex!important;justify-content:flex-end!important}.s-button[_ngcontent-%COMP%]{display:flex!important;align-items:center!important;justify-content:center!important;padding:calc((.75rem + 0px) * var(--velt-base-rem-unit)) calc((1.5rem + 0px) * var(--velt-base-rem-unit))!important;border-radius:calc((4rem + 0px) * var(--velt-base-rem-unit))!important;font-size:calc((1rem + 0px) * var(--velt-base-rem-unit))!important;transition:.1s ease!important;cursor:pointer!important}.s-primary[_ngcontent-%COMP%]{background:#625df5!important;color:#fff!important}.s-primary[_ngcontent-%COMP%]:not(.s-disabled):hover{background:#4f4bbf!important}.s-disabled[_ngcontent-%COMP%]{background:#939393!important;cursor:not-allowed!important} .velt-mat-dialog-container.snippyly-feedback-dialog mat-dialog-container .mat-mdc-dialog-surface.mdc-dialog__surface{background-color:transparent!important;padding:0!important;margin:0!important;border-radius:20px!important} .velt-mat-bottom-sheet-container.snippyly-feedback-bottom-sheet .mat-bottom-sheet-container{background-color:transparent!important;padding:0!important;margin:0!important;box-shadow:none!important} .velt-mat-bottom-sheet-container.snippyly-feedback-bottom-sheet .mat-bottom-sheet-container .s-feedback-modal{width:100%!important;border-bottom-left-radius:0!important;border-bottom-right-radius:0!important} .velt-mat-bottom-sheet-container.snippyly-feedback-bottom-sheet .mat-bottom-sheet-container .s-feedback-modal .s-button{flex-grow:1!important}@media screen and (max-width: 425px){ .snippyly-feedback-dialog{width:100vw!important;max-width:100vw!important;height:100vh!important} .snippyly-feedback-dialog .s-feedback-modal{width:100vw!important;height:100vh!important;max-width:100vw!important;max-height:100vh!important;border-radius:0!important} .snippyly-feedback-dialog .s-feedback-modal .s-feedback-body{flex-grow:1!important} .snippyly-feedback-dialog .s-feedback-modal .s-button{flex-grow:1!important}}"],changeDetection:0});let n=r;return n})();var qye=(()=>{let r=class r{constructor(e,t,o,a,l,s,d,v){this.analyticsService=e,this.authService=t,this.configService=o,this.docService=a,this.databaseService=l,this.loggingService=s,this.notificationService=d,this.commonDbService=v}sendContactUsData(e){try{let t=this.authService.getUser(),o=this.docService.getDocumentPaths();if(t&&o&&this.databaseService.getDbValue()){e.from=t?.isAnonymous?null:t,e.lastUpdated=this.serverTimestamp,e.apiKey=this.configService.getApiKey(),e.metadata=this.docService.getDocumentMetadata(),e.pageInfo=Wi(),e.id=this.commonDbService.generateDocumentId();let a=JSON.parse(JSON.stringify(e));this.commonDbService.setData({feature:"userContactUs",properties:{documentId:o?.documentId??"",organizationId:o?.organizationId??"",skipFirestore:!0},data:a}),this.updateNotificationsDatabase(a)}}catch(t){this.loggingService.catch("Error in UserContactUsService sendContactUsData: ",t)}}updateNotificationsDatabase(e){try{let t={notificationSource:"userContactUs",userContactUs:e};this.notificationService.updateNotificationDatabase(t)}catch(t){this.loggingService.catch("Error in UserContactUsService updateNotificationsDatabase: ",t)}}get serverTimestamp(){return this.commonDbService.getServerTimestamp()}};r.\u0275fac=function(t){return new(t||r)(J(rt),J(Ge),J(Lt),J(lt),J(On),J(x),J(hn),J(xn))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();function Hhn(n,r){if(n&1){let i=K();_(0,"input",14),M(1,"translate"),qo("ngModelChange",function(t){N(i);let o=c();return ma(o.contactUsForm.emailId,t)||(o.contactUsForm.emailId=t),F(t)}),y()}if(n&2){let i=c();g("placeholder",R(1,2,"Your email address")),Wo("ngModel",i.contactUsForm.emailId)}}var nK=(()=>{let r=class r{constructor(e,t,o,a,l,s,d){this.analyticsService=e,this.authService=t,this.loggingService=o,this.toastService=a,this.userContactUsService=l,this.matDialogRef=s,this.matBottomSheetRef=d,this.subscriptions=[],this.contactUsForm={},this.veltElement=!0;try{this.subscriptions.push(this.authService.getUser$().subscribe(v=>{v?.email&&!v?.isAnonymous?this.user=v:this.user=null}))}catch(v){this.loggingService.catch("Error in ContactUsDialogComponent constructor: ",v)}}ngOnInit(){try{this.matDialogRef&&this.matDialogRef?.addPanelClass("snippyly-contact-us-dialog")}catch(e){this.loggingService.catch("Error in ContactUsDialogComponent ngOnInit: ",e)}}submitForm(){try{this.user&&(this.contactUsForm.emailId=this.user.email),this.contactUsForm.emailId&&this.contactUsForm.message&&(this.userContactUsService.sendContactUsData({emailId:this.contactUsForm.emailId,message:this.contactUsForm.message}),this.analyticsService.trackEvent(Y.Events.ContactUs.CONTACT_SUBMITTED),this.toastService.setToast({message:"Thank you! We will get back to you soon.",type:"success",duration:2e3}),this.closeDialog())}catch(e){this.loggingService.catch("Error in ContactUsDialogComponent submitForm: ",e)}}closeDialog(){try{this.matBottomSheetRef&&this.matBottomSheetRef?.dismiss(),this.matDialogRef&&this.matDialogRef?.close()}catch(e){this.loggingService.catch("Error in ContactUsDialogComponent closeDialog: ",e)}}ngOnDestroy(){try{this.subscriptions.forEach(e=>{e.unsubscribe()})}catch(e){this.loggingService.catch("Error in ContactUsDialogComponent ngOnDestroy: ",e)}}};r.\u0275fac=function(t){return new(t||r)(C(rt),C(Ge),C(x),C(Lm),C(qye),C(ko,8),C(fm,8))},r.\u0275cmp=O({type:r,selectors:[["app-contact-us-dialog"]],hostVars:1,hostBindings:function(t,o){t&2&&T("data-velt-element",o.veltElement)},standalone:!1,decls:22,vars:16,consts:[["contactUsFormRef","ngForm"],[1,"s-contact-us-modal"],[1,"s-contact-us-header"],[1,"s-contact-us-header-title"],[1,"s-contact-us-header-description"],[1,"s-contact-us-modal-close",3,"click"],["width","20","height","20","viewBox","0 0 20 20","fill","none","xmlns","http://www.w3.org/2000/svg"],["fill-rule","evenodd","clip-rule","evenodd","d","M4.41009 4.41107C4.73553 4.08563 5.26317 4.08563 5.5886 4.41107L9.99935 8.82181L14.4101 4.41107C14.7355 4.08563 15.2632 4.08563 15.5886 4.41107C15.914 4.73651 15.914 5.26414 15.5886 5.58958L11.1779 10.0003L15.5886 14.4111C15.914 14.7365 15.914 15.2641 15.5886 15.5896C15.2632 15.915 14.7355 15.915 14.4101 15.5896L9.99935 11.1788L5.5886 15.5896C5.26317 15.915 4.73553 15.915 4.41009 15.5896C4.08466 15.2641 4.08466 14.7365 4.41009 14.4111L8.82084 10.0003L4.41009 5.58958C4.08466 5.26414 4.08466 4.73651 4.41009 4.41107Z","fill","#80808A"],[1,"s-contact-us-body"],[1,"s-contact-us-form"],["class","s-contact-us-input","name","emailId","required","","email","",3,"placeholder","ngModel","ngModelChange",4,"ngIf"],["rows","5","name","message","required","",1,"s-contact-us-input",3,"ngModelChange","placeholder","ngModel"],[1,"s-contact-us-footer"],[1,"s-button","s-primary",3,"click"],["name","emailId","required","","email","",1,"s-contact-us-input",3,"ngModelChange","placeholder","ngModel"]],template:function(t,o){if(t&1){let a=K();_(0,"div",1)(1,"div",2)(2,"div")(3,"div",3),ne(4),M(5,"translate"),y(),_(6,"div",4),ne(7),M(8,"translate"),y()(),_(9,"div",5),G("click",function(){return N(a),F(o.closeDialog())}),de(),_(10,"svg",6),D(11,"path",7),y()()(),bt(),_(12,"div",8)(13,"form",9,0),p(15,Hhn,2,4,"input",10),_(16,"textarea",11),M(17,"translate"),qo("ngModelChange",function(s){return N(a),ma(o.contactUsForm.message,s)||(o.contactUsForm.message=s),F(s)}),y()()(),_(18,"div",12)(19,"div",13),G("click",function(){N(a);let s=Ce(14);return F(s!=null&&s.valid?o.submitForm():null)}),ne(20),M(21,"translate"),y()()()}if(t&2){let a=Ce(14);m(4),Ee(" ",R(5,8,"Contact us")," "),m(3),Ee(" ",R(8,10,"Let us know how can we help you!")," "),m(8),g("ngIf",!o.user),m(),g("placeholder",R(17,12,"How can we help?")),Wo("ngModel",o.contactUsForm.message),m(3),ve("s-disabled",!(a!=null&&a.valid)),m(),Ee(" ",R(21,14,"Send")," ")}},dependencies:[se,n1,Ya,Ul,t1,zh,Gh,hl,Hh,ue],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}*[_ngcontent-%COMP%]{box-sizing:border-box;-webkit-tap-highlight-color:rgba(255,255,255,0)!important;outline:none!important;margin:0!important;padding:0!important;line-height:1.5!important;color:#000!important;font-size:calc((1rem + 0px) * var(--velt-base-rem-unit))}*[_ngcontent-%COMP%]:not(svg,rect,circle,ellipse,line,polyline,polygon,path,text,g,use,image,defs,hr){height:unset;width:unset}*[_ngcontent-%COMP%]:empty:not(svg,rect,circle,ellipse,line,polyline,polygon,path,text,g,use,image,defs,hr){display:revert!important}.s-contact-us-modal[_ngcontent-%COMP%]{width:500px!important;background:#141416!important;padding:calc((2rem + 0px) * var(--velt-base-rem-unit))!important;gap:calc((2rem + 0px) * var(--velt-base-rem-unit))!important;display:flex;flex-direction:column;border-radius:20px!important;box-shadow:0 calc((4rem + 0px) * var(--velt-base-rem-unit)) calc((4rem + 0px) * var(--velt-base-rem-unit)) calc((-3rem + 0px) * var(--velt-base-rem-unit)) #1f2f461f}.s-contact-us-modal[_ngcontent-%COMP%] .s-contact-us-header[_ngcontent-%COMP%]{display:flex!important;justify-content:space-between!important}.s-contact-us-modal[_ngcontent-%COMP%] .s-contact-us-header[_ngcontent-%COMP%] .s-contact-us-header-title[_ngcontent-%COMP%]{font-size:calc((1.5rem + 0px) * var(--velt-base-rem-unit))!important;font-weight:600!important;line-height:calc((2rem + 0px) * var(--velt-base-rem-unit))!important;color:#f4f5f6!important;margin-bottom:calc((1rem + 0px) * var(--velt-base-rem-unit))!important}.s-contact-us-modal[_ngcontent-%COMP%] .s-contact-us-header[_ngcontent-%COMP%] .s-contact-us-header-description[_ngcontent-%COMP%]{font-size:calc((1rem + 0px) * var(--velt-base-rem-unit))!important;font-weight:400!important;line-height:calc((1.5rem + 0px) * var(--velt-base-rem-unit))!important;color:#80808a!important}.s-contact-us-modal[_ngcontent-%COMP%] .s-contact-us-header[_ngcontent-%COMP%] .s-contact-us-modal-close[_ngcontent-%COMP%]{cursor:pointer!important}.s-contact-us-modal[_ngcontent-%COMP%] .s-contact-us-body[_ngcontent-%COMP%], .s-contact-us-modal[_ngcontent-%COMP%] .s-contact-us-body[_ngcontent-%COMP%] .s-contact-us-form[_ngcontent-%COMP%]{display:flex!important;flex-direction:column!important;gap:calc((2rem + 0px) * var(--velt-base-rem-unit))!important}.s-contact-us-modal[_ngcontent-%COMP%] .s-contact-us-body[_ngcontent-%COMP%] .s-contact-us-form[_ngcontent-%COMP%] textarea[_ngcontent-%COMP%]{resize:none!important}.s-contact-us-modal[_ngcontent-%COMP%] .s-contact-us-body[_ngcontent-%COMP%] .s-contact-us-input[_ngcontent-%COMP%]{border-radius:calc((.75rem + 0px) * var(--velt-base-rem-unit))!important;border:2px solid #303034;background:transparent;font-family:inherit;padding:calc((.75rem + 0px) * var(--velt-base-rem-unit)) calc((1rem + 0px) * var(--velt-base-rem-unit))!important;color:#fff!important}.s-contact-us-modal[_ngcontent-%COMP%] .s-contact-us-footer[_ngcontent-%COMP%]{display:flex!important;justify-content:flex-end!important}.s-button[_ngcontent-%COMP%]{display:flex!important;align-items:center!important;justify-content:center!important;padding:calc((.75rem + 0px) * var(--velt-base-rem-unit)) calc((1.5rem + 0px) * var(--velt-base-rem-unit))!important;border-radius:calc((4rem + 0px) * var(--velt-base-rem-unit))!important;font-size:calc((1rem + 0px) * var(--velt-base-rem-unit))!important;transition:.1s ease!important;cursor:pointer!important}.s-primary[_ngcontent-%COMP%]{background:#625df5!important;color:#fff!important}.s-primary[_ngcontent-%COMP%]:not(.s-disabled):hover{background:#4f4bbf!important}.s-disabled[_ngcontent-%COMP%]{background:#939393!important;cursor:not-allowed!important} .velt-mat-dialog-container.snippyly-contact-us-dialog mat-dialog-container .mat-mdc-dialog-surface.mdc-dialog__surface{background-color:transparent!important;padding:0!important;margin:0!important;border-radius:20px!important} .velt-mat-bottom-sheet-container.snippyly-contact-us-bottom-sheet .mat-bottom-sheet-container{background-color:transparent!important;padding:0!important;margin:0!important;box-shadow:none!important} .velt-mat-bottom-sheet-container.snippyly-contact-us-bottom-sheet .mat-bottom-sheet-container .s-contact-us-modal{width:100%!important;border-bottom-left-radius:0!important;border-bottom-right-radius:0!important} .velt-mat-bottom-sheet-container.snippyly-contact-us-bottom-sheet .mat-bottom-sheet-container .s-contact-us-modal .s-button{flex-grow:1!important}@media screen and (max-width: 425px){ .snippyly-contact-us-dialog{width:100vw!important;max-width:100vw!important;height:100vh!important} .snippyly-contact-us-dialog .s-contact-us-modal{width:100vw!important;height:100vh!important;max-width:100vw!important;max-height:100vh!important;border-radius:0!important} .snippyly-contact-us-dialog .s-contact-us-modal .s-contact-us-body{flex-grow:1!important} .snippyly-contact-us-dialog .s-contact-us-modal .s-button{flex-grow:1!important}}"],changeDetection:0});let n=r;return n})();var Yye=(()=>{let r=class r{constructor(e,t,o,a,l,s,d,v){this.analyticsService=e,this.authService=t,this.configService=o,this.docService=a,this.databaseService=l,this.loggingService=s,this.notificationService=d,this.commonDbService=v}submitIssue(e){try{let t=this.authService.getUser(),o=this.docService.getDocumentPaths();if(t&&o&&this.databaseService.getDbValue()){e.from=t?.isAnonymous?null:t,e.lastUpdated=this.serverTimestamp,e.apiKey=this.configService.getApiKey(),e.metadata=this.docService.getDocumentMetadata(),e.pageInfo=Wi(),e.id=this.commonDbService.generateDocumentId();let a=JSON.parse(JSON.stringify(e));this.commonDbService.setData({feature:"userReportBug",properties:{documentId:o?.documentId??"",organizationId:o?.organizationId??"",skipFirestore:!0},data:a}),this.updateNotificationsDatabase(a)}}catch(t){this.loggingService.catch("Error in UserReportBugService submitIssue: ",t)}}updateNotificationsDatabase(e){try{let t={notificationSource:"userReportBug",userReportBug:e};this.notificationService.updateNotificationDatabase(t)}catch(t){this.loggingService.catch("Error in UserReportBugService updateNotificationsDatabase: ",t)}}get serverTimestamp(){return this.commonDbService.getServerTimestamp()}};r.\u0275fac=function(t){return new(t||r)(J(rt),J(Ge),J(Lt),J(lt),J(On),J(x),J(hn),J(xn))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();function Ghn(n,r){if(n&1){let i=K();_(0,"input",14),M(1,"translate"),qo("ngModelChange",function(t){N(i);let o=c();return ma(o.issueForm.emailId,t)||(o.issueForm.emailId=t),F(t)}),y()}if(n&2){let i=c();g("placeholder",R(1,2,"Your email address")),Wo("ngModel",i.issueForm.emailId)}}var iK=(()=>{let r=class r{constructor(e,t,o,a,l,s,d){this.analyticsService=e,this.authService=t,this.loggingService=o,this.toastService=a,this.userReportBugService=l,this.matDialogRef=s,this.matBottomSheetRef=d,this.subscriptions=[],this.issueForm={},this.veltElement=!0;try{this.subscriptions.push(this.authService.getUser$().subscribe(v=>{v?.email&&!v?.isAnonymous?this.user=v:this.user=null}))}catch(v){this.loggingService.catch("Error in ReportBugDialogComponent constructor: ",v)}}ngOnInit(){try{this.matDialogRef&&this.matDialogRef?.addPanelClass("snippyly-feedback-dialog")}catch(e){this.loggingService.catch("Error in ReportBugDialogComponent ngOnInit: ",e)}}submitIssue(){try{this.user&&(this.issueForm.emailId=this.user.email),this.issueForm.emailId&&this.issueForm.message&&(this.userReportBugService.submitIssue({emailId:this.issueForm.emailId,message:this.issueForm.message}),this.analyticsService.trackEvent(Y.Events.Bug.BUG_SUBMITTED),this.toastService.setToast({message:"Thanks for reporting the bug. We will get back to you soon.",type:"success",duration:2e3}),this.closeDialog())}catch(e){this.loggingService.catch("Error in ReportBugDialogComponent submitFeedback: ",e)}}closeDialog(){this.matBottomSheetRef&&this.matBottomSheetRef.dismiss(),this.matDialogRef&&this.matDialogRef.close()}ngOnDestroy(){try{this.subscriptions.forEach(e=>{e.unsubscribe()})}catch(e){this.loggingService.catch("Error in ReportBugDialogComponent ngOnDestroy: ",e)}}};r.\u0275fac=function(t){return new(t||r)(C(rt),C(Ge),C(x),C(Lm),C(Yye),C(ko,8),C(fm,8))},r.\u0275cmp=O({type:r,selectors:[["snippyly-report-bug-dialog"]],hostVars:1,hostBindings:function(t,o){t&2&&T("data-velt-element",o.veltElement)},standalone:!1,decls:22,vars:16,consts:[["issueFormRef","ngForm"],[1,"s-report-bug-modal"],[1,"s-report-bug-header"],[1,"s-report-bug-header-title"],[1,"s-report-bug-header-description"],[1,"s-report-bug-modal-close",3,"click"],["width","20","height","20","viewBox","0 0 20 20","fill","none","xmlns","http://www.w3.org/2000/svg"],["fill-rule","evenodd","clip-rule","evenodd","d","M4.41009 4.41107C4.73553 4.08563 5.26317 4.08563 5.5886 4.41107L9.99935 8.82181L14.4101 4.41107C14.7355 4.08563 15.2632 4.08563 15.5886 4.41107C15.914 4.73651 15.914 5.26414 15.5886 5.58958L11.1779 10.0003L15.5886 14.4111C15.914 14.7365 15.914 15.2641 15.5886 15.5896C15.2632 15.915 14.7355 15.915 14.4101 15.5896L9.99935 11.1788L5.5886 15.5896C5.26317 15.915 4.73553 15.915 4.41009 15.5896C4.08466 15.2641 4.08466 14.7365 4.41009 14.4111L8.82084 10.0003L4.41009 5.58958C4.08466 5.26414 4.08466 4.73651 4.41009 4.41107Z","fill","#80808A"],[1,"s-report-bug-body"],[1,"s-report-bug-form"],["class","s-report-bug-input","name","emailId","required","","email","",3,"placeholder","ngModel","ngModelChange",4,"ngIf"],["rows","5","name","message","required","",1,"s-report-bug-input",3,"ngModelChange","placeholder","ngModel"],[1,"s-report-bug-footer"],[1,"s-button","s-primary",3,"click"],["name","emailId","required","","email","",1,"s-report-bug-input",3,"ngModelChange","placeholder","ngModel"]],template:function(t,o){if(t&1){let a=K();_(0,"div",1)(1,"div",2)(2,"div")(3,"div",3),ne(4),M(5,"translate"),y(),_(6,"div",4),ne(7),M(8,"translate"),y()(),_(9,"div",5),G("click",function(){return N(a),F(o.closeDialog())}),de(),_(10,"svg",6),D(11,"path",7),y()()(),bt(),_(12,"div",8)(13,"form",9,0),p(15,Ghn,2,4,"input",10),_(16,"textarea",11),M(17,"translate"),qo("ngModelChange",function(s){return N(a),ma(o.issueForm.message,s)||(o.issueForm.message=s),F(s)}),y()()(),_(18,"div",12)(19,"div",13),G("click",function(){N(a);let s=Ce(14);return F(s!=null&&s.valid?o.submitIssue():null)}),ne(20),M(21,"translate"),y()()()}if(t&2){let a=Ce(14);m(4),Ee(" ",R(5,8,"Report bugs")," "),m(3),Ee(" ",R(8,10,"Let us know about any bugs so we can fix them ASAP!")," "),m(8),g("ngIf",!o.user),m(),g("placeholder",R(17,12,"Tell us the details...")),Wo("ngModel",o.issueForm.message),m(3),ve("s-disabled",!(a!=null&&a.valid)),m(),Ee(" ",R(21,14,"Send")," ")}},dependencies:[se,n1,Ya,Ul,t1,zh,Gh,hl,Hh,ue],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}*[_ngcontent-%COMP%]{box-sizing:border-box;-webkit-tap-highlight-color:rgba(255,255,255,0)!important;outline:none!important;margin:0!important;padding:0!important;line-height:1.5!important;color:#000!important;font-size:calc((1rem + 0px) * var(--velt-base-rem-unit))}*[_ngcontent-%COMP%]:not(svg,rect,circle,ellipse,line,polyline,polygon,path,text,g,use,image,defs,hr){height:unset;width:unset}*[_ngcontent-%COMP%]:empty:not(svg,rect,circle,ellipse,line,polyline,polygon,path,text,g,use,image,defs,hr){display:revert!important}.s-report-bug-modal[_ngcontent-%COMP%]{width:500px!important;background:#141416!important;padding:calc((2rem + 0px) * var(--velt-base-rem-unit))!important;gap:calc((2rem + 0px) * var(--velt-base-rem-unit))!important;display:flex;flex-direction:column;border-radius:20px!important;box-shadow:0 calc((4rem + 0px) * var(--velt-base-rem-unit)) calc((4rem + 0px) * var(--velt-base-rem-unit)) calc((-3rem + 0px) * var(--velt-base-rem-unit)) #1f2f461f}.s-report-bug-modal[_ngcontent-%COMP%] .s-report-bug-header[_ngcontent-%COMP%]{display:flex!important;justify-content:space-between!important}.s-report-bug-modal[_ngcontent-%COMP%] .s-report-bug-header[_ngcontent-%COMP%] .s-report-bug-header-title[_ngcontent-%COMP%]{font-size:calc((1.5rem + 0px) * var(--velt-base-rem-unit))!important;font-weight:600!important;line-height:calc((2rem + 0px) * var(--velt-base-rem-unit))!important;color:#f4f5f6!important;margin-bottom:calc((1rem + 0px) * var(--velt-base-rem-unit))!important}.s-report-bug-modal[_ngcontent-%COMP%] .s-report-bug-header[_ngcontent-%COMP%] .s-report-bug-header-description[_ngcontent-%COMP%]{font-size:calc((1rem + 0px) * var(--velt-base-rem-unit))!important;font-weight:400!important;line-height:calc((1.5rem + 0px) * var(--velt-base-rem-unit))!important;color:#80808a!important}.s-report-bug-modal[_ngcontent-%COMP%] .s-report-bug-header[_ngcontent-%COMP%] .s-report-bug-modal-close[_ngcontent-%COMP%]{cursor:pointer!important}.s-report-bug-modal[_ngcontent-%COMP%] .s-report-bug-body[_ngcontent-%COMP%], .s-report-bug-modal[_ngcontent-%COMP%] .s-report-bug-body[_ngcontent-%COMP%] .s-report-bug-form[_ngcontent-%COMP%]{display:flex!important;flex-direction:column!important;gap:calc((2rem + 0px) * var(--velt-base-rem-unit))!important}.s-report-bug-modal[_ngcontent-%COMP%] .s-report-bug-body[_ngcontent-%COMP%] .s-report-bug-form[_ngcontent-%COMP%] textarea[_ngcontent-%COMP%]{resize:none!important}.s-report-bug-modal[_ngcontent-%COMP%] .s-report-bug-body[_ngcontent-%COMP%] .s-report-bug-input[_ngcontent-%COMP%]{border-radius:calc((.75rem + 0px) * var(--velt-base-rem-unit))!important;border:2px solid #303034;background:transparent;font-family:inherit;padding:calc((.75rem + 0px) * var(--velt-base-rem-unit)) calc((1rem + 0px) * var(--velt-base-rem-unit))!important;color:#fff!important}.s-report-bug-modal[_ngcontent-%COMP%] .s-report-bug-footer[_ngcontent-%COMP%]{display:flex!important;justify-content:flex-end!important}.s-button[_ngcontent-%COMP%]{display:flex!important;align-items:center!important;justify-content:center!important;padding:calc((.75rem + 0px) * var(--velt-base-rem-unit)) calc((1.5rem + 0px) * var(--velt-base-rem-unit))!important;border-radius:calc((4rem + 0px) * var(--velt-base-rem-unit))!important;font-size:calc((1rem + 0px) * var(--velt-base-rem-unit))!important;transition:.1s ease!important;cursor:pointer!important}.s-primary[_ngcontent-%COMP%]{background:#625df5!important;color:#fff!important}.s-primary[_ngcontent-%COMP%]:not(.s-disabled):hover{background:#4f4bbf!important}.s-disabled[_ngcontent-%COMP%]{background:#939393!important;cursor:not-allowed!important} .velt-mat-dialog-container.snippyly-report-bug-dialog mat-dialog-container .mat-mdc-dialog-surface.mdc-dialog__surface{background-color:transparent!important;padding:0!important;margin:0!important;border-radius:20px!important} .velt-mat-bottom-sheet-container.snippyly-report-bug-bottom-sheet .mat-bottom-sheet-container{background-color:transparent!important;padding:0!important;margin:0!important;box-shadow:none!important} .velt-mat-bottom-sheet-container.snippyly-report-bug-bottom-sheet .mat-bottom-sheet-container .s-report-bug-modal{width:100%!important;border-bottom-left-radius:0!important;border-bottom-right-radius:0!important} .velt-mat-bottom-sheet-container.snippyly-report-bug-bottom-sheet .mat-bottom-sheet-container .s-report-bug-modal .s-button{flex-grow:1!important}@media screen and (max-width: 425px){ .snippyly-report-bug-dialog{width:100vw!important;max-width:100vw!important;height:100vh!important} .snippyly-report-bug-dialog .s-report-bug-modal{width:100vw!important;height:100vh!important;max-width:100vw!important;max-height:100vh!important;border-radius:0!important} .snippyly-report-bug-dialog .s-report-bug-modal .s-report-bug-body{flex-grow:1!important} .snippyly-report-bug-dialog .s-report-bug-modal .s-button{flex-grow:1!important}}"],changeDetection:0});let n=r;return n})();var Whn=["customBtnRef"],qhn=["*"];function Yhn(n,r){n&1&&(_(0,"div",7),de(),_(1,"svg",8),D(2,"path",9),y(),bt(),_(3,"span",10),ne(4),M(5,"translate"),y()()),n&2&&(m(4),Ke(R(5,1,"Give feedback")))}function Khn(n,r){n&1&&(_(0,"div",7),de(),_(1,"svg",11),D(2,"path",12),y(),bt(),_(3,"span",10),ne(4),M(5,"translate"),y()()),n&2&&(m(4),Ke(R(5,1,"Report bugs")))}function Zhn(n,r){n&1&&(_(0,"div",7),de(),_(1,"svg",13),D(2,"path",14)(3,"path",15),y(),bt(),_(4,"span",10),ne(5),M(6,"translate"),y()()),n&2&&(m(5),Ke(R(6,1,"Contact us")))}function Xhn(n,r){if(n&1&&(_(0,"div",5),p(1,Yhn,6,3,"div",6)(2,Khn,6,3,"div",6)(3,Zhn,7,3,"div",6),y()),n&2){let i=c();g("ngSwitch",i.type),m(),g("ngSwitchCase","feedback"),m(),g("ngSwitchCase","reportBug"),m(),g("ngSwitchCase","contactUs")}}function Jhn(n,r){n&1&&Xe(0)}function Qhn(n,r){if(n&1&&(_(0,"div",16,1),p(2,Jhn,1,0,"ng-container",17),y()),n&2){c();let i=Ce(4);m(2),g("ngTemplateOutlet",i)}}function efn(n,r){n&1&&jt(0)}var rK=(()=>{let r=class r extends Ct{constructor(e,t,o,a,l,s,d){super(d,o),this.analyticsService=e,this.loggingService=t,this.themeService=o,this.dialog=a,this.bottomSheet=l,this.breakpointObserver=s,this.elementRef=d,this.type="feedback",this.showDefaultBtn=!1,this.veltElement=!0}ngOnDestroy(){try{super.ngOnDestroy()}catch{}}ngAfterViewInit(){try{this.customBtnRef?.nativeElement?.children?.length||(this.showDefaultBtn=!0)}catch(e){this.loggingService.catch("Error in UserRequestToolComponent view inti: ",e)}}openDialog(){try{switch(this.type){case"feedback":this.openFeedbackDialog();break;case"reportBug":this.openReportBugDialog();break;case"contactUs":this.openContactUsDialog();break;default:break}}catch(e){this.loggingService.catch("Error in UserRequestToolComponent openDialog: ",e)}}openFeedbackDialog(){try{this.analyticsService.trackEvent(Y.Events.Feedback.FEEDBACK_BUTTON_CLICKED),this.isMobile()?this.bottomSheet.open(tK,{panelClass:["snippyly-feedback-bottom-sheet","velt-mat-bottom-sheet-container"],backdropClass:"s-background-blur-1"}):this.dialog.open(tK,{panelClass:["snippyly-feedback-dialog","velt-mat-dialog-container"],backdropClass:"s-background-blur-1"})}catch(e){this.loggingService.catch("Error in UserRequestToolComponent openFeedbackDialog: ",e)}}openReportBugDialog(){try{this.analyticsService.trackEvent(Y.Events.Bug.BUG_BUTTON_CLICKED),this.isMobile()?this.bottomSheet.open(iK,{panelClass:["snippyly-report-bug-bottom-sheet","velt-mat-bottom-sheet-container"],backdropClass:"s-background-blur-1"}):this.dialog.open(iK,{panelClass:["snippyly-report-bug-dialog","velt-mat-dialog-container"],backdropClass:"s-background-blur-1"})}catch(e){this.loggingService.catch("Error in UserRequestToolComponent openReportBugDialog: ",e)}}openContactUsDialog(){try{this.analyticsService.trackEvent(Y.Events.ContactUs.CONTACT_BUTTON_CLICKED),this.isMobile()?this.bottomSheet.open(nK,{panelClass:["snippyly-contact-us-bottom-sheet","velt-mat-bottom-sheet-container"],backdropClass:"s-background-blur-1"}):this.dialog.open(nK,{panelClass:["snippyly-contact-us-dialog","velt-mat-dialog-container"],backdropClass:"s-background-blur-1"})}catch(e){this.loggingService.catch("Error in UserRequestToolComponent openContactUsDialog: ",e)}}isMobile(){return this.breakpointObserver.isMatched("(max-width: 599px)")}};r.\u0275fac=function(t){return new(t||r)(C(rt),C(x),C(mt),C(Ir),C(vd),C(Ur),C(z))},r.\u0275cmp=O({type:r,selectors:[["snippyly-user-request-tool"]],viewQuery:function(t,o){if(t&1&&dt(Whn,5),t&2){let a;ot(a=at())&&(o.customBtnRef=a.first)}},hostVars:1,hostBindings:function(t,o){t&2&&T("data-velt-element",o.veltElement)},inputs:{type:"type"},standalone:!1,features:[L],ngContentSelectors:qhn,decls:5,vars:2,consts:[["content",""],["customBtnRef",""],[1,"user-request-tool-container",3,"click"],[3,"ngSwitch",4,"ngIf"],["class","snippyly-custom-button-container",4,"ngIf"],[3,"ngSwitch"],["class","s-user-request-tool-button",4,"ngSwitchCase"],[1,"s-user-request-tool-button"],["width","20","height","20","viewBox","0 0 20 20","fill","none","xmlns","http://www.w3.org/2000/svg",1,"s-user-request-tool-button-icon"],["fill-rule","evenodd","clip-rule","evenodd","d","M10.5757 5.76422C10.2533 6.07365 9.74414 6.07365 9.4217 5.76422L8.8447 5.2105C8.16934 4.56239 7.25698 4.16667 6.2487 4.16667C4.17763 4.16667 2.4987 5.8456 2.4987 7.91667C2.4987 9.90219 3.57352 11.5417 5.12516 12.8888C6.67813 14.237 8.53486 15.1312 9.64424 15.5876C9.87619 15.683 10.1212 15.683 10.3532 15.5876C11.4625 15.1312 13.3193 14.237 14.8722 12.8888C16.4239 11.5417 17.4987 9.90218 17.4987 7.91667C17.4987 5.8456 15.8198 4.16667 13.7487 4.16667C12.7404 4.16667 11.8281 4.56239 11.1527 5.2105L10.5757 5.76422ZM9.9987 4.00798C9.02545 3.074 7.70411 2.5 6.2487 2.5C3.25716 2.5 0.832031 4.92512 0.832031 7.91667C0.832031 13.2235 6.64065 16.1542 9.01019 17.1289C9.64834 17.3914 10.3491 17.3914 10.9872 17.1289C13.3567 16.1542 19.1654 13.2235 19.1654 7.91667C19.1654 4.92512 16.7402 2.5 13.7487 2.5C12.2933 2.5 10.9719 3.074 9.9987 4.00798Z","fill","#4C5366"],[1,"s-user-request-tool-button-text"],["width","16","height","20","viewBox","0 0 16 18","fill","none","xmlns","http://www.w3.org/2000/svg"],["d","M8 17.9996C6.91667 17.9996 5.91267 17.733 4.988 17.1996C4.06267 16.6663 3.33333 15.933 2.8 14.9996H0.975C0.691667 14.9996 0.458333 14.9036 0.275 14.7116C0.0916668 14.5203 0 14.283 0 13.9996C0 13.7163 0.0956668 13.479 0.287 13.2876C0.479 13.0956 0.716667 12.9996 1 12.9996H2.1C2.05 12.6663 2.021 12.333 2.013 11.9996C2.00433 11.6663 2 11.333 2 10.9996H0.975C0.691667 10.9996 0.458333 10.9036 0.275 10.7116C0.0916668 10.5203 0 10.283 0 9.99963C0 9.7163 0.0956668 9.47863 0.287 9.28663C0.479 9.0953 0.716667 8.99963 1 8.99963H2C2 8.6663 2.00433 8.33297 2.013 7.99963C2.021 7.6663 2.05 7.33297 2.1 6.99963H0.975C0.691667 6.99963 0.458333 6.90363 0.275 6.71163C0.0916668 6.5203 0 6.28297 0 5.99963C0 5.7163 0.0956668 5.47863 0.287 5.28663C0.479 5.0953 0.716667 4.99963 1 4.99963H2.8C3.03333 4.6163 3.296 4.25797 3.588 3.92463C3.87933 3.5913 4.21667 3.29963 4.6 3.04963L3.675 2.09963C3.49167 1.89963 3.40433 1.66197 3.413 1.38663C3.421 1.11197 3.51667 0.882968 3.7 0.699635C3.88333 0.516301 4.11667 0.424635 4.4 0.424635C4.68333 0.424635 4.91667 0.516301 5.1 0.699635L6.55 2.14963C7.01667 1.99963 7.49167 1.92463 7.975 1.92463C8.45833 1.92463 8.93333 1.99963 9.4 2.14963L10.9 0.674635C11.1 0.491301 11.3377 0.403635 11.613 0.411635C11.8877 0.420301 12.1167 0.516301 12.3 0.699635C12.4833 0.882968 12.575 1.1163 12.575 1.39963C12.575 1.68297 12.4833 1.9163 12.3 2.09963L11.35 3.04963C11.7333 3.29963 12.0793 3.58697 12.388 3.91163C12.696 4.23697 12.9667 4.59963 13.2 4.99963H15.025C15.3083 4.99963 15.5417 5.0953 15.725 5.28663C15.9083 5.47863 16 5.7163 16 5.99963C16 6.28297 15.904 6.5203 15.712 6.71163C15.5207 6.90363 15.2833 6.99963 15 6.99963H13.9C13.95 7.33297 13.9793 7.6663 13.988 7.99963C13.996 8.33297 14 8.6663 14 8.99963H15.025C15.3083 8.99963 15.5417 9.0953 15.725 9.28663C15.9083 9.47863 16 9.7163 16 9.99963C16 10.283 15.904 10.5203 15.712 10.7116C15.5207 10.9036 15.2833 10.9996 15 10.9996H14C14 11.333 13.996 11.6663 13.988 11.9996C13.9793 12.333 13.95 12.6663 13.9 12.9996H15.025C15.3083 12.9996 15.5417 13.0956 15.725 13.2876C15.9083 13.479 16 13.7163 16 13.9996C16 14.283 15.904 14.5203 15.712 14.7116C15.5207 14.9036 15.2833 14.9996 15 14.9996H13.2C12.6667 15.933 11.9377 16.6663 11.013 17.1996C10.0877 17.733 9.08333 17.9996 8 17.9996ZM8 15.9996C9.1 15.9996 10.0417 15.608 10.825 14.8246C11.6083 14.0413 12 13.0996 12 11.9996V7.99963C12 6.89963 11.6083 5.95797 10.825 5.17463C10.0417 4.3913 9.1 3.99963 8 3.99963C6.9 3.99963 5.95833 4.3913 5.175 5.17463C4.39167 5.95797 4 6.89963 4 7.99963V11.9996C4 13.0996 4.39167 14.0413 5.175 14.8246C5.95833 15.608 6.9 15.9996 8 15.9996ZM7 12.9996H9.025C9.30833 12.9996 9.54167 12.9036 9.725 12.7116C9.90833 12.5203 10 12.283 10 11.9996C10 11.7163 9.90433 11.4786 9.713 11.2866C9.521 11.0953 9.28333 10.9996 9 10.9996H6.975C6.69167 10.9996 6.45833 11.0953 6.275 11.2866C6.09167 11.4786 6 11.7163 6 11.9996C6 12.283 6.096 12.5203 6.288 12.7116C6.47933 12.9036 6.71667 12.9996 7 12.9996ZM7 8.99963H9.025C9.30833 8.99963 9.54167 8.90364 9.725 8.71163C9.90833 8.5203 10 8.28297 10 7.99963C10 7.7163 9.90433 7.47863 9.713 7.28663C9.521 7.0953 9.28333 6.99963 9 6.99963H6.975C6.69167 6.99963 6.45833 7.0953 6.275 7.28663C6.09167 7.47863 6 7.7163 6 7.99963C6 8.28297 6.096 8.5203 6.288 8.71163C6.47933 8.90364 6.71667 8.99963 7 8.99963Z","fill","#4C5366"],["width","20","height","20","viewBox","0 0 24 24","fill","none","xmlns","http://www.w3.org/2000/svg"],["fill-rule","evenodd","clip-rule","evenodd","d","M20 5H4C3.44772 5 3 5.44772 3 6V18C3 18.5523 3.44772 19 4 19H20C20.5523 19 21 18.5523 21 18V6C21 5.44772 20.5523 5 20 5ZM4 3C2.34315 3 1 4.34315 1 6V18C1 19.6569 2.34315 21 4 21H20C21.6569 21 23 19.6569 23 18V6C23 4.34315 21.6569 3 20 3H4Z","fill","#777E91"],["fill-rule","evenodd","clip-rule","evenodd","d","M5.2318 7.35984C5.58537 6.93556 6.21593 6.87824 6.64021 7.2318L11.3598 11.1648C11.7307 11.4739 12.2694 11.4739 12.6402 11.1648L17.3598 7.2318C17.7841 6.87824 18.4147 6.93556 18.7682 7.35984C19.1218 7.78412 19.0645 8.41468 18.6402 8.76825L13.9206 12.7013C12.808 13.6284 11.192 13.6284 10.0795 12.7013L5.35984 8.76825C4.93556 8.41468 4.87824 7.78412 5.2318 7.35984Z","fill","#777E91"],[1,"snippyly-custom-button-container"],[4,"ngTemplateOutlet"]],template:function(t,o){if(t&1){let a=K();Wt(),_(0,"div",2),G("click",function(){return N(a),F(o.openDialog())}),p(1,Xhn,4,4,"div",3)(2,Qhn,3,1,"div",4),y(),p(3,efn,1,0,"ng-template",null,0,Me)}t&2&&(m(),g("ngIf",o.showDefaultBtn),m(),g("ngIf",!o.showDefaultBtn))},dependencies:[se,Nt,Rr,Jr,ue],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}.user-request-tool-container[_ngcontent-%COMP%]{display:inline-block!important;cursor:pointer!important}.user-request-tool-container[_ngcontent-%COMP%] .s-user-request-tool-button[_ngcontent-%COMP%]{display:flex!important;align-items:center!important;gap:calc((.5rem + 0px) * var(--velt-base-rem-unit))!important;padding:calc((.5rem + 0px) * var(--velt-base-rem-unit)) calc((1rem + 0px) * var(--velt-base-rem-unit))!important;border-radius:100px!important}.user-request-tool-container[_ngcontent-%COMP%] .s-user-request-tool-button[_ngcontent-%COMP%]:hover{background:#ededed!important}.user-request-tool-container[_ngcontent-%COMP%] .s-user-request-tool-button[_ngcontent-%COMP%] .s-user-request-tool-button-text[_ngcontent-%COMP%]{font-size:14px!important;color:#4c5366!important;font-weight:400!important}"],changeDetection:0});let n=r;return n})();function tfn(n,r){n&1&&(de(),_(0,"svg",4),D(1,"rect",11),y())}function nfn(n,r){n&1&&(de(),_(0,"svg",4),D(1,"rect",12)(2,"path",13),y())}function ifn(n,r){if(n&1){let i=K();_(0,"div",10),G("click",function(t){return N(i),c(2).onCheckboxToggle(),F(t.stopPropagation())})("keydown.space",function(t){return N(i),c(2).onCheckboxToggle(),t.preventDefault(),F(t.stopPropagation())})("keydown.enter",function(t){return N(i),c(2).onCheckboxToggle(),t.preventDefault(),F(t.stopPropagation())}),ie(1,tfn,2,0,":svg:svg",4),ie(2,nfn,3,0,":svg:svg",4),y()}if(n&2){let i=c(2);ve("velt-assign-dropdown--checkbox-icon-selected",i.isAssignedCheckbox),T("data-testid",i.componentId+"-checkbox-icon")("aria-checked",i.isAssignedCheckbox),m(),re(i.isAssignedCheckbox?-1:1),m(),re(i.isAssignedCheckbox?2:-1)}}function rfn(n,r){if(n&1&&(de(),_(0,"svg",4)(1,"g"),D(2,"path",14)(3,"path",15)(4,"path",16),y()()),n&2){let i=c(2);T("data-testid",i.componentId+"-icon")}}function ofn(n,r){if(n&1){let i=K();h(0,9),_(1,"div",17),G("click",function(){let t=N(i).$implicit,o=c(2);return F(o.assignContact(t))}),_(2,"div",18),D(3,"snippyly-user-avatar",19),_(4,"span",20),ne(5),M(6,"translate"),y()()(),f()}if(n&2){let i=r.$implicit,e=r.$index,t=c(2);m(),T("aria-selected",i.userId===(t.assignTo==null?null:t.assignTo.userId))("aria-label","Assign to "+((i==null?null:i.name)||(i==null?null:i.email)))("data-testid",t.componentId+"-option-"+e),m(),ve("s-dark",t.darkMode)("velt-assign-dropdown--item-dark",t.darkMode),m(),g("size",24)("user",i),T("data-testid",t.componentId+"-option-avatar-"+e),m(),T("data-testid",t.componentId+"-option-label-"+e),m(),Ke(R(6,12,(i==null?null:i.name)||(i==null?null:i.email)))}}function afn(n,r){if(n&1&&(_(0,"app-dropdown",1),h(1,2),ie(2,ifn,3,6,"div",3),ie(3,rfn,5,1,":svg:svg",4),_(4,"div",5),ne(5),M(6,"translate"),y(),_(7,"div",6),ne(8),M(9,"translate"),y(),de(),_(10,"svg",7),D(11,"path",8),y(),f(),ci(12,ofn,7,14,"ng-container",9,Is().trackByUserContact,!0),y()),n&2){let i=c();ve("velt-assign-dropdown--checkbox",i.assignToType==="checkbox"),g("darkMode",i.darkMode),T("data-testid",i.componentId)("data-velt-assign-to-type",i.assignToType),m(2),re(i.assignToType==="checkbox"?2:-1),m(),re(i.assignToType==="dropdown"?3:-1),m(),T("data-testid",i.componentId+"-label"),m(),Ke(R(6,13,"Assign to")),m(2),T("aria-labelledby","velt-assign-label")("data-testid",i.componentId+"-selected"),m(),Ee(" ",R(9,15,(i.assignTo==null?null:i.assignTo.name)||(i.assignTo==null?null:i.assignTo.email))," "),m(2),T("data-testid",i.componentId+"-arrow"),m(2),di(i.selectedUserContacts)}}var Kye=(()=>{let r=class r extends Ct{constructor(e,t,o){super(t,o),this.loggingService=e,this.elementRef=t,this.themeService=o,this.assignToType="dropdown",this.isAssignedCheckbox=!1,this.setAssignTo=new Fe,this.toggleCheckbox=new Fe,this.componentId="velt-assign-dropdown"}ngOnInit(){try{this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in AssignDropdownComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in AssignDropdownComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{lfn(this.elementRef.nativeElement,this.componentId)}catch(e){this.loggingService.catch("Error in AssignDropdownComponent setupA11yAttributes:",e)}}trackByUserContact(e,t){try{return t?.userId||t?.email||e}catch(o){return this.loggingService.catch("Error in AssignDropdownComponent trackByUserContact:",o),e}}assignContact(e){try{this.setAssignTo.emit({assignTo:e})}catch(t){this.loggingService.catch("Error in AssignDropdownComponent assignContact err: ",t)}}onCheckboxToggle(){try{this.toggleCheckbox.emit()}catch(e){this.loggingService.catch("Error in AssignDropdownComponent onCheckboxToggle err: ",e)}}};r.\u0275fac=function(t){return new(t||r)(C(x),C(z),C(mt))},r.\u0275cmp=O({type:r,selectors:[["app-assign-dropdown"]],inputs:{assignTo:"assignTo",selectedUserContacts:"selectedUserContacts",assignToType:"assignToType",isAssignedCheckbox:"isAssignedCheckbox"},outputs:{setAssignTo:"setAssignTo",toggleCheckbox:"toggleCheckbox"},standalone:!1,features:[L],decls:1,vars:1,consts:[["dropdownClass","velt-assign-dropdown-container","dropdownType","assign",1,"velt-assign-dropdown","s-assign-to-container",3,"darkMode","velt-assign-dropdown--checkbox"],["dropdownClass","velt-assign-dropdown-container","dropdownType","assign",1,"velt-assign-dropdown","s-assign-to-container",3,"darkMode"],["trigger",""],["role","checkbox","tabindex","0",1,"velt-assign-dropdown--checkbox-icon",3,"velt-assign-dropdown--checkbox-icon-selected"],["width","20","height","20","viewBox","0 0 20 20","fill","none","xmlns","http://www.w3.org/2000/svg","aria-hidden","true","focusable","false"],[1,"velt-assign-dropdown--input-label","input__label"],[1,"velt-assign-dropdown--contact","s-assigned-contact"],["width","24","height","24","viewBox","0 0 24 24","fill","none","xmlns","http://www.w3.org/2000/svg","aria-hidden","true","focusable","false",1,"velt-assign-dropdown--arrow"],["fill-rule","evenodd","clip-rule","evenodd","d","M16.2071 9.79289C15.8166 9.40237 15.1834 9.40237 14.7929 9.79289L12 12.5858L9.20711 9.79289C8.81658 9.40237 8.18342 9.40237 7.79289 9.79289C7.40237 10.1834 7.40237 10.8166 7.79289 11.2071L11.2929 14.7071C11.6834 15.0976 12.3166 15.0976 12.7071 14.7071L16.2071 11.2071C16.5976 10.8166 16.5976 10.1834 16.2071 9.79289Z","fill","currentColor"],["content",""],["role","checkbox","tabindex","0",1,"velt-assign-dropdown--checkbox-icon",3,"click","keydown.space","keydown.enter"],["x","1","y","1","width","18","height","18","rx","3","stroke","currentColor","stroke-width","2","fill","none"],["x","1","y","1","width","18","height","18","rx","3","fill","currentColor"],["d","M5.5 10L8.5 13L14.5 7","stroke","white","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"],["d","M13.3589 7.30469C11.3965 7.30469 9.65206 8.25585 8.56223 9.72128C8.12056 9.62865 7.66922 9.58074 7.21356 9.58074C3.6054 9.58074 0.669922 12.5162 0.669922 16.1244C0.669922 16.5957 1.05207 16.9779 1.52344 16.9779H8.67C9.76512 18.3633 11.4599 19.2539 13.3589 19.2539C16.6533 19.2539 19.3335 16.5737 19.3335 13.2793C19.3335 9.9849 16.6533 7.30469 13.3589 7.30469ZM2.45235 15.2709C2.85669 13.0097 4.83782 11.2878 7.21356 11.2878C7.38233 11.2878 7.55007 11.2972 7.71662 11.3143C7.50159 11.93 7.38426 12.5912 7.38426 13.2793C7.38426 13.9774 7.50501 14.6476 7.72601 15.2709H2.45235ZM13.3589 17.5469C11.0057 17.5469 9.0913 15.6325 9.0913 13.2793C9.0913 10.9262 11.0057 9.01172 13.3589 9.01172C15.712 9.01172 17.6265 10.9262 17.6265 13.2793C17.6265 15.6325 15.712 17.5469 13.3589 17.5469Z","fill","currentColor"],["d","M7.21319 7.87352C9.18202 7.87352 10.7837 6.27181 10.7837 4.30303C10.7837 2.33419 9.18202 0.732422 7.21319 0.732422C5.24435 0.732422 3.64258 2.33419 3.64258 4.30303C3.64258 6.27181 5.24435 7.87352 7.21319 7.87352ZM7.21319 2.43946C8.24076 2.43946 9.0767 3.27545 9.0767 4.30303C9.0767 5.33055 8.24076 6.16649 7.21319 6.16649C6.18561 6.16649 5.34961 5.33055 5.34961 4.30303C5.34961 3.27545 6.18561 2.43946 7.21319 2.43946Z","fill","currentColor"],["d","M15.0664 12.4258H14.2129V11.5723C14.2129 11.1009 13.8308 10.7188 13.3594 10.7188C12.888 10.7188 12.5059 11.1009 12.5059 11.5723V12.4258H11.6523C11.181 12.4258 10.7988 12.8079 10.7988 13.2793C10.7988 13.7507 11.181 14.1328 11.6523 14.1328H12.5059V14.9863C12.5059 15.4577 12.888 15.8399 13.3594 15.8399C13.8308 15.8399 14.2129 15.4577 14.2129 14.9863V14.1328H15.0664C15.5378 14.1328 15.9199 13.7507 15.9199 13.2793C15.9199 12.8079 15.5378 12.4258 15.0664 12.4258Z","fill","currentColor"],["mat-menu-item","","tabindex","0",3,"click"],[1,"velt-assign-dropdown--item","s-assign-to-menu-item"],["aria-hidden","true",3,"size","user"],[1,"velt-assign-dropdown--item-label","s-contact-label"]],template:function(t,o){t&1&&ie(0,afn,14,17,"app-dropdown",0),t&2&&re(o.selectedUserContacts!=null&&o.selectedUserContacts.length?0:-1)},dependencies:[Ns,ri,$m,ue],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}[_nghost-%COMP%]{width:100%}.velt-assign-dropdown[_ngcontent-%COMP%]{display:flex;align-items:center;width:100%;height:unset;border-radius:var(--velt-border-radius-md);cursor:pointer;margin-bottom:var(--velt-spacing-sm);color:var(--velt-accent-text)} .velt-assign-dropdown>div{width:100%;display:flex;align-items:center;gap:var(--velt-spacing-sm);padding:var(--velt-spacing-md) var(--velt-spacing-lg);box-sizing:border-box}.velt-assign-dropdown[_ngcontent-%COMP%] .velt-assign-dropdown--contact[_ngcontent-%COMP%]{flex-grow:1;flex-basis:0%;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.velt-assign-dropdown[_ngcontent-%COMP%] .velt-assign-dropdown--arrow[_ngcontent-%COMP%]{color:var(--velt-text-10)}.velt-assign-dropdown--item[_ngcontent-%COMP%]{display:flex;align-items:center;gap:var(--velt-spacing-sm);justify-content:flex-start;color:var(--velt-light-mode-text-1);text-decoration:none;font-size:var(--velt-font-size-sm)}.velt-assign-dropdown--item.velt-assign-dropdown--item-dark[_ngcontent-%COMP%]{color:var(--velt-dark-mode-text-1)}.velt-assign-dropdown--item[_ngcontent-%COMP%] snippyly-user-avatar[_ngcontent-%COMP%]{display:flex}.velt-assign-dropdown--checkbox-icon[_ngcontent-%COMP%]{display:flex}"],changeDetection:0});let n=r;return n})();function lfn(n,r){try{n.setAttribute("role","combobox"),n.setAttribute("aria-label","Assign user dropdown"),n.setAttribute("data-testid",r+"-container")}catch{}}function sfn(n,r){if(n&1&&(_(0,"div",1),de(),_(1,"svg",2)(2,"g"),D(3,"path",3),y(),D(4,"path",4),y()()),n&2){let i=c();T("data-testid",i.componentId+"-mobile")}}function cfn(n,r){if(n&1&&(_(0,"div",1),de(),_(1,"svg",5)(2,"g"),D(3,"path",3)(4,"path",6),y(),D(5,"path",7),y()()),n&2){let i=c();T("data-testid",i.componentId+"-tablet")}}function dfn(n,r){if(n&1&&(_(0,"div",1),de(),_(1,"svg",8),D(2,"path",9)(3,"path",10)(4,"path",11),y()()),n&2){let i=c();T("data-testid",i.componentId+"-desktop")}}function mfn(n,r){if(n&1&&(_(0,"div",1),de(),_(1,"svg",12),D(2,"path",13)(3,"path",14)(4,"path",15),y()()),n&2){let i=c();T("data-testid",i.componentId+"-monitor")}}var Zye=(()=>{let r=class r{constructor(e,t){this.elementRef=e,this.loggingService=t,this.deviceType="",this.componentId="velt-device-type-icons"}ngOnInit(){try{this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in DeviceTypeIconsComponent ngOnInit:",e)}}setupA11yAttributes(){try{gfn(this.elementRef.nativeElement,this.componentId)}catch(e){this.loggingService.catch("Error in DeviceTypeIconsComponent setupA11yAttributes:",e)}}};r.\u0275fac=function(t){return new(t||r)(C(z),C(x))},r.\u0275cmp=O({type:r,selectors:[["app-device-type-icons"]],inputs:{deviceType:"deviceType"},standalone:!1,decls:5,vars:3,consts:[["role","status",1,"devide-type-container","velt-device-type-icons"],[1,"s-flex","velt-device-type-icons--flex"],["width","53","height","17","viewBox","0 0 53 17","fill","none","xmlns","http://www.w3.org/2000/svg","aria-hidden","true","role","img",1,"skip-reset"],["fill-rule","evenodd","clip-rule","evenodd","d","M8.5 3.5H3.5C3.22386 3.5 3 3.72386 3 4V13C3 13.2761 3.22386 13.5 3.5 13.5H8.5C8.77614 13.5 9 13.2761 9 13V4C9 3.72386 8.77614 3.5 8.5 3.5ZM3.5 2.5C2.67157 2.5 2 3.17157 2 4V13C2 13.8284 2.67157 14.5 3.5 14.5H8.5C9.32843 14.5 10 13.8284 10 13V4C10 3.17157 9.32843 2.5 8.5 2.5H3.5Z","fill","currentColor"],["d","M24.624 4.388V12H23.623V6.324L21.093 12H20.389L17.848 6.313V12H16.847V4.388H17.925L20.741 10.68L23.557 4.388H24.624ZM29.0606 12.099C28.4959 12.099 27.9826 11.9707 27.5206 11.714C27.0659 11.4573 26.7066 11.0943 26.4426 10.625C26.1859 10.1483 26.0576 9.59833 26.0576 8.975C26.0576 8.359 26.1896 7.81633 26.4536 7.347C26.7249 6.87033 27.0916 6.50733 27.5536 6.258C28.0156 6.00133 28.5326 5.873 29.1046 5.873C29.6766 5.873 30.1936 6.00133 30.6556 6.258C31.1176 6.50733 31.4806 6.86667 31.7446 7.336C32.0159 7.80533 32.1516 8.35167 32.1516 8.975C32.1516 9.59833 32.0123 10.1483 31.7336 10.625C31.4623 11.0943 31.0919 11.4573 30.6226 11.714C30.1533 11.9707 29.6326 12.099 29.0606 12.099ZM29.0606 11.219C29.4199 11.219 29.7573 11.1347 30.0726 10.966C30.3879 10.7973 30.6409 10.5443 30.8316 10.207C31.0296 9.86967 31.1286 9.459 31.1286 8.975C31.1286 8.491 31.0333 8.08033 30.8426 7.743C30.6519 7.40567 30.4026 7.15633 30.0946 6.995C29.7866 6.82633 29.4529 6.742 29.0936 6.742C28.7269 6.742 28.3896 6.82633 28.0816 6.995C27.7809 7.15633 27.5389 7.40567 27.3556 7.743C27.1723 8.08033 27.0806 8.491 27.0806 8.975C27.0806 9.46633 27.1686 9.88067 27.3446 10.218C27.5279 10.5553 27.7699 10.8083 28.0706 10.977C28.3713 11.1383 28.7013 11.219 29.0606 11.219ZM34.5787 7.094C34.7841 6.73467 35.0847 6.44133 35.4807 6.214C35.8767 5.98667 36.3277 5.873 36.8337 5.873C37.3764 5.873 37.8641 6.00133 38.2967 6.258C38.7294 6.51467 39.0704 6.87767 39.3197 7.347C39.5691 7.809 39.6937 8.348 39.6937 8.964C39.6937 9.57267 39.5691 10.1153 39.3197 10.592C39.0704 11.0687 38.7257 11.439 38.2857 11.703C37.8531 11.967 37.3691 12.099 36.8337 12.099C36.3131 12.099 35.8547 11.9853 35.4587 11.758C35.0701 11.5307 34.7767 11.241 34.5787 10.889V12H33.5777V3.86H34.5787V7.094ZM38.6707 8.964C38.6707 8.50933 38.5791 8.11333 38.3957 7.776C38.2124 7.43867 37.9631 7.182 37.6477 7.006C37.3397 6.83 36.9987 6.742 36.6247 6.742C36.2581 6.742 35.9171 6.83367 35.6017 7.017C35.2937 7.193 35.0444 7.45333 34.8537 7.798C34.6704 8.13533 34.5787 8.52767 34.5787 8.975C34.5787 9.42967 34.6704 9.82933 34.8537 10.174C35.0444 10.5113 35.2937 10.7717 35.6017 10.955C35.9171 11.131 36.2581 11.219 36.6247 11.219C36.9987 11.219 37.3397 11.131 37.6477 10.955C37.9631 10.7717 38.2124 10.5113 38.3957 10.174C38.5791 9.82933 38.6707 9.426 38.6707 8.964ZM41.6383 4.993C41.4477 4.993 41.2863 4.927 41.1543 4.795C41.0223 4.663 40.9563 4.50167 40.9563 4.311C40.9563 4.12033 41.0223 3.959 41.1543 3.827C41.2863 3.695 41.4477 3.629 41.6383 3.629C41.8217 3.629 41.9757 3.695 42.1003 3.827C42.2323 3.959 42.2983 4.12033 42.2983 4.311C42.2983 4.50167 42.2323 4.663 42.1003 4.795C41.9757 4.927 41.8217 4.993 41.6383 4.993ZM42.1223 5.972V12H41.1213V5.972H42.1223ZM44.9394 3.86V12H43.9384V3.86H44.9394ZM52.2554 8.755C52.2554 8.94567 52.2444 9.14733 52.2224 9.36H47.4044C47.4411 9.954 47.6427 10.4197 48.0094 10.757C48.3834 11.087 48.8344 11.252 49.3624 11.252C49.7951 11.252 50.1544 11.153 50.4404 10.955C50.7337 10.7497 50.9391 10.4783 51.0564 10.141H52.1344C51.9731 10.7203 51.6504 11.1933 51.1664 11.56C50.6824 11.9193 50.0811 12.099 49.3624 12.099C48.7904 12.099 48.2771 11.9707 47.8224 11.714C47.3751 11.4573 47.0231 11.0943 46.7664 10.625C46.5097 10.1483 46.3814 9.59833 46.3814 8.975C46.3814 8.35167 46.5061 7.80533 46.7554 7.336C47.0047 6.86667 47.3531 6.50733 47.8004 6.258C48.2551 6.00133 48.7757 5.873 49.3624 5.873C49.9344 5.873 50.4404 5.99767 50.8804 6.247C51.3204 6.49633 51.6577 6.841 51.8924 7.281C52.1344 7.71367 52.2554 8.205 52.2554 8.755ZM51.2214 8.546C51.2214 8.16467 51.1371 7.83833 50.9684 7.567C50.7997 7.28833 50.5687 7.07933 50.2754 6.94C49.9894 6.79333 49.6704 6.72 49.3184 6.72C48.8124 6.72 48.3797 6.88133 48.0204 7.204C47.6684 7.52667 47.4667 7.974 47.4154 8.546H51.2214Z","fill","currentColor"],["width","51","height","17","viewBox","0 0 51 17","fill","none","xmlns","http://www.w3.org/2000/svg","aria-hidden","true","role","img"],["d","M6.5 12C6.5 12.2761 6.27614 12.5 6 12.5C5.72386 12.5 5.5 12.2761 5.5 12C5.5 11.7239 5.72386 11.5 6 11.5C6.27614 11.5 6.5 11.7239 6.5 12Z","fill","currentColor"],["d","M21.566 4.333V5.147H19.476V12H18.475V5.147H16.374V4.333H21.566ZM22.5342 8.964C22.5342 8.348 22.6588 7.809 22.9082 7.347C23.1575 6.87767 23.4985 6.51467 23.9312 6.258C24.3712 6.00133 24.8588 5.873 25.3942 5.873C25.9222 5.873 26.3805 5.98667 26.7692 6.214C27.1578 6.44133 27.4475 6.72733 27.6382 7.072V5.972H28.6502V12H27.6382V10.878C27.4402 11.23 27.1432 11.5233 26.7472 11.758C26.3585 11.9853 25.9038 12.099 25.3832 12.099C24.8478 12.099 24.3638 11.967 23.9312 11.703C23.4985 11.439 23.1575 11.0687 22.9082 10.592C22.6588 10.1153 22.5342 9.57267 22.5342 8.964ZM27.6382 8.975C27.6382 8.52033 27.5465 8.12433 27.3632 7.787C27.1798 7.44967 26.9305 7.193 26.6152 7.017C26.3072 6.83367 25.9662 6.742 25.5922 6.742C25.2182 6.742 24.8772 6.83 24.5692 7.006C24.2612 7.182 24.0155 7.43867 23.8322 7.776C23.6488 8.11333 23.5572 8.50933 23.5572 8.964C23.5572 9.426 23.6488 9.82933 23.8322 10.174C24.0155 10.5113 24.2612 10.7717 24.5692 10.955C24.8772 11.131 25.2182 11.219 25.5922 11.219C25.9662 11.219 26.3072 11.131 26.6152 10.955C26.9305 10.7717 27.1798 10.5113 27.3632 10.174C27.5465 9.82933 27.6382 9.42967 27.6382 8.975ZM31.4528 7.094C31.6581 6.73467 31.9588 6.44133 32.3548 6.214C32.7508 5.98667 33.2018 5.873 33.7078 5.873C34.2504 5.873 34.7381 6.00133 35.1708 6.258C35.6034 6.51467 35.9444 6.87767 36.1938 7.347C36.4431 7.809 36.5678 8.348 36.5678 8.964C36.5678 9.57267 36.4431 10.1153 36.1938 10.592C35.9444 11.0687 35.5998 11.439 35.1598 11.703C34.7271 11.967 34.2431 12.099 33.7078 12.099C33.1871 12.099 32.7288 11.9853 32.3328 11.758C31.9441 11.5307 31.6508 11.241 31.4528 10.889V12H30.4518V3.86H31.4528V7.094ZM35.5448 8.964C35.5448 8.50933 35.4531 8.11333 35.2698 7.776C35.0864 7.43867 34.8371 7.182 34.5218 7.006C34.2138 6.83 33.8728 6.742 33.4988 6.742C33.1321 6.742 32.7911 6.83367 32.4758 7.017C32.1678 7.193 31.9184 7.45333 31.7278 7.798C31.5444 8.13533 31.4528 8.52767 31.4528 8.975C31.4528 9.42967 31.5444 9.82933 31.7278 10.174C31.9184 10.5113 32.1678 10.7717 32.4758 10.955C32.7911 11.131 33.1321 11.219 33.4988 11.219C33.8728 11.219 34.2138 11.131 34.5218 10.955C34.8371 10.7717 35.0864 10.5113 35.2698 10.174C35.4531 9.82933 35.5448 9.426 35.5448 8.964ZM38.9964 3.86V12H37.9954V3.86H38.9964ZM46.3124 8.755C46.3124 8.94567 46.3014 9.14733 46.2794 9.36H41.4614C41.4981 9.954 41.6997 10.4197 42.0664 10.757C42.4404 11.087 42.8914 11.252 43.4194 11.252C43.8521 11.252 44.2114 11.153 44.4974 10.955C44.7907 10.7497 44.9961 10.4783 45.1134 10.141H46.1914C46.0301 10.7203 45.7074 11.1933 45.2234 11.56C44.7394 11.9193 44.1381 12.099 43.4194 12.099C42.8474 12.099 42.3341 11.9707 41.8794 11.714C41.4321 11.4573 41.0801 11.0943 40.8234 10.625C40.5667 10.1483 40.4384 9.59833 40.4384 8.975C40.4384 8.35167 40.5631 7.80533 40.8124 7.336C41.0617 6.86667 41.4101 6.50733 41.8574 6.258C42.3121 6.00133 42.8327 5.873 43.4194 5.873C43.9914 5.873 44.4974 5.99767 44.9374 6.247C45.3774 6.49633 45.7147 6.841 45.9494 7.281C46.1914 7.71367 46.3124 8.205 46.3124 8.755ZM45.2784 8.546C45.2784 8.16467 45.1941 7.83833 45.0254 7.567C44.8567 7.28833 44.6257 7.07933 44.3324 6.94C44.0464 6.79333 43.7274 6.72 43.3754 6.72C42.8694 6.72 42.4367 6.88133 42.0774 7.204C41.7254 7.52667 41.5237 7.974 41.4724 8.546H45.2784ZM48.9647 6.797V10.35C48.9647 10.6433 49.027 10.8523 49.1517 10.977C49.2763 11.0943 49.4927 11.153 49.8007 11.153H50.5377V12H49.6357C49.0783 12 48.6603 11.8717 48.3817 11.615C48.103 11.3583 47.9637 10.9367 47.9637 10.35V6.797H47.1827V5.972H47.9637V4.454H48.9647V5.972H50.5377V6.797H48.9647Z","fill","currentColor"],["width","62","height","17","viewBox","0 0 62 17","fill","none","xmlns","http://www.w3.org/2000/svg","aria-hidden","true","role","img"],["fill-rule","evenodd","clip-rule","evenodd","d","M2.5 5.5L2.5 10L9.5 10L9.5 5.5C9.5 5.22386 9.27614 5 9 5L3 5C2.72386 5 2.5 5.22386 2.5 5.5ZM1.5 11L10.5 11L10.5 5.5C10.5 4.67157 9.82843 4 9 4L3 4C2.17157 4 1.5 4.67157 1.5 5.5L1.5 11Z","fill","currentColor"],["fill-rule","evenodd","clip-rule","evenodd","d","M1.5 11L1.5 11.5C1.5 11.7761 1.72386 12 2 12L10 12C10.2761 12 10.5 11.7761 10.5 11.5L10.5 11L1.5 11ZM0.5 11.5C0.5 12.3284 1.17157 13 2 13L10 13C10.8284 13 11.5 12.3284 11.5 11.5L11.5 10.5C11.5 10.2239 11.2761 10 11 10L1 10C0.723858 10 0.5 10.2239 0.5 10.5L0.5 11.5Z","fill","currentColor"],["d","M19.234 4.333C20.07 4.333 20.7923 4.49067 21.401 4.806C22.017 5.114 22.4863 5.55767 22.809 6.137C23.139 6.71633 23.304 7.39833 23.304 8.183C23.304 8.96767 23.139 9.64967 22.809 10.229C22.4863 10.801 22.017 11.241 21.401 11.549C20.7923 11.8497 20.07 12 19.234 12H16.847V4.333H19.234ZM19.234 11.175C20.224 11.175 20.9793 10.9147 21.5 10.394C22.0207 9.866 22.281 9.129 22.281 8.183C22.281 7.22967 22.017 6.48533 21.489 5.95C20.9683 5.41467 20.2167 5.147 19.234 5.147H17.848V11.175H19.234ZM30.2343 8.755C30.2343 8.94567 30.2233 9.14733 30.2013 9.36H25.3833C25.42 9.954 25.6217 10.4197 25.9883 10.757C26.3623 11.087 26.8133 11.252 27.3413 11.252C27.774 11.252 28.1333 11.153 28.4193 10.955C28.7127 10.7497 28.918 10.4783 29.0353 10.141H30.1133C29.952 10.7203 29.6293 11.1933 29.1453 11.56C28.6613 11.9193 28.06 12.099 27.3413 12.099C26.7693 12.099 26.256 11.9707 25.8013 11.714C25.354 11.4573 25.002 11.0943 24.7453 10.625C24.4887 10.1483 24.3603 9.59833 24.3603 8.975C24.3603 8.35167 24.485 7.80533 24.7343 7.336C24.9837 6.86667 25.332 6.50733 25.7793 6.258C26.234 6.00133 26.7547 5.873 27.3413 5.873C27.9133 5.873 28.4193 5.99767 28.8593 6.247C29.2993 6.49633 29.6367 6.841 29.8713 7.281C30.1133 7.71367 30.2343 8.205 30.2343 8.755ZM29.2003 8.546C29.2003 8.16467 29.116 7.83833 28.9473 7.567C28.7787 7.28833 28.5477 7.07933 28.2543 6.94C27.9683 6.79333 27.6493 6.72 27.2973 6.72C26.7913 6.72 26.3587 6.88133 25.9993 7.204C25.6473 7.52667 25.4457 7.974 25.3943 8.546H29.2003ZM33.7996 12.099C33.3376 12.099 32.9233 12.022 32.5566 11.868C32.19 11.7067 31.9003 11.4867 31.6876 11.208C31.475 10.922 31.3576 10.5957 31.3356 10.229H32.3696C32.399 10.5297 32.5383 10.7753 32.7876 10.966C33.0443 11.1567 33.378 11.252 33.7886 11.252C34.17 11.252 34.4706 11.1677 34.6906 10.999C34.9106 10.8303 35.0206 10.6177 35.0206 10.361C35.0206 10.097 34.9033 9.90267 34.6686 9.778C34.434 9.646 34.071 9.51767 33.5796 9.393C33.1323 9.27567 32.7656 9.15833 32.4796 9.041C32.201 8.91633 31.959 8.73667 31.7536 8.502C31.5556 8.26 31.4566 7.94467 31.4566 7.556C31.4566 7.248 31.5483 6.96567 31.7316 6.709C31.915 6.45233 32.1753 6.25067 32.5126 6.104C32.85 5.95 33.235 5.873 33.6676 5.873C34.335 5.873 34.874 6.04167 35.2846 6.379C35.6953 6.71633 35.9153 7.17833 35.9446 7.765H34.9436C34.9216 7.44967 34.7933 7.19667 34.5586 7.006C34.3313 6.81533 34.0233 6.72 33.6346 6.72C33.2753 6.72 32.9893 6.797 32.7766 6.951C32.564 7.105 32.4576 7.30667 32.4576 7.556C32.4576 7.754 32.52 7.919 32.6446 8.051C32.7766 8.17567 32.938 8.27833 33.1286 8.359C33.3266 8.43233 33.598 8.51667 33.9426 8.612C34.3753 8.72933 34.7273 8.84667 34.9986 8.964C35.27 9.074 35.501 9.24267 35.6916 9.47C35.8896 9.69733 35.9923 9.99433 35.9996 10.361C35.9996 10.691 35.908 10.988 35.7246 11.252C35.5413 11.516 35.281 11.725 34.9436 11.879C34.6136 12.0257 34.2323 12.099 33.7996 12.099ZM40.8887 12L38.5237 9.338V12H37.5227V3.86H38.5237V8.645L40.8447 5.972H42.2417L39.4037 8.975L42.2527 12H40.8887ZM44.5148 6.797V10.35C44.5148 10.6433 44.5772 10.8523 44.7018 10.977C44.8265 11.0943 45.0428 11.153 45.3508 11.153H46.0878V12H45.1858C44.6285 12 44.2105 11.8717 43.9318 11.615C43.6532 11.3583 43.5138 10.9367 43.5138 10.35V6.797H42.7328V5.972H43.5138V4.454H44.5148V5.972H46.0878V6.797H44.5148ZM50.0397 12.099C49.475 12.099 48.9617 11.9707 48.4997 11.714C48.045 11.4573 47.6857 11.0943 47.4217 10.625C47.165 10.1483 47.0367 9.59833 47.0367 8.975C47.0367 8.359 47.1687 7.81633 47.4327 7.347C47.704 6.87033 48.0707 6.50733 48.5327 6.258C48.9947 6.00133 49.5117 5.873 50.0837 5.873C50.6557 5.873 51.1727 6.00133 51.6347 6.258C52.0967 6.50733 52.4597 6.86667 52.7237 7.336C52.995 7.80533 53.1307 8.35167 53.1307 8.975C53.1307 9.59833 52.9913 10.1483 52.7127 10.625C52.4413 11.0943 52.071 11.4573 51.6017 11.714C51.1323 11.9707 50.6117 12.099 50.0397 12.099ZM50.0397 11.219C50.399 11.219 50.7363 11.1347 51.0517 10.966C51.367 10.7973 51.62 10.5443 51.8107 10.207C52.0087 9.86967 52.1077 9.459 52.1077 8.975C52.1077 8.491 52.0123 8.08033 51.8217 7.743C51.631 7.40567 51.3817 7.15633 51.0737 6.995C50.7657 6.82633 50.432 6.742 50.0727 6.742C49.706 6.742 49.3687 6.82633 49.0607 6.995C48.76 7.15633 48.518 7.40567 48.3347 7.743C48.1513 8.08033 48.0597 8.491 48.0597 8.975C48.0597 9.46633 48.1477 9.88067 48.3237 10.218C48.507 10.5553 48.749 10.8083 49.0497 10.977C49.3503 11.1383 49.6803 11.219 50.0397 11.219ZM55.5578 7.083C55.7558 6.73833 56.0491 6.45233 56.4378 6.225C56.8338 5.99033 57.2921 5.873 57.8128 5.873C58.3481 5.873 58.8321 6.00133 59.2648 6.258C59.7048 6.51467 60.0495 6.87767 60.2988 7.347C60.5481 7.809 60.6728 8.348 60.6728 8.964C60.6728 9.57267 60.5481 10.1153 60.2988 10.592C60.0495 11.0687 59.7048 11.439 59.2648 11.703C58.8321 11.967 58.3481 12.099 57.8128 12.099C57.2995 12.099 56.8448 11.9853 56.4488 11.758C56.0601 11.5233 55.7631 11.2337 55.5578 10.889V14.86H54.5568V5.972H55.5578V7.083ZM59.6498 8.964C59.6498 8.50933 59.5581 8.11333 59.3748 7.776C59.1915 7.43867 58.9421 7.182 58.6268 7.006C58.3188 6.83 57.9778 6.742 57.6038 6.742C57.2371 6.742 56.8961 6.83367 56.5808 7.017C56.2728 7.193 56.0235 7.45333 55.8328 7.798C55.6495 8.13533 55.5578 8.52767 55.5578 8.975C55.5578 9.42967 55.6495 9.82933 55.8328 10.174C56.0235 10.5113 56.2728 10.7717 56.5808 10.955C56.8961 11.131 57.2371 11.219 57.6038 11.219C57.9778 11.219 58.3188 11.131 58.6268 10.955C58.9421 10.7717 59.1915 10.5113 59.3748 10.174C59.5581 9.82933 59.6498 9.426 59.6498 8.964Z","fill","currentColor"],["width","59","height","17","viewBox","0 0 59 17","fill","none","xmlns","http://www.w3.org/2000/svg","aria-hidden","true","role","img"],["d","M4.5 11.5H5.5V12.5H6.5V11.5H7.5V12.5H8C8.27614 12.5 8.5 12.7239 8.5 13C8.5 13.2761 8.27614 13.5 8 13.5H4C3.72386 13.5 3.5 13.2761 3.5 13C3.5 12.7239 3.72386 12.5 4 12.5H4.5V11.5Z","fill","currentColor"],["fill-rule","evenodd","clip-rule","evenodd","d","M2 5.5L2 9.5C2 10.0523 2.44772 10.5 3 10.5L9 10.5C9.55229 10.5 10 10.0523 10 9.5L10 5.5C10 4.94772 9.55228 4.5 9 4.5L3 4.5C2.44771 4.5 2 4.94772 2 5.5ZM1 9.5C1 10.6046 1.89543 11.5 3 11.5L9 11.5C10.1046 11.5 11 10.6046 11 9.5L11 5.5C11 4.39543 10.1046 3.5 9 3.5L3 3.5C1.89543 3.5 1 4.39543 1 5.5L1 9.5Z","fill","currentColor"],["d","M24.624 4.388V12H23.623V6.324L21.093 12H20.389L17.848 6.313V12H16.847V4.388H17.925L20.741 10.68L23.557 4.388H24.624ZM29.0606 12.099C28.4959 12.099 27.9826 11.9707 27.5206 11.714C27.0659 11.4573 26.7066 11.0943 26.4426 10.625C26.1859 10.1483 26.0576 9.59833 26.0576 8.975C26.0576 8.359 26.1896 7.81633 26.4536 7.347C26.7249 6.87033 27.0916 6.50733 27.5536 6.258C28.0156 6.00133 28.5326 5.873 29.1046 5.873C29.6766 5.873 30.1936 6.00133 30.6556 6.258C31.1176 6.50733 31.4806 6.86667 31.7446 7.336C32.0159 7.80533 32.1516 8.35167 32.1516 8.975C32.1516 9.59833 32.0123 10.1483 31.7336 10.625C31.4623 11.0943 31.0919 11.4573 30.6226 11.714C30.1533 11.9707 29.6326 12.099 29.0606 12.099ZM29.0606 11.219C29.4199 11.219 29.7573 11.1347 30.0726 10.966C30.3879 10.7973 30.6409 10.5443 30.8316 10.207C31.0296 9.86967 31.1286 9.459 31.1286 8.975C31.1286 8.491 31.0333 8.08033 30.8426 7.743C30.6519 7.40567 30.4026 7.15633 30.0946 6.995C29.7866 6.82633 29.4529 6.742 29.0936 6.742C28.7269 6.742 28.3896 6.82633 28.0816 6.995C27.7809 7.15633 27.5389 7.40567 27.3556 7.743C27.1723 8.08033 27.0806 8.491 27.0806 8.975C27.0806 9.46633 27.1686 9.88067 27.3446 10.218C27.5279 10.5553 27.7699 10.8083 28.0706 10.977C28.3713 11.1383 28.7013 11.219 29.0606 11.219ZM36.5147 5.862C37.2481 5.862 37.8421 6.08567 38.2967 6.533C38.7514 6.973 38.9787 7.611 38.9787 8.447V12H37.9887V8.59C37.9887 7.98867 37.8384 7.53033 37.5377 7.215C37.2371 6.89233 36.8264 6.731 36.3057 6.731C35.7777 6.731 35.3561 6.896 35.0407 7.226C34.7327 7.556 34.5787 8.03633 34.5787 8.667V12H33.5777V5.972H34.5787V6.83C34.7767 6.522 35.0444 6.28367 35.3817 6.115C35.7264 5.94633 36.1041 5.862 36.5147 5.862ZM41.2409 4.993C41.0502 4.993 40.8889 4.927 40.7569 4.795C40.6249 4.663 40.5589 4.50167 40.5589 4.311C40.5589 4.12033 40.6249 3.959 40.7569 3.827C40.8889 3.695 41.0502 3.629 41.2409 3.629C41.4242 3.629 41.5782 3.695 41.7029 3.827C41.8349 3.959 41.9009 4.12033 41.9009 4.311C41.9009 4.50167 41.8349 4.663 41.7029 4.795C41.5782 4.927 41.4242 4.993 41.2409 4.993ZM41.7249 5.972V12H40.7239V5.972H41.7249ZM44.7619 6.797V10.35C44.7619 10.6433 44.8242 10.8523 44.9489 10.977C45.0736 11.0943 45.2899 11.153 45.5979 11.153H46.3349V12H45.4329C44.8756 12 44.4576 11.8717 44.1789 11.615C43.9002 11.3583 43.7609 10.9367 43.7609 10.35V6.797H42.9799V5.972H43.7609V4.454H44.7619V5.972H46.3349V6.797H44.7619ZM50.2867 12.099C49.7221 12.099 49.2087 11.9707 48.7467 11.714C48.2921 11.4573 47.9327 11.0943 47.6687 10.625C47.4121 10.1483 47.2837 9.59833 47.2837 8.975C47.2837 8.359 47.4157 7.81633 47.6797 7.347C47.9511 6.87033 48.3177 6.50733 48.7797 6.258C49.2417 6.00133 49.7587 5.873 50.3307 5.873C50.9027 5.873 51.4197 6.00133 51.8817 6.258C52.3437 6.50733 52.7067 6.86667 52.9707 7.336C53.2421 7.80533 53.3777 8.35167 53.3777 8.975C53.3777 9.59833 53.2384 10.1483 52.9597 10.625C52.6884 11.0943 52.3181 11.4573 51.8487 11.714C51.3794 11.9707 50.8587 12.099 50.2867 12.099ZM50.2867 11.219C50.6461 11.219 50.9834 11.1347 51.2987 10.966C51.6141 10.7973 51.8671 10.5443 52.0577 10.207C52.2557 9.86967 52.3547 9.459 52.3547 8.975C52.3547 8.491 52.2594 8.08033 52.0687 7.743C51.8781 7.40567 51.6287 7.15633 51.3207 6.995C51.0127 6.82633 50.6791 6.742 50.3197 6.742C49.9531 6.742 49.6157 6.82633 49.3077 6.995C49.0071 7.15633 48.7651 7.40567 48.5817 7.743C48.3984 8.08033 48.3067 8.491 48.3067 8.975C48.3067 9.46633 48.3947 9.88067 48.5707 10.218C48.7541 10.5553 48.9961 10.8083 49.2967 10.977C49.5974 11.1383 49.9274 11.219 50.2867 11.219ZM55.8049 6.951C55.9809 6.60633 56.2302 6.33867 56.5529 6.148C56.8829 5.95733 57.2825 5.862 57.7519 5.862V6.896H57.4879C56.3659 6.896 55.8049 7.50467 55.8049 8.722V12H54.8039V5.972H55.8049V6.951Z","fill","currentColor"]],template:function(t,o){if(t&1&&(_(0,"div",0),ie(1,sfn,5,1,"div",1)(2,cfn,6,1,"div",1)(3,dfn,5,1,"div",1)(4,mfn,5,1,"div",1),y()),t&2){let a;T("data-testid",o.componentId)("aria-label","Viewing on"+o.deviceType),m(),re((a=o.deviceType)==="Mobile"?1:a==="Tablet"?2:a==="Desktop"?3:a==="Monitor"?4:-1)}},styles:[".velt-device-type-icons--flex[_ngcontent-%COMP%]{display:flex;cursor:pointer;color:var(--velt-text-4)}"],changeDetection:0});let n=r;return n})();function gfn(n,r){try{n.setAttribute("data-testid",r+"-container")}catch{}}var vfn=["tooltipTemplate"],ufn=["customTooltipTemplate"],pfn=["*",[["","tooltipContent",""]]],hfn=["*","[tooltipContent]"];function ffn(n,r){if(n&1&&(_(0,"div",4),ne(1),y()),n&2){let i=c();ve("velt-tooltip-content--dark",i.darkMode),T("data-testid",i.componentId+"-text"),m(),Ee(" ",i.tooltip," ")}}function Cfn(n,r){if(n&1&&(_(0,"div",4),jt(1,1),y()),n&2){let i=c();Xr(i.tooltipContentClass),ve("velt-tooltip-content--dark",i.darkMode),T("data-testid",i.componentId+"-custom")}}var Md=(()=>{let r=class r extends Ct{constructor(e,t,o,a,l,s,d){super(o,t,e),this.changeDetector=e,this.themeService=t,this.elementRef=o,this.loggingService=a,this.overlay=l,this.overlayPositionBuilder=s,this.viewContainerRef=d,this.veltElement=!0,this.clicked=new Fe,this.tooltip="",this.tooltipContentClass="",this.colorMode=!1,this.type="",this.unstyled=!1,this.componentId="velt-tooltip-button",this.overlayRef=null,this.isTooltipVisible=!1,this.buttonElement=null,this.boundShowTooltip=this.showTooltip.bind(this),this.boundScheduleHideTooltip=this.scheduleHideTooltip.bind(this),this.boundOverlayMouseEnter=this.onOverlayMouseEnter.bind(this),this.boundOverlayMouseLeave=this.onOverlayMouseLeave.bind(this)}ngOnInit(){try{this.setupA11yAttributes(),this.setupTooltipListeners()}catch(e){this.loggingService.catch("Error in TooltipButtonComponent ngOnInit:",e)}}ngOnDestroy(){try{this.hideTooltip(),this.hideTooltipTimer&&(clearTimeout(this.hideTooltipTimer),this.hideTooltipTimer=null),this.removeTooltipListeners(),this.clicked.complete(),super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in TooltipButtonComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("role","presentation"),e.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in TooltipButtonComponent setupA11yAttributes:",e)}}setupTooltipListeners(){try{this.buttonElement=this.elementRef.nativeElement.querySelector("button"),this.buttonElement&&(this.buttonElement.addEventListener("mouseenter",this.boundShowTooltip),this.buttonElement.addEventListener("mouseleave",this.boundScheduleHideTooltip),this.buttonElement.addEventListener("focus",this.boundShowTooltip),this.buttonElement.addEventListener("blur",this.boundScheduleHideTooltip))}catch(e){this.loggingService.catch("Error in TooltipButtonComponent setupTooltipListeners:",e)}}showTooltip(){try{if(!this.tooltip&&!this.hasCustomTooltipContent()||(this.hideTooltipTimer&&(clearTimeout(this.hideTooltipTimer),this.hideTooltipTimer=null),this.isTooltipVisible))return;this.createOverlay(),this.isTooltipVisible=!0}catch(e){this.loggingService.catch("Error in TooltipButtonComponent showTooltip:",e)}}scheduleHideTooltip(){try{this.hideTooltipTimer=setTimeout(()=>{this.hideTooltip()},100)}catch(e){this.loggingService.catch("Error in TooltipButtonComponent scheduleHideTooltip:",e)}}hideTooltip(){try{this.overlayRef&&(this.overlayRef.overlayElement.removeEventListener("mouseenter",this.boundOverlayMouseEnter),this.overlayRef.overlayElement.removeEventListener("mouseleave",this.boundOverlayMouseLeave),this.overlayRef.dispose(),this.overlayRef=null),this.isTooltipVisible=!1}catch(e){this.loggingService.catch("Error in TooltipButtonComponent hideTooltip:",e)}}createOverlay(){try{let e=this.elementRef.nativeElement.querySelector("button");if(!e)return;let t=this.overlayPositionBuilder.flexibleConnectedTo(e).withPositions([{originX:"center",originY:"bottom",overlayX:"center",overlayY:"top",offsetY:8},{originX:"center",originY:"top",overlayX:"center",overlayY:"bottom",offsetY:-8},{originX:"end",originY:"center",overlayX:"start",overlayY:"center",offsetX:8},{originX:"start",originY:"center",overlayX:"end",overlayY:"center",offsetX:-8}]).withPush(!0).withFlexibleDimensions(!1).withViewportMargin(8);this.overlayRef=this.overlay.create({positionStrategy:t,scrollStrategy:this.overlay.scrollStrategies.reposition(),hasBackdrop:!1,panelClass:["velt-tooltip-overlay","velt-overlay-panel"]});let o=this.tooltip?this.tooltipTemplate:this.customTooltipTemplate,a=new Ea(o,this.viewContainerRef);this.overlayRef.attach(a);let l=this.overlayRef.overlayElement.closest(".cdk-overlay-connected-position-bounding-box");l&&l instanceof HTMLElement&&this.zIndex&&(l.style.zIndex=this.zIndex.toString()),this.overlayRef.overlayElement.addEventListener("mouseenter",this.boundOverlayMouseEnter),this.overlayRef.overlayElement.addEventListener("mouseleave",this.boundOverlayMouseLeave)}catch(e){this.loggingService.catch("Error in TooltipButtonComponent createOverlay:",e)}}hasCustomTooltipContent(){try{let t=this.elementRef.nativeElement.querySelector("[tooltipContent]");return t&&t.children.length>0}catch(e){return this.loggingService.catch("Error in TooltipButtonComponent hasCustomTooltipContent:",e),!1}}onOverlayMouseEnter(){this.hideTooltipTimer&&(clearTimeout(this.hideTooltipTimer),this.hideTooltipTimer=null)}onOverlayMouseLeave(){this.scheduleHideTooltip()}removeTooltipListeners(){try{this.buttonElement&&(this.buttonElement.removeEventListener("mouseenter",this.boundShowTooltip),this.buttonElement.removeEventListener("mouseleave",this.boundScheduleHideTooltip),this.buttonElement.removeEventListener("focus",this.boundShowTooltip),this.buttonElement.removeEventListener("blur",this.boundScheduleHideTooltip),this.buttonElement=null)}catch(e){this.loggingService.catch("Error in TooltipButtonComponent removeTooltipListeners:",e)}}onButtonClick(e){try{this.hideTooltip(),this.clicked.emit(),e.stopPropagation()}catch(t){this.loggingService.catch("Error in TooltipButtonComponent onButtonClick:",t)}}};r.\u0275fac=function(t){return new(t||r)(C(on),C(mt),C(z),C(x),C(lc),C(_C),C(Ai))},r.\u0275cmp=O({type:r,selectors:[["app-tooltip-button"]],viewQuery:function(t,o){if(t&1&&(dt(vfn,7),dt(ufn,7)),t&2){let a;ot(a=at())&&(o.tooltipTemplate=a.first),ot(a=at())&&(o.customTooltipTemplate=a.first)}},hostVars:1,hostBindings:function(t,o){t&2&&T("data-velt-element",o.veltElement)},inputs:{tooltip:"tooltip",tooltipContentClass:"tooltipContentClass",colorMode:"colorMode",type:"type",zIndex:"zIndex",unstyled:"unstyled"},outputs:{clicked:"clicked"},standalone:!1,features:[L],ngContentSelectors:hfn,decls:7,vars:13,consts:[["tooltipTemplate",""],["customTooltipTemplate",""],["role","presentation",1,"s-tooltip"],[1,"__button","s-tooltip","velt-tooltip-button",3,"click"],[1,"velt-tooltip-content","s-tooltiptext"]],template:function(t,o){if(t&1){let a=K();Wt(pfn),_(0,"div",2)(1,"button",3),G("click",function(s){return N(a),F(o.onButtonClick(s))}),p(2,ffn,2,4,"ng-template",null,0,Me)(4,Cfn,2,5,"ng-template",null,1,Me),jt(6),y()()}t&2&&(T("data-testid",o.componentId+"-tooltip"),m(),ve("unresolve",o.type==="unresolve")("colorMode",o.colorMode)("velt-tooltip-button--unresolve",o.type==="unresolve")("unstyled",o.unstyled)("velt-tooltip-button--colorMode",o.colorMode),T("aria-label",o.tooltip||"")("data-testid",o.componentId))},styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}[_nghost-%COMP%]{--velt-green: var(--velt-light-mode-green);--velt-magenta: var(--velt-light-mode-magenta);--velt-amber: var(--velt-light-mode-amber);--velt-purple: var(--velt-light-mode-purple);--velt-cyan: var(--velt-light-mode-cyan);--velt-orange: var(--velt-light-mode-orange);--velt-black: var(--velt-light-mode-black);--velt-white: var(--velt-light-mode-white);--velt-gray: var(--velt-light-mode-gray);--velt-error: var(--velt-light-mode-error);--velt-error-hover: var(--velt-light-mode-error-hover);--velt-error-foreground: var(--velt-light-mode-error-foreground);--velt-error-light: var(--velt-light-mode-error-light);--velt-error-transparent: var(--velt-light-mode-error-transparent);--velt-warning: var(--velt-light-mode-warning);--velt-warning-hover: var(--velt-light-mode-warning-hover);--velt-warning-foreground: var(--velt-light-mode-warning-foreground);--velt-warning-light: var(--velt-light-mode-warning-light);--velt-warning-transparent: var(--velt-light-mode-warning-transparent);--velt-success: var(--velt-light-mode-success);--velt-success-hover: var(--velt-light-mode-success-hover);--velt-success-foreground: var(--velt-light-mode-success-foreground);--velt-success-light: var(--velt-light-mode-success-light);--velt-success-transparent: var(--velt-light-mode-success-transparent);--velt-accent: var(--velt-light-mode-accent);--velt-accent-text: var(--velt-light-mode-accent-text);--velt-accent-hover: var(--velt-light-mode-accent-hover);--velt-accent-foreground: var(--velt-light-mode-accent-foreground);--velt-accent-light: var(--velt-light-mode-accent-light);--velt-accent-transparent: var(--velt-light-mode-accent-transparent);--velt-text-0: var(--velt-light-mode-text-0);--velt-text-1: var(--velt-light-mode-text-1);--velt-text-2: var(--velt-light-mode-text-2);--velt-text-3: var(--velt-light-mode-text-3);--velt-text-4: var(--velt-light-mode-text-4);--velt-text-5: var(--velt-light-mode-text-5);--velt-text-6: var(--velt-light-mode-text-6);--velt-text-7: var(--velt-light-mode-text-7);--velt-text-8: var(--velt-light-mode-text-8);--velt-text-9: var(--velt-light-mode-text-9);--velt-text-10: var(--velt-light-mode-text-10);--velt-text-11: var(--velt-light-mode-text-11);--velt-text-12: var(--velt-light-mode-text-12);--velt-background-0: var(--velt-light-mode-background-0);--velt-background-1: var(--velt-light-mode-background-1);--velt-background-2: var(--velt-light-mode-background-2);--velt-background-3: var(--velt-light-mode-background-3);--velt-background-4: var(--velt-light-mode-background-4);--velt-background-5: var(--velt-light-mode-background-5);--velt-background-6: var(--velt-light-mode-background-6);--velt-background-7: var(--velt-light-mode-background-7);--velt-background-8: var(--velt-light-mode-background-8);--velt-background-9: var(--velt-light-mode-background-9);--velt-background-10: var(--velt-light-mode-background-10);--velt-border-0: var(--velt-light-mode-border-0);--velt-border-1: var(--velt-light-mode-border-1);--velt-border-2: var(--velt-light-mode-border-2);--velt-border-3: var(--velt-light-mode-border-3);--velt-border-4: var(--velt-light-mode-border-4);--velt-border-5: var(--velt-light-mode-border-5);--velt-border-6: var(--velt-light-mode-border-6);--velt-border-7: var(--velt-light-mode-border-7);--velt-border-8: var(--velt-light-mode-border-8);--velt-border-9: var(--velt-light-mode-border-9);--velt-border-10: var(--velt-light-mode-border-10);--velt-background-transparent: var(--velt-light-mode-background-transparent);--velt-border-transparent: var(--velt-light-mode-border-transparent);--velt-animation-transparent: var(--velt-light-mode-animation-transparent)}[dark][_nghost-%COMP%]{--velt-green: var(--velt-dark-mode-green);--velt-magenta: var(--velt-dark-mode-magenta);--velt-amber: var(--velt-dark-mode-amber);--velt-purple: var(--velt-dark-mode-purple);--velt-cyan: var(--velt-dark-mode-cyan);--velt-orange: var(--velt-dark-mode-orange);--velt-black: var(--velt-dark-mode-black);--velt-white: var(--velt-dark-mode-white);--velt-gray: var(--velt-dark-mode-gray);--velt-error: var(--velt-dark-mode-error);--velt-error-hover: var(--velt-dark-mode-error-hover);--velt-error-foreground: var(--velt-dark-mode-error-foreground);--velt-error-light: var(--velt-dark-mode-error-light);--velt-error-transparent: var(--velt-dark-mode-error-transparent);--velt-warning: var(--velt-dark-mode-warning);--velt-warning-hover: var(--velt-dark-mode-warning-hover);--velt-warning-foreground: var(--velt-dark-mode-warning-foreground);--velt-warning-light: var(--velt-dark-mode-warning-light);--velt-warning-transparent: var(--velt-dark-mode-warning-transparent);--velt-success: var(--velt-dark-mode-success);--velt-success-hover: var(--velt-dark-mode-success-hover);--velt-success-foreground: var(--velt-dark-mode-success-foreground);--velt-success-light: var(--velt-dark-mode-success-light);--velt-success-transparent: var(--velt-dark-mode-success-transparent);--velt-accent: var(--velt-dark-mode-accent);--velt-accent-text: var(--velt-dark-mode-accent-text);--velt-accent-hover: var(--velt-dark-mode-accent-hover);--velt-accent-foreground: var(--velt-dark-mode-accent-foreground);--velt-accent-light: var(--velt-dark-mode-accent-light);--velt-accent-transparent: var(--velt-dark-mode-accent-transparent);--velt-text-0: var(--velt-dark-mode-text-0);--velt-text-1: var(--velt-dark-mode-text-1);--velt-text-2: var(--velt-dark-mode-text-2);--velt-text-3: var(--velt-dark-mode-text-3);--velt-text-4: var(--velt-dark-mode-text-4);--velt-text-5: var(--velt-dark-mode-text-5);--velt-text-6: var(--velt-dark-mode-text-6);--velt-text-7: var(--velt-dark-mode-text-7);--velt-text-8: var(--velt-dark-mode-text-8);--velt-text-9: var(--velt-dark-mode-text-9);--velt-text-10: var(--velt-dark-mode-text-10);--velt-text-11: var(--velt-dark-mode-text-11);--velt-text-12: var(--velt-dark-mode-text-12);--velt-background-0: var(--velt-dark-mode-background-0);--velt-background-1: var(--velt-dark-mode-background-1);--velt-background-2: var(--velt-dark-mode-background-2);--velt-background-3: var(--velt-dark-mode-background-3);--velt-background-4: var(--velt-dark-mode-background-4);--velt-background-5: var(--velt-dark-mode-background-5);--velt-background-6: var(--velt-dark-mode-background-6);--velt-background-7: var(--velt-dark-mode-background-7);--velt-background-8: var(--velt-dark-mode-background-8);--velt-background-9: var(--velt-dark-mode-background-9);--velt-background-10: var(--velt-dark-mode-background-10);--velt-border-0: var(--velt-dark-mode-border-0);--velt-border-1: var(--velt-dark-mode-border-1);--velt-border-2: var(--velt-dark-mode-border-2);--velt-border-3: var(--velt-dark-mode-border-3);--velt-border-4: var(--velt-dark-mode-border-4);--velt-border-5: var(--velt-dark-mode-border-5);--velt-border-6: var(--velt-dark-mode-border-6);--velt-border-7: var(--velt-dark-mode-border-7);--velt-border-8: var(--velt-dark-mode-border-8);--velt-border-9: var(--velt-dark-mode-border-9);--velt-border-10: var(--velt-dark-mode-border-10);--velt-background-transparent: var(--velt-dark-mode-background-transparent);--velt-border-transparent: var(--velt-dark-mode-border-transparent);--velt-animation-transparent: var(--velt-dark-mode-animation-transparent)}.velt-tooltip-button[_ngcontent-%COMP%]{border:0;border-radius:var(--velt-border-radius-full);width:28px;height:28px;flex-shrink:0;display:flex;align-items:center;justify-content:center;cursor:pointer;background:transparent;transition:.5s;color:var(--velt-text-4)}.velt-tooltip-button.unstyled[_ngcontent-%COMP%]{background-color:initial;border-radius:initial;height:initial;width:initial;padding:initial;border:initial;color:initial;transition:initial}.velt-tooltip-button.velt-tooltip-button--colorMode[_ngcontent-%COMP%]{color:var(--velt-white)}.velt-tooltip-button.velt-tooltip-button--colorMode.velt-tooltip-button--unresolve[_ngcontent-%COMP%]{background:var(--velt-success);color:var(--velt-success-foreground)}.velt-tooltip-button.dropdown[_ngcontent-%COMP%] .dropdown-content[_ngcontent-%COMP%]{border:1px solid var(--velt-border-2);box-shadow:none;border-radius:var(--velt-border-radius-md);top:95%}.velt-tooltip-button[_ngcontent-%COMP%]:hover{background-color:var(--velt-background-3);cursor:pointer}.velt-tooltip-button[_ngcontent-%COMP%]:hover.unstyled{background-color:transparent}.velt-tooltip-button[_ngcontent-%COMP%]:hover.velt-tooltip-button--colorMode:hover{background:color-mix(in srgb,var(--velt-background-2) 20%,transparent)}.velt-tooltip-button[_ngcontent-%COMP%]:hover.velt-tooltip-button--colorMode:hover.velt-tooltip-button--unresolve{background:var(--velt-success-hover)}@media (max-width: 768px){button[_ngcontent-%COMP%]{padding:0}} .velt-tooltip-overlay{z-index:1000} .velt-tooltip-overlay .velt-tooltip-content{font-family:var(--velt-default-font-family);background:var(--velt-light-mode-background-1);color:var(--velt-light-mode-text-1);border:1px solid var(--velt-light-mode-border-2);border-radius:var(--velt-border-radius-sm);padding:8px 12px;font-size:12px;line-height:1.4;max-width:200px;word-wrap:break-word;box-shadow:0 4px 12px #00000026;position:relative;animation:_ngcontent-%COMP%_tooltipFadeIn .2s ease-out forwards}@keyframes _ngcontent-%COMP%_tooltipFadeIn{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}} .velt-tooltip-overlay .velt-tooltip-content--dark{background:var(--velt-dark-mode-background-1);color:var(--velt-dark-mode-text-1);border-color:var(--velt-dark-mode-border-2);box-shadow:0 4px 12px #0000004d}"],changeDetection:0});let n=r;return n})();var _fn=["*"],aK=(()=>{let r=class r extends Ct{constructor(e,t,o,a){super(o,a),this.loggingService=e,this.customFilterService=t,this.elementRef=o,this.themeService=a,this.headingMode=!1,this.changeStatus=new Fe,this.componentId="velt-resolve-button"}ngOnInit(){try{this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in ResolveButtonComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in ResolveButtonComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{bfn(this.elementRef.nativeElement,this.componentId)}catch(e){this.loggingService.catch("Error in ResolveButtonComponent setupA11yAttributes:",e)}}resolveComment(e){this.loggingService.log("%c[WB] Calling FUNCTION: resolveComment","color: green;");try{if(!this.annotation)return;this.changeStatus.emit({status:this.customFilterService.resolvedStatus,statusOptionType:e})}catch(t){this.catchError("Error in CommentDialogComponent resolveComment: ",t)}}catchError(e,t,o){try{this.loggingService.catch(e,t,E(b({},o||{}),{annotationId:this.annotation?.annotationId}))}catch{}}};r.\u0275fac=function(t){return new(t||r)(C(x),C(nr),C(z),C(mt))},r.\u0275cmp=O({type:r,selectors:[["app-resolve-button"]],inputs:{annotation:"annotation",sidebarMode:"sidebarMode",headingMode:"headingMode",zIndex:"zIndex"},outputs:{changeStatus:"changeStatus"},standalone:!1,features:[L],ngContentSelectors:_fn,decls:3,vars:9,consts:[[3,"clicked","tooltip","darkMode","colorMode","zIndex"]],template:function(t,o){t&1&&(Wt(),_(0,"app-tooltip-button",0),M(1,"translate"),G("clicked",function(){return o.resolveComment("button")}),jt(2),y()),t&2&&(ct("color",(o.annotation==null||o.annotation.status==null?null:o.annotation.status.color)+" !important"),g("tooltip",R(1,7,"Resolve"))("darkMode",o.darkMode)("colorMode",o.headingMode)("zIndex",o.zIndex||1e3),T("data-testid",o.componentId))},dependencies:[Md,ue],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}"],changeDetection:0});let n=r;return n})();function bfn(n,r){try{n.setAttribute("role","presentation"),n.setAttribute("data-testid",r+"-container")}catch{}}var Sfn=[[["","icon",""]],[["","extra",""]]],yfn=["[icon]","[extra]"],xN=(()=>{let r=class r extends Ct{constructor(e,t,o,a){super(o,t,e),this.changeDetector=e,this.themeService=t,this.elementRef=o,this.loggingService=a,this.clicked=new Fe,this.componentId="velt-action-button"}ngOnInit(){try{this.loggingService.log("%c[WB] Calling FUNCTION: ngOnInit","color: green;"),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in ActionButtonComponent ngOnInit:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","presentation")}catch(e){this.loggingService.catch("Error in ActionButtonComponent setupA11yAttributes:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in ActionButtonComponent ngOnDestroy:",e)}}};r.\u0275fac=function(t){return new(t||r)(C(on),C(mt),C(z),C(x))},r.\u0275cmp=O({type:r,selectors:[["app-action-button"]],inputs:{title:"title",disabled:"disabled"},outputs:{clicked:"clicked"},standalone:!1,features:[L],ngContentSelectors:yfn,decls:5,vars:11,consts:[["tabindex","0",1,"velt-action-button","action__button",3,"click","title","disabled"]],template:function(t,o){t&1&&(Wt(Sfn),_(0,"button",0),M(1,"translate"),M(2,"translate"),G("click",function(){return o.clicked.emit()}),jt(3),y(),jt(4,1)),t&2&&(ve("velt-action-button--disabled",o.disabled),g("title",R(1,7,o.title||""))("disabled",o.disabled),T("aria-label",R(2,9,o.title||"Action button"))("aria-disabled",o.disabled)("data-testid",o.componentId))},dependencies:[ue],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}button.action__button.velt-action-button[_ngcontent-%COMP%]{border:0;width:calc((2rem + 0px) * var(--velt-base-rem-unit));height:calc((2rem + 0px) * var(--velt-base-rem-unit));flex-shrink:0;display:flex;align-items:center;justify-content:center;background:transparent;transition:.5s;border-radius:var(--velt-border-radius-full);color:var(--velt-text-10)}button.action__button.velt-action-button[_ngcontent-%COMP%]:hover{background:var(--velt-background-3);cursor:pointer}@media (max-width: 768px){button[_ngcontent-%COMP%]{padding:0}}"],changeDetection:0});let n=r;return n})();var Ifn=(n,r,i,e,t,o)=>({template:n,componentName:r,variant:i,suffix:e,setIfCondition:t,componentElementRef:o});function Efn(n,r){n&1&&(h(0),de(),_(1,"svg",5),D(2,"path",6),y(),f())}var Xye=(()=>{let r=class r extends Ct{constructor(e,t,o,a){super(t,o,e),this.changeDetector=e,this.elementRef=t,this.themeService=o,this.loggingService=a,this.clicked=new Fe,this.selectFiles=new Fe,this.setIfConditionEvent=new Fe,this.acceptAttribute=Oe(""),this.componentId="velt-attachment-button"}ngOnInit(){try{this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in AttachmentButtonComponent ngOnInit:",e)}}ngOnChanges(e){try{if(super.ngOnChanges(e),e.allowedFileTypes&&e.allowedFileTypes.previousValue!==e.allowedFileTypes.currentValue){let t=this.getAcceptAttribute(e.allowedFileTypes.currentValue);this.acceptAttribute.set(t)}}catch(t){this.loggingService.catch("Error in AttachmentButtonComponent ngOnChanges:",t)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in AttachmentButtonComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{kfn(this.elementRef.nativeElement,this.componentId)}catch(e){this.loggingService.catch("Error in AttachmentButtonComponent setupA11yAttributes:",e)}}setIfConditionEventCalled(e){try{this.setIfConditionEvent.emit(e)}catch(t){this.loggingService.catch("Error in AttachmentButtonComponent setIfConditionEventCalled:",t)}}getAcceptAttribute(e){try{return e?.length?e.map(o=>{let a=o.toLowerCase().replace(".","");switch(a){case"png":case"jpg":case"jpeg":case"gif":case"webp":case"svg":return`image/${a==="jpg"?"jpeg":a==="svg"?"svg+xml":a}`;case"pdf":return"application/pdf";case"mp4":case"webm":case"ogg":return`video/${a}`;case"csv":return"text/csv";case"json":return"application/json";case"xls":return"application/vnd.ms-excel";case"xlsx":return"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";case"doc":return"application/msword";case"docx":return"application/vnd.openxmlformats-officedocument.wordprocessingml.document";case"ppt":return"application/vnd.ms-powerpoint";case"pptx":return"application/vnd.openxmlformats-officedocument.presentationml.presentation";case"txt":return"text/plain";default:return`.${a}`}}).join(", "):"image/png, image/gif, image/jpeg, image/svg+xml, image/webp, application/pdf, video/*, text/csv, application/json, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.wordprocessingml.document, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.openxmlformats-officedocument.presentationml.presentation, text/plain"}catch(t){return this.loggingService.catch("Error in AttachmentButtonComponent getAcceptAttribute:",t),""}}};r.\u0275fac=function(t){return new(t||r)(C(on),C(z),C(mt),C(x))},r.\u0275cmp=O({type:r,selectors:[["app-attachment-button"]],inputs:{template:"template",componentMeta:"componentMeta",allowedFileTypes:"allowedFileTypes"},outputs:{clicked:"clicked",selectFiles:"selectFiles",setIfConditionEvent:"setIfConditionEvent"},standalone:!1,features:[L,it],decls:8,vars:22,consts:[["fileInputRef",""],[3,"clicked","darkMode","title","ariaLabel"],["icon","","aria-hidden","true",1,"velt-attachment-button--icon"],[4,"veltDynamicTemplate"],["extra","","type","file","multiple","","tabindex","-1",1,"velt-attachment-button--input","file-upload-input",3,"change","accept"],["width","18","height","18","viewBox","0 0 18 18","fill","none","xmlns","http://www.w3.org/2000/svg","aria-hidden","true","focusable","false"],["fill-rule","evenodd","clip-rule","evenodd","d","M12.9295 0.71123C12.3395 0.803913 11.6796 1.06532 11.2298 1.3845C11.0263 1.52893 2.52007 9.03742 2.04935 9.48817C1.00899 10.4844 0.506081 11.9146 0.711064 13.2941C0.851555 14.2395 1.27958 15.0628 2.01012 15.7928C2.43833 16.2207 2.80773 16.4885 3.33384 16.7523C5.03396 17.6049 7.15751 17.5119 8.75811 16.5147C9.15263 16.2689 9.26532 16.175 10.8619 14.7616C11.6227 14.0881 12.6557 13.1735 13.1576 12.7292C13.6595 12.2849 14.625 11.4304 15.3033 10.8303C15.9816 10.2302 16.5717 9.68614 16.6147 9.62127C16.8654 9.24269 16.7159 8.68509 16.3068 8.47273C16.0924 8.36142 15.8057 8.3495 15.6017 8.44345C15.5271 8.47788 13.9216 9.87541 11.8443 11.7142C9.84941 13.48 8.11611 14.992 7.99257 15.0741C7.60179 15.3337 7.13724 15.5224 6.60924 15.6361C6.28899 15.7051 5.40697 15.7125 5.10817 15.6487C3.9235 15.396 3.0364 14.7672 2.58094 13.8576C2.37358 13.4435 2.30765 13.1555 2.30765 12.6644C2.30765 12.3244 2.32193 12.1911 2.3802 11.9873C2.52372 11.4852 2.79821 11.0383 3.20713 10.6411C3.3386 10.5133 4.48087 9.49485 5.74557 8.37774C8.22821 6.18475 9.71094 4.87325 11.2002 3.55303C12.0417 2.80708 12.1801 2.6972 12.4406 2.56811C12.9245 2.32836 13.39 2.24958 13.8905 2.32269C14.4532 2.40492 14.8442 2.59357 15.2108 2.95974C15.8379 3.58622 15.885 4.44576 15.3305 5.14671C15.1737 5.34504 8.02444 11.6759 7.78908 11.8249C7.28914 12.1415 6.84228 12.0807 6.57896 11.6603C6.3994 11.3736 6.44062 11.0391 6.68556 10.7956C6.75071 10.7309 7.74228 9.84838 8.88908 8.83454C10.0359 7.82073 11.2376 6.75804 11.5595 6.47305C12.2694 5.84466 12.3362 5.75879 12.3535 5.4526C12.3691 5.17745 12.3222 5.02657 12.1678 4.85547C11.9214 4.58228 11.5505 4.50031 11.2349 4.64926C11.1217 4.70264 10.2696 5.43521 8.44851 7.04449C7.00565 8.31957 5.69952 9.49029 5.54603 9.64602C5.23559 9.96099 5.06326 10.237 4.93561 10.6236C4.86603 10.8343 4.85277 10.9368 4.85062 11.2803C4.84782 11.727 4.90641 11.9879 5.09213 12.3556C5.34043 12.8471 5.83894 13.2975 6.36283 13.5037C7.23344 13.8464 8.26299 13.6025 9.1321 12.8477C9.24815 12.7469 10.1867 11.9185 11.2178 11.0069C12.2488 10.0953 13.7743 8.74778 14.6078 8.01238C15.4412 7.27701 16.2303 6.56564 16.3612 6.43156C16.7849 5.99759 17.0791 5.48562 17.2389 4.90396C17.358 4.47067 17.3644 3.79519 17.2538 3.35054C17.0553 2.55319 16.4914 1.77933 15.7647 1.30696C14.9688 0.789649 13.8829 0.561492 12.9295 0.71123Z","fill","currentColor"]],template:function(t,o){if(t&1){let a=K();_(0,"app-action-button",1),M(1,"translate"),M(2,"translate"),G("clicked",function(){N(a);let s=Ce(6);return s==null||s.click(),F(o.clicked.emit())}),_(3,"div",2),p(4,Efn,3,0,"ng-container",3),y(),_(5,"input",4,0),M(7,"translate"),G("change",function(s){return N(a),F(o.selectFiles.emit(s))}),y()()}t&2&&(g("darkMode",o.darkMode)("title",R(1,9,"Attach files"))("ariaLabel",R(2,11,"Attach files")),T("data-testid",o.componentId+"-trigger"),m(3),T("data-testid",o.componentId+"-icon"),m(),g("veltDynamicTemplate",vi(15,Ifn,o.template,o.componentMeta==null?null:o.componentMeta.componentName,o.componentMeta==null?null:o.componentMeta.variant,o.componentMeta==null?null:o.componentMeta.suffix,o.setIfConditionEventCalled.bind(o),o.elementRef)),m(),g("accept",o.acceptAttribute()),T("aria-label",R(7,13,"Attach files input"))("data-testid",o.componentId+"-input"))},dependencies:[xN,Q,ue],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}.velt-attachment-button--input[_ngcontent-%COMP%]{display:none}.velt-attachment-button--icon[_ngcontent-%COMP%]{display:flex}"],changeDetection:0});let n=r;return n})();function kfn(n,r){try{n.setAttribute("role","presentation"),n.setAttribute("data-testid",r+"-container")}catch{}}var lK=(()=>{let r=class r extends Ct{constructor(e,t,o,a,l,s,d,v){super(d,s,void 0,void 0,void 0,v,l),this.analyticsService=e,this.authService=t,this.arrowService=o,this.iamService=a,this.loggingService=l,this.themeService=s,this.elementRef=d,this.dynamicDataService=v,this.customButtonAdded=!1,this.disabled=!1,this.addArrowMode=!1,this.subscriptions=[],this.veltElement=!0,this.subscriptions.push(this.authService.getUser$().subscribe(u=>{this.user=u},u=>{this.loggingService.catch("Error in ArrowsToolComponent getUser$ subscription: ",u)}))}ngAfterViewInit(){try{this.subscriptions.push(this.arrowService.addArrowModeChange().subscribe(e=>{this.addArrowMode=e})),this.subscriptions.push(this.iamService.getFeaturesAccessLevel$().subscribe(e=>{this.disabled=!!e?.all?.disabled}))}catch(e){this.loggingService.catch("Error in ArrowsToolComponent AfterViewInit: ",e)}}onButtonSlotChange(){this.customButtonAdded=!0}addArrow(){this.loggingService.log("%c[WB] Calling FUNCTION: addArrow","color: green;");try{if(this.analyticsService.trackEvent(Y.Events.Arrow.ARROW_TOOL_CLICKED,{toolType:this.customButtonAdded?"custom":"default"}),this.user){if(this.disabled){this.loggingService.catch("Arrows are disabled.");return}this.user.isReadOnly||this.user.isAnonymous?this.loggingService.catch("Anonymous/Readonly users cannot add arrows."):!this.authService.isPlanExpired()&&this.iamService.getRole()?this.arrowService.enableAddArrowMode():this.loggingService.catch("User does not have permission to add arrows.")}else this.loggingService.catch("Velt sdk not authenticated.")}catch(e){this.loggingService.catch("Error in ArrowsToolComponent addArrow: ",e)}}ngOnDestroy(){this.loggingService.log("%c[WB] Calling FUNCTION: ngOnDestroy","color: green;");try{super.ngOnDestroy(),this.unsubscribe()}catch(e){this.loggingService.catch("Error in ArrowsToolComponent ondestroy: ",e)}}unsubscribe(){this.loggingService.log("%c[WB] Calling FUNCTION: unsubscribe","color: green;");try{this.subscriptions.map(e=>{e.unsubscribe()}),this.subscriptions=[]}catch(e){this.loggingService.catch("Error in ArrowsToolComponent unsubscribe: ",e)}}};r.\u0275fac=function(t){return new(t||r)(C(rt),C(Ge),C(Fm),C(An),C(x),C(mt),C(z),C(I))},r.\u0275cmp=O({type:r,selectors:[["snippyly-arrows-tool"]],hostVars:1,hostBindings:function(t,o){t&2&&T("data-velt-element",o.veltElement)},standalone:!1,features:[j([I]),L],decls:5,vars:2,consts:[["part","container",1,"snippyly-arrow-btn-container",3,"click"],["name","button",3,"slotchange"],["part","button-container","tabindex","0",1,"action-btn"],["part","button-icon","width","24","height","24","viewBox","0 0 25 24","fill","none","xmlns","http://www.w3.org/2000/svg",1,"action-btn-icon"],["d","M17.5 7L7.5 17M17.5 7H10M17.5 7V14.5","stroke","currentColor","stroke-width","1.5","stroke-linecap","round","stroke-linejoin","round"]],template:function(t,o){t&1&&(_(0,"div",0),G("click",function(l){return o.addArrow(),l.stopPropagation()}),_(1,"slot",1),G("slotchange",function(){return o.onButtonSlotChange()}),_(2,"div",2),de(),_(3,"svg",3),D(4,"path",4),y()()()()),t&2&&(m(2),ve("active",o.addArrowMode))},styles:[`html{--velt-base-rem-unit: 1}*[data-snippyly-element=true],*[data-velt-element=true]{font-family:var(--velt-default-font-family)}velt-wireframe{display:none!important}*{box-sizing:border-box;-webkit-tap-highlight-color:rgba(255,255,255,0)!important;outline:none!important;margin:0!important;padding:0!important;height:unset;width:unset;text-align:left!important;line-height:1.5!important;font-size:calc((1rem + 0px) * var(--velt-base-rem-unit))}*:empty{display:revert!important}.snippyly-arrow-btn-container{display:inline-block}.action-btn{display:flex;justify-content:center;align-items:center;padding:6px!important;border-radius:var(--legacy-velt-tool-border-radius);border:var(--legacy-velt-tool-border);background-color:var(--legacy-velt-tool-bg-color)}.action-btn .action-btn-icon{width:calc((var(--legacy-velt-tool-icon-size) + 0px) * var(--velt-base-rem-unit));height:calc((var(--legacy-velt-tool-icon-size) + 0px) * var(--velt-base-rem-unit));color:var(--legacy-velt-tool-icon-color);cursor:pointer}.action-btn:focus{border-radius:var(--legacy-velt-tool-focus-border-radius);border:var(--legacy-velt-tool-focus-border);background-color:var(--legacy-velt-tool-focus-bg-color)}.action-btn:focus .action-btn-icon{width:calc((var(--legacy-velt-tool-focus-icon-size) + 0px) * var(--velt-base-rem-unit));height:calc((var(--legacy-velt-tool-focus-icon-size) + 0px) * var(--velt-base-rem-unit));color:var(--legacy-velt-tool-focus-icon-color)}.action-btn:hover{border-radius:var(--legacy-velt-tool-hover-border-radius);border:var(--legacy-velt-tool-hover-border);background-color:var(--legacy-velt-tool-hover-bg-color)}.action-btn:hover .action-btn-icon{width:calc((var(--legacy-velt-tool-hover-icon-size) + 0px) * var(--velt-base-rem-unit));height:calc((var(--legacy-velt-tool-hover-icon-size) + 0px) * var(--velt-base-rem-unit));color:var(--legacy-velt-tool-hover-icon-color)}.action-btn:active,.action-btn.active{border-radius:var(--legacy-velt-tool-active-border-radius);border:var(--legacy-velt-tool-active-border);background-color:var(--legacy-velt-tool-active-bg-color)}.action-btn:active .action-btn-icon,.action-btn.active .action-btn-icon{width:calc((var(--legacy-velt-tool-active-icon-size) + 0px) * var(--velt-base-rem-unit));height:calc((var(--legacy-velt-tool-active-icon-size) + 0px) * var(--velt-base-rem-unit));color:var(--legacy-velt-tool-active-icon-color)}
|
|
554
554
|
`],encapsulation:3,changeDetection:0});let n=r;return n})();var Tfn=["handle"],wfn=["arrowRef"],Dfn=["headRef"],Ofn=n=>({transform:n});function Afn(n,r){if(n&1){let i=K();_(0,"div",8,2),G("cdkDragStarted",function(t){N(i);let o=c();return F(o.onDragStarted(t))})("cdkDragMoved",function(t){N(i);let o=c();return F(o.onDragMoved(t))})("cdkDragReleased",function(t){N(i);let o=c();return F(o.onDragReleased(t))}),de(),_(2,"svg",9),D(3,"path",10)(4,"path",11),y()()}if(n&2){let i=c();ve("s-arrow-annotation-handle-dragging",i.isResizing),g("cdkDragRootElement","arrow-pin-container-"+(i.arrowPinAnnotation==null?null:i.arrowPinAnnotation.annotationId))("cdkDragDisabled",!i.isEditable||i.isResizing)}}function Pfn(n,r){if(n&1){let i=K();_(0,"div",12,2),G("cdkDragStarted",function(){N(i);let t=c();return F(t.onResizeHandleDragStarted())})("cdkDragMoved",function(t){N(i);let o=c();return F(o.onResizeHandleDragMoved(t))})("cdkDragReleased",function(){N(i);let t=c();return F(t.onResizeHandleDragReleased())}),de(),_(2,"svg",13),D(3,"path",14),y()()}if(n&2){let i=c();ve("s-arrow-annotation-handle-dragging",i.isResizing)}}var Jye=(()=>{let r=class r{get arrowPinAnnotation(){return this._arrowPinAnnotation}set arrowPinAnnotation(e){this._arrowPinAnnotation=e,this.updatedArrowAngle&&this.arrowPinAnnotation?.props&&(this.arrowPinAnnotation.props.arrowAngle=this.updatedArrowAngle),this.calculateArrowWidthBasedOnViewport()}get arrowPinSelected(){return this._arrowPinSelected}set arrowPinSelected(e){this._arrowPinSelected=e,this.updateHighlightOnElement()}get arrowPinHover(){return this._arrowPinHover}set arrowPinHover(e){this._arrowPinHover=e,this.updateHighlightOnElement()}constructor(e,t,o,a){this.arrowService=e,this.domService=t,this.loggingService=o,this.elementRef=a,this._arrowPinSelected=!1,this.multipleArrowPinsSelected=!1,this.dragStarted=new Fe,this.dragMoved=new Fe,this.dragReleased=new Fe,this._arrowPinHover=!1,this.subscriptions=[],this.veltElement=!0,this.isDragging=!1,this.isResizing=!1,this.isEditable=!1,this.centerX=0,this.centerY=0,this.newAngle=0,this.newWidth=0,this.updatedArrowAngle=0,this.MIN_ARROW_LENGTH=V.VELT_MIN_ARROW_LENGTH,this.pointerEventSubscriptions=[],this.loggingService.log("%c[WB] Creating COMPONENT ArrowPinComponent","color: blue;")}ngOnInit(){this.loggingService.log("%c[WB] Calling FUNCTION: ngOnInit","color: green;")}ngAfterViewInit(){try{this.updateHighlightOnElement(),setTimeout(()=>{this.calculateArrowWidthBasedOnViewport()},100)}catch(e){this.loggingService.catch("Error in ArrowPinComponent AfterViewInit: ",e)}}ngOnChanges(e){try{e.arrowPinAnnotation&&this.checkIsEditable(),e.user&&this.checkIsEditable()}catch(t){this.loggingService.catch("Error in ArrowPinComponent ngOnChanges: ",t)}}checkIsEditable(){try{this.user?.userId===this.arrowPinAnnotation?.from?.userId?this.isEditable=!0:this.user&&!this.user.isAnonymous&&!this.user.isGuest?this.isEditable=!0:this.isEditable=!1}catch(e){this.loggingService.catch("Error in ArrowPinComponent checkIsEditable: ",e)}}onResizeHandleDragStarted(){try{this.isResizing||(this.updatedArrowAngle=0,this.updateCenter(),this.isResizing=!0)}catch(e){this.loggingService.catch("Error in ArrowPinComponent onResizeHandleDragStarted: ",e)}}onResizeHandleDragMoved(e){try{let t=e.event;if(!this.isResizing||!this.isWithinViewport(t))return;let o=this.getAngleAndDistanceFromMouseEvent(t);this.newAngle=o.angle,this.newWidth=Math.min(o.distance,this.getMaxAllowedArrowLength()),t.stopPropagation()}catch(t){this.loggingService.catch("Error in ArrowPinComponent onResizeHandleDragMoved: ",t)}}onResizeHandleDragReleased(){try{this.isResizing=!1,this.updateArrowPinAnnotationProps(),setTimeout(()=>{this.newAngle=0,this.newWidth=0},100)}catch(e){this.loggingService.catch("Error in ArrowPinComponent onResizeHandleDragReleased: ",e)}}updateCenter(){try{let e=this.elementRef.nativeElement.getBoundingClientRect();this.centerX=e.x,this.centerY=e.y}catch(e){this.loggingService.catch("Error in ArrowPinComponent updateCenter: ",e)}}getAngleAndDistanceFromMouseEvent(e){try{let t=e instanceof MouseEvent?e.clientX:e.touches[0].clientX,o=e instanceof MouseEvent?e.clientY:e.touches[0].clientY,a=t-this.centerX,l=o-this.centerY,d=Math.atan2(l,a)*(180/Math.PI);d=d<0?d+360:d;let v=Math.sqrt(a*a+l*l);return{angle:d,distance:v}}catch(t){return this.loggingService.catch("Error in ArrowPinComponent getAngleAndDistanceFromMouseEvent: ",t),{angle:0,distance:0}}}isWithinViewport(e){try{return typeof TouchEvent<"u"&&e instanceof TouchEvent?e.touches[0].clientX>=0&&e.touches[0].clientX<=window?.innerWidth&&e.touches[0].clientY>=0&&e.touches[0].clientY<=window?.innerHeight:e.clientX>=0&&e.clientX<=window?.innerWidth&&e.clientY>=0&&e.clientY<=window?.innerHeight}catch(t){return this.loggingService.catch("Error in ArrowPinComponent isWithinViewport: ",t),!1}}calculateArrowWidthBasedOnViewport(){try{if(this.isDragging)return;if(this.arrowPinAnnotation?.props){let e=this.arrowPinAnnotation.props.viewportWidth||0,t=this.arrowPinAnnotation.props.viewportHeight||0,o=window.innerWidth,a=window.innerHeight;this.arrowPinAnnotation.props.arrowLength||(this.arrowPinAnnotation.props.arrowLength=0);let l=(this.arrowPinAnnotation.props.arrowAngle||0)%360;l>45&&l<135||l>225&&l<315?t>0&&(this.arrowPinAnnotation.props.arrowLength=this.arrowPinAnnotation.props.arrowLength*a/t):e>0&&(this.arrowPinAnnotation.props.arrowLength=this.arrowPinAnnotation.props.arrowLength*o/e);let s=this.arrowRef?.nativeElement?.getBoundingClientRect();if(s){l<0&&(l=360+l);let d=l,v=l>90&&l<=180,u=l>180&&l<=270,S=o-s.x;(v||u)&&(S=s.right,d=180-l);let k=n7(S-V.VELT_ARROW_VIEWPORT_PADDING,d);if(k>0&&this.arrowPinAnnotation.props.arrowLength>k)if(k<this.MIN_ARROW_LENGTH){let A=(this.arrowPinAnnotation.props.arrowAngle||0)%360;A>=90&&A<=270?this.updatedArrowAngle=45:this.updatedArrowAngle=135,this.arrowPinAnnotation.props.arrowLength=this.MIN_ARROW_LENGTH}else this.arrowPinAnnotation.props.arrowLength=k}this.arrowPinAnnotation.props.arrowLength=Math.min(this.arrowPinAnnotation.props.arrowLength,this.getMaxAllowedArrowLength())}}catch(e){this.loggingService.catch("Error in ArrowPinComponent calculateArrowWidthBasedOnViewport: ",e)}}getMaxAllowedArrowLength(){try{return Math.max(window.innerWidth,window.innerHeight)*.8}catch(e){return this.loggingService.catch("Error in ArrowPinComponent getMaxAllowedArrowLength: ",e),0}}updateHighlightOnElement(){try{this.targetElement&&(this.arrowPinSelected||this.arrowPinHover?this.domService.highlightElement(this.targetElement):this.domService.removeHighlightFromElement(this.targetElement))}catch(e){this.loggingService.catch("Error in ArrowPinComponent updateHighlightOnElement: ",e)}}updateArrowPinAnnotationProps(){try{this.arrowPinAnnotation?.props||(this.arrowPinAnnotation.props=new Ic),this.arrowPinAnnotation.props.viewportWidth=window.innerWidth,this.arrowPinAnnotation.props.viewportHeight=window.innerHeight,this.arrowPinAnnotation.props.arrowAngle=this.newAngle,this.arrowPinAnnotation.props.arrowLength=this.newWidth,this.arrowService.updateArrow(this.arrowPinAnnotation)}catch(e){this.loggingService.catch("Error in ArrowPinComponent updateArrowPinAnnotation: ",e)}}onPointerOver(e){try{e.buttons?this.arrowPinHover&&(this.arrowPinHover=!1):this.arrowPinHover||(this.arrowPinHover=!0)}catch(t){this.loggingService.catch("Error in ArrowPinComponent onPointerOver: ",t)}}onDragStarted(e){this.isDragging=!0,this.dragStarted.emit(e)}onDragMoved(e){this.dragMoved.emit(e)}onDragReleased(e){this.isDragging=!1,this.dragReleased.emit(e)}onPointerOut(){this.arrowPinHover=!1}ngOnDestroy(){this.loggingService.log("%c[WB] Calling FUNCTION: ngOnDestroy","color: green;");try{this.unsubscribe()}catch(e){this.loggingService.catch("Error in ArrowPinComponent ondestroy: ",e)}}unsubscribe(){this.loggingService.log("%c[WB] Calling FUNCTION: unsubscribe","color: green;");try{this.subscriptions.map(e=>{e.unsubscribe()}),this.subscriptions=[]}catch(e){this.loggingService.catch("Error in ArrowPinComponent unsubscribe: ",e)}}};r.\u0275fac=function(t){return new(t||r)(C(Fm),C(Ve),C(x),C(z))},r.\u0275cmp=O({type:r,selectors:[["snippyly-arrow-pin"]],viewQuery:function(t,o){if(t&1&&(dt(Tfn,5),dt(wfn,5),dt(Dfn,5)),t&2){let a;ot(a=at())&&(o.handle=a.first),ot(a=at())&&(o.arrowRef=a.first),ot(a=at())&&(o.headRef=a.first)}},hostVars:1,hostBindings:function(t,o){t&2&&T("data-velt-element",o.veltElement)},inputs:{arrowPinAnnotation:"arrowPinAnnotation",arrowPinSelected:"arrowPinSelected",multipleArrowPinsSelected:"multipleArrowPinsSelected",user:"user",targetElement:"targetElement"},outputs:{dragStarted:"dragStarted",dragMoved:"dragMoved",dragReleased:"dragReleased"},standalone:!1,features:[it],decls:7,vars:15,consts:[["arrowRef",""],["headRef",""],["handle",""],[1,"s-arrow-annotation",3,"pointerover","pointerout","click","ngStyle"],["class","s-arrow-annotation-drag-handle","cdkDrag","","cdkDragHandle","",3,"s-arrow-annotation-handle-dragging","cdkDragRootElement","cdkDragDisabled","cdkDragStarted","cdkDragMoved","cdkDragReleased",4,"ngIf"],[1,"s-arrow-annotation-head"],[1,"s-arrow-annotation-line"],["class","s-arrow-annotation-handle","cdkDrag","",3,"s-arrow-annotation-handle-dragging","cdkDragStarted","cdkDragMoved","cdkDragReleased",4,"ngIf"],["cdkDrag","","cdkDragHandle","",1,"s-arrow-annotation-drag-handle",3,"cdkDragStarted","cdkDragMoved","cdkDragReleased","cdkDragRootElement","cdkDragDisabled"],["width","32","height","32","viewBox","0 0 24 24","fill","none","xmlns","http://www.w3.org/2000/svg"],["d","M18.0039 5.99219H14.4039M18.0039 5.99219V9.59219M18.0039 5.99219L13.8039 10.1922M6.00391 17.9922H9.60391M6.00391 17.9922V14.3922M6.00391 17.9922L10.2039 13.7922","stroke","#0093FF","stroke-width","1.2","stroke-linecap","round","stroke-linejoin","round"],["d","M6 5.99219H9.6M6 5.99219V9.59219M6 5.99219L10.2 10.1922M18 17.9922H14.4M18 17.9922V14.3922M18 17.9922L13.8 13.7922","stroke","#0093FF","stroke-width","1.2","stroke-linecap","round","stroke-linejoin","round"],["cdkDrag","",1,"s-arrow-annotation-handle",3,"cdkDragStarted","cdkDragMoved","cdkDragReleased"],["width","16","height","16","viewBox","0 0 10 10","fill","none","xmlns","http://www.w3.org/2000/svg"],["d","M1 5C1 3.11438 1 2.17157 1.58579 1.58579C2.17157 1 3.11438 1 5 1C6.88562 1 7.82843 1 8.41421 1.58579C9 2.17157 9 3.11438 9 5C9 6.88562 9 7.82843 8.41421 8.41421C7.82843 9 6.88562 9 5 9C3.11438 9 2.17157 9 1.58579 8.41421C1 7.82843 1 6.88562 1 5Z","stroke","#0093FF","stroke-width","1.5"]],template:function(t,o){if(t&1){let a=K();_(0,"div",3,0),G("pointerover",function(s){return N(a),F(o.onPointerOver(s))})("pointerout",function(){return N(a),F(o.onPointerOut())})("click",function(s){return N(a),F(s.preventDefault())}),p(2,Afn,5,4,"div",4),D(3,"div",5,1)(5,"div",6),p(6,Pfn,4,2,"div",7),y()}t&2&&(ct("width",o.newWidth||(o.arrowPinAnnotation==null||o.arrowPinAnnotation.props==null?null:o.arrowPinAnnotation.props.arrowLength)||o.MIN_ARROW_LENGTH,"px"),ve("s-arrow-annotation-selected",o.arrowPinSelected)("s-arrow-annotation-draggable",o.isEditable),g("ngStyle",$(13,Ofn,"rotate("+(o.newAngle||o.updatedArrowAngle||(o.arrowPinAnnotation==null||o.arrowPinAnnotation.props==null?null:o.arrowPinAnnotation.props.arrowAngle)||0)+"deg)")),m(2),g("ngIf",o.isEditable),m(),ct("border-right-color",((o.arrowPinAnnotation==null||o.arrowPinAnnotation.from==null?null:o.arrowPinAnnotation.from.color)||(o.arrowPinAnnotation==null?null:o.arrowPinAnnotation.color))+" !important"),m(2),ct("background-color",((o.arrowPinAnnotation==null||o.arrowPinAnnotation.from==null?null:o.arrowPinAnnotation.from.color)||(o.arrowPinAnnotation==null?null:o.arrowPinAnnotation.color))+" !important"),m(),g("ngIf",o.isEditable))},dependencies:[se,yg,ua,wg],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}.s-arrow-annotation[_ngcontent-%COMP%]{position:absolute!important;z-index:20!important;height:calc((.4rem + 0px) * var(--velt-base-rem-unit))!important;transform-origin:0 100%!important;left:50%!important;top:50%!important;display:flex!important;align-items:center!important;justify-content:flex-end!important}.s-arrow-annotation[_ngcontent-%COMP%] .s-arrow-annotation-line[_ngcontent-%COMP%]{height:calc((.4rem + 0px) * var(--velt-base-rem-unit))!important;transform-origin:0 100%!important;width:100%!important;background-color:#625df5!important}.s-arrow-annotation[_ngcontent-%COMP%] .s-arrow-annotation-head[_ngcontent-%COMP%]{width:0!important;height:0!important;border-top:calc((1.1rem + 0px) * var(--velt-base-rem-unit)) solid transparent!important;border-bottom:calc((1.1rem + 0px) * var(--velt-base-rem-unit)) solid transparent!important;border-right:calc((1.1rem + 0px) * var(--velt-base-rem-unit)) solid #625DF5!important}.s-arrow-annotation[_ngcontent-%COMP%] .s-arrow-annotation-drag-handle[_ngcontent-%COMP%]{transform:none!important;cursor:move!important;display:flex!important;position:absolute!important;left:-20px!important;opacity:0!important}.s-arrow-annotation[_ngcontent-%COMP%] .s-arrow-annotation-handle[_ngcontent-%COMP%]{transform:none!important;display:flex!important;opacity:0!important;cursor:grab!important}.s-arrow-annotation[_ngcontent-%COMP%] .s-arrow-annotation-handle[_ngcontent-%COMP%] svg[_ngcontent-%COMP%]{width:calc((1rem + 0px) * var(--velt-base-rem-unit))!important;height:calc((1rem + 0px) * var(--velt-base-rem-unit))!important}.s-arrow-annotation[_ngcontent-%COMP%] .s-arrow-annotation-handle.s-arrow-annotation-handle-dragging[_ngcontent-%COMP%]{cursor:grabbing!important}.s-arrow-annotation[_ngcontent-%COMP%]:hover .s-arrow-annotation-drag-handle[_ngcontent-%COMP%], .s-arrow-annotation.s-arrow-annotation-selected[_ngcontent-%COMP%] .s-arrow-annotation-drag-handle[_ngcontent-%COMP%], .s-arrow-annotation[_ngcontent-%COMP%]:hover .s-arrow-annotation-handle[_ngcontent-%COMP%], .s-arrow-annotation.s-arrow-annotation-selected[_ngcontent-%COMP%] .s-arrow-annotation-handle[_ngcontent-%COMP%]{opacity:1!important}"],changeDetection:0});let n=r;return n})();var Rfn=["arrowPinRef"];function Nfn(n,r){if(n&1){let i=K();_(0,"div",3),G("pointerup",function(t){return N(i),c(2).togglePinSelection(),F(t.stopPropagation())})("pointerdown",function(t){return N(i),F(t.stopPropagation())})("click",function(t){return N(i),F(t.stopPropagation())}),_(1,"snippyly-arrow-pin",4,0),G("dragStarted",function(){N(i);let t=c(2);return F(t.onPinDragStart())})("dragMoved",function(t){N(i);let o=c(2);return F(o.onPinMove(t))})("dragReleased",function(){N(i);let t=c(2);return F(t.onPinRelease())}),y()()}if(n&2){let i=c().ngIf,e=c();ct("top",i.annotationDragging?i.dragPosition==null?null:i.dragPosition.top:(i.arrowPinAnnotation==null||i.arrowPinAnnotation.position==null?null:i.arrowPinAnnotation.position.top)+i.offsetTop,"px")("left",i.annotationDragging?i.dragPosition==null?null:i.dragPosition.left:(i.arrowPinAnnotation==null||i.arrowPinAnnotation.position==null?null:i.arrowPinAnnotation.position.left)+i.offsetLeft,"px"),ve("pin-dragging",i.annotationDragging),g("id","arrow-pin-container-"+(i.arrowPinAnnotation==null?null:i.arrowPinAnnotation.annotationId)),m(),g("arrowPinAnnotation",i.arrowPinAnnotation)("arrowPinSelected",i.selectedAnnotationsMap[i.arrowPinAnnotation==null?null:i.arrowPinAnnotation.annotationId]&&!i.annotationDragging&&e.objectKeys(i.selectedAnnotationsMap).length===1)("multipleArrowPinSelected",i.selectedAnnotationsMap[i.arrowPinAnnotation==null?null:i.arrowPinAnnotation.annotationId]&&e.objectKeys(i.selectedAnnotationsMap).length>1)("targetElement",i.targetElement)("user",i.user)}}function Ffn(n,r){if(n&1&&(h(0),p(1,Nfn,3,12,"div",2),f()),n&2){let i=r.ngIf;m(),g("ngIf",i.arrowPinAnnotation==null?null:i.arrowPinAnnotation.position)}}var Qye=(()=>{let r=class r{constructor(e,t,o,a,l){this.analyticsService=e,this.authService=t,this.domService=o,this.arrowService=a,this.loggingService=l,this.multipleArrowPinsSelected=!1,this.avatarErrorImage="",this.objectKeys=Object.keys,this.subscriptions=[],this.componentConfigSignal=Oe({arrowPinAnnotation:void 0,annotationDragging:!1,dragPosition:null,offsetTop:0,offsetLeft:0,selectedAnnotationsMap:{},targetElement:void 0,user:void 0}),this.veltElement=!0,this.subscriptions.push(this.authService.getUser$().subscribe(s=>{this.componentConfigSignal.update(d=>(d=E(b({},d),{user:s}),d))},s=>{this.loggingService.catch("Error in ArrowPinPortalComponent getUser$ subscription: ",s)})),this.subscriptions.push(this.domService.getSelectedAnnotationsMap$().subscribe(s=>{this.componentConfigSignal.update(d=>(d=E(b({},d),{selectedAnnotationsMap:s}),d))},s=>{this.loggingService.catch("Error in ArrowPinPortalComponent getSelectedAnnotationsMap$ subscription: ",s)}))}ngOnInit(){}setArrowPinAnnotation(e){try{this.componentConfigSignal.update(t=>(t=E(b({},t),{arrowPinAnnotation:e}),t)),this.id=this.componentConfigSignal().arrowPinAnnotation?.annotationId}catch(t){this.loggingService.catch("Error in ArrowPinPortalComponent setArrowPinAnnotation: ",t)}}setTargetElement(e){try{this.componentConfigSignal.update(t=>(t=E(b({},t),{targetElement:e}),t))}catch(t){this.loggingService.catch("Error in ArrowPinPortalComponent setTargetElement: ",t)}}setOffsetLeft(e){try{this.componentConfigSignal.update(t=>(t=E(b({},t),{offsetLeft:e}),t))}catch(t){this.loggingService.catch("Error in ArrowPinPortalComponent setOffsetLeft: ",t)}}setOffsetTop(e){try{this.componentConfigSignal.update(t=>(t=E(b({},t),{offsetTop:e}),t))}catch(t){this.loggingService.catch("Error in ArrowPinPortalComponent setOffsetTop: ",t)}}togglePinSelection(){try{this.domService.toggleAnnotationSelection(this.componentConfigSignal().arrowPinAnnotation)}catch(e){this.loggingService.catch("Error in ArrowPinPortalComponent togglePinSelection: ",e)}}onPinDragStart(){this.componentConfigSignal().selectedAnnotationsMap[this.componentConfigSignal().arrowPinAnnotation.annotationId]&&this.domService.toggleAnnotationSelection(this.componentConfigSignal().arrowPinAnnotation);let e=document.getElementById(this.componentConfigSignal().arrowPinAnnotation.annotationId);e&&(this.parentElement=e.parentElement,e.style.opacity="0",document.body.appendChild(e)),this.componentConfigSignal.update(t=>(t=E(b({},t),{annotationDragging:!0}),t)),setTimeout(()=>{e&&(e.style.opacity="1")},50)}onPinMove(e){try{this.updateCurrentPinPosition(e)}catch(t){this.loggingService.catch("Error in ArrowPinPortalComponent onPinMove: ",t)}}updateCurrentPinPosition(e){try{this.domService.removeHighlightFromElement(this.componentConfigSignal().targetElement);let t=e.event,o=t?.touches?.length?t.touches[0]?.clientX:t.clientX,a=t?.touches?.length?t.touches[0]?.clientY:t.clientY,l=this.domService.getBackgroundElement(o,a);l&&(this.componentConfigSignal.update(s=>(s=E(b({},s),{targetElement:l}),s)),this.domService.highlightElement(this.componentConfigSignal().targetElement),this.pointerMoveEvent=e.event,this.componentConfigSignal.update(s=>(s=E(b({},s),{dragPosition:{top:a,left:o}}),s)))}catch(t){this.loggingService.catch("Error in ArrowPinPortalComponent updateCurrentPinPosition: ",t)}}onPinRelease(){try{let e=document.getElementById(this.componentConfigSignal().arrowPinAnnotation.annotationId);e&&this.parentElement&&this.parentElement.appendChild(e);let t=this.domService.getElementFromXPath(this.componentConfigSignal().arrowPinAnnotation.targetElement?.xpath);if(this.pointerMoveEvent){this.componentConfigSignal.update(u=>(u=b({},u),u.arrowPinAnnotation.targetElement=this.domService.getTargetElementForCursorPosition(this.pointerMoveEvent),u));let l=this.pointerMoveEvent,s=l?.touches?.length?l.touches[0]?.clientX:l.clientX,d=!1;if(s<V.VELT_MIN_ARROW_LENGTH){let u=this.componentConfigSignal().arrowPinAnnotation.props.arrowAngle||0;u>=90&&u<=270&&(this.componentConfigSignal.update(S=>(S=b({},S),S.arrowPinAnnotation.props.arrowAngle=45,S)),d=!0)}if(s>window?.innerWidth-V.VELT_MIN_ARROW_LENGTH){let u=this.componentConfigSignal().arrowPinAnnotation.props.arrowAngle||0;(u>=270&&u<=360||u>=0&&u<=90)&&(this.componentConfigSignal.update(S=>(S=b({},S),S.arrowPinAnnotation.props.arrowAngle=135,S)),d=!0)}if(!d){let u=s,S=this.componentConfigSignal().arrowPinAnnotation.props.arrowAngle||0;S>=0&&S<=90||S>=270&&S<=360?u=window.innerWidth-s:S=180-S;let k=n7(u-V.VELT_ARROW_VIEWPORT_PADDING,S);k>0&&k<(this.componentConfigSignal().arrowPinAnnotation.props.arrowLength||0)&&this.componentConfigSignal.update(A=>(A=b({},A),A.arrowPinAnnotation.props.arrowLength=k,A))}let v=this.domService.getCurrentWindowSizeValue();this.componentConfigSignal.update(u=>(u=b({},u),u.arrowPinAnnotation.props.screenWidth=v.screenWidth,u.arrowPinAnnotation.props.screenHeight=v.screenHeight,u.arrowPinAnnotation.props.screenScrollHeight=v.screenScrollHeight,u.arrowPinAnnotation.props.viewportWidth=window.innerWidth,u.arrowPinAnnotation.props.viewportHeight=window.innerHeight,u))}let o=this.domService.getElementFromXPath(this.componentConfigSignal().arrowPinAnnotation.targetElement?.xpath),a=this.domService.isElementInsideAdditionalLocationContainer(t)||this.domService.isElementInsideAdditionalLocationContainer(o);this.arrowService.updateArrow(this.componentConfigSignal().arrowPinAnnotation,!1,a),setTimeout(()=>{this.componentConfigSignal.update(l=>(l=b({},l),l.annotationDragging=!1,l.dragPosition=null,l)),this.domService.removeHighlightFromElement(this.componentConfigSignal().targetElement),this.arrowPinRef&&(this.arrowPinRef.updatedArrowAngle=0)},100),this.analyticsService.trackEvent(Y.Events.Arrow.ARROW_DRAGGED,{annotationId:this.componentConfigSignal().arrowPinAnnotation.annotationId})}catch(e){this.loggingService.catch("Error in ArrowPinPortalComponent onPinRelease: ",e)}}ngOnDestroy(){this.loggingService.log("%c[WB] Calling FUNCTION: ngOnDestroy","color: green;");try{this.unsubscribe()}catch(e){this.loggingService.catch("Error in ArrowPinPortalComponent ondestroy: ",e)}}unsubscribe(){this.loggingService.log("%c[WB] Calling FUNCTION: unsubscribe","color: green;");try{this.subscriptions.map(e=>{e.unsubscribe()}),this.subscriptions=[]}catch(e){this.loggingService.catch("Error in ArrowPinPortalComponent unsubscribe: ",e)}}};r.\u0275fac=function(t){return new(t||r)(C(rt),C(Ge),C(Ve),C(Fm),C(x))},r.\u0275cmp=O({type:r,selectors:[["snippyly-arrow-pin-portal"]],viewQuery:function(t,o){if(t&1&&dt(Rfn,5),t&2){let a;ot(a=at())&&(o.arrowPinRef=a.first)}},hostVars:2,hostBindings:function(t,o){t&2&&(Po("id",o.id),T("data-velt-element",o.veltElement))},inputs:{multipleArrowPinsSelected:"multipleArrowPinsSelected",avatarErrorImage:"avatarErrorImage"},standalone:!1,decls:1,vars:1,consts:[["arrowPinRef",""],[4,"ngIf"],["class","arrow-pin-portal",3,"id","pin-dragging","top","left","pointerup","pointerdown","click",4,"ngIf"],[1,"arrow-pin-portal",3,"pointerup","pointerdown","click","id"],[3,"dragStarted","dragMoved","dragReleased","arrowPinAnnotation","arrowPinSelected","multipleArrowPinSelected","targetElement","user"]],template:function(t,o){t&1&&p(0,Ffn,2,1,"ng-container",1),t&2&&g("ngIf",o.componentConfigSignal())},dependencies:[se,Jye],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}[_nghost-%COMP%]{position:absolute!important;top:0!important;left:0!important;box-sizing:border-box!important;-webkit-tap-highlight-color:rgba(255,255,255,0)!important;outline:none!important;margin:0!important;padding:0!important;height:unset!important;width:unset!important;text-align:left!important}*[_ngcontent-%COMP%]{box-sizing:border-box;-webkit-tap-highlight-color:rgba(255,255,255,0)!important;outline:none!important;margin:0!important;padding:0!important;height:unset;width:unset;text-align:left!important;line-height:1.5!important;color:#000!important;font-size:calc((1rem + 0px) * var(--velt-base-rem-unit))}*[_ngcontent-%COMP%]:empty{display:revert!important}.arrow-pin-portal[_ngcontent-%COMP%]{position:absolute;transform:none!important;top:0;left:0}.arrow-pin-portal.pin-dragging[_ngcontent-%COMP%]{position:fixed;z-index:var(--velt-arrow-z-index)!important}"],changeDetection:0});let n=r;return n})();var exe=(()=>{let r=class r{constructor(e,t,o,a,l){this.domService=e,this.componentFactoryResolver=t,this.injector=o,this.appRef=a,this.loggingService=l,this.arrowsPinById={}}setArrowPin(e){try{if(!this.arrowsPinById[e.annotationId])this.setPinPortal(e);else if(e.targetElement?.xpath===this.arrowsPinById[e.annotationId]?.annotation?.targetElement?.xpath){let t=this.arrowsPinById[e.annotationId].portalRef,o=this.arrowsPinById[e.annotationId].userTargetElement,a=this.arrowsPinById[e.annotationId].pinHostElement;if(document.body.contains(o)&&document.body.contains(a))t&&(t.instance.setArrowPinAnnotation(JSON.parse(JSON.stringify(e))),this.updateElementOffset(e));else{let l=this.arrowsPinById[e.annotationId].pinHostDomPortalOutlet;l&&(this.arrowsPinById[e.annotationId].pinHostElement?.removeAttribute(V.ATTRIBUTES.VELT_ARROW_PIN_HOST),this.arrowsPinById[e.annotationId].pinHostElement?.removeAttribute(V.ATTRIBUTES.VELT_ARROW_PIN_HOST_STATIC),l.detach(),delete this.arrowsPinById[e.annotationId],this.setPinPortal(e))}}else{let t=this.arrowsPinById[e.annotationId].pinHostDomPortalOutlet;t&&(this.arrowsPinById[e.annotationId].pinHostElement?.removeAttribute(V.ATTRIBUTES.VELT_ARROW_PIN_HOST),this.arrowsPinById[e.annotationId].pinHostElement?.removeAttribute(V.ATTRIBUTES.VELT_ARROW_PIN_HOST_STATIC),t.detach(),delete this.arrowsPinById[e.annotationId],this.setPinPortal(e))}}catch(t){this.loggingService.catch("Error in ArrowPinPortalService setArrowPin: ",t)}}setPinPortal(e){try{let t=this.domService.getXPath(e.targetElement?.xpath);if(t){let o=t.iterateNext();if(o){let a=this.domService.getHostElement(o),l=new Io(Qye),s=new Eo(a,this.appRef,this.injector),d=s.attach(l);d.instance.setArrowPinAnnotation(JSON.parse(JSON.stringify(e))),d.instance.setTargetElement(o),this.arrowsPinById[e.annotationId]={pinHostDomPortalOutlet:s,pinPortal:l,portalRef:d,annotation:JSON.parse(JSON.stringify(e)),userTargetElement:o,pinHostElement:a},a.setAttribute(V.ATTRIBUTES.VELT_ARROW_PIN_HOST,e.annotationId),window.getComputedStyle(a).position==="static"&&(xm(a)||a.setAttribute(V.ATTRIBUTES.VELT_ARROW_PIN_HOST_STATIC,"true")),this.updateElementOffset(e)}}}catch(t){this.loggingService.catch("Error in ArrowPinPortalService setPinPortal: ",t)}}updateElementOffset(e){try{let{portalRef:t,userTargetElement:o,pinHostElement:a}=this.arrowsPinById[e.annotationId],l=this.domService.getElementOffset(o,a);t.instance.setOffsetLeft(l.offsetLeft),t.instance.setOffsetTop(l.offsetTop)}catch(t){this.loggingService.catch("Error in ArrowPinPortalService updateElementOffset: ",t)}}checkPinsToRemove(e){try{let t=e.map(o=>o.annotationId);Object.keys(this.arrowsPinById).forEach(o=>{if(!t.includes(o)){let a=this.arrowsPinById[o];a.pinHostDomPortalOutlet.detach(),a.pinHostElement?.removeAttribute(V.ATTRIBUTES.VELT_ARROW_PIN_HOST),a.pinHostElement?.removeAttribute(V.ATTRIBUTES.VELT_ARROW_PIN_HOST_STATIC),this.domService.removeHighlightFromElement(a.pinHostElement),delete this.arrowsPinById[o]}})}catch(t){this.loggingService.catch("Error in ArrowPinPortalService checkPinsToRemove: ",t)}}};r.\u0275fac=function(t){return new(t||r)(J(Ve),J(Hr),J(Tt),J(fi),J(x))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var sK=(()=>{let r=class r{constructor(e,t,o,a,l,s){this.analyticsService=e,this.authService=t,this.domService=o,this.arrowService=a,this.arrowPinPortalService=l,this.loggingService=s,this.arrowPinAnnotations=[],this.subscriptions=[],this.isFirstComponent=!0,this.veltId=St(),this.veltElement=!0;try{this.loggingService.log("%c[WB] Creating CLASS: ArrowsContainerComponent","color: blue;")}catch(d){this.loggingService.catch("Error in ArrowsContainerComponent constructor: ",d)}}ngOnInit(){this.loggingService.log("%c[WB] Calling FUNCTION: ngOnInit","color: green;")}ngAfterViewInit(){try{let e=document.querySelector(V.TAGS.SNIPPYLY_ARROWS),t=document.querySelector(V.TAGS.VELT_ARROWS);t?this.veltId===t?.getAttribute(V.ATTRIBUTES.VELT_ID)&&(this.isFirstComponent=!0,this.initComponent()):this.veltId===e?.getAttribute(V.ATTRIBUTES.VELT_ID)&&(this.isFirstComponent=!0,this.initComponent())}catch(e){this.loggingService.catch("Error in ArrowsContainerComponent AfterViewInit: ",e)}}initComponent(){try{this.subscriptions.push(this.authService.getUser$().pipe(je(e=>!!e)).subscribe(e=>{e&&this.setArrowInstalledInAnalytics()},e=>{this.loggingService.catch("Error in getUser: ",e)})),this.getAllArrowsOnCurrentDocument()}catch(e){this.loggingService.catch("Error in ArrowsContainerComponent initComponent: ",e)}}getAllArrowsOnCurrentDocument(){this.loggingService.log("%c[WB] Calling FUNCTION: getAllArrowsOnCurrentDocument","color: green;");try{this.subscriptions.push(this.arrowService.getAllArrowAnnotations().pipe(je(e=>!!e),fe(e=>this.domService.getSelectedAnnotationsMap$().pipe(ge(t=>({annotations:e,selectedAnnotationsMap:t||{}}))))).subscribe(e=>{try{this.loggingService.log(e),this.arrowPinAnnotations=e?.annotations;let t=this.arrowPinAnnotations.filter(o=>o.targetElement);this.arrowPinPortalService.checkPinsToRemove(t),t.forEach(o=>{this.arrowPinPortalService.setArrowPin(o)})}catch(t){this.loggingService.catch("Error in ArrowsContainerComponent getAllArrowsOnCurrentDocument inside subscription: ",t)}},e=>{this.loggingService.catch("Error in ArrowsContainerComponent getAllArrowsOnCurrentDocument subscription: ",e)}))}catch(e){this.loggingService.catch("Error in ArrowsContainerComponent getAllArrowsOnCurrentDocument: ",e)}}ngOnDestroy(){this.loggingService.log("%c[WB] Calling FUNCTION: ngOnDestroy","color: green;");try{this.unsubscribe()}catch(e){this.loggingService.catch("Error in ArrowsContainerComponent ondestroy: ",e)}}unsubscribe(){this.loggingService.log("%c[WB] Calling FUNCTION: unsubscribe","color: green;");try{this.subscriptions.map(e=>{e.unsubscribe()}),this.subscriptions=[]}catch(e){this.loggingService.catch("Error in ArrowsContainerComponent unsubscribe: ",e)}}setArrowInstalledInAnalytics(){try{this.analyticsService.setInstalledFeature(Be.ARROW)}catch(e){this.loggingService.catch("Error in ArrowsContainerComponent setArrowInstalledInAnalytics: ",e)}}};r.\u0275fac=function(t){return new(t||r)(C(rt),C(Ge),C(Ve),C(Fm),C(exe),C(x))},r.\u0275cmp=O({type:r,selectors:[["snippyly-arrows-container"]],hostVars:2,hostBindings:function(t,o){t&2&&T("data-velt-id",o.veltId)("data-velt-element",o.veltElement)},standalone:!1,decls:0,vars:0,template:function(t,o){},encapsulation:2,changeDetection:0});let n=r;return n})();var txe=()=>({bottom:"cal(100% - 8px)",color:"green"});function Ufn(n,r){if(n&1){let i=K();_(0,"div",8),G("click",function(){N(i);let t=c(3);return F(t.togglePinSelection())}),_(1,"snippyly-comment-pin",9),G("saveComment",function(t){N(i);let o=c(3);return F(o.saveComment(t))}),y()()}if(n&2){let i=c(2).ngIf,e=c();g("id","comment-pin-container-"+(i.commentPinAnnotation==null?null:i.commentPinAnnotation.annotationId)),m(),ct("left",8,"px"),g("ngStyle",yt(9,txe))("annotationDragging",i.isResizing)("annotation",i.commentPinAnnotation)("commentPinSelected",i.selectedAnnotationsMap[i.commentPinAnnotation==null?null:i.commentPinAnnotation.annotationId]&&e.objectKeys(i.selectedAnnotationsMap).length===1)("multipleCommentPinSelected",i.selectedAnnotationsMap[i.commentPinAnnotation==null?null:i.commentPinAnnotation.annotationId]&&e.objectKeys(i.selectedAnnotationsMap).length>1)("user",e.user)}}function Bfn(n,r){if(n&1){let i=K();_(0,"div",8),G("click",function(){N(i);let t=c(3);return F(t.togglePinSelection())}),_(1,"snippyly-comment-pin",9),G("saveComment",function(t){N(i);let o=c(3);return F(o.saveComment(t))}),y()()}if(n&2){let i=c(2).ngIf,e=c();g("id","comment-pin-container-"+(i.multiThreadCommentAnnotation==null?null:i.multiThreadCommentAnnotation.annotationId)),m(),ct("left",8,"px"),g("ngStyle",yt(9,txe))("annotationDragging",i.isResizing)("annotation",i.multiThreadCommentAnnotation)("commentPinSelected",!!i.selectedAnnotationsMap[i.multiThreadCommentAnnotation==null?null:i.multiThreadCommentAnnotation.annotationId])("multipleCommentPinSelected",i.selectedAnnotationsMap[i.multiThreadCommentAnnotation==null?null:i.multiThreadCommentAnnotation.annotationId]&&e.objectKeys(i.selectedAnnotationsMap).length>1)("user",e.user)}}function Vfn(n,r){if(n&1){let i=K();h(0),_(1,"div",1),G("click",function(){N(i);let t=c(2);return F(t.togglePinSelection())}),y(),_(2,"div",2),G("click",function(){N(i);let t=c(2);return F(t.togglePinSelection())}),y(),_(3,"div",3),G("click",function(){N(i);let t=c(2);return F(t.togglePinSelection())}),y(),_(4,"div",4),G("click",function(){N(i);let t=c(2);return F(t.togglePinSelection())}),y(),_(5,"div",5),G("cdkDragStarted",function(){N(i);let t=c(2);return F(t.onResizeHandleDragStart("topLeft"))})("cdkDragMoved",function(t){N(i);let o=c(2);return F(o.onResizeHandleDragMove(t,"topLeft"))})("cdkDragEnded",function(){N(i);let t=c(2);return F(t.onResizeHandleDragEnd("topLeft"))})("click",function(){N(i);let t=c(2);return F(t.togglePinSelection())}),y(),_(6,"div",6),G("cdkDragStarted",function(){N(i);let t=c(2);return F(t.onResizeHandleDragStart("bottomRight"))})("cdkDragMoved",function(t){N(i);let o=c(2);return F(o.onResizeHandleDragMove(t,"bottomRight"))})("cdkDragEnded",function(){N(i);let t=c(2);return F(t.onResizeHandleDragEnd("bottomRight"))})("click",function(){N(i);let t=c(2);return F(t.togglePinSelection())}),p(7,Ufn,2,10,"div",7)(8,Bfn,2,10,"div",7),y(),f()}if(n&2){let i=c().ngIf,e=c();m(),ct("border-color",i.areaAnnotationColor)("width",e.LINE_THICKNESS,"px")("height",(i.areaProperties==null||i.areaProperties.coordinates==null||i.areaProperties.coordinates.bottomLeft==null?null:i.areaProperties.coordinates.bottomLeft.y)-(i.areaProperties==null||i.areaProperties.coordinates==null||i.areaProperties.coordinates.topLeft==null?null:i.areaProperties.coordinates.topLeft.y),"px")("left",(i.areaProperties==null||i.areaProperties.coordinates==null||i.areaProperties.coordinates.topLeft==null?null:i.areaProperties.coordinates.topLeft.x)+(i.isResizing?i.resizingOffset.left:i.offsetLeft),"px")("top",(i.areaProperties==null||i.areaProperties.coordinates==null||i.areaProperties.coordinates.topLeft==null?null:i.areaProperties.coordinates.topLeft.y)+(i.isResizing?i.resizingOffset.top:i.offsetTop),"px"),m(),ct("border-color",i.areaAnnotationColor)("height",e.LINE_THICKNESS,"px")("width",(i.areaProperties==null||i.areaProperties.coordinates==null||i.areaProperties.coordinates.bottomRight==null?null:i.areaProperties.coordinates.bottomRight.x)-(i.areaProperties==null||i.areaProperties.coordinates==null||i.areaProperties.coordinates.topLeft==null?null:i.areaProperties.coordinates.topLeft.x),"px")("left",(i.areaProperties==null||i.areaProperties.coordinates==null||i.areaProperties.coordinates.topLeft==null?null:i.areaProperties.coordinates.topLeft.x)+(i.isResizing?i.resizingOffset.left:i.offsetLeft),"px")("top",(i.areaProperties==null||i.areaProperties.coordinates==null||i.areaProperties.coordinates.topLeft==null?null:i.areaProperties.coordinates.topLeft.y)+(i.isResizing?i.resizingOffset.top:i.offsetTop),"px"),m(),ct("border-color",i.areaAnnotationColor)("width",e.LINE_THICKNESS,"px")("height",(i.areaProperties==null||i.areaProperties.coordinates==null||i.areaProperties.coordinates.bottomRight==null?null:i.areaProperties.coordinates.bottomRight.y)-(i.areaProperties==null||i.areaProperties.coordinates==null||i.areaProperties.coordinates.topRight==null?null:i.areaProperties.coordinates.topRight.y),"px")("left",(i.areaProperties==null||i.areaProperties.coordinates==null||i.areaProperties.coordinates.bottomRight==null?null:i.areaProperties.coordinates.bottomRight.x)+(i.isResizing?i.resizingOffset.left:i.offsetLeft),"px")("top",(i.areaProperties==null||i.areaProperties.coordinates==null||i.areaProperties.coordinates.topRight==null?null:i.areaProperties.coordinates.topRight.y)+(i.isResizing?i.resizingOffset.top:i.offsetTop),"px"),m(),ct("border-color",i.areaAnnotationColor)("height",e.LINE_THICKNESS,"px")("width",(i.areaProperties==null||i.areaProperties.coordinates==null||i.areaProperties.coordinates.topRight==null?null:i.areaProperties.coordinates.topRight.x)-(i.areaProperties==null||i.areaProperties.coordinates==null||i.areaProperties.coordinates.bottomLeft==null?null:i.areaProperties.coordinates.bottomLeft.x),"px")("left",(i.areaProperties==null||i.areaProperties.coordinates==null||i.areaProperties.coordinates.bottomLeft==null?null:i.areaProperties.coordinates.bottomLeft.x)+(i.isResizing?i.resizingOffset.left:i.offsetLeft),"px")("top",(i.areaProperties==null||i.areaProperties.coordinates==null||i.areaProperties.coordinates.bottomLeft==null?null:i.areaProperties.coordinates.bottomLeft.y)+(i.isResizing?i.resizingOffset.top:i.offsetTop),"px"),m(),ct("background-color",i.areaAnnotationColor)("width",e.DRAG_HANDLE_SIZE,"px")("height",e.DRAG_HANDLE_SIZE,"px")("left",(i.areaProperties==null||i.areaProperties.handle1==null?null:i.areaProperties.handle1.x)+(i.isResizing?i.resizingOffset.left:i.offsetLeft)-e.DRAG_HANDLE_SIZE/2,"px")("top",(i.areaProperties==null||i.areaProperties.handle1==null?null:i.areaProperties.handle1.y)+(i.isResizing?i.resizingOffset.top:i.offsetTop)-e.DRAG_HANDLE_SIZE/2,"px"),ve("drag-disabled",(i.areaPinAnnotation==null||i.areaPinAnnotation.from==null?null:i.areaPinAnnotation.from.userId)!==(e.user==null?null:e.user.userId)),g("cdkDragDisabled",(i.areaPinAnnotation==null||i.areaPinAnnotation.from==null?null:i.areaPinAnnotation.from.userId)!==(e.user==null?null:e.user.userId)),m(),ct("background-color",i.areaAnnotationColor)("width",e.DRAG_HANDLE_SIZE,"px")("height",e.DRAG_HANDLE_SIZE,"px")("left",(i.areaProperties==null||i.areaProperties.handle2==null?null:i.areaProperties.handle2.x)+(i.isResizing?i.resizingOffset.left:i.offsetLeft)-e.DRAG_HANDLE_SIZE/2,"px")("top",(i.areaProperties==null||i.areaProperties.handle2==null?null:i.areaProperties.handle2.y)+(i.isResizing?i.resizingOffset.top:i.offsetTop)-e.DRAG_HANDLE_SIZE/2,"px"),ve("drag-disabled",(i.areaPinAnnotation==null||i.areaPinAnnotation.from==null?null:i.areaPinAnnotation.from.userId)!==(e.user==null?null:e.user.userId)),g("cdkDragDisabled",(i.areaPinAnnotation==null||i.areaPinAnnotation.from==null?null:i.areaPinAnnotation.from.userId)!==(e.user==null?null:e.user.userId)),m(),g("ngIf",i.commentPinAnnotation),m(),g("ngIf",i.multiThreadCommentAnnotation)}}function jfn(n,r){if(n&1&&(h(0),p(1,Vfn,9,68,"ng-container",0),f()),n&2){let i=r.ngIf,e=c();m(),g("ngIf",!i.hideAreaAnnotation||e.selected)}}var nxe=(()=>{let r=class r{get resizing(){return this.componentConfigSignal().isResizing}onMouseEnter(){this.setAreaPinHover(!0)}onMouseLeave(){this.setAreaPinHover(!1)}constructor(e,t,o,a,l,s,d){this.analyticsService=e,this.authService=t,this.commentService=o,this.docService=a,this.domService=l,this.areaService=s,this.loggingService=d,this.multipleAreaPinsSelected=!1,this.avatarErrorImage="",this.objectKeys=Object.keys,this.subscriptions=[],this.annotationDragging=!1,this.dragPosition=null,this.LINE_THICKNESS=0,this.DRAG_HANDLE_SIZE=10,this.skipValueUpdate=!1,this.areaPinHover=!1,this.resolvedCommentsOnDom=!1,this.componentConfigSignal=Oe({hideAreaAnnotation:!1,selected:!1,areaAnnotationColor:"#625DF5",areaProperties:void 0,resizingOffset:{top:0,left:0},offsetLeft:0,offsetTop:0,isResizing:!1,areaPinAnnotation:void 0,user:void 0,commentPinAnnotation:void 0,selectedAnnotationsMap:{}}),this.selected=!1,this.veltElement=!0,this.subscriptions.push(this.authService.getUser$().subscribe(v=>{this.user=v},v=>{this.catchError("Error in AreaPinPortalComponent getUser$ subscription: ",v)})),this.subscriptions.push(this.domService.getSelectedAnnotationsMap$().subscribe(v=>{this.componentConfigSignal.update(u=>(u=E(b({},u),{selectedAnnotationsMap:v}),u)),this.componentConfigSignal().areaPinAnnotation?.annotationId&&this.componentConfigSignal().selectedAnnotationsMap&&(this.selected=!!this.componentConfigSignal().selectedAnnotationsMap[this.componentConfigSignal().areaPinAnnotation.annotationId],this.componentConfigSignal().commentPinAnnotation?this.selected=!!this.componentConfigSignal().selectedAnnotationsMap[this.componentConfigSignal().commentPinAnnotation?.annotationId]:this.componentConfigSignal().multiThreadCommentAnnotation&&(this.selected=!!this.componentConfigSignal().selectedAnnotationsMap[this.componentConfigSignal().multiThreadCommentAnnotation?.annotationId])),this.updateAreaActiveAttributeOnElement()},v=>{this.catchError("Error in AreaPinPortalComponent getSelectedAnnotationsMap$ subscription: ",v)}))}ngOnInit(){}ngAfterViewInit(){try{let e=this.componentConfigSignal().areaPinAnnotation.targetAnnotations?.find(o=>o?.type===Be.COMMENT)?.annotationId,t=this.componentConfigSignal().areaPinAnnotation.targetAnnotations?.find(o=>o?.type===Be.MULTI_THREAD)?.annotationId;e?(this.componentConfigSignal.update(o=>(o=E(b({},o),{hideAreaAnnotation:!0}),o)),this.subscriptions.push(this.commentService.getCommentAnnotationByAnnotationId(e).pipe(fe(o=>this.commentService.getResolvedCommentsOnDom$().pipe(ge(a=>(this.resolvedCommentsOnDom=a,o))))).subscribe(o=>{this.componentConfigSignal.update(a=>(a=E(b({},a),{commentPinAnnotation:o}),a.commentPinAnnotation?(a.areaAnnotationColor=a.commentPinAnnotation?.status.color,!this.resolvedCommentsOnDom&&!(this.commentService.getFilterCommentsOnDom()&&this.commentService.getCommentsFromSidebarMap())&&a.commentPinAnnotation?.status.type==="terminal"?a.hideAreaAnnotation=!0:a.hideAreaAnnotation=!1):a.hideAreaAnnotation=!0,a))}))):t?(this.componentConfigSignal.update(o=>(o=E(b({},o),{hideAreaAnnotation:!0}),o)),this.subscriptions.push(this.commentService.getMultiThreadCommentAnnotationByAnnotationId(t).pipe(fe(o=>this.commentService.getResolvedCommentsOnDom$().pipe(ge(a=>(this.resolvedCommentsOnDom=a,o))))).subscribe(o=>{this.componentConfigSignal.update(a=>(a=E(b({},a),{multiThreadCommentAnnotation:o}),a.hideAreaAnnotation=!1,a))}))):this.componentConfigSignal.update(o=>(o=E(b({},o),{areaAnnotationColor:this.componentConfigSignal().areaPinAnnotation?.from?.color||"#625DF5"}),o)),this.componentConfigSignal().areaPinAnnotation?.targetElements?.length&&this.componentConfigSignal().areaPinAnnotation?.targetElements?.forEach(o=>{if(o?.xpath){let a=this.domService.getElementFromXPath(o?.xpath);!a&&o?.cfXpath&&(a=this.domService.getElementFromXPath(o?.cfXpath)),!a&&o?.fXpath&&(a=this.domService.getElementFromXPath(o?.fXpath)),a&&this.detectPositionChange(a)}})}catch(e){this.catchError("Error in AreaPinPortalComponent ngAfterViewInit: ",e)}}setAreaPinAnnotation(e){try{this.componentConfigSignal.update(t=>(!this.skipValueUpdate&&!t.isResizing&&(t=E(b({},t),{areaPinAnnotation:e}),this.id=e.annotationId,t.isResizing||(t.areaProperties=e.areaProperties)),t))}catch(t){this.catchError("Error in AreaPinPortalComponent setAreaPinAnnotation: ",t)}}setOffsetLeft(e){try{this.componentConfigSignal.update(t=>(t=E(b({},t),{offsetLeft:e}),t))}catch(t){this.catchError("Error in AreaPinPortalComponent setOffsetLeft: ",t)}}setOffsetTop(e){try{this.componentConfigSignal.update(t=>(t=E(b({},t),{offsetTop:e}),t))}catch(t){this.catchError("Error in AreaPinPortalComponent setOffsetTop: ",t)}}togglePinSelection(){try{let e=!0;this.componentConfigSignal().commentPinAnnotation&&(e=!(this.domService.getDraftCommentAnnotationDialogs()||[])?.length,this.domService.resetSelectedAnnotationsMap(!0,"comments")),e&&(this.domService.toggleAnnotationSelection(this.componentConfigSignal().areaPinAnnotation),this.componentConfigSignal().commentPinAnnotation?this.domService.toggleAnnotationSelection(this.componentConfigSignal().commentPinAnnotation):this.componentConfigSignal().multiThreadCommentAnnotation&&this.domService.toggleAnnotationSelection(this.componentConfigSignal().multiThreadCommentAnnotation))}catch(e){this.catchError("Error in AreaPinPortalComponent togglePinSelection: ",e)}}saveComment(e){try{this.componentConfigSignal().commentPinAnnotation?this.commentService.saveComment(this.componentConfigSignal().commentPinAnnotation,e):this.componentConfigSignal().multiThreadCommentAnnotation&&this.commentService.saveComment(this.componentConfigSignal().multiThreadCommentAnnotation,e)}catch(t){this.catchError("Error in AreaPinPortalComponent saveComment: ",t)}}onResizeHandleDragStart(e){try{let t=document.getElementById(this.componentConfigSignal().areaPinAnnotation.annotationId);t&&(this.parentElement=t.parentElement,document.body.appendChild(t)),this.componentConfigSignal.update(s=>(s=E(b({},s),{isResizing:!0}),s));let o=this.domService.getElementFromXPath(this.componentConfigSignal().areaProperties?.targetElement),a=(o?.getBoundingClientRect().top||0)+window.scrollY,l=(o?.getBoundingClientRect().left||0)+window.scrollX;this.componentConfigSignal.update(s=>(s=E(b({},s),{resizingOffset:{top:a,left:l}}),s))}catch(t){this.catchError("Error in AreaPinPortalComponent onResizeHandleDragStart: ",t)}}onResizeHandleDragMove(e,t){try{let o=this.domService.getTargetElementForCursorPosition(e.event);if(this.componentConfigSignal().commentPinAnnotation){let a=this.domService.getElementFromXPath(o?.xpath);if(a&&!this.commentService.isElementInsideAllowedElements(a))return}if(o){let a=JSON.parse(JSON.stringify(this.componentConfigSignal().areaPinAnnotation)),l=a.targetElements||[];switch(t){case"topLeft":l[0]=o;break;case"bottomRight":l[1]=o;break;default:break}a.targetElements=l;let s=this.areaService.calculateAreaAnnotationPosition(a),d=this.domService.getElementFromXPath(s?.targetElement),v=(d?.getBoundingClientRect().top||0)+window.scrollY,u=(d?.getBoundingClientRect().left||0)+window.scrollX;this.componentConfigSignal.update(S=>(S=E(b({},S),{areaProperties:s,resizingOffset:{top:v,left:u},areaPinAnnotationOnResize:a}),S))}}catch(o){this.catchError("Error in AreaPinComponent onResizeHandleDragMove: ",o)}}onResizeHandleDragEnd(e){try{let t=document.getElementById(this.componentConfigSignal().areaPinAnnotation.annotationId);t&&this.parentElement&&(this.parentElement.appendChild(t),t.style.opacity="0"),this.componentConfigSignal.update(l=>(l=E(b({},l),{isResizing:!1}),l)),this.skipValueUpdate=!0;let o=this.domService.getElementFromXPath(this.componentConfigSignal().areaProperties?.targetElement),a=this.docService.getAdditionalDocumentIdFromElement(o)||this.docService.getDocumentPaths()?.clientDocumentId;!this.componentConfigSignal().areaPinAnnotation?.metadata?.clientDocumentId||this.componentConfigSignal().areaPinAnnotation?.metadata?.clientDocumentId==a?(this.componentConfigSignal.update(l=>(l=b({},l),l.areaPinAnnotationOnResize&&(l.areaPinAnnotation=JSON.parse(JSON.stringify(l.areaPinAnnotationOnResize))),delete l.areaPinAnnotationOnResize,l)),this.areaService.updateArea(this.componentConfigSignal().areaPinAnnotation,!1),this.analyticsService.trackEvent(Y.Events.Area.AREA_DRAGGED,{annotationId:this.componentConfigSignal().areaPinAnnotation.annotationId})):this.componentConfigSignal.update(l=>(l=b({},l),l.areaProperties=l.areaPinAnnotation.areaProperties,l)),setTimeout(()=>{this.skipValueUpdate=!1,t&&(t.style.opacity="1")},50)}catch(t){this.catchError("Error in AreaPinComponent onResizeHandleDragEnd: ",t)}}detectPositionChange(e){try{let t=ag(0,rg).pipe(ge(()=>{let o=e.getBoundingClientRect();return{top:o.top,left:o.left}}),xt((o,a)=>o.top===a.top&&o.left===a.left),Vi());this.subscriptions.push(t.subscribe(()=>{this.componentConfigSignal.update(o=>(o=E(b({},o),{areaProperties:this.areaService.calculateAreaAnnotationPosition(o.areaPinAnnotation)}),o))},o=>{}))}catch(t){this.catchError("Error in AreaPinPortalComponent detectPositionChange: ",t)}}setAreaPinHover(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setAreaPinHover","color: green;"),e&&this.targetElement&&!this.domService.isElementVisibleOnScreen(this.targetElement)&&(e=!1),this.areaPinHover=e,this.updateAreaActiveAttributeOnElement()}catch(t){this.catchError("Error in AreaPinPortalComponent setAreaPinHover: ",t)}}updateAreaActiveAttributeOnElement(){try{this.loggingService.log("%c[WB] Calling FUNCTION: updateAreaActiveAttributeOnElement","color: green;"),this.selected||this.areaPinHover?this.targetElement&&(this.targetElement?.hasAttribute(V.ATTRIBUTES.VELT_AREA_PIN_ACTIVE)||this.targetElement?.setAttribute(V.ATTRIBUTES.VELT_AREA_PIN_ACTIVE,"true")):this.targetElement&&this.targetElement?.hasAttribute(V.ATTRIBUTES.VELT_AREA_PIN_ACTIVE)&&this.targetElement?.removeAttribute(V.ATTRIBUTES.VELT_AREA_PIN_ACTIVE)}catch(e){this.catchError("Error in AreaPinPortalComponent updateAreaActiveAttributeOnElement: ",e)}}ngOnDestroy(){this.loggingService.log("%c[WB] Calling FUNCTION: ngOnDestroy","color: green;");try{this.unsubscribe()}catch(e){this.catchError("Error in AreaPinPortalComponent ondestroy: ",e)}}unsubscribe(){this.loggingService.log("%c[WB] Calling FUNCTION: unsubscribe","color: green;");try{this.subscriptions.map(e=>{e.unsubscribe()}),this.subscriptions=[]}catch(e){this.catchError("Error in AreaPinPortalComponent unsubscribe: ",e)}}catchError(e,t,o){try{this.loggingService.catch(e,t,E(b({},o||{}),{annotationId:this.componentConfigSignal()?.areaPinAnnotation?.annotationId}))}catch{}}};r.\u0275fac=function(t){return new(t||r)(C(rt),C(Ge),C(Pe),C(lt),C(Ve),C(kd),C(x))},r.\u0275cmp=O({type:r,selectors:[["snippyly-area-pin-portal"]],hostVars:6,hostBindings:function(t,o){t&1&&G("mouseenter",function(){return o.onMouseEnter()})("mouseleave",function(){return o.onMouseLeave()}),t&2&&(Po("id",o.id),T("data-velt-element",o.veltElement),ve("selected",o.selected)("resizing",o.resizing))},inputs:{multipleAreaPinsSelected:"multipleAreaPinsSelected",avatarErrorImage:"avatarErrorImage",user:"user",targetElement:"targetElement"},standalone:!1,decls:1,vars:1,consts:[[4,"ngIf"],["id","line1",1,"line","vertical",3,"click"],["id","line2",1,"line","horizontal",3,"click"],["id","line3",1,"line","vertical",3,"click"],["id","line4",1,"line","horizontal",3,"click"],["id","handle1","cdkDrag","",1,"handle",3,"cdkDragStarted","cdkDragMoved","cdkDragEnded","click","cdkDragDisabled"],["id","handle2","cdkDrag","",1,"handle",3,"cdkDragStarted","cdkDragMoved","cdkDragEnded","click","cdkDragDisabled"],[3,"id","click",4,"ngIf"],[3,"click","id"],[3,"saveComment","ngStyle","annotationDragging","annotation","commentPinSelected","multipleCommentPinSelected","user"]],template:function(t,o){t&1&&p(0,jfn,2,1,"ng-container",0),t&2&&g("ngIf",o.componentConfigSignal())},dependencies:[se,yg,ua,pp],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}[_nghost-%COMP%]{position:absolute!important;top:0!important;left:0!important;box-sizing:border-box!important;-webkit-tap-highlight-color:rgba(255,255,255,0)!important;outline:none!important;margin:0!important;padding:0!important;height:unset!important;width:unset!important;text-align:left!important;z-index:var(--velt-comment-pin-z-index)!important}*[_ngcontent-%COMP%]{box-sizing:border-box;-webkit-tap-highlight-color:rgba(255,255,255,0)!important;outline:none!important;margin:0!important;padding:0!important;height:unset;width:unset;text-align:left!important;line-height:1.5!important;color:#000!important;font-size:calc((1rem + 0px) * var(--velt-base-rem-unit));-webkit-text-fill-color:initial!important}*[_ngcontent-%COMP%]:empty{display:revert!important}.line[_ngcontent-%COMP%]{position:absolute;opacity:.4;transition:opacity .2s ease-in-out}.line.vertical[_ngcontent-%COMP%]{border-left:1px dashed;border-right:1px dashed}.line.horizontal[_ngcontent-%COMP%]{border-top:1px dashed;border-bottom:1px dashed}.handle[_ngcontent-%COMP%]{position:absolute;transform:none!important;border-radius:100%}.handle[_ngcontent-%COMP%]:not(.drag-disabled){cursor:grab}#handle1[_ngcontent-%COMP%]{opacity:.4;transition:opacity,transform .2s ease-in-out}#handle2[_ngcontent-%COMP%]{background-color:transparent!important}.resizing[_nghost-%COMP%] div[_ngcontent-%COMP%]{z-index:1}.resizing[_nghost-%COMP%] .handle[_ngcontent-%COMP%]{cursor:grabbing}[_nghost-%COMP%]:hover #handle1[_ngcontent-%COMP%], .resizing[_nghost-%COMP%] #handle1[_ngcontent-%COMP%], .selected[_nghost-%COMP%] #handle1[_ngcontent-%COMP%]{opacity:1;transform:scale(2)!important}[_nghost-%COMP%]:hover .line[_ngcontent-%COMP%], .resizing[_nghost-%COMP%] .line[_ngcontent-%COMP%], .selected[_nghost-%COMP%] .line[_ngcontent-%COMP%]{opacity:1}snippyly-comment-pin[_ngcontent-%COMP%]{position:absolute;bottom:calc(100% - 8px)}.s-metadata[_ngcontent-%COMP%]{position:fixed;bottom:10px;right:10px;background:#fff;font-size:14px;border:1px solid;padding:10px;box-shadow:1px 1px 1px 1px;border-radius:4px}.s-metadata[_ngcontent-%COMP%] table[_ngcontent-%COMP%]{border-collapse:collapse}.s-metadata[_ngcontent-%COMP%] table[_ngcontent-%COMP%] td[_ngcontent-%COMP%], .s-metadata[_ngcontent-%COMP%] table[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{border:1px solid;padding:4px 8px}"],changeDetection:0});let n=r;return n})();var ixe=(()=>{let r=class r{constructor(e,t,o,a,l){this.domService=e,this.componentFactoryResolver=t,this.injector=o,this.appRef=a,this.loggingService=l,this.areasPinById={}}setAreaPin(e){try{if(!this.areasPinById[e.annotationId])this.setPinPortal(e);else{let t=this.areasPinById[e.annotationId].portalRef?.instance?.componentConfigSignal().isResizing;if(e.areaProperties?.targetElement===this.areasPinById[e.annotationId]?.annotation?.areaProperties?.targetElement||t){let o=this.areasPinById[e.annotationId].portalRef,a=this.areasPinById[e.annotationId].userTargetElement,l=this.areasPinById[e.annotationId].pinHostElement;if(document.body.contains(a)&&document.body.contains(l))o&&(o.instance.setAreaPinAnnotation(JSON.parse(JSON.stringify(e))),this.updateElementOffset(e));else{let s=this.areasPinById[e.annotationId].pinHostDomPortalOutlet;s&&(this.removeAreaPinHostAttributes(e.annotationId,this.areasPinById[e.annotationId].pinHostElement),s.detach(),delete this.areasPinById[e.annotationId],this.setPinPortal(e))}}else{let o=this.areasPinById[e.annotationId].pinHostDomPortalOutlet;o&&(this.removeAreaPinHostAttributes(e.annotationId,this.areasPinById[e.annotationId].pinHostElement),o.detach(),delete this.areasPinById[e.annotationId],this.setPinPortal(e))}}}catch(t){this.loggingService.catch("Error in AreaPinPortalService setAreaPin: ",t)}}setPinPortal(e){try{if(e?.areaProperties?.targetElement){let t=this.domService.getElementFromXPath(e?.areaProperties?.targetElement);if(t){let o=this.domService.getHostElement(t),a=new Io(nxe),l=new Eo(o,this.appRef,this.injector),s=l.attach(a);s.instance.setAreaPinAnnotation(JSON.parse(JSON.stringify(e))),s.instance.targetElement=t,this.areasPinById[e.annotationId]={pinHostDomPortalOutlet:l,pinPortal:a,portalRef:s,annotation:JSON.parse(JSON.stringify(e)),userTargetElement:t,pinHostElement:o},this.setAreaPinHostAttributes(e.annotationId,o),this.updateElementOffset(e)}}}catch(t){this.loggingService.catch("Error in AreaPinPortalService setPinPortal: ",t)}}setAreaPinHostAttributes(e,t){try{let o=t.getAttribute(V.ATTRIBUTES.VELT_AREA_PIN_HOST);if(o){let a=o.split(",");a.includes(e)||(a.push(e),t.setAttribute(V.ATTRIBUTES.VELT_AREA_PIN_HOST,a.join(",")))}else t.setAttribute(V.ATTRIBUTES.VELT_AREA_PIN_HOST,e);window.getComputedStyle(t).position==="static"&&(xm(t)||t.setAttribute(V.ATTRIBUTES.VELT_AREA_PIN_HOST_STATIC,"true"))}catch(o){this.loggingService.catch("Error in AreaPinPortalService setAreaPinHostAttributes: ",o)}}removeAreaPinHostAttributes(e,t){try{let o=t.getAttribute(V.ATTRIBUTES.VELT_AREA_PIN_HOST);if(o){let a=o.split(","),l=a.indexOf(e);l>-1&&(a.splice(l,1),a.length>0?t.setAttribute(V.ATTRIBUTES.VELT_AREA_PIN_HOST,a.join(",")):t.removeAttribute(V.ATTRIBUTES.VELT_AREA_PIN_HOST))}t?.getAttribute(V.ATTRIBUTES.VELT_AREA_PIN_HOST)||t.removeAttribute(V.ATTRIBUTES.VELT_AREA_PIN_HOST_STATIC)}catch(o){this.loggingService.catch("Error in AreaPinPortalService removeAreaPinHostAttributes: ",o)}}updateElementOffset(e){try{let{portalRef:t,userTargetElement:o,pinHostElement:a}=this.areasPinById[e.annotationId],l=this.domService.getElementOffset(o,a);t.instance.setOffsetLeft(l.offsetLeft),t.instance.setOffsetTop(l.offsetTop)}catch(t){this.loggingService.catch("Error in AreaPinPortalService updateElementOffset: ",t)}}checkPinsToRemove(e){try{let t=e.map(o=>o.annotationId);Object.keys(this.areasPinById).forEach(o=>{if(!t.includes(o)){let a=this.areasPinById[o];a.pinHostDomPortalOutlet.detach(),this.removeAreaPinHostAttributes(o,a.pinHostElement),this.domService.removeHighlightFromElement(a.pinHostElement),delete this.areasPinById[o]}})}catch(t){this.loggingService.catch("Error in AreaPinPortalService checkPinsToRemove: ",t)}}};r.\u0275fac=function(t){return new(t||r)(J(Ve),J(Hr),J(Tt),J(fi),J(x))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var cK=(()=>{let r=class r{constructor(e,t,o,a,l,s,d){this.analyticsService=e,this.authService=t,this.domService=o,this.areaService=a,this.areaPinPortalService=l,this.commentService=s,this.loggingService=d,this.areaPinAnnotations=[],this.subscriptions=[],this.isFirstComponent=!0,this.commentsOnDom=!0,this.veltId=St(),this.veltElement=!0;try{this.loggingService.log("%c[WB] Creating CLASS: AreasContainerComponent","color: blue;")}catch(v){this.loggingService.catch("Error in AreasContainerComponent constructor: ",v)}}ngOnInit(){this.loggingService.log("%c[WB] Calling FUNCTION: ngOnInit","color: green;")}ngAfterViewInit(){try{let e=document.querySelector(V.TAGS.SNIPPYLY_AREAS),t=document.querySelector(V.TAGS.VELT_AREAS);t?this.veltId===t?.getAttribute(V.ATTRIBUTES.VELT_ID)&&(this.isFirstComponent=!0,this.initComponent()):this.veltId===e?.getAttribute(V.ATTRIBUTES.VELT_ID)&&(this.isFirstComponent=!0,this.initComponent())}catch(e){this.loggingService.catch("Error in AreasContainerComponent AfterViewInit: ",e)}}initComponent(){try{this.subscriptions.push(this.authService.getUser$().pipe(je(e=>!!e)).subscribe(e=>{e&&this.setAreaInstalledInAnalytics()},e=>{this.loggingService.catch("Error in getUser: ",e)})),this.getAllAreasOnCurrentDocument()}catch(e){this.loggingService.catch("Error in AreasContainerComponent initComponent: ",e)}}getAllAreasOnCurrentDocument(){this.loggingService.log("%c[WB] Calling FUNCTION: getAllAreasOnCurrentDocument","color: green;");try{this.subscriptions.push(this.areaService.getAllAreaAnnotations().pipe(je(e=>!!e),fe(e=>this.domService.getSelectedAnnotationsMap$().pipe(ge(t=>({annotations:e,selectedAnnotationsMap:t||{}})))),fe(e=>this.commentService.getCommentsOnDom$().pipe(ge(t=>(this.commentsOnDom=t,{annotations:e.annotations,selectedAnnotationsMap:e.selectedAnnotationsMap,commentsOnDom:t||{}}))))).subscribe(e=>{try{this.loggingService.log(e),this.areaPinAnnotations=e?.annotations,this.commentsOnDom||(this.areaPinAnnotations=this.areaPinAnnotations?.filter(o=>!o?.targetAnnotations?.filter(a=>a?.type===Be.COMMENT)?.length));let t=this.areaPinAnnotations.filter(o=>o?.areaProperties?.targetElement);this.areaPinPortalService.checkPinsToRemove(t),t.forEach(o=>{this.areaPinPortalService.setAreaPin(o)})}catch(t){this.loggingService.catch("Error in AreasContainerComponent getAllAreasOnCurrentDocument inside subscription: ",t)}},e=>{this.loggingService.catch("Error in AreasContainerComponent getAllAreasOnCurrentDocument subscription: ",e)}))}catch(e){this.loggingService.catch("Error in AreasContainerComponent getAllAreasOnCurrentDocument: ",e)}}ngOnDestroy(){this.loggingService.log("%c[WB] Calling FUNCTION: ngOnDestroy","color: green;");try{this.unsubscribe()}catch(e){this.loggingService.catch("Error in AreasContainerComponent ondestroy: ",e)}}unsubscribe(){this.loggingService.log("%c[WB] Calling FUNCTION: unsubscribe","color: green;");try{this.subscriptions.map(e=>{e.unsubscribe()}),this.subscriptions=[]}catch(e){this.loggingService.catch("Error in AreasContainerComponent unsubscribe: ",e)}}setAreaInstalledInAnalytics(){try{this.analyticsService.setInstalledFeature(Qh.AREA_COMMENT)}catch(e){this.loggingService.catch("Error in AreasContainerComponent setAreaInstalledInAnalytics: ",e)}}};r.\u0275fac=function(t){return new(t||r)(C(rt),C(Ge),C(Ve),C(kd),C(ixe),C(Pe),C(x))},r.\u0275cmp=O({type:r,selectors:[["snippyly-area-container"]],hostVars:2,hostBindings:function(t,o){t&2&&T("data-velt-id",o.veltId)("data-velt-element",o.veltElement)},standalone:!1,decls:0,vars:0,template:function(t,o){},encapsulation:2,changeDetection:0});let n=r;return n})();var Hfn=["customBtnRef"],zfn=["*"];function Gfn(n,r){if(n&1&&(_(0,"div",6),de(),_(1,"svg",7),D(2,"path",8),y()()),n&2){let i=c();m(),ve("active",i.addAreaMode)}}function Wfn(n,r){n&1&&Xe(0)}function qfn(n,r){n&1&&jt(0)}var dK=(()=>{let r=class r{constructor(e,t,o,a,l){this.analyticsService=e,this.authService=t,this.areaService=o,this.iamService=a,this.loggingService=l,this.showDefaultBtn=!1,this.addAreaMode=!1,this.subscriptions=[],this.veltElement=!0,this.subscriptions.push(this.authService.getUser$().subscribe(s=>{this.user=s},s=>{this.loggingService.catch("Error in AreasToolComponent getUser$ subscription: ",s)}))}ngOnInit(){}ngAfterViewInit(){try{this.customBtnRef?.nativeElement?.children?.length||(this.showDefaultBtn=!0),this.subscriptions.push(this.areaService.addAreaModeChange().subscribe(e=>{this.addAreaMode=e}))}catch(e){this.loggingService.catch("Error in AreasToolComponent AfterViewInit: ",e)}}addArea(){this.loggingService.log("%c[WB] Calling FUNCTION: addArea","color: green;");try{this.analyticsService.trackEvent(Y.Events.Area.AREA_TOOL_CLICKED,{toolType:this.customBtnRef?.nativeElement?.children?.length?"custom":"default"}),this.user&&(this.user.isReadOnly||this.user.isAnonymous?this.loggingService.catch("Anonymous/Readonly users cannot add areas."):!this.authService.isPlanExpired()&&this.iamService.getRole()?this.areaService.enableAddAreaMode():this.loggingService.catch("User does not have permission to add areas."))}catch(e){this.loggingService.catch("Error in AreasToolComponent addArea: ",e)}}ngOnDestroy(){this.loggingService.log("%c[WB] Calling FUNCTION: ngOnDestroy","color: green;");try{this.unsubscribe()}catch(e){this.loggingService.catch("Error in AreasToolComponent ondestroy: ",e)}}unsubscribe(){this.loggingService.log("%c[WB] Calling FUNCTION: unsubscribe","color: green;");try{this.subscriptions.map(e=>{e.unsubscribe()}),this.subscriptions=[]}catch(e){this.loggingService.catch("Error in AreasToolComponent unsubscribe: ",e)}}};r.\u0275fac=function(t){return new(t||r)(C(rt),C(Ge),C(kd),C(An),C(x))},r.\u0275cmp=O({type:r,selectors:[["snippyly-area-tool"]],viewQuery:function(t,o){if(t&1&&dt(Hfn,5),t&2){let a;ot(a=at())&&(o.customBtnRef=a.first)}},hostVars:1,hostBindings:function(t,o){t&2&&T("data-velt-element",o.veltElement)},standalone:!1,ngContentSelectors:zfn,decls:7,vars:4,consts:[["customBtnRef",""],["content",""],[1,"snippyly-area-btn-container",3,"click"],["class","action-btn",4,"ngIf"],[1,"custom-btn-container"],[4,"ngTemplateOutlet"],[1,"action-btn"],["width","32","height","32","viewBox","0 0 32 32","fill","none","xmlns","http://www.w3.org/2000/svg",1,"action-btn-icon"],["fill-rule","evenodd","clip-rule","evenodd","d","M22.6315 18.0207C23.3673 17.9913 23.9399 17.371 23.9105 16.6352L23.6567 10.2894C23.6289 9.59486 23.0723 9.03819 22.3778 9.01041L16.0319 8.75654C15.2961 8.7271 14.6758 9.29972 14.6463 10.0355C14.6169 10.7713 15.1895 11.3916 15.9253 11.4211L19.2283 11.5532L10.0679 20.7136C9.54724 21.2343 9.54724 22.0785 10.0679 22.5992C10.5886 23.1199 11.4329 23.1199 11.9536 22.5992L21.1139 13.4389L21.246 16.7418C21.2754 17.4775 21.8957 18.0502 22.6315 18.0207Z","fill","#8F95B2"]],template:function(t,o){if(t&1){let a=K();Wt(),_(0,"div",2),G("click",function(s){return N(a),o.addArea(),F(s.stopPropagation())}),p(1,Gfn,3,2,"div",3),_(2,"div",4,0),p(4,Wfn,1,0,"ng-container",5),y()(),p(5,qfn,1,0,"ng-template",null,1,Me)}if(t&2){let a=Ce(6);ve("active",o.addAreaMode),m(),g("ngIf",o.showDefaultBtn),m(3),g("ngTemplateOutlet",a)}},dependencies:[se,Nt],encapsulation:2,changeDetection:0});let n=r;return n})();var rxe=(()=>{let r=class r{constructor(){}ngOnInit(){}};r.\u0275fac=function(t){return new(t||r)},r.\u0275cmp=O({type:r,selectors:[["snippyly-comment-text"]],standalone:!1,decls:0,vars:0,template:function(t,o){},encapsulation:2,changeDetection:0});let n=r;return n})();var IN=(()=>{let r=class r{constructor(e){this.emojiService=e}transform(e,t,...o){try{let a=this.emojiService.getEmoji(e);return a||(t?.iconUrl?a=this.emojiService.getEmojiFromIconUrl(t.iconUrl):t?.iconEmoji&&(a=this.emojiService.getEmojiFromIconEmoji(t.iconEmoji,t?.icon))),a}catch{return""}}};r.\u0275fac=function(t){return new(t||r)(C(Rm,16))},r.\u0275pipe=or({name:"emoji",type:r,pure:!0,standalone:!1});let n=r;return n})();var Kfn=["commentDialogRef"];function Zfn(n,r){if(n&1&&(_(0,"sup"),ne(1),y()),n&2){let i=c(3);T("aria-hidden","true"),m(),Ke(i.commentAnnotation==null?null:i.commentAnnotation.annotationNumber)}}function Xfn(n,r){if(n&1){let i=K();_(0,"span",9),M(1,"translate"),G("click",function(){N(i);let t=c(3);return F(t.enableEditMode())}),de(),_(2,"svg",10),D(3,"path",11)(4,"path",12),y()()}if(n&2){let i=c(3);T("data-testid",i.componentId+"-edit")("aria-label",R(1,4,"Edit comment")),m(2),T("aria-hidden","true")("focusable","false")}}function Jfn(n,r){if(n&1&&(_(0,"p",5),p(1,Zfn,2,2,"sup",6),D(2,"span",7),M(3,"safeHtml"),p(4,Xfn,5,6,"span",8),y()),n&2){let i=c(2);T("data-testid",i.componentId+"-content"),m(),g("ngIf",i.commentAnnotation==null?null:i.commentAnnotation.annotationNumber),m(),g("innerHTML",R(3,4,i.commentHtml||""),ji),m(2),g("ngIf",(i.user==null?null:i.user.userId)===(i.commentAnnotation==null||i.commentAnnotation.from==null?null:i.commentAnnotation.from.userId))}}function Qfn(n,r){if(n&1){let i=K();_(0,"velt-comment-dialog-internal",13,0),G("saveComment",function(t){N(i);let o=c(2);return F(o.saveComment(t))})("afterViewInit",function(){N(i);let t=c(2);return F(t.onDialogAfterViewInit())}),y()}if(n&2){let i=c(2);g("annotation",i.commentAnnotation)("user",i.user)("commentPinSelected",!0)("inlineCommentMode",!0),T("data-testid",i.componentId+"-dialog")}}function e0n(n,r){if(n&1&&(_(0,"div",2),p(1,Jfn,5,6,"p",3)(2,Qfn,2,5,"velt-comment-dialog-internal",4),y()),n&2){let i=c();T("data-testid",i.componentId)("role","region"),m(),g("ngIf",i.commentHtml&&!i.editMode),m(),g("ngIf",!(!(i.commentAnnotation==null||i.commentAnnotation.comments==null)&&i.commentAnnotation.comments.length)||i.editMode)}}var oxe=(()=>{let r=class r{constructor(e,t,o,a,l){this.authService=e,this.commentService=t,this.domService=o,this.loggingService=a,this.elementRef=l,this.visibility=!1,this.editMode=!1,this.subscriptions=[],this.componentId="velt-inline-comment";try{this.subscriptions.push(this.authService.getUser$().subscribe(s=>{this.user=s},s=>{this.catchError("Error in InlineCommentComponent getUser$ subscription: ",s)}))}catch(s){this.catchError("Error in InlineCommentComponent constructor: ",s)}}ngOnInit(){this.setupA11yAttributes()}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in InlineCommentComponent setupA11yAttributes:",e)}}ngAfterViewInit(){try{this.commentAnnotationId&&this.getCommentAnnotationById(this.commentAnnotationId),this.subscriptions.push(this.domService.getSelectedAnnotationsMap$().subscribe(e=>{e&&this.commentAnnotationId&&e[this.commentAnnotationId]?this.visibility=!0:(this.visibility=!1,this.editMode=!1)},e=>{this.catchError("Error in InlineCommentComponent getSelectedAnnotationsMap$ subscription: ",e)}))}catch(e){this.catchError("Error in InlineCommentComponent after view init: ",e)}}getCommentAnnotationById(e){try{this.subscriptions.push(this.commentService.getCommentAnnotationByAnnotationId(e).subscribe(t=>{this.commentAnnotation=t,this.commentAnnotation?.comments?.length&&(this.commentText=this.commentAnnotation.comments[0].commentText,this.commentHtml=this.commentAnnotation.comments[0].commentHtml)},t=>{this.catchError("Error in InlineCommentComponent getCommentAnnotationById subscription: ",t)}))}catch(t){this.catchError("Error in InlineCommentComponent getCommentAnnotationById: ",t)}}saveComment(e){try{this.commentService.saveComment(this.commentAnnotation,e),this.disableEditMode()}catch(t){this.catchError("Error in InlineCommentComponent saveComment: ",t)}}enableEditMode(){try{this.editMode=!0}catch(e){this.catchError("Error in InlineCommentComponent enableEditMode: ",e)}}disableEditMode(){try{this.editMode=!1}catch(e){this.catchError("Error in InlineCommentComponent disableEditMode: ",e)}}onDialogAfterViewInit(){try{this.commentAnnotation?.comments?.length===1&&setTimeout(()=>{this.commentDialogRef?.onEditCommentClick(0)},100)}catch(e){this.catchError("Error in InlineCommentComponent onDialogAfterViewInit: ",e)}}ngOnDestroy(){try{this.subscriptions.forEach(e=>{e?.unsubscribe()})}catch(e){this.catchError("Error in InlineCommentComponent destroy: ",e)}}catchError(e,t,o){try{this.loggingService.catch(e,t,E(b({},o||{}),{annotationId:this.commentAnnotation?.annotationId}))}catch{}}};r.\u0275fac=function(t){return new(t||r)(C(Ge),C(Pe),C(Ve),C(x),C(z))},r.\u0275cmp=O({type:r,selectors:[["app-inline-comment"]],viewQuery:function(t,o){if(t&1&&dt(Kfn,5),t&2){let a;ot(a=at())&&(o.commentDialogRef=a.first)}},inputs:{commentAnnotationId:[0,"inlineCommentId","commentAnnotationId"]},standalone:!1,decls:1,vars:1,consts:[["commentDialogRef",""],["class","v-inline-comment-container",4,"ngIf"],[1,"v-inline-comment-container"],["class","v-inline-comment",4,"ngIf"],[3,"annotation","user","commentPinSelected","inlineCommentMode","saveComment","afterViewInit",4,"ngIf"],[1,"v-inline-comment"],[4,"ngIf"],[3,"innerHTML"],["class","v-inline-comment-edit","type","button",3,"click",4,"ngIf"],["type","button",1,"v-inline-comment-edit",3,"click"],["width","20","height","20","viewBox","0 0 24 24","fill","none","xmlns","http://www.w3.org/2000/svg"],["d","M3 22C3 21.4477 3.44772 21 4 21H20C20.5523 21 21 21.4477 21 22C21 22.5523 20.5523 23 20 23H4C3.44772 23 3 22.5523 3 22Z","fill","currentColor"],["fill-rule","evenodd","clip-rule","evenodd","d","M16.7071 3.12126C16.3166 2.73074 15.6834 2.73074 15.2929 3.12126L14.4142 3.99991L18 7.5857L18.8787 6.70705C19.2692 6.31652 19.2692 5.68336 18.8787 5.29284L16.7071 3.12126ZM6.91425 11.4999L13 5.41412L16.5858 8.99991L10.5 15.0857L6.91425 11.4999ZM5.50003 12.9141L5 13.4142V16.9999H8.58579L9.08582 16.4999L5.50003 12.9141ZM13.8787 1.70705C15.0503 0.535476 16.9497 0.535476 18.1213 1.70705L20.2929 3.87862C21.4645 5.0502 21.4645 6.94969 20.2929 8.12126L10 18.4142C9.62493 18.7892 9.11622 18.9999 8.58579 18.9999H5C3.89543 18.9999 3 18.1045 3 16.9999V13.4142C3 12.8837 3.21071 12.375 3.58579 11.9999L13.8787 1.70705Z","fill","currentColor"],[3,"saveComment","afterViewInit","annotation","user","commentPinSelected","inlineCommentMode"]],template:function(t,o){t&1&&p(0,e0n,3,4,"div",1),t&2&&g("ngIf",o.visibility)},dependencies:[se,so,Ac,ue],styles:["[_nghost-%COMP%] .v-inline-comment-container{width:100%;padding:1rem;margin:auto;margin-bottom:1rem;background-color:#f0f0f0;border-radius:4px}[_nghost-%COMP%] .v-inline-comment-container .v-inline-comment{display:flex;gap:.5rem}[_nghost-%COMP%] .v-inline-comment-container .v-inline-comment sup{color:#be2c25;font-weight:700;font-size:12px;margin-right:4px}[_nghost-%COMP%] .v-inline-comment-container .v-inline-comment span{font-size:1.125rem;flex-grow:1}[_nghost-%COMP%] .v-inline-comment-container .v-inline-comment a{color:#1955a5;border-bottom:1px solid #d5d5d5;text-decoration:none}[_nghost-%COMP%] .v-inline-comment-container .v-inline-comment .v-inline-comment-edit{flex-grow:0;cursor:pointer}"],changeDetection:0});let n=r;return n})();var axe=(()=>{let r=class r{constructor(e,t,o,a,l){this.authService=e,this.databaseService=t,this.docService=o,this.loggingService=a,this.commonDbService=l,this.db=Fl(),this.user=null,this.playersMap=new Map,this.eventsCountPerSecond=0,this.hold=!1,this.counter=0,this.loggingService.log("%c[WB] Creating CLASS: SyncVideoPlayerService","color: blue;");try{this.databaseService.getDb().pipe(je(s=>!!s),st(1)).subscribe(s=>{s&&(this.db=s,this.getUser())},s=>{this.loggingService.catch("Error in CommentService getDb subscription: ",s)}),setTimeout(()=>{this.eventsCountPerSecond=0},1e3)}catch(s){this.loggingService.catch("Error in SyncVideoPlayerService constructor: ",s)}}getUser(){try{this.loggingService.log("%c[WB] Calling FUNCTION: getUser","color: green;"),this.authService.getUser$().pipe(je(e=>!!e)).subscribe(e=>{this.user=e,this.getDocumentPaths()})}catch(e){this.loggingService.catch("Error in SyncVideoPlayerService getUser: ",e)}}getDocumentPaths(){try{this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentPaths","color: green;"),this.docService.getDocumentPaths$().subscribe(e=>{this.documentPaths=e,this.documentPaths&&(this.subscribeToVideoPlayers(),this.getAllVideoTags())})}catch(e){this.loggingService.catch("Error in SyncVideoPlayerService getDocumentPaths: ",e)}}subscribeToVideoPlayers(){try{this.loggingService.log("%c[WB] Calling FUNCTION: subscribeToVideoPlayers","color: green;"),this.documentPaths?.syncVideoPlayer&&this.commonDbService.dbListener({feature:"syncVideoPlayer",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}}).pipe(ge(e=>e?.data)).subscribe(e=>{Object.keys(e||{}).forEach(o=>{let a=e[o]||{},l=this.playersMap.get(o)?.playerElement;l||(l=this.getVideoTagByPlayerId(o)),l&&(this.playersMap.set(o,{playerElement:l,player:a}),this.updateLocalPlayerState(o,a))})})}catch(e){this.loggingService.catch("Error in SyncVideoPlayerService subscribeToVideoPlayers: ",e)}}getAllVideoTags(){try{this.loggingService.log("%c[WB] Calling FUNCTION: getAllVideoTags","color: green;"),Array.from(document.querySelectorAll(`video[${V.ATTRIBUTES.SYNC_VIDEO_PLAYER}]`)).forEach(t=>{let o=this.getPlayerId(t),a=new CR;a.playerId=o,a.src=t.src;let l=Array.from(t.querySelectorAll("source"));a.sources=l.map(s=>s?.src)?.filter(s=>!!s)||[],this.playersMap.set(o,{playerElement:t,player:a}),this.subscribeToPlayerEvents(o,t)})}catch(e){this.loggingService.catch("Error in SyncVideoPlayerService getAllVideoTags: ",e)}}subscribeToPlayerEvents(e,t){try{this.loggingService.log("%c[WB] Calling FUNCTION: subscribeToPlayerEvents","color: green;"),t.addEventListener("play",()=>{this.hold||this.updateVideoPlayerState(e,"play",{playing:!0,currentTime:t.currentTime})}),t.addEventListener("pause",()=>{this.hold||t.readyState===4&&this.updateVideoPlayerState(e,"pause",{playing:!1,currentTime:t.currentTime})}),t.addEventListener("ratechange",()=>{this.updateVideoPlayerState(e,"ratechange",{speed:t.playbackRate})}),t.addEventListener("seeked",()=>{if(t.currentTime<t.duration){let o=this.playersMap.get(e)?.player?.playerState||{};"currentTime"in o&&typeof o.currentTime=="number"&&Math.abs(t.currentTime-o.currentTime)>1&&this.updateVideoPlayerState(e,"seeked",{currentTime:t.currentTime})}}),t.addEventListener("timeupdate",()=>{if(!this.hold&&t.currentTime<t.duration){let o=this.playersMap.get(e)?.player?.playerState||{};Math.abs(t.currentTime-(o?.currentTime||0))>1&&this.updateVideoPlayerState(e,"timeupdate",{currentTime:t.currentTime})}}),t.addEventListener("volumechange",()=>{this.hold||this.updateVideoPlayerState(e,"volumechange",{volume:t.volume,muted:t.muted,currentTime:t.currentTime})})}catch(o){this.loggingService.catch("Error in SyncVideoPlayerService subscribeToPlayerEvents: ",o)}}updateVideoPlayerState(e,t,o){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: updateVideoPlayerState","color: green;"),this.eventsCountPerSecond++,this.eventsCountPerSecond>=500&&(this.hold=!0),this.hold){this.loggingService.catch("Too many events in 5 seconds. Holding events.");return}if(e&&this.user&&this.documentPaths?.syncVideoPlayer){let a=Li(this.db,`${this.documentPaths?.syncVideoPlayer}/${e}`),l={lastUpdated:this.timestamp,lastUpdatedBy:this.user,lastUpdatedEvent:t,playerState:b(b({},new ek),o)};jh(a,s=>{if(s)return l.playerId=s.playerId,l.src=s.src,l.sources=s.sources,l.playerState=b(b({},s.playerState),o),JSON.parse(JSON.stringify(l));l.playerId=e;let d=this.playersMap.get(e);if(d){l.src=d?.playerElement?.src;let v=Array.from(d?.playerElement?.querySelectorAll("source"));l.sources=v.map(u=>u?.src)?.filter(u=>!!u)||[]}return(o?.volume===void 0||o?.volume===null)&&(o.volume=100),JSON.parse(JSON.stringify(l))})}}catch(a){this.loggingService.catch("Error in SyncVideoPlayerService updateVideoPlayerState: ",a)}}updateLocalPlayerState(e,t){try{this.loggingService.log("%c[WB] Calling FUNCTION: updateLocalPlayerState","color: green;");let o=this.playersMap.get(e),a=o?.player?.playerState,l=o?.playerElement;if(!l)return;let s=a?.playing;s!==!l.paused&&(s?l.play():l.pause());let d=a?.currentTime||0;Math.abs(d-l.currentTime)>1&&(l.currentTime=d);let u=!!a?.muted;if(u!==l.muted&&(l.muted=u),!u){let k=a?.volume||0;k>=0&&k!==l.volume&&(l.volume=k)}let S=a?.speed;S==null&&(S=1),S!==l.playbackRate&&(l.playbackRate=S)}catch{}}getPlayerId(e){try{let t="",o=e?.getAttribute("src");if(o)t=`${Gn(o)}`;else{let a=e?.querySelectorAll("source");if(a&&a.length>0){let s=a[0]?.getAttribute("src");s&&(t=`${Gn(s)}`)}}return t}catch(t){return this.loggingService.catch("Error in SyncVideoPlayerService getSyncVideoPlayId: ",t),""}}getVideoTagByPlayerId(e){try{return Array.from(document.querySelectorAll(`video[${V.ATTRIBUTES.SYNC_VIDEO_PLAYER}]`)).find(a=>this.getPlayerId(a)===e)||void 0}catch(t){this.loggingService.catch("Error in SyncVideoPlayerService getVideoTagByPlayerId: ",t);return}}get timestamp(){return this.commonDbService.getServerTimestamp()}};r.\u0275fac=function(t){return new(t||r)(J(Ge),J(On),J(lt),J(x),J(xn))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var n0n=["trigger"],i0n=["overlay"],lxe=n=>({componentConfigSignal:n}),sxe=(n,r)=>({template:n,context:r}),r0n=(n,r)=>({reactionAnnotation:n,user:r});function o0n(n,r){if(n&1){let i=K();_(0,"div",8)(1,"div",9),M(2,"translate"),M(3,"translate"),G("click",function(t){return N(i),c(4).onReactionClick(),F(t.stopPropagation())}),D(4,"div",10),M(5,"emoji"),y()()}if(n&2){let i=c(3).ngIf,e=c();T("data-testid",e.componentId+"-timeline"),m(),T("data-testid",e.componentId+"-timeline-item")("aria-label",R(2,4,"React with")+" "+R(3,6,(i==null||i.annotation==null?null:i.annotation.icon)||"emoji")),m(3),g("innerHTML",Al(5,8,i==null||i.annotation==null?null:i.annotation.icon,i==null?null:i.annotation),ji)}}function a0n(n,r){if(n&1&&(h(0),D(1,"velt-reaction-pin-emoji-internal",13)(2,"velt-reaction-pin-count-internal",13),f()),n&2){let i=c(5);m(),g("componentConfigSignal",i.componentConfigSignal),m(),g("componentConfigSignal",i.componentConfigSignal)}}function l0n(n,r){if(n&1){let i=K();_(0,"div")(1,"div",11),M(2,"translate"),M(3,"translate"),G("click",function(t){return N(i),c(4).onReactionClick(),F(t.stopPropagation())}),p(4,a0n,3,2,"ng-container",12),y()()}if(n&2){let i=c(3).ngIf,e=c();m(),ve("velt-reaction-pin--default",!e.template)("velt-reaction-pin--no-reactions",!(!(i==null||i.annotation==null||i.annotation.reactions==null)&&i.annotation.reactions.length)),T("data-testid",e.componentId+"-default")("aria-label",R(2,7,"React with")+" "+R(3,9,(i==null||i.annotation==null?null:i.annotation.icon)||"emoji")),m(3),g("veltDynamicTemplate",w(13,sxe,e.template,$(11,lxe,e.componentConfigSignal)))}}function s0n(n,r){if(n&1&&(h(0),_(1,"div",5),p(2,o0n,6,11,"div",6)(3,l0n,5,16,"div",7),y(),f()),n&2){let i=c(3);m(),g("ngSwitch",i.type),m(),g("ngSwitchCase","timeline")}}function c0n(n,r){if(n&1){let i=K();_(0,"div",9),M(1,"translate"),M(2,"translate"),G("click",function(t){return N(i),c(6).onReactionClick(),F(t.stopPropagation())}),D(3,"div",10),M(4,"emoji"),y()}if(n&2){let i=c(5).ngIf,e=c();ve("active",i==null?null:i.isReactionSelectedByCurrentUser),T("data-testid",e.componentId+"-timeline-item")("aria-pressed",i==null?null:i.isReactionSelectedByCurrentUser)("aria-label",R(1,6,"React with")+" "+R(2,8,(i==null||i.annotation==null?null:i.annotation.icon)||"emoji")),m(3),g("innerHTML",Al(4,10,i==null||i.annotation==null?null:i.annotation.icon,i==null?null:i.annotation),ji)}}function d0n(n,r){if(n&1&&(_(0,"div",8),p(1,c0n,5,13,"div",15),y()),n&2){let i=c(4).ngIf,e=c();T("data-testid",e.componentId+"-timeline"),m(),g("ngIf",i==null||i.annotation==null?null:i.annotation.icon)}}function m0n(n,r){n&1&&D(0,"velt-skeleton-loader-internal",18)}function g0n(n,r){if(n&1&&(h(0),D(1,"velt-reaction-pin-emoji-internal",13)(2,"velt-reaction-pin-count-internal",13),f()),n&2){let i=c(7);m(),g("componentConfigSignal",i.componentConfigSignal),m(),g("componentConfigSignal",i.componentConfigSignal)}}function v0n(n,r){if(n&1){let i=K();_(0,"div",11),M(1,"translate"),M(2,"translate"),G("click",function(t){return N(i),c(6).onReactionClick(),F(t.stopPropagation())}),p(3,g0n,3,2,"ng-container",12),y()}if(n&2){let i=c(5).ngIf,e=c();ve("velt-reaction-pin--default",!e.template)("active",i==null?null:i.isReactionSelectedByCurrentUser)("velt-reaction-pin--no-reactions",!(!(i==null||i.annotation==null||i.annotation.reactions==null)&&i.annotation.reactions.length)),T("data-testid",e.componentId+"-default")("aria-pressed",i==null?null:i.isReactionSelectedByCurrentUser)("aria-label",R(1,10,"React with")+" "+R(2,12,(i==null||i.annotation==null?null:i.annotation.icon)||"emoji")),m(3),g("veltDynamicTemplate",w(16,sxe,e.template,$(14,lxe,e.componentConfigSignal)))}}function u0n(n,r){if(n&1&&(_(0,"div"),p(1,m0n,1,0,"velt-skeleton-loader-internal",16)(2,v0n,4,19,"div",17),y()),n&2){let i=c(4).ngIf,e=c();m(),g("ngIf",e.showLoadingTemplate),m(),g("ngIf",i==null||i.annotation==null?null:i.annotation.icon)}}function p0n(n,r){if(n&1&&(_(0,"div",5),p(1,d0n,2,2,"div",6)(2,u0n,3,2,"div",7),y()),n&2){let i=c(4);g("ngSwitch",i.type),m(),g("ngSwitchCase","timeline")}}function h0n(n,r){n&1&&Xe(0)}function f0n(n,r){if(n&1&&(h(0),p(1,h0n,1,0,"ng-container",20),f()),n&2){let i=c(4).ngIf,e=c();m(),g("ngTemplateOutlet",e.customTooltipTemplate)("ngTemplateOutletContext",w(2,r0n,i==null?null:i.annotation,i==null?null:i.user))}}function C0n(n,r){if(n&1&&D(0,"velt-reaction-pin-tooltip-internal",21),n&2){let i=c(5);g("shadowDom",!!i.shadowDom)("variant",i.variant)("componentConfigSignal",i.componentConfigSignal)("darkMode",i.darkMode)}}function _0n(n,r){if(n&1&&p(0,f0n,2,5,"ng-container",19)(1,C0n,1,4,"ng-template",null,2,Me),n&2){let i=Ce(2),e=c(4);g("ngIf",e.customTooltipTemplate)("ngIfElse",i)}}function b0n(n,r){if(n&1&&(_(0,"app-overlay-tooltip",14),p(1,p0n,3,2,"ng-template",null,0,Me)(3,_0n,3,2,"ng-template",null,1,Me),y()),n&2){let i=c(3);g("positions",i.positions)("disabled",i.disableTooltip),T("data-testid",i.componentId+"-tooltip")}}function S0n(n,r){if(n&1&&(h(0),p(1,s0n,4,2,"ng-container",3)(2,b0n,5,3,"app-overlay-tooltip",4),f()),n&2){let i=c().ngIf,e=c();m(),g("ngIf",e.reactionId&&!e.annotationId&&(i==null||i.annotation==null?null:i.annotation.icon)&&e.type!=="standalone"),m(),g("ngIf",(i==null||i.annotation==null||i.annotation.reactions==null?null:i.annotation.reactions.length)||e.type==="standalone")}}function y0n(n,r){if(n&1&&(h(0),p(1,S0n,3,2,"ng-container",3),f()),n&2){let i=c();m(),g("ngIf",!i.isExcludedValue)}}var fp=(()=>{let r=class r extends Ct{set reactionId(e){this._reactionId=e}get reactionId(){return this._reactionId}set"reaction-id"(e){this._reactionId=e}get isExcludedValue(){try{let e=this.componentConfigSignal(),t=e?.annotation?.icon,o=this.excludeReactionIds||e?.excludeReactionIds||[];return!t||!o?.length?!1:o.includes(t)}catch{return!1}}constructor(e,t,o,a,l,s,d){super(l,s,void 0,void 0,void 0,d,t),this.authService=e,this.loggingService=t,this.reactionService=o,this.wireframeService=a,this.elementRef=l,this.themeService=s,this.dynamicDataService=d,this.type="comment",this.disableTooltip=!1,this.shadowDom=!1,this.excludeReactionIds=[],this.commentReactionAnnotationIds=[],this.positions=[{originX:"center",originY:"top",overlayX:"center",overlayY:"bottom"},{originX:"center",originY:"bottom",overlayX:"center",overlayY:"top"},{originX:"start",originY:"center",overlayX:"end",overlayY:"center"},{originX:"end",originY:"center",overlayX:"start",overlayY:"center"}],this.componentConfigSignal=Oe(new kl),this.click=new Fe,this.showLoadingTemplate=!1,this.subscriptions=[],this.commentReactionSubscriptions=[],this.componentId="velt-reaction-pin",this.loggingService.log("%c[WB] Creating CLASS: ReactionPinComponent","color: blue;")}ngOnInit(){try{this.loggingService.log("%c[WB] Calling FUNCTION: ngOnInit","color: green;"),super.ngOnInit(),this.setupA11yAttributes(),this.setShowLoadingTemplate(),this.reactionId&&!this.annotationId&&(this.setDefaultReaction(this.reactionId),this.commentReactionAnnotationIds?.length&&this.findMatchingAnnotationFromCommentReactions());let e="velt-reaction-pin-wireframe";this.variant&&(e+=`---${this.variant}`),this.subscriptions.push(this.wireframeService.getWireframe$(e).subscribe(t=>{if(t){let o=document.createElement(t.tagName);o.innerHTML=t.innerHTML,this.template=o}}))}catch(e){this.catchError("Error in ReactionPinComponent OnInit: ",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","region"),e.setAttribute("aria-label","Reaction section")}catch(e){this.loggingService.catch("Error in ReactionPinComponent setupA11yAttributes:",e)}}ngAfterViewInit(){this.loggingService.log("%c[WB] Calling FUNCTION: ngAfterViewInit","color: green;");try{this.subscriptions.push(this.authService.getUser$().pipe(je(e=>!!e),st(1)).subscribe(e=>{this.componentConfigSignal.update(t=>(t=E(b({},t),{user:e}),t)),this.checkIfReactionSelectedByCurrentUser()}))}catch(e){this.catchError("Error in ReactionPinComponent ngAfterViewInit: ",e)}}ngOnChanges(e){try{super.ngOnChanges(e),e&&Object.keys(e).forEach(t=>{this.componentConfigSignal.update(o=>(o=E(b({},o),{[t]:e[t].currentValue}),o))}),e.annotationId&&(this.unsubscribe(),this.annotationId&&this.getReactionByAnnotationId(this.annotationId)),e.reactionId&&this.reactionId&&!this.annotationId&&this.setDefaultReaction(this.reactionId),(e.commentReactionAnnotationIds||e.reactionId)&&this.reactionId&&!this.annotationId&&this.commentReactionAnnotationIds?.length&&this.findMatchingAnnotationFromCommentReactions()}catch(t){this.catchError("Error in ReactionPinComponent ngOnChanges: ",t)}}setDefaultReaction(e){try{let t={icon:e,reactions:[]};this.componentConfigSignal.update(o=>(o=E(b({},o),{annotation:t}),o))}catch(t){this.catchError("Error in ReactionPinComponent setDefaultReaction: ",t)}}findMatchingAnnotationFromCommentReactions(){try{if(this.commentReactionSubscriptions.forEach(e=>e.unsubscribe()),this.commentReactionSubscriptions=[],!this.commentReactionAnnotationIds?.length||!this.reactionId)return;for(let e of this.commentReactionAnnotationIds){let t=this.reactionService.getReactionAnnotationByAnnotationId(e,this.parentMetadata).subscribe(o=>{o?.icon===this.reactionId&&(this.componentConfigSignal.update(a=>(a=E(b({},a),{annotation:o}),a)),this.checkIfReactionSelectedByCurrentUser())});this.commentReactionSubscriptions.push(t)}}catch(e){this.catchError("Error in ReactionPinComponent findMatchingAnnotationFromCommentReactions: ",e)}}getReactionByAnnotationId(e){this.loggingService.log("%c[WB] Calling FUNCTION: getReactionByAnnotationId","color: green;");try{this.subscriptions.push(this.reactionService.getReactionAnnotationByAnnotationId(e,this.parentMetadata).subscribe(t=>{this.componentConfigSignal.update(o=>(o=E(b({},o),{annotation:t}),o)),this.checkIfReactionSelectedByCurrentUser(),this.setShowLoadingTemplate(),this.componentConfigSignal().tooltipVisible&&!this.componentConfigSignal().annotation?.reactions?.length&&this.hideTooltip(),this.overlay?.overlayRef?.updatePosition()}))}catch(t){this.catchError("Error in ReactionPinComponent getReactionByAnnotationId: ",t)}}checkIfReactionSelectedByCurrentUser(){this.loggingService.log("%c[WB] Calling FUNCTION: checkIfReactionSelectedByCurrentUser","color: green;");try{this.componentConfigSignal.update(e=>(e=E(b({},e),{isReactionSelectedByCurrentUser:!!e.annotation?.reactions?.find(t=>t?.from?.userId===e.user?.userId)}),e))}catch(e){this.catchError("Error in ReactionPinComponent checkIfReactionSelectedByCurrentUser: ",e)}}setShowLoadingTemplate(){try{!this.componentConfigSignal()?.annotation?.icon&&this.componentConfigSignal()?.annotation?.isReactionResolverUsed?this.showLoadingTemplate=!0:this.showLoadingTemplate=!1}catch(e){this.catchError("Error in ReactionPinComponent setShowLoadingTemplate: ",e)}}onReactionClick(){this.loggingService.log("%c[WB] Calling FUNCTION: onReactionClick","color: green;");try{this.click.emit(this.componentConfigSignal().annotation)}catch(e){this.catchError("Error in ReactionPinComponent onReactionClick: ",e)}}showTooltip(){try{this.componentConfigSignal.update(e=>(e=E(b({},e),{tooltipVisible:!0}),e))}catch(e){this.catchError("Error in ReactionPinComponent showTooltip: ",e)}}hideTooltip(){try{this.componentConfigSignal.update(e=>(e=E(b({},e),{tooltipVisible:!1}),e))}catch(e){this.catchError("Error in ReactionPinComponent hideTooltip: ",e)}}ngOnDestroy(){this.loggingService.log("%c[WB] Calling FUNCTION: ngOnDestroy","color: green;");try{super.ngOnDestroy(),this.unsubscribe()}catch(e){this.catchError("Error in ReactionPinComponent ngOnDestroy: ",e)}}unsubscribe(){this.loggingService.log("%c[WB] Calling FUNCTION: unsubscribe","color: green;");try{this.subscriptions.forEach(e=>{e.unsubscribe()}),this.subscriptions=[],this.commentReactionSubscriptions.forEach(e=>{e.unsubscribe()}),this.commentReactionSubscriptions=[]}catch(e){this.catchError("Error in ReactionPinComponent unsubscribe: ",e)}}catchError(e,t,o){try{this.loggingService.catch(e,t,E(b({},o||{}),{annotationId:this.componentConfigSignal()?.annotation?.annotationId}))}catch{}}};r.\u0275fac=function(t){return new(t||r)(C(Ge),C(x),C(ra),C(Je),C(z),C(mt),C(I))},r.\u0275cmp=O({type:r,selectors:[["app-reaction-pin"]],viewQuery:function(t,o){if(t&1&&(dt(n0n,5),dt(i0n,5)),t&2){let a;ot(a=at())&&(o.trigger=a.first),ot(a=at())&&(o.overlay=a.first)}},inputs:{type:"type",annotationId:"annotationId",disableTooltip:"disableTooltip",customTooltipTemplate:[0,"tooltipTemplate","customTooltipTemplate"],variant:"variant",shadowDom:"shadowDom",parentMetadata:"parentMetadata",excludeReactionIds:"excludeReactionIds",commentReactionAnnotationIds:"commentReactionAnnotationIds",reactionId:[0,"reaction-id","reactionId"]},outputs:{click:"click"},standalone:!1,features:[j([I]),L,it],decls:1,vars:1,consts:[["triggerTemplate",""],["tooltipTemplate",""],["defaultTooltipTemplate",""],[4,"ngIf"],[3,"positions","disabled",4,"ngIf"],[3,"ngSwitch"],["class","s-emoji-block_timeline",4,"ngSwitchCase"],[4,"ngSwitchDefault"],[1,"s-emoji-block_timeline"],["role","button",1,"s-emoji-block__item",3,"click"],["role","img","aria-hidden","true",1,"s-emoji-block__item__emoji",3,"innerHTML"],["role","button",1,"velt-reaction-pin",3,"click"],[4,"veltDynamicTemplate"],[3,"componentConfigSignal"],[3,"positions","disabled"],["class","s-emoji-block__item","role","button",3,"active","click",4,"ngIf"],["height","34px","width","51px","borderRadius","8px",4,"ngIf"],["class","velt-reaction-pin","role","button",3,"velt-reaction-pin--default","active","velt-reaction-pin--no-reactions","click",4,"ngIf"],["height","34px","width","51px","borderRadius","8px"],[4,"ngIf","ngIfElse"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],[3,"shadowDom","variant","componentConfigSignal","darkMode"]],template:function(t,o){t&1&&p(0,y0n,2,1,"ng-container",3),t&2&&g("ngIf",o.componentConfigSignal())},dependencies:[se,Nt,Rr,Jr,Sg,Pd,Q,_S,CS,bS,ao,IN,ue],styles:["[_nghost-%COMP%]:empty{display:none}.s-emoji-block_timeline[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;gap:var(--velt-spacing-sm);width:18px;height:18px}.s-emoji-block_timeline[_ngcontent-%COMP%] .s-emoji-block__item[_ngcontent-%COMP%]{display:flex;align-items:center}.s-emoji-block_timeline[_ngcontent-%COMP%] .s-emoji-block__item__count[_ngcontent-%COMP%]{display:none}.s-emoji-block_timeline[_ngcontent-%COMP%] .s-emoji-block__item__emoji{display:flex;align-items:center;justify-content:center}.s-emoji-block_timeline[_ngcontent-%COMP%] .s-emoji-block__item__emoji svg, .s-emoji-block_timeline[_ngcontent-%COMP%] .s-emoji-block__item__emoji img{width:16px!important;height:16px!important} .snippyly-reaction-dialog-overlay-panel{z-index:2147483577}"],changeDetection:0});let n=r;return n})();var dxe=n=>({$implicit:n});function x0n(n,r){n&1&&Xe(0)}function I0n(n,r){n&1&&Xe(0)}function E0n(n,r){if(n&1){let i=K();_(0,"div",3),G("click",function(){let t=N(i).$implicit,o=c(2);return F(o.onCommentClick(t==null?null:t.commentAnnotation))}),p(1,I0n,1,0,"ng-container",4),y()}if(n&2){let i=r.$implicit;c(2);let e=Ce(6);m(),g("ngTemplateOutlet",e)("ngTemplateOutletContext",$(2,dxe,i==null?null:i.commentAnnotation))}}function k0n(n,r){if(n&1&&(h(0),p(1,E0n,2,4,"div",6),f()),n&2){let i=c();m(),g("ngForOf",i.data==null?null:i.data.overlappingCommentAnnotations)}}function T0n(n,r){n&1&&D(0,"div",10)}function w0n(n,r){if(n&1&&(_(0,"div")(1,"div",11),ne(2),y(),_(3,"div",12),ne(4),y()()),n&2){let i=c().$implicit,e=c();m(2),Ro(" ",e.formattedTimeMap[i==null||i.location==null?null:i.location.currentMediaPosition]," / ",e.formattedDuration),m(2),Ee(" ",(i==null||i.comments[0]==null||i.comments[0].commentText==null?null:i.comments[0].commentText.length)>100?(i==null||i.comments[0]==null||i.comments[0].commentText==null?null:i.comments[0].commentText.slice(0,100))+"...":i==null||i.comments[0]==null?null:i.comments[0].commentText," ")}}function D0n(n,r){if(n&1&&(_(0,"div",7),D(1,"snippyly-user-avatar",8),p(2,T0n,1,0,"div",9),y(),p(3,w0n,5,3,"div",5)),n&2){let i=r.$implicit,e=c();m(),g("user",i==null?null:i.from)("size",24),m(),g("ngIf",e.unreadCommentsMap==null?null:e.unreadCommentsMap[i==null?null:i.annotationId]),m(),g("ngIf",i==null||i.comments==null?null:i.comments.length)}}var mxe=(()=>{let r=class r{constructor(){this.commentClick=new Fe,this.veltElement=!0}ngOnInit(){}onCommentClick(e){this.commentClick.emit(e)}};r.\u0275fac=function(t){return new(t||r)},r.\u0275cmp=O({type:r,selectors:[["app-player-timeline-comment-tooltip"]],hostVars:1,hostBindings:function(t,o){t&2&&T("data-velt-element",o.veltElement)},inputs:{data:"data",formattedTimeMap:"formattedTimeMap",formattedDuration:"formattedDuration",unreadCommentsMap:"unreadCommentsMap"},outputs:{commentClick:"commentClick"},standalone:!1,decls:7,vars:5,consts:[["commentTemplate",""],[1,"comment-tooltip-container"],[1,"comment-tooltip"],[1,"comment-tooltip__item",3,"click"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],[4,"ngIf"],["class","comment-tooltip__item",3,"click",4,"ngFor","ngForOf"],[1,"comment-tooltip__item__user-avatar"],[3,"user","size"],["class","comment-tooltip__item__unread",4,"ngIf"],[1,"comment-tooltip__item__unread"],[1,"duration-text"],[1,"comment-text"]],template:function(t,o){if(t&1){let a=K();_(0,"div",1)(1,"div",2)(2,"div",3),G("click",function(){return N(a),F(o.onCommentClick(o.data==null?null:o.data.commentAnnotation))}),p(3,x0n,1,0,"ng-container",4),y(),p(4,k0n,2,1,"ng-container",5),y()(),p(5,D0n,4,4,"ng-template",null,0,Me)}if(t&2){let a=Ce(6);m(3),g("ngTemplateOutlet",a)("ngTemplateOutletContext",$(3,dxe,o.data==null?null:o.data.commentAnnotation)),m(),g("ngIf",o.data==null||o.data.overlappingCommentAnnotations==null?null:o.data.overlappingCommentAnnotations.length)}},dependencies:[Vt,se,Nt,ri],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}.comment-tooltip-container[_ngcontent-%COMP%]{padding-bottom:calc((.5rem + 0px) * var(--velt-base-rem-unit));transition:all .3s ease-in-out}.comment-tooltip-container[_ngcontent-%COMP%] .comment-tooltip[_ngcontent-%COMP%]{display:flex;justify-content:center;flex-direction:column;border-radius:calc((1rem + 0px) * var(--velt-base-rem-unit));background:#3333;box-shadow:0 8px 4px #0000000d,0 1px 1px #ffffff4d inset,0 -1px 1px #ffffff1a inset;-webkit-backdrop-filter:blur(16px);backdrop-filter:blur(16px);overflow:hidden}.comment-tooltip-container[_ngcontent-%COMP%] .comment-tooltip__item[_ngcontent-%COMP%]{display:flex;align-items:center;gap:calc((.75rem + 0px) * var(--velt-base-rem-unit));color:#fff;max-width:350px;padding:calc((.5rem + 0px) * var(--velt-base-rem-unit)) calc((1.5rem + 0px) * var(--velt-base-rem-unit));cursor:pointer}.comment-tooltip-container[_ngcontent-%COMP%] .comment-tooltip__item[_ngcontent-%COMP%] .duration-text[_ngcontent-%COMP%]{color:#fff9;font-size:10px;font-style:normal;font-weight:400;line-height:20px}.comment-tooltip-container[_ngcontent-%COMP%] .comment-tooltip__item[_ngcontent-%COMP%] .comment-text[_ngcontent-%COMP%]{color:var(--neutrals-13, #FFF);font-size:14px;font-style:normal;font-weight:400;line-height:20px}.comment-tooltip-container[_ngcontent-%COMP%] .comment-tooltip__item[_ngcontent-%COMP%] snippyly-user-avatar[_ngcontent-%COMP%]{--legacy-velt-user-avatar-size: 24px;display:flex;border-radius:31.2px;border:1px solid #FFF;background:var(--primary-2, #A259FE)}.comment-tooltip-container[_ngcontent-%COMP%] .comment-tooltip__item[_ngcontent-%COMP%]:hover{background:#0003}.comment-tooltip__item__user-avatar[_ngcontent-%COMP%]{position:relative}.comment-tooltip__item__user-avatar[_ngcontent-%COMP%] .comment-tooltip__item__unread[_ngcontent-%COMP%]{position:absolute;top:-1px;right:-1px;width:7px;height:7px;background:#ff7162;border-radius:50%;border:1px solid #0F0F0F}"],changeDetection:0});let n=r;return n})();var gxe=n=>({$implicit:n});function A0n(n,r){n&1&&Xe(0)}function P0n(n,r){n&1&&Xe(0)}function M0n(n,r){if(n&1&&(_(0,"div",6),p(1,P0n,1,0,"ng-container",7),y()),n&2){let i=r.$implicit;c(2);let e=Ce(3);m(),g("ngTemplateOutlet",e)("ngTemplateOutletContext",$(2,gxe,i==null?null:i.reactionAnnotation))}}function R0n(n,r){if(n&1&&(_(0,"div",5)(1,"div",6),p(2,A0n,1,0,"ng-container",7),y(),p(3,M0n,2,4,"div",8),y()),n&2){let i=c(),e=Ce(3);m(2),g("ngTemplateOutlet",e)("ngTemplateOutletContext",$(3,gxe,i.data==null?null:i.data.reactionAnnotation)),m(),g("ngForOf",i.data==null?null:i.data.overlappingReactionAnnotations)}}function N0n(n,r){n&1&&(_(0,"span"),ne(1,"(You)"),y())}function F0n(n,r){if(n&1&&(h(0),_(1,"span"),ne(2),M(3,"translate"),y(),p(4,N0n,2,0,"span",15),f()),n&2){let i=c().$implicit,e=c().user;m(2),Ke(R(3,2,(i==null||i.from==null?null:i.from.name)||(i==null||i.from==null?null:i.from.email))),m(2),g("ngIf",(i==null||i.from==null?null:i.from.userSnippylyId)===(e==null?null:e.userSnippylyId))}}function L0n(n,r){n&1&&D(0,"velt-skeleton-loader-internal",16)}function U0n(n,r){if(n&1&&(_(0,"div",12),D(1,"snippyly-user-avatar",13),p(2,F0n,5,4,"ng-container",14)(3,L0n,1,0,"ng-template",null,2,Me),y()),n&2){let i=r.$implicit,e=Ce(4);m(),g("size",24)("user",i==null?null:i.from),m(),g("ngIf",(i==null||i.from==null?null:i.from.name)||(i==null||i.from==null?null:i.from.email))("ngIfElse",e)}}function B0n(n,r){if(n&1&&(_(0,"div",10),p(1,U0n,5,4,"div",11),y()),n&2){let i=r.reactionAnnotation;m(),g("ngForOf",i==null?null:i.reactions)}}function V0n(n,r){if(n&1){let i=K();_(0,"app-reaction-pin",9),G("click",function(){let t=N(i).$implicit,o=c();return F(o.onReactionClick(t))}),p(1,B0n,2,1,"ng-template",null,1,Me),y()}if(n&2){let i=r.$implicit,e=Ce(2);g("width",50)("height",50)("tooltipTemplate",e)("annotationId",i==null?null:i.annotationId)}}var vxe=(()=>{let r=class r{constructor(){this.reactionClick=new Fe,this.veltElement=!0}ngOnInit(){}onReactionClick(e){this.reactionClick.emit(e)}};r.\u0275fac=function(t){return new(t||r)},r.\u0275cmp=O({type:r,selectors:[["app-player-timeline-reaction-tooltip"]],hostVars:1,hostBindings:function(t,o){t&2&&T("data-velt-element",o.veltElement)},inputs:{data:"data"},outputs:{reactionClick:"reactionClick"},standalone:!1,decls:4,vars:1,consts:[["reactionPinTemplate",""],["tooltipTemplate",""],["loadingTemplateRef",""],[1,"reaction-tooltip-container"],["class","reaction-tooltip",4,"ngIf"],[1,"reaction-tooltip"],[1,"reaction-tooltip__item"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],["class","reaction-tooltip__item",4,"ngFor","ngForOf"],["type","timeline",3,"click","width","height","tooltipTemplate","annotationId"],[1,"v-tooltip-container"],["class","v-tooltip-reaction-user",4,"ngFor","ngForOf"],[1,"v-tooltip-reaction-user"],[1,"s-tooltip-user-avatar",3,"size","user"],[4,"ngIf","ngIfElse"],[4,"ngIf"],["height","20px","width","64px","borderRadius","20px"]],template:function(t,o){t&1&&(_(0,"div",3),p(1,R0n,4,5,"div",4),y(),p(2,V0n,3,4,"ng-template",null,0,Me)),t&2&&(m(),g("ngIf",o.data==null||o.data.overlappingReactionAnnotations==null?null:o.data.overlappingReactionAnnotations.length))},dependencies:[Vt,se,Nt,ri,fp,ao,ue],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}.reaction-tooltip-container[_ngcontent-%COMP%]{padding-bottom:calc((.5rem + 0px) * var(--velt-base-rem-unit));transition:all .3s ease-in-out}.reaction-tooltip[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;gap:calc((.5rem + 0px) * var(--velt-base-rem-unit));background:#000;border:1px solid grey;border-radius:calc((.5rem + 0px) * var(--velt-base-rem-unit));padding:calc((.5rem + 0px) * var(--velt-base-rem-unit));border-radius:18px;background:#3333;box-shadow:0 8px 4px #0000000d,0 1px 1px #ffffff4d inset,0 -1px 1px #ffffff1a inset;-webkit-backdrop-filter:blur(16px);backdrop-filter:blur(16px)}.reaction-tooltip[_ngcontent-%COMP%] .reaction-tooltip__item[_ngcontent-%COMP%]{cursor:pointer}[_nghost-%COMP%] .s-emoji-block_timeline .s-emoji-block__item__emoji svg, [_nghost-%COMP%] .s-emoji-block_timeline[_ngcontent-%COMP%] .s-emoji-block__item__emoji[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:20px!important;height:20px!important} .v-tooltip-container{display:flex;flex-direction:column;gap:calc((.5rem + 0px) * var(--velt-base-rem-unit));padding:calc((.5rem + 0px) * var(--velt-base-rem-unit));color:var(--neutrals-13, #FFF);font-size:14px;font-style:normal;font-weight:400;line-height:20px;border-radius:calc((1.5rem + 0px) * var(--velt-base-rem-unit));background:#3333;box-shadow:0 8px 4px #0000000d,0 1px 1px #ffffff4d inset,0 -1px 1px #ffffff1a inset;-webkit-backdrop-filter:blur(16px);backdrop-filter:blur(16px)} .v-tooltip-container .v-tooltip-reaction-user{display:flex;align-items:center;gap:calc((.5rem + 0px) * var(--velt-base-rem-unit));padding-right:2px} .v-tooltip-container .v-tooltip-reaction-user snippyly-user-avatar{display:flex;border-radius:calc((2rem + 0px) * var(--velt-base-rem-unit));border:1px solid #FFF;background:var(--primary-2, #A259FE)}"],changeDetection:0});let n=r;return n})();function $0n(n,r){n&1&&Xe(0)}function H0n(n,r){if(n&1&&(_(0,"velt-shadow-dom-internal"),p(1,$0n,1,0,"ng-container",5),y()),n&2){c();let i=Ce(2);m(),g("ngTemplateOutlet",i)}}function z0n(n,r){n&1&&D(0,"div",18)}function G0n(n,r){n&1&&D(0,"div",18)}function W0n(n,r){if(n&1){let i=K();_(0,"div",19)(1,"div",20),G("click",function(t){N(i);let o=c(3).$implicit;return c(2).onCommentAnnotationClick(o==null||o.overlappingCommentAnnotations[0]==null?null:o.overlappingCommentAnnotations[0].commentAnnotation),F(t.stopPropagation())}),ne(2),p(3,G0n,1,0,"div",16),y()()}if(n&2){let i=c(3).$implicit;m(2),Ee(" +",i==null||i.overlappingCommentAnnotations==null?null:i.overlappingCommentAnnotations.length," "),m(),g("ngIf",i==null?null:i.isUnread)}}function q0n(n,r){if(n&1&&(_(0,"div",13)(1,"div",14),D(2,"snippyly-user-avatar",15),p(3,z0n,1,0,"div",16),y()(),p(4,W0n,4,2,"ng-template",17)),n&2){let i=c(2).$implicit;ct("background",(i==null||i.commentAnnotation==null||i.commentAnnotation.status==null?null:i.commentAnnotation.status.color)||null),m(2),g("user",i==null||i.commentAnnotation==null?null:i.commentAnnotation.from)("size",18),m(),g("ngIf",(i==null?null:i.isUnread)&&(i==null||i.overlappingCommentAnnotations==null?null:i.overlappingCommentAnnotations.length)===0),m(),g("ngIf",i==null||i.overlappingCommentAnnotations==null?null:i.overlappingCommentAnnotations.length)}}function Y0n(n,r){if(n&1){let i=K();_(0,"app-player-timeline-comment-tooltip",21),G("commentClick",function(t){N(i);let o=c(4);return F(o.onCommentAnnotationClick(t))}),y()}if(n&2){let i=c(2).$implicit,e=c(2);g("data",i)("formattedTimeMap",e.formattedTimeMap)("formattedDuration",e.formattedDuration)("unreadCommentsMap",e.unreadCommentsMap)}}function K0n(n,r){if(n&1){let i=K();_(0,"div",10)(1,"div",11),G("click",function(){N(i);let t=c().$implicit,o=c(2);return F(o.onCommentAnnotationClick(t==null?null:t.commentAnnotation))}),_(2,"app-overlay-tooltip",12),p(3,q0n,5,6,"ng-template",null,1,Me)(5,Y0n,1,4,"ng-template",null,2,Me),y()()()}if(n&2){let i=c().$implicit,e=c(2);ct("--legacy-velt-player-position",((i==null?null:i.position)||0)+"%")("--legacy-velt-player-offset-left",(e.frameWidth||0)/2+"px"),m(2),g("positions",e.commentTooltipOverlayPositions)}}function Z0n(n,r){if(n&1&&(h(0),p(1,K0n,7,5,"div",9),f()),n&2){let i=r.$implicit;m(),g("ngIf",(i==null?null:i.position)!==null)}}function X0n(n,r){n&1&&(_(0,"span"),ne(1,"(You)"),y())}function J0n(n,r){if(n&1&&(h(0),_(1,"span"),ne(2),M(3,"translate"),y(),p(4,X0n,2,0,"span",28),f()),n&2){let i=c().$implicit,e=c().user;m(2),Ke(R(3,2,(i==null||i.from==null?null:i.from.name)||(i==null||i.from==null?null:i.from.email))),m(2),g("ngIf",(i==null||i.from==null?null:i.from.userSnippylyId)===(e==null?null:e.userSnippylyId))}}function Q0n(n,r){n&1&&D(0,"velt-skeleton-loader-internal",29)}function eCn(n,r){if(n&1&&(_(0,"div",26),D(1,"snippyly-user-avatar",27),p(2,J0n,5,4,"ng-container",4)(3,Q0n,1,0,"ng-template",null,3,Me),y()),n&2){let i=r.$implicit,e=Ce(4);m(),g("size",24)("user",i==null?null:i.from),m(),g("ngIf",(i==null||i.from==null?null:i.from.name)||(i==null||i.from==null?null:i.from.email))("ngIfElse",e)}}function tCn(n,r){if(n&1&&(_(0,"div",24),p(1,eCn,5,4,"div",25),y()),n&2){let i=r.reactionAnnotation;m(),g("ngForOf",i==null?null:i.reactions)}}function nCn(n,r){if(n&1){let i=K();_(0,"div",20),G("click",function(t){N(i);let o=c(3).$implicit;return c(2).onReactionAnnotationClick(o==null||o.overlappingReactionAnnotations[0]==null?null:o.overlappingReactionAnnotations[0].reactionAnnotation),F(t.stopPropagation())}),ne(1),y()}if(n&2){let i=c(3).$implicit;m(),Ee(" +",i==null||i.overlappingReactionAnnotations==null?null:i.overlappingReactionAnnotations.length," ")}}function iCn(n,r){if(n&1){let i=K();_(0,"div",22)(1,"app-reaction-pin",23),G("click",function(){N(i);let t=c(2).$implicit,o=c(2);return F(o.onReactionAnnotationClick(t==null?null:t.reactionAnnotation))}),p(2,tCn,2,1,"ng-template",null,2,Me),y()(),p(4,nCn,2,1,"ng-template",17)}if(n&2){let i=Ce(3),e=c(2).$implicit;m(),g("disableTooltip",!!(!(e==null||e.overlappingReactionAnnotations==null)&&e.overlappingReactionAnnotations.length))("tooltipTemplate",i)("annotationId",e==null||e.reactionAnnotation==null?null:e.reactionAnnotation.annotationId),m(3),g("ngIf",e==null||e.overlappingReactionAnnotations==null?null:e.overlappingReactionAnnotations.length)}}function rCn(n,r){if(n&1){let i=K();_(0,"app-player-timeline-reaction-tooltip",30),G("reactionClick",function(t){N(i);let o=c(4);return F(o.onReactionAnnotationClick(t))}),y()}if(n&2){let i=c(2).$implicit;g("data",i)}}function oCn(n,r){if(n&1){let i=K();_(0,"div",10)(1,"div",11),G("click",function(){N(i);let t=c().$implicit,o=c(2);return F(o.onReactionAnnotationClick(t==null?null:t.reactionAnnotation))}),_(2,"app-overlay-tooltip",12),p(3,iCn,5,4,"ng-template",null,1,Me)(5,rCn,1,1,"ng-template",null,2,Me),y()()()}if(n&2){let i=c().$implicit,e=c(2);ct("--legacy-velt-player-position",((i==null?null:i.position)||0)+"%")("--legacy-velt-player-offset-left",(e.frameWidth||0)/2+"px"),m(2),g("positions",e.commentTooltipOverlayPositions)}}function aCn(n,r){if(n&1&&(h(0),p(1,oCn,7,5,"div",9),f()),n&2){let i=r.$implicit;m(),g("ngIf",(i==null?null:i.position)!==null)}}function lCn(n,r){if(n&1&&(_(0,"div",6)(1,"div",7),p(2,Z0n,2,1,"ng-container",8)(3,aCn,2,1,"ng-container",8),y()()),n&2){let i=c();m(2),g("ngForOf",i.commentAnnotationsWithPosition)("ngForTrackBy",i.trackByFn),m(),g("ngForOf",i.reactionAnnotationsWithPosition)("ngForTrackBy",i.trackByFn)}}var EN=(()=>{let r=class r{set _shadowDom(e){try{let t=e;typeof e=="string"&&(t=JSON.parse(e)),this.shadowDom=t}catch{}}get totalMediaLength(){return this._totalMediaLength}set totalMediaLength(e){this._totalMediaLength=e,e&&(this.formattedDuration=hd(e)),this.calculateFrameWidth(),this.calculateAllCommentAnnotationPosition()}set totalMediaLengthInput(e){typeof e=="string"&&(e=parseFloat(e)),e>=0&&this.commentService.setTotalMediaLength(e)}set _version(e){try{let t=e;typeof e=="string"&&(t=JSON.parse(e)),t&&typeof t=="object"?(this.version={id:t.id,name:t.name},this.filterCommentAnnotations(),this.filterReactionAnnotations()):this.version=void 0}catch{}}get offset(){return this._offset}set offset(e){this._offset=e,this.calculateFrameWidth(),this.calculateAllCommentAnnotationPosition()}set _offsetInput(e){try{typeof e=="string"&&(e=parseInt(e,10)),this.offset=e}catch{}}constructor(e,t,o,a,l,s,d){this.docService=e,this.domService=t,this.commentService=o,this.loggingService=a,this.reactionService=l,this.cd=s,this.elementRef=d,this.shadowDom=!0,this._totalMediaLength=0,this._offset=0,this.commentAnnotations=[],this.reactionAnnotations=[],this.commentClickEmitter=new Fe,this.reactionClickEmitter=new Fe,this.allCommentAnnotations=[],this.allReactionAnnotations=[],this.selectedAnnotationsMap={},this.commentAnnotationsWithPosition=[],this.reactionAnnotationsWithPosition=[],this.formattedTimeMap={},this.frameWidth=0,this.commentTooltipOverlayPositions=[{originX:"center",originY:"top",overlayX:"center",overlayY:"bottom"},{originX:"start",originY:"top",overlayX:"center",overlayY:"bottom"},{originX:"end",originY:"top",overlayX:"center",overlayY:"bottom"},{originX:"center",originY:"top",overlayX:"end",overlayY:"bottom"},{originX:"center",originY:"top",overlayX:"start",overlayY:"bottom"},{originX:"end",originY:"top",overlayX:"start",overlayY:"bottom"},{originX:"start",originY:"top",overlayX:"end",overlayY:"bottom"}],this.unreadCommentsMap=null,this.resolvedCommentsOnDom=!1,this.veltElement=!0,this.destroyRef=pe(ca);try{this.loggingService.log("%c[WB] Creating CLASS: CommentPlayerTimelineComponent","color: blue;"),this.docService.getDocumentPaths$().pipe(Sh(this.destroyRef)).subscribe(v=>{this.documentPaths=v,this.getAllCommentsOnCurrentDocument(),this.getAllReactionsOnCurrentDocument()},v=>{this.loggingService.catch("Error in CommentPlayerTimelineComponent getDocumentPaths$ subscription: ",v)}),this.domService.getSelectedAnnotationsMap$().pipe(Sh(this.destroyRef)).subscribe(v=>{this.selectedAnnotationsMap=v},v=>{this.loggingService.catch("Error in CommentPlayerTimelineComponent getSelectedAnnotationsMap$ subscription: ",v)}),this.commentService.getTotalMediaLength$().pipe(Sh(this.destroyRef)).subscribe(v=>{this.totalMediaLength=v},v=>{this.loggingService.catch("Error in CommentPlayerTimelineComponent getTotalMediaLength$ subscription: ",v)}),this.commentService.getResolvedCommentsOnDom$().pipe(Sh(this.destroyRef)).subscribe(v=>{this.resolvedCommentsOnDom!==v&&(this.resolvedCommentsOnDom=v,this.filterCommentAnnotations())},v=>{this.loggingService.catch("Error in CommentPlayerTimelineComponent getResolvedCommentsOnDom$ subscription: ",v)})}catch(v){this.loggingService.catch("Error in CommentPlayerTimelineComponent constructor: ",v)}}ngOnInit(){}ngOnChanges(e){try{e?.version&&this.filterCommentAnnotations(),e?.videoPlayerId&&(this.filterCommentAnnotations(),this.filterReactionAnnotations())}catch(t){this.loggingService.catch("Error in CommentPlayerTimelineComponent ngOnChanges: ",t)}}ngAfterViewInit(){try{this.calculateFrameWidth()}catch(e){this.loggingService.catch("Error in CommentPlayerTimelineComponent ngAfterViewInit: ",e)}}trackByFn(e,t){return t?.commentAnnotation?.annotationId||e}calculateFrameWidth(){try{if(this.source==="video")this.frameWidth=0;else{let e=0;if(this.elementRef?.nativeElement&&(e=this.elementRef.nativeElement?.offsetWidth),e&&this.totalMediaLength){let t=e/this.totalMediaLength;this.frameWidth=t,this.cd.markForCheck()}}}catch(e){this.loggingService.catch("Error in CommentPlayerTimelineComponent calculateOffsetLeft: ",e)}}getAllCommentsOnCurrentDocument(){try{this.loggingService.log("%c[WB] Calling FUNCTION: getAllCommentsOnCurrentDocument","color: green;"),this.getAllCommentAnnotationsSubscription&&this.getAllCommentAnnotationsSubscription.unsubscribe(),this.getAllCommentAnnotationsSubscription=this.commentService.getAllCommentAnnotations({customClientDocumentId:this.documentPaths?.clientDocumentId,excludeDomChanges:!0,skipPositionCalculation:!0,analytics:{enabled:!0,properties:{source:"internal",sourceId:"commentPlayerTimeline"}}}).pipe(Sh(this.destroyRef),je(e=>!!e),fe(e=>this.domService.getSelectedAnnotationsMap$().pipe(ge(t=>({filteredAnnotations:e,selectedAnnotationsMap:t||{}})))),fe(e=>this.commentService.getUnreadCommentsMap$().pipe(ge(t=>(this.unreadCommentsMap=t,E(b({},e),{unreadCommentsMap:t})))))).subscribe(e=>{this.loggingService.log(e),this.allCommentAnnotations=e?.filteredAnnotations?.slice()||[],this.filterCommentAnnotations()},e=>{this.loggingService.catch("Error in CommentPlayerTimelineComponent getAllCommentAnnotations subscription: ",e)})}catch(e){this.loggingService.catch("Error in CommentPlayerTimelineComponent getAllCommentsOnCurrentDocument: ",e)}}filterCommentAnnotations(){try{this.commentAnnotations=[],this.commentAnnotations=this.allCommentAnnotations.filter(e=>this.version?.id===e?.location?.version?.id?!this.videoPlayerId||e?.location?.videoPlayerId===this.videoPlayerId||e?.targetElementId===this.videoPlayerId:!1),this.commentAnnotations=this.commentAnnotations.filter(e=>!(e.status!==void 0&&e.status.type==="terminal"&&!this.selectedAnnotationsMap[e.annotationId]&&!this.resolvedCommentsOnDom)),this.calculateAllCommentAnnotationPosition(),this.cd.markForCheck()}catch(e){this.loggingService.catch("Error in CommentPlayerTimelineComponent filterCommentAnnotations: ",e)}}calculateAllCommentAnnotationPosition(){try{this.loggingService.log("%c[WB] Calling FUNCTION: calculateAllCommentAnnotationPosition","color: green;"),this.commentAnnotationsWithPosition=[],this.commentAnnotations.length&&this.commentAnnotations.forEach(e=>{let t=this.calculateCommentAnnotationPosition(e),o=this.commentAnnotationsWithPosition.find(l=>l?.position&&t&&l?.position+2>t&&l?.position-2<t?!0:null),a=o?.isUnread??!1;if(this.unreadCommentsMap?.[e.annotationId]&&(a=!0),o)o.isUnread=a,o.overlappingCommentAnnotations?o.overlappingCommentAnnotations.push({commentAnnotation:e,position:t}):o.overlappingCommentAnnotations=[{commentAnnotation:e,position:t}];else{let l=!1;this.unreadCommentsMap?.[e.annotationId]&&(l=!0),this.commentAnnotationsWithPosition.push({commentAnnotation:e,position:t,overlappingCommentAnnotations:[],isUnread:l})}})}catch(e){this.loggingService.catch("Error in CommentPlayerTimelineComponent calculateAllCommentAnnotationPosition: ",e)}}calculateCommentAnnotationPosition(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: calculateCommentAnnotationPosition","color: green;");let t=e?.location?.currentMediaPosition-this.offset;if(this.formattedTimeMap[t]||(this.formattedTimeMap[t]=hd(t)),t>=0&&this.totalMediaLength>0){let o=t/this.totalMediaLength*100;if(o>=0&&o<=100)return o}return null}catch{return null}}onCommentAnnotationClick(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: onCommentAnnotationClick","color: green;"),this.domService.toggleAnnotationSelection(e),this.emitOnCommentClick(e)}catch(t){this.loggingService.catch("Error in CommentPlayerTimelineComponent onCommentAnnotationClick: ",t)}}emitOnCommentClick(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: emitOnCommentClick","color: green;");let t=this.documentPaths?.clientDocumentId,o=e?.location;o||(o=e?.documentParams);let a={};e.context&&(a=e.context),this.commentClickEmitter.emit({documentId:t,location:o,targetElementId:e?.targetElementId,context:a,annotation:e})}catch(t){this.loggingService.catch("Error in CommentPlayerTimelineComponent emitOnCommentClick: ",t)}}getAllReactionsOnCurrentDocument(){try{this.loggingService.log("%c[WB] Calling FUNCTION: getAllReactionsOnCurrentDocument","color: green;"),this.getAllReactionAnnotationsSubscription&&this.getAllReactionAnnotationsSubscription.unsubscribe(),this.getAllReactionAnnotationsSubscription=this.reactionService.getAllReactionAnnotations(this.documentPaths?.clientDocumentId,void 0,!0,void 0,!0).pipe(Sh(this.destroyRef),je(e=>!!e),ge(e=>e?.filter(t=>!t?.commentAnnotationId))).subscribe(e=>{this.loggingService.log(e),this.allReactionAnnotations=e?.slice()||[],this.filterReactionAnnotations()},e=>{this.loggingService.catch("Error in CommentPlayerTimelineComponent getAllReactionsOnCurrentDocument subscription: ",e)})}catch(e){this.loggingService.catch("Error in CommentPlayerTimelineComponent getAllReactionsOnCurrentDocument: ",e)}}filterReactionAnnotations(){try{this.reactionAnnotations=[],this.reactionAnnotations=this.allReactionAnnotations.filter(e=>this.version?.id===e?.location?.version?.id?!this.videoPlayerId||e?.location?.videoPlayerId===this.videoPlayerId:!1),this.calculateAllReactionAnnotationPosition(),this.cd.markForCheck()}catch(e){this.loggingService.catch("Error in CommentPlayerTimelineComponent filterReactionAnnotations: ",e)}}calculateAllReactionAnnotationPosition(){try{this.loggingService.log("%c[WB] Calling FUNCTION: calculateAllReactionAnnotationPosition","color: green;"),this.reactionAnnotationsWithPosition=[],this.reactionAnnotations.length&&this.reactionAnnotations.forEach(e=>{let t=this.calculateReactionAnnotationPosition(e),o=this.reactionAnnotationsWithPosition.find(a=>a?.position&&t&&a?.position+2>t&&a?.position-2<t?!0:null);o?o.overlappingReactionAnnotations?o.overlappingReactionAnnotations.push({reactionAnnotation:e,position:t}):o.overlappingReactionAnnotations=[{reactionAnnotation:e,position:t}]:this.reactionAnnotationsWithPosition.push({reactionAnnotation:e,position:t,overlappingReactionAnnotations:[]})})}catch(e){this.loggingService.catch("Error in CommentPlayerTimelineComponent calculateAllReactionAnnotationPosition: ",e)}}calculateReactionAnnotationPosition(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: calculateReactionAnnotationPosition","color: green;");let t=e?.location?.currentMediaPosition;return t>=0&&this.totalMediaLength>0?t/this.totalMediaLength*100:null}catch{return null}}onReactionAnnotationClick(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: onReactionAnnotationClick","color: green;"),this.source!=="video"&&this.reactionService.addOrUpdateReaction(e.icon,[e.annotationId],location),this.emitOnReactionClick(e)}catch(t){this.loggingService.catch("Error in CommentPlayerTimelineComponent onReactionAnnotationClick: ",t)}}emitOnReactionClick(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: emitOnReactionClick","color: green;");let t=this.documentPaths?.clientDocumentId,o=e?.location;this.reactionClickEmitter.emit({documentId:t,location:o,targetElementId:e?.targetElementId,annotation:e})}catch(t){this.loggingService.catch("Error in CommentPlayerTimelineComponent emitOnReactionClick: ",t)}}ngOnDestroy(){this.loggingService.log("%c[WB] Calling FUNCTION: ngOnDestroy","color: green;");try{this.getAllCommentAnnotationsSubscription&&(this.getAllCommentAnnotationsSubscription.unsubscribe(),this.getAllCommentAnnotationsSubscription=void 0),this.getAllReactionAnnotationsSubscription&&(this.getAllReactionAnnotationsSubscription.unsubscribe(),this.getAllReactionAnnotationsSubscription=void 0)}catch(e){this.loggingService.catch("Error in CommentPlayerTimelineComponent ondestroy: ",e)}}};r.\u0275fac=function(t){return new(t||r)(C(lt),C(Ve),C(Pe),C(x),C(ra),C(on),C(z))},r.\u0275cmp=O({type:r,selectors:[["velt-comment-player-timeline-internal"]],hostVars:1,hostBindings:function(t,o){t&2&&T("data-velt-element",o.veltElement)},inputs:{_shadowDom:[0,"shadowDom","_shadowDom"],totalMediaLengthInput:[0,"totalMediaLength","totalMediaLengthInput"],_version:[0,"version","_version"],_offsetInput:[0,"offset","_offsetInput"],commentAnnotations:"commentAnnotations",reactionAnnotations:"reactionAnnotations",videoPlayerId:"videoPlayerId",source:"source"},outputs:{commentClickEmitter:"onCommentClick",reactionClickEmitter:"onReactionClick"},standalone:!1,features:[it],decls:3,vars:2,consts:[["videoContainerRef",""],["triggerTemplate",""],["tooltipTemplate",""],["loadingTemplateRef",""],[4,"ngIf","ngIfElse"],[4,"ngTemplateOutlet"],[1,"comment-player-timeline-container"],[1,"comment-player-timeline"],[4,"ngFor","ngForOf","ngForTrackBy"],["class","comment-player-timeline__item",3,"--legacy-velt-player-position","--legacy-velt-player-offset-left",4,"ngIf"],[1,"comment-player-timeline__item"],[3,"click"],[3,"positions"],[1,"video-comment-user-profile-container"],[1,"video-comment-user-profile-container_wraper"],[3,"user","size"],["class","video-comment-user-profile-container__unread",4,"ngIf"],[3,"ngIf"],[1,"video-comment-user-profile-container__unread"],[1,"video-comment-user-profile-overlapping-comments_wraper"],[1,"comment-player-timeline__item__overlapping-comments__count",3,"click"],[3,"commentClick","data","formattedTimeMap","formattedDuration","unreadCommentsMap"],[1,"video-comment-user-profile-container","video-reaction-container"],["type","timeline",3,"click","disableTooltip","tooltipTemplate","annotationId"],[1,"v-tooltip-container"],["class","v-tooltip-reaction-user",4,"ngFor","ngForOf"],[1,"v-tooltip-reaction-user"],[1,"s-tooltip-user-avatar",3,"size","user"],[4,"ngIf"],["height","20px","width","64px","borderRadius","20px"],[3,"reactionClick","data"]],template:function(t,o){if(t&1&&p(0,H0n,2,1,"velt-shadow-dom-internal",4)(1,lCn,4,4,"ng-template",null,0,Me),t&2){let a=Ce(2);g("ngIf",o.shadowDom)("ngIfElse",a)}},dependencies:[Vt,se,Nt,ri,fp,Pd,mxe,vxe,jn,ao,ue],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}.comment-player-timeline-container[_ngcontent-%COMP%]{width:100%}.comment-player-timeline-container[_ngcontent-%COMP%] .comment-player-timeline[_ngcontent-%COMP%]{position:relative;width:100%;height:1px}.comment-player-timeline-container[_ngcontent-%COMP%] .comment-player-timeline[_ngcontent-%COMP%] .comment-player-timeline__item[_ngcontent-%COMP%]{position:absolute;bottom:100%;left:calc(var(--legacy-velt-player-position, 0%) - var(--legacy-velt-player-offset-left, 0px));transform:translate(-50%)}.comment-player-timeline-container[_ngcontent-%COMP%] .comment-player-timeline[_ngcontent-%COMP%] .comment-player-timeline__item[_ngcontent-%COMP%] .video-comment-user-profile-container[_ngcontent-%COMP%]{padding:2px;background:#fff;border-radius:100%;cursor:pointer;position:relative}.comment-player-timeline-container[_ngcontent-%COMP%] .comment-player-timeline[_ngcontent-%COMP%] .comment-player-timeline__item[_ngcontent-%COMP%] .video-comment-user-profile-container[_ngcontent-%COMP%] snippyly-user-avatar[_ngcontent-%COMP%]{--legacy-velt-user-avatar-size: 18px;display:flex}.comment-player-timeline-container[_ngcontent-%COMP%] .comment-player-timeline[_ngcontent-%COMP%] .comment-player-timeline__item[_ngcontent-%COMP%] .video-comment-user-profile-container.video-reaction-container[_ngcontent-%COMP%]{background-color:#141416;border:1px solid #625df5}.comment-player-timeline-container[_ngcontent-%COMP%] .comment-player-timeline[_ngcontent-%COMP%] .comment-player-timeline__item[_ngcontent-%COMP%] .comment-player-timeline__item__overlapping-comments__count[_ngcontent-%COMP%]{width:18px;height:18px;background:#65dab5;font-size:calc((.5rem + 0px) * var(--velt-base-rem-unit));color:#fff;border-radius:100%;border:2px solid #57BEA3;display:flex;align-items:center;justify-content:center;cursor:pointer;position:relative}.comment-player-timeline-container[_ngcontent-%COMP%] .comment-player-timeline[_ngcontent-%COMP%] .comment-player-timeline__item[_ngcontent-%COMP%]:hover{z-index:1}.comment-player-timeline-container[_ngcontent-%COMP%] .comment-player-timeline[_ngcontent-%COMP%] .comment-player-timeline__item[_ngcontent-%COMP%]:hover .comment-tooltip-container[_ngcontent-%COMP%]{opacity:1;visibility:visible;display:flex}[_nghost-%COMP%] .s-emoji-block_timeline .s-emoji-block__item__emoji svg, [_nghost-%COMP%] .s-emoji-block_timeline[_ngcontent-%COMP%] .s-emoji-block__item__emoji[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:20px!important;height:20px!important} .v-tooltip-container{display:flex;flex-direction:column;gap:calc((.5rem + 0px) * var(--velt-base-rem-unit));padding:calc((.5rem + 0px) * var(--velt-base-rem-unit));color:var(--neutrals-13, #FFF);font-size:14px;font-style:normal;font-weight:400;line-height:20px;border-radius:calc((1.5rem + 0px) * var(--velt-base-rem-unit));background:#3333;box-shadow:0 8px 4px #0000000d,0 1px 1px #ffffff4d inset,0 -1px 1px #ffffff1a inset;-webkit-backdrop-filter:blur(16px);backdrop-filter:blur(16px)} .v-tooltip-container .v-tooltip-reaction-user{display:flex;align-items:center;gap:calc((.5rem + 0px) * var(--velt-base-rem-unit));padding-right:2px} .v-tooltip-container .v-tooltip-reaction-user snippyly-user-avatar{display:flex;border-radius:calc((2rem + 0px) * var(--velt-base-rem-unit));border:1px solid #FFF;background:var(--primary-2, #A259FE)}.video-comment-user-profile-container_wraper[_ngcontent-%COMP%]{position:relative}.video-comment-user-profile-overlapping-comments_wraper[_ngcontent-%COMP%]{position:absolute;top:0;left:calc((.5rem + 0px) * var(--velt-base-rem-unit))}.video-comment-user-profile-container__unread[_ngcontent-%COMP%]{position:absolute;top:-2px;right:-2px;width:8px;height:8px;background:#ff7162;border-radius:50%}"],changeDetection:0});let n=r;return n})();var cCn=n=>({componentConfigSignal:n}),dCn=(n,r)=>({template:n,context:r});function mCn(n,r){n&1&&Xe(0)}function gCn(n,r){if(n&1&&(_(0,"velt-shadow-dom-internal"),p(1,mCn,1,0,"ng-container",3),y()),n&2){c();let i=Ce(3),e=c();T("data-testid",e.componentId+"-shadow-dom"),m(),g("ngTemplateOutlet",i)}}function vCn(n,r){if(n&1&&(h(0),D(1,"velt-reactions-panel-items-internal",6),f()),n&2){let i=c(3);m(),g("componentConfigSignal",i.componentConfigSignal),T("data-testid",i.componentId+"-items")}}function uCn(n,r){if(n&1){let i=K();_(0,"div",4),M(1,"translate"),G("clickOutside",function(){N(i);let t=c(2);return F(t.onClickOutside())}),p(2,vCn,2,2,"ng-container",5),y()}if(n&2){let i=c(2);ve("velt-reactions-panel--inline-section-mode",i.isInlineSectionMode)("velt-reactions-panel--default",!i.template)("dark",i.darkMode),T("aria-label",R(1,9,"Available reactions"))("data-testid",i.componentId+"-panel"),m(2),g("veltDynamicTemplate",w(13,dCn,i.template,$(11,cCn,i.componentConfigSignal)))}}function pCn(n,r){if(n&1&&(h(0),p(1,gCn,2,2,"velt-shadow-dom-internal",2)(2,uCn,3,16,"ng-template",null,0,Me),f()),n&2){let i=Ce(3),e=c();m(),g("ngIf",e.shadowDom&&!e.template)("ngIfElse",i)}}var uxe=(()=>{let r=class r extends Ct{constructor(e,t,o,a,l,s){super(o,a,void 0,void 0,void 0,s,t),this.emojiService=e,this.loggingService=t,this.elementRef=o,this.themeService=a,this.wireframeService=l,this.dynamicDataService=s,this.shadowDom=!0,this.isInlineSectionMode=!1,this.excludeReactionIds=[],this.emojiSelected=new Fe,this.hideTooltip=new Fe,this.componentConfigSignal=Oe({variant:this.variant,onClickOutside:this.onClickOutside.bind(this),handleEmojiSelected:this.handleEmojiSelected.bind(this),excludeReactionIds:this.excludeReactionIds}),this.subscriptions=[],this.componentId="velt-reactions-panel"}ngOnInit(){try{this.loggingService.log("%c[WB] Calling FUNCTION: ngOnInit","color: green;"),super.ngOnInit(),this.setupA11yAttributes();let e="velt-reactions-panel-wireframe";this.variant&&(e+=`---${this.variant}`),this.subscriptions.push(this.wireframeService.getWireframe$(e).subscribe(t=>{if(t){let o=document.createElement(t.tagName);o.innerHTML=t.innerHTML,this.template=o}}))}catch(e){this.loggingService.catch("Error in ReactionsPanelComponent OnInit: ",e)}}ngOnChanges(e){try{super.ngOnChanges(e),e&&Object.keys(e).forEach(t=>{this.componentConfigSignal.update(o=>(o=E(b({},o),{[t]:e[t].currentValue}),o))})}catch(t){this.loggingService.catch("Error in ReactionsPanelComponent ngOnChanges: ",t)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in ReactionsPanelComponent setupA11yAttributes:",e)}}trackByEmojiKey(e,t){return t?.key||e}onClickOutside(){try{this.hideTooltip.emit()}catch(e){this.loggingService.catch("Error in ReactionsPanelComponent onClickOutside: ",e)}}handleEmojiSelected(e){try{this.emojiSelected.emit(e),this.hideTooltip.emit()}catch(t){this.loggingService.catch("Error in ReactionsPanelComponent handleEmojiSelected: ",t)}}ngOnDestroy(){this.loggingService.log("%c[WB] Calling FUNCTION: ngOnDestroy","color: green;");try{super.ngOnDestroy(),this.unsubscribe()}catch(e){this.loggingService.catch("Error in ReactionsPanelComponent ondestroy: ",e)}}unsubscribe(){this.loggingService.log("%c[WB] Calling FUNCTION: unsubscribe","color: green;");try{this.subscriptions.map(e=>{e.unsubscribe()}),this.subscriptions=[]}catch(e){this.loggingService.catch("Error in ReactionsPanelComponent unsubscribe: ",e)}}};r.\u0275fac=function(t){return new(t||r)(C(Rm),C(x),C(z),C(mt),C(Je),C(I))},r.\u0275cmp=O({type:r,selectors:[["velt-reactions-panel-internal"]],inputs:{shadowDom:"shadowDom",variant:"variant",isInlineSectionMode:"isInlineSectionMode",excludeReactionIds:"excludeReactionIds"},outputs:{emojiSelected:"emojiSelected",hideTooltip:"hideTooltip"},standalone:!1,features:[j([I]),L,it],decls:1,vars:1,consts:[["reactionsPanelRef",""],[4,"ngIf"],[4,"ngIf","ngIfElse"],[4,"ngTemplateOutlet"],["snippylyClickOutside","","role","list",1,"velt-reactions-panel",3,"clickOutside"],[4,"veltDynamicTemplate"],[3,"componentConfigSignal"]],template:function(t,o){t&1&&p(0,pCn,4,2,"ng-container",1),t&2&&g("ngIf",o.componentConfigSignal())},dependencies:[se,Nt,ai,Q,jn,SS,ue],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}[_nghost-%COMP%]{--velt-green: var(--velt-light-mode-green);--velt-magenta: var(--velt-light-mode-magenta);--velt-amber: var(--velt-light-mode-amber);--velt-purple: var(--velt-light-mode-purple);--velt-cyan: var(--velt-light-mode-cyan);--velt-orange: var(--velt-light-mode-orange);--velt-black: var(--velt-light-mode-black);--velt-white: var(--velt-light-mode-white);--velt-gray: var(--velt-light-mode-gray);--velt-error: var(--velt-light-mode-error);--velt-error-hover: var(--velt-light-mode-error-hover);--velt-error-foreground: var(--velt-light-mode-error-foreground);--velt-error-light: var(--velt-light-mode-error-light);--velt-error-transparent: var(--velt-light-mode-error-transparent);--velt-warning: var(--velt-light-mode-warning);--velt-warning-hover: var(--velt-light-mode-warning-hover);--velt-warning-foreground: var(--velt-light-mode-warning-foreground);--velt-warning-light: var(--velt-light-mode-warning-light);--velt-warning-transparent: var(--velt-light-mode-warning-transparent);--velt-success: var(--velt-light-mode-success);--velt-success-hover: var(--velt-light-mode-success-hover);--velt-success-foreground: var(--velt-light-mode-success-foreground);--velt-success-light: var(--velt-light-mode-success-light);--velt-success-transparent: var(--velt-light-mode-success-transparent);--velt-accent: var(--velt-light-mode-accent);--velt-accent-text: var(--velt-light-mode-accent-text);--velt-accent-hover: var(--velt-light-mode-accent-hover);--velt-accent-foreground: var(--velt-light-mode-accent-foreground);--velt-accent-light: var(--velt-light-mode-accent-light);--velt-accent-transparent: var(--velt-light-mode-accent-transparent);--velt-text-0: var(--velt-light-mode-text-0);--velt-text-1: var(--velt-light-mode-text-1);--velt-text-2: var(--velt-light-mode-text-2);--velt-text-3: var(--velt-light-mode-text-3);--velt-text-4: var(--velt-light-mode-text-4);--velt-text-5: var(--velt-light-mode-text-5);--velt-text-6: var(--velt-light-mode-text-6);--velt-text-7: var(--velt-light-mode-text-7);--velt-text-8: var(--velt-light-mode-text-8);--velt-text-9: var(--velt-light-mode-text-9);--velt-text-10: var(--velt-light-mode-text-10);--velt-text-11: var(--velt-light-mode-text-11);--velt-text-12: var(--velt-light-mode-text-12);--velt-background-0: var(--velt-light-mode-background-0);--velt-background-1: var(--velt-light-mode-background-1);--velt-background-2: var(--velt-light-mode-background-2);--velt-background-3: var(--velt-light-mode-background-3);--velt-background-4: var(--velt-light-mode-background-4);--velt-background-5: var(--velt-light-mode-background-5);--velt-background-6: var(--velt-light-mode-background-6);--velt-background-7: var(--velt-light-mode-background-7);--velt-background-8: var(--velt-light-mode-background-8);--velt-background-9: var(--velt-light-mode-background-9);--velt-background-10: var(--velt-light-mode-background-10);--velt-border-0: var(--velt-light-mode-border-0);--velt-border-1: var(--velt-light-mode-border-1);--velt-border-2: var(--velt-light-mode-border-2);--velt-border-3: var(--velt-light-mode-border-3);--velt-border-4: var(--velt-light-mode-border-4);--velt-border-5: var(--velt-light-mode-border-5);--velt-border-6: var(--velt-light-mode-border-6);--velt-border-7: var(--velt-light-mode-border-7);--velt-border-8: var(--velt-light-mode-border-8);--velt-border-9: var(--velt-light-mode-border-9);--velt-border-10: var(--velt-light-mode-border-10);--velt-background-transparent: var(--velt-light-mode-background-transparent);--velt-border-transparent: var(--velt-light-mode-border-transparent);--velt-animation-transparent: var(--velt-light-mode-animation-transparent)}[dark][_nghost-%COMP%]{--velt-green: var(--velt-dark-mode-green);--velt-magenta: var(--velt-dark-mode-magenta);--velt-amber: var(--velt-dark-mode-amber);--velt-purple: var(--velt-dark-mode-purple);--velt-cyan: var(--velt-dark-mode-cyan);--velt-orange: var(--velt-dark-mode-orange);--velt-black: var(--velt-dark-mode-black);--velt-white: var(--velt-dark-mode-white);--velt-gray: var(--velt-dark-mode-gray);--velt-error: var(--velt-dark-mode-error);--velt-error-hover: var(--velt-dark-mode-error-hover);--velt-error-foreground: var(--velt-dark-mode-error-foreground);--velt-error-light: var(--velt-dark-mode-error-light);--velt-error-transparent: var(--velt-dark-mode-error-transparent);--velt-warning: var(--velt-dark-mode-warning);--velt-warning-hover: var(--velt-dark-mode-warning-hover);--velt-warning-foreground: var(--velt-dark-mode-warning-foreground);--velt-warning-light: var(--velt-dark-mode-warning-light);--velt-warning-transparent: var(--velt-dark-mode-warning-transparent);--velt-success: var(--velt-dark-mode-success);--velt-success-hover: var(--velt-dark-mode-success-hover);--velt-success-foreground: var(--velt-dark-mode-success-foreground);--velt-success-light: var(--velt-dark-mode-success-light);--velt-success-transparent: var(--velt-dark-mode-success-transparent);--velt-accent: var(--velt-dark-mode-accent);--velt-accent-text: var(--velt-dark-mode-accent-text);--velt-accent-hover: var(--velt-dark-mode-accent-hover);--velt-accent-foreground: var(--velt-dark-mode-accent-foreground);--velt-accent-light: var(--velt-dark-mode-accent-light);--velt-accent-transparent: var(--velt-dark-mode-accent-transparent);--velt-text-0: var(--velt-dark-mode-text-0);--velt-text-1: var(--velt-dark-mode-text-1);--velt-text-2: var(--velt-dark-mode-text-2);--velt-text-3: var(--velt-dark-mode-text-3);--velt-text-4: var(--velt-dark-mode-text-4);--velt-text-5: var(--velt-dark-mode-text-5);--velt-text-6: var(--velt-dark-mode-text-6);--velt-text-7: var(--velt-dark-mode-text-7);--velt-text-8: var(--velt-dark-mode-text-8);--velt-text-9: var(--velt-dark-mode-text-9);--velt-text-10: var(--velt-dark-mode-text-10);--velt-text-11: var(--velt-dark-mode-text-11);--velt-text-12: var(--velt-dark-mode-text-12);--velt-background-0: var(--velt-dark-mode-background-0);--velt-background-1: var(--velt-dark-mode-background-1);--velt-background-2: var(--velt-dark-mode-background-2);--velt-background-3: var(--velt-dark-mode-background-3);--velt-background-4: var(--velt-dark-mode-background-4);--velt-background-5: var(--velt-dark-mode-background-5);--velt-background-6: var(--velt-dark-mode-background-6);--velt-background-7: var(--velt-dark-mode-background-7);--velt-background-8: var(--velt-dark-mode-background-8);--velt-background-9: var(--velt-dark-mode-background-9);--velt-background-10: var(--velt-dark-mode-background-10);--velt-border-0: var(--velt-dark-mode-border-0);--velt-border-1: var(--velt-dark-mode-border-1);--velt-border-2: var(--velt-dark-mode-border-2);--velt-border-3: var(--velt-dark-mode-border-3);--velt-border-4: var(--velt-dark-mode-border-4);--velt-border-5: var(--velt-dark-mode-border-5);--velt-border-6: var(--velt-dark-mode-border-6);--velt-border-7: var(--velt-dark-mode-border-7);--velt-border-8: var(--velt-dark-mode-border-8);--velt-border-9: var(--velt-dark-mode-border-9);--velt-border-10: var(--velt-dark-mode-border-10);--velt-background-transparent: var(--velt-dark-mode-background-transparent);--velt-border-transparent: var(--velt-dark-mode-border-transparent);--velt-animation-transparent: var(--velt-dark-mode-animation-transparent)}.velt-reactions-panel[_ngcontent-%COMP%]{max-width:100%;overflow:visible;border:1px solid var(--velt-border-5);border-radius:var(--velt-border-radius-md);transition:opacity .5s;padding:var(--velt-spacing-sm) var(--velt-spacing-md);background-color:var(--velt-background-0);font-style:normal;font-weight:400;font-size:var(--velt-font-size-xs);line-height:calc((2rem + 0px) * var(--velt-base-rem-unit));box-shadow:0 8px 16px -8px #0f0f0f1a}.velt-reactions-panel--inline-section-mode[_ngcontent-%COMP%]{border-radius:var(--velt-border-radius-2xl)}"],changeDetection:0});let n=r;return n})();var fCn=n=>({template:n}),CCn=()=>["snippyly-overlay-panel","snippyly-reaction-dialog-overlay-panel","velt-overlay-panel"];function _Cn(n,r){n&1&&Xe(0)}function bCn(n,r){if(n&1&&(_(0,"velt-shadow-dom-internal"),p(1,_Cn,1,0,"ng-container",4),y()),n&2){c();let i=Ce(2);m(),g("ngTemplateOutlet",i)}}function SCn(n,r){if(n&1&&(h(0),_(1,"div",8),de(),_(2,"svg",9),D(3,"path",10)(4,"path",11)(5,"path",12),y()(),f()),n&2){let i=c(2);m(),ve("active",i.tooltipVisible)("no-padding",i.noPadding),T("data-testid",i.componentId+"-button"),m(),T("data-testid",i.componentId+"-icon")}}function yCn(n,r){if(n&1){let i=K();_(0,"velt-reactions-panel-internal",13),M(1,"translate"),G("emojiSelected",function(t){N(i);let o=c(2);return F(o.handleEmojiSelected(t))})("hideTooltip",function(){N(i);let t=c(2);return F(t.hideTooltip())}),y()}if(n&2){let i=c(2);g("darkMode",i.darkMode)("shadowDom",i.shadowDom)("variant",i.variant)("isInlineSectionMode",i.isInlineSectionMode)("excludeReactionIds",i.excludeReactionIds),T("data-testid",i.componentId+"-panel")("aria-label",R(1,7,"Reaction selector"))}}function xCn(n,r){if(n&1){let i=K();_(0,"div",5,1),M(2,"translate"),G("pointerdown",function(){N(i);let t=c();return F(t.showTooltip())}),p(3,SCn,6,6,"ng-container",6),y(),p(4,yCn,2,9,"ng-template",7,2,Me)}if(n&2){let i=Ce(1),e=Ce(5),t=c();ve("velt-reaction-btn-container--inline-section-mode",t.isInlineSectionMode),T("data-testid",t.componentId)("aria-expanded",t.tooltipVisible)("aria-haspopup",!0)("aria-label",R(2,14,"Add reaction")),m(3),g("veltDynamicTemplate",$(16,fCn,t.template)),m(),g("cdkConnectedOverlayOrigin",i)("cdkConnectedOverlayOpen",t.tooltipVisible)("cdkConnectedOverlayDisableClose",!0)("cdkConnectedOverlayPanelClass",yt(18,CCn))("cdkConnectedOverlayPositions",t.positions)("snippylyOverlay",e)("snippylyOverlayZIndex",2147483627)}}var Jy=(()=>{let r=class r extends Ct{constructor(e,t,o,a,l,s,d,v,u){super(l,d,void 0,void 0,void 0,u,a),this.docService=e,this.domService=t,this.emojiService=o,this.loggingService=a,this.elementRef=l,this.reactionService=s,this.themeService=d,this.wireframeService=v,this.dynamicDataService=u,this.shadowDom=!0,this.isInlineSectionMode=!1,this.noPadding=!1,this.excludeReactionIds=[],this.onReactionToolClick=new Fe,this.emojiSelected=new Fe,this.reactionToolOpen=new Fe,this.tooltipVisible=!1,this.customButtonAdded=!1,this.positions=[{originX:"center",originY:"top",overlayX:"center",overlayY:"bottom"},{originX:"center",originY:"bottom",overlayX:"center",overlayY:"top"},{originX:"start",originY:"center",overlayX:"end",overlayY:"center"},{originX:"end",originY:"center",overlayX:"start",overlayY:"center"}].map(S=>new xi({originX:S.originX,originY:S.originY},{overlayX:S.overlayX,overlayY:S.overlayY})),this.subscriptions=[],this.veltElement=!0,this.componentId="velt-reaction-tool"}ngOnInit(){try{this.loggingService.log("%c[WB] Calling FUNCTION: ngOnInit","color: green;"),super.ngOnInit(),this.setupA11yAttributes();let e="velt-reaction-tool-wireframe";this.variant&&(e+=`---${this.variant}`),this.subscriptions.push(this.wireframeService.getWireframe$(e).subscribe(t=>{if(t){let o=document.createElement(t.tagName);o.innerHTML=t.innerHTML,this.template=o}}))}catch(e){this.loggingService.catch("Error in ReactionToolComponent OnInit: ",e)}}ngOnChanges(e){super.ngOnChanges(e)}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("role","button"),e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("aria-haspopup","true"),e.setAttribute("aria-expanded","false")}catch(e){this.loggingService.catch("Error in ReactionToolComponent setupA11yAttributes:",e)}}trackByEmojiKey(e,t){return t?.key||e}onButtonSlotChange(){this.customButtonAdded=!0}showTooltip(){try{this.tooltipVisible=!0,this.toggleHostClass(),this.onReactionToolClick.emit()}catch(e){this.loggingService.catch("Error in ReactionToolComponent showTooltip: ",e)}}hideTooltip(){try{this.tooltipVisible=!1,this.toggleHostClass()}catch(e){this.loggingService.catch("Error in ReactionToolComponent hideTooltip: ",e)}}toggleHostClass(){try{this.tooltipVisible?(this.reactionToolOpen.emit(!0),this.domService.addClassToElement(this.elementRef.nativeElement,"reaction-tool-active"),this.domService.addClassToElement(this.elementRef.nativeElement,"velt-reaction-tool-open")):(this.reactionToolOpen.emit(!1),this.domService.removeClassFromElement(this.elementRef.nativeElement,"reaction-tool-active"),this.domService.removeClassFromElement(this.elementRef.nativeElement,"velt-reaction-tool-open"))}catch(e){this.loggingService.catch("Error in ReactionToolComponent toggleHostClass: ",e)}}handleEmojiSelected(e){try{this.emojiSelected.emit(e),this.hideTooltip(),this.videoPlayerId&&this.addReaction(e)}catch(t){this.loggingService.catch("Error in ReactionToolComponent handleEmojiSelected: ",t)}}addReaction(e){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: addReaction","color: green;"),this.videoPlayerId){let t=this.docService.getLocation()?.locationId,o=this.docService.getLocation()?.location;if(t){let a=document.getElementById(this.videoPlayerId);a&&a instanceof HTMLVideoElement&&(a.paused||a.pause());let l=this.docService.getDocumentPaths(),d=this.reactionService.getReactionAnnotationsByOrganizationIdAndDocumentId({organizationId:l?.organizationId,documentId:l?.documentId??""}).find(v=>v.locationId===t);this.reactionService.addOrUpdateReaction(e,d?[d.annotationId]:[],o)}}}catch(t){this.loggingService.catch("Error in VeltVideoPlayerComponent addReaction: ",t)}}ngOnDestroy(){this.loggingService.log("%c[WB] Calling FUNCTION: ngOnDestroy","color: green;");try{super.ngOnDestroy(),this.unsubscribe()}catch(e){this.loggingService.catch("Error in ReactionToolComponent ondestroy: ",e)}}unsubscribe(){this.loggingService.log("%c[WB] Calling FUNCTION: unsubscribe","color: green;");try{this.subscriptions.map(e=>{e.unsubscribe()}),this.subscriptions=[]}catch(e){this.loggingService.catch("Error in ReactionToolComponent unsubscribe: ",e)}}};r.\u0275fac=function(t){return new(t||r)(C(lt),C(Ve),C(Rm),C(x),C(z),C(ra),C(mt),C(Je),C(I))},r.\u0275cmp=O({type:r,selectors:[["app-reaction-tool"]],hostVars:1,hostBindings:function(t,o){t&2&&T("data-velt-element",o.veltElement)},inputs:{shadowDom:"shadowDom",variant:"variant",isInlineSectionMode:"isInlineSectionMode",videoPlayerId:"videoPlayerId",noPadding:"noPadding",excludeReactionIds:"excludeReactionIds"},outputs:{onReactionToolClick:"onReactionToolClick",emojiSelected:"emojiSelected",reactionToolOpen:"reactionToolOpen"},standalone:!1,features:[j([I]),L,it],decls:3,vars:2,consts:[["reactionToolRefRef",""],["trigger","cdkOverlayOrigin"],["overlay","cdkConnectedOverlay"],[4,"ngIf","ngIfElse"],[4,"ngTemplateOutlet"],["part","container","cdkOverlayOrigin","","role","button",1,"v-reaction-btn-container",3,"pointerdown"],[4,"veltDynamicTemplate"],["cdkConnectedOverlay","",3,"cdkConnectedOverlayOrigin","cdkConnectedOverlayOpen","cdkConnectedOverlayDisableClose","cdkConnectedOverlayPanelClass","cdkConnectedOverlayPositions","snippylyOverlay","snippylyOverlayZIndex"],["part","button-container",1,"action-btn"],["part","button-icon","width","24","height","24","viewBox","0 0 24 24","fill","none","xmlns","http://www.w3.org/2000/svg","aria-hidden","true","focusable","false",1,"action-btn-icon"],["d","M18.699 12.0222C18.7836 10.5835 18.4287 9.15318 17.6815 7.92091C16.9342 6.68864 15.83 5.71271 14.5152 5.1226C13.2004 4.5325 11.7373 4.35612 10.32 4.61687C8.90263 4.87762 7.59808 5.56317 6.57941 6.58257C5.56074 7.60196 4.87612 8.907 4.61637 10.3245C4.35663 11.742 4.53404 13.205 5.12508 14.5194C5.71612 15.8337 6.69284 16.9373 7.92564 17.6837C9.15844 18.43 10.589 18.7839 12.0276 18.6983M14.7629 17.1318H19.5M17.1315 14.7633V19.5004M9.23631 10.0262H9.24421M13.9734 10.0262H13.9813M9.63107 13.9738C10.1506 14.479 10.8627 14.7633 11.6049 14.7633C12.347 14.7633 13.0591 14.479 13.5786 13.9738","stroke","currentColor","stroke-width","1.33929","stroke-linecap","round","stroke-linejoin","round"],["d","M15.3496 10.6504C15.3496 11.2027 14.9019 11.6504 14.3496 11.6504C13.7973 11.6504 13.3496 11.2027 13.3496 10.6504C13.3496 10.0981 13.7973 9.65039 14.3496 9.65039C14.9019 9.65039 15.3496 10.0981 15.3496 10.6504Z","fill","currentColor"],["d","M10.9004 10.6504C10.9004 11.2027 10.4527 11.6504 9.90039 11.6504C9.34811 11.6504 8.90039 11.2027 8.90039 10.6504C8.90039 10.0981 9.34811 9.65039 9.90039 9.65039C10.4527 9.65039 10.9004 10.0981 10.9004 10.6504Z","fill","currentColor"],[3,"emojiSelected","hideTooltip","darkMode","shadowDom","variant","isInlineSectionMode","excludeReactionIds"]],template:function(t,o){if(t&1&&p(0,bCn,2,1,"velt-shadow-dom-internal",3)(1,xCn,6,19,"ng-template",null,0,Me),t&2){let a=Ce(2);g("ngIf",!o.template&&o.shadowDom)("ngIfElse",a)}},dependencies:[se,Nt,mn,cn,hi,uxe,Q,jn,ue],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}[_nghost-%COMP%]{display:flex;--velt-green: var(--velt-light-mode-green);--velt-magenta: var(--velt-light-mode-magenta);--velt-amber: var(--velt-light-mode-amber);--velt-purple: var(--velt-light-mode-purple);--velt-cyan: var(--velt-light-mode-cyan);--velt-orange: var(--velt-light-mode-orange);--velt-black: var(--velt-light-mode-black);--velt-white: var(--velt-light-mode-white);--velt-gray: var(--velt-light-mode-gray);--velt-error: var(--velt-light-mode-error);--velt-error-hover: var(--velt-light-mode-error-hover);--velt-error-foreground: var(--velt-light-mode-error-foreground);--velt-error-light: var(--velt-light-mode-error-light);--velt-error-transparent: var(--velt-light-mode-error-transparent);--velt-warning: var(--velt-light-mode-warning);--velt-warning-hover: var(--velt-light-mode-warning-hover);--velt-warning-foreground: var(--velt-light-mode-warning-foreground);--velt-warning-light: var(--velt-light-mode-warning-light);--velt-warning-transparent: var(--velt-light-mode-warning-transparent);--velt-success: var(--velt-light-mode-success);--velt-success-hover: var(--velt-light-mode-success-hover);--velt-success-foreground: var(--velt-light-mode-success-foreground);--velt-success-light: var(--velt-light-mode-success-light);--velt-success-transparent: var(--velt-light-mode-success-transparent);--velt-accent: var(--velt-light-mode-accent);--velt-accent-text: var(--velt-light-mode-accent-text);--velt-accent-hover: var(--velt-light-mode-accent-hover);--velt-accent-foreground: var(--velt-light-mode-accent-foreground);--velt-accent-light: var(--velt-light-mode-accent-light);--velt-accent-transparent: var(--velt-light-mode-accent-transparent);--velt-text-0: var(--velt-light-mode-text-0);--velt-text-1: var(--velt-light-mode-text-1);--velt-text-2: var(--velt-light-mode-text-2);--velt-text-3: var(--velt-light-mode-text-3);--velt-text-4: var(--velt-light-mode-text-4);--velt-text-5: var(--velt-light-mode-text-5);--velt-text-6: var(--velt-light-mode-text-6);--velt-text-7: var(--velt-light-mode-text-7);--velt-text-8: var(--velt-light-mode-text-8);--velt-text-9: var(--velt-light-mode-text-9);--velt-text-10: var(--velt-light-mode-text-10);--velt-text-11: var(--velt-light-mode-text-11);--velt-text-12: var(--velt-light-mode-text-12);--velt-background-0: var(--velt-light-mode-background-0);--velt-background-1: var(--velt-light-mode-background-1);--velt-background-2: var(--velt-light-mode-background-2);--velt-background-3: var(--velt-light-mode-background-3);--velt-background-4: var(--velt-light-mode-background-4);--velt-background-5: var(--velt-light-mode-background-5);--velt-background-6: var(--velt-light-mode-background-6);--velt-background-7: var(--velt-light-mode-background-7);--velt-background-8: var(--velt-light-mode-background-8);--velt-background-9: var(--velt-light-mode-background-9);--velt-background-10: var(--velt-light-mode-background-10);--velt-border-0: var(--velt-light-mode-border-0);--velt-border-1: var(--velt-light-mode-border-1);--velt-border-2: var(--velt-light-mode-border-2);--velt-border-3: var(--velt-light-mode-border-3);--velt-border-4: var(--velt-light-mode-border-4);--velt-border-5: var(--velt-light-mode-border-5);--velt-border-6: var(--velt-light-mode-border-6);--velt-border-7: var(--velt-light-mode-border-7);--velt-border-8: var(--velt-light-mode-border-8);--velt-border-9: var(--velt-light-mode-border-9);--velt-border-10: var(--velt-light-mode-border-10);--velt-background-transparent: var(--velt-light-mode-background-transparent);--velt-border-transparent: var(--velt-light-mode-border-transparent);--velt-animation-transparent: var(--velt-light-mode-animation-transparent)}[dark][_nghost-%COMP%]{--velt-green: var(--velt-dark-mode-green);--velt-magenta: var(--velt-dark-mode-magenta);--velt-amber: var(--velt-dark-mode-amber);--velt-purple: var(--velt-dark-mode-purple);--velt-cyan: var(--velt-dark-mode-cyan);--velt-orange: var(--velt-dark-mode-orange);--velt-black: var(--velt-dark-mode-black);--velt-white: var(--velt-dark-mode-white);--velt-gray: var(--velt-dark-mode-gray);--velt-error: var(--velt-dark-mode-error);--velt-error-hover: var(--velt-dark-mode-error-hover);--velt-error-foreground: var(--velt-dark-mode-error-foreground);--velt-error-light: var(--velt-dark-mode-error-light);--velt-error-transparent: var(--velt-dark-mode-error-transparent);--velt-warning: var(--velt-dark-mode-warning);--velt-warning-hover: var(--velt-dark-mode-warning-hover);--velt-warning-foreground: var(--velt-dark-mode-warning-foreground);--velt-warning-light: var(--velt-dark-mode-warning-light);--velt-warning-transparent: var(--velt-dark-mode-warning-transparent);--velt-success: var(--velt-dark-mode-success);--velt-success-hover: var(--velt-dark-mode-success-hover);--velt-success-foreground: var(--velt-dark-mode-success-foreground);--velt-success-light: var(--velt-dark-mode-success-light);--velt-success-transparent: var(--velt-dark-mode-success-transparent);--velt-accent: var(--velt-dark-mode-accent);--velt-accent-text: var(--velt-dark-mode-accent-text);--velt-accent-hover: var(--velt-dark-mode-accent-hover);--velt-accent-foreground: var(--velt-dark-mode-accent-foreground);--velt-accent-light: var(--velt-dark-mode-accent-light);--velt-accent-transparent: var(--velt-dark-mode-accent-transparent);--velt-text-0: var(--velt-dark-mode-text-0);--velt-text-1: var(--velt-dark-mode-text-1);--velt-text-2: var(--velt-dark-mode-text-2);--velt-text-3: var(--velt-dark-mode-text-3);--velt-text-4: var(--velt-dark-mode-text-4);--velt-text-5: var(--velt-dark-mode-text-5);--velt-text-6: var(--velt-dark-mode-text-6);--velt-text-7: var(--velt-dark-mode-text-7);--velt-text-8: var(--velt-dark-mode-text-8);--velt-text-9: var(--velt-dark-mode-text-9);--velt-text-10: var(--velt-dark-mode-text-10);--velt-text-11: var(--velt-dark-mode-text-11);--velt-text-12: var(--velt-dark-mode-text-12);--velt-background-0: var(--velt-dark-mode-background-0);--velt-background-1: var(--velt-dark-mode-background-1);--velt-background-2: var(--velt-dark-mode-background-2);--velt-background-3: var(--velt-dark-mode-background-3);--velt-background-4: var(--velt-dark-mode-background-4);--velt-background-5: var(--velt-dark-mode-background-5);--velt-background-6: var(--velt-dark-mode-background-6);--velt-background-7: var(--velt-dark-mode-background-7);--velt-background-8: var(--velt-dark-mode-background-8);--velt-background-9: var(--velt-dark-mode-background-9);--velt-background-10: var(--velt-dark-mode-background-10);--velt-border-0: var(--velt-dark-mode-border-0);--velt-border-1: var(--velt-dark-mode-border-1);--velt-border-2: var(--velt-dark-mode-border-2);--velt-border-3: var(--velt-dark-mode-border-3);--velt-border-4: var(--velt-dark-mode-border-4);--velt-border-5: var(--velt-dark-mode-border-5);--velt-border-6: var(--velt-dark-mode-border-6);--velt-border-7: var(--velt-dark-mode-border-7);--velt-border-8: var(--velt-dark-mode-border-8);--velt-border-9: var(--velt-dark-mode-border-9);--velt-border-10: var(--velt-dark-mode-border-10);--velt-background-transparent: var(--velt-dark-mode-background-transparent);--velt-border-transparent: var(--velt-dark-mode-border-transparent);--velt-animation-transparent: var(--velt-dark-mode-animation-transparent)}.v-reaction-btn-container[_ngcontent-%COMP%]{display:flex}.action-btn[_ngcontent-%COMP%]{display:inline-flex;justify-content:center;align-items:center;padding:calc(var(--velt-spacing-md) / 2);border-radius:var(--velt-border-radius-full);border:2px solid transparent;background-color:transparent;color:var(--velt-text-4);cursor:pointer}.action-btn.no-padding[_ngcontent-%COMP%]{padding:0}.action-btn[_ngcontent-%COMP%] .action-btn-label[_ngcontent-%COMP%]{font-size:var(--velt-font-size-sm);padding-right:var(--velt-spacing-xs);font-weight:700;color:currentColor}.action-btn[_ngcontent-%COMP%] .action-btn-icon[_ngcontent-%COMP%]{width:calc((1.5rem + 0px) * var(--velt-base-rem-unit));height:calc((1.5rem + 0px) * var(--velt-base-rem-unit));color:currentColor}.action-btn[_ngcontent-%COMP%] .toolbar-icon-dropdown-arrow[_ngcontent-%COMP%]{width:16px;height:16px;color:currentColor}.action-btn[_ngcontent-%COMP%]:focus{border-radius:var(--velt-border-radius-full);border:2px solid var(--velt-border-2);background-color:transparent;color:var(--velt-text-4)}.action-btn[_ngcontent-%COMP%]:focus .toolbar-icon-dropdown-arrow[_ngcontent-%COMP%]{color:var(--velt-text-4)}.action-btn[_ngcontent-%COMP%]:hover{border-radius:var(--velt-border-radius-full);border:2px solid var(--velt-border-2);background-color:var(--velt-background-2);color:var(--velt-text-4)}.action-btn[_ngcontent-%COMP%]:hover .toolbar-icon-dropdown-arrow[_ngcontent-%COMP%]{color:var(--velt-text-4)}.action-btn[_ngcontent-%COMP%]:active, .action-btn.active[_ngcontent-%COMP%]{border-radius:var(--velt-border-radius-full);border:2px solid var(--velt-accent);background-color:var(--velt-accent);color:var(--velt-accent-foreground)}.action-btn[_ngcontent-%COMP%]:active .toolbar-icon-dropdown-arrow[_ngcontent-%COMP%], .action-btn.active[_ngcontent-%COMP%] .toolbar-icon-dropdown-arrow[_ngcontent-%COMP%]{color:var(--velt-text-4)}.velt-reaction-btn-container--inline-section-mode[_ngcontent-%COMP%] .action-btn-icon[_ngcontent-%COMP%]{height:18px;width:18px}.velt-reaction-btn-container--inline-section-mode[_ngcontent-%COMP%] .action-btn[_ngcontent-%COMP%]{padding:calc(var(--velt-spacing-xs) - 1px)}.velt-reaction-btn-container--inline-section-mode[_ngcontent-%COMP%] .action-btn[_ngcontent-%COMP%]:active, .velt-reaction-btn-container--inline-section-mode[_ngcontent-%COMP%] .action-btn.active[_ngcontent-%COMP%]{border:1px solid var(--velt-accent-text);background:linear-gradient(0deg,#0006 0% 100%),var(--velt-accent)}"],changeDetection:0});let n=r;return n})();var ECn=["videoRef"],kCn=["progressBarRef"],TCn=["ghostProgressBarRef"];function wCn(n,r){if(n&1&&(_(0,"div",46),ne(1),y()),n&2){let i=c();m(),Ee(" ",i.hoveredTimeFormatted)}}function DCn(n,r){if(n&1&&(h(0),D(1,"div",47),f()),n&2){let i=r.$implicit;m(),ct("background",(i==null||i.commentAnnotation==null||i.commentAnnotation.status==null?null:i.commentAnnotation.status.color)||null)("left",i==null?null:i.position,"%")}}function OCn(n,r){if(n&1&&(h(0),D(1,"div",48),f()),n&2){let i=r.$implicit;m(),ct("left",i==null?null:i.position,"%")}}function ACn(n,r){if(n&1){let i=K();_(0,"button",49),G("click",function(){N(i);let t=c();return F(t.playVideo())}),de(),_(1,"svg",27),D(2,"path",50),y()()}}function PCn(n,r){if(n&1){let i=K();_(0,"button",49),G("click",function(){N(i);let t=c();return F(t.pauseVideo())}),de(),_(1,"svg",27),D(2,"path",51)(3,"path",52),y()()}}function MCn(n,r){if(n&1){let i=K();_(0,"velt-comment-tool",53),G("enableAddCommentMode",function(){N(i);let t=c();return F(t.onEnableAddCommentMode())}),_(1,"button",26),de(),_(2,"svg",27)(3,"mask",54),D(4,"path",55),y(),D(5,"path",56),y()()()}if(n&2){let i=c();m(),ve("active",i.addCommentMode)}}function RCn(n,r){if(n&1){let i=K();_(0,"button",49),G("click",function(){N(i);let t=c();return F(t.toggleMuteVideo())}),de(),_(1,"svg",27),D(2,"path",57)(3,"path",58),y()()}}function NCn(n,r){if(n&1){let i=K();_(0,"button",49),G("click",function(){N(i);let t=c();return F(t.toggleMuteVideo())}),de(),_(1,"svg",27),D(2,"path",59),y()()}}function FCn(n,r){if(n&1){let i=K();_(0,"div",60),G("click",function(){let t=N(i).$implicit,o=c();return F(o.changeVideoSpeed(t))}),ne(1),y()}if(n&2){let i=r.$implicit;c();let e=Ce(2);ve("selected",(e==null?null:e.playbackRate)===i)("selected",i===(e==null?null:e.playbackRate)),m(),Ee(" ",i,"x ")}}function LCn(n,r){if(n&1){let i=K();_(0,"button",49),G("click",function(){N(i);let t=c();return F(t.toggleFullScreen())}),de(),_(1,"svg",61),D(2,"path",62)(3,"path",63)(4,"path",64)(5,"path",65),y()()}}function UCn(n,r){if(n&1){let i=K();_(0,"button",49),G("click",function(){N(i);let t=c();return F(t.toggleFullScreen())}),de(),_(1,"svg",61),D(2,"path",66)(3,"path",67)(4,"path",68)(5,"path",69),y()()}}var pxe=(()=>{let r=class r{set _shadowDom(e){try{let t=e;typeof e=="string"&&(t=JSON.parse(e)),this.shadowDom=t}catch{}}set _version(e){try{let t=e;typeof e=="string"&&(t=JSON.parse(e)),t&&typeof t=="object"?this.version={id:t.id,name:t.name}:this.version=void 0}catch{}}set isDarkMode(e){this._darkAttribute=e,this.checkDarkMode()}set commentTool(e){try{let t=e;typeof e=="string"&&(t=JSON.parse(e)),t?this.showCommentTool=!0:this.showCommentTool=!1}catch{}}constructor(e,t,o,a,l,s){this.commentService=e,this.docService=t,this.loggingService=o,this.reactionService=a,this.syncVideoPlayerService=l,this.cd=s,this.shadowDom=!0,this._darkAttribute="",this.darkMode=!1,this.showCommentTool=!0,this.currentTime=0,this.duration=0,this.currentTimeFormatted="00:00",this.durationFormatted="00:00",this.hoveredTimeFormatted="",this.controlPanelVisible=!1,this.HIDE_CONTROL_PANEL_DURATION=1e4,this.VIDEO_FORWARD_DURATION=5,this.VIDEO_BACKWARD_DURATION=5,this.VIDEO_SPEED_OPTIONS=[.25,.5,1,1.25,1.5,2],this.fullScreen=!1,this.addCommentMode=!1,this.subscriptions=[],this.loggingService.log("%c[WB] Creating CLASS: VeltVideoPlayerComponent","color: blue;");try{this.checkDarkMode(),this.subscriptions.push(this.commentService.addCommentModeChange().subscribe(d=>{this.addCommentMode=d,d?this.onEnableAddCommentMode():this.onDisableAddCommentMode()})),this.subscriptions.push(this.commentService.onCommentAdd$().subscribe(d=>{if(d){this.pauseVideo();let v=this.getLocationOnCurrentTime();this.docService.setLocation({location:v})}}))}catch(d){this.loggingService.catch("Error in VeltVideoPlayerComponent constructor: ",d)}}ngAfterViewInit(){try{this.addVeltCommentsTag(),this.videoRef?.nativeElement&&(this.playerId=OG(this.videoRef.nativeElement),this.subscriptions.push(Oi(this.videoRef.nativeElement,"play").subscribe(e=>{let t=this.docService.getLocation();t&&t.location?.videoPlayerId===this.playerId&&this.docService.removeLocations({})})),this.subscriptions.push(Oi(this.videoRef.nativeElement,"timeupdate").subscribe(e=>{this.currentTime=this.videoRef?.nativeElement?.currentTime||0,this.currentTimeFormatted=hd(this.currentTime),this.cd.markForCheck()})),this.subscriptions.push(Oi(this.videoRef.nativeElement,"loadedmetadata").subscribe(e=>{this.duration=this.videoRef?.nativeElement?.duration||0,this.durationFormatted=hd(this.duration),this.playerId=OG(this.videoRef?.nativeElement)}))),this.subscriptions.push(this.commentService.getSidebarCommentClick$().subscribe(e=>{let t=e.annotation;t?.location?.videoPlayerId===this.playerId&&this.onCommentAnnotationClick(t)}))}catch(e){this.loggingService.catch("Error in VeltVideoPlayerComponent ngAfterViewInit: ",e)}}trackByFn(e,t){return t?.commentAnnotation?.annotationId||e}addVeltCommentsTag(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: addVeltCommentsTag","color: green;"),!(document.querySelector(V.TAGS.VELT_COMMENTS)||document.querySelector(V.TAGS.SNIPPYLY_COMMENTS))){let t=document.createElement(V.TAGS.VELT_COMMENTS);document.body.appendChild(t)}}catch(e){this.loggingService.catch("Error in VeltVideoPlayerComponent addVeltCommentsTag: ",e)}}playVideo(){try{this.loggingService.log("%c[WB] Calling FUNCTION: playVideo","color: green;"),this.videoRef?.nativeElement?.play()}catch(e){this.loggingService.catch("Error in VeltVideoPlayerComponent playVideo: ",e)}}pauseVideo(){try{this.loggingService.log("%c[WB] Calling FUNCTION: pauseVideo","color: green;"),this.videoRef?.nativeElement?.pause()}catch(e){this.loggingService.catch("Error in VeltVideoPlayerComponent pauseVideo: ",e)}}toggleVideo(){try{this.loggingService.log("%c[WB] Calling FUNCTION: toggleVideo","color: green;"),this.videoRef?.nativeElement?.paused?this.playVideo():this.pauseVideo()}catch(e){this.loggingService.catch("Error in VeltVideoPlayerComponent toggleVideo: ",e)}}moveForwardVideo(){try{this.loggingService.log("%c[WB] Calling FUNCTION: moveForwardVideo","color: green;"),this.videoRef?.nativeElement&&(this.videoRef.nativeElement.currentTime+this.VIDEO_FORWARD_DURATION>this.videoRef.nativeElement.duration?this.videoRef.nativeElement.currentTime=this.videoRef.nativeElement.duration:this.videoRef.nativeElement.currentTime+=this.VIDEO_FORWARD_DURATION)}catch(e){this.loggingService.catch("Error in VeltVideoPlayerComponent moveForwardVideo: ",e)}}moveBackwardVideo(){try{this.loggingService.log("%c[WB] Calling FUNCTION: moveBackwardVideo","color: green;"),this.videoRef?.nativeElement&&(this.videoRef.nativeElement.currentTime-this.VIDEO_BACKWARD_DURATION<0?this.videoRef.nativeElement.currentTime=0:this.videoRef.nativeElement.currentTime-=this.VIDEO_BACKWARD_DURATION)}catch(e){this.loggingService.catch("Error in VeltVideoPlayerComponent moveBackwardVideo: ",e)}}toggleMuteVideo(){try{this.loggingService.log("%c[WB] Calling FUNCTION: toggleMuteVideo","color: green;"),this.videoRef?.nativeElement&&(this.videoRef.nativeElement.muted=!this.videoRef.nativeElement.muted)}catch(e){this.loggingService.catch("Error in VeltVideoPlayerComponent toggleMuteVideo: ",e)}}changeVolumeVideo(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: changeVolumeVideo","color: green;"),this.videoRef?.nativeElement&&(this.videoRef.nativeElement.volume=e.target.value)}catch(t){this.loggingService.catch("Error in VeltVideoPlayerComponent changeVolumeVideo: ",t)}}changeVideoSpeed(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: changeVideoSpeed","color: green;"),this.videoRef?.nativeElement&&(this.videoRef.nativeElement.playbackRate=e)}catch(t){this.loggingService.catch("Error in VeltVideoPlayerComponent changeVideoSpeed: ",t)}}stopVideo(){try{this.loggingService.log("%c[WB] Calling FUNCTION: stopVideo","color: green;"),this.videoRef?.nativeElement?.pause(),this.videoRef?.nativeElement&&(this.videoRef.nativeElement.currentTime=0)}catch(e){this.loggingService.catch("Error in VeltVideoPlayerComponent stopVideo: ",e)}}onProgressBarClick(e){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: onProgressBarClick","color: green;"),this.videoRef?.nativeElement){let t=e.offsetX/e.target.offsetWidth*this.duration;this.videoRef.nativeElement.currentTime=t}this.removeLocation()}catch(t){this.loggingService.catch("Error in VeltVideoPlayerComponent onProgressBarClick: ",t)}}onProgressBarPointerOver(e){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: onProgressBarPointerOver","color: green;"),this.progressBarRef?.nativeElement===e.target){if(this.ghostProgressBarRef?.nativeElement){this.ghostProgressBarRef.nativeElement.style.display="block",this.ghostProgressBarRef.nativeElement.style.width=`${e.offsetX}px`;let t=e.offsetX/e.target.offsetWidth*this.duration;this.hoveredTimeFormatted=hd(t)}}else this.onProgressBarPointerOut(e)}catch(t){this.loggingService.catch("Error in VeltVideoPlayerComponent onProgressBarPointerOver: ",t)}}onProgressBarPointerOut(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: onProgressBarPointerOut","color: green;"),this.ghostProgressBarRef?.nativeElement&&(this.ghostProgressBarRef.nativeElement.style.display="none"),this.hoveredTimeFormatted=""}catch(t){this.loggingService.catch("Error in VeltVideoPlayerComponent onProgressBarPointerOut: ",t)}}scrubVideo(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: scrubVideo","color: green;"),this.videoRef?.nativeElement&&(this.videoRef.nativeElement.currentTime=e.target?.value||0)}catch(t){this.loggingService.catch("Error in VeltVideoPlayerComponent scrubVideo: ",t)}}setLocation(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setLocation","color: green;"),this.playerId&&this.videoRef?.nativeElement&&(e&&this.docService.setLocation({location:e}),this.docService.setLocation({location:this.getLocationOnCurrentTime()}))}catch(t){this.loggingService.catch("Error in VeltVideoPlayerComponent setLocation: ",t)}}removeLocation(){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeLocation","color: green;"),this.docService.getLocation()&&this.docService.removeLocation({})}catch(e){this.loggingService.catch("Error in VeltVideoPlayerComponent removeLocation: ",e)}}onCommentAnnotationClick(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: onCommentAnnotationClick","color: green;"),this.videoRef?.nativeElement?.paused||(this.videoRef?.nativeElement.pause(),this.sync&&this.syncVideoPlayerService.updateVideoPlayerState(this.playerId,"pause",{playing:!1})),setTimeout(()=>{this.videoRef.nativeElement.currentTime=e.location?.currentMediaPosition,this.sync&&this.syncVideoPlayerService.updateVideoPlayerState(this.playerId,"timeupdate",{currentTime:e.location?.currentMediaPosition}),this.subscriptions.push(Oi(this.videoRef.nativeElement,"seeked").pipe(st(1)).subscribe({next:()=>{this.setLocation()},error:t=>{this.loggingService.catch("Error waiting for video to seek in VeltVideoPlayerComponent onCommentAnnotationClick: ",t)}}))},500)}catch(t){this.loggingService.catch("Error in VeltVideoPlayerComponent onCommentAnnotationClick: ",t)}}addReaction(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: addReaction","color: green;"),this.videoRef?.nativeElement?.paused||this.videoRef?.nativeElement.pause();let t=this.docService.getDocumentPaths(),o=this.reactionService.getReactionAnnotationsByOrganizationIdAndDocumentId({organizationId:t?.organizationId,documentId:t?.documentId??""}),a=this.videoRef?.nativeElement?.currentTime||0,l=o.find(d=>d.location?.videoPlayerId===this.playerId&&d.location?.currentMediaPosition===a),s=this.getLocationOnCurrentTime();this.reactionService.addOrUpdateReaction(e,l?[l.annotationId]:[],s)}catch(t){this.loggingService.catch("Error in VeltVideoPlayerComponent addReaction: ",t)}}onEnableAddCommentMode(){return X(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: onEnableAddCommentMode","color: green;"),this.playerId){this.previousAllowedElementIds=yield this.commentService.getAllowedElementIds().pipe(st(1)).toPromise();let e=[this.playerId];this.commentService.setAllowedElementIds(e),this.previousPersistentMode=yield this.commentService.persistentCommentModeChange().pipe(st(1)).toPromise(),this.commentService.enablePersistentCommentMode(),this.previousPersistentModeBanner=yield this.commentService.persistentModeBannerChange().pipe(st(1)).toPromise(),this.commentService.disablePersistentModeBanner()}this.pauseVideo()}catch(e){this.loggingService.catch("Error in VeltVideoPlayerComponent enableAddCommentMode: ",e)}})}onDisableAddCommentMode(){return X(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: onDisableAddCommentMode","color: green;"),this.previousAllowedElementIds&&(this.commentService.setAllowedElementIds(this.previousAllowedElementIds),this.previousAllowedElementIds=void 0),this.previousPersistentMode?this.commentService.enablePersistentCommentMode():this.previousPersistentMode===!1&&this.commentService.disablePersistentCommentMode(),this.previousPersistentMode=void 0,this.previousPersistentModeBanner?this.commentService.enablePersistentModeBanner():this.previousPersistentModeBanner===!1&&this.commentService.disablePersistentModeBanner(),this.previousPersistentModeBanner=void 0}catch(e){this.loggingService.catch("Error in VeltVideoPlayerComponent disableAddCommentMode: ",e)}})}onReactionAnnotationClick(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: onReactionAnnotationClick","color: green;"),this.videoRef?.nativeElement?.paused||(this.videoRef?.nativeElement.pause(),this.sync&&this.syncVideoPlayerService.updateVideoPlayerState(this.playerId,"pause",{playing:!1}));let t=this.videoRef?.nativeElement?.currentTime||0,o=e.location?.currentMediaPosition;if(t!==o)setTimeout(()=>{this.videoRef.nativeElement.currentTime=o,this.sync&&this.syncVideoPlayerService.updateVideoPlayerState(this.playerId,"timeupdate",{currentTime:o}),this.setLocation()},500);else{let a=this.getLocationOnCurrentTime();this.reactionService.addOrUpdateReaction(e.icon,[e.annotationId],a)}}catch(t){this.loggingService.catch("Error in VeltVideoPlayerComponent onReactionAnnotationClick: ",t)}}showControlPanel(){try{this.loggingService.log("%c[WB] Calling FUNCTION: showControlPanel","color: green;"),this.controlPanelVisible=!0}catch(e){this.loggingService.catch("Error in VeltVideoPlayerComponent showControlPanel: ",e)}}hideControlPanel(e=0){try{this.loggingService.log("%c[WB] Calling FUNCTION: hideControlPanel","color: green;"),this.hideControlPanelTimer&&clearTimeout(this.hideControlPanelTimer),this.hideControlPanelTimer=setTimeout(()=>{this.controlPanelVisible=!1},e)}catch(t){this.loggingService.catch("Error in VeltVideoPlayerComponent hideControlPanel: ",t)}}setTimerForHideControlPanel(){try{this.loggingService.log("%c[WB] Calling FUNCTION: setTimerForHideControlPanel","color: green;"),this.controlPanelVisible||this.showControlPanel(),this.hideControlPanel(this.HIDE_CONTROL_PANEL_DURATION)}catch(e){this.loggingService.catch("Error in VeltVideoPlayerComponent setTimerForHideControlPanel: ",e)}}toggleFullScreen(){try{this.loggingService.log("%c[WB] Calling FUNCTION: toggleFullScreen","color: green;"),this.fullScreen=!this.fullScreen}catch(e){this.loggingService.catch("Error in VeltVideoPlayerComponent toggleFullScreen: ",e)}}checkDarkMode(){try{this.loggingService.log("%c[WB] Calling FUNCTION: checkDarkMode","color: green;"),this._darkAttribute===""||this._darkAttribute==="true"?this.darkMode=!0:this.darkMode=!1,this.commentService.setCommentContainerDarkMode(this.darkMode)}catch(e){this.loggingService.catch("Error in CommentsContainerComponent checkDarkMode: ",e)}}getLocationOnCurrentTime(){try{this.loggingService.log("%c[WB] Calling FUNCTION: getLocationOnCurrentTime","color: green;");let e=Pde(this.videoRef?.nativeElement),t={videoPlayerId:this.playerId,currentMediaPosition:this.videoRef?.nativeElement?.currentTime,locationName:e?.timeSlot};return this.version&&(t.version={id:this.version?.id,name:this.version?.name}),t}catch(e){this.loggingService.catch("Error in VeltVideoPlayerComponent getLocationOnCurrentTime: ",e);return}}ngOnDestroy(){try{this.loggingService.log("%c[WB] Calling FUNCTION: ngOnDestroy","color: green;"),this.removeLocation(),this.onDisableAddCommentMode(),this.subscriptions.forEach(e=>{e.unsubscribe()})}catch(e){this.loggingService.catch("Error in VeltVideoPlayerComponent ngOnDestroy: ",e)}}};r.\u0275fac=function(t){return new(t||r)(C(Pe),C(lt),C(x),C(ra),C(axe),C(on))},r.\u0275cmp=O({type:r,selectors:[["app-velt-video-player"]],viewQuery:function(t,o){if(t&1&&(dt(ECn,5),dt(kCn,5),dt(TCn,5)),t&2){let a;ot(a=at())&&(o.videoRef=a.first),ot(a=at())&&(o.progressBarRef=a.first),ot(a=at())&&(o.ghostProgressBarRef=a.first)}},inputs:{src:"src",sync:"sync",_shadowDom:[0,"shadowDom","_shadowDom"],_version:[0,"version","_version"],isDarkMode:[0,"darkMode","isDarkMode"],commentTool:"commentTool"},standalone:!1,decls:55,vars:31,consts:[["videoRef",""],["progressBarRef",""],["ghostProgressBarRef",""],["playerTimelineRef",""],[1,"s-video-player-container",3,"pointerenter","pointermove","pointerleave","keyup","id"],["tabindex","0","data-velt-video-player","true",3,"click","keydown.space","keyup.space","keyup.arrowright","keyup.arrowleft","src"],["data-velt-comment-disabled","true",1,"s-video-control-panel"],[1,"s-video-control-panel__progress-bar",3,"click","pointermove","pointerout"],[1,"s-video-control-panel__progress-bar__filled"],[1,"s-video-control-panel__progress-bar__filled-ghost"],["class","s-video-control-panel__progress-bar__filled-ghost__tooltip",4,"ngIf"],[1,"s-video-control-panel__progress-bar__pins"],[4,"ngFor","ngForOf","ngForTrackBy"],[1,"s-video-control-panel__comment-player-timeline-container"],[3,"onCommentClick","onReactionClick","videoPlayerId","totalMediaLength","source","version","shadowDom"],[1,"s-video-control-panel__controls"],[1,"s-video-control-panel__controls_left"],[1,"control-btn-container","play-pause-btn-container"],["class","v-control-btn",3,"click",4,"ngIf"],[1,"s-video-control-panel__controls_center"],[1,"s-video-time-display"],[1,"s-video-time-display__current"],[1,"s-video-time-display__divider"],[1,"s-video-time-display__duration"],[1,"s-video-control-panel__controls_right"],[3,"emojiSelected","darkMode"],["slot","button",1,"v-control-btn"],["width","16","height","16","viewBox","0 0 16 16","fill","none","xmlns","http://www.w3.org/2000/svg",1,"v-control-btn-icon"],["d","M13.5825 8.01858C13.653 6.81971 13.3573 5.62775 12.7346 4.60086C12.1119 3.57397 11.1916 2.76069 10.096 2.26894C9.00036 1.77718 7.78109 1.6302 6.59998 1.84749C5.41886 2.06478 4.33173 2.63608 3.48284 3.48557C2.63395 4.33506 2.06343 5.4226 1.84698 6.60387C1.63052 7.78514 1.77837 9.0043 2.2709 10.0996C2.76343 11.1949 3.57737 12.1145 4.6047 12.7365C5.63203 13.3585 6.8242 13.6533 8.02302 13.582M10.3024 12.2766H14.25M12.2762 10.3028V14.2504M5.69693 6.35526H5.70351M9.6445 6.35526H9.65108M6.02589 9.6449C6.45881 10.066 7.05226 10.3028 7.67071 10.3028C8.28917 10.3028 8.88262 10.066 9.31554 9.6449","stroke","currentColor","stroke-width","1.11607","stroke-linecap","round","stroke-linejoin","round"],["d","M10.3856 6.39644C10.3856 6.83826 10.0275 7.19644 9.58564 7.19644C9.14382 7.19644 8.78564 6.83826 8.78564 6.39644C8.78564 5.95461 9.14382 5.59644 9.58564 5.59644C10.0275 5.59644 10.3856 5.95461 10.3856 6.39644Z","fill","currentColor"],["d","M6.39834 6.39644C6.39834 6.83826 6.04017 7.19644 5.59834 7.19644C5.15651 7.19644 4.79834 6.83826 4.79834 6.39644C4.79834 5.95461 5.15651 5.59644 5.59834 5.59644C6.04017 5.59644 6.39834 5.95461 6.39834 6.39644Z","fill","currentColor"],[3,"enableAddCommentMode",4,"ngIf"],[1,"control-btn-container","volume-btn-container"],[1,"volume-slider"],["type","range","min","0","max","1","step","0.01","orient","vertical",3,"change","value"],[1,"control-btn-container","video-speed-btn-container"],[1,"v-control-btn"],["width","16","height","16","viewBox","0 0 20 20","fill","none","xmlns","http://www.w3.org/2000/svg",1,"v-control-btn-icon"],["d","M9.99924 0C9.25917 0.00028487 8.52139 0.0821119 7.79924 0.244C7.55888 0.29763 7.34677 0.438067 7.20354 0.638401C7.06031 0.838734 6.99604 1.08487 7.02304 1.32966C7.05005 1.57444 7.16643 1.80065 7.34989 1.96495C7.53334 2.12924 7.77097 2.22006 8.01724 2.22C8.09095 2.22003 8.16443 2.21164 8.23624 2.195C9.3336 1.94818 10.4707 1.93553 11.5733 2.15788C12.6758 2.38023 13.7191 2.83258 14.6351 3.48541C15.551 4.13824 16.319 4.97688 16.8889 5.94659C17.4588 6.9163 17.8178 7.99529 17.9425 9.11313C18.0672 10.231 17.9547 11.3625 17.6125 12.434C17.2703 13.5055 16.706 14.4927 15.9564 15.3313C15.2069 16.1699 14.2889 16.8411 13.2624 17.3009C12.2359 17.7607 11.124 17.999 9.99924 18C9.40434 17.9986 8.81141 17.9316 8.23124 17.8C8.10281 17.7716 7.97005 17.7688 7.84053 17.7918C7.71102 17.8147 7.5873 17.863 7.47642 17.9337C7.36555 18.0045 7.2697 18.0964 7.19435 18.2042C7.11899 18.312 7.06561 18.4336 7.03724 18.562C7.00888 18.6904 7.00608 18.8232 7.02903 18.9527C7.05197 19.0822 7.1002 19.2059 7.17096 19.3168C7.24171 19.4277 7.33362 19.5235 7.44142 19.5989C7.54922 19.6742 7.67081 19.7276 7.79924 19.756C9.17115 20.0647 10.5928 20.0807 11.9712 19.8027C13.3497 19.5248 14.6541 18.9593 15.7992 18.143C16.9443 17.3268 17.9043 16.2782 18.6167 15.0658C19.3291 13.8534 19.7777 12.5043 19.9334 11.1067C20.089 9.70916 19.9481 8.29446 19.5199 6.95502C19.0917 5.61557 18.3858 4.38149 17.4484 3.33335C16.5109 2.28521 15.3629 1.44658 14.0793 0.872204C12.7957 0.297828 11.4055 0.000625613 9.99924 0Z","fill","currentColor"],["d","M1.91128 5.92553C2.02147 5.99788 2.14488 6.04773 2.2744 6.07222C2.40393 6.0967 2.53701 6.09534 2.66601 6.0682C2.795 6.04106 2.91736 5.98869 3.02604 5.91409C3.13472 5.8395 3.22758 5.74415 3.29928 5.63353C3.86099 4.76923 4.58503 4.0221 5.43128 3.43353C5.64876 3.28117 5.7968 3.04865 5.84284 2.78713C5.88888 2.52561 5.82915 2.25651 5.67678 2.03903C5.52441 1.82156 5.29189 1.67351 5.03038 1.62747C4.76886 1.58143 4.49976 1.64117 4.28228 1.79353C3.22591 2.52947 2.32168 3.46257 1.61928 4.54153C1.54756 4.65157 1.49821 4.77467 1.47407 4.90378C1.44993 5.0329 1.45146 5.1655 1.47857 5.29402C1.50569 5.42255 1.55786 5.54447 1.6321 5.65282C1.70635 5.76118 1.80121 5.85385 1.91128 5.92553Z","fill","currentColor"],["d","M2.146 11.5359C2.04912 11.0296 2.00023 10.5153 2 9.99989C2.00002 9.48641 2.04891 8.9741 2.146 8.46989C2.17089 8.34093 2.17013 8.20834 2.14377 8.07967C2.11741 7.95101 2.06597 7.82879 1.99238 7.72001C1.91879 7.61122 1.82449 7.518 1.71487 7.44566C1.60525 7.37332 1.48246 7.32328 1.3535 7.29839C1.22454 7.27351 1.09195 7.27426 0.96328 7.30062C0.834615 7.32698 0.712402 7.37842 0.603618 7.45202C0.494834 7.52561 0.40161 7.6199 0.329269 7.72952C0.256928 7.83914 0.206886 7.96193 0.182 8.09089C0.0614418 8.72009 0.000505335 9.35925 2.88948e-07 9.99989C-0.000153976 10.6433 0.061462 11.2853 0.184 11.9169C0.228069 12.1446 0.349922 12.3499 0.5287 12.4977C0.707478 12.6455 0.932061 12.7265 1.164 12.7269C1.22814 12.727 1.29214 12.7206 1.355 12.7079C1.61529 12.6573 1.84483 12.5055 1.99317 12.2857C2.1415 12.0659 2.19647 11.7962 2.146 11.5359Z","fill","currentColor"],["d","M3.30023 14.3698C3.22936 14.2577 3.13693 14.1609 3.02829 14.0849C2.91966 14.0089 2.797 13.9553 2.66745 13.9271C2.5379 13.899 2.40404 13.8968 2.27366 13.9209C2.14329 13.9449 2.019 13.9947 1.90802 14.0672C1.79704 14.1397 1.70159 14.2336 1.62722 14.3434C1.55286 14.4531 1.50105 14.5766 1.47483 14.7065C1.44861 14.8365 1.44849 14.9703 1.47448 15.1003C1.50047 15.2303 1.55206 15.3539 1.62623 15.4638C2.32899 16.5416 3.23279 17.4739 4.28823 18.2098C4.50584 18.3616 4.77485 18.4208 5.03609 18.3743C5.29733 18.3278 5.52939 18.1794 5.68123 17.9618C5.83307 17.7442 5.89224 17.4751 5.84573 17.2139C5.79922 16.9527 5.65084 16.7206 5.43323 16.5688C4.58711 15.9801 3.86281 15.2334 3.30023 14.3698Z","fill","currentColor"],["d","M7.528 14.8821C7.68767 14.9676 7.86754 15.0081 8.04842 14.9993C8.22929 14.9904 8.40439 14.9327 8.555 14.8322L14.555 10.8321C14.692 10.7408 14.8043 10.6171 14.8819 10.472C14.9596 10.3268 15.0002 10.1648 15.0002 10.0001C15.0002 9.83554 14.9596 9.67347 14.8819 9.52833C14.8043 9.38319 14.692 9.25947 14.555 9.16815L8.555 5.16815C8.4044 5.06767 8.22935 5.00996 8.04852 5.00118C7.86769 4.99239 7.68786 5.03287 7.52823 5.11828C7.3686 5.20369 7.23516 5.33083 7.14213 5.48614C7.04909 5.64145 6.99997 5.81911 7 6.00015V14.0001C6.99993 14.1812 7.049 14.3589 7.14199 14.5142C7.23498 14.6695 7.36839 14.7967 7.528 14.8821Z","fill","currentColor"],[1,"video-speed-options"],["class","video-speed-option",3,"selected","click",4,"ngFor","ngForOf"],[1,"control-btn-container"],[1,"s-video-control-panel__progress-bar__filled-ghost__tooltip"],[1,"s-video-control-panel__progress-bar__pin"],[1,"s-video-control-panel__progress-bar__pin","reaction-pin"],[1,"v-control-btn",3,"click"],["d","M4 2.66685V13.3335C3.99997 13.4521 4.03158 13.5686 4.09159 13.6709C4.15159 13.7733 4.23781 13.8577 4.34135 13.9156C4.44489 13.9735 4.562 14.0027 4.68059 14.0002C4.79918 13.9978 4.91497 13.9637 5.016 13.9015L13.6827 8.56819C13.7797 8.50854 13.8599 8.42502 13.9155 8.32558C13.9711 8.22614 14.0003 8.11412 14.0003 8.00019C14.0003 7.88626 13.9711 7.77423 13.9155 7.6748C13.8599 7.57536 13.7797 7.49183 13.6827 7.43219L5.016 2.09885C4.91497 2.0367 4.79918 2.00262 4.68059 2.00015C4.562 1.99767 4.44489 2.02688 4.34135 2.08476C4.23781 2.14265 4.15159 2.22711 4.09159 2.32943C4.03158 2.43175 3.99997 2.54823 4 2.66685Z","fill","currentColor"],["d","M1.3335 2.66665C1.3335 1.93027 1.93045 1.33331 2.66683 1.33331H5.3335C6.06988 1.33331 6.66683 1.93027 6.66683 2.66665V13.3333C6.66683 14.0697 6.06988 14.6666 5.3335 14.6666H2.66683C1.93045 14.6666 1.3335 14.0697 1.3335 13.3333V2.66665Z","fill","currentColor"],["d","M9.33325 2.66665C9.33325 1.93027 9.93021 1.33331 10.6666 1.33331H13.3333C14.0696 1.33331 14.6666 1.93027 14.6666 2.66665V13.3333C14.6666 14.0697 14.0696 14.6666 13.3333 14.6666H10.6666C9.93021 14.6666 9.33325 14.0697 9.33325 13.3333V2.66665Z","fill","currentColor"],[3,"enableAddCommentMode"],["id","path-1-inside-1_21881_357012","fill","currentColor"],["d","M1.86816 8.00004C1.86816 4.61343 4.61355 1.86804 8.00016 1.86804C11.3868 1.86804 14.1322 4.61343 14.1322 8.00004C14.1322 11.3867 11.3868 14.132 8.00016 14.132H2.89016C2.32573 14.132 1.86816 13.6745 1.86816 13.11V8.00004Z"],["d","M1.86816 8.00004C1.86816 4.61343 4.61355 1.86804 8.00016 1.86804C11.3868 1.86804 14.1322 4.61343 14.1322 8.00004C14.1322 11.3867 11.3868 14.132 8.00016 14.132H2.89016C2.32573 14.132 1.86816 13.6745 1.86816 13.11V8.00004Z","stroke","currentColor","stroke-width","2.2995","mask","url(#path-1-inside-1_21881_357012)"],["d","M10 5.33325C10.414 5.64374 10.75 6.04636 10.9814 6.50921C11.2129 6.97206 11.3333 7.48243 11.3333 7.99992C11.3333 8.5174 11.2129 9.02778 10.9814 9.49063C10.75 9.95348 10.414 10.3561 10 10.6666M11.8 3.33325C12.4959 3.89569 13.0573 4.60667 13.4429 5.41413C13.8286 6.2216 14.0287 7.10509 14.0287 7.99992C14.0287 8.89474 13.8286 9.77824 13.4429 10.5857C13.0573 11.3932 12.4959 12.1042 11.8 12.6666M4 9.9999H2.66667C2.48986 9.9999 2.32029 9.92966 2.19526 9.80464C2.07024 9.67961 2 9.51004 2 9.33323V6.66657C2 6.48976 2.07024 6.32019 2.19526 6.19516C2.32029 6.07014 2.48986 5.9999 2.66667 5.9999H4L6.33333 2.9999C6.3916 2.88672 6.48843 2.79812 6.60633 2.7501C6.72422 2.70207 6.8554 2.69781 6.97617 2.73806C7.09693 2.77832 7.19932 2.86044 7.26482 2.96959C7.33032 3.07875 7.35463 3.20773 7.33333 3.33323V12.6666C7.35463 12.7921 7.33032 12.9211 7.26482 13.0302C7.19932 13.1394 7.09693 13.2215 6.97617 13.2617C6.8554 13.302 6.72422 13.2977 6.60633 13.2497C6.48843 13.2017 6.3916 13.1131 6.33333 12.9999L4 9.9999Z","stroke","currentColor","stroke-linecap","round","stroke-linejoin","round"],["d","M4 9.9999H2.66667C2.48986 9.9999 2.32029 9.92966 2.19526 9.80464C2.07024 9.67961 2 9.51004 2 9.33323V6.66657C2 6.48976 2.07024 6.32019 2.19526 6.19516C2.32029 6.07014 2.48986 5.9999 2.66667 5.9999H4L6.33333 2.9999C6.3916 2.88672 6.48843 2.79812 6.60633 2.7501C6.72422 2.70207 6.8554 2.69781 6.97617 2.73806C7.09693 2.77832 7.19932 2.86044 7.26482 2.96959C7.33033 3.07875 7.35463 3.20773 7.33333 3.33323V12.6666C7.35463 12.7921 7.33033 12.9211 7.26482 13.0302C7.19932 13.1394 7.09693 13.2215 6.97617 13.2617C6.8554 13.302 6.72422 13.2977 6.60633 13.2497C6.48843 13.2017 6.3916 13.1131 6.33333 12.9999L4 9.9999Z","fill","currentColor"],["d","M10.9412 6.2707L14 9.14959M14 6.2707L10.9412 9.14959M3.29412 9.86932H1.76471C1.56189 9.86932 1.36739 9.79349 1.22398 9.65851C1.08057 9.52354 1 9.34048 1 9.14959V6.2707C1 6.07982 1.08057 5.89675 1.22398 5.76178C1.36739 5.62681 1.56189 5.55098 1.76471 5.55098H3.29412L5.97059 2.31222C6.03743 2.19004 6.1485 2.09438 6.28373 2.04254C6.41896 1.9907 6.56943 1.98609 6.70796 2.02955C6.84648 2.07301 6.96392 2.16167 7.03906 2.27951C7.1142 2.39734 7.14207 2.53659 7.11765 2.67209V12.7482C7.14207 12.8837 7.1142 13.023 7.03906 13.1408C6.96392 13.2586 6.84648 13.3473 6.70796 13.3907C6.56943 13.4342 6.41896 13.4296 6.28373 13.3778C6.1485 13.3259 6.03743 13.2303 5.97059 13.1081L3.29412 9.86932Z","stroke","currentColor","stroke-width","1.25","stroke-linecap","round","stroke-linejoin","round"],[1,"video-speed-option",3,"click"],["width","16","height","16","viewBox","0 0 24 24","fill","none","xmlns","http://www.w3.org/2000/svg",1,"v-control-btn-icon"],["d","M3 9C3.55228 9 4 8.55228 4 8V5C4 4.44772 4.44772 4 5 4H8C8.55228 4 9 3.55228 9 3C9 2.44772 8.55228 2 8 2H5C3.34315 2 2 3.34315 2 5V8C2 8.55228 2.44772 9 3 9Z","fill","currentColor"],["d","M4 16C4 15.4477 3.55228 15 3 15C2.44772 15 2 15.4477 2 16V19C2 20.6569 3.34315 22 5 22H8C8.55228 22 9 21.5523 9 21C9 20.4477 8.55228 20 8 20H5C4.44772 20 4 19.5523 4 19V16Z","fill","currentColor"],["d","M20 16C20 15.4477 20.4477 15 21 15C21.5523 15 22 15.4477 22 16V19C22 20.6569 20.6569 22 19 22H16C15.4477 22 15 21.5523 15 21C15 20.4477 15.4477 20 16 20H19C19.5523 20 20 19.5523 20 19V16Z","fill","currentColor"],["d","M20 8C20 8.55228 20.4477 9 21 9C21.5523 9 22 8.55228 22 8V5C22 3.34315 20.6569 2 19 2H16C15.4477 2 15 2.44772 15 3C15 3.55228 15.4477 4 16 4H19C19.5523 4 20 4.44772 20 5V8Z","fill","currentColor"],["d","M8 2C7.44772 2 7 2.44772 7 3L7 6C7 6.55228 6.55228 7 6 7L3 7C2.44772 7 2 7.44771 2 8C2 8.55228 2.44772 9 3 9L6 9C7.65685 9 9 7.65685 9 6L9 3C9 2.44772 8.55229 2 8 2Z","fill","currentColor"],["d","M7 21C7 21.5523 7.44772 22 8 22C8.55229 22 9 21.5523 9 21L9 18C9 16.3431 7.65685 15 6 15L3 15C2.44772 15 2 15.4477 2 16C2 16.5523 2.44772 17 3 17L6 17C6.55228 17 7 17.4477 7 18L7 21Z","fill","currentColor"],["d","M17 21C17 21.5523 16.5523 22 16 22C15.4477 22 15 21.5523 15 21L15 18C15 16.3431 16.3431 15 18 15H21C21.5523 15 22 15.4477 22 16C22 16.5523 21.5523 17 21 17H18C17.4477 17 17 17.4477 17 18L17 21Z","fill","currentColor"],["d","M17 3C17 2.44772 16.5523 2 16 2C15.4477 2 15 2.44772 15 3V6C15 7.65685 16.3431 9 18 9H21C21.5523 9 22 8.55228 22 8C22 7.44772 21.5523 7 21 7H18C17.4477 7 17 6.55228 17 6V3Z","fill","currentColor"]],template:function(t,o){if(t&1){let a=K();_(0,"div",4),G("pointerenter",function(){return N(a),F(o.showControlPanel())})("pointermove",function(){return N(a),F(o.setTimerForHideControlPanel())})("pointerleave",function(){return N(a),F(o.hideControlPanel(o.HIDE_CONTROL_PANEL_DURATION))})("keyup",function(){return N(a),F(o.setTimerForHideControlPanel())}),_(1,"video",5,0),G("click",function(){N(a);let s=Ce(2);return F(s!=null&&s.paused?o.playVideo():o.pauseVideo())})("keydown.space",function(s){return N(a),s.stopPropagation(),F(s.preventDefault())})("keyup.space",function(){return N(a),F(o.toggleVideo())})("keyup.arrowright",function(){return N(a),F(o.moveForwardVideo())})("keyup.arrowleft",function(){return N(a),F(o.moveBackwardVideo())}),y(),_(3,"div",6)(4,"div",7,1),G("click",function(s){return N(a),F(o.onProgressBarClick(s))})("pointermove",function(s){return N(a),F(o.onProgressBarPointerOver(s))})("pointerout",function(s){return N(a),F(o.onProgressBarPointerOut(s))}),D(6,"div",8),_(7,"div",9,2),p(9,wCn,2,1,"div",10),y(),_(10,"div",11),p(11,DCn,2,4,"ng-container",12)(12,OCn,2,2,"ng-container",12),y(),_(13,"div",13)(14,"velt-comment-player-timeline-internal",14,3),G("onCommentClick",function(s){return N(a),F(o.onCommentAnnotationClick(s))})("onReactionClick",function(s){return N(a),F(o.onReactionAnnotationClick(s==null?null:s.annotation))}),y()()(),_(16,"div",15)(17,"div",16)(18,"div",17),p(19,ACn,3,0,"button",18)(20,PCn,4,0,"button",18),y()(),_(21,"div",19)(22,"div",20)(23,"div",21),ne(24),y(),_(25,"div",22),ne(26,"/"),y(),_(27,"div",23),ne(28),y()()(),_(29,"div",24)(30,"app-reaction-tool",25),G("emojiSelected",function(s){return N(a),F(o.addReaction(s))}),_(31,"button",26),de(),_(32,"svg",27),D(33,"path",28)(34,"path",29)(35,"path",30),y()()(),p(36,MCn,6,2,"velt-comment-tool",31),bt(),_(37,"div",32),p(38,RCn,4,0,"button",18)(39,NCn,3,0,"button",18),_(40,"div",33)(41,"input",34),G("change",function(s){return N(a),F(o.changeVolumeVideo(s))}),y()()(),_(42,"div",35)(43,"button",36),de(),_(44,"svg",37),D(45,"path",38)(46,"path",39)(47,"path",40)(48,"path",41)(49,"path",42),y()(),bt(),_(50,"div",43),p(51,FCn,2,5,"div",44),y()(),_(52,"div",45),p(53,LCn,6,0,"button",18)(54,UCn,6,0,"button",18),y()()()()()}if(t&2){let a=Ce(2),l=Ce(15);ve("full-screen",o.fullScreen),g("id",o.playerId),m(),g("src",o.src,pn),T("data-sync-video-player",o.sync?!0:void 0),m(2),ve("hidden",!o.controlPanelVisible||o.addCommentMode),m(3),ct("width",o.currentTime*100/(o.duration||1),"%"),m(3),g("ngIf",o.hoveredTimeFormatted),m(2),g("ngForOf",l==null?null:l.commentAnnotationsWithPosition)("ngForTrackBy",o.trackByFn),m(),g("ngForOf",l==null?null:l.reactionAnnotationsWithPosition)("ngForTrackBy",o.trackByFn),m(2),g("videoPlayerId",o.playerId)("totalMediaLength",o.duration)("source","video")("version",o.version)("shadowDom",o.shadowDom),m(5),g("ngIf",a==null?null:a.paused),m(),g("ngIf",!(a!=null&&a.paused)),m(4),Ke(o.currentTimeFormatted),m(4),Ke(o.durationFormatted),m(2),g("darkMode",o.darkMode),m(6),g("ngIf",o.showCommentTool),m(2),g("ngIf",!(a!=null&&a.muted)),m(),g("ngIf",a==null?null:a.muted),m(2),g("value",a!=null&&a.muted?0:a==null?null:a.volume),m(10),g("ngForOf",o.VIDEO_SPEED_OPTIONS),m(2),g("ngIf",!o.fullScreen),m(),g("ngIf",o.fullScreen)}},dependencies:[Vt,se,EN,Jy],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}.s-video-player-container[_ngcontent-%COMP%]{height:100%;width:100%;position:relative;display:flex;overflow:hidden;border-radius:calc((.5rem + 0px) * var(--velt-base-rem-unit));background-color:#000;flex-direction:column}.s-video-player-container[_ngcontent-%COMP%] video[_ngcontent-%COMP%]{height:calc(100% - 100px);width:100%}.s-video-player-container[_ngcontent-%COMP%]:hover .s-video-control-panel[_ngcontent-%COMP%]{opacity:1}.s-video-player-container.full-screen[_ngcontent-%COMP%]{position:fixed;inset:0;background:#000;z-index:10000000;border-radius:0}.s-video-player-container[_ngcontent-%COMP%] .s-video-control-panel[_ngcontent-%COMP%]{width:100%;height:100px;align-items:center;justify-content:flex-end;display:flex;flex-direction:column;transition:opacity .3s ease-in-out}.s-video-player-container[_ngcontent-%COMP%] .s-video-control-panel.hidden[_ngcontent-%COMP%] .s-video-control-panel__controls[_ngcontent-%COMP%]{height:0px;opacity:0;padding:0;transform:translateY(calc((3.5rem + 0px) * var(--velt-base-rem-unit)))}.s-video-player-container[_ngcontent-%COMP%] .s-video-control-panel.hidden[_ngcontent-%COMP%] velt-comment-player-timeline-internal[_ngcontent-%COMP%]{opacity:.3}.s-video-player-container[_ngcontent-%COMP%] .s-video-control-panel[_ngcontent-%COMP%] .s-video-control-panel__controls[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;width:100%;height:calc((3.5rem + 0px) * var(--velt-base-rem-unit));color:#fff;transition:all .5s ease-in-out;padding:calc((.5rem + 0px) * var(--velt-base-rem-unit))}.s-video-player-container[_ngcontent-%COMP%] .s-video-control-panel[_ngcontent-%COMP%] .s-video-control-panel__controls[_ngcontent-%COMP%] .s-video-control-panel__controls_left[_ngcontent-%COMP%], .s-video-player-container[_ngcontent-%COMP%] .s-video-control-panel[_ngcontent-%COMP%] .s-video-control-panel__controls[_ngcontent-%COMP%] .s-video-control-panel__controls_center[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:calc((1rem + 0px) * var(--velt-base-rem-unit))}.s-video-player-container[_ngcontent-%COMP%] .s-video-control-panel[_ngcontent-%COMP%] .s-video-control-panel__controls[_ngcontent-%COMP%] .s-video-control-panel__controls_center[_ngcontent-%COMP%] .s-video-time-display[_ngcontent-%COMP%]{color:#fff;font-size:15px;font-style:normal;font-weight:500;line-height:140%;display:flex;gap:8px}.s-video-player-container[_ngcontent-%COMP%] .s-video-control-panel[_ngcontent-%COMP%] .s-video-control-panel__controls[_ngcontent-%COMP%] .s-video-control-panel__controls_center[_ngcontent-%COMP%] .s-video-time-display[_ngcontent-%COMP%] .s-video-time-display__current[_ngcontent-%COMP%]{min-width:44px;color:#fff;text-align:right}.s-video-player-container[_ngcontent-%COMP%] .s-video-control-panel[_ngcontent-%COMP%] .s-video-control-panel__controls[_ngcontent-%COMP%] .s-video-control-panel__controls_center[_ngcontent-%COMP%] .s-video-time-display[_ngcontent-%COMP%] .s-video-time-display__divider[_ngcontent-%COMP%], .s-video-player-container[_ngcontent-%COMP%] .s-video-control-panel[_ngcontent-%COMP%] .s-video-control-panel__controls[_ngcontent-%COMP%] .s-video-control-panel__controls_center[_ngcontent-%COMP%] .s-video-time-display[_ngcontent-%COMP%] .s-video-time-display__duration[_ngcontent-%COMP%]{opacity:.5}.s-video-player-container[_ngcontent-%COMP%] .s-video-control-panel[_ngcontent-%COMP%] .s-video-control-panel__controls[_ngcontent-%COMP%] .s-video-control-panel__controls_right[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between}.s-video-player-container[_ngcontent-%COMP%] .s-video-control-panel[_ngcontent-%COMP%] .s-video-control-panel__controls[_ngcontent-%COMP%] velt-comment-tool[_ngcontent-%COMP%]{display:flex}.s-video-player-container[_ngcontent-%COMP%] .s-video-control-panel[_ngcontent-%COMP%] .s-video-control-panel__controls[_ngcontent-%COMP%] .s-control-btn[_ngcontent-%COMP%]{cursor:pointer}.s-video-player-container[_ngcontent-%COMP%] .s-video-control-panel[_ngcontent-%COMP%] .s-video-control-panel__controls[_ngcontent-%COMP%] .volume-btn-container[_ngcontent-%COMP%]{position:relative}.s-video-player-container[_ngcontent-%COMP%] .s-video-control-panel[_ngcontent-%COMP%] .s-video-control-panel__controls[_ngcontent-%COMP%] .volume-btn-container[_ngcontent-%COMP%]:hover .volume-slider[_ngcontent-%COMP%]{display:block}.s-video-player-container[_ngcontent-%COMP%] .s-video-control-panel[_ngcontent-%COMP%] .s-video-control-panel__controls[_ngcontent-%COMP%] .volume-btn-container[_ngcontent-%COMP%] .volume-slider[_ngcontent-%COMP%]{position:absolute;bottom:90%;left:50%;transform:translate(-50%);display:none}.s-video-player-container[_ngcontent-%COMP%] .s-video-control-panel[_ngcontent-%COMP%] .s-video-control-panel__controls[_ngcontent-%COMP%] .volume-btn-container[_ngcontent-%COMP%] .volume-slider[_ngcontent-%COMP%] input[type=range][_ngcontent-%COMP%]{width:calc((4rem + 0px) * var(--velt-base-rem-unit));background:#ccc;outline:none;cursor:pointer;border-radius:5px}.s-video-player-container[_ngcontent-%COMP%] .s-video-control-panel[_ngcontent-%COMP%] .s-video-control-panel__controls[_ngcontent-%COMP%] .video-speed-btn-container[_ngcontent-%COMP%]{position:relative}.s-video-player-container[_ngcontent-%COMP%] .s-video-control-panel[_ngcontent-%COMP%] .s-video-control-panel__controls[_ngcontent-%COMP%] .video-speed-btn-container[_ngcontent-%COMP%]:hover .video-speed-options[_ngcontent-%COMP%]{display:flex}.s-video-player-container[_ngcontent-%COMP%] .s-video-control-panel[_ngcontent-%COMP%] .s-video-control-panel__controls[_ngcontent-%COMP%] .video-speed-btn-container[_ngcontent-%COMP%] .video-speed-options[_ngcontent-%COMP%]{position:absolute;bottom:90%;background:var(--legacy-velt-bg-dark-color);padding:1rem;left:50%;transform:translate(-50%);border-radius:16px;display:flex;flex-direction:column;font-size:12px;display:none}.s-video-player-container[_ngcontent-%COMP%] .s-video-control-panel[_ngcontent-%COMP%] .s-video-control-panel__controls[_ngcontent-%COMP%] .video-speed-btn-container[_ngcontent-%COMP%] .video-speed-options[_ngcontent-%COMP%] .video-speed-option[_ngcontent-%COMP%]{cursor:pointer;padding:.5rem;border-radius:8px;transition:.3s ease-in-out}.s-video-player-container[_ngcontent-%COMP%] .s-video-control-panel[_ngcontent-%COMP%] .s-video-control-panel__controls[_ngcontent-%COMP%] .video-speed-btn-container[_ngcontent-%COMP%] .video-speed-options[_ngcontent-%COMP%] .video-speed-option[_ngcontent-%COMP%]:hover, .s-video-player-container[_ngcontent-%COMP%] .s-video-control-panel[_ngcontent-%COMP%] .s-video-control-panel__controls[_ngcontent-%COMP%] .video-speed-btn-container[_ngcontent-%COMP%] .video-speed-options[_ngcontent-%COMP%] .video-speed-option.selected[_ngcontent-%COMP%]{color:var(--primary-6, #625DF5)}.s-video-player-container[_ngcontent-%COMP%] .s-video-control-panel[_ngcontent-%COMP%] .s-video-control-panel_progress-bar[_ngcontent-%COMP%]{width:100%;height:4px;background-color:#ffffff80;position:relative;margin:0 10px}.s-video-player-container[_ngcontent-%COMP%] .s-video-control-panel[_ngcontent-%COMP%] .s-video-control-panel_progress-bar[_ngcontent-%COMP%] .s-video-control-panel_progress-bar__current[_ngcontent-%COMP%]{position:absolute;top:0;left:0;height:100%;background-color:#fff}.s-video-player-container[_ngcontent-%COMP%] .s-video-control-panel[_ngcontent-%COMP%] .s-video-control-panel__progress-bar[_ngcontent-%COMP%]{width:100%;position:relative;margin-top:calc((1rem + 0px) * var(--velt-base-rem-unit));background:#ffffff54;cursor:pointer;--v-video-progress-bar-height: 4px;transition:height .2s ease-in-out}.s-video-player-container[_ngcontent-%COMP%] .s-video-control-panel[_ngcontent-%COMP%] .s-video-control-panel__progress-bar[_ngcontent-%COMP%] input[_ngcontent-%COMP%]{width:100%}.s-video-player-container[_ngcontent-%COMP%] .s-video-control-panel[_ngcontent-%COMP%] .s-video-control-panel__progress-bar[_ngcontent-%COMP%] .s-video-control-panel__progress-bar__pin[_ngcontent-%COMP%]{position:absolute;top:0;height:100%;width:1px;background-color:#00f}.s-video-player-container[_ngcontent-%COMP%] .s-video-control-panel[_ngcontent-%COMP%] .s-video-control-panel__progress-bar[_ngcontent-%COMP%] .s-video-control-panel__progress-bar__pin.reaction-pin[_ngcontent-%COMP%]{background:#f1f1f1}.s-video-player-container[_ngcontent-%COMP%] .s-video-control-panel[_ngcontent-%COMP%] .s-video-control-panel__progress-bar[_ngcontent-%COMP%]:hover{--v-video-progress-bar-height: 8px}.s-video-player-container[_ngcontent-%COMP%] .s-video-control-panel[_ngcontent-%COMP%] .s-video-control-panel__comment-player-timeline-container[_ngcontent-%COMP%]{position:absolute;width:100%;bottom:100%;left:2px}.s-video-control-panel__progress-bar__filled[_ngcontent-%COMP%]{height:var(--v-video-progress-bar-height, 4px);left:0;top:0;background:var(--primary-6, #625DF5);-webkit-user-select:none;user-select:none;pointer-events:none;transition:height .2s ease-in-out}.s-video-control-panel__progress-bar__filled-ghost[_ngcontent-%COMP%]{height:var(--v-video-progress-bar-height, 4px);left:0;top:0;background:var(--primary-6, rgba(98, 93, 245, .5333333333));-webkit-user-select:none;user-select:none;pointer-events:none;position:absolute;z-index:1;transition:height .2s ease-in-out}.s-video-control-panel__progress-bar__filled-ghost[_ngcontent-%COMP%] .s-video-control-panel__progress-bar__filled-ghost__tooltip[_ngcontent-%COMP%]{position:absolute;top:-28px;background:var(--legacy-velt-bg-dark-color);font-size:10px;right:0;transform:translate(50%);border-radius:4px;padding:2px 6px;color:var(--legacy-velt-primary-dark-color)}.comment-tool-icon[_ngcontent-%COMP%], .reaction-tool-icon[_ngcontent-%COMP%]{color:var(--legacy-velt-comment-tool-icon-color)!important;cursor:pointer;transition:.5s ease-in-out}app-reaction-tool.reaction-tool-active[_ngcontent-%COMP%] .reaction-tool-icon[_ngcontent-%COMP%]{fill:#fff!important;background:#625df5!important}velt-comment-tool[_ngcontent-%COMP%]{--legacy-velt-tool-icon-color: white !important}.s-video-control-comment-tool-container[_ngcontent-%COMP%]{position:absolute!important;bottom:calc((1rem + 0px) * var(--velt-base-rem-unit))!important;right:calc((1rem + 0px) * var(--velt-base-rem-unit))!important}.v-control-btn[_ngcontent-%COMP%]{cursor:pointer;color:#fff;display:inline-flex;align-items:center;justify-content:center;background:transparent;border:0;outline:0;width:40px;height:40px;border-radius:50%}.v-control-btn[_ngcontent-%COMP%]:hover, .v-control-btn[_ngcontent-%COMP%]:active, .v-control-btn.active[_ngcontent-%COMP%]{background-color:#625df5;-webkit-backdrop-filter:blur(16px);backdrop-filter:blur(16px)}app-reaction-tool.reaction-tool-active[_ngcontent-%COMP%] .v-control-btn[_ngcontent-%COMP%]{background-color:#625df5;-webkit-backdrop-filter:blur(16px);backdrop-filter:blur(16px)}"],changeDetection:0});let n=r;return n})();var mK=(()=>{let r=class r{transform(e,...t){return typeof e=="number"&&!isNaN(e)?e<1024?e+" bytes":e<1024*1024?(e/1024).toFixed(2)+" KB":e<1024*1024*1024?(e/1024/1024).toFixed(2)+" MB":(e/1024/1024/1024).toFixed(2)+" GB":e}};r.\u0275fac=function(t){return new(t||r)},r.\u0275pipe=or({name:"fileSize",type:r,pure:!0,standalone:!1});let n=r;return n})();function BCn(n,r){if(n&1&&(h(0),_(1,"div",21)(2,"div",22),D(3,"snippyly-user-avatar",23),y(),_(4,"div",24)(5,"div",25),ne(6),M(7,"translate"),y()(),_(8,"div",26),ne(9),M(10,"timeAgo"),y()(),f()),n&2){let i=r.$implicit;m(3),g("user",i==null?null:i.user)("size",32),m(3),Ee(" ",R(7,4,(i==null||i.user==null?null:i.user.name)||(i==null||i.user==null?null:i.user.email))," "),m(3),Ee(" ",R(10,6,i==null?null:i.timestamp)," ")}}function VCn(n,r){if(n&1&&(_(0,"div",19),p(1,BCn,11,8,"ng-container",20),y()),n&2){let i=c(2).ngIf;m(),g("ngForOf",i.userViews)}}function jCn(n,r){if(n&1){let i=K();h(0),_(1,"div",4)(2,"button",5),G("click",function(){N(i);let t=c(2);return F(t.closeTrendDialog())}),de(),_(3,"svg",6),D(4,"path",7),y(),bt(),_(5,"span"),ne(6),M(7,"translate"),y()()(),_(8,"div",8)(9,"div",9)(10,"div",10),ne(11),y(),_(12,"div",11),de(),_(13,"svg",12),D(14,"path",13)(15,"path",14),y(),bt(),_(16,"span"),ne(17),M(18,"translate"),y()()(),_(19,"div",15)(20,"div",16),ne(21),y(),_(22,"div",17)(23,"span"),ne(24),M(25,"translate"),y()()()(),p(26,VCn,2,1,"div",18),f()}if(n&2){let i=c().ngIf;m(6),Ke(R(7,6,"Go Back")),m(5),Ee(" ",i.totalUniqueViewsCount," "),m(6),Ke(R(18,8,"Total Views")),m(4),Ee(" ",i.todayViewsCount," "),m(3),Ke(R(25,10,"Views Today")),m(2),g("ngIf",i.userViews==null?null:i.userViews.length)}}function $Cn(n,r){if(n&1&&(h(0),_(1,"div",21)(2,"div",22),D(3,"snippyly-user-avatar",23),y(),_(4,"div",24)(5,"div",25),ne(6),M(7,"translate"),y(),_(8,"div",26),ne(9),M(10,"timeAgo"),y()()(),f()),n&2){let i=r.$implicit;m(3),g("user",i==null?null:i.user)("size",32),m(3),Ee(" ",R(7,4,(i==null||i.user==null?null:i.user.name)||(i==null||i.user==null?null:i.user.email))," "),m(3),Ee(" ",R(10,6,i==null?null:i.timestamp)," ")}}function HCn(n,r){if(n&1&&(_(0,"div",29)(1,"div",19),p(2,$Cn,11,8,"ng-container",20),y()()),n&2){let i=c(2).ngIf;m(2),g("ngForOf",i.userViews)}}function zCn(n,r){if(n&1&&(_(0,"div",27)(1,"div",9)(2,"div",10),ne(3),y(),_(4,"div",11),de(),_(5,"svg",12),D(6,"path",13)(7,"path",14),y(),bt(),_(8,"span"),ne(9),M(10,"translate"),y()()(),_(11,"div",15),ne(12),M(13,"translate"),M(14,"translate"),M(15,"translate"),y()(),p(16,HCn,3,1,"div",28)),n&2){let i=c().ngIf;m(3),Ee(" ",i.totalUniqueViewsCount," "),m(6),Ke(R(10,6,"Total Views")),m(3),lC(" ",i.todayViewsCount," ",i.todayViewsCount===1?R(13,8,"View"):R(14,10,"Views")," ",R(15,12,"Today")," "),m(4),g("ngIf",i.userViews==null?null:i.userViews.length)}}function GCn(n,r){if(n&1){let i=K();h(0),_(1,"div",2),G("clickOutside",function(){N(i);let t=c();return F(t.closeTrendDialog())}),p(2,jCn,27,12,"ng-container",3)(3,zCn,17,14,"ng-template",null,0,Me),y(),f()}if(n&2){let i=r.ngIf,e=Ce(4);m(),ve("bottom-sheet",i.bottomSheetMode),m(),g("ngIf",i.bottomSheetMode)("ngIfElse",e)}}var kN=(()=>{let r=class r{constructor(e,t,o,a,l,s){this.contactService=e,this.loggingService=t,this.viewsService=o,this.themeService=a,this.elementRef=l,this.bottomSheetData=s,this.close=new Fe,this.componentConfigSignal=Oe({today:new Date().toISOString().split("T")[0],todayViews:{},todayViewsCount:0,totalUniqueViews:{},totalUniqueViewsCount:0,views:{},usersMap:{},userViews:[],bottomSheetMode:!1}),this.subscriptions=[];try{s&&(this.componentConfigSignal.update(d=>(d=E(b({},d),{bottomSheetMode:!0}),d)),this.clientLocationId=s.clientLocationId,this.closeBottomSheetFn=s.closeBottomSheetFn),this.subscriptions.push(this.contactService.getUsersMap$().subscribe(d=>{this.componentConfigSignal.update(v=>(v=E(b({},v),{usersMap:d||{}}),v)),this.setLatestViewsByUsers()},d=>{this.loggingService.catch("Error in ViewAnalyticsDialogComponent getUsersMap$ subscription: ",d)})),this.subscriptions.push(this.themeService.getDarkMode$().subscribe(d=>{d?this.elementRef.nativeElement.setAttribute("dark",""):this.elementRef.nativeElement.removeAttribute("dark")}))}catch(d){this.loggingService.catch("Error in ViewAnalyticsDialogComponent constructor: ",d)}}ngOnInit(){this.getDocumentViews()}trackByUserIdAndTimestamp(e,t){return`${t?.user?.userSnippylyId}-${t.timestamp}`}getDocumentViews(){try{this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentViews","color: green;"),this.uniqueViewsByUserSubscription&&(this.componentConfigSignal.update(e=>(e=E(b({},e),{totalUniqueViews:{},totalUniqueViewsCount:0}),e)),this.uniqueViewsByUserSubscription.unsubscribe()),this.uniqueViewsByDateSubscription&&(this.componentConfigSignal.update(e=>(e=E(b({},e),{todayViews:{},todayViewsCount:0}),e)),this.uniqueViewsByDateSubscription.unsubscribe()),this.uniqueViewsByUserSubscription=this.viewsService.getUniqueViewsByUser(this.clientLocationId).subscribe(e=>{this.componentConfigSignal.update(t=>(t=E(b({},t),{totalUniqueViews:e||{},totalUniqueViewsCount:Object.keys(e||{})?.length||0}),t)),this.setLatestViewsByUsers()},e=>{this.loggingService.catch("Error in ViewAnalyticsDialogComponent getUniqueViewsByUser subscription: ",e)}),this.uniqueViewsByDateSubscription=this.viewsService.getUniqueViewsByDate(this.clientLocationId).subscribe(e=>{this.componentConfigSignal.update(t=>(t=b({},t),t.todayViews=e&&e[t.today]?e[t.today]:{},t.todayViewsCount=Object.keys(t.todayViews||{})?.length||0,t)),this.setLatestViewsByUsers()},e=>{this.loggingService.catch("Error in ViewAnalyticsDialogComponent getUniqueViewsByDate subscription: ",e)})}catch(e){this.loggingService.catch("Error in ViewAnalyticsDialogComponent getDocumentViews: ",e)}}setLatestViewsByUsers(){try{this.loggingService.log("%c[WB] Calling FUNCTION: setLatestViewsByUsers","color: green;"),Object.keys(this.componentConfigSignal().todayViews||{}).forEach(e=>{let t=this.componentConfigSignal().usersMap[e],o=this.componentConfigSignal().todayViews[e]?.timestamp;t&&o&&(this.componentConfigSignal().userViews.find(l=>l.user.userSnippylyId===e)||this.componentConfigSignal.update(l=>(l=E(b({},l),{userViews:[...l.userViews,{user:t,timestamp:o}]}),l)))}),this.componentConfigSignal.update(e=>(e=b({},e),e.userViews.sort((t,o)=>o.timestamp-t.timestamp),e.userViews=e.userViews.slice(0,3),e))}catch(e){this.loggingService.catch("Error in ViewAnalyticsDialogComponent setLatestViewsByUsers: ",e)}}closeTrendDialog(){try{this.close.emit(),this.closeBottomSheetFn&&this.closeBottomSheetFn?.()}catch(e){this.loggingService.catch("Error in ViewAnalyticsDialogComponent onClose: ",e)}}ngOnDestroy(){try{this.subscriptions.forEach(e=>{e.unsubscribe()}),this.uniqueViewsByDateSubscription?.unsubscribe(),this.uniqueViewsByUserSubscription?.unsubscribe()}catch(e){this.loggingService.catch("Error in ViewAnalyticsDialogComponent ngOnDestroy: ",e)}}};r.\u0275fac=function(t){return new(t||r)(C(ln),C(x),C(Qa),C(mt),C(z),C(gd,8))},r.\u0275cmp=O({type:r,selectors:[["velt-view-analytics-dialog"]],inputs:{clientLocationId:"clientLocationId"},outputs:{close:"close"},standalone:!1,decls:1,vars:1,consts:[["defaultDialogRef",""],[4,"ngIf"],["snippylyClickOutside","",1,"v-view-analytics-dialog-container",3,"clickOutside"],[4,"ngIf","ngIfElse"],[1,"v-back-btn-container"],[1,"v-back-btn",3,"click"],["width","16","height","16","viewBox","0 0 16 16","fill","none","xmlns","http://www.w3.org/2000/svg"],["d","M9.99988 4L5.99988 8L9.99988 12","stroke","currentColor","stroke-width","1.33333","stroke-linecap","round","stroke-linejoin","round"],[1,"v-view-analytics-count-container"],[1,"v-total-views-container"],[1,"v-total-views-count"],[1,"v-total-views-text"],["width","18","height","18","viewBox","0 0 18 18","fill","none","xmlns","http://www.w3.org/2000/svg"],["d","M7.5 9C7.5 9.39782 7.65804 9.77936 7.93934 10.0607C8.22064 10.342 8.60218 10.5 9 10.5C9.39782 10.5 9.77936 10.342 10.0607 10.0607C10.342 9.77936 10.5 9.39782 10.5 9C10.5 8.60218 10.342 8.22064 10.0607 7.93934C9.77936 7.65804 9.39782 7.5 9 7.5C8.60218 7.5 8.22064 7.65804 7.93934 7.93934C7.65804 8.22064 7.5 8.60218 7.5 9Z","stroke","#625DF5","stroke-width","1.25","stroke-linecap","round","stroke-linejoin","round"],["d","M15.75 9C13.95 12 11.7 13.5 9 13.5C6.3 13.5 4.05 12 2.25 9C4.05 6 6.3 4.5 9 4.5C11.7 4.5 13.95 6 15.75 9Z","stroke","#625DF5","stroke-width","1.25","stroke-linecap","round","stroke-linejoin","round"],[1,"v-today-views-container"],[1,"v-today-views-count"],[1,"v-today-views-text"],["class","v-users-container",4,"ngIf"],[1,"v-users-container"],[4,"ngFor","ngForOf"],[1,"v-user"],[1,"v-user-image"],[3,"user","size"],[1,"v-user-view-details"],[1,"v-user-name"],[1,"v-user-view-time"],[1,"v-document-viewer-tread-left"],["class","v-document-viewer-tread-right",4,"ngIf"],[1,"v-document-viewer-tread-right"]],template:function(t,o){t&1&&p(0,GCn,5,4,"ng-container",1),t&2&&g("ngIf",o.componentConfigSignal())},dependencies:[Vt,se,ri,ai,hp,ue],styles:[`.v-view-analytics-dialog-container{border-radius:var(--legacy-velt-view-analytics-dialog-border-radius);border:var(--legacy-velt-view-analytics-dialog-border);background:var(--legacy-velt-view-analytics-dialog-bg-color);box-shadow:var(--legacy-velt-view-analytics-dialog-box-shadow);padding:var(--legacy-velt-view-analytics-dialog-padding);display:flex;gap:16px}.v-view-analytics-dialog-container .v-document-viewer-tread-left{display:flex;flex-direction:column;gap:4px}.v-view-analytics-dialog-container .v-document-viewer-tread-left .v-total-views-container{width:140px;height:110px;flex-shrink:0;border-radius:8px;background:var(--legacy-velt-view-analytics-dialog-views-container-bg-color);box-sizing:border-box;display:flex;flex-direction:column;justify-content:center;align-items:center;gap:10px}.v-view-analytics-dialog-container .v-document-viewer-tread-left .v-total-views-container .v-total-views-count{color:var(--legacy-velt-view-analytics-dialog-total-views-count-color);font-size:32px;font-style:normal;font-weight:600;line-height:100%}.v-view-analytics-dialog-container .v-document-viewer-tread-left .v-total-views-container .v-total-views-text{color:var(--legacy-velt-view-analytics-dialog-total-views-text-color);font-size:12px;font-style:normal;font-weight:500;line-height:100%;text-transform:uppercase;display:flex;gap:4px;align-items:center}.v-view-analytics-dialog-container .v-document-viewer-tread-left .v-today-views-container{display:flex;width:140px;padding:8px 4px;justify-content:center;align-items:center;gap:4px;border-radius:8px;background:var(--legacy-velt-view-analytics-dialog-views-container-bg-color);box-sizing:border-box;color:var(--legacy-velt-view-analytics-dialog-today-views-text-color);font-size:12px;font-style:normal;font-weight:500;line-height:100%;text-transform:uppercase}.v-view-analytics-dialog-container .v-document-viewer-tread-right{padding:8px 0}.v-view-analytics-dialog-container .v-document-viewer-tread-right .v-users-container{display:inline-flex;flex-direction:column;align-items:flex-start;gap:16px;margin-right:16px}.v-view-analytics-dialog-container .v-document-viewer-tread-right .v-users-container .v-user{display:flex;align-items:center;gap:12px}.v-view-analytics-dialog-container .v-document-viewer-tread-right .v-users-container .v-user snippyly-user-avatar{display:flex}.v-view-analytics-dialog-container .v-document-viewer-tread-right .v-users-container .v-user .v-user-view-details{display:flex;flex-direction:column;gap:8px}.v-view-analytics-dialog-container .v-document-viewer-tread-right .v-users-container .v-user .v-user-view-details .v-user-name{color:var(--legacy-velt-view-analytics-dialog-user-name-color);font-size:12px;font-style:normal;font-weight:500;line-height:100%}.v-view-analytics-dialog-container .v-document-viewer-tread-right .v-users-container .v-user .v-user-view-details .v-user-view-time{color:var(--legacy-velt-view-analytics-dialog-user-timestamp-color);font-size:10px;font-style:normal;font-weight:500;line-height:100%;text-transform:uppercase}.v-view-analytics-dialog-container.bottom-sheet{display:flex;flex-direction:column;border-bottom-left-radius:0;border-bottom-right-radius:0}.v-view-analytics-dialog-container.bottom-sheet .v-back-btn-container{display:flex;padding:8px 8px 0}.v-view-analytics-dialog-container.bottom-sheet .v-back-btn-container .v-back-btn{background:transparent;border:0;outline:0;display:flex;align-items:center;gap:8px;color:var(--legacy-velt-view-analytics-dialog-back-btn-color);cursor:pointer;font-size:16px;font-style:normal;font-weight:400;line-height:normal}.v-view-analytics-dialog-container.bottom-sheet .v-view-analytics-count-container{display:flex;flex:1;gap:10px}.v-view-analytics-dialog-container.bottom-sheet .v-view-analytics-count-container .v-total-views-container{display:flex;padding:25px 20px;flex-direction:column;justify-content:center;align-items:center;gap:10px;flex:1 0 0;border-radius:8px;background:var(--legacy-velt-view-analytics-dialog-views-container-bg-color)}.v-view-analytics-dialog-container.bottom-sheet .v-view-analytics-count-container .v-total-views-container .v-total-views-count{color:var(--legacy-velt-view-analytics-dialog-total-views-count-color);font-size:32px;font-style:normal;font-weight:600;line-height:100%}.v-view-analytics-dialog-container.bottom-sheet .v-view-analytics-count-container .v-total-views-container .v-total-views-text{color:var(--legacy-velt-view-analytics-dialog-total-views-text-color);font-size:12px;font-style:normal;font-weight:500;line-height:100%;text-transform:uppercase;display:flex;gap:4px;align-items:center}.v-view-analytics-dialog-container.bottom-sheet .v-view-analytics-count-container .v-today-views-container{display:flex;padding:25px 20px;flex-direction:column;justify-content:center;align-items:center;gap:10px;flex:1 0 0;border-radius:8px;background:var(--legacy-velt-view-analytics-dialog-views-container-bg-color)}.v-view-analytics-dialog-container.bottom-sheet .v-view-analytics-count-container .v-today-views-container .v-today-views-count{color:var(--legacy-velt-view-analytics-dialog-today-views-text-color);font-size:32px;font-style:normal;font-weight:600;line-height:100%}.v-view-analytics-dialog-container.bottom-sheet .v-view-analytics-count-container .v-today-views-container .v-today-views-text{color:var(--legacy-velt-view-analytics-dialog-today-views-text-color);font-size:12px;font-style:normal;font-weight:500;line-height:100%;text-transform:uppercase;display:flex;gap:4px;align-items:center}.v-view-analytics-dialog-container.bottom-sheet .v-users-container{display:inline-flex;flex-direction:column;align-items:flex-start;gap:16px;margin-right:16px}.v-view-analytics-dialog-container.bottom-sheet .v-users-container .v-user{display:flex;align-items:center;gap:12px;width:100%}.v-view-analytics-dialog-container.bottom-sheet .v-users-container .v-user snippyly-user-avatar{display:flex}.v-view-analytics-dialog-container.bottom-sheet .v-users-container .v-user .v-user-view-details{display:flex;flex-direction:column;gap:8px;flex:1}.v-view-analytics-dialog-container.bottom-sheet .v-users-container .v-user .v-user-view-details .v-user-name{color:var(--legacy-velt-view-analytics-dialog-user-name-color);font-size:12px;font-style:normal;font-weight:500;line-height:100%}.v-view-analytics-dialog-container.bottom-sheet .v-users-container .v-user .v-user-view-time{color:var(--legacy-velt-view-analytics-dialog-user-timestamp-color);font-size:10px;font-style:normal;font-weight:500;line-height:100%;text-transform:uppercase}
|
|
555
555
|
`],encapsulation:3,changeDetection:0});let n=r;return n})();var hxe=(()=>{let r=class r{constructor(e,t){this.bottomSheet=e,this.loggingService=t,this.close=new Fe,this.subscriptions=[]}ngOnInit(){}ngAfterViewInit(){this.openBottomSheet()}openBottomSheet(){return X(this,null,function*(){try{this.bottomSheetRef=this.bottomSheet.open(kN,{data:{clientLocationId:this.clientLocationId,closeBottomSheetFn:()=>{this.onClose(),this.bottomSheetRef?.dismiss()}},panelClass:["v-view-analytics-bottom-sheet-container","velt-mat-bottom-sheet-container"]}),this.subscriptions.push(this.bottomSheetRef.backdropClick().subscribe(()=>{this.onClose()},e=>{this.loggingService.catch("Error in ViewAnalyticsBottomSheetComponent backdropClick subscription: ",e)}))}catch(e){this.loggingService.catch("Error in ViewAnalyticsBottomSheetComponent openBottomSheet: ",e)}})}onClose(){try{this.close.emit()}catch(e){this.loggingService.catch("Error in ViewAnalyticsBottomSheetComponent onClose: ",e)}}ngOnDestroy(){try{this.subscriptions.forEach(e=>{e.unsubscribe()})}catch(e){this.loggingService.catch("Error in ViewAnalyticsBottomSheetComponent ngOnDestroy: ",e)}}};r.\u0275fac=function(t){return new(t||r)(C(vd),C(x))},r.\u0275cmp=O({type:r,selectors:[["velt-view-analytics-bottom-sheet-internal"]],inputs:{clientLocationId:"clientLocationId"},outputs:{close:"close"},standalone:!1,decls:0,vars:0,template:function(t,o){},styles:[".velt-mat-bottom-sheet-container.v-view-analytics-bottom-sheet-container{padding:0!important} .velt-mat-bottom-sheet-container.v-view-analytics-bottom-sheet-container .mat-bottom-sheet-container{padding:0!important}"],changeDetection:0});let n=r;return n})();var YCn=()=>["snippyly-overlay-panel","v-view-analytics-overlay-panel","velt-overlay-panel"];function KCn(n,r){if(n&1){let i=K();_(0,"velt-view-analytics-dialog",11),G("close",function(){N(i);let t=c(2);return F(t.toggleTrends())}),y()}if(n&2){let i=c(2);g("clientLocationId",i.clientLocationId)}}function ZCn(n,r){if(n&1){let i=K();_(0,"velt-view-analytics-bottom-sheet-internal",11),G("close",function(){N(i);let t=c(2);return F(t.closeTrends())}),y()}if(n&2){let i=c(2);g("clientLocationId",i.clientLocationId)}}function XCn(n,r){if(n&1){let i=K();h(0),_(1,"div",3,0),G("click",function(t){return N(i),c().toggleTrends(),F(t.stopPropagation())}),_(3,"slot",4),G("slotchange",function(){N(i);let t=c();return F(t.onButtonSlotChange())}),_(4,"div",5),de(),_(5,"svg",6),D(6,"path",7),y(),bt(),_(7,"span",8),ne(8),y()()()(),p(9,KCn,1,1,"ng-template",9,1,Me)(11,ZCn,1,1,"velt-view-analytics-bottom-sheet-internal",10),f()}if(n&2){let i=r.ngIf,e=Ce(2),t=c();m(4),ve("active",i.treadsVisible),m(4),Ke(i.totalUniqueViewsCount),m(),g("cdkConnectedOverlayOrigin",e)("cdkConnectedOverlayOpen",!i.isPhone&&i.treadsVisible)("cdkConnectedOverlayPanelClass",yt(11,YCn))("cdkConnectedOverlayBackdropClass","snippyly-overlay-backdrop")("cdkConnectedOverlayGrowAfterOpen",!0)("cdkConnectedOverlayPositions",t.positions)("cdkConnectedOverlayDisableClose",!0),m(2),g("ngIf",i.isPhone&&i.treadsVisible)}}var fxe=(()=>{let r=class r{constructor(e,t,o,a){this.breakpointObserver=e,this.docService=t,this.loggingService=o,this.viewsService=a,this.type="document",this.componentConfigSignal=Oe({today:new Date().toISOString().split("T")[0],todayViews:{},todayViewsCount:0,totalUniqueViews:{},totalUniqueViewsCount:0,treadsVisible:!1,customButtonAdded:!1,isPhone:!1,componentId:Math.random().toString(36).substring(2)}),this.positions=V.OVERLAY_POSITIONS.map(l=>new xi({originX:l.originX,originY:l.originY},{overlayX:l.overlayX,overlayY:l.overlayY})),this.subscriptions=[]}ngOnInit(){try{this.getUniqueViewsByUser(),this.subscriptions.push(this.breakpointObserver.observe(er.XSmall).subscribe(e=>{this.componentConfigSignal.update(t=>(t=b({},t),t.isPhone=!!e.matches,t))},e=>{this.loggingService.catch("Error in ViewAnalyticsComponent breakpointObserver subscription: ",e)})),this.subscriptions.push(this.docService.getLocation$().subscribe(e=>{e?.location?.id&&(this.clientLocationId=e?.location?.id,this.getUniqueViewsByUser())}))}catch(e){this.loggingService.catch("Error in ViewAnalyticsComponent ngOnInit: ",e)}}ngOnChanges(e){try{(e.type||e.clientLocationId)&&this.getUniqueViewsByUser()}catch(t){this.loggingService.catch("Error in ViewAnalyticsComponent ngOnChanges: ",t)}}getUniqueViewsByUser(){try{this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentViews","color: green;"),this.uniqueViewsByUserSubscription&&(this.componentConfigSignal.update(t=>(t=b({},t),t.totalUniqueViews={},t.totalUniqueViewsCount=0,t)),this.uniqueViewsByUserSubscription.unsubscribe());let e=this.type==="location"&&this.clientLocationId?this.clientLocationId:void 0;this.uniqueViewsByUserSubscription=this.viewsService.getUniqueViewsByUser(e).subscribe(t=>{this.componentConfigSignal.update(o=>(o=b({},o),o.totalUniqueViews=t||{},o.totalUniqueViewsCount=Object.keys(o.totalUniqueViews||{})?.length||0,o))},t=>{this.loggingService.catch("Error in ViewAnalyticsComponent getUniqueViewsByUser subscription: ",t)})}catch(e){this.loggingService.catch("Error in ViewAnalyticsComponent getDocumentViews: ",e)}}toggleTrends(){try{this.loggingService.log("%c[WB] Calling FUNCTION: toggleTrends","color: green;"),this.componentConfigSignal.update(e=>(e=b({},e),e.treadsVisible=!e.treadsVisible,e))}catch(e){this.loggingService.catch("Error in ViewAnalyticsComponent toggleTrends: ",e)}}openTrends(){try{this.loggingService.log("%c[WB] Calling FUNCTION: openTrends","color: green;"),this.componentConfigSignal.update(e=>(e=b({},e),e.treadsVisible=!0,e))}catch(e){this.loggingService.catch("Error in ViewAnalyticsComponent openTrends: ",e)}}closeTrends(){try{this.loggingService.log("%c[WB] Calling FUNCTION: closeTrends","color: green;"),this.componentConfigSignal.update(e=>(e=b({},e),e.treadsVisible=!1,e))}catch(e){this.loggingService.catch("Error in ViewAnalyticsComponent closeTrends: ",e)}}onButtonSlotChange(){this.componentConfigSignal.update(e=>(e=b({},e),e.customButtonAdded=!0,e))}unsubscribe(){this.loggingService.log("%c[WB] Calling FUNCTION: unsubscribe","color: green;");try{this.subscriptions.map(e=>{e.unsubscribe()}),this.subscriptions=[],this.uniqueViewsByUserSubscription&&this.uniqueViewsByUserSubscription.unsubscribe()}catch(e){this.loggingService.catch("Error in ViewAnalyticsComponent unsubscribe: ",e)}}ngOnDestroy(){try{this.unsubscribe()}catch(e){this.loggingService.catch("Error in ViewAnalyticsComponent ngOnDestroy: ",e)}}};r.\u0275fac=function(t){return new(t||r)(C(Ur),C(lt),C(x),C(Qa))},r.\u0275cmp=O({type:r,selectors:[["velt-view-analytics-internal"]],inputs:{type:"type",clientLocationId:[0,"locationId","clientLocationId"]},standalone:!1,features:[it],decls:1,vars:1,consts:[["trigger","cdkOverlayOrigin"],["overlay","cdkConnectedOverlay"],[4,"ngIf"],["part","container","cdkOverlayOrigin","",1,"v-document-viewer-tread-container",3,"click"],["name","button",3,"slotchange"],["part","button-container",1,"action-btn"],["part","button-icon","width","24","height","24","viewBox","0 0 24 24","fill","none","xmlns","http://www.w3.org/2000/svg",1,"action-btn-icon"],["d","M4.5 16.1667L9.5 11.1667L12.8333 14.5L19.5 7.83334M19.5 7.83334H13.6667M19.5 7.83334V13.6667","stroke","currentColor","stroke-width","1.5","stroke-linecap","round","stroke-linejoin","round"],["part","button-label",1,"action-btn-label"],["cdkConnectedOverlay","",3,"cdkConnectedOverlayOrigin","cdkConnectedOverlayOpen","cdkConnectedOverlayPanelClass","cdkConnectedOverlayBackdropClass","cdkConnectedOverlayGrowAfterOpen","cdkConnectedOverlayPositions","cdkConnectedOverlayDisableClose"],[3,"clientLocationId","close",4,"ngIf"],[3,"close","clientLocationId"]],template:function(t,o){t&1&&p(0,XCn,12,12,"ng-container",2),t&2&&g("ngIf",o.componentConfigSignal())},dependencies:[se,mn,cn,kN,hxe],styles:[`html{--velt-base-rem-unit: 1}*[data-snippyly-element=true],*[data-velt-element=true]{font-family:var(--velt-default-font-family)}velt-wireframe{display:none!important}*{box-sizing:border-box;-webkit-tap-highlight-color:rgba(255,255,255,0);outline:none;margin:0;padding:0;height:unset;width:unset;text-align:left;line-height:1.5;font-size:calc((1rem + 0px) * var(--velt-base-rem-unit))}*:empty{display:revert}.v-document-viewer-tread-container{display:inline-block}.action-btn{display:inline-flex;justify-content:center;align-items:center;padding:6px;border-radius:var(--legacy-velt-tool-border-radius);border:var(--legacy-velt-tool-border);background-color:var(--legacy-velt-tool-bg-color);color:var(--legacy-velt-tool-icon-color);cursor:pointer}.action-btn .action-btn-label{font-size:calc((.9rem + 0px) * var(--velt-base-rem-unit));padding:0 12px 0 4px;font-weight:700;color:currentColor}.action-btn .action-btn-icon{width:calc((var(--legacy-velt-tool-icon-size) + 0px) * var(--velt-base-rem-unit));height:calc((var(--legacy-velt-tool-icon-size) + 0px) * var(--velt-base-rem-unit));color:currentColor;padding-left:8px;box-sizing:content-box}.action-btn .toolbar-icon-dropdown-arrow{width:16px;height:16px;color:currentColor}.action-btn:focus{border-radius:var(--legacy-velt-tool-focus-border-radius);border:var(--legacy-velt-tool-focus-border);background-color:var(--legacy-velt-tool-focus-bg-color);color:var(--legacy-velt-tool-focus-icon-color)}.action-btn:focus .action-btn-icon{width:calc((var(--legacy-velt-tool-focus-icon-size) + 0px) * var(--velt-base-rem-unit));height:calc((var(--legacy-velt-tool-focus-icon-size) + 0px) * var(--velt-base-rem-unit))}.action-btn:focus .toolbar-icon-dropdown-arrow{color:var(--legacy-velt-tool-focus-icon-color)}.action-btn:hover{border-radius:var(--legacy-velt-tool-hover-border-radius);border:var(--legacy-velt-tool-hover-border);background-color:var(--legacy-velt-tool-hover-bg-color);color:var(--legacy-velt-tool-hover-icon-color)}.action-btn:hover .action-btn-icon{width:calc((var(--legacy-velt-tool-hover-icon-size) + 0px) * var(--velt-base-rem-unit));height:calc((var(--legacy-velt-tool-hover-icon-size) + 0px) * var(--velt-base-rem-unit))}.action-btn:hover .toolbar-icon-dropdown-arrow{color:var(--legacy-velt-tool-hover-icon-color)}.action-btn:active,.action-btn.active{border-radius:var(--legacy-velt-tool-active-border-radius);border:var(--legacy-velt-tool-active-border);background-color:var(--legacy-velt-tool-active-bg-color);color:var(--legacy-velt-tool-active-icon-color)}.action-btn:active .action-btn-icon,.action-btn.active .action-btn-icon{width:calc((var(--legacy-velt-tool-active-icon-size) + 0px) * var(--velt-base-rem-unit));height:calc((var(--legacy-velt-tool-active-icon-size) + 0px) * var(--velt-base-rem-unit))}.action-btn:active .toolbar-icon-dropdown-arrow,.action-btn.active .toolbar-icon-dropdown-arrow{color:var(--legacy-velt-tool-active-icon-color)}
|
|
556
|
-
`],encapsulation:3,changeDetection:0});let n=r;return n})();var Cxe=(()=>{let r=class r extends Ct{constructor(e,t,o,a,l,s,d,v){super(v,s),this.authService=e,this.commentService=t,this.domService=o,this.loggingService=a,this.notificationService=l,this.themeService=s,this.viewsService=d,this.elementRef=v,this.onNotificationClickEvent=new Fe,this.veltElement=!0,this.componentId="velt-notifications-history-panel"}ngOnInit(){try{this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in NotificationsHistoryPanelComponent ngOnInit:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","dialog"),e.setAttribute("aria-label","Notifications history panel")}catch(e){this.loggingService.catch("Error in NotificationsHistoryPanelComponent setupA11yAttributes:",e)}}goToAnnotation(e){try{setTimeout(()=>{let t=null;e.targetElement||e.areaAnnotationId?t=document.getElementById(`comment-pin-container-${e.annotationId}`):t=document.querySelector(`[data-velt-id='${e.annotationId}']`),t&&t.scrollIntoView({behavior:"auto",block:"center",inline:"nearest"})},100)}catch(t){this.loggingService.catch("Error in NotificationsHistoryPanelComponent goToAnnotation: ",t)}}onNotificationClick(e){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: onNotificationClick","color: green;"),e.notificationSource==="comment"&&e.targetAnnotationId){let t=this.commentService.getAnnotationById(e?.targetAnnotationId);t&&(this.domService.toggleAnnotationSelection(t),this.goToAnnotation(t))}this.onNotificationClickEvent.emit(e),e?.id&&e.isUnread&&this.setNotificationAsRead(e)}catch(t){this.loggingService.catch("Error in NotificationsHistoryPanelComponent onNotificationClick: ",t)}}setNotificationAsRead(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setNotificationAsRead","color: green;"),e?.id&&(this.authService.getUser()?.organizationId?this.notificationService.setNotificationsAsRead([e]):this.viewsService.setNotificationsAsRead([e?.id]))}catch(t){this.loggingService.catch("Error in NotificationsHistoryPanelComponent setNotificationAsRead: ",t)}}};r.\u0275fac=function(t){return new(t||r)(C(Ge),C(Pe),C(Ve),C(x),C(hn),C(mt),C(Qa),C(z))},r.\u0275cmp=O({type:r,selectors:[["app-notifications-history-panel"]],hostVars:1,hostBindings:function(t,o){t&2&&T("data-velt-element",o.veltElement)},outputs:{onNotificationClickEvent:"onNotificationClick"},standalone:!1,features:[L],decls:1,vars:1,consts:[[3,"onNotificationClick","darkMode"]],template:function(t,o){t&1&&(_(0,"velt-notifications-panel-internal",0),G("onNotificationClick",function(l){return o.onNotificationClick(l)}),y()),t&2&&g("darkMode",o.darkMode)},dependencies:[Gm],encapsulation:2,changeDetection:0});let n=r;return n})();var _xe=(()=>{let r=class r{set _pageSize(e){try{let t=e;typeof e=="string"&&(t=JSON.parse(e));let o=typeof t=="number"?t:parseInt(t,10);!isNaN(o)&&o>0&&(this.pageSize=o)}catch{}}constructor(e,t,o){this.bottomSheet=e,this.loggingService=t,this.elementRef=o,this.onNotificationClickEvent=new Fe,this.close=new Fe,this.pageSize=5,this.subscriptions=[],this.componentId="velt-notifications-bottom-sheet-internal"}ngOnInit(){try{this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in NotificationsBottomSheetComponent ngOnInit:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","dialog"),e.setAttribute("aria-label","Notifications bottom sheet")}catch(e){this.loggingService.catch("Error in NotificationsBottomSheetComponent setupA11yAttributes:",e)}}ngAfterViewInit(){this.openBottomSheet()}openBottomSheet(){return X(this,null,function*(){try{this.bottomSheetRef=this.bottomSheet.open(Gm,{data:{closeBottomSheetFn:()=>{this.onClose(),this.bottomSheetRef?.dismiss()},onNotificationClickFn:e=>{this.onNotificationClickEvent.emit(e)},pageSize:this.pageSize},panelClass:["v-notifications-bottom-sheet-container","velt-mat-bottom-sheet-container"]}),this.subscriptions.push(this.bottomSheetRef.backdropClick().subscribe(()=>{this.onClose()},e=>{this.loggingService.catch("Error in NotificationsBottomSheetComponent backdropClick subscription: ",e)}))}catch(e){this.loggingService.catch("Error in NotificationsBottomSheetComponent openBottomSheet: ",e)}})}onClose(){try{this.close.emit()}catch(e){this.loggingService.catch("Error in NotificationsBottomSheetComponent onClose: ",e)}}ngOnDestroy(){try{this.subscriptions.forEach(e=>{e.unsubscribe()})}catch(e){this.loggingService.catch("Error in NotificationsBottomSheetComponent ngOnDestroy: ",e)}}};r.\u0275fac=function(t){return new(t||r)(C(vd),C(x),C(z))},r.\u0275cmp=O({type:r,selectors:[["velt-notifications-bottom-sheet-internal"]],inputs:{_pageSize:[0,"pageSize","_pageSize"]},outputs:{onNotificationClickEvent:"onNotificationClick",close:"close"},standalone:!1,decls:0,vars:0,template:function(t,o){},styles:[".velt-mat-bottom-sheet-container.v-notifications-bottom-sheet-container{padding:0!important} .velt-mat-bottom-sheet-container.v-notifications-bottom-sheet-container .mat-bottom-sheet-container{padding:0!important}"],changeDetection:0});let n=r;return n})();var JCn=["*"],bxe=(()=>{let r=class r{constructor(e,t,o,a){this.el=e,this.domService=t,this.loggingService=o,this.wireframeService=a;try{this.loggingService.log("%c[WB] Creating CLASS: WireframeComponent","color: blue;")}catch(l){this.loggingService.catch("Error in WireframeComponent constructor: ",l)}}ngAfterContentInit(){try{this.loggingService.log("%c[WB] Calling WireframeComponent FUNCTION: ngAfterContentInit","color: green;");let e=this.el.nativeElement.querySelectorAll(":scope > *"),t=new Map;e.forEach(o=>{if(o.nodeType===1){let a=o;if(a&&a?.tagName?.toLowerCase()?.startsWith("velt-")){let s=a.tagName.toLowerCase();if(s==="velt-comment-dialog-composer-action-button-wireframe"||s==="velt-comment-dialog-composer-format-toolbar-button-wireframe"){let u=a.getAttribute("type");u&&(s+=`--${u}`)}let d=a.getAttribute("variant");d&&(s+=`---${d}`);let v=this.domService.deepCloneElement(a);this.domService.setRandomNumberToElementRecursive(v),t.set(s,v)}}}),this.wireframeService.setWireframeMap(t)}catch(e){this.loggingService.catch("Error in WireframeComponent ngAfterContentInit: ",e)}}};r.\u0275fac=function(t){return new(t||r)(C(z),C(Ve),C(x),C(Je))},r.\u0275cmp=O({type:r,selectors:[["app-wireframe"]],standalone:!1,ngContentSelectors:JCn,decls:1,vars:0,template:function(t,o){t&1&&(Wt(),jt(0))},encapsulation:2,changeDetection:0});let n=r;return n})();function QCn(n,r){if(n&1&&(de(),_(0,"svg",3),D(1,"path",4)(2,"path",5),y()),n&2){let i=c(2);T("data-testid",i.componentId+"-media")("aria-label",i.type!=null&&i.type.includes("video")?"Video file":"Audio file")}}function e1n(n,r){if(n&1&&(de(),_(0,"svg",3),D(1,"path",6),y()),n&2){let i=c(2);T("data-testid",i.componentId+"-pdf")("aria-label","PDF file")}}function t1n(n,r){if(n&1&&(de(),_(0,"svg",3),D(1,"path",7),y()),n&2){let i=c(2);T("data-testid",i.componentId+"-csv")("aria-label","CSV file")}}function n1n(n,r){if(n&1&&(de(),_(0,"svg",3),D(1,"path",8),y()),n&2){let i=c(2);T("data-testid",i.componentId+"-json")("aria-label","JSON file")}}function i1n(n,r){if(n&1&&(de(),_(0,"svg",3),D(1,"path",9),y()),n&2){let i=c(2);T("data-testid",i.componentId+"-docx")("aria-label","DOCX file")}}function r1n(n,r){if(n&1&&(de(),_(0,"svg",3),D(1,"path",10),y()),n&2){let i=c(2);T("data-testid",i.componentId+"-xlsx")("aria-label","XLSX file")}}function o1n(n,r){if(n&1&&(de(),_(0,"svg",3),D(1,"path",11),y()),n&2){let i=c(2);T("data-testid",i.componentId+"-xls")("aria-label","XLS file")}}function a1n(n,r){if(n&1&&(de(),_(0,"svg",3),D(1,"path",12),y()),n&2){let i=c(2);T("data-testid",i.componentId+"-pptx")("aria-label","PPTX file")}}function l1n(n,r){if(n&1&&(h(0),p(1,QCn,3,2,"svg",2)(2,e1n,2,2,"svg",2)(3,t1n,2,2,"svg",2)(4,n1n,2,2,"svg",2)(5,i1n,2,2,"svg",2)(6,r1n,2,2,"svg",2)(7,o1n,2,2,"svg",2)(8,a1n,2,2,"svg",2),f()),n&2){let i=c();m(),g("ngIf",(i.type==null?null:i.type.includes("video"))||(i.type==null?null:i.type.includes("audio"))),m(),g("ngIf",i.type==null?null:i.type.includes("pdf")),m(),g("ngIf",i.type==null?null:i.type.includes("csv")),m(),g("ngIf",i.type==null?null:i.type.includes("json")),m(),g("ngIf",i.type==null?null:i.type.includes("wordprocessingml.document")),m(),g("ngIf",i.type==null?null:i.type.includes("spreadsheetml.sheet")),m(),g("ngIf",i.type==null?null:i.type.includes("vnd.ms-excel")),m(),g("ngIf",i.type==null?null:i.type.includes("presentationml.presentation"))}}function s1n(n,r){if(n&1&&(de(),_(0,"svg",3),D(1,"path",13),y()),n&2){let i=c();T("data-testid",i.componentId+"-default")("aria-label","Default file")}}var gK=(()=>{let r=class r{constructor(e,t){this.elementRef=e,this.loggingService=t,this.veltElement=!0,this.componentId="velt-file-icon"}ngOnInit(){try{this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in FileIconComponent ngOnInit:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("role","presentation"),e.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in FileIconComponent setupA11yAttributes:",e)}}};r.\u0275fac=function(t){return new(t||r)(C(z),C(x))},r.\u0275cmp=O({type:r,selectors:[["velt-file-icon-internal"]],hostVars:1,hostBindings:function(t,o){t&2&&T("data-velt-element",o.veltElement)},inputs:{type:"type"},standalone:!1,decls:3,vars:2,consts:[["otherIconRef",""],[4,"ngIf","ngIfElse"],["width","28","height","28","viewBox","0 0 32 32","fill","none","xmlns","http://www.w3.org/2000/svg","aria-hidden","true","focusable","false","role","img",4,"ngIf"],["width","28","height","28","viewBox","0 0 32 32","fill","none","xmlns","http://www.w3.org/2000/svg","aria-hidden","true","focusable","false","role","img"],["d","M2.66663 10.6667C2.66663 9.25218 3.22853 7.89563 4.22872 6.89543C5.22892 5.89524 6.58547 5.33334 7.99996 5.33334H24C25.4144 5.33334 26.771 5.89524 27.7712 6.89543C28.7714 7.89563 29.3333 9.25218 29.3333 10.6667V21.3333C29.3333 22.7478 28.7714 24.1044 27.7712 25.1046C26.771 26.1048 25.4144 26.6667 24 26.6667H7.99996C6.58547 26.6667 5.22892 26.1048 4.22872 25.1046C3.22853 24.1044 2.66663 22.7478 2.66663 21.3333V10.6667Z","stroke","currentColor","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"],["d","M13.3333 12L20 16L13.3333 20V12Z","stroke","currentColor","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"],["d","M18.6666 4V9.33333C18.6666 9.68696 18.8071 10.0261 19.0572 10.2761C19.3072 10.5262 19.6463 10.6667 20 10.6667H25.3333M18.6666 4H9.33329C8.62605 4 7.94777 4.28095 7.44767 4.78105C6.94758 5.28115 6.66663 5.95942 6.66663 6.66667V16M18.6666 4L25.3333 10.6667M25.3333 10.6667V16M6.66663 24H8.66663C9.19706 24 9.70577 23.7893 10.0808 23.4142C10.4559 23.0391 10.6666 22.5304 10.6666 22C10.6666 21.4696 10.4559 20.9609 10.0808 20.5858C9.70577 20.2107 9.19706 20 8.66663 20H6.66663V28M22.6666 24H25.3333M26.6666 20H22.6666V28M14.6666 20V28H16C16.7072 28 17.3855 27.719 17.8856 27.219C18.3857 26.7189 18.6666 26.0406 18.6666 25.3333V22.6667C18.6666 21.9594 18.3857 21.2811 17.8856 20.781C17.3855 20.281 16.7072 20 16 20H14.6666Z","stroke","currentColor","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"],["d","M18.6667 4V9.33333C18.6667 9.68696 18.8072 10.0261 19.0572 10.2761C19.3073 10.5262 19.6464 10.6667 20 10.6667H25.3334M18.6667 4H9.33337C8.62613 4 7.94785 4.28095 7.44776 4.78105C6.94766 5.28115 6.66671 5.95942 6.66671 6.66667V16M18.6667 4L25.3334 10.6667M25.3334 10.6667V16M9.33337 22C9.33337 21.4696 9.12266 20.9609 8.74759 20.5858C8.37252 20.2107 7.86381 20 7.33337 20C6.80294 20 6.29423 20.2107 5.91916 20.5858C5.54409 20.9609 5.33337 21.4696 5.33337 22V26C5.33337 26.5304 5.54409 27.0391 5.91916 27.4142C6.29423 27.7893 6.80294 28 7.33337 28C7.86381 28 8.37252 27.7893 8.74759 27.4142C9.12266 27.0391 9.33337 26.5304 9.33337 26M13.3334 27C13.3334 27.552 13.7814 28 14.3334 28H16C16.3537 28 16.6928 27.8595 16.9428 27.6095C17.1929 27.3594 17.3334 27.0203 17.3334 26.6667V25.3333C17.3334 24.9797 17.1929 24.6406 16.9428 24.3905C16.6928 24.1405 16.3537 24 16 24H14.6667C14.3131 24 13.9739 23.8595 13.7239 23.6095C13.4739 23.3594 13.3334 23.0203 13.3334 22.6667V21.3333C13.3334 20.9797 13.4739 20.6406 13.7239 20.3905C13.9739 20.1405 14.3131 20 14.6667 20H16.3334C16.5986 20 16.8529 20.1054 17.0405 20.2929C17.228 20.4804 17.3334 20.7348 17.3334 21M21.3334 20L24 28L26.6667 20","stroke","currentColor","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"],["d","M18.6667 4V9.33333C18.6667 9.68696 18.8072 10.0261 19.0572 10.2761C19.3073 10.5262 19.6464 10.6667 20 10.6667H25.3334M18.6667 4H9.33337C8.62613 4 7.94785 4.28095 7.44776 4.78105C6.94766 5.28115 6.66671 5.95942 6.66671 6.66667V16M18.6667 4L25.3334 10.6667M25.3334 10.6667V16M24 28V20L27 28V20M5 20H8V26.5C8 26.8978 7.84196 27.2794 7.56066 27.5607C7.27936 27.842 6.89782 28 6.5 28C6.10218 28 5.72064 27.842 5.43934 27.5607C5.15804 27.2794 5 26.8978 5 26.5V26M11 27C11 27.2652 11.1054 27.5196 11.2929 27.7071C11.4804 27.8946 11.7348 28 12 28H13C13.2652 28 13.5196 27.8946 13.7071 27.7071C13.8946 27.5196 14 27.2652 14 27V25C14 24.7348 13.8946 24.4804 13.7071 24.2929C13.5196 24.1054 13.2652 24 13 24H12C11.7348 24 11.4804 23.8946 11.2929 23.7071C11.1054 23.5196 11 23.2652 11 23V21C11 20.7348 11.1054 20.4804 11.2929 20.2929C11.4804 20.1054 11.7348 20 12 20H13C13.2652 20 13.5196 20.1054 13.7071 20.2929C13.8946 20.4804 14 20.7348 14 21M19 20C19.5304 20 20.0391 20.2107 20.4142 20.5858C20.7893 20.9609 21 21.4696 21 22V26C21 26.5304 20.7893 27.0391 20.4142 27.4142C20.0391 27.7893 19.5304 28 19 28C18.4696 28 17.9609 27.7893 17.5858 27.4142C17.2107 27.0391 17 26.5304 17 26V22C17 21.4696 17.2107 20.9609 17.5858 20.5858C17.9609 20.2107 18.4696 20 19 20Z","stroke","currentColor","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"],["d","M18.6666 4V9.33333C18.6666 9.68696 18.8071 10.0261 19.0572 10.2761C19.3072 10.5262 19.6463 10.6667 20 10.6667H25.3333M18.6666 4H9.33329C8.62605 4 7.94777 4.28095 7.44767 4.78105C6.94758 5.28115 6.66663 5.95942 6.66663 6.66667V16M18.6666 4L25.3333 10.6667M25.3333 10.6667V16M22.6666 22C22.6666 21.4696 22.4559 20.9609 22.0808 20.5858C21.7058 20.2107 21.1971 20 20.6666 20C20.1362 20 19.6275 20.2107 19.2524 20.5858C18.8773 20.9609 18.6666 21.4696 18.6666 22V26C18.6666 26.5304 18.8773 27.0391 19.2524 27.4142C19.6275 27.7893 20.1362 28 20.6666 28C21.1971 28 21.7058 27.7893 22.0808 27.4142C22.4559 27.0391 22.6666 26.5304 22.6666 26M26 20L30 28M26 28L30 20M2.66663 20V28H3.99996C4.7072 28 5.38548 27.719 5.88558 27.219C6.38567 26.7189 6.66663 26.0406 6.66663 25.3333V22.6667C6.66663 21.9594 6.38567 21.2811 5.88558 20.781C5.38548 20.281 4.7072 20 3.99996 20H2.66663ZM12.6666 20C13.1971 20 13.7058 20.2107 14.0808 20.5858C14.4559 20.9609 14.6666 21.4696 14.6666 22V26C14.6666 26.5304 14.4559 27.0391 14.0808 27.4142C13.7058 27.7893 13.1971 28 12.6666 28C12.1362 28 11.6275 27.7893 11.2524 27.4142C10.8773 27.0391 10.6666 26.5304 10.6666 26V22C10.6666 21.4696 10.8773 20.9609 11.2524 20.5858C11.6275 20.2107 12.1362 20 12.6666 20Z","stroke","currentColor","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"],["d","M18.6667 4V9.33333C18.6667 9.68696 18.8072 10.0261 19.0572 10.2761C19.3073 10.5262 19.6464 10.6667 20 10.6667H25.3334M18.6667 4H9.33337C8.62613 4 7.94785 4.28095 7.44776 4.78105C6.94766 5.28115 6.66671 5.95942 6.66671 6.66667V16M18.6667 4L25.3334 10.6667M25.3334 10.6667V16M24 20L27 28M24 28L27 20M5 20L9 28M5 28L9 20M18 27C18 27.552 18.336 28 18.75 28H20C20.2652 28 20.5196 27.8595 20.7071 27.6095C20.8946 27.3594 21 27.0203 21 26.6667V25.3333C21 24.9797 20.8946 24.6406 20.7071 24.3905C20.5196 24.1405 20.2652 24 20 24H19C18.7348 24 18.4804 23.8595 18.2929 23.6095C18.1054 23.3594 18 23.0203 18 22.6667V21.3333C18 20.9797 18.1054 20.6406 18.2929 20.3905C18.4804 20.1405 18.7348 20 19 20H20.25C20.4489 20 20.6397 20.1054 20.7803 20.2929C20.921 20.4804 21 20.7348 21 21M12 20V28H15","stroke","currentColor","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"],["d","M18.6667 4V9.33333C18.6667 9.68696 18.8072 10.0261 19.0572 10.2761C19.3073 10.5262 19.6464 10.6667 20 10.6667H25.3334M18.6667 4H9.33337C8.62613 4 7.94785 4.28095 7.44776 4.78105C6.94766 5.28115 6.66671 5.95942 6.66671 6.66667V16M18.6667 4L25.3334 10.6667M25.3334 10.6667V16M5.5 20L9.5 28M5.5 28L9.5 20M22.5 27C22.5 27.552 22.836 28 23.25 28H24.5C24.7652 28 25.0196 27.8595 25.2071 27.6095C25.3946 27.3594 25.5 27.0203 25.5 26.6667V25.3333C25.5 24.9797 25.3946 24.6406 25.2071 24.3905C25.0196 24.1405 24.7652 24 24.5 24H23.5C23.2348 24 22.9804 23.8595 22.7929 23.6095C22.6054 23.3594 22.5 23.0203 22.5 22.6667V21.3333C22.5 20.9797 22.6054 20.6406 22.7929 20.3905C22.9804 20.1405 23.2348 20 23.5 20H24.75C24.9489 20 25.1397 20.1054 25.2803 20.2929C25.421 20.4804 25.5 20.7348 25.5 21M15 20V28H18","stroke","currentColor","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"],["d","M18.6667 4V9.33333C18.6667 9.68696 18.8072 10.0261 19.0573 10.2761C19.3073 10.5262 19.6465 10.6667 20.0001 10.6667H25.3334M18.6667 4H9.33341C8.62617 4 7.94789 4.28095 7.4478 4.78105C6.9477 5.28115 6.66675 5.95942 6.66675 6.66667V16M18.6667 4L25.3334 10.6667M25.3334 10.6667V16M26.0001 20L30.0001 28M26.0001 28L30.0001 20M2.66675 24H4.66675C5.19718 24 5.70589 23.7893 6.08096 23.4142C6.45603 23.0391 6.66675 22.5304 6.66675 22C6.66675 21.4696 6.45603 20.9609 6.08096 20.5858C5.70589 20.2107 5.19718 20 4.66675 20H2.66675V28M10.6667 24H12.6667C13.1972 24 13.7059 23.7893 14.081 23.4142C14.456 23.0391 14.6667 22.5304 14.6667 22C14.6667 21.4696 14.456 20.9609 14.081 20.5858C13.7059 20.2107 13.1972 20 12.6667 20H10.6667V28M18.0001 20H22.0001M20.0001 20V28","stroke","currentColor","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"],["d","M18.6667 4V9.33333C18.6667 9.68696 18.8072 10.0261 19.0573 10.2761C19.3073 10.5262 19.6465 10.6667 20.0001 10.6667H25.3334M18.6667 4H9.33341C8.62617 4 7.94789 4.28095 7.4478 4.78105C6.9477 5.28115 6.66675 5.95942 6.66675 6.66667V16M18.6667 4L25.3334 10.6667M25.3334 10.6667V16L25.5001 25.3333C25.5001 26.0406 25.2192 26.7189 24.7191 27.219C24.219 27.719 23.5407 28 22.8335 28H9.50012C8.79288 28 8.1146 27.719 7.6145 27.219C7.11441 26.7189 6.83346 26.0406 6.83346 25.3333L6.66675 16.1667","stroke","currentColor","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"]],template:function(t,o){if(t&1&&p(0,l1n,9,8,"ng-container",1)(1,s1n,2,2,"ng-template",null,0,Me),t&2){let a=Ce(2);g("ngIf",(o.type==null?null:o.type.includes("video"))||(o.type==null?null:o.type.includes("audio"))||(o.type==null?null:o.type.includes("pdf"))||(o.type==null?null:o.type.includes("wordprocessingml.document"))||(o.type==null?null:o.type.includes("csv"))||(o.type==null?null:o.type.includes("json"))||(o.type==null?null:o.type.includes("spreadsheetml.sheet"))||(o.type==null?null:o.type.includes("vnd.ms-excel"))||(o.type==null?null:o.type.includes("presentationml.presentation")))("ngIfElse",a)}},dependencies:[se],encapsulation:2,changeDetection:0});let n=r;return n})();function c1n(n,r){if(n&1&&(_(0,"div",3),de(),_(1,"svg",4)(2,"mask",5),D(3,"path",6),y(),D(4,"path",7),y()()),n&2){let i=c(2);T("aria-hidden",!0),m(2),g("id",ch("mask-",i.veltId)),m(2),T("mask","url(#mask-"+i.veltId+")")}}function d1n(n,r){if(n&1){let i=K();h(0),_(1,"velt-comment-dialog-portal-internal",8),G("togglePinSelection",function(t){N(i);let o=c(2);return o.togglePinSelection(o.commentAnnotations[0]),F(t.stopPropagation())})("saveComment",function(t){N(i);let o=c(2);return F(o.saveComment(t,o.commentAnnotations[0]))}),_(2,"div",9),G("click",function(t){return N(i),F(t.stopPropagation())})("pointerup",function(t){N(i);let o=c(2);return o.togglePinSelection(o.commentAnnotations[0]),F(t.stopPropagation())}),_(3,"div",10),de(),_(4,"svg",11),D(5,"path",12)(6,"rect",13),y(),bt(),_(7,"div",14),D(8,"snippyly-user-avatar",15),y()(),_(9,"div",16),de(),_(10,"svg",4),D(11,"rect",17)(12,"circle",18),y()()()(),f()}if(n&2){let i=c(2);m(),g("annotation",i.commentAnnotations[0])("commentPinType","chart")("commentPinSelected",!!i.selectedAnnotationsMap[i.commentAnnotations[0]==null?null:i.commentAnnotations[0].annotationId])("user",i.user),m(),ve("selected",!!i.selectedAnnotationsMap[i.commentAnnotations[0]==null?null:i.commentAnnotations[0].annotationId])("ghost-comment",i.ghostComment),T("data-testid",i.componentId+"-dialog-portal"),m(),T("aria-hidden",!0),m(5),g("size",15)("user",i.commentAnnotations[0]==null?null:i.commentAnnotations[0].from),m(),T("aria-hidden",!0)}}function m1n(n,r){if(n&1){let i=K();h(0),_(1,"div",1),G("click",function(){N(i);let t=c();return F(t.addChartComment())}),p(2,c1n,5,4,"div",2)(3,d1n,13,13,"ng-container",0),y(),f()}if(n&2){let i=c();m(),ve("ghost-comment",i.ghostComment),T("role","button")("tabindex",0)("data-testid",i.componentId),m(),g("ngIf",!(i.commentAnnotations!=null&&i.commentAnnotations.length)),m(),g("ngIf",i.commentAnnotations==null?null:i.commentAnnotations.length)}}var Sxe=(()=>{let r=class r extends Ct{set _commentMetadata(e){try{let t=e;typeof e=="string"&&(t=JSON.parse(e)),this.commentMetadata=t,this.filterCommentAnnotationsByCommentMetadata()}catch{}}set _dialogMetadataTemplate(e){try{let t=e;typeof e=="string"&&(t=JSON.parse(e)),this.dialogMetadataTemplate=t}catch{}}set _ghostComment(e){try{let t=e;typeof e=="string"&&(t=JSON.parse(e)),this.ghostComment=t}catch{}}constructor(e,t,o,a,l,s,d){super(d,s),this.authService=e,this.commentService=t,this.docService=o,this.domService=a,this.loggingService=l,this.themeService=s,this.elementRef=d,this.dialogMetadataTemplate=["x","y","value"],this.ghostComment=!1,this.selectedAnnotationsMap={},this.allCommentAnnotations=[],this.commentAnnotations=[],this.subscriptions=[],this.veltId=St(),this.veltElement=!0,this.componentId="velt-chart-comment";try{this.loggingService.log("%c[WB] Creating COMPONENT ChartCommentComponent","color: blue;"),this.subscriptions.push(this.authService.getUser$().subscribe(v=>{this.user=v}))}catch(v){this.loggingService.catch("Error in ChartCommentComponent constructor: ",v)}}ngOnInit(){try{this.loggingService.log("%c[WB] Calling ChartCommentComponent FUNCTION: OnInit","color: green;"),this.setupA11yAttributes(),this.subscriptions.push(this.docService.getLocation$().subscribe(()=>{this.filterCommentAnnotationsByCommentMetadata()})),this.getChartCommentAnnotations(),this.subscriptions.push(this.domService.getSelectedAnnotationsMap$().subscribe(e=>{this.selectedAnnotationsMap=e||{},this.checkSelectedCommentAnnotation()}))}catch(e){this.loggingService.catch("Error in ChartCommentComponent OnInit: ",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","region"),e.setAttribute("aria-label","Chart comment region")}catch(e){this.loggingService.catch("Error in ChartCommentComponent setupA11yAttributes:",e)}}getChartCommentAnnotations(){try{this.loggingService.log("%c[WB] Calling ChartCommentComponent FUNCTION: getChartCommentAnnotations","color: green;"),this.subscriptions.push(this.commentService.getCommentAnnotationsOnCurrentOrganizationAndDocument$().pipe(fe(e=>this.docService.getLocation$().pipe(ge(()=>e))),ge(e=>e?.filter(t=>t.commentType==="chart")),xt((e,t)=>JSON.stringify(e||[])===JSON.stringify(t||[]))).subscribe(e=>{this.allCommentAnnotations=e||[],this.filterCommentAnnotationsByCommentMetadata(),this.checkSelectedCommentAnnotation()}))}catch(e){this.loggingService.catch("Error in ChartCommentComponent getChartCommentAnnotations: ",e)}}checkSelectedCommentAnnotation(){try{this.loggingService.log("%c[WB] Calling ChartCommentComponent FUNCTION: checkSelectedCommentAnnotation","color: green;");let e;this.commentAnnotations.forEach(t=>{this.selectedAnnotationsMap[t.annotationId]&&(e=t)}),e?this.selectedCommentAnnotation=e:this.selectedCommentAnnotation=void 0}catch(e){this.loggingService.catch("Error in ChartCommentComponent checkSelectedCommentAnnotation: ",e)}}addChartComment(){try{if(this.loggingService.log("%c[WB] Calling ChartCommentComponent FUNCTION: addChartComment","color: green;"),!this.commentAnnotations?.length){let e=b({},this.commentMetadata);this.dialogMetadataTemplate&&(e.metadataTemplate=this.dialogMetadataTemplate);let t=this.docService.getAdditionLocationFromElement(this.elementRef?.nativeElement);if(t?.id){let o=this.docService.getLocationByClientLocationId(t.id);o&&(t=o)}this.commentService.addComment(void 0,void 0,void 0,void 0,void 0,void 0,e,t)}}catch(e){this.loggingService.catch("Error in ChartCommentComponent addChartComment: ",e)}}filterCommentAnnotationsByCommentMetadata(){try{this.loggingService.log("%c[WB] Calling ChartCommentComponent FUNCTION: filterCommentAnnotationsByCommentMetadata","color: green;"),this.commentMetadata?this.commentAnnotations=this.allCommentAnnotations?.filter(e=>{let t=e.metadata||{};for(let o in this.commentMetadata||{})if(t[o]!==this.commentMetadata[o])return!1;return!0}):this.commentAnnotations=[]}catch(e){this.commentAnnotations=[],this.loggingService.catch("Error in ChartCommentComponent filterCommentAnnotationsByCommentMetadata: ",e)}}togglePinSelection(e){try{if(this.loggingService.log("%c[WB] Calling ChartCommentComponent FUNCTION: togglePinSelection","color: green;"),e)if(this.selectedAnnotationsMap[e?.annotationId])document.querySelector(`[${V.ATTRIBUTES.VELT_ANNOTATION_DRAFT}="${e?.annotationId}"]`)?this.domService.resetSelectedAnnotationsMap(!0,"comments"):this.domService.toggleAnnotationSelection(e);else{let t=document.querySelector(`[${V.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);if(t||(t=(this.domService.getDraftCommentAnnotationDialogs()||[])[0]),t){let o=t.getAttribute(V.ATTRIBUTES.VELT_ANNOTATION_DRAFT);if(o){let a=document.getElementById(`comment-pin-container-${o}`)||document.querySelector(`[data-velt-id='${o}']`);a&&(a.scrollIntoView({behavior:"auto",block:"center",inline:"center"}),this.domService.resetSelectedAnnotationsMap(!0,"comments"))}}else this.domService.resetSelectedAnnotationsMap(!0,"comments"),this.domService.toggleAnnotationSelection(e)}}catch(t){this.loggingService.catch("Error in ChartCommentComponent togglePinSelection: ",t)}}saveComment(e,t){try{this.loggingService.log("%c[WB] Calling ChartCommentComponent FUNCTION: saveComment","color: green;"),t&&this.commentService.saveComment(t,e)}catch(o){this.loggingService.catch("Error in ChartCommentComponent saveComment: ",o)}}ngOnDestroy(){this.loggingService.log("%c[WB] Calling ChartCommentComponent FUNCTION: ngOnDestroy","color: green;");try{super.ngOnDestroy(),this.unsubscribe()}catch(e){this.loggingService.catch("Error in ChartCommentComponent ondestroy: ",e)}}unsubscribe(){this.loggingService.log("%c[WB] Calling ChartCommentComponent FUNCTION: unsubscribe","color: green;");try{this.subscriptions.map(e=>{e.unsubscribe()}),this.subscriptions=[]}catch(e){this.loggingService.catch("Error in ChartCommentComponent unsubscribe: ",e)}}};r.\u0275fac=function(t){return new(t||r)(C(Ge),C(Pe),C(lt),C(Ve),C(x),C(mt),C(z))},r.\u0275cmp=O({type:r,selectors:[["app-chart-comment"]],hostVars:2,hostBindings:function(t,o){t&2&&T("data-velt-id",o.veltId)("data-velt-element",o.veltElement)},inputs:{_commentMetadata:[0,"commentMetadata","_commentMetadata"],_dialogMetadataTemplate:[0,"dialogMetadataTemplate","_dialogMetadataTemplate"],_ghostComment:[0,"ghostComment","_ghostComment"]},standalone:!1,features:[L],decls:1,vars:1,consts:[[4,"ngIf"],[1,"velt-chart-comment--container",3,"click"],["class","velt-chart-comment--dot-no-comments",4,"ngIf"],[1,"velt-chart-comment--dot-no-comments"],["width","12","height","12","viewBox","0 0 12 12","fill","none","xmlns","http://www.w3.org/2000/svg"],["fill","white",3,"id"],["d","M0 6C0 2.68629 2.68629 0 6 0C9.31371 0 12 2.68629 12 6C12 9.31371 9.31371 12 6 12H1C0.447715 12 0 11.5523 0 11V6Z"],["d","M0 6C0 2.68629 2.68629 0 6 0C9.31371 0 12 2.68629 12 6C12 9.31371 9.31371 12 6 12H1C0.447715 12 0 11.5523 0 11V6Z","fill","white","stroke","currentColor","stroke-width","3"],[3,"togglePinSelection","saveComment","annotation","commentPinType","commentPinSelected","user"],[1,"velt-chart-comment--pin-container",3,"click","pointerup"],[1,"velt-chart-comment--pin"],["width","20","height","20","viewBox","0 0 20 20","fill","none","xmlns","http://www.w3.org/2000/svg",0,"xmlns","xlink","http://www.w3.org/1999/xlink"],["d","M0.625 10C0.625 4.82233 4.82233 0.625 10 0.625C15.1777 0.625 19.375 4.82233 19.375 10C19.375 15.1777 15.1777 19.375 10 19.375H0.625V10Z","fill","white","stroke","currentColor","stroke-width","1.25"],["x","2.5","y","2.5","width","15","height","15","rx","7.5"],[1,"velt-chart-comment--user-avatar-container"],[3,"size","user"],[1,"velt-chart-comment--dot"],["x","0.75","y","0.75","width","10.5","height","10.5","rx","5.25","fill","white","stroke","currentColor","stroke-width","1.5"],["cx","6","cy","6","r","2.25","fill","currentColor"]],template:function(t,o){t&1&&p(0,m1n,4,7,"ng-container",0),t&2&&g("ngIf",o.commentMetadata)},dependencies:[se,ri,Zy],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}[_nghost-%COMP%]{--velt-green: var(--velt-light-mode-green);--velt-magenta: var(--velt-light-mode-magenta);--velt-amber: var(--velt-light-mode-amber);--velt-purple: var(--velt-light-mode-purple);--velt-cyan: var(--velt-light-mode-cyan);--velt-orange: var(--velt-light-mode-orange);--velt-black: var(--velt-light-mode-black);--velt-white: var(--velt-light-mode-white);--velt-gray: var(--velt-light-mode-gray);--velt-error: var(--velt-light-mode-error);--velt-error-hover: var(--velt-light-mode-error-hover);--velt-error-foreground: var(--velt-light-mode-error-foreground);--velt-error-light: var(--velt-light-mode-error-light);--velt-error-transparent: var(--velt-light-mode-error-transparent);--velt-warning: var(--velt-light-mode-warning);--velt-warning-hover: var(--velt-light-mode-warning-hover);--velt-warning-foreground: var(--velt-light-mode-warning-foreground);--velt-warning-light: var(--velt-light-mode-warning-light);--velt-warning-transparent: var(--velt-light-mode-warning-transparent);--velt-success: var(--velt-light-mode-success);--velt-success-hover: var(--velt-light-mode-success-hover);--velt-success-foreground: var(--velt-light-mode-success-foreground);--velt-success-light: var(--velt-light-mode-success-light);--velt-success-transparent: var(--velt-light-mode-success-transparent);--velt-accent: var(--velt-light-mode-accent);--velt-accent-text: var(--velt-light-mode-accent-text);--velt-accent-hover: var(--velt-light-mode-accent-hover);--velt-accent-foreground: var(--velt-light-mode-accent-foreground);--velt-accent-light: var(--velt-light-mode-accent-light);--velt-accent-transparent: var(--velt-light-mode-accent-transparent);--velt-text-0: var(--velt-light-mode-text-0);--velt-text-1: var(--velt-light-mode-text-1);--velt-text-2: var(--velt-light-mode-text-2);--velt-text-3: var(--velt-light-mode-text-3);--velt-text-4: var(--velt-light-mode-text-4);--velt-text-5: var(--velt-light-mode-text-5);--velt-text-6: var(--velt-light-mode-text-6);--velt-text-7: var(--velt-light-mode-text-7);--velt-text-8: var(--velt-light-mode-text-8);--velt-text-9: var(--velt-light-mode-text-9);--velt-text-10: var(--velt-light-mode-text-10);--velt-text-11: var(--velt-light-mode-text-11);--velt-text-12: var(--velt-light-mode-text-12);--velt-background-0: var(--velt-light-mode-background-0);--velt-background-1: var(--velt-light-mode-background-1);--velt-background-2: var(--velt-light-mode-background-2);--velt-background-3: var(--velt-light-mode-background-3);--velt-background-4: var(--velt-light-mode-background-4);--velt-background-5: var(--velt-light-mode-background-5);--velt-background-6: var(--velt-light-mode-background-6);--velt-background-7: var(--velt-light-mode-background-7);--velt-background-8: var(--velt-light-mode-background-8);--velt-background-9: var(--velt-light-mode-background-9);--velt-background-10: var(--velt-light-mode-background-10);--velt-border-0: var(--velt-light-mode-border-0);--velt-border-1: var(--velt-light-mode-border-1);--velt-border-2: var(--velt-light-mode-border-2);--velt-border-3: var(--velt-light-mode-border-3);--velt-border-4: var(--velt-light-mode-border-4);--velt-border-5: var(--velt-light-mode-border-5);--velt-border-6: var(--velt-light-mode-border-6);--velt-border-7: var(--velt-light-mode-border-7);--velt-border-8: var(--velt-light-mode-border-8);--velt-border-9: var(--velt-light-mode-border-9);--velt-border-10: var(--velt-light-mode-border-10);--velt-background-transparent: var(--velt-light-mode-background-transparent);--velt-border-transparent: var(--velt-light-mode-border-transparent);--velt-animation-transparent: var(--velt-light-mode-animation-transparent);display:inline-flex}[dark][_nghost-%COMP%]{--velt-green: var(--velt-dark-mode-green);--velt-magenta: var(--velt-dark-mode-magenta);--velt-amber: var(--velt-dark-mode-amber);--velt-purple: var(--velt-dark-mode-purple);--velt-cyan: var(--velt-dark-mode-cyan);--velt-orange: var(--velt-dark-mode-orange);--velt-black: var(--velt-dark-mode-black);--velt-white: var(--velt-dark-mode-white);--velt-gray: var(--velt-dark-mode-gray);--velt-error: var(--velt-dark-mode-error);--velt-error-hover: var(--velt-dark-mode-error-hover);--velt-error-foreground: var(--velt-dark-mode-error-foreground);--velt-error-light: var(--velt-dark-mode-error-light);--velt-error-transparent: var(--velt-dark-mode-error-transparent);--velt-warning: var(--velt-dark-mode-warning);--velt-warning-hover: var(--velt-dark-mode-warning-hover);--velt-warning-foreground: var(--velt-dark-mode-warning-foreground);--velt-warning-light: var(--velt-dark-mode-warning-light);--velt-warning-transparent: var(--velt-dark-mode-warning-transparent);--velt-success: var(--velt-dark-mode-success);--velt-success-hover: var(--velt-dark-mode-success-hover);--velt-success-foreground: var(--velt-dark-mode-success-foreground);--velt-success-light: var(--velt-dark-mode-success-light);--velt-success-transparent: var(--velt-dark-mode-success-transparent);--velt-accent: var(--velt-dark-mode-accent);--velt-accent-text: var(--velt-dark-mode-accent-text);--velt-accent-hover: var(--velt-dark-mode-accent-hover);--velt-accent-foreground: var(--velt-dark-mode-accent-foreground);--velt-accent-light: var(--velt-dark-mode-accent-light);--velt-accent-transparent: var(--velt-dark-mode-accent-transparent);--velt-text-0: var(--velt-dark-mode-text-0);--velt-text-1: var(--velt-dark-mode-text-1);--velt-text-2: var(--velt-dark-mode-text-2);--velt-text-3: var(--velt-dark-mode-text-3);--velt-text-4: var(--velt-dark-mode-text-4);--velt-text-5: var(--velt-dark-mode-text-5);--velt-text-6: var(--velt-dark-mode-text-6);--velt-text-7: var(--velt-dark-mode-text-7);--velt-text-8: var(--velt-dark-mode-text-8);--velt-text-9: var(--velt-dark-mode-text-9);--velt-text-10: var(--velt-dark-mode-text-10);--velt-text-11: var(--velt-dark-mode-text-11);--velt-text-12: var(--velt-dark-mode-text-12);--velt-background-0: var(--velt-dark-mode-background-0);--velt-background-1: var(--velt-dark-mode-background-1);--velt-background-2: var(--velt-dark-mode-background-2);--velt-background-3: var(--velt-dark-mode-background-3);--velt-background-4: var(--velt-dark-mode-background-4);--velt-background-5: var(--velt-dark-mode-background-5);--velt-background-6: var(--velt-dark-mode-background-6);--velt-background-7: var(--velt-dark-mode-background-7);--velt-background-8: var(--velt-dark-mode-background-8);--velt-background-9: var(--velt-dark-mode-background-9);--velt-background-10: var(--velt-dark-mode-background-10);--velt-border-0: var(--velt-dark-mode-border-0);--velt-border-1: var(--velt-dark-mode-border-1);--velt-border-2: var(--velt-dark-mode-border-2);--velt-border-3: var(--velt-dark-mode-border-3);--velt-border-4: var(--velt-dark-mode-border-4);--velt-border-5: var(--velt-dark-mode-border-5);--velt-border-6: var(--velt-dark-mode-border-6);--velt-border-7: var(--velt-dark-mode-border-7);--velt-border-8: var(--velt-dark-mode-border-8);--velt-border-9: var(--velt-dark-mode-border-9);--velt-border-10: var(--velt-dark-mode-border-10);--velt-background-transparent: var(--velt-dark-mode-background-transparent);--velt-border-transparent: var(--velt-dark-mode-border-transparent);--velt-animation-transparent: var(--velt-dark-mode-animation-transparent)}.velt-chart-comment--container[_ngcontent-%COMP%]{display:flex;cursor:pointer;color:var(--velt-accent)}.velt-chart-comment--container[_ngcontent-%COMP%] .velt-chart-comment--dot-no-comments[_ngcontent-%COMP%]{opacity:0;visibility:hidden}.velt-chart-comment--container[_ngcontent-%COMP%]:hover .velt-chart-comment--dot-no-comments[_ngcontent-%COMP%]{opacity:1;visibility:visible}.velt-chart-comment--container[_ngcontent-%COMP%] .velt-chart-comment--pin-container{color:var(--velt-accent)}.velt-chart-comment--container[_ngcontent-%COMP%] .velt-chart-comment--pin-container .velt-chart-comment--pin{position:relative;display:flex}.velt-chart-comment--container[_ngcontent-%COMP%] .velt-chart-comment--pin-container .velt-chart-comment--pin .velt-chart-comment--user-avatar-container{position:absolute;top:0;left:0;width:100%;height:100%;display:flex;align-items:center;justify-content:center}.velt-chart-comment--container[_ngcontent-%COMP%] .velt-chart-comment--pin-container .velt-chart-comment--pin .velt-chart-comment--user-avatar-container snippyly-user-avatar{display:flex}.velt-chart-comment--container[_ngcontent-%COMP%] .velt-chart-comment--pin-container .velt-chart-comment--pin{opacity:0;visibility:hidden;display:none}.velt-chart-comment--container[_ngcontent-%COMP%] .velt-chart-comment--pin-container:hover .velt-chart-comment--pin, .velt-chart-comment--container[_ngcontent-%COMP%] .velt-chart-comment--pin-container.selected .velt-chart-comment--pin{opacity:1;visibility:visible;display:flex}.velt-chart-comment--container[_ngcontent-%COMP%] .velt-chart-comment--pin-container:hover .velt-chart-comment--dot, .velt-chart-comment--container[_ngcontent-%COMP%] .velt-chart-comment--pin-container.selected .velt-chart-comment--dot{opacity:0;visibility:hidden;display:none}.velt-chart-comment--container[_ngcontent-%COMP%] .velt-chart-comment--pin-container.ghost-comment{color:var(--velt-gray)}"],changeDetection:0});let n=r;return n})();var yxe=(()=>{let r=class r{transform(e,t,o,a,l,...s){try{return e&&t?.length&&t.filter((v,u,S)=>S.findIndex(k=>k.text===v.text)===u).forEach(v=>{if(v?.text){let u=new RegExp(bc(v.text),"g");e=e.replaceAll(u,S=>`
|
|
557
|
-
<velt-autocomplete-chip type="custom" custom='${
|
|
558
|
-
</velt-autocomplete-chip>`)}}),e&&o?.length
|
|
559
|
-
<velt-autocomplete-chip type="group" group='${
|
|
560
|
-
</velt-autocomplete-chip>`)}}),e&&a?.length
|
|
561
|
-
<velt-autocomplete-chip type="contact" contact='${
|
|
562
|
-
</velt-autocomplete-chip>`)}}),(a?.filter(u=>!u.text).filter((u,S,k)=>k.findIndex(A=>A.userId===u.userId)===S)).forEach(u=>{if(u?.userId){let S=new RegExp(bc(`{{${u.userId}}}`),"g");e=e.replaceAll(S,k=>`<velt-autocomplete-chip type="loading" shadow-dom='${l?"true":"false"}'></velt-autocomplete-chip>`)}})),e}catch{return e}}};r.\u0275fac=function(t){return new(t||r)},r.\u0275pipe=or({name:"replaceAutocompleteList",type:r,pure:!0,standalone:!1});let n=r;return n})();var xxe=(()=>{let r=class r{set _hotkey(e){try{this.hotkey=e,this.setListData()}catch{}}set _listData(e){try{this.listData=g1n(e),this.setListData()}catch{}}constructor(e,t){this.autocompleteService=e,this.loggingService=t,this.hotkey="",this.listData=[];try{this.loggingService.log("%c[WB] Creating COMPONENT AutocompleteComponent","color: blue;")}catch(o){this.loggingService.catch("Error in AutocompleteComponent constructor: ",o)}}setListData(){try{this.loggingService.log("%c[WB] Calling AutocompleteComponent FUNCTION: setListData","color: green;"),v1n(this.hotkey,this.listData)&&this.autocompleteService.create({hotkey:this.hotkey,data:this.listData,type:"custom"})}catch(e){this.loggingService.catch("Error in AutocompleteComponent setListData: ",e)}}ngOnDestroy(){try{this.loggingService.log("%c[WB] Calling AutocompleteComponent FUNCTION: OnDestroy","color: green;"),this.hotkey&&this.autocompleteService.remove(this.hotkey)}catch(e){this.loggingService.catch("Error in AutocompleteComponent OnDestroy: ",e)}}};r.\u0275fac=function(t){return new(t||r)(C(Hl),C(x))},r.\u0275cmp=O({type:r,selectors:[["velt-autocomplete-internal"]],inputs:{_hotkey:[0,"hotkey","_hotkey"],_listData:[0,"listData","_listData"]},standalone:!1,decls:0,vars:0,template:function(t,o){},encapsulation:2,changeDetection:0});let n=r;return n})();function g1n(n){return typeof n=="string"?JSON.parse(n):n}function v1n(n,r){return!!(n&&r?.length)}var Ym=(()=>{let r=class r{constructor(e,t){this.domService=e,this.sanitizer=t}transform(e){try{let t=this.domService.sanitizeSvg(e);return this.sanitizer.bypassSecurityTrustHtml(t)}catch{return e}}};r.\u0275fac=function(t){return new(t||r)(C(Ve,16),C(Jc,16))},r.\u0275pipe=or({name:"safeSvg",type:r,pure:!0,standalone:!1});let n=r;return n})();var p1n=()=>({"line-height":"20px"});function h1n(n,r){if(n&1){let i=K();_(0,"mark",6),G("click",function(){N(i);let t=c(4);return F(t.onClick())}),ne(1),M(2,"translate"),y()}if(n&2){let i=c(3),e=c();ve("velt-autocomplete--contact-chip-current-user",(i==null||i.user==null?null:i.user.userId)&&(i==null||i.contact==null?null:i.contact.userId)===(i==null||i.user==null?null:i.user.userId))("current-user-chip",(i==null||i.user==null?null:i.user.userId)&&(i==null||i.contact==null?null:i.contact.userId)===(i==null||i.user==null?null:i.user.userId)),m(),Ee(" ",R(2,5,(i==null||i.contact==null?null:i.contact.name)||(i==null||i.contact==null?null:i.contact.email)||e.email))}}function f1n(n,r){if(n&1){let i=K();_(0,"mark",7),G("click",function(){N(i);let t=c(4);return F(t.onClick())}),ne(1),M(2,"translate"),y()}if(n&2){let i=c(3);m(),Ee(" ",R(2,1,(i==null||i.group==null||i.group.group==null||i.group.group.metadata==null?null:i.group.group.metadata.groupName)||(i==null||i.group==null?null:i.group.text)))}}function C1n(n,r){if(n&1&&(D(0,"div",9),M(1,"safeSvg")),n&2){let i=c(4);g("innerHtml",R(1,1,i==null||i.custom==null||i.custom.custom==null||i.custom.custom.icon==null?null:i.custom.custom.icon.svg),ji)}}function _1n(n,r){if(n&1&&D(0,"img",10),n&2){let i=c(4);g("src",i==null||i.custom==null||i.custom.custom==null||i.custom.custom.icon==null?null:i.custom.custom.icon.url,pn)}}function b1n(n,r){if(n&1){let i=K();_(0,"div",8),G("click",function(){N(i);let t=c(4);return F(t.onClick())}),ie(1,C1n,2,3,"div",9),ie(2,_1n,1,1,"img",10),_(3,"span"),ne(4),M(5,"translate"),y()()}if(n&2){let i=c(3);m(),re(!(i==null||i.custom==null||i.custom.custom==null||i.custom.custom.icon==null)&&i.custom.custom.icon.svg?1:-1),m(),re(!(i==null||i.custom==null||i.custom.custom==null||i.custom.custom.icon==null)&&i.custom.custom.icon.url?2:-1),m(2),Ke(R(5,3,i==null||i.custom==null||i.custom.custom==null?null:i.custom.custom.name))}}function S1n(n,r){if(n&1&&ie(0,h1n,3,7,"mark",3)(1,f1n,3,3,"mark",4)(2,b1n,6,5,"div",5),n&2){let i=c(3);re(i.type==="contact"?0:i.type==="group"?1:i.type==="custom"?2:-1)}}function y1n(n,r){if(n&1&&D(0,"velt-autocomplete-chip-tooltip-internal",11),n&2){let i=c(2),e=c();g("componentConfigSignal",e.componentConfigSignal)("shadowDom",!!(i!=null&&i.shadowDom))}}function x1n(n,r){n&1&&(_(0,"app-overlay-tooltip"),p(1,S1n,3,1,"ng-template",null,0,Me)(3,y1n,1,2,"ng-template",null,1,Me),y())}function I1n(n,r){n&1&&D(0,"velt-skeleton-loader-internal",2),n&2&&g("borderRadius","4px")("customStyles",yt(2,p1n))}function E1n(n,r){if(n&1&&ie(0,x1n,5,0,"app-overlay-tooltip")(1,I1n,1,3,"velt-skeleton-loader-internal",2),n&2){let i=c();re(i.type!=="loading"?0:1)}}var Ixe=(()=>{let r=class r extends wr{set _custom(e){try{typeof e=="string"&&(e=JSON.parse(e))}catch{}}set _group(e){try{typeof e=="string"&&(e=JSON.parse(e))}catch{}}set _contactData(e){try{typeof e=="string"&&(e=JSON.parse(e))}catch{}}set _encodedContact(e){try{typeof e=="string"&&(e=JSON.parse(e))}catch{}}set _encodedGroup(e){try{typeof e=="string"&&(e=JSON.parse(e))}catch{}}set _encodedCustom(e){try{typeof e=="string"&&(e=JSON.parse(e))}catch{}}set userObject(e){try{if(!e)return;let t=typeof e=="string"?JSON.parse(e):e;this.componentConfigSignal.update(o=>E(b({},o),{type:"contact",contact:t}))}catch(t){this.loggingService.catch("Error parsing userObject:",t)}}set userId(e){try{if(!e)return;let o=(this.contactService.getInternalUserContacts()??[]).find(a=>a.userId===e);o&&this.componentConfigSignal.update(a=>E(b({},a),{type:"contact",contact:o}))}catch(t){this.loggingService.catch("Error looking up userId:",t)}}set _shadowDom(e){try{typeof e=="string"&&(e=JSON.parse(e))}catch{}}constructor(){super(),this.type="contact",this.componentConfigSignal=Oe({type:"contact"}),this.subscriptions=[],this.authService=pe(Ge),this.autocompleteService=pe(Hl),this.contactService=pe(ln);try{this.loggingService.log("%c[WB] Creating COMPONENT AutocompleteChipComponent","color: blue;"),this.subscriptions.push(this.commentService.getDialogShadowDOM$().subscribe(e=>{this.componentConfigSignal.update(t=>(t=E(b({},t),{shadowDom:e}),t))}))}catch(e){this.loggingService.catch("Error in AutocompleteChipComponent constructor: ",e)}}ngOnInit(){try{this.loggingService.log("%c[WB] Calling AutocompleteChipComponent FUNCTION: ngOnInit","color: green;"),super.ngOnInit(),setTimeout(()=>{this.componentConfigSignal().type==="contact"&&(this.email||this.componentConfigSignal().contactData?.contact)&&(this.getCurrentUser(),this.email?(this.getContacts(),this.getUserByEmail(this.email)):this.componentConfigSignal().contactData?.contact&&this.componentConfigSignal.update(e=>(e=E(b({},e),{contact:e.contactData?.contact}),e))),this.componentConfigSignal().type==="group"&&this.getOrganizationGroups()},0)}catch(e){this.loggingService.catch("Error in AutocompleteChipComponent ngOnInit: ",e)}}ngOnChanges(e){try{e&&setTimeout(()=>{Object.keys(e).forEach(t=>{t==="_custom"?this.componentConfigSignal.update(o=>{let a=e[t].currentValue;if(typeof a=="string")try{a=JSON.parse(a)}catch{if(e?._encodedCustom?.currentValue)try{a=JSON.parse(atob(e?._encodedCustom?.currentValue))}catch{}}return o=E(b({},o),{custom:a}),o}):t==="_group"?this.componentConfigSignal.update(o=>{let a=e[t].currentValue;if(typeof a=="string")try{a=JSON.parse(a)}catch{if(e?._encodedGroup?.currentValue)try{a=JSON.parse(atob(e?._encodedGroup?.currentValue))}catch{}}return o=E(b({},o),{group:a}),o}):t==="_contactData"?this.componentConfigSignal.update(o=>{let a=e[t].currentValue;if(typeof a=="string")try{a=JSON.parse(a)}catch{if(e?._encodedContact?.currentValue)try{a=JSON.parse(atob(e?._encodedContact?.currentValue))}catch{}}return o=E(b({},o),{contactData:a}),o}):t==="_shadowDom"?this.componentConfigSignal.update(o=>(o=b({},o),o.shadowDom=typeof e[t].currentValue=="string"?JSON.parse(e[t].currentValue):e[t].currentValue,o)):this.componentConfigSignal.update(o=>(o=E(b({},o),{[t]:e[t].currentValue}),o))})},0)}catch(t){this.loggingService.catch("Error in AutocompleteChipComponent ngOnChanges: ",t)}}getCurrentUser(){try{this.loggingService.log("%c[WB] Calling AutocompleteChipComponent FUNCTION: getCurrentUser","color: green;"),this.subscriptions.push(this.authService.getUser$().subscribe(e=>{this.componentConfigSignal.update(t=>(t=E(b({},t),{user:e}),t))}))}catch(e){this.loggingService.catch("Error in AutocompleteChipComponent getCurrentUser: ",e)}}getContacts(){try{this.loggingService.log("%c[WB] Calling AutocompleteChipComponent FUNCTION: getContacts","color: green;"),this.subscriptions.push(this.contactService.getUserContacts$().subscribe(e=>{let t=e?.find(o=>o.email===this.email);t&&this.componentConfigSignal.update(o=>(o=E(b({},o),{contact:t}),o))}))}catch(e){this.loggingService.catch("Error in AutocompleteChipComponent getContacts: ",e)}}getUserByEmail(e){try{this.loggingService.log("%c[WB] Calling AutocompleteChipComponent FUNCTION: getUserByEmail","color: green;"),this.subscriptions.push(this.contactService.getUserByEmail$(e).subscribe(t=>{t&&this.componentConfigSignal.update(o=>(o=E(b({},o),{contact:t}),o))}))}catch(t){this.loggingService.catch("Error in AutocompleteChipComponent getUserByEmail: ",t)}}getOrganizationGroups(){try{this.loggingService.log("%c[WB] Calling AutocompleteChipComponent FUNCTION: getOrganizationGroups","color: green;"),this.subscriptions.push(this.contactService.getOrganizationGroups$().subscribe(e=>{if(e){let t=e.find(o=>o?.metadata?.groupId===this.componentConfigSignal().group?.groupId);t&&this.componentConfigSignal().group&&this.componentConfigSignal.update(o=>(o=E(b({},o),{group:E(b({},o.group),{group:t})}),o))}}))}catch(e){this.loggingService.catch("Error in AutocompleteChipComponent getOrganizationGroups: ",e)}}onClick(){try{this.loggingService.log("%c[WB] Calling AutocompleteChipComponent FUNCTION: onClick","color: green;");let e;this.componentConfigSignal().custom?.custom?e=E(b({},this.componentConfigSignal().custom?.custom),{type:"custom"}):this.componentConfigSignal().contact?(e={id:this.componentConfigSignal().contact?.userId,name:this.componentConfigSignal().contact?.name,description:this.componentConfigSignal().contact?.email,type:"contact"},this.componentConfigSignal().contact?.photoUrl&&(e.icon={url:this.componentConfigSignal().contact?.photoUrl})):this.componentConfigSignal().type==="contact"&&(e={id:void 0,name:void 0,description:this.email,type:"contact"}),e&&this.autocompleteService.setOnAutocompleteChipClick(e)}catch(e){this.loggingService.catch("Error in AutocompleteChipComponent onClick: ",e)}}unsubscribe(){try{this.loggingService.log("%c[WB] Calling AutocompleteChipComponent FUNCTION: unsubscribe","color: green;"),this.subscriptions.forEach(e=>e?.unsubscribe())}catch(e){this.loggingService.catch("Error in AutocompleteChipComponent unsubscribe: ",e)}}ngOnDestroy(){try{this.loggingService.log("%c[WB] Calling AutocompleteChipComponent FUNCTION: OnDestroy","color: green;"),this.unsubscribe(),super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in AutocompleteChipComponent OnDestroy: ",e)}}};r.\u0275fac=function(t){return new(t||r)},r.\u0275cmp=O({type:r,selectors:[["velt-autocomplete-chip-internal"]],inputs:{type:"type",email:"email",_custom:[0,"custom","_custom"],_group:[0,"group","_group"],_contactData:[0,"contact","_contactData"],_encodedContact:[0,"encodedContact","_encodedContact"],_encodedGroup:[0,"encodedGroup","_encodedGroup"],_encodedCustom:[0,"encodedCustom","_encodedCustom"],userObject:"userObject",userId:"userId",_shadowDom:[0,"shadowDom","_shadowDom"]},standalone:!1,features:[L,it],decls:1,vars:1,consts:[["triggerTemplate",""],["tooltipTemplate",""],["width","64px",3,"borderRadius","customStyles"],[1,"velt-autocomplete--contact-chip",3,"velt-autocomplete--contact-chip-current-user","current-user-chip"],[1,"velt-autocomplete--group-chip"],[1,"custom-chip"],[1,"velt-autocomplete--contact-chip",3,"click"],[1,"velt-autocomplete--group-chip",3,"click"],[1,"custom-chip",3,"click"],[1,"custom-chip-icon","custom-chip-icon-svg",3,"innerHtml"],[1,"custom-chip-icon","custom-chip-icon-img",3,"src"],[3,"componentConfigSignal","shadowDom"]],template:function(t,o){if(t&1&&ie(0,E1n,2,1),t&2){let a;re((a=o.componentConfigSignal())?0:-1,a)}},dependencies:[Pd,kf,ao,Ym,ue],styles:["[_nghost-%COMP%]{display:inline-flex;line-height:32px}.custom-chip[_ngcontent-%COMP%]{color:var(--velt-accent-text);background:var(--velt-accent-transparent);border-radius:var(--velt-border-radius-xs);word-break:break-word;padding:var(--velt-spacing-xs);margin:1px;gap:var(--velt-spacing-xs);opacity:0px;font-size:var(--velt-font-size-sm);font-style:normal;font-weight:400;line-height:120%;text-align:left;color:var(--velt-accent);display:inline-flex;align-items:center;justify-content:center;text-decoration:none}.custom-chip[_ngcontent-%COMP%] .custom-chip-icon[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center}.custom-chip[_ngcontent-%COMP%] .custom-chip-icon.custom-chip-icon-img[_ngcontent-%COMP%]{max-height:12px}"],changeDetection:0});let n=r;return n})();var k1n=["customBtnRef"],T1n=["*"],w1n=n=>({componentConfigSignal:n}),D1n=(n,r)=>({condition:n,data:r}),O1n=(n,r,i,e,t,o)=>({template:n,componentName:r,variant:i,suffix:e,setIfCondition:t,componentElementRef:o});function A1n(n,r){if(n&1&&(_(0,"div",5)(1,"button",8),M(2,"translate"),de(),_(3,"svg",9)(4,"g",10),D(5,"path",11),y(),_(6,"defs")(7,"clipPath",12),D(8,"rect",13),y()()()()()),n&2){let i=c(4);T("data-testid",i.componentId+"-default-button"),m(),T("aria-label",R(2,2,"Open user tagging menu"))}}function P1n(n,r){n&1&&Xe(0)}function M1n(n,r){if(n&1&&(h(0),ie(1,A1n,9,4,"div",5),_(2,"div",6,1),p(4,P1n,1,0,"ng-container",7),y(),f()),n&2){c();let i=Ce(6),e=c(),t=c();m(),re(e!=null&&e.showDefaultBtn?1:-1),m(),T("data-testid",t.componentId+"-custom-container"),m(2),g("ngTemplateOutlet",i)}}function R1n(n,r){n&1&&jt(0)}function N1n(n,r){if(n&1){let i=K();h(0),_(1,"div",3),M(2,"translate"),M(3,"translate"),G("pointerdown",function(){N(i);let t=c(2);return F(t.onPointerDown())})("click",function(){N(i);let t=c(2);return F(t.onClick())}),p(4,M1n,5,3,"ng-container",4),y(),p(5,R1n,1,0,"ng-template",null,0,Me),f()}if(n&2){let i=c(),e=c();m(),g("title",R(2,6,"Tag a user")),T("data-testid",e.componentId)("aria-expanded",!1)("aria-label",R(3,8,"Mention user"))("aria-controls",e.componentId+"-popup"),m(3),g("veltDynamicTemplate",vi(10,O1n,e.template,i==null||i.componentMeta==null?null:i.componentMeta.componentName,i==null||i.componentMeta==null?null:i.componentMeta.variant,i==null||i.componentMeta==null?null:i.componentMeta.suffix,e.setIfCondition.bind(e),e.elementRef))}}function F1n(n,r){if(n&1&&p(0,N1n,7,17,"ng-container",2),n&2){let i=c();g("veltIf",w(3,D1n,i.conditionSignal(),$(1,w1n,i.componentConfigSignal)))}}var vK=(()=>{let r=class r extends wr{constructor(){super(),this.triggerElement=null,this.hotkey="@",this.buttonClick=new Fe,this.deviceInfo=new ii,this.savedRange=null,this.componentConfigSignal=Oe({componentMeta:void 0,showDefaultBtn:!1}),this.veltElement=!0,this.componentId="velt-autocomplete-tool"}ngOnInit(){try{super.ngOnInit()}catch(e){this.loggingService.catch("Error in AutocompleteToolComponent ngOnInit:",e)}}ngOnChanges(e){try{e&&Object.keys(e).forEach(t=>{this.componentConfigSignal.update(o=>(o=E(b({},o),{[t]:e[t].currentValue}),o))})}catch(t){this.loggingService.catch("Error in AutocompleteToolComponent ngOnChanges: ",t)}}ngAfterViewInit(){try{this.customBtnRef?.nativeElement?.children?.length||this.componentConfigSignal.update(e=>(e=E(b({},e),{showDefaultBtn:!0}),e))}catch(e){this.loggingService.catch("Error in AutocompleteToolComponent ngAfterViewInit: ",e)}}ngOnDestroy(){super.ngOnDestroy()}setupA11yAttributes(){try{this.hostElementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in AutocompleteToolComponent setupA11yAttributes:",e)}}onPointerDown(){try{let e=this.trigger?this.trigger._element?.nativeElement:this.triggerElement;if(e?.hasAttribute("contenteditable")){let t=window.getSelection();if(t&&t.rangeCount>0){let o=t.getRangeAt(0);e.contains(o.startContainer)&&(this.savedRange=o.cloneRange())}}}catch(e){this.loggingService.catch("Error in onPointerDown:",e)}}onClick(){try{if(this.trigger||this.triggerElement){let e=this.trigger?this.trigger._element?.nativeElement:null;if(!e&&this.triggerElement&&(e=this.triggerElement),e){if(e?.focus(),this.savedRange&&e.contains(this.savedRange.startContainer)){let t=window.getSelection();t?.removeAllRanges(),t?.addRange(this.savedRange)}if(e?.hasAttribute("contenteditable")){let t=null;try{t=window.getSelection()?.getRangeAt(0)||null}catch{}let o=t?.startContainer,a=t?.startOffset??0;if(t&&o&&e.contains(o)){let l;if(o.nodeType===Node.TEXT_NODE){let d=o.splitText(a);o=d.previousSibling,l=document.createTextNode(this.hotkey),e.insertBefore(l,d)}else l=document.createTextNode(this.hotkey),e.insertBefore(l,o.childNodes[a]);t=document.createRange(),t.setStart(l,l.length),t.collapse(!0);let s=window.getSelection();s?.removeAllRanges(),s?.addRange(t)}else{let l=document.createTextNode(this.hotkey);e.appendChild(l),this.setCursorToEndOfContenteditable(e)}setTimeout(()=>{let l=new InputEvent("input",{data:this.hotkey,inputType:"insertText"});e?.dispatchEvent(l)},100)}else if(["input","textarea"].includes(e?.tagName?.toLowerCase())){let t=new InputEvent("input",{data:this.hotkey,inputType:"insertText"});e?.dispatchEvent(t)}this.savedRange=null}}this.buttonClick.emit()}catch(e){this.loggingService.catch("Error in AutocompleteToolComponent onClick: ",e)}}setCursorToEndOfContenteditable(e){this.loggingService.log("%c[WB] Calling FUNCTION: setCursorToEndOfContenteditable","color: green;");try{let t,o;document.createRange&&(t=document.createRange(),t.selectNodeContents(e),t.collapse(!1),o=window.getSelection(),o?.removeAllRanges(),o?.addRange(t))}catch(t){this.loggingService.catch("Error in AutocompleteToolComponent setCursorToEndOfContenteditable: ",t)}}};r.\u0275fac=function(t){return new(t||r)},r.\u0275cmp=O({type:r,selectors:[["velt-autocomplete-tool-internal"]],viewQuery:function(t,o){if(t&1&&dt(k1n,5),t&2){let a;ot(a=at())&&(o.customBtnRef=a.first)}},hostVars:1,hostBindings:function(t,o){t&2&&T("data-velt-element",o.veltElement)},inputs:{trigger:"trigger",triggerElement:"triggerElement",hotkey:"hotkey",template:"template",componentMeta:"componentMeta"},outputs:{buttonClick:"buttonClick"},standalone:!1,features:[j([I]),L,it],ngContentSelectors:T1n,decls:1,vars:1,consts:[["content",""],["customBtnRef",""],[4,"veltIf"],["role","combobox","tabindex","0",1,"velt-autocomplete-tool",3,"pointerdown","click","title"],[4,"veltDynamicTemplate"],[1,"action-btn"],[1,"custom-btn-container"],[4,"ngTemplateOutlet"],["type","button",1,"action__button"],["width","18","height","18","viewBox","0 0 18 18","fill","none","xmlns","http://www.w3.org/2000/svg","aria-hidden","true","role","img"],["clip-path","url(#clip0_12828_43447)"],["d","M12.2142 9.00926C12.2142 9.86174 11.8756 10.6793 11.2728 11.2821C10.67 11.8849 9.85244 12.2235 8.99996 12.2235C8.14748 12.2235 7.32992 11.8849 6.72712 11.2821C6.12432 10.6793 5.78568 9.86174 5.78568 9.00926C5.78568 8.15678 6.12432 7.33921 6.72712 6.73641C7.32992 6.13362 8.14748 5.79497 8.99996 5.79497C9.85244 5.79497 10.67 6.13362 11.2728 6.73641C11.8756 7.33921 12.2142 8.15678 12.2142 9.00926ZM12.2142 9.00926L12.2142 10.2146C12.2142 10.7474 12.4259 11.2584 12.8026 11.6351C13.1794 12.0119 13.6904 12.2235 14.2232 12.2235C14.756 12.2235 15.267 12.0119 15.6437 11.6351C16.0204 11.2584 16.2321 10.7474 16.2321 10.2146V9.00926C16.2341 7.45523 15.7355 5.9419 14.8101 4.69343C13.8847 3.44496 12.5818 2.52777 11.0944 2.07773C9.60695 1.62769 8.01411 1.66873 6.55183 2.19478C5.08955 2.72083 3.83561 3.7039 2.97575 4.99837C2.1159 6.29284 1.69588 7.82985 1.77791 9.38171C1.85994 10.9336 2.43965 12.4177 3.43118 13.6143C4.4227 14.8109 5.7733 15.6563 7.28288 16.0253C8.79247 16.3943 10.3808 16.2672 11.8125 15.6628","stroke","currentColor","stroke-width","1.6","stroke-linecap","round","stroke-linejoin","round"],["id","clip0_12828_43447"],["width","18","height","18","fill","white"]],template:function(t,o){if(t&1&&(Wt(),ie(0,F1n,1,6,"ng-container")),t&2){let a;re((a=o.componentConfigSignal())?0:-1,a)}},dependencies:[Nt,Q,ae,ue],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}[_nghost-%COMP%]{--velt-green: var(--velt-light-mode-green);--velt-magenta: var(--velt-light-mode-magenta);--velt-amber: var(--velt-light-mode-amber);--velt-purple: var(--velt-light-mode-purple);--velt-cyan: var(--velt-light-mode-cyan);--velt-orange: var(--velt-light-mode-orange);--velt-black: var(--velt-light-mode-black);--velt-white: var(--velt-light-mode-white);--velt-gray: var(--velt-light-mode-gray);--velt-error: var(--velt-light-mode-error);--velt-error-hover: var(--velt-light-mode-error-hover);--velt-error-foreground: var(--velt-light-mode-error-foreground);--velt-error-light: var(--velt-light-mode-error-light);--velt-error-transparent: var(--velt-light-mode-error-transparent);--velt-warning: var(--velt-light-mode-warning);--velt-warning-hover: var(--velt-light-mode-warning-hover);--velt-warning-foreground: var(--velt-light-mode-warning-foreground);--velt-warning-light: var(--velt-light-mode-warning-light);--velt-warning-transparent: var(--velt-light-mode-warning-transparent);--velt-success: var(--velt-light-mode-success);--velt-success-hover: var(--velt-light-mode-success-hover);--velt-success-foreground: var(--velt-light-mode-success-foreground);--velt-success-light: var(--velt-light-mode-success-light);--velt-success-transparent: var(--velt-light-mode-success-transparent);--velt-accent: var(--velt-light-mode-accent);--velt-accent-text: var(--velt-light-mode-accent-text);--velt-accent-hover: var(--velt-light-mode-accent-hover);--velt-accent-foreground: var(--velt-light-mode-accent-foreground);--velt-accent-light: var(--velt-light-mode-accent-light);--velt-accent-transparent: var(--velt-light-mode-accent-transparent);--velt-text-0: var(--velt-light-mode-text-0);--velt-text-1: var(--velt-light-mode-text-1);--velt-text-2: var(--velt-light-mode-text-2);--velt-text-3: var(--velt-light-mode-text-3);--velt-text-4: var(--velt-light-mode-text-4);--velt-text-5: var(--velt-light-mode-text-5);--velt-text-6: var(--velt-light-mode-text-6);--velt-text-7: var(--velt-light-mode-text-7);--velt-text-8: var(--velt-light-mode-text-8);--velt-text-9: var(--velt-light-mode-text-9);--velt-text-10: var(--velt-light-mode-text-10);--velt-text-11: var(--velt-light-mode-text-11);--velt-text-12: var(--velt-light-mode-text-12);--velt-background-0: var(--velt-light-mode-background-0);--velt-background-1: var(--velt-light-mode-background-1);--velt-background-2: var(--velt-light-mode-background-2);--velt-background-3: var(--velt-light-mode-background-3);--velt-background-4: var(--velt-light-mode-background-4);--velt-background-5: var(--velt-light-mode-background-5);--velt-background-6: var(--velt-light-mode-background-6);--velt-background-7: var(--velt-light-mode-background-7);--velt-background-8: var(--velt-light-mode-background-8);--velt-background-9: var(--velt-light-mode-background-9);--velt-background-10: var(--velt-light-mode-background-10);--velt-border-0: var(--velt-light-mode-border-0);--velt-border-1: var(--velt-light-mode-border-1);--velt-border-2: var(--velt-light-mode-border-2);--velt-border-3: var(--velt-light-mode-border-3);--velt-border-4: var(--velt-light-mode-border-4);--velt-border-5: var(--velt-light-mode-border-5);--velt-border-6: var(--velt-light-mode-border-6);--velt-border-7: var(--velt-light-mode-border-7);--velt-border-8: var(--velt-light-mode-border-8);--velt-border-9: var(--velt-light-mode-border-9);--velt-border-10: var(--velt-light-mode-border-10);--velt-background-transparent: var(--velt-light-mode-background-transparent);--velt-border-transparent: var(--velt-light-mode-border-transparent);--velt-animation-transparent: var(--velt-light-mode-animation-transparent)}[dark][_nghost-%COMP%]{--velt-green: var(--velt-dark-mode-green);--velt-magenta: var(--velt-dark-mode-magenta);--velt-amber: var(--velt-dark-mode-amber);--velt-purple: var(--velt-dark-mode-purple);--velt-cyan: var(--velt-dark-mode-cyan);--velt-orange: var(--velt-dark-mode-orange);--velt-black: var(--velt-dark-mode-black);--velt-white: var(--velt-dark-mode-white);--velt-gray: var(--velt-dark-mode-gray);--velt-error: var(--velt-dark-mode-error);--velt-error-hover: var(--velt-dark-mode-error-hover);--velt-error-foreground: var(--velt-dark-mode-error-foreground);--velt-error-light: var(--velt-dark-mode-error-light);--velt-error-transparent: var(--velt-dark-mode-error-transparent);--velt-warning: var(--velt-dark-mode-warning);--velt-warning-hover: var(--velt-dark-mode-warning-hover);--velt-warning-foreground: var(--velt-dark-mode-warning-foreground);--velt-warning-light: var(--velt-dark-mode-warning-light);--velt-warning-transparent: var(--velt-dark-mode-warning-transparent);--velt-success: var(--velt-dark-mode-success);--velt-success-hover: var(--velt-dark-mode-success-hover);--velt-success-foreground: var(--velt-dark-mode-success-foreground);--velt-success-light: var(--velt-dark-mode-success-light);--velt-success-transparent: var(--velt-dark-mode-success-transparent);--velt-accent: var(--velt-dark-mode-accent);--velt-accent-text: var(--velt-dark-mode-accent-text);--velt-accent-hover: var(--velt-dark-mode-accent-hover);--velt-accent-foreground: var(--velt-dark-mode-accent-foreground);--velt-accent-light: var(--velt-dark-mode-accent-light);--velt-accent-transparent: var(--velt-dark-mode-accent-transparent);--velt-text-0: var(--velt-dark-mode-text-0);--velt-text-1: var(--velt-dark-mode-text-1);--velt-text-2: var(--velt-dark-mode-text-2);--velt-text-3: var(--velt-dark-mode-text-3);--velt-text-4: var(--velt-dark-mode-text-4);--velt-text-5: var(--velt-dark-mode-text-5);--velt-text-6: var(--velt-dark-mode-text-6);--velt-text-7: var(--velt-dark-mode-text-7);--velt-text-8: var(--velt-dark-mode-text-8);--velt-text-9: var(--velt-dark-mode-text-9);--velt-text-10: var(--velt-dark-mode-text-10);--velt-text-11: var(--velt-dark-mode-text-11);--velt-text-12: var(--velt-dark-mode-text-12);--velt-background-0: var(--velt-dark-mode-background-0);--velt-background-1: var(--velt-dark-mode-background-1);--velt-background-2: var(--velt-dark-mode-background-2);--velt-background-3: var(--velt-dark-mode-background-3);--velt-background-4: var(--velt-dark-mode-background-4);--velt-background-5: var(--velt-dark-mode-background-5);--velt-background-6: var(--velt-dark-mode-background-6);--velt-background-7: var(--velt-dark-mode-background-7);--velt-background-8: var(--velt-dark-mode-background-8);--velt-background-9: var(--velt-dark-mode-background-9);--velt-background-10: var(--velt-dark-mode-background-10);--velt-border-0: var(--velt-dark-mode-border-0);--velt-border-1: var(--velt-dark-mode-border-1);--velt-border-2: var(--velt-dark-mode-border-2);--velt-border-3: var(--velt-dark-mode-border-3);--velt-border-4: var(--velt-dark-mode-border-4);--velt-border-5: var(--velt-dark-mode-border-5);--velt-border-6: var(--velt-dark-mode-border-6);--velt-border-7: var(--velt-dark-mode-border-7);--velt-border-8: var(--velt-dark-mode-border-8);--velt-border-9: var(--velt-dark-mode-border-9);--velt-border-10: var(--velt-dark-mode-border-10);--velt-background-transparent: var(--velt-dark-mode-background-transparent);--velt-border-transparent: var(--velt-dark-mode-border-transparent);--velt-animation-transparent: var(--velt-dark-mode-animation-transparent)}*[_ngcontent-%COMP%]{box-sizing:border-box}.action__button[_ngcontent-%COMP%]{border:0;border-radius:var(--velt-border-radius-full);width:calc((2rem + 0px) * var(--velt-base-rem-unit));height:calc((2rem + 0px) * var(--velt-base-rem-unit));flex-shrink:0;display:flex;align-items:center;justify-content:center;background:transparent;transition:.5s;color:var(--velt-text-10)}.action__button[_ngcontent-%COMP%]:hover{background:var(--velt-background-3);cursor:pointer}@media (max-width: 768px){button[_ngcontent-%COMP%]{padding:0}}"],changeDetection:0});let n=r;return n})();var L1n=["*"],U1n=new Set(["autocomplete-id","class","style","id","ng-reflect-autocomplete-id","ng-version","_nghost","_ngcontent"]),Exe=(()=>{let r=class r{constructor(e,t,o,a){this.coreService=e,this.elementRef=t,this.registry=o,this.loggingService=a,this.parentContextData={},this.onParentPayload=l=>{try{!this.autocompleteId&&l.autocompleteId&&(this.autocompleteId=l.autocompleteId),this.parentContextData=l.contextData||{},this.initializeAndBroadcast()}catch(s){this.loggingService.catch("[AUTOCOMPLETE CONTEXT WRAPPER] Error in onParentPayload:",s)}}}ngOnInit(){try{if(this.findAndConnectToParent(),this.parentRegistry){this.parentRegistry.register(this.onParentPayload);let e=this.parentRegistry.getLastPayload?.();e&&this.onParentPayload(e)}this.initializeAndBroadcast()}catch(e){this.loggingService.catch("[AUTOCOMPLETE CONTEXT WRAPPER] Error in ngOnInit:",e)}}findAndConnectToParent(){try{let t=this.elementRef.nativeElement.parentElement;for(;t;){if(t.tagName?.toLowerCase()==="velt-autocomplete-context-wrapper"){let o=t.__veltContext;if(o?.registry instanceof Bm){this.parentWrapper=o.wrapperRef,this.parentRegistry=o.registry;return}let a=window.ng;if(a?.getComponent){let s=a.getComponent(t);if(s?.registry){this.parentWrapper=s,this.parentRegistry=s.registry;return}}let l=t.__ngContext__;if(l&&Array.isArray(l))for(let s=0;s<l.length;s++){let d=l[s];if(d&&typeof d=="object"&&d.registry instanceof Bm){this.parentWrapper=d,this.parentRegistry=d.registry;return}}}t=t.parentElement}}catch(e){this.loggingService.catch("[AUTOCOMPLETE CONTEXT WRAPPER] Error finding parent wrapper:",e)}}ngOnChanges(e){try{e.autocompleteId&&!e.autocompleteId.firstChange&&this.initializeAndBroadcast()}catch(t){this.loggingService.catch("[AUTOCOMPLETE CONTEXT WRAPPER] Error in ngOnChanges:",t)}}ngOnDestroy(){try{let e=this.autocompleteId&&!this.parentWrapper;if(this.parentRegistry&&this.parentRegistry.unregister(this.onParentPayload),this.elementRef?.nativeElement&&(this.elementRef.nativeElement.__veltContext=void 0),this.parentWrapper=void 0,this.parentRegistry=void 0,e){let t=this.autocompleteId,o=this.registry;setTimeout(()=>{let a=this.coreService.getRegistry(t);(a===o||!a)&&this.coreService.clearContextConfig(t)},0)}}catch(e){this.loggingService.catch("[AUTOCOMPLETE CONTEXT WRAPPER] Error in ngOnDestroy:",e)}}collectAttributes(){let e={};try{let o=this.elementRef.nativeElement.attributes;for(let a=0;a<o.length;a++){let l=o[a],s=l.name.toLowerCase();U1n.has(s)||s.startsWith("_ng")||s.startsWith("ng-")||(e[s]=l.value)}}catch(t){this.loggingService.catch("[AUTOCOMPLETE CONTEXT WRAPPER] Error collecting attributes:",t)}return e}initializeAndBroadcast(){try{let e=this.autocompleteId||this.parentContextData["autocomplete-id"];if(!e)return;this.autocompleteId&&(this.coreService.getOrCreateContextConfig(this.autocompleteId),this.coreService.setRegistry(this.autocompleteId,this.registry),this.elementRef.nativeElement.setAttribute("autocomplete-id",this.autocompleteId));let t=this.collectAttributes(),o=b(b({},this.parentContextData),t);this.elementRef.nativeElement.__veltContext={registry:this.registry,autocompleteId:e,contextData:o,wrapperRef:this};let a={autocompleteId:e,contextData:o};this.registry.broadcast(a)}catch(e){this.loggingService.catch("[AUTOCOMPLETE CONTEXT WRAPPER] Error in initializeAndBroadcast:",e)}}};r.\u0275fac=function(t){return new(t||r)(C(f_),C(z),C(Bm),C(x))},r.\u0275cmp=O({type:r,selectors:[["velt-autocomplete-context-wrapper"]],inputs:{autocompleteId:"autocompleteId"},standalone:!1,features:[j([Bm]),it],ngContentSelectors:L1n,decls:1,vars:0,template:function(t,o){t&1&&(Wt(),jt(0))},styles:["[_nghost-%COMP%]{display:contents}"],changeDetection:0});let n=r;return n})();var B1n=["commentPinRef"];function V1n(n,r){if(n&1){let i=K();h(0),_(1,"div",2),G("pointerup",function(t){return N(i),c(2).togglePinSelection(),F(t.stopPropagation())})("touchend",function(t){return N(i),t.stopPropagation(),F(t.preventDefault())})("click",function(t){return N(i),F(t.stopPropagation())}),_(2,"snippyly-comment-pin",3,0),G("togglePinSelection",function(t){N(i);let o=c(2);return F(o.togglePinSelection(t))})("saveComment",function(t){N(i);let o=c(2);return F(o.saveComment(t))}),y()(),f()}if(n&2){let i=c().ngIf,e=c();m(),T("data-testid",e.componentId)("role","button")("tabindex",0),m(),g("annotation",i.commentPinAnnotation)("variant",e.variant)("containerComponentId",i.componentId)("commentPinSelected",!!i.commentPinSelected)("multipleCommentPinSelected",i.selectedAnnotationsMap[i.commentPinAnnotation==null?null:i.commentPinAnnotation.annotationId]&&e.objectKeys(i.selectedAnnotationsMap).length>1)("user",i.user),T("data-testid",e.componentId+"-pin")("aria-hidden","true")}}function j1n(n,r){if(n&1&&(h(0),p(1,V1n,4,11,"ng-container",1),f()),n&2){let i=r.ngIf;m(),g("ngIf",i.commentPinAnnotation&&i.user)}}var kxe=(()=>{let r=class r{set _folderId(e){try{this.componentConfigSignal.update(t=>(t=E(b({},t),{folderId:e}),t?.folderId?t.veltFolderId=Mi(t.folderId):t.veltFolderId=void 0,t)),this.getCommentAnnotationsForCommentPin()}catch{}}set _clientDocumentId(e){try{this.componentConfigSignal.update(t=>(t=E(b({},t),{clientDocumentId:e}),t?.clientDocumentId?t.documentId=this.docService.generateDocumentId(t.clientDocumentId):t.documentId=void 0,t)),this.getCommentAnnotationsForCommentPin()}catch{}}set _locationId(e){try{this.componentConfigSignal.update(t=>(t=E(b({},t),{locationId:e}),t)),this.getCommentAnnotationsForCommentPin()}catch{}}set _context(e){try{let t=e;typeof e=="string"&&(t=JSON.parse(e)),t&&typeof t=="object"&&this.componentConfigSignal.update(o=>(o=E(b({},o),{context:t}),o)),this.getCommentAnnotationsForCommentPin()}catch{}}set _contextOptions(e){try{let t=e;typeof e=="string"&&(t=JSON.parse(e)),t&&typeof t=="object"&&this.componentConfigSignal.update(o=>(o=E(b({},o),{contextOptions:t}),o)),this.getCommentAnnotationsForCommentPin()}catch{}}constructor(e,t,o,a,l,s,d){this.authService=e,this.commentService=t,this.docService=o,this.domService=a,this.loggingService=l,this.elementRef=s,this.commentActionsService=d,this.variant="default",this.objectKeys=Object.keys,this.resolvedCommentsOnDom=!1,this.componentConfigSignal=Oe({commentPinAnnotation:void 0,user:null,selectedAnnotationsMap:{},selectedAnnotationsLocationMap:{},componentId:`velt-comment-pin-${St()}`}),this.subscriptions=[],this.componentId="velt-comment-pin",this.uniqueComponentId="velt-comment-pin-"+St();try{this.loggingService.log("%c[WB] Creating Class: VeltCommentPinComponent","color: blue;"),this.temporaryMultiThreadAnnotationId=`temp_${this.uniqueComponentId}`,this.subscriptions.push(this.authService.getUser$().subscribe(v=>{this.componentConfigSignal.update(u=>(u=E(b({},u),{user:v}),u))})),this.subscriptions.push(this.domService.getSelectedAnnotationsMap$().subscribe(v=>{this.componentConfigSignal.update(u=>(u=E(b({},u),{selectedAnnotationsMap:v}),u)),this.checkCommentPinSelected()},v=>{this.catchError("Error in VeltCommentPinComponent getSelectedAnnotationsMap$ subscription: ",v)})),this.subscriptions.push(this.domService.getSelectedAnnotationsLocationMap$().subscribe(v=>{this.componentConfigSignal.update(u=>(u=E(b({},u),{selectedAnnotationsLocationMap:v}),u)),this.checkCommentPinSelected()},v=>{this.catchError("Error in VeltCommentPinComponent getSelectedAnnotationsLocationMap$ subscription: ",v)})),this.subscriptions.push(this.commentService.getGroupMatchedComments$().subscribe(v=>{this.componentConfigSignal.update(u=>(u=E(b({},u),{groupMatchedComments:v}),u))})),this.subscriptions.push(this.commentService.updateCommentDialogPositionTrigger$().subscribe(()=>{try{this.commentPinRef&&(this.componentConfigSignal().selectedAnnotationsMap&&this.componentConfigSignal().commentPinAnnotation?.annotationId&&this.componentConfigSignal().selectedAnnotationsMap[this.componentConfigSignal().commentPinAnnotation.annotationId])&&this.commentPinRef.updateOverlayPosition()}catch(v){this.catchError("Error in VeltCommentPinComponent updateCommentDialogPositionTrigger$: ",v)}},v=>{this.catchError("Error in VeltCommentPinComponent updateCommentDialogPositionTrigger$ subscription: ",v)}))}catch(v){this.catchError("Error in VeltCommentPinComponent constructor: ",v)}}ngOnInit(){this.setupA11yAttributes()}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in VeltCommentPinComponent setupA11yAttributes:",e)}}togglePinSelection(e){try{let t=e||this.componentConfigSignal().commentPinAnnotation;if(t&&this.commentActionsService.onCommentPinClick(t).catch(o=>{this.catchError("Error in VeltCommentPinComponent togglePinSelection onCommentPinClick: ",o)}),this.componentConfigSignal().selectedAnnotationsMap[t.annotationId])t?.ghostComment?.type!==Fs.DIFFERENT_DEVICE&&document.querySelector(`[${V.ATTRIBUTES.VELT_ANNOTATION_DRAFT}="${t?.annotationId}"]`)&&this.domService.resetSelectedAnnotationsMap(!0,"comments");else{let o=document.querySelector(`[${V.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);if(o||(o=(this.domService.getDraftCommentAnnotationDialogs()||[])[0]),o){let a=o.getAttribute(V.ATTRIBUTES.VELT_ANNOTATION_DRAFT);if(a){let l=document.getElementById(`comment-pin-container-${a}`)||document.querySelector(`[data-velt-id='${a}']`);l&&(l.scrollIntoView({behavior:"auto",block:"center",inline:"center"}),this.domService.resetSelectedAnnotationsMap(!0,"comments"))}}else this.domService.resetSelectedAnnotationsMap(!0,"comments"),this.domService.toggleAnnotationSelection(t,this.componentConfigSignal().componentId)}}catch(t){this.catchError("Error in VeltCommentPinComponent togglePinSelection: ",t)}}ngOnChanges(e){try{this.loggingService.log("%c[WB] Calling VeltCommentPinComponent FUNCTION: ngOnChanges","color: green;"),e?.annotationId&&this.annotationId&&this.getCommentAnnotationsForCommentPin(),e?.multiThreadAnnotationId&&this.multiThreadAnnotationId&&this.getMultiThreadCommentAnnotationByAnnotationId(this.multiThreadAnnotationId)}catch(t){this.catchError("Error in VeltCommentPinComponent ngOnChanges: ",t)}}getCommentAnnotationsForCommentPin(){try{this.loggingService.log("%c[WB] Calling VeltCommentPinComponent FUNCTION: getCommentAnnotationByAnnotationId","color: green;"),this.commentAnnotationByAnnotationIdSubscription&&(this.commentAnnotationByAnnotationIdSubscription.unsubscribe(),this.commentAnnotationByAnnotationIdSubscription=void 0);let e;(this.componentConfigSignal().folderId||this.componentConfigSignal().clientDocumentId)&&(e=this.componentConfigSignal().locationId),this.commentAnnotationByAnnotationIdSubscription=this.commentService.getCommentAnnotationsForCommentComponent({type:"pin",annotationId:this.annotationId,folderId:this.componentConfigSignal().folderId,veltFolderId:this.componentConfigSignal().veltFolderId,clientDocumentId:this.componentConfigSignal().clientDocumentId,documentId:this.componentConfigSignal().documentId,context:this.componentConfigSignal().context,contextOptions:this.componentConfigSignal().contextOptions,locationId:e}).pipe(fe(t=>this.commentService.getResolvedCommentsOnDom$().pipe(ge(o=>(this.resolvedCommentsOnDom=o,t)))),fe(t=>this.domService.getSelectedAnnotationsMap$().pipe(ge(o=>({commentPinAnnotation:t?.[0],selectedAnnotationsMap:o||{},commentAnnotations:t||[]}))))).subscribe(t=>{let o=null,a=!1,l=[];if(this.resolvedCommentsOnDom||this.componentConfigSignal().groupMatchedComments&&!this.annotationId)l=t?.commentAnnotations?.slice()||[];else{let d=t?.commentAnnotations?.filter(u=>u?.status?.type!=="terminal"),v=t?.commentAnnotations?.[0];d?.length?l=d:v&&t?.selectedAnnotationsMap?.[v.annotationId]&&(l=[v])}if(l?.length&&this.componentConfigSignal().groupMatchedComments&&!this.annotationId&&(a=l?.length>1||!l?.[0]?.isDraft),a){o=new i_,o.annotationId=this.temporaryMultiThreadAnnotationId,o.isTemporary=!0,o.from=l?.[0]?.from,o.metadata=l?.[0]?.metadata;let d,v=this.componentConfigSignal().locationId;v&&(d=this.docService.getLocationByClientLocationId(v),d||(d={id:v}));let u;d&&(u=this.docService.genarateLocationId(d)),d&&u&&(o.location=d,o.locationId=u),this.componentConfigSignal().context&&(o.context=this.componentConfigSignal().context),o.commentAnnotationsMap={},o.commentAnnotations={};for(let S of l||[])S.annotationId&&(o.commentAnnotationsMap||(o.commentAnnotationsMap={}),o.commentAnnotationsMap[S.annotationId]=S,o.commentAnnotations||(o.commentAnnotations={}),o.commentAnnotations[S.annotationId]=!0)}let s=l?.length?l[l?.length-1]:null;o&&(s=o),this.componentConfigSignal.update(d=>(d=E(b({},d),{commentPinAnnotation:s,commentAnnotations:l||[]}),d)),this.checkCommentPinSelected()})}catch(e){this.catchError("Error in VeltCommentPinComponent getCommentAnnotationByAnnotationId: ",e)}}getMultiThreadCommentAnnotationByAnnotationId(e){try{this.loggingService.log("%c[WB] Calling VeltCommentPinComponent FUNCTION: getMultiThreadCommentAnnotationByAnnotationId","color: green;"),this.multiThreadCommentAnnotationByAnnotationIdSubscription&&(this.multiThreadCommentAnnotationByAnnotationIdSubscription.unsubscribe(),this.multiThreadCommentAnnotationByAnnotationIdSubscription=void 0),this.multiThreadCommentAnnotationByAnnotationIdSubscription=this.commentService.getMultiThreadCommentAnnotationByAnnotationId(e).subscribe(t=>{this.componentConfigSignal.update(o=>(o=E(b({},o),{commentPinAnnotation:t}),o)),this.checkCommentPinSelected()})}catch(t){this.catchError("Error in VeltCommentPinComponent getMultiThreadCommentAnnotationByAnnotationId: ",t)}}checkCommentPinSelected(){try{let e=this.componentConfigSignal().selectedAnnotationsMap,t=this.componentConfigSignal().commentPinAnnotation,o=this.componentConfigSignal().sourceId;if(t){let a=!!e[t.annotationId];if(a)if(t?.isDraft)t?.sourceId&&(a=t?.sourceId===o,a&&this.domService.setSelectedAnnotationLocation(t.annotationId,this.componentConfigSignal().componentId));else{let l=this.componentConfigSignal().selectedAnnotationsLocationMap?.[t.annotationId];l&&(a=l===this.componentConfigSignal().componentId)}a!==this.componentConfigSignal().commentPinSelected&&this.componentConfigSignal.update(l=>(l=E(b({},l),{commentPinSelected:a}),l))}}catch(e){this.catchError("Error in VeltCommentPinComponent checkCommentPinSelected: ",e)}}unsubscribe(){try{this.loggingService.log("%c[WB] Calling VeltCommentPinComponent FUNCTION: unsubscribe","color: green;"),this.commentAnnotationByAnnotationIdSubscription&&(this.commentAnnotationByAnnotationIdSubscription.unsubscribe(),this.commentAnnotationByAnnotationIdSubscription=void 0),this.subscriptions.forEach(e=>{e.unsubscribe()})}catch(e){this.catchError("Error in VeltCommentPinComponent unsubscribe: ",e)}}ngOnDestroy(){try{this.loggingService.log("%c[WB] Calling VeltCommentPinComponent FUNCTION: ngOnDestroy","color: green;"),this.unsubscribe()}catch(e){this.catchError("Error in VeltCommentPinComponent ngOnDestroy: ",e)}}saveComment(e){try{this.commentService.saveComment(this.componentConfigSignal().commentPinAnnotation,e)}catch(t){this.catchError("Error in VeltCommentPinComponent saveComment: ",t)}}catchError(e,t,o){try{this.loggingService.catch(e,t,E(b({},o||{}),{annotationId:this.componentConfigSignal()?.commentPinAnnotation?.annotationId}))}catch{}}};r.\u0275fac=function(t){return new(t||r)(C(Ge),C(Pe),C(lt),C(Ve),C(x),C(z),C(Pn))},r.\u0275cmp=O({type:r,selectors:[["velt-comment-pin-internal"]],viewQuery:function(t,o){if(t&1&&dt(B1n,5),t&2){let a;ot(a=at())&&(o.commentPinRef=a.first)}},inputs:{annotationId:"annotationId",multiThreadAnnotationId:"multiThreadAnnotationId",variant:"variant",_folderId:[0,"folderId","_folderId"],_clientDocumentId:[0,"documentId","_clientDocumentId"],_locationId:[0,"locationId","_locationId"],_context:[0,"context","_context"],_contextOptions:[0,"contextOptions","_contextOptions"]},standalone:!1,features:[it],decls:1,vars:1,consts:[["commentPinRef",""],[4,"ngIf"],[1,"velt-comment-pin",3,"pointerup","touchend","click"],[3,"togglePinSelection","saveComment","annotation","variant","containerComponentId","commentPinSelected","multipleCommentPinSelected","user"]],template:function(t,o){t&1&&p(0,j1n,2,1,"ng-container",1),t&2&&g("ngIf",o.componentConfigSignal())},dependencies:[se,pp],styles:[".velt-comment-pin[_ngcontent-%COMP%]{width:fit-content}"],changeDetection:0});let n=r;return n})();function $1n(n,r){if(n&1){let i=K();h(0),_(1,"div",2),M(2,"translate"),G("pointerup",function(t){let o=N(i).$implicit;return c(2).togglePinSelection(o.commentAnnotation),F(t.stopPropagation())}),_(3,"snippyly-comment-pin",3),G("saveComment",function(t){let o=N(i).$implicit,a=c(2);return F(a.saveComment(t,o.commentAnnotation))}),y()(),f()}if(n&2){let i=r.$implicit,e=c(2);m(),ct("top",(i==null||i.position==null?null:i.position.y)+((e.position==null?null:e.position.y)||0),"px")("left",(i==null||i.position==null?null:i.position.x)+((e.position==null?null:e.position.x)||0),"px"),T("role","button")("aria-label",R(2,14,"Comment pin"))("aria-pressed",!!e.selectedAnnotationsMap[i.commentAnnotation==null?null:i.commentAnnotation.annotationId])("data-testid",e.componentId+(i.commentAnnotation==null?null:i.commentAnnotation.annotationId))("tabindex",0),m(2),g("annotation",i.commentAnnotation)("commentPinSelected",e.selectedAnnotationsMap[i.commentAnnotation==null?null:i.commentAnnotation.annotationId]&&e.objectKeys(e.selectedAnnotationsMap).length===1)("multipleCommentPinSelected",e.selectedAnnotationsMap[i.commentAnnotation==null?null:i.commentAnnotation.annotationId]&&e.objectKeys(e.selectedAnnotationsMap).length>1)("user",e.user),T("aria-hidden",!0)}}function H1n(n,r){if(n&1&&(h(0),p(1,$1n,4,16,"ng-container",1),f()),n&2){let i=c();m(),g("ngForOf",i.canvasCommentAnnotations)("ngForTrackBy",i.canvasCommentsTrackBy)}}var Txe=(()=>{let r=class r{set _position(e){try{let t=e;typeof e=="string"&&(t=JSON.parse(e)),this.position=t}catch{}}constructor(e,t,o,a,l,s){this.authService=e,this.docService=t,this.domService=o,this.commentService=a,this.loggingService=l,this.elementRef=s,this.position={},this.selectedAnnotationsMap={},this.canvasCommentAnnotations=[],this.objectKeys=Object.keys,this.commentAnnotations=[],this.subscriptions=[],this.componentId="velt-canvas-comment";try{this.loggingService.log("%c[WB] Creating Class: CanvasCommentComponent","color: blue;"),this.subscriptions.push(this.authService.getUser$().subscribe(d=>{this.user=d})),this.subscriptions.push(this.domService.getSelectedAnnotationsMap$().subscribe(d=>{this.selectedAnnotationsMap=d},d=>{this.loggingService.catch("Error in CanvasCommentComponent getSelectedAnnotationsMap$ subscription: ",d)})),this.subscriptions.push(this.docService.getDocumentPaths$().pipe(fe(d=>d?this.commentService.getAllCommentAnnotations({customClientDocumentId:d?.clientDocumentId,analytics:{enabled:!0,properties:{source:"internal",sourceId:"canvasComment"}}}):[])).subscribe(d=>{this.commentAnnotations=d||[],this.filterCanvasCommentAnnotations()}))}catch(d){this.loggingService.catch("Error in CanvasCommentComponent constructor: ",d)}}ngOnInit(){try{this.setupA11yAttributes(),this.filterCanvasCommentAnnotations()}catch(e){this.loggingService.catch("Error in CanvasCommentComponent ngOnInit: ",e)}}ngOnDestroy(){try{this.subscriptions.forEach(e=>{e.unsubscribe()})}catch{}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CanvasCommentComponent setupA11yAttributes:",e)}}canvasCommentsTrackBy(e,t){return t.commentAnnotation.annotationId||""}filterCanvasCommentAnnotations(){try{this.canvasId?this.canvasCommentAnnotations=(this.commentAnnotations||[]).filter(e=>e?.context?.canvasCommentConfig?.id===this.canvasId).map(e=>({position:e.context.canvasCommentConfig.position,commentAnnotation:e})):this.canvasCommentAnnotations=[]}catch(e){this.loggingService.catch("Error in CanvasCommentComponent filterCanvasCommentAnnotations: ",e)}}togglePinSelection(e){try{if(this.selectedAnnotationsMap[e.annotationId])e?.ghostComment?.type!==Fs.DIFFERENT_DEVICE&&document.querySelector(`[${V.ATTRIBUTES.VELT_ANNOTATION_DRAFT}="${e?.annotationId}"]`)&&this.domService.resetSelectedAnnotationsMap(!0,"comments");else{let t=document.querySelector(`[${V.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);if(t||(t=(this.domService.getDraftCommentAnnotationDialogs()||[])[0]),t){let o=t.getAttribute(V.ATTRIBUTES.VELT_ANNOTATION_DRAFT);if(o){let a=document.getElementById(`comment-pin-container-${o}`)||document.querySelector(`[data-velt-id='${o}']`);a&&(a.scrollIntoView({behavior:"auto",block:"center",inline:"center"}),this.domService.resetSelectedAnnotationsMap(!0,"comments"))}}else this.domService.resetSelectedAnnotationsMap(!0,"comments"),this.domService.toggleAnnotationSelection(e)}}catch(t){this.loggingService.catch("Error in CanvasCommentComponent togglePinSelection: ",t)}}saveComment(e,t){try{this.commentService.saveComment(t,e)}catch(o){this.loggingService.catch("Error in CanvasCommentComponent saveComment: ",o)}}};r.\u0275fac=function(t){return new(t||r)(C(Ge),C(lt),C(Ve),C(Pe),C(x),C(z))},r.\u0275cmp=O({type:r,selectors:[["app-canvas-comment"]],inputs:{canvasId:"canvasId",_position:[0,"position","_position"]},standalone:!1,decls:1,vars:1,consts:[[4,"ngIf"],[4,"ngFor","ngForOf","ngForTrackBy"],[1,"velt-canvas-comment-pin",3,"pointerup"],[3,"saveComment","annotation","commentPinSelected","multipleCommentPinSelected","user"]],template:function(t,o){t&1&&p(0,H1n,2,2,"ng-container",0),t&2&&g("ngIf",o.user)},dependencies:[Vt,se,pp,ue],styles:[".velt-canvas-comment-pin[_ngcontent-%COMP%]{position:absolute;transform:translateY(-100%)}"],changeDetection:0});let n=r;return n})();function z1n(n,r){if(n&1&&(h(0),D(1,"app-comments-minimap",1),M(2,"translate"),f()),n&2){let i=c().ngIf,e=c();m(),g("commentAnnotations",i.commentAnnotations)("user",i.user)("position",i.position)("targetScrollableElementId",i.targetScrollableElementId),T("data-testid",e.componentId+"-minimap")("role","complementary")("aria-label",R(2,8,"Comments minimap"))("aria-hidden",!(i.commentAnnotations!=null&&i.commentAnnotations.length))}}function G1n(n,r){if(n&1&&(h(0),p(1,z1n,3,10,"ng-container",0),f()),n&2){let i=r.ngIf;m(),g("ngIf",i.user)}}var wxe=(()=>{let r=class r{constructor(e,t,o,a){this.authService=e,this.commentService=t,this.loggingService=o,this.elementRef=a,this.targetScrollableElementId=null,this.position="right",this.componentConfigSignal=Oe({commentAnnotations:[],user:null,position:"right",targetScrollableElementId:null}),this.subscriptions=[],this.componentId="velt-comments-minimap";try{this.loggingService.log("%c[WB] Creating CLASS: VeltCommentsMinimapComponent","color: blue;"),this.subscriptions.push(this.authService.getUser$().subscribe(l=>{this.componentConfigSignal.update(s=>(s=E(b({},s),{user:l}),s))},l=>{this.loggingService.catch("Error in VeltCommentsMinimapComponent getUser$: ",l)})),this.subscriptions.push(this.commentService.getCommentAnnotationsFromCommentsContainer$().subscribe(l=>{this.componentConfigSignal.update(s=>(s=E(b({},s),{commentAnnotations:l}),s))},l=>{this.loggingService.catch("Error in VeltCommentsMinimapComponent getCommentAnnotationsFromCommentsContainer$: ",l)}))}catch(l){this.loggingService.catch("Error in VeltCommentsMinimapComponent constructor: ",l)}}ngOnInit(){this.setupA11yAttributes()}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in VeltCommentsMinimapComponent setupA11yAttributes:",e)}}ngOnChanges(e){try{e&&Object.keys(e).forEach(t=>{this.componentConfigSignal.update(o=>(o=E(b({},o),{[t]:e[t].currentValue}),o))})}catch(t){this.loggingService.catch("Error in VeltCommentsMinimapComponent ngOnChanges: ",t)}}ngOnDestroy(){try{this.subscriptions.forEach(e=>{e.unsubscribe()})}catch(e){this.loggingService.catch("Error in VeltCommentsMinimapComponent ngOnDestroy: ",e)}}};r.\u0275fac=function(t){return new(t||r)(C(Ge),C(Pe),C(x),C(z))},r.\u0275cmp=O({type:r,selectors:[["velt-comments-minimap-internal"]],inputs:{targetScrollableElementId:"targetScrollableElementId",position:"position"},standalone:!1,features:[it],decls:1,vars:1,consts:[[4,"ngIf"],[3,"commentAnnotations","user","position","targetScrollableElementId"]],template:function(t,o){t&1&&p(0,G1n,2,1,"ng-container",0),t&2&&g("ngIf",o.componentConfigSignal())},dependencies:[se,CN,ue],encapsulation:2,changeDetection:0});let n=r;return n})();var W1n=["waveformContainer"];function q1n(n,r){n&1&&(de(),_(0,"svg",14),D(1,"rect",15),y())}function Y1n(n,r){if(n&1&&(_(0,"div",16),ne(1),M(2,"translate"),y()),n&2){let i=c().index,e=c(4);m(),Ee(" ",R(2,1,e.indexToTimeSignal()[i])," ")}}function K1n(n,r){if(n&1&&(_(0,"div",8)(1,"div",9)(2,"p"),ne(3,"."),y()(),D(4,"div",10),_(5,"div",11),p(6,q1n,2,0,"svg",12)(7,Y1n,3,3,"div",13),y()()),n&2){let i=r.$implicit,e=r.index;m(),ct("height",i+"px"),ve("silent",i===2),m(5),g("ngIf",e%10===0),m(),g("ngIf",e%10===0)}}function Z1n(n,r){if(n&1&&(h(0),_(1,"div",4),D(2,"div",5),_(3,"div",6),p(4,K1n,8,6,"div",7),y()(),f()),n&2){let i=c(2).ngIf,e=c();m(4),g("ngForOf",i.barHeights)("ngForTrackBy",e.trackByBarHeights)}}function X1n(n,r){if(n&1&&(h(0),p(1,Z1n,5,2,"ng-container",1),f()),n&2){let i=c().ngIf;m(),g("ngIf",i.isAudio)}}function J1n(n,r){if(n&1&&(_(0,"div",9)(1,"p"),ne(2,"."),y()()),n&2){let i=r.$implicit;ct("height",i+"px")}}function Q1n(n,r){if(n&1&&(_(0,"div",18),p(1,J1n,3,2,"div",19),y()),n&2){let i=c(2).ngIf,e=c();ve("thread-mode",i.threadMode),m(),g("ngForOf",i.barHeights)("ngForTrackBy",e.trackByBarHeights)}}function e_n(n,r){if(n&1&&(h(0),p(1,Q1n,2,4,"div",17),f()),n&2){let i=c().ngIf;m(),g("ngIf",i.isAudio&&(i.collapsedMode||i.threadMode))}}function t_n(n,r){if(n&1&&(_(0,"div",9)(1,"p"),ne(2,"."),y()()),n&2){let i=r.$implicit,e=r.index,t=c(2).ngIf;ct("height",i+"px"),ve("active-bar",e<=t.activeBarIndex)}}function n_n(n,r){if(n&1&&(h(0),_(1,"div",20),p(2,t_n,3,4,"div",21),y(),f()),n&2){let i=c().ngIf,e=c();m(2),g("ngForOf",i.barHeights)("ngForTrackBy",e.trackByBarHeights)}}function i_n(n,r){if(n&1&&(_(0,"div",8)(1,"div",9)(2,"p"),ne(3,"."),y()()()),n&2){let i=r.$implicit;m(),ct("height",i+"px")}}function r_n(n,r){if(n&1&&(h(0),_(1,"div",22)(2,"div",4),D(3,"div",5),_(4,"div",6),p(5,i_n,4,2,"div",7),y()()(),f()),n&2){let i=c().ngIf,e=c();m(5),g("ngForOf",i.barHeights)("ngForTrackBy",e.trackByBarHeights)}}function o_n(n,r){if(n&1&&D(0,"div",25),n&2){let i=r.$implicit;ct("height",i,"px")}}function a_n(n,r){if(n&1&&(h(0),_(1,"div",23),p(2,o_n,1,2,"div",24),y(),f()),n&2){let i=c().ngIf,e=c();m(2),g("ngForOf",i.barHeights)("ngForTrackBy",e.trackByBarHeights)}}function l_n(n,r){if(n&1&&(h(0),_(1,"div",26,0),de(),_(3,"svg",27)(4,"defs")(5,"linearGradient",28),D(6,"stop",29)(7,"stop",30)(8,"stop",31),y()(),D(9,"path",32),y()(),f()),n&2){let i=c().ngIf;m(9),T("d",i.mirroredWaveformPath)}}function s_n(n,r){if(n&1&&(h(0)(1,2),p(2,X1n,2,1,"ng-container",3)(3,e_n,2,1,"ng-container",3)(4,n_n,3,2,"ng-container",3)(5,r_n,6,2,"ng-container",3)(6,a_n,3,2,"ng-container",3)(7,l_n,10,1,"ng-container",3),f()()),n&2){let i=r.ngIf;m(),g("ngSwitch",i==null?null:i.variant),m(),g("ngSwitchCase","expanded"),m(),g("ngSwitchCase","minified"),m(),g("ngSwitchCase","player"),m(),g("ngSwitchCase","preview"),m(),g("ngSwitchCase","preview-mini"),m(),g("ngSwitchCase","editor")}}var Qy=(()=>{let r=class r{constructor(e,t){this.loggingService=e,this.recorderService=t,this.height=144,this.isRecording=!1,this.variant="expanded",this.isAudio=!1,this.collapsedMode=!1,this.threadMode=!1,this.numberOfBars=38,this.muteMic=null,this.maxVolumeArray=[],this.allowCleanUp=!0,this.animationFrameId=null,this.lastDrawTime=0,this.drawInterval=50,this.componentConfigSignal=Oe({variant:"expanded",isAudio:!1,barHeights:[],collapsedMode:!1,threadMode:!1,activeBarIndex:-1,mirroredWaveformPath:""}),this.indexToTimeSignal=_e(()=>{let o=this.componentConfigSignal().barHeights||[],a=[];for(let l=0;l<o.length;l++){let s=this.indexToTime(l);a.push(s)}return a}),this.showWaveform=()=>{try{if(!this.bufferArray||this.bufferArray.length===0)return;let o=this.bufferArray.length/this.numberOfBars,a=[];for(let l=0;l<this.numberOfBars;l++){let s=l*o,d=s+o,v=0,u=0;for(let A=Math.floor(s);A<d&&A<this.bufferArray.length;A++)v+=this.bufferArray[A],u++;let k=(u>0?v/u:0)/255*this.height*3;a.push(k)}this.componentConfigSignal.update(l=>E(b({},l),{barHeights:a})),this.updateMirroredWaveformPath()}catch(o){this.loggingService.warn("Error in AudioWaveformComponent showWaveform: ",o)}},this.draw=()=>{try{if(!this.analyzer)return;switch(this.analyzer.getByteFrequencyData(this.dataArray),this.componentConfigSignal()?.variant){case"preview":this.drawPreview();break;case"preview-mini":this.drawPreviewMini();break;default:this.drawDefault()}}catch(o){this.loggingService.warn("Error in AudioWaveformComponent draw: ",o)}}}ngOnInit(){try{this.bufferArray&&this.showWaveform(),setTimeout(()=>{this.setupResizeObserver()},100),this.updateMirroredWaveformPath()}catch(e){this.loggingService.warn("Error in AudioWaveformComponent ngOnInit: ",e)}}ngOnChanges(e){try{e&&Object.keys(e).forEach(t=>{this.componentConfigSignal.update(o=>E(b({},o),{[t]:e[t].currentValue}))}),e.playerCurrentTime&&e.playerCurrentTime.currentValue&&this.componentConfigSignal.update(t=>E(b({},t),{activeBarIndex:this.showActiveBars(e.playerCurrentTime.currentValue,this.totalTime.display)})),(e?.recorderInitData?.currentValue?.stream||e?.previewStream?.currentValue)&&(this.stopAnimation(),this.setupAudioElements(e.recorderInitData?.currentValue?.stream||e.previewStream.currentValue),this.startAnimation()),e.muteMic&&this.handleMicMute(e.muteMic.currentValue),this.updateMirroredWaveformPath()}catch(t){this.loggingService.warn("Error in AudioWaveformComponent ngOnChanges: ",t)}}trackByBarHeights(e,t){return e+"__"+t}showActiveBars(e,t){try{let o=d=>{let[v,u]=d.split(":").map(Number);return v*60+u},a=o(e),l=o(t)-1,s=l>0?a/l:0;return a>=l?this.numberOfBars:Math.floor(s*this.numberOfBars)}catch(o){return this.loggingService.warn("Error in AudioWaveformComponent showActiveBars: ",o),-1}}ngOnDestroy(){try{this.stopAnimation(),this.cleanupAudio(),this.cleanupResizeObserver()}catch{}}setupAudioElements(e){return X(this,null,function*(){try{this.cleanupAudio(),this.audioContext=new AudioContext,this.stream=e,this.microphone=this.audioContext.createMediaStreamSource(this.stream),this.analyzer=this.audioContext.createAnalyser(),this.analyzer.smoothingTimeConstant=.8,this.microphone.connect(this.analyzer),this.dataArray=new Uint8Array(this.analyzer.frequencyBinCount),this.analyzer.fftSize=1024,this.handleMicMute(this.muteMic)}catch{this.dataArray=new Uint8Array(0)}})}noiseGate(e,t,o){try{for(let a=0;a<e.length;a++)e[a]=Math.abs(e[a])>t?e[a]-t+o:o}catch(a){this.loggingService.warn("Error in AudioWaveformComponent noiseGate: ",a)}}startAnimation(){try{let e=t=>{t-this.lastDrawTime>=this.drawInterval&&(this.draw(),this.lastDrawTime=t),this.animationFrameId=requestAnimationFrame(e)};this.animationFrameId=requestAnimationFrame(e)}catch(e){this.loggingService.warn("Error in AudioWaveformComponent startAnimation: ",e)}}stopAnimation(){try{this.animationFrameId!==null&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null)}catch(e){this.loggingService.warn("Error in AudioWaveformComponent stopAnimation: ",e)}}drawPreview(){try{this.noiseGate(this.dataArray,128,0);let e=1e3,t=Math.floor(this.dataArray.length/e),o=[];for(let l=0;l<e;l++){let s=l*t,d=Math.min(s+t,this.dataArray.length),v=this.dataArray.slice(s,d),u=v.reduce((S,k)=>S+k,0)/v.length;o.push(u)}o.sort((l,s)=>l-s);let a=[];for(let l=0;l<e;l++)a.push(o[l],o[l]);for(let l=e-1;l>=0;l--)a.push(o[l],o[l]);this.componentConfigSignal.update(l=>E(b({},l),{barHeights:a.filter(s=>s!==0)})),this.updateMirroredWaveformPath()}catch(e){this.loggingService.warn("Error in AudioWaveformComponent drawPreview: ",e)}}drawPreviewMini(){try{this.noiseGate(this.dataArray,128,0);let e=Math.max(...this.dataArray),t=Math.max(2,Math.min(14,e/128*14));if(this.componentConfigSignal.update(o=>E(b({},o),{barHeights:[Math.max(2,t/1.5),t,Math.max(2,t/2)]})),this.updateMirroredWaveformPath(),this.analyzer?.getByteTimeDomainData(this.dataArray),this.noiseGate(this.dataArray,128,2),this.isRecording){let o=Math.max(...this.dataArray);this.maxVolumeArray.push(o),this.recorderService.setRecordedDataStream(this.maxVolumeArray)}}catch(e){this.loggingService.warn("Error in AudioWaveformComponent drawPreviewMini: ",e)}}drawDefault(){try{if(this.analyzer?.getByteTimeDomainData(this.dataArray),this.noiseGate(this.dataArray,128,2),this.isRecording){let e=Math.max(...this.dataArray),t=e/255*this.height*3;this.maxVolumeArray.push(e),this.recorderService.setRecordedDataStream(this.maxVolumeArray),this.componentConfigSignal.update(o=>E(b({},o),{barHeights:[...o.barHeights,t]})),this.updateMirroredWaveformPath()}}catch(e){this.loggingService.warn("Error in AudioWaveformComponent drawDefault: ",e)}}cleanupAudio(){try{this.allowCleanUp&&this.variant!=="expanded"&&(this.microphone&&(this.microphone.disconnect(),this.microphone=null),this.stream&&(this.stream.getTracks().forEach(e=>e.stop()),this.stream=null),this.analyzer&&(this.analyzer.disconnect(),this.analyzer=null),this.audioContext&&this.audioContext.state!=="closed"&&(this.audioContext.close(),this.audioContext=null),this.componentConfigSignal.update(e=>E(b({},e),{barHeights:[]})),this.updateMirroredWaveformPath())}catch{}}handleMicMute(e){try{this.stream&&this.stream.getAudioTracks().forEach(t=>{t.enabled=!e})}catch(t){this.loggingService.warn("Error in AudioWaveformComponent handleMicMute: ",t)}}indexToTime(e){try{let t=e*100,o=Math.floor(t/1e3),a=Math.floor(o/60),l=o%60,s=a.toString().padStart(2,"0"),d=l.toString().padStart(2,"0");return`${s}:${d}`}catch(t){return this.loggingService.warn("Error in AudioWaveformComponent indexToTime: ",t),""}}generateMirroredWaveformPath(e,t,o){try{if(!e||e.length===0)return"";let a=o?e.slice(0,t):e.slice(t);if(a.length===0)return"";let l=o?0:t,s=e.length,d=100,u=18/2,S=Math.min(...a),A=Math.max(...a)-S,P=A>0?u*.8/A:.1,U=.5,W="";if(a.length>0){let te=l/s*d;W=`M ${te} ${u} `;let ye=te,me=A>0?(a[0]-S)*P:U,ke=u-Math.max(me,U);W+=`L ${ye} ${ke} `;for(let Le=1;Le<a.length;Le++){let Ue=(l+Le)/s*d,He=(l+Le-1)/s*d,$e=A>0?(a[Le]-S)*P:U,br=A>0?(a[Le-1]-S)*P:U,Dt=u-Math.max($e,U),wt=u-Math.max(br,U),Ze=He+(Ue-He)/3,Bt=He+2*(Ue-He)/3;W+=`C ${Ze} ${wt}, ${Bt} ${Dt}, ${Ue} ${Dt} `}let De=(l+a.length-1)/s*d;W+=`L ${De} ${u} `;let Ie=De,xe=A>0?(a[a.length-1]-S)*P:U,Re=u+Math.max(xe,U);W+=`L ${Ie} ${Re} `;for(let Le=a.length-2;Le>=0;Le--){let Ue=(l+Le)/s*d,He=(l+Le+1)/s*d,$e=A>0?(a[Le]-S)*P:U,br=A>0?(a[Le+1]-S)*P:U,Dt=u+Math.max($e,U),wt=u+Math.max(br,U),Ze=He-(He-Ue)/3,Bt=He-2*(He-Ue)/3;W+=`C ${Ze} ${wt}, ${Bt} ${Dt}, ${Ue} ${Dt} `}W+="Z"}return W}catch(a){return this.loggingService.warn("Error in AudioWaveformComponent generateMirroredWaveformPath: ",a),""}}onResize(){this.componentConfigSignal()?.variant==="editor"&&setTimeout(()=>{this.updateMirroredWaveformPath()},100)}updateMirroredWaveformPath(){try{let e=this.componentConfigSignal(),t=this.generateMirroredWaveformPath(e.barHeights,e.activeBarIndex+1,!1);this.componentConfigSignal.update(o=>E(b({},o),{mirroredWaveformPath:t}))}catch(e){this.loggingService.warn("Error in AudioWaveformComponent updateMirroredWaveformPath: ",e)}}setupResizeObserver(){try{this.waveformContainer&&!this.resizeObserver&&typeof ResizeObserver<"u"&&(this.resizeObserver=new ResizeObserver(e=>{this.updateMirroredWaveformPath()}),this.resizeObserver.observe(this.waveformContainer.nativeElement))}catch(e){this.loggingService.warn("Error in AudioWaveformComponent setupResizeObserver: ",e)}}cleanupResizeObserver(){try{this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=void 0)}catch(e){this.loggingService.warn("Error in AudioWaveformComponent cleanupResizeObserver: ",e)}}};r.\u0275fac=function(t){return new(t||r)(C(x),C(kn))},r.\u0275cmp=O({type:r,selectors:[["app-audio-waveform"]],viewQuery:function(t,o){if(t&1&&dt(W1n,5),t&2){let a;ot(a=at())&&(o.waveformContainer=a.first)}},hostBindings:function(t,o){t&1&&G("resize",function(){return o.onResize()},eI)},inputs:{height:"height",isRecording:"isRecording",variant:"variant",isAudio:"isAudio",collapsedMode:"collapsedMode",bufferArray:"bufferArray",playerCurrentTime:"playerCurrentTime",totalTime:"totalTime",recorderInitData:"recorderInitData",threadMode:"threadMode",previewStream:"previewStream",numberOfBars:"numberOfBars",muteMic:"muteMic"},standalone:!1,features:[it],decls:1,vars:1,consts:[["waveformContainer",""],[4,"ngIf"],[3,"ngSwitch"],[4,"ngSwitchCase"],[1,"audio-waveform"],[1,"center-line"],[1,"waves"],["class","bar-container",4,"ngFor","ngForOf","ngForTrackBy"],[1,"bar-container"],[1,"bar"],[1,"line"],[1,"time-container"],["width","2","height","8","viewBox","0 0 2 8","fill","none","xmlns","http://www.w3.org/2000/svg",4,"ngIf"],["class","time",4,"ngIf"],["width","2","height","8","viewBox","0 0 2 8","fill","none","xmlns","http://www.w3.org/2000/svg"],["x","0.5","width","1","height","8"],[1,"time"],["class","mini-audio-container",3,"thread-mode",4,"ngIf"],[1,"mini-audio-container"],["class","bar",3,"height",4,"ngFor","ngForOf","ngForTrackBy"],[1,"mini-audio-container-player"],["class","bar",3,"height","active-bar",4,"ngFor","ngForOf","ngForTrackBy"],[1,"audio-container-preview"],[1,"audio-container-preview-mini"],["class","audio-container-preview-mini--bar",3,"height",4,"ngFor","ngForOf","ngForTrackBy"],[1,"audio-container-preview-mini--bar"],[1,"editor-player"],["width","100%","height","18","viewBox","0 0 100 18","preserveAspectRatio","none",1,"smooth-waveform"],["id","active-gradient","x1","0%","y1","0%","x2","0%","y2","100%"],["offset","0%","stop-color","var(--velt-text-4)","stop-opacity","1"],["offset","50%","stop-color","var(--velt-text-4)","stop-opacity","1"],["offset","100%","stop-color","var(--velt-text-4)","stop-opacity","1"],["fill","url(#active-gradient)"]],template:function(t,o){t&1&&p(0,s_n,8,7,"ng-container",1),t&2&&g("ngIf",o.componentConfigSignal())},dependencies:[Vt,se,Rr,Jr,ue],styles:[".audio-waveform[_ngcontent-%COMP%]{display:flex;flex-direction:column;width:100%;height:100%;align-items:center;justify-content:center;overflow:hidden;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);box-sizing:border-box;border:1px solid var(--velt-border-3);border-radius:var(--velt-border-radius-lg)}.audio-waveform[_ngcontent-%COMP%] .center-line[_ngcontent-%COMP%]{position:absolute;background:var(--velt-background-2);height:4px;width:100%;z-index:1!important}.audio-waveform[_ngcontent-%COMP%] .waves[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:flex-end;height:144px;width:100%;z-index:2!important}.audio-waveform[_ngcontent-%COMP%] .waves[_ngcontent-%COMP%] .bar-container[_ngcontent-%COMP%]{height:100%;display:flex;align-items:center;justify-content:center;flex-direction:column}.audio-waveform[_ngcontent-%COMP%] .waves[_ngcontent-%COMP%] .bar-container[_ngcontent-%COMP%] .bar[_ngcontent-%COMP%]{width:2px;background:var(--velt-error);margin-right:var(--velt-spacing-xs);border-radius:var(--velt-border-radius-xs);transition:height .5s ease}.audio-waveform[_ngcontent-%COMP%] .waves[_ngcontent-%COMP%] .bar-container[_ngcontent-%COMP%] .bar.silent[_ngcontent-%COMP%]{background:var(--velt-text-12)}.audio-waveform[_ngcontent-%COMP%] .waves[_ngcontent-%COMP%] .bar-container[_ngcontent-%COMP%] .bar[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{opacity:0}.audio-waveform[_ngcontent-%COMP%] .waves[_ngcontent-%COMP%] .bar-container[_ngcontent-%COMP%] .line[_ngcontent-%COMP%]{position:absolute;bottom:35px;background:var(--velt-background-4);height:1px;width:6px}.audio-waveform[_ngcontent-%COMP%] .waves[_ngcontent-%COMP%] .bar-container[_ngcontent-%COMP%] .time-container[_ngcontent-%COMP%]{position:absolute;bottom:10px;display:flex;flex-direction:column;align-items:center;justify-content:space-between;margin-left:var(--velt-spacing-lg)}.audio-waveform[_ngcontent-%COMP%] .waves[_ngcontent-%COMP%] .bar-container[_ngcontent-%COMP%] .time-container[_ngcontent-%COMP%] svg[_ngcontent-%COMP%] rect[_ngcontent-%COMP%]{fill:var(--velt-background-4)}.audio-waveform[_ngcontent-%COMP%] .waves[_ngcontent-%COMP%] .bar-container[_ngcontent-%COMP%] .time-container[_ngcontent-%COMP%] .time[_ngcontent-%COMP%]{padding-top:var(--velt-spacing-sm);font-weight:600;font-size:var(--velt-font-size-2xs);line-height:11px;color:var(--velt-text-12)}.mini-audio-container[_ngcontent-%COMP%]{height:18px;display:flex;align-items:center;justify-content:flex-end;overflow:hidden;margin-left:var(--velt-spacing-sm)}.mini-audio-container.thread-mode[_ngcontent-%COMP%]{width:74px}.mini-audio-container[_ngcontent-%COMP%] .bar[_ngcontent-%COMP%]{width:2px;background:var(--velt-error);margin-right:var(--velt-spacing-2xs);border-radius:var(--velt-border-radius-2xs);transition:height .5s ease}.mini-audio-container[_ngcontent-%COMP%] .bar[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{opacity:0}.mini-audio-container-player[_ngcontent-%COMP%]{height:18px;display:flex;align-items:center;justify-content:center;overflow:hidden;margin-left:var(--velt-spacing-sm)}.mini-audio-container-player[_ngcontent-%COMP%] .bar[_ngcontent-%COMP%]{width:2px;background:var(--velt-text-12);margin-right:var(--velt-spacing-2xs);border-radius:var(--velt-border-radius-2xs)}.mini-audio-container-player[_ngcontent-%COMP%] .bar[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{opacity:0}.mini-audio-container-player[_ngcontent-%COMP%] .active-bar[_ngcontent-%COMP%]{background:var(--velt-accent-text)}.audio-container-preview[_ngcontent-%COMP%] .audio-waveform[_ngcontent-%COMP%]{display:flex;flex-direction:column;width:100%;height:300px;align-items:center;justify-content:center;overflow:hidden;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);z-index:-1;border-width:0px}.audio-container-preview[_ngcontent-%COMP%] .audio-waveform[_ngcontent-%COMP%] .center-line[_ngcontent-%COMP%]{position:absolute;background:var(--velt-background-2);height:4px;width:100%;z-index:1}.audio-container-preview[_ngcontent-%COMP%] .audio-waveform[_ngcontent-%COMP%] .waves[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;height:144px;width:100%;z-index:2}.audio-container-preview[_ngcontent-%COMP%] .audio-waveform[_ngcontent-%COMP%] .waves[_ngcontent-%COMP%] .bar-container[_ngcontent-%COMP%]{height:100%;display:flex;align-items:center;justify-content:center;flex-direction:column}.audio-container-preview[_ngcontent-%COMP%] .audio-waveform[_ngcontent-%COMP%] .waves[_ngcontent-%COMP%] .bar-container[_ngcontent-%COMP%] .bar[_ngcontent-%COMP%]{width:2px;background:var(--velt-error);margin-right:var(--velt-spacing-xs);border-radius:var(--velt-border-radius-2xs);transition:height .5s ease}.audio-container-preview[_ngcontent-%COMP%] .audio-waveform[_ngcontent-%COMP%] .waves[_ngcontent-%COMP%] .bar-container[_ngcontent-%COMP%] .bar[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{opacity:0}.audio-container-preview[_ngcontent-%COMP%] .audio-waveform[_ngcontent-%COMP%] .waves[_ngcontent-%COMP%] .bar-container[_ngcontent-%COMP%] .line[_ngcontent-%COMP%]{position:absolute;bottom:35px;background:var(--velt-background-4);height:1px;width:6px}.audio-container-preview[_ngcontent-%COMP%] .audio-waveform[_ngcontent-%COMP%] .waves[_ngcontent-%COMP%] .bar-container[_ngcontent-%COMP%] .time-container[_ngcontent-%COMP%]{position:absolute;bottom:10px;display:flex;flex-direction:column;align-items:center;justify-content:space-between;margin-left:var(--velt-spacing-lg)}.audio-container-preview[_ngcontent-%COMP%] .audio-waveform[_ngcontent-%COMP%] .waves[_ngcontent-%COMP%] .bar-container[_ngcontent-%COMP%] .time-container[_ngcontent-%COMP%] .time[_ngcontent-%COMP%]{padding-top:var(--velt-spacing-sm);font-weight:600;font-size:var(--velt-font-size-2xs);line-height:11px;color:var(--velt-text-12)}.audio-container-preview-mini[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;gap:2px;width:28px;height:28px;background:var(--velt-accent);border-radius:var(--velt-border-radius-3xl)}.audio-container-preview-mini[_ngcontent-%COMP%] .audio-container-preview-mini--bar[_ngcontent-%COMP%]{width:2px;background:var(--velt-white);border-radius:var(--velt-border-radius-2xs);transition:height .1s}.editor-player[_ngcontent-%COMP%]{height:50px;display:flex;align-items:center;justify-content:center;overflow:hidden;width:100%;position:relative;margin-left:1.5px}.editor-player[_ngcontent-%COMP%] .smooth-waveform[_ngcontent-%COMP%]{width:100%;height:100%;position:absolute;left:0;top:0}.editor-player[_ngcontent-%COMP%] .smooth-waveform[_ngcontent-%COMP%] .inactive-stop-top[_ngcontent-%COMP%], .editor-player[_ngcontent-%COMP%] .smooth-waveform[_ngcontent-%COMP%] .inactive-stop-bottom[_ngcontent-%COMP%]{stop-color:var(--velt-text-12)}.editor-player[_ngcontent-%COMP%] .smooth-waveform[_ngcontent-%COMP%] .active-stop-top[_ngcontent-%COMP%], .editor-player[_ngcontent-%COMP%] .smooth-waveform[_ngcontent-%COMP%] .active-stop-bottom[_ngcontent-%COMP%]{stop-color:var(--velt-accent-text)}.editor-player[_ngcontent-%COMP%] .smooth-waveform[_ngcontent-%COMP%] path[_ngcontent-%COMP%]{transition:d .2s ease-in-out}"],changeDetection:0});let n=r;return n})();var c_n=["knob"],d_n=["valueIndicatorContainer"];function m_n(n,r){if(n&1&&(_(0,"div",2,1)(2,"div",5)(3,"span",6),ne(4),y()()()),n&2){let i=c();m(4),Ke(i.valueIndicatorText)}}var g_n=["trackActive"],v_n=["*"];function u_n(n,r){if(n&1&&D(0,"div"),n&2){let i=r.$implicit,e=r.$index,t=c(3);Xr(i===0?"mdc-slider__tick-mark--active":"mdc-slider__tick-mark--inactive"),ct("transform",t._calcTickMarkTransform(e))}}function p_n(n,r){if(n&1&&ci(0,u_n,1,4,"div",8,mB),n&2){let i=c(2);di(i._tickMarks)}}function h_n(n,r){if(n&1&&(_(0,"div",6,1),ie(2,p_n,2,0),y()),n&2){let i=c();m(2),re(i._cachedWidth?2:-1)}}function f_n(n,r){if(n&1&&D(0,"mat-slider-visual-thumb",7),n&2){let i=c();g("discrete",i.discrete)("thumbPosition",1)("valueIndicatorText",i.startValueIndicatorText)}}var Qn=(function(n){return n[n.START=1]="START",n[n.END=2]="END",n})(Qn||{}),ex=(function(n){return n[n.ACTIVE=0]="ACTIVE",n[n.INACTIVE=1]="INACTIVE",n})(ex||{}),uK=new ft("_MatSlider"),Dxe=new ft("_MatSliderThumb"),C_n=new ft("_MatSliderRangeThumb"),Oxe=new ft("_MatSliderVisualThumb");var __n=(()=>{class n{_cdr=pe(on);_ngZone=pe($t);_slider=pe(uK);_renderer=pe(fr);_listenerCleanups;discrete;thumbPosition;valueIndicatorText;_ripple;_knob;_valueIndicatorContainer;_sliderInput;_sliderInputEl;_hoverRippleRef;_focusRippleRef;_activeRippleRef;_isHovered=!1;_isActive=!1;_isValueIndicatorVisible=!1;_hostElement=pe(z).nativeElement;_platform=pe(Nr);constructor(){}ngAfterViewInit(){let i=this._slider._getInput(this.thumbPosition);i&&(this._ripple.radius=24,this._sliderInput=i,this._sliderInputEl=this._sliderInput._hostElement,this._ngZone.runOutsideAngular(()=>{let e=this._sliderInputEl,t=this._renderer;this._listenerCleanups=[t.listen(e,"pointermove",this._onPointerMove),t.listen(e,"pointerdown",this._onDragStart),t.listen(e,"pointerup",this._onDragEnd),t.listen(e,"pointerleave",this._onMouseLeave),t.listen(e,"focus",this._onFocus),t.listen(e,"blur",this._onBlur)]}))}ngOnDestroy(){this._listenerCleanups?.forEach(i=>i())}_onPointerMove=i=>{if(this._sliderInput._isFocused)return;let e=this._hostElement.getBoundingClientRect(),t=this._slider._isCursorOnSliderThumb(i,e);this._isHovered=t,t?this._showHoverRipple():this._hideRipple(this._hoverRippleRef)};_onMouseLeave=()=>{this._isHovered=!1,this._hideRipple(this._hoverRippleRef)};_onFocus=()=>{this._hideRipple(this._hoverRippleRef),this._showFocusRipple(),this._hostElement.classList.add("mdc-slider__thumb--focused")};_onBlur=()=>{this._isActive||this._hideRipple(this._focusRippleRef),this._isHovered&&this._showHoverRipple(),this._hostElement.classList.remove("mdc-slider__thumb--focused")};_onDragStart=i=>{i.button===0&&(this._isActive=!0,this._showActiveRipple())};_onDragEnd=()=>{this._isActive=!1,this._hideRipple(this._activeRippleRef),this._sliderInput._isFocused||this._hideRipple(this._focusRippleRef),this._platform.SAFARI&&this._showHoverRipple()};_showHoverRipple(){this._isShowingRipple(this._hoverRippleRef)||(this._hoverRippleRef=this._showRipple({enterDuration:0,exitDuration:0}),this._hoverRippleRef?.element.classList.add("mat-mdc-slider-hover-ripple"))}_showFocusRipple(){this._isShowingRipple(this._focusRippleRef)||(this._focusRippleRef=this._showRipple({enterDuration:0,exitDuration:0},!0),this._focusRippleRef?.element.classList.add("mat-mdc-slider-focus-ripple"))}_showActiveRipple(){this._isShowingRipple(this._activeRippleRef)||(this._activeRippleRef=this._showRipple({enterDuration:225,exitDuration:400}),this._activeRippleRef?.element.classList.add("mat-mdc-slider-active-ripple"))}_isShowingRipple(i){return i?.state===Bl.FADING_IN||i?.state===Bl.VISIBLE}_showRipple(i,e){if(!this._slider.disabled&&(this._showValueIndicator(),this._slider._isRange&&this._slider._getThumb(this.thumbPosition===Qn.START?Qn.END:Qn.START)._showValueIndicator(),!(this._slider._globalRippleOptions?.disabled&&!e)))return this._ripple.launch({animation:this._slider._noopAnimations?{enterDuration:0,exitDuration:0}:i,centered:!0,persistent:!0})}_hideRipple(i){if(i?.fadeOut(),this._isShowingAnyRipple())return;this._slider._isRange||this._hideValueIndicator();let e=this._getSibling();e._isShowingAnyRipple()||(this._hideValueIndicator(),e._hideValueIndicator())}_showValueIndicator(){this._hostElement.classList.add("mdc-slider__thumb--with-indicator")}_hideValueIndicator(){this._hostElement.classList.remove("mdc-slider__thumb--with-indicator")}_getSibling(){return this._slider._getThumb(this.thumbPosition===Qn.START?Qn.END:Qn.START)}_getValueIndicatorContainer(){return this._valueIndicatorContainer?.nativeElement}_getKnob(){return this._knob.nativeElement}_isShowingAnyRipple(){return this._isShowingRipple(this._hoverRippleRef)||this._isShowingRipple(this._focusRippleRef)||this._isShowingRipple(this._activeRippleRef)}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=O({type:n,selectors:[["mat-slider-visual-thumb"]],viewQuery:function(e,t){if(e&1&&(dt(qh,5),dt(c_n,5),dt(d_n,5)),e&2){let o;ot(o=at())&&(t._ripple=o.first),ot(o=at())&&(t._knob=o.first),ot(o=at())&&(t._valueIndicatorContainer=o.first)}},hostAttrs:[1,"mdc-slider__thumb","mat-mdc-slider-visual-thumb"],inputs:{discrete:"discrete",thumbPosition:"thumbPosition",valueIndicatorText:"valueIndicatorText"},features:[j([{provide:Oxe,useExisting:n}])],decls:4,vars:2,consts:[["knob",""],["valueIndicatorContainer",""],[1,"mdc-slider__value-indicator-container"],[1,"mdc-slider__thumb-knob"],["matRipple","",1,"mat-focus-indicator",3,"matRippleDisabled"],[1,"mdc-slider__value-indicator"],[1,"mdc-slider__value-indicator-text"]],template:function(e,t){e&1&&(ie(0,m_n,5,1,"div",2),D(1,"div",3,0)(3,"div",4)),e&2&&(re(t.discrete?0:-1),m(3),g("matRippleDisabled",!0))},dependencies:[qh],styles:[`.mat-mdc-slider-visual-thumb .mat-ripple{height:100%;width:100%}.mat-mdc-slider .mdc-slider__tick-marks{justify-content:start}.mat-mdc-slider .mdc-slider__tick-marks .mdc-slider__tick-mark--active,.mat-mdc-slider .mdc-slider__tick-marks .mdc-slider__tick-mark--inactive{position:absolute;left:2px}
|
|
556
|
+
`],encapsulation:3,changeDetection:0});let n=r;return n})();var Cxe=(()=>{let r=class r extends Ct{constructor(e,t,o,a,l,s,d,v){super(v,s),this.authService=e,this.commentService=t,this.domService=o,this.loggingService=a,this.notificationService=l,this.themeService=s,this.viewsService=d,this.elementRef=v,this.onNotificationClickEvent=new Fe,this.veltElement=!0,this.componentId="velt-notifications-history-panel"}ngOnInit(){try{this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in NotificationsHistoryPanelComponent ngOnInit:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","dialog"),e.setAttribute("aria-label","Notifications history panel")}catch(e){this.loggingService.catch("Error in NotificationsHistoryPanelComponent setupA11yAttributes:",e)}}goToAnnotation(e){try{setTimeout(()=>{let t=null;e.targetElement||e.areaAnnotationId?t=document.getElementById(`comment-pin-container-${e.annotationId}`):t=document.querySelector(`[data-velt-id='${e.annotationId}']`),t&&t.scrollIntoView({behavior:"auto",block:"center",inline:"nearest"})},100)}catch(t){this.loggingService.catch("Error in NotificationsHistoryPanelComponent goToAnnotation: ",t)}}onNotificationClick(e){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: onNotificationClick","color: green;"),e.notificationSource==="comment"&&e.targetAnnotationId){let t=this.commentService.getAnnotationById(e?.targetAnnotationId);t&&(this.domService.toggleAnnotationSelection(t),this.goToAnnotation(t))}this.onNotificationClickEvent.emit(e),e?.id&&e.isUnread&&this.setNotificationAsRead(e)}catch(t){this.loggingService.catch("Error in NotificationsHistoryPanelComponent onNotificationClick: ",t)}}setNotificationAsRead(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setNotificationAsRead","color: green;"),e?.id&&(this.authService.getUser()?.organizationId?this.notificationService.setNotificationsAsRead([e]):this.viewsService.setNotificationsAsRead([e?.id]))}catch(t){this.loggingService.catch("Error in NotificationsHistoryPanelComponent setNotificationAsRead: ",t)}}};r.\u0275fac=function(t){return new(t||r)(C(Ge),C(Pe),C(Ve),C(x),C(hn),C(mt),C(Qa),C(z))},r.\u0275cmp=O({type:r,selectors:[["app-notifications-history-panel"]],hostVars:1,hostBindings:function(t,o){t&2&&T("data-velt-element",o.veltElement)},outputs:{onNotificationClickEvent:"onNotificationClick"},standalone:!1,features:[L],decls:1,vars:1,consts:[[3,"onNotificationClick","darkMode"]],template:function(t,o){t&1&&(_(0,"velt-notifications-panel-internal",0),G("onNotificationClick",function(l){return o.onNotificationClick(l)}),y()),t&2&&g("darkMode",o.darkMode)},dependencies:[Gm],encapsulation:2,changeDetection:0});let n=r;return n})();var _xe=(()=>{let r=class r{set _pageSize(e){try{let t=e;typeof e=="string"&&(t=JSON.parse(e));let o=typeof t=="number"?t:parseInt(t,10);!isNaN(o)&&o>0&&(this.pageSize=o)}catch{}}constructor(e,t,o){this.bottomSheet=e,this.loggingService=t,this.elementRef=o,this.onNotificationClickEvent=new Fe,this.close=new Fe,this.pageSize=5,this.subscriptions=[],this.componentId="velt-notifications-bottom-sheet-internal"}ngOnInit(){try{this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in NotificationsBottomSheetComponent ngOnInit:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","dialog"),e.setAttribute("aria-label","Notifications bottom sheet")}catch(e){this.loggingService.catch("Error in NotificationsBottomSheetComponent setupA11yAttributes:",e)}}ngAfterViewInit(){this.openBottomSheet()}openBottomSheet(){return X(this,null,function*(){try{this.bottomSheetRef=this.bottomSheet.open(Gm,{data:{closeBottomSheetFn:()=>{this.onClose(),this.bottomSheetRef?.dismiss()},onNotificationClickFn:e=>{this.onNotificationClickEvent.emit(e)},pageSize:this.pageSize},panelClass:["v-notifications-bottom-sheet-container","velt-mat-bottom-sheet-container"]}),this.subscriptions.push(this.bottomSheetRef.backdropClick().subscribe(()=>{this.onClose()},e=>{this.loggingService.catch("Error in NotificationsBottomSheetComponent backdropClick subscription: ",e)}))}catch(e){this.loggingService.catch("Error in NotificationsBottomSheetComponent openBottomSheet: ",e)}})}onClose(){try{this.close.emit()}catch(e){this.loggingService.catch("Error in NotificationsBottomSheetComponent onClose: ",e)}}ngOnDestroy(){try{this.subscriptions.forEach(e=>{e.unsubscribe()})}catch(e){this.loggingService.catch("Error in NotificationsBottomSheetComponent ngOnDestroy: ",e)}}};r.\u0275fac=function(t){return new(t||r)(C(vd),C(x),C(z))},r.\u0275cmp=O({type:r,selectors:[["velt-notifications-bottom-sheet-internal"]],inputs:{_pageSize:[0,"pageSize","_pageSize"]},outputs:{onNotificationClickEvent:"onNotificationClick",close:"close"},standalone:!1,decls:0,vars:0,template:function(t,o){},styles:[".velt-mat-bottom-sheet-container.v-notifications-bottom-sheet-container{padding:0!important} .velt-mat-bottom-sheet-container.v-notifications-bottom-sheet-container .mat-bottom-sheet-container{padding:0!important}"],changeDetection:0});let n=r;return n})();var JCn=["*"],bxe=(()=>{let r=class r{constructor(e,t,o,a){this.el=e,this.domService=t,this.loggingService=o,this.wireframeService=a;try{this.loggingService.log("%c[WB] Creating CLASS: WireframeComponent","color: blue;")}catch(l){this.loggingService.catch("Error in WireframeComponent constructor: ",l)}}ngAfterContentInit(){try{this.loggingService.log("%c[WB] Calling WireframeComponent FUNCTION: ngAfterContentInit","color: green;");let e=this.el.nativeElement.querySelectorAll(":scope > *"),t=new Map;e.forEach(o=>{if(o.nodeType===1){let a=o;if(a&&a?.tagName?.toLowerCase()?.startsWith("velt-")){let s=a.tagName.toLowerCase();if(s==="velt-comment-dialog-composer-action-button-wireframe"||s==="velt-comment-dialog-composer-format-toolbar-button-wireframe"){let u=a.getAttribute("type");u&&(s+=`--${u}`)}let d=a.getAttribute("variant");d&&(s+=`---${d}`);let v=this.domService.deepCloneElement(a);this.domService.setRandomNumberToElementRecursive(v),t.set(s,v)}}}),this.wireframeService.setWireframeMap(t)}catch(e){this.loggingService.catch("Error in WireframeComponent ngAfterContentInit: ",e)}}};r.\u0275fac=function(t){return new(t||r)(C(z),C(Ve),C(x),C(Je))},r.\u0275cmp=O({type:r,selectors:[["app-wireframe"]],standalone:!1,ngContentSelectors:JCn,decls:1,vars:0,template:function(t,o){t&1&&(Wt(),jt(0))},encapsulation:2,changeDetection:0});let n=r;return n})();function QCn(n,r){if(n&1&&(de(),_(0,"svg",3),D(1,"path",4)(2,"path",5),y()),n&2){let i=c(2);T("data-testid",i.componentId+"-media")("aria-label",i.type!=null&&i.type.includes("video")?"Video file":"Audio file")}}function e1n(n,r){if(n&1&&(de(),_(0,"svg",3),D(1,"path",6),y()),n&2){let i=c(2);T("data-testid",i.componentId+"-pdf")("aria-label","PDF file")}}function t1n(n,r){if(n&1&&(de(),_(0,"svg",3),D(1,"path",7),y()),n&2){let i=c(2);T("data-testid",i.componentId+"-csv")("aria-label","CSV file")}}function n1n(n,r){if(n&1&&(de(),_(0,"svg",3),D(1,"path",8),y()),n&2){let i=c(2);T("data-testid",i.componentId+"-json")("aria-label","JSON file")}}function i1n(n,r){if(n&1&&(de(),_(0,"svg",3),D(1,"path",9),y()),n&2){let i=c(2);T("data-testid",i.componentId+"-docx")("aria-label","DOCX file")}}function r1n(n,r){if(n&1&&(de(),_(0,"svg",3),D(1,"path",10),y()),n&2){let i=c(2);T("data-testid",i.componentId+"-xlsx")("aria-label","XLSX file")}}function o1n(n,r){if(n&1&&(de(),_(0,"svg",3),D(1,"path",11),y()),n&2){let i=c(2);T("data-testid",i.componentId+"-xls")("aria-label","XLS file")}}function a1n(n,r){if(n&1&&(de(),_(0,"svg",3),D(1,"path",12),y()),n&2){let i=c(2);T("data-testid",i.componentId+"-pptx")("aria-label","PPTX file")}}function l1n(n,r){if(n&1&&(h(0),p(1,QCn,3,2,"svg",2)(2,e1n,2,2,"svg",2)(3,t1n,2,2,"svg",2)(4,n1n,2,2,"svg",2)(5,i1n,2,2,"svg",2)(6,r1n,2,2,"svg",2)(7,o1n,2,2,"svg",2)(8,a1n,2,2,"svg",2),f()),n&2){let i=c();m(),g("ngIf",(i.type==null?null:i.type.includes("video"))||(i.type==null?null:i.type.includes("audio"))),m(),g("ngIf",i.type==null?null:i.type.includes("pdf")),m(),g("ngIf",i.type==null?null:i.type.includes("csv")),m(),g("ngIf",i.type==null?null:i.type.includes("json")),m(),g("ngIf",i.type==null?null:i.type.includes("wordprocessingml.document")),m(),g("ngIf",i.type==null?null:i.type.includes("spreadsheetml.sheet")),m(),g("ngIf",i.type==null?null:i.type.includes("vnd.ms-excel")),m(),g("ngIf",i.type==null?null:i.type.includes("presentationml.presentation"))}}function s1n(n,r){if(n&1&&(de(),_(0,"svg",3),D(1,"path",13),y()),n&2){let i=c();T("data-testid",i.componentId+"-default")("aria-label","Default file")}}var gK=(()=>{let r=class r{constructor(e,t){this.elementRef=e,this.loggingService=t,this.veltElement=!0,this.componentId="velt-file-icon"}ngOnInit(){try{this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in FileIconComponent ngOnInit:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("role","presentation"),e.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in FileIconComponent setupA11yAttributes:",e)}}};r.\u0275fac=function(t){return new(t||r)(C(z),C(x))},r.\u0275cmp=O({type:r,selectors:[["velt-file-icon-internal"]],hostVars:1,hostBindings:function(t,o){t&2&&T("data-velt-element",o.veltElement)},inputs:{type:"type"},standalone:!1,decls:3,vars:2,consts:[["otherIconRef",""],[4,"ngIf","ngIfElse"],["width","28","height","28","viewBox","0 0 32 32","fill","none","xmlns","http://www.w3.org/2000/svg","aria-hidden","true","focusable","false","role","img",4,"ngIf"],["width","28","height","28","viewBox","0 0 32 32","fill","none","xmlns","http://www.w3.org/2000/svg","aria-hidden","true","focusable","false","role","img"],["d","M2.66663 10.6667C2.66663 9.25218 3.22853 7.89563 4.22872 6.89543C5.22892 5.89524 6.58547 5.33334 7.99996 5.33334H24C25.4144 5.33334 26.771 5.89524 27.7712 6.89543C28.7714 7.89563 29.3333 9.25218 29.3333 10.6667V21.3333C29.3333 22.7478 28.7714 24.1044 27.7712 25.1046C26.771 26.1048 25.4144 26.6667 24 26.6667H7.99996C6.58547 26.6667 5.22892 26.1048 4.22872 25.1046C3.22853 24.1044 2.66663 22.7478 2.66663 21.3333V10.6667Z","stroke","currentColor","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"],["d","M13.3333 12L20 16L13.3333 20V12Z","stroke","currentColor","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"],["d","M18.6666 4V9.33333C18.6666 9.68696 18.8071 10.0261 19.0572 10.2761C19.3072 10.5262 19.6463 10.6667 20 10.6667H25.3333M18.6666 4H9.33329C8.62605 4 7.94777 4.28095 7.44767 4.78105C6.94758 5.28115 6.66663 5.95942 6.66663 6.66667V16M18.6666 4L25.3333 10.6667M25.3333 10.6667V16M6.66663 24H8.66663C9.19706 24 9.70577 23.7893 10.0808 23.4142C10.4559 23.0391 10.6666 22.5304 10.6666 22C10.6666 21.4696 10.4559 20.9609 10.0808 20.5858C9.70577 20.2107 9.19706 20 8.66663 20H6.66663V28M22.6666 24H25.3333M26.6666 20H22.6666V28M14.6666 20V28H16C16.7072 28 17.3855 27.719 17.8856 27.219C18.3857 26.7189 18.6666 26.0406 18.6666 25.3333V22.6667C18.6666 21.9594 18.3857 21.2811 17.8856 20.781C17.3855 20.281 16.7072 20 16 20H14.6666Z","stroke","currentColor","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"],["d","M18.6667 4V9.33333C18.6667 9.68696 18.8072 10.0261 19.0572 10.2761C19.3073 10.5262 19.6464 10.6667 20 10.6667H25.3334M18.6667 4H9.33337C8.62613 4 7.94785 4.28095 7.44776 4.78105C6.94766 5.28115 6.66671 5.95942 6.66671 6.66667V16M18.6667 4L25.3334 10.6667M25.3334 10.6667V16M9.33337 22C9.33337 21.4696 9.12266 20.9609 8.74759 20.5858C8.37252 20.2107 7.86381 20 7.33337 20C6.80294 20 6.29423 20.2107 5.91916 20.5858C5.54409 20.9609 5.33337 21.4696 5.33337 22V26C5.33337 26.5304 5.54409 27.0391 5.91916 27.4142C6.29423 27.7893 6.80294 28 7.33337 28C7.86381 28 8.37252 27.7893 8.74759 27.4142C9.12266 27.0391 9.33337 26.5304 9.33337 26M13.3334 27C13.3334 27.552 13.7814 28 14.3334 28H16C16.3537 28 16.6928 27.8595 16.9428 27.6095C17.1929 27.3594 17.3334 27.0203 17.3334 26.6667V25.3333C17.3334 24.9797 17.1929 24.6406 16.9428 24.3905C16.6928 24.1405 16.3537 24 16 24H14.6667C14.3131 24 13.9739 23.8595 13.7239 23.6095C13.4739 23.3594 13.3334 23.0203 13.3334 22.6667V21.3333C13.3334 20.9797 13.4739 20.6406 13.7239 20.3905C13.9739 20.1405 14.3131 20 14.6667 20H16.3334C16.5986 20 16.8529 20.1054 17.0405 20.2929C17.228 20.4804 17.3334 20.7348 17.3334 21M21.3334 20L24 28L26.6667 20","stroke","currentColor","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"],["d","M18.6667 4V9.33333C18.6667 9.68696 18.8072 10.0261 19.0572 10.2761C19.3073 10.5262 19.6464 10.6667 20 10.6667H25.3334M18.6667 4H9.33337C8.62613 4 7.94785 4.28095 7.44776 4.78105C6.94766 5.28115 6.66671 5.95942 6.66671 6.66667V16M18.6667 4L25.3334 10.6667M25.3334 10.6667V16M24 28V20L27 28V20M5 20H8V26.5C8 26.8978 7.84196 27.2794 7.56066 27.5607C7.27936 27.842 6.89782 28 6.5 28C6.10218 28 5.72064 27.842 5.43934 27.5607C5.15804 27.2794 5 26.8978 5 26.5V26M11 27C11 27.2652 11.1054 27.5196 11.2929 27.7071C11.4804 27.8946 11.7348 28 12 28H13C13.2652 28 13.5196 27.8946 13.7071 27.7071C13.8946 27.5196 14 27.2652 14 27V25C14 24.7348 13.8946 24.4804 13.7071 24.2929C13.5196 24.1054 13.2652 24 13 24H12C11.7348 24 11.4804 23.8946 11.2929 23.7071C11.1054 23.5196 11 23.2652 11 23V21C11 20.7348 11.1054 20.4804 11.2929 20.2929C11.4804 20.1054 11.7348 20 12 20H13C13.2652 20 13.5196 20.1054 13.7071 20.2929C13.8946 20.4804 14 20.7348 14 21M19 20C19.5304 20 20.0391 20.2107 20.4142 20.5858C20.7893 20.9609 21 21.4696 21 22V26C21 26.5304 20.7893 27.0391 20.4142 27.4142C20.0391 27.7893 19.5304 28 19 28C18.4696 28 17.9609 27.7893 17.5858 27.4142C17.2107 27.0391 17 26.5304 17 26V22C17 21.4696 17.2107 20.9609 17.5858 20.5858C17.9609 20.2107 18.4696 20 19 20Z","stroke","currentColor","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"],["d","M18.6666 4V9.33333C18.6666 9.68696 18.8071 10.0261 19.0572 10.2761C19.3072 10.5262 19.6463 10.6667 20 10.6667H25.3333M18.6666 4H9.33329C8.62605 4 7.94777 4.28095 7.44767 4.78105C6.94758 5.28115 6.66663 5.95942 6.66663 6.66667V16M18.6666 4L25.3333 10.6667M25.3333 10.6667V16M22.6666 22C22.6666 21.4696 22.4559 20.9609 22.0808 20.5858C21.7058 20.2107 21.1971 20 20.6666 20C20.1362 20 19.6275 20.2107 19.2524 20.5858C18.8773 20.9609 18.6666 21.4696 18.6666 22V26C18.6666 26.5304 18.8773 27.0391 19.2524 27.4142C19.6275 27.7893 20.1362 28 20.6666 28C21.1971 28 21.7058 27.7893 22.0808 27.4142C22.4559 27.0391 22.6666 26.5304 22.6666 26M26 20L30 28M26 28L30 20M2.66663 20V28H3.99996C4.7072 28 5.38548 27.719 5.88558 27.219C6.38567 26.7189 6.66663 26.0406 6.66663 25.3333V22.6667C6.66663 21.9594 6.38567 21.2811 5.88558 20.781C5.38548 20.281 4.7072 20 3.99996 20H2.66663ZM12.6666 20C13.1971 20 13.7058 20.2107 14.0808 20.5858C14.4559 20.9609 14.6666 21.4696 14.6666 22V26C14.6666 26.5304 14.4559 27.0391 14.0808 27.4142C13.7058 27.7893 13.1971 28 12.6666 28C12.1362 28 11.6275 27.7893 11.2524 27.4142C10.8773 27.0391 10.6666 26.5304 10.6666 26V22C10.6666 21.4696 10.8773 20.9609 11.2524 20.5858C11.6275 20.2107 12.1362 20 12.6666 20Z","stroke","currentColor","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"],["d","M18.6667 4V9.33333C18.6667 9.68696 18.8072 10.0261 19.0572 10.2761C19.3073 10.5262 19.6464 10.6667 20 10.6667H25.3334M18.6667 4H9.33337C8.62613 4 7.94785 4.28095 7.44776 4.78105C6.94766 5.28115 6.66671 5.95942 6.66671 6.66667V16M18.6667 4L25.3334 10.6667M25.3334 10.6667V16M24 20L27 28M24 28L27 20M5 20L9 28M5 28L9 20M18 27C18 27.552 18.336 28 18.75 28H20C20.2652 28 20.5196 27.8595 20.7071 27.6095C20.8946 27.3594 21 27.0203 21 26.6667V25.3333C21 24.9797 20.8946 24.6406 20.7071 24.3905C20.5196 24.1405 20.2652 24 20 24H19C18.7348 24 18.4804 23.8595 18.2929 23.6095C18.1054 23.3594 18 23.0203 18 22.6667V21.3333C18 20.9797 18.1054 20.6406 18.2929 20.3905C18.4804 20.1405 18.7348 20 19 20H20.25C20.4489 20 20.6397 20.1054 20.7803 20.2929C20.921 20.4804 21 20.7348 21 21M12 20V28H15","stroke","currentColor","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"],["d","M18.6667 4V9.33333C18.6667 9.68696 18.8072 10.0261 19.0572 10.2761C19.3073 10.5262 19.6464 10.6667 20 10.6667H25.3334M18.6667 4H9.33337C8.62613 4 7.94785 4.28095 7.44776 4.78105C6.94766 5.28115 6.66671 5.95942 6.66671 6.66667V16M18.6667 4L25.3334 10.6667M25.3334 10.6667V16M5.5 20L9.5 28M5.5 28L9.5 20M22.5 27C22.5 27.552 22.836 28 23.25 28H24.5C24.7652 28 25.0196 27.8595 25.2071 27.6095C25.3946 27.3594 25.5 27.0203 25.5 26.6667V25.3333C25.5 24.9797 25.3946 24.6406 25.2071 24.3905C25.0196 24.1405 24.7652 24 24.5 24H23.5C23.2348 24 22.9804 23.8595 22.7929 23.6095C22.6054 23.3594 22.5 23.0203 22.5 22.6667V21.3333C22.5 20.9797 22.6054 20.6406 22.7929 20.3905C22.9804 20.1405 23.2348 20 23.5 20H24.75C24.9489 20 25.1397 20.1054 25.2803 20.2929C25.421 20.4804 25.5 20.7348 25.5 21M15 20V28H18","stroke","currentColor","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"],["d","M18.6667 4V9.33333C18.6667 9.68696 18.8072 10.0261 19.0573 10.2761C19.3073 10.5262 19.6465 10.6667 20.0001 10.6667H25.3334M18.6667 4H9.33341C8.62617 4 7.94789 4.28095 7.4478 4.78105C6.9477 5.28115 6.66675 5.95942 6.66675 6.66667V16M18.6667 4L25.3334 10.6667M25.3334 10.6667V16M26.0001 20L30.0001 28M26.0001 28L30.0001 20M2.66675 24H4.66675C5.19718 24 5.70589 23.7893 6.08096 23.4142C6.45603 23.0391 6.66675 22.5304 6.66675 22C6.66675 21.4696 6.45603 20.9609 6.08096 20.5858C5.70589 20.2107 5.19718 20 4.66675 20H2.66675V28M10.6667 24H12.6667C13.1972 24 13.7059 23.7893 14.081 23.4142C14.456 23.0391 14.6667 22.5304 14.6667 22C14.6667 21.4696 14.456 20.9609 14.081 20.5858C13.7059 20.2107 13.1972 20 12.6667 20H10.6667V28M18.0001 20H22.0001M20.0001 20V28","stroke","currentColor","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"],["d","M18.6667 4V9.33333C18.6667 9.68696 18.8072 10.0261 19.0573 10.2761C19.3073 10.5262 19.6465 10.6667 20.0001 10.6667H25.3334M18.6667 4H9.33341C8.62617 4 7.94789 4.28095 7.4478 4.78105C6.9477 5.28115 6.66675 5.95942 6.66675 6.66667V16M18.6667 4L25.3334 10.6667M25.3334 10.6667V16L25.5001 25.3333C25.5001 26.0406 25.2192 26.7189 24.7191 27.219C24.219 27.719 23.5407 28 22.8335 28H9.50012C8.79288 28 8.1146 27.719 7.6145 27.219C7.11441 26.7189 6.83346 26.0406 6.83346 25.3333L6.66675 16.1667","stroke","currentColor","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"]],template:function(t,o){if(t&1&&p(0,l1n,9,8,"ng-container",1)(1,s1n,2,2,"ng-template",null,0,Me),t&2){let a=Ce(2);g("ngIf",(o.type==null?null:o.type.includes("video"))||(o.type==null?null:o.type.includes("audio"))||(o.type==null?null:o.type.includes("pdf"))||(o.type==null?null:o.type.includes("wordprocessingml.document"))||(o.type==null?null:o.type.includes("csv"))||(o.type==null?null:o.type.includes("json"))||(o.type==null?null:o.type.includes("spreadsheetml.sheet"))||(o.type==null?null:o.type.includes("vnd.ms-excel"))||(o.type==null?null:o.type.includes("presentationml.presentation")))("ngIfElse",a)}},dependencies:[se],encapsulation:2,changeDetection:0});let n=r;return n})();function c1n(n,r){if(n&1&&(_(0,"div",3),de(),_(1,"svg",4)(2,"mask",5),D(3,"path",6),y(),D(4,"path",7),y()()),n&2){let i=c(2);T("aria-hidden",!0),m(2),g("id",ch("mask-",i.veltId)),m(2),T("mask","url(#mask-"+i.veltId+")")}}function d1n(n,r){if(n&1){let i=K();h(0),_(1,"velt-comment-dialog-portal-internal",8),G("togglePinSelection",function(t){N(i);let o=c(2);return o.togglePinSelection(o.commentAnnotations[0]),F(t.stopPropagation())})("saveComment",function(t){N(i);let o=c(2);return F(o.saveComment(t,o.commentAnnotations[0]))}),_(2,"div",9),G("click",function(t){return N(i),F(t.stopPropagation())})("pointerup",function(t){N(i);let o=c(2);return o.togglePinSelection(o.commentAnnotations[0]),F(t.stopPropagation())}),_(3,"div",10),de(),_(4,"svg",11),D(5,"path",12)(6,"rect",13),y(),bt(),_(7,"div",14),D(8,"snippyly-user-avatar",15),y()(),_(9,"div",16),de(),_(10,"svg",4),D(11,"rect",17)(12,"circle",18),y()()()(),f()}if(n&2){let i=c(2);m(),g("annotation",i.commentAnnotations[0])("commentPinType","chart")("commentPinSelected",!!i.selectedAnnotationsMap[i.commentAnnotations[0]==null?null:i.commentAnnotations[0].annotationId])("user",i.user),m(),ve("selected",!!i.selectedAnnotationsMap[i.commentAnnotations[0]==null?null:i.commentAnnotations[0].annotationId])("ghost-comment",i.ghostComment),T("data-testid",i.componentId+"-dialog-portal"),m(),T("aria-hidden",!0),m(5),g("size",15)("user",i.commentAnnotations[0]==null?null:i.commentAnnotations[0].from),m(),T("aria-hidden",!0)}}function m1n(n,r){if(n&1){let i=K();h(0),_(1,"div",1),G("click",function(){N(i);let t=c();return F(t.addChartComment())}),p(2,c1n,5,4,"div",2)(3,d1n,13,13,"ng-container",0),y(),f()}if(n&2){let i=c();m(),ve("ghost-comment",i.ghostComment),T("role","button")("tabindex",0)("data-testid",i.componentId),m(),g("ngIf",!(i.commentAnnotations!=null&&i.commentAnnotations.length)),m(),g("ngIf",i.commentAnnotations==null?null:i.commentAnnotations.length)}}var Sxe=(()=>{let r=class r extends Ct{set _commentMetadata(e){try{let t=e;typeof e=="string"&&(t=JSON.parse(e)),this.commentMetadata=t,this.filterCommentAnnotationsByCommentMetadata()}catch{}}set _dialogMetadataTemplate(e){try{let t=e;typeof e=="string"&&(t=JSON.parse(e)),this.dialogMetadataTemplate=t}catch{}}set _ghostComment(e){try{let t=e;typeof e=="string"&&(t=JSON.parse(e)),this.ghostComment=t}catch{}}constructor(e,t,o,a,l,s,d){super(d,s),this.authService=e,this.commentService=t,this.docService=o,this.domService=a,this.loggingService=l,this.themeService=s,this.elementRef=d,this.dialogMetadataTemplate=["x","y","value"],this.ghostComment=!1,this.selectedAnnotationsMap={},this.allCommentAnnotations=[],this.commentAnnotations=[],this.subscriptions=[],this.veltId=St(),this.veltElement=!0,this.componentId="velt-chart-comment";try{this.loggingService.log("%c[WB] Creating COMPONENT ChartCommentComponent","color: blue;"),this.subscriptions.push(this.authService.getUser$().subscribe(v=>{this.user=v}))}catch(v){this.loggingService.catch("Error in ChartCommentComponent constructor: ",v)}}ngOnInit(){try{this.loggingService.log("%c[WB] Calling ChartCommentComponent FUNCTION: OnInit","color: green;"),this.setupA11yAttributes(),this.subscriptions.push(this.docService.getLocation$().subscribe(()=>{this.filterCommentAnnotationsByCommentMetadata()})),this.getChartCommentAnnotations(),this.subscriptions.push(this.domService.getSelectedAnnotationsMap$().subscribe(e=>{this.selectedAnnotationsMap=e||{},this.checkSelectedCommentAnnotation()}))}catch(e){this.loggingService.catch("Error in ChartCommentComponent OnInit: ",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","region"),e.setAttribute("aria-label","Chart comment region")}catch(e){this.loggingService.catch("Error in ChartCommentComponent setupA11yAttributes:",e)}}getChartCommentAnnotations(){try{this.loggingService.log("%c[WB] Calling ChartCommentComponent FUNCTION: getChartCommentAnnotations","color: green;"),this.subscriptions.push(this.commentService.getCommentAnnotationsOnCurrentOrganizationAndDocument$().pipe(fe(e=>this.docService.getLocation$().pipe(ge(()=>e))),ge(e=>e?.filter(t=>t.commentType==="chart")),xt((e,t)=>JSON.stringify(e||[])===JSON.stringify(t||[]))).subscribe(e=>{this.allCommentAnnotations=e||[],this.filterCommentAnnotationsByCommentMetadata(),this.checkSelectedCommentAnnotation()}))}catch(e){this.loggingService.catch("Error in ChartCommentComponent getChartCommentAnnotations: ",e)}}checkSelectedCommentAnnotation(){try{this.loggingService.log("%c[WB] Calling ChartCommentComponent FUNCTION: checkSelectedCommentAnnotation","color: green;");let e;this.commentAnnotations.forEach(t=>{this.selectedAnnotationsMap[t.annotationId]&&(e=t)}),e?this.selectedCommentAnnotation=e:this.selectedCommentAnnotation=void 0}catch(e){this.loggingService.catch("Error in ChartCommentComponent checkSelectedCommentAnnotation: ",e)}}addChartComment(){try{if(this.loggingService.log("%c[WB] Calling ChartCommentComponent FUNCTION: addChartComment","color: green;"),!this.commentAnnotations?.length){let e=b({},this.commentMetadata);this.dialogMetadataTemplate&&(e.metadataTemplate=this.dialogMetadataTemplate);let t=this.docService.getAdditionLocationFromElement(this.elementRef?.nativeElement);if(t?.id){let o=this.docService.getLocationByClientLocationId(t.id);o&&(t=o)}this.commentService.addComment(void 0,void 0,void 0,void 0,void 0,void 0,e,t)}}catch(e){this.loggingService.catch("Error in ChartCommentComponent addChartComment: ",e)}}filterCommentAnnotationsByCommentMetadata(){try{this.loggingService.log("%c[WB] Calling ChartCommentComponent FUNCTION: filterCommentAnnotationsByCommentMetadata","color: green;"),this.commentMetadata?this.commentAnnotations=this.allCommentAnnotations?.filter(e=>{let t=e.metadata||{};for(let o in this.commentMetadata||{})if(t[o]!==this.commentMetadata[o])return!1;return!0}):this.commentAnnotations=[]}catch(e){this.commentAnnotations=[],this.loggingService.catch("Error in ChartCommentComponent filterCommentAnnotationsByCommentMetadata: ",e)}}togglePinSelection(e){try{if(this.loggingService.log("%c[WB] Calling ChartCommentComponent FUNCTION: togglePinSelection","color: green;"),e)if(this.selectedAnnotationsMap[e?.annotationId])document.querySelector(`[${V.ATTRIBUTES.VELT_ANNOTATION_DRAFT}="${e?.annotationId}"]`)?this.domService.resetSelectedAnnotationsMap(!0,"comments"):this.domService.toggleAnnotationSelection(e);else{let t=document.querySelector(`[${V.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);if(t||(t=(this.domService.getDraftCommentAnnotationDialogs()||[])[0]),t){let o=t.getAttribute(V.ATTRIBUTES.VELT_ANNOTATION_DRAFT);if(o){let a=document.getElementById(`comment-pin-container-${o}`)||document.querySelector(`[data-velt-id='${o}']`);a&&(a.scrollIntoView({behavior:"auto",block:"center",inline:"center"}),this.domService.resetSelectedAnnotationsMap(!0,"comments"))}}else this.domService.resetSelectedAnnotationsMap(!0,"comments"),this.domService.toggleAnnotationSelection(e)}}catch(t){this.loggingService.catch("Error in ChartCommentComponent togglePinSelection: ",t)}}saveComment(e,t){try{this.loggingService.log("%c[WB] Calling ChartCommentComponent FUNCTION: saveComment","color: green;"),t&&this.commentService.saveComment(t,e)}catch(o){this.loggingService.catch("Error in ChartCommentComponent saveComment: ",o)}}ngOnDestroy(){this.loggingService.log("%c[WB] Calling ChartCommentComponent FUNCTION: ngOnDestroy","color: green;");try{super.ngOnDestroy(),this.unsubscribe()}catch(e){this.loggingService.catch("Error in ChartCommentComponent ondestroy: ",e)}}unsubscribe(){this.loggingService.log("%c[WB] Calling ChartCommentComponent FUNCTION: unsubscribe","color: green;");try{this.subscriptions.map(e=>{e.unsubscribe()}),this.subscriptions=[]}catch(e){this.loggingService.catch("Error in ChartCommentComponent unsubscribe: ",e)}}};r.\u0275fac=function(t){return new(t||r)(C(Ge),C(Pe),C(lt),C(Ve),C(x),C(mt),C(z))},r.\u0275cmp=O({type:r,selectors:[["app-chart-comment"]],hostVars:2,hostBindings:function(t,o){t&2&&T("data-velt-id",o.veltId)("data-velt-element",o.veltElement)},inputs:{_commentMetadata:[0,"commentMetadata","_commentMetadata"],_dialogMetadataTemplate:[0,"dialogMetadataTemplate","_dialogMetadataTemplate"],_ghostComment:[0,"ghostComment","_ghostComment"]},standalone:!1,features:[L],decls:1,vars:1,consts:[[4,"ngIf"],[1,"velt-chart-comment--container",3,"click"],["class","velt-chart-comment--dot-no-comments",4,"ngIf"],[1,"velt-chart-comment--dot-no-comments"],["width","12","height","12","viewBox","0 0 12 12","fill","none","xmlns","http://www.w3.org/2000/svg"],["fill","white",3,"id"],["d","M0 6C0 2.68629 2.68629 0 6 0C9.31371 0 12 2.68629 12 6C12 9.31371 9.31371 12 6 12H1C0.447715 12 0 11.5523 0 11V6Z"],["d","M0 6C0 2.68629 2.68629 0 6 0C9.31371 0 12 2.68629 12 6C12 9.31371 9.31371 12 6 12H1C0.447715 12 0 11.5523 0 11V6Z","fill","white","stroke","currentColor","stroke-width","3"],[3,"togglePinSelection","saveComment","annotation","commentPinType","commentPinSelected","user"],[1,"velt-chart-comment--pin-container",3,"click","pointerup"],[1,"velt-chart-comment--pin"],["width","20","height","20","viewBox","0 0 20 20","fill","none","xmlns","http://www.w3.org/2000/svg",0,"xmlns","xlink","http://www.w3.org/1999/xlink"],["d","M0.625 10C0.625 4.82233 4.82233 0.625 10 0.625C15.1777 0.625 19.375 4.82233 19.375 10C19.375 15.1777 15.1777 19.375 10 19.375H0.625V10Z","fill","white","stroke","currentColor","stroke-width","1.25"],["x","2.5","y","2.5","width","15","height","15","rx","7.5"],[1,"velt-chart-comment--user-avatar-container"],[3,"size","user"],[1,"velt-chart-comment--dot"],["x","0.75","y","0.75","width","10.5","height","10.5","rx","5.25","fill","white","stroke","currentColor","stroke-width","1.5"],["cx","6","cy","6","r","2.25","fill","currentColor"]],template:function(t,o){t&1&&p(0,m1n,4,7,"ng-container",0),t&2&&g("ngIf",o.commentMetadata)},dependencies:[se,ri,Zy],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}[_nghost-%COMP%]{--velt-green: var(--velt-light-mode-green);--velt-magenta: var(--velt-light-mode-magenta);--velt-amber: var(--velt-light-mode-amber);--velt-purple: var(--velt-light-mode-purple);--velt-cyan: var(--velt-light-mode-cyan);--velt-orange: var(--velt-light-mode-orange);--velt-black: var(--velt-light-mode-black);--velt-white: var(--velt-light-mode-white);--velt-gray: var(--velt-light-mode-gray);--velt-error: var(--velt-light-mode-error);--velt-error-hover: var(--velt-light-mode-error-hover);--velt-error-foreground: var(--velt-light-mode-error-foreground);--velt-error-light: var(--velt-light-mode-error-light);--velt-error-transparent: var(--velt-light-mode-error-transparent);--velt-warning: var(--velt-light-mode-warning);--velt-warning-hover: var(--velt-light-mode-warning-hover);--velt-warning-foreground: var(--velt-light-mode-warning-foreground);--velt-warning-light: var(--velt-light-mode-warning-light);--velt-warning-transparent: var(--velt-light-mode-warning-transparent);--velt-success: var(--velt-light-mode-success);--velt-success-hover: var(--velt-light-mode-success-hover);--velt-success-foreground: var(--velt-light-mode-success-foreground);--velt-success-light: var(--velt-light-mode-success-light);--velt-success-transparent: var(--velt-light-mode-success-transparent);--velt-accent: var(--velt-light-mode-accent);--velt-accent-text: var(--velt-light-mode-accent-text);--velt-accent-hover: var(--velt-light-mode-accent-hover);--velt-accent-foreground: var(--velt-light-mode-accent-foreground);--velt-accent-light: var(--velt-light-mode-accent-light);--velt-accent-transparent: var(--velt-light-mode-accent-transparent);--velt-text-0: var(--velt-light-mode-text-0);--velt-text-1: var(--velt-light-mode-text-1);--velt-text-2: var(--velt-light-mode-text-2);--velt-text-3: var(--velt-light-mode-text-3);--velt-text-4: var(--velt-light-mode-text-4);--velt-text-5: var(--velt-light-mode-text-5);--velt-text-6: var(--velt-light-mode-text-6);--velt-text-7: var(--velt-light-mode-text-7);--velt-text-8: var(--velt-light-mode-text-8);--velt-text-9: var(--velt-light-mode-text-9);--velt-text-10: var(--velt-light-mode-text-10);--velt-text-11: var(--velt-light-mode-text-11);--velt-text-12: var(--velt-light-mode-text-12);--velt-background-0: var(--velt-light-mode-background-0);--velt-background-1: var(--velt-light-mode-background-1);--velt-background-2: var(--velt-light-mode-background-2);--velt-background-3: var(--velt-light-mode-background-3);--velt-background-4: var(--velt-light-mode-background-4);--velt-background-5: var(--velt-light-mode-background-5);--velt-background-6: var(--velt-light-mode-background-6);--velt-background-7: var(--velt-light-mode-background-7);--velt-background-8: var(--velt-light-mode-background-8);--velt-background-9: var(--velt-light-mode-background-9);--velt-background-10: var(--velt-light-mode-background-10);--velt-border-0: var(--velt-light-mode-border-0);--velt-border-1: var(--velt-light-mode-border-1);--velt-border-2: var(--velt-light-mode-border-2);--velt-border-3: var(--velt-light-mode-border-3);--velt-border-4: var(--velt-light-mode-border-4);--velt-border-5: var(--velt-light-mode-border-5);--velt-border-6: var(--velt-light-mode-border-6);--velt-border-7: var(--velt-light-mode-border-7);--velt-border-8: var(--velt-light-mode-border-8);--velt-border-9: var(--velt-light-mode-border-9);--velt-border-10: var(--velt-light-mode-border-10);--velt-background-transparent: var(--velt-light-mode-background-transparent);--velt-border-transparent: var(--velt-light-mode-border-transparent);--velt-animation-transparent: var(--velt-light-mode-animation-transparent);display:inline-flex}[dark][_nghost-%COMP%]{--velt-green: var(--velt-dark-mode-green);--velt-magenta: var(--velt-dark-mode-magenta);--velt-amber: var(--velt-dark-mode-amber);--velt-purple: var(--velt-dark-mode-purple);--velt-cyan: var(--velt-dark-mode-cyan);--velt-orange: var(--velt-dark-mode-orange);--velt-black: var(--velt-dark-mode-black);--velt-white: var(--velt-dark-mode-white);--velt-gray: var(--velt-dark-mode-gray);--velt-error: var(--velt-dark-mode-error);--velt-error-hover: var(--velt-dark-mode-error-hover);--velt-error-foreground: var(--velt-dark-mode-error-foreground);--velt-error-light: var(--velt-dark-mode-error-light);--velt-error-transparent: var(--velt-dark-mode-error-transparent);--velt-warning: var(--velt-dark-mode-warning);--velt-warning-hover: var(--velt-dark-mode-warning-hover);--velt-warning-foreground: var(--velt-dark-mode-warning-foreground);--velt-warning-light: var(--velt-dark-mode-warning-light);--velt-warning-transparent: var(--velt-dark-mode-warning-transparent);--velt-success: var(--velt-dark-mode-success);--velt-success-hover: var(--velt-dark-mode-success-hover);--velt-success-foreground: var(--velt-dark-mode-success-foreground);--velt-success-light: var(--velt-dark-mode-success-light);--velt-success-transparent: var(--velt-dark-mode-success-transparent);--velt-accent: var(--velt-dark-mode-accent);--velt-accent-text: var(--velt-dark-mode-accent-text);--velt-accent-hover: var(--velt-dark-mode-accent-hover);--velt-accent-foreground: var(--velt-dark-mode-accent-foreground);--velt-accent-light: var(--velt-dark-mode-accent-light);--velt-accent-transparent: var(--velt-dark-mode-accent-transparent);--velt-text-0: var(--velt-dark-mode-text-0);--velt-text-1: var(--velt-dark-mode-text-1);--velt-text-2: var(--velt-dark-mode-text-2);--velt-text-3: var(--velt-dark-mode-text-3);--velt-text-4: var(--velt-dark-mode-text-4);--velt-text-5: var(--velt-dark-mode-text-5);--velt-text-6: var(--velt-dark-mode-text-6);--velt-text-7: var(--velt-dark-mode-text-7);--velt-text-8: var(--velt-dark-mode-text-8);--velt-text-9: var(--velt-dark-mode-text-9);--velt-text-10: var(--velt-dark-mode-text-10);--velt-text-11: var(--velt-dark-mode-text-11);--velt-text-12: var(--velt-dark-mode-text-12);--velt-background-0: var(--velt-dark-mode-background-0);--velt-background-1: var(--velt-dark-mode-background-1);--velt-background-2: var(--velt-dark-mode-background-2);--velt-background-3: var(--velt-dark-mode-background-3);--velt-background-4: var(--velt-dark-mode-background-4);--velt-background-5: var(--velt-dark-mode-background-5);--velt-background-6: var(--velt-dark-mode-background-6);--velt-background-7: var(--velt-dark-mode-background-7);--velt-background-8: var(--velt-dark-mode-background-8);--velt-background-9: var(--velt-dark-mode-background-9);--velt-background-10: var(--velt-dark-mode-background-10);--velt-border-0: var(--velt-dark-mode-border-0);--velt-border-1: var(--velt-dark-mode-border-1);--velt-border-2: var(--velt-dark-mode-border-2);--velt-border-3: var(--velt-dark-mode-border-3);--velt-border-4: var(--velt-dark-mode-border-4);--velt-border-5: var(--velt-dark-mode-border-5);--velt-border-6: var(--velt-dark-mode-border-6);--velt-border-7: var(--velt-dark-mode-border-7);--velt-border-8: var(--velt-dark-mode-border-8);--velt-border-9: var(--velt-dark-mode-border-9);--velt-border-10: var(--velt-dark-mode-border-10);--velt-background-transparent: var(--velt-dark-mode-background-transparent);--velt-border-transparent: var(--velt-dark-mode-border-transparent);--velt-animation-transparent: var(--velt-dark-mode-animation-transparent)}.velt-chart-comment--container[_ngcontent-%COMP%]{display:flex;cursor:pointer;color:var(--velt-accent)}.velt-chart-comment--container[_ngcontent-%COMP%] .velt-chart-comment--dot-no-comments[_ngcontent-%COMP%]{opacity:0;visibility:hidden}.velt-chart-comment--container[_ngcontent-%COMP%]:hover .velt-chart-comment--dot-no-comments[_ngcontent-%COMP%]{opacity:1;visibility:visible}.velt-chart-comment--container[_ngcontent-%COMP%] .velt-chart-comment--pin-container{color:var(--velt-accent)}.velt-chart-comment--container[_ngcontent-%COMP%] .velt-chart-comment--pin-container .velt-chart-comment--pin{position:relative;display:flex}.velt-chart-comment--container[_ngcontent-%COMP%] .velt-chart-comment--pin-container .velt-chart-comment--pin .velt-chart-comment--user-avatar-container{position:absolute;top:0;left:0;width:100%;height:100%;display:flex;align-items:center;justify-content:center}.velt-chart-comment--container[_ngcontent-%COMP%] .velt-chart-comment--pin-container .velt-chart-comment--pin .velt-chart-comment--user-avatar-container snippyly-user-avatar{display:flex}.velt-chart-comment--container[_ngcontent-%COMP%] .velt-chart-comment--pin-container .velt-chart-comment--pin{opacity:0;visibility:hidden;display:none}.velt-chart-comment--container[_ngcontent-%COMP%] .velt-chart-comment--pin-container:hover .velt-chart-comment--pin, .velt-chart-comment--container[_ngcontent-%COMP%] .velt-chart-comment--pin-container.selected .velt-chart-comment--pin{opacity:1;visibility:visible;display:flex}.velt-chart-comment--container[_ngcontent-%COMP%] .velt-chart-comment--pin-container:hover .velt-chart-comment--dot, .velt-chart-comment--container[_ngcontent-%COMP%] .velt-chart-comment--pin-container.selected .velt-chart-comment--dot{opacity:0;visibility:hidden;display:none}.velt-chart-comment--container[_ngcontent-%COMP%] .velt-chart-comment--pin-container.ghost-comment{color:var(--velt-gray)}"],changeDetection:0});let n=r;return n})();var yxe=(()=>{let r=class r{transform(e,t,o,a,l,...s){try{if(e&&t?.length){let d=t.filter((u,S,k)=>k.findIndex(A=>A.text===u.text)===S);d.sort((u,S)=>(S.text?.length||0)-(u.text?.length||0));let v=new Map;d.forEach((u,S)=>{if(u?.text){let k=`\0VELT_CUSTOM_${S}\0`,A=new RegExp(bc(u.text),"g");v.set(k,`
|
|
557
|
+
<velt-autocomplete-chip type="custom" custom='${u?.custom?JSON.stringify(u||{}):void 0}' encoded-custom='${u?.custom?btoa(JSON.stringify(u||{})):void 0}' shadow-dom='${l?"true":"false"}'>
|
|
558
|
+
</velt-autocomplete-chip>`),e=e.replaceAll(A,k)}}),v.forEach((u,S)=>{e=e.replaceAll(S,()=>u)})}if(e&&o?.length){let d=o.filter((u,S,k)=>k.findIndex(A=>A.text===u.text)===S);d.sort((u,S)=>(S.text?.length||0)-(u.text?.length||0));let v=new Map;d.forEach((u,S)=>{if(u?.text){let k=`\0VELT_GROUP_${S}\0`,A=new RegExp(bc(u.text),"g");v.set(k,`
|
|
559
|
+
<velt-autocomplete-chip type="group" group='${u?.groupId?JSON.stringify(u||{}):void 0}' encoded-group='${u?.groupId?btoa(JSON.stringify(u||{})):void 0}' shadow-dom='${l?"true":"false"}'>
|
|
560
|
+
</velt-autocomplete-chip>`),e=e.replaceAll(A,k)}}),v.forEach((u,S)=>{e=e.replaceAll(S,()=>u)})}if(e&&a?.length){let d=a.filter((S,k,A)=>A.findIndex(P=>P.text===S.text)===k);d.sort((S,k)=>(k.text?.length||0)-(S.text?.length||0));let v=new Map;d.forEach((S,k)=>{if(S?.text){let A=`\0VELT_CONTACT_${k}\0`,P=new RegExp(bc(S.text),"g");v.set(A,`
|
|
561
|
+
<velt-autocomplete-chip type="contact" contact='${S?.contact?JSON.stringify(S||{}):void 0}' encoded-contact='${S?.contact?btoa(JSON.stringify(S||{})):void 0}' shadow-dom='${l?"true":"false"}'>
|
|
562
|
+
</velt-autocomplete-chip>`),e=e.replaceAll(P,A)}}),v.forEach((S,k)=>{e=e.replaceAll(k,()=>S)}),(a?.filter(S=>!S.text).filter((S,k,A)=>A.findIndex(P=>P.userId===S.userId)===k)).forEach(S=>{if(S?.userId){let k=new RegExp(bc(`{{${S.userId}}}`),"g");e=e.replaceAll(k,A=>`<velt-autocomplete-chip type="loading" shadow-dom='${l?"true":"false"}'></velt-autocomplete-chip>`)}})}return e}catch{return e}}};r.\u0275fac=function(t){return new(t||r)},r.\u0275pipe=or({name:"replaceAutocompleteList",type:r,pure:!0,standalone:!1});let n=r;return n})();var xxe=(()=>{let r=class r{set _hotkey(e){try{this.hotkey=e,this.setListData()}catch{}}set _listData(e){try{this.listData=g1n(e),this.setListData()}catch{}}constructor(e,t){this.autocompleteService=e,this.loggingService=t,this.hotkey="",this.listData=[];try{this.loggingService.log("%c[WB] Creating COMPONENT AutocompleteComponent","color: blue;")}catch(o){this.loggingService.catch("Error in AutocompleteComponent constructor: ",o)}}setListData(){try{this.loggingService.log("%c[WB] Calling AutocompleteComponent FUNCTION: setListData","color: green;"),v1n(this.hotkey,this.listData)&&this.autocompleteService.create({hotkey:this.hotkey,data:this.listData,type:"custom"})}catch(e){this.loggingService.catch("Error in AutocompleteComponent setListData: ",e)}}ngOnDestroy(){try{this.loggingService.log("%c[WB] Calling AutocompleteComponent FUNCTION: OnDestroy","color: green;"),this.hotkey&&this.autocompleteService.remove(this.hotkey)}catch(e){this.loggingService.catch("Error in AutocompleteComponent OnDestroy: ",e)}}};r.\u0275fac=function(t){return new(t||r)(C(Hl),C(x))},r.\u0275cmp=O({type:r,selectors:[["velt-autocomplete-internal"]],inputs:{_hotkey:[0,"hotkey","_hotkey"],_listData:[0,"listData","_listData"]},standalone:!1,decls:0,vars:0,template:function(t,o){},encapsulation:2,changeDetection:0});let n=r;return n})();function g1n(n){return typeof n=="string"?JSON.parse(n):n}function v1n(n,r){return!!(n&&r?.length)}var Ym=(()=>{let r=class r{constructor(e,t){this.domService=e,this.sanitizer=t}transform(e){try{let t=this.domService.sanitizeSvg(e);return this.sanitizer.bypassSecurityTrustHtml(t)}catch{return e}}};r.\u0275fac=function(t){return new(t||r)(C(Ve,16),C(Jc,16))},r.\u0275pipe=or({name:"safeSvg",type:r,pure:!0,standalone:!1});let n=r;return n})();var p1n=()=>({"line-height":"20px"});function h1n(n,r){if(n&1){let i=K();_(0,"mark",6),G("click",function(){N(i);let t=c(4);return F(t.onClick())}),ne(1),M(2,"translate"),y()}if(n&2){let i=c(3),e=c();ve("velt-autocomplete--contact-chip-current-user",(i==null||i.user==null?null:i.user.userId)&&(i==null||i.contact==null?null:i.contact.userId)===(i==null||i.user==null?null:i.user.userId))("current-user-chip",(i==null||i.user==null?null:i.user.userId)&&(i==null||i.contact==null?null:i.contact.userId)===(i==null||i.user==null?null:i.user.userId)),m(),Ee(" ",R(2,5,(i==null||i.contact==null?null:i.contact.name)||(i==null||i.contact==null?null:i.contact.email)||e.email))}}function f1n(n,r){if(n&1){let i=K();_(0,"mark",7),G("click",function(){N(i);let t=c(4);return F(t.onClick())}),ne(1),M(2,"translate"),y()}if(n&2){let i=c(3);m(),Ee(" ",R(2,1,(i==null||i.group==null||i.group.group==null||i.group.group.metadata==null?null:i.group.group.metadata.groupName)||(i==null||i.group==null?null:i.group.text)))}}function C1n(n,r){if(n&1&&(D(0,"div",9),M(1,"safeSvg")),n&2){let i=c(4);g("innerHtml",R(1,1,i==null||i.custom==null||i.custom.custom==null||i.custom.custom.icon==null?null:i.custom.custom.icon.svg),ji)}}function _1n(n,r){if(n&1&&D(0,"img",10),n&2){let i=c(4);g("src",i==null||i.custom==null||i.custom.custom==null||i.custom.custom.icon==null?null:i.custom.custom.icon.url,pn)}}function b1n(n,r){if(n&1){let i=K();_(0,"div",8),G("click",function(){N(i);let t=c(4);return F(t.onClick())}),ie(1,C1n,2,3,"div",9),ie(2,_1n,1,1,"img",10),_(3,"span"),ne(4),M(5,"translate"),y()()}if(n&2){let i=c(3);m(),re(!(i==null||i.custom==null||i.custom.custom==null||i.custom.custom.icon==null)&&i.custom.custom.icon.svg?1:-1),m(),re(!(i==null||i.custom==null||i.custom.custom==null||i.custom.custom.icon==null)&&i.custom.custom.icon.url?2:-1),m(2),Ke(R(5,3,i==null||i.custom==null||i.custom.custom==null?null:i.custom.custom.name))}}function S1n(n,r){if(n&1&&ie(0,h1n,3,7,"mark",3)(1,f1n,3,3,"mark",4)(2,b1n,6,5,"div",5),n&2){let i=c(3);re(i.type==="contact"?0:i.type==="group"?1:i.type==="custom"?2:-1)}}function y1n(n,r){if(n&1&&D(0,"velt-autocomplete-chip-tooltip-internal",11),n&2){let i=c(2),e=c();g("componentConfigSignal",e.componentConfigSignal)("shadowDom",!!(i!=null&&i.shadowDom))}}function x1n(n,r){n&1&&(_(0,"app-overlay-tooltip"),p(1,S1n,3,1,"ng-template",null,0,Me)(3,y1n,1,2,"ng-template",null,1,Me),y())}function I1n(n,r){n&1&&D(0,"velt-skeleton-loader-internal",2),n&2&&g("borderRadius","4px")("customStyles",yt(2,p1n))}function E1n(n,r){if(n&1&&ie(0,x1n,5,0,"app-overlay-tooltip")(1,I1n,1,3,"velt-skeleton-loader-internal",2),n&2){let i=c();re(i.type!=="loading"?0:1)}}var Ixe=(()=>{let r=class r extends wr{set _custom(e){try{typeof e=="string"&&(e=JSON.parse(e))}catch{}}set _group(e){try{typeof e=="string"&&(e=JSON.parse(e))}catch{}}set _contactData(e){try{typeof e=="string"&&(e=JSON.parse(e))}catch{}}set _encodedContact(e){try{typeof e=="string"&&(e=JSON.parse(e))}catch{}}set _encodedGroup(e){try{typeof e=="string"&&(e=JSON.parse(e))}catch{}}set _encodedCustom(e){try{typeof e=="string"&&(e=JSON.parse(e))}catch{}}set userObject(e){try{if(!e)return;let t=typeof e=="string"?JSON.parse(e):e;this.componentConfigSignal.update(o=>E(b({},o),{type:"contact",contact:t}))}catch(t){this.loggingService.catch("Error parsing userObject:",t)}}set userId(e){try{if(!e)return;let o=(this.contactService.getInternalUserContacts()??[]).find(a=>a.userId===e);o&&this.componentConfigSignal.update(a=>E(b({},a),{type:"contact",contact:o}))}catch(t){this.loggingService.catch("Error looking up userId:",t)}}set _shadowDom(e){try{typeof e=="string"&&(e=JSON.parse(e))}catch{}}constructor(){super(),this.type="contact",this.componentConfigSignal=Oe({type:"contact"}),this.subscriptions=[],this.authService=pe(Ge),this.autocompleteService=pe(Hl),this.contactService=pe(ln);try{this.loggingService.log("%c[WB] Creating COMPONENT AutocompleteChipComponent","color: blue;"),this.subscriptions.push(this.commentService.getDialogShadowDOM$().subscribe(e=>{this.componentConfigSignal.update(t=>(t=E(b({},t),{shadowDom:e}),t))}))}catch(e){this.loggingService.catch("Error in AutocompleteChipComponent constructor: ",e)}}ngOnInit(){try{this.loggingService.log("%c[WB] Calling AutocompleteChipComponent FUNCTION: ngOnInit","color: green;"),super.ngOnInit(),setTimeout(()=>{this.componentConfigSignal().type==="contact"&&(this.email||this.componentConfigSignal().contactData?.contact)&&(this.getCurrentUser(),this.email?(this.getContacts(),this.getUserByEmail(this.email)):this.componentConfigSignal().contactData?.contact&&this.componentConfigSignal.update(e=>(e=E(b({},e),{contact:e.contactData?.contact}),e))),this.componentConfigSignal().type==="group"&&this.getOrganizationGroups()},0)}catch(e){this.loggingService.catch("Error in AutocompleteChipComponent ngOnInit: ",e)}}ngOnChanges(e){try{e&&setTimeout(()=>{Object.keys(e).forEach(t=>{t==="_custom"?this.componentConfigSignal.update(o=>{let a=e[t].currentValue;if(typeof a=="string")try{a=JSON.parse(a)}catch{if(e?._encodedCustom?.currentValue)try{a=JSON.parse(atob(e?._encodedCustom?.currentValue))}catch{}}return o=E(b({},o),{custom:a}),o}):t==="_group"?this.componentConfigSignal.update(o=>{let a=e[t].currentValue;if(typeof a=="string")try{a=JSON.parse(a)}catch{if(e?._encodedGroup?.currentValue)try{a=JSON.parse(atob(e?._encodedGroup?.currentValue))}catch{}}return o=E(b({},o),{group:a}),o}):t==="_contactData"?this.componentConfigSignal.update(o=>{let a=e[t].currentValue;if(typeof a=="string")try{a=JSON.parse(a)}catch{if(e?._encodedContact?.currentValue)try{a=JSON.parse(atob(e?._encodedContact?.currentValue))}catch{}}return o=E(b({},o),{contactData:a}),o}):t==="_shadowDom"?this.componentConfigSignal.update(o=>(o=b({},o),o.shadowDom=typeof e[t].currentValue=="string"?JSON.parse(e[t].currentValue):e[t].currentValue,o)):this.componentConfigSignal.update(o=>(o=E(b({},o),{[t]:e[t].currentValue}),o))})},0)}catch(t){this.loggingService.catch("Error in AutocompleteChipComponent ngOnChanges: ",t)}}getCurrentUser(){try{this.loggingService.log("%c[WB] Calling AutocompleteChipComponent FUNCTION: getCurrentUser","color: green;"),this.subscriptions.push(this.authService.getUser$().subscribe(e=>{this.componentConfigSignal.update(t=>(t=E(b({},t),{user:e}),t))}))}catch(e){this.loggingService.catch("Error in AutocompleteChipComponent getCurrentUser: ",e)}}getContacts(){try{this.loggingService.log("%c[WB] Calling AutocompleteChipComponent FUNCTION: getContacts","color: green;"),this.subscriptions.push(this.contactService.getUserContacts$().subscribe(e=>{let t=e?.find(o=>o.email===this.email);t&&this.componentConfigSignal.update(o=>(o=E(b({},o),{contact:t}),o))}))}catch(e){this.loggingService.catch("Error in AutocompleteChipComponent getContacts: ",e)}}getUserByEmail(e){try{this.loggingService.log("%c[WB] Calling AutocompleteChipComponent FUNCTION: getUserByEmail","color: green;"),this.subscriptions.push(this.contactService.getUserByEmail$(e).subscribe(t=>{t&&this.componentConfigSignal.update(o=>(o=E(b({},o),{contact:t}),o))}))}catch(t){this.loggingService.catch("Error in AutocompleteChipComponent getUserByEmail: ",t)}}getOrganizationGroups(){try{this.loggingService.log("%c[WB] Calling AutocompleteChipComponent FUNCTION: getOrganizationGroups","color: green;"),this.subscriptions.push(this.contactService.getOrganizationGroups$().subscribe(e=>{if(e){let t=e.find(o=>o?.metadata?.groupId===this.componentConfigSignal().group?.groupId);t&&this.componentConfigSignal().group&&this.componentConfigSignal.update(o=>(o=E(b({},o),{group:E(b({},o.group),{group:t})}),o))}}))}catch(e){this.loggingService.catch("Error in AutocompleteChipComponent getOrganizationGroups: ",e)}}onClick(){try{this.loggingService.log("%c[WB] Calling AutocompleteChipComponent FUNCTION: onClick","color: green;");let e;this.componentConfigSignal().custom?.custom?e=E(b({},this.componentConfigSignal().custom?.custom),{type:"custom"}):this.componentConfigSignal().contact?(e={id:this.componentConfigSignal().contact?.userId,name:this.componentConfigSignal().contact?.name,description:this.componentConfigSignal().contact?.email,type:"contact"},this.componentConfigSignal().contact?.photoUrl&&(e.icon={url:this.componentConfigSignal().contact?.photoUrl})):this.componentConfigSignal().type==="contact"&&(e={id:void 0,name:void 0,description:this.email,type:"contact"}),e&&this.autocompleteService.setOnAutocompleteChipClick(e)}catch(e){this.loggingService.catch("Error in AutocompleteChipComponent onClick: ",e)}}unsubscribe(){try{this.loggingService.log("%c[WB] Calling AutocompleteChipComponent FUNCTION: unsubscribe","color: green;"),this.subscriptions.forEach(e=>e?.unsubscribe())}catch(e){this.loggingService.catch("Error in AutocompleteChipComponent unsubscribe: ",e)}}ngOnDestroy(){try{this.loggingService.log("%c[WB] Calling AutocompleteChipComponent FUNCTION: OnDestroy","color: green;"),this.unsubscribe(),super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in AutocompleteChipComponent OnDestroy: ",e)}}};r.\u0275fac=function(t){return new(t||r)},r.\u0275cmp=O({type:r,selectors:[["velt-autocomplete-chip-internal"]],inputs:{type:"type",email:"email",_custom:[0,"custom","_custom"],_group:[0,"group","_group"],_contactData:[0,"contact","_contactData"],_encodedContact:[0,"encodedContact","_encodedContact"],_encodedGroup:[0,"encodedGroup","_encodedGroup"],_encodedCustom:[0,"encodedCustom","_encodedCustom"],userObject:"userObject",userId:"userId",_shadowDom:[0,"shadowDom","_shadowDom"]},standalone:!1,features:[L,it],decls:1,vars:1,consts:[["triggerTemplate",""],["tooltipTemplate",""],["width","64px",3,"borderRadius","customStyles"],[1,"velt-autocomplete--contact-chip",3,"velt-autocomplete--contact-chip-current-user","current-user-chip"],[1,"velt-autocomplete--group-chip"],[1,"custom-chip"],[1,"velt-autocomplete--contact-chip",3,"click"],[1,"velt-autocomplete--group-chip",3,"click"],[1,"custom-chip",3,"click"],[1,"custom-chip-icon","custom-chip-icon-svg",3,"innerHtml"],[1,"custom-chip-icon","custom-chip-icon-img",3,"src"],[3,"componentConfigSignal","shadowDom"]],template:function(t,o){if(t&1&&ie(0,E1n,2,1),t&2){let a;re((a=o.componentConfigSignal())?0:-1,a)}},dependencies:[Pd,kf,ao,Ym,ue],styles:["[_nghost-%COMP%]{display:inline-flex;line-height:32px}.custom-chip[_ngcontent-%COMP%]{color:var(--velt-accent-text);background:var(--velt-accent-transparent);border-radius:var(--velt-border-radius-xs);word-break:break-word;padding:var(--velt-spacing-xs);margin:1px;gap:var(--velt-spacing-xs);opacity:0px;font-size:var(--velt-font-size-sm);font-style:normal;font-weight:400;line-height:120%;text-align:left;color:var(--velt-accent);display:inline-flex;align-items:center;justify-content:center;text-decoration:none}.custom-chip[_ngcontent-%COMP%] .custom-chip-icon[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center}.custom-chip[_ngcontent-%COMP%] .custom-chip-icon.custom-chip-icon-img[_ngcontent-%COMP%]{max-height:12px}"],changeDetection:0});let n=r;return n})();var k1n=["customBtnRef"],T1n=["*"],w1n=n=>({componentConfigSignal:n}),D1n=(n,r)=>({condition:n,data:r}),O1n=(n,r,i,e,t,o)=>({template:n,componentName:r,variant:i,suffix:e,setIfCondition:t,componentElementRef:o});function A1n(n,r){if(n&1&&(_(0,"div",5)(1,"button",8),M(2,"translate"),de(),_(3,"svg",9)(4,"g",10),D(5,"path",11),y(),_(6,"defs")(7,"clipPath",12),D(8,"rect",13),y()()()()()),n&2){let i=c(4);T("data-testid",i.componentId+"-default-button"),m(),T("aria-label",R(2,2,"Open user tagging menu"))}}function P1n(n,r){n&1&&Xe(0)}function M1n(n,r){if(n&1&&(h(0),ie(1,A1n,9,4,"div",5),_(2,"div",6,1),p(4,P1n,1,0,"ng-container",7),y(),f()),n&2){c();let i=Ce(6),e=c(),t=c();m(),re(e!=null&&e.showDefaultBtn?1:-1),m(),T("data-testid",t.componentId+"-custom-container"),m(2),g("ngTemplateOutlet",i)}}function R1n(n,r){n&1&&jt(0)}function N1n(n,r){if(n&1){let i=K();h(0),_(1,"div",3),M(2,"translate"),M(3,"translate"),G("pointerdown",function(){N(i);let t=c(2);return F(t.onPointerDown())})("click",function(){N(i);let t=c(2);return F(t.onClick())}),p(4,M1n,5,3,"ng-container",4),y(),p(5,R1n,1,0,"ng-template",null,0,Me),f()}if(n&2){let i=c(),e=c();m(),g("title",R(2,6,"Tag a user")),T("data-testid",e.componentId)("aria-expanded",!1)("aria-label",R(3,8,"Mention user"))("aria-controls",e.componentId+"-popup"),m(3),g("veltDynamicTemplate",vi(10,O1n,e.template,i==null||i.componentMeta==null?null:i.componentMeta.componentName,i==null||i.componentMeta==null?null:i.componentMeta.variant,i==null||i.componentMeta==null?null:i.componentMeta.suffix,e.setIfCondition.bind(e),e.elementRef))}}function F1n(n,r){if(n&1&&p(0,N1n,7,17,"ng-container",2),n&2){let i=c();g("veltIf",w(3,D1n,i.conditionSignal(),$(1,w1n,i.componentConfigSignal)))}}var vK=(()=>{let r=class r extends wr{getSelectionFromElement(e){try{let t=e.getRootNode();if(t instanceof ShadowRoot)return t?.getSelection?.()||window.getSelection()}catch{}return window.getSelection()}constructor(){super(),this.triggerElement=null,this.hotkey="@",this.buttonClick=new Fe,this.deviceInfo=new ii,this.savedRange=null,this.componentConfigSignal=Oe({componentMeta:void 0,showDefaultBtn:!1}),this.veltElement=!0,this.componentId="velt-autocomplete-tool"}ngOnInit(){try{super.ngOnInit()}catch(e){this.loggingService.catch("Error in AutocompleteToolComponent ngOnInit:",e)}}ngOnChanges(e){try{e&&Object.keys(e).forEach(t=>{this.componentConfigSignal.update(o=>(o=E(b({},o),{[t]:e[t].currentValue}),o))})}catch(t){this.loggingService.catch("Error in AutocompleteToolComponent ngOnChanges: ",t)}}ngAfterViewInit(){try{this.customBtnRef?.nativeElement?.children?.length||this.componentConfigSignal.update(e=>(e=E(b({},e),{showDefaultBtn:!0}),e))}catch(e){this.loggingService.catch("Error in AutocompleteToolComponent ngAfterViewInit: ",e)}}ngOnDestroy(){super.ngOnDestroy()}setupA11yAttributes(){try{this.hostElementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in AutocompleteToolComponent setupA11yAttributes:",e)}}onPointerDown(){try{let e=this.trigger?this.trigger._element?.nativeElement:this.triggerElement;if(e?.hasAttribute("contenteditable")){let t=this.getSelectionFromElement(e);if(t&&t.rangeCount>0){let o=t.getRangeAt(0);e.contains(o.startContainer)&&(this.savedRange=o.cloneRange())}}}catch(e){this.loggingService.catch("Error in onPointerDown:",e)}}isHotkeyAlreadyAtCursor(e){try{if(e?.hasAttribute("contenteditable")){if(this.savedRange&&e.contains(this.savedRange.startContainer)){let o=this.savedRange.startContainer,a=this.savedRange.startOffset;if(o.nodeType===Node.TEXT_NODE&&a>0)return o.textContent?.charAt(a-1)===this.hotkey}let t=this.getSelectionFromElement(e);if(t&&t.rangeCount>0){let o=t.getRangeAt(0);if(e.contains(o.startContainer)&&o.startContainer.nodeType===Node.TEXT_NODE&&o.startOffset>0)return o.startContainer.textContent?.charAt(o.startOffset-1)===this.hotkey}if(t&&t.rangeCount>0){let o=t.getRangeAt(0);if(e.contains(o.startContainer)&&(e.textContent||"").endsWith(this.hotkey)&&(o.startContainer===e?o.startOffset===e.childNodes.length:o.startContainer.nodeType===Node.TEXT_NODE&&o.startOffset===(o.startContainer.textContent?.length||0)&&!o.startContainer.nextSibling))return!0}}}catch(t){this.loggingService.catch("Error in AutocompleteToolComponent isHotkeyAlreadyAtCursor: ",t)}return!1}onClick(){try{if(this.trigger||this.triggerElement){let e=this.trigger?this.trigger._element?.nativeElement:null;if(!e&&this.triggerElement&&(e=this.triggerElement),e){if(e?.focus(),this.savedRange&&e.contains(this.savedRange.startContainer)){let t=this.getSelectionFromElement(e);t?.removeAllRanges(),t?.addRange(this.savedRange)}if(e?.hasAttribute("contenteditable")){if(this.isHotkeyAlreadyAtCursor(e)){if(this.savedRange&&e.contains(this.savedRange.startContainer))try{let l=document.createRange();l.setStart(this.savedRange.startContainer,this.savedRange.startOffset),l.collapse(!0);let s=this.getSelectionFromElement(e);s?.removeAllRanges(),s?.addRange(l)}catch{}this.savedRange=null,setTimeout(()=>{let l=new InputEvent("input",{data:this.hotkey,inputType:"insertText"});e?.dispatchEvent(l)},100),this.buttonClick.emit();return}let t=null;try{t=this.getSelectionFromElement(e)?.getRangeAt(0)||null}catch{}let o=t?.startContainer,a=t?.startOffset??0;if(t&&o&&e.contains(o)){let l;if(o.nodeType===Node.TEXT_NODE){let d=o.splitText(a);o=d.previousSibling,l=document.createTextNode(this.hotkey),e.insertBefore(l,d)}else l=document.createTextNode(this.hotkey),e.insertBefore(l,o.childNodes[a]);t=document.createRange(),t.setStart(l,l.length),t.collapse(!0);let s=this.getSelectionFromElement(e);s?.removeAllRanges(),s?.addRange(t)}else{let l=document.createTextNode(this.hotkey);e.appendChild(l),this.setCursorToEndOfContenteditable(e)}setTimeout(()=>{let l=new InputEvent("input",{data:this.hotkey,inputType:"insertText"});e?.dispatchEvent(l)},100)}else if(["input","textarea"].includes(e?.tagName?.toLowerCase())){let t=new InputEvent("input",{data:this.hotkey,inputType:"insertText"});e?.dispatchEvent(t)}this.savedRange=null}}this.buttonClick.emit()}catch(e){this.loggingService.catch("Error in AutocompleteToolComponent onClick: ",e)}}setCursorToEndOfContenteditable(e){this.loggingService.log("%c[WB] Calling FUNCTION: setCursorToEndOfContenteditable","color: green;");try{let t,o;document.createRange&&(t=document.createRange(),t.selectNodeContents(e),t.collapse(!1),o=this.getSelectionFromElement(e),o?.removeAllRanges(),o?.addRange(t))}catch(t){this.loggingService.catch("Error in AutocompleteToolComponent setCursorToEndOfContenteditable: ",t)}}};r.\u0275fac=function(t){return new(t||r)},r.\u0275cmp=O({type:r,selectors:[["velt-autocomplete-tool-internal"]],viewQuery:function(t,o){if(t&1&&dt(k1n,5),t&2){let a;ot(a=at())&&(o.customBtnRef=a.first)}},hostVars:1,hostBindings:function(t,o){t&2&&T("data-velt-element",o.veltElement)},inputs:{trigger:"trigger",triggerElement:"triggerElement",hotkey:"hotkey",template:"template",componentMeta:"componentMeta"},outputs:{buttonClick:"buttonClick"},standalone:!1,features:[j([I]),L,it],ngContentSelectors:T1n,decls:1,vars:1,consts:[["content",""],["customBtnRef",""],[4,"veltIf"],["role","combobox","tabindex","0",1,"velt-autocomplete-tool",3,"pointerdown","click","title"],[4,"veltDynamicTemplate"],[1,"action-btn"],[1,"custom-btn-container"],[4,"ngTemplateOutlet"],["type","button",1,"action__button"],["width","18","height","18","viewBox","0 0 18 18","fill","none","xmlns","http://www.w3.org/2000/svg","aria-hidden","true","role","img"],["clip-path","url(#clip0_12828_43447)"],["d","M12.2142 9.00926C12.2142 9.86174 11.8756 10.6793 11.2728 11.2821C10.67 11.8849 9.85244 12.2235 8.99996 12.2235C8.14748 12.2235 7.32992 11.8849 6.72712 11.2821C6.12432 10.6793 5.78568 9.86174 5.78568 9.00926C5.78568 8.15678 6.12432 7.33921 6.72712 6.73641C7.32992 6.13362 8.14748 5.79497 8.99996 5.79497C9.85244 5.79497 10.67 6.13362 11.2728 6.73641C11.8756 7.33921 12.2142 8.15678 12.2142 9.00926ZM12.2142 9.00926L12.2142 10.2146C12.2142 10.7474 12.4259 11.2584 12.8026 11.6351C13.1794 12.0119 13.6904 12.2235 14.2232 12.2235C14.756 12.2235 15.267 12.0119 15.6437 11.6351C16.0204 11.2584 16.2321 10.7474 16.2321 10.2146V9.00926C16.2341 7.45523 15.7355 5.9419 14.8101 4.69343C13.8847 3.44496 12.5818 2.52777 11.0944 2.07773C9.60695 1.62769 8.01411 1.66873 6.55183 2.19478C5.08955 2.72083 3.83561 3.7039 2.97575 4.99837C2.1159 6.29284 1.69588 7.82985 1.77791 9.38171C1.85994 10.9336 2.43965 12.4177 3.43118 13.6143C4.4227 14.8109 5.7733 15.6563 7.28288 16.0253C8.79247 16.3943 10.3808 16.2672 11.8125 15.6628","stroke","currentColor","stroke-width","1.6","stroke-linecap","round","stroke-linejoin","round"],["id","clip0_12828_43447"],["width","18","height","18","fill","white"]],template:function(t,o){if(t&1&&(Wt(),ie(0,F1n,1,6,"ng-container")),t&2){let a;re((a=o.componentConfigSignal())?0:-1,a)}},dependencies:[Nt,Q,ae,ue],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}[_nghost-%COMP%]{--velt-green: var(--velt-light-mode-green);--velt-magenta: var(--velt-light-mode-magenta);--velt-amber: var(--velt-light-mode-amber);--velt-purple: var(--velt-light-mode-purple);--velt-cyan: var(--velt-light-mode-cyan);--velt-orange: var(--velt-light-mode-orange);--velt-black: var(--velt-light-mode-black);--velt-white: var(--velt-light-mode-white);--velt-gray: var(--velt-light-mode-gray);--velt-error: var(--velt-light-mode-error);--velt-error-hover: var(--velt-light-mode-error-hover);--velt-error-foreground: var(--velt-light-mode-error-foreground);--velt-error-light: var(--velt-light-mode-error-light);--velt-error-transparent: var(--velt-light-mode-error-transparent);--velt-warning: var(--velt-light-mode-warning);--velt-warning-hover: var(--velt-light-mode-warning-hover);--velt-warning-foreground: var(--velt-light-mode-warning-foreground);--velt-warning-light: var(--velt-light-mode-warning-light);--velt-warning-transparent: var(--velt-light-mode-warning-transparent);--velt-success: var(--velt-light-mode-success);--velt-success-hover: var(--velt-light-mode-success-hover);--velt-success-foreground: var(--velt-light-mode-success-foreground);--velt-success-light: var(--velt-light-mode-success-light);--velt-success-transparent: var(--velt-light-mode-success-transparent);--velt-accent: var(--velt-light-mode-accent);--velt-accent-text: var(--velt-light-mode-accent-text);--velt-accent-hover: var(--velt-light-mode-accent-hover);--velt-accent-foreground: var(--velt-light-mode-accent-foreground);--velt-accent-light: var(--velt-light-mode-accent-light);--velt-accent-transparent: var(--velt-light-mode-accent-transparent);--velt-text-0: var(--velt-light-mode-text-0);--velt-text-1: var(--velt-light-mode-text-1);--velt-text-2: var(--velt-light-mode-text-2);--velt-text-3: var(--velt-light-mode-text-3);--velt-text-4: var(--velt-light-mode-text-4);--velt-text-5: var(--velt-light-mode-text-5);--velt-text-6: var(--velt-light-mode-text-6);--velt-text-7: var(--velt-light-mode-text-7);--velt-text-8: var(--velt-light-mode-text-8);--velt-text-9: var(--velt-light-mode-text-9);--velt-text-10: var(--velt-light-mode-text-10);--velt-text-11: var(--velt-light-mode-text-11);--velt-text-12: var(--velt-light-mode-text-12);--velt-background-0: var(--velt-light-mode-background-0);--velt-background-1: var(--velt-light-mode-background-1);--velt-background-2: var(--velt-light-mode-background-2);--velt-background-3: var(--velt-light-mode-background-3);--velt-background-4: var(--velt-light-mode-background-4);--velt-background-5: var(--velt-light-mode-background-5);--velt-background-6: var(--velt-light-mode-background-6);--velt-background-7: var(--velt-light-mode-background-7);--velt-background-8: var(--velt-light-mode-background-8);--velt-background-9: var(--velt-light-mode-background-9);--velt-background-10: var(--velt-light-mode-background-10);--velt-border-0: var(--velt-light-mode-border-0);--velt-border-1: var(--velt-light-mode-border-1);--velt-border-2: var(--velt-light-mode-border-2);--velt-border-3: var(--velt-light-mode-border-3);--velt-border-4: var(--velt-light-mode-border-4);--velt-border-5: var(--velt-light-mode-border-5);--velt-border-6: var(--velt-light-mode-border-6);--velt-border-7: var(--velt-light-mode-border-7);--velt-border-8: var(--velt-light-mode-border-8);--velt-border-9: var(--velt-light-mode-border-9);--velt-border-10: var(--velt-light-mode-border-10);--velt-background-transparent: var(--velt-light-mode-background-transparent);--velt-border-transparent: var(--velt-light-mode-border-transparent);--velt-animation-transparent: var(--velt-light-mode-animation-transparent)}[dark][_nghost-%COMP%]{--velt-green: var(--velt-dark-mode-green);--velt-magenta: var(--velt-dark-mode-magenta);--velt-amber: var(--velt-dark-mode-amber);--velt-purple: var(--velt-dark-mode-purple);--velt-cyan: var(--velt-dark-mode-cyan);--velt-orange: var(--velt-dark-mode-orange);--velt-black: var(--velt-dark-mode-black);--velt-white: var(--velt-dark-mode-white);--velt-gray: var(--velt-dark-mode-gray);--velt-error: var(--velt-dark-mode-error);--velt-error-hover: var(--velt-dark-mode-error-hover);--velt-error-foreground: var(--velt-dark-mode-error-foreground);--velt-error-light: var(--velt-dark-mode-error-light);--velt-error-transparent: var(--velt-dark-mode-error-transparent);--velt-warning: var(--velt-dark-mode-warning);--velt-warning-hover: var(--velt-dark-mode-warning-hover);--velt-warning-foreground: var(--velt-dark-mode-warning-foreground);--velt-warning-light: var(--velt-dark-mode-warning-light);--velt-warning-transparent: var(--velt-dark-mode-warning-transparent);--velt-success: var(--velt-dark-mode-success);--velt-success-hover: var(--velt-dark-mode-success-hover);--velt-success-foreground: var(--velt-dark-mode-success-foreground);--velt-success-light: var(--velt-dark-mode-success-light);--velt-success-transparent: var(--velt-dark-mode-success-transparent);--velt-accent: var(--velt-dark-mode-accent);--velt-accent-text: var(--velt-dark-mode-accent-text);--velt-accent-hover: var(--velt-dark-mode-accent-hover);--velt-accent-foreground: var(--velt-dark-mode-accent-foreground);--velt-accent-light: var(--velt-dark-mode-accent-light);--velt-accent-transparent: var(--velt-dark-mode-accent-transparent);--velt-text-0: var(--velt-dark-mode-text-0);--velt-text-1: var(--velt-dark-mode-text-1);--velt-text-2: var(--velt-dark-mode-text-2);--velt-text-3: var(--velt-dark-mode-text-3);--velt-text-4: var(--velt-dark-mode-text-4);--velt-text-5: var(--velt-dark-mode-text-5);--velt-text-6: var(--velt-dark-mode-text-6);--velt-text-7: var(--velt-dark-mode-text-7);--velt-text-8: var(--velt-dark-mode-text-8);--velt-text-9: var(--velt-dark-mode-text-9);--velt-text-10: var(--velt-dark-mode-text-10);--velt-text-11: var(--velt-dark-mode-text-11);--velt-text-12: var(--velt-dark-mode-text-12);--velt-background-0: var(--velt-dark-mode-background-0);--velt-background-1: var(--velt-dark-mode-background-1);--velt-background-2: var(--velt-dark-mode-background-2);--velt-background-3: var(--velt-dark-mode-background-3);--velt-background-4: var(--velt-dark-mode-background-4);--velt-background-5: var(--velt-dark-mode-background-5);--velt-background-6: var(--velt-dark-mode-background-6);--velt-background-7: var(--velt-dark-mode-background-7);--velt-background-8: var(--velt-dark-mode-background-8);--velt-background-9: var(--velt-dark-mode-background-9);--velt-background-10: var(--velt-dark-mode-background-10);--velt-border-0: var(--velt-dark-mode-border-0);--velt-border-1: var(--velt-dark-mode-border-1);--velt-border-2: var(--velt-dark-mode-border-2);--velt-border-3: var(--velt-dark-mode-border-3);--velt-border-4: var(--velt-dark-mode-border-4);--velt-border-5: var(--velt-dark-mode-border-5);--velt-border-6: var(--velt-dark-mode-border-6);--velt-border-7: var(--velt-dark-mode-border-7);--velt-border-8: var(--velt-dark-mode-border-8);--velt-border-9: var(--velt-dark-mode-border-9);--velt-border-10: var(--velt-dark-mode-border-10);--velt-background-transparent: var(--velt-dark-mode-background-transparent);--velt-border-transparent: var(--velt-dark-mode-border-transparent);--velt-animation-transparent: var(--velt-dark-mode-animation-transparent)}*[_ngcontent-%COMP%]{box-sizing:border-box}.action__button[_ngcontent-%COMP%]{border:0;border-radius:var(--velt-border-radius-full);width:calc((2rem + 0px) * var(--velt-base-rem-unit));height:calc((2rem + 0px) * var(--velt-base-rem-unit));flex-shrink:0;display:flex;align-items:center;justify-content:center;background:transparent;transition:.5s;color:var(--velt-text-10)}.action__button[_ngcontent-%COMP%]:hover{background:var(--velt-background-3);cursor:pointer}@media (max-width: 768px){button[_ngcontent-%COMP%]{padding:0}}"],changeDetection:0});let n=r;return n})();var L1n=["*"],U1n=new Set(["autocomplete-id","class","style","id","ng-reflect-autocomplete-id","ng-version","_nghost","_ngcontent"]),Exe=(()=>{let r=class r{constructor(e,t,o,a){this.coreService=e,this.elementRef=t,this.registry=o,this.loggingService=a,this.parentContextData={},this.onParentPayload=l=>{try{!this.autocompleteId&&l.autocompleteId&&(this.autocompleteId=l.autocompleteId),this.parentContextData=l.contextData||{},this.initializeAndBroadcast()}catch(s){this.loggingService.catch("[AUTOCOMPLETE CONTEXT WRAPPER] Error in onParentPayload:",s)}}}ngOnInit(){try{if(this.findAndConnectToParent(),this.parentRegistry){this.parentRegistry.register(this.onParentPayload);let e=this.parentRegistry.getLastPayload?.();e&&this.onParentPayload(e)}this.initializeAndBroadcast()}catch(e){this.loggingService.catch("[AUTOCOMPLETE CONTEXT WRAPPER] Error in ngOnInit:",e)}}findAndConnectToParent(){try{let t=this.elementRef.nativeElement.parentElement;for(;t;){if(t.tagName?.toLowerCase()==="velt-autocomplete-context-wrapper"){let o=t.__veltContext;if(o?.registry instanceof Bm){this.parentWrapper=o.wrapperRef,this.parentRegistry=o.registry;return}let a=window.ng;if(a?.getComponent){let s=a.getComponent(t);if(s?.registry){this.parentWrapper=s,this.parentRegistry=s.registry;return}}let l=t.__ngContext__;if(l&&Array.isArray(l))for(let s=0;s<l.length;s++){let d=l[s];if(d&&typeof d=="object"&&d.registry instanceof Bm){this.parentWrapper=d,this.parentRegistry=d.registry;return}}}t=t.parentElement}}catch(e){this.loggingService.catch("[AUTOCOMPLETE CONTEXT WRAPPER] Error finding parent wrapper:",e)}}ngOnChanges(e){try{e.autocompleteId&&!e.autocompleteId.firstChange&&this.initializeAndBroadcast()}catch(t){this.loggingService.catch("[AUTOCOMPLETE CONTEXT WRAPPER] Error in ngOnChanges:",t)}}ngOnDestroy(){try{let e=this.autocompleteId&&!this.parentWrapper;if(this.parentRegistry&&this.parentRegistry.unregister(this.onParentPayload),this.elementRef?.nativeElement&&(this.elementRef.nativeElement.__veltContext=void 0),this.parentWrapper=void 0,this.parentRegistry=void 0,e){let t=this.autocompleteId,o=this.registry;setTimeout(()=>{let a=this.coreService.getRegistry(t);(a===o||!a)&&this.coreService.clearContextConfig(t)},0)}}catch(e){this.loggingService.catch("[AUTOCOMPLETE CONTEXT WRAPPER] Error in ngOnDestroy:",e)}}collectAttributes(){let e={};try{let o=this.elementRef.nativeElement.attributes;for(let a=0;a<o.length;a++){let l=o[a],s=l.name.toLowerCase();U1n.has(s)||s.startsWith("_ng")||s.startsWith("ng-")||(e[s]=l.value)}}catch(t){this.loggingService.catch("[AUTOCOMPLETE CONTEXT WRAPPER] Error collecting attributes:",t)}return e}initializeAndBroadcast(){try{let e=this.autocompleteId||this.parentContextData["autocomplete-id"];if(!e)return;this.autocompleteId&&(this.coreService.getOrCreateContextConfig(this.autocompleteId),this.coreService.setRegistry(this.autocompleteId,this.registry),this.elementRef.nativeElement.setAttribute("autocomplete-id",this.autocompleteId));let t=this.collectAttributes(),o=b(b({},this.parentContextData),t);this.elementRef.nativeElement.__veltContext={registry:this.registry,autocompleteId:e,contextData:o,wrapperRef:this};let a={autocompleteId:e,contextData:o};this.registry.broadcast(a)}catch(e){this.loggingService.catch("[AUTOCOMPLETE CONTEXT WRAPPER] Error in initializeAndBroadcast:",e)}}};r.\u0275fac=function(t){return new(t||r)(C(f_),C(z),C(Bm),C(x))},r.\u0275cmp=O({type:r,selectors:[["velt-autocomplete-context-wrapper"]],inputs:{autocompleteId:"autocompleteId"},standalone:!1,features:[j([Bm]),it],ngContentSelectors:L1n,decls:1,vars:0,template:function(t,o){t&1&&(Wt(),jt(0))},styles:["[_nghost-%COMP%]{display:contents}"],changeDetection:0});let n=r;return n})();var B1n=["commentPinRef"];function V1n(n,r){if(n&1){let i=K();h(0),_(1,"div",2),G("pointerup",function(t){return N(i),c(2).togglePinSelection(),F(t.stopPropagation())})("touchend",function(t){return N(i),t.stopPropagation(),F(t.preventDefault())})("click",function(t){return N(i),F(t.stopPropagation())}),_(2,"snippyly-comment-pin",3,0),G("togglePinSelection",function(t){N(i);let o=c(2);return F(o.togglePinSelection(t))})("saveComment",function(t){N(i);let o=c(2);return F(o.saveComment(t))}),y()(),f()}if(n&2){let i=c().ngIf,e=c();m(),T("data-testid",e.componentId)("role","button")("tabindex",0),m(),g("annotation",i.commentPinAnnotation)("variant",e.variant)("containerComponentId",i.componentId)("commentPinSelected",!!i.commentPinSelected)("multipleCommentPinSelected",i.selectedAnnotationsMap[i.commentPinAnnotation==null?null:i.commentPinAnnotation.annotationId]&&e.objectKeys(i.selectedAnnotationsMap).length>1)("user",i.user),T("data-testid",e.componentId+"-pin")("aria-hidden","true")}}function j1n(n,r){if(n&1&&(h(0),p(1,V1n,4,11,"ng-container",1),f()),n&2){let i=r.ngIf;m(),g("ngIf",i.commentPinAnnotation&&i.user)}}var kxe=(()=>{let r=class r{set _folderId(e){try{this.componentConfigSignal.update(t=>(t=E(b({},t),{folderId:e}),t?.folderId?t.veltFolderId=Mi(t.folderId):t.veltFolderId=void 0,t)),this.getCommentAnnotationsForCommentPin()}catch{}}set _clientDocumentId(e){try{this.componentConfigSignal.update(t=>(t=E(b({},t),{clientDocumentId:e}),t?.clientDocumentId?t.documentId=this.docService.generateDocumentId(t.clientDocumentId):t.documentId=void 0,t)),this.getCommentAnnotationsForCommentPin()}catch{}}set _locationId(e){try{this.componentConfigSignal.update(t=>(t=E(b({},t),{locationId:e}),t)),this.getCommentAnnotationsForCommentPin()}catch{}}set _context(e){try{let t=e;typeof e=="string"&&(t=JSON.parse(e)),t&&typeof t=="object"&&this.componentConfigSignal.update(o=>(o=E(b({},o),{context:t}),o)),this.getCommentAnnotationsForCommentPin()}catch{}}set _contextOptions(e){try{let t=e;typeof e=="string"&&(t=JSON.parse(e)),t&&typeof t=="object"&&this.componentConfigSignal.update(o=>(o=E(b({},o),{contextOptions:t}),o)),this.getCommentAnnotationsForCommentPin()}catch{}}constructor(e,t,o,a,l,s,d){this.authService=e,this.commentService=t,this.docService=o,this.domService=a,this.loggingService=l,this.elementRef=s,this.commentActionsService=d,this.variant="default",this.objectKeys=Object.keys,this.resolvedCommentsOnDom=!1,this.componentConfigSignal=Oe({commentPinAnnotation:void 0,user:null,selectedAnnotationsMap:{},selectedAnnotationsLocationMap:{},componentId:`velt-comment-pin-${St()}`}),this.subscriptions=[],this.componentId="velt-comment-pin",this.uniqueComponentId="velt-comment-pin-"+St();try{this.loggingService.log("%c[WB] Creating Class: VeltCommentPinComponent","color: blue;"),this.temporaryMultiThreadAnnotationId=`temp_${this.uniqueComponentId}`,this.subscriptions.push(this.authService.getUser$().subscribe(v=>{this.componentConfigSignal.update(u=>(u=E(b({},u),{user:v}),u))})),this.subscriptions.push(this.domService.getSelectedAnnotationsMap$().subscribe(v=>{this.componentConfigSignal.update(u=>(u=E(b({},u),{selectedAnnotationsMap:v}),u)),this.checkCommentPinSelected()},v=>{this.catchError("Error in VeltCommentPinComponent getSelectedAnnotationsMap$ subscription: ",v)})),this.subscriptions.push(this.domService.getSelectedAnnotationsLocationMap$().subscribe(v=>{this.componentConfigSignal.update(u=>(u=E(b({},u),{selectedAnnotationsLocationMap:v}),u)),this.checkCommentPinSelected()},v=>{this.catchError("Error in VeltCommentPinComponent getSelectedAnnotationsLocationMap$ subscription: ",v)})),this.subscriptions.push(this.commentService.getGroupMatchedComments$().subscribe(v=>{this.componentConfigSignal.update(u=>(u=E(b({},u),{groupMatchedComments:v}),u))})),this.subscriptions.push(this.commentService.updateCommentDialogPositionTrigger$().subscribe(()=>{try{this.commentPinRef&&(this.componentConfigSignal().selectedAnnotationsMap&&this.componentConfigSignal().commentPinAnnotation?.annotationId&&this.componentConfigSignal().selectedAnnotationsMap[this.componentConfigSignal().commentPinAnnotation.annotationId])&&this.commentPinRef.updateOverlayPosition()}catch(v){this.catchError("Error in VeltCommentPinComponent updateCommentDialogPositionTrigger$: ",v)}},v=>{this.catchError("Error in VeltCommentPinComponent updateCommentDialogPositionTrigger$ subscription: ",v)}))}catch(v){this.catchError("Error in VeltCommentPinComponent constructor: ",v)}}ngOnInit(){this.setupA11yAttributes()}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in VeltCommentPinComponent setupA11yAttributes:",e)}}togglePinSelection(e){try{let t=e||this.componentConfigSignal().commentPinAnnotation;if(t&&this.commentActionsService.onCommentPinClick(t).catch(o=>{this.catchError("Error in VeltCommentPinComponent togglePinSelection onCommentPinClick: ",o)}),this.componentConfigSignal().selectedAnnotationsMap[t.annotationId])t?.ghostComment?.type!==Fs.DIFFERENT_DEVICE&&document.querySelector(`[${V.ATTRIBUTES.VELT_ANNOTATION_DRAFT}="${t?.annotationId}"]`)&&this.domService.resetSelectedAnnotationsMap(!0,"comments");else{let o=document.querySelector(`[${V.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);if(o||(o=(this.domService.getDraftCommentAnnotationDialogs()||[])[0]),o){let a=o.getAttribute(V.ATTRIBUTES.VELT_ANNOTATION_DRAFT);if(a){let l=document.getElementById(`comment-pin-container-${a}`)||document.querySelector(`[data-velt-id='${a}']`);l&&(l.scrollIntoView({behavior:"auto",block:"center",inline:"center"}),this.domService.resetSelectedAnnotationsMap(!0,"comments"))}}else this.domService.resetSelectedAnnotationsMap(!0,"comments"),this.domService.toggleAnnotationSelection(t,this.componentConfigSignal().componentId)}}catch(t){this.catchError("Error in VeltCommentPinComponent togglePinSelection: ",t)}}ngOnChanges(e){try{this.loggingService.log("%c[WB] Calling VeltCommentPinComponent FUNCTION: ngOnChanges","color: green;"),e?.annotationId&&this.annotationId&&this.getCommentAnnotationsForCommentPin(),e?.multiThreadAnnotationId&&this.multiThreadAnnotationId&&this.getMultiThreadCommentAnnotationByAnnotationId(this.multiThreadAnnotationId)}catch(t){this.catchError("Error in VeltCommentPinComponent ngOnChanges: ",t)}}getCommentAnnotationsForCommentPin(){try{this.loggingService.log("%c[WB] Calling VeltCommentPinComponent FUNCTION: getCommentAnnotationByAnnotationId","color: green;"),this.commentAnnotationByAnnotationIdSubscription&&(this.commentAnnotationByAnnotationIdSubscription.unsubscribe(),this.commentAnnotationByAnnotationIdSubscription=void 0);let e;(this.componentConfigSignal().folderId||this.componentConfigSignal().clientDocumentId)&&(e=this.componentConfigSignal().locationId),this.commentAnnotationByAnnotationIdSubscription=this.commentService.getCommentAnnotationsForCommentComponent({type:"pin",annotationId:this.annotationId,folderId:this.componentConfigSignal().folderId,veltFolderId:this.componentConfigSignal().veltFolderId,clientDocumentId:this.componentConfigSignal().clientDocumentId,documentId:this.componentConfigSignal().documentId,context:this.componentConfigSignal().context,contextOptions:this.componentConfigSignal().contextOptions,locationId:e}).pipe(fe(t=>this.commentService.getResolvedCommentsOnDom$().pipe(ge(o=>(this.resolvedCommentsOnDom=o,t)))),fe(t=>this.domService.getSelectedAnnotationsMap$().pipe(ge(o=>({commentPinAnnotation:t?.[0],selectedAnnotationsMap:o||{},commentAnnotations:t||[]}))))).subscribe(t=>{let o=null,a=!1,l=[];if(this.resolvedCommentsOnDom||this.componentConfigSignal().groupMatchedComments&&!this.annotationId)l=t?.commentAnnotations?.slice()||[];else{let d=t?.commentAnnotations?.filter(u=>u?.status?.type!=="terminal"),v=t?.commentAnnotations?.[0];d?.length?l=d:v&&t?.selectedAnnotationsMap?.[v.annotationId]&&(l=[v])}if(l?.length&&this.componentConfigSignal().groupMatchedComments&&!this.annotationId&&(a=l?.length>1||!l?.[0]?.isDraft),a){o=new i_,o.annotationId=this.temporaryMultiThreadAnnotationId,o.isTemporary=!0,o.from=l?.[0]?.from,o.metadata=l?.[0]?.metadata;let d,v=this.componentConfigSignal().locationId;v&&(d=this.docService.getLocationByClientLocationId(v),d||(d={id:v}));let u;d&&(u=this.docService.genarateLocationId(d)),d&&u&&(o.location=d,o.locationId=u),this.componentConfigSignal().context&&(o.context=this.componentConfigSignal().context),o.commentAnnotationsMap={},o.commentAnnotations={};for(let S of l||[])S.annotationId&&(o.commentAnnotationsMap||(o.commentAnnotationsMap={}),o.commentAnnotationsMap[S.annotationId]=S,o.commentAnnotations||(o.commentAnnotations={}),o.commentAnnotations[S.annotationId]=!0)}let s=l?.length?l[l?.length-1]:null;o&&(s=o),this.componentConfigSignal.update(d=>(d=E(b({},d),{commentPinAnnotation:s,commentAnnotations:l||[]}),d)),this.checkCommentPinSelected()})}catch(e){this.catchError("Error in VeltCommentPinComponent getCommentAnnotationByAnnotationId: ",e)}}getMultiThreadCommentAnnotationByAnnotationId(e){try{this.loggingService.log("%c[WB] Calling VeltCommentPinComponent FUNCTION: getMultiThreadCommentAnnotationByAnnotationId","color: green;"),this.multiThreadCommentAnnotationByAnnotationIdSubscription&&(this.multiThreadCommentAnnotationByAnnotationIdSubscription.unsubscribe(),this.multiThreadCommentAnnotationByAnnotationIdSubscription=void 0),this.multiThreadCommentAnnotationByAnnotationIdSubscription=this.commentService.getMultiThreadCommentAnnotationByAnnotationId(e).subscribe(t=>{this.componentConfigSignal.update(o=>(o=E(b({},o),{commentPinAnnotation:t}),o)),this.checkCommentPinSelected()})}catch(t){this.catchError("Error in VeltCommentPinComponent getMultiThreadCommentAnnotationByAnnotationId: ",t)}}checkCommentPinSelected(){try{let e=this.componentConfigSignal().selectedAnnotationsMap,t=this.componentConfigSignal().commentPinAnnotation,o=this.componentConfigSignal().sourceId;if(t){let a=!!e[t.annotationId];if(a)if(t?.isDraft)t?.sourceId&&(a=t?.sourceId===o,a&&this.domService.setSelectedAnnotationLocation(t.annotationId,this.componentConfigSignal().componentId));else{let l=this.componentConfigSignal().selectedAnnotationsLocationMap?.[t.annotationId];l&&(a=l===this.componentConfigSignal().componentId)}a!==this.componentConfigSignal().commentPinSelected&&this.componentConfigSignal.update(l=>(l=E(b({},l),{commentPinSelected:a}),l))}}catch(e){this.catchError("Error in VeltCommentPinComponent checkCommentPinSelected: ",e)}}unsubscribe(){try{this.loggingService.log("%c[WB] Calling VeltCommentPinComponent FUNCTION: unsubscribe","color: green;"),this.commentAnnotationByAnnotationIdSubscription&&(this.commentAnnotationByAnnotationIdSubscription.unsubscribe(),this.commentAnnotationByAnnotationIdSubscription=void 0),this.subscriptions.forEach(e=>{e.unsubscribe()})}catch(e){this.catchError("Error in VeltCommentPinComponent unsubscribe: ",e)}}ngOnDestroy(){try{this.loggingService.log("%c[WB] Calling VeltCommentPinComponent FUNCTION: ngOnDestroy","color: green;"),this.unsubscribe()}catch(e){this.catchError("Error in VeltCommentPinComponent ngOnDestroy: ",e)}}saveComment(e){try{this.commentService.saveComment(this.componentConfigSignal().commentPinAnnotation,e)}catch(t){this.catchError("Error in VeltCommentPinComponent saveComment: ",t)}}catchError(e,t,o){try{this.loggingService.catch(e,t,E(b({},o||{}),{annotationId:this.componentConfigSignal()?.commentPinAnnotation?.annotationId}))}catch{}}};r.\u0275fac=function(t){return new(t||r)(C(Ge),C(Pe),C(lt),C(Ve),C(x),C(z),C(Pn))},r.\u0275cmp=O({type:r,selectors:[["velt-comment-pin-internal"]],viewQuery:function(t,o){if(t&1&&dt(B1n,5),t&2){let a;ot(a=at())&&(o.commentPinRef=a.first)}},inputs:{annotationId:"annotationId",multiThreadAnnotationId:"multiThreadAnnotationId",variant:"variant",_folderId:[0,"folderId","_folderId"],_clientDocumentId:[0,"documentId","_clientDocumentId"],_locationId:[0,"locationId","_locationId"],_context:[0,"context","_context"],_contextOptions:[0,"contextOptions","_contextOptions"]},standalone:!1,features:[it],decls:1,vars:1,consts:[["commentPinRef",""],[4,"ngIf"],[1,"velt-comment-pin",3,"pointerup","touchend","click"],[3,"togglePinSelection","saveComment","annotation","variant","containerComponentId","commentPinSelected","multipleCommentPinSelected","user"]],template:function(t,o){t&1&&p(0,j1n,2,1,"ng-container",1),t&2&&g("ngIf",o.componentConfigSignal())},dependencies:[se,pp],styles:[".velt-comment-pin[_ngcontent-%COMP%]{width:fit-content}"],changeDetection:0});let n=r;return n})();function $1n(n,r){if(n&1){let i=K();h(0),_(1,"div",2),M(2,"translate"),G("pointerup",function(t){let o=N(i).$implicit;return c(2).togglePinSelection(o.commentAnnotation),F(t.stopPropagation())}),_(3,"snippyly-comment-pin",3),G("saveComment",function(t){let o=N(i).$implicit,a=c(2);return F(a.saveComment(t,o.commentAnnotation))}),y()(),f()}if(n&2){let i=r.$implicit,e=c(2);m(),ct("top",(i==null||i.position==null?null:i.position.y)+((e.position==null?null:e.position.y)||0),"px")("left",(i==null||i.position==null?null:i.position.x)+((e.position==null?null:e.position.x)||0),"px"),T("role","button")("aria-label",R(2,14,"Comment pin"))("aria-pressed",!!e.selectedAnnotationsMap[i.commentAnnotation==null?null:i.commentAnnotation.annotationId])("data-testid",e.componentId+(i.commentAnnotation==null?null:i.commentAnnotation.annotationId))("tabindex",0),m(2),g("annotation",i.commentAnnotation)("commentPinSelected",e.selectedAnnotationsMap[i.commentAnnotation==null?null:i.commentAnnotation.annotationId]&&e.objectKeys(e.selectedAnnotationsMap).length===1)("multipleCommentPinSelected",e.selectedAnnotationsMap[i.commentAnnotation==null?null:i.commentAnnotation.annotationId]&&e.objectKeys(e.selectedAnnotationsMap).length>1)("user",e.user),T("aria-hidden",!0)}}function H1n(n,r){if(n&1&&(h(0),p(1,$1n,4,16,"ng-container",1),f()),n&2){let i=c();m(),g("ngForOf",i.canvasCommentAnnotations)("ngForTrackBy",i.canvasCommentsTrackBy)}}var Txe=(()=>{let r=class r{set _position(e){try{let t=e;typeof e=="string"&&(t=JSON.parse(e)),this.position=t}catch{}}constructor(e,t,o,a,l,s){this.authService=e,this.docService=t,this.domService=o,this.commentService=a,this.loggingService=l,this.elementRef=s,this.position={},this.selectedAnnotationsMap={},this.canvasCommentAnnotations=[],this.objectKeys=Object.keys,this.commentAnnotations=[],this.subscriptions=[],this.componentId="velt-canvas-comment";try{this.loggingService.log("%c[WB] Creating Class: CanvasCommentComponent","color: blue;"),this.subscriptions.push(this.authService.getUser$().subscribe(d=>{this.user=d})),this.subscriptions.push(this.domService.getSelectedAnnotationsMap$().subscribe(d=>{this.selectedAnnotationsMap=d},d=>{this.loggingService.catch("Error in CanvasCommentComponent getSelectedAnnotationsMap$ subscription: ",d)})),this.subscriptions.push(this.docService.getDocumentPaths$().pipe(fe(d=>d?this.commentService.getAllCommentAnnotations({customClientDocumentId:d?.clientDocumentId,analytics:{enabled:!0,properties:{source:"internal",sourceId:"canvasComment"}}}):[])).subscribe(d=>{this.commentAnnotations=d||[],this.filterCanvasCommentAnnotations()}))}catch(d){this.loggingService.catch("Error in CanvasCommentComponent constructor: ",d)}}ngOnInit(){try{this.setupA11yAttributes(),this.filterCanvasCommentAnnotations()}catch(e){this.loggingService.catch("Error in CanvasCommentComponent ngOnInit: ",e)}}ngOnDestroy(){try{this.subscriptions.forEach(e=>{e.unsubscribe()})}catch{}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CanvasCommentComponent setupA11yAttributes:",e)}}canvasCommentsTrackBy(e,t){return t.commentAnnotation.annotationId||""}filterCanvasCommentAnnotations(){try{this.canvasId?this.canvasCommentAnnotations=(this.commentAnnotations||[]).filter(e=>e?.context?.canvasCommentConfig?.id===this.canvasId).map(e=>({position:e.context.canvasCommentConfig.position,commentAnnotation:e})):this.canvasCommentAnnotations=[]}catch(e){this.loggingService.catch("Error in CanvasCommentComponent filterCanvasCommentAnnotations: ",e)}}togglePinSelection(e){try{if(this.selectedAnnotationsMap[e.annotationId])e?.ghostComment?.type!==Fs.DIFFERENT_DEVICE&&document.querySelector(`[${V.ATTRIBUTES.VELT_ANNOTATION_DRAFT}="${e?.annotationId}"]`)&&this.domService.resetSelectedAnnotationsMap(!0,"comments");else{let t=document.querySelector(`[${V.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);if(t||(t=(this.domService.getDraftCommentAnnotationDialogs()||[])[0]),t){let o=t.getAttribute(V.ATTRIBUTES.VELT_ANNOTATION_DRAFT);if(o){let a=document.getElementById(`comment-pin-container-${o}`)||document.querySelector(`[data-velt-id='${o}']`);a&&(a.scrollIntoView({behavior:"auto",block:"center",inline:"center"}),this.domService.resetSelectedAnnotationsMap(!0,"comments"))}}else this.domService.resetSelectedAnnotationsMap(!0,"comments"),this.domService.toggleAnnotationSelection(e)}}catch(t){this.loggingService.catch("Error in CanvasCommentComponent togglePinSelection: ",t)}}saveComment(e,t){try{this.commentService.saveComment(t,e)}catch(o){this.loggingService.catch("Error in CanvasCommentComponent saveComment: ",o)}}};r.\u0275fac=function(t){return new(t||r)(C(Ge),C(lt),C(Ve),C(Pe),C(x),C(z))},r.\u0275cmp=O({type:r,selectors:[["app-canvas-comment"]],inputs:{canvasId:"canvasId",_position:[0,"position","_position"]},standalone:!1,decls:1,vars:1,consts:[[4,"ngIf"],[4,"ngFor","ngForOf","ngForTrackBy"],[1,"velt-canvas-comment-pin",3,"pointerup"],[3,"saveComment","annotation","commentPinSelected","multipleCommentPinSelected","user"]],template:function(t,o){t&1&&p(0,H1n,2,2,"ng-container",0),t&2&&g("ngIf",o.user)},dependencies:[Vt,se,pp,ue],styles:[".velt-canvas-comment-pin[_ngcontent-%COMP%]{position:absolute;transform:translateY(-100%)}"],changeDetection:0});let n=r;return n})();function z1n(n,r){if(n&1&&(h(0),D(1,"app-comments-minimap",1),M(2,"translate"),f()),n&2){let i=c().ngIf,e=c();m(),g("commentAnnotations",i.commentAnnotations)("user",i.user)("position",i.position)("targetScrollableElementId",i.targetScrollableElementId),T("data-testid",e.componentId+"-minimap")("role","complementary")("aria-label",R(2,8,"Comments minimap"))("aria-hidden",!(i.commentAnnotations!=null&&i.commentAnnotations.length))}}function G1n(n,r){if(n&1&&(h(0),p(1,z1n,3,10,"ng-container",0),f()),n&2){let i=r.ngIf;m(),g("ngIf",i.user)}}var wxe=(()=>{let r=class r{constructor(e,t,o,a){this.authService=e,this.commentService=t,this.loggingService=o,this.elementRef=a,this.targetScrollableElementId=null,this.position="right",this.componentConfigSignal=Oe({commentAnnotations:[],user:null,position:"right",targetScrollableElementId:null}),this.subscriptions=[],this.componentId="velt-comments-minimap";try{this.loggingService.log("%c[WB] Creating CLASS: VeltCommentsMinimapComponent","color: blue;"),this.subscriptions.push(this.authService.getUser$().subscribe(l=>{this.componentConfigSignal.update(s=>(s=E(b({},s),{user:l}),s))},l=>{this.loggingService.catch("Error in VeltCommentsMinimapComponent getUser$: ",l)})),this.subscriptions.push(this.commentService.getCommentAnnotationsFromCommentsContainer$().subscribe(l=>{this.componentConfigSignal.update(s=>(s=E(b({},s),{commentAnnotations:l}),s))},l=>{this.loggingService.catch("Error in VeltCommentsMinimapComponent getCommentAnnotationsFromCommentsContainer$: ",l)}))}catch(l){this.loggingService.catch("Error in VeltCommentsMinimapComponent constructor: ",l)}}ngOnInit(){this.setupA11yAttributes()}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in VeltCommentsMinimapComponent setupA11yAttributes:",e)}}ngOnChanges(e){try{e&&Object.keys(e).forEach(t=>{this.componentConfigSignal.update(o=>(o=E(b({},o),{[t]:e[t].currentValue}),o))})}catch(t){this.loggingService.catch("Error in VeltCommentsMinimapComponent ngOnChanges: ",t)}}ngOnDestroy(){try{this.subscriptions.forEach(e=>{e.unsubscribe()})}catch(e){this.loggingService.catch("Error in VeltCommentsMinimapComponent ngOnDestroy: ",e)}}};r.\u0275fac=function(t){return new(t||r)(C(Ge),C(Pe),C(x),C(z))},r.\u0275cmp=O({type:r,selectors:[["velt-comments-minimap-internal"]],inputs:{targetScrollableElementId:"targetScrollableElementId",position:"position"},standalone:!1,features:[it],decls:1,vars:1,consts:[[4,"ngIf"],[3,"commentAnnotations","user","position","targetScrollableElementId"]],template:function(t,o){t&1&&p(0,G1n,2,1,"ng-container",0),t&2&&g("ngIf",o.componentConfigSignal())},dependencies:[se,CN,ue],encapsulation:2,changeDetection:0});let n=r;return n})();var W1n=["waveformContainer"];function q1n(n,r){n&1&&(de(),_(0,"svg",14),D(1,"rect",15),y())}function Y1n(n,r){if(n&1&&(_(0,"div",16),ne(1),M(2,"translate"),y()),n&2){let i=c().index,e=c(4);m(),Ee(" ",R(2,1,e.indexToTimeSignal()[i])," ")}}function K1n(n,r){if(n&1&&(_(0,"div",8)(1,"div",9)(2,"p"),ne(3,"."),y()(),D(4,"div",10),_(5,"div",11),p(6,q1n,2,0,"svg",12)(7,Y1n,3,3,"div",13),y()()),n&2){let i=r.$implicit,e=r.index;m(),ct("height",i+"px"),ve("silent",i===2),m(5),g("ngIf",e%10===0),m(),g("ngIf",e%10===0)}}function Z1n(n,r){if(n&1&&(h(0),_(1,"div",4),D(2,"div",5),_(3,"div",6),p(4,K1n,8,6,"div",7),y()(),f()),n&2){let i=c(2).ngIf,e=c();m(4),g("ngForOf",i.barHeights)("ngForTrackBy",e.trackByBarHeights)}}function X1n(n,r){if(n&1&&(h(0),p(1,Z1n,5,2,"ng-container",1),f()),n&2){let i=c().ngIf;m(),g("ngIf",i.isAudio)}}function J1n(n,r){if(n&1&&(_(0,"div",9)(1,"p"),ne(2,"."),y()()),n&2){let i=r.$implicit;ct("height",i+"px")}}function Q1n(n,r){if(n&1&&(_(0,"div",18),p(1,J1n,3,2,"div",19),y()),n&2){let i=c(2).ngIf,e=c();ve("thread-mode",i.threadMode),m(),g("ngForOf",i.barHeights)("ngForTrackBy",e.trackByBarHeights)}}function e_n(n,r){if(n&1&&(h(0),p(1,Q1n,2,4,"div",17),f()),n&2){let i=c().ngIf;m(),g("ngIf",i.isAudio&&(i.collapsedMode||i.threadMode))}}function t_n(n,r){if(n&1&&(_(0,"div",9)(1,"p"),ne(2,"."),y()()),n&2){let i=r.$implicit,e=r.index,t=c(2).ngIf;ct("height",i+"px"),ve("active-bar",e<=t.activeBarIndex)}}function n_n(n,r){if(n&1&&(h(0),_(1,"div",20),p(2,t_n,3,4,"div",21),y(),f()),n&2){let i=c().ngIf,e=c();m(2),g("ngForOf",i.barHeights)("ngForTrackBy",e.trackByBarHeights)}}function i_n(n,r){if(n&1&&(_(0,"div",8)(1,"div",9)(2,"p"),ne(3,"."),y()()()),n&2){let i=r.$implicit;m(),ct("height",i+"px")}}function r_n(n,r){if(n&1&&(h(0),_(1,"div",22)(2,"div",4),D(3,"div",5),_(4,"div",6),p(5,i_n,4,2,"div",7),y()()(),f()),n&2){let i=c().ngIf,e=c();m(5),g("ngForOf",i.barHeights)("ngForTrackBy",e.trackByBarHeights)}}function o_n(n,r){if(n&1&&D(0,"div",25),n&2){let i=r.$implicit;ct("height",i,"px")}}function a_n(n,r){if(n&1&&(h(0),_(1,"div",23),p(2,o_n,1,2,"div",24),y(),f()),n&2){let i=c().ngIf,e=c();m(2),g("ngForOf",i.barHeights)("ngForTrackBy",e.trackByBarHeights)}}function l_n(n,r){if(n&1&&(h(0),_(1,"div",26,0),de(),_(3,"svg",27)(4,"defs")(5,"linearGradient",28),D(6,"stop",29)(7,"stop",30)(8,"stop",31),y()(),D(9,"path",32),y()(),f()),n&2){let i=c().ngIf;m(9),T("d",i.mirroredWaveformPath)}}function s_n(n,r){if(n&1&&(h(0)(1,2),p(2,X1n,2,1,"ng-container",3)(3,e_n,2,1,"ng-container",3)(4,n_n,3,2,"ng-container",3)(5,r_n,6,2,"ng-container",3)(6,a_n,3,2,"ng-container",3)(7,l_n,10,1,"ng-container",3),f()()),n&2){let i=r.ngIf;m(),g("ngSwitch",i==null?null:i.variant),m(),g("ngSwitchCase","expanded"),m(),g("ngSwitchCase","minified"),m(),g("ngSwitchCase","player"),m(),g("ngSwitchCase","preview"),m(),g("ngSwitchCase","preview-mini"),m(),g("ngSwitchCase","editor")}}var Qy=(()=>{let r=class r{constructor(e,t){this.loggingService=e,this.recorderService=t,this.height=144,this.isRecording=!1,this.variant="expanded",this.isAudio=!1,this.collapsedMode=!1,this.threadMode=!1,this.numberOfBars=38,this.muteMic=null,this.maxVolumeArray=[],this.allowCleanUp=!0,this.animationFrameId=null,this.lastDrawTime=0,this.drawInterval=50,this.componentConfigSignal=Oe({variant:"expanded",isAudio:!1,barHeights:[],collapsedMode:!1,threadMode:!1,activeBarIndex:-1,mirroredWaveformPath:""}),this.indexToTimeSignal=_e(()=>{let o=this.componentConfigSignal().barHeights||[],a=[];for(let l=0;l<o.length;l++){let s=this.indexToTime(l);a.push(s)}return a}),this.showWaveform=()=>{try{if(!this.bufferArray||this.bufferArray.length===0)return;let o=this.bufferArray.length/this.numberOfBars,a=[];for(let l=0;l<this.numberOfBars;l++){let s=l*o,d=s+o,v=0,u=0;for(let A=Math.floor(s);A<d&&A<this.bufferArray.length;A++)v+=this.bufferArray[A],u++;let k=(u>0?v/u:0)/255*this.height*3;a.push(k)}this.componentConfigSignal.update(l=>E(b({},l),{barHeights:a})),this.updateMirroredWaveformPath()}catch(o){this.loggingService.warn("Error in AudioWaveformComponent showWaveform: ",o)}},this.draw=()=>{try{if(!this.analyzer)return;switch(this.analyzer.getByteFrequencyData(this.dataArray),this.componentConfigSignal()?.variant){case"preview":this.drawPreview();break;case"preview-mini":this.drawPreviewMini();break;default:this.drawDefault()}}catch(o){this.loggingService.warn("Error in AudioWaveformComponent draw: ",o)}}}ngOnInit(){try{this.bufferArray&&this.showWaveform(),setTimeout(()=>{this.setupResizeObserver()},100),this.updateMirroredWaveformPath()}catch(e){this.loggingService.warn("Error in AudioWaveformComponent ngOnInit: ",e)}}ngOnChanges(e){try{e&&Object.keys(e).forEach(t=>{this.componentConfigSignal.update(o=>E(b({},o),{[t]:e[t].currentValue}))}),e.playerCurrentTime&&e.playerCurrentTime.currentValue&&this.componentConfigSignal.update(t=>E(b({},t),{activeBarIndex:this.showActiveBars(e.playerCurrentTime.currentValue,this.totalTime.display)})),(e?.recorderInitData?.currentValue?.stream||e?.previewStream?.currentValue)&&(this.stopAnimation(),this.setupAudioElements(e.recorderInitData?.currentValue?.stream||e.previewStream.currentValue),this.startAnimation()),e.muteMic&&this.handleMicMute(e.muteMic.currentValue),this.updateMirroredWaveformPath()}catch(t){this.loggingService.warn("Error in AudioWaveformComponent ngOnChanges: ",t)}}trackByBarHeights(e,t){return e+"__"+t}showActiveBars(e,t){try{let o=d=>{let[v,u]=d.split(":").map(Number);return v*60+u},a=o(e),l=o(t)-1,s=l>0?a/l:0;return a>=l?this.numberOfBars:Math.floor(s*this.numberOfBars)}catch(o){return this.loggingService.warn("Error in AudioWaveformComponent showActiveBars: ",o),-1}}ngOnDestroy(){try{this.stopAnimation(),this.cleanupAudio(),this.cleanupResizeObserver()}catch{}}setupAudioElements(e){return X(this,null,function*(){try{this.cleanupAudio(),this.audioContext=new AudioContext,this.stream=e,this.microphone=this.audioContext.createMediaStreamSource(this.stream),this.analyzer=this.audioContext.createAnalyser(),this.analyzer.smoothingTimeConstant=.8,this.microphone.connect(this.analyzer),this.dataArray=new Uint8Array(this.analyzer.frequencyBinCount),this.analyzer.fftSize=1024,this.handleMicMute(this.muteMic)}catch{this.dataArray=new Uint8Array(0)}})}noiseGate(e,t,o){try{for(let a=0;a<e.length;a++)e[a]=Math.abs(e[a])>t?e[a]-t+o:o}catch(a){this.loggingService.warn("Error in AudioWaveformComponent noiseGate: ",a)}}startAnimation(){try{let e=t=>{t-this.lastDrawTime>=this.drawInterval&&(this.draw(),this.lastDrawTime=t),this.animationFrameId=requestAnimationFrame(e)};this.animationFrameId=requestAnimationFrame(e)}catch(e){this.loggingService.warn("Error in AudioWaveformComponent startAnimation: ",e)}}stopAnimation(){try{this.animationFrameId!==null&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null)}catch(e){this.loggingService.warn("Error in AudioWaveformComponent stopAnimation: ",e)}}drawPreview(){try{this.noiseGate(this.dataArray,128,0);let e=1e3,t=Math.floor(this.dataArray.length/e),o=[];for(let l=0;l<e;l++){let s=l*t,d=Math.min(s+t,this.dataArray.length),v=this.dataArray.slice(s,d),u=v.reduce((S,k)=>S+k,0)/v.length;o.push(u)}o.sort((l,s)=>l-s);let a=[];for(let l=0;l<e;l++)a.push(o[l],o[l]);for(let l=e-1;l>=0;l--)a.push(o[l],o[l]);this.componentConfigSignal.update(l=>E(b({},l),{barHeights:a.filter(s=>s!==0)})),this.updateMirroredWaveformPath()}catch(e){this.loggingService.warn("Error in AudioWaveformComponent drawPreview: ",e)}}drawPreviewMini(){try{this.noiseGate(this.dataArray,128,0);let e=Math.max(...this.dataArray),t=Math.max(2,Math.min(14,e/128*14));if(this.componentConfigSignal.update(o=>E(b({},o),{barHeights:[Math.max(2,t/1.5),t,Math.max(2,t/2)]})),this.updateMirroredWaveformPath(),this.analyzer?.getByteTimeDomainData(this.dataArray),this.noiseGate(this.dataArray,128,2),this.isRecording){let o=Math.max(...this.dataArray);this.maxVolumeArray.push(o),this.recorderService.setRecordedDataStream(this.maxVolumeArray)}}catch(e){this.loggingService.warn("Error in AudioWaveformComponent drawPreviewMini: ",e)}}drawDefault(){try{if(this.analyzer?.getByteTimeDomainData(this.dataArray),this.noiseGate(this.dataArray,128,2),this.isRecording){let e=Math.max(...this.dataArray),t=e/255*this.height*3;this.maxVolumeArray.push(e),this.recorderService.setRecordedDataStream(this.maxVolumeArray),this.componentConfigSignal.update(o=>E(b({},o),{barHeights:[...o.barHeights,t]})),this.updateMirroredWaveformPath()}}catch(e){this.loggingService.warn("Error in AudioWaveformComponent drawDefault: ",e)}}cleanupAudio(){try{this.allowCleanUp&&this.variant!=="expanded"&&(this.microphone&&(this.microphone.disconnect(),this.microphone=null),this.stream&&(this.stream.getTracks().forEach(e=>e.stop()),this.stream=null),this.analyzer&&(this.analyzer.disconnect(),this.analyzer=null),this.audioContext&&this.audioContext.state!=="closed"&&(this.audioContext.close(),this.audioContext=null),this.componentConfigSignal.update(e=>E(b({},e),{barHeights:[]})),this.updateMirroredWaveformPath())}catch{}}handleMicMute(e){try{this.stream&&this.stream.getAudioTracks().forEach(t=>{t.enabled=!e})}catch(t){this.loggingService.warn("Error in AudioWaveformComponent handleMicMute: ",t)}}indexToTime(e){try{let t=e*100,o=Math.floor(t/1e3),a=Math.floor(o/60),l=o%60,s=a.toString().padStart(2,"0"),d=l.toString().padStart(2,"0");return`${s}:${d}`}catch(t){return this.loggingService.warn("Error in AudioWaveformComponent indexToTime: ",t),""}}generateMirroredWaveformPath(e,t,o){try{if(!e||e.length===0)return"";let a=o?e.slice(0,t):e.slice(t);if(a.length===0)return"";let l=o?0:t,s=e.length,d=100,u=18/2,S=Math.min(...a),A=Math.max(...a)-S,P=A>0?u*.8/A:.1,U=.5,W="";if(a.length>0){let te=l/s*d;W=`M ${te} ${u} `;let ye=te,me=A>0?(a[0]-S)*P:U,ke=u-Math.max(me,U);W+=`L ${ye} ${ke} `;for(let Le=1;Le<a.length;Le++){let Ue=(l+Le)/s*d,He=(l+Le-1)/s*d,$e=A>0?(a[Le]-S)*P:U,br=A>0?(a[Le-1]-S)*P:U,Dt=u-Math.max($e,U),wt=u-Math.max(br,U),Ze=He+(Ue-He)/3,Bt=He+2*(Ue-He)/3;W+=`C ${Ze} ${wt}, ${Bt} ${Dt}, ${Ue} ${Dt} `}let De=(l+a.length-1)/s*d;W+=`L ${De} ${u} `;let Ie=De,xe=A>0?(a[a.length-1]-S)*P:U,Re=u+Math.max(xe,U);W+=`L ${Ie} ${Re} `;for(let Le=a.length-2;Le>=0;Le--){let Ue=(l+Le)/s*d,He=(l+Le+1)/s*d,$e=A>0?(a[Le]-S)*P:U,br=A>0?(a[Le+1]-S)*P:U,Dt=u+Math.max($e,U),wt=u+Math.max(br,U),Ze=He-(He-Ue)/3,Bt=He-2*(He-Ue)/3;W+=`C ${Ze} ${wt}, ${Bt} ${Dt}, ${Ue} ${Dt} `}W+="Z"}return W}catch(a){return this.loggingService.warn("Error in AudioWaveformComponent generateMirroredWaveformPath: ",a),""}}onResize(){this.componentConfigSignal()?.variant==="editor"&&setTimeout(()=>{this.updateMirroredWaveformPath()},100)}updateMirroredWaveformPath(){try{let e=this.componentConfigSignal(),t=this.generateMirroredWaveformPath(e.barHeights,e.activeBarIndex+1,!1);this.componentConfigSignal.update(o=>E(b({},o),{mirroredWaveformPath:t}))}catch(e){this.loggingService.warn("Error in AudioWaveformComponent updateMirroredWaveformPath: ",e)}}setupResizeObserver(){try{this.waveformContainer&&!this.resizeObserver&&typeof ResizeObserver<"u"&&(this.resizeObserver=new ResizeObserver(e=>{this.updateMirroredWaveformPath()}),this.resizeObserver.observe(this.waveformContainer.nativeElement))}catch(e){this.loggingService.warn("Error in AudioWaveformComponent setupResizeObserver: ",e)}}cleanupResizeObserver(){try{this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=void 0)}catch(e){this.loggingService.warn("Error in AudioWaveformComponent cleanupResizeObserver: ",e)}}};r.\u0275fac=function(t){return new(t||r)(C(x),C(kn))},r.\u0275cmp=O({type:r,selectors:[["app-audio-waveform"]],viewQuery:function(t,o){if(t&1&&dt(W1n,5),t&2){let a;ot(a=at())&&(o.waveformContainer=a.first)}},hostBindings:function(t,o){t&1&&G("resize",function(){return o.onResize()},eI)},inputs:{height:"height",isRecording:"isRecording",variant:"variant",isAudio:"isAudio",collapsedMode:"collapsedMode",bufferArray:"bufferArray",playerCurrentTime:"playerCurrentTime",totalTime:"totalTime",recorderInitData:"recorderInitData",threadMode:"threadMode",previewStream:"previewStream",numberOfBars:"numberOfBars",muteMic:"muteMic"},standalone:!1,features:[it],decls:1,vars:1,consts:[["waveformContainer",""],[4,"ngIf"],[3,"ngSwitch"],[4,"ngSwitchCase"],[1,"audio-waveform"],[1,"center-line"],[1,"waves"],["class","bar-container",4,"ngFor","ngForOf","ngForTrackBy"],[1,"bar-container"],[1,"bar"],[1,"line"],[1,"time-container"],["width","2","height","8","viewBox","0 0 2 8","fill","none","xmlns","http://www.w3.org/2000/svg",4,"ngIf"],["class","time",4,"ngIf"],["width","2","height","8","viewBox","0 0 2 8","fill","none","xmlns","http://www.w3.org/2000/svg"],["x","0.5","width","1","height","8"],[1,"time"],["class","mini-audio-container",3,"thread-mode",4,"ngIf"],[1,"mini-audio-container"],["class","bar",3,"height",4,"ngFor","ngForOf","ngForTrackBy"],[1,"mini-audio-container-player"],["class","bar",3,"height","active-bar",4,"ngFor","ngForOf","ngForTrackBy"],[1,"audio-container-preview"],[1,"audio-container-preview-mini"],["class","audio-container-preview-mini--bar",3,"height",4,"ngFor","ngForOf","ngForTrackBy"],[1,"audio-container-preview-mini--bar"],[1,"editor-player"],["width","100%","height","18","viewBox","0 0 100 18","preserveAspectRatio","none",1,"smooth-waveform"],["id","active-gradient","x1","0%","y1","0%","x2","0%","y2","100%"],["offset","0%","stop-color","var(--velt-text-4)","stop-opacity","1"],["offset","50%","stop-color","var(--velt-text-4)","stop-opacity","1"],["offset","100%","stop-color","var(--velt-text-4)","stop-opacity","1"],["fill","url(#active-gradient)"]],template:function(t,o){t&1&&p(0,s_n,8,7,"ng-container",1),t&2&&g("ngIf",o.componentConfigSignal())},dependencies:[Vt,se,Rr,Jr,ue],styles:[".audio-waveform[_ngcontent-%COMP%]{display:flex;flex-direction:column;width:100%;height:100%;align-items:center;justify-content:center;overflow:hidden;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);box-sizing:border-box;border:1px solid var(--velt-border-3);border-radius:var(--velt-border-radius-lg)}.audio-waveform[_ngcontent-%COMP%] .center-line[_ngcontent-%COMP%]{position:absolute;background:var(--velt-background-2);height:4px;width:100%;z-index:1!important}.audio-waveform[_ngcontent-%COMP%] .waves[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:flex-end;height:144px;width:100%;z-index:2!important}.audio-waveform[_ngcontent-%COMP%] .waves[_ngcontent-%COMP%] .bar-container[_ngcontent-%COMP%]{height:100%;display:flex;align-items:center;justify-content:center;flex-direction:column}.audio-waveform[_ngcontent-%COMP%] .waves[_ngcontent-%COMP%] .bar-container[_ngcontent-%COMP%] .bar[_ngcontent-%COMP%]{width:2px;background:var(--velt-error);margin-right:var(--velt-spacing-xs);border-radius:var(--velt-border-radius-xs);transition:height .5s ease}.audio-waveform[_ngcontent-%COMP%] .waves[_ngcontent-%COMP%] .bar-container[_ngcontent-%COMP%] .bar.silent[_ngcontent-%COMP%]{background:var(--velt-text-12)}.audio-waveform[_ngcontent-%COMP%] .waves[_ngcontent-%COMP%] .bar-container[_ngcontent-%COMP%] .bar[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{opacity:0}.audio-waveform[_ngcontent-%COMP%] .waves[_ngcontent-%COMP%] .bar-container[_ngcontent-%COMP%] .line[_ngcontent-%COMP%]{position:absolute;bottom:35px;background:var(--velt-background-4);height:1px;width:6px}.audio-waveform[_ngcontent-%COMP%] .waves[_ngcontent-%COMP%] .bar-container[_ngcontent-%COMP%] .time-container[_ngcontent-%COMP%]{position:absolute;bottom:10px;display:flex;flex-direction:column;align-items:center;justify-content:space-between;margin-left:var(--velt-spacing-lg)}.audio-waveform[_ngcontent-%COMP%] .waves[_ngcontent-%COMP%] .bar-container[_ngcontent-%COMP%] .time-container[_ngcontent-%COMP%] svg[_ngcontent-%COMP%] rect[_ngcontent-%COMP%]{fill:var(--velt-background-4)}.audio-waveform[_ngcontent-%COMP%] .waves[_ngcontent-%COMP%] .bar-container[_ngcontent-%COMP%] .time-container[_ngcontent-%COMP%] .time[_ngcontent-%COMP%]{padding-top:var(--velt-spacing-sm);font-weight:600;font-size:var(--velt-font-size-2xs);line-height:11px;color:var(--velt-text-12)}.mini-audio-container[_ngcontent-%COMP%]{height:18px;display:flex;align-items:center;justify-content:flex-end;overflow:hidden;margin-left:var(--velt-spacing-sm)}.mini-audio-container.thread-mode[_ngcontent-%COMP%]{width:74px}.mini-audio-container[_ngcontent-%COMP%] .bar[_ngcontent-%COMP%]{width:2px;background:var(--velt-error);margin-right:var(--velt-spacing-2xs);border-radius:var(--velt-border-radius-2xs);transition:height .5s ease}.mini-audio-container[_ngcontent-%COMP%] .bar[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{opacity:0}.mini-audio-container-player[_ngcontent-%COMP%]{height:18px;display:flex;align-items:center;justify-content:center;overflow:hidden;margin-left:var(--velt-spacing-sm)}.mini-audio-container-player[_ngcontent-%COMP%] .bar[_ngcontent-%COMP%]{width:2px;background:var(--velt-text-12);margin-right:var(--velt-spacing-2xs);border-radius:var(--velt-border-radius-2xs)}.mini-audio-container-player[_ngcontent-%COMP%] .bar[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{opacity:0}.mini-audio-container-player[_ngcontent-%COMP%] .active-bar[_ngcontent-%COMP%]{background:var(--velt-accent-text)}.audio-container-preview[_ngcontent-%COMP%] .audio-waveform[_ngcontent-%COMP%]{display:flex;flex-direction:column;width:100%;height:300px;align-items:center;justify-content:center;overflow:hidden;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);z-index:-1;border-width:0px}.audio-container-preview[_ngcontent-%COMP%] .audio-waveform[_ngcontent-%COMP%] .center-line[_ngcontent-%COMP%]{position:absolute;background:var(--velt-background-2);height:4px;width:100%;z-index:1}.audio-container-preview[_ngcontent-%COMP%] .audio-waveform[_ngcontent-%COMP%] .waves[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;height:144px;width:100%;z-index:2}.audio-container-preview[_ngcontent-%COMP%] .audio-waveform[_ngcontent-%COMP%] .waves[_ngcontent-%COMP%] .bar-container[_ngcontent-%COMP%]{height:100%;display:flex;align-items:center;justify-content:center;flex-direction:column}.audio-container-preview[_ngcontent-%COMP%] .audio-waveform[_ngcontent-%COMP%] .waves[_ngcontent-%COMP%] .bar-container[_ngcontent-%COMP%] .bar[_ngcontent-%COMP%]{width:2px;background:var(--velt-error);margin-right:var(--velt-spacing-xs);border-radius:var(--velt-border-radius-2xs);transition:height .5s ease}.audio-container-preview[_ngcontent-%COMP%] .audio-waveform[_ngcontent-%COMP%] .waves[_ngcontent-%COMP%] .bar-container[_ngcontent-%COMP%] .bar[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{opacity:0}.audio-container-preview[_ngcontent-%COMP%] .audio-waveform[_ngcontent-%COMP%] .waves[_ngcontent-%COMP%] .bar-container[_ngcontent-%COMP%] .line[_ngcontent-%COMP%]{position:absolute;bottom:35px;background:var(--velt-background-4);height:1px;width:6px}.audio-container-preview[_ngcontent-%COMP%] .audio-waveform[_ngcontent-%COMP%] .waves[_ngcontent-%COMP%] .bar-container[_ngcontent-%COMP%] .time-container[_ngcontent-%COMP%]{position:absolute;bottom:10px;display:flex;flex-direction:column;align-items:center;justify-content:space-between;margin-left:var(--velt-spacing-lg)}.audio-container-preview[_ngcontent-%COMP%] .audio-waveform[_ngcontent-%COMP%] .waves[_ngcontent-%COMP%] .bar-container[_ngcontent-%COMP%] .time-container[_ngcontent-%COMP%] .time[_ngcontent-%COMP%]{padding-top:var(--velt-spacing-sm);font-weight:600;font-size:var(--velt-font-size-2xs);line-height:11px;color:var(--velt-text-12)}.audio-container-preview-mini[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;gap:2px;width:28px;height:28px;background:var(--velt-accent);border-radius:var(--velt-border-radius-3xl)}.audio-container-preview-mini[_ngcontent-%COMP%] .audio-container-preview-mini--bar[_ngcontent-%COMP%]{width:2px;background:var(--velt-white);border-radius:var(--velt-border-radius-2xs);transition:height .1s}.editor-player[_ngcontent-%COMP%]{height:50px;display:flex;align-items:center;justify-content:center;overflow:hidden;width:100%;position:relative;margin-left:1.5px}.editor-player[_ngcontent-%COMP%] .smooth-waveform[_ngcontent-%COMP%]{width:100%;height:100%;position:absolute;left:0;top:0}.editor-player[_ngcontent-%COMP%] .smooth-waveform[_ngcontent-%COMP%] .inactive-stop-top[_ngcontent-%COMP%], .editor-player[_ngcontent-%COMP%] .smooth-waveform[_ngcontent-%COMP%] .inactive-stop-bottom[_ngcontent-%COMP%]{stop-color:var(--velt-text-12)}.editor-player[_ngcontent-%COMP%] .smooth-waveform[_ngcontent-%COMP%] .active-stop-top[_ngcontent-%COMP%], .editor-player[_ngcontent-%COMP%] .smooth-waveform[_ngcontent-%COMP%] .active-stop-bottom[_ngcontent-%COMP%]{stop-color:var(--velt-accent-text)}.editor-player[_ngcontent-%COMP%] .smooth-waveform[_ngcontent-%COMP%] path[_ngcontent-%COMP%]{transition:d .2s ease-in-out}"],changeDetection:0});let n=r;return n})();var c_n=["knob"],d_n=["valueIndicatorContainer"];function m_n(n,r){if(n&1&&(_(0,"div",2,1)(2,"div",5)(3,"span",6),ne(4),y()()()),n&2){let i=c();m(4),Ke(i.valueIndicatorText)}}var g_n=["trackActive"],v_n=["*"];function u_n(n,r){if(n&1&&D(0,"div"),n&2){let i=r.$implicit,e=r.$index,t=c(3);Xr(i===0?"mdc-slider__tick-mark--active":"mdc-slider__tick-mark--inactive"),ct("transform",t._calcTickMarkTransform(e))}}function p_n(n,r){if(n&1&&ci(0,u_n,1,4,"div",8,mB),n&2){let i=c(2);di(i._tickMarks)}}function h_n(n,r){if(n&1&&(_(0,"div",6,1),ie(2,p_n,2,0),y()),n&2){let i=c();m(2),re(i._cachedWidth?2:-1)}}function f_n(n,r){if(n&1&&D(0,"mat-slider-visual-thumb",7),n&2){let i=c();g("discrete",i.discrete)("thumbPosition",1)("valueIndicatorText",i.startValueIndicatorText)}}var Qn=(function(n){return n[n.START=1]="START",n[n.END=2]="END",n})(Qn||{}),ex=(function(n){return n[n.ACTIVE=0]="ACTIVE",n[n.INACTIVE=1]="INACTIVE",n})(ex||{}),uK=new ft("_MatSlider"),Dxe=new ft("_MatSliderThumb"),C_n=new ft("_MatSliderRangeThumb"),Oxe=new ft("_MatSliderVisualThumb");var __n=(()=>{class n{_cdr=pe(on);_ngZone=pe($t);_slider=pe(uK);_renderer=pe(fr);_listenerCleanups;discrete;thumbPosition;valueIndicatorText;_ripple;_knob;_valueIndicatorContainer;_sliderInput;_sliderInputEl;_hoverRippleRef;_focusRippleRef;_activeRippleRef;_isHovered=!1;_isActive=!1;_isValueIndicatorVisible=!1;_hostElement=pe(z).nativeElement;_platform=pe(Nr);constructor(){}ngAfterViewInit(){let i=this._slider._getInput(this.thumbPosition);i&&(this._ripple.radius=24,this._sliderInput=i,this._sliderInputEl=this._sliderInput._hostElement,this._ngZone.runOutsideAngular(()=>{let e=this._sliderInputEl,t=this._renderer;this._listenerCleanups=[t.listen(e,"pointermove",this._onPointerMove),t.listen(e,"pointerdown",this._onDragStart),t.listen(e,"pointerup",this._onDragEnd),t.listen(e,"pointerleave",this._onMouseLeave),t.listen(e,"focus",this._onFocus),t.listen(e,"blur",this._onBlur)]}))}ngOnDestroy(){this._listenerCleanups?.forEach(i=>i())}_onPointerMove=i=>{if(this._sliderInput._isFocused)return;let e=this._hostElement.getBoundingClientRect(),t=this._slider._isCursorOnSliderThumb(i,e);this._isHovered=t,t?this._showHoverRipple():this._hideRipple(this._hoverRippleRef)};_onMouseLeave=()=>{this._isHovered=!1,this._hideRipple(this._hoverRippleRef)};_onFocus=()=>{this._hideRipple(this._hoverRippleRef),this._showFocusRipple(),this._hostElement.classList.add("mdc-slider__thumb--focused")};_onBlur=()=>{this._isActive||this._hideRipple(this._focusRippleRef),this._isHovered&&this._showHoverRipple(),this._hostElement.classList.remove("mdc-slider__thumb--focused")};_onDragStart=i=>{i.button===0&&(this._isActive=!0,this._showActiveRipple())};_onDragEnd=()=>{this._isActive=!1,this._hideRipple(this._activeRippleRef),this._sliderInput._isFocused||this._hideRipple(this._focusRippleRef),this._platform.SAFARI&&this._showHoverRipple()};_showHoverRipple(){this._isShowingRipple(this._hoverRippleRef)||(this._hoverRippleRef=this._showRipple({enterDuration:0,exitDuration:0}),this._hoverRippleRef?.element.classList.add("mat-mdc-slider-hover-ripple"))}_showFocusRipple(){this._isShowingRipple(this._focusRippleRef)||(this._focusRippleRef=this._showRipple({enterDuration:0,exitDuration:0},!0),this._focusRippleRef?.element.classList.add("mat-mdc-slider-focus-ripple"))}_showActiveRipple(){this._isShowingRipple(this._activeRippleRef)||(this._activeRippleRef=this._showRipple({enterDuration:225,exitDuration:400}),this._activeRippleRef?.element.classList.add("mat-mdc-slider-active-ripple"))}_isShowingRipple(i){return i?.state===Bl.FADING_IN||i?.state===Bl.VISIBLE}_showRipple(i,e){if(!this._slider.disabled&&(this._showValueIndicator(),this._slider._isRange&&this._slider._getThumb(this.thumbPosition===Qn.START?Qn.END:Qn.START)._showValueIndicator(),!(this._slider._globalRippleOptions?.disabled&&!e)))return this._ripple.launch({animation:this._slider._noopAnimations?{enterDuration:0,exitDuration:0}:i,centered:!0,persistent:!0})}_hideRipple(i){if(i?.fadeOut(),this._isShowingAnyRipple())return;this._slider._isRange||this._hideValueIndicator();let e=this._getSibling();e._isShowingAnyRipple()||(this._hideValueIndicator(),e._hideValueIndicator())}_showValueIndicator(){this._hostElement.classList.add("mdc-slider__thumb--with-indicator")}_hideValueIndicator(){this._hostElement.classList.remove("mdc-slider__thumb--with-indicator")}_getSibling(){return this._slider._getThumb(this.thumbPosition===Qn.START?Qn.END:Qn.START)}_getValueIndicatorContainer(){return this._valueIndicatorContainer?.nativeElement}_getKnob(){return this._knob.nativeElement}_isShowingAnyRipple(){return this._isShowingRipple(this._hoverRippleRef)||this._isShowingRipple(this._focusRippleRef)||this._isShowingRipple(this._activeRippleRef)}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=O({type:n,selectors:[["mat-slider-visual-thumb"]],viewQuery:function(e,t){if(e&1&&(dt(qh,5),dt(c_n,5),dt(d_n,5)),e&2){let o;ot(o=at())&&(t._ripple=o.first),ot(o=at())&&(t._knob=o.first),ot(o=at())&&(t._valueIndicatorContainer=o.first)}},hostAttrs:[1,"mdc-slider__thumb","mat-mdc-slider-visual-thumb"],inputs:{discrete:"discrete",thumbPosition:"thumbPosition",valueIndicatorText:"valueIndicatorText"},features:[j([{provide:Oxe,useExisting:n}])],decls:4,vars:2,consts:[["knob",""],["valueIndicatorContainer",""],[1,"mdc-slider__value-indicator-container"],[1,"mdc-slider__thumb-knob"],["matRipple","",1,"mat-focus-indicator",3,"matRippleDisabled"],[1,"mdc-slider__value-indicator"],[1,"mdc-slider__value-indicator-text"]],template:function(e,t){e&1&&(ie(0,m_n,5,1,"div",2),D(1,"div",3,0)(3,"div",4)),e&2&&(re(t.discrete?0:-1),m(3),g("matRippleDisabled",!0))},dependencies:[qh],styles:[`.mat-mdc-slider-visual-thumb .mat-ripple{height:100%;width:100%}.mat-mdc-slider .mdc-slider__tick-marks{justify-content:start}.mat-mdc-slider .mdc-slider__tick-marks .mdc-slider__tick-mark--active,.mat-mdc-slider .mdc-slider__tick-marks .mdc-slider__tick-mark--inactive{position:absolute;left:2px}
|
|
563
563
|
`],encapsulation:2,changeDetection:0})}return n})(),Axe=(()=>{class n{_ngZone=pe($t);_cdr=pe(on);_elementRef=pe(z);_dir=pe(va,{optional:!0});_globalRippleOptions=pe(_z,{optional:!0});_trackActive;_thumbs;_input;_inputs;get disabled(){return this._disabled}set disabled(i){this._disabled=i;let e=this._getInput(Qn.END),t=this._getInput(Qn.START);e&&(e.disabled=this._disabled),t&&(t.disabled=this._disabled)}_disabled=!1;get discrete(){return this._discrete}set discrete(i){this._discrete=i,this._updateValueIndicatorUIs()}_discrete=!1;get showTickMarks(){return this._showTickMarks}set showTickMarks(i){this._showTickMarks=i,this._hasViewInitialized&&(this._updateTickMarkUI(),this._updateTickMarkTrackUI())}_showTickMarks=!1;get min(){return this._min}set min(i){let e=i==null||isNaN(i)?this._min:i;this._min!==e&&this._updateMin(e)}_min=0;color;disableRipple=!1;_updateMin(i){let e=this._min;this._min=i,this._isRange?this._updateMinRange({old:e,new:i}):this._updateMinNonRange(i),this._onMinMaxOrStepChange()}_updateMinRange(i){let e=this._getInput(Qn.END),t=this._getInput(Qn.START),o=e.value,a=t.value;t.min=i.new,e.min=Math.max(i.new,t.value),t.max=Math.min(e.max,e.value),t._updateWidthInactive(),e._updateWidthInactive(),i.new<i.old?this._onTranslateXChangeBySideEffect(e,t):this._onTranslateXChangeBySideEffect(t,e),o!==e.value&&this._onValueChange(e),a!==t.value&&this._onValueChange(t)}_updateMinNonRange(i){let e=this._getInput(Qn.END);if(e){let t=e.value;e.min=i,e._updateThumbUIByValue(),this._updateTrackUI(e),t!==e.value&&this._onValueChange(e)}}get max(){return this._max}set max(i){let e=i==null||isNaN(i)?this._max:i;this._max!==e&&this._updateMax(e)}_max=100;_updateMax(i){let e=this._max;this._max=i,this._isRange?this._updateMaxRange({old:e,new:i}):this._updateMaxNonRange(i),this._onMinMaxOrStepChange()}_updateMaxRange(i){let e=this._getInput(Qn.END),t=this._getInput(Qn.START),o=e.value,a=t.value;e.max=i.new,t.max=Math.min(i.new,e.value),e.min=t.value,e._updateWidthInactive(),t._updateWidthInactive(),i.new>i.old?this._onTranslateXChangeBySideEffect(t,e):this._onTranslateXChangeBySideEffect(e,t),o!==e.value&&this._onValueChange(e),a!==t.value&&this._onValueChange(t)}_updateMaxNonRange(i){let e=this._getInput(Qn.END);if(e){let t=e.value;e.max=i,e._updateThumbUIByValue(),this._updateTrackUI(e),t!==e.value&&this._onValueChange(e)}}get step(){return this._step}set step(i){let e=isNaN(i)?this._step:i;this._step!==e&&this._updateStep(e)}_step=1;_updateStep(i){this._step=i,this._isRange?this._updateStepRange():this._updateStepNonRange(),this._onMinMaxOrStepChange()}_updateStepRange(){let i=this._getInput(Qn.END),e=this._getInput(Qn.START),t=i.value,o=e.value,a=e.value;i.min=this._min,e.max=this._max,i.step=this._step,e.step=this._step,this._platform.SAFARI&&(i.value=i.value,e.value=e.value),i.min=Math.max(this._min,e.value),e.max=Math.min(this._max,i.value),e._updateWidthInactive(),i._updateWidthInactive(),i.value<a?this._onTranslateXChangeBySideEffect(e,i):this._onTranslateXChangeBySideEffect(i,e),t!==i.value&&this._onValueChange(i),o!==e.value&&this._onValueChange(e)}_updateStepNonRange(){let i=this._getInput(Qn.END);if(i){let e=i.value;i.step=this._step,this._platform.SAFARI&&(i.value=i.value),i._updateThumbUIByValue(),e!==i.value&&this._onValueChange(i)}}displayWith=i=>`${i}`;_tickMarks;_noopAnimations=Pa();_dirChangeSubscription;_resizeObserver;_cachedWidth;_cachedLeft;_rippleRadius=24;startValueIndicatorText="";endValueIndicatorText="";_endThumbTransform;_startThumbTransform;_isRange=!1;_isRtl=!1;_hasViewInitialized=!1;_tickMarkTrackWidth=0;_hasAnimation=!1;_resizeTimer=null;_platform=pe(Nr);constructor(){pe(vl).load(l1),this._dir&&(this._dirChangeSubscription=this._dir.change.subscribe(()=>this._onDirChange()),this._isRtl=this._dir.value==="rtl")}_knobRadius=8;_inputPadding;ngAfterViewInit(){this._platform.isBrowser&&this._updateDimensions();let i=this._getInput(Qn.END),e=this._getInput(Qn.START);this._isRange=!!i&&!!e,this._cdr.detectChanges();let t=this._getThumb(Qn.END);this._rippleRadius=t._ripple.radius,this._inputPadding=this._rippleRadius-this._knobRadius,this._isRange?this._initUIRange(i,e):this._initUINonRange(i),this._updateTrackUI(i),this._updateTickMarkUI(),this._updateTickMarkTrackUI(),this._observeHostResize(),this._cdr.detectChanges()}_initUINonRange(i){i.initProps(),i.initUI(),this._updateValueIndicatorUI(i),this._hasViewInitialized=!0,i._updateThumbUIByValue()}_initUIRange(i,e){i.initProps(),i.initUI(),e.initProps(),e.initUI(),i._updateMinMax(),e._updateMinMax(),i._updateStaticStyles(),e._updateStaticStyles(),this._updateValueIndicatorUIs(),this._hasViewInitialized=!0,i._updateThumbUIByValue(),e._updateThumbUIByValue()}ngOnDestroy(){this._dirChangeSubscription.unsubscribe(),this._resizeObserver?.disconnect(),this._resizeObserver=null}_onDirChange(){this._isRtl=this._dir?.value==="rtl",this._isRange?this._onDirChangeRange():this._onDirChangeNonRange(),this._updateTickMarkUI()}_onDirChangeRange(){let i=this._getInput(Qn.END),e=this._getInput(Qn.START);i._setIsLeftThumb(),e._setIsLeftThumb(),i.translateX=i._calcTranslateXByValue(),e.translateX=e._calcTranslateXByValue(),i._updateStaticStyles(),e._updateStaticStyles(),i._updateWidthInactive(),e._updateWidthInactive(),i._updateThumbUIByValue(),e._updateThumbUIByValue()}_onDirChangeNonRange(){this._getInput(Qn.END)._updateThumbUIByValue()}_observeHostResize(){typeof ResizeObserver>"u"||!ResizeObserver||this._ngZone.runOutsideAngular(()=>{this._resizeObserver=new ResizeObserver(()=>{this._isActive()||(this._resizeTimer&&clearTimeout(this._resizeTimer),this._onResize())}),this._resizeObserver.observe(this._elementRef.nativeElement)})}_isActive(){return this._getThumb(Qn.START)._isActive||this._getThumb(Qn.END)._isActive}_getValue(i=Qn.END){let e=this._getInput(i);return e?e.value:this.min}_skipUpdate(){return!!(this._getInput(Qn.START)?._skipUIUpdate||this._getInput(Qn.END)?._skipUIUpdate)}_updateDimensions(){this._cachedWidth=this._elementRef.nativeElement.offsetWidth,this._cachedLeft=this._elementRef.nativeElement.getBoundingClientRect().left}_setTrackActiveStyles(i){let e=this._trackActive.nativeElement.style;e.left=i.left,e.right=i.right,e.transformOrigin=i.transformOrigin,e.transform=i.transform}_calcTickMarkTransform(i){let e=i*(this._tickMarkTrackWidth/(this._tickMarks.length-1));return`translateX(${this._isRtl?this._cachedWidth-6-e:e}px`}_onTranslateXChange(i){this._hasViewInitialized&&(this._updateThumbUI(i),this._updateTrackUI(i),this._updateOverlappingThumbUI(i))}_onTranslateXChangeBySideEffect(i,e){this._hasViewInitialized&&(i._updateThumbUIByValue(),e._updateThumbUIByValue())}_onValueChange(i){this._hasViewInitialized&&(this._updateValueIndicatorUI(i),this._updateTickMarkUI(),this._cdr.detectChanges())}_onMinMaxOrStepChange(){this._hasViewInitialized&&(this._updateTickMarkUI(),this._updateTickMarkTrackUI(),this._cdr.markForCheck())}_onResize(){if(this._hasViewInitialized){if(this._updateDimensions(),this._isRange){let i=this._getInput(Qn.END),e=this._getInput(Qn.START);i._updateThumbUIByValue(),e._updateThumbUIByValue(),i._updateStaticStyles(),e._updateStaticStyles(),i._updateMinMax(),e._updateMinMax(),i._updateWidthInactive(),e._updateWidthInactive()}else{let i=this._getInput(Qn.END);i&&i._updateThumbUIByValue()}this._updateTickMarkUI(),this._updateTickMarkTrackUI(),this._cdr.detectChanges()}}_thumbsOverlap=!1;_areThumbsOverlapping(){let i=this._getInput(Qn.START),e=this._getInput(Qn.END);return!i||!e?!1:e.translateX-i.translateX<20}_updateOverlappingThumbClassNames(i){let e=i.getSibling(),t=this._getThumb(i.thumbPosition);this._getThumb(e.thumbPosition)._hostElement.classList.remove("mdc-slider__thumb--top"),t._hostElement.classList.toggle("mdc-slider__thumb--top",this._thumbsOverlap)}_updateOverlappingThumbUI(i){!this._isRange||this._skipUpdate()||this._thumbsOverlap!==this._areThumbsOverlapping()&&(this._thumbsOverlap=!this._thumbsOverlap,this._updateOverlappingThumbClassNames(i))}_updateThumbUI(i){if(this._skipUpdate())return;let e=this._getThumb(i.thumbPosition===Qn.END?Qn.END:Qn.START);e._hostElement.style.transform=`translateX(${i.translateX}px)`}_updateValueIndicatorUI(i){if(this._skipUpdate())return;let e=this.displayWith(i.value);if(this._hasViewInitialized?i._valuetext.set(e):i._hostElement.setAttribute("aria-valuetext",e),this.discrete){i.thumbPosition===Qn.START?this.startValueIndicatorText=e:this.endValueIndicatorText=e;let t=this._getThumb(i.thumbPosition);e.length<3?t._hostElement.classList.add("mdc-slider__thumb--short-value"):t._hostElement.classList.remove("mdc-slider__thumb--short-value")}}_updateValueIndicatorUIs(){let i=this._getInput(Qn.END),e=this._getInput(Qn.START);i&&this._updateValueIndicatorUI(i),e&&this._updateValueIndicatorUI(e)}_updateTickMarkTrackUI(){if(!this.showTickMarks||this._skipUpdate())return;let i=this._step&&this._step>0?this._step:1,t=(Math.floor(this.max/i)*i-this.min)/(this.max-this.min);this._tickMarkTrackWidth=(this._cachedWidth-6)*t}_updateTrackUI(i){this._skipUpdate()||(this._isRange?this._updateTrackUIRange(i):this._updateTrackUINonRange(i))}_updateTrackUIRange(i){let e=i.getSibling();if(!e||!this._cachedWidth)return;let t=Math.abs(e.translateX-i.translateX)/this._cachedWidth;i._isLeftThumb&&this._cachedWidth?this._setTrackActiveStyles({left:"auto",right:`${this._cachedWidth-e.translateX}px`,transformOrigin:"right",transform:`scaleX(${t})`}):this._setTrackActiveStyles({left:`${e.translateX}px`,right:"auto",transformOrigin:"left",transform:`scaleX(${t})`})}_updateTrackUINonRange(i){this._isRtl?this._setTrackActiveStyles({left:"auto",right:"0px",transformOrigin:"right",transform:`scaleX(${1-i.fillPercentage})`}):this._setTrackActiveStyles({left:"0px",right:"auto",transformOrigin:"left",transform:`scaleX(${i.fillPercentage})`})}_updateTickMarkUI(){if(!this.showTickMarks||this.step===void 0||this.min===void 0||this.max===void 0)return;let i=this.step>0?this.step:1;this._isRange?this._updateTickMarkUIRange(i):this._updateTickMarkUINonRange(i)}_updateTickMarkUINonRange(i){let e=this._getValue(),t=Math.max(Math.round((e-this.min)/i),0)+1,o=Math.max(Math.round((this.max-e)/i),0)-1;this._isRtl?t++:o++,this._tickMarks=Array(t).fill(ex.ACTIVE).concat(Array(o).fill(ex.INACTIVE))}_updateTickMarkUIRange(i){let e=this._getValue(),t=this._getValue(Qn.START),o=Math.max(Math.round((t-this.min)/i),0),a=Math.max(Math.round((e-t)/i)+1,0),l=Math.max(Math.round((this.max-e)/i),0);this._tickMarks=Array(o).fill(ex.INACTIVE).concat(Array(a).fill(ex.ACTIVE),Array(l).fill(ex.INACTIVE))}_getInput(i){if(i===Qn.END&&this._input)return this._input;if(this._inputs?.length)return i===Qn.START?this._inputs.first:this._inputs.last}_getThumb(i){return i===Qn.END?this._thumbs?.last:this._thumbs?.first}_setTransition(i){this._hasAnimation=!this._platform.IOS&&i&&!this._noopAnimations,this._elementRef.nativeElement.classList.toggle("mat-mdc-slider-with-animation",this._hasAnimation)}_isCursorOnSliderThumb(i,e){let t=e.width/2,o=e.x+t,a=e.y+t,l=i.clientX-o,s=i.clientY-a;return Math.pow(l,2)+Math.pow(s,2)<Math.pow(t,2)}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=O({type:n,selectors:[["mat-slider"]],contentQueries:function(e,t,o){if(e&1&&(Ql(o,Dxe,5),Ql(o,C_n,4)),e&2){let a;ot(a=at())&&(t._input=a.first),ot(a=at())&&(t._inputs=a)}},viewQuery:function(e,t){if(e&1&&(dt(g_n,5),dt(Oxe,5)),e&2){let o;ot(o=at())&&(t._trackActive=o.first),ot(o=at())&&(t._thumbs=o)}},hostAttrs:[1,"mat-mdc-slider","mdc-slider"],hostVars:12,hostBindings:function(e,t){e&2&&(Xr("mat-"+(t.color||"primary")),ve("mdc-slider--range",t._isRange)("mdc-slider--disabled",t.disabled)("mdc-slider--discrete",t.discrete)("mdc-slider--tick-marks",t.showTickMarks)("_mat-animation-noopable",t._noopAnimations))},inputs:{disabled:[2,"disabled","disabled",wi],discrete:[2,"discrete","discrete",wi],showTickMarks:[2,"showTickMarks","showTickMarks",wi],min:[2,"min","min",Zc],color:"color",disableRipple:[2,"disableRipple","disableRipple",wi],max:[2,"max","max",Zc],step:[2,"step","step",Zc],displayWith:"displayWith"},exportAs:["matSlider"],features:[j([{provide:uK,useExisting:n}])],ngContentSelectors:v_n,decls:9,vars:5,consts:[["trackActive",""],["tickMarkContainer",""],[1,"mdc-slider__track"],[1,"mdc-slider__track--inactive"],[1,"mdc-slider__track--active"],[1,"mdc-slider__track--active_fill"],[1,"mdc-slider__tick-marks"],[3,"discrete","thumbPosition","valueIndicatorText"],[3,"class","transform"]],template:function(e,t){e&1&&(Wt(),jt(0),_(1,"div",2),D(2,"div",3),_(3,"div",4),D(4,"div",5,0),y(),ie(6,h_n,3,1,"div",6),y(),ie(7,f_n,1,3,"mat-slider-visual-thumb",7),D(8,"mat-slider-visual-thumb",7)),e&2&&(m(6),re(t.showTickMarks?6:-1),m(),re(t._isRange?7:-1),m(),g("discrete",t.discrete)("thumbPosition",2)("valueIndicatorText",t.endValueIndicatorText))},dependencies:[__n],styles:[`.mdc-slider__track{position:absolute;top:50%;transform:translateY(-50%);width:100%;pointer-events:none;height:var(--mat-slider-inactive-track-height, 4px)}.mdc-slider__track--active,.mdc-slider__track--inactive{display:flex;height:100%;position:absolute;width:100%}.mdc-slider__track--active{overflow:hidden;border-radius:var(--mat-slider-active-track-shape, var(--mat-sys-corner-full));height:var(--mat-slider-active-track-height, 4px);top:calc((var(--mat-slider-inactive-track-height, 4px) - var(--mat-slider-active-track-height, 4px))/2)}.mdc-slider__track--active_fill{border-top-style:solid;box-sizing:border-box;height:100%;width:100%;position:relative;transform-origin:left;transition:transform 80ms ease;border-color:var(--mat-slider-active-track-color, var(--mat-sys-primary));border-top-width:var(--mat-slider-active-track-height, 4px)}.mdc-slider--disabled .mdc-slider__track--active_fill{border-color:var(--mat-slider-disabled-active-track-color, var(--mat-sys-on-surface))}[dir=rtl] .mdc-slider__track--active_fill{-webkit-transform-origin:right;transform-origin:right}.mdc-slider__track--inactive{left:0;top:0;opacity:.24;background-color:var(--mat-slider-inactive-track-color, var(--mat-sys-surface-variant));height:var(--mat-slider-inactive-track-height, 4px);border-radius:var(--mat-slider-inactive-track-shape, var(--mat-sys-corner-full))}.mdc-slider--disabled .mdc-slider__track--inactive{background-color:var(--mat-slider-disabled-inactive-track-color, var(--mat-sys-on-surface));opacity:.24}.mdc-slider__track--inactive::before{position:absolute;box-sizing:border-box;width:100%;height:100%;top:0;left:0;border:1px solid rgba(0,0,0,0);border-radius:inherit;content:"";pointer-events:none}@media(forced-colors: active){.mdc-slider__track--inactive::before{border-color:CanvasText}}.mdc-slider__value-indicator-container{bottom:44px;left:50%;pointer-events:none;position:absolute;transform:var(--mat-slider-value-indicator-container-transform, translateX(-50%) rotate(-45deg))}.mdc-slider__thumb--with-indicator .mdc-slider__value-indicator-container{pointer-events:auto}.mdc-slider__value-indicator{display:flex;align-items:center;transform:scale(0);transform-origin:var(--mat-slider-value-indicator-transform-origin, 0 28px);transition:transform 100ms cubic-bezier(0.4, 0, 1, 1);word-break:normal;background-color:var(--mat-slider-label-container-color, var(--mat-sys-primary));color:var(--mat-slider-label-label-text-color, var(--mat-sys-on-primary));width:var(--mat-slider-value-indicator-width, 28px);height:var(--mat-slider-value-indicator-height, 28px);padding:var(--mat-slider-value-indicator-padding, 0);opacity:var(--mat-slider-value-indicator-opacity, 1);border-radius:var(--mat-slider-value-indicator-border-radius, 50% 50% 50% 0)}.mdc-slider__thumb--with-indicator .mdc-slider__value-indicator{transition:transform 100ms cubic-bezier(0, 0, 0.2, 1);transform:scale(1)}.mdc-slider__value-indicator::before{border-left:6px solid rgba(0,0,0,0);border-right:6px solid rgba(0,0,0,0);border-top:6px solid;bottom:-5px;content:"";height:0;left:50%;position:absolute;transform:translateX(-50%);width:0;display:var(--mat-slider-value-indicator-caret-display, none);border-top-color:var(--mat-slider-label-container-color, var(--mat-sys-primary))}.mdc-slider__value-indicator::after{position:absolute;box-sizing:border-box;width:100%;height:100%;top:0;left:0;border:1px solid rgba(0,0,0,0);border-radius:inherit;content:"";pointer-events:none}@media(forced-colors: active){.mdc-slider__value-indicator::after{border-color:CanvasText}}.mdc-slider__value-indicator-text{text-align:center;width:var(--mat-slider-value-indicator-width, 28px);transform:var(--mat-slider-value-indicator-text-transform, rotate(45deg));font-family:var(--mat-slider-label-label-text-font, var(--mat-sys-label-medium-font));font-size:var(--mat-slider-label-label-text-size, var(--mat-sys-label-medium-size));font-weight:var(--mat-slider-label-label-text-weight, var(--mat-sys-label-medium-weight));line-height:var(--mat-slider-label-label-text-line-height, var(--mat-sys-label-medium-line-height));letter-spacing:var(--mat-slider-label-label-text-tracking, var(--mat-sys-label-medium-tracking))}.mdc-slider__thumb{-webkit-user-select:none;user-select:none;display:flex;left:-24px;outline:none;position:absolute;height:48px;width:48px;pointer-events:none}.mdc-slider--discrete .mdc-slider__thumb{transition:transform 80ms ease}.mdc-slider--disabled .mdc-slider__thumb{pointer-events:none}.mdc-slider__thumb--top{z-index:1}.mdc-slider__thumb-knob{position:absolute;box-sizing:border-box;left:50%;top:50%;transform:translate(-50%, -50%);border-style:solid;width:var(--mat-slider-handle-width, 20px);height:var(--mat-slider-handle-height, 20px);border-width:calc(var(--mat-slider-handle-height, 20px)/2) calc(var(--mat-slider-handle-width, 20px)/2);box-shadow:var(--mat-slider-handle-elevation, var(--mat-sys-level1));background-color:var(--mat-slider-handle-color, var(--mat-sys-primary));border-color:var(--mat-slider-handle-color, var(--mat-sys-primary));border-radius:var(--mat-slider-handle-shape, var(--mat-sys-corner-full))}.mdc-slider__thumb:hover .mdc-slider__thumb-knob{background-color:var(--mat-slider-hover-handle-color, var(--mat-sys-primary));border-color:var(--mat-slider-hover-handle-color, var(--mat-sys-primary))}.mdc-slider__thumb--focused .mdc-slider__thumb-knob{background-color:var(--mat-slider-focus-handle-color, var(--mat-sys-primary));border-color:var(--mat-slider-focus-handle-color, var(--mat-sys-primary))}.mdc-slider--disabled .mdc-slider__thumb-knob{background-color:var(--mat-slider-disabled-handle-color, var(--mat-sys-on-surface));border-color:var(--mat-slider-disabled-handle-color, var(--mat-sys-on-surface))}.mdc-slider__thumb--top .mdc-slider__thumb-knob,.mdc-slider__thumb--top.mdc-slider__thumb:hover .mdc-slider__thumb-knob,.mdc-slider__thumb--top.mdc-slider__thumb--focused .mdc-slider__thumb-knob{border:solid 1px #fff;box-sizing:content-box;border-color:var(--mat-slider-with-overlap-handle-outline-color, var(--mat-sys-on-primary));border-width:var(--mat-slider-with-overlap-handle-outline-width, 1px)}.mdc-slider__tick-marks{align-items:center;box-sizing:border-box;display:flex;height:100%;justify-content:space-between;padding:0 1px;position:absolute;width:100%}.mdc-slider__tick-mark--active,.mdc-slider__tick-mark--inactive{width:var(--mat-slider-with-tick-marks-container-size, 2px);height:var(--mat-slider-with-tick-marks-container-size, 2px);border-radius:var(--mat-slider-with-tick-marks-container-shape, var(--mat-sys-corner-full))}.mdc-slider__tick-mark--inactive{opacity:var(--mat-slider-with-tick-marks-inactive-container-opacity, 0.38);background-color:var(--mat-slider-with-tick-marks-inactive-container-color, var(--mat-sys-on-surface-variant))}.mdc-slider--disabled .mdc-slider__tick-mark--inactive{opacity:var(--mat-slider-with-tick-marks-inactive-container-opacity, 0.38);background-color:var(--mat-slider-with-tick-marks-disabled-container-color, var(--mat-sys-on-surface))}.mdc-slider__tick-mark--active{opacity:var(--mat-slider-with-tick-marks-active-container-opacity, 0.38);background-color:var(--mat-slider-with-tick-marks-active-container-color, var(--mat-sys-on-primary))}.mdc-slider__input{cursor:pointer;left:2px;margin:0;height:44px;opacity:0;position:absolute;top:2px;width:44px;box-sizing:content-box}.mdc-slider__input.mat-mdc-slider-input-no-pointer-events{pointer-events:none}.mdc-slider__input.mat-slider__right-input{left:auto;right:0}.mat-mdc-slider{display:inline-block;box-sizing:border-box;outline:none;vertical-align:middle;cursor:pointer;height:48px;margin:0 8px;position:relative;touch-action:pan-y;width:auto;min-width:112px;-webkit-tap-highlight-color:rgba(0,0,0,0)}.mat-mdc-slider.mdc-slider--disabled{cursor:auto;opacity:.38}.mat-mdc-slider.mdc-slider--disabled .mdc-slider__input{cursor:auto}.mat-mdc-slider .mdc-slider__thumb,.mat-mdc-slider .mdc-slider__track--active_fill{transition-duration:0ms}.mat-mdc-slider.mat-mdc-slider-with-animation .mdc-slider__thumb,.mat-mdc-slider.mat-mdc-slider-with-animation .mdc-slider__track--active_fill{transition-duration:80ms}.mat-mdc-slider.mdc-slider--discrete .mdc-slider__thumb,.mat-mdc-slider.mdc-slider--discrete .mdc-slider__track--active_fill{transition-duration:0ms}.mat-mdc-slider.mat-mdc-slider-with-animation .mdc-slider__thumb,.mat-mdc-slider.mat-mdc-slider-with-animation .mdc-slider__track--active_fill{transition-duration:80ms}.mat-mdc-slider .mat-ripple .mat-ripple-element{background-color:var(--mat-slider-ripple-color, var(--mat-sys-primary))}.mat-mdc-slider .mat-ripple .mat-mdc-slider-hover-ripple{background-color:var(--mat-slider-hover-state-layer-color, color-mix(in srgb, var(--mat-sys-primary) 5%, transparent))}.mat-mdc-slider .mat-ripple .mat-mdc-slider-focus-ripple,.mat-mdc-slider .mat-ripple .mat-mdc-slider-active-ripple{background-color:var(--mat-slider-focus-state-layer-color, color-mix(in srgb, var(--mat-sys-primary) 20%, transparent))}.mat-mdc-slider._mat-animation-noopable.mdc-slider--discrete .mdc-slider__thumb,.mat-mdc-slider._mat-animation-noopable.mdc-slider--discrete .mdc-slider__track--active_fill,.mat-mdc-slider._mat-animation-noopable .mdc-slider__value-indicator{transition:none}.mat-mdc-slider .mat-focus-indicator::before{border-radius:50%}.mdc-slider__thumb--focused .mat-focus-indicator::before{content:""}
|
|
564
564
|
`],encapsulation:2,changeDetection:0})}return n})();var b_n={provide:Fg,useExisting:mo(()=>pK),multi:!0};var pK=(()=>{class n{_ngZone=pe($t);_elementRef=pe(z);_cdr=pe(on);_slider=pe(uK);_platform=pe(Nr);_listenerCleanups;get value(){return Zc(this._hostElement.value,0)}set value(i){i===null&&(i=this._getDefaultValue()),i=isNaN(i)?0:i;let e=i+"";if(!this._hasSetInitialValue){this._initialValue=e;return}this._isActive||this._setValue(e)}_setValue(i){this._hostElement.value=i,this._updateThumbUIByValue(),this._slider._onValueChange(this),this._cdr.detectChanges(),this._slider._cdr.markForCheck()}valueChange=new Fe;dragStart=new Fe;dragEnd=new Fe;get translateX(){return this._slider.min>=this._slider.max?(this._translateX=this._tickMarkOffset,this._translateX):(this._translateX===void 0&&(this._translateX=this._calcTranslateXByValue()),this._translateX)}set translateX(i){this._translateX=i}_translateX;thumbPosition=Qn.END;get min(){return Zc(this._hostElement.min,0)}set min(i){this._hostElement.min=i+"",this._cdr.detectChanges()}get max(){return Zc(this._hostElement.max,0)}set max(i){this._hostElement.max=i+"",this._cdr.detectChanges()}get step(){return Zc(this._hostElement.step,0)}set step(i){this._hostElement.step=i+"",this._cdr.detectChanges()}get disabled(){return wi(this._hostElement.disabled)}set disabled(i){this._hostElement.disabled=i,this._cdr.detectChanges(),this._slider.disabled!==this.disabled&&(this._slider.disabled=this.disabled)}get percentage(){return this._slider.min>=this._slider.max?this._slider._isRtl?1:0:(this.value-this._slider.min)/(this._slider.max-this._slider.min)}get fillPercentage(){return this._slider._cachedWidth?this._translateX===0?0:this.translateX/this._slider._cachedWidth:this._slider._isRtl?1:0}_hostElement=this._elementRef.nativeElement;_valuetext=Oe("");_knobRadius=8;_tickMarkOffset=3;_isActive=!1;_isFocused=!1;_setIsFocused(i){this._isFocused=i}_hasSetInitialValue=!1;_initialValue;_formControl;_destroyed=new nt;_skipUIUpdate=!1;_onChangeFn;_onTouchedFn=()=>{};_isControlInitialized=!1;constructor(){let i=pe(fr);this._ngZone.runOutsideAngular(()=>{this._listenerCleanups=[i.listen(this._hostElement,"pointerdown",this._onPointerDown.bind(this)),i.listen(this._hostElement,"pointermove",this._onPointerMove.bind(this)),i.listen(this._hostElement,"pointerup",this._onPointerUp.bind(this))]})}ngOnDestroy(){this._listenerCleanups.forEach(i=>i()),this._destroyed.next(),this._destroyed.complete(),this.dragStart.complete(),this.dragEnd.complete()}initProps(){this._updateWidthInactive(),this.disabled!==this._slider.disabled&&(this._slider.disabled=!0),this.step=this._slider.step,this.min=this._slider.min,this.max=this._slider.max,this._initValue()}initUI(){this._updateThumbUIByValue()}_initValue(){this._hasSetInitialValue=!0,this._initialValue===void 0?this.value=this._getDefaultValue():(this._hostElement.value=this._initialValue,this._updateThumbUIByValue(),this._slider._onValueChange(this),this._cdr.detectChanges())}_getDefaultValue(){return this.min}_onBlur(){this._setIsFocused(!1),this._onTouchedFn()}_onFocus(){this._slider._setTransition(!1),this._slider._updateTrackUI(this),this._setIsFocused(!0)}_onChange(){this.valueChange.emit(this.value),this._isActive&&this._updateThumbUIByValue({withAnimation:!0})}_onInput(){this._onChangeFn?.(this.value),(this._slider.step||!this._isActive)&&this._updateThumbUIByValue({withAnimation:!0}),this._slider._onValueChange(this)}_onNgControlValueChange(){(!this._isActive||!this._isFocused)&&(this._slider._onValueChange(this),this._updateThumbUIByValue()),this._slider.disabled=this._formControl.disabled}_onPointerDown(i){if(!(this.disabled||i.button!==0)){if(this._platform.IOS){let e=this._slider._isCursorOnSliderThumb(i,this._slider._getThumb(this.thumbPosition)._hostElement.getBoundingClientRect());this._isActive=e,this._updateWidthActive(),this._slider._updateDimensions();return}this._isActive=!0,this._setIsFocused(!0),this._updateWidthActive(),this._slider._updateDimensions(),this._slider.step||this._updateThumbUIByPointerEvent(i,{withAnimation:!0}),this.disabled||(this._handleValueCorrection(i),this.dragStart.emit({source:this,parent:this._slider,value:this.value}))}}_handleValueCorrection(i){this._skipUIUpdate=!0,setTimeout(()=>{this._skipUIUpdate=!1,this._fixValue(i)},0)}_fixValue(i){let e=i.clientX-this._slider._cachedLeft,t=this._slider._cachedWidth,o=this._slider.step===0?1:this._slider.step,a=Math.floor((this._slider.max-this._slider.min)/o),l=this._slider._isRtl?1-e/t:e/t,d=Math.round(l*a)/a*(this._slider.max-this._slider.min)+this._slider.min,v=Math.round(d/o)*o,u=this.value;if(v===u){this._slider._onValueChange(this),this._slider.step>0?this._updateThumbUIByValue():this._updateThumbUIByPointerEvent(i,{withAnimation:this._slider._hasAnimation});return}this.value=v,this.valueChange.emit(this.value),this._onChangeFn?.(this.value),this._slider._onValueChange(this),this._slider.step>0?this._updateThumbUIByValue():this._updateThumbUIByPointerEvent(i,{withAnimation:this._slider._hasAnimation})}_onPointerMove(i){!this._slider.step&&this._isActive&&this._updateThumbUIByPointerEvent(i)}_onPointerUp(){this._isActive&&(this._isActive=!1,this._platform.SAFARI&&this._setIsFocused(!1),this.dragEnd.emit({source:this,parent:this._slider,value:this.value}),setTimeout(()=>this._updateWidthInactive(),this._platform.IOS?10:0))}_clamp(i){let e=this._tickMarkOffset,t=this._slider._cachedWidth-this._tickMarkOffset;return Math.max(Math.min(i,t),e)}_calcTranslateXByValue(){return this._slider._isRtl?(1-this.percentage)*(this._slider._cachedWidth-this._tickMarkOffset*2)+this._tickMarkOffset:this.percentage*(this._slider._cachedWidth-this._tickMarkOffset*2)+this._tickMarkOffset}_calcTranslateXByPointerEvent(i){return i.clientX-this._slider._cachedLeft}_updateWidthActive(){}_updateWidthInactive(){this._hostElement.style.padding=`0 ${this._slider._inputPadding}px`,this._hostElement.style.width=`calc(100% + ${this._slider._inputPadding-this._tickMarkOffset*2}px)`,this._hostElement.style.left=`-${this._slider._rippleRadius-this._tickMarkOffset}px`}_updateThumbUIByValue(i){this.translateX=this._clamp(this._calcTranslateXByValue()),this._updateThumbUI(i)}_updateThumbUIByPointerEvent(i,e){this.translateX=this._clamp(this._calcTranslateXByPointerEvent(i)),this._updateThumbUI(e)}_updateThumbUI(i){this._slider._setTransition(!!i?.withAnimation),this._slider._onTranslateXChange(this)}writeValue(i){(this._isControlInitialized||i!==null)&&(this.value=i)}registerOnChange(i){this._onChangeFn=i,this._isControlInitialized=!0}registerOnTouched(i){this._onTouchedFn=i}setDisabledState(i){this.disabled=i}focus(){this._hostElement.focus()}blur(){this._hostElement.blur()}static \u0275fac=function(e){return new(e||n)};static \u0275dir=Kt({type:n,selectors:[["input","matSliderThumb",""]],hostAttrs:["type","range",1,"mdc-slider__input"],hostVars:1,hostBindings:function(e,t){e&1&&G("change",function(){return t._onChange()})("input",function(){return t._onInput()})("blur",function(){return t._onBlur()})("focus",function(){return t._onFocus()}),e&2&&T("aria-valuetext",t._valuetext())},inputs:{value:[2,"value","value",Zc]},outputs:{valueChange:"valueChange",dragStart:"dragStart",dragEnd:"dragEnd"},exportAs:["matSliderThumb"],features:[j([b_n,{provide:Dxe,useExisting:n}])]})}return n})();var Pxe=(()=>{class n{static \u0275fac=function(e){return new(e||n)};static \u0275mod=Sn({type:n});static \u0275inj=fn({imports:[ro,c1]})}return n})();var y_n=["*"],hK=(()=>{let r=class r extends Ct{constructor(e,t,o,a){super(o,a),this.loggingService=e,this.customFilterService=t,this.elementRef=o,this.themeService=a,this.headingMode=!1,this.changeStatus=new Fe,this.componentId="velt-unresolve-button"}ngOnInit(){try{this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in UnresolveButtonComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in UnresolveButtonComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{x_n(this.elementRef.nativeElement,this.componentId)}catch(e){this.loggingService.catch("Error in UnresolveButtonComponent setupA11yAttributes: ",e)}}unresolveComment(e){this.loggingService.log("%c[WB] Calling FUNCTION: unresolveComment","color: green;");try{if(!this.annotation)return;this.changeStatus.emit({status:this.customFilterService.defaultStatus,statusOptionType:e})}catch(t){this.catchError("Error in UnresolveButtonComponent unresolveComment: ",t)}}catchError(e,t,o){try{this.loggingService.catch(e,t,E(b({},o||{}),{annotationId:this.annotation?.annotationId}))}catch{}}};r.\u0275fac=function(t){return new(t||r)(C(x),C(nr),C(z),C(mt))},r.\u0275cmp=O({type:r,selectors:[["app-unresolve-button"]],inputs:{annotation:"annotation",sidebarMode:"sidebarMode",headingMode:"headingMode",zIndex:"zIndex"},outputs:{changeStatus:"changeStatus"},standalone:!1,features:[L],ngContentSelectors:y_n,decls:3,vars:9,consts:[["type","unresolve",3,"clicked","tooltip","darkMode","colorMode","zIndex"]],template:function(t,o){t&1&&(Wt(),_(0,"app-tooltip-button",0),M(1,"translate"),G("clicked",function(){return o.unresolveComment("button")}),jt(2),y()),t&2&&(ct("color",(o.annotation==null||o.annotation.status==null?null:o.annotation.status.color)+" !important"),g("tooltip",R(1,7,"Unresolve"))("darkMode",o.darkMode)("colorMode",o.headingMode)("zIndex",o.zIndex||1e3),T("data-testid",o.componentId+"-tooltip-button"))},dependencies:[Md,ue],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}"]});let n=r;return n})();function x_n(n,r){try{n.setAttribute("role","button"),n.setAttribute("aria-label","Unresolve comment"),n.setAttribute("data-testid",r+"-container")}catch{}}var Mxe=(()=>{let r=class r{constructor(e){this.loggingService=e,this.commentTextData$=new be({});try{this.loggingService.log("%c[WB] Creating CLASS: CommentTextService","color: blue;")}catch(t){this.loggingService.catch("Error in CommentTextService constructor: ",t)}}setCommentTextData(e){try{this.loggingService.log("%c[WB] Calling CommentTextService FUNCTION: setCommentTextData","color: green;");let t=e.annotationId||e.multiThreadAnnotationId;if(t){let o=e.componentId,a=this.commentTextData$.getValue();a[t]||(a[t]={}),a[t][o]=e,this.commentTextData$.next(a),this.updateLastPositionInDataByAnnotationId(t)}}catch(t){this.loggingService.catch("Error in CommentTextService setCommentTextData: ",t)}}removeCommentTextData(e){try{this.loggingService.log("%c[WB] Calling CommentTextService FUNCTION: removeCommentTextData","color: green;");let t=e.annotationId||e.multiThreadAnnotationId;if(t){let o=e.componentId,a=this.commentTextData$.getValue();delete a[t][o],this.commentTextData$.next(a),this.updateLastPositionInDataByAnnotationId(t)}}catch(t){this.loggingService.catch("Error in CommentTextService removeCommentTextData: ",t)}}updateLastPositionInDataByAnnotationId(e){try{this.loggingService.log("%c[WB] Calling CommentTextService FUNCTION: updateLastPositionInDataByAnnotationId","color: green;");let t=this.commentTextData$.getValue();Object.values(t[e]).forEach(o=>{o.last=this.checkIfLast(o)}),this.commentTextData$.next(t)}catch(t){this.loggingService.catch("Error in CommentTextService updateLastPositionInDataByAnnotationId: ",t)}}checkIfLast(e){try{if(this.loggingService.log("%c[WB] Calling CommentTextService FUNCTION: checkIfLast","color: green;"),e?.elementRef?.nativeElement){let t=[];if(e.annotationId?t=Array.from(document.querySelectorAll(`${V.TAGS.VELT_COMMENT_TEXT}[${V.ATTRIBUTES.ANNOTATION_ID}="${e.annotationId}"]`)):e.multiThreadAnnotationId&&(t=Array.from(document.querySelectorAll(`${V.TAGS.VELT_COMMENT_TEXT}[${V.ATTRIBUTES.MULTI_THREAD_ANNOTATION_ID}="${e.multiThreadAnnotationId}"]`))),t.length&&t[t.length-1]===e.elementRef.nativeElement)return!0}return!1}catch(t){return this.loggingService.catch("Error in CommentTextService checkIfLast: ",t),!1}}getCommentTextDataByAnnotationIdAndComponentId(e,t){try{return this.loggingService.log("%c[WB] Calling CommentTextService FUNCTION: getCommentTextDataByAnnotationIdAndComponentId","color: green;"),this.commentTextData$.pipe(ge(o=>o&&e&&t&&o[e]?o[e][t]:null))}catch(o){return this.loggingService.catch("Error in CommentTextService getCommentTextDataByAnnotationIdAndComponentId: ",o),ce(null)}}};r.\u0275fac=function(t){return new(t||r)(J(x))},r.\u0275prov=Ne({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var E_n=["overlay"],k_n=["*"],T_n=()=>["snippyly-overlay-panel","velt-overlay-panel"];function w_n(n,r){if(n&1){let i=K();h(0),_(1,"velt-multi-thread-comment-dialog-internal",6),M(2,"translate"),G("updateOverlayPosition",function(){N(i);let t=c(4);return F(t.updateOverlayPosition())})("saveComment",function(t){N(i);let o=c(4);return F(o.saveComment(t))}),y(),f()}if(n&2){let i=c(3).ngIf,e=c();m(),g("multiThreadAnnotationId",i.commentPinAnnotation.annotationId)("annotation",i.commentPinAnnotation)("user",i.user)("commentPinSelected",!0),T("data-testid",e.componentTestId+"-multi-thread-dialog")("role","dialog")("aria-label",R(2,7,"Multi-thread comment dialog"))}}function D_n(n,r){if(n&1){let i=K();_(0,"velt-comment-dialog-internal",7),M(1,"translate"),G("updateOverlayPosition",function(){N(i);let t=c(4);return F(t.updateOverlayPosition())})("saveComment",function(t){N(i);let o=c(4);return F(o.saveComment(t))}),y()}if(n&2){let i=c(3).ngIf,e=c();g("annotation",i.commentPinAnnotation)("user",i.user)("commentPinSelected",i.commentPinSelected),T("data-testid",e.componentTestId+"-comment-dialog")("role","dialog")("aria-label",R(1,6,"Comment dialog"))}}function O_n(n,r){if(n&1&&p(0,w_n,3,9,"ng-container",5)(1,D_n,2,8,"ng-template",null,1,Me),n&2){let i=Ce(2),e=c(2).ngIf;g("ngIf",(e==null||e.commentPinAnnotation==null?null:e.commentPinAnnotation.type)==="multiThread")("ngIfElse",i)}}function A_n(n,r){if(n&1&&p(0,O_n,3,2,"ng-template",4,0,Me),n&2){let i=c().ngIf,e=c();g("cdkConnectedOverlayOrigin",e.origin)("cdkConnectedOverlayOpen",(!i.mobileMode||!i.isPhone)&&!i.inboxMode&&!i.streamMode&&(!i.inlineCommentMode||i.isInsidePdfViewer)&&i.floatingCommentsEnabled&&(i.last&&i.commentPinSelected||i.commentPinHover&&!i.commentPinSelected))("cdkConnectedOverlayPanelClass",yt(7,T_n))("cdkConnectedOverlayBackdropClass","snippyly-overlay-backdrop")("cdkConnectedOverlayLockPosition",!1)("cdkConnectedOverlayGrowAfterOpen",!0)("cdkConnectedOverlayDisableClose",!0)}}function P_n(n,r){if(n&1&&(h(0),jt(1),p(2,A_n,2,8,"ng-template",3),f()),n&2){let i=c();m(2),g("ngIf",i.origin)}}var Rxe=(()=>{let r=class r{onPointerOverListener(e){try{this.onPointerOver(e),e.stopPropagation()}catch(t){this.catchError("Error in VeltCommentTextComponent onPointerOverListener: ",t)}}onPointerOutListener(e){try{this.onPointerOut(),e.stopPropagation()}catch(t){this.catchError("Error in VeltCommentTextComponent onPointerOutListener: ",t)}}onPointerDownListener(e){try{e.stopPropagation()}catch(t){this.catchError("Error in VeltCommentTextComponent onPointerDownListener: ",t)}}onPointerUpListener(e){try{this.togglePinSelection(),e.stopPropagation()}catch(t){this.catchError("Error in VeltCommentTextComponent onPointerUpListener: ",t)}}constructor(e,t,o,a,l,s,d){this.authService=e,this.commentService=t,this.commentTextService=o,this.domService=a,this.loggingService=l,this.elementRef=s,this.cd=d,this.resolvedCommentsOnDom=!1,this.componentConfigSignal=Oe({commentPinAnnotation:void 0,user:null,selectedAnnotationsMap:{},commentPinHover:!1,commentPinSelected:!1,isPhone:!1,mobileMode:!1,streamMode:!1,inboxMode:!1,textClicked:!1,floatingCommentsEnabled:!0,sidebarVisible:!1,inlineCommentMode:!1,isInsidePdfViewer:!1,first:!1,last:!1}),this.selectedAnnotationsMap={},this.isDialogOnHoverEnabled=!1,this.subscriptions=[],this.componentId=St(),this.commentAvailable=!1,this.commentSelected=!1,this.componentTestId="velt-comment-text";try{this.loggingService.log("%c[WB] Creating Class: VeltCommentTextComponent","color: blue;"),this.origin=new cn(this.elementRef),this.subscriptions.push(this.authService.getUser$().subscribe(v=>{this.componentConfigSignal.update(u=>(u=E(b({},u),{user:v}),u))},v=>{this.catchError("Error in VeltCommentTextComponent getUser$ subscription: ",v)})),this.subscriptions.push(this.domService.getSelectedAnnotationsMap$().subscribe(v=>{this.selectedAnnotationsMap=v,this.componentConfigSignal.update(u=>(u=E(b({},u),{selectedAnnotationsMap:v}),u)),this.checkPinSelection()},v=>{this.catchError("Error in VeltCommentTextComponent getSelectedAnnotationsMap$ subscription: ",v)})),this.subscriptions.push(this.commentService.getEnableDialogOnHover$().subscribe(v=>{this.isDialogOnHoverEnabled=v},v=>{this.catchError("Error in CommentPinComponent getEnableDialogOnHover subscription: ",v)})),this.subscriptions.push(this.commentService.onCommentAnnotationDelete$().subscribe(v=>{v?.annotationId&&this.componentConfigSignal().commentPinAnnotation?.annotationId&&v.annotationId===this.componentConfigSignal().commentPinAnnotation?.annotationId&&this.removeThisComponent()},v=>{this.catchError("Error in VeltCommentTextComponent onCommentAnnotationDelete$ subscription: ",v)})),this.subscriptions.push(this.commentService.onMultiThreadCommentAnnotationDelete$().subscribe(v=>{v?.annotationId&&this.componentConfigSignal().commentPinAnnotation?.annotationId&&v.annotationId===this.componentConfigSignal().commentPinAnnotation?.annotationId&&this.removeThisComponent()},v=>{this.catchError("Error in VeltCommentTextComponent onMultiThreadCommentAnnotationDelete$ subscription: ",v)})),this.subscriptions.push(this.commentService.updateCommentDialogPositionTrigger$().subscribe(()=>{try{!!(this.componentConfigSignal().selectedAnnotationsMap&&this.componentConfigSignal().commentPinAnnotation?.annotationId&&this.componentConfigSignal().selectedAnnotationsMap[this.componentConfigSignal().commentPinAnnotation.annotationId])&&this.updateOverlayPosition()}catch(v){this.catchError("Error in VeltCommentTextComponent updateCommentDialogPositionTrigger$: ",v)}},v=>{this.catchError("Error in VeltCommentTextComponent updateCommentDialogPositionTrigger$ subscription: ",v)}))}catch(v){this.catchError("Error in VeltCommentTextComponent constructor: ",v)}}ngOnInit(){this.setupA11yAttributes()}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentTestId)}catch(e){this.loggingService.catch("Error in VeltCommentTextComponent setupA11yAttributes:",e)}}togglePinSelection(e){try{if(this.componentConfigSignal().textClicked&&!e)return;let t=e||this.componentConfigSignal().commentPinAnnotation;if(t)if(this.selectedAnnotationsMap[t.annotationId])e||(document.querySelector(`[${V.ATTRIBUTES.VELT_ANNOTATION_DRAFT}="${t?.annotationId}"]`)?this.domService.resetSelectedAnnotationsMap(!0,"comments"):(this.componentConfigSignal.update(a=>(a=E(b({},a),{textClicked:!0}),a)),this.domService.toggleAnnotationSelection(t)));else{let o=document.querySelector(`[${V.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);if(o||(o=(this.domService.getDraftCommentAnnotationDialogs()||[])[0]),o){let a=o.getAttribute(V.ATTRIBUTES.VELT_ANNOTATION_DRAFT);if(a){let l=document.getElementById(`comment-pin-container-${a}`)||document.querySelector(`[data-velt-id='${a}']`);l&&(l.scrollIntoView({behavior:"auto",block:"center",inline:"center"}),this.domService.resetSelectedAnnotationsMap(!0,"comments"))}}else this.domService.resetSelectedAnnotationsMap(!0,"comments"),this.componentConfigSignal.update(a=>(a=E(b({},a),{textClicked:!0}),a)),this.domService.toggleAnnotationSelection(t)}}catch(t){this.catchError("Error in VeltCommentTextComponent togglePinSelection: ",t)}}ngAfterViewInit(){try{this.commentTextData={annotationId:this.annotationId,multiThreadAnnotationId:this.multiThreadAnnotationId,componentId:this.componentId,elementRef:this.elementRef,last:!1},this.commentTextService.setCommentTextData(this.commentTextData),this.subscriptions.push(this.commentTextService.getCommentTextDataByAnnotationIdAndComponentId(this.annotationId||this.multiThreadAnnotationId,this.componentId).subscribe(e=>{this.componentConfigSignal.update(t=>(t=E(b({},t),{last:e?.last||!1}),t)),this.checkPinSelection()},e=>{this.catchError("Error in VeltCommentTextComponent getCommentTextDataByAnnotationIdAndComponentId subscription: ",e)}))}catch(e){this.catchError("Error in VeltCommentTextComponent ngAfterViewInit: ",e)}}ngOnChanges(e){try{this.loggingService.log("%c[WB] Calling VeltCommentTextComponent FUNCTION: ngOnChanges","color: green;"),e?.annotationId&&this.annotationId&&this.getCommentAnnotationByAnnotationId(this.annotationId),e?.multiThreadAnnotationId&&this.multiThreadAnnotationId&&this.getMultiThreadCommentAnnotationByAnnotationId(this.multiThreadAnnotationId)}catch(t){this.catchError("Error in VeltCommentTextComponent ngOnChanges: ",t)}}getCommentAnnotationByAnnotationId(e){try{this.loggingService.log("%c[WB] Calling VeltCommentTextComponent FUNCTION: getCommentAnnotationByAnnotationId","color: green;"),this.commentAnnotationByAnnotationIdSubscription&&(this.commentAnnotationByAnnotationIdSubscription.unsubscribe(),this.commentAnnotationByAnnotationIdSubscription=void 0),this.commentAnnotationByAnnotationIdSubscription=this.commentService.getCommentAnnotationByAnnotationId(e).pipe(fe(t=>this.commentService.getResolvedCommentsOnDom$().pipe(ge(o=>(this.resolvedCommentsOnDom=o,t)))),fe(t=>this.domService.getSelectedAnnotationsMap$().pipe(ge(o=>({commentPinAnnotation:t,selectedAnnotationsMap:o||{}}))))).subscribe(t=>{let o;t?.commentPinAnnotation&&(this.resolvedCommentsOnDom||this.commentService.getFilterCommentsOnDom()&&this.commentService.getCommentsFromSidebarMap()||t?.commentPinAnnotation?.status?.type!=="terminal"||t?.selectedAnnotationsMap[t.commentPinAnnotation.annotationId])&&(o=t.commentPinAnnotation),this.componentConfigSignal.update(l=>(l=E(b({},l),{commentPinAnnotation:o}),l));let a=!!o;this.commentAvailable!==a&&(this.commentAvailable=a,this.cd.markForCheck()),this.checkPinSelection()})}catch(t){this.catchError("Error in VeltCommentTextComponent getCommentAnnotationByAnnotationId: ",t)}}getMultiThreadCommentAnnotationByAnnotationId(e){try{this.loggingService.log("%c[WB] Calling VeltCommentTextComponent FUNCTION: getMultiThreadCommentAnnotationByAnnotationId","color: green;"),this.multiThreadCommentAnnotationByAnnotationIdSubscription&&(this.multiThreadCommentAnnotationByAnnotationIdSubscription.unsubscribe(),this.multiThreadCommentAnnotationByAnnotationIdSubscription=void 0),this.multiThreadCommentAnnotationByAnnotationIdSubscription=this.commentService.getMultiThreadCommentAnnotationByAnnotationId(e).subscribe(t=>{this.componentConfigSignal.update(a=>(a=E(b({},a),{commentPinAnnotation:t}),a));let o=!!t;this.commentAvailable!==o&&(this.commentAvailable=o,this.cd.markForCheck()),this.checkPinSelection()})}catch(t){this.catchError("Error in VeltCommentTextComponent getMultiThreadCommentAnnotationByAnnotationId: ",t)}}unsubscribe(){try{this.loggingService.log("%c[WB] Calling VeltCommentTextComponent FUNCTION: unsubscribe","color: green;"),this.commentAnnotationByAnnotationIdSubscription&&(this.commentAnnotationByAnnotationIdSubscription.unsubscribe(),this.commentAnnotationByAnnotationIdSubscription=void 0),this.multiThreadCommentAnnotationByAnnotationIdSubscription&&(this.multiThreadCommentAnnotationByAnnotationIdSubscription.unsubscribe(),this.multiThreadCommentAnnotationByAnnotationIdSubscription=void 0),this.subscriptions.forEach(e=>{e.unsubscribe()})}catch(e){this.catchError("Error in VeltCommentTextComponent unsubscribe: ",e)}}checkPinSelection(){try{this.selectedAnnotationsMap[this.componentConfigSignal().commentPinAnnotation?.annotationId]?this.componentConfigSignal.update(e=>(e=E(b({},e),{commentPinSelected:!0}),e?.commentPinAnnotation?.isDraft&&(e.textClicked=!!e.last),e)):this.componentConfigSignal.update(e=>(e=E(b({},e),{commentPinSelected:!1,textClicked:!1}),e)),sessionStorage.getItem(V.SESSION_STORAGE.SNIPPYLY_AUTO_SELECT_ANNOTATION_ID)===this.componentConfigSignal().commentPinAnnotation?.annotationId&&this.componentConfigSignal().last&&(this.componentConfigSignal.update(e=>(e=E(b({},e),{textClicked:!0}),e)),sessionStorage.removeItem(V.SESSION_STORAGE.SNIPPYLY_AUTO_SELECT_ANNOTATION_ID)),this.componentConfigSignal().commentPinSelected!==this.commentSelected&&(this.commentSelected=this.componentConfigSignal().commentPinSelected,this.cd.markForCheck())}catch(e){this.catchError("Error in VeltCommentTextComponent checkPinSelection: ",e)}}onPointerOver(e){try{if(this.componentConfigSignal().commentPinHover)return;e.buttons?this.componentConfigSignal().commentPinHover&&this.componentConfigSignal.update(t=>(t=E(b({},t),{commentPinHover:!1}),t)):!this.componentConfigSignal().commentPinHover&&this.isDialogOnHoverEnabled&&this.componentConfigSignal.update(t=>(t=E(b({},t),{commentPinHover:!0}),t))}catch(t){this.catchError("Error in VeltCommentTextComponent onPointerOver: ",t)}}onPointerOut(){this.componentConfigSignal.update(e=>(e=E(b({},e),{commentPinHover:!1}),e))}updateOverlayPosition(){try{this.loggingService.log("updateOverlayPosition",this.componentConfigSignal().commentPinAnnotation?.annotationId),this.commentDialogOverlay&&this.commentDialogOverlay?.overlayRef?.updatePosition()}catch{}}removeThisComponent(){try{this.loggingService.log("%c[WB] Calling VeltCommentTextComponent FUNCTION: removeThisComponent","color: green;"),this.clearRemoveThisComponentTimeout();try{if(this.elementRef.nativeElement?.closest(`[${V.ATTRIBUTES.SLATE_EDITOR}]`))return}catch(e){this.catchError("Error in VeltCommentTextComponent removeThisComponent: ",e)}this.removeThisComponentTimeout=setTimeout(()=>{if(this.elementRef.nativeElement?.isConnected){let e=this.elementRef.nativeElement.parentElement,t=this.elementRef.nativeElement.childNodes,o=document.createDocumentFragment();for(let a=0;a<t.length;a++){let l=t[a];l?.nodeType!==Node.COMMENT_NODE&&o.appendChild(l)}e.insertBefore(o,this.elementRef.nativeElement),e.removeChild(this.elementRef.nativeElement),e.normalize()}},500)}catch(e){this.catchError("Error in VeltCommentTextComponent removeThisComponent: ",e)}}clearRemoveThisComponentTimeout(){try{this.removeThisComponentTimeout&&(clearTimeout(this.removeThisComponentTimeout),this.removeThisComponentTimeout=void 0)}catch(e){this.catchError("Error in VeltCommentTextComponent clearRemoveThisComponentTimeout: ",e)}}ngOnDestroy(){try{this.loggingService.log("%c[WB] Calling VeltCommentTextComponent FUNCTION: ngOnDestroy","color: green;"),this.clearRemoveThisComponentTimeout(),this.unsubscribe(),this.commentTextData&&this.commentTextService.removeCommentTextData(this.commentTextData)}catch(e){this.catchError("Error in VeltCommentTextComponent ngOnDestroy: ",e)}}saveComment(e){try{this.loggingService.log("%c[WB] Calling VeltCommentTextComponent FUNCTION: saveComment","color: green;"),this.commentService.saveComment(this.componentConfigSignal().commentPinAnnotation,e)}catch(t){this.catchError("Error in VeltCommentTextComponent saveComment: ",t)}}catchError(e,t,o){try{this.loggingService.catch(e,t,E(b({},o||{}),{annotationId:this.componentConfigSignal()?.commentPinAnnotation?.annotationId}))}catch{}}};r.\u0275fac=function(t){return new(t||r)(C(Ge),C(Pe),C(Mxe),C(Ve),C(x),C(z),C(on))},r.\u0275cmp=O({type:r,selectors:[["velt-comment-text-internal"]],viewQuery:function(t,o){if(t&1&&dt(E_n,5),t&2){let a;ot(a=at())&&(o.commentDialogOverlay=a.first)}},hostVars:2,hostBindings:function(t,o){t&1&&G("pointerover",function(l){return o.onPointerOverListener(l)})("pointerout",function(l){return o.onPointerOutListener(l)})("pointerdown",function(l){return o.onPointerDownListener(l)})("pointerup",function(l){return o.onPointerUpListener(l)}),t&2&&T("comment-available",o.commentAvailable)("comment-selected",o.commentSelected)},inputs:{annotationId:"annotationId",multiThreadAnnotationId:"multiThreadAnnotationId"},standalone:!1,features:[it],ngContentSelectors:k_n,decls:1,vars:1,consts:[["overlay","cdkConnectedOverlay"],["commentDialogRef",""],[4,"ngIf"],[3,"ngIf"],["cdkConnectedOverlay","",3,"cdkConnectedOverlayOrigin","cdkConnectedOverlayOpen","cdkConnectedOverlayPanelClass","cdkConnectedOverlayBackdropClass","cdkConnectedOverlayLockPosition","cdkConnectedOverlayGrowAfterOpen","cdkConnectedOverlayDisableClose"],[4,"ngIf","ngIfElse"],[3,"updateOverlayPosition","saveComment","multiThreadAnnotationId","annotation","user","commentPinSelected"],[3,"updateOverlayPosition","saveComment","annotation","user","commentPinSelected"]],template:function(t,o){t&1&&(Wt(),p(0,P_n,3,1,"ng-container",2)),t&2&&g("ngIf",o.componentConfigSignal())},dependencies:[se,mn,ql,so,ue],encapsulation:2,changeDetection:0});let n=r;return n})();var Nxe=(()=>{let r=class r{transform(e,t=!0){try{if(!t)return e;if(!e)return"";if(e.includes("@"))return e.split("@")[0];let o=e.trim().split(" ");if(o.length<=1)return e;let l=o.pop()?.[0].toUpperCase();return`${o.join(" ")} ${l}.`}catch{return e}}};r.\u0275fac=function(t){return new(t||r)},r.\u0275pipe=or({name:"shortUserName",type:r,pure:!0,standalone:!1});let n=r;return n})();var Fxe=(()=>{let r=class r{constructor(e){this.domService=e}transform(e){try{return this.domService.sanitizeHtml(e)}catch{return e}}};r.\u0275fac=function(t){return new(t||r)(C(Ve,16))},r.\u0275pipe=or({name:"sanitizeHtml",type:r,pure:!0,standalone:!1});let n=r;return n})();var Lxe=(()=>{let r=class r{transform(e,t,o){try{return!e||!t||e.length===0?e:e.sort((l,s)=>{let d=l[t],v=s[t];return d<v?o==="asc"?-1:1:d>v?o==="asc"?1:-1:0})}catch{return e}}};r.\u0275fac=function(t){return new(t||r)},r.\u0275pipe=or({name:"orderBy",type:r,pure:!0,standalone:!1});let n=r;return n})();var Uxe=(()=>{let r=class r{transform(e,t){try{return!e||e.length===0?e:[...e].sort((o,a)=>o.value.id===t||!t&&o.value.id==="other"?-1:a.value.id===t||!t&&a.value.id==="other"?1:0)}catch{return e}}};r.\u0275fac=function(t){return new(t||r)},r.\u0275pipe=or({name:"orderByThisPageInSidebarFilter",type:r,pure:!0,standalone:!1});let n=r;return n})();var Bxe=(()=>{let r=class r{transform(e){try{if(!e||e<0||!isFinite(e))return"00:00:00";let t=Math.floor(e/1e3),o=Math.floor(t/3600),a=Math.floor(t%3600/60),l=t%60,s=S=>isNaN(S)?"00":S.toString().padStart(2,"0"),d=s(o),v=s(a),u=s(l);return`${d}:${v}:${u}`}catch(t){return console.error("Error in hourMinSecTimeDisplay pipe:",t),null}}};r.\u0275fac=function(t){return new(t||r)},r.\u0275pipe=or({name:"hourMinSecTimeDisplay",type:r,pure:!0,standalone:!1});let n=r;return n})();var M_n=n=>({componentConfigSignal:n}),R_n=(n,r)=>({condition:n,data:r});function N_n(n,r){if(n&1&&D(0,"velt-video-editor-player-internal",3),n&2){let i=c(2).ngIf;g("type",i.annotationId?"embed":"standalone")("url",i.url)("blob",i.blob)("annotationId",i.annotationId||i.recorderId)("variant",i==null?null:i.variant)("darkMode",i.darkMode)}}function F_n(n,r){if(n&1&&(h(0),p(1,N_n,1,6,"velt-video-editor-player-internal",2),f()),n&2){let i=c().ngIf;m(),g("ngIf",i.blob||i.url||i.annotationId)}}function L_n(n,r){if(n&1&&(h(0),p(1,F_n,2,1,"ng-container",1),f()),n&2){let i=c();m(),g("veltIf",w(3,R_n,i.conditionSignal(),$(1,M_n,i.componentConfigSignal)))}}var Vxe=(()=>{let r=class r extends Ct{constructor(e,t,o,a,l,s,d){super(s,l,void 0,void 0,void 0,d,t),this.authService=e,this.loggingService=t,this.commentService=o,this.wireframeService=a,this.themeService=l,this.elementRef=s,this.dynamicDataService=d,this.subscriptions=[],this.componentConfigSignal=Oe({blob:this.blob,url:this.url,annotationId:this.annotationId,recorderId:this.recorderId,darkMode:this.darkMode,variant:this.variant}),this.componentId="velt-video-editor",super.initializeComponentConfigSignal({componentId:"video-editor",blob:this.blob,url:this.url,annotationId:this.annotationId});try{this.subscriptions.push(super.onDarkModeChange().subscribe(v=>{this.componentConfigSignal.update(u=>(u=E(b({},u),{darkMode:v}),u))}))}catch(v){this.loggingService.catch("Error in VideoEditorComponent constructor: ",v)}}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in VideoEditorComponent ngOnInit: ",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in VideoEditorComponent setupA11yAttributes:",e)}}ngOnChanges(e){try{e&&(super.ngOnChanges(e),Object.keys(e).forEach(t=>{this.componentConfigSignal.update(o=>(o=E(b({},o),{[t]:e[t].currentValue}),o))}))}catch(t){this.loggingService.catch("Error in VideoEditorComponent ngOnChanges: ",t)}}ngOnDestroy(){try{super.ngOnDestroy(),this.subscriptions.forEach(e=>e.unsubscribe())}catch(e){this.loggingService.catch("Error in VideoEditorComponent ngOnDestroy: ",e)}}};r.\u0275fac=function(t){return new(t||r)(C(Ge),C(x),C(Pe),C(Je),C(mt),C(z),C(I))},r.\u0275cmp=O({type:r,selectors:[["velt-video-editor"]],inputs:{blob:"blob",url:"url",annotationId:"annotationId",recorderId:"recorderId",variant:"variant"},standalone:!1,features:[j([I]),L,it],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[3,"type","url","blob","annotationId","variant","darkMode",4,"ngIf"],[3,"type","url","blob","annotationId","variant","darkMode"]],template:function(t,o){t&1&&p(0,L_n,2,6,"ng-container",0),t&2&&g("ngIf",o.componentConfigSignal())},dependencies:[se,ae,mp],encapsulation:2,changeDetection:0});let n=r;return n})();var U_n=["*"],B_n=new Set(["annotation-id","class","style","id","ng-reflect-annotation-id","ng-version","_nghost","_ngcontent"]),jxe=(()=>{let r=class r{constructor(e,t,o,a){this.coreService=e,this.elementRef=t,this.registry=o,this.loggingService=a,this.parentContextData={},this.onParentPayload=l=>{try{!this.annotationId&&l.annotationId&&(this.annotationId=l.annotationId),this.parentContextData=l.contextData||{},this.initializeAndBroadcast()}catch(s){this.loggingService.catch("[CONTEXT WRAPPER] Error in onParentPayload:",s)}}}ngOnInit(){try{if(this.findAndConnectToParent(),this.parentRegistry){this.parentRegistry.register(this.onParentPayload);let e=this.parentRegistry.getLastPayload?.();e&&this.onParentPayload(e)}this.initializeAndBroadcast()}catch(e){this.loggingService.catch("[CONTEXT WRAPPER] Error in ngOnInit:",e)}}findAndConnectToParent(){try{let t=this.elementRef.nativeElement.parentElement;for(;t;){if(t.tagName?.toLowerCase()==="velt-comment-dialog-context-wrapper"){let o=t.__veltContext;if(o?.registry instanceof jm){this.parentWrapper=o.wrapperRef,this.parentRegistry=o.registry;return}let a=window.ng;if(a?.getComponent){let s=a.getComponent(t);if(s?.registry){this.parentWrapper=s,this.parentRegistry=s.registry;return}}let l=t.__ngContext__;if(l&&Array.isArray(l))for(let s=0;s<l.length;s++){let d=l[s];if(d&&typeof d=="object"&&d.registry instanceof jm){this.parentWrapper=d,this.parentRegistry=d.registry;return}}}t=t.parentElement}}catch(e){this.loggingService.catch("[CONTEXT WRAPPER] Error finding parent wrapper:",e)}}ngOnChanges(e){try{e.annotationId&&!e.annotationId.firstChange&&this.initializeAndBroadcast()}catch(t){this.loggingService.catch("[CONTEXT WRAPPER] Error in ngOnChanges:",t)}}ngOnDestroy(){try{let e=this.annotationId&&!this.parentWrapper;if(this.parentRegistry&&this.parentRegistry.unregister(this.onParentPayload),this.elementRef?.nativeElement&&(this.elementRef.nativeElement.__veltContext=void 0),this.parentWrapper=void 0,this.parentRegistry=void 0,e){let t=this.annotationId,o=this.registry;setTimeout(()=>{let a=this.coreService.getRegistry(t);(a===o||!a)&&(this.coreService.clearContext(t),this.coreService.clearRegistry(t))},0)}}catch(e){this.loggingService.catch("[CONTEXT WRAPPER] Error in ngOnDestroy:",e)}}collectAttributes(){let e={};try{let o=this.elementRef.nativeElement.attributes;for(let a=0;a<o.length;a++){let l=o[a],s=l.name.toLowerCase();B_n.has(s)||s.startsWith("_ng")||s.startsWith("ng-")||(e[s]=l.value)}}catch(t){this.loggingService.catch("[CONTEXT WRAPPER] Error collecting attributes:",t)}return e}initializeAndBroadcast(){try{let e=this.annotationId||this.parentContextData["annotation-id"];if(!e)return;this.annotationId&&(this.coreService.getOrCreateContextConfig(this.annotationId),this.coreService.setRegistry(this.annotationId,this.registry),this.elementRef.nativeElement.setAttribute("annotation-id",this.annotationId));let t=this.collectAttributes(),o=b(b({},this.parentContextData),t);this.elementRef.nativeElement.__veltContext={registry:this.registry,annotationId:e,contextData:o,wrapperRef:this};let a={annotationId:e,contextData:o};this.registry.broadcast(a)}catch(e){this.loggingService.catch("[CONTEXT WRAPPER] Error in initializeAndBroadcast:",e)}}};r.\u0275fac=function(t){return new(t||r)(C($_),C(z),C(jm),C(x))},r.\u0275cmp=O({type:r,selectors:[["velt-comment-dialog-context-wrapper"]],inputs:{annotationId:"annotationId"},standalone:!1,features:[j([jm]),it],ngContentSelectors:U_n,decls:1,vars:0,template:function(t,o){t&1&&(Wt(),jt(0))},styles:["[_nghost-%COMP%]{display:contents}"],changeDetection:0});let n=r;return n})();var $xe=(n,r)=>({componentConfigSignal:n,parentLocalUIState:r}),V_n=(n,r)=>({condition:n,data:r}),j_n=(n,r,i,e,t)=>({template:n,context:r,componentName:"velt-comment-dialog-private-button-wireframe",variant:i,setIfCondition:e,componentElementRef:t});function $_n(n,r){if(n&1&&(h(0),_(1,"app-tooltip-button",2),M(2,"translate"),M(3,"translate"),de(),_(4,"svg",3)(5,"g"),D(6,"path",4)(7,"path",5)(8,"path",6),y()()(),f()),n&2){let i=c(2),e=c();m(),g("darkMode",(i.uiState==null?null:i.uiState.darkMode)??!1)("tooltip",R(2,5,"Private Comment")),T("data-testid",e.componentId)("aria-label",R(3,7,"Private Comment")),m(3),T("data-testid",e.componentId+"-icon")}}function H_n(n,r){if(n&1&&(h(0),p(1,$_n,9,9,"ng-container",1),f()),n&2){let i=c(),e=c();m(),g("veltDynamicTemplate",B(4,j_n,e.template,w(1,$xe,e.componentConfigSignal,e.localUIStateSignal),i.uiState==null?null:i.uiState.variant,e.setIfCondition.bind(e),e.elementRef))}}function z_n(n,r){if(n&1&&p(0,H_n,2,10,"ng-container",0),n&2){let i=c();g("veltIf",w(4,V_n,i.conditionSignal(),w(1,$xe,i.componentConfigSignal,i.localUIStateSignal)))}}var Hxe=(()=>{let r=class r extends we{constructor(){super(...arguments),this.componentId="velt-comment-dialog-private-button-internal"}setupA11yAttributes(){try{G_n(this.hostElementRef.nativeElement,this.componentId)}catch(e){this.loggingService.catch("Error in CommentDialogPrivateButtonComponent setupA11yAttributes:",e)}}};r.\u0275fac=(()=>{let e;return function(o){return(e||(e=ze(r)))(o||r)}})(),r.\u0275cmp=O({type:r,selectors:[["velt-comment-dialog-private-button-internal"]],standalone:!1,features:[j([I]),L],decls:1,vars:1,consts:[[4,"veltIf"],[4,"veltDynamicTemplate"],["role","button","tabindex","0",3,"darkMode","tooltip"],["width","18","height","18","viewBox","0 0 14 14","fill","none","xmlns","http://www.w3.org/2000/svg","aria-hidden","true","role","img",1,"velt-private-comment--icon"],["fill-rule","evenodd","clip-rule","evenodd","d","M7.00284 6.45712C6.03598 6.45712 5.17472 6.49234 4.47105 6.53706C3.80359 6.57949 3.29036 7.08874 3.24246 7.75148C3.20839 8.22294 3.18466 8.7197 3.18466 9.18439C3.18466 9.64909 3.20839 10.1458 3.24246 10.6173C3.29036 11.28 3.80359 11.7893 4.47105 11.8317C5.17472 11.8765 6.03598 11.9117 7.00284 11.9117C7.96971 11.9117 8.83097 11.8765 9.53464 11.8317C10.2021 11.7893 10.7153 11.28 10.7632 10.6173C10.7973 10.1458 10.821 9.64909 10.821 9.18439C10.821 8.7197 10.7973 8.22294 10.7632 7.75148C10.7153 7.08874 10.2021 6.57949 9.53464 6.53706C8.83097 6.49234 7.96971 6.45712 7.00284 6.45712ZM4.40184 5.44835C3.19216 5.52524 2.24177 6.46387 2.15439 7.67284C2.11912 8.16079 2.09375 8.68528 2.09375 9.18439C2.09375 9.68351 2.11912 10.208 2.15439 10.6959C2.24177 11.9049 3.19216 12.8435 4.40184 12.9204C5.12527 12.9664 6.00982 13.0026 7.00284 13.0026C7.99586 13.0026 8.88042 12.9664 9.60384 12.9204C10.8135 12.8435 11.7639 11.9049 11.8513 10.6959C11.8866 10.208 11.9119 9.68351 11.9119 9.18439C11.9119 8.68528 11.8866 8.16079 11.8513 7.67284C11.7639 6.46387 10.8135 5.52524 9.60384 5.44835C8.88042 5.40237 7.99586 5.36621 7.00284 5.36621C6.00982 5.36621 5.12527 5.40237 4.40184 5.44835Z","fill","currentColor"],["fill-rule","evenodd","clip-rule","evenodd","d","M7.54847 9.58373C7.87455 9.3951 8.09393 9.04255 8.09393 8.63876C8.09393 8.03627 7.60551 7.54785 7.00302 7.54785C6.40053 7.54785 5.91211 8.03627 5.91211 8.63876C5.91211 9.04255 6.13149 9.3951 6.45756 9.58373V10.2751C6.45756 10.5764 6.70177 10.8206 7.00302 10.8206C7.30426 10.8206 7.54847 10.5764 7.54847 10.2751V9.58373Z","fill","currentColor"],["fill-rule","evenodd","clip-rule","evenodd","d","M4.27539 3.72923C4.27539 2.22299 5.49643 1.00195 7.00266 1.00195C8.50889 1.00195 9.72994 2.22299 9.72994 3.72923V5.91104C9.72994 6.21229 9.48573 6.4565 9.18448 6.4565C8.88324 6.4565 8.63903 6.21229 8.63903 5.91104V3.72923C8.63903 2.82549 7.9064 2.09286 7.00266 2.09286C6.09892 2.09286 5.3663 2.82549 5.3663 3.72923V5.91104C5.3663 6.21229 5.12209 6.4565 4.82085 6.4565C4.5196 6.4565 4.27539 6.21229 4.27539 5.91104V3.72923Z","fill","currentColor"]],template:function(t,o){if(t&1&&ie(0,z_n,1,7,"ng-container"),t&2){let a;re((a=o.componentConfigSignal())?0:-1,a)}},dependencies:[Md,Q,ae,ue],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}[_nghost-%COMP%]{--velt-green: var(--velt-light-mode-green);--velt-magenta: var(--velt-light-mode-magenta);--velt-amber: var(--velt-light-mode-amber);--velt-purple: var(--velt-light-mode-purple);--velt-cyan: var(--velt-light-mode-cyan);--velt-orange: var(--velt-light-mode-orange);--velt-black: var(--velt-light-mode-black);--velt-white: var(--velt-light-mode-white);--velt-gray: var(--velt-light-mode-gray);--velt-error: var(--velt-light-mode-error);--velt-error-hover: var(--velt-light-mode-error-hover);--velt-error-foreground: var(--velt-light-mode-error-foreground);--velt-error-light: var(--velt-light-mode-error-light);--velt-error-transparent: var(--velt-light-mode-error-transparent);--velt-warning: var(--velt-light-mode-warning);--velt-warning-hover: var(--velt-light-mode-warning-hover);--velt-warning-foreground: var(--velt-light-mode-warning-foreground);--velt-warning-light: var(--velt-light-mode-warning-light);--velt-warning-transparent: var(--velt-light-mode-warning-transparent);--velt-success: var(--velt-light-mode-success);--velt-success-hover: var(--velt-light-mode-success-hover);--velt-success-foreground: var(--velt-light-mode-success-foreground);--velt-success-light: var(--velt-light-mode-success-light);--velt-success-transparent: var(--velt-light-mode-success-transparent);--velt-accent: var(--velt-light-mode-accent);--velt-accent-text: var(--velt-light-mode-accent-text);--velt-accent-hover: var(--velt-light-mode-accent-hover);--velt-accent-foreground: var(--velt-light-mode-accent-foreground);--velt-accent-light: var(--velt-light-mode-accent-light);--velt-accent-transparent: var(--velt-light-mode-accent-transparent);--velt-text-0: var(--velt-light-mode-text-0);--velt-text-1: var(--velt-light-mode-text-1);--velt-text-2: var(--velt-light-mode-text-2);--velt-text-3: var(--velt-light-mode-text-3);--velt-text-4: var(--velt-light-mode-text-4);--velt-text-5: var(--velt-light-mode-text-5);--velt-text-6: var(--velt-light-mode-text-6);--velt-text-7: var(--velt-light-mode-text-7);--velt-text-8: var(--velt-light-mode-text-8);--velt-text-9: var(--velt-light-mode-text-9);--velt-text-10: var(--velt-light-mode-text-10);--velt-text-11: var(--velt-light-mode-text-11);--velt-text-12: var(--velt-light-mode-text-12);--velt-background-0: var(--velt-light-mode-background-0);--velt-background-1: var(--velt-light-mode-background-1);--velt-background-2: var(--velt-light-mode-background-2);--velt-background-3: var(--velt-light-mode-background-3);--velt-background-4: var(--velt-light-mode-background-4);--velt-background-5: var(--velt-light-mode-background-5);--velt-background-6: var(--velt-light-mode-background-6);--velt-background-7: var(--velt-light-mode-background-7);--velt-background-8: var(--velt-light-mode-background-8);--velt-background-9: var(--velt-light-mode-background-9);--velt-background-10: var(--velt-light-mode-background-10);--velt-border-0: var(--velt-light-mode-border-0);--velt-border-1: var(--velt-light-mode-border-1);--velt-border-2: var(--velt-light-mode-border-2);--velt-border-3: var(--velt-light-mode-border-3);--velt-border-4: var(--velt-light-mode-border-4);--velt-border-5: var(--velt-light-mode-border-5);--velt-border-6: var(--velt-light-mode-border-6);--velt-border-7: var(--velt-light-mode-border-7);--velt-border-8: var(--velt-light-mode-border-8);--velt-border-9: var(--velt-light-mode-border-9);--velt-border-10: var(--velt-light-mode-border-10);--velt-background-transparent: var(--velt-light-mode-background-transparent);--velt-border-transparent: var(--velt-light-mode-border-transparent);--velt-animation-transparent: var(--velt-light-mode-animation-transparent)}[dark][_nghost-%COMP%]{--velt-green: var(--velt-dark-mode-green);--velt-magenta: var(--velt-dark-mode-magenta);--velt-amber: var(--velt-dark-mode-amber);--velt-purple: var(--velt-dark-mode-purple);--velt-cyan: var(--velt-dark-mode-cyan);--velt-orange: var(--velt-dark-mode-orange);--velt-black: var(--velt-dark-mode-black);--velt-white: var(--velt-dark-mode-white);--velt-gray: var(--velt-dark-mode-gray);--velt-error: var(--velt-dark-mode-error);--velt-error-hover: var(--velt-dark-mode-error-hover);--velt-error-foreground: var(--velt-dark-mode-error-foreground);--velt-error-light: var(--velt-dark-mode-error-light);--velt-error-transparent: var(--velt-dark-mode-error-transparent);--velt-warning: var(--velt-dark-mode-warning);--velt-warning-hover: var(--velt-dark-mode-warning-hover);--velt-warning-foreground: var(--velt-dark-mode-warning-foreground);--velt-warning-light: var(--velt-dark-mode-warning-light);--velt-warning-transparent: var(--velt-dark-mode-warning-transparent);--velt-success: var(--velt-dark-mode-success);--velt-success-hover: var(--velt-dark-mode-success-hover);--velt-success-foreground: var(--velt-dark-mode-success-foreground);--velt-success-light: var(--velt-dark-mode-success-light);--velt-success-transparent: var(--velt-dark-mode-success-transparent);--velt-accent: var(--velt-dark-mode-accent);--velt-accent-text: var(--velt-dark-mode-accent-text);--velt-accent-hover: var(--velt-dark-mode-accent-hover);--velt-accent-foreground: var(--velt-dark-mode-accent-foreground);--velt-accent-light: var(--velt-dark-mode-accent-light);--velt-accent-transparent: var(--velt-dark-mode-accent-transparent);--velt-text-0: var(--velt-dark-mode-text-0);--velt-text-1: var(--velt-dark-mode-text-1);--velt-text-2: var(--velt-dark-mode-text-2);--velt-text-3: var(--velt-dark-mode-text-3);--velt-text-4: var(--velt-dark-mode-text-4);--velt-text-5: var(--velt-dark-mode-text-5);--velt-text-6: var(--velt-dark-mode-text-6);--velt-text-7: var(--velt-dark-mode-text-7);--velt-text-8: var(--velt-dark-mode-text-8);--velt-text-9: var(--velt-dark-mode-text-9);--velt-text-10: var(--velt-dark-mode-text-10);--velt-text-11: var(--velt-dark-mode-text-11);--velt-text-12: var(--velt-dark-mode-text-12);--velt-background-0: var(--velt-dark-mode-background-0);--velt-background-1: var(--velt-dark-mode-background-1);--velt-background-2: var(--velt-dark-mode-background-2);--velt-background-3: var(--velt-dark-mode-background-3);--velt-background-4: var(--velt-dark-mode-background-4);--velt-background-5: var(--velt-dark-mode-background-5);--velt-background-6: var(--velt-dark-mode-background-6);--velt-background-7: var(--velt-dark-mode-background-7);--velt-background-8: var(--velt-dark-mode-background-8);--velt-background-9: var(--velt-dark-mode-background-9);--velt-background-10: var(--velt-dark-mode-background-10);--velt-border-0: var(--velt-dark-mode-border-0);--velt-border-1: var(--velt-dark-mode-border-1);--velt-border-2: var(--velt-dark-mode-border-2);--velt-border-3: var(--velt-dark-mode-border-3);--velt-border-4: var(--velt-dark-mode-border-4);--velt-border-5: var(--velt-dark-mode-border-5);--velt-border-6: var(--velt-dark-mode-border-6);--velt-border-7: var(--velt-dark-mode-border-7);--velt-border-8: var(--velt-dark-mode-border-8);--velt-border-9: var(--velt-dark-mode-border-9);--velt-border-10: var(--velt-dark-mode-border-10);--velt-background-transparent: var(--velt-dark-mode-background-transparent);--velt-border-transparent: var(--velt-dark-mode-border-transparent);--velt-animation-transparent: var(--velt-dark-mode-animation-transparent)}[_nghost-%COMP%]:empty{display:none}"],changeDetection:0});let n=r;return n})();function G_n(n,r){try{n.setAttribute("data-testid",r+"-container"),n.setAttribute("role","button"),n.setAttribute("aria-label","Private comment indicator")}catch{}}var zxe=(()=>{let r=class r{constructor(e){this.injector=e,this.customElements=[{name:V.TAGS.SNIPPYLY_ROOT,component:TY},{name:V.TAGS.SNIPPYLY_PRESENCE,component:Uy},{name:V.TAGS.SNIPPYLY_CURSOR,component:HY},{name:V.TAGS.SNIPPYLY_COMMENT_TOOL,component:hS},{name:V.TAGS.SNIPPYLY_COMMENTS,component:$Y},{name:V.TAGS.SNIPPYLY_COMMENTS_SIDEBAR,component:_N},{name:V.TAGS.SNIPPYLY_COMMENT_BUBBLE,component:j_},{name:V.TAGS.SNIPPYLY_TAG_TOOL,component:QY},{name:V.TAGS.SNIPPYLY_TAGS,component:JY},{name:V.TAGS.SNIPPYLY_HUDDLE,component:GY},{name:V.TAGS.SNIPPYLY_HUDDLE_TOOL,component:zY},{name:V.TAGS.SNIPPYLY_RECORDER_TOOL,component:WY},{name:V.TAGS.SNIPPYLY_RECORDER_NOTES,component:YY},{name:V.TAGS.SNIPPYLY_MENU,component:wY},{name:V.TAGS.SNIPPYLY_RECORDER_CONTROL_PANEL,component:KY},{name:V.TAGS.SNIPPYLY_RECORDER_PLAYER,component:ZY},{name:V.TAGS.SNIPPYLY_REWRITER,component:XY},{name:V.TAGS.SNIPPYLY_SIDEBAR_BUTTON,component:rp},{name:V.TAGS.SNIPPYLY_USER_INVITE_TOOL,component:eK},{name:V.TAGS.SNIPPYLY_USER_REQUEST_TOOL,component:rK},{name:V.TAGS.SNIPPYLY_ARROW_TOOL,component:lK},{name:V.TAGS.SNIPPYLY_ARROWS,component:sK},{name:V.TAGS.SNIPPYLY_AREA_TOOL,component:dK},{name:V.TAGS.SNIPPYLY_AREAS,component:cK}],this.veltCustomElements=[{name:V.TAGS.VELT_ROOT,component:TY},{name:V.TAGS.VELT_PRESENCE,component:Uy},{name:V.TAGS.VELT_CURSOR,component:HY},{name:V.TAGS.VELT_COMMENT_TOOL,component:hS},{name:V.TAGS.VELT_COMMENTS,component:$Y},{name:V.TAGS.VELT_COMMENTS_SIDEBAR,component:_N},{name:V.TAGS.VELT_COMMENT_BUBBLE,component:j_},{name:V.TAGS.VELT_COMMENT_THREAD,component:ID},{name:V.TAGS.VELT_COMMENT_PIN,component:kxe},{name:V.TAGS.VELT_COMMENT_TEXT,component:Rxe},{name:V.TAGS.VELT_CHART_COMMENT,component:Sxe},{name:V.TAGS.VELT_CANVAS_COMMENT,component:Txe},{name:V.TAGS.VELT_INLINE_COMMENTS_SECTION,component:YT},{name:V.TAGS.VELT_COMMENTS_MINIMAP,component:wxe},{name:V.TAGS.VELT_TAG_TOOL,component:QY},{name:V.TAGS.VELT_TAGS,component:JY},{name:V.TAGS.VELT_HUDDLE,component:GY},{name:V.TAGS.VELT_HUDDLE_TOOL,component:zY},{name:V.TAGS.VELT_RECORDER_TOOL,component:WY},{name:V.TAGS.VELT_RECORDER_NOTES,component:YY},{name:V.TAGS.VELT_MENU,component:wY},{name:V.TAGS.VELT_RECORDER_CONTROL_PANEL,component:KY},{name:V.TAGS.VELT_RECORDER_PLAYER,component:ZY},{name:V.TAGS.VELT_VIDEO_EDITOR,component:Vxe},{name:V.TAGS.VELT_REWRITER,component:XY},{name:V.TAGS.VELT_SIDEBAR_BUTTON,component:rp},{name:V.TAGS.VELT_COMMENTS_SIDEBAR_BUTTON,component:rp},{name:V.TAGS.VELT_USER_INVITE_TOOL,component:eK},{name:V.TAGS.VELT_USER_REQUEST_TOOL,component:rK},{name:V.TAGS.VELT_ARROW_TOOL,component:lK},{name:V.TAGS.VELT_ARROWS,component:sK},{name:V.TAGS.VELT_AREA_TOOL,component:dK},{name:V.TAGS.VELT_AREAS,component:cK},{name:V.TAGS.VELT_INLINE_COMMENT,component:oxe},{name:V.TAGS.VELT_VIDEO_PLAYER,component:pxe},{name:V.TAGS.VELT_VIDEO_COMMENTS_TIMELINE,component:EN},{name:V.TAGS.VELT_REACTION_TOOL,component:Jy},{name:V.TAGS.VELT_INLINE_REACTIONS_SECTION,component:U3},{name:V.TAGS.VELT_VIEW_ANALYTICS,component:fxe},{name:V.TAGS.VELT_NOTIFICATIONS_TOOL,component:Pw},{name:V.TAGS.VELT_NOTIFICATIONS_PANEL,component:Gm},{name:V.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL,component:Cxe},{name:V.TAGS.VELT_WIREFRAME,component:bxe},{name:V.TAGS.VELT_AUTOCOMPLETE,component:xxe},{name:V.TAGS.VELT_AUTOCOMPLETE_PANEL,component:Ad},{name:V.TAGS.VELT_AUTOCOMPLETE_OPTION,component:k_},{name:V.TAGS.VELT_AUTOCOMPLETE_OPTION_ICON,component:I_},{name:V.TAGS.VELT_AUTOCOMPLETE_OPTION_NAME,component:E_},{name:V.TAGS.VELT_AUTOCOMPLETE_OPTION_DESCRIPTION,component:y_},{name:V.TAGS.VELT_AUTOCOMPLETE_OPTION_ERROR_ICON,component:x_},{name:V.TAGS.VELT_AUTOCOMPLETE_GROUP_OPTION,component:Py},{name:V.TAGS.VELT_AUTOCOMPLETE_TOOL,component:vK},{name:V.TAGS.VELT_AUTOCOMPLETE_EMPTY,component:ND},{name:V.TAGS.VELT_AUTOCOMPLETE_CHIP,component:Ixe},{name:V.TAGS.VELT_AUTOCOMPLETE_CHIP_TOOLTIP,component:kf},{name:V.TAGS.VELT_AUTOCOMPLETE_CHIP_TOOLTIP_ICON,component:b_},{name:V.TAGS.VELT_AUTOCOMPLETE_CHIP_TOOLTIP_NAME,component:S_},{name:V.TAGS.VELT_AUTOCOMPLETE_CHIP_TOOLTIP_DESCRIPTION,component:C_},{name:V.TAGS.VELT_AUTOCOMPLETE_CONTEXT_WRAPPER,component:Exe},{name:V.TAGS.VELT_COMMENT_COMPOSER,component:dD},{name:V.TAGS.VELT_SKELETON_LOADER,component:ao},{name:V.TAGS.VELT_SINGLE_EDITOR_MODE_PANEL,component:Ef},{name:"velt-comment-dialog-context-wrapper",component:jxe},{name:"velt-comment-dialog",component:so},{name:"velt-comment-dialog-delete-button",component:Bw},{name:"velt-comment-dialog-assignee-banner",component:Df},{name:"velt-comment-dialog-assignee-banner-user-name",component:G_},{name:"velt-comment-dialog-assignee-banner-user-avatar",component:z_},{name:"velt-comment-dialog-assignee-banner-resolve-button",component:H_},{name:"velt-comment-dialog-assignee-banner-unresolve-button",component:my},{name:"velt-comment-dialog-approve",component:wf},{name:"velt-comment-dialog-assign-menu",component:Ou},{name:"velt-comment-dialog-close-button",component:L3},{name:"velt-comment-dialog-comment-category",component:W_},{name:"velt-comment-dialog-comment-suggestion-status",component:q_},{name:"velt-comment-dialog-ghost-banner",component:Pf},{name:"velt-comment-dialog-hide-reply",component:qy},{name:"velt-comment-dialog-more-reply",component:_b},{name:"velt-comment-dialog-navigation-button",component:fy},{name:"velt-comment-dialog-private-banner",component:Rf},{name:"velt-comment-dialog-sign-in",component:Nf},{name:"velt-comment-dialog-upgrade",component:Uf},{name:"velt-comment-dialog-metadata",component:e0},{name:"velt-comment-dialog-resolve-button",component:Sb},{name:"velt-comment-dialog-unresolve-button",component:gy},{name:"velt-comment-dialog-suggestion-action",component:Ff},{name:"velt-comment-dialog-suggestion-action-accept",component:yb},{name:"velt-comment-dialog-suggestion-action-reject",component:xb},{name:"velt-comment-dialog-all-comment",component:Tf},{name:"velt-comment-dialog-private-button",component:Hxe},{name:"velt-comment-dialog-copy-link",component:qb},{name:"velt-comment-dialog-comment-index",component:Wk},{name:"velt-comment-dialog-comment-number",component:Gy},{name:"velt-comment-dialog-toggle-reply",component:Wb},{name:"velt-comment-dialog-toggle-reply-icon",component:Oy},{name:"velt-comment-dialog-toggle-reply-count",component:Dy},{name:"velt-comment-dialog-toggle-reply-text",component:Ay},{name:"velt-comment-dialog-reply-avatars",component:Vy},{name:"velt-comment-dialog-reply-avatars-remaining-count",component:Hy},{name:"velt-comment-dialog-reply-avatars-list",component:$y},{name:"velt-comment-dialog-reply-avatars-list-item",component:jy},{name:"velt-comment-dialog-composer-avatar",component:ES},{name:"velt-comment-dialog-composer-input",component:fb},{name:"velt-comment-dialog-composer-private-badge",component:bb},{name:"velt-comment-dialog-composer-attachments",component:hb},{name:"velt-comment-dialog-composer-assign-user",component:Q_},{name:"velt-comment-dialog-composer-recordings",component:Cb},{name:"velt-comment-dialog-composer-action-button",component:Z_},{name:"velt-comment-dialog-composer",component:Au},{name:"velt-comment-dialog-composer-attachments-image",component:ib},{name:"velt-comment-dialog-composer-attachments-image-preview",component:eb},{name:"velt-comment-dialog-composer-attachments-image-loading",component:nb},{name:"velt-comment-dialog-composer-attachments-image-delete",component:tb},{name:"velt-comment-dialog-composer-attachments-other",component:ub},{name:"velt-comment-dialog-composer-attachments-selected",component:pb},{name:"velt-comment-dialog-composer-attachments-other-icon",component:db},{name:"velt-comment-dialog-composer-attachments-other-name",component:gb},{name:"velt-comment-dialog-composer-attachments-other-size",component:vb},{name:"velt-comment-dialog-composer-attachments-other-loading",component:mb},{name:"velt-comment-dialog-composer-attachments-other-delete",component:cb},{name:"velt-comment-dialog-composer-attachments-invalid",component:sb},{name:"velt-comment-dialog-composer-attachments-invalid-item",component:lb},{name:"velt-comment-dialog-composer-attachments-invalid-item-preview",component:rb},{name:"velt-comment-dialog-composer-attachments-invalid-item-message",component:ob},{name:"velt-comment-dialog-composer-attachments-invalid-item-delete",component:ab},{name:"velt-comment-dialog-composer-format-toolbar",component:X_},{name:"velt-comment-dialog-composer-format-toolbar-button",component:J_},{name:"velt-comment-dialog-body",component:Of},{name:"velt-comment-dialog-header",component:Mf},{name:"velt-comment-dialog-threads",component:Gb},{name:"velt-comment-dialog-thread-card",component:zb},{name:"velt-comment-dialog-thread-card-avatar",component:Ib},{name:"velt-comment-dialog-thread-card-device-type",component:Eb},{name:"velt-comment-dialog-thread-card-draft",component:hy},{name:"velt-comment-dialog-thread-card-name",component:Ub},{name:"velt-comment-dialog-thread-card-time",component:Hb},{name:"velt-comment-dialog-thread-card-unread",component:US},{name:"velt-comment-dialog-thread-card-edited",component:zy},{name:"velt-comment-dialog-thread-card-options",component:Bb},{name:"velt-comment-dialog-status-dropdown",component:Wf},{name:"velt-comment-dialog-status",component:Xk},{name:"velt-comment-dialog-priority",component:Jk},{name:"velt-comment-dialog-options",component:Qk},{name:"velt-comment-dialog-status-dropdown-trigger-icon",component:tp},{name:"velt-comment-dialog-status-dropdown-trigger-name",component:np},{name:"velt-comment-dialog-status-dropdown-trigger-arrow",component:ep},{name:"velt-comment-dialog-status-dropdown-trigger",component:Gf},{name:"velt-comment-dialog-status-dropdown-content-item-icon",component:Xu},{name:"velt-comment-dialog-status-dropdown-content-item-name",component:Ju},{name:"velt-comment-dialog-status-dropdown-content-item",component:Qu},{name:"velt-comment-dialog-status-dropdown-content",component:zf},{name:V.TAGS.VELT_COMMENT_DIALOG_VISIBILITY_BANNER_DROPDOWN,component:Zb},{name:V.TAGS.VELT_COMMENT_DIALOG_VISIBILITY_BANNER_DROPDOWN_TRIGGER,component:Xb},{name:V.TAGS.VELT_COMMENT_DIALOG_VISIBILITY_BANNER_DROPDOWN_TRIGGER_LABEL,component:Jb},{name:V.TAGS.VELT_COMMENT_DIALOG_VISIBILITY_BANNER_DROPDOWN_TRIGGER_AVATAR_LIST,component:Qb},{name:V.TAGS.VELT_COMMENT_DIALOG_VISIBILITY_BANNER_DROPDOWN_TRIGGER_AVATAR_LIST_ITEM,component:eS},{name:V.TAGS.VELT_COMMENT_DIALOG_VISIBILITY_BANNER_DROPDOWN_TRIGGER_AVATAR_LIST_REMAINING_COUNT,component:tS},{name:V.TAGS.VELT_COMMENT_DIALOG_VISIBILITY_BANNER_DROPDOWN_TRIGGER_ICON,component:nS},{name:V.TAGS.VELT_COMMENT_DIALOG_VISIBILITY_BANNER_DROPDOWN_CONTENT,component:iS},{name:V.TAGS.VELT_COMMENT_DIALOG_VISIBILITY_BANNER_DROPDOWN_CONTENT_ITEM,component:rS},{name:V.TAGS.VELT_COMMENT_DIALOG_VISIBILITY_BANNER_DROPDOWN_CONTENT_ITEM_ICON,component:oS},{name:V.TAGS.VELT_COMMENT_DIALOG_VISIBILITY_BANNER_DROPDOWN_CONTENT_ITEM_LABEL,component:aS},{name:V.TAGS.VELT_COMMENT_DIALOG_VISIBILITY_BANNER_DROPDOWN_CONTENT_USER_PICKER,component:Zk},{name:V.TAGS.VELT_COMMENT_DIALOG_VISIBILITY_BANNER,component:qf},{name:V.TAGS.VELT_COMMENT_DIALOG_VISIBILITY_BANNER_ICON,component:lS},{name:V.TAGS.VELT_COMMENT_DIALOG_VISIBILITY_BANNER_TEXT,component:sS},{name:"velt-comment-dialog-priority-dropdown",component:Hf},{name:"velt-comment-dialog-priority-dropdown-trigger",component:$f},{name:"velt-comment-dialog-priority-dropdown-trigger-icon",component:Yu},{name:"velt-comment-dialog-priority-dropdown-trigger-name",component:Ku},{name:"velt-comment-dialog-priority-dropdown-trigger-arrow",component:qu},{name:"velt-comment-dialog-priority-dropdown-content",component:jf},{name:"velt-comment-dialog-priority-dropdown-content-item",component:Wu},{name:"velt-comment-dialog-priority-dropdown-content-item-icon",component:Hu},{name:"velt-comment-dialog-priority-dropdown-content-item-name",component:zu},{name:"velt-comment-dialog-priority-dropdown-content-item-tick",component:Gu},{name:"velt-comment-dialog-options-dropdown",component:Vf},{name:"velt-comment-dialog-custom-annotation-dropdown",component:Zf},{name:"velt-comment-dialog-custom-annotation-dropdown-trigger",component:RS},{name:"velt-comment-dialog-custom-annotation-dropdown-trigger-arrow",component:OS},{name:"velt-comment-dialog-custom-annotation-dropdown-trigger-list",component:PS},{name:"velt-comment-dialog-custom-annotation-dropdown-trigger-list-item",component:AS},{name:"velt-comment-dialog-custom-annotation-dropdown-trigger-placeholder",component:LS},{name:"velt-comment-dialog-custom-annotation-dropdown-trigger-remaining-count",component:MS},{name:"velt-comment-dialog-custom-annotation-dropdown-content",component:DS},{name:"velt-comment-dialog-custom-annotation-dropdown-content-item",component:wS},{name:"velt-comment-dialog-custom-annotation-dropdown-content-item-icon",component:kS},{name:"velt-comment-dialog-custom-annotation-dropdown-content-item-label",component:TS},{name:"velt-comment-dialog-options-dropdown-trigger",component:ju},{name:"velt-comment-dialog-options-dropdown-content",component:Vu},{name:"velt-comment-dialog-options-dropdown-content-make-private-enable",component:Uu},{name:"velt-comment-dialog-options-dropdown-content-make-private-disable",component:Lu},{name:"velt-comment-dialog-options-dropdown-content-make-private",component:Bu},{name:"velt-comment-dialog-options-dropdown-content-assign",component:Pu},{name:"velt-comment-dialog-options-dropdown-content-edit",component:Fu},{name:"velt-comment-dialog-options-dropdown-content-notification",component:Xf},{name:"velt-comment-dialog-options-dropdown-content-notification-subscribe",component:NS},{name:"velt-comment-dialog-options-dropdown-content-notification-unsubscribe",component:FS},{name:"velt-comment-dialog-options-dropdown-content-mark-as-read",component:Bf},{name:"velt-comment-dialog-options-dropdown-content-mark-as-read-mark-read",component:Yb},{name:"velt-comment-dialog-options-dropdown-content-mark-as-read-mark-unread",component:Kb},{name:"velt-comment-dialog-options-dropdown-content-delete-comment",component:Mu},{name:"velt-comment-dialog-options-dropdown-content-delete-thread",component:Ru},{name:"velt-comment-dialog-options-dropdown-content-delete",component:Nu},{name:"velt-comment-dialog-thread-card-reply",component:BA},{name:"velt-comment-dialog-thread-card-message",component:Lb},{name:"velt-comment-dialog-thread-card-attachments",component:Fb},{name:"velt-comment-dialog-thread-card-attachments-other",component:Nb},{name:"velt-comment-dialog-thread-card-attachments-other-download",component:Ab},{name:"velt-comment-dialog-thread-card-attachments-other-delete",component:Ob},{name:"velt-comment-dialog-thread-card-attachments-other-size",component:Rb},{name:"velt-comment-dialog-thread-card-attachments-other-name",component:Mb},{name:"velt-comment-dialog-thread-card-attachments-other-icon",component:Pb},{name:"velt-comment-dialog-thread-card-attachments-image",component:Db},{name:"velt-comment-dialog-thread-card-attachments-image-download",component:wb},{name:"velt-comment-dialog-thread-card-attachments-image-delete",component:Tb},{name:"velt-comment-dialog-thread-card-attachments-image-preview",component:kb},{name:"velt-comment-dialog-thread-card-reaction-tool",component:Lf},{name:"velt-comment-dialog-thread-card-reactions",component:Vb},{name:"velt-comment-dialog-thread-card-reaction-pin",component:qk},{name:"velt-comment-dialog-thread-card-assign-button",component:Yk},{name:"velt-comment-dialog-thread-card-edit-composer",component:jb},{name:"velt-comment-dialog-thread-card-recordings",component:$b},{name:"velt-comment-dialog-thread-card-seen-dropdown-content-item-avatar",component:Sy},{name:"velt-comment-dialog-thread-card-seen-dropdown-content-item-name",component:xy},{name:"velt-comment-dialog-thread-card-seen-dropdown-content-item-time",component:yy},{name:"velt-comment-dialog-thread-card-seen-dropdown-content-title",component:Iy},{name:"velt-comment-dialog-thread-card-seen-dropdown-content-item",component:by},{name:"velt-comment-dialog-thread-card-seen-dropdown-content-items",component:Ty},{name:"velt-comment-dialog-thread-card-seen-dropdown-trigger",component:ky},{name:"velt-comment-dialog-thread-card-seen-dropdown-content",component:Ey},{name:"velt-comment-dialog-thread-card-seen-dropdown",component:_y}]}ngDoBootstrap(){this.customElements.forEach(e=>{let t=RV(e.component,{injector:this.injector});customElements.get(e.name)||customElements.define(e.name,t)}),this.veltCustomElements.forEach(e=>{let t=RV(e.component,{injector:this.injector});customElements.get(e.name)||customElements.define(e.name,t)})}};r.\u0275fac=function(t){return new(t||r)(J(Tt))},r.\u0275mod=Sn({type:r}),r.\u0275inj=fn({providers:[zie(()=>{let e=sessionStorage?.getItem("veltFirebaseLogLevel")||wn?.firebaseLogLevel||"silent";return rj(e),Gie(wn.firebaseConfig)}),Jae(()=>Fl()),qre(()=>Yre()),Yle(()=>V2()),vle(()=>{let e=ple();return wn.useEmulators&&ule(e,"localhost",5001),e}),{provide:Dl,useClass:Hye},rV(oV()),yB()],imports:[kI,hde,Ds,Wne,td,MI,sie,uce,Jse,Mz,Fz,tce,Sse,yse,Pxe]});let n=r;return n})();ee(Uy,[se,Nt,Q,jn,ae,sA,cA],[]);ee(hS,[se,Nt,Q,jn,ae],[]);ee(fN,[se,ua,wg,pp],[]);ee(p8,[se,mn,cn,hN,rxe,ql,so],[]);ee(el,[se,Pz,hi,Q,$w,Hw,jw,Vw,ae],[]);ee(BO,[se,Q,ae],[]);ee(j_,[Ko,se,Nt,Q,zk,Hk,Gk,jn,Zy,ae],[ue]);ee(rp,[se,Nt,mn,cn,_N,hi,Q,fS,jn,yS,xS],[ue]);ee(MR,[se,hi,Uk,Ek],[]);ee(By,[se,Q,ae,hA,SA,bA,fA,IA],[]);ee(gk,[se],[ue]);ee(RT,[se,Q,MT,DT],[ue]);ee(vA,[se,Nt,Q,jn,ae,dA,pA],[]);ee(ID,[se,ae,so],[]);ee(Pw,[se,Nt,mn,cn,Gm,_xe,Q,jn,Aw,ww,Dw,ae],[ue]);ee(Gm,[se,Nt,ai,Q,jn,XT,$O,QT,rw],[ue]);ee(PR,[se,Rr,Jr,hi],[ue]);ee(vT,[se,Q,eT,LA,uT,pT,nT,ae],[ue]);ee(gT,[Ko,se,ai,Q,rT,aT,HD,dT,vS,sT,zD,GD,WD,iT,cT,oT,mT,lT,ae,ED,Ly],[ue]);ee(tT,[se,Nt,Q,SD,ae],[ue]);ee(pS,[se,Q,ae,so],[ue]);ee(eT,[se,Q,ae],[ue]);ee(LA,[se,Q,ae],[ue]);ee(uT,[se,Ya,Ul,hl,Q,ae],[ue]);ee(pT,[se,RT,Q,ae],[ue]);ee(nT,[se,Q,ae],[ue]);ee(Yl,[se,Q,UD,LD,FD,BD,ae],[]);ee(UD,[se,Ya,Ul,hl,Q,ae],[ue]);ee(LD,[se,Q,ae],[]);ee(FD,[se,Q,ae],[]);ee(BD,[Vt,se,Q,VD,ae],[]);ee(VD,[se,Q,jD,$D,ae],[]);ee(jD,[se,Q,ae],[]);ee($D,[se,Q,ae],[]);ee(rT,[se,Q,ae],[ue]);ee(aT,[se,Q,ae],[ue]);ee(HD,[se,Q,ae],[ue]);ee(dT,[se,Q,ae],[ue]);ee(vS,[Vt,se,Nt,mn,cn,hi,ai,Q,Yl,tl,nl,IS,Wl,ae],[xg,Uxe,ue]);ee(sT,[Vt,se,Nt,mn,cn,hi,ai,Q,Yl,tl,nl,Wl,ae],[ue]);ee(zD,[Vt,se,Nt,mn,cn,hi,ai,Q,Yl,tl,nl,Wl,ae],[ue]);ee(GD,[Vt,se,Nt,mn,cn,hi,ai,Q,Yl,tl,nl,Wl,ae],[ue]);ee(WD,[Vt,se,Nt,mn,cn,hi,ai,Q,Yl,tl,nl,Wl,ae],[ue]);ee(iT,[Vt,se,Nt,mn,cn,hi,ai,Q,Yl,tl,nl,Wl,ae],[xg,ue]);ee(cT,[Vt,se,Nt,mn,cn,hi,ai,Q,Yl,tl,nl,Wl,ae],[ue]);ee(oT,[Vt,se,Q,tl,nl,ae],[ue]);ee(mT,[Vt,se,Nt,mn,cn,hi,ai,Q,Yl,tl,nl,Wl,ae],[]);ee(lT,[Vt,se,Q,tl,nl,ae],[xg,ue]);ee(fS,[se,Q,ae],[]);ee(dS,[se,Q,ae],[ue]);ee(cS,[se,Q,ae],[ue]);ee(P8,[se,Q,ae],[]);ee(zk,[se,Q,ae],[]);ee(Hk,[se,ri,Q,ae],[]);ee(Gk,[se,Q,ae],[ue]);ee(gS,[se,Q,ae],[]);ee(mS,[se,Q,ae],[]);ee(p_,[se,Nt,Q,jn,ae],[ue]);ee(h_,[se,Nt,Q,Bk,$k,Vk,jk,jn,ae],[ue]);ee(Bk,[se,Q,ae],[ue]);ee($k,[se,Q,ae],[]);ee(Vk,[se,Q,ae],[ue]);ee(jk,[se,Q,ae],[ue]);ee(Ad,[Nt,dV,PI,pC,nE,s1,iE,hi,Q,k_,Py,ae],[]);ee(k_,[Q,I_,E_,y_,x_],[]);ee(I_,[Nt,ri,Q],[Ym]);ee(E_,[Nt,Q,ao],[ue]);ee(y_,[Nt,Q],[ue]);ee(x_,[Nt,Q],[ue]);ee(Py,[Q,ae],[]);ee(ND,[Q,ae],[]);ee(Kf,[se,Q,ae],[ue]);ee(Yf,[se,Q,vT,gT,M8,tT,pS,ae],[ue]);ee(Gf,[Ko,Q,tp,np,ep,ae],[]);ee(zf,[Q,Qu,ae],[]);ee(tp,[Q,ae],[Ym]);ee(np,[Q,ae],[]);ee(ep,[Q,ae],[]);ee(Qu,[Q,Xu,Ju,ae],[]);ee(Xu,[Q,ae],[Ym]);ee(Ju,[Q,ae],[]);ee(Zb,[$m,Q,Xb,iS,ae],[]);ee(Xb,[Q,Jb,Qb,nS,ae],[]);ee(Jb,[Q,ae],[]);ee(Qb,[Q,eS,tS,ae],[]);ee(eS,[ri,Q,ae],[]);ee(tS,[ri,Q,ae],[]);ee(nS,[Q,ae],[]);ee(iS,[Q,rS,ae],[]);ee(rS,[Q,oS,aS,ae],[]);ee(oS,[Q,ae],[]);ee(aS,[Q,ae],[ue]);ee(qf,[cn,Q,Zb,Zk,lS,sS,ae],[ue]);ee(lS,[Q,ae],[]);ee(sS,[Q,ae],[ue]);ee($f,[Q,qu,Ku,Yu,ae],[]);ee(jf,[Q,Wu,ae],[]);ee(qu,[Q,ae],[]);ee(Ku,[se,Q,ae],[]);ee(Yu,[Q,ae],[Ac]);ee(Wu,[Q,Hu,zu,Gu,ae],[]);ee(Hu,[Q,ae],[Ac]);ee(zu,[Q,ae],[]);ee(Gu,[Q,ae],[]);ee(ju,[Q,ae],[ue]);ee(Vu,[Q,Bu,Pu,Fu,Nu,ae,Xf,Bf],[]);ee(Bu,[Q,Lu,Uu,ae],[]);ee(Pu,[Q,ae],[ue]);ee(Fu,[Q,ae],[ue]);ee(Nu,[Q,Ru,Mu,ae],[ue]);ee(Ru,[Q,ae],[ue]);ee(Mu,[Q,ae],[ue]);ee(Lu,[Q,ae],[ue]);ee(Uu,[Q,ae],[ue]);ee(_S,[se,Q,ae],[IN,ue]);ee(CS,[se,Q,ae],[ue]);ee(bS,[se,Nt,Q,jn,_T],[ue]);ee(_T,[Vt,se,Q,CT,ae],[ue]);ee(CT,[se,Q,hT,fT,ae],[ue]);ee(hT,[se,ri,Q,ae],[ue]);ee(fT,[se,Q,ae,ao],[ue]);ee(SS,[Vt,se,Q,ST,ae],[ue]);ee(ST,[se,Q,bT,ae],[ue]);ee(bT,[se,Q,ae],[]);ee(kf,[Nt,Q,jn,b_,S_,C_,ae],[]);ee(b_,[Nt,ri,Q,ae],[Ym]);ee(S_,[Nt,Q,ae],[ue]);ee(C_,[Nt,Q,ae],[ue]);ee(MT,[se,Q,PT,OT,AT,ae],[]);ee(PT,[se,Q,ae],[ue]);ee(OT,[se,Q,ae],[]);ee(AT,[se,Q,ae],[]);ee(DT,[Vt,se,ai,Q,wT,ae],[ue]);ee(wT,[se,Q,kT,TT,ET,IT,ae],[]);ee(kT,[se,Q,ae],[Ym,ue]);ee(TT,[se,Q,ae],[ue]);ee(ET,[se,Q,ae],[]);ee(IT,[se,Q,yT,xT,ae],[]);ee(yT,[se,Q,ae],[]);ee(xT,[se,Q,ae],[]);ee(yS,[se,Q,ae],[]);ee(xS,[se,Q,ae],[ue]);ee(tl,[se,Q,FT,UT,BT,ae],[ue]);ee(FT,[se,Q,NT,LT,ae],[]);ee(UT,[se,Q,ae],[ue]);ee(BT,[se,Q,ae],[ue]);ee(NT,[se,Q,ae],[ue]);ee(LT,[se,Q,ae],[ue]);ee(nl,[se,Q,ae],[ue]);ee(IS,[se,Q,ae],[ue]);ee(uS,[se,Q,VT,zT,ae],[]);ee(VT,[se,Q,ae,so],[ue]);ee(zT,[se,Q,jT,$T,HT,ae],[]);ee(jT,[se,Q,ae],[]);ee($T,[se,Q,ae],[ue]);ee(HT,[se,Q,ae],[]);ee(YT,[se,Nt,Q,jn,ZT,KT],[ue]);ee(qT,[se,ai,Q,ae,so],[ue]);ee(GT,[se,Q,ae],[]);ee(WT,[Vt,se,Q,ae,so],[]);ee(ZT,[se,Q,ae],[ue]);ee(KT,[se,Q,qT,GT,WT,ae,RD],[ue]);ee(XT,[se,Q,JT,VO,Mw,ae,FA],[ue]);ee(JT,[se,Q,ae],[ue]);ee(VO,[se,Q,ae],[ue]);ee($O,[se,Q,eA,KO,ZO,XO,tA,ae],[]);ee(jO,[se,Q,ae],[]);ee(qO,[se,Q,ae],[]);ee(YO,[se,Q,ae],[]);ee(HO,[se,mn,cn,hi,ai,Q,WO,GO,Wl,ae],[]);ee(WO,[se,Q,YO,rA,oA,ae],[]);ee(GO,[Vt,se,Q,zO,ae],[]);ee(zO,[se,Q,nA,iA,ae],[]);ee(eA,[se,Q,ae],[]);ee(KO,[se,Q,ae],[]);ee(ZO,[se,Q,qO,QO,JO,ae],[]);ee(XO,[se,Q,jO,aA,ae],[]);ee(QO,[se,Q,ae],[]);ee(JO,[se,Q,ae],[]);ee(tA,[Vt,se,Q,HO,ae],[]);ee(nA,[se,Q,ae],[]);ee(iA,[se,Q,ae],[]);ee(QT,[se,Q,iw,ew,nw,tw,ae],[ue]);ee(rw,[se,Q,ow,aw,kw,lw,ae],[]);ee(lp,[se,Q,bw,ae],[ue]);ee(bw,[se,Q,ae],[ue]);ee(ow,[se,Q,lp,ap,sp,dp,ae],[ue]);ee(aw,[se,Q,lp,Rw,dp,ae],[ue]);ee(kw,[se,Q,lp,Ew,dp,ae],[ue]);ee(lw,[se,Q,lp,cw,dp,ae],[ue]);ee(ap,[Vt,se,Q,_w,ae],[]);ee(_w,[se,Q,vw,Cw,hw,uw,pw,fw,ae],[ue]);ee(sp,[se,Q,ae],[ue]);ee(cw,[Vt,se,Q,sw,ae],[]);ee(sw,[se,Q,gw,mw,dw,Uw,ae],[]);ee(gw,[se,Nt,Q,ae],[ue]);ee(mw,[se,Q,ae],[ue]);ee(dw,[se,Q,ap,sp,ae],[ue]);ee(Ew,[Vt,se,Q,Iw,ae],[xg]);ee(Iw,[se,Q,xw,yw,Sw,Tw,ae],[]);ee(xw,[se,Q,ae],[ue]);ee(yw,[se,Q,ae],[ue]);ee(Sw,[se,Q,ap,sp,ae],[ue]);ee(Tw,[se,ri,Q,ae],[ue]);ee(vw,[se,ri,Q,ae],[]);ee(Cw,[se,Q,ae],[ue]);ee(hw,[se,Q,ae],[Ac,ue]);ee(uw,[se,Q,ae,ao],[Ac,ue]);ee(pw,[se,Q,ae],[ue]);ee(fw,[se,Q,ae],[hp,ue]);ee(iw,[se,Q,ae],[ue]);ee(ew,[se,Q,ae],[ue]);ee(nw,[se,Q,ae],[ue]);ee(tw,[se,Q,ae],[ue]);ee(Aw,[se,Q,ae],[ue]);ee(ww,[se,Q,ae],[ue]);ee(Dw,[se,Q,Ow,ae],[ue]);ee(Ow,[se,Q,ae],[]);ee(Mw,[se,Q,ae],[ue]);ee(Rw,[Vt,se,Q,Nw,ae],[ue]);ee(Nw,[se,Q,Fw,Lw,ae],[ue]);ee(Fw,[se,Q,ae],[ue]);ee(Lw,[se,Q,ap,sp,ae],[]);ee(Uw,[se,Q,ae],[ue]);ee(rA,[se,Q,ae],[]);ee(oA,[se,Q,ae],[]);ee(aA,[se,Q,ae],[]);ee(AS,[Q,ae],[ue]);ee(kS,[Q,ae],[]);ee(TS,[Q,ae],[ue]);ee(LS,[Q,ae],[ue]);ee(MS,[Q,ae],[ue]);ee(OS,[Q,ae],[ue]);ee(PS,[Q,AS,ae],[ue]);ee(RS,[Q,LS,MS,OS,PS,ae],[]);ee(wS,[Q,kS,TS,ae],[]);ee(DS,[Q,jn,wS,ae],[ue]);ee(Zf,[$m,Q,RS,DS,ae],[]);ee($w,[se,Oz,Q,ae],[ue]);ee(Hw,[se,Az,Q,ae],[ue]);ee(jw,[se,Q,ae],[ue]);ee(Vw,[se,Dz,Q,ae],[ue]);ee(VS,[se,Nt,Q,jn,ae],[ue]);ee($S,[se,Nt,Q,jn,ae],[ue]);ee(jS,[se,Nt,Q,jn,ae],[ue]);ee(BS,[se,Nt,hc,tu,Q,jn,Gw,ae],[ue]);ee(zw,[se,Ns,Q,ae],[ue]);ee(qw,[se,Ns,Q,ae],[ue]);ee(Ww,[se,Ns,Q,ae],[ue]);ee(Gw,[se,Nt,Q,jn,zw,qw,Ww,ae],[ue]);ee(F_,[se,Q,ae],[ue]);ee(P_,[se,Q,ae],[ue]);ee(Uk,[se,Nt,Q,jn,F_,P_,Lk,Rk,L_,N_,M_,Ak,R_,A_,U_,B_,ae,UA],[]);ee(Lk,[se,Q,ae],[]);ee(Rk,[se,Q,ae],[ue]);ee(L_,[se,Q,Nk,Fk,ae],[]);ee(Nk,[se,Q,ae],[ue]);ee(Fk,[se,Q,ae],[]);ee(N_,[se,Q,ae],[ue]);ee(M_,[se,Xy,Q,Pk,Mk,ae],[ue]);ee(Ak,[se,Xy,Q,Ok,Dk,ae],[ue]);ee(R_,[se,Q,ae],[ue]);ee(Ek,[se,Nt,Q,jn,F_,P_,L_,N_,M_,R_,A_,U_,B_,ae],[ue]);ee(Ok,[se,Q,ae],[]);ee(Dk,[se,Q,ae],[]);ee(Pk,[se,Q,ae],[]);ee(Mk,[se,Q,ae],[]);ee(Ik,[se,Nt,Q,jn,Ck,xk,ae],[ue]);ee(Ck,[se,ai,Q,D_,O_,w_,T_,ae],[ue]);ee(xk,[se,ai,Q,D_,O_,w_,T_,ae],[ue]);ee(D_,[se,Q,ae],[ue]);ee(O_,[se,Q,yk,Sk,ae],[]);ee(yk,[se,Q,ae],[]);ee(Sk,[se,Q,ae],[]);ee(w_,[Vt,se,Q,_k,bk,ae],[]);ee(_k,[se,Q,ae],[]);ee(bk,[se,Q,ae],[ue]);ee(T_,[se,Q,ae],[]);ee(Ny,[se,Q,_O,aN,ae],[]);ee(_O,[se,Q,rN,oN,My,CO,ae],[]);ee(iN,[se,Q,ae],[]);ee(My,[se,Q,ae],[]);ee(CO,[se,Q,My,iO,mO,cO,lO,uO,fO,rO,ae],[]);ee(iO,[se,Q,ae],[]);ee(mO,[se,Q,vO,gO,ae],[]);ee(cO,[se,Q,sO,dO,ae],[]);ee(lO,[se,Q,aO,oO,ae],[]);ee(uO,[se,Q,pO,hO,ae],[]);ee(nN,[se,Q,ae],[]);ee(fO,[se,Ya,Ul,hl,Axe,pK,Q,ae],[]);ee(rO,[Vt,se,Q,ae],[ue]);ee(aO,[se,Q,ae],[ue]);ee(oO,[se,Q,ae],[]);ee(sO,[se,Q,ae],[]);ee(dO,[se,Q,ae],[]);ee(vO,[se,Q,ae],[]);ee(gO,[se,Q,ae],[]);ee(pO,[se,Q,ae],[]);ee(hO,[se,Q,ae],[ue]);ee(A_,[se,Q,kk,Tk,wk,ae],[ue]);ee(kk,[se,Q,ae],[ue]);ee(Tk,[se,Q,ae],[]);ee(wk,[se,Rr,Jr,Q,ae],[]);ee(WS,[se,Q,ae],[ue]);ee(HS,[se,Q,i3,Qw,n3,Jw,Xw,o3,r3,ae],[ue]);ee(i3,[se,Rr,Jr,Q,ae],[ue]);ee(Qw,[se,Q,ae],[ue,Bxe]);ee(n3,[se,Q,t3,e3,ae],[ue]);ee(t3,[se,Q,ae],[ue]);ee(e3,[se,Q,ae],[ue]);ee(Jw,[se,Q,ae],[ue]);ee(Xw,[se,Q,ae],[ue]);ee(o3,[se,Q,ae],[ue]);ee(qS,[se,Nt,mn,cn,ua,wg,Q,jn,WS,HS,Jf,Fy,ae],[ue]);ee(GS,[se,Nt,ua,Q,jn,WS,HS,a3,Fy,ae],[ue]);ee(Jf,[se,Q,ae],[ue]);ee(l3,[se,Q,ae],[ue]);ee(Zw,[se,Q,Kw,Yw,ae],[ue]);ee(Kw,[se,Q,ae],[]);ee(Yw,[se,Q,ae],[]);ee(f3,[Vt,se,Q,t0,ae],[gp,ue]);ee(h3,[se,Q,JS,p3,ae],[ue]);ee(v3,[se,Q,ae],[ue]);ee(u3,[se,Q,JS,ty,ae],[ue]);ee(iy,[se,Nt,BO,Q,jn,f3,h3,v3,u3,XS,ey,ny,KS,ZS,QS,wy,ae],[ue]);ee(JS,[se,Q,ae],[ue]);ee(ty,[se,Q,ae],[]);ee(p3,[se,Ya,lz,Ul,hl,Q,ae],[ue]);ee(XS,[se,Q,ae],[ue]);ee(ey,[se,n0,Q,ae],[ue]);ee(ny,[se,Ry,Q,ae],[ue]);ee(KS,[se,Q,ae],[ue]);ee(ZS,[se,Q,ae],[ue]);ee(U_,[se,Q,Ik,ae],[ue]);ee(B_,[se,Q,Qy,ae],[]);ee(a3,[se,Q,Jf,l3,Zw,zS,ae],[ue]);ee(Fy,[se,Q,Jf,zS,ae],[ue]);ee(r3,[se,Q,Qy,ae],[ue]);ee(zS,[se,Q,Qy,ae],[ue]);ee(YS,[se,Nt,cn,Q,jn,ty,XS,ey,ny,KS,ZS,g3,d3,m3,QS,wy,ae],[ue]);ee(g3,[Vt,se,Q,t0,ae],[gp,ue]);ee(d3,[se,Q,c3,s3,ae],[ue]);ee(m3,[se,Q,Qy,ae],[ue]);ee(c3,[se,Q,ae],[]);ee(s3,[se,Q,ae],[ue]);ee(QS,[se,Q,ae],[ue]);ee(ry,[se,Nt,Q,jn,S3],[]);ee(oy,[se,cn,Q,y3,C3,b3],[]);ee(y3,[se,Q],[ue]);ee(C3,[se,Q],[]);ee(_3,[se,Q],[]);ee(b3,[se,mn,ua,hi,Q,_3,S3],[ue]);ee(cy,[se,ua,Q,E3,I3,Qf,U8],[ue]);ee(E3,[se,Q,k3,T3],[]);ee(k3,[se,Q],[]);ee(T3,[se,Q],[ue]);ee(I3,[se,Q],[]);ee(Qf,[se,Q,B8,A3],[]);ee(A3,[se,Q,O3,D3],[]);ee(sy,[se,Q,L8,F8],[]);ee(ly,[se,Nt,Q,jn,cy],[]);ee(ay,[se,Nt,cn,Q,jn,P3,x3,w3],[]);ee(P3,[se,Q],[ue]);ee(x3,[se,Q],[]);ee(w3,[se,mn,hi,Q,cy],[]);ee(O3,[se,Q],[ue]);ee(D3,[se,Q],[ue]);ee(dy,[se,Nt,Q,jn,F3,M3],[ue]);ee(F3,[se,Q,R3,N3],[]);ee(R3,[se,Q],[ue]);ee(N3,[se,Q],[ue]);ee(M3,[se,Q],[ue]);ee(wy,[se,ri,Q,ae],[ue]);ee(U3,[se,Nt,Q,jn,j3,ae],[]);ee(j3,[se,Q,V3,B3,ae],[]);ee(V3,[Vt,se,fp,Q,ae],[]);ee(B3,[se,Jy,Q,ae],[]);ee(V8,[se,Q,Y3,q3,ae],[ue]);ee(Y3,[se,Q,ae],[ue]);ee(q3,[se,ai,Q,K3,Z3,$3,W3,H3,z3,G3,YA,KA,ae],[ue]);ee(K3,[se,Q,Ks,ae],[ue]);ee(Z3,[se,Q,Ks,ae],[ue]);ee($3,[se,Q,Ks,ae],[ue]);ee(W3,[se,Q,Ks,ae],[ue]);ee(H3,[se,Q,Ks,ae],[ue]);ee(z3,[se,Q,Ks,ae],[ue]);ee(G3,[se,Q,Ks,ae],[ue]);ee(YA,[se,Q,Ks,ae],[ue]);ee(KA,[se,Q,Ks,ae],[ue]);ee(Ks,[se,Q,ae],[ue]);ee(j8,[se,Q,J3,X3,ae],[ue]);ee(J3,[se,Q,Q3,ae],[ue]);ee(X3,[se,ai,Q,vS,ae],[ue]);ee(Q3,[se,Q,ae],[ue]);ee(ql,[se,Nt,Q,jn,vy,uy,py,eD,cD,pD],[ue]);ee(vy,[se,Q,ae],[]);ee(uy,[se,Q,ae,so],[ue]);ee(py,[Vt,se,Q,ae,so],[ue]);ee(H8,[se,Q,vy,uy,py,ae],[ue]);ee($8,[se,Q,ae],[ue]);ee(G8,[se,Q],[]);ee(eD,[se,Q,nD,tD,ae],[]);ee(nD,[se,ai,Q,iD,oD,aD,rD,lD,sD,ae],[ue]);ee(tD,[se,Q,ae],[ue]);ee(iD,[se,Q,qm,ae],[ue]);ee(oD,[se,Q,qm,ae],[ue]);ee(aD,[se,Q,qm,ae],[ue]);ee(rD,[se,Q,qm,ae],[ue]);ee(qm,[se,Q,ae],[]);ee(lD,[se,Q,qm,ae],[ue]);ee(sD,[se,Q,qm,ae],[ue]);ee(cD,[se,Q,bD,ae],[ue]);ee(dD,[se,ae,so],[]);ee(W8,[se,Q,gD,mD,ae],[ue]);ee(gD,[se,ai,Q,vD,uD,ae],[ue]);ee(mD,[se,Q,ae],[ue]);ee(vD,[se,Q,ae],[ue]);ee(uD,[se,Q,ae],[ue]);ee(pD,[se,Q,ae],[ue]);ee(q8,[se,Q,fD,hD,ae],[]);ee(fD,[se,ai,Q,CD,_D,ae],[ue]);ee(hD,[se,Q,ae],[ue]);ee(CD,[se,Q,ae],[ue]);ee(_D,[se,Q,ae],[ue]);ee(bD,[se,Q,ae],[ue]);ee(dp,[se,Q,ae],[]);ee(SD,[se,Q,ae],[ue]);ee(Y8,[se,Q,ae],[ue]);ee(Cy,[se,Q,xD,yD,ae],[]);ee(xD,[se,Q,ae],[ue]);ee(yD,[se,Q,ae,so],[ue]);ee(Z8,[se,Q,ae],[ue]);ee(ED,[Vt,se,Nt,mn,cn,hi,ai,Q,Yl,tl,nl,Wl,ae],[ue]);ee(gN,[Vt,se,Nt,mn,cn,hi,ai,Q,Yl,tl,nl,Wl,ae],[ue]);ee(RD,[se,Q,ae,MD,OD],[]);ee(MD,[se,Q,ae,PD,AD],[ue]);ee(OD,[Vt,se,ai,Q,ae,DD],[ue]);ee(PD,[se,Q,ae],[ue]);ee(AD,[se,Q,ae],[]);ee(DD,[se,Q,ae,wD,kD,TD],[]);ee(wD,[se,Q,ae],[]);ee(kD,[se,Q,ae],[]);ee(TD,[se,Q,ae],[ue]);ee(mp,[se,Q,ae,qD,YD,JD,eO,tO,NA],[]);ee(X8,[se,Q,ae],[]);ee(qD,[se,Q,ae],[]);ee(YD,[se,Q,ae],[]);ee(J8,[se,Q,ae],[]);ee(ZD,[se,Q,ae],[]);ee(XD,[Vt,se,yg,ua,Q,ae],[gp]);ee(JD,[se,Q,ae,ZD,XD],[]);ee(QD,[se,Q,ae],[]);ee(Q8,[se,Q,ae,KD,nO],[]);ee(eO,[se,mn,cn,hi,ai,Q,ae,RO,wA],[]);ee(eN,[se,Q,ae],[]);ee(tO,[se,Q,ae],[]);ee(KD,[se,Q,ae],[]);ee(nO,[se,Q,ae],[]);ee(tN,[se,Q,ae],[ue]);ee(Ef,[se,Nt,Q,jn,ae,bO,SO,yO,xO,IO,EO],[]);ee(lN,[se,Q,ae],[ue]);ee(sN,[se,Q,ae],[ue]);ee(bO,[se,Q,ae],[]);ee(SO,[se,Q,ae],[ue]);ee(yO,[se,Q,ae],[ue]);ee(xO,[se,Q,ae],[ue]);ee(IO,[se,Q,ae],[ue]);ee(EO,[se,Q,ae],[ue]);ee(AO,[se,mn,cn,hi,ai,Q,ae,OO,DO],[]);ee(OO,[se,Q,ae],[]);ee(DO,[se,Q,ae,wO,kO],[]);ee(wO,[Vt,se,Q,ae,TO],[]);ee(TO,[se,Q,ae],[]);ee(kO,[se,Q,ae],[]);ee(cN,[Vt,se,Q,ae],[]);ee(PO,[Vt,se,Md,Q,ae,AO],[ue]);ee(MO,[Vt,se,Md,Q,Qy,ae],[ue]);ee(RO,[se,Q,ae,PO,MO,NO,RA],[]);ee(NO,[se,mn,cn,hi,ai,Q,ae,kA,TA],[]);ee(mN,[se,Q,ae],[]);ee(dN,[se,mn,cn,hi,ai,Q,ae,LO,FO],[ue]);ee(LO,[se,Q,ae,UO],[ue]);ee(UO,[se,Q,ae],[ue]);ee(FO,[se,ai,Q,ae,Ly],[ue]);ee(Ly,[Vt,se,Nt,mn,cn,hi,ai,Q,Yl,tl,nl,IS,Wl,ae],[xg,ue]);ee(sA,[Vt,se,Q,ae,lA],[]);ee(cA,[se,ri,Q,ae],[]);ee(lA,[se,ri,vA,Q,ae],[]);ee(dA,[se,ri,Q,ae],[]);ee(pA,[se,Q,ae,uA,mA,gA],[]);ee(uA,[se,Q,ae,ao],[ue]);ee(mA,[se,Q,ae],[ue]);ee(gA,[se,Q,ae],[ue]);ee(hA,[se,Q,ae],[]);ee(SA,[se,Q,ae,ao,yA,xA],[]);ee(bA,[se,Q,ae],[]);ee(fA,[se,Q,ae,CA,_A],[]);ee(IA,[se,Q,ae],[]);ee(CA,[se,ri,Q,ae],[]);ee(_A,[se,Q,ae],[]);ee(yA,[se,Q,ae],[ue]);ee(xA,[se,Q,ae],[ue]);ee(EA,[se,Q,ae],[]);ee(kA,[se,Q,ae],[]);ee(TA,[se,Q,ae,QD,EA],[]);ee(wA,[se,ai,Q,ae,DA,OA,MA],[]);ee(DA,[se,Q,ae],[]);ee(OA,[se,Q,ae,AA,PA],[]);ee(MA,[se,Q,ae],[]);ee(AA,[se,Q,ae],[]);ee(PA,[se,Q,ae],[]);ee(RA,[se,Q,ae],[]);ee(NA,[se,Q,ae],[]);ee(FA,[se,Q,ae],[ue]);ee(UA,[se,Q,ae],[]);ee(Wy,[se,Q,ae],[]);ee(uN,[se,mn,cn,hi,ai,Q,ae,WA,zA],[ue]);ee(WA,[se,Q,ae,GA,qA],[]);ee(GA,[se,Q,ae],[ue]);ee(qA,[se,Q,ae],[]);ee(zA,[se,ai,Q,ae,HA],[ue]);ee(HA,[Vt,se,Q,ae,$A],[]);ee(vN,[se,Q,ae],[ue]);ee($A,[se,Q,ae,VA,jA],[]);ee(VA,[se,Q,ae],[]);ee(jA,[se,Q,ae],[ue]);ee(Bw,[Md,Q,ae],[ue]);ee(Df,[Q,ae,G_,z_,H_,my],[ue]);ee(G_,[Q,ae,ao],[ue]);ee(z_,[ri,Q,ae],[ue]);ee(H_,[aK,Q,ae],[]);ee(my,[Q,hK,ae],[]);ee(e0,[Q,ae],[ue]);ee(Sb,[aK,Q,ae],[ue]);ee(wf,[Q,ae],[ue]);ee(Ou,[ai,Q,Ad,ae],[ue]);ee(L3,[Q,ae],[ue]);ee(W_,[Q,ae],[ue]);ee(q_,[Q,ae],[ue]);ee(Pf,[Q,ae],[ue]);ee(qy,[Q,ae],[ue]);ee(_b,[Q,ae],[ue]);ee(fy,[Q,ae],[ue]);ee(Rf,[Q,ae],[ue]);ee(Nf,[Q,ae],[ue]);ee(Uf,[Q,ae],[ue]);ee(gy,[Q,hK,ae],[ue]);ee(Ff,[Q,ae,yb,xb],[ue]);ee(yb,[Q,ae],[ue]);ee(xb,[Q,ae],[ue]);ee(Tf,[Q,ae],[ue]);ee(qb,[Md,Q,ae],[ue]);ee(Wk,[Q,ae],[ue]);ee(Gy,[Q,ae],[ue]);ee(Wb,[Q,ae,Oy,Dy,Ay],[ue]);ee(Oy,[Q,ae],[]);ee(Dy,[Q,ae],[]);ee(Ay,[Q,ae],[ue]);ee(Vy,[Q,ae,Hy,$y],[]);ee(Hy,[ri,Q,ae],[]);ee($y,[Q,ae,jy],[]);ee(jy,[ri,Q,ae],[]);ee(ES,[ri,Q,ae],[]);ee(bb,[Q,ae],[ue]);ee(hb,[Q,ae,pb,sb],[ue]);ee(fb,[hk,Q,Ad,ae],[]);ee(Q_,[Kye,Q,ae],[ue]);ee(Cb,[ev,bN,Q,ae],[ue]);ee(Z_,[xN,Xye,Xy,Q,vK,ae],[ue]);ee(Au,[Q,Zf,ae,ES,bb,hb,fb,Q_,Cb,Z_,X_],[ue]);ee(ib,[Q,ae,eb,nb,tb],[]);ee(eb,[Q,ae],[]);ee(nb,[Q,ae],[]);ee(tb,[Q,ae],[ue]);ee(ub,[Q,ae,db,gb,vb,mb,cb],[ue]);ee(pb,[Q,ae,ib,ub],[]);ee(db,[Q,gK,ae],[]);ee(gb,[Q,ae],[ue]);ee(vb,[Q,ae],[mK]);ee(mb,[Q,ae],[]);ee(cb,[Q,ae],[ue]);ee(sb,[Q,ae,lb],[]);ee(lb,[Q,ae,rb,ob,ab],[]);ee(rb,[Q,ae],[]);ee(ob,[Q,ae],[]);ee(ab,[Q,ae],[]);ee(X_,[Q,ae,J_],[ue]);ee(J_,[Q,ae],[ue]);ee(Of,[Q,ae,qy,Wb,Vy,Gb],[ue]);ee(Mf,[Q,Zf,ae,Sb,Ou,W_,q_,fy,gy,qb,Gy,Wf,Hf,Vf],[ue]);ee(Gb,[Q,ae,_b,zb],[Lxe,ue]);ee(zb,[Q,ae,Ib,Eb,hy,Ub,Hb,US,zy,Bb,Lb,Fb,Lf,Vb,jb,$b,_y],[ue]);ee(Ib,[ri,Q,ae],[ue]);ee(Eb,[Zye,Pd,Q,ae],[ue]);ee(hy,[Q,ae],[ue]);ee(Ub,[Q,ae,ao],[Nxe]);ee(Hb,[Q,ae],[$B,hp]);ee(US,[Q,ae],[ue]);ee(zy,[Q,ae],[ue]);ee(Bb,[Q,ae,Ou,Vf],[]);ee(Wf,[$m,Q,Gf,zf,ae],[]);ee(Xk,[Q,ae,Wf],[]);ee(Jk,[Q,ae,Hf],[]);ee(Qk,[Q,ae,Ou,Vf],[]);ee(tp,[Q,ae],[Ym]);ee(np,[Q,ae],[]);ee(ep,[Q,ae],[]);ee(Gf,[Ko,Q,tp,np,ep,ae],[]);ee(Xu,[Q,ae],[Ym]);ee(Ju,[Q,ae],[]);ee(Qu,[Q,Xu,Ju,ae],[]);ee(zf,[Q,Qu,ae],[]);ee(Hf,[$m,Q,$f,jf,ae],[]);ee($f,[Q,qu,Ku,Yu,ae],[]);ee(Yu,[Q,ae],[Ac]);ee(Ku,[se,Q,ae],[]);ee(qu,[Q,ae],[]);ee(jf,[Q,Wu,ae],[]);ee(Wu,[Q,Hu,zu,Gu,ae],[]);ee(Hu,[Q,ae],[Ac]);ee(zu,[Q,ae],[]);ee(Gu,[Q,ae],[]);ee(ju,[Q,ae],[ue]);ee(Vu,[Q,Bu,Pu,Fu,Nu,ae,Xf,Bf],[]);ee(Uu,[Q,ae],[ue]);ee(Lu,[Q,ae],[ue]);ee(Bu,[Q,Lu,Uu,ae],[]);ee(Pu,[Q,ae],[ue]);ee(Fu,[Q,ae],[ue]);ee(Xf,[Q,ae,NS,FS],[]);ee(NS,[Q,ae],[ue]);ee(FS,[Q,ae],[ue]);ee(Bf,[Q,ae,Yb,Kb],[ue]);ee(Yb,[Q,ae],[ue]);ee(Kb,[Q,ae],[ue]);ee(Mu,[Q,ae],[ue]);ee(Ru,[Q,ae],[ue]);ee(Nu,[Q,Ru,Mu,ae],[ue]);ee(BA,[Q,ae],[ue]);ee(Lb,[Q,ae,ao],[Ac,Fxe,ue,yxe]);ee(Fb,[Q,ae,Nb,Db],[ue]);ee(Nb,[Q,ae,ao,Ab,Ob,Rb,Mb,Pb],[ue]);ee(Ab,[Q,ae],[ue]);ee(Ob,[Q,ae],[ue]);ee(Rb,[Q,ae],[ue,mK]);ee(Mb,[Q,ae],[ue]);ee(Pb,[Q,gK,ae],[]);ee(Db,[Q,ae,ao,wb,Tb,kb],[ue]);ee(wb,[Q,ae],[ue]);ee(Tb,[Q,ae],[ue]);ee(kb,[Vue,Q,ae],[ue]);ee(Lf,[Jy,Q,ae],[]);ee(Vb,[fp,Q,ae,Lf],[ue]);ee(qk,[fp,Q,ae],[]);ee(Yk,[Pd,Q,ae],[ue]);ee(jb,[Q,ae,Au],[ue]);ee($b,[ev,Q,ae],[]);ee(Sy,[ri,Q,ae],[ue]);ee(xy,[Q,ae],[ue]);ee(yy,[Q,ae],[hp,ue]);ee(Iy,[Q,ae],[ue]);ee(by,[Q,ae,Sy,xy,yy],[]);ee(Ty,[Q,ae,by],[ue]);ee(ky,[Q,ae],[ue]);ee(Ey,[Nt,Q,jn,ae,Iy,Ty],[ue]);ee(_y,[$m,Q,ae,ky,Ey],[ue]);var Wxe=!0,qxe=!0;function tx(n,r,i){let e=n.match(r);return e&&e.length>=i&&parseFloat(e[i],10)}function Km(n,r,i){if(!n.RTCPeerConnection)return;let e=n.RTCPeerConnection.prototype,t=e.addEventListener;e.addEventListener=function(a,l){if(a!==r)return t.apply(this,arguments);let s=d=>{let v=i(d);v&&(l.handleEvent?l.handleEvent(v):l(v))};return this._eventMap=this._eventMap||{},this._eventMap[r]||(this._eventMap[r]=new Map),this._eventMap[r].set(l,s),t.apply(this,[a,s])};let o=e.removeEventListener;e.removeEventListener=function(a,l){if(a!==r||!this._eventMap||!this._eventMap[r])return o.apply(this,arguments);if(!this._eventMap[r].has(l))return o.apply(this,arguments);let s=this._eventMap[r].get(l);return this._eventMap[r].delete(l),this._eventMap[r].size===0&&delete this._eventMap[r],Object.keys(this._eventMap).length===0&&delete this._eventMap,o.apply(this,[a,s])},Object.defineProperty(e,"on"+r,{get(){return this["_on"+r]},set(a){this["_on"+r]&&(this.removeEventListener(r,this["_on"+r]),delete this["_on"+r]),a&&this.addEventListener(r,this["_on"+r]=a)},enumerable:!0,configurable:!0})}function Yxe(n){return typeof n!="boolean"?new Error("Argument type: "+typeof n+". Please use a boolean."):(Wxe=n,n?"adapter.js logging disabled":"adapter.js logging enabled")}function Kxe(n){return typeof n!="boolean"?new Error("Argument type: "+typeof n+". Please use a boolean."):(qxe=!n,"adapter.js deprecation warnings "+(n?"disabled":"enabled"))}function TN(){if(typeof window=="object"){if(Wxe)return;typeof console<"u"&&typeof console.log=="function"&&console.log.apply(console,arguments)}}function nx(n,r){qxe&&console.warn(n+" is deprecated, please use "+r+" instead.")}function Zxe(n){let r={browser:null,version:null};if(typeof n>"u"||!n.navigator||!n.navigator.userAgent)return r.browser="Not a browser.",r;let{navigator:i}=n;if(i.mozGetUserMedia)r.browser="firefox",r.version=parseInt(tx(i.userAgent,/Firefox\/(\d+)\./,1));else if(i.webkitGetUserMedia||n.isSecureContext===!1&&n.webkitRTCPeerConnection)r.browser="chrome",r.version=parseInt(tx(i.userAgent,/Chrom(e|ium)\/(\d+)\./,2));else if(n.RTCPeerConnection&&i.userAgent.match(/AppleWebKit\/(\d+)\./))r.browser="safari",r.version=parseInt(tx(i.userAgent,/AppleWebKit\/(\d+)\./,1)),r.supportsUnifiedPlan=n.RTCRtpTransceiver&&"currentDirection"in n.RTCRtpTransceiver.prototype,r._safariVersion=tx(i.userAgent,/Version\/(\d+(\.?\d+))/,1);else return r.browser="Not a supported browser.",r;return r}function Gxe(n){return Object.prototype.toString.call(n)==="[object Object]"}function CK(n){return Gxe(n)?Object.keys(n).reduce(function(r,i){let e=Gxe(n[i]),t=e?CK(n[i]):n[i],o=e&&!Object.keys(t).length;return t===void 0||o?r:Object.assign(r,{[i]:t})},{}):n}function fK(n,r,i){!r||i.has(r.id)||(i.set(r.id,r),Object.keys(r).forEach(e=>{e.endsWith("Id")?fK(n,n.get(r[e]),i):e.endsWith("Ids")&&r[e].forEach(t=>{fK(n,n.get(t),i)})}))}function _K(n,r,i){let e=i?"outbound-rtp":"inbound-rtp",t=new Map;if(r===null)return t;let o=[];return n.forEach(a=>{a.type==="track"&&a.trackIdentifier===r.id&&o.push(a)}),o.forEach(a=>{n.forEach(l=>{l.type===e&&l.trackId===a.id&&fK(n,l,t)})}),t}var ON={};b4(ON,{fixNegotiationNeeded:()=>kK,shimAddTrackRemoveTrack:()=>EK,shimAddTrackRemoveTrackWithNative:()=>Qxe,shimGetDisplayMedia:()=>Jxe,shimGetSendersWithDtmf:()=>yK,shimGetStats:()=>xK,shimGetUserMedia:()=>wN,shimMediaStream:()=>bK,shimOnTrack:()=>SK,shimPeerConnection:()=>DN,shimSenderReceiverGetStats:()=>IK});var Xxe=TN;function wN(n,r){let i=n&&n.navigator;if(!i.mediaDevices)return;let e=function(l){if(typeof l!="object"||l.mandatory||l.optional)return l;let s={};return Object.keys(l).forEach(d=>{if(d==="require"||d==="advanced"||d==="mediaSource")return;let v=typeof l[d]=="object"?l[d]:{ideal:l[d]};v.exact!==void 0&&typeof v.exact=="number"&&(v.min=v.max=v.exact);let u=function(S,k){return S?S+k.charAt(0).toUpperCase()+k.slice(1):k==="deviceId"?"sourceId":k};if(v.ideal!==void 0){s.optional=s.optional||[];let S={};typeof v.ideal=="number"?(S[u("min",d)]=v.ideal,s.optional.push(S),S={},S[u("max",d)]=v.ideal,s.optional.push(S)):(S[u("",d)]=v.ideal,s.optional.push(S))}v.exact!==void 0&&typeof v.exact!="number"?(s.mandatory=s.mandatory||{},s.mandatory[u("",d)]=v.exact):["min","max"].forEach(S=>{v[S]!==void 0&&(s.mandatory=s.mandatory||{},s.mandatory[u(S,d)]=v[S])})}),l.advanced&&(s.optional=(s.optional||[]).concat(l.advanced)),s},t=function(l,s){if(r.version>=61)return s(l);if(l=JSON.parse(JSON.stringify(l)),l&&typeof l.audio=="object"){let d=function(v,u,S){u in v&&!(S in v)&&(v[S]=v[u],delete v[u])};l=JSON.parse(JSON.stringify(l)),d(l.audio,"autoGainControl","googAutoGainControl"),d(l.audio,"noiseSuppression","googNoiseSuppression"),l.audio=e(l.audio)}if(l&&typeof l.video=="object"){let d=l.video.facingMode;d=d&&(typeof d=="object"?d:{ideal:d});let v=r.version<66;if(d&&(d.exact==="user"||d.exact==="environment"||d.ideal==="user"||d.ideal==="environment")&&!(i.mediaDevices.getSupportedConstraints&&i.mediaDevices.getSupportedConstraints().facingMode&&!v)){delete l.video.facingMode;let u;if(d.exact==="environment"||d.ideal==="environment"?u=["back","rear"]:(d.exact==="user"||d.ideal==="user")&&(u=["front"]),u)return i.mediaDevices.enumerateDevices().then(S=>{S=S.filter(A=>A.kind==="videoinput");let k=S.find(A=>u.some(P=>A.label.toLowerCase().includes(P)));return!k&&S.length&&u.includes("back")&&(k=S[S.length-1]),k&&(l.video.deviceId=d.exact?{exact:k.deviceId}:{ideal:k.deviceId}),l.video=e(l.video),Xxe("chrome: "+JSON.stringify(l)),s(l)})}l.video=e(l.video)}return Xxe("chrome: "+JSON.stringify(l)),s(l)},o=function(l){return r.version>=64?l:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[l.name]||l.name,message:l.message,constraint:l.constraint||l.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}},a=function(l,s,d){t(l,v=>{i.webkitGetUserMedia(v,s,u=>{d&&d(o(u))})})};if(i.getUserMedia=a.bind(i),i.mediaDevices.getUserMedia){let l=i.mediaDevices.getUserMedia.bind(i.mediaDevices);i.mediaDevices.getUserMedia=function(s){return t(s,d=>l(d).then(v=>{if(d.audio&&!v.getAudioTracks().length||d.video&&!v.getVideoTracks().length)throw v.getTracks().forEach(u=>{u.stop()}),new DOMException("","NotFoundError");return v},v=>Promise.reject(o(v))))}}}function Jxe(n,r){if(!(n.navigator.mediaDevices&&"getDisplayMedia"in n.navigator.mediaDevices)&&n.navigator.mediaDevices){if(typeof r!="function"){console.error("shimGetDisplayMedia: getSourceId argument is not a function");return}n.navigator.mediaDevices.getDisplayMedia=function(e){return r(e).then(t=>{let o=e.video&&e.video.width,a=e.video&&e.video.height,l=e.video&&e.video.frameRate;return e.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:l||3}},o&&(e.video.mandatory.maxWidth=o),a&&(e.video.mandatory.maxHeight=a),n.navigator.mediaDevices.getUserMedia(e)})}}}function bK(n){n.MediaStream=n.MediaStream||n.webkitMediaStream}function SK(n){if(typeof n=="object"&&n.RTCPeerConnection&&!("ontrack"in n.RTCPeerConnection.prototype)){Object.defineProperty(n.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(i){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=i)},enumerable:!0,configurable:!0});let r=n.RTCPeerConnection.prototype.setRemoteDescription;n.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=e=>{e.stream.addEventListener("addtrack",t=>{let o;n.RTCPeerConnection.prototype.getReceivers?o=this.getReceivers().find(l=>l.track&&l.track.id===t.track.id):o={track:t.track};let a=new Event("track");a.track=t.track,a.receiver=o,a.transceiver={receiver:o},a.streams=[e.stream],this.dispatchEvent(a)}),e.stream.getTracks().forEach(t=>{let o;n.RTCPeerConnection.prototype.getReceivers?o=this.getReceivers().find(l=>l.track&&l.track.id===t.id):o={track:t};let a=new Event("track");a.track=t,a.receiver=o,a.transceiver={receiver:o},a.streams=[e.stream],this.dispatchEvent(a)})},this.addEventListener("addstream",this._ontrackpoly)),r.apply(this,arguments)}}else Km(n,"track",r=>(r.transceiver||Object.defineProperty(r,"transceiver",{value:{receiver:r.receiver}}),r))}function yK(n){if(typeof n=="object"&&n.RTCPeerConnection&&!("getSenders"in n.RTCPeerConnection.prototype)&&"createDTMFSender"in n.RTCPeerConnection.prototype){let r=function(t,o){return{track:o,get dtmf(){return this._dtmf===void 0&&(o.kind==="audio"?this._dtmf=t.createDTMFSender(o):this._dtmf=null),this._dtmf},_pc:t}};if(!n.RTCPeerConnection.prototype.getSenders){n.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};let t=n.RTCPeerConnection.prototype.addTrack;n.RTCPeerConnection.prototype.addTrack=function(l,s){let d=t.apply(this,arguments);return d||(d=r(this,l),this._senders.push(d)),d};let o=n.RTCPeerConnection.prototype.removeTrack;n.RTCPeerConnection.prototype.removeTrack=function(l){o.apply(this,arguments);let s=this._senders.indexOf(l);s!==-1&&this._senders.splice(s,1)}}let i=n.RTCPeerConnection.prototype.addStream;n.RTCPeerConnection.prototype.addStream=function(o){this._senders=this._senders||[],i.apply(this,[o]),o.getTracks().forEach(a=>{this._senders.push(r(this,a))})};let e=n.RTCPeerConnection.prototype.removeStream;n.RTCPeerConnection.prototype.removeStream=function(o){this._senders=this._senders||[],e.apply(this,[o]),o.getTracks().forEach(a=>{let l=this._senders.find(s=>s.track===a);l&&this._senders.splice(this._senders.indexOf(l),1)})}}else if(typeof n=="object"&&n.RTCPeerConnection&&"getSenders"in n.RTCPeerConnection.prototype&&"createDTMFSender"in n.RTCPeerConnection.prototype&&n.RTCRtpSender&&!("dtmf"in n.RTCRtpSender.prototype)){let r=n.RTCPeerConnection.prototype.getSenders;n.RTCPeerConnection.prototype.getSenders=function(){let e=r.apply(this,[]);return e.forEach(t=>t._pc=this),e},Object.defineProperty(n.RTCRtpSender.prototype,"dtmf",{get(){return this._dtmf===void 0&&(this.track.kind==="audio"?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function xK(n){if(!n.RTCPeerConnection)return;let r=n.RTCPeerConnection.prototype.getStats;n.RTCPeerConnection.prototype.getStats=function(){let[e,t,o]=arguments;if(arguments.length>0&&typeof e=="function")return r.apply(this,arguments);if(r.length===0&&(arguments.length===0||typeof e!="function"))return r.apply(this,[]);let a=function(s){let d={};return s.result().forEach(u=>{let S={id:u.id,timestamp:u.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[u.type]||u.type};u.names().forEach(k=>{S[k]=u.stat(k)}),d[S.id]=S}),d},l=function(s){return new Map(Object.keys(s).map(d=>[d,s[d]]))};if(arguments.length>=2){let s=function(d){t(l(a(d)))};return r.apply(this,[s,e])}return new Promise((s,d)=>{r.apply(this,[function(v){s(l(a(v)))},d])}).then(t,o)}}function IK(n){if(!(typeof n=="object"&&n.RTCPeerConnection&&n.RTCRtpSender&&n.RTCRtpReceiver))return;if(!("getStats"in n.RTCRtpSender.prototype)){let i=n.RTCPeerConnection.prototype.getSenders;i&&(n.RTCPeerConnection.prototype.getSenders=function(){let o=i.apply(this,[]);return o.forEach(a=>a._pc=this),o});let e=n.RTCPeerConnection.prototype.addTrack;e&&(n.RTCPeerConnection.prototype.addTrack=function(){let o=e.apply(this,arguments);return o._pc=this,o}),n.RTCRtpSender.prototype.getStats=function(){let o=this;return this._pc.getStats().then(a=>_K(a,o.track,!0))}}if(!("getStats"in n.RTCRtpReceiver.prototype)){let i=n.RTCPeerConnection.prototype.getReceivers;i&&(n.RTCPeerConnection.prototype.getReceivers=function(){let t=i.apply(this,[]);return t.forEach(o=>o._pc=this),t}),Km(n,"track",e=>(e.receiver._pc=e.srcElement,e)),n.RTCRtpReceiver.prototype.getStats=function(){let t=this;return this._pc.getStats().then(o=>_K(o,t.track,!1))}}if(!("getStats"in n.RTCRtpSender.prototype&&"getStats"in n.RTCRtpReceiver.prototype))return;let r=n.RTCPeerConnection.prototype.getStats;n.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof n.MediaStreamTrack){let e=arguments[0],t,o,a;return this.getSenders().forEach(l=>{l.track===e&&(t?a=!0:t=l)}),this.getReceivers().forEach(l=>(l.track===e&&(o?a=!0:o=l),l.track===e)),a||t&&o?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():o?o.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return r.apply(this,arguments)}}function Qxe(n){n.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(a=>this._shimmedLocalStreams[a][0])};let r=n.RTCPeerConnection.prototype.addTrack;n.RTCPeerConnection.prototype.addTrack=function(a,l){if(!l)return r.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};let s=r.apply(this,arguments);return this._shimmedLocalStreams[l.id]?this._shimmedLocalStreams[l.id].indexOf(s)===-1&&this._shimmedLocalStreams[l.id].push(s):this._shimmedLocalStreams[l.id]=[l,s],s};let i=n.RTCPeerConnection.prototype.addStream;n.RTCPeerConnection.prototype.addStream=function(a){this._shimmedLocalStreams=this._shimmedLocalStreams||{},a.getTracks().forEach(d=>{if(this.getSenders().find(u=>u.track===d))throw new DOMException("Track already exists.","InvalidAccessError")});let l=this.getSenders();i.apply(this,arguments);let s=this.getSenders().filter(d=>l.indexOf(d)===-1);this._shimmedLocalStreams[a.id]=[a].concat(s)};let e=n.RTCPeerConnection.prototype.removeStream;n.RTCPeerConnection.prototype.removeStream=function(a){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[a.id],e.apply(this,arguments)};let t=n.RTCPeerConnection.prototype.removeTrack;n.RTCPeerConnection.prototype.removeTrack=function(a){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},a&&Object.keys(this._shimmedLocalStreams).forEach(l=>{let s=this._shimmedLocalStreams[l].indexOf(a);s!==-1&&this._shimmedLocalStreams[l].splice(s,1),this._shimmedLocalStreams[l].length===1&&delete this._shimmedLocalStreams[l]}),t.apply(this,arguments)}}function EK(n,r){if(!n.RTCPeerConnection)return;if(n.RTCPeerConnection.prototype.addTrack&&r.version>=65)return Qxe(n);let i=n.RTCPeerConnection.prototype.getLocalStreams;n.RTCPeerConnection.prototype.getLocalStreams=function(){let v=i.apply(this);return this._reverseStreams=this._reverseStreams||{},v.map(u=>this._reverseStreams[u.id])};let e=n.RTCPeerConnection.prototype.addStream;n.RTCPeerConnection.prototype.addStream=function(v){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},v.getTracks().forEach(u=>{if(this.getSenders().find(k=>k.track===u))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[v.id]){let u=new n.MediaStream(v.getTracks());this._streams[v.id]=u,this._reverseStreams[u.id]=v,v=u}e.apply(this,[v])};let t=n.RTCPeerConnection.prototype.removeStream;n.RTCPeerConnection.prototype.removeStream=function(v){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.apply(this,[this._streams[v.id]||v]),delete this._reverseStreams[this._streams[v.id]?this._streams[v.id].id:v.id],delete this._streams[v.id]},n.RTCPeerConnection.prototype.addTrack=function(v,u){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");let S=[].slice.call(arguments,1);if(S.length!==1||!S[0].getTracks().find(P=>P===v))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");if(this.getSenders().find(P=>P.track===v))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};let A=this._streams[u.id];if(A)A.addTrack(v),Promise.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{let P=new n.MediaStream([v]);this._streams[u.id]=P,this._reverseStreams[P.id]=u,this.addStream(P)}return this.getSenders().find(P=>P.track===v)};function o(d,v){let u=v.sdp;return Object.keys(d._reverseStreams||[]).forEach(S=>{let k=d._reverseStreams[S],A=d._streams[k.id];u=u.replace(new RegExp(A.id,"g"),k.id)}),new RTCSessionDescription({type:v.type,sdp:u})}function a(d,v){let u=v.sdp;return Object.keys(d._reverseStreams||[]).forEach(S=>{let k=d._reverseStreams[S],A=d._streams[k.id];u=u.replace(new RegExp(k.id,"g"),A.id)}),new RTCSessionDescription({type:v.type,sdp:u})}["createOffer","createAnswer"].forEach(function(d){let v=n.RTCPeerConnection.prototype[d],u={[d](){let S=arguments;return arguments.length&&typeof arguments[0]=="function"?v.apply(this,[A=>{let P=o(this,A);S[0].apply(null,[P])},A=>{S[1]&&S[1].apply(null,A)},arguments[2]]):v.apply(this,arguments).then(A=>o(this,A))}};n.RTCPeerConnection.prototype[d]=u[d]});let l=n.RTCPeerConnection.prototype.setLocalDescription;n.RTCPeerConnection.prototype.setLocalDescription=function(){return!arguments.length||!arguments[0].type?l.apply(this,arguments):(arguments[0]=a(this,arguments[0]),l.apply(this,arguments))};let s=Object.getOwnPropertyDescriptor(n.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(n.RTCPeerConnection.prototype,"localDescription",{get(){let d=s.get.apply(this);return d.type===""?d:o(this,d)}}),n.RTCPeerConnection.prototype.removeTrack=function(v){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!v._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(v._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{};let S;Object.keys(this._streams).forEach(k=>{this._streams[k].getTracks().find(P=>v.track===P)&&(S=this._streams[k])}),S&&(S.getTracks().length===1?this.removeStream(this._reverseStreams[S.id]):S.removeTrack(v.track),this.dispatchEvent(new Event("negotiationneeded")))}}function DN(n,r){!n.RTCPeerConnection&&n.webkitRTCPeerConnection&&(n.RTCPeerConnection=n.webkitRTCPeerConnection),n.RTCPeerConnection&&r.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(i){let e=n.RTCPeerConnection.prototype[i],t={[i](){return arguments[0]=new(i==="addIceCandidate"?n.RTCIceCandidate:n.RTCSessionDescription)(arguments[0]),e.apply(this,arguments)}};n.RTCPeerConnection.prototype[i]=t[i]})}function kK(n,r){Km(n,"negotiationneeded",i=>{let e=i.target;if(!((r.version<72||e.getConfiguration&&e.getConfiguration().sdpSemantics==="plan-b")&&e.signalingState!=="stable"))return i})}var MN={};b4(MN,{shimAddTransceiver:()=>PK,shimCreateAnswer:()=>NK,shimCreateOffer:()=>RK,shimGetDisplayMedia:()=>eIe,shimGetParameters:()=>MK,shimGetUserMedia:()=>AN,shimOnTrack:()=>TK,shimPeerConnection:()=>PN,shimRTCDataChannel:()=>AK,shimReceiverGetStats:()=>DK,shimRemoveStream:()=>OK,shimSenderGetStats:()=>wK});function AN(n,r){let i=n&&n.navigator,e=n&&n.MediaStreamTrack;if(i.getUserMedia=function(t,o,a){nx("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),i.mediaDevices.getUserMedia(t).then(o,a)},!(r.version>55&&"autoGainControl"in i.mediaDevices.getSupportedConstraints())){let t=function(a,l,s){l in a&&!(s in a)&&(a[s]=a[l],delete a[l])},o=i.mediaDevices.getUserMedia.bind(i.mediaDevices);if(i.mediaDevices.getUserMedia=function(a){return typeof a=="object"&&typeof a.audio=="object"&&(a=JSON.parse(JSON.stringify(a)),t(a.audio,"autoGainControl","mozAutoGainControl"),t(a.audio,"noiseSuppression","mozNoiseSuppression")),o(a)},e&&e.prototype.getSettings){let a=e.prototype.getSettings;e.prototype.getSettings=function(){let l=a.apply(this,arguments);return t(l,"mozAutoGainControl","autoGainControl"),t(l,"mozNoiseSuppression","noiseSuppression"),l}}if(e&&e.prototype.applyConstraints){let a=e.prototype.applyConstraints;e.prototype.applyConstraints=function(l){return this.kind==="audio"&&typeof l=="object"&&(l=JSON.parse(JSON.stringify(l)),t(l,"autoGainControl","mozAutoGainControl"),t(l,"noiseSuppression","mozNoiseSuppression")),a.apply(this,[l])}}}}function eIe(n,r){n.navigator.mediaDevices&&"getDisplayMedia"in n.navigator.mediaDevices||n.navigator.mediaDevices&&(n.navigator.mediaDevices.getDisplayMedia=function(e){if(!(e&&e.video)){let t=new DOMException("getDisplayMedia without video constraints is undefined");return t.name="NotFoundError",t.code=8,Promise.reject(t)}return e.video===!0?e.video={mediaSource:r}:e.video.mediaSource=r,n.navigator.mediaDevices.getUserMedia(e)})}function TK(n){typeof n=="object"&&n.RTCTrackEvent&&"receiver"in n.RTCTrackEvent.prototype&&!("transceiver"in n.RTCTrackEvent.prototype)&&Object.defineProperty(n.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function PN(n,r){if(typeof n!="object"||!(n.RTCPeerConnection||n.mozRTCPeerConnection))return;!n.RTCPeerConnection&&n.mozRTCPeerConnection&&(n.RTCPeerConnection=n.mozRTCPeerConnection),r.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(t){let o=n.RTCPeerConnection.prototype[t],a={[t](){return arguments[0]=new(t==="addIceCandidate"?n.RTCIceCandidate:n.RTCSessionDescription)(arguments[0]),o.apply(this,arguments)}};n.RTCPeerConnection.prototype[t]=a[t]});let i={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},e=n.RTCPeerConnection.prototype.getStats;n.RTCPeerConnection.prototype.getStats=function(){let[o,a,l]=arguments;return e.apply(this,[o||null]).then(s=>{if(r.version<53&&!a)try{s.forEach(d=>{d.type=i[d.type]||d.type})}catch(d){if(d.name!=="TypeError")throw d;s.forEach((v,u)=>{s.set(u,Object.assign({},v,{type:i[v.type]||v.type}))})}return s}).then(a,l)}}function wK(n){if(!(typeof n=="object"&&n.RTCPeerConnection&&n.RTCRtpSender)||n.RTCRtpSender&&"getStats"in n.RTCRtpSender.prototype)return;let r=n.RTCPeerConnection.prototype.getSenders;r&&(n.RTCPeerConnection.prototype.getSenders=function(){let t=r.apply(this,[]);return t.forEach(o=>o._pc=this),t});let i=n.RTCPeerConnection.prototype.addTrack;i&&(n.RTCPeerConnection.prototype.addTrack=function(){let t=i.apply(this,arguments);return t._pc=this,t}),n.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function DK(n){if(!(typeof n=="object"&&n.RTCPeerConnection&&n.RTCRtpSender)||n.RTCRtpSender&&"getStats"in n.RTCRtpReceiver.prototype)return;let r=n.RTCPeerConnection.prototype.getReceivers;r&&(n.RTCPeerConnection.prototype.getReceivers=function(){let e=r.apply(this,[]);return e.forEach(t=>t._pc=this),e}),Km(n,"track",i=>(i.receiver._pc=i.srcElement,i)),n.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function OK(n){!n.RTCPeerConnection||"removeStream"in n.RTCPeerConnection.prototype||(n.RTCPeerConnection.prototype.removeStream=function(i){nx("removeStream","removeTrack"),this.getSenders().forEach(e=>{e.track&&i.getTracks().includes(e.track)&&this.removeTrack(e)})})}function AK(n){n.DataChannel&&!n.RTCDataChannel&&(n.RTCDataChannel=n.DataChannel)}function PK(n){if(!(typeof n=="object"&&n.RTCPeerConnection))return;let r=n.RTCPeerConnection.prototype.addTransceiver;r&&(n.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];let e=arguments[1]&&arguments[1].sendEncodings;e===void 0&&(e=[]),e=[...e];let t=e.length>0;t&&e.forEach(a=>{if("rid"in a&&!/^[a-z0-9]{0,16}$/i.test(a.rid))throw new TypeError("Invalid RID value provided.");if("scaleResolutionDownBy"in a&&!(parseFloat(a.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in a&&!(parseFloat(a.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")});let o=r.apply(this,arguments);if(t){let{sender:a}=o,l=a.getParameters();(!("encodings"in l)||l.encodings.length===1&&Object.keys(l.encodings[0]).length===0)&&(l.encodings=e,a.sendEncodings=e,this.setParametersPromises.push(a.setParameters(l).then(()=>{delete a.sendEncodings}).catch(()=>{delete a.sendEncodings})))}return o})}function MK(n){if(!(typeof n=="object"&&n.RTCRtpSender))return;let r=n.RTCRtpSender.prototype.getParameters;r&&(n.RTCRtpSender.prototype.getParameters=function(){let e=r.apply(this,arguments);return"encodings"in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}function RK(n){if(!(typeof n=="object"&&n.RTCPeerConnection))return;let r=n.RTCPeerConnection.prototype.createOffer;n.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>r.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):r.apply(this,arguments)}}function NK(n){if(!(typeof n=="object"&&n.RTCPeerConnection))return;let r=n.RTCPeerConnection.prototype.createAnswer;n.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>r.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):r.apply(this,arguments)}}var RN={};b4(RN,{shimAudioContext:()=>HK,shimCallbacksAPI:()=>UK,shimConstraints:()=>tIe,shimCreateOfferLegacy:()=>$K,shimGetUserMedia:()=>BK,shimLocalStreamsAPI:()=>FK,shimRTCIceServerUrls:()=>VK,shimRemoteStreamsAPI:()=>LK,shimTrackEventTransceiver:()=>jK});function FK(n){if(!(typeof n!="object"||!n.RTCPeerConnection)){if("getLocalStreams"in n.RTCPeerConnection.prototype||(n.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in n.RTCPeerConnection.prototype)){let r=n.RTCPeerConnection.prototype.addTrack;n.RTCPeerConnection.prototype.addStream=function(e){this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach(t=>r.call(this,t,e)),e.getVideoTracks().forEach(t=>r.call(this,t,e))},n.RTCPeerConnection.prototype.addTrack=function(e,...t){return t&&t.forEach(o=>{this._localStreams?this._localStreams.includes(o)||this._localStreams.push(o):this._localStreams=[o]}),r.apply(this,arguments)}}"removeStream"in n.RTCPeerConnection.prototype||(n.RTCPeerConnection.prototype.removeStream=function(i){this._localStreams||(this._localStreams=[]);let e=this._localStreams.indexOf(i);if(e===-1)return;this._localStreams.splice(e,1);let t=i.getTracks();this.getSenders().forEach(o=>{t.includes(o.track)&&this.removeTrack(o)})})}}function LK(n){if(!(typeof n!="object"||!n.RTCPeerConnection)&&("getRemoteStreams"in n.RTCPeerConnection.prototype||(n.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in n.RTCPeerConnection.prototype))){Object.defineProperty(n.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(i){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=i),this.addEventListener("track",this._onaddstreampoly=e=>{e.streams.forEach(t=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(t))return;this._remoteStreams.push(t);let o=new Event("addstream");o.stream=t,this.dispatchEvent(o)})})}});let r=n.RTCPeerConnection.prototype.setRemoteDescription;n.RTCPeerConnection.prototype.setRemoteDescription=function(){let e=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(t){t.streams.forEach(o=>{if(e._remoteStreams||(e._remoteStreams=[]),e._remoteStreams.indexOf(o)>=0)return;e._remoteStreams.push(o);let a=new Event("addstream");a.stream=o,e.dispatchEvent(a)})}),r.apply(e,arguments)}}}function UK(n){if(typeof n!="object"||!n.RTCPeerConnection)return;let r=n.RTCPeerConnection.prototype,i=r.createOffer,e=r.createAnswer,t=r.setLocalDescription,o=r.setRemoteDescription,a=r.addIceCandidate;r.createOffer=function(d,v){let u=arguments.length>=2?arguments[2]:arguments[0],S=i.apply(this,[u]);return v?(S.then(d,v),Promise.resolve()):S},r.createAnswer=function(d,v){let u=arguments.length>=2?arguments[2]:arguments[0],S=e.apply(this,[u]);return v?(S.then(d,v),Promise.resolve()):S};let l=function(s,d,v){let u=t.apply(this,[s]);return v?(u.then(d,v),Promise.resolve()):u};r.setLocalDescription=l,l=function(s,d,v){let u=o.apply(this,[s]);return v?(u.then(d,v),Promise.resolve()):u},r.setRemoteDescription=l,l=function(s,d,v){let u=a.apply(this,[s]);return v?(u.then(d,v),Promise.resolve()):u},r.addIceCandidate=l}function BK(n){let r=n&&n.navigator;if(r.mediaDevices&&r.mediaDevices.getUserMedia){let i=r.mediaDevices,e=i.getUserMedia.bind(i);r.mediaDevices.getUserMedia=t=>e(tIe(t))}!r.getUserMedia&&r.mediaDevices&&r.mediaDevices.getUserMedia&&(r.getUserMedia=(function(e,t,o){r.mediaDevices.getUserMedia(e).then(t,o)}).bind(r))}function tIe(n){return n&&n.video!==void 0?Object.assign({},n,{video:CK(n.video)}):n}function VK(n){if(!n.RTCPeerConnection)return;let r=n.RTCPeerConnection;n.RTCPeerConnection=function(e,t){if(e&&e.iceServers){let o=[];for(let a=0;a<e.iceServers.length;a++){let l=e.iceServers[a];l.urls===void 0&&l.url?(nx("RTCIceServer.url","RTCIceServer.urls"),l=JSON.parse(JSON.stringify(l)),l.urls=l.url,delete l.url,o.push(l)):o.push(e.iceServers[a])}e.iceServers=o}return new r(e,t)},n.RTCPeerConnection.prototype=r.prototype,"generateCertificate"in r&&Object.defineProperty(n.RTCPeerConnection,"generateCertificate",{get(){return r.generateCertificate}})}function jK(n){typeof n=="object"&&n.RTCTrackEvent&&"receiver"in n.RTCTrackEvent.prototype&&!("transceiver"in n.RTCTrackEvent.prototype)&&Object.defineProperty(n.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function $K(n){let r=n.RTCPeerConnection.prototype.createOffer;n.RTCPeerConnection.prototype.createOffer=function(e){if(e){typeof e.offerToReceiveAudio<"u"&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);let t=this.getTransceivers().find(a=>a.receiver.track.kind==="audio");e.offerToReceiveAudio===!1&&t?t.direction==="sendrecv"?t.setDirection?t.setDirection("sendonly"):t.direction="sendonly":t.direction==="recvonly"&&(t.setDirection?t.setDirection("inactive"):t.direction="inactive"):e.offerToReceiveAudio===!0&&!t&&this.addTransceiver("audio",{direction:"recvonly"}),typeof e.offerToReceiveVideo<"u"&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);let o=this.getTransceivers().find(a=>a.receiver.track.kind==="video");e.offerToReceiveVideo===!1&&o?o.direction==="sendrecv"?o.setDirection?o.setDirection("sendonly"):o.direction="sendonly":o.direction==="recvonly"&&(o.setDirection?o.setDirection("inactive"):o.direction="inactive"):e.offerToReceiveVideo===!0&&!o&&this.addTransceiver("video",{direction:"recvonly"})}return r.apply(this,arguments)}}function HK(n){typeof n!="object"||n.AudioContext||(n.AudioContext=n.webkitAudioContext)}var WK={};b4(WK,{removeExtmapAllowMixed:()=>LN,shimAddIceCandidateNullOrEmpty:()=>e4,shimConnectionState:()=>FN,shimMaxMessageSize:()=>JA,shimParameterlessSetLocalDescription:()=>t4,shimRTCIceCandidate:()=>XA,shimRTCIceCandidateRelayProtocol:()=>NN,shimSendThrowTypeError:()=>QA});var ix=wZ(GK());function XA(n){if(!n.RTCIceCandidate||n.RTCIceCandidate&&"foundation"in n.RTCIceCandidate.prototype)return;let r=n.RTCIceCandidate;n.RTCIceCandidate=function(e){if(typeof e=="object"&&e.candidate&&e.candidate.indexOf("a=")===0&&(e=JSON.parse(JSON.stringify(e)),e.candidate=e.candidate.substring(2)),e.candidate&&e.candidate.length){let t=new r(e),o=ix.default.parseCandidate(e.candidate);for(let a in o)a in t||Object.defineProperty(t,a,{value:o[a]});return t.toJSON=function(){return{candidate:t.candidate,sdpMid:t.sdpMid,sdpMLineIndex:t.sdpMLineIndex,usernameFragment:t.usernameFragment}},t}return new r(e)},n.RTCIceCandidate.prototype=r.prototype,Km(n,"icecandidate",i=>(i.candidate&&Object.defineProperty(i,"candidate",{value:new n.RTCIceCandidate(i.candidate),writable:"false"}),i))}function NN(n){!n.RTCIceCandidate||n.RTCIceCandidate&&"relayProtocol"in n.RTCIceCandidate.prototype||Km(n,"icecandidate",r=>{if(r.candidate){let i=ix.default.parseCandidate(r.candidate.candidate);i.type==="relay"&&(r.candidate.relayProtocol={0:"tls",1:"tcp",2:"udp"}[i.priority>>24])}return r})}function JA(n,r){if(!n.RTCPeerConnection)return;"sctp"in n.RTCPeerConnection.prototype||Object.defineProperty(n.RTCPeerConnection.prototype,"sctp",{get(){return typeof this._sctp>"u"?null:this._sctp}});let i=function(l){if(!l||!l.sdp)return!1;let s=ix.default.splitSections(l.sdp);return s.shift(),s.some(d=>{let v=ix.default.parseMLine(d);return v&&v.kind==="application"&&v.protocol.indexOf("SCTP")!==-1})},e=function(l){let s=l.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(s===null||s.length<2)return-1;let d=parseInt(s[1],10);return d!==d?-1:d},t=function(l){let s=65536;return r.browser==="firefox"&&(r.version<57?l===-1?s=16384:s=2147483637:r.version<60?s=r.version===57?65535:65536:s=2147483637),s},o=function(l,s){let d=65536;r.browser==="firefox"&&r.version===57&&(d=65535);let v=ix.default.matchPrefix(l.sdp,"a=max-message-size:");return v.length>0?d=parseInt(v[0].substring(19),10):r.browser==="firefox"&&s!==-1&&(d=2147483637),d},a=n.RTCPeerConnection.prototype.setRemoteDescription;n.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,r.browser==="chrome"&&r.version>=76){let{sdpSemantics:s}=this.getConfiguration();s==="plan-b"&&Object.defineProperty(this,"sctp",{get(){return typeof this._sctp>"u"?null:this._sctp},enumerable:!0,configurable:!0})}if(i(arguments[0])){let s=e(arguments[0]),d=t(s),v=o(arguments[0],s),u;d===0&&v===0?u=Number.POSITIVE_INFINITY:d===0||v===0?u=Math.max(d,v):u=Math.min(d,v);let S={};Object.defineProperty(S,"maxMessageSize",{get(){return u}}),this._sctp=S}return a.apply(this,arguments)}}function QA(n){if(!(n.RTCPeerConnection&&"createDataChannel"in n.RTCPeerConnection.prototype))return;function r(e,t){let o=e.send;e.send=function(){let l=arguments[0],s=l.length||l.size||l.byteLength;if(e.readyState==="open"&&t.sctp&&s>t.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+t.sctp.maxMessageSize+" bytes)");return o.apply(e,arguments)}}let i=n.RTCPeerConnection.prototype.createDataChannel;n.RTCPeerConnection.prototype.createDataChannel=function(){let t=i.apply(this,arguments);return r(t,this),t},Km(n,"datachannel",e=>(r(e.channel,e.target),e))}function FN(n){if(!n.RTCPeerConnection||"connectionState"in n.RTCPeerConnection.prototype)return;let r=n.RTCPeerConnection.prototype;Object.defineProperty(r,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(r,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(i){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),i&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=i)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach(i=>{let e=r[i];r[i]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=t=>{let o=t.target;if(o._lastConnectionState!==o.connectionState){o._lastConnectionState=o.connectionState;let a=new Event("connectionstatechange",t);o.dispatchEvent(a)}return t},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),e.apply(this,arguments)}})}function LN(n,r){if(!n.RTCPeerConnection||r.browser==="chrome"&&r.version>=71||r.browser==="safari"&&r._safariVersion>=13.1)return;let i=n.RTCPeerConnection.prototype.setRemoteDescription;n.RTCPeerConnection.prototype.setRemoteDescription=function(t){if(t&&t.sdp&&t.sdp.indexOf(`
|
|
565
565
|
a=extmap-allow-mixed`)!==-1){let o=t.sdp.split(`
|