@veltdev/sdk-dev 4.5.0-beta.166 → 4.5.0-beta.168
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/velt.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var SNIPPYLY_VERSION = '4.5.0-beta.
|
|
1
|
+
var SNIPPYLY_VERSION = '4.5.0-beta.168';
|
|
2
2
|
(function(m,w){"use strict";function rt(){var e=K.splice(0,K.length);for(ie=0;e.length;)e.shift().call(null,e.shift())}function me(e,t){for(var n=0,r=e.length;n<r;n++)Te(e[n],t)}function ot(e){for(var t,n=0,r=e.length;n<r;n++)t=e[n],U(t,q[pe(t)])}function fe(e){return function(t){Lt(t)&&(Te(t,e),L.length&&me(t.querySelectorAll(L),e))}}function pe(e){var t=le.call(e,"is"),n=e.nodeName.toUpperCase(),r=v.call(D,t?Y+t.toUpperCase():x+n);return t&&-1<r&&!De(n,t)?-1:r}function De(e,t){return-1<L.indexOf(e+'[is="'+t+'"]')}function Ie(e){var t=e.currentTarget,n=e.attrChange,r=e.attrName,o=e.target,l=e[W]||2,a=e[He]||3;!ce||o&&o!==t||!t[y]||r==="style"||e.prevValue===e.newValue&&(e.newValue!==""||n!==l&&n!==a)||t[y](r,n===l?null:e.prevValue,n===a?null:e.newValue)}function Fe(e){var t=fe(e);return function(n){K.push(t,n.target),ie&&clearTimeout(ie),ie=setTimeout(rt,1)}}function de(e){nt&&(nt=!1,e.currentTarget.removeEventListener(Ze,de)),L.length&&me((e.target||u).querySelectorAll(L),e.detail===E?E:b),R&&at()}function lt(e,t){var n=this;Ye.call(n,e,t),Me.call(n,{target:n})}function Se(e,t,n){var r=t.apply(e,n),o=pe(r);return-1<o&&U(r,q[o]),n.pop()&&L.length&&ot(r.querySelectorAll(L)),r}function he(e,t){Tt(e,t),$?$.observe(e,gt):(ue&&(e.setAttribute=lt,e[H]=Ee(e),e[g](st,Me)),e[g](N,Ie)),e[k]&&ce&&(e.created=!0,e[k](),e.created=!1)}function at(){for(var e,t=0,n=G.length;t<n;t++)e=G[t],V.contains(e)||(n--,G.splice(t--,1),Te(e,E))}function Ve(e){throw new Error("A "+e+" type is already registered")}function Te(e,t){var n,r,o=pe(e);-1<o&&!Mt.call(e,"TEMPLATE")&&(Q(e,q[o]),o=0,t!==b||e[b]?t!==E||e[E]||(e[b]=!1,e[E]=!0,r="disconnected",o=1):(e[E]=!1,e[b]=!0,r="connected",o=1,R&&v.call(G,e)<0&&G.push(e)),o&&(n=e[t+O]||e[r+O])&&n.call(e))}function z(){}function Pe(e,t,n){var r=n&&n[_]||"",o=t.prototype,l=Ce(o),a=t.observedAttributes||ye,s={prototype:l};oe(l,k,{value:function(){if(te)te=!1;else if(!this[B]){this[B]=!0,new t(this),o[k]&&o[k].call(this);var i=j[ne.get(t)];(!Z||i.create.length>1)&&_e(this)}}}),oe(l,y,{value:function(i){-1<v.call(a,i)&&o[y]&&o[y].apply(this,arguments)}}),o[qe]&&oe(l,ut,{value:o[qe]}),o[Be]&&oe(l,ct,{value:o[Be]}),r&&(s[_]=r),e=e.toUpperCase(),j[e]={constructor:t,create:r?[r,re(e)]:[e]},ne.set(t,e),u[S](e.toLowerCase(),s),Le(e),P[e].r()}function Re(e){var t=j[e.toUpperCase()];return t&&t.constructor}function Ue(e){return typeof e=="string"?e:e&&e.is||""}function _e(e){for(var t,n=e[y],r=n?e.attributes:ye,o=r.length;o--;)t=r[o],n.call(e,t.name||t.nodeName,null,t.value||t.nodeValue)}function Le(e){return e=e.toUpperCase(),e in P||(P[e]={},P[e].p=new Xe(function(t){P[e].r=t})),P[e].p}function ke(){C&&delete m.customElements,I(m,"customElements",{configurable:!0,value:new z}),I(m,"CustomElementRegistry",{configurable:!0,value:z});for(var e=it.get(/^HTML[A-Z]*[a-z]/),t=e.length;t--;function(n){var r=m[n];if(r){m[n]=function(o){var l,a;return o||(o=this),o[B]||(te=!0,l=j[ne.get(o.constructor)],a=Z&&l.create.length===1,o=a?Reflect.construct(r,ye,l.constructor):u.createElement.apply(u,l.create),o[B]=!0,te=!1,a||_e(o)),o},m[n].prototype=r.prototype;try{r.prototype.constructor=m[n]}catch{dt=!0,I(r,B,{value:m[n]})}}}(e[t]));u.createElement=function(n,r){var o=Ue(r);return o?Ae.call(this,n,re(o)):Ae.call(this,n)},et||(Oe=!0,u[S](""))}var u=m.document,T=m.Object,it=function(e){var t,n,r,o,l=/^[A-Z]+[a-z]/,a=function(p){var f,h=[];for(f in i)p.test(f)&&h.push(f);return h},s=function(p,f){(f=f.toLowerCase())in i||(i[p]=(i[p]||[]).concat(f),i[f]=i[f.toUpperCase()]=p)},i=(T.create||T)(null),c={};for(n in e)for(o in e[n])for(r=e[n][o],i[o]=r,t=0;t<r.length;t++)i[r[t].toLowerCase()]=i[r[t].toUpperCase()]=o;return c.get=function(p){return typeof p=="string"?i[p]||(l.test(p)?[]:""):a(p)},c.set=function(p,f){return l.test(p)?s(p,f):s(f,p),c},c}({collections:{HTMLAllCollection:["all"],HTMLCollection:["forms"],HTMLFormControlsCollection:["elements"],HTMLOptionsCollection:["options"]},elements:{Element:["element"],HTMLAnchorElement:["a"],HTMLAppletElement:["applet"],HTMLAreaElement:["area"],HTMLAttachmentElement:["attachment"],HTMLAudioElement:["audio"],HTMLBRElement:["br"],HTMLBaseElement:["base"],HTMLBodyElement:["body"],HTMLButtonElement:["button"],HTMLCanvasElement:["canvas"],HTMLContentElement:["content"],HTMLDListElement:["dl"],HTMLDataElement:["data"],HTMLDataListElement:["datalist"],HTMLDetailsElement:["details"],HTMLDialogElement:["dialog"],HTMLDirectoryElement:["dir"],HTMLDivElement:["div"],HTMLDocument:["document"],HTMLElement:["element","abbr","address","article","aside","b","bdi","bdo","cite","code","command","dd","dfn","dt","em","figcaption","figure","footer","header","i","kbd","mark","nav","noscript","rp","rt","ruby","s","samp","section","small","strong","sub","summary","sup","u","var","wbr"],HTMLEmbedElement:["embed"],HTMLFieldSetElement:["fieldset"],HTMLFontElement:["font"],HTMLFormElement:["form"],HTMLFrameElement:["frame"],HTMLFrameSetElement:["frameset"],HTMLHRElement:["hr"],HTMLHeadElement:["head"],HTMLHeadingElement:["h1","h2","h3","h4","h5","h6"],HTMLHtmlElement:["html"],HTMLIFrameElement:["iframe"],HTMLImageElement:["img"],HTMLInputElement:["input"],HTMLKeygenElement:["keygen"],HTMLLIElement:["li"],HTMLLabelElement:["label"],HTMLLegendElement:["legend"],HTMLLinkElement:["link"],HTMLMapElement:["map"],HTMLMarqueeElement:["marquee"],HTMLMediaElement:["media"],HTMLMenuElement:["menu"],HTMLMenuItemElement:["menuitem"],HTMLMetaElement:["meta"],HTMLMeterElement:["meter"],HTMLModElement:["del","ins"],HTMLOListElement:["ol"],HTMLObjectElement:["object"],HTMLOptGroupElement:["optgroup"],HTMLOptionElement:["option"],HTMLOutputElement:["output"],HTMLParagraphElement:["p"],HTMLParamElement:["param"],HTMLPictureElement:["picture"],HTMLPreElement:["pre"],HTMLProgressElement:["progress"],HTMLQuoteElement:["blockquote","q","quote"],HTMLScriptElement:["script"],HTMLSelectElement:["select"],HTMLShadowElement:["shadow"],HTMLSlotElement:["slot"],HTMLSourceElement:["source"],HTMLSpanElement:["span"],HTMLStyleElement:["style"],HTMLTableCaptionElement:["caption"],HTMLTableCellElement:["td","th"],HTMLTableColElement:["col","colgroup"],HTMLTableElement:["table"],HTMLTableRowElement:["tr"],HTMLTableSectionElement:["thead","tbody","tfoot"],HTMLTemplateElement:["template"],HTMLTextAreaElement:["textarea"],HTMLTimeElement:["time"],HTMLTitleElement:["title"],HTMLTrackElement:["track"],HTMLUListElement:["ul"],HTMLUnknownElement:["unknown","vhgroupv","vkeygen"],HTMLVideoElement:["video"]},nodes:{Attr:["node"],Audio:["audio"],CDATASection:["node"],CharacterData:["node"],Comment:["#comment"],Document:["#document"],DocumentFragment:["#document-fragment"],DocumentType:["node"],HTMLDocument:["#document"],Image:["img"],Option:["option"],ProcessingInstruction:["node"],ShadowRoot:["#shadow-root"],Text:["#text"],XMLDocument:["xml"]}});typeof w!="object"&&(w={type:w||"auto"});var K,Me,X,Ee,$,ve,Q,U,A,S="registerElement",xe=1e5*m.Math.random()>>0,H="__"+S+xe,g="addEventListener",b="attached",O="Callback",E="detached",_="extends",y="attributeChanged"+O,ut=b+O,qe="connected"+O,Be="disconnected"+O,k="created"+O,ct=E+O,W="ADDITION",He="REMOVAL",N="DOMAttrModified",Ze="DOMContentLoaded",st="DOMSubtreeModified",x="<",Y="=",mt=/^[A-Z][._A-Z0-9]*-[-._A-Z0-9]*$/,ft=["ANNOTATION-XML","COLOR-PROFILE","FONT-FACE","FONT-FACE-SRC","FONT-FACE-URI","FONT-FACE-FORMAT","FONT-FACE-NAME","MISSING-GLYPH"],D=[],q=[],L="",V=u.documentElement,v=D.indexOf||function(e){for(var t=this.length;t--&&this[t]!==e;);return t},ge=T.prototype,be=ge.hasOwnProperty,J=ge.isPrototypeOf,I=T.defineProperty,ye=[],ee=T.getOwnPropertyDescriptor,je=T.getOwnPropertyNames,pt=T.getPrototypeOf,Ge=T.setPrototypeOf,ze=!!T.__proto__,dt=!1,B="__dreCEv1",C=m.customElements,Z=!/^force/.test(w.type)&&!!(C&&C.define&&C.get&&C.whenDefined),Ke=T.create||T,ht=m.Map||function(){var e,t=[],n=[];return{get:function(r){return n[v.call(t,r)]},set:function(r,o){e=v.call(t,r),e<0?n[t.push(r)-1]=o:n[e]=o}}},Xe=m.Promise||function(e){function t(l){for(r=!0;n.length;)n.shift()(l)}var n=[],r=!1,o={catch:function(){return o},then:function(l){return n.push(l),r&&setTimeout(t,1),o}};return e(t),o},te=!1,j=Ke(null),P=Ke(null),ne=new ht,re=function(e){return e.toLowerCase()},Ce=T.create||function e(t){return t?(e.prototype=t,new e):this},Tt=Ge||(ze?function(e,t){return e.__proto__=t,e}:je&&ee?function(){function e(t,n){for(var r,o=je(n),l=0,a=o.length;l<a;l++)r=o[l],be.call(t,r)||I(t,r,ee(n,r))}return function(t,n){do e(t,n);while((n=pt(n))&&!J.call(n,t));return t}}():function(e,t){for(var n in t)e[n]=t[n];return e}),F=m.MutationObserver||m.WebKitMutationObserver,$e=m.HTMLAnchorElement,d=(m.HTMLElement||m.Element||m.Node).prototype,R=!J.call(d,V),oe=R?function(e,t,n){return e[t]=n.value,e}:I,Lt=R?function(e){return e.nodeType===1}:function(e){return J.call(d,e)},G=R&&[],Qe=d.attachShadow,We=d.cloneNode,Mt=d.closest||function(e){for(var t=this;t&&t.nodeName!==e;)t=t.parentNode;return t},we=d.dispatchEvent,le=d.getAttribute,Et=d.hasAttribute,vt=d.removeAttribute,Ye=d.setAttribute,ae=u.createElement,Ht=u.importNode,Ae=ae,gt=F&&{attributes:!0,characterData:!0,attributeOldValue:!0},Je=F||function(e){ue=!1,V.removeEventListener(N,Je)},ie=0,et=S in u&&!/^force-all/.test(w.type),tt=!0,Oe=!1,ue=!0,nt=!0,ce=!0;if(F&&(A=u.createElement("div"),A.innerHTML="<div><div></div></div>",new F(function(e,t){if(e[0]&&e[0].type=="childList"&&!e[0].removedNodes[0].childNodes.length){A=ee(d,"innerHTML");var n=A&&A.set;n&&I(d,"innerHTML",{set:function(r){for(;this.lastChild;)this.removeChild(this.lastChild);n.call(this,r)}})}t.disconnect(),A=null}).observe(A,{childList:!0,subtree:!0}),A.innerHTML=""),et||(Ge||ze?(Q=function(e,t){J.call(t,e)||he(e,t)},U=he):(Q=function(e,t){e[H]||(e[H]=T(!0),he(e,t))},U=Q),R?(ue=!1,function(){var e=ee(d,g),t=e.value,n=function(l){var a=new CustomEvent(N,{bubbles:!0});a.attrName=l,a.prevValue=le.call(this,l),a.newValue=null,a[He]=a.attrChange=2,vt.call(this,l),we.call(this,a)},r=function(l,a){var s=Et.call(this,l),i=s&&le.call(this,l),c=new CustomEvent(N,{bubbles:!0});Ye.call(this,l,a),c.attrName=l,c.prevValue=s?i:null,c.newValue=a,s?c.MODIFICATION=c.attrChange=1:c[W]=c.attrChange=0,we.call(this,c)},o=function(l){var a,s=l.currentTarget,i=s[H],c=l.propertyName;i.hasOwnProperty(c)&&(i=i[c],a=new CustomEvent(N,{bubbles:!0}),a.attrName=i.name,a.prevValue=i.value||null,a.newValue=i.value=s[c]||null,a.prevValue==null?a[W]=a.attrChange=0:a.MODIFICATION=a.attrChange=1,we.call(s,a))};e.value=function(l,a,s){l===N&&this[y]&&this.setAttribute!==r&&(this[H]={className:{name:"class",value:this.className}},this.setAttribute=r,this.removeAttribute=n,t.call(this,"propertychange",o)),t.call(this,l,a,s)},I(d,g,e)}()):F||(V[g](N,Je),V.setAttribute(H,1),V.removeAttribute(H),ue&&(Me=function(e){var t,n,r,o=this;if(o===e.target){t=o[H],o[H]=n=Ee(o);for(r in n){if(!(r in t))return X(0,o,r,t[r],n[r],W);if(n[r]!==t[r])return X(1,o,r,t[r],n[r],"MODIFICATION")}for(r in t)if(!(r in n))return X(2,o,r,t[r],n[r],He)}},X=function(e,t,n,r,o,l){var a={attrChange:e,currentTarget:t,attrName:n,prevValue:r,newValue:o};a[l]=e,Ie(a)},Ee=function(e){for(var t,n,r={},o=e.attributes,l=0,a=o.length;l<a;l++)t=o[l],(n=t.name)!=="setAttribute"&&(r[n]=t.value);return r})),u[S]=function(e,t){if(n=e.toUpperCase(),tt&&(tt=!1,F?($=function(i,c){function p(f,h){for(var M=0,se=f.length;M<se;h(f[M++]));}return new F(function(f){for(var h,M,se,Ne=0,bt=f.length;Ne<bt;Ne++)h=f[Ne],h.type==="childList"?(p(h.addedNodes,i),p(h.removedNodes,c)):(M=h.target,ce&&M[y]&&h.attributeName!=="style"&&(se=le.call(M,h.attributeName))!==h.oldValue&&M[y](h.attributeName,h.oldValue,se))})}(fe(b),fe(E)),ve=function(i){return $.observe(i,{childList:!0,subtree:!0}),i},ve(u),Qe&&(d.attachShadow=function(){return ve(Qe.apply(this,arguments))})):(K=[],u[g]("DOMNodeInserted",Fe(b)),u[g]("DOMNodeRemoved",Fe(E))),u[g](Ze,de),u[g]("readystatechange",de),u.importNode=function(i,c){switch(i.nodeType){case 1:return Se(u,Ht,[i,!!c]);case 11:for(var p=u.createDocumentFragment(),f=i.childNodes,h=f.length,M=0;M<h;M++)p.appendChild(u.importNode(f[M],!!c));return p;default:return We.call(i,!!c)}},d.cloneNode=function(i){return Se(this,We,[!!i])}),Oe)return Oe=!1;if(-2<v.call(D,Y+n)+v.call(D,x+n)&&Ve(e),!mt.test(n)||-1<v.call(ft,n))throw new Error("The type "+e+" is invalid");var n,r,o=function(){return a?u.createElement(s,n):u.createElement(s)},l=t||ge,a=be.call(l,_),s=a?t[_].toUpperCase():n;return a&&-1<v.call(D,x+s)&&Ve(s),r=D.push((a?Y:x)+n)-1,L=L.concat(L.length?",":"",a?s+'[is="'+e.toLowerCase()+'"]':s),o.prototype=q[r]=be.call(l,"prototype")?l.prototype:Ce(d),L.length&&me(u.querySelectorAll(L),b),o},u.createElement=Ae=function(e,t){var n=Ue(t),r=n?ae.call(u,e,re(n)):ae.call(u,e),o=""+e,l=v.call(D,(n?Y:x)+(n||o).toUpperCase()),a=-1<l;return n&&(r.setAttribute("is",n=n.toLowerCase()),a&&(a=De(o.toUpperCase(),n))),ce=!u.createElement.innerHTMLHelper,a&&U(r,q[l]),r}),addEventListener("beforeunload",function(){delete u.createElement,delete u.importNode,delete u[S]},!1),z.prototype={constructor:z,define:Z?function(e,t,n){if(n)Pe(e,t,n);else{var r=e.toUpperCase();j[r]={constructor:t,create:[r]},ne.set(t,r),C.define(e,t)}}:Pe,get:Z?function(e){return C.get(e)||Re(e)}:Re,whenDefined:Z?function(e){return Xe.race([C.whenDefined(e),Le(e)])}:Le},!C||/^force/.test(w.type))ke();else if(!w.noBuiltIn)try{(function(e,t,n){var r=new RegExp(`^<a\\s+is=('|")`+n+"\\1></a>$");if(t[_]="a",e.prototype=Ce($e.prototype),e.prototype.constructor=e,m.customElements.define(n,e,t),!r.test(u.createElement("a",{is:n}).outerHTML)||!r.test(new e().outerHTML))throw t})(function e(){return Reflect.construct($e,[],e)},{},"document-register-element-a"+xe)}catch{ke()}if(!w.noBuiltIn)try{if(ae.call(u,"a","a").outerHTML.indexOf("is")<0)throw{}}catch{re=function(t){return{is:t.toLowerCase()}}}})(window);
|
|
3
3
|
|
|
4
4
|
var C_e=Object.create;var gO=Object.defineProperty,__e=Object.defineProperties,y_e=Object.getOwnPropertyDescriptor,S_e=Object.getOwnPropertyDescriptors,b_e=Object.getOwnPropertyNames,pO=Object.getOwnPropertySymbols,SW=Object.getPrototypeOf,I7=Object.prototype.hasOwnProperty,bW=Object.prototype.propertyIsEnumerable,I_e=Reflect.get;var yW=(i,o,n)=>o in i?gO(i,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[o]=n,I=(i,o)=>{for(var n in o||={})I7.call(o,n)&&yW(i,n,o[n]);if(pO)for(var n of pO(o))bW.call(o,n)&&yW(i,n,o[n]);return i},T=(i,o)=>__e(i,S_e(o));var E7=(i,o)=>{var n={};for(var e in i)I7.call(i,e)&&o.indexOf(e)<0&&(n[e]=i[e]);if(i!=null&&pO)for(var e of pO(i))o.indexOf(e)<0&&bW.call(i,e)&&(n[e]=i[e]);return n};var E_e=(i,o)=>()=>(o||i((o={exports:{}}).exports,o),o.exports),uO=(i,o)=>{for(var n in o)gO(i,n,{get:o[n],enumerable:!0})},x_e=(i,o,n,e)=>{if(o&&typeof o=="object"||typeof o=="function")for(let t of b_e(o))!I7.call(i,t)&&t!==n&&gO(i,t,{get:()=>o[t],enumerable:!(e=y_e(o,t))||e.enumerable});return i};var IW=(i,o,n)=>(n=i!=null?C_e(SW(i)):{},x_e(o||!i||!i.__esModule?gO(n,"default",{value:i,enumerable:!0}):n,i));var Ym=(i,o,n)=>I_e(SW(i),n,o);var Q=(i,o,n)=>new Promise((e,t)=>{var r=d=>{try{s(n.next(d))}catch(p){t(p)}},a=d=>{try{s(n.throw(d))}catch(p){t(p)}},s=d=>d.done?e(d.value):Promise.resolve(d.value).then(r,a);s((n=n.apply(i,o)).next())});var VG=E_e((hfo,BG)=>{"use strict";var yt={};yt.generateIdentifier=function(){return Math.random().toString(36).substring(2,12)};yt.localCName=yt.generateIdentifier();yt.splitLines=function(i){return i.trim().split(`
|
|
@@ -193,7 +193,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
193
193
|
<img src="${o||this.thumbnailWithPlayIconUrl||this.thumbnailUrl}" />
|
|
194
194
|
</a>
|
|
195
195
|
`}};var Zp=class{constructor(){this.type="recorder",this.recordingType="audio",this.mode="floating",this.attachment=null,this.attachments=[],this.pageInfo=new to}};var ck=class{constructor(){this.type="rewriter",this.rewriterType="copywriter",this.pageInfo=new to}};var ub=class{constructor(){this.screenWidth=0,this.screenHeight=0,this.screenScrollHeight=0}};var Xp=class{constructor(){this.pageInfo=new to}},hb=function(i){return i.Start="start",i.End="end",i}(hb||{}),s0=function(i){return i.Avatar="avatar",i.Label="label",i}(s0||{});var dk=class{constructor(){this.sources=[],this.playerState=new fb}},fb=class{constructor(){this.volume=1}};var vb=class{constructor(){this.to=[],this.resolved=!1,this.type="tag",this.pageInfo=new to}};var Qp=class{constructor(){this.visibility="private"}};var mk=class{constructor(){this.reactions=[],this.type="reaction",this.pageInfo=new to,this.isReactionResolverUsed=!1}};var pk=class{};var Vt=(()=>{let o=class o{constructor(e,t){this.loggingService=e,this.analyticsService=t,this.config$=new ve(null),this.disableLogsConfig$=new ve({warnings:!0,suppressAll:!1}),this.apiKey$=new ve(""),this.baseFeatureAllowList=[],this.sf$=new ve(!1),this.sdkType$=new ve("core"),this.logsEnabled$=new ve(!0);try{this.analyticsService.setConfigService(this),this.sdkType$.subscribe(r=>{this.analyticsService.updateDefaultProperties({sdkType:r})},r=>{this.loggingService.catch("Error in ConfigService sdkType$: ",r)}),this.logsEnabled$.subscribe(r=>{r?this.loggingService.enableLogs():this.loggingService.disableLogs(),mt.logsEnabled=r},r=>{this.loggingService.catch("Error in ConfigService logsEnabled$: ",r)})}catch(r){this.loggingService.catch("Error in ConfigService constructor: ",r)}}initConfig(e){try{e.featureAllowList?.length||(e.featureAllowList=Object.values(Ne)),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(r=>!e.includes(r)):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()}catch(e){return this.loggingService.catch("Error in ConfigService getSF$: ",e),se(!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),se("core")}}enableLogs(){try{if(this.logsEnabled$.value===!0)return;this.logsEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in ConfigService enableLogs: ",e)}}disableLogs(e){try{e&&this.disableLogsConfig$.next({warnings:e.warnings??!0,suppressAll:e.suppressAll??!1}),e?.warnings!==!1&&this.logsEnabled$.next(!1)}catch(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}}};o.\u0275fac=function(t){return new(t||o)(J(y),J(tt))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var rce=(()=>{let o=class o{constructor(e){this.loggingService=e,this.initLocalStorageData()}initLocalStorageData(){this.loggingService.log("%c[WB] Calling FUNCTION: initLocalStorageData","color: green;"),this.getLocalStorageData(),this.getSessionStorageData()}getLocalStorageData(){this.loggingService.log("%c[WB] Calling FUNCTION: getLocalStorageData","color: green;");try{let e=localStorage?.getItem(j.LOCALSTORAGE_DATA_ID);if(e)return JSON.parse(e);{let t=new mh;return this.setLocalStorageData(t),t}}catch(e){return this.loggingService.catch("Error in getLocalStorageData:",e),new mh}}setLocalStorageData(e){this.loggingService.log("%c[WB] Calling FUNCTION: setLocalStorageData","color: green;");try{if(e){let t=JSON.stringify(e);localStorage?.setItem(j.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(j.LOCALSTORAGE_DATA_ID)}getSessionStorageData(){this.loggingService.log("%c[WB] Calling FUNCTION: getSessionStorageData","color: green;");try{let e=sessionStorage?.getItem(j.LOCALSTORAGE_DATA_ID);if(e)return JSON.parse(e);{let t=new mh;return this.setSessionStorageData(t),t}}catch(e){return this.loggingService.catch("Error in getSessionStorageData:",e),new mh}}setSessionStorageData(e){this.loggingService.log("%c[WB] Calling FUNCTION: setSessionStorageData","color: green;");try{if(e){let t=JSON.stringify(e);sessionStorage?.setItem(j.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(j.LOCALSTORAGE_DATA_ID)}catch(e){this.loggingService.catch("Error in deleteSessionStorageData:",e)}}};o.\u0275fac=function(t){return new(t||o)(J(y))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Rd=(()=>{let o=class o{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 Do,t=this.localStorageService.getSessionStorageData();if(t.snippylyAvatar)e=t.snippylyAvatar;else{let r=this.generateUserAvatar();t.snippylyAvatar=r,this.localStorageService.setSessionStorageData(t)}return e}catch(e){return this.loggingService.catch("Error in getSessionAvatar:",e),new Do}}generateUserAvatar(){this.loggingService.log("%c[WB] Calling FUNCTION: generateUserAvatar","color: green;");try{let e=Math.floor(Math.random()*this.avatarList.length),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 j.AVATAR_COLOR_LIST[e%j.AVATAR_COLOR_LIST.length];let t=Math.floor(Math.random()*j.AVATAR_COLOR_LIST.length);return j.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),""}}};o.\u0275fac=function(t){return new(t||o)(J(rce),J(y))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Nd=(()=>{let o=class o{constructor(e){this.loggingService=e,this.actionSubjects=new Map,this.subscriptions=[]}triggerAction(e,t){try{this.actionSubjects.has(e)||this.actionSubjects.set(e,new et),this.actionSubjects.get(e)?.next(t)}catch(r){this.loggingService.catch("Error in CoreActionsService triggerAction: ",r)}}onAction(e){try{return this.actionSubjects.has(e)||this.actionSubjects.set(e,new et),this.actionSubjects.get(e)?.asObservable()}catch(t){return this.loggingService.catch("Error in CoreActionsService onAction: ",t),se(null)}}};o.\u0275fac=function(t){return new(t||o)(J(y))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var{entries:hce,setPrototypeOf:ace,isFrozen:Q7e,getPrototypeOf:J7e,getOwnPropertyDescriptor:e8e}=Object,{freeze:ts,seal:Rl,create:fce}=Object,{apply:dz,construct:mz}=typeof Reflect<"u"&&Reflect;ts||(ts=function(o){return o});Rl||(Rl=function(o){return o});dz||(dz=function(o,n,e){return o.apply(n,e)});mz||(mz=function(o,n){return new o(...n)});var uk=ns(Array.prototype.forEach),t8e=ns(Array.prototype.lastIndexOf),sce=ns(Array.prototype.pop),_b=ns(Array.prototype.push),n8e=ns(Array.prototype.splice),fk=ns(String.prototype.toLowerCase),rz=ns(String.prototype.toString),lce=ns(String.prototype.match),yb=ns(String.prototype.replace),i8e=ns(String.prototype.indexOf),o8e=ns(String.prototype.trim),kc=ns(Object.prototype.hasOwnProperty),es=ns(RegExp.prototype.test),Sb=r8e(TypeError);function ns(i){return function(o){o instanceof RegExp&&(o.lastIndex=0);for(var n=arguments.length,e=new Array(n>1?n-1:0),t=1;t<n;t++)e[t-1]=arguments[t];return dz(i,o,e)}}function r8e(i){return function(){for(var o=arguments.length,n=new Array(o),e=0;e<o;e++)n[e]=arguments[e];return mz(i,n)}}function li(i,o){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:fk;ace&&ace(i,null);let e=o.length;for(;e--;){let t=o[e];if(typeof t=="string"){let r=n(t);r!==t&&(Q7e(o)||(o[e]=r),t=r)}i[t]=!0}return i}function a8e(i){for(let o=0;o<i.length;o++)kc(i,o)||(i[o]=null);return i}function ph(i){let o=fce(null);for(let[n,e]of hce(i))kc(i,n)&&(Array.isArray(e)?o[n]=a8e(e):e&&typeof e=="object"&&e.constructor===Object?o[n]=ph(e):o[n]=e);return o}function bb(i,o){for(;i!==null;){let e=e8e(i,o);if(e){if(e.get)return ns(e.get);if(typeof e.value=="function")return ns(e.value)}i=J7e(i)}function n(){return null}return n}var cce=ts(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),az=ts(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),sz=ts(["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"]),s8e=ts(["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"]),lz=ts(["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"]),l8e=ts(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),dce=ts(["#text"]),mce=ts(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),cz=ts(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),pce=ts(["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"]),hk=ts(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),c8e=Rl(/\{\{[\w\W]*|[\w\W]*\}\}/gm),d8e=Rl(/<%[\w\W]*|[\w\W]*%>/gm),m8e=Rl(/\$\{[\w\W]*/gm),p8e=Rl(/^data-[\-\w.\u00B7-\uFFFF]+$/),g8e=Rl(/^aria-[\-\w]+$/),vce=Rl(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),u8e=Rl(/^(?:\w+script|data):/i),h8e=Rl(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Cce=Rl(/^html$/i),f8e=Rl(/^[a-z][.\w]*(-[.\w]+)+$/i),gce=Object.freeze({__proto__:null,ARIA_ATTR:g8e,ATTR_WHITESPACE:h8e,CUSTOM_ELEMENT:f8e,DATA_ATTR:p8e,DOCTYPE_NAME:Cce,ERB_EXPR:d8e,IS_ALLOWED_URI:vce,IS_SCRIPT_OR_DATA:u8e,MUSTACHE_EXPR:c8e,TMPLIT_EXPR:m8e}),Ib={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},v8e=function(){return typeof window>"u"?null:window},C8e=function(o,n){if(typeof o!="object"||typeof o.createPolicy!="function")return null;let e=null,t="data-tt-policy-suffix";n&&n.hasAttribute(t)&&(e=n.getAttribute(t));let r="dompurify"+(e?"#"+e:"");try{return o.createPolicy(r,{createHTML(a){return a},createScriptURL(a){return a}})}catch{return console.warn("TrustedTypes policy "+r+" could not be created."),null}},uce=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function _ce(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:v8e(),o=Qt=>_ce(Qt);if(o.version="3.2.5",o.removed=[],!i||!i.document||i.document.nodeType!==Ib.document||!i.Element)return o.isSupported=!1,o;let{document:n}=i,e=n,t=e.currentScript,{DocumentFragment:r,HTMLTemplateElement:a,Node:s,Element:d,NodeFilter:p,NamedNodeMap:u=i.NamedNodeMap||i.MozNamedAttrMap,HTMLFormElement:C,DOMParser:E,trustedTypes:D}=i,L=d.prototype,G=bb(L,"cloneNode"),Y=bb(L,"remove"),ne=bb(L,"nextSibling"),ge=bb(L,"childNodes"),ye=bb(L,"parentNode");if(typeof a=="function"){let Qt=n.createElement("template");Qt.content&&Qt.content.ownerDocument&&(n=Qt.content.ownerDocument)}let Re,Ge="",{implementation:Be,createNodeIterator:we,createDocumentFragment:Se,getElementsByTagName:Oe}=n,{importNode:_e}=e,fe=uce();o.isSupported=typeof hce=="function"&&typeof ye=="function"&&Be&&Be.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:Ae,ERB_EXPR:Te,TMPLIT_EXPR:Pn,DATA_ATTR:Nn,ARIA_ATTR:Pt,IS_SCRIPT_OR_DATA:Mt,ATTR_WHITESPACE:Ht,CUSTOM_ELEMENT:Fn}=gce,{IS_ALLOWED_URI:Zt}=gce,qt=null,wi=li({},[...cce,...az,...sz,...lz,...dce]),Xt=null,Zn=li({},[...mce,...cz,...pce,...hk]),Vi=Object.seal(fce(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}})),Kd=null,vo=null,ll=!0,Hr=!0,cl=!1,zl=!0,Uc=!1,xg=!0,Gl=!1,Tg=!1,Eh=!1,Zd=!1,xh=!1,Dg=!1,b_=!0,Th=!1,Zw="user-content-",I_=!0,Xd=!1,jc={},$c=null,wr=li({},["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"]),zr=null,wg=li({},["audio","video","img","source","image","track"]),Dh=null,E_=li({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),wh="http://www.w3.org/1998/Math/MathML",Hc="http://www.w3.org/2000/svg",dl="http://www.w3.org/1999/xhtml",Qd=dl,Og=!1,x_=null,h7=li({},[wh,Hc,dl],rz),Gm=li({},["mi","mo","mn","ms","mtext"]),Ag=li({},["annotation-xml"]),Xw=li({},["title","style","font","a","script"]),Wl=null,T_=["application/xhtml+xml","text/html"],D_="text/html",Co=null,Jd=null,Oh=n.createElement("form"),w_=function(Ue){return Ue instanceof RegExp||Ue instanceof Function},em=function(){let Ue=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Jd&&Jd===Ue)){if((!Ue||typeof Ue!="object")&&(Ue={}),Ue=ph(Ue),Wl=T_.indexOf(Ue.PARSER_MEDIA_TYPE)===-1?D_:Ue.PARSER_MEDIA_TYPE,Co=Wl==="application/xhtml+xml"?rz:fk,qt=kc(Ue,"ALLOWED_TAGS")?li({},Ue.ALLOWED_TAGS,Co):wi,Xt=kc(Ue,"ALLOWED_ATTR")?li({},Ue.ALLOWED_ATTR,Co):Zn,x_=kc(Ue,"ALLOWED_NAMESPACES")?li({},Ue.ALLOWED_NAMESPACES,rz):h7,Dh=kc(Ue,"ADD_URI_SAFE_ATTR")?li(ph(E_),Ue.ADD_URI_SAFE_ATTR,Co):E_,zr=kc(Ue,"ADD_DATA_URI_TAGS")?li(ph(wg),Ue.ADD_DATA_URI_TAGS,Co):wg,$c=kc(Ue,"FORBID_CONTENTS")?li({},Ue.FORBID_CONTENTS,Co):wr,Kd=kc(Ue,"FORBID_TAGS")?li({},Ue.FORBID_TAGS,Co):{},vo=kc(Ue,"FORBID_ATTR")?li({},Ue.FORBID_ATTR,Co):{},jc=kc(Ue,"USE_PROFILES")?Ue.USE_PROFILES:!1,ll=Ue.ALLOW_ARIA_ATTR!==!1,Hr=Ue.ALLOW_DATA_ATTR!==!1,cl=Ue.ALLOW_UNKNOWN_PROTOCOLS||!1,zl=Ue.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Uc=Ue.SAFE_FOR_TEMPLATES||!1,xg=Ue.SAFE_FOR_XML!==!1,Gl=Ue.WHOLE_DOCUMENT||!1,Zd=Ue.RETURN_DOM||!1,xh=Ue.RETURN_DOM_FRAGMENT||!1,Dg=Ue.RETURN_TRUSTED_TYPE||!1,Eh=Ue.FORCE_BODY||!1,b_=Ue.SANITIZE_DOM!==!1,Th=Ue.SANITIZE_NAMED_PROPS||!1,I_=Ue.KEEP_CONTENT!==!1,Xd=Ue.IN_PLACE||!1,Zt=Ue.ALLOWED_URI_REGEXP||vce,Qd=Ue.NAMESPACE||dl,Gm=Ue.MATHML_TEXT_INTEGRATION_POINTS||Gm,Ag=Ue.HTML_INTEGRATION_POINTS||Ag,Vi=Ue.CUSTOM_ELEMENT_HANDLING||{},Ue.CUSTOM_ELEMENT_HANDLING&&w_(Ue.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Vi.tagNameCheck=Ue.CUSTOM_ELEMENT_HANDLING.tagNameCheck),Ue.CUSTOM_ELEMENT_HANDLING&&w_(Ue.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Vi.attributeNameCheck=Ue.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),Ue.CUSTOM_ELEMENT_HANDLING&&typeof Ue.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(Vi.allowCustomizedBuiltInElements=Ue.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Uc&&(Hr=!1),xh&&(Zd=!0),jc&&(qt=li({},dce),Xt=[],jc.html===!0&&(li(qt,cce),li(Xt,mce)),jc.svg===!0&&(li(qt,az),li(Xt,cz),li(Xt,hk)),jc.svgFilters===!0&&(li(qt,sz),li(Xt,cz),li(Xt,hk)),jc.mathMl===!0&&(li(qt,lz),li(Xt,pce),li(Xt,hk))),Ue.ADD_TAGS&&(qt===wi&&(qt=ph(qt)),li(qt,Ue.ADD_TAGS,Co)),Ue.ADD_ATTR&&(Xt===Zn&&(Xt=ph(Xt)),li(Xt,Ue.ADD_ATTR,Co)),Ue.ADD_URI_SAFE_ATTR&&li(Dh,Ue.ADD_URI_SAFE_ATTR,Co),Ue.FORBID_CONTENTS&&($c===wr&&($c=ph($c)),li($c,Ue.FORBID_CONTENTS,Co)),I_&&(qt["#text"]=!0),Gl&&li(qt,["html","head","body"]),qt.table&&(li(qt,["tbody"]),delete Kd.tbody),Ue.TRUSTED_TYPES_POLICY){if(typeof Ue.TRUSTED_TYPES_POLICY.createHTML!="function")throw Sb('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof Ue.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Sb('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');Re=Ue.TRUSTED_TYPES_POLICY,Ge=Re.createHTML("")}else Re===void 0&&(Re=C8e(D,t)),Re!==null&&typeof Ge=="string"&&(Ge=Re.createHTML(""));ts&&ts(Ue),Jd=Ue}},O_=li({},[...az,...sz,...s8e]),Gr=li({},[...lz,...l8e]),Qw=function(Ue){let bt=ye(Ue);(!bt||!bt.tagName)&&(bt={namespaceURI:Qd,tagName:"template"});let Wt=fk(Ue.tagName),oo=fk(bt.tagName);return x_[Ue.namespaceURI]?Ue.namespaceURI===Hc?bt.namespaceURI===dl?Wt==="svg":bt.namespaceURI===wh?Wt==="svg"&&(oo==="annotation-xml"||Gm[oo]):!!O_[Wt]:Ue.namespaceURI===wh?bt.namespaceURI===dl?Wt==="math":bt.namespaceURI===Hc?Wt==="math"&&Ag[oo]:!!Gr[Wt]:Ue.namespaceURI===dl?bt.namespaceURI===Hc&&!Ag[oo]||bt.namespaceURI===wh&&!Gm[oo]?!1:!Gr[Wt]&&(Xw[Wt]||!O_[Wt]):!!(Wl==="application/xhtml+xml"&&x_[Ue.namespaceURI]):!1},Ia=function(Ue){_b(o.removed,{element:Ue});try{ye(Ue).removeChild(Ue)}catch{Y(Ue)}},zc=function(Ue,bt){try{_b(o.removed,{attribute:bt.getAttributeNode(Ue),from:bt})}catch{_b(o.removed,{attribute:null,from:bt})}if(bt.removeAttribute(Ue),Ue==="is")if(Zd||xh)try{Ia(bt)}catch{}else try{bt.setAttribute(Ue,"")}catch{}},Jw=function(Ue){let bt=null,Wt=null;if(Eh)Ue="<remove></remove>"+Ue;else{let Ar=lce(Ue,/^[\r\n\t ]+/);Wt=Ar&&Ar[0]}Wl==="application/xhtml+xml"&&Qd===dl&&(Ue='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+Ue+"</body></html>");let oo=Re?Re.createHTML(Ue):Ue;if(Qd===dl)try{bt=new E().parseFromString(oo,Wl)}catch{}if(!bt||!bt.documentElement){bt=Be.createDocument(Qd,"template",null);try{bt.documentElement.innerHTML=Og?Ge:oo}catch{}}let Or=bt.body||bt.documentElement;return Ue&&Wt&&Or.insertBefore(n.createTextNode(Wt),Or.childNodes[0]||null),Qd===dl?Oe.call(bt,Gl?"html":"body")[0]:Gl?bt.documentElement:Or},eO=function(Ue){return we.call(Ue.ownerDocument||Ue,Ue,p.SHOW_ELEMENT|p.SHOW_COMMENT|p.SHOW_TEXT|p.SHOW_PROCESSING_INSTRUCTION|p.SHOW_CDATA_SECTION,null)},Gc=function(Ue){return Ue instanceof C&&(typeof Ue.nodeName!="string"||typeof Ue.textContent!="string"||typeof Ue.removeChild!="function"||!(Ue.attributes instanceof u)||typeof Ue.removeAttribute!="function"||typeof Ue.setAttribute!="function"||typeof Ue.namespaceURI!="string"||typeof Ue.insertBefore!="function"||typeof Ue.hasChildNodes!="function")},tO=function(Ue){return typeof s=="function"&&Ue instanceof s};function ql(Qt,Ue,bt){uk(Qt,Wt=>{Wt.call(o,Ue,bt,Jd)})}let Pg=function(Ue){let bt=null;if(ql(fe.beforeSanitizeElements,Ue,null),Gc(Ue))return Ia(Ue),!0;let Wt=Co(Ue.nodeName);if(ql(fe.uponSanitizeElement,Ue,{tagName:Wt,allowedTags:qt}),Ue.hasChildNodes()&&!tO(Ue.firstElementChild)&&es(/<[/\w!]/g,Ue.innerHTML)&&es(/<[/\w!]/g,Ue.textContent)||Ue.nodeType===Ib.progressingInstruction||xg&&Ue.nodeType===Ib.comment&&es(/<[/\w]/g,Ue.data))return Ia(Ue),!0;if(!qt[Wt]||Kd[Wt]){if(!Kd[Wt]&&Ah(Wt)&&(Vi.tagNameCheck instanceof RegExp&&es(Vi.tagNameCheck,Wt)||Vi.tagNameCheck instanceof Function&&Vi.tagNameCheck(Wt)))return!1;if(I_&&!$c[Wt]){let oo=ye(Ue)||Ue.parentNode,Or=ge(Ue)||Ue.childNodes;if(Or&&oo){let Ar=Or.length;for(let Pr=Ar-1;Pr>=0;--Pr){let Ns=G(Or[Pr],!0);Ns.__removalCount=(Ue.__removalCount||0)+1,oo.insertBefore(Ns,ne(Ue))}}}return Ia(Ue),!0}return Ue instanceof d&&!Qw(Ue)||(Wt==="noscript"||Wt==="noembed"||Wt==="noframes")&&es(/<\/no(script|embed|frames)/i,Ue.innerHTML)?(Ia(Ue),!0):(Uc&&Ue.nodeType===Ib.text&&(bt=Ue.textContent,uk([Ae,Te,Pn],oo=>{bt=yb(bt,oo," ")}),Ue.textContent!==bt&&(_b(o.removed,{element:Ue.cloneNode()}),Ue.textContent=bt)),ql(fe.afterSanitizeElements,Ue,null),!1)},A_=function(Ue,bt,Wt){if(b_&&(bt==="id"||bt==="name")&&(Wt in n||Wt in Oh))return!1;if(!(Hr&&!vo[bt]&&es(Nn,bt))){if(!(ll&&es(Pt,bt))){if(!Xt[bt]||vo[bt]){if(!(Ah(Ue)&&(Vi.tagNameCheck instanceof RegExp&&es(Vi.tagNameCheck,Ue)||Vi.tagNameCheck instanceof Function&&Vi.tagNameCheck(Ue))&&(Vi.attributeNameCheck instanceof RegExp&&es(Vi.attributeNameCheck,bt)||Vi.attributeNameCheck instanceof Function&&Vi.attributeNameCheck(bt))||bt==="is"&&Vi.allowCustomizedBuiltInElements&&(Vi.tagNameCheck instanceof RegExp&&es(Vi.tagNameCheck,Wt)||Vi.tagNameCheck instanceof Function&&Vi.tagNameCheck(Wt))))return!1}else if(!Dh[bt]){if(!es(Zt,yb(Wt,Ht,""))){if(!((bt==="src"||bt==="xlink:href"||bt==="href")&&Ue!=="script"&&i8e(Wt,"data:")===0&&zr[Ue])){if(!(cl&&!es(Mt,yb(Wt,Ht,"")))){if(Wt)return!1}}}}}}return!0},Ah=function(Ue){return Ue!=="annotation-xml"&&lce(Ue,Fn)},Mg=function(Ue){ql(fe.beforeSanitizeAttributes,Ue,null);let{attributes:bt}=Ue;if(!bt||Gc(Ue))return;let Wt={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Xt,forceKeepAttr:void 0},oo=bt.length;for(;oo--;){let Or=bt[oo],{name:Ar,namespaceURI:Pr,value:Ns}=Or,tm=Co(Ar),ar=Ar==="value"?Ns:o8e(Ns);if(Wt.attrName=tm,Wt.attrValue=ar,Wt.keepAttr=!0,Wt.forceKeepAttr=void 0,ql(fe.uponSanitizeAttribute,Ue,Wt),ar=Wt.attrValue,Th&&(tm==="id"||tm==="name")&&(zc(Ar,Ue),ar=Zw+ar),xg&&es(/((--!?|])>)|<\/(style|title)/i,ar)){zc(Ar,Ue);continue}if(Wt.forceKeepAttr||(zc(Ar,Ue),!Wt.keepAttr))continue;if(!zl&&es(/\/>/i,ar)){zc(Ar,Ue);continue}Uc&&uk([Ae,Te,Pn],Ph=>{ar=yb(ar,Ph," ")});let qc=Co(Ue.nodeName);if(A_(qc,tm,ar)){if(Re&&typeof D=="object"&&typeof D.getAttributeType=="function"&&!Pr)switch(D.getAttributeType(qc,tm)){case"TrustedHTML":{ar=Re.createHTML(ar);break}case"TrustedScriptURL":{ar=Re.createScriptURL(ar);break}}try{Pr?Ue.setAttributeNS(Pr,Ar,ar):Ue.setAttribute(Ar,ar),Gc(Ue)?Ia(Ue):sce(o.removed)}catch{}}}ql(fe.afterSanitizeAttributes,Ue,null)},Wc=function Qt(Ue){let bt=null,Wt=eO(Ue);for(ql(fe.beforeSanitizeShadowDOM,Ue,null);bt=Wt.nextNode();)ql(fe.uponSanitizeShadowNode,bt,null),Pg(bt),Mg(bt),bt.content instanceof r&&Qt(bt.content);ql(fe.afterSanitizeShadowDOM,Ue,null)};return o.sanitize=function(Qt){let Ue=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},bt=null,Wt=null,oo=null,Or=null;if(Og=!Qt,Og&&(Qt="<!-->"),typeof Qt!="string"&&!tO(Qt))if(typeof Qt.toString=="function"){if(Qt=Qt.toString(),typeof Qt!="string")throw Sb("dirty is not a string, aborting")}else throw Sb("toString is not a function");if(!o.isSupported)return Qt;if(Tg||em(Ue),o.removed=[],typeof Qt=="string"&&(Xd=!1),Xd){if(Qt.nodeName){let Ns=Co(Qt.nodeName);if(!qt[Ns]||Kd[Ns])throw Sb("root node is forbidden and cannot be sanitized in-place")}}else if(Qt instanceof s)bt=Jw("<!---->"),Wt=bt.ownerDocument.importNode(Qt,!0),Wt.nodeType===Ib.element&&Wt.nodeName==="BODY"||Wt.nodeName==="HTML"?bt=Wt:bt.appendChild(Wt);else{if(!Zd&&!Uc&&!Gl&&Qt.indexOf("<")===-1)return Re&&Dg?Re.createHTML(Qt):Qt;if(bt=Jw(Qt),!bt)return Zd?null:Dg?Ge:""}bt&&Eh&&Ia(bt.firstChild);let Ar=eO(Xd?Qt:bt);for(;oo=Ar.nextNode();)Pg(oo),Mg(oo),oo.content instanceof r&&Wc(oo.content);if(Xd)return Qt;if(Zd){if(xh)for(Or=Se.call(bt.ownerDocument);bt.firstChild;)Or.appendChild(bt.firstChild);else Or=bt;return(Xt.shadowroot||Xt.shadowrootmode)&&(Or=_e.call(e,Or,!0)),Or}let Pr=Gl?bt.outerHTML:bt.innerHTML;return Gl&&qt["!doctype"]&&bt.ownerDocument&&bt.ownerDocument.doctype&&bt.ownerDocument.doctype.name&&es(Cce,bt.ownerDocument.doctype.name)&&(Pr="<!DOCTYPE "+bt.ownerDocument.doctype.name+`>
|
|
196
|
-
`+Pr),Uc&&uk([Ae,Te,Pn],Ns=>{Pr=yb(Pr,Ns," ")}),Re&&Dg?Re.createHTML(Pr):Pr},o.setConfig=function(){let Qt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};em(Qt),Tg=!0},o.clearConfig=function(){Jd=null,Tg=!1},o.isValidAttribute=function(Qt,Ue,bt){Jd||em({});let Wt=Co(Qt),oo=Co(Ue);return A_(Wt,oo,bt)},o.addHook=function(Qt,Ue){typeof Ue=="function"&&_b(fe[Qt],Ue)},o.removeHook=function(Qt,Ue){if(Ue!==void 0){let bt=t8e(fe[Qt],Ue);return bt===-1?void 0:n8e(fe[Qt],bt,1)[0]}return sce(fe[Qt])},o.removeHooks=function(Qt){fe[Qt]=[]},o.removeAllHooks=function(){fe=uce()},o}var pz=_ce();var yce={ADD_TAGS:["velt-skeleton-loader"],ADD_ATTR:["border-radius"]},Fe=(()=>{let o=class o{constructor(e,t,r){this.rendererFactory2=e,this.loggingService=t,this.sanitizer=r,this.isVideoEditorHandlingDelete=!1,this.pageScrollHeight=0,this.enableRectSelectionSubject$=new ve(!1),this.enableRectSelection$=this.enableRectSelectionSubject$.asObservable(),this.scrollableElementsIds$=new ve([]),this.mousedown=!1,this.windowMouseDown$=new et,this.windowPointerMove$=new ve(null),this.windowPointerUp$=new ve(null),this.documentSelectionChange$=new ve(null),this.windowClick$=new ve(null),this.windowScroll$=new ve(null),this.windowResize$=new ve(null),this.windowKeyupBackspace$=new ve(null),this.windowKeyupDelete$=new ve(null),this.windowKeyupEsc$=new ve(null),this.windowPopState$=new ve(null),this.documentClick$=new ve(null),this.documentClickSubject$=new et,this.documentFocus$=new ve(null),this.windowKeydownShift$=new ve(null),this.windowKeyupShift$=new ve(null),this.mutation$=new ve(null),this.childListMutation$=new ve(null),this.networkStatus$=new ve(!1),this.xpathCache=new Map,this.xpathCacheId=new Map,this.selectedAnnotationsMap$=new ve({}),this.selectedAnnotationsLocationMap$=new ve({}),this.recordingInProgress$=new ve({}),this.deleteAnnotations$=new ve([]),this.pinHighlighterClass$=new ve(null),this.dialogOpenedInSidebar$=new ve(!1),this.textHighlighterClass$=new ve(null),this.commentPinHighlighter$=new ve(!1),this.deviceInfo$=new ve(new Gn),this.customCss$=new ve(null),this.mutationObserver=null,this.previousMousePosition={pageX:0,pageY:0,clientX:0,clientY:0},this.currentMousePosition={pageX:0,pageY:0,clientX:0,clientY:0,element:{xpath:"",topPercentage:0,leftPercentage:0}},this.nodeMap={},this.unlistenElementScroll={},this.filterSnippylyNodes=a=>{try{let s=[];return a.forEach(d=>{if(!qi(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 p=!1;d.childNodes.forEach(u=>{qi(u)&&(p=!0)}),p||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.renderer=this.rendererFactory2.createRenderer(null,null);let a=this.calculateScreenSize();this.currentScreenSize$=new ve(a),this.currentMousePosition$=new ve(this.currentMousePosition),this.detectNetworkStatusChange(),this.getScrollableElementsIds$().pipe(Ri(),gn(([s,d])=>{try{let p=d.filter(C=>!s.includes(C)),u=s.filter(C=>!d.includes(C));u.length&&u.map(E=>document.getElementById(E)).filter(E=>E).forEach(E=>{this.unlistenElementScroll&&this.unlistenElementScroll[E.id]&&this.unlistenElementScroll[E.id]()}),p.length&&p.map(E=>document.getElementById(E)).filter(E=>E).forEach(E=>{this.unlistenElementScroll[E.id]=this.renderer.listen(E,"scroll",D=>{let L=this.calculateScreenSize();this.currentScreenSize$.next(L)})})}catch(p){this.loggingService.catch("Error in DomService getScrollableElementsIds subscription: ",p)}})).subscribe(()=>{},s=>{this.loggingService.catch("Error in DomService getScrollableElementsIds subscription: ",s)}),this.getSelectedAnnotationsMap$().subscribe(s=>{Object.keys(s||{})?.length?Qre("snippylyUserScalableNo","viewport","width=device-width, user-scalable=no"):Jre("snippylyUserScalableNo")},s=>{this.loggingService.catch("Error in DomService getSelectedAnnotationsMap$ subscription: ",s)})}catch(a){this.loggingService.catch("Error in DomService constructor: ",a)}}setDocService(e){try{this.docService=e,this.subscribeToDomEvents()}catch(t){this.loggingService.catch("Error in DomService setDocService: ",t)}}subscribeToDomEvents(){try{this.docService?.getDocumentPaths$().pipe(de(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(),En([this.docService?.getOrganizationConfig$(),this.docService?.getDocumentPaths$()]).pipe(de(([e,t])=>!!e||!!t),kt(),de(e=>{e?this.onDocumentClick():this.unsubscribeFromDocumentClick()})).subscribe()}catch(e){this.loggingService.catch("Error in DomService subscribeToDomEvents: ",e)}}setScrollableElementsIds(e){try{e&&e.length&&this.scrollableElementsIds$.next(Array.from(new Set(e)))}catch(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.mutationObserver=new MutationObserver(t=>{try{if(t?.find(a=>a?.attributeName===j.VELT_IGNORE_CHANGE_DETECTION))return;let r=t.filter(a=>a.type==="childList").filter(a=>{let s=a.target;return a.removedNodes.forEach(d=>{let p=d;if(typeof p.getAttribute=="function"){let u=p.getAttribute(j.ATTRIBUTES.VELT_ELEMENT_CACHE_ID);if(u!==null&&u!==""){let C=this.xpathCacheId.get(u);C!==void 0&&(this.xpathCacheId.delete(u),this.xpathCache.delete(C))}}}),qi(s)?!1:!!(this.filterSnippylyNodes(a.addedNodes).length||this.filterSnippylyNodes(a.removedNodes).length)});this.childListMutation$.next(r),r.push(...t.filter(a=>a.type==="attributes").filter(a=>!qi(a.target)).filter(a=>this.filterSnippylyNodes([a.target]).length).filter(a=>{if(a){let s=a.target;return s?.classList?.contains("snippyly-sidebar-panel")?!1:s?!s.getAttribute(j.VELT_IGNORE_CHANGE_DETECTION):!0}return!0})),r=r.filter(a=>{let s=!0;return Object.keys(j.INGNORE_MUTATION_OBSERVER_CHANGE_TAGS).forEach(d=>{a.target?.closest(d)&&(s=!1)}),s}),r=r.filter(a=>a.target&&To(a.target)),r.length&&this.mutation$.next(r)}catch(r){this.loggingService.catch("Error in DomService change detection: ",r)}}),this.mutationObserver.observe(document.body,{childList:!0,subtree:!0,attributes:!0}))}catch(t){this.loggingService.catch("Error in DomService change detection: ",t)}}unsetMutationObserver(){try{this.mutationObserver&&(this.mutationObserver.disconnect(),this.mutationObserver=null)}catch(e){this.loggingService.catch("Error in DomService unsetMutationObserver: ",e)}}detectNetworkStatusChange(){this.loggingService.log("%c[WB] Calling FUNCTION: detectNetworkStatusChange","color: green;");try{ao(mi(window,"offline").pipe(de(()=>!1)),mi(window,"online").pipe(de(()=>!0)),new Lt(e=>{e.next(navigator.onLine),e.complete()})).subscribe(e=>{this.networkStatus$.next(e)})}catch(e){this.loggingService.catch("Error in DomService detectNetworkStatusChange: ",e)}}onWindowResize(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowResize","color: green;");try{this.unsubscribeFromWindowResize(),this.unlistenWindowResize=this.renderer.listen("window","resize",e=>{this.windowResize$.next(e);let t=this.calculateScreenSize();this.deviceInfo$.next(new Gn),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()!==j.TAGS.SUPERFLOW_TOOLBAR&&(this.documentClick$.next(e),this.documentClickSubject$.next(e))},document.addEventListener("click",this.documentClickListener,!0)}catch(e){this.loggingService.catch("Error in DomService onDocumentClick: ",e)}}unsubscribeFromDocumentClick(){try{this.documentClickListener&&typeof this.documentClickListener=="function"&&(document.removeEventListener("click",this.documentClickListener,!0),this.documentClickListener=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromDocumentClick: ",e)}}onDocumentFocus(){this.loggingService.log("%c[WB] Calling FUNCTION: onDocumentFocus","color: green;");try{this.unsubscribeFromDocumentFocus(),this.documentFocusListener=e=>{this.documentFocus$.next(e)},document.addEventListener("focus",this.documentFocusListener,!0)}catch(e){this.loggingService.catch("Error in DomService onDocumentFocus: ",e)}}unsubscribeFromDocumentFocus(){try{this.documentFocusListener&&typeof this.documentFocusListener=="function"&&(document.removeEventListener("focus",this.documentFocusListener,!0),this.documentFocusListener=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromDocumentFocus: ",e)}}onWindowKeydownShift(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeydownShift","color: green;");try{this.unsubscribeFromWindowKeydownShift(),this.unlistenWindowKeydownShift=this.renderer.listen("window","keydown.shift",e=>{this.windowKeydownShift$.next(e),this.windowKeyupShift$.next(null)})}catch(e){this.loggingService.catch("Error in DomService onWindowKeydownShift: ",e)}}unsubscribeFromWindowKeydownShift(){try{this.unlistenWindowKeydownShift&&typeof this.unlistenWindowKeydownShift=="function"&&(this.unlistenWindowKeydownShift(),this.unlistenWindowKeydownShift=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromWindowKeydownShift: ",e)}}onWindowKeyupShift(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeyupShift","color: green;");try{this.unsubscribeFromWindowKeyupShift(),this.unlistenWindowKeyupShift=this.renderer.listen("window","keyup.shift",e=>{this.windowKeyupShift$.next(e),this.windowKeydownShift$.next(null)})}catch(e){this.loggingService.catch("Error in DomService onWindowKeyupShift: ",e)}}unsubscribeFromWindowKeyupShift(){try{this.unlistenWindowKeyupShift&&typeof this.unlistenWindowKeyupShift=="function"&&(this.unlistenWindowKeyupShift(),this.unlistenWindowKeyupShift=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromWindowKeyupShift: ",e)}}onWindowKeydown$(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeydown$","color: green;");try{return mi(window,"keydown")}catch(e){return this.loggingService.catch("Error in DomService onWindowKeydown$: ",e),Ug}}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),r=e.target;if(t?.includes("name()='svg'")){let C=this.getXPath(t);C&&(r=C.iterateNext()||e.target)}let a=r.getBoundingClientRect(),s=e.clientX-a.x,d=e.clientY-a.y,p=s*100/(a.width||1),u=d*100/(a.height||1);this.currentMousePosition.element={xpath:t,topPercentage:u,leftPercentage:p}}else this.currentMousePosition.element=null;this.currentMousePosition$.next(this.currentMousePosition)}catch(t){this.loggingService.catch("Error in DomService updateCurrentMousePosition: ",t)}}getTargetElementForCursorPosition(e,t=!0,r=!1,a=!0,s){try{let d=e,p=d?.touches?.length?d.touches[0]?.clientX:d.clientX,u=d?.touches?.length?d.touches[0]?.clientY:d.clientY,C=this.getBackgroundElement(p,u,t,r);if(C&&s&&typeof s=="function"&&(C=s(C)),C){let E=this.getXPath(C),D=this.getXPath(C,!0),L=C.getBoundingClientRect(),G=p-L.x,Y=u-L.y,ne=G*100/(L.width||1),ge=Y*100/(L.height||1),ye={xpath:E,fXpath:D,leftPercentage:ne,topPercentage:ge};if(a){let Re=this.getXPath(C,!0,!0);ye.cfXpath=Re}return ye}else return null}catch(d){return this.loggingService.catch("Error in DomService getTargetElementForCommentPinAnnotation: ",d),null}}getBackgroundElement(e,t,r=!0,a=!1){try{let s=document.elementsFromPoint(e,t),d=[];s.forEach(u=>{qi(u)?d=[]:To(u)&&d.push(u)}),a&&(d=d.filter(u=>this.isElementVisibleOnScreen(u)));let p=0;return r||d?.forEach((u,C)=>{u.tagName.toLowerCase()==="svg"&&(p=C)}),d[p]}catch(s){return this.loggingService.catch("Error in DomService getBackgroundElement: ",s),null}}getBackgroundVeltElement(e,t){try{let r=document.elementsFromPoint(e,t),a=[];return r.forEach(s=>{qi(s)&&To(s)&&a.push(s)}),a[0]}catch(r){return this.loggingService.catch("Error in DomService getBackgroundSnippylyElement: ",r),null}}setPointerPosition(e){this.loggingService.log("%c[WB] Calling FUNCTION: setPointerPosition","color: green;");try{this.previousMousePosition.pageX=e.pageX,this.previousMousePosition.pageY=e.pageY,this.currentMousePosition.pageX=e.pageX,this.currentMousePosition.pageY=e.pageY}catch(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,r=Math.min(t,e.width/2),a=Math.abs(e.y),s=e.y-20;return a>50&&(s=Math.abs(e.y)+180),this.loggingService.log(e),this.loggingService.log(r),this.loggingService.log(s),{topPositionX:r,topPositionY:s}}catch(e){return this.loggingService.catch("Error in DomService getTopLeftPosition: ",e),{topPositionX:0,topPositionY:0}}}toggleSelection(){this.enableRectSelectionSubject$.next(!this.enableRectSelectionSubject$.value)}enableSelection(){this.enableRectSelectionSubject$.next(!0)}disableSelection(){this.enableRectSelectionSubject$.next(!1)}setPinHighlighterClass(e){this.pinHighlighterClass$.next(e)}setTextHighlighterClass(e){this.textHighlighterClass$.next(e)}getTextHighlighterClass(){return this.textHighlighterClass$.asObservable()}enableCommentPinHighlighter(){this.commentPinHighlighter$.next(!0)}disableCommentPinHighlighter(){this.commentPinHighlighter$.next(!1)}getCommentPinHighlighter$(){return this.commentPinHighlighter$.asObservable()}getCommentPinHighlighter(){return this.commentPinHighlighter$?.value}highlightElement(e,t,r){if(e){if(!r&&this.getCommentPinHighlighter()&&(this.pinHighlighterClass$.value?this.addClassToElement(e,this.pinHighlighterClass$.value):this.addClassToElement(e,j.SNIPPYLY_HIGHLIGHT)),t&&!e.hasAttribute(j.ATTRIBUTES.DEFAULT_CURSOR)){let a=e.style.getPropertyValue("cursor"),s=e.style.getPropertyPriority("cursor"),d=a?{defaultCursorValue:a,defaultCursorPriority:s}:"";e.setAttribute(j.ATTRIBUTES.DEFAULT_CURSOR,d?JSON.stringify(d):""),e.style.setProperty("cursor",t,"important")}e.setAttribute(j.SNIPPYLY_HIGHLIGHT,"true"),e.setAttribute(j.VELT_IGNORE_CHANGE_DETECTION,"true")}}removeHighlightFromElement(e){if(e&&(this.pinHighlighterClass$.value&&this.removeClassFromElement(e,this.pinHighlighterClass$.value),this.removeClassFromElement(e,j.SNIPPYLY_HIGHLIGHT),e.removeAttribute(j.SNIPPYLY_HIGHLIGHT),e.removeAttribute(j.VELT_IGNORE_CHANGE_DETECTION),e.hasAttribute(j.ATTRIBUTES.DEFAULT_CURSOR))){try{if(e.style.removeProperty("cursor"),e.getAttribute(j.ATTRIBUTES.DEFAULT_CURSOR)){let t=JSON.parse(e.getAttribute(j.ATTRIBUTES.DEFAULT_CURSOR));e.style.setProperty("cursor",t.defaultCursorValue,t.defaultCursorPriority)}}catch{}e.removeAttribute(j.ATTRIBUTES.DEFAULT_CURSOR)}}highlightUserElement(e,t,r,a=!1){try{e&&(this.addClassToElement(e,j.VELT_LIVE_SELECTION_ON_ELEMENT),a&&this.addClassToElement(e,j.VELT_LIVE_SELECTION_ON_ELEMENT_DEFAULT),e.setAttribute(j.SNIPPYLY_HIGHLIGHT,"true"),e.setAttribute(j.VELT_IGNORE_CHANGE_DETECTION,"true"),t&&!e.style.getPropertyValue(j.VELT_SELECTION_COLOR)&&e.style.setProperty(j.VELT_SELECTION_COLOR,t),r&&e.setAttribute(j.SNIPPYLY_HIGHLIGHT_USER_NAME,r))}catch(s){this.loggingService.catch("Error in DomService highlightUserElement: ",s)}}removeHighlightUserFromElement(e){try{e&&(this.removeClassFromElement(e,j.VELT_LIVE_SELECTION_ON_ELEMENT),this.removeClassFromElement(e,j.VELT_LIVE_SELECTION_ON_ELEMENT_DEFAULT),e.removeAttribute(j.SNIPPYLY_HIGHLIGHT),e.removeAttribute(j.VELT_IGNORE_CHANGE_DETECTION),e.removeAttribute(j.VELT_SELECTION_COLOR),e.removeAttribute(j.SNIPPYLY_HIGHLIGHT_USER_NAME),e.style.removeProperty(j.VELT_SELECTION_COLOR))}catch(t){this.loggingService.catch("Error in DomService removeHighlightUserFromElement: ",t)}}previewHighlightElement(e){e&&e.setAttribute(j.SNIPPYLY_HIGHLIGHT_PREVIEW,"true")}removePreviewHighlightFromElement(e){e&&e.removeAttribute(j.SNIPPYLY_HIGHLIGHT_PREVIEW)}getXPath(e,t=!1,r=!1,a){try{let s=this.calculateXPath(e,t,r,a);if(s&&typeof s=="string"&&s.includes("/svg")){let d=s.split("/"),p=!1;d.forEach((u,C)=>{u.includes("svg")&&(p=!0),p&&(d[C]="svg:"+u)}),s=d.join("/")}return s}catch(s){this.loggingService.catch("Error in DomService getXPath:",s)}}namespaceResolver(e){return e==="svg"?"http://www.w3.org/2000/svg":null}calculateXPath(e,t,r,a){try{if(e){if(typeof e=="string")return document.evaluate(e,a||document,this.namespaceResolver,XPathResult.ANY_TYPE,null);if(!e||e.nodeType!=1)return"";if(e.id&&document.querySelectorAll(`[id='${e.id}']`)?.length===1&&!t)return"//*[@id='"+e.id+"']";if(r&&e.className&&e.className.split){let d=e.className?.split(" ")?.filter(p=>!p?.includes("snippyly")&&!p?.includes("velt")&&!["show-pin-cursor"].includes(p))[0];if(d){let p=this.calculateXPath(e.parentNode,t,r,a)+"/"+e.tagName.toLowerCase(),u=Array.from(e.parentNode?.children||[]).filter(C=>C.nodeType===1&&C.tagName===e.tagName?C.className?.split(" ")?.filter(D=>D?.includes("snippyly")||D?.includes("velt")||["show-pin-cursor"].includes(D))[0]===d:!1);if(u.length>1){let C=u.indexOf(e)+1;p+=`[contains(concat(' ', normalize-space(@class), ' '), ' ${d} ')][${C}]`}else p+=`[contains(concat(' ', normalize-space(@class), ' '), ' ${d} ')]`;return p}}let s=[].filter.call(e.parentNode?.children?e.parentNode?.children:[],function(d){return d.tagName==e.tagName});return this.calculateXPath(e.parentNode,t,r)+"/"+e.tagName.toLowerCase()+(s.length>1?"["+([].indexOf.call(s,e)+1)+"]":"")}}catch(s){this.loggingService.catch("Error in DomService calculateXPath:",s)}}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 r=this.getXPath(e,!1,!1,t);if(r){let a=r?.iterateNext();if(a!==null&&typeof a.setAttribute=="function"){let s=vn();a.setAttribute(j.ATTRIBUTES.VELT_ELEMENT_CACHE_ID,s),this.xpathCacheId.set(s,e)}return this.xpathCache.set(e,a),a}return null}catch(r){return this.loggingService.catch("Error in DomService getElementFromXPath:",r),null}}calculateScreenSize(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowResize","color: green;");try{let e=[document?.body?.clientHeight||0,document?.documentElement?.clientHeight||0,window?.innerHeight||0],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 r=new ub;return r.screenWidth=Math.max(...t),r.screenHeight=Math.max(...e),r.screenScrollHeight=this.pageScrollHeight,r}catch(e){return this.loggingService.catch("Error in DomService calculateScreenSize:",e),new ub}}calculatePageScrollHeight(){this.loggingService.log("%c[WB] Calling FUNCTION: calculatePageScrollHeight","color: green;");try{this.pageScrollHeight=0,this.findLongestNode(document?.documentElement?.childNodes)}catch(e){this.loggingService.catch("Error in DomService calculatePageScrollHeight: ",e)}}removeSnippylyContent(e){this.loggingService.log("%c[WB] Calling FUNCTION: removeSnippylyContent","color: green;");try{let r=new DOMParser().parseFromString(e,"text/html");r.querySelectorAll("[data-snippyly-cache-id]").forEach(E=>{E.removeAttribute("data-snippyly-cache-id")}),r.querySelectorAll("[data-velt-cache-id]").forEach(E=>{E.removeAttribute("data-velt-cache-id")}),r.querySelectorAll(".comment-text-highlight").forEach(E=>{E?.parentNode?.insertBefore(document.createTextNode(E?.textContent),E),E.remove()});let p=document.createNodeIterator(r,NodeFilter.SHOW_COMMENT),u;for(;u=p.nextNode();)u?.remove();return this.mergeAdjacentTextNodes(r.body),this.sanitizeHtml(r.body.innerHTML)}catch(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 r=t.nextSibling;for(;r&&r.nodeType===Node.TEXT_NODE;)t.textContent+=r.textContent,r.remove(),r=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 r=Math.max(e[t]?.scrollHeight,e[t]?.clientHeight);this.pageScrollHeight=Math.max(r,this.pageScrollHeight),this.nodeMap[r]=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 r=Array.from(document.querySelectorAll(`[${j.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`)),a=this.getDraftCommentAnnotationDialogs()||[];r.push(...a),r=Array.from(new Set(r));let s=r.map(C=>C.classList.contains("velt-annotation-draft-checked")?(C.classList.remove("velt-annotation-draft-checked"),null):(this.removeClassFromElement(C,"velt-comment-dialog-shake"),setTimeout(()=>{this.addClassToElement(C,"velt-comment-dialog-shake"),C.getAttribute(j.ATTRIBUTES.VELT_ANNOTATION_EDIT_COMMENT)||C.classList.contains("velt-annotation-draft-checked")||this.addClassToElement(C,"velt-annotation-draft-checked")},100),C.getAttribute(j.ATTRIBUTES.VELT_ANNOTATION_DRAFT))).filter(C=>C),d=Object.keys(this.getRecordingInProgress()||{});s=[...s,...d];let p=this.selectedAnnotationsMap$.value;if(e&&this.selectedAnnotationsMap$.value&&Object.keys(this.selectedAnnotationsMap$.value).length){let C=[];Object.keys(p).forEach(E=>{if(p[E]?.type==="tag"){let D=p[E];D?.to?.length||s.includes(E)||C.push(D)}else p[E]?.comments?.length||s.includes(E)||C.push(p[E])}),this.deleteAnnotations$.next(C),this.deleteAnnotations$.next([])}let u={};Object.keys(p).forEach(C=>{if(s.includes(C)&&(u[C]=p[C]),t)switch(t){case"comment":["comment","videoPin"].includes(p[C]?.type)||(u[C]=p[C]);break;default:p[C]?.type!==t&&(u[C]=p[C]);break}}),Object.keys(u).forEach(C=>{let E=u[C]?.multiThreadAnnotationId;E&&!u[E]&&(u[E]={annotationId:E,type:"multiThread"})}),JSON.stringify(this.selectedAnnotationsMap$.value)!==JSON.stringify(u)&&this.selectedAnnotationsMap$.next(u),this.setDialogOpenedInSidebar(!1)}catch(r){this.loggingService.catch("Error in DomService resetSelectedAnnotationsMap: ",r)}}setRecordingInProgress(e,t){try{if(t)this.recordingInProgress$.next(T(I({},this.recordingInProgress$.value),{[e]:t}));else{let r=this.recordingInProgress$.value;delete r[e],this.recordingInProgress$.next(r)}}catch(r){this.loggingService.catch("Error in DomService setRecordingInProgress: ",r)}}resetRecordingInProgress(){try{this.recordingInProgress$.next({})}catch(e){this.loggingService.catch("Error in DomService resetRecordingInProgress: ",e)}}getRecordingInProgress(){try{return this.recordingInProgress$.value}catch(e){return this.loggingService.catch("Error in DomService getRecordingInProgress: ",e),{}}}getDraftCommentAnnotationDialogs(){try{let e=[];return Array.from(document.querySelectorAll(`${j.TAGS.SNIPPYLY_COMMENT_DIALOG}`)).forEach(r=>{if(r?.shadowRoot){let a=r.shadowRoot.querySelector(`[${j.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);a&&e.push(a)}else{let a=r.querySelector(`${j.TAGS.VELT_SHADOW_DOM_INTERNAL}`);if(a?.shadowRoot){let s=a.shadowRoot?.querySelector(`[${j.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);s&&e.push(s)}else{let s=r.querySelector(`[${j.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);s&&e.push(s)}}}),e}catch(e){return this.loggingService.catch("Error in DomService getDraftCommentAnnotationDialogs: ",e),[]}}getSelectedAnnotationsMap(e){try{let t=this.selectedAnnotationsMap$.value;if(e){let r={};return Object.keys(t).forEach(a=>{switch(e){case"comment":["comment","videoPin"].includes(t[a].type)&&(r[a]=t[a]);break;default:t[a].type===e&&(r[a]=t[a]);break}}),r}else return t}catch(t){return this.loggingService.catch("Error in DomService getSelectedAnnotationsMap: ",t),{}}}getSelectedAnnotationsMap$(e){return this.selectedAnnotationsMap$.asObservable().pipe(de(t=>{if(e){let r={};return Object.keys(t).forEach(a=>{t[a].type===e&&(r[a]=t[a])}),r}else return t}))}getSelectedComments$(){return this.selectedAnnotationsMap$.asObservable().pipe(de(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,r,a=!1,s){try{r==="sidebarShowReplies"?this.setDialogOpenedInSidebar(!0):this.setDialogOpenedInSidebar(!1);let d=JSON.parse(JSON.stringify(this.selectedAnnotationsMap$.value||{})),p=JSON.parse(JSON.stringify(this.selectedAnnotationsLocationMap$.value||{}));d[e.annotationId]&&!a?delete d[e.annotationId]:((!this.windowKeydownShift$.value||a)&&(d={}),d[e.annotationId]=e,p[e.annotationId]=t,s=e?.multiThreadAnnotationId||s,s&&(d[s]={annotationId:s,type:"multiThread"},p[s]=t)),this.selectedAnnotationsMap$.next(d),Object.keys(p).forEach(u=>{d[u]||delete p[u]}),this.selectedAnnotationsLocationMap$.next(p)}catch(d){this.loggingService.catch("Error in DomService toggleAnnotationSelection: ",d)}}setSelectedAnnotationLocation(e,t){try{let r=JSON.parse(JSON.stringify(this.getSelectedAnnotationsLocationMap()||{}));r?.[e]!==t&&(r[e]=t,this.selectedAnnotationsLocationMap$.next(r))}catch(r){this.loggingService.catch("Error in DomService setSelectedAnnotationLocation: ",r)}}updateSelectedAnnotationInMap(e){try{let t=this.selectedAnnotationsMap$.value;e.forEach(r=>{t[r.annotationId]&&(t[r.annotationId]=r)}),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),se([])}}getHighestNode(){return this.loggingService.log("%c[WB] Calling FUNCTION: getHighestNode","color: green;"),this.highestNode}onWindowMouseDown$(){return this.windowMouseDown$.asObservable()}onWindowPointerMove$(){return this.windowPointerMove$.asObservable()}onWindowPointerMove(){return this.windowPointerMove$.value}onWindowPointerUp$(){return this.windowPointerUp$.asObservable()}onSelectionChange$(){return this.documentSelectionChange$.asObservable()}onWindowClick$(){return this.windowClick$.asObservable()}onWindowScroll$(){return this.windowScroll$.asObservable()}onWindowResize$(){return this.windowResize$.asObservable()}onWindowKeyupBackspace$(){return this.windowKeyupBackspace$.asObservable()}onWindowKeyupDelete$(){return this.windowKeyupDelete$.asObservable()}onWindowKeyupEsc$(){return this.windowKeyupEsc$.asObservable()}onWindowPopState$(){return this.windowPopState$.asObservable()}onDocumentClick$(){return this.documentClick$.asObservable()}getLastDocumentClick(){return this.documentClick$.value}onDocumentClickSubject$(){return this.documentClickSubject$.asObservable()}onDocumentFocus$(){return this.documentFocus$.asObservable()}onDomChange$(e){try{return this.mutationObserver||this.setMutationObserver(e),this.mutation$.asObservable()}catch(t){return this.loggingService.catch("Error in DomService onDomChange$: ",t),se([])}}getChildListMutation$(){return this.childListMutation$.asObservable()}onNetworkStatusChange$(){return this.networkStatus$.asObservable()}getElementOffset(e,t){try{let r={offsetTop:0,offsetLeft:0},a=e;if(a===t){let s=window.getComputedStyle(e);s.position==="static"&&s.transformStyle!="preserve-3d"&&s.transform=="none"&&(r.offsetLeft=e?.offsetLeft||0,r.offsetTop=e?.offsetTop||0)}if(a!==t)if(e?.closest("svg"))for(;a&&a!==t;){let d=window.getComputedStyle(a);if(a.tagName.toLowerCase()==="svg"||a instanceof SVGElement){let p=a.parentElement;if(p){let u=p.getBoundingClientRect(),C=a.getBoundingClientRect();r.offsetLeft+=C.left-u.left,r.offsetTop+=C.top-u.top}}else d.position==="static"?d.transformStyle!="preserve-3d"&&d.transform=="none"&&(r.offsetLeft+=a?.offsetLeft||0,r.offsetTop+=a?.offsetTop||0):(r.offsetLeft+=a.offsetLeft,r.offsetTop+=a.offsetTop);if(a=a.parentElement,e instanceof SVGElement&&a===t){let p=window.getComputedStyle(a);p.position==="static"&&p.transformStyle!="preserve-3d"&&p.transform=="none"&&(r.offsetLeft+=a?.offsetLeft||0,r.offsetTop+=a?.offsetTop||0)}}else{let d=window.getComputedStyle(a);d.position==="static"?d.transformStyle!="preserve-3d"&&d.transform=="none"&&(r.offsetLeft+=a?.offsetLeft||0,r.offsetTop+=a?.offsetTop||0):(r.offsetLeft+=a.offsetLeft,r.offsetTop+=a.offsetTop)}return r}catch(r){return this.loggingService.catch("Error in DomService getElementOffset: ",r),{offsetTop:0,offsetLeft:0}}}isElementVisible(e){try{if(typeof e?.getBoundingClientRect=="function"){let{width:t,height:r,top:a,bottom:s}=e?.getBoundingClientRect();return t>0||r>0||a<window.innerHeight&&s>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,r=window.getComputedStyle(t);return!(r.display==="none"||r.visibility==="hidden"||parseFloat(r.opacity)===0)}return!1}catch(t){return this.loggingService.catch("Error in DomService isElementVisibleOnScreen: ",t),!1}}getClickAndDragPointsObservable(){return new Lt(e=>{let t=mi(document,"mousedown").pipe(de(p=>({type:p.type,x:p.clientX+window.scrollX,y:p.clientY+window.scrollY,event:p}))),r=mi(document,"mousemove").pipe(de(p=>({type:p.type,x:p.clientX+window.scrollX,y:p.clientY+window.scrollY,event:p}))),a=mi(document,"mouseup").pipe(de(p=>({type:p.type,x:p.clientX+window.scrollX,y:p.clientY+window.scrollY,event:p}))),d=t.pipe(he(p=>r.pipe(Ri(),de(([u,C])=>({startPoint:p,prevPoint:u,curPoint:C})),so(a)))).subscribe(e);return()=>d.unsubscribe()})}drawRectangle(e,t){let r=document.querySelector(".rectangle");r||(r=document.createElement("div"),this.addClassToElement(r,"rectangle"),r.setAttribute(j.ATTRIBUTES.VELT_COMMENT_DISABLED,"true"),r.setAttribute(j.VELT_IGNORE_CHANGE_DETECTION,"true"),document.body.appendChild(r));let a=Math.abs(t.x-e.x),s=Math.abs(t.y-e.y),d=Math.min(e.x,t.x),p=Math.min(e.y,t.y);return r.style.width=`${a}px`,r.style.height=`${s}px`,r.style.left=`${d}px`,r.style.top=`${p}px`,r.style.position="absolute",r.style.border="2px dashed #f00",r.style.pointerEvents="none",r.style.zIndex="2147483577",r}getRange(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: getRange","color: green;"),window.getSelection()?.toString()){let e=window.getSelection();if(e?.rangeCount)return e.getRangeAt(0)}return null}catch(e){return this.loggingService.catch("Error in DomService getRange: ",e),null}}clearTextSelection(){try{this.loggingService.log("%c[WB] Calling FUNCTION: clearTextSelection","color: green;"),window.getSelection&&(window.getSelection()?.empty?window.getSelection()?.empty():window.getSelection()?.removeAllRanges&&window.getSelection()?.removeAllRanges())}catch(e){this.loggingService.catch("Error in DomService clearTextSelection: ",e)}}getTargetTextRangeFromSelectionRange(e){try{let t={},r=e.commonAncestorContainer;r?.nodeType===Node.TEXT_NODE&&(r=r.parentElement);let a=document.body;if(r){let d=this.getTextXPath(r);this.isXpathWithId(d)&&(a=r)}let s=this.getAdditionalLocationContainer(r);if(s&&(a=s),t.commonAncestorContainer=this.getTextXPath(a),t.commonAncestorContainer){let d=this.getElementFromXPath(t.commonAncestorContainer);d&&(t.commonAncestorContainerFXpath=this.getXPath(d,!0),t.commonAncestorContainerCFXpath=this.getXPath(d,!0,!0))}return t.text=e.toString(),t.occurrence=Ku(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,r=e.previousSibling;for(;r;)r.nodeType===Node.TEXT_NODE&&t++,r=r.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(j.NON_NESTABLE_ELEMENTS[e?.tagName?.toLowerCase()]){let r=e?.closest("picture");return r?r?.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(`[${j.ATTRIBUTES.VELT_LOCATION}], [${j.ATTRIBUTES.VELT_LOCATION_ID}]`)}catch(t){return this.loggingService.catch("Error in DomService isElementInsideAdditionalLocationContainer: ",t),!1}}getAdditionalLocationContainer(e){try{return e?.closest(`[${j.ATTRIBUTES.VELT_LOCATION}], [${j.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:r}){try{let a=[];if(e?.length)for(let s=0;s<e.length;s++){let d=document.getElementById(e[s]);d&&a.push(d)}if(t?.length)for(let s=0;s<t.length;s++){let d=document.getElementsByClassName(t[s]);for(let p=0;p<d.length;p++){let u=d[p];u&&u instanceof HTMLElement&&a.push(u)}}if(r?.length)for(let s=0;s<r.length;s++){let d=document.querySelectorAll(r[s]);for(let p=0;p<d.length;p++){let u=d[p];u&&u instanceof HTMLElement&&a.push(u)}}return a}catch(a){return this.loggingService.catch("Error in DomService getListedElements: ",a),[]}}isElementInsideListedElementIds(e,t){try{if(t?.length){for(let r=0;r<t.length;r++){let a=document.getElementById(t[r]);if(a&&a.contains(e))return!0}return!1}return!0}catch(r){return this.loggingService.catch("Error in DomService isElementInsideListedElementIds: ",r),!1}}isElementInsideListedElementClassNames(e,t){try{if(t?.length){for(let r=0;r<t.length;r++){let a=document.getElementsByClassName(t[r]);for(let s=0;s<a.length;s++)if(a[s].contains(e))return!0}return!1}return!0}catch(r){return this.loggingService.catch("Error in DomService isElementInsideListedElementClassNames: ",r),!1}}isElementInsideListedElementQuerySelectors(e,t){try{if(t?.length){for(let r=0;r<t.length;r++){let a=document.querySelectorAll(t[r]);for(let s=0;s<a.length;s++)if(a[s].contains(e))return!0}return!1}return!0}catch(r){return this.loggingService.catch("Error in DomService isElementInsideListedElementQuerySelectors: ",r),!1}}addClassToElement(e,t){try{this.loggingService.log("%c[WB] Calling FUNCTION: addClassToElement","color: green;"),e&&(e.classList?.contains(t)||e.classList?.add(t))}catch(r){this.loggingService.catch("Error in DomService addClassToElement: ",r)}}removeClassFromElement(e,t){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeClassFromElement","color: green;"),e&&e.classList?.contains(t)&&e.classList?.remove(t)}catch(r){this.loggingService.catch("Error in DomService removeClassFromElement: ",r)}}isElementInsideParentWithAttribute(e,t,r){try{let a=e;for(;a&&a!==document.body;){if(a?.getAttribute&&a?.getAttribute(t)===r)return!0;a=a.parentElement}return!1}catch(a){return this.loggingService.catch("Error in DomService isElementInsideParentWithAttribute: ",a),!1}}setVideoEditorHandlingDelete(e){try{this.isVideoEditorHandlingDelete=e}catch(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),se(null)}}injectCustomCss(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: injectCustomCss","color: green;");let t=this.customCss$.value;if(t){let r=e?.shadowRoot?.querySelector(`[${j.VELT_CUSTOM_CSS}]`);if(r&&r.remove(),t?.type==="link"){let a=document.createElement("link");a.href=t?.value,a.rel="stylesheet",a.setAttribute(j.VELT_CUSTOM_CSS,"true"),e?.shadowRoot?.appendChild(a)}else{let a=document.createElement("style");a.innerHTML=this.sanitizeHtml(t?.value),a.setAttribute(j.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 r=t.innerHTML;return r=r.replace(o.MULTIPLE_NBSP_REGEX," ").replace(o.TRIM_NBSP_REGEX,"").trim(),r}catch(t){return this.loggingService.catch("Error in DomService trimCommentHtml: ",t),e}}removeEmptyElements(e){try{let a=function(s){return r.test(s.innerHTML)};var t=a;let r=/^\s*(<br\s*\/?>)?\s*$/;for(;e.firstChild&&a(e.firstChild);)e.removeChild(e.firstChild);for(;e.lastChild&&a(e.lastChild);)e.removeChild(e.lastChild)}catch(r){this.loggingService.catch("Error in DomService removeEmptyElements: ",r)}}normalizeWhitespace(e){try{e.childNodes.forEach(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;"),pz.sanitize(e,yce)}catch(t){return this.loggingService.catch("Error in DomService sanitizeHtml: ",t),""}}sanitizeSvg(e){try{return pz.sanitize(e,yce)}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 Gn;this.deviceInfo$.next(e)}catch(e){this.loggingService.catch("Error in DomService setDeviceInfo: ",e)}}getDeviceInfo$(){try{return this.loggingService.log("%c[WB] Calling FUNCTION: getDeviceInfo$","color: green;"),this.deviceInfo$.asObservable()}catch(e){return this.loggingService.catch("Error in DomService getDeviceInfo$: ",e),se(new Gn)}}getTabId(){try{let e=sessionStorage.getItem(j.SESSION_STORAGE.VELT_TAB_ID),t=this.getTabIdFromWindowName();return(!e||e!==t)&&(e=vn(),sessionStorage.setItem(j.SESSION_STORAGE.VELT_TAB_ID,e),this.setTabIdToWindowName(e)),e}catch(e){return this.loggingService.catch("Error in DomService getTabId: ",e),null}}getTabIdFromWindowName(){try{return window.name}catch(e){return this.loggingService.catch("Error in DomService getTabIdFromWindowName: ",e),null}}setTabIdToWindowName(e){try{window.name=e}catch(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 Gn}}isMobileDevice(){try{return new Gn().getDeviceType()===tr.MOBILE}catch(e){return this.loggingService.catch("Error in DomService isMobileDevice: ",e),!1}}isTabletDevice(){try{return new Gn().getDeviceType()===tr.TABLET}catch(e){return this.loggingService.catch("Error in DomService isTabletDevice: ",e),!1}}isDesktopDevice(){try{return new Gn().getDeviceType()===tr.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(r=>{t.setAttribute(r.nodeName,r.nodeValue)}),e.childNodes.forEach(r=>{r.nodeType===Node.ELEMENT_NODE?t.appendChild(this.deepCloneElement(r)):r.nodeType===Node.TEXT_NODE&&t.appendChild(document.createTextNode(r.nodeValue))}),t}catch(r){return this.loggingService.catch("Error in DomService deepCloneElement: ",r),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(r=>{if(this.removeWireframeSuffixFromTags(r),r.tagName.toLowerCase().endsWith("-wireframe")){let a=r.tagName.toLowerCase().replace("-wireframe",""),s=document.createElement(a);for(Array.from(r.attributes).forEach(d=>{s.setAttribute(d.name,d.value)});r.firstChild;)s.appendChild(r.firstChild);r.parentNode.replaceChild(s,r)}})}isMonitorDevice(){try{return new Gn().getDeviceType()===tr.MONITOR}catch(e){return this.loggingService.catch("Error in DomService isMonitorDevice: ",e),!1}}};o.MULTIPLE_NBSP_REGEX=/(?: \s*){2,}/g,o.TRIM_NBSP_REGEX=/^(?: \s*)+|(?: \s*)+$/g,o.\u0275fac=function(t){return new(t||o)(J(Xo),J(y),J(Hs))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var je=(()=>{let o=class o{constructor(e,t,r,a,s,d,p,u){this.afAuth=e,this.configService=t,this.avatarService=r,this.coreActionsService=a,this.domService=s,this.functions=d,this.analyticsService=p,this.loggingService=u,this.user$=new ve(null),this.userOptions$=new ve(null),this.userContacts$=new ve(null),this.userOrganization$=new ve(null),this.providedUser=new Do,this.firebaseConfig$=new ve(null),this.advancedQueries$=new ve(null),this.planDetails$=new ve(null),this.signOutPreviousUser$=new ve(null),this.preSignOutFunctions=new Map,this.autoLoginCalled=!1,this.autoLoginRequired=!0,this.config=null,this.getPlanDetailsCalled=!1,this.forceReLoggedIn=!1,this.lastLoggedInUserData=null,this.sessionReLoginCount=0,this.SESSION_RE_LOGIN_COUNT_LIMIT=10,this.sessionReLoginSubscription=null,this.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(C=>{this.config=C}),this.forceReLoggedIn=localStorage.getItem(j.LOCAL_STORAGE.VELT_USER_FORCE_RE_LOGGED_IN)==="true",this.sessionReLoginSubscription=Qn(this.afAuth).pipe(Ko(this.afAuth.currentUser),Ri(),he(([C,E])=>this.domService.onNetworkStatusChange$().pipe(Le(D=>D),rt(1),de(()=>({previousUser:C,currentUser:E}))))).subscribe(D=>Q(this,[D],function*({previousUser:C,currentUser:E}){if(!E&&C){let L=C?.stsTokenManager?.expirationTime,G=new Date().getTime(),Y=L-G;G>L&&(this.analyticsService.trackEvent(X.Events.Core.SDK_SESSION_TOKEN_EXPIRED,{apiKey:this.apiKey,user:this.user$.value,lastLoggedInUserData:this.lastLoggedInUserData,timeLeft:Y,forceReset:this.userOptions$.value?.forceReset,sessionReLoginCount:this.sessionReLoginCount},!0,this.user$.value?.userSnippylyId),this.user$.value&&C?.uid===this.user$.value?.userSnippylyId&&this.lastLoggedInUserData?.user?.userSnippylyId===this.user$.value?.userSnippylyId&&(this.sessionReLoginCount>this.SESSION_RE_LOGIN_COUNT_LIMIT?(this.analyticsService.trackEvent(X.Events.Core.SDK_SESSION_RE_LOGIN_COUNT_EXCEEDED,{apiKey:this.apiKey,clientUserId:this.lastLoggedInUserData.user.userId,snippylyUserId:this.lastLoggedInUserData.user.userSnippylyId,timeLeft:Y,forceReset:this.userOptions$.value?.forceReset,sessionReLoginCount:this.sessionReLoginCount},!0,this.user$.value?.userSnippylyId),this.sessionReLoginSubscription?.unsubscribe()):(this.sessionReLoginCount++,this.analyticsService.trackEvent(X.Events.Core.SDK_SESSION_RE_LOGIN_TRIGGERED,{apiKey:this.apiKey,clientUserId:this.lastLoggedInUserData.user.userId,snippylyUserId:this.lastLoggedInUserData.user.userSnippylyId,user:this.getUserWithoutContacts(this.lastLoggedInUserData.user),timeLeft:Y,forceReset:this.userOptions$.value?.forceReset,sessionReLoginCount:this.sessionReLoginCount},!0,this.lastLoggedInUserData.user.userSnippylyId),this.initializeClient(this.lastLoggedInUserData.user,this.lastLoggedInUserData.userOptions,this.lastLoggedInUserData.initializeClientToken,this.lastLoggedInUserData.autoLogin,"internal-sessionReLogin"))))}}),C=>{this.loggingService.catch("Error in AuthService sessionReLoginSubscription: ",C)}),this.getUser$().pipe(kt(si)).subscribe(C=>{let E=Ca(C);this.coreActionsService.triggerAction(Hi.USER_UPDATE,E),this.coreActionsService.triggerAction(Hi.INIT_UPDATE,{event:Hi.USER_UPDATE,payload:{user:E}})})}catch(C){this.loggingService.catch("Error in AuthService constructor: ",C)}}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 QM),this.configService.initConfig(t),t.debugMode?sessionStorage.setItem("debugMode","true"):sessionStorage.removeItem("debugMode"),this.autoLoginCalled||Qn(this.afAuth).pipe(rt(1)).subscribe(r=>Q(this,null,function*(){if(this.autoLoginCalled=!0,r){let a=yield Dm(r,!0).catch(s=>null);if(a){let{user:s}=a?.claims;this.autoLoginRequired&&this.initializeClient(s,this.userOptions$?.value?T(I({},this.userOptions$?.value),{replaceContacts:!1,replaceGroupContacts:!1,replacePrivateContacts:!1}):{},new Date().getTime(),!0,"internal-autoLogin")}}}))}catch(r){this.loggingService.catch("Error in setApiKey: ",r)}}setUsersService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setUsersService","color: green;"),this.usersService=e}catch(t){this.loggingService.catch("Error in setUsersService: ",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(X.Events.Core.SDK_VALIDATE_CLIENT_FAILED,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,message:"Organization Id is not set",forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e)},!0,e.userSnippylyId),this.configService.getSF())this.loggingService.catch("OrganizationId is not set in Identify method",void 0,void 0,!0);else throw new Error("OrganizationId is not set in Identify method")}setVeltAuthProvider(e){return Q(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: setVeltAuthProvider","color: green;");try{this.onRetrySubscription?.unsubscribe();let t=yield Aj(()=>window.Velt.identify(e.user,e.options,{fromProvider:!0}),e.retryConfig||{retryCount:0,retryDelay:0});return t&&e.onTokenExpired&&typeof e.onTokenExpired=="function"&&(this.onRetrySubscription=this.coreActionsService.onAction(Hi.ERROR).pipe(Le(r=>r.code==="token_expired"),rt(10)).subscribe(r=>Q(this,null,function*(){r.code==="token_expired"&&(yield Aj(()=>Q(this,null,function*(){try{let a=yield e.onTokenExpired?.();return a?window.Velt.identify(e.user,T(I({},e.options),{authToken:a}),{fromProvider:!0}):!0}catch{return!1}}),e.retryConfig||{retryCount:0,retryDelay:0}))}))),t}catch(t){return this.loggingService.catch("Error in setVeltAuthProvider: ",t),null}})}initializeClient(e,t,r,a,s){return Q(this,null,function*(){try{if(this.autoLoginRequired=!1,this.userOptions$.next(t),this.initializeClientToken)this.pendingUserLogin=e,this.pendingUserLoginSource=s;else{e.userSnippylyId=Ev(this.configService.getApiKey(),e.userId),this.pendingUserLogin=void 0,this.pendingUserLoginSource=void 0,this.initializeClientToken=r;let d=yield Qn(this.afAuth).pipe(rt(1)).toPromise().catch(u=>null),p=!0;if(this.providedUser=JSON.parse(JSON.stringify(e)),d){let u=yield Dm(d,!0).catch(D=>null);if(!u)return;let{user:C,firebaseConfig:E}=u.claims;if(d?.uid!==e?.userSnippylyId||e?.groupId!==C?.groupId||e?.organizationId!==C?.organizationId||t?.forceReset||!a&&e?.organizationId&&!this.forceReLoggedIn||this.forceReLoginRequiredForAdvancedQueries(e)||this.forceReLoginRequiredForRegion(e,E))localStorage.setItem(j.LOCAL_STORAGE.VELT_USER_FORCE_RE_LOGGED_IN,"true"),this.forceReLoggedIn=!0,yield this.signOutUser("internal");else{this.loggingService.log("%c[WB] Calling FUNCTION: reinitializeCurrentUser","color: green;"),this.loggingService.log("Keeping user");let D=yield Dm(d,!0).catch(ne=>null);if(!D)return;let{firebaseConfig:L,user:G,advancedQueries:Y}=D.claims;this.validateOrganizationId(e),this.setFirebaseConfig(L),this.setAdvancedQueries(Y),G&&(this.providedUser.isAdmin=!!G.isAdmin),this.initializeSignedInUser(d,a),p=!1,this.analyticsService.trackEvent(X.Events.Core.SDK_USER_AUTH_SUCCESS,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,authType:"auto",forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e),source:s})}}if(p){this.analyticsService.trackEvent(X.Events.Core.SDK_VALIDATE_CLIENT_TRIGGERED,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e),source:s},!0,e.userSnippylyId,e.userId);let u=yr(this.functions,br({url:ni.cloudFunction.validateClient,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:20*60*1e3}),C=fa(),E=(yield u({apiKey:this.apiKey,user:e,version:C,authToken:t?.authToken}))?.data;if(E.error){if(this.analyticsService.trackEvent(X.Events.Core.SDK_VALIDATE_CLIENT_FAILED,T(I({apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,message:E.error,forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e)},E),{source:s}),!0,e.userSnippylyId,e.userId),E.error&&typeof E.error=="string")if(E.error?.toLowerCase()?.includes("token expired"))if(this.tokenExpiredErrorCount++,this.tokenExpiredErrorCount<=this.TOKEN_EXPIRED_ERROR_COUNT_LIMIT){let D={code:"token_expired",message:"Token expired",error:E?.error,source:E?.source};this.coreActionsService.triggerAction(Hi.ERROR,D)}else{let D={code:"too_many_retries",message:"Token expired. Too many retries.",error:E?.error,source:E?.source};this.coreActionsService.triggerAction(Hi.ERROR,D),this.analyticsService.trackEvent(X.Events.Core.SDK_JWT_EXPIRED_RETRY_EXCEEDED,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,forceReset:this.userOptions$.value?.forceReset,source:s},!0,e.userSnippylyId,e.userId)}else{let D=E;this.coreActionsService.triggerAction(Hi.ERROR,D)}throw E}else this.tokenExpiredErrorCount=0;if(this.analyticsService.trackEvent(X.Events.Core.SDK_VALIDATE_CLIENT_SUCCESS,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e),source:s},!0,e.userSnippylyId,e.userId),this.validateOrganizationId(e),E.firebaseConfig){this.setFirebaseConfig(E.firebaseConfig),yield this.signInWithCustomToken(e,E.token),this.loggingService.log("new signed in user",this.afAuth.currentUser);let D=yield Dm(this.afAuth.currentUser,!0).catch(Y=>null);if(!D)return;let{user:L,advancedQueries:G}=D.claims;this.setAdvancedQueries(G),this.providedUser.isAdmin=!!L?.isAdmin,this.initializeSignedInUser(this.afAuth.currentUser,a)}}this.initializeClientToken=0,this.lastLoggedInUserData={user:e,userOptions:t,initializeClientToken:r,autoLogin:a},this.checkForPendingLogin()}return e}catch(d){return this.initializeClientToken=0,this.checkForPendingLogin(),this.loggingService.catch("Error in initializeClient: ",d),Promise.resolve(null)}})}isVersionGreaterThanOrEqualTo4(){try{let e=fa();return(e?parseInt(e.split(".")?.[0]||"0"):0)>=4}catch(e){return this.loggingService.catch("Error in isVersionGreaterThanOrEqualTo4: ",e),!1}}forceReLoginRequiredForAdvancedQueries(e){try{let t=this.isVersionGreaterThanOrEqualTo4(),r=!1;try{let a=localStorage.getItem(j.LOCAL_STORAGE.VELT_ADVANCED_QUERIES);a&&(r=JSON.parse(a)?.advancedQueriesEnabled)}catch(a){this.loggingService.catch("Error in forceReLoginRequiredForAdvancedQueries: ",a)}return!!(t&&e.organizationId&&!r)}catch(t){return this.loggingService.catch("Error in forceReLoginRequiredForAdvancedQueries: ",t),!1}}forceReLoginRequiredForRegion(e,t){try{return!!(this.isVersionGreaterThanOrEqualTo4()&&e.organizationId&&!t?.region)}catch(r){return this.loggingService.catch("Error in forceReLoginRequiredForRegion: ",r),!1}}checkForPendingLogin(){this.pendingUserLogin&&this.initializeClient(this.pendingUserLogin,this.userOptions$?.value||{},new Date().getTime(),void 0,this.pendingUserLoginSource)}setFirebaseConfig(e){this.loggingService.log("%c[WB] Calling FUNCTION: setFirebaseConfig","color: green;");try{this.firebaseConfig$.value||this.firebaseConfig$.next({firebaseOptions:I(I({},ni.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(j.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 En([this.configService.getConfig$(),this.getAdvancedQueries$()]).pipe(de(()=>this.getAdvancedQueriesEnabled()),Hn(()=>se(!1)))}getAdvancedQueriesEnabled(){try{return!this.configService.getConfig()?.advancedQueriesDisabled&&!!this.getAdvancedQueries()?.advancedQueriesEnabled}catch(e){return this.loggingService.catch("Error in getAdvancedQueriesEnabled: ",e),!1}}signOutPreviousUser(){return this.signOutPreviousUser$.asObservable()}getUser(){return this.loggingService.log("%c[WB] Calling FUNCTION: getUser","color: green;"),this.afAuth?.currentUser?this.user$.value:null}getUser$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getUser$","color: green;"),Qn(this.afAuth).pipe(he(e=>e?this.user$.asObservable():se(null)),kt(si))}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=I(I({},this.providedUser),e),t){let r=I(I({},t),e);this.updateUserInternally(r)}}catch(t){this.loggingService.catch("Error in updateUser: ",t)}}signInWithCustomToken(e,t,r="manual"){this.loggingService.log("%c[WB] Calling FUNCTION: signInWithCustomToken","color: green;");try{return Cee(this.afAuth,t).then(a=>(this.analyticsService.trackEvent(X.Events.Core.SDK_USER_AUTH_SUCCESS,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,authType:r,forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e)}),a)).catch(a=>(this.analyticsService.trackEvent(X.Events.Core.SDK_USER_AUTH_FAILED,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,authType:r,forceReset:this.userOptions$.value?.forceReset,message:a.message,user:this.getUserWithoutContacts(e)}),a))}catch(a){return this.loggingService.catch("Error in signInWithCustomToken: ",a),Promise.reject(a)}}resetServicesCache(){this.loggingService.log("%c[WB] Calling FUNCTION: resetServicesCache in AuthService","color: green;");try{this.commonDbService?.unsubscribeFromObservables(),this.docService?.clearCacheOnUserCascade(),this.contactService?.clearCache(),this.iamService?.clearCache(),this.areaService?.clearCache(),this.commentService?.clearCache(),this.reactionService?.clearCache(),this.recorderAnnotationService?.clearCache(),this.viewsService?.clearCache()}catch(e){this.loggingService.catch("Error in resetServicesCache: ",e)}}initializeSignedInUser(e,t){this.loggingService.log("%c[WB] Calling FUNCTION: initializeSignedInUser","color: green;");try{let r=new Do;r.userSnippylyId=e.uid,r.type="signedIn",this.mergeUserWithProvidedUserData(r,t)}catch(r){this.loggingService.catch("Error in initializeSignedInUser: ",r)}}mergeUserWithProvidedUserData(e,t){return Q(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: mergeUserWithProvidedUserData","color: green;");try{e.userId=this.providedUser?.userId||e.userId;let r=null;if(this.usersService?.userDataProviderAvailable()){let a=yield this.usersService.resolveUsers({userIds:[e.userId],organizationId:this.providedUser?.organizationId||e.organizationId,skipUserCheck:!0});a&&a[e.userId]&&(r=JSON.parse(JSON.stringify(a[e.userId]||{}))),e=I(I({},e),r||{})}e.name=r?r?.name:this.providedUser?.name||e.name,e.clientUserName=r?r?.clientUserName:this.providedUser?.clientUserName||e.clientUserName,e.photoUrl=r?r?.photoUrl:this.providedUser?.photoUrl||e.photoUrl,e?.photoUrl===void 0&&(e.photoUrl=null),e.email=r?r?.email:this.providedUser?.email||e.email,e.color=r?.color||this.providedUser?.color||this.getUserAvatarColor(e.userId),e.textColor=r?.textColor||this.providedUser?.textColor||this.getUserTextColor(e.userId),e.initial=r?.initial||this.providedUser?.initial||e.initial||e.name?.charAt(0).toUpperCase()||e.email?.charAt(0).toUpperCase(),e.contacts=this.providedUser?.contacts||e.contacts,e.plan=this.providedUser?.plan||e.plan,e.groupId=this.providedUser?.groupId||e.groupId,e.clientGroupId=this.providedUser?.clientGroupId||e.clientGroupId,e.clientOrganizationId=this.providedUser?.clientOrganizationId||e.clientOrganizationId,e.organizationId=this.providedUser?.organizationId||e.organizationId,e.isAdmin=this.providedUser?.isAdmin,e.isReadOnly=this.providedUser?.isReadOnly,e.isAnonymous=this.providedUser?.isAnonymous,e.isGuest=this.providedUser?.isGuest,this.updateUserInternally(e)}catch(r){this.loggingService.catch("Error in mergeUserWithProvidedUserData: ",r)}})}updateUserInternally(e){return Q(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||(yield this.getPlanDetailsFromDb()),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)),r=T(I({},t),{lastUpdated:new Date})}catch(t){this.loggingService.catch("Error in updateUserToFirebase: ",t)}}getPlanDetailsFromDb(){return Q(this,null,function*(){try{this.getPlanDetailsCalled=!0;let t=yield yr(this.functions,br({url:ni.cloudFunction.getPlanDetails,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:20*60*1e3})({apiKey:this.configService.getApiKey(),sdkVersion:fa(),sdkType:this.configService.getSdkType()});return t?.data?.isPlanExpired&&(this.analyticsService.trackEvent(X.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(Le(e=>!!e),de(e=>!!e?.isPlanExpired))}isPlanExpired(){return this.planDetails$.getValue()?.isPlanExpired}addPreSignOutFuction(e,t){try{this.preSignOutFunctions.set(e,t)}catch(r){this.loggingService.catch("Error in addPreSignOutFuction: ",r)}}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(he(e=>e?this.userOrganization$.asObservable().pipe(de(t=>t?.metadata?.organizationId===e.organizationId?t:null)):se(null)))}signOutUser(e="internal"){return Q(this,null,function*(){try{e==="external"&&this.onRetrySubscription?.unsubscribe(),yield this.analyticsService.trackEvent(X.Events.Core.SDK_USER_SIGN_OUT,{apiKey:this.apiKey,clientUserId:this.user$?.value?.userId,snippylyUserId:this.user$?.value?.userSnippylyId,message:e==="external"?"User Sign out":"System Sign out",user:this.user$?.value?this.getUserWithoutContacts(this.user$?.value):null,forceReset:this.userOptions$.value?.forceReset,source:e});let t=yield Qn(this.afAuth).pipe(rt(1)).toPromise().catch(r=>null);if(t){this.resetServicesCache(),this.user$.next(null);for(let[r,a]of this.preSignOutFunctions)try{yield a(t)}catch(s){this.loggingService.catch(`Error in signOutUser ${r} function: `,s)}return this.user$.next(null),yield Dd(1e3),_ee(this.afAuth).catch(r=>{this.loggingService.catch("Error in signOutUser:",r)})}else return Promise.resolve()}catch(t){this.loggingService.catch("Error in signOutUser: ",t)}})}isFeatureAllowed(e){return no(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 Ca(e)}catch(t){return this.loggingService.catch("Error in getUserForClient: ",t),null}}getUserAvatarColor(e){try{return e?this.avatarService.generateUserColor(fn(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{}}};o.\u0275fac=function(t){return new(t||o)(J(Ei),J(Vt),J(Rd),J(Nd),J(Fe),J($o),J(tt),J(y))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Fd=class{constructor({apiKey:o,documentId:n,organizationId:e,clientDocumentId:t,clientOrganizationId:r}){this.paths={},this.apiKey=o,this.documentId=n,this.organizationId=e,this.clientDocumentId=t,this.clientOrganizationId=r,t&&(this.documentId=xc(t)),r&&(this.organizationId=Tc(r)),this.generateDocumentPaths()}generateDocumentPaths(){try{if(this.paths.clientDocumentId=this.clientDocumentId,this.paths.documentId=this.documentId,this.organizationId&&(this.paths.organizationId=this.organizationId,this.paths.clientOrganizationId=this.clientOrganizationId),this.apiKey){let o=`${this.apiKey}`;this.organizationId&&(o=`${o}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${this.paths.organizationId}`),this.documentId&&(this.paths.docs=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/`,this.paths.presence=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_PRESENCE}/`,this.paths.cursor=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_CURSOR}/`,this.paths.comment=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_COMMENT}/`,this.paths.multiThread=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_MULTI_THREAD}/`,this.paths.tag=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_TAG}/`,this.paths.area=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_AREA}/`,this.paths.arrow=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_ARROW}/`,this.paths.selection=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_SELECTION}/`,this.paths.audioHuddle=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_AUDIO_HUDDLE}/`,this.paths.huddle=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_HUDDLE}/`,this.paths.recorder=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_RECORDER}/`,this.paths.flock=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_FOLLOW_ALONG}/`,this.paths.syncVideoPlayer=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_SYNC_VIDEO_PLAYER}/`,this.paths.liveState=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_LIVE_STATE}/`,this.paths.liveStateSingleEditorMode=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_LIVE_STATE}/default/singleEditorMode`,this.paths.reaction=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_REACTION}/`,this.paths.crdt=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_CRDT}/`,this.paths.views=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_VIEWS}/`,this.paths.notifications=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_NOTIFICATIONS}/`,this.paths.metadata=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_METADATA}/`,this.paths.users=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_USERS}/`,this.paths.documentIam=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_IAM}/`,this.paths.userConfig=`${o}/${j.FIREBASE_PARTIAL_PATH_USERS}`),this.paths.customerMetadata=`${o}/${j.FIREBASE_PARTIAL_PATH_CUSTOMER_METADATA}/`,this.paths.groupContacts=`${o}/${j.FIREBASE_PARTIAL_PATH_CONTACTS}/${j.FIREBASE_PARTIAL_PATH_GROUPS}/`,this.paths.globalContacts=`${o}/${j.FIREBASE_PARTIAL_PATH_CONTACTS}/${j.FIREBASE_PARTIAL_PATH_GLOBAL}/`,this.paths.logins=`${o}/${j.FIREBASE_PARTIAL_PATH_CONTACTS}/${j.FIREBASE_PARTIAL_PATH_LOGINS}/`,this.paths.userFeedback=`${o}/${j.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${j.FIREBASE_PARTIAL_PATH_FEEDBACK}/`,this.paths.userReportBugs=`${o}/${j.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${j.FIREBASE_PARTIAL_PATH_BUGS}/`,this.paths.userContactUs=`${o}/${j.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${j.FIREBASE_PARTIAL_PATH_CONTACT_US}/`,this.organizationId&&(this.paths.organizationMetadata=`${o}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_METADATA}/`,this.paths.organizationIam=`${o}/${j.FIREBASE_PARTIAL_PATH_IAM}/`,this.paths.organizationGroups=`${o}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_GROUPS}/`,this.paths.organizationNotifications=`${o}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/`,this.documentId&&(this.paths.organizationNotificationsWithDocumentId=`${o}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/`),this.paths.organizationNotificationsLastNotificationTimestamp=`${o}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${j.FIREBASE_PARTIAL_PATH_LAST_NOTIFICATION_TIMESTAMP}/${j.FIREBASE_PARTIAL_PATH_DOCS}/`,this.paths.organizationNotificationsUsers=`${o}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${j.FIREBASE_PARTIAL_PATH_USERS}/`),this.paths.workspaceIam=`${this.apiKey}/${j.FIREBASE_PARTIAL_PATH_IAM}/`}}catch{}}get 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 organizationNotifications(){return this.paths.organizationNotifications?this.paths.organizationNotifications:this.throwError("Organization notifications path is not available.")}get organizationNotificationsWithDocumentId(){return this.paths.organizationNotificationsWithDocumentId?this.paths.organizationNotificationsWithDocumentId:this.throwError("Organization notifications with document id path is not available.")}get organizationNotificationsUsers(){return this.paths.organizationNotificationsUsers?this.paths.organizationNotificationsUsers:this.throwError("Organization notifications users path is not available.")}get organizationNotificationsLastNotificationTimestamp(){return this.paths.organizationNotificationsLastNotificationTimestamp?this.paths.organizationNotificationsLastNotificationTimestamp:this.throwError("Organization notifications last notification timestamp path is not available.")}throwError(o){throw{type:"DocumentPaths",message:o,metadata:{apiKey:this.apiKey,documentId:this.documentId,organizationId:this.organizationId}}}};var vk=class{constructor({apiKey:o,documentId:n,organizationId:e,clientDocumentId:t,clientOrganizationId:r,folderId:a,veltFolderId:s}){this.paths={},this.apiKey=o,this.documentId=n,this.organizationId=e,this.veltFolderId=s,t&&(this.documentId=xc(t)),r&&(this.organizationId=Tc(r)),a&&(this.folderId=a,this.veltFolderId=zo(a)),this.generateDocumentPaths()}generateDocumentPaths(){try{if(this.paths.clientDocumentId=this.clientDocumentId,this.paths.documentId=this.documentId,this.organizationId&&(this.paths.organizationId=this.organizationId,this.paths.clientOrganizationId=this.clientOrganizationId),this.veltFolderId&&(this.paths.folderId=this.folderId,this.paths.veltFolderId=this.veltFolderId),this.apiKey){let o=`apiKey/${this.apiKey}`;this.organizationId&&(o=`${o}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${this.paths.organizationId}`,this.paths.organization=o,this.paths.folder=`${o}/${j.FIREBASE_PARTIAL_PATH_FOLDERS}`,this.paths.organizationUsers=`${o}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_USERS}`,this.paths.users=`${o}/${j.FIREBASE_PARTIAL_PATH_CENTRAL_USERS}`,this.paths.notificationDocs=`${o}/${j.FIREBASE_PARTIAL_PATH_NOTIFICATION_DOCS}`,this.paths.notificationUsers=`${o}/${j.FIREBASE_PARTIAL_PATH_NOTIFICATION_USERS}`,this.paths.organizationGroups=`${o}/${j.FIREBASE_PARTIAL_PATH_GROUPS}`,this.paths.lastNotificationTimestamp=`${o}/${j.FIREBASE_PARTIAL_PATH_LAST_NOTIFICATION_TIMESTAMP}`,this.paths.userConfig=`${o}/${j.FIREBASE_PARTIAL_PATH_USERS}`,this.paths.permissionsUsers=`${o}/${j.FIREBASE_PARTIAL_PATH_PERMISSIONS_USERS}`),this.veltFolderId&&(this.paths.folderUsers=`${o}/${j.FIREBASE_PARTIAL_PATH_FOLDERS}/${this.veltFolderId}/${j.FIREBASE_PARTIAL_PATH_FOLDER_USERS}`),this.documentId&&(this.paths.document=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}`,this.paths.comment=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_COMMENT}`,this.paths.location=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_LOCATION}`,this.paths.multiThread=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_MULTI_THREAD}`,this.paths.area=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_AREA}`,this.paths.recorder=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_RECORDER}`,this.paths.reaction=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_REACTION}`,this.paths.crdt=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_CRDT}`,this.paths.commentViews=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_COMMENT_VIEWS}`,this.paths.notificationViews=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_NOTIFICATION_VIEWS}`,this.paths.documentViews=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_DOCUMENT_VIEWS}`,this.paths.locationViews=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_LOCATION_VIEWS}`,this.paths.documentUsers=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_DOCUMENT_USERS}`,this.paths.docNotification=`${this.paths.notificationDocs}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_DOC_NOTIFICATION}`)}}catch{}}get 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 commentViews(){return this.paths.commentViews?this.paths.commentViews:this.throwError("CommentViews path is not available.")}get documentViews(){return this.paths.documentViews?this.paths.documentViews:this.throwError("DocumentViews path is not available.")}get locationViews(){return this.paths.locationViews?this.paths.locationViews:this.throwError("LocationViews path is not available.")}get notificationViews(){return this.paths.notificationViews?this.paths.notificationViews:this.throwError("NotificationViews path is not available.")}get documentUsers(){return this.paths.documentUsers?this.paths.documentUsers:this.throwError("DocumentUsers path is not available.")}get folderUsers(){return this.paths.folderUsers?this.paths.folderUsers:this.throwError("FolderUsers path is not available.")}get organizationUsers(){return this.paths.organizationUsers?this.paths.organizationUsers:this.throwError("OrganizationUsers path is not available.")}get notificationDocs(){return this.paths.notificationDocs?this.paths.notificationDocs:this.throwError("NotificationDocs path is not available.")}get notificationUsers(){return this.paths.notificationUsers?this.paths.notificationUsers:this.throwError("NotificationUsers path is not available.")}get multiThread(){return this.paths.multiThread?this.paths.multiThread:this.throwError("Multi thread path is not available.")}get recorder(){return this.paths.recorder?this.paths.recorder:this.throwError("Recorder path is not available.")}get reaction(){return this.paths.reaction?this.paths.reaction:this.throwError("Reaction path is not available.")}get crdt(){return this.paths.crdt?this.paths.crdt:this.throwError("CRDT path is not available.")}throwError(o){throw{type:"DocumentPaths",message:o,metadata:{apiKey:this.apiKey,documentId:this.documentId,organizationId:this.organizationId}}}};var Ck=class{};var _n=(()=>{let o=class o{constructor(e,t){this.authService=e,this.loggingService=t,this.db$=new ve(null);try{this.authService.getFirebaseConfig$().subscribe(r=>{r&&this.db$.next(x6(void 0,r.firebaseOptions.databaseURL))},r=>{this.loggingService.catch("Error in DatabaseService constructor: ",r)})}catch(r){this.loggingService.catch("Error in DatabaseService constructor:",r)}}getDb(){return this.db$.asObservable()}getDbValue(){return this.db$.getValue()}};o.\u0275fac=function(t){return new(t||o)(J(je),J(y))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var ws=(()=>{let o=class o{constructor(e,t){this.loggingService=e,this.analyticsService=t,this.resolveTimeout=1*60*1e3,this.retrySaveConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryDeleteConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryGetConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.commentAnnotationDataProvider$=new ve(null),this.commentAnnotationById$=new ve({}),this.fieldsToRemove=[],this.getCommentAnnotationById=r=>{try{return this.commentAnnotationDataProviderAvailable()?this.commentAnnotationById$.value?.[r]:void 0}catch(a){this.loggingService.catch("Error in CommentAnnotationsResolverService getCommentAnnotationById:",a);return}};try{this.loggingService.log("CommentAnnotationsResolverService initialized"),this.commentAnnotationDataProvider$.subscribe(r=>{r&&(r.config?.resolveTimeout&&(this.resolveTimeout=r.config.resolveTimeout),r.config?.saveRetryConfig&&(this.retrySaveConfig=r.config.saveRetryConfig),r.config?.deleteRetryConfig&&(this.retryDeleteConfig=r.config.deleteRetryConfig),r.config?.getRetryConfig&&(this.retryGetConfig=r.config.getRetryConfig),r.config?.fieldsToRemove&&(this.fieldsToRemove=r.config.fieldsToRemove))})}catch(r){this.loggingService.catch("Error in CommentAnnotationsResolverService constructor:",r)}}getProvider(){try{let e=this.commentAnnotationDataProvider$.getValue();return e||void 0}catch(e){this.loggingService.catch("Error in CommentAnnotationsResolverService getProvider:",e);return}}ngOnDestroy(){try{this.commentAnnotationById$.next({})}catch(e){this.loggingService.catch("Error in CommentAnnotationsResolverService ngOnDestroy:",e)}}resolveCommentAnnotations(e){return Q(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling CommentAnnotationsResolverService FUNCTION: resolveCommentAnnotations","color: green;"),!this.commentAnnotationDataProviderAvailable())return{};let t,r=!1,a=!1,s=()=>{t&&(clearTimeout(t),t=void 0,a=!0)};return new Promise((d,p)=>{t=setTimeout(()=>{a||(r=!0,s(),p(new Error("Comment annotation resolution timeout")))},this.commentAnnotationDataProvider$.value?.config?.resolveTimeout||this.resolveTimeout);let u=this.getProvider();if(!u)return s(),d({});let C={},E=[...new Set(e.commentAnnotationIds||[])],D=T(I({},e),{commentAnnotationIds:E});Q(this,null,function*(){try{if(E.length>0||e.documentIds?.length||e.folderId){let G=wc(()=>u?.get(D)||Promise.resolve(void 0),"getCommentAnnotations",this.retryGetConfig).then(Y=>r?{}:(s(),Y&&Y.statusCode!==200?(this.loggingService.catch(Y?.message??"Error in CommentAnnotationsResolverService resolveCommentAnnotations:"),{}):Y?.data)).catch(Y=>{throw s(),Y});try{C=(yield G)||{},this.analyticsService.trackEvent(X.Events.Resolver.COMMENT_RESOLVER_GET,{sourceMethod:"resolveCommentAnnotations",source:"sdk",commentAnnotationIds:E});let Y={};Object.entries(C).forEach(([ne,ge])=>{let ye=this.commentAnnotationById$.value?.[ne];ye?ye&&JSON.stringify(ye)!==JSON.stringify(ge)&&(Y[ne]=ge):Y[ne]=ge}),Object.keys(Y).length>0&&this.commentAnnotationById$.next(I(I({},this.commentAnnotationById$.getValue()),Y)),d(Y)}catch(Y){r||p(Y),d(C)}}else s(),d({})}catch(G){s(),p(G)}})})}catch(t){return this.loggingService.catch("Error in CommentAnnotationsResolverService resolveCommentAnnotations:",t),{}}})}saveCommentAnnotation(e){return Q(this,null,function*(){try{this.loggingService.log("%c[WB] Calling CommentAnnotationsResolverService FUNCTION: saveCommentAnnotation","color: green;");let t=this.getProvider();if(!this.commentAnnotationDataProviderAvailable())throw new Error("Comment annotation save data provider not available");let r=JSON.parse(JSON.stringify(this.commentAnnotationById$.getValue()));this.commentAnnotationById$._value=I(I({},r),e.commentAnnotation);let a=yield wc(()=>t?.save({commentAnnotation:e.commentAnnotation,event:e.eventType,commentId:e.commentId,metadata:Object.values(e.commentAnnotation??{})?.[0]?.metadata})||Promise.resolve(void 0),"saveCommentAnnotation",this.retrySaveConfig);return a&&a.statusCode!==200?(this.retrySaveConfig.revertOnFailure&&(this.commentAnnotationById$._value=r),this.loggingService.catch(a?.message??"Error in CommentAnnotationsResolverService saveCommentAnnotation:"),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(X.Events.Resolver.COMMENT_RESOLVER_SAVE,{sourceMethod:"saveCommentAnnotation",source:"sdk",commentAnnotationIds:Object.keys(e.commentAnnotation),eventType:e.eventType,commentId:e.commentId}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0})}catch(t){return this.loggingService.warn("Error in CommentAnnotationsResolverService saveCommentAnnotation:",t),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0}}})}deleteCommentAnnotation(e,t){return Q(this,null,function*(){try{this.loggingService.log("%c[WB] Calling CommentAnnotationsResolverService FUNCTION: deleteCommentAnnotation","color: green;");let r=this.getProvider();if(!this.commentAnnotationDataProviderAvailable())throw new Error("Comment annotation delete data provider not available");let a=this.commentAnnotationById$.getValue(),s=I({},a);delete s?.[e],this.commentAnnotationById$._value=s;let d=yield wc(()=>r?.delete({commentAnnotationId:e.toString(),metadata:t,event:Ja.COMMENT_ANNOTATION_DELETE})||Promise.resolve(void 0),"deleteCommentAnnotation",this.retryDeleteConfig);return d&&d.statusCode!==200?(this.retryDeleteConfig.revertOnFailure&&(this.commentAnnotationById$._value=a),this.loggingService.catch(d?.message??"Error in CommentAnnotationsResolverService deleteCommentAnnotation:"),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(X.Events.Resolver.COMMENT_RESOLVER_DELETE,{sourceMethod:"deleteCommentAnnotation",source:"sdk",commentAnnotationId:e.toString()}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0})}catch(r){return this.loggingService.warn("Error in CommentAnnotationsResolverService deleteCommentAnnotation:",r),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0}}})}getCommentAnnotationsById$(){try{return this.commentAnnotationDataProviderAvailable()?(this.loggingService.log("%c[WB] Calling CommentAnnotationsResolverService FUNCTION: getCommentAnnotationsById$","color: green;"),this.commentAnnotationById$.asObservable()):se(void 0)}catch(e){return this.loggingService.catch("Error in CommentAnnotationsResolverService getCommentAnnotationsById$:",e),se(void 0)}}getAnnotationById(e){try{return this.commentAnnotationDataProviderAvailable()?this.commentAnnotationById$.getValue()?.[e]:void 0}catch(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 r=["get","save","delete"].filter(a=>!(a in e)||typeof e[a]!="function");if(r.length>0){let a=`DataProviders.comment is invalid. The following methods are missing or are not functions: ${r.join(", ")}.`;this.loggingService.catch(a);return}else this.commentAnnotationDataProvider$.next(e)}}catch(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}}};o.\u0275fac=function(t){return new(t||o)(J(y),J(tt))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Ld=(()=>{let o=class o{constructor(e,t){this.loggingService=e,this.analyticsService=t,this.resolveTimeout=1*60*1e3,this.retrySaveConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryDeleteConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryGetConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.reactionAnnotationDataProvider$=new ve(null),this.reactionAnnotationById$=new ve({}),this.getReactionAnnotationById=r=>{try{return this.reactionAnnotationDataProviderAvailable()?this.reactionAnnotationById$.value?.[r]:void 0}catch(a){this.loggingService.catch("Error in ReactionAnnotationsResolverService getReactionAnnotationById:",a);return}};try{this.loggingService.log("ReactionAnnotationsResolverService initialized"),this.reactionAnnotationDataProvider$.subscribe(r=>{r&&(r.config?.resolveTimeout&&(this.resolveTimeout=r.config.resolveTimeout),r.config?.saveRetryConfig&&(this.retrySaveConfig=r.config.saveRetryConfig),r.config?.deleteRetryConfig&&(this.retryDeleteConfig=r.config.deleteRetryConfig),r.config?.getRetryConfig&&(this.retryGetConfig=r.config.getRetryConfig))})}catch(r){this.loggingService.catch("Error in ReactionAnnotationsResolverService constructor:",r)}}getProvider(){try{let e=this.reactionAnnotationDataProvider$.getValue();return e||void 0}catch(e){this.loggingService.catch("Error in ReactionAnnotationsResolverService getProvider:",e);return}}ngOnDestroy(){try{this.reactionAnnotationById$.next({})}catch(e){this.loggingService.catch("Error in ReactionAnnotationsResolverService ngOnDestroy:",e)}}resolveReactionAnnotations(e){return Q(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling ReactionAnnotationsResolverService FUNCTION: resolveReactionAnnotations","color: green;"),!this.reactionAnnotationDataProviderAvailable())return{};let t,r=!1,a=!1,s=()=>{t&&(clearTimeout(t),t=void 0,a=!0)};return new Promise((d,p)=>{t=setTimeout(()=>{a||(r=!0,s(),p(new Error("Reaction annotation resolution timeout")))},this.reactionAnnotationDataProvider$.value?.config?.resolveTimeout||this.resolveTimeout);let u=this.getProvider();if(!u)return s(),d({});let C={},E=[...new Set(e.reactionAnnotationIds||[])],D=T(I({},e),{reactionAnnotationIds:E});Q(this,null,function*(){try{if(E.length>0||e.documentIds?.length||e.folderId){let G=wc(()=>u?.get(D)||Promise.resolve(void 0),"getReactionAnnotations",this.retryGetConfig).then(Y=>r?{}:(s(),Y&&Y.statusCode!==200?(this.loggingService.catch(Y?.message??"Error in ReactionAnnotationsResolverService resolveReactionAnnotations:"),{}):Y?.data)).catch(Y=>{throw s(),Y});try{C=(yield G)||{},this.analyticsService.trackEvent(X.Events.Resolver.REACTION_RESOLVER_GET,{sourceMethod:"resolveReactionAnnotations",source:"sdk",reactionAnnotationIds:E});let Y={};Object.entries(C).forEach(([ne,ge])=>{let ye=this.reactionAnnotationById$.value?.[ne];ye?ye&&JSON.stringify(ye)!==JSON.stringify(ge)&&(Y[ne]=ge):Y[ne]=ge}),Object.keys(Y).length>0&&this.reactionAnnotationById$.next(I(I({},this.reactionAnnotationById$.getValue()),Y)),d(Y)}catch(Y){r||p(Y),d(C)}}else s(),d({})}catch(G){s(),p(G)}})})}catch(t){return this.loggingService.catch("Error in ReactionAnnotationsResolverService resolveReactionAnnotations:",t),{}}})}saveReactionAnnotation(e){return Q(this,null,function*(){try{this.loggingService.log("%c[WB] Calling ReactionAnnotationsResolverService FUNCTION: saveReactionAnnotation","color: green;");let t=this.getProvider();if(!this.reactionAnnotationDataProviderAvailable())throw new Error("Reaction annotation save data provider not available");let r=JSON.parse(JSON.stringify(this.reactionAnnotationById$.getValue()));this.reactionAnnotationById$._value=I(I({},r),e);let a={reactionAnnotation:e,event:Ja.REACTION_ADD,metadata:Object.values(e??{})?.[0]?.metadata},s=yield wc(()=>t?.save(a)||Promise.resolve(void 0),"saveReactionAnnotation",this.retrySaveConfig);return s&&s.statusCode!==200?(this.retrySaveConfig.revertOnFailure&&(this.reactionAnnotationById$._value=r),this.loggingService.catch(s?.message??"Error in ReactionAnnotationsResolverService saveReactionAnnotation:"),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(X.Events.Resolver.REACTION_RESOLVER_SAVE,{sourceMethod:"saveReactionAnnotation",source:"sdk",reactionAnnotationIds:Object.keys(e),eventType:a.event}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0})}catch(t){return this.loggingService.warn("Error in ReactionAnnotationsResolverService saveReactionAnnotation:",t),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0}}})}deleteReactionAnnotation(e,t){return Q(this,null,function*(){try{this.loggingService.log("%c[WB] Calling ReactionAnnotationsResolverService FUNCTION: deleteReactionAnnotation","color: green;");let r=this.getProvider();if(!this.reactionAnnotationDataProviderAvailable())throw new Error("Reaction annotation delete data provider not available");let a=JSON.parse(JSON.stringify(this.reactionAnnotationById$.getValue())),s=I({},a);delete s?.[e],this.reactionAnnotationById$._value=s;let d=yield wc(()=>r?.delete({reactionAnnotationId:e.toString(),metadata:t,event:Ja.REACTION_DELETE})||Promise.resolve(void 0),"deleteReactionAnnotation",this.retryDeleteConfig);return d&&d.statusCode!==200?(this.retryDeleteConfig.revertOnFailure&&(this.reactionAnnotationById$._value=a),this.loggingService.catch(d?.message??"Error in ReactionAnnotationsResolverService deleteReactionAnnotation:"),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(X.Events.Resolver.REACTION_RESOLVER_DELETE,{sourceMethod:"deleteReactionAnnotation",source:"sdk",reactionAnnotationId:e.toString()}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0})}catch(r){return this.loggingService.warn("Error in ReactionAnnotationsResolverService deleteReactionAnnotation:",r),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0}}})}getReactionAnnotationsById$(){try{return this.reactionAnnotationDataProviderAvailable()?(this.loggingService.log("%c[WB] Calling ReactionAnnotationsResolverService FUNCTION: getReactionAnnotationsById$","color: green;"),this.reactionAnnotationById$.asObservable()):se(void 0)}catch(e){return this.loggingService.catch("Error in ReactionAnnotationsResolverService getReactionAnnotationsById$:",e),se(void 0)}}getAnnotationById(e){try{return this.reactionAnnotationDataProviderAvailable()?this.reactionAnnotationById$.getValue()?.[e]:void 0}catch(t){this.loggingService.catch("Error in ReactionAnnotationsResolverService getAnnotationById:",t);return}}setReactionAnnotationDataProvider(e){try{if(e){this.loggingService.log("Setting reaction annotation data provider");let r=["get","save","delete"].filter(a=>!(a in e)||typeof e[a]!="function");if(r.length>0){let a=`DataProviders.reaction is invalid. The following methods are missing or are not functions: ${r.join(", ")}.`;this.loggingService.catch(a);return}else this.reactionAnnotationDataProvider$.next(e)}}catch(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}}};o.\u0275fac=function(t){return new(t||o)(J(y),J(tt))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var at=(()=>{let o=class o{constructor(e,t,r,a,s,d,p,u,C){this.analyticsService=e,this.authService=t,this.databaseService=r,this.domService=a,this.configService=s,this.loggingService=d,this.commentResolverService=p,this.reactionResolverService=u,this.coreActionsService=C,this.documentPaths$=new ve(null),this.documentIds$=new ve([]),this.organizationConfig$=new ve(null),this.firestorePaths$=new ve(null),this.location$=new ve(null),this.excludedLocationIds$=new ve([]),this.organizationMetadata$=new ve(null),this.documentMetadata$=new ve(null),this.locationMetadata$=new ve(null),this.customerMetadata$=new ve(null),this.currentDocumentId=null,this.isCustomDocId=!1,this.locations$=new ve({}),this.preDocumentIdChangeFunctions=new Map,this.draftDocuments=[],this.clientDocumentMetadataMap={},this.uiState=new ve({}),this.lastSetDocumentIdExecutionTime=0,this.lastSetDocumentIdCallTime=0,this.setDocumentIdSubject=new et,this.DEBOUNCE_TIME=5e3,this.MAX_QUEUE_SIZE=100,this.queueSize=0,this.isDocumentIdInDebounceQueue=!1,this.draftLocationMap={locations:[],options:void 0};try{this.loggingService.log("%c[WB] Creating CLASS: DocService","color: blue;"),this.domService.setDocService(this),this.authService.setDocService(this),this.setDocumentIdSubject.pipe(sr(this.DEBOUNCE_TIME)).subscribe({next:E=>Q(this,null,function*(){try{yield this.setDocumentIdImpl(E.documentId,E.clientOrganizationId,E.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:E=>{this.loggingService.catch("Error in setDocumentId subscription:",E),this.queueSize--}}),this.databaseService.getDb().pipe(Le(E=>!!E),rt(1)).subscribe(E=>{E&&(this.db=E)}),this.configService.getApiKey$().subscribe(E=>{if(this.apiKey=E,this.apiKey){if(!this.isCustomDocId){let D=UP(window.location.href);this.currentUrl=D}this.analyticsService.updateDefaultProperties({apiKey:E})}}),this.authService.getUser$().subscribe(E=>Q(this,null,function*(){E&&(this.analyticsService.updateDefaultProperties({organizationId:E?.organizationId,clientOrganizationId:E?.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&&E?.organizationId&&this.documentPaths$.value?.organizationId!==E?.organizationId&&(yield this.setDocuments({documents:this.documentIds$.value.length?this.documentIds$.value.map(D=>({id:D.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),E?.organizationId&&E?.clientOrganizationId&&(this.organizationConfig$.next({organizationId:E?.organizationId,clientOrganizationId:E?.clientOrganizationId}),yield this.updateOrganizationMetadata()))})),this.documentPaths$.subscribe(E=>{let D={documentId:E?.documentId,clientDocumentId:E?.clientDocumentId,folderId:E?.folderId,allDocuments:E?.allDocuments,veltFolderId:E?.veltFolderId};E?.organizationId&&(D.organizationId=E.organizationId,D.clientOrganizationId=E.clientOrganizationId),this.analyticsService.updateDefaultProperties(D),this.domService.resetSelectedAnnotationsMap()}),this.location$.subscribe(E=>{this.analyticsService.updateDefaultProperties({clientLocation:E?.location,locationId:E?.locationId})}),this.organizationMetadata$.subscribe(E=>{this.authService.setUserOrganization(E?.[this.documentPaths$.value?.organizationId])}),this.documentPaths$.pipe(Le(E=>!!E),rt(1)).subscribe(()=>{try{this.subscribeToCustomerMetadata()}catch(E){this.loggingService.catch("Error in DocService subscribeToCustomerMetadata:",E)}},E=>{this.loggingService.catch("Error in DocService subscribeToCustomerMetadata:",E)}),this.loggingService.log("%c[WB] Creating CLASS: DocService 2","color: blue;"),this.onWindowPopstate(),this.onWindowClick()}catch(E){this.loggingService.catch("Error in DocService constructor:",E)}}getOptionsFromDocumentPaths(){try{return this.documentPaths$.value?{folderId:this.documentPaths$.value?.folderId,allDocuments:this.documentPaths$.value?.allDocuments,locationId:this.documentPaths$.value?.locationId,organizationId:this.documentPaths$.value?.clientOrganizationId}: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.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)}}setCommonDbService(e){try{this.commonDbService=e}catch(t){this.loggingService.catch("Error in setCommonDbService:",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=UP(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=UP(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(s){return Q(this,arguments,function*({documentId:e,documentMetadata:t,options:r,source:a="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocument","color: green;"),a==="internal"&&this.analyticsService.trackEvent(X.Events.Core.SET_DOCUMENTS_TRIGGERED,{payload:{id:e,documentMetadata:t,methodName:"setDocument",source:a}}),this.coreActionsService.triggerAction(Hi.INIT_UPDATE,{event:X.Events.Core.SET_DOCUMENTS_TRIGGERED,methodName:"setDocument",source:a,payload:{documentId:e,documentMetadata:t,options:r}}),yield this.setDocumentsImpl({documents:[{id:e,metadata:t}],options:I({organizationId:t?.organizationId},r??{}),source:a})}catch(d){this.loggingService.catch("Error in DocService setDocument:",d)}})}shouldSetDocumentsAgain(e,t={}){try{this.loggingService.log("%c[WB] Calling FUNCTION: shouldSetDocumentsAgain","color: green;");let r=this.documentPaths$.value?.clientDocumentId,a=t?.rootDocumentId??e[0]?.id,s=this.documentIds$.value.map(u=>u.clientDocumentId),d=Sj(this.getOptionsFromDocumentPaths()??{})??{};return!e.every(u=>s.includes(u.id))||!zi(d,t)||r!==a}catch(r){return this.loggingService.catch("Error in DocService shouldSetDocumentsAgain:",r),!0}}getDocumentIdsFromDocuments({documents:e,setClientDocumentMetadataMap:t=!1}){try{let r=[];return e.forEach(a=>{let s=a.id,d=`${fn(s)}`;t&&a?.metadata&&typeof a.metadata=="object"&&(this.clientDocumentMetadataMap[s]=a.metadata),r.push({documentId:d,clientDocumentId:s})}),r}catch(r){return this.loggingService.catch("Error in DocService getDocumentIdsFromDocuments:",r),[]}}setDocuments(a){return Q(this,arguments,function*({documents:e,options:t,source:r="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocuments","color: green;"),r==="internal"&&this.analyticsService.trackEvent(X.Events.Core.SET_DOCUMENTS_TRIGGERED,{payload:{documents:e,options:t,methodName:"setDocuments",source:r}}),this.coreActionsService.triggerAction(Hi.INIT_UPDATE,{event:X.Events.Core.SET_DOCUMENTS_TRIGGERED,methodName:"setDocuments",source:r,payload:{documents:e,options:t}}),yield this.setDocumentsImpl({documents:e,options:t??{},source:r})}catch(s){this.loggingService.catch("Error in DocService setDocuments:",s)}})}setRootDocument(r){return Q(this,arguments,function*({document:e,source:t="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setRootDocument","color: green;"),this.coreActionsService.triggerAction(Hi.INIT_UPDATE,{event:X.Events.Core.SET_ROOT_DOCUMENT_TRIGGERED,methodName:"setRootDocument",source:t,payload:{document:e}});let a=this.getOptionsFromDocumentPaths()??{},s=this.documentIds$.value.map(d=>d.clientDocumentId);if(!s.includes(e.id)){let d=[...s.map(u=>({id:u})),{id:e.id}],p=this.getDocumentIdsFromDocuments({documents:d,setClientDocumentMetadataMap:!0});this.documentIds$.next(p)}yield this.setDocumentIdImpl(e.id,this.documentPaths$.value?.clientOrganizationId,a)}catch(a){this.loggingService.catch("Error in DocService setRootDocument:",a)}})}setDocumentsImpl(a){return Q(this,arguments,function*({documents:e,options:t,source:r}){try{let s=t?.organizationId??this.documentPaths$.value?.clientOrganizationId;if(!this.shouldSetDocumentsAgain(e,Sj(T(I({},t),{organizationId:s})))){r==="external"&&this.loggingService.catch("setDocuments called with previous request");return}this.documentPaths$.value?.organizationId&&t?.organizationId&&this.documentPaths$.value?.organizationId!==t?.organizationId?this.authService.resetServicesCache():this.unsetDocuments({source:"internal",unsetDocumentPaths:!1});let d=this.getDocumentIdsFromDocuments({documents:e,setClientDocumentMetadataMap:!0});if(d?.length===0){this.loggingService.warn("Minimum one document must be set in setDocuments");return}if(!this.authService.getUser()){this.draftDocuments=e,this.draftOptions=t;return}if(this.documentIds$.next(d),e?.length){let u=e[0]?.id;t?.rootDocumentId&&e.find(C=>C.id===t?.rootDocumentId)&&(u=t?.rootDocumentId),yield this.debounceSetDocuments({documentId:u,clientOrganizationId:t?.organizationId,options:t})}return}catch(s){this.loggingService.catch("Error in DocService setDocumentsImpl:",s)}})}setDocumentId(a){return Q(this,arguments,function*({documentId:e,clientOrganizationId:t,source:r="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocumentId","color: green;"),r==="internal"&&this.analyticsService.trackEvent(X.Events.Core.SET_DOCUMENTS_TRIGGERED,{payload:{id:e,clientOrganizationId:t,methodName:"setDocumentId",source:r}}),this.coreActionsService.triggerAction(Hi.INIT_UPDATE,{event:X.Events.Core.SET_DOCUMENTS_TRIGGERED,methodName:"setDocumentId",source:r,payload:{documentId:e,clientOrganizationId:t}}),yield this.setDocumentsImpl({documents:[{id:e}],options:{organizationId:t},source:r})}catch(s){this.loggingService.catch("Error in setDocumentId:",s);return}})}debounceSetDocuments(a){return Q(this,arguments,function*({documentId:e,clientOrganizationId:t,options:r}){try{this.loggingService.log("%c[WB] Calling FUNCTION: debounceSetDocuments","color: green;");let s=Date.now(),d=s-this.lastSetDocumentIdCallTime,p=s-this.lastSetDocumentIdExecutionTime;if(this.lastSetDocumentIdCallTime=s,this.queueSize>=this.MAX_QUEUE_SIZE){this.loggingService.warn("SetDocumentId queue size exceeded limit");return}if(!this.documentPaths$.value&&!this.isDocumentIdInDebounceQueue||d>this.DEBOUNCE_TIME&&p>this.DEBOUNCE_TIME){yield this.setDocumentIdImpl(e,t,r),this.lastSetDocumentIdExecutionTime=s;return}this.documentPaths$.next(null),this.isDocumentIdInDebounceQueue=!0,this.draftLocationMap={locations:[],options:void 0},this.queueSize++,this.setDocumentIdSubject.next({documentId:e,clientOrganizationId:t,options:r??void 0});return}catch(s){this.loggingService.catch("Error in debounceSetDocuments:",s)}})}setDocumentIdImpl(e,t,r){return Q(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 s=this.currentDocumentId;if(this.apiKey){let d=`${fn(e)}`,p=r?.folderId,u=r?.folderId?zo(r?.folderId):void 0,C=r?.locationId,E=r?.allDocuments,D=a?.organizationId?t?_t(t):a?.organizationId:void 0;if(yield Promise.allSettled([this.commentResolverService.resolveCommentAnnotations({documentIds:this.documentIds$.value.map(L=>L.clientDocumentId),organizationId:t??a?.clientOrganizationId??""}),this.reactionResolverService.resolveReactionAnnotations({documentIds:this.documentIds$.value.map(L=>L.clientDocumentId),organizationId:t??a?.clientOrganizationId??""})]),this.currentDocumentId!==d||this.documentPaths$.value?.organizationId!==D){this.loggingService.log("setting new docid"),this.currentDocumentId=d;let L=new tk,G=new Ck;L.clientDocumentId=e,G.clientDocumentId=e,L.folderId=p,G.folderId=p,L.locationId=C,G.locationId=C,L.allDocuments=E,G.allDocuments=E,L.veltFolderId=u,G.veltFolderId=u,L.documentId=d,G.documentId=d,D&&(L.organizationId=D,L.clientOrganizationId=t??a?.clientOrganizationId,G.organizationId=D,G.clientOrganizationId=t??a?.clientOrganizationId);let Y=`${this.apiKey}`,ne=`apiKey/${this.apiKey}`;D&&(Y=`${Y}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${L.organizationId}`,ne=`${ne}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${L.organizationId}`),G.organization=`apiKey/${this.apiKey}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}`,G.document=`${ne}/${j.FIREBASE_PARTIAL_PATH_DOCS}`,L.presence=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_PRESENCE}/`,L.cursor=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_CURSOR}/`,L.comment=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_COMMENT}/`,G.comment=`${ne}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_COMMENT}`,L.multiThread=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_MULTI_THREAD}/`,G.multiThread=`${ne}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_MULTI_THREAD}`,L.tag=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_TAG}/`,L.area=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_AREA}/`,G.area=`${ne}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_AREA}`,L.arrow=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_ARROW}/`,L.selection=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_SELECTION}/`,L.audioHuddle=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_AUDIO_HUDDLE}/`,L.huddle=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_HUDDLE}/`,L.recorder=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_RECORDER}/`,G.recorder=`${ne}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_RECORDER}`,L.flock=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_FOLLOW_ALONG}/`,L.syncVideoPlayer=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_SYNC_VIDEO_PLAYER}/`,L.liveState=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_LIVE_STATE}/`,L.liveStateSingleEditorMode=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_LIVE_STATE}/default/singleEditorMode`,L.reaction=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_REACTION}/`,G.reaction=`${ne}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_REACTION}`,L.crdt=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_CRDT}/`,G.crdt=`${ne}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_CRDT}`,L.customerMetadata=`${this.apiKey}/${j.FIREBASE_PARTIAL_PATH_CUSTOMER_METADATA}/`,L.views=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_VIEWS}/`,G.commentViews=`${ne}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_COMMENT_VIEWS}`,G.notificationViews=`${ne}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_NOTIFICATION_VIEWS}`,G.documentViews=`${ne}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_DOCUMENT_VIEWS}`,G.locationViews=`${ne}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_LOCATION_VIEWS}`,L.notifications=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_NOTIFICATIONS}/`,L.metadata=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_METADATA}/`,L.users=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_USERS}/`,L.documentIam=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_IAM}/`,L.workspaceIam=`${this.apiKey}/${j.FIREBASE_PARTIAL_PATH_IAM}/`,L.groupContacts=`${Y}/${j.FIREBASE_PARTIAL_PATH_CONTACTS}/${j.FIREBASE_PARTIAL_PATH_GROUPS}/`,L.globalContacts=`${Y}/${j.FIREBASE_PARTIAL_PATH_CONTACTS}/${j.FIREBASE_PARTIAL_PATH_GLOBAL}/`,L.logins=`${Y}/${j.FIREBASE_PARTIAL_PATH_CONTACTS}/${j.FIREBASE_PARTIAL_PATH_LOGINS}/`,L.userFeedback=`${Y}/${j.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${j.FIREBASE_PARTIAL_PATH_FEEDBACK}/`,L.userReportBugs=`${Y}/${j.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${j.FIREBASE_PARTIAL_PATH_BUGS}/`,L.userContactUs=`${Y}/${j.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${j.FIREBASE_PARTIAL_PATH_CONTACT_US}/`,D&&(L.organizationMetadata=`${Y}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_METADATA}/`,L.organizationIam=`${Y}/${j.FIREBASE_PARTIAL_PATH_IAM}/`,L.organizationGroups=`${Y}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_GROUPS}/`,L.organizationNotifications=`${Y}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/`,d&&(L.organizationNotificationsWithDocumentId=`${Y}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/`),L.organizationNotificationsLastNotificationTimestamp=`${Y}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${j.FIREBASE_PARTIAL_PATH_LAST_NOTIFICATION_TIMESTAMP}/${j.FIREBASE_PARTIAL_PATH_DOCS}/`,L.organizationNotificationsUsers=`${Y}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${j.FIREBASE_PARTIAL_PATH_USERS}/`),G.organizationUsers=`${ne}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_USERS}`,G.users=`${ne}/${j.FIREBASE_PARTIAL_PATH_CENTRAL_USERS}`,G.documentUsers=`${ne}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_DOCUMENT_USERS}`,G.notificationDocs=`${ne}/${j.FIREBASE_PARTIAL_PATH_NOTIFICATION_DOCS}`,G.notificationUsers=`${ne}/${j.FIREBASE_PARTIAL_PATH_NOTIFICATION_USERS}`,this.documentPaths$.next(L),this.firestorePaths$.next(G),L?.clientOrganizationId&&L?.organizationId&&!(L?.clientOrganizationId===this.organizationConfig$?.value?.clientOrganizationId&&L?.organizationId===this.organizationConfig$?.value?.organizationId)&&this.organizationConfig$.next({organizationId:L?.organizationId,clientOrganizationId:L?.clientOrganizationId}),yield Promise.allSettled([this.updateFolderMetadata(),this.updateDocumentMetadata(),this.fetchLocationMetadata(),this.updateOrganizationMetadata()]),s&&this.location$.value&&this.removeLocation({}),this.coreActionsService.triggerAction(Hi.INIT_UPDATE,{event:X.Events.Doc.SET_DOCUMENTS_SUCCESS,payload:{documentId:d,clientDocumentId:e}}),this.analyticsService.trackEvent(X.Events.Doc.SET_DOCUMENTS_SUCCESS,{documentId:d,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(X.Events.Core.UNSET_DOCUMENTS_TRIGGERED,{payload:{methodName:"unsetDocumentId",source:e}}),this.coreActionsService.triggerAction(Hi.INIT_UPDATE,{event:X.Events.Doc.UNSET_DOCUMENTS_TRIGGERED,methodName:"unsetDocumentId",source:e}),this.unsetDocumentImpl({source:e,unsetDocumentPaths:t})}catch(r){this.loggingService.catch("Error in unsetDocumentId: ",r)}}unsetDocumentImpl({source:e,unsetDocumentPaths:t}){this.loggingService.log("%c[WB] Calling FUNCTION: unsetDocumentImpl","color: green;");try{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.clientDocumentMetadata=void 0,this.clientDocumentMetadataMap={},this.locations$.next({}),this.documentIds$.next([]),this.coreActionsService.triggerAction(Hi.INIT_UPDATE,{event:X.Events.Doc.UNSET_DOCUMENTS_SUCCESS,source:e}),this.analyticsService.trackEvent(X.Events.Doc.UNSET_DOCUMENTS_SUCCESS,{documentId:this.currentDocumentId,documentMetadata:this.documentMetadata$.value?.[this.currentDocumentId??""],message:e==="external"?"User unset document id":"System unset document id",source:e},!0,this.getUserIdForAnalytics())}catch(r){this.loggingService.catch("Error in unsetDocumentImpl: ",r)}}unsetDocuments({source:e,unsetDocumentPaths:t=!0}){this.loggingService.log("%c[WB] Calling FUNCTION: unsetDocuments","color: green;");try{e==="internal"&&this.analyticsService.trackEvent(X.Events.Core.UNSET_DOCUMENTS_TRIGGERED,{payload:{methodName:"unsetDocuments",source:e}}),this.coreActionsService.triggerAction(Hi.INIT_UPDATE,{event:X.Events.Doc.UNSET_DOCUMENTS_TRIGGERED,source:e,methodName:"unsetDocuments"}),this.unsetDocumentImpl({source:e,unsetDocumentPaths:t})}catch(r){this.loggingService.catch("Error in unsetDocuments: ",r)}}addPreDocumentIdChangeFunction(e,t){try{this.loggingService.log("%c[WB] Calling FUNCTION: addPreDocumentIdChangeFunction","color: green;"),this.preDocumentIdChangeFunctions.set(e,t)}catch(r){this.loggingService.catch("Error in addPreDocumentIdChangeFunction: ",r)}}callPreDocumentIdChangeFunctions(e){return Q(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: callPreDocumentIdChangeFunctions","color: green;");for(let[t,r]of this.preDocumentIdChangeFunctions)try{yield r(e)}catch(a){this.loggingService.catch("Error in callPreDocumentIdChangeFunctions: ",a)}}catch(t){this.loggingService.catch("Error in callPreDocumentIdChangeFunctions: ",t)}})}fetchOrganizationMetadata(){return Q(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: fetchOrganizationMetadata","color: green;");try{if(this.db&&this.organizationConfig$.value?.organizationId){let e=this.organizationConfig$.value?.organizationId;yield this.commonDbService?.getData({feature:"organizationMetadata",properties:{apiKey:this.apiKey??"",organizationId:e,field:"metadata"}}).then(t=>{t&&this.organizationMetadata$.next(T(I({},this.organizationMetadata$.value),{[e]:t}))}).catch(t=>{this.loggingService.catch("Error in fetchOrganizationMetadata: ",t)})}}catch(e){this.loggingService.catch("Error in fetchOrganizationMetadata: ",e)}})}fetchDocumentMetadata(e){return Q(this,null,function*(){try{if(this.db&&this.authService.getUser()){let t=this.documentPaths$.value,r=this.documentMetadata$.value;if(e=e.filter(a=>!r?.[a.documentId]),e?.some(a=>!a?.documentId||!a?.clientDocumentId)||!t)return;if(this.commonDbService?.shouldUseFirestore()){let a=t?.folderId,s=t?.allDocuments,d=[],p={organizationId:t?.clientOrganizationId,folderId:a,allDocuments:s};if(a&&s)d.push(this.fetchDocuments(p));else{let C=[];for(let D=0;D<e.length;D+=20)C.push(e.slice(D,D+20));C.forEach(D=>{let L=JSON.parse(JSON.stringify(p));L.documentIds=D.map(G=>G.clientDocumentId),d.push(this.fetchDocuments(L))})}let u={};d.length>0&&(yield Promise.all(d).then(C=>{C?.forEach(E=>{E?.forEach(D=>{D?.metadata?.documentId&&(u[D.metadata.documentId]=D.metadata)})}),this.documentMetadata$.next(I(I({},this.documentMetadata$.value),u))}).catch(C=>{this.loggingService.catch("Error in fetchDocumentMetadata: ",C)}))}else r?.[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.documentMetadata$.next({[a.documentId]:a})}).catch(a=>{this.loggingService.catch("Error in fetchDocumentMetadata: ",a)})}}catch(t){this.loggingService.catch("Error in fetchDocumentMetadata: ",t)}})}fetchLocationMetadata(){return Q(this,null,function*(){try{if(this.db&&this.authService.getUser()){let e=this.documentPaths$.value,t=this.documentIds$.value,r=e?.folderId,a=e?.allDocuments,s=[],d={organizationId:e?.clientOrganizationId,folderId:r,allDocuments:a};if(r&&a)s.push(this.fetchLocations(d));else{let u=[];for(let E=0;E<t.length;E+=20)u.push(t.slice(E,E+20));u.forEach(E=>{let D=JSON.parse(JSON.stringify(d));D.documentIds=E.map(L=>L.clientDocumentId),s.push(this.fetchLocations(D))})}let p=this.locationMetadata$.value??{};s.length>0&&Promise.all(s).then(u=>{u?.forEach(C=>{C?.forEach(E=>{E?.metadata?.documentId&&(p[E.metadata.documentId]=T(I({},p?.[E.metadata.documentId]??{}),{[E.location.id]:E}))})}),Object.keys(p||{}).length>0&&this.locationMetadata$.next(p)}).catch(u=>{this.loggingService.catch("Error in fetchLocationMetadata: ",u)})}}catch(e){this.loggingService.catch("Error in fetchLocationMetadata: ",e)}})}getLocationMetadatas(){return this.locationMetadata$.value}subscribeToCustomerMetadata(){this.loggingService.log("%c[WB] Calling FUNCTION: subscribeToCustomerMetadata","color: green;");try{if(this.customerMetadataSubscription)return;this.db&&this.authService.getUser()&&this.documentPaths$.value&&(this.customerMetadataSubscription=this.commonDbService?.dbListener({feature:"customerMetadata",properties:{skipFirestore:!0}}).pipe(Hn(t=>se(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(de(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`${fn(e)}`}catch(t){return this.loggingService.catch("Error in generateDocumentId: ",t),""}}generateOrganizationId(e){try{return`${_t(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(r){return Q(this,arguments,function*({location:e,source:t="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setLocation","color: green;"),t==="internal"&&this.analyticsService.trackEvent(X.Events.Core.SET_LOCATIONS_TRIGGERED,{payload:{locations:[e],options:void 0,methodName:"setLocation",source:t}}),this.coreActionsService.triggerAction(Hi.INIT_UPDATE,{event:X.Events.Core.SET_LOCATIONS_TRIGGERED,source:t,methodName:"setLocation",payload:{locations:[e],options:void 0}}),this.setLocationsImpl({locations:[e]})}catch(a){this.loggingService.catch("Error in setLocation: ",a)}})}setLocations(a){return Q(this,arguments,function*({locations:e,options:t,source:r="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setLocations","color: green;"),r==="internal"&&this.analyticsService.trackEvent(X.Events.Core.SET_LOCATIONS_TRIGGERED,{payload:{locations:e,options:t,methodName:"setLocations",source:r}}),this.coreActionsService.triggerAction(Hi.INIT_UPDATE,{event:X.Events.Core.SET_LOCATIONS_TRIGGERED,methodName:"setLocations",source:r,payload:{locations:e,options:t}}),this.setLocationsImpl({locations:e,options:t})}catch(s){this.loggingService.catch("Error in setLocations: ",s)}})}getValidLocations(e){try{let t=[];return e&&Array.isArray(e)&&e.forEach(r=>{if(r&&typeof r=="object"){let a=!0;r?.version&&(!r?.version?.id||!r?.version?.name)&&(this.loggingService.catch(`Error in setting location for locationId: ${r?.id}, If you're setting version then add id and name fields to version object.`),a=!1),a&&t.push(r)}}),t}catch(t){this.loggingService.catch("Error in getValidLocations: ",t)}return e}setRootLocation(r){return Q(this,arguments,function*({location:e,source:t="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setRootLocation","color: green;"),t==="internal"&&this.analyticsService.trackEvent(X.Events.Core.SET_ROOT_LOCATION_TRIGGERED,{payload:{location:e,methodName:"setRootLocation",source:t}}),this.coreActionsService.triggerAction(Hi.INIT_UPDATE,{event:X.Events.Core.SET_ROOT_LOCATION_TRIGGERED,methodName:"setRootLocation",source:t,payload:{location:e}});let a=Object.values(this.locations$.value).map(s=>s.location).filter(s=>String(s.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=T(I(I({},this.draftLocationMap.options??{}),t??{}),{rootLocationId:e[0].id})),this.draftLocationMap.locations=[...this.draftLocationMap.locations,...e],this.draftLocationMap.options=I(I({},this.draftLocationMap.options),t);return}let a=this.getValidLocations(e),s=[],d=[];this.location$.value?.location.id&&d.push(this.location$.value?.location.id),d=[...d,...Object.values(this.locations$.value).map(C=>C.location.id)].filter(C=>C!==void 0);let p;if(t?.rootLocationId&&t?.rootLocationId!==this.location$.value?.location.id&&(p=a.find(C=>C.id===t?.rootLocationId),!p)){this.loggingService.catch(`Error in setting locations, rootLocationId: ${t?.rootLocationId} not found in locations.`);return}if(t?.appendLocation){if(p){let C=Go(p),E=fn(JSON.stringify(C));C.id&&s.push({locationId:E,location:C}),this.location$.next({locationId:E,location:C})}}else{p||(p=a[0]);let C=Go(p),E=fn(JSON.stringify(C));C.id&&s.push({locationId:E,location:C}),this.location$.next({locationId:E,location:C})}let u=[];return a.slice(t?.appendLocation?0:1).forEach(C=>{if(C.id!==this.location$.value?.location.id){let E=I({},C),D=this.locations$.value;C?.id&&Object.keys(D).forEach(ne=>{let ge=D[ne];ge.location?.id===C.id&&(E=I(I({},ge.location),C),delete D?.[ne])});let L=this.genarateLocationId(E),G={locationId:L,location:E};E.id&&s.push({locationId:L,location:E}),u.push(G);let Y=T(I({},D),{[L]:G});this.locations$.next(Y)}}),this.updateDocumentLocationMetadata(s),this.coreActionsService.triggerAction(Hi.INIT_UPDATE,{event:X.Events.Doc.SET_LOCATIONS_SUCCESS,methodName:"setLocations",payload:{locations:a,options:t}}),this.analyticsService.trackEvent(X.Events.Doc.SET_LOCATIONS_SUCCESS,{locations:a,options:t},!0,this.getUserIdForAnalytics()),u}catch(r){this.loggingService.catch("Error in setLocationImpl: ",r);return}}addLocation({location:e,source:t="internal"}){try{return this.loggingService.log("%c[WB] Calling FUNCTION: addLocation","color: green;"),t==="internal"&&this.analyticsService.trackEvent(X.Events.Core.SET_LOCATIONS_TRIGGERED,{payload:{locations:[e],options:{appendLocation:!0},methodName:"addLocation",source:t}}),this.coreActionsService.triggerAction(Hi.INIT_UPDATE,{event:X.Events.Core.SET_LOCATIONS_TRIGGERED,methodName:"addLocation",source:t,payload:{locations:[e],options:{appendLocation:!0}}}),this.setLocationsImpl({locations:[e],options:{appendLocation:!0}})}catch(r){this.loggingService.catch("Error in DocService addLocation:",r);return}}removeLocation({location:e,source:t="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeLocation","color: green;"),t==="internal"&&this.analyticsService.trackEvent(X.Events.Core.REMOVE_LOCATIONS_TRIGGERED,{payload:{locations:[e],methodName:"removeLocation",source:t}}),this.coreActionsService.triggerAction(Hi.INIT_UPDATE,{event:X.Events.Core.REMOVE_LOCATIONS_TRIGGERED,source:t,methodName:"removeLocation",payload:{locations:[e]}}),e&&this.removeLocationsImpl([e],t)}catch(r){this.loggingService.catch("Error in removeLocation: ",r)}}removeLocations({locations:e,source:t="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeLocations","color: green;"),t==="internal"&&this.analyticsService.trackEvent(X.Events.Core.REMOVE_LOCATIONS_TRIGGERED,{payload:{locations:e,methodName:"removeLocations",source:t}}),this.coreActionsService.triggerAction(Hi.INIT_UPDATE,{event:X.Events.Core.REMOVE_LOCATIONS_TRIGGERED,methodName:"removeLocations",source:t,payload:{locations:e}}),this.removeLocationsImpl(e,t)}catch(r){this.loggingService.catch("Error in removeLocations: ",r)}}removeLocationsImpl(e,t="internal"){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeLocations","color: green;"),t==="internal"&&this.analyticsService.trackEvent(X.Events.Core.REMOVE_LOCATIONS_TRIGGERED,{payload:{locations:e},methodName:"removeLocations",message:"System removed locations",source:t},!0,this.getUserIdForAnalytics()),e?e.forEach(r=>{let a=this.genarateLocationId(r);this.getLocation()?.locationId===a&&(this.location$.next(null),t!=="internal"&&(this.draftLocationMap.locations=this.draftLocationMap.locations.filter(s=>s.id!==r.id))),this.removeCustomLocation(r)}):(this.location$.next(null),this.locations$.next({}),t!=="internal"&&(this.draftLocationMap.options=void 0,this.draftLocationMap.locations=[])),this.analyticsService.trackEvent(X.Events.Doc.REMOVE_LOCATIONS_SUCCESS,{payload:{locations:e},source:t},!0,this.getUserIdForAnalytics())}catch(r){this.loggingService.catch("Error in removeLocation: ",r)}}unsetLocationIds(e,t="internal"){try{this.loggingService.log("%c[WB] Calling FUNCTION: unsetLocationIds","color: green;"),this.coreActionsService.triggerAction(Hi.INIT_UPDATE,{event:X.Events.Core.UNSET_LOCATIONS_TRIGGERED,methodName:"unsetLocationIds",source:t,payload:{locationIds:e}}),t==="internal"&&this.analyticsService.trackEvent(X.Events.Core.UNSET_LOCATIONS_TRIGGERED,{payload:{locationIds:e},methodName:"unsetLocationIds",message:"System unset location ids",source:t},!0,this.getUserIdForAnalytics()),e?.length?e.forEach(r=>{this.getLocation()?.location.id===r&&(this.location$.next(null),t!=="internal"&&(this.draftLocationMap.locations=this.draftLocationMap.locations.filter(a=>a.id!==r))),this.removeCustomLocationId(r)}):(this.location$.next(null),this.locations$.next({}),t!=="internal"&&(this.draftLocationMap.options=void 0,this.draftLocationMap.locations=[])),this.analyticsService.trackEvent(X.Events.Doc.REMOVE_LOCATIONS_SUCCESS,{payload:{locationIds:e},source:t},!0,this.getUserIdForAnalytics())}catch(r){this.loggingService.catch("Error in unsetLocationIds: ",r)}}getLocation$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getLocation$","color: green;"),this.location$.asObservable()}getLocation(){return this.loggingService.log("%c[WB] Calling FUNCTION: getLocation$","color: green;"),this.location$.value?JSON.parse(JSON.stringify(this.location$.value)):null}excludeLocationIds(e){try{this.excludedLocationIds$.next([...e])}catch(t){this.loggingService.catch("Error in excludeLocationIds: ",t)}}getExcludedLocationIds$(){try{return this.excludedLocationIds$.asObservable()}catch(e){return this.loggingService.catch("Error in getExcludedLocationIds$: ",e),se([])}}updateOrganizationMetadata(){return Q(this,null,function*(){try{let e=this.organizationConfig$.value?.organizationId,t=this.documentPaths$.value;if(this.db&&e&&t?.documentId){if(this.organizationMetadata$.value?.[e])return;let a=new pk;a.apiKey=this.configService?.getApiKey()??"",a.organizationId=e,a.clientOrganizationId=this.organizationConfig$.value?.clientOrganizationId,yield this.commonDbService?.updateData({feature:"organizationMetadata",data:JSON.parse(JSON.stringify(a)),properties:{organizationId:e,documentId:t?.documentId??""}}),yield this.fetchOrganizationMetadata()}}catch(e){this.loggingService.catch("Error in updateOrganizationMetadata: ",e)}})}updateFolderMetadata(){return Q(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 r={folderId:this.documentPaths$.value?.folderId,veltFolderId:this.documentPaths$.value?.veltFolderId,apiKey:this.configService?.getApiKey()??"",organizationId:e?.organizationId,clientOrganizationId:e?.clientOrganizationId,createdAt:Date.now(),lastUpdated:Date.now(),parentFolderId:"root",veltParentFolderId:"root"};this.commonDbService?.updateData({feature:"folderMetadata",data:JSON.parse(JSON.stringify({metadata:r})),properties:{organizationId:e?.organizationId??"",folderId:this.documentPaths$.value?.veltFolderId??""}})}}}catch(e){this.loggingService.catch("Error in updateFolderMetadata: ",e)}})}updateDocumentMetadata(){return Q(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 r=t.map(a=>Q(this,null,function*(){let s=new ek;this.clientDocumentMetadata&&(this.clientDocumentMetadata?.clientDocumentId===e.clientDocumentId&&this.clientDocumentMetadata?.documentMetadata&&(s=I(I({},this.clientDocumentMetadata.documentMetadata),s)),this.clientDocumentMetadata=void 0),this.clientDocumentMetadataMap?.[a.clientDocumentId]&&(s=I(I({},this.clientDocumentMetadataMap[a.clientDocumentId]),s)),s.apiKey=this.configService?.getApiKey()??"",s.documentId=a.documentId,s.clientDocumentId=a.clientDocumentId,s.organizationId=e.organizationId,s.clientOrganizationId=e.clientOrganizationId,s.pageInfo=xi();let d=e?.folderId,p=e?.veltFolderId;s?.pageInfo?.deviceInfo&&delete s?.pageInfo?.deviceInfo;let u=!0,C=this.documentMetadata$.value?.[a.documentId];if(d&&p){let E=yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:a?.documentId??"",organizationId:e?.organizationId??"",field:"metadata"}});E?.clientDocumentId?E?.folderId&&(E?.folderId!==d||E?.veltFolderId!==p)?(this.loggingService.catch(`Folder id mismatch for document ${a?.clientDocumentId??""}`),u=!1):E?.folderId===d?(d&&(s.folderId=d),p&&(s.veltFolderId=p)):(this.loggingService.catch(`Document ${a?.clientDocumentId??""} is not in the folder ${d??""}`),u=!1):(d&&(s.folderId=d),p&&(s.veltFolderId=p))}if(C){let E={};Object.entries(s).forEach(([D,L])=>{E[D]=L}),zi(E,C)&&(u=!1)}u&&(yield this.commonDbService?.updateData({feature:"documentMetadata",data:JSON.parse(JSON.stringify(s)),properties:{organizationId:e?.organizationId??"",documentId:a?.documentId??""}}))}));yield Promise.allSettled(r),yield this.fetchDocumentMetadata(t)}}}catch(e){this.loggingService.catch("Error in updateDocumentMetadata: ",e)}})}updateDocumentLocationMetadata(e){return Q(this,null,function*(){try{if(this.db&&this.authService.getUser()){let t=this.documentPaths$.value;if(t){let r=this.getDocumentIds();r.find(a=>a.documentId===t.documentId)||r.push({documentId:t.documentId??"",clientDocumentId:t.clientDocumentId??""});for(let a of r){let s=yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:a?.documentId??"",organizationId:t?.organizationId??"",field:"metadata"}}),d=[];for(let p of e){let u=new rk;u.locationId=p?.locationId,u.veltLocationId=vj(p?.location?.id??""),u.location=p?.location,u.pageInfo=xi(),u?.pageInfo?.deviceInfo&&delete u?.pageInfo?.deviceInfo;let C=T(I({},s),{[j.FIREBASE_PARTIAL_PATH_LOCATIONS]:T(I({},s[j.FIREBASE_PARTIAL_PATH_LOCATIONS]??{}),{[p?.locationId]:u})});this.commonDbService?.shouldUseFirestore()||d.push(this.commonDbService?.updateData({feature:"documentMetadata",data:JSON.parse(JSON.stringify(C)),properties:{documentId:a?.documentId??"",organizationId:t?.organizationId??""}}));let E=this.locationMetadata$.value;if(E||(E={}),p?.location?.id){let D=E?.[a.documentId],L=D?.[p?.location?.id??""];E&&(D||(E[a.documentId]={}),L||(E[a.documentId][p?.location?.id??""]={}),E[a.documentId][p?.location?.id??""]=T(I({},L),{location:p?.location})),Object.keys(E||{}).length>0&&this.locationMetadata$.next(E)}}yield Promise.allSettled(d)}}}}catch(t){this.loggingService.catch("Error in updateDocumentLocationMetadata: ",t)}})}genarateLocationId(e){try{return e&&typeof e=="object"?fn(JSON.stringify(Go(e))):0}catch(t){return this.loggingService.catch("Error in genarateLocationId: ",t),0}}removeCustomLocation(e,t="internal"){try{let r=this.genarateLocationId(e),a=this.locations$.value;a[r]&&(delete a[r],this.locations$.next(I({},a)),t!=="internal"&&this.isDocumentIdInDebounceQueue&&(this.draftLocationMap.locations=this.draftLocationMap.locations.filter(s=>s.id!==e.id)))}catch(r){this.loggingService.catch("Error in DocService removeLocation:",r)}}removeCustomLocationId(e,t="internal"){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeCustomLocationId","color: green;");let r=this.locations$.value;Object.entries(r).forEach(([a,s])=>{s.location.id===e&&(delete r[a],this.locations$.next(I({},r)),t!=="internal"&&this.isDocumentIdInDebounceQueue&&(this.draftLocationMap.locations=this.draftLocationMap.locations.filter(d=>d.id!==e)))})}catch(r){this.loggingService.catch("Error in DocService removeCustomLocationId:",r)}}getLocationByClientLocationId(e){try{let t=this.getLocation()?.location;if(t?.id===e)return t;{let r=this.getLocations();Object.keys(r).forEach(a=>{let s=r[a];s.location?.id===e&&(t=s.location)})}return t}catch(t){this.loggingService.catch("Error in DocService getLocationByClientLocationId:",t);return}}removeLocationIfNotInDom(){try{let e=this.locations$.value,t=document.querySelectorAll(`[${j.ATTRIBUTES.VELT_LOCATION}]`),r=[];t.forEach(a=>{let s=a.getAttribute(j.ATTRIBUTES.VELT_LOCATION);if(s){let d=JSON.parse(s),p=this.genarateLocationId(d);r.push(p)}}),Object.keys(e).forEach(a=>{let s=e[a];r.includes(s.locationId)||delete e[a]}),this.locations$.next(I({},e))}catch(e){this.loggingService.catch("Error in DocService removeLocationIfNotInDom:",e)}}getLocations$(){try{return this.locations$.asObservable()}catch(e){return this.loggingService.catch("Error in DocService getLocations$:",e),se({})}}getLocations(){try{return this.locations$.value}catch(e){return this.loggingService.catch("Error in DocService getLocations:",e),{}}}getLocationFromElement(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: getLocationFromElement","color: green;");let t=null;if(e?.getAttribute(j.ATTRIBUTES.VELT_LOCATION)?t=e:t=e.closest(`[${j.ATTRIBUTES.VELT_LOCATION}]`),t){let r=t?.getAttribute(j.ATTRIBUTES.VELT_LOCATION);if(r){let a=JSON.parse(r);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(`[${j.ATTRIBUTES.VELT_LOCATION}], [${j.ATTRIBUTES.VELT_LOCATION_ID}]`).forEach(r=>{if(r.getAttribute(j.ATTRIBUTES.VELT_LOCATION)){let a=this.getLocationFromElement(r);a?.locationId&&(e[a.locationId]={element:r,location:a})}else if(r.getAttribute(j.ATTRIBUTES.VELT_LOCATION_ID)){let a=r.getAttribute(j.ATTRIBUTES.VELT_LOCATION_ID);if(a){let s=this.getLocationByClientLocationId(a);s?.locationId&&(e[s.locationId]={element:r,location:s});let d={id:a},p=this.genarateLocationId(d);e[a]={element:r,location:{locationId:p,location:d}}}}}),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(`[${j.ATTRIBUTES.VELT_LOCATION}], [${j.ATTRIBUTES.VELT_LOCATION_ID}]`),t){if(t?.getAttribute(j.ATTRIBUTES.VELT_LOCATION)){let r=t?.getAttribute(j.ATTRIBUTES.VELT_LOCATION);if(r)return JSON.parse(r)}else if(t?.getAttribute(j.ATTRIBUTES.VELT_LOCATION_ID)){let r=t?.getAttribute(j.ATTRIBUTES.VELT_LOCATION_ID);if(r)return{id:r}}}return null}catch(t){return this.loggingService.catch("Error in DocService getAdditionLocationFromElement:",t),null}}getAdditionalDocumentIdFromElement(e){try{return e?.closest(`[${j.ATTRIBUTES.VELT_DOCUMENT_ID}]`)?.getAttribute(j.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(){try{return Object.values(this.documentMetadata$.value||{})}catch(e){return this.loggingService.catch("Error in DocService getAllDocumentMetadata:",e),[]}}getDocumentMetadataOfAvailableDocuments(){try{this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentMetadataOfAvailableDocuments","color: green;");let e=this.documentMetadata$.value||{},t={},r=this.documentPaths$.value?.veltFolderId,a=this.documentPaths$.value?.allDocuments;if(r&&a)Object.values(e).forEach(s=>{s?.documentId&&s?.veltFolderId===r&&(t[s.documentId]=s)});else{let s=this.documentIds$.value;if(s?.length)s.forEach(d=>{let p=e?.[d.documentId];p&&(t[d.documentId]=p)});else if(this.documentPaths$.value?.documentId){let d=e?.[this.documentPaths$.value?.documentId];d&&(t[this.documentPaths$.value?.documentId]=d)}}return Object.values(t)}catch(e){return this.loggingService.catch("Error in DocService getDocumentMetadataOfAvailableDocuments:",e),[]}}getDocumentMetadata$(e){return this.documentMetadata$.asObservable().pipe(de(t=>t?.[e??this.documentPaths$.value?.documentId??""]||null))}getOrganizationMetadata(e){return this.organizationMetadata$.value?.[e]||null}getOrganizationMetadata$(e){return this.organizationMetadata$.asObservable().pipe(de(t=>t?.[e]||null))}getCustomerMetadata(){return this.customerMetadata$.value}getCustomerMetadata$(){return this.customerMetadata$.asObservable()}getOrganizationConfig$(){return this.organizationConfig$.asObservable().pipe(kt(si))}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(r){this.loggingService.catch("Error in DocService getMetadataFromType:",r);return}}getDefaultMetadata({clientDocumentId:e,documentId:t}){try{let r=this.documentPaths$.value;if(!r)return;let a=e||r.clientDocumentId,s=t||r.documentId,d=this.getDocumentMetadata(s);if(!d)return;let p=d?.folderId,u=d?.veltFolderId;return I(I({apiKey:this.configService.getApiKey()??void 0,clientDocumentId:a,clientOrganizationId:r.clientOrganizationId,documentId:s,organizationId:r.organizationId},p?{folderId:p}:{}),u?{veltFolderId:u}:{})}catch(r){this.loggingService.catch("Error in DocService getDefaultMetadata:",r);return}}getBaseMetadata(e,t){try{let r,a;t?.element?r=this.getAdditionalDocumentIdFromElement(t.element)||void 0:t?.clientDocumentId&&(r=t.clientDocumentId),r&&(a=this.generateDocumentId(r));let s=this.getMetadataFromType(e,t),d=this.getDefaultMetadata({clientDocumentId:r,documentId:a});return s||d||{}}catch(r){return this.loggingService.catch("Error in DocService getBaseMetadata:",r),{}}}getServerId({documentId:e,organizationId:t}){try{return e&&(e=this.generateDocumentId(e)),t&&(t=this.generateOrganizationId(t)),{documentId:e,organizationId:t}}catch(r){return this.loggingService.catch("Error in DocService getServerId:",r),null}}fetchDocuments(e){return Q(this,null,function*(){try{if(!this.authService.getUser())return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),[];let r=[];if(!e?.organizationId)return this.loggingService.catch("Error in fetchDocuments: organizationId is required"),[];if(e?.folderId){let s=zo(e?.folderId);r.push(ut("metadata.veltFolderId","==",s))}return e?.documentIds?.length&&!e?.allDocuments&&r.push(ut("metadata.documentId","in",e?.documentIds?.map(s=>this.generateDocumentId(s)).slice(0,30))),yield this.commonDbService?.queryData({feature:"allDocuments",properties:{firestoreQuery:r,apiKey:this.apiKey??"",organizationId:this.generateOrganizationId(e?.organizationId)??this.documentPaths$.value?.organizationId,documentId:this.documentPaths$.value?.documentId}})}catch(t){return this.loggingService.catch("Error in DocService fetchDocuments:",t),[]}})}fetchLocations(e){return Q(this,null,function*(){try{if(!this.authService.getUser())return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),[];let r=[];if(!e?.organizationId)return this.commonDbService?.shouldUseFirestore()&&this.loggingService.catch("Error in fetchLocations: organizationId is required"),[];if(e?.folderId){let s=zo(e?.folderId);r.push(ut("metadata.veltFolderId","==",s))}return e?.documentIds?.length&&!e?.allDocuments&&r.push(ut("metadata.documentId","in",e?.documentIds?.map(s=>this.generateDocumentId(s)).slice(0,30))),yield this.commonDbService?.queryData({feature:"allLocations",properties:{firestoreQuery:r,apiKey:this.apiKey??"",organizationId:this.generateOrganizationId(e?.organizationId)??this.documentPaths$.value?.organizationId,documentId:this.documentPaths$.value?.documentId}})}catch(t){return this.loggingService.catch("Error in DocService fetchLocations:",t),[]}})}updateDocuments(e){return Q(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:r,documents:a,folderId:s}=e;if(!r&&(r=this.documentPaths$.value?.clientOrganizationId,!r))return this.loggingService.catch("Error in updateDocuments: organizationId is required"),[];let d=Tc(r);if(!a||a.length===0)return this.loggingService.catch("Error in updateDocuments: documents is required"),[];let p=[],u=this.documentMetadata$.value??{};for(let C of a)if(C?.documentId){C.organizationId=d,C.clientOrganizationId=r,C.clientDocumentId=C.documentId;let E=xc(C.documentId);C.documentId=E,C.apiKey=this.configService.getApiKey()??void 0,(s||this.documentPaths$.value?.folderId)&&(C.folderId=s||this.documentPaths$.value?.folderId,C.veltFolderId=zo(s||this.documentPaths$.value?.folderId||""));let D=()=>{if(s&&this.documentPaths$.value?.folderId&&s!==this.documentPaths$.value?.folderId)return;let G=u?.[E];G?u[E]=I(I({},G),C):u[E]=C},L=yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:E,organizationId:d,field:"metadata"}});if(L&&L.apiKey&&L.folderId&&s&&L.folderId!=C.folderId){this.loggingService.catch(`Error in updateDocuments: document ${C.clientDocumentId} already exists with different folderId: ${L.folderId}`);continue}if(L&&L.apiKey&&!L.folderId&&C.folderId){this.loggingService.catch(`Error in updateDocuments: document ${C.clientDocumentId} already exists, move this document to folder with REST API`);continue}D(),C&&this.commonDbService&&p.push(this.commonDbService.updateData({feature:"documentMetadata",data:JSON.parse(JSON.stringify(C)),properties:{organizationId:d,documentId:E}}))}yield Promise.all(p),this.documentMetadata$.next(u)}catch(t){return this.loggingService.catch("Error in DocService updateDocuments:",t),[]}})}updateLocations(e){return Q(this,null,function*(){try{if(!this.authService.getUser())return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),[];let{organizationId:r,locations:a,documentIds:s}=e;if((!s||s.length===0)&&(s=this.documentIds$.value.map(C=>C.clientDocumentId)??[],s.length===0))return this.loggingService.catch("Error in updateLocations: documentId is required"),[];if(!r&&(r=this.documentPaths$.value?.clientOrganizationId,!r))return this.loggingService.catch("Error in updateLocations: organizationId is required"),[];if(!a||a.length===0)return this.loggingService.catch("Error in updateLocations: locations is required"),[];let d=s.map(C=>xc(C)),p=[],u=this.locationMetadata$.value;u||(u={}),d.forEach(C=>{a.forEach(E=>{let D=this.location$.value;if(E?.id===D?.location?.id&&this.location$.next({locationId:D?.locationId,location:E}),E?.id){delete E?.metadata;let L=vj(E.id),G=u?.[C],Y=G?.[E.id];u&&(G||(u[C]={}),Y||(u[C][E.id]={}),u[C][E.id]=T(I({},Y),{location:E})),E&&this.commonDbService&&p.push(this.commonDbService.updateData({feature:"locationMetadata",data:JSON.parse(JSON.stringify({location:E})),properties:{organizationId:Tc(r),documentId:C,id:L}}))}})}),yield Promise.all(p),Object.keys(u||{}).length>0&&this.locationMetadata$.next(u)}catch(t){return this.loggingService.catch("Error in DocService updateLocations:",t),[]}})}fetchFolders(e){return Q(this,null,function*(){try{if(!this.authService.getUser())return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),[];let r=[];if(!e?.organizationId)return this.loggingService.catch("Error in fetchFolders: organizationId is required"),{data:[],parentFolders:[]};let a=[],s=this.generateOrganizationId(e?.organizationId);if(e?.folderId){let d=zo(e?.folderId);r=yield this.commonDbService?.getData({feature:"folder",properties:{folderId:d,apiKey:this.apiKey??"",organizationId:s,documentId:this.documentPaths$.value?.documentId}}),r&&(r=[r]),a=yield this.commonDbService?.queryData({feature:"allFolders",properties:{firestoreQuery:[ut("metadata.veltParentFolderId","==",d)],folderId:d,apiKey:this.apiKey??"",organizationId:s,documentId:this.documentPaths$.value?.documentId}})}else r=yield this.commonDbService?.queryData({feature:"allFolders",properties:{apiKey:this.apiKey??"",organizationId:s,documentId:this.documentPaths$.value?.documentId}});return{data:r,parentFolders:a}}catch(t){return this.loggingService.catch("Error in DocService getFoldersRequest:",t),{data:[],parentFolders:[]}}})}getDocumentIam$(){return this.authService.getUser$().pipe(he(e=>e?this.documentPaths$.pipe(he(t=>t?.documentIam?this.commonDbService?.dbListener({feature:"documentIam",properties:{documentId:t.documentId,organizationId:t.organizationId,isCollection:!1}}).pipe(de(r=>r?.data?.docIamConfig??r?.data),kt((r,a)=>JSON.stringify(r??{})===JSON.stringify(a??{}))):se(null))):se(null)))}getDocumentAccessType(e){try{return e&&e.features&&e.features.all?e.features.all.restricted?Ci.RESTRICTED:Ci.PUBLIC:e&&e.documentAccessType?e.documentAccessType:Ci.PUBLIC}catch(t){return this.loggingService.catch("Error in DocService getDocumentAccessType:",t),Ci.PUBLIC}}changeDocumentAccessType(e){return Q(this,null,function*(){try{let t=this.documentPaths$.value;if(t){let r=yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:t?.documentId??"",organizationId:t?.organizationId??"",field:"docIamConfig"}});switch(delete r.documentAccessType,r.features||(r.features={}),r.features.all||(r.features.all={}),e){case Ci.PUBLIC:r.features.all.restricted=!1;break;case Ci.RESTRICTED:r.features.all.restricted=!0,r.features.all.guestMode=!1;break;default:break}this.commonDbService?.updateData({feature:"documentAccessType",data:JSON.parse(JSON.stringify(r)),properties:{documentId: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(I(I({},this.uiState.value),e))}catch(t){this.loggingService.catch("Error in DocService setUIState:",t)}}getUIState$(){return this.uiState.asObservable()}};o.\u0275fac=function(t){return new(t||o)(J(tt),J(je),J(_n),J(Fe),J(Vt),J(y),J(ws),J(Ld),J(Nd))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Yn=(()=>{let o=class o{constructor(e,t,r,a){this.analyticsService=e,this.authService=t,this.docService=r,this.loggingService=a,this.defaultUserDataProvider={get:s=>Q(this,null,function*(){return{}})},this.resolveOrganizationUsers=new ve(!0),this.resolveFolderUsers=new ve(!0),this.resolveDocumentUsers=new ve(!0),this.resolveTimeout=1*60*1e3,this.maxResolveAttempts=1,this.resolveAttempts=new Map,this.subscriptions=new hn,this.userDataProvider$=new ve(null),this.userById$=new ve({}),this.userByIdCalled$=new ve({}),this.pendingResolutions=new Set,this.getUserById=s=>{try{return this.userById$.value?.[s]}catch(d){this.loggingService.catch("Error in UsersService getUserById:",d);return}};try{this.analyticsService.setUserService(this),this.authService.setUsersService(this)}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)}}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(r){return this.loggingService.catch("Error in UsersService isResolverForFeatureDisabled:",r),!1}}resolveUsers(d){return Q(this,arguments,function*({userIds:e,forceResolve:t,feature:r,organizationId:a,skipUserCheck:s=!1}){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: resolveUsers","color: green;");let p=!1;if(r&&(p=this.isResolverForFeatureDisabled(r)),p)return{};{let u={},C=[],E={};if(e?.forEach(D=>{let L=this.getUserById(D);L?u[D]=L:this.userByIdCalled$.getValue()[D]?t&&C.push(D):(C.push(D),this.userByIdCalled$.next(T(I({},this.userByIdCalled$.getValue()),{[D]:!0})))}),C.length>0){let D={};try{let L,G=new Promise((Y,ne)=>{L=setTimeout(()=>{ne(new Error("User resolution timeout"))},this.userDataProvider$.getValue()?.config?.resolveTimeout||this.userDataProvider$.getValue()?.resolveTimeout||this.resolveTimeout)});D=yield Promise.race([this.getUsersFromDB({userIds:C,organizationId:a,skipUserCheck:s}).finally(()=>{clearTimeout(L)}),G]),this.analyticsService.trackEvent(X.Events.Resolver.USER_RESOLVER_GET,{sourceMethod:"resolveUsers",source:"sdk",userIds:C})}catch(L){this.loggingService.catch("Error in UsersService resolveUsers getUsers:",L,{userIds:C})}finally{C?.forEach(L=>{D[L]||(D[L]={userId:L,name:`User ${L}`})})}Object.entries(D).forEach(([L,G])=>{G&&(u[L]=D?.[L],E[L]=D?.[L])})}return Object.keys(E).length>0&&(this.authService.setOptionalPropertiesToUsers(Object.values(E)),this.userById$.next(I(I({},this.userById$.getValue()),E))),u}}catch(p){return this.loggingService.catch("Error in UsersService resolveUsers:",p),{}}})}getUsersFromDB(a){return Q(this,arguments,function*({userIds:e,organizationId:t,skipUserCheck:r=!1}){this.loggingService.log("%c[WB] Calling UsersService FUNCTION: getUsersFromDB","color: green;");try{let s=this.userDataProvider$.getValue();return s?s.get(e):(t||(t=this.docService.getOrganizationConfig()?.organizationId),t?this.getUsersFromDBWithBatching({userIds:e,organizationId:t,skipUserCheck:r}):{})}catch(s){return this.loggingService.catch("Error in UsersService getUsersFromDB:",s),{}}})}getUsersFromDBWithBatching(a){return Q(this,arguments,function*({userIds:e,organizationId:t,skipUserCheck:r=!1}){try{if(!e?.length)return{};let s=[];for(let C=0;C<e.length;C+=30)s.push(e.slice(C,C+30));let d=s.map((C,E)=>Q(this,null,function*(){try{return(yield this.commonDbService?.queryData({feature:"allOrganizationUsers",properties:{organizationId:t,useCollectionGroup:!1,isCollection:!0,firestoreQuery:[ut("user.userId","in",C)],skipUserCheck:r}}))||[]}catch(D){return this.loggingService.catch(`Error in batch ${E+1}:`,D),[]}})),p=yield Promise.all(d),u={};return p.forEach(C=>{C.forEach(E=>{E?.user?.userId&&(u[E.user.userId]=E.user)})}),u}catch(s){return this.loggingService.catch("Error in getUsersFromDBWithBatching:",s),{}}})}subscribeToDocuments(){return this.docService.getDocumentIds$().pipe(gn(e=>Q(this,null,function*(){let t=yield this.getUsersFromCentralDb({documentIds:e?.map(r=>r.documentId)});this.resolveUsers({userIds:t})})))}getUsersFromCentralDb(t){return Q(this,arguments,function*({documentIds:e}){try{return new Promise(r=>{r(["customuser1","customuser2","customuser3"])})}catch{return[]}})}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()}catch(e){return this.loggingService.catch("Error in UsersService getUserById$:",e),se({})}}setUserByIds(e){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setUserByIds","color: green;");let t=this.userById$.getValue();e.forEach(r=>{t[r.userId]=I(I({},t?.[r.userId]??{}),r)}),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;"),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)}}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}}};o.\u0275fac=function(t){return new(t||o)(J(tt),J(je),J(at),J(y))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Sce=(()=>{let o=class o{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 r of e)r?.from?.userId&&t.add(r?.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}}};o.\u0275fac=function(t){return new(t||o)(J(y),J(Yn))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var bce=(()=>{let o=class o{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 r of e)r?.from?.userId&&t.add(r?.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}}};o.\u0275fac=function(t){return new(t||o)(J(y),J(Yn))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Jp=class{static getFirestoreProdDbName(o,n){return n?.storeDbId??(this.isTestingDb(n?.databaseURL??"")?"sdktest":`apikey${o.toLowerCase()}`)}static isTestingDb(o){try{return o.includes("-test")}catch(n){return mt.error("Error in isTestingDb:",n),!1}}};var eg=(()=>{let o=class o{constructor(e,t){this.loggingService=e,this.analyticsService=t,this.retrySaveConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryDeleteConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.attachmentDataProvider$=new ve(null);try{this.loggingService.log("AttachmentResolverService initialized"),this.attachmentDataProvider$.subscribe(r=>{r&&(r.config?.saveRetryConfig&&(this.retrySaveConfig=r.config.saveRetryConfig),r.config?.deleteRetryConfig&&(this.retryDeleteConfig=r.config.deleteRetryConfig))})}catch(r){this.loggingService.catch("Error in AttachmentResolverService constructor:",r)}}getProvider(){try{let e=this.attachmentDataProvider$.getValue();return e||void 0}catch(e){this.loggingService.catch("Error in AttachmentResolverService getProvider:",e);return}}saveAttachment(e){return Q(this,null,function*(){try{this.loggingService.log("%c[WB] Calling AttachmentResolverService FUNCTION: saveAttachment","color: green;");let t=this.getProvider();if(!this.attachmentDataProviderAvailable())throw new Error("Attachment save data provider not available");let r=yield wc(()=>t?.save({attachment:e.attachment,event:e.eventType,metadata:e.attachment.metadata})||Promise.resolve(void 0),"saveAttachment",this.retrySaveConfig);if(r?.statusCode!==200){this.loggingService.catch(r?.message??"Error in AttachmentResolverService saveAttachment:");return}return this.analyticsService.trackEvent(X.Events.Resolver.ATTACHMENT_RESOLVER_SAVE,{sourceMethod:"saveAttachment",source:"sdk",attachmentId:e.attachment.attachmentId,eventType:e.eventType}),r}catch(t){this.loggingService.warn("Error in AttachmentResolverService saveAttachment:",t);return}})}deleteAttachment(r){return Q(this,arguments,function*({attachmentId:e,metadata:t}){try{this.loggingService.log("%c[WB] Calling AttachmentResolverService FUNCTION: deleteAttachment","color: green;");let a=this.getProvider();if(!this.attachmentDataProviderAvailable())throw new Error("Attachment delete data provider not available");let s=yield wc(()=>a?.delete({attachmentId:e,metadata:t,event:Ja.ATTACHMENT_DELETE})||Promise.resolve(void 0),"deleteAttachment",this.retryDeleteConfig);return s?.statusCode!==200?(this.loggingService.catch(s?.message??"Error in AttachmentResolverService deleteAttachment:"),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(X.Events.Resolver.ATTACHMENT_RESOLVER_DELETE,{sourceMethod:"deleteAttachment",source:"sdk",attachmentId:e}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0})}catch(a){return this.loggingService.warn("Error in AttachmentResolverService deleteAttachment:",a),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0}}})}setAttachmentDataProvider(e){try{if(e){this.loggingService.log("Setting attachment data provider");let r=["save","delete"].filter(a=>!(a in e)||typeof e[a]!="function");if(r.length>0){let a=`DataProviders.attachment is invalid. The following methods are missing or are not functions: ${r.join(", ")}.`;this.loggingService.catch(a);return}else this.attachmentDataProvider$.next(e)}}catch(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}}};o.\u0275fac=function(t){return new(t||o)(J(y),J(tt))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var c0=(()=>{let o=class o{constructor(e,t,r,a,s,d,p){this.loggingService=e,this.usersService=t,this.authService=r,this.functions=a,this.configService=s,this.commentAnnotationsResolverService=d,this.attachmentResolverService=p,this.notificationActionTypeMap={[jt.NEWLY_ADDED]:Ja.COMMENT_ANNOTATION_ADD,[jt.ADDED]:Ja.COMMENT_ADD,[jt.UPDATED]:Ja.COMMENT_UPDATE,[jt.DELETED]:Ja.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)}}getUserIdsToResolveFromComments(e){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: getUserIdsToResolveFromComments","color: green;");let t=new Set;for(let r of e){if(r?.from?.userId&&t.add(r?.from?.userId),r?.comments)for(let a of r?.comments){if(a?.from?.userId&&t.add(a?.from?.userId),a?.to)for(let s of a?.to)s?.userId&&t.add(s?.userId);if(a?.taggedUserContacts)for(let s of a?.taggedUserContacts)s?.userId&&t.add(s?.userId)}if(r?.assignedTo?.userId&&t.add(r?.assignedTo?.userId),r?.subscribedUsers)for(let a of Object.values(r?.subscribedUsers))a.user.userId&&t.add(a.user.userId);if(r?.unsubscribedUsers)for(let a of Object.values(r?.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 s=this.usersService.getUserById(a?.userId);if(s)return I(I({},a),s)}return a})),t?.taggedUserContacts&&(t.taggedUserContacts=t?.taggedUserContacts?.map(a=>{if(a?.contact){let s=this.usersService.getUserById(a?.contact?.userId);s&&(a.contact=s,(s?.name||s?.email)&&(a.text=`@${s?.name||s?.email}`))}return a})),(t?.taggedUserContacts?.filter((a,s,d)=>d.findIndex(p=>p.text===a.text)===s)||[]).forEach(a=>{if(a?.text){let s=new RegExp(xd(`{{${a.userId}}}`),"g");t.commentText=t.commentText?.replaceAll(s,a.text),t.commentHtml=t.commentHtml?.replaceAll(s,a.text)}})}if(e?.assignedTo?.userId){let t=this.usersService.getUserById(e?.assignedTo?.userId);t&&(e.assignedTo=t)}if(e?.subscribedUsers)for(let t of Object.values(e?.subscribedUsers)){let r=this.usersService.getUserById(t.user.userId);r&&e?.subscribedUsers?.id?.user&&(e.subscribedUsers.id.user=r)}if(e?.unsubscribedUsers)for(let t of Object.values(e?.unsubscribedUsers)){let r=this.usersService.getUserById(t.user.userId);r&&e?.unsubscribedUsers?.id?.user&&(e.unsubscribedUsers.id.user=r)}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)}),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),r=this.attachmentResolverService.attachmentDataProviderAvailable(),a=this.commentAnnotationsResolverService.getFieldsToRemove();return t&&(e?.comments?.forEach(s=>{let d=t?.comments?.[s?.commentId];if(d){s.commentHtml=d?.commentHtml,s.commentText=d?.commentText;let p=d?.attachments;r&&p&&s.attachments?.forEach(u=>{let C=u?.attachmentId;p?.[C]&&(u.name=p?.[C]?.name,u.url=p?.[C]?.url)})}}),t?.targetTextRange&&e?.targetTextRange&&(e.targetTextRange.text=t?.targetTextRange?.text),a?.length>0&&a.forEach(s=>{t?.[s]&&(e[s]=t[s])})),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 r=e?.location?.id,a=e?.metadata?.documentId;if(!r||!a)return e;let s=t?.[a]?.[r];return s&&(e.location=s?.location),e}catch(r){return this.loggingService.catch("Error in CommentUtilsService mergeLocationWithCommentAnnotations:",r),e}}isCommentsDataChanged(e,t){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: isCommentsDataChanged","color: green;");let r=this.commentAnnotationsResolverService.getCommentAnnotationById(t);return r?!zi(e,r):!0}catch(r){return this.loggingService.catch("Error in CommentUtilsService isCommentsDataChanged:",r),!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 r=this.attachmentResolverService.attachmentDataProviderAvailable(),a=new Mc;if(Object.assign(a,e),a.isCommentResolverUsed=t,r){let s=a.attachments?.map(d=>(d.isAttachmentResolverUsed=!0,delete d?.name,delete d?.url,d));a.attachments=s}return delete a?.commentHtml,delete a?.commentText,a}catch(t){return this.loggingService.catch("Error in CommentUtilsService stripCommentsFromAnnotationData:",t),e}}stripCommentAnnotationData({data:e,actionType:t}){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: stripCommentAnnotationData","color: green;"),!this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable()||!t)return{originalData:e,strippedData:null};let r=this.attachmentResolverService.attachmentDataProviderAvailable(),a=this.commentAnnotationsResolverService.getFieldsToRemove(),s=this.notificationActionTypeMap?.[t],d={},p=null,u=!1;if(e&&e.annotationId){let C=e.annotationId;d[C]=I(I(I(I({annotationId:C,metadata:wv(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,a?.length>0&&a.forEach(D=>{e?.[D]&&(d[C][D]=e[D],delete e[D])}),e.comments?.forEach(D=>{if(D.commentId){let L;r&&(L={},D.attachments?.forEach(G=>{L[G.attachmentId]={attachmentId:G.attachmentId,name:G.name,url:G.url}})),d[C].comments[D.commentId]=I(I(I(I(I(I({commentId:D.commentId},D?.commentHtml&&{commentHtml:D?.commentHtml}),D?.commentText&&{commentText:D?.commentText}),L&&{attachments:L}),D?.from&&{from:D?.from}),D?.to&&{to:D?.to}),D?.taggedUserContacts&&{taggedUserContacts:D?.taggedUserContacts})}}),u=this.isCommentsDataChanged(d[C],C);let E=new ko;Object.assign(E,e),E.comments=e.comments?.map(D=>this.stripCommentsFromAnnotationData({comment:D}))||[],p=E}return{strippedData:u?d:null,originalData:p,eventType:s}}catch(r){return this.loggingService.catch("Error in CommentAnnotationsResolverService stripCommentAnnotationData:",r),{strippedData:null,originalData:null}}}formatCommentThreadData(e){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: formatCommentThreadData","color: green;"),this.usersService.userDataProviderAvailable()){e?.from?.userId&&(e.from={userId:e.from.userId}),e?.to&&(e.to=e?.to?.map(r=>r?.userId?{userId:r.userId}:r)),e?.taggedUserContacts&&(e.taggedUserContacts=e?.taggedUserContacts?.map(r=>r?.contact?T(I({},r),{contact:{userId:r.userId}}):r));let t=e?.taggedUserContacts?.filter((r,a,s)=>s.findIndex(d=>d.text===r.text)===a)||[];t.forEach(r=>{if(r?.text){let a=new RegExp(xd(r.text),"g");e.commentText=e.commentText?.replaceAll(a,s=>`{{${r.userId}}}`),e.commentHtml=e.commentHtml?.replaceAll(a,s=>`{{${r.userId}}}`)}}),t.forEach(r=>{r?.text&&(r.text="")})}return e}catch(t){return this.loggingService.catch("Error in CommentUtilsService formatCommentThreadData:",t),e}}handleCommentEncryption(s){return Q(this,arguments,function*({data:e,firestorePath:t,extraData:r,eventType:a}){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: handleCommentEncryption","color: green;");let d=NP(this.authService.getFirebaseConfig()?.firebaseOptions),p=yr(this.functions,br({url:ni.cloudFunction?.[d]?.setEncryptedData,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:20*60*1e3});if(r){r=this.notificationService?.processNotificationData(r),r.annotationData=e;let D=r?.targetAnnotationData?.commentId;if(D){let L=e?.comments?.find(G=>G?.commentId===D);L&&(r.targetAnnotationData=L)}try{let L=this.stripCommentAnnotationData({data:r.annotationData,actionType:r?.actionType??jt.NEWLY_ADDED});L?.originalData&&(r.annotationData=this.formatCommentData(L.originalData)),r?.targetAnnotationData&&(r.targetAnnotationData=this.formatCommentThreadData(this.stripCommentsFromAnnotationData({comment:r.targetAnnotationData})))}catch(L){this.loggingService.warn("Error in CommentUtilsService handleCommentEncryption:",L)}}let u=Jp.getFirestoreProdDbName(this.configService.getApiKey()??"",this.authService.getFirebaseConfig()?.firebaseOptions),C={path:t??"",data:e??{},dbId:u??"",notificationData:r||void 0,notificationURL:ni.firebaseNotificationsDatabaseURL,feature:"comment",eventType:a??"PATCH",sdkVersion:fa()},E=yield Up(C,this.authService.getUser()?.userId??"");yield p({veltData:E})}catch(d){this.loggingService.catch("Error in CommentUtilsService handleCommentEncryption:",d)}})}};o.\u0275fac=function(t){return new(t||o)(J(y),J(Yn),J(je),J($o),J(Vt),J(ws),J(eg))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Ice=(()=>{let o=class o{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 r of e)r?.user?.userId&&t.add(r?.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);t&&(e=T(I({},e),{user:t}))}return e}catch(t){return this.loggingService.catch("Error in ContactUtilsService mergeUserIamWithUser: ",t),e}}};o.\u0275fac=function(t){return new(t||o)(J(y),J(Yn))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Ece=(()=>{let o=class o{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 r of e)r?.userId&&t.add(r?.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=I(I({},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(r=>{t.includes(r)||(e[r]=null)})}return e}catch(t){return this.loggingService.catch("Error in CursorUtilsService formatCursorUserData:",t),e}}};o.\u0275fac=function(t){return new(t||o)(J(y),J(Yn))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var yk=(()=>{let o=class o{constructor(e,t){this.loggingService=e,this.usersService=t}getUserIdsToResolveFromHuddleAttendees(e){try{this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: getUserIdsToResolveFromHuddleAttendees","color: green;");let t=new Set;for(let r of e)r?.userId&&t.add(r?.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=I(I({},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(r=>{t.includes(r)||(e[r]=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 r of e)r?.from?.userId&&t.add(r?.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 Q(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: resolveUsersFromHuddleMessages","color: green;"),this.usersService.userDataProviderAvailable()){let t=this.getUserIdsToResolveFromHuddleMessages(e),r=yield this.usersService.resolveUsers({userIds:t});for(let a of e)a?.from?.userId&&r[a.from.userId]&&(a.from=r[a.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}}};o.\u0275fac=function(t){return new(t||o)(J(y),J(Yn))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Tce=(()=>{let o=class o{constructor(e,t){this.loggingService=e,this.usersService=t}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 r of e)r?.updatedBy?.userId&&t.add(r?.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),[]}}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}}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 r=this.usersService.getUserById(t?.updatedBy?.userId);r&&(t.updatedBy=r)}return e}catch(t){return this.loggingService.catch("Error in mergeLiveStateCustomsWithUsers:",t),e}}};o.\u0275fac=function(t){return new(t||o)(J(y),J(Yn))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Dce=(()=>{let o=class o{constructor(e,t){this.loggingService=e,this.usersService=t}getUserIdsToResolveFromMultiThreads(e){try{let t=new Set;for(let r of e)r?.from?.userId&&t.add(r?.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}}};o.\u0275fac=function(t){return new(t||o)(J(y),J(Yn))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var d0=(()=>{let o=class o{constructor(e,t,r){this.authService=e,this.loggingService=t,this.usersService=r}getUserIdsToResolveFromRecorders(e){try{let t=new Set;for(let r of e)r?.from?.userId&&t.add(r?.from?.userId),r?.transcription?.from?.userId&&t.add(r?.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?T(I({},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(r){return this.loggingService.catch("Error in RecorderUtilsService formatRecorderData:",r),e}}formatRecorderDataForWhisperTranscription(e){try{return this.usersService.userDataProviderAvailable()&&e?.fromUser?.userId&&(e.fromUser={userId:e.fromUser?.userId}),e}catch(t){return this.loggingService.catch("Error in RecorderUtilsService formatRecorderDataForWhisperTranscription:",t),e}}encryptRecorderAnnotation(e){return Q(this,null,function*(){try{return yield Up(e,this.authService.getUser()?.userId??"")}catch(t){this.loggingService.catch("Error in RecorderUtilsService encryptRecorderAnnotation:",t);return}})}};o.\u0275fac=function(t){return new(t||o)(J(je),J(y),J(Yn))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Sk=(()=>{let o=class o{constructor(e,t,r,a,s,d){this.commentUtilsService=e,this.recorderUtilsService=t,this.loggingService=r,this.usersService=a,this.authService=s,this.commentAnnotationsResolverService=d}getUserIdsToResolveFromNotifications(e){try{let t=new Set;for(let r of e){let{notification:a}=r;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 s=this.commentUtilsService.getUserIdsToResolveFromComments([a?.notificationSourceData]);for(let d of s)t.add(d)}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),r=e?.raw?.targetAnnotationData?.commentId,a=t?.comments?.[r]?.commentText,s=t?.comments?.[r]?.commentHtml;return a&&s&&e?.raw?.notificationSource==="comment"&&(e.notification.displayBodyMessageTemplate=a,e.raw.targetAnnotationData.commentText=a,e.raw.targetAnnotationData.commentHtml=s),e}catch(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 r=e?.notification?.notificationSourceData?.location?.id,a=e?.notification?.notificationSourceData?.metadata?.documentId;if(!r||!a)return e;let s=t?.[a]?.[r];return s&&(e.notification.notificationSourceData.location=s?.location,e?.raw?.annotationData?.location&&(e.raw.annotationData.location=s?.location)),e}catch(r){return this.loggingService.catch("Error in NotificationUtilsService mergeLocationWithNotification:",r),e}}mergeNotificationWithUser(e){try{this.loggingService.log("%c[WB] Calling NotificationUtilsService FUNCTION: mergeNotificationWithUser","color: green;");let{notification:t}=e;if(t?.actionUser?.userId){let r=this.usersService.getUserById(t?.actionUser?.userId);r&&(t.actionUser=r)}if(t?.displayHeadlineMessageTemplateData?.actionUser?.userId){let r=this.usersService.getUserById(t?.displayHeadlineMessageTemplateData?.actionUser?.userId);r&&(t.displayHeadlineMessageTemplateData.actionUser=r)}if(t?.displayHeadlineMessageTemplateData?.recipientUser?.userId){let r=this.usersService.getUserById(t?.displayHeadlineMessageTemplateData?.recipientUser?.userId);r&&(t.displayHeadlineMessageTemplateData.recipientUser=r)}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(r){return this.loggingService.catch("Error in NotificationUtilsService formatNotification: ",r),e}}getTargetAnnotationIdsFromNotifications(e){try{this.loggingService.log("%c[WB] Calling NotificationUtilsService FUNCTION: getTargetAnnotationIdsFromNotifications","color: green;");let t=[];return Object.values(e).forEach(r=>{r?.notification?.targetAnnotationId&&r?.raw?.notificationSource==="comment"&&t.push(r.notification.targetAnnotationId)}),t}catch(t){return this.loggingService.catch("Error in NotificationUtilsService getTargetAnnotationIdsFromNotifications:",t),[]}}handleNotificationEncryption(t){return Q(this,arguments,function*({data:e}){try{this.loggingService.log("%c[WB] Calling NotificationUtilsService FUNCTION: handleNotificationEncryption","color: green;");let r="notificationwithdocumentidstoencryptanddecryptonsdk"+(this.authService.getUser()?.userId??"");return yield Up(e,r)}catch(r){return this.loggingService.catch("Error in NotificationUtilsService handleNotificationEncryption:",r),e}})}};o.\u0275fac=function(t){return new(t||o)(J(c0),J(d0),J(y),J(Yn),J(je),J(ws))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Oce=(()=>{let o=class o{constructor(e,t){this.loggingService=e,this.usersService=t}getUserIdsToResolveFromPresenceUsers(e){try{let t=new Set;for(let r of e)r?.userId&&t.add(r?.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=I(I({},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(r=>{t.includes(r)||(e[r]=null)})}return e}catch(t){return this.loggingService.catch("Error in PresenceUtilsService formatPresenceUserData:",t),e}}};o.\u0275fac=function(t){return new(t||o)(J(y),J(Yn))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Ace=(()=>{let o=class o{constructor(e,t,r,a,s,d){this.loggingService=e,this.usersService=t,this.authService=r,this.functions=a,this.configService=s,this.reactionAnnotationsResolverService=d}getUserIdsToResolveFromReactions(e){try{let t=new Set;for(let r of e)if(r?.from?.userId&&t.add(r?.from?.userId),r?.reactions?.length)for(let a of r?.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 Q(this,arguments,function*({data:e,firestorePath:t,eventType:r}){try{let s=NP(this.authService.getFirebaseConfig()?.firebaseOptions),d=yr(this.functions,br({url:ni.cloudFunction?.[s]?.setEncryptedData,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:20*60*1e3}),p=Jp.getFirestoreProdDbName(this.configService.getApiKey()??"",this.authService.getFirebaseConfig()?.firebaseOptions),u=this.authService.getUser()?.userId??"",C={path:t??"",data:e??{},dbId:p??"",feature:"reaction",eventType:r??"PATCH",sdkVersion:fa()},E=yield Up(C,u);yield d({veltData:E})}catch(s){this.loggingService.catch("Error in handleReactionEncryption:",s)}})}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 r=this.usersService.getUserById(t?.from?.userId);r&&(t.from=r)}}}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 r=this.reactionAnnotationsResolverService.getReactionAnnotationById(t);return r?!zi(e,r):!0}catch(r){return this.loggingService.catch("Error in ReactionUtilsService isReactionDataChanged:",r),!0}}stripReactionAnnotationData(e){try{if(this.loggingService.log("%c[WB] Calling ReactionUtilsService FUNCTION: stripReactionAnnotationData","color: green;"),!this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable())return{originalData:e,strippedData:null};let t={};if(e&&e.annotationId){let r=e.annotationId;if(t[r]=I({annotationId:r,metadata:wv(e.metadata??{}),icon:e.icon},e?.from&&{from:e?.from}),!this.isReactionDataChanged(t[r],r))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}}};o.\u0275fac=function(t){return new(t||o)(J(y),J(Yn),J(je),J($o),J(Vt),J(Ld))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Pce=(()=>{let o=class o{constructor(e,t){this.loggingService=e,this.usersService=t}getUserIdsToResolveFromSelections(e){try{let t=new Set;for(let r of e)r?.user?.userId&&t.add(r.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}}};o.\u0275fac=function(t){return new(t||o)(J(y),J(Yn))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Mce=(()=>{let o=class o{constructor(e,t){this.loggingService=e,this.usersService=t}getUserIdsToResolveFromTags(e){try{let t=new Set;for(let r of e)if(r?.from?.userId&&t.add(r.from.userId),r?.to?.length)for(let a of r.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 r=this.usersService.getUserById(t?.userId);r&&(t=r)}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}}};o.\u0275fac=function(t){return new(t||o)(J(y),J(Yn))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var tg=(()=>{let o=class o{constructor(e,t,r,a,s,d,p,u,C,E,D,L,G,Y,ne,ge,ye,Re,Ge){this.areaUtilsService=e,this.arrowUtilsService=t,this.commentUtilsService=r,this.contactUtilsService=a,this.cursorUtilsService=s,this.huddleUtilsService=d,this.liveStateUtilsService=p,this.loggingService=u,this.multiThreadUtilsService=C,this.notificationUtilsService=E,this.presenceUtilsService=D,this.reactionUtilsService=L,this.recorderUtilsService=G,this.selectionUtilsService=Y,this.tagUtilsService=ne,this.usersService=ge,this.docService=ye,this.commentAnnotationsResolverService=Re,this.reactionAnnotationsResolverService=Ge}getFirestorePath({feature:e,properties:t,documentPaths:r,apiKey:a}){try{if(!a)return;let{documentId:s,organizationId:d,folderId:p}=t;d||(d=r?.organizationId);let u=new vk({apiKey:a,documentId:s?`${s}`:"",organizationId:d?`${d}`:"",veltFolderId:p?`${p}`:void 0});switch(e){case"userConfig":return t?.userId&&t?.documentId&&u?.userConfig?`${u?.userConfig}/${t?.userId}/${j.FIREBASE_PARTIAL_PATH_DOCUMENT_CONFIGURATIONS}/${t?.documentId}`:void 0;case"allPermissionsUsers":return u?.permissionsUsers?`${u?.permissionsUsers}`:void 0;case"comment":return t?.documentId&&t?.id&&u?.comment?`${u?.comment}/${t?.id}`:void 0;case"allComments":return t?.documentId&&u?.comment?`${u?.comment}`:void 0;case"multiThread":return t?.documentId&&t?.id&&u?.multiThread?`${u?.multiThread}/${t?.id}`:void 0;case"allMultiThreads":return t?.documentId&&u?.multiThread?`${u?.multiThread}`:void 0;case"crdt":return t?.documentId&&u?.crdt&&t?.id?`${u?.crdt}/${t?.id}`:void 0;case"allLastNotificationTimestamp":return u?.lastNotificationTimestamp?`${u?.lastNotificationTimestamp}`:void 0;case"lastNotificationTimestamp":return t?.id&&u?.lastNotificationTimestamp?`${u?.lastNotificationTimestamp}/${t?.id}`:void 0;case"area":return t?.documentId&&t?.id&&u?.area?`${u?.area}/${t?.id}`:void 0;case"allAreas":return t?.documentId&&u?.area?`${u?.area}`:void 0;case"allDocuments":return u?.document?`${u?.document}`:void 0;case"allLocations":return u?.location?`${u?.location}`:void 0;case"allFolders":return u?.folder?`${u?.folder}`:void 0;case"folder":return u?.folder&&t.folderId?`${u?.folder}/${t.folderId}`:void 0;case"documentUserAccess":return t?.documentId&&t?.id&&u?.documentUsers?`${u?.documentUsers}/${t?.id}`:void 0;case"reaction":return t?.documentId&&t?.id&&u?.reaction?`${u?.reaction}/${t?.id}`:void 0;case"allReactions":return t?.documentId&&u?.reaction?`${u?.reaction}`:void 0;case"recorder":return t?.documentId&&t?.id&&u?.recorder?`${u?.recorder}/${t?.id}`:void 0;case"allRecorders":return t?.documentId&&u?.recorder?`${u?.recorder}`:void 0;case"documentAccessType":return t?.documentId&&u?.document?`${u?.document}/${t?.documentId}`:void 0;case"organizationMetadata":return u?.organization?`${u?.organization}`:void 0;case"documentIam":case"documentMetadata":return t?.documentId&&u?.document?`${u?.document}/${t?.documentId}`:void 0;case"folderMetadata":return t?.folderId&&u?.folder?`${u?.folder}/${t?.folderId}`:void 0;case"locationMetadata":return t?.documentId&&u?.location&&t?.id?`${u?.location}/${t?.id}`:void 0;case"documentUser":return t?.documentId&&t?.id&&u?.documentUsers?`${u?.documentUsers}/${t?.id}`:void 0;case"allDocumentUsers":return u?.users?`${u?.users}`:void 0;case"allFolderUsers":return u?.users?`${u?.users}`:void 0;case"allOrganizationGroups":return u?.organizationGroups?`${u?.organizationGroups}`:void 0;case"allOrganizationUsers":return u?.users?`${u?.users}`:void 0;case"commentViews":return t?.documentId&&t?.id&&u?.commentViews?`${u?.commentViews}/${t?.id}`:void 0;case"allCommentViews":return t?.documentId&&u?.commentViews?`${u?.commentViews}`:void 0;case"notificationViewsTimestamp":return t?.documentId&&t?.id&&u?.notificationViews?`${u?.notificationViews}/${t?.id}`:void 0;case"allDocumentViews":return t?.documentId&&u?.documentViews?`${u?.documentViews}`:void 0;case"documentViews":case"documentMetadataViews":case"documentDayViews":case"documentUsersViews":return t?.documentId&&t?.id&&u?.documentViews?`${u?.documentViews}/${t?.id}`:void 0;case"locationDayViews":case"locationUsersViews":case"locationViews":case"locationMetadataViews":case"location":return t?.documentId&&t?.id&&u?.locationViews?`${u?.locationViews}/${t?.id}`:void 0;case"allLocationViews":return t?.documentId&&u?.locationViews?`${u?.locationViews}`:void 0;case"allDocNotifications":return t?.documentId&&u?.docNotification?`${u?.docNotification}`:void 0;case"docNotificationViews":case"docNotification":return t?.documentId&&t?.id&&u?.docNotification?`${u?.docNotification}/${t?.id}`:void 0;case"userNotificationViews":case"userNotification":return t?.userId&&t?.id&&u?.notificationUsers?`${u?.notificationUsers}/${t?.userId}/${j.FIREBASE_PARTIAL_PATH_USER_NOTIFICATION}/${t?.id}`:void 0;case"allDocNotifications":return t?.documentId&&u?.docNotification?`${u?.docNotification}`:void 0;case"allUserNotifications":return t?.userId&&u?.notificationUsers?`${u?.notificationUsers}/${t?.userId}/${j.FIREBASE_PARTIAL_PATH_USER_NOTIFICATION}`:void 0;default:throw new Error(`Unknown feature: ${e}`)}}catch(s){this.loggingService.catch("Error in CommonDbUtilsService getFirestorePath:",s);return}}getFirestoreCollectionGroupPath(e){try{switch(e){case"allComments":return j.FIREBASE_PARTIAL_PATH_COMMENT;case"allDocuments":return j.FIREBASE_PARTIAL_PATH_DOCS;case"allLocations":return j.FIREBASE_PARTIAL_PATH_LOCATION;case"allMultiThreads":return j.FIREBASE_PARTIAL_PATH_MULTI_THREAD;case"allAreas":return j.FIREBASE_PARTIAL_PATH_AREA;case"allReactions":return j.FIREBASE_PARTIAL_PATH_REACTION;case"allRecorders":return j.FIREBASE_PARTIAL_PATH_RECORDER;case"allDocumentViews":return j.FIREBASE_PARTIAL_PATH_DOCUMENT_VIEWS;case"allCommentViews":return j.FIREBASE_PARTIAL_PATH_COMMENT_VIEWS;case"allLocationViews":return j.FIREBASE_PARTIAL_PATH_LOCATION_VIEWS;case"allDocumentUsers":return j.FIREBASE_PARTIAL_PATH_DOCUMENT_USERS;case"allFolderUsers":return j.FIREBASE_PARTIAL_PATH_FOLDER_USERS;default:throw new Error(`Unknown feature: ${e}`)}}catch(t){this.loggingService.catch("Error in CommonDbUtilsService getFirestoreCollectionGroupPath:",t);return}}getDocumentPath({feature:e,properties:t,defaultDocumentPaths:r,apiKey:a,useFirestore:s}){try{if(!a)return;let{documentId:d,organizationId:p}=t;p||(p=r?.organizationId);let u=new Fd({apiKey:a,documentId:d?`${d}`:"",organizationId:p?`${p}`:""});switch(e){case"userConfig":return t?.userId&&t?.documentId&&u?.userConfig?`${u?.userConfig}/${t?.userId}/${j.FIREBASE_PARTIAL_PATH_DOCUMENT_CONFIGURATIONS}/${t?.documentId}`:void 0;case"allComments":return!s&&t?.documentId&&u?.comment?`${u?.comment}`:void 0;case"allGlobalContacts":return t?.documentId&&u?.globalContacts?`${u?.globalContacts}`:void 0;case"globalContacts":return t?.documentId&&t?.userId&&u?.globalContacts?`${u?.globalContacts}${t?.userId}`:void 0;case"groupContacts":return t?.documentId&&t?.groupId&&u?.groupContacts?`${u?.groupContacts}${t?.groupId}`:void 0;case"groupContactsUser":return t?.documentId&&t?.groupId&&t?.userId&&u?.groupContacts?`${u?.groupContacts}${t?.groupId}/${t?.userId}`:void 0;case"allLoginContacts":return t?.documentId&&t?.userId&&u?.logins?`${u?.logins}${t?.userId}/contacts`:void 0;case"allLogins":return t?.documentId&&u?.logins?`${u?.logins}`:void 0;case"logins":return t?.documentId&&t?.userId&&u?.logins?`${u?.logins}${t?.userId}`:void 0;case"customerMetadata":return u?.customerMetadata?`${u?.customerMetadata}`:void 0;case"allArrows":return t?.documentId&&u?.arrow?`${u?.arrow}`:void 0;case"arrow":return t?.documentId&&u?.arrow&&t.id?`${u?.arrow}${t.id}`:void 0;case"allCursors":return t?.documentId&&u?.cursor?`${u?.cursor}`:void 0;case"cursor":return t?.documentId&&u?.cursor&&t.id?`${u?.cursor}${t.id}`:void 0;case"flockUser":return t?.documentId&&u?.flock&&t.id?`${u?.flock}users/${t.id}`:void 0;case"flockSession":return t?.documentId&&u?.flock&&t.id?`${u?.flock}sessions/${t.id}`:void 0;case"allHuddleAttendees":return t?.documentId&&u?.huddle?`${u?.huddle}attendees`:void 0;case"huddleAttendee":return t?.documentId&&u?.huddle&&t.id?`${u?.huddle}attendees/${t.id}`:void 0;case"huddleAttendeeState":return t?.documentId&&u?.huddle&&t.id?`${u?.huddle}attendees/${t.id}/state`:void 0;case"allHuddleInvitees":return t?.documentId&&u?.huddle?`${u?.huddle}invitees`:void 0;case"huddleConnection":return t?.documentId&&u?.huddle&&t.id?`${u?.huddle}connections/${t.id}`:void 0;case"huddleIceCandidate":return t?.documentId&&u?.huddle&&t.id?`${u?.huddle}iceCandidates/${t.id}`:void 0;case"allHuddleIceCandidates":return t?.documentId&&u?.huddle?`${u?.huddle}iceCandidates`:void 0;case"allHuddleMessages":return t?.documentId&&u?.huddle?`${u?.huddle}messages`:void 0;case"huddleMessage":return t?.documentId&&u?.huddle&&t.id?`${u?.huddle}messages/${t.id}`:void 0;case"allLiveStates":return t?.documentId&&u?.liveState?`${u?.liveState}`:void 0;case"allLiveStateCustoms":return t?.documentId&&u?.liveState?`${u?.liveState}custom`:void 0;case"liveStateCustom":return t?.documentId&&u?.liveState&&t?.id?`${u?.liveState}custom/${t.id}`:void 0;case"liveStateSingleEditorMode":return t?.documentId&&u?.liveStateSingleEditorMode?`${u?.liveStateSingleEditorMode}`:void 0;case"liveStateAutoSyncStateCurrent":return t?.documentId&&u?.liveState?`${u?.liveState}default/autoSyncState/current`:void 0;case"liveStateAutoSyncStateHistoryId":return t?.documentId&&u?.liveState&&t?.id?`${u?.liveState}default/autoSyncState/history/${t.id}`:void 0;case"presence":return t?.documentId&&u?.presence&&t?.userId?`${u?.presence}${t?.userId}`:void 0;case"allPresence":return t?.documentId&&u?.presence?`${u?.presence}`:void 0;case"workspaceIam":return u?.workspaceIam?`${u?.workspaceIam}`:void 0;case"selection":return t?.documentId&&u?.selection&&t?.userId?`${u?.selection}${t?.userId}`:void 0;case"allSelections":return t?.documentId&&u?.selection?`${u?.selection}`:void 0;case"syncVideoPlayer":return t?.documentId&&u?.syncVideoPlayer?`${u?.syncVideoPlayer}`:void 0;case"allTags":return t?.documentId&&u?.tag?`${u?.tag}`:void 0;case"tag":return t?.documentId&&u?.tag&&t?.id?`${u?.tag}${t?.id}`:void 0;case"userContactUs":return t?.documentId&&u?.userContactUs?`${u?.userContactUs}`:void 0;case"userFeedback":return t?.documentId&&u?.userFeedback?`${u?.userFeedback}`:void 0;case"userReportBug":return t?.documentId&&u?.userReportBugs?`${u?.userReportBugs}`:void 0;case"comment":return!s&&t?.documentId&&t?.id&&u?.comment?`${u?.comment}${t?.id}`:void 0;case"allMultiThreads":return!s&&t?.documentId&&u?.multiThread?`${u?.multiThread}`:void 0;case"crdt":return!s&&t?.documentId&&u?.crdt?`${u?.crdt}`:void 0;case"crdtData":return t?.documentId&&u?.crdt&&t?.id?`${u?.crdt}/${t?.id}/data`:void 0;case"crdtSyncState":return t?.documentId&&u?.crdt&&t?.id?`${u?.crdt}/${t?.id}/sync/state`:void 0;case"crdtSyncPresence":return t?.documentId&&t.userId&&u?.crdt&&t?.id?`${u?.crdt}/${t?.id}/sync/presence/${t.userId}`:void 0;case"allCrdtSyncPresence":return t?.documentId&&u?.crdt&&t?.id?`${u?.crdt}/${t?.id}/sync/presence`:void 0;case"crdtPresence":return t?.documentId&&t.userId&&u?.crdt&&t?.id?`${u?.crdt}/${t?.id}/presence/${t.userId}`:void 0;case"allCrdtPresence":return t?.documentId&&u?.crdt&&t?.id?`${u?.crdt}/${t?.id}/presence`:void 0;case"crdtVersion":return t?.documentId&&u?.crdt&&t?.id&&t?.versionId?`${u?.crdt}/${t?.id}/versions/${t?.versionId}`:void 0;case"crdtVersions":return t?.documentId&&u?.crdt&&t?.id?`${u?.crdt}/${t?.id}/versions`:void 0;case"multiThread":return!s&&t?.documentId&&t?.id&&u?.multiThread?`${u?.multiThread}${t?.id}`:void 0;case"allLastNotificationTimestamp":return!s&&u?.organizationNotificationsLastNotificationTimestamp?`${u?.organizationNotificationsLastNotificationTimestamp}`:void 0;case"lastNotificationTimestamp":return!s&&t?.id&&u?.organizationNotificationsLastNotificationTimestamp?`${u?.organizationNotificationsLastNotificationTimestamp}${t?.id}`:void 0;case"documentIam":return!s&&t?.documentId&&u?.documentIam?`${u?.documentIam}`:void 0;case"documentMetadata":return!s&&t?.documentId&&u?.metadata?`${u?.metadata}`:void 0;case"allDocuments":return!s&&u?.docs&&t?.documentId?`${u?.docs}/${t?.documentId}/${j.FIREBASE_PARTIAL_PATH_METADATA}`:void 0;case"allAreas":return!s&&t?.documentId&&u?.area?`${u?.area}`:void 0;case"area":return!s&&t?.id&&u?.area?`${u?.area}${t?.id}`:void 0;case"documentUserAccess":return!s&&t?.id&&u?.documentIam?`${u?.documentIam}users/${t?.id}`:void 0;case"documentUser":return!s&&t?.documentId&&t?.id&&u?.documentIam?`${u?.documentIam}users/${t?.id}`:void 0;case"allDocumentUsers":return!s&&t?.documentId&&u?.documentIam?`${u?.documentIam}users/`:void 0;case"allOrganizationGroups":return!s&&u?.organizationGroups?`${u?.organizationGroups}`:void 0;case"allOrganizationUsers":return!s&&u?.organizationIam?`${u?.organizationIam}users/`:void 0;case"reaction":return!s&&t?.id&&u?.reaction?`${u?.reaction}${t?.id}`:void 0;case"allReactions":return!s&&t?.documentId&&u?.reaction?`${u?.reaction}`:void 0;case"recorder":return!s&&t?.documentId&&t?.id&&u?.recorder?`${u?.recorder}${t?.id}`:void 0;case"allRecorders":return!s&&t?.documentId&&u?.recorder?`${u?.recorder}`:void 0;case"organizationMetadata":return!s&&u?.organizationMetadata?`${u?.organizationMetadata}`:void 0;case"documentAccessType":return!s&&u?.documentIam?`${u?.documentIam}`:void 0;case"documentIam":return!s&&u?.documentIam?`${u?.documentIam}`:void 0;case"documentMetadata":return!s&&t?.documentId&&u?.metadata?`${u?.metadata}`:void 0;case"commentViews":return!s&&t?.documentId&&t?.id&&u?.views?`${u?.views}comment/${t?.id}`:void 0;case"allDocumentViews":return!s&&t?.documentId&&u?.views?`${u?.views}documentViews/`:void 0;case"documentViews":return!s&&t?.documentId&&t?.id&&u?.views?`${u?.views}documentViews/${t?.id}`:void 0;case"allCommentViews":return!s&&t?.documentId&&u?.views?`${u?.views}comment/`:void 0;case"allLocationViews":return!s&&t?.documentId&&u?.views?`${u?.views}locationViews/`:void 0;case"notificationViewsTimestamp":return!s&&t?.id&&t?.user&&u?.views?`${u?.views}notification/${t?.id}/views/${t?.user}`:void 0;case"documentUsersViews":return!s&&t?.id&&t?.user&&t?.date&&u?.views?`${u?.views}documentViews/${t?.id}/users/${t?.user}/${t?.date}`:void 0;case"documentMetadataViews":return!s&&t?.id&&u?.views?`${u?.views}documentViews/${t?.id}/metadata`:void 0;case"documentDayViews":return!s&&t?.id&&t?.date&&t?.user&&u?.views?`${u?.views}documentViews/${t?.id}/day/${t?.date}/${t?.user}`:void 0;case"locationViews":return!s&&t?.id&&u?.views?`${u?.views}locationViews/${t?.id}/location`:void 0;case"location":return!s&&t?.id&&u?.views?`${u?.views}locationViews/${t?.id}`:void 0;case"locationUsersViews":return!s&&t?.id&&t?.user&&t?.date&&u?.views?`${u?.views}locationViews/${t?.id}/users/${t?.user}/${t?.date}`:void 0;case"locationMetadataViews":return!s&&t?.id&&u?.views?`${u?.views}locationViews/${t?.id}/metadata`:void 0;case"locationDayViews":return!s&&t?.id&&t?.date&&t?.user&&u?.views?`${u?.views}locationViews/${t?.id}/day/${t?.date}/${t?.user}`:void 0;case"docNotificationViews":case"docNotification":return t?.documentId&&t?.id&&u?.organizationNotificationsWithDocumentId?`${u?.organizationNotificationsWithDocumentId}${t?.id}`:void 0;case"allDocNotifications":return t?.documentId&&u?.organizationNotificationsWithDocumentId?`${u?.organizationNotificationsWithDocumentId}`:void 0;case"allUserNotifications":return t?.userId&&u?.organizationNotificationsUsers?`${u?.organizationNotificationsUsers}${t?.userId}`:void 0;case"userNotificationViews":case"userNotification":return t?.userId&&t?.id&&u?.organizationNotificationsUsers?`${u?.organizationNotificationsUsers}${t?.userId}/${t?.id}`:void 0;case"locationMetadata":return;case"allLocations":return;case"folderMetadata":return;default:throw new Error(`Unknown feature: ${e}`)}}catch(d){this.loggingService.catch("Error in CommonDbUtilsService getDocumentPath:",d);return}}resolveAnnotations(r){return Q(this,arguments,function*({data:e,feature:t}){try{if(e&&e?.length>0)switch(t){case"allComments":{this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable()&&this.commentAnnotationsResolverService.resolveCommentAnnotations({commentAnnotationIds:e,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""});break}case"allReactions":{this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable()&&this.reactionAnnotationsResolverService.resolveReactionAnnotations({reactionAnnotationIds:e,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""});break}default:break}}catch(a){this.loggingService.catch(`Error in CommonDbUtilsService resolveAnnotations: ${t}`,a)}})}formatResponse(d){return Q(this,arguments,function*({feature:e,data:t,shouldAwait:r=!1,forceResolve:a=!1,shouldCommentAnnotationsResolverAwait:s=!1}){try{if(this.usersService.userDataProviderAvailable()){let p=[];switch(e){case"allAreas":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.areaUtilsService.getUserIdsToResolveFromAreaAnnotations(Object.values(t)));break}case"allArrows":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.arrowUtilsService.getUserIdsToResolveFromArrowAnnotations(Object.values(t)));break}case"allCursors":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.cursorUtilsService.getUserIdsToResolveFromCursorUsers(Object.values(t)));break}case"allComments":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.commentUtilsService.getUserIdsToResolveFromComments(Object.values(t)));break}case"allDocumentUsers":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.contactUtilsService.getUserIdsToResolveFromUserIamData(Object.values(t)));break}case"allFolderUsers":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.contactUtilsService.getUserIdsToResolveFromUserIamData(Object.values(t)));break}case"allOrganizationUsers":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.contactUtilsService.getUserIdsToResolveFromUserIamData(Object.values(t)));break}case"allMultiThreads":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.multiThreadUtilsService.getUserIdsToResolveFromMultiThreads(Object.values(t)));break}case"allDocNotifications":{t&&typeof t=="object"&&(p=this.notificationUtilsService.getUserIdsToResolveFromNotifications(Array.isArray(t)?t:Object.values(t)));break}case"allUserNotifications":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.notificationUtilsService.getUserIdsToResolveFromNotifications(Object.values(t)));break}case"allPresence":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.presenceUtilsService.getUserIdsToResolveFromPresenceUsers(Object.values(t)));break}case"allRecorders":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.recorderUtilsService.getUserIdsToResolveFromRecorders(Object.values(t)));break}case"allReactions":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.reactionUtilsService.getUserIdsToResolveFromReactions(Object.values(t)));break}case"allTags":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.tagUtilsService.getUserIdsToResolveFromTags(Object.values(t)));break}case"allHuddleAttendees":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.huddleUtilsService.getUserIdsToResolveFromHuddleAttendees(Object.values(t)));break}case"liveStateCustom":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.liveStateUtilsService.getUserIdsToResolveFromLiveStateCustom(t));break}case"allLiveStateCustoms":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.liveStateUtilsService.getUserIdsToResolveFromLiveStateCustoms(Object.values(t)));break}case"allLiveStates":{t&&typeof t=="object"&&(p=this.liveStateUtilsService.getUserIdsToResolveFromLiveStates(t));break}case"allSelections":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.selectionUtilsService.getUserIdsToResolveFromSelections(Object.values(t)));break}default:p=[]}p?.length&&(r?yield this.usersService.resolveUsers({userIds:p,forceResolve:a,feature:e}):this.usersService.resolveUsers({userIds:p,forceResolve:a,feature:e}))}if(this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable()){let p=[];switch(e){case"allDocNotifications":{if(t&&typeof t=="object"){let u=this.notificationUtilsService.getTargetAnnotationIdsFromNotifications(t);p=[...p,...u],p=p.filter(C=>!this.commentAnnotationsResolverService.getCommentAnnotationById(C))}break}case"allUserNotifications":{if(t&&typeof t=="object"&&!Array.isArray(t)){let u=this.notificationUtilsService.getTargetAnnotationIdsFromNotifications(t);p=[...p,...u],p=p.filter(C=>!this.commentAnnotationsResolverService.getCommentAnnotationById(C))}break}default:p=[]}p?.length&&(s?yield this.commentAnnotationsResolverService.resolveCommentAnnotations({commentAnnotationIds:p,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""}):this.commentAnnotationsResolverService.resolveCommentAnnotations({commentAnnotationIds:p,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""}))}return t}catch(p){return this.loggingService.catch("Error in CommonDbUtilsService formatResponse:",p),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((r,[a,s])=>(r[a]=this.commentUtilsService.mergeStrippedDataWithCommentAnnotations(s),r),{}):e;case"allDocNotifications":case"allUserNotifications":return e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).reduce((r,[a,s])=>(r[a]=this.notificationUtilsService.mergeStrippedDataWithNotification(s),r),{}):e;default:return e}return e}catch(r){return this.loggingService.catch("Error in CommonDbUtilsService mergeCommentAnnotationsWithData:",r),e}}mergeReactionAnnotationsWithData({data:e,feature: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((r,[a,s])=>(r[a]=this.reactionUtilsService.mergeStrippedDataWithReactionAnnotations(s),r),{}):e;default:return e}return e}catch(r){return this.loggingService.catch("Error in CommonDbUtilsService mergeReactionAnnotationsWithData:",r),e}}mergeLocationMetadataWithData({data:e,feature:t,locationMetadata:r}){try{if(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: mergeLocationMetadataWithData","color: green;"),r&&typeof r=="object"&&!Array.isArray(r))switch(t){case"allComments":return e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).reduce((a,[s,d])=>(a[s]=this.commentUtilsService.mergeLocationWithCommentAnnotations(d,r),a),{}):e;case"allDocNotifications":case"allUserNotifications":return e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).reduce((a,[s,d])=>(a[s]=this.notificationUtilsService.mergeLocationWithNotification(d,r),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((r,[a,s])=>(r[a]=this.areaUtilsService.mergeAreaWithUser(s),r),{}):t;case"allArrows":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[a,s])=>(r[a]=this.arrowUtilsService.mergeArrowWithUser(s),r),{}):t;case"allCursors":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[a,s])=>(r[a]=this.cursorUtilsService.mergeCursorUserWithUser(s),r),{}):t;case"allComments":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[a,s])=>(r[a]=this.commentUtilsService.mergeCommentWithUser(s),r),{}):t;case"allDocumentUsers":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[a,s])=>(r[a]=this.contactUtilsService.mergeUserIamWithUser(s),r),{}):t;case"allFolderUsers":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[a,s])=>(r[a]=this.contactUtilsService.mergeUserIamWithUser(s),r),{}):t;case"allOrganizationUsers":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[a,s])=>(r[a]=this.contactUtilsService.mergeUserIamWithUser(s),r),{}):t;case"allMultiThreads":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[a,s])=>(r[a]=this.multiThreadUtilsService.mergeMultiThreadWithUser(s),r),{}):t;case"allDocNotifications":return t&&typeof t=="object"?t?.map(r=>this.notificationUtilsService.mergeNotificationWithUser(r)):t;case"allUserNotifications":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[a,s])=>(r[a]=this.notificationUtilsService.mergeNotificationWithUser(s),r),{}):t;case"allPresence":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[a,s])=>(r[a]=this.presenceUtilsService.mergePresenceUserWithUser(s),r),{}):t;case"allRecorders":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[a,s])=>(r[a]=this.recorderUtilsService.mergeRecorderWithUser(s),r),{}):t;case"allReactions":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[a,s])=>(r[a]=this.reactionUtilsService.mergeReactionWithUser(s),r),{}):t;case"allTags":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[a,s])=>(r[a]=this.tagUtilsService.mergeTagWithUser(s),r),{}):t;case"allHuddleAttendees":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[a,s])=>(r[a]=this.huddleUtilsService.mergeHuddleAttendeeWithUser(s),r),{}):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((r,[a,s])=>(r[a]=this.liveStateUtilsService.mergeLiveStateCustomWithUser(s),r),{}):t;case"allLiveStates":return t&&typeof t=="object"?this.liveStateUtilsService.mergeLiveStateWithUser(t):t;case"allSelections":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[a,s])=>(r[a]=this.selectionUtilsService.mergeSelectionWithUser(s),r),{}):t;default:return t}return t}catch(r){return this.loggingService.catch("Error in CommonDbUtilsService mergeUsersWithData:",r),t}}mergeCommentAnnotationsWithData$({data:e,feature:t}){try{return this.commentAnnotationsResolverService.getCommentAnnotationsById$().pipe(de(()=>{let r=this.mergeCommentAnnotationsWithData({data:e?.data??{},feature:t}),a=this.mergeUsersWithData({feature:t,data:r??{}});return typeof a=="object"?{data:JSON.parse(JSON.stringify(a)),operation:e?.operation??null}:{data:a,operation:e?.operation??null}}),kt(si))}catch(r){return this.loggingService.catch("Error in mergeCommentAnnotationsWithData:",r),se(e)}}mergeReactionAnnotationsWithData$({data:e,feature:t}){try{return this.reactionAnnotationsResolverService.getReactionAnnotationsById$().pipe(de(()=>{let r=this.mergeReactionAnnotationsWithData({data:e?.data??{},feature:t}),a=this.mergeUsersWithData({feature:t,data:r??{}});return typeof a=="object"?{data:JSON.parse(JSON.stringify(a)),operation:e?.operation??null}:{data:a,operation:e?.operation??null}}),kt(si))}catch(r){return this.loggingService.catch("Error in mergeReactionAnnotationsWithData:",r),se(e)}}mergeUsersWithData$({feature:e,data:t}){try{return this.usersService.getUserById$().pipe(de(()=>{let r=this.mergeUsersWithData({feature:e,data:t?.data??{}});return typeof r=="object"?{data:JSON.parse(JSON.stringify(r)),operation:t?.operation??null}:{data:r,operation:t?.operation??null}}),kt(si))}catch(r){return this.loggingService.catch(`Error in mergeUsersWithData for ${e}:`,r),se(t)}}mergeLocationMetadataWithData$({data:e,feature:t}){try{return this.docService.getLocationMetadata$().pipe(de(r=>{let a=this.mergeLocationMetadataWithData({data:e?.data??{},feature:t,locationMetadata:r});return typeof a=="object"?{data:JSON.parse(JSON.stringify(a)),operation:e?.operation??null}:{data:a,operation:e?.operation??null}}),kt(si))}catch(r){return this.loggingService.catch(`Error in mergeLocationMetadataWithData for ${t}:`,r),se(e)}}handleDataStripping({feature:e,data:t,actionType:r}){try{switch(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: handleDataStripping","color: green;"),e){case"comment":return this.commentUtilsService.stripCommentAnnotationData({data:t,actionType:r});case"reaction":return this.reactionUtilsService.stripReactionAnnotationData(t);default:return{originalData:t,strippedData:null}}}catch(a){return this.loggingService.catch("Error in CommonDbUtilsService handleDataStripping:",a),{originalData:t,strippedData:null}}}formatData({feature:e,data:t,properties:r,offset:a,isRealtimeDb:s}){try{this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: formatData","color: green;"),typeof t=="object"&&(t=JSON.parse(JSON.stringify(t)));let d=new Date().getTime()+a;switch(e){case"documentAccessType":return delete t?.users,{docIamConfig:t};case"organizationMetadata":case"documentMetadata":return s?t:{metadata: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,d);case"notificationViewsTimestamp":return{views:{[r.user??""]:t}};case"documentUsersViews":return s?t:{users:{[r.user??""]:{[r.date??""]:t}}};case"documentDayViews":return s?t:{day:{[r.date??""]:{[r.user??""]:t}}};case"documentMetadataViews":return s?t:{metadata:t};case"huddleMessage":return this.huddleUtilsService.formatHuddleMessageData(t);case"locationMetadataViews":return s?t:{metadata:t};case"locationUsersViews":return s?t:{users:{[r.user??""]:{[r.date??""]:t}}};case"locationDayViews":return s?t:{day:{[r.date??""]:{[r.user??""]:t}}};case"locationViews":return s?t:{location:t};case"docNotificationViews":return s?t:{views:t.views};case"userNotificationViews":return s?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(d){return this.loggingService.catch("Error in CommonDbUtilsService formatData:",d),t}}modifyAndSetData(s){return Q(this,arguments,function*({feature:e,data:t,subscriber:r,operation:a=null}){try{let d=yield this.modifyData({feature:e,data:t});r.next({data:d,operation:a})}catch(d){this.loggingService.catch("Error in CommonDbUtilsService modifyAndSetData:",d)}})}isDataAlreadyProcessedInLocalCache({feature:e,change:t,cache:r}){try{if(e==="allReactions"||e==="allComments"){if(t.type==="removed")return!Object.keys(r??{}).includes(t.doc.id);if(r?.[t.doc.id]){let a=t.doc.data(),s=r?.[t.doc.id];return a?.lastUpdated===s?.lastUpdated}}return!1}catch(a){return this.loggingService.catch("Error in CommonDbUtilsService isDataAlreadyProcessedInLocalCache:",a),!1}}modifyData(r){return Q(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)?T(I({},e),{metadata:e?.metadata??{documentId:t?.documentId,organizationId:t?.organizationId,apiKey:t?.apiKey}}):e}catch(r){return this.loggingService.catch("Error in CommonDbUtilsService addMetadata:",r),e}}setDataInLocal(p){return Q(this,arguments,function*({feature:e,data:t,observablesCache:r,eventType:a,id:s,operation:d=null}){try{let C={comment:"allComments",reaction:"allReactions"}[e];if(!C)return null;let E=t?.metadata?.documentId,D=t?.metadata?.veltFolderId;return Object.keys(r).filter(L=>L.includes(C)&&(!E||L.includes(E)||D&&L.includes(D))).forEach(L=>{let G=r[L]?.subject?.getValue()??{};a==="DELETE"?s&&G?.data?.[s]&&(delete G?.data?.[s],r[L]?.subject&&r[L].subject.next({data:G?.data,operation:d})):r[L]?.subject?.next({data:T(I({},G?.data),{[t?.annotationId]:t}),operation:d})}),null}catch(u){return this.loggingService.catch("Error in CommonDbUtilsService setDataInLocal:",u),null}})}handleCommentEncryption(s){return Q(this,arguments,function*({data:e,firestorePath:t,extraData:r,eventType:a}){try{return yield this.commentUtilsService.handleCommentEncryption({data:e,firestorePath:t,extraData:r,eventType:a})}catch(d){return this.loggingService.catch("Error in CommonDbUtilsService handleCommentEncryption:",d),e}})}handleReactionEncryption(a){return Q(this,arguments,function*({data:e,firestorePath:t,eventType:r}){try{return yield this.reactionUtilsService.handleReactionEncryption({data:e,firestorePath:t,eventType:r})}catch(s){return this.loggingService.catch("Error in CommonDbUtilsService handleReactionEncryption:",s),e}})}};o.\u0275fac=function(t){return new(t||o)(J(Sce),J(bce),J(c0),J(Ice),J(Ece),J(yk),J(Tce),J(y),J(Dce),J(Sk),J(Oce),J(Ace),J(d0),J(Pce),J(Mce),J(Yn),J(at),J(ws),J(Ld))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var kce=(()=>{let o=class o{constructor(e,t,r){this.configService=e,this.authService=t,this.loggingService=r,this.firestore$=new ve(null);try{En([this.authService.getFirebaseConfig$(),this.configService.getApiKey$()]).pipe(Le(([a,s])=>!!a&&!!s),rt(1)).subscribe(([a,s])=>{a&&s&&a?.firebaseOptions?.storeDbId&&this.firestore$.next(WM(Jp.getFirestoreProdDbName(s,a.firebaseOptions)))},a=>{})}catch{}}getFirestore(){return this.firestore$.asObservable()}getFirestoreValue(){return this.firestore$.value}generateFirestoreDocumentId(){try{let e=this.getFirestoreValue()||WM("DocumentIdDb");if(e){let t=mb(e,"generateDocumentId");return t0(t).id}return}catch(e){this.loggingService.catch("Error in FirestoreService generateFirestoreDocumentId: ",e);return}}};o.\u0275fac=function(t){return new(t||o)(J(Vt),J(je),J(y))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var yn=(()=>{let o=class o{constructor(e,t,r,a,s,d,p,u,C,E){this.authService=e,this.commonDbUtilsService=t,this.loggingService=r,this.firestoreService=a,this.databaseService=s,this.configService=d,this.docService=p,this.usersService=u,this.commentAnnotationsResolverService=C,this.reactionAnnotationsResolverService=E,this.offset=0,this.db=null,this.firestore=null,this.subscriptions=[],this.offsetListener=null,this.observablesCache={},this.firestoreSubscriptions={},this.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(D=>{if(D){this.db=D;let L=$i(D,".info/serverTimeOffset");this.offsetListener=Ap(L,G=>{let Y=G.val();this.offset=Y})}})),this.subscriptions.push(this.firestoreService.getFirestore().subscribe(D=>{D&&(this.firestore=D)}))}unsubscribeFromObservables(){try{Object.values(this.firestoreSubscriptions??{}).forEach(e=>{e?.unsubscribe()}),Object.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 Q(this,null,function*(){try{if(this.db){let r=$i(this.db,e);return Cd(r).update(t)}return Promise.resolve()}catch(r){return this.loggingService.catch("Error in setupOnDisconnect:",r),Promise.resolve()}})}getOffset(){return this.offset}getServerTimestamp(){return new Date().getTime()+this.getOffset()}subscribeToServices(e){En([this.databaseService.getDb(),this.firestoreService.getFirestore()]).pipe(Le(([t,r])=>!!t),rt(1),gn(([t,r])=>{e({db:t,firestore:r})})).subscribe({error:t=>{this.loggingService.catch("Error in CommonDbService subscription: ",t)}})}performDatabaseOperation(e,t,r,a,s,d){return Q(this,null,function*(){try{if(!t){this.loggingService.warn(`%c[WB] No properties found for ${e}`,"color: red;");return}return this.subscribeToServices(C=>Q(this,[C],function*({db:p,firestore:u}){let E;t?.skipFirestore||(E=this.commonDbUtilsService.getFirestorePath({feature:e,properties:t,documentPaths:this.docService.getDocumentPaths(),apiKey:t.apiKey??this.configService.getApiKey()}));let D=this.commonDbUtilsService.getDocumentPath({feature:e,properties:t,defaultDocumentPaths:this.docService.getDocumentPaths(),apiKey:t.apiKey??this.configService.getApiKey(),useFirestore:this.shouldUseFirestore()});if(!p){this.loggingService.warn(`%c[WB] No database or firestore found for ${e}`,"color: red;");return}try{let L,G;try{D&&(L=$i(p,`${D}`))}catch{this.loggingService.catch("Error in dbRef")}try{E?.includes("/organizations")&&u&&E&&(G=t0(u,`${E}`))}catch{this.loggingService.catch("Error in docRef")}if(!this.authService.getUser())return;yield r({dbRef:L,firestoreRef:G,data:a,firestorePath:E}),d&&d({firestoreAvailable:!!u})}catch(L){this.loggingService.catch(`Error in ${e} operation: `,L),s&&s(L)}}))}catch(p){this.loggingService.catch("Error in performDatabaseOperation:",p)}})}setData(p){return Q(this,arguments,function*({feature:e,data:t,properties:r,callback:a,errorCallback:s,extraData:d}){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,r,u=>Q(this,null,function*(){if(u.dbRef){let C=this.commonDbUtilsService.formatData({feature:e,data:u.data,properties:r,offset:this.getOffset(),isRealtimeDb:!0});yield Zf(u.dbRef,JSON.parse(JSON.stringify(C)))}try{if(u.firestoreRef&&u.data&&!r?.skipFirestore){let C=this.commonDbUtilsService.formatData({feature:e,data:u.data,properties:r,offset:this.getOffset()});typeof C=="object"&&(C=JSON.parse(JSON.stringify(C)));let{strippedData:E,originalData:D,eventType:L}=this.commonDbUtilsService.handleDataStripping({feature:e,data:C,actionType:d?.actionType});if(e==="comment"){let G=null;E&&(G=yield this.commentAnnotationsResolverService.saveCommentAnnotation({commentAnnotation:E,eventType:L,commentId:d?.targetAnnotationData?.commentId})),D&&(G?.isSuccess||G===null)&&(yield this.commonDbUtilsService.handleCommentEncryption({data:D,firestorePath:u.firestorePath??"",extraData:d}))}else if(e==="reaction"){let G=null;E&&(G=yield this.reactionAnnotationsResolverService.saveReactionAnnotation(E)),D&&(G?.isSuccess||G===null)&&(yield this.commonDbUtilsService.handleReactionEncryption({data:D,firestorePath:u.firestorePath??""}))}else e==="recorder"?this.firestore&&(yield nce(this.firestore,G=>Q(this,null,function*(){G.set(u.firestoreRef,C)}))):yield oz(u.firestoreRef,C)}}catch(C){this.authService.getUser()&&this.loggingService.catch(`Error in setData for ${e}`,C)}}),t,s,a))}catch(u){this.loggingService.catch(`Error in setData for ${e}`,u)}})}updateData(p){return Q(this,arguments,function*({feature:e,data:t,properties:r,callback:a,errorCallback:s,extraData:d}){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,r,u=>Q(this,null,function*(){if(u.dbRef&&!r?.skipRtdb){let C=this.commonDbUtilsService.formatData({feature:e,data:u.data,properties:r,offset:this.getOffset(),isRealtimeDb:!0});yield M6(u.dbRef,JSON.parse(JSON.stringify(C)))}try{if(u.firestoreRef&&u.data&&!r?.skipFirestore){let C=this.commonDbUtilsService.formatData({feature:e,data:u.data,properties:r,offset:this.getOffset()});typeof C=="object"&&(C=JSON.parse(JSON.stringify(C)));let{strippedData:E,originalData:D,eventType:L}=this.commonDbUtilsService.handleDataStripping({feature:e,data:C,actionType:d?.actionType});if(e==="comment"){let G=null;E&&(G=yield this.commentAnnotationsResolverService.saveCommentAnnotation({commentAnnotation:E,eventType:L,commentId:d?.targetAnnotationData?.commentId})),D&&(G?.isSuccess||G===null)&&(yield this.commonDbUtilsService.handleCommentEncryption({data:D,firestorePath:u.firestorePath??"",extraData:d}))}else if(e==="reaction"){let G=null;E&&(G=yield this.reactionAnnotationsResolverService.saveReactionAnnotation(E)),D&&(G?.isSuccess||G===null)&&(yield this.commonDbUtilsService.handleReactionEncryption({data:D,firestorePath:u.firestorePath??""}))}else yield oz(u.firestoreRef,C,{merge:!0})}}catch(C){this.authService.getUser()&&this.loggingService.catch(`Error in updateDoc for ${e}`,C)}}),t,s,a))}catch(u){this.loggingService.catch(`Error in updateData for ${e}`,u)}})}deleteData(s){return Q(this,arguments,function*({feature:e,properties:t,callback:r,errorCallback:a}){try{return this.loggingService.log(`%c[WB] Calling FUNCTION: deleteData for ${e}`,"color: green;"),this.commonDbUtilsService.setDataInLocal({feature:e,observablesCache:this.observablesCache,eventType:"DELETE",id:t?.id,operation:{type:"removed",ids:[t?.id]}}),this.performDatabaseOperation(e,t,d=>Q(this,null,function*(){d.dbRef&&(yield A6(d.dbRef));try{if(d.firestoreRef&&!t?.skipFirestore)if(e==="comment"){let p=null;p=yield this.commentAnnotationsResolverService.deleteCommentAnnotation(t?.id??""),(p?.isSuccess||p===null)&&(yield this.commonDbUtilsService.handleCommentEncryption({firestorePath:d.firestorePath??"",eventType:"DELETE"}))}else if(e==="reaction"){let p=null;p=yield this.reactionAnnotationsResolverService.deleteReactionAnnotation(t?.id??""),(p?.isSuccess||p===null)&&(yield this.commonDbUtilsService.handleReactionEncryption({firestorePath:d.firestorePath??"",eventType:"DELETE"}))}else yield Xle(d.firestoreRef)}catch(p){this.authService.getUser()&&this.loggingService.catch(`Error in deleteData for ${e}`,p)}}),void 0,a,r)}catch(d){this.loggingService.catch(`Error in deleteData for ${e}`,d)}})}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=vn()),e||"noDocumentId"}catch(e){return this.loggingService.catch("Error in generateFirestoreDocumentId:",e),vn()||"noDocumentId"}}queryData(r){return Q(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 Q(this,null,function*(){try{if(!this.firestore)return this.loggingService.warn("[WB] Firestore not initialized"),[];let r=t?.useCollectionGroup?this.commonDbUtilsService.getFirestoreCollectionGroupPath(e):this.commonDbUtilsService.getFirestorePath({feature:e,properties:t,documentPaths:this.docService.getDocumentPaths(),apiKey:t.apiKey??this.configService.getApiKey()});if(!r)return this.loggingService.warn(`[WB] No firestore path found for ${e}`),[];try{let a=mb(this.firestore,r);t?.useCollectionGroup&&(a=tz(this.firestore,r));let s=t?.firestoreQuery??[],d=iz(a,...s);if(!this.authService.getUser()&&!t?.skipUserCheck)return[];if(t?.getCount){let p=yield Jle(d).catch(u=>(this.authService.getUser()&&this.loggingService.catch(`Error in getCountFromServer for ${e}`,u),null));return p?p.data().count:0}else{let p=yield tce(d).catch(E=>(this.authService.getUser()&&this.loggingService.catch(`Error in getDocs for ${e}`,E),null));if(!p)return[];let u=p.docs.map(E=>E.data());return yield this.commonDbUtilsService.modifyData({feature:e,data:u})}}catch(a){return this.loggingService.catch(`Error in Firestore query for ${e}:`,a),[]}}catch(r){return this.loggingService.catch(`Error in Firestore query for ${e}:`,r),[]}})}handleRtdbQuery(e,t){return Q(this,null,function*(){if(!this.db)return this.loggingService.warn("[WB] Realtime Database not initialized"),[];let r=this.commonDbUtilsService.getDocumentPath({feature:e,properties:t,defaultDocumentPaths:this.docService.getDocumentPaths(),apiKey:t.apiKey??this.configService.getApiKey()});if(!r)return this.loggingService.warn(`[WB] No database path found for ${e}`),[];try{let a=$i(this.db,r),s=t?.rtdbQuery??[],d=DV(a,...s);if(!this.authService.getUser()&&!t?.skipUserCheck)return[];let p=yield xV(d).catch(C=>(this.authService.getUser()&&this.loggingService.catch(`Error in get for ${e}`,C),null));if(!p)return[];let u=p.val();return u?t?.skipObjectValues?u:Object.values(u??{}):[]}catch(a){return this.loggingService.catch(`Error in RTDB query for ${e}:`,a),[]}})}getData(r){return Q(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 s=this.commonDbUtilsService.getFirestorePath({feature:e,properties:t,documentPaths:this.docService.getDocumentPaths(),apiKey:t.apiKey??this.configService.getApiKey()});if(!s)return this.loggingService.warn(`[WB] No firestore path found for ${e}`),{};try{if(!this.authService.getUser())return{};let d=yield ece(t0(this.firestore,s)).catch(u=>(this.authService.getUser()&&this.loggingService.catch(`Error in getDoc for ${e}`,u),null));if(!d)return this.loggingService.warn(`[WB] No document found at ${s}`),{};let p=d.data();return t?.field?p?.[t.field]??{}:p??{}}catch(d){return this.loggingService.catch(`Error fetching Firestore data for ${e}:`,d),{}}}if(this.db){let s=this.commonDbUtilsService.getDocumentPath({feature:e,properties:t,defaultDocumentPaths:this.docService.getDocumentPaths(),apiKey:t.apiKey??this.configService.getApiKey()});if(!s)return this.loggingService.warn(`[WB] No database path found for ${e}`),{};try{if(!this.authService.getUser())return{};let d=yield xV($i(this.db,s)).catch(u=>(this.authService.getUser()&&this.loggingService.catch(`Error in get for ${e}`,u),null));if(!d)return this.loggingService.warn(`[WB] No data found at ${s}`),{};let p=d.val();return t?.field?p?.[t.field]??{}:p??{}}catch(d){return this.loggingService.catch(`Error fetching RTDB data for ${e}:`,d),{}}}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 r=this.shouldUseFirestore();t?.skipFirestore&&(r=!1);let a=`${e}-${JSON.stringify(t)}`;return En([this.databaseService.getDb(),this.firestoreService.getFirestore(),this.authService.getUser$().pipe(Le(s=>!!s))]).pipe(Le(([s,d])=>s?r&&!d?(this.loggingService.warn(`[WB] Firestore requested but not available for ${e}`),!1):!0:(this.loggingService.warn(`[WB] No database found for ${e}`),!1)),he(([s,d])=>{try{if(r&&d){if(!!!this.observablesCache[a]){this.observablesCache[a]={subject:new ve({}),count:0};let C=this.handleFirestoreListener(e,t,d).subscribe(E=>{this.observablesCache[a]?.subject?.next(E)},E=>this.observablesCache[a]?.subject?.error(E));this.firestoreSubscriptions[a]=C}return new Lt(u=>{let C=this.observablesCache[a]?.subject?.subscribe(E=>u.next(E),E=>u.error(E),()=>u.complete());return this.observablesCache[a].count+=1,()=>{C?.unsubscribe(),this.observablesCache[a]&&(this.observablesCache[a].count-=1,this.observablesCache[a].count<=0&&(this.firestoreSubscriptions[a]?.unsubscribe(),delete this.firestoreSubscriptions[a],this.observablesCache[a]?.subject?.complete(),delete this.observablesCache[a]))}})}else if(s){if(!!!this.observablesCache[a]){this.observablesCache[a]={subject:new ve({}),count:0};let C=this.handleRealtimeDbListener(e,t,s).subscribe(E=>{this.observablesCache[a]?.subject?.next(E)},E=>this.observablesCache[a]?.subject?.error(E));this.rtdbSubscriptions[a]=C}return new Lt(u=>{let C=this.observablesCache[a]?.subject?.subscribe(E=>u.next(E),E=>u.error(E),()=>u.complete());return this.observablesCache[a].count+=1,()=>{C?.unsubscribe(),this.observablesCache[a]&&(this.observablesCache[a].count-=1,this.observablesCache[a].count<=0&&(this.rtdbSubscriptions[a]?.unsubscribe(),delete this.rtdbSubscriptions?.[a],this.observablesCache[a]?.subject?.complete(),delete this.observablesCache?.[a]))}})}return se({})}catch(p){return this.loggingService.catch(`Error setting up listener for ${e}:`,p),se({})}}),Hg(()=>{this.loggingService.log(`[WB] Cleaning up listener for ${e} and key ${a}`)}))}handleFirestoreListener(e,t,r){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()}),s=`${e}-${JSON.stringify(t)}`;return a?new Lt(d=>{let p=t.isCollection?this.setupCollectionListener(r,a,e,d,t):this.setupDocumentListener(r,a,e,d,t);return()=>{d.complete(),d.unsubscribe(),p(),this.observablesCache[s]?.subject?.complete(),this.observablesCache[s]?.subject?.unsubscribe(),delete this.observablesCache[s]}}).pipe(he(d=>this.commonDbUtilsService.mergeUsersWithData$({feature:e,data:d})),he(d=>["allComments","allUserNotifications"].includes(e)?this.commonDbUtilsService.mergeCommentAnnotationsWithData$({data:d,feature:e}):se(d)),he(d=>["allReactions"].includes(e)?this.commonDbUtilsService.mergeReactionAnnotationsWithData$({data:d,feature:e}):se(d)),kt(si)):(this.loggingService.warn(`[WB] No firestore path found for ${e} and key ${s}`),se({}))}setupCollectionListener(e,t,r,a,s){let d=`${r}-${JSON.stringify(s)}`,p=mb(e,t);if(s?.useCollectionGroup&&(p=tz(e,t)),s?.useQuery&&s?.firestoreQuery){let E=s?.firestoreQuery??[];p=iz(p,...E)}let u=!0,C=[];return nz(p,E=>{try{let D=JSON.parse(JSON.stringify(this.observablesCache[d]?.subject?.getValue()?.data??{})),L=null,G=!1;E?.docChanges()?.length?E.docChanges().forEach(Y=>{["allComments","allReactions"].includes(r)&&!u&&Y.type!=="removed"&&C.push(Y.doc.id),this.commonDbUtilsService.isDataAlreadyProcessedInLocalCache({feature:r,change:Y,cache:this.observablesCache[d]?.subject?.getValue()?.data??{}})||(G=!0,Object.assign(D,this.handleCollectionChange(Y,D)),Y.type==="removed"&&(L||(L={type:Y.type,ids:[]}),L.ids.push(Y.doc.id)))}):G=!0,G&&(["allComments","allReactions"].includes(r)&&C?.length&&(this.commonDbUtilsService.resolveAnnotations({data:C,feature:r}),C=[]),this.commonDbUtilsService.modifyAndSetData({feature:r,data:D,subscriber:a,operation:L})),u=!1}catch(D){this.handleListenerError(D,r,a)}},E=>this.handleListenerError(E,r,a))}handleCollectionChange(e,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,r,a,s){let d=t0(e,t);return nz(d,p=>{try{let u=p.data()||{};s?.field&&(u=u?.[s?.field]??{}),this.commonDbUtilsService.modifyAndSetData({feature:r,data:u,subscriber:a,operation:null})}catch(u){this.handleListenerError(u,r,a)}},p=>this.handleListenerError(p,r,a))}handleListenerError(e,t,r){this.loggingService.catch(`Firestore listener error for ${t}:`,e),r.error(e)}handleRealtimeDbListener(e,t,r){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}`),se({});let s=$i(r,a);if(t?.useQuery&&t?.rtdbQuery){let d=t?.rtdbQuery??[];s=DV(s,...d)}return this.objectValFromChildEvents(s,e).pipe(Hn(d=>(this.loggingService.catch(`RTDB listener error for ${e}:`,d),se({}))),de(d=>(d===null&&(d={}),d&&typeof d=="object"?Object.entries(d??{}).reduce((u,[C,E])=>(u[C]=this.commonDbUtilsService.addMetadata(E,t),u),{}):this.commonDbUtilsService.addMetadata(d,t))),he(d=>this.commonDbUtilsService.modifyData({feature:e,data:d})),he(d=>this.usersService.getUserById$().pipe(de(()=>({data:this.commonDbUtilsService.mergeUsersWithData({feature:e,data:d}),operation:null})))))}objectValFromChildEvents(e,t){return new Lt(r=>{let a={},s=!1,d=null,p=Y=>{try{this.loggingService.catch(`Realtime DB listener error for ${t}:`,Y),r.error(Y)}catch{}},u=Y=>{try{if(!zi(Y,d)){let ne=JSON.parse(JSON.stringify(Y));d=ne,r.next(ne)}}catch{}},C=Y=>{try{Y.key&&(a[Y.key]=Y.val(),s&&u(I({},a)))}catch{}},E=Y=>{try{Y.key&&(a[Y.key]=Y.val(),s&&u(I({},a)))}catch{}},D=Y=>{try{Y.key&&(delete a[Y.key],s&&u(I({},a)))}catch{}},L=Y=>{try{if(!s){let ne=a&&typeof a=="object"?JSON.parse(JSON.stringify(a)):{};d=ne,r.next(ne),s=!0}}catch{}};Sne(e,C,p),bne(e,E,p),Ine(e,D,p);let G=Ap(e,L,p,{onlyOnce:!0});return()=>{try{G&&typeof G=="function"&&G(),O6(e,"child_added",C),O6(e,"child_changed",E),O6(e,"child_removed",D)}catch{}}})}};o.\u0275fac=function(t){return new(t||o)(J(je),J(tg),J(y),J(kce),J(_n),J(Vt),J(at),J(Yn),J(ws),J(Ld))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var bi=(()=>{let o=class o{constructor(e,t,r,a,s,d,p,u){this.analyticsService=e,this.authService=t,this.configService=r,this.databaseService=a,this.docService=s,this.loggingService=d,this.commonDbService=p,this.usersService=u,this.db=Za(),this.internalUserContacts$=new ve([]),this.userGlobalContact$=new ve(!1),this.userGroupContact$=new ve(null),this.users$=new ve([]),this.userPersonalContacts=[],this.userGroupContacts=[],this.userGlobalContacts=[],this.users=[],this.documentPaths=null,this.userOrganizationContacts$=new ve([]),this.userFolderContacts$=new ve([]),this.userDocumentContacts$=new ve([]),this.userOrganizationGroups$=new ve([]),this.onContactSelectedSubject$=new et,this.documentAccessType=null,this.atHereEnabled$=new ve(!1),this.atHereLabel$=new ve("here"),this.atHereDescription$=new ve(null),this.contactListScopeForOrganizationUsers$=new ve([Li.ALL]),this.customUserContacts$=new ve(null),this.customUserContactsConfig$=new ve({merge:!1}),this.currentOrganizationUserIAM$=new ve(null),this.userContacts$=new ve([]),this.userSnippylyIdContacts$=new ve(null),this.usersByOrganizationId$=new ve({}),this.temporaryUserIds$=new ve([]),this.usersByOrganizationIdAndDocumentId$=new ve({}),this.usersByOrganizationIdAndFolderId$=new ve({}),this.userById$=new ve({}),this.authService.setContactService(this),this.authService.getUser$().pipe(he(C=>this.docService.getDocumentPaths$().pipe(gn(E=>{this.documentPaths=E}),de(()=>C)))).subscribe(C=>Q(this,null,function*(){this.user=C,C&&this.documentPaths?C?.organizationId?(this.getOrganizationContactsFromDb$(),this.getFolderContactsFromDb$(),this.getDocumentContactsFromDb$(),this.getOrganizationGroupsFromDb$(),this.getTemporaryUsers()):(this.getLoggedInUsers$().subscribe(),this.getUserContactsFromDb$(),yield this.migrateLoggedInUserFromEmailToUserIdPath(C),this.setLoggedInUser(C),yield this.moveGlobalContactUserFromEmailToUserIdPath(C),this.updateUserInGlobalContactsIfAvailable(C),C?.groupId&&(yield this.migrateGroupContactsFromEmailToUserIdPath(C?.groupId)),this.checkToSetLoggedInUserInGroupContacts()):(this.getUserContactSubscription?.unsubscribe(),this.getUserContactSubscription=void 0,this.getLoggedInUsersSubscription?.unsubscribe(),this.getLoggedInUsersSubscription=void 0,this.getOrganizationContactsSubscription?.unsubscribe(),this.getOrganizationContactsSubscription=void 0,this.getFolderContactsSubscription?.unsubscribe(),this.getFolderContactsSubscription=void 0,this.getDocumentContactsSubscription?.unsubscribe(),this.getDocumentContactsSubscription=void 0,this.getOrganizationGroupsSubscription?.unsubscribe(),this.getOrganizationGroupsSubscription=void 0)}),C=>{this.loggingService.catch("Error in ContactService constructor getUser$: ",C)}),this.databaseService.getDb().pipe(Le(C=>!!C),rt(1)).subscribe(C=>{C&&(this.db=C)},C=>{this.loggingService.catch("Error in ContactService constructor getDb: ",C)}),this.getOrganizationGroups$().subscribe(C=>{this.authService.setOrganizationUserGroups(C)}),En([this.getInternalUserContacts$(),this.getCustomUserContacts$(),this.getCustomUserContactsConfig$()]).subscribe(([C,E,D])=>{E?D?.merge?this.userContacts$.next([...C||[],...E||[]]):this.userContacts$.next(E||[]):this.userContacts$.next(C||[])}),this.getUserContacts$().subscribe(C=>{try{C?.forEach(E=>{let D=E?.userSnippylyId||Ev(this.configService.getApiKey(),E.userId);D&&this.userSnippylyIdContacts$.next(T(I({},this.userSnippylyIdContacts$.value),{[D]:E}))})}catch{}})}clearCache(){this.loggingService.log("%c[WB] Calling FUNCTION: clearCache in ContactService","color: green;");try{this.documentPaths=null,this.usersByOrganizationId$.next({}),this.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=[]}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 Q(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:_t(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:_t(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:_t(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(T(I({},e),{contacts:void 0})))}),this.setLoggedInUserPrivateContacts(e,e?.contacts))}catch(t){this.loggingService.catch("Error in ContactService setLoggedInUser: ",t)}}migrateLoggedInUserFromEmailToUserIdPath(e){return Q(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:_t(e?.email),skipFirestore:!0}});if(Object.keys(t??{}).length>0){let r=t;if(r){if(r?.contacts){let a={};Object.keys(r?.contacts??{})?.forEach(s=>{let d=r.contacts[s];if(d?.userId){let p=_t(d?.userId);a[p]=d}}),r.contacts=a}yield this.commonDbService.updateData({feature:"logins",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:_t(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(r))}),yield this.commonDbService.deleteData({feature:"logins",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:_t(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:_t(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(e))})}catch(t){this.loggingService.catch("Error in ContactService addGlobalContact: ",t)}}updateUserInGlobalContactsIfAvailable(e){return Q(this,null,function*(){try{if(e?.userId&&this.documentPaths?.globalContacts&&(yield this.checkIfUserGlobalContact(e))){let r=new Do;r.userId=e?.userId,r.userSnippylyId=e?.userSnippylyId,r.email=e?.email,r.name=e?.name,r.photoUrl=e?.photoUrl,this.commonDbService.updateData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:_t(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(r))})}}catch(t){this.loggingService.catch("Error in ContactService updateUserInGlobalContactsIfAvailable: ",t)}})}moveGlobalContactUserFromEmailToUserIdPath(e){return Q(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:_t(e?.email),skipFirestore:!0}});if(Object.keys(t??{}).length>0){let r=t;r&&(yield this.commonDbService.updateData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:_t(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(r))}),yield this.commonDbService.deleteData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:_t(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 r,a=t?.filter(d=>d?.visibility!=="group"),s=!1;this.authService.getUserOptions()&&(s=!!this.authService.getUserOptions()?.replaceContacts||!!this.authService.getUserOptions()?.replacePrivateContacts),a?.length?(r={},a?.forEach(d=>{if(d?.userId){let p=_t(d?.userId);r[p]=d}}),s?this.commonDbService.setData({feature:"allLoginContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:_t(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(r))}):this.commonDbService.updateData({feature:"allLoginContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:_t(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(r))})):s&&this.commonDbService.deleteData({feature:"allLoginContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:_t(e?.userId),skipFirestore:!0}})}}catch(r){this.loggingService.catch("Error in ContactService setLoggedInUserPrivateContacts: ",r)}}migrateGroupContactsFromEmailToUserIdPath(e){return Q(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(r=>Q(this,null,function*(){let a=t[r];a?.email&&a?.userId&&_t(a?.email)===r&&(yield this.commonDbService.deleteData({feature:"groupContactsUser",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",groupId:e,userId:r,skipFirestore:!0}}),yield this.commonDbService.updateData({feature:"groupContactsUser",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",groupId:e,userId:_t(a?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(a))}))}))}}catch(t){this.loggingService.catch("Error in ContactService migrateGroupContacts: ",t)}})}checkToSetLoggedInUserInGroupContacts(){return Q(this,null,function*(){try{this.user?.groupId&&this.user?.userId&&((yield this.checkIfUserGlobalContact(this.user))||this.docService.getDocumentIam$().pipe(rt(1)).subscribe(t=>Q(this,null,function*(){if(this.user?.groupId&&this.user?.userId){let r=!1,a=this.docService.getDocumentAccessType(t);if(!a||a===Ci.PUBLIC)r=!0;else if(a===Ci.RESTRICTED){let s=_t(this.user?.userId);if(t?.users?.[s]&&(r=!0),this.user?.email){let d=_t(this.user?.email);t?.users?.[d]&&(r=!0)}}if(r){let s=new Qp;s.email=this.user.email,s.visibility="group",s.name=this.user.name,s.photoUrl=this.user.photoUrl,s.userId=this.user.userId,(this.authService.getUserOptions()?.replaceContacts||this.authService.getUserOptions()?.replaceGroupContacts)&&(yield this.removeGroupContacts(this.user?.groupId)),this.setLoggedInUserGroupContacts(this.user?.groupId,[s]),this.user?.contacts&&this.user?.groupId&&this.setLoggedInUserGroupContacts(this.user?.groupId,this.user?.contacts)}}})))}catch(e){this.loggingService.catch("Error in ContactService checkToSetLoggedInUserInGroupContacts: ",e)}})}setLoggedInUserGroupContacts(e,t){try{let r=t?.filter(a=>a?.visibility==="group");r?.length&&r.forEach(a=>Q(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:_t(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:_t(a?.email),skipFirestore:!0}}))}}))}catch(r){this.loggingService.catch("Error in ContactService setLoggedInUserGroupContacts: ",r)}}removeGroupContacts(e){return Q(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(r=>{r?.userId?(!r?.email||!t[r.email])&&(t[r.userId]=r):r?.email&&(!r?.userId||!t[r.userId])&&(t[r.email]=r)}),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:r,veltFolderId:a}=e||{};return t&&r?En([this.usersByOrganizationId$,this.usersByOrganizationIdAndFolderId$,this.usersByOrganizationIdAndDocumentId$,this.userById$,this.customUserContacts$,this.customUserContactsConfig$,this.getContactListScopeForOrganizationUsers$(),this.temporaryUserIds$]).pipe(de(([s,d,p,u,C,E,D,L])=>{let G={},Y=!1;E&&!E?.merge&&(Y=!0);let ne=Be=>D.some(we=>Be.includes(we)),ge=ne([Li.ALL,Li.ORGANIZATION])?Object.keys(s?.[t]||{}):[],ye=a?ne([Li.ALL,Li.FOLDER])?Object.keys(d?.[t]?.[a]||{}):[]:[],Re=ne([Li.ALL,Li.DOCUMENT])?Object.keys(p?.[t]?.[r]||{}):[];if([...ge,...ye||[],...Re,...L].forEach(Be=>{let we=u?.[Be];we&&(G[Be]=we)}),C){let{merge:Be,options:we}=E||{},{organizationId:Se,documentId:Oe,folderId:_e}=we||{},fe=_e?zo(_e):void 0;(!Se||Se===t)&&(!Oe||Oe===r)&&(!fe||fe===a)&&(Be||(G={}),C.forEach(Ae=>{Ae?.userId&&(G[Ae.userId]=Ae)}))}return Object.values(G??{})})):this.userContacts$.asObservable().pipe(de(s=>s))}catch(t){return this.loggingService.catch("Error in ContactService getUserContacts$ metadata: ",t),se([])}}getUserContactsBySnippylyId$(){return this.userSnippylyIdContacts$.asObservable()}getAtHereLabel(){return this.atHereLabel$.asObservable()}getAtHereDescription(){return this.atHereDescription$.asObservable()}getUserContactsFromDb$(){this.getUserContactSubscription||(this.getUserContactSubscription=this.authService.getUser$().pipe(Le(e=>!!e),he(e=>this.docService.getDocumentPaths$().pipe(Le(t=>!!t),gn(t=>{this.documentPaths=t}),de(()=>e))),he(e=>{if(this.userGroupContacts=[],this.userPersonalContacts=[],!e)return se();if(!this.documentPaths)return se();let t=[];return t.push(this.commonDbService.dbListener({feature:"allGlobalContacts",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}}).pipe(de(r=>r?.data),gn(r=>{r?(this.userGlobalContacts=Object.values(r??{}),this.userGlobalContacts?.find(a=>a.userId===this.user?.userId)?this.userGlobalContact$.next(!0):this.userGlobalContact$.next(!1)):(this.userGlobalContacts=[],this.userGlobalContact$.next(!1))}))),t.push(this.commonDbService.dbListener({feature:"groupContacts",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0,groupId:e?.groupId}}).pipe(de(r=>r?.data),gn(r=>{r?(this.userGroupContacts=Object.values(r??{}),this.userGroupContacts?.find(a=>a?.userId===this.user?.userId)?this.userGroupContact$.next(!0):this.userGroupContact$.next(!1)):(this.userGroupContacts=[],this.userGroupContact$.next(!1))}))),t.push(this.commonDbService.dbListener({feature:"allLoginContacts",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0,userId:_t(e?.userId)}}).pipe(de(r=>r?.data),gn(r=>{r?this.userPersonalContacts=Object.values(r??{}):this.userPersonalContacts=[]}))),ao(...t).pipe(so(this.authService.getUser$().pipe(Le(r=>!r))))})).subscribe(()=>{this.mergeUserContacts()},e=>{this.loggingService.catch("Error in ContactService getUserContacts$ subscription: ",e)}))}addUserContact(e){try{this.user?.organizationId||this.user?.groupId&&(e.visibility="group",this.setLoggedInUserGroupContacts(this.user?.groupId,[e]))}catch(t){this.loggingService.catch("Error in ContactService addUserContact: ",t)}}isUserGlobalContact$(){return this.userGlobalContact$.asObservable()}isUserGlobalContact(){return this.userGlobalContact$.value}isUserGroupContact$(){return this.userGroupContact$.asObservable()}isUserGroupContact(){return this.userGroupContact$.value}getLoggedInUsers$(){return this.getLoggedInUsersSubscription||(this.getLoggedInUsersSubscription=this.authService.getUser$().pipe(he(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(de(t=>t?.data),gn(t=>{t?this.users=Object.values(t??{}):this.users=[]})):(this.users=[],se()):se():se())).subscribe(()=>{this.users$.next(this.users)},e=>{this.loggingService.catch("Error in ContactService getLoggedInUsers$ subscription: ",e)})),this.users$.asObservable()}getUsersMap$(){return this.authService.getUser$().pipe(he(e=>e?.organizationId?this.userById$.pipe(de(t=>{let r={};return Object.values(t||{}).forEach(a=>{a?.userSnippylyId&&(r[a?.userSnippylyId]=a)}),r})):this.users$.pipe(de(t=>{let r={};return t.forEach(a=>{r[a.userSnippylyId]=a}),r}))))}getUserByEmail$(e){return this.users$.pipe(de(t=>t.find(r=>r.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(de(t=>t.find(r=>r.userId===e)))}getUserGroupContacts(){return this.userGroupContacts}getTemporaryUsers(){try{let e=this.authService.getUser();this.docService.getOrganizationConfig$().pipe(Le(t=>!!t),de(t=>t?.organizationId)).subscribe(t=>Q(this,null,function*(){if(t&&e){let r=((yield this.commonDbService?.queryData({feature:"allPermissionsUsers",properties:{organizationId:t,useCollectionGroup:!1,isCollection:!0,firestoreQuery:[ut("expiresAt",">",new Date().getTime())]}}))??[]).filter(a=>a?.userId!==e?.userId);if(r?.length){let a=yield this.usersService.resolveUsers({userIds:r.map(s=>s?.userId)});if(a){let s={};Object.entries(a).forEach(([p,u])=>{s[p]=u}),this.userById$.next(I(I({},this.userById$.value),s));let d=new Set([...this.temporaryUserIds$.value,...Object.keys(s)]);this.temporaryUserIds$.next(Array.from(d))}}}}))}catch(e){this.loggingService.catch("Error in ContactService getTemporaryUsers: ",e)}}getOrganizationContactsFromDb$(){try{this.getOrganizationContactsSubscription||(this.getOrganizationContactsSubscription=this.authService.getUser$().pipe(he(e=>e?.organizationId?se(e).pipe(he(t=>this.docService.getOrganizationConfig$().pipe(Le(r=>!!r),de(()=>t))),he(t=>this.usersService.getResolveOrganizationUsers$().pipe(Le(r=>r),de(()=>t))),he(t=>{let r=this.docService.getOrganizationConfig()?.organizationId;return this.setUserOrganizationContacts([],r),t?r?this.commonDbService.dbListener({feature:"allOrganizationUsers",properties:{organizationId:r,isCollection:!0,useQuery:!0,firestoreQuery:[Bi(ut("organizationIds","array-contains-any",[r])),jr("id")]}}).pipe(de(a=>a?.data),de(a=>{if(a){typeof a=="object"&&(a?.undefined&&delete a.undefined,a?.null&&delete a.null);let s=Object.values(a??{});this.setUserOrganizationContacts(s,r)}else this.setUserOrganizationContacts([],r)})):se():se()}),he(()=>this.getContactListScopeForOrganizationUsers$())):(this.setUserOrganizationContacts([]),se()))).subscribe(()=>{this.mergeOrganizationAndDocumentContacts()},e=>{this.loggingService.catch("Error in ContactService getOrganizationContactsFromDb$ subscription: ",e)}))}catch{}}getFolderContactsFromDb$(){try{this.getFolderContactsSubscription||(this.getFolderContactsSubscription=this.authService.getUser$().pipe(he(e=>e?se(e).pipe(he(t=>this.docService.getOrganizationConfig$().pipe(Le(r=>!!r),de(()=>t))),he(t=>this.usersService.getResolveFolderUsers$().pipe(Le(r=>r),de(()=>t))),he(t=>{let r=this.docService.getOrganizationConfig()?.organizationId;if(this.setUserFolderContacts([]),!t)return se();if(!this.commonDbService.shouldUseFirestore())return se();if(!this.documentPaths?.veltFolderId)return se();let a=se([]);return a=this.commonDbService.dbListener({feature:"allFolderUsers",properties:{organizationId:r,folderId:this.documentPaths?.veltFolderId,isCollection:!0,useQuery:!0,firestoreQuery:[Bi(ut("folderIds","array-contains-any",[this.documentPaths?.veltFolderId])),jr("id")]}}).pipe(de(s=>s?.data)),a.pipe(de(s=>{if(s){typeof s=="object"&&(s?.undefined&&delete s.undefined,s?.null&&delete s.null);let d=Object.values(s??{});this.setUserFolderContacts(d)}else this.setUserFolderContacts([])}))}),he(()=>this.getContactListScopeForOrganizationUsers$())):(this.setUserFolderContacts([]),se()))).subscribe(()=>{this.mergeOrganizationAndDocumentContacts()},e=>{this.loggingService.catch("Error in ContactService getFolderContactsFromDb$ subscription: ",e)}))}catch{}}getDocumentContactsFromDb$(){try{this.getDocumentContactsSubscription||(this.getDocumentContactsSubscription=this.authService.getUser$().pipe(he(e=>e?se(e).pipe(he(t=>this.docService.getDocumentPaths$().pipe(Le(r=>!!r),gn(r=>{this.documentPaths=r}),de(()=>t))),he(t=>this.usersService.getResolveDocumentUsers$().pipe(Le(r=>r),de(()=>t))),he(t=>(this.setUserDocumentContacts([]),t?this.documentPaths?this.docService.getDocumentIds$().pipe(he(r=>{let a=r?.length>0?r.map(u=>u.documentId):[this.documentPaths?.documentId??""];if(a.some(u=>!u)||!this.documentPaths)return se();let s=se([]),d={isCollection:!0,useQuery:!0};this.commonDbService.shouldUseFirestore()||(d.documentId=a?.length?a[0]:void 0,d.organizationId=this.documentPaths?.organizationId);let p=[];for(let u=0;u<a.length;u+=j.LISTENER_BATCH_SIZE)p.push(a.slice(u,u+j.LISTENER_BATCH_SIZE));return s=En(p.map(u=>this.commonDbService.dbListener({feature:"allDocumentUsers",properties:T(I({},d),{firestoreQuery:[Bi(ut("documentIds","array-contains-any",u)),jr("id")]})}).pipe(Wr()))).pipe(de(u=>va(u)?.data)),s.pipe(de(u=>{if(u){typeof u=="object"&&(u?.undefined&&delete u.undefined,u?.null&&delete u.null);let C=Object.values(u??{});this.setUserDocumentContacts(C)}else this.setUserDocumentContacts([])}))})):se():se())),he(()=>this.getContactListScopeForOrganizationUsers$())):(this.setUserDocumentContacts([]),se()))).subscribe(()=>{this.mergeOrganizationAndDocumentContacts()},e=>{this.loggingService.catch("Error in ContactService getDocumentContactsFromDb$ subscription: ",e)}))}catch{}}setUserOrganizationContacts(e,t){try{let r=e.find(s=>s.user.userId===this.user?.userId);r?this.currentOrganizationUserIAM$.next(r):this.currentOrganizationUserIAM$.next(null);let a=e.map(s=>s.user);if(this.userOrganizationContacts$.next(a),this.usersService.setUserByIds(a),t){let s={};s[t]={};let d={};e.forEach(p=>{s[t][p.user.userId]=p,d[p.user.userId]=p.user}),this.userById$.next(I(I({},this.userById$.value),d)),this.usersByOrganizationId$.next(T(I({},this.usersByOrganizationId$.value),{[t]:s[t]}))}else this.usersByOrganizationId$.next({})}catch(r){this.loggingService.catch("Error in ContactService setUserOrganizationContacts: ",r)}}getUserOrganizationContacts$(){return this.getContactListScopeForOrganizationUsers$().pipe(he(()=>this.checkContactListScopeForOrganizationUsers([Li.ALL,Li.ORGANIZATION])?this.userOrganizationContacts$.asObservable():se([])))}getUserOrganizationContacts(){return this.checkContactListScopeForOrganizationUsers([Li.ALL,Li.ORGANIZATION])?this.userOrganizationContacts$.value:[]}setUserFolderContacts(e){try{let t=e?.map(s=>s?.user);this.userFolderContacts$.next(t),this.usersService.setUserByIds(t);let r={},a={};e?.forEach(s=>{let{organizationId:d}=s?.metadata||{};d&&(r[d]||(r[d]={}),s.folderIds?.forEach(p=>{r[d][p]||(r[d][p]={}),r[d][p][s.user.userId]=s,a[s.user.userId]=s.user}))}),this.userById$.next(I(I({},this.userById$.value),a)),this.usersByOrganizationIdAndFolderId$.next(r)}catch(t){this.loggingService.catch("Error in ContactService updateUserFolderContacts: ",t)}}getUserFolderContacts$(){return this.getContactListScopeForOrganizationUsers$().pipe(he(()=>this.checkContactListScopeForOrganizationUsers([Li.ALL,Li.FOLDER])?this.userFolderContacts$.asObservable():se([])))}getUserFolderContacts(){return this.checkContactListScopeForOrganizationUsers([Li.ALL,Li.FOLDER])?this.userFolderContacts$.value:[]}setUserDocumentContacts(e){try{let t=e?.map(s=>s?.user);this.userDocumentContacts$.next(t),this.usersService.setUserByIds(t);let r={},a={};e?.forEach(s=>{let{organizationId:d}=s?.metadata||{};d&&(r[d]||(r[d]={}),s.documentIds?.forEach(p=>{r[d][p]||(r[d][p]={}),r[d][p][s.user.userId]=s,a[s.user.userId]=s.user}))}),this.userById$.next(I(I({},this.userById$.value),a)),this.usersByOrganizationIdAndDocumentId$.next(r)}catch(t){this.loggingService.catch("Error in ContactService updateUserDocumentContacts: ",t)}}getUserDocumentContacts$(){return this.getContactListScopeForOrganizationUsers$().pipe(he(()=>this.checkContactListScopeForOrganizationUsers([Li.ALL,Li.DOCUMENT])?this.userDocumentContacts$.asObservable():se([])))}getUserDocumentContacts(){return this.checkContactListScopeForOrganizationUsers([Li.ALL,Li.DOCUMENT])?this.userDocumentContacts$.value:[]}getCurrentOrganizationUserIAM$(){return this.currentOrganizationUserIAM$.asObservable()}getCurrentOrganizationUserIAM(){return this.currentOrganizationUserIAM$.value}mergeOrganizationAndDocumentContacts(){try{let e=[];this.getContactListScopeForOrganizationUsers().includes(Li.ALL)?e=[...this.getUserOrganizationContacts(),...this.getUserFolderContacts(),...this.getUserDocumentContacts()]:this.getContactListScopeForOrganizationUsers().includes(Li.ORGANIZATION)?e=[...this.getUserOrganizationContacts()]:this.getContactListScopeForOrganizationUsers().includes(Li.FOLDER)?e=[...this.getUserFolderContacts()]:this.getContactListScopeForOrganizationUsers().includes(Li.DOCUMENT)&&(e=[...this.getUserDocumentContacts()]);let t=[...new Map(e.filter(r=>r?.userId).map(r=>[r.userId,r])).values()];this.internalUserContacts$.next(t)}catch(e){this.loggingService.catch("Error in ContactService mergeOrganizationAndDocumentContacts: ",e)}}getOrganizationGroupsFromDb$(){try{this.getOrganizationGroupsSubscription||(this.getOrganizationGroupsSubscription=this.authService.getUser$().pipe(he(e=>e?.organizationId?se(e).pipe(he(t=>this.docService.getOrganizationConfig$().pipe(Le(r=>!!r),de(()=>t))),he(t=>{if(this.setUserOrganizationGroups([]),!t)return se();let r=this.docService.getOrganizationConfig()?.organizationId;return r?this.commonDbService.dbListener({feature:"allOrganizationGroups",properties:{organizationId:r,isCollection:!0}}).pipe(de(a=>a?.data),de(a=>{a?(typeof a=="object"&&(a?.undefined&&delete a.undefined,a?.null&&delete a.null),this.setUserOrganizationGroups(Object.values(a??{}))):this.setUserOrganizationGroups([])})):se()})):(this.setUserOrganizationGroups([]),se()))).subscribe(()=>{},e=>{this.loggingService.catch("Error in ContactService getOrganizationGroupsFromDb$ subscription: ",e)}))}catch{}}setUserOrganizationGroups(e){try{this.userOrganizationGroups$.next(e)}catch(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),r=!!this.getUserOrganizationContacts().find(a=>a.userId===e.userId);switch(this.documentAccessType){case Ci.RESTRICTED:if(!t){let a={contact:e,isOrganizationContact:r,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(he(()=>this.checkContactListScopeForOrganizationUsers([Li.ALL,Li.ORGANIZATION_USER_GROUP])?this.userOrganizationGroups$.asObservable():se([])))}enableAtHere(){try{if(this.analyticsService.setFeatureConfig({feature:Ne.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:Ne.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:Ne.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:Ne.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(he(()=>this.checkContactListScopeForOrganizationUsers([Li.ALL,Li.DOCUMENT])?this.atHereEnabled$.asObservable():se(!1)))}getAtHereEnabled(){return this.checkContactListScopeForOrganizationUsers([Li.ALL,Li.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 Q(this,null,function*(){try{if(this.analyticsService.trackEvent(X.Events.Contact.UPDATE_CONTACT_LIST_TRIGGERED,{contactsCount:e?.length,config:t}),this.usersService?.userDataProviderAvailable()){let r=e.map(s=>s?.userId).filter(s=>s);yield this.usersService.resolveUsers({userIds:r});let a=r.map(s=>this.usersService.getUserById(s)).filter(s=>!!s);this.customUserContacts$.next(a)}else this.customUserContacts$.next(e);this.customUserContactsConfig$.next(t)}catch(r){this.loggingService.catch("Error in CommentService updateContactList: ",r)}})}convert(e){try{if(e?.options){let{documentId:t,organizationId:r}=this.docService.getServerId(e?.options);e.options=T(I({},e?.options),{documentId:t,organizationId:r})}return this}catch(t){return this.loggingService.catch("Error in ContactService convert: ",t),this}}getContactList$(){try{return this.authService.getUser$().pipe(he(e=>e?En([this.userOrganizationContacts$.asObservable(),this.userFolderContacts$.asObservable(),this.userDocumentContacts$.asObservable(),this.userOrganizationGroups$.asObservable(),this.customUserContacts$.asObservable()]).pipe(de(([t,r,a,s,d])=>{let p={};p.organizationUsers=t?.map(C=>this.convertToClientUser(C)),p.folderUsers=r?.map(C=>this.convertToClientUser(C)),p.documentUsers=a?.map(C=>this.convertToClientUser(C)),p.updatedContactList=d?.map(C=>this.convertToClientUser(C));let u=[];return s?.forEach(C=>{let E=this.convertToClientUserGroup(C,p.organizationUsers||[]);E&&u.push(E)}),p.userGroups=u,p}),kt(si)):se(null)),Hn(e=>(this.loggingService.catch("Error in ContactService getContactList$: ",e),se(null))))}catch(e){return this.loggingService.catch("Error in ContactService getContactList$: ",e),se(null)}}convertToClientUserGroup(e,t){try{let r={groupId:e?.metadata?.clientGroupId,groupName:e?.metadata?.groupName,users:[]},a={};return t?.forEach(s=>{if(s?.userId){let d=_t(s.userId);a[d]=s}}),Object.keys(e?.users??{}).forEach(s=>{a[s]&&r.users?.push(a[s])}),r}catch(r){return this.loggingService.catch("Error in ContactService convertToClientUserGroup: ",r),null}}convertToClientUser(e){try{return e&&(e=JSON.parse(JSON.stringify(e)),e?.clientGroupId&&(e.groupId=e.clientGroupId,delete e.clientGroupId),e?.clientOrganizationId&&(e.organizationId=e.clientOrganizationId,delete e.clientOrganizationId),e?.userSnippylyId&&delete e.userSnippylyId),e}catch(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()}};o.\u0275fac=function(t){return new(t||o)(J(tt),J(je),J(Vt),J(_n),J(at),J(y),J(yn),J(Yn))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Rce=i=>{try{return i.name.split(".").slice(0,-1).join(".")}catch(o){mt.catch("Error in File utils getFileName: ",o);return}},fz=i=>{try{return/(?:\.([^.]+))?$/.exec(i?.name)[1]}catch(o){mt.catch("Error in File utils getFileExtension: ",o);return}},Nce=(i,o)=>{try{let n=i.slice(0,-1,i.type);return new File([n],o+"."+fz(i),{type:i.type})}catch(n){mt.catch("Error in File utils updateFile: ",n);return}},Fce=i=>new Promise((o,n)=>{let e=new FileReader;e.readAsDataURL(i),e.onload=()=>{o(e.result)},e.onerror=t=>{n(t)}}),Lce={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 ng=(()=>{let o=class o{constructor(e,t,r,a){this.authService=e,this.configService=t,this.loggingService=r,this.attachmentResolverService=a,this.storage=nS();try{this.configService.getApiKey$().subscribe(s=>{this.apiKey=s}),this.authService.getFirebaseConfig$().subscribe(s=>{s&&s.firebaseOptions?.storageBucket&&(this.storage=nS(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 r=new i0;r.name=t.name;let a=Nce(t,`${r.attachmentId}_${Rce(t)}`),s=`${this.apiKey}/${e}/${a?.name}`;return r.bucketPath=s,r.size=t.size,r.type=fz(t),r?.type&&(r.mimeType=Lce[r?.type]),r}catch(r){return this.loggingService.catch("Error in StorageService createAttachment: ",r),null}}uploadAttachmentToStorage({attachment:e,file:t,resolve:r,reject:a}){try{let s=iS(this.storage,e.bucketPath),d=JV(s,t,{cacheControl:"public,max-age=3600"});d.on("state_changed",p=>{let u=p.bytesTransferred/p.totalBytes*100},p=>{a(p)},()=>{QV(d.snapshot.ref).then(p=>{e.url=p,r(e)})})}catch(s){this.loggingService.catch("Error in StorageService uploadAttachmentToStorage: ",s),a(s)}}uploadToResolver(d){return Q(this,arguments,function*({file:e,attachment:t,metadata:r,resolve:a,reject:s}){try{r.attachmentId=t.attachmentId;let p={attachmentId:t.attachmentId,name:t.name,file:e,metadata:r,mimeType:t.mimeType},u=yield this.attachmentResolverService.saveAttachment({attachment:p,eventType:Ja.ATTACHMENT_ADD});u&&u.data?.url?(t.url=u.data?.url,a(t)):s(new Error("Failed to upload attachment to resolver"))}catch(p){this.loggingService.catch("Error in StorageService uploadToResolver: ",p),s(p)}})}uploadFile({path:e,file:t,useAttachmentResolver:r,metadata:a}){return new Promise((s,d)=>{try{if(!this.apiKey)throw new Error("API key not configured");let p=this.createAttachment({path:e,file:t});if(!p)throw new Error("Attachment not created");r?this.uploadToResolver({file:t,attachment:p,metadata:a,resolve:s,reject:d}):this.uploadAttachmentToStorage({attachment:p,file:t,resolve:s,reject:d})}catch(p){this.loggingService.catch("Error in StorageService uploadFile:",p),d(p)}})}uploadChunk(e,t,r){return new Promise((a,s)=>{try{if(this.apiKey){let d=`${this.apiKey}/${e}/${t.name}`,p=iS(this.storage,d),u=JV(p,t,{cacheControl:"public,max-age=3600"});u.on("state_changed",C=>{let E=C.bytesTransferred/C.totalBytes*100},C=>{s(C)},()=>{QV(u.snapshot.ref).then(C=>{a(C)}).catch(C=>{this.loggingService.catch(`[uploadChunk] Error getting download URL for chunk ${r}:`,C),s(C)})})}else{let d=new Error("API key not available");this.loggingService.catch("[uploadChunk] API key not available",d),s(d)}}catch(d){this.loggingService.catch(`[uploadChunk] Error in StorageService uploadChunk for chunk ${r}: `,d),s(d)}})}downloadAttachment(e){try{if(e.url){let t=new XMLHttpRequest;t.responseType="blob",t.onload=()=>{let r=t.response,a=document.createElement("a"),s=window.URL.createObjectURL(r);a.setAttribute("type","hidden"),a.setAttribute(j.ATTRIBUTES.VELT_DOWNLOAD_BUTTON,"true"),a.classList.add("snippyly-overlay-panel"),a.href=s,e?.name&&(a.download=e?.name),document.body.appendChild(a);let d=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!1});a.dispatchEvent(d),window.URL.revokeObjectURL(s),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:r}){return new Promise((a,s)=>{if(r)this.attachmentResolverService.deleteAttachment({attachmentId:e.attachmentId,metadata:t}).then(()=>{a(null)}).catch(d=>{s(d)});else{let d=iS(this.storage,e.bucketPath);XV(d).then(()=>{a(null)}).catch(p=>{a(null)})}})}deleteFileFromPath(e){return new Promise((t,r)=>{let a=iS(this.storage,e);XV(a).then(()=>{t(null)}).catch(s=>{r(s)})})}};o.\u0275fac=function(t){return new(t||o)(J(je),J(Vt),J(y),J(eg))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Sn=(()=>{let o=class o{constructor(e,t,r,a,s,d,p,u){this.analyticsService=e,this.authService=t,this.contactService=r,this.databaseService=a,this.docService=s,this.configService=d,this.loggingService=p,this.commonDbService=u,this.documentIAM$=new ve(null),this.workspaceIAM$=new ve(null),this.roles$=new ve([]),this.getDocumentIamSubscription=null,this.getOrganizationIamSubscription=null,this.getWorkspaceIamSubscription=null;try{this.authService.setIamService(this),this.databaseService.getDb().pipe(Le(C=>!!C),rt(1)).subscribe(C=>{C&&(this.getUser(),this.getDocumentPaths())},C=>{this.loggingService.catch("Error in CommentService getDb subscription: ",C)}),this.getRole$().pipe(rt(1)).subscribe(C=>{this.authService?.getUser()&&!C&&this.analyticsService.trackEvent(X.Events.Iam.USER_ACCESS_DENIED)}),this.documentIAM$.subscribe(C=>{C?.accessType&&this.contactService.setDocumentAccessType(C.accessType)})}catch(C){this.loggingService.catch("Error in IamService constructor: ",C)}}clearCache(){this.loggingService.log("%c[WB] Calling FUNCTION: clearCache in IamService","color: green;");try{this.documentIAM$.next(null),this.workspaceIAM$.next(null),this.roles$.next([]),this.documentPaths=null}catch(e){this.loggingService.catch("Error in IamService clearCache: ",e)}}getUser(){try{this.authService.getUser$().pipe(Le(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(Le(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 JM;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=>se(null))).subscribe(e=>{this.workspaceIAM$.next(e?.data),this.roles$.next(e?.data?.roles||[])}))}catch(e){this.loggingService.catch("Error in IamService getWorkspaceIam: ",e)}}isUserAllowed$(){return this.getRole$().pipe(de(e=>!!e),kt())}getDocumentIAM$(){return this.documentIAM$.asObservable()}getRoles$(){return this.roles$.asObservable().pipe(de(e=>e?.length?e:j.WorkspaceRoles))}getFeaturesAccessLevel$(){return this.documentIAM$.asObservable().pipe(de(e=>e?.features),he(e=>this.getRole$().pipe(de(t=>(t===uo.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(he(()=>this.documentIAM$.pipe(Le(t=>!!t),he(()=>this.workspaceIAM$.pipe(de(()=>e===this.getRole()))))))}catch(t){return this.loggingService.catch("Error in IamService hasRole$: ",t),se(!1)}}getRole$(){try{return this.authService.getUser$().pipe(he(()=>this.configService.getSF$()),he(()=>this.configService.getSF()?this.contactService.isUserGlobalContact$():se(null)),he(()=>this.documentIAM$.pipe(Le(e=>!!e))),he(()=>this.workspaceIAM$),de(()=>this.getRole()))}catch(e){return this.loggingService.catch("Error in IamService getRole$: ",e),se(null)}}getRole(){try{let e=this.configService.getSF();if(e&&this.contactService.isUserGlobalContact())return uo.ADMIN;if(!e&&this.user?.isAdmin)return uo.ADMIN;let t=null,r;if(this.user)switch((this.documentIAM$.value?this.documentIAM$.value?.features?.all?.restricted:!1)?Ci.RESTRICTED:this.documentIAM$.value?this.documentIAM$.value?.documentAccessType||Ci.PUBLIC:null){case Ci.PUBLIC:r=this.getUserFromDocumentIAM(this.user?.email,this.user?.userId),r||(r=this.getUserFromWorkspaceIAM(this.user?.email,this.user?.userId)),t=r?.role?.name||uo.COMMENTER;break;case Ci.RESTRICTED:r=this.getUserFromDocumentIAM(this.user?.email,this.user?.userId),r||(r=this.getUserFromWorkspaceIAM(this.user?.email,this.user?.userId)),t=r?.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(de(e=>e===uo.ADMIN),kt())}isUserAdmin(){try{return this.getRole()===uo.ADMIN}catch(e){return this.loggingService.catch("Error in IamService isUserAdmin: ",e),!1}}getUserFromDocumentIAM(e,t){try{if(e||t){let r;return e&&(r=this.documentIAM$.value?.users?.[_t(e)]),!r&&t&&(r=this.documentIAM$.value?.users?.[_t(t)]),r}else return}catch(r){this.loggingService.catch("Error in IamService getUserFromDocumentIAM: ",r)}}getUserFromWorkspaceIAM(e,t){try{if(e||t){let r;return e&&(r=this.workspaceIAM$.value?.users?.[_t(e)]),!r&&t&&(r=this.workspaceIAM$.value?.users?.[_t(t)]),r}else return}catch(r){this.loggingService.catch("Error in IamService getUserFromWorkspaceIAM: ",r)}}};o.\u0275fac=function(t){return new(t||o)(J(tt),J(je),J(bi),J(_n),J(at),J(Vt),J(y),J(yn))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var cn=(()=>{let o=class o{constructor(e,t,r,a,s,d,p,u,C,E,D,L,G,Y,ne,ge){this.afAuth=e,this.analyticsService=t,this.authService=r,this.configService=a,this.commonDbService=s,this.commonDbUtilsService=d,this.commentUtilsService=p,this.commentAnnotationsResolverService=u,this.databaseService=C,this.docService=E,this.domService=D,this.iamService=L,this.loggingService=G,this.notificationUtilsService=Y,this.usersService=ne,this.functions=ge,this.db=Za(),this.notificationsDb=Za(void 0,ni.firebaseNotificationsDatabaseURL),this.documentPaths=null,this.notifications$=new ve([]),this.rawNotificationsByIdMap$=new ve(new Map),this.processedNotifications$=new ve([]),this.readNotificationsOnForYouTab$=new ve(!1),this.notificationViews$=new ve({}),this.notificationsByIdMap$=new ve(new Map),this.historyPanelVisible$=new ve(!1),this.notificationsForYou$=new ve(null),this.notificationsByDocumentIdMap$=new ve(null),this.notificationsByDocumentIdSubscription={},this.allowedDocumentMetadataMap$=new ve(null),this.maxNotificationDays$=new ve(15),this.tabConfig$=new ve({people:{enable:!1}}),this.settingsConfig$=new ve(null),this.muteAllNotifications$=new ve(!1),this.enableSettings$=new ve(!1),this.selfNotifications$=new ve(!1),this.settingsInitialConfig$=new ve([{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.notificationsPanelVisible$=new ve(!1);try{this.subscribeNotificationsData().subscribe(),this.commentUtilsService.setNotificationService(this),this.databaseService.getDb().pipe(Le(ye=>!!ye),rt(1)).subscribe(ye=>{ye&&(this.db=ye,this.getDocumentIds(),this.subscribeGetNotificationsForYou())},ye=>{this.loggingService.catch("Error in NotificationService getDb subscription: ",ye)}),this.authService.getUser$().subscribe(ye=>{ye?(this.subscribeGetNotificationsForYou(),this.getDocumentIds(),this.subscribeToUserSettings()):(Object.keys(this.notificationsByDocumentIdSubscription).forEach(Re=>{this.notificationsByDocumentIdSubscription[Re]?.unsubscribe()}),this.notificationForYouSubscription?.unsubscribe(),this.documentIdsSubscription?.unsubscribe(),this.resetCacheData())}),this.docService.getLocationMetadata$().subscribe(ye=>{if(ye){let Re=this.notificationsByDocumentIdMap$.getValue()?JSON.parse(JSON.stringify(this.notificationsByDocumentIdMap$.getValue())):null;Object.keys(ye||{}).forEach(Ge=>{let Be=Re?.[Ge]?.notifications;Be?.length&&Be.forEach(we=>{this.notificationUtilsService.mergeLocationWithNotification({notification:we},ye)?.notification})}),this.notificationsByDocumentIdMap$.next(Re)}})}catch(ye){this.loggingService.catch("Error in NotificationService constructor: ",ye)}}setDBConfigDataToInitialConfig(e){try{let t=JSON.parse(JSON.stringify(this.settingsConfig$.getValue()??{}));Object.entries(e||{}).forEach(([r,a])=>{t[r]=a}),this.settingsConfig$.next(t)}catch(t){this.loggingService.catch("Error in NotificationService setDBConfigDataToInitialConfig: ",t)}}getInitialConfigFromDB(e){return Q(this,null,function*(){try{this.loggingService.log("%c[WB] Calling NotificationService FUNCTION: getInitialConfigFromDB","color: green;");let t=_t(this.authService.getUser()?.userId??""),r=yield this.commonDbService.getData({feature:"userConfig",properties:{useCollectionGroup:!1,isCollection:!1,documentId:e?.documentId,userId:t}});if(r?.notificationsConfig)this.setDBConfigDataToInitialConfig(r?.notificationsConfig);else{this.setSettingsInitialConfig(this.settingsInitialConfig$.getValue());let a={};this.settingsInitialConfig$.getValue().forEach(d=>{if(d.enable){let p=d?.values?.find(u=>u.id===d.default);a[d.id]=p||d?.values?.[0]||{id:"NONE",name:"None"}}});let s={};Object.keys(a).forEach(d=>{s[d]=a[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=_t(this.authService.getUser()?.userId??"");this.userSettingsSubscription=this.enableSettings$.pipe(Le(t=>t===!0),he(()=>this.docService.getDocumentPaths$().pipe(Le(t=>!!t),he(t=>_o(this.getInitialConfigFromDB(t)).pipe(he(()=>this.commonDbService.dbListener({feature:"userConfig",properties:{useCollectionGroup:!1,isCollection:!1,documentId:t?.documentId,userId:e}}).pipe(de(r=>{r?.data?.notificationsConfig&&!zi(r?.data?.notificationsConfig??{},this.settingsConfig$.getValue()??{})&&this.setDBConfigDataToInitialConfig(r?.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.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(gn(()=>{this.notificationsByDocumentIdMap$.next(null)}),he(()=>this.getDocumentIdsByLastNotificationTimestamp().pipe(Ri(),de(([e,t])=>{let r=e?.map(u=>u.documentId),a=t?.map(u=>u.documentId),s=r?.filter(u=>!a?.includes(u)),d=a?.map(u=>({documentId:u,timestamp:t?.find(C=>C.documentId===u)?.timestamp})).filter(u=>!r?.includes(u.documentId)),p=a?.map(u=>{let C=t?.find(E=>E.documentId===u)?.timestamp;return{documentId:u,timestamp:C}}).filter(u=>{let C=e?.find(E=>E.documentId===u.documentId)?.timestamp;return C&&u.timestamp&&C!==u.timestamp});d?.length&&this.fetchNotificationsForDocumentIds(d),p?.length&&this.fetchNotificationsForDocumentIds(p,1),s?.forEach(u=>{this.removeNotificationsForDocumentId(u)}),t&&!t?.length&&!this.notificationsByDocumentIdMap$.getValue()&&this.notificationsByDocumentIdMap$.next({})})))).subscribe(()=>{},e=>{this.loggingService.catch("Error in NotificationService getDocumentIds subscription: ",e)})}catch(e){this.loggingService.catch("Error in NotificationService getDocumentIds: ",e)}}getDocumentIdsByLastNotificationTimestamp(e=15){try{return this.authService.getUser$().pipe(he(t=>this.docService.getOrganizationConfig$().pipe(de(r=>{let a=null,s=this.configService.getApiKey(),d=r?.organizationId||t?.organizationId;return s&&d&&(a=new Fd({apiKey:s,organizationId:d})),{user:t,documentPaths:a}}))),he(t=>{let{user:r,documentPaths:a}=t;if(r&&a?.organizationNotificationsLastNotificationTimestamp){let s=new Date,d=this.maxNotificationDays$.getValue()>0?this.maxNotificationDays$.getValue():15;s.setDate(s.getDate()-d);let p=s.getTime();return this.commonDbService.dbListener({feature:"allLastNotificationTimestamp",properties:{organizationId:a?.organizationId,isCollection:!0,useQuery:!0,firestoreQuery:[Bi(ut("timestamp",">=",p)),jr("timestamp","desc"),n0(e)]}}).pipe(de(u=>u?.data),de(u=>{let C=[];return Object.keys(u||{}).forEach(E=>{let D=this.commonDbService.shouldUseFirestore()?u[E]?.timestamp??0:u[E],L=this.commonDbService.shouldUseFirestore()?u[E]?.deletedNotification??!1:!1;if(L&&L.id&&L?.timestamp===D){let G=L.id,Y=u[E]?.metadata?.documentId,ne=JSON.parse(JSON.stringify(this.notificationsByDocumentIdMap$.getValue()??{})),ge=ne?.[Y]??{documentMetadata:null,notifications:[]},ye=ge.notifications??[],Re=ye?.findIndex(Ge=>Ge.id===G);Re!==-1&&(ye.splice(Re,1),this.notificationsByDocumentIdMap$.next(T(I({},ne),{[Y]:T(I({},ge),{notifications:ye})})))}C.push({documentId:E,timestamp:D})}),C}),Hn(u=>(this.loggingService.catch("Error in NotificationService getDocumentIdsByLastNotificationTimestamp: ",u),se([]))))}return se(null)}))}catch(t){return this.loggingService.catch("Error in NotificationService getDocumentIdsByLastNotificationTimestamp: ",t),se([])}}fetchNotificationsForDocumentIds(e,t=15){return Q(this,null,function*(){try{if(e?.length){let r=yr(this.functions,br({url:ni.cloudFunction.getNotificationsForDocuments,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:12e5}),a=this.docService.getOrganizationConfig()?.organizationId??"",s=this.getStartAtTimestamp(),d={};e.forEach(L=>{if(L?.documentId){let G=this.getAllowedDocumentMetadataByDocumentId(L.documentId);G&&(d[L.documentId]=G)}});let p={organizationId:a,documentIds:e,timestamp:s,limitToLast:t,documentMetadataByDocumentId:d,selfNotifications:this.selfNotifications$.value},u=yield this.notificationUtilsService.handleNotificationEncryption({data:p}),C=(yield r({veltData:u}))?.data?.data?.veltData||{},E="notificationwithdocumentidstoencryptanddecryptonsdk"+(this.authService.getUser()?.userId??""),D=yield jre(C,E);if(D&&typeof D=="object"){let L=this.usersService.userDataProviderAvailable(),G=this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable(),Y=[],ne=[];Object.keys(D).forEach((ge,ye)=>{let Re=D[ge].documentMetadata;if(Re){let Be=this.allowedDocumentMetadataMap$.value||{};(!Be?.[ge]||!zi(Be?.[ge],Re))&&this.allowedDocumentMetadataMap$.next(T(I({},Be),{[ge]:Re}))}let Ge=D[ge].notifications||[];Ge.forEach(Be=>{Be.notification=this.getClientNotificationObject(Be)}),this.setNotificationForDocumentIdInCache(ge,Re,Ge),L&&Y.push(this.commonDbUtilsService.formatResponse({feature:"allDocNotifications",data:Ge,shouldAwait:!0,forceResolve:!0})),G&&ne.push(this.commonDbUtilsService.formatResponse({feature:"allDocNotifications",data:Ge,shouldCommentAnnotationsResolverAwait:!0}))}),L&&Promise.all(Y).then(()=>{Object.keys(D).forEach(ge=>{let ye=D?.[ge]?.documentMetadata||{},Re=this.commonDbUtilsService.mergeUsersWithData({feature:"allDocNotifications",data:D?.[ge]?.notifications||[]});Re.forEach(Ge=>{Ge.notification=this.getClientNotificationObject(Ge)}),this.setNotificationForDocumentIdInCache(ge,ye,Re)})}),G&&Promise.all(ne).then(()=>{Object.keys(D).forEach(ge=>{let ye=D?.[ge]?.documentMetadata||{},Re=D?.[ge]?.notifications?.reduce((Ge,Be)=>(Ge[Be.notificationId]=Be,Ge),{});Re=this.commonDbUtilsService.mergeCommentAnnotationsWithData({feature:"allDocNotifications",data:Re}),Re=Object.values(Re??{}),Re.forEach(Ge=>{Ge.notification=this.getClientNotificationObject(Ge)}),this.setNotificationForDocumentIdInCache(ge,ye,Re)})})}}}catch(r){return this.loggingService.catch("Error in NotificationService fetchNotificationsForDocumentIds: ",r),[]}})}setNotificationForDocumentIdInCache(e,t,r,a){try{let s=this.docService.getOrganizationConfig()?.organizationId??"",d=this.docService.getOrganizationMetadata(s);t||(t=JSON.parse(JSON.stringify(this.docService.getDocumentMetadata()||{}))),d||(d=JSON.parse(JSON.stringify(this.docService.getOrganizationMetadata(s)||{})));let p=this.notificationsByDocumentIdMap$.getValue(),u=p?.[e]?.notifications||[],C=this.docService.getLocationMetadatas(),E=r?.map(G=>{let Y=G.notification;return Y.metadata&&(Y.metadata.documentName=t?.documentName||Y.metadata.documentName,Y.metadata.organizationMetadata=d||Y.metadata.organizationMetadata,Y.metadata.documentMetadata=t||Y.metadata.documentMetadata),C&&(Y=this.notificationUtilsService.mergeLocationWithNotification({notification:Y},C)?.notification),Y})?.filter(G=>!!G)||[],D=new Map(u.map(G=>[G.id,G]));E.forEach(G=>{D.set(G.id,G)});let L=Array.from(D.values()).sort((G,Y)=>(Y.timestamp||0)-(G.timestamp||0));this.notificationsByDocumentIdMap$.next(T(I({},p),{[e]:{notifications:L,documentMetadata:t}}))}catch(s){this.loggingService.catch("Error in NotificationService setNotificationForDocumentIdInCache: ",s)}}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)}}getNotificationsForDocumentId$(e,t=50){try{return this.authService.getUser$().pipe(de(r=>({user:r})),he(r=>this.maxNotificationDays$.pipe(de(()=>r))),he(r=>{let{user:a}=r,s=this.configService.getApiKey();if(a&&s){let d=new Date,p=this.maxNotificationDays$.getValue()>0?this.maxNotificationDays$.getValue():15;d.setDate(d.getDate()-p);let u=d.getTime();return _o(this.commonDbService.queryData({feature:"allDocNotifications",properties:{rtdbQuery:[Mu("timestamp"),ku(u),TV(t)],firestoreQuery:[jr("timestamp","desc"),ut("timestamp",">=",u),ut("notification.actionUser.userId","!=",a.userId),n0(t)],apiKey:s,organizationId:this.docService?.getDocumentPaths()?.organizationId||a?.organizationId,documentId:e}})).pipe(he(C=>this.commonDbUtilsService.mergeUsersWithData$({feature:"allDocNotifications",data:{data:C,operation:null}})),de(C=>C?.data??[]),de(C=>(C.sort((E,D)=>D.timestamp-E.timestamp),C)),Hn(C=>(this.loggingService.catch("Error in NotificationService getNotificationsForDocumentId: ",C),se([]))),de(C=>(C.forEach(E=>{E.notification=this.getClientNotificationObject(E)}),C)))}return se([])}))}catch(r){return this.loggingService.catch("Error in NotificationService getNotificationsForDocumentId: ",r),se([])}}getStartAtTimestamp(){try{let e=new Date,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.databaseService.getDb().pipe(he(e=>this.authService.getUser$().pipe(de(t=>({db:e,user:t})))),he(e=>this.maxNotificationDays$.pipe(de(()=>e))),he(e=>{let{db:t,user:r}=e,a=this.configService.getApiKey();if(t&&r?.organizationId&&a){let s=_t(r?.userId),d=new Date,p=this.maxNotificationDays$.getValue()>0?this.maxNotificationDays$.getValue():15;d.setDate(d.getDate()-p);let u=d.getTime();return this.commonDbService.dbListener({feature:"allUserNotifications",properties:{useQuery:!0,isCollection:!0,rtdbQuery:[Mu("timestamp"),ku(u),TV(50)],firestoreQuery:[jr("timestamp","desc"),ut("timestamp",">=",u),ut("notification.actionUser.userId","!=",r.userId),n0(50)],apiKey:a,organizationId:this.docService?.getDocumentPaths()?.organizationId||r?.organizationId,documentId:this.docService.getDocumentPaths()?.documentId,userId:s}}).pipe(he(C=>C?.data?se(C).pipe(de(E=>E?.data),de(E=>{let D=Object.values(E||{});return D.forEach(G=>{G.notification=this.getClientNotificationObject(G)}),D.sort((G,Y)=>Y.timestamp-G.timestamp),D.map(G=>G.notification).filter(G=>!!G)}),he(E=>{let D={data:E?.reduce((L,G)=>(L[G.id]={notification:G},L),{}),operation:null};return this.commonDbUtilsService.mergeLocationMetadataWithData$({data:D,feature:"allUserNotifications"}).pipe(de(L=>Object.values(L?.data||{}).map(G=>G?.notification)))})):se(null)))}return se(null)}),he(e=>{let t=this.docService.getOrganizationConfig()?.organizationId??"";return this.docService.getOrganizationMetadata$(t).pipe(de(()=>e))}),he(e=>this.allowedDocumentMetadataMap$.pipe(de(()=>e))),de(e=>(e?.length&&(e=e.map(t=>{if(t?.metadata){let r=this.docService.getOrganizationConfig()?.organizationId??"",a=this.getAllowedDocumentMetadataByDocumentId(t.metadata.documentId),s=this.docService.getOrganizationMetadata(r);a||(a=JSON.parse(JSON.stringify(this.docService.getDocumentMetadata()||{}))),s||(s=JSON.parse(JSON.stringify(this.docService.getOrganizationMetadata(r)||{}))),t.metadata.documentName=a?.documentName||t.metadata.documentName,t.metadata.organizationMetadata=s||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([]),se(e))))}catch(e){return this.loggingService.catch("Error in NotificationService getNotificationsForYou: ",e),se({})}}subscribeNotificationsData(e,t){this.loggingService.log("%c[WB] Calling FUNCTION: subscribeViewsData","color: green;");let r,a;try{if(e&&(a=fn(e)),t&&typeof t=="object"){let s=Go(t);r=fn(JSON.stringify(s))}}catch(s){this.loggingService.catch("Error in ViewsService subscribeViewsData: ",s)}return Qn(this.afAuth).pipe(Le(s=>!!s),he(s=>this.isFeatureAllowed({firebaseUser:s})),he(s=>s.featureAllowed?this.iamService.isUserAllowed$().pipe(de(d=>(s.featureAllowed=d,s))):se(s)),he(s=>!s.featureAllowed||s?.user?.organizationId?(this.notifications$.next([]),this.rawNotificationsByIdMap$.next(new Map),this.processedNotifications$.next([]),this.notificationsByIdMap$.next(new Map),this.notificationViews$.next({}),this.setNotificationsByIdMap(),se([])):se(s).pipe(he(d=>this.docService.getDocumentPaths$().pipe(de(p=>(this.documentPaths=p,d.documentPaths=p,d)))),he(d=>this.getDataFromDocumentId(a)))))}isFeatureAllowed(e){return this.configService.getConfig$().pipe(Le(t=>!!t),de(t=>T(I({},e),{config:t})),he(t=>this.authService.getUser$().pipe(de(r=>T(I({},t),{user:r})))),he(t=>no(t.config,t.user,Ne.NOTIFICATION)?se(T(I({},t),{featureAllowed:!0})):(this.loggingService.warn("Notification feature is not allowed."),se(T(I({},t),{featureAllowed:!1})))))}getDataFromDocumentId(e){return this.databaseService.getDb().pipe(Le(t=>!!t),he(t=>{if(this.db=t,this.loggingService.log(this.db),this.configService?.getApiKey()&&this.documentPaths?.views){let r=`${this.configService.getApiKey()}`;this.documentPaths?.organizationId&&(r+=`/${j.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${this.documentPaths.organizationId}`);let a=$i(this.db,`${e?r+"/"+j.FIREBASE_PARTIAL_PATH_DOCS+"/"+e+"/"+j.FIREBASE_PARTIAL_PATH_VIEWS+"/":this.documentPaths?.notifications}`);return w6(a).pipe(Hn(s=>(this.loggingService.catch("Error in NotificationService getDataFromDocumentId: ",s),se(null))),de(s=>{let d=[],p=new Map;s?.raw&&(Object.keys(s?.raw||{}).forEach(C=>{let E=s?.raw[C];E?.id&&d.push(E)}),d.forEach(C=>{C.id&&p.set(C.id,C)})),this.notifications$.next(d),this.rawNotificationsByIdMap$.next(p);let u=[];s?.processed&&Object.keys(s?.processed||{}).forEach(C=>{let E=s?.processed[C];E?.id&&u.push(E)}),this.processedNotifications$.next(u),this.setNotificationsByIdMap()}))}else return se(null)}))}setNotificationsByIdMap(){try{let e=this.authService.getUser();if(e){let t=this.notificationViews$.getValue(),r;e?.email&&(r=_t(e?.email));let a;e?.userId&&(a=_t(e?.userId));let s=new Map;this.processedNotifications$.getValue().forEach(p=>{if(p.id&&p?.displayHeadlineMessageTemplate){let u=!1;(r&&p.notifyUsers?.[r]||a&&p.notifyUsers?.[a])&&(u=!0);let C={id:p.id,notificationSource:p.notificationSource,actionType:p.actionType,actionUser:p.actionUser,timestamp:p.timestamp,targetAnnotationId:p.targetAnnotationId,displayHeadlineMessage:this.getNotificationHeadlineMessage(p),displayBodyMessage:this.getNotificationBodyMessage(p),forYou:u,notificationSourceData:p.notificationSourceData},E=this.getRawNotificationById(C.id);if(E?.metadata&&(C.metadata={apiKey:E.metadata.apiKey,organizationId:E.metadata.organizationId,clientOrganizationId:E.metadata.clientOrganizationId,documentId:E.metadata.documentId,clientDocumentId:E.metadata.clientDocumentId,location:E?.location,locationId:E?.locationId}),C?.notificationSource==="comment"&&C?.targetAnnotationId){let D=this.commentService?.getAnnotationById(C.targetAnnotationId);D||E?.annotationData&&(D=E.annotationData),D&&(C.notificationSourceData=qn(D))}s.set(p.id,C)}}),s.forEach((p,u)=>{p.isUnread=p?.actionUser?.userSnippylyId!==e?.userSnippylyId&&!t?.notification?.[u]?.views?.[e?.userSnippylyId],s.set(u,p)}),this.notificationsByIdMap$.next(s)}}catch(e){this.loggingService.catch("Error in NotificationService setNotificationsByIdMap: ",e)}}getClientNotificationObject({processed:e,raw:t,metadata:r,views:a,notification:s}){try{let d=this.authService.getUser(),p=s||e;if(p.id&&p?.displayHeadlineMessageTemplate&&d){let u=null;d?.email&&(u=_t(d?.email));let C=null;d?.userId&&(C=_t(d?.userId));let E=!1,D=!0;(u&&p.notifyUsers?.[u]||C&&p.notifyUsersByUserId?.[C])&&(E=!0),C&&a?.[C]&&(D=!1);let L={id:p.id};if(s?L=T(I(I({},L),s),{displayHeadlineMessage:this.getNotificationHeadlineMessage(s),displayBodyMessage:this.getNotificationBodyMessage(s),forYou:E,isUnread:D}):L={id:e.id,notificationSource:e.notificationSource,actionType:e.actionType,actionUser:e.actionUser,timestamp:e.timestamp,targetAnnotationId:e.targetAnnotationId,displayHeadlineMessage:this.getNotificationHeadlineMessage(e),displayBodyMessage:this.getNotificationBodyMessage(e),forYou:E,isUnread:D,metadata:r},L?.notificationSource==="comment"&&L?.targetAnnotationId){let G=this.commentService?.getAnnotationById(L.targetAnnotationId);G||s?.notificationSourceData&&(G=s?.notificationSourceData),G||t?.annotationData&&(G=t.annotationData),G&&(L.notificationSourceData=qn(G))}return t?.targetAnnotationData?.isCommentResolverUsed&&(L.isCommentResolverUsed=t?.targetAnnotationData?.isCommentResolverUsed),L}return}catch(d){this.loggingService.catch("Error in NotificationService getClientNotificationObject: ",d);return}}getNotificationsForYou$(){return this.notificationsForYou$.asObservable()}getNotificationsByDocumentId$(){return this.notificationsByDocumentIdMap$.asObservable().pipe(de(e=>e?Object.keys(e??{}).map(t=>{let r=e[t].notifications||[],a=r.filter(d=>d.isUnread).length,s=r.length>0&&r[0]?.timestamp||0;return{documentId:t,notifications:e[t]?.notifications,unreadNotificationsCount:a,latestNotificationTimestamp:s,documentMetadata:e[t]?.documentMetadata}}).filter(t=>t.notifications?.length>0).sort((t,r)=>r.latestNotificationTimestamp-t.latestNotificationTimestamp):null))}getAllNotifications$(){return this.getNotificationsByDocumentId$().pipe(de(e=>{let t=null;return e?(t=[],e.forEach(r=>{r.notifications.forEach(a=>{t?.push(a)})}),t?.sort((r,a)=>a.timestamp-r.timestamp)):null}))}processNotificationData(e){try{let t=e?.annotationData?.metadata,r=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(r?this.docService.getOrganizationMetadata(r)||{}:{})),e?.metadata?.organizationMetadata?.clientOrganizationId&&e?.metadata?.organizationMetadata?.organizationId&&(e.metadata.organizationMetadata.organizationId=e?.metadata?.organizationMetadata?.clientOrganizationId);let a=this.configService.getApiKey();e.metadata.apiKey=a,e.platform=this.configService.getSF()?"sf":"sdk",e.actionUser=this.authService.getUser();let s=t?.documentId?new Fd({apiKey:a,documentId:t.documentId,organizationId:t?.organizationId}):this.docService.getDocumentPaths();e?.actionUser?.organizationId&&(e.metadata.organizationId=s?.organizationId||e.actionUser.organizationId,e.metadata.clientOrganizationId=s?.clientOrganizationId||e.actionUser.clientOrganizationId);let d=this.docService.getLocation();d&&(e.location=d?.location,e.locationId=d?.locationId),this.loggingService.log(`[NOTIFICATION] ${e?.notificationSource} ${e?.actionType}`,e);let p=this.commonDbService.getServerTimestamp(),u=this.notificationUtilsService.formatNotification(e,p);return JSON.parse(JSON.stringify(u))}catch(t){return this.loggingService.catch("Error in NotificationService processNotificationData: ",t),null}}updateNotificationDatabase(e){try{let t=$i(this.notificationsDb),r=this.processNotificationData(e);C6(t,JSON.parse(JSON.stringify(r)))}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(he(t=>t?t.organizationId?this.getAllNotifications$().pipe(he(r=>this.notificationsForYou$.pipe(de(a=>{if(r||a){let s=new Map;return(!e?.type||["all","documents"].includes(e.type))&&(r||[]).forEach(d=>{d.id&&s.set(d.id,d)}),(!e?.type||["all","forYou"].includes(e.type))&&(a||[]).forEach(d=>{d.id&&!s.has(d.id)&&s.set(d.id,d)}),Array.from(s.values()).sort((d,p)=>(p.timestamp||0)-(d.timestamp||0))}else return null})))):this.notificationsByIdMap$.asObservable().pipe(de(r=>Array.from(r.values())),de(r=>r.sort((a,s)=>s.timestamp-a.timestamp)),zg()):se(null)),kt(si))}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 r=e.displayHeadlineMessageTemplate,a=e.displayHeadlineMessageTemplateData,s=/\{(\w+)\}/g,d=r.replace(s,(p,u)=>(u==="actionUser"||u==="recipientUser")&&a[u]?t?.email&&a[u].email===t?.email||t?.userId&&a[u]?.userId===t?.userId?"You":a[u].name||a[u].email||' <velt-skeleton-loader width="50px" height="20px" border-radius="4px"></velt-skeleton-loader> ':a[u]?a[u]:p);return this.domService.sanitizeHtml(d)}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(r=>{if(r?.userId){let a=this.usersService.getUserById(r?.userId);t=t?.replaceAll(`{{${r.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,r=!1){try{e?document.querySelector(j.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL)?this.historyPanelVisible$.next(e):this.loggingService.catch("Error in NotificationService setHistoryPanelVisibility: ",`<${j.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL}> tag is not added.`):this.historyPanelVisible$.next(e),e?this.analyticsService.trackEvent(X.Events.Notifications.NOTIFICATION_HISTORY_PANEL_OPENED):this.analyticsService.trackEvent(X.Events.Notifications.NOTIFICATION_HISTORY_PANEL_CLOSED)}catch{this.loggingService.catch("Error in NotificationService setHistoryPanelVisibility: ",`<${j.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL}> tag is not added.`)}}toggleHistoryPanelVisibility(e=!1,t=!1){try{this.historyPanelVisible$.value?this.historyPanelVisible$.next(!this.historyPanelVisible$.value):document.querySelector(j.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL)?(this.historyPanelVisible$.next(!this.historyPanelVisible$.value),this.historyPanelVisible$.value?this.analyticsService.trackEvent(X.Events.Notifications.NOTIFICATION_HISTORY_PANEL_TOGGLED,{action:"closed"}):this.analyticsService.trackEvent(X.Events.Notifications.NOTIFICATION_HISTORY_PANEL_TOGGLED,{action:"opened"})):this.loggingService.catch("Error in NotificationService toggleHistoryPanelVisibility: ",`<${j.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL}> tag is not added.`)}catch{this.loggingService.catch("Error in NotificationService toggleHistoryPanelVisibility: ",`<${j.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL}> tag is not added.`)}}getHistoryPanelVisibility$(){return this.historyPanelVisible$.asObservable()}setNotificationsAsRead(e){return Q(this,null,function*(){try{if(e?.length){for(let a=0;a<e.length;a+=50){let d=e.slice(a,a+50).filter(p=>p?.id).map(p=>this.setNotificationAsRead(p));yield Promise.all(d)}let r=JSON.parse(JSON.stringify(this.notificationsByDocumentIdMap$.getValue()||{}));e.forEach(a=>{let s=a.metadata?.documentId;if(s&&r?.[s]){let d=r?.[s]?.notifications||[],p=d.find(u=>u.id===a.id);p&&(p.isUnread=!1),r[s].notifications=d}}),this.notificationsByDocumentIdMap$.next(r)}}catch(t){this.loggingService.catch("Error in NotificationService setNotificationsAsRead: ",t)}})}setAllNotificationsAsRead(e){return Q(this,null,function*(){try{if(e?.tabId==="for-you"){let t=this.notificationsForYou$.value||[];this.setNotificationsAsRead(t)}else this.getNotifications$().pipe(rt(1)).subscribe(t=>{t&&this.setNotificationsAsRead(t)})}catch(t){this.loggingService.catch("Error in NotificationService setAllNotificationsAsRead: ",t)}})}getUnreadNotificationsCount$(){try{return this.notificationsForYou$.pipe(de(e=>e?.filter(r=>r?.isUnread)?.length??null),he(e=>this.getNotifications$().pipe(de(t=>{let r=t?.filter(a=>a?.isUnread)?.length??null;return{forYou:e,all:r}}))))}catch(e){return this.loggingService.catch("Error in NotificationService getUnreadNotificationsCount$: ",e),se({forYou:null,all:null})}}setNotificationAsRead(e){return Q(this,null,function*(){try{let t=this.authService.getUser();if(t&&e?.id){let r=_t(t?.userId),{metadata:a}=e;if(a){let{apiKey:s,organizationId:d,documentId:p}=a;if(s&&d&&p&&r){let u=yield this.commonDbService.getData({feature:"docNotification",properties:{id:e.id,organizationId:d,documentId:p,apiKey:s}});u?.notificationId&&(u?.views?.[r]||(u.views||(u.views={}),u.views[r]={timestamp:Date.now()},this.commonDbService.updateData({feature:"docNotificationViews",properties:{id:e.id,organizationId:d,documentId:p,apiKey:s},data:u})));let C=yield this.commonDbService.getData({feature:"userNotification",properties:{id:e.id,userId:r,documentId:p,organizationId:d}});C?.notificationId&&(this.getReadNotificationsOnForYouTab()?C?.views?.[r]||(C.views||(C.views={}),C.views[r]={timestamp:Date.now()},this.commonDbService.updateData({feature:"userNotificationViews",properties:{id:e.id,userId:r,documentId:p,organizationId:d},data:C})):yield this.commonDbService.deleteData({feature:"userNotification",properties:{id:e.id,userId:r,documentId:p,organizationId:d}}))}}}}catch(t){this.loggingService.catch("Error in NotificationService setNotificationAsRead: ",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}markNotificationAsReadById(e){return Q(this,null,function*(){try{this.getNotifications$().pipe(rt(1)).subscribe(t=>{if(t){let r=t.filter(a=>a.id===e);this.setNotificationsAsRead(r)}})}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)}}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(r=>{["email","inbox"].includes(r.id)&&(t=!r.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 Q(this,null,function*(){try{let t=_t(this.authService.getUser()?.userId??""),r=this.docService.getDocumentPaths(),a={apiKey:this.configService.getApiKey(),organizationId:r?.organizationId,documentId:r?.documentId,clientOrganizationId:r?.clientOrganizationId,clientDocumentId:r?.clientDocumentId,userId:t,clientUserId:this.authService.getUser()?.userId};t&&r?.documentId&&this.getEnableSettings()&&this.enableSettings$.value&&(yield this.commonDbService.updateData({feature:"userConfig",properties:{documentId:r.documentId,userId:t},data:{id:r.documentId,notificationsConfig:e||this.settingsConfig$.getValue(),metadata:a}}))}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}};o.\u0275fac=function(t){return new(t||o)(J(Ei),J(tt),J(je),J(Vt),J(yn),J(tg),J(c0),J(ws),J(_n),J(at),J(Fe),J(Sn),J(y),J(Sk),J(Yn),J($o))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Wo=(()=>{let o=class o{constructor(e){this.loggingService=e,this._customStatusMap=new ve(j.CommentAnnotationStatusMap),this._customPriorityMap=new ve(j.CommentAnnotationPriorityMap),this._customCategoryMap=new ve(j.CommentCategoryMap);try{let t=sessionStorage.getItem(j.SESSION_STORAGE.VELT_CUSTOM_PRIORITY_MAP);t&&this._customPriorityMap.next(JSON.parse(t));let r=sessionStorage.getItem(j.SESSION_STORAGE.VELT_CUSTOM_STATUS_MAP);r&&this._customStatusMap.next(JSON.parse(r));let a=sessionStorage.getItem(j.SESSION_STORAGE.VELT_CUSTOM_CATEGORY_MAP);a&&this._customCategoryMap.next(JSON.parse(a))}catch(t){this.loggingService.catch("Error in CustomFilterService constructor: ",t)}}setCustomStatusFilters(e){try{if(e.length<2){this._customStatusMap.next(j.CommentAnnotationStatusMap),sessionStorage.setItem(j.SESSION_STORAGE.VELT_CUSTOM_STATUS_MAP,JSON.stringify(j.CommentAnnotationStatusMap)),this.loggingService.catch("Custom status filters must have at least 2 filters");return}let t={};e.forEach(r=>{t[r.id]=r,r.type||(r.type="ongoing")}),this._customStatusMap.next(t),sessionStorage.setItem(j.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(j.CommentAnnotationPriorityMap),sessionStorage.setItem(j.SESSION_STORAGE.VELT_CUSTOM_PRIORITY_MAP,JSON.stringify(j.CommentAnnotationPriorityMap)),this.loggingService.catch("Custom priority filters must have at least 2 filters");return}let t={};e.forEach(r=>{t[r.id]=r}),this._customPriorityMap.next(t),sessionStorage.setItem(j.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(r=>{t[r.id]=r}),this._customCategoryMap.next(t),sessionStorage.setItem(j.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(([r,a])=>a.type==="default");if(t)return t[1]}catch(e){this.loggingService.catch("Error in CustomFilterService defaultStatus: ",e)}return j.CommentAnnotationStatusMap.OPEN}get resolvedStatus(){try{let t=Object.entries(this._customStatusMap.value).find(([r,a])=>a.type==="terminal");if(t)return t[1]}catch(e){this.loggingService.catch("Error in CustomFilterService resolvedStatus: ",e)}return j.CommentAnnotationStatusMap.OPEN}get ongoingStatuses(){try{let t=Object.entries(this._customStatusMap.value).filter(([r,a])=>a.type==="ongoing");if(t)return t.map(r=>r[1])}catch(e){this.loggingService.catch("Error in CustomFilterService ongoingStatuses: ",e)}return[j.CommentAnnotationStatusMap.IN_PROGRESS]}convertLegacyAnnotationStatus(e){try{if(typeof e.status=="string"||e.status===void 0){let t=Object.entries(this._customStatusMap.value),r=t.find(([a,s])=>s.type==="default");switch(e.status){case"open":r&&(e.status=r[1]);break;case"inProgress":let a=t.find(([d,p])=>p.type==="ongoing");a&&(e.status=a[1]);break;case"resolved":let s=t.find(([d,p])=>p.type==="terminal");s&&(e.status=s[1]);break;default:r&&(e.status=r[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=j.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=>j.CommentCategoryMap[t]))}catch(t){this.loggingService.catch("Error in CustomFilterService convertLegacyCategory: ",t)}return e}};o.\u0275fac=function(t){return new(t||o)(J(y))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Nc=(()=>{let o=class o{constructor(e,t,r){this.domService=e,this.loggingService=t,this.sanitizer=r,this.emojis={};try{this.loggingService.log("%c[WB] Creating CLASS: EmojiService","color: blue;"),Object.keys(o.Icons).forEach(a=>{let s=o.Icons[a];this.emojis[a]=this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeSvg(s))}),Object.keys(o.GIF_PATHS).forEach(a=>{let s=`<img src="${o.GIF_PATHS[a]}" alt="${a}" />`;this.emojis[a]=this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeHtml(s))})}catch(a){this.loggingService.catch("Error in EmojiService constructor: ",a)}}getEmoji(e){try{return this.emojis[e]}catch{return""}}getEmojiFromIconUrl(e){try{return this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeHtml(`<img src="${e}" alt="emoji" />`))}catch{return""}}getEmojiFromIconEmoji(e,t){try{let r=`<span class="velt-emoji-icon velt-emoji-icon--emoji">${e}</span>`;return t&&(r=`<span class="velt-emoji-icon velt-emoji-icon--emoji" emoji-id=${t}>${e}</span>`),this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeHtml(r))}catch{return""}}setEmojiList(e){try{this.emojis={},Object.keys(e).forEach(t=>{let r=e[t];if(r.svg)this.emojis[t]=this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeSvg(r.svg));else if(r.url){let a=`<img src="${r.url}" alt="${t}" />`;this.emojis[t]=this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeHtml(a))}else r.emoji&&(this.emojis[t]=this.getEmojiFromIconEmoji(this.domService.sanitizeHtml(r.emoji)))})}catch(t){this.loggingService.catch("Error in EmojiService setEmojiList: ",t)}}};o.Icons={RAISED_HANDS:`<svg width="58" height="57" viewBox="0 0 58 57" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
196
|
+
`+Pr),Uc&&uk([Ae,Te,Pn],Ns=>{Pr=yb(Pr,Ns," ")}),Re&&Dg?Re.createHTML(Pr):Pr},o.setConfig=function(){let Qt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};em(Qt),Tg=!0},o.clearConfig=function(){Jd=null,Tg=!1},o.isValidAttribute=function(Qt,Ue,bt){Jd||em({});let Wt=Co(Qt),oo=Co(Ue);return A_(Wt,oo,bt)},o.addHook=function(Qt,Ue){typeof Ue=="function"&&_b(fe[Qt],Ue)},o.removeHook=function(Qt,Ue){if(Ue!==void 0){let bt=t8e(fe[Qt],Ue);return bt===-1?void 0:n8e(fe[Qt],bt,1)[0]}return sce(fe[Qt])},o.removeHooks=function(Qt){fe[Qt]=[]},o.removeAllHooks=function(){fe=uce()},o}var pz=_ce();var yce={ADD_TAGS:["velt-skeleton-loader"],ADD_ATTR:["border-radius"]},Fe=(()=>{let o=class o{constructor(e,t,r){this.rendererFactory2=e,this.loggingService=t,this.sanitizer=r,this.isVideoEditorHandlingDelete=!1,this.pageScrollHeight=0,this.enableRectSelectionSubject$=new ve(!1),this.enableRectSelection$=this.enableRectSelectionSubject$.asObservable(),this.scrollableElementsIds$=new ve([]),this.mousedown=!1,this.windowMouseDown$=new et,this.windowPointerMove$=new ve(null),this.windowPointerUp$=new ve(null),this.documentSelectionChange$=new ve(null),this.windowClick$=new ve(null),this.windowScroll$=new ve(null),this.windowResize$=new ve(null),this.windowKeyupBackspace$=new ve(null),this.windowKeyupDelete$=new ve(null),this.windowKeyupEsc$=new ve(null),this.windowPopState$=new ve(null),this.documentClick$=new ve(null),this.documentClickSubject$=new et,this.documentFocus$=new ve(null),this.windowKeydownShift$=new ve(null),this.windowKeyupShift$=new ve(null),this.mutation$=new ve(null),this.childListMutation$=new ve(null),this.networkStatus$=new ve(!1),this.xpathCache=new Map,this.xpathCacheId=new Map,this.selectedAnnotationsMap$=new ve({}),this.selectedAnnotationsLocationMap$=new ve({}),this.recordingInProgress$=new ve({}),this.deleteAnnotations$=new ve([]),this.pinHighlighterClass$=new ve(null),this.dialogOpenedInSidebar$=new ve(!1),this.textHighlighterClass$=new ve(null),this.commentPinHighlighter$=new ve(!1),this.deviceInfo$=new ve(new Gn),this.customCss$=new ve(null),this.mutationObserver=null,this.previousMousePosition={pageX:0,pageY:0,clientX:0,clientY:0},this.currentMousePosition={pageX:0,pageY:0,clientX:0,clientY:0,element:{xpath:"",topPercentage:0,leftPercentage:0}},this.nodeMap={},this.unlistenElementScroll={},this.filterSnippylyNodes=a=>{try{let s=[];return a.forEach(d=>{if(!qi(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 p=!1;d.childNodes.forEach(u=>{qi(u)&&(p=!0)}),p||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.renderer=this.rendererFactory2.createRenderer(null,null);let a=this.calculateScreenSize();this.currentScreenSize$=new ve(a),this.currentMousePosition$=new ve(this.currentMousePosition),this.detectNetworkStatusChange(),this.getScrollableElementsIds$().pipe(Ri(),gn(([s,d])=>{try{let p=d.filter(C=>!s.includes(C)),u=s.filter(C=>!d.includes(C));u.length&&u.map(E=>document.getElementById(E)).filter(E=>E).forEach(E=>{this.unlistenElementScroll&&this.unlistenElementScroll[E.id]&&this.unlistenElementScroll[E.id]()}),p.length&&p.map(E=>document.getElementById(E)).filter(E=>E).forEach(E=>{this.unlistenElementScroll[E.id]=this.renderer.listen(E,"scroll",D=>{let L=this.calculateScreenSize();this.currentScreenSize$.next(L)})})}catch(p){this.loggingService.catch("Error in DomService getScrollableElementsIds subscription: ",p)}})).subscribe(()=>{},s=>{this.loggingService.catch("Error in DomService getScrollableElementsIds subscription: ",s)}),this.getSelectedAnnotationsMap$().subscribe(s=>{Object.keys(s||{})?.length?Qre("snippylyUserScalableNo","viewport","width=device-width, user-scalable=no"):Jre("snippylyUserScalableNo")},s=>{this.loggingService.catch("Error in DomService getSelectedAnnotationsMap$ subscription: ",s)})}catch(a){this.loggingService.catch("Error in DomService constructor: ",a)}}setDocService(e){try{this.docService=e,this.subscribeToDomEvents()}catch(t){this.loggingService.catch("Error in DomService setDocService: ",t)}}subscribeToDomEvents(){try{this.docService?.getDocumentPaths$().pipe(de(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(),En([this.docService?.getOrganizationConfig$(),this.docService?.getDocumentPaths$()]).pipe(de(([e,t])=>!!e||!!t),kt(),de(e=>{e?this.onDocumentClick():this.unsubscribeFromDocumentClick()})).subscribe()}catch(e){this.loggingService.catch("Error in DomService subscribeToDomEvents: ",e)}}setScrollableElementsIds(e){try{e&&e.length&&this.scrollableElementsIds$.next(Array.from(new Set(e)))}catch(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.mutationObserver=new MutationObserver(t=>{try{if(t?.find(a=>a?.attributeName===j.VELT_IGNORE_CHANGE_DETECTION))return;let r=t.filter(a=>a.type==="childList").filter(a=>{let s=a.target;return a.removedNodes.forEach(d=>{let p=d;if(typeof p.getAttribute=="function"){let u=p.getAttribute(j.ATTRIBUTES.VELT_ELEMENT_CACHE_ID);if(u!==null&&u!==""){let C=this.xpathCacheId.get(u);C!==void 0&&(this.xpathCacheId.delete(u),this.xpathCache.delete(C))}}}),qi(s)?!1:!!(this.filterSnippylyNodes(a.addedNodes).length||this.filterSnippylyNodes(a.removedNodes).length)});this.childListMutation$.next(r),r.push(...t.filter(a=>a.type==="attributes").filter(a=>!qi(a.target)).filter(a=>this.filterSnippylyNodes([a.target]).length).filter(a=>{if(a){let s=a.target;return s?.classList?.contains("snippyly-sidebar-panel")?!1:s?!s.getAttribute(j.VELT_IGNORE_CHANGE_DETECTION):!0}return!0})),r=r.filter(a=>{let s=!0;return Object.keys(j.INGNORE_MUTATION_OBSERVER_CHANGE_TAGS).forEach(d=>{a.target?.closest(d)&&(s=!1)}),s}),r=r.filter(a=>a.target&&To(a.target)),r.length&&this.mutation$.next(r)}catch(r){this.loggingService.catch("Error in DomService change detection: ",r)}}),this.mutationObserver.observe(document.body,{childList:!0,subtree:!0,attributes:!0}))}catch(t){this.loggingService.catch("Error in DomService change detection: ",t)}}unsetMutationObserver(){try{this.mutationObserver&&(this.mutationObserver.disconnect(),this.mutationObserver=null)}catch(e){this.loggingService.catch("Error in DomService unsetMutationObserver: ",e)}}detectNetworkStatusChange(){this.loggingService.log("%c[WB] Calling FUNCTION: detectNetworkStatusChange","color: green;");try{ao(mi(window,"offline").pipe(de(()=>!1)),mi(window,"online").pipe(de(()=>!0)),new Lt(e=>{e.next(navigator.onLine),e.complete()})).subscribe(e=>{this.networkStatus$.next(e)})}catch(e){this.loggingService.catch("Error in DomService detectNetworkStatusChange: ",e)}}onWindowResize(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowResize","color: green;");try{this.unsubscribeFromWindowResize(),this.unlistenWindowResize=this.renderer.listen("window","resize",e=>{this.windowResize$.next(e);let t=this.calculateScreenSize();this.deviceInfo$.next(new Gn),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()!==j.TAGS.SUPERFLOW_TOOLBAR&&(this.documentClick$.next(e),this.documentClickSubject$.next(e))},document.addEventListener("click",this.documentClickListener,!0)}catch(e){this.loggingService.catch("Error in DomService onDocumentClick: ",e)}}unsubscribeFromDocumentClick(){try{this.documentClickListener&&typeof this.documentClickListener=="function"&&(document.removeEventListener("click",this.documentClickListener,!0),this.documentClickListener=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromDocumentClick: ",e)}}onDocumentFocus(){this.loggingService.log("%c[WB] Calling FUNCTION: onDocumentFocus","color: green;");try{this.unsubscribeFromDocumentFocus(),this.documentFocusListener=e=>{this.documentFocus$.next(e)},document.addEventListener("focus",this.documentFocusListener,!0)}catch(e){this.loggingService.catch("Error in DomService onDocumentFocus: ",e)}}unsubscribeFromDocumentFocus(){try{this.documentFocusListener&&typeof this.documentFocusListener=="function"&&(document.removeEventListener("focus",this.documentFocusListener,!0),this.documentFocusListener=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromDocumentFocus: ",e)}}onWindowKeydownShift(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeydownShift","color: green;");try{this.unsubscribeFromWindowKeydownShift(),this.unlistenWindowKeydownShift=this.renderer.listen("window","keydown.shift",e=>{this.windowKeydownShift$.next(e),this.windowKeyupShift$.next(null)})}catch(e){this.loggingService.catch("Error in DomService onWindowKeydownShift: ",e)}}unsubscribeFromWindowKeydownShift(){try{this.unlistenWindowKeydownShift&&typeof this.unlistenWindowKeydownShift=="function"&&(this.unlistenWindowKeydownShift(),this.unlistenWindowKeydownShift=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromWindowKeydownShift: ",e)}}onWindowKeyupShift(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeyupShift","color: green;");try{this.unsubscribeFromWindowKeyupShift(),this.unlistenWindowKeyupShift=this.renderer.listen("window","keyup.shift",e=>{this.windowKeyupShift$.next(e),this.windowKeydownShift$.next(null)})}catch(e){this.loggingService.catch("Error in DomService onWindowKeyupShift: ",e)}}unsubscribeFromWindowKeyupShift(){try{this.unlistenWindowKeyupShift&&typeof this.unlistenWindowKeyupShift=="function"&&(this.unlistenWindowKeyupShift(),this.unlistenWindowKeyupShift=null)}catch(e){this.loggingService.catch("Error in DomService unsubscribeFromWindowKeyupShift: ",e)}}onWindowKeydown$(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeydown$","color: green;");try{return mi(window,"keydown")}catch(e){return this.loggingService.catch("Error in DomService onWindowKeydown$: ",e),Ug}}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),r=e.target;if(t?.includes("name()='svg'")){let C=this.getXPath(t);C&&(r=C.iterateNext()||e.target)}let a=r.getBoundingClientRect(),s=e.clientX-a.x,d=e.clientY-a.y,p=s*100/(a.width||1),u=d*100/(a.height||1);this.currentMousePosition.element={xpath:t,topPercentage:u,leftPercentage:p}}else this.currentMousePosition.element=null;this.currentMousePosition$.next(this.currentMousePosition)}catch(t){this.loggingService.catch("Error in DomService updateCurrentMousePosition: ",t)}}getTargetElementForCursorPosition(e,t=!0,r=!1,a=!0,s){try{let d=e,p=d?.touches?.length?d.touches[0]?.clientX:d.clientX,u=d?.touches?.length?d.touches[0]?.clientY:d.clientY,C=this.getBackgroundElement(p,u,t,r);if(C&&s&&typeof s=="function"&&(C=s(C)),C){let E=this.getXPath(C),D=this.getXPath(C,!0),L=C.getBoundingClientRect(),G=p-L.x,Y=u-L.y,ne=G*100/(L.width||1),ge=Y*100/(L.height||1),ye={xpath:E,fXpath:D,leftPercentage:ne,topPercentage:ge};if(a){let Re=this.getXPath(C,!0,!0);ye.cfXpath=Re}return ye}else return null}catch(d){return this.loggingService.catch("Error in DomService getTargetElementForCommentPinAnnotation: ",d),null}}getBackgroundElement(e,t,r=!0,a=!1){try{let s=document.elementsFromPoint(e,t),d=[];s.forEach(u=>{qi(u)?d=[]:To(u)&&d.push(u)}),a&&(d=d.filter(u=>this.isElementVisibleOnScreen(u)));let p=0;return r||d?.forEach((u,C)=>{u.tagName.toLowerCase()==="svg"&&(p=C)}),d[p]}catch(s){return this.loggingService.catch("Error in DomService getBackgroundElement: ",s),null}}getBackgroundVeltElement(e,t){try{let r=document.elementsFromPoint(e,t),a=[];return r.forEach(s=>{qi(s)&&To(s)&&a.push(s)}),a[0]}catch(r){return this.loggingService.catch("Error in DomService getBackgroundSnippylyElement: ",r),null}}setPointerPosition(e){this.loggingService.log("%c[WB] Calling FUNCTION: setPointerPosition","color: green;");try{this.previousMousePosition.pageX=e.pageX,this.previousMousePosition.pageY=e.pageY,this.currentMousePosition.pageX=e.pageX,this.currentMousePosition.pageY=e.pageY}catch(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,r=Math.min(t,e.width/2),a=Math.abs(e.y),s=e.y-20;return a>50&&(s=Math.abs(e.y)+180),this.loggingService.log(e),this.loggingService.log(r),this.loggingService.log(s),{topPositionX:r,topPositionY:s}}catch(e){return this.loggingService.catch("Error in DomService getTopLeftPosition: ",e),{topPositionX:0,topPositionY:0}}}toggleSelection(){this.enableRectSelectionSubject$.next(!this.enableRectSelectionSubject$.value)}enableSelection(){this.enableRectSelectionSubject$.next(!0)}disableSelection(){this.enableRectSelectionSubject$.next(!1)}setPinHighlighterClass(e){this.pinHighlighterClass$.next(e)}setTextHighlighterClass(e){this.textHighlighterClass$.next(e)}getTextHighlighterClass(){return this.textHighlighterClass$.asObservable()}enableCommentPinHighlighter(){this.commentPinHighlighter$.next(!0)}disableCommentPinHighlighter(){this.commentPinHighlighter$.next(!1)}getCommentPinHighlighter$(){return this.commentPinHighlighter$.asObservable()}getCommentPinHighlighter(){return this.commentPinHighlighter$?.value}highlightElement(e,t,r){if(e){if(!r&&this.getCommentPinHighlighter()&&(this.pinHighlighterClass$.value?this.addClassToElement(e,this.pinHighlighterClass$.value):this.addClassToElement(e,j.SNIPPYLY_HIGHLIGHT)),t&&!e.hasAttribute(j.ATTRIBUTES.DEFAULT_CURSOR)){let a=e.style.getPropertyValue("cursor"),s=e.style.getPropertyPriority("cursor"),d=a?{defaultCursorValue:a,defaultCursorPriority:s}:"";e.setAttribute(j.ATTRIBUTES.DEFAULT_CURSOR,d?JSON.stringify(d):""),e.style.setProperty("cursor",t,"important")}e.setAttribute(j.SNIPPYLY_HIGHLIGHT,"true"),e.setAttribute(j.VELT_IGNORE_CHANGE_DETECTION,"true")}}removeHighlightFromElement(e){if(e&&(this.pinHighlighterClass$.value&&this.removeClassFromElement(e,this.pinHighlighterClass$.value),this.removeClassFromElement(e,j.SNIPPYLY_HIGHLIGHT),e.removeAttribute(j.SNIPPYLY_HIGHLIGHT),e.removeAttribute(j.VELT_IGNORE_CHANGE_DETECTION),e.hasAttribute(j.ATTRIBUTES.DEFAULT_CURSOR))){try{if(e.style.removeProperty("cursor"),e.getAttribute(j.ATTRIBUTES.DEFAULT_CURSOR)){let t=JSON.parse(e.getAttribute(j.ATTRIBUTES.DEFAULT_CURSOR));e.style.setProperty("cursor",t.defaultCursorValue,t.defaultCursorPriority)}}catch{}e.removeAttribute(j.ATTRIBUTES.DEFAULT_CURSOR)}}highlightUserElement(e,t,r,a=!1){try{e&&(this.addClassToElement(e,j.VELT_LIVE_SELECTION_ON_ELEMENT),a&&this.addClassToElement(e,j.VELT_LIVE_SELECTION_ON_ELEMENT_DEFAULT),e.setAttribute(j.SNIPPYLY_HIGHLIGHT,"true"),e.setAttribute(j.VELT_IGNORE_CHANGE_DETECTION,"true"),t&&!e.style.getPropertyValue(j.VELT_SELECTION_COLOR)&&e.style.setProperty(j.VELT_SELECTION_COLOR,t),r&&e.setAttribute(j.SNIPPYLY_HIGHLIGHT_USER_NAME,r))}catch(s){this.loggingService.catch("Error in DomService highlightUserElement: ",s)}}removeHighlightUserFromElement(e){try{e&&(this.removeClassFromElement(e,j.VELT_LIVE_SELECTION_ON_ELEMENT),this.removeClassFromElement(e,j.VELT_LIVE_SELECTION_ON_ELEMENT_DEFAULT),e.removeAttribute(j.SNIPPYLY_HIGHLIGHT),e.removeAttribute(j.VELT_IGNORE_CHANGE_DETECTION),e.removeAttribute(j.VELT_SELECTION_COLOR),e.removeAttribute(j.SNIPPYLY_HIGHLIGHT_USER_NAME),e.style.removeProperty(j.VELT_SELECTION_COLOR))}catch(t){this.loggingService.catch("Error in DomService removeHighlightUserFromElement: ",t)}}previewHighlightElement(e){e&&e.setAttribute(j.SNIPPYLY_HIGHLIGHT_PREVIEW,"true")}removePreviewHighlightFromElement(e){e&&e.removeAttribute(j.SNIPPYLY_HIGHLIGHT_PREVIEW)}getXPath(e,t=!1,r=!1,a){try{let s=this.calculateXPath(e,t,r,a);if(s&&typeof s=="string"&&s.includes("/svg")){let d=s.split("/"),p=!1;d.forEach((u,C)=>{u.includes("svg")&&(p=!0),p&&(d[C]="svg:"+u)}),s=d.join("/")}return s}catch(s){this.loggingService.catch("Error in DomService getXPath:",s)}}namespaceResolver(e){return e==="svg"?"http://www.w3.org/2000/svg":null}calculateXPath(e,t,r,a){try{if(e){if(typeof e=="string")return document.evaluate(e,a||document,this.namespaceResolver,XPathResult.ANY_TYPE,null);if(!e||e.nodeType!=1)return"";if(e.id&&document.querySelectorAll(`[id='${e.id}']`)?.length===1&&!t)return"//*[@id='"+e.id+"']";if(r&&e.className&&e.className.split){let d=e.className?.split(" ")?.filter(p=>!p?.includes("snippyly")&&!p?.includes("velt")&&!["show-pin-cursor"].includes(p))[0];if(d){let p=this.calculateXPath(e.parentNode,t,r,a)+"/"+e.tagName.toLowerCase(),u=Array.from(e.parentNode?.children||[]).filter(C=>C.nodeType===1&&C.tagName===e.tagName?C.className?.split(" ")?.filter(D=>D?.includes("snippyly")||D?.includes("velt")||["show-pin-cursor"].includes(D))[0]===d:!1);if(u.length>1){let C=u.indexOf(e)+1;p+=`[contains(concat(' ', normalize-space(@class), ' '), ' ${d} ')][${C}]`}else p+=`[contains(concat(' ', normalize-space(@class), ' '), ' ${d} ')]`;return p}}let s=[].filter.call(e.parentNode?.children?e.parentNode?.children:[],function(d){return d.tagName==e.tagName});return this.calculateXPath(e.parentNode,t,r)+"/"+e.tagName.toLowerCase()+(s.length>1?"["+([].indexOf.call(s,e)+1)+"]":"")}}catch(s){this.loggingService.catch("Error in DomService calculateXPath:",s)}}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 r=this.getXPath(e,!1,!1,t);if(r){let a=r?.iterateNext();if(a!==null&&typeof a.setAttribute=="function"){let s=vn();a.setAttribute(j.ATTRIBUTES.VELT_ELEMENT_CACHE_ID,s),this.xpathCacheId.set(s,e)}return this.xpathCache.set(e,a),a}return null}catch(r){return this.loggingService.catch("Error in DomService getElementFromXPath:",r),null}}calculateScreenSize(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowResize","color: green;");try{let e=[document?.body?.clientHeight||0,document?.documentElement?.clientHeight||0,window?.innerHeight||0],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 r=new ub;return r.screenWidth=Math.max(...t),r.screenHeight=Math.max(...e),r.screenScrollHeight=this.pageScrollHeight,r}catch(e){return this.loggingService.catch("Error in DomService calculateScreenSize:",e),new ub}}calculatePageScrollHeight(){this.loggingService.log("%c[WB] Calling FUNCTION: calculatePageScrollHeight","color: green;");try{this.pageScrollHeight=0,this.findLongestNode(document?.documentElement?.childNodes)}catch(e){this.loggingService.catch("Error in DomService calculatePageScrollHeight: ",e)}}removeSnippylyContent(e){this.loggingService.log("%c[WB] Calling FUNCTION: removeSnippylyContent","color: green;");try{let r=new DOMParser().parseFromString(e,"text/html");r.querySelectorAll("[data-snippyly-cache-id]").forEach(E=>{E.removeAttribute("data-snippyly-cache-id")}),r.querySelectorAll("[data-velt-cache-id]").forEach(E=>{E.removeAttribute("data-velt-cache-id")}),r.querySelectorAll(".comment-text-highlight").forEach(E=>{E?.parentNode?.insertBefore(document.createTextNode(E?.textContent),E),E.remove()});let p=document.createNodeIterator(r,NodeFilter.SHOW_COMMENT),u;for(;u=p.nextNode();)u?.remove();return this.mergeAdjacentTextNodes(r.body),this.sanitizeHtml(r.body.innerHTML)}catch(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 r=t.nextSibling;for(;r&&r.nodeType===Node.TEXT_NODE;)t.textContent+=r.textContent,r.remove(),r=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 r=Math.max(e[t]?.scrollHeight,e[t]?.clientHeight);this.pageScrollHeight=Math.max(r,this.pageScrollHeight),this.nodeMap[r]=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 r=Array.from(document.querySelectorAll(`[${j.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`)),a=this.getDraftCommentAnnotationDialogs()||[];r.push(...a),r=Array.from(new Set(r));let s=r.map(C=>C.classList.contains("velt-annotation-draft-checked")?(C.classList.remove("velt-annotation-draft-checked"),null):(this.removeClassFromElement(C,"velt-comment-dialog-shake"),setTimeout(()=>{this.addClassToElement(C,"velt-comment-dialog-shake"),C.getAttribute(j.ATTRIBUTES.VELT_ANNOTATION_EDIT_COMMENT)||C.classList.contains("velt-annotation-draft-checked")||this.addClassToElement(C,"velt-annotation-draft-checked")},100),C.getAttribute(j.ATTRIBUTES.VELT_ANNOTATION_DRAFT))).filter(C=>C),d=Object.keys(this.getRecordingInProgress()||{});s=[...s,...d];let p=this.selectedAnnotationsMap$.value;if(e&&this.selectedAnnotationsMap$.value&&Object.keys(this.selectedAnnotationsMap$.value).length){let C=[];Object.keys(p).forEach(E=>{if(p[E]?.type==="tag"){let D=p[E];D?.to?.length||s.includes(E)||C.push(D)}else p[E]?.comments?.length||s.includes(E)||C.push(p[E])}),this.deleteAnnotations$.next(C),this.deleteAnnotations$.next([])}let u={};Object.keys(p).forEach(C=>{if(s.includes(C)&&(u[C]=p[C]),t)switch(t){case"comment":["comment","videoPin"].includes(p[C]?.type)||(u[C]=p[C]);break;default:p[C]?.type!==t&&(u[C]=p[C]);break}}),Object.keys(u).forEach(C=>{let E=u[C]?.multiThreadAnnotationId;E&&!u[E]&&(u[E]={annotationId:E,type:"multiThread"})}),JSON.stringify(this.selectedAnnotationsMap$.value)!==JSON.stringify(u)&&this.selectedAnnotationsMap$.next(u),this.setDialogOpenedInSidebar(!1)}catch(r){this.loggingService.catch("Error in DomService resetSelectedAnnotationsMap: ",r)}}setRecordingInProgress(e,t){try{if(t)this.recordingInProgress$.next(T(I({},this.recordingInProgress$.value),{[e]:t}));else{let r=this.recordingInProgress$.value;delete r[e],this.recordingInProgress$.next(r)}}catch(r){this.loggingService.catch("Error in DomService setRecordingInProgress: ",r)}}resetRecordingInProgress(){try{this.recordingInProgress$.next({})}catch(e){this.loggingService.catch("Error in DomService resetRecordingInProgress: ",e)}}getRecordingInProgress(){try{return this.recordingInProgress$.value}catch(e){return this.loggingService.catch("Error in DomService getRecordingInProgress: ",e),{}}}getDraftCommentAnnotationDialogs(){try{let e=[];return Array.from(document.querySelectorAll(`${j.TAGS.SNIPPYLY_COMMENT_DIALOG}`)).forEach(r=>{if(r?.shadowRoot){let a=r.shadowRoot.querySelector(`[${j.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);a&&e.push(a)}else{let a=r.querySelector(`${j.TAGS.VELT_SHADOW_DOM_INTERNAL}`);if(a?.shadowRoot){let s=a.shadowRoot?.querySelector(`[${j.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);s&&e.push(s)}else{let s=r.querySelector(`[${j.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);s&&e.push(s)}}}),e}catch(e){return this.loggingService.catch("Error in DomService getDraftCommentAnnotationDialogs: ",e),[]}}getSelectedAnnotationsMap(e){try{let t=this.selectedAnnotationsMap$.value;if(e){let r={};return Object.keys(t).forEach(a=>{switch(e){case"comment":["comment","videoPin"].includes(t[a].type)&&(r[a]=t[a]);break;default:t[a].type===e&&(r[a]=t[a]);break}}),r}else return t}catch(t){return this.loggingService.catch("Error in DomService getSelectedAnnotationsMap: ",t),{}}}getSelectedAnnotationsMap$(e){return this.selectedAnnotationsMap$.asObservable().pipe(de(t=>{if(e){let r={};return Object.keys(t).forEach(a=>{t[a].type===e&&(r[a]=t[a])}),r}else return t}))}getSelectedComments$(){return this.selectedAnnotationsMap$.asObservable().pipe(de(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,r,a=!1,s){try{r==="sidebarShowReplies"?this.setDialogOpenedInSidebar(!0):this.setDialogOpenedInSidebar(!1);let d=JSON.parse(JSON.stringify(this.selectedAnnotationsMap$.value||{})),p=JSON.parse(JSON.stringify(this.selectedAnnotationsLocationMap$.value||{}));d[e.annotationId]&&!a?delete d[e.annotationId]:((!this.windowKeydownShift$.value||a)&&(d={}),d[e.annotationId]=e,p[e.annotationId]=t,s=e?.multiThreadAnnotationId||s,s&&(d[s]={annotationId:s,type:"multiThread"},p[s]=t)),this.selectedAnnotationsMap$.next(d),Object.keys(p).forEach(u=>{d[u]||delete p[u]}),this.selectedAnnotationsLocationMap$.next(p)}catch(d){this.loggingService.catch("Error in DomService toggleAnnotationSelection: ",d)}}setSelectedAnnotationLocation(e,t){try{let r=JSON.parse(JSON.stringify(this.getSelectedAnnotationsLocationMap()||{}));r?.[e]!==t&&(r[e]=t,this.selectedAnnotationsLocationMap$.next(r))}catch(r){this.loggingService.catch("Error in DomService setSelectedAnnotationLocation: ",r)}}updateSelectedAnnotationInMap(e){try{let t=this.selectedAnnotationsMap$.value;e.forEach(r=>{t[r.annotationId]&&(t[r.annotationId]=r)}),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),se([])}}getHighestNode(){return this.loggingService.log("%c[WB] Calling FUNCTION: getHighestNode","color: green;"),this.highestNode}onWindowMouseDown$(){return this.windowMouseDown$.asObservable()}onWindowPointerMove$(){return this.windowPointerMove$.asObservable()}onWindowPointerMove(){return this.windowPointerMove$.value}onWindowPointerUp$(){return this.windowPointerUp$.asObservable()}onSelectionChange$(){return this.documentSelectionChange$.asObservable()}onWindowClick$(){return this.windowClick$.asObservable()}onWindowScroll$(){return this.windowScroll$.asObservable()}onWindowResize$(){return this.windowResize$.asObservable()}onWindowKeyupBackspace$(){return this.windowKeyupBackspace$.asObservable()}onWindowKeyupDelete$(){return this.windowKeyupDelete$.asObservable()}onWindowKeyupEsc$(){return this.windowKeyupEsc$.asObservable()}onWindowPopState$(){return this.windowPopState$.asObservable()}onDocumentClick$(){return this.documentClick$.asObservable()}getLastDocumentClick(){return this.documentClick$.value}onDocumentClickSubject$(){return this.documentClickSubject$.asObservable()}onDocumentFocus$(){return this.documentFocus$.asObservable()}onDomChange$(e){try{return this.mutationObserver||this.setMutationObserver(e),this.mutation$.asObservable()}catch(t){return this.loggingService.catch("Error in DomService onDomChange$: ",t),se([])}}getChildListMutation$(){return this.childListMutation$.asObservable()}onNetworkStatusChange$(){return this.networkStatus$.asObservable()}getElementOffset(e,t){try{let r={offsetTop:0,offsetLeft:0},a=e;if(a===t){let s=window.getComputedStyle(e);s.position==="static"&&s.transformStyle!="preserve-3d"&&s.transform=="none"&&(r.offsetLeft=e?.offsetLeft||0,r.offsetTop=e?.offsetTop||0)}if(a!==t)if(e?.closest("svg"))for(;a&&a!==t;){let d=window.getComputedStyle(a);if(a.tagName.toLowerCase()==="svg"||a instanceof SVGElement){let p=a.parentElement;if(p){let u=p.getBoundingClientRect(),C=a.getBoundingClientRect();r.offsetLeft+=C.left-u.left,r.offsetTop+=C.top-u.top}}else d.position==="static"?d.transformStyle!="preserve-3d"&&d.transform=="none"&&(r.offsetLeft+=a?.offsetLeft||0,r.offsetTop+=a?.offsetTop||0):(r.offsetLeft+=a.offsetLeft,r.offsetTop+=a.offsetTop);if(a=a.parentElement,e instanceof SVGElement&&a===t){let p=window.getComputedStyle(a);p.position==="static"&&p.transformStyle!="preserve-3d"&&p.transform=="none"&&(r.offsetLeft+=a?.offsetLeft||0,r.offsetTop+=a?.offsetTop||0)}}else{let d=window.getComputedStyle(a);d.position==="static"?d.transformStyle!="preserve-3d"&&d.transform=="none"&&(r.offsetLeft+=a?.offsetLeft||0,r.offsetTop+=a?.offsetTop||0):(r.offsetLeft+=a.offsetLeft,r.offsetTop+=a.offsetTop)}return r}catch(r){return this.loggingService.catch("Error in DomService getElementOffset: ",r),{offsetTop:0,offsetLeft:0}}}isElementVisible(e){try{if(typeof e?.getBoundingClientRect=="function"){let{width:t,height:r,top:a,bottom:s}=e?.getBoundingClientRect();return t>0||r>0||a<window.innerHeight&&s>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,r=window.getComputedStyle(t);return!(r.display==="none"||r.visibility==="hidden"||parseFloat(r.opacity)===0)}return!1}catch(t){return this.loggingService.catch("Error in DomService isElementVisibleOnScreen: ",t),!1}}getClickAndDragPointsObservable(){return new Lt(e=>{let t=mi(document,"mousedown").pipe(de(p=>({type:p.type,x:p.clientX+window.scrollX,y:p.clientY+window.scrollY,event:p}))),r=mi(document,"mousemove").pipe(de(p=>({type:p.type,x:p.clientX+window.scrollX,y:p.clientY+window.scrollY,event:p}))),a=mi(document,"mouseup").pipe(de(p=>({type:p.type,x:p.clientX+window.scrollX,y:p.clientY+window.scrollY,event:p}))),d=t.pipe(he(p=>r.pipe(Ri(),de(([u,C])=>({startPoint:p,prevPoint:u,curPoint:C})),so(a)))).subscribe(e);return()=>d.unsubscribe()})}drawRectangle(e,t){let r=document.querySelector(".rectangle");r||(r=document.createElement("div"),this.addClassToElement(r,"rectangle"),r.setAttribute(j.ATTRIBUTES.VELT_COMMENT_DISABLED,"true"),r.setAttribute(j.VELT_IGNORE_CHANGE_DETECTION,"true"),document.body.appendChild(r));let a=Math.abs(t.x-e.x),s=Math.abs(t.y-e.y),d=Math.min(e.x,t.x),p=Math.min(e.y,t.y);return r.style.width=`${a}px`,r.style.height=`${s}px`,r.style.left=`${d}px`,r.style.top=`${p}px`,r.style.position="absolute",r.style.border="2px dashed #f00",r.style.pointerEvents="none",r.style.zIndex="2147483577",r}getRange(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: getRange","color: green;"),window.getSelection()?.toString()){let e=window.getSelection();if(e?.rangeCount)return e.getRangeAt(0)}return null}catch(e){return this.loggingService.catch("Error in DomService getRange: ",e),null}}clearTextSelection(){try{this.loggingService.log("%c[WB] Calling FUNCTION: clearTextSelection","color: green;"),window.getSelection&&(window.getSelection()?.empty?window.getSelection()?.empty():window.getSelection()?.removeAllRanges&&window.getSelection()?.removeAllRanges())}catch(e){this.loggingService.catch("Error in DomService clearTextSelection: ",e)}}getTargetTextRangeFromSelectionRange(e){try{let t={},r=e.commonAncestorContainer;r?.nodeType===Node.TEXT_NODE&&(r=r.parentElement);let a=document.body;if(r){let d=this.getTextXPath(r);this.isXpathWithId(d)&&(a=r)}let s=this.getAdditionalLocationContainer(r);if(s&&(a=s),t.commonAncestorContainer=this.getTextXPath(a),t.commonAncestorContainer){let d=this.getElementFromXPath(t.commonAncestorContainer);d&&(t.commonAncestorContainerFXpath=this.getXPath(d,!0),t.commonAncestorContainerCFXpath=this.getXPath(d,!0,!0))}return t.text=e.toString(),t.occurrence=Ku(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,r=e.previousSibling;for(;r;)r.nodeType===Node.TEXT_NODE&&t++,r=r.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(j.NON_NESTABLE_ELEMENTS[e?.tagName?.toLowerCase()]){let r=e?.closest("picture");return r?r?.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(`[${j.ATTRIBUTES.VELT_LOCATION}], [${j.ATTRIBUTES.VELT_LOCATION_ID}]`)}catch(t){return this.loggingService.catch("Error in DomService isElementInsideAdditionalLocationContainer: ",t),!1}}getAdditionalLocationContainer(e){try{return e?.closest(`[${j.ATTRIBUTES.VELT_LOCATION}], [${j.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:r}){try{let a=[];if(e?.length)for(let s=0;s<e.length;s++){let d=document.getElementById(e[s]);d&&a.push(d)}if(t?.length)for(let s=0;s<t.length;s++){let d=document.getElementsByClassName(t[s]);for(let p=0;p<d.length;p++){let u=d[p];u&&u instanceof HTMLElement&&a.push(u)}}if(r?.length)for(let s=0;s<r.length;s++){let d=document.querySelectorAll(r[s]);for(let p=0;p<d.length;p++){let u=d[p];u&&u instanceof HTMLElement&&a.push(u)}}return a}catch(a){return this.loggingService.catch("Error in DomService getListedElements: ",a),[]}}isElementInsideListedElementIds(e,t){try{if(t?.length){for(let r=0;r<t.length;r++){let a=document.getElementById(t[r]);if(a&&a.contains(e))return!0}return!1}return!0}catch(r){return this.loggingService.catch("Error in DomService isElementInsideListedElementIds: ",r),!1}}isElementInsideListedElementClassNames(e,t){try{if(t?.length){for(let r=0;r<t.length;r++){let a=document.getElementsByClassName(t[r]);for(let s=0;s<a.length;s++)if(a[s].contains(e))return!0}return!1}return!0}catch(r){return this.loggingService.catch("Error in DomService isElementInsideListedElementClassNames: ",r),!1}}isElementInsideListedElementQuerySelectors(e,t){try{if(t?.length){for(let r=0;r<t.length;r++){let a=document.querySelectorAll(t[r]);for(let s=0;s<a.length;s++)if(a[s].contains(e))return!0}return!1}return!0}catch(r){return this.loggingService.catch("Error in DomService isElementInsideListedElementQuerySelectors: ",r),!1}}addClassToElement(e,t){try{this.loggingService.log("%c[WB] Calling FUNCTION: addClassToElement","color: green;"),e&&(e.classList?.contains(t)||e.classList?.add(t))}catch(r){this.loggingService.catch("Error in DomService addClassToElement: ",r)}}removeClassFromElement(e,t){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeClassFromElement","color: green;"),e&&e.classList?.contains(t)&&e.classList?.remove(t)}catch(r){this.loggingService.catch("Error in DomService removeClassFromElement: ",r)}}isElementInsideParentWithAttribute(e,t,r){try{let a=e;for(;a&&a!==document.body;){if(a?.getAttribute&&a?.getAttribute(t)===r)return!0;a=a.parentElement}return!1}catch(a){return this.loggingService.catch("Error in DomService isElementInsideParentWithAttribute: ",a),!1}}setVideoEditorHandlingDelete(e){try{this.isVideoEditorHandlingDelete=e}catch(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),se(null)}}injectCustomCss(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: injectCustomCss","color: green;");let t=this.customCss$.value;if(t){let r=e?.shadowRoot?.querySelector(`[${j.VELT_CUSTOM_CSS}]`);if(r&&r.remove(),t?.type==="link"){let a=document.createElement("link");a.href=t?.value,a.rel="stylesheet",a.setAttribute(j.VELT_CUSTOM_CSS,"true"),e?.shadowRoot?.appendChild(a)}else{let a=document.createElement("style");a.innerHTML=this.sanitizeHtml(t?.value),a.setAttribute(j.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 r=t.innerHTML;return r=r.replace(o.MULTIPLE_NBSP_REGEX," ").replace(o.TRIM_NBSP_REGEX,"").trim(),r}catch(t){return this.loggingService.catch("Error in DomService trimCommentHtml: ",t),e}}removeEmptyElements(e){try{let a=function(s){return r.test(s.innerHTML)};var t=a;let r=/^\s*(<br\s*\/?>)?\s*$/;for(;e.firstChild&&a(e.firstChild);)e.removeChild(e.firstChild);for(;e.lastChild&&a(e.lastChild);)e.removeChild(e.lastChild)}catch(r){this.loggingService.catch("Error in DomService removeEmptyElements: ",r)}}normalizeWhitespace(e){try{e.childNodes.forEach(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;"),pz.sanitize(e,yce)}catch(t){return this.loggingService.catch("Error in DomService sanitizeHtml: ",t),""}}sanitizeSvg(e){try{return pz.sanitize(e,yce)}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 Gn;this.deviceInfo$.next(e)}catch(e){this.loggingService.catch("Error in DomService setDeviceInfo: ",e)}}getDeviceInfo$(){try{return this.loggingService.log("%c[WB] Calling FUNCTION: getDeviceInfo$","color: green;"),this.deviceInfo$.asObservable()}catch(e){return this.loggingService.catch("Error in DomService getDeviceInfo$: ",e),se(new Gn)}}getTabId(){try{let e=sessionStorage.getItem(j.SESSION_STORAGE.VELT_TAB_ID),t=this.getTabIdFromWindowName();return(!e||e!==t)&&(e=vn(),sessionStorage.setItem(j.SESSION_STORAGE.VELT_TAB_ID,e),this.setTabIdToWindowName(e)),e}catch(e){return this.loggingService.catch("Error in DomService getTabId: ",e),null}}getTabIdFromWindowName(){try{return window.name}catch(e){return this.loggingService.catch("Error in DomService getTabIdFromWindowName: ",e),null}}setTabIdToWindowName(e){try{window.name=e}catch(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 Gn}}isMobileDevice(){try{return new Gn().getDeviceType()===tr.MOBILE}catch(e){return this.loggingService.catch("Error in DomService isMobileDevice: ",e),!1}}isTabletDevice(){try{return new Gn().getDeviceType()===tr.TABLET}catch(e){return this.loggingService.catch("Error in DomService isTabletDevice: ",e),!1}}isDesktopDevice(){try{return new Gn().getDeviceType()===tr.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(r=>{t.setAttribute(r.nodeName,r.nodeValue)}),e.childNodes.forEach(r=>{r.nodeType===Node.ELEMENT_NODE?t.appendChild(this.deepCloneElement(r)):r.nodeType===Node.TEXT_NODE&&t.appendChild(document.createTextNode(r.nodeValue))}),t}catch(r){return this.loggingService.catch("Error in DomService deepCloneElement: ",r),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(r=>{if(this.removeWireframeSuffixFromTags(r),r.tagName.toLowerCase().endsWith("-wireframe")){let a=r.tagName.toLowerCase().replace("-wireframe",""),s=document.createElement(a);for(Array.from(r.attributes).forEach(d=>{s.setAttribute(d.name,d.value)});r.firstChild;)s.appendChild(r.firstChild);r.parentNode.replaceChild(s,r)}})}isMonitorDevice(){try{return new Gn().getDeviceType()===tr.MONITOR}catch(e){return this.loggingService.catch("Error in DomService isMonitorDevice: ",e),!1}}};o.MULTIPLE_NBSP_REGEX=/(?: \s*){2,}/g,o.TRIM_NBSP_REGEX=/^(?: \s*)+|(?: \s*)+$/g,o.\u0275fac=function(t){return new(t||o)(J(Xo),J(y),J(Hs))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var je=(()=>{let o=class o{constructor(e,t,r,a,s,d,p,u){this.afAuth=e,this.configService=t,this.avatarService=r,this.coreActionsService=a,this.domService=s,this.functions=d,this.analyticsService=p,this.loggingService=u,this.user$=new ve(null),this.userOptions$=new ve(null),this.userContacts$=new ve(null),this.userOrganization$=new ve(null),this.providedUser=new Do,this.firebaseConfig$=new ve(null),this.advancedQueries$=new ve(null),this.planDetails$=new ve(null),this.signOutPreviousUser$=new ve(null),this.preSignOutFunctions=new Map,this.autoLoginCalled=!1,this.autoLoginRequired=!0,this.config=null,this.getPlanDetailsCalled=!1,this.forceReLoggedIn=!1,this.lastLoggedInUserData=null,this.sessionReLoginCount=0,this.SESSION_RE_LOGIN_COUNT_LIMIT=10,this.sessionReLoginSubscription=null,this.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(C=>{this.config=C}),this.forceReLoggedIn=localStorage.getItem(j.LOCAL_STORAGE.VELT_USER_FORCE_RE_LOGGED_IN)==="true",this.sessionReLoginSubscription=Qn(this.afAuth).pipe(Ko(this.afAuth.currentUser),Ri(),he(([C,E])=>this.domService.onNetworkStatusChange$().pipe(Le(D=>D),rt(1),de(()=>({previousUser:C,currentUser:E}))))).subscribe(D=>Q(this,[D],function*({previousUser:C,currentUser:E}){if(!E&&C){let L=C?.stsTokenManager?.expirationTime,G=new Date().getTime(),Y=L-G;G>L&&(this.analyticsService.trackEvent(X.Events.Core.SDK_SESSION_TOKEN_EXPIRED,{apiKey:this.apiKey,user:this.user$.value,lastLoggedInUserData:this.lastLoggedInUserData,timeLeft:Y,forceReset:this.userOptions$.value?.forceReset,sessionReLoginCount:this.sessionReLoginCount},!0,this.user$.value?.userSnippylyId),this.user$.value&&C?.uid===this.user$.value?.userSnippylyId&&this.lastLoggedInUserData?.user?.userSnippylyId===this.user$.value?.userSnippylyId&&(this.sessionReLoginCount>this.SESSION_RE_LOGIN_COUNT_LIMIT?(this.analyticsService.trackEvent(X.Events.Core.SDK_SESSION_RE_LOGIN_COUNT_EXCEEDED,{apiKey:this.apiKey,clientUserId:this.lastLoggedInUserData.user.userId,snippylyUserId:this.lastLoggedInUserData.user.userSnippylyId,timeLeft:Y,forceReset:this.userOptions$.value?.forceReset,sessionReLoginCount:this.sessionReLoginCount},!0,this.user$.value?.userSnippylyId),this.sessionReLoginSubscription?.unsubscribe()):(this.sessionReLoginCount++,this.analyticsService.trackEvent(X.Events.Core.SDK_SESSION_RE_LOGIN_TRIGGERED,{apiKey:this.apiKey,clientUserId:this.lastLoggedInUserData.user.userId,snippylyUserId:this.lastLoggedInUserData.user.userSnippylyId,user:this.getUserWithoutContacts(this.lastLoggedInUserData.user),timeLeft:Y,forceReset:this.userOptions$.value?.forceReset,sessionReLoginCount:this.sessionReLoginCount},!0,this.lastLoggedInUserData.user.userSnippylyId),this.initializeClient(this.lastLoggedInUserData.user,this.lastLoggedInUserData.userOptions,this.lastLoggedInUserData.initializeClientToken,this.lastLoggedInUserData.autoLogin,"internal-sessionReLogin"))))}}),C=>{this.loggingService.catch("Error in AuthService sessionReLoginSubscription: ",C)}),this.getUser$().pipe(kt(si)).subscribe(C=>{let E=Ca(C);this.coreActionsService.triggerAction(Hi.USER_UPDATE,E),this.coreActionsService.triggerAction(Hi.INIT_UPDATE,{event:Hi.USER_UPDATE,payload:{user:E}})})}catch(C){this.loggingService.catch("Error in AuthService constructor: ",C)}}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 QM),this.configService.initConfig(t),t.debugMode?sessionStorage.setItem("debugMode","true"):sessionStorage.removeItem("debugMode"),this.autoLoginCalled||Qn(this.afAuth).pipe(rt(1)).subscribe(r=>Q(this,null,function*(){if(this.autoLoginCalled=!0,r){let a=yield Dm(r,!0).catch(s=>null);if(a){let{user:s}=a?.claims;this.autoLoginRequired&&this.initializeClient(s,this.userOptions$?.value?T(I({},this.userOptions$?.value),{replaceContacts:!1,replaceGroupContacts:!1,replacePrivateContacts:!1}):{},new Date().getTime(),!0,"internal-autoLogin")}}}))}catch(r){this.loggingService.catch("Error in setApiKey: ",r)}}setUsersService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setUsersService","color: green;"),this.usersService=e}catch(t){this.loggingService.catch("Error in setUsersService: ",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(X.Events.Core.SDK_VALIDATE_CLIENT_FAILED,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,message:"Organization Id is not set",forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e)},!0,e.userSnippylyId),this.configService.getSF())this.loggingService.catch("OrganizationId is not set in Identify method",void 0,void 0,!0);else throw new Error("OrganizationId is not set in Identify method")}setVeltAuthProvider(e){return Q(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: setVeltAuthProvider","color: green;");try{this.onRetrySubscription?.unsubscribe();let t=null;e.generateToken&&typeof e.generateToken=="function"&&(t=yield e.generateToken());let r=yield Aj(()=>window.Velt.identify(e.user,I(I({},e.options||{}),t&&{authToken:t}),{fromProvider:!0}),e.retryConfig||{retryCount:0,retryDelay:0});return r&&e.generateToken&&typeof e.generateToken=="function"&&(this.onRetrySubscription=this.coreActionsService.onAction(Hi.ERROR).pipe(Le(a=>a.code==="token_expired"),rt(10)).subscribe(a=>Q(this,null,function*(){if(a.code==="token_expired"){let s=this.docService?.getDocumentIds()?.map(D=>({id:D.clientDocumentId}))??[],d=this.docService?.getOptionsFromDocumentPaths()??void 0,p=[],u=this.docService?.getLocation();u&&p.push(u.location);let C=this.docService?.getLocations();C&&Object.values(C).forEach(D=>{p.push(D.location)}),(yield Aj(()=>Q(this,null,function*(){try{let D=yield e.generateToken?.();return D?window.Velt.identify(e.user,I(I({},e.options||{}),D&&{authToken:D}),{fromProvider:!0}):!0}catch{return!1}}),e.retryConfig||{retryCount:0,retryDelay:0}))&&(yield this.docService?.setDocuments({documents:s,options:d,source:"internal"}),yield this.docService?.setLocations({locations:p,source:"internal",options:{appendLocation:!u}}))}}))),r}catch(t){return this.loggingService.catch("Error in setVeltAuthProvider: ",t),null}})}initializeClient(e,t,r,a,s){return Q(this,null,function*(){try{if(this.autoLoginRequired=!1,this.userOptions$.next(t),this.initializeClientToken)this.pendingUserLogin=e,this.pendingUserLoginSource=s;else{e.userSnippylyId=Ev(this.configService.getApiKey(),e.userId),this.pendingUserLogin=void 0,this.pendingUserLoginSource=void 0,this.initializeClientToken=r;let d=yield Qn(this.afAuth).pipe(rt(1)).toPromise().catch(u=>null),p=!0;if(this.providedUser=JSON.parse(JSON.stringify(e)),d){let u=yield Dm(d,!0).catch(D=>null);if(!u)return;let{user:C,firebaseConfig:E}=u.claims;if(d?.uid!==e?.userSnippylyId||e?.groupId!==C?.groupId||e?.organizationId!==C?.organizationId||t?.forceReset||!a&&e?.organizationId&&!this.forceReLoggedIn||this.forceReLoginRequiredForAdvancedQueries(e)||this.forceReLoginRequiredForRegion(e,E))localStorage.setItem(j.LOCAL_STORAGE.VELT_USER_FORCE_RE_LOGGED_IN,"true"),this.forceReLoggedIn=!0,yield this.signOutUser("internal");else{this.loggingService.log("%c[WB] Calling FUNCTION: reinitializeCurrentUser","color: green;"),this.loggingService.log("Keeping user");let D=yield Dm(d,!0).catch(ne=>null);if(!D)return;let{firebaseConfig:L,user:G,advancedQueries:Y}=D.claims;this.validateOrganizationId(e),this.setFirebaseConfig(L),this.setAdvancedQueries(Y),G&&(this.providedUser.isAdmin=!!G.isAdmin),this.initializeSignedInUser(d,a),p=!1,this.analyticsService.trackEvent(X.Events.Core.SDK_USER_AUTH_SUCCESS,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,authType:"auto",forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e),source:s})}}if(p){this.analyticsService.trackEvent(X.Events.Core.SDK_VALIDATE_CLIENT_TRIGGERED,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e),source:s},!0,e.userSnippylyId,e.userId);let u=yr(this.functions,br({url:ni.cloudFunction.validateClient,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:20*60*1e3}),C=fa(),E=(yield u({apiKey:this.apiKey,user:e,version:C,authToken:t?.authToken}))?.data;if(E.error){if(this.analyticsService.trackEvent(X.Events.Core.SDK_VALIDATE_CLIENT_FAILED,T(I({apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,message:E.error,forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e)},E),{source:s}),!0,e.userSnippylyId,e.userId),E.error&&typeof E.error=="string")if(E.error?.toLowerCase()?.includes("token expired"))if(this.tokenExpiredErrorCount++,this.tokenExpiredErrorCount<=this.TOKEN_EXPIRED_ERROR_COUNT_LIMIT){let D={code:"token_expired",message:"Token expired",error:E?.error,source:E?.source};this.coreActionsService.triggerAction(Hi.ERROR,D)}else{let D={code:"too_many_retries",message:"Token expired. Too many retries.",error:E?.error,source:E?.source};this.coreActionsService.triggerAction(Hi.ERROR,D),this.analyticsService.trackEvent(X.Events.Core.SDK_JWT_EXPIRED_RETRY_EXCEEDED,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,forceReset:this.userOptions$.value?.forceReset,source:s},!0,e.userSnippylyId,e.userId)}else{let D=E;this.coreActionsService.triggerAction(Hi.ERROR,D)}throw E}else this.tokenExpiredErrorCount=0;if(this.analyticsService.trackEvent(X.Events.Core.SDK_VALIDATE_CLIENT_SUCCESS,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e),source:s},!0,e.userSnippylyId,e.userId),this.validateOrganizationId(e),E.firebaseConfig){this.setFirebaseConfig(E.firebaseConfig),yield this.signInWithCustomToken(e,E.token),this.loggingService.log("new signed in user",this.afAuth.currentUser);let D=yield Dm(this.afAuth.currentUser,!0).catch(Y=>null);if(!D)return;let{user:L,advancedQueries:G}=D.claims;this.setAdvancedQueries(G),this.providedUser.isAdmin=!!L?.isAdmin,this.initializeSignedInUser(this.afAuth.currentUser,a)}}this.initializeClientToken=0,this.lastLoggedInUserData={user:e,userOptions:t,initializeClientToken:r,autoLogin:a},this.checkForPendingLogin()}return e}catch(d){return this.initializeClientToken=0,this.checkForPendingLogin(),this.loggingService.catch("Error in initializeClient: ",d),Promise.resolve(null)}})}isVersionGreaterThanOrEqualTo4(){try{let e=fa();return(e?parseInt(e.split(".")?.[0]||"0"):0)>=4}catch(e){return this.loggingService.catch("Error in isVersionGreaterThanOrEqualTo4: ",e),!1}}forceReLoginRequiredForAdvancedQueries(e){try{let t=this.isVersionGreaterThanOrEqualTo4(),r=!1;try{let a=localStorage.getItem(j.LOCAL_STORAGE.VELT_ADVANCED_QUERIES);a&&(r=JSON.parse(a)?.advancedQueriesEnabled)}catch(a){this.loggingService.catch("Error in forceReLoginRequiredForAdvancedQueries: ",a)}return!!(t&&e.organizationId&&!r)}catch(t){return this.loggingService.catch("Error in forceReLoginRequiredForAdvancedQueries: ",t),!1}}forceReLoginRequiredForRegion(e,t){try{return!!(this.isVersionGreaterThanOrEqualTo4()&&e.organizationId&&!t?.region)}catch(r){return this.loggingService.catch("Error in forceReLoginRequiredForRegion: ",r),!1}}checkForPendingLogin(){this.pendingUserLogin&&this.initializeClient(this.pendingUserLogin,this.userOptions$?.value||{},new Date().getTime(),void 0,this.pendingUserLoginSource)}setFirebaseConfig(e){this.loggingService.log("%c[WB] Calling FUNCTION: setFirebaseConfig","color: green;");try{this.firebaseConfig$.value||this.firebaseConfig$.next({firebaseOptions:I(I({},ni.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(j.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 En([this.configService.getConfig$(),this.getAdvancedQueries$()]).pipe(de(()=>this.getAdvancedQueriesEnabled()),Hn(()=>se(!1)))}getAdvancedQueriesEnabled(){try{return!this.configService.getConfig()?.advancedQueriesDisabled&&!!this.getAdvancedQueries()?.advancedQueriesEnabled}catch(e){return this.loggingService.catch("Error in getAdvancedQueriesEnabled: ",e),!1}}signOutPreviousUser(){return this.signOutPreviousUser$.asObservable()}getUser(){return this.loggingService.log("%c[WB] Calling FUNCTION: getUser","color: green;"),this.afAuth?.currentUser?this.user$.value:null}getUser$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getUser$","color: green;"),Qn(this.afAuth).pipe(he(e=>e?this.user$.asObservable():se(null)),kt(si))}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=I(I({},this.providedUser),e),t){let r=I(I({},t),e);this.updateUserInternally(r)}}catch(t){this.loggingService.catch("Error in updateUser: ",t)}}signInWithCustomToken(e,t,r="manual"){this.loggingService.log("%c[WB] Calling FUNCTION: signInWithCustomToken","color: green;");try{return Cee(this.afAuth,t).then(a=>(this.analyticsService.trackEvent(X.Events.Core.SDK_USER_AUTH_SUCCESS,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,authType:r,forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e)}),a)).catch(a=>(this.analyticsService.trackEvent(X.Events.Core.SDK_USER_AUTH_FAILED,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,authType:r,forceReset:this.userOptions$.value?.forceReset,message:a.message,user:this.getUserWithoutContacts(e)}),a))}catch(a){return this.loggingService.catch("Error in signInWithCustomToken: ",a),Promise.reject(a)}}resetServicesCache(){this.loggingService.log("%c[WB] Calling FUNCTION: resetServicesCache in AuthService","color: green;");try{this.commonDbService?.unsubscribeFromObservables(),this.docService?.clearCacheOnUserCascade(),this.contactService?.clearCache(),this.iamService?.clearCache(),this.areaService?.clearCache(),this.commentService?.clearCache(),this.reactionService?.clearCache(),this.recorderAnnotationService?.clearCache(),this.viewsService?.clearCache()}catch(e){this.loggingService.catch("Error in resetServicesCache: ",e)}}initializeSignedInUser(e,t){this.loggingService.log("%c[WB] Calling FUNCTION: initializeSignedInUser","color: green;");try{let r=new Do;r.userSnippylyId=e.uid,r.type="signedIn",this.mergeUserWithProvidedUserData(r,t)}catch(r){this.loggingService.catch("Error in initializeSignedInUser: ",r)}}mergeUserWithProvidedUserData(e,t){return Q(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: mergeUserWithProvidedUserData","color: green;");try{e.userId=this.providedUser?.userId||e.userId;let r=null;if(this.usersService?.userDataProviderAvailable()){let a=yield this.usersService.resolveUsers({userIds:[e.userId],organizationId:this.providedUser?.organizationId||e.organizationId,skipUserCheck:!0});a&&a[e.userId]&&(r=JSON.parse(JSON.stringify(a[e.userId]||{}))),e=I(I({},e),r||{})}e.name=r?r?.name:this.providedUser?.name||e.name,e.clientUserName=r?r?.clientUserName:this.providedUser?.clientUserName||e.clientUserName,e.photoUrl=r?r?.photoUrl:this.providedUser?.photoUrl||e.photoUrl,e?.photoUrl===void 0&&(e.photoUrl=null),e.email=r?r?.email:this.providedUser?.email||e.email,e.color=r?.color||this.providedUser?.color||this.getUserAvatarColor(e.userId),e.textColor=r?.textColor||this.providedUser?.textColor||this.getUserTextColor(e.userId),e.initial=r?.initial||this.providedUser?.initial||e.initial||e.name?.charAt(0).toUpperCase()||e.email?.charAt(0).toUpperCase(),e.contacts=this.providedUser?.contacts||e.contacts,e.plan=this.providedUser?.plan||e.plan,e.groupId=this.providedUser?.groupId||e.groupId,e.clientGroupId=this.providedUser?.clientGroupId||e.clientGroupId,e.clientOrganizationId=this.providedUser?.clientOrganizationId||e.clientOrganizationId,e.organizationId=this.providedUser?.organizationId||e.organizationId,e.isAdmin=this.providedUser?.isAdmin,e.isReadOnly=this.providedUser?.isReadOnly,e.isAnonymous=this.providedUser?.isAnonymous,e.isGuest=this.providedUser?.isGuest,this.updateUserInternally(e)}catch(r){this.loggingService.catch("Error in mergeUserWithProvidedUserData: ",r)}})}updateUserInternally(e){return Q(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||(yield this.getPlanDetailsFromDb()),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)),r=T(I({},t),{lastUpdated:new Date})}catch(t){this.loggingService.catch("Error in updateUserToFirebase: ",t)}}getPlanDetailsFromDb(){return Q(this,null,function*(){try{this.getPlanDetailsCalled=!0;let t=yield yr(this.functions,br({url:ni.cloudFunction.getPlanDetails,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:20*60*1e3})({apiKey:this.configService.getApiKey(),sdkVersion:fa(),sdkType:this.configService.getSdkType()});return t?.data?.isPlanExpired&&(this.analyticsService.trackEvent(X.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(Le(e=>!!e),de(e=>!!e?.isPlanExpired))}isPlanExpired(){return this.planDetails$.getValue()?.isPlanExpired}addPreSignOutFuction(e,t){try{this.preSignOutFunctions.set(e,t)}catch(r){this.loggingService.catch("Error in addPreSignOutFuction: ",r)}}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(he(e=>e?this.userOrganization$.asObservable().pipe(de(t=>t?.metadata?.organizationId===e.organizationId?t:null)):se(null)))}signOutUser(e="internal"){return Q(this,null,function*(){try{e==="external"&&this.onRetrySubscription?.unsubscribe(),yield this.analyticsService.trackEvent(X.Events.Core.SDK_USER_SIGN_OUT,{apiKey:this.apiKey,clientUserId:this.user$?.value?.userId,snippylyUserId:this.user$?.value?.userSnippylyId,message:e==="external"?"User Sign out":"System Sign out",user:this.user$?.value?this.getUserWithoutContacts(this.user$?.value):null,forceReset:this.userOptions$.value?.forceReset,source:e});let t=yield Qn(this.afAuth).pipe(rt(1)).toPromise().catch(r=>null);if(t){this.resetServicesCache(),this.user$.next(null);for(let[r,a]of this.preSignOutFunctions)try{yield a(t)}catch(s){this.loggingService.catch(`Error in signOutUser ${r} function: `,s)}return this.user$.next(null),yield Dd(1e3),_ee(this.afAuth).catch(r=>{this.loggingService.catch("Error in signOutUser:",r)})}else return Promise.resolve()}catch(t){this.loggingService.catch("Error in signOutUser: ",t)}})}isFeatureAllowed(e){return no(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 Ca(e)}catch(t){return this.loggingService.catch("Error in getUserForClient: ",t),null}}getUserAvatarColor(e){try{return e?this.avatarService.generateUserColor(fn(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{}}};o.\u0275fac=function(t){return new(t||o)(J(Ei),J(Vt),J(Rd),J(Nd),J(Fe),J($o),J(tt),J(y))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Fd=class{constructor({apiKey:o,documentId:n,organizationId:e,clientDocumentId:t,clientOrganizationId:r}){this.paths={},this.apiKey=o,this.documentId=n,this.organizationId=e,this.clientDocumentId=t,this.clientOrganizationId=r,t&&(this.documentId=xc(t)),r&&(this.organizationId=Tc(r)),this.generateDocumentPaths()}generateDocumentPaths(){try{if(this.paths.clientDocumentId=this.clientDocumentId,this.paths.documentId=this.documentId,this.organizationId&&(this.paths.organizationId=this.organizationId,this.paths.clientOrganizationId=this.clientOrganizationId),this.apiKey){let o=`${this.apiKey}`;this.organizationId&&(o=`${o}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${this.paths.organizationId}`),this.documentId&&(this.paths.docs=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/`,this.paths.presence=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_PRESENCE}/`,this.paths.cursor=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_CURSOR}/`,this.paths.comment=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_COMMENT}/`,this.paths.multiThread=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_MULTI_THREAD}/`,this.paths.tag=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_TAG}/`,this.paths.area=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_AREA}/`,this.paths.arrow=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_ARROW}/`,this.paths.selection=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_SELECTION}/`,this.paths.audioHuddle=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_AUDIO_HUDDLE}/`,this.paths.huddle=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_HUDDLE}/`,this.paths.recorder=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_RECORDER}/`,this.paths.flock=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_FOLLOW_ALONG}/`,this.paths.syncVideoPlayer=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_SYNC_VIDEO_PLAYER}/`,this.paths.liveState=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_LIVE_STATE}/`,this.paths.liveStateSingleEditorMode=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_LIVE_STATE}/default/singleEditorMode`,this.paths.reaction=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_REACTION}/`,this.paths.crdt=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_CRDT}/`,this.paths.views=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_VIEWS}/`,this.paths.notifications=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_NOTIFICATIONS}/`,this.paths.metadata=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_METADATA}/`,this.paths.users=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_USERS}/`,this.paths.documentIam=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_IAM}/`,this.paths.userConfig=`${o}/${j.FIREBASE_PARTIAL_PATH_USERS}`),this.paths.customerMetadata=`${o}/${j.FIREBASE_PARTIAL_PATH_CUSTOMER_METADATA}/`,this.paths.groupContacts=`${o}/${j.FIREBASE_PARTIAL_PATH_CONTACTS}/${j.FIREBASE_PARTIAL_PATH_GROUPS}/`,this.paths.globalContacts=`${o}/${j.FIREBASE_PARTIAL_PATH_CONTACTS}/${j.FIREBASE_PARTIAL_PATH_GLOBAL}/`,this.paths.logins=`${o}/${j.FIREBASE_PARTIAL_PATH_CONTACTS}/${j.FIREBASE_PARTIAL_PATH_LOGINS}/`,this.paths.userFeedback=`${o}/${j.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${j.FIREBASE_PARTIAL_PATH_FEEDBACK}/`,this.paths.userReportBugs=`${o}/${j.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${j.FIREBASE_PARTIAL_PATH_BUGS}/`,this.paths.userContactUs=`${o}/${j.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${j.FIREBASE_PARTIAL_PATH_CONTACT_US}/`,this.organizationId&&(this.paths.organizationMetadata=`${o}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_METADATA}/`,this.paths.organizationIam=`${o}/${j.FIREBASE_PARTIAL_PATH_IAM}/`,this.paths.organizationGroups=`${o}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_GROUPS}/`,this.paths.organizationNotifications=`${o}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/`,this.documentId&&(this.paths.organizationNotificationsWithDocumentId=`${o}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/`),this.paths.organizationNotificationsLastNotificationTimestamp=`${o}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${j.FIREBASE_PARTIAL_PATH_LAST_NOTIFICATION_TIMESTAMP}/${j.FIREBASE_PARTIAL_PATH_DOCS}/`,this.paths.organizationNotificationsUsers=`${o}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${j.FIREBASE_PARTIAL_PATH_USERS}/`),this.paths.workspaceIam=`${this.apiKey}/${j.FIREBASE_PARTIAL_PATH_IAM}/`}}catch{}}get 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 organizationNotifications(){return this.paths.organizationNotifications?this.paths.organizationNotifications:this.throwError("Organization notifications path is not available.")}get organizationNotificationsWithDocumentId(){return this.paths.organizationNotificationsWithDocumentId?this.paths.organizationNotificationsWithDocumentId:this.throwError("Organization notifications with document id path is not available.")}get organizationNotificationsUsers(){return this.paths.organizationNotificationsUsers?this.paths.organizationNotificationsUsers:this.throwError("Organization notifications users path is not available.")}get organizationNotificationsLastNotificationTimestamp(){return this.paths.organizationNotificationsLastNotificationTimestamp?this.paths.organizationNotificationsLastNotificationTimestamp:this.throwError("Organization notifications last notification timestamp path is not available.")}throwError(o){throw{type:"DocumentPaths",message:o,metadata:{apiKey:this.apiKey,documentId:this.documentId,organizationId:this.organizationId}}}};var vk=class{constructor({apiKey:o,documentId:n,organizationId:e,clientDocumentId:t,clientOrganizationId:r,folderId:a,veltFolderId:s}){this.paths={},this.apiKey=o,this.documentId=n,this.organizationId=e,this.veltFolderId=s,t&&(this.documentId=xc(t)),r&&(this.organizationId=Tc(r)),a&&(this.folderId=a,this.veltFolderId=zo(a)),this.generateDocumentPaths()}generateDocumentPaths(){try{if(this.paths.clientDocumentId=this.clientDocumentId,this.paths.documentId=this.documentId,this.organizationId&&(this.paths.organizationId=this.organizationId,this.paths.clientOrganizationId=this.clientOrganizationId),this.veltFolderId&&(this.paths.folderId=this.folderId,this.paths.veltFolderId=this.veltFolderId),this.apiKey){let o=`apiKey/${this.apiKey}`;this.organizationId&&(o=`${o}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${this.paths.organizationId}`,this.paths.organization=o,this.paths.folder=`${o}/${j.FIREBASE_PARTIAL_PATH_FOLDERS}`,this.paths.organizationUsers=`${o}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_USERS}`,this.paths.users=`${o}/${j.FIREBASE_PARTIAL_PATH_CENTRAL_USERS}`,this.paths.notificationDocs=`${o}/${j.FIREBASE_PARTIAL_PATH_NOTIFICATION_DOCS}`,this.paths.notificationUsers=`${o}/${j.FIREBASE_PARTIAL_PATH_NOTIFICATION_USERS}`,this.paths.organizationGroups=`${o}/${j.FIREBASE_PARTIAL_PATH_GROUPS}`,this.paths.lastNotificationTimestamp=`${o}/${j.FIREBASE_PARTIAL_PATH_LAST_NOTIFICATION_TIMESTAMP}`,this.paths.userConfig=`${o}/${j.FIREBASE_PARTIAL_PATH_USERS}`,this.paths.permissionsUsers=`${o}/${j.FIREBASE_PARTIAL_PATH_PERMISSIONS_USERS}`),this.veltFolderId&&(this.paths.folderUsers=`${o}/${j.FIREBASE_PARTIAL_PATH_FOLDERS}/${this.veltFolderId}/${j.FIREBASE_PARTIAL_PATH_FOLDER_USERS}`),this.documentId&&(this.paths.document=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}`,this.paths.comment=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_COMMENT}`,this.paths.location=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_LOCATION}`,this.paths.multiThread=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_MULTI_THREAD}`,this.paths.area=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_AREA}`,this.paths.recorder=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_RECORDER}`,this.paths.reaction=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_REACTION}`,this.paths.crdt=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_CRDT}`,this.paths.commentViews=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_COMMENT_VIEWS}`,this.paths.notificationViews=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_NOTIFICATION_VIEWS}`,this.paths.documentViews=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_DOCUMENT_VIEWS}`,this.paths.locationViews=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_LOCATION_VIEWS}`,this.paths.documentUsers=`${o}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_DOCUMENT_USERS}`,this.paths.docNotification=`${this.paths.notificationDocs}/${this.documentId}/${j.FIREBASE_PARTIAL_PATH_DOC_NOTIFICATION}`)}}catch{}}get 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 commentViews(){return this.paths.commentViews?this.paths.commentViews:this.throwError("CommentViews path is not available.")}get documentViews(){return this.paths.documentViews?this.paths.documentViews:this.throwError("DocumentViews path is not available.")}get locationViews(){return this.paths.locationViews?this.paths.locationViews:this.throwError("LocationViews path is not available.")}get notificationViews(){return this.paths.notificationViews?this.paths.notificationViews:this.throwError("NotificationViews path is not available.")}get documentUsers(){return this.paths.documentUsers?this.paths.documentUsers:this.throwError("DocumentUsers path is not available.")}get folderUsers(){return this.paths.folderUsers?this.paths.folderUsers:this.throwError("FolderUsers path is not available.")}get organizationUsers(){return this.paths.organizationUsers?this.paths.organizationUsers:this.throwError("OrganizationUsers path is not available.")}get notificationDocs(){return this.paths.notificationDocs?this.paths.notificationDocs:this.throwError("NotificationDocs path is not available.")}get notificationUsers(){return this.paths.notificationUsers?this.paths.notificationUsers:this.throwError("NotificationUsers path is not available.")}get multiThread(){return this.paths.multiThread?this.paths.multiThread:this.throwError("Multi thread path is not available.")}get recorder(){return this.paths.recorder?this.paths.recorder:this.throwError("Recorder path is not available.")}get reaction(){return this.paths.reaction?this.paths.reaction:this.throwError("Reaction path is not available.")}get crdt(){return this.paths.crdt?this.paths.crdt:this.throwError("CRDT path is not available.")}throwError(o){throw{type:"DocumentPaths",message:o,metadata:{apiKey:this.apiKey,documentId:this.documentId,organizationId:this.organizationId}}}};var Ck=class{};var _n=(()=>{let o=class o{constructor(e,t){this.authService=e,this.loggingService=t,this.db$=new ve(null);try{this.authService.getFirebaseConfig$().subscribe(r=>{r&&this.db$.next(x6(void 0,r.firebaseOptions.databaseURL))},r=>{this.loggingService.catch("Error in DatabaseService constructor: ",r)})}catch(r){this.loggingService.catch("Error in DatabaseService constructor:",r)}}getDb(){return this.db$.asObservable()}getDbValue(){return this.db$.getValue()}};o.\u0275fac=function(t){return new(t||o)(J(je),J(y))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var ws=(()=>{let o=class o{constructor(e,t){this.loggingService=e,this.analyticsService=t,this.resolveTimeout=1*60*1e3,this.retrySaveConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryDeleteConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryGetConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.commentAnnotationDataProvider$=new ve(null),this.commentAnnotationById$=new ve({}),this.fieldsToRemove=[],this.getCommentAnnotationById=r=>{try{return this.commentAnnotationDataProviderAvailable()?this.commentAnnotationById$.value?.[r]:void 0}catch(a){this.loggingService.catch("Error in CommentAnnotationsResolverService getCommentAnnotationById:",a);return}};try{this.loggingService.log("CommentAnnotationsResolverService initialized"),this.commentAnnotationDataProvider$.subscribe(r=>{r&&(r.config?.resolveTimeout&&(this.resolveTimeout=r.config.resolveTimeout),r.config?.saveRetryConfig&&(this.retrySaveConfig=r.config.saveRetryConfig),r.config?.deleteRetryConfig&&(this.retryDeleteConfig=r.config.deleteRetryConfig),r.config?.getRetryConfig&&(this.retryGetConfig=r.config.getRetryConfig),r.config?.fieldsToRemove&&(this.fieldsToRemove=r.config.fieldsToRemove))})}catch(r){this.loggingService.catch("Error in CommentAnnotationsResolverService constructor:",r)}}getProvider(){try{let e=this.commentAnnotationDataProvider$.getValue();return e||void 0}catch(e){this.loggingService.catch("Error in CommentAnnotationsResolverService getProvider:",e);return}}ngOnDestroy(){try{this.commentAnnotationById$.next({})}catch(e){this.loggingService.catch("Error in CommentAnnotationsResolverService ngOnDestroy:",e)}}resolveCommentAnnotations(e){return Q(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling CommentAnnotationsResolverService FUNCTION: resolveCommentAnnotations","color: green;"),!this.commentAnnotationDataProviderAvailable())return{};let t,r=!1,a=!1,s=()=>{t&&(clearTimeout(t),t=void 0,a=!0)};return new Promise((d,p)=>{t=setTimeout(()=>{a||(r=!0,s(),p(new Error("Comment annotation resolution timeout")))},this.commentAnnotationDataProvider$.value?.config?.resolveTimeout||this.resolveTimeout);let u=this.getProvider();if(!u)return s(),d({});let C={},E=[...new Set(e.commentAnnotationIds||[])],D=T(I({},e),{commentAnnotationIds:E});Q(this,null,function*(){try{if(E.length>0||e.documentIds?.length||e.folderId){let G=wc(()=>u?.get(D)||Promise.resolve(void 0),"getCommentAnnotations",this.retryGetConfig).then(Y=>r?{}:(s(),Y&&Y.statusCode!==200?(this.loggingService.catch(Y?.message??"Error in CommentAnnotationsResolverService resolveCommentAnnotations:"),{}):Y?.data)).catch(Y=>{throw s(),Y});try{C=(yield G)||{},this.analyticsService.trackEvent(X.Events.Resolver.COMMENT_RESOLVER_GET,{sourceMethod:"resolveCommentAnnotations",source:"sdk",commentAnnotationIds:E});let Y={};Object.entries(C).forEach(([ne,ge])=>{let ye=this.commentAnnotationById$.value?.[ne];ye?ye&&JSON.stringify(ye)!==JSON.stringify(ge)&&(Y[ne]=ge):Y[ne]=ge}),Object.keys(Y).length>0&&this.commentAnnotationById$.next(I(I({},this.commentAnnotationById$.getValue()),Y)),d(Y)}catch(Y){r||p(Y),d(C)}}else s(),d({})}catch(G){s(),p(G)}})})}catch(t){return this.loggingService.catch("Error in CommentAnnotationsResolverService resolveCommentAnnotations:",t),{}}})}saveCommentAnnotation(e){return Q(this,null,function*(){try{this.loggingService.log("%c[WB] Calling CommentAnnotationsResolverService FUNCTION: saveCommentAnnotation","color: green;");let t=this.getProvider();if(!this.commentAnnotationDataProviderAvailable())throw new Error("Comment annotation save data provider not available");let r=JSON.parse(JSON.stringify(this.commentAnnotationById$.getValue()));this.commentAnnotationById$._value=I(I({},r),e.commentAnnotation);let a=yield wc(()=>t?.save({commentAnnotation:e.commentAnnotation,event:e.eventType,commentId:e.commentId,metadata:Object.values(e.commentAnnotation??{})?.[0]?.metadata})||Promise.resolve(void 0),"saveCommentAnnotation",this.retrySaveConfig);return a&&a.statusCode!==200?(this.retrySaveConfig.revertOnFailure&&(this.commentAnnotationById$._value=r),this.loggingService.catch(a?.message??"Error in CommentAnnotationsResolverService saveCommentAnnotation:"),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(X.Events.Resolver.COMMENT_RESOLVER_SAVE,{sourceMethod:"saveCommentAnnotation",source:"sdk",commentAnnotationIds:Object.keys(e.commentAnnotation),eventType:e.eventType,commentId:e.commentId}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0})}catch(t){return this.loggingService.warn("Error in CommentAnnotationsResolverService saveCommentAnnotation:",t),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0}}})}deleteCommentAnnotation(e,t){return Q(this,null,function*(){try{this.loggingService.log("%c[WB] Calling CommentAnnotationsResolverService FUNCTION: deleteCommentAnnotation","color: green;");let r=this.getProvider();if(!this.commentAnnotationDataProviderAvailable())throw new Error("Comment annotation delete data provider not available");let a=this.commentAnnotationById$.getValue(),s=I({},a);delete s?.[e],this.commentAnnotationById$._value=s;let d=yield wc(()=>r?.delete({commentAnnotationId:e.toString(),metadata:t,event:Ja.COMMENT_ANNOTATION_DELETE})||Promise.resolve(void 0),"deleteCommentAnnotation",this.retryDeleteConfig);return d&&d.statusCode!==200?(this.retryDeleteConfig.revertOnFailure&&(this.commentAnnotationById$._value=a),this.loggingService.catch(d?.message??"Error in CommentAnnotationsResolverService deleteCommentAnnotation:"),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(X.Events.Resolver.COMMENT_RESOLVER_DELETE,{sourceMethod:"deleteCommentAnnotation",source:"sdk",commentAnnotationId:e.toString()}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0})}catch(r){return this.loggingService.warn("Error in CommentAnnotationsResolverService deleteCommentAnnotation:",r),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0}}})}getCommentAnnotationsById$(){try{return this.commentAnnotationDataProviderAvailable()?(this.loggingService.log("%c[WB] Calling CommentAnnotationsResolverService FUNCTION: getCommentAnnotationsById$","color: green;"),this.commentAnnotationById$.asObservable()):se(void 0)}catch(e){return this.loggingService.catch("Error in CommentAnnotationsResolverService getCommentAnnotationsById$:",e),se(void 0)}}getAnnotationById(e){try{return this.commentAnnotationDataProviderAvailable()?this.commentAnnotationById$.getValue()?.[e]:void 0}catch(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 r=["get","save","delete"].filter(a=>!(a in e)||typeof e[a]!="function");if(r.length>0){let a=`DataProviders.comment is invalid. The following methods are missing or are not functions: ${r.join(", ")}.`;this.loggingService.catch(a);return}else this.commentAnnotationDataProvider$.next(e)}}catch(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}}};o.\u0275fac=function(t){return new(t||o)(J(y),J(tt))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Ld=(()=>{let o=class o{constructor(e,t){this.loggingService=e,this.analyticsService=t,this.resolveTimeout=1*60*1e3,this.retrySaveConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryDeleteConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryGetConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.reactionAnnotationDataProvider$=new ve(null),this.reactionAnnotationById$=new ve({}),this.getReactionAnnotationById=r=>{try{return this.reactionAnnotationDataProviderAvailable()?this.reactionAnnotationById$.value?.[r]:void 0}catch(a){this.loggingService.catch("Error in ReactionAnnotationsResolverService getReactionAnnotationById:",a);return}};try{this.loggingService.log("ReactionAnnotationsResolverService initialized"),this.reactionAnnotationDataProvider$.subscribe(r=>{r&&(r.config?.resolveTimeout&&(this.resolveTimeout=r.config.resolveTimeout),r.config?.saveRetryConfig&&(this.retrySaveConfig=r.config.saveRetryConfig),r.config?.deleteRetryConfig&&(this.retryDeleteConfig=r.config.deleteRetryConfig),r.config?.getRetryConfig&&(this.retryGetConfig=r.config.getRetryConfig))})}catch(r){this.loggingService.catch("Error in ReactionAnnotationsResolverService constructor:",r)}}getProvider(){try{let e=this.reactionAnnotationDataProvider$.getValue();return e||void 0}catch(e){this.loggingService.catch("Error in ReactionAnnotationsResolverService getProvider:",e);return}}ngOnDestroy(){try{this.reactionAnnotationById$.next({})}catch(e){this.loggingService.catch("Error in ReactionAnnotationsResolverService ngOnDestroy:",e)}}resolveReactionAnnotations(e){return Q(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling ReactionAnnotationsResolverService FUNCTION: resolveReactionAnnotations","color: green;"),!this.reactionAnnotationDataProviderAvailable())return{};let t,r=!1,a=!1,s=()=>{t&&(clearTimeout(t),t=void 0,a=!0)};return new Promise((d,p)=>{t=setTimeout(()=>{a||(r=!0,s(),p(new Error("Reaction annotation resolution timeout")))},this.reactionAnnotationDataProvider$.value?.config?.resolveTimeout||this.resolveTimeout);let u=this.getProvider();if(!u)return s(),d({});let C={},E=[...new Set(e.reactionAnnotationIds||[])],D=T(I({},e),{reactionAnnotationIds:E});Q(this,null,function*(){try{if(E.length>0||e.documentIds?.length||e.folderId){let G=wc(()=>u?.get(D)||Promise.resolve(void 0),"getReactionAnnotations",this.retryGetConfig).then(Y=>r?{}:(s(),Y&&Y.statusCode!==200?(this.loggingService.catch(Y?.message??"Error in ReactionAnnotationsResolverService resolveReactionAnnotations:"),{}):Y?.data)).catch(Y=>{throw s(),Y});try{C=(yield G)||{},this.analyticsService.trackEvent(X.Events.Resolver.REACTION_RESOLVER_GET,{sourceMethod:"resolveReactionAnnotations",source:"sdk",reactionAnnotationIds:E});let Y={};Object.entries(C).forEach(([ne,ge])=>{let ye=this.reactionAnnotationById$.value?.[ne];ye?ye&&JSON.stringify(ye)!==JSON.stringify(ge)&&(Y[ne]=ge):Y[ne]=ge}),Object.keys(Y).length>0&&this.reactionAnnotationById$.next(I(I({},this.reactionAnnotationById$.getValue()),Y)),d(Y)}catch(Y){r||p(Y),d(C)}}else s(),d({})}catch(G){s(),p(G)}})})}catch(t){return this.loggingService.catch("Error in ReactionAnnotationsResolverService resolveReactionAnnotations:",t),{}}})}saveReactionAnnotation(e){return Q(this,null,function*(){try{this.loggingService.log("%c[WB] Calling ReactionAnnotationsResolverService FUNCTION: saveReactionAnnotation","color: green;");let t=this.getProvider();if(!this.reactionAnnotationDataProviderAvailable())throw new Error("Reaction annotation save data provider not available");let r=JSON.parse(JSON.stringify(this.reactionAnnotationById$.getValue()));this.reactionAnnotationById$._value=I(I({},r),e);let a={reactionAnnotation:e,event:Ja.REACTION_ADD,metadata:Object.values(e??{})?.[0]?.metadata},s=yield wc(()=>t?.save(a)||Promise.resolve(void 0),"saveReactionAnnotation",this.retrySaveConfig);return s&&s.statusCode!==200?(this.retrySaveConfig.revertOnFailure&&(this.reactionAnnotationById$._value=r),this.loggingService.catch(s?.message??"Error in ReactionAnnotationsResolverService saveReactionAnnotation:"),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(X.Events.Resolver.REACTION_RESOLVER_SAVE,{sourceMethod:"saveReactionAnnotation",source:"sdk",reactionAnnotationIds:Object.keys(e),eventType:a.event}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0})}catch(t){return this.loggingService.warn("Error in ReactionAnnotationsResolverService saveReactionAnnotation:",t),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0}}})}deleteReactionAnnotation(e,t){return Q(this,null,function*(){try{this.loggingService.log("%c[WB] Calling ReactionAnnotationsResolverService FUNCTION: deleteReactionAnnotation","color: green;");let r=this.getProvider();if(!this.reactionAnnotationDataProviderAvailable())throw new Error("Reaction annotation delete data provider not available");let a=JSON.parse(JSON.stringify(this.reactionAnnotationById$.getValue())),s=I({},a);delete s?.[e],this.reactionAnnotationById$._value=s;let d=yield wc(()=>r?.delete({reactionAnnotationId:e.toString(),metadata:t,event:Ja.REACTION_DELETE})||Promise.resolve(void 0),"deleteReactionAnnotation",this.retryDeleteConfig);return d&&d.statusCode!==200?(this.retryDeleteConfig.revertOnFailure&&(this.reactionAnnotationById$._value=a),this.loggingService.catch(d?.message??"Error in ReactionAnnotationsResolverService deleteReactionAnnotation:"),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(X.Events.Resolver.REACTION_RESOLVER_DELETE,{sourceMethod:"deleteReactionAnnotation",source:"sdk",reactionAnnotationId:e.toString()}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0})}catch(r){return this.loggingService.warn("Error in ReactionAnnotationsResolverService deleteReactionAnnotation:",r),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0}}})}getReactionAnnotationsById$(){try{return this.reactionAnnotationDataProviderAvailable()?(this.loggingService.log("%c[WB] Calling ReactionAnnotationsResolverService FUNCTION: getReactionAnnotationsById$","color: green;"),this.reactionAnnotationById$.asObservable()):se(void 0)}catch(e){return this.loggingService.catch("Error in ReactionAnnotationsResolverService getReactionAnnotationsById$:",e),se(void 0)}}getAnnotationById(e){try{return this.reactionAnnotationDataProviderAvailable()?this.reactionAnnotationById$.getValue()?.[e]:void 0}catch(t){this.loggingService.catch("Error in ReactionAnnotationsResolverService getAnnotationById:",t);return}}setReactionAnnotationDataProvider(e){try{if(e){this.loggingService.log("Setting reaction annotation data provider");let r=["get","save","delete"].filter(a=>!(a in e)||typeof e[a]!="function");if(r.length>0){let a=`DataProviders.reaction is invalid. The following methods are missing or are not functions: ${r.join(", ")}.`;this.loggingService.catch(a);return}else this.reactionAnnotationDataProvider$.next(e)}}catch(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}}};o.\u0275fac=function(t){return new(t||o)(J(y),J(tt))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var at=(()=>{let o=class o{constructor(e,t,r,a,s,d,p,u,C){this.analyticsService=e,this.authService=t,this.databaseService=r,this.domService=a,this.configService=s,this.loggingService=d,this.commentResolverService=p,this.reactionResolverService=u,this.coreActionsService=C,this.documentPaths$=new ve(null),this.documentIds$=new ve([]),this.organizationConfig$=new ve(null),this.firestorePaths$=new ve(null),this.location$=new ve(null),this.excludedLocationIds$=new ve([]),this.organizationMetadata$=new ve(null),this.documentMetadata$=new ve(null),this.locationMetadata$=new ve(null),this.customerMetadata$=new ve(null),this.currentDocumentId=null,this.isCustomDocId=!1,this.locations$=new ve({}),this.preDocumentIdChangeFunctions=new Map,this.draftDocuments=[],this.clientDocumentMetadataMap={},this.uiState=new ve({}),this.lastSetDocumentIdExecutionTime=0,this.lastSetDocumentIdCallTime=0,this.setDocumentIdSubject=new et,this.DEBOUNCE_TIME=5e3,this.MAX_QUEUE_SIZE=100,this.queueSize=0,this.isDocumentIdInDebounceQueue=!1,this.draftLocationMap={locations:[],options:void 0};try{this.loggingService.log("%c[WB] Creating CLASS: DocService","color: blue;"),this.domService.setDocService(this),this.authService.setDocService(this),this.setDocumentIdSubject.pipe(sr(this.DEBOUNCE_TIME)).subscribe({next:E=>Q(this,null,function*(){try{yield this.setDocumentIdImpl(E.documentId,E.clientOrganizationId,E.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:E=>{this.loggingService.catch("Error in setDocumentId subscription:",E),this.queueSize--}}),this.databaseService.getDb().pipe(Le(E=>!!E),rt(1)).subscribe(E=>{E&&(this.db=E)}),this.configService.getApiKey$().subscribe(E=>{if(this.apiKey=E,this.apiKey){if(!this.isCustomDocId){let D=UP(window.location.href);this.currentUrl=D}this.analyticsService.updateDefaultProperties({apiKey:E})}}),this.authService.getUser$().subscribe(E=>Q(this,null,function*(){E&&(this.analyticsService.updateDefaultProperties({organizationId:E?.organizationId,clientOrganizationId:E?.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&&E?.organizationId&&this.documentPaths$.value?.organizationId!==E?.organizationId&&(yield this.setDocuments({documents:this.documentIds$.value.length?this.documentIds$.value.map(D=>({id:D.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),E?.organizationId&&E?.clientOrganizationId&&(this.organizationConfig$.next({organizationId:E?.organizationId,clientOrganizationId:E?.clientOrganizationId}),yield this.updateOrganizationMetadata()))})),this.documentPaths$.subscribe(E=>{let D={documentId:E?.documentId,clientDocumentId:E?.clientDocumentId,folderId:E?.folderId,allDocuments:E?.allDocuments,veltFolderId:E?.veltFolderId};E?.organizationId&&(D.organizationId=E.organizationId,D.clientOrganizationId=E.clientOrganizationId),this.analyticsService.updateDefaultProperties(D),this.domService.resetSelectedAnnotationsMap()}),this.location$.subscribe(E=>{this.analyticsService.updateDefaultProperties({clientLocation:E?.location,locationId:E?.locationId})}),this.organizationMetadata$.subscribe(E=>{this.authService.setUserOrganization(E?.[this.documentPaths$.value?.organizationId])}),this.documentPaths$.pipe(Le(E=>!!E),rt(1)).subscribe(()=>{try{this.subscribeToCustomerMetadata()}catch(E){this.loggingService.catch("Error in DocService subscribeToCustomerMetadata:",E)}},E=>{this.loggingService.catch("Error in DocService subscribeToCustomerMetadata:",E)}),this.loggingService.log("%c[WB] Creating CLASS: DocService 2","color: blue;"),this.onWindowPopstate(),this.onWindowClick()}catch(E){this.loggingService.catch("Error in DocService constructor:",E)}}getOptionsFromDocumentPaths(){try{return this.documentPaths$.value?{folderId:this.documentPaths$.value?.folderId,allDocuments:this.documentPaths$.value?.allDocuments,locationId:this.documentPaths$.value?.locationId,organizationId:this.documentPaths$.value?.clientOrganizationId}: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.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)}}setCommonDbService(e){try{this.commonDbService=e}catch(t){this.loggingService.catch("Error in setCommonDbService:",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=UP(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=UP(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(s){return Q(this,arguments,function*({documentId:e,documentMetadata:t,options:r,source:a="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocument","color: green;"),a==="internal"&&this.analyticsService.trackEvent(X.Events.Core.SET_DOCUMENTS_TRIGGERED,{payload:{id:e,documentMetadata:t,methodName:"setDocument",source:a}}),this.coreActionsService.triggerAction(Hi.INIT_UPDATE,{event:X.Events.Core.SET_DOCUMENTS_TRIGGERED,methodName:"setDocument",source:a,payload:{documentId:e,documentMetadata:t,options:r}}),yield this.setDocumentsImpl({documents:[{id:e,metadata:t}],options:I({organizationId:t?.organizationId},r??{}),source:a})}catch(d){this.loggingService.catch("Error in DocService setDocument:",d)}})}shouldSetDocumentsAgain(e,t={}){try{this.loggingService.log("%c[WB] Calling FUNCTION: shouldSetDocumentsAgain","color: green;");let r=this.documentPaths$.value?.clientDocumentId,a=t?.rootDocumentId??e[0]?.id,s=this.documentIds$.value.map(u=>u.clientDocumentId),d=Sj(this.getOptionsFromDocumentPaths()??{})??{};return!e.every(u=>s.includes(u.id))||!zi(d,t)||r!==a}catch(r){return this.loggingService.catch("Error in DocService shouldSetDocumentsAgain:",r),!0}}getDocumentIdsFromDocuments({documents:e,setClientDocumentMetadataMap:t=!1}){try{let r=[];return e.forEach(a=>{let s=a.id,d=`${fn(s)}`;t&&a?.metadata&&typeof a.metadata=="object"&&(this.clientDocumentMetadataMap[s]=a.metadata),r.push({documentId:d,clientDocumentId:s})}),r}catch(r){return this.loggingService.catch("Error in DocService getDocumentIdsFromDocuments:",r),[]}}setDocuments(a){return Q(this,arguments,function*({documents:e,options:t,source:r="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocuments","color: green;"),r==="internal"&&this.analyticsService.trackEvent(X.Events.Core.SET_DOCUMENTS_TRIGGERED,{payload:{documents:e,options:t,methodName:"setDocuments",source:r}}),this.coreActionsService.triggerAction(Hi.INIT_UPDATE,{event:X.Events.Core.SET_DOCUMENTS_TRIGGERED,methodName:"setDocuments",source:r,payload:{documents:e,options:t}}),yield this.setDocumentsImpl({documents:e,options:t??{},source:r})}catch(s){this.loggingService.catch("Error in DocService setDocuments:",s)}})}setRootDocument(r){return Q(this,arguments,function*({document:e,source:t="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setRootDocument","color: green;"),this.coreActionsService.triggerAction(Hi.INIT_UPDATE,{event:X.Events.Core.SET_ROOT_DOCUMENT_TRIGGERED,methodName:"setRootDocument",source:t,payload:{document:e}});let a=this.getOptionsFromDocumentPaths()??{},s=this.documentIds$.value.map(d=>d.clientDocumentId);if(!s.includes(e.id)){let d=[...s.map(u=>({id:u})),{id:e.id}],p=this.getDocumentIdsFromDocuments({documents:d,setClientDocumentMetadataMap:!0});this.documentIds$.next(p)}yield this.setDocumentIdImpl(e.id,this.documentPaths$.value?.clientOrganizationId,a)}catch(a){this.loggingService.catch("Error in DocService setRootDocument:",a)}})}setDocumentsImpl(a){return Q(this,arguments,function*({documents:e,options:t,source:r}){try{let s=t?.organizationId??this.documentPaths$.value?.clientOrganizationId;if(!this.shouldSetDocumentsAgain(e,Sj(T(I({},t),{organizationId:s})))){r==="external"&&this.loggingService.catch("setDocuments called with previous request");return}this.documentPaths$.value?.organizationId&&t?.organizationId&&this.documentPaths$.value?.organizationId!==t?.organizationId?this.authService.resetServicesCache():this.unsetDocuments({source:"internal",unsetDocumentPaths:!1});let d=this.getDocumentIdsFromDocuments({documents:e,setClientDocumentMetadataMap:!0});if(d?.length===0){this.loggingService.warn("Minimum one document must be set in setDocuments");return}if(!this.authService.getUser()){this.draftDocuments=e,this.draftOptions=t;return}if(this.documentIds$.next(d),e?.length){let u=e[0]?.id;t?.rootDocumentId&&e.find(C=>C.id===t?.rootDocumentId)&&(u=t?.rootDocumentId),yield this.debounceSetDocuments({documentId:u,clientOrganizationId:t?.organizationId,options:t})}return}catch(s){this.loggingService.catch("Error in DocService setDocumentsImpl:",s)}})}setDocumentId(a){return Q(this,arguments,function*({documentId:e,clientOrganizationId:t,source:r="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocumentId","color: green;"),r==="internal"&&this.analyticsService.trackEvent(X.Events.Core.SET_DOCUMENTS_TRIGGERED,{payload:{id:e,clientOrganizationId:t,methodName:"setDocumentId",source:r}}),this.coreActionsService.triggerAction(Hi.INIT_UPDATE,{event:X.Events.Core.SET_DOCUMENTS_TRIGGERED,methodName:"setDocumentId",source:r,payload:{documentId:e,clientOrganizationId:t}}),yield this.setDocumentsImpl({documents:[{id:e}],options:{organizationId:t},source:r})}catch(s){this.loggingService.catch("Error in setDocumentId:",s);return}})}debounceSetDocuments(a){return Q(this,arguments,function*({documentId:e,clientOrganizationId:t,options:r}){try{this.loggingService.log("%c[WB] Calling FUNCTION: debounceSetDocuments","color: green;");let s=Date.now(),d=s-this.lastSetDocumentIdCallTime,p=s-this.lastSetDocumentIdExecutionTime;if(this.lastSetDocumentIdCallTime=s,this.queueSize>=this.MAX_QUEUE_SIZE){this.loggingService.warn("SetDocumentId queue size exceeded limit");return}if(!this.documentPaths$.value&&!this.isDocumentIdInDebounceQueue||d>this.DEBOUNCE_TIME&&p>this.DEBOUNCE_TIME){yield this.setDocumentIdImpl(e,t,r),this.lastSetDocumentIdExecutionTime=s;return}this.documentPaths$.next(null),this.isDocumentIdInDebounceQueue=!0,this.draftLocationMap={locations:[],options:void 0},this.queueSize++,this.setDocumentIdSubject.next({documentId:e,clientOrganizationId:t,options:r??void 0});return}catch(s){this.loggingService.catch("Error in debounceSetDocuments:",s)}})}setDocumentIdImpl(e,t,r){return Q(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 s=this.currentDocumentId;if(this.apiKey){let d=`${fn(e)}`,p=r?.folderId,u=r?.folderId?zo(r?.folderId):void 0,C=r?.locationId,E=r?.allDocuments,D=a?.organizationId?t?_t(t):a?.organizationId:void 0;if(yield Promise.allSettled([this.commentResolverService.resolveCommentAnnotations({documentIds:this.documentIds$.value.map(L=>L.clientDocumentId),organizationId:t??a?.clientOrganizationId??""}),this.reactionResolverService.resolveReactionAnnotations({documentIds:this.documentIds$.value.map(L=>L.clientDocumentId),organizationId:t??a?.clientOrganizationId??""})]),this.currentDocumentId!==d||this.documentPaths$.value?.organizationId!==D){this.loggingService.log("setting new docid"),this.currentDocumentId=d;let L=new tk,G=new Ck;L.clientDocumentId=e,G.clientDocumentId=e,L.folderId=p,G.folderId=p,L.locationId=C,G.locationId=C,L.allDocuments=E,G.allDocuments=E,L.veltFolderId=u,G.veltFolderId=u,L.documentId=d,G.documentId=d,D&&(L.organizationId=D,L.clientOrganizationId=t??a?.clientOrganizationId,G.organizationId=D,G.clientOrganizationId=t??a?.clientOrganizationId);let Y=`${this.apiKey}`,ne=`apiKey/${this.apiKey}`;D&&(Y=`${Y}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${L.organizationId}`,ne=`${ne}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${L.organizationId}`),G.organization=`apiKey/${this.apiKey}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}`,G.document=`${ne}/${j.FIREBASE_PARTIAL_PATH_DOCS}`,L.presence=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_PRESENCE}/`,L.cursor=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_CURSOR}/`,L.comment=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_COMMENT}/`,G.comment=`${ne}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_COMMENT}`,L.multiThread=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_MULTI_THREAD}/`,G.multiThread=`${ne}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_MULTI_THREAD}`,L.tag=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_TAG}/`,L.area=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_AREA}/`,G.area=`${ne}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_AREA}`,L.arrow=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_ARROW}/`,L.selection=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_SELECTION}/`,L.audioHuddle=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_AUDIO_HUDDLE}/`,L.huddle=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_HUDDLE}/`,L.recorder=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_RECORDER}/`,G.recorder=`${ne}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_RECORDER}`,L.flock=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_FOLLOW_ALONG}/`,L.syncVideoPlayer=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_SYNC_VIDEO_PLAYER}/`,L.liveState=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_LIVE_STATE}/`,L.liveStateSingleEditorMode=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_LIVE_STATE}/default/singleEditorMode`,L.reaction=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_REACTION}/`,G.reaction=`${ne}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_REACTION}`,L.crdt=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_CRDT}/`,G.crdt=`${ne}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_CRDT}`,L.customerMetadata=`${this.apiKey}/${j.FIREBASE_PARTIAL_PATH_CUSTOMER_METADATA}/`,L.views=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_VIEWS}/`,G.commentViews=`${ne}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_COMMENT_VIEWS}`,G.notificationViews=`${ne}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_NOTIFICATION_VIEWS}`,G.documentViews=`${ne}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_DOCUMENT_VIEWS}`,G.locationViews=`${ne}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_LOCATION_VIEWS}`,L.notifications=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_NOTIFICATIONS}/`,L.metadata=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_METADATA}/`,L.users=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_USERS}/`,L.documentIam=`${Y}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_IAM}/`,L.workspaceIam=`${this.apiKey}/${j.FIREBASE_PARTIAL_PATH_IAM}/`,L.groupContacts=`${Y}/${j.FIREBASE_PARTIAL_PATH_CONTACTS}/${j.FIREBASE_PARTIAL_PATH_GROUPS}/`,L.globalContacts=`${Y}/${j.FIREBASE_PARTIAL_PATH_CONTACTS}/${j.FIREBASE_PARTIAL_PATH_GLOBAL}/`,L.logins=`${Y}/${j.FIREBASE_PARTIAL_PATH_CONTACTS}/${j.FIREBASE_PARTIAL_PATH_LOGINS}/`,L.userFeedback=`${Y}/${j.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${j.FIREBASE_PARTIAL_PATH_FEEDBACK}/`,L.userReportBugs=`${Y}/${j.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${j.FIREBASE_PARTIAL_PATH_BUGS}/`,L.userContactUs=`${Y}/${j.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${j.FIREBASE_PARTIAL_PATH_CONTACT_US}/`,D&&(L.organizationMetadata=`${Y}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_METADATA}/`,L.organizationIam=`${Y}/${j.FIREBASE_PARTIAL_PATH_IAM}/`,L.organizationGroups=`${Y}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_GROUPS}/`,L.organizationNotifications=`${Y}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/`,d&&(L.organizationNotificationsWithDocumentId=`${Y}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/`),L.organizationNotificationsLastNotificationTimestamp=`${Y}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${j.FIREBASE_PARTIAL_PATH_LAST_NOTIFICATION_TIMESTAMP}/${j.FIREBASE_PARTIAL_PATH_DOCS}/`,L.organizationNotificationsUsers=`${Y}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${j.FIREBASE_PARTIAL_PATH_USERS}/`),G.organizationUsers=`${ne}/${j.FIREBASE_PARTIAL_PATH_ORGANIZATION_USERS}`,G.users=`${ne}/${j.FIREBASE_PARTIAL_PATH_CENTRAL_USERS}`,G.documentUsers=`${ne}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${d}/${j.FIREBASE_PARTIAL_PATH_DOCUMENT_USERS}`,G.notificationDocs=`${ne}/${j.FIREBASE_PARTIAL_PATH_NOTIFICATION_DOCS}`,G.notificationUsers=`${ne}/${j.FIREBASE_PARTIAL_PATH_NOTIFICATION_USERS}`,this.documentPaths$.next(L),this.firestorePaths$.next(G),L?.clientOrganizationId&&L?.organizationId&&!(L?.clientOrganizationId===this.organizationConfig$?.value?.clientOrganizationId&&L?.organizationId===this.organizationConfig$?.value?.organizationId)&&this.organizationConfig$.next({organizationId:L?.organizationId,clientOrganizationId:L?.clientOrganizationId}),yield Promise.allSettled([this.updateFolderMetadata(),this.updateDocumentMetadata(),this.fetchLocationMetadata(),this.updateOrganizationMetadata()]),s&&this.location$.value&&this.removeLocation({}),this.coreActionsService.triggerAction(Hi.INIT_UPDATE,{event:X.Events.Doc.SET_DOCUMENTS_SUCCESS,payload:{documentId:d,clientDocumentId:e}}),this.analyticsService.trackEvent(X.Events.Doc.SET_DOCUMENTS_SUCCESS,{documentId:d,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(X.Events.Core.UNSET_DOCUMENTS_TRIGGERED,{payload:{methodName:"unsetDocumentId",source:e}}),this.coreActionsService.triggerAction(Hi.INIT_UPDATE,{event:X.Events.Doc.UNSET_DOCUMENTS_TRIGGERED,methodName:"unsetDocumentId",source:e}),this.unsetDocumentImpl({source:e,unsetDocumentPaths:t})}catch(r){this.loggingService.catch("Error in unsetDocumentId: ",r)}}unsetDocumentImpl({source:e,unsetDocumentPaths:t}){this.loggingService.log("%c[WB] Calling FUNCTION: unsetDocumentImpl","color: green;");try{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.clientDocumentMetadata=void 0,this.clientDocumentMetadataMap={},this.locations$.next({}),this.documentIds$.next([]),this.coreActionsService.triggerAction(Hi.INIT_UPDATE,{event:X.Events.Doc.UNSET_DOCUMENTS_SUCCESS,source:e}),this.analyticsService.trackEvent(X.Events.Doc.UNSET_DOCUMENTS_SUCCESS,{documentId:this.currentDocumentId,documentMetadata:this.documentMetadata$.value?.[this.currentDocumentId??""],message:e==="external"?"User unset document id":"System unset document id",source:e},!0,this.getUserIdForAnalytics())}catch(r){this.loggingService.catch("Error in unsetDocumentImpl: ",r)}}unsetDocuments({source:e,unsetDocumentPaths:t=!0}){this.loggingService.log("%c[WB] Calling FUNCTION: unsetDocuments","color: green;");try{e==="internal"&&this.analyticsService.trackEvent(X.Events.Core.UNSET_DOCUMENTS_TRIGGERED,{payload:{methodName:"unsetDocuments",source:e}}),this.coreActionsService.triggerAction(Hi.INIT_UPDATE,{event:X.Events.Doc.UNSET_DOCUMENTS_TRIGGERED,source:e,methodName:"unsetDocuments"}),this.unsetDocumentImpl({source:e,unsetDocumentPaths:t})}catch(r){this.loggingService.catch("Error in unsetDocuments: ",r)}}addPreDocumentIdChangeFunction(e,t){try{this.loggingService.log("%c[WB] Calling FUNCTION: addPreDocumentIdChangeFunction","color: green;"),this.preDocumentIdChangeFunctions.set(e,t)}catch(r){this.loggingService.catch("Error in addPreDocumentIdChangeFunction: ",r)}}callPreDocumentIdChangeFunctions(e){return Q(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: callPreDocumentIdChangeFunctions","color: green;");for(let[t,r]of this.preDocumentIdChangeFunctions)try{yield r(e)}catch(a){this.loggingService.catch("Error in callPreDocumentIdChangeFunctions: ",a)}}catch(t){this.loggingService.catch("Error in callPreDocumentIdChangeFunctions: ",t)}})}fetchOrganizationMetadata(){return Q(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: fetchOrganizationMetadata","color: green;");try{if(this.db&&this.organizationConfig$.value?.organizationId){let e=this.organizationConfig$.value?.organizationId;yield this.commonDbService?.getData({feature:"organizationMetadata",properties:{apiKey:this.apiKey??"",organizationId:e,field:"metadata"}}).then(t=>{t&&this.organizationMetadata$.next(T(I({},this.organizationMetadata$.value),{[e]:t}))}).catch(t=>{this.loggingService.catch("Error in fetchOrganizationMetadata: ",t)})}}catch(e){this.loggingService.catch("Error in fetchOrganizationMetadata: ",e)}})}fetchDocumentMetadata(e){return Q(this,null,function*(){try{if(this.db&&this.authService.getUser()){let t=this.documentPaths$.value,r=this.documentMetadata$.value;if(e=e.filter(a=>!r?.[a.documentId]),e?.some(a=>!a?.documentId||!a?.clientDocumentId)||!t)return;if(this.commonDbService?.shouldUseFirestore()){let a=t?.folderId,s=t?.allDocuments,d=[],p={organizationId:t?.clientOrganizationId,folderId:a,allDocuments:s};if(a&&s)d.push(this.fetchDocuments(p));else{let C=[];for(let D=0;D<e.length;D+=20)C.push(e.slice(D,D+20));C.forEach(D=>{let L=JSON.parse(JSON.stringify(p));L.documentIds=D.map(G=>G.clientDocumentId),d.push(this.fetchDocuments(L))})}let u={};d.length>0&&(yield Promise.all(d).then(C=>{C?.forEach(E=>{E?.forEach(D=>{D?.metadata?.documentId&&(u[D.metadata.documentId]=D.metadata)})}),this.documentMetadata$.next(I(I({},this.documentMetadata$.value),u))}).catch(C=>{this.loggingService.catch("Error in fetchDocumentMetadata: ",C)}))}else r?.[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.documentMetadata$.next({[a.documentId]:a})}).catch(a=>{this.loggingService.catch("Error in fetchDocumentMetadata: ",a)})}}catch(t){this.loggingService.catch("Error in fetchDocumentMetadata: ",t)}})}fetchLocationMetadata(){return Q(this,null,function*(){try{if(this.db&&this.authService.getUser()){let e=this.documentPaths$.value,t=this.documentIds$.value,r=e?.folderId,a=e?.allDocuments,s=[],d={organizationId:e?.clientOrganizationId,folderId:r,allDocuments:a};if(r&&a)s.push(this.fetchLocations(d));else{let u=[];for(let E=0;E<t.length;E+=20)u.push(t.slice(E,E+20));u.forEach(E=>{let D=JSON.parse(JSON.stringify(d));D.documentIds=E.map(L=>L.clientDocumentId),s.push(this.fetchLocations(D))})}let p=this.locationMetadata$.value??{};s.length>0&&Promise.all(s).then(u=>{u?.forEach(C=>{C?.forEach(E=>{E?.metadata?.documentId&&(p[E.metadata.documentId]=T(I({},p?.[E.metadata.documentId]??{}),{[E.location.id]:E}))})}),Object.keys(p||{}).length>0&&this.locationMetadata$.next(p)}).catch(u=>{this.loggingService.catch("Error in fetchLocationMetadata: ",u)})}}catch(e){this.loggingService.catch("Error in fetchLocationMetadata: ",e)}})}getLocationMetadatas(){return this.locationMetadata$.value}subscribeToCustomerMetadata(){this.loggingService.log("%c[WB] Calling FUNCTION: subscribeToCustomerMetadata","color: green;");try{if(this.customerMetadataSubscription)return;this.db&&this.authService.getUser()&&this.documentPaths$.value&&(this.customerMetadataSubscription=this.commonDbService?.dbListener({feature:"customerMetadata",properties:{skipFirestore:!0}}).pipe(Hn(t=>se(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(de(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`${fn(e)}`}catch(t){return this.loggingService.catch("Error in generateDocumentId: ",t),""}}generateOrganizationId(e){try{return`${_t(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(r){return Q(this,arguments,function*({location:e,source:t="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setLocation","color: green;"),t==="internal"&&this.analyticsService.trackEvent(X.Events.Core.SET_LOCATIONS_TRIGGERED,{payload:{locations:[e],options:void 0,methodName:"setLocation",source:t}}),this.coreActionsService.triggerAction(Hi.INIT_UPDATE,{event:X.Events.Core.SET_LOCATIONS_TRIGGERED,source:t,methodName:"setLocation",payload:{locations:[e],options:void 0}}),this.setLocationsImpl({locations:[e]})}catch(a){this.loggingService.catch("Error in setLocation: ",a)}})}setLocations(a){return Q(this,arguments,function*({locations:e,options:t,source:r="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setLocations","color: green;"),r==="internal"&&this.analyticsService.trackEvent(X.Events.Core.SET_LOCATIONS_TRIGGERED,{payload:{locations:e,options:t,methodName:"setLocations",source:r}}),this.coreActionsService.triggerAction(Hi.INIT_UPDATE,{event:X.Events.Core.SET_LOCATIONS_TRIGGERED,methodName:"setLocations",source:r,payload:{locations:e,options:t}}),this.setLocationsImpl({locations:e,options:t})}catch(s){this.loggingService.catch("Error in setLocations: ",s)}})}getValidLocations(e){try{let t=[];return e&&Array.isArray(e)&&e.forEach(r=>{if(r&&typeof r=="object"){let a=!0;r?.version&&(!r?.version?.id||!r?.version?.name)&&(this.loggingService.catch(`Error in setting location for locationId: ${r?.id}, If you're setting version then add id and name fields to version object.`),a=!1),a&&t.push(r)}}),t}catch(t){this.loggingService.catch("Error in getValidLocations: ",t)}return e}setRootLocation(r){return Q(this,arguments,function*({location:e,source:t="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setRootLocation","color: green;"),t==="internal"&&this.analyticsService.trackEvent(X.Events.Core.SET_ROOT_LOCATION_TRIGGERED,{payload:{location:e,methodName:"setRootLocation",source:t}}),this.coreActionsService.triggerAction(Hi.INIT_UPDATE,{event:X.Events.Core.SET_ROOT_LOCATION_TRIGGERED,methodName:"setRootLocation",source:t,payload:{location:e}});let a=Object.values(this.locations$.value).map(s=>s.location).filter(s=>String(s.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=T(I(I({},this.draftLocationMap.options??{}),t??{}),{rootLocationId:e[0].id})),this.draftLocationMap.locations=[...this.draftLocationMap.locations,...e],this.draftLocationMap.options=I(I({},this.draftLocationMap.options),t);return}let a=this.getValidLocations(e),s=[],d=[];this.location$.value?.location.id&&d.push(this.location$.value?.location.id),d=[...d,...Object.values(this.locations$.value).map(C=>C.location.id)].filter(C=>C!==void 0);let p;if(t?.rootLocationId&&t?.rootLocationId!==this.location$.value?.location.id&&(p=a.find(C=>C.id===t?.rootLocationId),!p)){this.loggingService.catch(`Error in setting locations, rootLocationId: ${t?.rootLocationId} not found in locations.`);return}if(t?.appendLocation){if(p){let C=Go(p),E=fn(JSON.stringify(C));C.id&&s.push({locationId:E,location:C}),this.location$.next({locationId:E,location:C})}}else{p||(p=a[0]);let C=Go(p),E=fn(JSON.stringify(C));C.id&&s.push({locationId:E,location:C}),this.location$.next({locationId:E,location:C})}let u=[];return a.slice(t?.appendLocation?0:1).forEach(C=>{if(C.id!==this.location$.value?.location.id){let E=I({},C),D=this.locations$.value;C?.id&&Object.keys(D).forEach(ne=>{let ge=D[ne];ge.location?.id===C.id&&(E=I(I({},ge.location),C),delete D?.[ne])});let L=this.genarateLocationId(E),G={locationId:L,location:E};E.id&&s.push({locationId:L,location:E}),u.push(G);let Y=T(I({},D),{[L]:G});this.locations$.next(Y)}}),this.updateDocumentLocationMetadata(s),this.coreActionsService.triggerAction(Hi.INIT_UPDATE,{event:X.Events.Doc.SET_LOCATIONS_SUCCESS,methodName:"setLocations",payload:{locations:a,options:t}}),this.analyticsService.trackEvent(X.Events.Doc.SET_LOCATIONS_SUCCESS,{locations:a,options:t},!0,this.getUserIdForAnalytics()),u}catch(r){this.loggingService.catch("Error in setLocationImpl: ",r);return}}addLocation({location:e,source:t="internal"}){try{return this.loggingService.log("%c[WB] Calling FUNCTION: addLocation","color: green;"),t==="internal"&&this.analyticsService.trackEvent(X.Events.Core.SET_LOCATIONS_TRIGGERED,{payload:{locations:[e],options:{appendLocation:!0},methodName:"addLocation",source:t}}),this.coreActionsService.triggerAction(Hi.INIT_UPDATE,{event:X.Events.Core.SET_LOCATIONS_TRIGGERED,methodName:"addLocation",source:t,payload:{locations:[e],options:{appendLocation:!0}}}),this.setLocationsImpl({locations:[e],options:{appendLocation:!0}})}catch(r){this.loggingService.catch("Error in DocService addLocation:",r);return}}removeLocation({location:e,source:t="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeLocation","color: green;"),t==="internal"&&this.analyticsService.trackEvent(X.Events.Core.REMOVE_LOCATIONS_TRIGGERED,{payload:{locations:[e],methodName:"removeLocation",source:t}}),this.coreActionsService.triggerAction(Hi.INIT_UPDATE,{event:X.Events.Core.REMOVE_LOCATIONS_TRIGGERED,source:t,methodName:"removeLocation",payload:{locations:[e]}}),e&&this.removeLocationsImpl([e],t)}catch(r){this.loggingService.catch("Error in removeLocation: ",r)}}removeLocations({locations:e,source:t="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeLocations","color: green;"),t==="internal"&&this.analyticsService.trackEvent(X.Events.Core.REMOVE_LOCATIONS_TRIGGERED,{payload:{locations:e,methodName:"removeLocations",source:t}}),this.coreActionsService.triggerAction(Hi.INIT_UPDATE,{event:X.Events.Core.REMOVE_LOCATIONS_TRIGGERED,methodName:"removeLocations",source:t,payload:{locations:e}}),this.removeLocationsImpl(e,t)}catch(r){this.loggingService.catch("Error in removeLocations: ",r)}}removeLocationsImpl(e,t="internal"){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeLocations","color: green;"),t==="internal"&&this.analyticsService.trackEvent(X.Events.Core.REMOVE_LOCATIONS_TRIGGERED,{payload:{locations:e},methodName:"removeLocations",message:"System removed locations",source:t},!0,this.getUserIdForAnalytics()),e?e.forEach(r=>{let a=this.genarateLocationId(r);this.getLocation()?.locationId===a&&(this.location$.next(null),t!=="internal"&&(this.draftLocationMap.locations=this.draftLocationMap.locations.filter(s=>s.id!==r.id))),this.removeCustomLocation(r)}):(this.location$.next(null),this.locations$.next({}),t!=="internal"&&(this.draftLocationMap.options=void 0,this.draftLocationMap.locations=[])),this.analyticsService.trackEvent(X.Events.Doc.REMOVE_LOCATIONS_SUCCESS,{payload:{locations:e},source:t},!0,this.getUserIdForAnalytics())}catch(r){this.loggingService.catch("Error in removeLocation: ",r)}}unsetLocationIds(e,t="internal"){try{this.loggingService.log("%c[WB] Calling FUNCTION: unsetLocationIds","color: green;"),this.coreActionsService.triggerAction(Hi.INIT_UPDATE,{event:X.Events.Core.UNSET_LOCATIONS_TRIGGERED,methodName:"unsetLocationIds",source:t,payload:{locationIds:e}}),t==="internal"&&this.analyticsService.trackEvent(X.Events.Core.UNSET_LOCATIONS_TRIGGERED,{payload:{locationIds:e},methodName:"unsetLocationIds",message:"System unset location ids",source:t},!0,this.getUserIdForAnalytics()),e?.length?e.forEach(r=>{this.getLocation()?.location.id===r&&(this.location$.next(null),t!=="internal"&&(this.draftLocationMap.locations=this.draftLocationMap.locations.filter(a=>a.id!==r))),this.removeCustomLocationId(r)}):(this.location$.next(null),this.locations$.next({}),t!=="internal"&&(this.draftLocationMap.options=void 0,this.draftLocationMap.locations=[])),this.analyticsService.trackEvent(X.Events.Doc.REMOVE_LOCATIONS_SUCCESS,{payload:{locationIds:e},source:t},!0,this.getUserIdForAnalytics())}catch(r){this.loggingService.catch("Error in unsetLocationIds: ",r)}}getLocation$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getLocation$","color: green;"),this.location$.asObservable()}getLocation(){return this.loggingService.log("%c[WB] Calling FUNCTION: getLocation$","color: green;"),this.location$.value?JSON.parse(JSON.stringify(this.location$.value)):null}excludeLocationIds(e){try{this.excludedLocationIds$.next([...e])}catch(t){this.loggingService.catch("Error in excludeLocationIds: ",t)}}getExcludedLocationIds$(){try{return this.excludedLocationIds$.asObservable()}catch(e){return this.loggingService.catch("Error in getExcludedLocationIds$: ",e),se([])}}updateOrganizationMetadata(){return Q(this,null,function*(){try{let e=this.organizationConfig$.value?.organizationId,t=this.documentPaths$.value;if(this.db&&e&&t?.documentId){if(this.organizationMetadata$.value?.[e])return;let a=new pk;a.apiKey=this.configService?.getApiKey()??"",a.organizationId=e,a.clientOrganizationId=this.organizationConfig$.value?.clientOrganizationId,yield this.commonDbService?.updateData({feature:"organizationMetadata",data:JSON.parse(JSON.stringify(a)),properties:{organizationId:e,documentId:t?.documentId??""}}),yield this.fetchOrganizationMetadata()}}catch(e){this.loggingService.catch("Error in updateOrganizationMetadata: ",e)}})}updateFolderMetadata(){return Q(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 r={folderId:this.documentPaths$.value?.folderId,veltFolderId:this.documentPaths$.value?.veltFolderId,apiKey:this.configService?.getApiKey()??"",organizationId:e?.organizationId,clientOrganizationId:e?.clientOrganizationId,createdAt:Date.now(),lastUpdated:Date.now(),parentFolderId:"root",veltParentFolderId:"root"};this.commonDbService?.updateData({feature:"folderMetadata",data:JSON.parse(JSON.stringify({metadata:r})),properties:{organizationId:e?.organizationId??"",folderId:this.documentPaths$.value?.veltFolderId??""}})}}}catch(e){this.loggingService.catch("Error in updateFolderMetadata: ",e)}})}updateDocumentMetadata(){return Q(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 r=t.map(a=>Q(this,null,function*(){let s=new ek;this.clientDocumentMetadata&&(this.clientDocumentMetadata?.clientDocumentId===e.clientDocumentId&&this.clientDocumentMetadata?.documentMetadata&&(s=I(I({},this.clientDocumentMetadata.documentMetadata),s)),this.clientDocumentMetadata=void 0),this.clientDocumentMetadataMap?.[a.clientDocumentId]&&(s=I(I({},this.clientDocumentMetadataMap[a.clientDocumentId]),s)),s.apiKey=this.configService?.getApiKey()??"",s.documentId=a.documentId,s.clientDocumentId=a.clientDocumentId,s.organizationId=e.organizationId,s.clientOrganizationId=e.clientOrganizationId,s.pageInfo=xi();let d=e?.folderId,p=e?.veltFolderId;s?.pageInfo?.deviceInfo&&delete s?.pageInfo?.deviceInfo;let u=!0,C=this.documentMetadata$.value?.[a.documentId];if(d&&p){let E=yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:a?.documentId??"",organizationId:e?.organizationId??"",field:"metadata"}});E?.clientDocumentId?E?.folderId&&(E?.folderId!==d||E?.veltFolderId!==p)?(this.loggingService.catch(`Folder id mismatch for document ${a?.clientDocumentId??""}`),u=!1):E?.folderId===d?(d&&(s.folderId=d),p&&(s.veltFolderId=p)):(this.loggingService.catch(`Document ${a?.clientDocumentId??""} is not in the folder ${d??""}`),u=!1):(d&&(s.folderId=d),p&&(s.veltFolderId=p))}if(C){let E={};Object.entries(s).forEach(([D,L])=>{E[D]=L}),zi(E,C)&&(u=!1)}u&&(yield this.commonDbService?.updateData({feature:"documentMetadata",data:JSON.parse(JSON.stringify(s)),properties:{organizationId:e?.organizationId??"",documentId:a?.documentId??""}}))}));yield Promise.allSettled(r),yield this.fetchDocumentMetadata(t)}}}catch(e){this.loggingService.catch("Error in updateDocumentMetadata: ",e)}})}updateDocumentLocationMetadata(e){return Q(this,null,function*(){try{if(this.db&&this.authService.getUser()){let t=this.documentPaths$.value;if(t){let r=this.getDocumentIds();r.find(a=>a.documentId===t.documentId)||r.push({documentId:t.documentId??"",clientDocumentId:t.clientDocumentId??""});for(let a of r){let s=yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:a?.documentId??"",organizationId:t?.organizationId??"",field:"metadata"}}),d=[];for(let p of e){let u=new rk;u.locationId=p?.locationId,u.veltLocationId=vj(p?.location?.id??""),u.location=p?.location,u.pageInfo=xi(),u?.pageInfo?.deviceInfo&&delete u?.pageInfo?.deviceInfo;let C=T(I({},s),{[j.FIREBASE_PARTIAL_PATH_LOCATIONS]:T(I({},s[j.FIREBASE_PARTIAL_PATH_LOCATIONS]??{}),{[p?.locationId]:u})});this.commonDbService?.shouldUseFirestore()||d.push(this.commonDbService?.updateData({feature:"documentMetadata",data:JSON.parse(JSON.stringify(C)),properties:{documentId:a?.documentId??"",organizationId:t?.organizationId??""}}));let E=this.locationMetadata$.value;if(E||(E={}),p?.location?.id){let D=E?.[a.documentId],L=D?.[p?.location?.id??""];E&&(D||(E[a.documentId]={}),L||(E[a.documentId][p?.location?.id??""]={}),E[a.documentId][p?.location?.id??""]=T(I({},L),{location:p?.location})),Object.keys(E||{}).length>0&&this.locationMetadata$.next(E)}}yield Promise.allSettled(d)}}}}catch(t){this.loggingService.catch("Error in updateDocumentLocationMetadata: ",t)}})}genarateLocationId(e){try{return e&&typeof e=="object"?fn(JSON.stringify(Go(e))):0}catch(t){return this.loggingService.catch("Error in genarateLocationId: ",t),0}}removeCustomLocation(e,t="internal"){try{let r=this.genarateLocationId(e),a=this.locations$.value;a[r]&&(delete a[r],this.locations$.next(I({},a)),t!=="internal"&&this.isDocumentIdInDebounceQueue&&(this.draftLocationMap.locations=this.draftLocationMap.locations.filter(s=>s.id!==e.id)))}catch(r){this.loggingService.catch("Error in DocService removeLocation:",r)}}removeCustomLocationId(e,t="internal"){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeCustomLocationId","color: green;");let r=this.locations$.value;Object.entries(r).forEach(([a,s])=>{s.location.id===e&&(delete r[a],this.locations$.next(I({},r)),t!=="internal"&&this.isDocumentIdInDebounceQueue&&(this.draftLocationMap.locations=this.draftLocationMap.locations.filter(d=>d.id!==e)))})}catch(r){this.loggingService.catch("Error in DocService removeCustomLocationId:",r)}}getLocationByClientLocationId(e){try{let t=this.getLocation()?.location;if(t?.id===e)return t;{let r=this.getLocations();Object.keys(r).forEach(a=>{let s=r[a];s.location?.id===e&&(t=s.location)})}return t}catch(t){this.loggingService.catch("Error in DocService getLocationByClientLocationId:",t);return}}removeLocationIfNotInDom(){try{let e=this.locations$.value,t=document.querySelectorAll(`[${j.ATTRIBUTES.VELT_LOCATION}]`),r=[];t.forEach(a=>{let s=a.getAttribute(j.ATTRIBUTES.VELT_LOCATION);if(s){let d=JSON.parse(s),p=this.genarateLocationId(d);r.push(p)}}),Object.keys(e).forEach(a=>{let s=e[a];r.includes(s.locationId)||delete e[a]}),this.locations$.next(I({},e))}catch(e){this.loggingService.catch("Error in DocService removeLocationIfNotInDom:",e)}}getLocations$(){try{return this.locations$.asObservable()}catch(e){return this.loggingService.catch("Error in DocService getLocations$:",e),se({})}}getLocations(){try{return this.locations$.value}catch(e){return this.loggingService.catch("Error in DocService getLocations:",e),{}}}getLocationFromElement(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: getLocationFromElement","color: green;");let t=null;if(e?.getAttribute(j.ATTRIBUTES.VELT_LOCATION)?t=e:t=e.closest(`[${j.ATTRIBUTES.VELT_LOCATION}]`),t){let r=t?.getAttribute(j.ATTRIBUTES.VELT_LOCATION);if(r){let a=JSON.parse(r);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(`[${j.ATTRIBUTES.VELT_LOCATION}], [${j.ATTRIBUTES.VELT_LOCATION_ID}]`).forEach(r=>{if(r.getAttribute(j.ATTRIBUTES.VELT_LOCATION)){let a=this.getLocationFromElement(r);a?.locationId&&(e[a.locationId]={element:r,location:a})}else if(r.getAttribute(j.ATTRIBUTES.VELT_LOCATION_ID)){let a=r.getAttribute(j.ATTRIBUTES.VELT_LOCATION_ID);if(a){let s=this.getLocationByClientLocationId(a);s?.locationId&&(e[s.locationId]={element:r,location:s});let d={id:a},p=this.genarateLocationId(d);e[a]={element:r,location:{locationId:p,location:d}}}}}),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(`[${j.ATTRIBUTES.VELT_LOCATION}], [${j.ATTRIBUTES.VELT_LOCATION_ID}]`),t){if(t?.getAttribute(j.ATTRIBUTES.VELT_LOCATION)){let r=t?.getAttribute(j.ATTRIBUTES.VELT_LOCATION);if(r)return JSON.parse(r)}else if(t?.getAttribute(j.ATTRIBUTES.VELT_LOCATION_ID)){let r=t?.getAttribute(j.ATTRIBUTES.VELT_LOCATION_ID);if(r)return{id:r}}}return null}catch(t){return this.loggingService.catch("Error in DocService getAdditionLocationFromElement:",t),null}}getAdditionalDocumentIdFromElement(e){try{return e?.closest(`[${j.ATTRIBUTES.VELT_DOCUMENT_ID}]`)?.getAttribute(j.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(){try{return Object.values(this.documentMetadata$.value||{})}catch(e){return this.loggingService.catch("Error in DocService getAllDocumentMetadata:",e),[]}}getDocumentMetadataOfAvailableDocuments(){try{this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentMetadataOfAvailableDocuments","color: green;");let e=this.documentMetadata$.value||{},t={},r=this.documentPaths$.value?.veltFolderId,a=this.documentPaths$.value?.allDocuments;if(r&&a)Object.values(e).forEach(s=>{s?.documentId&&s?.veltFolderId===r&&(t[s.documentId]=s)});else{let s=this.documentIds$.value;if(s?.length)s.forEach(d=>{let p=e?.[d.documentId];p&&(t[d.documentId]=p)});else if(this.documentPaths$.value?.documentId){let d=e?.[this.documentPaths$.value?.documentId];d&&(t[this.documentPaths$.value?.documentId]=d)}}return Object.values(t)}catch(e){return this.loggingService.catch("Error in DocService getDocumentMetadataOfAvailableDocuments:",e),[]}}getDocumentMetadata$(e){return this.documentMetadata$.asObservable().pipe(de(t=>t?.[e??this.documentPaths$.value?.documentId??""]||null))}getOrganizationMetadata(e){return this.organizationMetadata$.value?.[e]||null}getOrganizationMetadata$(e){return this.organizationMetadata$.asObservable().pipe(de(t=>t?.[e]||null))}getCustomerMetadata(){return this.customerMetadata$.value}getCustomerMetadata$(){return this.customerMetadata$.asObservable()}getOrganizationConfig$(){return this.organizationConfig$.asObservable().pipe(kt(si))}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(r){this.loggingService.catch("Error in DocService getMetadataFromType:",r);return}}getDefaultMetadata({clientDocumentId:e,documentId:t}){try{let r=this.documentPaths$.value;if(!r)return;let a=e||r.clientDocumentId,s=t||r.documentId,d=this.getDocumentMetadata(s);if(!d)return;let p=d?.folderId,u=d?.veltFolderId;return I(I({apiKey:this.configService.getApiKey()??void 0,clientDocumentId:a,clientOrganizationId:r.clientOrganizationId,documentId:s,organizationId:r.organizationId},p?{folderId:p}:{}),u?{veltFolderId:u}:{})}catch(r){this.loggingService.catch("Error in DocService getDefaultMetadata:",r);return}}getBaseMetadata(e,t){try{let r,a;t?.element?r=this.getAdditionalDocumentIdFromElement(t.element)||void 0:t?.clientDocumentId&&(r=t.clientDocumentId),r&&(a=this.generateDocumentId(r));let s=this.getMetadataFromType(e,t),d=this.getDefaultMetadata({clientDocumentId:r,documentId:a});return s||d||{}}catch(r){return this.loggingService.catch("Error in DocService getBaseMetadata:",r),{}}}getServerId({documentId:e,organizationId:t}){try{return e&&(e=this.generateDocumentId(e)),t&&(t=this.generateOrganizationId(t)),{documentId:e,organizationId:t}}catch(r){return this.loggingService.catch("Error in DocService getServerId:",r),null}}fetchDocuments(e){return Q(this,null,function*(){try{if(!this.authService.getUser())return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),[];let r=[];if(!e?.organizationId)return this.loggingService.catch("Error in fetchDocuments: organizationId is required"),[];if(e?.folderId){let s=zo(e?.folderId);r.push(ut("metadata.veltFolderId","==",s))}return e?.documentIds?.length&&!e?.allDocuments&&r.push(ut("metadata.documentId","in",e?.documentIds?.map(s=>this.generateDocumentId(s)).slice(0,30))),yield this.commonDbService?.queryData({feature:"allDocuments",properties:{firestoreQuery:r,apiKey:this.apiKey??"",organizationId:this.generateOrganizationId(e?.organizationId)??this.documentPaths$.value?.organizationId,documentId:this.documentPaths$.value?.documentId}})}catch(t){return this.loggingService.catch("Error in DocService fetchDocuments:",t),[]}})}fetchLocations(e){return Q(this,null,function*(){try{if(!this.authService.getUser())return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),[];let r=[];if(!e?.organizationId)return this.commonDbService?.shouldUseFirestore()&&this.loggingService.catch("Error in fetchLocations: organizationId is required"),[];if(e?.folderId){let s=zo(e?.folderId);r.push(ut("metadata.veltFolderId","==",s))}return e?.documentIds?.length&&!e?.allDocuments&&r.push(ut("metadata.documentId","in",e?.documentIds?.map(s=>this.generateDocumentId(s)).slice(0,30))),yield this.commonDbService?.queryData({feature:"allLocations",properties:{firestoreQuery:r,apiKey:this.apiKey??"",organizationId:this.generateOrganizationId(e?.organizationId)??this.documentPaths$.value?.organizationId,documentId:this.documentPaths$.value?.documentId}})}catch(t){return this.loggingService.catch("Error in DocService fetchLocations:",t),[]}})}updateDocuments(e){return Q(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:r,documents:a,folderId:s}=e;if(!r&&(r=this.documentPaths$.value?.clientOrganizationId,!r))return this.loggingService.catch("Error in updateDocuments: organizationId is required"),[];let d=Tc(r);if(!a||a.length===0)return this.loggingService.catch("Error in updateDocuments: documents is required"),[];let p=[],u=this.documentMetadata$.value??{};for(let C of a)if(C?.documentId){C.organizationId=d,C.clientOrganizationId=r,C.clientDocumentId=C.documentId;let E=xc(C.documentId);C.documentId=E,C.apiKey=this.configService.getApiKey()??void 0,(s||this.documentPaths$.value?.folderId)&&(C.folderId=s||this.documentPaths$.value?.folderId,C.veltFolderId=zo(s||this.documentPaths$.value?.folderId||""));let D=()=>{if(s&&this.documentPaths$.value?.folderId&&s!==this.documentPaths$.value?.folderId)return;let G=u?.[E];G?u[E]=I(I({},G),C):u[E]=C},L=yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:E,organizationId:d,field:"metadata"}});if(L&&L.apiKey&&L.folderId&&s&&L.folderId!=C.folderId){this.loggingService.catch(`Error in updateDocuments: document ${C.clientDocumentId} already exists with different folderId: ${L.folderId}`);continue}if(L&&L.apiKey&&!L.folderId&&C.folderId){this.loggingService.catch(`Error in updateDocuments: document ${C.clientDocumentId} already exists, move this document to folder with REST API`);continue}D(),C&&this.commonDbService&&p.push(this.commonDbService.updateData({feature:"documentMetadata",data:JSON.parse(JSON.stringify(C)),properties:{organizationId:d,documentId:E}}))}yield Promise.all(p),this.documentMetadata$.next(u)}catch(t){return this.loggingService.catch("Error in DocService updateDocuments:",t),[]}})}updateLocations(e){return Q(this,null,function*(){try{if(!this.authService.getUser())return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),[];let{organizationId:r,locations:a,documentIds:s}=e;if((!s||s.length===0)&&(s=this.documentIds$.value.map(C=>C.clientDocumentId)??[],s.length===0))return this.loggingService.catch("Error in updateLocations: documentId is required"),[];if(!r&&(r=this.documentPaths$.value?.clientOrganizationId,!r))return this.loggingService.catch("Error in updateLocations: organizationId is required"),[];if(!a||a.length===0)return this.loggingService.catch("Error in updateLocations: locations is required"),[];let d=s.map(C=>xc(C)),p=[],u=this.locationMetadata$.value;u||(u={}),d.forEach(C=>{a.forEach(E=>{let D=this.location$.value;if(E?.id===D?.location?.id&&this.location$.next({locationId:D?.locationId,location:E}),E?.id){delete E?.metadata;let L=vj(E.id),G=u?.[C],Y=G?.[E.id];u&&(G||(u[C]={}),Y||(u[C][E.id]={}),u[C][E.id]=T(I({},Y),{location:E})),E&&this.commonDbService&&p.push(this.commonDbService.updateData({feature:"locationMetadata",data:JSON.parse(JSON.stringify({location:E})),properties:{organizationId:Tc(r),documentId:C,id:L}}))}})}),yield Promise.all(p),Object.keys(u||{}).length>0&&this.locationMetadata$.next(u)}catch(t){return this.loggingService.catch("Error in DocService updateLocations:",t),[]}})}fetchFolders(e){return Q(this,null,function*(){try{if(!this.authService.getUser())return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),[];let r=[];if(!e?.organizationId)return this.loggingService.catch("Error in fetchFolders: organizationId is required"),{data:[],parentFolders:[]};let a=[],s=this.generateOrganizationId(e?.organizationId);if(e?.folderId){let d=zo(e?.folderId);r=yield this.commonDbService?.getData({feature:"folder",properties:{folderId:d,apiKey:this.apiKey??"",organizationId:s,documentId:this.documentPaths$.value?.documentId}}),r&&(r=[r]),a=yield this.commonDbService?.queryData({feature:"allFolders",properties:{firestoreQuery:[ut("metadata.veltParentFolderId","==",d)],folderId:d,apiKey:this.apiKey??"",organizationId:s,documentId:this.documentPaths$.value?.documentId}})}else r=yield this.commonDbService?.queryData({feature:"allFolders",properties:{apiKey:this.apiKey??"",organizationId:s,documentId:this.documentPaths$.value?.documentId}});return{data:r,parentFolders:a}}catch(t){return this.loggingService.catch("Error in DocService getFoldersRequest:",t),{data:[],parentFolders:[]}}})}getDocumentIam$(){return this.authService.getUser$().pipe(he(e=>e?this.documentPaths$.pipe(he(t=>t?.documentIam?this.commonDbService?.dbListener({feature:"documentIam",properties:{documentId:t.documentId,organizationId:t.organizationId,isCollection:!1}}).pipe(de(r=>r?.data?.docIamConfig??r?.data),kt((r,a)=>JSON.stringify(r??{})===JSON.stringify(a??{}))):se(null))):se(null)))}getDocumentAccessType(e){try{return e&&e.features&&e.features.all?e.features.all.restricted?Ci.RESTRICTED:Ci.PUBLIC:e&&e.documentAccessType?e.documentAccessType:Ci.PUBLIC}catch(t){return this.loggingService.catch("Error in DocService getDocumentAccessType:",t),Ci.PUBLIC}}changeDocumentAccessType(e){return Q(this,null,function*(){try{let t=this.documentPaths$.value;if(t){let r=yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:t?.documentId??"",organizationId:t?.organizationId??"",field:"docIamConfig"}});switch(delete r.documentAccessType,r.features||(r.features={}),r.features.all||(r.features.all={}),e){case Ci.PUBLIC:r.features.all.restricted=!1;break;case Ci.RESTRICTED:r.features.all.restricted=!0,r.features.all.guestMode=!1;break;default:break}this.commonDbService?.updateData({feature:"documentAccessType",data:JSON.parse(JSON.stringify(r)),properties:{documentId: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(I(I({},this.uiState.value),e))}catch(t){this.loggingService.catch("Error in DocService setUIState:",t)}}getUIState$(){return this.uiState.asObservable()}};o.\u0275fac=function(t){return new(t||o)(J(tt),J(je),J(_n),J(Fe),J(Vt),J(y),J(ws),J(Ld),J(Nd))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Yn=(()=>{let o=class o{constructor(e,t,r,a){this.analyticsService=e,this.authService=t,this.docService=r,this.loggingService=a,this.defaultUserDataProvider={get:s=>Q(this,null,function*(){return{}})},this.resolveOrganizationUsers=new ve(!0),this.resolveFolderUsers=new ve(!0),this.resolveDocumentUsers=new ve(!0),this.resolveTimeout=1*60*1e3,this.maxResolveAttempts=1,this.resolveAttempts=new Map,this.subscriptions=new hn,this.userDataProvider$=new ve(null),this.userById$=new ve({}),this.userByIdCalled$=new ve({}),this.pendingResolutions=new Set,this.getUserById=s=>{try{return this.userById$.value?.[s]}catch(d){this.loggingService.catch("Error in UsersService getUserById:",d);return}};try{this.analyticsService.setUserService(this),this.authService.setUsersService(this)}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)}}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(r){return this.loggingService.catch("Error in UsersService isResolverForFeatureDisabled:",r),!1}}resolveUsers(d){return Q(this,arguments,function*({userIds:e,forceResolve:t,feature:r,organizationId:a,skipUserCheck:s=!1}){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: resolveUsers","color: green;");let p=!1;if(r&&(p=this.isResolverForFeatureDisabled(r)),p)return{};{let u={},C=[],E={};if(e?.forEach(D=>{let L=this.getUserById(D);L?u[D]=L:this.userByIdCalled$.getValue()[D]?t&&C.push(D):(C.push(D),this.userByIdCalled$.next(T(I({},this.userByIdCalled$.getValue()),{[D]:!0})))}),C.length>0){let D={};try{let L,G=new Promise((Y,ne)=>{L=setTimeout(()=>{ne(new Error("User resolution timeout"))},this.userDataProvider$.getValue()?.config?.resolveTimeout||this.userDataProvider$.getValue()?.resolveTimeout||this.resolveTimeout)});D=yield Promise.race([this.getUsersFromDB({userIds:C,organizationId:a,skipUserCheck:s}).finally(()=>{clearTimeout(L)}),G]),this.analyticsService.trackEvent(X.Events.Resolver.USER_RESOLVER_GET,{sourceMethod:"resolveUsers",source:"sdk",userIds:C})}catch(L){this.loggingService.catch("Error in UsersService resolveUsers getUsers:",L,{userIds:C})}finally{C?.forEach(L=>{D[L]||(D[L]={userId:L,name:`User ${L}`})})}Object.entries(D).forEach(([L,G])=>{G&&(u[L]=D?.[L],E[L]=D?.[L])})}return Object.keys(E).length>0&&(this.authService.setOptionalPropertiesToUsers(Object.values(E)),this.userById$.next(I(I({},this.userById$.getValue()),E))),u}}catch(p){return this.loggingService.catch("Error in UsersService resolveUsers:",p),{}}})}getUsersFromDB(a){return Q(this,arguments,function*({userIds:e,organizationId:t,skipUserCheck:r=!1}){this.loggingService.log("%c[WB] Calling UsersService FUNCTION: getUsersFromDB","color: green;");try{let s=this.userDataProvider$.getValue();return s?s.get(e):(t||(t=this.docService.getOrganizationConfig()?.organizationId),t?this.getUsersFromDBWithBatching({userIds:e,organizationId:t,skipUserCheck:r}):{})}catch(s){return this.loggingService.catch("Error in UsersService getUsersFromDB:",s),{}}})}getUsersFromDBWithBatching(a){return Q(this,arguments,function*({userIds:e,organizationId:t,skipUserCheck:r=!1}){try{if(!e?.length)return{};let s=[];for(let C=0;C<e.length;C+=30)s.push(e.slice(C,C+30));let d=s.map((C,E)=>Q(this,null,function*(){try{return(yield this.commonDbService?.queryData({feature:"allOrganizationUsers",properties:{organizationId:t,useCollectionGroup:!1,isCollection:!0,firestoreQuery:[ut("user.userId","in",C)],skipUserCheck:r}}))||[]}catch(D){return this.loggingService.catch(`Error in batch ${E+1}:`,D),[]}})),p=yield Promise.all(d),u={};return p.forEach(C=>{C.forEach(E=>{E?.user?.userId&&(u[E.user.userId]=E.user)})}),u}catch(s){return this.loggingService.catch("Error in getUsersFromDBWithBatching:",s),{}}})}subscribeToDocuments(){return this.docService.getDocumentIds$().pipe(gn(e=>Q(this,null,function*(){let t=yield this.getUsersFromCentralDb({documentIds:e?.map(r=>r.documentId)});this.resolveUsers({userIds:t})})))}getUsersFromCentralDb(t){return Q(this,arguments,function*({documentIds:e}){try{return new Promise(r=>{r(["customuser1","customuser2","customuser3"])})}catch{return[]}})}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()}catch(e){return this.loggingService.catch("Error in UsersService getUserById$:",e),se({})}}setUserByIds(e){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setUserByIds","color: green;");let t=this.userById$.getValue();e.forEach(r=>{t[r.userId]=I(I({},t?.[r.userId]??{}),r)}),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;"),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)}}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}}};o.\u0275fac=function(t){return new(t||o)(J(tt),J(je),J(at),J(y))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Sce=(()=>{let o=class o{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 r of e)r?.from?.userId&&t.add(r?.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}}};o.\u0275fac=function(t){return new(t||o)(J(y),J(Yn))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var bce=(()=>{let o=class o{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 r of e)r?.from?.userId&&t.add(r?.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}}};o.\u0275fac=function(t){return new(t||o)(J(y),J(Yn))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Jp=class{static getFirestoreProdDbName(o,n){return n?.storeDbId??(this.isTestingDb(n?.databaseURL??"")?"sdktest":`apikey${o.toLowerCase()}`)}static isTestingDb(o){try{return o.includes("-test")}catch(n){return mt.error("Error in isTestingDb:",n),!1}}};var eg=(()=>{let o=class o{constructor(e,t){this.loggingService=e,this.analyticsService=t,this.retrySaveConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryDeleteConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.attachmentDataProvider$=new ve(null);try{this.loggingService.log("AttachmentResolverService initialized"),this.attachmentDataProvider$.subscribe(r=>{r&&(r.config?.saveRetryConfig&&(this.retrySaveConfig=r.config.saveRetryConfig),r.config?.deleteRetryConfig&&(this.retryDeleteConfig=r.config.deleteRetryConfig))})}catch(r){this.loggingService.catch("Error in AttachmentResolverService constructor:",r)}}getProvider(){try{let e=this.attachmentDataProvider$.getValue();return e||void 0}catch(e){this.loggingService.catch("Error in AttachmentResolverService getProvider:",e);return}}saveAttachment(e){return Q(this,null,function*(){try{this.loggingService.log("%c[WB] Calling AttachmentResolverService FUNCTION: saveAttachment","color: green;");let t=this.getProvider();if(!this.attachmentDataProviderAvailable())throw new Error("Attachment save data provider not available");let r=yield wc(()=>t?.save({attachment:e.attachment,event:e.eventType,metadata:e.attachment.metadata})||Promise.resolve(void 0),"saveAttachment",this.retrySaveConfig);if(r?.statusCode!==200){this.loggingService.catch(r?.message??"Error in AttachmentResolverService saveAttachment:");return}return this.analyticsService.trackEvent(X.Events.Resolver.ATTACHMENT_RESOLVER_SAVE,{sourceMethod:"saveAttachment",source:"sdk",attachmentId:e.attachment.attachmentId,eventType:e.eventType}),r}catch(t){this.loggingService.warn("Error in AttachmentResolverService saveAttachment:",t);return}})}deleteAttachment(r){return Q(this,arguments,function*({attachmentId:e,metadata:t}){try{this.loggingService.log("%c[WB] Calling AttachmentResolverService FUNCTION: deleteAttachment","color: green;");let a=this.getProvider();if(!this.attachmentDataProviderAvailable())throw new Error("Attachment delete data provider not available");let s=yield wc(()=>a?.delete({attachmentId:e,metadata:t,event:Ja.ATTACHMENT_DELETE})||Promise.resolve(void 0),"deleteAttachment",this.retryDeleteConfig);return s?.statusCode!==200?(this.loggingService.catch(s?.message??"Error in AttachmentResolverService deleteAttachment:"),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(X.Events.Resolver.ATTACHMENT_RESOLVER_DELETE,{sourceMethod:"deleteAttachment",source:"sdk",attachmentId:e}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0})}catch(a){return this.loggingService.warn("Error in AttachmentResolverService deleteAttachment:",a),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0}}})}setAttachmentDataProvider(e){try{if(e){this.loggingService.log("Setting attachment data provider");let r=["save","delete"].filter(a=>!(a in e)||typeof e[a]!="function");if(r.length>0){let a=`DataProviders.attachment is invalid. The following methods are missing or are not functions: ${r.join(", ")}.`;this.loggingService.catch(a);return}else this.attachmentDataProvider$.next(e)}}catch(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}}};o.\u0275fac=function(t){return new(t||o)(J(y),J(tt))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var c0=(()=>{let o=class o{constructor(e,t,r,a,s,d,p){this.loggingService=e,this.usersService=t,this.authService=r,this.functions=a,this.configService=s,this.commentAnnotationsResolverService=d,this.attachmentResolverService=p,this.notificationActionTypeMap={[jt.NEWLY_ADDED]:Ja.COMMENT_ANNOTATION_ADD,[jt.ADDED]:Ja.COMMENT_ADD,[jt.UPDATED]:Ja.COMMENT_UPDATE,[jt.DELETED]:Ja.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)}}getUserIdsToResolveFromComments(e){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: getUserIdsToResolveFromComments","color: green;");let t=new Set;for(let r of e){if(r?.from?.userId&&t.add(r?.from?.userId),r?.comments)for(let a of r?.comments){if(a?.from?.userId&&t.add(a?.from?.userId),a?.to)for(let s of a?.to)s?.userId&&t.add(s?.userId);if(a?.taggedUserContacts)for(let s of a?.taggedUserContacts)s?.userId&&t.add(s?.userId)}if(r?.assignedTo?.userId&&t.add(r?.assignedTo?.userId),r?.subscribedUsers)for(let a of Object.values(r?.subscribedUsers))a.user.userId&&t.add(a.user.userId);if(r?.unsubscribedUsers)for(let a of Object.values(r?.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 s=this.usersService.getUserById(a?.userId);if(s)return I(I({},a),s)}return a})),t?.taggedUserContacts&&(t.taggedUserContacts=t?.taggedUserContacts?.map(a=>{if(a?.contact){let s=this.usersService.getUserById(a?.contact?.userId);s&&(a.contact=s,(s?.name||s?.email)&&(a.text=`@${s?.name||s?.email}`))}return a})),(t?.taggedUserContacts?.filter((a,s,d)=>d.findIndex(p=>p.text===a.text)===s)||[]).forEach(a=>{if(a?.text){let s=new RegExp(xd(`{{${a.userId}}}`),"g");t.commentText=t.commentText?.replaceAll(s,a.text),t.commentHtml=t.commentHtml?.replaceAll(s,a.text)}})}if(e?.assignedTo?.userId){let t=this.usersService.getUserById(e?.assignedTo?.userId);t&&(e.assignedTo=t)}if(e?.subscribedUsers)for(let t of Object.values(e?.subscribedUsers)){let r=this.usersService.getUserById(t.user.userId);r&&e?.subscribedUsers?.id?.user&&(e.subscribedUsers.id.user=r)}if(e?.unsubscribedUsers)for(let t of Object.values(e?.unsubscribedUsers)){let r=this.usersService.getUserById(t.user.userId);r&&e?.unsubscribedUsers?.id?.user&&(e.unsubscribedUsers.id.user=r)}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)}),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),r=this.attachmentResolverService.attachmentDataProviderAvailable(),a=this.commentAnnotationsResolverService.getFieldsToRemove();return t&&(e?.comments?.forEach(s=>{let d=t?.comments?.[s?.commentId];if(d){s.commentHtml=d?.commentHtml,s.commentText=d?.commentText;let p=d?.attachments;r&&p&&s.attachments?.forEach(u=>{let C=u?.attachmentId;p?.[C]&&(u.name=p?.[C]?.name,u.url=p?.[C]?.url)})}}),t?.targetTextRange?.text&&e?.targetTextRange&&(e.targetTextRange.text=t?.targetTextRange?.text),a?.length>0&&a.forEach(s=>{t?.[s]&&(e[s]=t[s])})),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 r=e?.location?.id,a=e?.metadata?.documentId;if(!r||!a)return e;let s=t?.[a]?.[r];return s&&(e.location=s?.location),e}catch(r){return this.loggingService.catch("Error in CommentUtilsService mergeLocationWithCommentAnnotations:",r),e}}isCommentsDataChanged(e,t){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: isCommentsDataChanged","color: green;");let r=this.commentAnnotationsResolverService.getCommentAnnotationById(t);return r?!zi(e,r):!0}catch(r){return this.loggingService.catch("Error in CommentUtilsService isCommentsDataChanged:",r),!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 r=this.attachmentResolverService.attachmentDataProviderAvailable(),a=new Mc;if(Object.assign(a,e),a.isCommentResolverUsed=t,r){let s=a.attachments?.map(d=>(d.isAttachmentResolverUsed=!0,delete d?.name,delete d?.url,d));a.attachments=s}return delete a?.commentHtml,delete a?.commentText,a}catch(t){return this.loggingService.catch("Error in CommentUtilsService stripCommentsFromAnnotationData:",t),e}}stripCommentAnnotationData({data:e,actionType:t}){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: stripCommentAnnotationData","color: green;"),!this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable()||!t)return{originalData:e,strippedData:null};let r=this.attachmentResolverService.attachmentDataProviderAvailable(),a=this.commentAnnotationsResolverService.getFieldsToRemove(),s=this.notificationActionTypeMap?.[t],d={},p=null,u=!1;if(e&&e.annotationId){let C=e.annotationId;d[C]=I(I(I(I({annotationId:C,metadata:wv(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,a?.length>0&&a.forEach(D=>{e?.[D]&&(d[C][D]=e[D],delete e[D])}),e.comments?.forEach(D=>{if(D.commentId){let L;r&&(L={},D.attachments?.forEach(G=>{L[G.attachmentId]={attachmentId:G.attachmentId,name:G.name,url:G.url}})),d[C].comments[D.commentId]=I(I(I(I(I(I({commentId:D.commentId},D?.commentHtml&&{commentHtml:D?.commentHtml}),D?.commentText&&{commentText:D?.commentText}),L&&{attachments:L}),D?.from&&{from:D?.from}),D?.to&&{to:D?.to}),D?.taggedUserContacts&&{taggedUserContacts:D?.taggedUserContacts})}}),u=this.isCommentsDataChanged(d[C],C);let E=new ko;Object.assign(E,e),E.comments=e.comments?.map(D=>this.stripCommentsFromAnnotationData({comment:D}))||[],p=E}return{strippedData:u?d:null,originalData:p,eventType:s}}catch(r){return this.loggingService.catch("Error in CommentAnnotationsResolverService stripCommentAnnotationData:",r),{strippedData:null,originalData:null}}}formatCommentThreadData(e){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: formatCommentThreadData","color: green;"),this.usersService.userDataProviderAvailable()){e?.from?.userId&&(e.from={userId:e.from.userId}),e?.to&&(e.to=e?.to?.map(r=>r?.userId?{userId:r.userId}:r)),e?.taggedUserContacts&&(e.taggedUserContacts=e?.taggedUserContacts?.map(r=>r?.contact?T(I({},r),{contact:{userId:r.userId}}):r));let t=e?.taggedUserContacts?.filter((r,a,s)=>s.findIndex(d=>d.text===r.text)===a)||[];t.forEach(r=>{if(r?.text){let a=new RegExp(xd(r.text),"g");e.commentText=e.commentText?.replaceAll(a,s=>`{{${r.userId}}}`),e.commentHtml=e.commentHtml?.replaceAll(a,s=>`{{${r.userId}}}`)}}),t.forEach(r=>{r?.text&&(r.text="")})}return e}catch(t){return this.loggingService.catch("Error in CommentUtilsService formatCommentThreadData:",t),e}}handleCommentEncryption(s){return Q(this,arguments,function*({data:e,firestorePath:t,extraData:r,eventType:a}){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: handleCommentEncryption","color: green;");let d=NP(this.authService.getFirebaseConfig()?.firebaseOptions),p=yr(this.functions,br({url:ni.cloudFunction?.[d]?.setEncryptedData,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:20*60*1e3});if(r){r=this.notificationService?.processNotificationData(r),r.annotationData=e;let D=r?.targetAnnotationData?.commentId;if(D){let L=e?.comments?.find(G=>G?.commentId===D);L&&(r.targetAnnotationData=L)}try{let L=this.stripCommentAnnotationData({data:r.annotationData,actionType:r?.actionType??jt.NEWLY_ADDED});L?.originalData&&(r.annotationData=this.formatCommentData(L.originalData)),r?.targetAnnotationData&&(r.targetAnnotationData=this.formatCommentThreadData(this.stripCommentsFromAnnotationData({comment:r.targetAnnotationData})))}catch(L){this.loggingService.warn("Error in CommentUtilsService handleCommentEncryption:",L)}}let u=Jp.getFirestoreProdDbName(this.configService.getApiKey()??"",this.authService.getFirebaseConfig()?.firebaseOptions),C={path:t??"",data:e??{},dbId:u??"",notificationData:r||void 0,notificationURL:ni.firebaseNotificationsDatabaseURL,feature:"comment",eventType:a??"PATCH",sdkVersion:fa()},E=yield Up(C,this.authService.getUser()?.userId??"");yield p({veltData:E})}catch(d){this.loggingService.catch("Error in CommentUtilsService handleCommentEncryption:",d)}})}};o.\u0275fac=function(t){return new(t||o)(J(y),J(Yn),J(je),J($o),J(Vt),J(ws),J(eg))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Ice=(()=>{let o=class o{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 r of e)r?.user?.userId&&t.add(r?.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);t&&(e=T(I({},e),{user:t}))}return e}catch(t){return this.loggingService.catch("Error in ContactUtilsService mergeUserIamWithUser: ",t),e}}};o.\u0275fac=function(t){return new(t||o)(J(y),J(Yn))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Ece=(()=>{let o=class o{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 r of e)r?.userId&&t.add(r?.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=I(I({},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(r=>{t.includes(r)||(e[r]=null)})}return e}catch(t){return this.loggingService.catch("Error in CursorUtilsService formatCursorUserData:",t),e}}};o.\u0275fac=function(t){return new(t||o)(J(y),J(Yn))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var yk=(()=>{let o=class o{constructor(e,t){this.loggingService=e,this.usersService=t}getUserIdsToResolveFromHuddleAttendees(e){try{this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: getUserIdsToResolveFromHuddleAttendees","color: green;");let t=new Set;for(let r of e)r?.userId&&t.add(r?.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=I(I({},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(r=>{t.includes(r)||(e[r]=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 r of e)r?.from?.userId&&t.add(r?.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 Q(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: resolveUsersFromHuddleMessages","color: green;"),this.usersService.userDataProviderAvailable()){let t=this.getUserIdsToResolveFromHuddleMessages(e),r=yield this.usersService.resolveUsers({userIds:t});for(let a of e)a?.from?.userId&&r[a.from.userId]&&(a.from=r[a.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}}};o.\u0275fac=function(t){return new(t||o)(J(y),J(Yn))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Tce=(()=>{let o=class o{constructor(e,t){this.loggingService=e,this.usersService=t}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 r of e)r?.updatedBy?.userId&&t.add(r?.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),[]}}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}}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 r=this.usersService.getUserById(t?.updatedBy?.userId);r&&(t.updatedBy=r)}return e}catch(t){return this.loggingService.catch("Error in mergeLiveStateCustomsWithUsers:",t),e}}};o.\u0275fac=function(t){return new(t||o)(J(y),J(Yn))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Dce=(()=>{let o=class o{constructor(e,t){this.loggingService=e,this.usersService=t}getUserIdsToResolveFromMultiThreads(e){try{let t=new Set;for(let r of e)r?.from?.userId&&t.add(r?.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}}};o.\u0275fac=function(t){return new(t||o)(J(y),J(Yn))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var d0=(()=>{let o=class o{constructor(e,t,r){this.authService=e,this.loggingService=t,this.usersService=r}getUserIdsToResolveFromRecorders(e){try{let t=new Set;for(let r of e)r?.from?.userId&&t.add(r?.from?.userId),r?.transcription?.from?.userId&&t.add(r?.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?T(I({},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(r){return this.loggingService.catch("Error in RecorderUtilsService formatRecorderData:",r),e}}formatRecorderDataForWhisperTranscription(e){try{return this.usersService.userDataProviderAvailable()&&e?.fromUser?.userId&&(e.fromUser={userId:e.fromUser?.userId}),e}catch(t){return this.loggingService.catch("Error in RecorderUtilsService formatRecorderDataForWhisperTranscription:",t),e}}encryptRecorderAnnotation(e){return Q(this,null,function*(){try{return yield Up(e,this.authService.getUser()?.userId??"")}catch(t){this.loggingService.catch("Error in RecorderUtilsService encryptRecorderAnnotation:",t);return}})}};o.\u0275fac=function(t){return new(t||o)(J(je),J(y),J(Yn))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Sk=(()=>{let o=class o{constructor(e,t,r,a,s,d){this.commentUtilsService=e,this.recorderUtilsService=t,this.loggingService=r,this.usersService=a,this.authService=s,this.commentAnnotationsResolverService=d}getUserIdsToResolveFromNotifications(e){try{let t=new Set;for(let r of e){let{notification:a}=r;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 s=this.commentUtilsService.getUserIdsToResolveFromComments([a?.notificationSourceData]);for(let d of s)t.add(d)}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),r=e?.raw?.targetAnnotationData?.commentId,a=t?.comments?.[r]?.commentText,s=t?.comments?.[r]?.commentHtml;return a&&s&&e?.raw?.notificationSource==="comment"&&(e.notification.displayBodyMessageTemplate=a,e.raw.targetAnnotationData.commentText=a,e.raw.targetAnnotationData.commentHtml=s),e}catch(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 r=e?.notification?.notificationSourceData?.location?.id,a=e?.notification?.notificationSourceData?.metadata?.documentId;if(!r||!a)return e;let s=t?.[a]?.[r];return s&&(e.notification.notificationSourceData.location=s?.location,e?.raw?.annotationData?.location&&(e.raw.annotationData.location=s?.location)),e}catch(r){return this.loggingService.catch("Error in NotificationUtilsService mergeLocationWithNotification:",r),e}}mergeNotificationWithUser(e){try{this.loggingService.log("%c[WB] Calling NotificationUtilsService FUNCTION: mergeNotificationWithUser","color: green;");let{notification:t}=e;if(t?.actionUser?.userId){let r=this.usersService.getUserById(t?.actionUser?.userId);r&&(t.actionUser=r)}if(t?.displayHeadlineMessageTemplateData?.actionUser?.userId){let r=this.usersService.getUserById(t?.displayHeadlineMessageTemplateData?.actionUser?.userId);r&&(t.displayHeadlineMessageTemplateData.actionUser=r)}if(t?.displayHeadlineMessageTemplateData?.recipientUser?.userId){let r=this.usersService.getUserById(t?.displayHeadlineMessageTemplateData?.recipientUser?.userId);r&&(t.displayHeadlineMessageTemplateData.recipientUser=r)}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(r){return this.loggingService.catch("Error in NotificationUtilsService formatNotification: ",r),e}}getTargetAnnotationIdsFromNotifications(e){try{this.loggingService.log("%c[WB] Calling NotificationUtilsService FUNCTION: getTargetAnnotationIdsFromNotifications","color: green;");let t=[];return Object.values(e).forEach(r=>{r?.notification?.targetAnnotationId&&r?.raw?.notificationSource==="comment"&&t.push(r.notification.targetAnnotationId)}),t}catch(t){return this.loggingService.catch("Error in NotificationUtilsService getTargetAnnotationIdsFromNotifications:",t),[]}}handleNotificationEncryption(t){return Q(this,arguments,function*({data:e}){try{this.loggingService.log("%c[WB] Calling NotificationUtilsService FUNCTION: handleNotificationEncryption","color: green;");let r="notificationwithdocumentidstoencryptanddecryptonsdk"+(this.authService.getUser()?.userId??"");return yield Up(e,r)}catch(r){return this.loggingService.catch("Error in NotificationUtilsService handleNotificationEncryption:",r),e}})}};o.\u0275fac=function(t){return new(t||o)(J(c0),J(d0),J(y),J(Yn),J(je),J(ws))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Oce=(()=>{let o=class o{constructor(e,t){this.loggingService=e,this.usersService=t}getUserIdsToResolveFromPresenceUsers(e){try{let t=new Set;for(let r of e)r?.userId&&t.add(r?.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=I(I({},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(r=>{t.includes(r)||(e[r]=null)})}return e}catch(t){return this.loggingService.catch("Error in PresenceUtilsService formatPresenceUserData:",t),e}}};o.\u0275fac=function(t){return new(t||o)(J(y),J(Yn))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Ace=(()=>{let o=class o{constructor(e,t,r,a,s,d){this.loggingService=e,this.usersService=t,this.authService=r,this.functions=a,this.configService=s,this.reactionAnnotationsResolverService=d}getUserIdsToResolveFromReactions(e){try{let t=new Set;for(let r of e)if(r?.from?.userId&&t.add(r?.from?.userId),r?.reactions?.length)for(let a of r?.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 Q(this,arguments,function*({data:e,firestorePath:t,eventType:r}){try{let s=NP(this.authService.getFirebaseConfig()?.firebaseOptions),d=yr(this.functions,br({url:ni.cloudFunction?.[s]?.setEncryptedData,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:20*60*1e3}),p=Jp.getFirestoreProdDbName(this.configService.getApiKey()??"",this.authService.getFirebaseConfig()?.firebaseOptions),u=this.authService.getUser()?.userId??"",C={path:t??"",data:e??{},dbId:p??"",feature:"reaction",eventType:r??"PATCH",sdkVersion:fa()},E=yield Up(C,u);yield d({veltData:E})}catch(s){this.loggingService.catch("Error in handleReactionEncryption:",s)}})}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 r=this.usersService.getUserById(t?.from?.userId);r&&(t.from=r)}}}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 r=this.reactionAnnotationsResolverService.getReactionAnnotationById(t);return r?!zi(e,r):!0}catch(r){return this.loggingService.catch("Error in ReactionUtilsService isReactionDataChanged:",r),!0}}stripReactionAnnotationData(e){try{if(this.loggingService.log("%c[WB] Calling ReactionUtilsService FUNCTION: stripReactionAnnotationData","color: green;"),!this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable())return{originalData:e,strippedData:null};let t={};if(e&&e.annotationId){let r=e.annotationId;if(t[r]=I({annotationId:r,metadata:wv(e.metadata??{}),icon:e.icon},e?.from&&{from:e?.from}),!this.isReactionDataChanged(t[r],r))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}}};o.\u0275fac=function(t){return new(t||o)(J(y),J(Yn),J(je),J($o),J(Vt),J(Ld))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Pce=(()=>{let o=class o{constructor(e,t){this.loggingService=e,this.usersService=t}getUserIdsToResolveFromSelections(e){try{let t=new Set;for(let r of e)r?.user?.userId&&t.add(r.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}}};o.\u0275fac=function(t){return new(t||o)(J(y),J(Yn))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Mce=(()=>{let o=class o{constructor(e,t){this.loggingService=e,this.usersService=t}getUserIdsToResolveFromTags(e){try{let t=new Set;for(let r of e)if(r?.from?.userId&&t.add(r.from.userId),r?.to?.length)for(let a of r.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 r=this.usersService.getUserById(t?.userId);r&&(t=r)}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}}};o.\u0275fac=function(t){return new(t||o)(J(y),J(Yn))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var tg=(()=>{let o=class o{constructor(e,t,r,a,s,d,p,u,C,E,D,L,G,Y,ne,ge,ye,Re,Ge){this.areaUtilsService=e,this.arrowUtilsService=t,this.commentUtilsService=r,this.contactUtilsService=a,this.cursorUtilsService=s,this.huddleUtilsService=d,this.liveStateUtilsService=p,this.loggingService=u,this.multiThreadUtilsService=C,this.notificationUtilsService=E,this.presenceUtilsService=D,this.reactionUtilsService=L,this.recorderUtilsService=G,this.selectionUtilsService=Y,this.tagUtilsService=ne,this.usersService=ge,this.docService=ye,this.commentAnnotationsResolverService=Re,this.reactionAnnotationsResolverService=Ge}getFirestorePath({feature:e,properties:t,documentPaths:r,apiKey:a}){try{if(!a)return;let{documentId:s,organizationId:d,folderId:p}=t;d||(d=r?.organizationId);let u=new vk({apiKey:a,documentId:s?`${s}`:"",organizationId:d?`${d}`:"",veltFolderId:p?`${p}`:void 0});switch(e){case"userConfig":return t?.userId&&t?.documentId&&u?.userConfig?`${u?.userConfig}/${t?.userId}/${j.FIREBASE_PARTIAL_PATH_DOCUMENT_CONFIGURATIONS}/${t?.documentId}`:void 0;case"allPermissionsUsers":return u?.permissionsUsers?`${u?.permissionsUsers}`:void 0;case"comment":return t?.documentId&&t?.id&&u?.comment?`${u?.comment}/${t?.id}`:void 0;case"allComments":return t?.documentId&&u?.comment?`${u?.comment}`:void 0;case"multiThread":return t?.documentId&&t?.id&&u?.multiThread?`${u?.multiThread}/${t?.id}`:void 0;case"allMultiThreads":return t?.documentId&&u?.multiThread?`${u?.multiThread}`:void 0;case"crdt":return t?.documentId&&u?.crdt&&t?.id?`${u?.crdt}/${t?.id}`:void 0;case"allLastNotificationTimestamp":return u?.lastNotificationTimestamp?`${u?.lastNotificationTimestamp}`:void 0;case"lastNotificationTimestamp":return t?.id&&u?.lastNotificationTimestamp?`${u?.lastNotificationTimestamp}/${t?.id}`:void 0;case"area":return t?.documentId&&t?.id&&u?.area?`${u?.area}/${t?.id}`:void 0;case"allAreas":return t?.documentId&&u?.area?`${u?.area}`:void 0;case"allDocuments":return u?.document?`${u?.document}`:void 0;case"allLocations":return u?.location?`${u?.location}`:void 0;case"allFolders":return u?.folder?`${u?.folder}`:void 0;case"folder":return u?.folder&&t.folderId?`${u?.folder}/${t.folderId}`:void 0;case"documentUserAccess":return t?.documentId&&t?.id&&u?.documentUsers?`${u?.documentUsers}/${t?.id}`:void 0;case"reaction":return t?.documentId&&t?.id&&u?.reaction?`${u?.reaction}/${t?.id}`:void 0;case"allReactions":return t?.documentId&&u?.reaction?`${u?.reaction}`:void 0;case"recorder":return t?.documentId&&t?.id&&u?.recorder?`${u?.recorder}/${t?.id}`:void 0;case"allRecorders":return t?.documentId&&u?.recorder?`${u?.recorder}`:void 0;case"documentAccessType":return t?.documentId&&u?.document?`${u?.document}/${t?.documentId}`:void 0;case"organizationMetadata":return u?.organization?`${u?.organization}`:void 0;case"documentIam":case"documentMetadata":return t?.documentId&&u?.document?`${u?.document}/${t?.documentId}`:void 0;case"folderMetadata":return t?.folderId&&u?.folder?`${u?.folder}/${t?.folderId}`:void 0;case"locationMetadata":return t?.documentId&&u?.location&&t?.id?`${u?.location}/${t?.id}`:void 0;case"documentUser":return t?.documentId&&t?.id&&u?.documentUsers?`${u?.documentUsers}/${t?.id}`:void 0;case"allDocumentUsers":return u?.users?`${u?.users}`:void 0;case"allFolderUsers":return u?.users?`${u?.users}`:void 0;case"allOrganizationGroups":return u?.organizationGroups?`${u?.organizationGroups}`:void 0;case"allOrganizationUsers":return u?.users?`${u?.users}`:void 0;case"commentViews":return t?.documentId&&t?.id&&u?.commentViews?`${u?.commentViews}/${t?.id}`:void 0;case"allCommentViews":return t?.documentId&&u?.commentViews?`${u?.commentViews}`:void 0;case"notificationViewsTimestamp":return t?.documentId&&t?.id&&u?.notificationViews?`${u?.notificationViews}/${t?.id}`:void 0;case"allDocumentViews":return t?.documentId&&u?.documentViews?`${u?.documentViews}`:void 0;case"documentViews":case"documentMetadataViews":case"documentDayViews":case"documentUsersViews":return t?.documentId&&t?.id&&u?.documentViews?`${u?.documentViews}/${t?.id}`:void 0;case"locationDayViews":case"locationUsersViews":case"locationViews":case"locationMetadataViews":case"location":return t?.documentId&&t?.id&&u?.locationViews?`${u?.locationViews}/${t?.id}`:void 0;case"allLocationViews":return t?.documentId&&u?.locationViews?`${u?.locationViews}`:void 0;case"allDocNotifications":return t?.documentId&&u?.docNotification?`${u?.docNotification}`:void 0;case"docNotificationViews":case"docNotification":return t?.documentId&&t?.id&&u?.docNotification?`${u?.docNotification}/${t?.id}`:void 0;case"userNotificationViews":case"userNotification":return t?.userId&&t?.id&&u?.notificationUsers?`${u?.notificationUsers}/${t?.userId}/${j.FIREBASE_PARTIAL_PATH_USER_NOTIFICATION}/${t?.id}`:void 0;case"allDocNotifications":return t?.documentId&&u?.docNotification?`${u?.docNotification}`:void 0;case"allUserNotifications":return t?.userId&&u?.notificationUsers?`${u?.notificationUsers}/${t?.userId}/${j.FIREBASE_PARTIAL_PATH_USER_NOTIFICATION}`:void 0;default:throw new Error(`Unknown feature: ${e}`)}}catch(s){this.loggingService.catch("Error in CommonDbUtilsService getFirestorePath:",s);return}}getFirestoreCollectionGroupPath(e){try{switch(e){case"allComments":return j.FIREBASE_PARTIAL_PATH_COMMENT;case"allDocuments":return j.FIREBASE_PARTIAL_PATH_DOCS;case"allLocations":return j.FIREBASE_PARTIAL_PATH_LOCATION;case"allMultiThreads":return j.FIREBASE_PARTIAL_PATH_MULTI_THREAD;case"allAreas":return j.FIREBASE_PARTIAL_PATH_AREA;case"allReactions":return j.FIREBASE_PARTIAL_PATH_REACTION;case"allRecorders":return j.FIREBASE_PARTIAL_PATH_RECORDER;case"allDocumentViews":return j.FIREBASE_PARTIAL_PATH_DOCUMENT_VIEWS;case"allCommentViews":return j.FIREBASE_PARTIAL_PATH_COMMENT_VIEWS;case"allLocationViews":return j.FIREBASE_PARTIAL_PATH_LOCATION_VIEWS;case"allDocumentUsers":return j.FIREBASE_PARTIAL_PATH_DOCUMENT_USERS;case"allFolderUsers":return j.FIREBASE_PARTIAL_PATH_FOLDER_USERS;default:throw new Error(`Unknown feature: ${e}`)}}catch(t){this.loggingService.catch("Error in CommonDbUtilsService getFirestoreCollectionGroupPath:",t);return}}getDocumentPath({feature:e,properties:t,defaultDocumentPaths:r,apiKey:a,useFirestore:s}){try{if(!a)return;let{documentId:d,organizationId:p}=t;p||(p=r?.organizationId);let u=new Fd({apiKey:a,documentId:d?`${d}`:"",organizationId:p?`${p}`:""});switch(e){case"userConfig":return t?.userId&&t?.documentId&&u?.userConfig?`${u?.userConfig}/${t?.userId}/${j.FIREBASE_PARTIAL_PATH_DOCUMENT_CONFIGURATIONS}/${t?.documentId}`:void 0;case"allComments":return!s&&t?.documentId&&u?.comment?`${u?.comment}`:void 0;case"allGlobalContacts":return t?.documentId&&u?.globalContacts?`${u?.globalContacts}`:void 0;case"globalContacts":return t?.documentId&&t?.userId&&u?.globalContacts?`${u?.globalContacts}${t?.userId}`:void 0;case"groupContacts":return t?.documentId&&t?.groupId&&u?.groupContacts?`${u?.groupContacts}${t?.groupId}`:void 0;case"groupContactsUser":return t?.documentId&&t?.groupId&&t?.userId&&u?.groupContacts?`${u?.groupContacts}${t?.groupId}/${t?.userId}`:void 0;case"allLoginContacts":return t?.documentId&&t?.userId&&u?.logins?`${u?.logins}${t?.userId}/contacts`:void 0;case"allLogins":return t?.documentId&&u?.logins?`${u?.logins}`:void 0;case"logins":return t?.documentId&&t?.userId&&u?.logins?`${u?.logins}${t?.userId}`:void 0;case"customerMetadata":return u?.customerMetadata?`${u?.customerMetadata}`:void 0;case"allArrows":return t?.documentId&&u?.arrow?`${u?.arrow}`:void 0;case"arrow":return t?.documentId&&u?.arrow&&t.id?`${u?.arrow}${t.id}`:void 0;case"allCursors":return t?.documentId&&u?.cursor?`${u?.cursor}`:void 0;case"cursor":return t?.documentId&&u?.cursor&&t.id?`${u?.cursor}${t.id}`:void 0;case"flockUser":return t?.documentId&&u?.flock&&t.id?`${u?.flock}users/${t.id}`:void 0;case"flockSession":return t?.documentId&&u?.flock&&t.id?`${u?.flock}sessions/${t.id}`:void 0;case"allHuddleAttendees":return t?.documentId&&u?.huddle?`${u?.huddle}attendees`:void 0;case"huddleAttendee":return t?.documentId&&u?.huddle&&t.id?`${u?.huddle}attendees/${t.id}`:void 0;case"huddleAttendeeState":return t?.documentId&&u?.huddle&&t.id?`${u?.huddle}attendees/${t.id}/state`:void 0;case"allHuddleInvitees":return t?.documentId&&u?.huddle?`${u?.huddle}invitees`:void 0;case"huddleConnection":return t?.documentId&&u?.huddle&&t.id?`${u?.huddle}connections/${t.id}`:void 0;case"huddleIceCandidate":return t?.documentId&&u?.huddle&&t.id?`${u?.huddle}iceCandidates/${t.id}`:void 0;case"allHuddleIceCandidates":return t?.documentId&&u?.huddle?`${u?.huddle}iceCandidates`:void 0;case"allHuddleMessages":return t?.documentId&&u?.huddle?`${u?.huddle}messages`:void 0;case"huddleMessage":return t?.documentId&&u?.huddle&&t.id?`${u?.huddle}messages/${t.id}`:void 0;case"allLiveStates":return t?.documentId&&u?.liveState?`${u?.liveState}`:void 0;case"allLiveStateCustoms":return t?.documentId&&u?.liveState?`${u?.liveState}custom`:void 0;case"liveStateCustom":return t?.documentId&&u?.liveState&&t?.id?`${u?.liveState}custom/${t.id}`:void 0;case"liveStateSingleEditorMode":return t?.documentId&&u?.liveStateSingleEditorMode?`${u?.liveStateSingleEditorMode}`:void 0;case"liveStateAutoSyncStateCurrent":return t?.documentId&&u?.liveState?`${u?.liveState}default/autoSyncState/current`:void 0;case"liveStateAutoSyncStateHistoryId":return t?.documentId&&u?.liveState&&t?.id?`${u?.liveState}default/autoSyncState/history/${t.id}`:void 0;case"presence":return t?.documentId&&u?.presence&&t?.userId?`${u?.presence}${t?.userId}`:void 0;case"allPresence":return t?.documentId&&u?.presence?`${u?.presence}`:void 0;case"workspaceIam":return u?.workspaceIam?`${u?.workspaceIam}`:void 0;case"selection":return t?.documentId&&u?.selection&&t?.userId?`${u?.selection}${t?.userId}`:void 0;case"allSelections":return t?.documentId&&u?.selection?`${u?.selection}`:void 0;case"syncVideoPlayer":return t?.documentId&&u?.syncVideoPlayer?`${u?.syncVideoPlayer}`:void 0;case"allTags":return t?.documentId&&u?.tag?`${u?.tag}`:void 0;case"tag":return t?.documentId&&u?.tag&&t?.id?`${u?.tag}${t?.id}`:void 0;case"userContactUs":return t?.documentId&&u?.userContactUs?`${u?.userContactUs}`:void 0;case"userFeedback":return t?.documentId&&u?.userFeedback?`${u?.userFeedback}`:void 0;case"userReportBug":return t?.documentId&&u?.userReportBugs?`${u?.userReportBugs}`:void 0;case"comment":return!s&&t?.documentId&&t?.id&&u?.comment?`${u?.comment}${t?.id}`:void 0;case"allMultiThreads":return!s&&t?.documentId&&u?.multiThread?`${u?.multiThread}`:void 0;case"crdt":return!s&&t?.documentId&&u?.crdt?`${u?.crdt}`:void 0;case"crdtData":return t?.documentId&&u?.crdt&&t?.id?`${u?.crdt}/${t?.id}/data`:void 0;case"crdtSyncState":return t?.documentId&&u?.crdt&&t?.id?`${u?.crdt}/${t?.id}/sync/state`:void 0;case"crdtSyncPresence":return t?.documentId&&t.userId&&u?.crdt&&t?.id?`${u?.crdt}/${t?.id}/sync/presence/${t.userId}`:void 0;case"allCrdtSyncPresence":return t?.documentId&&u?.crdt&&t?.id?`${u?.crdt}/${t?.id}/sync/presence`:void 0;case"crdtPresence":return t?.documentId&&t.userId&&u?.crdt&&t?.id?`${u?.crdt}/${t?.id}/presence/${t.userId}`:void 0;case"allCrdtPresence":return t?.documentId&&u?.crdt&&t?.id?`${u?.crdt}/${t?.id}/presence`:void 0;case"crdtVersion":return t?.documentId&&u?.crdt&&t?.id&&t?.versionId?`${u?.crdt}/${t?.id}/versions/${t?.versionId}`:void 0;case"crdtVersions":return t?.documentId&&u?.crdt&&t?.id?`${u?.crdt}/${t?.id}/versions`:void 0;case"multiThread":return!s&&t?.documentId&&t?.id&&u?.multiThread?`${u?.multiThread}${t?.id}`:void 0;case"allLastNotificationTimestamp":return!s&&u?.organizationNotificationsLastNotificationTimestamp?`${u?.organizationNotificationsLastNotificationTimestamp}`:void 0;case"lastNotificationTimestamp":return!s&&t?.id&&u?.organizationNotificationsLastNotificationTimestamp?`${u?.organizationNotificationsLastNotificationTimestamp}${t?.id}`:void 0;case"documentIam":return!s&&t?.documentId&&u?.documentIam?`${u?.documentIam}`:void 0;case"documentMetadata":return!s&&t?.documentId&&u?.metadata?`${u?.metadata}`:void 0;case"allDocuments":return!s&&u?.docs&&t?.documentId?`${u?.docs}/${t?.documentId}/${j.FIREBASE_PARTIAL_PATH_METADATA}`:void 0;case"allAreas":return!s&&t?.documentId&&u?.area?`${u?.area}`:void 0;case"area":return!s&&t?.id&&u?.area?`${u?.area}${t?.id}`:void 0;case"documentUserAccess":return!s&&t?.id&&u?.documentIam?`${u?.documentIam}users/${t?.id}`:void 0;case"documentUser":return!s&&t?.documentId&&t?.id&&u?.documentIam?`${u?.documentIam}users/${t?.id}`:void 0;case"allDocumentUsers":return!s&&t?.documentId&&u?.documentIam?`${u?.documentIam}users/`:void 0;case"allOrganizationGroups":return!s&&u?.organizationGroups?`${u?.organizationGroups}`:void 0;case"allOrganizationUsers":return!s&&u?.organizationIam?`${u?.organizationIam}users/`:void 0;case"reaction":return!s&&t?.id&&u?.reaction?`${u?.reaction}${t?.id}`:void 0;case"allReactions":return!s&&t?.documentId&&u?.reaction?`${u?.reaction}`:void 0;case"recorder":return!s&&t?.documentId&&t?.id&&u?.recorder?`${u?.recorder}${t?.id}`:void 0;case"allRecorders":return!s&&t?.documentId&&u?.recorder?`${u?.recorder}`:void 0;case"organizationMetadata":return!s&&u?.organizationMetadata?`${u?.organizationMetadata}`:void 0;case"documentAccessType":return!s&&u?.documentIam?`${u?.documentIam}`:void 0;case"documentIam":return!s&&u?.documentIam?`${u?.documentIam}`:void 0;case"documentMetadata":return!s&&t?.documentId&&u?.metadata?`${u?.metadata}`:void 0;case"commentViews":return!s&&t?.documentId&&t?.id&&u?.views?`${u?.views}comment/${t?.id}`:void 0;case"allDocumentViews":return!s&&t?.documentId&&u?.views?`${u?.views}documentViews/`:void 0;case"documentViews":return!s&&t?.documentId&&t?.id&&u?.views?`${u?.views}documentViews/${t?.id}`:void 0;case"allCommentViews":return!s&&t?.documentId&&u?.views?`${u?.views}comment/`:void 0;case"allLocationViews":return!s&&t?.documentId&&u?.views?`${u?.views}locationViews/`:void 0;case"notificationViewsTimestamp":return!s&&t?.id&&t?.user&&u?.views?`${u?.views}notification/${t?.id}/views/${t?.user}`:void 0;case"documentUsersViews":return!s&&t?.id&&t?.user&&t?.date&&u?.views?`${u?.views}documentViews/${t?.id}/users/${t?.user}/${t?.date}`:void 0;case"documentMetadataViews":return!s&&t?.id&&u?.views?`${u?.views}documentViews/${t?.id}/metadata`:void 0;case"documentDayViews":return!s&&t?.id&&t?.date&&t?.user&&u?.views?`${u?.views}documentViews/${t?.id}/day/${t?.date}/${t?.user}`:void 0;case"locationViews":return!s&&t?.id&&u?.views?`${u?.views}locationViews/${t?.id}/location`:void 0;case"location":return!s&&t?.id&&u?.views?`${u?.views}locationViews/${t?.id}`:void 0;case"locationUsersViews":return!s&&t?.id&&t?.user&&t?.date&&u?.views?`${u?.views}locationViews/${t?.id}/users/${t?.user}/${t?.date}`:void 0;case"locationMetadataViews":return!s&&t?.id&&u?.views?`${u?.views}locationViews/${t?.id}/metadata`:void 0;case"locationDayViews":return!s&&t?.id&&t?.date&&t?.user&&u?.views?`${u?.views}locationViews/${t?.id}/day/${t?.date}/${t?.user}`:void 0;case"docNotificationViews":case"docNotification":return t?.documentId&&t?.id&&u?.organizationNotificationsWithDocumentId?`${u?.organizationNotificationsWithDocumentId}${t?.id}`:void 0;case"allDocNotifications":return t?.documentId&&u?.organizationNotificationsWithDocumentId?`${u?.organizationNotificationsWithDocumentId}`:void 0;case"allUserNotifications":return t?.userId&&u?.organizationNotificationsUsers?`${u?.organizationNotificationsUsers}${t?.userId}`:void 0;case"userNotificationViews":case"userNotification":return t?.userId&&t?.id&&u?.organizationNotificationsUsers?`${u?.organizationNotificationsUsers}${t?.userId}/${t?.id}`:void 0;case"locationMetadata":return;case"allLocations":return;case"folderMetadata":return;default:throw new Error(`Unknown feature: ${e}`)}}catch(d){this.loggingService.catch("Error in CommonDbUtilsService getDocumentPath:",d);return}}resolveAnnotations(r){return Q(this,arguments,function*({data:e,feature:t}){try{if(e&&e?.length>0)switch(t){case"allComments":{this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable()&&this.commentAnnotationsResolverService.resolveCommentAnnotations({commentAnnotationIds:e,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""});break}case"allReactions":{this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable()&&this.reactionAnnotationsResolverService.resolveReactionAnnotations({reactionAnnotationIds:e,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""});break}default:break}}catch(a){this.loggingService.catch(`Error in CommonDbUtilsService resolveAnnotations: ${t}`,a)}})}formatResponse(d){return Q(this,arguments,function*({feature:e,data:t,shouldAwait:r=!1,forceResolve:a=!1,shouldCommentAnnotationsResolverAwait:s=!1}){try{if(this.usersService.userDataProviderAvailable()){let p=[];switch(e){case"allAreas":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.areaUtilsService.getUserIdsToResolveFromAreaAnnotations(Object.values(t)));break}case"allArrows":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.arrowUtilsService.getUserIdsToResolveFromArrowAnnotations(Object.values(t)));break}case"allCursors":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.cursorUtilsService.getUserIdsToResolveFromCursorUsers(Object.values(t)));break}case"allComments":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.commentUtilsService.getUserIdsToResolveFromComments(Object.values(t)));break}case"allDocumentUsers":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.contactUtilsService.getUserIdsToResolveFromUserIamData(Object.values(t)));break}case"allFolderUsers":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.contactUtilsService.getUserIdsToResolveFromUserIamData(Object.values(t)));break}case"allOrganizationUsers":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.contactUtilsService.getUserIdsToResolveFromUserIamData(Object.values(t)));break}case"allMultiThreads":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.multiThreadUtilsService.getUserIdsToResolveFromMultiThreads(Object.values(t)));break}case"allDocNotifications":{t&&typeof t=="object"&&(p=this.notificationUtilsService.getUserIdsToResolveFromNotifications(Array.isArray(t)?t:Object.values(t)));break}case"allUserNotifications":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.notificationUtilsService.getUserIdsToResolveFromNotifications(Object.values(t)));break}case"allPresence":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.presenceUtilsService.getUserIdsToResolveFromPresenceUsers(Object.values(t)));break}case"allRecorders":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.recorderUtilsService.getUserIdsToResolveFromRecorders(Object.values(t)));break}case"allReactions":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.reactionUtilsService.getUserIdsToResolveFromReactions(Object.values(t)));break}case"allTags":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.tagUtilsService.getUserIdsToResolveFromTags(Object.values(t)));break}case"allHuddleAttendees":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.huddleUtilsService.getUserIdsToResolveFromHuddleAttendees(Object.values(t)));break}case"liveStateCustom":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.liveStateUtilsService.getUserIdsToResolveFromLiveStateCustom(t));break}case"allLiveStateCustoms":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.liveStateUtilsService.getUserIdsToResolveFromLiveStateCustoms(Object.values(t)));break}case"allLiveStates":{t&&typeof t=="object"&&(p=this.liveStateUtilsService.getUserIdsToResolveFromLiveStates(t));break}case"allSelections":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.selectionUtilsService.getUserIdsToResolveFromSelections(Object.values(t)));break}default:p=[]}p?.length&&(r?yield this.usersService.resolveUsers({userIds:p,forceResolve:a,feature:e}):this.usersService.resolveUsers({userIds:p,forceResolve:a,feature:e}))}if(this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable()){let p=[];switch(e){case"allDocNotifications":{if(t&&typeof t=="object"){let u=this.notificationUtilsService.getTargetAnnotationIdsFromNotifications(t);p=[...p,...u],p=p.filter(C=>!this.commentAnnotationsResolverService.getCommentAnnotationById(C))}break}case"allUserNotifications":{if(t&&typeof t=="object"&&!Array.isArray(t)){let u=this.notificationUtilsService.getTargetAnnotationIdsFromNotifications(t);p=[...p,...u],p=p.filter(C=>!this.commentAnnotationsResolverService.getCommentAnnotationById(C))}break}default:p=[]}p?.length&&(s?yield this.commentAnnotationsResolverService.resolveCommentAnnotations({commentAnnotationIds:p,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""}):this.commentAnnotationsResolverService.resolveCommentAnnotations({commentAnnotationIds:p,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""}))}return t}catch(p){return this.loggingService.catch("Error in CommonDbUtilsService formatResponse:",p),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((r,[a,s])=>(r[a]=this.commentUtilsService.mergeStrippedDataWithCommentAnnotations(s),r),{}):e;case"allDocNotifications":case"allUserNotifications":return e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).reduce((r,[a,s])=>(r[a]=this.notificationUtilsService.mergeStrippedDataWithNotification(s),r),{}):e;default:return e}return e}catch(r){return this.loggingService.catch("Error in CommonDbUtilsService mergeCommentAnnotationsWithData:",r),e}}mergeReactionAnnotationsWithData({data:e,feature: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((r,[a,s])=>(r[a]=this.reactionUtilsService.mergeStrippedDataWithReactionAnnotations(s),r),{}):e;default:return e}return e}catch(r){return this.loggingService.catch("Error in CommonDbUtilsService mergeReactionAnnotationsWithData:",r),e}}mergeLocationMetadataWithData({data:e,feature:t,locationMetadata:r}){try{if(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: mergeLocationMetadataWithData","color: green;"),r&&typeof r=="object"&&!Array.isArray(r))switch(t){case"allComments":return e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).reduce((a,[s,d])=>(a[s]=this.commentUtilsService.mergeLocationWithCommentAnnotations(d,r),a),{}):e;case"allDocNotifications":case"allUserNotifications":return e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).reduce((a,[s,d])=>(a[s]=this.notificationUtilsService.mergeLocationWithNotification(d,r),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((r,[a,s])=>(r[a]=this.areaUtilsService.mergeAreaWithUser(s),r),{}):t;case"allArrows":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[a,s])=>(r[a]=this.arrowUtilsService.mergeArrowWithUser(s),r),{}):t;case"allCursors":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[a,s])=>(r[a]=this.cursorUtilsService.mergeCursorUserWithUser(s),r),{}):t;case"allComments":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[a,s])=>(r[a]=this.commentUtilsService.mergeCommentWithUser(s),r),{}):t;case"allDocumentUsers":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[a,s])=>(r[a]=this.contactUtilsService.mergeUserIamWithUser(s),r),{}):t;case"allFolderUsers":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[a,s])=>(r[a]=this.contactUtilsService.mergeUserIamWithUser(s),r),{}):t;case"allOrganizationUsers":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[a,s])=>(r[a]=this.contactUtilsService.mergeUserIamWithUser(s),r),{}):t;case"allMultiThreads":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[a,s])=>(r[a]=this.multiThreadUtilsService.mergeMultiThreadWithUser(s),r),{}):t;case"allDocNotifications":return t&&typeof t=="object"?t?.map(r=>this.notificationUtilsService.mergeNotificationWithUser(r)):t;case"allUserNotifications":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[a,s])=>(r[a]=this.notificationUtilsService.mergeNotificationWithUser(s),r),{}):t;case"allPresence":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[a,s])=>(r[a]=this.presenceUtilsService.mergePresenceUserWithUser(s),r),{}):t;case"allRecorders":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[a,s])=>(r[a]=this.recorderUtilsService.mergeRecorderWithUser(s),r),{}):t;case"allReactions":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[a,s])=>(r[a]=this.reactionUtilsService.mergeReactionWithUser(s),r),{}):t;case"allTags":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[a,s])=>(r[a]=this.tagUtilsService.mergeTagWithUser(s),r),{}):t;case"allHuddleAttendees":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[a,s])=>(r[a]=this.huddleUtilsService.mergeHuddleAttendeeWithUser(s),r),{}):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((r,[a,s])=>(r[a]=this.liveStateUtilsService.mergeLiveStateCustomWithUser(s),r),{}):t;case"allLiveStates":return t&&typeof t=="object"?this.liveStateUtilsService.mergeLiveStateWithUser(t):t;case"allSelections":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((r,[a,s])=>(r[a]=this.selectionUtilsService.mergeSelectionWithUser(s),r),{}):t;default:return t}return t}catch(r){return this.loggingService.catch("Error in CommonDbUtilsService mergeUsersWithData:",r),t}}mergeCommentAnnotationsWithData$({data:e,feature:t}){try{return this.commentAnnotationsResolverService.getCommentAnnotationsById$().pipe(de(()=>{let r=this.mergeCommentAnnotationsWithData({data:e?.data??{},feature:t}),a=this.mergeUsersWithData({feature:t,data:r??{}});return typeof a=="object"?{data:JSON.parse(JSON.stringify(a)),operation:e?.operation??null}:{data:a,operation:e?.operation??null}}),kt(si))}catch(r){return this.loggingService.catch("Error in mergeCommentAnnotationsWithData:",r),se(e)}}mergeReactionAnnotationsWithData$({data:e,feature:t}){try{return this.reactionAnnotationsResolverService.getReactionAnnotationsById$().pipe(de(()=>{let r=this.mergeReactionAnnotationsWithData({data:e?.data??{},feature:t}),a=this.mergeUsersWithData({feature:t,data:r??{}});return typeof a=="object"?{data:JSON.parse(JSON.stringify(a)),operation:e?.operation??null}:{data:a,operation:e?.operation??null}}),kt(si))}catch(r){return this.loggingService.catch("Error in mergeReactionAnnotationsWithData:",r),se(e)}}mergeUsersWithData$({feature:e,data:t}){try{return this.usersService.getUserById$().pipe(de(()=>{let r=this.mergeUsersWithData({feature:e,data:t?.data??{}});return typeof r=="object"?{data:JSON.parse(JSON.stringify(r)),operation:t?.operation??null}:{data:r,operation:t?.operation??null}}),kt(si))}catch(r){return this.loggingService.catch(`Error in mergeUsersWithData for ${e}:`,r),se(t)}}mergeLocationMetadataWithData$({data:e,feature:t}){try{return this.docService.getLocationMetadata$().pipe(de(r=>{let a=this.mergeLocationMetadataWithData({data:e?.data??{},feature:t,locationMetadata:r});return typeof a=="object"?{data:JSON.parse(JSON.stringify(a)),operation:e?.operation??null}:{data:a,operation:e?.operation??null}}),kt(si))}catch(r){return this.loggingService.catch(`Error in mergeLocationMetadataWithData for ${t}:`,r),se(e)}}handleDataStripping({feature:e,data:t,actionType:r}){try{switch(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: handleDataStripping","color: green;"),e){case"comment":return this.commentUtilsService.stripCommentAnnotationData({data:t,actionType:r});case"reaction":return this.reactionUtilsService.stripReactionAnnotationData(t);default:return{originalData:t,strippedData:null}}}catch(a){return this.loggingService.catch("Error in CommonDbUtilsService handleDataStripping:",a),{originalData:t,strippedData:null}}}formatData({feature:e,data:t,properties:r,offset:a,isRealtimeDb:s}){try{this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: formatData","color: green;"),typeof t=="object"&&(t=JSON.parse(JSON.stringify(t)));let d=new Date().getTime()+a;switch(e){case"documentAccessType":return delete t?.users,{docIamConfig:t};case"organizationMetadata":case"documentMetadata":return s?t:{metadata: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,d);case"notificationViewsTimestamp":return{views:{[r.user??""]:t}};case"documentUsersViews":return s?t:{users:{[r.user??""]:{[r.date??""]:t}}};case"documentDayViews":return s?t:{day:{[r.date??""]:{[r.user??""]:t}}};case"documentMetadataViews":return s?t:{metadata:t};case"huddleMessage":return this.huddleUtilsService.formatHuddleMessageData(t);case"locationMetadataViews":return s?t:{metadata:t};case"locationUsersViews":return s?t:{users:{[r.user??""]:{[r.date??""]:t}}};case"locationDayViews":return s?t:{day:{[r.date??""]:{[r.user??""]:t}}};case"locationViews":return s?t:{location:t};case"docNotificationViews":return s?t:{views:t.views};case"userNotificationViews":return s?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(d){return this.loggingService.catch("Error in CommonDbUtilsService formatData:",d),t}}modifyAndSetData(s){return Q(this,arguments,function*({feature:e,data:t,subscriber:r,operation:a=null}){try{let d=yield this.modifyData({feature:e,data:t});r.next({data:d,operation:a})}catch(d){this.loggingService.catch("Error in CommonDbUtilsService modifyAndSetData:",d)}})}isDataAlreadyProcessedInLocalCache({feature:e,change:t,cache:r}){try{if(e==="allReactions"||e==="allComments"){if(t.type==="removed")return!Object.keys(r??{}).includes(t.doc.id);if(r?.[t.doc.id]){let a=t.doc.data(),s=r?.[t.doc.id];return a?.lastUpdated===s?.lastUpdated}}return!1}catch(a){return this.loggingService.catch("Error in CommonDbUtilsService isDataAlreadyProcessedInLocalCache:",a),!1}}modifyData(r){return Q(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)?T(I({},e),{metadata:e?.metadata??{documentId:t?.documentId,organizationId:t?.organizationId,apiKey:t?.apiKey}}):e}catch(r){return this.loggingService.catch("Error in CommonDbUtilsService addMetadata:",r),e}}setDataInLocal(p){return Q(this,arguments,function*({feature:e,data:t,observablesCache:r,eventType:a,id:s,operation:d=null}){try{let C={comment:"allComments",reaction:"allReactions"}[e];if(!C)return null;let E=t?.metadata?.documentId,D=t?.metadata?.veltFolderId;return Object.keys(r).filter(L=>L.includes(C)&&(!E||L.includes(E)||D&&L.includes(D))).forEach(L=>{let G=r[L]?.subject?.getValue()??{};a==="DELETE"?s&&G?.data?.[s]&&(delete G?.data?.[s],r[L]?.subject&&r[L].subject.next({data:G?.data,operation:d})):r[L]?.subject?.next({data:T(I({},G?.data),{[t?.annotationId]:t}),operation:d})}),null}catch(u){return this.loggingService.catch("Error in CommonDbUtilsService setDataInLocal:",u),null}})}handleCommentEncryption(s){return Q(this,arguments,function*({data:e,firestorePath:t,extraData:r,eventType:a}){try{return yield this.commentUtilsService.handleCommentEncryption({data:e,firestorePath:t,extraData:r,eventType:a})}catch(d){return this.loggingService.catch("Error in CommonDbUtilsService handleCommentEncryption:",d),e}})}handleReactionEncryption(a){return Q(this,arguments,function*({data:e,firestorePath:t,eventType:r}){try{return yield this.reactionUtilsService.handleReactionEncryption({data:e,firestorePath:t,eventType:r})}catch(s){return this.loggingService.catch("Error in CommonDbUtilsService handleReactionEncryption:",s),e}})}};o.\u0275fac=function(t){return new(t||o)(J(Sce),J(bce),J(c0),J(Ice),J(Ece),J(yk),J(Tce),J(y),J(Dce),J(Sk),J(Oce),J(Ace),J(d0),J(Pce),J(Mce),J(Yn),J(at),J(ws),J(Ld))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var kce=(()=>{let o=class o{constructor(e,t,r){this.configService=e,this.authService=t,this.loggingService=r,this.firestore$=new ve(null);try{En([this.authService.getFirebaseConfig$(),this.configService.getApiKey$()]).pipe(Le(([a,s])=>!!a&&!!s),rt(1)).subscribe(([a,s])=>{a&&s&&a?.firebaseOptions?.storeDbId&&this.firestore$.next(WM(Jp.getFirestoreProdDbName(s,a.firebaseOptions)))},a=>{})}catch{}}getFirestore(){return this.firestore$.asObservable()}getFirestoreValue(){return this.firestore$.value}generateFirestoreDocumentId(){try{let e=this.getFirestoreValue()||WM("DocumentIdDb");if(e){let t=mb(e,"generateDocumentId");return t0(t).id}return}catch(e){this.loggingService.catch("Error in FirestoreService generateFirestoreDocumentId: ",e);return}}};o.\u0275fac=function(t){return new(t||o)(J(Vt),J(je),J(y))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var yn=(()=>{let o=class o{constructor(e,t,r,a,s,d,p,u,C,E){this.authService=e,this.commonDbUtilsService=t,this.loggingService=r,this.firestoreService=a,this.databaseService=s,this.configService=d,this.docService=p,this.usersService=u,this.commentAnnotationsResolverService=C,this.reactionAnnotationsResolverService=E,this.offset=0,this.db=null,this.firestore=null,this.subscriptions=[],this.offsetListener=null,this.observablesCache={},this.firestoreSubscriptions={},this.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(D=>{if(D){this.db=D;let L=$i(D,".info/serverTimeOffset");this.offsetListener=Ap(L,G=>{let Y=G.val();this.offset=Y})}})),this.subscriptions.push(this.firestoreService.getFirestore().subscribe(D=>{D&&(this.firestore=D)}))}unsubscribeFromObservables(){try{Object.values(this.firestoreSubscriptions??{}).forEach(e=>{e?.unsubscribe()}),Object.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 Q(this,null,function*(){try{if(this.db){let r=$i(this.db,e);return Cd(r).update(t)}return Promise.resolve()}catch(r){return this.loggingService.catch("Error in setupOnDisconnect:",r),Promise.resolve()}})}getOffset(){return this.offset}getServerTimestamp(){return new Date().getTime()+this.getOffset()}subscribeToServices(e){En([this.databaseService.getDb(),this.firestoreService.getFirestore()]).pipe(Le(([t,r])=>!!t),rt(1),gn(([t,r])=>{e({db:t,firestore:r})})).subscribe({error:t=>{this.loggingService.catch("Error in CommonDbService subscription: ",t)}})}performDatabaseOperation(e,t,r,a,s,d){return Q(this,null,function*(){try{if(!t){this.loggingService.warn(`%c[WB] No properties found for ${e}`,"color: red;");return}return this.subscribeToServices(C=>Q(this,[C],function*({db:p,firestore:u}){let E;t?.skipFirestore||(E=this.commonDbUtilsService.getFirestorePath({feature:e,properties:t,documentPaths:this.docService.getDocumentPaths(),apiKey:t.apiKey??this.configService.getApiKey()}));let D=this.commonDbUtilsService.getDocumentPath({feature:e,properties:t,defaultDocumentPaths:this.docService.getDocumentPaths(),apiKey:t.apiKey??this.configService.getApiKey(),useFirestore:this.shouldUseFirestore()});if(!p){this.loggingService.warn(`%c[WB] No database or firestore found for ${e}`,"color: red;");return}try{let L,G;try{D&&(L=$i(p,`${D}`))}catch{this.loggingService.catch("Error in dbRef")}try{E?.includes("/organizations")&&u&&E&&(G=t0(u,`${E}`))}catch{this.loggingService.catch("Error in docRef")}if(!this.authService.getUser())return;yield r({dbRef:L,firestoreRef:G,data:a,firestorePath:E}),d&&d({firestoreAvailable:!!u})}catch(L){this.loggingService.catch(`Error in ${e} operation: `,L),s&&s(L)}}))}catch(p){this.loggingService.catch("Error in performDatabaseOperation:",p)}})}setData(p){return Q(this,arguments,function*({feature:e,data:t,properties:r,callback:a,errorCallback:s,extraData:d}){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,r,u=>Q(this,null,function*(){if(u.dbRef){let C=this.commonDbUtilsService.formatData({feature:e,data:u.data,properties:r,offset:this.getOffset(),isRealtimeDb:!0});yield Zf(u.dbRef,JSON.parse(JSON.stringify(C)))}try{if(u.firestoreRef&&u.data&&!r?.skipFirestore){let C=this.commonDbUtilsService.formatData({feature:e,data:u.data,properties:r,offset:this.getOffset()});typeof C=="object"&&(C=JSON.parse(JSON.stringify(C)));let{strippedData:E,originalData:D,eventType:L}=this.commonDbUtilsService.handleDataStripping({feature:e,data:C,actionType:d?.actionType});if(e==="comment"){let G=null;E&&(G=yield this.commentAnnotationsResolverService.saveCommentAnnotation({commentAnnotation:E,eventType:L,commentId:d?.targetAnnotationData?.commentId})),D&&(G?.isSuccess||G===null)&&(yield this.commonDbUtilsService.handleCommentEncryption({data:D,firestorePath:u.firestorePath??"",extraData:d}))}else if(e==="reaction"){let G=null;E&&(G=yield this.reactionAnnotationsResolverService.saveReactionAnnotation(E)),D&&(G?.isSuccess||G===null)&&(yield this.commonDbUtilsService.handleReactionEncryption({data:D,firestorePath:u.firestorePath??""}))}else e==="recorder"?this.firestore&&(yield nce(this.firestore,G=>Q(this,null,function*(){G.set(u.firestoreRef,C)}))):yield oz(u.firestoreRef,C)}}catch(C){this.authService.getUser()&&this.loggingService.catch(`Error in setData for ${e}`,C)}}),t,s,a))}catch(u){this.loggingService.catch(`Error in setData for ${e}`,u)}})}updateData(p){return Q(this,arguments,function*({feature:e,data:t,properties:r,callback:a,errorCallback:s,extraData:d}){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,r,u=>Q(this,null,function*(){if(u.dbRef&&!r?.skipRtdb){let C=this.commonDbUtilsService.formatData({feature:e,data:u.data,properties:r,offset:this.getOffset(),isRealtimeDb:!0});yield M6(u.dbRef,JSON.parse(JSON.stringify(C)))}try{if(u.firestoreRef&&u.data&&!r?.skipFirestore){let C=this.commonDbUtilsService.formatData({feature:e,data:u.data,properties:r,offset:this.getOffset()});typeof C=="object"&&(C=JSON.parse(JSON.stringify(C)));let{strippedData:E,originalData:D,eventType:L}=this.commonDbUtilsService.handleDataStripping({feature:e,data:C,actionType:d?.actionType});if(e==="comment"){let G=null;E&&(G=yield this.commentAnnotationsResolverService.saveCommentAnnotation({commentAnnotation:E,eventType:L,commentId:d?.targetAnnotationData?.commentId})),D&&(G?.isSuccess||G===null)&&(yield this.commonDbUtilsService.handleCommentEncryption({data:D,firestorePath:u.firestorePath??"",extraData:d}))}else if(e==="reaction"){let G=null;E&&(G=yield this.reactionAnnotationsResolverService.saveReactionAnnotation(E)),D&&(G?.isSuccess||G===null)&&(yield this.commonDbUtilsService.handleReactionEncryption({data:D,firestorePath:u.firestorePath??""}))}else yield oz(u.firestoreRef,C,{merge:!0})}}catch(C){this.authService.getUser()&&this.loggingService.catch(`Error in updateDoc for ${e}`,C)}}),t,s,a))}catch(u){this.loggingService.catch(`Error in updateData for ${e}`,u)}})}deleteData(s){return Q(this,arguments,function*({feature:e,properties:t,callback:r,errorCallback:a}){try{return this.loggingService.log(`%c[WB] Calling FUNCTION: deleteData for ${e}`,"color: green;"),this.commonDbUtilsService.setDataInLocal({feature:e,observablesCache:this.observablesCache,eventType:"DELETE",id:t?.id,operation:{type:"removed",ids:[t?.id]}}),this.performDatabaseOperation(e,t,d=>Q(this,null,function*(){d.dbRef&&(yield A6(d.dbRef));try{if(d.firestoreRef&&!t?.skipFirestore)if(e==="comment"){let p=null;p=yield this.commentAnnotationsResolverService.deleteCommentAnnotation(t?.id??""),(p?.isSuccess||p===null)&&(yield this.commonDbUtilsService.handleCommentEncryption({firestorePath:d.firestorePath??"",eventType:"DELETE"}))}else if(e==="reaction"){let p=null;p=yield this.reactionAnnotationsResolverService.deleteReactionAnnotation(t?.id??""),(p?.isSuccess||p===null)&&(yield this.commonDbUtilsService.handleReactionEncryption({firestorePath:d.firestorePath??"",eventType:"DELETE"}))}else yield Xle(d.firestoreRef)}catch(p){this.authService.getUser()&&this.loggingService.catch(`Error in deleteData for ${e}`,p)}}),void 0,a,r)}catch(d){this.loggingService.catch(`Error in deleteData for ${e}`,d)}})}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=vn()),e||"noDocumentId"}catch(e){return this.loggingService.catch("Error in generateFirestoreDocumentId:",e),vn()||"noDocumentId"}}queryData(r){return Q(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 Q(this,null,function*(){try{if(!this.firestore)return this.loggingService.warn("[WB] Firestore not initialized"),[];let r=t?.useCollectionGroup?this.commonDbUtilsService.getFirestoreCollectionGroupPath(e):this.commonDbUtilsService.getFirestorePath({feature:e,properties:t,documentPaths:this.docService.getDocumentPaths(),apiKey:t.apiKey??this.configService.getApiKey()});if(!r)return this.loggingService.warn(`[WB] No firestore path found for ${e}`),[];try{let a=mb(this.firestore,r);t?.useCollectionGroup&&(a=tz(this.firestore,r));let s=t?.firestoreQuery??[],d=iz(a,...s);if(!this.authService.getUser()&&!t?.skipUserCheck)return[];if(t?.getCount){let p=yield Jle(d).catch(u=>(this.authService.getUser()&&this.loggingService.catch(`Error in getCountFromServer for ${e}`,u),null));return p?p.data().count:0}else{let p=yield tce(d).catch(E=>(this.authService.getUser()&&this.loggingService.catch(`Error in getDocs for ${e}`,E),null));if(!p)return[];let u=p.docs.map(E=>E.data());return yield this.commonDbUtilsService.modifyData({feature:e,data:u})}}catch(a){return this.loggingService.catch(`Error in Firestore query for ${e}:`,a),[]}}catch(r){return this.loggingService.catch(`Error in Firestore query for ${e}:`,r),[]}})}handleRtdbQuery(e,t){return Q(this,null,function*(){if(!this.db)return this.loggingService.warn("[WB] Realtime Database not initialized"),[];let r=this.commonDbUtilsService.getDocumentPath({feature:e,properties:t,defaultDocumentPaths:this.docService.getDocumentPaths(),apiKey:t.apiKey??this.configService.getApiKey()});if(!r)return this.loggingService.warn(`[WB] No database path found for ${e}`),[];try{let a=$i(this.db,r),s=t?.rtdbQuery??[],d=DV(a,...s);if(!this.authService.getUser()&&!t?.skipUserCheck)return[];let p=yield xV(d).catch(C=>(this.authService.getUser()&&this.loggingService.catch(`Error in get for ${e}`,C),null));if(!p)return[];let u=p.val();return u?t?.skipObjectValues?u:Object.values(u??{}):[]}catch(a){return this.loggingService.catch(`Error in RTDB query for ${e}:`,a),[]}})}getData(r){return Q(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 s=this.commonDbUtilsService.getFirestorePath({feature:e,properties:t,documentPaths:this.docService.getDocumentPaths(),apiKey:t.apiKey??this.configService.getApiKey()});if(!s)return this.loggingService.warn(`[WB] No firestore path found for ${e}`),{};try{if(!this.authService.getUser())return{};let d=yield ece(t0(this.firestore,s)).catch(u=>(this.authService.getUser()&&this.loggingService.catch(`Error in getDoc for ${e}`,u),null));if(!d)return this.loggingService.warn(`[WB] No document found at ${s}`),{};let p=d.data();return t?.field?p?.[t.field]??{}:p??{}}catch(d){return this.loggingService.catch(`Error fetching Firestore data for ${e}:`,d),{}}}if(this.db){let s=this.commonDbUtilsService.getDocumentPath({feature:e,properties:t,defaultDocumentPaths:this.docService.getDocumentPaths(),apiKey:t.apiKey??this.configService.getApiKey()});if(!s)return this.loggingService.warn(`[WB] No database path found for ${e}`),{};try{if(!this.authService.getUser())return{};let d=yield xV($i(this.db,s)).catch(u=>(this.authService.getUser()&&this.loggingService.catch(`Error in get for ${e}`,u),null));if(!d)return this.loggingService.warn(`[WB] No data found at ${s}`),{};let p=d.val();return t?.field?p?.[t.field]??{}:p??{}}catch(d){return this.loggingService.catch(`Error fetching RTDB data for ${e}:`,d),{}}}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 r=this.shouldUseFirestore();t?.skipFirestore&&(r=!1);let a=`${e}-${JSON.stringify(t)}`;return En([this.databaseService.getDb(),this.firestoreService.getFirestore(),this.authService.getUser$().pipe(Le(s=>!!s))]).pipe(Le(([s,d])=>s?r&&!d?(this.loggingService.warn(`[WB] Firestore requested but not available for ${e}`),!1):!0:(this.loggingService.warn(`[WB] No database found for ${e}`),!1)),he(([s,d])=>{try{if(r&&d){if(!!!this.observablesCache[a]){this.observablesCache[a]={subject:new ve({}),count:0};let C=this.handleFirestoreListener(e,t,d).subscribe(E=>{this.observablesCache[a]?.subject?.next(E)},E=>this.observablesCache[a]?.subject?.error(E));this.firestoreSubscriptions[a]=C}return new Lt(u=>{let C=this.observablesCache[a]?.subject?.subscribe(E=>u.next(E),E=>u.error(E),()=>u.complete());return this.observablesCache[a].count+=1,()=>{C?.unsubscribe(),this.observablesCache[a]&&(this.observablesCache[a].count-=1,this.observablesCache[a].count<=0&&(this.firestoreSubscriptions[a]?.unsubscribe(),delete this.firestoreSubscriptions[a],this.observablesCache[a]?.subject?.complete(),delete this.observablesCache[a]))}})}else if(s){if(!!!this.observablesCache[a]){this.observablesCache[a]={subject:new ve({}),count:0};let C=this.handleRealtimeDbListener(e,t,s).subscribe(E=>{this.observablesCache[a]?.subject?.next(E)},E=>this.observablesCache[a]?.subject?.error(E));this.rtdbSubscriptions[a]=C}return new Lt(u=>{let C=this.observablesCache[a]?.subject?.subscribe(E=>u.next(E),E=>u.error(E),()=>u.complete());return this.observablesCache[a].count+=1,()=>{C?.unsubscribe(),this.observablesCache[a]&&(this.observablesCache[a].count-=1,this.observablesCache[a].count<=0&&(this.rtdbSubscriptions[a]?.unsubscribe(),delete this.rtdbSubscriptions?.[a],this.observablesCache[a]?.subject?.complete(),delete this.observablesCache?.[a]))}})}return se({})}catch(p){return this.loggingService.catch(`Error setting up listener for ${e}:`,p),se({})}}),Hg(()=>{this.loggingService.log(`[WB] Cleaning up listener for ${e} and key ${a}`)}))}handleFirestoreListener(e,t,r){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()}),s=`${e}-${JSON.stringify(t)}`;return a?new Lt(d=>{let p=t.isCollection?this.setupCollectionListener(r,a,e,d,t):this.setupDocumentListener(r,a,e,d,t);return()=>{d.complete(),d.unsubscribe(),p(),this.observablesCache[s]?.subject?.complete(),this.observablesCache[s]?.subject?.unsubscribe(),delete this.observablesCache[s]}}).pipe(he(d=>this.commonDbUtilsService.mergeUsersWithData$({feature:e,data:d})),he(d=>["allComments","allUserNotifications"].includes(e)?this.commonDbUtilsService.mergeCommentAnnotationsWithData$({data:d,feature:e}):se(d)),he(d=>["allReactions"].includes(e)?this.commonDbUtilsService.mergeReactionAnnotationsWithData$({data:d,feature:e}):se(d)),kt(si)):(this.loggingService.warn(`[WB] No firestore path found for ${e} and key ${s}`),se({}))}setupCollectionListener(e,t,r,a,s){let d=`${r}-${JSON.stringify(s)}`,p=mb(e,t);if(s?.useCollectionGroup&&(p=tz(e,t)),s?.useQuery&&s?.firestoreQuery){let E=s?.firestoreQuery??[];p=iz(p,...E)}let u=!0,C=[];return nz(p,E=>{try{let D=JSON.parse(JSON.stringify(this.observablesCache[d]?.subject?.getValue()?.data??{})),L=null,G=!1;E?.docChanges()?.length?E.docChanges().forEach(Y=>{["allComments","allReactions"].includes(r)&&!u&&Y.type!=="removed"&&C.push(Y.doc.id),this.commonDbUtilsService.isDataAlreadyProcessedInLocalCache({feature:r,change:Y,cache:this.observablesCache[d]?.subject?.getValue()?.data??{}})||(G=!0,Object.assign(D,this.handleCollectionChange(Y,D)),Y.type==="removed"&&(L||(L={type:Y.type,ids:[]}),L.ids.push(Y.doc.id)))}):G=!0,G&&(["allComments","allReactions"].includes(r)&&C?.length&&(this.commonDbUtilsService.resolveAnnotations({data:C,feature:r}),C=[]),this.commonDbUtilsService.modifyAndSetData({feature:r,data:D,subscriber:a,operation:L})),u=!1}catch(D){this.handleListenerError(D,r,a)}},E=>this.handleListenerError(E,r,a))}handleCollectionChange(e,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,r,a,s){let d=t0(e,t);return nz(d,p=>{try{let u=p.data()||{};s?.field&&(u=u?.[s?.field]??{}),this.commonDbUtilsService.modifyAndSetData({feature:r,data:u,subscriber:a,operation:null})}catch(u){this.handleListenerError(u,r,a)}},p=>this.handleListenerError(p,r,a))}handleListenerError(e,t,r){this.loggingService.catch(`Firestore listener error for ${t}:`,e),r.error(e)}handleRealtimeDbListener(e,t,r){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}`),se({});let s=$i(r,a);if(t?.useQuery&&t?.rtdbQuery){let d=t?.rtdbQuery??[];s=DV(s,...d)}return this.objectValFromChildEvents(s,e).pipe(Hn(d=>(this.loggingService.catch(`RTDB listener error for ${e}:`,d),se({}))),de(d=>(d===null&&(d={}),d&&typeof d=="object"?Object.entries(d??{}).reduce((u,[C,E])=>(u[C]=this.commonDbUtilsService.addMetadata(E,t),u),{}):this.commonDbUtilsService.addMetadata(d,t))),he(d=>this.commonDbUtilsService.modifyData({feature:e,data:d})),he(d=>this.usersService.getUserById$().pipe(de(()=>({data:this.commonDbUtilsService.mergeUsersWithData({feature:e,data:d}),operation:null})))))}objectValFromChildEvents(e,t){return new Lt(r=>{let a={},s=!1,d=null,p=Y=>{try{this.loggingService.catch(`Realtime DB listener error for ${t}:`,Y),r.error(Y)}catch{}},u=Y=>{try{if(!zi(Y,d)){let ne=JSON.parse(JSON.stringify(Y));d=ne,r.next(ne)}}catch{}},C=Y=>{try{Y.key&&(a[Y.key]=Y.val(),s&&u(I({},a)))}catch{}},E=Y=>{try{Y.key&&(a[Y.key]=Y.val(),s&&u(I({},a)))}catch{}},D=Y=>{try{Y.key&&(delete a[Y.key],s&&u(I({},a)))}catch{}},L=Y=>{try{if(!s){let ne=a&&typeof a=="object"?JSON.parse(JSON.stringify(a)):{};d=ne,r.next(ne),s=!0}}catch{}};Sne(e,C,p),bne(e,E,p),Ine(e,D,p);let G=Ap(e,L,p,{onlyOnce:!0});return()=>{try{G&&typeof G=="function"&&G(),O6(e,"child_added",C),O6(e,"child_changed",E),O6(e,"child_removed",D)}catch{}}})}};o.\u0275fac=function(t){return new(t||o)(J(je),J(tg),J(y),J(kce),J(_n),J(Vt),J(at),J(Yn),J(ws),J(Ld))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var bi=(()=>{let o=class o{constructor(e,t,r,a,s,d,p,u){this.analyticsService=e,this.authService=t,this.configService=r,this.databaseService=a,this.docService=s,this.loggingService=d,this.commonDbService=p,this.usersService=u,this.db=Za(),this.internalUserContacts$=new ve([]),this.userGlobalContact$=new ve(!1),this.userGroupContact$=new ve(null),this.users$=new ve([]),this.userPersonalContacts=[],this.userGroupContacts=[],this.userGlobalContacts=[],this.users=[],this.documentPaths=null,this.userOrganizationContacts$=new ve([]),this.userFolderContacts$=new ve([]),this.userDocumentContacts$=new ve([]),this.userOrganizationGroups$=new ve([]),this.onContactSelectedSubject$=new et,this.documentAccessType=null,this.atHereEnabled$=new ve(!1),this.atHereLabel$=new ve("here"),this.atHereDescription$=new ve(null),this.contactListScopeForOrganizationUsers$=new ve([Li.ALL]),this.customUserContacts$=new ve(null),this.customUserContactsConfig$=new ve({merge:!1}),this.currentOrganizationUserIAM$=new ve(null),this.userContacts$=new ve([]),this.userSnippylyIdContacts$=new ve(null),this.usersByOrganizationId$=new ve({}),this.temporaryUserIds$=new ve([]),this.usersByOrganizationIdAndDocumentId$=new ve({}),this.usersByOrganizationIdAndFolderId$=new ve({}),this.userById$=new ve({}),this.authService.setContactService(this),this.authService.getUser$().pipe(he(C=>this.docService.getDocumentPaths$().pipe(gn(E=>{this.documentPaths=E}),de(()=>C)))).subscribe(C=>Q(this,null,function*(){this.user=C,C&&this.documentPaths?C?.organizationId?(this.getOrganizationContactsFromDb$(),this.getFolderContactsFromDb$(),this.getDocumentContactsFromDb$(),this.getOrganizationGroupsFromDb$(),this.getTemporaryUsers()):(this.getLoggedInUsers$().subscribe(),this.getUserContactsFromDb$(),yield this.migrateLoggedInUserFromEmailToUserIdPath(C),this.setLoggedInUser(C),yield this.moveGlobalContactUserFromEmailToUserIdPath(C),this.updateUserInGlobalContactsIfAvailable(C),C?.groupId&&(yield this.migrateGroupContactsFromEmailToUserIdPath(C?.groupId)),this.checkToSetLoggedInUserInGroupContacts()):(this.getUserContactSubscription?.unsubscribe(),this.getUserContactSubscription=void 0,this.getLoggedInUsersSubscription?.unsubscribe(),this.getLoggedInUsersSubscription=void 0,this.getOrganizationContactsSubscription?.unsubscribe(),this.getOrganizationContactsSubscription=void 0,this.getFolderContactsSubscription?.unsubscribe(),this.getFolderContactsSubscription=void 0,this.getDocumentContactsSubscription?.unsubscribe(),this.getDocumentContactsSubscription=void 0,this.getOrganizationGroupsSubscription?.unsubscribe(),this.getOrganizationGroupsSubscription=void 0)}),C=>{this.loggingService.catch("Error in ContactService constructor getUser$: ",C)}),this.databaseService.getDb().pipe(Le(C=>!!C),rt(1)).subscribe(C=>{C&&(this.db=C)},C=>{this.loggingService.catch("Error in ContactService constructor getDb: ",C)}),this.getOrganizationGroups$().subscribe(C=>{this.authService.setOrganizationUserGroups(C)}),En([this.getInternalUserContacts$(),this.getCustomUserContacts$(),this.getCustomUserContactsConfig$()]).subscribe(([C,E,D])=>{E?D?.merge?this.userContacts$.next([...C||[],...E||[]]):this.userContacts$.next(E||[]):this.userContacts$.next(C||[])}),this.getUserContacts$().subscribe(C=>{try{C?.forEach(E=>{let D=E?.userSnippylyId||Ev(this.configService.getApiKey(),E.userId);D&&this.userSnippylyIdContacts$.next(T(I({},this.userSnippylyIdContacts$.value),{[D]:E}))})}catch{}})}clearCache(){this.loggingService.log("%c[WB] Calling FUNCTION: clearCache in ContactService","color: green;");try{this.documentPaths=null,this.usersByOrganizationId$.next({}),this.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=[]}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 Q(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:_t(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:_t(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:_t(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(T(I({},e),{contacts:void 0})))}),this.setLoggedInUserPrivateContacts(e,e?.contacts))}catch(t){this.loggingService.catch("Error in ContactService setLoggedInUser: ",t)}}migrateLoggedInUserFromEmailToUserIdPath(e){return Q(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:_t(e?.email),skipFirestore:!0}});if(Object.keys(t??{}).length>0){let r=t;if(r){if(r?.contacts){let a={};Object.keys(r?.contacts??{})?.forEach(s=>{let d=r.contacts[s];if(d?.userId){let p=_t(d?.userId);a[p]=d}}),r.contacts=a}yield this.commonDbService.updateData({feature:"logins",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:_t(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(r))}),yield this.commonDbService.deleteData({feature:"logins",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:_t(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:_t(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(e))})}catch(t){this.loggingService.catch("Error in ContactService addGlobalContact: ",t)}}updateUserInGlobalContactsIfAvailable(e){return Q(this,null,function*(){try{if(e?.userId&&this.documentPaths?.globalContacts&&(yield this.checkIfUserGlobalContact(e))){let r=new Do;r.userId=e?.userId,r.userSnippylyId=e?.userSnippylyId,r.email=e?.email,r.name=e?.name,r.photoUrl=e?.photoUrl,this.commonDbService.updateData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:_t(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(r))})}}catch(t){this.loggingService.catch("Error in ContactService updateUserInGlobalContactsIfAvailable: ",t)}})}moveGlobalContactUserFromEmailToUserIdPath(e){return Q(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:_t(e?.email),skipFirestore:!0}});if(Object.keys(t??{}).length>0){let r=t;r&&(yield this.commonDbService.updateData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:_t(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(r))}),yield this.commonDbService.deleteData({feature:"globalContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:_t(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 r,a=t?.filter(d=>d?.visibility!=="group"),s=!1;this.authService.getUserOptions()&&(s=!!this.authService.getUserOptions()?.replaceContacts||!!this.authService.getUserOptions()?.replacePrivateContacts),a?.length?(r={},a?.forEach(d=>{if(d?.userId){let p=_t(d?.userId);r[p]=d}}),s?this.commonDbService.setData({feature:"allLoginContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:_t(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(r))}):this.commonDbService.updateData({feature:"allLoginContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:_t(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(r))})):s&&this.commonDbService.deleteData({feature:"allLoginContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:_t(e?.userId),skipFirestore:!0}})}}catch(r){this.loggingService.catch("Error in ContactService setLoggedInUserPrivateContacts: ",r)}}migrateGroupContactsFromEmailToUserIdPath(e){return Q(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(r=>Q(this,null,function*(){let a=t[r];a?.email&&a?.userId&&_t(a?.email)===r&&(yield this.commonDbService.deleteData({feature:"groupContactsUser",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",groupId:e,userId:r,skipFirestore:!0}}),yield this.commonDbService.updateData({feature:"groupContactsUser",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",groupId:e,userId:_t(a?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(a))}))}))}}catch(t){this.loggingService.catch("Error in ContactService migrateGroupContacts: ",t)}})}checkToSetLoggedInUserInGroupContacts(){return Q(this,null,function*(){try{this.user?.groupId&&this.user?.userId&&((yield this.checkIfUserGlobalContact(this.user))||this.docService.getDocumentIam$().pipe(rt(1)).subscribe(t=>Q(this,null,function*(){if(this.user?.groupId&&this.user?.userId){let r=!1,a=this.docService.getDocumentAccessType(t);if(!a||a===Ci.PUBLIC)r=!0;else if(a===Ci.RESTRICTED){let s=_t(this.user?.userId);if(t?.users?.[s]&&(r=!0),this.user?.email){let d=_t(this.user?.email);t?.users?.[d]&&(r=!0)}}if(r){let s=new Qp;s.email=this.user.email,s.visibility="group",s.name=this.user.name,s.photoUrl=this.user.photoUrl,s.userId=this.user.userId,(this.authService.getUserOptions()?.replaceContacts||this.authService.getUserOptions()?.replaceGroupContacts)&&(yield this.removeGroupContacts(this.user?.groupId)),this.setLoggedInUserGroupContacts(this.user?.groupId,[s]),this.user?.contacts&&this.user?.groupId&&this.setLoggedInUserGroupContacts(this.user?.groupId,this.user?.contacts)}}})))}catch(e){this.loggingService.catch("Error in ContactService checkToSetLoggedInUserInGroupContacts: ",e)}})}setLoggedInUserGroupContacts(e,t){try{let r=t?.filter(a=>a?.visibility==="group");r?.length&&r.forEach(a=>Q(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:_t(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:_t(a?.email),skipFirestore:!0}}))}}))}catch(r){this.loggingService.catch("Error in ContactService setLoggedInUserGroupContacts: ",r)}}removeGroupContacts(e){return Q(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(r=>{r?.userId?(!r?.email||!t[r.email])&&(t[r.userId]=r):r?.email&&(!r?.userId||!t[r.userId])&&(t[r.email]=r)}),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:r,veltFolderId:a}=e||{};return t&&r?En([this.usersByOrganizationId$,this.usersByOrganizationIdAndFolderId$,this.usersByOrganizationIdAndDocumentId$,this.userById$,this.customUserContacts$,this.customUserContactsConfig$,this.getContactListScopeForOrganizationUsers$(),this.temporaryUserIds$]).pipe(de(([s,d,p,u,C,E,D,L])=>{let G={},Y=!1;E&&!E?.merge&&(Y=!0);let ne=Be=>D.some(we=>Be.includes(we)),ge=ne([Li.ALL,Li.ORGANIZATION])?Object.keys(s?.[t]||{}):[],ye=a?ne([Li.ALL,Li.FOLDER])?Object.keys(d?.[t]?.[a]||{}):[]:[],Re=ne([Li.ALL,Li.DOCUMENT])?Object.keys(p?.[t]?.[r]||{}):[];if([...ge,...ye||[],...Re,...L].forEach(Be=>{let we=u?.[Be];we&&(G[Be]=we)}),C){let{merge:Be,options:we}=E||{},{organizationId:Se,documentId:Oe,folderId:_e}=we||{},fe=_e?zo(_e):void 0;(!Se||Se===t)&&(!Oe||Oe===r)&&(!fe||fe===a)&&(Be||(G={}),C.forEach(Ae=>{Ae?.userId&&(G[Ae.userId]=Ae)}))}return Object.values(G??{})})):this.userContacts$.asObservable().pipe(de(s=>s))}catch(t){return this.loggingService.catch("Error in ContactService getUserContacts$ metadata: ",t),se([])}}getUserContactsBySnippylyId$(){return this.userSnippylyIdContacts$.asObservable()}getAtHereLabel(){return this.atHereLabel$.asObservable()}getAtHereDescription(){return this.atHereDescription$.asObservable()}getUserContactsFromDb$(){this.getUserContactSubscription||(this.getUserContactSubscription=this.authService.getUser$().pipe(Le(e=>!!e),he(e=>this.docService.getDocumentPaths$().pipe(Le(t=>!!t),gn(t=>{this.documentPaths=t}),de(()=>e))),he(e=>{if(this.userGroupContacts=[],this.userPersonalContacts=[],!e)return se();if(!this.documentPaths)return se();let t=[];return t.push(this.commonDbService.dbListener({feature:"allGlobalContacts",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}}).pipe(de(r=>r?.data),gn(r=>{r?(this.userGlobalContacts=Object.values(r??{}),this.userGlobalContacts?.find(a=>a.userId===this.user?.userId)?this.userGlobalContact$.next(!0):this.userGlobalContact$.next(!1)):(this.userGlobalContacts=[],this.userGlobalContact$.next(!1))}))),t.push(this.commonDbService.dbListener({feature:"groupContacts",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0,groupId:e?.groupId}}).pipe(de(r=>r?.data),gn(r=>{r?(this.userGroupContacts=Object.values(r??{}),this.userGroupContacts?.find(a=>a?.userId===this.user?.userId)?this.userGroupContact$.next(!0):this.userGroupContact$.next(!1)):(this.userGroupContacts=[],this.userGroupContact$.next(!1))}))),t.push(this.commonDbService.dbListener({feature:"allLoginContacts",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0,userId:_t(e?.userId)}}).pipe(de(r=>r?.data),gn(r=>{r?this.userPersonalContacts=Object.values(r??{}):this.userPersonalContacts=[]}))),ao(...t).pipe(so(this.authService.getUser$().pipe(Le(r=>!r))))})).subscribe(()=>{this.mergeUserContacts()},e=>{this.loggingService.catch("Error in ContactService getUserContacts$ subscription: ",e)}))}addUserContact(e){try{this.user?.organizationId||this.user?.groupId&&(e.visibility="group",this.setLoggedInUserGroupContacts(this.user?.groupId,[e]))}catch(t){this.loggingService.catch("Error in ContactService addUserContact: ",t)}}isUserGlobalContact$(){return this.userGlobalContact$.asObservable()}isUserGlobalContact(){return this.userGlobalContact$.value}isUserGroupContact$(){return this.userGroupContact$.asObservable()}isUserGroupContact(){return this.userGroupContact$.value}getLoggedInUsers$(){return this.getLoggedInUsersSubscription||(this.getLoggedInUsersSubscription=this.authService.getUser$().pipe(he(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(de(t=>t?.data),gn(t=>{t?this.users=Object.values(t??{}):this.users=[]})):(this.users=[],se()):se():se())).subscribe(()=>{this.users$.next(this.users)},e=>{this.loggingService.catch("Error in ContactService getLoggedInUsers$ subscription: ",e)})),this.users$.asObservable()}getUsersMap$(){return this.authService.getUser$().pipe(he(e=>e?.organizationId?this.userById$.pipe(de(t=>{let r={};return Object.values(t||{}).forEach(a=>{a?.userSnippylyId&&(r[a?.userSnippylyId]=a)}),r})):this.users$.pipe(de(t=>{let r={};return t.forEach(a=>{r[a.userSnippylyId]=a}),r}))))}getUserByEmail$(e){return this.users$.pipe(de(t=>t.find(r=>r.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(de(t=>t.find(r=>r.userId===e)))}getUserGroupContacts(){return this.userGroupContacts}getTemporaryUsers(){try{let e=this.authService.getUser();this.docService.getOrganizationConfig$().pipe(Le(t=>!!t),de(t=>t?.organizationId)).subscribe(t=>Q(this,null,function*(){if(t&&e){let r=((yield this.commonDbService?.queryData({feature:"allPermissionsUsers",properties:{organizationId:t,useCollectionGroup:!1,isCollection:!0,firestoreQuery:[ut("expiresAt",">",new Date().getTime())]}}))??[]).filter(a=>a?.userId!==e?.userId);if(r?.length){let a=yield this.usersService.resolveUsers({userIds:r.map(s=>s?.userId)});if(a){let s={};Object.entries(a).forEach(([p,u])=>{s[p]=u}),this.userById$.next(I(I({},this.userById$.value),s));let d=new Set([...this.temporaryUserIds$.value,...Object.keys(s)]);this.temporaryUserIds$.next(Array.from(d))}}}}))}catch(e){this.loggingService.catch("Error in ContactService getTemporaryUsers: ",e)}}getOrganizationContactsFromDb$(){try{this.getOrganizationContactsSubscription||(this.getOrganizationContactsSubscription=this.authService.getUser$().pipe(he(e=>e?.organizationId?se(e).pipe(he(t=>this.docService.getOrganizationConfig$().pipe(Le(r=>!!r),de(()=>t))),he(t=>this.usersService.getResolveOrganizationUsers$().pipe(Le(r=>r),de(()=>t))),he(t=>{let r=this.docService.getOrganizationConfig()?.organizationId;return this.setUserOrganizationContacts([],r),t?r?this.commonDbService.dbListener({feature:"allOrganizationUsers",properties:{organizationId:r,isCollection:!0,useQuery:!0,firestoreQuery:[Bi(ut("organizationIds","array-contains-any",[r])),jr("id")]}}).pipe(de(a=>a?.data),de(a=>{if(a){typeof a=="object"&&(a?.undefined&&delete a.undefined,a?.null&&delete a.null);let s=Object.values(a??{});this.setUserOrganizationContacts(s,r)}else this.setUserOrganizationContacts([],r)})):se():se()}),he(()=>this.getContactListScopeForOrganizationUsers$())):(this.setUserOrganizationContacts([]),se()))).subscribe(()=>{this.mergeOrganizationAndDocumentContacts()},e=>{this.loggingService.catch("Error in ContactService getOrganizationContactsFromDb$ subscription: ",e)}))}catch{}}getFolderContactsFromDb$(){try{this.getFolderContactsSubscription||(this.getFolderContactsSubscription=this.authService.getUser$().pipe(he(e=>e?se(e).pipe(he(t=>this.docService.getOrganizationConfig$().pipe(Le(r=>!!r),de(()=>t))),he(t=>this.usersService.getResolveFolderUsers$().pipe(Le(r=>r),de(()=>t))),he(t=>{let r=this.docService.getOrganizationConfig()?.organizationId;if(this.setUserFolderContacts([]),!t)return se();if(!this.commonDbService.shouldUseFirestore())return se();if(!this.documentPaths?.veltFolderId)return se();let a=se([]);return a=this.commonDbService.dbListener({feature:"allFolderUsers",properties:{organizationId:r,folderId:this.documentPaths?.veltFolderId,isCollection:!0,useQuery:!0,firestoreQuery:[Bi(ut("folderIds","array-contains-any",[this.documentPaths?.veltFolderId])),jr("id")]}}).pipe(de(s=>s?.data)),a.pipe(de(s=>{if(s){typeof s=="object"&&(s?.undefined&&delete s.undefined,s?.null&&delete s.null);let d=Object.values(s??{});this.setUserFolderContacts(d)}else this.setUserFolderContacts([])}))}),he(()=>this.getContactListScopeForOrganizationUsers$())):(this.setUserFolderContacts([]),se()))).subscribe(()=>{this.mergeOrganizationAndDocumentContacts()},e=>{this.loggingService.catch("Error in ContactService getFolderContactsFromDb$ subscription: ",e)}))}catch{}}getDocumentContactsFromDb$(){try{this.getDocumentContactsSubscription||(this.getDocumentContactsSubscription=this.authService.getUser$().pipe(he(e=>e?se(e).pipe(he(t=>this.docService.getDocumentPaths$().pipe(Le(r=>!!r),gn(r=>{this.documentPaths=r}),de(()=>t))),he(t=>this.usersService.getResolveDocumentUsers$().pipe(Le(r=>r),de(()=>t))),he(t=>(this.setUserDocumentContacts([]),t?this.documentPaths?this.docService.getDocumentIds$().pipe(he(r=>{let a=r?.length>0?r.map(u=>u.documentId):[this.documentPaths?.documentId??""];if(a.some(u=>!u)||!this.documentPaths)return se();let s=se([]),d={isCollection:!0,useQuery:!0};this.commonDbService.shouldUseFirestore()||(d.documentId=a?.length?a[0]:void 0,d.organizationId=this.documentPaths?.organizationId);let p=[];for(let u=0;u<a.length;u+=j.LISTENER_BATCH_SIZE)p.push(a.slice(u,u+j.LISTENER_BATCH_SIZE));return s=En(p.map(u=>this.commonDbService.dbListener({feature:"allDocumentUsers",properties:T(I({},d),{firestoreQuery:[Bi(ut("documentIds","array-contains-any",u)),jr("id")]})}).pipe(Wr()))).pipe(de(u=>va(u)?.data)),s.pipe(de(u=>{if(u){typeof u=="object"&&(u?.undefined&&delete u.undefined,u?.null&&delete u.null);let C=Object.values(u??{});this.setUserDocumentContacts(C)}else this.setUserDocumentContacts([])}))})):se():se())),he(()=>this.getContactListScopeForOrganizationUsers$())):(this.setUserDocumentContacts([]),se()))).subscribe(()=>{this.mergeOrganizationAndDocumentContacts()},e=>{this.loggingService.catch("Error in ContactService getDocumentContactsFromDb$ subscription: ",e)}))}catch{}}setUserOrganizationContacts(e,t){try{let r=e.find(s=>s.user.userId===this.user?.userId);r?this.currentOrganizationUserIAM$.next(r):this.currentOrganizationUserIAM$.next(null);let a=e.map(s=>s.user);if(this.userOrganizationContacts$.next(a),this.usersService.setUserByIds(a),t){let s={};s[t]={};let d={};e.forEach(p=>{s[t][p.user.userId]=p,d[p.user.userId]=p.user}),this.userById$.next(I(I({},this.userById$.value),d)),this.usersByOrganizationId$.next(T(I({},this.usersByOrganizationId$.value),{[t]:s[t]}))}else this.usersByOrganizationId$.next({})}catch(r){this.loggingService.catch("Error in ContactService setUserOrganizationContacts: ",r)}}getUserOrganizationContacts$(){return this.getContactListScopeForOrganizationUsers$().pipe(he(()=>this.checkContactListScopeForOrganizationUsers([Li.ALL,Li.ORGANIZATION])?this.userOrganizationContacts$.asObservable():se([])))}getUserOrganizationContacts(){return this.checkContactListScopeForOrganizationUsers([Li.ALL,Li.ORGANIZATION])?this.userOrganizationContacts$.value:[]}setUserFolderContacts(e){try{let t=e?.map(s=>s?.user);this.userFolderContacts$.next(t),this.usersService.setUserByIds(t);let r={},a={};e?.forEach(s=>{let{organizationId:d}=s?.metadata||{};d&&(r[d]||(r[d]={}),s.folderIds?.forEach(p=>{r[d][p]||(r[d][p]={}),r[d][p][s.user.userId]=s,a[s.user.userId]=s.user}))}),this.userById$.next(I(I({},this.userById$.value),a)),this.usersByOrganizationIdAndFolderId$.next(r)}catch(t){this.loggingService.catch("Error in ContactService updateUserFolderContacts: ",t)}}getUserFolderContacts$(){return this.getContactListScopeForOrganizationUsers$().pipe(he(()=>this.checkContactListScopeForOrganizationUsers([Li.ALL,Li.FOLDER])?this.userFolderContacts$.asObservable():se([])))}getUserFolderContacts(){return this.checkContactListScopeForOrganizationUsers([Li.ALL,Li.FOLDER])?this.userFolderContacts$.value:[]}setUserDocumentContacts(e){try{let t=e?.map(s=>s?.user);this.userDocumentContacts$.next(t),this.usersService.setUserByIds(t);let r={},a={};e?.forEach(s=>{let{organizationId:d}=s?.metadata||{};d&&(r[d]||(r[d]={}),s.documentIds?.forEach(p=>{r[d][p]||(r[d][p]={}),r[d][p][s.user.userId]=s,a[s.user.userId]=s.user}))}),this.userById$.next(I(I({},this.userById$.value),a)),this.usersByOrganizationIdAndDocumentId$.next(r)}catch(t){this.loggingService.catch("Error in ContactService updateUserDocumentContacts: ",t)}}getUserDocumentContacts$(){return this.getContactListScopeForOrganizationUsers$().pipe(he(()=>this.checkContactListScopeForOrganizationUsers([Li.ALL,Li.DOCUMENT])?this.userDocumentContacts$.asObservable():se([])))}getUserDocumentContacts(){return this.checkContactListScopeForOrganizationUsers([Li.ALL,Li.DOCUMENT])?this.userDocumentContacts$.value:[]}getCurrentOrganizationUserIAM$(){return this.currentOrganizationUserIAM$.asObservable()}getCurrentOrganizationUserIAM(){return this.currentOrganizationUserIAM$.value}mergeOrganizationAndDocumentContacts(){try{let e=[];this.getContactListScopeForOrganizationUsers().includes(Li.ALL)?e=[...this.getUserOrganizationContacts(),...this.getUserFolderContacts(),...this.getUserDocumentContacts()]:this.getContactListScopeForOrganizationUsers().includes(Li.ORGANIZATION)?e=[...this.getUserOrganizationContacts()]:this.getContactListScopeForOrganizationUsers().includes(Li.FOLDER)?e=[...this.getUserFolderContacts()]:this.getContactListScopeForOrganizationUsers().includes(Li.DOCUMENT)&&(e=[...this.getUserDocumentContacts()]);let t=[...new Map(e.filter(r=>r?.userId).map(r=>[r.userId,r])).values()];this.internalUserContacts$.next(t)}catch(e){this.loggingService.catch("Error in ContactService mergeOrganizationAndDocumentContacts: ",e)}}getOrganizationGroupsFromDb$(){try{this.getOrganizationGroupsSubscription||(this.getOrganizationGroupsSubscription=this.authService.getUser$().pipe(he(e=>e?.organizationId?se(e).pipe(he(t=>this.docService.getOrganizationConfig$().pipe(Le(r=>!!r),de(()=>t))),he(t=>{if(this.setUserOrganizationGroups([]),!t)return se();let r=this.docService.getOrganizationConfig()?.organizationId;return r?this.commonDbService.dbListener({feature:"allOrganizationGroups",properties:{organizationId:r,isCollection:!0}}).pipe(de(a=>a?.data),de(a=>{a?(typeof a=="object"&&(a?.undefined&&delete a.undefined,a?.null&&delete a.null),this.setUserOrganizationGroups(Object.values(a??{}))):this.setUserOrganizationGroups([])})):se()})):(this.setUserOrganizationGroups([]),se()))).subscribe(()=>{},e=>{this.loggingService.catch("Error in ContactService getOrganizationGroupsFromDb$ subscription: ",e)}))}catch{}}setUserOrganizationGroups(e){try{this.userOrganizationGroups$.next(e)}catch(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),r=!!this.getUserOrganizationContacts().find(a=>a.userId===e.userId);switch(this.documentAccessType){case Ci.RESTRICTED:if(!t){let a={contact:e,isOrganizationContact:r,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(he(()=>this.checkContactListScopeForOrganizationUsers([Li.ALL,Li.ORGANIZATION_USER_GROUP])?this.userOrganizationGroups$.asObservable():se([])))}enableAtHere(){try{if(this.analyticsService.setFeatureConfig({feature:Ne.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:Ne.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:Ne.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:Ne.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(he(()=>this.checkContactListScopeForOrganizationUsers([Li.ALL,Li.DOCUMENT])?this.atHereEnabled$.asObservable():se(!1)))}getAtHereEnabled(){return this.checkContactListScopeForOrganizationUsers([Li.ALL,Li.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 Q(this,null,function*(){try{if(this.analyticsService.trackEvent(X.Events.Contact.UPDATE_CONTACT_LIST_TRIGGERED,{contactsCount:e?.length,config:t}),this.usersService?.userDataProviderAvailable()){let r=e.map(s=>s?.userId).filter(s=>s);yield this.usersService.resolveUsers({userIds:r});let a=r.map(s=>this.usersService.getUserById(s)).filter(s=>!!s);this.customUserContacts$.next(a)}else this.customUserContacts$.next(e);this.customUserContactsConfig$.next(t)}catch(r){this.loggingService.catch("Error in CommentService updateContactList: ",r)}})}convert(e){try{if(e?.options){let{documentId:t,organizationId:r}=this.docService.getServerId(e?.options);e.options=T(I({},e?.options),{documentId:t,organizationId:r})}return this}catch(t){return this.loggingService.catch("Error in ContactService convert: ",t),this}}getContactList$(){try{return this.authService.getUser$().pipe(he(e=>e?En([this.userOrganizationContacts$.asObservable(),this.userFolderContacts$.asObservable(),this.userDocumentContacts$.asObservable(),this.userOrganizationGroups$.asObservable(),this.customUserContacts$.asObservable()]).pipe(de(([t,r,a,s,d])=>{let p={};p.organizationUsers=t?.map(C=>this.convertToClientUser(C)),p.folderUsers=r?.map(C=>this.convertToClientUser(C)),p.documentUsers=a?.map(C=>this.convertToClientUser(C)),p.updatedContactList=d?.map(C=>this.convertToClientUser(C));let u=[];return s?.forEach(C=>{let E=this.convertToClientUserGroup(C,p.organizationUsers||[]);E&&u.push(E)}),p.userGroups=u,p}),kt(si)):se(null)),Hn(e=>(this.loggingService.catch("Error in ContactService getContactList$: ",e),se(null))))}catch(e){return this.loggingService.catch("Error in ContactService getContactList$: ",e),se(null)}}convertToClientUserGroup(e,t){try{let r={groupId:e?.metadata?.clientGroupId,groupName:e?.metadata?.groupName,users:[]},a={};return t?.forEach(s=>{if(s?.userId){let d=_t(s.userId);a[d]=s}}),Object.keys(e?.users??{}).forEach(s=>{a[s]&&r.users?.push(a[s])}),r}catch(r){return this.loggingService.catch("Error in ContactService convertToClientUserGroup: ",r),null}}convertToClientUser(e){try{return e&&(e=JSON.parse(JSON.stringify(e)),e?.clientGroupId&&(e.groupId=e.clientGroupId,delete e.clientGroupId),e?.clientOrganizationId&&(e.organizationId=e.clientOrganizationId,delete e.clientOrganizationId),e?.userSnippylyId&&delete e.userSnippylyId),e}catch(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()}};o.\u0275fac=function(t){return new(t||o)(J(tt),J(je),J(Vt),J(_n),J(at),J(y),J(yn),J(Yn))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Rce=i=>{try{return i.name.split(".").slice(0,-1).join(".")}catch(o){mt.catch("Error in File utils getFileName: ",o);return}},fz=i=>{try{return/(?:\.([^.]+))?$/.exec(i?.name)[1]}catch(o){mt.catch("Error in File utils getFileExtension: ",o);return}},Nce=(i,o)=>{try{let n=i.slice(0,-1,i.type);return new File([n],o+"."+fz(i),{type:i.type})}catch(n){mt.catch("Error in File utils updateFile: ",n);return}},Fce=i=>new Promise((o,n)=>{let e=new FileReader;e.readAsDataURL(i),e.onload=()=>{o(e.result)},e.onerror=t=>{n(t)}}),Lce={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 ng=(()=>{let o=class o{constructor(e,t,r,a){this.authService=e,this.configService=t,this.loggingService=r,this.attachmentResolverService=a,this.storage=nS();try{this.configService.getApiKey$().subscribe(s=>{this.apiKey=s}),this.authService.getFirebaseConfig$().subscribe(s=>{s&&s.firebaseOptions?.storageBucket&&(this.storage=nS(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 r=new i0;r.name=t.name;let a=Nce(t,`${r.attachmentId}_${Rce(t)}`),s=`${this.apiKey}/${e}/${a?.name}`;return r.bucketPath=s,r.size=t.size,r.type=fz(t),r?.type&&(r.mimeType=Lce[r?.type]),r}catch(r){return this.loggingService.catch("Error in StorageService createAttachment: ",r),null}}uploadAttachmentToStorage({attachment:e,file:t,resolve:r,reject:a}){try{let s=iS(this.storage,e.bucketPath),d=JV(s,t,{cacheControl:"public,max-age=3600"});d.on("state_changed",p=>{let u=p.bytesTransferred/p.totalBytes*100},p=>{a(p)},()=>{QV(d.snapshot.ref).then(p=>{e.url=p,r(e)})})}catch(s){this.loggingService.catch("Error in StorageService uploadAttachmentToStorage: ",s),a(s)}}uploadToResolver(d){return Q(this,arguments,function*({file:e,attachment:t,metadata:r,resolve:a,reject:s}){try{r.attachmentId=t.attachmentId;let p={attachmentId:t.attachmentId,name:t.name,file:e,metadata:r,mimeType:t.mimeType},u=yield this.attachmentResolverService.saveAttachment({attachment:p,eventType:Ja.ATTACHMENT_ADD});u&&u.data?.url?(t.url=u.data?.url,a(t)):s(new Error("Failed to upload attachment to resolver"))}catch(p){this.loggingService.catch("Error in StorageService uploadToResolver: ",p),s(p)}})}uploadFile({path:e,file:t,useAttachmentResolver:r,metadata:a}){return new Promise((s,d)=>{try{if(!this.apiKey)throw new Error("API key not configured");let p=this.createAttachment({path:e,file:t});if(!p)throw new Error("Attachment not created");r?this.uploadToResolver({file:t,attachment:p,metadata:a,resolve:s,reject:d}):this.uploadAttachmentToStorage({attachment:p,file:t,resolve:s,reject:d})}catch(p){this.loggingService.catch("Error in StorageService uploadFile:",p),d(p)}})}uploadChunk(e,t,r){return new Promise((a,s)=>{try{if(this.apiKey){let d=`${this.apiKey}/${e}/${t.name}`,p=iS(this.storage,d),u=JV(p,t,{cacheControl:"public,max-age=3600"});u.on("state_changed",C=>{let E=C.bytesTransferred/C.totalBytes*100},C=>{s(C)},()=>{QV(u.snapshot.ref).then(C=>{a(C)}).catch(C=>{this.loggingService.catch(`[uploadChunk] Error getting download URL for chunk ${r}:`,C),s(C)})})}else{let d=new Error("API key not available");this.loggingService.catch("[uploadChunk] API key not available",d),s(d)}}catch(d){this.loggingService.catch(`[uploadChunk] Error in StorageService uploadChunk for chunk ${r}: `,d),s(d)}})}downloadAttachment(e){try{if(e.url){let t=new XMLHttpRequest;t.responseType="blob",t.onload=()=>{let r=t.response,a=document.createElement("a"),s=window.URL.createObjectURL(r);a.setAttribute("type","hidden"),a.setAttribute(j.ATTRIBUTES.VELT_DOWNLOAD_BUTTON,"true"),a.classList.add("snippyly-overlay-panel"),a.href=s,e?.name&&(a.download=e?.name),document.body.appendChild(a);let d=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!1});a.dispatchEvent(d),window.URL.revokeObjectURL(s),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:r}){return new Promise((a,s)=>{if(r)this.attachmentResolverService.deleteAttachment({attachmentId:e.attachmentId,metadata:t}).then(()=>{a(null)}).catch(d=>{s(d)});else{let d=iS(this.storage,e.bucketPath);XV(d).then(()=>{a(null)}).catch(p=>{a(null)})}})}deleteFileFromPath(e){return new Promise((t,r)=>{let a=iS(this.storage,e);XV(a).then(()=>{t(null)}).catch(s=>{r(s)})})}};o.\u0275fac=function(t){return new(t||o)(J(je),J(Vt),J(y),J(eg))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Sn=(()=>{let o=class o{constructor(e,t,r,a,s,d,p,u){this.analyticsService=e,this.authService=t,this.contactService=r,this.databaseService=a,this.docService=s,this.configService=d,this.loggingService=p,this.commonDbService=u,this.documentIAM$=new ve(null),this.workspaceIAM$=new ve(null),this.roles$=new ve([]),this.getDocumentIamSubscription=null,this.getOrganizationIamSubscription=null,this.getWorkspaceIamSubscription=null;try{this.authService.setIamService(this),this.databaseService.getDb().pipe(Le(C=>!!C),rt(1)).subscribe(C=>{C&&(this.getUser(),this.getDocumentPaths())},C=>{this.loggingService.catch("Error in CommentService getDb subscription: ",C)}),this.getRole$().pipe(rt(1)).subscribe(C=>{this.authService?.getUser()&&!C&&this.analyticsService.trackEvent(X.Events.Iam.USER_ACCESS_DENIED)}),this.documentIAM$.subscribe(C=>{C?.accessType&&this.contactService.setDocumentAccessType(C.accessType)})}catch(C){this.loggingService.catch("Error in IamService constructor: ",C)}}clearCache(){this.loggingService.log("%c[WB] Calling FUNCTION: clearCache in IamService","color: green;");try{this.documentIAM$.next(null),this.workspaceIAM$.next(null),this.roles$.next([]),this.documentPaths=null}catch(e){this.loggingService.catch("Error in IamService clearCache: ",e)}}getUser(){try{this.authService.getUser$().pipe(Le(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(Le(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 JM;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=>se(null))).subscribe(e=>{this.workspaceIAM$.next(e?.data),this.roles$.next(e?.data?.roles||[])}))}catch(e){this.loggingService.catch("Error in IamService getWorkspaceIam: ",e)}}isUserAllowed$(){return this.getRole$().pipe(de(e=>!!e),kt())}getDocumentIAM$(){return this.documentIAM$.asObservable()}getRoles$(){return this.roles$.asObservable().pipe(de(e=>e?.length?e:j.WorkspaceRoles))}getFeaturesAccessLevel$(){return this.documentIAM$.asObservable().pipe(de(e=>e?.features),he(e=>this.getRole$().pipe(de(t=>(t===uo.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(he(()=>this.documentIAM$.pipe(Le(t=>!!t),he(()=>this.workspaceIAM$.pipe(de(()=>e===this.getRole()))))))}catch(t){return this.loggingService.catch("Error in IamService hasRole$: ",t),se(!1)}}getRole$(){try{return this.authService.getUser$().pipe(he(()=>this.configService.getSF$()),he(()=>this.configService.getSF()?this.contactService.isUserGlobalContact$():se(null)),he(()=>this.documentIAM$.pipe(Le(e=>!!e))),he(()=>this.workspaceIAM$),de(()=>this.getRole()))}catch(e){return this.loggingService.catch("Error in IamService getRole$: ",e),se(null)}}getRole(){try{let e=this.configService.getSF();if(e&&this.contactService.isUserGlobalContact())return uo.ADMIN;if(!e&&this.user?.isAdmin)return uo.ADMIN;let t=null,r;if(this.user)switch((this.documentIAM$.value?this.documentIAM$.value?.features?.all?.restricted:!1)?Ci.RESTRICTED:this.documentIAM$.value?this.documentIAM$.value?.documentAccessType||Ci.PUBLIC:null){case Ci.PUBLIC:r=this.getUserFromDocumentIAM(this.user?.email,this.user?.userId),r||(r=this.getUserFromWorkspaceIAM(this.user?.email,this.user?.userId)),t=r?.role?.name||uo.COMMENTER;break;case Ci.RESTRICTED:r=this.getUserFromDocumentIAM(this.user?.email,this.user?.userId),r||(r=this.getUserFromWorkspaceIAM(this.user?.email,this.user?.userId)),t=r?.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(de(e=>e===uo.ADMIN),kt())}isUserAdmin(){try{return this.getRole()===uo.ADMIN}catch(e){return this.loggingService.catch("Error in IamService isUserAdmin: ",e),!1}}getUserFromDocumentIAM(e,t){try{if(e||t){let r;return e&&(r=this.documentIAM$.value?.users?.[_t(e)]),!r&&t&&(r=this.documentIAM$.value?.users?.[_t(t)]),r}else return}catch(r){this.loggingService.catch("Error in IamService getUserFromDocumentIAM: ",r)}}getUserFromWorkspaceIAM(e,t){try{if(e||t){let r;return e&&(r=this.workspaceIAM$.value?.users?.[_t(e)]),!r&&t&&(r=this.workspaceIAM$.value?.users?.[_t(t)]),r}else return}catch(r){this.loggingService.catch("Error in IamService getUserFromWorkspaceIAM: ",r)}}};o.\u0275fac=function(t){return new(t||o)(J(tt),J(je),J(bi),J(_n),J(at),J(Vt),J(y),J(yn))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var cn=(()=>{let o=class o{constructor(e,t,r,a,s,d,p,u,C,E,D,L,G,Y,ne,ge){this.afAuth=e,this.analyticsService=t,this.authService=r,this.configService=a,this.commonDbService=s,this.commonDbUtilsService=d,this.commentUtilsService=p,this.commentAnnotationsResolverService=u,this.databaseService=C,this.docService=E,this.domService=D,this.iamService=L,this.loggingService=G,this.notificationUtilsService=Y,this.usersService=ne,this.functions=ge,this.db=Za(),this.notificationsDb=Za(void 0,ni.firebaseNotificationsDatabaseURL),this.documentPaths=null,this.notifications$=new ve([]),this.rawNotificationsByIdMap$=new ve(new Map),this.processedNotifications$=new ve([]),this.readNotificationsOnForYouTab$=new ve(!1),this.notificationViews$=new ve({}),this.notificationsByIdMap$=new ve(new Map),this.historyPanelVisible$=new ve(!1),this.notificationsForYou$=new ve(null),this.notificationsByDocumentIdMap$=new ve(null),this.notificationsByDocumentIdSubscription={},this.allowedDocumentMetadataMap$=new ve(null),this.maxNotificationDays$=new ve(15),this.tabConfig$=new ve({people:{enable:!1}}),this.settingsConfig$=new ve(null),this.muteAllNotifications$=new ve(!1),this.enableSettings$=new ve(!1),this.selfNotifications$=new ve(!1),this.settingsInitialConfig$=new ve([{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.notificationsPanelVisible$=new ve(!1);try{this.subscribeNotificationsData().subscribe(),this.commentUtilsService.setNotificationService(this),this.databaseService.getDb().pipe(Le(ye=>!!ye),rt(1)).subscribe(ye=>{ye&&(this.db=ye,this.getDocumentIds(),this.subscribeGetNotificationsForYou())},ye=>{this.loggingService.catch("Error in NotificationService getDb subscription: ",ye)}),this.authService.getUser$().subscribe(ye=>{ye?(this.subscribeGetNotificationsForYou(),this.getDocumentIds(),this.subscribeToUserSettings()):(Object.keys(this.notificationsByDocumentIdSubscription).forEach(Re=>{this.notificationsByDocumentIdSubscription[Re]?.unsubscribe()}),this.notificationForYouSubscription?.unsubscribe(),this.documentIdsSubscription?.unsubscribe(),this.resetCacheData())}),this.docService.getLocationMetadata$().subscribe(ye=>{if(ye){let Re=this.notificationsByDocumentIdMap$.getValue()?JSON.parse(JSON.stringify(this.notificationsByDocumentIdMap$.getValue())):null;Object.keys(ye||{}).forEach(Ge=>{let Be=Re?.[Ge]?.notifications;Be?.length&&Be.forEach(we=>{this.notificationUtilsService.mergeLocationWithNotification({notification:we},ye)?.notification})}),this.notificationsByDocumentIdMap$.next(Re)}})}catch(ye){this.loggingService.catch("Error in NotificationService constructor: ",ye)}}setDBConfigDataToInitialConfig(e){try{let t=JSON.parse(JSON.stringify(this.settingsConfig$.getValue()??{}));Object.entries(e||{}).forEach(([r,a])=>{t[r]=a}),this.settingsConfig$.next(t)}catch(t){this.loggingService.catch("Error in NotificationService setDBConfigDataToInitialConfig: ",t)}}getInitialConfigFromDB(e){return Q(this,null,function*(){try{this.loggingService.log("%c[WB] Calling NotificationService FUNCTION: getInitialConfigFromDB","color: green;");let t=_t(this.authService.getUser()?.userId??""),r=yield this.commonDbService.getData({feature:"userConfig",properties:{useCollectionGroup:!1,isCollection:!1,documentId:e?.documentId,userId:t}});if(r?.notificationsConfig)this.setDBConfigDataToInitialConfig(r?.notificationsConfig);else{this.setSettingsInitialConfig(this.settingsInitialConfig$.getValue());let a={};this.settingsInitialConfig$.getValue().forEach(d=>{if(d.enable){let p=d?.values?.find(u=>u.id===d.default);a[d.id]=p||d?.values?.[0]||{id:"NONE",name:"None"}}});let s={};Object.keys(a).forEach(d=>{s[d]=a[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=_t(this.authService.getUser()?.userId??"");this.userSettingsSubscription=this.enableSettings$.pipe(Le(t=>t===!0),he(()=>this.docService.getDocumentPaths$().pipe(Le(t=>!!t),he(t=>_o(this.getInitialConfigFromDB(t)).pipe(he(()=>this.commonDbService.dbListener({feature:"userConfig",properties:{useCollectionGroup:!1,isCollection:!1,documentId:t?.documentId,userId:e}}).pipe(de(r=>{r?.data?.notificationsConfig&&!zi(r?.data?.notificationsConfig??{},this.settingsConfig$.getValue()??{})&&this.setDBConfigDataToInitialConfig(r?.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.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(gn(()=>{this.notificationsByDocumentIdMap$.next(null)}),he(()=>this.getDocumentIdsByLastNotificationTimestamp().pipe(Ri(),de(([e,t])=>{let r=e?.map(u=>u.documentId),a=t?.map(u=>u.documentId),s=r?.filter(u=>!a?.includes(u)),d=a?.map(u=>({documentId:u,timestamp:t?.find(C=>C.documentId===u)?.timestamp})).filter(u=>!r?.includes(u.documentId)),p=a?.map(u=>{let C=t?.find(E=>E.documentId===u)?.timestamp;return{documentId:u,timestamp:C}}).filter(u=>{let C=e?.find(E=>E.documentId===u.documentId)?.timestamp;return C&&u.timestamp&&C!==u.timestamp});d?.length&&this.fetchNotificationsForDocumentIds(d),p?.length&&this.fetchNotificationsForDocumentIds(p,1),s?.forEach(u=>{this.removeNotificationsForDocumentId(u)}),t&&!t?.length&&!this.notificationsByDocumentIdMap$.getValue()&&this.notificationsByDocumentIdMap$.next({})})))).subscribe(()=>{},e=>{this.loggingService.catch("Error in NotificationService getDocumentIds subscription: ",e)})}catch(e){this.loggingService.catch("Error in NotificationService getDocumentIds: ",e)}}getDocumentIdsByLastNotificationTimestamp(e=15){try{return this.authService.getUser$().pipe(he(t=>this.docService.getOrganizationConfig$().pipe(de(r=>{let a=null,s=this.configService.getApiKey(),d=r?.organizationId||t?.organizationId;return s&&d&&(a=new Fd({apiKey:s,organizationId:d})),{user:t,documentPaths:a}}))),he(t=>{let{user:r,documentPaths:a}=t;if(r&&a?.organizationNotificationsLastNotificationTimestamp){let s=new Date,d=this.maxNotificationDays$.getValue()>0?this.maxNotificationDays$.getValue():15;s.setDate(s.getDate()-d);let p=s.getTime();return this.commonDbService.dbListener({feature:"allLastNotificationTimestamp",properties:{organizationId:a?.organizationId,isCollection:!0,useQuery:!0,firestoreQuery:[Bi(ut("timestamp",">=",p)),jr("timestamp","desc"),n0(e)]}}).pipe(de(u=>u?.data),de(u=>{let C=[];return Object.keys(u||{}).forEach(E=>{let D=this.commonDbService.shouldUseFirestore()?u[E]?.timestamp??0:u[E],L=this.commonDbService.shouldUseFirestore()?u[E]?.deletedNotification??!1:!1;if(L&&L.id&&L?.timestamp===D){let G=L.id,Y=u[E]?.metadata?.documentId,ne=JSON.parse(JSON.stringify(this.notificationsByDocumentIdMap$.getValue()??{})),ge=ne?.[Y]??{documentMetadata:null,notifications:[]},ye=ge.notifications??[],Re=ye?.findIndex(Ge=>Ge.id===G);Re!==-1&&(ye.splice(Re,1),this.notificationsByDocumentIdMap$.next(T(I({},ne),{[Y]:T(I({},ge),{notifications:ye})})))}C.push({documentId:E,timestamp:D})}),C}),Hn(u=>(this.loggingService.catch("Error in NotificationService getDocumentIdsByLastNotificationTimestamp: ",u),se([]))))}return se(null)}))}catch(t){return this.loggingService.catch("Error in NotificationService getDocumentIdsByLastNotificationTimestamp: ",t),se([])}}fetchNotificationsForDocumentIds(e,t=15){return Q(this,null,function*(){try{if(e?.length){let r=yr(this.functions,br({url:ni.cloudFunction.getNotificationsForDocuments,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:12e5}),a=this.docService.getOrganizationConfig()?.organizationId??"",s=this.getStartAtTimestamp(),d={};e.forEach(L=>{if(L?.documentId){let G=this.getAllowedDocumentMetadataByDocumentId(L.documentId);G&&(d[L.documentId]=G)}});let p={organizationId:a,documentIds:e,timestamp:s,limitToLast:t,documentMetadataByDocumentId:d,selfNotifications:this.selfNotifications$.value},u=yield this.notificationUtilsService.handleNotificationEncryption({data:p}),C=(yield r({veltData:u}))?.data?.data?.veltData||{},E="notificationwithdocumentidstoencryptanddecryptonsdk"+(this.authService.getUser()?.userId??""),D=yield jre(C,E);if(D&&typeof D=="object"){let L=this.usersService.userDataProviderAvailable(),G=this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable(),Y=[],ne=[];Object.keys(D).forEach((ge,ye)=>{let Re=D[ge].documentMetadata;if(Re){let Be=this.allowedDocumentMetadataMap$.value||{};(!Be?.[ge]||!zi(Be?.[ge],Re))&&this.allowedDocumentMetadataMap$.next(T(I({},Be),{[ge]:Re}))}let Ge=D[ge].notifications||[];Ge.forEach(Be=>{Be.notification=this.getClientNotificationObject(Be)}),this.setNotificationForDocumentIdInCache(ge,Re,Ge),L&&Y.push(this.commonDbUtilsService.formatResponse({feature:"allDocNotifications",data:Ge,shouldAwait:!0,forceResolve:!0})),G&&ne.push(this.commonDbUtilsService.formatResponse({feature:"allDocNotifications",data:Ge,shouldCommentAnnotationsResolverAwait:!0}))}),L&&Promise.all(Y).then(()=>{Object.keys(D).forEach(ge=>{let ye=D?.[ge]?.documentMetadata||{},Re=this.commonDbUtilsService.mergeUsersWithData({feature:"allDocNotifications",data:D?.[ge]?.notifications||[]});Re.forEach(Ge=>{Ge.notification=this.getClientNotificationObject(Ge)}),this.setNotificationForDocumentIdInCache(ge,ye,Re)})}),G&&Promise.all(ne).then(()=>{Object.keys(D).forEach(ge=>{let ye=D?.[ge]?.documentMetadata||{},Re=D?.[ge]?.notifications?.reduce((Ge,Be)=>(Ge[Be.notificationId]=Be,Ge),{});Re=this.commonDbUtilsService.mergeCommentAnnotationsWithData({feature:"allDocNotifications",data:Re}),Re=Object.values(Re??{}),Re.forEach(Ge=>{Ge.notification=this.getClientNotificationObject(Ge)}),this.setNotificationForDocumentIdInCache(ge,ye,Re)})})}}}catch(r){return this.loggingService.catch("Error in NotificationService fetchNotificationsForDocumentIds: ",r),[]}})}setNotificationForDocumentIdInCache(e,t,r,a){try{let s=this.docService.getOrganizationConfig()?.organizationId??"",d=this.docService.getOrganizationMetadata(s);t||(t=JSON.parse(JSON.stringify(this.docService.getDocumentMetadata()||{}))),d||(d=JSON.parse(JSON.stringify(this.docService.getOrganizationMetadata(s)||{})));let p=this.notificationsByDocumentIdMap$.getValue(),u=p?.[e]?.notifications||[],C=this.docService.getLocationMetadatas(),E=r?.map(G=>{let Y=G.notification;return Y.metadata&&(Y.metadata.documentName=t?.documentName||Y.metadata.documentName,Y.metadata.organizationMetadata=d||Y.metadata.organizationMetadata,Y.metadata.documentMetadata=t||Y.metadata.documentMetadata),C&&(Y=this.notificationUtilsService.mergeLocationWithNotification({notification:Y},C)?.notification),Y})?.filter(G=>!!G)||[],D=new Map(u.map(G=>[G.id,G]));E.forEach(G=>{D.set(G.id,G)});let L=Array.from(D.values()).sort((G,Y)=>(Y.timestamp||0)-(G.timestamp||0));this.notificationsByDocumentIdMap$.next(T(I({},p),{[e]:{notifications:L,documentMetadata:t}}))}catch(s){this.loggingService.catch("Error in NotificationService setNotificationForDocumentIdInCache: ",s)}}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)}}getNotificationsForDocumentId$(e,t=50){try{return this.authService.getUser$().pipe(de(r=>({user:r})),he(r=>this.maxNotificationDays$.pipe(de(()=>r))),he(r=>{let{user:a}=r,s=this.configService.getApiKey();if(a&&s){let d=new Date,p=this.maxNotificationDays$.getValue()>0?this.maxNotificationDays$.getValue():15;d.setDate(d.getDate()-p);let u=d.getTime();return _o(this.commonDbService.queryData({feature:"allDocNotifications",properties:{rtdbQuery:[Mu("timestamp"),ku(u),TV(t)],firestoreQuery:[jr("timestamp","desc"),ut("timestamp",">=",u),ut("notification.actionUser.userId","!=",a.userId),n0(t)],apiKey:s,organizationId:this.docService?.getDocumentPaths()?.organizationId||a?.organizationId,documentId:e}})).pipe(he(C=>this.commonDbUtilsService.mergeUsersWithData$({feature:"allDocNotifications",data:{data:C,operation:null}})),de(C=>C?.data??[]),de(C=>(C.sort((E,D)=>D.timestamp-E.timestamp),C)),Hn(C=>(this.loggingService.catch("Error in NotificationService getNotificationsForDocumentId: ",C),se([]))),de(C=>(C.forEach(E=>{E.notification=this.getClientNotificationObject(E)}),C)))}return se([])}))}catch(r){return this.loggingService.catch("Error in NotificationService getNotificationsForDocumentId: ",r),se([])}}getStartAtTimestamp(){try{let e=new Date,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.databaseService.getDb().pipe(he(e=>this.authService.getUser$().pipe(de(t=>({db:e,user:t})))),he(e=>this.maxNotificationDays$.pipe(de(()=>e))),he(e=>{let{db:t,user:r}=e,a=this.configService.getApiKey();if(t&&r?.organizationId&&a){let s=_t(r?.userId),d=new Date,p=this.maxNotificationDays$.getValue()>0?this.maxNotificationDays$.getValue():15;d.setDate(d.getDate()-p);let u=d.getTime();return this.commonDbService.dbListener({feature:"allUserNotifications",properties:{useQuery:!0,isCollection:!0,rtdbQuery:[Mu("timestamp"),ku(u),TV(50)],firestoreQuery:[jr("timestamp","desc"),ut("timestamp",">=",u),ut("notification.actionUser.userId","!=",r.userId),n0(50)],apiKey:a,organizationId:this.docService?.getDocumentPaths()?.organizationId||r?.organizationId,documentId:this.docService.getDocumentPaths()?.documentId,userId:s}}).pipe(he(C=>C?.data?se(C).pipe(de(E=>E?.data),de(E=>{let D=Object.values(E||{});return D.forEach(G=>{G.notification=this.getClientNotificationObject(G)}),D.sort((G,Y)=>Y.timestamp-G.timestamp),D.map(G=>G.notification).filter(G=>!!G)}),he(E=>{let D={data:E?.reduce((L,G)=>(L[G.id]={notification:G},L),{}),operation:null};return this.commonDbUtilsService.mergeLocationMetadataWithData$({data:D,feature:"allUserNotifications"}).pipe(de(L=>Object.values(L?.data||{}).map(G=>G?.notification)))})):se(null)))}return se(null)}),he(e=>{let t=this.docService.getOrganizationConfig()?.organizationId??"";return this.docService.getOrganizationMetadata$(t).pipe(de(()=>e))}),he(e=>this.allowedDocumentMetadataMap$.pipe(de(()=>e))),de(e=>(e?.length&&(e=e.map(t=>{if(t?.metadata){let r=this.docService.getOrganizationConfig()?.organizationId??"",a=this.getAllowedDocumentMetadataByDocumentId(t.metadata.documentId),s=this.docService.getOrganizationMetadata(r);a||(a=JSON.parse(JSON.stringify(this.docService.getDocumentMetadata()||{}))),s||(s=JSON.parse(JSON.stringify(this.docService.getOrganizationMetadata(r)||{}))),t.metadata.documentName=a?.documentName||t.metadata.documentName,t.metadata.organizationMetadata=s||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([]),se(e))))}catch(e){return this.loggingService.catch("Error in NotificationService getNotificationsForYou: ",e),se({})}}subscribeNotificationsData(e,t){this.loggingService.log("%c[WB] Calling FUNCTION: subscribeViewsData","color: green;");let r,a;try{if(e&&(a=fn(e)),t&&typeof t=="object"){let s=Go(t);r=fn(JSON.stringify(s))}}catch(s){this.loggingService.catch("Error in ViewsService subscribeViewsData: ",s)}return Qn(this.afAuth).pipe(Le(s=>!!s),he(s=>this.isFeatureAllowed({firebaseUser:s})),he(s=>s.featureAllowed?this.iamService.isUserAllowed$().pipe(de(d=>(s.featureAllowed=d,s))):se(s)),he(s=>!s.featureAllowed||s?.user?.organizationId?(this.notifications$.next([]),this.rawNotificationsByIdMap$.next(new Map),this.processedNotifications$.next([]),this.notificationsByIdMap$.next(new Map),this.notificationViews$.next({}),this.setNotificationsByIdMap(),se([])):se(s).pipe(he(d=>this.docService.getDocumentPaths$().pipe(de(p=>(this.documentPaths=p,d.documentPaths=p,d)))),he(d=>this.getDataFromDocumentId(a)))))}isFeatureAllowed(e){return this.configService.getConfig$().pipe(Le(t=>!!t),de(t=>T(I({},e),{config:t})),he(t=>this.authService.getUser$().pipe(de(r=>T(I({},t),{user:r})))),he(t=>no(t.config,t.user,Ne.NOTIFICATION)?se(T(I({},t),{featureAllowed:!0})):(this.loggingService.warn("Notification feature is not allowed."),se(T(I({},t),{featureAllowed:!1})))))}getDataFromDocumentId(e){return this.databaseService.getDb().pipe(Le(t=>!!t),he(t=>{if(this.db=t,this.loggingService.log(this.db),this.configService?.getApiKey()&&this.documentPaths?.views){let r=`${this.configService.getApiKey()}`;this.documentPaths?.organizationId&&(r+=`/${j.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${this.documentPaths.organizationId}`);let a=$i(this.db,`${e?r+"/"+j.FIREBASE_PARTIAL_PATH_DOCS+"/"+e+"/"+j.FIREBASE_PARTIAL_PATH_VIEWS+"/":this.documentPaths?.notifications}`);return w6(a).pipe(Hn(s=>(this.loggingService.catch("Error in NotificationService getDataFromDocumentId: ",s),se(null))),de(s=>{let d=[],p=new Map;s?.raw&&(Object.keys(s?.raw||{}).forEach(C=>{let E=s?.raw[C];E?.id&&d.push(E)}),d.forEach(C=>{C.id&&p.set(C.id,C)})),this.notifications$.next(d),this.rawNotificationsByIdMap$.next(p);let u=[];s?.processed&&Object.keys(s?.processed||{}).forEach(C=>{let E=s?.processed[C];E?.id&&u.push(E)}),this.processedNotifications$.next(u),this.setNotificationsByIdMap()}))}else return se(null)}))}setNotificationsByIdMap(){try{let e=this.authService.getUser();if(e){let t=this.notificationViews$.getValue(),r;e?.email&&(r=_t(e?.email));let a;e?.userId&&(a=_t(e?.userId));let s=new Map;this.processedNotifications$.getValue().forEach(p=>{if(p.id&&p?.displayHeadlineMessageTemplate){let u=!1;(r&&p.notifyUsers?.[r]||a&&p.notifyUsers?.[a])&&(u=!0);let C={id:p.id,notificationSource:p.notificationSource,actionType:p.actionType,actionUser:p.actionUser,timestamp:p.timestamp,targetAnnotationId:p.targetAnnotationId,displayHeadlineMessage:this.getNotificationHeadlineMessage(p),displayBodyMessage:this.getNotificationBodyMessage(p),forYou:u,notificationSourceData:p.notificationSourceData},E=this.getRawNotificationById(C.id);if(E?.metadata&&(C.metadata={apiKey:E.metadata.apiKey,organizationId:E.metadata.organizationId,clientOrganizationId:E.metadata.clientOrganizationId,documentId:E.metadata.documentId,clientDocumentId:E.metadata.clientDocumentId,location:E?.location,locationId:E?.locationId}),C?.notificationSource==="comment"&&C?.targetAnnotationId){let D=this.commentService?.getAnnotationById(C.targetAnnotationId);D||E?.annotationData&&(D=E.annotationData),D&&(C.notificationSourceData=qn(D))}s.set(p.id,C)}}),s.forEach((p,u)=>{p.isUnread=p?.actionUser?.userSnippylyId!==e?.userSnippylyId&&!t?.notification?.[u]?.views?.[e?.userSnippylyId],s.set(u,p)}),this.notificationsByIdMap$.next(s)}}catch(e){this.loggingService.catch("Error in NotificationService setNotificationsByIdMap: ",e)}}getClientNotificationObject({processed:e,raw:t,metadata:r,views:a,notification:s}){try{let d=this.authService.getUser(),p=s||e;if(p.id&&p?.displayHeadlineMessageTemplate&&d){let u=null;d?.email&&(u=_t(d?.email));let C=null;d?.userId&&(C=_t(d?.userId));let E=!1,D=!0;(u&&p.notifyUsers?.[u]||C&&p.notifyUsersByUserId?.[C])&&(E=!0),C&&a?.[C]&&(D=!1);let L={id:p.id};if(s?L=T(I(I({},L),s),{displayHeadlineMessage:this.getNotificationHeadlineMessage(s),displayBodyMessage:this.getNotificationBodyMessage(s),forYou:E,isUnread:D}):L={id:e.id,notificationSource:e.notificationSource,actionType:e.actionType,actionUser:e.actionUser,timestamp:e.timestamp,targetAnnotationId:e.targetAnnotationId,displayHeadlineMessage:this.getNotificationHeadlineMessage(e),displayBodyMessage:this.getNotificationBodyMessage(e),forYou:E,isUnread:D,metadata:r},L?.notificationSource==="comment"&&L?.targetAnnotationId){let G=this.commentService?.getAnnotationById(L.targetAnnotationId);G||s?.notificationSourceData&&(G=s?.notificationSourceData),G||t?.annotationData&&(G=t.annotationData),G&&(L.notificationSourceData=qn(G))}return t?.targetAnnotationData?.isCommentResolverUsed&&(L.isCommentResolverUsed=t?.targetAnnotationData?.isCommentResolverUsed),L}return}catch(d){this.loggingService.catch("Error in NotificationService getClientNotificationObject: ",d);return}}getNotificationsForYou$(){return this.notificationsForYou$.asObservable()}getNotificationsByDocumentId$(){return this.notificationsByDocumentIdMap$.asObservable().pipe(de(e=>e?Object.keys(e??{}).map(t=>{let r=e[t].notifications||[],a=r.filter(d=>d.isUnread).length,s=r.length>0&&r[0]?.timestamp||0;return{documentId:t,notifications:e[t]?.notifications,unreadNotificationsCount:a,latestNotificationTimestamp:s,documentMetadata:e[t]?.documentMetadata}}).filter(t=>t.notifications?.length>0).sort((t,r)=>r.latestNotificationTimestamp-t.latestNotificationTimestamp):null))}getAllNotifications$(){return this.getNotificationsByDocumentId$().pipe(de(e=>{let t=null;return e?(t=[],e.forEach(r=>{r.notifications.forEach(a=>{t?.push(a)})}),t?.sort((r,a)=>a.timestamp-r.timestamp)):null}))}processNotificationData(e){try{let t=e?.annotationData?.metadata,r=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(r?this.docService.getOrganizationMetadata(r)||{}:{})),e?.metadata?.organizationMetadata?.clientOrganizationId&&e?.metadata?.organizationMetadata?.organizationId&&(e.metadata.organizationMetadata.organizationId=e?.metadata?.organizationMetadata?.clientOrganizationId);let a=this.configService.getApiKey();e.metadata.apiKey=a,e.platform=this.configService.getSF()?"sf":"sdk",e.actionUser=this.authService.getUser();let s=t?.documentId?new Fd({apiKey:a,documentId:t.documentId,organizationId:t?.organizationId}):this.docService.getDocumentPaths();e?.actionUser?.organizationId&&(e.metadata.organizationId=s?.organizationId||e.actionUser.organizationId,e.metadata.clientOrganizationId=s?.clientOrganizationId||e.actionUser.clientOrganizationId);let d=this.docService.getLocation();d&&(e.location=d?.location,e.locationId=d?.locationId),this.loggingService.log(`[NOTIFICATION] ${e?.notificationSource} ${e?.actionType}`,e);let p=this.commonDbService.getServerTimestamp(),u=this.notificationUtilsService.formatNotification(e,p);return JSON.parse(JSON.stringify(u))}catch(t){return this.loggingService.catch("Error in NotificationService processNotificationData: ",t),null}}updateNotificationDatabase(e){try{let t=$i(this.notificationsDb),r=this.processNotificationData(e);C6(t,JSON.parse(JSON.stringify(r)))}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(he(t=>t?t.organizationId?this.getAllNotifications$().pipe(he(r=>this.notificationsForYou$.pipe(de(a=>{if(r||a){let s=new Map;return(!e?.type||["all","documents"].includes(e.type))&&(r||[]).forEach(d=>{d.id&&s.set(d.id,d)}),(!e?.type||["all","forYou"].includes(e.type))&&(a||[]).forEach(d=>{d.id&&!s.has(d.id)&&s.set(d.id,d)}),Array.from(s.values()).sort((d,p)=>(p.timestamp||0)-(d.timestamp||0))}else return null})))):this.notificationsByIdMap$.asObservable().pipe(de(r=>Array.from(r.values())),de(r=>r.sort((a,s)=>s.timestamp-a.timestamp)),zg()):se(null)),kt(si))}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 r=e.displayHeadlineMessageTemplate,a=e.displayHeadlineMessageTemplateData,s=/\{(\w+)\}/g,d=r.replace(s,(p,u)=>(u==="actionUser"||u==="recipientUser")&&a[u]?t?.email&&a[u].email===t?.email||t?.userId&&a[u]?.userId===t?.userId?"You":a[u].name||a[u].email||' <velt-skeleton-loader width="50px" height="20px" border-radius="4px"></velt-skeleton-loader> ':a[u]?a[u]:p);return this.domService.sanitizeHtml(d)}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(r=>{if(r?.userId){let a=this.usersService.getUserById(r?.userId);t=t?.replaceAll(`{{${r.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,r=!1){try{e?document.querySelector(j.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL)?this.historyPanelVisible$.next(e):this.loggingService.catch("Error in NotificationService setHistoryPanelVisibility: ",`<${j.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL}> tag is not added.`):this.historyPanelVisible$.next(e),e?this.analyticsService.trackEvent(X.Events.Notifications.NOTIFICATION_HISTORY_PANEL_OPENED):this.analyticsService.trackEvent(X.Events.Notifications.NOTIFICATION_HISTORY_PANEL_CLOSED)}catch{this.loggingService.catch("Error in NotificationService setHistoryPanelVisibility: ",`<${j.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL}> tag is not added.`)}}toggleHistoryPanelVisibility(e=!1,t=!1){try{this.historyPanelVisible$.value?this.historyPanelVisible$.next(!this.historyPanelVisible$.value):document.querySelector(j.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL)?(this.historyPanelVisible$.next(!this.historyPanelVisible$.value),this.historyPanelVisible$.value?this.analyticsService.trackEvent(X.Events.Notifications.NOTIFICATION_HISTORY_PANEL_TOGGLED,{action:"closed"}):this.analyticsService.trackEvent(X.Events.Notifications.NOTIFICATION_HISTORY_PANEL_TOGGLED,{action:"opened"})):this.loggingService.catch("Error in NotificationService toggleHistoryPanelVisibility: ",`<${j.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL}> tag is not added.`)}catch{this.loggingService.catch("Error in NotificationService toggleHistoryPanelVisibility: ",`<${j.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL}> tag is not added.`)}}getHistoryPanelVisibility$(){return this.historyPanelVisible$.asObservable()}setNotificationsAsRead(e){return Q(this,null,function*(){try{if(e?.length){for(let a=0;a<e.length;a+=50){let d=e.slice(a,a+50).filter(p=>p?.id).map(p=>this.setNotificationAsRead(p));yield Promise.all(d)}let r=JSON.parse(JSON.stringify(this.notificationsByDocumentIdMap$.getValue()||{}));e.forEach(a=>{let s=a.metadata?.documentId;if(s&&r?.[s]){let d=r?.[s]?.notifications||[],p=d.find(u=>u.id===a.id);p&&(p.isUnread=!1),r[s].notifications=d}}),this.notificationsByDocumentIdMap$.next(r)}}catch(t){this.loggingService.catch("Error in NotificationService setNotificationsAsRead: ",t)}})}setAllNotificationsAsRead(e){return Q(this,null,function*(){try{if(e?.tabId==="for-you"){let t=this.notificationsForYou$.value||[];this.setNotificationsAsRead(t)}else this.getNotifications$().pipe(rt(1)).subscribe(t=>{t&&this.setNotificationsAsRead(t)})}catch(t){this.loggingService.catch("Error in NotificationService setAllNotificationsAsRead: ",t)}})}getUnreadNotificationsCount$(){try{return this.notificationsForYou$.pipe(de(e=>e?.filter(r=>r?.isUnread)?.length??null),he(e=>this.getNotifications$().pipe(de(t=>{let r=t?.filter(a=>a?.isUnread)?.length??null;return{forYou:e,all:r}}))))}catch(e){return this.loggingService.catch("Error in NotificationService getUnreadNotificationsCount$: ",e),se({forYou:null,all:null})}}setNotificationAsRead(e){return Q(this,null,function*(){try{let t=this.authService.getUser();if(t&&e?.id){let r=_t(t?.userId),{metadata:a}=e;if(a){let{apiKey:s,organizationId:d,documentId:p}=a;if(s&&d&&p&&r){let u=yield this.commonDbService.getData({feature:"docNotification",properties:{id:e.id,organizationId:d,documentId:p,apiKey:s}});u?.notificationId&&(u?.views?.[r]||(u.views||(u.views={}),u.views[r]={timestamp:Date.now()},this.commonDbService.updateData({feature:"docNotificationViews",properties:{id:e.id,organizationId:d,documentId:p,apiKey:s},data:u})));let C=yield this.commonDbService.getData({feature:"userNotification",properties:{id:e.id,userId:r,documentId:p,organizationId:d}});C?.notificationId&&(this.getReadNotificationsOnForYouTab()?C?.views?.[r]||(C.views||(C.views={}),C.views[r]={timestamp:Date.now()},this.commonDbService.updateData({feature:"userNotificationViews",properties:{id:e.id,userId:r,documentId:p,organizationId:d},data:C})):yield this.commonDbService.deleteData({feature:"userNotification",properties:{id:e.id,userId:r,documentId:p,organizationId:d}}))}}}}catch(t){this.loggingService.catch("Error in NotificationService setNotificationAsRead: ",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}markNotificationAsReadById(e){return Q(this,null,function*(){try{this.getNotifications$().pipe(rt(1)).subscribe(t=>{if(t){let r=t.filter(a=>a.id===e);this.setNotificationsAsRead(r)}})}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)}}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(r=>{["email","inbox"].includes(r.id)&&(t=!r.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 Q(this,null,function*(){try{let t=_t(this.authService.getUser()?.userId??""),r=this.docService.getDocumentPaths(),a={apiKey:this.configService.getApiKey(),organizationId:r?.organizationId,documentId:r?.documentId,clientOrganizationId:r?.clientOrganizationId,clientDocumentId:r?.clientDocumentId,userId:t,clientUserId:this.authService.getUser()?.userId};t&&r?.documentId&&this.getEnableSettings()&&this.enableSettings$.value&&(yield this.commonDbService.updateData({feature:"userConfig",properties:{documentId:r.documentId,userId:t},data:{id:r.documentId,notificationsConfig:e||this.settingsConfig$.getValue(),metadata:a}}))}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}};o.\u0275fac=function(t){return new(t||o)(J(Ei),J(tt),J(je),J(Vt),J(yn),J(tg),J(c0),J(ws),J(_n),J(at),J(Fe),J(Sn),J(y),J(Sk),J(Yn),J($o))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Wo=(()=>{let o=class o{constructor(e){this.loggingService=e,this._customStatusMap=new ve(j.CommentAnnotationStatusMap),this._customPriorityMap=new ve(j.CommentAnnotationPriorityMap),this._customCategoryMap=new ve(j.CommentCategoryMap);try{let t=sessionStorage.getItem(j.SESSION_STORAGE.VELT_CUSTOM_PRIORITY_MAP);t&&this._customPriorityMap.next(JSON.parse(t));let r=sessionStorage.getItem(j.SESSION_STORAGE.VELT_CUSTOM_STATUS_MAP);r&&this._customStatusMap.next(JSON.parse(r));let a=sessionStorage.getItem(j.SESSION_STORAGE.VELT_CUSTOM_CATEGORY_MAP);a&&this._customCategoryMap.next(JSON.parse(a))}catch(t){this.loggingService.catch("Error in CustomFilterService constructor: ",t)}}setCustomStatusFilters(e){try{if(e.length<2){this._customStatusMap.next(j.CommentAnnotationStatusMap),sessionStorage.setItem(j.SESSION_STORAGE.VELT_CUSTOM_STATUS_MAP,JSON.stringify(j.CommentAnnotationStatusMap)),this.loggingService.catch("Custom status filters must have at least 2 filters");return}let t={};e.forEach(r=>{t[r.id]=r,r.type||(r.type="ongoing")}),this._customStatusMap.next(t),sessionStorage.setItem(j.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(j.CommentAnnotationPriorityMap),sessionStorage.setItem(j.SESSION_STORAGE.VELT_CUSTOM_PRIORITY_MAP,JSON.stringify(j.CommentAnnotationPriorityMap)),this.loggingService.catch("Custom priority filters must have at least 2 filters");return}let t={};e.forEach(r=>{t[r.id]=r}),this._customPriorityMap.next(t),sessionStorage.setItem(j.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(r=>{t[r.id]=r}),this._customCategoryMap.next(t),sessionStorage.setItem(j.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(([r,a])=>a.type==="default");if(t)return t[1]}catch(e){this.loggingService.catch("Error in CustomFilterService defaultStatus: ",e)}return j.CommentAnnotationStatusMap.OPEN}get resolvedStatus(){try{let t=Object.entries(this._customStatusMap.value).find(([r,a])=>a.type==="terminal");if(t)return t[1]}catch(e){this.loggingService.catch("Error in CustomFilterService resolvedStatus: ",e)}return j.CommentAnnotationStatusMap.OPEN}get ongoingStatuses(){try{let t=Object.entries(this._customStatusMap.value).filter(([r,a])=>a.type==="ongoing");if(t)return t.map(r=>r[1])}catch(e){this.loggingService.catch("Error in CustomFilterService ongoingStatuses: ",e)}return[j.CommentAnnotationStatusMap.IN_PROGRESS]}convertLegacyAnnotationStatus(e){try{if(typeof e.status=="string"||e.status===void 0){let t=Object.entries(this._customStatusMap.value),r=t.find(([a,s])=>s.type==="default");switch(e.status){case"open":r&&(e.status=r[1]);break;case"inProgress":let a=t.find(([d,p])=>p.type==="ongoing");a&&(e.status=a[1]);break;case"resolved":let s=t.find(([d,p])=>p.type==="terminal");s&&(e.status=s[1]);break;default:r&&(e.status=r[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=j.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=>j.CommentCategoryMap[t]))}catch(t){this.loggingService.catch("Error in CustomFilterService convertLegacyCategory: ",t)}return e}};o.\u0275fac=function(t){return new(t||o)(J(y))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Nc=(()=>{let o=class o{constructor(e,t,r){this.domService=e,this.loggingService=t,this.sanitizer=r,this.emojis={};try{this.loggingService.log("%c[WB] Creating CLASS: EmojiService","color: blue;"),Object.keys(o.Icons).forEach(a=>{let s=o.Icons[a];this.emojis[a]=this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeSvg(s))}),Object.keys(o.GIF_PATHS).forEach(a=>{let s=`<img src="${o.GIF_PATHS[a]}" alt="${a}" />`;this.emojis[a]=this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeHtml(s))})}catch(a){this.loggingService.catch("Error in EmojiService constructor: ",a)}}getEmoji(e){try{return this.emojis[e]}catch{return""}}getEmojiFromIconUrl(e){try{return this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeHtml(`<img src="${e}" alt="emoji" />`))}catch{return""}}getEmojiFromIconEmoji(e,t){try{let r=`<span class="velt-emoji-icon velt-emoji-icon--emoji">${e}</span>`;return t&&(r=`<span class="velt-emoji-icon velt-emoji-icon--emoji" emoji-id=${t}>${e}</span>`),this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeHtml(r))}catch{return""}}setEmojiList(e){try{this.emojis={},Object.keys(e).forEach(t=>{let r=e[t];if(r.svg)this.emojis[t]=this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeSvg(r.svg));else if(r.url){let a=`<img src="${r.url}" alt="${t}" />`;this.emojis[t]=this.sanitizer.bypassSecurityTrustHtml(this.domService.sanitizeHtml(a))}else r.emoji&&(this.emojis[t]=this.getEmojiFromIconEmoji(this.domService.sanitizeHtml(r.emoji)))})}catch(t){this.loggingService.catch("Error in EmojiService setEmojiList: ",t)}}};o.Icons={RAISED_HANDS:`<svg width="58" height="57" viewBox="0 0 58 57" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
197
197
|
<path d="M35.8477 11.6603L40.4962 5.23427" stroke="#B0BEC5" stroke-width="1.92685" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
|
|
198
198
|
<path d="M21.8298 11.617L17.4655 6.02428" stroke="#B0BEC5" stroke-width="1.92685" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
|
|
199
199
|
<path d="M28.7568 9.77682L28.7761 1" stroke="#B0BEC5" stroke-width="1.92685" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
|
|
@@ -401,7 +401,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
401
401
|
Provide one more option
|
|
402
402
|
<|im_end|>
|
|
403
403
|
`),a}catch(a){return this.loggingService.catch("Error in RewriterService getChatGPTPrompt: ",a),""}}removeChatGPTPlaceholders(e){try{let t=["<|im_start|>","<|im_start>","<im_start|>","<im_start>","<|im_end|>","<|im_end>","<im_end|>","<im_end>","<|end|>","<|end>","<end|>","<end>","<|start|>","<|start>","<start|>","<start>"],r=e;return t.forEach(a=>{let s=a.replace(/\|/g,"\\|");r=r?.replace(new RegExp(s,"g"),"")}),r}catch(t){return this.loggingService.catch("Error in RewriterService removeChatGPTPlaceholders: ",t),""}}};o.\u0275fac=function(t){return new(t||o)(J(tt),J(je),J(Vt),J(Fe),J(y),J($o))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Zk=class extends ri{constructor(o){super(o),this.getService(y).log("%c[WB] Creating CLASS: RewriterElement","color: blue;"),this.enableRewriter=this._enableRewriter,this.disableRewriter=this._disableRewriter}_enableRewriter(){this.getService(y).log("%c[WB] Calling FUNCTION: _enableLiveRewriter","color: green;");try{this.trackEvent(X.Events.Rewriter.ENABLE_REWRITER_TRIGGERED),this.getService(Bc).enableRewriter()}catch(o){this.getService(y).catch("Error in enableLiveRewriter: ",o)}}_disableRewriter(){this.getService(y).log("%c[WB] Calling FUNCTION: _disableRewriter","color: green;");try{this.trackEvent(X.Events.Rewriter.DISABLE_REWRITER_TRIGGERED),this.getService(Bc).disableRewriter()}catch(o){this.getService(y).catch("Error in disableRewriter: ",o)}}};var tRe=()=>({}),Fo=(()=>{let o=class o{constructor(){this.height=void 0,this.width=void 0,this.borderRadius=void 0,this.customClass=void 0,this.veltElement=!0}ngOnInit(){}};o.\u0275fac=function(t){return new(t||o)},o.\u0275cmp=O({type:o,selectors:[["velt-skeleton-loader-internal"]],hostVars:1,hostBindings:function(t,r){t&2&&x("data-velt-element",r.veltElement)},inputs:{height:"height",width:"width",borderRadius:"borderRadius",customClass:"customClass",customStyles:"customStyles"},standalone:!1,decls:2,vars:11,consts:[[1,"skeleton-loader",3,"ngStyle"]],template:function(t,r){t&1&&(_(0,"div",0),ee(1),b()),t&2&&(Qo(r.customClass),it("--velt-skeleton-loader-height",r.height||"100%")("--velt-skeleton-loader-width",r.width||"100%")("--velt-skeleton-loader-border-radius",r.borderRadius||"inherit"),c("ngStyle",r.customStyles||Ot(10,tRe)),m(),Ce(" ","\u200E ",`
|
|
404
|
-
`))},dependencies:[_m],styles:["[_nghost-%COMP%]{display:inline-flex;align-items:center}.skeleton-loader[_ngcontent-%COMP%]{display:inline-block;background:linear-gradient(-90deg,#f0f0f0,#e2e2e2,#f0f0f0);background-size:400% 400%;animation:_ngcontent-%COMP%_skeleton-loading 1.2s ease-in-out 4;height:var(--velt-skeleton-loader-height);width:var(--velt-skeleton-loader-width);border-radius:var(--velt-skeleton-loader-border-radius)}@keyframes _ngcontent-%COMP%_skeleton-loading{0%{background-position:100% 0}to{background-position:-100% 0}}"]});let i=o;return i})();var nRe=["userAvatarRef"],iRe=["*"];function oRe(i,o){if(i&1&&(_(0,"div",7),w(1,"span",8),b()),i&2){let n=l(2).ngIf,e=l();it("background-color",n.background||"#625DF5"),x("data-testid",e.componentId+"-initial-container"),m(),it("color",n.textColor||"#FFFFFF"),x("data-modal-author-initial",n.initial)("data-testid",e.componentId+"-initial")}}function rRe(i,o){if(i&1){let n=q();_(0,"img",9),z("error",function(){N(n);let t=l(3);return F(t.onImageLoadError())})("load",function(){N(n);let t=l(3);return F(t.onImageLoaded())}),b()}if(i&2){let n=l(2).ngIf,e=l();it("display",n.imgLoaded?"":"none !important"),c("src",n.src,mn),x("alt","User avatar")("data-testid",e.componentId+"-image")}}function aRe(i,o){if(i&1&&(f(0),_(1,"div",4,1),g(3,oRe,2,7,"div",5)(4,rRe,1,5,"ng-template",6),Nt(5),b(),v()),i&2){let n=l().ngIf,e=l();m(),x("data-testid",e.componentId+"-container")("aria-label","User avatar"),m(2),c("ngIf",!n.imgLoaded),m(),c("ngIf",!n.imgLoadError)}}function sRe(i,o){if(i&1&&w(0,"velt-skeleton-loader-internal",10),i&2){let n=l().ngIf;c("height",n.size?n.size+"px":"100%")("width",n.size?n.size+"px":"100%")}}function lRe(i,o){if(i&1&&(f(0),g(1,aRe,6,4,"ng-container",3)(2,sRe,1,2,"ng-template",null,0,Ee),v()),i&2){let n=o.ngIf,e=ce(3);m(),c("ngIf",n.imgLoaded||(n==null||n.user==null?null:n.user.photoUrl)||(n==null||n.user==null?null:n.user.name)||(n==null||n.user==null?null:n.user.email)||(n==null?null:n.initial))("ngIfElse",e)}}var Wn=(()=>{let o=class o{constructor(e,t,r){this.authService=e,this.loggingService=t,this.elementRef=r,this.initial="",this.background="#625DF5",this.textColor="#FFFFFF",this.userAvatarRef=new R(null),this.componentConfigSignal=xe({background:"#625DF5",textColor:"#FFFFFF",initial:"",src:"",imgLoaded:!1,imgLoadError:!1}),this.veltElement=!0,this.componentId="velt-user-avatar"}ngOnInit(){try{this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in UserAvatarComponent ngOnInit:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("role","img"),e.setAttribute("data-testid",this.componentId+"-container"),this.updateAriaLabel()}catch(e){this.loggingService.catch("Error in UserAvatarComponent setupA11yAttributes:",e)}}updateAriaLabel(){try{this.elementRef.nativeElement.setAttribute("aria-label","User avatar")}catch(e){this.loggingService.catch("Error in UserAvatarComponent updateAriaLabel:",e)}}ngAfterViewInit(){this.updateAvatarSize()}ngOnChanges(e){try{if(e&&Object.keys(e).forEach(t=>{this.componentConfigSignal.update(r=>(r=T(I({},r),{[t]:e[t].currentValue}),r))}),e?.user){let t=e.user.currentValue;t?.photoUrl!==this.componentConfigSignal().src&&this.componentConfigSignal.update(r=>(r=T(I({},r),{src:t?.photoUrl,imgLoaded:!1,imgLoadError:!1}),r)),this.componentConfigSignal.update(r=>(r=T(I({},r),{background:t?.color||this.authService.getUserAvatarColor(t?.userId)}),r)),this.componentConfigSignal.update(r=>(r=T(I({},r),{textColor:t?.textColor||this.authService.getUserTextColor(t?.userId)}),r)),this.componentConfigSignal.update(r=>(r=T(I({},r),{initial:t?.initial||t?.name?.charAt(0)||t?.email?.charAt(0)}),r))}e?.size&&this.updateAvatarSize(),e?.width&&this.updateAvatarSize(),e?.height&&this.updateAvatarSize()}catch(t){this.loggingService.catch("Error in UserAvatarComponent ngOnChanges: ",t)}}onImageLoadError(){try{this.componentConfigSignal.update(e=>(e=T(I({},e),{imgLoadError:!0}),e))}catch(e){this.loggingService.catch("Error in UserAvatarComponent onImageLoadError: ",e)}}onImageLoaded(){try{this.componentConfigSignal.update(e=>(e=T(I({},e),{imgLoaded:!0}),e))}catch(e){this.loggingService.catch("Error in UserAvatarComponent onImageLoaded: ",e)}}updateAvatarSize(){try{this.elementRef?.nativeElement&&(this.size&&(this.elementRef.nativeElement.style.setProperty("--legacy-velt-user-avatar-height",this.size+"px"),this.elementRef.nativeElement.style.setProperty("--legacy-velt-user-avatar-width",this.size+"px")),this.width&&this.elementRef.nativeElement.style.setProperty("--legacy-velt-user-avatar-width",this.size+"px"),this.height&&this.elementRef.nativeElement.style.setProperty("--legacy-velt-user-avatar-height",this.size+"px"))}catch(e){this.loggingService.catch("Error in UserAvatarComponent updateAvatarSize: ",e)}}};o.\u0275fac=function(t){return new(t||o)(h(je),h(y),h(R))},o.\u0275cmp=O({type:o,selectors:[["snippyly-user-avatar"]],viewQuery:function(t,r){if(t&1&&nt(nRe,5),t&2){let a;Xe(a=Qe())&&(r.userAvatarRef=a.first)}},hostVars:1,hostBindings:function(t,r){t&2&&x("data-velt-element",r.veltElement)},inputs:{initial:"initial",src:"src",background:"background",textColor:"textColor",size:"size",width:"width",height:"height",user:"user"},standalone:!1,features:[Ze],ngContentSelectors:iRe,decls:1,vars:1,consts:[["loadingTemplateRef",""],["userAvatarRef",""],[4,"ngIf"],[4,"ngIf","ngIfElse"],["velt-ignore-change-detection","true","role","img",1,"s-user-avatar-container","velt-user-avatar"],["class","s-user-avatar-initial-container velt-user-avatar--initial-container","aria-hidden","componentConfig.imgLoaded",3,"background-color",4,"ngIf"],[3,"ngIf"],["aria-hidden","componentConfig.imgLoaded",1,"s-user-avatar-initial-container","velt-user-avatar--initial-container"],[1,"s-user-avatar-initial","velt-user-avatar--initial"],["referrerpolicy","no-referrer","velt-ignore-change-detection","true",1,"s-user-avatar-image","velt-user-avatar--image",3,"error","load","src"],["borderRadius","100%",3,"height","width"]],template:function(t,r){t&1&&(Bt(),g(0,lRe,4,2,"ng-container",2)),t&2&&c("ngIf",r.componentConfigSignal())},dependencies:[Z,Fo],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}[_nghost-%COMP%]:empty{display:none}*[_ngcontent-%COMP%]{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;color:#000;font-size:calc((1rem + 0px) * var(--velt-base-rem-unit));position:static}*[_ngcontent-%COMP%]:empty{display:revert}.s-user-avatar-container[_ngcontent-%COMP%]{position:relative;width:calc((var(--legacy-velt-user-avatar-size) + 0px) * var(--velt-base-rem-unit));height:calc((var(--legacy-velt-user-avatar-size) + 0px) * var(--velt-base-rem-unit));border-radius:50%;display:inline-block}velt-skeleton-loader-internal[_ngcontent-%COMP%]{width:calc((var(--legacy-velt-user-avatar-size) + 0px) * var(--velt-base-rem-unit));height:calc((var(--legacy-velt-user-avatar-size) + 0px) * var(--velt-base-rem-unit));border-radius:50%}.s-user-avatar-initial-container[_ngcontent-%COMP%]{width:100%;height:100%;display:flex;justify-content:center;border-radius:50%;align-items:center;font-size:calc((.8rem + 0px) * var(--velt-base-rem-unit))}.s-user-avatar-image[_ngcontent-%COMP%]{object-fit:cover;border-radius:50%;width:100%;height:100%;display:flex}.s-user-avatar-initial[_ngcontent-%COMP%]{color:#fff;font-size:calc((var(--legacy-velt-user-avatar-initial-font-size) + 0px) * var(--velt-base-rem-unit));position:relative;text-transform:uppercase}.s-user-avatar-initial[_ngcontent-%COMP%]:after{content:attr(data-modal-author-initial);position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.velt-user-avatar[_ngcontent-%COMP%], velt-skeleton-loader-internal[_ngcontent-%COMP%]{height:var(--legacy-velt-user-avatar-height, calc((var(--legacy-velt-user-avatar-size) + 0px) * var(--velt-base-rem-unit)));width:var(--legacy-velt-user-avatar-width, calc((var(--legacy-velt-user-avatar-size) + 0px) * var(--velt-base-rem-unit)))}"],changeDetection:0});let i=o;return i})();var cRe=["selectionElementPortalOverlay"],dRe=i=>[i];function mRe(i,o){if(i&1&&(f(0),_(1,"span",10),ee(2),P(3,"translate"),b(),v()),i&2){let n=l(),e=n.$implicit,t=n.index,r=l(5);m(),it("--velt-selection-color",e==null||e.user==null?null:e.user.color),x("data-testid",r.componentId+"-user-name-"+t),m(),ze(M(3,4,(e==null||e.user==null?null:e.user.name)||(e==null||e.user==null?null:e.user.email)))}}function pRe(i,o){if(i&1&&(f(0),g(1,mRe,4,6,"ng-container",3),v()),i&2){let n=o.index,e=l(5);m(),c("ngIf",n<e.maxCount)}}function gRe(i,o){if(i&1&&(_(0,"span",11),ee(1),b()),i&2){let n=l(4).ngIf,e=l();it("--velt-selection-color",(n.selections[0]==null||n.selections[0].user==null?null:n.selections[0].user.color)||"white"),x("data-testid",e.componentId+"-additional-count")("aria-label",(n.selections==null?null:n.selections.length)-e.maxCount+" additional users"),m(),Ce("+",(n.selections==null?null:n.selections.length)-e.maxCount,"")}}function uRe(i,o){if(i&1&&(f(0),_(1,"div",7),P(2,"translate"),g(3,pRe,2,1,"ng-container",8)(4,gRe,2,5,"span",9),b(),v()),i&2){let n=l(3).ngIf,e=l();m(),x("data-testid",e.componentId+"-label-container")("aria-label",M(2,4,"Selected users")),m(2),c("ngForOf",n.selections),m(),c("ngIf",(n.selections==null?null:n.selections.length)>e.maxCount)}}function hRe(i,o){if(i&1&&(f(0),w(1,"snippyly-user-avatar",13),v()),i&2){let n=l(),e=n.$implicit,t=n.index;m(),it("--velt-selection-color",e==null||e.user==null?null:e.user.color)("--velt-selection-user-index",t),c("size",20)("user",e==null?null:e.user)}}function fRe(i,o){if(i&1&&(f(0),g(1,hRe,2,6,"ng-container",3),v()),i&2){let n=o.index,e=l(5);m(),c("ngIf",n<e.maxCount)}}function vRe(i,o){if(i&1&&(_(0,"div",14),P(1,"translate"),_(2,"span",15),ee(3),b()()),i&2){let n=l(4).ngIf,e=l();it("--velt-selection-user-index",n.selections==null?null:n.selections.length)("background-color",(n.selections[(n.selections==null?null:n.selections.length)-1]==null||n.selections[(n.selections==null?null:n.selections.length)-1].user==null?null:n.selections[(n.selections==null?null:n.selections.length)-1].user.color)||"white"),x("data-testid",e.componentId+"-additional-avatars")("aria-label",(n.selections==null?null:n.selections.length)-e.maxCount+" "+M(1,7,"additional users")),m(3),Ce("+",(n.selections==null?null:n.selections.length)-e.maxCount,"")}}function CRe(i,o){if(i&1&&g(0,fRe,2,1,"ng-container",8)(1,vRe,4,9,"div",12),i&2){let n=l(3).ngIf,e=l();c("ngForOf",n.selections),m(),c("ngIf",(n.selections==null?null:n.selections.length)>e.maxCount)}}function _Re(i,o){if(i&1&&g(0,uRe,5,6,"ng-container",6)(1,CRe,2,2,"ng-template",null,2,Ee),i&2){let n=ce(2),e=l(2).ngIf,t=l();c("ngIf",(e==null?null:e.userIndicatorType)===(t.userIndicatorTypes==null?null:t.userIndicatorTypes.Label))("ngIfElse",n)}}function yRe(i,o){if(i&1&&(f(0),w(1,"div",4,0),g(3,_Re,3,2,"ng-template",5,1,Ee),v()),i&2){let n=ce(2),e=l().ngIf,t=l();m(),it("top",(e==null||e.position==null?null:e.position.top)+t.offsetTop,"px")("left",(e==null||e.position==null?null:e.position.left)+t.offsetLeft,"px"),c("id","selection-element-contianer-"+(t.highlight.user==null?null:t.highlight.user.userSnippylyId)),x("data-testid",t.componentId),m(2),c("cdkConnectedOverlayOrigin",n)("cdkConnectedOverlayOpen",!0)("cdkConnectedOverlayLockPosition",!1)("cdkConnectedOverlayGrowAfterOpen",!0)("cdkConnectedOverlayDisableClose",!0)("cdkConnectedOverlayPositions",A(12,dRe,e==null?null:e.overlayPosition))}}function SRe(i,o){if(i&1&&(f(0),g(1,yRe,5,14,"ng-container",3),v()),i&2){let n=o.ngIf;m(),c("ngIf",n==null?null:n.position)}}var Gce=(()=>{let o=class o{get highlight(){return this._highlight}set highlight(e){this._highlight=e,this.calculatePosition()}constructor(e,t,r){this.loggingService=e,this.selectionService=t,this.elementRef=r,this._highlight=new Xp,this.position=null,this.userIndicatorTypes=s0,this.offsetLeft=0,this.offsetTop=0,this.maxCount=1,this.componentConfigSignal=xe({userIndicatorPosition:hb.End,userIndicatorType:s0.Avatar,position:null,overlayPosition:{originX:"end",originY:"top",overlayX:"end",overlayY:"top"},selections:[]}),this.veltElement=!0,this.componentId="velt-selection-element";try{this.loggingService.log("%c[WB] Creating CLASS: SelectionElementPortalComponent","color: blue;");let a=this.selectionService.getUserIndicatorPosition(),s=this.selectionService.getUserIndicatorType();this.componentConfigSignal.update(d=>(d=T(I({},d),{userIndicatorPosition:a,userIndicatorType:s}),d)),this.setOverlayPosition(a)}catch(a){this.loggingService.log("Error in SelectionElementPortalComponent constructor: ",a)}}ngOnInit(){try{this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in SelectionElementPortalComponent ngOnInit:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","complementary"),e.setAttribute("aria-label","Selection portal")}catch(e){this.loggingService.catch("Error in SelectionElementPortalComponent setupA11yAttributes:",e)}}setSelections(e){try{this.componentConfigSignal.update(t=>(t=T(I({},t),{selections:e}),t))}catch(t){this.loggingService.catch("Error in SelectionElementPortalComponent setSelections: ",t)}}addSelection(e){try{this.componentConfigSignal.update(t=>(t=I({},t),t.selections.push(e),t))}catch(t){this.loggingService.catch("Error in SelectionElementPortalComponent addSelection: ",t)}}ngAfterViewInit(){try{this.loggingService.log("%c[WB] Calling SelectionElementPortalComponent FUNCTION: ngAfterViewInit","color: green;"),this.updateOverlayPosition()}catch(e){this.loggingService.catch("Error in ngAfterViewInit: ",e)}}setOverlayPosition(e){try{switch(this.loggingService.log("%c[WB] Calling SelectionElementPortalComponent FUNCTION: setOverlayPosition","color: green;"),e){case"start":this.componentConfigSignal.update(t=>(t=T(I({},t),{overlayPosition:{originX:"start",originY:"top",overlayX:"start",overlayY:"top"}}),t));break;default:this.componentConfigSignal.update(t=>(t=T(I({},t),{overlayPosition:{originX:"end",originY:"top",overlayX:"end",overlayY:"top"}}),t))}this.updateOverlayPosition()}catch(t){this.loggingService.catch("Error in SelectionElementPortalComponent setOverlayPosition: ",t)}}updateOverlayPosition(){try{this.loggingService.log("%c[WB] Calling SelectionElementPortalComponent FUNCTION: updateOverlayPosition","color: green;"),this.selectionElementPortalOverlay&&this.selectionElementPortalOverlay?.overlayRef?.updatePosition()}catch(e){this.loggingService.catch("Error in SelectionElementPortalComponent updateOverlayPosition: ",e)}}calculatePosition(){try{if(this.loggingService.log("%c[WB] Calling SelectionElementPortalComponent FUNCTION: calculatePosition","color: green;"),this.highlight?.targetElement){let e=NS(this.highlight.targetElement);if(e){let t=e.iterateNext(),r,a=null,s=null;try{r=JSON.parse(t?.getAttribute(j.ATTRIBUTES.VELT_SELECTION_CONFIG)||"{}"),a=t?.getAttribute(j.ATTRIBUTES.VELT_LIVE_SELECTION_USER_INDICATOR_POSITION)||this.componentConfigSignal().userIndicatorPosition,a&&this.setOverlayPosition(a),s=t?.getAttribute(j.ATTRIBUTES.VELT_LIVE_SELECTION_USER_INDICATOR_TYPE)||this.componentConfigSignal().userIndicatorType,this.componentConfigSignal.update(p=>(p=T(I({},p),{userIndicatorPosition:a,userIndicatorType:s}),p))}catch{}let d;if(r?.horizontal&&(d=r.horizontal),a==="start"?d="top-start":d="top-right",t){let p=t.getBoundingClientRect();if(p&&p.width&&p.height)switch(d){case"left":this.position={top:p.height/2-16,left:-4};break;case"left-start":this.position={top:0,left:-4};break;case"top-start":this.position={top:-32,left:0};break;case"top-right":this.position={top:-32,left:p.width};break;case"bottom-left":this.position={top:p.height+4,left:0};break;case"bottom-right":this.position={top:p.height+4,left:p.width-32};break;case"center-left":this.position={top:p.height/2-16,left:-32};break;case"center-right":this.position={top:p.height/2-16,left:p.width+4};break;default:this.position={top:-32,left:p.width}}else this.position=null}else this.position=null}else this.position=null}this.componentConfigSignal.update(e=>(e=T(I({},e),{position:this.position}),e))}catch(e){this.loggingService.catch("Error in SelectionElementPortalComponent calculatePosition: ",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(Os),h(R))},o.\u0275cmp=O({type:o,selectors:[["app-selection-element-portal"]],viewQuery:function(t,r){if(t&1&&nt(cRe,5),t&2){let a;Xe(a=Qe())&&(r.selectionElementPortalOverlay=a.first)}},hostVars:1,hostBindings:function(t,r){t&2&&x("data-velt-element",r.veltElement)},inputs:{highlight:"highlight",offsetLeft:"offsetLeft",offsetTop:"offsetTop"},standalone:!1,decls:1,vars:1,consts:[["trigger","cdkOverlayOrigin"],["selectionElementPortalOverlay","cdkConnectedOverlay"],["defaultAvatarTypeTemplate",""],[4,"ngIf"],["cdkOverlayOrigin","","role","presentation",1,"selection-element-portal",3,"id"],["cdkConnectedOverlay","",3,"cdkConnectedOverlayOrigin","cdkConnectedOverlayOpen","cdkConnectedOverlayLockPosition","cdkConnectedOverlayGrowAfterOpen","cdkConnectedOverlayDisableClose","cdkConnectedOverlayPositions"],[4,"ngIf","ngIfElse"],["role","list",1,"velt-live-selection-element-user-name-container"],[4,"ngFor","ngForOf"],["class","velt-live-selection-element-user-name-plus","role","listitem",3,"--velt-selection-color",4,"ngIf"],["role","listitem",1,"velt-live-selection-element-user-name"],["role","listitem",1,"velt-live-selection-element-user-name-plus"],["class","photo-container","role","listitem",3,"--velt-selection-user-index","background-color",4,"ngIf"],[1,"photo-container","selection-user-avatar",3,"size","user"],["role","listitem",1,"photo-container"],[1,"s-selection-element-avatar-initial"]],template:function(t,r){t&1&&g(0,SRe,2,1,"ng-container",3),t&2&&c("ngIf",r.componentConfigSignal())},dependencies:[ft,Z,nn,en,Wn,pe],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);position:absolute;top:0;left:0;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}*[_ngcontent-%COMP%]{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;color:#000;font-size:calc((1rem + 0px) * var(--velt-base-rem-unit))}*[_ngcontent-%COMP%]:empty{display:revert}.selection-element-portal[_ngcontent-%COMP%]{display:none;position:absolute;top:0;left:0;white-space:nowrap;z-index:1;font-size:var(--velt-font-size-xs)}.photo-container[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;width:calc((1.5rem + 0px) * var(--velt-base-rem-unit));height:calc((1.5rem + 0px) * var(--velt-base-rem-unit));box-sizing:border-box;background-clip:padding-box;border-radius:50%;color:var(--velt-light-mode-white);border:2px solid var(--velt-selection-color);margin-left:-5px;z-index:calc(var(--velt-selection-user-index, 0) * -1)}.photo-container[_ngcontent-%COMP%] .s-selection-element-avatar-initial[_ngcontent-%COMP%]{color:var(--velt-light-mode-white)}.photo-container[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%;border-radius:50%;object-fit:cover} snippyly-user-avatar.selection-user-avatar .s-user-avatar-initial{font-size:var(--velt-font-size-md)}.velt-live-selection-element-user-name-container[_ngcontent-%COMP%]{display:flex;gap:var(--velt-spacing-xs);margin-top:5px}.velt-live-selection-element-user-name-container[_ngcontent-%COMP%] .velt-live-selection-element-user-name[_ngcontent-%COMP%]{color:var(--velt-light-mode-white);display:flex;background:var(--velt-selection-color);padding:var(--velt-spacing-xs) var(--velt-spacing-sm);font-size:var(--velt-spacing-md);font-style:normal;font-weight:400;line-height:100%;border-radius:var(--velt-border-radius-md);font-family:var(--velt-default-font-family)}.velt-live-selection-element-user-name-container[_ngcontent-%COMP%] .velt-live-selection-element-user-name-plus[_ngcontent-%COMP%]{color:var(--velt-light-mode-white);display:flex;background:var(--velt-selection-color);padding:var(--velt-spacing-x);font-size:var(--velt-font-size-xs);font-style:normal;font-weight:400;line-height:100%;border-radius:var(--velt-border-radius-md);font-family:var(--velt-default-font-family)}"],changeDetection:0});let i=o;return i})();var v0=(i,o)=>{try{let n=IRe(i),e=[],t=[];return n.forEach(r=>{r?.parentElement?.closest(j.TAGS.SNIPPYLY_TEXT_HIGHLIGHT)?r?.parentElement?.normalize():t.push(r)}),t.forEach(r=>{let a=ERe(r,o);a&&e.push(a)}),e}catch(n){return mt.catch("Error in highlighter highlightRange: ",n),[]}},IRe=i=>{try{if(i.collapsed)return[];let o=i.commonAncestorContainer;if(i.commonAncestorContainer.nodeType!==Node.ELEMENT_NODE&&(o=i.commonAncestorContainer.parentElement),!o)return[];let n=[],e=o.ownerDocument.createNodeIterator(o,NodeFilter.SHOW_TEXT),t,r=!1;for(;t=e.nextNode();)if(i.intersectsNode(t)){let a=t?.length;i.startContainer===t&&i.startOffset>0&&(t.splitText(i.startOffset),r=!0),i.endContainer===t&&i.endOffset<a&&t.splitText(i.endOffset),n.push(t)}return r&&n.shift(),n}catch(o){return mt.catch("Error in highlighter getTextNodesInRange: ",o),[]}},ERe=(i,o)=>{try{let n=document.createElement(o||j.TAGS.SNIPPYLY_TEXT_HIGHLIGHT);return i.parentElement?.replaceChild(n,i),n.appendChild(i),n}catch(n){return mt.catch("Error in highlighter highlightNode: ",n),null}};var Os=(()=>{let o=class o{constructor(e,t,r,a,s,d,p,u,C,E,D){this.afAuth=e,this.authService=t,this.configService=r,this.databaseService=a,this.docService=s,this.domService=d,this.componentFactoryResolver=p,this.injector=u,this.appRef=C,this.loggingService=E,this.commonDbService=D,this.documentPaths=null,this.textSelections={},this.enableSelections$=new ve(!1),this.userIndicatorEnabled$=new ve(!0),this.userIndicatorPosition$=new ve(hb.End),this.userIndicatorType$=new ve(s0.Avatar),this.defaultElementsTrackingEnabled$=new ve(!0),this.defaultStylingEnabled$=new ve(!0),this.elementSelections={},this.databaseService.getDb().pipe(Le(L=>!!L),rt(1)).subscribe(L=>{L&&this.updateOnDocumentFocusChange()},L=>{this.loggingService.catch("Error in SelectionService getDb subscription: ",L)}),this.docService.getDocumentPaths$().subscribe(L=>{this.documentPaths=L},L=>{this.loggingService.catch("Error in SelectionService getDocumentPaths subscription: ",L)}),this.domService.onDocumentClick$().subscribe(L=>{try{if(this.enableSelections$.value&&this.isFeatureAllowed()&&L?.target&&!window.getSelection()?.toString()){let G=this.getSelectionEnabledElement(L.target);if(G&&!qi(G)){let Y=this.domService.getXPath(G);if(Y){let ne=new Xp;ne.type="click",ne.targetElement=Y,this.setSelection(ne)}}else this.removeSelection()}}catch(G){this.loggingService.catch("Error in SelectionService onDocumentClick$: ",G)}},L=>{this.loggingService.catch("Error in SelectionService onDocumentClick$ subscription: ",L)}),this.domService.onDocumentFocus$().subscribe(L=>{try{if(this.enableSelections$.value&&this.isFeatureAllowed()&&L?.target){let G=this.getSelectionEnabledElement(L.target);if(G&&!qi(G)){let Y=this.domService.getXPath(G);if(Y){let ne=new Xp;ne.type="focus",ne.targetElement=Y,this.setSelection(ne)}}else this.removeSelection()}}catch(G){this.loggingService.catch("Error in SelectionService onDocumentFocus$: ",G)}},L=>{this.loggingService.catch("Error in SelectionService onDocumentFocus$ subscription: ",L)}),this.domService.onWindowKeyupEsc$().subscribe(L=>{this.removeSelection()},L=>{this.loggingService.catch("Error in SelectionService onWindowKeyupEsc$ subscription: ",L)}),this.enableSelections$.pipe(he(()=>this.isFeatureAllowed$({})),Le(L=>L?.config&&L?.user)).subscribe(L=>{(!L?.featureAllowed||!this.enableSelections$.value)&&this.removeSelection()},L=>{this.loggingService.catch("Error in SelectionService enableSelections$ subscription: ",L)}),this.domService.onSelectionChange$().subscribe(()=>{try{if(this.enableSelections$.value&&this.isFeatureAllowed()&&window.getSelection()?.toString()){let L=window.getSelection()?.getRangeAt(0);if(L.commonAncestorContainer&&!L?.collapsed){let G=zre([L]),Y=new Xp;Y.type="selection",Y.targetTextRange=G?.length?G[0]:null,this.setSelection(Y)}}}catch(L){this.loggingService.catch("Error in SelectionService onSelectionChange$: ",L)}},L=>{this.loggingService.catch("Error in SelectionService onSelectionChange$ subscription: ",L)}),this.authService.getUser$().subscribe(L=>{this.user=L},L=>{this.loggingService.catch("Error in SelectionService getUser$ subscription: ",L)}),this.getSelectionsOnCurrentDocument().pipe(Ri()).subscribe(([L,G])=>{try{if(L){let Y=[];Object.keys(L).forEach(ne=>{let ge=L[ne],ye=G?G[ne]:null;!zi(ge,ye)&&ne!==this.getUserIdHash(this.user)&&Y.push(ge)}),Y.forEach(ne=>{if(ne.targetElement){let ge=this.elementSelections[ne?.targetElement]?.portalRef,Re=(this.elementSelections[ne?.targetElement]?.selections||[]).filter(Ge=>this.getUserIdHash(Ge.user)!==this.getUserIdHash(ne?.user));Re?.length?(ge.instance.setSelections(Re.slice()),this.elementSelections[ne?.targetElement].selections=Re.slice(),this.highlightElement(Re[0])):(this.removeHighlightFromElement(ne),this.removeSelectionElement(ne))}else ne.targetTextRange&&this.removeHighlightFromText(ne)})}if(G){let Y=[];Object.keys(G).forEach(ne=>{let ge=L?L[ne]:null,ye=G[ne];!zi(ge,ye)&&ne!==this.getUserIdHash(this.user)&&Y.push(ye)}),Y.forEach(ne=>{ne.targetElement?(this.highlightElement(ne),this.getUserIndicatorEnabled()&&this.setElementHighlight(ne)):ne.targetTextRange&&this.highlightText(ne)})}}catch(Y){this.loggingService.catch("Error in SelectionService getSelectionsOnCurrentDocument: ",Y)}},L=>{this.loggingService.catch("Error in SelectionService getSelectionsOnCurrentDocument subscription: ",L)}),this.authService.addPreSignOutFuction("highlight-signout",this.signOutUser.bind(this))}isFeatureAllowed(){return no(this.configService.getConfig(),this.authService.getUser(),Ne.LIVE_SELECTION)}updateOnDocumentFocusChange(){this.loggingService.log("%c[WB] Calling FUNCTION: updateOnDocumentFocusChange","color: green;");try{document&&document.addEventListener("visibilitychange",e=>{this.user&&document.visibilityState==="hidden"&&this.removeSelection()})}catch(e){this.loggingService.catch("Error in updateOnDocumentFocusChange:",e)}}getSelectionsOnCurrentDocument(){return this.loggingService.log("%c[WB] Calling FUNCTION: getSelectionsOnCurrentDocument","color: green;"),Qn(this.afAuth).pipe(Le(e=>!!e),he(e=>this.isFeatureAllowed$({firebaseUser:e})),he(e=>e.featureAllowed?se(e).pipe(he(t=>this.docService.getDocumentPaths$().pipe(de(r=>(this.documentPaths=r,t)))),he(t=>t?.user?t?.user?.isAnonymous?se(null):this.documentPaths?this.databaseService.getDb().pipe(Le(r=>!!r),he(r=>this.documentPaths?.selection?this.commonDbService.dbListener({feature:"allSelections",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}}).pipe(de(a=>a?.data)):se(null))):se(null):se(null))):se(null)))}isFeatureAllowed$(e){return this.configService.getConfig$().pipe(Le(t=>!!t),de(t=>T(I({},e),{config:t})),he(t=>this.authService.getUser$().pipe(de(r=>(this.user=r,T(I({},t),{user:r}))))),he(t=>no(t.config,t.user,Ne.LIVE_SELECTION)?se(T(I({},t),{featureAllowed:!0})):(this.loggingService.warn("Live Selection feature is not allowed."),se(T(I({},t),{featureAllowed:!1})))),kt((t,r)=>t?.featureAllowed===r?.featureAllowed))}setSelection(e){try{if(this.user?.userId&&this.documentPaths?.selection){e.user=this.user;let t=JSON.parse(JSON.stringify(e));this.commonDbService.updateData({feature:"selection",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,userId:this.getUserIdHash(this.user)??"",skipFirestore:!0},data:t})}}catch(t){this.loggingService.catch("Error in SelectionService setSelection: ",t)}}removeSelection(){try{this.user?.userId&&this.documentPaths?.selection&&this.commonDbService.deleteData({feature:"selection",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,userId:this.getUserIdHash(this.user)??"",skipFirestore:!0}})}catch(e){this.loggingService.catch("Error in SelectionService removeSelection: ",e)}}highlightElement(e){try{let t=this.domService.getXPath(e.targetElement);if(t){let r=t.iterateNext();if(r){let a=["input","textarea","select","button"],s;try{r?.getAttribute(j.ATTRIBUTES.VELT_SELECTION_CONFIG)&&(s=JSON.parse(r?.getAttribute(j.ATTRIBUTES.VELT_SELECTION_CONFIG)||"{}"))}catch{}(!s||s?.border)&&this.domService.highlightUserElement(r,e?.user?.color,e?.user?.name,this.getDefaultStylingEnabled())}}}catch(t){this.loggingService.catch("Error in SelectionService highlightElement: ",t)}}removeHighlightFromElement(e){try{let t=this.domService.getXPath(e.targetElement);if(t){let r=t.iterateNext();r&&this.domService.removeHighlightUserFromElement(r)}}catch(t){this.loggingService.catch("Error in SelectionService removeHighlightFromElement: ",t)}}highlightText(e){try{if(e?.targetTextRange){let t=bv(e.targetTextRange?.text,this.domService.getXPath(e.targetTextRange?.commonAncestorContainer).iterateNext(),e.targetTextRange?.occurrence),r=new Range;try{r.setStart(t[0].textNode,t[0].startOffset||0),r.setEnd(t[t.length-1].textNode,t[t.length-1].endOffset||0)}catch{}if(r.toString()===e.targetTextRange?.text){let a=v0(r,j.TAGS.SNIPPYLY_HIGHLIGHT_USER_TEXT),s=[],d=this.getSelectionUserMarker(e.user);if(a&&a.length&&(a.forEach(p=>{p?.textContent?.trim()&&(this.domService.addClassToElement(p,p.tagName?.toLowerCase()),this.domService.addClassToElement(p,j.VELT_LIVE_SELECTION_ON_TEXT),this.getDefaultStylingEnabled()&&this.domService.addClassToElement(p,j.VELT_LIVE_SELECTION_ON_TEXT_DEFAULT),e.user?.color&&p.style.setProperty(j.VELT_SELECTION_COLOR,e.user?.color+"55"),s.push({element:p,textNode:p.childNodes[0]}))}),d)){let p=a.filter(C=>C?.textContent?.trim()),u=p?.length?p[p?.length-1]:null;u&&u.parentNode.insertBefore(d,u.nextSibling)}this.textSelections[this.getUserIdHash(e?.user)]={textNodes:s,marker:d}}}}catch(t){this.loggingService.catch("Error in SelectionService highlightText: ",t)}}removeHighlightFromText(e){try{let t=this.getUserIdHash(e?.user);t&&this.textSelections[t]?.textNodes?.length&&(this.textSelections[t].textNodes.forEach(r=>{r?.element&&r?.textNode&&r.element.replaceWith(r.textNode),r.textNode&&r.textNode.parentNode?.normalize()}),this.textSelections[t]?.marker&&this.textSelections[t]?.marker?.remove())}catch(t){this.loggingService.catch("Error in SelectionService removeHighlightFromText: ",t)}}getSelectionUserMarker(e){try{let t=document.createElement("span");t.classList.add("snippyly-user-marker","active"),t.setAttribute("data-name",e?.name+""),t.style.setProperty("--velt-selection-marker-color",e?.color||"#000");let r=document.createElement("span");r.classList.add("snippyly-user-marker-line");let a=document.createElement("span");return a.classList.add("snippyly-user-marker-dot"),r.appendChild(a),t.appendChild(r),setTimeout(()=>{t?.classList?.remove("active")},1e3),t}catch(t){return this.loggingService.catch("Error in SelectionService getSelectionUserMarker: ",t),null}}signOutUser(e){return new Promise((t,r)=>{try{this.documentPaths?.selection&&e?this.commonDbService.getData({feature:"selection",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,userId:e.uid,skipFirestore:!0}}).then(a=>{a&&this.commonDbService.deleteData({feature:"selection",errorCallback:s=>{r(s)},callback:()=>{t(null)},properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,userId:this.getUserIdHash(this.user)??"",skipFirestore:!0}}),t(null)}).catch(a=>{this.loggingService.catch("Error in SelectionService signOutUser subscription: ",a),r(a)}):t(null)}catch(a){this.loggingService.catch("Error in SelectionService signOutUser:",a),r(a)}})}enableSelections(e){try{this.enableSelections$.next(e)}catch(t){this.loggingService.catch("Error in SelectionService enableSelections: ",t)}}enableUserIndicator(){try{if(this.userIndicatorEnabled$.value===!0)return;this.userIndicatorEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in SelectionService enableUserIndicator: ",e)}}disableUserIndicator(){try{if(this.userIndicatorEnabled$.value===!1)return;this.userIndicatorEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in SelectionService disableUserIndicator: ",e)}}getUserIndicatorEnabled$(){return this.userIndicatorEnabled$.asObservable()}getUserIndicatorEnabled(){return this.userIndicatorEnabled$.value}setUserIndicatorPosition(e){try{this.userIndicatorPosition$.next(e)}catch(t){this.loggingService.catch("Error in SelectionService setUserIndicatorPosition: ",t)}}getUserIndicatorPosition$(){return this.userIndicatorPosition$.asObservable()}getUserIndicatorPosition(){return this.userIndicatorPosition$.value}setUserIndicatorType(e){try{this.userIndicatorType$.next(e)}catch(t){this.loggingService.catch("Error in SelectionService setUserIndicatorType: ",t)}}getUserIndicatorType$(){return this.userIndicatorType$.asObservable()}getUserIndicatorType(){return this.userIndicatorType$.value}enableDefaultElementsTracking(){try{if(this.defaultElementsTrackingEnabled$.value===!0)return;this.defaultElementsTrackingEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in SelectionService enableDefaultElementsTracking: ",e)}}disableDefaultElementsTracking(){try{if(this.defaultElementsTrackingEnabled$.value===!1)return;this.defaultElementsTrackingEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in SelectionService disableDefaultElementsTracking: ",e)}}getDefaultElementsTrackingEnabled$(){return this.defaultElementsTrackingEnabled$.asObservable()}getDefaultElementsTrackingEnabled(){return this.defaultElementsTrackingEnabled$.value}enableDefaultStyling(){try{if(this.defaultStylingEnabled$.value===!0)return;this.defaultStylingEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in SelectionService enableDefaultStyling: ",e)}}disableDefaultStyling(){try{if(this.defaultStylingEnabled$.value===!1)return;this.defaultStylingEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in SelectionService disableDefaultStyling: ",e)}}getDefaultStylingEnabled$(){return this.defaultStylingEnabled$.asObservable()}getDefaultStylingEnabled(){return this.defaultStylingEnabled$.value}getSelectionEnabledElement(e){try{let t=this.getDefaultElementsTrackingEnabled();return t&&j.SELECTION_ENABLED_ELEMENTS[e.tagName?.toLowerCase()]?e:bj(e,t)}catch(t){return this.loggingService.catch("Error in SelectionService isElementAllowed: ",t),null}}setElementHighlight(e){try{if(!this.elementSelections[e.targetElement])this.setSelectionElement(e);else{let t=this.elementSelections[e.targetElement].portalRef;this.elementSelections[e.targetElement].selections?.find(a=>this.getUserIdHash(a.user)===this.getUserIdHash(e?.user))||(t.instance.addSelection(e),this.elementSelections[e.targetElement].selections.push(e))}}catch(t){this.loggingService.catch("Error in SelectionService setElementSelection: ",t)}}setSelectionElement(e){try{let t=this.domService.getXPath(e.targetElement);if(t){let r=t.iterateNext();if(r){let a=this.domService.getHostElement(r),s=new Bo(Gce),d=new Vo(a,this.componentFactoryResolver,this.appRef,this.injector),p=d.attach(s);p.instance.highlight=e,p.instance.setSelections([e]),this.elementSelections[e.targetElement]={selectionHostDomPortalOutlet:d,selectionElementPortal:s,portalRef:p,selections:[JSON.parse(JSON.stringify(e))],userTargetElement:r,selectionHostElement:a,targetElement:e.targetElement},this.updateElementOffset(e)}}}catch(t){this.loggingService.catch("Error in SelectionService setSelectionElement: ",t)}}updateElementOffset(e){try{let{portalRef:t,userTargetElement:r,selectionHostElement:a}=this.elementSelections[e.targetElement],s=this.domService.getElementOffset(r,a);t.instance.offsetLeft=s.offsetLeft,t.instance.offsetTop=s.offsetTop}catch(t){this.loggingService.catch("Error in SelectionService updateElementOffset: ",t)}}checkElementHighlightsToRemove(e){try{let t=e.map(r=>r.targetElement);Object.keys(this.elementSelections).forEach(r=>{if(!t.includes(r)){let a=this.elementSelections[r];a&&(a.selectionHostDomPortalOutlet.detach(),this.domService.removeHighlightFromElement(a.selectionHostElement)),delete this.elementSelections[r]}})}catch(t){this.loggingService.catch("Error in SelectionService checkElementHighlightsToRemove: ",t)}}removeSelectionElement(e){try{let t=this.elementSelections[e.targetElement];t&&(t.selectionHostDomPortalOutlet.detach(),this.domService.removeHighlightFromElement(t.selectionHostElement)),delete this.elementSelections[e.targetElement]}catch(t){this.loggingService.catch("Error in SelectionService removeSelectionElement: ",t)}}getUserIdHash(e){try{return e?.userId?_t(e?.userId):null}catch(t){return this.loggingService.catch("Error in SelectionService getUserIdHash: ",t),null}}};o.\u0275fac=function(t){return new(t||o)(J(Ei),J(je),J(Vt),J(_n),J(at),J(Fe),J(Eo),J(xt),J(fi),J(y),J(yn))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Xk=class extends ri{constructor(o){super(o),this.getService(y).log("%c[WB] Creating CLASS: SelectionElement","color: blue;"),this.enableLiveSelection=this._enableLiveSelection,this.disableLiveSelection=this._disableLiveSelection,this.enableUserIndicator=this._enableUserIndicator,this.disableUserIndicator=this._disableUserIndicator,this.setUserIndicatorPosition=this._setUserIndicatorPosition,this.setUserIndicatorType=this._setUserIndicatorType,this.enableDefaultElementsTracking=this._enableDefaultElementsTracking,this.disableDefaultElementsTracking=this._disableDefaultElementsTracking,this.enableDefaultStyling=this._enableDefaultStyling,this.disableDefaultStyling=this._disableDefaultStyling,this.getLiveSelectionData=this._getLiveSelectionData}_enableLiveSelection(){this.getService(y).log("%c[WB] Calling FUNCTION: _enableLiveSelection","color: green;");try{this.trackEvent(X.Events.Selection.ENABLE_LIVE_SELECTION_TRIGGERED),this.getService(Os).enableSelections(!0)}catch(o){this.getService(y).catch("Error in enableLiveSelection: ",o)}}_disableLiveSelection(){this.getService(y).log("%c[WB] Calling FUNCTION: _disableLiveSelection","color: green;");try{this.trackEvent(X.Events.Selection.DISABLE_LIVE_SELECTION_TRIGGERED),this.getService(Os).enableSelections(!1)}catch(o){this.getService(y).catch("Error in disableLiveSelection: ",o)}}_enableUserIndicator(){this.getService(y).log("%c[WB] Calling FUNCTION: enableUserIndicator","color: green;");try{this.trackEvent(X.Events.Selection.ENABLE_USER_INDICATOR_TRIGGERED),this.getService(Os).enableUserIndicator()}catch(o){this.getService(y).catch("Error in _enableUserIndicator: ",o)}}_disableUserIndicator(){this.getService(y).log("%c[WB] Calling FUNCTION: disableUserIndicator","color: green;");try{this.trackEvent(X.Events.Selection.DISABLE_USER_INDICATOR_TRIGGERED),this.getService(Os).disableUserIndicator()}catch(o){this.getService(y).catch("Error in _disableUserIndicator: ",o)}}_setUserIndicatorPosition(o){this.getService(y).log("%c[WB] Calling FUNCTION: setUserIndicatorPosition","color: green;");try{this.trackEvent(X.Events.Selection.SET_USER_INDICATOR_POSITION_TRIGGERED,{payload:{position:o}}),this.getService(Os).setUserIndicatorPosition(o)}catch(n){this.getService(y).catch("Error in _setUserIndicatorPosition: ",n)}}_setUserIndicatorType(o){this.getService(y).log("%c[WB] Calling FUNCTION: setUserIndicatorType","color: green;");try{this.trackEvent(X.Events.Selection.SET_USER_INDICATOR_TYPE_TRIGGERED,{payload:{type:o}}),this.getService(Os).setUserIndicatorType(o)}catch(n){this.getService(y).catch("Error in _setUserIndicatorType: ",n)}}_enableDefaultElementsTracking(){this.getService(y).log("%c[WB] Calling FUNCTION: enableDefaultElementsTracking","color: green;");try{this.trackEvent(X.Events.Selection.ENABLE_DEFAULT_ELEMENTS_TRACKING_TRIGGERED),this.getService(Os).enableDefaultElementsTracking()}catch(o){this.getService(y).catch("Error in _enableDefaultElementsTracking: ",o)}}_disableDefaultElementsTracking(){this.getService(y).log("%c[WB] Calling FUNCTION: disableDefaultElementsTracking","color: green;");try{this.trackEvent(X.Events.Selection.DISABLE_DEFAULT_ELEMENTS_TRACKING_TRIGGERED),this.getService(Os).disableDefaultElementsTracking()}catch(o){this.getService(y).catch("Error in _disableDefaultElementsTracking: ",o)}}_enableDefaultStyling(){this.getService(y).log("%c[WB] Calling FUNCTION: enableDefaultStyling","color: green;");try{this.trackEvent(X.Events.Selection.ENABLE_DEFAULT_STYLING_TRIGGERED),this.getService(Os).enableDefaultStyling()}catch(o){this.getService(y).catch("Error in _enableDefaultStyling: ",o)}}_disableDefaultStyling(){this.getService(y).log("%c[WB] Calling FUNCTION: disableDefaultStyling","color: green;");try{this.trackEvent(X.Events.Selection.DISABLE_DEFAULT_STYLING_TRIGGERED),this.getService(Os).disableDefaultStyling()}catch(o){this.getService(y).catch("Error in _disableDefaultStyling: ",o)}}_getLiveSelectionData(){this.getService(y).log("%c[WB] Calling FUNCTION: getLiveSelectionData","color: green;");try{return this.trackEvent(X.Events.Selection.GET_LIVE_SELECTION_DATA_TRIGGERED),this.getService(Os).getSelectionsOnCurrentDocument()}catch(o){return this.getService(y).catch("Error in _getLiveSelectionData: ",o),se(null)}}};var Va=(()=>{let o=class o{constructor(e,t,r,a,s,d,p,u,C,E,D,L,G,Y,ne){this.analyticsService=e,this.configService=t,this.docService=r,this.databaseService=a,this.authService=s,this.domService=d,this.afAuth=p,this.iamService=u,this.avatarService=C,this.contactService=E,this.storageService=D,this.dialog=L,this.loggingService=G,this.notificationService=Y,this.commonDbService=ne,this.tagAnnotations$=new ve({}),this.tagAnnotationsByDocumentId$=new ve({}),this.documentPaths=null,this.allowedElementIds$=new ve([]),this.addTagMode$=new ve(!1),this.enableTextTags$=new ve(!1),this.loggingService.log("%c[WB] Creating CLASS: TagService","color: blue;"),this.databaseService.getDb().pipe(Le(ge=>!!ge),rt(1)).subscribe(ge=>{ge&&this.getDocumentPaths()},ge=>{this.loggingService.catch("Error in TagService getDb subscription: ",ge)}),this.domService.onWindowPointerMove$().subscribe(ge=>{if(this.addTagMode$.value){this.hightlightElement&&this.domService.removeHighlightFromElement(this.hightlightElement);let ye=this.domService.getBackgroundElement(ge.clientX,ge.clientY);ye&&(this.isElementInsideAllowedElements(ye)?FP(ge.target)?this.domService.removeClassFromElement(document.body,"show-pin-cursor"):(this.domService.addClassToElement(document.body,"show-pin-cursor"),this.hightlightElement=ye,this.domService.highlightElement(this.hightlightElement,j.CURSOR.TAG_PIN)):this.domService.removeClassFromElement(document.body,"show-pin-cursor"))}},ge=>{this.loggingService.catch("Error in TagService onWindowPointerMove$ subscription: ",ge)}),this.domService.onWindowKeyupEsc$().subscribe(ge=>{this.addTagMode$.value&&this.disableAddTagMode()},ge=>{this.loggingService.catch("Error in TagService onWindowKeyupEsc$ subscription: ",ge)}),this.domService.onDocumentClick$().subscribe(ge=>{if(ge&&this.addTagMode$.value){if(ge.preventDefault(),ge.stopPropagation(),!FP(ge.target)){let ye=this.domService.getBackgroundElement(ge.clientX,ge.clientY);ye&&this.isElementInsideAllowedElements(ye)&&this.addTag(ge)}this.disableAddTagMode()}},ge=>{this.loggingService.catch("Error in TagService onDocumentClick$ subscription: ",ge)}),this.addTagMode$.subscribe(ge=>{this.hightlightElement&&this.domService.removeHighlightFromElement(this.hightlightElement),ge?this.domService.addClassToElement(document.body,"snippyly-add-tag-mode"):(this.domService.removeClassFromElement(document.body,"snippyly-add-tag-mode"),this.domService.removeClassFromElement(document.body,"show-pin-cursor"))},ge=>{this.loggingService.catch("Error in TagService addTagMode$ subscription: ",ge)}),this.domService.onWindowKeyupBackspace$().subscribe(ge=>{this.deleteTagPinAnnotations("keyupBackspace")},ge=>{this.loggingService.catch("Error in TagService onWindowKeyupBackspace$ subscription: ",ge)}),this.domService.onWindowKeyupDelete$().subscribe(ge=>{this.deleteTagPinAnnotations("keyupDelete")},ge=>{this.loggingService.catch("Error in TagService onWindowKeyupDelete$ subscription: ",ge)}),this.domService.getDeleteCommmentAnnotations$().subscribe(ge=>{ge?.length&&(ge?.filter(Re=>Re.type==="tag")).forEach(Re=>Q(this,null,function*(){yield this.deleteTagPinAnnotation(Re)}))},ge=>{this.loggingService.catch("Error in TagService onWindowKeyupDelete$ subscription: ",ge)})}getDocumentPaths(){this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentPaths","color: green;"),this.docService.getDocumentPaths$()}getAnonymousAvatarImage(){return this.loggingService.log("%c[WB] Calling FUNCTION: getAnonymousAvatarImage","color: green;"),this.avatarService.generateUserImage()}setAllowedElementIds(e){this.allowedElementIds$.next(e||[])}getAllowedElementIds(){return this.allowedElementIds$.asObservable()}getAllTagAnnotations(e,t,r){this.loggingService.log("%c[WB] Calling FUNCTION: getAllTagAnnotations","color: green;");let a,s;try{if(e&&(s=fn(e)),t&&typeof t=="object"){let d=Go(t);a=fn(JSON.stringify(d))}}catch(d){this.loggingService.catch("Error in TagService getAllTagAnnotations: ",d)}return Qn(this.afAuth).pipe(Le(d=>!!d),he(d=>this.isFeatureAllowed({firebaseUser:d,annotations:[],filteredAnnotations:[]})),he(d=>d.featureAllowed?this.iamService.isUserAllowed$().pipe(de(p=>(d.featureAllowed=p,d))):se(d)),he(d=>d.featureAllowed?this.authService.isPlanExpired$().pipe(de(p=>(d.featureAllowed=!p,d))):se(d)),he(d=>d.featureAllowed?se(d).pipe(he(p=>this.docService.getDocumentPaths$().pipe(de(u=>(this.documentPaths=u,p.documentPaths=u,p)))),he(p=>this.getDataFromDocumentId(s).pipe(de(u=>(p.annotations=u||[],I({},p))))),he(p=>this.docService.getLocation$().pipe(de(u=>(p.location=u,p)))),he(p=>this.docService.getLocations$().pipe(de(u=>(p.customLocations=u,p)))),de(p=>{if(p.filteredAnnotations=[],s&&!a)return p.filteredAnnotations=p.annotations?.slice(),p;{let u=[];return a?u.push(a):(u.push(p?.location?.locationId),u.push(...Object.values(p?.customLocations||[]).map(C=>C.locationId))),p.filteredAnnotations=this.filterAnnotationsByLocationIds(p?.annotations,u),p}}),he(p=>r?se(p):p?.annotations?.length?this.domService.onWindowResize$().pipe(de(()=>p)):se(p)),he(p=>r?se(p):p?.annotations?.length?this.domService.onDomChange$("TagService getAllTagAnnotations").pipe(de(()=>p)):se(p)),de(p=>(p?.filteredAnnotations?.forEach(u=>{this.calculateTagAnnotationPosition(u)}),p)),he(p=>p?.filteredAnnotations?se(p?.filteredAnnotations||[]):se([]))):se([])))}isFeatureAllowed(e){return this.configService.getConfig$().pipe(Le(t=>!!t),de(t=>T(I({},e),{config:t})),he(t=>this.authService.getUser$().pipe(de(r=>T(I({},t),{user:r})))),he(t=>no(t.config,t.user,Ne.TAG)?se(T(I({},t),{featureAllowed:!0})):(this.loggingService.warn("Tag feature is not allowed."),se(T(I({},t),{featureAllowed:!1})))))}getDataFromDocumentId(e){return this.databaseService.getDb().pipe(Le(t=>!!t),he(t=>this.configService?.getApiKey()&&this.documentPaths?.tag?this.commonDbService.dbListener({feature:"allTags",properties:{documentId:e??this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}}).pipe(de(r=>r?.data),de(r=>{let a=[];return r&&(a=Object.values(r).filter(s=>typeof s=="object")),this.setTagAnnotationsByDocumentId(e||this.documentPaths?.documentId,a),a})):se([])))}setTagAnnotationsByDocumentId(e,t){try{e&&this.tagAnnotationsByDocumentId$.next(T(I({},this.tagAnnotationsByDocumentId$.value),{[e]:t}))}catch(r){this.loggingService.catch("Error in TagService setTagAnnotationsByDocumentId:",r)}}filterAnnotationsByLocationIds(e,t){try{return e.filter(r=>t.includes(r.locationId))}catch(r){return this.loggingService.catch("Error in TagService filterAnnotationsByLocations:",r),[]}}calculateTagAnnotationPosition(e){try{if(e.targetElement){let t=this.domService.getXPath(e.targetElement?.xpath);if(t){let r=t.iterateNext();if(r&&To(r)){let a=r.getBoundingClientRect();if(a&&a.width&&a.height){let{height:s,width:d}=jp(r);e.position={top:s*e.targetElement.topPercentage/100,left:d*e.targetElement.leftPercentage/100}}else e.position=null}else e.position=null}else e.position=null}}catch(t){this.loggingService.catch("Error in TagService calculateTagAnnotationPosition:",t)}}filterPinAnnotations(e,t,r){this.loggingService.log("%c[WB] Calling FUNCTION: filterPinAnnotations","color: green;");try{let a=e?Object.values(e):[];a.forEach((d,p)=>{d?.annotationId&&(d.annotationIndex=p+1)});let s=[];if(t)r?s=a.filter(d=>d.locationId===r):s=a.slice();else{let d=this.docService.getLocation();d&&d.locationId?s=a.filter(p=>p.locationId===d.locationId):s=a.filter(p=>!p.locationId)}return s}catch(a){return this.loggingService.catch("Error in TagService filterPinAnnotations:",a),[]}}addTag(e,t){this.loggingService.log("%c[WB] Calling FUNCTION: addTag","color: green;");try{let r=this.authService.getUser();if(r)if(r.isReadOnly||r.isAnonymous)this.loggingService.catch("Anonymous/Readonly users cannot add tags.");else{let a=new vb;a.from=r,a.color=j.DEFAULT_ANNOTATION_COLOR,a.resolved=!1,a.lastUpdated=this.timestamp;let{topPositionX:s,topPositionY:d}=this.domService.getTopLeftPosition();a.positionX=s,a.positionY=d;let p=this.domService.getCurrentWindowSizeValue();if(a.screenWidth=p.screenWidth,a.screenHeight=p.screenHeight,a.screenScrollHeight=p.screenScrollHeight,a.taggedElementPath="",e&&(a.targetElement=this.domService.getTargetElementForCursorPosition(e)),t&&(a.targetTextRange=t),a?.targetElement?.xpath){let u=this.domService.getXPath(a.targetElement.xpath);if(u){let C=u.iterateNext();C&&(To(C)||(a.targetElement=null))}}this.setLocationToTagAnnotation(a),a.pageInfo=xi(),a.pageInfo&&(a.pageInfo.screenWidth=this.domService.getCurrentWindowSizeValue()?.screenWidth),this.saveTagToDb(a)}}catch(r){this.loggingService.catch("Error in TagService addTag: ",r)}}setLocationToTagAnnotation(e){try{let t=this.docService.getLocation();t?(e.locationId=t.locationId,e.location=t.location):(delete e.locationId,delete e.location);try{let r;e.targetElement?.xpath?r=this.domService.getElementFromXPath(e.targetElement.xpath):e.targetTextRange?.commonAncestorContainer&&(r=this.domService.getElementFromXPath(e.targetTextRange.commonAncestorContainer));let a=this.docService.getAdditionLocationFromElement(r);if(a){let s=this.docService.addLocation({location:a,source:"internal"});s?.[0]&&(e.locationId=s[0].locationId,e.location=s[0].location)}}catch{}}catch(t){this.loggingService.catch("Error in TagService setLocationToTagAnnotation:",t)}}saveTagToDb(e){this.loggingService.log("%c[WB] Calling FUNCTION: saveTagToDb","color: green;");try{this.authService.getUser()&&this.authService.isFeatureAllowed(Ne.TAG)&&this.docService.getDocumentPaths$().pipe(Le(t=>!!t),rt(1),he(t=>(this.documentPaths=t,this.loggingService.log(this.documentPaths),this.databaseService.getDb().pipe(Le(r=>!!r),rt(1),he(r=>{if(this.documentPaths?.tag){e.annotationId=this.commonDbService.generateDocumentId(),e.pageInfo&&(e.pageInfo.tagUrl=this.generateTagUrl(e));let a=JSON.parse(JSON.stringify(e));return a.position=null,this.domService.toggleAnnotationSelection(a),e.targetTextRange&&sessionStorage.setItem(j.SESSION_STORAGE.SNIPPYLY_AUTO_SELECT_ANNOTATION_ID,e.annotationId),this.analyticsService.trackEvent(X.Events.Tag.TAG_DRAFT_ADDED,{annotationId:e.annotationId}),this.commonDbService.setData({feature:"tag",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",id:e.annotationId,skipFirestore:!0},data:a})}else return se(null)}))))).subscribe(()=>{},t=>{this.loggingService.catch("Error in TagService saveTagToDb subscription: ",t)})}catch(t){this.loggingService.catch("Error in TagService saveTagToDb: ",t)}}updateTag(e,t=!1,r){try{r&&this.setLocationToTagAnnotation(e),t&&this.updateNotificationsDatabase(e,RS.UPDATED),this.updateTagToDb(e)}catch(a){this.loggingService.catch("Error in TagService updateTag: ",a)}}resolveTag(e){try{e.resolved=!0,this.domService.resetSelectedAnnotationsMap(!1),this.updateNotificationsDatabase(e,RS.RESOLVED),this.updateTagToDb(e),this.domService.updateSelectedAnnotationInMap([e]),this.analyticsService.trackEvent(X.Events.Tag.TAG_RESOLVED,{annotationId:e.annotationId})}catch(t){this.loggingService.catch("Error in TagService resolveTag: ",t)}}updateTagToDb(e){this.loggingService.log("%c[WB] Calling FUNCTION: updateTagToDb","color: green;");try{if(e?.targetElement?.xpath){let t=this.domService.getXPath(e.targetElement.xpath);if(t){let r=t.iterateNext();r&&(To(r)||(e.targetElement=null))}}this.domService.updateSelectedAnnotationInMap([e]),this.authService.getUser()&&this.authService.isFeatureAllowed(Ne.TAG)&&this.docService.getDocumentPaths$().pipe(Le(t=>!!t),rt(1),he(t=>(this.documentPaths=t,this.loggingService.log(this.documentPaths),this.databaseService.getDb().pipe(Le(r=>!!r),rt(1),he(r=>{if(this.documentPaths?.tag&&e?.annotationId){let a=JSON.parse(JSON.stringify(e));return a.position=null,this.commonDbService.setData({feature:"tag",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",id:e.annotationId,skipFirestore:!0},data:a})}else return se(null)}))))).subscribe(()=>{},t=>{this.loggingService.catch("Error in TagService updateTagToDb subscription: ",t)})}catch(t){this.loggingService.catch("Error in TagService updateTagToDb: ",t)}}deleteTagPinAnnotations(e){try{let t=this.domService.getSelectedAnnotationsMap(),r=this.authService.getUser(),a=[];Object.keys(t).forEach(s=>Q(this,null,function*(){let d=t[s];d.type==="tag"&&r&&d.from&&(r?.isAdmin||d.from.userId===r.userId)&&a.push(d)})),a?.length&&(this.analyticsService.trackEvent(X.Events.Tag.TAG_DELETE_TRIGGERED,{triggerType:e,annotationId:a.map(s=>s.annotationId).join()}),this.dialog.open(ya,{data:{title:"Delete tag?",message:"This selected tag will be deleted.",yesButton:"Delete",noButton:"Cancel",variant:"tag"}}).afterClosed().pipe(rt(1)).subscribe(s=>{s&&(a.forEach(d=>Q(this,null,function*(){yield this.deleteTagPinAnnotation(d)})),setTimeout(()=>{document.querySelectorAll(`[${j.SNIPPYLY_HIGHLIGHT}]`).forEach(p=>{this.domService.removeHighlightFromElement(p)})},100))})),this.domService.resetSelectedAnnotationsMap(!0,"tag")}catch(t){this.loggingService.catch("Error in TagService deleteTagPinAnnotations: ",t)}}deleteTagPinAnnotation(e){return this.authService.isFeatureAllowed(Ne.TAG)&&this.documentPaths?.tag&&e?.annotationId?(this.updateNotificationsDatabase(e,RS.DELETED),this.analyticsService.trackEvent(X.Events.Tag.TAG_DELETED,{annotationId:e.annotationId}),this.commonDbService.deleteData({feature:"tag",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",id:e.annotationId,skipFirestore:!0}})):Promise.resolve()}enableAddTagMode(){this.authService.isFeatureAllowed(Ne.TAG)?(this.analyticsService.trackEvent(X.Events.Tag.TAG_ADD_MODE_ENABLED),this.addTagMode$.next(!0)):this.loggingService.catch("Error in TagService enableAddTagMode: ","Tag feature is not enabled.")}disableAddTagMode(){this.analyticsService.trackEvent(X.Events.Tag.TAG_ADD_MODE_DISABLED),this.addTagMode$.next(!1)}addTagModeChange(){return this.addTagMode$.asObservable()}enableTextTags(e){this.enableTextTags$.next(e)}getEnableTextTags$(){return this.enableTextTags$.asObservable()}get timestamp(){return this.commonDbService.getServerTimestamp()}isElementInsideAllowedElements(e){try{return this.domService.isElementInsideListedElementIds(e,this.allowedElementIds$.value)}catch(t){return this.loggingService.catch("Error in TagService isElementInsideAllowedElements: ",t),!1}}attachTag(e,t=[]){let r=na(e,t);if(r){let a=this.domService.getXPath(r),s=this.getTagPinAnnotationObject();s&&(s.targetElement={xpath:a,topPercentage:50,leftPercentage:90},this.saveTagToDb(s))}}getTagPinAnnotationObject(){let e=this.authService.getUser();if(e)if(e.isReadOnly||e.isAnonymous)this.loggingService.catch("Anonymous/Readonly users cannot add tags.");else{let t=new vb;t.from=e,t.color=j.DEFAULT_ANNOTATION_COLOR,t.resolved=!1,t.lastUpdated=this.timestamp;let{topPositionX:r,topPositionY:a}=this.domService.getTopLeftPosition();t.positionX=r,t.positionY=a;let s=this.domService.getCurrentWindowSizeValue();t.screenWidth=s.screenWidth,t.screenHeight=s.screenHeight,t.screenScrollHeight=s.screenScrollHeight,t.taggedElementPath="";let d=this.docService.getLocation();return d&&(t.locationId=d.locationId,t.location=d.location),t}return null}updateNotificationsDatabase(e,t){try{let r={annotationData:e,actionType:t,notificationSource:"tag"};this.notificationService.updateNotificationDatabase(r)}catch(r){this.loggingService.catch("Error in TagService updateNotificationsDatabase: ",r)}}getUserContacts$(){return this.contactService.getUserContacts$()}addUserContact(e){this.contactService.addUserContact(e)}getTagUrl(e){try{return e?.pageInfo?.tagUrl?e.pageInfo.tagUrl:(e?.pageInfo||(e.pageInfo=xi(),e.pageInfo&&(e.pageInfo.screenWidth=this.domService.getCurrentWindowSizeValue()?.screenWidth)),e.pageInfo.tagUrl=this.generateTagUrl(e),this.updateTag(e),e.pageInfo?.tagUrl)}catch(t){this.loggingService.catch("Error in TagService getTagUrl: ",t);return}}uploadFile(e,t){let r=`${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentPaths?.documentId}/${j.FIREBASE_PARTIAL_PATH_TAG}/${t.annotationId}`;return this.documentPaths?.organizationId&&(r=`${j.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${this.documentPaths.organizationId}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentPaths?.documentId}/${j.FIREBASE_PARTIAL_PATH_TAG}/${t.annotationId}`),this.storageService.uploadFile({path:r,file:e})}downloadAttachment(e){this.storageService.downloadAttachment(e)}deleteAttachment(e){return this.storageService.deleteAttachment({attachment:e})}generateTagUrl(e){let t=new URL(window.location.href);return t.searchParams.delete(j.URL_PARAMS.TAG_ID),t.searchParams.append(j.URL_PARAMS.TAG_ID,e.annotationId),t.href}};o.\u0275fac=function(t){return new(t||o)(J(tt),J(Vt),J(at),J(_n),J(je),J(Fe),J(Ei),J(Sn),J(Rd),J(bi),J(ng),J(Qi),J(y),J(cn),J(yn))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Qk=class extends ri{constructor(o){super(o),this.getService(y).log("%c[WB] Creating CLASS: TagElement","color: blue;"),this.getAllTagAnnotations=this._getAllTagAnnotations,this.deleteTag=this._deleteTag,this.allowedElementIds=this._allowedElementIds,this.attachTag=this._attachTag,this.addTagModeChange=this._addTagModeChange}_getAllTagAnnotations(o,n){this.getService(y).log("%c[WB] Calling FUNCTION: getOnlineUsers","color: green;");try{return this.trackEvent(X.Events.Tag.GET_ALL_TAG_ANNOTATIONS_TRIGGERED,{payload:{documentId:o,location:n}}),this.getService(Va).getAllTagAnnotations(o,n)}catch(e){return this.getService(y).catch("Error in _getLiveTagsOnCurrentDocument: ",e),se(null)}}_deleteTag(){this.getService(y).log("%c[WB] Calling FUNCTION: deleteTag","color: green;");try{this.trackEvent(X.Events.Tag.DELETE_TAG_TRIGGERED),this.getService(Va).deleteTagPinAnnotations("tagElement")}catch(o){this.getService(y).catch("Error in _deleteTag: ",o)}}_allowedElementIds(o){this.getService(y).log("%c[WB] Calling FUNCTION: allowedElementIds","color: green;");try{this.trackEvent(X.Events.Tag.ALLOWED_ELEMENT_IDS_TRIGGERED,{payload:{elementIds:o}}),this.getService(Va).setAllowedElementIds(o)}catch(n){this.getService(y).catch("Error in allowedElementIds: ",n)}}_attachTag(o){this.getService(y).log("%c[WB] Calling FUNCTION: attachTag","color: green;");try{this.trackEvent(X.Events.Tag.ATTACH_TAG_TRIGGERED,{payload:{elementId:o}}),this.getService(Va).attachTag(o,["id","data-id"])}catch(n){this.getService(y).catch("Error in _attachTag: ",n)}}_addTagModeChange(){this.getService(y).log("%c[WB] Calling FUNCTION: addTagModeChange","color: green;");try{return this.trackEvent(X.Events.Tag.ADD_TAG_MODE_CHANGE_TRIGGERED),this.getService(Va).addTagModeChange()}catch(o){return this.getService(y).catch("Error in _addTagModeChange: ",o),se(!1)}}};var Jk=class extends ri{constructor(o){super(o),this.getService(y).log("%c[WB] Creating CLASS: ViewsElement","color: blue;"),this.getUniqueViewsByUser=this._getUniqueViewsByUser,this.getUniqueViewsByDate=this._getUniqueViewsByDate}_getUniqueViewsByUser(o){this.getService(y).log("%c[WB] Calling FUNCTION: _getUniqueViewsByUser","color: green;");try{return this.trackEvent(X.Events.Views.GET_UNIQUE_VIEWS_BY_USER_TRIGGERED,{payload:{clientLocationId:o}}),this.getService(rs).getUniqueViewsByUser(o)}catch(n){return this.getService(y).catch("Error in getUniqueViewsByUser: ",n),se({})}}_getUniqueViewsByDate(o){this.getService(y).log("%c[WB] Calling FUNCTION: _getUniqueViewsByDate","color: green;");try{return this.trackEvent(X.Events.Views.GET_UNIQUE_VIEWS_BY_DATE_TRIGGERED,{payload:{clientLocationId:o}}),this.getService(rs).getUniqueViewsByDate(o)}catch(n){return this.getService(y).catch("Error in getUniqueViewsByDate: ",n),se({})}}};var Tb=(()=>{let o=class o{constructor(e,t){this.docService=e,this.loggingService=t}updateDocuments(e){return Q(this,null,function*(){try{return yield this.docService.updateDocuments(e)}catch(t){return this.loggingService.catch("Error in DocActionsService updateDocuments: ",t),null}})}updateLocations(e){return Q(this,null,function*(){try{return yield this.docService.updateLocations(e)}catch(t){return this.loggingService.catch("Error in DocActionsService updateLocations: ",t),null}})}fetchDocuments(e){return Q(this,null,function*(){try{let t=yield this.docService.fetchDocuments(e),r=[];return t.forEach(a=>{let s=a?.docIamConfig??{},d=a?.metadata??{};d.disabled=!!s?.disabled,d.id=d?.clientDocumentId,d.documentId=d?.clientDocumentId,delete d?.clientDocumentId,d.organizationId=d?.clientOrganizationId,delete d?.clientOrganizationId,delete d?.pageInfo,delete d?.veltFolderId,r.push(d)}),{data:r.reduce((a,s)=>(s?.documentId&&(a[s.documentId]=s),a),{})}}catch(t){return this.loggingService.catch("Error in CommentActionsService fetchDocuments: ",t),{data:null}}})}fetchFolders(e){return Q(this,null,function*(){try{let t=yield this.docService.fetchFolders(e),r=t?.parentFolders?.map(s=>{let d=s?.metadata??{};return delete d?.veltFolderId,d.organizationId=d.clientOrganizationId,delete d?.clientOrganizationId,delete d?.veltParentFolderId,I({},d)});return{data:(t?.data?.map(s=>{let d=s?.metadata??{};return delete d?.veltFolderId,d.organizationId=d.clientOrganizationId,delete d?.clientOrganizationId,delete d?.veltParentFolderId,I(I({},d),e?.folderId?{subFolders:r}:{})})).reduce((s,d)=>(d?.folderId&&(s[d.folderId]=d),s),{})}}catch(t){return this.loggingService.catch("Error in CommentActionsService fetchFolders: ",t),{data:null}}})}};o.\u0275fac=function(t){return new(t||o)(J(at),J(y))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var e9=(()=>{let o=class o{constructor(e,t,r,a,s){this.authService=e,this.coreActionsService=t,this.docService=r,this.iamService=a,this.loggingService=s,this.veltInitState$=new ve(void 0);try{this.loggingService.log("%c[WB] Creating CLASS: VeltService","color: blue;");let d=this.authService.getUser$(),p=this.docService.getDocumentPaths$(),u=this.iamService.isUserAllowed$();En([d,p,u]).subscribe(([C,E,D])=>{C&&E&&D?this.veltInitState$.next(!0):this.veltInitState$.next(!1)}),this.getVeltInitState$().subscribe(C=>{this.coreActionsService.triggerAction(Hi.DOCUMENT_INIT,C)})}catch(d){this.loggingService.catch("Error in VeltService constructor: ",d)}}getVeltInitState$(){try{return this.veltInitState$.asObservable().pipe(kt())}catch(e){return this.loggingService.catch("Error in VeltService getVeltInitState$: ",e),se(void 0)}}};o.\u0275fac=function(t){return new(t||o)(J(je),J(Nd),J(at),J(Sn),J(y))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var sl=(()=>{let o=class o{constructor(e,t,r,a,s,d,p){this.authService=e,this.commonDbService=t,this.commonDbUtilsService=r,this.configService=a,this.docService=s,this.domService=d,this.loggingService=p;try{this.loggingService.log("%c[WB] Creating CLASS: CrdtService","color: blue;")}catch(u){this.loggingService.catch("Error in CrdtService constructor: ",u)}}updateData({id:e,state:t}){try{this.loggingService.log("%c[WB] Calling CrdtService FUNCTION: updateData","color: green;");let r=this.docService.getDocumentPaths(),a=this.authService.getUser(),s=this.domService.getTabId();if(a?.userId&&r){let d=_t(e),p=a.userId,u=_t(a.userId);return this.commonDbService.updateData({feature:"crdtData",properties:{documentId:r?.documentId??"",organizationId:r?.organizationId??"",id:d,skipFirestore:!0},data:{id:e,veltId:d,state:t,lastUpdate:new Date().toISOString(),lastUpdatedBy:p,lastUpdatedByVeltUserId:u,sessionId:s}})}return Promise.resolve(null)}catch(r){return this.loggingService.catch("Error in CrdtService updateData: ",r),Promise.resolve(null)}}onDataChange({id:e,callback:t}){try{this.loggingService.log("%c[WB] Calling CrdtService FUNCTION: onDataChange","color: green;");let r=this.docService.getDocumentPaths();if(r){let a=_t(e),s=this.commonDbService.dbListener({feature:"crdtData",properties:{documentId:r?.documentId??"",organizationId:r?.organizationId??"",id:a,skipFirestore:!0}}).subscribe(d=>{d?.data?t(d.data):t(d)});return()=>s.unsubscribe()}return()=>{}}catch(r){return this.loggingService.catch("Error in CrdtService onDataChange: ",r),()=>{}}}getData({id:e}){try{this.loggingService.log("%c[WB] Calling CrdtService FUNCTION: getData","color: green;");let t=this.docService.getDocumentPaths();if(t){let r=_t(e);return this.commonDbService.getData({feature:"crdtData",properties:{documentId:t?.documentId??"",organizationId:t?.organizationId??"",id:r,skipFirestore:!0}})}return Promise.resolve(null)}catch(t){return this.loggingService.catch("Error in CrdtService getData: ",t),Promise.resolve(null)}}onStateChange({id:e,callback:t}){try{this.loggingService.log("%c[WB] Calling CrdtService FUNCTION: onStateChange","color: green;");let r=this.docService.getDocumentPaths();if(r){let a=_t(e),s=this.commonDbService.dbListener({feature:"crdtSyncState",properties:{documentId:r?.documentId??"",organizationId:r?.organizationId??"",id:a,skipFirestore:!0}}).subscribe(d=>{d?.data?t(d.data):t(d)});return()=>s.unsubscribe()}return()=>{}}catch(r){return this.loggingService.catch("Error in CrdtService onStateChange: ",r),()=>{}}}updateState({id:e,state:t}){try{this.loggingService.log("%c[WB] Calling CrdtService FUNCTION: updateState","color: green;");let r=this.docService.getDocumentPaths(),a=this.authService.getUser(),s=this.domService.getTabId();if(a?.userId&&r){let d=_t(e),p=a.userId,u=_t(p);return this.commonDbService.setData({feature:"crdtSyncState",properties:{documentId:r?.documentId??"",organizationId:r?.organizationId??"",id:d,skipFirestore:!0},data:{id:e,veltId:d,state:t,lastUpdate:new Date().toISOString(),lastUpdatedBy:p,lastUpdatedByVeltUserId:u,sessionId:s}})}return Promise.resolve(null)}catch(r){return this.loggingService.catch("Error in CrdtService updateState: ",r),Promise.resolve(null)}}registerSyncUser(t){return Q(this,arguments,function*({id:e}){try{this.loggingService.log("%c[WB] Calling CrdtService FUNCTION: registerSyncUser","color: green;");let r=this.authService.getUser(),a=this.docService.getDocumentPaths(),s=this.configService.getApiKey(),d=_t(e),p=this.domService.getTabId();if(r?.userId&&a&&s){let u=r.userId,C=_t(u),E={documentId:a?.documentId??"",organizationId:a?.organizationId??"",id:d,userId:C,apiKey:s,skipFirestore:!0},D={userId:u,veltUserId:C,status:"online",lastSeen:Date.now(),sessionId:p};yield this.commonDbService.setData({feature:"crdtSyncPresence",properties:E,data:D});let L=this.commonDbUtilsService.getDocumentPath({feature:"crdtSyncPresence",properties:E,defaultDocumentPaths:a,apiKey:s});L&&(yield this.commonDbService.setupOnDisconnect(L,{status:"offline",lastSeen:new Date().getTime(),sessionId:p}))}}catch(r){this.loggingService.catch("Error in CrdtService registerSyncUser: ",r)}})}onRegisteredUserChange({id:e,callback:t}){try{this.loggingService.log("%c[WB] Calling CrdtService FUNCTION: onRegisteredUserChange","color: green;");let r=this.docService.getDocumentPaths();if(r){let a=_t(e),s=this.commonDbService.dbListener({feature:"allCrdtSyncPresence",properties:{documentId:r?.documentId??"",organizationId:r?.organizationId??"",id:a,skipFirestore:!0}}).subscribe(d=>{d?.data?t(d.data):t(d)});return()=>s.unsubscribe()}return()=>{}}catch(r){return this.loggingService.catch("Error in CrdtService onRegisteredUserChange: ",r),()=>{}}}setPresence(t){return Q(this,arguments,function*({id:e}){try{this.loggingService.log("%c[WB] Calling CrdtService FUNCTION: setPresence","color: green;");let r=this.authService.getUser(),a=this.docService.getDocumentPaths(),s=this.configService.getApiKey(),d=_t(e),p=this.domService.getTabId();if(r?.userId&&a&&s){let u=r.userId,C=_t(u),E={documentId:a?.documentId??"",organizationId:a?.organizationId??"",id:d,userId:C,apiKey:s,skipFirestore:!0},D={userId:u,veltUserId:C,status:"online",lastSeen:Date.now(),sessionId:p};yield this.commonDbService.setData({feature:"crdtPresence",properties:E,data:D});let L=this.commonDbUtilsService.getDocumentPath({feature:"crdtPresence",properties:E,defaultDocumentPaths:a,apiKey:s});L&&(yield this.commonDbService.setupOnDisconnect(L,{status:"offline",lastSeen:new Date().getTime(),sessionId:p}))}}catch(r){this.loggingService.catch("Error in CrdtService setPresence: ",r)}})}onPresenceChange({id:e,callback:t}){try{this.loggingService.log("%c[WB] Calling CrdtService FUNCTION: onPresenceChange","color: green;");let r=this.docService.getDocumentPaths();if(r){let a=_t(e),s=this.commonDbService.dbListener({feature:"allCrdtPresence",properties:{documentId:r?.documentId??"",organizationId:r?.organizationId??"",id:a,skipFirestore:!0}}).subscribe(d=>{d?.data?t(d.data):t(d)});return()=>s.unsubscribe()}return()=>{}}catch(r){return this.loggingService.catch("Error in CrdtService onPresenceChange: ",r),()=>{}}}storeVersion({id:e,versionId:t,versionName:r,state:a}){try{this.loggingService.log("%c[WB] Calling CrdtService FUNCTION: storeVersion","color: green;");let s=this.docService.getDocumentPaths();if(s){let d=_t(e),p={versionId:t,versionName:r,state:a,timestamp:new Date().getTime()};return this.commonDbService.setData({feature:"crdtVersion",properties:{documentId:s?.documentId??"",organizationId:s?.organizationId??"",id:d,versionId:t,skipFirestore:!0},data:I({id:e},p)})}return Promise.resolve(null)}catch(s){return this.loggingService.catch("Error in CrdtService storeVersion: ",s),Promise.resolve(null)}}getVersion(r){return Q(this,arguments,function*({id:e,versionId:t}){try{this.loggingService.log("%c[WB] Calling CrdtService FUNCTION: getVersion","color: green;");let a=this.docService.getDocumentPaths();if(a){let s=_t(e);return this.commonDbService.getData({feature:"crdtVersion",properties:{documentId:a?.documentId??"",organizationId:a?.organizationId??"",id:s,versionId:t,skipFirestore:!0}})}return Promise.resolve(null)}catch(a){return this.loggingService.catch("Error in CrdtService getVersion: ",a),Promise.resolve(null)}})}getVersions(t){return Q(this,arguments,function*({id:e}){try{this.loggingService.log("%c[WB] Calling CrdtService FUNCTION: getVersions","color: green;");let r=this.docService.getDocumentPaths();if(r){let a=_t(e),s=yield this.commonDbService.getData({feature:"crdtVersions",properties:{documentId:r?.documentId??"",organizationId:r?.organizationId??"",id:a,skipFirestore:!0}});return s?Object.values(s):null}return Promise.resolve(null)}catch(r){return this.loggingService.catch("Error in CrdtService getVersions: ",r),Promise.resolve(null)}})}};o.\u0275fac=function(t){return new(t||o)(J(je),J(yn),J(tg),J(Vt),J(at),J(Fe),J(y))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var t9=class extends ri{constructor(o){super(o),this.getService(y).log("%c[WB] Creating CLASS: CrdtElement","color: blue;"),this.updateData=this._updateData,this.onDataChange=this._onDataChange,this.getData=this._getData,this.onStateChange=this._onStateChange,this.updateState=this._updateState,this.registerSyncUser=this._registerSyncUser,this.onRegisteredUserChange=this._onRegisteredUserChange,this.setPresence=this._setPresence,this.onPresenceChange=this._onPresenceChange,this.storeVersion=this._storeVersion,this.getVersion=this._getVersion,this.getVersions=this._getVersions}_updateData(o){this.getService(y).log("%c[WB] Calling FUNCTION: updateData","color: green;");try{return this.getService(sl).updateData(o)}catch(n){return this.getService(y).catch("Error in updateData: ",n),Promise.resolve(null)}}_onDataChange(o){this.getService(y).log("%c[WB] Calling FUNCTION: onDataChange","color: green;");try{return this.getService(sl).onDataChange(o)}catch(n){return this.getService(y).catch("Error in onDataChange: ",n),()=>{}}}_getData(o){this.getService(y).log("%c[WB] Calling FUNCTION: getData","color: green;");try{return this.getService(sl).getData(o)}catch(n){return this.getService(y).catch("Error in getData: ",n),Promise.resolve(null)}}_onStateChange(o){this.getService(y).log("%c[WB] Calling FUNCTION: onStateChange","color: green;");try{return this.getService(sl).onStateChange(o)}catch(n){return this.getService(y).catch("Error in onStateChange: ",n),()=>{}}}_updateState(o){this.getService(y).log("%c[WB] Calling FUNCTION: updateState","color: green;");try{return this.getService(sl).updateState(o)}catch(n){return this.getService(y).catch("Error in updateState: ",n),Promise.resolve(null)}}_registerSyncUser(o){this.getService(y).log("%c[WB] Calling FUNCTION: registerSyncUser","color: green;");try{return this.getService(sl).registerSyncUser(o)}catch(n){return this.getService(y).catch("Error in registerSyncUser: ",n),Promise.resolve()}}_onRegisteredUserChange(o){this.getService(y).log("%c[WB] Calling FUNCTION: onRegisteredUserChange","color: green;");try{return this.getService(sl).onRegisteredUserChange(o)}catch(n){return this.getService(y).catch("Error in onRegisteredUserChange: ",n),()=>{}}}_setPresence(o){this.getService(y).log("%c[WB] Calling FUNCTION: setPresence","color: green;");try{return this.getService(sl).setPresence(o)}catch(n){return this.getService(y).catch("Error in setPresence: ",n),Promise.resolve()}}_onPresenceChange(o){this.getService(y).log("%c[WB] Calling FUNCTION: onPresenceChange","color: green;");try{return this.getService(sl).onPresenceChange(o)}catch(n){return this.getService(y).catch("Error in onPresenceChange: ",n),()=>{}}}_storeVersion(o){this.getService(y).log("%c[WB] Calling FUNCTION: storeVersion","color: green;");try{return this.getService(sl).storeVersion(o)}catch(n){return this.getService(y).catch("Error in storeVersion: ",n),Promise.resolve(null)}}_getVersion(o){this.getService(y).log("%c[WB] Calling FUNCTION: getVersion","color: green;");try{return this.getService(sl).getVersion(o)}catch(n){return this.getService(y).catch("Error in getVersion: ",n),Promise.resolve(null)}}_getVersions(o){this.getService(y).log("%c[WB] Calling FUNCTION: getVersions","color: green;");try{return this.getService(sl).getVersions(o)}catch(n){return this.getService(y).catch("Error in getVersions: ",n),Promise.resolve(null)}}};var n9=class{constructor(o){this.injector=o,this.initConfig=(n,e)=>{this.getService(y).log("%c[WB] Calling FUNCTION: initConfig","color: green;");try{n?typeof n!="string"?this.getService(y).catch("Error in initConfig: ","Apikey must be string."):n?.trim()?this.getService(je).setApiKey(n?.trim(),e):this.getService(y).catch("Error in initConfig: ","Apikey is not provided."):this.getService(y).catch("Error in initConfig: ","Apikey is not provided.")}catch(t){this.getService(y).catch("Error in initConfig: ",t)}},this.identify=(n,e,t)=>(this.getService(y).log("%c[WB] Calling FUNCTION: identify","color: green;"),new Promise((r,a)=>{try{typeof n=="object"&&(n=JSON.parse(JSON.stringify(n)));let s=this.getService(Vt).getApiKey(),d=Ev(s,n.userId);if(t?.ha||this.getService(tt).trackEvent(X.Events.Core.IDENTIFY,{apiKey:s,clientUserId:n.userId,snippylyUserId:d,forceReset:e?.forceReset,user:this.getService(je).getUserWithoutContacts(n),source:"client",fromProvider:t?.fromProvider},!0,d,n?.userId),!(n&&n.userId))this.getService(y).catch("Error in identify: ","Missing userId in config data."),r(null);else if(typeof n.userId!="string")this.getService(y).catch("Error in identify: ","userId must be string."),r(null);else if(n?.groupId&&typeof n?.groupId!="string")this.getService(y).catch("Error in identify: ","groupId must be string."),r(null);else{if(n?.groupId)if(n?.groupId?.match(/^[a-zA-Z0-9_]*$/))n.clientGroupId=n.groupId;else{let u=n.groupId;n.clientGroupId=u,n.groupId=_t(u)}if(n?.organizationId){let u=n.organizationId;n.clientOrganizationId=u,n.organizationId=_t(u)}delete n.isAdmin;let p=j.REGEX_URL;if(n?.name&&p.test(n?.name))throw new Error("Invalid name.");n.clientUserName=n.name,n?.name&&n?.name?.length>20&&(n.name=n.name.slice(0,20)),this.getService(je).initializeClient(n,e||{},new Date().getTime(),void 0,"external").then(u=>{let C;try{u&&(C=JSON.parse(JSON.stringify(u)))}catch{}r(C)}).catch(u=>{this.getService(y).catch("Error in identify: ",u),r(null)})}}catch(s){this.getService(y).catch("Error in identify: ",s),r(null)}})),this.updateUser=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: updateUser","color: green;");try{if(this.getService(y).catch("DEPRECATED: ","'updateUser' method is deprecated."),n&&typeof n=="object"){if(n=JSON.parse(JSON.stringify(n)),n?.groupId)if(n?.groupId?.match(/^[a-zA-Z0-9_]*$/))n.clientGroupId=n.groupId;else{let e=n.groupId;n.clientGroupId=e,n.groupId=_t(e)}delete n.isAdmin,this.getService(je).updateUser(n)}else this.getService(y).catch("Error in updateUser: ","Invalid user object provided.")}catch(e){this.getService(y).catch("Error in updateUser: ",e)}},this.signOutUser=n=>(this.getService(y).log("%c[WB] Calling FUNCTION: signOutUser","color: green;"),n?.ha||this.trackEvent(X.Events.Core.SIGN_OUT_USER_TRIGGERED),new Promise((e,t)=>Q(this,null,function*(){try{yield this.getService(je).signOutUser("external"),e(null)}catch(r){this.getService(y).catch("Error in signOutUser: ",r),e(null)}}))),this.setDocument=(n,e,t,r)=>Q(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: setDocument","color: green;");try{r?.ha||this.trackEvent(X.Events.Core.SET_DOCUMENTS_TRIGGERED,{payload:{id:n,documentMetadata:e,methodName:"setDocument",source:"external"}}),n&&n.trim()?(e&&(typeof e=="object"?e=JSON.parse(JSON.stringify(e)):this.getService(y).catch("Error in setDocument: ","Invalid documentMetadata provided.")),yield this.getService(at).setDocument({documentId:n,documentMetadata:e,options:t,source:"external"})):this.getService(y).catch("Error in setDocument: ","Invalid document id provided.")}catch(a){this.getService(y).catch("Error in setDocument: ",a)}}),this.setDocumentId=(n,e,t)=>Q(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: setDocumentId","color: green;");try{if(t?.ha||this.trackEvent(X.Events.Core.SET_DOCUMENTS_TRIGGERED,{payload:{id:n,organizationId:e,methodName:"setDocumentId",source:"external"}}),n&&n.trim())return yield this.getService(at).setDocumentId({documentId:n,clientOrganizationId:e,source:"external"});this.getService(y).catch("Error in setDocumentId: ","Invalid document id provided.")}catch(r){this.getService(y).catch("Error in setDocumentId: ",r)}}),this.setDocuments=(n,e,t)=>Q(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: setDocuments","color: green;");try{t?.ha||this.trackEvent(X.Events.Core.SET_DOCUMENTS_TRIGGERED,{payload:{documents:n,options:e,methodName:"setDocuments",source:"external"}}),typeof n=="object"&&n instanceof Array?(n=JSON.parse(JSON.stringify(n)),n=n.filter(r=>typeof r=="object"&&r!==null&&r.id?.trim()),n.length?yield this.getService(at).setDocuments({documents:n,options:e,source:"external"}):this.getService(y).catch("Error in setDocuments: ","Invalid documents provided.")):this.getService(y).catch("Error in setDocuments: ","Invalid documents provided.")}catch(r){this.getService(y).catch("Error in setDocuments: ",r)}}),this.setRootDocument=(n,e)=>Q(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: setRootDocument","color: green;");try{e?.ha||this.trackEvent(X.Events.Core.SET_ROOT_DOCUMENT_TRIGGERED,{payload:{document:n,methodName:"setRootDocument",source:"external"}}),typeof n=="object"?(n=JSON.parse(JSON.stringify(n)),n.id?yield this.getService(at).setRootDocument({document:n,source:"external"}):this.getService(y).catch("Error in setRootDocument: ","Invalid document provided.")):this.getService(y).catch("Error in setRootDocument: ","Invalid document provided.")}catch(t){this.getService(y).catch("Error in setRootDocument: ",t)}}),this.unsetDocumentId=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: unsetDocumentId","color: green;");try{n?.ha||this.trackEvent(X.Events.Core.UNSET_DOCUMENTS_TRIGGERED,{payload:{methodName:"unsetDocumentId",source:"external"}}),this.getService(at).unsetDocumentId({source:"external"})}catch(e){this.getService(y).catch("Error in unsetDocumentId: ",e)}},this.unsetDocuments=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: unsetDocuments","color: green;");try{n?.ha||this.trackEvent(X.Events.Core.UNSET_DOCUMENTS_TRIGGERED,{payload:{methodName:"unsetDocuments",source:"external"}}),this.getService(at).unsetDocuments({source:"external"})}catch(e){this.getService(y).catch("Error in unsetDocuments: ",e)}},this.fetchDocuments=(n,e)=>{this.getService(y).log("%c[WB] Calling FUNCTION: fetchDocuments","color: green;");try{return e?.ha||this.trackEvent(X.Events.Core.FETCH_DOCUMENTS_TRIGGERED,{payload:{options:n}}),this.getService(Tb).fetchDocuments(n)}catch(t){return this.getService(y).catch("Error in fetchDocuments: ",t),Promise.resolve({data:null})}},this.updateDocuments=(n,e)=>{this.getService(y).log("%c[WB] Calling FUNCTION: updateDocuments","color: green;");try{return e?.ha||this.trackEvent(X.Events.Core.UPDATE_DOCUMENTS_TRIGGERED,{payload:{request:n}}),this.getService(Tb).updateDocuments(n)}catch(t){return this.getService(y).catch("Error in updateDocuments: ",t),Promise.resolve({data:null})}},this.updateLocations=(n,e)=>{this.getService(y).log("%c[WB] Calling FUNCTION: updateLocations","color: green;");try{return e?.ha||this.trackEvent(X.Events.Core.UPDATE_LOCATIONS_TRIGGERED,{payload:{request:n}}),this.getService(Tb).updateLocations(n)}catch(t){return this.getService(y).catch("Error in updateLocations: ",t),Promise.resolve({data:null})}},this.fetchFolders=(n,e)=>{this.getService(y).log("%c[WB] Calling FUNCTION: fetchFolders","color: green;");try{return e?.ha||this.trackEvent(X.Events.Core.FETCH_FOLDERS_TRIGGERED,{payload:{options:n}}),this.getService(Tb).fetchFolders(n)}catch(t){return this.getService(y).catch("Error in fetchFolders: ",t),Promise.resolve({data:null})}},this.setUserDataProvider=(n,e)=>{this.getService(y).log("%c[WB] Calling FUNCTION: setUserDataProvider","color: green;");try{e?.ha||this.trackEvent(X.Events.Core.SET_USER_DATA_PROVIDER_TRIGGERED),this.getService(Yn).setUserDataProvider(n)}catch(t){this.getService(y).catch("Error in setUserDataProvider: ",t)}},this.setDataProviders=(n,e)=>{this.getService(y).log("%c[WB] Calling FUNCTION: setDataProviders","color: green;");try{if(e?.ha||this.trackEvent(X.Events.Core.SET_DATA_PROVIDERS_TRIGGERED),n.comment&&this.getService(ws).setCommentAnnotationDataProvider(n.comment),n.user&&this.getService(Yn).setUserDataProvider(n.user),n.reaction&&this.getService(Ld).setReactionAnnotationDataProvider(n.reaction),n.attachment)if(n.comment)this.getService(eg).setAttachmentDataProvider(n.attachment);else throw new Error("Comment data provider is required for attachment data provider")}catch(t){this.getService(y).catch("Error in setDataProviders: ",t)}},this.setVeltAuthProvider=n=>Q(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: setVeltAuthProvider","color: green;");try{return yield this.getService(je).setVeltAuthProvider(n)}catch(e){return this.getService(y).catch("Error in setVeltAuthProvider: ",e),null}}),this.getDocumentId=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getDocumentId","color: green;");try{return n?.ha||this.trackEvent(X.Events.Core.GET_DOCUMENT_ID_TRIGGERED),this.getService(at).getDocumentId()}catch(e){this.getService(y).catch("Error in getDocumentId: ",e)}},this.setLocation=(n,e,t)=>Q(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: setLocation","color: green;");try{t?.ha||this.trackEvent(X.Events.Core.SET_LOCATIONS_TRIGGERED,{payload:{params:n,appendLocation:e,methodName:"setLocation",source:"external"}}),n&&typeof n=="object"?e?this.getService(at).addLocation({location:n,source:"external"}):yield this.getService(at).setLocation({location:n,source:"external"}):this.getService(y).catch("Error in setLocation: ","Invalid location params provided.")}catch(r){this.getService(y).catch("Error in setLocation: ",r)}}),this.setRootLocation=(n,e)=>Q(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: setRootLocation","color: green;");try{e?.ha||this.trackEvent(X.Events.Core.SET_ROOT_LOCATION_TRIGGERED,{payload:{location:n,methodName:"setRootLocation",source:"external"}}),typeof n=="object"?(n=JSON.parse(JSON.stringify(n)),n.id?yield this.getService(at).setRootLocation({location:n,source:"external"}):this.getService(y).catch("Error in setRootLocation: ","Invalid location provided.")):this.getService(y).catch("Error in setRootLocation: ","Invalid location provided.")}catch(t){this.getService(y).catch("Error in setRootLocation: ",t)}}),this.setLocations=(n,e,t)=>Q(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: setLocations","color: green;");try{t?.ha||this.trackEvent(X.Events.Core.SET_LOCATIONS_TRIGGERED,{payload:{locations:n,options:e,methodName:"setLocations",source:"external"}}),n&&Array.isArray(n)?yield this.getService(at).setLocations({locations:n,options:e,source:"external"}):this.getService(y).catch("Error in setLocations: ","Invalid location params provided.")}catch(r){this.getService(y).catch("Error in setLocations: ",r)}}),this.addLocation=(n,e)=>Q(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: addLocation","color: green;");try{e?.ha||this.trackEvent(X.Events.Core.SET_LOCATIONS_TRIGGERED,{payload:{params:n,methodName:"addLocation",source:"external"}}),n&&typeof n=="object"?this.getService(at).addLocation({location:n,source:"external"}):this.getService(y).catch("Error in addLocation: ","Invalid location params provided.")}catch(t){this.getService(y).catch("Error in addLocation: ",t)}}),this.setScrollableElementsIds=(n,e)=>{this.getService(y).log("%c[WB] Calling FUNCTION: setScrollableElementsIds","color: green;");try{e?.ha||this.trackEvent(X.Events.Core.SET_SCROLLABLE_ELEMENTS_IDS_TRIGGERED,{payload:{ids:n}}),n?this.getService(Fe).setScrollableElementsIds(n):this.getService(y).catch("Error in setScrollableElementsIds: ","Invalid ids provided.")}catch(t){this.getService(y).catch("Error in setScrollableElementsIds: ",t)}},this.removeLocation=(n,e)=>{this.getService(y).log("%c[WB] Calling FUNCTION: removeLocation","color: green;");try{e?.ha||this.trackEvent(X.Events.Core.REMOVE_LOCATIONS_TRIGGERED,{payload:{location:n},methodName:"removeLocation",source:"external"}),this.getService(at).removeLocation({location:n,source:"external"})}catch(t){this.getService(y).catch("Error in removeLocation: ",t)}},this.removeLocations=(n,e)=>{this.getService(y).log("%c[WB] Calling FUNCTION: removeLocations","color: green;");try{e?.ha||this.trackEvent(X.Events.Core.REMOVE_LOCATIONS_TRIGGERED,{payload:{locations:n},methodName:"removeLocations",source:"external"}),this.getService(at).removeLocations({locations:n,source:"external"})}catch(t){this.getService(y).catch("Error in removeLocations: ",t)}},this.unsetLocationIds=(n,e)=>{this.getService(y).log("%c[WB] Calling FUNCTION: unsetLocationIds","color: green;");try{e?.ha||this.trackEvent(X.Events.Core.UNSET_LOCATIONS_TRIGGERED,{payload:{locationIds:n},methodName:"unsetLocationIds",source:"external"}),this.getService(at).unsetLocationIds(n,"external")}catch(t){this.getService(y).catch("Error in unsetLocationIds: ",t)}},this.excludeLocationIds=(n,e)=>{this.getService(y).log("%c[WB] Calling FUNCTION: excludeLocationIds","color: green;");try{e?.ha||this.trackEvent(X.Events.Core.EXCLUDE_LOCATION_IDS_TRIGGERED,{payload:{ids:n}}),typeof n=="object"&&n instanceof Array&&(n=n.filter(t=>typeof t=="string"),this.getService(at).excludeLocationIds(n))}catch(t){this.getService(y).catch("Error in excludeLocationIds: ",t)}},this.updateContactList=(n,e,t)=>{this.getService(y).log("%c[WB] Calling FUNCTION: updateContactList","color: green;");try{t?.ha||this.trackEvent(X.Events.Core.UPDATE_CONTACT_LIST_TRIGGERED,{payload:{userContacts:n,config:e}}),typeof n=="object"&&n instanceof Array&&(!e||e&&typeof e=="object")&&(n=JSON.parse(JSON.stringify(n)),this.getService(bi).updateContactList(n,e))}catch(r){this.getService(y).catch("Error in updateContactList: ",r)}},this.removeScrollableElementsIds=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: removeScrollableElementsIds","color: green;");try{n?.ha||this.trackEvent(X.Events.Core.REMOVE_SCROLLABLE_ELEMENTS_IDS_TRIGGERED),this.getService(Fe).removeScrollableElementsIds()}catch(e){this.getService(y).catch("Error in removeScrollableElementsIds: ",e)}},this.getPresenceElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getPresenceElement","color: green;");try{let e=new Wk(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getPresenceElement: ",e),null}},this.getCursorElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getCursorElement","color: green;");try{let e=new Uk(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getCursorElement: ",e),null}},this.getCommentElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getCommentElement","color: green;");try{let e=new kk(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getCommentElement: ",e),null}},this.getTagElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getTagElement","color: green;");try{let e=new Qk(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getTagElement: ",e),null}},this.getSelectionElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getSelectionElement","color: green;");try{let e=new Xk(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getSelectionElement: ",e),null}},this.getRecorderElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getRecorderElement","color: green;");try{let e=new Yk(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getRecorderElement: ",e),null}},this.getContactElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getContactElement","color: green;");try{let e=new Rk(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getContactElement: ",e),null}},this.getRewriterElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getRewriterElement","color: green;");try{let e=new Zk(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getRewriterElement: ",e),null}},this.getHuddleElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getHuddleElement","color: green;");try{let e=new $k(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getHuddleElement: ",e),null}},this.getLiveStateSyncElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getLiveStateSyncElement","color: green;");try{let e=new Hk(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getLiveStateSyncElement: ",e),null}},this.getArrowElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getArrowElement","color: green;");try{let e=new Ak(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getArrowElement: ",e),null}},this.getViewsElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getViewsElement","color: green;");try{let e=new Jk(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getViewsElement: ",e),null}},this.getNotificationElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getNotificationElement","color: green;");try{let e=new Gk(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getNotificationElement: ",e),null}},this.getAutocompleteElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getAutocompleteElement","color: green;");try{let e=new Mk(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getAutocompleteElement: ",e),null}},this.getDocElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getDocElement","color: green;");try{let e=new jk(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getDocElement: ",e),null}},this.getAreaElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getAreaElement","color: green;");try{let e=new wk(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getAreaElement: ",e),null}},this.getReactionElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getReactionElement","color: green;");try{let e=new qk(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getReactionElement: ",e),null}},this.getCrdtElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getCrdtElement","color: green;");try{let e=new t9(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getCrdtElement: ",e),null}},this.getMetadata=n=>Q(this,null,function*(){try{return n?.ha||this.trackEvent(X.Events.Core.GET_METADATA_TRIGGERED),this.getService(Vd).getGlobalMetadata()}catch(e){return this.getService(y).catch("Error in getMetadata: ",e),null}}),this.disableFeatures=(n,e)=>{try{e?.ha||this.trackEvent(X.Events.Core.DISABLE_FEATURES_TRIGGERED,{payload:{features:n}}),this.getService(Vt).disableFeatures(n)}catch(t){this.getService(y).catch("Error in disableFeatures: ",t)}},this.setDarkMode=(n,e)=>{try{e?.ha||this.trackEvent(X.Events.Core.SET_DARK_MODE_TRIGGERED,{payload:{value:n}}),this.getService(qe).setDarkMode(n)}catch(t){this.getService(y).catch("Error in setDarkMode: ",t)}},this.enableLogs=n=>{try{n?.ha||this.trackEvent(X.Events.Core.ENABLE_LOGS_TRIGGERED),this.getService(Vt).enableLogs()}catch(e){this.getService(y).catch("Error in enableLogs: ",e)}},this.disableLogs=(n,e)=>{try{e?.ha||this.trackEvent(X.Events.Core.DISABLE_LOGS_TRIGGERED),this.getService(Vt).disableLogs(n)}catch(t){this.getService(y).catch("Error in disableLogs: ",t)}},this.isUserAllowed$=n=>{try{return n?.ha||this.trackEvent(X.Events.Core.IS_USER_ALLOWED_TRIGGERED),this.getService(Sn).isUserAllowed$()}catch(e){return this.getService(y).catch("Error in isUserAllowed$: ",e),se(!1)}},this.getUser=n=>{try{n?.ha||this.trackEvent(X.Events.Core.GET_USER_TRIGGERED);let e=this.getService(je).getUser();if(e&&typeof e=="object"){let t=JSON.parse(JSON.stringify(e));return t?.clientOrganizationId&&(t.organizationId=t.clientOrganizationId,delete t.clientOrganizationId),t?.clientGroupId&&(t.groupId=t.clientGroupId,delete t.clientGroupId),delete t.userSnippylyId,t}else return null}catch(e){return this.getService(y).catch("Error in getUser: ",e),null}},this.getUserRole$=n=>{try{return n?.ha||this.trackEvent(X.Events.Core.GET_USER_ROLE_TRIGGERED),this.getService(Sn).getRole$()}catch(e){return this.getService(y).catch("Error in getUserRole$: ",e),se("")}},this.getFeaturesAccessLevelIam$=n=>{try{return n?.ha||this.trackEvent(X.Events.Core.GET_FEATURES_ACCESS_LEVEL_IAM_TRIGGERED),this.getService(Sn).getFeaturesAccessLevel$()}catch(e){return this.getService(y).catch("Error in getFeaturesAccessLevel$: ",e),se(void 0)}},this.isPlanExpired$=n=>{try{return n?.ha||this.trackEvent(X.Events.Core.IS_PLAN_EXPIRED_TRIGGERED),this.getService(je).isPlanExpired$()}catch(e){return this.getService(y).catch("Error in isPlanExpired$: ",e),se(!1)}},this.getCustomerMetadata$=n=>{try{return n?.ha||this.trackEvent(X.Events.Core.GET_CUSTOMER_METADATA_TRIGGERED),this.getService(at).getCustomerMetadata$()}catch(e){return this.getService(y).catch("Error in getCustomerMetadata$: ",e),se(null)}},this.getDocumentMetadata=n=>{try{return n?.ha||this.trackEvent(X.Events.Core.GET_DOCUMENT_METADATA_TRIGGERED),this.getService(at).getDocumentMetadata$()}catch(e){return this.getService(y).catch("Error in getDocumentMetadata: ",e),se(null)}},this.getVeltInitState=n=>{try{return n?.ha||this.trackEvent(X.Events.Core.GET_VELT_INIT_STATE_TRIGGERED),this.getService(e9).getVeltInitState$()}catch(e){return this.getService(y).catch("Error in getVeltInitState: ",e),se(void 0)}},this.removeVeltContent=(n,e)=>{try{return e?.ha||this.trackEvent(X.Events.Core.REMOVE_VELT_CONTENT_TRIGGERED),this.getService(Fe).removeSnippylyContent(n)}catch(t){return this.getService(y).catch("Error in removeVeltContent: ",t),""}},this.injectCustomCss=(n,e)=>{try{e?.ha||this.trackEvent(X.Events.Core.INJECT_CUSTOM_CSS_TRIGGERED),this.getService(y).log("%c[WB] Calling FUNCTION: injectCustomCss","color: green;"),this.getService(Fe).setCustomCss(n)}catch(t){this.getService(y).catch("Error in injectCustomCss: ",t)}},this.setLanguage=(n,e)=>{try{e?.ha||this.trackEvent(X.Events.Core.SET_LANGUAGE_TRIGGERED,{payload:{language:n}}),this.getService(al).setLanguage(n)}catch(t){this.getService(y).catch("Error in setLanguage: ",t)}},this.setTranslations=(n,e)=>{try{e?.ha||this.trackEvent(X.Events.Core.SET_TRANSLATIONS_TRIGGERED,{payload:{translations:n}}),this.getService(al).setTranslations(n)}catch(t){this.getService(y).catch("Error in setTranslations: ",t)}},this.enableAutoTranslation=n=>{try{n?.ha||this.trackEvent(X.Events.Core.ENABLE_AUTO_TRANSLATION_TRIGGERED),this.getService(al).enableAutoTranslation()}catch(e){this.getService(y).catch("Error in enableAutoTranslation: ",e)}},this.disableAutoTranslation=n=>{try{n?.ha||this.trackEvent(X.Events.Core.DISABLE_AUTO_TRANSLATION_TRIGGERED),this.getService(al).disableAutoTranslation()}catch(e){this.getService(y).catch("Error in disableAutoTranslation: ",e)}},this.sf=(n,e)=>{try{e?.ha||this.trackEvent(X.Events.Core.SF_TRIGGERED,{payload:{value:n}}),n?(document.querySelector(j.TAGS.SNIPPYLY_PLUGIN)||document.querySelector(j.TAGS.SUPERFLOW_TOOLBAR))&&this.getService(Vt).setSF(n):this.getService(Vt).setSF(n)}catch(t){this.getService(y).catch("Error in sf: ",t)}},this.st=(n,e)=>{try{e?.ha||this.trackEvent(X.Events.Core.ST_TRIGGERED,{payload:{value:n}}),this.getService(Vt).setSdkType(n)}catch(t){this.getService(y).catch("Error in st: ",t)}},this.getService=n=>this.injector.get(n),this.on=(n,e)=>{this.getService(y).log("%c[WB] Calling FUNCTION: on","color: green;");try{return e?.ha||this.trackEvent(X.Events.Core.ON_ACTION_TRIGGERED,{payload:{action:n}}),this.getService(Nd).onAction(n)}catch(t){return this.getService(y).catch("Error in on: ",t),se(null)}},this.setUiState=(n,e)=>{try{e?.ha||this.trackEvent(X.Events.Core.SET_UI_STATE_TRIGGERED,{payload:{uiState:n}}),this.getService(at).setUIState(n)}catch(t){this.getService(y).catch("Error in setUiState: ",t)}},this.getUiState=n=>{try{return n?.ha||this.trackEvent(X.Events.Core.GET_UI_STATE_TRIGGERED),this.getService(at).getUIState$()}catch(e){return this.getService(y).catch("Error in getUiState: ",e),se({})}},this.resetVeltButtonState=(n,e)=>{try{e?.ha||this.trackEvent(X.Events.Core.RESET_VELT_BUTTON_STATE_TRIGGERED,{payload:{config:n}}),this.getService(g0).resetVeltButtonState(n)}catch(t){this.getService(y).catch("Error in resetVeltButtonState: ",t)}},this.getService(y).log("%c[WB] Creating CLASS: Snippyly","color: blue;")}trackEvent(o,n={},e=!0){try{n||(n={}),n=T(I({},n),{source:"external"}),this.getService(tt).trackAuthenticatedEvent(o,n,e)}catch(t){this.getService(y).catch("Error in _trackEvent: ",t);return}}};var Wce=(()=>{let o=class o{constructor(){this.veltElement=!0}ngOnInit(){}};o.\u0275fac=function(t){return new(t||o)},o.\u0275cmp=O({type:o,selectors:[["app-external-styles"]],hostVars:1,hostBindings:function(t,r){t&2&&x("data-velt-element",r.veltElement)},standalone:!1,decls:0,vars:0,template:function(t,r){},styles:[`.cdk-overlay-container,.cdk-global-overlay-wrapper{pointer-events:none;top:0;left:0;height:100%;width:100%}.cdk-overlay-container{position:fixed;z-index:1000}.cdk-overlay-container:empty{display:none}.cdk-global-overlay-wrapper{display:flex;position:absolute;z-index:1000}.cdk-overlay-pane{position:absolute;pointer-events:auto;box-sizing:border-box;display:flex;max-width:100%;max-height:100%;z-index:1000}.cdk-overlay-backdrop{position:absolute;inset:0;pointer-events:auto;-webkit-tap-highlight-color:rgba(0,0,0,0);opacity:0;z-index:1000;transition:opacity .4s cubic-bezier(.25,.8,.25,1)}@media (prefers-reduced-motion){.cdk-overlay-backdrop{transition-duration:1ms}}.cdk-overlay-backdrop-showing{opacity:1}@media (forced-colors: active){.cdk-overlay-backdrop-showing{opacity:.6}}.cdk-overlay-dark-backdrop{background:#00000052}.cdk-overlay-transparent-backdrop{transition:visibility 1ms linear,opacity 1ms linear;visibility:hidden;opacity:1}.cdk-overlay-transparent-backdrop.cdk-overlay-backdrop-showing,.cdk-high-contrast-active .cdk-overlay-transparent-backdrop{opacity:0;visibility:visible}.cdk-overlay-backdrop-noop-animation{transition:none}.cdk-overlay-connected-position-bounding-box{position:absolute;display:flex;flex-direction:column;min-width:1px;min-height:1px;z-index:1000}.cdk-global-scrollblock{position:fixed;width:100%;overflow-y:scroll}html{--velt-base-rem-unit: 1}velt-wireframe{display:none!important}:root{--legacy-velt-neutral-0: #000000;--legacy-velt-neutral-1: #141416;--legacy-velt-neutral-2: #23262F;--legacy-velt-neutral-3: #353945;--legacy-velt-neutral-4: #777E90;--legacy-velt-neutral-5: #B1B5C3;--legacy-velt-neutral-6: #E6E8EC;--legacy-velt-neutral-7: #F4F5F6;--legacy-velt-neutral-8: #FCFCFD;--legacy-velt-neutral-9: #FFFFFF;--legacy-velt-dark-1: #141416;--legacy-velt-dark-2: #222226;--legacy-velt-dark-3: #303034;--legacy-velt-dark-4: #404044;--legacy-velt-dark-5: #59595F;--legacy-velt-dark-6: #80808A;--legacy-velt-dark-7: #91919C;--legacy-velt-dark-8: #E5E5E9;--legacy-velt-primary-color: var(--legacy-velt-dark-1);--legacy-velt-primary-dark-color: var(--legacy-velt-dark-8);--legacy-velt-secondary-color: var(--legacy-velt-neutral-4);--legacy-velt-secondary-dark-color: var(--legacy-velt-dark-7);--legacy-velt-bg-color: var(--legacy-velt-neutral-8);--legacy-velt-bg-dark-color: var(--legacy-velt-dark-1);--legacy-velt-border-color: var(--legacy-velt-neutral-6);--legacy-velt-border-dark-color: var(--legacy-velt-dark-3);--legacy-velt-grey-2-color: #D4D6DF;--legacy-velt-grey-2-dark-color: var(--legacy-velt-dark-4);--legacy-velt-grey-4-color: #989898;--legacy-velt-grey-4-dark-color: var(--legacy-velt-dark-6);--legacy-velt-status-open-color: #625DF5;--legacy-velt-status-in-progress-color: #ECB000;--legacy-velt-status-resolved-color: #00C48C;--legacy-velt-purple: #625DF5;--legacy-velt-orange: #ECB000;--legacy-velt-green: #0DCF82;--legacy-velt-blue: #0d6efd;--legacy-velt-primary-btn-color: var(--legacy-velt-purple);--legacy-velt-hyperlink-color: var(--legacy-velt-purple);--legacy-velt-grey-btn-color: var(--legacy-velt-neutral-5);--legacy-velt-header-btn-color: var(--legacy-velt-neutral-3);--legacy-velt-dropdown-item-color: var(--legacy-velt-neutral-2);--legacy-velt-avatar-size: 2rem;--velt-default-font-family: sans-serif;--Icon-Size-Small: 12px;--Icon-Size-Medium: 16px;--Icon-Size-Large: 24px}:root[data-velt-theme=dark]{--legacy-velt-primary-color: var(--legacy-velt-primary-dark-color);--legacy-velt-secondary-color: var(--legacy-velt-secondary-dark-color);--legacy-velt-bg-color: var(--legacy-velt-bg-dark-color);--legacy-velt-border-color: var(--legacy-velt-border-dark-color);--legacy-velt-grey-2-color: var(--legacy-velt-grey-2-dark-color);--legacy-velt-grey-4-color: var(--legacy-velt-grey-4-dark-color);--legacy-velt-primary-btn-color: var(--legacy-velt-border-dark-color);--legacy-velt-hyperlink-color: var(--legacy-velt-secondary-dark-color);--legacy-velt-grey-btn-color: var(--legacy-velt-secondary-dark-color);--legacy-velt-header-btn-color: var(--legacy-velt-secondary-dark-color);--legacy-velt-dropdown-item-color: var(--legacy-velt-secondary-dark-color)}:root{--legacy-velt-tool-padding: 6px;--legacy-velt-tool-icon-size: 1.5rem;--legacy-velt-tool-icon-color: var(--legacy-velt-neutral-4);--legacy-velt-tool-border-radius: 50px;--legacy-velt-tool-border-color: transparent;--legacy-velt-tool-border: 2px solid var(--legacy-velt-tool-border-color);--legacy-velt-tool-bg-color: transparent;--legacy-velt-tool-focus-icon-size: var(--legacy-velt-tool-icon-size);--legacy-velt-tool-focus-icon-color: var(--legacy-velt-tool-icon-color);--legacy-velt-tool-focus-border-radius: var(--legacy-velt-tool-border-radius);--legacy-velt-tool-focus-border-color: var(--legacy-velt-neutral-7);--legacy-velt-tool-focus-border: 2px solid var(--legacy-velt-tool-focus-border-color);--legacy-velt-tool-focus-bg-color: var(--legacy-velt-tool-bg-color);--legacy-velt-tool-hover-icon-size: var(--legacy-velt-tool-icon-size);--legacy-velt-tool-hover-icon-color: var(--legacy-velt-neutral-3);--legacy-velt-tool-hover-border-radius: var(--legacy-velt-tool-border-radius);--legacy-velt-tool-hover-border-color: var(--legacy-velt-neutral-7);--legacy-velt-tool-hover-border: 2px solid var(--legacy-velt-tool-hover-border-color);--legacy-velt-tool-hover-bg-color: var(--legacy-velt-neutral-7);--legacy-velt-tool-active-icon-size: var(--legacy-velt-tool-icon-size);--legacy-velt-tool-active-icon-color: var(--legacy-velt-neutral-9);--legacy-velt-tool-active-border-radius: var(--legacy-velt-tool-border-radius);--legacy-velt-tool-active-border-color: var(--legacy-velt-purple);--legacy-velt-tool-active-border: 2px solid var(--legacy-velt-tool-active-border-color);--legacy-velt-tool-active-bg-color: var(--legacy-velt-purple)}:root[data-velt-theme=dark],:root:not(data-velt-theme) velt-comment-tool[dark],:root:not(data-velt-theme) velt-sidebar-button[dark],:root:not(data-velt-theme) velt-arrow-tool[dark],:root:not(data-velt-theme) velt-reaction-tool[dark],:root:not(data-velt-theme) velt-huddle-tool[dark],:root:not(data-velt-theme) velt-recorder-tool[dark],:root:not(data-velt-theme) velt-user-invite-tool[dark],:root:not(data-velt-theme) velt-user-request-tool[dark],:root:not(data-velt-theme) velt-notifications-tool[dark],:root:not(data-velt-theme) app-recorder-all-tool-menu[dark],:root:not(data-velt-theme) snippyly-recording-preview-steps-dialog[dark],:root:not(data-velt-theme) snippyly-recorder-control-panel-internal[dark],:root:not(data-velt-theme) snippyly-recorder-player-internal[dark],:root:not(data-velt-theme) velt-recorder-player-expanded[dark]:root:not(data-velt-theme) app-transcription-panel[dark]{--legacy-velt-tool-icon-size: 1.5rem;--legacy-velt-tool-icon-color: var(--legacy-velt-neutral-4);--legacy-velt-tool-border-radius: 50px;--legacy-velt-tool-border-color: transparent;--legacy-velt-tool-border: 2px solid var(--legacy-velt-tool-border-color);--legacy-velt-tool-bg-color: transparent;--legacy-velt-tool-focus-icon-size: var(--legacy-velt-tool-icon-size);--legacy-velt-tool-focus-icon-color: var(--legacy-velt-tool-icon-color);--legacy-velt-tool-focus-border-radius: var(--legacy-velt-tool-border-radius);--legacy-velt-tool-focus-border-color: var(--legacy-velt-neutral-2);--legacy-velt-tool-focus-border: 2px solid var(--legacy-velt-tool-focus-border-color);--legacy-velt-tool-focus-bg-color: var(--legacy-velt-tool-bg-color);--legacy-velt-tool-hover-icon-size: var(--legacy-velt-tool-icon-size);--legacy-velt-tool-hover-icon-color: var(--legacy-velt-neutral-5);--legacy-velt-tool-hover-border-radius: var(--legacy-velt-tool-border-radius);--legacy-velt-tool-hover-border-color: var(--legacy-velt-neutral-1);--legacy-velt-tool-hover-border: 2px solid var(--legacy-velt-tool-hover-border-color);--legacy-velt-tool-hover-bg-color: var(--legacy-velt-neutral-1);--legacy-velt-tool-active-icon-size: var(--legacy-velt-tool-icon-size);--legacy-velt-tool-active-icon-color: var(--legacy-velt-neutral-9);--legacy-velt-tool-active-border-radius: var(--legacy-velt-tool-border-radius);--legacy-velt-tool-active-border-color: var(--legacy-velt-purple);--legacy-velt-tool-active-border: 2px solid var(--legacy-velt-tool-active-border-color);--legacy-velt-tool-active-bg-color: var(--legacy-velt-purple)}snippyly-user-avatar,velt-user-avatar{--legacy-velt-user-avatar-size: var(--legacy-velt-avatar-size);--legacy-velt-user-avatar-initial-font-size: .8}snippyly-follow-overlay,velt-follow-overlay{--legacy-velt-follow-overlay-bg-color: var(--legacy-velt-bg-color);--legacy-velt-follow-overlay-text-color: var(--legacy-velt-primary-color);--legacy-velt-follow-overlay-btn-color: var(--legacy-velt-neutral-6);--legacy-velt-follow-overlay-btn-hover-color: var(--legacy-velt-neutral-5);--legacy-velt-follow-overlay-border-color: var(--legacy-velt-border-color)}snippyly-follow-overlay[dark],velt-follow-overlay[dark]{--legacy-velt-follow-overlay-bg-color: var(--legacy-velt-bg-dark-color);--legacy-velt-follow-overlay-text-color: var(--legacy-velt-primary-dark-color);--legacy-velt-follow-overlay-border-color: var(--legacy-velt-border-dark-color)}snippyly-cursor,velt-cursor{--legacy-velt-cursor-avatar-size: var(--legacy-velt-avatar-size);--legacy-velt-cursor-video-size: 4.2rem}snippyly-reaction-tool,velt-reaction-tool,app-reaction-tool{--legacy-velt-reaction-tool-icon-size: 2rem;--legacy-velt-reaction-tool-border-radius: 50px;--legacy-velt-reaction-tool-icon-color: #8F95B2;--legacy-velt-reaction-tool-hover-bg-color: #EAE8F9;--legacy-velt-reaction-tool-active-fill-color: white;--legacy-velt-reaction-tool-active-bg-color: var(--legacy-velt-purple)}snippyly-reaction-tool[dark],velt-reaction-tool[dark],app-reaction-tool[dark]{--legacy-velt-reaction-tool-icon-size: 2rem;--legacy-velt-reaction-tool-border-radius: 50px;--legacy-velt-reaction-tool-icon-color: #EAE8F9;--legacy-velt-reaction-tool-hover-bg-color: #8F95B2;--legacy-velt-reaction-tool-active-fill-color: white;--legacy-velt-reaction-tool-active-bg-color: var(--legacy-velt-purple)}velt-view-analytics-dialog{--legacy-velt-view-analytics-dialog-bg-color: #FFF;--legacy-velt-view-analytics-dialog-border-radius: 12px;--legacy-velt-view-analytics-dialog-border: 1px solid rgba(0, 0, 0, .08);--legacy-velt-view-analytics-dialog-box-shadow: 0px 0px 32px 0px rgba(0, 0, 0, .12);--legacy-velt-view-analytics-dialog-padding: 8px;--legacy-velt-view-analytics-dialog-total-views-count-color: #111;--legacy-velt-view-analytics-dialog-total-views-text-color: #625DF5;--legacy-velt-view-analytics-dialog-today-views-text-color: #848297;--legacy-velt-view-analytics-dialog-views-container-bg-color: #F4F3FF;--legacy-velt-view-analytics-dialog-user-name-color: #4C5366;--legacy-velt-view-analytics-dialog-user-timestamp-color: #959595;--legacy-velt-view-analytics-dialog-back-btn-color: #8F95B2}velt-view-analytics-dialog[dark]{--legacy-velt-view-analytics-dialog-bg-color: #131229;--legacy-velt-view-analytics-dialog-border-radius: 12px;--legacy-velt-view-analytics-dialog-border: 1px solid rgba(255, 255, 255, .08);--legacy-velt-view-analytics-dialog-box-shadow: 0px 0px 32px 0px rgba(0, 0, 0, .12);--legacy-velt-view-analytics-dialog-padding: 8px;--legacy-velt-view-analytics-dialog-total-views-count-color: #FFF;--legacy-velt-view-analytics-dialog-total-views-text-color: #9491F8;--legacy-velt-view-analytics-dialog-today-views-text-color: #848297;--legacy-velt-view-analytics-dialog-views-container-bg-color: rgba(244, 243, 255, .06);--legacy-velt-view-analytics-dialog-user-name-color: #FFF;--legacy-velt-view-analytics-dialog-user-timestamp-color: rgba(255, 255, 255, .4)}velt-reaction-pin-tooltip-internal{--Surface-Neutral-0: #FFF;--Surface-Neutral-2: #F5F5F5;--Surface-Neutral-3: #F0F0F0;--Text-Neutral-0: #0A0A0A;--Text-Neutral-3: #292929;--Text-Neutral-5: #525252;--Text-Neutral-9: #999;--Text-Brand-Primary: #625DF5}velt-reaction-pin-tooltip-internal[dark]{--Surface-Neutral-0: #0F0F0F;--Surface-Neutral-2: #1F1F1F;--Surface-Neutral-3: #2F2F2F;--Text-Neutral-0: #FFF;--Text-Neutral-3: #E0E0E0;--Text-Neutral-5: #C2C2C2;--Text-Neutral-9: #ADADAD;--Text-Brand-Primary: #9491F8}:root{--velt-border-radius-2xs: calc((.125rem + 0px) * var(--velt-base-rem-unit));--velt-border-radius-xs: calc((.25rem + 0px) * var(--velt-base-rem-unit));--velt-border-radius-sm: calc((.5rem + 0px) * var(--velt-base-rem-unit));--velt-border-radius-md: calc((.75rem + 0px) * var(--velt-base-rem-unit));--velt-border-radius-lg: calc((1rem + 0px) * var(--velt-base-rem-unit));--velt-border-radius-xl: calc((1.25rem + 0px) * var(--velt-base-rem-unit));--velt-border-radius-2xl: calc((1.5rem + 0px) * var(--velt-base-rem-unit));--velt-border-radius-3xl: calc((2rem + 0px) * var(--velt-base-rem-unit));--velt-border-radius-full: calc((5rem + 0px) * var(--velt-base-rem-unit));--velt-spacing-2xs: calc((.125rem + 0px) * var(--velt-base-rem-unit));--velt-spacing-xs: calc((.25rem + 0px) * var(--velt-base-rem-unit));--velt-spacing-sm: calc((.5rem + 0px) * var(--velt-base-rem-unit));--velt-spacing-md: calc((.75rem + 0px) * var(--velt-base-rem-unit));--velt-spacing-lg: calc((1rem + 0px) * var(--velt-base-rem-unit));--velt-spacing-xl: calc((1.25rem + 0px) * var(--velt-base-rem-unit));--velt-spacing-2xl: calc((1.5rem + 0px) * var(--velt-base-rem-unit));--velt-font-size-2xs: calc((.625rem + 0px) * var(--velt-base-rem-unit));--velt-font-size-xs: calc((.75rem + 0px) * var(--velt-base-rem-unit));--velt-font-size-sm: calc((.875rem + 0px) * var(--velt-base-rem-unit));--velt-font-size-md: calc((1rem + 0px) * var(--velt-base-rem-unit));--velt-font-size-lg: calc((1.5rem + 0px) * var(--velt-base-rem-unit));--velt-font-size-xl: calc((1.75rem + 0px) * var(--velt-base-rem-unit));--velt-font-size-2xl: calc((2rem + 0px) * var(--velt-base-rem-unit));--velt-light-mode-green: #0DCF82;--velt-light-mode-magenta: #A259FE;--velt-light-mode-amber: #FF7162;--velt-light-mode-purple: #625DF5;--velt-light-mode-cyan: #4BC9F0;--velt-light-mode-orange: #FE965C;--velt-light-mode-black: #080808;--velt-light-mode-white: #FFFFFF;--velt-light-mode-gray: #EBEBEB;--velt-light-mode-error: #FF7162;--velt-light-mode-error-hover: #DE5041;--velt-light-mode-error-foreground: #FFFFFF;--velt-light-mode-error-light: #FFF4F2;--velt-light-mode-error-transparent: rgba(255, 113, 98, .08);--velt-light-mode-warning: #FFCD2E;--velt-light-mode-warning-hover: #C69400;--velt-light-mode-warning-foreground: #474747;--velt-light-mode-warning-light: #FFFBEE;--velt-light-mode-warning-transparent: rgba(255, 205, 46, .08);--velt-light-mode-success: #198F65;--velt-light-mode-success-hover: #006B41;--velt-light-mode-success-foreground: #FFFFFF;--velt-light-mode-success-light: #EDF6F3;--velt-light-mode-success-transparent: rgba(25, 143, 101, .08);--velt-light-mode-accent: #625DF5;--velt-light-mode-accent-text: #625DF5;--velt-light-mode-accent-hover: #534FCF;--velt-light-mode-accent-foreground: #FFFFFF;--velt-light-mode-accent-light: #F2F2FE;--velt-light-mode-accent-transparent: rgba(148, 145, 248, .08);--velt-light-mode-text-0: #0A0A0A;--velt-light-mode-text-1: #141414;--velt-light-mode-text-2: #1F1F1F;--velt-light-mode-text-3: #292929;--velt-light-mode-text-4: #3D3D3D;--velt-light-mode-text-5: #525252;--velt-light-mode-text-6: #666666;--velt-light-mode-text-7: #7A7A7A;--velt-light-mode-text-8: #858585;--velt-light-mode-text-9: #999999;--velt-light-mode-text-10: #B8B8B8;--velt-light-mode-text-11: #A3A3A3;--velt-light-mode-text-12: #8F8F8F;--velt-light-mode-background-0: #FFFFFF;--velt-light-mode-background-1: #FAFAFA;--velt-light-mode-background-2: #F5F5F5;--velt-light-mode-background-3: #F0F0F0;--velt-light-mode-background-4: #EBEBEB;--velt-light-mode-background-5: #E5E5E5;--velt-light-mode-background-6: #E0E0E0;--velt-light-mode-background-7: #DBDBDB;--velt-light-mode-background-8: #D6D6D6;--velt-light-mode-background-9: #D1D1D1;--velt-light-mode-background-10: #CCCCCC;--velt-light-mode-border-0: #FFFFFF;--velt-light-mode-border-1: #FAFAFA;--velt-light-mode-border-2: #F5F5F5;--velt-light-mode-border-3: #F0F0F0;--velt-light-mode-border-4: #EBEBEB;--velt-light-mode-border-5: #E5E5E5;--velt-light-mode-border-6: #E0E0E0;--velt-light-mode-border-7: #DBDBDB;--velt-light-mode-border-8: #D6D6D6;--velt-light-mode-border-9: #D1D1D1;--velt-light-mode-border-10: #CCCCCC;--velt-light-mode-background-transparent: rgba(255, 255, 255, .8);--velt-light-mode-border-transparent: rgba(0, 0, 0, .16);--velt-light-mode-animation-transparent: rgba(255, 255, 255, .2);--velt-dark-mode-green: #0DCF82;--velt-dark-mode-magenta: #A259FE;--velt-dark-mode-amber: #FF7162;--velt-dark-mode-purple: #625DF5;--velt-dark-mode-cyan: #4BC9F0;--velt-dark-mode-orange: #FE965C;--velt-dark-mode-black: #080808;--velt-dark-mode-white: #FFFFFF;--velt-dark-mode-gray: #EBEBEB;--velt-dark-mode-error: #FF7162;--velt-dark-mode-error-hover: #DE5041;--velt-dark-mode-error-foreground: #FFFFFF;--velt-dark-mode-error-light: #FFF4F2;--velt-dark-mode-error-transparent: rgba(255, 113, 98, .08);--velt-dark-mode-warning: #FFCD2E;--velt-dark-mode-warning-hover: #C69400;--velt-dark-mode-warning-foreground: #474747;--velt-dark-mode-warning-light: #FFFBEE;--velt-dark-mode-warning-transparent: rgba(255, 205, 46, .08);--velt-dark-mode-success: #198F65;--velt-dark-mode-success-hover: #006B41;--velt-dark-mode-success-foreground: #FFFFFF;--velt-dark-mode-success-light: #EDF6F3;--velt-dark-mode-success-transparent: rgba(25, 143, 101, .08);--velt-dark-mode-accent: #625DF5;--velt-dark-mode-accent-text: #9491F8;--velt-dark-mode-accent-hover: #534FCF;--velt-dark-mode-accent-foreground: #FFFFFF;--velt-dark-mode-accent-light: #F2F2FE;--velt-dark-mode-accent-transparent: rgba(148, 145, 248, .08);--velt-dark-mode-text-0: #FFFFFF;--velt-dark-mode-text-1: #F5F5F5;--velt-dark-mode-text-2: #EBEBEB;--velt-dark-mode-text-3: #E0E0E0;--velt-dark-mode-text-4: #D6D6D6;--velt-dark-mode-text-5: #C2C2C2;--velt-dark-mode-text-6: #ADADAD;--velt-dark-mode-text-7: #8F8F8F;--velt-dark-mode-text-8: #7A7A7A;--velt-dark-mode-text-9: #666666;--velt-dark-mode-text-10: #525252;--velt-dark-mode-text-11: #474747;--velt-dark-mode-text-12: #3D3D3D;--velt-dark-mode-background-0: #0F0F0F;--velt-dark-mode-background-1: #1A1A1A;--velt-dark-mode-background-2: #1F1F1F;--velt-dark-mode-background-3: #242424;--velt-dark-mode-background-4: #292929;--velt-dark-mode-background-5: #2E2E2E;--velt-dark-mode-background-6: #333333;--velt-dark-mode-background-7: #383838;--velt-dark-mode-background-8: #3D3D3D;--velt-dark-mode-background-9: #424242;--velt-dark-mode-background-10: #474747;--velt-dark-mode-border-0: #0F0F0F;--velt-dark-mode-border-1: #1A1A1A;--velt-dark-mode-border-2: #1F1F1F;--velt-dark-mode-border-3: #242424;--velt-dark-mode-border-4: #292929;--velt-dark-mode-border-5: #2E2E2E;--velt-dark-mode-border-6: #333333;--velt-dark-mode-border-7: #383838;--velt-dark-mode-border-8: #3D3D3D;--velt-dark-mode-border-9: #424242;--velt-dark-mode-border-10: #474747;--velt-dark-mode-background-transparent: rgba(0, 0, 0, .8);--velt-dark-mode-border-transparent: rgba(255, 255, 255, .16);--velt-dark-mode-animation-transparent: rgba(255, 255, 255, .2);--velt-comment-pin-z-index: 2147483557;--velt-arrow-z-index: 2147483557;--velt-recorder-player-z-index: 2147483557;--velt-cursor-z-index: 2147483647;--velt-persistent-comment-frame-z-index: 2147483647;--velt-toast-popup-z-index: 2147483647;--velt-live-state-sync-overlay-z-index: 2147483647;--velt-follow-mode-overlay-z-index: 2147483647;--velt-comments-minimap-z-index: 2147483637;--velt-global-overlay-z-index: 2147483637}*[data-snippyly-element=true],*[data-velt-element=true]{font-family:var(--velt-default-font-family)}.cdk-overlay-container{z-index:var(--velt-global-overlay-z-index)!important}.cdk-overlay-container .cdk-overlay-pane.mat-mdc-dialog-panel{max-width:var(--mat-dialog-container-max-width, 80vw);min-width:var(--mat-dialog-container-min-width, 0)}mat-dialog-container .mat-mdc-dialog-surface.mdc-dialog__surface{background-color:#fff;padding:24px}mat-dialog-container .mat-mdc-dialog-surface.mdc-dialog__surface .mdc-dialog__title:before{height:unset}mat-dialog-container .mat-mdc-dialog-actions{padding:var(--mat-dialog-actions-padding, 8px)}.mat-mdc-autocomplete-panel{padding:0!important;border-radius:var(--velt-border-radius-md)!important}.cdk-overlay-pane{background-color:transparent!important;border:none!important;box-shadow:none!important}.cdk-overlay-pane.mat-mdc-tooltip-panel .mat-mdc-tooltip{color:#fff;background-color:#0b0b0b;border:1px solid #eeeeee;border-radius:4px;padding:8px 12px;font-size:14px}.mat-mdc-menu-panel.velt-menu{box-shadow:none}video.flip{transform:rotateY(180deg);-webkit-transform:rotateY(180deg);-moz-transform:rotateY(180deg)}body[data-velt-huddle-on-cursor-mode] .cdk-overlay-container{z-index:calc(var(--velt-global-overlay-z-index, 2147483637) - 1)!important}body[data-velt-huddle-on-cursor-mode]:not(.show-pin-cursor){cursor:none!important}body[data-velt-huddle-on-cursor-mode]:not(.show-pin-cursor) *{cursor:none!important}body.snippyly-add-comment-mode,body.snippyly-add-comment-mode *{-webkit-user-select:none!important;user-select:none!important}body.snippyly-add-comment-mode [data-velt-iframe-container=true][data-velt-iframe-container-static=true]{position:relative!important}body.snippyly-add-comment-mode [data-velt-iframe-container=true]:before{content:""!important;position:absolute!important;inset:0!important;z-index:1!important}body[data-velt-ongoing-recording=screen][data-velt-comment-recording=true] [data-velt-element=true]:not(snippyly-comment-text-portal):not(velt-recorder-control-panel):not([data-velt-screen-recorder-panel=true]){display:none!important}body[data-velt-ongoing-recording=screen][data-velt-comment-recording=true] snippyly-text-highlight.snippyly-text-highlight{color:inherit!important}body[data-velt-ongoing-recording=screen][data-velt-comment-recording=true] snippyly-text-highlight.snippyly-text-highlight .comment-text-highlight{color:inherit!important;background-color:inherit!important;cursor:inherit!important}body[data-velt-ongoing-recording=screen][data-velt-comment-recording=true] snippyly-text-highlight.snippyly-text-highlight .comment-text-highlight.selected{background-color:inherit!important}body [data-velt-pdf-viewer=true] snippyly-text-highlight.snippyly-text-highlight snippyly-comment-text-portal,body [data-velt-pdf-viewer=true] snippyly-text-highlight.snippyly-text-highlight velt-comment-text-portal{font-family:inherit!important}body [data-velt-pdf-viewer=true] snippyly-text-highlight.snippyly-text-highlight .comment-text-highlight{color:transparent!important}body [data-velt-pdf-viewer=true] snippyly-text-highlight.snippyly-text-highlight .comment-text-highlight.selected{color:transparent!important}body [data-velt-pdf-viewer=true] snippyly-text-highlight.snippyly-text-highlight .comment-annotation-number{display:none!important}:where([data-velt-pdf-viewer=true]) .textLayer:is(:has([data-snippyly-pin-host],[data-velt-pin-host]),:has(snippyly-comment-pin-portal,snippyly-tag-pin-portal,snippyly-recorder-pin-portal,snippyly-arrow-pin-portal,snippyly-area-pin-portal,velt-comment-pin-portal,velt-tag-pin-portal,velt-recorder-pin-portal,velt-arrow-pin-portal,velt-area-pin-portal)){opacity:1!important;visibility:visible!important}:where([data-velt-pdf-viewer=true]) .textLayer:is(:has([data-snippyly-pin-host],[data-velt-pin-host]),:has(snippyly-comment-pin-portal,snippyly-tag-pin-portal,snippyly-recorder-pin-portal,snippyly-arrow-pin-portal,snippyly-area-pin-portal,velt-comment-pin-portal,velt-tag-pin-portal,velt-recorder-pin-portal,velt-arrow-pin-portal,velt-area-pin-portal)) snippyly-text-highlight.snippyly-text-highlight .comment-text-highlight{opacity:.2!important}[data-snippyly-comment-pin-host][data-snippyly-comment-pin-host-static],[data-snippyly-tag-pin-host][data-snippyly-tag-pin-host-static],[data-snippyly-recorder-pin-host][data-snippyly-recorder-pin-host-static],[data-snippyly-arrow-pin-host][data-snippyly-arrow-pin-host-static],[data-snippyly-area-pin-host][data-snippyly-area-pin-host-static],[data-velt-comment-pin-host][data-velt-comment-pin-host-static],[data-velt-tag-pin-host][data-velt-tag-pin-host-static],[data-velt-recorder-pin-host][data-velt-recorder-pin-host-static],[data-velt-arrow-pin-host][data-velt-arrow-pin-host-static],[data-velt-area-pin-host][data-velt-area-pin-host-static]{position:relative}[data-velt-comment-pin-host][data-velt-comment-pin-active=true],[data-velt-area-pin-host][data-velt-area-pin-active=true]{opacity:1!important;visibility:visible!important}.s-display-none,.velt-display-none{display:none!important}.s-flex,.velt-display-flex{display:flex!important}.velt-items-center{align-items:center!important}.s-background-blur-1{-webkit-backdrop-filter:blur(4px)!important;backdrop-filter:blur(4px)!important}.s-background-blur-2{-webkit-backdrop-filter:blur(8px)!important;backdrop-filter:blur(8px)!important}.s-background-blur-3{-webkit-backdrop-filter:blur(12px)!important;backdrop-filter:blur(12px)!important}.s-background-blur-4{-webkit-backdrop-filter:blur(16px)!important;backdrop-filter:blur(16px)!important}.s-tooltip{position:relative!important}.s-tooltip .s-tooltiptext{visibility:hidden!important;block-size:auto!important;width:max-content!important;top:120%!important;background-color:var(--legacy-velt-bg-color);border:1px solid var(--legacy-velt-border-color);color:var(--legacy-velt-primary-color)!important;text-align:left!important;padding:.5em .75em!important;border-radius:6px!important;font-style:normal!important;font-weight:400!important;font-size:12px!important;line-height:2em!important;box-shadow:var(--legacy-velt-box-shadow)!important;position:absolute!important;z-index:1!important;opacity:0!important;transition:opacity .5s!important;left:50%!important;transform:translate(-50%)!important}.s-tooltip .s-tooltiptext:after{content:" "!important;position:absolute!important;top:0!important;left:50%!important;width:12px!important;height:12px!important;border-left:1px solid var(--legacy-velt-border-color);border-top:1px solid var(--legacy-velt-border-color);background-color:var(--legacy-velt-bg-color);border-radius:4px!important;transform:translate(-50%,-41%) rotate(45deg)!important;transform-origin:center!important}.s-tooltip .s-tooltiptext:before{content:" ";position:absolute;top:0;left:50%;width:24px;height:24px;transform:translate(-50%,-41%);background:transparent}.s-tooltip .s-tooltiptext.left{top:50%!important;right:120%!important;transform:translateY(-50%)!important}.s-tooltip .s-tooltiptext.left:after{transform:translate(41%,-50%) rotate(45deg)!important;transform-origin:center!important;left:unset!important;right:0!important;top:50%!important}.s-tooltip .s-tooltiptext.left.top{top:100%!important;transform:translateY(-45%)!important}.s-tooltip .s-tooltiptext.left.top:after{transform:translate(41%,66%) rotate(45deg)!important;top:0!important}.s-tooltip:hover .s-tooltiptext{visibility:visible!important;opacity:1!important}.s-tooltip-light .s-tooltiptext{background-color:#fff!important;color:#000!important;box-shadow:0 2px 8px -2px #9f9f9f!important}.s-tooltip-light .s-tooltiptext:after{background-color:#fff!important}.s-tooltip-link{font-style:normal!important;font-weight:400!important;font-size:12px!important;line-height:calc((1.5rem + 0px) * var(--velt-base-rem-unit))!important;color:#fff!important}.s-cursor-pointer,.velt-cursor-pointer{cursor:pointer!important}.s-shake{animation:shake .82s cubic-bezier(.36,.07,.19,.97) both;transform:translateZ(0);backface-visibility:hidden;perspective:1000px}@keyframes shake{10%,90%{transform:translate3d(-1px,0,0)}20%,80%{transform:translate3d(2px,0,0)}30%,50%,70%{transform:translate3d(-4px,0,0)}40%,60%{transform:translate3d(4px,0,0)}}app-render-timer-wrapper{width:100%;height:100%}velt-comment-text[comment-available=true]{color:var(--Constant-Warning---Text, #E2A600);background-color:#e2a6001a;border-bottom:1px solid #E2A600}
|
|
404
|
+
`))},dependencies:[_m],styles:["[_nghost-%COMP%]{display:inline-flex;align-items:center}.skeleton-loader[_ngcontent-%COMP%]{display:inline-block;background:linear-gradient(-90deg,#f0f0f0,#e2e2e2,#f0f0f0);background-size:400% 400%;animation:_ngcontent-%COMP%_skeleton-loading 1.2s ease-in-out 4;height:var(--velt-skeleton-loader-height);width:var(--velt-skeleton-loader-width);border-radius:var(--velt-skeleton-loader-border-radius)}@keyframes _ngcontent-%COMP%_skeleton-loading{0%{background-position:100% 0}to{background-position:-100% 0}}"]});let i=o;return i})();var nRe=["userAvatarRef"],iRe=["*"];function oRe(i,o){if(i&1&&(_(0,"div",7),w(1,"span",8),b()),i&2){let n=l(2).ngIf,e=l();it("background-color",n.background||"#625DF5"),x("data-testid",e.componentId+"-initial-container"),m(),it("color",n.textColor||"#FFFFFF"),x("data-modal-author-initial",n.initial)("data-testid",e.componentId+"-initial")}}function rRe(i,o){if(i&1){let n=q();_(0,"img",9),z("error",function(){N(n);let t=l(3);return F(t.onImageLoadError())})("load",function(){N(n);let t=l(3);return F(t.onImageLoaded())}),b()}if(i&2){let n=l(2).ngIf,e=l();it("display",n.imgLoaded?"":"none !important"),c("src",n.src,mn),x("alt","User avatar")("data-testid",e.componentId+"-image")}}function aRe(i,o){if(i&1&&(f(0),_(1,"div",4,1),g(3,oRe,2,7,"div",5)(4,rRe,1,5,"ng-template",6),Nt(5),b(),v()),i&2){let n=l().ngIf,e=l();m(),x("data-testid",e.componentId+"-container")("aria-label","User avatar"),m(2),c("ngIf",!n.imgLoaded),m(),c("ngIf",!n.imgLoadError)}}function sRe(i,o){if(i&1&&w(0,"velt-skeleton-loader-internal",10),i&2){let n=l().ngIf;c("height",n.size?n.size+"px":"100%")("width",n.size?n.size+"px":"100%")}}function lRe(i,o){if(i&1&&(f(0),g(1,aRe,6,4,"ng-container",3)(2,sRe,1,2,"ng-template",null,0,Ee),v()),i&2){let n=o.ngIf,e=ce(3);m(),c("ngIf",n.imgLoaded||(n==null||n.user==null?null:n.user.photoUrl)||(n==null||n.user==null?null:n.user.name)||(n==null||n.user==null?null:n.user.email)||(n==null?null:n.initial))("ngIfElse",e)}}var Wn=(()=>{let o=class o{constructor(e,t,r){this.authService=e,this.loggingService=t,this.elementRef=r,this.initial="",this.background="#625DF5",this.textColor="#FFFFFF",this.userAvatarRef=new R(null),this.componentConfigSignal=xe({background:"#625DF5",textColor:"#FFFFFF",initial:"",src:"",imgLoaded:!1,imgLoadError:!1}),this.veltElement=!0,this.componentId="velt-user-avatar"}ngOnInit(){try{this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in UserAvatarComponent ngOnInit:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("role","img"),e.setAttribute("data-testid",this.componentId+"-container"),this.updateAriaLabel()}catch(e){this.loggingService.catch("Error in UserAvatarComponent setupA11yAttributes:",e)}}updateAriaLabel(){try{this.elementRef.nativeElement.setAttribute("aria-label","User avatar")}catch(e){this.loggingService.catch("Error in UserAvatarComponent updateAriaLabel:",e)}}ngAfterViewInit(){this.updateAvatarSize()}ngOnChanges(e){try{if(e&&Object.keys(e).forEach(t=>{this.componentConfigSignal.update(r=>(r=T(I({},r),{[t]:e[t].currentValue}),r))}),e?.user){let t=e.user.currentValue;t?.photoUrl!==this.componentConfigSignal().src&&this.componentConfigSignal.update(r=>(r=T(I({},r),{src:t?.photoUrl,imgLoaded:!1,imgLoadError:!1}),r)),this.componentConfigSignal.update(r=>(r=T(I({},r),{background:t?.color||this.authService.getUserAvatarColor(t?.userId)}),r)),this.componentConfigSignal.update(r=>(r=T(I({},r),{textColor:t?.textColor||this.authService.getUserTextColor(t?.userId)}),r)),this.componentConfigSignal.update(r=>(r=T(I({},r),{initial:t?.initial||t?.name?.charAt(0)||t?.email?.charAt(0)}),r))}e?.size&&this.updateAvatarSize(),e?.width&&this.updateAvatarSize(),e?.height&&this.updateAvatarSize()}catch(t){this.loggingService.catch("Error in UserAvatarComponent ngOnChanges: ",t)}}onImageLoadError(){try{this.componentConfigSignal.update(e=>(e=T(I({},e),{imgLoadError:!0}),e))}catch(e){this.loggingService.catch("Error in UserAvatarComponent onImageLoadError: ",e)}}onImageLoaded(){try{this.componentConfigSignal.update(e=>(e=T(I({},e),{imgLoaded:!0}),e))}catch(e){this.loggingService.catch("Error in UserAvatarComponent onImageLoaded: ",e)}}updateAvatarSize(){try{this.elementRef?.nativeElement&&(this.size&&(this.elementRef.nativeElement.style.setProperty("--legacy-velt-user-avatar-height",this.size+"px"),this.elementRef.nativeElement.style.setProperty("--legacy-velt-user-avatar-width",this.size+"px")),this.width&&this.elementRef.nativeElement.style.setProperty("--legacy-velt-user-avatar-width",this.size+"px"),this.height&&this.elementRef.nativeElement.style.setProperty("--legacy-velt-user-avatar-height",this.size+"px"))}catch(e){this.loggingService.catch("Error in UserAvatarComponent updateAvatarSize: ",e)}}};o.\u0275fac=function(t){return new(t||o)(h(je),h(y),h(R))},o.\u0275cmp=O({type:o,selectors:[["snippyly-user-avatar"]],viewQuery:function(t,r){if(t&1&&nt(nRe,5),t&2){let a;Xe(a=Qe())&&(r.userAvatarRef=a.first)}},hostVars:1,hostBindings:function(t,r){t&2&&x("data-velt-element",r.veltElement)},inputs:{initial:"initial",src:"src",background:"background",textColor:"textColor",size:"size",width:"width",height:"height",user:"user"},standalone:!1,features:[Ze],ngContentSelectors:iRe,decls:1,vars:1,consts:[["loadingTemplateRef",""],["userAvatarRef",""],[4,"ngIf"],[4,"ngIf","ngIfElse"],["velt-ignore-change-detection","true","role","img",1,"s-user-avatar-container","velt-user-avatar"],["class","s-user-avatar-initial-container velt-user-avatar--initial-container","aria-hidden","componentConfig.imgLoaded",3,"background-color",4,"ngIf"],[3,"ngIf"],["aria-hidden","componentConfig.imgLoaded",1,"s-user-avatar-initial-container","velt-user-avatar--initial-container"],[1,"s-user-avatar-initial","velt-user-avatar--initial"],["referrerpolicy","no-referrer","velt-ignore-change-detection","true",1,"s-user-avatar-image","velt-user-avatar--image",3,"error","load","src"],["borderRadius","100%",3,"height","width"]],template:function(t,r){t&1&&(Bt(),g(0,lRe,4,2,"ng-container",2)),t&2&&c("ngIf",r.componentConfigSignal())},dependencies:[Z,Fo],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}[_nghost-%COMP%]:empty{display:none}*[_ngcontent-%COMP%]{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;color:#000;font-size:calc((1rem + 0px) * var(--velt-base-rem-unit));position:static}*[_ngcontent-%COMP%]:empty{display:revert}.s-user-avatar-container[_ngcontent-%COMP%]{position:relative;width:calc((var(--legacy-velt-user-avatar-size) + 0px) * var(--velt-base-rem-unit));height:calc((var(--legacy-velt-user-avatar-size) + 0px) * var(--velt-base-rem-unit));border-radius:50%;display:inline-block}velt-skeleton-loader-internal[_ngcontent-%COMP%]{width:calc((var(--legacy-velt-user-avatar-size) + 0px) * var(--velt-base-rem-unit));height:calc((var(--legacy-velt-user-avatar-size) + 0px) * var(--velt-base-rem-unit));border-radius:50%}.s-user-avatar-initial-container[_ngcontent-%COMP%]{width:100%;height:100%;display:flex;justify-content:center;border-radius:50%;align-items:center;font-size:calc((.8rem + 0px) * var(--velt-base-rem-unit))}.s-user-avatar-image[_ngcontent-%COMP%]{object-fit:cover;border-radius:50%;width:100%;height:100%;display:flex}.s-user-avatar-initial[_ngcontent-%COMP%]{color:#fff;font-size:calc((var(--legacy-velt-user-avatar-initial-font-size) + 0px) * var(--velt-base-rem-unit));position:relative;text-transform:uppercase}.s-user-avatar-initial[_ngcontent-%COMP%]:after{content:attr(data-modal-author-initial);position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.velt-user-avatar[_ngcontent-%COMP%], velt-skeleton-loader-internal[_ngcontent-%COMP%]{height:var(--legacy-velt-user-avatar-height, calc((var(--legacy-velt-user-avatar-size) + 0px) * var(--velt-base-rem-unit)));width:var(--legacy-velt-user-avatar-width, calc((var(--legacy-velt-user-avatar-size) + 0px) * var(--velt-base-rem-unit)))}"],changeDetection:0});let i=o;return i})();var cRe=["selectionElementPortalOverlay"],dRe=i=>[i];function mRe(i,o){if(i&1&&(f(0),_(1,"span",10),ee(2),P(3,"translate"),b(),v()),i&2){let n=l(),e=n.$implicit,t=n.index,r=l(5);m(),it("--velt-selection-color",e==null||e.user==null?null:e.user.color),x("data-testid",r.componentId+"-user-name-"+t),m(),ze(M(3,4,(e==null||e.user==null?null:e.user.name)||(e==null||e.user==null?null:e.user.email)))}}function pRe(i,o){if(i&1&&(f(0),g(1,mRe,4,6,"ng-container",3),v()),i&2){let n=o.index,e=l(5);m(),c("ngIf",n<e.maxCount)}}function gRe(i,o){if(i&1&&(_(0,"span",11),ee(1),b()),i&2){let n=l(4).ngIf,e=l();it("--velt-selection-color",(n.selections[0]==null||n.selections[0].user==null?null:n.selections[0].user.color)||"white"),x("data-testid",e.componentId+"-additional-count")("aria-label",(n.selections==null?null:n.selections.length)-e.maxCount+" additional users"),m(),Ce("+",(n.selections==null?null:n.selections.length)-e.maxCount,"")}}function uRe(i,o){if(i&1&&(f(0),_(1,"div",7),P(2,"translate"),g(3,pRe,2,1,"ng-container",8)(4,gRe,2,5,"span",9),b(),v()),i&2){let n=l(3).ngIf,e=l();m(),x("data-testid",e.componentId+"-label-container")("aria-label",M(2,4,"Selected users")),m(2),c("ngForOf",n.selections),m(),c("ngIf",(n.selections==null?null:n.selections.length)>e.maxCount)}}function hRe(i,o){if(i&1&&(f(0),w(1,"snippyly-user-avatar",13),v()),i&2){let n=l(),e=n.$implicit,t=n.index;m(),it("--velt-selection-color",e==null||e.user==null?null:e.user.color)("--velt-selection-user-index",t),c("size",20)("user",e==null?null:e.user)}}function fRe(i,o){if(i&1&&(f(0),g(1,hRe,2,6,"ng-container",3),v()),i&2){let n=o.index,e=l(5);m(),c("ngIf",n<e.maxCount)}}function vRe(i,o){if(i&1&&(_(0,"div",14),P(1,"translate"),_(2,"span",15),ee(3),b()()),i&2){let n=l(4).ngIf,e=l();it("--velt-selection-user-index",n.selections==null?null:n.selections.length)("background-color",(n.selections[(n.selections==null?null:n.selections.length)-1]==null||n.selections[(n.selections==null?null:n.selections.length)-1].user==null?null:n.selections[(n.selections==null?null:n.selections.length)-1].user.color)||"white"),x("data-testid",e.componentId+"-additional-avatars")("aria-label",(n.selections==null?null:n.selections.length)-e.maxCount+" "+M(1,7,"additional users")),m(3),Ce("+",(n.selections==null?null:n.selections.length)-e.maxCount,"")}}function CRe(i,o){if(i&1&&g(0,fRe,2,1,"ng-container",8)(1,vRe,4,9,"div",12),i&2){let n=l(3).ngIf,e=l();c("ngForOf",n.selections),m(),c("ngIf",(n.selections==null?null:n.selections.length)>e.maxCount)}}function _Re(i,o){if(i&1&&g(0,uRe,5,6,"ng-container",6)(1,CRe,2,2,"ng-template",null,2,Ee),i&2){let n=ce(2),e=l(2).ngIf,t=l();c("ngIf",(e==null?null:e.userIndicatorType)===(t.userIndicatorTypes==null?null:t.userIndicatorTypes.Label))("ngIfElse",n)}}function yRe(i,o){if(i&1&&(f(0),w(1,"div",4,0),g(3,_Re,3,2,"ng-template",5,1,Ee),v()),i&2){let n=ce(2),e=l().ngIf,t=l();m(),it("top",(e==null||e.position==null?null:e.position.top)+t.offsetTop,"px")("left",(e==null||e.position==null?null:e.position.left)+t.offsetLeft,"px"),c("id","selection-element-contianer-"+(t.highlight.user==null?null:t.highlight.user.userSnippylyId)),x("data-testid",t.componentId),m(2),c("cdkConnectedOverlayOrigin",n)("cdkConnectedOverlayOpen",!0)("cdkConnectedOverlayLockPosition",!1)("cdkConnectedOverlayGrowAfterOpen",!0)("cdkConnectedOverlayDisableClose",!0)("cdkConnectedOverlayPositions",A(12,dRe,e==null?null:e.overlayPosition))}}function SRe(i,o){if(i&1&&(f(0),g(1,yRe,5,14,"ng-container",3),v()),i&2){let n=o.ngIf;m(),c("ngIf",n==null?null:n.position)}}var Gce=(()=>{let o=class o{get highlight(){return this._highlight}set highlight(e){this._highlight=e,this.calculatePosition()}constructor(e,t,r){this.loggingService=e,this.selectionService=t,this.elementRef=r,this._highlight=new Xp,this.position=null,this.userIndicatorTypes=s0,this.offsetLeft=0,this.offsetTop=0,this.maxCount=1,this.componentConfigSignal=xe({userIndicatorPosition:hb.End,userIndicatorType:s0.Avatar,position:null,overlayPosition:{originX:"end",originY:"top",overlayX:"end",overlayY:"top"},selections:[]}),this.veltElement=!0,this.componentId="velt-selection-element";try{this.loggingService.log("%c[WB] Creating CLASS: SelectionElementPortalComponent","color: blue;");let a=this.selectionService.getUserIndicatorPosition(),s=this.selectionService.getUserIndicatorType();this.componentConfigSignal.update(d=>(d=T(I({},d),{userIndicatorPosition:a,userIndicatorType:s}),d)),this.setOverlayPosition(a)}catch(a){this.loggingService.log("Error in SelectionElementPortalComponent constructor: ",a)}}ngOnInit(){try{this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in SelectionElementPortalComponent ngOnInit:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","complementary"),e.setAttribute("aria-label","Selection portal")}catch(e){this.loggingService.catch("Error in SelectionElementPortalComponent setupA11yAttributes:",e)}}setSelections(e){try{this.componentConfigSignal.update(t=>(t=T(I({},t),{selections:e}),t))}catch(t){this.loggingService.catch("Error in SelectionElementPortalComponent setSelections: ",t)}}addSelection(e){try{this.componentConfigSignal.update(t=>(t=I({},t),t.selections.push(e),t))}catch(t){this.loggingService.catch("Error in SelectionElementPortalComponent addSelection: ",t)}}ngAfterViewInit(){try{this.loggingService.log("%c[WB] Calling SelectionElementPortalComponent FUNCTION: ngAfterViewInit","color: green;"),this.updateOverlayPosition()}catch(e){this.loggingService.catch("Error in ngAfterViewInit: ",e)}}setOverlayPosition(e){try{switch(this.loggingService.log("%c[WB] Calling SelectionElementPortalComponent FUNCTION: setOverlayPosition","color: green;"),e){case"start":this.componentConfigSignal.update(t=>(t=T(I({},t),{overlayPosition:{originX:"start",originY:"top",overlayX:"start",overlayY:"top"}}),t));break;default:this.componentConfigSignal.update(t=>(t=T(I({},t),{overlayPosition:{originX:"end",originY:"top",overlayX:"end",overlayY:"top"}}),t))}this.updateOverlayPosition()}catch(t){this.loggingService.catch("Error in SelectionElementPortalComponent setOverlayPosition: ",t)}}updateOverlayPosition(){try{this.loggingService.log("%c[WB] Calling SelectionElementPortalComponent FUNCTION: updateOverlayPosition","color: green;"),this.selectionElementPortalOverlay&&this.selectionElementPortalOverlay?.overlayRef?.updatePosition()}catch(e){this.loggingService.catch("Error in SelectionElementPortalComponent updateOverlayPosition: ",e)}}calculatePosition(){try{if(this.loggingService.log("%c[WB] Calling SelectionElementPortalComponent FUNCTION: calculatePosition","color: green;"),this.highlight?.targetElement){let e=NS(this.highlight.targetElement);if(e){let t=e.iterateNext(),r,a=null,s=null;try{r=JSON.parse(t?.getAttribute(j.ATTRIBUTES.VELT_SELECTION_CONFIG)||"{}"),a=t?.getAttribute(j.ATTRIBUTES.VELT_LIVE_SELECTION_USER_INDICATOR_POSITION)||this.componentConfigSignal().userIndicatorPosition,a&&this.setOverlayPosition(a),s=t?.getAttribute(j.ATTRIBUTES.VELT_LIVE_SELECTION_USER_INDICATOR_TYPE)||this.componentConfigSignal().userIndicatorType,this.componentConfigSignal.update(p=>(p=T(I({},p),{userIndicatorPosition:a,userIndicatorType:s}),p))}catch{}let d;if(r?.horizontal&&(d=r.horizontal),a==="start"?d="top-start":d="top-right",t){let p=t.getBoundingClientRect();if(p&&p.width&&p.height)switch(d){case"left":this.position={top:p.height/2-16,left:-4};break;case"left-start":this.position={top:0,left:-4};break;case"top-start":this.position={top:-32,left:0};break;case"top-right":this.position={top:-32,left:p.width};break;case"bottom-left":this.position={top:p.height+4,left:0};break;case"bottom-right":this.position={top:p.height+4,left:p.width-32};break;case"center-left":this.position={top:p.height/2-16,left:-32};break;case"center-right":this.position={top:p.height/2-16,left:p.width+4};break;default:this.position={top:-32,left:p.width}}else this.position=null}else this.position=null}else this.position=null}this.componentConfigSignal.update(e=>(e=T(I({},e),{position:this.position}),e))}catch(e){this.loggingService.catch("Error in SelectionElementPortalComponent calculatePosition: ",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(Os),h(R))},o.\u0275cmp=O({type:o,selectors:[["app-selection-element-portal"]],viewQuery:function(t,r){if(t&1&&nt(cRe,5),t&2){let a;Xe(a=Qe())&&(r.selectionElementPortalOverlay=a.first)}},hostVars:1,hostBindings:function(t,r){t&2&&x("data-velt-element",r.veltElement)},inputs:{highlight:"highlight",offsetLeft:"offsetLeft",offsetTop:"offsetTop"},standalone:!1,decls:1,vars:1,consts:[["trigger","cdkOverlayOrigin"],["selectionElementPortalOverlay","cdkConnectedOverlay"],["defaultAvatarTypeTemplate",""],[4,"ngIf"],["cdkOverlayOrigin","","role","presentation",1,"selection-element-portal",3,"id"],["cdkConnectedOverlay","",3,"cdkConnectedOverlayOrigin","cdkConnectedOverlayOpen","cdkConnectedOverlayLockPosition","cdkConnectedOverlayGrowAfterOpen","cdkConnectedOverlayDisableClose","cdkConnectedOverlayPositions"],[4,"ngIf","ngIfElse"],["role","list",1,"velt-live-selection-element-user-name-container"],[4,"ngFor","ngForOf"],["class","velt-live-selection-element-user-name-plus","role","listitem",3,"--velt-selection-color",4,"ngIf"],["role","listitem",1,"velt-live-selection-element-user-name"],["role","listitem",1,"velt-live-selection-element-user-name-plus"],["class","photo-container","role","listitem",3,"--velt-selection-user-index","background-color",4,"ngIf"],[1,"photo-container","selection-user-avatar",3,"size","user"],["role","listitem",1,"photo-container"],[1,"s-selection-element-avatar-initial"]],template:function(t,r){t&1&&g(0,SRe,2,1,"ng-container",3),t&2&&c("ngIf",r.componentConfigSignal())},dependencies:[ft,Z,nn,en,Wn,pe],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);position:absolute;top:0;left:0;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}*[_ngcontent-%COMP%]{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;color:#000;font-size:calc((1rem + 0px) * var(--velt-base-rem-unit))}*[_ngcontent-%COMP%]:empty{display:revert}.selection-element-portal[_ngcontent-%COMP%]{display:none;position:absolute;top:0;left:0;white-space:nowrap;z-index:1;font-size:var(--velt-font-size-xs)}.photo-container[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;width:calc((1.5rem + 0px) * var(--velt-base-rem-unit));height:calc((1.5rem + 0px) * var(--velt-base-rem-unit));box-sizing:border-box;background-clip:padding-box;border-radius:50%;color:var(--velt-light-mode-white);border:2px solid var(--velt-selection-color);margin-left:-5px;z-index:calc(var(--velt-selection-user-index, 0) * -1)}.photo-container[_ngcontent-%COMP%] .s-selection-element-avatar-initial[_ngcontent-%COMP%]{color:var(--velt-light-mode-white)}.photo-container[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%;border-radius:50%;object-fit:cover} snippyly-user-avatar.selection-user-avatar .s-user-avatar-initial{font-size:var(--velt-font-size-md)}.velt-live-selection-element-user-name-container[_ngcontent-%COMP%]{display:flex;gap:var(--velt-spacing-xs);margin-top:5px}.velt-live-selection-element-user-name-container[_ngcontent-%COMP%] .velt-live-selection-element-user-name[_ngcontent-%COMP%]{color:var(--velt-light-mode-white);display:flex;background:var(--velt-selection-color);padding:var(--velt-spacing-xs) var(--velt-spacing-sm);font-size:var(--velt-spacing-md);font-style:normal;font-weight:400;line-height:100%;border-radius:var(--velt-border-radius-md);font-family:var(--velt-default-font-family)}.velt-live-selection-element-user-name-container[_ngcontent-%COMP%] .velt-live-selection-element-user-name-plus[_ngcontent-%COMP%]{color:var(--velt-light-mode-white);display:flex;background:var(--velt-selection-color);padding:var(--velt-spacing-x);font-size:var(--velt-font-size-xs);font-style:normal;font-weight:400;line-height:100%;border-radius:var(--velt-border-radius-md);font-family:var(--velt-default-font-family)}"],changeDetection:0});let i=o;return i})();var v0=(i,o)=>{try{let n=IRe(i),e=[],t=[];return n.forEach(r=>{r?.parentElement?.closest(j.TAGS.SNIPPYLY_TEXT_HIGHLIGHT)?r?.parentElement?.normalize():t.push(r)}),t.forEach(r=>{let a=ERe(r,o);a&&e.push(a)}),e}catch(n){return mt.catch("Error in highlighter highlightRange: ",n),[]}},IRe=i=>{try{if(i.collapsed)return[];let o=i.commonAncestorContainer;if(i.commonAncestorContainer.nodeType!==Node.ELEMENT_NODE&&(o=i.commonAncestorContainer.parentElement),!o)return[];let n=[],e=o.ownerDocument.createNodeIterator(o,NodeFilter.SHOW_TEXT),t,r=!1;for(;t=e.nextNode();)if(i.intersectsNode(t)){let a=t?.length;i.startContainer===t&&i.startOffset>0&&(t.splitText(i.startOffset),r=!0),i.endContainer===t&&i.endOffset<a&&t.splitText(i.endOffset),n.push(t)}return r&&n.shift(),n}catch(o){return mt.catch("Error in highlighter getTextNodesInRange: ",o),[]}},ERe=(i,o)=>{try{let n=document.createElement(o||j.TAGS.SNIPPYLY_TEXT_HIGHLIGHT);return i.parentElement?.replaceChild(n,i),n.appendChild(i),n}catch(n){return mt.catch("Error in highlighter highlightNode: ",n),null}};var Os=(()=>{let o=class o{constructor(e,t,r,a,s,d,p,u,C,E,D){this.afAuth=e,this.authService=t,this.configService=r,this.databaseService=a,this.docService=s,this.domService=d,this.componentFactoryResolver=p,this.injector=u,this.appRef=C,this.loggingService=E,this.commonDbService=D,this.documentPaths=null,this.textSelections={},this.enableSelections$=new ve(!1),this.userIndicatorEnabled$=new ve(!0),this.userIndicatorPosition$=new ve(hb.End),this.userIndicatorType$=new ve(s0.Avatar),this.defaultElementsTrackingEnabled$=new ve(!0),this.defaultStylingEnabled$=new ve(!0),this.elementSelections={},this.databaseService.getDb().pipe(Le(L=>!!L),rt(1)).subscribe(L=>{L&&this.updateOnDocumentFocusChange()},L=>{this.loggingService.catch("Error in SelectionService getDb subscription: ",L)}),this.docService.getDocumentPaths$().subscribe(L=>{this.documentPaths=L},L=>{this.loggingService.catch("Error in SelectionService getDocumentPaths subscription: ",L)}),this.domService.onDocumentClick$().subscribe(L=>{try{if(this.enableSelections$.value&&this.isFeatureAllowed()&&L?.target&&!window.getSelection()?.toString()){let G=this.getSelectionEnabledElement(L.target);if(G&&!qi(G)){let Y=this.domService.getXPath(G);if(Y){let ne=new Xp;ne.type="click",ne.targetElement=Y,this.setSelection(ne)}}else this.removeSelection()}}catch(G){this.loggingService.catch("Error in SelectionService onDocumentClick$: ",G)}},L=>{this.loggingService.catch("Error in SelectionService onDocumentClick$ subscription: ",L)}),this.domService.onDocumentFocus$().subscribe(L=>{try{if(this.enableSelections$.value&&this.isFeatureAllowed()&&L?.target){let G=this.getSelectionEnabledElement(L.target);if(G&&!qi(G)){let Y=this.domService.getXPath(G);if(Y){let ne=new Xp;ne.type="focus",ne.targetElement=Y,this.setSelection(ne)}}else this.removeSelection()}}catch(G){this.loggingService.catch("Error in SelectionService onDocumentFocus$: ",G)}},L=>{this.loggingService.catch("Error in SelectionService onDocumentFocus$ subscription: ",L)}),this.domService.onWindowKeyupEsc$().subscribe(L=>{this.removeSelection()},L=>{this.loggingService.catch("Error in SelectionService onWindowKeyupEsc$ subscription: ",L)}),this.enableSelections$.pipe(he(()=>this.isFeatureAllowed$({})),Le(L=>L?.config&&L?.user)).subscribe(L=>{(!L?.featureAllowed||!this.enableSelections$.value)&&this.removeSelection()},L=>{this.loggingService.catch("Error in SelectionService enableSelections$ subscription: ",L)}),this.domService.onSelectionChange$().subscribe(()=>{try{if(this.enableSelections$.value&&this.isFeatureAllowed()&&window.getSelection()?.toString()){let L=window.getSelection()?.getRangeAt(0);if(L.commonAncestorContainer&&!L?.collapsed){let G=zre([L]),Y=new Xp;Y.type="selection",Y.targetTextRange=G?.length?G[0]:null,this.setSelection(Y)}}}catch(L){this.loggingService.catch("Error in SelectionService onSelectionChange$: ",L)}},L=>{this.loggingService.catch("Error in SelectionService onSelectionChange$ subscription: ",L)}),this.authService.getUser$().subscribe(L=>{this.user=L},L=>{this.loggingService.catch("Error in SelectionService getUser$ subscription: ",L)}),this.getSelectionsOnCurrentDocument().pipe(Ri()).subscribe(([L,G])=>{try{if(L){let Y=[];Object.keys(L).forEach(ne=>{let ge=L[ne],ye=G?G[ne]:null;!zi(ge,ye)&&ne!==this.getUserIdHash(this.user)&&Y.push(ge)}),Y.forEach(ne=>{if(ne.targetElement){let ge=this.elementSelections[ne?.targetElement]?.portalRef,Re=(this.elementSelections[ne?.targetElement]?.selections||[]).filter(Ge=>this.getUserIdHash(Ge.user)!==this.getUserIdHash(ne?.user));Re?.length?(ge.instance.setSelections(Re.slice()),this.elementSelections[ne?.targetElement].selections=Re.slice(),this.highlightElement(Re[0])):(this.removeHighlightFromElement(ne),this.removeSelectionElement(ne))}else ne.targetTextRange&&this.removeHighlightFromText(ne)})}if(G){let Y=[];Object.keys(G).forEach(ne=>{let ge=L?L[ne]:null,ye=G[ne];!zi(ge,ye)&&ne!==this.getUserIdHash(this.user)&&Y.push(ye)}),Y.forEach(ne=>{ne.targetElement?(this.highlightElement(ne),this.getUserIndicatorEnabled()&&this.setElementHighlight(ne)):ne.targetTextRange&&this.highlightText(ne)})}}catch(Y){this.loggingService.catch("Error in SelectionService getSelectionsOnCurrentDocument: ",Y)}},L=>{this.loggingService.catch("Error in SelectionService getSelectionsOnCurrentDocument subscription: ",L)}),this.authService.addPreSignOutFuction("highlight-signout",this.signOutUser.bind(this))}isFeatureAllowed(){return no(this.configService.getConfig(),this.authService.getUser(),Ne.LIVE_SELECTION)}updateOnDocumentFocusChange(){this.loggingService.log("%c[WB] Calling FUNCTION: updateOnDocumentFocusChange","color: green;");try{document&&document.addEventListener("visibilitychange",e=>{this.user&&document.visibilityState==="hidden"&&this.removeSelection()})}catch(e){this.loggingService.catch("Error in updateOnDocumentFocusChange:",e)}}getSelectionsOnCurrentDocument(){return this.loggingService.log("%c[WB] Calling FUNCTION: getSelectionsOnCurrentDocument","color: green;"),Qn(this.afAuth).pipe(Le(e=>!!e),he(e=>this.isFeatureAllowed$({firebaseUser:e})),he(e=>e.featureAllowed?se(e).pipe(he(t=>this.docService.getDocumentPaths$().pipe(de(r=>(this.documentPaths=r,t)))),he(t=>t?.user?t?.user?.isAnonymous?se(null):this.documentPaths?this.databaseService.getDb().pipe(Le(r=>!!r),he(r=>this.documentPaths?.selection?this.commonDbService.dbListener({feature:"allSelections",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}}).pipe(de(a=>a?.data)):se(null))):se(null):se(null))):se(null)))}isFeatureAllowed$(e){return this.configService.getConfig$().pipe(Le(t=>!!t),de(t=>T(I({},e),{config:t})),he(t=>this.authService.getUser$().pipe(de(r=>(this.user=r,T(I({},t),{user:r}))))),he(t=>no(t.config,t.user,Ne.LIVE_SELECTION)?se(T(I({},t),{featureAllowed:!0})):(this.loggingService.warn("Live Selection feature is not allowed."),se(T(I({},t),{featureAllowed:!1})))),kt((t,r)=>t?.featureAllowed===r?.featureAllowed))}setSelection(e){try{if(this.user?.userId&&this.documentPaths?.selection){e.user=this.user;let t=JSON.parse(JSON.stringify(e));this.commonDbService.updateData({feature:"selection",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,userId:this.getUserIdHash(this.user)??"",skipFirestore:!0},data:t})}}catch(t){this.loggingService.catch("Error in SelectionService setSelection: ",t)}}removeSelection(){try{this.user?.userId&&this.documentPaths?.selection&&this.commonDbService.deleteData({feature:"selection",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,userId:this.getUserIdHash(this.user)??"",skipFirestore:!0}})}catch(e){this.loggingService.catch("Error in SelectionService removeSelection: ",e)}}highlightElement(e){try{let t=this.domService.getXPath(e.targetElement);if(t){let r=t.iterateNext();if(r){let a=["input","textarea","select","button"],s;try{r?.getAttribute(j.ATTRIBUTES.VELT_SELECTION_CONFIG)&&(s=JSON.parse(r?.getAttribute(j.ATTRIBUTES.VELT_SELECTION_CONFIG)||"{}"))}catch{}(!s||s?.border)&&this.domService.highlightUserElement(r,e?.user?.color,e?.user?.name,this.getDefaultStylingEnabled())}}}catch(t){this.loggingService.catch("Error in SelectionService highlightElement: ",t)}}removeHighlightFromElement(e){try{let t=this.domService.getXPath(e.targetElement);if(t){let r=t.iterateNext();r&&this.domService.removeHighlightUserFromElement(r)}}catch(t){this.loggingService.catch("Error in SelectionService removeHighlightFromElement: ",t)}}highlightText(e){try{if(e?.targetTextRange){let t=bv(e.targetTextRange?.text,this.domService.getXPath(e.targetTextRange?.commonAncestorContainer).iterateNext(),e.targetTextRange?.occurrence),r=new Range;try{r.setStart(t[0].textNode,t[0].startOffset||0),r.setEnd(t[t.length-1].textNode,t[t.length-1].endOffset||0)}catch{}if(r.toString()===e.targetTextRange?.text){let a=v0(r,j.TAGS.SNIPPYLY_HIGHLIGHT_USER_TEXT),s=[],d=this.getSelectionUserMarker(e.user);if(a&&a.length&&(a.forEach(p=>{p?.textContent?.trim()&&(this.domService.addClassToElement(p,p.tagName?.toLowerCase()),this.domService.addClassToElement(p,j.VELT_LIVE_SELECTION_ON_TEXT),this.getDefaultStylingEnabled()&&this.domService.addClassToElement(p,j.VELT_LIVE_SELECTION_ON_TEXT_DEFAULT),e.user?.color&&p.style.setProperty(j.VELT_SELECTION_COLOR,e.user?.color+"55"),s.push({element:p,textNode:p.childNodes[0]}))}),d)){let p=a.filter(C=>C?.textContent?.trim()),u=p?.length?p[p?.length-1]:null;u&&u.parentNode.insertBefore(d,u.nextSibling)}this.textSelections[this.getUserIdHash(e?.user)]={textNodes:s,marker:d}}}}catch(t){this.loggingService.catch("Error in SelectionService highlightText: ",t)}}removeHighlightFromText(e){try{let t=this.getUserIdHash(e?.user);t&&this.textSelections[t]?.textNodes?.length&&(this.textSelections[t].textNodes.forEach(r=>{r?.element&&r?.textNode&&r.element.replaceWith(r.textNode),r.textNode&&r.textNode.parentNode?.normalize()}),this.textSelections[t]?.marker&&this.textSelections[t]?.marker?.remove())}catch(t){this.loggingService.catch("Error in SelectionService removeHighlightFromText: ",t)}}getSelectionUserMarker(e){try{let t=document.createElement("span");t.classList.add("snippyly-user-marker","active"),t.setAttribute("data-name",e?.name+""),t.style.setProperty("--velt-selection-marker-color",e?.color||"#000");let r=document.createElement("span");r.classList.add("snippyly-user-marker-line");let a=document.createElement("span");return a.classList.add("snippyly-user-marker-dot"),r.appendChild(a),t.appendChild(r),setTimeout(()=>{t?.classList?.remove("active")},1e3),t}catch(t){return this.loggingService.catch("Error in SelectionService getSelectionUserMarker: ",t),null}}signOutUser(e){return new Promise((t,r)=>{try{this.documentPaths?.selection&&e?this.commonDbService.getData({feature:"selection",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,userId:e.uid,skipFirestore:!0}}).then(a=>{a&&this.commonDbService.deleteData({feature:"selection",errorCallback:s=>{r(s)},callback:()=>{t(null)},properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,userId:this.getUserIdHash(this.user)??"",skipFirestore:!0}}),t(null)}).catch(a=>{this.loggingService.catch("Error in SelectionService signOutUser subscription: ",a),r(a)}):t(null)}catch(a){this.loggingService.catch("Error in SelectionService signOutUser:",a),r(a)}})}enableSelections(e){try{this.enableSelections$.next(e)}catch(t){this.loggingService.catch("Error in SelectionService enableSelections: ",t)}}enableUserIndicator(){try{if(this.userIndicatorEnabled$.value===!0)return;this.userIndicatorEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in SelectionService enableUserIndicator: ",e)}}disableUserIndicator(){try{if(this.userIndicatorEnabled$.value===!1)return;this.userIndicatorEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in SelectionService disableUserIndicator: ",e)}}getUserIndicatorEnabled$(){return this.userIndicatorEnabled$.asObservable()}getUserIndicatorEnabled(){return this.userIndicatorEnabled$.value}setUserIndicatorPosition(e){try{this.userIndicatorPosition$.next(e)}catch(t){this.loggingService.catch("Error in SelectionService setUserIndicatorPosition: ",t)}}getUserIndicatorPosition$(){return this.userIndicatorPosition$.asObservable()}getUserIndicatorPosition(){return this.userIndicatorPosition$.value}setUserIndicatorType(e){try{this.userIndicatorType$.next(e)}catch(t){this.loggingService.catch("Error in SelectionService setUserIndicatorType: ",t)}}getUserIndicatorType$(){return this.userIndicatorType$.asObservable()}getUserIndicatorType(){return this.userIndicatorType$.value}enableDefaultElementsTracking(){try{if(this.defaultElementsTrackingEnabled$.value===!0)return;this.defaultElementsTrackingEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in SelectionService enableDefaultElementsTracking: ",e)}}disableDefaultElementsTracking(){try{if(this.defaultElementsTrackingEnabled$.value===!1)return;this.defaultElementsTrackingEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in SelectionService disableDefaultElementsTracking: ",e)}}getDefaultElementsTrackingEnabled$(){return this.defaultElementsTrackingEnabled$.asObservable()}getDefaultElementsTrackingEnabled(){return this.defaultElementsTrackingEnabled$.value}enableDefaultStyling(){try{if(this.defaultStylingEnabled$.value===!0)return;this.defaultStylingEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in SelectionService enableDefaultStyling: ",e)}}disableDefaultStyling(){try{if(this.defaultStylingEnabled$.value===!1)return;this.defaultStylingEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in SelectionService disableDefaultStyling: ",e)}}getDefaultStylingEnabled$(){return this.defaultStylingEnabled$.asObservable()}getDefaultStylingEnabled(){return this.defaultStylingEnabled$.value}getSelectionEnabledElement(e){try{let t=this.getDefaultElementsTrackingEnabled();return t&&j.SELECTION_ENABLED_ELEMENTS[e.tagName?.toLowerCase()]?e:bj(e,t)}catch(t){return this.loggingService.catch("Error in SelectionService isElementAllowed: ",t),null}}setElementHighlight(e){try{if(!this.elementSelections[e.targetElement])this.setSelectionElement(e);else{let t=this.elementSelections[e.targetElement].portalRef;this.elementSelections[e.targetElement].selections?.find(a=>this.getUserIdHash(a.user)===this.getUserIdHash(e?.user))||(t.instance.addSelection(e),this.elementSelections[e.targetElement].selections.push(e))}}catch(t){this.loggingService.catch("Error in SelectionService setElementSelection: ",t)}}setSelectionElement(e){try{let t=this.domService.getXPath(e.targetElement);if(t){let r=t.iterateNext();if(r){let a=this.domService.getHostElement(r),s=new Bo(Gce),d=new Vo(a,this.componentFactoryResolver,this.appRef,this.injector),p=d.attach(s);p.instance.highlight=e,p.instance.setSelections([e]),this.elementSelections[e.targetElement]={selectionHostDomPortalOutlet:d,selectionElementPortal:s,portalRef:p,selections:[JSON.parse(JSON.stringify(e))],userTargetElement:r,selectionHostElement:a,targetElement:e.targetElement},this.updateElementOffset(e)}}}catch(t){this.loggingService.catch("Error in SelectionService setSelectionElement: ",t)}}updateElementOffset(e){try{let{portalRef:t,userTargetElement:r,selectionHostElement:a}=this.elementSelections[e.targetElement],s=this.domService.getElementOffset(r,a);t.instance.offsetLeft=s.offsetLeft,t.instance.offsetTop=s.offsetTop}catch(t){this.loggingService.catch("Error in SelectionService updateElementOffset: ",t)}}checkElementHighlightsToRemove(e){try{let t=e.map(r=>r.targetElement);Object.keys(this.elementSelections).forEach(r=>{if(!t.includes(r)){let a=this.elementSelections[r];a&&(a.selectionHostDomPortalOutlet.detach(),this.domService.removeHighlightFromElement(a.selectionHostElement)),delete this.elementSelections[r]}})}catch(t){this.loggingService.catch("Error in SelectionService checkElementHighlightsToRemove: ",t)}}removeSelectionElement(e){try{let t=this.elementSelections[e.targetElement];t&&(t.selectionHostDomPortalOutlet.detach(),this.domService.removeHighlightFromElement(t.selectionHostElement)),delete this.elementSelections[e.targetElement]}catch(t){this.loggingService.catch("Error in SelectionService removeSelectionElement: ",t)}}getUserIdHash(e){try{return e?.userId?_t(e?.userId):null}catch(t){return this.loggingService.catch("Error in SelectionService getUserIdHash: ",t),null}}};o.\u0275fac=function(t){return new(t||o)(J(Ei),J(je),J(Vt),J(_n),J(at),J(Fe),J(Eo),J(xt),J(fi),J(y),J(yn))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Xk=class extends ri{constructor(o){super(o),this.getService(y).log("%c[WB] Creating CLASS: SelectionElement","color: blue;"),this.enableLiveSelection=this._enableLiveSelection,this.disableLiveSelection=this._disableLiveSelection,this.enableUserIndicator=this._enableUserIndicator,this.disableUserIndicator=this._disableUserIndicator,this.setUserIndicatorPosition=this._setUserIndicatorPosition,this.setUserIndicatorType=this._setUserIndicatorType,this.enableDefaultElementsTracking=this._enableDefaultElementsTracking,this.disableDefaultElementsTracking=this._disableDefaultElementsTracking,this.enableDefaultStyling=this._enableDefaultStyling,this.disableDefaultStyling=this._disableDefaultStyling,this.getLiveSelectionData=this._getLiveSelectionData}_enableLiveSelection(){this.getService(y).log("%c[WB] Calling FUNCTION: _enableLiveSelection","color: green;");try{this.trackEvent(X.Events.Selection.ENABLE_LIVE_SELECTION_TRIGGERED),this.getService(Os).enableSelections(!0)}catch(o){this.getService(y).catch("Error in enableLiveSelection: ",o)}}_disableLiveSelection(){this.getService(y).log("%c[WB] Calling FUNCTION: _disableLiveSelection","color: green;");try{this.trackEvent(X.Events.Selection.DISABLE_LIVE_SELECTION_TRIGGERED),this.getService(Os).enableSelections(!1)}catch(o){this.getService(y).catch("Error in disableLiveSelection: ",o)}}_enableUserIndicator(){this.getService(y).log("%c[WB] Calling FUNCTION: enableUserIndicator","color: green;");try{this.trackEvent(X.Events.Selection.ENABLE_USER_INDICATOR_TRIGGERED),this.getService(Os).enableUserIndicator()}catch(o){this.getService(y).catch("Error in _enableUserIndicator: ",o)}}_disableUserIndicator(){this.getService(y).log("%c[WB] Calling FUNCTION: disableUserIndicator","color: green;");try{this.trackEvent(X.Events.Selection.DISABLE_USER_INDICATOR_TRIGGERED),this.getService(Os).disableUserIndicator()}catch(o){this.getService(y).catch("Error in _disableUserIndicator: ",o)}}_setUserIndicatorPosition(o){this.getService(y).log("%c[WB] Calling FUNCTION: setUserIndicatorPosition","color: green;");try{this.trackEvent(X.Events.Selection.SET_USER_INDICATOR_POSITION_TRIGGERED,{payload:{position:o}}),this.getService(Os).setUserIndicatorPosition(o)}catch(n){this.getService(y).catch("Error in _setUserIndicatorPosition: ",n)}}_setUserIndicatorType(o){this.getService(y).log("%c[WB] Calling FUNCTION: setUserIndicatorType","color: green;");try{this.trackEvent(X.Events.Selection.SET_USER_INDICATOR_TYPE_TRIGGERED,{payload:{type:o}}),this.getService(Os).setUserIndicatorType(o)}catch(n){this.getService(y).catch("Error in _setUserIndicatorType: ",n)}}_enableDefaultElementsTracking(){this.getService(y).log("%c[WB] Calling FUNCTION: enableDefaultElementsTracking","color: green;");try{this.trackEvent(X.Events.Selection.ENABLE_DEFAULT_ELEMENTS_TRACKING_TRIGGERED),this.getService(Os).enableDefaultElementsTracking()}catch(o){this.getService(y).catch("Error in _enableDefaultElementsTracking: ",o)}}_disableDefaultElementsTracking(){this.getService(y).log("%c[WB] Calling FUNCTION: disableDefaultElementsTracking","color: green;");try{this.trackEvent(X.Events.Selection.DISABLE_DEFAULT_ELEMENTS_TRACKING_TRIGGERED),this.getService(Os).disableDefaultElementsTracking()}catch(o){this.getService(y).catch("Error in _disableDefaultElementsTracking: ",o)}}_enableDefaultStyling(){this.getService(y).log("%c[WB] Calling FUNCTION: enableDefaultStyling","color: green;");try{this.trackEvent(X.Events.Selection.ENABLE_DEFAULT_STYLING_TRIGGERED),this.getService(Os).enableDefaultStyling()}catch(o){this.getService(y).catch("Error in _enableDefaultStyling: ",o)}}_disableDefaultStyling(){this.getService(y).log("%c[WB] Calling FUNCTION: disableDefaultStyling","color: green;");try{this.trackEvent(X.Events.Selection.DISABLE_DEFAULT_STYLING_TRIGGERED),this.getService(Os).disableDefaultStyling()}catch(o){this.getService(y).catch("Error in _disableDefaultStyling: ",o)}}_getLiveSelectionData(){this.getService(y).log("%c[WB] Calling FUNCTION: getLiveSelectionData","color: green;");try{return this.trackEvent(X.Events.Selection.GET_LIVE_SELECTION_DATA_TRIGGERED),this.getService(Os).getSelectionsOnCurrentDocument()}catch(o){return this.getService(y).catch("Error in _getLiveSelectionData: ",o),se(null)}}};var Va=(()=>{let o=class o{constructor(e,t,r,a,s,d,p,u,C,E,D,L,G,Y,ne){this.analyticsService=e,this.configService=t,this.docService=r,this.databaseService=a,this.authService=s,this.domService=d,this.afAuth=p,this.iamService=u,this.avatarService=C,this.contactService=E,this.storageService=D,this.dialog=L,this.loggingService=G,this.notificationService=Y,this.commonDbService=ne,this.tagAnnotations$=new ve({}),this.tagAnnotationsByDocumentId$=new ve({}),this.documentPaths=null,this.allowedElementIds$=new ve([]),this.addTagMode$=new ve(!1),this.enableTextTags$=new ve(!1),this.loggingService.log("%c[WB] Creating CLASS: TagService","color: blue;"),this.databaseService.getDb().pipe(Le(ge=>!!ge),rt(1)).subscribe(ge=>{ge&&this.getDocumentPaths()},ge=>{this.loggingService.catch("Error in TagService getDb subscription: ",ge)}),this.domService.onWindowPointerMove$().subscribe(ge=>{if(this.addTagMode$.value){this.hightlightElement&&this.domService.removeHighlightFromElement(this.hightlightElement);let ye=this.domService.getBackgroundElement(ge.clientX,ge.clientY);ye&&(this.isElementInsideAllowedElements(ye)?FP(ge.target)?this.domService.removeClassFromElement(document.body,"show-pin-cursor"):(this.domService.addClassToElement(document.body,"show-pin-cursor"),this.hightlightElement=ye,this.domService.highlightElement(this.hightlightElement,j.CURSOR.TAG_PIN)):this.domService.removeClassFromElement(document.body,"show-pin-cursor"))}},ge=>{this.loggingService.catch("Error in TagService onWindowPointerMove$ subscription: ",ge)}),this.domService.onWindowKeyupEsc$().subscribe(ge=>{this.addTagMode$.value&&this.disableAddTagMode()},ge=>{this.loggingService.catch("Error in TagService onWindowKeyupEsc$ subscription: ",ge)}),this.domService.onDocumentClick$().subscribe(ge=>{if(ge&&this.addTagMode$.value){if(ge.preventDefault(),ge.stopPropagation(),!FP(ge.target)){let ye=this.domService.getBackgroundElement(ge.clientX,ge.clientY);ye&&this.isElementInsideAllowedElements(ye)&&this.addTag(ge)}this.disableAddTagMode()}},ge=>{this.loggingService.catch("Error in TagService onDocumentClick$ subscription: ",ge)}),this.addTagMode$.subscribe(ge=>{this.hightlightElement&&this.domService.removeHighlightFromElement(this.hightlightElement),ge?this.domService.addClassToElement(document.body,"snippyly-add-tag-mode"):(this.domService.removeClassFromElement(document.body,"snippyly-add-tag-mode"),this.domService.removeClassFromElement(document.body,"show-pin-cursor"))},ge=>{this.loggingService.catch("Error in TagService addTagMode$ subscription: ",ge)}),this.domService.onWindowKeyupBackspace$().subscribe(ge=>{this.deleteTagPinAnnotations("keyupBackspace")},ge=>{this.loggingService.catch("Error in TagService onWindowKeyupBackspace$ subscription: ",ge)}),this.domService.onWindowKeyupDelete$().subscribe(ge=>{this.deleteTagPinAnnotations("keyupDelete")},ge=>{this.loggingService.catch("Error in TagService onWindowKeyupDelete$ subscription: ",ge)}),this.domService.getDeleteCommmentAnnotations$().subscribe(ge=>{ge?.length&&(ge?.filter(Re=>Re.type==="tag")).forEach(Re=>Q(this,null,function*(){yield this.deleteTagPinAnnotation(Re)}))},ge=>{this.loggingService.catch("Error in TagService onWindowKeyupDelete$ subscription: ",ge)})}getDocumentPaths(){this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentPaths","color: green;"),this.docService.getDocumentPaths$()}getAnonymousAvatarImage(){return this.loggingService.log("%c[WB] Calling FUNCTION: getAnonymousAvatarImage","color: green;"),this.avatarService.generateUserImage()}setAllowedElementIds(e){this.allowedElementIds$.next(e||[])}getAllowedElementIds(){return this.allowedElementIds$.asObservable()}getAllTagAnnotations(e,t,r){this.loggingService.log("%c[WB] Calling FUNCTION: getAllTagAnnotations","color: green;");let a,s;try{if(e&&(s=fn(e)),t&&typeof t=="object"){let d=Go(t);a=fn(JSON.stringify(d))}}catch(d){this.loggingService.catch("Error in TagService getAllTagAnnotations: ",d)}return Qn(this.afAuth).pipe(Le(d=>!!d),he(d=>this.isFeatureAllowed({firebaseUser:d,annotations:[],filteredAnnotations:[]})),he(d=>d.featureAllowed?this.iamService.isUserAllowed$().pipe(de(p=>(d.featureAllowed=p,d))):se(d)),he(d=>d.featureAllowed?this.authService.isPlanExpired$().pipe(de(p=>(d.featureAllowed=!p,d))):se(d)),he(d=>d.featureAllowed?se(d).pipe(he(p=>this.docService.getDocumentPaths$().pipe(de(u=>(this.documentPaths=u,p.documentPaths=u,p)))),he(p=>this.getDataFromDocumentId(s).pipe(de(u=>(p.annotations=u||[],I({},p))))),he(p=>this.docService.getLocation$().pipe(de(u=>(p.location=u,p)))),he(p=>this.docService.getLocations$().pipe(de(u=>(p.customLocations=u,p)))),de(p=>{if(p.filteredAnnotations=[],s&&!a)return p.filteredAnnotations=p.annotations?.slice(),p;{let u=[];return a?u.push(a):(u.push(p?.location?.locationId),u.push(...Object.values(p?.customLocations||[]).map(C=>C.locationId))),p.filteredAnnotations=this.filterAnnotationsByLocationIds(p?.annotations,u),p}}),he(p=>r?se(p):p?.annotations?.length?this.domService.onWindowResize$().pipe(de(()=>p)):se(p)),he(p=>r?se(p):p?.annotations?.length?this.domService.onDomChange$("TagService getAllTagAnnotations").pipe(de(()=>p)):se(p)),de(p=>(p?.filteredAnnotations?.forEach(u=>{this.calculateTagAnnotationPosition(u)}),p)),he(p=>p?.filteredAnnotations?se(p?.filteredAnnotations||[]):se([]))):se([])))}isFeatureAllowed(e){return this.configService.getConfig$().pipe(Le(t=>!!t),de(t=>T(I({},e),{config:t})),he(t=>this.authService.getUser$().pipe(de(r=>T(I({},t),{user:r})))),he(t=>no(t.config,t.user,Ne.TAG)?se(T(I({},t),{featureAllowed:!0})):(this.loggingService.warn("Tag feature is not allowed."),se(T(I({},t),{featureAllowed:!1})))))}getDataFromDocumentId(e){return this.databaseService.getDb().pipe(Le(t=>!!t),he(t=>this.configService?.getApiKey()&&this.documentPaths?.tag?this.commonDbService.dbListener({feature:"allTags",properties:{documentId:e??this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}}).pipe(de(r=>r?.data),de(r=>{let a=[];return r&&(a=Object.values(r).filter(s=>typeof s=="object")),this.setTagAnnotationsByDocumentId(e||this.documentPaths?.documentId,a),a})):se([])))}setTagAnnotationsByDocumentId(e,t){try{e&&this.tagAnnotationsByDocumentId$.next(T(I({},this.tagAnnotationsByDocumentId$.value),{[e]:t}))}catch(r){this.loggingService.catch("Error in TagService setTagAnnotationsByDocumentId:",r)}}filterAnnotationsByLocationIds(e,t){try{return e.filter(r=>t.includes(r.locationId))}catch(r){return this.loggingService.catch("Error in TagService filterAnnotationsByLocations:",r),[]}}calculateTagAnnotationPosition(e){try{if(e.targetElement){let t=this.domService.getXPath(e.targetElement?.xpath);if(t){let r=t.iterateNext();if(r&&To(r)){let a=r.getBoundingClientRect();if(a&&a.width&&a.height){let{height:s,width:d}=jp(r);e.position={top:s*e.targetElement.topPercentage/100,left:d*e.targetElement.leftPercentage/100}}else e.position=null}else e.position=null}else e.position=null}}catch(t){this.loggingService.catch("Error in TagService calculateTagAnnotationPosition:",t)}}filterPinAnnotations(e,t,r){this.loggingService.log("%c[WB] Calling FUNCTION: filterPinAnnotations","color: green;");try{let a=e?Object.values(e):[];a.forEach((d,p)=>{d?.annotationId&&(d.annotationIndex=p+1)});let s=[];if(t)r?s=a.filter(d=>d.locationId===r):s=a.slice();else{let d=this.docService.getLocation();d&&d.locationId?s=a.filter(p=>p.locationId===d.locationId):s=a.filter(p=>!p.locationId)}return s}catch(a){return this.loggingService.catch("Error in TagService filterPinAnnotations:",a),[]}}addTag(e,t){this.loggingService.log("%c[WB] Calling FUNCTION: addTag","color: green;");try{let r=this.authService.getUser();if(r)if(r.isReadOnly||r.isAnonymous)this.loggingService.catch("Anonymous/Readonly users cannot add tags.");else{let a=new vb;a.from=r,a.color=j.DEFAULT_ANNOTATION_COLOR,a.resolved=!1,a.lastUpdated=this.timestamp;let{topPositionX:s,topPositionY:d}=this.domService.getTopLeftPosition();a.positionX=s,a.positionY=d;let p=this.domService.getCurrentWindowSizeValue();if(a.screenWidth=p.screenWidth,a.screenHeight=p.screenHeight,a.screenScrollHeight=p.screenScrollHeight,a.taggedElementPath="",e&&(a.targetElement=this.domService.getTargetElementForCursorPosition(e)),t&&(a.targetTextRange=t),a?.targetElement?.xpath){let u=this.domService.getXPath(a.targetElement.xpath);if(u){let C=u.iterateNext();C&&(To(C)||(a.targetElement=null))}}this.setLocationToTagAnnotation(a),a.pageInfo=xi(),a.pageInfo&&(a.pageInfo.screenWidth=this.domService.getCurrentWindowSizeValue()?.screenWidth),this.saveTagToDb(a)}}catch(r){this.loggingService.catch("Error in TagService addTag: ",r)}}setLocationToTagAnnotation(e){try{let t=this.docService.getLocation();t?(e.locationId=t.locationId,e.location=t.location):(delete e.locationId,delete e.location);try{let r;e.targetElement?.xpath?r=this.domService.getElementFromXPath(e.targetElement.xpath):e.targetTextRange?.commonAncestorContainer&&(r=this.domService.getElementFromXPath(e.targetTextRange.commonAncestorContainer));let a=this.docService.getAdditionLocationFromElement(r);if(a){let s=this.docService.addLocation({location:a,source:"internal"});s?.[0]&&(e.locationId=s[0].locationId,e.location=s[0].location)}}catch{}}catch(t){this.loggingService.catch("Error in TagService setLocationToTagAnnotation:",t)}}saveTagToDb(e){this.loggingService.log("%c[WB] Calling FUNCTION: saveTagToDb","color: green;");try{this.authService.getUser()&&this.authService.isFeatureAllowed(Ne.TAG)&&this.docService.getDocumentPaths$().pipe(Le(t=>!!t),rt(1),he(t=>(this.documentPaths=t,this.loggingService.log(this.documentPaths),this.databaseService.getDb().pipe(Le(r=>!!r),rt(1),he(r=>{if(this.documentPaths?.tag){e.annotationId=this.commonDbService.generateDocumentId(),e.pageInfo&&(e.pageInfo.tagUrl=this.generateTagUrl(e));let a=JSON.parse(JSON.stringify(e));return a.position=null,this.domService.toggleAnnotationSelection(a),e.targetTextRange&&sessionStorage.setItem(j.SESSION_STORAGE.SNIPPYLY_AUTO_SELECT_ANNOTATION_ID,e.annotationId),this.analyticsService.trackEvent(X.Events.Tag.TAG_DRAFT_ADDED,{annotationId:e.annotationId}),this.commonDbService.setData({feature:"tag",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",id:e.annotationId,skipFirestore:!0},data:a})}else return se(null)}))))).subscribe(()=>{},t=>{this.loggingService.catch("Error in TagService saveTagToDb subscription: ",t)})}catch(t){this.loggingService.catch("Error in TagService saveTagToDb: ",t)}}updateTag(e,t=!1,r){try{r&&this.setLocationToTagAnnotation(e),t&&this.updateNotificationsDatabase(e,RS.UPDATED),this.updateTagToDb(e)}catch(a){this.loggingService.catch("Error in TagService updateTag: ",a)}}resolveTag(e){try{e.resolved=!0,this.domService.resetSelectedAnnotationsMap(!1),this.updateNotificationsDatabase(e,RS.RESOLVED),this.updateTagToDb(e),this.domService.updateSelectedAnnotationInMap([e]),this.analyticsService.trackEvent(X.Events.Tag.TAG_RESOLVED,{annotationId:e.annotationId})}catch(t){this.loggingService.catch("Error in TagService resolveTag: ",t)}}updateTagToDb(e){this.loggingService.log("%c[WB] Calling FUNCTION: updateTagToDb","color: green;");try{if(e?.targetElement?.xpath){let t=this.domService.getXPath(e.targetElement.xpath);if(t){let r=t.iterateNext();r&&(To(r)||(e.targetElement=null))}}this.domService.updateSelectedAnnotationInMap([e]),this.authService.getUser()&&this.authService.isFeatureAllowed(Ne.TAG)&&this.docService.getDocumentPaths$().pipe(Le(t=>!!t),rt(1),he(t=>(this.documentPaths=t,this.loggingService.log(this.documentPaths),this.databaseService.getDb().pipe(Le(r=>!!r),rt(1),he(r=>{if(this.documentPaths?.tag&&e?.annotationId){let a=JSON.parse(JSON.stringify(e));return a.position=null,this.commonDbService.setData({feature:"tag",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",id:e.annotationId,skipFirestore:!0},data:a})}else return se(null)}))))).subscribe(()=>{},t=>{this.loggingService.catch("Error in TagService updateTagToDb subscription: ",t)})}catch(t){this.loggingService.catch("Error in TagService updateTagToDb: ",t)}}deleteTagPinAnnotations(e){try{let t=this.domService.getSelectedAnnotationsMap(),r=this.authService.getUser(),a=[];Object.keys(t).forEach(s=>Q(this,null,function*(){let d=t[s];d.type==="tag"&&r&&d.from&&(r?.isAdmin||d.from.userId===r.userId)&&a.push(d)})),a?.length&&(this.analyticsService.trackEvent(X.Events.Tag.TAG_DELETE_TRIGGERED,{triggerType:e,annotationId:a.map(s=>s.annotationId).join()}),this.dialog.open(ya,{data:{title:"Delete tag?",message:"This selected tag will be deleted.",yesButton:"Delete",noButton:"Cancel",variant:"tag"}}).afterClosed().pipe(rt(1)).subscribe(s=>{s&&(a.forEach(d=>Q(this,null,function*(){yield this.deleteTagPinAnnotation(d)})),setTimeout(()=>{document.querySelectorAll(`[${j.SNIPPYLY_HIGHLIGHT}]`).forEach(p=>{this.domService.removeHighlightFromElement(p)})},100))})),this.domService.resetSelectedAnnotationsMap(!0,"tag")}catch(t){this.loggingService.catch("Error in TagService deleteTagPinAnnotations: ",t)}}deleteTagPinAnnotation(e){return this.authService.isFeatureAllowed(Ne.TAG)&&this.documentPaths?.tag&&e?.annotationId?(this.updateNotificationsDatabase(e,RS.DELETED),this.analyticsService.trackEvent(X.Events.Tag.TAG_DELETED,{annotationId:e.annotationId}),this.commonDbService.deleteData({feature:"tag",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",id:e.annotationId,skipFirestore:!0}})):Promise.resolve()}enableAddTagMode(){this.authService.isFeatureAllowed(Ne.TAG)?(this.analyticsService.trackEvent(X.Events.Tag.TAG_ADD_MODE_ENABLED),this.addTagMode$.next(!0)):this.loggingService.catch("Error in TagService enableAddTagMode: ","Tag feature is not enabled.")}disableAddTagMode(){this.analyticsService.trackEvent(X.Events.Tag.TAG_ADD_MODE_DISABLED),this.addTagMode$.next(!1)}addTagModeChange(){return this.addTagMode$.asObservable()}enableTextTags(e){this.enableTextTags$.next(e)}getEnableTextTags$(){return this.enableTextTags$.asObservable()}get timestamp(){return this.commonDbService.getServerTimestamp()}isElementInsideAllowedElements(e){try{return this.domService.isElementInsideListedElementIds(e,this.allowedElementIds$.value)}catch(t){return this.loggingService.catch("Error in TagService isElementInsideAllowedElements: ",t),!1}}attachTag(e,t=[]){let r=na(e,t);if(r){let a=this.domService.getXPath(r),s=this.getTagPinAnnotationObject();s&&(s.targetElement={xpath:a,topPercentage:50,leftPercentage:90},this.saveTagToDb(s))}}getTagPinAnnotationObject(){let e=this.authService.getUser();if(e)if(e.isReadOnly||e.isAnonymous)this.loggingService.catch("Anonymous/Readonly users cannot add tags.");else{let t=new vb;t.from=e,t.color=j.DEFAULT_ANNOTATION_COLOR,t.resolved=!1,t.lastUpdated=this.timestamp;let{topPositionX:r,topPositionY:a}=this.domService.getTopLeftPosition();t.positionX=r,t.positionY=a;let s=this.domService.getCurrentWindowSizeValue();t.screenWidth=s.screenWidth,t.screenHeight=s.screenHeight,t.screenScrollHeight=s.screenScrollHeight,t.taggedElementPath="";let d=this.docService.getLocation();return d&&(t.locationId=d.locationId,t.location=d.location),t}return null}updateNotificationsDatabase(e,t){try{let r={annotationData:e,actionType:t,notificationSource:"tag"};this.notificationService.updateNotificationDatabase(r)}catch(r){this.loggingService.catch("Error in TagService updateNotificationsDatabase: ",r)}}getUserContacts$(){return this.contactService.getUserContacts$()}addUserContact(e){this.contactService.addUserContact(e)}getTagUrl(e){try{return e?.pageInfo?.tagUrl?e.pageInfo.tagUrl:(e?.pageInfo||(e.pageInfo=xi(),e.pageInfo&&(e.pageInfo.screenWidth=this.domService.getCurrentWindowSizeValue()?.screenWidth)),e.pageInfo.tagUrl=this.generateTagUrl(e),this.updateTag(e),e.pageInfo?.tagUrl)}catch(t){this.loggingService.catch("Error in TagService getTagUrl: ",t);return}}uploadFile(e,t){let r=`${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentPaths?.documentId}/${j.FIREBASE_PARTIAL_PATH_TAG}/${t.annotationId}`;return this.documentPaths?.organizationId&&(r=`${j.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${this.documentPaths.organizationId}/${j.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentPaths?.documentId}/${j.FIREBASE_PARTIAL_PATH_TAG}/${t.annotationId}`),this.storageService.uploadFile({path:r,file:e})}downloadAttachment(e){this.storageService.downloadAttachment(e)}deleteAttachment(e){return this.storageService.deleteAttachment({attachment:e})}generateTagUrl(e){let t=new URL(window.location.href);return t.searchParams.delete(j.URL_PARAMS.TAG_ID),t.searchParams.append(j.URL_PARAMS.TAG_ID,e.annotationId),t.href}};o.\u0275fac=function(t){return new(t||o)(J(tt),J(Vt),J(at),J(_n),J(je),J(Fe),J(Ei),J(Sn),J(Rd),J(bi),J(ng),J(Qi),J(y),J(cn),J(yn))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Qk=class extends ri{constructor(o){super(o),this.getService(y).log("%c[WB] Creating CLASS: TagElement","color: blue;"),this.getAllTagAnnotations=this._getAllTagAnnotations,this.deleteTag=this._deleteTag,this.allowedElementIds=this._allowedElementIds,this.attachTag=this._attachTag,this.addTagModeChange=this._addTagModeChange}_getAllTagAnnotations(o,n){this.getService(y).log("%c[WB] Calling FUNCTION: getOnlineUsers","color: green;");try{return this.trackEvent(X.Events.Tag.GET_ALL_TAG_ANNOTATIONS_TRIGGERED,{payload:{documentId:o,location:n}}),this.getService(Va).getAllTagAnnotations(o,n)}catch(e){return this.getService(y).catch("Error in _getLiveTagsOnCurrentDocument: ",e),se(null)}}_deleteTag(){this.getService(y).log("%c[WB] Calling FUNCTION: deleteTag","color: green;");try{this.trackEvent(X.Events.Tag.DELETE_TAG_TRIGGERED),this.getService(Va).deleteTagPinAnnotations("tagElement")}catch(o){this.getService(y).catch("Error in _deleteTag: ",o)}}_allowedElementIds(o){this.getService(y).log("%c[WB] Calling FUNCTION: allowedElementIds","color: green;");try{this.trackEvent(X.Events.Tag.ALLOWED_ELEMENT_IDS_TRIGGERED,{payload:{elementIds:o}}),this.getService(Va).setAllowedElementIds(o)}catch(n){this.getService(y).catch("Error in allowedElementIds: ",n)}}_attachTag(o){this.getService(y).log("%c[WB] Calling FUNCTION: attachTag","color: green;");try{this.trackEvent(X.Events.Tag.ATTACH_TAG_TRIGGERED,{payload:{elementId:o}}),this.getService(Va).attachTag(o,["id","data-id"])}catch(n){this.getService(y).catch("Error in _attachTag: ",n)}}_addTagModeChange(){this.getService(y).log("%c[WB] Calling FUNCTION: addTagModeChange","color: green;");try{return this.trackEvent(X.Events.Tag.ADD_TAG_MODE_CHANGE_TRIGGERED),this.getService(Va).addTagModeChange()}catch(o){return this.getService(y).catch("Error in _addTagModeChange: ",o),se(!1)}}};var Jk=class extends ri{constructor(o){super(o),this.getService(y).log("%c[WB] Creating CLASS: ViewsElement","color: blue;"),this.getUniqueViewsByUser=this._getUniqueViewsByUser,this.getUniqueViewsByDate=this._getUniqueViewsByDate}_getUniqueViewsByUser(o){this.getService(y).log("%c[WB] Calling FUNCTION: _getUniqueViewsByUser","color: green;");try{return this.trackEvent(X.Events.Views.GET_UNIQUE_VIEWS_BY_USER_TRIGGERED,{payload:{clientLocationId:o}}),this.getService(rs).getUniqueViewsByUser(o)}catch(n){return this.getService(y).catch("Error in getUniqueViewsByUser: ",n),se({})}}_getUniqueViewsByDate(o){this.getService(y).log("%c[WB] Calling FUNCTION: _getUniqueViewsByDate","color: green;");try{return this.trackEvent(X.Events.Views.GET_UNIQUE_VIEWS_BY_DATE_TRIGGERED,{payload:{clientLocationId:o}}),this.getService(rs).getUniqueViewsByDate(o)}catch(n){return this.getService(y).catch("Error in getUniqueViewsByDate: ",n),se({})}}};var Tb=(()=>{let o=class o{constructor(e,t){this.docService=e,this.loggingService=t}updateDocuments(e){return Q(this,null,function*(){try{return yield this.docService.updateDocuments(e)}catch(t){return this.loggingService.catch("Error in DocActionsService updateDocuments: ",t),null}})}updateLocations(e){return Q(this,null,function*(){try{return yield this.docService.updateLocations(e)}catch(t){return this.loggingService.catch("Error in DocActionsService updateLocations: ",t),null}})}fetchDocuments(e){return Q(this,null,function*(){try{let t=yield this.docService.fetchDocuments(e),r=[];return t.forEach(a=>{let s=a?.docIamConfig??{},d=a?.metadata??{};d.disabled=!!s?.disabled,d.id=d?.clientDocumentId,d.documentId=d?.clientDocumentId,delete d?.clientDocumentId,d.organizationId=d?.clientOrganizationId,delete d?.clientOrganizationId,delete d?.pageInfo,delete d?.veltFolderId,r.push(d)}),{data:r.reduce((a,s)=>(s?.documentId&&(a[s.documentId]=s),a),{})}}catch(t){return this.loggingService.catch("Error in CommentActionsService fetchDocuments: ",t),{data:null}}})}fetchFolders(e){return Q(this,null,function*(){try{let t=yield this.docService.fetchFolders(e),r=t?.parentFolders?.map(s=>{let d=s?.metadata??{};return delete d?.veltFolderId,d.organizationId=d.clientOrganizationId,delete d?.clientOrganizationId,delete d?.veltParentFolderId,I({},d)});return{data:(t?.data?.map(s=>{let d=s?.metadata??{};return delete d?.veltFolderId,d.organizationId=d.clientOrganizationId,delete d?.clientOrganizationId,delete d?.veltParentFolderId,I(I({},d),e?.folderId?{subFolders:r}:{})})).reduce((s,d)=>(d?.folderId&&(s[d.folderId]=d),s),{})}}catch(t){return this.loggingService.catch("Error in CommentActionsService fetchFolders: ",t),{data:null}}})}};o.\u0275fac=function(t){return new(t||o)(J(at),J(y))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var e9=(()=>{let o=class o{constructor(e,t,r,a,s){this.authService=e,this.coreActionsService=t,this.docService=r,this.iamService=a,this.loggingService=s,this.veltInitState$=new ve(void 0);try{this.loggingService.log("%c[WB] Creating CLASS: VeltService","color: blue;");let d=this.authService.getUser$(),p=this.docService.getDocumentPaths$(),u=this.iamService.isUserAllowed$();En([d,p,u]).subscribe(([C,E,D])=>{C&&E&&D?this.veltInitState$.next(!0):this.veltInitState$.next(!1)}),this.getVeltInitState$().subscribe(C=>{this.coreActionsService.triggerAction(Hi.DOCUMENT_INIT,C)})}catch(d){this.loggingService.catch("Error in VeltService constructor: ",d)}}getVeltInitState$(){try{return this.veltInitState$.asObservable().pipe(kt())}catch(e){return this.loggingService.catch("Error in VeltService getVeltInitState$: ",e),se(void 0)}}};o.\u0275fac=function(t){return new(t||o)(J(je),J(Nd),J(at),J(Sn),J(y))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var sl=(()=>{let o=class o{constructor(e,t,r,a,s,d,p){this.authService=e,this.commonDbService=t,this.commonDbUtilsService=r,this.configService=a,this.docService=s,this.domService=d,this.loggingService=p;try{this.loggingService.log("%c[WB] Creating CLASS: CrdtService","color: blue;")}catch(u){this.loggingService.catch("Error in CrdtService constructor: ",u)}}updateData({id:e,state:t}){try{this.loggingService.log("%c[WB] Calling CrdtService FUNCTION: updateData","color: green;");let r=this.docService.getDocumentPaths(),a=this.authService.getUser(),s=this.domService.getTabId();if(a?.userId&&r){let d=_t(e),p=a.userId,u=_t(a.userId);return this.commonDbService.updateData({feature:"crdtData",properties:{documentId:r?.documentId??"",organizationId:r?.organizationId??"",id:d,skipFirestore:!0},data:{id:e,veltId:d,state:t,lastUpdate:new Date().toISOString(),lastUpdatedBy:p,lastUpdatedByVeltUserId:u,sessionId:s}})}return Promise.resolve(null)}catch(r){return this.loggingService.catch("Error in CrdtService updateData: ",r),Promise.resolve(null)}}onDataChange({id:e,callback:t}){try{this.loggingService.log("%c[WB] Calling CrdtService FUNCTION: onDataChange","color: green;");let r=this.docService.getDocumentPaths();if(r){let a=_t(e),s=this.commonDbService.dbListener({feature:"crdtData",properties:{documentId:r?.documentId??"",organizationId:r?.organizationId??"",id:a,skipFirestore:!0}}).subscribe(d=>{d?.data?t(d.data):t(d)});return()=>s.unsubscribe()}return()=>{}}catch(r){return this.loggingService.catch("Error in CrdtService onDataChange: ",r),()=>{}}}getData({id:e}){try{this.loggingService.log("%c[WB] Calling CrdtService FUNCTION: getData","color: green;");let t=this.docService.getDocumentPaths();if(t){let r=_t(e);return this.commonDbService.getData({feature:"crdtData",properties:{documentId:t?.documentId??"",organizationId:t?.organizationId??"",id:r,skipFirestore:!0}})}return Promise.resolve(null)}catch(t){return this.loggingService.catch("Error in CrdtService getData: ",t),Promise.resolve(null)}}onStateChange({id:e,callback:t}){try{this.loggingService.log("%c[WB] Calling CrdtService FUNCTION: onStateChange","color: green;");let r=this.docService.getDocumentPaths();if(r){let a=_t(e),s=this.commonDbService.dbListener({feature:"crdtSyncState",properties:{documentId:r?.documentId??"",organizationId:r?.organizationId??"",id:a,skipFirestore:!0}}).subscribe(d=>{d?.data?t(d.data):t(d)});return()=>s.unsubscribe()}return()=>{}}catch(r){return this.loggingService.catch("Error in CrdtService onStateChange: ",r),()=>{}}}updateState({id:e,state:t}){try{this.loggingService.log("%c[WB] Calling CrdtService FUNCTION: updateState","color: green;");let r=this.docService.getDocumentPaths(),a=this.authService.getUser(),s=this.domService.getTabId();if(a?.userId&&r){let d=_t(e),p=a.userId,u=_t(p);return this.commonDbService.setData({feature:"crdtSyncState",properties:{documentId:r?.documentId??"",organizationId:r?.organizationId??"",id:d,skipFirestore:!0},data:{id:e,veltId:d,state:t,lastUpdate:new Date().toISOString(),lastUpdatedBy:p,lastUpdatedByVeltUserId:u,sessionId:s}})}return Promise.resolve(null)}catch(r){return this.loggingService.catch("Error in CrdtService updateState: ",r),Promise.resolve(null)}}registerSyncUser(t){return Q(this,arguments,function*({id:e}){try{this.loggingService.log("%c[WB] Calling CrdtService FUNCTION: registerSyncUser","color: green;");let r=this.authService.getUser(),a=this.docService.getDocumentPaths(),s=this.configService.getApiKey(),d=_t(e),p=this.domService.getTabId();if(r?.userId&&a&&s){let u=r.userId,C=_t(u),E={documentId:a?.documentId??"",organizationId:a?.organizationId??"",id:d,userId:C,apiKey:s,skipFirestore:!0},D={userId:u,veltUserId:C,status:"online",lastSeen:Date.now(),sessionId:p};yield this.commonDbService.setData({feature:"crdtSyncPresence",properties:E,data:D});let L=this.commonDbUtilsService.getDocumentPath({feature:"crdtSyncPresence",properties:E,defaultDocumentPaths:a,apiKey:s});L&&(yield this.commonDbService.setupOnDisconnect(L,{status:"offline",lastSeen:new Date().getTime(),sessionId:p}))}}catch(r){this.loggingService.catch("Error in CrdtService registerSyncUser: ",r)}})}onRegisteredUserChange({id:e,callback:t}){try{this.loggingService.log("%c[WB] Calling CrdtService FUNCTION: onRegisteredUserChange","color: green;");let r=this.docService.getDocumentPaths();if(r){let a=_t(e),s=this.commonDbService.dbListener({feature:"allCrdtSyncPresence",properties:{documentId:r?.documentId??"",organizationId:r?.organizationId??"",id:a,skipFirestore:!0}}).subscribe(d=>{d?.data?t(d.data):t(d)});return()=>s.unsubscribe()}return()=>{}}catch(r){return this.loggingService.catch("Error in CrdtService onRegisteredUserChange: ",r),()=>{}}}setPresence(t){return Q(this,arguments,function*({id:e}){try{this.loggingService.log("%c[WB] Calling CrdtService FUNCTION: setPresence","color: green;");let r=this.authService.getUser(),a=this.docService.getDocumentPaths(),s=this.configService.getApiKey(),d=_t(e),p=this.domService.getTabId();if(r?.userId&&a&&s){let u=r.userId,C=_t(u),E={documentId:a?.documentId??"",organizationId:a?.organizationId??"",id:d,userId:C,apiKey:s,skipFirestore:!0},D={userId:u,veltUserId:C,status:"online",lastSeen:Date.now(),sessionId:p};yield this.commonDbService.setData({feature:"crdtPresence",properties:E,data:D});let L=this.commonDbUtilsService.getDocumentPath({feature:"crdtPresence",properties:E,defaultDocumentPaths:a,apiKey:s});L&&(yield this.commonDbService.setupOnDisconnect(L,{status:"offline",lastSeen:new Date().getTime(),sessionId:p}))}}catch(r){this.loggingService.catch("Error in CrdtService setPresence: ",r)}})}onPresenceChange({id:e,callback:t}){try{this.loggingService.log("%c[WB] Calling CrdtService FUNCTION: onPresenceChange","color: green;");let r=this.docService.getDocumentPaths();if(r){let a=_t(e),s=this.commonDbService.dbListener({feature:"allCrdtPresence",properties:{documentId:r?.documentId??"",organizationId:r?.organizationId??"",id:a,skipFirestore:!0}}).subscribe(d=>{d?.data?t(d.data):t(d)});return()=>s.unsubscribe()}return()=>{}}catch(r){return this.loggingService.catch("Error in CrdtService onPresenceChange: ",r),()=>{}}}saveVersion({id:e,versionId:t,versionName:r,state:a}){try{this.loggingService.log("%c[WB] Calling CrdtService FUNCTION: saveVersion","color: green;");let s=this.docService.getDocumentPaths();if(s){let d=_t(e),p={versionId:t,versionName:r,state:a,timestamp:new Date().getTime()};return this.commonDbService.setData({feature:"crdtVersion",properties:{documentId:s?.documentId??"",organizationId:s?.organizationId??"",id:d,versionId:t,skipFirestore:!0},data:I({id:e},p)})}return Promise.resolve(null)}catch(s){return this.loggingService.catch("Error in CrdtService saveVersion: ",s),Promise.resolve(null)}}getVersion(r){return Q(this,arguments,function*({id:e,versionId:t}){try{this.loggingService.log("%c[WB] Calling CrdtService FUNCTION: getVersion","color: green;");let a=this.docService.getDocumentPaths();if(a){let s=_t(e);return this.commonDbService.getData({feature:"crdtVersion",properties:{documentId:a?.documentId??"",organizationId:a?.organizationId??"",id:s,versionId:t,skipFirestore:!0}})}return Promise.resolve(null)}catch(a){return this.loggingService.catch("Error in CrdtService getVersion: ",a),Promise.resolve(null)}})}getVersions(t){return Q(this,arguments,function*({id:e}){try{this.loggingService.log("%c[WB] Calling CrdtService FUNCTION: getVersions","color: green;");let r=this.docService.getDocumentPaths();if(r){let a=_t(e),s=yield this.commonDbService.getData({feature:"crdtVersions",properties:{documentId:r?.documentId??"",organizationId:r?.organizationId??"",id:a,skipFirestore:!0}});return s?Object.values(s):null}return Promise.resolve(null)}catch(r){return this.loggingService.catch("Error in CrdtService getVersions: ",r),Promise.resolve(null)}})}};o.\u0275fac=function(t){return new(t||o)(J(je),J(yn),J(tg),J(Vt),J(at),J(Fe),J(y))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var t9=class extends ri{constructor(o){super(o),this.getService(y).log("%c[WB] Creating CLASS: CrdtElement","color: blue;"),this.updateData=this._updateData,this.onDataChange=this._onDataChange,this.getData=this._getData,this.onStateChange=this._onStateChange,this.updateState=this._updateState,this.registerSyncUser=this._registerSyncUser,this.onRegisteredUserChange=this._onRegisteredUserChange,this.setPresence=this._setPresence,this.onPresenceChange=this._onPresenceChange,this.saveVersion=this._saveVersion,this.getVersion=this._getVersion,this.getVersions=this._getVersions}_updateData(o){this.getService(y).log("%c[WB] Calling FUNCTION: updateData","color: green;");try{return this.getService(sl).updateData(o)}catch(n){return this.getService(y).catch("Error in updateData: ",n),Promise.resolve(null)}}_onDataChange(o){this.getService(y).log("%c[WB] Calling FUNCTION: onDataChange","color: green;");try{return this.getService(sl).onDataChange(o)}catch(n){return this.getService(y).catch("Error in onDataChange: ",n),()=>{}}}_getData(o){this.getService(y).log("%c[WB] Calling FUNCTION: getData","color: green;");try{return this.getService(sl).getData(o)}catch(n){return this.getService(y).catch("Error in getData: ",n),Promise.resolve(null)}}_onStateChange(o){this.getService(y).log("%c[WB] Calling FUNCTION: onStateChange","color: green;");try{return this.getService(sl).onStateChange(o)}catch(n){return this.getService(y).catch("Error in onStateChange: ",n),()=>{}}}_updateState(o){this.getService(y).log("%c[WB] Calling FUNCTION: updateState","color: green;");try{return this.getService(sl).updateState(o)}catch(n){return this.getService(y).catch("Error in updateState: ",n),Promise.resolve(null)}}_registerSyncUser(o){this.getService(y).log("%c[WB] Calling FUNCTION: registerSyncUser","color: green;");try{return this.getService(sl).registerSyncUser(o)}catch(n){return this.getService(y).catch("Error in registerSyncUser: ",n),Promise.resolve()}}_onRegisteredUserChange(o){this.getService(y).log("%c[WB] Calling FUNCTION: onRegisteredUserChange","color: green;");try{return this.getService(sl).onRegisteredUserChange(o)}catch(n){return this.getService(y).catch("Error in onRegisteredUserChange: ",n),()=>{}}}_setPresence(o){this.getService(y).log("%c[WB] Calling FUNCTION: setPresence","color: green;");try{return this.getService(sl).setPresence(o)}catch(n){return this.getService(y).catch("Error in setPresence: ",n),Promise.resolve()}}_onPresenceChange(o){this.getService(y).log("%c[WB] Calling FUNCTION: onPresenceChange","color: green;");try{return this.getService(sl).onPresenceChange(o)}catch(n){return this.getService(y).catch("Error in onPresenceChange: ",n),()=>{}}}_saveVersion(o){this.getService(y).log("%c[WB] Calling FUNCTION: saveVersion","color: green;");try{return this.getService(sl).saveVersion(o)}catch(n){return this.getService(y).catch("Error in saveVersion: ",n),Promise.resolve(null)}}_getVersion(o){this.getService(y).log("%c[WB] Calling FUNCTION: getVersion","color: green;");try{return this.getService(sl).getVersion(o)}catch(n){return this.getService(y).catch("Error in getVersion: ",n),Promise.resolve(null)}}_getVersions(o){this.getService(y).log("%c[WB] Calling FUNCTION: getVersions","color: green;");try{return this.getService(sl).getVersions(o)}catch(n){return this.getService(y).catch("Error in getVersions: ",n),Promise.resolve(null)}}};var n9=class{constructor(o){this.injector=o,this.initConfig=(n,e)=>{this.getService(y).log("%c[WB] Calling FUNCTION: initConfig","color: green;");try{n?typeof n!="string"?this.getService(y).catch("Error in initConfig: ","Apikey must be string."):n?.trim()?this.getService(je).setApiKey(n?.trim(),e):this.getService(y).catch("Error in initConfig: ","Apikey is not provided."):this.getService(y).catch("Error in initConfig: ","Apikey is not provided.")}catch(t){this.getService(y).catch("Error in initConfig: ",t)}},this.identify=(n,e,t)=>(this.getService(y).log("%c[WB] Calling FUNCTION: identify","color: green;"),new Promise((r,a)=>{try{typeof n=="object"&&(n=JSON.parse(JSON.stringify(n)));let s=this.getService(Vt).getApiKey(),d=Ev(s,n.userId);if(t?.ha||this.getService(tt).trackEvent(X.Events.Core.IDENTIFY,{apiKey:s,clientUserId:n.userId,snippylyUserId:d,forceReset:e?.forceReset,user:this.getService(je).getUserWithoutContacts(n),source:"client",fromProvider:t?.fromProvider},!0,d,n?.userId),!(n&&n.userId))this.getService(y).catch("Error in identify: ","Missing userId in config data."),r(null);else if(typeof n.userId!="string")this.getService(y).catch("Error in identify: ","userId must be string."),r(null);else if(n?.groupId&&typeof n?.groupId!="string")this.getService(y).catch("Error in identify: ","groupId must be string."),r(null);else{if(n?.groupId)if(n?.groupId?.match(/^[a-zA-Z0-9_]*$/))n.clientGroupId=n.groupId;else{let u=n.groupId;n.clientGroupId=u,n.groupId=_t(u)}if(n?.organizationId){let u=n.organizationId;n.clientOrganizationId=u,n.organizationId=_t(u)}delete n.isAdmin;let p=j.REGEX_URL;if(n?.name&&p.test(n?.name))throw new Error("Invalid name.");n.clientUserName=n.name,n?.name&&n?.name?.length>20&&(n.name=n.name.slice(0,20)),this.getService(je).initializeClient(n,e||{},new Date().getTime(),void 0,"external").then(u=>{let C;try{u&&(C=JSON.parse(JSON.stringify(u)))}catch{}r(C)}).catch(u=>{this.getService(y).catch("Error in identify: ",u),r(null)})}}catch(s){this.getService(y).catch("Error in identify: ",s),r(null)}})),this.updateUser=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: updateUser","color: green;");try{if(this.getService(y).catch("DEPRECATED: ","'updateUser' method is deprecated."),n&&typeof n=="object"){if(n=JSON.parse(JSON.stringify(n)),n?.groupId)if(n?.groupId?.match(/^[a-zA-Z0-9_]*$/))n.clientGroupId=n.groupId;else{let e=n.groupId;n.clientGroupId=e,n.groupId=_t(e)}delete n.isAdmin,this.getService(je).updateUser(n)}else this.getService(y).catch("Error in updateUser: ","Invalid user object provided.")}catch(e){this.getService(y).catch("Error in updateUser: ",e)}},this.signOutUser=n=>(this.getService(y).log("%c[WB] Calling FUNCTION: signOutUser","color: green;"),n?.ha||this.trackEvent(X.Events.Core.SIGN_OUT_USER_TRIGGERED),new Promise((e,t)=>Q(this,null,function*(){try{yield this.getService(je).signOutUser("external"),e(null)}catch(r){this.getService(y).catch("Error in signOutUser: ",r),e(null)}}))),this.setDocument=(n,e,t,r)=>Q(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: setDocument","color: green;");try{r?.ha||this.trackEvent(X.Events.Core.SET_DOCUMENTS_TRIGGERED,{payload:{id:n,documentMetadata:e,methodName:"setDocument",source:"external"}}),n&&n.trim()?(e&&(typeof e=="object"?e=JSON.parse(JSON.stringify(e)):this.getService(y).catch("Error in setDocument: ","Invalid documentMetadata provided.")),yield this.getService(at).setDocument({documentId:n,documentMetadata:e,options:t,source:"external"})):this.getService(y).catch("Error in setDocument: ","Invalid document id provided.")}catch(a){this.getService(y).catch("Error in setDocument: ",a)}}),this.setDocumentId=(n,e,t)=>Q(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: setDocumentId","color: green;");try{if(t?.ha||this.trackEvent(X.Events.Core.SET_DOCUMENTS_TRIGGERED,{payload:{id:n,organizationId:e,methodName:"setDocumentId",source:"external"}}),n&&n.trim())return yield this.getService(at).setDocumentId({documentId:n,clientOrganizationId:e,source:"external"});this.getService(y).catch("Error in setDocumentId: ","Invalid document id provided.")}catch(r){this.getService(y).catch("Error in setDocumentId: ",r)}}),this.setDocuments=(n,e,t)=>Q(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: setDocuments","color: green;");try{t?.ha||this.trackEvent(X.Events.Core.SET_DOCUMENTS_TRIGGERED,{payload:{documents:n,options:e,methodName:"setDocuments",source:"external"}}),typeof n=="object"&&n instanceof Array?(n=JSON.parse(JSON.stringify(n)),n=n.filter(r=>typeof r=="object"&&r!==null&&r.id?.trim()),n.length?yield this.getService(at).setDocuments({documents:n,options:e,source:"external"}):this.getService(y).catch("Error in setDocuments: ","Invalid documents provided.")):this.getService(y).catch("Error in setDocuments: ","Invalid documents provided.")}catch(r){this.getService(y).catch("Error in setDocuments: ",r)}}),this.setRootDocument=(n,e)=>Q(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: setRootDocument","color: green;");try{e?.ha||this.trackEvent(X.Events.Core.SET_ROOT_DOCUMENT_TRIGGERED,{payload:{document:n,methodName:"setRootDocument",source:"external"}}),typeof n=="object"?(n=JSON.parse(JSON.stringify(n)),n.id?yield this.getService(at).setRootDocument({document:n,source:"external"}):this.getService(y).catch("Error in setRootDocument: ","Invalid document provided.")):this.getService(y).catch("Error in setRootDocument: ","Invalid document provided.")}catch(t){this.getService(y).catch("Error in setRootDocument: ",t)}}),this.unsetDocumentId=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: unsetDocumentId","color: green;");try{n?.ha||this.trackEvent(X.Events.Core.UNSET_DOCUMENTS_TRIGGERED,{payload:{methodName:"unsetDocumentId",source:"external"}}),this.getService(at).unsetDocumentId({source:"external"})}catch(e){this.getService(y).catch("Error in unsetDocumentId: ",e)}},this.unsetDocuments=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: unsetDocuments","color: green;");try{n?.ha||this.trackEvent(X.Events.Core.UNSET_DOCUMENTS_TRIGGERED,{payload:{methodName:"unsetDocuments",source:"external"}}),this.getService(at).unsetDocuments({source:"external"})}catch(e){this.getService(y).catch("Error in unsetDocuments: ",e)}},this.fetchDocuments=(n,e)=>{this.getService(y).log("%c[WB] Calling FUNCTION: fetchDocuments","color: green;");try{return e?.ha||this.trackEvent(X.Events.Core.FETCH_DOCUMENTS_TRIGGERED,{payload:{options:n}}),this.getService(Tb).fetchDocuments(n)}catch(t){return this.getService(y).catch("Error in fetchDocuments: ",t),Promise.resolve({data:null})}},this.updateDocuments=(n,e)=>{this.getService(y).log("%c[WB] Calling FUNCTION: updateDocuments","color: green;");try{return e?.ha||this.trackEvent(X.Events.Core.UPDATE_DOCUMENTS_TRIGGERED,{payload:{request:n}}),this.getService(Tb).updateDocuments(n)}catch(t){return this.getService(y).catch("Error in updateDocuments: ",t),Promise.resolve({data:null})}},this.updateLocations=(n,e)=>{this.getService(y).log("%c[WB] Calling FUNCTION: updateLocations","color: green;");try{return e?.ha||this.trackEvent(X.Events.Core.UPDATE_LOCATIONS_TRIGGERED,{payload:{request:n}}),this.getService(Tb).updateLocations(n)}catch(t){return this.getService(y).catch("Error in updateLocations: ",t),Promise.resolve({data:null})}},this.fetchFolders=(n,e)=>{this.getService(y).log("%c[WB] Calling FUNCTION: fetchFolders","color: green;");try{return e?.ha||this.trackEvent(X.Events.Core.FETCH_FOLDERS_TRIGGERED,{payload:{options:n}}),this.getService(Tb).fetchFolders(n)}catch(t){return this.getService(y).catch("Error in fetchFolders: ",t),Promise.resolve({data:null})}},this.setUserDataProvider=(n,e)=>{this.getService(y).log("%c[WB] Calling FUNCTION: setUserDataProvider","color: green;");try{e?.ha||this.trackEvent(X.Events.Core.SET_USER_DATA_PROVIDER_TRIGGERED),this.getService(Yn).setUserDataProvider(n)}catch(t){this.getService(y).catch("Error in setUserDataProvider: ",t)}},this.setDataProviders=(n,e)=>{this.getService(y).log("%c[WB] Calling FUNCTION: setDataProviders","color: green;");try{if(e?.ha||this.trackEvent(X.Events.Core.SET_DATA_PROVIDERS_TRIGGERED),n.comment&&this.getService(ws).setCommentAnnotationDataProvider(n.comment),n.user&&this.getService(Yn).setUserDataProvider(n.user),n.reaction&&this.getService(Ld).setReactionAnnotationDataProvider(n.reaction),n.attachment)if(n.comment)this.getService(eg).setAttachmentDataProvider(n.attachment);else throw new Error("Comment data provider is required for attachment data provider")}catch(t){this.getService(y).catch("Error in setDataProviders: ",t)}},this.setVeltAuthProvider=n=>Q(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: setVeltAuthProvider","color: green;");try{return yield this.getService(je).setVeltAuthProvider(n)}catch(e){return this.getService(y).catch("Error in setVeltAuthProvider: ",e),null}}),this.getDocumentId=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getDocumentId","color: green;");try{return n?.ha||this.trackEvent(X.Events.Core.GET_DOCUMENT_ID_TRIGGERED),this.getService(at).getDocumentId()}catch(e){this.getService(y).catch("Error in getDocumentId: ",e)}},this.setLocation=(n,e,t)=>Q(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: setLocation","color: green;");try{t?.ha||this.trackEvent(X.Events.Core.SET_LOCATIONS_TRIGGERED,{payload:{params:n,appendLocation:e,methodName:"setLocation",source:"external"}}),n&&typeof n=="object"?e?this.getService(at).addLocation({location:n,source:"external"}):yield this.getService(at).setLocation({location:n,source:"external"}):this.getService(y).catch("Error in setLocation: ","Invalid location params provided.")}catch(r){this.getService(y).catch("Error in setLocation: ",r)}}),this.setRootLocation=(n,e)=>Q(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: setRootLocation","color: green;");try{e?.ha||this.trackEvent(X.Events.Core.SET_ROOT_LOCATION_TRIGGERED,{payload:{location:n,methodName:"setRootLocation",source:"external"}}),typeof n=="object"?(n=JSON.parse(JSON.stringify(n)),n.id?yield this.getService(at).setRootLocation({location:n,source:"external"}):this.getService(y).catch("Error in setRootLocation: ","Invalid location provided.")):this.getService(y).catch("Error in setRootLocation: ","Invalid location provided.")}catch(t){this.getService(y).catch("Error in setRootLocation: ",t)}}),this.setLocations=(n,e,t)=>Q(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: setLocations","color: green;");try{t?.ha||this.trackEvent(X.Events.Core.SET_LOCATIONS_TRIGGERED,{payload:{locations:n,options:e,methodName:"setLocations",source:"external"}}),n&&Array.isArray(n)?yield this.getService(at).setLocations({locations:n,options:e,source:"external"}):this.getService(y).catch("Error in setLocations: ","Invalid location params provided.")}catch(r){this.getService(y).catch("Error in setLocations: ",r)}}),this.addLocation=(n,e)=>Q(this,null,function*(){this.getService(y).log("%c[WB] Calling FUNCTION: addLocation","color: green;");try{e?.ha||this.trackEvent(X.Events.Core.SET_LOCATIONS_TRIGGERED,{payload:{params:n,methodName:"addLocation",source:"external"}}),n&&typeof n=="object"?this.getService(at).addLocation({location:n,source:"external"}):this.getService(y).catch("Error in addLocation: ","Invalid location params provided.")}catch(t){this.getService(y).catch("Error in addLocation: ",t)}}),this.setScrollableElementsIds=(n,e)=>{this.getService(y).log("%c[WB] Calling FUNCTION: setScrollableElementsIds","color: green;");try{e?.ha||this.trackEvent(X.Events.Core.SET_SCROLLABLE_ELEMENTS_IDS_TRIGGERED,{payload:{ids:n}}),n?this.getService(Fe).setScrollableElementsIds(n):this.getService(y).catch("Error in setScrollableElementsIds: ","Invalid ids provided.")}catch(t){this.getService(y).catch("Error in setScrollableElementsIds: ",t)}},this.removeLocation=(n,e)=>{this.getService(y).log("%c[WB] Calling FUNCTION: removeLocation","color: green;");try{e?.ha||this.trackEvent(X.Events.Core.REMOVE_LOCATIONS_TRIGGERED,{payload:{location:n},methodName:"removeLocation",source:"external"}),this.getService(at).removeLocation({location:n,source:"external"})}catch(t){this.getService(y).catch("Error in removeLocation: ",t)}},this.removeLocations=(n,e)=>{this.getService(y).log("%c[WB] Calling FUNCTION: removeLocations","color: green;");try{e?.ha||this.trackEvent(X.Events.Core.REMOVE_LOCATIONS_TRIGGERED,{payload:{locations:n},methodName:"removeLocations",source:"external"}),this.getService(at).removeLocations({locations:n,source:"external"})}catch(t){this.getService(y).catch("Error in removeLocations: ",t)}},this.unsetLocationIds=(n,e)=>{this.getService(y).log("%c[WB] Calling FUNCTION: unsetLocationIds","color: green;");try{e?.ha||this.trackEvent(X.Events.Core.UNSET_LOCATIONS_TRIGGERED,{payload:{locationIds:n},methodName:"unsetLocationIds",source:"external"}),this.getService(at).unsetLocationIds(n,"external")}catch(t){this.getService(y).catch("Error in unsetLocationIds: ",t)}},this.excludeLocationIds=(n,e)=>{this.getService(y).log("%c[WB] Calling FUNCTION: excludeLocationIds","color: green;");try{e?.ha||this.trackEvent(X.Events.Core.EXCLUDE_LOCATION_IDS_TRIGGERED,{payload:{ids:n}}),typeof n=="object"&&n instanceof Array&&(n=n.filter(t=>typeof t=="string"),this.getService(at).excludeLocationIds(n))}catch(t){this.getService(y).catch("Error in excludeLocationIds: ",t)}},this.updateContactList=(n,e,t)=>{this.getService(y).log("%c[WB] Calling FUNCTION: updateContactList","color: green;");try{t?.ha||this.trackEvent(X.Events.Core.UPDATE_CONTACT_LIST_TRIGGERED,{payload:{userContacts:n,config:e}}),typeof n=="object"&&n instanceof Array&&(!e||e&&typeof e=="object")&&(n=JSON.parse(JSON.stringify(n)),this.getService(bi).updateContactList(n,e))}catch(r){this.getService(y).catch("Error in updateContactList: ",r)}},this.removeScrollableElementsIds=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: removeScrollableElementsIds","color: green;");try{n?.ha||this.trackEvent(X.Events.Core.REMOVE_SCROLLABLE_ELEMENTS_IDS_TRIGGERED),this.getService(Fe).removeScrollableElementsIds()}catch(e){this.getService(y).catch("Error in removeScrollableElementsIds: ",e)}},this.getPresenceElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getPresenceElement","color: green;");try{let e=new Wk(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getPresenceElement: ",e),null}},this.getCursorElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getCursorElement","color: green;");try{let e=new Uk(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getCursorElement: ",e),null}},this.getCommentElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getCommentElement","color: green;");try{let e=new kk(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getCommentElement: ",e),null}},this.getTagElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getTagElement","color: green;");try{let e=new Qk(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getTagElement: ",e),null}},this.getSelectionElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getSelectionElement","color: green;");try{let e=new Xk(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getSelectionElement: ",e),null}},this.getRecorderElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getRecorderElement","color: green;");try{let e=new Yk(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getRecorderElement: ",e),null}},this.getContactElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getContactElement","color: green;");try{let e=new Rk(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getContactElement: ",e),null}},this.getRewriterElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getRewriterElement","color: green;");try{let e=new Zk(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getRewriterElement: ",e),null}},this.getHuddleElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getHuddleElement","color: green;");try{let e=new $k(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getHuddleElement: ",e),null}},this.getLiveStateSyncElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getLiveStateSyncElement","color: green;");try{let e=new Hk(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getLiveStateSyncElement: ",e),null}},this.getArrowElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getArrowElement","color: green;");try{let e=new Ak(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getArrowElement: ",e),null}},this.getViewsElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getViewsElement","color: green;");try{let e=new Jk(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getViewsElement: ",e),null}},this.getNotificationElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getNotificationElement","color: green;");try{let e=new Gk(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getNotificationElement: ",e),null}},this.getAutocompleteElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getAutocompleteElement","color: green;");try{let e=new Mk(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getAutocompleteElement: ",e),null}},this.getDocElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getDocElement","color: green;");try{let e=new jk(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getDocElement: ",e),null}},this.getAreaElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getAreaElement","color: green;");try{let e=new wk(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getAreaElement: ",e),null}},this.getReactionElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getReactionElement","color: green;");try{let e=new qk(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getReactionElement: ",e),null}},this.getCrdtElement=n=>{this.getService(y).log("%c[WB] Calling FUNCTION: getCrdtElement","color: green;");try{let e=new t9(this.injector);return n?.ha&&e.ha(n.ha),e}catch(e){return this.getService(y).catch("Error in getCrdtElement: ",e),null}},this.getMetadata=n=>Q(this,null,function*(){try{return n?.ha||this.trackEvent(X.Events.Core.GET_METADATA_TRIGGERED),this.getService(Vd).getGlobalMetadata()}catch(e){return this.getService(y).catch("Error in getMetadata: ",e),null}}),this.disableFeatures=(n,e)=>{try{e?.ha||this.trackEvent(X.Events.Core.DISABLE_FEATURES_TRIGGERED,{payload:{features:n}}),this.getService(Vt).disableFeatures(n)}catch(t){this.getService(y).catch("Error in disableFeatures: ",t)}},this.setDarkMode=(n,e)=>{try{e?.ha||this.trackEvent(X.Events.Core.SET_DARK_MODE_TRIGGERED,{payload:{value:n}}),this.getService(qe).setDarkMode(n)}catch(t){this.getService(y).catch("Error in setDarkMode: ",t)}},this.enableLogs=n=>{try{n?.ha||this.trackEvent(X.Events.Core.ENABLE_LOGS_TRIGGERED),this.getService(Vt).enableLogs()}catch(e){this.getService(y).catch("Error in enableLogs: ",e)}},this.disableLogs=(n,e)=>{try{e?.ha||this.trackEvent(X.Events.Core.DISABLE_LOGS_TRIGGERED),this.getService(Vt).disableLogs(n)}catch(t){this.getService(y).catch("Error in disableLogs: ",t)}},this.isUserAllowed$=n=>{try{return n?.ha||this.trackEvent(X.Events.Core.IS_USER_ALLOWED_TRIGGERED),this.getService(Sn).isUserAllowed$()}catch(e){return this.getService(y).catch("Error in isUserAllowed$: ",e),se(!1)}},this.getUser=n=>{try{n?.ha||this.trackEvent(X.Events.Core.GET_USER_TRIGGERED);let e=this.getService(je).getUser();if(e&&typeof e=="object"){let t=JSON.parse(JSON.stringify(e));return t?.clientOrganizationId&&(t.organizationId=t.clientOrganizationId,delete t.clientOrganizationId),t?.clientGroupId&&(t.groupId=t.clientGroupId,delete t.clientGroupId),delete t.userSnippylyId,t}else return null}catch(e){return this.getService(y).catch("Error in getUser: ",e),null}},this.getUserRole$=n=>{try{return n?.ha||this.trackEvent(X.Events.Core.GET_USER_ROLE_TRIGGERED),this.getService(Sn).getRole$()}catch(e){return this.getService(y).catch("Error in getUserRole$: ",e),se("")}},this.getFeaturesAccessLevelIam$=n=>{try{return n?.ha||this.trackEvent(X.Events.Core.GET_FEATURES_ACCESS_LEVEL_IAM_TRIGGERED),this.getService(Sn).getFeaturesAccessLevel$()}catch(e){return this.getService(y).catch("Error in getFeaturesAccessLevel$: ",e),se(void 0)}},this.isPlanExpired$=n=>{try{return n?.ha||this.trackEvent(X.Events.Core.IS_PLAN_EXPIRED_TRIGGERED),this.getService(je).isPlanExpired$()}catch(e){return this.getService(y).catch("Error in isPlanExpired$: ",e),se(!1)}},this.getCustomerMetadata$=n=>{try{return n?.ha||this.trackEvent(X.Events.Core.GET_CUSTOMER_METADATA_TRIGGERED),this.getService(at).getCustomerMetadata$()}catch(e){return this.getService(y).catch("Error in getCustomerMetadata$: ",e),se(null)}},this.getDocumentMetadata=n=>{try{return n?.ha||this.trackEvent(X.Events.Core.GET_DOCUMENT_METADATA_TRIGGERED),this.getService(at).getDocumentMetadata$()}catch(e){return this.getService(y).catch("Error in getDocumentMetadata: ",e),se(null)}},this.getVeltInitState=n=>{try{return n?.ha||this.trackEvent(X.Events.Core.GET_VELT_INIT_STATE_TRIGGERED),this.getService(e9).getVeltInitState$()}catch(e){return this.getService(y).catch("Error in getVeltInitState: ",e),se(void 0)}},this.removeVeltContent=(n,e)=>{try{return e?.ha||this.trackEvent(X.Events.Core.REMOVE_VELT_CONTENT_TRIGGERED),this.getService(Fe).removeSnippylyContent(n)}catch(t){return this.getService(y).catch("Error in removeVeltContent: ",t),""}},this.injectCustomCss=(n,e)=>{try{e?.ha||this.trackEvent(X.Events.Core.INJECT_CUSTOM_CSS_TRIGGERED),this.getService(y).log("%c[WB] Calling FUNCTION: injectCustomCss","color: green;"),this.getService(Fe).setCustomCss(n)}catch(t){this.getService(y).catch("Error in injectCustomCss: ",t)}},this.setLanguage=(n,e)=>{try{e?.ha||this.trackEvent(X.Events.Core.SET_LANGUAGE_TRIGGERED,{payload:{language:n}}),this.getService(al).setLanguage(n)}catch(t){this.getService(y).catch("Error in setLanguage: ",t)}},this.setTranslations=(n,e)=>{try{e?.ha||this.trackEvent(X.Events.Core.SET_TRANSLATIONS_TRIGGERED,{payload:{translations:n}}),this.getService(al).setTranslations(n)}catch(t){this.getService(y).catch("Error in setTranslations: ",t)}},this.enableAutoTranslation=n=>{try{n?.ha||this.trackEvent(X.Events.Core.ENABLE_AUTO_TRANSLATION_TRIGGERED),this.getService(al).enableAutoTranslation()}catch(e){this.getService(y).catch("Error in enableAutoTranslation: ",e)}},this.disableAutoTranslation=n=>{try{n?.ha||this.trackEvent(X.Events.Core.DISABLE_AUTO_TRANSLATION_TRIGGERED),this.getService(al).disableAutoTranslation()}catch(e){this.getService(y).catch("Error in disableAutoTranslation: ",e)}},this.sf=(n,e)=>{try{e?.ha||this.trackEvent(X.Events.Core.SF_TRIGGERED,{payload:{value:n}}),n?(document.querySelector(j.TAGS.SNIPPYLY_PLUGIN)||document.querySelector(j.TAGS.SUPERFLOW_TOOLBAR))&&this.getService(Vt).setSF(n):this.getService(Vt).setSF(n)}catch(t){this.getService(y).catch("Error in sf: ",t)}},this.st=(n,e)=>{try{e?.ha||this.trackEvent(X.Events.Core.ST_TRIGGERED,{payload:{value:n}}),this.getService(Vt).setSdkType(n)}catch(t){this.getService(y).catch("Error in st: ",t)}},this.getService=n=>this.injector.get(n),this.on=(n,e)=>{this.getService(y).log("%c[WB] Calling FUNCTION: on","color: green;");try{return e?.ha||this.trackEvent(X.Events.Core.ON_ACTION_TRIGGERED,{payload:{action:n}}),this.getService(Nd).onAction(n)}catch(t){return this.getService(y).catch("Error in on: ",t),se(null)}},this.setUiState=(n,e)=>{try{e?.ha||this.trackEvent(X.Events.Core.SET_UI_STATE_TRIGGERED,{payload:{uiState:n}}),this.getService(at).setUIState(n)}catch(t){this.getService(y).catch("Error in setUiState: ",t)}},this.getUiState=n=>{try{return n?.ha||this.trackEvent(X.Events.Core.GET_UI_STATE_TRIGGERED),this.getService(at).getUIState$()}catch(e){return this.getService(y).catch("Error in getUiState: ",e),se({})}},this.resetVeltButtonState=(n,e)=>{try{e?.ha||this.trackEvent(X.Events.Core.RESET_VELT_BUTTON_STATE_TRIGGERED,{payload:{config:n}}),this.getService(g0).resetVeltButtonState(n)}catch(t){this.getService(y).catch("Error in resetVeltButtonState: ",t)}},this.getService(y).log("%c[WB] Creating CLASS: Snippyly","color: blue;")}trackEvent(o,n={},e=!0){try{n||(n={}),n=T(I({},n),{source:"external"}),this.getService(tt).trackAuthenticatedEvent(o,n,e)}catch(t){this.getService(y).catch("Error in _trackEvent: ",t);return}}};var Wce=(()=>{let o=class o{constructor(){this.veltElement=!0}ngOnInit(){}};o.\u0275fac=function(t){return new(t||o)},o.\u0275cmp=O({type:o,selectors:[["app-external-styles"]],hostVars:1,hostBindings:function(t,r){t&2&&x("data-velt-element",r.veltElement)},standalone:!1,decls:0,vars:0,template:function(t,r){},styles:[`.cdk-overlay-container,.cdk-global-overlay-wrapper{pointer-events:none;top:0;left:0;height:100%;width:100%}.cdk-overlay-container{position:fixed;z-index:1000}.cdk-overlay-container:empty{display:none}.cdk-global-overlay-wrapper{display:flex;position:absolute;z-index:1000}.cdk-overlay-pane{position:absolute;pointer-events:auto;box-sizing:border-box;display:flex;max-width:100%;max-height:100%;z-index:1000}.cdk-overlay-backdrop{position:absolute;inset:0;pointer-events:auto;-webkit-tap-highlight-color:rgba(0,0,0,0);opacity:0;z-index:1000;transition:opacity .4s cubic-bezier(.25,.8,.25,1)}@media (prefers-reduced-motion){.cdk-overlay-backdrop{transition-duration:1ms}}.cdk-overlay-backdrop-showing{opacity:1}@media (forced-colors: active){.cdk-overlay-backdrop-showing{opacity:.6}}.cdk-overlay-dark-backdrop{background:#00000052}.cdk-overlay-transparent-backdrop{transition:visibility 1ms linear,opacity 1ms linear;visibility:hidden;opacity:1}.cdk-overlay-transparent-backdrop.cdk-overlay-backdrop-showing,.cdk-high-contrast-active .cdk-overlay-transparent-backdrop{opacity:0;visibility:visible}.cdk-overlay-backdrop-noop-animation{transition:none}.cdk-overlay-connected-position-bounding-box{position:absolute;display:flex;flex-direction:column;min-width:1px;min-height:1px;z-index:1000}.cdk-global-scrollblock{position:fixed;width:100%;overflow-y:scroll}html{--velt-base-rem-unit: 1}velt-wireframe{display:none!important}:root{--legacy-velt-neutral-0: #000000;--legacy-velt-neutral-1: #141416;--legacy-velt-neutral-2: #23262F;--legacy-velt-neutral-3: #353945;--legacy-velt-neutral-4: #777E90;--legacy-velt-neutral-5: #B1B5C3;--legacy-velt-neutral-6: #E6E8EC;--legacy-velt-neutral-7: #F4F5F6;--legacy-velt-neutral-8: #FCFCFD;--legacy-velt-neutral-9: #FFFFFF;--legacy-velt-dark-1: #141416;--legacy-velt-dark-2: #222226;--legacy-velt-dark-3: #303034;--legacy-velt-dark-4: #404044;--legacy-velt-dark-5: #59595F;--legacy-velt-dark-6: #80808A;--legacy-velt-dark-7: #91919C;--legacy-velt-dark-8: #E5E5E9;--legacy-velt-primary-color: var(--legacy-velt-dark-1);--legacy-velt-primary-dark-color: var(--legacy-velt-dark-8);--legacy-velt-secondary-color: var(--legacy-velt-neutral-4);--legacy-velt-secondary-dark-color: var(--legacy-velt-dark-7);--legacy-velt-bg-color: var(--legacy-velt-neutral-8);--legacy-velt-bg-dark-color: var(--legacy-velt-dark-1);--legacy-velt-border-color: var(--legacy-velt-neutral-6);--legacy-velt-border-dark-color: var(--legacy-velt-dark-3);--legacy-velt-grey-2-color: #D4D6DF;--legacy-velt-grey-2-dark-color: var(--legacy-velt-dark-4);--legacy-velt-grey-4-color: #989898;--legacy-velt-grey-4-dark-color: var(--legacy-velt-dark-6);--legacy-velt-status-open-color: #625DF5;--legacy-velt-status-in-progress-color: #ECB000;--legacy-velt-status-resolved-color: #00C48C;--legacy-velt-purple: #625DF5;--legacy-velt-orange: #ECB000;--legacy-velt-green: #0DCF82;--legacy-velt-blue: #0d6efd;--legacy-velt-primary-btn-color: var(--legacy-velt-purple);--legacy-velt-hyperlink-color: var(--legacy-velt-purple);--legacy-velt-grey-btn-color: var(--legacy-velt-neutral-5);--legacy-velt-header-btn-color: var(--legacy-velt-neutral-3);--legacy-velt-dropdown-item-color: var(--legacy-velt-neutral-2);--legacy-velt-avatar-size: 2rem;--velt-default-font-family: sans-serif;--Icon-Size-Small: 12px;--Icon-Size-Medium: 16px;--Icon-Size-Large: 24px}:root[data-velt-theme=dark]{--legacy-velt-primary-color: var(--legacy-velt-primary-dark-color);--legacy-velt-secondary-color: var(--legacy-velt-secondary-dark-color);--legacy-velt-bg-color: var(--legacy-velt-bg-dark-color);--legacy-velt-border-color: var(--legacy-velt-border-dark-color);--legacy-velt-grey-2-color: var(--legacy-velt-grey-2-dark-color);--legacy-velt-grey-4-color: var(--legacy-velt-grey-4-dark-color);--legacy-velt-primary-btn-color: var(--legacy-velt-border-dark-color);--legacy-velt-hyperlink-color: var(--legacy-velt-secondary-dark-color);--legacy-velt-grey-btn-color: var(--legacy-velt-secondary-dark-color);--legacy-velt-header-btn-color: var(--legacy-velt-secondary-dark-color);--legacy-velt-dropdown-item-color: var(--legacy-velt-secondary-dark-color)}:root{--legacy-velt-tool-padding: 6px;--legacy-velt-tool-icon-size: 1.5rem;--legacy-velt-tool-icon-color: var(--legacy-velt-neutral-4);--legacy-velt-tool-border-radius: 50px;--legacy-velt-tool-border-color: transparent;--legacy-velt-tool-border: 2px solid var(--legacy-velt-tool-border-color);--legacy-velt-tool-bg-color: transparent;--legacy-velt-tool-focus-icon-size: var(--legacy-velt-tool-icon-size);--legacy-velt-tool-focus-icon-color: var(--legacy-velt-tool-icon-color);--legacy-velt-tool-focus-border-radius: var(--legacy-velt-tool-border-radius);--legacy-velt-tool-focus-border-color: var(--legacy-velt-neutral-7);--legacy-velt-tool-focus-border: 2px solid var(--legacy-velt-tool-focus-border-color);--legacy-velt-tool-focus-bg-color: var(--legacy-velt-tool-bg-color);--legacy-velt-tool-hover-icon-size: var(--legacy-velt-tool-icon-size);--legacy-velt-tool-hover-icon-color: var(--legacy-velt-neutral-3);--legacy-velt-tool-hover-border-radius: var(--legacy-velt-tool-border-radius);--legacy-velt-tool-hover-border-color: var(--legacy-velt-neutral-7);--legacy-velt-tool-hover-border: 2px solid var(--legacy-velt-tool-hover-border-color);--legacy-velt-tool-hover-bg-color: var(--legacy-velt-neutral-7);--legacy-velt-tool-active-icon-size: var(--legacy-velt-tool-icon-size);--legacy-velt-tool-active-icon-color: var(--legacy-velt-neutral-9);--legacy-velt-tool-active-border-radius: var(--legacy-velt-tool-border-radius);--legacy-velt-tool-active-border-color: var(--legacy-velt-purple);--legacy-velt-tool-active-border: 2px solid var(--legacy-velt-tool-active-border-color);--legacy-velt-tool-active-bg-color: var(--legacy-velt-purple)}:root[data-velt-theme=dark],:root:not(data-velt-theme) velt-comment-tool[dark],:root:not(data-velt-theme) velt-sidebar-button[dark],:root:not(data-velt-theme) velt-arrow-tool[dark],:root:not(data-velt-theme) velt-reaction-tool[dark],:root:not(data-velt-theme) velt-huddle-tool[dark],:root:not(data-velt-theme) velt-recorder-tool[dark],:root:not(data-velt-theme) velt-user-invite-tool[dark],:root:not(data-velt-theme) velt-user-request-tool[dark],:root:not(data-velt-theme) velt-notifications-tool[dark],:root:not(data-velt-theme) app-recorder-all-tool-menu[dark],:root:not(data-velt-theme) snippyly-recording-preview-steps-dialog[dark],:root:not(data-velt-theme) snippyly-recorder-control-panel-internal[dark],:root:not(data-velt-theme) snippyly-recorder-player-internal[dark],:root:not(data-velt-theme) velt-recorder-player-expanded[dark]:root:not(data-velt-theme) app-transcription-panel[dark]{--legacy-velt-tool-icon-size: 1.5rem;--legacy-velt-tool-icon-color: var(--legacy-velt-neutral-4);--legacy-velt-tool-border-radius: 50px;--legacy-velt-tool-border-color: transparent;--legacy-velt-tool-border: 2px solid var(--legacy-velt-tool-border-color);--legacy-velt-tool-bg-color: transparent;--legacy-velt-tool-focus-icon-size: var(--legacy-velt-tool-icon-size);--legacy-velt-tool-focus-icon-color: var(--legacy-velt-tool-icon-color);--legacy-velt-tool-focus-border-radius: var(--legacy-velt-tool-border-radius);--legacy-velt-tool-focus-border-color: var(--legacy-velt-neutral-2);--legacy-velt-tool-focus-border: 2px solid var(--legacy-velt-tool-focus-border-color);--legacy-velt-tool-focus-bg-color: var(--legacy-velt-tool-bg-color);--legacy-velt-tool-hover-icon-size: var(--legacy-velt-tool-icon-size);--legacy-velt-tool-hover-icon-color: var(--legacy-velt-neutral-5);--legacy-velt-tool-hover-border-radius: var(--legacy-velt-tool-border-radius);--legacy-velt-tool-hover-border-color: var(--legacy-velt-neutral-1);--legacy-velt-tool-hover-border: 2px solid var(--legacy-velt-tool-hover-border-color);--legacy-velt-tool-hover-bg-color: var(--legacy-velt-neutral-1);--legacy-velt-tool-active-icon-size: var(--legacy-velt-tool-icon-size);--legacy-velt-tool-active-icon-color: var(--legacy-velt-neutral-9);--legacy-velt-tool-active-border-radius: var(--legacy-velt-tool-border-radius);--legacy-velt-tool-active-border-color: var(--legacy-velt-purple);--legacy-velt-tool-active-border: 2px solid var(--legacy-velt-tool-active-border-color);--legacy-velt-tool-active-bg-color: var(--legacy-velt-purple)}snippyly-user-avatar,velt-user-avatar{--legacy-velt-user-avatar-size: var(--legacy-velt-avatar-size);--legacy-velt-user-avatar-initial-font-size: .8}snippyly-follow-overlay,velt-follow-overlay{--legacy-velt-follow-overlay-bg-color: var(--legacy-velt-bg-color);--legacy-velt-follow-overlay-text-color: var(--legacy-velt-primary-color);--legacy-velt-follow-overlay-btn-color: var(--legacy-velt-neutral-6);--legacy-velt-follow-overlay-btn-hover-color: var(--legacy-velt-neutral-5);--legacy-velt-follow-overlay-border-color: var(--legacy-velt-border-color)}snippyly-follow-overlay[dark],velt-follow-overlay[dark]{--legacy-velt-follow-overlay-bg-color: var(--legacy-velt-bg-dark-color);--legacy-velt-follow-overlay-text-color: var(--legacy-velt-primary-dark-color);--legacy-velt-follow-overlay-border-color: var(--legacy-velt-border-dark-color)}snippyly-cursor,velt-cursor{--legacy-velt-cursor-avatar-size: var(--legacy-velt-avatar-size);--legacy-velt-cursor-video-size: 4.2rem}snippyly-reaction-tool,velt-reaction-tool,app-reaction-tool{--legacy-velt-reaction-tool-icon-size: 2rem;--legacy-velt-reaction-tool-border-radius: 50px;--legacy-velt-reaction-tool-icon-color: #8F95B2;--legacy-velt-reaction-tool-hover-bg-color: #EAE8F9;--legacy-velt-reaction-tool-active-fill-color: white;--legacy-velt-reaction-tool-active-bg-color: var(--legacy-velt-purple)}snippyly-reaction-tool[dark],velt-reaction-tool[dark],app-reaction-tool[dark]{--legacy-velt-reaction-tool-icon-size: 2rem;--legacy-velt-reaction-tool-border-radius: 50px;--legacy-velt-reaction-tool-icon-color: #EAE8F9;--legacy-velt-reaction-tool-hover-bg-color: #8F95B2;--legacy-velt-reaction-tool-active-fill-color: white;--legacy-velt-reaction-tool-active-bg-color: var(--legacy-velt-purple)}velt-view-analytics-dialog{--legacy-velt-view-analytics-dialog-bg-color: #FFF;--legacy-velt-view-analytics-dialog-border-radius: 12px;--legacy-velt-view-analytics-dialog-border: 1px solid rgba(0, 0, 0, .08);--legacy-velt-view-analytics-dialog-box-shadow: 0px 0px 32px 0px rgba(0, 0, 0, .12);--legacy-velt-view-analytics-dialog-padding: 8px;--legacy-velt-view-analytics-dialog-total-views-count-color: #111;--legacy-velt-view-analytics-dialog-total-views-text-color: #625DF5;--legacy-velt-view-analytics-dialog-today-views-text-color: #848297;--legacy-velt-view-analytics-dialog-views-container-bg-color: #F4F3FF;--legacy-velt-view-analytics-dialog-user-name-color: #4C5366;--legacy-velt-view-analytics-dialog-user-timestamp-color: #959595;--legacy-velt-view-analytics-dialog-back-btn-color: #8F95B2}velt-view-analytics-dialog[dark]{--legacy-velt-view-analytics-dialog-bg-color: #131229;--legacy-velt-view-analytics-dialog-border-radius: 12px;--legacy-velt-view-analytics-dialog-border: 1px solid rgba(255, 255, 255, .08);--legacy-velt-view-analytics-dialog-box-shadow: 0px 0px 32px 0px rgba(0, 0, 0, .12);--legacy-velt-view-analytics-dialog-padding: 8px;--legacy-velt-view-analytics-dialog-total-views-count-color: #FFF;--legacy-velt-view-analytics-dialog-total-views-text-color: #9491F8;--legacy-velt-view-analytics-dialog-today-views-text-color: #848297;--legacy-velt-view-analytics-dialog-views-container-bg-color: rgba(244, 243, 255, .06);--legacy-velt-view-analytics-dialog-user-name-color: #FFF;--legacy-velt-view-analytics-dialog-user-timestamp-color: rgba(255, 255, 255, .4)}velt-reaction-pin-tooltip-internal{--Surface-Neutral-0: #FFF;--Surface-Neutral-2: #F5F5F5;--Surface-Neutral-3: #F0F0F0;--Text-Neutral-0: #0A0A0A;--Text-Neutral-3: #292929;--Text-Neutral-5: #525252;--Text-Neutral-9: #999;--Text-Brand-Primary: #625DF5}velt-reaction-pin-tooltip-internal[dark]{--Surface-Neutral-0: #0F0F0F;--Surface-Neutral-2: #1F1F1F;--Surface-Neutral-3: #2F2F2F;--Text-Neutral-0: #FFF;--Text-Neutral-3: #E0E0E0;--Text-Neutral-5: #C2C2C2;--Text-Neutral-9: #ADADAD;--Text-Brand-Primary: #9491F8}:root{--velt-border-radius-2xs: calc((.125rem + 0px) * var(--velt-base-rem-unit));--velt-border-radius-xs: calc((.25rem + 0px) * var(--velt-base-rem-unit));--velt-border-radius-sm: calc((.5rem + 0px) * var(--velt-base-rem-unit));--velt-border-radius-md: calc((.75rem + 0px) * var(--velt-base-rem-unit));--velt-border-radius-lg: calc((1rem + 0px) * var(--velt-base-rem-unit));--velt-border-radius-xl: calc((1.25rem + 0px) * var(--velt-base-rem-unit));--velt-border-radius-2xl: calc((1.5rem + 0px) * var(--velt-base-rem-unit));--velt-border-radius-3xl: calc((2rem + 0px) * var(--velt-base-rem-unit));--velt-border-radius-full: calc((5rem + 0px) * var(--velt-base-rem-unit));--velt-spacing-2xs: calc((.125rem + 0px) * var(--velt-base-rem-unit));--velt-spacing-xs: calc((.25rem + 0px) * var(--velt-base-rem-unit));--velt-spacing-sm: calc((.5rem + 0px) * var(--velt-base-rem-unit));--velt-spacing-md: calc((.75rem + 0px) * var(--velt-base-rem-unit));--velt-spacing-lg: calc((1rem + 0px) * var(--velt-base-rem-unit));--velt-spacing-xl: calc((1.25rem + 0px) * var(--velt-base-rem-unit));--velt-spacing-2xl: calc((1.5rem + 0px) * var(--velt-base-rem-unit));--velt-font-size-2xs: calc((.625rem + 0px) * var(--velt-base-rem-unit));--velt-font-size-xs: calc((.75rem + 0px) * var(--velt-base-rem-unit));--velt-font-size-sm: calc((.875rem + 0px) * var(--velt-base-rem-unit));--velt-font-size-md: calc((1rem + 0px) * var(--velt-base-rem-unit));--velt-font-size-lg: calc((1.5rem + 0px) * var(--velt-base-rem-unit));--velt-font-size-xl: calc((1.75rem + 0px) * var(--velt-base-rem-unit));--velt-font-size-2xl: calc((2rem + 0px) * var(--velt-base-rem-unit));--velt-light-mode-green: #0DCF82;--velt-light-mode-magenta: #A259FE;--velt-light-mode-amber: #FF7162;--velt-light-mode-purple: #625DF5;--velt-light-mode-cyan: #4BC9F0;--velt-light-mode-orange: #FE965C;--velt-light-mode-black: #080808;--velt-light-mode-white: #FFFFFF;--velt-light-mode-gray: #EBEBEB;--velt-light-mode-error: #FF7162;--velt-light-mode-error-hover: #DE5041;--velt-light-mode-error-foreground: #FFFFFF;--velt-light-mode-error-light: #FFF4F2;--velt-light-mode-error-transparent: rgba(255, 113, 98, .08);--velt-light-mode-warning: #FFCD2E;--velt-light-mode-warning-hover: #C69400;--velt-light-mode-warning-foreground: #474747;--velt-light-mode-warning-light: #FFFBEE;--velt-light-mode-warning-transparent: rgba(255, 205, 46, .08);--velt-light-mode-success: #198F65;--velt-light-mode-success-hover: #006B41;--velt-light-mode-success-foreground: #FFFFFF;--velt-light-mode-success-light: #EDF6F3;--velt-light-mode-success-transparent: rgba(25, 143, 101, .08);--velt-light-mode-accent: #625DF5;--velt-light-mode-accent-text: #625DF5;--velt-light-mode-accent-hover: #534FCF;--velt-light-mode-accent-foreground: #FFFFFF;--velt-light-mode-accent-light: #F2F2FE;--velt-light-mode-accent-transparent: rgba(148, 145, 248, .08);--velt-light-mode-text-0: #0A0A0A;--velt-light-mode-text-1: #141414;--velt-light-mode-text-2: #1F1F1F;--velt-light-mode-text-3: #292929;--velt-light-mode-text-4: #3D3D3D;--velt-light-mode-text-5: #525252;--velt-light-mode-text-6: #666666;--velt-light-mode-text-7: #7A7A7A;--velt-light-mode-text-8: #858585;--velt-light-mode-text-9: #999999;--velt-light-mode-text-10: #B8B8B8;--velt-light-mode-text-11: #A3A3A3;--velt-light-mode-text-12: #8F8F8F;--velt-light-mode-background-0: #FFFFFF;--velt-light-mode-background-1: #FAFAFA;--velt-light-mode-background-2: #F5F5F5;--velt-light-mode-background-3: #F0F0F0;--velt-light-mode-background-4: #EBEBEB;--velt-light-mode-background-5: #E5E5E5;--velt-light-mode-background-6: #E0E0E0;--velt-light-mode-background-7: #DBDBDB;--velt-light-mode-background-8: #D6D6D6;--velt-light-mode-background-9: #D1D1D1;--velt-light-mode-background-10: #CCCCCC;--velt-light-mode-border-0: #FFFFFF;--velt-light-mode-border-1: #FAFAFA;--velt-light-mode-border-2: #F5F5F5;--velt-light-mode-border-3: #F0F0F0;--velt-light-mode-border-4: #EBEBEB;--velt-light-mode-border-5: #E5E5E5;--velt-light-mode-border-6: #E0E0E0;--velt-light-mode-border-7: #DBDBDB;--velt-light-mode-border-8: #D6D6D6;--velt-light-mode-border-9: #D1D1D1;--velt-light-mode-border-10: #CCCCCC;--velt-light-mode-background-transparent: rgba(255, 255, 255, .8);--velt-light-mode-border-transparent: rgba(0, 0, 0, .16);--velt-light-mode-animation-transparent: rgba(255, 255, 255, .2);--velt-dark-mode-green: #0DCF82;--velt-dark-mode-magenta: #A259FE;--velt-dark-mode-amber: #FF7162;--velt-dark-mode-purple: #625DF5;--velt-dark-mode-cyan: #4BC9F0;--velt-dark-mode-orange: #FE965C;--velt-dark-mode-black: #080808;--velt-dark-mode-white: #FFFFFF;--velt-dark-mode-gray: #EBEBEB;--velt-dark-mode-error: #FF7162;--velt-dark-mode-error-hover: #DE5041;--velt-dark-mode-error-foreground: #FFFFFF;--velt-dark-mode-error-light: #FFF4F2;--velt-dark-mode-error-transparent: rgba(255, 113, 98, .08);--velt-dark-mode-warning: #FFCD2E;--velt-dark-mode-warning-hover: #C69400;--velt-dark-mode-warning-foreground: #474747;--velt-dark-mode-warning-light: #FFFBEE;--velt-dark-mode-warning-transparent: rgba(255, 205, 46, .08);--velt-dark-mode-success: #198F65;--velt-dark-mode-success-hover: #006B41;--velt-dark-mode-success-foreground: #FFFFFF;--velt-dark-mode-success-light: #EDF6F3;--velt-dark-mode-success-transparent: rgba(25, 143, 101, .08);--velt-dark-mode-accent: #625DF5;--velt-dark-mode-accent-text: #9491F8;--velt-dark-mode-accent-hover: #534FCF;--velt-dark-mode-accent-foreground: #FFFFFF;--velt-dark-mode-accent-light: #F2F2FE;--velt-dark-mode-accent-transparent: rgba(148, 145, 248, .08);--velt-dark-mode-text-0: #FFFFFF;--velt-dark-mode-text-1: #F5F5F5;--velt-dark-mode-text-2: #EBEBEB;--velt-dark-mode-text-3: #E0E0E0;--velt-dark-mode-text-4: #D6D6D6;--velt-dark-mode-text-5: #C2C2C2;--velt-dark-mode-text-6: #ADADAD;--velt-dark-mode-text-7: #8F8F8F;--velt-dark-mode-text-8: #7A7A7A;--velt-dark-mode-text-9: #666666;--velt-dark-mode-text-10: #525252;--velt-dark-mode-text-11: #474747;--velt-dark-mode-text-12: #3D3D3D;--velt-dark-mode-background-0: #0F0F0F;--velt-dark-mode-background-1: #1A1A1A;--velt-dark-mode-background-2: #1F1F1F;--velt-dark-mode-background-3: #242424;--velt-dark-mode-background-4: #292929;--velt-dark-mode-background-5: #2E2E2E;--velt-dark-mode-background-6: #333333;--velt-dark-mode-background-7: #383838;--velt-dark-mode-background-8: #3D3D3D;--velt-dark-mode-background-9: #424242;--velt-dark-mode-background-10: #474747;--velt-dark-mode-border-0: #0F0F0F;--velt-dark-mode-border-1: #1A1A1A;--velt-dark-mode-border-2: #1F1F1F;--velt-dark-mode-border-3: #242424;--velt-dark-mode-border-4: #292929;--velt-dark-mode-border-5: #2E2E2E;--velt-dark-mode-border-6: #333333;--velt-dark-mode-border-7: #383838;--velt-dark-mode-border-8: #3D3D3D;--velt-dark-mode-border-9: #424242;--velt-dark-mode-border-10: #474747;--velt-dark-mode-background-transparent: rgba(0, 0, 0, .8);--velt-dark-mode-border-transparent: rgba(255, 255, 255, .16);--velt-dark-mode-animation-transparent: rgba(255, 255, 255, .2);--velt-comment-pin-z-index: 2147483557;--velt-arrow-z-index: 2147483557;--velt-recorder-player-z-index: 2147483557;--velt-cursor-z-index: 2147483647;--velt-persistent-comment-frame-z-index: 2147483647;--velt-toast-popup-z-index: 2147483647;--velt-live-state-sync-overlay-z-index: 2147483647;--velt-follow-mode-overlay-z-index: 2147483647;--velt-comments-minimap-z-index: 2147483637;--velt-global-overlay-z-index: 2147483637}*[data-snippyly-element=true],*[data-velt-element=true]{font-family:var(--velt-default-font-family)}.cdk-overlay-container{z-index:var(--velt-global-overlay-z-index)!important}.cdk-overlay-container .cdk-overlay-pane.mat-mdc-dialog-panel{max-width:var(--mat-dialog-container-max-width, 80vw);min-width:var(--mat-dialog-container-min-width, 0)}mat-dialog-container .mat-mdc-dialog-surface.mdc-dialog__surface{background-color:#fff;padding:24px}mat-dialog-container .mat-mdc-dialog-surface.mdc-dialog__surface .mdc-dialog__title:before{height:unset}mat-dialog-container .mat-mdc-dialog-actions{padding:var(--mat-dialog-actions-padding, 8px)}.mat-mdc-autocomplete-panel{padding:0!important;border-radius:var(--velt-border-radius-md)!important}.cdk-overlay-pane{background-color:transparent!important;border:none!important;box-shadow:none!important}.cdk-overlay-pane.mat-mdc-tooltip-panel .mat-mdc-tooltip{color:#fff;background-color:#0b0b0b;border:1px solid #eeeeee;border-radius:4px;padding:8px 12px;font-size:14px}.mat-mdc-menu-panel.velt-menu{box-shadow:none}video.flip{transform:rotateY(180deg);-webkit-transform:rotateY(180deg);-moz-transform:rotateY(180deg)}body[data-velt-huddle-on-cursor-mode] .cdk-overlay-container{z-index:calc(var(--velt-global-overlay-z-index, 2147483637) - 1)!important}body[data-velt-huddle-on-cursor-mode]:not(.show-pin-cursor){cursor:none!important}body[data-velt-huddle-on-cursor-mode]:not(.show-pin-cursor) *{cursor:none!important}body.snippyly-add-comment-mode,body.snippyly-add-comment-mode *{-webkit-user-select:none!important;user-select:none!important}body.snippyly-add-comment-mode [data-velt-iframe-container=true][data-velt-iframe-container-static=true]{position:relative!important}body.snippyly-add-comment-mode [data-velt-iframe-container=true]:before{content:""!important;position:absolute!important;inset:0!important;z-index:1!important}body[data-velt-ongoing-recording=screen][data-velt-comment-recording=true] [data-velt-element=true]:not(snippyly-comment-text-portal):not(velt-recorder-control-panel):not([data-velt-screen-recorder-panel=true]){display:none!important}body[data-velt-ongoing-recording=screen][data-velt-comment-recording=true] snippyly-text-highlight.snippyly-text-highlight{color:inherit!important}body[data-velt-ongoing-recording=screen][data-velt-comment-recording=true] snippyly-text-highlight.snippyly-text-highlight .comment-text-highlight{color:inherit!important;background-color:inherit!important;cursor:inherit!important}body[data-velt-ongoing-recording=screen][data-velt-comment-recording=true] snippyly-text-highlight.snippyly-text-highlight .comment-text-highlight.selected{background-color:inherit!important}body [data-velt-pdf-viewer=true] snippyly-text-highlight.snippyly-text-highlight snippyly-comment-text-portal,body [data-velt-pdf-viewer=true] snippyly-text-highlight.snippyly-text-highlight velt-comment-text-portal{font-family:inherit!important}body [data-velt-pdf-viewer=true] snippyly-text-highlight.snippyly-text-highlight .comment-text-highlight{color:transparent!important}body [data-velt-pdf-viewer=true] snippyly-text-highlight.snippyly-text-highlight .comment-text-highlight.selected{color:transparent!important}body [data-velt-pdf-viewer=true] snippyly-text-highlight.snippyly-text-highlight .comment-annotation-number{display:none!important}:where([data-velt-pdf-viewer=true]) .textLayer:is(:has([data-snippyly-pin-host],[data-velt-pin-host]),:has(snippyly-comment-pin-portal,snippyly-tag-pin-portal,snippyly-recorder-pin-portal,snippyly-arrow-pin-portal,snippyly-area-pin-portal,velt-comment-pin-portal,velt-tag-pin-portal,velt-recorder-pin-portal,velt-arrow-pin-portal,velt-area-pin-portal)){opacity:1!important;visibility:visible!important}:where([data-velt-pdf-viewer=true]) .textLayer:is(:has([data-snippyly-pin-host],[data-velt-pin-host]),:has(snippyly-comment-pin-portal,snippyly-tag-pin-portal,snippyly-recorder-pin-portal,snippyly-arrow-pin-portal,snippyly-area-pin-portal,velt-comment-pin-portal,velt-tag-pin-portal,velt-recorder-pin-portal,velt-arrow-pin-portal,velt-area-pin-portal)) snippyly-text-highlight.snippyly-text-highlight .comment-text-highlight{opacity:.2!important}[data-snippyly-comment-pin-host][data-snippyly-comment-pin-host-static],[data-snippyly-tag-pin-host][data-snippyly-tag-pin-host-static],[data-snippyly-recorder-pin-host][data-snippyly-recorder-pin-host-static],[data-snippyly-arrow-pin-host][data-snippyly-arrow-pin-host-static],[data-snippyly-area-pin-host][data-snippyly-area-pin-host-static],[data-velt-comment-pin-host][data-velt-comment-pin-host-static],[data-velt-tag-pin-host][data-velt-tag-pin-host-static],[data-velt-recorder-pin-host][data-velt-recorder-pin-host-static],[data-velt-arrow-pin-host][data-velt-arrow-pin-host-static],[data-velt-area-pin-host][data-velt-area-pin-host-static]{position:relative}[data-velt-comment-pin-host][data-velt-comment-pin-active=true],[data-velt-area-pin-host][data-velt-area-pin-active=true]{opacity:1!important;visibility:visible!important}.s-display-none,.velt-display-none{display:none!important}.s-flex,.velt-display-flex{display:flex!important}.velt-items-center{align-items:center!important}.s-background-blur-1{-webkit-backdrop-filter:blur(4px)!important;backdrop-filter:blur(4px)!important}.s-background-blur-2{-webkit-backdrop-filter:blur(8px)!important;backdrop-filter:blur(8px)!important}.s-background-blur-3{-webkit-backdrop-filter:blur(12px)!important;backdrop-filter:blur(12px)!important}.s-background-blur-4{-webkit-backdrop-filter:blur(16px)!important;backdrop-filter:blur(16px)!important}.s-tooltip{position:relative!important}.s-tooltip .s-tooltiptext{visibility:hidden!important;block-size:auto!important;width:max-content!important;top:120%!important;background-color:var(--legacy-velt-bg-color);border:1px solid var(--legacy-velt-border-color);color:var(--legacy-velt-primary-color)!important;text-align:left!important;padding:.5em .75em!important;border-radius:6px!important;font-style:normal!important;font-weight:400!important;font-size:12px!important;line-height:2em!important;box-shadow:var(--legacy-velt-box-shadow)!important;position:absolute!important;z-index:1!important;opacity:0!important;transition:opacity .5s!important;left:50%!important;transform:translate(-50%)!important}.s-tooltip .s-tooltiptext:after{content:" "!important;position:absolute!important;top:0!important;left:50%!important;width:12px!important;height:12px!important;border-left:1px solid var(--legacy-velt-border-color);border-top:1px solid var(--legacy-velt-border-color);background-color:var(--legacy-velt-bg-color);border-radius:4px!important;transform:translate(-50%,-41%) rotate(45deg)!important;transform-origin:center!important}.s-tooltip .s-tooltiptext:before{content:" ";position:absolute;top:0;left:50%;width:24px;height:24px;transform:translate(-50%,-41%);background:transparent}.s-tooltip .s-tooltiptext.left{top:50%!important;right:120%!important;transform:translateY(-50%)!important}.s-tooltip .s-tooltiptext.left:after{transform:translate(41%,-50%) rotate(45deg)!important;transform-origin:center!important;left:unset!important;right:0!important;top:50%!important}.s-tooltip .s-tooltiptext.left.top{top:100%!important;transform:translateY(-45%)!important}.s-tooltip .s-tooltiptext.left.top:after{transform:translate(41%,66%) rotate(45deg)!important;top:0!important}.s-tooltip:hover .s-tooltiptext{visibility:visible!important;opacity:1!important}.s-tooltip-light .s-tooltiptext{background-color:#fff!important;color:#000!important;box-shadow:0 2px 8px -2px #9f9f9f!important}.s-tooltip-light .s-tooltiptext:after{background-color:#fff!important}.s-tooltip-link{font-style:normal!important;font-weight:400!important;font-size:12px!important;line-height:calc((1.5rem + 0px) * var(--velt-base-rem-unit))!important;color:#fff!important}.s-cursor-pointer,.velt-cursor-pointer{cursor:pointer!important}.s-shake{animation:shake .82s cubic-bezier(.36,.07,.19,.97) both;transform:translateZ(0);backface-visibility:hidden;perspective:1000px}@keyframes shake{10%,90%{transform:translate3d(-1px,0,0)}20%,80%{transform:translate3d(2px,0,0)}30%,50%,70%{transform:translate3d(-4px,0,0)}40%,60%{transform:translate3d(4px,0,0)}}app-render-timer-wrapper{width:100%;height:100%}velt-comment-text[comment-available=true]{color:var(--Constant-Warning---Text, #E2A600);background-color:#e2a6001a;border-bottom:1px solid #E2A600}
|
|
405
405
|
`],encapsulation:2,changeDetection:0});let i=o;return i})();var jd=(()=>{let o=class o{constructor(e){this.loggingService=e,this.toasts$=new ve([])}setToast(e){try{e.id||(e.id=Math.random()),this.toasts$.next([...this.toasts$.value,e]),e.duration&&e.duration>0&&Ql(e.duration).pipe(rt(1)).subscribe(()=>{this.removeToast(e)},t=>{this.loggingService.catch("Error in ToastService setToast timer subscription: ",t)})}catch(t){this.loggingService.catch("Error in ToastService setToast: ",t)}}removeToast(e){try{this.toasts$.next(this.toasts$.value.filter(t=>t.id!==e.id))}catch(t){this.loggingService.catch("Error in ToastService removeToast: ",t)}}getToasts$(){return this.toasts$.asObservable()}};o.\u0275fac=function(t){return new(t||o)(J(y))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();function DRe(i,o){i&1&&(le(),_(0,"svg",6),w(1,"path",7),b())}function wRe(i,o){i&1&&(le(),_(0,"svg",6),w(1,"path",8)(2,"path",9),b())}function ORe(i,o){if(i&1){let n=q();_(0,"div",2),g(1,DRe,2,0,"svg",3)(2,wRe,3,0,"svg",3),ee(3),P(4,"translate"),le(),_(5,"svg",4),z("click",function(){let t=N(n).$implicit,r=l();return F(r.removeToast(t))}),w(6,"path",5),b()()}if(i&2){let n=o.$implicit;c("@fade",!0),m(),c("ngIf",n.type==="success"),m(),c("ngIf",n.type==="error"),m(),Ce(" ",M(4,4,n.message)," ")}}var qce=(()=>{let o=class o{constructor(e,t,r){this.loggingService=e,this.toastService=t,this.elementRef=r,this.toasts=[],this.subscriptions=[];try{this.subscriptions.push(this.toastService.getToasts$().subscribe(a=>{this.toasts=a}))}catch(a){console.log(a)}}ngOnDestroy(){try{this.subscriptions.forEach(e=>{e.unsubscribe()})}catch{}}ngAfterViewInit(){try{setTimeout(()=>{this.moveToastTagToEnd()},5e3)}catch{}}moveToastTagToEnd(){try{let e=this.elementRef?.nativeElement;document.body.appendChild(e)}catch(e){this.loggingService.catch("Error in ToastPopupComponent moveToastTagToEnd: ",e)}}removeToast(e){this.toastService.removeToast(e)}};o.\u0275fac=function(t){return new(t||o)(h(y),h(jd),h(R))},o.\u0275cmp=O({type:o,selectors:[["velt-toast-popup"]],standalone:!1,decls:2,vars:1,consts:[[1,"s-notification-container"],["class","s-notification",4,"ngFor","ngForOf"],[1,"s-notification"],["width","24","height","24","viewBox","0 0 24 24","fill","none","xmlns","http://www.w3.org/2000/svg",4,"ngIf"],["width","24","height","24","viewBox","0 0 24 24","fill","none","xmlns","http://www.w3.org/2000/svg",1,"s-last-item","s-notification-close-btn",3,"click"],["fill-rule","evenodd","clip-rule","evenodd","d","M5.29289 5.29289C5.68342 4.90237 6.31658 4.90237 6.70711 5.29289L12 10.5858L17.2929 5.29289C17.6834 4.90237 18.3166 4.90237 18.7071 5.29289C19.0976 5.68342 19.0976 6.31658 18.7071 6.70711L13.4142 12L18.7071 17.2929C19.0976 17.6834 19.0976 18.3166 18.7071 18.7071C18.3166 19.0976 17.6834 19.0976 17.2929 18.7071L12 13.4142L6.70711 18.7071C6.31658 19.0976 5.68342 19.0976 5.29289 18.7071C4.90237 18.3166 4.90237 17.6834 5.29289 17.2929L10.5858 12L5.29289 6.70711C4.90237 6.31658 4.90237 5.68342 5.29289 5.29289Z","fill","#E6E8EC"],["width","24","height","24","viewBox","0 0 24 24","fill","none","xmlns","http://www.w3.org/2000/svg"],["fill-rule","evenodd","clip-rule","evenodd","d","M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22ZM17.7071 9.70711C18.0976 9.31658 18.0976 8.68342 17.7071 8.29289C17.3166 7.90237 16.6834 7.90237 16.2929 8.29289L11 13.5858L8.70711 11.2929C8.31658 10.9024 7.68342 10.9024 7.29289 11.2929C6.90237 11.6834 6.90237 12.3166 7.29289 12.7071L10.2929 15.7071C10.6834 16.0976 11.3166 16.0976 11.7071 15.7071L17.7071 9.70711Z","fill","#0DCF82"],["fill-rule","evenodd","clip-rule","evenodd","d","M12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20ZM12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z","fill","#FF7162"],["fill-rule","evenodd","clip-rule","evenodd","d","M8.29289 8.29289C8.68342 7.90237 9.31658 7.90237 9.70711 8.29289L12 10.5858L14.2929 8.29289C14.6834 7.90237 15.3166 7.90237 15.7071 8.29289C16.0976 8.68342 16.0976 9.31658 15.7071 9.70711L13.4142 12L15.7071 14.2929C16.0976 14.6834 16.0976 15.3166 15.7071 15.7071C15.3166 16.0976 14.6834 16.0976 14.2929 15.7071L12 13.4142L9.70711 15.7071C9.31658 16.0976 8.68342 16.0976 8.29289 15.7071C7.90237 15.3166 7.90237 14.6834 8.29289 14.2929L10.5858 12L8.29289 9.70711C7.90237 9.31658 7.90237 8.68342 8.29289 8.29289Z","fill","#FF7162"]],template:function(t,r){t&1&&(_(0,"div",0),g(1,ORe,7,6,"div",1),b()),t&2&&(m(),c("ngForOf",r.toasts))},dependencies:[ft,Z,pe],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-notification-container[_ngcontent-%COMP%]{position:fixed!important;top:5%!important;left:50%!important;transform:translate(-50%)!important;display:flex!important;justify-content:center!important;align-items:center!important;z-index:var(--velt-toast-popup-z-index)!important;gap:calc((.5rem + 0px) * var(--velt-base-rem-unit))!important;flex-direction:column!important}.s-notification[_ngcontent-%COMP%]{display:flex!important;padding:calc((1rem + 0px) * var(--velt-base-rem-unit))!important;gap:calc((1rem + 0px) * var(--velt-base-rem-unit))!important;border-radius:calc((10rem + 0px) * var(--velt-base-rem-unit))!important;background:#23262f!important;color:#e6e8ec!important;width:calc((30rem + 0px) * var(--velt-base-rem-unit))!important;max-width:90vw!important;align-items:center!important}.s-last-item[_ngcontent-%COMP%]{margin-left:auto!important}.s-notification-close-btn[_ngcontent-%COMP%]{cursor:pointer!important}"],data:{animation:[FU("fade",[aP("false",Id({opacity:0})),aP("true",Id({opacity:1})),sP("false => true",[Id({opacity:0}),rP(1e3,Id({opacity:1}))]),sP("true => false",[rP(1e3,Id({opacity:0}))])])]},changeDetection:0});let i=o;return i})();var Ez=i=>({componentConfigSignal:i}),Yce=(i,o)=>({condition:i,data:o}),PRe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-single-editor-mode-panel-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function MRe(i,o){i&1&&Ve(0)}function kRe(i,o){if(i&1&&(_(0,"velt-shadow-dom-internal"),g(1,MRe,1,0,"ng-container",4),b()),i&2){l(3);let n=ce(2);m(),c("ngTemplateOutlet",n)}}function RRe(i,o){if(i&1&&(f(0),g(1,kRe,2,1,"velt-shadow-dom-internal",3),v()),i&2){let n=l().ngIf,e=l(),t=ce(2);m(),c("ngIf",n.shadowDom&&!e.template)("ngIfElse",t)}}function NRe(i,o){if(i&1&&(f(0),g(1,RRe,2,2,"ng-container",2),v()),i&2){let n=l();m(),c("veltIf",k(3,Yce,n.conditionSignal(),A(1,Ez,n.componentConfigSignal)))}}function FRe(i,o){if(i&1&&(f(0),_(1,"div",8),w(2,"velt-single-editor-mode-panel-viewer-text",9)(3,"velt-single-editor-mode-panel-editor-text",9)(4,"velt-single-editor-mode-panel-countdown",9)(5,"velt-single-editor-mode-panel-request-access",9)(6,"velt-single-editor-mode-panel-reject-request",9)(7,"velt-single-editor-mode-panel-edit-here",9),b(),v()),i&2){let n=l(6);m(2),c("componentConfigSignal",n.componentConfigSignal),m(),c("componentConfigSignal",n.componentConfigSignal),m(),c("componentConfigSignal",n.componentConfigSignal),m(),c("componentConfigSignal",n.componentConfigSignal),m(),c("componentConfigSignal",n.componentConfigSignal),m(),c("componentConfigSignal",n.componentConfigSignal)}}function LRe(i,o){if(i&1&&(f(0),g(1,FRe,8,6,"ng-container",7),v()),i&2){let n=l(3).ngIf,e=l(2);m(),c("veltDynamicTemplate",$(3,PRe,e.template,A(1,Ez,e.componentConfigSignal),n.variant,e.setIfCondition.bind(e),e.elementRef))}}function BRe(i,o){if(i&1&&(_(0,"div",6),g(1,LRe,2,9,"ng-container",2),b()),i&2){let n=l(2).ngIf,e=l(2);ue("velt-single-editor-mode-panel-container-no-pointer",n.type==="editor")("no-pointer",n.type==="editor"),m(),c("veltIf",k(7,Yce,e.conditionSignal(),A(5,Ez,e.componentConfigSignal)))}}function VRe(i,o){if(i&1&&(f(0),g(1,BRe,2,10,"div",5),v()),i&2){let n=l().ngIf;m(),c("ngIf",n.leaderName!==""||n.type==="editor")}}function URe(i,o){if(i&1&&(f(0),g(1,VRe,2,1,"ng-container",1),v()),i&2){let n=o.ngIf;m(),c("ngIf",n.singleEditorMode)}}function jRe(i,o){if(i&1&&g(0,URe,2,1,"ng-container",1),i&2){let n=l();c("ngIf",n.componentConfigSignal())}}var hh=(()=>{let o=class o extends Je{set _shadowDom(e){try{let t=e;typeof e=="string"&&(t=JSON.parse(e)),this.componentConfigSignal.update(r=>(r=T(I({},r),{shadowDom:t}),r))}catch(t){this.loggingService.catch("Error in SingleEditorModePanelComponent _shadowDom: ",t)}}constructor(e,t,r,a,s,d,p){super(e,s,void 0,void 0,void 0,d,a),this.elementRef=e,this.authService=t,this.liveStateService=r,this.loggingService=a,this.themeService=s,this.dynamicDataService=d,this.wireframeService=p,this.subscriptions=[],this.componentConfigSignal=xe({singleEditorMode:!1,defaultSingleEditorUIEnabled:!1,editAccessRequested:!1,leaderName:"",type:"reader",requestEditorAccessCountdown:0,singleEditorLiveStateData:null,singleEditorConfig:null,isUserEditor:null,variant:this.variant,shadowDom:!0,requestEditorAccess:this.requestEditorAccess.bind(this),cancelEditorAccessRequest:this.cancelEditorAccessRequest.bind(this),rejectEditorAccessRequest:this.rejectEditorAccessRequest.bind(this),acceptEditorAccessRequest:this.acceptEditorAccessRequest.bind(this),editCurrentTab:this.editCurrentTab.bind(this)}),this.componentId="velt-single-editor-mode-panel";try{this.loggingService.log("%c[WB] Calling FUNCTION: SingleEditorModePanelComponent constructor","color: green;"),this.subscriptions.push(this.liveStateService.getSingleEditorMode$().subscribe(u=>{this.componentConfigSignal.update(C=>T(I({},C),{singleEditorMode:u}))})),this.subscriptions.push(this.liveStateService.getDefaultSingleEditorUIEnabled$().subscribe(u=>{this.componentConfigSignal.update(C=>T(I({},C),{defaultSingleEditorUIEnabled:u}))})),this.subscriptions.push(this.liveStateService.getSingleEditorModeConfig$().subscribe(u=>{this.componentConfigSignal.update(C=>T(I({},C),{singleEditorConfig:u}))})),this.subscriptions.push(this.liveStateService.isUserEditor$().subscribe(u=>{this.componentConfigSignal.update(C=>T(I({},C),{isUserEditor:u}))})),this.subscriptions.push(this.liveStateService.getSingleEditorLiveStateData$().subscribe(u=>{let C=this.componentConfigSignal().singleEditorLiveStateData?.requestEditorAccess?.user?.userId,E=u?.requestEditorAccess?.user?.userId;if(C&&E&&C!==E&&this.componentConfigSignal().requestEditorAccessCountdown&&this.removeRequestEditorAccessCountdown(),this.componentConfigSignal.update(D=>T(I({},D),{singleEditorLiveStateData:u})),u){this.componentConfigSignal.update(L=>T(I({},L),{leaderName:u?.editor?.name||u?.editor?.email||""}));let D=this.authService.getUser();D?.userId===u?.editor?.userId?this.componentConfigSignal.update(L=>T(I({},L),{type:"editor"})):this.componentConfigSignal.update(L=>T(I({},L),{type:"reader"})),D?.userId===u?.requestEditorAccess?.user?.userId&&u?.requestEditorAccess?.status==="pending"?this.componentConfigSignal.update(L=>T(I({},L),{editAccessRequested:!0})):this.componentConfigSignal.update(L=>T(I({},L),{editAccessRequested:!1})),this.componentConfigSignal().type==="editor"&&!this.componentConfigSignal().requestEditorAccessCountdown&&u?.requestEditorAccess?.status==="pending"?this.showRequestEditorAccessCountdown():this.removeRequestEditorAccessCountdown()}}))}catch(u){this.loggingService.catch("Error in SingleEditorModePanelComponent constructor: ",u)}}ngOnInit(){try{this.loggingService.log("%c[WB] Calling FUNCTION: ngOnInit","color: green;"),super.ngOnInit(),this.setupA11yAttributes();let e="velt-single-editor-mode-panel-wireframe";this.variant&&(e+=`---${this.variant}`),this.wireframeService.getWireframe$(e).subscribe(t=>{if(t){let r=document.createElement(t.tagName);r.innerHTML=t.innerHTML,this.template=r}})}catch(e){this.loggingService.catch("Error in SingleEditorModePanelComponent ngOnInit: ",e)}}ngOnDestroy(){try{super.ngOnDestroy(),this.subscriptions.forEach(e=>{e.unsubscribe()})}catch(e){this.loggingService.catch("Error in SingleEditorModePanelComponent ngOnDestroy: ",e)}}ngOnChanges(e){try{super.ngOnChanges(e),e&&Object.keys(e).forEach(t=>{this.componentConfigSignal.update(r=>(r=T(I({},r),{[t]:e[t].currentValue}),r))})}catch(t){this.loggingService.catch("Error in SingleEditorModePanelComponent ngOnChanges: ",t)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in SingleEditorModePanelComponent setupA11yAttributes:",e)}}showRequestEditorAccessCountdown(){try{this.loggingService.log("%c[WB] Calling FUNCTION: showRequestEditorAccessCountdown","color: green;"),this.componentConfigSignal.update(e=>(e=T(I({},e),{requestEditorAccessCountdown:e.singleEditorLiveStateData?.requestEditorAccess?.editorAccessTimeout||j.LIVE_STATE_REQUEST_EDITOR_ACCESS_WAIT_TIME}),e)),this.interval=setInterval(()=>{this.componentConfigSignal.update(e=>T(I({},e),{requestEditorAccessCountdown:e.requestEditorAccessCountdown-1})),this.componentConfigSignal().requestEditorAccessCountdown<=0&&clearInterval(this.interval)},1e3)}catch(e){this.loggingService.catch("Error in SingleEditorModePanelComponent showRequestEditorAccessCountdown: ",e)}}removeRequestEditorAccessCountdown(){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeRequestEditorAccessCountdown","color: green;"),this.componentConfigSignal.update(e=>T(I({},e),{requestEditorAccessCountdown:0})),clearInterval(this.interval)}catch(e){this.loggingService.catch("Error in SingleEditorModePanelComponent removeRequestEditorAccessCountdown: ",e)}}requestEditorAccess(){try{this.loggingService.log("%c[WB] Calling FUNCTION: requestEditorAccess","color: green;"),this.componentConfigSignal().editAccessRequested||this.liveStateService.requestEditorAccess().subscribe()}catch(e){this.loggingService.catch("Error in SingleEditorModePanelComponent requestEditorAccess: ",e)}}cancelEditorAccessRequest(){try{this.loggingService.log("%c[WB] Calling FUNCTION: cancelEditorAccessRequest","color: green;"),this.liveStateService.cancelEditorAccessRequest()}catch(e){this.loggingService.catch("Error in SingleEditorModePanelComponent cancelEditorAccessRequest: ",e)}}acceptEditorAccessRequest(){try{this.loggingService.log("%c[WB] Calling FUNCTION: acceptEditorAccessRequest","color: green;"),this.liveStateService.acceptEditorAccessRequest()}catch(e){this.loggingService.catch("Error in SingleEditorModePanelComponent acceptEditorAccessRequest: ",e)}}rejectEditorAccessRequest(){try{this.loggingService.log("%c[WB] Calling FUNCTION: rejectEditorAccessRequest","color: green;"),this.liveStateService.rejectEditorAccessRequest()}catch(e){this.loggingService.catch("Error in SingleEditorModePanelComponent rejectEditorAccessRequest: ",e)}}editCurrentTab(){try{this.loggingService.log("%c[WB] Calling FUNCTION: editCurrentTab","color: green;"),this.liveStateService.editCurrentTab()}catch(e){this.loggingService.catch("Error in SingleEditorModePanelComponent editCurrentTab: ",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(je),h(Di),h(y),h(qe),h(S),h(He))},o.\u0275cmp=O({type:o,selectors:[["velt-single-editor-mode-panel"]],inputs:{variant:"variant",_shadowDom:[0,"shadowDom","_shadowDom"]},standalone:!1,features:[V([S]),B,Ze],decls:3,vars:1,consts:[["liveStateSyncPanelRef",""],[4,"ngIf"],[4,"veltIf"],[4,"ngIf","ngIfElse"],[4,"ngTemplateOutlet"],["data-velt-ignore","","class","velt-single-editor-mode-panel-container single-editor-mode-panel-container",3,"velt-single-editor-mode-panel-container-no-pointer","no-pointer",4,"ngIf"],["data-velt-ignore","",1,"velt-single-editor-mode-panel-container","single-editor-mode-panel-container"],[4,"veltDynamicTemplate"],["data-velt-ignore","",1,"velt-single-editor-mode-panel","follow-dialog"],[3,"componentConfigSignal"]],template:function(t,r){t&1&&g(0,NRe,2,6,"ng-container",1)(1,jRe,1,1,"ng-template",null,0,Ee),t&2&&c("ngIf",r.componentConfigSignal())},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)}[_nghost-%COMP%]:empty{display:none}[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-single-editor-mode-panel[_ngcontent-%COMP%]{font-size:var(--velt-font-size-xs);display:flex;justify-content:center;align-items:center;gap:var(--velt-spacing-sm);width:fit-content;padding:var(--velt-spacing-sm) var(--velt-spacing-md);background-color:var(--velt-background-0);color:var(--velt-text-0);border-radius:var(--velt-border-radius-full);box-shadow:0 8px 16px -8px #0f0f0f1a;border:1px solid var(--velt-border-4)}.velt-single-editor-mode-panel-container.velt-single-editor-mode-panel-container-no-pointer[_ngcontent-%COMP%]{pointer-events:none}"],changeDetection:0});let i=o;return i})();function HRe(i,o){if(i&1&&(f(0),_(1,"div",1),w(2,"velt-single-editor-mode-panel",2),b(),v()),i&2){let n=l(2);m(2),c("variant",n.variant)}}function zRe(i,o){if(i&1&&(f(0),g(1,HRe,3,1,"ng-container",0),v()),i&2){let n=o.ngIf;m(),c("ngIf",n.singleEditorMode&&n.defaultSingleEditorUIEnabled)}}var Kce=(()=>{let o=class o extends Je{constructor(e,t,r,a,s){super(e,t,void 0,void 0,void 0,r,a),this.elementRef=e,this.themeService=t,this.dynamicDataService=r,this.loggingService=a,this.liveStateService=s,this.subscriptions=[],this.componentConfigSignal=xe({singleEditorMode:!1,defaultSingleEditorUIEnabled:!1,variant:this.variant}),this.componentId="velt-live-state-sync-overlay";try{this.subscriptions.push(this.liveStateService.getSingleEditorMode$().subscribe(d=>{this.componentConfigSignal.update(p=>T(I({},p),{singleEditorMode:d}))})),this.subscriptions.push(this.liveStateService.getDefaultSingleEditorUIEnabled$().subscribe(d=>{this.componentConfigSignal.update(p=>T(I({},p),{defaultSingleEditorUIEnabled:d}))}))}catch(d){this.loggingService.catch("Error in LiveStateSyncOverlayComponent constructor: ",d)}}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in LiveStateSyncOverlayComponent ngOnInit: ",e)}}ngOnDestroy(){try{super.ngOnDestroy(),this.subscriptions.forEach(e=>e.unsubscribe())}catch(e){this.loggingService.catch("Error in LiveStateSyncOverlayComponent ngOnDestroy: ",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("role","dialog"),e.setAttribute("aria-labelledby",this.componentId),e.setAttribute("aria-modal","true")}catch(e){this.loggingService.catch("Error in LiveStateSyncOverlayComponent setupA11yAttributes: ",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(qe),h(S),h(y),h(Di))},o.\u0275cmp=O({type:o,selectors:[["snippyly-live-state-sync-overlay"]],inputs:{variant:"variant"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],["data-velt-ignore","",1,"velt-live-state-sync-overlay-container","live-state-sync-overlay-container"],[3,"variant"]],template:function(t,r){t&1&&g(0,zRe,2,1,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},dependencies:[Z,hh],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}.velt-live-state-sync-overlay-container{position:fixed;bottom:calc((2rem + 0px) * var(--velt-base-rem-unit));left:50%;transform:translate(-50%);background-color:transparent;z-index:var(--velt-live-state-sync-overlay-z-index);display:flex;justify-content:center;align-items:flex-end}
|
|
406
406
|
`],encapsulation:3,changeDetection:0});let i=o;return i})();var xz=(()=>{let o=class o{set signInButton(e){this.translateService.setLanguage(e)}set translations(e){try{let t=e;if(typeof e=="string"&&(t=JSON.parse(e)),!t||typeof t!="object")return;this.translateService.setTranslations(t)}catch(t){this.loggingService.catch("Error in AppComponent set translations: ",t)}}set _autoTranslation(e){let t=e;typeof e=="string"&&(t=JSON.parse(e)),t?this.translateService.enableAutoTranslation():this.translateService.disableAutoTranslation()}onResize(e){this.setSnippylyViewportSize()}constructor(e,t,r,a,s,d,p,u,C,E){this.docService=e,this.domService=t,this.loggingService=r,this.viewportRuler=a,this.themeService=s,this.breakpointObserver=d,this.translateService=p,this.notificationService=u,this.veltService=C,this.injector=E,this.snippyly=new n9(this.injector),this.getSnippyly=new Pe,this.subscriptions=[],this.veltElement=!0,this.loggingService.log("%c[WB] Creating CLASS: AppComponent","color: blue;");try{this.subscriptions.push(this.docService.getDocumentPaths$().subscribe(()=>{this.domService.removeScrollableElementsIds()},D=>{this.loggingService.catch("Error in AppComponent getDocumentPaths subscription:",D)})),this.updateDeviceType(),this.updateDeviceOrientation(),this.setVeltVersion()}catch(D){this.loggingService.catch("Error in AppComponent constructor:",D)}}ngOnInit(){}ngAfterViewInit(){try{this.domService.setDeviceInfo(),this.setSnippylyViewportSize(),this.getSnippyly.emit(this.snippyly),this.setSnippylyRemBaseUnit(),this.subscriptions.push(this.domService.onWindowResize$().subscribe(()=>{this.setSnippylyRemBaseUnit()})),this.themeService.updateListenerOnConfigChange()}catch(e){this.loggingService.catch("Error in App After view init: ",e)}}setVeltVersion(){try{window?.Velt?.version&&localStorage.setItem(j.LOCAL_STORAGE.VELT_VERSION,window.Velt.version)}catch(e){this.loggingService.catch("Error in AppComponent setVeltVersion: ",e)}}updateDeviceType(){try{Object.values(ki).forEach(t=>{Gn.Breakpoints[t]=this.breakpointObserver.isMatched(t),this.subscriptions.push(this.breakpointObserver.observe(t).subscribe(r=>{Gn.Breakpoints[t]=r.matches}))})}catch(e){this.loggingService.catch("Error in AppComponent updateDeviceType: ",e)}}updateDeviceOrientation(){try{Object.values(Sv).forEach(t=>{Gn.Orientations[t]=window.matchMedia(t).matches,this.subscriptions.push(this.breakpointObserver.observe(t).subscribe(r=>{Gn.Orientations[t]=r.matches}))})}catch(e){this.loggingService.catch("Error in AppComponent updateDeviceOrientation: ",e)}}observeHtmlTagChanges(){}setSnippylyRemBaseUnit(){try{let e=document.documentElement,t=window.getComputedStyle(e),r=16,a=+t.fontSize.replace("px",""),s=a?r/a:1;e.style.setProperty(j.VELT_BASE_REM_UNIT,s+"")}catch(e){this.loggingService.catch("Error in AppComponent setSnippylyRemBaseUnit: ",e)}}setSnippylyViewportSize(){try{setTimeout(()=>{let e=this.viewportRuler.getViewportSize(),t=document.documentElement;t.style.setProperty(j.VELT_VIEWPORT_WIDTH,e.width+"px"),t.style.setProperty(j.VELT_VIEWPORT_HEIGHT,e.height+"px")},100)}catch{}}ngOnDestroy(){try{this.subscriptions.forEach(e=>{e.unsubscribe()}),this.themeService.disablePrefersColorScheme()}catch{}}};o.\u0275fac=function(t){return new(t||o)(h(at),h(Fe),h(y),h(zs),h(qe),h(go),h(al),h(cn),h(e9),h(xt))},o.\u0275cmp=O({type:o,selectors:[["app-root"]],hostVars:1,hostBindings:function(t,r){t&1&&z("resize",function(s){return r.onResize(s)},!1,Z4),t&2&&x("data-velt-element",r.veltElement)},inputs:{snippyly:"snippyly",signInButton:[0,"language","signInButton"],translations:"translations",_autoTranslation:[0,"autoTranslation","_autoTranslation"]},outputs:{getSnippyly:"getSnippyly"},standalone:!1,decls:3,vars:0,template:function(t,r){t&1&&w(0,"app-external-styles")(1,"velt-toast-popup")(2,"snippyly-live-state-sync-overlay")},dependencies:[Wce,qce,Kce],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} snippyly-highlight-user-text.velt-live-selection-on-text-default{background-color:var(--velt-selection-color, rgba(162, 89, 254, .5333333333))!important} .velt-live-selection-on-element-default{outline:2px solid var(--velt-selection-color, #a259fe)!important} .snippyly-highlight{outline:var(--legacy-velt-comment-pin-highlight, 2px dashed #a259fe)!important} [snippyly-highlight-preview=true]{outline:2px solid green!important} body.snippyly-add-comment-mode.show-pin-cursor:not[data-velt-element], body.snippyly-add-comment-mode.show-pin-cursor[_ngcontent-%COMP%] *[_ngcontent-%COMP%]:not[data-velt-element]{cursor:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZpZXdCb3g9IjAgMCAxOCAxOCIgZmlsbD0iIzYyNURGNSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPG1hc2sgaWQ9InBhdGgtMS1pbnNpZGUtMV8yMDMyXzIzNjgxIiBmaWxsPSJ3aGl0ZSI+CjxwYXRoIGQ9Ik0wLjM1Mjk0MSAxOEMwLjE1ODAxNyAxOCAtNi45MDcxNWUtMDkgMTcuODQyIC0xLjU0Mjc1ZS0wOCAxNy42NDcxTC0zLjkzNDAyZS0wNyA5Qy02LjEwNjczZS0wNyA0LjAyOTQ0IDQuMDI5NDQgLTEuNzYxMzJlLTA3IDkgLTMuOTM0MDJlLTA3Vi0zLjkzNDAyZS0wN0MxMy45NzA2IC02LjEwNjczZS0wNyAxOCA0LjAyOTQ0IDE4IDlWOUMxOCAxMy45NzA2IDEzLjk3MDYgMTggOSAxOEwwLjM1Mjk0MSAxOFoiLz4KPC9tYXNrPgo8cGF0aCBkPSJNMC4zNTI5NDEgMThDMC4xNTgwMTcgMTggLTYuOTA3MTVlLTA5IDE3Ljg0MiAtMS41NDI3NWUtMDggMTcuNjQ3MUwtMy45MzQwMmUtMDcgOUMtNi4xMDY3M2UtMDcgNC4wMjk0NCA0LjAyOTQ0IC0xLjc2MTMyZS0wNyA5IC0zLjkzNDAyZS0wN1YtMy45MzQwMmUtMDdDMTMuOTcwNiAtNi4xMDY3M2UtMDcgMTggNC4wMjk0NCAxOCA5VjlDMTggMTMuOTcwNiAxMy45NzA2IDE4IDkgMThMMC4zNTI5NDEgMThaIiBmaWxsPSIjMTQxNDE2Ii8+CjxwYXRoIGQ9Ik0wLjM1Mjk0MSAxOEMwLjE1ODAxNyAxOCAtNi45MDcxNWUtMDkgMTcuODQyIC0xLjU0Mjc1ZS0wOCAxNy42NDcxTC0zLjkzNDAyZS0wNyA5Qy02LjEwNjczZS0wNyA0LjAyOTQ0IDQuMDI5NDQgLTEuNzYxMzJlLTA3IDkgLTMuOTM0MDJlLTA3Vi0zLjkzNDAyZS0wN0MxMy45NzA2IC02LjEwNjczZS0wNyAxOCA0LjAyOTQ0IDE4IDlWOUMxOCAxMy45NzA2IDEzLjk3MDYgMTggOSAxOEwwLjM1Mjk0MSAxOFoiIHN0cm9rZT0id2hpdGUiIHN0cm9rZS13aWR0aD0iMiIgbWFzaz0idXJsKCNwYXRoLTEtaW5zaWRlLTFfMjAzMl8yMzY4MSkiLz4KPC9zdmc+Cg==) 0 31,auto} body.snippyly-add-tag-mode.show-pin-cursor:not[data-velt-element], body.snippyly-add-tag-mode.show-pin-cursor[_ngcontent-%COMP%] *[_ngcontent-%COMP%]:not[data-velt-element]{cursor:url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB2aWV3Qm94PSIwIDAgMzIgMzIiIHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczpieD0iaHR0cHM6Ly9ib3h5LXN2Zy5jb20iPgogIDxlbGxpcHNlIHN0eWxlPSJzdHJva2U6IHJnYigwLCAwLCAwKTsgZmlsbDogcmdiKDE2MiwgODksIDI1NCk7IHBhaW50LW9yZGVyOiBmaWxsOyBzdHJva2Utd2lkdGg6IDBweDsiIGN4PSIxNiIgY3k9IjE2IiByeD0iMTYiIHJ5PSIxNiIvPgogIDxwYXRoIGQ9Ik0gOS4zMzMgMjIgQyA5LjMzMyAyMiA4IDIyIDggMjAuNjY3IEMgOCAxOS4zMzMgOS4zMzMgMTUuMzMzIDE2IDE1LjMzMyBDIDIyLjY2NyAxNS4zMzMgMjQgMTkuMzMzIDI0IDIwLjY2NyBDIDI0IDIyIDIyLjY2NyAyMiAyMi42NjcgMjIgTCA5LjMzMyAyMiBaIE0gMTYgMTQgQyAxOS4wNzkgMTQgMjEuMDA0IDEwLjY2NyAxOS40NjQgOCBDIDE4Ljc1IDYuNzYyIDE3LjQyOSA2IDE2IDYgQyAxMi45MjEgNiAxMC45OTYgOS4zMzMgMTIuNTM2IDEyIEMgMTMuMjUgMTMuMjM3IDE0LjU3MSAxNCAxNiAxNCBaIiBzdHlsZT0iZmlsbDogcmdiKDI1NSwgMjU1LCAyNTUpOyIgYng6b3JpZ2luPSIwLjUgMC41Ii8+Cjwvc3ZnPg==) 16 16,auto!important} body.snippyly-add-arrow-mode.show-pin-cursor:not[data-velt-element], body.snippyly-add-arrow-mode.show-pin-cursor[_ngcontent-%COMP%] *[_ngcontent-%COMP%]:not[data-velt-element]{cursor:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTUiIHZpZXdCb3g9IjAgMCAxNiAxNSIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xMy44MDU0IDEwLjAyMDdDMTQuNTQxMiA5Ljk5MTMxIDE1LjExMzggOS4zNzA5OCAxNS4wODQzIDguNjM1MThMMTQuODMwNiAyLjI4OTM5QzE0LjgwMjggMS41OTQ4NiAxNC4yNDYxIDEuMDM4MTkgMTMuNTUxNiAxLjAxMDQxTDcuMjA1NzEgMC43NTY1MzdDNi40Njk5MiAwLjcyNzEwMiA1Ljg0OTU4IDEuMjk5NzIgNS44MjAxNSAyLjAzNTUxQzUuNzkwNzEgMi43NzEzIDYuMzYzMzMgMy4zOTE2NCA3LjA5OTEyIDMuNDIxMDdMMTAuNDAyMSAzLjU1MzIxTDEuMjQxNzcgMTIuNzEzNkMwLjcyMTA2NyAxMy4yMzQzIDAuNzIxMDY3IDE0LjA3ODUgMS4yNDE3NyAxNC41OTkyQzEuNzYyNDYgMTUuMTE5OSAyLjYwNjY4IDE1LjExOTkgMy4xMjczOCAxNC41OTkyTDEyLjI4NzcgNS40Mzg4NkwxMi40MTk4IDguNzQxNzVDMTIuNDQ5MiA5LjQ3NzU0IDEzLjA2OTYgMTAuMDUwMiAxMy44MDU0IDEwLjAyMDdaIiBmaWxsPSIjOEY5NUIyIi8+Cjwvc3ZnPgo=) 15 0,auto!important} .selection-element-portal{display:flex!important} .snippyly-user-marker{cursor:default;display:inline;position:relative} .snippyly-user-marker:after{color:#fff;content:attr(data-name);display:none;font-style:normal;font-weight:400;left:0;line-height:1;opacity:0;position:absolute;top:-30px;transition:opacity .2s linear,transform .3s ease-in-out;white-space:nowrap;z-index:99999;padding:4px!important;font-size:calc((.8rem + 0px) * var(--velt-base-rem-unit));border-radius:8px;font-family:var(--velt-default-font-family, unset);transform:translate(-50%)} .snippyly-user-marker:hover:after, .snippyly-user-marker.active:after{animation:all 1s ease-in-out;display:block;opacity:1} .snippyly-user-marker .snippyly-user-marker-line{bottom:0;height:100%;position:absolute;width:0} .snippyly-user-marker .snippyly-user-marker-line .snippyly-user-marker-dot{border-radius:50%;cursor:default;display:block;height:4px;left:50%;position:absolute;top:-3px;transform:translate(-50%,-50%);width:4px} .snippyly-user-marker:after{background-color:var(--velt-selection-marker-color)!important} .snippyly-user-marker .snippyly-user-marker-line, .snippyly-user-marker .snippyly-user-marker-dot{border:1px solid var(--velt-selection-marker-color)!important;background-color:var(--velt-selection-marker-color)!important} .v-device-info-tooltip-container{display:flex;padding:calc((.25rem + 0px) * var(--velt-base-rem-unit)) calc((.5rem + 0px) * var(--velt-base-rem-unit));margin:calc((.5rem + 0px) * var(--velt-base-rem-unit));align-items:flex-start;flex-direction:column;gap:calc((.2rem + 0px) * var(--velt-base-rem-unit));border-radius:calc((.5rem + 0px) * var(--velt-base-rem-unit));background:var(--neutrals-1, #141416);color:var(--neutrals-10, #FFF);font-size:calc((.75rem + 0px) * var(--velt-base-rem-unit));font-style:normal;font-weight:400;line-height:normal} .v-device-info-tooltip-container.dark{background:var(--neutrals-3, #353945);color:var(--neutrals-10, #FFF)} .huddle-all-menu-panel{box-shadow:0 calc((1rem + 0px) * var(--velt-base-rem-unit)) calc((3rem + 0px) * var(--velt-base-rem-unit)) #0000002d!important;background-color:#fff!important;border-radius:8px;color:#000} .huddle-all-menu-panel .mat-mdc-menu-item{background-color:#fff!important;padding:0 calc((1rem + 0px) * var(--velt-base-rem-unit))!important;height:40px!important;min-height:40px!important;width:100%!important;font-size:calc((.9rem + 0px) * var(--velt-base-rem-unit))!important;display:flex!important;gap:8px!important;align-items:center!important;border:0!important;font-weight:unset!important;text-transform:unset!important;font-family:var(--velt-default-font-family, unset)!important} .huddle-all-menu-panel .mat-mdc-menu-item .mat-mdc-menu-item-text{font-size:calc((.9rem + 0px) * var(--velt-base-rem-unit))!important;display:flex!important;gap:8px!important;align-items:center!important;border:0!important;font-weight:unset!important;text-transform:unset!important;font-family:var(--velt-default-font-family, unset)!important} .huddle-all-menu-panel .mat-mdc-menu-item:hover{background-color:#f1f1f1!important} .huddle-all-menu-panel .mat-mdc-menu-item:disabled{color:#c4c4c4!important} .snippyly-huddle-menu-panel-overlay-panel{z-index:2147483617!important} .snippyly-huddle-banner-panel{top:0!important;left:0!important} .snippyly-huddle-banner-panel .huddle-banner{border:1px solid rgba(26,28,30,.1);box-shadow:0 2px 12px #001c3b1f;border-radius:calc((1rem + 0px) * var(--velt-base-rem-unit))!important;position:fixed;background:#fff;z-index:2;top:calc((1rem + 0px) * var(--velt-base-rem-unit))!important;right:calc((1rem + 0px) * var(--velt-base-rem-unit))!important;color:#000} .snippyly-huddle-banner-panel .huddle-banner>div{display:flex} .snippyly-huddle-banner-panel .huddle-banner>div>*{padding:calc((.75rem + 0px) * var(--velt-base-rem-unit))!important} .snippyly-huddle-banner-panel .huddle-banner>div .title{font-weight:600;font-size:calc((1rem + 0px) * var(--velt-base-rem-unit))!important;line-height:calc((1.5rem + 0px) * var(--velt-base-rem-unit))!important;margin:0!important} .snippyly-huddle-banner-panel .huddle-banner>div .subtitle{font-weight:400;font-size:14px!important;line-height:21px!important;margin:0} .snippyly-huddle-banner-panel .huddle-banner>div .action-btn-container{margin:calc((.75rem + 0px) * var(--velt-base-rem-unit)) 0 calc((.25rem + 0px) * var(--velt-base-rem-unit))!important} .snippyly-huddle-banner-panel .huddle-banner>div .action-btn-container button{cursor:pointer} .snippyly-huddle-banner-panel .huddle-banner>div .join-btn{padding:calc((.5rem + 0px) * var(--velt-base-rem-unit)) calc((.75rem + 0px) * var(--velt-base-rem-unit))!important;background:#625df5;border-radius:90px!important;border:0;margin-right:calc((.5rem + 0px) * var(--velt-base-rem-unit))!important;color:#fff!important;font-weight:700;transition:.2s;font-size:calc((.8rem + 0px) * var(--velt-base-rem-unit))!important} .snippyly-huddle-banner-panel .huddle-banner>div .join-btn:hover{background:#4742dc} .snippyly-huddle-banner-panel .huddle-banner>div .cancel-btn{color:#777e91;background:transparent;border:0;font-weight:700;font-size:calc((.8rem + 0px) * var(--velt-base-rem-unit))!important} .snippyly-huddle-banner-panel .huddle-banner>div .close-btn{cursor:pointer} .velt-recorder-all-tool--menu-panel{overflow:unset!important} .velt-recorder-all-tool--menu-panel .mat-mdc-menu-content{padding:0!important} .v-view-analytics-overlay-panel{z-index:2147483617!important}"],changeDetection:0});let i=o;return i})();var di=(()=>{let o=class o{constructor(){this.subscriptions=[]}ngAfterViewInit(){this.overlay instanceof nn?this.setOverlayZIndex(this.overlay):this.overlay instanceof CS?this.setMatAutocompleteZIndex(this.overlay):this.overlay instanceof HTMLElement&&this.setElementZIndex(this.overlay)}setOverlayZIndex(e){this.overlay instanceof nn&&this.subscriptions.push(e.positionChange.pipe(rt(1)).subscribe(()=>{e?.overlayRef&&e?.overlayRef?.hostElement&&this.zIndex&&(e.overlayRef.hostElement.style.zIndex=this.zIndex?.toString())},t=>{}))}setMatAutocompleteZIndex(e){try{this.overlay instanceof CS&&this.subscriptions.push(e.opened.pipe(rt(1)).subscribe(()=>{setTimeout(()=>{if(e?.panel?.nativeElement){let t=e.panel.nativeElement?.closest(".cdk-overlay-connected-position-bounding-box");t&&(t.style.zIndex=this.zIndex?.toString())}},100)},t=>{}))}catch{}}setElementZIndex(e){try{this.overlay instanceof HTMLElement&&setTimeout(()=>{let t=e?.closest(".cdk-global-overlay-wrapper")||e?.closest(".cdk-overlay-connected-position-bounding-box");t&&this.zIndex&&(t.style.zIndex=this.zIndex?.toString());let a=e?.closest(".cdk-overlay-container")?.querySelector(".cdk-overlay-backdrop");a&&this.backdropZIndex&&(this.originalBackdropZIndex=a.style.zIndex,a.style.zIndex=this.backdropZIndex?.toString(),this.backdropElement=a)},100)}catch{}}ngOnDestroy(){try{this.subscriptions.forEach(e=>{e.unsubscribe()}),this.backdropElement&&this.originalBackdropZIndex&&(this.backdropElement.style.zIndex=this.originalBackdropZIndex?.toString())}catch{}}};o.\u0275fac=function(t){return new(t||o)},o.\u0275dir=Ut({type:o,selectors:[["","snippylyOverlay",""]],inputs:{overlay:[0,"snippylyOverlay","overlay"],zIndex:[0,"snippylyOverlayZIndex","zIndex"],backdropZIndex:[0,"snippylyOverlayBackdropZIndex","backdropZIndex"]},standalone:!1});let i=o;return i})();var WRe=["*"],qRe=()=>["snippyly-overlay-panel","snippyly-lightbox-overlay-panel"];function YRe(i,o){if(i&1){let n=q();_(0,"div",5),z("click",function(t){return N(n),l(2).closeImageInFullScreen(),F(t.stopPropagation())})("pointerdown",function(t){return N(n),F(t.stopPropagation())}),w(1,"img",6),b()}if(i&2){let n=l(2);x("aria-label","Image Preview")("data-testid",n.componentId+"-overlay-container"),m(),c("src",n.src,mn)("alt","Image preview"),x("data-testid",n.componentId+"-image")}}function KRe(i,o){if(i&1&&(f(0),Nt(1),w(2,"div",3,0),g(4,YRe,2,5,"ng-template",4,1,Ee),v()),i&2){let n=o.ngIf,e=ce(3),t=ce(5),r=l();m(2),x("data-testid",r.componentId+"-trigger"),m(2),c("cdkConnectedOverlayOrigin",e)("cdkConnectedOverlayOpen",n.showImageInFullScreen)("cdkConnectedOverlayPanelClass",Ot(7,qRe))("cdkConnectedOverlayDisableClose",!0)("snippylyOverlay",t)("snippylyOverlayZIndex",2147483627)}}var Zce=(()=>{let o=class o{constructor(e,t){this.loggingService=e,this.elementRef=t,this.componentConfigSignal=xe({showImageInFullScreen:!1}),this.veltElement=!0,this.componentId="velt-lightbox";try{this.loggingService.log("%c[WB] Creating Class: LightboxComponent","color: blue;")}catch(r){this.loggingService.catch("Error in LightboxComponent constructor: ",r)}}ngOnInit(){this.setupA11yAttributes()}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 LightboxComponent setupA11yAttributes:",e)}}openImageInFullScreen(){try{this.loggingService.log("%c[WB] LightboxComponent FUNCTION: openImageInFullScreen","color: green;"),this.componentConfigSignal.update(e=>(e=T(I({},e),{showImageInFullScreen:!0}),e))}catch(e){this.loggingService.catch("Error in LightboxComponent openImageInFullScreen: ",e)}}closeImageInFullScreen(){try{this.loggingService.log("%c[WB] LightboxComponent FUNCTION: closeImageInFullScreen","color: green;"),this.componentConfigSignal.update(e=>(e=T(I({},e),{showImageInFullScreen:!1}),e))}catch(e){this.loggingService.catch("Error in LightboxComponent closeImageInFullScreen: ",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R))},o.\u0275cmp=O({type:o,selectors:[["snippyly-lightbox"]],hostVars:1,hostBindings:function(t,r){t&2&&x("data-velt-element",r.veltElement)},inputs:{src:"src"},standalone:!1,ngContentSelectors:WRe,decls:1,vars:1,consts:[["trigger","cdkOverlayOrigin"],["overlay","cdkConnectedOverlay"],[4,"ngIf"],["cdkOverlayOrigin",""],["cdkConnectedOverlay","",3,"cdkConnectedOverlayOrigin","cdkConnectedOverlayOpen","cdkConnectedOverlayPanelClass","cdkConnectedOverlayDisableClose","snippylyOverlay","snippylyOverlayZIndex"],["role","dialog","aria-modal","true","tabindex","-1",1,"snippyly-image-overlay-container",3,"click","pointerdown"],[3,"src","alt"]],template:function(t,r){t&1&&(Bt(),g(0,KRe,6,8,"ng-container",2)),t&2&&c("ngIf",r.componentConfigSignal())},dependencies:[Z,nn,en,di],styles:["[_nghost-%COMP%]{display:flex} .snippyly-lightbox-overlay-panel{inset:0!important} .snippyly-lightbox-overlay-panel .snippyly-image-overlay-container{width:100vw;height:100vh;display:flex;align-items:center;justify-content:center;background:#d3d3d37a;-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);z-index:2147483627} .snippyly-lightbox-overlay-panel img{max-width:80vw;max-height:80vh;border-radius:var(--velt-border-radius-sm)}"],changeDetection:0});let i=o;return i})();var ZRe=["menuRef"],XRe=["menuTrigger"],QRe=["*"];function JRe(i,o){i&1&&(f(0),w(1,"button",5),v())}var Tz=(()=>{let o=class o{constructor(e){this.loggingService=e,this.menuItems=[],this.veltElement=!0}ngOnInit(){}ngAfterViewInit(){try{let e=this.menuTrigger?.nativeElement?.querySelector("[menu-items]");if(e){e.style.display="none";for(let t=0;t<e.children.length;t++){let r=e.children[t];this.menuItems.push(r)}setTimeout(()=>{this.addMenuOptions()},100)}}catch(e){this.loggingService.catch("Error in MenuComponent afterViewInit: ",e)}}ngAfterContentInit(){}addMenuOptions(){try{this.menuRef&&this.menuRef._allItems.forEach((e,t)=>{e._getHostElement()?.appendChild(this.menuItems[t])})}catch(e){this.loggingService.catch("Error in MenuComponent addMenuOptions: ",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y))},o.\u0275cmp=O({type:o,selectors:[["snippyly-menu"]],viewQuery:function(t,r){if(t&1&&(nt(ZRe,5),nt(XRe,5)),t&2){let a;Xe(a=Qe())&&(r.menuRef=a.first),Xe(a=Qe())&&(r.menuTrigger=a.first)}},hostVars:1,hostBindings:function(t,r){t&2&&x("data-velt-element",r.veltElement)},standalone:!1,ngContentSelectors:QRe,decls:7,vars:4,consts:[["menuTrigger","","menuTriggerRef","matMenuTrigger"],["menuRef","matMenu"],[3,"matMenuTriggerFor"],[1,"velt-menu","snippyly-menu-panel"],[4,"ngFor","ngForOf"],["mat-menu-item",""]],template:function(t,r){if(t&1&&(Bt(),_(0,"div",2,0),Nt(3),b(),_(4,"mat-menu",3,1),g(6,JRe,2,0,"ng-container",4),b()),t&2){let a=ce(2),s=ce(5);ue("active",a==null?null:a.menuOpen),c("matMenuTriggerFor",s),m(6),c("ngForOf",r.menuItems)}},dependencies:[ft,Dl,Xs,Np],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;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} .snippyly-menu-panel{box-shadow:0 calc((1rem + 0px) * var(--velt-base-rem-unit)) calc((3rem + 0px) * var(--velt-base-rem-unit)) #0000002d!important;background-color:#fff!important;border-radius:8px!important} .snippyly-menu-panel button{background-color:#fff;padding:0 calc((1rem + 0px) * var(--velt-base-rem-unit))!important;height:40px!important;width:100%!important;font-size:calc((.9rem + 0px) * var(--velt-base-rem-unit))!important} .snippyly-menu-panel button:hover{background-color:#f1f1f1}"],changeDetection:0});let i=o;return i})();var eNe={provide:Mm,useExisting:Nr(()=>wb),multi:!0},wb=(()=>{let o=class o extends _S{};o.\u0275fac=(()=>{let e;return function(r){return(e||(e=Ga(o)))(r||o)}})(),o.\u0275dir=Ut({type:o,selectors:[["","contenteditable","","veltAutocomplete",""]],inputs:{veltAutocomplete:"veltAutocomplete"},exportAs:["snippylyUserSelectorTrigger"],standalone:!1,features:[V([eNe]),B]});let i=o;return i})();var As=class{constructor(){this.position={top:-1e3,left:-1e3},this.showAdder=!1,this.createAnnotation=()=>{},this.disabled=!1,this.commentToolEnabled=!0,this.isPlanExpired=!1,this.isUserAllowed=!1,this.enableTextComments=!1,this.user=null,this.rewriterEnabled=!1,this.left=0,this.createRewriter=()=>{},this.selectedWordsCount=0,this.selectedCharactersCount=0,this.MIN_ALLOWED_WORDS_COUNT=3,this.MIN_ALLOWED_CHARACTERS_COUNT=7,this.MAX_ALLOWED_CHARACTERS_COUNT=8e3}};var Xce=i=>({componentConfigSignal:i}),tNe=(i,o)=>({condition:i,data:o}),nNe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-text-comment-tool-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function iNe(i,o){i&1&&Ve(0)}function oNe(i,o){if(i&1&&(_(0,"velt-shadow-dom-internal"),g(1,iNe,1,0,"ng-container",2),b()),i&2){l();let n=ce(2);m(),c("ngTemplateOutlet",n)}}function rNe(i,o){i&1&&(_(0,"div",8),le(),_(1,"svg",9)(2,"mask",10),w(3,"path",11),b(),w(4,"path",12)(5,"path",13),b()())}function aNe(i,o){if(i&1){let n=q();_(0,"div",6),P(1,"translate"),z("pointerdown",function(t){return N(n),l(2).ngIf.createAnnotation(),F(t.stopPropagation())}),g(2,rNe,6,0,"div",7),b()}if(i&2){let n=l(2).ngIf,e=l(2);it("top",n.position.top,"px")("left",n.position.left,"px")("visibility",n.showAdder?"visible":"hidden"),x("data-testid",e.componentId)("role","button")("aria-label",M(1,12,"Add text comment"))("aria-disabled",!n.commentToolEnabled)("tabindex",0),m(2),c("veltDynamicTemplate",$(16,nNe,e.template,A(14,Xce,e.componentConfigSignal),n.variant,e.setIfCondition.bind(e),e.elementRef))}}function sNe(i,o){if(i&1&&(f(0),g(1,aNe,3,22,"div",5),v()),i&2){let n=l().ngIf;m(),c("ngIf",n&&!n.disabled&&n.commentToolEnabled&&!n.isPlanExpired&&n.isUserAllowed&&n.enableTextComments&&(n.user==null?null:n.user.userId)&&!n.rewriterEnabled)}}function lNe(i,o){if(i&1&&(f(0),g(1,sNe,2,1,"ng-container",4),v()),i&2){let n=l(2);m(),c("veltIf",k(3,tNe,n.conditionSignal(),A(1,Xce,n.componentConfigSignal)))}}function cNe(i,o){if(i&1&&g(0,lNe,2,6,"ng-container",3),i&2){let n=l();c("ngIf",n.componentConfigSignal())}}var C0=(()=>{let o=class o extends Je{constructor(e,t,r,a,s,d){super(a,s,void 0,r,r.getTextCommentToolDarkMode$(),d,e),this.loggingService=e,this.wireframeService=t,this.commentService=r,this.elementRef=a,this.themeService=s,this.dynamicDataService=d,this.textCommentToolShadowDOM=!1,this.subscriptions=[],this.componentId="velt-text-comment-tool",super.initializeComponentConfigSignal(new As),this.subscriptions.push(this.commentService.getTextCommentToolShadowDOM$().subscribe(p=>{this.textCommentToolShadowDOM=p},p=>{this.loggingService.catch("Error in TextCommentToolComponent getTextCommentToolShadowDOM$ subscription: ",p)}))}ngOnInit(){try{this.loggingService.log("%c[WB] Calling FUNCTION: ngOnInit","color: green;"),super.ngOnInit(),this.setupA11yAttributes(),this.subscriptions.push(this.wireframeService.getWireframe$("velt-text-comment-tool-wireframe").subscribe(t=>{if(t){let r=document.createElement(t.tagName);r.innerHTML=t.innerHTML,this.template=r}}))}catch(e){this.loggingService.catch("Error in CommentBubbleComponent OnInit: ",e)}}ngOnDestroy(){try{super.ngOnDestroy(),this.subscriptions.forEach(e=>{e.unsubscribe()})}catch{}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","button"),e.setAttribute("aria-label","Add text comment"),e.setAttribute("tabindex","0");let t=this.componentConfigSignal();e.setAttribute("aria-disabled",String(!t.commentToolEnabled))}catch(e){this.loggingService.catch("Error in TextCommentToolComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(He),h(De),h(R),h(qe),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-text-comment-tool"]],standalone:!1,features:[V([S]),B],decls:3,vars:2,consts:[["textCommentContainerRef",""],[4,"ngIf","ngIfElse"],[4,"ngTemplateOutlet"],[4,"ngIf"],[4,"veltIf"],["class","velt-text-comment-tool",3,"top","left","visibility","pointerdown",4,"ngIf"],[1,"velt-text-comment-tool",3,"pointerdown"],["class","velt-text-comment-tool--container",4,"veltDynamicTemplate"],[1,"velt-text-comment-tool--container"],["width","32","height","32","viewBox","0 0 18 18","fill","none","xmlns","http://www.w3.org/2000/svg","role","img","aria-hidden","true","focusable","false"],["id","path-1-inside-1_2032_23681","fill","white"],["d","M0.352941 18C0.158017 18 -6.90715e-09 17.842 -1.54275e-08 17.6471L-3.93402e-07 9C-6.10673e-07 4.02944 4.02944 -1.76132e-07 9 -3.93402e-07C13.9706 -6.10673e-07 18 4.02944 18 9C18 13.9706 13.9706 18 9 18L0.352941 18Z"],["d","M0.352941 18C0.158017 18 -6.90715e-09 17.842 -1.54275e-08 17.6471L-3.93402e-07 9C-6.10673e-07 4.02944 4.02944 -1.76132e-07 9 -3.93402e-07C13.9706 -6.10673e-07 18 4.02944 18 9C18 13.9706 13.9706 18 9 18L0.352941 18Z","fill","#625DF5"],["d","M0.352941 18C0.158017 18 -6.90715e-09 17.842 -1.54275e-08 17.6471L-3.93402e-07 9C-6.10673e-07 4.02944 4.02944 -1.76132e-07 9 -3.93402e-07C13.9706 -6.10673e-07 18 4.02944 18 9C18 13.9706 13.9706 18 9 18L0.352941 18Z","stroke","white","stroke-width","2","mask","url(#path-1-inside-1_2032_23681)"]],template:function(t,r){if(t&1&&g(0,oNe,2,1,"velt-shadow-dom-internal",1)(1,cNe,1,1,"ng-template",null,0,Ee),t&2){let a=ce(2);c("ngIf",!r.template&&r.textCommentToolShadowDOM)("ngIfElse",a)}},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-text-comment-tool[_ngcontent-%COMP%]{position:fixed;z-index:2147483577;overflow-wrap:break-word;font-size:var(--velt-font-size-xs);text-align:center;visibility:hidden;cursor:pointer}.velt-text-comment-tool[_ngcontent-%COMP%] .velt-text-comment-tool--container[_ngcontent-%COMP%]{display:flex}"],changeDetection:0});let i=o;return i})();var Qce=i=>({componentConfigSignal:i}),mNe=(i,o)=>({condition:i,data:o}),pNe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-text-comment-toolbar-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function gNe(i,o){i&1&&Ve(0)}function uNe(i,o){if(i&1&&(_(0,"velt-shadow-dom-internal"),g(1,gNe,1,0,"ng-container",2),b()),i&2){l();let n=ce(2);m(),c("ngTemplateOutlet",n)}}function hNe(i,o){if(i&1&&w(0,"app-text-comment-toolbar-comment-annotation",10),i&2){let n=l(6);c("componentConfigSignal",n.componentConfigSignal)}}function fNe(i,o){i&1&&w(0,"app-text-comment-toolbar-divider")}function vNe(i,o){if(i&1&&(_(0,"div",8),g(1,hNe,1,1,"app-text-comment-toolbar-comment-annotation",9)(2,fNe,1,0,"app-text-comment-toolbar-divider",3),w(3,"app-text-comment-toolbar-copywriter",10)(4,"app-text-comment-toolbar-generic",10),b()),i&2){let n=l(3).ngIf,e=l(2);m(),c("ngIf",n.commentToolEnabled),m(),c("ngIf",n.commentToolEnabled),m(),c("componentConfigSignal",e.componentConfigSignal),m(),c("componentConfigSignal",e.componentConfigSignal)}}function CNe(i,o){if(i&1){let n=q();_(0,"div",6),P(1,"translate"),z("click",function(t){return N(n),F(t.stopPropagation())})("pointerdown",function(t){return N(n),F(t.stopPropagation())})("pointerup",function(t){return N(n),F(t.stopPropagation())}),g(2,vNe,5,4,"div",7),b()}if(i&2){let n=l(2).ngIf,e=l(2);it("top",n.position.top,"px")("left",n.left,"px")("visibility",n.showAdder?"visible":"hidden")("top",n.position.top,"px")("left",n.left,"px")("visibility",n.showAdder?"visible":"hidden"),x("data-testid",e.componentId)("role","toolbar")("aria-label",M(1,17,"Text comment tools"))("aria-hidden",!n.showAdder),m(2),c("veltDynamicTemplate",$(21,pNe,e.template,A(19,Qce,e.componentConfigSignal),n.variant,e.setIfCondition.bind(e),e.elementRef))}}function _Ne(i,o){if(i&1&&(f(0),g(1,CNe,3,27,"div",5),v()),i&2){let n=l().ngIf;m(),c("ngIf",n&&!n.disabled&&!n.isPlanExpired&&n.isUserAllowed&&n.enableTextComments&&(n.user==null?null:n.user.userId)&&n.rewriterEnabled)}}function yNe(i,o){if(i&1&&(f(0),g(1,_Ne,2,1,"ng-container",4),v()),i&2){let n=l(2);m(),c("veltIf",k(3,mNe,n.conditionSignal(),A(1,Qce,n.componentConfigSignal)))}}function SNe(i,o){if(i&1&&g(0,yNe,2,6,"ng-container",3),i&2){let n=l();c("ngIf",n.componentConfigSignal())}}var _0=(()=>{let o=class o extends Je{constructor(e,t,r,a,s,d){super(a,s,void 0,r,r.getTextCommentToolbarDarkMode$(),d,e),this.loggingService=e,this.wireframeService=t,this.commentService=r,this.elementRef=a,this.themeService=s,this.dynamicDataService=d,this.textCommentToolbarShadowDOM=!1,this.subscriptions=[],this.componentId="velt-text-comment-toolbar",super.initializeComponentConfigSignal(new As),this.subscriptions.push(this.commentService.getTextCommentToolbarShadowDOM$().subscribe(p=>{this.textCommentToolbarShadowDOM=p},p=>{this.loggingService.catch("Error in CommentPinComponent getTextCommentToolbarShadowDOM$ subscription: ",p)}))}ngOnInit(){try{this.loggingService.log("%c[WB] Calling FUNCTION: ngOnInit","color: green;"),super.ngOnInit(),this.setupA11yAttributes(),this.subscriptions.push(this.wireframeService.getWireframe$("velt-text-comment-toolbar-wireframe").subscribe(t=>{if(t){let r=document.createElement(t.tagName);r.innerHTML=t.innerHTML,this.template=r}}))}catch(e){this.loggingService.catch("Error in CommentBubbleComponent OnInit: ",e)}}ngOnDestroy(){try{super.ngOnDestroy(),this.subscriptions.forEach(e=>{e.unsubscribe()})}catch{}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","toolbar"),e.setAttribute("aria-label","Text comment tools")}catch(e){this.loggingService.catch("Error in TextCommentToolbarComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(He),h(De),h(R),h(qe),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-text-comment-toolbar"]],standalone:!1,features:[V([S]),B],decls:3,vars:2,consts:[["textCommentToolbarContainerRef",""],[4,"ngIf","ngIfElse"],[4,"ngTemplateOutlet"],[4,"ngIf"],[4,"veltIf"],["class","velt-text-comment-toolbar",3,"top","left","visibility","click","pointerdown","pointerup",4,"ngIf"],[1,"velt-text-comment-toolbar",3,"click","pointerdown","pointerup"],["class","velt-text-comment-toolbar--container",4,"veltDynamicTemplate"],[1,"velt-text-comment-toolbar--container"],[3,"componentConfigSignal",4,"ngIf"],[3,"componentConfigSignal"]],template:function(t,r){if(t&1&&g(0,uNe,2,1,"velt-shadow-dom-internal",1)(1,SNe,1,1,"ng-template",null,0,Ee),t&2){let a=ce(2);c("ngIf",!r.template&&r.textCommentToolbarShadowDOM)("ngIfElse",a)}},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-text-comment-toolbar[_ngcontent-%COMP%]{position:fixed;z-index:99999;transform:translate(-50%)}.velt-text-comment-toolbar--container[_ngcontent-%COMP%]{width:max-content;display:flex;align-items:center;padding:var(--velt-spacing-xs) var(--velt-spacing-sm);gap:var(--velt-spacing-sm);background:var(--velt-background-0);border:var(--velt-border-4);box-shadow:0 8px 16px #8f95b226;border-radius:var(--velt-border-radius-full);color:var(--velt-text-0)}"],changeDetection:0});let i=o;return i})();var INe=["commentAdderRef"],Jce=(()=>{let o=class o{constructor(e,t,r,a,s,d,p,u){this.analyticsService=e,this.authService=t,this.domService=r,this.iamService=a,this.commentService=s,this.loggingService=d,this.rewriterService=p,this.elementRef=u,this.componentConfigSignal=xe({position:{top:-1e3,left:-1e3},showAdder:!1,createAnnotation:this.createAnnotation.bind(this),disabled:!1,commentToolEnabled:!0,isPlanExpired:!1,isUserAllowed:!1,enableTextComments:!1,user:null,rewriterEnabled:!1,left:0,createRewriter:this.createRewriter.bind(this),selectedWordsCount:0,selectedCharactersCount:0,MIN_ALLOWED_WORDS_COUNT:3,MIN_ALLOWED_CHARACTERS_COUNT:7,MAX_ALLOWED_CHARACTERS_COUNT:8e3,variant:this.variant}),this.allowedElementIds=[],this.selectedCharactersCount=0,this.subscriptions=[],this.veltElement=!0,this.componentId="velt-comment-adder",this.subscriptions.push(this.commentService.getTextCommentMode$().subscribe(C=>{this.componentConfigSignal.update(E=>(E=T(I({},E),{enableTextComments:C}),E))},C=>{this.loggingService.catch("Error in CommentAdderComponent getTextCommentMode$ subscription: ",C)})),this.subscriptions.push(this.commentService.getAllowedElementIds().subscribe(C=>{this.allowedElementIds=C},C=>{this.loggingService.catch("Error in CommentAdderComponent getAllowedElementIds subscription: ",C)})),this.subscriptions.push(this.commentService.getCommentTool$().subscribe(C=>{this.componentConfigSignal.update(E=>(E=T(I({},E),{commentToolEnabled:C}),E))})),this.subscriptions.push(this.iamService.getFeaturesAccessLevel$().subscribe(C=>{this.componentConfigSignal.update(E=>(E=T(I({},E),{disabled:!!C?.all?.disabled}),E))})),this.subscriptions.push(this.authService.getUser$().subscribe(C=>{this.componentConfigSignal.update(E=>(E=T(I({},E),{user:C}),E))},C=>{this.loggingService.catch("Error in CommentAdderComponent getUser$ subscription: ",C)})),this.subscriptions.push(this.rewriterService.getRewriterEnabled$().subscribe(C=>{this.componentConfigSignal.update(E=>(E=T(I({},E),{rewriterEnabled:C}),E))},C=>{this.loggingService.catch("Error in CommentAdderComponent getRewriterEnabled$ subscription: ",C)})),this.subscriptions.push(this.iamService.isUserAllowed$().subscribe(C=>{this.componentConfigSignal.update(E=>(E=T(I({},E),{isUserAllowed:C}),E))},C=>{this.loggingService.catch("Error in CommentAdderComponent isUserAllowed$ subscription: ",C)})),this.subscriptions.push(this.authService.isPlanExpired$().subscribe(C=>{this.componentConfigSignal.update(E=>(E=T(I({},E),{isPlanExpired:C}),E))},C=>{this.loggingService.catch("Error in CommentAdderComponent isPlanExpired$ subscription: ",C)}))}ngOnChanges(e){try{e&&Object.keys(e).forEach(t=>{this.componentConfigSignal.update(r=>(r=T(I({},r),{[t]:e[t].currentValue}),r))})}catch(t){this.loggingService.catch("Error in CommentAdderComponent ngOnChanges: ",t)}}ngOnInit(){this.setupA11yAttributes(),this.domService.onSelectionChange$().subscribe(()=>{try{if(this.componentConfigSignal().enableTextComments&&this.componentConfigSignal().user&&!(this.componentConfigSignal().user?.isReadOnly||this.componentConfigSignal().user?.isAnonymous)&&this.authService.isFeatureAllowed(Ne.COMMENT)){if(window.getSelection()?.toString()){let e=window.getSelection()?.toString(),t=$P(e||"").join(" ");this.componentConfigSignal.update(r=>(r=T(I({},r),{selectedWordsCount:t?.split(" ").length||0,selectedCharactersCount:t?.length||0}),r))}else this.componentConfigSignal.update(e=>(e=T(I({},e),{selectedWordsCount:0,selectedCharactersCount:0}),e));if(window.getSelection()?.toString()&&!HP()){let e=window.getSelection()?.getRangeAt(0);e.commonAncestorContainer&&this.commentService.isElementInsideAllowedElements(e.commonAncestorContainer)&&(Rm(e.commonAncestorContainer)?this.clearSelection():(this.onSelection(),this.subscribeScrollChange()))}else this.clearSelection()}else this.clearSelection()}catch(e){this.loggingService.catch("Error in CommentAdderComponent onSelectionChange$: ",e)}},e=>{this.loggingService.catch("Error in CommentAdderComponent onSelectionChange$ subscription: ",e)})}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","application"),e.setAttribute("aria-label","Text comment adder")}catch(e){this.loggingService.catch("Error in CommentAdderComponent setupA11yAttributes:",e)}}subscribeScrollChange(){try{this.loggingService.log("%c[WB] Calling FUNCTION: subscribeScrollChange","color: green;"),this.scrollChangeSubscription&&this.scrollChangeSubscription.unsubscribe(),this.scrollChangeSubscription=En([this.domService.onWindowPointerUp$(),this.domService.getCurrentWindowSize$()]).subscribe(()=>{this.onSelection()})}catch(e){this.loggingService.catch("Error in CommentAdderComponent subscribeScrollChange: ",e)}}onSelection(){try{this.loggingService.log("%c[WB] Calling FUNCTION: onSelection","color: green;");let e=this.domService.getRange();if(e?.commonAncestorContainer){let t=e.getClientRects();if(t.length){let r=t[t.length-1];this.componentConfigSignal.update(a=>(a=T(I({},a),{position:{top:r.y+r.height+(a.rewriterEnabled?16:4),left:r.x+r.width-16}}),a)),this.onPositionUpdate(),this.componentConfigSignal.update(a=>(a=T(I({},a),{showAdder:!0}),a))}else this.clearSelection()}}catch(e){this.loggingService.catch("Error in CommentAdderComponent onSelection: ",e)}}createAnnotation(e,t){return Q(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: createAnnotation","color: green;"),yield Dd(200),this.componentConfigSignal().user){let r=this.domService.getRange(),a=r?this.domService.getTargetTextRangeFromSelectionRange(r):void 0;this.domService.clearTextSelection(),setTimeout(()=>{if(e)this.rewriterService.addRewriter(void 0,a,t);else{let s=r?.commonAncestorContainer;s&&s.nodeType===Node.TEXT_NODE&&(s=s.parentElement);let d=this.commentService.getInlineCommentSectionConfig(s);this.commentService.addComment(void 0,a,void 0,void 0,void 0,void 0,void 0,void 0,d)}},100)}}catch(r){this.loggingService.catch("Error in CommentAdderComponent createAnnotation: ",r)}})}createRewriter(e){return Q(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: createRewriter","color: green;"),this.componentConfigSignal().selectedWordsCount>=this.componentConfigSignal().MIN_ALLOWED_WORDS_COUNT&&this.componentConfigSignal().selectedCharactersCount>=this.componentConfigSignal().MIN_ALLOWED_CHARACTERS_COUNT&&this.componentConfigSignal().selectedCharactersCount<this.componentConfigSignal().MAX_ALLOWED_CHARACTERS_COUNT?(this.createAnnotation(!0,e),e==="copywriter"?this.analyticsService.trackEvent(X.Events.Rewriter.REWRITE_BUTTON_CLICKED,{charactersSelected:this.componentConfigSignal().selectedCharactersCount,wordsSelected:this.componentConfigSignal().selectedWordsCount,isMobileDevice:this.domService.isMobileDevice()}):this.analyticsService.trackEvent(X.Events.Rewriter.REWRITE_PROMPT_BUTTON_CLICKED,{charactersSelected:this.componentConfigSignal().selectedCharactersCount,wordsSelected:this.componentConfigSignal().selectedWordsCount,isMobileDevice:this.domService.isMobileDevice()})):this.componentConfigSignal().selectedCharactersCount<this.componentConfigSignal().MIN_ALLOWED_CHARACTERS_COUNT?this.analyticsService.trackEvent(X.Events.Rewriter.REWRITER_MIN_CHARACTER_NOT_MET,{minCharacterAllowed:this.componentConfigSignal().MIN_ALLOWED_CHARACTERS_COUNT,charactersSelected:this.componentConfigSignal().selectedCharactersCount,isMobileDevice:this.domService.isMobileDevice()}):this.componentConfigSignal().selectedCharactersCount>this.componentConfigSignal().MAX_ALLOWED_CHARACTERS_COUNT&&this.analyticsService.trackEvent(X.Events.Rewriter.REWRITER_MAX_CHARACTER_NOT_MET,{maxCharacterAllowed:this.componentConfigSignal().MAX_ALLOWED_CHARACTERS_COUNT,charactersSelected:this.componentConfigSignal().selectedCharactersCount,isMobileDevice:this.domService.isMobileDevice()})}catch(t){this.loggingService.catch("Error in CommentAdderComponent createRewriter: ",t)}})}clearSelection(){try{this.loggingService.log("%c[WB] Calling FUNCTION: clearSelection","color: green;"),this.componentConfigSignal.update(e=>(e=T(I({},e),{showAdder:!1,position:{top:-1e3,left:-1e3}}),e)),this.onPositionUpdate(),this.scrollChangeSubscription&&this.scrollChangeSubscription.unsubscribe()}catch(e){this.loggingService.catch("Error in CommentAdderComponent clearSelection: ",e)}}onPositionUpdate(){try{let e=this.commentAdderRef?.nativeElement.getBoundingClientRect(),t=0,r=0;e&&(t=e.width/2,r=window.innerWidth-e.width/2);let a=this.componentConfigSignal().position.left;a<t&&(a=t),a>r&&(a=r),this.componentConfigSignal().position.left<0&&(a=this.componentConfigSignal().position.left),this.componentConfigSignal.update(s=>(s=T(I({},s),{left:a}),s))}catch(e){this.loggingService.catch("Error in CommentAdderComponent onPositionUpdate: ",e)}}ngOnDestroy(){this.loggingService.log("%c[WB] Calling FUNCTION: ngOnDestroy","color: green;");try{this.unsubscribe()}catch(e){this.loggingService.catch("Error in CommentAdderComponent 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 CommentAdderComponent unsubscribe: ",e)}}};o.\u0275fac=function(t){return new(t||o)(h(tt),h(je),h(Fe),h(Sn),h(De),h(y),h(Bc),h(R))},o.\u0275cmp=O({type:o,selectors:[["snippyly-comment-adder"]],viewQuery:function(t,r){if(t&1&&nt(INe,5),t&2){let a;Xe(a=Qe())&&(r.commentAdderRef=a.first)}},hostVars:1,hostBindings:function(t,r){t&2&&x("data-velt-element",r.veltElement)},inputs:{variant:"variant"},standalone:!1,features:[Ze],decls:4,vars:7,consts:[["commentAdderRef",""],[3,"componentConfigSignal"]],template:function(t,r){t&1&&(w(0,"app-text-comment-tool",1),_(1,"div",null,0),w(3,"app-text-comment-toolbar",1),b()),t&2&&(c("componentConfigSignal",r.componentConfigSignal),x("data-testid",r.componentId+"-tool"),m(),x("data-testid",r.componentId+"-toolbar-container")("role","toolbar")("aria-label","Text comment tools")("aria-hidden",!r.componentConfigSignal().showAdder),m(2),c("componentConfigSignal",r.componentConfigSignal))},dependencies:[C0,_0],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);outline:none;margin:0;padding:0;line-height:1.5;color:#000;font-size:calc((1rem + 0px) * var(--velt-base-rem-unit));-webkit-user-select:none;-ms-user-select:none;user-select:none}*[_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}"],changeDetection:0});let i=o;return i})();var xNe=["overlay"];function TNe(i,o){if(i&1&&w(0,"span",8),i&2){let n,e=l().ngIf;ue("index-3-digit",(e.commentPinAnnotation==null||e.commentPinAnnotation.annotationIndex==null||(n=e.commentPinAnnotation.annotationIndex.toString())==null?null:n.length)===3),x("data-comment-annotation-number","#"+(e.commentPinAnnotation==null?null:e.commentPinAnnotation.annotationIndex))}}function DNe(i,o){if(i&1){let n=q();f(0),_(1,"velt-multi-thread-comment-dialog-internal",10),z("saveComment",function(t){N(n);let r=l(3);return F(r.saveComment(t))})("pointerUp",function(t){N(n);let r=l(3);return F(r.togglePinSelection(t))}),b(),v()}if(i&2){let n=l(2).ngIf;m(),c("multiThreadAnnotationId",n.commentPinAnnotation.annotationId)("annotation",n.commentPinAnnotation)("user",n.user)("commentPinSelected",n.commentPinSelected)}}function wNe(i,o){if(i&1){let n=q();_(0,"snippyly-comment-dialog",11),z("saveComment",function(t){N(n);let r=l(3);return F(r.saveComment(t))}),b()}if(i&2){let n=l(2).ngIf;c("annotation",n.commentPinAnnotation)("user",n.user)("commentPinSelected",n.commentPinSelected)("inlineCommentMode",n.inlineCommentMode)("isInsidePdfViewer",n.isInsidePdfViewer)}}function ONe(i,o){if(i&1&&g(0,DNe,2,4,"ng-container",9)(1,wNe,1,5,"ng-template",null,2,Ee),i&2){let n=ce(2),e=l().ngIf;c("ngIf",(e==null||e.commentPinAnnotation==null?null:e.commentPinAnnotation.type)==="multiThread")("ngIfElse",n)}}function ANe(i,o){if(i&1){let n=q();_(0,"snippyly-comment-bottom-sheet",12),z("saveComment",function(t){N(n);let r=l(2);return F(r.saveComment(t))}),b()}if(i&2){let n=l().ngIf;c("annotation",n.commentPinAnnotation)("user",n.user)("isInsidePdfViewer",n.isInsidePdfViewer)}}function PNe(i,o){if(i&1){let n=q();f(0),_(1,"snippyly-comment-text",4,0),z("pointerover",function(t){return N(n),l().onPointerOver(t),F(t.stopPropagation())})("pointerout",function(){N(n);let t=l();return F(t.onPointerOut())})("pointerdown",function(t){return N(n),F(t.stopPropagation())})("pointerup",function(t){return N(n),l().togglePinSelection(),F(t.stopPropagation())})("touchend",function(t){return N(n),t.stopPropagation(),F(t.preventDefault())})("click",function(t){return N(n),t.stopPropagation(),F(t.preventDefault())}),b(),g(3,TNe,1,3,"span",5)(4,ONe,3,2,"ng-template",6,1,Ee)(6,ANe,1,3,"snippyly-comment-bottom-sheet",7),v()}if(i&2){let n=o.ngIf,e=ce(2),t=l();m(),ue("inline-comment-mode",n.inlineCommentMode&&!n.isInsidePdfViewer)("selected",n.commentPinHover||n.commentPinSelected),m(2),c("ngIf",n.last&&n.showCommentIndex&&(n.commentPinAnnotation==null?null:n.commentPinAnnotation.annotationIndex)),m(),c("cdkConnectedOverlayOrigin",e)("cdkConnectedOverlayOpen",(!n.mobileMode||!n.isPhone)&&!n.inboxMode&&!n.streamMode&&(!n.inlineCommentMode||n.isInsidePdfViewer)&&n.floatingCommentsEnabled&&(n.textClicked&&n.commentPinSelected||n.commentPinHover&&!n.commentPinSelected))("cdkConnectedOverlayOffsetY",n.overlayOriginY==="top"?-8:2)("cdkConnectedOverlayPanelClass","snippyly-overlay-panel")("cdkConnectedOverlayBackdropClass","snippyly-overlay-backdrop")("cdkConnectedOverlayLockPosition",!1)("cdkConnectedOverlayPositions",t.positions)("cdkConnectedOverlayGrowAfterOpen",!0)("cdkConnectedOverlayDisableClose",!0),m(2),c("ngIf",(n==null?null:n.user)&&n.mobileMode&&n.isPhone&&!n.sidebarVisible&&(!n.inlineCommentMode||n.isInsidePdfViewer)&&!n.inboxMode&&!n.streamMode&&n.floatingCommentsEnabled&&n.textClicked&&n.commentPinSelected)}}var i9=(()=>{let o=class o{onEnter(e){this.onKeyupEnter&&this.onKeyupEnter()}constructor(e,t,r,a,s,d,p,u){this.analyticsService=e,this.authService=t,this.breakpointObserver=r,this.domService=a,this.commentService=s,this.loggingService=d,this.recorderService=p,this.elementRef=u,this.subscriptions=[],this.selectedAnnotationsMap={},this.customScrollableParentEventsListenersSubscriptions=[],this.isDialogOnHoverEnabled=!1,this.componentConfigSignal=xe({inlineCommentMode:!1,isInsidePdfViewer:!1,commentPinHover:!1,commentPinSelected:!1,first:!1,last:!1,showCommentIndex:!1,commentPinAnnotation:null,isPhone:!1,mobileMode:!1,streamMode:!1,inboxMode:!1,textClicked:!1,floatingCommentsEnabled:!0,sidebarVisible:!1,user:null,overlayOriginX:"start",overlayOriginY:"top"}),this.positions=j.OVERLAY_POSITIONS.map(C=>new yi({originX:C.originX,originY:C.originY},{overlayX:C.overlayX,overlayY:C.overlayY})),this.veltElement=!0,this.componentId="velt-comment-text-portal",this.subscriptions.push(this.authService.getUser$().subscribe(C=>{this.componentConfigSignal.update(E=>(E=T(I({},E),{user:C}),E))},C=>{this.catchError("Error in CommentTextPortalComponent getUser$ subscription: ",C)})),this.subscriptions.push(this.commentService.getSidebarVisibility$().subscribe(C=>{this.componentConfigSignal.update(E=>(E=T(I({},E),{sidebarVisible:C}),E))},C=>{this.catchError("Error in CommentTextPortalComponent getSidebarVisibility$ subscription: ",C)})),this.subscriptions.push(this.commentService.showFloatingComments$().subscribe(C=>{this.componentConfigSignal.update(E=>(E=T(I({},E),{floatingCommentsEnabled:C}),E))},C=>{this.catchError("Error in CommentTextPortalComponent showFloatingComments$ subscription: ",C)})),this.subscriptions.push(this.commentService.getShowCommentIndex().subscribe(C=>{this.componentConfigSignal.update(E=>(E=T(I({},E),{showCommentIndex:C}),E))},C=>{this.catchError("Error in CommentTextPortalComponent getShowCommentIndex subscription: ",C)})),this.subscriptions.push(this.commentService.getEnableDialogOnHover$().subscribe(C=>{this.isDialogOnHoverEnabled=C},C=>{this.catchError("Error in CommentPinComponent getEnableDialogOnHover subscription: ",C)})),this.subscriptions.push(this.breakpointObserver.observe(ki.XSmall).subscribe(C=>{let E=!1;C.matches?E=!0:E=!1,this.componentConfigSignal.update(D=>(D=T(I({},D),{isPhone:E}),D))},C=>{this.catchError("Error in CommentTextPortalComponent breakpointObserver subscription: ",C)}))}ngOnInit(){try{this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentTextPortalComponent ngOnInit:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentTextPortalComponent setupA11yAttributes:",e)}}ngAfterViewInit(){try{let e=this.element.childNodes[0];this.element.childNodes[1].childNodes[0].appendChild(e),this.componentConfigSignal.update(r=>{let a=Dv(this.element,j.ATTRIBUTES.VELT_PDF_VIEWER);return r=T(I({},r),{isInsidePdfViewer:a}),r}),this.subscriptions.push(this.overlay?.positionChange?.subscribe(r=>{this.componentConfigSignal.update(a=>(a=T(I({},a),{overlayOriginX:r.connectionPair.originX,overlayOriginY:r.connectionPair.originY}),a))},r=>{this.catchError("Error in CommentTextPortalComponent positionChange subscription: ",r)})),this.subscriptions.push(this.domService.getSelectedAnnotationsMap$().subscribe(r=>{this.selectedAnnotationsMap=r,this.checkPinSelection()},r=>{this.catchError("Error in CommentTextPortalComponent getSelectedAnnotationsMap$ subscription: ",r)})),this.subscriptions.push(this.commentService.getStreamMode$().subscribe(r=>{this.componentConfigSignal.update(a=>(a=T(I({},a),{streamMode:r}),a))},r=>{this.catchError("Error in CommentTextPortalComponent getStreamMode$ subscription: ",r)})),this.subscriptions.push(this.commentService.getInboxMode$().subscribe(r=>{this.componentConfigSignal.update(a=>(a=T(I({},a),{inboxMode:r}),a))},r=>{this.catchError("Error in CommentTextPortalComponent getInboxMode subscription: ",r)})),this.subscriptions.push(this.commentService.getMobileMode$().subscribe(r=>{this.componentConfigSignal.update(a=>(a=T(I({},a),{mobileMode:r}),a))},r=>{this.catchError("Error in CommentTextPortalComponent getMobileMode$ subscription: ",r)})),this.subscriptions.push(this.commentService.getInlineCommentMode$().subscribe(r=>{this.componentConfigSignal.update(a=>(a=T(I({},a),{inlineCommentMode:r}),a))},r=>{this.catchError("Error in CommentTextPortalComponent getInlineCommentMode$ subscription: ",r)})),this.subscriptions.push(this.recorderService.onInitRecording().subscribe(r=>{this.recorderInitConfig=r},r=>{this.catchError("Error in CommentTextPortalComponent onInitRecording subscription: ",r)}))}catch(e){this.catchError("Error in CommentTextPortalComponent AfterViewInit: ",e)}}setFirst(e){try{this.componentConfigSignal.update(t=>(t=T(I({},t),{first:e}),t))}catch(t){this.catchError("Error in CommentTextPortalComponent setFirst: ",t)}}setLast(e){try{this.componentConfigSignal.update(t=>(t=T(I({},t),{last:e}),t))}catch(t){this.catchError("Error in CommentTextPortalComponent setLast: ",t)}}setCommentPinAnnotation(e){try{this.componentConfigSignal.update(t=>(t=T(I({},t),{commentPinAnnotation:e}),t))}catch(t){this.catchError("Error in CommentTextPortalComponent setCommentPinAnnotation: ",t)}}setElement(e){try{this.element=e,this.element?this.customScrollableParents=Bp(this.element):this.customScrollableParents=[],this.addCustomScrollableParentsEventListeners()}catch(t){this.catchError("Error in CommentTextPortalComponent setElement: ",t)}}checkPinSelection(){try{this.selectedAnnotationsMap[this.componentConfigSignal().commentPinAnnotation?.annotationId]?this.componentConfigSignal.update(e=>(e=T(I({},e),{commentPinSelected:!0}),e)):this.componentConfigSignal.update(e=>(e=T(I({},e),{commentPinSelected:!1,textClicked:!1}),e)),sessionStorage.getItem(j.SESSION_STORAGE.SNIPPYLY_AUTO_SELECT_ANNOTATION_ID)===this.componentConfigSignal().commentPinAnnotation.annotationId&&this.componentConfigSignal().last&&(this.componentConfigSignal.update(e=>(e=T(I({},e),{textClicked:!0}),e)),sessionStorage.removeItem(j.SESSION_STORAGE.SNIPPYLY_AUTO_SELECT_ANNOTATION_ID))}catch(e){this.catchError("Error in CommentTextPortalComponent checkPinSelection: ",e)}}onPointerOver(e){try{if(this.componentConfigSignal().commentPinHover)return;e.buttons?this.componentConfigSignal().commentPinHover&&this.componentConfigSignal.update(t=>(t=T(I({},t),{commentPinHover:!1}),t)):!this.componentConfigSignal().commentPinHover&&this.isDialogOnHoverEnabled&&this.componentConfigSignal.update(t=>(t=T(I({},t),{commentPinHover:!0}),t))}catch(t){this.catchError("Error in CommentTextPortalComponent onPointerOver: ",t)}}onPointerOut(){this.componentConfigSignal.update(e=>(e=T(I({},e),{commentPinHover:!1}),e))}togglePinSelection(e){try{if(this.recorderInitConfig?.isCommentRecording||this.componentConfigSignal().textClicked&&!e)return;let t=e||this.componentConfigSignal().commentPinAnnotation;if(this.selectedAnnotationsMap[t.annotationId])e||(document.querySelector(`[${j.ATTRIBUTES.VELT_ANNOTATION_DRAFT}="${t?.annotationId}"]`)?this.domService.resetSelectedAnnotationsMap(!0,"comments"):(this.componentConfigSignal.update(a=>(a=T(I({},a),{textClicked:!0}),a)),this.domService.toggleAnnotationSelection(t)));else{let r=document.querySelector(`[${j.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);if(r||(r=(this.domService.getDraftCommentAnnotationDialogs()||[])[0]),r){let a=r.getAttribute(j.ATTRIBUTES.VELT_ANNOTATION_DRAFT);if(a){let s=document.getElementById(`comment-pin-container-${a}`)||document.querySelector(`[data-velt-id='${a}']`);s&&(s.scrollIntoView({behavior:"auto",block:"center",inline:"center"}),this.domService.resetSelectedAnnotationsMap(!0,"comments"))}}else this.domService.resetSelectedAnnotationsMap(!0,"comments"),this.componentConfigSignal.update(a=>(a=T(I({},a),{textClicked:!0}),a)),this.domService.toggleAnnotationSelection(t)}}catch(t){this.catchError("Error in CommentTextPortalComponent togglePinSelection: ",t)}}saveComment(e){try{this.commentService.saveComment(this.componentConfigSignal().commentPinAnnotation,e)}catch(t){this.catchError("Error in CommentTextPortalComponent saveComment: ",t)}}updateOverlayPosition(){try{this.loggingService.log("updateOverlayPosition",this.componentConfigSignal().commentPinAnnotation?.annotationId),this.overlay&&this.overlay?.overlayRef?.updatePosition()}catch(e){this.catchError("Error in CommentTextPortalComponent updateOverlayPosition: ",e)}}addCustomScrollableParentsEventListeners(){try{this.removeCustomScrollableParentsEventListeners(),this.customScrollableParents?.length&&this.customScrollableParents?.forEach(e=>{this.customScrollableParentEventsListenersSubscriptions.push(mi(e,"scroll").subscribe(t=>{this.updateOverlayPosition()},t=>{this.catchError("Error in CommentTextPortalComponent addCustomScrollableParentsEventListeners scroll subscription: ",t)}))})}catch(e){this.catchError("Error in CommentTextPortalComponent addCustomScrollableParentsEventListeners: ",e)}}removeCustomScrollableParentsEventListeners(){try{this.customScrollableParentEventsListenersSubscriptions.map(e=>{e.unsubscribe()}),this.customScrollableParentEventsListenersSubscriptions=[]}catch(e){this.catchError("Error in CommentTextPortalComponent removeCustomScrollableParentsEventListeners: ",e)}}ngOnDestroy(){this.loggingService.log("%c[WB] Calling FUNCTION: unsubscribe","color: green;");try{this.removeCustomScrollableParentsEventListeners(),this.subscriptions.map(e=>{e.unsubscribe()}),this.subscriptions=[]}catch(e){this.catchError("Error in CommentTextPortalComponent unsubscribe: ",e)}}catchError(e,t,r){try{this.loggingService.catch(e,t,T(I({},r||{}),{annotationId:this.componentConfigSignal()?.commentPinAnnotation?.annotationId}))}catch{}}};o.\u0275fac=function(t){return new(t||o)(h(tt),h(je),h(go),h(Fe),h(De),h(y),h(kn),h(R))},o.\u0275cmp=O({type:o,selectors:[["snippyly-comment-text-portal"]],viewQuery:function(t,r){if(t&1&&nt(xNe,5),t&2){let a;Xe(a=Qe())&&(r.overlay=a.first)}},hostVars:1,hostBindings:function(t,r){t&1&&z("keyup.enter",function(s){return r.onEnter(s)},!1,X4),t&2&&x("data-velt-element",r.veltElement)},standalone:!1,decls:1,vars:1,consts:[["trigger","cdkOverlayOrigin"],["overlay","cdkConnectedOverlay"],["commentDialogRef",""],[4,"ngIf"],["cdkOverlayOrigin","","data-velt-comment-disabled","true",1,"comment-text-highlight",3,"pointerover","pointerout","pointerdown","pointerup","touchend","click"],["class","comment-annotation-number",3,"index-3-digit",4,"ngIf"],["cdkConnectedOverlay","",3,"cdkConnectedOverlayOrigin","cdkConnectedOverlayOpen","cdkConnectedOverlayOffsetY","cdkConnectedOverlayPanelClass","cdkConnectedOverlayBackdropClass","cdkConnectedOverlayLockPosition","cdkConnectedOverlayPositions","cdkConnectedOverlayGrowAfterOpen","cdkConnectedOverlayDisableClose"],[3,"annotation","user","isInsidePdfViewer","saveComment",4,"ngIf"],[1,"comment-annotation-number"],[4,"ngIf","ngIfElse"],[3,"saveComment","pointerUp","multiThreadAnnotationId","annotation","user","commentPinSelected"],[3,"saveComment","annotation","user","commentPinSelected","inlineCommentMode","isInsidePdfViewer"],[3,"saveComment","annotation","user","isInsidePdfViewer"]],template:function(t,r){t&1&&g(0,PNe,7,15,"ng-container",3),t&2&&c("ngIf",r.componentConfigSignal())},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;margin:0;padding:0;height:inherit;width:inherit;text-align:inherit;line-height:inherit;font-size:inherit;text-transform:inherit;float:inherit;-webkit-text-fill-color:initial}*[_ngcontent-%COMP%]:empty{display:revert}[_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);font-family:inherit}.comment-text-highlight[_ngcontent-%COMP%]{cursor:pointer} snippyly-text-highlight.snippyly-text-highlight{color:var(--velt-black)} snippyly-text-highlight.snippyly-text-highlight .comment-text-highlight{color:var(--velt-warning-hover);background-color:var(--velt-warning-transparent);border-bottom:1px solid var(--velt-warning-hover)} snippyly-text-highlight.snippyly-text-highlight .comment-text-highlight.selected{color:var(--velt-black);background-color:var(--velt-warning)} snippyly-text-highlight.snippyly-text-highlight .comment-text-highlight.inline-comment-mode{background-color:inherit} snippyly-text-highlight.snippyly-text-highlight .comment-text-highlight.inline-comment-mode.selected{background-color:inherit}.comment-annotation-number[_ngcontent-%COMP%]{border-radius:50%;border:1px solid var(--velt-gray);width:20px;height:20px;font-size:calc((.7rem + 0px) * var(--velt-base-rem-unit));display:inline-flex;justify-content:center;align-items:center;box-sizing:content-box;background:var(--velt-white);color:var(--velt-black);position:relative}.comment-annotation-number.index-3-digit[_ngcontent-%COMP%]{width:32px;height:32px}.comment-annotation-number[_ngcontent-%COMP%]:after{content:attr(data-comment-annotation-number);position:absolute;font-weight:400;letter-spacing:normal;word-spacing:normal}"],changeDetection:0});let i=o;return i})();var o9=(()=>{let o=class o{constructor(e,t,r,a,s,d,p){this.docService=e,this.domService=t,this.commentService=r,this.componentFactoryResolver=a,this.injector=s,this.appRef=d,this.loggingService=p,this.commentsTextById={},this.commonAncestorElementObservers=new Map,this.commonAncestorElementObserverCounts=new Map,this.inlineCommentMode=!1;try{this.commentService.getInlineCommentMode$().subscribe(u=>{this.inlineCommentMode=u})}catch(u){this.loggingService.catch("Error in CommentPinPortalService constructor: ",u)}}updateTextCommentAnnotations(e){try{this.checkToRemoveTextCommentAnnotations(e),e.forEach(t=>{this.updateTextCommentAnnotation(t)})}catch(t){this.loggingService.catch("Error in CommentPinPortalService updateTextCommentAnnotations: ",t)}}updateTextCommentAnnotation(e){let t=this.commentsTextById[e.annotationId];if(t)if(zi(t?.annotation?.targetTextRange,e?.targetTextRange)){let r=!1;t?.texts?.length?t.texts.forEach(a=>{document.body.contains(a?.textNode)||(r=!0)}):r=!0,r?(this.removeTextCommentAnnotation(e),this.getCommonAncestorContainer(e)):t.texts.forEach(a=>{a.portalRef&&a.portalRef.instance.setCommentPinAnnotation(e)})}else this.removeTextCommentAnnotation(e),this.getCommonAncestorContainer(e);else this.getCommonAncestorContainer(e)}getCommonAncestorContainer(e){try{let t=this.domService.getElementFromXPath(e?.targetTextRange?.commonAncestorContainer);if(t&&this.domService.isElementVisible(t)){let r=t?.nodeType===Node.ELEMENT_NODE?t:t?.parentElement;this.commentsTextById[e.annotationId]={texts:[],annotation:e,commonAncestorContainer:t,commonAncestorElement:r,commonAncestorText:r?.textContent},this.setTextCommentPortal(e),this.observeCommonAncestorElementChanges(e)}else this.setGhostComment(e)}catch(t){this.loggingService.catch("Error in CommentPinPortalService getCommonAncestorContainer: ",t)}}setTextCommentPortal(e){try{let t=this.commentsTextById[e.annotationId];if(t){let r=this.domService.getXPath(e?.targetTextRange?.commonAncestorContainer)?.iterateNext();if(e?.locationId&&this.docService.getLocation()?.locationId!==e?.locationId){let p=this.docService.getElementMapWithLocation();p[e?.locationId]&&(r=p[e?.locationId]?.element)}let a=bv(e.targetTextRange?.text,r,e.targetTextRange?.occurrence),s=!1;if(a?.forEach(d=>{d?.textNode?.parentElement?.closest("script")&&(s=!0)}),!s){let d=new Range;try{d.setStart(a[0].textNode,a[0].startOffset||0),d.setEnd(a[a.length-1].textNode,a[a.length-1].endOffset||0)}catch{}if(d.toString()===e.targetTextRange?.text){let p=v0(d),u=[],C=p?.find(E=>!E?.textContent);if(C&&C?.remove(),p=p?.filter(E=>E?.textContent),p&&p.length){let E=-1,D=-1;if(p.forEach((L,G)=>{this.textHighlighterClass?this.domService.addClassToElement(L,this.textHighlighterClass):this.domService.addClassToElement(L,L.tagName?.toLowerCase()),L.setAttribute(j.ATTRIBUTES.VELT_ID,e.annotationId);let Y=L.childNodes[0],ne=new Bo(i9),ge=new Vo(L,this.componentFactoryResolver,this.appRef,this.injector),ye=ge.attach(ne);ye.instance.setCommentPinAnnotation(e),ye.instance.setElement(L),ye.instance.onKeyupEnter=()=>{this.onCommonAncestorElementChange(e)},E<0&&(E=G),D=G,u.push({host:ge,portal:ne,portalRef:ye,element:L,textNode:Y})}),E>=0&&u[E]?.portalRef&&u[E].portalRef.instance.setFirst(!0),D>=0&&u[D]?.portalRef&&u[D].portalRef.instance.setLast(!0),t.texts=u,this.inlineCommentMode&&!document.querySelector(`${j.TAGS.VELT_INLINE_COMMENT}[${j.ATTRIBUTES.VELT_INLINE_COMMENT_ID}="${e.annotationId}"]`)){let G=t.texts?.filter(ne=>!!ne?.element)?.map(ne=>ne?.element),Y=G?.length?G[G.length-1]:null;if(Y&&!Dv(Y,j.ATTRIBUTES.VELT_PDF_VIEWER)){let ge=Y?.parentElement;if(ge){let ye=document.createElement(j.TAGS.VELT_INLINE_COMMENT);ye.setAttribute(j.ATTRIBUTES.VELT_INLINE_COMMENT_ID,e.annotationId),ge.insertAdjacentElement("afterend",ye),t.inlineCommentElement=ye}}}}this.removeGhostComment(e)}else this.setGhostComment(e)}}else this.setGhostComment(e)}catch(t){this.loggingService.catch("Error in CommentPinPortalService setTextCommentPortal: ",t)}}checkToRemoveTextCommentAnnotations(e){try{let t=e.map(a=>a.annotationId),r=!1;if(Object.keys(this.commentsTextById).forEach(a=>{t.includes(a)||(this.commentsTextById[a]?.annotation?.targetTextRange&&(r=!0),this.removeTextCommentAnnotation(this.commentsTextById[a].annotation))}),r){let a=[];Object.keys(this.commentsTextById).forEach(s=>{this.commentsTextById[s]?.annotation?.targetTextRange&&(a.push(this.commentsTextById[s]?.annotation),this.removeTextCommentAnnotation(this.commentsTextById[s]?.annotation))}),a?.length&&a.forEach(s=>{this.updateTextCommentAnnotation(s)})}}catch(t){this.loggingService.catch("Error in CommentPinPortalService checkToRemoveTextCommentAnnotations: ",t)}}removeTextCommentAnnotation(e){try{let t=this.commentsTextById[e.annotationId];if(t.texts.forEach(r=>{r?.host&&r.host.detach(),r?.element&&r?.textNode&&r.element.replaceWith(r.textNode),r.textNode&&r.textNode.parentNode?.normalize()}),t.texts?.length){let r=document.querySelectorAll(`${j.TAGS.SNIPPYLY_TEXT_HIGHLIGHT}[data-velt-id="${e?.annotationId}"]`);r?.length&&r.forEach(a=>{let s=a?.parentNode;if(a?.textContent){let d=document.createTextNode(a.textContent);a.replaceWith(d)}s&&s.normalize()})}t?.inlineCommentElement&&t?.inlineCommentElement?.remove(),this.checkToUnsubscribeCommonAncestorElementChanges(e),delete this.commentsTextById[e.annotationId]}catch(t){this.loggingService.catch("Error in CommentPinPortalService removeTextCommentAnnotation: ",t)}}observeCommonAncestorElementChanges(e){try{let t=this.commentsTextById[e.annotationId];if(t.commonAncestorElement){let r=this.commonAncestorElementObservers.get(t.commonAncestorElement);if(r)r.annotations.find(a=>a.annotationId===e.annotationId)||r.annotations.push(e);else{let a=new MutationObserver(s=>{let d="";if(jP(t?.commonAncestorElement).forEach(u=>{u?.parentElement?.closest(".comment-annotation-number")||(d+=u.textContent)}),t?.commonAncestorText!==d&&s.filter(u=>[Node.ELEMENT_NODE,Node.TEXT_NODE].includes(u.target.nodeType)).filter(u=>u.target?.parentElement&&(u?.target?.parentElement?.classList?.contains("comment-text-highlight")||!qi(u.target?.parentElement))).length){this.commonAncestorElementObservers.get(t.commonAncestorElement)?.annotations?.forEach(L=>{this.onCommonAncestorElementChange(L)});let{count:C,lastUpdated:E}=this.commonAncestorElementObserverCounts.get(t.commonAncestorElement)||{count:0,lastUpdated:0},D=Date.now();this.commonAncestorElementObserverCounts.set(t.commonAncestorElement,{count:D-E<100?C+1:1,lastUpdated:Date.now()}),C>5&&(a.disconnect(),this.loggingService.catch("Failed to detect text changes."))}});a.observe(t.commonAncestorElement,{characterData:!0,subtree:!0}),r={observer:a,annotations:[e]}}this.commonAncestorElementObservers.set(t.commonAncestorElement,r)}}catch(t){this.loggingService.catch("Error in CommentPinPortalService observeCommonAncestorElementChanges: ",t)}}onCommonAncestorElementChange(e){try{let t=this.commentsTextById[e.annotationId];if(t.texts?.length){let r="";t.texts.forEach(C=>r+=C.textNode?.textContent);let a=t.texts[0].textNode,s=[];document.querySelectorAll(`${j.TAGS.SNIPPYLY_TEXT_HIGHLIGHT}[data-velt-id="${e?.annotationId}"]`)?.forEach(C=>{s.push(C)});let d=!1;if(s?.length!==t?.texts?.length&&(d=!0),s?.length){let C="";s.forEach(E=>{C+=E?.textContent||""}),C&&(r=C,d&&this.removeTextCommentAnnotation(e))}let p=Ku(t.commonAncestorContainer,0,a,0,r)+1,u={};u.commonAncestorContainer=e.targetTextRange?.commonAncestorContainer,u.text=r,u.occurrence=p,zi(e.targetTextRange,u)||(t.annotation.targetTextRange=u,this.updateAnnotationToFirebase(t.annotation))}else this.setTextCommentPortal(t.annotation)}catch(t){this.loggingService.catch("Error in CommentPinPortalService onCommonAncestorElementChange: ",t)}}updateAnnotationToFirebase(e){try{this.commentService.updateComment(e,!1,!0)}catch(t){this.loggingService.catch("Error in CommentPinPortalService updateAnnotationToFirebase: ",t)}}checkToUnsubscribeCommonAncestorElementChanges(e){try{let t=this.commentsTextById[e.annotationId];if(t.commonAncestorElement){let r=this.commonAncestorElementObservers.get(t.commonAncestorElement);r&&(r.annotations=r?.annotations.filter(a=>a.annotationId!==e.annotationId),r.annotations.length||this.unsubscribeCommonAncestorElementChanges(e))}}catch(t){this.loggingService.catch("Error in CommentPinPortalService checkToUnsubscribeCommonAncestorElementChanges: ",t)}}setGhostComment(e){try{e.ghostComment={},this.commentService.setGhostCommentMessage(e),this.commentService.addAnnotationToGhostCommentAnnotationMap(e)}catch(t){this.loggingService.catch("Error in CommentPinPortalService setGhostComment: ",t)}}removeGhostComment(e){try{delete e.ghostComment,this.commentService.removeAnnotationFromGhostCommentAnnotationMap(e)}catch(t){this.loggingService.catch("Error in CommentPinPortalService removeGhostComment: ",t)}}onAcceptComment(e){try{let t=this.commentsTextById[e.annotationId];if(t?.texts?.length){let r=t.texts.length-1,a=t.texts[r].textNode;if(a&&a.parentNode){let s=e.comments?.length?e.comments[0]:null,d=Tv(s?.replaceContentHtml)?null:s?.replaceContentHtml,p=s?.replaceContentText||s?.commentText||"";if(Tv(d)&&!s?.replaceContentText&&(d=s?.commentHtml||""),e?.selectAllContent&&e?.targetElementId){let u=na(e.targetElementId,["id","data-id"]);u&&(u.innerHTML=this.domService.sanitizeHtml(Tv(d)?p||"":d||""))}else{if(d&&d!==p){let u=document.createElement("span");u.innerHTML=this.domService.sanitizeHtml(d||p||""),a.parentNode.replaceChild(u,a),t.texts[r].textNode=u}else t.texts[r].textNode.textContent=p||"";for(let u=0;u<r;u++){let C=t.texts[u].textNode;C&&(C.textContent="")}}this.removeTextCommentAnnotation(e),this.domService.resetSelectedAnnotationsMap()}}}catch(t){this.loggingService.catch("Error in CommentPinPortalService onAcceptComment: ",t)}}unsubscribeCommonAncestorElementChanges(e){try{let t=this.commentsTextById[e.annotationId];this.commonAncestorElementObservers.get(t.commonAncestorElement)?.observer?.disconnect(),this.commonAncestorElementObservers.delete(t.commonAncestorElement)}catch(t){this.loggingService.catch("Error in CommentPinPortalService unsubscribeCommonAncestorElementChanges: ",t)}}};o.\u0275fac=function(t){return new(t||o)(J(at),J(Fe),J(De),J(Eo),J(xt),J(fi),J(y))},o.\u0275prov=Me({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var $d=class{constructor(){this.type="contact"}};var tde=i=>({componentConfigSignal:i}),MNe=(i,o)=>({condition:i,data:o}),kNe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-autocomplete-chip-tooltip-description-wireframe",variant:n,setIfCondition:e,componentElementRef:t}),RNe=()=>({});function NNe(i,o){i&1&&Ve(0)}function FNe(i,o){if(i&1&&(f(0),g(1,NNe,1,0,"ng-container",6),v()),i&2){l(2);let n=ce(3);m(),c("ngTemplateOutlet",n)}}function LNe(i,o){i&1&&Ve(0)}function BNe(i,o){if(i&1&&(f(0),g(1,LNe,1,0,"ng-container",6),v()),i&2){l(2);let n=ce(5);m(),c("ngTemplateOutlet",n)}}function VNe(i,o){i&1&&Ve(0)}function UNe(i,o){if(i&1&&(f(0),g(1,VNe,1,0,"ng-container",6),v()),i&2){l(2);let n=ce(7);m(),c("ngTemplateOutlet",n)}}function jNe(i,o){if(i&1&&(f(0),g(1,FNe,2,1,"ng-container",3)(2,BNe,2,1,"ng-container",3)(3,UNe,2,1,"ng-container",3),v()),i&2){let n=l(2).ngIf;m(),c("ngIf",(n==null?null:n.type)==="contact"),m(),c("ngIf",(n==null?null:n.type)==="custom"),m(),c("ngIf",(n==null?null:n.type)==="group")}}function $Ne(i,o){if(i&1&&(ee(0),P(1,"translate")),i&2){let n=l(2).ngIf;Ce(" ",M(1,1,(n==null||n.contact==null?null:n.contact.email)||(n==null?null:n.email))," ")}}function HNe(i,o){if(i&1&&(ee(0),P(1,"translate")),i&2){let n=l(2).ngIf;Ce(" ",M(1,1,n==null||n.custom==null||n.custom.custom==null?null:n.custom.custom.description)," ")}}function zNe(i,o){if(i&1&&(f(0),ee(1),P(2,"translate"),v()),i&2){let n,e=l(3).ngIf,t=l();m(),hr(" ",(n=t.objectKeys((e==null||e.group==null||e.group.group==null?null:e.group.group.users)||Ot(4,RNe)))==null?null:n.length," ",M(2,2,"members")," ")}}function GNe(i,o){if(i&1&&g(0,zNe,3,5,"ng-container",3),i&2){let n=l(2).ngIf;c("ngIf",n==null||n.group==null?null:n.group.group)}}function WNe(i,o){if(i&1&&(f(0),g(1,jNe,4,3,"ng-container",5)(2,$Ne,2,3,"ng-template",null,0,Ee)(4,HNe,2,3,"ng-template",null,1,Ee)(6,GNe,1,1,"ng-template",null,2,Ee),v()),i&2){let n=l().ngIf,e=l();m(),c("veltDynamicTemplate",$(3,kNe,e.template,A(1,tde,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function qNe(i,o){if(i&1&&(f(0),g(1,WNe,8,9,"ng-container",4),v()),i&2){let n=l();m(),c("veltIf",k(3,MNe,n.conditionSignal(),A(1,tde,n.componentConfigSignal)))}}var Ob=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.objectKeys=Object.keys,super.initializeComponentConfigSignal(new $d)}ngOnInit(){try{super.ngOnInit()}catch(e){this.loggingService.catch("Error in AutocompleteChipTooltipDescriptionComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in AutocompleteChipTooltipDescriptionComponent ngOnDestroy:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["velt-autocomplete-chip-tooltip-description-internal"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[["contacEmailRef",""],["customDescriptionRef",""],["groupDescriptionRef",""],[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[4,"ngTemplateOutlet"]],template:function(t,r){t&1&&g(0,qNe,2,6,"ng-container",3),t&2&&c("ngIf",r.componentConfigSignal())},encapsulation:2,changeDetection:0});let i=o;return i})();var nde=i=>({componentConfigSignal:i}),YNe=(i,o)=>({condition:i,data:o}),KNe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-autocomplete-chip-tooltip-icon-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function ZNe(i,o){i&1&&Ve(0)}function XNe(i,o){if(i&1&&(f(0),g(1,ZNe,1,0,"ng-container",6),v()),i&2){l(2);let n=ce(3);m(),c("ngTemplateOutlet",n)}}function QNe(i,o){i&1&&Ve(0)}function JNe(i,o){if(i&1&&(f(0),g(1,QNe,1,0,"ng-container",6),v()),i&2){l(2);let n=ce(5);m(),c("ngTemplateOutlet",n)}}function eFe(i,o){i&1&&Ve(0)}function tFe(i,o){if(i&1&&(f(0),g(1,eFe,1,0,"ng-container",6),v()),i&2){l(2);let n=ce(7);m(),c("ngTemplateOutlet",n)}}function nFe(i,o){if(i&1&&(f(0),g(1,XNe,2,1,"ng-container",3)(2,JNe,2,1,"ng-container",3)(3,tFe,2,1,"ng-container",3),v()),i&2){let n=l(2).ngIf;m(),c("ngIf",(n==null?null:n.type)==="contact"),m(),c("ngIf",(n==null?null:n.type)==="custom"),m(),c("ngIf",(n==null?null:n.type)==="group")}}function iFe(i,o){if(i&1&&w(0,"snippyly-user-avatar",7),i&2){let n=l(2).ngIf;c("size",32)("user",n==null?null:n.contact)}}function oFe(i,o){if(i&1&&(w(0,"div",11),P(1,"safeSvg")),i&2){let n=l(3).ngIf;c("innerHtml",M(1,1,n==null||n.custom==null||n.custom.custom==null||n.custom.custom.icon==null?null:n.custom.custom.icon.svg),Yi)}}function rFe(i,o){if(i&1&&w(0,"img",12),i&2){let n=l(3).ngIf;c("src",n==null||n.custom==null||n.custom.custom==null||n.custom.custom.icon==null?null:n.custom.custom.icon.url,mn)}}function aFe(i,o){if(i&1&&(g(0,oFe,2,3,"div",8),_(1,"div",9),g(2,rFe,1,1,"img",10),b()),i&2){let n=l(2).ngIf;c("ngIf",n==null||n.custom==null||n.custom.custom==null||n.custom.custom.icon==null?null:n.custom.custom.icon.svg),m(2),c("ngIf",n==null||n.custom==null||n.custom.custom==null||n.custom.custom.icon==null?null:n.custom.custom.icon.url)}}function sFe(i,o){i&1&&(_(0,"div",13),le(),_(1,"svg",14),w(2,"path",15),b()())}function lFe(i,o){if(i&1&&(f(0),g(1,nFe,4,3,"ng-container",5)(2,iFe,1,2,"ng-template",null,0,Ee)(4,aFe,3,2,"ng-template",null,1,Ee)(6,sFe,3,0,"ng-template",null,2,Ee),v()),i&2){let n=l().ngIf,e=l();m(),c("veltDynamicTemplate",$(3,KNe,e.template,A(1,nde,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function cFe(i,o){if(i&1&&(f(0),g(1,lFe,8,9,"ng-container",4),v()),i&2){let n=l();m(),c("veltIf",k(3,YNe,n.conditionSignal(),A(1,nde,n.componentConfigSignal)))}}var Ab=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,super.initializeComponentConfigSignal(new $d)}ngOnInit(){try{super.ngOnInit()}catch(e){this.loggingService.catch("Error in AutocompleteChipTooltipIconComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in AutocompleteChipTooltipIconComponent ngOnDestroy:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["velt-autocomplete-chip-tooltip-icon-internal"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[["contactAvatarRef",""],["customIconRef",""],["groupIconRef",""],[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[4,"ngTemplateOutlet"],[1,"comment-dialog-user-avatar",3,"size","user"],["class","velt-autocomplete-chip-tooltip--icon-svg",3,"innerHtml",4,"ngIf"],[1,"velt-autocomplete-chip-tooltip--icon-img"],[3,"src",4,"ngIf"],[1,"velt-autocomplete-chip-tooltip--icon-svg",3,"innerHtml"],[3,"src"],[1,"velt-autocomplete-chip-tooltip--group-icon","velt-autocomplete-chip-tooltip--icon-svg"],["xmlns","http://www.w3.org/2000/svg","fill","rgb(233, 242, 255)","width","16","height","16","viewBox","0 0 16 16",1,"bi","bi-people-fill"],["d","M7 14s-1 0-1-1 1-4 5-4 5 3 5 4-1 1-1 1zm4-6a3 3 0 1 0 0-6 3 3 0 0 0 0 6m-5.784 6A2.24 2.24 0 0 1 5 13c0-1.355.68-2.75 1.936-3.72A6.3 6.3 0 0 0 5 9c-4 0-5 3-5 4s1 1 1 1zM4.5 8a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5"]],template:function(t,r){t&1&&g(0,cFe,2,6,"ng-container",3),t&2&&c("ngIf",r.componentConfigSignal())},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-autocomplete-chip-tooltip--group-icon[_ngcontent-%COMP%]{width:100%;height:100%;padding:var(--velt-spacing-xs);display:flex;align-items:center;justify-content:center;background:linear-gradient(0deg,#ffffff0a,#ffffff0a),linear-gradient(0deg,#3772ff14,#3772ff14);box-sizing:border-box}.velt-autocomplete-chip-tooltip--icon-svg[_ngcontent-%COMP%]{display:flex;width:100%;height:100%;align-items:center;justify-content:center;color:var(--velt-text-0)}.velt-autocomplete-chip-tooltip--icon-img[_ngcontent-%COMP%]{display:flex;width:100%;height:100%;align-items:center;justify-content:center}.velt-autocomplete-chip-tooltip--icon-img[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:16px;height:16px;object-fit:cover}"],changeDetection:0});let i=o;return i})();var ide=i=>({componentConfigSignal:i}),dFe=(i,o)=>({condition:i,data:o}),mFe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-autocomplete-chip-tooltip-name-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function pFe(i,o){i&1&&Ve(0)}function gFe(i,o){if(i&1&&(f(0),g(1,pFe,1,0,"ng-container",6),v()),i&2){l(2);let n=ce(3);m(),c("ngTemplateOutlet",n)}}function uFe(i,o){i&1&&Ve(0)}function hFe(i,o){if(i&1&&(f(0),g(1,uFe,1,0,"ng-container",6),v()),i&2){l(2);let n=ce(5);m(),c("ngTemplateOutlet",n)}}function fFe(i,o){i&1&&Ve(0)}function vFe(i,o){if(i&1&&(f(0),g(1,fFe,1,0,"ng-container",6),v()),i&2){l(2);let n=ce(7);m(),c("ngTemplateOutlet",n)}}function CFe(i,o){if(i&1&&(f(0),g(1,gFe,2,1,"ng-container",3)(2,hFe,2,1,"ng-container",3)(3,vFe,2,1,"ng-container",3),v()),i&2){let n=l(2).ngIf;m(),c("ngIf",(n==null?null:n.type)==="contact"),m(),c("ngIf",(n==null?null:n.type)==="custom"),m(),c("ngIf",(n==null?null:n.type)==="group")}}function _Fe(i,o){if(i&1&&(ee(0),P(1,"translate")),i&2){let n=l(2).ngIf;Ce(" ",M(1,1,n==null||n.contact==null?null:n.contact.name)," ")}}function yFe(i,o){if(i&1&&(ee(0),P(1,"translate")),i&2){let n=l(2).ngIf;Ce(" ",M(1,1,n==null||n.custom==null||n.custom.custom==null?null:n.custom.custom.name)," ")}}function SFe(i,o){if(i&1&&(ee(0),P(1,"translate")),i&2){let n=l(2).ngIf;Ce(" ",M(1,1,(n==null||n.group==null||n.group.group==null||n.group.group.metadata==null?null:n.group.group.metadata.groupName)||(n==null||n.group==null?null:n.group.text))," ")}}function bFe(i,o){if(i&1&&(f(0),g(1,CFe,4,3,"ng-container",5)(2,_Fe,2,3,"ng-template",null,0,Ee)(4,yFe,2,3,"ng-template",null,1,Ee)(6,SFe,2,3,"ng-template",null,2,Ee),v()),i&2){let n=l().ngIf,e=l();m(),c("veltDynamicTemplate",$(3,mFe,e.template,A(1,ide,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function IFe(i,o){if(i&1&&(f(0),g(1,bFe,8,9,"ng-container",4),v()),i&2){let n=l();m(),c("veltIf",k(3,dFe,n.conditionSignal(),A(1,ide,n.componentConfigSignal)))}}var Pb=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,super.initializeComponentConfigSignal(new $d)}ngOnInit(){try{super.ngOnInit()}catch(e){this.loggingService.catch("Error in AutocompleteChipTooltipIconComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in AutocompleteChipTooltipIconComponent ngOnDestroy:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["velt-autocomplete-chip-tooltip-name-internal"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[["contactNameRef",""],["customNameRef",""],["groupNameRef",""],[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[4,"ngTemplateOutlet"]],template:function(t,r){t&1&&g(0,IFe,2,6,"ng-container",3),t&2&&c("ngIf",r.componentConfigSignal())},encapsulation:2,changeDetection:0});let i=o;return i})();var ode=i=>({componentConfigSignal:i}),EFe=(i,o)=>({condition:i,data:o}),xFe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-autocomplete-chip-tooltip-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function TFe(i,o){i&1&&Ve(0)}function DFe(i,o){if(i&1&&(_(0,"velt-shadow-dom-internal"),g(1,TFe,1,0,"ng-container",4),b()),i&2){l();let n=ce(3);m(),c("ngTemplateOutlet",n)}}function wFe(i,o){if(i&1&&(_(0,"div",6)(1,"div",7),w(2,"velt-autocomplete-chip-tooltip-icon-internal",8),b(),_(3,"div",9)(4,"div",10),w(5,"velt-autocomplete-chip-tooltip-name-internal",8),b(),_(6,"div",11),w(7,"velt-autocomplete-chip-tooltip-description-internal",8),b()()()),i&2){let n=l(4);m(2),c("componentConfigSignal",n.componentConfigSignal),m(3),c("componentConfigSignal",n.componentConfigSignal),m(2),c("componentConfigSignal",n.componentConfigSignal)}}function OFe(i,o){if(i&1&&g(0,wFe,8,3,"div",5),i&2){let n=l(2).ngIf,e=l();c("veltDynamicTemplate",$(3,xFe,e.template,A(1,ode,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function AFe(i,o){if(i&1&&(f(0),g(1,DFe,2,1,"velt-shadow-dom-internal",3)(2,OFe,1,9,"ng-template",null,0,Ee),v()),i&2){let n=ce(3),e=l(2);m(),c("ngIf",e.shadowDom&&!e.template)("ngIfElse",n)}}function PFe(i,o){if(i&1&&(f(0),g(1,AFe,4,2,"ng-container",2),v()),i&2){let n=l();m(),c("veltIf",k(3,EFe,n.conditionSignal(),A(1,ode,n.componentConfigSignal)))}}var y0=(()=>{let o=class o extends Je{constructor(e,t,r,a,s){super(r,a,void 0,void 0,void 0,s,e),this.loggingService=e,this.wireframeService=t,this.elementRef=r,this.themeService=a,this.dynamicDataService=s,this.shadowDom=!1,this.subscriptions=[],super.initializeComponentConfigSignal(new $d)}ngOnInit(){try{super.ngOnInit(),this.loggingService.log("%c[WB] Calling FUNCTION: ngOnInit","color: green;"),this.subscriptions.push(this.wireframeService.getWireframe$("velt-autocomplete-chip-tooltip-wireframe").subscribe(t=>{if(t){let r=document.createElement(t.tagName);r.innerHTML=t.innerHTML,this.template=r}}))}catch(e){this.loggingService.catch("Error in AutocompleteChipTooltipComponent OnInit: ",e)}}ngOnDestroy(){try{super.ngOnDestroy(),this.subscriptions.forEach(e=>{e.unsubscribe()})}catch{}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(He),h(R),h(qe),h(S))},o.\u0275cmp=O({type:o,selectors:[["velt-autocomplete-chip-tooltip-internal"]],inputs:{shadowDom:"shadowDom",variant:"variant"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[["tooltipContainerRef",""],[4,"ngIf"],[4,"veltIf"],[4,"ngIf","ngIfElse"],[4,"ngTemplateOutlet"],["class","velt-autocomplete-chip-tooltip",4,"veltDynamicTemplate"],[1,"velt-autocomplete-chip-tooltip"],[1,"velt-autocomplete-chip-tooltip--icon"],[3,"componentConfigSignal"],[1,"velt-autocomplete-chip-tooltip--content"],[1,"velt-autocomplete-chip-tooltip--name"],[1,"velt-autocomplete-chip-tooltip--description"]],template:function(t,r){t&1&&g(0,PFe,2,6,"ng-container",1),t&2&&c("ngIf",r.componentConfigSignal())},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-autocomplete-chip-tooltip[_ngcontent-%COMP%]{display:flex;background:var(--velt-background-0);border-radius:var(--velt-border-radius-sm);padding:var(--velt-spacing-md);margin:var(--velt-spacing-xs) 0;box-shadow:0 4px 21px #00000014;gap:var(--velt-spacing-md);max-width:256px;line-height:1.3;align-items:center}.velt-autocomplete-chip-tooltip[_ngcontent-%COMP%] .velt-autocomplete-chip-tooltip--icon[_ngcontent-%COMP%]{width:32px;height:32px;border-radius:var(--velt-border-radius-full);overflow:hidden;flex-shrink:0}.velt-autocomplete-chip-tooltip[_ngcontent-%COMP%] .velt-autocomplete-chip-tooltip--icon[_ngcontent-%COMP%] snippyly-user-avatar[_ngcontent-%COMP%]{display:flex}.velt-autocomplete-chip-tooltip[_ngcontent-%COMP%] .velt-autocomplete-chip-tooltip--icon[_ngcontent-%COMP%] .velt-autocomplete-chip-tooltip--icon-svg[_ngcontent-%COMP%]{width:100%;height:100%;padding:var(--velt-spacing-xs);display:flex;align-items:center;justify-content:center;background:linear-gradient(0deg,#ffffff0a,#ffffff0a),linear-gradient(0deg,#3772ff14,#3772ff14);box-sizing:border-box}.velt-autocomplete-chip-tooltip[_ngcontent-%COMP%] .velt-autocomplete-chip-tooltip--icon[_ngcontent-%COMP%] .velt-autocomplete-chip-tooltip--icon-svg[_ngcontent-%COMP%] svg[_ngcontent-%COMP%]{width:100%;height:100%}.velt-autocomplete-chip-tooltip[_ngcontent-%COMP%] .velt-autocomplete-chip-tooltip--icon[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%;object-fit:cover}.velt-autocomplete-chip-tooltip[_ngcontent-%COMP%] .velt-autocomplete-chip-tooltip--content[_ngcontent-%COMP%]{display:flex;flex-direction:column}.velt-autocomplete-chip-tooltip[_ngcontent-%COMP%] .velt-autocomplete-chip-tooltip--content[_ngcontent-%COMP%] .velt-autocomplete-chip-tooltip--name[_ngcontent-%COMP%]{font-size:var(--velt-font-size-sm);font-weight:400;line-height:21px;text-align:left;word-break:break-word;color:var(--velt-text-0)}.velt-autocomplete-chip-tooltip[_ngcontent-%COMP%] .velt-autocomplete-chip-tooltip--content[_ngcontent-%COMP%] .velt-autocomplete-chip-tooltip--description[_ngcontent-%COMP%]{font-size:var(--velt-font-size-xs);font-weight:400;line-height:17px;letter-spacing:.01em;text-align:left;color:var(--velt-text-5);word-break:break-word}"],changeDetection:0});let i=o;return i})();var Ps=class{constructor(){this.onOptionClick=()=>{},this.newUserContactError=void 0,this.newUserContact=void 0,this.expandMentionGroups=!1,this.showMentionGroupsFirst=!1,this.showMentionGroupsOnly=!1}};var Dz=i=>({$implicit:i}),kFe=(i,o)=>({componentConfigSignal:i,userContact:o}),wz=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-autocomplete-option-description-wireframe",variant:n,setIfCondition:e,componentElementRef:t}),RFe=(i,o)=>({componentConfigSignal:i,custom:o}),NFe=(i,o)=>({componentConfigSignal:i,group:o}),rde=()=>({});function FFe(i,o){i&1&&Ve(0)}function LFe(i,o){if(i&1&&(f(0),g(1,FFe,1,0,"ng-container",4),v()),i&2){l();let n=ce(5),e=l();m(),c("ngTemplateOutlet",n)("ngTemplateOutletContext",A(2,Dz,e.selectorItem==null?null:e.selectorItem.contact))}}function BFe(i,o){i&1&&Ve(0)}function VFe(i,o){if(i&1&&(f(0),g(1,BFe,1,0,"ng-container",4),v()),i&2){l();let n=ce(7),e=l();m(),c("ngTemplateOutlet",n)("ngTemplateOutletContext",A(2,Dz,e.selectorItem==null?null:e.selectorItem.custom))}}function UFe(i,o){i&1&&Ve(0)}function jFe(i,o){if(i&1&&(f(0),g(1,UFe,1,0,"ng-container",4),v()),i&2){l();let n=ce(9),e=l();m(),c("ngTemplateOutlet",n)("ngTemplateOutletContext",A(2,Dz,e.selectorItem==null?null:e.selectorItem.group))}}function $Fe(i,o){if(i&1&&(_(0,"p",6),ee(1),P(2,"translate"),b()),i&2){let n=l(2).$implicit,e=l(2);ue("velt-autocomplete-option-description--secondary",(n.name==null?null:n.name.length)>0),x("aria-label",e.field?n[e.field]:n.email),m(),Ce(" ",e.field?n[e.field]:M(2,4,n.email)," ")}}function HFe(i,o){if(i&1&&(f(0),g(1,$Fe,3,6,"p",5),v()),i&2){let n=l().$implicit,e=l().ngIf,t=l();m(),c("veltDynamicTemplate",$(4,wz,t.template,k(1,kFe,t.componentConfigSignal,n),e==null?null:e.variant,t.setIfCondition.bind(t),t.elementRef))}}function zFe(i,o){if(i&1&&g(0,HFe,2,10,"ng-container",3),i&2){let n=o.$implicit,e=l(2);c("ngIf",e.field?n==null?null:n[e.field]:(n.email==null?null:n.email.length)>0&&(n.name==null?null:n.name.length)>0)}}function GFe(i,o){if(i&1&&(_(0,"p",6),ee(1),P(2,"translate"),b()),i&2){let n=l(2).$implicit;x("aria-label",n.description),m(),Ce(" ",M(2,2,n.description)," ")}}function WFe(i,o){if(i&1&&(f(0),g(1,GFe,3,4,"p",7),v()),i&2){let n=l().$implicit,e=l().ngIf,t=l();m(),c("veltDynamicTemplate",$(4,wz,t.template,k(1,RFe,t.componentConfigSignal,n),e==null?null:e.variant,t.setIfCondition.bind(t),t.elementRef))}}function qFe(i,o){if(i&1&&g(0,WFe,2,10,"ng-container",3),i&2){let n=o.$implicit;c("ngIf",(n.description==null?null:n.description.length)>0)}}function YFe(i,o){if(i&1&&(_(0,"p",6),ee(1),P(2,"translate"),b()),i&2){let n,e,t=l().$implicit,r=l(2);x("aria-label",((n=r.objectKeys((t==null?null:t.users)||Ot(5,rde)))==null?null:n.length)+" members"),m(),hr(" ",(e=r.objectKeys((t==null?null:t.users)||Ot(6,rde)))==null?null:e.length," ",M(2,3,"members")," ")}}function KFe(i,o){if(i&1&&(f(0),g(1,YFe,3,7,"p",7),v()),i&2){let n=o.$implicit,e=l().ngIf,t=l();m(),c("veltDynamicTemplate",$(4,wz,t.template,k(1,NFe,t.componentConfigSignal,n),e==null?null:e.variant,t.setIfCondition.bind(t),t.elementRef))}}function ZFe(i,o){if(i&1&&(f(0),g(1,LFe,2,4,"ng-container",3)(2,VFe,2,4,"ng-container",3)(3,jFe,2,4,"ng-container",3)(4,zFe,1,1,"ng-template",null,0,Ee)(6,qFe,1,1,"ng-template",null,1,Ee)(8,KFe,2,10,"ng-template",null,2,Ee),v()),i&2){let n=l();m(),c("ngIf",(n.selectorItem==null?null:n.selectorItem.type)==="contact"),m(),c("ngIf",(n.selectorItem==null?null:n.selectorItem.type)==="custom"),m(),c("ngIf",(n.selectorItem==null?null:n.selectorItem.type)==="group")}}var Mb=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.objectKeys=Object.keys,this.componentId="velt-autocomplete-option-description",super.initializeComponentConfigSignal(new Ps)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,selectorItem:this.selectorItem}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in AutocompleteOptionDescriptionComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in AutocompleteOptionDescriptionComponent 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 AutocompleteOptionDescriptionComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["velt-autocomplete-option-description-internal"]],inputs:{selectorItem:"selectorItem",field:"field"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[["contactEmailRef",""],["customDescriptionRef",""],["groupDescriptionRef",""],[4,"ngIf"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],["class","line-height-1 velt-autocomplete-option-description",3,"velt-autocomplete-option-description--secondary",4,"veltDynamicTemplate"],[1,"line-height-1","velt-autocomplete-option-description"],["class","line-height-1 velt-autocomplete-option-description",4,"veltDynamicTemplate"]],template:function(t,r){t&1&&g(0,ZFe,10,3,"ng-container",3),t&2&&c("ngIf",r.componentConfigSignal())},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:block}.velt-autocomplete-option-description[_ngcontent-%COMP%]{overflow:hidden;text-overflow:ellipsis;color:var(--velt-text-8);font-size:var(--velt-font-size-xs);margin:0;line-height:18px}"],changeDetection:0});let i=o;return i})();var XFe=i=>({$implicit:i}),QFe=(i,o,n)=>({componentConfigSignal:i,isNewContact:o,userContact:n}),JFe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-autocomplete-option-error-icon-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function eLe(i,o){i&1&&Ve(0)}function tLe(i,o){if(i&1&&(f(0),g(1,eLe,1,0,"ng-container",2),v()),i&2){l();let n=ce(3),e=l();m(),c("ngTemplateOutlet",n)("ngTemplateOutletContext",A(2,XFe,e.selectorItem==null?null:e.selectorItem.contact))}}function nLe(i,o){if(i&1&&(_(0,"div",6)(1,"div",7),le(),_(2,"svg",8),w(3,"path",9)(4,"path",10),b()()()),i&2){let n=l(3).ngIf,e=l();m(),c("title",n.newUserContactError),x("title",n.newUserContactError)("data-testid",e.componentId+"-icon"),m(),x("data-testid",e.componentId+"-svg")}}function iLe(i,o){if(i&1&&(_(0,"div",4),P(1,"translate"),g(2,nLe,5,4,"div",5),b()),i&2){let n=l().$implicit,e=l().ngIf,t=l();x("aria-label",M(1,3,(e==null?null:e.newUserContactError)||"Invalid contact"))("data-testid",t.componentId),m(2),c("veltDynamicTemplate",$(9,JFe,t.template,$e(5,QFe,t.componentConfigSignal,t.isNewContact,n),e==null?null:e.variant,t.setIfCondition.bind(t),t.elementRef))}}function oLe(i,o){if(i&1&&g(0,iLe,3,15,"div",3),i&2){let n=l().ngIf,e=l();c("ngIf",e.isNewContact&&n.newUserContactError)}}function rLe(i,o){if(i&1&&(f(0),g(1,tLe,2,4,"ng-container",1)(2,oLe,1,1,"ng-template",null,0,Ee),v()),i&2){let n=l();m(),c("ngIf",(n.selectorItem==null?null:n.selectorItem.type)==="contact")}}var kb=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-autocomplete-error-icon",super.initializeComponentConfigSignal(new Ps)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,selectorItem:this.selectorItem,isNewContact:this.isNewContact}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in AutocompleteOptionErrorIconComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in AutocompleteOptionErrorIconComponent 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 AutocompleteOptionErrorIconComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["velt-autocomplete-option-error-icon-internal"]],inputs:{selectorItem:"selectorItem",isNewContact:"isNewContact"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[["errorIconRef",""],[4,"ngIf"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],["role","alert",4,"ngIf"],["role","alert"],["class","velt-autocomplete-option-error-icon",4,"veltDynamicTemplate"],[1,"velt-autocomplete-option-error-icon"],[1,"s-flex",3,"title"],["xmlns","http://www.w3.org/2000/svg","width","16","height","16","fill","currentColor","viewBox","0 0 16 16","aria-hidden","true","focusable","false",1,"bi","bi-exclamation-triangle"],["fill","red","d","M7.938 2.016A.13.13 0 0 1 8.002 2a.13.13 0 0 1 .063.016.146.146 0 0 1 .054.057l6.857 11.667c.036.06.035.124.002.183a.163.163 0 0 1-.054.06.116.116 0 0 1-.066.017H1.146a.115.115 0 0 1-.066-.017.163.163 0 0 1-.054-.06.176.176 0 0 1 .002-.183L7.884 2.073a.147.147 0 0 1 .054-.057zm1.044-.45a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566z"],["fill","red","d","M7.002 12a1 1 0 1 1 2 0 1 1 0 0 1-2 0zM7.1 5.995a.905.905 0 1 1 1.8 0l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995z"]],template:function(t,r){t&1&&g(0,rLe,4,1,"ng-container",1),t&2&&c("ngIf",r.componentConfigSignal())},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-autocomplete-option-error-icon[_ngcontent-%COMP%]{margin-inline:var(--velt-spacing-lg)}.velt-autocomplete-option-error-icon[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{background-color:transparent;border:none;padding:0;margin:0;cursor:pointer;outline:none;color:var(--velt-text-1)}"],changeDetection:0});let i=o;return i})();var aLe=(i,o)=>({componentConfigSignal:i,selectorItem:o}),sLe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-autocomplete-option-icon-wireframe",variant:n,setIfCondition:e,componentElementRef:t}),Oz=i=>({$implicit:i});function lLe(i,o){i&1&&Ve(0)}function cLe(i,o){if(i&1&&(f(0),g(1,lLe,1,0,"ng-container",7),v()),i&2){l(2);let n=ce(3),e=l();m(),c("ngTemplateOutlet",n)("ngTemplateOutletContext",A(2,Oz,e.selectorItem==null?null:e.selectorItem.contact))}}function dLe(i,o){i&1&&Ve(0)}function mLe(i,o){if(i&1&&(f(0),g(1,dLe,1,0,"ng-container",7),v()),i&2){l(2);let n=ce(5),e=l();m(),c("ngTemplateOutlet",n)("ngTemplateOutletContext",A(2,Oz,e.selectorItem==null?null:e.selectorItem.custom))}}function pLe(i,o){i&1&&Ve(0)}function gLe(i,o){if(i&1&&(f(0),g(1,pLe,1,0,"ng-container",7),v()),i&2){l(2);let n=ce(7),e=l();m(),c("ngTemplateOutlet",n)("ngTemplateOutletContext",A(2,Oz,e.selectorItem==null?null:e.selectorItem.group))}}function uLe(i,o){if(i&1&&(_(0,"div",6),g(1,cLe,2,4,"ng-container",4)(2,mLe,2,4,"ng-container",4)(3,gLe,2,4,"ng-container",4),b()),i&2){let n=l(2);x("data-testid",n.componentId)("aria-label","Option icon"),m(),c("ngIf",(n.selectorItem==null?null:n.selectorItem.type)==="contact"),m(),c("ngIf",(n.selectorItem==null?null:n.selectorItem.type)==="custom"),m(),c("ngIf",(n.selectorItem==null?null:n.selectorItem.type)==="group")}}function hLe(i,o){if(i&1&&(f(0),le(),_(1,"svg",9),w(2,"path",10),b(),v()),i&2){let n=l(3);m(),x("data-testid",n.componentId+"-contact-at")}}function fLe(i,o){if(i&1&&w(0,"snippyly-user-avatar",11),i&2){let n=l().$implicit,e=l(2);c("size",32)("user",n),x("data-testid",e.componentId+"-contact-avatar")}}function vLe(i,o){if(i&1&&g(0,hLe,3,1,"ng-container",8)(1,fLe,1,3,"ng-template",null,3,Ee),i&2){let n=o.$implicit,e=ce(2);c("ngIf",(n==null?null:n.visibility)==="here")("ngIfElse",e)}}function CLe(i,o){if(i&1&&(f(0),w(1,"div",12),P(2,"safeSvg"),v()),i&2){let n=l().$implicit,e=l(2);m(),c("innerHTML",M(2,2,n.icon.svg),Yi),x("data-testid",e.componentId+"-custom-svg")}}function _Le(i,o){if(i&1&&(f(0),w(1,"img",13),v()),i&2){let n=l().$implicit,e=l(2);m(),c("src",n.icon.url,mn),x("alt",(n==null?null:n.description)||"Custom icon")("data-testid",e.componentId+"-custom-img")}}function yLe(i,o){if(i&1&&g(0,CLe,3,4,"ng-container",4)(1,_Le,2,3,"ng-container",4),i&2){let n=o.$implicit;c("ngIf",n==null||n.icon==null?null:n.icon.svg),m(),c("ngIf",n==null||n.icon==null?null:n.icon.url)}}function SLe(i,o){if(i&1&&(le(),_(0,"svg",14),w(1,"path",15),b()),i&2){let n=l(2);x("data-testid",n.componentId+"-group-icon")}}function bLe(i,o){if(i&1&&(f(0),g(1,uLe,4,5,"div",5)(2,vLe,3,2,"ng-template",null,0,Ee)(4,yLe,2,2,"ng-template",null,1,Ee)(6,SLe,2,1,"ng-template",null,2,Ee),v()),i&2){let n=o.ngIf,e=l();m(),c("veltDynamicTemplate",$(4,sLe,e.template,k(1,aLe,e.componentConfigSignal,e.selectorItem),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}var Rb=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-autocomplete-icon",super.initializeComponentConfigSignal(new Ps)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,selectorItem:this.selectorItem}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in AutocompleteOptionIconComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in AutocompleteOptionIconComponent 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 AutocompleteOptionIconComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["velt-autocomplete-option-icon-internal"]],inputs:{selectorItem:"selectorItem"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[["contactAvatarRef",""],["customAvatarRef",""],["groupAvatarRef",""],["defaultAvatarRef",""],[4,"ngIf"],["class","velt-autocomplete-option-icon","role","img",4,"veltDynamicTemplate"],["role","img",1,"velt-autocomplete-option-icon"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],[4,"ngIf","ngIfElse"],["xmlns","http://www.w3.org/2000/svg","width","24","height","24","fill","none","viewBox","0 0 16 16","aria-hidden","true","focusable","false",1,"bi","bi-at"],["fill","currentColor","d","M13.106 7.222c0-2.967-2.249-5.032-5.482-5.032-3.35 0-5.646 2.318-5.646 5.702 0 3.493 2.235 5.708 5.762 5.708.862 0 1.689-.123 2.304-.335v-.862c-.43.199-1.354.328-2.29.328-2.926 0-4.813-1.88-4.813-4.798 0-2.844 1.921-4.881 4.594-4.881 2.735 0 4.608 1.688 4.608 4.156 0 1.682-.554 2.769-1.416 2.769-.492 0-.772-.28-.772-.76V5.206H8.923v.834h-.11c-.266-.595-.881-.964-1.6-.964-1.4 0-2.378 1.162-2.378 2.823 0 1.737.957 2.906 2.379 2.906.8 0 1.415-.39 1.709-1.087h.11c.081.67.703 1.148 1.503 1.148 1.572 0 2.57-1.415 2.57-3.643zm-7.177.704c0-1.197.54-1.907 1.456-1.907.93 0 1.524.738 1.524 1.907S8.308 9.84 7.371 9.84c-.895 0-1.442-.725-1.442-1.914z"],[3,"size","user"],[1,"velt-autocomplete-option-icon--custom-svg",3,"innerHTML"],[1,"velt-autocomplete-option-icon--custom-img",3,"src"],["xmlns","http://www.w3.org/2000/svg","width","16","height","16","fill","currentColor","viewBox","0 0 16 16","aria-hidden","true","focusable","false",1,"bi","bi-people-fill"],["d","M7 14s-1 0-1-1 1-4 5-4 5 3 5 4-1 1-1 1zm4-6a3 3 0 1 0 0-6 3 3 0 0 0 0 6m-5.784 6A2.24 2.24 0 0 1 5 13c0-1.355.68-2.75 1.936-3.72A6.3 6.3 0 0 0 5 9c-4 0-5 3-5 4s1 1 1 1zM4.5 8a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5"]],template:function(t,r){t&1&&g(0,bLe,8,10,"ng-container",4),t&2&&c("ngIf",r.componentConfigSignal())},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-autocomplete-option-icon--placeholder[_ngcontent-%COMP%]{z-index:2;opacity:.8}.velt-autocomplete-option-icon[_ngcontent-%COMP%]{min-width:calc((2.25rem + 0px) * var(--velt-base-rem-unit));width:calc((2.25rem + 0px) * var(--velt-base-rem-unit));min-height:calc((2.25rem + 0px) * var(--velt-base-rem-unit));height:calc((2.25rem + 0px) * var(--velt-base-rem-unit));box-sizing:border-box;background-clip:padding-box;border:solid 2px transparent;display:flex;align-items:center;justify-content:center;position:relative;margin-right:var(--velt-spacing-md)}.velt-autocomplete-option-icon[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%;border-radius:var(--velt-border-radius-full);z-index:2;object-fit:cover}.velt-autocomplete-option-icon[_ngcontent-%COMP%]:before{content:"";position:absolute;inset:0;z-index:1;border-radius:inherit;background:inherit}.velt-autocomplete-option-icon[_ngcontent-%COMP%] svg[_ngcontent-%COMP%]{color:var(--velt-text-1)}'],changeDetection:0});let i=o;return i})();var Az=i=>({$implicit:i}),ILe=(i,o)=>({componentConfigSignal:i,userContact:o}),Pz=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-autocomplete-option-name-wireframe",variant:n,setIfCondition:e,componentElementRef:t}),ELe=(i,o)=>({componentConfigSignal:i,custom:o}),xLe=(i,o)=>({componentConfigSignal:i,group:o});function TLe(i,o){i&1&&Ve(0)}function DLe(i,o){if(i&1&&(f(0),g(1,TLe,1,0,"ng-container",5),v()),i&2){l();let n=ce(5),e=l();m(),c("ngTemplateOutlet",n)("ngTemplateOutletContext",A(2,Az,e.selectorItem==null?null:e.selectorItem.contact))}}function wLe(i,o){i&1&&Ve(0)}function OLe(i,o){if(i&1&&(f(0),g(1,wLe,1,0,"ng-container",5),v()),i&2){l();let n=ce(7),e=l();m(),c("ngTemplateOutlet",n)("ngTemplateOutletContext",A(2,Az,e.selectorItem==null?null:e.selectorItem.custom))}}function ALe(i,o){i&1&&Ve(0)}function PLe(i,o){if(i&1&&(f(0),g(1,ALe,1,0,"ng-container",5),v()),i&2){l();let n=ce(9),e=l();m(),c("ngTemplateOutlet",n)("ngTemplateOutletContext",A(2,Az,e.selectorItem==null?null:e.selectorItem.group))}}function MLe(i,o){if(i&1&&(_(0,"p",8),ee(1),P(2,"translate"),b()),i&2){let n=l(2).$implicit,e=l(2);x("data-testid",e.componentId+"-contact-text")("aria-label",n.name||n.email),m(),Ce(" ",M(2,3,n.name||n.email)," ")}}function kLe(i,o){if(i&1&&(f(0),g(1,MLe,3,5,"p",7),v()),i&2){let n=l().$implicit,e=l().ngIf,t=l();m(),c("veltDynamicTemplate",$(4,Pz,t.template,k(1,ILe,t.componentConfigSignal,n),e==null?null:e.variant,t.setIfCondition.bind(t),t.elementRef))}}function RLe(i,o){i&1&&w(0,"velt-skeleton-loader-internal",9)}function NLe(i,o){if(i&1&&g(0,kLe,2,10,"ng-container",6)(1,RLe,1,0,"ng-template",null,3,Ee),i&2){let n=o.$implicit,e=ce(2);c("ngIf",(n.name==null?null:n.name.length)>0||(n==null||n.email==null?null:n.email.length)>0)("ngIfElse",e)}}function FLe(i,o){if(i&1&&(_(0,"p",8),ee(1),P(2,"translate"),b()),i&2){let n=l(2).$implicit,e=l(2);x("data-testid",e.componentId+"-custom-text")("aria-label",n.name),m(),Ce(" ",M(2,3,n.name)," ")}}function LLe(i,o){if(i&1&&(f(0),g(1,FLe,3,5,"p",7),v()),i&2){let n=l().$implicit,e=l().ngIf,t=l();m(),c("veltDynamicTemplate",$(4,Pz,t.template,k(1,ELe,t.componentConfigSignal,n),e==null?null:e.variant,t.setIfCondition.bind(t),t.elementRef))}}function BLe(i,o){if(i&1&&g(0,LLe,2,10,"ng-container",4),i&2){let n=o.$implicit;c("ngIf",(n.name==null?null:n.name.length)>0)}}function VLe(i,o){if(i&1&&(_(0,"p",8),ee(1),P(2,"translate"),b()),i&2){let n=l(2).$implicit,e=l(2);x("data-testid",e.componentId+"-group-text")("aria-label",n==null||n.metadata==null?null:n.metadata.groupName),m(),Ce(" ",M(2,3,n==null||n.metadata==null?null:n.metadata.groupName)," ")}}function ULe(i,o){if(i&1&&(f(0),g(1,VLe,3,5,"p",7),v()),i&2){let n=l().$implicit,e=l().ngIf,t=l();m(),c("veltDynamicTemplate",$(4,Pz,t.template,k(1,xLe,t.componentConfigSignal,n),e==null?null:e.variant,t.setIfCondition.bind(t),t.elementRef))}}function jLe(i,o){if(i&1&&g(0,ULe,2,10,"ng-container",4),i&2){let n=o.$implicit;c("ngIf",(n==null||n.metadata==null||n.metadata.groupName==null?null:n.metadata.groupName.length)>0)}}function $Le(i,o){if(i&1&&(f(0),g(1,DLe,2,4,"ng-container",4)(2,OLe,2,4,"ng-container",4)(3,PLe,2,4,"ng-container",4)(4,NLe,3,2,"ng-template",null,0,Ee)(6,BLe,1,1,"ng-template",null,1,Ee)(8,jLe,1,1,"ng-template",null,2,Ee),v()),i&2){let n=l();m(),c("ngIf",(n.selectorItem==null?null:n.selectorItem.type)==="contact"),m(),c("ngIf",(n.selectorItem==null?null:n.selectorItem.type)==="custom"),m(),c("ngIf",(n.selectorItem==null?null:n.selectorItem.type)==="group")}}var Nb=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-autocomplete-name",super.initializeComponentConfigSignal(new Ps)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,selectorItem:this.selectorItem}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in AutocompleteOptionNameComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in AutocompleteOptionNameComponent 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 AutocompleteOptionNameComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["velt-autocomplete-option-name-internal"]],inputs:{selectorItem:"selectorItem"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[["contactNameRef",""],["customNameRef",""],["groupNameRef",""],["loadingTemplateRef",""],[4,"ngIf"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],[4,"ngIf","ngIfElse"],["class","line-height-1 velt-autocomplete-option-name","role","option",4,"veltDynamicTemplate"],["role","option",1,"line-height-1","velt-autocomplete-option-name"],["height","21px","width","80px","borderRadius","20px"]],template:function(t,r){t&1&&g(0,$Le,10,3,"ng-container",4),t&2&&c("ngIf",r.componentConfigSignal())},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-autocomplete-option-name[_ngcontent-%COMP%]{overflow:hidden;text-overflow:ellipsis;color:var(--velt-text-1);font-size:var(--velt-font-size-sm);margin:0;line-height:21px}"],changeDetection:0});let i=o;return i})();var HLe=(i,o,n)=>({componentConfigSignal:i,isNewContact:o,selectorItem:n}),zLe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-autocomplete-option-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function GLe(i,o){if(i&1&&(_(0,"div",2),w(1,"velt-autocomplete-option-icon-internal",3),_(2,"div",4),w(3,"velt-autocomplete-option-name-internal",3)(4,"velt-autocomplete-option-description-internal",3),b(),w(5,"velt-autocomplete-option-error-icon-internal",5),b()),i&2){let n=l().ngIf,e=l();x("data-testid",e.componentId)("aria-selected",!1)("aria-disabled",!!(n!=null&&n.newUserContactError)),m(),c("selectorItem",e.selectorItem)("componentConfigSignal",e.componentConfigSignal),m(),x("data-testid",e.componentId+"-details"),m(),c("selectorItem",e.selectorItem)("componentConfigSignal",e.componentConfigSignal),m(),c("selectorItem",e.selectorItem)("componentConfigSignal",e.componentConfigSignal),m(),c("selectorItem",e.selectorItem)("isNewContact",e.isNewContact)("componentConfigSignal",e.componentConfigSignal)}}function WLe(i,o){if(i&1&&(f(0),g(1,GLe,6,13,"div",1),v()),i&2){let n=o.ngIf,e=l();m(),c("veltDynamicTemplate",$(5,zLe,e.template,$e(1,HLe,e.componentConfigSignal,e.isNewContact,e.selectorItem),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}var S0=(()=>{let o=class o extends H{constructor(e,t,r,a){super(r,a,e),this.loggingService=e,this.wireframeService=t,this.elementRef=r,this.dynamicDataService=a,this.subscriptions=[],this.componentId="velt-autocomplete-option",super.initializeComponentConfigSignal(new Ps)}ngOnInit(){try{this.loggingService.log("%c[WB] Calling FUNCTION: ngOnInit","color: green;");let e="velt-autocomplete-option-wireframe";this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,selectorItem:this.selectorItem,isNewContact:this.isNewContact}),this.variant&&(e+=`---${this.variant}`),this.subscriptions.push(this.wireframeService.getWireframe$(e).subscribe(t=>{if(t){let r=document.createElement(t.tagName);r.innerHTML=t.innerHTML,this.template=r}})),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentBubbleComponent OnInit: ",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("role","option"),e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("aria-label",this.getOptionLabel())}catch(e){this.loggingService.catch("Error in AutocompleteOptionComponent setupA11yAttributes:",e)}}ngOnDestroy(){try{this.loggingService.log("%c[WB] Calling FUNCTION: ngOnDestroy","color: red;"),super.ngOnDestroy(),this.subscriptions.forEach(e=>e?.unsubscribe())}catch(e){this.loggingService.catch("Error in CommentBubbleComponent OnDestroy: ",e)}}getOptionLabel(){try{switch(this.selectorItem?.type){case"contact":return this.getContactLabel();case"custom":return this.selectorItem.custom?.name||"Custom option";case"group":return this.selectorItem.group?.metadata?.groupName||"Group option";default:return"Option"}}catch(e){return this.loggingService.catch("Error in AutocompleteOptionComponent getOptionLabel:",e),"Option"}}getContactLabel(){try{let e=this.selectorItem?.contact,t=e?.name||e?.email||"Contact";return this.isNewContact?`New contact: ${t}`:t}catch(e){return this.loggingService.catch("Error in AutocompleteOptionComponent getContactLabel:",e),"Contact"}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(He),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["velt-autocomplete-option-internal"]],inputs:{selectorItem:"selectorItem",isNewContact:"isNewContact",variant:"variant"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],["class","velt-autocomplete-option--container","role","option",4,"veltDynamicTemplate"],["role","option",1,"velt-autocomplete-option--container"],[3,"selectorItem","componentConfigSignal"],[1,"velt-autocomplete-option--details"],[3,"selectorItem","isNewContact","componentConfigSignal"]],template:function(t,r){t&1&&g(0,WLe,2,11,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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-autocomplete-option--container[_ngcontent-%COMP%]{display:flex;align-items:center;width:100%}.velt-autocomplete-option--details[_ngcontent-%COMP%]{overflow:hidden;flex-grow:1}"],changeDetection:0});let i=o;return i})();var rr=class{constructor(){this.isAudioPermissionOpen=!1,this.toggleAudioPermission=()=>{},this.selectAudioDevice=()=>{},this.audioDevices=[],this.isVideoPermissionOpen=!1,this.toggleVideoPermission=()=>{},this.selectVideoDevice=()=>{},this.videoDevices=[],this.shadowDom=!1,this.isOpen=!1,this.settingsEmbedded=!1,this.closeVideoDropdown=()=>{},this.closeAudioDropdown=()=>{}}};var YLe=i=>({componentConfigSignal:i}),KLe=(i,o)=>({condition:i,data:o}),ZLe=i=>({componentConfigSignal:i,type:"audio"}),XLe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-media-source-settings-audio-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function QLe(i,o){if(i&1&&(f(0),_(1,"div",5)(2,"div",6),le(),_(3,"svg",7),w(4,"path",8),b()(),pt(),w(5,"velt-media-source-settings-selected-label-internal",9)(6,"velt-media-source-settings-toggle-icon-internal",9),b(),w(7,"velt-media-source-settings-divider-internal",9)(8,"velt-media-source-settings-options-internal",9),v()),i&2){let n=l(4);m(),x("aria-hidden","true"),m(4),c("componentConfigSignal",n.componentConfigSignal)("template",n.template),x("data-testid",n.componentId+"-label"),m(),c("componentConfigSignal",n.componentConfigSignal)("template",n.template),x("data-testid",n.componentId+"-toggle"),m(),c("componentConfigSignal",n.componentConfigSignal)("template",n.template),x("data-testid",n.componentId+"-divider"),m(),c("componentConfigSignal",n.componentConfigSignal)("template",n.template),x("data-testid",n.componentId+"-options")("role","listbox")("aria-label","Audio source options")}}function JLe(i,o){if(i&1){let n=q();_(0,"div",3),P(1,"translate"),z("clickOutside",function(){N(n);let t=l(2).ngIf;return F(t.closeAudioDropdown())})("click",function(t){N(n);let r=l(2).ngIf;return F(r.toggleAudioPermission(t))}),g(2,QLe,9,15,"ng-container",4),b()}if(i&2){let n=l(2).ngIf,e=l();ue("velt-media-source-settings-audio--active",n.isAudioPermissionOpen),x("data-testid",e.componentId)("role","button")("aria-expanded",n.isAudioPermissionOpen)("aria-haspopup","listbox")("aria-label",M(1,9,"Audio settings"))("tabindex",0),m(2),c("veltDynamicTemplate",$(13,XLe,e.template,A(11,ZLe,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function eBe(i,o){if(i&1&&(f(0),g(1,JLe,3,19,"div",2),v()),i&2){let n=l().ngIf;m(),c("ngIf",n.settingsVisible==null?null:n.settingsVisible.audio)}}function tBe(i,o){if(i&1&&(f(0),g(1,eBe,2,1,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,KLe,n.conditionSignal(),A(1,YLe,n.componentConfigSignal)))}}var Fb=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.componentId="velt-media-source-settings-audio",super.initializeComponentConfigSignal(new rr)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in MediaSourceSettingsAudioComponent ngOnInit: ",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in MediaSourceSettingsAudioComponent ngOnDestroy: ",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in MediaSourceSettingsAudioComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["velt-media-source-settings-audio-internal"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["class","velt-media-source-settings-audio","snippylyClickOutside","",3,"velt-media-source-settings-audio--active","clickOutside","click",4,"ngIf"],["snippylyClickOutside","",1,"velt-media-source-settings-audio",3,"clickOutside","click"],[4,"veltDynamicTemplate"],[1,"velt-media-source-settings-audio-trigger"],[1,"velt-media-source-settings-audio-trigger-icon"],["width","16","height","16","viewBox","0 0 16 16","fill","none","xmlns","http://www.w3.org/2000/svg","focusable","false","aria-hidden","true"],["d","M3.33301 6.66732C3.33301 7.90499 3.82467 9.09198 4.69984 9.96715C5.57501 10.8423 6.762 11.334 7.99967 11.334M7.99967 11.334C9.23735 11.334 10.4243 10.8423 11.2995 9.96715C12.1747 9.09198 12.6663 7.90499 12.6663 6.66732M7.99967 11.334V14.0007M5.33301 14.0007H10.6663M5.99967 3.33398C5.99967 2.80355 6.21039 2.29484 6.58546 1.91977C6.96053 1.5447 7.46924 1.33398 7.99967 1.33398C8.53011 1.33398 9.03882 1.5447 9.41389 1.91977C9.78896 2.29484 9.99967 2.80355 9.99967 3.33398V6.66732C9.99967 7.19775 9.78896 7.70646 9.41389 8.08153C9.03882 8.4566 8.53011 8.66732 7.99967 8.66732C7.46924 8.66732 6.96053 8.4566 6.58546 8.08153C6.21039 7.70646 5.99967 7.19775 5.99967 6.66732V3.33398Z","stroke","currentColor","stroke-linecap","round","stroke-linejoin","round"],["type","audio",3,"componentConfigSignal","template"]],template:function(t,r){t&1&&g(0,tBe,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},styles:[".velt-media-source-settings-audio[_ngcontent-%COMP%]{padding:var(--velt-spacing-md);margin:var(--velt-spacing-xs);border-radius:var(--velt-border-radius-md);display:flex;flex-direction:column;align-items:center;box-sizing:border-box}.velt-media-source-settings-audio[_ngcontent-%COMP%]:hover{background:var(--velt-background-3)}.velt-media-source-settings-audio--active[_ngcontent-%COMP%]{background:var(--velt-background-2)}.velt-media-source-settings-audio-trigger[_ngcontent-%COMP%]{width:100%;display:flex;gap:var(--velt-spacing-md);align-items:center;cursor:pointer}.velt-media-source-settings-audio-trigger[_ngcontent-%COMP%] .velt-media-source-settings-audio-trigger-icon[_ngcontent-%COMP%]{padding:1px;color:var(--velt-text-3);display:flex}.velt-media-source-settings-audio-trigger[_ngcontent-%COMP%] .velt-media-source-settings-audio-trigger-icon[_ngcontent-%COMP%] svg[_ngcontent-%COMP%]{max-width:none}"],changeDetection:0});let i=o;return i})();var nBe=i=>({componentConfigSignal:i}),iBe=(i,o)=>({condition:i,data:o}),oBe=(i,o,n,e)=>({template:i,componentName:"velt-media-source-settings-divider-wireframe",variant:o,setIfCondition:n,componentElementRef:e});function rBe(i,o){if(i&1&&(f(0),w(1,"div",3),v()),i&2){let n=l(4);m(),x("data-testid",n.componentId+"-divider")("role","separator")("aria-orientation","horizontal")("aria-hidden","true")}}function aBe(i,o){if(i&1&&(_(0,"div"),g(1,rBe,2,4,"ng-container",2),b()),i&2){let n=l(2).ngIf,e=l();x("data-testid",e.componentId+"-divider-container")("role","presentation"),m(),c("veltDynamicTemplate",dt(3,oBe,e.template,n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function sBe(i,o){if(i&1&&(f(0),g(1,aBe,2,8,"div",0),v()),i&2){let n=l().ngIf,e=l();m(),c("ngIf",e.type==="audio"?n.isAudioPermissionOpen:n.isVideoPermissionOpen)}}function lBe(i,o){if(i&1&&(f(0),g(1,sBe,2,1,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,iBe,n.conditionSignal(),A(1,nBe,n.componentConfigSignal)))}}var b0=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.type="audio",this.componentId="velt-media-source-settings-divider",super.initializeComponentConfigSignal(new rr)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,type:this.type}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in MediaSourceSettingsDividerComponent ngOnInit: ",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in MediaSourceSettingsDividerComponent ngOnDestroy: ",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in MediaSourceSettingsDividerComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["velt-media-source-settings-divider-internal"]],inputs:{type:"type"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[1,"velt-media-source-settings-divider"]],template:function(t,r){t&1&&g(0,lBe,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},styles:["[_nghost-%COMP%]{width:100%}[_nghost-%COMP%]:empty{display:none}.velt-media-source-settings-divider[_ngcontent-%COMP%]{width:100%;height:1px;background:var(--velt-background-4);margin-top:var(--velt-spacing-md)}"],changeDetection:0});let i=o;return i})();var cBe=i=>({componentConfigSignal:i}),dBe=(i,o)=>({condition:i,data:o}),mBe=(i,o,n,e)=>({template:i,componentName:"velt-media-source-settings-options-item-icon-wireframe",variant:o,setIfCondition:n,componentElementRef:e});function pBe(i,o){i&1&&(f(0),le(),_(1,"svg",4),w(2,"path",5),b(),v())}function gBe(i,o){if(i&1&&(f(0),_(1,"div",2),g(2,pBe,3,0,"ng-container",3),b(),v()),i&2){let n=l().ngIf,e=l();m(),ue("selected",e.device.deviceId===(e.type==="audio"?n.selectedAudioDevice==null?null:n.selectedAudioDevice.deviceId:n.selectedVideoDevice==null?null:n.selectedVideoDevice.deviceId)),x("data-testid",e.componentId+"-selected-icon")("role","presentation")("aria-hidden","true"),m(),c("veltDynamicTemplate",dt(6,mBe,e.template,n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function uBe(i,o){if(i&1&&(f(0),g(1,gBe,3,11,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,dBe,n.conditionSignal(),A(1,cBe,n.componentConfigSignal)))}}var Lb=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.type="audio",this.componentId="velt-media-source-settings-options-item-icon",super.initializeComponentConfigSignal(new rr)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,type:this.type,device:this.device}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in MediaSourceSettingsOptionsItemIconComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in MediaSourceSettingsOptionsItemIconComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in MediaSourceSettingsOptionsItemIconComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["velt-media-source-settings-options-item-icon"]],inputs:{type:"type",device:"device"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[1,"velt-media-source-settings-options--selected-icon"],[4,"veltDynamicTemplate"],["width","18","height","18","viewBox","0 0 18 18","fill","none","xmlns","http://www.w3.org/2000/svg","focusable","false","aria-hidden","true"],["d","M3.75 9L7.5 12.75L15 5.25","stroke","currentColor","stroke-width","1.5","stroke-linecap","round","stroke-linejoin","round"]],template:function(t,r){t&1&&g(0,uBe,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},styles:[".velt-media-source-settings-options--selected-icon[_ngcontent-%COMP%]{visibility:hidden;color:var(--velt-accent-text);display:flex}.velt-media-source-settings-options--selected-icon.selected[_ngcontent-%COMP%]{visibility:visible}"],changeDetection:0});let i=o;return i})();var hBe=i=>({componentConfigSignal:i}),fBe=(i,o)=>({condition:i,data:o}),vBe=(i,o,n,e)=>({template:i,componentName:"velt-media-source-settings-options-item-label-wireframe",variant:o,setIfCondition:n,componentElementRef:e});function CBe(i,o){if(i&1&&(f(0),_(1,"p"),P(2,"translate"),ee(3),P(4,"translate"),b(),v()),i&2){let n=l(2).ngIf,e=l();m(),ue("velt-media-source-settings-options--label-selected",e.device.deviceId===(e.type==="audio"?n.selectedAudioDevice==null?null:n.selectedAudioDevice.deviceId:n.selectedVideoDevice==null?null:n.selectedVideoDevice.deviceId)),x("data-testid",e.componentId+"-device-label")("role","option")("title",M(2,6,e.device.label)),m(2),Ce(" ",M(4,8,e.device.label)," ")}}function _Be(i,o){if(i&1&&(f(0),g(1,CBe,5,10,"ng-container",2),v()),i&2){let n=l().ngIf,e=l();m(),c("veltDynamicTemplate",dt(1,vBe,e.template,n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function yBe(i,o){if(i&1&&(f(0),g(1,_Be,2,6,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,fBe,n.conditionSignal(),A(1,hBe,n.componentConfigSignal)))}}var Bb=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.type="audio",this.componentId="velt-media-source-settings-options-item-label",super.initializeComponentConfigSignal(new rr)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,type:this.type,device:this.device}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in MediaSourceSettingsOptionsItemLabelComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in MediaSourceSettingsOptionsItemLabelComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in MediaSourceSettingsOptionsItemLabelComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["velt-media-source-settings-options-item-label"]],inputs:{type:"type",device:"device"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"]],template:function(t,r){t&1&&g(0,yBe,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},styles:["p[_ngcontent-%COMP%]{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin:0}.velt-media-source-settings-options--label-selected[_ngcontent-%COMP%]{color:var(--velt-text-0)}"],changeDetection:0});let i=o;return i})();var SBe=i=>({componentConfigSignal:i}),bBe=(i,o)=>({condition:i,data:o}),IBe=(i,o,n)=>({device:i,type:o,componentConfigSignal:n}),EBe=(i,o,n,e,t)=>({template:i,context:o,cloneTemplate:!0,componentName:"velt-media-source-settings-options-item-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function xBe(i,o){if(i&1&&(f(0),w(1,"velt-media-source-settings-options-item-icon",7)(2,"velt-media-source-settings-options-item-label",7),v()),i&2){let n=l().$implicit,e=l(4);m(),c("device",n)("type",e.type)("componentConfigSignal",e.componentConfigSignal),x("data-testid",e.componentId+"-option-icon-"+n.deviceId),m(),c("device",n)("type",e.type)("componentConfigSignal",e.componentConfigSignal),x("data-testid",e.componentId+"-option-label-"+n.deviceId)}}function TBe(i,o){if(i&1){let n=q();_(0,"div",5),z("click",function(){let t=N(n).$implicit,r=l(3).ngIf,a=l();return F(a.type==="audio"?r.selectAudioDevice(t):r.selectVideoDevice(t))}),g(1,xBe,3,8,"ng-container",6),b()}if(i&2){let n=o.$implicit,e=l(3).ngIf,t=l();ue("velt-media-source-settings-options--current-selected",n.deviceId===(t.type==="audio"?e.selectedAudioDevice==null?null:e.selectedAudioDevice.deviceId:e.selectedVideoDevice==null?null:e.selectedVideoDevice.deviceId)),x("data-testid",t.componentId+"-option-"+n.deviceId)("role","option"),m(),c("veltDynamicTemplate",$(9,EBe,t.optionTemplate,$e(5,IBe,n,t.type,t.componentConfigSignal),e==null?null:e.variant,t.setIfCondition.bind(t),t.elementRef))}}function DBe(i,o){if(i&1&&(_(0,"div",3),g(1,TBe,2,15,"div",4),b()),i&2){let n=l(2).ngIf,e=l();x("data-testid",e.componentId+"-options")("role","listbox")("aria-orientation","vertical"),m(),c("ngForOf",e.type==="audio"?n.audioDevices:n.videoDevices)}}function wBe(i,o){if(i&1&&(f(0),g(1,DBe,2,4,"div",2),v()),i&2){let n=l().ngIf,e=l();m(),c("ngIf",e.type==="audio"?n.isAudioPermissionOpen:n.isVideoPermissionOpen)}}function OBe(i,o){if(i&1&&(f(0),g(1,wBe,2,1,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,bBe,n.conditionSignal(),A(1,SBe,n.componentConfigSignal)))}}var I0=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.type="audio",this.componentId="velt-media-source-settings-options",super.initializeComponentConfigSignal(new rr)}ngOnInit(){try{if(this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,type:this.type}),this.setupA11yAttributes(),!this.optionTemplate){let e=this.template?.querySelector("velt-media-source-settings-options-item-wireframe");Ke(e)||(this.optionTemplate=e)}}catch{}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in MediaSourceSettingsOptionsComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in MediaSourceSettingsOptionsComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["velt-media-source-settings-options-internal"]],inputs:{type:"type"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["class","velt-media-source-settings-options",4,"ngIf"],[1,"velt-media-source-settings-options"],["class","velt-media-source-settings-options-item",3,"velt-media-source-settings-options--current-selected","click",4,"ngFor","ngForOf"],[1,"velt-media-source-settings-options-item",3,"click"],[4,"veltDynamicTemplate"],[3,"device","type","componentConfigSignal"]],template:function(t,r){t&1&&g(0,OBe,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},styles:["[_nghost-%COMP%]{width:100%}[_nghost-%COMP%]:empty{display:none}.velt-media-source-settings-options[_ngcontent-%COMP%]{width:100%;display:flex;flex-direction:column;align-items:center;max-height:104px;overflow-y:scroll}.velt-media-source-settings-options-item[_ngcontent-%COMP%]{width:100%;display:flex;gap:var(--velt-spacing-md);align-items:center;cursor:pointer;padding-block:var(--velt-spacing-sm);border-radius:var(--velt-border-radius-sm);color:var(--velt-text-6)}.velt-media-source-settings-options-item[_ngcontent-%COMP%]:not(.velt-media-source-settings-options--current-selected):hover{background:var(--velt-background-4);color:var(--velt-text-0)}.velt-media-source-settings-options--current-selected[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{opacity:50%;color:var(--velt-text-0)}"],changeDetection:0});let i=o;return i})();var ABe=i=>({componentConfigSignal:i}),PBe=(i,o)=>({condition:i,data:o}),MBe=(i,o,n,e)=>({template:i,componentName:"velt-media-source-settings-selected-label-wireframe",variant:o,setIfCondition:n,componentElementRef:e});function kBe(i,o){if(i&1&&(f(0),_(1,"p",3),ee(2),P(3,"translate"),P(4,"translate"),P(5,"translate"),P(6,"translate"),b(),v()),i&2){let n,e=l(3);m(),x("data-testid",e.componentId+"-selected-device-label")("role","status")("aria-live","polite"),m(),Ce(" ",e.type==="audio"?(n=M(3,4,(n=e.componentConfigSignal().selectedAudioDevice)==null?null:n.label))!==null&&n!==void 0?n:M(4,6,"No device found"):(n=M(5,8,(n=e.componentConfigSignal().selectedVideoDevice)==null?null:n.label))!==null&&n!==void 0?n:M(6,10,"No device found")," ")}}function RBe(i,o){if(i&1&&(f(0),g(1,kBe,7,12,"ng-container",2),v()),i&2){let n=l().ngIf,e=l();m(),c("veltDynamicTemplate",dt(1,MBe,e.template,n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function NBe(i,o){if(i&1&&(f(0),g(1,RBe,2,6,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,PBe,n.conditionSignal(),A(1,ABe,n.componentConfigSignal)))}}var E0=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.type="audio",this.componentId="velt-media-source-settings-selected-label",super.initializeComponentConfigSignal(new rr)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,type:this.type}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in MediaSourceSettingsSelectedLabelComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in MediaSourceSettingsSelectedLabelComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in MediaSourceSettingsSelectedLabelComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["velt-media-source-settings-selected-label-internal"]],inputs:{type:"type"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[1,"velt-media-source-settings-label"]],template:function(t,r){t&1&&g(0,NBe,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},styles:["[_nghost-%COMP%]{flex:1}.velt-media-source-settings-label[_ngcontent-%COMP%]{flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin:0;color:var(--velt-text-3)}"],changeDetection:0});let i=o;return i})();var FBe=i=>({componentConfigSignal:i}),LBe=(i,o)=>({condition:i,data:o}),BBe=(i,o,n,e)=>({template:i,componentName:"velt-media-source-settings-toggle-icon-close-wireframe",variant:o,setIfCondition:n,componentElementRef:e});function VBe(i,o){if(i&1&&(f(0),le(),_(1,"svg",3),w(2,"path",4),b(),v()),i&2){let n=l(4);m(),x("data-testid",n.componentId+"-toggle-icon")("aria-hidden","true")}}function UBe(i,o){if(i&1&&(f(0),g(1,VBe,3,2,"ng-container",2),v()),i&2){let n=l(2).ngIf,e=l();m(),c("veltDynamicTemplate",dt(1,BBe,e.template,n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function jBe(i,o){if(i&1&&(f(0),g(1,UBe,2,6,"ng-container",0),v()),i&2){let n=l().ngIf,e=l();m(),c("ngIf",e.type==="audio"?!n.isAudioPermissionOpen:!n.isVideoPermissionOpen)}}function $Be(i,o){if(i&1&&(f(0),g(1,jBe,2,1,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,LBe,n.conditionSignal(),A(1,FBe,n.componentConfigSignal)))}}var Vb=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.type="audio",this.componentId="velt-media-source-settings-toggle-icon-close",super.initializeComponentConfigSignal(new rr)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,type:this.type}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in MediaSourceSettingsToggleIconCloseComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in MediaSourceSettingsToggleIconCloseComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in MediaSourceSettingsToggleIconCloseComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["velt-media-source-settings-toggle-icon-close-internal"]],inputs:{type:"type"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["width","18","height","18","viewBox","0 0 18 18","fill","none","xmlns","http://www.w3.org/2000/svg","focusable","false","role","presentation",1,"velt-media-source-settings-toggle-icon"],["d","M4 7L9 12L14 7","fill","currentColor"]],template:function(t,r){t&1&&g(0,$Be,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},styles:["[_nghost-%COMP%]{display:flex}svg[_ngcontent-%COMP%]{max-width:none;color:var(--velt-text-12)}"],changeDetection:0});let i=o;return i})();var HBe=i=>({componentConfigSignal:i}),zBe=(i,o)=>({condition:i,data:o}),GBe=(i,o,n,e)=>({template:i,componentName:"velt-media-source-settings-toggle-icon-open-wireframe",variant:o,setIfCondition:n,componentElementRef:e});function WBe(i,o){if(i&1&&(f(0),le(),_(1,"svg",3),w(2,"path",4),b(),v()),i&2){let n=l(4);m(),x("data-testid",n.componentId+"-toggle-icon-open")("aria-hidden","true")}}function qBe(i,o){if(i&1&&(f(0),g(1,WBe,3,2,"ng-container",2),v()),i&2){let n=l(2).ngIf,e=l();m(),c("veltDynamicTemplate",dt(1,GBe,e.template,n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function YBe(i,o){if(i&1&&(f(0),g(1,qBe,2,6,"ng-container",0),v()),i&2){let n=l().ngIf,e=l();m(),c("ngIf",e.type==="audio"?n.isAudioPermissionOpen:n.isVideoPermissionOpen)}}function KBe(i,o){if(i&1&&(f(0),g(1,YBe,2,1,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,zBe,n.conditionSignal(),A(1,HBe,n.componentConfigSignal)))}}var Ub=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.type="audio",this.componentId="velt-media-source-settings-toggle-icon-open",super.initializeComponentConfigSignal(new rr)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,type:this.type}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in MediaSourceSettingsToggleIconOpenComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in MediaSourceSettingsToggleIconOpenComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in MediaSourceSettingsToggleIconOpenComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["velt-media-source-settings-toggle-icon-open-internal"]],inputs:{type:"type"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["width","18","height","18","viewBox","0 0 18 18","fill","none","xmlns","http://www.w3.org/2000/svg","focusable","false","role","presentation",1,"velt-media-source-settings-toggle-icon-open"],["d","M4 12L9 7L14 12","fill","currentColor"]],template:function(t,r){t&1&&g(0,KBe,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},styles:["[_nghost-%COMP%]{display:flex}svg[_ngcontent-%COMP%]{max-width:none;color:var(--velt-text-12)}"],changeDetection:0});let i=o;return i})();var ZBe=i=>({componentConfigSignal:i}),XBe=(i,o)=>({condition:i,data:o}),QBe=(i,o)=>({componentConfigSignal:i,type:o}),JBe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-media-source-settings-toggle-icon-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function eVe(i,o){if(i&1&&(f(0),_(1,"div",3),w(2,"velt-media-source-settings-toggle-icon-open-internal",4)(3,"velt-media-source-settings-toggle-icon-close-internal",4),b(),v()),i&2){let n=l(3);m(),x("data-testid",n.componentId+"-toggle-container")("role","presentation")("aria-hidden","true"),m(),c("componentConfigSignal",n.componentConfigSignal)("type",n.type)("template",n.template),x("data-testid",n.componentId+"-toggle-open"),m(),c("componentConfigSignal",n.componentConfigSignal)("type",n.type)("template",n.template),x("data-testid",n.componentId+"-toggle-close")}}function tVe(i,o){if(i&1&&(f(0),g(1,eVe,4,11,"ng-container",2),v()),i&2){let n=l().ngIf,e=l();m(),c("veltDynamicTemplate",$(4,JBe,e.template,k(1,QBe,e.componentConfigSignal,e.type),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function nVe(i,o){if(i&1&&(f(0),g(1,tVe,2,10,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,XBe,n.conditionSignal(),A(1,ZBe,n.componentConfigSignal)))}}var x0=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.type="audio",this.componentId="velt-media-source-settings-toggle-icon",super.initializeComponentConfigSignal(new rr)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,type:this.type}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in MediaSourceSettingsToggleIconComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in MediaSourceSettingsToggleIconComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in MediaSourceSettingsToggleIconComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["velt-media-source-settings-toggle-icon-internal"]],inputs:{type:"type"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[1,"velt-media-source-settings--toggle-icon"],[3,"componentConfigSignal","type","template"]],template:function(t,r){t&1&&g(0,nVe,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},encapsulation:2,changeDetection:0});let i=o;return i})();var iVe=i=>({componentConfigSignal:i}),oVe=(i,o)=>({condition:i,data:o}),rVe=i=>({componentConfigSignal:i,type:"video"}),aVe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-media-source-settings-video-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function sVe(i,o){if(i&1&&(f(0),_(1,"div",5)(2,"div",6),le(),_(3,"svg",7),w(4,"path",8)(5,"path",9),b()(),pt(),w(6,"velt-media-source-settings-selected-label-internal",10)(7,"velt-media-source-settings-toggle-icon-internal",10),b(),w(8,"velt-media-source-settings-divider-internal",10)(9,"velt-media-source-settings-options-internal",10),v()),i&2){let n=l(4);m(),x("aria-hidden","true"),m(5),c("componentConfigSignal",n.componentConfigSignal)("template",n.template),x("data-testid",n.componentId+"-label"),m(),c("componentConfigSignal",n.componentConfigSignal)("template",n.template),x("data-testid",n.componentId+"-toggle"),m(),c("componentConfigSignal",n.componentConfigSignal)("template",n.template),x("data-testid",n.componentId+"-divider"),m(),c("componentConfigSignal",n.componentConfigSignal)("template",n.template),x("data-testid",n.componentId+"-options")}}function lVe(i,o){if(i&1){let n=q();_(0,"div",3),P(1,"translate"),z("clickOutside",function(){N(n);let t=l(2).ngIf;return F(t.closeVideoDropdown())})("click",function(t){N(n);let r=l(2).ngIf;return F(r.toggleVideoPermission(t))}),g(2,sVe,10,13,"ng-container",4),b()}if(i&2){let n=l(2).ngIf,e=l();ue("velt-media-source-settings-video--active",n.isVideoPermissionOpen),x("data-testid",e.componentId)("role","button")("aria-expanded",n.isVideoPermissionOpen)("aria-haspopup","listbox")("aria-label",M(1,9,"Video settings"))("tabindex",0),m(2),c("veltDynamicTemplate",$(13,aVe,e.template,A(11,rVe,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function cVe(i,o){if(i&1&&(f(0),g(1,lVe,3,19,"div",2),v()),i&2){let n=l().ngIf;m(),c("ngIf",n.settingsVisible==null?null:n.settingsVisible.video)}}function dVe(i,o){if(i&1&&(f(0),g(1,cVe,2,1,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,oVe,n.conditionSignal(),A(1,iVe,n.componentConfigSignal)))}}var jb=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.componentId="velt-media-source-settings-video",super.initializeComponentConfigSignal(new rr)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in MediaSourceSettingsVideoComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in MediaSourceSettingsVideoComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in MediaSourceSettingsVideoComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["velt-media-source-settings-video-internal"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["class","velt-media-source-settings-video","snippylyClickOutside","",3,"velt-media-source-settings-video--active","clickOutside","click",4,"ngIf"],["snippylyClickOutside","",1,"velt-media-source-settings-video",3,"clickOutside","click"],[4,"veltDynamicTemplate"],[1,"velt-media-source-settings-video-trigger"],[1,"velt-media-source-settings-video-trigger-icon"],["width","16","height","16","viewBox","0 0 16 16","fill","none","xmlns","http://www.w3.org/2000/svg","focusable","false","aria-hidden","true"],["d","M10 6.66675L13.0353 5.14941C13.1369 5.09864 13.2499 5.07467 13.3633 5.07978C13.4768 5.08489 13.5871 5.11891 13.6837 5.17862C13.7804 5.23832 13.8602 5.32173 13.9155 5.42093C13.9709 5.52012 13.9999 5.63182 14 5.74541V10.2547C13.9999 10.3683 13.9709 10.48 13.9155 10.5792C13.8602 10.6784 13.7804 10.7618 13.6837 10.8215C13.5871 10.8812 13.4768 10.9153 13.3633 10.9204C13.2499 10.9255 13.1369 10.9015 13.0353 10.8507L10 9.33341V6.66675Z","stroke","currentColor","stroke-linecap","round","stroke-linejoin","round"],["d","M2 5.33333C2 4.97971 2.14048 4.64057 2.39052 4.39052C2.64057 4.14048 2.97971 4 3.33333 4H8.66667C9.02029 4 9.35943 4.14048 9.60948 4.39052C9.85952 4.64057 10 4.97971 10 5.33333V10.6667C10 11.0203 9.85952 11.3594 9.60948 11.6095C9.35943 11.8595 9.02029 12 8.66667 12H3.33333C2.97971 12 2.64057 11.8595 2.39052 11.6095C2.14048 11.3594 2 11.0203 2 10.6667V5.33333Z","stroke","currentColor","stroke-linecap","round","stroke-linejoin","round"],["type","video",3,"componentConfigSignal","template"]],template:function(t,r){t&1&&g(0,dVe,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},styles:[".velt-media-source-settings-video[_ngcontent-%COMP%]{padding:var(--velt-spacing-md);margin:var(--velt-spacing-xs);border-radius:var(--velt-border-radius-md);display:flex;flex-direction:column;align-items:center;box-sizing:border-box}.velt-media-source-settings-video[_ngcontent-%COMP%]:hover{background:var(--velt-background-3)}.velt-media-source-settings-video--active[_ngcontent-%COMP%]{background:var(--velt-background-2)}.velt-media-source-settings-video-trigger[_ngcontent-%COMP%]{width:100%;display:flex;gap:var(--velt-spacing-md);align-items:center;cursor:pointer}.velt-media-source-settings-video-trigger[_ngcontent-%COMP%] .velt-media-source-settings-video-trigger-icon[_ngcontent-%COMP%]{display:flex;padding:1px;color:var(--velt-text-3)}.velt-media-source-settings-video-trigger[_ngcontent-%COMP%] .velt-media-source-settings-video-trigger-icon[_ngcontent-%COMP%] svg[_ngcontent-%COMP%]{max-width:none}"],changeDetection:0});let i=o;return i})();var ade=i=>({componentConfigSignal:i}),mVe=(i,o)=>({condition:i,data:o}),pVe=(i,o,n,e,t)=>({template:i,context:o,cloneTemplate:!0,componentName:"velt-media-source-settings-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function gVe(i,o){i&1&&Ve(0)}function uVe(i,o){if(i&1&&(_(0,"velt-shadow-dom-internal"),g(1,gVe,1,0,"ng-container",4),b()),i&2){l();let n=ce(3);m(),c("ngTemplateOutlet",n)}}function hVe(i,o){if(i&1&&(f(0),_(1,"div",8),w(2,"velt-media-source-settings-audio-internal",9)(3,"velt-media-source-settings-video-internal",9),b(),v()),i&2){let n=l(5);m(),x("role","group")("aria-label","Media settings controls"),m(),c("componentConfigSignal",n.componentConfigSignal),x("data-testid",n.componentId+"-audio")("role","region")("aria-label","Audio settings"),m(),c("componentConfigSignal",n.componentConfigSignal),x("data-testid",n.componentId+"-video")("role","region")("aria-label","Video settings")}}function fVe(i,o){if(i&1&&(_(0,"div",6),P(1,"translate"),g(2,hVe,4,10,"ng-container",7),b()),i&2){let n=l(3).ngIf,e=l();x("data-testid",e.componentId)("role","dialog")("aria-label",M(1,5,"Media source settings"))("aria-modal","true"),m(2),c("veltDynamicTemplate",$(9,pVe,e.template,A(7,ade,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function vVe(i,o){if(i&1&&g(0,fVe,3,15,"div",5),i&2){let n=l(2).ngIf;c("ngIf",n.isOpen||n.settingsEmbedded)}}function CVe(i,o){if(i&1&&(f(0),g(1,uVe,2,1,"velt-shadow-dom-internal",3)(2,vVe,1,1,"ng-template",null,0,Ee),v()),i&2){let n=ce(3),e=l().ngIf,t=l();m(),c("ngIf",e.shadowDom&&!t.template)("ngIfElse",n)}}function _Ve(i,o){if(i&1&&(f(0),g(1,CVe,4,2,"ng-container",2),v()),i&2){let n=l();m(),c("veltIf",k(3,mVe,n.conditionSignal(),A(1,ade,n.componentConfigSignal)))}}var $b=(()=>{let o=class o extends H{constructor(e,t,r,a,s,d){super(a,s,e),this.loggingService=e,this.wireframeService=t,this.devicePermissionService=r,this.elementRef=a,this.dynamicDataService=s,this.recorderService=d,this.isOpen=!1,this.showMicSettings=!0,this.showCamSettings=!0,this.config={},this.shadowDom=!0,this.devices=[],this.defaultMediaSourceOptions=Dc(),this.subscriptions=[],this.veltElement=!0,this.componentConfigSignal=xe({toggleAudioPermission:this.toggleAudioPermission.bind(this),selectAudioDevice:this.selectAudioDevice.bind(this),toggleVideoPermission:this.toggleVideoPermission.bind(this),selectVideoDevice:this.selectVideoDevice.bind(this),isAudioPermissionOpen:!1,settingsVisible:{audio:!0,video:!0},selectedAudioDevice:void 0,selectedVideoDevice:void 0,isVideoPermissionOpen:!1,audioDevices:[],videoDevices:[],shadowDom:this.shadowDom,isOpen:this.isOpen,variant:this.variant,settingsEmbedded:!1,closeVideoDropdown:this.closeVideoDropdown.bind(this),closeAudioDropdown:this.closeAudioDropdown.bind(this)}),this.componentId="velt-media-source-settings";try{this.getDevices(),this.subscriptions.push(this.devicePermissionService.getPermissionState$("video").subscribe(p=>{this.getDevices()})),this.subscriptions.push(this.devicePermissionService.getPermissionState$("audio").subscribe(p=>{this.getDevices()})),this.subscriptions.push(this.recorderService.getSettingsEmbedded$().subscribe(p=>{this.componentConfigSignal.update(u=>T(I({},u),{settingsEmbedded:p}))}))}catch(p){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent constructor: ",p)}}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes(),this.updateSettingsVisibility(),this.loggingService.log("%c[WB] Calling FUNCTION: ngOnInit","color: green;");let e="velt-media-source-settings-wireframe";this.variant&&(e+=`---${this.variant}`),this.wireframeService.getWireframe$(e).subscribe(t=>{if(t){let r=document.createElement(t.tagName);r.innerHTML=t.innerHTML,this.template=r}})}catch(e){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent ngOnInit: ",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in MediaSourceSettingsComponent setupA11yAttributes:",e)}}ngOnChanges(e){try{e&&Object.keys(e).forEach(t=>{this.componentConfigSignal.update(r=>(r=T(I({},r),{[t]:e[t].currentValue}),r))}),(e.showMicSettings||e.showCamSettings)&&this.updateSettingsVisibility()}catch(t){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent ngOnChanges: ",t)}}ngOnDestroy(){try{super.ngOnDestroy(),this.subscriptions.forEach(e=>{e?.unsubscribe()})}catch(e){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent ngOnDestroy: ",e)}}updateSettingsVisibility(){try{this.componentConfigSignal.update(e=>T(I({},e),{settingsVisible:{audio:this.showMicSettings,video:this.showCamSettings}}))}catch(e){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent ngOnChanges: ",e)}}getDevices(){return Q(this,null,function*(){try{let e=new Gn;if(e.getBrowserName()?.toLowerCase()==="safari"||e.getBrowserName()?.toLowerCase()==="firefox")try{let t=yield navigator.mediaDevices.getUserMedia({audio:!0,video:!0});t&&t.getTracks().forEach(r=>r.stop())}catch(t){this.loggingService.catch("Error in MediaSourceSettingsComponent getDevices getUserMedia catch: ",t)}navigator.mediaDevices.enumerateDevices().then(t=>{if(this.devices=t.filter(r=>r.kind==="audioinput"||r.kind==="videoinput"),this.componentConfigSignal.update(r=>T(I({},r),{audioDevices:this.devices.filter(a=>a.kind==="audioinput"&&a.deviceId!==""),videoDevices:this.devices.filter(a=>a.kind==="videoinput"&&a.deviceId!=="")})),this.componentConfigSignal().audioDevices.length>0&&!this.componentConfigSignal().selectedAudioDevice){if(this.defaultMediaSourceOptions?.selectedAudioDevice?.deviceId){let r=this.componentConfigSignal().audioDevices.find(a=>a.deviceId===this.defaultMediaSourceOptions?.selectedAudioDevice?.deviceId);r&&this.componentConfigSignal.update(a=>T(I({},a),{selectedAudioDevice:r}))}this.componentConfigSignal().selectedAudioDevice||this.componentConfigSignal.update(r=>T(I({},r),{selectedAudioDevice:this.componentConfigSignal().audioDevices[0]}))}if(this.componentConfigSignal().videoDevices.length>0&&!this.componentConfigSignal().selectedVideoDevice){if(this.defaultMediaSourceOptions?.selectedVideoDevice?.deviceId){let r=this.componentConfigSignal().videoDevices.find(a=>a.deviceId===this.defaultMediaSourceOptions?.selectedVideoDevice?.deviceId);r&&this.componentConfigSignal.update(a=>T(I({},a),{selectedVideoDevice:r}))}this.componentConfigSignal().selectedVideoDevice||this.componentConfigSignal.update(r=>T(I({},r),{selectedVideoDevice:this.componentConfigSignal().videoDevices[0]}))}}).catch(t=>{this.loggingService.catch("Error in MediaSourceSettingsComponent getDevices enumerateDevices catch: ",t)})}catch(e){this.loggingService.catch("Error in MediaSourceSettingsComponent getDevices: ",e)}})}selectAudioDevice(e){try{this.componentConfigSignal.update(t=>T(I({},t),{selectedAudioDevice:e})),this.saveChanges()}catch(t){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent selectAudioDevice: ",t)}}selectVideoDevice(e){try{this.componentConfigSignal.update(t=>T(I({},t),{selectedVideoDevice:e})),this.saveChanges()}catch(t){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent selectVideoDevice: ",t)}}saveChanges(){try{let e={};this.componentConfigSignal()?.settingsVisible?.audio&&(e.selectedAudioDevice=this.componentConfigSignal()?.selectedAudioDevice),this.componentConfigSignal()?.settingsVisible?.video&&(e.selectedVideoDevice=this.componentConfigSignal()?.selectedVideoDevice),localStorage.setItem(j.LOCAL_STORAGE.SNIPPYLY_DEFAULT_MEDIA_SOURCE_OPTIONS,JSON.stringify(e||{})),this.defaultMediaSourceOptions=Dc(),this.config.mediaConfig.audio||(this.config.mediaConfig.audio={enabled:!1}),this.config.mediaConfig.audio.deviceId=this.defaultMediaSourceOptions?.selectedAudioDevice?.deviceId,this.config.mediaConfig.video||(this.config.mediaConfig.video={enabled:!1}),this.config.mediaConfig.video.deviceId=this.defaultMediaSourceOptions?.selectedVideoDevice?.deviceId,this.config.updateMediaConfig(this.config.mediaConfig)}catch(e){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent saveChanges: ",e)}}toggleAudioPermission(e){try{e.stopPropagation(),this.componentConfigSignal().audioDevices.length>0&&this.componentConfigSignal.update(t=>T(I({},t),{isAudioPermissionOpen:!t.isAudioPermissionOpen}))}catch(t){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent toggleAudioPermission: ",t)}}toggleVideoPermission(e){try{e.stopPropagation(),this.componentConfigSignal().videoDevices.length>0&&this.componentConfigSignal.update(t=>(t=T(I({},t),{isVideoPermissionOpen:!t.isVideoPermissionOpen}),t))}catch(t){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent toggleVideoPermission: ",t)}}closeVideoDropdown(){try{this.componentConfigSignal.update(e=>(e=T(I({},e),{isVideoPermissionOpen:!1}),e))}catch(e){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent closeVideoDropdown: ",e)}}closeAudioDropdown(){try{this.componentConfigSignal.update(e=>(e=T(I({},e),{isAudioPermissionOpen:!1}),e))}catch(e){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent closeAudioDropdown: ",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(He),h(Bd),h(R),h(S),h(kn))},o.\u0275cmp=O({type:o,selectors:[["velt-media-source-settings-internal"]],hostVars:1,hostBindings:function(t,r){t&2&&x("data-velt-element",r.veltElement)},inputs:{isOpen:"isOpen",showMicSettings:"showMicSettings",showCamSettings:"showCamSettings",config:"config",shadowDom:"shadowDom",variant:"variant"},standalone:!1,features:[V([S]),B,Ze],decls:1,vars:1,consts:[["mediaSourcePermissionRef",""],[4,"ngIf"],[4,"veltIf"],[4,"ngIf","ngIfElse"],[4,"ngTemplateOutlet"],["class","velt-media-source-settings-container",4,"ngIf"],[1,"velt-media-source-settings-container"],[4,"veltDynamicTemplate"],[1,"velt-media-source-settings"],[3,"componentConfigSignal"]],template:function(t,r){t&1&&g(0,_Ve,2,6,"ng-container",1),t&2&&c("ngIf",r.componentConfigSignal())},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-media-source-settings[_ngcontent-%COMP%]{position:absolute;left:0;bottom:90px;border-radius:var(--velt-border-radius-lg);background:var(--velt-background-1);display:flex;flex-direction:column;width:366px;font-weight:400;font-size:var(--velt-font-size-xs);line-height:18px;overflow:hidden}"],changeDetection:0});let i=o;return i})();var bn=class{constructor(){this.closeDialog=()=>{},this.startCountdown=()=>{},this.toggleAudio=()=>{},this.toggleVideo=()=>{},this.toggleSettings=()=>{},this.cancelCountdown=()=>{},this.updateMediaConfig=()=>{},this.handleOverlayClick=()=>{},this.countdownStarted=!1,this.isSettingsOpen=!1,this.mediaConfig={audio:{enabled:!1},video:{enabled:!1}},this.mediaState={audio:{enabled:!1},video:{enabled:!1}},this.type="video",this.darkMode=!1,this.shadowDom=!0}};var yVe=i=>({componentConfigSignal:i}),SVe=(i,o)=>({condition:i,data:o}),bVe=(i,o)=>({componentConfigSignal:i,variant:o}),IVe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-recording-preview-steps-dialog-audio-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function EVe(i,o){i&1&&Ve(0)}function xVe(i,o){if(i&1&&(_(0,"velt-shadow-dom-internal"),g(1,EVe,1,0,"ng-container",5),b()),i&2){l();let n=ce(3);m(),c("ngTemplateOutlet",n)}}function TVe(i,o){if(i&1&&(f(0),_(1,"div",9)(2,"div",10),w(3,"app-recording-preview-steps-dialog-close-button",11),b(),w(4,"app-recording-preview-steps-dialog-timer",11)(5,"app-recording-preview-steps-dialog-waveform",12),_(6,"div",13),w(7,"velt-recording-preview-steps-dialog-settings-panel-internal",12),_(8,"app-recording-preview-steps-dialog-button-panel",11),w(9,"app-recording-preview-steps-dialog-start-recording",11)(10,"velt-recording-preview-steps-dialog-mic-button-internal",11)(11,"app-recording-preview-steps-dialog-settings",11),b(),w(12,"app-recording-preview-steps-dialog-bottom-panel",11),b()(),v()),i&2){let n=l(5);m(),x("data-testid",n.componentId+"-overlay"),m(),x("data-testid",n.componentId+"-header"),m(),c("componentConfigSignal",n.componentConfigSignal)("template",n.template)("variant",n.variant),m(),c("componentConfigSignal",n.componentConfigSignal)("template",n.template)("variant",n.variant),m(),c("componentConfigSignal",n.componentConfigSignal),m(),x("data-testid",n.componentId+"-settings")("role","group")("aria-label","Recording settings"),m(),c("componentConfigSignal",n.componentConfigSignal),m(),c("componentConfigSignal",n.componentConfigSignal)("template",n.template)("variant",n.variant),m(),c("componentConfigSignal",n.componentConfigSignal)("template",n.template)("variant",n.variant),m(),c("componentConfigSignal",n.componentConfigSignal)("template",n.template)("variant",n.variant),m(),c("componentConfigSignal",n.componentConfigSignal)("template",n.template)("variant",n.variant),m(),c("componentConfigSignal",n.componentConfigSignal)("template",n.template)("variant",n.variant)}}function DVe(i,o){if(i&1){let n=q();_(0,"div",7,1),P(2,"translate"),z("pointerdown",function(t){return N(n),F(t.stopPropagation())})("pointerup",function(t){return N(n),F(t.stopPropagation())})("click",function(t){N(n);let r=l(3).ngIf;return F(r.handleOverlayClick(t))}),g(3,TVe,13,28,"ng-container",8),b()}if(i&2){let n=l(4);x("data-testid",n.componentId)("role","dialog")("aria-label",M(2,4,"Audio recording preview")),m(3),c("veltDynamicTemplate",$(9,IVe,n.template,k(6,bVe,n.componentConfigSignal,n.variant),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function wVe(i,o){if(i&1&&g(0,DVe,4,15,"div",6),i&2){let n=l(2).ngIf;c("ngIf",n.type==="audio")}}function OVe(i,o){if(i&1&&(f(0),g(1,xVe,2,1,"velt-shadow-dom-internal",4)(2,wVe,1,1,"ng-template",null,0,Ee),v()),i&2){let n=ce(3),e=l().ngIf,t=l();m(),c("ngIf",e.shadowDom&&!t.template)("ngIfElse",n)}}function AVe(i,o){if(i&1&&(f(0),g(1,OVe,4,2,"ng-container",3),v()),i&2){let n=l();m(),c("veltIf",k(3,SVe,n.conditionSignal(),A(1,yVe,n.componentConfigSignal)))}}var Hb=(()=>{let o=class o extends H{constructor(e,t,r,a){super(r,a,e),this.loggingService=e,this.wireframeService=t,this.elementRef=r,this.dynamicDataService=a,this.componentId="velt-recording-preview-steps-dialog-audio",super.initializeComponentConfigSignal(new bn)}ngOnInit(){try{this.loggingService.log("%c[WB] Calling FUNCTION: ngOnInit","color: green;"),super.ngOnInit(),this.setupA11yAttributes();let e="velt-recording-preview-steps-dialog-audio-wireframe";this.variant&&(e+=`---${this.variant}`),this.wireframeService.getWireframe$(e).subscribe(t=>{if(t){let r=document.createElement(t.tagName);r.innerHTML=t.innerHTML,this.template=r}})}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogAudioComponent OnInit: ",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogAudioComponent ngOnDestroy: ",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogAudioComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(He),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-recording-preview-steps-dialog-audio"]],inputs:{variant:"variant"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[["audioDialogRef",""],["recordingPreviewDialogRef",""],[4,"ngIf"],[4,"veltIf"],[4,"ngIf","ngIfElse"],[4,"ngTemplateOutlet"],["class","velt-recording-preview-audio",3,"pointerdown","pointerup","click",4,"ngIf"],[1,"velt-recording-preview-audio",3,"pointerdown","pointerup","click"],[4,"veltDynamicTemplate"],[1,"velt-recording-preview-audio--overlay"],[1,"velt-recording-preview-audio--header"],[3,"componentConfigSignal","template","variant"],[3,"componentConfigSignal"],[1,"velt-recording-preview-audio--settings"]],template:function(t,r){t&1&&g(0,AVe,2,6,"ng-container",2),t&2&&c("ngIf",r.componentConfigSignal())},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%;height:100%}.velt-recording-preview-audio[_ngcontent-%COMP%], .velt-recording-preview-audio--header[_ngcontent-%COMP%]{display:flex}.velt-recording-preview-audio[_ngcontent-%COMP%]{position:relative;width:calc((50rem + 0px) * var(--velt-base-rem-unit));height:calc((30rem + 0px) * var(--velt-base-rem-unit));max-width:calc(.8 * var(--legacy-velt-viewport-width))}.velt-recording-preview-audio[_ngcontent-%COMP%] .velt-recording-preview-audio--audio-waves[_ngcontent-%COMP%]{transform:scale(1.5);height:100%;z-index:-1}@media screen and (max-width: 768px){.velt-recording-preview-audio[_ngcontent-%COMP%]{width:calc((35rem + 0px) * var(--velt-base-rem-unit));height:calc((25rem + 0px) * var(--velt-base-rem-unit));max-width:calc(.8 * var(--legacy-velt-viewport-width))}}@media screen and (max-width: 425px){ .snippyly-recording-preview-steps-dialog{width:calc(1 * var(--legacy-velt-viewport-width));max-width:calc(1 * var(--legacy-velt-viewport-width))} .snippyly-recording-preview-steps-dialog mat-dialog-container .mat-mdc-dialog-surface.mdc-dialog__surface{width:calc(1 * var(--legacy-velt-viewport-width));height:calc(1 * var(--legacy-velt-viewport-height));border-radius:calc((0rem + 0px) * var(--velt-base-rem-unit))} .snippyly-recording-preview-steps-dialog mat-dialog-container .velt-recording-preview-audio{width:calc(1 * var(--legacy-velt-viewport-width));height:calc(1 * var(--legacy-velt-viewport-height));max-width:calc(1 * var(--legacy-velt-viewport-width));border-radius:calc((0rem + 0px) * var(--velt-base-rem-unit))} .snippyly-recording-preview-steps-dialog mat-dialog-container .velt-recording-preview-audio video{height:100%}}.velt-recording-preview-audio--overlay[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;justify-content:space-between;padding:var(--velt-spacing-2xl);content:"";position:absolute;border-radius:var(--velt-border-radius-lg);border:1px solid var(--velt-border-2);background:var(--velt-background-0);z-index:1;inset:0}.velt-recording-preview-audio--header[_ngcontent-%COMP%]{justify-content:flex-end;width:100%;gap:var(--velt-spacing-sm);align-items:center}.velt-recording-preview-audio--settings[_ngcontent-%COMP%]{width:366px;display:flex;flex-direction:column;gap:var(--velt-spacing-lg);align-items:center;justify-content:center;position:relative;pointer-events:auto}'],changeDetection:0});let i=o;return i})();var PVe=i=>({componentConfigSignal:i}),MVe=(i,o)=>({condition:i,data:o}),kVe=(i,o)=>({componentConfigSignal:i,variant:o}),RVe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-recording-preview-steps-dialog-bottom-panel-close-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function NVe(i,o){if(i&1&&(f(0),_(1,"div",5),le(),_(2,"svg",6),w(3,"path",7),b()(),v()),i&2){let n=l(4);m(),x("data-testid",n.componentId+"-icon")}}function FVe(i,o){if(i&1){let n=q();_(0,"div",3),P(1,"translate"),z("click",function(){N(n);let t=l(2).ngIf;return F(t.closeDialog())}),g(2,NVe,4,1,"ng-container",4),b()}if(i&2){let n=l(3);x("data-testid",n.componentId)("aria-label",M(1,3,"Cancel recording")),m(2),c("veltDynamicTemplate",$(8,RVe,n.template,k(5,kVe,n.componentConfigSignal,n.variant),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function LVe(i,o){if(i&1&&(f(0),g(1,FVe,3,14,"div",2),v()),i&2){let n=l().ngIf;m(),c("ngIf",n.countdownStarted)}}function BVe(i,o){if(i&1&&(f(0),g(1,LVe,2,1,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,MVe,n.conditionSignal(),A(1,PVe,n.componentConfigSignal)))}}var zb=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.componentId="velt-recording-preview-steps-dialog-bottom-panel-close",super.initializeComponentConfigSignal(new bn)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogBottomPanelCloseComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogBottomPanelCloseComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","button"),e.setAttribute("aria-label","Close recording preview")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogBottomPanelCloseComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-recording-preview-steps-dialog-bottom-panel-close"]],inputs:{variant:"variant"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["class","velt-recording-preview--bottom-panel-close","role","button","tabindex","0",3,"click",4,"ngIf"],["role","button","tabindex","0",1,"velt-recording-preview--bottom-panel-close",3,"click"],[4,"veltDynamicTemplate"],["aria-hidden","true",1,"velt-recording-preview--close"],["width","16","height","16","viewBox","0 0 16 16","fill","none","xmlns","http://www.w3.org/2000/svg","focusable","false","role","img","aria-hidden","true"],["d","M12 3.99805L4 11.998M4 3.99805L12 11.998","stroke","currentColor","stroke-width","1.33333","stroke-linecap","round","stroke-linejoin","round"]],template:function(t,r){t&1&&g(0,BVe,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},styles:[".velt-recording-preview--close[_ngcontent-%COMP%]{padding:var(--velt-spacing-sm);cursor:pointer;display:flex;color:var(--velt-text-12);transition:all .2s ease}.velt-recording-preview--close[_ngcontent-%COMP%]:hover{color:var(--velt-text-10)}"],changeDetection:0});let i=o;return i})();var VVe=i=>({componentConfigSignal:i}),UVe=(i,o)=>({condition:i,data:o}),jVe=(i,o)=>({componentConfigSignal:i,variant:o}),$Ve=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-recording-preview-steps-dialog-bottom-panel-countdown-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function HVe(i,o){if(i&1&&(_(0,"div",4),ee(1),b()),i&2){let n=l(3).ngIf,e=l();x("data-testid",e.componentId)("aria-label","Recording starts in "+n.countdown+" seconds"),m(),Ce(" ",n.countdown," ")}}function zVe(i,o){if(i&1&&(f(0),g(1,HVe,2,3,"div",3),v()),i&2){let n=l(2).ngIf;m(),c("ngIf",n.countdownStarted)}}function GVe(i,o){if(i&1&&(f(0),g(1,zVe,2,1,"ng-container",2),v()),i&2){let n=l(2);m(),c("veltDynamicTemplate",$(4,$Ve,n.template,k(1,jVe,n.componentConfigSignal,n.variant),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function WVe(i,o){if(i&1&&(f(0),g(1,GVe,2,10,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,UVe,n.conditionSignal(),A(1,VVe,n.componentConfigSignal)))}}var Gb=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.componentId="velt-recording-preview-steps-dialog-bottom-panel-countdown",super.initializeComponentConfigSignal(new bn)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogBottomPanelCountdownComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogBottomPanelCountdownComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogBottomPanelCountdownComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-recording-preview-steps-dialog-bottom-panel-countdown"]],inputs:{variant:"variant"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["class","velt-recording-preview--countdown","role","timer","aria-live","polite",4,"ngIf"],["role","timer","aria-live","polite",1,"velt-recording-preview--countdown"]],template:function(t,r){t&1&&g(0,WVe,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},styles:[".velt-recording-preview--countdown[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;font-size:var(--velt-font-size-sm);font-weight:500;color:var(--velt-text-4)}"],changeDetection:0});let i=o;return i})();var qVe=i=>({componentConfigSignal:i}),YVe=(i,o)=>({condition:i,data:o}),Mz=(i,o)=>({componentConfigSignal:i,variant:o}),kz=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-recording-preview-steps-dialog-bottom-panel-icon-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function KVe(i,o){if(i&1&&(f(0),_(1,"div",5),le(),_(2,"svg",6),w(3,"path",7)(4,"path",8),b()(),v()),i&2){let n=l(5);m(),x("data-testid",n.componentId+"-video")}}function ZVe(i,o){if(i&1&&(f(0),g(1,KVe,5,1,"ng-container",4),v()),i&2){let n=l(4);m(),c("veltDynamicTemplate",$(4,kz,n.template,k(1,Mz,n.componentConfigSignal,n.variant),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function XVe(i,o){if(i&1&&(f(0),_(1,"div",9),le(),_(2,"svg",6),w(3,"path",10),b()(),v()),i&2){let n=l(5);m(),x("data-testid",n.componentId+"-screen")}}function QVe(i,o){if(i&1&&(f(0),g(1,XVe,4,1,"ng-container",4),v()),i&2){let n=l(4);m(),c("veltDynamicTemplate",$(4,kz,n.template,k(1,Mz,n.componentConfigSignal,n.variant),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function JVe(i,o){if(i&1&&(f(0),_(1,"div",11),le(),_(2,"svg",6),w(3,"path",12),b()(),v()),i&2){let n=l(5);m(),x("data-testid",n.componentId+"-audio")}}function eUe(i,o){if(i&1&&(f(0),g(1,JVe,4,1,"ng-container",4),v()),i&2){let n=l(4);m(),c("veltDynamicTemplate",$(4,kz,n.template,k(1,Mz,n.componentConfigSignal,n.variant),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function tUe(i,o){if(i&1&&(f(0)(1,2),_(2,"div"),g(3,ZVe,2,10,"ng-container",3)(4,QVe,2,10,"ng-container",3)(5,eUe,2,10,"ng-container",3),b(),v()()),i&2){let n=l(2).ngIf,e=l();m(),c("ngSwitch",n.type),m(),ue("velt-recording-preview--recording-started",n.countdownStarted),x("data-testid",e.componentId),m(),c("ngSwitchCase","video"),m(),c("ngSwitchCase","screen"),m(),c("ngSwitchCase","audio")}}function nUe(i,o){if(i&1&&(f(0),g(1,tUe,6,7,"ng-container",0),v()),i&2){let n=l().ngIf,e=l();m(),c("ngIf",!e.type||e.type===n.type)}}function iUe(i,o){if(i&1&&(f(0),g(1,nUe,2,1,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,YVe,n.conditionSignal(),A(1,qVe,n.componentConfigSignal)))}}var Wb=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.componentId="velt-recording-preview-steps-dialog-bottom-panel-icon",super.initializeComponentConfigSignal(new bn)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogBottomPanelIconComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogBottomPanelIconComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","img"),e.setAttribute("aria-label",`${this.type||""} recording icon`)}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogBottomPanelIconComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-recording-preview-steps-dialog-bottom-panel-icon"]],inputs:{type:"type",variant:"variant"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[3,"ngSwitch"],[4,"ngSwitchCase"],[4,"veltDynamicTemplate"],["role","img","aria-label","Video recording icon | translate",1,"velt-recording-preview--bottom-panel-icon"],["width","24","height","24","viewBox","0 0 24 24","fill","none","xmlns","http://www.w3.org/2000/svg","focusable","false","aria-hidden","true"],["d","M14.6657 10.2226L18.7128 8.19949C18.8483 8.13179 18.9988 8.09983 19.1501 8.10664C19.3014 8.11346 19.4485 8.15882 19.5773 8.23843C19.7062 8.31803 19.8126 8.42924 19.8864 8.56151C19.9602 8.69377 19.9989 8.8427 19.999 8.99415V15.0066C19.9989 15.1581 19.9602 15.307 19.8864 15.4392C19.8126 15.5715 19.7062 15.6827 19.5773 15.7623C19.4485 15.8419 19.3014 15.8873 19.1501 15.8941C18.9988 15.9009 18.8483 15.869 18.7128 15.8013L14.6657 13.7782V10.2226Z","stroke","white","stroke-width","1.25","stroke-linecap","round","stroke-linejoin","round"],["d","M3.99902 8.44428C3.99902 7.97279 4.18632 7.5206 4.51972 7.1872C4.85312 6.8538 5.30531 6.6665 5.7768 6.6665H12.8879C13.3594 6.6665 13.8116 6.8538 14.145 7.1872C14.4784 7.5206 14.6657 7.97279 14.6657 8.44428V15.5554C14.6657 16.0269 14.4784 16.4791 14.145 16.8125C13.8116 17.1459 13.3594 17.3332 12.8879 17.3332H5.7768C5.30531 17.3332 4.85312 17.1459 4.51972 16.8125C4.18632 16.4791 3.99902 16.0269 3.99902 15.5554V8.44428Z","stroke","white","stroke-width","1.25","stroke-linecap","round","stroke-linejoin","round"],["role","img","aria-label","Screen recording icon | translate",1,"velt-recording-preview--bottom-panel-icon"],["d","M18.5 12.0004V14.1671C18.5 14.3586 18.4239 14.5423 18.2885 14.6778C18.153 14.8132 17.9693 14.8893 17.7778 14.8893H6.22222C6.03068 14.8893 5.84698 14.8132 5.71153 14.6778C5.57609 14.5423 5.5 14.3586 5.5 14.1671V6.94488C5.5 6.75333 5.57609 6.56963 5.71153 6.43419C5.84698 6.29875 6.03068 6.22266 6.22222 6.22266H12.7222M8.38889 17.7782H15.6111M9.83333 14.8893V17.7782M14.1667 14.8893V17.7782M15.6111 6.22266H18.5M18.5 6.22266V9.11155M18.5 6.22266L14.8889 9.83377","stroke","currentColor","stroke-width","1.25","stroke-linecap","round","stroke-linejoin","round"],["role","img","aria-label","Audio recording icon | translate",1,"velt-recording-preview--bottom-panel-icon"],["d","M7 10.4291C7 11.7552 7.52678 13.027 8.46447 13.9647C9.40215 14.9023 10.6739 15.4291 12 15.4291M12 15.4291C13.3261 15.4291 14.5979 14.9023 15.5355 13.9647C16.4732 13.027 17 11.7552 17 10.4291M12 15.4291V18.2863M9.14286 18.2863H14.8571M9.85714 6.8577C9.85714 6.28938 10.0829 5.74434 10.4848 5.34247C10.8866 4.94061 11.4317 4.71484 12 4.71484C12.5683 4.71484 13.1134 4.94061 13.5152 5.34247C13.9171 5.74434 14.1429 6.28938 14.1429 6.8577V10.4291C14.1429 10.9975 13.9171 11.5425 13.5152 11.9444C13.1134 12.3462 12.5683 12.572 12 12.572C11.4317 12.572 10.8866 12.3462 10.4848 11.9444C10.0829 11.5425 9.85714 10.9975 9.85714 10.4291V6.8577Z","stroke","currentColor","stroke-width","1.25","stroke-linecap","round","stroke-linejoin","round"]],template:function(t,r){t&1&&g(0,iUe,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},styles:[".velt-recording-preview--bottom-panel-icon[_ngcontent-%COMP%]{padding:var(--velt-spacing-md);background:var(--velt-accent);border-radius:var(--velt-border-radius-full);display:flex;margin-right:var(--velt-spacing-md);color:var(--velt-accent-foreground)}.velt-recording-preview--recording-started[_ngcontent-%COMP%] .velt-recording-preview--bottom-panel-icon[_ngcontent-%COMP%]{padding:var(--velt-spacing-sm)}"],changeDetection:0});let i=o;return i})();var oUe=i=>({componentConfigSignal:i}),rUe=(i,o)=>({condition:i,data:o}),aUe=(i,o)=>({componentConfigSignal:i,variant:o}),sUe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-recording-preview-steps-dialog-bottom-panel-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function lUe(i,o){if(i&1&&(_(0,"div",6),ee(1),P(2,"translate"),w(3,"app-recording-preview-steps-dialog-bottom-panel-countdown",4),b()),i&2){let n=l(4);x("data-testid",n.componentId+"-countdown"),m(),Ce(" ",M(2,5,"Starting recording in")," "),m(2),c("componentConfigSignal",n.componentConfigSignal)("template",n.template)("variant",n.variant)}}function cUe(i,o){if(i&1&&(f(0),_(1,"div",3),P(2,"translate"),w(3,"app-recording-preview-steps-dialog-bottom-panel-icon",4),g(4,lUe,4,7,"div",5),w(5,"app-recording-preview-steps-dialog-bottom-panel-close",4),b(),v()),i&2){let n=l(2).ngIf,e=l();m(),ue("velt-recording-preview--recording-started",n.countdownStarted),x("data-testid",e.componentId)("aria-label",M(2,11,"Recording preview bottom panel")),m(2),c("componentConfigSignal",e.componentConfigSignal)("template",e.template)("variant",e.variant),m(),c("ngIf",n.countdownStarted),m(),c("componentConfigSignal",e.componentConfigSignal)("template",e.template)("variant",e.variant)}}function dUe(i,o){if(i&1&&(f(0),g(1,cUe,6,13,"ng-container",2),v()),i&2){let n=l(2);m(),c("veltDynamicTemplate",$(4,sUe,n.template,k(1,aUe,n.componentConfigSignal,n.variant),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function mUe(i,o){if(i&1&&(f(0),g(1,dUe,2,10,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,rUe,n.conditionSignal(),A(1,oUe,n.componentConfigSignal)))}}var T0=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.componentId="velt-recording-preview-steps-dialog-bottom-panel",super.initializeComponentConfigSignal(new bn)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogBottomPanelComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogBottomPanelComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","region"),e.setAttribute("aria-label","Recording controls bottom panel")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogBottomPanelComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-recording-preview-steps-dialog-bottom-panel"]],inputs:{variant:"variant"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["role","region",1,"velt-recording-preview--bottom-panel"],[3,"componentConfigSignal","template","variant"],["class","velt-recording-preview--countdown","role","status","aria-live","polite",4,"ngIf"],["role","status","aria-live","polite",1,"velt-recording-preview--countdown"]],template:function(t,r){t&1&&g(0,mUe,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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:fixed;bottom:5%}.velt-recording-preview--bottom-panel[_ngcontent-%COMP%]{opacity:0;animation:_ngcontent-%COMP%_showAfterDelay .4s forwards}@keyframes _ngcontent-%COMP%_showAfterDelay{0%{opacity:0}99%{opacity:0}to{opacity:1}}.velt-recording-preview--recording-started[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;padding:var(--velt-spacing-xs) var(--velt-spacing-md) var(--velt-spacing-xs) var(--velt-spacing-xs);border-radius:var(--velt-border-radius-3xl);border:1px solid var(--velt-border-2);background:var(--velt-background-0);-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px)}.velt-recording-preview--countdown[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;font-size:var(--velt-font-size-sm);font-weight:500;color:var(--velt-text-4);gap:var(--velt-spacing-xs)}"],changeDetection:0});let i=o;return i})();var pUe=["*"],gUe=i=>({componentConfigSignal:i}),uUe=(i,o)=>({condition:i,data:o}),hUe=(i,o)=>({componentConfigSignal:i,variant:o}),fUe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-recording-preview-steps-dialog-button-panel-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function vUe(i,o){i&1&&(f(0),Nt(1),v())}function CUe(i,o){if(i&1&&(_(0,"div",3),P(1,"translate"),g(2,vUe,2,0,"ng-container",4),b()),i&2){let n=l(3);x("data-testid",n.componentId)("aria-label",M(1,4,"Recording control buttons"))("aria-orientation","horizontal"),m(2),c("veltDynamicTemplate",$(9,fUe,n.template,k(6,hUe,n.componentConfigSignal,n.variant),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function _Ue(i,o){if(i&1&&(f(0),g(1,CUe,3,15,"div",2),v()),i&2){let n=l().ngIf;m(),c("ngIf",!n.countdownStarted)}}function yUe(i,o){if(i&1&&(f(0),g(1,_Ue,2,1,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,uUe,n.conditionSignal(),A(1,gUe,n.componentConfigSignal)))}}var D0=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.componentId="velt-recording-preview-steps-dialog-button-panel",super.initializeComponentConfigSignal(new bn)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogButtonPanelComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogButtonPanelComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","toolbar"),e.setAttribute("aria-label","Recording controls")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogButtonPanelComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-recording-preview-steps-dialog-button-panel"]],inputs:{variant:"variant"},standalone:!1,features:[V([S]),B],ngContentSelectors:pUe,decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["class","velt-recording-preview-button-panel","role","toolbar",4,"ngIf"],["role","toolbar",1,"velt-recording-preview-button-panel"],[4,"veltDynamicTemplate"]],template:function(t,r){t&1&&(Bt(),g(0,yUe,2,6,"ng-container",0)),t&2&&c("ngIf",r.componentConfigSignal())},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-recording-preview-button-panel[_ngcontent-%COMP%]{display:flex;align-items:center;gap:var(--velt-spacing-sm);margin-bottom:var(--velt-spacing-lg)}"],changeDetection:0});let i=o;return i})();var SUe=i=>({componentConfigSignal:i}),bUe=(i,o)=>({condition:i,data:o}),IUe=(i,o)=>({componentConfigSignal:i,variant:o}),EUe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-recording-preview-steps-dialog-camera-button-off-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function xUe(i,o){if(i&1&&(f(0),le(),_(1,"svg",3),w(2,"path",4)(3,"path",5),b(),v()),i&2){let n=l(4);m(),x("data-testid",n.componentId+"-icon")}}function TUe(i,o){if(i&1&&(f(0),g(1,xUe,4,1,"ng-container",2),v()),i&2){let n=l(3);m(),c("veltDynamicTemplate",$(4,EUe,n.template,k(1,IUe,n.componentConfigSignal,n.variant),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function DUe(i,o){if(i&1&&(f(0),g(1,TUe,2,10,"ng-container",0),v()),i&2){let n=l().ngIf;m(),c("ngIf",!(n.mediaConfig.video!=null&&n.mediaConfig.video.enabled))}}function wUe(i,o){if(i&1&&(f(0),g(1,DUe,2,1,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,bUe,n.conditionSignal(),A(1,SUe,n.componentConfigSignal)))}}var qb=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.componentId="velt-recording-preview-steps-dialog-camera-button-off",super.initializeComponentConfigSignal(new bn)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogCameraButtonOffComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogCameraButtonOffComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","button"),e.setAttribute("aria-label","Camera off"),e.setAttribute("aria-pressed","true"),e.setAttribute("tabindex","0")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogCameraButtonOffComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["velt-recording-preview-steps-dialog-camera-button-off-internal"]],inputs:{variant:"variant"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["width","28","height","28","viewBox","0 0 28 28","fill","none","xmlns","http://www.w3.org/2000/svg","focusable","false","aria-hidden","true"],["d","M20.9375 17.6068C21.1017 17.5503 21.2442 17.444 21.345 17.3027C21.4459 17.1614 21.5 16.9921 21.5 16.8184V11.1818C21.4999 11.0398 21.4636 10.9002 21.3944 10.7762C21.3252 10.6522 21.2255 10.5479 21.1047 10.4733C20.9839 10.3986 20.846 10.3561 20.7042 10.3497C20.5623 10.3433 20.4212 10.3733 20.2942 10.4368L16.5 12.3334V13.1668V10.6667C16.5 10.2246 16.3244 9.80072 16.0118 9.48816C15.6993 9.17559 15.2754 9 14.8333 9H12.3333M16.5 16.5V17.3333C16.5 17.7754 16.3244 18.1993 16.0118 18.5118C15.6993 18.8244 15.2754 19 14.8333 19H8.16667C7.72464 19 7.30072 18.8244 6.98816 18.5118C6.67559 18.1993 6.5 17.7754 6.5 17.3333V10.6667C6.5 10.2246 6.67559 9.80072 6.98816 9.48816C7.30072 9.17559 7.72464 9 8.16667 9H9","stroke","currentColor","stroke-opacity","0.52","stroke-width","1.5","stroke-linecap","round","stroke-linejoin","round"],["d","M6.5 6.5L21.5 21.5","stroke","#FF7162","stroke-width","1.5","stroke-linecap","round","stroke-linejoin","round"]],template:function(t,r){t&1&&g(0,wUe,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},styles:["[_nghost-%COMP%]{display:flex}"],changeDetection:0});let i=o;return i})();var OUe=i=>({componentConfigSignal:i}),AUe=(i,o)=>({condition:i,data:o}),PUe=(i,o)=>({componentConfigSignal:i,variant:o}),MUe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-recording-preview-steps-dialog-camera-button-on-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function kUe(i,o){if(i&1&&(f(0),le(),_(1,"svg",3),w(2,"path",4)(3,"path",5),b(),v()),i&2){let n=l(4);m(),x("data-testid",n.componentId+"-icon")}}function RUe(i,o){if(i&1&&(f(0),g(1,kUe,4,1,"ng-container",2),v()),i&2){let n=l(3);m(),c("veltDynamicTemplate",$(4,MUe,n.template,k(1,PUe,n.componentConfigSignal,n.variant),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function NUe(i,o){if(i&1&&(f(0),g(1,RUe,2,10,"ng-container",0),v()),i&2){let n=l().ngIf;m(),c("ngIf",n.mediaConfig.video==null?null:n.mediaConfig.video.enabled)}}function FUe(i,o){if(i&1&&(f(0),g(1,NUe,2,1,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,AUe,n.conditionSignal(),A(1,OUe,n.componentConfigSignal)))}}var Yb=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.componentId="velt-recording-preview-steps-dialog-camera-button-on",super.initializeComponentConfigSignal(new bn)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogCameraButtonOnComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogCameraButtonOnComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","button"),e.setAttribute("aria-label","Camera on"),e.setAttribute("aria-pressed","false"),e.setAttribute("tabindex","0")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogCameraButtonOnComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["velt-recording-preview-steps-dialog-camera-button-on-internal"]],inputs:{variant:"variant"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["width","28","height","28","viewBox","0 0 28 28","fill","none","xmlns","http://www.w3.org/2000/svg","focusable","false","aria-hidden","true"],["d","M16.5 12.3334L20.2942 10.4368C20.4212 10.3733 20.5623 10.3433 20.7042 10.3497C20.846 10.3561 20.9839 10.3986 21.1047 10.4733C21.2255 10.5479 21.3252 10.6522 21.3944 10.7762C21.4636 10.9002 21.4999 11.0398 21.5 11.1818V16.8184C21.4999 16.9604 21.4636 17.1 21.3944 17.224C21.3252 17.348 21.2255 17.4523 21.1047 17.5269C20.9839 17.6016 20.846 17.6441 20.7042 17.6505C20.5623 17.6569 20.4212 17.6269 20.2942 17.5634L16.5 15.6668V12.3334Z","stroke","currentColor","stroke-width","1.5","stroke-linecap","round","stroke-linejoin","round"],["d","M6.5 10.6667C6.5 10.2246 6.67559 9.80072 6.98816 9.48816C7.30072 9.17559 7.72464 9 8.16667 9H14.8333C15.2754 9 15.6993 9.17559 16.0118 9.48816C16.3244 9.80072 16.5 10.2246 16.5 10.6667V17.3333C16.5 17.7754 16.3244 18.1993 16.0118 18.5118C15.6993 18.8244 15.2754 19 14.8333 19H8.16667C7.72464 19 7.30072 18.8244 6.98816 18.5118C6.67559 18.1993 6.5 17.7754 6.5 17.3333V10.6667Z","stroke","currentColor","stroke-width","1.5","stroke-linecap","round","stroke-linejoin","round"]],template:function(t,r){t&1&&g(0,FUe,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},styles:["[_nghost-%COMP%]{display:flex}"],changeDetection:0});let i=o;return i})();var LUe=i=>({componentConfigSignal:i}),BUe=(i,o)=>({condition:i,data:o}),VUe=(i,o)=>({componentConfigSignal:i,variant:o}),UUe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-recording-preview-steps-dialog-camera-button-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function jUe(i,o){if(i&1&&(f(0),_(1,"div",6),w(2,"velt-recording-preview-steps-dialog-camera-button-on-internal",7)(3,"velt-recording-preview-steps-dialog-camera-button-off-internal",7),b(),v()),i&2){let n=l(3).ngIf,e=l();m(),ue("velt-recording-preview--icon-button-off",!(n.mediaConfig.video!=null&&n.mediaConfig.video.enabled)),x("data-testid",e.componentId+"-icon-container"),m(),c("componentConfigSignal",e.componentConfigSignal)("template",e.template)("variant",e.variant),m(),c("componentConfigSignal",e.componentConfigSignal)("template",e.template)("variant",e.variant)}}function $Ue(i,o){if(i&1){let n=q();_(0,"app-device-permission-button",3)(1,"div",4),P(2,"translate"),P(3,"translate"),P(4,"translate"),z("click",function(){N(n);let t=l(2).ngIf;return F(t.toggleVideo())}),g(5,jUe,4,9,"ng-container",5),b()()}if(i&2){let n=l(2).ngIf,e=l();c("darkMode",!!n.darkMode),x("data-testid",e.componentId+"-permission-button"),m(),x("data-testid",e.componentId+"-toggle")("aria-label",M(2,6,"Toggle camera")+" "+(n.mediaConfig.video!=null&&n.mediaConfig.video.enabled?M(3,8,"off"):M(4,10,"on")))("aria-pressed",!!(n.mediaConfig.video!=null&&n.mediaConfig.video.enabled)),m(4),c("veltDynamicTemplate",$(15,UUe,e.template,k(12,VUe,e.componentConfigSignal,e.variant),e.variant,e.setIfCondition.bind(e),e.elementRef))}}function HUe(i,o){if(i&1&&(f(0),g(1,$Ue,6,21,"app-device-permission-button",2),v()),i&2){let n=l().ngIf;m(),c("ngIf",n.type==="screen")}}function zUe(i,o){if(i&1&&(f(0),g(1,HUe,2,1,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,BUe,n.conditionSignal(),A(1,LUe,n.componentConfigSignal)))}}var Kb=(()=>{let o=class o extends H{constructor(e,t,r,a){super(r,a,t),this.devicePermissionService=e,this.loggingService=t,this.elementRef=r,this.dynamicDataService=a,this.componentId="velt-recording-preview-steps-dialog-camera-button",super.initializeComponentConfigSignal(new bn)}ngOnChanges(e){try{if(e.componentConfigSignal){let t=this.componentConfigSignal();!t?.mediaState?.video?.enabled&&t.type==="video"&&this.devicePermissionService.openDevicePermissionDeniedDialog("video",{darkMode:!1})}}catch(t){this.loggingService.catch("Error in RecordingPreviewStepsDialogCameraButtonComponent ngOnChanges:",t)}}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes(),!this.componentConfigSignal()?.mediaState?.video?.enabled&&this.componentConfigSignal().type==="video"&&this.devicePermissionService.openDevicePermissionDeniedDialog("video",{darkMode:!1})}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogCameraButtonComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogCameraButtonOnComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","group"),e.setAttribute("aria-label","Camera control buttons")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogCameraButtonComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(Bd),h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["velt-recording-preview-steps-dialog-camera-button-internal"]],inputs:{variant:"variant"},standalone:!1,features:[V([S]),B,Ze],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["type","video",3,"darkMode",4,"ngIf"],["type","video",3,"darkMode"],["role","button","tabindex","0",3,"click"],[4,"veltDynamicTemplate"],[1,"velt-recording-preview--icon-button"],[3,"componentConfigSignal","template","variant"]],template:function(t,r){t&1&&g(0,zUe,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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%]:empty{display:none}.velt-recording-preview--icon-button[_ngcontent-%COMP%]{padding:var(--velt-spacing-md);display:flex;align-items:center;justify-content:center;border-radius:var(--velt-border-radius-3xl);cursor:pointer;border:1.5px solid var(--velt-border-2);background:var(--velt-background-0);color:var(--velt-text-2);transition:all .2s ease}.velt-recording-preview--icon-button[_ngcontent-%COMP%]:hover{border:1.5px solid var(--velt-border-3);background:var(--velt-background-1);color:var(--velt-text-3)}"],changeDetection:0});let i=o;return i})();var sde=i=>({componentConfigSignal:i}),GUe=(i,o)=>({condition:i,data:o}),WUe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-recording-preview-steps-dialog-mic-button-off-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function qUe(i,o){if(i&1&&(f(0),le(),_(1,"svg",3),w(2,"path",4)(3,"path",5),b(),v()),i&2){let n=l(4);m(),x("data-testid",n.componentId+"-icon")}}function YUe(i,o){if(i&1&&(f(0),g(1,qUe,4,1,"ng-container",2),v()),i&2){let n=l(3);m(),c("veltDynamicTemplate",$(3,WUe,n.template,A(1,sde,n.componentConfigSignal),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function KUe(i,o){if(i&1&&(f(0),g(1,YUe,2,9,"ng-container",0),v()),i&2){let n=l().ngIf;m(),c("ngIf",!(n.mediaConfig.audio!=null&&n.mediaConfig.audio.enabled))}}function ZUe(i,o){if(i&1&&(f(0),g(1,KUe,2,1,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,GUe,n.conditionSignal(),A(1,sde,n.componentConfigSignal)))}}var Zb=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.componentId="velt-recording-preview-steps-dialog-mic-button-off",super.initializeComponentConfigSignal(new bn)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogMicButtonOffComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogMicButtonOffComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","button"),e.setAttribute("aria-label","Microphone off"),e.setAttribute("aria-pressed","true"),e.setAttribute("tabindex","0")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogMicButtonOffComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["velt-recording-preview-steps-dialog-mic-button-off-internal"]],inputs:{variant:"variant"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["width","28","height","28","viewBox","0 0 28 28","fill","none","xmlns","http://www.w3.org/2000/svg","focusable","false","aria-hidden","true"],["d","M11.5013 8.1665C11.5013 7.50346 11.7647 6.86758 12.2335 6.39874C12.7024 5.9299 13.3383 5.6665 14.0013 5.6665C14.6643 5.6665 15.3002 5.9299 15.7691 6.39874C16.2379 6.86758 16.5013 7.50346 16.5013 8.1665V12.3332C16.5013 12.58 16.4648 12.8254 16.393 13.0615M14.7263 14.7282C14.3527 14.8414 13.9578 14.8655 13.5732 14.7987C13.1885 14.7318 12.8249 14.5758 12.5114 14.3432C12.198 14.1105 11.9433 13.8077 11.7679 13.459C11.5925 13.1102 11.5012 12.7252 11.5013 12.3348V11.5015M8.16797 12.3332C8.16779 13.386 8.45252 14.4192 8.99198 15.3232C9.53144 16.2273 10.3055 16.9685 11.2321 17.4683C12.1587 17.9681 13.2033 18.2078 14.2551 18.162C15.3069 18.1162 16.3267 17.7866 17.2063 17.2082M18.873 15.5415C19.5012 14.5896 19.835 13.4737 19.833 12.3332M10.668 21.4998H17.3346M14.0013 18.1665V21.4998","stroke","currentColor","stroke-opacity","0.52","stroke-width","1.5","stroke-linecap","round","stroke-linejoin","round"],["d","M6.5 6.5L21.5 21.5","stroke","#FF7162","stroke-width","1.5","stroke-linecap","round","stroke-linejoin","round"]],template:function(t,r){t&1&&g(0,ZUe,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},styles:["[_nghost-%COMP%]{display:flex}"],changeDetection:0});let i=o;return i})();var lde=i=>({componentConfigSignal:i}),XUe=(i,o)=>({condition:i,data:o}),QUe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-recording-preview-steps-dialog-mic-button-on-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function JUe(i,o){if(i&1&&(f(0),le(),_(1,"svg",3),w(2,"path",4),b(),v()),i&2){let n=l(4);m(),x("data-testid",n.componentId+"-icon")}}function eje(i,o){if(i&1&&(f(0),g(1,JUe,3,1,"ng-container",2),v()),i&2){let n=l(3);m(),c("veltDynamicTemplate",$(3,QUe,n.template,A(1,lde,n.componentConfigSignal),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function tje(i,o){if(i&1&&(f(0),g(1,eje,2,9,"ng-container",0),v()),i&2){let n=l().ngIf;m(),c("ngIf",n.mediaConfig.audio==null?null:n.mediaConfig.audio.enabled)}}function nje(i,o){if(i&1&&(f(0),g(1,tje,2,1,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,XUe,n.conditionSignal(),A(1,lde,n.componentConfigSignal)))}}var Xb=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.componentId="velt-recording-preview-steps-dialog-mic-button-on",super.initializeComponentConfigSignal(new bn)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogMicButtonOnComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogMicButtonOnComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","button"),e.setAttribute("aria-label","Microphone on"),e.setAttribute("aria-pressed","false"),e.setAttribute("tabindex","0")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogMicButtonOnComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["velt-recording-preview-steps-dialog-mic-button-on-internal"]],inputs:{variant:"variant"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["width","28","height","28","viewBox","0 0 28 28","fill","none","xmlns","http://www.w3.org/2000/svg","focusable","false","aria-hidden","true"],["d","M8.16699 12.3332C8.16699 13.8803 8.78157 15.364 9.87554 16.458C10.9695 17.5519 12.4532 18.1665 14.0003 18.1665M14.0003 18.1665C15.5474 18.1665 17.0312 17.5519 18.1251 16.458C19.2191 15.364 19.8337 13.8803 19.8337 12.3332M14.0003 18.1665V21.4998M10.667 21.4998H17.3337M11.5003 8.1665C11.5003 7.50346 11.7637 6.86758 12.2326 6.39874C12.7014 5.9299 13.3373 5.6665 14.0003 5.6665C14.6634 5.6665 15.2993 5.9299 15.7681 6.39874C16.2369 6.86758 16.5003 7.50346 16.5003 8.1665V12.3332C16.5003 12.9962 16.2369 13.6321 15.7681 14.1009C15.2993 14.5698 14.6634 14.8332 14.0003 14.8332C13.3373 14.8332 12.7014 14.5698 12.2326 14.1009C11.7637 13.6321 11.5003 12.9962 11.5003 12.3332V8.1665Z","stroke","currentColor","stroke-width","1.5","stroke-linecap","round","stroke-linejoin","round"]],template:function(t,r){t&1&&g(0,nje,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},styles:["[_nghost-%COMP%]{display:flex}"],changeDetection:0});let i=o;return i})();var ije=i=>({componentConfigSignal:i}),oje=(i,o)=>({condition:i,data:o}),rje=(i,o)=>({componentConfigSignal:i,variant:o}),aje=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-recording-preview-steps-dialog-mic-button-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function sje(i,o){if(i&1&&(f(0),_(1,"div",5),w(2,"velt-recording-preview-steps-dialog-mic-button-on-internal",6)(3,"velt-recording-preview-steps-dialog-mic-button-off-internal",6),b(),v()),i&2){let n=l(2).ngIf,e=l();m(),ue("velt-recording-preview--icon-button-off",!(n.mediaConfig.audio!=null&&n.mediaConfig.audio.enabled)),x("data-testid",e.componentId+"-icon-container"),m(),c("componentConfigSignal",e.componentConfigSignal)("template",e.template)("variant",e.variant),m(),c("componentConfigSignal",e.componentConfigSignal)("template",e.template)("variant",e.variant)}}function lje(i,o){if(i&1){let n=q();f(0),_(1,"app-device-permission-button",2)(2,"div",3),P(3,"translate"),P(4,"translate"),P(5,"translate"),z("click",function(){N(n);let t=l().ngIf;return F(t.toggleAudio())})("keydown.enter",function(){N(n);let t=l().ngIf;return F(t.toggleAudio())})("keydown.space",function(){N(n);let t=l().ngIf;return F(t.toggleAudio())}),g(6,sje,4,9,"ng-container",4),b()(),v()}if(i&2){let n=l().ngIf,e=l();m(),c("darkMode",!!n.darkMode),x("data-testid",e.componentId+"-permission-button"),m(),x("data-testid",e.componentId+"-toggle")("aria-label",M(3,6,"Toggle microphone")+" "+(n.mediaConfig.audio!=null&&n.mediaConfig.audio.enabled?M(4,8,"off"):M(5,10,"on")))("aria-pressed",!!(n.mediaConfig.audio!=null&&n.mediaConfig.audio.enabled)),m(4),c("veltDynamicTemplate",$(15,aje,e.template,k(12,rje,e.componentConfigSignal,e.variant),e.variant,e.setIfCondition.bind(e),e.elementRef))}}function cje(i,o){if(i&1&&(f(0),g(1,lje,7,21,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,oje,n.conditionSignal(),A(1,ije,n.componentConfigSignal)))}}var w0=(()=>{let o=class o extends H{constructor(e,t,r,a){super(r,a,t),this.devicePermissionService=e,this.loggingService=t,this.elementRef=r,this.dynamicDataService=a,this.componentId="velt-recording-preview-steps-dialog-mic-button",super.initializeComponentConfigSignal(new bn)}ngOnChanges(e){try{if(e.componentConfigSignal){let t=this.componentConfigSignal();!t?.mediaState?.audio?.enabled&&t.type==="audio"&&this.devicePermissionService.openDevicePermissionDeniedDialog("audio",{darkMode:!1})}}catch(t){this.loggingService.catch("Error in RecordingPreviewStepsDialogMicButtonComponent ngOnChanges:",t)}}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes(),!this.componentConfigSignal()?.mediaState?.audio?.enabled&&this.componentConfigSignal().type==="audio"&&this.devicePermissionService.openDevicePermissionDeniedDialog("audio",{darkMode:!1})}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogMicButtonComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogMicButtonOnComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","group"),e.setAttribute("aria-label","Microphone control buttons")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogMicButtonComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(Bd),h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["velt-recording-preview-steps-dialog-mic-button-internal"]],inputs:{variant:"variant"},standalone:!1,features:[V([S]),B,Ze],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["type","audio",3,"darkMode"],["role","button","tabindex","0",3,"click","keydown.enter","keydown.space"],[4,"veltDynamicTemplate"],[1,"velt-recording-preview--icon-button"],[3,"componentConfigSignal","template","variant"]],template:function(t,r){t&1&&g(0,cje,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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-recording-preview--icon-button[_ngcontent-%COMP%]{padding:var(--velt-spacing-md);display:flex;align-items:center;justify-content:center;border-radius:var(--velt-border-radius-3xl);cursor:pointer;border:1.5px solid var(--velt-border-2);background:var(--velt-background-0);color:var(--velt-text-2);transition:all .2s ease}.velt-recording-preview--icon-button[_ngcontent-%COMP%]:hover{border:1.5px solid var(--velt-border-3);background:var(--velt-background-1);color:var(--velt-text-3)}"],changeDetection:0});let i=o;return i})();var cde=i=>({componentConfigSignal:i}),dje=(i,o)=>({condition:i,data:o}),mje=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-recording-preview-steps-dialog-settings-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function pje(i,o){if(i&1&&(f(0),_(1,"div",5),le(),_(2,"svg",6),w(3,"path",7)(4,"path",8),b()(),v()),i&2){let n=l(4);m(),x("data-testid",n.componentId+"-icon-container"),m(),x("data-testid",n.componentId+"-icon")}}function gje(i,o){if(i&1){let n=q();_(0,"div",3),P(1,"translate"),P(2,"translate"),P(3,"translate"),z("click",function(t){N(n);let r=l(2).ngIf;return F(r.toggleSettings(t))})("keydown.enter",function(t){N(n);let r=l(2).ngIf;return F(r.toggleSettings(t))})("keydown.space",function(t){N(n);let r=l(2).ngIf;return F(r.toggleSettings(t))}),g(4,pje,5,2,"ng-container",4),b()}if(i&2){let n=l(2).ngIf,e=l();ue("velt-recording-preview--settings-button-open",n.isSettingsOpen),x("data-testid",e.componentId+"-button")("aria-label",(n.isSettingsOpen?M(1,7,"Close"):M(2,9,"Open"))+" "+M(3,11,"recording settings"))("aria-expanded",n.isSettingsOpen)("aria-controls",e.componentId+"-panel"),m(4),c("veltDynamicTemplate",$(15,mje,e.template,A(13,cde,e.componentConfigSignal),e.variant,e.setIfCondition.bind(e),e.elementRef))}}function uje(i,o){if(i&1&&(f(0),g(1,gje,5,21,"div",2),v()),i&2){let n=l().ngIf;m(),c("ngIf",!n.countdownStarted)}}function hje(i,o){if(i&1&&(f(0),g(1,uje,2,1,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,dje,n.conditionSignal(),A(1,cde,n.componentConfigSignal)))}}var O0=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.componentId="velt-recording-preview-steps-dialog-settings",super.initializeComponentConfigSignal(new bn)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogSettingsComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogSettingsComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","region"),e.setAttribute("aria-label","Recording preview settings")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogSettingsComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-recording-preview-steps-dialog-settings"]],inputs:{variant:"variant"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["role","button","tabindex","0",3,"velt-recording-preview--settings-button-open","click","keydown.enter","keydown.space",4,"ngIf"],["role","button","tabindex","0",3,"click","keydown.enter","keydown.space"],[4,"veltDynamicTemplate"],[1,"velt-recording-preview--settings-button"],["width","24","height","24","viewBox","0 0 24 24","fill","none","xmlns","http://www.w3.org/2000/svg","focusable","false","aria-hidden","true"],["d","M10.325 4.317C10.751 2.561 13.249 2.561 13.675 4.317C13.7389 4.5808 13.8642 4.82578 14.0407 5.032C14.2172 5.23822 14.4399 5.39985 14.6907 5.50375C14.9414 5.60764 15.2132 5.65085 15.4838 5.62987C15.7544 5.60889 16.0162 5.5243 16.248 5.383C17.791 4.443 19.558 6.209 18.618 7.753C18.4769 7.98466 18.3924 8.24634 18.3715 8.51677C18.3506 8.78721 18.3938 9.05877 18.4975 9.30938C18.6013 9.55999 18.7627 9.78258 18.9687 9.95905C19.1747 10.1355 19.4194 10.2609 19.683 10.325C21.439 10.751 21.439 13.249 19.683 13.675C19.4192 13.7389 19.1742 13.8642 18.968 14.0407C18.7618 14.2172 18.6001 14.4399 18.4963 14.6907C18.3924 14.9414 18.3491 15.2132 18.3701 15.4838C18.3911 15.7544 18.4757 16.0162 18.617 16.248C19.557 17.791 17.791 19.558 16.247 18.618C16.0153 18.4769 15.7537 18.3924 15.4832 18.3715C15.2128 18.3506 14.9412 18.3938 14.6906 18.4975C14.44 18.6013 14.2174 18.7627 14.0409 18.9687C13.8645 19.1747 13.7391 19.4194 13.675 19.683C13.249 21.439 10.751 21.439 10.325 19.683C10.2611 19.4192 10.1358 19.1742 9.95929 18.968C9.7828 18.7618 9.56011 18.6001 9.30935 18.4963C9.05859 18.3924 8.78683 18.3491 8.51621 18.3701C8.24559 18.3911 7.98375 18.4757 7.752 18.617C6.209 19.557 4.442 17.791 5.382 16.247C5.5231 16.0153 5.60755 15.7537 5.62848 15.4832C5.64942 15.2128 5.60624 14.9412 5.50247 14.6906C5.3987 14.44 5.23726 14.2174 5.03127 14.0409C4.82529 13.8645 4.58056 13.7391 4.317 13.675C2.561 13.249 2.561 10.751 4.317 10.325C4.5808 10.2611 4.82578 10.1358 5.032 9.95929C5.23822 9.7828 5.39985 9.56011 5.50375 9.30935C5.60764 9.05859 5.65085 8.78683 5.62987 8.51621C5.60889 8.24559 5.5243 7.98375 5.383 7.752C4.443 6.209 6.209 4.442 7.753 5.382C8.753 5.99 10.049 5.452 10.325 4.317Z","stroke","currentColor","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"],["d","M9 12C9 12.7956 9.31607 13.5587 9.87868 14.1213C10.4413 14.6839 11.2044 15 12 15C12.7956 15 13.5587 14.6839 14.1213 14.1213C14.6839 13.5587 15 12.7956 15 12C15 11.2044 14.6839 10.4413 14.1213 9.87868C13.5587 9.31607 12.7956 9 12 9C11.2044 9 10.4413 9.31607 9.87868 9.87868C9.31607 10.4413 9 11.2044 9 12Z","stroke","currentColor","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"]],template:function(t,r){t&1&&g(0,hje,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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-recording-preview--settings-button[_ngcontent-%COMP%]{padding:var(--velt-spacing-md);display:flex;align-items:center;justify-content:center;border-radius:var(--velt-border-radius-full);cursor:pointer;border:1.5px solid var(--velt-border-2);background:var(--velt-background-0);color:var(--velt-text-2);transition:all .2s ease}.velt-recording-preview--settings-button[_ngcontent-%COMP%]:hover{border:1.5px solid var(--velt-border-3);background:var(--velt-background-1);color:var(--velt-text-3)}.velt-recording-preview--settings-button-open[_ngcontent-%COMP%]{background:var(--velt-background-0);border-radius:var(--velt-border-radius-full)}.velt-recording-preview--settings-button-open[_ngcontent-%COMP%] .velt-recording-preview--settings-button[_ngcontent-%COMP%]{color:var(--velt-accent);border:1.5px solid var(--velt-accent-transparent);background:var(--velt-accent-transparent)}"],changeDetection:0});let i=o;return i})();var dde=i=>({componentConfigSignal:i}),fje=(i,o)=>({condition:i,data:o}),vje=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-recording-preview-steps-dialog-start-recording-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function Cje(i,o){if(i&1&&(f(0),_(1,"div",4),ee(2),P(3,"translate"),b(),v()),i&2){let n=l(3);m(),x("data-testid",n.componentId+"-label"),m(),Ce(" ",M(3,2,"Start Recording"),"")}}function _je(i,o){if(i&1){let n=q();f(0),_(1,"div",2),z("click",function(){N(n);let t=l().ngIf;return F(t.startCountdown())}),g(2,Cje,4,4,"ng-container",3),b(),v()}if(i&2){let n=l().ngIf,e=l();m(),ue("disabled",n.type==="video"&&(!(n.mediaConfig.video!=null&&n.mediaConfig.video.enabled)||!n.mediaState.video.enabled)||n.type==="audio"&&(!(n.mediaConfig.audio!=null&&n.mediaConfig.audio.enabled)||!n.mediaState.audio.enabled)),x("data-testid",e.componentId+"-button"),m(),c("veltDynamicTemplate",$(6,vje,e.template,A(4,dde,e.componentConfigSignal),e.variant,e.setIfCondition.bind(e),e.elementRef))}}function yje(i,o){if(i&1&&(f(0),g(1,_je,3,12,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,fje,n.conditionSignal(),A(1,dde,n.componentConfigSignal)))}}var A0=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.componentId="velt-recording-preview-steps-dialog-start-recording",super.initializeComponentConfigSignal(new bn)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogStartRecordingComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogStartRecordingComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","region"),e.setAttribute("aria-label","Start recording")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogStartRecordingComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-recording-preview-steps-dialog-start-recording"]],inputs:{variant:"variant"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["role","button","tabindex","0",3,"click"],[4,"veltDynamicTemplate"],[1,"velt-recording-preview-start-button"]],template:function(t,r){t&1&&g(0,yje,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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-recording-preview-start-button[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;gap:var(--velt-spacing-sm);padding:var(--velt-spacing-lg) var(--velt-spacing-2xl);font-size:var(--velt-font-size-sm);font-weight:600;transition:all .2s ease;cursor:pointer;width:fit-content;border-radius:var(--velt-border-radius-full);background:var(--velt-accent);color:var(--velt-accent-foreground)}.velt-recording-preview-start-button[_ngcontent-%COMP%]:hover{background:var(--velt-accent-hover)}.disabled[_ngcontent-%COMP%]{opacity:.5;pointer-events:none}"],changeDetection:0});let i=o;return i})();var Sje=i=>({componentConfigSignal:i}),bje=(i,o)=>({condition:i,data:o}),Ije=(i,o)=>({componentConfigSignal:i,variant:o}),Eje=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-recording-preview-steps-dialog-camera-off-message-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function xje(i,o){if(i&1&&(f(0),_(1,"h1",5),P(2,"translate"),ee(3),P(4,"translate"),b(),v()),i&2){let n=l(4);m(),x("data-testid",n.componentId+"-text")("aria-label",M(2,3,"Camera is off")),m(2),ze(M(4,5,"Camera is off"))}}function Tje(i,o){if(i&1&&(_(0,"div",3),g(1,xje,5,7,"ng-container",4),b()),i&2){let n=l(3);x("data-testid",n.componentId),m(),c("veltDynamicTemplate",$(5,Eje,n.template,k(2,Ije,n.componentConfigSignal,n.variant),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function Dje(i,o){if(i&1&&(f(0),g(1,Tje,2,11,"div",2),v()),i&2){let n=l().ngIf;m(),c("ngIf",!n.countdownStarted&&(!(n.mediaConfig.video!=null&&n.mediaConfig.video.enabled)||!n.mediaState.video.enabled))}}function wje(i,o){if(i&1&&(f(0),g(1,Dje,2,1,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,bje,n.conditionSignal(),A(1,Sje,n.componentConfigSignal)))}}var Qb=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.componentId="velt-recording-preview-steps-dialog-camera-off-message",super.initializeComponentConfigSignal(new bn)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogCameraOffMessageComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogCameraOffMessageComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","alert"),e.setAttribute("aria-live","polite"),e.setAttribute("aria-atomic","true")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogCameraOffMessageComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-recording-preview-steps-dialog-camera-off-message"]],inputs:{variant:"variant"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["role","alert","aria-live","polite","aria-atomic","true",4,"ngIf"],["role","alert","aria-live","polite","aria-atomic","true"],[4,"veltDynamicTemplate"],[1,"velt-recording-preview-camera-off-message"]],template:function(t,r){t&1&&g(0,wje,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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-recording-preview-camera-off-message[_ngcontent-%COMP%]{font-size:var(--velt-font-size-lg);color:var(--velt-text-0);margin:0}"],changeDetection:0});let i=o;return i})();var mde=i=>({componentConfigSignal:i}),Oje=(i,o)=>({condition:i,data:o}),Aje=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-recording-preview-steps-dialog-close-button-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function Pje(i,o){if(i&1&&(f(0),_(1,"div",4),le(),_(2,"svg",5),w(3,"path",6),b()(),v()),i&2){let n=l(3);m(),x("data-testid",n.componentId+"-icon-container"),m(),x("data-testid",n.componentId+"-icon")}}function Mje(i,o){if(i&1){let n=q();f(0),_(1,"div",2),P(2,"translate"),z("click",function(){N(n);let t=l().ngIf;return F(t.closeDialog())})("keydown.enter",function(){N(n);let t=l().ngIf;return F(t.closeDialog())})("keydown.space",function(){N(n);let t=l().ngIf;return F(t.closeDialog())}),g(3,Pje,4,2,"ng-container",3),b(),v()}if(i&2){let n=l(2);m(),x("data-testid",n.componentId)("aria-label",M(2,3,"Close recording preview")),m(2),c("veltDynamicTemplate",$(7,Aje,n.template,A(5,mde,n.componentConfigSignal),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function kje(i,o){if(i&1&&(f(0),g(1,Mje,4,13,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,Oje,n.conditionSignal(),A(1,mde,n.componentConfigSignal)))}}var P0=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.componentId="velt-recording-preview-steps-dialog-close-button",super.initializeComponentConfigSignal(new bn)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogCloseButtonComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogCameraOffMessageComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","button"),e.setAttribute("aria-label","Close recording preview"),e.setAttribute("tabindex","0")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogCloseButtonComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-recording-preview-steps-dialog-close-button"]],inputs:{variant:"variant"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["role","button","tabindex","0",3,"click","keydown.enter","keydown.space"],[4,"veltDynamicTemplate"],[1,"velt-recording-preview--icon-button"],["width","24","height","24","viewBox","0 0 24 24","fill","none","xmlns","http://www.w3.org/2000/svg","focusable","false","aria-hidden","true",1,"velt-cursor-pointer"],["fill-rule","evenodd","clip-rule","evenodd","d","M5.29289 5.29289C5.68342 4.90237 6.31658 4.90237 6.70711 5.29289L12 10.5858L17.2929 5.29289C17.6834 4.90237 18.3166 4.90237 18.7071 5.29289C19.0976 5.68342 19.0976 6.31658 18.7071 6.70711L13.4142 12L18.7071 17.2929C19.0976 17.6834 19.0976 18.3166 18.7071 18.7071C18.3166 19.0976 17.6834 19.0976 17.2929 18.7071L12 13.4142L6.70711 18.7071C6.31658 19.0976 5.68342 19.0976 5.29289 18.7071C4.90237 18.3166 4.90237 17.6834 5.29289 17.2929L10.5858 12L5.29289 6.70711C4.90237 6.31658 4.90237 5.68342 5.29289 5.29289Z","fill","#fff"]],template:function(t,r){t&1&&g(0,kje,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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-recording-preview--icon-button[_ngcontent-%COMP%]{padding:var(--velt-spacing-md);display:flex;align-items:center;justify-content:center;border-radius:var(--velt-border-radius-3xl);cursor:pointer;border:1.5px solid var(--velt-border-3);background:var(--velt-background-1);transition:all .2s ease}.velt-recording-preview--icon-button[_ngcontent-%COMP%] svg[_ngcontent-%COMP%] path[_ngcontent-%COMP%]{fill:var(--velt-text-4)}.velt-recording-preview--icon-button[_ngcontent-%COMP%]:hover{border:1.5px solid var(--velt-border-4);background:var(--velt-background-2)}"],changeDetection:0});let i=o;return i})();var pde=i=>({componentConfigSignal:i}),Rje=(i,o)=>({condition:i,data:o}),Nje=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-recording-preview-steps-dialog-timer-cancel-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function Fje(i,o){if(i&1&&(f(0),_(1,"div",4),ee(2),P(3,"translate"),b(),v()),i&2){let n=l(3);m(),x("data-testid",n.componentId+"-label"),m(),Ce(" ",M(3,2,"Cancel")," ")}}function Lje(i,o){if(i&1){let n=q();f(0),_(1,"div",2),z("click",function(){N(n);let t=l().ngIf;return F(t.cancelCountdown())})("keydown.enter",function(){N(n);let t=l().ngIf;return F(t.cancelCountdown())})("keydown.space",function(){N(n);let t=l().ngIf;return F(t.cancelCountdown())}),g(2,Fje,4,4,"ng-container",3),b(),v()}if(i&2){let n=l(2);m(),x("data-testid",n.componentId+"-button"),m(),c("veltDynamicTemplate",$(4,Nje,n.template,A(2,pde,n.componentConfigSignal),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function Bje(i,o){if(i&1&&(f(0),g(1,Lje,3,10,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,Rje,n.conditionSignal(),A(1,pde,n.componentConfigSignal)))}}var Jb=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.componentId="velt-recording-preview-steps-dialog-timer-cancel",super.initializeComponentConfigSignal(new bn)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogTimerCancelComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogTimerCancelComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","region"),e.setAttribute("aria-label","Recording countdown cancel controls")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogTimerCancelComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-recording-preview-steps-dialog-timer-cancel"]],inputs:{variant:"variant"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["role","button","tabindex","0",1,"velt-recording-preview-timer--cancel-button",3,"click","keydown.enter","keydown.space"],[4,"veltDynamicTemplate"],[1,"velt-recording-preview-timer--cancel-button"]],template:function(t,r){t&1&&g(0,Bje,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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;bottom:15%}.velt-recording-preview-timer--cancel-button[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;gap:var(--velt-spacing-sm);font-weight:500;font-size:var(--velt-font-size-md);line-height:24px;color:var(--velt-error);text-transform:uppercase;letter-spacing:1.5px;cursor:pointer}.velt-recording-preview-timer--cancel-button[_ngcontent-%COMP%]:hover{color:var(--velt-error-hover)}"],changeDetection:0});let i=o;return i})();var gde=i=>({componentConfigSignal:i}),Vje=(i,o)=>({condition:i,data:o}),Uje=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-recording-preview-steps-dialog-timer-countdown-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function jje(i,o){if(i&1&&(_(0,"h1",4),ee(1),b()),i&2){let n=l(3).ngIf,e=l();x("data-testid",e.componentId+"-value"),m(),Ce(" ",n.countdown,"")}}function $je(i,o){if(i&1&&(f(0),g(1,jje,2,2,"h1",3),v()),i&2){let n=l(2).ngIf;m(),c("ngIf",n.countdown)}}function Hje(i,o){if(i&1&&(f(0),g(1,$je,2,1,"ng-container",2),v()),i&2){let n=l(2);m(),c("veltDynamicTemplate",$(3,Uje,n.template,A(1,gde,n.componentConfigSignal),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function zje(i,o){if(i&1&&(f(0),g(1,Hje,2,9,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,Vje,n.conditionSignal(),A(1,gde,n.componentConfigSignal)))}}var e2=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.componentId="velt-recording-preview-steps-dialog-timer-countdown",super.initializeComponentConfigSignal(new bn)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogTimerCountdownComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogTimerCountdownComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","timer"),e.setAttribute("aria-label","Recording countdown timer"),e.setAttribute("aria-live","assertive")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogTimerCountdownComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-recording-preview-steps-dialog-timer-countdown"]],inputs:{variant:"variant"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["class","velt-recording-preview-timer--countdown","role","timer","aria-live","assertive",4,"ngIf"],["role","timer","aria-live","assertive",1,"velt-recording-preview-timer--countdown"]],template:function(t,r){t&1&&g(0,zje,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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}.velt-recording-preview-timer--countdown[_ngcontent-%COMP%]{font-size:120px;line-height:120px;font-weight:600;color:var(--velt-text-5);margin:0}"],changeDetection:0});let i=o;return i})();var ude=i=>({componentConfigSignal:i}),Gje=(i,o)=>({condition:i,data:o}),Wje=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-recording-preview-steps-dialog-timer-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function qje(i,o){if(i&1&&(f(0),_(1,"div",3),w(2,"app-recording-preview-steps-dialog-timer-countdown",4)(3,"app-recording-preview-steps-dialog-timer-cancel",4),b(),v()),i&2){let n=l(4);m(),x("data-testid",n.componentId),m(),c("componentConfigSignal",n.componentConfigSignal)("template",n.template)("variant",n.variant),m(),c("componentConfigSignal",n.componentConfigSignal)("template",n.template)("variant",n.variant)}}function Yje(i,o){if(i&1&&(f(0),g(1,qje,4,7,"ng-container",2),v()),i&2){let n=l(3);m(),c("veltDynamicTemplate",$(3,Wje,n.template,A(1,ude,n.componentConfigSignal),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function Kje(i,o){if(i&1&&(f(0),g(1,Yje,2,9,"ng-container",0),v()),i&2){let n=l().ngIf;m(),c("ngIf",n.countdownStarted)}}function Zje(i,o){if(i&1&&(f(0),g(1,Kje,2,1,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,Gje,n.conditionSignal(),A(1,ude,n.componentConfigSignal)))}}var M0=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.componentId="velt-recording-preview-steps-dialog-timer",super.initializeComponentConfigSignal(new bn)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogTimerComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogTimerComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","region"),e.setAttribute("aria-label","Recording countdown section")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogTimerComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-recording-preview-steps-dialog-timer"]],inputs:{variant:"variant"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["role","region","aria-live","polite",1,"velt-recording-preview-dialog-timer"],[3,"componentConfigSignal","template","variant"]],template:function(t,r){t&1&&g(0,Zje,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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%]:empty{display:none}.velt-recording-preview-dialog-timer[_ngcontent-%COMP%]{position:relative;width:332px;height:332px;display:flex;align-items:center;justify-content:center;gap:var(--velt-spacing-lg);border-radius:100%;flex-direction:column;border:2px solid var(--velt-border-transparent);background:var(--velt-background-transparent);-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px)}"],changeDetection:0});let i=o;return i})();var Xje=i=>({componentConfigSignal:i}),Qje=(i,o)=>({condition:i,data:o}),Jje=(i,o)=>({componentConfigSignal:i,variant:o}),e$e=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-recording-preview-steps-dialog-video-player-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function t$e(i,o){if(i&1&&(f(0),w(1,"video",3),v()),i&2){let n=l(2).ngIf,e=l();m(),c("srcObject",n.mediaStream)("volume",0),x("data-testid",e.componentId)}}function n$e(i,o){if(i&1&&(f(0),g(1,t$e,2,3,"ng-container",2),v()),i&2){let n=l(2);m(),c("veltDynamicTemplate",$(4,e$e,n.template,k(1,Jje,n.componentConfigSignal,n.variant),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function i$e(i,o){if(i&1&&(f(0),g(1,n$e,2,10,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,Qje,n.conditionSignal(),A(1,Xje,n.componentConfigSignal)))}}var t2=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.componentId="velt-recording-preview-steps-dialog-video-player",super.initializeComponentConfigSignal(new bn)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogVideoPlayerComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogVideoPlayerComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","region"),e.setAttribute("aria-label","Video preview")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogVideoPlayerComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-recording-preview-steps-dialog-video-player"]],inputs:{variant:"variant"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["id","player","autoplay","","muted","true","playsinline","","webkit-playsinline","true","x-webkit-airplay","allow","disablePictureInPicture","","role","application","aria-live","polite",1,"flip","velt-recording-preview-video--player",3,"srcObject","volume"]],template:function(t,r){t&1&&g(0,i$e,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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:block;width:100%}video[_ngcontent-%COMP%]{width:100%;z-index:9999}.velt-recording-preview-video--player[_ngcontent-%COMP%]{object-fit:cover}"],changeDetection:0});let i=o;return i})();var o$e=i=>({componentConfigSignal:i}),r$e=(i,o)=>({condition:i,data:o}),a$e=()=>["video","screen"],s$e=(i,o)=>({componentConfigSignal:i,variant:o}),l$e=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-recording-preview-steps-dialog-video-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function c$e(i,o){i&1&&Ve(0)}function d$e(i,o){if(i&1&&(_(0,"velt-shadow-dom-internal"),g(1,c$e,1,0,"ng-container",5),b()),i&2){l();let n=ce(3);m(),c("ngTemplateOutlet",n)}}function m$e(i,o){if(i&1&&(f(0),w(1,"app-recording-preview-steps-dialog-video-player",9),_(2,"div",10)(3,"div",11),w(4,"app-recording-preview-steps-dialog-waveform",9)(5,"app-recording-preview-steps-dialog-close-button",12),b(),w(6,"app-recording-preview-steps-dialog-timer",12)(7,"app-recording-preview-steps-dialog-camera-off-message",12),_(8,"div",13),w(9,"velt-recording-preview-steps-dialog-settings-panel-internal",9),_(10,"app-recording-preview-steps-dialog-button-panel",12),w(11,"app-recording-preview-steps-dialog-start-recording",12)(12,"velt-recording-preview-steps-dialog-mic-button-internal",12)(13,"velt-recording-preview-steps-dialog-camera-button-internal",12)(14,"app-recording-preview-steps-dialog-settings",12),b(),w(15,"app-recording-preview-steps-dialog-bottom-panel",12),b()(),v()),i&2){let n=l(5);m(),c("componentConfigSignal",n.componentConfigSignal),m(),x("data-testid",n.componentId+"-overlay"),m(),x("data-testid",n.componentId+"-header"),m(),c("componentConfigSignal",n.componentConfigSignal),m(),c("componentConfigSignal",n.componentConfigSignal)("template",n.template)("variant",n.variant),m(),c("componentConfigSignal",n.componentConfigSignal)("template",n.template)("variant",n.variant),m(),c("componentConfigSignal",n.componentConfigSignal)("template",n.template)("variant",n.variant),m(),x("data-testid",n.componentId+"-settings"),m(),c("componentConfigSignal",n.componentConfigSignal),m(),c("componentConfigSignal",n.componentConfigSignal)("template",n.template)("variant",n.variant),m(),c("componentConfigSignal",n.componentConfigSignal)("template",n.template)("variant",n.variant),m(),c("componentConfigSignal",n.componentConfigSignal)("template",n.template)("variant",n.variant),m(),c("componentConfigSignal",n.componentConfigSignal)("template",n.template)("variant",n.variant),m(),c("componentConfigSignal",n.componentConfigSignal)("template",n.template)("variant",n.variant),m(),c("componentConfigSignal",n.componentConfigSignal)("template",n.template)("variant",n.variant)}}function p$e(i,o){if(i&1){let n=q();_(0,"div",7,1),z("pointerdown",function(t){return N(n),F(t.stopPropagation())})("pointerup",function(t){return N(n),F(t.stopPropagation())})("click",function(t){N(n);let r=l(3).ngIf;return F(r.handleOverlayClick(t))}),g(2,m$e,16,33,"ng-container",8),b()}if(i&2){let n=l(4);x("data-testid",n.componentId),m(2),c("veltDynamicTemplate",$(5,l$e,n.template,k(2,s$e,n.componentConfigSignal,n.variant),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function g$e(i,o){if(i&1&&g(0,p$e,3,11,"div",6),i&2){let n=l(2).ngIf;c("ngIf",Ot(1,a$e).includes(n.type))}}function u$e(i,o){if(i&1&&(f(0),g(1,d$e,2,1,"velt-shadow-dom-internal",4)(2,g$e,1,2,"ng-template",null,0,Ee),v()),i&2){let n=ce(3),e=l().ngIf,t=l();m(),c("ngIf",e.shadowDom&&!t.template)("ngIfElse",n)}}function h$e(i,o){if(i&1&&(f(0),g(1,u$e,4,2,"ng-container",3),v()),i&2){let n=l();m(),c("veltIf",k(3,r$e,n.conditionSignal(),A(1,o$e,n.componentConfigSignal)))}}var n2=(()=>{let o=class o extends H{constructor(e,t,r,a){super(r,a,e),this.loggingService=e,this.wireframeService=t,this.elementRef=r,this.dynamicDataService=a,this.componentId="velt-recording-preview-steps-dialog-video",super.initializeComponentConfigSignal(new bn)}ngOnInit(){try{this.loggingService.log("%c[WB] Calling FUNCTION: ngOnInit","color: green;");let e="velt-recording-preview-steps-dialog-video-wireframe";super.ngOnInit(),this.setupA11yAttributes(),this.variant&&(e+=`---${this.variant}`),this.wireframeService.getWireframe$(e).subscribe(t=>{if(t){let r=document.createElement(t.tagName);r.innerHTML=t.innerHTML,this.template=r}})}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogVideoComponent OnInit: ",e)}}ngOnChanges(e){try{e&&Object.keys(e).forEach(t=>{this.componentConfigSignal.update(r=>(r=T(I({},r),{[t]:e[t].currentValue}),r))})}catch(t){this.loggingService.catch("Error in RecordingPreviewStepsDialogVideoComponent ngOnChanges: ",t)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogVideoComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","region"),e.setAttribute("aria-label","Video preview area")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogVideoComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(He),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-recording-preview-steps-dialog-video"]],inputs:{variant:"variant"},standalone:!1,features:[V([S]),B,Ze],decls:1,vars:1,consts:[["videoDialogRef",""],["recordingPreviewDialogRef",""],[4,"ngIf"],[4,"veltIf"],[4,"ngIf","ngIfElse"],[4,"ngTemplateOutlet"],["role","dialog","class","velt-recording-preview-video",3,"pointerdown","pointerup","click",4,"ngIf"],["role","dialog",1,"velt-recording-preview-video",3,"pointerdown","pointerup","click"],[4,"veltDynamicTemplate"],[3,"componentConfigSignal"],["role","region","aria-label","Video controls overlay",1,"velt-recording-preview-video--overlay"],["role","region","aria-label","Video header controls",1,"velt-recording-preview-video--header"],[3,"componentConfigSignal","template","variant"],["role","region","aria-label","Recording settings and controls",1,"velt-recording-preview-video--settings"]],template:function(t,r){t&1&&g(0,h$e,2,6,"ng-container",2),t&2&&c("ngIf",r.componentConfigSignal())},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%;height:100%}.velt-recording-preview-video[_ngcontent-%COMP%], .velt-recording-preview-video--header[_ngcontent-%COMP%]{display:flex}.velt-recording-preview-video[_ngcontent-%COMP%]{position:relative;background:var(--velt-background-0);flex-direction:column;align-items:center;overflow:hidden;border-radius:var(--velt-border-radius-lg);width:calc((50rem + 0px) * var(--velt-base-rem-unit));height:calc((30rem + 0px) * var(--velt-base-rem-unit));max-width:calc(.8 * var(--legacy-velt-viewport-width))}@media screen and (max-width: 768px){.velt-recording-preview-video[_ngcontent-%COMP%]{width:calc((35rem + 0px) * var(--velt-base-rem-unit));height:calc((25rem + 0px) * var(--velt-base-rem-unit));max-width:calc(.8 * var(--legacy-velt-viewport-width))}}@media screen and (max-width: 425px){ .snippyly-recording-preview-steps-dialog{width:calc(1 * var(--legacy-velt-viewport-width));max-width:calc(1 * var(--legacy-velt-viewport-width))} .snippyly-recording-preview-steps-dialog mat-dialog-container .mat-mdc-dialog-surface.mdc-dialog__surface{width:calc(1 * var(--legacy-velt-viewport-width));height:calc(1 * var(--legacy-velt-viewport-height));border-radius:calc((0rem + 0px) * var(--velt-base-rem-unit))} .snippyly-recording-preview-steps-dialog mat-dialog-container .velt-recording-preview-video{width:calc(1 * var(--legacy-velt-viewport-width));height:calc(1 * var(--legacy-velt-viewport-height));max-width:calc(1 * var(--legacy-velt-viewport-width));border-radius:calc((0rem + 0px) * var(--velt-base-rem-unit))} .snippyly-recording-preview-steps-dialog mat-dialog-container .velt-recording-preview-video video{height:100%}}.velt-recording-preview-video--overlay[_ngcontent-%COMP%]{display:flex;flex-direction:column;justify-content:space-between;align-items:center;padding:var(--velt-spacing-2xl);content:"";position:absolute;border-radius:var(--velt-border-radius-lg);z-index:1;inset:0}.velt-recording-preview-video--header[_ngcontent-%COMP%]{justify-content:space-between;width:100%;gap:calc((.5rem + 0px) * var(--velt-base-rem-unit));align-items:flex-start}.velt-recording-preview-video--settings[_ngcontent-%COMP%]{width:366px;display:flex;flex-direction:column;gap:var(--velt-spacing-lg);align-items:center;justify-content:center;position:relative}'],changeDetection:0});let i=o;return i})();var hde=i=>({componentConfigSignal:i}),f$e=(i,o)=>({condition:i,data:o}),v$e=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-recording-preview-steps-dialog-settings-panel-wireframe",variant:n,setIfCondition:e,componentElementRef:t,replaceTemplate:!1}),C$e=()=>["video","screen"];function _$e(i,o){if(i&1&&(f(0),w(1,"velt-media-source-settings-internal",3),P(2,"translate"),v()),i&2){let n=l(2).ngIf;m(),c("showMicSettings",!0)("shadowDom",n.shadowDom)("showCamSettings",Ot(8,C$e).includes(n.type))("isOpen",n.isSettingsOpen)("config",n),x("aria-label",M(2,6,"Media source settings"))}}function y$e(i,o){if(i&1&&(f(0),g(1,_$e,3,9,"ng-container",2),v()),i&2){let n=l(2);m(),c("veltDynamicTemplate",$(3,v$e,n.template,A(1,hde,n.componentConfigSignal),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function S$e(i,o){if(i&1&&(f(0),g(1,y$e,2,9,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,f$e,n.conditionSignal(),A(1,hde,n.componentConfigSignal)))}}var k0=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.componentId="velt-recording-preview-steps-dialog-settings-panel",super.initializeComponentConfigSignal(new bn)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogSettingsPanelComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogSettingsPanelComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","dialog"),e.setAttribute("aria-label","Recording settings panel"),e.setAttribute("aria-modal","true"),e.setAttribute("tabindex","-1"),this.componentConfigSignal().isSettingsOpen?e.setAttribute("aria-hidden","false"):e.setAttribute("aria-hidden","true")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogSettingsPanelComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["velt-recording-preview-steps-dialog-settings-panel-internal"]],inputs:{variant:"variant"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["role","group",3,"showMicSettings","shadowDom","showCamSettings","isOpen","config"]],template:function(t,r){t&1&&g(0,S$e,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},encapsulation:2,changeDetection:0});let i=o;return i})();var b$e=i=>({componentConfigSignal:i}),I$e=(i,o)=>({condition:i,data:o}),E$e=(i,o)=>({componentConfigSignal:i,variant:o}),x$e=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-recording-preview-steps-dialog-waveform-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function T$e(i,o){if(i&1&&(f(0),w(1,"app-audio-waveform",3),v()),i&2){let n=l(2).ngIf,e=l();m(),c("variant",n.type==="audio"?"preview":"preview-mini")("previewStream",e.streamSignal())("muteMic",!(n.mediaConfig.audio!=null&&n.mediaConfig.audio.enabled)),x("data-testid",e.componentId)}}function D$e(i,o){if(i&1&&(f(0),g(1,T$e,2,4,"ng-container",2),v()),i&2){let n=l(2);m(),c("veltDynamicTemplate",$(4,x$e,n.template,k(1,E$e,n.componentConfigSignal,n.variant),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function w$e(i,o){if(i&1&&(f(0),g(1,D$e,2,10,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,I$e,n.conditionSignal(),A(1,b$e,n.componentConfigSignal)))}}var R0=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.streamSignal=xe(null),this.componentId="velt-recording-preview-steps-dialog-waveform",super.initializeComponentConfigSignal(new bn)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes(),this.setupAudioElements()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogWaveformComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy(),this.cleanupAudio()}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogWaveformComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","img"),e.setAttribute("aria-label","Audio waveform visualization"),e.setAttribute("aria-live","polite")}catch(e){this.loggingService.catch("Error in RecordingPreviewStepsDialogWaveformComponent setupA11yAttributes:",e)}}setupAudioElements(){return Q(this,null,function*(){try{this.audioContext=new AudioContext,this.streamSignal.set(yield navigator.mediaDevices.getUserMedia({audio:!0}))}catch(e){this.loggingService.catch("Error accessing the microphone",e)}})}cleanupAudio(){try{this.audioContext&&(this.audioContext.close(),this.audioContext=null);let e=this.streamSignal();e&&(e.getTracks().forEach(t=>t.stop()),this.streamSignal.set(null))}catch(e){this.loggingService.catch("Error cleaning up audio resources:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-recording-preview-steps-dialog-waveform"]],inputs:{variant:"variant"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["role","img","aria-live","polite",3,"variant","previewStream","muteMic"]],template:function(t,r){t&1&&g(0,w$e,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},encapsulation:2,changeDetection:0});let i=o;return i})();var fde=i=>({componentConfigSignal:i}),O$e=(i,o)=>({condition:i,data:o}),A$e=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-text-comment-toolbar-comment-annotation-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function P$e(i,o){i&1&&(_(0,"div",5),le(),_(1,"svg",6),w(2,"path",7),b()())}function M$e(i,o){if(i&1){let n=q();_(0,"div",3),P(1,"translate"),z("pointerdown",function(t){return N(n),l(2).ngIf.createAnnotation(),F(t.stopPropagation())}),g(2,P$e,3,0,"div",4),b()}if(i&2){let n=l(3);x("data-testid",n.componentId)("role","button")("aria-label",M(1,5,"Add comment annotation"))("tabindex",0),m(2),c("veltDynamicTemplate",$(9,A$e,n.template,A(7,fde,n.componentConfigSignal),n.componentConfigSignal().variant,n.setIfCondition.bind(n),n.elementRef))}}function k$e(i,o){if(i&1&&(f(0),g(1,M$e,3,15,"div",2),v()),i&2){let n=l().ngIf;m(),c("ngIf",n.commentToolEnabled)}}function R$e(i,o){if(i&1&&(f(0),g(1,k$e,2,1,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,O$e,n.conditionSignal(),A(1,fde,n.componentConfigSignal)))}}var i2=(()=>{let o=class o extends Je{constructor(e,t,r,a,s){super(e,t,void 0,r,r.getTextCommentToolbarDarkMode$(),s,a),this.elementRef=e,this.themeService=t,this.commentService=r,this.loggingService=a,this.dynamicDataService=s,this.componentId="velt-text-comment-toolbar-comment-annotation",super.initializeComponentConfigSignal(new As)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in TextCommentToolbarCommentAnnotationComponent ngOnInit:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","button"),e.setAttribute("aria-label","Add comment annotation"),e.setAttribute("tabindex","0")}catch(e){this.loggingService.catch("Error in TextCommentToolbarCommentAnnotationComponent setupA11yAttributes:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch{}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(qe),h(De),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-text-comment-toolbar-comment-annotation"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[3,"pointerdown",4,"ngIf"],[3,"pointerdown"],["class","velt-cursor-pointer velt-text-comment-toolbar-comment-annotation",4,"veltDynamicTemplate"],[1,"velt-cursor-pointer","velt-text-comment-toolbar-comment-annotation"],["width","32","height","32","viewBox","0 0 32 32","fill","none","xmlns","http://www.w3.org/2000/svg","role","img","aria-hidden","true","focusable","false"],["fill-rule","evenodd","clip-rule","evenodd","d","M17.7608 6.03888C21.6888 6.64595 24.7153 9.3481 25.7503 13.1722C26.0832 14.4028 26.0832 16.5981 25.7503 17.8287C24.8136 21.2897 22.3047 23.7986 18.8437 24.7353C18.1546 24.9217 17.6783 24.9695 16.5154 24.9685C14.9367 24.9672 14.1823 24.8254 12.8496 24.2792L12.1364 23.9869L9.93697 24.5342C7.8786 25.0464 7.71866 25.071 7.44436 24.917C6.90064 24.6118 6.90443 24.3818 7.49147 22.0353L8.03021 19.8823L7.73729 19.1677C7.19053 17.8336 7.04867 17.0796 7.04737 15.5005C7.0464 14.3376 7.09415 13.8613 7.28063 13.1722C8.21127 9.73361 10.737 7.1939 14.1308 6.28405C14.9298 6.06985 17.0392 5.92745 17.7608 6.03888ZM14.2233 8.05664C12.9452 8.46912 12.019 9.04056 11.0373 10.0223C9.57907 11.4805 8.85364 13.0991 8.75174 15.1214C8.68947 16.3572 8.85884 17.3544 9.31582 18.4435C9.47381 18.8201 9.65855 19.2624 9.72624 19.4266C9.82922 19.6761 9.78471 19.9865 9.45432 21.3204C9.23688 22.1979 9.06827 22.9251 9.07953 22.9364C9.09079 22.9476 9.81796 22.779 10.6955 22.5616C12.0294 22.2312 12.3398 22.1867 12.5893 22.2897C12.7535 22.3573 13.1958 22.5421 13.5724 22.7001C14.6615 23.1571 15.6587 23.3264 16.8945 23.2642C18.9168 23.1623 20.5354 22.4368 21.9936 20.9786C22.968 20.0042 23.5361 19.0878 23.9685 17.7926C24.2112 17.0656 24.2457 16.7805 24.2457 15.5005C24.2457 14.2204 24.2112 13.9353 23.9685 13.2083C23.5361 11.9132 22.968 10.9967 21.9936 10.0223C20.3414 8.37025 18.566 7.66777 16.2447 7.74769C15.3595 7.77823 14.8403 7.8575 14.2233 8.05664Z","fill","currentColor"]],template:function(t,r){t&1&&g(0,R$e,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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%]:empty{display:none}.velt-text-comment-toolbar-comment-annotation[_ngcontent-%COMP%]{display:flex;color:var(--velt-accent-text)}"],changeDetection:0});let i=o;return i})();var vde=i=>({componentConfigSignal:i}),N$e=(i,o)=>({condition:i,data:o}),F$e=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-text-comment-toolbar-copywriter-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function L$e(i,o){if(i&1&&(_(0,"div",11),ee(1),P(2,"translate"),P(3,"translate"),b()),i&2){let n=l(3).ngIf;m(),Ce(" ",n.selectedCharactersCount>n.MAX_ALLOWED_CHARACTERS_COUNT?M(2,1,"Select a shorter text"):M(3,3,"Select a longer text")," ")}}function B$e(i,o){if(i&1&&(_(0,"div",4),g(1,L$e,4,5,"div",5),le(),_(2,"svg",6)(3,"g",7),w(4,"path",8),b(),_(5,"defs")(6,"clipPath",9),w(7,"rect",10),b()()(),ee(8),P(9,"translate"),b()),i&2){let n=l(2).ngIf;m(),c("ngIf",n.selectedWordsCount<n.MIN_ALLOWED_WORDS_COUNT||n.selectedCharactersCount<n.MIN_ALLOWED_CHARACTERS_COUNT||n.selectedCharactersCount>n.MAX_ALLOWED_CHARACTERS_COUNT),m(7),Ce(" ",M(9,2,"Rewrite")," ")}}function V$e(i,o){if(i&1){let n=q();f(0),_(1,"div",2),P(2,"translate"),z("pointerdown",function(t){return N(n),l().ngIf.createRewriter("copywriter"),F(t.stopPropagation())}),g(3,B$e,10,4,"div",3),b(),v()}if(i&2){let n=l().ngIf,e=l();m(),ue("velt-text-comment-toolbar-copywriter--disabled",n.selectedWordsCount<n.MIN_ALLOWED_WORDS_COUNT||n.selectedCharactersCount<n.MIN_ALLOWED_CHARACTERS_COUNT||n.selectedCharactersCount>n.MAX_ALLOWED_CHARACTERS_COUNT),x("data-testid",e.componentId)("role","button")("aria-label",M(2,8,"Use AI to rewrite selected text"))("tabindex",0)("aria-disabled",n.selectedWordsCount<n.MIN_ALLOWED_WORDS_COUNT||n.selectedCharactersCount<n.MIN_ALLOWED_CHARACTERS_COUNT||n.selectedCharactersCount>n.MAX_ALLOWED_CHARACTERS_COUNT),m(2),c("veltDynamicTemplate",$(12,F$e,e.template,A(10,vde,e.componentConfigSignal),n.variant,e.setIfCondition.bind(e),e.elementRef))}}function U$e(i,o){if(i&1&&(f(0),g(1,V$e,4,18,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,N$e,n.conditionSignal(),A(1,vde,n.componentConfigSignal)))}}var o2=(()=>{let o=class o extends Je{constructor(e,t,r,a,s){super(e,t,void 0,r,r.getTextCommentToolbarDarkMode$(),s,a),this.elementRef=e,this.themeService=t,this.commentService=r,this.loggingService=a,this.dynamicDataService=s,this.componentId="velt-text-comment-toolbar-copywriter",super.initializeComponentConfigSignal(new As)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in TextCommentToolbarCopywriterComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in TextCommentToolbarCopywriterComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","button"),e.setAttribute("aria-label","Rewrite text with copywriter"),e.setAttribute("tabindex","0");let t=this.componentConfigSignal(),r=t.selectedWordsCount<t.MIN_ALLOWED_WORDS_COUNT||t.selectedCharactersCount<t.MIN_ALLOWED_CHARACTERS_COUNT||t.selectedCharactersCount>t.MAX_ALLOWED_CHARACTERS_COUNT;e.setAttribute("aria-disabled",String(r))}catch(e){this.loggingService.catch("Error in TextCommentToolbarCopywriterComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(qe),h(De),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-text-comment-toolbar-copywriter"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[3,"pointerdown"],["class","velt-text-comment-toolbar-copywriter s-tooltip s-tooltip-light",4,"veltDynamicTemplate"],[1,"velt-text-comment-toolbar-copywriter","s-tooltip","s-tooltip-light"],["class","s-tooltiptext","role","tooltip",4,"ngIf"],["width","16","height","16","viewBox","0 0 16 16","fill","none","xmlns","http://www.w3.org/2000/svg","role","img","aria-hidden","true","focusable","false",1,"velt-text-comment-toolbar-copywriter--svg"],["clip-path","url(#clip0_3311_3365)"],["d","M6.49994 15.9999C6.34193 16.0007 6.18743 15.9533 6.05709 15.8639C5.92676 15.7746 5.8268 15.6476 5.77057 15.4999L4.52557 12.2624C4.50035 12.1972 4.46178 12.1379 4.41232 12.0885C4.36286 12.039 4.30362 12.0004 4.23838 11.9752L0.999941 10.7293C0.852423 10.6727 0.725541 10.5727 0.63604 10.4424C0.546538 10.3122 0.498626 10.1579 0.498626 9.99991C0.498626 9.8419 0.546538 9.68761 0.63604 9.55739C0.725541 9.42717 0.852423 9.32716 0.999941 9.27054L4.23744 8.02554C4.30268 8.00032 4.36193 7.96175 4.41138 7.91229C4.46084 7.86284 4.49941 7.80359 4.52463 7.73835L5.77057 4.49991C5.82718 4.3524 5.9272 4.22551 6.05742 4.13601C6.18764 4.04651 6.34193 3.9986 6.49994 3.9986C6.65795 3.9986 6.81225 4.04651 6.94246 4.13601C7.07268 4.22551 7.1727 4.3524 7.22932 4.49991L8.47432 7.73741C8.49953 7.80265 8.5381 7.8619 8.58756 7.91136C8.63702 7.96081 8.69627 7.99939 8.7615 8.0246L11.9803 9.26304C12.1338 9.31994 12.266 9.42278 12.359 9.55754C12.452 9.6923 12.5012 9.85244 12.4999 10.0162C12.4976 10.1714 12.4486 10.3224 12.3595 10.4495C12.2703 10.5767 12.1451 10.6741 11.9999 10.7293L8.76244 11.9743C8.6972 11.9995 8.63795 12.0381 8.5885 12.0875C8.53904 12.137 8.50047 12.1962 8.47525 12.2615L7.22932 15.4999C7.17308 15.6476 7.07312 15.7746 6.94279 15.8639C6.81245 15.9533 6.65796 16.0007 6.49994 15.9999ZM2.74994 5.49991C2.6573 5.49991 2.56684 5.47184 2.49047 5.4194C2.4141 5.36696 2.35541 5.29262 2.32213 5.20616L1.79525 3.83616C1.78383 3.8062 1.76621 3.77899 1.74354 3.75632C1.72086 3.73364 1.69365 3.71602 1.66369 3.7046L0.293691 3.17773C0.207247 3.14444 0.132915 3.08574 0.0804885 3.00937C0.0280618 2.933 0 2.84255 0 2.74991C0 2.65728 0.0280618 2.56682 0.0804885 2.49045C0.132915 2.41408 0.207247 2.35539 0.293691 2.3221L1.66369 1.79523C1.69362 1.78375 1.72081 1.76611 1.74347 1.74345C1.76614 1.72078 1.78378 1.6936 1.79525 1.66366L2.31744 0.305851C2.34689 0.225914 2.39757 0.155514 2.46402 0.102216C2.53048 0.0489189 2.6102 0.0147393 2.69463 0.00335107C2.79599 -0.00897073 2.89856 0.0128976 2.98608 0.0654883C3.0736 0.118079 3.14105 0.198382 3.17775 0.293664L3.70463 1.66366C3.7161 1.6936 3.73374 1.72078 3.75641 1.74345C3.77908 1.76611 3.80626 1.78375 3.83619 1.79523L5.20619 2.3221C5.29263 2.35539 5.36697 2.41408 5.41939 2.49045C5.47182 2.56682 5.49988 2.65728 5.49988 2.74991C5.49988 2.84255 5.47182 2.933 5.41939 3.00937C5.36697 3.08574 5.29263 3.14444 5.20619 3.17773L3.83619 3.7046C3.80623 3.71602 3.77902 3.73364 3.75635 3.75632C3.73367 3.77899 3.71605 3.8062 3.70463 3.83616L3.17775 5.20616C3.14447 5.29262 3.08578 5.36696 3.00941 5.4194C2.93304 5.47184 2.84258 5.49991 2.74994 5.49991ZM12.4999 7.99991C12.3989 7.99988 12.3002 7.96923 12.2169 7.91199C12.1336 7.85475 12.0696 7.77362 12.0334 7.67929L11.3196 5.82398C11.3071 5.79128 11.2878 5.76159 11.263 5.73683C11.2383 5.71207 11.2086 5.69278 11.1759 5.68023L9.32057 4.96648C9.22631 4.93016 9.14526 4.86614 9.0881 4.78286C9.03094 4.69957 9.00034 4.60093 9.00034 4.49991C9.00034 4.3989 9.03094 4.30026 9.0881 4.21697C9.14526 4.13369 9.22631 4.06967 9.32057 4.03335L11.1759 3.3196C11.2086 3.30705 11.2383 3.28776 11.263 3.263C11.2878 3.23823 11.3071 3.20854 11.3196 3.17585L12.0281 1.33366C12.0604 1.24655 12.1158 1.16983 12.1882 1.11167C12.2607 1.0535 12.3476 1.01607 12.4396 1.00335C12.5502 0.989962 12.6621 1.0139 12.7576 1.07136C12.8531 1.12883 12.9266 1.21652 12.9665 1.32054L13.6803 3.17585C13.6928 3.20854 13.7121 3.23823 13.7369 3.263C13.7616 3.28776 13.7913 3.30705 13.824 3.3196L15.6793 4.03335C15.7736 4.06967 15.8546 4.13369 15.9118 4.21697C15.9689 4.30026 15.9995 4.3989 15.9995 4.49991C15.9995 4.60093 15.9689 4.69957 15.9118 4.78286C15.8546 4.86614 15.7736 4.93016 15.6793 4.96648L13.824 5.68023C13.7913 5.69278 13.7616 5.71207 13.7369 5.73683C13.7121 5.76159 13.6928 5.79128 13.6803 5.82398L12.9665 7.67929C12.9302 7.77362 12.8663 7.85475 12.783 7.91199C12.6997 7.96923 12.601 7.99988 12.4999 7.99991Z","fill","currentColor"],["id","clip0_3311_3365"],["width","16","height","16","fill","currentColor"],["role","tooltip",1,"s-tooltiptext"]],template:function(t,r){t&1&&g(0,U$e,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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%]:empty{display:none}.velt-text-comment-toolbar-copywriter[_ngcontent-%COMP%]{background:var(--velt-background-2);border-radius:var(--velt-border-radius-full);padding:var(--velt-spacing-2xs) var(--velt-spacing-md);cursor:pointer;color:var(--velt-text-4);display:flex;align-items:center;gap:var(--velt-spacing-sm);font-size:var(--velt-font-size-sm);font-style:normal;font-weight:400;line-height:normal}.velt-text-comment-toolbar-copywriter[_ngcontent-%COMP%] .velt-text-comment-toolbar-copywriter--svg[_ngcontent-%COMP%]{color:var(--velt-accent-text);padding:var(--velt-spacing-xs)}.velt-text-comment-toolbar-copywriter.velt-text-comment-toolbar-copywriter--disabled[_ngcontent-%COMP%]{cursor:not-allowed;color:var(--velt-gray)}"],changeDetection:0});let i=o;return i})();var Cde=i=>({componentConfigSignal:i}),j$e=(i,o)=>({condition:i,data:o}),$$e=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-text-comment-toolbar-generic-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function H$e(i,o){if(i&1&&(_(0,"div",15),ee(1),P(2,"translate"),P(3,"translate"),b()),i&2){let n=l(3).ngIf;m(),Ce(" ",n.selectedCharactersCount>n.MAX_ALLOWED_CHARACTERS_COUNT?M(2,1,"Select a shorter text"):M(3,3,"Select a longer text")," ")}}function z$e(i,o){if(i&1&&(_(0,"div",4),g(1,H$e,4,5,"div",5),le(),_(2,"svg",6),w(3,"path",7)(4,"path",8)(5,"path",9)(6,"path",10)(7,"path",11)(8,"path",12)(9,"path",13)(10,"path",14),b(),ee(11),P(12,"translate"),b()),i&2){let n=l(2).ngIf;m(),c("ngIf",n.selectedWordsCount<n.MIN_ALLOWED_WORDS_COUNT||n.selectedCharactersCount<n.MIN_ALLOWED_CHARACTERS_COUNT||n.selectedCharactersCount>n.MAX_ALLOWED_CHARACTERS_COUNT),m(10),Ce(" ",M(12,2,"Ask ChatGPT")," ")}}function G$e(i,o){if(i&1){let n=q();f(0),_(1,"div",2),z("pointerdown",function(t){return N(n),l().ngIf.createRewriter("generic"),F(t.stopPropagation())}),g(2,z$e,13,4,"div",3),b(),v()}if(i&2){let n=l().ngIf,e=l();m(),ue("velt-text-comment-toolbar-generic--disabled",n.selectedWordsCount<n.MIN_ALLOWED_WORDS_COUNT||n.selectedCharactersCount<n.MIN_ALLOWED_CHARACTERS_COUNT||n.selectedCharactersCount>n.MAX_ALLOWED_CHARACTERS_COUNT),x("data-testid",e.componentId)("role","separator")("aria-orientation","vertical"),m(),c("veltDynamicTemplate",$(8,$$e,e.template,A(6,Cde,e.componentConfigSignal),n.variant,e.setIfCondition.bind(e),e.elementRef))}}function W$e(i,o){if(i&1&&(f(0),g(1,G$e,3,14,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,j$e,n.conditionSignal(),A(1,Cde,n.componentConfigSignal)))}}var r2=(()=>{let o=class o extends Je{constructor(e,t,r,a,s){super(e,t,void 0,r,r.getTextCommentToolbarDarkMode$(),s,a),this.elementRef=e,this.themeService=t,this.commentService=r,this.loggingService=a,this.dynamicDataService=s,this.componentId="velt-text-comment-toolbar-divider",super.initializeComponentConfigSignal(new As)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in TextCommentToolbarDividerComponent ngOnInit:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","separator"),e.setAttribute("aria-orientation","vertical")}catch(e){this.loggingService.catch("Error in TextCommentToolbarDividerComponent setupA11yAttributes:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in TextCommentToolbarGenericComponent ngOnDestroy:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(qe),h(De),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-text-comment-toolbar-generic"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[3,"pointerdown"],["class","velt-text-comment-toolbar-generic s-tooltip s-tooltip-light",4,"veltDynamicTemplate"],[1,"velt-text-comment-toolbar-generic","s-tooltip","s-tooltip-light"],["class","s-tooltiptext",4,"ngIf"],["width","24","height","24","viewBox","0 0 24 24","fill","none","xmlns","http://www.w3.org/2000/svg","role","presentation","aria-hidden","true","focusable","false",1,"velt-text-comment-toolbar-generic--svg"],["fill-rule","evenodd","clip-rule","evenodd","d","M20 6H4C2.89543 6 2 6.89543 2 8V16C2 17.1046 2.89543 18 4 18H20C21.1046 18 22 17.1046 22 16V8C22 6.89543 21.1046 6 20 6ZM4 4C1.79086 4 0 5.79086 0 8V16C0 18.2091 1.79086 20 4 20H20C22.2091 20 24 18.2091 24 16V8C24 5.79086 22.2091 4 20 4H4Z","fill","currentColor"],["d","M16 10C16 9.44772 16.4477 9 17 9H19C19.5523 9 20 9.44772 20 10C20 10.5523 19.5523 11 19 11H17C16.4477 11 16 10.5523 16 10Z","fill","currentColor"],["d","M4 14C4 13.4477 4.44772 13 5 13C5.55228 13 6 13.4477 6 14C6 14.5523 5.55228 15 5 15C4.44772 15 4 14.5523 4 14Z","fill","currentColor"],["d","M8 14C8 13.4477 8.44772 13 9 13H15C15.5523 13 16 13.4477 16 14C16 14.5523 15.5523 15 15 15H9C8.44772 15 8 14.5523 8 14Z","fill","currentColor"],["d","M19 13C18.4477 13 18 13.4477 18 14C18 14.5523 18.4477 15 19 15C19.5523 15 20 14.5523 20 14C20 13.4477 19.5523 13 19 13Z","fill","currentColor"],["d","M13 9C12.4477 9 12 9.44772 12 10C12 10.5523 12.4477 11 13 11C13.5523 11 14 10.5523 14 10C14 9.44772 13.5523 9 13 9Z","fill","currentColor"],["d","M8 10C8 9.44772 8.44772 9 9 9C9.55228 9 10 9.44772 10 10C10 10.5523 9.55228 11 9 11C8.44772 11 8 10.5523 8 10Z","fill","currentColor"],["d","M5 9C4.44772 9 4 9.44772 4 10C4 10.5523 4.44772 11 5 11C5.55228 11 6 10.5523 6 10C6 9.44772 5.55228 9 5 9Z","fill","currentColor"],[1,"s-tooltiptext"]],template:function(t,r){t&1&&g(0,W$e,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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%]:empty{display:none}.velt-text-comment-toolbar-generic[_ngcontent-%COMP%]{background:var(--velt-background-2);border-radius:var(--velt-border-radius-full);padding:var(--velt-spacing-2xs) var(--velt-spacing-md);cursor:pointer;color:var(--velt-text-4);display:flex;align-items:center;gap:var(--velt-spacing-sm);font-size:var(--velt-font-size-sm);font-style:normal;font-weight:400;line-height:normal}.velt-text-comment-toolbar-generic[_ngcontent-%COMP%] .velt-text-comment-toolbar-generic--svg[_ngcontent-%COMP%]{color:var(--velt-accent-text)}.velt-text-comment-toolbar-generic.velt-text-comment-toolbar-generic--disabled[_ngcontent-%COMP%]{cursor:not-allowed;color:var(--velt-gray)}"],changeDetection:0});let i=o;return i})();var q$e=i=>({componentConfigSignal:i}),Y$e=(i,o)=>({condition:i,data:o}),K$e=i=>({componentConfig:i}),Z$e=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-text-comment-toolbar-divider-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function X$e(i,o){if(i&1&&(_(0,"div",3),le(),_(1,"svg",4),w(2,"rect",5),b()()),i&2){let n=l(4);x("data-testid",n.componentId)("role","separator")("aria-orientation","vertical")}}function Q$e(i,o){if(i&1&&(f(0),g(1,X$e,3,3,"div",2),v()),i&2){let n=l(2).ngIf,e=l();m(),c("veltDynamicTemplate",$(3,Z$e,e.template,A(1,K$e,n),n.variant,e.setIfCondition.bind(e),e.elementRef))}}function J$e(i,o){if(i&1&&(f(0),g(1,Q$e,2,9,"ng-container",0),v()),i&2){let n=l().ngIf;m(),c("ngIf",n.commentToolEnabled)}}function eHe(i,o){if(i&1&&(f(0),g(1,J$e,2,1,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,Y$e,n.conditionSignal(),A(1,q$e,n.componentConfigSignal)))}}var a2=(()=>{let o=class o extends Je{constructor(e,t,r,a,s){super(e,t,void 0,r,r.getTextCommentToolbarDarkMode$(),s,a),this.elementRef=e,this.themeService=t,this.commentService=r,this.loggingService=a,this.dynamicDataService=s,this.componentId="velt-text-comment-toolbar-divider",super.initializeComponentConfigSignal(new As)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in TextCommentToolbarDividerComponent ngOnInit:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","separator"),e.setAttribute("aria-orientation","vertical")}catch(e){this.loggingService.catch("Error in TextCommentToolbarDividerComponent setupA11yAttributes:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in TextCommentToolbarDividerComponent ngOnDestroy:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(qe),h(De),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-text-comment-toolbar-divider"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["class","velt-text-comment-toolbar-divider",4,"veltDynamicTemplate"],[1,"velt-text-comment-toolbar-divider"],["width","1","height","16","viewBox","0 0 1 16","fill","none","xmlns","http://www.w3.org/2000/svg","role","presentation","aria-hidden","true","focusable","false"],["x","1","y","0.5","width","15","height","0.999999","rx","0.5","transform","rotate(90 1 0.5)","fill","currentColor"]],template:function(t,r){t&1&&g(0,eHe,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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%]:empty{display:none}.velt-text-comment-toolbar-divider[_ngcontent-%COMP%]{display:flex;color:var(--velt-border-4)}"],changeDetection:0});let i=o;return i})();var Hm=class{constructor(){this.annotations=[],this.unresolvedAnnotationsCount=0,this.showAvatar=!0,this.unreadCount=0,this.commentCountType=hj.TOTAL,this.selectedAnnotationsMap={},this.customStatusesShown=!1,this.selectedAnnotationsLocationMap={},this.commentPinSelected=!1,this.groupMatchedComments=!1}};var tHe=i=>({componentConfigSignal:i}),nHe=(i,o)=>({condition:i,data:o}),iHe=(i,o)=>({componentConfigSignal:i,wireframe:o}),oHe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-bubble-avatar-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function rHe(i,o){if(i&1&&(f(0),w(1,"snippyly-user-avatar",3),v()),i&2){let n=l(3).ngIf,e=l();m(),c("user",n==null||n.annotation==null?null:n.annotation.from),x("data-testid",e.componentId+"-user")}}function aHe(i,o){if(i&1&&(f(0),g(1,rHe,2,2,"ng-container",0),v()),i&2){let n=l(2).ngIf;m(),c("ngIf",(n==null?null:n.showAvatar)&&(n==null||n.annotation==null?null:n.annotation.from))}}function sHe(i,o){if(i&1&&(f(0),g(1,aHe,2,1,"ng-container",2),v()),i&2){let n=l().ngIf,e=l();m(),c("veltDynamicTemplate",$(4,oHe,e.template,k(1,iHe,e.componentConfigSignal,e.wireframe),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function lHe(i,o){if(i&1&&(f(0),g(1,sHe,2,10,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,nHe,n.conditionSignal(),A(1,tHe,n.componentConfigSignal)))}}var s2=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-comment-bubble-avatar",super.initializeComponentConfigSignal(new Hm)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentBubbleAvatarComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentBubbleAvatarComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","img"),e.setAttribute("aria-label","Comment author avatar")}catch(e){this.loggingService.catch("Error in CommentBubbleAvatarComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-bubble-avatar"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["part","user-avatar",3,"user"]],template:function(t,r){t&1&&g(0,lHe,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},encapsulation:2,changeDetection:0});let i=o;return i})();var cHe=i=>({componentConfigSignal:i}),dHe=(i,o)=>({condition:i,data:o}),mHe=(i,o)=>({componentConfigSignal:i,wireframe:o}),pHe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-bubble-comments-count-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function gHe(i,o){if(i&1&&(f(0),ee(1),v()),i&2){let n=l(2).ngIf;m(),Ce(" ",(n==null?null:n.unresolvedAnnotationsCount)||0," ")}}function uHe(i,o){if(i&1&&(f(0),g(1,gHe,2,1,"ng-container",1),v()),i&2){let n=l().ngIf;m(),c("ngIf",n==null?null:n.unresolvedAnnotationsCount)}}function hHe(i,o){if(i&1&&(f(0),ee(1),v()),i&2){let n=l(2).ngIf;m(),Ce(" ",n.commentCountType==="total"?(n==null||n.annotation==null||n.annotation.comments==null?null:n.annotation.comments.length)||0:n.unreadCount||0," ")}}function fHe(i,o){if(i&1&&g(0,hHe,2,1,"ng-container",1),i&2){let n=l().ngIf;c("ngIf",n.commentCountType==="total"&&(n==null||n.annotation==null||n.annotation.comments==null?null:n.annotation.comments.length)||n.commentCountType!=="total"&&n.unreadCount)}}function vHe(i,o){if(i&1&&(f(0),g(1,uHe,2,1,"ng-container",4)(2,fHe,1,1,"ng-template",null,0,Ee),v()),i&2){let n=o.ngIf,e=ce(3);m(),c("ngIf",(n==null||n.annotation==null?null:n.annotation.type)==="multiThread")("ngIfElse",e)}}function CHe(i,o){if(i&1&&(f(0),g(1,vHe,4,2,"ng-container",1),v()),i&2){let n=l(3);m(),c("ngIf",n.componentConfigSignal())}}function _He(i,o){if(i&1&&(f(0),g(1,CHe,2,1,"ng-container",3),v()),i&2){let n=l().ngIf,e=l();m(),c("veltDynamicTemplate",$(4,pHe,e.template,k(1,mHe,e.componentConfigSignal,e.wireframe),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function yHe(i,o){if(i&1&&(f(0),g(1,_He,2,10,"ng-container",2),v()),i&2){let n=l();m(),c("veltIf",k(3,dHe,n.conditionSignal(),A(1,cHe,n.componentConfigSignal)))}}var l2=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-comment-bubble-count",super.initializeComponentConfigSignal(new Hm)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentBubbleCommentsCountComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentBubbleCommentsCountComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","status"),e.setAttribute("aria-live","polite"),e.setAttribute("aria-atomic","true")}catch(e){this.loggingService.catch("Error in CommentBubbleCommentsCountComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-bubble-comments-count"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[["defaultCommentsCount",""],[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[4,"ngIf","ngIfElse"]],template:function(t,r){t&1&&g(0,yHe,2,6,"ng-container",1),t&2&&c("ngIf",r.componentConfigSignal())},styles:["[_nghost-%COMP%]:empty{display:none}"],changeDetection:0});let i=o;return i})();var _de=(i,o)=>{try{if(i.hasAttribute(o))return i;if(i.children.length===0)return;for(let n=0;n<i.children.length;n++){let e=i.children[n],t=_de(e,o);if(t!==void 0)return t}return}catch(n){mt.catch("Error in utils findInjectionPointByAttribute: ",n)}},yde=(i,o,n)=>{try{let e=_de(i,o);if(e===void 0)return;let t=e.getAttribute(o);if(t===null)return;if(Object.values(j.INJECTION_ATTRIBUTES).includes(o)){if(n===null){e.removeAttribute(t);return}if(t===""){switch(e.tagName.toLowerCase()){case"img":e.src=n;break;case"p":case"a":case"b":case"strong":case"i":case"span":e.innerText=n;break}return}e[t]=n}if(n===null){e.style.removeProperty(t);return}e.style.setProperty(t,n,"important")}catch(e){mt.catch("Error in utils injectAttributeData: ",e)}},N0=i=>{let o={};return i.from?.photoUrl?o[j.INJECTION_ATTRIBUTES.VELT_AVATAR_IMG]=i.from?.photoUrl:o[j.INJECTION_ATTRIBUTES.VELT_AVATAR_IMG]=null,i.priority?o[j.INJECTION_STYLE_PROPS.VELT_COMMENT_PRIORITY_COLOR]=i.priority.color:o[j.INJECTION_STYLE_PROPS.VELT_COMMENT_PRIORITY_COLOR]=null,i.from?.color?o[j.INJECTION_STYLE_PROPS.VELT_AVATAR_COLOR]=i.from?.color:o[j.INJECTION_STYLE_PROPS.VELT_AVATAR_COLOR]=null,o[j.INJECTION_ATTRIBUTES.VELT_COMMENT_LENGTH]=i.comments?.length||0,o};var r9=(()=>{let o=class o extends H{constructor(e,t,r){super(e,t,r),this._elementRef=e}ngOnInit(){super.ngOnInit()}ngOnDestroy(){super.ngOnDestroy()}injectAttributeData(e,t){for(let r of Object.keys(t))yde(e,r,t[r])}};o.\u0275fac=function(t){return new(t||o)(h(R),h(S),h(y))},o.\u0275cmp=O({type:o,selectors:[["velt-attribute-injector"]],standalone:!1,features:[B],decls:0,vars:0,template:function(t,r){},encapsulation:2,changeDetection:0});let i=o;return i})();var Sde=i=>({componentConfigSignal:i}),SHe=(i,o)=>({condition:i,data:o}),bHe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-bubble-wireframe",variant:n,setIfCondition:e,componentElementRef:t}),IHe=(i,o,n)=>({"velt-comment-pin--status-default":i,"velt-comment-pin--status-ongoing":o,"velt-comment-pin--status-terminal":n});function EHe(i,o){i&1&&Ve(0)}function xHe(i,o){if(i&1&&(_(0,"velt-shadow-dom-internal"),g(1,EHe,1,0,"ng-container",2),b()),i&2){l();let n=ce(2);m(),c("ngTemplateOutlet",n)}}function THe(i,o){if(i&1&&(f(0),_(1,"div",8),le(),_(2,"svg",9),w(3,"path",10),b(),pt(),w(4,"app-comment-bubble-comments-count",11),P(5,"translate"),b(),w(6,"app-comment-bubble-avatar",12),P(7,"translate"),v()),i&2){let n=l(3).ngIf,e=l(2);m(),it("--velt-internal-comment-pin-bg-color",(n.annotation==null||n.annotation.status==null?null:n.annotation.status.color)||"var(--velt-accent, #625DF5)"),c("ngClass",$e(16,IHe,!n.customStatusesShown&&(n.annotation==null||n.annotation.status==null?null:n.annotation.status.type)==="default",!n.customStatusesShown&&(n.annotation==null||n.annotation.status==null?null:n.annotation.status.type)==="ongoing",!n.customStatusesShown&&(n.annotation==null||n.annotation.status==null?null:n.annotation.status.type)==="terminal")),x("data-testid",e.componentId+"-count-container"),m(),x("data-testid",e.componentId+"-count-icon")("aria-label","Comment bubble containing "+((n==null||n.annotation==null||n.annotation.comments==null?null:n.annotation.comments.length)||"0")+" comments"),m(2),c("componentConfigSignal",e.componentConfigSignal),x("data-testid",e.componentId+"-count")("aria-label",((n==null||n.annotation==null||n.annotation.comments==null?null:n.annotation.comments.length)||"0")+" "+M(5,12,"comments in this thread")),m(2),c("componentConfigSignal",e.componentConfigSignal),x("data-testid",e.componentId+"-avatar")("aria-label",M(7,14,"Avatar for comment author"))}}function DHe(i,o){if(i&1){let n=q();f(0),_(1,"velt-comment-dialog-portal-internal",5),z("togglePinSelection",function(t){return N(n),l(4).togglePinSelection(t),F(t.stopPropagation())})("saveComment",function(t){N(n);let r=l(4);return F(r.saveComment(t))})("addComment",function(t){N(n);let r=l(4);return F(r.onAddComment(t))}),_(2,"div",6),z("click",function(t){return N(n),F(t.stopPropagation())})("pointerup",function(t){return N(n),l(4).togglePinSelection(),F(t.stopPropagation())}),g(3,THe,8,20,"ng-container",7),b()(),v()}if(i&2){let n=l(2).ngIf,e=l(2);m(),c("annotation",n.annotation)("context",n.context)("commentPinType","bubble")("commentPinSelected",n.commentPinSelected)("commentBubbleTargetPinHover",e.commentBubbleTargetPinHover)("targetElement",e.targetElement)("user",e.user),x("data-testid",e.componentId+"-dialog-portal"),m(),ue("velt-comment-bubble-hover",e.commentBubbleTargetPinHover)("velt-comment-bubble-open",!!n.selectedAnnotationsMap[n.annotation==null?null:n.annotation.annotationId]),x("data-velt-comment-bubble-comments-count",(n==null||n.annotation==null||n.annotation.comments==null?null:n.annotation.comments.length)||"0")("data-testid",e.componentId),m(),c("veltDynamicTemplate",$(17,bHe,e.template,A(15,Sde,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function wHe(i,o){if(i&1&&(f(0),g(1,DHe,4,23,"ng-container",3),v()),i&2){let n=l().ngIf;m(),c("ngIf",n.annotation)}}function OHe(i,o){if(i&1&&(f(0),g(1,wHe,2,1,"ng-container",4),v()),i&2){let n=l(2);m(),c("veltIf",k(3,SHe,n.conditionSignal(),A(1,Sde,n.componentConfigSignal)))}}function AHe(i,o){if(i&1&&g(0,OHe,2,6,"ng-container",3),i&2){let n=l();c("ngIf",n.componentConfigSignal())}}var F0=(()=>{let o=class o extends r9{set _targetCommentElementId(e){try{this.targetElementId=e}catch{}}set _commentCountType(e){try{this.componentConfigSignal.update(t=>(t=T(I({},t),{commentCountType:e}),t))}catch{}}set _shadowDom(e){try{let t=e;typeof e=="string"&&(t=JSON.parse(e)),this.shadowDom=t}catch{}}set commentBubbleTargetPinHoverInput(e){try{let t=e;typeof e=="string"&&(t=JSON.parse(e)),this.commentBubbleTargetPinHover=!!t}catch(t){this.catchError("Error in CommentBubbleComponent commentBubbleTargetPinHover setter: ",t)}}set showAvatarInput(e){try{let t=e;typeof e=="string"&&(t=JSON.parse(e)),this.componentConfigSignal.update(r=>(r=T(I({},r),{showAvatar:!!t}),r))}catch(t){this.catchError("Error in CommentBubbleComponent showAvatar setter: ",t)}}set avatar(e){try{let t=e;typeof e=="string"&&(t=JSON.parse(e)),this.componentConfigSignal.update(r=>(r=T(I({},r),{showAvatar:!!t}),r))}catch(t){this.catchError("Error in CommentBubbleComponent showAvatar setter: ",t)}}set _folderId(e){try{this.componentConfigSignal.update(t=>(t=T(I({},t),{folderId:e}),t?.folderId?t.veltFolderId=zo(t.folderId):t.veltFolderId=void 0,t)),this.checkCommentAnnotationAvailable()}catch{}}set _clientDocumentId(e){try{this.componentConfigSignal.update(t=>(t=T(I({},t),{clientDocumentId:e}),t?.clientDocumentId?t.documentId=this.docService.generateDocumentId(t.clientDocumentId):t.documentId=void 0,t)),this.checkCommentAnnotationAvailable()}catch{}}set _locationId(e){try{this.componentConfigSignal.update(t=>(t=T(I({},t),{locationId:e}),t)),this.checkCommentAnnotationAvailable()}catch{}}set _context(e){try{let t=e;typeof e=="string"&&(t=JSON.parse(e)),t&&typeof t=="object"&&this.componentConfigSignal.update(r=>(r=T(I({},r),{context:t}),r))}catch{}}set _contextOptions(e){try{let t=e;typeof e=="string"&&(t=JSON.parse(e)),t&&typeof t=="object"&&this.componentConfigSignal.update(r=>(r=T(I({},r),{contextOptions:t}),r))}catch{}}constructor(e,t,r,a,s,d,p,u){super(p,u,s),this.authService=e,this.commentService=t,this.docService=r,this.domService=a,this.loggingService=s,this.wireframeService=d,this.elementRef=p,this.dynamicDataService=u,this.shadowDom=!0,this.darkMode=null,this.commentBubbleTargetPinHover=!1,this.commentAnnotationAvailable=!1,this.objectKeys=Object.keys,this.selectedAnnotationsMap={},this.resolvedCommentsOnDom=!1,this.hasSlotContent=!1,this.componentConfigSignal=xe(new Hm),this.subscriptions=[],this.veltElement=!0,this.componentId="velt-comment-bubble",this.uniqueComponentId="velt-comment-bubble-"+vn(),super.initializeComponentConfigSignal(new Hm);try{this.multiThreadAnnotationId=`temp_${this.uniqueComponentId}`,this.subscriptions.push(this.authService.getUser$().subscribe(C=>{this.user=C},C=>{this.catchError("Error in CommentBubbleComponent getUser$ subscription: ",C)})),this.subscriptions.push(this.commentService.getUnreadCommentsMap$().subscribe(C=>{this.componentConfigSignal.update(E=>(E=T(I({},E),{unreadCount:C?.[this.componentConfigSignal().annotation?.annotationId||""]||0}),E))})),this.subscriptions.push(this.domService.getSelectedAnnotationsLocationMap$().subscribe(C=>{this.componentConfigSignal.update(E=>(E=T(I({},E),{selectedAnnotationsLocationMap:C}),E)),this.checkCommentPinSelected()})),this.subscriptions.push(this.commentService.getCustomStatusesShown$().subscribe(C=>{this.componentConfigSignal.update(E=>(E=T(I({},E),{customStatusesShown:C}),E))})),this.subscriptions.push(this.commentService.getGroupMatchedComments$().subscribe(C=>{this.componentConfigSignal.update(E=>(E=T(I({},E),{groupMatchedComments:C}),E))})),this.subscriptions.push(this.domService.getSelectedAnnotationsMap$().subscribe(C=>{this.selectedAnnotationsMap=C,this.componentConfigSignal.update(E=>(E=T(I({},E),{selectedAnnotationsMap:C}),E)),this.checkCommentPinSelected()},C=>{this.catchError("Error in CommentBubbleComponent getSelectedAnnotationsMap$ subscription: ",C)}))}catch(C){this.catchError("Error in CommentBubbleComponent constructor: ",C)}}ngOnInit(){try{this.loggingService.log("%c[WB] Calling FUNCTION: ngOnInit","color: green;"),super.ngOnInit(),this.setupA11yAttributes();let e="velt-comment-bubble-wireframe";this.variant&&(e+=`---${this.variant}`),this.subscriptions.push(this.wireframeService.getWireframe$(e).subscribe(t=>{if(t){let r=document.createElement(t.tagName);r.innerHTML=t.innerHTML,this.template=r}}))}catch(e){this.catchError("Error in CommentBubbleComponent OnInit: ",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentBubbleComponent setupA11yAttributes:",e)}}ngAfterViewInit(){try{(this.targetElementId||this.componentConfigSignal().context||this.annotationId)&&this.checkCommentAnnotationAvailable()}catch(e){this.catchError("Error in CommentBubbleComponent AfterViewInit: ",e)}}ngOnChanges(e){try{if(e?.annotationId&&this.annotationId&&this.checkCommentAnnotationAvailable(),(e._context||e.context)&&this.checkCommentAnnotationAvailable(),(e._targetCommentElementId||e.targetElementId)&&this.checkCommentAnnotationAvailable(),e.darkMode){let t=e.darkMode.currentValue;t!==null&&(t!="false"?this.elementRef.nativeElement.setAttribute("dark",""):this.elementRef.nativeElement.removeAttribute("dark"))}}catch(t){this.catchError("Error in CommentBubbleComponent ngOnChanges: ",t)}}handleCustomContent(e){try{let t=e.target;if(t.assignedElements().length>0){this.hasSlotContent=!0;let r=t.assignedElements()[0];this.customContentRef=r,r!==void 0&&this.componentConfigSignal().annotation!==null&&this.componentConfigSignal().annotation!==void 0&&this.injectAttributeData(r,N0(this.componentConfigSignal().annotation))}else this.hasSlotContent=!1,this.customContentRef=void 0}catch(t){this.catchError("Error in CommentBubbleComponent handleCustomContent: ",t)}}checkCommentAnnotationAvailable(){try{this.commentAnnotationSubscription&&this.commentAnnotationSubscription.unsubscribe(),this.removeBubbleCommentAnnotationIds(),this.commentAnnotationAvailable=!1;let e;(this.componentConfigSignal().folderId||this.componentConfigSignal().clientDocumentId)&&(e=this.componentConfigSignal().locationId),!!(this.targetElementId||this.componentConfigSignal().context||this.annotationId||this.componentConfigSignal().folderId||this.componentConfigSignal().documentId||e)?this.commentAnnotationSubscription=this.commentService.getCommentAnnotationsForCommentComponent({type:"bubble",annotationId:this.annotationId,targetElementId:this.targetElementId,context:this.componentConfigSignal().context,contextOptions:this.componentConfigSignal().contextOptions,element:this.elementRef.nativeElement,folderId:this.componentConfigSignal().folderId,documentId:this.componentConfigSignal().documentId,clientDocumentId:this.componentConfigSignal().clientDocumentId,locationId:e}).pipe(he(r=>this.domService.getSelectedAnnotationsMap$().pipe(de(a=>(this.selectedAnnotationsMap=a,r)))),he(r=>this.commentService.getResolvedCommentsOnDom$().pipe(de(a=>(this.resolvedCommentsOnDom=a,r))))).subscribe(r=>{let a=this.resolvedCommentsOnDom||this.componentConfigSignal().groupMatchedComments?r?.slice():r?.filter(u=>u.status.type!=="terminal"),s=null,d=!1;if(a?.length&&this.componentConfigSignal().groupMatchedComments&&(d=a?.length>1||!a?.[0]?.isDraft),d){s=new a0,s.annotationId=this.multiThreadAnnotationId,s.isTemporary=!0,s.from=a?.[0]?.from,s.metadata=a?.[0]?.metadata;let u,C=this.componentConfigSignal().locationId;C&&(u=this.docService.getLocationByClientLocationId(C),u||(u={id:C}));let E;u&&(E=this.docService.genarateLocationId(u)),u&&E&&(s.location=u,s.locationId=E),this.componentConfigSignal().context&&(s.context=this.componentConfigSignal().context),this.targetElementId&&(s.targetElementId=this.targetElementId),s.commentAnnotationsMap={},s.commentAnnotations={};for(let D of a||[])D.annotationId&&(s.commentAnnotationsMap||(s.commentAnnotationsMap={}),s.commentAnnotationsMap[D.annotationId]=D,s.commentAnnotations||(s.commentAnnotations={}),s.commentAnnotations[D.annotationId]=!0)}let p=a?.length?a[a?.length-1]:null;s&&(p=s),this.componentConfigSignal.update(u=>(u=T(I({},u),{annotation:p,annotations:a||[]}),u.unresolvedAnnotationsCount=a?.filter(C=>C.status.type!=="terminal")?.length||0,u)),this.resolvedCommentsOnDom||this.componentConfigSignal().annotation?.status?.type!=="terminal"||this.selectedAnnotationsMap[this.componentConfigSignal().annotation?.annotationId]||this.componentConfigSignal.update(u=>(u=T(I({},u),{annotation:null}),u)),this.componentConfigSignal().annotation!==null&&this.customContentRef!==void 0&&this.injectAttributeData(this.customContentRef,N0(this.componentConfigSignal().annotation)),this.veltAnnotationId=this.componentConfigSignal().annotation?.annotationId,this.veltAnnotationIds=r?.map(u=>u?.annotationId).join(","),this.commentService.addBubbleCommentAnnotationIds(r?.map(u=>u?.annotationId)||[]),this.checkCommentPinSelected(),setTimeout(()=>{this.commentService.addBubbleCommentAnnotationIds(r?.map(u=>u?.annotationId)||[])},100)},r=>{this.catchError("Error in CommentBubbleComponent getCommentAnnotationAvailableOnXPath subscription: ",r)}):(this.targetElement=void 0,this.componentConfigSignal.update(r=>(r=T(I({},r),{annotation:null}),r)),this.veltAnnotationId=void 0,this.veltAnnotationIds=void 0,this.selectedAnnotationsMap={})}catch(e){this.catchError("Error in CommentBubbleComponent checkCommentAnnotationAvailable: ",e)}}onAddComment(e){try{this.componentConfigSignal().groupMatchedComments&&e?.annotation?.isDraft&&(this.domService.getSelectedAnnotationsMap()?.[this.multiThreadAnnotationId]||this.domService.toggleAnnotationSelection({annotationId:this.multiThreadAnnotationId,type:"multiThread"},this.componentId))}catch(t){this.catchError("Error in CommentBubbleComponent onAddComment: ",t)}}checkCommentPinSelected(){try{let e=this.componentConfigSignal().selectedAnnotationsMap,t=this.componentConfigSignal().annotation,r=this.componentConfigSignal().selectedAnnotationsLocationMap,a=this.componentId;if(t){let s=!!e[t?.annotationId];if(s)if(t?.isDraft)t?.sourceId&&(s=t?.sourceId===a,s&&this.domService.setSelectedAnnotationLocation(t.annotationId,this.componentId));else{let d=r?.[t.annotationId];d&&(s=d===this.componentId)}s!==this.componentConfigSignal().commentPinSelected&&this.componentConfigSignal.update(d=>(d=T(I({},d),{commentPinSelected:s}),d))}}catch(e){this.catchError("Error in CommentBubbleComponent checkCommentPinSelected: ",e)}}togglePinSelection(e){try{let t=e||this.componentConfigSignal().annotation;if(t)if(this.selectedAnnotationsMap[t?.annotationId])document.querySelector(`[${j.ATTRIBUTES.VELT_ANNOTATION_DRAFT}="${t.annotationId}"]`)?this.domService.resetSelectedAnnotationsMap(!0,"comments"):this.domService.toggleAnnotationSelection(t,this.componentId);else{let r=document.querySelector(`[${j.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);if(r||(r=(this.domService.getDraftCommentAnnotationDialogs()||[])[0]),r){let a=r.getAttribute(j.ATTRIBUTES.VELT_ANNOTATION_DRAFT);if(a){let s=document.getElementById(`comment-pin-container-${a}`)||document.querySelector(`[data-velt-id='${a}']`);s&&(s.scrollIntoView({behavior:"auto",block:"center",inline:"center"}),this.domService.resetSelectedAnnotationsMap(!0,"comments"))}}else this.domService.resetSelectedAnnotationsMap(!0,"comments"),this.domService.toggleAnnotationSelection(t,this.componentId)}}catch(t){this.catchError("Error in CommentBubbleComponent togglePinSelection: ",t)}}saveComment(e){try{this.componentConfigSignal().annotation&&this.commentService.saveComment(this.componentConfigSignal().annotation,e)}catch(t){this.catchError("Error in CommentBubbleComponent saveComment: ",t)}}removeBubbleCommentAnnotationIds(){try{this.commentService.removeBubbleCommentAnnotationIds(this.veltAnnotationIds?.split(",")||[])}catch(e){this.catchError("Error in CommentBubbleComponent removeBubbleCommentAnnotationIds: ",e)}}ngOnDestroy(){this.loggingService.log("%c[WB] Calling FUNCTION: ngOnDestroy","color: green;");try{super.ngOnDestroy(),this.removeBubbleCommentAnnotationIds(),this.unsubscribe()}catch(e){this.catchError("Error in CommentBubbleComponent ondestroy: ",e)}}unsubscribe(){this.loggingService.log("%c[WB] Calling FUNCTION: unsubscribe","color: green;");try{this.subscriptions.map(e=>{e.unsubscribe()}),this.commentAnnotationSubscription&&this.commentAnnotationSubscription.unsubscribe(),this.subscriptions=[]}catch(e){this.catchError("Error in CommentBubbleComponent unsubscribe: ",e)}}catchError(e,t,r){try{this.loggingService.catch(e,t,T(I({},r||{}),{annotationId:this.componentConfigSignal()?.annotation?.annotationId}))}catch{}}};o.\u0275fac=function(t){return new(t||o)(h(je),h(De),h(at),h(Fe),h(y),h(He),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["snippyly-comment-bubble"]],hostVars:3,hostBindings:function(t,r){t&2&&x("data-velt-annotation-id",r.veltAnnotationId)("data-velt-annotation-ids",r.veltAnnotationIds)("data-velt-element",r.veltElement)},inputs:{annotationId:"annotationId",_targetCommentElementId:[0,"targetCommentElementId","_targetCommentElementId"],targetElementId:"targetElementId",variant:"variant",_commentCountType:[0,"commentCountType","_commentCountType"],_shadowDom:[0,"shadowDom","_shadowDom"],darkMode:"darkMode",commentBubbleTargetPinHoverInput:[0,"commentBubbleTargetPinHover","commentBubbleTargetPinHoverInput"],showAvatarInput:[0,"showAvatar","showAvatarInput"],avatar:"avatar",_folderId:[0,"folderId","_folderId"],_clientDocumentId:[0,"documentId","_clientDocumentId"],_locationId:[0,"locationId","_locationId"],_context:[0,"context","_context"],_contextOptions:[0,"contextOptions","_contextOptions"]},standalone:!1,features:[V([S]),B,Ze],decls:3,vars:2,consts:[["commentBubbleRefRef",""],[4,"ngIf","ngIfElse"],[4,"ngTemplateOutlet"],[4,"ngIf"],[4,"veltIf"],[3,"togglePinSelection","saveComment","addComment","annotation","context","commentPinType","commentPinSelected","commentBubbleTargetPinHover","targetElement","user"],["part","container","slot","comment-bubble",1,"comment-bubble-container","velt-comment-bubble",3,"click","pointerup"],[4,"veltDynamicTemplate"],["part","count-container",1,"comment-count-container","velt-comment-bubble--count-container",3,"ngClass"],["width","32","height","26","viewBox","0 0 32 26","fill","none","xmlns","http://www.w3.org/2000/svg","aria-hidden","true","role","img"],["fill","currentColor","stroke","currentColor","part","count-icon-path","d","M18 1H10C5.02944 1 1 5.02944 1 10V16C1 20.9706 5.02944 25 10 25H26H28.1315C29.7289 25 30.6817 23.2197 29.7956 21.8906L27.5038 18.453C27.1753 17.9602 27 17.3812 27 16.7889V10C27 5.02944 22.9706 1 18 1Z"],["aria-hidden","true","role","status",1,"comment-count","velt-comment-bubble--count",3,"componentConfigSignal"],["aria-hidden","true","role","img",3,"componentConfigSignal"]],template:function(t,r){if(t&1&&g(0,xHe,2,1,"velt-shadow-dom-internal",1)(1,AHe,1,1,"ng-template",null,0,Ee),t&2){let a=ce(2);c("ngIf",!r.template&&r.shadowDom)("ngIfElse",a)}},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:inline-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)}[_nghost-%COMP%]:empty{display:none}[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)}.comment-bubble-container[_ngcontent-%COMP%]{display:flex;align-items:center;gap:0;cursor:pointer}.comment-bubble-container.custom-content[_ngcontent-%COMP%]{display:unset;gap:unset}snippyly-user-avatar[_ngcontent-%COMP%]{--legacy-velt-user-avatar-size: 1.625rem;display:flex;justify-content:center;align-items:center;padding-top:1px}.comment-count-container[_ngcontent-%COMP%]{align-items:center;box-sizing:border-box;display:flex;justify-content:left;position:relative;height:calc((1.625rem + 0px) * var(--velt-base-rem-unit));width:calc((2rem + 0px) * var(--velt-base-rem-unit))}.comment-count-container[_ngcontent-%COMP%] svg[_ngcontent-%COMP%]{color:var(--velt-internal-comment-pin-bg-color)}.comment-count-container[_ngcontent-%COMP%] svg.velt-comment-pin--status-default[_ngcontent-%COMP%]{color:var(--velt-accent, var(--velt-internal-comment-pin-bg-color))}.comment-count-container[_ngcontent-%COMP%] svg.velt-comment-pin--status-ongoing[_ngcontent-%COMP%]{color:var(--velt-warning, var(--velt-internal-comment-pin-bg-color))}.comment-count-container[_ngcontent-%COMP%] svg.velt-comment-pin--status-terminal[_ngcontent-%COMP%]{color:var(--velt-success, var(--velt-internal-comment-pin-bg-color))}.comment-count[_ngcontent-%COMP%]{font-size:var(--velt-font-size-2xs);font-weight:600;left:2px;line-height:20px;position:absolute;right:var(--velt-spacing-xs);text-align:center;color:var(--velt-accent-foreground)}"],changeDetection:0});let i=o;return i})();var ke=class{constructor(){this.addCommentMode=!1,this.moderatorMode=!1,this.enableSignInButton=!1,this.enablePriority=!1,this.enableStatus=!1,this.enableResolve=!1,this.suggestionMode=!1,this.enableUpgradeButton=!1,this.isPlanExpired=!1,this.isPrivateComment=!1,this.isUserAdmin=!1,this.darkMode=!1,this.showScreenSizeInfo=!1,this.multiThread=!1,this.bottomSheetMode=!1,this.showAllComments=!1,this.showCommentIndex=!1,this.disabled=!1,this.enableAutoCategorize=!1,this.enableAttachment=!1,this.enableReactions=!1,this.screenSharingSupported=!1,this.allowedRecordings=[],this.sidebarButtonOnCommentDialogVisible=!1,this.userMentions=!0,this.deleteOnBackspace=!0,this.recordingSummaryEnabled=!1,this.dialogShadowDOM=!1,this.enterKeyToSubmit=!1,this.isInputFocused=!1,this.showDefault=!0,this.dialogOpenedInSidebar=!1,this.resolveStatusAccessAdminOnly=!1,this.readOnly=!1,this.newComment="",this.newCommentHTML="",this.showCommentButtons=!1,this.editComment=null,this.editCommentIndex=null,this.optionsMenuOpened=!1,this.selectedUserContacts=[],this.showReplies=!1,this.ghostComment=null,this.enableGhostCommentsMessage=!1,this.hasReactionsByCommentId={},this.unreadCommentsMap=null,this.selectedFiles=[],this.invalidSelectedFiles=[],this.selectedAttachments=[],this.attachmentsToDelete=[],this.uploadingAttachments=!1,this.localRecordedData=[],this.taggedUserContacts=[],this.customList=[],this.toOrganizationUserGroup=[],this.composerInOpenState=!1,this.customChipData=null,this.selectedCustomChipSet=new Set,this.notificationEnabled=!1,this.pageModeComposer=!1,this.playVideoInFullScreen=!0,this.isKnownUser=!1,this.dialogSelectedByKnownUser=!1,this.showGhostCommentMessage=!1,this.showSuggestionModeActions=!1,this.canResolveAnnotation=!1,this.canUnresolveAnnotation=!1,this.getAnnotationDraftAttribute=null,this.assignToMenuOpened=!1,this.commentDialogUniqueId="",this.deviceInfoTooltipPositions=[],this.shortUserName=!0,this.annotationIndex=0,this.userContacts=[],this.annotation=new ko,this.user=new Do,this.dialogMode=!0,this.sidebarMode=!1,this.inboxMode=!1,this.inlineCommentMode=!1,this.isInsidePdfViewer=!1,this.locationDisplayName=void 0,this.locationVersion=void 0,this.commentPinSelected=!1,this.fullExpanded=!1,this.commentDialogSelected=!1,this.variant="dialog",this.inlineCommentSectionMode=!1,this.commentComposerMode=!1,this.composerMode=Yu.DEFAULT,this.openDropdownIndexValue=-1,this.reactionToolOpenIndex=-1,this.focusedThreadMode=!1,this.isFocusedThreadEnabled=!1,this.currentDialogView={},this.userContactsBySnippylyId=null,this.seenByUsers=!0,this.isAutocompleteDropdownOpen=!1,this.repliesUniqueUsers=[],this.maxReplyAvatars=3,this.totalReplies=0,this.replyAvatars=!1}};var bde=i=>({componentConfigSignal:i}),PHe=(i,o)=>({condition:i,data:o}),MHe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-all-comment-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function kHe(i,o){if(i&1&&(_(0,"div",5),P(1,"translate"),le(),_(2,"svg",6),w(3,"path",7)(4,"path",8),b(),pt(),_(5,"div",9),ee(6),P(7,"translate"),b()()),i&2){let n=l(4);x("aria-label",M(1,7,"View all comments"))("aria-haspopup",!0)("aria-expanded",!1)("data-testid",n.componentId+"-button"),m(2),x("data-testid",n.componentId+"-icon"),m(3),x("data-testid",n.componentId+"-label"),m(),Ce(" ",M(7,9,"All comments"),"")}}function RHe(i,o){if(i&1){let n=q();_(0,"div",3),z("click",function(t){N(n);let r=l(2).ngIf;return r==null||r.openAllComments(),F(t.stopPropagation())}),g(1,kHe,8,11,"div",4),b()}if(i&2){let n=l(2).ngIf,e=l();x("data-testid",e.componentId),m(),c("veltDynamicTemplate",$(4,MHe,e.template,A(2,bde,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function NHe(i,o){if(i&1&&(f(0),g(1,RHe,2,10,"div",2),v()),i&2){let n=l().ngIf;m(),c("ngIf",(n==null?null:n.commentDialogSelected)&&(n==null||n.annotation==null||n.annotation.comments==null?null:n.annotation.comments.length)&&(n==null?null:n.dialogMode)&&(n==null?null:n.sidebarButtonOnCommentDialogVisible))}}function FHe(i,o){if(i&1&&(f(0),g(1,NHe,2,1,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,PHe,n.conditionSignal(),A(1,bde,n.componentConfigSignal)))}}var L0=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-comment-dialog-all-comment",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogAllCommentComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogAllCommentComponent 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 CommentDialogAllCommentComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-all-comment"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[3,"click",4,"ngIf"],[3,"click"],["class","velt-all-comment","role","button","tabindex","0",4,"veltDynamicTemplate"],["role","button","tabindex","0",1,"velt-all-comment"],["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","M4.83268 12.2505V14.8286L9.05119 12.3358L9.49212 12.3286C11.2454 12.2999 12.8232 12.1234 14.003 11.9439C14.7476 11.8306 15.2649 11.3109 15.3773 10.6585C15.5332 9.75341 15.666 8.60678 15.666 7.33268C15.666 6.05858 15.5332 4.91195 15.3773 4.0069C15.2649 3.35442 14.7476 2.83478 14.003 2.72149C12.7126 2.52515 10.948 2.33268 8.99935 2.33268C7.05074 2.33268 5.28608 2.52515 3.9957 2.72149C3.25113 2.83478 2.73377 3.35442 2.62138 4.00691C2.46548 4.91195 2.33268 6.05858 2.33268 7.33268C2.33268 8.60678 2.46548 9.75341 2.62138 10.6585C2.71897 11.2251 3.1148 11.6792 3.69192 11.8711L4.83268 12.2505ZM0.978897 3.72399C1.22072 2.32008 2.33662 1.28808 3.74499 1.07379C5.09444 0.86846 6.94567 0.666016 8.99935 0.666016C11.053 0.666016 12.9043 0.86846 14.2537 1.07379C15.6621 1.28808 16.778 2.32008 17.0198 3.72399C17.1883 4.70245 17.3327 5.94539 17.3327 7.33268C17.3327 8.71997 17.1883 9.96292 17.0198 10.9414C16.778 12.3453 15.6621 13.3773 14.2537 13.5916C13.0192 13.7794 11.3647 13.9648 9.51941 13.9951L4.42329 17.0064C3.86778 17.3347 3.16602 16.9342 3.16602 16.289V13.4526C2.03815 13.0776 1.18648 12.1465 0.978897 10.9414C0.810359 9.96292 0.666016 8.71997 0.666016 7.33268C0.666016 5.94539 0.810359 4.70245 0.978897 3.72399Z","fill","currentColor"],["fill-rule","evenodd","clip-rule","evenodd","d","M4.83268 4.83268C4.37244 4.83268 3.99935 5.20578 3.99935 5.66602C3.99935 6.12625 4.37244 6.49935 4.83268 6.49935H13.166C13.6263 6.49935 13.9993 6.12625 13.9993 5.66602C13.9993 5.20578 13.6263 4.83268 13.166 4.83268H4.83268ZM4.83268 8.16602C4.37244 8.16602 3.99935 8.53911 3.99935 8.99935C3.99935 9.45959 4.37245 9.83268 4.83268 9.83268H8.16602C8.62625 9.83268 8.99935 9.45959 8.99935 8.99935C8.99935 8.53911 8.62625 8.16602 8.16602 8.16602H4.83268Z","fill","currentColor"],[1,"velt-all-comment--button"]],template:function(t,r){t&1&&g(0,FHe,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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%]:empty{display:none}.velt-all-comment[_ngcontent-%COMP%]{gap:var(--velt-spacing-xs);display:flex;flex-direction:row;align-items:center;justify-content:center}.velt-all-comment[_ngcontent-%COMP%] *[_ngcontent-%COMP%]{color:var(--velt-accent-text)}.velt-all-comment--button[_ngcontent-%COMP%]{position:relative;line-height:1.25em;font-weight:600;display:inline-block;cursor:pointer}"],changeDetection:0});let i=o;return i})();var Ide=i=>({componentConfigSignal:i}),BHe=(i,o)=>({condition:i,data:o}),VHe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-approve-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function UHe(i,o){if(i&1&&(f(0),w(1,"div",5),_(2,"div",6),ee(3),P(4,"translate"),b(),v()),i&2){let n=l(4);m(),x("data-testid",n.componentId+"-fill"),m(),x("data-testid",n.componentId+"-label"),m(),Ce(" ",M(4,3,"Approve"),"")}}function jHe(i,o){if(i&1){let n=q();_(0,"div",3),P(1,"translate"),z("click",function(t){N(n);let r=l(2).ngIf;return r==null||r.approveCommentPinAnnotation(),F(t.stopPropagation())}),g(2,UHe,5,5,"ng-container",4),b()}if(i&2){let n=l(2).ngIf,e=l();x("aria-label",M(1,4,"Approve comment"))("aria-pressed",!1)("data-testid",e.componentId+"-button"),m(2),c("veltDynamicTemplate",$(8,VHe,e.template,A(6,Ide,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function $He(i,o){if(i&1&&(f(0),g(1,jHe,3,14,"ng-template",2),v()),i&2){let n=l().ngIf;m(),c("ngIf",(n==null?null:n.commentDialogSelected)&&(n==null||n.annotation==null||n.annotation.comments==null?null:n.annotation.comments.length)&&(n==null?null:n.moderatorMode)&&!(!(n==null||n.annotation==null)&&n.annotation.approved)&&(n==null||n.user==null?null:n.user.isAdmin))}}function HHe(i,o){if(i&1&&(f(0),g(1,$He,2,1,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,BHe,n.conditionSignal(),A(1,Ide,n.componentConfigSignal)))}}var B0=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-comment-dialog-approve",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogApproveComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogApproveComponent 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 CommentDialogApproveComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-approve"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[3,"ngIf"],["role","button","tabindex","0",3,"click"],[4,"veltDynamicTemplate"],["aria-hidden","true",1,"velt-fill"],[1,"velt-flat-button"]],template:function(t,r){t&1&&g(0,HHe,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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%]:empty{display:none}.velt-fill[_ngcontent-%COMP%]{flex-grow:1}.velt-flat-button[_ngcontent-%COMP%]{padding:var(--velt-spacing-sm) var(--velt-spacing-md);background:var(--velt-accent);border-radius:var(--velt-border-radius-3xl);border:0;color:var(--velt-accent-foreground);font-weight:700;transition:.2s;font-size:var(--velt-font-size-sm);cursor:pointer}.velt-flat-button[_ngcontent-%COMP%]:hover{background:var(--velt-accent-hover)}"],changeDetection:0});let i=o;return i})();var Ede=i=>({componentConfigSignal:i}),GHe=(i,o)=>({condition:i,data:o}),WHe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-assign-menu-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function qHe(i,o){if(i&1){let n=q();f(0),_(1,"velt-autocomplete-panel-internal",5),P(2,"translate"),P(3,"translate"),z("optionSelected",function(t){N(n);let r=l(3).ngIf;return F(r==null?null:r.assignCommentToUser(t))}),b(),v()}if(i&2){let n=l(3).ngIf,e=l();m(),c("darkMode",!!(n!=null&&n.darkMode))("enableOnFocus",!0)("metadata",n==null||n.annotation==null?null:n.annotation.metadata)("placeholder",M(2,6,"Search")),x("aria-label",M(3,8,"Search users"))("data-testid",e.componentId+"-autocomplete")}}function YHe(i,o){if(i&1){let n=q();_(0,"div",3),P(1,"translate"),z("clickOutside",function(){N(n);let t=l(2).ngIf;return F(t==null?null:t.closeAssignToMenu())}),g(2,qHe,4,10,"ng-container",4),b()}if(i&2){let n=l(2).ngIf,e=l();x("data-testid",e.componentId)("aria-label",M(1,4,"Assign thread"))("aria-modal",!0),m(2),c("veltDynamicTemplate",$(8,WHe,e.template,A(6,Ede,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function KHe(i,o){if(i&1&&(f(0),g(1,YHe,3,14,"div",2),v()),i&2){let n=l().ngIf;m(),c("ngIf",n==null?null:n.assignToMenuOpened)}}function ZHe(i,o){if(i&1&&(f(0),g(1,KHe,2,1,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,GHe,n.conditionSignal(),A(1,Ede,n.componentConfigSignal)))}}var c2=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-comment-dialog-assign-menu",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogAssignMenuComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogAssignMenuComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("role","dialog"),e.setAttribute("aria-label","Assign thread"),e.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogAssignMenuComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-assign-menu"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["class","velt-header--assign-menu","snippylyClickOutside","","role","dialog",3,"clickOutside",4,"ngIf"],["snippylyClickOutside","","role","dialog",1,"velt-header--assign-menu",3,"clickOutside"],[4,"veltDynamicTemplate"],[3,"optionSelected","darkMode","enableOnFocus","metadata","placeholder"]],template:function(t,r){t&1&&g(0,ZHe,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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%]:empty{display:none}[_nghost-%COMP%] .velt-header--assign-menu{position:absolute;top:100%;width:calc((15rem + 0px) * var(--velt-base-rem-unit));right:0;background:var(--velt-background-0);border:1px solid var(--velt-border-4);border-radius:var(--velt-border-radius-md);padding:var(--velt-spacing-sm);box-sizing:border-box;height:100%;height:unset;line-height:unset;display:flex;gap:var(--velt-spacing-sm);z-index:3}[_nghost-%COMP%] .velt-header--assign-menu velt-autocomplete-panel-internal{width:100%}[_nghost-%COMP%] .velt-header--assign-menu velt-autocomplete-panel-internal input{border:0;font-size:var(--velt-font-size-sm)}"],changeDetection:0});let i=o;return i})();var xde=i=>({componentConfigSignal:i}),XHe=(i,o)=>({condition:i,data:o}),QHe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-assignee-banner-resolve-button-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function JHe(i,o){if(i&1&&(le(),_(0,"svg",4),w(1,"path",5),b()),i&2){let n=l(4);x("data-testid",n.componentId+"-icon")}}function eze(i,o){if(i&1){let n=q();f(0),_(1,"app-resolve-button",2),z("changeStatus",function(t){N(n);let r=l(2).ngIf;return F(r==null?null:r.changeStatus(t))}),g(2,JHe,2,1,"svg",3),b(),v()}if(i&2){let n=l(2).ngIf,e=l();m(),c("darkMode",!!(n!=null&&n.darkMode))("headingMode",!0)("annotation",n==null?null:n.annotation)("sidebarMode",n==null?null:n.sidebarMode),x("data-testid",e.componentId),m(),c("veltDynamicTemplate",$(8,QHe,e.template,A(6,xde,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function tze(i,o){if(i&1&&(f(0),g(1,eze,3,14,"ng-container",0),v()),i&2){let n=l().ngIf;m(),c("ngIf",n==null?null:n.canResolveAnnotation)}}function nze(i,o){if(i&1&&(f(0),g(1,tze,2,1,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,XHe,n.conditionSignal(),A(1,xde,n.componentConfigSignal)))}}var d2=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-banner-resolve-button",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogAssigneeBannerResolveButtonComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogAssigneeBannerResolveButtonComponent 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 CommentDialogAssigneeBannerResolveButtonComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-assignee-banner-resolve-button"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[3,"changeStatus","darkMode","headingMode","annotation","sidebarMode"],["width","12","height","10","viewBox","0 0 12 10","fill","none","xmlns","http://www.w3.org/2000/svg","aria-hidden","true","focusable","false",4,"veltDynamicTemplate"],["width","12","height","10","viewBox","0 0 12 10","fill","none","xmlns","http://www.w3.org/2000/svg","aria-hidden","true","focusable","false"],["fill-rule","evenodd","clip-rule","evenodd","d","M11.5886 1.07806C11.914 1.4035 11.914 1.93114 11.5886 2.25657L4.92194 8.92324C4.5965 9.24868 4.06886 9.24868 3.74343 8.92324L0.410093 5.58991C0.0846564 5.26447 0.0846564 4.73683 0.410093 4.4114C0.73553 4.08596 1.26317 4.08596 1.5886 4.4114L4.33268 7.15547L10.4101 1.07806C10.7355 0.752625 11.2632 0.752625 11.5886 1.07806Z","fill","currentColor"]],template:function(t,r){t&1&&g(0,nze,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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%]:empty{display:none}"],changeDetection:0});let i=o;return i})();var Tde=i=>({componentConfigSignal:i}),ize=(i,o)=>({condition:i,data:o}),oze=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-assignee-banner-user-avatar-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function rze(i,o){if(i&1&&(f(0),w(1,"snippyly-user-avatar",3),P(2,"translate"),v()),i&2){let n=l(2).ngIf,e=l();m(),c("size",28)("user",n==null||n.annotation==null?null:n.annotation.assignedTo),x("aria-label",M(2,4,"Avatar for assigned user"))("data-testid",e.componentId+"-avatar")}}function aze(i,o){if(i&1&&(f(0),g(1,rze,3,6,"ng-container",2),v()),i&2){let n=l().ngIf,e=l();m(),c("veltDynamicTemplate",$(3,oze,e.template,A(1,Tde,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function sze(i,o){if(i&1&&(f(0),g(1,aze,2,9,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,ize,n.conditionSignal(),A(1,Tde,n.componentConfigSignal)))}}var m2=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-assignee-banner-avatar",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogAssigneeBannerUserAvatarComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogAssigneeBannerUserAvatarComponent 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 CommentDialogAssigneeBannerUserAvatarComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-assignee-banner-user-avatar"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[1,"velt-assignee-banner--user-avatar",3,"size","user"]],template:function(t,r){t&1&&g(0,sze,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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%]:empty{display:none}.velt-assignee-banner--user-avatar[_ngcontent-%COMP%]{align-self:center}"],changeDetection:0});let i=o;return i})();var Dde=i=>({componentConfigSignal:i}),lze=(i,o)=>({condition:i,data:o}),cze=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-assignee-banner-user-name-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function dze(i,o){if(i&1&&(_(0,"div",5),P(1,"translate"),ee(2),P(3,"translate"),b()),i&2){let n=l(3).ngIf,e=l();x("data-testid",e.componentId)("aria-label",M(1,3,"Assigned to")+" "+((n==null||n.annotation==null||n.annotation.assignedTo==null?null:n.annotation.assignedTo.name)||(n==null||n.annotation==null||n.annotation.assignedTo==null?null:n.annotation.assignedTo.email))),m(2),Ce(" ",M(3,5,(n==null||n.annotation==null||n.annotation.assignedTo==null?null:n.annotation.assignedTo.name)||(n==null||n.annotation==null||n.annotation.assignedTo==null?null:n.annotation.assignedTo.email)),"")}}function mze(i,o){if(i&1&&(f(0),g(1,dze,4,7,"div",4),v()),i&2){let n=l(2).ngIf,e=ce(3);m(),c("ngIf",(n==null||n.annotation==null||n.annotation.assignedTo==null?null:n.annotation.assignedTo.name)||(n==null||n.annotation==null||n.annotation.assignedTo==null?null:n.annotation.assignedTo.email))("ngIfElse",e)}}function pze(i,o){if(i&1&&(f(0),g(1,mze,2,2,"ng-container",3),v()),i&2){let n=l().ngIf,e=l();m(),c("veltDynamicTemplate",$(3,cze,e.template,A(1,Dde,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function gze(i,o){i&1&&w(0,"velt-skeleton-loader-internal",6)}function uze(i,o){if(i&1&&(f(0),g(1,pze,2,9,"ng-container",2)(2,gze,1,0,"ng-template",null,0,Ee),v()),i&2){let n=l();m(),c("veltIf",k(3,lze,n.conditionSignal(),A(1,Dde,n.componentConfigSignal)))}}var p2=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-assignee-banner-name",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogAssigneeBannerUserNameComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogAssigneeBannerUserNameComponent 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 CommentDialogAssigneeBannerUserNameComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-assignee-banner-user-name"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[["loadingTemplateRef",""],[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["class","velt-assignee-banner--user-name","role","text",4,"ngIf","ngIfElse"],["role","text",1,"velt-assignee-banner--user-name"],["height","16px","width","80px","borderRadius","8px"]],template:function(t,r){t&1&&g(0,uze,4,6,"ng-container",1),t&2&&c("ngIf",r.componentConfigSignal())},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%}[_nghost-%COMP%]:empty{display:none}.velt-assignee-banner--user-name[_ngcontent-%COMP%]{color:var(--velt-accent-foreground);text-overflow:ellipsis;white-space:nowrap;overflow:hidden}"],changeDetection:0});let i=o;return i})();var wde=i=>({componentConfigSignal:i}),hze=(i,o)=>({condition:i,data:o}),fze=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-assignee-banner-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function vze(i,o){if(i&1&&(f(0),w(1,"app-comment-dialog-assignee-banner-resolve-button",7)(2,"app-comment-dialog-assignee-banner-unresolve-button",8),v()),i&2){let n=l(5);m(),c("componentConfigSignal",n.componentConfigSignal),m(),c("componentConfigSignal",n.componentConfigSignal)}}function Cze(i,o){if(i&1&&(_(0,"div",3),P(1,"translate"),w(2,"app-comment-dialog-assignee-banner-user-avatar",4),_(3,"div",5)(4,"div",6),ee(5),P(6,"translate"),b(),w(7,"app-comment-dialog-assignee-banner-user-name",4),b(),g(8,vze,3,2,"ng-container",0),b()),i&2){let n=l(3).ngIf,e=l();it("background-color",n==null||n.annotation==null||n.annotation.status==null?null:n.annotation.status.color)("--legacy-velt-assignee-banner-color",(n==null||n.annotation==null||n.annotation.status==null?null:n.annotation.status.lightColor)||"white")("--legacy-velt-tooltip-button-color",(n==null||n.annotation==null||n.annotation.status==null?null:n.annotation.status.lightColor)||"white"),ue("velt-assignee-banner--private-comment-mode",n==null?null:n.isPrivateComment)("private-comment",n==null?null:n.isPrivateComment),x("data-testid",e.componentId)("aria-label",M(1,17,"Comment assignment details")),m(2),c("componentConfigSignal",e.componentConfigSignal),m(),x("data-testid",e.componentId+"-author"),m(2),ze(M(6,19,"Assigned to:")),m(2),c("componentConfigSignal",e.componentConfigSignal),m(),c("ngIf",!(n!=null&&n.readOnly))}}function _ze(i,o){if(i&1&&(f(0),g(1,Cze,9,21,"div",2),v()),i&2){let n=l(2).ngIf,e=l();m(),c("veltDynamicTemplate",$(3,fze,e.template,A(1,wde,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function yze(i,o){if(i&1&&(f(0),g(1,_ze,2,9,"ng-container",0),v()),i&2){let n=l().ngIf;m(),c("ngIf",(n==null||n.annotation==null?null:n.annotation.assignedTo)&&!(n!=null&&n.inlineCommentMode))}}function Sze(i,o){if(i&1&&(f(0),g(1,yze,2,1,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,hze,n.conditionSignal(),A(1,wde,n.componentConfigSignal)))}}var V0=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-assignee-banner",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogAssigneeBannerComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogAssigneeBannerComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("role","region"),e.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogAssigneeBannerComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-assignee-banner"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["class","velt-assignee-banner--heading","role","region",3,"velt-assignee-banner--private-comment-mode","private-comment","backgroundColor","--legacy-velt-assignee-banner-color","--legacy-velt-tooltip-button-color",4,"veltDynamicTemplate"],["role","region",1,"velt-assignee-banner--heading"],[3,"componentConfigSignal"],[1,"velt-assignee-banner--author"],[1,"velt-assignee-banner--text"],[1,"velt-assignee-banner--resolve-button",3,"componentConfigSignal"],[1,"velt-assignee-banner--unresolve-button",3,"componentConfigSignal"]],template:function(t,r){t&1&&g(0,Sze,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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%}[_nghost-%COMP%]:empty{display:none}.velt-assignee-banner--heading[_ngcontent-%COMP%]{background:var(--velt-green);margin:calc(var(--velt-spacing-lg) * -1);padding:var(--velt-spacing-lg);color:var(--velt-white);display:flex;align-items:center;justify-content:flex-start;grid-gap:var(--velt-spacing-sm);gap:var(--velt-spacing-sm);margin-bottom:0;border-radius:var(--velt-border-radius-md) var(--velt-border-radius-md) 0 0}.velt-assignee-banner--heading.velt-assignee-banner--private-comment-mode[_ngcontent-%COMP%]{background:color-mix(in srgb,var(--velt-purple) 32%,var(--velt-black) 100%);border-radius:0}.velt-assignee-banner--author[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-start;overflow:hidden}.velt-assignee-banner--text[_ngcontent-%COMP%]{font-style:normal;font-weight:400;font-size:var(--velt-font-size-xs);line-height:17px;color:var(--velt-accent-foreground)}.velt-assignee-banner--resolve-button[_ngcontent-%COMP%], .velt-assignee-banner--unresolve-button[_ngcontent-%COMP%]{margin-left:auto}"],changeDetection:0});let i=o;return i})();var Ize=["commentContainer"],Eze=i=>({componentConfigSignal:i}),xze=(i,o)=>({condition:i,data:o}),Tze=(i,o)=>({componentConfigSignal:i,wireframe:o}),Dze=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-body-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function wze(i,o){if(i&1&&(f(0),w(1,"app-comment-dialog-reply-avatars",10),v()),i&2){let n=l(6);m(),c("componentConfigSignal",n.componentConfigSignal)}}function Oze(i,o){if(i&1&&(_(0,"div",9),g(1,wze,2,1,"ng-container",1),w(2,"app-comment-dialog-toggle-reply",10),b()),i&2){let n=l(4).ngIf,e=l();ue("velt-comment-dialog-body--reply-avatars-inline-mode",n.inlineCommentSectionMode),m(),c("ngIf",(n==null?null:n.replyAvatars)&&!(n!=null&&n.commentDialogSelected)),m(),c("componentConfigSignal",e.componentConfigSignal),x("data-testid",e.componentId+"-toggle")}}function Aze(i,o){if(i&1){let n=q();_(0,"div",6),z("scroll",function(t){N(n);let r=l(3).ngIf;return F(r==null?null:r.setMessageScrollOffset(t))}),w(1,"app-comment-dialog-threads",7),g(2,Oze,3,5,"div",8),b()}if(i&2){let n=l(3).ngIf,e=l();x("aria-live","polite")("aria-atomic","false")("data-testid",e.componentId+"-scroll-container"),m(),c("componentConfigSignal",e.componentConfigSignal)("wireframe",e.wireframe),x("data-testid",e.componentId+"-threads"),m(),c("ngIf",!(n!=null&&n.readOnly))}}function Pze(i,o){if(i&1&&(_(0,"div",4,0),P(2,"translate"),g(3,Aze,3,7,"div",5),b()),i&2){let n=l(2).ngIf,e=l();ue("velt-comment-dialog-body--inline-comment-section-mode",n==null?null:n.inlineCommentSectionMode)("velt-comment-dialog-body--closed",!(n!=null&&n.commentDialogSelected)&&(n==null||n.annotation==null||n.annotation.comments==null?null:n.annotation.comments.length))("velt-comment-dialog-body--focused-thread-mode",n==null?null:n.focusedThreadMode),x("data-testid",e.componentId)("aria-label",M(2,10,"Comment dialog thread"))("aria-expanded",!(!(n!=null&&n.commentDialogSelected)&&(!(n==null||n.annotation==null||n.annotation.comments==null)&&n.annotation.comments.length))),m(3),c("veltDynamicTemplate",$(15,Dze,e.template,k(12,Tze,e.componentConfigSignal,e.wireframe),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function Mze(i,o){if(i&1&&(f(0),g(1,Pze,4,21,"div",3),v()),i&2){let n=l().ngIf;m(),c("ngIf",n==null||n.annotation==null||n.annotation.comments==null?null:n.annotation.comments.length)}}function kze(i,o){if(i&1&&(f(0),g(1,Mze,2,1,"ng-container",2),v()),i&2){let n=l();m(),c("veltIf",k(3,xze,n.conditionSignal(),A(1,Eze,n.componentConfigSignal)))}}var U0=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.subscriptions=[],this.componentId="velt-comment-dialog-body",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes(),this.subscriptions.push(this.componentConfigSignal().scrollToBottom.subscribe(()=>{this.scrollToBottom()}))}catch{}}ngOnDestroy(){try{super.ngOnDestroy(),this.subscriptions.forEach(e=>{e.unsubscribe()}),clearTimeout(this.scrollTimeout)}catch{}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogBodyComponent setupA11yAttributes:",e)}}scrollToBottom(){try{clearTimeout(this.scrollTimeout),this.scrollTimeout=setTimeout(()=>{this.commentContainer?.nativeElement&&this.commentContainer?.nativeElement.scrollTo({top:this.commentContainer.nativeElement.scrollHeight,behavior:"smooth"})},100)}catch(e){this.catchError("Error in CommentDialogBodyComponent scrollToBottom: ",e)}}catchError(e,t,r){try{this.loggingService.catch(e,t,T(I({},r||{}),{annotationId:this.componentConfigSignal()?.annotation?.annotationId}))}catch{}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-body"]],viewQuery:function(t,r){if(t&1&&nt(Ize,5),t&2){let a;Xe(a=Qe())&&(r.commentContainer=a.first)}},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[["commentContainer",""],[4,"ngIf"],[4,"veltIf"],["class","velt-body","role","region",3,"velt-comment-dialog-body--inline-comment-section-mode","velt-comment-dialog-body--closed","velt-comment-dialog-body--focused-thread-mode",4,"ngIf"],["role","region",1,"velt-body"],["role","log",3,"scroll",4,"veltDynamicTemplate"],["role","log",3,"scroll"],[3,"componentConfigSignal","wireframe"],["class","velt-comment-dialog-body--reply-avatars",3,"velt-comment-dialog-body--reply-avatars-inline-mode",4,"ngIf"],[1,"velt-comment-dialog-body--reply-avatars"],[3,"componentConfigSignal"]],template:function(t,r){t&1&&g(0,kze,2,6,"ng-container",1),t&2&&c("ngIf",r.componentConfigSignal())},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%]:empty{display:none}.velt-body[_ngcontent-%COMP%]{display:flex;flex-direction:column;max-height:250px;position:relative}.velt-body.velt-comment-dialog-body--inline-comment-section-mode[_ngcontent-%COMP%]{max-height:none}.velt-comment-dialog-body--inline-comment-section-mode[_ngcontent-%COMP%] app-comment-dialog-threads[_ngcontent-%COMP%]{max-height:none;overflow:initial}[_ngcontent-%COMP%]::-webkit-scrollbar{display:none;width:0;height:0}[_ngcontent-%COMP%]::-webkit-scrollbar{width:0;height:0}[_ngcontent-%COMP%]::-webkit-scrollbar-button{width:0;height:0}.velt-comment-dialog-body--focused-thread-mode[_ngcontent-%COMP%]{width:100%;max-height:none}.velt-comment-dialog-body--focused-thread-mode[_ngcontent-%COMP%] app-comment-dialog-threads[_ngcontent-%COMP%]{max-height:none}.velt-comment-dialog-body--reply-avatars[_ngcontent-%COMP%]{display:flex;flex-direction:row;align-items:center;margin-top:var(--velt-spacing-xs)}.velt-comment-dialog-body--reply-avatars-inline-mode[_ngcontent-%COMP%]{margin-left:calc((3rem + 0px) * var(--velt-base-rem-unit));gap:var(--velt-spacing-sm)}"],changeDetection:0});let i=o;return i})();var Ode=i=>({componentConfigSignal:i}),Nze=(i,o)=>({condition:i,data:o}),Fze=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-comment-category-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function Lze(i,o){if(i&1&&(_(0,"div",3),P(1,"translate"),ee(2),P(3,"translate"),b()),i&2){let n=l(3).ngIf,e=l();it("background-color",(n==null||n.annotation==null||n.annotation.commentCategories==null||n.annotation.commentCategories[0]==null?null:n.annotation.commentCategories[0].color)+" !important"),x("data-testid",e.componentId+"-index")("aria-label",M(1,6,"Comment Index")+" "+(n==null||n.annotation==null?null:n.annotation.annotationIndex))("aria-hidden",!0),m(2),Ce(" ",M(3,8,n==null?null:n.annotation.commentCategories[0].name),"")}}function Bze(i,o){if(i&1&&(f(0),g(1,Lze,4,10,"div",2),v()),i&2){let n=l(2).ngIf,e=l();m(),c("veltDynamicTemplate",$(3,Fze,e.template,A(1,Ode,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function Vze(i,o){if(i&1&&(f(0),g(1,Bze,2,9,"ng-container",0),v()),i&2){let n=l().ngIf;m(),c("ngIf",(n==null?null:n.enableAutoCategorize)&&(n==null||n.annotation==null||n.annotation.commentCategories==null?null:n.annotation.commentCategories.length))}}function Uze(i,o){if(i&1&&(f(0),g(1,Vze,2,1,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,Nze,n.conditionSignal(),A(1,Ode,n.componentConfigSignal)))}}var g2=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-comment-dialog-comment-category",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogCommentCategoryComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogCommentCategoryComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogCommentCategoryComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-comment-category"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["class","velt-comment-category",3,"background-color",4,"veltDynamicTemplate"],[1,"velt-comment-category"]],template:function(t,r){t&1&&g(0,Uze,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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%]:empty{display:none}.velt-comment-category[_ngcontent-%COMP%]{color:var(--velt-white);display:flex;justify-content:center;align-items:center;padding:var(--velt-spacing-sm);border-radius:var(--velt-border-radius-3xl);min-width:calc((1rem + 0px) * var(--velt-base-rem-unit));height:calc((1rem + 0px) * var(--velt-base-rem-unit));font-style:normal;font-weight:600;font-size:var(--velt-font-size-2xs);font-weight:400;background:var(--velt-gray);box-sizing:border-box}"],changeDetection:0});let i=o;return i})();var Ade=i=>({componentConfigSignal:i}),jze=(i,o)=>({condition:i,data:o}),$ze=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-comment-index-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function Hze(i,o){if(i&1&&(_(0,"div",3),P(1,"translate"),ee(2),b()),i&2){let n=l(3).ngIf,e=l();x("data-testid",e.componentId)("aria-label",M(1,4,"Comment Index")+" "+(n==null||n.annotation==null?null:n.annotation.annotationIndex))("aria-hidden",!0),m(2),Ce(" #",n==null||n.annotation==null?null:n.annotation.annotationIndex,"")}}function zze(i,o){if(i&1&&(f(0),g(1,Hze,3,6,"div",2),v()),i&2){let n=l(2).ngIf,e=l();m(),c("veltDynamicTemplate",$(3,$ze,e.template,A(1,Ade,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function Gze(i,o){if(i&1&&(f(0),g(1,zze,2,9,"ng-container",0),v()),i&2){let n=l().ngIf;m(),c("ngIf",n==null||n.annotation==null?null:n.annotation.annotationIndex)}}function Wze(i,o){if(i&1&&(f(0),g(1,Gze,2,1,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,jze,n.conditionSignal(),A(1,Ade,n.componentConfigSignal)))}}var u2=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-comment-dialog-comment-index",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogCommentIndexComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogCommentIndexComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogCommentIndexComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-comment-index"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["class","velt-comment-index",4,"veltDynamicTemplate"],[1,"velt-comment-index"]],template:function(t,r){t&1&&g(0,Wze,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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%]:empty{display:none}.velt-comment-index[_ngcontent-%COMP%]{display:flex;justify-content:center;align-items:center;padding:var(--velt-spacing-sm);border-radius:var(--velt-border-radius-3xl);width:calc((1rem + 0px) * var(--velt-base-rem-unit));height:calc((1rem + 0px) * var(--velt-base-rem-unit));font-style:normal;font-weight:600;font-size:var(--velt-font-size-2xs);box-sizing:border-box;width:calc((2rem + 0px) * var(--velt-base-rem-unit));font-weight:400;background:var(--velt-gray);color:var(--velt-black)}"],changeDetection:0});let i=o;return i})();var Pde=i=>({componentConfigSignal:i}),qze=(i,o)=>({condition:i,data:o}),Yze=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-comment-suggestion-status-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function Kze(i,o){if(i&1&&(_(0,"div",3),P(1,"translate"),P(2,"translate"),ee(3),P(4,"translate"),b()),i&2){let n=l(3).ngIf,e=l();ue("velt-comment-suggestion-status--accepted",(n==null||n.annotation==null||n.annotation.status==null?null:n.annotation.status.id)===(n==null||n.commentAcceptedStatus==null?null:n.commentAcceptedStatus.id))("velt-comment-suggestion-status--rejected",(n==null||n.annotation==null||n.annotation.status==null?null:n.annotation.status.id)===(n==null||n.commentRejectedStatus==null?null:n.commentRejectedStatus.id)),x("data-testid",e.componentId)("aria-label",M(1,7,"Suggestion")+" "+M(2,9,(n==null||n.annotation==null||n.annotation.status==null?null:n.annotation.status.name)||"")),m(3),Ce(" ",M(4,11,(n==null||n.annotation==null||n.annotation.status==null?null:n.annotation.status.name)||"")," ")}}function Zze(i,o){if(i&1&&(f(0),g(1,Kze,5,13,"div",2),v()),i&2){let n=l(2).ngIf,e=l();m(),c("veltDynamicTemplate",$(3,Yze,e.template,A(1,Pde,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function Xze(i,o){if(i&1&&(f(0),g(1,Zze,2,9,"ng-container",0),v()),i&2){let n=l().ngIf;m(),c("ngIf",(n==null?null:n.suggestionMode)&&((n==null||n.annotation==null||n.annotation.status==null?null:n.annotation.status.id)===(n==null||n.commentAcceptedStatus==null?null:n.commentAcceptedStatus.id)||(n==null||n.annotation==null||n.annotation.status==null?null:n.annotation.status.id)===(n==null||n.commentRejectedStatus==null?null:n.commentRejectedStatus.id)))}}function Qze(i,o){if(i&1&&(f(0),g(1,Xze,2,1,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,qze,n.conditionSignal(),A(1,Pde,n.componentConfigSignal)))}}var h2=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-comment-dialog-comment-suggestion-status",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogCommentSuggestionStatusComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogCommentSuggestionStatusComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogCommentSuggestionStatusComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-comment-suggestion-status"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["class","velt-comment-suggestion-status","role","status",3,"velt-comment-suggestion-status--accepted","velt-comment-suggestion-status--rejected",4,"veltDynamicTemplate"],["role","status",1,"velt-comment-suggestion-status"]],template:function(t,r){t&1&&g(0,Qze,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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%]:empty{display:none}.velt-comment-suggestion-status[_ngcontent-%COMP%]{background:var(--velt-white);display:flex;justify-content:center;align-items:center;padding:var(--velt-spacing-sm);border-radius:var(--velt-border-radius-3xl);min-width:calc((1rem + 0px) * var(--velt-base-rem-unit));height:calc((1rem + 0px) * var(--velt-base-rem-unit));font-style:normal;font-weight:600;font-size:var(--velt-font-size-2xs);font-weight:400;background:var(--velt-gray)}.velt-comment-suggestion-status.velt-comment-suggestion-status--accepted[_ngcontent-%COMP%]{background:var(--velt-success);color:var(--velt-success-foreground)}.velt-comment-suggestion-status.velt-comment-suggestion-status--rejected[_ngcontent-%COMP%]{background:var(--velt-error);color:var(--velt-error-foreground)}"],changeDetection:0});let i=o;return i})();var j0=i=>({componentConfigSignal:i}),Jze=(i,o)=>({condition:i,data:o}),$0=(i,o)=>({componentName:"velt-comment-dialog-composer-action-button-wireframe",variant:i,suffix:o}),f2=(i,o,n,e,t,r)=>({template:i,context:o,componentName:"velt-comment-dialog-composer-action-button-wireframe",variant:n,suffix:e,setIfCondition:t,componentElementRef:r});function eGe(i,o){if(i&1){let n=q();_(0,"velt-autocomplete-tool-internal",6),P(1,"translate"),z("buttonClick",function(){N(n);let t=l(4).ngIf;return F(t==null?null:t.onAtClick(t==null||t.newCommentTextArea==null?null:t.newCommentTextArea.nativeElement))}),b()}if(i&2){let n=l(4).ngIf,e=l();c("hotkey",e.hotkey)("template",e.template)("componentMeta",k(9,$0,n==null?null:n.variant,e.type))("darkMode",!!(n!=null&&n.darkMode))("triggerElement",n==null||n.newCommentTextArea==null?null:n.newCommentTextArea.nativeElement),x("aria-label",M(1,7,"Mention someone using @ symbol"))("data-testid",e.componentId+"-autocomplete-new")}}function tGe(i,o){if(i&1){let n=q();_(0,"velt-autocomplete-tool-internal",6),P(1,"translate"),z("buttonClick",function(){N(n);let t=l(4).ngIf;return F(t==null?null:t.onAtClick(t==null||t.editCommentTextArea==null?null:t.editCommentTextArea.nativeElement))}),b()}if(i&2){let n=l(4).ngIf,e=l();c("hotkey",e.hotkey)("template",e.template)("componentMeta",k(9,$0,n==null?null:n.variant,e.type))("darkMode",!!(n!=null&&n.darkMode))("triggerElement",n==null||n.editCommentTextArea==null?null:n.editCommentTextArea.nativeElement),x("aria-label",M(1,7,"Mention someone using @ symbol while editing"))("data-testid",e.componentId+"-autocomplete-edit")}}function nGe(i,o){if(i&1&&(f(0),g(1,eGe,2,12,"velt-autocomplete-tool-internal",5)(2,tGe,2,12,"velt-autocomplete-tool-internal",5),v()),i&2){let n=l(4);m(),c("ngIf",!n.editMode),m(),c("ngIf",n.editMode)}}function iGe(i,o){if(i&1&&(f(0),g(1,nGe,3,2,"ng-container",0),v()),i&2){let n=l(2).ngIf;m(),c("ngIf",n==null?null:n.userMentions)}}function oGe(i,o){if(i&1){let n=q();_(0,"velt-autocomplete-tool-internal",6),P(1,"translate"),z("buttonClick",function(){N(n);let t=l(4).ngIf;return F(t==null?null:t.onAtClick(t==null||t.newCommentTextArea==null?null:t.newCommentTextArea.nativeElement))}),b()}if(i&2){let n=l(4).ngIf,e=l();c("hotkey",e.hotkey)("template",e.template)("componentMeta",k(9,$0,n==null?null:n.variant,e.type))("darkMode",!!(n!=null&&n.darkMode))("triggerElement",n==null||n.newCommentTextArea==null?null:n.newCommentTextArea.nativeElement),x("aria-label",M(1,7,"Type @ to mention someone"))("data-testid",e.componentId+"-autocomplete-tool-new")}}function rGe(i,o){if(i&1){let n=q();_(0,"velt-autocomplete-tool-internal",6),P(1,"translate"),z("buttonClick",function(){N(n);let t=l(4).ngIf;return F(t==null?null:t.onAtClick(t==null||t.editCommentTextArea==null?null:t.editCommentTextArea.nativeElement))}),b()}if(i&2){let n=l(4).ngIf,e=l();c("hotkey",e.hotkey)("template",e.template)("componentMeta",k(9,$0,n==null?null:n.variant,e.type))("darkMode",!!(n!=null&&n.darkMode))("triggerElement",n==null||n.editCommentTextArea==null?null:n.editCommentTextArea.nativeElement),x("aria-label",M(1,7,"Type @ to mention someone while editing"))("data-testid",e.componentId+"-autocomplete-tool-edit")}}function aGe(i,o){if(i&1&&(f(0),g(1,oGe,2,12,"velt-autocomplete-tool-internal",5)(2,rGe,2,12,"velt-autocomplete-tool-internal",5),v()),i&2){let n=l(4);m(),c("ngIf",!n.editMode),m(),c("ngIf",n.editMode)}}function sGe(i,o){if(i&1&&(f(0),g(1,aGe,3,2,"ng-container",0),v()),i&2){let n=l(2).ngIf;m(),c("ngIf",n==null?null:n.userMentions)}}function lGe(i,o){if(i&1){let n=q();_(0,"app-attachment-button",8),P(1,"translate"),z("clicked",function(){N(n);let t=l(3).ngIf;return F(t==null?null:t.onAttachmentButtonClick())})("selectFiles",function(t){N(n);let r=l(3).ngIf;return F(r==null?null:r.selectFiles(t))})("setIfConditionEvent",function(t){N(n);let r=l(4);return F(r.setIfCondition(t))}),b()}if(i&2){let n=l(3).ngIf,e=l();c("template",e.template)("darkMode",!!(n!=null&&n.darkMode))("componentMeta",k(7,$0,n==null?null:n.variant,e.type)),x("aria-label",M(1,5,"Add file attachment to comment"))("data-testid",e.componentId+"-attachment-button")}}function cGe(i,o){if(i&1&&(f(0),g(1,lGe,2,10,"app-attachment-button",7),v()),i&2){let n=l(2).ngIf;m(),c("ngIf",n==null?null:n.enableAttachment)}}function dGe(i,o){if(i&1){let n=q();_(0,"app-attachment-button",8),P(1,"translate"),z("clicked",function(){N(n);let t=l(3).ngIf;return F(t==null?null:t.onAttachmentButtonClick())})("selectFiles",function(t){N(n);let r=l(3).ngIf;return F(r==null?null:r.selectFiles(t))})("setIfConditionEvent",function(t){N(n);let r=l(4);return F(r.setIfCondition(t))}),b()}if(i&2){let n=l(3).ngIf,e=l();c("template",e.template)("darkMode",!!(n!=null&&n.darkMode))("componentMeta",k(7,$0,n==null?null:n.variant,e.type)),x("aria-label",M(1,5,"Add file attachment to comment"))("data-testid",e.componentId+"-attachment-button")}}function mGe(i,o){if(i&1&&(f(0),g(1,dGe,2,10,"app-attachment-button",7),v()),i&2){let n=l(2).ngIf;m(),c("ngIf",n==null?null:n.enableAttachment)}}function pGe(i,o){if(i&1&&(f(0),_(1,"app-action-button",13),P(2,"translate"),le(),_(3,"svg",14),w(4,"path",15)(5,"path",16),b()(),v()),i&2){let n=l(4).ngIf,e=l();m(),c("title",M(2,4,"Record voice"))("darkMode",!!(n!=null&&n.darkMode)),x("aria-label","Record voice message")("data-testid",e.componentId+"-audio-record")}}function gGe(i,o){if(i&1){let n=q();_(0,"app-device-permission-button",10),P(1,"translate"),_(2,"div",11),P(3,"translate"),z("click",function(){N(n);let t=l(3).ngIf;return F(t!=null&&t.recorderInitConfig||t==null?null:t.initRecording("audio"))}),g(4,pGe,6,6,"ng-container",12),b()()}if(i&2){let n=l(3).ngIf,e=l();c("darkMode",!!(n!=null&&n.darkMode)),x("aria-label",M(1,6,"Record voice message"))("data-testid",e.componentId+"-audio-button"),m(2),x("aria-label",M(3,8,"Click to start voice recording"))("data-testid",e.componentId+"-audio-record"),m(2),c("veltDynamicTemplate",Us(12,f2,e.template,A(10,j0,e.componentConfigSignal),n==null?null:n.variant,e.type,e.setIfCondition.bind(e),e.elementRef))}}function uGe(i,o){if(i&1&&(f(0),g(1,gGe,5,19,"app-device-permission-button",9),v()),i&2){let n=l(2).ngIf;m(),c("ngIf",n==null||n.allowedRecordings==null?null:n.allowedRecordings.includes("audio"))}}function hGe(i,o){if(i&1&&(f(0),_(1,"app-action-button",13),P(2,"translate"),P(3,"translate"),le(),_(4,"svg",19),w(5,"path",20),b()(),v()),i&2){let n=l(4).ngIf,e=l();m(),c("title",M(2,4,"Record video"))("darkMode",!!(n!=null&&n.darkMode)),x("aria-label",M(3,6,"Record video message"))("data-testid",e.componentId+"-video-record")}}function fGe(i,o){if(i&1){let n=q();_(0,"app-device-permission-button",18),P(1,"translate"),_(2,"div",11),z("click",function(){N(n);let t=l(3).ngIf;return F(t!=null&&t.recorderInitConfig||t==null?null:t.initRecording("video"))}),g(3,hGe,6,8,"ng-container",12),b()()}if(i&2){let n=l(3).ngIf,e=l();c("darkMode",!!(n!=null&&n.darkMode)),x("aria-label",M(1,6,"Record video message"))("data-testid",e.componentId+"-video-button"),m(2),x("aria-label","Click to start video recording")("data-testid",e.componentId+"-video-record"),m(),c("veltDynamicTemplate",Us(10,f2,e.template,A(8,j0,e.componentConfigSignal),n==null?null:n.variant,e.type,e.setIfCondition.bind(e),e.elementRef))}}function vGe(i,o){if(i&1&&(f(0),g(1,fGe,4,17,"app-device-permission-button",17),v()),i&2){let n=l(2).ngIf;m(),c("ngIf",n==null||n.allowedRecordings==null?null:n.allowedRecordings.includes("video"))}}function CGe(i,o){if(i&1&&(f(0),_(1,"app-action-button",13),P(2,"translate"),P(3,"translate"),le(),_(4,"svg",22),w(5,"path",23)(6,"path",24)(7,"path",25)(8,"path",26),b()(),v()),i&2){let n=l(4).ngIf,e=l();m(),c("title",M(2,4,"Record screen"))("darkMode",!!(n!=null&&n.darkMode)),x("aria-label",M(3,6,"Record your screen"))("data-testid",e.componentId+"-screen-record")}}function _Ge(i,o){if(i&1){let n=q();_(0,"div",11),P(1,"translate"),z("click",function(){N(n);let t=l(3).ngIf;return F(t!=null&&t.recorderInitConfig||t==null?null:t.initRecording("screen"))}),g(2,CGe,9,8,"ng-container",12),b()}if(i&2){let n=l(3).ngIf,e=l();x("aria-label",M(1,3,"Click to start screen recording"))("data-testid",e.componentId+"-screen-record"),m(2),c("veltDynamicTemplate",Us(7,f2,e.template,A(5,j0,e.componentConfigSignal),n==null?null:n.variant,e.type,e.setIfCondition.bind(e),e.elementRef))}}function yGe(i,o){if(i&1&&(f(0),g(1,_Ge,3,14,"div",21),v()),i&2){let n=l(2).ngIf;m(),c("ngIf",(n==null||n.allowedRecordings==null?null:n.allowedRecordings.includes("screen"))&&(n==null?null:n.screenSharingSupported))}}function SGe(i,o){i&1&&(_(0,"div",30),le(),_(1,"svg",31),w(2,"path",32),b()())}function bGe(i,o){if(i&1){let n=q();_(0,"button",28),P(1,"translate"),z("click",function(t){N(n);let r=l(3).ngIf;return r==null||r.addComment(),F(t.stopPropagation())}),g(2,SGe,3,0,"div",29),b()}if(i&2){let n,e=l(3).ngIf,t=l();c("disabled",(e==null||e.newComment==null||(n=e.newComment.trim())==null?null:n.length)<1&&!(!(e==null||e.selectedAttachments==null)&&e.selectedAttachments.length)&&!(!(e==null||e.localRecordedData==null)&&e.localRecordedData.length)||(e==null?null:e.uploadingAttachments)),x("aria-label",M(1,4,"Save new comment"))("data-testid",t.componentId+"-submit-new"),m(2),c("veltDynamicTemplate",Us(8,f2,t.template,A(6,j0,t.componentConfigSignal),e==null?null:e.variant,t.type,t.setIfCondition.bind(t),t.elementRef))}}function IGe(i,o){i&1&&(_(0,"div",30),le(),_(1,"svg",31),w(2,"path",33),b()())}function EGe(i,o){if(i&1){let n=q();_(0,"button",28),P(1,"translate"),z("click",function(t){N(n);let r=l(3).ngIf,a=l();return r==null||r.updateComment(a.i,r==null||r.editCommentTextArea==null?null:r.editCommentTextArea.nativeElement.innerText),F(t.stopPropagation())}),g(2,IGe,3,0,"div",29),b()}if(i&2){let n,e=l(3).ngIf,t=l();c("disabled",!(!(e==null||e.editCommentTextArea==null||e.editCommentTextArea.nativeElement==null||e.editCommentTextArea.nativeElement.innerText==null||(n=e.editCommentTextArea.nativeElement.innerText.trim())==null)&&n.length)&&!(!(e==null||e.selectedAttachments==null)&&e.selectedAttachments.length)&&!(!(e==null||e.attachmentsToDelete==null)&&e.attachmentsToDelete.length)&&!(!(e==null||e.localRecordedData==null)&&e.localRecordedData.length)||(e==null?null:e.uploadingAttachments)),x("aria-label",M(1,4,"Save edited comment"))("data-testid",t.componentId+"-submit-edit"),m(2),c("veltDynamicTemplate",Us(8,f2,t.template,A(6,j0,t.componentConfigSignal),e==null?null:e.variant,t.type,t.setIfCondition.bind(t),t.elementRef))}}function xGe(i,o){if(i&1&&(f(0),g(1,bGe,3,15,"button",27)(2,EGe,3,15,"button",27),v()),i&2){let n=l(3);m(),c("ngIf",!n.editMode),m(),c("ngIf",n.editMode)}}function TGe(i,o){if(i&1){let n=q();f(0),_(1,"div",2),P(2,"translate"),z("click",function(t){return N(n),F(t.stopPropagation())}),f(3,3),g(4,iGe,2,1,"ng-container",4)(5,sGe,2,1,"ng-container",4)(6,cGe,2,1,"ng-container",4)(7,mGe,2,1,"ng-container",4)(8,uGe,2,1,"ng-container",4)(9,vGe,2,1,"ng-container",4)(10,yGe,2,1,"ng-container",4)(11,xGe,3,2,"ng-container",4),v(),b(),v()}if(i&2){let n=l(2);m(),x("aria-label",M(2,11,"Comment tools and actions"))("data-testid",n.componentId),m(2),c("ngSwitch",n.type),m(),c("ngSwitchCase","userMentions"),m(),c("ngSwitchCase","autocomplete"),m(),c("ngSwitchCase","file"),m(),c("ngSwitchCase","attachments"),m(),c("ngSwitchCase","audio"),m(),c("ngSwitchCase","video"),m(),c("ngSwitchCase","screen"),m(),c("ngSwitchCase","submit")}}function DGe(i,o){if(i&1&&(f(0),g(1,TGe,12,13,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,Jze,n.conditionSignal(),A(1,j0,n.componentConfigSignal)))}}var v2=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.editMode=!1,this.hotkey="@",this.componentId="velt-comment-dialog-composer-action-button",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogComposerActionButtonComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogComposerActionButtonComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","group"),e.setAttribute("aria-label",`Composer action button group for ${this.type}`)}catch(e){this.loggingService.catch("Error in CommentDialogComposerActionButtonComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-composer-action-button"]],inputs:{type:"type",editMode:"editMode",i:"i",hotkey:"hotkey"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["role","group",1,"velt-comment-dialog-composer-action-button",3,"click"],[3,"ngSwitch"],[4,"ngSwitchCase"],[3,"hotkey","template","componentMeta","darkMode","triggerElement","buttonClick",4,"ngIf"],[3,"buttonClick","hotkey","template","componentMeta","darkMode","triggerElement"],[3,"template","darkMode","componentMeta","clicked","selectFiles","setIfConditionEvent",4,"ngIf"],[3,"clicked","selectFiles","setIfConditionEvent","template","darkMode","componentMeta"],["type","audio","mode","thread",3,"darkMode",4,"ngIf"],["type","audio","mode","thread",3,"darkMode"],["role","button","tabindex","0",3,"click"],[4,"veltDynamicTemplate"],[3,"title","darkMode"],["icon","","width","14","height","20","viewBox","0 0 14 20","fill","none","xmlns","http://www.w3.org/2000/svg","aria-hidden","true","role","img"],["fill-rule","evenodd","clip-rule","evenodd","d","M0.833333 7.5C1.29357 7.5 1.66667 7.8731 1.66667 8.33333V9.16667C1.66667 11.9281 3.90524 14.1667 6.66667 14.1667C9.42809 14.1667 11.6667 11.9281 11.6667 9.16667V8.33333C11.6667 7.8731 12.0398 7.5 12.5 7.5C12.9602 7.5 13.3333 7.8731 13.3333 8.33333V9.16667C13.3333 12.5663 10.7886 15.3717 7.5 15.7818V18.3333H10C10.4602 18.3333 10.8333 18.7064 10.8333 19.1667C10.8333 19.6269 10.4602 20 10 20H3.33333C2.8731 20 2.5 19.6269 2.5 19.1667C2.5 18.7064 2.8731 18.3333 3.33333 18.3333H5.83333V15.7818C2.54474 15.3717 0 12.5663 0 9.16667V8.33333C0 7.8731 0.373096 7.5 0.833333 7.5Z","fill","currentColor"],["fill-rule","evenodd","clip-rule","evenodd","d","M8.33203 9.16667V3.33333C8.33203 2.41286 7.58584 1.66667 6.66536 1.66667C5.74489 1.66667 4.9987 2.41286 4.9987 3.33333V9.16667C4.9987 10.0871 5.74489 10.8333 6.66536 10.8333C7.58584 10.8333 8.33203 10.0871 8.33203 9.16667ZM6.66536 0C4.82442 0 3.33203 1.49238 3.33203 3.33333V9.16667C3.33203 11.0076 4.82442 12.5 6.66536 12.5C8.50631 12.5 9.9987 11.0076 9.9987 9.16667V3.33333C9.9987 1.49238 8.50631 0 6.66536 0Z","fill","currentColor"],["type","video","mode","thread",3,"darkMode",4,"ngIf"],["type","video","mode","thread",3,"darkMode"],["icon","","width","19","height","11","viewBox","0 0 19 11","fill","none","xmlns","http://www.w3.org/2000/svg","aria-hidden","true","role","img"],["fill-rule","evenodd","clip-rule","evenodd","d","M2.55139 0.230077C1.68754 0.453772 1.06855 1.02195 0.766641 1.86822L0.666016 2.15026V5.58765V9.02505L0.766892 9.30709C1.0535 10.1083 1.64038 10.6731 2.43987 10.9173L2.70863 10.9993H7.1343H11.56L11.8467 10.9033C12.6234 10.6431 13.2099 10.0635 13.47 9.29927C13.56 9.03464 13.5637 8.99015 13.5769 8.02909C13.5844 7.48129 13.6004 7.03312 13.6125 7.03312C13.661 7.03312 15.0857 7.85517 15.8518 8.3252C16.7188 8.85713 16.9126 8.93691 17.338 8.93691C18.0692 8.93691 18.7509 8.40671 18.947 7.68535C19.0174 7.42654 19.0165 3.74584 18.946 3.48531C18.7883 2.90254 18.278 2.40649 17.7016 2.27577C17.4483 2.2183 17.0895 2.23195 16.8373 2.30859C16.6848 2.35492 16.3699 2.52421 15.9107 2.80671C15.3288 3.1648 13.6405 4.14219 13.6039 4.14219C13.5979 4.14219 13.5847 3.70988 13.5747 3.18148C13.5543 2.10348 13.5363 1.99704 13.2916 1.506C13.0166 0.954081 12.475 0.492835 11.8467 0.275239L11.56 0.17596L7.18806 0.168733C2.95948 0.161752 2.80747 0.163762 2.55139 0.230077ZM11.3211 1.83448C11.5404 1.89857 11.7306 2.05186 11.8398 2.25268L11.9183 2.39705V5.57098V8.74488L11.8268 8.91988C11.7122 9.13896 11.4929 9.30656 11.2552 9.35673C11.0123 9.40799 3.20786 9.40919 2.98224 9.35804C2.74243 9.30364 2.53297 9.14287 2.42553 8.93071L2.33236 8.74678V5.58765V2.42853L2.42553 2.2446C2.52985 2.03864 2.7435 1.8703 2.96604 1.81882C3.04208 1.80123 4.88581 1.78558 7.11882 1.7836C10.641 1.7805 11.1578 1.78678 11.3211 1.83448ZM17.3116 5.59171V7.28802L17.2309 7.23605C16.8358 6.98144 15.6936 6.30232 15.1359 5.99038C14.7573 5.77856 14.4468 5.59675 14.4461 5.58635C14.4453 5.57591 14.7874 5.37341 15.2062 5.13632C15.6251 4.89919 16.258 4.52439 16.6128 4.30341C16.9675 4.08243 17.2699 3.90019 17.2847 3.8985C17.2995 3.89681 17.3116 4.65875 17.3116 5.59171Z","fill","currentColor"],["role","button","tabindex","0",3,"click",4,"ngIf"],["icon","","width","20","height","20","viewBox","0 0 20 20","fill","none","xmlns","http://www.w3.org/2000/svg","aria-hidden","true","role","img"],["d","M7.4987 15H9.16536V16.6667H10.832V15H12.4987V16.6667H13.332C13.7923 16.6667 14.1654 17.0398 14.1654 17.5C14.1654 17.9602 13.7923 18.3333 13.332 18.3333H6.66536C6.20513 18.3333 5.83203 17.9602 5.83203 17.5C5.83203 17.0398 6.20513 16.6667 6.66536 16.6667H7.4987V15Z","fill","currentColor"],["fill-rule","evenodd","clip-rule","evenodd","d","M3.33464 5L3.33464 11.6667C3.33464 12.5871 4.08083 13.3333 5.0013 13.3333L15.0013 13.3333C15.9218 13.3333 16.668 12.5871 16.668 11.6667L16.668 5C16.668 4.07953 15.9218 3.33333 15.0013 3.33333L5.0013 3.33333C4.08083 3.33333 3.33464 4.07953 3.33464 5ZM1.66797 11.6667C1.66797 13.5076 3.16035 15 5.0013 15L15.0013 15C16.8423 15 18.3346 13.5076 18.3346 11.6667L18.3346 5C18.3346 3.15905 16.8423 1.66667 15.0013 1.66667L5.0013 1.66667C3.16035 1.66667 1.66797 3.15905 1.66797 5L1.66797 11.6667Z","fill","currentColor"],["d","M5.83333 5C5.3731 5 5 5.3731 5 5.83333C5 6.29357 5.3731 6.66667 5.83333 6.66667H11.6667C12.1269 6.66667 12.5 6.29357 12.5 5.83333C12.5 5.3731 12.1269 5 11.6667 5H5.83333Z","fill","currentColor"],["d","M5.83333 8.33333C5.3731 8.33333 5 8.70643 5 9.16667C5 9.6269 5.3731 10 5.83333 10H7.5C7.96024 10 8.33333 9.6269 8.33333 9.16667C8.33333 8.70643 7.96024 8.33333 7.5 8.33333H5.83333Z","fill","currentColor"],["class","velt-composer--submit-button",3,"disabled","click",4,"ngIf"],[1,"velt-composer--submit-button",3,"click","disabled"],["class","velt-composer--input-button",4,"veltDynamicTemplate"],[1,"velt-composer--input-button"],["width","14","height","14","viewBox","0 0 24 24","fill","none","xmlns","http://www.w3.org/2000/svg","aria-hidden","true","role","img"],["d","M20.8089 10.1394L4.6724 3.15546C3.9926 2.8612 3.22459 2.99065 2.66814 3.49311C2.1117 3.99565 1.87896 4.76995 2.06084 5.51382L3.49713 11.3888H10.5294C10.853 11.3888 11.1154 11.6625 11.1154 12C11.1154 12.3375 10.853 12.6112 10.5294 12.6112H3.49713L2.06084 18.4862C1.87896 19.2301 2.11166 20.0044 2.66814 20.5069C3.22572 21.0104 3.99381 21.1382 4.67244 20.8445L20.8089 13.8606C21.5436 13.5426 22 12.8297 22 12C22 11.1703 21.5436 10.4574 20.8089 10.1394Z","fill","currentColor"],["d","M20.8089 10.1394L4.6724 3.15546C3.9926 2.8612 3.22459 2.99065 2.66814 3.49311C2.1117 3.99565 1.87896 4.76995 2.06084 5.51382L3.49713 11.3888H10.5294C10.853 11.3888 11.1154 11.6625 11.1154 12C11.1154 12.3375 10.853 12.6112 10.5294 12.6112H3.49713L2.06084 18.4862C1.87896 19.2301 2.11166 20.0044 2.66814 20.5069C3.22572 21.0104 3.99381 21.1382 4.67244 20.8445L20.8089 13.8606C21.5436 13.5426 22 12.8297 22 12C22 11.1703 21.5436 10.4574 20.8089 10.1394Z","fill","white"]],template:function(t,r){t&1&&g(0,DGe,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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}[_nghost-%COMP%]:empty{display:none}.velt-comment-dialog-composer-action-button[_ngcontent-%COMP%]{display:flex;justify-content:center;align-items:center}.velt-composer--submit-button[_ngcontent-%COMP%]{background:transparent;border:0;outline:0}.velt-composer--submit-button[_ngcontent-%COMP%] .velt-composer--input-button[_ngcontent-%COMP%]{display:flex;justify-content:center;align-items:center;width:2.4em;height:2.4em;border:0;border-radius:var(--velt-border-radius-3xl);background:var(--velt-accent);color:var(--velt-accent-foreground);cursor:pointer}.velt-composer--submit-button[_ngcontent-%COMP%]:disabled .velt-composer--input-button[_ngcontent-%COMP%]{opacity:.4;pointer-events:none;cursor:not-allowed}.velt-composer--submit-button[_ngcontent-%COMP%]:hover .velt-composer--input-button[_ngcontent-%COMP%]{background:var(--velt-accent-hover);color:var(--velt-accent-foreground)}.velt-composer--submit-button[_ngcontent-%COMP%]:focus .velt-composer--input-button[_ngcontent-%COMP%]{background:var(--velt-accent-hover);color:var(--velt-accent-foreground);outline:0}.velt-composer--submit-button[_ngcontent-%COMP%]:active .velt-composer--input-button[_ngcontent-%COMP%]{background:var(--velt-accent-hover);color:var(--velt-accent-foreground)}"],changeDetection:0});let i=o;return i})();var Mde=i=>({componentConfigSignal:i}),wGe=(i,o)=>({condition:i,data:o}),OGe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-composer-assign-user-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function AGe(i,o){if(i&1){let n=q();_(0,"app-assign-dropdown",4),P(1,"translate"),z("setAssignTo",function(t){N(n);let r=l(3).ngIf;return F(r==null?null:r.setAssignTo(t))}),b()}if(i&2){let n=l(3).ngIf,e=l();c("darkMode",!!(n!=null&&n.darkMode))("assignTo",n==null?null:n.assignTo)("selectedUserContacts",n==null?null:n.selectedUserContacts),x("data-testid",e.componentId+"-dropdown")("aria-label",M(1,5,"Assign user"))}}function PGe(i,o){if(i&1&&(f(0),g(1,AGe,2,7,"app-assign-dropdown",3),v()),i&2){let n=l(2).ngIf;m(),c("ngIf",n==null?null:n.userMentions)}}function MGe(i,o){if(i&1&&(f(0),g(1,PGe,2,1,"ng-container",2),v()),i&2){let n=l().ngIf,e=l();m(),c("veltDynamicTemplate",$(3,OGe,e.template,A(1,Mde,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function kGe(i,o){if(i&1&&(f(0),g(1,MGe,2,9,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,wGe,n.conditionSignal(),A(1,Mde,n.componentConfigSignal)))}}var C2=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-comment-dialog-composer-assign-user",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAssignUserComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAssignUserComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogComposerAssignUserComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-composer-assign-user"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[3,"darkMode","assignTo","selectedUserContacts","setAssignTo",4,"ngIf"],[3,"setAssignTo","darkMode","assignTo","selectedUserContacts"]],template:function(t,r){t&1&&g(0,kGe,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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%}[_nghost-%COMP%]:empty{display:none}"],changeDetection:0});let i=o;return i})();var RGe=(i,o,n,e)=>({componentConfigSignal:i,file:o,fileIndex:n,isEditMode:e}),NGe=(i,o)=>({condition:i,data:o}),FGe=(i,o,n,e)=>({componentConfigSignal:i,fileIndex:o,file:n,isEditMode:e}),LGe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-composer-attachments-image-preview-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function BGe(i,o){if(i&1&&(f(0),w(1,"img",3),v()),i&2){let n=l(3);m(),c("src",n.file==null?null:n.file.url,mn)}}function VGe(i,o){if(i&1&&(f(0),g(1,BGe,2,1,"ng-container",2),v()),i&2){let n=l().ngIf,e=l();m(),c("veltDynamicTemplate",$(6,LGe,e.template,dt(1,FGe,e.componentConfigSignal,e.fileIndex,e.file,e.isEditMode),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function UGe(i,o){if(i&1&&(f(0),g(1,VGe,2,12,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(6,NGe,n.conditionSignal(),dt(1,RGe,n.componentConfigSignal,n.file,n.fileIndex,n.isEditMode)))}}var _2=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.componentId="velt-comment-dialog-composer-attachments-image-preview",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,file:this.file,fileIndex:this.fileIndex,isEditMode:this.isEditMode}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsImagePreviewComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsImagePreviewComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsImagePreviewComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-composer-attachments-image-preview"]],inputs:{file:"file",fileIndex:"fileIndex",isEditMode:"isEditMode"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["velt-ignore-change-detection","true","aria-hidden","true","role","img",3,"src"]],template:function(t,r){t&1&&g(0,UGe,2,9,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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}img[_ngcontent-%COMP%]{width:100%;object-fit:cover;height:100%}"],changeDetection:0});let i=o;return i})();var jGe=(i,o,n,e)=>({componentConfigSignal:i,file:o,fileIndex:n,isEditMode:e}),$Ge=(i,o)=>({condition:i,data:o}),HGe=(i,o,n,e)=>({componentConfigSignal:i,fileIndex:o,file:n,isEditMode:e}),zGe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-composer-attachments-image-delete-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function GGe(i,o){i&1&&(f(0),le(),_(1,"svg",5),w(2,"path",6)(3,"path",7),b(),v())}function WGe(i,o){if(i&1){let n=q();_(0,"button",3),P(1,"translate"),P(2,"translate"),z("click",function(){N(n);let t=l(2).ngIf,r=l();return F(r.isEditMode?t==null?null:t.removeAttachmentFromComment(r.fileIndex):t==null?null:t.removeFile(r.fileIndex))}),g(3,GGe,4,0,"ng-container",4),b()}if(i&2){let n=l(2).ngIf,e=l();c("title",M(1,4,"Remove File")),x("data-testid",e.componentId)("aria-label",M(2,6,"Remove file")),m(3),c("veltDynamicTemplate",$(13,zGe,e.template,dt(8,HGe,e.componentConfigSignal,e.fileIndex,e.file,e.isEditMode),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function qGe(i,o){if(i&1&&(f(0),g(1,WGe,4,19,"button",2),v()),i&2){let n=l().ngIf;m(),c("ngIf",!(n!=null&&n.uploadingAttachments))}}function YGe(i,o){if(i&1&&(f(0),g(1,qGe,2,1,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(6,$Ge,n.conditionSignal(),dt(1,jGe,n.componentConfigSignal,n.file,n.fileIndex,n.isEditMode)))}}var y2=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.componentId="velt-comment-dialog-composer-attachments-image-delete",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,file:this.file,fileIndex:this.fileIndex,isEditMode:this.isEditMode}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsImageDeleteComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsImageDeleteComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsImageDeleteComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-composer-attachments-image-delete"]],inputs:{file:"file",fileIndex:"fileIndex",isEditMode:"isEditMode"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["class","velt-composer--icon-button",3,"title","click",4,"ngIf"],[1,"velt-composer--icon-button",3,"click","title"],[4,"veltDynamicTemplate"],["xmlns","http://www.w3.org/2000/svg","height","24px","viewBox","0 0 24 24","width","24px","fill","currentColor","aria-hidden","true","role","img"],["d","M0 0h24v24H0V0z","fill","none"],["d","M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"]],template:function(t,r){t&1&&g(0,YGe,2,9,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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-composer--icon-button[_ngcontent-%COMP%]{background:var(--velt-white);display:flex;align-items:center;border-radius:var(--velt-border-radius-3xl);width:40px;height:40px;justify-content:center;margin:var(--velt-spacing-xs);color:var(--velt-black)}"],changeDetection:0});let i=o;return i})();var KGe=(i,o,n,e)=>({componentConfigSignal:i,file:o,fileIndex:n,isEditMode:e}),ZGe=(i,o)=>({condition:i,data:o}),XGe=(i,o,n,e)=>({componentConfigSignal:i,fileIndex:o,file:n,isEditMode:e}),QGe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-composer-attachments-image-loading-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function JGe(i,o){i&1&&(f(0),le(),_(1,"svg",3)(2,"circle",4),w(3,"animateTransform",5),b()(),v())}function eWe(i,o){if(i&1&&(f(0),g(1,JGe,4,0,"ng-container",2),v()),i&2){let n=l(2).ngIf,e=l();m(),c("veltDynamicTemplate",$(6,QGe,e.template,dt(1,XGe,e.componentConfigSignal,e.fileIndex,e.file,e.isEditMode),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function tWe(i,o){if(i&1&&(f(0),g(1,eWe,2,12,"ng-container",0),v()),i&2){let n=l().ngIf,e=l();m(),c("ngIf",(n==null?null:n.uploadingAttachments)&&!e.isEditMode&&!(e.file!=null&&e.file.uploaded))}}function nWe(i,o){if(i&1&&(f(0),g(1,tWe,2,1,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(6,ZGe,n.conditionSignal(),dt(1,KGe,n.componentConfigSignal,n.file,n.fileIndex,n.isEditMode)))}}var S2=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.componentId="velt-comment-dialog-composer-attachments-image-loading",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,file:this.file,fileIndex:this.fileIndex,isEditMode:this.isEditMode}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsImageLoadingComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsImageLoadingComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsImageLoadingComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-composer-attachments-image-loading"]],inputs:{file:"file",fileIndex:"fileIndex",isEditMode:"isEditMode"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["xmlns","http://www.w3.org/2000/svg",0,"xmlns","xlink","http://www.w3.org/1999/xlink","width","48px","height","48px","viewBox","0 0 100 100","preserveAspectRatio","xMidYMid","aria-hidden","true","role","img",2,"margin","auto","display","block"],["cx","50","cy","50","fill","none","stroke","currentColor","stroke-width","7","r","34","stroke-dasharray","160.22122533307947 55.40707511102649"],["attributeName","transform","type","rotate","repeatCount","indefinite","dur","1s","values","0 50 50;360 50 50","keyTimes","0;1"]],template:function(t,r){t&1&&g(0,nWe,2,9,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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}svg[_ngcontent-%COMP%]{color:var(--velt-white)}"],changeDetection:0});let i=o;return i})();var iWe=(i,o,n,e)=>({componentConfigSignal:i,file:o,fileIndex:n,isEditMode:e}),oWe=(i,o)=>({condition:i,data:o}),rWe=(i,o,n,e)=>({componentConfigSignal:i,fileIndex:o,file:n,isEditMode:e}),aWe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-composer-attachments-image-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function sWe(i,o){if(i&1&&(f(0),_(1,"div",3),P(2,"translate"),P(3,"translate"),_(4,"div",4),P(5,"translate"),P(6,"translate"),w(7,"app-comment-dialog-composer-attachments-image-loading",5),P(8,"translate"),P(9,"translate"),w(10,"app-comment-dialog-composer-attachments-image-delete",6),P(11,"translate"),P(12,"translate"),b(),w(13,"app-comment-dialog-composer-attachments-image-preview",7),P(14,"translate"),P(15,"translate"),b(),v()),i&2){let n=l(3).ngIf,e=l();m(),ue("loading",(n==null?null:n.uploadingAttachments)&&!e.isEditMode&&!(e.file!=null&&e.file.uploaded)),x("aria-label",M(2,24,"Image attachment:")+" "+M(3,26,(e.file==null?null:e.file.name)||"unnamed image"))("data-testid",e.componentId+"-selected-file"),m(3),x("aria-label",M(5,28,"Actions for image:")+" "+M(6,30,(e.file==null?null:e.file.name)||"unnamed image"))("data-testid",e.componentId+"-file-actions"),m(3),c("componentConfigSignal",e.componentConfigSignal)("file",e.file)("fileIndex",e.fileIndex)("isEditMode",e.isEditMode),x("aria-label",M(8,32,"Uploading image:")+" "+M(9,34,(e.file==null?null:e.file.name)||"unnamed image"))("data-testid",e.componentId+"-file-loading"),m(3),c("componentConfigSignal",e.componentConfigSignal)("file",e.file)("fileIndex",e.fileIndex)("isEditMode",e.isEditMode),x("aria-label",M(11,36,"Delete image:")+" "+M(12,38,(e.file==null?null:e.file.name)||"unnamed image"))("data-testid",e.componentId+"-file-delete"),m(3),c("componentConfigSignal",e.componentConfigSignal)("file",e.file)("fileIndex",e.fileIndex)("isEditMode",e.isEditMode),x("aria-label",M(14,40,"Preview of image:")+" "+M(15,42,(e.file==null?null:e.file.name)||"unnamed image"))("data-testid",e.componentId+"-file-preview")}}function lWe(i,o){if(i&1&&(f(0),g(1,sWe,16,44,"ng-container",2),v()),i&2){let n=l(2).ngIf,e=l();m(),c("veltDynamicTemplate",$(6,aWe,e.template,dt(1,rWe,e.componentConfigSignal,e.fileIndex,e.file,e.isEditMode),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function cWe(i,o){if(i&1&&(f(0),g(1,lWe,2,12,"ng-container",0),v()),i&2){let n=l(2);m(),c("ngIf",n.isEditMode?n.file==null||n.file.mimeType==null?null:n.file.mimeType.includes("image"):n.file==null||n.file.fileType==null?null:n.file.fileType.includes("image"))}}function dWe(i,o){if(i&1&&(f(0),g(1,cWe,2,1,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(6,oWe,n.conditionSignal(),dt(1,iWe,n.componentConfigSignal,n.file,n.fileIndex,n.isEditMode)))}}var b2=(()=>{let o=class o extends H{set _imageWireframe(e){this.imageWireframe=e,this.imageWireframe?this.template=this.domService.deepCloneElement(this.imageWireframe):this.template=null}constructor(e,t,r,a){super(t,r,a),this.domService=e,this.elementRef=t,this.dynamicDataService=r,this.loggingService=a,this.componentId="velt-comment-dialog-composer-attachments-image",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,file:this.file,fileIndex:this.fileIndex,isEditMode:this.isEditMode}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsImageComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsImageComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","region"),e.setAttribute("aria-label","Image attachment controls")}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsImageComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(Fe),h(R),h(S),h(y))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-composer-attachments-image"]],inputs:{file:"file",fileIndex:"fileIndex",isEditMode:"isEditMode",_imageWireframe:[0,"imageWireframe","_imageWireframe"]},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["role","region",1,"velt-composer--selected-file"],["role","group",1,"velt-composer--selected-file-actions"],[3,"componentConfigSignal","file","fileIndex","isEditMode"],["role","button","tabindex","0",3,"componentConfigSignal","file","fileIndex","isEditMode"],["role","img",3,"componentConfigSignal","file","fileIndex","isEditMode"]],template:function(t,r){t&1&&g(0,dWe,2,9,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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%]:empty{display:none}.velt-composer--selected-file[_ngcontent-%COMP%]{border-radius:var(--velt-border-radius-sm);overflow:hidden;line-height:0;position:relative;height:80px;width:93px;flex:0 0 30%}.velt-composer--selected-file[_ngcontent-%COMP%] .velt-composer--selected-file-actions[_ngcontent-%COMP%]{position:absolute;width:100%;height:100%;background:color-mix(in srgb,var(--velt-surface-0) 32%,transparent);align-items:center;justify-content:center;display:none}.velt-composer--selected-file[_ngcontent-%COMP%]:hover .velt-composer--selected-file-actions[_ngcontent-%COMP%], .velt-composer--selected-file.loading[_ngcontent-%COMP%] .velt-composer--selected-file-actions[_ngcontent-%COMP%]{display:flex}"],changeDetection:0});let i=o;return i})();var mWe=(i,o,n)=>({componentConfigSignal:i,file:o,fileIndex:n}),pWe=(i,o)=>({condition:i,data:o}),gWe=(i,o,n)=>({componentConfigSignal:i,fileIndex:o,file:n}),uWe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-composer-attachments-invalid-item-preview-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function hWe(i,o){if(i&1&&(f(0),w(1,"img",3),v()),i&2){let n=l(3);m(),c("src",n.file==null?null:n.file.url,mn)}}function fWe(i,o){if(i&1&&(f(0),g(1,hWe,2,1,"ng-container",2),v()),i&2){let n=l().ngIf,e=l();m(),c("veltDynamicTemplate",$(5,uWe,e.template,$e(1,gWe,e.componentConfigSignal,e.fileIndex,e.file),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function vWe(i,o){if(i&1&&(f(0),g(1,fWe,2,11,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(5,pWe,n.conditionSignal(),$e(1,mWe,n.componentConfigSignal,n.file,n.fileIndex)))}}var I2=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.componentId="velt-comment-dialog-composer-attachments-invalid-item-preview",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,file:this.file,fileIndex:this.fileIndex}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsInvalidItemPreviewComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsInvalidItemPreviewComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsInvalidItemPreviewComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-composer-attachments-invalid-item-preview"]],inputs:{file:"file",fileIndex:"fileIndex"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["velt-ignore-change-detection","true","aria-hidden","true","role","img",3,"src"]],template:function(t,r){t&1&&g(0,vWe,2,8,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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}img[_ngcontent-%COMP%]{width:100%;object-fit:cover;height:100%}"],changeDetection:0});let i=o;return i})();var CWe=(i,o,n)=>({componentConfigSignal:i,file:o,fileIndex:n}),_We=(i,o)=>({condition:i,data:o}),yWe=(i,o,n)=>({componentConfigSignal:i,fileIndex:o,file:n}),SWe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-composer-attachments-invalid-item-message-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function bWe(i,o){if(i&1&&(f(0),_(1,"span",3),P(2,"translate"),P(3,"translate"),ee(4),P(5,"translate"),b(),v()),i&2){let n=l(3);m(),x("data-testid",n.componentId)("aria-label",M(2,3,"Error message:")+" "+M(3,5,n.file==null?null:n.file.errorMessage)),m(3),Ce(" ",M(5,7,n.file==null?null:n.file.errorMessage)," ")}}function IWe(i,o){if(i&1&&(f(0),g(1,bWe,6,9,"ng-container",2),v()),i&2){let n=l().ngIf,e=l();m(),c("veltDynamicTemplate",$(5,SWe,e.template,$e(1,yWe,e.componentConfigSignal,e.fileIndex,e.file),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function EWe(i,o){if(i&1&&(f(0),g(1,IWe,2,11,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(5,_We,n.conditionSignal(),$e(1,CWe,n.componentConfigSignal,n.file,n.fileIndex)))}}var E2=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.componentId="velt-comment-dialog-composer-attachments-invalid-item-message",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,file:this.file,fileIndex:this.fileIndex}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsInvalidItemMessageComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsInvalidItemMessageComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsInvalidItemMessageComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-composer-attachments-invalid-item-message"]],inputs:{file:"file",fileIndex:"fileIndex"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[1,"velt-composer--error-message"]],template:function(t,r){t&1&&g(0,EWe,2,8,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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-composer--error-message[_ngcontent-%COMP%]{font-size:var(--velt-font-size-xs);text-align:center;margin-top:var(--velt-spacing-xs);color:var(--velt-white)}"],changeDetection:0});let i=o;return i})();var kde=(i,o,n)=>({componentConfigSignal:i,file:o,fileIndex:n}),xWe=(i,o)=>({condition:i,data:o}),TWe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-composer-attachments-invalid-item-delete-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function DWe(i,o){i&1&&(f(0),le(),_(1,"svg",4),w(2,"path",5)(3,"path",6),b(),v())}function wWe(i,o){if(i&1){let n=q();f(0),_(1,"button",2),P(2,"translate"),P(3,"translate"),P(4,"translate"),z("click",function(){N(n);let t=l().ngIf,r=l();return F(t==null?null:t.removeInvalidFile(r.fileIndex))}),g(5,DWe,4,0,"ng-container",3),b(),v()}if(i&2){let n=l().ngIf,e=l();m(),c("title",M(2,4,"Remove File")),x("aria-label",M(3,6,"Remove invalid file:")+" "+M(4,8,(e.file==null?null:e.file.name)||"unnamed file"))("data-testid",e.componentId+"-button"),m(4),c("veltDynamicTemplate",$(14,TWe,e.template,$e(10,kde,e.componentConfigSignal,e.file,e.fileIndex),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function OWe(i,o){if(i&1&&(f(0),g(1,wWe,6,20,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(5,xWe,n.conditionSignal(),$e(1,kde,n.componentConfigSignal,n.file,n.fileIndex)))}}var x2=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.componentId="velt-comment-dialog-composer-attachments-invalid-item-delete",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,file:this.file,fileIndex:this.fileIndex}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsInvalidItemDeleteComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsInvalidItemDeleteComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsInvalidItemDeleteComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-composer-attachments-invalid-item-delete"]],inputs:{file:"file",fileIndex:"fileIndex"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[1,"velt-composer--icon-button",3,"click","title"],[4,"veltDynamicTemplate"],["xmlns","http://www.w3.org/2000/svg","height","24px","viewBox","0 0 24 24","width","24px","fill","currentColor","aria-hidden","true","role","img"],["d","M0 0h24v24H0V0z","fill","none"],["d","M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"]],template:function(t,r){t&1&&g(0,OWe,2,8,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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-composer--icon-button[_ngcontent-%COMP%]{background:var(--velt-white);display:flex;align-items:center;border-radius:var(--velt-border-radius-3xl);width:40px;height:40px;justify-content:center;margin:var(--velt-spacing-xs);color:var(--velt-black)}"],changeDetection:0});let i=o;return i})();var Rde=(i,o,n)=>({componentConfigSignal:i,file:o,fileIndex:n}),AWe=(i,o)=>({condition:i,data:o}),PWe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-composer-attachments-invalid-item-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function MWe(i,o){if(i&1&&(f(0),_(1,"div",3),P(2,"translate"),P(3,"translate"),_(4,"div",4),P(5,"translate"),P(6,"translate"),w(7,"app-comment-dialog-composer-attachments-invalid-item-delete",5),b(),_(8,"div",6),P(9,"translate"),le(),_(10,"svg",7),w(11,"path",8),b(),pt(),w(12,"app-comment-dialog-composer-attachments-invalid-item-message",9),b(),w(13,"app-comment-dialog-composer-attachments-invalid-item-preview",10),P(14,"translate"),P(15,"translate"),b(),v()),i&2){let n=l(3);m(),x("aria-label",M(2,18,"Invalid file:")+" "+M(3,20,(n.file==null?null:n.file.name)||"unnamed file"))("data-testid",n.componentId),m(3),x("aria-label",M(5,22,"Actions for invalid file:")+" "+M(6,24,(n.file==null?null:n.file.name)||"unnamed file"))("data-testid",n.componentId+"-file-actions"),m(3),c("componentConfigSignal",n.componentConfigSignal)("file",n.file)("fileIndex",n.fileIndex),x("aria-label","Remove invalid file: "+((n.file==null?null:n.file.name)||"unnamed file"))("data-testid",n.componentId+"-delete-file"),m(),x("aria-label","File error: "+M(9,26,(n.file==null?null:n.file.error)||"File cannot be uploaded"))("data-testid",n.componentId+"-error-message"),m(4),c("file",n.file)("componentConfigSignal",n.componentConfigSignal),x("data-testid",n.componentId+"-error-message-text"),m(),c("componentConfigSignal",n.componentConfigSignal)("file",n.file),x("aria-label",M(14,28,"Preview of invalid file:")+" "+M(15,30,(n.file==null?null:n.file.name)||"unnamed file"))("data-testid",n.componentId+"-preview-file")}}function kWe(i,o){if(i&1&&(f(0),g(1,MWe,16,32,"ng-container",2),v()),i&2){let n=l().ngIf,e=l();m(),c("veltDynamicTemplate",$(5,PWe,e.template,$e(1,Rde,e.componentConfigSignal,e.file,e.fileIndex),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function RWe(i,o){if(i&1&&(f(0),g(1,kWe,2,11,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(5,AWe,n.conditionSignal(),$e(1,Rde,n.componentConfigSignal,n.file,n.fileIndex)))}}var T2=(()=>{let o=class o extends H{set _itemWireframe(e){this.itemWireframe=e,this.itemWireframe?this.template=this.domService.deepCloneElement(this.itemWireframe):this.template=null}constructor(e,t,r,a){super(t,r,a),this.domService=e,this.elementRef=t,this.dynamicDataService=r,this.loggingService=a,this.componentId="velt-comment-dialog-composer-attachments-invalid-item",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,file:this.file,fileIndex:this.fileIndex}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsInvalidItemComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsInvalidItemComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","region"),e.setAttribute("aria-label","Composer invalid attachment actions")}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsInvalidItemComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(Fe),h(R),h(S),h(y))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-composer-attachments-invalid-item"]],inputs:{file:"file",fileIndex:"fileIndex",_itemWireframe:[0,"itemWireframe","_itemWireframe"]},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["role","region",1,"velt-composer--invalid-selected-file"],["role","group",1,"velt-composer--selected-file-actions"],["role","button","tabindex","0",3,"componentConfigSignal","file","fileIndex"],["role","alert","aria-live","polite",1,"velt-composer--error-message"],["xmlns","http://www.w3.org/2000/svg","height","24px","viewBox","0 0 24 24","width","24px","fill","currentColor","aria-hidden","true","role","img",1,"velt-composer--error-message-icon"],["d","M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"],[3,"file","componentConfigSignal"],["role","img",3,"componentConfigSignal","file"]],template:function(t,r){t&1&&g(0,RWe,2,8,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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%]:empty{display:none}.velt-composer--invalid-selected-file[_ngcontent-%COMP%]{border-radius:var(--velt-border-radius-sm);overflow:hidden;line-height:0;position:relative;height:72px;width:85px;flex:0 0 30%;border:4px solid var(--velt-error)}.velt-composer--invalid-selected-file[_ngcontent-%COMP%] .velt-composer--error-message[_ngcontent-%COMP%]{position:absolute;height:100%;width:100%;background:color-mix(in srgb,var(--velt-surface-0) 52%,transparent);display:flex;flex-direction:column;padding:var(--velt-spacing-xs);align-items:center;justify-content:center;color:var(--velt-white);box-sizing:border-box;gap:var(--velt-spacing-md)}.velt-composer--invalid-selected-file[_ngcontent-%COMP%] .velt-composer--error-message[_ngcontent-%COMP%] .velt-composer--error-message-icon[_ngcontent-%COMP%]{height:24px;color:var(--velt-white)}.velt-composer--invalid-selected-file[_ngcontent-%COMP%] .velt-composer--selected-file-actions[_ngcontent-%COMP%]{position:absolute;width:100%;height:100%;background:color-mix(in srgb,var(--velt-surface-0) 32%,transparent);align-items:center;justify-content:center;display:none}.velt-composer--invalid-selected-file[_ngcontent-%COMP%]:hover .velt-composer--selected-file-actions[_ngcontent-%COMP%], .velt-composer--invalid-selected-file.loading[_ngcontent-%COMP%] .velt-composer--selected-file-actions[_ngcontent-%COMP%]{display:flex}.velt-composer--invalid-selected-file[_ngcontent-%COMP%]:hover .velt-composer--error-message[_ngcontent-%COMP%]{display:none}"],changeDetection:0});let i=o;return i})();var Nde=i=>({componentConfigSignal:i}),NWe=(i,o)=>({condition:i,data:o}),FWe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-composer-attachments-invalid-wireframe",variant:n,setIfCondition:e,componentElementRef:t,replaceTemplate:!1});function LWe(i,o){if(i&1&&(_(0,"div",4),P(1,"translate"),P(2,"translate"),w(3,"app-comment-dialog-composer-attachments-invalid-item",5),b()),i&2){let n=o.$implicit,e=o.index,t=l(4);x("aria-label",M(1,6,"Invalid file")+" "+M(2,8,(n==null||n.file==null?null:n.file.name)||"unknown"))("data-testid",t.componentId+"-invalid-file-"+e),m(3),c("componentConfigSignal",t.componentConfigSignal)("file",n)("fileIndex",e)("itemWireframe",t.itemTemplate)}}function BWe(i,o){if(i&1&&(f(0),g(1,LWe,4,10,"div",3),v()),i&2){let n=l(2).ngIf;m(),c("ngForOf",n==null?null:n.invalidSelectedFiles)}}function VWe(i,o){if(i&1&&(f(0),g(1,BWe,2,1,"ng-container",2),v()),i&2){let n=l().ngIf,e=l();m(),c("veltDynamicTemplate",$(3,FWe,e.template,A(1,Nde,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function UWe(i,o){if(i&1&&(f(0),g(1,VWe,2,9,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,NWe,n.conditionSignal(),A(1,Nde,n.componentConfigSignal)))}}var D2=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-comment-dialog-composer-attachments-invalid",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{if(super.ngOnInit(),this.setupA11yAttributes(),!this.itemTemplate){let e=this.template?.querySelector("velt-comment-dialog-composer-attachments-invalid-item-wireframe");Ke(e)||(this.itemTemplate=e)}}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsInvalidComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsInvalidComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","list"),e.setAttribute("aria-label","List of invalid files")}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsInvalidComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-composer-attachments-invalid"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["role","listitem",4,"ngFor","ngForOf"],["role","listitem"],[3,"componentConfigSignal","file","fileIndex","itemWireframe"]],template:function(t,r){t&1&&g(0,UWe,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},styles:["[_nghost-%COMP%]{display:flex;flex-direction:column;gap:var(--velt-spacing-sm)}[_nghost-%COMP%]:empty{display:none}"],changeDetection:0});let i=o;return i})();var jWe=(i,o,n,e)=>({componentConfigSignal:i,file:o,fileIndex:n,isEditMode:e}),$We=(i,o)=>({condition:i,data:o}),HWe=(i,o,n,e)=>({componentConfigSignal:i,fileIndex:o,file:n,isEditMode:e}),zWe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-composer-attachments-other-delete-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function GWe(i,o){i&1&&(f(0),le(),_(1,"svg",5),w(2,"path",6),b(),v())}function WWe(i,o){if(i&1){let n=q();_(0,"button",3),P(1,"translate"),P(2,"translate"),z("click",function(){N(n);let t=l(2).ngIf,r=l();return F(r.isEditMode?t==null?null:t.removeAttachmentFromComment(r.fileIndex):t==null?null:t.removeFile(r.fileIndex))}),g(3,GWe,3,0,"ng-container",4),b()}if(i&2){let n=l(2).ngIf,e=l();x("data-testid",e.componentId+"-button")("aria-label",M(1,3,"Delete file")+" "+M(2,5,(e.file==null||e.file.file==null?null:e.file.file.name)||"unknown")),m(3),c("veltDynamicTemplate",$(12,zWe,e.template,dt(7,HWe,e.componentConfigSignal,e.fileIndex,e.file,e.isEditMode),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function qWe(i,o){if(i&1&&(f(0),g(1,WWe,4,18,"button",2),v()),i&2){let n=l().ngIf;m(),c("ngIf",!(n!=null&&n.uploadingAttachments))}}function YWe(i,o){if(i&1&&(f(0),g(1,qWe,2,1,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(6,$We,n.conditionSignal(),dt(1,jWe,n.componentConfigSignal,n.file,n.fileIndex,n.isEditMode)))}}var w2=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-comment-dialog-composer-attachments-other-delete",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,file:this.file,fileIndex:this.fileIndex,isEditMode:this.isEditMode}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsOtherDeleteComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsOtherDeleteComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsOtherDeleteComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-composer-attachments-other-delete"]],inputs:{file:"file",fileIndex:"fileIndex",isEditMode:"isEditMode"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["class","velt-composer--attachment-icon-btn",3,"click",4,"ngIf"],[1,"velt-composer--attachment-icon-btn",3,"click"],[4,"veltDynamicTemplate"],["xmlns","http://www.w3.org/2000/svg","width","18","height","19","viewBox","0 0 18 19","fill","none","aria-hidden","true","role","img"],["d","M13.5 5L4.5 14M4.5 5L13.5 14","stroke","currentColor","stroke-width","1.5","stroke-linecap","round","stroke-linejoin","round"]],template:function(t,r){t&1&&g(0,YWe,2,9,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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-composer--attachment-icon-btn[_ngcontent-%COMP%]{display:flex;background:transparent;border:0;padding:var(--velt-spacing-sm);cursor:pointer;color:var(--velt-error)}"],changeDetection:0});let i=o;return i})();var KWe=(i,o,n,e)=>({componentConfigSignal:i,file:o,fileIndex:n,isEditMode:e}),ZWe=(i,o)=>({condition:i,data:o}),XWe=(i,o,n,e)=>({componentConfigSignal:i,fileIndex:o,file:n,isEditMode:e}),QWe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-composer-attachments-other-icon-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function JWe(i,o){if(i&1&&(f(0),_(1,"div",3),w(2,"velt-file-icon-internal",4),b(),v()),i&2){let n=l(3);m(),x("data-testid",n.componentId),m(),c("type",n.isEditMode?n.file==null?null:n.file.mimeType:n.file==null?null:n.file.fileType),x("data-testid",n.componentId+"-file-icon-internal")}}function eqe(i,o){if(i&1&&(f(0),g(1,JWe,3,3,"ng-container",2),v()),i&2){let n=l().ngIf,e=l();m(),c("veltDynamicTemplate",$(6,QWe,e.template,dt(1,XWe,e.componentConfigSignal,e.fileIndex,e.file,e.isEditMode),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function tqe(i,o){if(i&1&&(f(0),g(1,eqe,2,12,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(6,ZWe,n.conditionSignal(),dt(1,KWe,n.componentConfigSignal,n.file,n.fileIndex,n.isEditMode)))}}var O2=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-comment-dialog-composer-attachments-other-icon",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,file:this.file,fileIndex:this.fileIndex,isEditMode:this.isEditMode}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsOtherIconComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsOtherIconComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsOtherIconComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-composer-attachments-other-icon"]],inputs:{file:"file",fileIndex:"fileIndex",isEditMode:"isEditMode"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[1,"velt-composer--attachment-icon"],[3,"type"]],template:function(t,r){t&1&&g(0,tqe,2,9,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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-composer--attachment-icon[_ngcontent-%COMP%]{display:flex;color:var(--velt-accent)}"],changeDetection:0});let i=o;return i})();var nqe=(i,o,n,e)=>({componentConfigSignal:i,file:o,fileIndex:n,isEditMode:e}),iqe=(i,o)=>({condition:i,data:o}),oqe=(i,o,n,e)=>({componentConfigSignal:i,fileIndex:o,file:n,isEditMode:e}),rqe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-composer-attachments-other-loading-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function aqe(i,o){if(i&1&&(f(0),le(),_(1,"svg",3)(2,"circle",4),w(3,"animateTransform",5),b()(),v()),i&2){let n=l(4);m(),x("data-testid",n.componentId+"-svg")}}function sqe(i,o){if(i&1&&(f(0),g(1,aqe,4,1,"ng-container",2),v()),i&2){let n=l(2).ngIf,e=l();m(),c("veltDynamicTemplate",$(6,rqe,e.template,dt(1,oqe,e.componentConfigSignal,e.fileIndex,e.file,e.isEditMode),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function lqe(i,o){if(i&1&&(f(0),g(1,sqe,2,12,"ng-container",0),v()),i&2){let n=l().ngIf,e=l();m(),c("ngIf",!e.isEditMode&&(n==null?null:n.uploadingAttachments)&&!(e.file!=null&&e.file.uploaded))}}function cqe(i,o){if(i&1&&(f(0),g(1,lqe,2,1,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(6,iqe,n.conditionSignal(),dt(1,nqe,n.componentConfigSignal,n.file,n.fileIndex,n.isEditMode)))}}var A2=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-comment-dialog-composer-attachments-other-loading",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,file:this.file,fileIndex:this.fileIndex,isEditMode:this.isEditMode}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsOtherLoadingComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsOtherLoadingComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsOtherLoadingComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-composer-attachments-other-loading"]],inputs:{file:"file",fileIndex:"fileIndex",isEditMode:"isEditMode"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["xmlns","http://www.w3.org/2000/svg",0,"xmlns","xlink","http://www.w3.org/1999/xlink","width","32px","height","32px","viewBox","0 0 100 100","preserveAspectRatio","xMidYMid","aria-hidden","true","role","img",2,"margin","auto","display","block"],["cx","50","cy","50","fill","none","stroke","currentColor","stroke-width","7","r","34","stroke-dasharray","160.22122533307947 55.40707511102649"],["attributeName","transform","type","rotate","repeatCount","indefinite","dur","1s","values","0 50 50;360 50 50","keyTimes","0;1"]],template:function(t,r){t&1&&g(0,cqe,2,9,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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}svg[_ngcontent-%COMP%]{color:var(--velt-accent)}"],changeDetection:0});let i=o;return i})();var dqe=(i,o,n,e)=>({componentConfigSignal:i,file:o,fileIndex:n,isEditMode:e}),mqe=(i,o)=>({condition:i,data:o}),pqe=(i,o,n,e)=>({componentConfigSignal:i,fileIndex:o,file:n,isEditMode:e}),gqe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-composer-attachments-other-name-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function uqe(i,o){if(i&1&&(f(0),_(1,"span",3),P(2,"translate"),ee(3),P(4,"translate"),b(),v()),i&2){let n=l(3);m(),x("data-testid",n.componentId)("aria-label",n.isEditMode?n.file==null?null:n.file.name:M(2,3,n.file==null||n.file.file==null?null:n.file.file.name)),m(2),Ce(" ",n.isEditMode?n.file==null?null:n.file.name:M(4,5,n.file==null||n.file.file==null?null:n.file.file.name)," ")}}function hqe(i,o){if(i&1&&(f(0),g(1,uqe,5,7,"ng-container",2),v()),i&2){let n=l().ngIf,e=l();m(),c("veltDynamicTemplate",$(6,gqe,e.template,dt(1,pqe,e.componentConfigSignal,e.fileIndex,e.file,e.isEditMode),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function fqe(i,o){if(i&1&&(f(0),g(1,hqe,2,12,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(6,mqe,n.conditionSignal(),dt(1,dqe,n.componentConfigSignal,n.file,n.fileIndex,n.isEditMode)))}}var P2=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-comment-dialog-composer-attachments-other-name",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,file:this.file,fileIndex:this.fileIndex,isEditMode:this.isEditMode}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsOtherNameComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsOtherNameComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsOtherNameComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-composer-attachments-other-name"]],inputs:{file:"file",fileIndex:"fileIndex",isEditMode:"isEditMode"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[1,"velt-composer--attachment-name"]],template:function(t,r){t&1&&g(0,fqe,2,9,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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%]{line-height:normal}.velt-composer--attachment-name[_ngcontent-%COMP%]{overflow:hidden;color:var(--velt-text-3);text-overflow:ellipsis;font-size:var(--velt-font-size-xs);font-style:normal;font-weight:600;line-height:normal;white-space:nowrap}"],changeDetection:0});let i=o;return i})();var vqe=(i,o,n,e)=>({componentConfigSignal:i,file:o,fileIndex:n,isEditMode:e}),Cqe=(i,o)=>({condition:i,data:o}),_qe=(i,o,n,e)=>({componentConfigSignal:i,fileIndex:o,file:n,isEditMode:e}),yqe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-composer-attachments-other-size-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function Sqe(i,o){if(i&1&&(f(0),_(1,"span",3),P(2,"fileSize"),ee(3),P(4,"fileSize"),b(),v()),i&2){let n=l(3);m(),x("data-testid",n.componentId)("aria-label",n.isEditMode?n.file==null?null:n.file.size:M(2,3,n.file==null||n.file.file==null?null:n.file.file.size)),m(2),Ce(" ",n.isEditMode?n.file==null?null:n.file.size:M(4,5,n.file==null||n.file.file==null?null:n.file.file.size)," ")}}function bqe(i,o){if(i&1&&(f(0),g(1,Sqe,5,7,"ng-container",2),v()),i&2){let n=l().ngIf,e=l();m(),c("veltDynamicTemplate",$(6,yqe,e.template,dt(1,_qe,e.componentConfigSignal,e.fileIndex,e.file,e.isEditMode),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function Iqe(i,o){if(i&1&&(f(0),g(1,bqe,2,12,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(6,Cqe,n.conditionSignal(),dt(1,vqe,n.componentConfigSignal,n.file,n.fileIndex,n.isEditMode)))}}var M2=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.componentId="velt-comment-dialog-composer-attachments-other-size",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,file:this.file,fileIndex:this.fileIndex,isEditMode:this.isEditMode}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsOtherSizeComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsOtherSizeComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsOtherSizeComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-composer-attachments-other-size"]],inputs:{file:"file",fileIndex:"fileIndex",isEditMode:"isEditMode"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[1,"velt-composer--attachment-size"]],template:function(t,r){t&1&&g(0,Iqe,2,9,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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%]{line-height:normal}.velt-composer--attachment-size[_ngcontent-%COMP%]{overflow:hidden;color:var(--velt-text-7);text-overflow:ellipsis;font-size:var(--velt-font-size-2xs);font-style:normal;font-weight:500;line-height:normal}"],changeDetection:0});let i=o;return i})();var Eqe=(i,o,n,e)=>({componentConfigSignal:i,file:o,fileIndex:n,isEditMode:e}),xqe=(i,o)=>({condition:i,data:o}),Tqe=(i,o,n,e)=>({componentConfigSignal:i,fileIndex:o,file:n,isEditMode:e}),Dqe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-composer-attachments-other-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function wqe(i,o){if(i&1&&(f(0),_(1,"div",3),P(2,"translate"),P(3,"translate"),w(4,"app-comment-dialog-composer-attachments-other-icon",4),P(5,"translate"),P(6,"translate"),_(7,"div",5),P(8,"translate"),P(9,"translate"),w(10,"app-comment-dialog-composer-attachments-other-name",6),P(11,"translate"),P(12,"translate"),w(13,"app-comment-dialog-composer-attachments-other-size",6),P(14,"translate"),P(15,"translate"),b(),w(16,"app-comment-dialog-composer-attachments-other-loading",7),P(17,"translate"),P(18,"translate"),_(19,"div",8),P(20,"translate"),P(21,"translate"),w(22,"app-comment-dialog-composer-attachments-other-delete",9),P(23,"translate"),P(24,"translate"),b()(),v()),i&2){let n=l(4);m(),x("aria-label",M(2,36,"File attachment:")+" "+M(3,38,(n.file==null?null:n.file.name)||"unnamed file"))("data-testid",n.componentId+"-attachment"),m(3),c("componentConfigSignal",n.componentConfigSignal)("file",n.file)("fileIndex",n.fileIndex)("isEditMode",n.isEditMode),x("aria-label",M(5,40,"File type icon for")+" "+M(6,42,(n.file==null?null:n.file.name)||"unnamed file"))("data-testid",n.componentId+"-attachment-icon"),m(3),x("aria-label",M(8,44,"Details for file:")+" "+M(9,46,(n.file==null?null:n.file.name)||"unnamed file"))("data-testid",n.componentId+"-attachment-details"),m(3),c("componentConfigSignal",n.componentConfigSignal)("file",n.file)("fileIndex",n.fileIndex)("isEditMode",n.isEditMode),x("aria-label",M(11,48,"Filename:")+" "+M(12,50,(n.file==null?null:n.file.name)||"unnamed file"))("data-testid",n.componentId+"-attachment-name"),m(3),c("componentConfigSignal",n.componentConfigSignal)("file",n.file)("fileIndex",n.fileIndex)("isEditMode",n.isEditMode),x("aria-label",M(14,52,"File size:")+" "+M(15,54,(n.file==null?null:n.file.size)||"unknown size"))("data-testid",n.componentId+"-attachment-size"),m(3),c("componentConfigSignal",n.componentConfigSignal)("file",n.file)("fileIndex",n.fileIndex)("isEditMode",n.isEditMode),x("aria-label",M(17,56,"Uploading file:")+" "+M(18,58,(n.file==null?null:n.file.name)||"unnamed file"))("data-testid",n.componentId+"-attachment-loading"),m(3),x("aria-label",M(20,60,"Actions for file:")+" "+M(21,62,(n.file==null?null:n.file.name)||"unnamed file"))("data-testid",n.componentId+"-attachment-actions"),m(3),c("componentConfigSignal",n.componentConfigSignal)("file",n.file)("fileIndex",n.fileIndex)("isEditMode",n.isEditMode),x("aria-label",M(23,64,"Remove file:")+" "+M(24,66,(n.file==null?null:n.file.name)||"unnamed file"))("data-testid",n.componentId+"-delete-attachment")}}function Oqe(i,o){if(i&1&&(f(0),g(1,wqe,25,68,"ng-container",2),v()),i&2){let n=l(2).ngIf,e=l();m(),c("veltDynamicTemplate",$(6,Dqe,e.template,dt(1,Tqe,e.componentConfigSignal,e.fileIndex,e.file,e.isEditMode),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function Aqe(i,o){if(i&1&&(f(0),g(1,Oqe,2,12,"ng-container",0),v()),i&2){let n=l(2);m(),c("ngIf",n.isEditMode?!(!(n.file==null||n.file.mimeType==null)&&n.file.mimeType.includes("image")):!(!(n.file==null||n.file.fileType==null)&&n.file.fileType.includes("image")))}}function Pqe(i,o){if(i&1&&(f(0),g(1,Aqe,2,1,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(6,xqe,n.conditionSignal(),dt(1,Eqe,n.componentConfigSignal,n.file,n.fileIndex,n.isEditMode)))}}var k2=(()=>{let o=class o extends H{set _otherWireframe(e){this.otherWireframe=e,this.otherWireframe?this.template=this.domService.deepCloneElement(this.otherWireframe):this.template=null}constructor(e,t,r,a){super(t,a,r),this.domService=e,this.elementRef=t,this.loggingService=r,this.dynamicDataService=a,this.componentId="velt-comment-dialog-composer-attachments-other",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef?.nativeElement,{componentConfigSignal:this.componentConfigSignal,file:this.file,fileIndex:this.fileIndex,isEditMode:this.isEditMode}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsOtherComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsOtherComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","region"),e.setAttribute("aria-label","File attachment controls")}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsOtherComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(Fe),h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-composer-attachments-other"]],inputs:{file:"file",fileIndex:"fileIndex",isEditMode:"isEditMode",_otherWireframe:[0,"otherWireframe","_otherWireframe"]},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["role","region",1,"velt-composer--other-attachment"],["role","img",3,"componentConfigSignal","file","fileIndex","isEditMode"],["role","group",1,"velt-composer--attachment-details"],[3,"componentConfigSignal","file","fileIndex","isEditMode"],["role","status","aria-live","polite",3,"componentConfigSignal","file","fileIndex","isEditMode"],["role","group",1,"velt-composer--attachment-actions"],["role","button","tabindex","0",3,"componentConfigSignal","file","fileIndex","isEditMode"]],template:function(t,r){t&1&&g(0,Pqe,2,9,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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%}[_nghost-%COMP%]:empty{display:none}.velt-composer--other-attachment[_ngcontent-%COMP%]{display:flex;padding:var(--velt-spacing-sm) var(--velt-spacing-xs) var(--velt-spacing-sm) var(--velt-spacing-md);justify-content:space-between;gap:var(--velt-spacing-sm);align-items:center;align-self:stretch;width:100%;border-radius:var(--velt-border-radius-sm);border:1px solid var(--velt-border-4);box-sizing:border-box}.velt-composer--other-attachment[_ngcontent-%COMP%] .velt-composer--attachment-details[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:var(--velt-spacing-xs);flex:1;overflow:hidden}.velt-composer--other-attachment[_ngcontent-%COMP%] .velt-composer--attachment-actions[_ngcontent-%COMP%]{display:flex;width:0;overflow:hidden}.velt-composer--other-attachment[_ngcontent-%COMP%]:not(:last-child){margin-bottom:var(--velt-spacing-lg)}.velt-composer--other-attachment[_ngcontent-%COMP%]:hover .velt-composer--attachment-actions[_ngcontent-%COMP%]{width:auto}"],changeDetection:0});let i=o;return i})();var Fde=i=>({componentConfigSignal:i}),Mqe=(i,o)=>({condition:i,data:o}),kqe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-composer-attachments-selected-wireframe",variant:n,setIfCondition:e,componentElementRef:t,replaceTemplate:!1});function Rqe(i,o){if(i&1&&(f(0),w(1,"app-comment-dialog-composer-attachments-other",7)(2,"app-comment-dialog-composer-attachments-image",8),v()),i&2){let n=o.$implicit,e=o.index,t=l(5);m(),c("componentConfigSignal",t.componentConfigSignal)("file",n)("fileIndex",e)("isEditMode",!0)("otherWireframe",t.otherTemplate),m(),c("componentConfigSignal",t.componentConfigSignal)("file",n)("fileIndex",e)("isEditMode",!0)("imageWireframe",t.imageTemplate)}}function Nqe(i,o){if(i&1&&(f(0),w(1,"app-comment-dialog-composer-attachments-other",7)(2,"app-comment-dialog-composer-attachments-image",8),v()),i&2){let n=o.$implicit,e=o.index,t=l(5);m(),c("componentConfigSignal",t.componentConfigSignal)("file",n)("fileIndex",e)("isEditMode",!1)("otherWireframe",t.otherTemplate),m(),c("componentConfigSignal",t.componentConfigSignal)("file",n)("fileIndex",e)("isEditMode",!1)("imageWireframe",t.imageTemplate)}}function Fqe(i,o){if(i&1&&(_(0,"div",4),P(1,"translate"),P(2,"translate"),g(3,Rqe,3,10,"ng-container",5)(4,Nqe,3,10,"ng-container",6),b()),i&2){let n=l(3).ngIf,e=l();x("aria-label",M(1,5,"Attached files")+" - "+(((n==null||n.editComment==null||n.editComment.attachments==null?null:n.editComment.attachments.length)||0)+((n==null||n.selectedFiles==null?null:n.selectedFiles.length)||0))+" "+M(2,7,"total attachments"))("data-testid",e.componentId+"-attachments-list"),m(3),c("ngForOf",n==null||n.editComment==null?null:n.editComment.attachments)("ngForTrackBy",n==null?null:n.trackByAttachmentId),m(),c("ngForOf",n==null?null:n.selectedFiles)}}function Lqe(i,o){if(i&1&&(f(0),g(1,Fqe,5,9,"div",3),v()),i&2){let n=l(2).ngIf;m(),c("ngIf",(n==null||n.editComment==null||n.editComment.attachments==null?null:n.editComment.attachments.length)||(n==null||n.selectedFiles==null?null:n.selectedFiles.length))}}function Bqe(i,o){if(i&1&&(f(0),g(1,Lqe,2,1,"ng-container",2),v()),i&2){let n=l().ngIf,e=l();m(),c("veltDynamicTemplate",$(3,kqe,e.template,A(1,Fde,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function Vqe(i,o){if(i&1&&(f(0),g(1,Bqe,2,9,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,Mqe,n.conditionSignal(),A(1,Fde,n.componentConfigSignal)))}}var R2=(()=>{let o=class o extends H{constructor(e,t,r){super(e,t,r),this.elementRef=e,this.dynamicDataService=t,this.loggingService=r,this.componentId="velt-comment-dialog-composer-attachments-selected",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{if(super.ngOnInit(),this.setupA11yAttributes(),!this.imageTemplate){let e=this.template?.querySelector("velt-comment-dialog-composer-attachments-image-wireframe");Ke(e)||(this.imageTemplate=e)}if(!this.otherTemplate){let e=this.template?.querySelector("velt-comment-dialog-composer-attachments-other-wireframe");Ke(e)||(this.otherTemplate=e)}}catch{}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsSelectedComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","list"),e.setAttribute("aria-label","List of selected attachments")}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsSelectedComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(S),h(y))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-composer-attachments-selected"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["class","velt-comment-dialog-composer-attachments--selected","role","list",4,"ngIf"],["role","list",1,"velt-comment-dialog-composer-attachments--selected"],[4,"ngFor","ngForOf","ngForTrackBy"],[4,"ngFor","ngForOf"],[3,"componentConfigSignal","file","fileIndex","isEditMode","otherWireframe"],[3,"componentConfigSignal","file","fileIndex","isEditMode","imageWireframe"]],template:function(t,r){t&1&&g(0,Vqe,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},styles:["[_nghost-%COMP%]{width:100%}[_nghost-%COMP%]:empty{display:none}.velt-comment-dialog-composer-attachments--selected[_ngcontent-%COMP%]{width:100%;display:flex;flex-wrap:wrap;gap:var(--velt-spacing-sm);flex-direction:row;padding:var(--velt-spacing-xs);box-sizing:border-box}"],changeDetection:0});let i=o;return i})();var Lde=i=>({componentConfigSignal:i}),Uqe=(i,o)=>({condition:i,data:o}),jqe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-composer-attachments-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function $qe(i,o){if(i&1&&(f(0),_(1,"div",3),P(2,"translate"),P(3,"translate"),P(4,"translate"),w(5,"app-comment-dialog-composer-attachments-selected",4)(6,"app-comment-dialog-composer-attachments-invalid",4),b(),v()),i&2){let n=l(3).ngIf,e=l();m(),x("aria-label",M(2,4,"File attachments")+" - "+((n==null||n.selectedFiles==null?null:n.selectedFiles.length)||0)+" "+M(3,6,"valid")+", "+((n==null||n.invalidSelectedFiles==null?null:n.invalidSelectedFiles.length)||0)+" "+M(4,8,"invalid files"))("data-testid",e.componentId),m(4),c("componentConfigSignal",e.componentConfigSignal),m(),c("componentConfigSignal",e.componentConfigSignal)}}function Hqe(i,o){if(i&1&&(f(0),g(1,$qe,7,10,"ng-container",2),v()),i&2){let n=l(2).ngIf,e=l();m(),c("veltDynamicTemplate",$(3,jqe,e.template,A(1,Lde,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function zqe(i,o){if(i&1&&(f(0),g(1,Hqe,2,9,"ng-container",0),v()),i&2){let n=l().ngIf;m(),c("ngIf",(n==null?null:n.editComment)||(n==null||n.selectedFiles==null?null:n.selectedFiles.length)||(n==null||n.invalidSelectedFiles==null?null:n.invalidSelectedFiles.length))}}function Gqe(i,o){if(i&1&&(f(0),g(1,zqe,2,1,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,Uqe,n.conditionSignal(),A(1,Lde,n.componentConfigSignal)))}}var N2=(()=>{let o=class o extends H{constructor(e,t,r){super(e,t,r),this.elementRef=e,this.dynamicDataService=t,this.loggingService=r,this.componentId="velt-comment-dialog-composer-attachments",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","region"),e.setAttribute("aria-label","Attachments section")}catch(e){this.loggingService.catch("Error in CommentDialogComposerAttachmentsComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(S),h(y))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-composer-attachments"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["role","region",1,"velt-composer--attachments"],[3,"componentConfigSignal"]],template:function(t,r){t&1&&g(0,Gqe,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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%}[_nghost-%COMP%]:empty{display:none}.velt-composer--attachments[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;width:100%;gap:var(--velt-spacing-sm);flex-direction:row}"],changeDetection:0});let i=o;return i})();var Wqe=["newCommentTextArea"],qqe=["editCommentTextArea"],Yqe=["userSelector"],Bde=i=>({componentConfigSignal:i}),Kqe=(i,o)=>({condition:i,data:o}),Zqe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-composer-input-wireframe",variant:n,setIfCondition:e,componentElementRef:t,replaceTemplate:!1});function Xqe(i,o){if(i&1){let n=q();_(0,"velt-autocomplete-panel-internal",11,1),z("userContactOptionSelected",function(t){N(n),l();let r=ce(4),a=l(3).ngIf;return F(a==null?null:a.userContactSelected(t,r))})("customOptionSelected",function(t){N(n),l();let r=ce(4),a=l(3).ngIf;return F(a==null?null:a.autocompleteItemSelected(t,r))})("groupOptionSelected",function(t){N(n),l();let r=ce(4),a=l(3).ngIf;return F(a==null?null:a.groupSelected(t,r))})("atHereSelected",function(t){N(n),l();let r=ce(4),a=l(3).ngIf;return F(a==null?null:a.atHereSelected(t,r))})("enterPressed",function(){N(n);let t=l(5);return F(t.onEnterPressInAutocompletePanel())})("autocompleteStateChanged",function(t){N(n);let r=l(5);return F(r.onAutocompleteStateChanged(t))}),b()}if(i&2){l();let n=ce(5),e=l(3).ngIf;c("darkMode",!!(e!=null&&e.darkMode))("hideInput",!0)("showAtHere",!0)("metadata",e==null||e.annotation==null?null:e.annotation.metadata)("autocompletePanelTrigger",n)("type","generic")("autocompletePanelPosition",e!=null&&e.bottomSheetMode?"above":"auto")}}function Qqe(i,o){if(i&1){let n=q();_(0,"div",7),P(1,"translate"),z("click",function(t){N(n);let r=l(3).ngIf;return r==null||r.onComposerClick(),F(t.stopPropagation())}),_(2,"div",8)(3,"div",9,0),P(6,"translate"),P(7,"translate"),P(8,"translate"),z("afterViewInit",function(){N(n);let t=l(4);return F(t.setNewCommentTextArea())})("input",function(t){N(n);let r=l(3).ngIf;return F(r==null?null:r.onCommentInput(t))})("paste",function(t){N(n);let r=l(3).ngIf;return r==null||r.onPaste(t),F(t.preventDefault())})("keypress",function(t){return N(n),F(t.stopPropagation())})("keyup",function(t){N(n);let r=l(3).ngIf;return t.stopPropagation(),F(r==null?null:r.onEscapeKeyPressed(t))})("keydown",function(t){N(n);let r=l(4);return t.stopPropagation(),F(r.onKeyPressedAddComment(t))})("keydown.escape",function(t){N(n);let r=l(4);return r.onEscapeKeyPressed(t,r.userSelector),F(t.stopPropagation())})("keydown.backspace",function(){N(n);let t=ce(4),r=l(3).ngIf;return F(!(t!=null&&t.innerText)&&(r!=null&&r.deleteOnBackspace)?r==null?null:r.deleteCommentPinAnnotations("keydownBackspace"):null)})("keydown.delete",function(){N(n);let t=ce(4),r=l(3).ngIf;return F(t!=null&&t.innerText||r==null?null:r.deleteCommentPinAnnotations("keydownDelete"))})("copy",function(t){return N(n),F(t.stopPropagation())})("dragover",function(t){return N(n),F(t.preventDefault())})("dragenter",function(t){return N(n),F(t.preventDefault())})("drop",function(t){N(n);let r=l(3).ngIf;return r==null||r.onDrop(t),F(t.preventDefault())})("click",function(){N(n);let t=l(4);return F(t.onCombinedClick())}),b()(),g(9,Xqe,2,7,"velt-autocomplete-panel-internal",10),b()}if(i&2){let n=l(3).ngIf,e=l();x("aria-label",M(1,6,"New comment composer"))("data-testid",e.componentId+"-section"),m(3),c("matAutocompleteDisabled",!(n!=null&&n.userMentions)),x("data-testid",e.componentId+"-new-textarea")("placeholder",e.placeholder?M(6,8,e.placeholder):n!=null&&n.userMentions?M(7,10,"Comment or type @ to add others"):M(8,12,"Write a comment...")),m(6),c("ngIf",n==null?null:n.userMentions)}}function Jqe(i,o){if(i&1){let n=q();_(0,"velt-autocomplete-panel-internal",11,1),z("userContactOptionSelected",function(t){N(n),l();let r=ce(4),a=l(4).ngIf;return F(a==null?null:a.userContactSelected(t,r))})("customOptionSelected",function(t){N(n),l();let r=ce(4),a=l(4).ngIf;return F(a==null?null:a.autocompleteItemSelected(t,r))})("groupOptionSelected",function(t){N(n),l();let r=ce(4),a=l(4).ngIf;return F(a==null?null:a.groupSelected(t,r))})("atHereSelected",function(t){N(n),l();let r=ce(4),a=l(4).ngIf;return F(a==null?null:a.atHereSelected(t,r))})("enterPressed",function(){N(n);let t=l(6);return F(t.onEnterPressInAutocompletePanel())})("autocompleteStateChanged",function(t){N(n);let r=l(6);return F(r.onAutocompleteStateChanged(t))}),b()}if(i&2){l();let n=ce(5),e=l(4).ngIf;c("darkMode",!!(e!=null&&e.darkMode))("hideInput",!0)("showAtHere",!0)("metadata",e==null||e.annotation==null?null:e.annotation.metadata)("autocompletePanelTrigger",n)("type","generic")("autocompletePanelPosition",e!=null&&e.bottomSheetMode?"above":"auto")}}function eYe(i,o){if(i&1){let n=q();_(0,"div",7),P(1,"translate"),z("click",function(t){return N(n),F(t.stopPropagation())}),_(2,"div",8)(3,"div",12,2),P(6,"translate"),P(7,"translate"),P(8,"translate"),z("afterViewInit",function(){N(n);let t=l(5);return F(t.setEditCommentTextArea())})("input",function(t){N(n);let r=l(4).ngIf;return F(r==null?null:r.onCommentInput(t))})("paste",function(t){N(n);let r=l(4).ngIf;return r==null||r.onPaste(t),F(t.preventDefault())})("keypress",function(t){return N(n),F(t.stopPropagation())})("keyup",function(t){return N(n),F(t.stopPropagation())})("keydown",function(t){N(n);let r=ce(4),a=l(5);return t.stopPropagation(),F(a.onKeyPressedUpdateComment(t,a.i,r.innerText))})("keydown.backspace",function(){N(n);let t=ce(4),r=l(4).ngIf;return F(!(t!=null&&t.innerText)&&(r!=null&&r.deleteOnBackspace)?r==null?null:r.deleteCommentPinAnnotations("keydownBackspace"):null)})("keydown.delete",function(){N(n);let t=ce(4),r=l(4).ngIf;return F(t!=null&&t.innerText||r==null?null:r.deleteCommentPinAnnotations("keydownEscape"))})("keydown.escape",function(t){N(n);let r=l(4).ngIf,a=l();return a.onEscapeKeyPressed(t,a.userSelector)||(r==null||r.cancelUpdate()),F(t.stopPropagation())})("copy",function(t){return N(n),F(t.stopPropagation())})("dragover",function(t){return N(n),F(t.preventDefault())})("dragenter",function(t){return N(n),F(t.preventDefault())})("drop",function(t){N(n);let r=l(4).ngIf;return r==null||r.onDrop(t),F(t.preventDefault())})("click",function(){N(n);let t=l(5);return F(t.onInputClick())}),b(),g(9,Jqe,2,7,"velt-autocomplete-panel-internal",10),b()()}if(i&2){let n=l(4).ngIf,e=l();x("aria-label",M(1,6,"Edit comment composer"))("data-testid",e.componentId+"-edit-section"),m(3),c("matAutocompleteDisabled",!(n!=null&&n.userMentions)),x("data-testid",e.componentId+"-edit-textarea")("placeholder",e.placeholder?M(6,8,e.placeholder):n!=null&&n.userMentions?M(7,10,"Comment or add emails with @"):M(8,12,"Write a comment...")),m(6),c("ngIf",n==null?null:n.userMentions)}}function tYe(i,o){if(i&1&&(f(0),g(1,eYe,10,14,"div",6),v()),i&2){let n=l(3).ngIf;m(),c("ngIf",!(n!=null&&n.recorderInitConfig&&(n==null||n.recorderInitConfig==null?null:n.recorderInitConfig.panelId)===(n==null?null:n.commentDialogUniqueId)))}}function nYe(i,o){if(i&1&&(f(0),g(1,Qqe,10,14,"div",6)(2,tYe,2,1,"ng-container",3),v()),i&2){let n=l(2).ngIf,e=l();m(),c("ngIf",!e.editMode&&!(n!=null&&n.recorderInitConfig&&(n==null||n.recorderInitConfig==null?null:n.recorderInitConfig.panelId)===(n==null?null:n.commentDialogUniqueId))),m(),c("ngIf",e.editMode&&e.commentObj)}}function iYe(i,o){if(i&1&&(f(0),g(1,nYe,3,2,"ng-container",5),v()),i&2){let n=l().ngIf,e=l();m(),c("veltDynamicTemplate",$(3,Zqe,e.template,A(1,Bde,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function oYe(i,o){if(i&1&&(f(0),g(1,iYe,2,9,"ng-container",4),v()),i&2){let n=l();m(),c("veltIf",k(3,Kqe,n.conditionSignal(),A(1,Bde,n.componentConfigSignal)))}}var F2=(()=>{let o=class o extends H{constructor(e,t,r,a){super(r,a,e),this.loggingService=e,this.renderer=t,this.elementRef=r,this.dynamicDataService=a,this.editMode=!1,this.allowKeydown=!0,this.componentId="velt-comment-dialog-composer-input",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogComposerInputComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogComposerInputComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogComposerInputComponent setupA11yAttributes:",e)}}ngAfterViewInit(){try{this.setNewCommentTextArea(),this.setEditCommentTextArea()}catch(e){this.catchError("Error in CommentDialogComposerInputComponent ngAfterViewInit: ",e)}}setNewCommentTextArea(){try{this.loggingService.log("%c[WB] Calling CommentDialogComposerInputComponent FUNCTION: setNewCommentTextArea","color: green;"),setTimeout(()=>{this.componentConfigSignal()&&this.componentConfigSignal.update(e=>(e=T(I({},e),{newCommentTextArea:this.newCommentTextArea}),e))})}catch(e){this.catchError("Error in CommentDialogComposerInputComponent setNewCommentTextArea: ",e)}}setEditCommentTextArea(){try{this.loggingService.log("%c[WB] Calling CommentDialogComposerInputComponent FUNCTION: setEditCommentTextArea","color: green;"),setTimeout(()=>{this.componentConfigSignal()&&this.componentConfigSignal.update(e=>(e=T(I({},e),{editCommentTextArea:this.editCommentTextArea}),e))})}catch(e){this.catchError("Error in CommentDialogComposerInputComponent setEditCommentTextArea: ",e)}}onKeyPressedAddComment(e){try{this.loggingService.log("%c[WB] Calling CommentDialogComposerInputComponent FUNCTION: onKeyPressedAddComment","color: green;"),this.allowKeydown?this.componentConfigSignal()?.onKeyPressedAddComment(e):this.allowKeydown=!0}catch(t){this.catchError("Error in CommentDialogComposerInputComponent onKeyPressedAddComment: ",t)}}onKeyPressedUpdateComment(e,t,r){try{this.loggingService.log("%c[WB] Calling CommentDialogComposerInputComponent FUNCTION: onKeyPressedUpdateComment","color: green;"),this.allowKeydown?this.componentConfigSignal()?.onKeyPressedUpdateComment(e,t,r):this.allowKeydown=!0}catch(a){this.catchError("Error in CommentDialogComposerInputComponent onKeyPressedUpdateComment: ",a)}}onEnterPressInAutocompletePanel(){try{this.loggingService.log("%c[WB] Calling CommentDialogComposerInputComponent FUNCTION: onEnterPressInAutocompletePanel","color: green;"),this.componentConfigSignal()?.enterKeyToSubmit&&(this.allowKeydown=!1)}catch(e){this.catchError("Error in CommentDialogComposerInputComponent onEnterPressInAutocompletePanel: ",e)}}onEscapeKeyPressed(e,t){try{if(this.loggingService.log("%c[WB] Calling CommentDialogComposerInputComponent FUNCTION: onEscapeKeyPressed","color: green;"),t?.trigger?.panelOpen||t?.matAutocompleteTrigger?.panelOpen){t.closePanel();let s=e.target;if(s&&s.hasAttribute("contenteditable")){let d=["@","#","$"];if(xv(s,d)){let u=window.getSelection();if(u&&u.rangeCount>0){let C=u.getRangeAt(0),E=C.startOffset,D=C.commonAncestorContainer?.textContent||"",L=-1;for(let G of d){let Y=D.lastIndexOf(G,E);Y>L&&(L=Y)}L!==-1&&t.disableAutocompleteAtPosition(L)}}}return!0}return!1}catch(r){return this.catchError("Error in CommentDialogComposerInputComponent onEscapeKeyPressed: ",r),!1}}onInputClick(){this.loggingService.log("%c[WB] Calling CommentDialogComposerInputComponent FUNCTION: onInputClick","color: green;");try{this.componentConfigSignal.update(e=>(e=T(I({},e),{composerInOpenState:!0}),e)),this.componentConfigSignal()?.composerInOpenState&&setTimeout(()=>{this.componentConfigSignal().updateOverlayPositionEmit()},300)}catch(e){this.catchError("Error in CommentDialogComposerInputComponent onInputClick: ",e)}}onCombinedClick(){this.loggingService.log("%c[WB] Calling CommentDialogComposerInputComponent FUNCTION: onCombinedClick","color: green;");try{this.componentConfigSignal()&&this.componentConfigSignal.update(e=>(e=T(I({},e),{showCommentButtons:!0}),e)),this.onInputClick()}catch(e){this.catchError("Error in CommentDialogComposerInputComponent onCombinedClick: ",e)}}catchError(e,t,r){try{this.loggingService.catch(e,t,T(I({},r||{}),{annotationId:this.componentConfigSignal()?.annotation?.annotationId}))}catch{}}onFocus(e){this.newCommentTextArea&&this.newCommentTextArea?.nativeElement.contains(e.target)&&this.componentConfigSignal.update(t=>(t=T(I({},t),{isInputFocused:!0}),t)),this.editCommentTextArea&&this.editCommentTextArea?.nativeElement.contains(e.target)&&this.componentConfigSignal.update(t=>(t=T(I({},t),{isInputFocused:!0}),t))}onBlur(e){this.newCommentTextArea&&this.newCommentTextArea?.nativeElement.contains(e.target)&&this.componentConfigSignal.update(t=>(t=T(I({},t),{isInputFocused:!1}),t)),this.editCommentTextArea&&this.editCommentTextArea?.nativeElement.contains(e.target)&&this.componentConfigSignal.update(t=>(t=T(I({},t),{isInputFocused:!1}),t))}onAutocompleteStateChanged(e){try{this.loggingService.log("%c[WB] Calling CommentDialogComposerInputComponent FUNCTION: onAutocompleteStateChanged","color: green;"),this.componentConfigSignal.update(t=>(t=T(I({},t),{isAutocompleteDropdownOpen:e}),t))}catch(t){this.catchError("Error in CommentDialogComposerInputComponent onAutocompleteStateChanged: ",t)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(Ki),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-composer-input"]],viewQuery:function(t,r){if(t&1&&(nt(Wqe,5),nt(qqe,5),nt(Yqe,5)),t&2){let a;Xe(a=Qe())&&(r.newCommentTextArea=a.first),Xe(a=Qe())&&(r.editCommentTextArea=a.first),Xe(a=Qe())&&(r.userSelector=a.first)}},hostBindings:function(t,r){t&1&&z("focusin",function(s){return r.onFocus(s)})("focusout",function(s){return r.onBlur(s)})},inputs:{editMode:"editMode",commentObj:"commentObj",i:"i",placeholder:"placeholder"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[["newCommentTextArea","","snippylyUserSelectorTrigger","snippylyUserSelectorTrigger"],["userSelector",""],["editCommentTextArea","","snippylyUserSelectorTrigger","snippylyUserSelectorTrigger"],[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["class","velt-composer-input","role","region",3,"click",4,"ngIf"],["role","region",1,"velt-composer-input",3,"click"],[1,"velt-composer-input--container"],["role","textbox","contenteditable","","veltAfterViewInit","","veltAutocomplete","",1,"velt-composer-input--message",3,"afterViewInit","input","paste","keypress","keyup","keydown","keydown.escape","keydown.backspace","keydown.delete","copy","dragover","dragenter","drop","click","matAutocompleteDisabled"],[3,"darkMode","hideInput","showAtHere","metadata","autocompletePanelTrigger","type","autocompletePanelPosition","userContactOptionSelected","customOptionSelected","groupOptionSelected","atHereSelected","enterPressed","autocompleteStateChanged",4,"ngIf"],[3,"userContactOptionSelected","customOptionSelected","groupOptionSelected","atHereSelected","enterPressed","autocompleteStateChanged","darkMode","hideInput","showAtHere","metadata","autocompletePanelTrigger","type","autocompletePanelPosition"],["role","textbox","contenteditable","","veltAfterViewInit","","veltAutocomplete","",1,"velt-composer-input--message",3,"afterViewInit","input","paste","keypress","keyup","keydown","keydown.backspace","keydown.delete","keydown.escape","copy","dragover","dragenter","drop","click","matAutocompleteDisabled"]],template:function(t,r){t&1&&g(0,oYe,2,6,"ng-container",3),t&2&&c("ngIf",r.componentConfigSignal())},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%;display:flex}[_nghost-%COMP%]:empty{display:none}.velt-composer-input[_ngcontent-%COMP%]{position:relative;overflow:auto;width:100%;max-height:10em}.velt-composer-input--container[_ngcontent-%COMP%]{width:100%;display:flex;gap:2rem}.velt-composer-input--container[_ngcontent-%COMP%] input[_ngcontent-%COMP%]{display:none}.velt-composer-input--message[_ngcontent-%COMP%]{resize:vertical;padding:var(--velt-spacing-sm);outline:0;border:0;color:var(--velt-text-3);width:100%;box-sizing:border-box}.velt-composer-input--message[_ngcontent-%COMP%]:empty:before{color:var(--velt-text-8);content:attr(placeholder);display:block;pointer-events:none}*[_ngcontent-%COMP%]{-ms-overflow-style:none;scrollbar-width:none}*[_ngcontent-%COMP%]::-webkit-scrollbar{display:none}"],changeDetection:0});let i=o;return i})();var Vde=i=>({componentConfigSignal:i}),rYe=(i,o)=>({condition:i,data:o}),aYe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-composer-recordings-wireframe",variant:n,setIfCondition:e,componentElementRef:t,replaceTemplate:!1});function sYe(i,o){if(i&1){let n=q();f(0),_(1,"snippyly-recorder-player-internal",5),P(2,"translate"),P(3,"translate"),z("onDelete",function(t){N(n);let r=l(3).ngIf;return F(r==null?null:r.onDeleteRecorderAnnotation(t))}),b(),v()}if(i&2){let n=o.$implicit,e=l(3).ngIf,t=l();m(),c("isEditMode",!0)("showSummary",!!(e!=null&&e.recordingSummaryEnabled))("darkMode",!!(e!=null&&e.darkMode))("recorderId",n==null?null:n.id)("shadowDom",(e==null?null:e.dialogShadowDOM)!==!1)("playVideoInFullScreen",e==null?null:e.playVideoInFullScreen),x("aria-label",M(2,8,"Screen recording")+" "+M(3,10,(n==null?null:n.id)||"unnamed"))("data-testid",t.componentId+"-recorder-"+(n==null?null:n.id))}}function lYe(i,o){if(i&1){let n=q();f(0),g(1,sYe,4,12,"ng-container",3),_(2,"snippyly-recorder-control-panel-internal",4),P(3,"translate"),z("onRecordedData",function(t){N(n);let r=l(2).ngIf;return F(r==null?null:r.onRecordedData(t))}),b(),v()}if(i&2){let n=l(2).ngIf,e=l();m(),c("ngForOf",n==null?null:n.localRecordedData)("ngForTrackBy",n==null?null:n.trackByRecorderId),m(),c("panelId",n==null?null:n.commentDialogUniqueId)("darkMode",!!(n!=null&&n.darkMode)),x("aria-label",M(3,6,"Screen recording controls"))("data-testid",e.componentId+"-control-panel")}}function cYe(i,o){if(i&1&&(f(0),g(1,lYe,4,8,"ng-container",2),v()),i&2){let n=l().ngIf,e=l();m(),c("veltDynamicTemplate",$(3,aYe,e.template,A(1,Vde,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function dYe(i,o){if(i&1&&(f(0),g(1,cYe,2,9,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,rYe,n.conditionSignal(),A(1,Vde,n.componentConfigSignal)))}}var L2=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-comment-dialog-composer-recordings",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogComposerRecordingsComponent ngOnInit: ",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogComposerRecordingsComponent ngOnDestroy: ",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","region"),e.setAttribute("aria-label","Recordings section")}catch(e){this.loggingService.catch("Error in CommentDialogComposerRecordingsComponent setupA11yAttributes: ",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-composer-recordings"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[4,"ngFor","ngForOf","ngForTrackBy"],["mode","thread","sourceFeature","comment","role","group",3,"onRecordedData","panelId","darkMode"],["mode","thread","sourceFeature","comment","role","group",3,"onDelete","isEditMode","showSummary","darkMode","recorderId","shadowDom","playVideoInFullScreen"]],template:function(t,r){t&1&&g(0,dYe,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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%;display:flex;flex-direction:column;gap:var(--velt-spacing-lg)}[_nghost-%COMP%]:empty{display:none}snippyly-recorder-control-panel-internal[_ngcontent-%COMP%]{width:100%}snippyly-recorder-player-internal[_ngcontent-%COMP%]{width:100%}"],changeDetection:0});let i=o;return i})();var mYe=i=>({componentConfigSignal:i}),pYe=(i,o)=>({condition:i,data:o}),gYe=(i,o,n,e,t)=>({componentConfigSignal:i,editMode:o,commentObj:n,i:e,wireframe:t}),uYe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-composer-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function hYe(i,o){if(i&1&&(f(0),w(1,"app-comment-dialog-composer-avatar",6),v()),i&2){let n=l(6);m(),c("componentConfigSignal",n.componentConfigSignal)}}function fYe(i,o){if(i&1&&w(0,"app-comment-dialog-composer-action-button",13),i&2){let n=l(7);c("type","submit")("componentConfigSignal",n.componentConfigSignal)("editMode",n.editMode)("commentObj",n.commentObj)("i",n.i)}}function vYe(i,o){if(i&1&&(_(0,"div",10),w(1,"app-comment-dialog-composer-input",11),g(2,fYe,1,5,"app-comment-dialog-composer-action-button",12),b()),i&2){let n=l(5).ngIf,e=l();m(),c("componentConfigSignal",e.componentConfigSignal)("editMode",e.editMode)("commentObj",e.commentObj)("i",e.i),m(),c("ngIf",n.composerMode==="default"&&!n.composerInOpenState)}}function CYe(i,o){i&1&&w(0,"div",18)}function _Ye(i,o){if(i&1&&(f(0),g(1,CYe,1,0,"div",14),_(2,"div",15),w(3,"app-comment-dialog-composer-action-button",13)(4,"app-comment-dialog-composer-action-button",16)(5,"app-comment-dialog-composer-action-button",16)(6,"app-comment-dialog-composer-action-button",16)(7,"app-comment-dialog-composer-action-button",16)(8,"div",17)(9,"app-comment-dialog-composer-action-button",13),b(),v()),i&2){let n=l(5).ngIf,e=l();m(),c("ngIf",!(n!=null&&n.recorderInitConfig&&(n==null||n.recorderInitConfig==null?null:n.recorderInitConfig.panelId)===(n==null?null:n.commentDialogUniqueId)&&(n==null||n.recorderInitConfig==null?null:n.recorderInitConfig.type)==="screen")),m(2),c("type","autocomplete")("componentConfigSignal",e.componentConfigSignal)("editMode",e.editMode)("commentObj",e.commentObj)("i",e.i),m(),c("type","attachments")("componentConfigSignal",e.componentConfigSignal),m(),c("type","audio")("componentConfigSignal",e.componentConfigSignal),m(),c("type","video")("componentConfigSignal",e.componentConfigSignal),m(),c("type","screen")("componentConfigSignal",e.componentConfigSignal),m(2),c("type","submit")("componentConfigSignal",e.componentConfigSignal)("editMode",e.editMode)("commentObj",e.commentObj)("i",e.i)}}function yYe(i,o){if(i&1&&(f(0),_(1,"div"),g(2,hYe,2,1,"ng-container",0),_(3,"div",5),w(4,"app-comment-dialog-composer-private-badge",6)(5,"app-comment-dialog-composer-attachments",7)(6,"app-comment-dialog-composer-recordings",6)(7,"app-comment-dialog-custom-annotation-dropdown",8),g(8,vYe,3,5,"div",9)(9,_Ye,10,19,"ng-container",0),b()(),w(10,"app-comment-dialog-composer-assign-user",6),v()),i&2){let n=l(4).ngIf,e=l();m(),ue("velt-composer--inline-comment-section-mode",n.inlineCommentSectionMode)("velt-composer--multi-thread-mode",n.multiThread)("velt-composer--comment-composer-mode",n.commentComposerMode),m(),c("ngIf",n.inlineCommentSectionMode),m(2),c("componentConfigSignal",e.componentConfigSignal),m(),c("wireframe",e.wireframe)("componentConfigSignal",e.componentConfigSignal),m(),c("componentConfigSignal",e.componentConfigSignal),m(),c("componentConfigSignal",e.componentConfigSignal),m(),c("ngIf",!(n!=null&&n.recorderInitConfig&&(n==null||n.recorderInitConfig==null?null:n.recorderInitConfig.panelId)===(n==null?null:n.commentDialogUniqueId))),m(),c("ngIf",n.composerMode!=="default"||n.composerMode==="default"&&n.composerInOpenState),m(),c("componentConfigSignal",e.componentConfigSignal)}}function SYe(i,o){if(i&1){let n=q();_(0,"div",3),P(1,"translate"),P(2,"translate"),z("click",function(){N(n);let t=l(3).ngIf;return F(t==null?null:t.focusOnComposerInput())}),g(3,yYe,11,15,"ng-container",4),b()}if(i&2){let n=l(3).ngIf,e=l();ue("velt-comment-dialog-composer--no-comments",!(!(n==null||n.annotation==null||n.annotation.comments==null)&&n.annotation.comments.length))("velt-comment-dialog-composer--inline",n.inlineCommentSectionMode)("velt-comment-dialog-composer--top",n.composerPosition==="top")("velt-comment-dialog-composer--recording",(n==null||n.recorderInitConfig==null?null:n.recorderInitConfig.panelId)===(n==null?null:n.commentDialogUniqueId))("velt-composer-edit-mode",e.editMode)("velt-composer-open",n.composerInOpenState)("velt-composer-input-focused",n.isInputFocused),x("aria-label",e.editMode?M(1,17,"Edit comment section"):M(2,19,"Add new comment section"))("data-testid",e.componentId+"-section"),m(3),c("veltDynamicTemplate",$(27,uYe,e.template,$(21,gYe,e.componentConfigSignal,e.editMode,e.commentObj,e.i,e.wireframe),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function bYe(i,o){if(i&1&&(f(0),g(1,SYe,4,33,"div",2),v()),i&2){let n=l(2).ngIf,e=l();m(),c("ngIf",!(n!=null&&n.disabled)&&!!(n!=null&&n.editComment)===e.editMode&&(n==null?null:n.isKnownUser)&&(!(!(n==null||n.annotation==null||n.annotation.comments==null)&&n.annotation.comments.length)||(n==null?null:n.commentDialogSelected))&&!(n!=null&&n.isPlanExpired))}}function IYe(i,o){if(i&1&&(f(0),g(1,bYe,2,1,"ng-container",0),v()),i&2){let n=l().ngIf;m(),c("ngIf",!(!(n==null||n.annotation==null||n.annotation.comments==null)&&n.annotation.comments.length)||!(n!=null&&n.inlineCommentMode))}}function EYe(i,o){if(i&1&&(f(0),g(1,IYe,2,1,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,pYe,n.conditionSignal(),A(1,mYe,n.componentConfigSignal)))}}var fh=(()=>{let o=class o extends H{get composerWireframe(){return this._composerWireframe}set composerWireframe(e){this._composerWireframe=e,this.composerWireframe&&this.composerWireframe?.children?.length>0?this.template=this.domService.deepCloneElement(this.composerWireframe):this.template=null}onClick(e){try{e.stopPropagation(),e.preventDefault()}catch(t){this.loggingService.catch("Error in CommentDialogComposerComponent onClick:",t)}}constructor(e,t,r,a){super(r,a,t),this.domService=e,this.loggingService=t,this.elementRef=r,this.dynamicDataService=a,this.editMode=!1,this.componentId="velt-comment-dialog-composer",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogComposerComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogComposerComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","region"),e.setAttribute("aria-label","Comment composer section")}catch(e){this.loggingService.catch("Error in CommentDialogComposerComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(Fe),h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-composer"]],hostBindings:function(t,r){t&1&&z("click",function(s){return r.onClick(s)})},inputs:{editMode:"editMode",commentObj:"commentObj",i:"i",composerWireframe:"composerWireframe"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["class","velt-comment-dialog-composer","role","region",3,"velt-comment-dialog-composer--no-comments","velt-comment-dialog-composer--inline","velt-comment-dialog-composer--top","velt-comment-dialog-composer--recording","velt-composer-edit-mode","velt-composer-open","velt-composer-input-focused","click",4,"ngIf"],["role","region",1,"velt-comment-dialog-composer",3,"click"],[4,"veltDynamicTemplate"],[1,"velt-composer--reply-div","velt-composer--input-text-wrap"],[3,"componentConfigSignal"],[3,"wireframe","componentConfigSignal"],["type","composer",3,"componentConfigSignal"],["style","display: flex; width: 100%;",4,"ngIf"],[2,"display","flex","width","100%"],[3,"componentConfigSignal","editMode","commentObj","i"],[3,"type","componentConfigSignal","editMode","commentObj","i",4,"ngIf"],[3,"type","componentConfigSignal","editMode","commentObj","i"],["class","velt-composer--line-div",4,"ngIf"],[1,"velt-composer--actions-wrap"],[3,"type","componentConfigSignal"],[1,"velt-composer--flex-fill"],[1,"velt-composer--line-div"]],template:function(t,r){t&1&&g(0,EYe,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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%;display:flex}[_nghost-%COMP%]:empty{display:none}.velt-comment-dialog-composer[_ngcontent-%COMP%]{width:100%;box-sizing:border-box}.velt-composer--reply-div[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;justify-content:flex-start;width:100%;height:100%;border-radius:var(--velt-border-radius-md);background-color:var(--velt-background-0);border:1px solid var(--velt-border-4);box-sizing:border-box;position:relative;padding:var(--velt-spacing-sm);transition:.5s}.velt-composer--inline-comment-section-mode[_ngcontent-%COMP%]{display:flex;gap:var(--velt-spacing-sm);width:100%}.velt-composer--inline-comment-section-mode[_ngcontent-%COMP%] app-comment-dialog-composer-avatar[_ngcontent-%COMP%]{display:none}.velt-composer--inline-comment-section-mode[_ngcontent-%COMP%] .velt-composer--input-text-wrap[_ngcontent-%COMP%]{border:0px;padding:0}.velt-comment-dialog-composer--no-comments[_ngcontent-%COMP%] .velt-composer--inline-comment-section-mode[_ngcontent-%COMP%] app-comment-dialog-composer-avatar[_ngcontent-%COMP%]{margin-top:2px;display:block}[_nghost-%COMP%] .velt-comment-dialog-composer--inline .velt-dropdown-container{padding:var(--velt-spacing-md) 0px}.velt-composer--line-div[_ngcontent-%COMP%]{border-top:1px solid var(--velt-border-4);width:100%}.velt-composer--line-div[_ngcontent-%COMP%]:not(:empty){overflow:hidden;text-align:center;color:var(--velt-text-10);cursor:pointer;border-top:0}.velt-composer--line-div[_ngcontent-%COMP%]:not(:empty):before, .velt-composer--line-div[_ngcontent-%COMP%]:not(:empty):after{background-color:var(--velt-background-4);content:"";display:inline-block;height:1px;position:relative;vertical-align:middle;width:50%}.velt-composer--line-div[_ngcontent-%COMP%]:not(:empty):before{right:.5em;margin-left:calc(var(--velt-border-radius-full) * -1)}.velt-composer--line-div[_ngcontent-%COMP%]:not(:empty):after{left:.5em;margin-left:calc(var(--velt-border-radius-full) * -1)}.velt-composer--actions-wrap[_ngcontent-%COMP%]{position:relative;width:100%;margin-top:var(--velt-spacing-sm);display:flex;flex-direction:line;align-items:center;justify-content:flex-start;gap:var(--velt-spacing-xs)}.velt-composer--flex-fill[_ngcontent-%COMP%]{flex:1}.velt-composer-open[_ngcontent-%COMP%]{max-height:280px;overflow:auto}*[_ngcontent-%COMP%]{-ms-overflow-style:none;scrollbar-width:none}*[_ngcontent-%COMP%]::-webkit-scrollbar{display:none}.velt-comment-dialog-composer--top[_ngcontent-%COMP%] .velt-composer--inline-comment-section-mode[_ngcontent-%COMP%] .velt-composer--input-text-wrap[_ngcontent-%COMP%]{border-bottom:1px solid var(--velt-border-4);padding-bottom:var(--velt-spacing-md);border-radius:0}.velt-comment-dialog-composer--top[_ngcontent-%COMP%] .velt-composer--inline-comment-section-mode[_ngcontent-%COMP%] .velt-composer--input-text-wrap[_ngcontent-%COMP%] .velt-composer--line-div[_ngcontent-%COMP%]{display:none}'],changeDetection:0});let i=o;return i})();var Ude=i=>({componentConfigSignal:i}),TYe=(i,o)=>({condition:i,data:o}),DYe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-ghost-banner-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function wYe(i,o){if(i&1&&(f(0),le(),_(1,"svg",5),w(2,"path",6)(3,"path",7),b(),pt(),_(4,"span",8),ee(5),P(6,"translate"),b(),v()),i&2){let n=l(3).ngIf,e=l();m(4),x("data-testid",e.componentId+"-message"),m(),Ce(" ",M(6,2,n==null||n.ghostComment==null?null:n.ghostComment.message),"")}}function OYe(i,o){if(i&1&&(_(0,"div",3),P(1,"translate"),g(2,wYe,7,4,"ng-container",4),b()),i&2){let n=l(2).ngIf,e=l();x("aria-label",M(1,3,"Ghost comment notification"))("data-testid",e.componentId),m(2),c("veltDynamicTemplate",$(7,DYe,e.template,A(5,Ude,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function AYe(i,o){if(i&1&&(f(0),g(1,OYe,3,13,"div",2),v()),i&2){let n=l().ngIf;m(),c("ngIf",(n==null?null:n.showGhostCommentMessage)&&!(n!=null&&n.inlineCommentMode)&&(n==null||n.annotation==null||n.annotation.comments==null?null:n.annotation.comments.length))}}function PYe(i,o){if(i&1&&(f(0),g(1,AYe,2,1,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,TYe,n.conditionSignal(),A(1,Ude,n.componentConfigSignal)))}}var H0=(()=>{let o=class o extends H{constructor(e,t,r){super(t,r,e),this.loggingService=e,this.elementRef=t,this.dynamicDataService=r,this.componentId="velt-comment-dialog-ghost-banner",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogGhostBannerComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogGhostBannerComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","region"),e.setAttribute("aria-label","Ghost comment banner")}catch(e){this.loggingService.catch("Error in CommentDialogGhostBannerComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-ghost-banner"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["class","velt-ghost-banner","role","region",4,"ngIf"],["role","region",1,"velt-ghost-banner"],[4,"veltDynamicTemplate"],["width","16","height","16","viewBox","0 0 16 16","fill","none","xmlns","http://www.w3.org/2000/svg","aria-hidden","true"],["fill-rule","evenodd","clip-rule","evenodd","d","M8.00065 13.3333C10.9462 13.3333 13.334 10.9455 13.334 7.99998C13.334 5.05446 10.9462 2.66665 8.00065 2.66665C5.05513 2.66665 2.66732 5.05446 2.66732 7.99998C2.66732 10.9455 5.05513 13.3333 8.00065 13.3333ZM8.00065 14.6666C11.6825 14.6666 14.6673 11.6819 14.6673 7.99998C14.6673 4.31808 11.6825 1.33331 8.00065 1.33331C4.31875 1.33331 1.33398 4.31808 1.33398 7.99998C1.33398 11.6819 4.31875 14.6666 8.00065 14.6666Z","fill","currentColor"],["fill-rule","evenodd","clip-rule","evenodd","d","M8.00065 4.66669C7.63246 4.66669 7.33398 4.96516 7.33398 5.33335C7.33398 5.70154 7.63246 6.00002 8.00065 6.00002C8.36884 6.00002 8.66732 5.70154 8.66732 5.33335C8.66732 4.96516 8.36884 4.66669 8.00065 4.66669ZM8.00065 7.33335C7.63246 7.33335 7.33398 7.63183 7.33398 8.00002V10.6667C7.33398 11.0349 7.63246 11.3334 8.00065 11.3334C8.36884 11.3334 8.66732 11.0349 8.66732 10.6667V8.00002C8.66732 7.63183 8.36884 7.33335 8.00065 7.33335Z","fill","currentColor"],["aria-live","polite"]],template:function(t,r){t&1&&g(0,PYe,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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%]:empty{display:none}.velt-ghost-banner[_ngcontent-%COMP%]{margin:-14px -14px 0;padding:var(--velt-spacing-2xl) var(--velt-spacing-lg);border-radius:var(--velt-border-radius-md) var(--velt-border-radius-md) 0 0;background-color:color-mix(in srgb,var(--velt-error) 12%,transparent);display:flex;gap:var(--velt-spacing-sm);color:var(--velt-error);align-items:center}.velt-ghost-banner[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{font-size:var(--velt-font-size-xs)}"],changeDetection:0});let i=o;return i})();var kYe=["customContainerRef"],RYe=["*"],jde=i=>({componentConfigSignal:i}),NYe=(i,o)=>({condition:i,data:o}),FYe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-header-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function LYe(i,o){if(i&1&&(_(0,"div",6,0),P(2,"translate"),Nt(3),b()),i&2){let n=l(5);x("data-testid",n.componentId+"-custom")("aria-label",M(2,2,"Comment dialog header"))}}function BYe(i,o){if(i&1&&(_(0,"div",6),P(1,"translate"),w(2,"app-comment-dialog-status",7)(3,"app-comment-dialog-priority",7)(4,"app-comment-dialog-custom-annotation-dropdown",7)(5,"div",8)(6,"app-comment-dialog-options",7)(7,"app-copy-link",7)(8,"app-comment-dialog-resolve-button",7)(9,"app-comment-dialog-unresolve-button",7),b()),i&2){let n=l(5);x("data-testid",n.componentId+"-default")("aria-label",M(1,18,"Comment dialog header controls"))("aria-controls",n.componentId+"-content"),m(2),c("componentConfigSignal",n.componentConfigSignal),x("data-testid",n.componentId+"-status"),m(),c("componentConfigSignal",n.componentConfigSignal),x("data-testid",n.componentId+"-priority"),m(),c("componentConfigSignal",n.componentConfigSignal),x("data-testid",n.componentId+"-custom-annotation-dropdown"),m(),x("data-testid",n.componentId+"-fill"),m(),c("componentConfigSignal",n.componentConfigSignal),x("data-testid",n.componentId+"-options"),m(),c("componentConfigSignal",n.componentConfigSignal),x("data-testid",n.componentId+"-copy-link"),m(),c("componentConfigSignal",n.componentConfigSignal),x("data-testid",n.componentId+"-resolve-button"),m(),c("componentConfigSignal",n.componentConfigSignal),x("data-testid",n.componentId+"-unresolve-button")}}function VYe(i,o){if(i&1&&(_(0,"div",9),w(1,"app-comment-dialog-comment-index",7)(2,"app-comment-dialog-comment-category",7)(3,"div",8)(4,"app-comment-dialog-comment-suggestion-status",7)(5,"app-comment-dialog-priority",7)(6,"app-comment-dialog-status",7)(7,"app-comment-dialog-navigation-button",7),b()),i&2){let n=l(5);m(),c("componentConfigSignal",n.componentConfigSignal),x("data-testid",n.componentId+"-comment-index"),m(),c("componentConfigSignal",n.componentConfigSignal),x("data-testid",n.componentId+"-comment-category"),m(),x("data-testid",n.componentId+"-fill"),m(),c("componentConfigSignal",n.componentConfigSignal),x("data-testid",n.componentId+"-comment-suggestion-status"),m(),c("componentConfigSignal",n.componentConfigSignal),x("data-testid",n.componentId+"-priority"),m(),c("componentConfigSignal",n.componentConfigSignal),x("data-testid",n.componentId+"-status"),m(),c("componentConfigSignal",n.componentConfigSignal),x("data-testid",n.componentId+"-navigation-button")}}function UYe(i,o){if(i&1&&(f(0),g(1,LYe,4,4,"div",4)(2,BYe,10,20,"div",4)(3,VYe,8,13,"div",5),v()),i&2){let n=l(3).ngIf,e=l();m(),c("ngIf",!e.showDefaultContent),m(),c("ngIf",e.showDefaultContent()&&!(n!=null&&n.sidebarMode)),m(),c("ngIf",e.showDefaultContent()&&(n==null?null:n.sidebarMode))}}function jYe(i,o){if(i&1&&(f(0),g(1,UYe,4,3,"ng-container",3),v()),i&2){let n=l(2).ngIf,e=l();m(),c("veltDynamicTemplate",$(3,FYe,e.template,A(1,jde,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function $Ye(i,o){if(i&1&&(f(0),g(1,jYe,2,9,"ng-container",1),v()),i&2){let n=l().ngIf;m(),c("ngIf",n==null||n.annotation==null||n.annotation.comments==null?null:n.annotation.comments.length)}}function HYe(i,o){if(i&1&&(f(0),g(1,$Ye,2,1,"ng-container",2),v()),i&2){let n=l();m(),c("veltIf",k(3,NYe,n.conditionSignal(),A(1,jde,n.componentConfigSignal)))}}var z0=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.showDefaultContent=xe(!1),this.componentId="velt-comment-dialog-header",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogHeaderComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogHeaderComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogHeaderComponent setupA11yAttributes:",e)}}ngAfterViewInit(){try{this.customContainerRef?.nativeElement?.children?.length||this.showDefaultContent.set(!0)}catch{}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-header"]],viewQuery:function(t,r){if(t&1&&nt(kYe,5),t&2){let a;Xe(a=Qe())&&(r.customContainerRef=a.first)}},standalone:!1,features:[V([S]),B],ngContentSelectors:RYe,decls:1,vars:1,consts:[["customContainerRef",""],[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["class","velt-header","role","banner",4,"ngIf"],["class","velt-header",4,"ngIf"],["role","banner",1,"velt-header"],[3,"componentConfigSignal"],[1,"velt-fill"],[1,"velt-header"]],template:function(t,r){t&1&&(Bt(),g(0,HYe,2,6,"ng-container",1)),t&2&&c("ngIf",r.componentConfigSignal())},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%}[_nghost-%COMP%]:empty{display:none}.velt-header[_ngcontent-%COMP%]{display:flex;justify-content:flex-end;align-items:center;gap:var(--velt-spacing-sm);position:relative}.velt-fill[_ngcontent-%COMP%]{flex-grow:1}"],changeDetection:0});let i=o;return i})();var $de=i=>({componentConfigSignal:i}),GYe=(i,o)=>({condition:i,data:o}),WYe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-more-reply-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function qYe(i,o){if(i&1&&(_(0,"div",4),ee(1),P(2,"translate"),P(3,"translate"),b()),i&2){let n=l(3).ngIf,e=l();x("data-testid",e.componentId+"-count-"+e.i)("aria-live","polite"),m(),Ce(" ",(n==null||n.annotation==null||n.annotation.comments==null?null:n.annotation.comments.length)===3?M(2,3,"1 more reply"):(n==null||n.annotation==null||n.annotation.comments==null?null:n.annotation.comments.length)-2+" "+M(3,5,"more replies")," ")}}function YYe(i,o){if(i&1){let n=q();f(0),_(1,"div",2),P(2,"translate"),P(3,"translate"),z("click",function(t){N(n);let r=l(2).ngIf;return r==null||r.onMoreRepliesClick(),F(t.stopPropagation())}),g(4,qYe,4,7,"div",3),b(),v()}if(i&2){let n=l(2).ngIf,e=l();m(),x("data-testid",e.componentId+"-button-"+e.i)("aria-label",(n==null||n.annotation==null||n.annotation.comments==null?null:n.annotation.comments.length)===3?M(2,3,"Show 1 more reply"):M(3,5,"Show "+((n==null||n.annotation==null||n.annotation.comments==null?null:n.annotation.comments.length)-2)+" more replies")),m(3),c("veltDynamicTemplate",$(9,WYe,e.template,A(7,$de,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function KYe(i,o){if(i&1&&(f(0),g(1,YYe,5,15,"ng-container",0),v()),i&2){let n=l().ngIf,e=l();m(),c("ngIf",(n==null?null:n.commentDialogSelected)&&!(n!=null&&n.showAllComments)&&(n==null||n.annotation==null||n.annotation.comments==null?null:n.annotation.comments.length)>2&&e.i===1)}}function ZYe(i,o){if(i&1&&(f(0),g(1,KYe,2,1,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,GYe,n.conditionSignal(),A(1,$de,n.componentConfigSignal)))}}var B2=(()=>{let o=class o extends H{get moreReplyTemplate(){return this._moreReplyTemplate}set moreReplyTemplate(e){try{this._moreReplyTemplate=e,this._moreReplyTemplate?this.template=this.domService.deepCloneElement(this.moreReplyTemplate):this.template=null}catch(t){this.loggingService.catch("Error in CommentDialogMoreReplyComponent moreReplyTemplate:",t)}}constructor(e,t,r,a){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.domService=a,this.componentId="velt-comment-dialog-more-reply",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogMoreReplyComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogMoreReplyComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",`${this.componentId}-host-${this.i}`)}catch(e){this.loggingService.catch("Error in CommentDialogMoreReplyComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S),h(Fe))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-more-reply"]],inputs:{i:"i",moreReplyTemplate:"moreReplyTemplate"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["role","button","tabindex","0",3,"click"],["class","velt-hidden-count","role","status",4,"veltDynamicTemplate"],["role","status",1,"velt-hidden-count"]],template:function(t,r){t&1&&g(0,ZYe,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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%]:empty{display:none}.velt-hidden-count[_ngcontent-%COMP%]{text-align:center;color:var(--velt-text-10);cursor:pointer}.velt-hidden-count[_ngcontent-%COMP%]:before, .velt-hidden-count[_ngcontent-%COMP%]:after{background-color:var(--velt-background-4);content:"";display:inline-block;height:1px;position:relative;vertical-align:middle;width:calc(50% - 50px - 1em)}.velt-hidden-count[_ngcontent-%COMP%]:before{right:.5em;margin-left:-50%}.velt-hidden-count[_ngcontent-%COMP%]:after{left:.5em;margin-right:-50%}'],changeDetection:0});let i=o;return i})();var Hde=i=>({componentConfigSignal:i}),XYe=(i,o)=>({condition:i,data:o}),QYe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-options-wireframe",variant:n,setIfCondition:e,componentElementRef:t,replaceTemplate:!1});function JYe(i,o){if(i&1){let n=q();f(0),_(1,"app-comment-dialog-options-dropdown",3),z("openAssignToMenu",function(){N(n);let t=l(3).ngIf;return F(t==null?null:t.toggleAssignToMenu())})("deleteComment",function(){N(n);let t=l(3).ngIf;return F(t==null?null:t.deleteComment())})("editCommentClick",function(){N(n);let t=l(3).ngIf;return F(t==null?null:t.onEditCommentClick(0))})("toggleNotificationSubscription",function(){N(n);let t=l(3).ngIf;return F(t==null?null:t.toggleNotificationSubscription())})("changeCommentAccessMode",function(t){N(n);let r=l(3).ngIf;return F(r==null?null:r.changeCommentAccessMode(t))}),b(),v()}if(i&2){let n=l(3).ngIf,e=l();m(),c("darkMode",!!(n!=null&&n.darkMode))("componentConfigSignal",e.componentConfigSignal)("annotation",n==null?null:n.annotation)("user",n==null?null:n.user)("allowAssignment",!!(n!=null&&n.userMentions))("notificationEnabled",!!(n!=null&&n.notificationEnabled))("variant",n==null?null:n.variant)("allowChangeCommentAccessMode",!!(n!=null&&n.isUserAdmin))("isUserAdmin",!!(n!=null&&n.isUserAdmin))("shadowDom",n.dialogShadowDOM)("contentTemplate",e.contentTemplate)("triggerTemplate",e.triggerTemplate)}}function eKe(i,o){if(i&1&&(f(0),w(1,"app-comment-dialog-assign-menu",4),v()),i&2){let n=l(4);m(),c("componentConfigSignal",n.componentConfigSignal)}}function tKe(i,o){if(i&1&&(f(0),g(1,JYe,2,12,"ng-container",0)(2,eKe,2,1,"ng-container",0),v()),i&2){let n=l(2).ngIf;m(),c("ngIf",n&&!(n!=null&&n.disabled)&&(n==null?null:n.dialogSelectedByKnownUser)&&!(n!=null&&n.isPlanExpired)&&(n==null||n.annotation==null||n.annotation.comments==null?null:n.annotation.comments.length)&&!(n!=null&&n.inlineCommentMode)),m(),c("ngIf",n&&!(n!=null&&n.disabled)&&(n==null?null:n.dialogSelectedByKnownUser)&&!(n!=null&&n.isPlanExpired)&&(n==null||n.annotation==null||n.annotation.comments==null?null:n.annotation.comments.length)&&!(n!=null&&n.inlineCommentMode))}}function nKe(i,o){if(i&1&&(f(0),g(1,tKe,3,2,"ng-container",2),v()),i&2){let n=l().ngIf,e=l();m(),c("veltDynamicTemplate",$(3,QYe,e.template,A(1,Hde,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function iKe(i,o){if(i&1&&(f(0),g(1,nKe,2,9,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,XYe,n.conditionSignal(),A(1,Hde,n.componentConfigSignal)))}}var V2=(()=>{let o=class o extends H{constructor(e,t,r,a){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.wireframeService=a,this.subscriptions=[],super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: ngOnInit","color: green;"),super.ngOnInit(),!this.template){let e="velt-comment-dialog-options-wireframe";this.variant&&(e+=`---${this.variant}`),this.subscriptions.push(this.wireframeService.getWireframe$(e).subscribe(t=>{if(t){let r=document.createElement(t.tagName);r.innerHTML=t.innerHTML,this.template=r,this.getChildTemplate()}}))}this.getChildTemplate()}catch(e){this.catchError("Error in CommentDialogOptionsComponent OnInit: ",e)}}ngOnDestroy(){try{super.ngOnDestroy(),this.subscriptions.forEach(e=>{e.unsubscribe()})}catch{}}getChildTemplate(){if(!this.triggerTemplate&&this.template){let e=this.template.querySelector("velt-comment-dialog-options-dropdown-trigger-wireframe");Ke(e)||(this.triggerTemplate=e)}if(!this.contentTemplate&&this.template){let e=this.template.querySelector("velt-comment-dialog-options-dropdown-content-wireframe");Ke(e)||(this.contentTemplate=e)}}catchError(e,t,r){try{this.loggingService.catch(e,t,T(I({},r||{}),{annotationId:this.componentConfigSignal()?.annotation?.annotationId}))}catch{}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S),h(He))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-options"]],inputs:{variant:"variant"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[3,"openAssignToMenu","deleteComment","editCommentClick","toggleNotificationSubscription","changeCommentAccessMode","darkMode","componentConfigSignal","annotation","user","allowAssignment","notificationEnabled","variant","allowChangeCommentAccessMode","isUserAdmin","shadowDom","contentTemplate","triggerTemplate"],[3,"componentConfigSignal"]],template:function(t,r){t&1&&g(0,iKe,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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:relative;display:inline-block}[_nghost-%COMP%]:empty{display:none}"],changeDetection:0});let i=o;return i})();var zde=i=>({componentConfigSignal:i}),oKe=(i,o)=>({condition:i,data:o}),rKe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-priority-wireframe",variant:n,setIfCondition:e,componentElementRef:t,replaceTemplate:!1});function aKe(i,o){if(i&1){let n=q();f(0),_(1,"velt-comment-dialog-priority-dropdown-internal",3),z("changePriority",function(t){N(n);let r=l(3).ngIf;return F(r==null?null:r.changePriority(t))})("click",function(t){return N(n),F(t.stopPropagation())}),b(),v()}if(i&2){let n=l(3).ngIf,e=l();m(),c("disabled",(n==null?null:n.disabled)||(n==null?null:n.isPlanExpired))("darkMode",!!(n!=null&&n.darkMode))("enablePriority",!!(n!=null&&n.enablePriority))("shadowDom",n.dialogShadowDOM)("variant",n==null?null:n.variant)("annotation",n==null?null:n.annotation)("user",n==null?null:n.user)("triggerTemplate",e.triggerTemplate)("contentTemplate",e.contentTemplate)}}function sKe(i,o){if(i&1&&(f(0),g(1,aKe,2,9,"ng-container",0),v()),i&2){let n=l(2).ngIf;m(),c("ngIf",(n==null||n.annotation==null||n.annotation.comments==null?null:n.annotation.comments.length)&&!(n!=null&&n.inlineCommentMode)&&(n==null?null:n.enablePriority))}}function lKe(i,o){if(i&1&&(f(0),g(1,sKe,2,1,"ng-container",2),v()),i&2){let n=l().ngIf,e=l();m(),c("veltDynamicTemplate",$(3,rKe,e.template,A(1,zde,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function cKe(i,o){if(i&1&&(f(0),g(1,lKe,2,9,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,oKe,n.conditionSignal(),A(1,zde,n.componentConfigSignal)))}}var U2=(()=>{let o=class o extends H{constructor(e,t,r,a){super(r,a,e),this.loggingService=e,this.wireframeService=t,this.elementRef=r,this.dynamicDataService=a,this.subscriptions=[],this.componentId="velt-comment-dialog-priority",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: ngOnInit","color: green;"),super.ngOnInit(),this.setupA11yAttributes(),!this.template){let e="velt-comment-dialog-priority-wireframe";this.variant&&(e+=`---${this.variant}`),this.subscriptions.push(this.wireframeService.getWireframe$(e).subscribe(t=>{if(t){let r=document.createElement(t.tagName);r.innerHTML=t.innerHTML,this.template=r,this.getChildTemplate()}}))}this.getChildTemplate()}catch(e){this.catchError("Error in CommentDialogPriorityComponent OnInit: ",e)}}ngOnDestroy(){try{super.ngOnDestroy(),this.subscriptions.forEach(e=>{e.unsubscribe()})}catch{}}getChildTemplate(){if(!this.triggerTemplate&&this.template){let e=this.template.querySelector("velt-comment-dialog-priority-dropdown-trigger-wireframe");Ke(e)||(this.triggerTemplate=e)}if(!this.contentTemplate&&this.template){let e=this.template.querySelector("velt-comment-dialog-priority-dropdown-content-wireframe");Ke(e)||(this.contentTemplate=e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","combobox"),e.setAttribute("aria-label","Priority")}catch(e){this.loggingService.catch("Error setting up accessibility attributes in CommentDialogPriorityComponent: ",e)}}catchError(e,t,r){try{this.loggingService.catch(e,t,T(I({},r||{}),{annotationId:this.componentConfigSignal()?.annotation?.annotationId}))}catch{}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(He),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-priority"]],inputs:{variant:"variant"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["snippylyTheme","",3,"changePriority","click","disabled","darkMode","enablePriority","shadowDom","variant","annotation","user","triggerTemplate","contentTemplate"]],template:function(t,r){t&1&&g(0,cKe,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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%]:empty{display:none}"],changeDetection:0});let i=o;return i})();var Gde=i=>({componentConfigSignal:i}),dKe=(i,o)=>({condition:i,data:o}),mKe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-private-badge-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function pKe(i,o){if(i&1&&(_(0,"button",3),P(1,"translate"),le(),_(2,"svg",4),w(3,"path",5)(4,"path",6),b(),ee(5),P(6,"translate"),b()),i&2){let n=l(4);x("aria-label",M(1,3,"Private comment mode - only visible to your team"))("data-testid",n.componentId),m(5),Ce(" ",M(6,5,"Only for your team")," ")}}function gKe(i,o){if(i&1&&(f(0),g(1,pKe,7,7,"button",2),v()),i&2){let n=l(2).ngIf,e=l();m(),c("veltDynamicTemplate",$(3,mKe,e.template,A(1,Gde,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function uKe(i,o){if(i&1&&(f(0),g(1,gKe,2,9,"ng-container",0),v()),i&2){let n=l().ngIf;m(),c("ngIf",(n==null?null:n.isPrivateComment)&&!(!(n==null||n.annotation==null||n.annotation.comments==null)&&n.annotation.comments.length))}}function hKe(i,o){if(i&1&&(f(0),g(1,uKe,2,1,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,dKe,n.conditionSignal(),A(1,Gde,n.componentConfigSignal)))}}var j2=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-comment-dialog-composer-private-badge",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogComposerPrivateBadgeComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogComposerPrivateBadgeComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("role","region"),e.setAttribute("aria-label","Private comment badge for your team")}catch(e){this.loggingService.catch("Error in CommentDialogComposerPrivateBadgeComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-composer-private-badge"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["class","velt-private-badge","role","button",4,"veltDynamicTemplate"],["role","button",1,"velt-private-badge"],["width","14","height","14","viewBox","0 0 14 14","fill","none","xmlns","http://www.w3.org/2000/svg","aria-hidden","true"],["fill-rule","evenodd","clip-rule","evenodd","d","M1.81485 7.71681C1.9083 6.42388 2.92469 5.42008 4.21838 5.33784C4.99204 5.28867 5.93802 5.25 7 5.25C8.06198 5.25 9.00796 5.28867 9.78162 5.33784C11.0753 5.42008 12.0917 6.42388 12.1851 7.71681C12.2229 8.23864 12.25 8.79956 12.25 9.33333C12.25 9.86711 12.2229 10.428 12.1851 10.9499C12.0917 12.2428 11.0753 13.2466 9.78162 13.3288C9.00796 13.378 8.06198 13.4167 7 13.4167C5.93802 13.4167 4.99204 13.378 4.21838 13.3288C2.92469 13.2466 1.9083 12.2428 1.81485 10.9499C1.77714 10.428 1.75 9.86711 1.75 9.33333C1.75 8.79956 1.77714 8.23864 1.81485 7.71681ZM8.16667 8.75C8.16667 9.18183 7.93205 9.55887 7.58333 9.76059V10.5C7.58333 10.8222 7.32217 11.0833 7 11.0833C6.67783 11.0833 6.41667 10.8222 6.41667 10.5V9.76059C6.06795 9.55887 5.83333 9.18183 5.83333 8.75C5.83333 8.10567 6.35567 7.58333 7 7.58333C7.64433 7.58333 8.16667 8.10567 8.16667 8.75Z","fill","currentColor"],["fill-rule","evenodd","clip-rule","evenodd","d","M4.08398 3.4987C4.08398 1.88787 5.38982 0.582031 7.00065 0.582031C8.61148 0.582031 9.91732 1.88787 9.91732 3.4987V5.83203C9.91732 6.1542 9.65615 6.41536 9.33398 6.41536C9.01182 6.41536 8.75065 6.1542 8.75065 5.83203V3.4987C8.75065 2.5322 7.96715 1.7487 7.00065 1.7487C6.03415 1.7487 5.25065 2.5322 5.25065 3.4987V5.83203C5.25065 6.1542 4.98948 6.41536 4.66732 6.41536C4.34515 6.41536 4.08398 6.1542 4.08398 5.83203V3.4987Z","fill","currentColor"]],template:function(t,r){t&1&&g(0,hKe,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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%]{align-self:flex-start}[_nghost-%COMP%]:empty{display:none}.velt-private-badge[_ngcontent-%COMP%]{flex-shrink:0;display:flex;align-items:center;justify-content:center;padding-block:var(--velt-spacing-sm);gap:var(--velt-spacing-sm);background-color:var(--velt-background-0);border:none;border-radius:var(--velt-border-radius-sm);font-style:normal;font-weight:500;font-size:var(--velt-font-size-xs);line-height:18px;color:var(--velt-text-0)}"],changeDetection:0});let i=o;return i})();var Wde=i=>({componentConfigSignal:i}),fKe=(i,o)=>({condition:i,data:o}),vKe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-private-banner-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function CKe(i,o){if(i&1&&(_(0,"div",3),P(1,"translate"),le(),_(2,"svg",4),w(3,"path",5)(4,"path",6),b(),ee(5),P(6,"translate"),b()),i&2){let n=l(4);x("data-testid",n.componentId)("aria-label",M(1,4,"Private comment banner")),m(2),x("data-testid",n.componentId+"-icon"),m(3),Ce(" ",M(6,6,"Only for your team")," ")}}function _Ke(i,o){if(i&1&&(f(0),g(1,CKe,7,8,"div",2),v()),i&2){let n=l(2).ngIf,e=l();m(),c("veltDynamicTemplate",$(3,vKe,e.template,A(1,Wde,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function yKe(i,o){if(i&1&&(f(0),g(1,_Ke,2,9,"ng-container",0),v()),i&2){let n=l().ngIf;m(),c("ngIf",(n==null?null:n.isPrivateComment)&&(n==null||n.annotation==null||n.annotation.comments==null?null:n.annotation.comments.length))}}function SKe(i,o){if(i&1&&(f(0),g(1,yKe,2,1,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,fKe,n.conditionSignal(),A(1,Wde,n.componentConfigSignal)))}}var G0=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-comment-dialog-private-banner",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogPrivateBannerComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogPrivateBannerComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogPrivateBannerComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-private-banner"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["class","velt-private-comment--heading","role","banner",4,"veltDynamicTemplate"],["role","banner",1,"velt-private-comment--heading"],["width","14","height","14","viewBox","0 0 14 14","fill","none","xmlns","http://www.w3.org/2000/svg","aria-hidden","true","role","img"],["fill-rule","evenodd","clip-rule","evenodd","d","M1.81485 7.71681C1.9083 6.42388 2.92469 5.42008 4.21838 5.33784C4.99204 5.28867 5.93802 5.25 7 5.25C8.06198 5.25 9.00796 5.28867 9.78162 5.33784C11.0753 5.42008 12.0917 6.42388 12.1851 7.71681C12.2229 8.23864 12.25 8.79956 12.25 9.33333C12.25 9.86711 12.2229 10.428 12.1851 10.9499C12.0917 12.2428 11.0753 13.2466 9.78162 13.3288C9.00796 13.378 8.06198 13.4167 7 13.4167C5.93802 13.4167 4.99204 13.378 4.21838 13.3288C2.92469 13.2466 1.9083 12.2428 1.81485 10.9499C1.77714 10.428 1.75 9.86711 1.75 9.33333C1.75 8.79956 1.77714 8.23864 1.81485 7.71681ZM8.16667 8.75C8.16667 9.18183 7.93205 9.55887 7.58333 9.76059V10.5C7.58333 10.8222 7.32217 11.0833 7 11.0833C6.67783 11.0833 6.41667 10.8222 6.41667 10.5V9.76059C6.06795 9.55887 5.83333 9.18183 5.83333 8.75C5.83333 8.10567 6.35567 7.58333 7 7.58333C7.64433 7.58333 8.16667 8.10567 8.16667 8.75Z","fill","white"],["fill-rule","evenodd","clip-rule","evenodd","d","M4.0835 3.50001C4.0835 1.88918 5.38933 0.583344 7.00016 0.583344C8.61099 0.583344 9.91683 1.88918 9.91683 3.50001V5.83334C9.91683 6.15551 9.65566 6.41668 9.3335 6.41668C9.01133 6.41668 8.75016 6.15551 8.75016 5.83334V3.50001C8.75016 2.53351 7.96666 1.75001 7.00016 1.75001C6.03366 1.75001 5.25016 2.53351 5.25016 3.50001V5.83334C5.25016 6.15551 4.989 6.41668 4.66683 6.41668C4.34466 6.41668 4.0835 6.15551 4.0835 5.83334V3.50001Z","fill","white"]],template:function(t,r){t&1&&g(0,SKe,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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%]:empty{display:none}.velt-private-comment--heading[_ngcontent-%COMP%]{background:color-mix(in srgb,var(--velt-accent) 32%,var(--velt-black) 100%);margin:calc(var(--velt-spacing-lg) * -1);padding:var(--velt-spacing-lg);color:var(--velt-accent-foreground);display:flex;align-items:center;justify-content:flex-start;grid-gap:var(--velt-spacing-sm);gap:var(--velt-spacing-sm);margin-bottom:0;border-radius:var(--velt-border-radius-md) var(--velt-border-radius-md) 0 0;border-bottom:1px solid color-mix(in srgb,var(--velt-accent-foreground) 16%,transparent)}"],changeDetection:0});let i=o;return i})();var qde=i=>({componentConfigSignal:i}),IKe=(i,o)=>({condition:i,data:o}),EKe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-resolve-button-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function xKe(i,o){if(i&1&&(f(0),le(),_(1,"svg",5),w(2,"path",6),b(),v()),i&2){let n=l(4);m(),x("data-testid",n.componentId+"-icon")}}function TKe(i,o){if(i&1){let n=q();_(0,"app-resolve-button",3),P(1,"translate"),z("changeStatus",function(t){N(n);let r=l(2).ngIf;return F(r==null?null:r.changeStatus(t))})("click",function(t){return N(n),F(t.stopPropagation())}),g(2,xKe,3,1,"ng-container",4),b()}if(i&2){let n=l(2).ngIf,e=l();c("darkMode",!!(n!=null&&n.darkMode))("annotation",n==null?null:n.annotation)("sidebarMode",n==null?null:n.sidebarMode),x("data-testid",e.componentId)("aria-label",M(1,7,"Resolve thread"))("aria-pressed",!1),m(2),c("veltDynamicTemplate",$(11,EKe,e.template,A(9,qde,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function DKe(i,o){if(i&1&&(f(0),g(1,TKe,3,17,"app-resolve-button",2),v()),i&2){let n=l().ngIf;m(),c("ngIf",(n==null?null:n.canResolveAnnotation)&&!(!(n==null||n.annotation==null)&&n.annotation.assignedTo)&&(!(n!=null&&n.resolveStatusAccessAdminOnly)||(n==null||n.annotation==null||n.annotation.from==null?null:n.annotation.from.userId)===(n==null||n.user==null?null:n.user.userId)||(n==null?null:n.isUserAdmin)))}}function wKe(i,o){if(i&1&&(f(0),g(1,DKe,2,1,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,IKe,n.conditionSignal(),A(1,qde,n.componentConfigSignal)))}}var W0=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-comment-dialog-resolve-button",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogResolveButtonComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogResolveButtonComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogResolveButtonComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-resolve-button"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["role","button","tabindex","0",3,"darkMode","annotation","sidebarMode","changeStatus","click",4,"ngIf"],["role","button","tabindex","0",3,"changeStatus","click","darkMode","annotation","sidebarMode"],[4,"veltDynamicTemplate"],["width","12","height","10","viewBox","0 0 12 10","fill","none","xmlns","http://www.w3.org/2000/svg","aria-hidden","true","role","img"],["fill-rule","evenodd","clip-rule","evenodd","d","M11.5886 1.07806C11.914 1.4035 11.914 1.93114 11.5886 2.25657L4.92194 8.92324C4.5965 9.24868 4.06886 9.24868 3.74343 8.92324L0.410093 5.58991C0.0846564 5.26447 0.0846564 4.73683 0.410093 4.4114C0.73553 4.08596 1.26317 4.08596 1.5886 4.4114L4.33268 7.15547L10.4101 1.07806C10.7355 0.752625 11.2632 0.752625 11.5886 1.07806Z","fill","currentColor"]],template:function(t,r){t&1&&g(0,wKe,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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%]:empty{display:none}"],changeDetection:0});let i=o;return i})();var Yde=i=>({componentConfigSignal:i}),OKe=(i,o)=>({condition:i,data:o}),AKe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-sign-in-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function PKe(i,o){if(i&1&&(f(0),w(1,"div",5),_(2,"div",6),P(3,"translate"),ee(4),P(5,"translate"),b(),v()),i&2){let n=l(4);m(2),x("data-testid",n.componentId+"-button")("aria-label",M(3,3,"Sign In")),m(2),Ce(" ",M(5,5,"Sign In"),"")}}function MKe(i,o){if(i&1){let n=q();_(0,"div",3),z("click",function(t){N(n);let r=l(2).ngIf;return r==null||r.onSignInClick(),F(t.stopPropagation())}),g(1,PKe,6,7,"ng-container",4),b()}if(i&2){let n=l(2).ngIf,e=l();x("data-testid",e.componentId+"-container"),m(),c("veltDynamicTemplate",$(4,AKe,e.template,A(2,Yde,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function kKe(i,o){if(i&1&&(f(0),g(1,MKe,2,10,"ng-template",2),v()),i&2){let n=l().ngIf;m(),c("ngIf",(n==null?null:n.commentDialogSelected)&&(n==null||n.annotation==null||n.annotation.comments==null?null:n.annotation.comments.length)&&(!(n!=null&&n.user)||(n==null||n.user==null?null:n.user.isAnonymous))&&(n==null?null:n.enableSignInButton))}}function RKe(i,o){if(i&1&&(f(0),g(1,kKe,2,1,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,OKe,n.conditionSignal(),A(1,Yde,n.componentConfigSignal)))}}var q0=(()=>{let o=class o extends H{constructor(e,t,r){super(e,t,r),this.elementRef=e,this.dynamicDataService=t,this.loggingService=r,this.componentId="velt-comment-dialog-sign-in",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogSignInComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogSignInComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogSignInComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(S),h(y))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-sign-in"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[3,"ngIf"],["role","presentation",3,"click"],[4,"veltDynamicTemplate"],["role","presentation",1,"velt-fill"],["role","button","tabindex","0",1,"velt-flat-button","velt-success-button"]],template:function(t,r){t&1&&g(0,RKe,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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%]:empty{display:none}.velt-fill[_ngcontent-%COMP%]{flex-grow:1}.velt-flat-button[_ngcontent-%COMP%]{padding:var(--velt-spacing-sm) var(--velt-spacing-md);background:var(--velt-accent);border-radius:var(--velt-border-radius-3xl);border:0;color:var(--velt-accent-foreground);font-weight:700;transition:.2s;font-size:var(--velt-font-size-sm);cursor:pointer}.velt-flat-button[_ngcontent-%COMP%]:hover{background:var(--velt-accent-hover)}.velt-flat-button.velt-success-button[_ngcontent-%COMP%]{background:var(--velt-success)}.velt-flat-button.velt-success-button[_ngcontent-%COMP%]:hover{background:var(--velt-success-hover)}"],changeDetection:0});let i=o;return i})();var Kde=i=>({componentConfigSignal:i}),FKe=(i,o)=>({condition:i,data:o}),LKe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-status-wireframe",variant:n,setIfCondition:e,componentElementRef:t,replaceTemplate:!1});function BKe(i,o){if(i&1){let n=q();_(0,"app-comment-dialog-status-dropdown",4),P(1,"translate"),z("changeStatus",function(t){N(n);let r=l(4).ngIf;return F(r==null?null:r.changeStatus(t))})("click",function(t){return N(n),F(t.stopPropagation())}),b()}if(i&2){let n=l(4).ngIf,e=l();c("darkMode",!!(n!=null&&n.darkMode))("user",n==null?null:n.user)("annotation",n==null?null:n.annotation)("isUserAdmin",!!(n!=null&&n.isUserAdmin))("resolveStatusAccessAdminOnly",!!(n!=null&&n.resolveStatusAccessAdminOnly))("disabled",(n==null?null:n.disabled)||(n==null?null:n.isPlanExpired))("shadowDom",n.dialogShadowDOM)("variant",n==null?null:n.variant)("triggerTemplate",e.triggerTemplate)("contentTemplate",e.contentTemplate)("componentConfigSignal",e.componentConfigSignal),x("data-testid",e.componentId)("aria-label","Status dropdown for "+M(1,13,(n==null||n.annotation==null||n.annotation.status==null?null:n.annotation.status.name)||"comment"))}}function VKe(i,o){if(i&1&&(f(0),g(1,BKe,2,15,"app-comment-dialog-status-dropdown",3),v()),i&2){let n=l(3).ngIf;m(),c("ngIf",n==null?null:n.enableStatus)}}function UKe(i,o){if(i&1&&(f(0),g(1,VKe,2,1,"ng-container",0),v()),i&2){let n=l(2).ngIf;m(),c("ngIf",(n==null||n.annotation==null||n.annotation.comments==null?null:n.annotation.comments.length)&&!(n!=null&&n.inlineCommentMode))}}function jKe(i,o){if(i&1&&(f(0),g(1,UKe,2,1,"ng-container",2),v()),i&2){let n=l().ngIf,e=l();m(),c("veltDynamicTemplate",$(3,LKe,e.template,A(1,Kde,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function $Ke(i,o){if(i&1&&(f(0),g(1,jKe,2,9,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,FKe,n.conditionSignal(),A(1,Kde,n.componentConfigSignal)))}}var $2=(()=>{let o=class o extends H{constructor(e,t,r,a){super(r,a,e),this.loggingService=e,this.wireframeService=t,this.elementRef=r,this.dynamicDataService=a,this.subscriptions=[],this.componentId="velt-comment-dialog-status",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: ngOnInit","color: green;"),super.ngOnInit(),this.setupA11yAttributes(),!this.template){let e="velt-comment-dialog-status-wireframe";this.variant&&(e+=`---${this.variant}`),this.subscriptions.push(this.wireframeService.getWireframe$(e).subscribe(t=>{if(t){let r=document.createElement(t.tagName);r.innerHTML=t.innerHTML,this.template=r,this.getChildTemplate()}}))}this.getChildTemplate()}catch(e){this.catchError("Error in CommentDialogStatusComponent OnInit: ",e)}}ngOnDestroy(){try{super.ngOnDestroy(),this.subscriptions.forEach(e=>{e.unsubscribe()})}catch{}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("role","region"),e.setAttribute("aria-label","Thread status controls"),e.setAttribute("data-testid",this.componentId+"-container"),this.componentConfigSignal()?.disabled&&e.setAttribute("aria-disabled","true"),e.setAttribute("aria-live","polite")}catch(e){this.loggingService.catch("Error in CommentDialogStatusComponent setupA11yAttributes:",e)}}getChildTemplate(){if(!this.triggerTemplate&&this.template){let e=this.template.querySelector("velt-comment-dialog-status-dropdown-trigger-wireframe");Ke(e)||(this.triggerTemplate=e)}if(!this.contentTemplate&&this.template){let e=this.template.querySelector("velt-comment-dialog-status-dropdown-content-wireframe");Ke(e)||(this.triggerTemplate=e)}}catchError(e,t,r){try{this.loggingService.catch(e,t,T(I({},r||{}),{annotationId:this.componentConfigSignal()?.annotation?.annotationId}))}catch{}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(He),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-status"]],inputs:{variant:"variant"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[3,"darkMode","user","annotation","isUserAdmin","resolveStatusAccessAdminOnly","disabled","shadowDom","variant","triggerTemplate","contentTemplate","componentConfigSignal","changeStatus","click",4,"ngIf"],[3,"changeStatus","click","darkMode","user","annotation","isUserAdmin","resolveStatusAccessAdminOnly","disabled","shadowDom","variant","triggerTemplate","contentTemplate","componentConfigSignal"]],template:function(t,r){t&1&&g(0,$Ke,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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%]:empty{display:none}"],changeDetection:0});let i=o;return i})();var Zde=i=>({componentConfigSignal:i}),HKe=(i,o)=>({condition:i,data:o}),zKe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-suggestion-action-accept-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function GKe(i,o){if(i&1&&(_(0,"div",4),P(1,"translate"),ee(2),P(3,"translate"),b()),i&2){let n=l(3);x("data-testid",n.componentId+"-button")("aria-label",M(1,3,"Accept suggestion")),m(2),Ce(" ",M(3,5,"Accept")," ")}}function WKe(i,o){if(i&1){let n=q();f(0),_(1,"div",2),z("click",function(t){N(n);let r=l().ngIf;return r==null||r.acceptCommentPinAnnotation(),F(t.stopPropagation())}),g(2,GKe,4,7,"div",3),b(),v()}if(i&2){let n=l().ngIf,e=l();m(),x("data-testid",e.componentId),m(),c("veltDynamicTemplate",$(4,zKe,e.template,A(2,Zde,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function qKe(i,o){if(i&1&&(f(0),g(1,WKe,3,10,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,HKe,n.conditionSignal(),A(1,Zde,n.componentConfigSignal)))}}var H2=(()=>{let o=class o extends H{constructor(e,t,r){super(e,t,r),this.elementRef=e,this.dynamicDataService=t,this.loggingService=r,this.componentId="velt-comment-dialog-suggestion-action-accept",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogSuggestionActionAcceptComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogSuggestionActionAcceptComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogSuggestionActionAcceptComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(S),h(y))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-suggestion-action-accept"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["role","presentation",3,"click"],["class","velt-flat-button velt-accept-button","role","button","tabindex","0",4,"veltDynamicTemplate"],["role","button","tabindex","0",1,"velt-flat-button","velt-accept-button"]],template:function(t,r){t&1&&g(0,qKe,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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%]:empty{display:none}.velt-flat-button[_ngcontent-%COMP%]{width:100px;text-align:center}.velt-flat-button.velt-accept-button[_ngcontent-%COMP%]{background:transparent;color:var(--velt-success);text-decoration:underline}"],changeDetection:0});let i=o;return i})();var Xde=i=>({componentConfigSignal:i}),YKe=(i,o)=>({condition:i,data:o}),KKe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-suggestion-action-reject-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function ZKe(i,o){if(i&1&&(_(0,"div",4),P(1,"translate"),ee(2),P(3,"translate"),b()),i&2){let n=l(3);x("data-testid",n.componentId+"-button")("aria-label",M(1,3,"Reject suggestion")),m(2),Ce(" ",M(3,5,"Reject")," ")}}function XKe(i,o){if(i&1){let n=q();f(0),_(1,"div",2),z("click",function(t){N(n);let r=l().ngIf;return r==null||r.rejectCommentPinAnnotation(),F(t.stopPropagation())}),g(2,ZKe,4,7,"div",3),b(),v()}if(i&2){let n=l().ngIf,e=l();m(),x("data-testid",e.componentId),m(),c("veltDynamicTemplate",$(4,KKe,e.template,A(2,Xde,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function QKe(i,o){if(i&1&&(f(0),g(1,XKe,3,10,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,YKe,n.conditionSignal(),A(1,Xde,n.componentConfigSignal)))}}var z2=(()=>{let o=class o extends H{constructor(e,t,r){super(e,t,r),this.elementRef=e,this.dynamicDataService=t,this.loggingService=r,this.componentId="velt-comment-dialog-suggestion-action-reject",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogSuggestionActionRejectComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogSuggestionActionRejectComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogSuggestionActionRejectComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(S),h(y))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-suggestion-action-reject"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["role","presentation",3,"click"],["class","velt-flat-button velt-reject-button","role","button","tabindex","0",4,"veltDynamicTemplate"],["role","button","tabindex","0",1,"velt-flat-button","velt-reject-button"]],template:function(t,r){t&1&&g(0,QKe,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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%]:empty{display:none}.velt-flat-button[_ngcontent-%COMP%]{width:100px;text-align:center}.velt-flat-button.velt-reject-button[_ngcontent-%COMP%]{background:transparent;color:var(--velt-error);text-decoration:underline}"],changeDetection:0});let i=o;return i})();var Qde=i=>({componentConfigSignal:i}),JKe=(i,o)=>({condition:i,data:o}),eZe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-suggestion-action-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function tZe(i,o){if(i&1&&(_(0,"div",3),P(1,"translate"),w(2,"app-comment-dialog-suggestion-action-accept",4)(3,"app-comment-dialog-suggestion-action-reject",4),b()),i&2){let n=l(4);x("data-testid",n.componentId)("aria-label",M(1,6,"Suggestion actions")),m(2),c("componentConfigSignal",n.componentConfigSignal),x("data-testid",n.componentId+"-accept"),m(),c("componentConfigSignal",n.componentConfigSignal),x("data-testid",n.componentId+"-reject")}}function nZe(i,o){if(i&1&&(f(0),g(1,tZe,4,8,"div",2),v()),i&2){let n=l(2).ngIf,e=l();m(),c("veltDynamicTemplate",$(3,eZe,e.template,A(1,Qde,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function iZe(i,o){if(i&1&&(f(0),g(1,nZe,2,9,"ng-container",0),v()),i&2){let n=l().ngIf;m(),c("ngIf",n==null?null:n.showSuggestionModeActions)}}function oZe(i,o){if(i&1&&(f(0),g(1,iZe,2,1,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(3,JKe,n.conditionSignal(),A(1,Qde,n.componentConfigSignal)))}}var Y0=(()=>{let o=class o extends H{constructor(e,t,r){super(e,t,r),this.elementRef=e,this.dynamicDataService=t,this.loggingService=r,this.componentId="velt-comment-dialog-suggestion-action",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogSuggestionActionComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogSuggestionActionComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogSuggestionActionComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(S),h(y))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-suggestion-action"]],standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["class","velt-suggestion-actions","role","toolbar",4,"veltDynamicTemplate"],["role","toolbar",1,"velt-suggestion-actions"],[3,"componentConfigSignal"]],template:function(t,r){t&1&&g(0,oZe,2,6,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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%]:empty{display:none}.velt-suggestion-actions[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;gap:var(--velt-spacing-lg);margin-bottom:var(--velt-spacing-lg)}.velt-suggestion-actions[_ngcontent-%COMP%]{margin-bottom:0}"],changeDetection:0});let i=o;return i})();var Jde=(i,o,n)=>({componentConfigSignal:i,commentObj:o,i:n}),aZe=(i,o)=>({condition:i,data:o}),sZe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-thread-card-avatar-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function lZe(i,o){if(i&1&&(f(0),w(1,"snippyly-user-avatar",3),P(2,"translate"),P(3,"translate"),v()),i&2){let n=l(4);m(),c("size",32)("user",n.commentObj==null?null:n.commentObj.from),x("data-testid",n.componentId)("aria-label",M(2,4,"Avatar for")+" "+M(3,6,(n.commentObj==null||n.commentObj.from==null?null:n.commentObj.from.name)||(n.commentObj==null||n.commentObj.from==null?null:n.commentObj.from.email)||"user"))}}function cZe(i,o){if(i&1&&(f(0),g(1,lZe,4,8,"ng-container",0),v()),i&2){let n=l(3);m(),c("ngIf",n.commentObj)}}function dZe(i,o){if(i&1&&(f(0),g(1,cZe,2,1,"ng-container",2),v()),i&2){let n=l().ngIf,e=l();m(),c("veltDynamicTemplate",$(5,sZe,e.template,$e(1,Jde,e.componentConfigSignal,e.commentObj,e.i),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function mZe(i,o){if(i&1&&(f(0),g(1,dZe,2,11,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(5,aZe,n.conditionSignal(),$e(1,Jde,n.componentConfigSignal,n.commentObj,n.i)))}}var G2=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-thread-card-avatar",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef.nativeElement,{componentConfigSignal:this.componentConfigSignal,commentObj:this.commentObj,i:this.i}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAvatarComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAvatarComponent 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 CommentDialogThreadCardAvatarComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-thread-card-avatar"]],inputs:{commentObj:"commentObj",i:"i"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[1,"comment-dialog-user-avatar",3,"size","user"]],template:function(t,r){t&1&&g(0,mZe,2,8,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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%]:empty{display:none}"],changeDetection:0});let i=o;return i})();var eme=(i,o,n)=>({componentConfigSignal:i,commentObj:o,i:n}),pZe=(i,o)=>({condition:i,data:o}),gZe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-thread-card-device-type-wireframe",variant:n,setIfCondition:e,componentElementRef:t}),uZe=i=>({$implicit:i}),hZe=()=>[];function fZe(i,o){i&1&&Ve(0)}function vZe(i,o){if(i&1&&(_(0,"div",7),g(1,fZe,1,0,"ng-container",8),b()),i&2){l();let n=ce(3),e=l(2).ngIf,t=l();x("data-testid",t.componentId),m(),c("ngTemplateOutlet",n)("ngTemplateOutletContext",A(3,uZe,e==null?null:e.deviceType))}}function CZe(i,o){if(i&1&&w(0,"app-device-type-icons",10),i&2){let n=l().$implicit,e=l(4);c("deviceType",n),x("data-testid",e.componentId+"-icons")}}function _Ze(i,o){if(i&1&&(_(0,"div",11)(1,"div"),ee(2),P(3,"translate"),b(),_(4,"div"),ee(5),P(6,"translate"),b()()),i&2){let n=l(4).ngIf,e=l();ue("dark",n==null?null:n.darkMode),x("data-testid",e.componentId+"-info"),m(2),D1("",M(3,7,n==null||n.annotation==null||n.annotation.pageInfo==null||n.annotation.pageInfo.deviceInfo==null?null:n.annotation.pageInfo.deviceInfo.osName)," \u2022 ",n==null||n.annotation==null||n.annotation.pageInfo==null||n.annotation.pageInfo.deviceInfo==null?null:n.annotation.pageInfo.deviceInfo.screenWidth,"x",n==null||n.annotation==null||n.annotation.pageInfo==null||n.annotation.pageInfo.deviceInfo==null?null:n.annotation.pageInfo.deviceInfo.screenHeight," "),m(3),Ce("Using ",M(6,9,n==null||n.annotation==null||n.annotation.pageInfo==null||n.annotation.pageInfo.deviceInfo==null?null:n.annotation.pageInfo.deviceInfo.browserName),"")}}function yZe(i,o){if(i&1&&(_(0,"app-overlay-tooltip",9),g(1,CZe,1,2,"ng-template",null,1,Ee)(3,_Ze,7,11,"ng-template",null,2,Ee),b()),i&2){let n=l(3).ngIf,e=l();c("positions",(n==null?null:n.deviceInfoTooltipPositions)||Ot(2,hZe)),x("data-testid",e.componentId+"-tooltip")}}function SZe(i,o){if(i&1&&(f(0),g(1,vZe,2,5,"div",6)(2,yZe,5,3,"ng-template",null,0,Ee),v()),i&2){let n=l(2).ngIf,e=l();m(),c("ngIf",!e.i&&(n==null?null:n.showScreenSizeInfo))}}function bZe(i,o){if(i&1&&(f(0),g(1,SZe,4,1,"ng-container",5),v()),i&2){let n=l().ngIf,e=l();m(),c("veltDynamicTemplate",$(5,gZe,e.template,$e(1,eme,e.componentConfigSignal,e.commentObj,e.i),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function IZe(i,o){if(i&1&&(f(0),g(1,bZe,2,11,"ng-container",4),v()),i&2){let n=l();m(),c("veltIf",k(5,pZe,n.conditionSignal(),$e(1,eme,n.componentConfigSignal,n.commentObj,n.i)))}}var W2=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.deviceInfoTooltipPositions=[{originX:"center",originY:"bottom",overlayX:"center",overlayY:"top"},{originX:"center",originY:"top",overlayX:"center",overlayY:"bottom"}],this.componentId="velt-device-type",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef.nativeElement,{componentConfigSignal:this.componentConfigSignal,commentObj:this.commentObj,i:this.i}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardDeviceTypeComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardDeviceTypeComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardDeviceTypeComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-thread-card-device-type"]],inputs:{i:"i",commentObj:"commentObj"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[["deviceTypeRef",""],["triggerTemplate",""],["tooltipTemplate",""],[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["class","modal-device__type",4,"ngIf"],[1,"modal-device__type"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],[3,"positions"],[3,"deviceType"],["role","tooltip",1,"v-device-info-tooltip-container"]],template:function(t,r){t&1&&g(0,IZe,2,8,"ng-container",3),t&2&&c("ngIf",r.componentConfigSignal())},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%]:empty{display:none}"],changeDetection:0});let i=o;return i})();var tme=(i,o,n,e)=>({componentConfigSignal:i,attachment:o,attachmentIndex:n,commentObj:e}),EZe=(i,o)=>({condition:i,data:o}),xZe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-thread-card-attachments-image-preview-wireframe",variant:n,setIfCondition:e,componentElementRef:t,replaceTemplate:!1});function TZe(i,o){if(i&1){let n=q();f(0),_(1,"snippyly-lightbox",4,0)(3,"img",5),P(4,"translate"),P(5,"translate"),z("click",function(){N(n);let t=ce(2);return F(t==null?null:t.openImageInFullScreen())}),b()(),v()}if(i&2){let n=l(3);m(),c("src",n.attachment==null?null:n.attachment.url),x("data-testid",n.componentId+"-lightbox"),m(2),c("src",n.attachment==null?null:n.attachment.url,mn)("alt",M(4,5,"Attachment")+" "+M(5,7,(n.attachment==null?null:n.attachment.name)||"preview")),x("data-testid",n.componentId+"-image")}}function DZe(i,o){if(i&1&&(f(0),g(1,TZe,6,9,"ng-container",3),v()),i&2){let n=l().ngIf,e=l();m(),c("veltDynamicTemplate",$(6,xZe,e.template,dt(1,tme,e.componentConfigSignal,e.attachment,e.attachmentIndex,e.commentObj),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function wZe(i,o){if(i&1&&(f(0),g(1,DZe,2,12,"ng-container",2),v()),i&2){let n=l();m(),c("veltIf",k(6,EZe,n.conditionSignal(),dt(1,tme,n.componentConfigSignal,n.attachment,n.attachmentIndex,n.commentObj)))}}var q2=(()=>{let o=class o extends H{constructor(e,t,r){super(e,t,r),this.elementRef=e,this.dynamicDataService=t,this.loggingService=r,this.componentId="velt-attachment-preview",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef.nativeElement,{componentConfigSignal:this.componentConfigSignal,attachmentIndex:this.attachmentIndex,attachment:this.attachment,commentObj:this.commentObj}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsImagePreviewComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsImagePreviewComponent 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 CommentDialogThreadCardAttachmentsImagePreviewComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(S),h(y))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-thread-card-attachments-image-preview"]],inputs:{commentObj:"commentObj",attachment:"attachment",attachmentIndex:"attachmentIndex"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[["lightboxRef",""],[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[3,"src"],["velt-ignore-change-detection","true",3,"click","src","alt"]],template:function(t,r){t&1&&g(0,wZe,2,9,"ng-container",1),t&2&&c("ngIf",r.componentConfigSignal())},styles:["img[_ngcontent-%COMP%]{width:100%;object-fit:cover}"],changeDetection:0});let i=o;return i})();var nme=(i,o,n,e)=>({componentConfigSignal:i,commentObj:o,attachmentIndex:n,attachment:e}),OZe=(i,o)=>({condition:i,data:o}),AZe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-thread-card-attachments-image-delete-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function PZe(i,o){if(i&1&&(f(0),_(1,"div",5),le(),_(2,"svg",6),w(3,"path",7)(4,"path",8),b()(),v()),i&2){let n=l(4);m(2),x("data-testid",n.componentId+"-icon")}}function MZe(i,o){if(i&1){let n=q();_(0,"div",3),P(1,"translate"),P(2,"translate"),z("click",function(t){N(n);let r=l(2).ngIf,a=l();return r==null||r.removeAttachment(a.attachmentIndex,a.commentObj),F(t.stopPropagation())}),g(3,PZe,5,1,"ng-container",4),b()}if(i&2){let n=l(2).ngIf,e=l();c("title",M(1,4,"Delete Attachment")),x("aria-label",M(2,6,"Delete Attachment"))("data-testid",e.componentId),m(3),c("veltDynamicTemplate",$(13,AZe,e.template,dt(8,nme,e.componentConfigSignal,e.commentObj,e.attachmentIndex,e.attachment),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function kZe(i,o){if(i&1&&(f(0),g(1,MZe,4,19,"div",2),v()),i&2){let n=l().ngIf,e=l();m(),c("ngIf",!(n!=null&&n.disabled)&&(e.commentObj==null||e.commentObj.from==null?null:e.commentObj.from.userId)===(n==null||n.user==null?null:n.user.userId)&&!(n!=null&&n.isPlanExpired))}}function RZe(i,o){if(i&1&&(f(0),g(1,kZe,2,1,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(6,OZe,n.conditionSignal(),dt(1,nme,n.componentConfigSignal,n.commentObj,n.attachmentIndex,n.attachment)))}}var Y2=(()=>{let o=class o extends H{constructor(e,t,r){super(e,t,r),this.elementRef=e,this.dynamicDataService=t,this.loggingService=r,this.componentId="velt-attachment-delete",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef.nativeElement,{componentConfigSignal:this.componentConfigSignal,attachmentIndex:this.attachmentIndex,attachment:this.attachment,commentObj:this.commentObj}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsImageDeleteComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsImageDeleteComponent 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 CommentDialogThreadCardAttachmentsImageDeleteComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(S),h(y))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-thread-card-attachments-image-delete"]],inputs:{commentObj:"commentObj",attachment:"attachment",attachmentIndex:"attachmentIndex"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["type","button",3,"title","click",4,"ngIf"],["type","button",3,"click","title"],[4,"veltDynamicTemplate"],[1,"icon-button","velt-comment-attachment--image-action-btn"],["xmlns","http://www.w3.org/2000/svg","height","24px","viewBox","0 0 24 24","width","24px","fill","currentColor","aria-hidden","true","focusable","false"],["d","M0 0h24v24H0V0z","fill","none"],["d","M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"]],template:function(t,r){t&1&&g(0,RZe,2,9,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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-comment-attachment--image-action-btn[_ngcontent-%COMP%]{background:var(--velt-white);display:flex;align-items:center;border-radius:var(--velt-border-radius-3xl);width:40px;height:40px;justify-content:center;opacity:1;margin:var(--velt-spacing-xs);border:0;cursor:pointer;color:var(--velt-black)}"],changeDetection:0});let i=o;return i})();var ime=(i,o,n,e)=>({componentConfigSignal:i,commentObj:o,attachmentIndex:n,attachment:e}),NZe=(i,o)=>({condition:i,data:o}),FZe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-thread-card-attachments-image-download-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function LZe(i,o){if(i&1&&(f(0),_(1,"div",5),le(),_(2,"svg",6)(3,"g"),w(4,"rect",7),b(),_(5,"g"),w(6,"path",8),b()()(),v()),i&2){let n=l(4);m(2),x("data-testid",n.componentId+"-icon")}}function BZe(i,o){if(i&1){let n=q();_(0,"div",3),P(1,"translate"),P(2,"translate"),z("click",function(t){N(n);let r=l(2).ngIf,a=l();return r==null||r.downloadAttachment(a.attachment),F(t.stopPropagation())}),g(3,LZe,7,1,"ng-container",4),b()}if(i&2){let n=l(2).ngIf,e=l();c("title",M(1,4,"Download Attachment")),x("aria-label",M(2,6,"Download Attachment"))("data-testid",e.componentId),m(3),c("veltDynamicTemplate",$(13,FZe,e.template,dt(8,ime,e.componentConfigSignal,e.commentObj,e.attachmentIndex,e.attachment),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function VZe(i,o){if(i&1&&(f(0),g(1,BZe,4,19,"div",2),v()),i&2){let n=l().ngIf;m(),c("ngIf",!(n!=null&&n.disabled)&&(n==null||n.user==null?null:n.user.userId)&&!(!(n==null||n.user==null)&&n.user.isAnonymous)&&!(n!=null&&n.isPlanExpired))}}function UZe(i,o){if(i&1&&(f(0),g(1,VZe,2,1,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(6,NZe,n.conditionSignal(),dt(1,ime,n.componentConfigSignal,n.commentObj,n.attachmentIndex,n.attachment)))}}var K2=(()=>{let o=class o extends H{constructor(e,t,r){super(e,t,r),this.elementRef=e,this.dynamicDataService=t,this.loggingService=r,this.componentId="velt-attachment-download",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef.nativeElement,{componentConfigSignal:this.componentConfigSignal,attachmentIndex:this.attachmentIndex,attachment:this.attachment,commentObj:this.commentObj}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsImageDownloadComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsImageDownloadComponent 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 CommentDialogThreadCardAttachmentsImageDownloadComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(S),h(y))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-thread-card-attachments-image-download"]],inputs:{commentObj:"commentObj",attachment:"attachment",attachmentIndex:"attachmentIndex"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["type","button",3,"title","click",4,"ngIf"],["type","button",3,"click","title"],[4,"veltDynamicTemplate"],[1,"icon-button","velt-comment-attachment--image-action-btn"],["xmlns","http://www.w3.org/2000/svg","enable-background","new 0 0 24 24","height","24px","viewBox","0 0 24 24","width","24px","fill","currentColor","aria-hidden","true","focusable","false"],["fill","none","height","24","width","24"],["d","M18,15v3H6v-3H4v3c0,1.1,0.9,2,2,2h12c1.1,0,2-0.9,2-2v-3H18z M17,11l-1.41-1.41L13,12.17V4h-2v8.17L8.41,9.59L7,11l5,5 L17,11z"]],template:function(t,r){t&1&&g(0,UZe,2,9,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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-comment-attachment--image-action-btn[_ngcontent-%COMP%]{background:var(--velt-white);display:flex;align-items:center;border-radius:var(--velt-border-radius-3xl);width:40px;height:40px;justify-content:center;opacity:1;margin:var(--velt-spacing-xs);border:0;cursor:pointer;color:var(--velt-black)}"],changeDetection:0});let i=o;return i})();var ome=(i,o,n,e)=>({componentConfigSignal:i,attachmentIndex:o,attachment:n,commentObj:e}),jZe=(i,o)=>({condition:i,data:o}),$Ze=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-thread-card-attachments-image-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function HZe(i,o){if(i&1&&(_(0,"div",8),P(1,"translate"),w(2,"app-comment-dialog-thread-card-attachments-image-download",7)(3,"app-comment-dialog-thread-card-attachments-image-delete",7),b()),i&2){let n=l(5);x("data-testid",n.componentId+"-actions")("aria-label",M(1,10,"Image attachment actions")),m(2),c("componentConfigSignal",n.componentConfigSignal)("attachmentIndex",n.attachmentIndex)("commentObj",n.commentObj)("attachment",n.attachment),m(),c("componentConfigSignal",n.componentConfigSignal)("attachmentIndex",n.attachmentIndex)("commentObj",n.commentObj)("attachment",n.attachment)}}function zZe(i,o){if(i&1&&(f(0),_(1,"div",5),P(2,"translate"),g(3,HZe,4,12,"div",6),w(4,"app-comment-dialog-thread-card-attachments-image-preview",7),b(),v()),i&2){let n=l(3).ngIf,e=l();m(),x("aria-label",M(2,7,"Image attachment controls"))("data-testid",e.componentId),m(2),c("ngIf",!(n!=null&&n.readOnly)),m(),c("componentConfigSignal",e.componentConfigSignal)("attachmentIndex",e.attachmentIndex)("commentObj",e.commentObj)("attachment",e.attachment)}}function GZe(i,o){if(i&1&&(f(0),g(1,zZe,5,9,"ng-container",4),v()),i&2){l(2);let n=ce(3),e=l();m(),c("ngIf",!e.showLoadingTemplate)("ngIfElse",n)}}function WZe(i,o){if(i&1&&(f(0),g(1,GZe,2,2,"ng-container",3),v()),i&2){let n=l().ngIf,e=l();m(),c("veltDynamicTemplate",$(6,$Ze,e.template,dt(1,ome,e.componentConfigSignal,e.attachmentIndex,e.attachment,e.commentObj),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function qZe(i,o){i&1&&w(0,"velt-skeleton-loader-internal",9)}function YZe(i,o){if(i&1&&(f(0),g(1,WZe,2,12,"ng-container",2)(2,qZe,1,0,"ng-template",null,0,Ee),v()),i&2){let n=l();m(),c("veltIf",k(6,jZe,n.conditionSignal(),dt(1,ome,n.componentConfigSignal,n.attachmentIndex,n.attachment,n.commentObj)))}}var Z2=(()=>{let o=class o extends H{get attachment(){return this._attachment}set attachment(e){try{this._attachment=e,this.setShowLoadingTemplate()}catch{}}get imageWireframe(){return this._imageWireframe}set imageWireframe(e){this._imageWireframe=e,this.imageWireframe?this.template=this.domService.deepCloneElement(this.imageWireframe):this.template=null}constructor(e,t,r,a){super(t,a,r),this.domService=e,this.elementRef=t,this.loggingService=r,this.dynamicDataService=a,this.showLoadingTemplate=!1,this.componentId="velt-comment-attachment-image",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef.nativeElement,{componentConfigSignal:this.componentConfigSignal,attachmentIndex:this.attachmentIndex,attachment:this.attachment,commentObj:this.commentObj}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsImageComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsImageComponent ngOnDestroy:",e)}}setShowLoadingTemplate(){try{this.attachment?.isAttachmentResolverUsed&&!this.attachment?.url?this.showLoadingTemplate=!0:this.showLoadingTemplate=!1}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsImageComponent setShowLoadingTemplate: ",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 CommentDialogThreadCardAttachmentsImageComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(Fe),h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-thread-card-attachments-image"]],inputs:{commentObj:"commentObj",attachment:"attachment",attachmentIndex:"attachmentIndex",imageWireframe:"imageWireframe"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[["loadingTemplateRef",""],[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[4,"ngIf","ngIfElse"],["velt-ignore-change-detection","true","role","group",1,"comment-attachment","velt-comment-attachment--image"],["class","comment-attachment-actions velt-comment-attachment--image-actions","role","group",4,"ngIf"],[3,"componentConfigSignal","attachmentIndex","commentObj","attachment"],["role","group",1,"comment-attachment-actions","velt-comment-attachment--image-actions"],["height","20px","width","200px","borderRadius","20px",1,"velt-thread-card--message"]],template:function(t,r){t&1&&g(0,YZe,4,9,"ng-container",1),t&2&&c("ngIf",r.componentConfigSignal())},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-comment-attachment--image[_ngcontent-%COMP%]{border-radius:var(--velt-border-radius-sm);overflow:hidden;line-height:0;position:relative;max-width:400px}.velt-comment-attachment--image[_ngcontent-%COMP%] .velt-comment-attachment--image-actions[_ngcontent-%COMP%]{position:absolute;bottom:8px;right:8px;display:flex;opacity:0}.velt-comment-attachment--image[_ngcontent-%COMP%]:hover .velt-comment-attachment--image-actions[_ngcontent-%COMP%]{opacity:1}.velt-comment-attachment--image[_ngcontent-%COMP%]:not(:last-child){margin-bottom:var(--velt-spacing-lg)}"],changeDetection:0});let i=o;return i})();var KZe=(i,o,n,e)=>({componentConfigSignal:i,commentObj:o,attachmentIndex:n,attachment:e}),ZZe=(i,o)=>({condition:i,data:o}),XZe=i=>({componentConfigSignal:i}),QZe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-thread-card-attachments-other-delete-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function JZe(i,o){if(i&1&&(f(0),_(1,"div",5),le(),_(2,"svg",6),w(3,"path",7),b()(),v()),i&2){let n=l(4);m(),x("data-testid",n.componentId+"-icon")}}function eXe(i,o){if(i&1){let n=q();_(0,"button",3),P(1,"translate"),z("click",function(t){N(n);let r=l(2).ngIf,a=l();return r==null||r.removeAttachment(a.attachmentIndex,a.commentObj),F(t.stopPropagation())}),g(2,JZe,4,1,"ng-container",4),b()}if(i&2){let n=l(2).ngIf,e=l();x("aria-label",M(1,3,"Delete attachment"))("data-testid",e.componentId),m(2),c("veltDynamicTemplate",$(7,QZe,e.template,A(5,XZe,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function tXe(i,o){if(i&1&&(f(0),g(1,eXe,3,13,"button",2),v()),i&2){let n=l().ngIf,e=l();m(),c("ngIf",!(n!=null&&n.disabled)&&(e.commentObj==null||e.commentObj.from==null?null:e.commentObj.from.userId)===(n==null||n.user==null?null:n.user.userId)&&!(n!=null&&n.isPlanExpired))}}function nXe(i,o){if(i&1&&(f(0),g(1,tXe,2,1,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(6,ZZe,n.conditionSignal(),dt(1,KZe,n.componentConfigSignal,n.commentObj,n.attachmentIndex,n.attachment)))}}var X2=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-attachment-other-delete",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef.nativeElement,{componentConfigSignal:this.componentConfigSignal,attachmentIndex:this.attachmentIndex,attachment:this.attachment,commentObj:this.commentObj}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsOtherDeleteComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsOtherDeleteComponent 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 CommentDialogThreadCardAttachmentsOtherDeleteComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-thread-card-attachments-other-delete"]],inputs:{commentObj:"commentObj",attachment:"attachment",attachmentIndex:"attachmentIndex"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["type","button",3,"click",4,"ngIf"],["type","button",3,"click"],[4,"veltDynamicTemplate"],[1,"attachment-icon-btn","velt-comment-attachment--action-btn"],["width","18","height","19","viewBox","0 0 18 19","fill","none","xmlns","http://www.w3.org/2000/svg","aria-hidden","true","focusable","false"],["d","M3 5.75H15M7.5 8.75V13.25M10.5 8.75V13.25M3.75 5.75L4.5 14.75C4.5 15.1478 4.65804 15.5294 4.93934 15.8107C5.22064 16.092 5.60218 16.25 6 16.25H12C12.3978 16.25 12.7794 16.092 13.0607 15.8107C13.342 15.5294 13.5 15.1478 13.5 14.75L14.25 5.75M6.75 5.75V3.5C6.75 3.30109 6.82902 3.11032 6.96967 2.96967C7.11032 2.82902 7.30109 2.75 7.5 2.75H10.5C10.6989 2.75 10.8897 2.82902 11.0303 2.96967C11.171 3.11032 11.25 3.30109 11.25 3.5V5.75","stroke","currentColor","stroke-width","1.5","stroke-linecap","round","stroke-linejoin","round"]],template:function(t,r){t&1&&g(0,nXe,2,9,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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;align-items:center}button[_ngcontent-%COMP%]{background:transparent;border:0;display:flex;margin:0;padding:0}.velt-comment-attachment--action-btn[_ngcontent-%COMP%]{display:flex;padding:var(--velt-spacing-sm);cursor:pointer;align-items:center;color:var(--velt-error)}"],changeDetection:0});let i=o;return i})();var iXe=(i,o,n,e)=>({componentConfigSignal:i,commentObj:o,attachmentIndex:n,attachment:e}),oXe=(i,o)=>({condition:i,data:o}),rXe=i=>({componentConfigSignal:i}),aXe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-thread-card-attachments-other-download-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function sXe(i,o){if(i&1&&(f(0),_(1,"div",4),le(),_(2,"svg",5),w(3,"path",6),b()(),v()),i&2){let n=l(3);m(),x("data-testid",n.componentId+"-icon")}}function lXe(i,o){if(i&1){let n=q();f(0),_(1,"button",2),P(2,"translate"),P(3,"translate"),z("click",function(t){N(n);let r=l().ngIf,a=l();return r==null||r.downloadAttachment(a.attachment),F(t.stopPropagation())}),g(4,sXe,4,1,"ng-container",3),b(),v()}if(i&2){let n=l().ngIf,e=l();m(),x("title",M(2,4,"Download attachment"))("aria-label",M(3,6,"Download attachment"))("data-testid",e.componentId),m(3),c("veltDynamicTemplate",$(10,aXe,e.template,A(8,rXe,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function cXe(i,o){if(i&1&&(f(0),g(1,lXe,5,16,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(6,oXe,n.conditionSignal(),dt(1,iXe,n.componentConfigSignal,n.commentObj,n.attachmentIndex,n.attachment)))}}var Q2=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-attachment-other-download",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef.nativeElement,{componentConfigSignal:this.componentConfigSignal,attachmentIndex:this.attachmentIndex,attachment:this.attachment,commentObj:this.commentObj}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsOtherDownloadComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsOtherDownloadComponent 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 CommentDialogThreadCardAttachmentsOtherDownloadComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-thread-card-attachments-other-download"]],inputs:{commentObj:"commentObj",attachment:"attachment",attachmentIndex:"attachmentIndex"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],["type","button",3,"click"],[4,"veltDynamicTemplate"],[1,"attachment-icon-btn","velt-comment-attachment--action-btn"],["width","18","height","19","viewBox","0 0 18 19","fill","none","xmlns","http://www.w3.org/2000/svg","aria-hidden","true","focusable","false"],["d","M3 13.25V14.75C3 15.1478 3.15804 15.5294 3.43934 15.8107C3.72064 16.092 4.10218 16.25 4.5 16.25H13.5C13.8978 16.25 14.2794 16.092 14.5607 15.8107C14.842 15.5294 15 15.1478 15 14.75V13.25M5.25 8.75L9 12.5M9 12.5L12.75 8.75M9 12.5V3.5","stroke","currentColor","stroke-width","1.5","stroke-linecap","round","stroke-linejoin","round"]],template:function(t,r){t&1&&g(0,cXe,2,9,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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;align-items:center}button[_ngcontent-%COMP%]{background:transparent;border:0;display:flex;margin:0;padding:0}.velt-comment-attachment--action-btn[_ngcontent-%COMP%]{display:flex;padding:var(--velt-spacing-sm);cursor:pointer;align-items:center;color:var(--velt-accent)}"],changeDetection:0});let i=o;return i})();var rme=(i,o,n,e)=>({componentConfigSignal:i,attachment:o,attachmentIndex:n,commentObj:e}),dXe=(i,o)=>({condition:i,data:o}),mXe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-thread-card-attachments-other-icon-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function pXe(i,o){if(i&1&&(f(0),w(1,"velt-file-icon-internal",3),v()),i&2){let n=l(3);m(),c("type",n.attachment==null?null:n.attachment.mimeType),x("data-testid",n.componentId)}}function gXe(i,o){if(i&1&&(f(0),g(1,pXe,2,2,"ng-container",2),v()),i&2){let n=l().ngIf,e=l();m(),c("veltDynamicTemplate",$(6,mXe,e.template,dt(1,rme,e.componentConfigSignal,e.attachment,e.attachmentIndex,e.commentObj),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function uXe(i,o){if(i&1&&(f(0),g(1,gXe,2,12,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(6,dXe,n.conditionSignal(),dt(1,rme,n.componentConfigSignal,n.attachment,n.attachmentIndex,n.commentObj)))}}var J2=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-attachment-other-icon",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef.nativeElement,{componentConfigSignal:this.componentConfigSignal,attachmentIndex:this.attachmentIndex,attachment:this.attachment,commentObj:this.commentObj}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsOtherIconComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsOtherIconComponent 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 CommentDialogThreadCardAttachmentsOtherIconComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-thread-card-attachments-other-icon"]],inputs:{commentObj:"commentObj",attachment:"attachment",attachmentIndex:"attachmentIndex"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[3,"type"]],template:function(t,r){t&1&&g(0,uXe,2,9,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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;color:var(--velt-accent)}[_nghost-%COMP%]:empty{display:none}"],changeDetection:0});let i=o;return i})();var ame=(i,o,n,e)=>({componentConfigSignal:i,attachment:o,attachmentIndex:n,commentObj:e}),hXe=(i,o)=>({condition:i,data:o}),fXe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-thread-card-attachments-other-name-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function vXe(i,o){if(i&1&&(f(0),_(1,"span",3),P(2,"translate"),ee(3),P(4,"translate"),b(),v()),i&2){let n=l(3);m(),x("data-testid",n.componentId)("aria-label","File name: "+M(2,3,(n.attachment==null?null:n.attachment.name)||"")),m(2),ze(M(4,5,n.attachment==null?null:n.attachment.name))}}function CXe(i,o){if(i&1&&(f(0),g(1,vXe,5,7,"ng-container",2),v()),i&2){let n=l().ngIf,e=l();m(),c("veltDynamicTemplate",$(6,fXe,e.template,dt(1,ame,e.componentConfigSignal,e.attachment,e.attachmentIndex,e.commentObj),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function _Xe(i,o){if(i&1&&(f(0),g(1,CXe,2,12,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(6,hXe,n.conditionSignal(),dt(1,ame,n.componentConfigSignal,n.attachment,n.attachmentIndex,n.commentObj)))}}var eI=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-attachment-other-name",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef.nativeElement,{componentConfigSignal:this.componentConfigSignal,attachmentIndex:this.attachmentIndex,attachment:this.attachment,commentObj:this.commentObj}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsOtherNameComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsOtherNameComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsOtherNameComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-thread-card-attachments-other-name"]],inputs:{commentObj:"commentObj",attachment:"attachment",attachmentIndex:"attachmentIndex"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[1,"attachment-name","velt-comment-attachment--name"]],template:function(t,r){t&1&&g(0,_Xe,2,9,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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%]{line-height:normal}.velt-comment-attachment--name[_ngcontent-%COMP%]{overflow:hidden;color:var(--velt-text-3);text-overflow:ellipsis;font-size:var(--velt-font-size-xs);font-style:normal;font-weight:600;line-height:normal;white-space:nowrap}"],changeDetection:0});let i=o;return i})();var sme=(i,o,n,e)=>({componentConfigSignal:i,attachment:o,attachmentIndex:n,commentObj:e}),yXe=(i,o)=>({condition:i,data:o}),SXe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-thread-card-attachments-other-size-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function bXe(i,o){if(i&1&&(f(0),_(1,"span",3),P(2,"translate"),P(3,"fileSize"),ee(4),P(5,"fileSize"),b(),v()),i&2){let n=l(3);m(),x("data-testid",n.componentId)("aria-label",M(2,3,"File size:")+" "+M(3,5,n.attachment==null?null:n.attachment.size)),m(3),ze(M(5,7,n.attachment==null?null:n.attachment.size))}}function IXe(i,o){if(i&1&&(f(0),g(1,bXe,6,9,"ng-container",2),v()),i&2){let n=l().ngIf,e=l();m(),c("veltDynamicTemplate",$(6,SXe,e.template,dt(1,sme,e.componentConfigSignal,e.attachment,e.attachmentIndex,e.commentObj),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function EXe(i,o){if(i&1&&(f(0),g(1,IXe,2,12,"ng-container",1),v()),i&2){let n=l();m(),c("veltIf",k(6,yXe,n.conditionSignal(),dt(1,sme,n.componentConfigSignal,n.attachment,n.attachmentIndex,n.commentObj)))}}var tI=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-attachment-other-size",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef.nativeElement,{componentConfigSignal:this.componentConfigSignal,attachmentIndex:this.attachmentIndex,attachment:this.attachment,commentObj:this.commentObj}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsOtherSizeComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsOtherSizeComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsOtherSizeComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-thread-card-attachments-other-size"]],inputs:{commentObj:"commentObj",attachment:"attachment",attachmentIndex:"attachmentIndex"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[1,"attachment-size","velt-comment-attachment--size"]],template:function(t,r){t&1&&g(0,EXe,2,9,"ng-container",0),t&2&&c("ngIf",r.componentConfigSignal())},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%]{line-height:normal}.velt-comment-attachment--size[_ngcontent-%COMP%]{overflow:hidden;color:var(--velt-text-7);text-overflow:ellipsis;font-size:var(--velt-font-size-2xs);font-style:normal;font-weight:500;line-height:normal}"],changeDetection:0});let i=o;return i})();var lme=(i,o,n,e)=>({componentConfigSignal:i,attachmentIndex:o,commentObj:n,attachment:e}),xXe=(i,o)=>({condition:i,data:o}),TXe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-thread-card-attachments-other-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function DXe(i,o){if(i&1&&(_(0,"div",10),w(1,"app-comment-dialog-thread-card-attachments-other-download",7)(2,"app-comment-dialog-thread-card-attachments-other-delete",7),b()),i&2){let n=l(5);x("data-testid",n.componentId+"-actions")("aria-label","Attachment actions"),m(),c("componentConfigSignal",n.componentConfigSignal)("attachmentIndex",n.attachmentIndex)("commentObj",n.commentObj)("attachment",n.attachment),m(),c("componentConfigSignal",n.componentConfigSignal)("attachmentIndex",n.attachmentIndex)("commentObj",n.commentObj)("attachment",n.attachment)}}function wXe(i,o){if(i&1&&(f(0),_(1,"div",5),P(2,"translate"),_(3,"div",6),w(4,"app-comment-dialog-thread-card-attachments-other-icon",7),b(),_(5,"div",8),w(6,"app-comment-dialog-thread-card-attachments-other-name",7)(7,"app-comment-dialog-thread-card-attachments-other-size",7),b(),g(8,DXe,3,10,"div",9),b(),v()),i&2){let n=l(3).ngIf,e=l();m(),x("data-testid",e.componentId)("aria-label","Attachment: "+M(2,18,(e.attachment==null?null:e.attachment.name)||"")),m(2),x("data-testid",e.componentId+"-icon"),m(),c("componentConfigSignal",e.componentConfigSignal)("attachmentIndex",e.attachmentIndex)("commentObj",e.commentObj)("attachment",e.attachment),m(),x("data-testid",e.componentId+"-details")("aria-label","Attachment details"),m(),c("componentConfigSignal",e.componentConfigSignal)("attachmentIndex",e.attachmentIndex)("commentObj",e.commentObj)("attachment",e.attachment),m(),c("componentConfigSignal",e.componentConfigSignal)("attachmentIndex",e.attachmentIndex)("commentObj",e.commentObj)("attachment",e.attachment),m(),c("ngIf",!(n!=null&&n.readOnly))}}function OXe(i,o){if(i&1&&(f(0),g(1,wXe,9,20,"ng-container",4),v()),i&2){l(2);let n=ce(3),e=l();m(),c("ngIf",!e.showLoadingTemplate)("ngIfElse",n)}}function AXe(i,o){if(i&1&&(f(0),g(1,OXe,2,2,"ng-container",3),v()),i&2){let n=l().ngIf,e=l();m(),c("veltDynamicTemplate",$(6,TXe,e.template,dt(1,lme,e.componentConfigSignal,e.attachmentIndex,e.commentObj,e.attachment),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function PXe(i,o){i&1&&w(0,"velt-skeleton-loader-internal",11)}function MXe(i,o){if(i&1&&(f(0),g(1,AXe,2,12,"ng-container",2)(2,PXe,1,0,"ng-template",null,0,Ee),v()),i&2){let n=l();m(),c("veltIf",k(6,xXe,n.conditionSignal(),dt(1,lme,n.componentConfigSignal,n.attachmentIndex,n.commentObj,n.attachment)))}}var nI=(()=>{let o=class o extends H{get attachment(){return this._attachment}set attachment(e){try{this._attachment=e,this.setShowLoadingTemplate()}catch{}}get otherWireframe(){return this._otherWireframe}set otherWireframe(e){this._otherWireframe=e,this.otherWireframe?this.template=this.domService.deepCloneElement(this.otherWireframe):this.template=null}constructor(e,t,r,a){super(t,a,r),this.domService=e,this.elementRef=t,this.loggingService=r,this.dynamicDataService=a,this.showLoadingTemplate=!1,this.componentId="velt-attachment-other",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef.nativeElement,{componentConfigSignal:this.componentConfigSignal,attachmentIndex:this.attachmentIndex,attachment:this.attachment,commentObj:this.commentObj}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsOtherComponent ngOnInit:",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsOtherComponent ngOnDestroy:",e)}}setShowLoadingTemplate(){try{this.attachment?.isAttachmentResolverUsed&&!this.attachment?.url?this.showLoadingTemplate=!0:this.showLoadingTemplate=!1}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsOtherComponent setShowLoadingTemplate: ",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("role","article"),e.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsOtherComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(Fe),h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-thread-card-attachments-other"]],inputs:{commentObj:"commentObj",attachment:"attachment",attachmentIndex:"attachmentIndex",otherWireframe:"otherWireframe"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[["loadingTemplateRef",""],[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[4,"ngIf","ngIfElse"],["role","article",1,"comment-pdf-attachment","velt-comment-attachment"],["role","presentation",1,"attachment-icon","velt-comment-attachment--icon"],[3,"componentConfigSignal","attachmentIndex","commentObj","attachment"],["role","group",1,"attachment-details","velt-comment-attachment--details"],["class","attachment-actions velt-comment-attachment--actions","role","group",4,"ngIf"],["role","group",1,"attachment-actions","velt-comment-attachment--actions"],["height","20px","width","200px","borderRadius","20px",1,"velt-thread-card--message"]],template:function(t,r){t&1&&g(0,MXe,4,9,"ng-container",1),t&2&&c("ngIf",r.componentConfigSignal())},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-comment-attachment[_ngcontent-%COMP%]{display:flex;padding:var(--velt-spacing-sm) var(--velt-spacing-xs) var(--velt-spacing-sm) var(--velt-spacing-md);justify-content:space-between;gap:var(--velt-spacing-sm);align-items:center;align-self:stretch;width:100%;border-radius:var(--velt-border-radius-sm);border:1px solid var(--velt-border-4);box-sizing:border-box}.velt-comment-attachment[_ngcontent-%COMP%] .velt-comment-attachment--icon[_ngcontent-%COMP%]{display:flex}.velt-comment-attachment[_ngcontent-%COMP%] .velt-comment-attachment--details[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:var(--velt-spacing-xs);flex:1;overflow:hidden}.velt-comment-attachment[_ngcontent-%COMP%] .velt-comment-attachment--actions[_ngcontent-%COMP%]{display:flex;width:0;overflow:hidden}.velt-comment-attachment[_ngcontent-%COMP%]:not(:last-child){margin-bottom:var(--velt-spacing-lg)}.velt-comment-attachment[_ngcontent-%COMP%]:hover .velt-comment-attachment--actions[_ngcontent-%COMP%]{width:auto}"],changeDetection:0});let i=o;return i})();var cme=(i,o,n)=>({componentConfigSignal:i,commentObj:o,i:n}),kXe=(i,o)=>({condition:i,data:o}),RXe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-thread-card-attachments-wireframe",variant:n,setIfCondition:e,componentElementRef:t,replaceTemplate:!1});function NXe(i,o){i&1&&Ve(0)}function FXe(i,o){if(i&1&&(f(0),g(1,NXe,1,0,"ng-container",9),v()),i&2){l();let n=ce(5);m(),c("ngTemplateOutlet",n)}}function LXe(i,o){if(i&1&&w(0,"app-comment-dialog-thread-card-attachments-other",10),i&2){let n=l(),e=n.$implicit,t=n.index,r=l(6);c("componentConfigSignal",r.componentConfigSignal)("attachment",e)("commentObj",r.commentObj)("attachmentIndex",t)("otherWireframe",r.otherWireframe)}}function BXe(i,o){if(i&1&&w(0,"app-comment-dialog-thread-card-attachments-image",11),i&2){let n=l(),e=n.$implicit,t=n.index,r=l(6);c("componentConfigSignal",r.componentConfigSignal)("attachmentIndex",t)("commentObj",r.commentObj)("attachment",e)("imageWireframe",r.imageWireframe)}}function VXe(i,o){if(i&1&&(f(0),g(1,FXe,2,1,"ng-container",8)(2,LXe,1,5,"ng-template",null,0,Ee)(4,BXe,1,5,"ng-template",null,1,Ee),v()),i&2){let n=o.$implicit,e=ce(3);m(),c("ngIf",n==null||n.mimeType==null?null:n.mimeType.includes("image"))("ngIfElse",e)}}function UXe(i,o){if(i&1&&(_(0,"div",6),P(1,"translate"),g(2,VXe,6,2,"ng-container",7),b()),i&2){let n=l(4).ngIf,e=l();x("data-testid",e.componentId)("aria-label",M(1,4,"Attachments")+"("+(e.commentObj==null||e.commentObj.attachments==null?null:e.commentObj.attachments.length)+")"),m(2),c("ngForOf",e.commentObj==null?null:e.commentObj.attachments)("ngForTrackBy",n==null?null:n.trackByAttachmentId)}}function jXe(i,o){if(i&1&&(f(0),g(1,UXe,3,6,"div",5),v()),i&2){let n=l(4);m(),c("ngIf",n.commentObj==null||n.commentObj.attachments==null?null:n.commentObj.attachments.length)}}function $Xe(i,o){if(i&1&&(f(0),g(1,jXe,2,1,"ng-container",2),v()),i&2){let n=l(3);m(),c("ngIf",n.commentObj)}}function HXe(i,o){if(i&1&&(f(0),g(1,$Xe,2,1,"ng-container",4),v()),i&2){let n=l().ngIf,e=l();m(),c("veltDynamicTemplate",$(5,RXe,e.template,$e(1,cme,e.componentConfigSignal,e.commentObj,e.i),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function zXe(i,o){if(i&1&&(f(0),g(1,HXe,2,11,"ng-container",3),v()),i&2){let n=l();m(),c("veltIf",k(5,kXe,n.conditionSignal(),$e(1,cme,n.componentConfigSignal,n.commentObj,n.i)))}}var iI=(()=>{let o=class o extends H{constructor(e,t,r){super(e,r,t),this.elementRef=e,this.loggingService=t,this.dynamicDataService=r,this.componentId="velt-thread-card-attachments",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef.nativeElement,{componentConfigSignal:this.componentConfigSignal,commentObj:this.commentObj,i:this.i}),this.setupA11yAttributes(),this.imageWireframe||(this.imageWireframe=this.template?.querySelector("velt-comment-dialog-thread-card-attachments-image-wireframe")),this.otherWireframe||(this.otherWireframe=this.template?.querySelector("velt-comment-dialog-thread-card-attachments-other-wireframe"))}catch{}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsComponent ngOnDestroy:",e)}}setupA11yAttributes(){try{let e=this.elementRef.nativeElement;e.setAttribute("role","region"),e.setAttribute("data-testid",this.componentId+"-container"),e.setAttribute("aria-label","Comment attachments")}catch(e){this.loggingService.catch("Error in CommentDialogThreadCardAttachmentsComponent setupA11yAttributes:",e)}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-thread-card-attachments"]],inputs:{commentObj:"commentObj",i:"i"},standalone:!1,features:[V([S]),B],decls:1,vars:1,consts:[["otherAttachmentRef",""],["imageAttachmentRef",""],[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],["class","comment-attachments velt-comment-attachments","velt-ignore-change-detection","true","role","region",4,"ngIf"],["velt-ignore-change-detection","true","role","region",1,"comment-attachments","velt-comment-attachments"],[4,"ngFor","ngForOf","ngForTrackBy"],[4,"ngIf","ngIfElse"],[4,"ngTemplateOutlet"],[3,"componentConfigSignal","attachment","commentObj","attachmentIndex","otherWireframe"],[3,"componentConfigSignal","attachmentIndex","commentObj","attachment","imageWireframe"]],template:function(t,r){t&1&&g(0,zXe,2,8,"ng-container",2),t&2&&c("ngIf",r.componentConfigSignal())},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%]:empty{display:none}.velt-comment-attachments[_ngcontent-%COMP%]{gap:var(--velt-spacing-sm);display:flex;flex-direction:column}.velt-comment-attachments[_ngcontent-%COMP%]:not(:empty){margin:var(--velt-spacing-lg) 0 var(--velt-spacing-sm);padding-left:calc((3rem + 0px) * var(--velt-base-rem-unit))}"],changeDetection:0});let i=o;return i})();var dme=(i,o,n)=>({componentConfigSignal:i,commentObj:o,i:n}),GXe=(i,o)=>({condition:i,data:o}),WXe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-thread-card-message-wireframe",variant:n,setIfCondition:e,componentElementRef:t}),qXe=(i,o,n,e,t)=>[i,o,n,e,t];function YXe(i,o){if(i&1){let n=q();_(0,"div",7),P(1,"translate"),z("copy",function(t){return N(n),F(t.stopPropagation())}),ee(2),P(3,"translate"),b()}if(i&2){let n=l(4).ngIf,e=l();ue("velt-thread-card--inline-mode",n==null?null:n.inlineCommentSectionMode)("velt-thread-card--draft",e.commentObj==null?null:e.commentObj.isDraft),x("data-testid",e.componentId+"-text")("aria-label",M(1,7,"Comment")+" "+(e.i+1)),m(2),Ce(" ",M(3,9,e.commentObj.commentText)," ")}}function KXe(i,o){if(i&1){let n=q();_(0,"div",8),P(1,"sanitizeHtml"),P(2,"replaceAutocompleteList"),P(3,"safeHtml"),P(4,"translate"),z("copy",function(t){return N(n),F(t.stopPropagation())}),b()}if(i&2){let n=l(4).ngIf,e=l();ue("velt-thread-card--inline-mode",n==null?null:n.inlineCommentSectionMode)("velt-thread-card--draft",e.commentObj==null?null:e.commentObj.isDraft),c("innerHTML",js(3,15,jZ(2,9,$(20,qXe,M(1,7,e.commentObj.commentHtml),e.commentObj==null?null:e.commentObj.customList,e.commentObj==null?null:e.commentObj.toOrganizationUserGroup,e.commentObj==null?null:e.commentObj.taggedUserContacts,(n==null?null:n.dialogShadowDOM)&&!(n!=null&&n.template))),!1),Yi),x("data-testid",e.componentId+"-html")("aria-label",M(4,18,"Comment")+" "+(e.i+1))}}function ZXe(i,o){if(i&1&&(f(0),g(1,YXe,4,11,"div",5)(2,KXe,5,26,"div",6),v()),i&2){let n=l(3).ngIf,e=l();m(),c("ngIf",(n==null?null:n.editCommentIndex)!==e.i&&e.commentObj.commentText&&!e.commentObj.commentHtml),m(),c("ngIf",(n==null?null:n.editCommentIndex)!==e.i&&e.commentObj.commentHtml)}}function XXe(i,o){if(i&1&&(f(0),g(1,ZXe,3,2,"ng-container",4),v()),i&2){l(2);let n=ce(3),e=l();m(),c("ngIf",!e.showLoadingTemplate)("ngIfElse",n)}}function QXe(i,o){if(i&1&&(f(0),g(1,XXe,2,2,"ng-container",3),v()),i&2){let n=l().ngIf,e=l();m(),c("veltDynamicTemplate",$(5,WXe,e.template,$e(1,dme,e.componentConfigSignal,e.commentObj,e.i),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function JXe(i,o){i&1&&w(0,"velt-skeleton-loader-internal",9)}function eQe(i,o){if(i&1&&(f(0),g(1,QXe,2,11,"ng-container",2)(2,JXe,1,0,"ng-template",null,0,Ee),v()),i&2){let n=l();m(),c("veltIf",k(5,GXe,n.conditionSignal(),$e(1,dme,n.componentConfigSignal,n.commentObj,n.i)))}}var oI=(()=>{let o=class o extends H{get commentObj(){return this._commentObj}set commentObj(e){try{this._commentObj=e,this.setShowLoadingTemplate()}catch{}}constructor(e,t,r,a,s){super(a,s,t),this.authService=e,this.loggingService=t,this.renderer=r,this.elementRef=a,this.dynamicDataService=s,this.showLoadingTemplate=!1,this.componentId="velt-thread-card-message",super.initializeComponentConfigSignal(new ke)}ngOnInit(){try{this.setupA11yAttributes(),this.dynamicDataService.applyConditionalClasses(this.elementRef.nativeElement,{componentConfigSignal:this.componentConfigSignal,commentObj:this.commentObj,i:this.i}),this.setShowLoadingTemplate();let t=this.authService.getUser()?.email;if(t){let r=this.renderer.createElement("style");this.renderer.setProperty(r,"type","text/css"),this.renderer.setProperty(r,"innerHTML",`
|
|
407
407
|
.velt-comment-dialog-thread-card-message--email-chip[email="${t}"] {
|