@veltdev/sdk-dev 4.6.6-beta.6 → 4.6.6-beta.8
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/app/client/snippyly.model.d.ts +1 -1
- package/package.json +1 -1
- package/velt.js +3 -3
package/velt.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var SNIPPYLY_VERSION = '4.6.6-beta.
|
|
1
|
+
var SNIPPYLY_VERSION = '4.6.6-beta.8';
|
|
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 PSe=Object.create;var XA=Object.defineProperty,MSe=Object.defineProperties,kSe=Object.getOwnPropertyDescriptor,RSe=Object.getOwnPropertyDescriptors,NSe=Object.getOwnPropertyNames,ZA=Object.getOwnPropertySymbols,XY=Object.getPrototypeOf,S8=Object.prototype.hasOwnProperty,QY=Object.prototype.propertyIsEnumerable,FSe=Reflect.get;var ZY=(i,o,n)=>o in i?XA(i,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[o]=n,E=(i,o)=>{for(var n in o||={})S8.call(o,n)&&ZY(i,n,o[n]);if(ZA)for(var n of ZA(o))QY.call(o,n)&&ZY(i,n,o[n]);return i},D=(i,o)=>MSe(i,RSe(o));var gy=(i,o)=>{var n={};for(var e in i)S8.call(i,e)&&o.indexOf(e)<0&&(n[e]=i[e]);if(i!=null&&ZA)for(var e of ZA(i))o.indexOf(e)<0&&QY.call(i,e)&&(n[e]=i[e]);return n};var LSe=(i,o)=>()=>(o||i((o={exports:{}}).exports,o),o.exports),QA=(i,o)=>{for(var n in o)XA(i,n,{get:o[n],enumerable:!0})},BSe=(i,o,n,e)=>{if(o&&typeof o=="object"||typeof o=="function")for(let t of NSe(o))!S8.call(i,t)&&t!==n&&XA(i,t,{get:()=>o[t],enumerable:!(e=kSe(o,t))||e.enumerable});return i};var JY=(i,o,n)=>(n=i!=null?PSe(XY(i)):{},BSe(o||!i||!i.__esModule?XA(n,"default",{value:i,enumerable:!0}):n,i));var Bp=(i,o,n)=>FSe(XY(i),n,o);var Q=(i,o,n)=>new Promise((e,t)=>{var r=c=>{try{s(n.next(c))}catch(p){t(p)}},a=c=>{try{s(n.throw(c))}catch(p){t(p)}},s=c=>c.done?e(c.value):Promise.resolve(c.value).then(r,a);s((n=n.apply(i,o)).next())});var fY=LSe((V3o,hY)=>{"use strict";var Ot={};Ot.generateIdentifier=function(){return Math.random().toString(36).substring(2,12)};Ot.localCName=Ot.generateIdentifier();Ot.splitLines=function(i){return i.trim().split(`
|
|
@@ -204,7 +204,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
204
204
|
<img src="${o||this.thumbnailWithPlayIconUrl||this.thumbnailUrl}" />
|
|
205
205
|
</a>
|
|
206
206
|
`}};var Xg=class{constructor(){this.type="recorder",this.recordingType="audio",this.mode="floating",this.attachment=null,this.attachments=[],this.pageInfo=new po}};var i9=class{constructor(){this.type="rewriter",this.rewriterType="copywriter",this.pageInfo=new po}};var LI=class{constructor(){this.screenWidth=0,this.screenHeight=0,this.screenScrollHeight=0}};var Qg=class{constructor(){this.pageInfo=new po}},BI=(function(i){return i.Start="start",i.End="end",i})(BI||{}),PC=(function(i){return i.Avatar="avatar",i.Label="label",i})(PC||{});var o9=class{constructor(){this.sources=[],this.playerState=new VI}},VI=class{constructor(){this.volume=1}};var UI=class{constructor(){this.to=[],this.resolved=!1,this.type="tag",this.pageInfo=new po}};var Dp=class{constructor(){this.visibility="private"}};var r9=class{constructor(){this.reactions=[],this.type="reaction",this.pageInfo=new po,this.isReactionResolverUsed=!1}};var a9=class{};var Qs=(function(i){return i.EDITOR="editor",i.VIEWER="viewer",i})(Qs||{}),Lo=(function(i){return i.DOES_NOT_EXIST="does_not_exist",i.PERMISSION_DENIED="permission_denied",i.SOMETHING_WENT_WRONG="something_went_wrong",i})(Lo||{});var Ft=(()=>{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),this.safeEval$=new ve(!1),this.encryptionProvider$=new ve(null);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(),et.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(Re)),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().pipe(_t(Xt))}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}}enableSafeEval(){try{this.safeEval$.next(!0)}catch(e){this.loggingService.catch("Error in ConfigService enableSafeEval: ",e)}}disableSafeEval(){try{this.safeEval$.next(!1)}catch(e){this.loggingService.catch("Error in ConfigService disableSafeEval: ",e)}}getSafeEval(){try{return this.safeEval$.value}catch(e){return this.loggingService.catch("Error in ConfigService getSafeEval: ",e),!1}}getSafeEval$(){try{return this.safeEval$.asObservable()}catch(e){return this.loggingService.catch("Error in ConfigService getSafeEval$: ",e),se(!1)}}setEncryptionProvider(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setEncryptionProvider","color: green;"),this.encryptionProvider$.next(e)}catch(t){this.loggingService.catch("Error in ConfigService setEncryptionProvider: ",t)}}getEncryptionProvider(){try{return this.encryptionProvider$.value}catch(e){return this.loggingService.catch("Error in ConfigService getEncryptionProvider: ",e),null}}getEncryptionProvider$(){try{return this.encryptionProvider$.asObservable()}catch(e){return this.loggingService.catch("Error in ConfigService getEncryptionProvider$: ",e),se(null)}}};o.\u0275fac=function(t){return new(t||o)(ee(y),ee(tt))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var spe=(()=>{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(U.LOCALSTORAGE_DATA_ID);if(e)return JSON.parse(e);{let t=new bf;return this.setLocalStorageData(t),t}}catch(e){return this.loggingService.catch("Error in getLocalStorageData:",e),new bf}}setLocalStorageData(e){this.loggingService.log("%c[WB] Calling FUNCTION: setLocalStorageData","color: green;");try{if(e){let t=JSON.stringify(e);localStorage?.setItem(U.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(U.LOCALSTORAGE_DATA_ID)}getSessionStorageData(){this.loggingService.log("%c[WB] Calling FUNCTION: getSessionStorageData","color: green;");try{let e=sessionStorage?.getItem(U.LOCALSTORAGE_DATA_ID);if(e)return JSON.parse(e);{let t=new bf;return this.setSessionStorageData(t),t}}catch(e){return this.loggingService.catch("Error in getSessionStorageData:",e),new bf}}setSessionStorageData(e){this.loggingService.log("%c[WB] Calling FUNCTION: setSessionStorageData","color: green;");try{if(e){let t=JSON.stringify(e);sessionStorage?.setItem(U.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(U.LOCALSTORAGE_DATA_ID)}catch(e){this.loggingService.catch("Error in deleteSessionStorageData:",e)}}};o.\u0275fac=function(t){return new(t||o)(ee(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var hm=(()=>{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 zo,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 zo}}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 U.AVATAR_COLOR_LIST[e%U.AVATAR_COLOR_LIST.length];let t=Math.floor(Math.random()*U.AVATAR_COLOR_LIST.length);return U.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)(ee(spe),ee(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var ni=(()=>{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 nt),this.actionSubjects.get(e)?.next(t)}catch(r){this.loggingService.catch("Error in CoreActionsService triggerAction: ",r)}}onAction(e){try{this.actionSubjects.has(e)||this.actionSubjects.set(e,new nt);let t=this.actionSubjects.get(e);return t?t.asObservable():se(null)}catch(t){return this.loggingService.catch("Error in CoreActionsService onAction: ",t),se(null)}}};o.\u0275fac=function(t){return new(t||o)(ee(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var{entries:fpe,setPrototypeOf:lpe,isFrozen:ONe,getPrototypeOf:ANe,getOwnPropertyDescriptor:PNe}=Object,{freeze:xs,seal:gc,create:$W}=Object,{apply:HW,construct:zW}=typeof Reflect<"u"&&Reflect;xs||(xs=function(o){return o});gc||(gc=function(o){return o});HW||(HW=function(o,n){for(var e=arguments.length,t=new Array(e>2?e-2:0),r=2;r<e;r++)t[r-2]=arguments[r];return o.apply(n,t)});zW||(zW=function(o){for(var n=arguments.length,e=new Array(n>1?n-1:0),t=1;t<n;t++)e[t-1]=arguments[t];return new o(...e)});var s9=Ts(Array.prototype.forEach),MNe=Ts(Array.prototype.lastIndexOf),cpe=Ts(Array.prototype.pop),$I=Ts(Array.prototype.push),kNe=Ts(Array.prototype.splice),c9=Ts(String.prototype.toLowerCase),FW=Ts(String.prototype.toString),LW=Ts(String.prototype.match),HI=Ts(String.prototype.replace),RNe=Ts(String.prototype.indexOf),NNe=Ts(String.prototype.trim),vd=Ts(Object.prototype.hasOwnProperty),Es=Ts(RegExp.prototype.test),zI=FNe(TypeError);function Ts(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 HW(i,o,e)}}function FNe(i){return function(){for(var o=arguments.length,n=new Array(o),e=0;e<o;e++)n[e]=arguments[e];return zW(i,n)}}function hi(i,o){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:c9;lpe&&lpe(i,null);let e=o.length;for(;e--;){let t=o[e];if(typeof t=="string"){let r=n(t);r!==t&&(ONe(o)||(o[e]=r),t=r)}i[t]=!0}return i}function LNe(i){for(let o=0;o<i.length;o++)vd(i,o)||(i[o]=null);return i}function wp(i){let o=$W(null);for(let[n,e]of fpe(i))vd(i,n)&&(Array.isArray(e)?o[n]=LNe(e):e&&typeof e=="object"&&e.constructor===Object?o[n]=wp(e):o[n]=e);return o}function GI(i,o){for(;i!==null;){let e=PNe(i,o);if(e){if(e.get)return Ts(e.get);if(typeof e.value=="function")return Ts(e.value)}i=ANe(i)}function n(){return null}return n}var dpe=xs(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),BW=xs(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),VW=xs(["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"]),BNe=xs(["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"]),UW=xs(["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"]),VNe=xs(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),mpe=xs(["#text"]),ppe=xs(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),jW=xs(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),gpe=xs(["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"]),l9=xs(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),UNe=gc(/\{\{[\w\W]*|[\w\W]*\}\}/gm),jNe=gc(/<%[\w\W]*|[\w\W]*%>/gm),$Ne=gc(/\$\{[\w\W]*/gm),HNe=gc(/^data-[\-\w.\u00B7-\uFFFF]+$/),zNe=gc(/^aria-[\-\w]+$/),vpe=gc(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),GNe=gc(/^(?:\w+script|data):/i),WNe=gc(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Cpe=gc(/^html$/i),qNe=gc(/^[a-z][.\w]*(-[.\w]+)+$/i),upe=Object.freeze({__proto__:null,ARIA_ATTR:zNe,ATTR_WHITESPACE:WNe,CUSTOM_ELEMENT:qNe,DATA_ATTR:HNe,DOCTYPE_NAME:Cpe,ERB_EXPR:jNe,IS_ALLOWED_URI:vpe,IS_SCRIPT_OR_DATA:GNe,MUSTACHE_EXPR:UNe,TMPLIT_EXPR:$Ne}),WI={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},YNe=function(){return typeof window>"u"?null:window},KNe=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}},hpe=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function _pe(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:YNe(),o=cn=>_pe(cn);if(o.version="3.3.0",o.removed=[],!i||!i.document||i.document.nodeType!==WI.document||!i.Element)return o.isSupported=!1,o;let{document:n}=i,e=n,t=e.currentScript,{DocumentFragment:r,HTMLTemplateElement:a,Node:s,Element:c,NodeFilter:p,NamedNodeMap:g=i.NamedNodeMap||i.MozNamedAttrMap,HTMLFormElement:f,DOMParser:I,trustedTypes:T}=i,L=c.prototype,G=GI(L,"cloneNode"),z=GI(L,"remove"),J=GI(L,"nextSibling"),le=GI(L,"childNodes"),_e=GI(L,"parentNode");if(typeof a=="function"){let cn=n.createElement("template");cn.content&&cn.content.ownerDocument&&(n=cn.content.ownerDocument)}let De,Be="",{implementation:Ve,createNodeIterator:be,createDocumentFragment:Se,getElementsByTagName:Ae}=n,{importNode:Ce}=e,he=hpe();o.isSupported=typeof fpe=="function"&&typeof _e=="function"&&Ve&&Ve.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:Oe,ERB_EXPR:Ne,TMPLIT_EXPR:io,DATA_ATTR:St,ARIA_ATTR:It,IS_SCRIPT_OR_DATA:bt,ATTR_WHITESPACE:Lt,CUSTOM_ELEMENT:Yt}=upe,{IS_ALLOWED_URI:Gt}=upe,Qt=null,Ii=hi({},[...dpe,...BW,...VW,...UW,...mpe]),tn=null,ei=hi({},[...ppe,...jW,...gpe,...l9]),Yi=Object.seal($W(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}})),Am=null,wo=null,Ua=Object.seal($W(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Ta=!0,sl=!0,bc=!1,Rf=!0,Ed=!1,kp=!0,Ic=!1,Nf=!1,Ff=!1,Rp=!1,Eu=!1,xu=!1,Lf=!0,K1=!1,g8="user-content-",Tu=!0,Pm=!1,xd={},Jo=null,ra=hi({},["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"]),Du=null,Z1=hi({},["audio","video","img","source","image","track"]),Bf=null,RA=hi({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Td="http://www.w3.org/1998/Math/MathML",wu="http://www.w3.org/2000/svg",Bl="http://www.w3.org/1999/xhtml",Dd=Bl,X1=!1,Q1=null,J1=hi({},[Td,wu,Bl],FW),Ou=hi({},["mi","mo","mn","ms","mtext"]),Au=hi({},["annotation-xml"]),Pu=hi({},["title","style","font","a","script"]),Mm=null,ey=["application/xhtml+xml","text/html"],km="text/html",fr=null,Ec=null,NA=n.createElement("form"),Np=function(Ue){return Ue instanceof RegExp||Ue instanceof Function},Vf=function(){let Ue=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Ec&&Ec===Ue)){if((!Ue||typeof Ue!="object")&&(Ue={}),Ue=wp(Ue),Mm=ey.indexOf(Ue.PARSER_MEDIA_TYPE)===-1?km:Ue.PARSER_MEDIA_TYPE,fr=Mm==="application/xhtml+xml"?FW:c9,Qt=vd(Ue,"ALLOWED_TAGS")?hi({},Ue.ALLOWED_TAGS,fr):Ii,tn=vd(Ue,"ALLOWED_ATTR")?hi({},Ue.ALLOWED_ATTR,fr):ei,Q1=vd(Ue,"ALLOWED_NAMESPACES")?hi({},Ue.ALLOWED_NAMESPACES,FW):J1,Bf=vd(Ue,"ADD_URI_SAFE_ATTR")?hi(wp(RA),Ue.ADD_URI_SAFE_ATTR,fr):RA,Du=vd(Ue,"ADD_DATA_URI_TAGS")?hi(wp(Z1),Ue.ADD_DATA_URI_TAGS,fr):Z1,Jo=vd(Ue,"FORBID_CONTENTS")?hi({},Ue.FORBID_CONTENTS,fr):ra,Am=vd(Ue,"FORBID_TAGS")?hi({},Ue.FORBID_TAGS,fr):wp({}),wo=vd(Ue,"FORBID_ATTR")?hi({},Ue.FORBID_ATTR,fr):wp({}),xd=vd(Ue,"USE_PROFILES")?Ue.USE_PROFILES:!1,Ta=Ue.ALLOW_ARIA_ATTR!==!1,sl=Ue.ALLOW_DATA_ATTR!==!1,bc=Ue.ALLOW_UNKNOWN_PROTOCOLS||!1,Rf=Ue.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Ed=Ue.SAFE_FOR_TEMPLATES||!1,kp=Ue.SAFE_FOR_XML!==!1,Ic=Ue.WHOLE_DOCUMENT||!1,Rp=Ue.RETURN_DOM||!1,Eu=Ue.RETURN_DOM_FRAGMENT||!1,xu=Ue.RETURN_TRUSTED_TYPE||!1,Ff=Ue.FORCE_BODY||!1,Lf=Ue.SANITIZE_DOM!==!1,K1=Ue.SANITIZE_NAMED_PROPS||!1,Tu=Ue.KEEP_CONTENT!==!1,Pm=Ue.IN_PLACE||!1,Gt=Ue.ALLOWED_URI_REGEXP||vpe,Dd=Ue.NAMESPACE||Bl,Ou=Ue.MATHML_TEXT_INTEGRATION_POINTS||Ou,Au=Ue.HTML_INTEGRATION_POINTS||Au,Yi=Ue.CUSTOM_ELEMENT_HANDLING||{},Ue.CUSTOM_ELEMENT_HANDLING&&Np(Ue.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Yi.tagNameCheck=Ue.CUSTOM_ELEMENT_HANDLING.tagNameCheck),Ue.CUSTOM_ELEMENT_HANDLING&&Np(Ue.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Yi.attributeNameCheck=Ue.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),Ue.CUSTOM_ELEMENT_HANDLING&&typeof Ue.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(Yi.allowCustomizedBuiltInElements=Ue.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Ed&&(sl=!1),Eu&&(Rp=!0),xd&&(Qt=hi({},mpe),tn=[],xd.html===!0&&(hi(Qt,dpe),hi(tn,ppe)),xd.svg===!0&&(hi(Qt,BW),hi(tn,jW),hi(tn,l9)),xd.svgFilters===!0&&(hi(Qt,VW),hi(tn,jW),hi(tn,l9)),xd.mathMl===!0&&(hi(Qt,UW),hi(tn,gpe),hi(tn,l9))),Ue.ADD_TAGS&&(typeof Ue.ADD_TAGS=="function"?Ua.tagCheck=Ue.ADD_TAGS:(Qt===Ii&&(Qt=wp(Qt)),hi(Qt,Ue.ADD_TAGS,fr))),Ue.ADD_ATTR&&(typeof Ue.ADD_ATTR=="function"?Ua.attributeCheck=Ue.ADD_ATTR:(tn===ei&&(tn=wp(tn)),hi(tn,Ue.ADD_ATTR,fr))),Ue.ADD_URI_SAFE_ATTR&&hi(Bf,Ue.ADD_URI_SAFE_ATTR,fr),Ue.FORBID_CONTENTS&&(Jo===ra&&(Jo=wp(Jo)),hi(Jo,Ue.FORBID_CONTENTS,fr)),Tu&&(Qt["#text"]=!0),Ic&&hi(Qt,["html","head","body"]),Qt.table&&(hi(Qt,["tbody"]),delete Am.tbody),Ue.TRUSTED_TYPES_POLICY){if(typeof Ue.TRUSTED_TYPES_POLICY.createHTML!="function")throw zI('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof Ue.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw zI('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');De=Ue.TRUSTED_TYPES_POLICY,Be=De.createHTML("")}else De===void 0&&(De=KNe(T,t)),De!==null&&typeof Be=="string"&&(Be=De.createHTML(""));xs&&xs(Ue),Ec=Ue}},aa=hi({},[...BW,...VW,...BNe]),ty=hi({},[...UW,...VNe]),Mu=function(Ue){let Mt=_e(Ue);(!Mt||!Mt.tagName)&&(Mt={namespaceURI:Dd,tagName:"template"});let Jt=c9(Ue.tagName),fo=c9(Mt.tagName);return Q1[Ue.namespaceURI]?Ue.namespaceURI===wu?Mt.namespaceURI===Bl?Jt==="svg":Mt.namespaceURI===Td?Jt==="svg"&&(fo==="annotation-xml"||Ou[fo]):!!aa[Jt]:Ue.namespaceURI===Td?Mt.namespaceURI===Bl?Jt==="math":Mt.namespaceURI===wu?Jt==="math"&&Au[fo]:!!ty[Jt]:Ue.namespaceURI===Bl?Mt.namespaceURI===wu&&!Au[fo]||Mt.namespaceURI===Td&&!Ou[fo]?!1:!ty[Jt]&&(Pu[Jt]||!aa[Jt]):!!(Mm==="application/xhtml+xml"&&Q1[Ue.namespaceURI]):!1},ja=function(Ue){$I(o.removed,{element:Ue});try{_e(Ue).removeChild(Ue)}catch{z(Ue)}},Rm=function(Ue,Mt){try{$I(o.removed,{attribute:Mt.getAttributeNode(Ue),from:Mt})}catch{$I(o.removed,{attribute:null,from:Mt})}if(Mt.removeAttribute(Ue),Ue==="is")if(Rp||Eu)try{ja(Mt)}catch{}else try{Mt.setAttribute(Ue,"")}catch{}},FA=function(Ue){let Mt=null,Jt=null;if(Ff)Ue="<remove></remove>"+Ue;else{let Bo=LW(Ue,/^[\r\n\t ]+/);Jt=Bo&&Bo[0]}Mm==="application/xhtml+xml"&&Dd===Bl&&(Ue='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+Ue+"</body></html>");let fo=De?De.createHTML(Ue):Ue;if(Dd===Bl)try{Mt=new I().parseFromString(fo,Mm)}catch{}if(!Mt||!Mt.documentElement){Mt=Ve.createDocument(Dd,"template",null);try{Mt.documentElement.innerHTML=X1?Be:fo}catch{}}let sa=Mt.body||Mt.documentElement;return Ue&&Jt&&sa.insertBefore(n.createTextNode(Jt),sa.childNodes[0]||null),Dd===Bl?Ae.call(Mt,Ic?"html":"body")[0]:Ic?Mt.documentElement:sa},Nm=function(Ue){return be.call(Ue.ownerDocument||Ue,Ue,p.SHOW_ELEMENT|p.SHOW_COMMENT|p.SHOW_TEXT|p.SHOW_PROCESSING_INSTRUCTION|p.SHOW_CDATA_SECTION,null)},ny=function(Ue){return Ue instanceof f&&(typeof Ue.nodeName!="string"||typeof Ue.textContent!="string"||typeof Ue.removeChild!="function"||!(Ue.attributes instanceof g)||typeof Ue.removeAttribute!="function"||typeof Ue.setAttribute!="function"||typeof Ue.namespaceURI!="string"||typeof Ue.insertBefore!="function"||typeof Ue.hasChildNodes!="function")},LA=function(Ue){return typeof s=="function"&&Ue instanceof s};function ks(cn,Ue,Mt){s9(cn,Jt=>{Jt.call(o,Ue,Mt,Ec)})}let iy=function(Ue){let Mt=null;if(ks(he.beforeSanitizeElements,Ue,null),ny(Ue))return ja(Ue),!0;let Jt=fr(Ue.nodeName);if(ks(he.uponSanitizeElement,Ue,{tagName:Jt,allowedTags:Qt}),kp&&Ue.hasChildNodes()&&!LA(Ue.firstElementChild)&&Es(/<[/\w!]/g,Ue.innerHTML)&&Es(/<[/\w!]/g,Ue.textContent)||Ue.nodeType===WI.progressingInstruction||kp&&Ue.nodeType===WI.comment&&Es(/<[/\w]/g,Ue.data))return ja(Ue),!0;if(!(Ua.tagCheck instanceof Function&&Ua.tagCheck(Jt))&&(!Qt[Jt]||Am[Jt])){if(!Am[Jt]&&ku(Jt)&&(Yi.tagNameCheck instanceof RegExp&&Es(Yi.tagNameCheck,Jt)||Yi.tagNameCheck instanceof Function&&Yi.tagNameCheck(Jt)))return!1;if(Tu&&!Jo[Jt]){let fo=_e(Ue)||Ue.parentNode,sa=le(Ue)||Ue.childNodes;if(sa&&fo){let Bo=sa.length;for(let Da=Bo-1;Da>=0;--Da){let ll=G(sa[Da],!0);ll.__removalCount=(Ue.__removalCount||0)+1,fo.insertBefore(ll,J(Ue))}}}return ja(Ue),!0}return Ue instanceof c&&!Mu(Ue)||(Jt==="noscript"||Jt==="noembed"||Jt==="noframes")&&Es(/<\/no(script|embed|frames)/i,Ue.innerHTML)?(ja(Ue),!0):(Ed&&Ue.nodeType===WI.text&&(Mt=Ue.textContent,s9([Oe,Ne,io],fo=>{Mt=HI(Mt,fo," ")}),Ue.textContent!==Mt&&($I(o.removed,{element:Ue.cloneNode()}),Ue.textContent=Mt)),ks(he.afterSanitizeElements,Ue,null),!1)},Uf=function(Ue,Mt,Jt){if(Lf&&(Mt==="id"||Mt==="name")&&(Jt in n||Jt in NA))return!1;if(!(sl&&!wo[Mt]&&Es(St,Mt))){if(!(Ta&&Es(It,Mt))){if(!(Ua.attributeCheck instanceof Function&&Ua.attributeCheck(Mt,Ue))){if(!tn[Mt]||wo[Mt]){if(!(ku(Ue)&&(Yi.tagNameCheck instanceof RegExp&&Es(Yi.tagNameCheck,Ue)||Yi.tagNameCheck instanceof Function&&Yi.tagNameCheck(Ue))&&(Yi.attributeNameCheck instanceof RegExp&&Es(Yi.attributeNameCheck,Mt)||Yi.attributeNameCheck instanceof Function&&Yi.attributeNameCheck(Mt,Ue))||Mt==="is"&&Yi.allowCustomizedBuiltInElements&&(Yi.tagNameCheck instanceof RegExp&&Es(Yi.tagNameCheck,Jt)||Yi.tagNameCheck instanceof Function&&Yi.tagNameCheck(Jt))))return!1}else if(!Bf[Mt]){if(!Es(Gt,HI(Jt,Lt,""))){if(!((Mt==="src"||Mt==="xlink:href"||Mt==="href")&&Ue!=="script"&&RNe(Jt,"data:")===0&&Du[Ue])){if(!(bc&&!Es(bt,HI(Jt,Lt,"")))){if(Jt)return!1}}}}}}}return!0},ku=function(Ue){return Ue!=="annotation-xml"&&LW(Ue,Yt)},xc=function(Ue){ks(he.beforeSanitizeAttributes,Ue,null);let{attributes:Mt}=Ue;if(!Mt||ny(Ue))return;let Jt={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:tn,forceKeepAttr:void 0},fo=Mt.length;for(;fo--;){let sa=Mt[fo],{name:Bo,namespaceURI:Da,value:ll}=sa,Vl=fr(Bo),Tc=ll,vr=Bo==="value"?Tc:NNe(Tc);if(Jt.attrName=Vl,Jt.attrValue=vr,Jt.keepAttr=!0,Jt.forceKeepAttr=void 0,ks(he.uponSanitizeAttribute,Ue,Jt),vr=Jt.attrValue,K1&&(Vl==="id"||Vl==="name")&&(Rm(Bo,Ue),vr=g8+vr),kp&&Es(/((--!?|])>)|<\/(style|title|textarea)/i,vr)){Rm(Bo,Ue);continue}if(Vl==="attributename"&&LW(vr,"href")){Rm(Bo,Ue);continue}if(Jt.forceKeepAttr)continue;if(!Jt.keepAttr){Rm(Bo,Ue);continue}if(!Rf&&Es(/\/>/i,vr)){Rm(Bo,Ue);continue}Ed&&s9([Oe,Ne,io],oy=>{vr=HI(vr,oy," ")});let VA=fr(Ue.nodeName);if(!Uf(VA,Vl,vr)){Rm(Bo,Ue);continue}if(De&&typeof T=="object"&&typeof T.getAttributeType=="function"&&!Da)switch(T.getAttributeType(VA,Vl)){case"TrustedHTML":{vr=De.createHTML(vr);break}case"TrustedScriptURL":{vr=De.createScriptURL(vr);break}}if(vr!==Tc)try{Da?Ue.setAttributeNS(Da,Bo,vr):Ue.setAttribute(Bo,vr),ny(Ue)?ja(Ue):cpe(o.removed)}catch{Rm(Bo,Ue)}}ks(he.afterSanitizeAttributes,Ue,null)},BA=function cn(Ue){let Mt=null,Jt=Nm(Ue);for(ks(he.beforeSanitizeShadowDOM,Ue,null);Mt=Jt.nextNode();)ks(he.uponSanitizeShadowNode,Mt,null),iy(Mt),xc(Mt),Mt.content instanceof r&&cn(Mt.content);ks(he.afterSanitizeShadowDOM,Ue,null)};return o.sanitize=function(cn){let Ue=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Mt=null,Jt=null,fo=null,sa=null;if(X1=!cn,X1&&(cn="<!-->"),typeof cn!="string"&&!LA(cn))if(typeof cn.toString=="function"){if(cn=cn.toString(),typeof cn!="string")throw zI("dirty is not a string, aborting")}else throw zI("toString is not a function");if(!o.isSupported)return cn;if(Nf||Vf(Ue),o.removed=[],typeof cn=="string"&&(Pm=!1),Pm){if(cn.nodeName){let ll=fr(cn.nodeName);if(!Qt[ll]||Am[ll])throw zI("root node is forbidden and cannot be sanitized in-place")}}else if(cn instanceof s)Mt=FA("<!---->"),Jt=Mt.ownerDocument.importNode(cn,!0),Jt.nodeType===WI.element&&Jt.nodeName==="BODY"||Jt.nodeName==="HTML"?Mt=Jt:Mt.appendChild(Jt);else{if(!Rp&&!Ed&&!Ic&&cn.indexOf("<")===-1)return De&&xu?De.createHTML(cn):cn;if(Mt=FA(cn),!Mt)return Rp?null:xu?Be:""}Mt&&Ff&&ja(Mt.firstChild);let Bo=Nm(Pm?cn:Mt);for(;fo=Bo.nextNode();)iy(fo),xc(fo),fo.content instanceof r&&BA(fo.content);if(Pm)return cn;if(Rp){if(Eu)for(sa=Se.call(Mt.ownerDocument);Mt.firstChild;)sa.appendChild(Mt.firstChild);else sa=Mt;return(tn.shadowroot||tn.shadowrootmode)&&(sa=Ce.call(e,sa,!0)),sa}let Da=Ic?Mt.outerHTML:Mt.innerHTML;return Ic&&Qt["!doctype"]&&Mt.ownerDocument&&Mt.ownerDocument.doctype&&Mt.ownerDocument.doctype.name&&Es(Cpe,Mt.ownerDocument.doctype.name)&&(Da="<!DOCTYPE "+Mt.ownerDocument.doctype.name+`>
|
|
207
|
-
`+Da),Ed&&s9([Oe,Ne,io],ll=>{Da=HI(Da,ll," ")}),De&&xu?De.createHTML(Da):Da},o.setConfig=function(){let cn=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Vf(cn),Nf=!0},o.clearConfig=function(){Ec=null,Nf=!1},o.isValidAttribute=function(cn,Ue,Mt){Ec||Vf({});let Jt=fr(cn),fo=fr(Ue);return Uf(Jt,fo,Mt)},o.addHook=function(cn,Ue){typeof Ue=="function"&&$I(he[cn],Ue)},o.removeHook=function(cn,Ue){if(Ue!==void 0){let Mt=MNe(he[cn],Ue);return Mt===-1?void 0:kNe(he[cn],Mt,1)[0]}return cpe(he[cn])},o.removeHooks=function(cn){he[cn]=[]},o.removeAllHooks=function(){he=hpe()},o}var qI=_pe();var ype={ADD_TAGS:["velt-skeleton-loader"],ADD_ATTR:["border-radius","target"]},Le=(()=>{let o=class o{constructor(e,t,r,a){this.analyticsService=e,this.rendererFactory2=t,this.loggingService=r,this.sanitizer=a,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 nt,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 nt,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 Yn),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.tabId=null,this.dynamicIdPatterns=[/^yui_[a-z0-9_]+$/i],this.excludeClassList=["show-pin-cursor"],this.filterSnippylyNodes=s=>{try{let c=[];return s.forEach(p=>{if(!qi(p))if(p instanceof HTMLElement){if(p.className.includes("cdk-overlay-container")||p.className.includes("cdk-overlay-connected-position-bounding-box"))return;if(p.className.includes("cdk-overlay")){let g=!1;p.childNodes.forEach(f=>{qi(f)&&(g=!0)}),g||c.push(p)}else c.push(p)}else c.push(p)}),c}catch(c){return this.loggingService.catch("Error in DomService filterSnippylyNodes: ",c),[]}},this.loggingService.log("%c[WB] Creating CLASS: DomService","color: blue;");try{this.analyticsService.setDomService(this),this.renderer=this.rendererFactory2.createRenderer(null,null);let s=this.calculateScreenSize();this.currentScreenSize$=new ve(s),this.currentMousePosition$=new ve(this.currentMousePosition),this.detectNetworkStatusChange(),this.getScrollableElementsIds$().pipe(Di(),on(([c,p])=>{try{let g=p.filter(I=>!c.includes(I)),f=c.filter(I=>!p.includes(I));f.length&&f.map(T=>document.getElementById(T)).filter(T=>T).forEach(T=>{this.unlistenElementScroll&&this.unlistenElementScroll[T.id]&&this.unlistenElementScroll[T.id]()}),g.length&&g.map(T=>document.getElementById(T)).filter(T=>T).forEach(T=>{this.unlistenElementScroll[T.id]=this.renderer.listen(T,"scroll",L=>{let G=this.calculateScreenSize();this.currentScreenSize$.next(G)})})}catch(g){this.loggingService.catch("Error in DomService getScrollableElementsIds subscription: ",g)}})).subscribe(()=>{},c=>{this.loggingService.catch("Error in DomService getScrollableElementsIds subscription: ",c)}),this.getSelectedAnnotationsMap$().subscribe(c=>{Object.keys(c||{})?.length?Gle("snippylyUserScalableNo","viewport","width=device-width, user-scalable=no"):Wle("snippylyUserScalableNo")},c=>{this.loggingService.catch("Error in DomService getSelectedAnnotationsMap$ subscription: ",c)})}catch(s){this.loggingService.catch("Error in DomService constructor: ",s)}}setDocService(e){try{this.docService=e,this.subscribeToDomEvents()}catch(t){this.loggingService.catch("Error in DomService setDocService: ",t)}}setDynamicIdPatterns(e){try{let t=e.map(r=>typeof r=="string"?new RegExp(r):r).filter(Boolean);t.length&&(this.dynamicIdPatterns=t)}catch(t){this.loggingService.catch("Error in DomService setDynamicIdPatterns: ",t)}}isLikelyDynamicId(e){try{return e?this.dynamicIdPatterns.some(t=>t.test(e)):!1}catch{return!1}}getStableAttributes(e){try{let t={};if(!e.getAttributeNames)return t;let r=new Set(["id","class","style"]);return e.getAttributeNames().forEach(s=>{if(r.has(s)||s.includes("snippyly")||s.includes("velt"))return;let c=e.getAttribute(s);c&&c.length<=256&&(t[s]=c)}),t}catch{return{}}}buildStableElementSelector(e,t){try{if(Object.keys(t).length===0)return;let a=[e.tagName?.toLowerCase()],s=["data-","aria-","role","name","title","type"];return Object.keys(t).sort((p,g)=>{let f=s.findIndex(T=>p.startsWith(T)),I=s.findIndex(T=>g.startsWith(T));return(f===-1?99:f)-(I===-1?99:I)}).slice(0,4).forEach(p=>{let g=CSS.escape(t[p]);a.push(`[${p}="${g}"]`)}),a.join("")}catch{return}}getVisibleText(e,t=400){try{let r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null),a="",s,c=0;for(;(s=r.nextNode())&&a.length<t;){let p=(s.textContent||"").replace(/\s+/g," ").trim();if(p&&(a+=(a?" ":"")+p),c++,c>100)break}return a.slice(0,t)}catch{return""}}hashText(e){try{return kle(e)}catch{return}}generateRobustXPath(e,t){try{let r=t?.maxDepth||10,a=t?.useAbsolutePath||!1,s=[],c=e,p=0;for(;c&&c!==document.documentElement&&p<r;){let T=this.buildRobustXPathSegment(c);if(T&&(s.unshift(T),this.isStrongAnchorSegment(T)))break;c=c.parentElement,p++}if(s.length===0)return;let f=(a?"/":"//")+s.join("/");return s.some(T=>T.includes("[@")||T.includes("[contains(@class"))?f:void 0}catch{return}}buildRobustXPathSegment(e){try{let t=e.tagName.toLowerCase(),r=e.id;if(r&&!this.isLikelyDynamicId(r)&&document.querySelectorAll(`[id="${CSS.escape(r)}"]`).length===1)return`*[@id=${this.escapeXPathValue(r)}]`;let a=["data-region","data-instanceid","data-action","data-key","data-block","data-activityid"];for(let T of a){let L=e.getAttribute(T);if(L)return`${t}[@${T}=${this.escapeXPathValue(L)}]`}let s=Array.from(e.attributes).filter(T=>T.name.startsWith("data-")&&!T.name.includes("snippyly")&&!T.name.includes("velt")&&T.value.length<100).sort((T,L)=>T.value.length-L.value.length);if(s.length>0){let T=s[0];return`${t}[@${T.name}=${this.escapeXPathValue(T.value)}]`}let c=e.getAttribute("role");if(c)return`${t}[@role=${this.escapeXPathValue(c)}]`;let p=e.getAttribute("aria-label");if(p&&p.length<50)return`${t}[@aria-label=${this.escapeXPathValue(p)}]`;let g=e.getAttribute("name");if(g)return`${t}[@name=${this.escapeXPathValue(g)}]`;let f=e.getAttribute("type");if(f)return`${t}[@type=${this.escapeXPathValue(f)}]`;let I=Array.from(e.classList||[]).filter(T=>T.length>0&&T.length<40&&!T.includes("yui")&&!T.includes("velt")&&!T.includes("snippyly")&&!this.excludeClassList.includes(T)).slice(0,2);if(I.length>0){let T=I.map(L=>`contains(@class, ${this.escapeXPathValue(L)})`).join(" and ");return`${t}[${T}]`}if(e.parentElement){let T=Array.from(e.parentElement.children).filter(L=>L.tagName===e.tagName);if(T.length>1){let L=T.indexOf(e)+1;return`${t}[${L}]`}}return t}catch{return}}isStrongAnchorSegment(e){try{return!!(e.includes("[@id=")||["main","navigation","banner","contentinfo","complementary","search"].some(a=>e.includes(`[@role='${a}']`))||["data-region","data-instanceid","data-activityid"].some(a=>e.includes(`[@${a}=`)))}catch{return!1}}escapeXPathValue(e,t=!0){try{return e.includes("'")?e.includes('"')?`concat(${e.split("'").map(s=>`'${s}'`).join(`,"'",`)})`:t?`"${e}"`:e:t?`'${e}'`:e}catch{try{return`concat(${e.split("'").map(c=>`'${c}'`).join(`,"'",`)})`}catch{return t?`'${e}'`:e}}}getElementFromRobustXPath(e){try{return document.evaluate(e,document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue}catch{return null}}getAllElementsFromRobustXPath(e){try{let t=document.evaluate(e,document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null),r=[];for(let a=0;a<t.snapshotLength;a++){let s=t.snapshotItem(a);s instanceof Element&&r.push(s)}return r}catch{return[]}}generateAnchorRecord(e,t){try{let r=this.generateAnchorRecordForElement(e,t),a=null;if(e.parentElement&&e.parentElement instanceof HTMLElement&&wi(e.parentElement)&&e.parentElement!==document.body&&(a=e.parentElement),r&&a){let s=this.generateAnchorRecordForElement(a,t);s&&(r.parent=s)}return r}catch(r){return this.loggingService.catch("Error in DomService generateAnchorRecord: ",r),null}}generateAnchorRecordForElement(e,t){try{if(!e)return null;let r=e,a=r.tagName?.toUpperCase();if(!a)return null;let s=r.id&&!this.isLikelyDynamicId(r.id)?r.id:void 0,c=this.getStableAttributes(r),p=this.buildStableElementSelector(r,c),g=this.getVisibleText(r),f=this.hashText(g||""),I=this.generateRobustXPath(r),T=this.getXPath(r),L=this.getXPath(r,!0),G=this.getXPath(r,!0,!0);return{version:"1.0",id:s,tagName:a,elementSelector:p,robustXPath:I||void 0,xPath:T||void 0,fXPath:L||void 0,cfXPath:G||void 0,contentHash:f?{value:f,algorithm:"md5",source:"textContent"}:void 0,createdAt:Date.now()}}catch(r){return this.loggingService.catch("Error in DomService generateAnchorRecordForElement: ",r),null}}resolveAnchorRecord(e){try{let t=[],r=null,a=(f,I,T=0)=>{let L=[],G=T;if(L.push({method:I,score:T}),e.tagName&&f.tagName?.toUpperCase()===e.tagName&&(G+=10,L.push({method:"tagName-match",score:10})),e.contentHash?.value){let z=this.getVisibleText(f);this.hashText(z)===e.contentHash.value&&(G+=30,L.push({method:"contentHash-match",score:30}))}t.push({el:f,score:G,by:I,scoreBreakdown:L})};if(e.id){let f=document.querySelectorAll(`#${CSS.escape(e.id)}`);if(f.length===1)return{element:f[0],matchedBy:"id",score:90};f.length>1&&f.forEach(I=>a(I,"id-duplicate",70))}if(e.elementSelector){let f=document.querySelectorAll(e.elementSelector);if(f.length===1)return{element:f[0],matchedBy:"element-selector",score:80};f.forEach(I=>a(I,"element-selector-duplicate",60))}e.robustXPath&&this.getAllElementsFromRobustXPath(e.robustXPath).slice(0,20).forEach(L=>a(L,"robustXPath",50)),e?.parent&&(r=this.resolveAnchorRecord(e.parent),r.element&&r.element.querySelectorAll(e.tagName?.toLowerCase()||"*").forEach(I=>a(I,"parent+tag",40)));let s=(f,I,T)=>{if(!f)return;let L=this.getElementFromXPath(f);L&&a(L,I||"xpath",T||30)};if(s(e.xPath,"xPath",30),s(e.cfXPath,"cfXPath",30),s(e.fXPath,"fXPath",30),e.contentHash?.value&&t.length===0){let I=T=>{let L=0;for(let G=0;G<T.length&&L<400;G++){let z=T[G];if(L++,!this.isElementVisible(z))continue;let J=this.getVisibleText(z),le=this.hashText(J);le&&le===e.contentHash?.value&&a(z,"contentHash",15)}};if(r?.element&&r?.element instanceof Element){let T=r?.element?.querySelectorAll("*");I(T)}}if(!t.length)return{element:null};t.sort((f,I)=>I.score-f.score);let c=t[0].score,p=t.filter(f=>f.score===c);if(p.length>1){let f=[{path:e.xPath,label:"xPath"},{path:e.cfXPath,label:"cfXPath"},{path:e.fXPath,label:"fXPath"}];for(let I of f)if(I.path){let T=this.getElementFromXPath(I.path);if(T){let L=p.find(G=>G.el===T);if(L)return{element:L.el,matchedBy:`${L.by}+position`,score:L.score,scoreBreakdown:L.scoreBreakdown}}}}let g=t[0];return{element:g.el,matchedBy:g.by,score:g.score,scoreBreakdown:g.scoreBreakdown}}catch(t){return this.loggingService.catch("Error in DomService resolveAnchorRecord: ",t),{element:null}}}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(),this.onDocumentClick()}catch(e){this.loggingService.catch("Error in DomService subscribeToDomEvents: ",e)}}setScrollableElementsIds(e){try{e&&e.length&&this.scrollableElementsIds$.next(Array.from(new Set(e)))}catch(t){this.loggingService.catch("Error in DomService setScrollableElementsIds: ",t)}}getScrollableElementsIds$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getScrollableElementsIds$","color: green;"),this.scrollableElementsIds$.asObservable()}removeScrollableElementsIds(){this.scrollableElementsIds$.next([])}setMutationObserver(e){try{this.mutationObserver||(this.loggingService.log("%c[WB] Calling DomService FUNCTION: setMutationObserver","color: green;"),this.loggingService.log("%c[WB] setMutationObserver from: "+e,"color: green;"),this.mutationObserver=new MutationObserver(t=>{try{if(t?.find(a=>a?.attributeName===U.VELT_IGNORE_CHANGE_DETECTION))return;let r=t.filter(a=>a.type==="childList").filter(a=>{let s=a.target;return a.removedNodes.forEach(c=>{let p=c;if(typeof p.getAttribute=="function"){let g=p.getAttribute(U.ATTRIBUTES.VELT_ELEMENT_CACHE_ID);if(g!==null&&g!==""){let f=this.xpathCacheId.get(g);f!==void 0&&(this.xpathCacheId.delete(g),this.xpathCache.delete(f))}}}),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(U.VELT_IGNORE_CHANGE_DETECTION):!0}return!0})),r=r.filter(a=>{let s=!0;return Object.keys(U.INGNORE_MUTATION_OBSERVER_CHANGE_TAGS).forEach(c=>{a.target?.closest(c)&&(s=!1)}),s}),r=r.filter(a=>a.target&&wi(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{Uo(fi(window,"offline").pipe(de(()=>!1)),fi(window,"online").pipe(de(()=>!0)),new $t(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 Yn),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()!==U.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 fi(window,"keydown")}catch(e){return this.loggingService.catch("Error in DomService onWindowKeydown$: ",e),Ul}}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 f=this.getXPath(t);f&&(r=f.iterateNext()||e.target)}let a=r.getBoundingClientRect(),s=e.clientX-a.x,c=e.clientY-a.y,p=s*100/(a.width||1),g=c*100/(a.height||1);this.currentMousePosition.element={xpath:t,topPercentage:g,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,c=!0,p){try{let g=e,f=g?.touches?.length?g.touches[0]?.clientX:g?.clientX,I=g?.touches?.length?g.touches[0]?.clientY:g?.clientY;p&&(f=p.clientX,I=p.clientY);let T=this.getBackgroundElement(f,I,t,r);if(T&&s&&typeof s=="function"&&(T=s(T)),T){let L=this.getXPath(T),G=this.getXPath(T,!0),z=T.getBoundingClientRect(),J=f-z.x,le=I-z.y,_e=J*100/(z.width||1),De=le*100/(z.height||1),Be={xpath:L,fXpath:G,leftPercentage:_e,topPercentage:De};if(a){let Ve=this.getXPath(T,!0,!0);Be.cfXpath=Ve}if(c){let Ve=this.generateAnchorRecord(T);Ve&&(Be.anchor=Ve)}return Be}else return null}catch(g){return this.loggingService.catch("Error in DomService getTargetElementForCommentPinAnnotation: ",g),null}}getBackgroundElement(e,t,r=!0,a=!1){try{let s=document.elementsFromPoint(e,t),c=[];s.forEach(g=>{qi(g)?c=[]:wi(g)&&c.push(g)}),a&&(c=c.filter(g=>this.isElementVisibleOnScreen(g)));let p=0;return r||c?.forEach((g,f)=>{g.tagName.toLowerCase()==="svg"&&(p=f)}),c[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)&&wi(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,U.SNIPPYLY_HIGHLIGHT)),t&&!e.hasAttribute(U.ATTRIBUTES.DEFAULT_CURSOR)){let a=e.style.getPropertyValue("cursor"),s=e.style.getPropertyPriority("cursor"),c=a?{defaultCursorValue:a,defaultCursorPriority:s}:"";e.setAttribute(U.ATTRIBUTES.DEFAULT_CURSOR,c?JSON.stringify(c):""),e.style.setProperty("cursor",t,"important")}e.setAttribute(U.SNIPPYLY_HIGHLIGHT,"true"),e.setAttribute(U.VELT_IGNORE_CHANGE_DETECTION,"true")}}removeHighlightFromElement(e){if(e&&(this.pinHighlighterClass$.value&&this.removeClassFromElement(e,this.pinHighlighterClass$.value),this.removeClassFromElement(e,U.SNIPPYLY_HIGHLIGHT),e.removeAttribute(U.SNIPPYLY_HIGHLIGHT),e.removeAttribute(U.VELT_IGNORE_CHANGE_DETECTION),e.hasAttribute(U.ATTRIBUTES.DEFAULT_CURSOR))){try{if(e.style.removeProperty("cursor"),e.getAttribute(U.ATTRIBUTES.DEFAULT_CURSOR)){let t=JSON.parse(e.getAttribute(U.ATTRIBUTES.DEFAULT_CURSOR));e.style.setProperty("cursor",t.defaultCursorValue,t.defaultCursorPriority)}}catch{}e.removeAttribute(U.ATTRIBUTES.DEFAULT_CURSOR)}}highlightUserElement(e,t,r,a=!1){try{e&&(this.addClassToElement(e,U.VELT_LIVE_SELECTION_ON_ELEMENT),a&&this.addClassToElement(e,U.VELT_LIVE_SELECTION_ON_ELEMENT_DEFAULT),e.setAttribute(U.SNIPPYLY_HIGHLIGHT,"true"),e.setAttribute(U.VELT_IGNORE_CHANGE_DETECTION,"true"),t&&!e.style.getPropertyValue(U.VELT_SELECTION_COLOR)&&e.style.setProperty(U.VELT_SELECTION_COLOR,t),r&&e.setAttribute(U.SNIPPYLY_HIGHLIGHT_USER_NAME,r))}catch(s){this.loggingService.catch("Error in DomService highlightUserElement: ",s)}}removeHighlightUserFromElement(e){try{e&&(this.removeClassFromElement(e,U.VELT_LIVE_SELECTION_ON_ELEMENT),this.removeClassFromElement(e,U.VELT_LIVE_SELECTION_ON_ELEMENT_DEFAULT),e.removeAttribute(U.SNIPPYLY_HIGHLIGHT),e.removeAttribute(U.VELT_IGNORE_CHANGE_DETECTION),e.removeAttribute(U.VELT_SELECTION_COLOR),e.removeAttribute(U.SNIPPYLY_HIGHLIGHT_USER_NAME),e.style.removeProperty(U.VELT_SELECTION_COLOR))}catch(t){this.loggingService.catch("Error in DomService removeHighlightUserFromElement: ",t)}}previewHighlightElement(e){e&&e.setAttribute(U.SNIPPYLY_HIGHLIGHT_PREVIEW,"true")}removePreviewHighlightFromElement(e){e&&e.removeAttribute(U.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 c=s.split("/"),p=!1;c.forEach((g,f)=>{g.includes("svg")&&(p=!0),p&&(c[f]="svg:"+g)}),s=c.join("/")}return s}catch(s){this.loggingService.catch("Error in DomService getXPath:",s)}}namespaceResolver(e){return e==="svg"?"http://www.w3.org/2000/svg":null}calculateXPath(e,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 c=e.className?.split(" ")?.filter(p=>!p?.includes("snippyly")&&!p?.includes("velt")&&!["show-pin-cursor"].includes(p))[0];if(c){let p=this.calculateXPath(e.parentNode,t,r,a)+"/"+e.tagName.toLowerCase(),g=Array.from(e.parentNode?.children||[]).filter(f=>f.nodeType===1&&f.tagName===e.tagName?f.className?.split(" ")?.filter(T=>T?.includes("snippyly")||T?.includes("velt")||["show-pin-cursor"].includes(T))[0]===c:!1);if(g.length>1){let f=g.indexOf(e)+1;p+=`[contains(concat(' ', normalize-space(@class), ' '), ' ${c} ')][${f}]`}else p+=`[contains(concat(' ', normalize-space(@class), ' '), ' ${c} ')]`;return p}}let s=[].filter.call(e.parentNode?.children?e.parentNode?.children:[],function(c){return c.tagName==e.tagName});return this.calculateXPath(e.parentNode,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=vt();a.setAttribute(U.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}}getElementFromTargetElement(e){try{let t=null;if(e?.anchor){let r=this.resolveAnchorRecord(e.anchor);r?.element&&(t=r.element)}else e?.xpath?t=this.getElementFromXPath(e.xpath):e?.cfXpath?t=this.getElementFromXPath(e.cfXpath):e?.fXpath&&(t=this.getElementFromXPath(e.fXpath));return t}catch(t){return this.loggingService.catch("Error in DomService getElementFromTargetElement:",t),null}}getElementFromTargetTextRange(e){try{let t=null;if(e?.commonAncestorContainerAnchor){let r=this.resolveAnchorRecord(e.commonAncestorContainerAnchor);r?.element&&(t=r.element)}else e?.commonAncestorContainer&&(t=this.getElementFromXPath(e.commonAncestorContainer));return t}catch(t){return this.loggingService.catch("Error in DomService getElementFromTargetTextRange:",t),null}}calculateScreenSize(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowResize","color: green;");try{let e=[document?.body?.clientHeight||0,document?.documentElement?.clientHeight||0,window?.innerHeight||0],t=[document?.body?.clientWidth||0,document?.documentElement?.clientWidth||0,window?.innerWidth||0];this.calculatePageScrollHeight(),this.loggingService.log(this.pageScrollHeight),this.loggingService.log(this.nodeMap),this.highestNode=this.nodeMap[this.pageScrollHeight];let r=new LI;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 LI}}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(I=>{I.removeAttribute("data-snippyly-cache-id")}),r.querySelectorAll("[data-velt-cache-id]").forEach(I=>{I.removeAttribute("data-velt-cache-id")}),r.querySelectorAll(".comment-text-highlight").forEach(I=>{I?.parentNode?.insertBefore(document.createTextNode(I?.textContent),I),I.remove()});let p=document.createNodeIterator(r,NodeFilter.SHOW_COMMENT),g;for(;g=p.nextNode();)g?.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(`[${U.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`)),a=this.getDraftCommentAnnotationDialogs()||[];r.push(...a),r=Array.from(new Set(r));let s=r.map(f=>f.classList.contains("velt-annotation-draft-checked")?(f.classList.remove("velt-annotation-draft-checked"),null):(this.removeClassFromElement(f,"velt-comment-dialog-shake"),setTimeout(()=>{this.addClassToElement(f,"velt-comment-dialog-shake"),f.getAttribute(U.ATTRIBUTES.VELT_ANNOTATION_EDIT_COMMENT)||f.classList.contains("velt-annotation-draft-checked")||this.addClassToElement(f,"velt-annotation-draft-checked")},100),f.getAttribute(U.ATTRIBUTES.VELT_ANNOTATION_DRAFT))).filter(f=>f),c=Object.keys(this.getRecordingInProgress()||{});s=[...s,...c];let p=this.selectedAnnotationsMap$.value;if(e&&this.selectedAnnotationsMap$.value&&Object.keys(this.selectedAnnotationsMap$.value).length){let f=[];Object.keys(p).forEach(I=>{if(p[I]?.type==="tag"){let T=p[I];T?.to?.length||s.includes(I)||f.push(T)}else p[I]?.comments?.length||s.includes(I)||f.push(p[I])}),this.deleteAnnotations$.next(f),this.deleteAnnotations$.next([])}let g={};Object.keys(p).forEach(f=>{if(s.includes(f)&&(g[f]=p[f]),t)switch(t){case"comment":["comment","videoPin"].includes(p[f]?.type)||(g[f]=p[f]);break;default:p[f]?.type!==t&&(g[f]=p[f]);break}}),Object.keys(g).forEach(f=>{let I=g[f]?.multiThreadAnnotationId;I&&!g[I]&&(g[I]={annotationId:I,type:"multiThread"})}),JSON.stringify(this.selectedAnnotationsMap$.value)!==JSON.stringify(g)&&this.selectedAnnotationsMap$.next(g),this.setDialogOpenedInSidebar(!1)}catch(r){this.loggingService.catch("Error in DomService resetSelectedAnnotationsMap: ",r)}}setRecordingInProgress(e,t){try{if(t)this.recordingInProgress$.next(D(E({},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(`${U.TAGS.SNIPPYLY_COMMENT_DIALOG}`)).forEach(r=>{if(r?.shadowRoot){let a=r.shadowRoot.querySelector(`[${U.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);a&&e.push(a)}else{let a=r.querySelector(`${U.TAGS.VELT_SHADOW_DOM_INTERNAL}`);if(a?.shadowRoot){let s=a.shadowRoot?.querySelector(`[${U.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);s&&e.push(s)}else{let s=r.querySelector(`[${U.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 c=JSON.parse(JSON.stringify(this.selectedAnnotationsMap$.value||{})),p=JSON.parse(JSON.stringify(this.selectedAnnotationsLocationMap$.value||{}));c[e.annotationId]&&!a?delete c[e.annotationId]:((!this.windowKeydownShift$.value||a)&&(c={}),c[e.annotationId]=e,p[e.annotationId]=t,s=e?.multiThreadAnnotationId||s,s&&(c[s]={annotationId:s,type:"multiThread"},p[s]=t)),this.selectedAnnotationsMap$.next(c),Object.keys(p).forEach(g=>{c[g]||delete p[g]}),this.selectedAnnotationsLocationMap$.next(p)}catch(c){this.loggingService.catch("Error in DomService toggleAnnotationSelection: ",c)}}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()}getNetworkStatus(){return this.networkStatus$.value}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 c=window.getComputedStyle(a);if(a.tagName.toLowerCase()==="svg"||a instanceof SVGElement){let p=a.parentElement;if(p){let g=p.getBoundingClientRect(),f=a.getBoundingClientRect();r.offsetLeft+=f.left-g.left,r.offsetTop+=f.top-g.top}}else c.position==="static"?c.transformStyle!="preserve-3d"&&c.transform=="none"&&(r.offsetLeft+=a?.offsetLeft||0,r.offsetTop+=a?.offsetTop||0):(r.offsetLeft+=a.offsetLeft,r.offsetTop+=a.offsetTop);if(a=a.parentElement,e instanceof SVGElement&&a===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 c=window.getComputedStyle(a);c.position==="static"?c.transformStyle!="preserve-3d"&&c.transform=="none"&&(r.offsetLeft+=a?.offsetLeft||0,r.offsetTop+=a?.offsetTop||0):(r.offsetLeft+=a.offsetLeft,r.offsetTop+=a.offsetTop)}return r}catch(r){return this.loggingService.catch("Error in DomService getElementOffset: ",r),{offsetTop:0,offsetLeft:0}}}isElementVisible(e){try{if(typeof e?.getBoundingClientRect=="function"){let{width: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 $t(e=>{let t=fi(document,"mousedown").pipe(de(p=>({type:p.type,x:p.clientX+window.scrollX,y:p.clientY+window.scrollY,event:p}))),r=fi(document,"mousemove").pipe(de(p=>({type:p.type,x:p.clientX+window.scrollX,y:p.clientY+window.scrollY,event:p}))),a=fi(document,"mouseup").pipe(de(p=>({type:p.type,x:p.clientX+window.scrollX,y:p.clientY+window.scrollY,event:p}))),c=t.pipe(fe(p=>r.pipe(Di(),de(([g,f])=>({startPoint:p,prevPoint:g,curPoint:f})),Co(a)))).subscribe(e);return()=>c.unsubscribe()})}drawRectangle(e,t){let r=document.querySelector(".rectangle");r||(r=document.createElement("div"),this.addClassToElement(r,"rectangle"),r.setAttribute(U.ATTRIBUTES.VELT_COMMENT_DISABLED,"true"),r.setAttribute(U.VELT_IGNORE_CHANGE_DETECTION,"true"),document.body.appendChild(r));let a=Math.abs(t.x-e.x),s=Math.abs(t.y-e.y),c=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=`${c}px`,r.style.top=`${p}px`,r.style.position="absolute",r.style.border="2px dashed #f00",r.style.pointerEvents="none",r.style.zIndex="2147483577",r}getRange(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: getRange","color: green;"),window.getSelection()?.toString()){let e=window.getSelection();if(e?.rangeCount)return e.getRangeAt(0)}return null}catch(e){return this.loggingService.catch("Error in DomService getRange: ",e),null}}clearTextSelection(){try{this.loggingService.log("%c[WB] Calling FUNCTION: clearTextSelection","color: green;"),window.getSelection&&(window.getSelection()?.empty?window.getSelection()?.empty():window.getSelection()?.removeAllRanges&&window.getSelection()?.removeAllRanges())}catch(e){this.loggingService.catch("Error in DomService clearTextSelection: ",e)}}getTargetTextRangeFromSelectionRange(e){try{let t={},r=e.commonAncestorContainer;r?.nodeType===Node.TEXT_NODE&&(r=r.parentElement);let a=document.body;if(r){let c=this.getTextXPath(r);this.isXpathWithId(c)&&(a=r)}let s=this.getAdditionalLocationContainer(r);if(s&&(a=s),t.commonAncestorContainer=this.getTextXPath(a),t.commonAncestorContainer){let c=this.getElementFromXPath(t.commonAncestorContainer);if(c){t.commonAncestorContainerFXpath=this.getXPath(c,!0),t.commonAncestorContainerCFXpath=this.getXPath(c,!0,!0);let p=this.generateAnchorRecord(c);p&&(t.commonAncestorContainerAnchor=p)}}return t.text=e.toString(),t.occurrence=rf(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(U.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(`[${U.ATTRIBUTES.VELT_LOCATION}], [${U.ATTRIBUTES.VELT_LOCATION_ID}]`)}catch(t){return this.loggingService.catch("Error in DomService isElementInsideAdditionalLocationContainer: ",t),!1}}getAdditionalLocationContainer(e){try{return e?.closest(`[${U.ATTRIBUTES.VELT_LOCATION}], [${U.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 c=document.getElementById(e[s]);c&&a.push(c)}if(t?.length)for(let s=0;s<t.length;s++){let c=document.getElementsByClassName(t[s]);for(let p=0;p<c.length;p++){let g=c[p];g&&g instanceof HTMLElement&&a.push(g)}}if(r?.length)for(let s=0;s<r.length;s++){let c=document.querySelectorAll(r[s]);for(let p=0;p<c.length;p++){let g=c[p];g&&g instanceof HTMLElement&&a.push(g)}}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(`[${U.VELT_CUSTOM_CSS}]`);if(r&&r.remove(),t?.type==="link"){let a=document.createElement("link");a.href=t?.value,a.rel="stylesheet",a.setAttribute(U.VELT_CUSTOM_CSS,"true"),e?.shadowRoot?.appendChild(a)}else{let a=document.createElement("style");a.innerHTML=this.sanitizeHtml(t?.value),a.setAttribute(U.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;"),qI.sanitize(e,ype)}catch(t){return this.loggingService.catch("Error in DomService sanitizeHtml: ",t),""}}sanitizeSvg(e){try{return qI.sanitize(e,ype)}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 Yn;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 Yn)}}getTabId(){try{let e=sessionStorage.getItem(U.SESSION_STORAGE.VELT_TAB_ID);!e&&this.tabId&&(e=this.tabId,sessionStorage.setItem(U.SESSION_STORAGE.VELT_TAB_ID,e)),!this.tabId&&e&&(this.tabId=e);let t=this.getTabIdFromWindowName();return(!e||e!==t)&&(e=vt(),this.tabId=e,sessionStorage.setItem(U.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 Yn}}isMobileDevice(){try{return new Yn().getDeviceType()===mr.MOBILE}catch(e){return this.loggingService.catch("Error in DomService isMobileDevice: ",e),!1}}isTabletDevice(){try{return new Yn().getDeviceType()===mr.TABLET}catch(e){return this.loggingService.catch("Error in DomService isTabletDevice: ",e),!1}}isDesktopDevice(){try{return new Yn().getDeviceType()===mr.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(c=>{s.setAttribute(c.name,c.value)});r.firstChild;)s.appendChild(r.firstChild);r.parentNode.replaceChild(s,r)}})}isMonitorDevice(){try{return new Yn().getDeviceType()===mr.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)(ee(tt),ee(er),ee(y),ee(fl))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var je=(()=>{let o=class o{constructor(e,t,r,a,s,c,p,g){this.afAuth=e,this.configService=t,this.avatarService=r,this.coreActionsService=a,this.domService=s,this.functions=c,this.analyticsService=p,this.loggingService=g,this.user$=new ve(null),this.userOptions$=new ve(null),this.userContacts$=new ve(null),this.userOrganization$=new ve(null),this.providedUser=new zo,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(f=>{this.config=f}),this.forceReLoggedIn=localStorage.getItem(U.LOCAL_STORAGE.VELT_USER_FORCE_RE_LOGGED_IN)==="true",this.sessionReLoginSubscription=ti(this.afAuth).pipe(oo(this.afAuth.currentUser),Di(),fe(([f,I])=>this.domService.onNetworkStatusChange$().pipe(Fe(T=>T),ot(1),de(()=>({previousUser:f,currentUser:I}))))).subscribe(T=>Q(this,[T],function*({previousUser:f,currentUser:I}){if(!I&&f){let L=f?.stsTokenManager?.expirationTime,G=new Date().getTime(),z=L-G;G>L&&(this.analyticsService.trackEvent(Y.Events.Core.SDK_SESSION_TOKEN_EXPIRED,{apiKey:this.apiKey,user:this.user$.value,lastLoggedInUserData:this.lastLoggedInUserData,timeLeft:z,forceReset:this.userOptions$.value?.forceReset,sessionReLoginCount:this.sessionReLoginCount},!0,this.user$.value?.userSnippylyId),this.user$.value&&f?.uid===this.user$.value?.userSnippylyId&&this.lastLoggedInUserData?.user?.userSnippylyId===this.user$.value?.userSnippylyId&&(this.sessionReLoginCount>this.SESSION_RE_LOGIN_COUNT_LIMIT?(this.analyticsService.trackEvent(Y.Events.Core.SDK_SESSION_RE_LOGIN_COUNT_EXCEEDED,{apiKey:this.apiKey,clientUserId:this.lastLoggedInUserData.user.userId,snippylyUserId:this.lastLoggedInUserData.user.userSnippylyId,timeLeft:z,forceReset:this.userOptions$.value?.forceReset,sessionReLoginCount:this.sessionReLoginCount},!0,this.user$.value?.userSnippylyId),this.sessionReLoginSubscription?.unsubscribe()):(this.sessionReLoginCount++,this.analyticsService.trackEvent(Y.Events.Core.SDK_SESSION_RE_LOGIN_TRIGGERED,{apiKey:this.apiKey,clientUserId:this.lastLoggedInUserData.user.userId,snippylyUserId:this.lastLoggedInUserData.user.userSnippylyId,user:this.getUserWithoutContacts(this.lastLoggedInUserData.user),timeLeft:z,forceReset:this.userOptions$.value?.forceReset,sessionReLoginCount:this.sessionReLoginCount},!0,this.lastLoggedInUserData.user.userSnippylyId),this.lastLoggedInUserData.user=yield this.updateUserWithColorAndTextColor(this.lastLoggedInUserData.user),this.initializeClient(this.lastLoggedInUserData.user,this.lastLoggedInUserData.userOptions,this.lastLoggedInUserData.initializeClientToken,this.lastLoggedInUserData.autoLogin,"internal-sessionReLogin"))))}}),f=>{this.loggingService.catch("Error in AuthService sessionReLoginSubscription: ",f)}),this.getUser$().pipe(_t(Xt)).subscribe(f=>{let I=Dr(f);this.coreActionsService.triggerAction(ct.USER_UPDATE,I),this.coreActionsService.triggerAction(ct.INIT_UPDATE,{event:ct.USER_UPDATE,payload:{user:I}})})}catch(f){this.loggingService.catch("Error in AuthService constructor: ",f)}}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 WR),this.configService.initConfig(t),t.debugMode?sessionStorage.setItem("debugMode","true"):sessionStorage.removeItem("debugMode"),this.autoLoginCalled||ti(this.afAuth).pipe(ot(1)).subscribe(r=>Q(this,null,function*(){if(this.autoLoginCalled=!0,r){let a=yield pp(r,!0).catch(s=>null);if(a){let{user:s}=a?.claims;this.autoLoginRequired&&(s=yield this.updateUserWithColorAndTextColor(s),this.initializeClient(s,this.userOptions$?.value?D(E({},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)}}setUserPermissionService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setUserPermissionService","color: green;"),this.userPermissionService=e}catch(t){this.loggingService.catch("Error in setUserPermissionService: ",t)}}setDocService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocService","color: green;"),this.docService=e}catch(t){this.loggingService.catch("Error in setDocService: ",t)}}setContactService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setContactService","color: green;"),this.contactService=e}catch(t){this.loggingService.catch("Error in setContactService: ",t)}}setIamService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setIamService","color: green;"),this.iamService=e}catch(t){this.loggingService.catch("Error in setIamService: ",t)}}setAreaService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setAreaService","color: green;"),this.areaService=e}catch(t){this.loggingService.catch("Error in setAreaService: ",t)}}setCommentService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setCommentService","color: green;"),this.commentService=e}catch(t){this.loggingService.catch("Error in setCommentService: ",t)}}setReactionService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setReactionService","color: green;"),this.reactionService=e}catch(t){this.loggingService.catch("Error in setReactionService: ",t)}}setRecorderAnnotationService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setRecorderAnnotationService","color: green;"),this.recorderAnnotationService=e}catch(t){this.loggingService.catch("Error in setRecorderAnnotationService: ",t)}}setViewsService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setViewsService","color: green;"),this.viewsService=e}catch(t){this.loggingService.catch("Error in setViewsService: ",t)}}setCommonDbService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setCommonDbService","color: green;"),this.commonDbService=e}catch(t){this.loggingService.catch("Error in setCommonDbService: ",t)}}validateOrganizationId(e){if(this.isVersionGreaterThanOrEqualTo4()&&!e?.organizationId)if(this.analyticsService.trackEvent(Y.Events.Core.SDK_VALIDATE_CLIENT_FAILED,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,message:"Organization Id is not set",forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e)},!0,e.userSnippylyId),this.configService.getSF())this.loggingService.catch("OrganizationId is not set in Identify method",void 0,void 0,!0);else throw new Error("OrganizationId is not set in Identify method")}setVeltAuthProvider(e){return Q(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: setVeltAuthProvider","color: green;");try{this.onRetrySubscription?.unsubscribe();let t=null;if(!e.user)return null;e.generateToken&&typeof e.generateToken=="function"&&(t=yield e.generateToken());let r=yield sz(()=>window.Velt.identify(e.user,E(E({},e.options||{}),t&&{authToken:t}),{fromProvider:!0}).catch(a=>(e.onError&&typeof e.onError=="function"&&e.onError(a),Promise.reject(a))),e.retryConfig||{retryCount:0,retryDelay:0});return r&&e.generateToken&&typeof e.generateToken=="function"&&(this.onRetrySubscription=this.coreActionsService.onAction(ct.ERROR).pipe(Fe(a=>a.code==="token_expired"),ot(10)).subscribe(a=>Q(this,null,function*(){if(a.code==="token_expired"){let s=this.docService?.getDocumentIds()?.map(T=>({id:T.clientDocumentId}))??[],c=this.docService?.getOptionsFromDocumentPaths()??void 0,p=[],g=this.docService?.getLocation();g&&p.push(g.location);let f=this.docService?.getLocations();f&&Object.values(f).forEach(T=>{p.push(T.location)}),(yield sz(()=>Q(this,null,function*(){try{let T=yield e.generateToken?.();return T?window.Velt.identify(e.user,E(E({},e.options||{}),T&&{authToken:T}),{fromProvider:!0}):!0}catch{return!1}}),e.retryConfig||{retryCount:0,retryDelay:0}))&&(yield this.docService?.setDocuments({documents:s,options:c,source:"internal"}),yield this.docService?.setLocations({locations:p,source:"internal",options:{appendLocation:!g}}))}}))),r}catch(t){return this.loggingService.catch("Error in setVeltAuthProvider: ",t),null}})}setUserToStorage(e){return Q(this,null,function*(){try{if(e){let t=yield Dl(e,e?.userId??"");localStorage.setItem(U.LOCAL_STORAGE.VELT_IDENTIFY_USER,t)}}catch(t){this.loggingService.catch("Error in setUserToStorage: ",t)}})}getUserFromStorage(e){return Q(this,null,function*(){try{let t=localStorage.getItem(U.LOCAL_STORAGE.VELT_IDENTIFY_USER);return t?yield W0(t,e?.userId??""):null}catch(t){return this.loggingService.catch("Error in getUserFromStorage: ",t),null}})}updateUserWithColorAndTextColor(e){return Q(this,null,function*(){try{let t=JSON.parse(JSON.stringify(e??{})),r=yield this.getUserFromStorage(t);return!r||Object.keys(r).length===0?(delete t?.color,delete t?.textColor,t):(r?.color&&(t.color=r?.color),r?.textColor&&(t.textColor=r?.textColor),t)}catch(t){return this.loggingService.catch("Error in updateUserWithColorAndTextColor: ",t),e}})}updateUserIfRequired(e){return Q(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: updateUserIfRequired","color: green;");try{let t=yield this.getUserFromStorage(e),r={};if(e.color&&e.color!==t?.color&&(r.color=e.color),e.textColor&&e.textColor!==t?.textColor&&(r.textColor=e.textColor),Object.keys(r).length>0&&e.clientOrganizationId){let a=Xi(this.functions,Qi({url:wn?.cloudFunction?.sdkProxy,apiProxyDomain:this.configService?.getApiProxyDomain()}));pd({data:{type:"addUserInfoToOrganization",metadata:{organizationId:e.clientOrganizationId},user:D(E({},r),{userId:e.userId})},getSdkProxy:a,userId:e?.userId??""})}}catch(t){this.loggingService.catch("Error in updateUserIfRequired: ",t)}})}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=K0(this.configService.getApiKey(),e.userId),this.pendingUserLogin=void 0,this.pendingUserLoginSource=void 0,this.initializeClientToken=r;let c=yield ti(this.afAuth).pipe(ot(1)).toPromise().catch(g=>null),p=!0;if(this.providedUser=JSON.parse(JSON.stringify(e)),c){let g=yield pp(c,!0).catch(T=>null);if(!g)return;let{user:f,firebaseConfig:I}=g.claims;if(c?.uid!==e?.userSnippylyId||e?.groupId!==f?.groupId||e?.organizationId!==f?.organizationId||t?.forceReset||!a&&e?.organizationId&&!this.forceReLoggedIn||this.forceReLoginRequiredForAdvancedQueries(e)||this.forceReLoginRequiredForRegion(e,I)||this.forceReLoginRequiredForCommentViews(e))localStorage.setItem(U.LOCAL_STORAGE.VELT_USER_FORCE_RE_LOGGED_IN,"true"),localStorage.setItem(U.LOCAL_STORAGE.VELT_COMMENT_VIEWS_MIGRATED,"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 T=yield pp(c,!0).catch(J=>null);if(!T)return;let{firebaseConfig:L,user:G,advancedQueries:z}=T.claims;yield this.updateUserIfRequired(e),this.validateOrganizationId(e),this.setFirebaseConfig(L),this.setAdvancedQueries(z),G&&(this.providedUser.isAdmin=!!G.isAdmin),this.initializeSignedInUser(c,a,e),p=!1,this.analyticsService.trackEvent(Y.Events.Core.SDK_USER_AUTH_SUCCESS,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,authType:"auto",forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e),source:s})}}if(p){this.analyticsService.trackEvent(Y.Events.Core.SDK_VALIDATE_CLIENT_TRIGGERED,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e),source:s},!0,e.userSnippylyId,e.userId);let g=Xi(this.functions,Qi({url:wn.cloudFunction.validateClient,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:1200*1e3}),f=_a(),I=(yield g({apiKey:this.apiKey,user:e,version:f,authToken:t?.authToken}))?.data;if(I.error){if(this.analyticsService.trackEvent(Y.Events.Core.SDK_VALIDATE_CLIENT_FAILED,D(E({apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,message:I.error,forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e)},I),{source:s}),!0,e.userSnippylyId,e.userId),I.error&&typeof I.error=="string")if(I.error?.toLowerCase()?.includes("token expired"))if(this.tokenExpiredErrorCount++,this.tokenExpiredErrorCount<=this.TOKEN_EXPIRED_ERROR_COUNT_LIMIT){let T={code:"token_expired",message:"Token expired",error:I?.error,source:I?.source};this.coreActionsService.triggerAction(ct.ERROR,T)}else{let T={code:"too_many_retries",message:"Token expired. Too many retries.",error:I?.error,source:I?.source};this.coreActionsService.triggerAction(ct.ERROR,T),this.analyticsService.trackEvent(Y.Events.Core.SDK_JWT_EXPIRED_RETRY_EXCEEDED,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,forceReset:this.userOptions$.value?.forceReset,source:s},!0,e.userSnippylyId,e.userId)}else{let T=I;this.coreActionsService.triggerAction(ct.ERROR,T)}throw I}else this.tokenExpiredErrorCount=0;if(this.analyticsService.trackEvent(Y.Events.Core.SDK_VALIDATE_CLIENT_SUCCESS,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e),source:s},!0,e.userSnippylyId,e.userId),this.validateOrganizationId(e),I.firebaseConfig){this.setFirebaseConfig(I.firebaseConfig),yield this.signInWithCustomToken(e,I.token),this.loggingService.log("new signed in user",this.afAuth.currentUser);let T=yield pp(this.afAuth.currentUser,!0).catch(z=>null);if(!T)return;let{user:L,advancedQueries:G}=T.claims;this.setAdvancedQueries(G),this.providedUser.isAdmin=!!L?.isAdmin,this.initializeSignedInUser(this.afAuth.currentUser,a,e)}}this.initializeClientToken=0,this.lastLoggedInUserData={user:e,userOptions:t,initializeClientToken:r,autoLogin:a},this.checkForPendingLogin()}return e}catch(c){return this.initializeClientToken=0,this.checkForPendingLogin(),this.loggingService.catch("Error in initializeClient: ",c),t?.throwError?Promise.reject(c):Promise.resolve(null)}})}isVersionGreaterThanOrEqualTo4(){try{let e=_a();return(e?parseInt(e.split(".")?.[0]||"0"):0)>=4}catch(e){return this.loggingService.catch("Error in isVersionGreaterThanOrEqualTo4: ",e),!1}}isVersion4Point5(){try{let e=_a();if(e){let t=e.split("."),r=parseInt(t[0]||"0"),a=parseInt(t[1]||"0"),s=parseInt(t[2]||"0");if(r>=4&&a>=5)return r===4&&a===5&&s===0?!e.toLowerCase().includes("beta"):!0}return!1}catch(e){return this.loggingService.catch("Error in isVersion4Point5: ",e),!1}}forceReLoginRequiredForAdvancedQueries(e){try{let t=this.isVersionGreaterThanOrEqualTo4(),r=!1;try{let a=localStorage.getItem(U.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}}forceReLoginRequiredForCommentViews(e){try{let t=this.isVersion4Point5(),r=!1;try{let a=localStorage.getItem(U.LOCAL_STORAGE.VELT_COMMENT_VIEWS_MIGRATED);a&&(r=JSON.parse(a))}catch(a){this.loggingService.catch("Error in forceReLoginRequiredForCommentViews: ",a)}return!!(t&&e.organizationId&&!r)}catch(t){return this.loggingService.catch("Error in forceReLoginRequiredForCommentViews: ",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:E(E({},wn.firebaseConfig),e)})}catch(t){this.loggingService.catch("Error in setFirebaseConfig: ",t)}}getFirebaseConfig$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getFirebaseConfig","color: green;"),this.firebaseConfig$.asObservable()}getFirebaseConfig(){return this.loggingService.log("%c[WB] Calling FUNCTION: getFirebaseConfig","color: green;"),this.firebaseConfig$.value}setAdvancedQueries(e){this.loggingService.log("%c[WB] Calling FUNCTION: setAdvancedQueries","color: green;");try{e&&typeof e=="object"&&localStorage.setItem(U.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 mn([this.configService.getConfig$(),this.getAdvancedQueries$()]).pipe(de(()=>this.getAdvancedQueriesEnabled()),zn(()=>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;"),ti(this.afAuth).pipe(fe(e=>e?this.user$.asObservable():se(null)),_t(Xt))}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=E(E({},this.providedUser),e),t){let r=E(E({},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 cie(this.afAuth,t).then(a=>(this.analyticsService.trackEvent(Y.Events.Core.SDK_USER_AUTH_SUCCESS,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,authType:r,forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e)}),a)).catch(a=>(this.analyticsService.trackEvent(Y.Events.Core.SDK_USER_AUTH_FAILED,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,authType: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,r){this.loggingService.log("%c[WB] Calling FUNCTION: initializeSignedInUser","color: green;");try{let a=new zo;a.userSnippylyId=e.uid,a.type="signedIn",r&&(a=E(E({},a),r)),this.setUserToStorage(a),this.mergeUserWithProvidedUserData(a,t)}catch(a){this.loggingService.catch("Error in initializeSignedInUser: ",a)}}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?.externalUserDataProviderAvailable()){let a=vt();this.coreActionsService.triggerAction(ct.USER_RESOLVER,{event:Y.Events.Resolver.USER_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:a,methodName:Hr.MERGE_USER_WITH_PROVIDED_USER_DATA,source:"internal",payload:{userIds:[e.userId],organizationId:this.providedUser?.organizationId||e.organizationId}});let s=yield this.usersService.resolveUsers({userIds:[e.userId],organizationId:this.providedUser?.organizationId||e.organizationId,skipUserCheck:!0,uniqueId:a});s&&s[e.userId]&&(r=JSON.parse(JSON.stringify(s[e.userId]||{}))),e=E(E({},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||this.getPlanDetailsFromDb();try{if(this.userPermissionService?.isPermissionProviderAvailable()&&e.clientOrganizationId){let r=[{userId:e.userId,resource:{id:e.clientOrganizationId,type:Fo.ORGANIZATION,source:Hi.IDENTIFY,organizationId:e.clientOrganizationId}}],a=vt();this.coreActionsService.triggerAction(ct.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.RESOURCE_ACCESS_REQUEST_FORMED,methodName:Hi.IDENTIFY,uniqueId:a,timestamp:new Date().getTime(),source:"internal",payload:{requests:r}}),yield this.userPermissionService?.onResourceAccessRequired({requests:r,uniqueId:a,userId:e.userId,methodName:Hi.IDENTIFY,fromCache:!1})}}catch(r){this.loggingService.catch("Error in updateUserInternally: ",r)}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=D(E({},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 Xi(this.functions,Qi({url:wn.cloudFunction.getPlanDetails,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:1200*1e3})({apiKey:this.configService.getApiKey(),sdkVersion:_a(),sdkType:this.configService.getSdkType()});return t?.data?.isPlanExpired&&(this.analyticsService.trackEvent(Y.Events.Core.SDK_PLAN_EXPIRED),this.configService.getSF()||console.warn("Velt SDK plan has expired.")),this.planDetails$.next(t?.data||{planInfo:null,isPlanExpired:!1}),t}catch(e){return this.loggingService.catch("Error in getPlanDetailsFromDb: ",e),this.planDetails$.next({planInfo:null,isPlanExpired:!1}),Promise.resolve(null)}})}isPlanExpired$(){return this.planDetails$.pipe(Fe(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(fe(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(),this.userPermissionService?.revokeAccessOnUserLogout(),yield this.analyticsService.trackEvent(Y.Events.Core.SDK_USER_SIGN_OUT,{apiKey:this.apiKey,clientUserId:this.user$?.value?.userId,snippylyUserId:this.user$?.value?.userSnippylyId,message:e==="external"?"User Sign out":"System Sign out",user:this.user$?.value?this.getUserWithoutContacts(this.user$?.value):null,forceReset:this.userOptions$.value?.forceReset,source:e});let t=yield ti(this.afAuth).pipe(ot(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 lm(1e3),die(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 Dr(e)}catch(t){return this.loggingService.catch("Error in getUserForClient: ",t),null}}getUserAvatarColor(e){try{return e?this.avatarService.generateUserColor(Nn(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)(ee(Pi),ee(Ft),ee(hm),ee(ni),ee(Le),ee(xo),ee(tt),ee(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var fm=class{constructor({apiKey:o,documentId:n,organizationId:e,folderId:t,veltFolderId:r,clientDocumentId:a,clientOrganizationId:s}){this.paths={},this.apiKey=o,this.documentId=n,this.organizationId=e,this.folderId=t,this.veltFolderId=r,this.clientDocumentId=a,this.clientOrganizationId=s,a&&(this.documentId=Tr(a)),s&&(this.organizationId=os(s)),t&&(this.folderId=t,this.veltFolderId=$i(t)),this.generateDocumentPaths()}generateDocumentPaths(){try{if(this.paths.clientDocumentId=this.clientDocumentId,this.paths.documentId=this.documentId,this.organizationId&&(this.paths.organizationId=this.organizationId,this.paths.clientOrganizationId=this.clientOrganizationId),this.veltFolderId&&(this.paths.folderId=this.folderId,this.paths.veltFolderId=this.veltFolderId),this.apiKey){let o=`${this.apiKey}`;this.organizationId&&(o=`${o}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${this.paths.organizationId}`),this.documentId&&(this.paths.docs=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/`,this.paths.folder=`${o}/${U.FIREBASE_PARTIAL_PATH_FOLDERS}/`,this.paths.presence=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_PRESENCE}/`,this.paths.cursor=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_CURSOR}/`,this.paths.comment=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_COMMENT}/`,this.paths.multiThread=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_MULTI_THREAD}/`,this.paths.tag=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_TAG}/`,this.paths.area=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_AREA}/`,this.paths.arrow=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_ARROW}/`,this.paths.selection=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_SELECTION}/`,this.paths.audioHuddle=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_AUDIO_HUDDLE}/`,this.paths.huddle=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_HUDDLE}/`,this.paths.recorder=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_RECORDER}/`,this.paths.flock=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_FOLLOW_ALONG}/`,this.paths.syncVideoPlayer=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_SYNC_VIDEO_PLAYER}/`,this.paths.liveState=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_LIVE_STATE}/`,this.paths.liveStateSingleEditorMode=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_LIVE_STATE}/default/singleEditorMode`,this.paths.reaction=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_REACTION}/`,this.paths.crdt=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_CRDT}/`,this.paths.views=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_VIEWS}/`,this.paths.notifications=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_NOTIFICATIONS}/`,this.paths.metadata=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_METADATA}/`,this.paths.users=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_USERS}/`,this.paths.documentIam=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_IAM}/`,this.paths.userConfig=`${o}/${U.FIREBASE_PARTIAL_PATH_USERS}`),this.paths.customerMetadata=`${o}/${U.FIREBASE_PARTIAL_PATH_CUSTOMER_METADATA}/`,this.paths.groupContacts=`${o}/${U.FIREBASE_PARTIAL_PATH_CONTACTS}/${U.FIREBASE_PARTIAL_PATH_GROUPS}/`,this.paths.globalContacts=`${o}/${U.FIREBASE_PARTIAL_PATH_CONTACTS}/${U.FIREBASE_PARTIAL_PATH_GLOBAL}/`,this.paths.logins=`${o}/${U.FIREBASE_PARTIAL_PATH_CONTACTS}/${U.FIREBASE_PARTIAL_PATH_LOGINS}/`,this.paths.userFeedback=`${o}/${U.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${U.FIREBASE_PARTIAL_PATH_FEEDBACK}/`,this.paths.userReportBugs=`${o}/${U.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${U.FIREBASE_PARTIAL_PATH_BUGS}/`,this.paths.userContactUs=`${o}/${U.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${U.FIREBASE_PARTIAL_PATH_CONTACT_US}/`,this.organizationId&&(this.paths.organizationMetadata=`${o}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATION_METADATA}/`,this.paths.organizationIam=`${o}/${U.FIREBASE_PARTIAL_PATH_IAM}/`,this.paths.organizationGroups=`${o}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATION_GROUPS}/`,this.paths.organizationNotifications=`${o}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/`,this.documentId&&(this.paths.organizationNotificationsWithDocumentId=`${o}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/`,this.paths.heartbeatByDocument=`${o}/${U.FIREBASE_PARTIAL_PATH_HEARTBEAT_BY_DOCUMENT}/${this.documentId}/`),this.paths.organizationNotificationsLastNotificationTimestamp=`${o}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${U.FIREBASE_PARTIAL_PATH_LAST_NOTIFICATION_TIMESTAMP}/${U.FIREBASE_PARTIAL_PATH_DOCS}/`,this.paths.organizationNotificationsUsers=`${o}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${U.FIREBASE_PARTIAL_PATH_USERS}/`,this.paths.heartbeat=`${o}/${U.FIREBASE_PARTIAL_PATH_HEARTBEAT}/`),this.paths.workspaceIam=`${this.apiKey}/${U.FIREBASE_PARTIAL_PATH_IAM}/`}}catch{}}get folder(){return this.paths.folder?this.paths.folder:this.throwError("Folder path is not available.")}get userConfig(){return this.paths.userConfig?this.paths.userConfig:this.throwError("User config path is not available.")}get workspaceIam(){return this.paths.workspaceIam?this.paths.workspaceIam:this.throwError("Workspace IAM path is not available.")}get docs(){return this.paths.docs?this.paths.docs:this.throwError("Docs path is not available.")}get presence(){return this.paths.presence?this.paths.presence:this.throwError("Presence path is not available.")}get cursor(){return this.paths.cursor?this.paths.cursor:this.throwError("Cursor path is not available.")}get area(){return this.paths.area?this.paths.area:this.throwError("Area path is not available.")}get arrow(){return this.paths.arrow?this.paths.arrow:this.throwError("Arrow path is not available.")}get comment(){return this.paths.comment?this.paths.comment:this.throwError("Comment path is not available.")}get multiThread(){return this.paths.multiThread?this.paths.multiThread:this.throwError("Multi thread path is not available.")}get tag(){return this.paths.tag?this.paths.tag:this.throwError("Tag path is not available.")}get selection(){return this.paths.selection?this.paths.selection:this.throwError("Selection path is not available.")}get audioHuddle(){return this.paths.audioHuddle?this.paths.audioHuddle:this.throwError("Audio huddle path is not available.")}get huddle(){return this.paths.huddle?this.paths.huddle:this.throwError("Huddle path is not available.")}get recorder(){return this.paths.recorder?this.paths.recorder:this.throwError("Recorder path is not available.")}get flock(){return this.paths.flock?this.paths.flock:this.throwError("Flock path is not available.")}get syncVideoPlayer(){return this.paths.syncVideoPlayer?this.paths.syncVideoPlayer:this.throwError("Sync video player path is not available.")}get liveState(){return this.paths.liveState?this.paths.liveState:this.throwError("Live state path is not available.")}get liveStateSingleEditorMode(){return this.paths.liveStateSingleEditorMode?this.paths.liveStateSingleEditorMode:this.throwError("Live state single editor mode path is not available.")}get reaction(){return this.paths.reaction?this.paths.reaction:this.throwError("Reaction path is not available.")}get crdt(){return this.paths.crdt?this.paths.crdt:this.throwError("CRDT path is not available.")}get views(){return this.paths.views?this.paths.views:this.throwError("Views path is not available.")}get notifications(){return this.paths.notifications?this.paths.notifications:this.throwError("Notifications path is not available.")}get metadata(){return this.paths.metadata?this.paths.metadata:this.throwError("Metadata path is not available.")}get users(){return this.paths.users?this.paths.users:this.throwError("Users path is not available.")}get documentIam(){return this.paths.documentIam?this.paths.documentIam:this.throwError("Document IAM path is not available.")}get organizationMetadata(){return this.paths.organizationMetadata?this.paths.organizationMetadata:this.throwError("Organization metadata path is not available.")}get organizationIam(){return this.paths.organizationIam?this.paths.organizationIam:this.throwError("Organization IAM path is not available.")}get customerMetadata(){return this.paths.customerMetadata?this.paths.customerMetadata:this.throwError("Customer metadata path is not available.")}get groupContacts(){return this.paths.groupContacts?this.paths.groupContacts:this.throwError("Group contacts path is not available.")}get globalContacts(){return this.paths.globalContacts?this.paths.globalContacts:this.throwError("Global contacts path is not available.")}get logins(){return this.paths.logins?this.paths.logins:this.throwError("Logins path is not available.")}get userFeedback(){return this.paths.userFeedback?this.paths.userFeedback:this.throwError("User feedback path is not available.")}get userReportBugs(){return this.paths.userReportBugs?this.paths.userReportBugs:this.throwError("User report bugs path is not available.")}get userContactUs(){return this.paths.userContactUs?this.paths.userContactUs:this.throwError("User contact us path is not available.")}get organizationGroups(){return this.paths.organizationGroups?this.paths.organizationGroups:this.throwError("Organization groups path is not available.")}get heartbeat(){return this.paths.heartbeat?this.paths.heartbeat:this.throwError("Heartbeat path is not available.")}get heartbeatByDocument(){return this.paths.heartbeatByDocument?this.paths.heartbeatByDocument:this.throwError("Heartbeat by document path is not available.")}get organizationNotifications(){return this.paths.organizationNotifications?this.paths.organizationNotifications:this.throwError("Organization notifications path is not available.")}get organizationNotificationsWithDocumentId(){return this.paths.organizationNotificationsWithDocumentId?this.paths.organizationNotificationsWithDocumentId:this.throwError("Organization notifications with document id path is not available.")}get organizationNotificationsUsers(){return this.paths.organizationNotificationsUsers?this.paths.organizationNotificationsUsers:this.throwError("Organization notifications users path is not available.")}get organizationNotificationsLastNotificationTimestamp(){return this.paths.organizationNotificationsLastNotificationTimestamp?this.paths.organizationNotificationsLastNotificationTimestamp:this.throwError("Organization notifications last notification timestamp path is not available.")}throwError(o){throw{type:"DocumentPaths",message:o,metadata:{apiKey:this.apiKey,documentId:this.documentId,organizationId:this.organizationId}}}};var d9=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=Tr(t)),r&&(this.organizationId=os(r)),a&&(this.folderId=a,this.veltFolderId=$i(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}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${this.paths.organizationId}`,this.paths.organization=o,this.paths.folder=`${o}/${U.FIREBASE_PARTIAL_PATH_FOLDERS}`,this.paths.organizationUsers=`${o}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATION_USERS}`,this.paths.users=`${o}/${U.FIREBASE_PARTIAL_PATH_CENTRAL_USERS}`,this.paths.notificationDocs=`${o}/${U.FIREBASE_PARTIAL_PATH_NOTIFICATION_DOCS}`,this.paths.notificationUsers=`${o}/${U.FIREBASE_PARTIAL_PATH_NOTIFICATION_USERS}`,this.paths.organizationGroups=`${o}/${U.FIREBASE_PARTIAL_PATH_GROUPS}`,this.paths.lastNotificationTimestamp=`${o}/${U.FIREBASE_PARTIAL_PATH_LAST_NOTIFICATION_TIMESTAMP}`,this.paths.userConfig=`${o}/${U.FIREBASE_PARTIAL_PATH_USERS}`,this.paths.permissionsUsers=`${o}/${U.FIREBASE_PARTIAL_PATH_PERMISSIONS_USERS}`),this.veltFolderId&&(this.paths.folderUsers=`${o}/${U.FIREBASE_PARTIAL_PATH_FOLDERS}/${this.veltFolderId}/${U.FIREBASE_PARTIAL_PATH_FOLDER_USERS}`),this.documentId&&(this.paths.document=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}`,this.paths.comment=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_COMMENT}`,this.paths.location=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_LOCATION}`,this.paths.multiThread=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_MULTI_THREAD}`,this.paths.area=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_AREA}`,this.paths.recorder=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_RECORDER}`,this.paths.reaction=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_REACTION}`,this.paths.crdt=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_CRDT}`,this.paths.notificationViews=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_NOTIFICATION_VIEWS}`,this.paths.documentViews=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_DOCUMENT_VIEWS}`,this.paths.locationViews=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_LOCATION_VIEWS}`,this.paths.documentUsers=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_DOCUMENT_USERS}`,this.paths.docNotification=`${this.paths.notificationDocs}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_DOC_NOTIFICATION}`)}}catch{}}get permissionsUsers(){return this.paths.permissionsUsers?this.paths.permissionsUsers:this.throwError("PermissionsUsers path is not available.")}get users(){return this.paths.users?this.paths.users:this.throwError("Users path is not available.")}get userConfig(){return this.paths.userConfig?this.paths.userConfig:this.throwError("UserConfig path is not available.")}get folder(){return this.paths.folder?this.paths.folder:this.throwError("Folder path is not available.")}get lastNotificationTimestamp(){return this.paths.lastNotificationTimestamp?this.paths.lastNotificationTimestamp:this.throwError("LastNotificationTimestamp path is not available.")}get organizationGroups(){return this.paths.organizationGroups?this.paths.organizationGroups:this.throwError("organizationGroups path is not available.")}get docNotification(){return this.paths.docNotification?this.paths.docNotification:this.throwError("DocNotification path is not available.")}get organization(){return this.paths.organization?this.paths.organization:this.throwError("Organization path is not available.")}get document(){return this.paths.document?this.paths.document:this.throwError("Document path is not available.")}get location(){return this.paths.location?this.paths.location:this.throwError("Location path is not available.")}get area(){return this.paths.area?this.paths.area:this.throwError("Area path is not available.")}get comment(){return this.paths.comment?this.paths.comment:this.throwError("Comment path is not available.")}get documentViews(){return this.paths.documentViews?this.paths.documentViews:this.throwError("DocumentViews path is not available.")}get locationViews(){return this.paths.locationViews?this.paths.locationViews:this.throwError("LocationViews path is not available.")}get notificationViews(){return this.paths.notificationViews?this.paths.notificationViews:this.throwError("NotificationViews path is not available.")}get documentUsers(){return this.paths.documentUsers?this.paths.documentUsers:this.throwError("DocumentUsers path is not available.")}get folderUsers(){return this.paths.folderUsers?this.paths.folderUsers:this.throwError("FolderUsers path is not available.")}get organizationUsers(){return this.paths.organizationUsers?this.paths.organizationUsers:this.throwError("OrganizationUsers path is not available.")}get notificationDocs(){return this.paths.notificationDocs?this.paths.notificationDocs:this.throwError("NotificationDocs path is not available.")}get notificationUsers(){return this.paths.notificationUsers?this.paths.notificationUsers:this.throwError("NotificationUsers path is not available.")}get multiThread(){return this.paths.multiThread?this.paths.multiThread:this.throwError("Multi thread path is not available.")}get recorder(){return this.paths.recorder?this.paths.recorder:this.throwError("Recorder path is not available.")}get reaction(){return this.paths.reaction?this.paths.reaction:this.throwError("Reaction path is not available.")}get crdt(){return this.paths.crdt?this.paths.crdt:this.throwError("CRDT path is not available.")}throwError(o){throw{type:"DocumentPaths",message:o,metadata:{apiKey:this.apiKey,documentId:this.documentId,organizationId:this.organizationId}}}};var m9=class{};var In=(()=>{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(vM(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)(ee(je),ee(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Js=(()=>{let o=class o{constructor(e,t,r){this.coreActionsService=e,this.loggingService=t,this.analyticsService=r,this.resolveTimeout=60*1e3,this.retrySaveConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryDeleteConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryGetConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.commentAnnotationDataProvider$=new ve(null),this.commentAnnotationById$=new ve({}),this.fieldsToRemove=[],this.getCommentAnnotationById=a=>{try{return this.commentAnnotationDataProviderAvailable()?this.commentAnnotationById$.value?.[a]:void 0}catch(s){this.loggingService.catch("Error in CommentAnnotationsResolverService getCommentAnnotationById:",s);return}};try{this.loggingService.log("CommentAnnotationsResolverService initialized"),this.commentAnnotationDataProvider$.subscribe(a=>{a&&(a.config?.resolveTimeout&&(this.resolveTimeout=a.config.resolveTimeout),a.config?.saveRetryConfig&&(this.retrySaveConfig=a.config.saveRetryConfig),a.config?.deleteRetryConfig&&(this.retryDeleteConfig=a.config.deleteRetryConfig),a.config?.getRetryConfig&&(this.retryGetConfig=a.config.getRetryConfig),a.config?.fieldsToRemove&&(this.fieldsToRemove=a.config.fieldsToRemove))})}catch(a){this.loggingService.catch("Error in CommentAnnotationsResolverService constructor:",a)}}getProvider(){try{let e=this.commentAnnotationDataProvider$.getValue();return e||void 0}catch(e){this.loggingService.catch("Error in CommentAnnotationsResolverService getProvider:",e);return}}ngOnDestroy(){try{this.commentAnnotationById$.next({})}catch(e){this.loggingService.catch("Error in CommentAnnotationsResolverService ngOnDestroy:",e)}}resolveCommentAnnotations(e,t){return Q(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling CommentAnnotationsResolverService FUNCTION: resolveCommentAnnotations","color: green;"),!this.commentAnnotationDataProviderAvailable())return{};let r,a=!1,s=!1,c=()=>{r&&(clearTimeout(r),r=void 0,s=!0)};return new Promise((p,g)=>{r=setTimeout(()=>{if(!s){a=!0,c();let z=t||vt();this.coreActionsService.triggerAction(ct.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:z,methodName:No.RESOLVE_COMMENT_ANNOTATIONS,source:"internal",payload:{error:new Error("Comment annotation resolution timeout"),request:e}}),g(new Error("Comment annotation resolution timeout"))}},this.commentAnnotationDataProvider$.value?.config?.resolveTimeout||this.resolveTimeout);let f=this.getProvider();if(!f)return c(),p({});let I={},T=[...new Set(e.commentAnnotationIds||[])],L=D(E({},e),{commentAnnotationIds:T});Q(this,null,function*(){try{if(T.length>0||e.documentIds?.length||e.folderId){let z=t||vt();this.coreActionsService.triggerAction(ct.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_RESOLUTION_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:z,methodName:No.RESOLVE_COMMENT_ANNOTATIONS,source:"internal",payload:{request:L}});let J=md(()=>f?.get(L)||Promise.resolve(void 0),"getCommentAnnotations",this.retryGetConfig).then(le=>a?{}:(c(),le&&le.statusCode!==200?(this.coreActionsService.triggerAction(ct.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:z,methodName:No.RESOLVE_COMMENT_ANNOTATIONS,source:"internal",payload:{result:le,request:L}}),this.loggingService.catch(le?.message??"Error in CommentAnnotationsResolverService resolveCommentAnnotations:"),{}):le?.data)).catch(le=>{throw c(),le});try{I=(yield J)||{},this.analyticsService.trackEvent(Y.Events.Resolver.COMMENT_RESOLVER_GET,{sourceMethod:"resolveCommentAnnotations",source:"sdk",commentAnnotationIds:T});let le={};Object.entries(I).forEach(([_e,De])=>{let Be=this.commentAnnotationById$.value?.[_e];Be?Be&&JSON.stringify(Be)!==JSON.stringify(De)&&(le[_e]=De):le[_e]=De}),Object.keys(le).length>0&&this.commentAnnotationById$.next(E(E({},this.commentAnnotationById$.getValue()),le)),this.coreActionsService.triggerAction(ct.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_RESOLUTION_RESULT,timestamp:new Date().getTime(),uniqueId:z,methodName:No.RESOLVE_COMMENT_ANNOTATIONS,source:"internal",payload:{result:le,request:L}}),p(le)}catch(le){let _e=t||vt();this.coreActionsService.triggerAction(ct.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:_e,methodName:No.RESOLVE_COMMENT_ANNOTATIONS,source:"internal",payload:{error:le,request:L}}),a||g(le),p(I)}}else c(),p({})}catch(z){c();let J=t||vt();this.coreActionsService.triggerAction(ct.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:J,methodName:No.RESOLVE_COMMENT_ANNOTATIONS,source:"internal",payload:{error:z,request:L}}),g(z)}})})}catch(r){this.loggingService.catch("Error in CommentAnnotationsResolverService resolveCommentAnnotations:",r);let a=t||vt();return this.coreActionsService.triggerAction(ct.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:No.RESOLVE_COMMENT_ANNOTATIONS,source:"internal",payload:{error:r,request:e}}),{}}})}saveCommentAnnotation(e,t){return Q(this,null,function*(){try{this.loggingService.log("%c[WB] Calling CommentAnnotationsResolverService FUNCTION: saveCommentAnnotation","color: green;");let r=this.getProvider();if(!this.commentAnnotationDataProviderAvailable())throw new Error("Comment annotation save data provider not available");let a=t||vt();this.coreActionsService.triggerAction(ct.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_SAVE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:a,methodName:No.SAVE_COMMENT_ANNOTATION,source:"internal",payload:{request:e}});let s=JSON.parse(JSON.stringify(this.commentAnnotationById$.getValue()));this.commentAnnotationById$._value=E(E({},s),e.commentAnnotation);let c=yield md(()=>r?.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 c&&c.statusCode!==200?(this.retrySaveConfig.revertOnFailure&&(this.commentAnnotationById$._value=s),this.loggingService.catch(c?.message??"Error in CommentAnnotationsResolverService saveCommentAnnotation:"),this.coreActionsService.triggerAction(ct.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:No.SAVE_COMMENT_ANNOTATION,source:"internal",payload:{error:c,request:e}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(Y.Events.Resolver.COMMENT_RESOLVER_SAVE,{sourceMethod:"saveCommentAnnotation",source:"sdk",commentAnnotationIds:Object.keys(e.commentAnnotation),eventType:e.eventType,commentId:e.commentId}),this.coreActionsService.triggerAction(ct.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_SAVE_RESULT,timestamp:new Date().getTime(),uniqueId:a,methodName:No.SAVE_COMMENT_ANNOTATION,source:"internal",payload:{result:{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0},request:e}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0})}catch(r){this.loggingService.warn("Error in CommentAnnotationsResolverService saveCommentAnnotation:",r);let a=t||vt();return this.coreActionsService.triggerAction(ct.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:No.SAVE_COMMENT_ANNOTATION,source:"internal",payload:{error:r,request:e}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0}}})}deleteCommentAnnotation(e,t,r){return Q(this,null,function*(){try{this.loggingService.log("%c[WB] Calling CommentAnnotationsResolverService FUNCTION: deleteCommentAnnotation","color: green;");let a=this.getProvider();if(!this.commentAnnotationDataProviderAvailable())throw new Error("Comment annotation delete data provider not available");let s=r||vt();this.coreActionsService.triggerAction(ct.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_DELETE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:s,methodName:No.DELETE_COMMENT_ANNOTATION,source:"internal",payload:{commentAnnotationId:e.toString(),metadata:t}});let c=this.commentAnnotationById$.getValue(),p=E({},c);delete p?.[e],this.commentAnnotationById$._value=p;let g=yield md(()=>a?.delete({commentAnnotationId:e.toString(),metadata:t,event:va.COMMENT_ANNOTATION_DELETE})||Promise.resolve(void 0),"deleteCommentAnnotation",this.retryDeleteConfig);return g&&g.statusCode!==200?(this.retryDeleteConfig.revertOnFailure&&(this.commentAnnotationById$._value=c),this.loggingService.catch(g?.message??"Error in CommentAnnotationsResolverService deleteCommentAnnotation:"),this.coreActionsService.triggerAction(ct.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:s,methodName:No.DELETE_COMMENT_ANNOTATION,source:"internal",payload:{error:g,commentAnnotationId:e.toString(),metadata:t}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(Y.Events.Resolver.COMMENT_RESOLVER_DELETE,{sourceMethod:"deleteCommentAnnotation",source:"sdk",commentAnnotationId:e.toString()}),this.coreActionsService.triggerAction(ct.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_DELETE_RESULT,timestamp:new Date().getTime(),uniqueId:s,methodName:No.DELETE_COMMENT_ANNOTATION,source:"internal",payload:{result:{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0},commentAnnotationId:e.toString(),metadata:t}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0})}catch(a){this.loggingService.warn("Error in CommentAnnotationsResolverService deleteCommentAnnotation:",a);let s=r||vt();return this.coreActionsService.triggerAction(ct.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:s,methodName:No.DELETE_COMMENT_ANNOTATION,source:"internal",payload:{error:a,commentAnnotationId:e.toString(),metadata:t}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0}}})}getCommentAnnotationsById$(){try{return this.commentAnnotationDataProviderAvailable()?(this.loggingService.log("%c[WB] Calling CommentAnnotationsResolverService FUNCTION: getCommentAnnotationsById$","color: green;"),this.commentAnnotationById$.asObservable()):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)(ee(ni),ee(y),ee(tt))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var vm=(()=>{let o=class o{constructor(e,t,r){this.coreActionsService=e,this.loggingService=t,this.analyticsService=r,this.resolveTimeout=60*1e3,this.retrySaveConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryDeleteConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryGetConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.reactionAnnotationDataProvider$=new ve(null),this.reactionAnnotationById$=new ve({}),this.getReactionAnnotationById=a=>{try{return this.reactionAnnotationDataProviderAvailable()?this.reactionAnnotationById$.value?.[a]:void 0}catch(s){this.loggingService.catch("Error in ReactionAnnotationsResolverService getReactionAnnotationById:",s);return}};try{this.loggingService.log("ReactionAnnotationsResolverService initialized"),this.reactionAnnotationDataProvider$.subscribe(a=>{a&&(a.config?.resolveTimeout&&(this.resolveTimeout=a.config.resolveTimeout),a.config?.saveRetryConfig&&(this.retrySaveConfig=a.config.saveRetryConfig),a.config?.deleteRetryConfig&&(this.retryDeleteConfig=a.config.deleteRetryConfig),a.config?.getRetryConfig&&(this.retryGetConfig=a.config.getRetryConfig))})}catch(a){this.loggingService.catch("Error in ReactionAnnotationsResolverService constructor:",a)}}getProvider(){try{let e=this.reactionAnnotationDataProvider$.getValue();return e||void 0}catch(e){this.loggingService.catch("Error in ReactionAnnotationsResolverService getProvider:",e);return}}ngOnDestroy(){try{this.reactionAnnotationById$.next({})}catch(e){this.loggingService.catch("Error in ReactionAnnotationsResolverService ngOnDestroy:",e)}}resolveReactionAnnotations(e,t){return Q(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling ReactionAnnotationsResolverService FUNCTION: resolveReactionAnnotations","color: green;"),!this.reactionAnnotationDataProviderAvailable())return{};let r,a=!1,s=!1,c=()=>{r&&(clearTimeout(r),r=void 0,s=!0)};return new Promise((p,g)=>{r=setTimeout(()=>{if(!s){a=!0,c();let z=t||vt();this.coreActionsService.triggerAction(ct.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:z,methodName:Ho.RESOLVE_REACTION_ANNOTATIONS,source:"internal",payload:{error:new Error("Reaction annotation resolution timeout"),request:e}}),g(new Error("Reaction annotation resolution timeout"))}},this.reactionAnnotationDataProvider$.value?.config?.resolveTimeout||this.resolveTimeout);let f=this.getProvider();if(!f)return c(),p({});let I={},T=[...new Set(e.reactionAnnotationIds||[])],L=D(E({},e),{reactionAnnotationIds:T});Q(this,null,function*(){try{if(T.length>0||e.documentIds?.length||e.folderId){let z=t||vt();this.coreActionsService.triggerAction(ct.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_RESOLUTION_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:z,methodName:Ho.RESOLVE_REACTION_ANNOTATIONS,source:"internal",payload:{request:L}});let J=md(()=>f?.get(L)||Promise.resolve(void 0),"getReactionAnnotations",this.retryGetConfig).then(le=>a?{}:(c(),le&&le.statusCode!==200?(this.coreActionsService.triggerAction(ct.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:z,methodName:Ho.RESOLVE_REACTION_ANNOTATIONS,source:"internal",payload:{result:le,request:L}}),this.loggingService.catch(le?.message??"Error in ReactionAnnotationsResolverService resolveReactionAnnotations:"),{}):le?.data)).catch(le=>{throw c(),le});try{I=(yield J)||{},this.analyticsService.trackEvent(Y.Events.Resolver.REACTION_RESOLVER_GET,{sourceMethod:"resolveReactionAnnotations",source:"sdk",reactionAnnotationIds:T});let le={};Object.entries(I).forEach(([_e,De])=>{let Be=this.reactionAnnotationById$.value?.[_e];Be?Be&&JSON.stringify(Be)!==JSON.stringify(De)&&(le[_e]=De):le[_e]=De}),Object.keys(le).length>0&&this.reactionAnnotationById$.next(E(E({},this.reactionAnnotationById$.getValue()),le)),this.coreActionsService.triggerAction(ct.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_RESOLUTION_RESULT,timestamp:new Date().getTime(),uniqueId:z,methodName:Ho.RESOLVE_REACTION_ANNOTATIONS,source:"internal",payload:{result:le,request:L}}),p(le)}catch(le){let _e=t||vt();this.coreActionsService.triggerAction(ct.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:_e,methodName:Ho.RESOLVE_REACTION_ANNOTATIONS,source:"internal",payload:{error:le,request:L}}),a||g(le),p(I)}}else c(),p({})}catch(z){c();let J=t||vt();this.coreActionsService.triggerAction(ct.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:J,methodName:Ho.RESOLVE_REACTION_ANNOTATIONS,source:"internal",payload:{error:z,request:L}}),g(z)}})})}catch(r){this.loggingService.catch("Error in ReactionAnnotationsResolverService resolveReactionAnnotations:",r);let a=t||vt();return this.coreActionsService.triggerAction(ct.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:Ho.RESOLVE_REACTION_ANNOTATIONS,source:"internal",payload:{error:r,request:e}}),{}}})}saveReactionAnnotation(e,t){return Q(this,null,function*(){try{this.loggingService.log("%c[WB] Calling ReactionAnnotationsResolverService FUNCTION: saveReactionAnnotation","color: green;");let r=this.getProvider();if(!this.reactionAnnotationDataProviderAvailable())throw new Error("Reaction annotation save data provider not available");let a=t||vt();this.coreActionsService.triggerAction(ct.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_SAVE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:a,methodName:Ho.SAVE_REACTION_ANNOTATION,source:"internal",payload:{request:e}});let s=JSON.parse(JSON.stringify(this.reactionAnnotationById$.getValue()));this.reactionAnnotationById$._value=E(E({},s),e);let c={reactionAnnotation:e,event:va.REACTION_ADD,metadata:Object.values(e??{})?.[0]?.metadata},p=yield md(()=>r?.save(c)||Promise.resolve(void 0),"saveReactionAnnotation",this.retrySaveConfig);return p&&p.statusCode!==200?(this.retrySaveConfig.revertOnFailure&&(this.reactionAnnotationById$._value=s),this.loggingService.catch(p?.message??"Error in ReactionAnnotationsResolverService saveReactionAnnotation:"),this.coreActionsService.triggerAction(ct.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:Ho.SAVE_REACTION_ANNOTATION,source:"internal",payload:{error:p,request:e}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(Y.Events.Resolver.REACTION_RESOLVER_SAVE,{sourceMethod:"saveReactionAnnotation",source:"sdk",reactionAnnotationIds:Object.keys(e),eventType:c.event}),this.coreActionsService.triggerAction(ct.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_SAVE_RESULT,timestamp:new Date().getTime(),uniqueId:a,methodName:Ho.SAVE_REACTION_ANNOTATION,source:"internal",payload:{result:{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0},request:e}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0})}catch(r){this.loggingService.warn("Error in ReactionAnnotationsResolverService saveReactionAnnotation:",r);let a=t||vt();return this.coreActionsService.triggerAction(ct.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:Ho.SAVE_REACTION_ANNOTATION,source:"internal",payload:{error:r,request:e}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0}}})}deleteReactionAnnotation(e,t,r){return Q(this,null,function*(){try{this.loggingService.log("%c[WB] Calling ReactionAnnotationsResolverService FUNCTION: deleteReactionAnnotation","color: green;");let a=this.getProvider();if(!this.reactionAnnotationDataProviderAvailable())throw new Error("Reaction annotation delete data provider not available");let s=r||vt();this.coreActionsService.triggerAction(ct.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_DELETE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:s,methodName:Ho.DELETE_REACTION_ANNOTATION,source:"internal",payload:{reactionAnnotationId:e.toString(),metadata:t}});let c=JSON.parse(JSON.stringify(this.reactionAnnotationById$.getValue())),p=E({},c);delete p?.[e],this.reactionAnnotationById$._value=p;let g=yield md(()=>a?.delete({reactionAnnotationId:e.toString(),metadata:t,event:va.REACTION_DELETE})||Promise.resolve(void 0),"deleteReactionAnnotation",this.retryDeleteConfig);return g&&g.statusCode!==200?(this.retryDeleteConfig.revertOnFailure&&(this.reactionAnnotationById$._value=c),this.loggingService.catch(g?.message??"Error in ReactionAnnotationsResolverService deleteReactionAnnotation:"),this.coreActionsService.triggerAction(ct.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:s,methodName:Ho.DELETE_REACTION_ANNOTATION,source:"internal",payload:{error:g,reactionAnnotationId:e.toString(),metadata:t}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(Y.Events.Resolver.REACTION_RESOLVER_DELETE,{sourceMethod:"deleteReactionAnnotation",source:"sdk",reactionAnnotationId:e.toString()}),this.coreActionsService.triggerAction(ct.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_DELETE_RESULT,timestamp:new Date().getTime(),uniqueId:s,methodName:Ho.DELETE_REACTION_ANNOTATION,source:"internal",payload:{result:{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0},reactionAnnotationId:e.toString(),metadata:t}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0})}catch(a){this.loggingService.warn("Error in ReactionAnnotationsResolverService deleteReactionAnnotation:",a);let s=r||vt();return this.coreActionsService.triggerAction(ct.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:s,methodName:Ho.DELETE_REACTION_ANNOTATION,source:"internal",payload:{error:a,reactionAnnotationId:e.toString(),metadata:t}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0}}})}getReactionAnnotationsById$(){try{return this.reactionAnnotationDataProviderAvailable()?(this.loggingService.log("%c[WB] Calling ReactionAnnotationsResolverService FUNCTION: getReactionAnnotationsById$","color: green;"),this.reactionAnnotationById$.asObservable()):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)(ee(ni),ee(y),ee(tt))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var rt=(()=>{let o=class o{constructor(e,t,r,a,s,c,p,g,f,I){this.analyticsService=e,this.authService=t,this.databaseService=r,this.domService=a,this.configService=s,this.loggingService=c,this.commentResolverService=p,this.reactionResolverService=g,this.coreActionsService=f,this.functions=I,this.documentPaths$=new ve(null),this.docContext$=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 nt,this.DEBOUNCE_TIME=5e3,this.MAX_QUEUE_SIZE=100,this.queueSize=0,this.isDocumentIdInDebounceQueue=!1,this.currentValidationToken=null,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(Ao(this.DEBOUNCE_TIME)).subscribe({next:T=>Q(this,null,function*(){try{yield this.setDocumentIdImpl(T.documentId,T.clientOrganizationId,T.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:T=>{this.loggingService.catch("Error in setDocumentId subscription:",T),this.queueSize--}}),this.databaseService.getDb().pipe(Fe(T=>!!T),ot(1)).subscribe(T=>{T&&(this.db=T)}),this.configService.getApiKey$().subscribe(T=>{if(this.apiKey=T,this.apiKey){if(!this.isCustomDocId){let L=Mk(window.location.href);this.currentUrl=L}this.analyticsService.updateDefaultProperties({apiKey:T})}}),this.authService.getUser$().subscribe(T=>Q(this,null,function*(){if(T&&(this.analyticsService.updateDefaultProperties({organizationId:T?.organizationId,clientOrganizationId:T?.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&&T?.organizationId&&this.documentPaths$.value?.organizationId!==T?.organizationId&&(yield this.setDocuments({documents:this.documentIds$.value.length?this.documentIds$.value.map(L=>({id:L.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),T?.organizationId&&T?.clientOrganizationId)){let L={organizationId:T?.organizationId,clientOrganizationId:T?.clientOrganizationId};this.getOrganizationConfig()||this.organizationConfig$.next({organizationId:T?.organizationId,clientOrganizationId:T?.clientOrganizationId}),yield this.updateOrganizationMetadata(L)}})),this.documentPaths$.subscribe(T=>{let L={documentId:T?.documentId,clientDocumentId:T?.clientDocumentId,folderId:T?.folderId,allDocuments:T?.allDocuments,veltFolderId:T?.veltFolderId};T?.organizationId&&(L.organizationId=T.organizationId,L.clientOrganizationId=T.clientOrganizationId),this.analyticsService.updateDefaultProperties(L),this.domService.resetSelectedAnnotationsMap()}),this.location$.subscribe(T=>{this.analyticsService.updateDefaultProperties({clientLocation:T?.location,locationId:T?.locationId})}),this.organizationMetadata$.subscribe(T=>{this.authService.setUserOrganization(T?.[this.documentPaths$.value?.organizationId])}),this.documentPaths$.pipe(Fe(T=>!!T),ot(1)).subscribe(()=>{try{this.subscribeToCustomerMetadata()}catch(T){this.loggingService.catch("Error in DocService subscribeToCustomerMetadata:",T)}},T=>{this.loggingService.catch("Error in DocService subscribeToCustomerMetadata:",T)}),this.loggingService.log("%c[WB] Creating CLASS: DocService 2","color: blue;"),this.onWindowPopstate(),this.onWindowClick()}catch(T){this.loggingService.catch("Error in DocService constructor:",T)}}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)}}setUserPermissionService(e){try{this.userPermissionService=e}catch(t){this.loggingService.catch("Error in setUserPermissionService:",t)}}setCommentService(e){try{this.commentService=e}catch(t){this.loggingService.catch("Error in setCommentService:",t)}}onWindowPopstate(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowPopstate","color: green;");try{this.domService.onWindowPopState$().subscribe(()=>{this.loggingService.log("location",location.href);let e=Mk(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=Mk(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(Y.Events.Core.SET_DOCUMENTS_TRIGGERED,{payload:{id:e,documentMetadata:t,methodName:"setDocument",source:a}}),this.coreActionsService.triggerAction(ct.INIT_UPDATE,{event:Y.Events.Core.SET_DOCUMENTS_TRIGGERED,methodName:Fa.SET_DOCUMENTS,source:a,payload:{documentId:e,documentMetadata:t,options:r}}),yield this.setDocumentsImpl({documents:[{id:e,metadata:t}],options:E({organizationId:t?.organizationId},r??{}),source:a})}catch(c){this.loggingService.catch("Error in DocService setDocument:",c)}})}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(g=>g.clientDocumentId),c=QH(this.getOptionsFromDocumentPaths()??{})??{};return!e.every(g=>s.includes(g.id))||!ui(c,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,c=`${Nn(s)}`;t&&a?.metadata&&typeof a.metadata=="object"&&(this.clientDocumentMetadataMap[s]=a.metadata),r.push({documentId:c,clientDocumentId:s})}),r}catch(r){return this.loggingService.catch("Error in DocService getDocumentIdsFromDocuments:",r),[]}}setDocuments(s){return Q(this,arguments,function*({documents:e,options:t,source:r="internal",skipPermissionValidation:a=!1}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocuments","color: green;"),r==="internal"&&this.analyticsService.trackEvent(Y.Events.Core.SET_DOCUMENTS_TRIGGERED,{payload:{documents:e,options:t,methodName:"setDocuments",source:r}}),this.coreActionsService.triggerAction(ct.INIT_UPDATE,{event:Y.Events.Core.SET_DOCUMENTS_TRIGGERED,methodName:Fa.SET_DOCUMENTS,source:r,payload:{documents:e,options:t}}),yield this.setDocumentsImpl({documents:e,options:t??{},source:r,skipPermissionValidation:a})}catch(c){this.loggingService.catch("Error in DocService setDocuments:",c)}})}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(ct.INIT_UPDATE,{event:Y.Events.Core.SET_ROOT_DOCUMENT_TRIGGERED,methodName:Fa.SET_ROOT_DOCUMENT,source:t,payload:{document:e}});let a=this.getOptionsFromDocumentPaths()??{},s=this.documentIds$.value.map(c=>c.clientDocumentId);if(!s.includes(e.id)){let c=[...s.map(g=>({id:g})),{id:e.id}],p=this.getDocumentIdsFromDocuments({documents:c,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)}})}setDocContext(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocContext","color: green;");let t=JSON.parse(JSON.stringify(e??null));this.docContext$.next(t)}catch(t){this.loggingService.catch("Error in setDocContext: ",t)}}getDocContext(){return this.docContext$.getValue()}getDocContext$(){return this.docContext$.asObservable().pipe(_t(Xt))}getProcessedDocContext(){return oce(this.getDocContext())}filterRelevantDocuments(a){return Q(this,arguments,function*({options:e,documentIds:t,skipPermissionValidation:r=!1}){try{let s=this.authService.getUser();return!s||!this.commonDbService?.shouldUseFirestore()||(t=yield this.fetchDocumentsFromFolder(e,t,s),yield this.handlePermissionProvider(e,t,s),t=yield this.filterDocumentsByPermissions(e,t,s,r),t=t.slice(0,50)),t}catch(s){return this.loggingService.catch("Error in DocService filterRelevantDocuments:",s),t}})}fetchDocumentsFromFolder(e,t,r){return Q(this,null,function*(){if(!e?.folderId||!e?.allDocuments)return t;try{let a=Xi(this.functions,Qi({url:wn?.cloudFunction?.sdkProxy,apiProxyDomain:this.configService?.getApiProxyDomain()}));(yield pd({methodName:"getDocuments",data:{type:"getDocuments",metadata:{organizationId:e?.organizationId??r?.clientOrganizationId,folderId:e?.folderId}},getSdkProxy:a,userId:r?.userId??""}))?.data?.forEach(c=>{t.find(p=>p.clientDocumentId===c.id)||t.push({documentId:Tr(c.id),clientDocumentId:c.id})})}catch(a){this.loggingService.warn("Error in DocService fetchDocumentsFromFolder:",a)}return t})}buildPermissionRequests(e,t,r){try{let a=[];return e.organizationId&&e.organizationId!==r.clientOrganizationId&&a.push({userId:r.userId,resource:{id:e.organizationId,type:Fo.ORGANIZATION,source:Hi.SET_DOCUMENTS,organizationId:e.organizationId}}),e.folderId&&a.push({userId:r.userId,resource:{id:e.folderId,type:Fo.FOLDER,source:Hi.SET_DOCUMENTS,organizationId:e?.organizationId??r?.clientOrganizationId??""}}),t&&t.forEach(s=>{a.push({userId:r.userId,resource:{id:s.clientDocumentId,type:Fo.DOCUMENT,source:Hi.SET_DOCUMENTS,organizationId:e?.organizationId??r?.clientOrganizationId??""}})}),e?.context&&this.userPermissionService?.getIsContextEnabled()&&rce({input:e?.context}).forEach(c=>{let p=JSON.stringify(c.access);a.push({userId:r.userId,resource:{id:p,type:Fo.CONTEXT,source:Hi.SET_DOCUMENTS,organizationId:e?.organizationId??r?.clientOrganizationId??"",context:c}})}),a}catch(a){return this.loggingService.catch("Error in buildPermissionRequests:",a),[]}}processAccessibleContexts(e,t){try{if(!e?.success||!e?.data?.length||!this.userPermissionService?.getIsContextEnabled())return;let r=e.data.filter(a=>a.type===Fo.CONTEXT&&a.hasAccess).map(a=>a.resourceId);if(this.loggingService.logContext("[CONTEXT] processAccessibleContexts called with accessibleContextIds:",JSON.parse(JSON.stringify(r??"nil"))),r?.length){let a=t.filter(c=>r.includes(c.resource.id)).map(c=>c.resource.context).filter(c=>!!c),s=ace({input:a});this.loggingService.logContext("[CONTEXT] processAccessibleContexts called with accessibleContext:",JSON.parse(JSON.stringify(s??"nil"))),s?.access&&(this.loggingService.logContext("[CONTEXT] setting accessibleContext in docContext:",JSON.parse(JSON.stringify(s??"nil"))),this.setDocContext(s))}}catch(r){this.loggingService.catch("Error in processAccessibleContexts:",r)}}handlePermissionProvider(e,t,r){return Q(this,null,function*(){if(this.userPermissionService?.isPermissionProviderAvailable())try{this.loggingService.logContext("[CONTEXT] handlePermissionProvider called with options:",JSON.parse(JSON.stringify(e??"nil")),"documentIds:",JSON.parse(JSON.stringify(t??"nil")),"user:",JSON.parse(JSON.stringify(r??"nil")));let a=this.buildPermissionRequests(e,t,r),s=vt();this.coreActionsService.triggerAction(ct.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.RESOURCE_ACCESS_REQUEST_FORMED,methodName:Hi.SET_DOCUMENTS,uniqueId:s,timestamp:new Date().getTime(),source:"internal",payload:{requests:a}});let c=yield this.userPermissionService?.onResourceAccessRequired({requests:a,uniqueId:s,methodName:Hi.SET_DOCUMENTS,fromCache:!1});this.loggingService.logContext("[CONTEXT] handlePermissionProvider called with res:",JSON.parse(JSON.stringify(c??"nil")),"requests:",JSON.parse(JSON.stringify(a??"nil"))),this.processAccessibleContexts(c,a)}catch(a){this.loggingService.catch("Error in handlePermissionProvider:",a)}})}filterDocumentsByPermissions(e,t,r,a=!1){return Q(this,null,function*(){if(a)return t;this.loggingService.logContext("[CONTEXT] filterDocumentsByPermissions called with options:",JSON.parse(JSON.stringify(e??"nil")),"documentIds:",JSON.parse(JSON.stringify(t??"nil")),"user:",JSON.parse(JSON.stringify(r??"nil")));let s=this.currentValidationToken,c=[...t];return s&&this.validatePermissionsInBackground(e,t,r,s),c})}validatePermissionsInBackground(e,t,r,a){let s=e?.organizationId??r?.clientOrganizationId;this.userPermissionService?.getUserPermissions({organizationId:s,documentIds:t.map(c=>c.clientDocumentId),folderIds:e?.folderId?[e?.folderId]:[]}).then(c=>{if(this.currentValidationToken===a&&c){this.userPermissionService?.setCurrentUserPermissions(c);let p=[];Object.entries(c?.[r.userId]?.documents??{}).forEach(([g,f])=>{f?.errorCode===Lo.PERMISSION_DENIED&&p.push(g)}),s&&c?.[r.userId]?.organization?.[s]?.errorCode===Lo.PERMISSION_DENIED&&this.loggingService.catch(`User does not have access to organization: ${s}`,void 0,void 0,!0),e?.folderId&&c?.[r.userId]?.folders?.[e?.folderId]?.errorCode===Lo.PERMISSION_DENIED&&this.loggingService.catch(`User does not have access to folder: ${e?.folderId}`,void 0,void 0,!0),p.length>0&&(this.loggingService.catch(`User does not have access to documents: ${p.join(", ")}`,void 0,void 0,!0),this.handleDeniedDocumentAccess(p,r,a))}}).catch(c=>{this.loggingService.catch("Error in background permission validation:",c)})}handleDeniedDocumentAccess(e,t,r){try{if(this.currentValidationToken!==r)return;let a=this.documentPaths$.value;this.coreActionsService.triggerAction(ct.ERROR,{event:Y.Events.Core.SDK_ERROR,sourceMethod:"handleDeniedDocumentAccess",message:"Access denied to document after optimistic load",documentIds:e,userId:t.userId,timestamp:new Date().getTime()});let s=this.documentIds$.value||[],c=s.filter(p=>!e.includes(p.clientDocumentId));c.length!==s.length&&(c.length>0?this.setDocuments({documents:c.map(p=>({id:p.clientDocumentId})),options:{organizationId:a?.clientOrganizationId},source:"internal",skipPermissionValidation:!0}):(this.loggingService.catch("Error in DocService handleDeniedDocumentAccess: Documents provided are all denied"),this.coreActionsService.triggerAction(ct.ERROR,{event:Y.Events.Core.SDK_ERROR,sourceMethod:"handleDeniedDocumentAccess",message:"All documents provided are denied",documentIds:e,userId:t.userId,timestamp:new Date().getTime()}),this.unsetDocuments({source:"internal"})))}catch(a){this.loggingService.catch("Error in handleDeniedDocumentAccess:",a)}}addUserInfoToOrganization(r){return Q(this,arguments,function*({organizationId:e,user:t}){try{let a=Xi(this.functions,Qi({url:wn?.cloudFunction?.sdkProxy,apiProxyDomain:this.configService?.getApiProxyDomain()}));yield pd({data:{type:"addUserInfoToOrganization",metadata:{organizationId:e},user:t},getSdkProxy:a,userId:t?.userId??""})}catch(a){this.loggingService.warn("Error in DocService addUserInfoToOrganization:",a)}})}setDocumentsImpl(s){return Q(this,arguments,function*({documents:e,options:t,source:r,skipPermissionValidation:a=!1}){try{this.loggingService.logContext("[CONTEXT] setDocumentsImpl called with documents:",JSON.parse(JSON.stringify(e??"nil")),"options:",JSON.parse(JSON.stringify(t??"nil")));let c=t?.organizationId??this.documentPaths$.value?.clientOrganizationId;if(!this.shouldSetDocumentsAgain(e,QH(D(E({},t),{organizationId:c})))){r==="external"&&this.loggingService.catch("setDocuments called with previous request");return}let p=vt();this.currentValidationToken=p;let g=this.getDocumentIdsFromDocuments({documents:e,setClientDocumentMetadataMap:!0});if(g?.length===0){this.loggingService.warn("Minimum one document must be set in setDocuments");return}let f=this.authService.getUser();if(!f){this.draftDocuments=e,this.draftOptions=t;return}this.documentPaths$.value?.organizationId&&t?.organizationId&&this.documentPaths$.value?.organizationId!==t?.organizationId?this.authService.resetServicesCache():this.unsetDocuments({source:"internal",unsetDocumentPaths:!1});let I=t?.organizationId??f?.clientOrganizationId;if(I&&this.addUserInfoToOrganization({organizationId:I,user:f}),g=yield this.filterRelevantDocuments({options:t,documentIds:g,skipPermissionValidation:a}),this.documentIds$.next(g),g?.length){let T=g[0]?.clientDocumentId;t?.rootDocumentId&&g.find(L=>L.clientDocumentId===t?.rootDocumentId)&&(T=t?.rootDocumentId),yield this.debounceSetDocuments({documentId:T,clientOrganizationId:t?.organizationId,options:t})}return}catch(c){this.loggingService.catch("Error in DocService setDocumentsImpl:",c)}})}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(Y.Events.Core.SET_DOCUMENTS_TRIGGERED,{payload:{id:e,clientOrganizationId:t,methodName:"setDocumentId",source:r}}),this.coreActionsService.triggerAction(ct.INIT_UPDATE,{event:Y.Events.Core.SET_DOCUMENTS_TRIGGERED,methodName:Fa.SET_DOCUMENT_ID,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(),c=s-this.lastSetDocumentIdCallTime,p=s-this.lastSetDocumentIdExecutionTime;if(this.lastSetDocumentIdCallTime=s,this.queueSize>=this.MAX_QUEUE_SIZE){this.loggingService.warn("SetDocumentId queue size exceeded limit");return}if(!this.documentPaths$.value&&!this.isDocumentIdInDebounceQueue||c>this.DEBOUNCE_TIME&&p>this.DEBOUNCE_TIME){yield this.setDocumentIdImpl(e,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 c=`${Nn(e)}`,p=r?.folderId,g=r?.folderId?$i(r?.folderId):void 0,f=r?.locationId,I=r?.allDocuments,T=a?.organizationId?t?Tt(t):a?.organizationId:void 0,L=vt();this.coreActionsService.triggerAction(ct.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:L,methodName:No.INIT_DOCUMENTS,source:"internal",payload:{documentIds:this.documentIds$.value.map(z=>z.clientDocumentId),organizationId:t??a?.clientOrganizationId??""}});let G=vt();if(this.coreActionsService.triggerAction(ct.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:G,methodName:Ho.INIT_DOCUMENTS,source:"internal",payload:{documentIds:this.documentIds$.value.map(z=>z.clientDocumentId),organizationId:t??a?.clientOrganizationId??""}}),yield Promise.allSettled([this.commentResolverService.resolveCommentAnnotations({documentIds:this.documentIds$.value.map(z=>z.clientDocumentId),organizationId:t??a?.clientOrganizationId??""},L),this.reactionResolverService.resolveReactionAnnotations({documentIds:this.documentIds$.value.map(z=>z.clientDocumentId),organizationId:t??a?.clientOrganizationId??""},G)]),this.currentDocumentId!==c||this.documentPaths$.value?.organizationId!==T){this.loggingService.log("setting new docid"),this.currentDocumentId=c;let z=new KR,J=new m9;z.clientDocumentId=e,J.clientDocumentId=e,z.folderId=p,J.folderId=p,z.locationId=f,J.locationId=f,z.allDocuments=I,J.allDocuments=I,z.veltFolderId=g,J.veltFolderId=g,z.documentId=c,J.documentId=c,T&&(z.organizationId=T,z.clientOrganizationId=t??a?.clientOrganizationId,J.organizationId=T,J.clientOrganizationId=t??a?.clientOrganizationId);let le=`${this.apiKey}`,_e=`apiKey/${this.apiKey}`;T&&(le=`${le}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${z.organizationId}`,_e=`${_e}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${z.organizationId}`),J.organization=`apiKey/${this.apiKey}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}`,J.document=`${_e}/${U.FIREBASE_PARTIAL_PATH_DOCS}`,z.presence=`${le}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_PRESENCE}/`,z.cursor=`${le}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_CURSOR}/`,z.comment=`${le}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_COMMENT}/`,J.comment=`${_e}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_COMMENT}`,z.multiThread=`${le}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_MULTI_THREAD}/`,J.multiThread=`${_e}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_MULTI_THREAD}`,z.tag=`${le}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_TAG}/`,z.area=`${le}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_AREA}/`,J.area=`${_e}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_AREA}`,z.arrow=`${le}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_ARROW}/`,z.selection=`${le}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_SELECTION}/`,z.audioHuddle=`${le}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_AUDIO_HUDDLE}/`,z.huddle=`${le}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_HUDDLE}/`,z.recorder=`${le}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_RECORDER}/`,J.recorder=`${_e}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_RECORDER}`,z.flock=`${le}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_FOLLOW_ALONG}/`,z.syncVideoPlayer=`${le}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_SYNC_VIDEO_PLAYER}/`,z.liveState=`${le}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_LIVE_STATE}/`,z.liveStateSingleEditorMode=`${le}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_LIVE_STATE}/default/singleEditorMode`,z.reaction=`${le}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_REACTION}/`,J.reaction=`${_e}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_REACTION}`,z.crdt=`${le}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_CRDT}/`,J.crdt=`${_e}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_CRDT}`,z.customerMetadata=`${this.apiKey}/${U.FIREBASE_PARTIAL_PATH_CUSTOMER_METADATA}/`,z.views=`${le}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_VIEWS}/`,J.notificationViews=`${_e}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_NOTIFICATION_VIEWS}`,J.documentViews=`${_e}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_DOCUMENT_VIEWS}`,J.locationViews=`${_e}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_LOCATION_VIEWS}`,z.notifications=`${le}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_NOTIFICATIONS}/`,z.metadata=`${le}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_METADATA}/`,z.users=`${le}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_USERS}/`,z.documentIam=`${le}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_IAM}/`,z.workspaceIam=`${this.apiKey}/${U.FIREBASE_PARTIAL_PATH_IAM}/`,z.groupContacts=`${le}/${U.FIREBASE_PARTIAL_PATH_CONTACTS}/${U.FIREBASE_PARTIAL_PATH_GROUPS}/`,z.globalContacts=`${le}/${U.FIREBASE_PARTIAL_PATH_CONTACTS}/${U.FIREBASE_PARTIAL_PATH_GLOBAL}/`,z.logins=`${le}/${U.FIREBASE_PARTIAL_PATH_CONTACTS}/${U.FIREBASE_PARTIAL_PATH_LOGINS}/`,z.userFeedback=`${le}/${U.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${U.FIREBASE_PARTIAL_PATH_FEEDBACK}/`,z.userReportBugs=`${le}/${U.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${U.FIREBASE_PARTIAL_PATH_BUGS}/`,z.userContactUs=`${le}/${U.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${U.FIREBASE_PARTIAL_PATH_CONTACT_US}/`,T&&(z.organizationMetadata=`${le}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATION_METADATA}/`,z.organizationIam=`${le}/${U.FIREBASE_PARTIAL_PATH_IAM}/`,z.organizationGroups=`${le}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATION_GROUPS}/`,z.organizationNotifications=`${le}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/`,c&&(z.organizationNotificationsWithDocumentId=`${le}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/`,z.heartbeatByDocument=`${le}/${U.FIREBASE_PARTIAL_PATH_HEARTBEAT_BY_DOCUMENT}/${c}/`),z.organizationNotificationsLastNotificationTimestamp=`${le}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${U.FIREBASE_PARTIAL_PATH_LAST_NOTIFICATION_TIMESTAMP}/${U.FIREBASE_PARTIAL_PATH_DOCS}/`,z.organizationNotificationsUsers=`${le}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${U.FIREBASE_PARTIAL_PATH_USERS}/`,z.heartbeat=`${le}/${U.FIREBASE_PARTIAL_PATH_HEARTBEAT}/`),J.organizationUsers=`${_e}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATION_USERS}`,J.users=`${_e}/${U.FIREBASE_PARTIAL_PATH_CENTRAL_USERS}`,J.documentUsers=`${_e}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_DOCUMENT_USERS}`,J.notificationDocs=`${_e}/${U.FIREBASE_PARTIAL_PATH_NOTIFICATION_DOCS}`,J.notificationUsers=`${_e}/${U.FIREBASE_PARTIAL_PATH_NOTIFICATION_USERS}`,this.documentPaths$.next(z),this.firestorePaths$.next(J),z?.clientOrganizationId&&z?.organizationId&&!(z?.clientOrganizationId===this.getOrganizationConfig()?.clientOrganizationId&&z?.organizationId===this.getOrganizationConfig()?.organizationId)&&this.organizationConfig$.next({organizationId:z?.organizationId,clientOrganizationId:z?.clientOrganizationId}),Promise.allSettled([this.updateFolderMetadata(),this.updateDocumentMetadata(),this.fetchLocationMetadata(),this.updateOrganizationMetadata()]),s&&this.location$.value&&this.removeLocation({}),this.coreActionsService.triggerAction(ct.INIT_UPDATE,{event:Y.Events.Doc.SET_DOCUMENTS_SUCCESS,payload:{documentId:c,clientDocumentId:e}}),this.analyticsService.trackEvent(Y.Events.Doc.SET_DOCUMENTS_SUCCESS,{documentId:c,clientDocumentId:e},!0,this.getUserIdForAnalytics())}}else this.loggingService.catch("Error in setDocumentIdImpl: API key is not provided.")}catch(a){this.loggingService.catch("Error in setDocumentIdImpl: ",a)}})}unsetDocumentId({source:e,unsetDocumentPaths:t}){this.loggingService.log("%c[WB] Calling FUNCTION: unsetDocumentId","color: green;");try{e==="internal"&&this.analyticsService.trackEvent(Y.Events.Core.UNSET_DOCUMENTS_TRIGGERED,{payload:{methodName:"unsetDocumentId",source:e}}),this.coreActionsService.triggerAction(ct.INIT_UPDATE,{event:Y.Events.Doc.UNSET_DOCUMENTS_TRIGGERED,methodName:Fa.UNSET_DOCUMENT_ID,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),this.userPermissionService?.revokeAccessOnDocumentUnset(),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(ct.INIT_UPDATE,{event:Y.Events.Doc.UNSET_DOCUMENTS_SUCCESS,source:e}),this.analyticsService.trackEvent(Y.Events.Doc.UNSET_DOCUMENTS_SUCCESS,{documentId:this.currentDocumentId,documentMetadata:this.documentMetadata$.value?.[this.currentDocumentId??""],message:e==="external"?"User unset document id":"System unset document id",source:e},!0,this.getUserIdForAnalytics())}catch(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(Y.Events.Core.UNSET_DOCUMENTS_TRIGGERED,{payload:{methodName:"unsetDocuments",source:e}}),this.coreActionsService.triggerAction(ct.INIT_UPDATE,{event:Y.Events.Doc.UNSET_DOCUMENTS_TRIGGERED,source:e,methodName:Fa.UNSET_DOCUMENTS}),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(e){return Q(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: fetchOrganizationMetadata","color: green;");try{if(!e&&this.getOrganizationConfig()&&(e=this.getOrganizationConfig()),this.db&&e?.organizationId){let t=e?.organizationId;yield this.commonDbService?.getData({feature:"organizationMetadata",properties:{apiKey:this.apiKey??"",organizationId:t,field:"metadata"}}).then(r=>{r&&!r?.errorCode&&this.organizationMetadata$.next(D(E({},this.organizationMetadata$.value),{[t]:r}))}).catch(r=>{this.loggingService.catch("Error in fetchOrganizationMetadata: ",r)})}}catch(t){this.loggingService.catch("Error in fetchOrganizationMetadata: ",t)}})}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=[],c={organizationId:t?.clientOrganizationId,folderId:a},p=[],g=20;for(let I=0;I<e.length;I+=g)p.push(e.slice(I,I+g));p.forEach(I=>{let T=JSON.parse(JSON.stringify(c));T.documentIds=I.map(L=>L.clientDocumentId),s.push(this.fetchDocuments(T))});let f={};s.length>0&&(yield Promise.all(s).then(I=>{I?.forEach(T=>{T?.forEach(L=>{L?.metadata?.documentId&&(f[L.metadata.documentId]=L.metadata)})}),this.setAllDocumentMetadata(E(E({},this.documentMetadata$.value),f))}).catch(I=>{this.loggingService.catch("Error in fetchDocumentMetadata: ",I)}))}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.setDocumentMetadata(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=[],c={organizationId:e?.clientOrganizationId,folderId:r,allDocuments:a},p=[],g=20;for(let I=0;I<t.length;I+=g)p.push(t.slice(I,I+g));p.forEach(I=>{let T=JSON.parse(JSON.stringify(c));T.documentIds=I.map(L=>L.clientDocumentId),s.push(this.fetchLocations(T))});let f=this.locationMetadata$.value??{};s.length>0&&Promise.all(s).then(I=>{I?.forEach(T=>{T?.forEach(L=>{L?.metadata?.documentId&&(f[L.metadata.documentId]=D(E({},f?.[L.metadata.documentId]??{}),{[L.location.id]:L}))})}),Object.keys(f||{}).length>0&&this.locationMetadata$.next(f)}).catch(I=>{this.loggingService.catch("Error in fetchLocationMetadata: ",I)})}}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(zn(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`${Nn(e)}`}catch(t){return this.loggingService.catch("Error in generateDocumentId: ",t),""}}generateOrganizationId(e){try{return`${Tt(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(Y.Events.Core.SET_LOCATIONS_TRIGGERED,{payload:{locations:[e],options:void 0,methodName:"setLocation",source:t}}),this.coreActionsService.triggerAction(ct.INIT_UPDATE,{event:Y.Events.Core.SET_LOCATIONS_TRIGGERED,source:t,methodName:Fa.SET_LOCATION,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(Y.Events.Core.SET_LOCATIONS_TRIGGERED,{payload:{locations:e,options:t,methodName:"setLocations",source:r}}),this.coreActionsService.triggerAction(ct.INIT_UPDATE,{event:Y.Events.Core.SET_LOCATIONS_TRIGGERED,methodName:Fa.SET_LOCATIONS,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(Y.Events.Core.SET_ROOT_LOCATION_TRIGGERED,{payload:{location:e,methodName:"setRootLocation",source:t}}),this.coreActionsService.triggerAction(ct.INIT_UPDATE,{event:Y.Events.Core.SET_ROOT_LOCATION_TRIGGERED,methodName:Fa.SET_ROOT_LOCATION,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=D(E(E({},this.draftLocationMap.options??{}),t??{}),{rootLocationId:e[0].id})),this.draftLocationMap.locations=[...this.draftLocationMap.locations,...e],this.draftLocationMap.options=E(E({},this.draftLocationMap.options),t);return}let a=this.getValidLocations(e),s=[],c=[];this.location$.value?.location.id&&c.push(this.location$.value?.location.id),c=[...c,...Object.values(this.locations$.value).map(f=>f.location.id)].filter(f=>f!==void 0);let p;if(t?.rootLocationId&&t?.rootLocationId!==this.location$.value?.location.id&&(p=a.find(f=>f.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 f=or(p),I=Nn(JSON.stringify(f));f.id&&s.push({locationId:I,location:f}),this.location$.next({locationId:I,location:f})}}else{p||(p=a[0]);let f=or(p),I=Nn(JSON.stringify(f));f.id&&s.push({locationId:I,location:f}),this.location$.next({locationId:I,location:f})}let g=[];return a.slice(t?.appendLocation?0:1).forEach(f=>{if(f.id!==this.location$.value?.location.id){let I=E({},f),T=this.locations$.value;f?.id&&Object.keys(T).forEach(J=>{let le=T[J];le.location?.id===f.id&&(I=E(E({},le.location),f),delete T?.[J])});let L=this.genarateLocationId(I),G={locationId:L,location:I};I.id&&s.push({locationId:L,location:I}),g.push(G);let z=D(E({},T),{[L]:G});this.locations$.next(z)}}),this.updateDocumentLocationMetadata(s),this.coreActionsService.triggerAction(ct.INIT_UPDATE,{event:Y.Events.Doc.SET_LOCATIONS_SUCCESS,methodName:Fa.SET_LOCATIONS,payload:{locations:a,options:t}}),this.analyticsService.trackEvent(Y.Events.Doc.SET_LOCATIONS_SUCCESS,{locations:a,options:t},!0,this.getUserIdForAnalytics()),g}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(Y.Events.Core.SET_LOCATIONS_TRIGGERED,{payload:{locations:[e],options:{appendLocation:!0},methodName:"addLocation",source:t}}),this.coreActionsService.triggerAction(ct.INIT_UPDATE,{event:Y.Events.Core.SET_LOCATIONS_TRIGGERED,methodName:Fa.ADD_LOCATION,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(Y.Events.Core.REMOVE_LOCATIONS_TRIGGERED,{payload:{locations:[e],methodName:"removeLocation",source:t}}),this.coreActionsService.triggerAction(ct.INIT_UPDATE,{event:Y.Events.Core.REMOVE_LOCATIONS_TRIGGERED,source:t,methodName:Fa.REMOVE_LOCATION,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(Y.Events.Core.REMOVE_LOCATIONS_TRIGGERED,{payload:{locations:e,methodName:"removeLocations",source:t}}),this.coreActionsService.triggerAction(ct.INIT_UPDATE,{event:Y.Events.Core.REMOVE_LOCATIONS_TRIGGERED,methodName:Fa.REMOVE_LOCATIONS,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(Y.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(Y.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(ct.INIT_UPDATE,{event:Y.Events.Core.UNSET_LOCATIONS_TRIGGERED,methodName:Fa.UNSET_LOCATION_IDS,source:t,payload:{locationIds:e}}),t==="internal"&&this.analyticsService.trackEvent(Y.Events.Core.UNSET_LOCATIONS_TRIGGERED,{payload:{locationIds:e},methodName:"unsetLocationIds",message:"System unset location ids",source:t},!0,this.getUserIdForAnalytics()),e?.length?e.forEach(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.coreActionsService.triggerAction(ct.INIT_UPDATE,{event:Y.Events.Doc.REMOVE_LOCATIONS_SUCCESS,methodName:Fa.REMOVE_LOCATIONS_SUCCESS,source:t,payload:{locationIds:e}}),this.analyticsService.trackEvent(Y.Events.Doc.REMOVE_LOCATIONS_SUCCESS,{payload:{locationIds:e},source:t},!0,this.getUserIdForAnalytics())}catch(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(e){return Q(this,null,function*(){try{!e&&this.getOrganizationConfig()&&(e=this.getOrganizationConfig());let t=e?.organizationId,r=this.documentPaths$.value;if(this.db&&t&&r?.documentId){if(this.organizationMetadata$.value?.[t])return;let s=new a9;s.apiKey=this.configService?.getApiKey()??"",s.organizationId=t,s.clientOrganizationId=e?.clientOrganizationId,this.userPermissionService?.hasEditAccess({organizationId:t})&&(yield this.commonDbService?.updateData({feature:"organizationMetadata",data:JSON.parse(JSON.stringify(s)),properties:{organizationId:t,documentId:r?.documentId??""}})),yield this.fetchOrganizationMetadata(e)}}catch(t){this.loggingService.catch("Error in updateOrganizationMetadata: ",t)}})}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,clientOrganizationId:e?.clientOrganizationId,parentFolderId:"root"};if(this.userPermissionService?.hasEditAccess({folderId:this.documentPaths$.value?.veltFolderId??""})){let a=Xi(this.functions,Qi({url:wn?.cloudFunction?.sdkProxy,apiProxyDomain:this.configService?.getApiProxyDomain()}));yield pd({methodName:"createFolder",data:{type:"createFolder",metadata:r},getSdkProxy:a,userId:this.authService.getUser()?.userId??""})}}}}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 YR;this.clientDocumentMetadata&&(this.clientDocumentMetadata?.clientDocumentId===e.clientDocumentId&&this.clientDocumentMetadata?.documentMetadata&&(s=E(E({},this.clientDocumentMetadata.documentMetadata),s)),this.clientDocumentMetadata=void 0),this.clientDocumentMetadataMap?.[a.clientDocumentId]&&(s=E(E({},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=ki();let c=e?.folderId,p=e?.veltFolderId;s?.pageInfo?.deviceInfo&&delete s?.pageInfo?.deviceInfo;let g=!0,f=this.documentMetadata$.value?.[a.documentId];if(c&&p){let I=this.getDocumentMetadata(a?.documentId??"")??(yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:a?.documentId??"",organizationId:e?.organizationId??"",field:"metadata"}}));I?.clientDocumentId&&!I?.errorCode?I?.folderId&&(I?.folderId!==c||I?.veltFolderId!==p)?(this.loggingService.catch(`Folder id mismatch for document ${a?.clientDocumentId??""}`),g=!1):I?.folderId===c?(c&&(s.folderId=c),p&&(s.veltFolderId=p)):(this.loggingService.catch(`Document ${a?.clientDocumentId??""} is not in the folder ${c??""}`),g=!1):(c&&(s.folderId=c),p&&(s.veltFolderId=p))}if(f){let I={};Object.entries(s).forEach(([T,L])=>{I[T]=L}),ui(I,f)&&(g=!1)}g&&this.userPermissionService?.hasEditAccess({documentId:a?.documentId??"",folderId:e?.allDocuments&&e?.veltFolderId?e?.veltFolderId:void 0})&&(yield this.commonDbService?.updateData({feature:"documentMetadata",data:JSON.parse(JSON.stringify(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"}});s?.errorCode&&(s={});let c=[];for(let p of e){let g=new JR;g.locationId=p?.locationId,g.veltLocationId=YH(p?.location?.id??""),g.location=p?.location,g.pageInfo=ki(),g?.pageInfo?.deviceInfo&&delete g?.pageInfo?.deviceInfo;let f=D(E({},s),{[U.FIREBASE_PARTIAL_PATH_LOCATIONS]:D(E({},s[U.FIREBASE_PARTIAL_PATH_LOCATIONS]??{}),{[p?.locationId]:g})});this.commonDbService?.shouldUseFirestore()||c.push(this.commonDbService?.updateData({feature:"documentMetadata",data:JSON.parse(JSON.stringify(f)),properties:{documentId:a?.documentId??"",organizationId:t?.organizationId??""}}));let I=this.locationMetadata$.value;if(I||(I={}),p?.location?.id){let T=I?.[a.documentId],L=T?.[p?.location?.id??""];I&&(T||(I[a.documentId]={}),L||(I[a.documentId][p?.location?.id??""]={}),I[a.documentId][p?.location?.id??""]=D(E({},L),{location:p?.location})),Object.keys(I||{}).length>0&&this.locationMetadata$.next(I)}}yield Promise.allSettled(c)}}}}catch(t){this.loggingService.catch("Error in updateDocumentLocationMetadata: ",t)}})}genarateLocationId(e){try{return e&&typeof e=="object"?Nn(JSON.stringify(or(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(E({},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(E({},r)),t!=="internal"&&this.isDocumentIdInDebounceQueue&&(this.draftLocationMap.locations=this.draftLocationMap.locations.filter(c=>c.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(`[${U.ATTRIBUTES.VELT_LOCATION}]`),r=[];t.forEach(a=>{let s=a.getAttribute(U.ATTRIBUTES.VELT_LOCATION);if(s){let c=JSON.parse(s),p=this.genarateLocationId(c);r.push(p)}}),Object.keys(e).forEach(a=>{let s=e[a];r.includes(s.locationId)||delete e[a]}),this.locations$.next(E({},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(U.ATTRIBUTES.VELT_LOCATION)?t=e:t=e.closest(`[${U.ATTRIBUTES.VELT_LOCATION}]`),t){let r=t?.getAttribute(U.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(`[${U.ATTRIBUTES.VELT_LOCATION}], [${U.ATTRIBUTES.VELT_LOCATION_ID}]`).forEach(r=>{if(r.getAttribute(U.ATTRIBUTES.VELT_LOCATION)){let a=this.getLocationFromElement(r);a?.locationId&&(e[a.locationId]={element:r,location:a})}else if(r.getAttribute(U.ATTRIBUTES.VELT_LOCATION_ID)){let a=r.getAttribute(U.ATTRIBUTES.VELT_LOCATION_ID);if(a){let s=this.getLocationByClientLocationId(a);s?.locationId&&(e[s.locationId]={element:r,location:s});let c={id:a},p=this.genarateLocationId(c);e[a]={element:r,location:{locationId:p,location:c}}}}}),e}catch(e){return this.loggingService.catch("Error in DocService getElementMapWithLocation:",e),{}}}getAdditionLocationFromElement(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: getAdditionLocationFromElement","color: green;");let t;if(t=e?.closest(`[${U.ATTRIBUTES.VELT_LOCATION}], [${U.ATTRIBUTES.VELT_LOCATION_ID}]`),t){if(t?.getAttribute(U.ATTRIBUTES.VELT_LOCATION)){let r=t?.getAttribute(U.ATTRIBUTES.VELT_LOCATION);if(r)return JSON.parse(r)}else if(t?.getAttribute(U.ATTRIBUTES.VELT_LOCATION_ID)){let r=t?.getAttribute(U.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(`[${U.ATTRIBUTES.VELT_DOCUMENT_ID}]`)?.getAttribute(U.ATTRIBUTES.VELT_DOCUMENT_ID)||null}catch(t){return this.loggingService.catch("Error in DocService getAdditionalDocumentIdFromElement:",t),null}}getDocumentMetadata(e){try{return e?this.documentMetadata$.value?.[e]||null:this.documentMetadata$.value?.[this.documentPaths$.value?.documentId??""]||null}catch(t){return this.loggingService.catch("Error in DocService getDocumentMetadata:",t),null}}getAllDocumentMetadata$(e){return this.getAllDocumentMetadataMap$().pipe(de(t=>t?.[e??this.documentPaths$.value?.documentId??""]||null),_t(Xt))}getAllDocumentMetadata(){try{return Object.values(this.documentMetadata$.value||{})}catch(e){return this.loggingService.catch("Error in DocService getAllDocumentMetadata:",e),[]}}getAllDocumentMetadataMap$(){return this.documentMetadata$.asObservable().pipe(de(e=>e||{}),_t(Xt))}getAllDocumentMetadataMap(){try{return this.documentMetadata$.value||{}}catch(e){return this.loggingService.catch("Error in DocService getAllDocumentMetadata:",e),{}}}getDocumentMetadataOfAvailableDocuments(){try{this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentMetadataOfAvailableDocuments","color: green;");let e=this.documentMetadata$.value||{},t={},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(c=>{let p=e?.[c.documentId];p&&(t[c.documentId]=p)});else if(this.documentPaths$.value?.documentId){let c=e?.[this.documentPaths$.value?.documentId];c&&(t[this.documentPaths$.value?.documentId]=c)}}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),_t(Xt))}setDocumentMetadata(e,t){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocumentMetadata","color: green;");let r=JSON.parse(JSON.stringify(this.documentMetadata$.value??{}));r[e]=t,this.documentMetadata$.next(r)}catch(r){this.loggingService.catch("Error in DocService setDocumentMetadata:",r)}}setAllDocumentMetadata(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setAllDocumentMetadata","color: green;"),this.documentMetadata$.next(e)}catch(t){this.loggingService.catch("Error in DocService setAllDocumentMetadata:",t)}}getOrganizationMetadata(e){return this.organizationMetadata$.value?.[e]||null}getOrganizationMetadata$(e){return this.organizationMetadata$.asObservable().pipe(de(t=>t?.[e]||null))}getOrganizationMetadataMap$(){return this.organizationMetadata$.asObservable().pipe(de(e=>e||{}),_t(Xt))}getCustomerMetadata(){return this.customerMetadata$.value}getCustomerMetadata$(){return this.customerMetadata$.asObservable()}getOrganizationConfig$(){return this.organizationConfig$.asObservable().pipe(_t(Xt))}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,c=this.getDocumentMetadata(s);if(!c)return;let p=c?.folderId,g=c?.veltFolderId;return E(E({apiKey:this.configService.getApiKey()??void 0,clientDocumentId:a,clientOrganizationId:r.clientOrganizationId,documentId:s,organizationId:r.organizationId},p?{folderId:p}:{}),g?{veltFolderId:g}:{})}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),c=this.getDefaultMetadata({clientDocumentId:r,documentId:a});return s||c||{}}catch(r){return this.loggingService.catch("Error in DocService getBaseMetadata:",r),{}}}getServerId({documentId:e,organizationId: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=$i(e?.folderId);r.push(ft("metadata.veltFolderId","==",s))}return e?.documentIds?.length&&!e?.allDocuments&&r.push(ft("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=$i(e?.folderId);r.push(ft("metadata.veltFolderId","==",s))}return e?.documentIds?.length&&!e?.allDocuments&&r.push(ft("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 c=os(r);if(!a||a.length===0)return this.loggingService.catch("Error in updateDocuments: documents is required"),[];let p=[],g=this.documentMetadata$.value??{};for(let f of a)if(f?.documentId){f.organizationId=c,f.clientOrganizationId=r,f.clientDocumentId=f.documentId;let I=Tr(f.documentId);f.documentId=I,f.apiKey=this.configService.getApiKey()??void 0,(s||this.documentPaths$.value?.folderId)&&(f.folderId=s||this.documentPaths$.value?.folderId,f.veltFolderId=$i(s||this.documentPaths$.value?.folderId||""));let T=()=>{if(s&&this.documentPaths$.value?.folderId&&s!==this.documentPaths$.value?.folderId)return;let G=g?.[I];G?g[I]=E(E({},G),f):g[I]=f},L=yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:I,organizationId:c,field:"metadata"}});if(L?.errorCode&&(L={}),L&&L.apiKey&&L.folderId&&s&&L.folderId!=f.folderId){this.loggingService.catch(`Error in updateDocuments: document ${f.clientDocumentId} already exists with different folderId: ${L.folderId}`);continue}if(L&&L.apiKey&&!L.folderId&&f.folderId){this.loggingService.catch(`Error in updateDocuments: document ${f.clientDocumentId} already exists, move this document to folder with REST API`);continue}T(),f&&this.commonDbService&&this.userPermissionService?.hasEditAccess({documentId:f?.documentId??""})&&p.push(this.commonDbService.updateData({feature:"documentMetadata",data:JSON.parse(JSON.stringify(f)),properties:{organizationId:c,documentId:I}}))}yield Promise.all(p),this.setAllDocumentMetadata(g)}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(f=>f.clientDocumentId)??[],s.length===0))return this.loggingService.catch("Error in updateLocations: documentId is required"),[];if(!r&&(r=this.documentPaths$.value?.clientOrganizationId,!r))return this.loggingService.catch("Error in updateLocations: organizationId is required"),[];if(!a||a.length===0)return this.loggingService.catch("Error in updateLocations: locations is required"),[];let c=s.map(f=>Tr(f)),p=[],g=this.locationMetadata$.value;g||(g={}),c.forEach(f=>{a.forEach(I=>{let T=this.location$.value;if(I?.id===T?.location?.id&&this.location$.next({locationId:T?.locationId,location:I}),I?.id){delete I?.metadata;let L=YH(I.id),G=g?.[f],z=G?.[I.id];g&&(G||(g[f]={}),z||(g[f][I.id]={}),g[f][I.id]=D(E({},z),{location:I})),I&&this.commonDbService&&p.push(this.commonDbService.updateData({feature:"locationMetadata",data:JSON.parse(JSON.stringify({location:I})),properties:{organizationId:os(r),documentId:f,id:L}}))}})}),yield Promise.all(p),Object.keys(g||{}).length>0&&this.locationMetadata$.next(g)}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 c=$i(e?.folderId);r=yield this.commonDbService?.getData({feature:"folder",properties:{folderId:c,apiKey:this.apiKey??"",organizationId:s,documentId:this.documentPaths$.value?.documentId}}),r&&(r=[r]),a=yield this.commonDbService?.queryData({feature:"allFolders",properties:{firestoreQuery:[ft("metadata.veltParentFolderId","==",c)],folderId:c,apiKey:this.apiKey??"",organizationId:s,documentId:this.documentPaths$.value?.documentId}})}else r=yield this.commonDbService?.queryData({feature:"allFolders",properties:{apiKey:this.apiKey??"",organizationId:s,documentId:this.documentPaths$.value?.documentId}});return{data:r,parentFolders:a}}catch(t){return this.loggingService.catch("Error in DocService getFoldersRequest:",t),{data:[],parentFolders:[]}}})}getDocumentIam$(){return this.authService.getUser$().pipe(fe(e=>e?this.documentPaths$.pipe(fe(t=>t?.documentIam?this.commonDbService?.dbListener({feature:"documentIam",properties:{documentId:t.documentId,organizationId:t.organizationId,isCollection:!1}}).pipe(de(r=>r?.data?.docIamConfig??r?.data),_t((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?xi.RESTRICTED:xi.PUBLIC:e&&e.documentAccessType?e.documentAccessType:xi.PUBLIC}catch(t){return this.loggingService.catch("Error in DocService getDocumentAccessType:",t),xi.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"}});if(r?.errorCode)return;switch(delete r.documentAccessType,r.features||(r.features={}),r.features.all||(r.features.all={}),e){case xi.PUBLIC:r.features.all.restricted=!1;break;case xi.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(E(E({},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)(ee(tt),ee(je),ee(In),ee(Le),ee(Ft),ee(y),ee(Js),ee(vm),ee(ni),ee(xo))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Ln=(()=>{let o=class o{constructor(e,t,r,a,s){this.analyticsService=e,this.authService=t,this.coreActionsService=r,this.docService=a,this.loggingService=s,this.resolveOrganizationUsers=new ve(!0),this.resolveFolderUsers=new ve(!0),this.resolveDocumentUsers=new ve(!0),this.unresolvedUsers=new ve([]),this.resolveTimeout=60*1e3,this.resolveAttempts=new Map,this.subscriptions=new Dn,this.userDataProvider$=new ve(null),this.userById$=new ve({}),this.userByIdCalled$=new ve({}),this.pendingResolutions=new Set,this.getUserById=c=>{try{return this.userById$.value?.[c]}catch(p){this.loggingService.catch("Error in UsersService getUserById:",p);return}};try{this.analyticsService.setUserService(this),this.authService.setUsersService(this),this.docService.getDocumentPaths$().pipe(Fe(c=>!!c),fe(()=>this.getUnresolvedUsers$().pipe(Fe(c=>c.length>0),Ao(300),ot(20),fe(c=>{let p=this.docService.getOrganizationConfig()?.organizationId;return this.commonDbService?this.commonDbService?.dbListener({feature:"allOrganizationUsers",properties:{organizationId:p,isCollection:!0,useQuery:!0,firestoreQuery:[yi(ft("user.userId","in",c.slice(0,20)))]}}).pipe(de(g=>g?.data),on(g=>{if(g&&typeof g=="object"){delete g.undefined,delete g.null;let f=Object.values(g??{});this.setUserByIds(f.map(T=>T.user));let I=c.filter(T=>!f.some(L=>L.user.userId===T));I.length!==c.length&&this.setUnresolvedUsers(I)}})):se([])})))).subscribe()}catch(c){this.loggingService.catch("Error in UsersService constructor:",c)}}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(p){return Q(this,arguments,function*({userIds:e,forceResolve:t,feature:r,organizationId:a,skipUserCheck:s=!1,uniqueId:c}){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: resolveUsers","color: green;");let g=!1;if(r&&(g=this.isResolverForFeatureDisabled(r)),g)return{};{let f={},I=[],T={};if(e?.forEach(L=>{let G=this.getUserById(L);G?f[L]=G:this.userByIdCalled$.getValue()[L]?t&&I.push(L):(I.push(L),this.userByIdCalled$.next(D(E({},this.userByIdCalled$.getValue()),{[L]:!0})))}),I.length>0){let L=c||vt();this.coreActionsService.triggerAction(ct.USER_RESOLVER,{event:Y.Events.Resolver.USER_RESOLUTION_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:L,methodName:Hr.RESOLVE_USERS,source:"internal",payload:{userIds:I,organizationId:a,feature:r,forceResolve:t,skipUserCheck:s,externalUserDataProviderAvailable:this.externalUserDataProviderAvailable()}});let G={};try{let z,J=new Promise((le,_e)=>{z=setTimeout(()=>{_e(new Error("User resolution timeout"))},this.userDataProvider$.getValue()?.config?.resolveTimeout||this.userDataProvider$.getValue()?.resolveTimeout||this.resolveTimeout)});G=yield Promise.race([this.getUsersFromDB({userIds:I,organizationId:a,skipUserCheck:s}).finally(()=>{clearTimeout(z)}),J]),this.analyticsService.trackEvent(Y.Events.Resolver.USER_RESOLVER_GET,{sourceMethod:"resolveUsers",source:"sdk",userIds:I}),this.coreActionsService.triggerAction(ct.USER_RESOLVER,{event:Y.Events.Resolver.USER_RESOLUTION_RESULT,timestamp:new Date().getTime(),uniqueId:L,methodName:Hr.RESOLVE_USERS,source:"internal",payload:{result:G,userIds:I,externalUserDataProviderAvailable:this.externalUserDataProviderAvailable()}})}catch(z){this.loggingService.catch("Error in UsersService resolveUsers getUsers:",z,{userIds:I}),this.coreActionsService.triggerAction(ct.USER_RESOLVER,{event:Y.Events.Resolver.USER_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:L,methodName:Hr.RESOLVE_USERS,source:"internal",payload:{error:z,userIds:I,externalUserDataProviderAvailable:this.externalUserDataProviderAvailable()}})}finally{I?.forEach(z=>{if(!G[z]){let J=new Set([...this.getUnresolvedUsers(),z]);this.unresolvedUsers.next(Array.from(J)),G[z]={userId:z,name:`User ${z}`}}})}Object.entries(G).forEach(([z,J])=>{J&&(f[z]=G?.[z],T[z]=G?.[z])})}return Object.keys(T).length>0&&(this.authService.setOptionalPropertiesToUsers(Object.values(T)),this.userById$.next(E(E({},this.userById$.getValue()),T))),f}}catch(g){this.loggingService.catch("Error in UsersService resolveUsers:",g);let f=c||vt();return this.coreActionsService.triggerAction(ct.USER_RESOLVER,{event:Y.Events.Resolver.USER_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:f,methodName:Hr.RESOLVE_USERS,source:"internal",payload:{error:g,userIds:e,externalUserDataProviderAvailable:this.externalUserDataProviderAvailable()}}),{}}})}getUnresolvedUsers$(){return this.unresolvedUsers.asObservable()}getUnresolvedUsers(){this.loggingService.log("%c[WB] Calling UsersService FUNCTION: getUnresolvedUsers","color: green;");try{return JSON.parse(JSON.stringify(this.unresolvedUsers.getValue()))}catch(e){return this.loggingService.catch("Error in UsersService getUnresolvedUsers:",e),[]}}setUnresolvedUsers(e){this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setUnresolvedUsers","color: green;");try{if(Array.isArray(e)){let t=JSON.parse(JSON.stringify(e));this.unresolvedUsers.next(t)}}catch(t){this.loggingService.catch("Error in UsersService setUnresolvedUsers:",t)}}getUsersFromDB(a){return 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();if(s)return s.get(e);if(t||(t=this.docService.getOrganizationConfig()?.organizationId),!t)return{};let c=(yield this.getUsersFromDBWithBatching({userIds:e,organizationId:t,skipUserCheck:r}))??[],p={};return c.forEach(g=>{g.forEach(f=>{f?.user?.userId&&(p[f.user.userId]=f.user)})}),p}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 g=0;g<e.length;g+=30)s.push(e.slice(g,g+30));let c=s.map((g,f)=>Q(this,null,function*(){try{return(yield this.commonDbService?.queryData({feature:"allOrganizationUsers",properties:{organizationId:t,useCollectionGroup:!1,isCollection:!0,firestoreQuery:[ft("user.userId","in",g)],skipUserCheck:r}}))||[]}catch(I){return this.loggingService.catch(`Error in batch ${f+1}:`,I),[]}}));return yield Promise.all(c)}catch(s){return this.loggingService.catch("Error in getUsersFromDBWithBatching:",s),[]}})}getTemporaryUsersFromDBWithBatching(a){return Q(this,arguments,function*({userIds:e,organizationId:t,resourceIds:r}){try{if(!e?.length||!r?.length)return[];let s=[];for(let G=0;G<e.length;G+=30)s.push(e.slice(G,G+30));let c=[];for(let G=0;G<r.length;G+=30)c.push(r.slice(G,G+30));let p=[],g=0,f=(G,z)=>Q(this,null,function*(){try{return((yield this.commonDbService?.queryData({feature:"allPermissionsUsers",properties:{organizationId:t,useCollectionGroup:!1,isCollection:!0,firestoreQuery:[yi(ft("userId","in",G),ft("veltResourceId","in",z))]}}))??[])||[]}catch(J){return this.loggingService.catch(`Error in batch ${g+1}:`,J),[]}});for(let G of s)for(let z of c)p.push(f(G,z)),g++;return(yield Promise.all(p)).flat().filter((G,z,J)=>z===J.findIndex(le=>le.userId===G.userId&&le.resourceId===G.resourceId))}catch(s){return this.loggingService.catch("Error in getTemporaryUsersFromDBWithBatching:",s),[]}})}getResolveOrganizationUsers$(){return this.resolveOrganizationUsers.asObservable()}getResolveFolderUsers$(){return this.resolveFolderUsers.asObservable()}getResolveDocumentUsers$(){return this.resolveDocumentUsers.asObservable()}getUserById$(){try{return this.loggingService.log("%c[WB] Calling UsersService FUNCTION: getUserById$","color: green;"),this.userById$.asObservable().pipe(_t(Xt))}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=JSON.parse(JSON.stringify(this.userById$.getValue()??{}));e.forEach(r=>{t[r.userId]=E(E({},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)}}externalUserDataProviderAvailable(){try{return this.loggingService.log("%c[WB] Calling UsersService FUNCTION: externalUserDataProviderAvailable","color: green;"),!!this.commonDbService?.shouldUseFirestore()&&!!this.userDataProvider$.getValue()}catch(e){return this.loggingService.catch("Error in UsersService externalUserDataProviderAvailable:",e),!1}}userDataProviderAvailable(){try{return this.loggingService.log("%c[WB] Calling UsersService FUNCTION: userDataProviderAvailable","color: green;"),!!this.commonDbService?.shouldUseFirestore()}catch(e){return this.loggingService.catch("Error in UsersService userDataProviderAvailable:",e),!1}}};o.\u0275fac=function(t){return new(t||o)(ee(tt),ee(je),ee(ni),ee(rt),ee(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Spe=(()=>{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)(ee(y),ee(Ln))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var bpe=(()=>{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)(ee(y),ee(Ln))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Jg=class{static getFirestoreProdDbName(o,n){return n?.databaseURL?.includes("snippyly-plugin.firebaseio.com")||n?.databaseURL?.includes("snippyly-plugin-staging.firebaseio.com")?"sfdb":n?.storeDbId??(this.isTestingDb(n?.databaseURL??"")?"sdktest":`apikey${o.toLowerCase()}`)}static isTestingDb(o){try{return o.includes("-test")}catch(n){return et.error("Error in isTestingDb:",n),!1}}};var eu=(()=>{let o=class o{constructor(e,t,r){this.coreActionsService=e,this.loggingService=t,this.analyticsService=r,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(a=>{a&&(a.config?.saveRetryConfig&&(this.retrySaveConfig=a.config.saveRetryConfig),a.config?.deleteRetryConfig&&(this.retryDeleteConfig=a.config.deleteRetryConfig))})}catch(a){this.loggingService.catch("Error in AttachmentResolverService constructor:",a)}}getProvider(){try{let e=this.attachmentDataProvider$.getValue();return e||void 0}catch(e){this.loggingService.catch("Error in AttachmentResolverService getProvider:",e);return}}saveAttachment(e,t){return Q(this,null,function*(){try{this.loggingService.log("%c[WB] Calling AttachmentResolverService FUNCTION: saveAttachment","color: green;");let r=this.getProvider();if(!this.attachmentDataProviderAvailable())throw new Error("Attachment save data provider not available");let a=t||vt();this.coreActionsService.triggerAction(ct.ATTACHMENT_RESOLVER,{event:Y.Events.Resolver.ATTACHMENT_SAVE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:a,methodName:kl.SAVE_ATTACHMENT,source:"internal",payload:{request:e}});let s=yield md(()=>r?.save({attachment:e.attachment,event:e.eventType,metadata:e.attachment.metadata})||Promise.resolve(void 0),"saveAttachment",this.retrySaveConfig);if(s?.statusCode!==200){this.loggingService.catch(s?.message??"Error in AttachmentResolverService saveAttachment:"),this.coreActionsService.triggerAction(ct.ATTACHMENT_RESOLVER,{event:Y.Events.Resolver.ATTACHMENT_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:kl.SAVE_ATTACHMENT,source:"internal",payload:{error:s,request:e}});return}return this.analyticsService.trackEvent(Y.Events.Resolver.ATTACHMENT_RESOLVER_SAVE,{sourceMethod:"saveAttachment",source:"sdk",attachmentId:e.attachment.attachmentId,eventType:e.eventType}),this.coreActionsService.triggerAction(ct.ATTACHMENT_RESOLVER,{event:Y.Events.Resolver.ATTACHMENT_SAVE_RESULT,timestamp:new Date().getTime(),uniqueId:a,methodName:kl.SAVE_ATTACHMENT,source:"internal",payload:{result:s,request:e}}),s}catch(r){this.loggingService.warn("Error in AttachmentResolverService saveAttachment:",r);let a=t||vt();this.coreActionsService.triggerAction(ct.ATTACHMENT_RESOLVER,{event:Y.Events.Resolver.ATTACHMENT_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:kl.SAVE_ATTACHMENT,source:"internal",payload:{error:r,request:e}});return}})}deleteAttachment(a,s){return Q(this,arguments,function*({attachmentId:e,metadata:t},r){try{this.loggingService.log("%c[WB] Calling AttachmentResolverService FUNCTION: deleteAttachment","color: green;");let c=this.getProvider();if(!this.attachmentDataProviderAvailable())throw new Error("Attachment delete data provider not available");let p=r||vt();this.coreActionsService.triggerAction(ct.ATTACHMENT_RESOLVER,{event:Y.Events.Resolver.ATTACHMENT_DELETE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:p,methodName:kl.DELETE_ATTACHMENT,source:"internal",payload:{attachmentId:e,metadata:t}});let g=yield md(()=>c?.delete({attachmentId:e,metadata:t,event:va.ATTACHMENT_DELETE})||Promise.resolve(void 0),"deleteAttachment",this.retryDeleteConfig);return g?.statusCode!==200?(this.loggingService.catch(g?.message??"Error in AttachmentResolverService deleteAttachment:"),this.coreActionsService.triggerAction(ct.ATTACHMENT_RESOLVER,{event:Y.Events.Resolver.ATTACHMENT_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:p,methodName:kl.DELETE_ATTACHMENT,source:"internal",payload:{error:g,attachmentId:e,metadata:t}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(Y.Events.Resolver.ATTACHMENT_RESOLVER_DELETE,{sourceMethod:"deleteAttachment",source:"sdk",attachmentId:e}),this.coreActionsService.triggerAction(ct.ATTACHMENT_RESOLVER,{event:Y.Events.Resolver.ATTACHMENT_DELETE_RESULT,timestamp:new Date().getTime(),uniqueId:p,methodName:kl.DELETE_ATTACHMENT,source:"internal",payload:{result:{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0},attachmentId:e,metadata:t}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0})}catch(c){this.loggingService.warn("Error in AttachmentResolverService deleteAttachment:",c);let p=r||vt();return this.coreActionsService.triggerAction(ct.ATTACHMENT_RESOLVER,{event:Y.Events.Resolver.ATTACHMENT_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:p,methodName:kl.DELETE_ATTACHMENT,source:"internal",payload:{error:c,attachmentId:e,metadata:t}}),{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)(ee(ni),ee(y),ee(tt))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var tu=(()=>{let o=class o{constructor(e,t,r,a,s,c,p,g){this.loggingService=e,this.usersService=t,this.authService=r,this.functions=a,this.configService=s,this.commentAnnotationsResolverService=c,this.attachmentResolverService=p,this.coreActionsService=g,this.notificationActionTypeMap={[zt.NEWLY_ADDED]:va.COMMENT_ANNOTATION_ADD,[zt.ADDED]:va.COMMENT_ADD,[zt.UPDATED]:va.COMMENT_UPDATE,[zt.DELETED]:va.COMMENT_DELETE}}setNotificationService(e){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: setNotificationService","color: green;"),this.notificationService=e}catch(t){this.loggingService.catch("Error in CommentUtilsService setNotificationService: ",t)}}setUserPermissionService(e){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: setUserPermissionService","color: green;"),this.userPermissionService=e}catch(t){this.loggingService.catch("Error in CommentUtilsService setUserPermissionService: ",t)}}getUserIdsToResolveFromComments(e){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: getUserIdsToResolveFromComments","color: green;");let t=new Set;for(let 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 E(E({},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,c)=>c.findIndex(p=>p.text===a.text)===s)||[]).forEach(a=>{if(a?.text){let s=new RegExp(cd(`{{${a.userId}}}`),"g");t.commentText?.includes(`@User ${a.userId}`)&&(s=new RegExp(cd(`@User ${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)}),e?.viewedBy&&delete e.viewedBy,e?.comments&&e.comments.forEach(t=>{t?.reactionAnnotations&&delete t.reactionAnnotations}),this.usersService.userDataProviderAvailable()){if(e?.from?.userId&&(e.from={userId:e.from.userId}),e?.assignedTo?.userId&&(e.assignedTo={userId:e.assignedTo.userId}),e?.subscribedUsers)for(let t of Object.keys(e?.subscribedUsers))e.subscribedUsers[t].user={userId:e?.subscribedUsers[t].user.userId};if(e?.unsubscribedUsers)for(let t of Object.keys(e?.unsubscribedUsers))e.unsubscribedUsers[t].user={userId:e?.unsubscribedUsers[t].user.userId}}return e?.comments&&(e.comments=e?.comments?.map(t=>this.formatCommentThreadData(t))),e}catch(t){return this.loggingService.catch("Error in CommentUtilsService formatCommentData:",t),e}}mergeStrippedDataWithCommentAnnotations(e){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: mergeStrippedDataWithCommentAnnotations","color: green;"),!this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable())return e;let t=this.commentAnnotationsResolverService.getAnnotationById(e?.annotationId),r=this.attachmentResolverService.attachmentDataProviderAvailable(),a=this.commentAnnotationsResolverService.getFieldsToRemove();return t&&(e?.comments?.forEach(s=>{let c=t?.comments?.[s?.commentId];if(c){s.commentHtml=c?.commentHtml,s.commentText=c?.commentText;let p=c?.attachments;r&&p&&s.attachments?.forEach(g=>{let f=g?.attachmentId;p?.[f]&&(g.name=p?.[f]?.name,g.url=p?.[f]?.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?!ui(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 fd;if(Object.assign(a,e),a.isCommentResolverUsed=t,r){let s=a.attachments?.map(c=>(c.isAttachmentResolverUsed=!0,delete c?.name,delete c?.url,c));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,commentId:r}){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: stripCommentAnnotationData","color: green;"),!this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable())return{originalData:e,strippedData:null};let a=this.attachmentResolverService.attachmentDataProviderAvailable(),s=this.commentAnnotationsResolverService.getFieldsToRemove(),c;t&&(c=this.notificationActionTypeMap?.[t]);let p={},g=null,f=!1;if(e&&e.annotationId){let T=e.annotationId;p[T]=E(E(E(E({annotationId:T,metadata:J0(e.metadata??{}),comments:{}},e?.from&&{from:e?.from}),e?.assignedTo&&{assignedTo:e?.assignedTo}),e?.resolvedByUserId&&{resolvedByUserId:e?.resolvedByUserId}),e?.targetTextRange?.text&&{targetTextRange:{text:e?.targetTextRange?.text}}),delete e?.targetTextRange?.text,s?.length>0&&s.forEach(G=>{e?.[G]&&(p[T][G]=e[G],delete e[G])}),e.comments?.forEach(G=>{if(G.commentId){let z;a&&(z={},G.attachments?.forEach(J=>{z[J.attachmentId]={attachmentId:J.attachmentId,name:J.name,url:J.url}})),p[T].comments[G.commentId]=E(E(E(E(E(E({commentId:G.commentId},G?.commentHtml&&{commentHtml:G?.commentHtml}),G?.commentText&&{commentText:G?.commentText}),z&&{attachments:z}),G?.from&&{from:G?.from}),G?.to&&{to:G?.to}),G?.taggedUserContacts&&{taggedUserContacts:G?.taggedUserContacts})}}),f=this.isCommentsDataChanged(p[T],T);let L=new Zo;Object.assign(L,e),L.comments=e.comments?.map(G=>this.stripCommentsFromAnnotationData({comment:G}))||[],g=L}let I=g?.comments?.find(T=>T.commentId===r);return I?.isDraft&&(c=g?.comments?.length&&g?.comments?.length>0?va.COMMENT_ADD:va.COMMENT_ANNOTATION_ADD),{strippedData:f&&(t||I?.isDraft)?p:null,originalData:g,eventType:c}}catch(a){return this.loggingService.catch("Error in CommentAnnotationsResolverService stripCommentAnnotationData:",a),{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?.userId?D(E({},r),{contact:{userId:r.contact.userId}}):r));let t=e?.taggedUserContacts?.filter((r,a,s)=>s.findIndex(c=>c.text===r.text)===a)||[];t.forEach(r=>{if(r?.text&&r?.contact?.userId){let a=new RegExp(cd(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?.contact?.userId&&(r.text="")})}return e}catch(t){return this.loggingService.catch("Error in CommentUtilsService formatCommentThreadData:",t),e}}getDeniedForYouUsers(t){return Q(this,arguments,function*({extraData:e}){try{let r=Object.values(e?.annotationData?.subscribedUsers||{}).map(s=>s.user.userId)??[],a=[];if(this.userPermissionService?.isPermissionProviderAvailable()&&r.length){let s=e?.metadata?.clientDocumentId,c=[];r.forEach(f=>{if(c.push({userId:f,resource:{id:s,type:Fo.DOCUMENT,source:Hi.SET_NOTIFICATIONS,organizationId:e?.metadata?.clientOrganizationId??""}}),e?.annotationData?.context?.access&&this.userPermissionService?.getIsContextEnabled()){let I=JSON.stringify(e?.annotationData?.context?.access);c.push({userId:f,resource:{id:I,type:Fo.CONTEXT,source:Hi.SET_NOTIFICATIONS,organizationId:e?.metadata?.clientOrganizationId??"",context:{access:e?.annotationData?.context?.access}}})}});let p=vt();this.coreActionsService.triggerAction(ct.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.RESOURCE_ACCESS_REQUEST_FORMED,methodName:Hi.SET_NOTIFICATIONS,uniqueId:p,timestamp:new Date().getTime(),source:"internal",payload:{requests:c}});let g=yield this.userPermissionService?.onResourceAccessRequired({requests:c,uniqueId:p,methodName:Hi.SET_NOTIFICATIONS});g?.success&&g?.data?.length&&g.data.forEach(f=>{f.hasAccess||a.push(f.userId)})}return a}catch(r){return this.loggingService.catch("Error in CommentUtilsService getDeniedForYouUsers:",r),[]}})}handleCommentEncryption(c){return Q(this,arguments,function*({data:e,firestorePath:t,extraData:r,eventType:a,metadata:s}){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: handleCommentEncryption","color: green;");let p=Dk(this.authService.getFirebaseConfig()?.firebaseOptions),g=Xi(this.functions,Qi({url:wn.cloudFunction?.[p]?.setEncryptedData,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:1200*1e3});if(r){r=this.notificationService?.processNotificationData(r),r.annotationData=e;let G=r?.targetAnnotationData?.commentId;if(G){let z=e?.comments?.find(J=>J?.commentId===G);z&&(r.targetAnnotationData=z)}try{let z=this.stripCommentAnnotationData({data:r.annotationData,actionType:r?.actionType??zt.NEWLY_ADDED});z?.originalData&&(r.annotationData=this.formatCommentData(z.originalData)),r?.targetAnnotationData&&(r.targetAnnotationData=this.formatCommentThreadData(this.stripCommentsFromAnnotationData({comment:r.targetAnnotationData})))}catch(z){this.loggingService.warn("Error in CommentUtilsService handleCommentEncryption:",z)}}let f=Jg.getFirestoreProdDbName(this.configService.getApiKey()??"",this.authService.getFirebaseConfig()?.firebaseOptions),I=yield this.getDeniedForYouUsers({extraData:r}),T={path:t??"",data:e??{},dbId:f??"",notificationData:r||void 0,notificationURL:wn.firebaseNotificationsDatabaseURL,feature:"comment",eventType:a??"PATCH",sdkVersion:_a(),deniedForYouUsers:I,isPermissionProviderUsed:this.userPermissionService?.isPermissionProviderAvailable(),isCommentResolverUsed:this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable(),metadata:s},L=yield Dl(T,this.authService.getUser()?.userId??"");yield g({veltData:L})}catch(p){this.loggingService.catch("Error in CommentUtilsService handleCommentEncryption:",p)}})}};o.\u0275fac=function(t){return new(t||o)(ee(y),ee(Ln),ee(je),ee(xo),ee(Ft),ee(Js),ee(eu),ee(ni))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Ipe=(()=>{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);if(t){let r=t;e?.user&&typeof e.user=="object"&&(r=E(E({},r),e.user)),e=D(E({},e),{user:r})}}return e}catch(t){return this.loggingService.catch("Error in ContactUtilsService mergeUserIamWithUser: ",t),e}}};o.\u0275fac=function(t){return new(t||o)(ee(y),ee(Ln))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Epe=(()=>{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=E(E({},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)(ee(y),ee(Ln))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var u9=(()=>{let o=class o{constructor(e,t,r){this.coreActionsService=e,this.loggingService=t,this.usersService=r}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=E(E({},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=vt();this.coreActionsService.triggerAction(ct.USER_RESOLVER,{event:Y.Events.Resolver.USER_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:r,methodName:Hr.RESOLVE_USERS_FROM_HUDDLE_MESSAGES,source:"internal",payload:{userIds:t}});let a=yield this.usersService.resolveUsers({userIds:t,uniqueId:r});for(let s of e)s?.from?.userId&&a[s.from.userId]&&(s.from=a[s.from.userId])}return e}catch(t){return this.loggingService.catch("Error in HuddleUtilsService resolveUsersFromHuddleMessages:",t),e}})}formatHuddleMessageData(e){try{return this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: formatHuddleMessageData","color: green;"),this.usersService.userDataProviderAvailable()&&e?.from?.userId&&(e.from={userId:e.from.userId}),e}catch(t){return this.loggingService.catch("Error in HuddleUtilsService formatHuddleMessageData:",t),e}}};o.\u0275fac=function(t){return new(t||o)(ee(ni),ee(y),ee(Ln))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var h9=(()=>{let o=class o{constructor(e,t,r){this.coreActionsService=e,this.loggingService=t,this.usersService=r}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),[]}}getUserIdsToResolveFromLiveStateSingleEditorMode(e){try{let t=new Set;return e?.editor?.userId&&t.add(e?.editor?.userId),e?.requestEditorAccess?.user?.userId&&t.add(e?.requestEditorAccess?.user?.userId),Array.from(t)}catch(t){return this.loggingService.catch("Error in LiveStateUtilsService getUserIdsToResolveFromLiveStateSingleEditorMode:",t),[]}}mergeLiveStateWithUser(e){try{if(e?.default?.singleEditorMode?.editor?.userId){let t=this.usersService.getUserById(e?.default?.singleEditorMode?.editor?.userId);t&&(e.default.singleEditorMode.editor=t)}if(e?.default?.singleEditorMode?.requestEditorAccess?.user?.userId){let t=this.usersService.getUserById(e?.default?.singleEditorMode?.requestEditorAccess?.user?.userId);t&&(e.default.singleEditorMode.requestEditorAccess.user=t)}return e}catch(t){return this.loggingService.catch("Error in LiveStateUtilsService mergeLiveStateWithUser:",t),e}}mergeSingleEditorLiveStateDataWithUser(e){try{if(e?.editor?.userId){let t=this.usersService.getUserById(e?.editor?.userId);t&&(e.editor=t)}if(e?.requestEditorAccess?.user?.userId){let t=this.usersService.getUserById(e?.requestEditorAccess?.user?.userId);t&&(e.requestEditorAccess.user=t)}return e}catch(t){return this.loggingService.catch("Error in LiveStateUtilsService mergeSingleEditorLiveStateDataWithUser:",t),e}}resolveAndMergeSingleEditorLiveStateDataWithUser(e){return Q(this,null,function*(){try{let t=this.getUserIdsToResolveFromLiveStates({default:{singleEditorMode:e}});if(t.length){let r=vt();return this.coreActionsService.triggerAction(ct.USER_RESOLVER,{event:Y.Events.Resolver.USER_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:r,methodName:Hr.RESOLVE_AND_MERGE_SINGLE_EDITOR_LIVE_STATE_DATA_WITH_USER,source:"internal",payload:{userIds:t}}),yield this.usersService.resolveUsers({userIds:t,uniqueId:r}),this.mergeSingleEditorLiveStateDataWithUser(e)}return e}catch(t){return this.loggingService.catch("Error in LiveStateUtilsService resolveAndMergeSingleEditorLiveStateDataWithUser:",t),e}})}formatLiveStateSingleEditorModeData(e){try{return this.usersService.userDataProviderAvailable()&&(e?.editor?.userId&&(e.editor={userId:e.editor.userId}),e?.requestEditorAccess?.user?.userId&&(e.requestEditorAccess.user={userId:e.requestEditorAccess.user.userId})),e}catch(t){return this.loggingService.catch("Error in LiveStateUtilsService formatLiveStateSingleEditorModeData:",t),e}}mergeLiveStateCustomsWithUsers(e){try{for(let t of e)if(t?.updatedBy?.userId){let 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)(ee(ni),ee(y),ee(Ln))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Dpe=(()=>{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)(ee(y),ee(Ln))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var kC=(()=>{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?D(E({},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 Dl(e,this.authService.getUser()?.userId??"")}catch(t){this.loggingService.catch("Error in RecorderUtilsService encryptRecorderAnnotation:",t);return}})}};o.\u0275fac=function(t){return new(t||o)(ee(je),ee(y),ee(Ln))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var f9=(()=>{let o=class o{constructor(e,t,r,a,s,c){this.commentUtilsService=e,this.recorderUtilsService=t,this.loggingService=r,this.usersService=a,this.authService=s,this.commentAnnotationsResolverService=c}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 c of s)t.add(c)}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 Dl(e,r)}catch(r){return this.loggingService.catch("Error in NotificationUtilsService handleNotificationEncryption:",r),e}})}};o.\u0275fac=function(t){return new(t||o)(ee(tu),ee(kC),ee(y),ee(Ln),ee(je),ee(Js))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Ope=(()=>{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=E(E({},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)(ee(y),ee(Ln))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Ape=(()=>{let o=class o{constructor(e,t,r,a,s,c){this.loggingService=e,this.usersService=t,this.authService=r,this.functions=a,this.configService=s,this.reactionAnnotationsResolverService=c}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=Dk(this.authService.getFirebaseConfig()?.firebaseOptions),c=Xi(this.functions,Qi({url:wn.cloudFunction?.[s]?.setEncryptedData,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:1200*1e3}),p=Jg.getFirestoreProdDbName(this.configService.getApiKey()??"",this.authService.getFirebaseConfig()?.firebaseOptions),g=this.authService.getUser()?.userId??"",f={path:t??"",data:e??{},dbId:p??"",feature:"reaction",eventType:r??"PATCH",sdkVersion:_a()},I=yield Dl(f,g);yield c({veltData:I})}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?!ui(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]=E({annotationId:r,metadata:J0(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)(ee(y),ee(Ln),ee(je),ee(xo),ee(Ft),ee(vm))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Ppe=(()=>{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)(ee(y),ee(Ln))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Mpe=(()=>{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)(ee(y),ee(Ln))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Cm=(()=>{let o=class o{constructor(e,t,r,a,s,c,p,g,f,I,T,L,G,z,J,le,_e,De,Be,Ve){this.areaUtilsService=e,this.arrowUtilsService=t,this.commentUtilsService=r,this.contactUtilsService=a,this.coreActionsService=s,this.cursorUtilsService=c,this.huddleUtilsService=p,this.liveStateUtilsService=g,this.loggingService=f,this.multiThreadUtilsService=I,this.notificationUtilsService=T,this.presenceUtilsService=L,this.reactionUtilsService=G,this.recorderUtilsService=z,this.selectionUtilsService=J,this.tagUtilsService=le,this.usersService=_e,this.docService=De,this.commentAnnotationsResolverService=Be,this.reactionAnnotationsResolverService=Ve}getErrorForGetRequests({feature:e,error:t}){try{switch(e){case"organizationMetadata":case"documentMetadata":case"folderMetadata":return(t?.message??"")?.includes("Missing or insufficient permissions.")?{errorCode:"PERMISSION_DENIED"}:null;default:return null}}catch(r){return this.loggingService.catch("Error in CommonDbUtilsService getErrorForGetRequests:",r),null}}getFirestorePath({feature:e,properties:t,documentPaths:r,apiKey:a}){try{if(!a)return;let{documentId:s,organizationId:c,folderId:p}=t;c||(c=r?.organizationId);let g=new d9({apiKey:a,documentId:s?`${s}`:"",organizationId:c?`${c}`:"",veltFolderId:p?`${p}`:void 0});switch(e){case"userConfig":return t?.userId&&t?.documentId&&g?.userConfig?`${g?.userConfig}/${t?.userId}/${U.FIREBASE_PARTIAL_PATH_DOCUMENT_CONFIGURATIONS}/${t?.documentId}`:void 0;case"allPermissionsUsers":return g?.permissionsUsers?`${g?.permissionsUsers}`:void 0;case"comment":return t?.documentId&&t?.id&&g?.comment?`${g?.comment}/${t?.id}`:void 0;case"allComments":return t?.documentId&&g?.comment?`${g?.comment}`:void 0;case"multiThread":return t?.documentId&&t?.id&&g?.multiThread?`${g?.multiThread}/${t?.id}`:void 0;case"allMultiThreads":return t?.documentId&&g?.multiThread?`${g?.multiThread}`:void 0;case"crdt":return t?.documentId&&g?.crdt&&t?.id?`${g?.crdt}/${t?.id}`:void 0;case"allLastNotificationTimestamp":return g?.lastNotificationTimestamp?`${g?.lastNotificationTimestamp}`:void 0;case"lastNotificationTimestamp":return t?.id&&g?.lastNotificationTimestamp?`${g?.lastNotificationTimestamp}/${t?.id}`:void 0;case"area":return t?.documentId&&t?.id&&g?.area?`${g?.area}/${t?.id}`:void 0;case"allAreas":return t?.documentId&&g?.area?`${g?.area}`:void 0;case"allDocuments":return g?.document?`${g?.document}`:void 0;case"allLocations":return g?.location?`${g?.location}`:void 0;case"allFolders":return g?.folder?`${g?.folder}`:void 0;case"folder":return g?.folder&&t.folderId?`${g?.folder}/${t.folderId}`:void 0;case"documentUserAccess":return t?.documentId&&t?.id&&g?.documentUsers?`${g?.documentUsers}/${t?.id}`:void 0;case"reaction":return t?.documentId&&t?.id&&g?.reaction?`${g?.reaction}/${t?.id}`:void 0;case"allReactions":return t?.documentId&&g?.reaction?`${g?.reaction}`:void 0;case"recorder":return t?.documentId&&t?.id&&g?.recorder?`${g?.recorder}/${t?.id}`:void 0;case"allRecorders":return t?.documentId&&g?.recorder?`${g?.recorder}`:void 0;case"recorderTrackEvent":return t?.documentId&&t?.id&&g?.recorder?`${g?.recorder}/${t?.id}/trackRecorderEvent`:void 0;case"documentAccessType":return t?.documentId&&g?.document?`${g?.document}/${t?.documentId}`:void 0;case"organizationMetadata":return g?.organization?`${g?.organization}`:void 0;case"documentIam":case"documentMetadata":return t?.documentId&&g?.document?`${g?.document}/${t?.documentId}`:void 0;case"folderMetadata":return t?.folderId&&g?.folder?`${g?.folder}/${t?.folderId}`:void 0;case"locationMetadata":return t?.documentId&&g?.location&&t?.id?`${g?.location}/${t?.id}`:void 0;case"documentUser":return t?.documentId&&t?.id&&g?.documentUsers?`${g?.documentUsers}/${t?.id}`:void 0;case"allDocumentUsers":return g?.users?`${g?.users}`:void 0;case"allFolderUsers":return g?.users?`${g?.users}`:void 0;case"allOrganizationGroups":return g?.organizationGroups?`${g?.organizationGroups}`:void 0;case"allOrganizationUsers":return g?.users?`${g?.users}`:void 0;case"notificationViewsTimestamp":return t?.documentId&&t?.id&&g?.notificationViews?`${g?.notificationViews}/${t?.id}`:void 0;case"allDocumentViews":return t?.documentId&&g?.documentViews?`${g?.documentViews}`:void 0;case"documentViews":case"documentMetadataViews":case"documentDayViews":case"documentUsersViews":return t?.documentId&&t?.id&&g?.documentViews?`${g?.documentViews}/${t?.id}`:void 0;case"locationDayViews":case"locationUsersViews":case"locationViews":case"locationMetadataViews":case"location":return t?.documentId&&t?.id&&g?.locationViews?`${g?.locationViews}/${t?.id}`:void 0;case"allLocationViews":return t?.documentId&&g?.locationViews?`${g?.locationViews}`:void 0;case"allDocNotifications":return t?.documentId&&g?.docNotification?`${g?.docNotification}`:void 0;case"docNotificationViews":case"docNotification":return t?.documentId&&t?.id&&g?.docNotification?`${g?.docNotification}/${t?.id}`:void 0;case"userNotificationViews":case"userNotification":return t?.userId&&t?.id&&g?.notificationUsers?`${g?.notificationUsers}/${t?.userId}/${U.FIREBASE_PARTIAL_PATH_USER_NOTIFICATION}/${t?.id}`:void 0;case"allUserNotifications":return t?.userId&&g?.notificationUsers?`${g?.notificationUsers}/${t?.userId}/${U.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 U.FIREBASE_PARTIAL_PATH_COMMENT;case"allDocuments":return U.FIREBASE_PARTIAL_PATH_DOCS;case"allLocations":return U.FIREBASE_PARTIAL_PATH_LOCATION;case"allMultiThreads":return U.FIREBASE_PARTIAL_PATH_MULTI_THREAD;case"allAreas":return U.FIREBASE_PARTIAL_PATH_AREA;case"allReactions":return U.FIREBASE_PARTIAL_PATH_REACTION;case"allRecorders":return U.FIREBASE_PARTIAL_PATH_RECORDER;case"allDocumentViews":return U.FIREBASE_PARTIAL_PATH_DOCUMENT_VIEWS;case"allLocationViews":return U.FIREBASE_PARTIAL_PATH_LOCATION_VIEWS;case"allDocumentUsers":return U.FIREBASE_PARTIAL_PATH_DOCUMENT_USERS;case"allFolderUsers":return U.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:c,organizationId:p}=t;p||(p=r?.organizationId);let g=new fm({apiKey:a,documentId:c?`${c}`:"",organizationId:p?`${p}`:""});switch(e){case"userConfig":return t?.userId&&t?.documentId&&g?.userConfig?`${g?.userConfig}/${t?.userId}/${U.FIREBASE_PARTIAL_PATH_DOCUMENT_CONFIGURATIONS}/${t?.documentId}`:void 0;case"allComments":return!s&&t?.documentId&&g?.comment?`${g?.comment}`:void 0;case"allGlobalContacts":return t?.documentId&&g?.globalContacts?`${g?.globalContacts}`:void 0;case"globalContacts":return t?.documentId&&t?.userId&&g?.globalContacts?`${g?.globalContacts}${t?.userId}`:void 0;case"groupContacts":return t?.documentId&&t?.groupId&&g?.groupContacts?`${g?.groupContacts}${t?.groupId}`:void 0;case"groupContactsUser":return t?.documentId&&t?.groupId&&t?.userId&&g?.groupContacts?`${g?.groupContacts}${t?.groupId}/${t?.userId}`:void 0;case"allLoginContacts":return t?.documentId&&t?.userId&&g?.logins?`${g?.logins}${t?.userId}/contacts`:void 0;case"allLogins":return t?.documentId&&g?.logins?`${g?.logins}`:void 0;case"logins":return t?.documentId&&t?.userId&&g?.logins?`${g?.logins}${t?.userId}`:void 0;case"customerMetadata":return g?.customerMetadata?`${g?.customerMetadata}`:void 0;case"allArrows":return t?.documentId&&g?.arrow?`${g?.arrow}`:void 0;case"arrow":return t?.documentId&&g?.arrow&&t.id?`${g?.arrow}${t.id}`:void 0;case"allCursors":return t?.documentId&&g?.cursor?`${g?.cursor}`:void 0;case"cursor":return t?.documentId&&g?.cursor&&t.id?`${g?.cursor}${t.id}`:void 0;case"flockUser":return t?.documentId&&g?.flock&&t.id?`${g?.flock}users/${t.id}`:void 0;case"flockSession":return t?.documentId&&g?.flock&&t.id?`${g?.flock}sessions/${t.id}`:void 0;case"allHuddleAttendees":return t?.documentId&&g?.huddle?`${g?.huddle}attendees`:void 0;case"huddleAttendee":return t?.documentId&&g?.huddle&&t.id?`${g?.huddle}attendees/${t.id}`:void 0;case"huddleAttendeeState":return t?.documentId&&g?.huddle&&t.id?`${g?.huddle}attendees/${t.id}/state`:void 0;case"allHuddleInvitees":return t?.documentId&&g?.huddle?`${g?.huddle}invitees`:void 0;case"huddleConnection":return t?.documentId&&g?.huddle&&t.id?`${g?.huddle}connections/${t.id}`:void 0;case"huddleIceCandidate":return t?.documentId&&g?.huddle&&t.id?`${g?.huddle}iceCandidates/${t.id}`:void 0;case"allHuddleIceCandidates":return t?.documentId&&g?.huddle?`${g?.huddle}iceCandidates`:void 0;case"allHuddleMessages":return t?.documentId&&g?.huddle?`${g?.huddle}messages`:void 0;case"huddleMessage":return t?.documentId&&g?.huddle&&t.id?`${g?.huddle}messages/${t.id}`:void 0;case"allLiveStates":return t?.documentId&&g?.liveState?`${g?.liveState}`:void 0;case"allLiveStateCustoms":return t?.documentId&&g?.liveState?`${g?.liveState}custom`:void 0;case"liveStateCustom":return t?.documentId&&g?.liveState&&t?.id?`${g?.liveState}custom/${t.id}`:void 0;case"liveStateSingleEditorMode":return t?.documentId&&g?.liveStateSingleEditorMode?`${g?.liveStateSingleEditorMode}`:void 0;case"liveStateAutoSyncState":return t?.documentId&&g?.liveState?`${g?.liveState}default/autoSyncState`:void 0;case"liveStateAutoSyncStateCurrent":return t?.documentId&&g?.liveState?`${g?.liveState}default/autoSyncState/current`:void 0;case"liveStateAutoSyncStateHistoryId":return t?.documentId&&g?.liveState&&t?.id?`${g?.liveState}default/autoSyncState/history/${t.id}`:void 0;case"presence":return t?.documentId&&g?.presence&&t?.userId?`${g?.presence}${t?.userId}`:void 0;case"allPresence":return t?.documentId&&g?.presence?`${g?.presence}`:void 0;case"workspaceIam":return g?.workspaceIam?`${g?.workspaceIam}`:void 0;case"selection":return t?.documentId&&g?.selection&&t?.userId?`${g?.selection}${t?.userId}`:void 0;case"allSelections":return t?.documentId&&g?.selection?`${g?.selection}`:void 0;case"syncVideoPlayer":return t?.documentId&&g?.syncVideoPlayer?`${g?.syncVideoPlayer}`:void 0;case"allTags":return t?.documentId&&g?.tag?`${g?.tag}`:void 0;case"tag":return t?.documentId&&g?.tag&&t?.id?`${g?.tag}${t?.id}`:void 0;case"userContactUs":return t?.documentId&&g?.userContactUs?`${g?.userContactUs}`:void 0;case"userFeedback":return t?.documentId&&g?.userFeedback?`${g?.userFeedback}`:void 0;case"userReportBug":return t?.documentId&&g?.userReportBugs?`${g?.userReportBugs}`:void 0;case"comment":return!s&&t?.documentId&&t?.id&&g?.comment?`${g?.comment}${t?.id}`:void 0;case"allMultiThreads":return!s&&t?.documentId&&g?.multiThread?`${g?.multiThread}`:void 0;case"crdt":return!s&&t?.documentId&&g?.crdt?`${g?.crdt}`:void 0;case"crdtData":return t?.documentId&&g?.crdt&&t?.id?`${g?.crdt}/${t?.id}/data`:void 0;case"crdtSyncState":return t?.documentId&&g?.crdt&&t?.id?`${g?.crdt}/${t?.id}/sync/state`:void 0;case"crdtSyncPresence":return t?.documentId&&t.userId&&g?.crdt&&t?.id?`${g?.crdt}/${t?.id}/sync/presence/${t.userId}`:void 0;case"allCrdtSyncPresence":return t?.documentId&&g?.crdt&&t?.id?`${g?.crdt}/${t?.id}/sync/presence`:void 0;case"crdtPresence":return t?.documentId&&t.userId&&g?.crdt&&t?.id?`${g?.crdt}/${t?.id}/presence/${t.userId}`:void 0;case"allCrdtPresence":return t?.documentId&&g?.crdt&&t?.id?`${g?.crdt}/${t?.id}/presence`:void 0;case"crdtVersion":return t?.documentId&&g?.crdt&&t?.id&&t?.versionId?`${g?.crdt}/${t?.id}/versions/${t?.versionId}`:void 0;case"crdtVersions":return t?.documentId&&g?.crdt&&t?.id?`${g?.crdt}/${t?.id}/versions`:void 0;case"multiThread":return!s&&t?.documentId&&t?.id&&g?.multiThread?`${g?.multiThread}${t?.id}`:void 0;case"allLastNotificationTimestamp":return!s&&g?.organizationNotificationsLastNotificationTimestamp?`${g?.organizationNotificationsLastNotificationTimestamp}`:void 0;case"lastNotificationTimestamp":return!s&&t?.id&&g?.organizationNotificationsLastNotificationTimestamp?`${g?.organizationNotificationsLastNotificationTimestamp}${t?.id}`:void 0;case"documentIam":return!s&&t?.documentId&&g?.documentIam?`${g?.documentIam}`:void 0;case"allDocuments":return!s&&g?.docs&&t?.documentId?`${g?.docs}/${t?.documentId}/${U.FIREBASE_PARTIAL_PATH_METADATA}`:void 0;case"allAreas":return!s&&t?.documentId&&g?.area?`${g?.area}`:void 0;case"area":return!s&&t?.id&&g?.area?`${g?.area}${t?.id}`:void 0;case"folder":return!s&&t?.folderId&&g?.folder?`${g?.folder}${t?.folderId}`:void 0;case"documentUserAccess":return!s&&t?.id&&g?.documentIam?`${g?.documentIam}users/${t?.id}`:void 0;case"documentUser":return!s&&t?.documentId&&t?.id&&g?.documentIam?`${g?.documentIam}users/${t?.id}`:void 0;case"allDocumentUsers":return!s&&t?.documentId&&g?.documentIam?`${g?.documentIam}users/`:void 0;case"allOrganizationGroups":return!s&&g?.organizationGroups?`${g?.organizationGroups}`:void 0;case"allOrganizationUsers":return!s&&g?.organizationIam?`${g?.organizationIam}users/`:void 0;case"reaction":return!s&&t?.id&&g?.reaction?`${g?.reaction}${t?.id}`:void 0;case"allReactions":return!s&&t?.documentId&&g?.reaction?`${g?.reaction}`:void 0;case"recorder":return!s&&t?.documentId&&t?.id&&g?.recorder?`${g?.recorder}${t?.id}`:void 0;case"allRecorders":return!s&&t?.documentId&&g?.recorder?`${g?.recorder}`:void 0;case"organizationMetadata":return!s&&g?.organizationMetadata?`${g?.organizationMetadata}`:void 0;case"heartbeat":return t?.id&&g?.heartbeat?`${g?.heartbeat}${t?.id}`:void 0;case"allHeartbeats":return g?.heartbeat?`${g?.heartbeat}`:void 0;case"heartbeatByDocument":return t?.id&&g?.heartbeatByDocument?`${g?.heartbeatByDocument}${t?.id}`:void 0;case"allHeartbeatsByDocument":return g?.heartbeatByDocument?`${g?.heartbeatByDocument}`:void 0;case"documentAccessType":return!s&&g?.documentIam?`${g?.documentIam}`:void 0;case"documentMetadata":return!s&&t?.documentId&&g?.metadata?`${g?.metadata}`:void 0;case"allDocumentViews":return!s&&t?.documentId&&g?.views?`${g?.views}documentViews/`:void 0;case"documentViews":return!s&&t?.documentId&&t?.id&&g?.views?`${g?.views}documentViews/${t?.id}`:void 0;case"allLocationViews":return!s&&t?.documentId&&g?.views?`${g?.views}locationViews/`:void 0;case"notificationViewsTimestamp":return!s&&t?.id&&t?.user&&g?.views?`${g?.views}notification/${t?.id}/views/${t?.user}`:void 0;case"documentUsersViews":return!s&&t?.id&&t?.user&&t?.date&&g?.views?`${g?.views}documentViews/${t?.id}/users/${t?.user}/${t?.date}`:void 0;case"documentMetadataViews":return!s&&t?.id&&g?.views?`${g?.views}documentViews/${t?.id}/metadata`:void 0;case"documentDayViews":return!s&&t?.id&&t?.date&&t?.user&&g?.views?`${g?.views}documentViews/${t?.id}/day/${t?.date}/${t?.user}`:void 0;case"locationViews":return!s&&t?.id&&g?.views?`${g?.views}locationViews/${t?.id}/location`:void 0;case"location":return!s&&t?.id&&g?.views?`${g?.views}locationViews/${t?.id}`:void 0;case"locationUsersViews":return!s&&t?.id&&t?.user&&t?.date&&g?.views?`${g?.views}locationViews/${t?.id}/users/${t?.user}/${t?.date}`:void 0;case"locationMetadataViews":return!s&&t?.id&&g?.views?`${g?.views}locationViews/${t?.id}/metadata`:void 0;case"locationDayViews":return!s&&t?.id&&t?.date&&t?.user&&g?.views?`${g?.views}locationViews/${t?.id}/day/${t?.date}/${t?.user}`:void 0;case"docNotificationViews":case"docNotification":return t?.documentId&&t?.id&&g?.organizationNotificationsWithDocumentId?`${g?.organizationNotificationsWithDocumentId}${t?.id}`:void 0;case"allDocNotifications":return t?.documentId&&g?.organizationNotificationsWithDocumentId?`${g?.organizationNotificationsWithDocumentId}`:void 0;case"allUserNotifications":return t?.userId&&g?.organizationNotificationsUsers?`${g?.organizationNotificationsUsers}${t?.userId}`:void 0;case"userNotificationViews":case"userNotification":return t?.userId&&t?.id&&g?.organizationNotificationsUsers?`${g?.organizationNotificationsUsers}${t?.userId}/${t?.id}`:void 0;case"locationMetadata":return;case"allLocations":return;case"folderMetadata":return;case"allPermissionsUsers":return;default:throw new Error(`Unknown feature: ${e}`)}}catch(c){this.loggingService.catch("Error in CommonDbUtilsService getDocumentPath:",c);return}}resolveAnnotations(r){return Q(this,arguments,function*({data:e,feature:t}){try{if(e&&e?.length>0)switch(t){case"allComments":{if(this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable()){let a=vt();this.coreActionsService.triggerAction(ct.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:a,methodName:No.FORMAT_RESPONSE,source:"internal",payload:{commentAnnotationIds:e,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""}}),this.commentAnnotationsResolverService.resolveCommentAnnotations({commentAnnotationIds:e,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""},a)}break}case"allReactions":{if(this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable()){let a=vt();this.coreActionsService.triggerAction(ct.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:a,methodName:Ho.FORMAT_RESPONSE,source:"internal",payload:{reactionAnnotationIds:e,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""}}),this.reactionAnnotationsResolverService.resolveReactionAnnotations({reactionAnnotationIds:e,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""},a)}break}default:break}}catch(a){this.loggingService.catch(`Error in CommonDbUtilsService resolveAnnotations: ${t}`,a)}})}formatResponse(c){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"liveStateSingleEditorMode":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.liveStateUtilsService.getUserIdsToResolveFromLiveStateSingleEditorMode(t));break}case"allSelections":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.selectionUtilsService.getUserIdsToResolveFromSelections(Object.values(t)));break}default:p=[]}if(p?.length){let g=vt();this.coreActionsService.triggerAction(ct.USER_RESOLVER,{event:Y.Events.Resolver.USER_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:g,methodName:Hr.FORMAT_RESPONSE,source:"internal",payload:{userIds:p,feature:e,forceResolve:a}}),r?yield this.usersService.resolveUsers({userIds:p,forceResolve:a,feature:e,uniqueId:g}):this.usersService.resolveUsers({userIds:p,forceResolve:a,feature:e,uniqueId:g})}}if(this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable()){let p=[];switch(e){case"allDocNotifications":{if(t&&typeof t=="object"){let g=this.notificationUtilsService.getTargetAnnotationIdsFromNotifications(t);p=[...p,...g],p=p.filter(f=>!this.commentAnnotationsResolverService.getCommentAnnotationById(f))}break}case"allUserNotifications":{if(t&&typeof t=="object"&&!Array.isArray(t)){let g=this.notificationUtilsService.getTargetAnnotationIdsFromNotifications(t);p=[...p,...g],p=p.filter(f=>!this.commentAnnotationsResolverService.getCommentAnnotationById(f))}break}default:p=[]}if(p?.length){let g=vt();this.coreActionsService.triggerAction(ct.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:g,methodName:No.FORMAT_RESPONSE,source:"internal",payload:{commentAnnotationIds:p,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??"",shouldCommentAnnotationsResolverAwait:s}}),s?yield this.commentAnnotationsResolverService.resolveCommentAnnotations({commentAnnotationIds:p,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""},g):this.commentAnnotationsResolverService.resolveCommentAnnotations({commentAnnotationIds:p,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""},g)}}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,c])=>(a[s]=this.commentUtilsService.mergeLocationWithCommentAnnotations(c,r),a),{}):e;case"allDocNotifications":case"allUserNotifications":return e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).reduce((a,[s,c])=>(a[s]=this.notificationUtilsService.mergeLocationWithNotification(c,r),a),{}):e;default:return e}return e}catch(a){return this.loggingService.catch("Error in CommonDbUtilsService mergeLocationMetadataWithData:",a),e}}mergeUsersWithData({feature:e,data: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"liveStateSingleEditorMode":return t&&typeof t=="object"&&!Array.isArray(t)?this.liveStateUtilsService.mergeSingleEditorLiveStateDataWithUser(t):t;case"allSelections":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((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}}),_t(Xt))}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}}),_t(Xt))}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}}),_t(Xt))}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}}),_t(Xt))}catch(r){return this.loggingService.catch(`Error in mergeLocationMetadataWithData for ${t}:`,r),se(e)}}handleDataStripping({feature:e,data:t,actionType:r,commentId:a}){try{switch(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: handleDataStripping","color: green;"),e){case"comment":return this.commentUtilsService.stripCommentAnnotationData({data:t,actionType:r,commentId:a});case"reaction":return this.reactionUtilsService.stripReactionAnnotationData(t);default:return{originalData:t,strippedData:null}}}catch(s){return this.loggingService.catch("Error in CommonDbUtilsService handleDataStripping:",s),{originalData:t,strippedData:null}}}formatData({feature:e,data:t,properties: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 c=new Date().getTime()+a;switch(e){case"documentAccessType":return delete t?.users,{docIamConfig:t};case"organizationMetadata":case"documentMetadata":return s?t:{metadata:t};case"documentCommentMetadata":return t;case"cursor":return this.cursorUtilsService.formatCursorUserData(t);case"comment":return this.commentUtilsService.formatCommentData(t);case"area":return this.areaUtilsService.formatAreaData(t);case"arrow":return this.arrowUtilsService.formatArrowData(t);case"liveStateCustom":return this.liveStateUtilsService.formatLiveStateCustomData(t);case"liveStateSingleEditorMode":return this.liveStateUtilsService.formatLiveStateSingleEditorModeData(t);case"multiThread":return this.multiThreadUtilsService.formatMultiThreadData(t);case"reaction":return this.reactionUtilsService.formatReactionData(t);case"recorder":return this.recorderUtilsService.formatRecorderData(t,c);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(c){return this.loggingService.catch("Error in CommonDbUtilsService formatData:",c),t}}modifyAndSetData(s){return Q(this,arguments,function*({feature:e,data:t,subscriber:r,operation:a=null}){try{let c=yield this.modifyData({feature:e,data:t});r.next({data:c,operation:a})}catch(c){this.loggingService.catch("Error in CommonDbUtilsService modifyAndSetData:",c)}})}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)?D(E({},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:c=null}){try{let f={comment:"allComments",reaction:"allReactions"}[e];if(!f)return null;let I=t?.metadata?.documentId,T=t?.metadata?.veltFolderId;return Object.keys(r).filter(L=>L.includes(f)&&(!I||L.includes(I)||T&&L.includes(T))).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:c})):r[L]?.subject?.next({data:D(E({},G?.data),{[t?.annotationId]:t}),operation:c})}),null}catch(g){return this.loggingService.catch("Error in CommonDbUtilsService setDataInLocal:",g),null}})}handleCommentEncryption(c){return Q(this,arguments,function*({data:e,firestorePath:t,extraData:r,eventType:a,metadata:s}){try{return yield this.commentUtilsService.handleCommentEncryption({data:e,firestorePath:t,extraData:r,eventType:a,metadata:s})}catch(p){return this.loggingService.catch("Error in CommonDbUtilsService handleCommentEncryption:",p),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}})}rtdbDefaultTransactionCallback(e,t){try{let r=E({},e||{});return Object.entries(t).forEach(([a,s])=>{s==null?delete r[a]:r[a]=s}),r}catch(r){return this.loggingService.catch("Error in CommonDbUtilsService rtdbDefaultTransactionCallback:",r),e}}};o.\u0275fac=function(t){return new(t||o)(ee(Spe),ee(bpe),ee(tu),ee(Ipe),ee(ni),ee(Epe),ee(u9),ee(h9),ee(y),ee(Dpe),ee(f9),ee(Ope),ee(Ape),ee(kC),ee(Ppe),ee(Mpe),ee(Ln),ee(rt),ee(Js),ee(vm))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var kpe=(()=>{let o=class o{constructor(e,t,r){this.configService=e,this.authService=t,this.loggingService=r,this.firestore$=new ve(null);try{mn([this.authService.getFirebaseConfig$(),this.configService.getApiKey$()]).pipe(Fe(([a,s])=>!!a&&!!s),ot(1)).subscribe(([a,s])=>{a&&s&&a?.firebaseOptions?.storeDbId&&this.firestore$.next(BR(Jg.getFirestoreProdDbName(s,a.firebaseOptions)))},a=>{})}catch{}}getFirestore(){return this.firestore$.asObservable()}getFirestoreValue(){return this.firestore$.value}generateFirestoreDocumentId(){try{let e=this.getFirestoreValue()||BR("DocumentIdDb");if(e){let t=RI(e,"generateDocumentId");return xC(t).id}return}catch(e){this.loggingService.catch("Error in FirestoreService generateFirestoreDocumentId: ",e);return}}};o.\u0275fac=function(t){return new(t||o)(ee(Ft),ee(je),ee(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var un=(()=>{let o=class o{constructor(e,t,r,a,s,c,p,g,f,I,T){this.authService=e,this.commonDbUtilsService=t,this.coreActionsService=r,this.loggingService=a,this.firestoreService=s,this.databaseService=c,this.configService=p,this.docService=g,this.usersService=f,this.commentAnnotationsResolverService=I,this.reactionAnnotationsResolverService=T,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(L=>{if(L){this.db=L;let G=Mi(L,".info/serverTimeOffset");this.offsetListener=wg(G,z=>{let J=z.val();this.offset=J})}})),this.subscriptions.push(this.firestoreService.getFirestore().subscribe(L=>{L&&(this.firestore=L)}))}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=Mi(this.db,e);return El(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){mn([this.databaseService.getDb(),this.firestoreService.getFirestore()]).pipe(Fe(([t,r])=>!!t),ot(1),on(([t,r])=>{e({db:t,firestore:r})})).subscribe({error:t=>{this.loggingService.catch("Error in CommonDbService subscription: ",t)}})}performDatabaseOperation(e,t,r,a,s,c){return Q(this,null,function*(){try{if(!t){this.loggingService.warn(`%c[WB] No properties found for ${e}`,"color: red;");return}return this.subscribeToServices(f=>Q(this,[f],function*({db:p,firestore:g}){let I;t?.skipFirestore||(I=this.commonDbUtilsService.getFirestorePath({feature:e,properties:t,documentPaths:this.docService.getDocumentPaths(),apiKey:t.apiKey??this.configService.getApiKey()}));let T=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{T&&(L=Mi(p,`${T}`))}catch{this.loggingService.catch("Error in dbRef")}try{I?.includes("/organizations")&&g&&I&&(G=xC(g,`${I}`))}catch{this.loggingService.catch("Error in docRef")}if(!this.authService.getUser())return;yield r({dbRef:L,firestoreRef:G,data:a,firestorePath:I}),c&&c({firestoreAvailable:!!g})}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:c}){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,g=>Q(this,null,function*(){if(g.dbRef){let f=this.commonDbUtilsService.formatData({feature:e,data:g.data,properties:r,offset:this.getOffset(),isRealtimeDb:!0});r?.rtdbTransaction?yield Hh(g.dbRef,()=>JSON.parse(JSON.stringify(f))):yield f0(g.dbRef,JSON.parse(JSON.stringify(f)))}try{if(g.firestoreRef&&g.data&&!r?.skipFirestore){let f=this.commonDbUtilsService.formatData({feature:e,data:g.data,properties:r,offset:this.getOffset()});typeof f=="object"&&(f=JSON.parse(JSON.stringify(f)));let{strippedData:I,originalData:T,eventType:L}=this.commonDbUtilsService.handleDataStripping({feature:e,data:f,actionType:c?.actionType,commentId:c?.targetAnnotationData?.commentId??r?.targetCommentId});if(e==="comment"){let G=null,z=vt();this.coreActionsService.triggerAction(ct.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:z,methodName:No.SET_DATA,source:"internal",payload:{strippedData:I,originalData:T,eventType:L,commentId:c?.targetAnnotationData?.commentId}}),I&&(G=yield this.commentAnnotationsResolverService.saveCommentAnnotation({commentAnnotation:I,eventType:L,commentId:c?.targetAnnotationData?.commentId},z)),T&&(G?.isSuccess||G===null)&&(yield this.commonDbUtilsService.handleCommentEncryption({data:T,firestorePath:g.firestorePath??"",extraData:c,metadata:r?.metadata}))}else if(e==="reaction"){let G=null,z=vt();this.coreActionsService.triggerAction(ct.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:z,methodName:Ho.SET_DATA,source:"internal",payload:{strippedData:I,originalData:T}}),I&&(G=yield this.reactionAnnotationsResolverService.saveReactionAnnotation(I,z)),T&&(G?.isSuccess||G===null)&&(yield this.commonDbUtilsService.handleReactionEncryption({data:T,firestorePath:g.firestorePath??""}))}else e==="recorder"?this.firestore&&(yield ope(this.firestore,G=>Q(this,null,function*(){G.set(g.firestoreRef,f)}))):yield NW(g.firestoreRef,f)}}catch(f){this.authService.getUser()&&this.loggingService.catch(`Error in setData for ${e}`,f)}}),t,s,a))}catch(g){this.loggingService.catch(`Error in setData for ${e}`,g)}})}updateData(p){return Q(this,arguments,function*({feature:e,data:t,properties:r,callback:a,errorCallback:s,extraData:c}){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,g=>Q(this,null,function*(){if(g.dbRef&&!r?.skipRtdb){let f=this.commonDbUtilsService.formatData({feature:e,data:g.data,properties:r,offset:this.getOffset(),isRealtimeDb:!0});r?.rtdbTransaction?yield Hh(g.dbRef,I=>{let T;return r?.rtdbTransactionCallback?T=r.rtdbTransactionCallback(I,f):T=this.commonDbUtilsService.rtdbDefaultTransactionCallback(I,f),JSON.parse(JSON.stringify(T))}):yield IM(g.dbRef,JSON.parse(JSON.stringify(f)))}try{if(g.firestoreRef&&g.data&&!r?.skipFirestore){let f=this.commonDbUtilsService.formatData({feature:e,data:g.data,properties:r,offset:this.getOffset()});typeof f=="object"&&(f=JSON.parse(JSON.stringify(f)));let{strippedData:I,originalData:T,eventType:L}=this.commonDbUtilsService.handleDataStripping({feature:e,data:f,actionType:c?.actionType,commentId:c?.targetAnnotationData?.commentId});if(e==="comment"){let G=null,z=vt();this.coreActionsService.triggerAction(ct.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:z,methodName:No.UPDATE_DATA,source:"internal",payload:{strippedData:I,originalData:T,eventType:L,commentId:c?.targetAnnotationData?.commentId}}),I&&(G=yield this.commentAnnotationsResolverService.saveCommentAnnotation({commentAnnotation:I,eventType:L,commentId:c?.targetAnnotationData?.commentId},z)),T&&(G?.isSuccess||G===null)&&(yield this.commonDbUtilsService.handleCommentEncryption({data:T,firestorePath:g.firestorePath??"",extraData:c,metadata:r?.metadata}))}else if(e==="reaction"){let G=null,z=vt();this.coreActionsService.triggerAction(ct.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:z,methodName:Ho.UPDATE_DATA,source:"internal",payload:{strippedData:I,originalData:T}}),I&&(G=yield this.reactionAnnotationsResolverService.saveReactionAnnotation(I,z)),T&&(G?.isSuccess||G===null)&&(yield this.commonDbUtilsService.handleReactionEncryption({data:T,firestorePath:g.firestorePath??""}))}else yield NW(g.firestoreRef,f,{merge:!0})}}catch(f){this.authService.getUser()&&this.loggingService.catch(`Error in updateDoc for ${e}`,f)}}),t,s,a))}catch(g){this.loggingService.catch(`Error in updateData for ${e}`,g)}})}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,c=>Q(this,null,function*(){c.dbRef&&(yield bM(c.dbRef));try{if(c.firestoreRef&&!t?.skipFirestore)if(e==="comment"){let p=null,g=vt();this.coreActionsService.triggerAction(ct.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_DELETE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:g,methodName:No.DELETE_DATA,source:"internal",payload:{commentAnnotationId:t?.id??"",metadata:t?.metadata}}),p=yield this.commentAnnotationsResolverService.deleteCommentAnnotation(t?.id??"",t?.metadata,g),(p?.isSuccess||p===null)&&(yield this.commonDbUtilsService.handleCommentEncryption({firestorePath:c.firestorePath??"",eventType:"DELETE",metadata:t?.metadata}))}else if(e==="reaction"){let p=null,g=vt();this.coreActionsService.triggerAction(ct.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_DELETE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:g,methodName:Ho.DELETE_DATA,source:"internal",payload:{reactionAnnotationId:t?.id??"",metadata:t?.metadata}}),p=yield this.reactionAnnotationsResolverService.deleteReactionAnnotation(t?.id??"",t?.metadata,g),(p?.isSuccess||p===null)&&(yield this.commonDbUtilsService.handleReactionEncryption({firestorePath:c.firestorePath??"",eventType:"DELETE"}))}else yield Jme(c.firestoreRef)}catch(p){this.authService.getUser()&&this.loggingService.catch(`Error in deleteData for ${e}`,p)}}),void 0,a,r)}catch(c){this.loggingService.catch(`Error in deleteData for ${e}`,c)}})}shouldUseFirestore(){try{return this.authService.getAdvancedQueriesEnabled()}catch(e){return this.loggingService.catch("Error in shouldUseFirestore:",e),!1}}generateDocumentId(){try{let e=this.firestoreService.generateFirestoreDocumentId();return e||(e=vt()),e||"noDocumentId"}catch(e){return this.loggingService.catch("Error in generateFirestoreDocumentId:",e),vt()||"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=RI(this.firestore,r);t?.useCollectionGroup&&(a=MW(this.firestore,r));let s=t?.firestoreQuery??[],c=RW(a,...s);if(!this.authService.getUser()&&!t?.skipUserCheck)return[];if(t?.getCount)try{let p=yield tpe(c).catch(g=>(this.authService.getUser()&&this.loggingService.catch(`Error in getCountFromServer for ${e}`,g),null));return p?p.data().count:0}catch(p){return this.authService.getUser()&&this.loggingService.catch(`Error in getCountFromServer for ${e}`,p),0}else try{let p=yield ipe(c).catch(f=>(this.authService.getUser()&&this.loggingService.catch(`Error in getDocs for ${e}`,f),null));if(!p)return[];let g=p.docs.map(f=>f.data());try{return yield this.commonDbUtilsService.modifyData({feature:e,data:g})}catch(f){return this.loggingService.catch(`Error in modifyData for ${e}`,f),g}}catch(p){return this.authService.getUser()&&this.loggingService.catch(`Error in getDocs for ${e}`,p),[]}}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=Mi(this.db,r),s=t?.rtdbQuery??[],c=a$(a,...s);if(!this.authService.getUser()&&!t?.skipUserCheck)return[];let p=yield o$(c).catch(f=>(this.authService.getUser()&&this.loggingService.catch(`Error in get for ${e}`,f),null));if(!p)return[];let g=p.val();return g?t?.skipObjectValues?g:Object.values(g??{}):[]}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 this.loggingService.catch("User not set. [source: getData]",void 0,void 0,!0),{};let c=yield npe(xC(this.firestore,s)).catch(g=>(this.authService.getUser()&&this.loggingService.catch(`Error in getDoc for ${e}`,g),this.commonDbUtilsService.getErrorForGetRequests({feature:e,error:g})));if(c){if(c?.errorCode)return c}else return this.loggingService.warn(`[WB] No document found at ${s}`),{};let p=c.data();return t?.field?p?.[t.field]??{}:p??{}}catch(c){return this.loggingService.catch(`Error fetching Firestore data for ${e}:`,c),{}}}if(this.db){let s=this.commonDbUtilsService.getDocumentPath({feature:e,properties: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 c=yield o$(Mi(this.db,s)).catch(g=>(this.authService.getUser()&&this.loggingService.catch(`Error in get for ${e}`,g),this.commonDbUtilsService.getErrorForGetRequests({feature:e,error:g})));if(c){if(c?.errorCode)return c}else return this.loggingService.warn(`[WB] No data found at ${s}`),{};let p=c.val();return t?.field?p?.[t.field]??{}:p??{}}catch(c){return this.loggingService.catch(`Error fetching RTDB data for ${e}:`,c),{}}}return this.loggingService.warn("[WB] No database connection available"),{}}catch(a){return this.loggingService.catch("Unexpected error in getData:",a),{}}})}dbListener({feature:e,properties:t}){let r=this.shouldUseFirestore();t?.skipFirestore&&(r=!1);let a=`${e}-${JSON.stringify(t)}`;return mn([this.databaseService.getDb(),this.firestoreService.getFirestore(),this.authService.getUser$().pipe(Fe(s=>!!s))]).pipe(Fe(([s,c])=>s?r&&!c?(this.loggingService.warn(`[WB] Firestore requested but not available for ${e}`),!1):!0:(this.loggingService.warn(`[WB] No database found for ${e}`),!1)),fe(([s,c])=>{try{if(r&&c){if(!!!this.observablesCache[a]){this.observablesCache[a]={subject:new ve({}),count:0};let f=this.handleFirestoreListener(e,t,c).subscribe(I=>{this.observablesCache[a]?.subject?.next(I)},I=>this.observablesCache[a]?.subject?.error(I));this.firestoreSubscriptions[a]=f}return new $t(g=>{let f=this.observablesCache[a]?.subject?.subscribe(I=>g.next(I),I=>g.error(I),()=>g.complete());return this.observablesCache[a].count+=1,()=>{f?.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 f=this.handleRealtimeDbListener(e,t,s).subscribe(I=>{this.observablesCache[a]?.subject?.next(I)},I=>this.observablesCache[a]?.subject?.error(I));this.rtdbSubscriptions[a]=f}return new $t(g=>{let f=this.observablesCache[a]?.subject?.subscribe(I=>g.next(I),I=>g.error(I),()=>g.complete());return this.observablesCache[a].count+=1,()=>{f?.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({})}}),Hu(()=>{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 $t(c=>{let p=t.isCollection?this.setupCollectionListener(r,a,e,c,t):this.setupDocumentListener(r,a,e,c,t);return()=>{c.complete(),c.unsubscribe(),p(),this.observablesCache[s]?.subject?.complete(),this.observablesCache[s]?.subject?.unsubscribe(),delete this.observablesCache[s]}}).pipe(fe(c=>this.commonDbUtilsService.mergeUsersWithData$({feature:e,data:c})),fe(c=>["allComments","allUserNotifications"].includes(e)?this.commonDbUtilsService.mergeCommentAnnotationsWithData$({data:c,feature:e}):se(c)),fe(c=>["allReactions"].includes(e)?this.commonDbUtilsService.mergeReactionAnnotationsWithData$({data:c,feature:e}):se(c)),_t(Xt)):(this.loggingService.warn(`[WB] No firestore path found for ${e} and key ${s}`),se({}))}setupCollectionListener(e,t,r,a,s){let c=`${r}-${JSON.stringify(s)}`,p=RI(e,t);if(s?.useCollectionGroup&&(p=MW(e,t)),s?.useQuery&&s?.firestoreQuery){let I=s?.firestoreQuery??[];p=RW(p,...I)}let g=!0,f=[];return r==="allComments"&&this.loggingService.logContext("[CONTEXT] setupCollectionListener called with path:",t,"feature:",r,"properties:",JSON.stringify(s??"nil")),kW(p,I=>{try{let T=JSON.parse(JSON.stringify(this.observablesCache[c]?.subject?.getValue()?.data??{})),L=null,G=!1;I?.docChanges()?.length?I.docChanges().forEach(z=>{["allComments","allReactions"].includes(r)&&!g&&z.type!=="removed"&&f.push(z.doc.id),this.commonDbUtilsService.isDataAlreadyProcessedInLocalCache({feature:r,change:z,cache:this.observablesCache[c]?.subject?.getValue()?.data??{}})||(G=!0,Object.assign(T,this.handleCollectionChange(z,T)),z.type==="removed"&&(L||(L={type:z.type,ids:[]}),L.ids.push(z.doc.id)))}):G=!0,G&&(["allComments","allReactions"].includes(r)&&f?.length&&(this.commonDbUtilsService.resolveAnnotations({data:f,feature:r}),f=[]),this.commonDbUtilsService.modifyAndSetData({feature:r,data:T,subscriber:a,operation:L})),g=!1}catch(T){this.handleListenerError(T,r,a)}},I=>this.handleListenerError(I,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 c=xC(e,t);return kW(c,p=>{try{let g=p.data()||{};s?.field&&(g=g?.[s?.field]??{}),this.commonDbUtilsService.modifyAndSetData({feature:r,data:g,subscriber:a,operation:null})}catch(g){this.handleListenerError(g,r,a)}},p=>this.handleListenerError(p,r,a))}handleListenerError(e,t,r){this.loggingService.catch(`Firestore listener error for ${t}:`,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=Mi(r,a);if(t?.useQuery&&t?.rtdbQuery){let c=t?.rtdbQuery??[];s=a$(s,...c)}return this.objectValFromChildEvents(s,e).pipe(zn(c=>(this.loggingService.catch(`RTDB listener error for ${e}:`,c),se({}))),de(c=>(c===null&&(c={}),c&&typeof c=="object"?Object.entries(c??{}).reduce((g,[f,I])=>(g[f]=this.commonDbUtilsService.addMetadata(I,t),g),{}):this.commonDbUtilsService.addMetadata(c,t))),fe(c=>this.commonDbUtilsService.modifyData({feature:e,data:c})),fe(c=>this.usersService.getUserById$().pipe(de(()=>({data:this.commonDbUtilsService.mergeUsersWithData({feature:e,data:c}),operation:null})))))}objectValFromChildEvents(e,t){return new $t(r=>{let a={},s=!1,c=null,p=z=>{try{this.loggingService.catch(`Realtime DB listener error for ${t}:`,z),r.error(z)}catch{}},g=z=>{try{if(!ui(z,c)){let J=JSON.parse(JSON.stringify(z));c=J,r.next(J)}}catch{}},f=z=>{try{z.key&&(a[z.key]=z.val(),s&&g(E({},a)))}catch{}},I=z=>{try{z.key&&(a[z.key]=z.val(),s&&g(E({},a)))}catch{}},T=z=>{try{z.key&&(delete a[z.key],s&&g(E({},a)))}catch{}},L=z=>{try{if(!s){let J=a&&typeof a=="object"?JSON.parse(JSON.stringify(a)):{};c=J,r.next(J),s=!0}}catch{}};hre(e,f,p),fre(e,I,p),vre(e,T,p);let G=wg(e,L,p,{onlyOnce:!0});return()=>{try{G&&typeof G=="function"&&G(),SM(e,"child_added",f),SM(e,"child_changed",I),SM(e,"child_removed",T)}catch{}}})}};o.\u0275fac=function(t){return new(t||o)(ee(je),ee(Cm),ee(ni),ee(y),ee(kpe),ee(In),ee(Ft),ee(rt),ee(Ln),ee(Js),ee(vm))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Si=(()=>{let o=class o{constructor(e,t,r,a,s,c,p,g,f){this.analyticsService=e,this.authService=t,this.configService=r,this.coreActionsService=a,this.databaseService=s,this.docService=c,this.loggingService=p,this.commonDbService=g,this.usersService=f,this.db=Ss(),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.userAccessFields$=new ve({}),this.userOrganizationContacts$=new ve([]),this.userFolderContacts$=new ve([]),this.userDocumentContacts$=new ve([]),this.userOrganizationGroups$=new ve([]),this.onContactSelectedSubject$=new nt,this.documentAccessType=null,this.atHereEnabled$=new ve(!1),this.atHereLabel$=new ve("here"),this.atHereDescription$=new ve(null),this.contactListScopeForOrganizationUsers$=new ve([Wi.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(fe(I=>this.docService.getDocumentPaths$().pipe(on(T=>{this.documentPaths=T}),de(()=>I)))).subscribe(I=>Q(this,null,function*(){if(this.user=I,I&&this.documentPaths)if(!I?.organizationId)this.getLoggedInUsers$().subscribe(),this.getUserContactsFromDb$(),yield this.migrateLoggedInUserFromEmailToUserIdPath(I),this.setLoggedInUser(I),yield this.moveGlobalContactUserFromEmailToUserIdPath(I),this.updateUserInGlobalContactsIfAvailable(I),I?.groupId&&(yield this.migrateGroupContactsFromEmailToUserIdPath(I?.groupId)),this.checkToSetLoggedInUserInGroupContacts();else{let T=this.userPermissionService?.getCurrentUserPermissions(),L=this.documentPaths.folderId,G=!0;L&&T?.[I?.userId]?.folders?.[L]?.errorCode===Lo.PERMISSION_DENIED&&(G=!1),this.getOrganizationContactsFromDb$(),G&&this.getFolderContactsFromDb$(),this.getDocumentContactsFromDb$(),this.getOrganizationGroupsFromDb$(),this.getTemporaryUsers()}else this.getUserContactSubscription?.unsubscribe(),this.getUserContactSubscription=void 0,this.getLoggedInUsersSubscription?.unsubscribe(),this.getLoggedInUsersSubscription=void 0,this.getOrganizationContactsSubscription?.unsubscribe(),this.getOrganizationContactsSubscription=void 0,this.getFolderContactsSubscription?.unsubscribe(),this.getFolderContactsSubscription=void 0,this.getDocumentContactsSubscription?.unsubscribe(),this.getDocumentContactsSubscription=void 0,this.getOrganizationGroupsSubscription?.unsubscribe(),this.getOrganizationGroupsSubscription=void 0}),I=>{this.loggingService.catch("Error in ContactService constructor getUser$: ",I)}),this.databaseService.getDb().pipe(Fe(I=>!!I),ot(1)).subscribe(I=>{I&&(this.db=I)},I=>{this.loggingService.catch("Error in ContactService constructor getDb: ",I)}),this.getOrganizationGroups$().subscribe(I=>{this.authService.setOrganizationUserGroups(I)}),mn([this.getInternalUserContacts$(),this.getCustomUserContacts$(),this.getCustomUserContactsConfig$()]).subscribe(([I,T,L])=>{T?L?.merge?this.userContacts$.next([...I||[],...T||[]]):this.userContacts$.next(T||[]):this.userContacts$.next(I||[])}),this.getUserContacts$().subscribe(I=>{try{I?.forEach(T=>{let L=T?.userSnippylyId||K0(this.configService.getApiKey(),T.userId);L&&this.userSnippylyIdContacts$.next(D(E({},this.userSnippylyIdContacts$.value),{[L]:T}))})}catch{}})}setUserPermissionService(e){try{this.userPermissionService=e}catch(t){this.loggingService.catch("Error in ContactService setUserPermissionService: ",t)}}clearCache(){this.loggingService.log("%c[WB] Calling FUNCTION: clearCache in ContactService","color: green;");try{this.documentPaths=null,this.usersByOrganizationId$.next({}),this.temporaryUserIds$.next([]),this.usersByOrganizationIdAndFolderId$.next({}),this.usersByOrganizationIdAndDocumentId$.next({}),this.userById$.next({}),this.userOrganizationContacts$.next([]),this.userFolderContacts$.next([]),this.userDocumentContacts$.next([]),this.userOrganizationGroups$.next([]),this.userContacts$.next([]),this.userSnippylyIdContacts$.next(null),this.userGlobalContact$.next(!1),this.userGroupContact$.next(null),this.users$.next([]),this.userPersonalContacts=[],this.userGroupContacts=[],this.userGlobalContacts=[],this.users=[]}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:Tt(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:Tt(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:Tt(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(D(E({},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:Tt(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 c=r.contacts[s];if(c?.userId){let p=Tt(c?.userId);a[p]=c}}),r.contacts=a}yield this.commonDbService.updateData({feature:"logins",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Tt(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:Tt(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:Tt(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(e))})}catch(t){this.loggingService.catch("Error in ContactService addGlobalContact: ",t)}}getUserAccessFields(){return JSON.parse(JSON.stringify(this.userAccessFields$.value))}getUserAccessFieldsByUserId(e){return this.getUserAccessFields()?.[e]}setUserAccessFields(e){try{let t=this.getUserAccessFields();e.forEach(a=>{t[a.user.userId]=a.accessFields||[]});let r=this.authService.getUser()?.userId;if(r&&t?.[r]?.length){let a=this.userPermissionService?.getCurrentUserPermissions();a&&(a[r].context={accessFields:t[r]},this.userPermissionService?.setCurrentUserPermissions(a))}this.userAccessFields$.next(JSON.parse(JSON.stringify(t)))}catch(t){this.loggingService.catch("Error in ContactService setUserAccessFields: ",t)}}updateUserInGlobalContactsIfAvailable(e){return Q(this,null,function*(){try{if(e?.userId&&this.documentPaths?.globalContacts&&(yield this.checkIfUserGlobalContact(e))){let r=new zo;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:Tt(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:Tt(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:Tt(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:Tt(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(c=>c?.visibility!=="group"),s=!1;this.authService.getUserOptions()&&(s=!!this.authService.getUserOptions()?.replaceContacts||!!this.authService.getUserOptions()?.replacePrivateContacts),a?.length?(r={},a?.forEach(c=>{if(c?.userId){let p=Tt(c?.userId);r[p]=c}}),s?this.commonDbService.setData({feature:"allLoginContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Tt(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:Tt(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:Tt(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&&Tt(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:Tt(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(ot(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===xi.PUBLIC)r=!0;else if(a===xi.RESTRICTED){let s=Tt(this.user?.userId);if(t?.users?.[s]&&(r=!0),this.user?.email){let c=Tt(this.user?.email);t?.users?.[c]&&(r=!0)}}if(r){let s=new Dp;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:Tt(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:Tt(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?mn([this.usersByOrganizationId$,this.usersByOrganizationIdAndFolderId$,this.usersByOrganizationIdAndDocumentId$,this.userById$,this.customUserContacts$,this.customUserContactsConfig$,this.getContactListScopeForOrganizationUsers$(),this.temporaryUserIds$]).pipe(de(([s,c,p,g,f,I,T,L])=>{let G={},z=!1;I&&!I?.merge&&(z=!0);let J=Ve=>T.some(be=>Ve.includes(be)),le=J([Wi.ALL,Wi.ORGANIZATION])?Object.keys(s?.[t]||{}):[],_e=a?J([Wi.ALL,Wi.FOLDER])?Object.keys(c?.[t]?.[a]||{}):[]:[],De=J([Wi.ALL,Wi.DOCUMENT])?Object.keys(p?.[t]?.[r]||{}):[];if([...le,..._e||[],...De,...L].forEach(Ve=>{let be=g?.[Ve];be&&(G[Ve]=be)}),f){let{merge:Ve,options:be}=I||{},{organizationId:Se,documentId:Ae,folderId:Ce}=be||{},he=Ce?$i(Ce):void 0;(!Se||Se===t)&&(!Ae||Ae===r)&&(!he||he===a)&&(Ve||(G={}),f.forEach(Oe=>{Oe?.userId&&(G[Oe.userId]=Oe)}))}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()}getUserBySnippylyId(e){return this.userSnippylyIdContacts$.value?.[e]}getAtHereLabel(){return this.atHereLabel$.asObservable()}getAtHereDescription(){return this.atHereDescription$.asObservable()}getUserContactsFromDb$(){this.getUserContactSubscription||(this.getUserContactSubscription=this.authService.getUser$().pipe(Fe(e=>!!e),fe(e=>this.docService.getDocumentPaths$().pipe(Fe(t=>!!t),on(t=>{this.documentPaths=t}),de(()=>e))),fe(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),on(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),on(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:Tt(e?.userId)}}).pipe(de(r=>r?.data),on(r=>{r?this.userPersonalContacts=Object.values(r??{}):this.userPersonalContacts=[]}))),Uo(...t).pipe(Co(this.authService.getUser$().pipe(Fe(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().pipe(_t(Xt))}isUserGlobalContact(){return this.userGlobalContact$.value}isUserGroupContact$(){return this.userGroupContact$.asObservable()}isUserGroupContact(){return this.userGroupContact$.value}getLoggedInUsers$(){return this.getLoggedInUsersSubscription||(this.getLoggedInUsersSubscription=this.authService.getUser$().pipe(fe(e=>e?this.documentPaths?e?.userId&&this.documentPaths?.logins?this.commonDbService.dbListener({feature:"allLogins",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}}).pipe(de(t=>t?.data),on(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(fe(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(Fe(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:[ft("expiresAt",">",new Date().getTime())]}}))??[]).filter(a=>a?.userId!==e?.userId);if(r?.length){let a=r.map(p=>p?.userId),s=vt();this.coreActionsService.triggerAction(ct.USER_RESOLVER,{event:Y.Events.Resolver.USER_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:s,methodName:Hr.GET_TEMPORARY_USERS,source:"internal",payload:{userIds:a}});let c=yield this.usersService.resolveUsers({userIds:a,uniqueId:s});if(c){let p={};Object.entries(c).forEach(([f,I])=>{p[f]=I}),this.userById$.next(E(E({},this.userById$.value),p));let g=new Set([...this.temporaryUserIds$.value,...Object.keys(p)]);this.temporaryUserIds$.next(Array.from(g))}}}}))}catch(e){this.loggingService.catch("Error in ContactService getTemporaryUsers: ",e)}}getOrganizationContactsFromDb$(){try{this.getOrganizationContactsSubscription||(this.getOrganizationContactsSubscription=this.authService.getUser$().pipe(fe(e=>e?.organizationId?se(e).pipe(fe(t=>this.docService.getOrganizationConfig$().pipe(Fe(r=>!!r),de(()=>t))),fe(t=>this.usersService.getResolveOrganizationUsers$().pipe(Fe(r=>r),de(()=>t))),fe(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:[yi($R(ft("organizationIds","array-contains-any",[r]),ft("viewerOrganizationIds","array-contains-any",[r]))),Ji("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.setUserAccessFields(s),this.setUserOrganizationContacts(s,r)}else this.setUserOrganizationContacts([],r)})):se():se()}),fe(()=>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(fe(e=>e?se(e).pipe(fe(t=>this.docService.getOrganizationConfig$().pipe(Fe(r=>!!r),de(()=>t))),fe(t=>this.usersService.getResolveFolderUsers$().pipe(Fe(r=>r),de(()=>t))),fe(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:[yi($R(ft("folderIds","array-contains-any",[this.documentPaths?.veltFolderId]),ft("viewerFolderIds","array-contains-any",[this.documentPaths?.veltFolderId]))),Ji("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 c=Object.values(s??{});this.setUserAccessFields(c),this.setUserFolderContacts(c)}else this.setUserFolderContacts([])}))}),fe(()=>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(fe(e=>e?se(e).pipe(fe(t=>this.docService.getDocumentPaths$().pipe(Fe(r=>!!r),on(r=>{this.documentPaths=r}),de(()=>t))),fe(t=>this.usersService.getResolveDocumentUsers$().pipe(Fe(r=>r),de(()=>t))),fe(t=>(this.setUserDocumentContacts([]),t?this.documentPaths?this.docService.getDocumentIds$().pipe(fe(r=>{let a=r?.length>0?r.map(g=>g.documentId):[this.documentPaths?.documentId??""];if(a.some(g=>!g)||!this.documentPaths)return se();let s=se([]),c={isCollection:!0,useQuery:!0};this.commonDbService.shouldUseFirestore()||(c.documentId=a?.length?a[0]:void 0,c.organizationId=this.documentPaths?.organizationId);let p=[];for(let g=0;g<a.length;g+=U.LISTENER_BATCH_SIZE)p.push(a.slice(g,g+U.LISTENER_BATCH_SIZE));return s=mn(p.map(g=>this.commonDbService.dbListener({feature:"allDocumentUsers",properties:D(E({},c),{firestoreQuery:[yi($R(ft("documentIds","array-contains-any",g),ft("viewerDocumentIds","array-contains-any",g))),Ji("id")]})}).pipe(Or()))).pipe(de(g=>na(g)?.data)),s.pipe(de(g=>{if(g){typeof g=="object"&&(g?.undefined&&delete g.undefined,g?.null&&delete g.null);let f=Object.values(g??{});this.setUserAccessFields(f),this.setUserDocumentContacts(f)}else this.setUserDocumentContacts([])}))})):se():se())),fe(()=>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 c={};e.forEach(p=>{s[t][p.user.userId]=p,c[p.user.userId]=p.user}),this.userById$.next(E(E({},this.userById$.value),c)),this.usersByOrganizationId$.next(D(E({},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(fe(()=>this.checkContactListScopeForOrganizationUsers([Wi.ALL,Wi.ORGANIZATION])?this.userOrganizationContacts$.asObservable():se([])))}getUserOrganizationContacts(){return this.checkContactListScopeForOrganizationUsers([Wi.ALL,Wi.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:c}=s?.metadata||{};c&&(r[c]||(r[c]={}),s.folderIds?.forEach(p=>{r[c][p]||(r[c][p]={}),r[c][p][s.user.userId]=s,a[s.user.userId]=s.user}))}),this.userById$.next(E(E({},this.userById$.value),a)),this.usersByOrganizationIdAndFolderId$.next(r)}catch(t){this.loggingService.catch("Error in ContactService updateUserFolderContacts: ",t)}}getUserFolderContacts$(){return this.getContactListScopeForOrganizationUsers$().pipe(fe(()=>this.checkContactListScopeForOrganizationUsers([Wi.ALL,Wi.FOLDER])?this.userFolderContacts$.asObservable():se([])))}getUserFolderContacts(){return this.checkContactListScopeForOrganizationUsers([Wi.ALL,Wi.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:c}=s?.metadata||{};c&&(r[c]||(r[c]={}),s.documentIds?.forEach(p=>{r[c][p]||(r[c][p]={}),r[c][p][s.user.userId]=s,a[s.user.userId]=s.user}))}),this.userById$.next(E(E({},this.userById$.value),a)),this.usersByOrganizationIdAndDocumentId$.next(r)}catch(t){this.loggingService.catch("Error in ContactService updateUserDocumentContacts: ",t)}}getUserDocumentContacts$(){return this.getContactListScopeForOrganizationUsers$().pipe(fe(()=>this.checkContactListScopeForOrganizationUsers([Wi.ALL,Wi.DOCUMENT])?this.userDocumentContacts$.asObservable():se([])))}getUserDocumentContacts(){return this.checkContactListScopeForOrganizationUsers([Wi.ALL,Wi.DOCUMENT])?this.userDocumentContacts$.value:[]}getCurrentOrganizationUserIAM$(){return this.currentOrganizationUserIAM$.asObservable()}getCurrentOrganizationUserIAM(){return this.currentOrganizationUserIAM$.value}mergeOrganizationAndDocumentContacts(){try{let e=[];this.getContactListScopeForOrganizationUsers().includes(Wi.ALL)?e=[...this.getUserOrganizationContacts(),...this.getUserFolderContacts(),...this.getUserDocumentContacts()]:this.getContactListScopeForOrganizationUsers().includes(Wi.ORGANIZATION)?e=[...this.getUserOrganizationContacts()]:this.getContactListScopeForOrganizationUsers().includes(Wi.FOLDER)?e=[...this.getUserFolderContacts()]:this.getContactListScopeForOrganizationUsers().includes(Wi.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(fe(e=>e?.organizationId?se(e).pipe(fe(t=>this.docService.getOrganizationConfig$().pipe(Fe(r=>!!r),de(()=>t))),fe(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 xi.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(fe(()=>this.checkContactListScopeForOrganizationUsers([Wi.ALL,Wi.ORGANIZATION_USER_GROUP])?this.userOrganizationGroups$.asObservable():se([])))}enableAtHere(){try{if(this.analyticsService.setFeatureConfig({feature:Re.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:Re.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:Re.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:Re.COMMENT,config:{atHereEnabled:!1}}),this.atHereEnabled$.value===!1)return;this.atHereEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in ContactService disableAtHere: ",e)}}getAtHereEnabled$(){return this.getContactListScopeForOrganizationUsers$().pipe(fe(()=>this.checkContactListScopeForOrganizationUsers([Wi.ALL,Wi.DOCUMENT])?this.atHereEnabled$.asObservable():se(!1)))}getAtHereEnabled(){return this.checkContactListScopeForOrganizationUsers([Wi.ALL,Wi.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{this.analyticsService.trackEvent(Y.Events.Contact.UPDATE_CONTACT_LIST_TRIGGERED,{contactsCount:e?.length,config:t}),this.usersService.setUserByIds(e),this.customUserContacts$.next(e),this.customUserContactsConfig$.next(t)}catch(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=D(E({},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(fe(e=>e?mn([this.userOrganizationContacts$.asObservable(),this.userFolderContacts$.asObservable(),this.userDocumentContacts$.asObservable(),this.userOrganizationGroups$.asObservable(),this.customUserContacts$.asObservable()]).pipe(de(([t,r,a,s,c])=>{let p={};p.organizationUsers=t?.map(f=>this.convertToClientUser(f)),p.folderUsers=r?.map(f=>this.convertToClientUser(f)),p.documentUsers=a?.map(f=>this.convertToClientUser(f)),p.updatedContactList=c?.map(f=>this.convertToClientUser(f));let g=[];return s?.forEach(f=>{let I=this.convertToClientUserGroup(f,p.organizationUsers||[]);I&&g.push(I)}),p.userGroups=g,p}),_t(Xt)):se(null)),zn(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 c=Tt(s.userId);a[c]=s}}),Object.keys(e?.users??{}).forEach(s=>{a[s]&&r.users?.push(a[s])}),r}catch(r){return this.loggingService.catch("Error in ContactService convertToClientUserGroup: ",r),null}}convertToClientUser(e){try{return e&&(e=JSON.parse(JSON.stringify(e)),e?.clientGroupId&&(e.groupId=e.clientGroupId,delete e.clientGroupId),e?.clientOrganizationId&&(e.organizationId=e.clientOrganizationId,delete e.clientOrganizationId),e?.userSnippylyId&&delete e.userSnippylyId),e}catch(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)(ee(tt),ee(je),ee(Ft),ee(ni),ee(In),ee(rt),ee(y),ee(un),ee(Ln))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Rpe=i=>{try{let o={USE_PROFILES:{svg:!0,svgFilters:!0},FORBID_ATTR:["onerror","onload","onclick","onmouseover","onmouseout","onmouseenter","onmouseleave","onmousemove","onmousedown","onmouseup","onwheel","onscroll","onkeydown","onkeyup","onkeypress","onfocus","onblur","onchange","onsubmit","on*"],FORBID_TAGS:["script","style","iframe","object","embed","form"]};return qI.sanitize(i,o)}catch(o){return et.catch("Error in File utils sanitizeSvg: ",o),""}},Npe=i=>{try{return i.name.split(".").slice(0,-1).join(".")}catch(o){et.catch("Error in File utils getFileName: ",o);return}},qW=i=>{try{return/(?:\.([^.]+))?$/.exec(i?.name)[1]}catch(o){et.catch("Error in File utils getFileExtension: ",o);return}},Fpe=(i,o)=>{try{let n=i.slice(0,-1,i.type);return new File([n],o+"."+qW(i),{type:i.type})}catch(n){et.catch("Error in File utils updateFile: ",n);return}},Lpe=i=>new Promise((o,n)=>{let e=new FileReader;e.readAsDataURL(i),e.onload=()=>{o(e.result)},e.onerror=t=>{n(t)}}),YW={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 nu=(()=>{let o=class o{constructor(e,t,r,a,s){this.authService=e,this.configService=t,this.coreActionsService=r,this.loggingService=a,this.attachmentResolverService=s,this.storage=wb();try{this.configService.getApiKey$().subscribe(c=>{this.apiKey=c}),this.authService.getFirebaseConfig$().subscribe(c=>{c&&c.firebaseOptions?.storageBucket&&(this.storage=wb(void 0,c?.firebaseOptions?.storageBucket))},c=>{this.loggingService.catch("Error in StorageService constructor: ",c)})}catch(c){this.loggingService.catch("Error in StorageService constructor:",c)}}createAttachment({path:e,file:t}){try{let r=new TC;r.name=t.name;let a=Fpe(t,`${r.attachmentId}_${Npe(t)}`),s=`${this.apiKey}/${e}/${a?.name}`;return r.bucketPath=s,r.size=t.size,r.type=qW(t),r?.type&&(r.mimeType=YW[r?.type]),r}catch(r){return this.loggingService.catch("Error in StorageService createAttachment: ",r),null}}sanitizeSvgFile(e){return Q(this,null,function*(){if(e.type===YW.svg)try{let t=yield e.text(),r=Rpe(t);return new File([r],e.name,{type:e.type})}catch(t){return this.loggingService.catch("Error in StorageService sanitizeSvgFile: ",t),e}return e})}uploadAttachmentToStorage(s){return Q(this,arguments,function*({attachment:e,file:t,resolve:r,reject:a}){try{let c=Ob(this.storage,e.bucketPath),p=M$(c,t,{cacheControl:"public,max-age=3600"});p.on("state_changed",g=>{let f=g.bytesTransferred/g.totalBytes*100},g=>{a(g)},()=>{P$(p.snapshot.ref).then(g=>{e.url=g,r(e)})})}catch(c){this.loggingService.catch("Error in StorageService uploadAttachmentToStorage: ",c),a(c)}})}uploadToResolver(c){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},g=vt();this.coreActionsService.triggerAction(ct.ATTACHMENT_RESOLVER,{event:Y.Events.Resolver.ATTACHMENT_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:g,methodName:kl.UPLOAD_TO_RESOLVER,source:"internal",payload:{attachment:p,eventType:va.ATTACHMENT_ADD}});let f=yield this.attachmentResolverService.saveAttachment({attachment:p,eventType:va.ATTACHMENT_ADD},g);f&&f.data?.url?(t.url=f.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,c)=>Q(this,null,function*(){try{if(!this.apiKey)throw new Error("API key not configured");let p=yield this.sanitizeSvgFile(t),g=this.createAttachment({path:e,file:p});if(!g)throw new Error("Attachment not created");r?this.uploadToResolver({file:p,attachment:g,metadata:a,resolve:s,reject:c}):this.uploadAttachmentToStorage({attachment:g,file:p,resolve:s,reject:c})}catch(p){this.loggingService.catch("Error in StorageService uploadFile:",p),c(p)}}))}uploadChunk(e,t,r){return new Promise((a,s)=>{try{if(this.apiKey){let c=`${this.apiKey}/${e}/${t.name}`,p=Ob(this.storage,c),g=M$(p,t,{cacheControl:"public,max-age=3600"});g.on("state_changed",f=>{let I=f.bytesTransferred/f.totalBytes*100},f=>{s(f)},()=>{P$(g.snapshot.ref).then(f=>{a(f)}).catch(f=>{this.loggingService.catch(`[uploadChunk] Error getting download URL for chunk ${r}:`,f),s(f)})})}else{let c=new Error("API key not available");this.loggingService.catch("[uploadChunk] API key not available",c),s(c)}}catch(c){this.loggingService.catch(`[uploadChunk] Error in StorageService uploadChunk for chunk ${r}: `,c),s(c)}})}downloadAttachment(e){try{if(e.url){let 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(U.ATTRIBUTES.VELT_DOWNLOAD_BUTTON,"true"),a.classList.add("snippyly-overlay-panel"),a.href=s,e?.name&&(a.download=e?.name),document.body.appendChild(a);let c=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!1});a.dispatchEvent(c),window.URL.revokeObjectURL(s),a.remove()},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){let c=vt();this.coreActionsService.triggerAction(ct.ATTACHMENT_RESOLVER,{event:Y.Events.Resolver.ATTACHMENT_DELETE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:c,methodName:kl.DELETE_ATTACHMENT,source:"internal",payload:{attachmentId:e.attachmentId,metadata:t}}),this.attachmentResolverService.deleteAttachment({attachmentId:e.attachmentId,metadata:t},c).then(()=>{a(null)}).catch(p=>{s(p)})}else{let c=Ob(this.storage,e.bucketPath);A$(c).then(()=>{a(null)}).catch(p=>{a(null)})}})}deleteFileFromPath(e){return new Promise((t,r)=>{let a=Ob(this.storage,e);A$(a).then(()=>{t(null)}).catch(s=>{r(s)})})}};o.\u0275fac=function(t){return new(t||o)(ee(je),ee(Ft),ee(ni),ee(y),ee(eu))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var En=(()=>{let o=class o{constructor(e,t,r,a,s,c,p,g){this.analyticsService=e,this.authService=t,this.contactService=r,this.databaseService=a,this.docService=s,this.configService=c,this.loggingService=p,this.commonDbService=g,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(Fe(f=>!!f),ot(1)).subscribe(f=>{f&&(this.getUser(),this.getDocumentPaths())},f=>{this.loggingService.catch("Error in CommentService getDb subscription: ",f)}),this.getRole$().pipe(ot(1)).subscribe(f=>{this.authService?.getUser()&&!f&&this.analyticsService.trackEvent(Y.Events.Iam.USER_ACCESS_DENIED)}),this.documentIAM$.subscribe(f=>{f?.accessType&&this.contactService.setDocumentAccessType(f.accessType)})}catch(f){this.loggingService.catch("Error in IamService constructor: ",f)}}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(Fe(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(Fe(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 qR;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(zn(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),_t())}getDocumentIAM$(){return this.documentIAM$.asObservable()}getRoles$(){return this.roles$.asObservable().pipe(de(e=>e?.length?e:U.WorkspaceRoles))}getFeaturesAccessLevel$(){return this.documentIAM$.asObservable().pipe(de(e=>e?.features),fe(e=>this.getRole$().pipe(de(t=>(t===co.ADMIN&&(e=e&&JSON.parse(JSON.stringify(e||{})),e?.all?.disabled&&(e.all.disabled=!1)),e)))))}hasRole(e){try{return e===this.getRole()}catch(t){return this.loggingService.catch("Error in IamService hasRole: ",t),!1}}hasRoleAny(e=[]){try{return e?.includes(this.getRole()||"")}catch(t){return this.loggingService.catch("Error in IamService hasRoleAny: ",t),!1}}hasRole$(e){try{return this.authService.getUser$().pipe(fe(()=>this.documentIAM$.pipe(Fe(t=>!!t),fe(()=>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(fe(()=>this.configService.getSF$()),fe(()=>this.configService.getSF()?this.contactService.isUserGlobalContact$():se(null)),fe(()=>this.configService.getSF()?this.documentIAM$.pipe(Fe(e=>!!e),_t(Xt)):se(null)),fe(()=>this.workspaceIAM$.pipe(_t(Xt))),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 co.ADMIN;if(!e)return this.user?.isAdmin?co.ADMIN:co.COMMENTER;let t=null,r;if(this.user)switch((this.documentIAM$.value?this.documentIAM$.value?.features?.all?.restricted:!1)?xi.RESTRICTED:this.documentIAM$.value?this.documentIAM$.value?.documentAccessType||xi.PUBLIC:null){case xi.PUBLIC:r=this.getUserFromDocumentIAM(this.user?.email,this.user?.userId),r||(r=this.getUserFromWorkspaceIAM(this.user?.email,this.user?.userId)),t=r?.role?.name||co.COMMENTER;break;case xi.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===co.ADMIN),_t())}isUserAdmin(){try{return this.getRole()===co.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?.[Tt(e)]),!r&&t&&(r=this.documentIAM$.value?.users?.[Tt(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?.[Tt(e)]),!r&&t&&(r=this.workspaceIAM$.value?.users?.[Tt(t)]),r}else return}catch(r){this.loggingService.catch("Error in IamService getUserFromWorkspaceIAM: ",r)}}};o.\u0275fac=function(t){return new(t||o)(ee(tt),ee(je),ee(Si),ee(In),ee(rt),ee(Ft),ee(y),ee(un))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var ss=(()=>{let o=class o{constructor(e,t,r,a,s,c,p,g,f,I){this.authService=e,this.docService=t,this.loggingService=r,this.commonDbService=a,this.usersService=s,this.commentUtilsService=c,this.coreActionsService=p,this.functions=g,this.configService=f,this.contactService=I,this.currentUserPermissions$=new ve(null),this.permissionsCache$=new ve(null),this.permissionProvider$=new ve(null);try{this.docService.setUserPermissionService(this),this.authService.setUserPermissionService(this),this.commentUtilsService.setUserPermissionService(this),this.contactService.setUserPermissionService(this)}catch(T){this.loggingService.catch("Error in UserPermissionService constructor:",T)}}hasUserContextAccess({userId:e,accessFields:t}){try{if(!this.getIsContextEnabled()||t.includes(U.DEFAULT_VELT_CONTEXT))return!0;let r=this.contactService.getUserAccessFieldsByUserId(e);return r?t.every(a=>r.includes(a)):!0}catch(r){return this.loggingService.catch("Error in UserPermissionService hasUserContextAccess:",r),!1}}organizationDetails(e){return Q(this,null,function*(){try{let t=yield this.commonDbService?.getData({feature:"organizationMetadata",properties:{organizationId:e}});return t&&t?.errorCode?{errorCode:Lo.PERMISSION_DENIED,error:!0}:t&&!t?.metadata?{errorCode:Lo.DOES_NOT_EXIST,error:!0}:{error:!1}}catch(t){return this.loggingService.catch("Error in UserPermissionService organizationDetails:",t),{errorCode:Lo.SOMETHING_WENT_WRONG,error:!0}}})}documentDetails(r){return Q(this,arguments,function*({documentId:e,organizationId:t}){try{let a=yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:e,organizationId:t}});if(a&&a?.errorCode)return{errorCode:Lo.PERMISSION_DENIED,error:!0};if(a&&!a?.metadata)return{errorCode:Lo.DOES_NOT_EXIST,error:!0};let s=this.docService.getDocumentMetadata(e)??{};return this.docService.setDocumentMetadata(e,E(E({},s),a?.metadata??{})),{error:!1}}catch(a){return this.loggingService.catch("Error in UserPermissionService documentDetails:",a),{errorCode:Lo.SOMETHING_WENT_WRONG,error:!0}}})}folderDetails(r){return Q(this,arguments,function*({folderId:e,organizationId:t}){try{let a=yield this.commonDbService?.getData({feature:"folderMetadata",properties:{folderId:e,organizationId:t}});return a&&a?.errorCode?{errorCode:Lo.PERMISSION_DENIED,error:!0}:a&&!a?.metadata?{errorCode:Lo.DOES_NOT_EXIST,error:!0}:{error:!1}}catch(a){return this.loggingService.catch("Error in UserPermissionService folderDetails:",a),{errorCode:Lo.SOMETHING_WENT_WRONG,error:!0}}})}getUserPermissions(e){return Q(this,null,function*(){try{if(!this.authService.getUser())return this.loggingService.catch("User not set. [source: getUserPermissions]",void 0,void 0,!0),{};let t=this.extractResourceIds(e);if(!t.clientOrganizationId||!t.organizationId)return this.loggingService.catch("Client organization id or organization id not set during getUserPermissions",void 0,void 0,!0),{};let r=yield this.validateResources(t),[a,s]=yield this.fetchUserPermissionsFromDB(t),c=this.buildPermissionsResponse(t,r,a,s);return!e&&Object.keys(c).length>0&&this.setCurrentUserPermissions(c),c}catch(t){return this.loggingService.catch("Error in UserPermissionService getUserPermissions:",t),{}}})}extractResourceIds(e){let t=this.docService.getDocumentPaths(),r=this.docService.getDocumentIds();return{folderIds:e?.folderIds?.length?e.folderIds:t?.folderId?[t.folderId]:[],documentIds:e?.documentIds?.length?e.documentIds:r.map(a=>a.clientDocumentId),clientOrganizationId:e?.organizationId??t?.clientOrganizationId,organizationId:e?.organizationId??t?.clientOrganizationId?os(e?.organizationId??t?.clientOrganizationId??""):void 0}}validateResources(e){return Q(this,null,function*(){let{folderIds:t,documentIds:r,organizationId:a,clientOrganizationId:s}=e,c=[],p=[];a&&(c.push(this.organizationDetails(a)),p.push({id:s??"",type:"organization"})),t.forEach(f=>{c.push(this.folderDetails({folderId:$i(f),organizationId:a??""})),p.push({id:f,type:"folder"})}),r.forEach(f=>{c.push(this.documentDetails({documentId:Tr(f),organizationId:a??""})),p.push({id:f,type:"document"})});let g=yield Promise.allSettled(c);return this.processValidationResults(g,p)})}processValidationResults(e,t){let r=[],a=[],s,c=e.map((p,g)=>({result:p,metadata:t[g]})).filter(({result:p})=>p.status==="rejected"||p.status==="fulfilled"&&p.value.error);for(let{result:p,metadata:g}of c){let f=p.status==="fulfilled"?p.value.errorCode??Lo.SOMETHING_WENT_WRONG:Lo.SOMETHING_WENT_WRONG,I={id:g.id,errorCode:f};switch(g.type){case"organization":if(s=I,f===Lo.DOES_NOT_EXIST)throw new Error(`Organization with id '${g.id}' does not exist`);break;case"folder":r.push(I);break;case"document":a.push(I);break}}return{failedFolderIds:r,failedDocumentIds:a,failedOrganizationId:s}}fetchUserPermissionsFromDB(e){return Q(this,null,function*(){let{folderIds:t,documentIds:r,organizationId:a}=e,s=[this.authService.getUser()?.userId??""],c=[...t.map(f=>$i(f)),...r.map(f=>Tr(f)),a??""],[p,g]=yield Promise.allSettled([this.usersService.getUsersFromDBWithBatching({userIds:s,organizationId:a}),this.usersService.getTemporaryUsersFromDBWithBatching({userIds:s,organizationId:a,resourceIds:c})]);return[p.status==="fulfilled"?p.value:[],g.status==="fulfilled"?g.value:[]]})}buildPermissionsResponse(e,t,r,a){let{folderIds:s,documentIds:c,clientOrganizationId:p,organizationId:g}=e,{failedFolderIds:f,failedDocumentIds:I,failedOrganizationId:T}=t,L={};return this.processRegularUserPermissions(L,r,s,c,p??"",g??"",f,I,T),this.processTemporaryUserPermissions(L,a),this.processContextPermissions(L),L}processContextPermissions(e){try{let t=this.authService.getUser()?.userId;if(t){let r=this.contactService.getUserAccessFieldsByUserId(t);r?.length&&(e[t].context={accessFields:r})}}catch(t){this.loggingService.catch("Error in UserPermissionService processContextPermissions:",t);return}}processRegularUserPermissions(e,t,r,a,s,c,p,g,f){for(let I of t)for(let T of I)T?.user?.userId&&(e[T.user.userId]=D(E({},r.length&&{folders:this.buildFolderPermissions(r,T,p)}),{documents:this.buildDocumentPermissions(a,T,g),organization:{[s]:this.buildOrganizationPermission(c,T,f)}}))}getErrorMessage(e,t){try{switch(this.loggingService.log(`Error in UserPermissionService getErrorMessage: ${e} ${t}`),e){case Lo.DOES_NOT_EXIST:return`${t} does not exist`;case Lo.PERMISSION_DENIED:return`User does not have access to ${t}`;case Lo.SOMETHING_WENT_WRONG:return"Something went wrong";default:return"Something went wrong"}}catch(r){return this.loggingService.catch("Error in UserPermissionService getErrorMessage:",r),"Something went wrong"}}buildFolderPermissions(e,t,r){return e.reduce((a,s)=>{let c=r.find(p=>p.id===s);return c?a[s]={error:this.getErrorMessage(c.errorCode,"folder"),errorCode:c.errorCode}:a[s]={accessRole:t.viewerFolderIds?.includes($i(s))?Qs.VIEWER:Qs.EDITOR},a},{})}buildDocumentPermissions(e,t,r){return e.reduce((a,s)=>{let c=r.find(p=>p.id===s);return c?a[s]={error:this.getErrorMessage(c.errorCode,"document"),errorCode:c.errorCode}:a[s]={accessRole:t.viewerDocumentIds?.includes(Tr(s))?Qs.VIEWER:Qs.EDITOR},a},{})}buildOrganizationPermission(e,t,r){return r?{error:this.getErrorMessage(r.errorCode,"organization"),errorCode:r.errorCode}:{accessRole:t.viewerOrganizationIds?.includes(e)?Qs.VIEWER:Qs.EDITOR}}processTemporaryUserPermissions(e,t){for(let r of t)if(r?.userId)switch(this.ensureUserPermissionStructure(e,r.userId),r.type){case"folder":this.addTemporaryFolderPermission(e,r);break;case"document":this.addTemporaryDocumentPermission(e,r);break;case"organization":this.addTemporaryOrganizationPermission(e,r);break}}ensureUserPermissionStructure(e,t){e[t]||(e[t]={})}addTemporaryFolderPermission(e,t){let{userId:r,resourceId:a,role:s,expiresAt:c}=t;e[r].folders||(e[r].folders={}),e[r].folders[a]||(e[r].folders[a]={accessRole:s??Qs.EDITOR,expiresAt:c})}addTemporaryDocumentPermission(e,t){let{userId:r,resourceId:a,role:s,expiresAt:c}=t;e[r].documents||(e[r].documents={}),e[r].documents[a]={accessRole:s??Qs.EDITOR,expiresAt:c}}addTemporaryOrganizationPermission(e,t){let{userId:r,resourceId:a,role:s,expiresAt:c}=t;e[r].organization||(e[r].organization={}),e[r].organization[a]={accessRole:s??Qs.EDITOR,expiresAt:c}}hasEditAccess({organizationId:e,folderId:t,documentId:r}){try{let a=!0,s=this.getCurrentUserPermissionsWithServerIds(),c=this.authService.getUser()?.userId??"";return s&&(e&&typeof e=="string"&&s?.[c]?.organization?.[e]&&(s?.[c]?.organization?.[e]?.accessRole===Qs.VIEWER||s?.[c]?.organization?.[e]?.errorCode===Lo.PERMISSION_DENIED)&&(a=!1),t&&typeof t=="string"&&s?.[c]?.folders?.[t]&&(s?.[c]?.folders?.[t]?.accessRole===Qs.VIEWER||s?.[c]?.folders?.[t]?.errorCode===Lo.PERMISSION_DENIED)&&(a=!1),r&&typeof r=="string"&&s?.[c]?.documents?.[r]&&(s?.[c]?.documents?.[r]?.accessRole===Qs.VIEWER||s?.[c]?.documents?.[r]?.errorCode===Lo.PERMISSION_DENIED)&&(a=!1)),a}catch{return!0}}getCurrentUserPermissions$(){return this.currentUserPermissions$.asObservable().pipe(_t(Xt))}getCurrentUserPermissions(){return this.currentUserPermissions$.value}refactorPermissionsWithServerIds(e){try{let t=JSON.parse(JSON.stringify(e??{})),r=this.authService.getUser()?.userId??"";if(t?.[r]){let a=this.docService.getDocumentPaths()?.clientOrganizationId??"";if(t?.[r]?.organization?.[a]){let s=os(a);t[r].organization&&(t[r].organization[s]=t[r].organization[a],delete t[r].organization[a])}t?.[r]?.folders&&(t[r].folders=Object.fromEntries(Object.entries(t?.[r]?.folders??{}).map(([s,c])=>[$i(s),c]))),t?.[r]?.documents&&(t[r].documents=Object.fromEntries(Object.entries(t?.[r]?.documents??{}).map(([s,c])=>[Tr(s),c])))}return t}catch(t){return this.loggingService.catch("Error in UsersPermissionService refactorPermissionsWithServerIds:",t),e}}getCurrentUserPermissionsWithServerIds$(){return this.currentUserPermissions$.asObservable().pipe(de(e=>this.refactorPermissionsWithServerIds(e)),_t(Xt))}getCurrentUserPermissionsWithServerIds(){return this.refactorPermissionsWithServerIds(this.currentUserPermissions$.value)}setCurrentUserPermissions(e){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setCurrentUserPermissions","color: green;");let t=null;e&&(t=JSON.parse(JSON.stringify(e))),this.currentUserPermissions$.next(t)}catch(t){this.loggingService.catch("Error in UsersPermissionService setCurrentUserPermissions:",t)}}getIsContextEnabled(){return this.loggingService.log("%c[WB] Calling FUNCTION: getIsContextEnabled","color: green;"),this.permissionProvider$.value?.isContextEnabled??!1}setPermissionProvider(e){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setPermissionProvider","color: green;"),this.permissionProvider$.next(e)}catch(t){this.loggingService.catch("Error in UsersPermissionService setPermissionProvider:",t)}}get isRevokeAccessOnDocumentUnsetEnabled(){return this.permissionProvider$.value?.revokeAccessOn?.some(e=>e.type===wC.DOCUMENT_UNSET)??!1}get isRevokeAccessOnUserLogoutEnabled(){return this.permissionProvider$.value?.revokeAccessOn?.some(e=>e.type===wC.USER_LOGOUT)??!1}get isRevokeOrganizationAccessOnUserLogoutEnabled(){return this.permissionProvider$.value?.revokeAccessOn?.some(e=>e.type===wC.USER_LOGOUT&&e.revokeOrganizationAccess)??!1}get isRevokeOrganizationAccessOnDocumentUnsetEnabled(){return this.permissionProvider$.value?.revokeAccessOn?.some(e=>e.type===wC.DOCUMENT_UNSET&&e.revokeOrganizationAccess)??!1}getPermissionProviderRetryConfig(){return this.permissionProvider$.value?.retryConfig??{retryCount:0,retryDelay:0}}revokeAccessOnUserLogout(){return Q(this,null,function*(){let e=vt();try{if(this.isRevokeAccessOnUserLogoutEnabled){let t=[],r=this.authService.getUser()?.userId??"";if((this.getPermissionsCache()??[]).forEach(s=>{s.userId===r&&s.hasAccess&&(s.type===Fo.ORGANIZATION?this.isRevokeOrganizationAccessOnUserLogoutEnabled&&t.push(D(E({},s),{hasAccess:!1})):t.push(D(E({},s),{hasAccess:!1})))}),t.length>0){this.coreActionsService.triggerAction(ct.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_USER_LOGOUT_FORMED,timestamp:new Date().getTime(),uniqueId:e,methodName:Hi.REVOKE_ACCESS_ON_USER_LOGOUT,source:"internal",payload:{requests:t}}),this.setPermissionsCache([]),this.coreActionsService.triggerAction(ct.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_USER_LOGOUT_TRIGGERED,timestamp:new Date().getTime(),uniqueId:e,methodName:Hi.REVOKE_ACCESS_ON_USER_LOGOUT,source:"internal",payload:{requests:t}});let s=yield this.revokeAccess({requests:t,userId:this.authService.getUser()?.userId??""});s.success?this.coreActionsService.triggerAction(ct.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_USER_LOGOUT_RESULT,timestamp:new Date().getTime(),uniqueId:e,methodName:Hi.REVOKE_ACCESS_ON_USER_LOGOUT,source:"internal",payload:{result:{data:s,success:!1,statusCode:500}}}):this.coreActionsService.triggerAction(ct.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_USER_LOGOUT_ERROR,timestamp:new Date().getTime(),uniqueId:e,methodName:Hi.REVOKE_ACCESS_ON_USER_LOGOUT,source:"internal",payload:{result:{data:s,success:!0,statusCode:200}}})}}}catch(t){this.coreActionsService.triggerAction(ct.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_USER_LOGOUT_ERROR,timestamp:new Date().getTime(),uniqueId:e,methodName:Hi.REVOKE_ACCESS_ON_USER_LOGOUT,source:"internal",payload:{error:t}}),this.loggingService.catch("Error in UsersPermissionService revokeAccessOnUserLogout:",t)}})}revokeAccessOnDocumentUnset(){return Q(this,null,function*(){let e=vt();try{if(this.isRevokeAccessOnDocumentUnsetEnabled){let t=[],r=this.docService.getDocumentIds(),a=this.docService.getOrganizationConfig()?.clientOrganizationId??"",s=this.docService.getDocumentPaths()?.folderId??"",c=this.authService.getUser()?.userId??"",p=this.getPermissionsCache()??[];if(r.forEach(g=>{p.find(f=>f.resourceId===g.clientDocumentId&&f.type===Fo.DOCUMENT&&f.organizationId===a&&f.userId===c)&&(t.push({userId:c,resourceId:g.clientDocumentId,organizationId:a,type:Fo.DOCUMENT,hasAccess:!1}),p=p.filter(f=>!(f.resourceId===g.clientDocumentId&&f.type===Fo.DOCUMENT&&f.organizationId===a&&f.userId===c)))}),s&&p.find(g=>g.resourceId===s&&g.type===Fo.FOLDER&&g.organizationId===a&&g.userId===c)&&(t.push({userId:c,resourceId:s,organizationId:a,type:Fo.FOLDER,hasAccess:!1}),p=p.filter(g=>!(g.resourceId===s&&g.type===Fo.FOLDER&&g.organizationId===a&&g.userId===c))),a&&this.isRevokeOrganizationAccessOnDocumentUnsetEnabled&&p.find(g=>g.resourceId===a&&g.type===Fo.ORGANIZATION&&g.organizationId===a&&g.userId===c)&&(t.push({userId:c,resourceId:a,organizationId:a,type:Fo.ORGANIZATION,hasAccess:!1}),p=p.filter(g=>!(g.resourceId===a&&g.type===Fo.ORGANIZATION&&g.organizationId===a&&g.userId===c))),this.setPermissionsCache(p),t.length>0){this.coreActionsService.triggerAction(ct.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_FORMED,timestamp:new Date().getTime(),uniqueId:e,methodName:Hi.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{requests:t}}),this.coreActionsService.triggerAction(ct.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_TRIGGERED,timestamp:new Date().getTime(),uniqueId:e,methodName:Hi.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{requests:t}});let g=yield this.revokeAccess({requests:t,userId:c});g.success?this.coreActionsService.triggerAction(ct.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_RESULT,timestamp:new Date().getTime(),uniqueId:e,methodName:Hi.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{result:{data:g,success:!0,statusCode:200}}}):this.coreActionsService.triggerAction(ct.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_ERROR,timestamp:new Date().getTime(),uniqueId:e,methodName:Hi.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{result:{data:g,success:!1,statusCode:500}}})}}}catch(t){this.coreActionsService.triggerAction(ct.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_ERROR,timestamp:new Date().getTime(),uniqueId:e,methodName:Hi.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{error:t}}),this.loggingService.catch("Error in UsersPermissionService revokeAccessOnDocumentUnset:",t)}})}getAccess(r){return Q(this,arguments,function*({requests:e,userId:t}){let a=Xi(this.functions,Qi({url:wn?.cloudFunction?.sdkProxy,apiProxyDomain:this.configService?.getApiProxyDomain()}));return yield pd({methodName:"getAccess",data:{type:"getAccess",data:e,metadata:{retryConfig:this.getPermissionProviderRetryConfig()}},getSdkProxy:a,userId:t})})}revokeAccess(r){return Q(this,arguments,function*({requests:e,userId:t}){let a=Xi(this.functions,Qi({url:wn?.cloudFunction?.sdkProxy,apiProxyDomain:this.configService?.getApiProxyDomain()}));return yield pd({methodName:"revokeAccess",data:{type:"revokeAccess",data:e,metadata:{retryConfig:this.getPermissionProviderRetryConfig()}},getSdkProxy:a,userId:t})})}onResourceAccessRequired(c){return Q(this,arguments,function*({requests:e,uniqueId:t,methodName:r,userId:a,fromCache:s=!0}){try{if(!e?.length)return;let p=[],g=this.getPermissionsCache()??[];if(!this.forceRefreshPermissions()&&s&&(e.forEach(f=>{let I=g?.find(T=>T.resourceId===f.resource.id&&T.type===f.resource.type&&T.userId===f.userId&&T.organizationId===f.resource.organizationId);I&&p.push(I)}),p.length>0&&(e=e.filter(f=>!p.find(I=>I.resourceId===f.resource.id&&I.type===f.resource.type&&I.userId===f.userId&&I.organizationId===f.resource.organizationId)))),e.length>0){this.coreActionsService.triggerAction(ct.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.RESOURCE_ACCESS_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:t,methodName:r,source:"internal",payload:{requests:e,fromCache:s}});let f=yield this.getAccess({requests:e,userId:this.authService.getUser()?.userId??a??""});return this.coreActionsService.triggerAction(ct.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.RESOURCE_ACCESS_RESULT,timestamp:new Date().getTime(),uniqueId:t,methodName:r,source:"internal",payload:{result:f}}),f?.success&&f?.data?.length&&(this.setPermissionsCache([...g,...f.data]),f.data=[...p,...f.data]),f}else if(p.length>0)return this.coreActionsService.triggerAction(ct.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.RESOURCE_ACCESS_RESULT_FROM_CACHE,timestamp:new Date().getTime(),methodName:r,source:"internal",uniqueId:t,payload:{results:p}}),{data:p,success:!0,statusCode:200};return}catch(p){this.loggingService.catch("Error in UsersPermissionService onResourceAccessRequired:",p),this.coreActionsService.triggerAction(ct.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.RESOURCE_ACCESS_ERROR,timestamp:new Date().getTime(),methodName:r,source:"internal",uniqueId:t,payload:{error:p,requests:e,fromCache:s}});return}})}getPermissionsCache(){return this.forceRefreshPermissions()?[]:this.permissionsCache$.getValue()}forceRefreshPermissions(){return this.getPermissionProvider()?.forceRefresh??!1}setPermissionsCache(e){try{let t=new Map;e.forEach(a=>{let s=`${a.userId}_${a.resourceId}_${a.organizationId}_${a.type}`;t.set(s,a)});let r=JSON.parse(JSON.stringify(Array.from(t.values())));this.permissionsCache$.next(r)}catch(t){this.loggingService.catch("Error in UsersPermissionService setPermissionsCache:",t)}}isPermissionProviderAvailable(){try{return!!this.permissionProvider$.getValue()}catch(e){return this.loggingService.catch("Error in UsersPermissionService isPermissionProviderAvailable:",e),!1}}getPermissionProvider(){try{return this.permissionProvider$.getValue()}catch(e){return this.loggingService.catch("Error in UsersPermissionService getPermissionProvider:",e),null}}getPermissionProvider$(){return this.permissionProvider$.asObservable()}};o.\u0275fac=function(t){return new(t||o)(ee(je),ee(rt),ee(y),ee(un),ee(Ln),ee(tu),ee(ni),ee(xo),ee(Ft),ee(Si))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Cn=(()=>{let o=class o{constructor(e,t,r,a,s,c,p,g,f,I,T,L,G,z,J,le,_e,De){this.afAuth=e,this.analyticsService=t,this.authService=r,this.configService=a,this.commonDbService=s,this.commonDbUtilsService=c,this.commentUtilsService=p,this.commentAnnotationsResolverService=g,this.databaseService=f,this.docService=I,this.domService=T,this.iamService=L,this.loggingService=G,this.notificationUtilsService=z,this.usersService=J,this.functions=le,this.userPermissionService=_e,this.coreActionsService=De,this.db=Ss(),this.notificationsDb=Ss(void 0,wn.firebaseNotificationsDatabaseURL),this.documentPaths=null,this.notifications$=new ve([]),this.rawNotificationsByIdMap$=new ve(new Map),this.processedNotifications$=new ve([]),this.userNotificationsFromServer$=new ve([]),this.readNotificationsOnForYouTab$=new ve(!1),this.currentDocumentOnly$=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(Fe(Be=>!!Be),ot(1)).subscribe(Be=>{Be&&(this.db=Be,this.getDocumentIds(),this.subscribeGetNotificationsForYou())},Be=>{this.loggingService.catch("Error in NotificationService getDb subscription: ",Be)}),this.authService.getUser$().subscribe(Be=>{Be?(this.subscribeGetNotificationsForYou(),this.getDocumentIds(),this.subscribeToUserSettings()):(Object.keys(this.notificationsByDocumentIdSubscription).forEach(Ve=>{this.notificationsByDocumentIdSubscription[Ve]?.unsubscribe()}),this.notificationForYouSubscription?.unsubscribe(),this.documentIdsSubscription?.unsubscribe(),this.resetCacheData())}),this.docService.getLocationMetadata$().subscribe(Be=>{if(Be){let Ve=this.notificationsByDocumentIdMap$.getValue()?JSON.parse(JSON.stringify(this.notificationsByDocumentIdMap$.getValue())):null;Object.keys(Be||{}).forEach(be=>{let Se=Ve?.[be]?.notifications;Se?.length&&Se.forEach(Ae=>{this.notificationUtilsService.mergeLocationWithNotification({notification:Ae},Be)?.notification})}),this.notificationsByDocumentIdMap$.next(Ve)}})}catch(Be){this.loggingService.catch("Error in NotificationService constructor: ",Be)}}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=Tt(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(c=>{if(c.enable){let p=c?.values?.find(g=>g.id===c.default);a[c.id]=p||c?.values?.[0]||{id:"NONE",name:"None"}}});let s={};Object.keys(a).forEach(c=>{s[c]=a[c].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=Tt(this.authService.getUser()?.userId??"");this.userSettingsSubscription=this.enableSettings$.pipe(Fe(t=>t===!0),fe(()=>this.docService.getDocumentPaths$().pipe(Fe(t=>!!t),fe(t=>Oo(this.getInitialConfigFromDB(t)).pipe(fe(()=>this.commonDbService.dbListener({feature:"userConfig",properties:{useCollectionGroup:!1,isCollection:!1,documentId:t?.documentId,userId:e}}).pipe(de(r=>{r?.data?.notificationsConfig&&!ui(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.setUserNotificationsFromServer([]),this.notificationsByDocumentIdMap$.next(null),this.notificationsForYou$.next(null),this.settingsConfig$.next(null)}catch(e){this.loggingService.catch("Error in NotificationService resetCacheData: ",e)}}subscribeGetNotificationsForYou(){try{this.notificationForYouSubscription&&this.notificationForYouSubscription.unsubscribe(),this.notificationForYouSubscription=this.getNotificationsForYou().subscribe(()=>{},e=>{this.loggingService.catch("Error in NotificationService getNotificationsForYou subscription: ",e)})}catch(e){this.loggingService.catch("Error in NotificationService subscriveGetNotificationsForYou: ",e)}}setCommentService(e){try{this.commentService=e}catch(t){this.loggingService.catch("Error in NotificationService setCommentService: ",t)}}getDocumentIds(){try{this.documentIdsSubscription&&this.documentIdsSubscription.unsubscribe(),this.documentIdsSubscription=this.selfNotifications$.pipe(fe(()=>this.getCurrentDocumentOnly$().pipe(fe(e=>e?this.docService.getDocumentPaths$().pipe(de(t=>{})):se(void 0)))),on(()=>{this.notificationsByDocumentIdMap$.next(null)}),fe(()=>this.getDocumentIdsByLastNotificationTimestamp().pipe(Di(),de(([e,t])=>{let r=e?.map(g=>g.documentId),a=t?.map(g=>g.documentId),s=r?.filter(g=>!a?.includes(g)),c=a?.map(g=>({documentId:g,timestamp:t?.find(f=>f.documentId===g)?.timestamp})).filter(g=>!r?.includes(g.documentId)),p=a?.map(g=>{let f=t?.find(I=>I.documentId===g)?.timestamp;return{documentId:g,timestamp:f}}).filter(g=>{let f=e?.find(I=>I.documentId===g.documentId)?.timestamp;return f&&g.timestamp&&f!==g.timestamp});c?.length&&this.fetchNotificationsForDocumentIds(c),p?.length&&this.fetchNotificationsForDocumentIds(p,1),s?.forEach(g=>{this.removeNotificationsForDocumentId(g)}),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(fe(t=>this.docService.getOrganizationConfig$().pipe(de(r=>{let a=null,s=this.configService.getApiKey(),c=r?.organizationId||t?.organizationId;return s&&c&&(a=new fm({apiKey:s,organizationId:c})),{user:t,documentPaths:a}}))),fe(t=>{let{user:r,documentPaths:a}=t;if(this.getCurrentDocumentOnly()&&!this.docService?.getDocumentPaths()?.documentId)return se(null);if(r&&a?.organizationNotificationsLastNotificationTimestamp){let s=new Date,c=this.maxNotificationDays$.getValue()>0?this.maxNotificationDays$.getValue():15;s.setDate(s.getDate()-c);let p=s.getTime(),g=[yi(ft("timestamp",">=",p),...this.getCurrentDocumentOnly()&&this.docService.getDocumentPaths()?.documentId?[ft("metadata.documentId","==",this.docService.getDocumentPaths()?.documentId)]:[])];return this.getCurrentDocumentOnly()||(g.push(Ji("timestamp","desc")),g.push(jR(e))),this.commonDbService.dbListener({feature:"allLastNotificationTimestamp",properties:{organizationId:a?.organizationId,isCollection:!0,useQuery:!0,firestoreQuery:g}}).pipe(de(f=>f?.data),de(f=>{let I=[];return Object.keys(f||{}).forEach(T=>{let L=this.commonDbService.shouldUseFirestore()?f[T]?.timestamp??0:f[T],G=this.commonDbService.shouldUseFirestore()?f[T]?.deletedNotification??!1:!1;if(G&&G.id&&G?.timestamp===L){let z=G.id,J=f[T]?.metadata?.documentId,le=JSON.parse(JSON.stringify(this.notificationsByDocumentIdMap$.getValue()??{})),_e=le?.[J]??{documentMetadata:null,notifications:[]},De=_e.notifications??[],Be=De?.findIndex(Ve=>Ve.id===z);Be!==-1&&(De.splice(Be,1),this.notificationsByDocumentIdMap$.next(D(E({},le),{[J]:D(E({},_e),{notifications:De})})))}I.push({documentId:T,timestamp:L})}),I}),zn(f=>(this.loggingService.catch("Error in NotificationService getDocumentIdsByLastNotificationTimestamp: ",f),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=Xi(this.functions,Qi({url:wn.cloudFunction.getNotificationsForDocuments,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:12e5}),a=this.docService.getOrganizationConfig()?.organizationId??"";if(!a)return[];let s=this.getStartAtTimestamp(),c={};if(e.forEach(De=>{if(De?.documentId){let Be=this.getAllowedDocumentMetadataByDocumentId(De.documentId);Be&&(c[De.documentId]=Be)}}),this.userPermissionService?.isPermissionProviderAvailable())try{let De=[];if(e.forEach(Ae=>{this.docService.getDocumentMetadata(Ae.documentId)||De.push(Ae.documentId)}),De.length){let Ae=this.authService.getUser(),Ce=Xi(this.functions,Qi({url:wn?.cloudFunction?.sdkProxy,apiProxyDomain:this.configService?.getApiProxyDomain()}));try{let he=yield pd({methodName:"getDocumentMetadataFromIds",data:{type:"getDocumentMetadataFromIds",metadata:{organizationId:Ae?.clientOrganizationId,folderId:this.documentPaths?.folderId},documentIds:De},getSdkProxy:Ce,userId:Ae?.userId??""});if(he?.data?.length){let Oe={};he.data.forEach(Ne=>{Ne?.documentId&&(Oe[Ne.documentId]=Ne)}),this.docService.setAllDocumentMetadata(E(E({},this.docService.getAllDocumentMetadataMap()),Oe))}}catch(he){this.loggingService.warn("Error in NotificationService fetchNotificationsForDocumentIds: ",he)}}let Be=[],Ve=[];e.forEach(Ae=>{let Ce=this.docService.getDocumentMetadata(Ae.documentId);Ce?.clientDocumentId?Be.push({userId:this.authService.getUser()?.userId??"",resource:{id:Ce.clientDocumentId,type:Fo.DOCUMENT,source:Hi.GET_NOTIFICATIONS,organizationId:this.docService.getOrganizationConfig()?.clientOrganizationId??""}}):Ve.push(Ae.documentId)}),Ve.length&&(e=e.filter(Ae=>!Ve.includes(Ae.documentId)));let be=vt();this.coreActionsService.triggerAction(ct.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.RESOURCE_ACCESS_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:be,methodName:Hi.GET_NOTIFICATIONS,source:"internal",payload:{requests:Be}});let Se=yield this.userPermissionService?.onResourceAccessRequired({requests:Be,uniqueId:be,methodName:Hi.GET_NOTIFICATIONS});Se?.success&&Se?.data?.length?Se.data.forEach(Ae=>{!Ae.hasAccess&&Ae.resourceId&&(e=e.filter(Ce=>Ce.documentId!==Tr(Ae.resourceId)))}):e=[]}catch(De){this.loggingService.warn("Error in NotificationService fetchNotificationsForDocumentIds: ",De),e=[]}if(!e.length)return[];let p=this.userPermissionService?.getPermissionsCache()?.filter(De=>De.type===Fo.CONTEXT),g={organizationId:a,documentIds:e.filter(De=>!!De.documentId&&!!De.timestamp).map(De=>({documentId:De.documentId,timestamp:De.timestamp??0})),timestamp:s,limitToLast:t,selfNotifications:this.selfNotifications$.value,isPermissionProviderUsed:this.userPermissionService?.isPermissionProviderAvailable(),getUserNotifications:!0,isContextEnabled:this.userPermissionService?.getIsContextEnabled(),cachedData:p,retryConfig:this.userPermissionService?.getPermissionProviderRetryConfig()},f=yield this.notificationUtilsService.handleNotificationEncryption({data:g}),I=yield r({veltData:f}),T=I?.data?.data?.veltData||{},L=I?.data?.data?.veltAdditionalData||{},G="notificationwithdocumentidstoencryptanddecryptonsdk"+(this.authService.getUser()?.userId??""),z=yield W0(T,G),{userNotifications:J=[],userNotificationIdsInDocNotifications:le=[],permissionResults:_e=[]}=yield W0(L,G);if(this.userPermissionService?.getIsContextEnabled()){let De=[...this.userPermissionService?.getPermissionsCache()??[],..._e??[]];this.userPermissionService?.setPermissionsCache(De)}if(z&&typeof z=="object"){let De=this.usersService.userDataProviderAvailable(),Be=this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable(),Ve=[],be=[];Object.keys(z).forEach((Se,Ae)=>{let Ce=z[Se].documentMetadata;if(Ce){let Oe=this.allowedDocumentMetadataMap$.value||{};(!Oe?.[Se]||!ui(Oe?.[Se],Ce))&&this.allowedDocumentMetadataMap$.next(D(E({},Oe),{[Se]:Ce}))}let he=z[Se].notifications||[];he.forEach(Oe=>{le.includes(Oe.notificationId)&&!J.find(Ne=>Ne.notificationId===Oe.notificationId)&&J.push(JSON.parse(JSON.stringify(Oe))),Oe.notification=this.getClientNotificationObject(Oe)}),this.setNotificationForDocumentIdInCache(Se,Ce,he),De&&(Ve.push(this.commonDbUtilsService.formatResponse({feature:"allDocNotifications",data:he,shouldAwait:!0,forceResolve:!0})),Ve.push(this.commonDbUtilsService.formatResponse({feature:"allUserNotifications",data:J,shouldAwait:!0,forceResolve:!0}))),Be&&(be.push(this.commonDbUtilsService.formatResponse({feature:"allDocNotifications",data:he,shouldCommentAnnotationsResolverAwait:!0})),be.push(this.commonDbUtilsService.formatResponse({feature:"allUserNotifications",data:J,shouldCommentAnnotationsResolverAwait:!0})))}),this.setUserNotificationsFromServer([...this.getUserNotificationsFromServer(),...J]),De&&Promise.all(Ve).then(()=>{Object.keys(z).forEach(Se=>{let Ae=z?.[Se]?.documentMetadata||{},Ce=this.commonDbUtilsService.mergeUsersWithData({feature:"allDocNotifications",data:z?.[Se]?.notifications||[]});Ce.forEach(he=>{he.notification=this.getClientNotificationObject(he)}),this.setNotificationForDocumentIdInCache(Se,Ae,Ce)})}),Be&&Promise.all(be).then(()=>{Object.keys(z).forEach(Se=>{let Ae=z?.[Se]?.documentMetadata||{},Ce=z?.[Se]?.notifications?.reduce((he,Oe)=>(he[Oe.notificationId]=Oe,he),{});Ce=this.commonDbUtilsService.mergeCommentAnnotationsWithData({feature:"allDocNotifications",data:Ce}),Ce=Object.values(Ce??{}),Ce.forEach(he=>{he.notification=this.getClientNotificationObject(he)}),this.setNotificationForDocumentIdInCache(Se,Ae,Ce)})})}}}catch(r){return this.loggingService.catch("Error in NotificationService fetchNotificationsForDocumentIds: ",r),[]}})}getUserNotificationsFromServer$(){return this.userNotificationsFromServer$.asObservable()}setUserNotificationsFromServer(e){try{let t=JSON.parse(JSON.stringify(e));t=t.filter((r,a,s)=>a===s.findIndex(c=>c.notificationId===r.notificationId)),this.userNotificationsFromServer$.next(t)}catch(t){this.loggingService.catch("Error in NotificationService setUserNotificationsFromServer: ",t)}}getUserNotificationsFromServer(){return this.userNotificationsFromServer$.getValue()}setNotificationForDocumentIdInCache(e,t,r,a){try{let s=this.docService.getOrganizationConfig()?.organizationId??"",c=this.docService.getOrganizationMetadata(s);t||(t=JSON.parse(JSON.stringify(this.docService.getDocumentMetadata()||{}))),c||(c=JSON.parse(JSON.stringify(this.docService.getOrganizationMetadata(s)||{})));let p=this.notificationsByDocumentIdMap$.getValue(),g=p?.[e]?.notifications||[],f=this.docService.getLocationMetadatas(),I=r?.map(G=>{let z=G?.notification;return z?(z.metadata&&(z.metadata.documentName=t?.documentName||z.metadata.documentName,z.metadata.organizationMetadata=c||z.metadata.organizationMetadata,z.metadata.documentMetadata=t||z.metadata.documentMetadata),f&&(z=this.notificationUtilsService.mergeLocationWithNotification({notification:z},f)?.notification),z):null})?.filter(G=>!!G)||[],T=new Map(g.map(G=>[G.id,G]));I.forEach(G=>{T.set(G.id,G)});let L=Array.from(T.values()).sort((G,z)=>(z.timestamp||0)-(G.timestamp||0));this.notificationsByDocumentIdMap$.next(D(E({},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)}}getStartAtTimestamp(){try{let e=new Date,t=this.maxNotificationDays$.getValue()>0?this.maxNotificationDays$.getValue():15;return e.setDate(e.getDate()-t),e.getTime()}catch(e){return this.loggingService.catch("Error in NotificationService getStartAtTimestamp: ",e),0}}getNotificationsForYou(){try{return this.getUserNotificationsFromServer$().pipe(fe(e=>se(e).pipe(de(t=>{let r=this.usersService.userDataProviderAvailable(),a=this.commentAnnotationsResolverService?.commentAnnotationDataProviderAvailable();if(r||a){let c=t?.reduce((p,g)=>(p[g.notificationId]=g,p),{});r&&(c=this.commonDbUtilsService.mergeUsersWithData({feature:"allUserNotifications",data:c||[]})),a&&(c=this.commonDbUtilsService.mergeCommentAnnotationsWithData({feature:"allUserNotifications",data:c||[]})),t=Object.values(c??{})}return t.forEach(c=>{c.notification=this.getClientNotificationObject(c)}),t.sort((c,p)=>p.timestamp-c.timestamp),t.map(c=>c.notification).filter(c=>!!c)}),fe(t=>{let r={data:t?.reduce((a,s)=>(a[s.id]={notification:s},a),{}),operation:null};return this.commonDbUtilsService.mergeLocationMetadataWithData$({data:r,feature:"allUserNotifications"}).pipe(de(a=>Object.values(a?.data||{}).map(s=>s?.notification)))}))),fe(e=>{let t=this.docService.getOrganizationConfig()?.organizationId??"";return this.docService.getOrganizationMetadata$(t).pipe(de(()=>e))}),fe(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=Nn(e)),t&&typeof t=="object"){let s=or(t);r=Nn(JSON.stringify(s))}}catch(s){this.loggingService.catch("Error in ViewsService subscribeViewsData: ",s)}return ti(this.afAuth).pipe(Fe(s=>!!s),fe(s=>this.isFeatureAllowed({firebaseUser:s})),fe(s=>s.featureAllowed?this.iamService.isUserAllowed$().pipe(de(c=>(s.featureAllowed=c,s))):se(s)),fe(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(fe(c=>this.docService.getDocumentPaths$().pipe(de(p=>(this.documentPaths=p,c.documentPaths=p,c)))),fe(c=>this.getDataFromDocumentId(a)))))}isFeatureAllowed(e){return this.configService.getConfig$().pipe(Fe(t=>!!t),de(t=>D(E({},e),{config:t})),fe(t=>this.authService.getUser$().pipe(de(r=>D(E({},t),{user:r})))),fe(t=>no(t.config,t.user,Re.NOTIFICATION)?se(D(E({},t),{featureAllowed:!0})):(this.loggingService.warn("Notification feature is not allowed."),se(D(E({},t),{featureAllowed:!1})))))}getDataFromDocumentId(e){return this.databaseService.getDb().pipe(Fe(t=>!!t),fe(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+=`/${U.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${this.documentPaths.organizationId}`);let a=Mi(this.db,`${e?r+"/"+U.FIREBASE_PARTIAL_PATH_DOCS+"/"+e+"/"+U.FIREBASE_PARTIAL_PATH_VIEWS+"/":this.documentPaths?.notifications}`);return yM(a).pipe(zn(s=>(this.loggingService.catch("Error in NotificationService getDataFromDocumentId: ",s),se(null))),de(s=>{let c=[],p=new Map;s?.raw&&(Object.keys(s?.raw||{}).forEach(f=>{let I=s?.raw[f];I?.id&&c.push(I)}),c.forEach(f=>{f.id&&p.set(f.id,f)})),this.notifications$.next(c),this.rawNotificationsByIdMap$.next(p);let g=[];s?.processed&&Object.keys(s?.processed||{}).forEach(f=>{let I=s?.processed[f];I?.id&&g.push(I)}),this.processedNotifications$.next(g),this.setNotificationsByIdMap()}))}else return se(null)}))}setNotificationsByIdMap(){try{let e=this.authService.getUser();if(e){let t=this.notificationViews$.getValue(),r;e?.email&&(r=Tt(e?.email));let a;e?.userId&&(a=Tt(e?.userId));let s=new Map;this.processedNotifications$.getValue().forEach(p=>{if(p.id&&p?.displayHeadlineMessageTemplate){let g=!1;(r&&p.notifyUsers?.[r]||a&&p.notifyUsers?.[a])&&(g=!0);let f={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:g,notificationSourceData:p.notificationSourceData},I=this.getRawNotificationById(f.id);if(I?.metadata&&(f.metadata={apiKey:I.metadata.apiKey,organizationId:I.metadata.organizationId,clientOrganizationId:I.metadata.clientOrganizationId,documentId:I.metadata.documentId,clientDocumentId:I.metadata.clientDocumentId,location:I?.location,locationId:I?.locationId}),f?.notificationSource==="comment"&&f?.targetAnnotationId){let T=this.commentService?.getAnnotationById(f.targetAnnotationId);T||I?.annotationData&&(T=I.annotationData),T&&(f.notificationSourceData=this.commentService?.getCommentAnnotationForClient(T))}s.set(p.id,f)}}),s.forEach((p,g)=>{p.isUnread=p?.actionUser?.userSnippylyId!==e?.userSnippylyId&&!t?.notification?.[g]?.views?.[e?.userSnippylyId],s.set(g,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 c=this.authService.getUser(),p=s||e;if(p.id&&p?.displayHeadlineMessageTemplate&&c){let g=null;c?.email&&(g=Tt(c?.email));let f=null;c?.userId&&(f=Tt(c?.userId));let I=!1,T=!0;(g&&p.notifyUsers?.[g]||f&&p.notifyUsersByUserId?.[f])&&(I=!0),f&&a?.[f]&&(T=!1);let L={id:p.id};if(s?L=D(E(E({},L),s),{displayHeadlineMessage:this.getNotificationHeadlineMessage(s),displayBodyMessage:this.getNotificationBodyMessage(s),forYou:I,isUnread:T}):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:I,isUnread:T,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=this.commentService?.getCommentAnnotationForClient(G))}return t?.targetAnnotationData?.isCommentResolverUsed&&(L.isCommentResolverUsed=t?.targetAnnotationData?.isCommentResolverUsed),L}return}catch(c){this.loggingService.catch("Error in NotificationService getClientNotificationObject: ",c);return}}getNotificationsForYou$(){return this.notificationsForYou$.asObservable()}getNotificationsByDocumentId$(){return this.notificationsByDocumentIdMap$.asObservable().pipe(de(e=>e?Object.keys(e??{}).map(t=>{let r=e[t].notifications||[],a=r.filter(c=>c.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 fm({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 c=this.docService.getLocation();c&&(e.location=c?.location,e.locationId=c?.locationId),this.loggingService.log(`[NOTIFICATION] ${e?.notificationSource} ${e?.actionType}`,e);let p=this.commonDbService.getServerTimestamp(),g=this.notificationUtilsService.formatNotification(e,p);return JSON.parse(JSON.stringify(g))}catch(t){return this.loggingService.catch("Error in NotificationService processNotificationData: ",t),null}}updateNotificationDatabase(e){try{let t=Mi(this.notificationsDb),r=this.processNotificationData(e);dM(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(fe(t=>t?t.organizationId?this.getAllNotifications$().pipe(fe(r=>this.notificationsForYou$.pipe(de(a=>{if(r||a){let s=new Map;return(!e?.type||["all","documents"].includes(e.type))&&(r||[]).forEach(c=>{c.id&&s.set(c.id,c)}),(!e?.type||["all","forYou"].includes(e.type))&&(a||[]).forEach(c=>{c.id&&!s.has(c.id)&&s.set(c.id,c)}),Array.from(s.values()).sort((c,p)=>(p.timestamp||0)-(c.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)),zu()):se(null)),_t(Xt))}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,c=r.replace(s,(p,g)=>(g==="actionUser"||g==="recipientUser")&&a[g]?t?.email&&a[g].email===t?.email||t?.userId&&a[g]?.userId===t?.userId?"You":a[g].name||a[g].email||' <velt-skeleton-loader width="50px" height="20px" border-radius="4px"></velt-skeleton-loader> ':a[g]?a[g]:p);return this.domService.sanitizeHtml(c)}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>'),t=t?.replaceAll(`@User ${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(U.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL)?this.historyPanelVisible$.next(e):this.loggingService.catch("Error in NotificationService setHistoryPanelVisibility: ",`<${U.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL}> tag is not added.`):this.historyPanelVisible$.next(e),e?this.analyticsService.trackEvent(Y.Events.Notifications.NOTIFICATION_HISTORY_PANEL_OPENED):this.analyticsService.trackEvent(Y.Events.Notifications.NOTIFICATION_HISTORY_PANEL_CLOSED)}catch{this.loggingService.catch("Error in NotificationService setHistoryPanelVisibility: ",`<${U.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(U.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL)?(this.historyPanelVisible$.next(!this.historyPanelVisible$.value),this.historyPanelVisible$.value?this.analyticsService.trackEvent(Y.Events.Notifications.NOTIFICATION_HISTORY_PANEL_TOGGLED,{action:"closed"}):this.analyticsService.trackEvent(Y.Events.Notifications.NOTIFICATION_HISTORY_PANEL_TOGGLED,{action:"opened"})):this.loggingService.catch("Error in NotificationService toggleHistoryPanelVisibility: ",`<${U.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL}> tag is not added.`)}catch{this.loggingService.catch("Error in NotificationService toggleHistoryPanelVisibility: ",`<${U.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL}> tag is not added.`)}}getHistoryPanelVisibility$(){return this.historyPanelVisible$.asObservable()}setNotificationsAsRead(e){return Q(this,null,function*(){try{let t=JSON.parse(JSON.stringify(this.getUserNotificationsFromServer()));if(e?.length){for(let c=0;c<e.length;c+=50){let g=e.slice(c,c+50).filter(T=>T?.id),f=g.map(T=>this.setNotificationAsRead({notification:T,userNotifications:JSON.parse(JSON.stringify(t))})),I=yield Promise.all(f);g.forEach((T,L)=>{let G=I[L];if(!G.some(J=>J.notificationId===T.id))t=t.filter(J=>J.notificationId!==T.id);else{let J=t.find(_e=>_e.notificationId===T.id),le=G.find(_e=>_e.notificationId===T.id);J&&le?.views&&(J.views=le.views)}})}let a=JSON.parse(JSON.stringify(this.notificationsByDocumentIdMap$.getValue()||{}));e.forEach(c=>{let p=c.metadata?.documentId;if(p&&a?.[p]){let g=a?.[p]?.notifications||[],f=g.find(I=>I.id===c.id);f&&(f.isUnread=!1),a[p].notifications=g}}),this.notificationsByDocumentIdMap$.next(a),!ui(t,this.getUserNotificationsFromServer())&&this.setUserNotificationsFromServer(t)}}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(ot(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),fe(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(r){return Q(this,arguments,function*({notification:e,userNotifications:t}){try{let a=this.authService.getUser();if(a&&e?.id){let s=Tt(a?.userId),{metadata:c}=e;if(c){let{apiKey:p,organizationId:g,documentId:f}=c;if(p&&g&&f&&s){let I=yield this.commonDbService.getData({feature:"docNotification",properties:{id:e.id,organizationId:g,documentId:f,apiKey:p}});I?.notificationId&&(I?.views?.[s]||(I.views||(I.views={}),I.views[s]={timestamp:Date.now()},this.commonDbService.updateData({feature:"docNotificationViews",properties:{id:e.id,organizationId:g,documentId:f,apiKey:p},data:I})));let T=yield this.commonDbService.getData({feature:"userNotification",properties:{id:e.id,userId:s,documentId:f,organizationId:g}});if(T?.notificationId){if(!this.getReadNotificationsOnForYouTab())yield this.commonDbService.deleteData({feature:"userNotification",properties:{id:e.id,userId:s,documentId:f,organizationId:g}}),t=t.filter(L=>L.notificationId!==e.id);else if(!T?.views?.[s]){T.views||(T.views={}),T.views[s]={timestamp:Date.now()};let L=t.find(G=>G.notificationId===e.id);L&&(L.views=T.views),this.commonDbService.updateData({feature:"userNotificationViews",properties:{id:e.id,userId:s,documentId:f,organizationId:g},data:T})}}}}}return t}catch(a){return this.loggingService.catch("Error in NotificationService setNotificationAsRead: ",a),t}})}setMaxDays(e){try{e>0?this.maxNotificationDays$.next(e):this.maxNotificationDays$.next(15)}catch(t){this.loggingService.catch("Error in NotificationService setMaxDays: ",t)}}setTabConfig(e){try{e&&this.tabConfig$.next(e)}catch(t){this.loggingService.catch("Error in NotificationService setTabConfig: ",t)}}getTabConfig$(){return this.tabConfig$.asObservable()}getTabConfig(){return this.tabConfig$.value}enableReadNotificationsOnForYouTab(){this.readNotificationsOnForYouTab$.next(!0)}disableReadNotificationsOnForYouTab(){this.readNotificationsOnForYouTab$.next(!1)}getReadNotificationsOnForYouTab$(){return this.readNotificationsOnForYouTab$.asObservable()}getReadNotificationsOnForYouTab(){return this.readNotificationsOnForYouTab$.value}enableCurrentDocumentOnly(){try{if(this.currentDocumentOnly$.value===!0)return;this.currentDocumentOnly$.next(!0)}catch(e){this.loggingService.catch("Error in NotificationService enableCurrentDocumentOnly: ",e)}}disableCurrentDocumentOnly(){try{if(this.currentDocumentOnly$.value===!1)return;this.currentDocumentOnly$.next(!1)}catch(e){this.loggingService.catch("Error in NotificationService disableCurrentDocumentOnly: ",e)}}getCurrentDocumentOnly$(){return this.currentDocumentOnly$.asObservable()}getCurrentDocumentOnly(){return this.currentDocumentOnly$.value}markNotificationAsReadById(e){return Q(this,null,function*(){try{this.getNotifications$().pipe(ot(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=Tt(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)(ee(Pi),ee(tt),ee(je),ee(Ft),ee(un),ee(Cm),ee(tu),ee(Js),ee(In),ee(rt),ee(Le),ee(En),ee(y),ee(f9),ee(Ln),ee(xo),ee(ss),ee(ni))},o.\u0275prov=Pe({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(U.CommentAnnotationStatusMap),this._customPriorityMap=new ve(U.CommentAnnotationPriorityMap),this._customCategoryMap=new ve(U.CommentCategoryMap);try{let t=sessionStorage.getItem(U.SESSION_STORAGE.VELT_CUSTOM_PRIORITY_MAP);t&&this._customPriorityMap.next(JSON.parse(t));let r=sessionStorage.getItem(U.SESSION_STORAGE.VELT_CUSTOM_STATUS_MAP);r&&this._customStatusMap.next(JSON.parse(r));let a=sessionStorage.getItem(U.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(U.CommentAnnotationStatusMap),sessionStorage.setItem(U.SESSION_STORAGE.VELT_CUSTOM_STATUS_MAP,JSON.stringify(U.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(U.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(U.CommentAnnotationPriorityMap),sessionStorage.setItem(U.SESSION_STORAGE.VELT_CUSTOM_PRIORITY_MAP,JSON.stringify(U.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(U.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(U.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 U.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 U.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[U.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(([c,p])=>p.type==="ongoing");a&&(e.status=a[1]);break;case"resolved":let s=t.find(([c,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=U.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=>U.CommentCategoryMap[t]))}catch(t){this.loggingService.catch("Error in CustomFilterService convertLegacyCategory: ",t)}return e}};o.\u0275fac=function(t){return new(t||o)(ee(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Cd=(()=>{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">
|
|
207
|
+
`+Da),Ed&&s9([Oe,Ne,io],ll=>{Da=HI(Da,ll," ")}),De&&xu?De.createHTML(Da):Da},o.setConfig=function(){let cn=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Vf(cn),Nf=!0},o.clearConfig=function(){Ec=null,Nf=!1},o.isValidAttribute=function(cn,Ue,Mt){Ec||Vf({});let Jt=fr(cn),fo=fr(Ue);return Uf(Jt,fo,Mt)},o.addHook=function(cn,Ue){typeof Ue=="function"&&$I(he[cn],Ue)},o.removeHook=function(cn,Ue){if(Ue!==void 0){let Mt=MNe(he[cn],Ue);return Mt===-1?void 0:kNe(he[cn],Mt,1)[0]}return cpe(he[cn])},o.removeHooks=function(cn){he[cn]=[]},o.removeAllHooks=function(){he=hpe()},o}var qI=_pe();var ype={ADD_TAGS:["velt-skeleton-loader"],ADD_ATTR:["border-radius","target"]},Le=(()=>{let o=class o{constructor(e,t,r,a){this.analyticsService=e,this.rendererFactory2=t,this.loggingService=r,this.sanitizer=a,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 nt,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 nt,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 Yn),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.tabId=null,this.dynamicIdPatterns=[/^yui_[a-z0-9_]+$/i],this.excludeClassList=["show-pin-cursor"],this.filterSnippylyNodes=s=>{try{let c=[];return s.forEach(p=>{if(!qi(p))if(p instanceof HTMLElement){if(p.className.includes("cdk-overlay-container")||p.className.includes("cdk-overlay-connected-position-bounding-box"))return;if(p.className.includes("cdk-overlay")){let g=!1;p.childNodes.forEach(f=>{qi(f)&&(g=!0)}),g||c.push(p)}else c.push(p)}else c.push(p)}),c}catch(c){return this.loggingService.catch("Error in DomService filterSnippylyNodes: ",c),[]}},this.loggingService.log("%c[WB] Creating CLASS: DomService","color: blue;");try{this.analyticsService.setDomService(this),this.renderer=this.rendererFactory2.createRenderer(null,null);let s=this.calculateScreenSize();this.currentScreenSize$=new ve(s),this.currentMousePosition$=new ve(this.currentMousePosition),this.detectNetworkStatusChange(),this.getScrollableElementsIds$().pipe(Di(),on(([c,p])=>{try{let g=p.filter(I=>!c.includes(I)),f=c.filter(I=>!p.includes(I));f.length&&f.map(T=>document.getElementById(T)).filter(T=>T).forEach(T=>{this.unlistenElementScroll&&this.unlistenElementScroll[T.id]&&this.unlistenElementScroll[T.id]()}),g.length&&g.map(T=>document.getElementById(T)).filter(T=>T).forEach(T=>{this.unlistenElementScroll[T.id]=this.renderer.listen(T,"scroll",L=>{let G=this.calculateScreenSize();this.currentScreenSize$.next(G)})})}catch(g){this.loggingService.catch("Error in DomService getScrollableElementsIds subscription: ",g)}})).subscribe(()=>{},c=>{this.loggingService.catch("Error in DomService getScrollableElementsIds subscription: ",c)}),this.getSelectedAnnotationsMap$().subscribe(c=>{Object.keys(c||{})?.length?Gle("snippylyUserScalableNo","viewport","width=device-width, user-scalable=no"):Wle("snippylyUserScalableNo")},c=>{this.loggingService.catch("Error in DomService getSelectedAnnotationsMap$ subscription: ",c)})}catch(s){this.loggingService.catch("Error in DomService constructor: ",s)}}setDocService(e){try{this.docService=e,this.subscribeToDomEvents()}catch(t){this.loggingService.catch("Error in DomService setDocService: ",t)}}setDynamicIdPatterns(e){try{let t=e.map(r=>typeof r=="string"?new RegExp(r):r).filter(Boolean);t.length&&(this.dynamicIdPatterns=t)}catch(t){this.loggingService.catch("Error in DomService setDynamicIdPatterns: ",t)}}isLikelyDynamicId(e){try{return e?this.dynamicIdPatterns.some(t=>t.test(e)):!1}catch{return!1}}getStableAttributes(e){try{let t={};if(!e.getAttributeNames)return t;let r=new Set(["id","class","style"]);return e.getAttributeNames().forEach(s=>{if(r.has(s)||s.includes("snippyly")||s.includes("velt"))return;let c=e.getAttribute(s);c&&c.length<=256&&(t[s]=c)}),t}catch{return{}}}buildStableElementSelector(e,t){try{if(Object.keys(t).length===0)return;let a=[e.tagName?.toLowerCase()],s=["data-","aria-","role","name","title","type"];return Object.keys(t).sort((p,g)=>{let f=s.findIndex(T=>p.startsWith(T)),I=s.findIndex(T=>g.startsWith(T));return(f===-1?99:f)-(I===-1?99:I)}).slice(0,4).forEach(p=>{let g=CSS.escape(t[p]);a.push(`[${p}="${g}"]`)}),a.join("")}catch{return}}getVisibleText(e,t=400){try{let r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null),a="",s,c=0;for(;(s=r.nextNode())&&a.length<t;){let p=(s.textContent||"").replace(/\s+/g," ").trim();if(p&&(a+=(a?" ":"")+p),c++,c>100)break}return a.slice(0,t)}catch{return""}}hashText(e){try{return kle(e)}catch{return}}generateRobustXPath(e,t){try{let r=t?.maxDepth||10,a=t?.useAbsolutePath||!1,s=[],c=e,p=0;for(;c&&c!==document.documentElement&&p<r;){let T=this.buildRobustXPathSegment(c);if(T&&(s.unshift(T),this.isStrongAnchorSegment(T)))break;c=c.parentElement,p++}if(s.length===0)return;let f=(a?"/":"//")+s.join("/");return s.some(T=>T.includes("[@")||T.includes("[contains(@class"))?f:void 0}catch{return}}buildRobustXPathSegment(e){try{let t=e.tagName.toLowerCase(),r=e.id;if(r&&!this.isLikelyDynamicId(r)&&document.querySelectorAll(`[id="${CSS.escape(r)}"]`).length===1)return`*[@id=${this.escapeXPathValue(r)}]`;let a=["data-region","data-instanceid","data-action","data-key","data-block","data-activityid"];for(let T of a){let L=e.getAttribute(T);if(L)return`${t}[@${T}=${this.escapeXPathValue(L)}]`}let s=Array.from(e.attributes).filter(T=>T.name.startsWith("data-")&&!T.name.includes("snippyly")&&!T.name.includes("velt")&&T.value.length<100).sort((T,L)=>T.value.length-L.value.length);if(s.length>0){let T=s[0];return`${t}[@${T.name}=${this.escapeXPathValue(T.value)}]`}let c=e.getAttribute("role");if(c)return`${t}[@role=${this.escapeXPathValue(c)}]`;let p=e.getAttribute("aria-label");if(p&&p.length<50)return`${t}[@aria-label=${this.escapeXPathValue(p)}]`;let g=e.getAttribute("name");if(g)return`${t}[@name=${this.escapeXPathValue(g)}]`;let f=e.getAttribute("type");if(f)return`${t}[@type=${this.escapeXPathValue(f)}]`;let I=Array.from(e.classList||[]).filter(T=>T.length>0&&T.length<40&&!T.includes("yui")&&!T.includes("velt")&&!T.includes("snippyly")&&!this.excludeClassList.includes(T)).slice(0,2);if(I.length>0){let T=I.map(L=>`contains(@class, ${this.escapeXPathValue(L)})`).join(" and ");return`${t}[${T}]`}if(e.parentElement){let T=Array.from(e.parentElement.children).filter(L=>L.tagName===e.tagName);if(T.length>1){let L=T.indexOf(e)+1;return`${t}[${L}]`}}return t}catch{return}}isStrongAnchorSegment(e){try{return!!(e.includes("[@id=")||["main","navigation","banner","contentinfo","complementary","search"].some(a=>e.includes(`[@role='${a}']`))||["data-region","data-instanceid","data-activityid"].some(a=>e.includes(`[@${a}=`)))}catch{return!1}}escapeXPathValue(e,t=!0){try{return e.includes("'")?e.includes('"')?`concat(${e.split("'").map(s=>`'${s}'`).join(`,"'",`)})`:t?`"${e}"`:e:t?`'${e}'`:e}catch{try{return`concat(${e.split("'").map(c=>`'${c}'`).join(`,"'",`)})`}catch{return t?`'${e}'`:e}}}getElementFromRobustXPath(e){try{return document.evaluate(e,document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue}catch{return null}}getAllElementsFromRobustXPath(e){try{let t=document.evaluate(e,document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null),r=[];for(let a=0;a<t.snapshotLength;a++){let s=t.snapshotItem(a);s instanceof Element&&r.push(s)}return r}catch{return[]}}generateAnchorRecord(e,t){try{let r=this.generateAnchorRecordForElement(e,t),a=null;if(e.parentElement&&e.parentElement instanceof HTMLElement&&wi(e.parentElement)&&e.parentElement!==document.body&&(a=e.parentElement),r&&a){let s=this.generateAnchorRecordForElement(a,t);s&&(r.parent=s)}return r}catch(r){return this.loggingService.catch("Error in DomService generateAnchorRecord: ",r),null}}generateAnchorRecordForElement(e,t){try{if(!e)return null;let r=e,a=r.tagName?.toUpperCase();if(!a)return null;let s=r.id&&!this.isLikelyDynamicId(r.id)?r.id:void 0,c=this.getStableAttributes(r),p=this.buildStableElementSelector(r,c),g=this.getVisibleText(r),f=this.hashText(g||""),I=this.generateRobustXPath(r),T=this.getXPath(r),L=this.getXPath(r,!0),G=this.getXPath(r,!0,!0);return{version:"1.0",id:s,tagName:a,elementSelector:p,robustXPath:I||void 0,xPath:T||void 0,fXPath:L||void 0,cfXPath:G||void 0,contentHash:f?{value:f,algorithm:"md5",source:"textContent"}:void 0,createdAt:Date.now()}}catch(r){return this.loggingService.catch("Error in DomService generateAnchorRecordForElement: ",r),null}}resolveAnchorRecord(e){try{let t=[],r=null,a=(f,I,T=0)=>{let L=[],G=T;if(L.push({method:I,score:T}),e.tagName&&f.tagName?.toUpperCase()===e.tagName&&(G+=10,L.push({method:"tagName-match",score:10})),e.contentHash?.value){let z=this.getVisibleText(f);this.hashText(z)===e.contentHash.value&&(G+=30,L.push({method:"contentHash-match",score:30}))}t.push({el:f,score:G,by:I,scoreBreakdown:L})};if(e.id){let f=document.querySelectorAll(`#${CSS.escape(e.id)}`);if(f.length===1)return{element:f[0],matchedBy:"id",score:90};f.length>1&&f.forEach(I=>a(I,"id-duplicate",70))}if(e.elementSelector){let f=document.querySelectorAll(e.elementSelector);if(f.length===1)return{element:f[0],matchedBy:"element-selector",score:80};f.forEach(I=>a(I,"element-selector-duplicate",60))}e.robustXPath&&this.getAllElementsFromRobustXPath(e.robustXPath).slice(0,20).forEach(L=>a(L,"robustXPath",50)),e?.parent&&(r=this.resolveAnchorRecord(e.parent),r.element&&r.element.querySelectorAll(e.tagName?.toLowerCase()||"*").forEach(I=>a(I,"parent+tag",40)));let s=(f,I,T)=>{if(!f)return;let L=this.getElementFromXPath(f);L&&a(L,I||"xpath",T||30)};if(s(e.xPath,"xPath",30),s(e.cfXPath,"cfXPath",30),s(e.fXPath,"fXPath",30),e.contentHash?.value&&t.length===0){let I=T=>{let L=0;for(let G=0;G<T.length&&L<400;G++){let z=T[G];if(L++,!this.isElementVisible(z))continue;let J=this.getVisibleText(z),le=this.hashText(J);le&&le===e.contentHash?.value&&a(z,"contentHash",15)}};if(r?.element&&r?.element instanceof Element){let T=r?.element?.querySelectorAll("*");I(T)}}if(!t.length)return{element:null};t.sort((f,I)=>I.score-f.score);let c=t[0].score,p=t.filter(f=>f.score===c);if(p.length>1){let f=[{path:e.xPath,label:"xPath"},{path:e.cfXPath,label:"cfXPath"},{path:e.fXPath,label:"fXPath"}];for(let I of f)if(I.path){let T=this.getElementFromXPath(I.path);if(T){let L=p.find(G=>G.el===T);if(L)return{element:L.el,matchedBy:`${L.by}+position`,score:L.score,scoreBreakdown:L.scoreBreakdown}}}}let g=t[0];return{element:g.el,matchedBy:g.by,score:g.score,scoreBreakdown:g.scoreBreakdown}}catch(t){return this.loggingService.catch("Error in DomService resolveAnchorRecord: ",t),{element:null}}}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(),this.onDocumentClick()}catch(e){this.loggingService.catch("Error in DomService subscribeToDomEvents: ",e)}}setScrollableElementsIds(e){try{e&&e.length&&this.scrollableElementsIds$.next(Array.from(new Set(e)))}catch(t){this.loggingService.catch("Error in DomService setScrollableElementsIds: ",t)}}getScrollableElementsIds$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getScrollableElementsIds$","color: green;"),this.scrollableElementsIds$.asObservable()}removeScrollableElementsIds(){this.scrollableElementsIds$.next([])}setMutationObserver(e){try{this.mutationObserver||(this.loggingService.log("%c[WB] Calling DomService FUNCTION: setMutationObserver","color: green;"),this.loggingService.log("%c[WB] setMutationObserver from: "+e,"color: green;"),this.mutationObserver=new MutationObserver(t=>{try{if(t?.find(a=>a?.attributeName===U.VELT_IGNORE_CHANGE_DETECTION))return;let r=t.filter(a=>a.type==="childList").filter(a=>{let s=a.target;return a.removedNodes.forEach(c=>{let p=c;if(typeof p.getAttribute=="function"){let g=p.getAttribute(U.ATTRIBUTES.VELT_ELEMENT_CACHE_ID);if(g!==null&&g!==""){let f=this.xpathCacheId.get(g);f!==void 0&&(this.xpathCacheId.delete(g),this.xpathCache.delete(f))}}}),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(U.VELT_IGNORE_CHANGE_DETECTION):!0}return!0})),r=r.filter(a=>{let s=!0;return Object.keys(U.INGNORE_MUTATION_OBSERVER_CHANGE_TAGS).forEach(c=>{a.target?.closest(c)&&(s=!1)}),s}),r=r.filter(a=>a.target&&wi(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{Uo(fi(window,"offline").pipe(de(()=>!1)),fi(window,"online").pipe(de(()=>!0)),new $t(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 Yn),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()!==U.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 fi(window,"keydown")}catch(e){return this.loggingService.catch("Error in DomService onWindowKeydown$: ",e),Ul}}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 f=this.getXPath(t);f&&(r=f.iterateNext()||e.target)}let a=r.getBoundingClientRect(),s=e.clientX-a.x,c=e.clientY-a.y,p=s*100/(a.width||1),g=c*100/(a.height||1);this.currentMousePosition.element={xpath:t,topPercentage:g,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,c=!0,p){try{let g=e,f=g?.touches?.length?g.touches[0]?.clientX:g?.clientX,I=g?.touches?.length?g.touches[0]?.clientY:g?.clientY;p&&(f=p.clientX,I=p.clientY);let T=this.getBackgroundElement(f,I,t,r);if(T&&s&&typeof s=="function"&&(T=s(T)),T){let L=this.getXPath(T),G=this.getXPath(T,!0),z=T.getBoundingClientRect(),J=f-z.x,le=I-z.y,_e=J*100/(z.width||1),De=le*100/(z.height||1),Be={xpath:L,fXpath:G,leftPercentage:_e,topPercentage:De};if(a){let Ve=this.getXPath(T,!0,!0);Be.cfXpath=Ve}if(c){let Ve=this.generateAnchorRecord(T);Ve&&(Be.anchor=Ve)}return Be}else return null}catch(g){return this.loggingService.catch("Error in DomService getTargetElementForCommentPinAnnotation: ",g),null}}getBackgroundElement(e,t,r=!0,a=!1){try{let s=document.elementsFromPoint(e,t),c=[];s.forEach(g=>{qi(g)?c=[]:wi(g)&&c.push(g)}),a&&(c=c.filter(g=>this.isElementVisibleOnScreen(g)));let p=0;return r||c?.forEach((g,f)=>{g.tagName.toLowerCase()==="svg"&&(p=f)}),c[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)&&wi(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,U.SNIPPYLY_HIGHLIGHT)),t&&!e.hasAttribute(U.ATTRIBUTES.DEFAULT_CURSOR)){let a=e.style.getPropertyValue("cursor"),s=e.style.getPropertyPriority("cursor"),c=a?{defaultCursorValue:a,defaultCursorPriority:s}:"";e.setAttribute(U.ATTRIBUTES.DEFAULT_CURSOR,c?JSON.stringify(c):""),e.style.setProperty("cursor",t,"important")}e.setAttribute(U.SNIPPYLY_HIGHLIGHT,"true"),e.setAttribute(U.VELT_IGNORE_CHANGE_DETECTION,"true")}}removeHighlightFromElement(e){if(e&&(this.pinHighlighterClass$.value&&this.removeClassFromElement(e,this.pinHighlighterClass$.value),this.removeClassFromElement(e,U.SNIPPYLY_HIGHLIGHT),e.removeAttribute(U.SNIPPYLY_HIGHLIGHT),e.removeAttribute(U.VELT_IGNORE_CHANGE_DETECTION),e.hasAttribute(U.ATTRIBUTES.DEFAULT_CURSOR))){try{if(e.style.removeProperty("cursor"),e.getAttribute(U.ATTRIBUTES.DEFAULT_CURSOR)){let t=JSON.parse(e.getAttribute(U.ATTRIBUTES.DEFAULT_CURSOR));e.style.setProperty("cursor",t.defaultCursorValue,t.defaultCursorPriority)}}catch{}e.removeAttribute(U.ATTRIBUTES.DEFAULT_CURSOR)}}highlightUserElement(e,t,r,a=!1){try{e&&(this.addClassToElement(e,U.VELT_LIVE_SELECTION_ON_ELEMENT),a&&this.addClassToElement(e,U.VELT_LIVE_SELECTION_ON_ELEMENT_DEFAULT),e.setAttribute(U.SNIPPYLY_HIGHLIGHT,"true"),e.setAttribute(U.VELT_IGNORE_CHANGE_DETECTION,"true"),t&&!e.style.getPropertyValue(U.VELT_SELECTION_COLOR)&&e.style.setProperty(U.VELT_SELECTION_COLOR,t),r&&e.setAttribute(U.SNIPPYLY_HIGHLIGHT_USER_NAME,r))}catch(s){this.loggingService.catch("Error in DomService highlightUserElement: ",s)}}removeHighlightUserFromElement(e){try{e&&(this.removeClassFromElement(e,U.VELT_LIVE_SELECTION_ON_ELEMENT),this.removeClassFromElement(e,U.VELT_LIVE_SELECTION_ON_ELEMENT_DEFAULT),e.removeAttribute(U.SNIPPYLY_HIGHLIGHT),e.removeAttribute(U.VELT_IGNORE_CHANGE_DETECTION),e.removeAttribute(U.VELT_SELECTION_COLOR),e.removeAttribute(U.SNIPPYLY_HIGHLIGHT_USER_NAME),e.style.removeProperty(U.VELT_SELECTION_COLOR))}catch(t){this.loggingService.catch("Error in DomService removeHighlightUserFromElement: ",t)}}previewHighlightElement(e){e&&e.setAttribute(U.SNIPPYLY_HIGHLIGHT_PREVIEW,"true")}removePreviewHighlightFromElement(e){e&&e.removeAttribute(U.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 c=s.split("/"),p=!1;c.forEach((g,f)=>{g.includes("svg")&&(p=!0),p&&(c[f]="svg:"+g)}),s=c.join("/")}return s}catch(s){this.loggingService.catch("Error in DomService getXPath:",s)}}namespaceResolver(e){return e==="svg"?"http://www.w3.org/2000/svg":null}calculateXPath(e,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 c=e.className?.split(" ")?.filter(p=>!p?.includes("snippyly")&&!p?.includes("velt")&&!["show-pin-cursor"].includes(p))[0];if(c){let p=this.calculateXPath(e.parentNode,t,r,a)+"/"+e.tagName.toLowerCase(),g=Array.from(e.parentNode?.children||[]).filter(f=>f.nodeType===1&&f.tagName===e.tagName?f.className?.split(" ")?.filter(T=>T?.includes("snippyly")||T?.includes("velt")||["show-pin-cursor"].includes(T))[0]===c:!1);if(g.length>1){let f=g.indexOf(e)+1;p+=`[contains(concat(' ', normalize-space(@class), ' '), ' ${c} ')][${f}]`}else p+=`[contains(concat(' ', normalize-space(@class), ' '), ' ${c} ')]`;return p}}let s=[].filter.call(e.parentNode?.children?e.parentNode?.children:[],function(c){return c.tagName==e.tagName});return this.calculateXPath(e.parentNode,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=vt();a.setAttribute(U.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}}getElementFromTargetElement(e){try{let t=null;if(e?.anchor){let r=this.resolveAnchorRecord(e.anchor);r?.element&&(t=r.element)}else e?.xpath?t=this.getElementFromXPath(e.xpath):e?.cfXpath?t=this.getElementFromXPath(e.cfXpath):e?.fXpath&&(t=this.getElementFromXPath(e.fXpath));return t}catch(t){return this.loggingService.catch("Error in DomService getElementFromTargetElement:",t),null}}getElementFromTargetTextRange(e){try{let t=null;if(e?.commonAncestorContainerAnchor){let r=this.resolveAnchorRecord(e.commonAncestorContainerAnchor);r?.element&&(t=r.element)}else e?.commonAncestorContainer&&(t=this.getElementFromXPath(e.commonAncestorContainer));return t}catch(t){return this.loggingService.catch("Error in DomService getElementFromTargetTextRange:",t),null}}calculateScreenSize(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowResize","color: green;");try{let e=[document?.body?.clientHeight||0,document?.documentElement?.clientHeight||0,window?.innerHeight||0],t=[document?.body?.clientWidth||0,document?.documentElement?.clientWidth||0,window?.innerWidth||0];this.calculatePageScrollHeight(),this.loggingService.log(this.pageScrollHeight),this.loggingService.log(this.nodeMap),this.highestNode=this.nodeMap[this.pageScrollHeight];let r=new LI;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 LI}}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(I=>{I.removeAttribute("data-snippyly-cache-id")}),r.querySelectorAll("[data-velt-cache-id]").forEach(I=>{I.removeAttribute("data-velt-cache-id")}),r.querySelectorAll(".comment-text-highlight").forEach(I=>{I?.parentNode?.insertBefore(document.createTextNode(I?.textContent),I),I.remove()});let p=document.createNodeIterator(r,NodeFilter.SHOW_COMMENT),g;for(;g=p.nextNode();)g?.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(`[${U.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`)),a=this.getDraftCommentAnnotationDialogs()||[];r.push(...a),r=Array.from(new Set(r));let s=r.map(f=>f.classList.contains("velt-annotation-draft-checked")?(f.classList.remove("velt-annotation-draft-checked"),null):(this.removeClassFromElement(f,"velt-comment-dialog-shake"),setTimeout(()=>{this.addClassToElement(f,"velt-comment-dialog-shake"),f.getAttribute(U.ATTRIBUTES.VELT_ANNOTATION_EDIT_COMMENT)||f.classList.contains("velt-annotation-draft-checked")||this.addClassToElement(f,"velt-annotation-draft-checked")},100),f.getAttribute(U.ATTRIBUTES.VELT_ANNOTATION_DRAFT))).filter(f=>f),c=Object.keys(this.getRecordingInProgress()||{});s=[...s,...c];let p=this.selectedAnnotationsMap$.value;if(e&&this.selectedAnnotationsMap$.value&&Object.keys(this.selectedAnnotationsMap$.value).length){let f=[];Object.keys(p).forEach(I=>{if(p[I]?.type==="tag"){let T=p[I];T?.to?.length||s.includes(I)||f.push(T)}else p[I]?.comments?.length||s.includes(I)||f.push(p[I])}),this.deleteAnnotations$.next(f),this.deleteAnnotations$.next([])}let g={};Object.keys(p).forEach(f=>{if(s.includes(f)&&(g[f]=p[f]),t)switch(t){case"comment":["comment","videoPin"].includes(p[f]?.type)||(g[f]=p[f]);break;default:p[f]?.type!==t&&(g[f]=p[f]);break}}),Object.keys(g).forEach(f=>{let I=g[f]?.multiThreadAnnotationId;I&&!g[I]&&(g[I]={annotationId:I,type:"multiThread"})}),JSON.stringify(this.selectedAnnotationsMap$.value)!==JSON.stringify(g)&&this.selectedAnnotationsMap$.next(g),this.setDialogOpenedInSidebar(!1)}catch(r){this.loggingService.catch("Error in DomService resetSelectedAnnotationsMap: ",r)}}setRecordingInProgress(e,t){try{if(t)this.recordingInProgress$.next(D(E({},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(`${U.TAGS.SNIPPYLY_COMMENT_DIALOG}`)).forEach(r=>{if(r?.shadowRoot){let a=r.shadowRoot.querySelector(`[${U.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);a&&e.push(a)}else{let a=r.querySelector(`${U.TAGS.VELT_SHADOW_DOM_INTERNAL}`);if(a?.shadowRoot){let s=a.shadowRoot?.querySelector(`[${U.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);s&&e.push(s)}else{let s=r.querySelector(`[${U.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 c=JSON.parse(JSON.stringify(this.selectedAnnotationsMap$.value||{})),p=JSON.parse(JSON.stringify(this.selectedAnnotationsLocationMap$.value||{}));c[e.annotationId]&&!a?delete c[e.annotationId]:((!this.windowKeydownShift$.value||a)&&(c={}),c[e.annotationId]=e,p[e.annotationId]=t,s=e?.multiThreadAnnotationId||s,s&&(c[s]={annotationId:s,type:"multiThread"},p[s]=t)),this.selectedAnnotationsMap$.next(c),Object.keys(p).forEach(g=>{c[g]||delete p[g]}),this.selectedAnnotationsLocationMap$.next(p)}catch(c){this.loggingService.catch("Error in DomService toggleAnnotationSelection: ",c)}}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()}getNetworkStatus(){return this.networkStatus$.value}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 c=window.getComputedStyle(a);if(a.tagName.toLowerCase()==="svg"||a instanceof SVGElement){let p=a.parentElement;if(p){let g=p.getBoundingClientRect(),f=a.getBoundingClientRect();r.offsetLeft+=f.left-g.left,r.offsetTop+=f.top-g.top}}else c.position==="static"?c.transformStyle!="preserve-3d"&&c.transform=="none"&&(r.offsetLeft+=a?.offsetLeft||0,r.offsetTop+=a?.offsetTop||0):(r.offsetLeft+=a.offsetLeft,r.offsetTop+=a.offsetTop);if(a=a.parentElement,e instanceof SVGElement&&a===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 c=window.getComputedStyle(a);c.position==="static"?c.transformStyle!="preserve-3d"&&c.transform=="none"&&(r.offsetLeft+=a?.offsetLeft||0,r.offsetTop+=a?.offsetTop||0):(r.offsetLeft+=a.offsetLeft,r.offsetTop+=a.offsetTop)}return r}catch(r){return this.loggingService.catch("Error in DomService getElementOffset: ",r),{offsetTop:0,offsetLeft:0}}}isElementVisible(e){try{if(typeof e?.getBoundingClientRect=="function"){let{width: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 $t(e=>{let t=fi(document,"mousedown").pipe(de(p=>({type:p.type,x:p.clientX+window.scrollX,y:p.clientY+window.scrollY,event:p}))),r=fi(document,"mousemove").pipe(de(p=>({type:p.type,x:p.clientX+window.scrollX,y:p.clientY+window.scrollY,event:p}))),a=fi(document,"mouseup").pipe(de(p=>({type:p.type,x:p.clientX+window.scrollX,y:p.clientY+window.scrollY,event:p}))),c=t.pipe(fe(p=>r.pipe(Di(),de(([g,f])=>({startPoint:p,prevPoint:g,curPoint:f})),Co(a)))).subscribe(e);return()=>c.unsubscribe()})}drawRectangle(e,t){let r=document.querySelector(".rectangle");r||(r=document.createElement("div"),this.addClassToElement(r,"rectangle"),r.setAttribute(U.ATTRIBUTES.VELT_COMMENT_DISABLED,"true"),r.setAttribute(U.VELT_IGNORE_CHANGE_DETECTION,"true"),document.body.appendChild(r));let a=Math.abs(t.x-e.x),s=Math.abs(t.y-e.y),c=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=`${c}px`,r.style.top=`${p}px`,r.style.position="absolute",r.style.border="2px dashed #f00",r.style.pointerEvents="none",r.style.zIndex="2147483577",r}getRange(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: getRange","color: green;"),window.getSelection()?.toString()){let e=window.getSelection();if(e?.rangeCount)return e.getRangeAt(0)}return null}catch(e){return this.loggingService.catch("Error in DomService getRange: ",e),null}}clearTextSelection(){try{this.loggingService.log("%c[WB] Calling FUNCTION: clearTextSelection","color: green;"),window.getSelection&&(window.getSelection()?.empty?window.getSelection()?.empty():window.getSelection()?.removeAllRanges&&window.getSelection()?.removeAllRanges())}catch(e){this.loggingService.catch("Error in DomService clearTextSelection: ",e)}}getTargetTextRangeFromSelectionRange(e){try{let t={},r=e.commonAncestorContainer;r?.nodeType===Node.TEXT_NODE&&(r=r.parentElement);let a=document.body;if(r){let c=this.getTextXPath(r);this.isXpathWithId(c)&&(a=r)}let s=this.getAdditionalLocationContainer(r);if(s&&(a=s),t.commonAncestorContainer=this.getTextXPath(a),t.commonAncestorContainer){let c=this.getElementFromXPath(t.commonAncestorContainer);if(c){t.commonAncestorContainerFXpath=this.getXPath(c,!0),t.commonAncestorContainerCFXpath=this.getXPath(c,!0,!0);let p=this.generateAnchorRecord(c);p&&(t.commonAncestorContainerAnchor=p)}}return t.text=e.toString(),t.occurrence=rf(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(U.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(`[${U.ATTRIBUTES.VELT_LOCATION}], [${U.ATTRIBUTES.VELT_LOCATION_ID}]`)}catch(t){return this.loggingService.catch("Error in DomService isElementInsideAdditionalLocationContainer: ",t),!1}}getAdditionalLocationContainer(e){try{return e?.closest(`[${U.ATTRIBUTES.VELT_LOCATION}], [${U.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 c=document.getElementById(e[s]);c&&a.push(c)}if(t?.length)for(let s=0;s<t.length;s++){let c=document.getElementsByClassName(t[s]);for(let p=0;p<c.length;p++){let g=c[p];g&&g instanceof HTMLElement&&a.push(g)}}if(r?.length)for(let s=0;s<r.length;s++){let c=document.querySelectorAll(r[s]);for(let p=0;p<c.length;p++){let g=c[p];g&&g instanceof HTMLElement&&a.push(g)}}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(`[${U.VELT_CUSTOM_CSS}]`);if(r&&r.remove(),t?.type==="link"){let a=document.createElement("link");a.href=t?.value,a.rel="stylesheet",a.setAttribute(U.VELT_CUSTOM_CSS,"true"),e?.shadowRoot?.appendChild(a)}else{let a=document.createElement("style");a.innerHTML=this.sanitizeHtml(t?.value),a.setAttribute(U.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;"),qI.sanitize(e,ype)}catch(t){return this.loggingService.catch("Error in DomService sanitizeHtml: ",t),""}}sanitizeSvg(e){try{return qI.sanitize(e,ype)}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 Yn;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 Yn)}}getTabId(){try{let e=sessionStorage.getItem(U.SESSION_STORAGE.VELT_TAB_ID);!e&&this.tabId&&(e=this.tabId,sessionStorage.setItem(U.SESSION_STORAGE.VELT_TAB_ID,e)),!this.tabId&&e&&(this.tabId=e);let t=this.getTabIdFromWindowName();return(!e||e!==t)&&(e=vt(),this.tabId=e,sessionStorage.setItem(U.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 Yn}}isMobileDevice(){try{return new Yn().getDeviceType()===mr.MOBILE}catch(e){return this.loggingService.catch("Error in DomService isMobileDevice: ",e),!1}}isTabletDevice(){try{return new Yn().getDeviceType()===mr.TABLET}catch(e){return this.loggingService.catch("Error in DomService isTabletDevice: ",e),!1}}isDesktopDevice(){try{return new Yn().getDeviceType()===mr.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(c=>{s.setAttribute(c.name,c.value)});r.firstChild;)s.appendChild(r.firstChild);r.parentNode.replaceChild(s,r)}})}isMonitorDevice(){try{return new Yn().getDeviceType()===mr.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)(ee(tt),ee(er),ee(y),ee(fl))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var je=(()=>{let o=class o{constructor(e,t,r,a,s,c,p,g){this.afAuth=e,this.configService=t,this.avatarService=r,this.coreActionsService=a,this.domService=s,this.functions=c,this.analyticsService=p,this.loggingService=g,this.user$=new ve(null),this.userOptions$=new ve(null),this.userContacts$=new ve(null),this.userOrganization$=new ve(null),this.providedUser=new zo,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(f=>{this.config=f}),this.forceReLoggedIn=localStorage.getItem(U.LOCAL_STORAGE.VELT_USER_FORCE_RE_LOGGED_IN)==="true",this.sessionReLoginSubscription=ti(this.afAuth).pipe(oo(this.afAuth.currentUser),Di(),fe(([f,I])=>this.domService.onNetworkStatusChange$().pipe(Fe(T=>T),ot(1),de(()=>({previousUser:f,currentUser:I}))))).subscribe(T=>Q(this,[T],function*({previousUser:f,currentUser:I}){if(!I&&f){let L=f?.stsTokenManager?.expirationTime,G=new Date().getTime(),z=L-G;G>L&&(this.analyticsService.trackEvent(Y.Events.Core.SDK_SESSION_TOKEN_EXPIRED,{apiKey:this.apiKey,user:this.user$.value,lastLoggedInUserData:this.lastLoggedInUserData,timeLeft:z,forceReset:this.userOptions$.value?.forceReset,sessionReLoginCount:this.sessionReLoginCount},!0,this.user$.value?.userSnippylyId),this.user$.value&&f?.uid===this.user$.value?.userSnippylyId&&this.lastLoggedInUserData?.user?.userSnippylyId===this.user$.value?.userSnippylyId&&(this.sessionReLoginCount>this.SESSION_RE_LOGIN_COUNT_LIMIT?(this.analyticsService.trackEvent(Y.Events.Core.SDK_SESSION_RE_LOGIN_COUNT_EXCEEDED,{apiKey:this.apiKey,clientUserId:this.lastLoggedInUserData.user.userId,snippylyUserId:this.lastLoggedInUserData.user.userSnippylyId,timeLeft:z,forceReset:this.userOptions$.value?.forceReset,sessionReLoginCount:this.sessionReLoginCount},!0,this.user$.value?.userSnippylyId),this.sessionReLoginSubscription?.unsubscribe()):(this.sessionReLoginCount++,this.analyticsService.trackEvent(Y.Events.Core.SDK_SESSION_RE_LOGIN_TRIGGERED,{apiKey:this.apiKey,clientUserId:this.lastLoggedInUserData.user.userId,snippylyUserId:this.lastLoggedInUserData.user.userSnippylyId,user:this.getUserWithoutContacts(this.lastLoggedInUserData.user),timeLeft:z,forceReset:this.userOptions$.value?.forceReset,sessionReLoginCount:this.sessionReLoginCount},!0,this.lastLoggedInUserData.user.userSnippylyId),this.lastLoggedInUserData.user=yield this.updateUserWithColorAndTextColor(this.lastLoggedInUserData.user),this.initializeClient(this.lastLoggedInUserData.user,this.lastLoggedInUserData.userOptions,this.lastLoggedInUserData.initializeClientToken,this.lastLoggedInUserData.autoLogin,"internal-sessionReLogin"))))}}),f=>{this.loggingService.catch("Error in AuthService sessionReLoginSubscription: ",f)}),this.getUser$().pipe(_t(Xt)).subscribe(f=>{let I=Dr(f);this.coreActionsService.triggerAction(ct.USER_UPDATE,I),this.coreActionsService.triggerAction(ct.INIT_UPDATE,{event:ct.USER_UPDATE,payload:{user:I}})})}catch(f){this.loggingService.catch("Error in AuthService constructor: ",f)}}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 WR),this.configService.initConfig(t),t.debugMode?sessionStorage.setItem("debugMode","true"):sessionStorage.removeItem("debugMode"),this.autoLoginCalled||ti(this.afAuth).pipe(ot(1)).subscribe(r=>Q(this,null,function*(){if(this.autoLoginCalled=!0,r){let a=yield pp(r,!0).catch(s=>null);if(a){let{user:s}=a?.claims;this.autoLoginRequired&&(s=yield this.updateUserWithColorAndTextColor(s),this.initializeClient(s,this.userOptions$?.value?D(E({},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)}}setUserPermissionService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setUserPermissionService","color: green;"),this.userPermissionService=e}catch(t){this.loggingService.catch("Error in setUserPermissionService: ",t)}}setDocService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocService","color: green;"),this.docService=e}catch(t){this.loggingService.catch("Error in setDocService: ",t)}}setContactService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setContactService","color: green;"),this.contactService=e}catch(t){this.loggingService.catch("Error in setContactService: ",t)}}setIamService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setIamService","color: green;"),this.iamService=e}catch(t){this.loggingService.catch("Error in setIamService: ",t)}}setAreaService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setAreaService","color: green;"),this.areaService=e}catch(t){this.loggingService.catch("Error in setAreaService: ",t)}}setCommentService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setCommentService","color: green;"),this.commentService=e}catch(t){this.loggingService.catch("Error in setCommentService: ",t)}}setReactionService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setReactionService","color: green;"),this.reactionService=e}catch(t){this.loggingService.catch("Error in setReactionService: ",t)}}setRecorderAnnotationService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setRecorderAnnotationService","color: green;"),this.recorderAnnotationService=e}catch(t){this.loggingService.catch("Error in setRecorderAnnotationService: ",t)}}setViewsService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setViewsService","color: green;"),this.viewsService=e}catch(t){this.loggingService.catch("Error in setViewsService: ",t)}}setCommonDbService(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setCommonDbService","color: green;"),this.commonDbService=e}catch(t){this.loggingService.catch("Error in setCommonDbService: ",t)}}validateOrganizationId(e){if(this.isVersionGreaterThanOrEqualTo4()&&!e?.organizationId)if(this.analyticsService.trackEvent(Y.Events.Core.SDK_VALIDATE_CLIENT_FAILED,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,message:"Organization Id is not set",forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e)},!0,e.userSnippylyId),this.configService.getSF())this.loggingService.catch("OrganizationId is not set in Identify method",void 0,void 0,!0);else throw new Error("OrganizationId is not set in Identify method")}setVeltAuthProvider(e){return Q(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: setVeltAuthProvider","color: green;");try{this.onRetrySubscription?.unsubscribe();let t=null;if(!e.user)return null;e.generateToken&&typeof e.generateToken=="function"&&(t=yield e.generateToken());let r=yield sz(()=>window.Velt.identify(e.user,E(E({},e.options||{}),t&&{authToken:t}),{fromProvider:!0}).catch(a=>(e.onError&&typeof e.onError=="function"&&e.onError(a),Promise.reject(a))),e.retryConfig||{retryCount:0,retryDelay:0});return r&&e.generateToken&&typeof e.generateToken=="function"&&(this.onRetrySubscription=this.coreActionsService.onAction(ct.ERROR).pipe(Fe(a=>a.code==="token_expired"),ot(10)).subscribe(a=>Q(this,null,function*(){if(a.code==="token_expired"){let s=this.docService?.getDocumentIds()?.map(T=>({id:T.clientDocumentId}))??[],c=this.docService?.getOptionsFromDocumentPaths()??void 0,p=[],g=this.docService?.getLocation();g&&p.push(g.location);let f=this.docService?.getLocations();f&&Object.values(f).forEach(T=>{p.push(T.location)}),(yield sz(()=>Q(this,null,function*(){try{let T=yield e.generateToken?.();return T?window.Velt.identify(e.user,E(E({},e.options||{}),T&&{authToken:T}),{fromProvider:!0}):!0}catch{return!1}}),e.retryConfig||{retryCount:0,retryDelay:0}))&&(yield this.docService?.setDocuments({documents:s,options:c,source:"internal"}),yield this.docService?.setLocations({locations:p,source:"internal",options:{appendLocation:!g}}))}}))),r}catch(t){return this.loggingService.catch("Error in setVeltAuthProvider: ",t),null}})}setUserToStorage(e){return Q(this,null,function*(){try{if(e){let t=yield Dl(e,e?.userId??"");localStorage.setItem(U.LOCAL_STORAGE.VELT_IDENTIFY_USER,t)}}catch(t){this.loggingService.catch("Error in setUserToStorage: ",t)}})}getUserFromStorage(e){return Q(this,null,function*(){try{let t=localStorage.getItem(U.LOCAL_STORAGE.VELT_IDENTIFY_USER);return t?yield W0(t,e?.userId??""):null}catch(t){return this.loggingService.catch("Error in getUserFromStorage: ",t),null}})}updateUserWithColorAndTextColor(e){return Q(this,null,function*(){try{let t=JSON.parse(JSON.stringify(e??{})),r=yield this.getUserFromStorage(t);return!r||Object.keys(r).length===0?(delete t?.color,delete t?.textColor,t):(r?.color&&(t.color=r?.color),r?.textColor&&(t.textColor=r?.textColor),t)}catch(t){return this.loggingService.catch("Error in updateUserWithColorAndTextColor: ",t),e}})}updateUserIfRequired(e){return Q(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: updateUserIfRequired","color: green;");try{let t=yield this.getUserFromStorage(e),r={};if(e.color&&e.color!==t?.color&&(r.color=e.color),e.textColor&&e.textColor!==t?.textColor&&(r.textColor=e.textColor),Object.keys(r).length>0&&e.clientOrganizationId){let a=Xi(this.functions,Qi({url:wn?.cloudFunction?.sdkProxy,apiProxyDomain:this.configService?.getApiProxyDomain()}));pd({data:{type:"addUserInfoToOrganization",metadata:{organizationId:e.clientOrganizationId},user:D(E({},r),{userId:e.userId})},getSdkProxy:a,userId:e?.userId??""})}}catch(t){this.loggingService.catch("Error in updateUserIfRequired: ",t)}})}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=K0(this.configService.getApiKey(),e.userId),this.pendingUserLogin=void 0,this.pendingUserLoginSource=void 0,this.initializeClientToken=r;let c=yield ti(this.afAuth).pipe(ot(1)).toPromise().catch(g=>null),p=!0;if(this.providedUser=JSON.parse(JSON.stringify(e)),c){let g=yield pp(c,!0).catch(T=>null);if(!g)return;let{user:f,firebaseConfig:I}=g.claims;if(c?.uid!==e?.userSnippylyId||e?.groupId!==f?.groupId||e?.organizationId!==f?.organizationId||t?.forceReset||!a&&e?.organizationId&&!this.forceReLoggedIn||this.forceReLoginRequiredForAdvancedQueries(e)||this.forceReLoginRequiredForRegion(e,I)||this.forceReLoginRequiredForCommentViews(e))localStorage.setItem(U.LOCAL_STORAGE.VELT_USER_FORCE_RE_LOGGED_IN,"true"),localStorage.setItem(U.LOCAL_STORAGE.VELT_COMMENT_VIEWS_MIGRATED,"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 T=yield pp(c,!0).catch(J=>null);if(!T)return;let{firebaseConfig:L,user:G,advancedQueries:z}=T.claims;yield this.updateUserIfRequired(e),this.validateOrganizationId(e),this.setFirebaseConfig(L),this.setAdvancedQueries(z),G&&(this.providedUser.isAdmin=!!G.isAdmin),this.initializeSignedInUser(c,a,e),p=!1,this.analyticsService.trackEvent(Y.Events.Core.SDK_USER_AUTH_SUCCESS,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,authType:"auto",forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e),source:s})}}if(p){this.analyticsService.trackEvent(Y.Events.Core.SDK_VALIDATE_CLIENT_TRIGGERED,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e),source:s},!0,e.userSnippylyId,e.userId);let g=Xi(this.functions,Qi({url:wn.cloudFunction.validateClient,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:1200*1e3}),f=_a(),I=(yield g({apiKey:this.apiKey,user:e,version:f,authToken:t?.authToken}))?.data;if(I.error){if(this.analyticsService.trackEvent(Y.Events.Core.SDK_VALIDATE_CLIENT_FAILED,D(E({apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,message:I.error,forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e)},I),{source:s}),!0,e.userSnippylyId,e.userId),I.error&&typeof I.error=="string")if(I.error?.toLowerCase()?.includes("token expired"))if(this.tokenExpiredErrorCount++,this.tokenExpiredErrorCount<=this.TOKEN_EXPIRED_ERROR_COUNT_LIMIT){let T={code:"token_expired",message:"Token expired",error:I?.error,source:I?.source};this.coreActionsService.triggerAction(ct.ERROR,T)}else{let T={code:"too_many_retries",message:"Token expired. Too many retries.",error:I?.error,source:I?.source};this.coreActionsService.triggerAction(ct.ERROR,T),this.analyticsService.trackEvent(Y.Events.Core.SDK_JWT_EXPIRED_RETRY_EXCEEDED,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,forceReset:this.userOptions$.value?.forceReset,source:s},!0,e.userSnippylyId,e.userId)}else{let T=I;this.coreActionsService.triggerAction(ct.ERROR,T)}throw I}else this.tokenExpiredErrorCount=0;if(this.analyticsService.trackEvent(Y.Events.Core.SDK_VALIDATE_CLIENT_SUCCESS,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e),source:s},!0,e.userSnippylyId,e.userId),this.validateOrganizationId(e),I.firebaseConfig){this.setFirebaseConfig(I.firebaseConfig),yield this.signInWithCustomToken(e,I.token),this.loggingService.log("new signed in user",this.afAuth.currentUser);let T=yield pp(this.afAuth.currentUser,!0).catch(z=>null);if(!T)return;let{user:L,advancedQueries:G}=T.claims;this.setAdvancedQueries(G),this.providedUser.isAdmin=!!L?.isAdmin,this.initializeSignedInUser(this.afAuth.currentUser,a,e)}}this.initializeClientToken=0,this.lastLoggedInUserData={user:e,userOptions:t,initializeClientToken:r,autoLogin:a},this.checkForPendingLogin()}return e}catch(c){return this.initializeClientToken=0,this.checkForPendingLogin(),this.loggingService.catch("Error in initializeClient: ",c),t?.throwError?Promise.reject(c):Promise.resolve(null)}})}isVersionGreaterThanOrEqualTo4(){try{let e=_a();return(e?parseInt(e.split(".")?.[0]||"0"):0)>=4}catch(e){return this.loggingService.catch("Error in isVersionGreaterThanOrEqualTo4: ",e),!1}}isVersion4Point5(){try{let e=_a();if(e){let t=e.split("."),r=parseInt(t[0]||"0"),a=parseInt(t[1]||"0"),s=parseInt(t[2]||"0");if(r>=4&&a>=5)return r===4&&a===5&&s===0?!e.toLowerCase().includes("beta"):!0}return!1}catch(e){return this.loggingService.catch("Error in isVersion4Point5: ",e),!1}}forceReLoginRequiredForAdvancedQueries(e){try{let t=this.isVersionGreaterThanOrEqualTo4(),r=!1;try{let a=localStorage.getItem(U.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}}forceReLoginRequiredForCommentViews(e){try{let t=this.isVersion4Point5(),r=!1;try{let a=localStorage.getItem(U.LOCAL_STORAGE.VELT_COMMENT_VIEWS_MIGRATED);a&&(r=JSON.parse(a))}catch(a){this.loggingService.catch("Error in forceReLoginRequiredForCommentViews: ",a)}return!!(t&&e.organizationId&&!r)}catch(t){return this.loggingService.catch("Error in forceReLoginRequiredForCommentViews: ",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:E(E({},wn.firebaseConfig),e)})}catch(t){this.loggingService.catch("Error in setFirebaseConfig: ",t)}}getFirebaseConfig$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getFirebaseConfig","color: green;"),this.firebaseConfig$.asObservable()}getFirebaseConfig(){return this.loggingService.log("%c[WB] Calling FUNCTION: getFirebaseConfig","color: green;"),this.firebaseConfig$.value}setAdvancedQueries(e){this.loggingService.log("%c[WB] Calling FUNCTION: setAdvancedQueries","color: green;");try{e&&typeof e=="object"&&localStorage.setItem(U.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 mn([this.configService.getConfig$(),this.getAdvancedQueries$()]).pipe(de(()=>this.getAdvancedQueriesEnabled()),zn(()=>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;"),ti(this.afAuth).pipe(fe(e=>e?this.user$.asObservable():se(null)),_t(Xt))}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=E(E({},this.providedUser),e),t){let r=E(E({},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 cie(this.afAuth,t).then(a=>(this.analyticsService.trackEvent(Y.Events.Core.SDK_USER_AUTH_SUCCESS,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,authType:r,forceReset:this.userOptions$.value?.forceReset,user:this.getUserWithoutContacts(e)}),a)).catch(a=>(this.analyticsService.trackEvent(Y.Events.Core.SDK_USER_AUTH_FAILED,{apiKey:this.apiKey,clientUserId:e.userId,snippylyUserId:e.userSnippylyId,authType: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,r){this.loggingService.log("%c[WB] Calling FUNCTION: initializeSignedInUser","color: green;");try{let a=new zo;a.userSnippylyId=e.uid,a.type="signedIn",r&&(a=E(E({},a),r)),this.setUserToStorage(a),this.mergeUserWithProvidedUserData(a,t)}catch(a){this.loggingService.catch("Error in initializeSignedInUser: ",a)}}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?.externalUserDataProviderAvailable()){let a=vt();this.coreActionsService.triggerAction(ct.USER_RESOLVER,{event:Y.Events.Resolver.USER_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:a,methodName:Hr.MERGE_USER_WITH_PROVIDED_USER_DATA,source:"internal",payload:{userIds:[e.userId],organizationId:this.providedUser?.organizationId||e.organizationId}});let s=yield this.usersService.resolveUsers({userIds:[e.userId],organizationId:this.providedUser?.organizationId||e.organizationId,skipUserCheck:!0,uniqueId:a});s&&s[e.userId]&&(r=JSON.parse(JSON.stringify(s[e.userId]||{}))),e=E(E({},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||this.getPlanDetailsFromDb();try{if(this.userPermissionService?.isPermissionProviderAvailable()&&e.clientOrganizationId){let r=[{userId:e.userId,resource:{id:e.clientOrganizationId,type:Fo.ORGANIZATION,source:Hi.IDENTIFY,organizationId:e.clientOrganizationId}}],a=vt();this.coreActionsService.triggerAction(ct.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.RESOURCE_ACCESS_REQUEST_FORMED,methodName:Hi.IDENTIFY,uniqueId:a,timestamp:new Date().getTime(),source:"internal",payload:{requests:r}}),yield this.userPermissionService?.onResourceAccessRequired({requests:r,uniqueId:a,userId:e.userId,methodName:Hi.IDENTIFY,fromCache:!1})}}catch(r){this.loggingService.catch("Error in updateUserInternally: ",r)}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=D(E({},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 Xi(this.functions,Qi({url:wn.cloudFunction.getPlanDetails,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:1200*1e3})({apiKey:this.configService.getApiKey(),sdkVersion:_a(),sdkType:this.configService.getSdkType()});return t?.data?.isPlanExpired&&(this.analyticsService.trackEvent(Y.Events.Core.SDK_PLAN_EXPIRED),this.configService.getSF()||console.warn("Velt SDK plan has expired.")),this.planDetails$.next(t?.data||{planInfo:null,isPlanExpired:!1}),t}catch(e){return this.loggingService.catch("Error in getPlanDetailsFromDb: ",e),this.planDetails$.next({planInfo:null,isPlanExpired:!1}),Promise.resolve(null)}})}isPlanExpired$(){return this.planDetails$.pipe(Fe(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(fe(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(),this.userPermissionService?.revokeAccessOnUserLogout(),yield this.analyticsService.trackEvent(Y.Events.Core.SDK_USER_SIGN_OUT,{apiKey:this.apiKey,clientUserId:this.user$?.value?.userId,snippylyUserId:this.user$?.value?.userSnippylyId,message:e==="external"?"User Sign out":"System Sign out",user:this.user$?.value?this.getUserWithoutContacts(this.user$?.value):null,forceReset:this.userOptions$.value?.forceReset,source:e});let t=yield ti(this.afAuth).pipe(ot(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 lm(1e3),die(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 Dr(e)}catch(t){return this.loggingService.catch("Error in getUserForClient: ",t),null}}getUserAvatarColor(e){try{return e?this.avatarService.generateUserColor(Nn(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)(ee(Pi),ee(Ft),ee(hm),ee(ni),ee(Le),ee(xo),ee(tt),ee(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var fm=class{constructor({apiKey:o,documentId:n,organizationId:e,folderId:t,veltFolderId:r,clientDocumentId:a,clientOrganizationId:s}){this.paths={},this.apiKey=o,this.documentId=n,this.organizationId=e,this.folderId=t,this.veltFolderId=r,this.clientDocumentId=a,this.clientOrganizationId=s,a&&(this.documentId=Tr(a)),s&&(this.organizationId=os(s)),t&&(this.folderId=t,this.veltFolderId=$i(t)),this.generateDocumentPaths()}generateDocumentPaths(){try{if(this.paths.clientDocumentId=this.clientDocumentId,this.paths.documentId=this.documentId,this.organizationId&&(this.paths.organizationId=this.organizationId,this.paths.clientOrganizationId=this.clientOrganizationId),this.veltFolderId&&(this.paths.folderId=this.folderId,this.paths.veltFolderId=this.veltFolderId),this.apiKey){let o=`${this.apiKey}`;this.organizationId&&(o=`${o}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${this.paths.organizationId}`),this.documentId&&(this.paths.docs=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/`,this.paths.folder=`${o}/${U.FIREBASE_PARTIAL_PATH_FOLDERS}/`,this.paths.presence=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_PRESENCE}/`,this.paths.cursor=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_CURSOR}/`,this.paths.comment=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_COMMENT}/`,this.paths.multiThread=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_MULTI_THREAD}/`,this.paths.tag=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_TAG}/`,this.paths.area=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_AREA}/`,this.paths.arrow=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_ARROW}/`,this.paths.selection=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_SELECTION}/`,this.paths.audioHuddle=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_AUDIO_HUDDLE}/`,this.paths.huddle=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_HUDDLE}/`,this.paths.recorder=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_RECORDER}/`,this.paths.flock=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_FOLLOW_ALONG}/`,this.paths.syncVideoPlayer=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_SYNC_VIDEO_PLAYER}/`,this.paths.liveState=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_LIVE_STATE}/`,this.paths.liveStateSingleEditorMode=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_LIVE_STATE}/default/singleEditorMode`,this.paths.reaction=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_REACTION}/`,this.paths.crdt=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_CRDT}/`,this.paths.views=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_VIEWS}/`,this.paths.notifications=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_NOTIFICATIONS}/`,this.paths.metadata=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_METADATA}/`,this.paths.users=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_USERS}/`,this.paths.documentIam=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_IAM}/`,this.paths.userConfig=`${o}/${U.FIREBASE_PARTIAL_PATH_USERS}`),this.paths.customerMetadata=`${o}/${U.FIREBASE_PARTIAL_PATH_CUSTOMER_METADATA}/`,this.paths.groupContacts=`${o}/${U.FIREBASE_PARTIAL_PATH_CONTACTS}/${U.FIREBASE_PARTIAL_PATH_GROUPS}/`,this.paths.globalContacts=`${o}/${U.FIREBASE_PARTIAL_PATH_CONTACTS}/${U.FIREBASE_PARTIAL_PATH_GLOBAL}/`,this.paths.logins=`${o}/${U.FIREBASE_PARTIAL_PATH_CONTACTS}/${U.FIREBASE_PARTIAL_PATH_LOGINS}/`,this.paths.userFeedback=`${o}/${U.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${U.FIREBASE_PARTIAL_PATH_FEEDBACK}/`,this.paths.userReportBugs=`${o}/${U.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${U.FIREBASE_PARTIAL_PATH_BUGS}/`,this.paths.userContactUs=`${o}/${U.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${U.FIREBASE_PARTIAL_PATH_CONTACT_US}/`,this.organizationId&&(this.paths.organizationMetadata=`${o}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATION_METADATA}/`,this.paths.organizationIam=`${o}/${U.FIREBASE_PARTIAL_PATH_IAM}/`,this.paths.organizationGroups=`${o}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATION_GROUPS}/`,this.paths.organizationNotifications=`${o}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/`,this.documentId&&(this.paths.organizationNotificationsWithDocumentId=`${o}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/`,this.paths.heartbeatByDocument=`${o}/${U.FIREBASE_PARTIAL_PATH_HEARTBEAT_BY_DOCUMENT}/${this.documentId}/`),this.paths.organizationNotificationsLastNotificationTimestamp=`${o}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${U.FIREBASE_PARTIAL_PATH_LAST_NOTIFICATION_TIMESTAMP}/${U.FIREBASE_PARTIAL_PATH_DOCS}/`,this.paths.organizationNotificationsUsers=`${o}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${U.FIREBASE_PARTIAL_PATH_USERS}/`,this.paths.heartbeat=`${o}/${U.FIREBASE_PARTIAL_PATH_HEARTBEAT}/`),this.paths.workspaceIam=`${this.apiKey}/${U.FIREBASE_PARTIAL_PATH_IAM}/`}}catch{}}get folder(){return this.paths.folder?this.paths.folder:this.throwError("Folder path is not available.")}get userConfig(){return this.paths.userConfig?this.paths.userConfig:this.throwError("User config path is not available.")}get workspaceIam(){return this.paths.workspaceIam?this.paths.workspaceIam:this.throwError("Workspace IAM path is not available.")}get docs(){return this.paths.docs?this.paths.docs:this.throwError("Docs path is not available.")}get presence(){return this.paths.presence?this.paths.presence:this.throwError("Presence path is not available.")}get cursor(){return this.paths.cursor?this.paths.cursor:this.throwError("Cursor path is not available.")}get area(){return this.paths.area?this.paths.area:this.throwError("Area path is not available.")}get arrow(){return this.paths.arrow?this.paths.arrow:this.throwError("Arrow path is not available.")}get comment(){return this.paths.comment?this.paths.comment:this.throwError("Comment path is not available.")}get multiThread(){return this.paths.multiThread?this.paths.multiThread:this.throwError("Multi thread path is not available.")}get tag(){return this.paths.tag?this.paths.tag:this.throwError("Tag path is not available.")}get selection(){return this.paths.selection?this.paths.selection:this.throwError("Selection path is not available.")}get audioHuddle(){return this.paths.audioHuddle?this.paths.audioHuddle:this.throwError("Audio huddle path is not available.")}get huddle(){return this.paths.huddle?this.paths.huddle:this.throwError("Huddle path is not available.")}get recorder(){return this.paths.recorder?this.paths.recorder:this.throwError("Recorder path is not available.")}get flock(){return this.paths.flock?this.paths.flock:this.throwError("Flock path is not available.")}get syncVideoPlayer(){return this.paths.syncVideoPlayer?this.paths.syncVideoPlayer:this.throwError("Sync video player path is not available.")}get liveState(){return this.paths.liveState?this.paths.liveState:this.throwError("Live state path is not available.")}get liveStateSingleEditorMode(){return this.paths.liveStateSingleEditorMode?this.paths.liveStateSingleEditorMode:this.throwError("Live state single editor mode path is not available.")}get reaction(){return this.paths.reaction?this.paths.reaction:this.throwError("Reaction path is not available.")}get crdt(){return this.paths.crdt?this.paths.crdt:this.throwError("CRDT path is not available.")}get views(){return this.paths.views?this.paths.views:this.throwError("Views path is not available.")}get notifications(){return this.paths.notifications?this.paths.notifications:this.throwError("Notifications path is not available.")}get metadata(){return this.paths.metadata?this.paths.metadata:this.throwError("Metadata path is not available.")}get users(){return this.paths.users?this.paths.users:this.throwError("Users path is not available.")}get documentIam(){return this.paths.documentIam?this.paths.documentIam:this.throwError("Document IAM path is not available.")}get organizationMetadata(){return this.paths.organizationMetadata?this.paths.organizationMetadata:this.throwError("Organization metadata path is not available.")}get organizationIam(){return this.paths.organizationIam?this.paths.organizationIam:this.throwError("Organization IAM path is not available.")}get customerMetadata(){return this.paths.customerMetadata?this.paths.customerMetadata:this.throwError("Customer metadata path is not available.")}get groupContacts(){return this.paths.groupContacts?this.paths.groupContacts:this.throwError("Group contacts path is not available.")}get globalContacts(){return this.paths.globalContacts?this.paths.globalContacts:this.throwError("Global contacts path is not available.")}get logins(){return this.paths.logins?this.paths.logins:this.throwError("Logins path is not available.")}get userFeedback(){return this.paths.userFeedback?this.paths.userFeedback:this.throwError("User feedback path is not available.")}get userReportBugs(){return this.paths.userReportBugs?this.paths.userReportBugs:this.throwError("User report bugs path is not available.")}get userContactUs(){return this.paths.userContactUs?this.paths.userContactUs:this.throwError("User contact us path is not available.")}get organizationGroups(){return this.paths.organizationGroups?this.paths.organizationGroups:this.throwError("Organization groups path is not available.")}get heartbeat(){return this.paths.heartbeat?this.paths.heartbeat:this.throwError("Heartbeat path is not available.")}get heartbeatByDocument(){return this.paths.heartbeatByDocument?this.paths.heartbeatByDocument:this.throwError("Heartbeat by document path is not available.")}get organizationNotifications(){return this.paths.organizationNotifications?this.paths.organizationNotifications:this.throwError("Organization notifications path is not available.")}get organizationNotificationsWithDocumentId(){return this.paths.organizationNotificationsWithDocumentId?this.paths.organizationNotificationsWithDocumentId:this.throwError("Organization notifications with document id path is not available.")}get organizationNotificationsUsers(){return this.paths.organizationNotificationsUsers?this.paths.organizationNotificationsUsers:this.throwError("Organization notifications users path is not available.")}get organizationNotificationsLastNotificationTimestamp(){return this.paths.organizationNotificationsLastNotificationTimestamp?this.paths.organizationNotificationsLastNotificationTimestamp:this.throwError("Organization notifications last notification timestamp path is not available.")}throwError(o){throw{type:"DocumentPaths",message:o,metadata:{apiKey:this.apiKey,documentId:this.documentId,organizationId:this.organizationId}}}};var d9=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=Tr(t)),r&&(this.organizationId=os(r)),a&&(this.folderId=a,this.veltFolderId=$i(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}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${this.paths.organizationId}`,this.paths.organization=o,this.paths.folder=`${o}/${U.FIREBASE_PARTIAL_PATH_FOLDERS}`,this.paths.organizationUsers=`${o}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATION_USERS}`,this.paths.users=`${o}/${U.FIREBASE_PARTIAL_PATH_CENTRAL_USERS}`,this.paths.notificationDocs=`${o}/${U.FIREBASE_PARTIAL_PATH_NOTIFICATION_DOCS}`,this.paths.notificationUsers=`${o}/${U.FIREBASE_PARTIAL_PATH_NOTIFICATION_USERS}`,this.paths.organizationGroups=`${o}/${U.FIREBASE_PARTIAL_PATH_GROUPS}`,this.paths.lastNotificationTimestamp=`${o}/${U.FIREBASE_PARTIAL_PATH_LAST_NOTIFICATION_TIMESTAMP}`,this.paths.userConfig=`${o}/${U.FIREBASE_PARTIAL_PATH_USERS}`,this.paths.permissionsUsers=`${o}/${U.FIREBASE_PARTIAL_PATH_PERMISSIONS_USERS}`),this.veltFolderId&&(this.paths.folderUsers=`${o}/${U.FIREBASE_PARTIAL_PATH_FOLDERS}/${this.veltFolderId}/${U.FIREBASE_PARTIAL_PATH_FOLDER_USERS}`),this.documentId&&(this.paths.document=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}`,this.paths.comment=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_COMMENT}`,this.paths.location=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_LOCATION}`,this.paths.multiThread=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_MULTI_THREAD}`,this.paths.area=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_AREA}`,this.paths.recorder=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_RECORDER}`,this.paths.reaction=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_REACTION}`,this.paths.crdt=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_CRDT}`,this.paths.notificationViews=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_NOTIFICATION_VIEWS}`,this.paths.documentViews=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_DOCUMENT_VIEWS}`,this.paths.locationViews=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_LOCATION_VIEWS}`,this.paths.documentUsers=`${o}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_DOCUMENT_USERS}`,this.paths.docNotification=`${this.paths.notificationDocs}/${this.documentId}/${U.FIREBASE_PARTIAL_PATH_DOC_NOTIFICATION}`)}}catch{}}get permissionsUsers(){return this.paths.permissionsUsers?this.paths.permissionsUsers:this.throwError("PermissionsUsers path is not available.")}get users(){return this.paths.users?this.paths.users:this.throwError("Users path is not available.")}get userConfig(){return this.paths.userConfig?this.paths.userConfig:this.throwError("UserConfig path is not available.")}get folder(){return this.paths.folder?this.paths.folder:this.throwError("Folder path is not available.")}get lastNotificationTimestamp(){return this.paths.lastNotificationTimestamp?this.paths.lastNotificationTimestamp:this.throwError("LastNotificationTimestamp path is not available.")}get organizationGroups(){return this.paths.organizationGroups?this.paths.organizationGroups:this.throwError("organizationGroups path is not available.")}get docNotification(){return this.paths.docNotification?this.paths.docNotification:this.throwError("DocNotification path is not available.")}get organization(){return this.paths.organization?this.paths.organization:this.throwError("Organization path is not available.")}get document(){return this.paths.document?this.paths.document:this.throwError("Document path is not available.")}get location(){return this.paths.location?this.paths.location:this.throwError("Location path is not available.")}get area(){return this.paths.area?this.paths.area:this.throwError("Area path is not available.")}get comment(){return this.paths.comment?this.paths.comment:this.throwError("Comment path is not available.")}get documentViews(){return this.paths.documentViews?this.paths.documentViews:this.throwError("DocumentViews path is not available.")}get locationViews(){return this.paths.locationViews?this.paths.locationViews:this.throwError("LocationViews path is not available.")}get notificationViews(){return this.paths.notificationViews?this.paths.notificationViews:this.throwError("NotificationViews path is not available.")}get documentUsers(){return this.paths.documentUsers?this.paths.documentUsers:this.throwError("DocumentUsers path is not available.")}get folderUsers(){return this.paths.folderUsers?this.paths.folderUsers:this.throwError("FolderUsers path is not available.")}get organizationUsers(){return this.paths.organizationUsers?this.paths.organizationUsers:this.throwError("OrganizationUsers path is not available.")}get notificationDocs(){return this.paths.notificationDocs?this.paths.notificationDocs:this.throwError("NotificationDocs path is not available.")}get notificationUsers(){return this.paths.notificationUsers?this.paths.notificationUsers:this.throwError("NotificationUsers path is not available.")}get multiThread(){return this.paths.multiThread?this.paths.multiThread:this.throwError("Multi thread path is not available.")}get recorder(){return this.paths.recorder?this.paths.recorder:this.throwError("Recorder path is not available.")}get reaction(){return this.paths.reaction?this.paths.reaction:this.throwError("Reaction path is not available.")}get crdt(){return this.paths.crdt?this.paths.crdt:this.throwError("CRDT path is not available.")}throwError(o){throw{type:"DocumentPaths",message:o,metadata:{apiKey:this.apiKey,documentId:this.documentId,organizationId:this.organizationId}}}};var m9=class{};var In=(()=>{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(vM(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)(ee(je),ee(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Js=(()=>{let o=class o{constructor(e,t,r){this.coreActionsService=e,this.loggingService=t,this.analyticsService=r,this.resolveTimeout=60*1e3,this.retrySaveConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryDeleteConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryGetConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.commentAnnotationDataProvider$=new ve(null),this.commentAnnotationById$=new ve({}),this.fieldsToRemove=[],this.getCommentAnnotationById=a=>{try{return this.commentAnnotationDataProviderAvailable()?this.commentAnnotationById$.value?.[a]:void 0}catch(s){this.loggingService.catch("Error in CommentAnnotationsResolverService getCommentAnnotationById:",s);return}};try{this.loggingService.log("CommentAnnotationsResolverService initialized"),this.commentAnnotationDataProvider$.subscribe(a=>{a&&(a.config?.resolveTimeout&&(this.resolveTimeout=a.config.resolveTimeout),a.config?.saveRetryConfig&&(this.retrySaveConfig=a.config.saveRetryConfig),a.config?.deleteRetryConfig&&(this.retryDeleteConfig=a.config.deleteRetryConfig),a.config?.getRetryConfig&&(this.retryGetConfig=a.config.getRetryConfig),a.config?.fieldsToRemove&&(this.fieldsToRemove=a.config.fieldsToRemove))})}catch(a){this.loggingService.catch("Error in CommentAnnotationsResolverService constructor:",a)}}getProvider(){try{let e=this.commentAnnotationDataProvider$.getValue();return e||void 0}catch(e){this.loggingService.catch("Error in CommentAnnotationsResolverService getProvider:",e);return}}ngOnDestroy(){try{this.commentAnnotationById$.next({})}catch(e){this.loggingService.catch("Error in CommentAnnotationsResolverService ngOnDestroy:",e)}}resolveCommentAnnotations(e,t){return Q(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling CommentAnnotationsResolverService FUNCTION: resolveCommentAnnotations","color: green;"),!this.commentAnnotationDataProviderAvailable())return{};let r,a=!1,s=!1,c=()=>{r&&(clearTimeout(r),r=void 0,s=!0)};return new Promise((p,g)=>{r=setTimeout(()=>{if(!s){a=!0,c();let z=t||vt();this.coreActionsService.triggerAction(ct.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:z,methodName:No.RESOLVE_COMMENT_ANNOTATIONS,source:"internal",payload:{error:new Error("Comment annotation resolution timeout"),request:e}}),g(new Error("Comment annotation resolution timeout"))}},this.commentAnnotationDataProvider$.value?.config?.resolveTimeout||this.resolveTimeout);let f=this.getProvider();if(!f)return c(),p({});let I={},T=[...new Set(e.commentAnnotationIds||[])],L=D(E({},e),{commentAnnotationIds:T});Q(this,null,function*(){try{if(T.length>0||e.documentIds?.length||e.folderId){let z=t||vt();this.coreActionsService.triggerAction(ct.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_RESOLUTION_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:z,methodName:No.RESOLVE_COMMENT_ANNOTATIONS,source:"internal",payload:{request:L}});let J=md(()=>f?.get(L)||Promise.resolve(void 0),"getCommentAnnotations",this.retryGetConfig).then(le=>a?{}:(c(),le&&le.statusCode!==200?(this.coreActionsService.triggerAction(ct.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:z,methodName:No.RESOLVE_COMMENT_ANNOTATIONS,source:"internal",payload:{result:le,request:L}}),this.loggingService.catch(le?.message??"Error in CommentAnnotationsResolverService resolveCommentAnnotations:"),{}):le?.data)).catch(le=>{throw c(),le});try{I=(yield J)||{},this.analyticsService.trackEvent(Y.Events.Resolver.COMMENT_RESOLVER_GET,{sourceMethod:"resolveCommentAnnotations",source:"sdk",commentAnnotationIds:T});let le={};Object.entries(I).forEach(([_e,De])=>{let Be=this.commentAnnotationById$.value?.[_e];Be?Be&&JSON.stringify(Be)!==JSON.stringify(De)&&(le[_e]=De):le[_e]=De}),Object.keys(le).length>0&&this.commentAnnotationById$.next(E(E({},this.commentAnnotationById$.getValue()),le)),this.coreActionsService.triggerAction(ct.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_RESOLUTION_RESULT,timestamp:new Date().getTime(),uniqueId:z,methodName:No.RESOLVE_COMMENT_ANNOTATIONS,source:"internal",payload:{result:le,request:L}}),p(le)}catch(le){let _e=t||vt();this.coreActionsService.triggerAction(ct.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:_e,methodName:No.RESOLVE_COMMENT_ANNOTATIONS,source:"internal",payload:{error:le,request:L}}),a||g(le),p(I)}}else c(),p({})}catch(z){c();let J=t||vt();this.coreActionsService.triggerAction(ct.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:J,methodName:No.RESOLVE_COMMENT_ANNOTATIONS,source:"internal",payload:{error:z,request:L}}),g(z)}})})}catch(r){this.loggingService.catch("Error in CommentAnnotationsResolverService resolveCommentAnnotations:",r);let a=t||vt();return this.coreActionsService.triggerAction(ct.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:No.RESOLVE_COMMENT_ANNOTATIONS,source:"internal",payload:{error:r,request:e}}),{}}})}saveCommentAnnotation(e,t){return Q(this,null,function*(){try{this.loggingService.log("%c[WB] Calling CommentAnnotationsResolverService FUNCTION: saveCommentAnnotation","color: green;");let r=this.getProvider();if(!this.commentAnnotationDataProviderAvailable())throw new Error("Comment annotation save data provider not available");let a=t||vt();this.coreActionsService.triggerAction(ct.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_SAVE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:a,methodName:No.SAVE_COMMENT_ANNOTATION,source:"internal",payload:{request:e}});let s=JSON.parse(JSON.stringify(this.commentAnnotationById$.getValue()));this.commentAnnotationById$._value=E(E({},s),e.commentAnnotation);let c=yield md(()=>r?.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 c&&c.statusCode!==200?(this.retrySaveConfig.revertOnFailure&&(this.commentAnnotationById$._value=s),this.loggingService.catch(c?.message??"Error in CommentAnnotationsResolverService saveCommentAnnotation:"),this.coreActionsService.triggerAction(ct.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:No.SAVE_COMMENT_ANNOTATION,source:"internal",payload:{error:c,request:e}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(Y.Events.Resolver.COMMENT_RESOLVER_SAVE,{sourceMethod:"saveCommentAnnotation",source:"sdk",commentAnnotationIds:Object.keys(e.commentAnnotation),eventType:e.eventType,commentId:e.commentId}),this.coreActionsService.triggerAction(ct.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_SAVE_RESULT,timestamp:new Date().getTime(),uniqueId:a,methodName:No.SAVE_COMMENT_ANNOTATION,source:"internal",payload:{result:{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0},request:e}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0})}catch(r){this.loggingService.warn("Error in CommentAnnotationsResolverService saveCommentAnnotation:",r);let a=t||vt();return this.coreActionsService.triggerAction(ct.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:No.SAVE_COMMENT_ANNOTATION,source:"internal",payload:{error:r,request:e}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0}}})}deleteCommentAnnotation(e,t,r){return Q(this,null,function*(){try{this.loggingService.log("%c[WB] Calling CommentAnnotationsResolverService FUNCTION: deleteCommentAnnotation","color: green;");let a=this.getProvider();if(!this.commentAnnotationDataProviderAvailable())throw new Error("Comment annotation delete data provider not available");let s=r||vt();this.coreActionsService.triggerAction(ct.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_DELETE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:s,methodName:No.DELETE_COMMENT_ANNOTATION,source:"internal",payload:{commentAnnotationId:e.toString(),metadata:t}});let c=this.commentAnnotationById$.getValue(),p=E({},c);delete p?.[e],this.commentAnnotationById$._value=p;let g=yield md(()=>a?.delete({commentAnnotationId:e.toString(),metadata:t,event:va.COMMENT_ANNOTATION_DELETE})||Promise.resolve(void 0),"deleteCommentAnnotation",this.retryDeleteConfig);return g&&g.statusCode!==200?(this.retryDeleteConfig.revertOnFailure&&(this.commentAnnotationById$._value=c),this.loggingService.catch(g?.message??"Error in CommentAnnotationsResolverService deleteCommentAnnotation:"),this.coreActionsService.triggerAction(ct.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:s,methodName:No.DELETE_COMMENT_ANNOTATION,source:"internal",payload:{error:g,commentAnnotationId:e.toString(),metadata:t}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(Y.Events.Resolver.COMMENT_RESOLVER_DELETE,{sourceMethod:"deleteCommentAnnotation",source:"sdk",commentAnnotationId:e.toString()}),this.coreActionsService.triggerAction(ct.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_DELETE_RESULT,timestamp:new Date().getTime(),uniqueId:s,methodName:No.DELETE_COMMENT_ANNOTATION,source:"internal",payload:{result:{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0},commentAnnotationId:e.toString(),metadata:t}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0})}catch(a){this.loggingService.warn("Error in CommentAnnotationsResolverService deleteCommentAnnotation:",a);let s=r||vt();return this.coreActionsService.triggerAction(ct.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:s,methodName:No.DELETE_COMMENT_ANNOTATION,source:"internal",payload:{error:a,commentAnnotationId:e.toString(),metadata:t}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0}}})}getCommentAnnotationsById$(){try{return this.commentAnnotationDataProviderAvailable()?(this.loggingService.log("%c[WB] Calling CommentAnnotationsResolverService FUNCTION: getCommentAnnotationsById$","color: green;"),this.commentAnnotationById$.asObservable()):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)(ee(ni),ee(y),ee(tt))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var vm=(()=>{let o=class o{constructor(e,t,r){this.coreActionsService=e,this.loggingService=t,this.analyticsService=r,this.resolveTimeout=60*1e3,this.retrySaveConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryDeleteConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryGetConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.reactionAnnotationDataProvider$=new ve(null),this.reactionAnnotationById$=new ve({}),this.getReactionAnnotationById=a=>{try{return this.reactionAnnotationDataProviderAvailable()?this.reactionAnnotationById$.value?.[a]:void 0}catch(s){this.loggingService.catch("Error in ReactionAnnotationsResolverService getReactionAnnotationById:",s);return}};try{this.loggingService.log("ReactionAnnotationsResolverService initialized"),this.reactionAnnotationDataProvider$.subscribe(a=>{a&&(a.config?.resolveTimeout&&(this.resolveTimeout=a.config.resolveTimeout),a.config?.saveRetryConfig&&(this.retrySaveConfig=a.config.saveRetryConfig),a.config?.deleteRetryConfig&&(this.retryDeleteConfig=a.config.deleteRetryConfig),a.config?.getRetryConfig&&(this.retryGetConfig=a.config.getRetryConfig))})}catch(a){this.loggingService.catch("Error in ReactionAnnotationsResolverService constructor:",a)}}getProvider(){try{let e=this.reactionAnnotationDataProvider$.getValue();return e||void 0}catch(e){this.loggingService.catch("Error in ReactionAnnotationsResolverService getProvider:",e);return}}ngOnDestroy(){try{this.reactionAnnotationById$.next({})}catch(e){this.loggingService.catch("Error in ReactionAnnotationsResolverService ngOnDestroy:",e)}}resolveReactionAnnotations(e,t){return Q(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling ReactionAnnotationsResolverService FUNCTION: resolveReactionAnnotations","color: green;"),!this.reactionAnnotationDataProviderAvailable())return{};let r,a=!1,s=!1,c=()=>{r&&(clearTimeout(r),r=void 0,s=!0)};return new Promise((p,g)=>{r=setTimeout(()=>{if(!s){a=!0,c();let z=t||vt();this.coreActionsService.triggerAction(ct.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:z,methodName:Ho.RESOLVE_REACTION_ANNOTATIONS,source:"internal",payload:{error:new Error("Reaction annotation resolution timeout"),request:e}}),g(new Error("Reaction annotation resolution timeout"))}},this.reactionAnnotationDataProvider$.value?.config?.resolveTimeout||this.resolveTimeout);let f=this.getProvider();if(!f)return c(),p({});let I={},T=[...new Set(e.reactionAnnotationIds||[])],L=D(E({},e),{reactionAnnotationIds:T});Q(this,null,function*(){try{if(T.length>0||e.documentIds?.length||e.folderId){let z=t||vt();this.coreActionsService.triggerAction(ct.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_RESOLUTION_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:z,methodName:Ho.RESOLVE_REACTION_ANNOTATIONS,source:"internal",payload:{request:L}});let J=md(()=>f?.get(L)||Promise.resolve(void 0),"getReactionAnnotations",this.retryGetConfig).then(le=>a?{}:(c(),le&&le.statusCode!==200?(this.coreActionsService.triggerAction(ct.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:z,methodName:Ho.RESOLVE_REACTION_ANNOTATIONS,source:"internal",payload:{result:le,request:L}}),this.loggingService.catch(le?.message??"Error in ReactionAnnotationsResolverService resolveReactionAnnotations:"),{}):le?.data)).catch(le=>{throw c(),le});try{I=(yield J)||{},this.analyticsService.trackEvent(Y.Events.Resolver.REACTION_RESOLVER_GET,{sourceMethod:"resolveReactionAnnotations",source:"sdk",reactionAnnotationIds:T});let le={};Object.entries(I).forEach(([_e,De])=>{let Be=this.reactionAnnotationById$.value?.[_e];Be?Be&&JSON.stringify(Be)!==JSON.stringify(De)&&(le[_e]=De):le[_e]=De}),Object.keys(le).length>0&&this.reactionAnnotationById$.next(E(E({},this.reactionAnnotationById$.getValue()),le)),this.coreActionsService.triggerAction(ct.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_RESOLUTION_RESULT,timestamp:new Date().getTime(),uniqueId:z,methodName:Ho.RESOLVE_REACTION_ANNOTATIONS,source:"internal",payload:{result:le,request:L}}),p(le)}catch(le){let _e=t||vt();this.coreActionsService.triggerAction(ct.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:_e,methodName:Ho.RESOLVE_REACTION_ANNOTATIONS,source:"internal",payload:{error:le,request:L}}),a||g(le),p(I)}}else c(),p({})}catch(z){c();let J=t||vt();this.coreActionsService.triggerAction(ct.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:J,methodName:Ho.RESOLVE_REACTION_ANNOTATIONS,source:"internal",payload:{error:z,request:L}}),g(z)}})})}catch(r){this.loggingService.catch("Error in ReactionAnnotationsResolverService resolveReactionAnnotations:",r);let a=t||vt();return this.coreActionsService.triggerAction(ct.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:Ho.RESOLVE_REACTION_ANNOTATIONS,source:"internal",payload:{error:r,request:e}}),{}}})}saveReactionAnnotation(e,t){return Q(this,null,function*(){try{this.loggingService.log("%c[WB] Calling ReactionAnnotationsResolverService FUNCTION: saveReactionAnnotation","color: green;");let r=this.getProvider();if(!this.reactionAnnotationDataProviderAvailable())throw new Error("Reaction annotation save data provider not available");let a=t||vt();this.coreActionsService.triggerAction(ct.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_SAVE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:a,methodName:Ho.SAVE_REACTION_ANNOTATION,source:"internal",payload:{request:e}});let s=JSON.parse(JSON.stringify(this.reactionAnnotationById$.getValue()));this.reactionAnnotationById$._value=E(E({},s),e);let c={reactionAnnotation:e,event:va.REACTION_ADD,metadata:Object.values(e??{})?.[0]?.metadata},p=yield md(()=>r?.save(c)||Promise.resolve(void 0),"saveReactionAnnotation",this.retrySaveConfig);return p&&p.statusCode!==200?(this.retrySaveConfig.revertOnFailure&&(this.reactionAnnotationById$._value=s),this.loggingService.catch(p?.message??"Error in ReactionAnnotationsResolverService saveReactionAnnotation:"),this.coreActionsService.triggerAction(ct.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:Ho.SAVE_REACTION_ANNOTATION,source:"internal",payload:{error:p,request:e}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(Y.Events.Resolver.REACTION_RESOLVER_SAVE,{sourceMethod:"saveReactionAnnotation",source:"sdk",reactionAnnotationIds:Object.keys(e),eventType:c.event}),this.coreActionsService.triggerAction(ct.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_SAVE_RESULT,timestamp:new Date().getTime(),uniqueId:a,methodName:Ho.SAVE_REACTION_ANNOTATION,source:"internal",payload:{result:{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0},request:e}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0})}catch(r){this.loggingService.warn("Error in ReactionAnnotationsResolverService saveReactionAnnotation:",r);let a=t||vt();return this.coreActionsService.triggerAction(ct.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:Ho.SAVE_REACTION_ANNOTATION,source:"internal",payload:{error:r,request:e}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0}}})}deleteReactionAnnotation(e,t,r){return Q(this,null,function*(){try{this.loggingService.log("%c[WB] Calling ReactionAnnotationsResolverService FUNCTION: deleteReactionAnnotation","color: green;");let a=this.getProvider();if(!this.reactionAnnotationDataProviderAvailable())throw new Error("Reaction annotation delete data provider not available");let s=r||vt();this.coreActionsService.triggerAction(ct.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_DELETE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:s,methodName:Ho.DELETE_REACTION_ANNOTATION,source:"internal",payload:{reactionAnnotationId:e.toString(),metadata:t}});let c=JSON.parse(JSON.stringify(this.reactionAnnotationById$.getValue())),p=E({},c);delete p?.[e],this.reactionAnnotationById$._value=p;let g=yield md(()=>a?.delete({reactionAnnotationId:e.toString(),metadata:t,event:va.REACTION_DELETE})||Promise.resolve(void 0),"deleteReactionAnnotation",this.retryDeleteConfig);return g&&g.statusCode!==200?(this.retryDeleteConfig.revertOnFailure&&(this.reactionAnnotationById$._value=c),this.loggingService.catch(g?.message??"Error in ReactionAnnotationsResolverService deleteReactionAnnotation:"),this.coreActionsService.triggerAction(ct.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:s,methodName:Ho.DELETE_REACTION_ANNOTATION,source:"internal",payload:{error:g,reactionAnnotationId:e.toString(),metadata:t}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(Y.Events.Resolver.REACTION_RESOLVER_DELETE,{sourceMethod:"deleteReactionAnnotation",source:"sdk",reactionAnnotationId:e.toString()}),this.coreActionsService.triggerAction(ct.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_DELETE_RESULT,timestamp:new Date().getTime(),uniqueId:s,methodName:Ho.DELETE_REACTION_ANNOTATION,source:"internal",payload:{result:{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0},reactionAnnotationId:e.toString(),metadata:t}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0})}catch(a){this.loggingService.warn("Error in ReactionAnnotationsResolverService deleteReactionAnnotation:",a);let s=r||vt();return this.coreActionsService.triggerAction(ct.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:s,methodName:Ho.DELETE_REACTION_ANNOTATION,source:"internal",payload:{error:a,reactionAnnotationId:e.toString(),metadata:t}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0}}})}getReactionAnnotationsById$(){try{return this.reactionAnnotationDataProviderAvailable()?(this.loggingService.log("%c[WB] Calling ReactionAnnotationsResolverService FUNCTION: getReactionAnnotationsById$","color: green;"),this.reactionAnnotationById$.asObservable()):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)(ee(ni),ee(y),ee(tt))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var rt=(()=>{let o=class o{constructor(e,t,r,a,s,c,p,g,f,I){this.analyticsService=e,this.authService=t,this.databaseService=r,this.domService=a,this.configService=s,this.loggingService=c,this.commentResolverService=p,this.reactionResolverService=g,this.coreActionsService=f,this.functions=I,this.documentPaths$=new ve(null),this.docContext$=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 nt,this.DEBOUNCE_TIME=5e3,this.MAX_QUEUE_SIZE=100,this.queueSize=0,this.isDocumentIdInDebounceQueue=!1,this.currentValidationToken=null,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(Ao(this.DEBOUNCE_TIME)).subscribe({next:T=>Q(this,null,function*(){try{yield this.setDocumentIdImpl(T.documentId,T.clientOrganizationId,T.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:T=>{this.loggingService.catch("Error in setDocumentId subscription:",T),this.queueSize--}}),this.databaseService.getDb().pipe(Fe(T=>!!T),ot(1)).subscribe(T=>{T&&(this.db=T)}),this.configService.getApiKey$().subscribe(T=>{if(this.apiKey=T,this.apiKey){if(!this.isCustomDocId){let L=Mk(window.location.href);this.currentUrl=L}this.analyticsService.updateDefaultProperties({apiKey:T})}}),this.authService.getUser$().subscribe(T=>Q(this,null,function*(){if(T&&(this.analyticsService.updateDefaultProperties({organizationId:T?.organizationId,clientOrganizationId:T?.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&&T?.organizationId&&this.documentPaths$.value?.organizationId!==T?.organizationId&&(yield this.setDocuments({documents:this.documentIds$.value.length?this.documentIds$.value.map(L=>({id:L.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),T?.organizationId&&T?.clientOrganizationId)){let L={organizationId:T?.organizationId,clientOrganizationId:T?.clientOrganizationId};this.getOrganizationConfig()||this.organizationConfig$.next({organizationId:T?.organizationId,clientOrganizationId:T?.clientOrganizationId}),yield this.updateOrganizationMetadata(L)}})),this.documentPaths$.subscribe(T=>{let L={documentId:T?.documentId,clientDocumentId:T?.clientDocumentId,folderId:T?.folderId,allDocuments:T?.allDocuments,veltFolderId:T?.veltFolderId};T?.organizationId&&(L.organizationId=T.organizationId,L.clientOrganizationId=T.clientOrganizationId),this.analyticsService.updateDefaultProperties(L),this.domService.resetSelectedAnnotationsMap()}),this.location$.subscribe(T=>{this.analyticsService.updateDefaultProperties({clientLocation:T?.location,locationId:T?.locationId})}),this.organizationMetadata$.subscribe(T=>{this.authService.setUserOrganization(T?.[this.documentPaths$.value?.organizationId])}),this.documentPaths$.pipe(Fe(T=>!!T),ot(1)).subscribe(()=>{try{this.subscribeToCustomerMetadata()}catch(T){this.loggingService.catch("Error in DocService subscribeToCustomerMetadata:",T)}},T=>{this.loggingService.catch("Error in DocService subscribeToCustomerMetadata:",T)}),this.loggingService.log("%c[WB] Creating CLASS: DocService 2","color: blue;"),this.onWindowPopstate(),this.onWindowClick()}catch(T){this.loggingService.catch("Error in DocService constructor:",T)}}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)}}setUserPermissionService(e){try{this.userPermissionService=e}catch(t){this.loggingService.catch("Error in setUserPermissionService:",t)}}setCommentService(e){try{this.commentService=e}catch(t){this.loggingService.catch("Error in setCommentService:",t)}}onWindowPopstate(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowPopstate","color: green;");try{this.domService.onWindowPopState$().subscribe(()=>{this.loggingService.log("location",location.href);let e=Mk(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=Mk(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(Y.Events.Core.SET_DOCUMENTS_TRIGGERED,{payload:{id:e,documentMetadata:t,methodName:"setDocument",source:a}}),this.coreActionsService.triggerAction(ct.INIT_UPDATE,{event:Y.Events.Core.SET_DOCUMENTS_TRIGGERED,methodName:Fa.SET_DOCUMENTS,source:a,payload:{documentId:e,documentMetadata:t,options:r}}),yield this.setDocumentsImpl({documents:[{id:e,metadata:t}],options:E({organizationId:t?.organizationId},r??{}),source:a})}catch(c){this.loggingService.catch("Error in DocService setDocument:",c)}})}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(g=>g.clientDocumentId),c=QH(this.getOptionsFromDocumentPaths()??{})??{};return!e.every(g=>s.includes(g.id))||!ui(c,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,c=`${Nn(s)}`;t&&a?.metadata&&typeof a.metadata=="object"&&(this.clientDocumentMetadataMap[s]=a.metadata),r.push({documentId:c,clientDocumentId:s})}),r}catch(r){return this.loggingService.catch("Error in DocService getDocumentIdsFromDocuments:",r),[]}}setDocuments(s){return Q(this,arguments,function*({documents:e,options:t,source:r="internal",skipPermissionValidation:a=!1}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocuments","color: green;"),r==="internal"&&this.analyticsService.trackEvent(Y.Events.Core.SET_DOCUMENTS_TRIGGERED,{payload:{documents:e,options:t,methodName:"setDocuments",source:r}}),this.coreActionsService.triggerAction(ct.INIT_UPDATE,{event:Y.Events.Core.SET_DOCUMENTS_TRIGGERED,methodName:Fa.SET_DOCUMENTS,source:r,payload:{documents:e,options:t}}),yield this.setDocumentsImpl({documents:e,options:t??{},source:r,skipPermissionValidation:a})}catch(c){this.loggingService.catch("Error in DocService setDocuments:",c)}})}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(ct.INIT_UPDATE,{event:Y.Events.Core.SET_ROOT_DOCUMENT_TRIGGERED,methodName:Fa.SET_ROOT_DOCUMENT,source:t,payload:{document:e}});let a=this.getOptionsFromDocumentPaths()??{},s=this.documentIds$.value.map(c=>c.clientDocumentId);if(!s.includes(e.id)){let c=[...s.map(g=>({id:g})),{id:e.id}],p=this.getDocumentIdsFromDocuments({documents:c,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)}})}setDocContext(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocContext","color: green;");let t=JSON.parse(JSON.stringify(e??null));this.docContext$.next(t)}catch(t){this.loggingService.catch("Error in setDocContext: ",t)}}getDocContext(){return this.docContext$.getValue()}getDocContext$(){return this.docContext$.asObservable().pipe(_t(Xt))}getProcessedDocContext(){return oce(this.getDocContext())}filterRelevantDocuments(a){return Q(this,arguments,function*({options:e,documentIds:t,skipPermissionValidation:r=!1}){try{let s=this.authService.getUser();return!s||!this.commonDbService?.shouldUseFirestore()||(t=yield this.fetchDocumentsFromFolder(e,t,s),yield this.handlePermissionProvider(e,t,s),t=yield this.filterDocumentsByPermissions(e,t,s,r),t=t.slice(0,50)),t}catch(s){return this.loggingService.catch("Error in DocService filterRelevantDocuments:",s),t}})}fetchDocumentsFromFolder(e,t,r){return Q(this,null,function*(){if(!e?.folderId||!e?.allDocuments)return t;try{let a=Xi(this.functions,Qi({url:wn?.cloudFunction?.sdkProxy,apiProxyDomain:this.configService?.getApiProxyDomain()}));(yield pd({methodName:"getDocuments",data:{type:"getDocuments",metadata:{organizationId:e?.organizationId??r?.clientOrganizationId,folderId:e?.folderId}},getSdkProxy:a,userId:r?.userId??""}))?.data?.forEach(c=>{t.find(p=>p.clientDocumentId===c.id)||t.push({documentId:Tr(c.id),clientDocumentId:c.id})})}catch(a){this.loggingService.warn("Error in DocService fetchDocumentsFromFolder:",a)}return t})}buildPermissionRequests(e,t,r){try{let a=[];return e.organizationId&&e.organizationId!==r.clientOrganizationId&&a.push({userId:r.userId,resource:{id:e.organizationId,type:Fo.ORGANIZATION,source:Hi.SET_DOCUMENTS,organizationId:e.organizationId}}),e.folderId&&a.push({userId:r.userId,resource:{id:e.folderId,type:Fo.FOLDER,source:Hi.SET_DOCUMENTS,organizationId:e?.organizationId??r?.clientOrganizationId??""}}),t&&t.forEach(s=>{a.push({userId:r.userId,resource:{id:s.clientDocumentId,type:Fo.DOCUMENT,source:Hi.SET_DOCUMENTS,organizationId:e?.organizationId??r?.clientOrganizationId??""}})}),e?.context&&this.userPermissionService?.getIsContextEnabled()&&rce({input:e?.context}).forEach(c=>{let p=JSON.stringify(c.access);a.push({userId:r.userId,resource:{id:p,type:Fo.CONTEXT,source:Hi.SET_DOCUMENTS,organizationId:e?.organizationId??r?.clientOrganizationId??"",context:c}})}),a}catch(a){return this.loggingService.catch("Error in buildPermissionRequests:",a),[]}}processAccessibleContexts(e,t){try{if(!e?.success||!e?.data?.length||!this.userPermissionService?.getIsContextEnabled())return;let r=e.data.filter(a=>a.type===Fo.CONTEXT&&a.hasAccess).map(a=>a.resourceId);if(this.loggingService.logContext("[CONTEXT] processAccessibleContexts called with accessibleContextIds:",JSON.parse(JSON.stringify(r??"nil"))),r?.length){let a=t.filter(c=>r.includes(c.resource.id)).map(c=>c.resource.context).filter(c=>!!c),s=ace({input:a});this.loggingService.logContext("[CONTEXT] processAccessibleContexts called with accessibleContext:",JSON.parse(JSON.stringify(s??"nil"))),s?.access&&(this.loggingService.logContext("[CONTEXT] setting accessibleContext in docContext:",JSON.parse(JSON.stringify(s??"nil"))),this.setDocContext(s))}}catch(r){this.loggingService.catch("Error in processAccessibleContexts:",r)}}handlePermissionProvider(e,t,r){return Q(this,null,function*(){if(this.userPermissionService?.isPermissionProviderAvailable())try{this.loggingService.logContext("[CONTEXT] handlePermissionProvider called with options:",JSON.parse(JSON.stringify(e??"nil")),"documentIds:",JSON.parse(JSON.stringify(t??"nil")),"user:",JSON.parse(JSON.stringify(r??"nil")));let a=this.buildPermissionRequests(e,t,r),s=vt();this.coreActionsService.triggerAction(ct.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.RESOURCE_ACCESS_REQUEST_FORMED,methodName:Hi.SET_DOCUMENTS,uniqueId:s,timestamp:new Date().getTime(),source:"internal",payload:{requests:a}});let c=yield this.userPermissionService?.onResourceAccessRequired({requests:a,uniqueId:s,methodName:Hi.SET_DOCUMENTS,fromCache:!1});this.loggingService.logContext("[CONTEXT] handlePermissionProvider called with res:",JSON.parse(JSON.stringify(c??"nil")),"requests:",JSON.parse(JSON.stringify(a??"nil"))),this.processAccessibleContexts(c,a)}catch(a){this.loggingService.catch("Error in handlePermissionProvider:",a)}})}filterDocumentsByPermissions(e,t,r,a=!1){return Q(this,null,function*(){if(a)return t;this.loggingService.logContext("[CONTEXT] filterDocumentsByPermissions called with options:",JSON.parse(JSON.stringify(e??"nil")),"documentIds:",JSON.parse(JSON.stringify(t??"nil")),"user:",JSON.parse(JSON.stringify(r??"nil")));let s=this.currentValidationToken,c=[...t];return s&&this.validatePermissionsInBackground(e,t,r,s),c})}validatePermissionsInBackground(e,t,r,a){let s=e?.organizationId??r?.clientOrganizationId;this.userPermissionService?.getUserPermissions({organizationId:s,documentIds:t.map(c=>c.clientDocumentId),folderIds:e?.folderId?[e?.folderId]:[]}).then(c=>{if(this.currentValidationToken===a&&c){this.userPermissionService?.setCurrentUserPermissions(c);let p=[];Object.entries(c?.[r.userId]?.documents??{}).forEach(([g,f])=>{f?.errorCode===Lo.PERMISSION_DENIED&&p.push(g)}),s&&c?.[r.userId]?.organization?.[s]?.errorCode===Lo.PERMISSION_DENIED&&this.loggingService.catch(`User does not have access to organization: ${s}`,void 0,void 0,!0),e?.folderId&&c?.[r.userId]?.folders?.[e?.folderId]?.errorCode===Lo.PERMISSION_DENIED&&this.loggingService.catch(`User does not have access to folder: ${e?.folderId}`,void 0,void 0,!0),p.length>0&&(this.loggingService.catch(`User does not have access to documents: ${p.join(", ")}`,void 0,void 0,!0),this.handleDeniedDocumentAccess(p,r,a))}}).catch(c=>{this.loggingService.catch("Error in background permission validation:",c)})}handleDeniedDocumentAccess(e,t,r){try{if(this.currentValidationToken!==r)return;let a=this.documentPaths$.value;this.coreActionsService.triggerAction(ct.ERROR,{event:Y.Events.Core.SDK_ERROR,sourceMethod:"handleDeniedDocumentAccess",message:"Access denied to document after optimistic load",documentIds:e,userId:t.userId,timestamp:new Date().getTime()});let s=this.documentIds$.value||[],c=s.filter(p=>!e.includes(p.clientDocumentId));c.length!==s.length&&(c.length>0?this.setDocuments({documents:c.map(p=>({id:p.clientDocumentId})),options:{organizationId:a?.clientOrganizationId},source:"internal",skipPermissionValidation:!0}):(this.loggingService.catch("Error in DocService handleDeniedDocumentAccess: Documents provided are all denied"),this.coreActionsService.triggerAction(ct.ERROR,{event:Y.Events.Core.SDK_ERROR,sourceMethod:"handleDeniedDocumentAccess",message:"All documents provided are denied",documentIds:e,userId:t.userId,timestamp:new Date().getTime()}),this.unsetDocuments({source:"internal"})))}catch(a){this.loggingService.catch("Error in handleDeniedDocumentAccess:",a)}}addUserInfoToOrganization(r){return Q(this,arguments,function*({organizationId:e,user:t}){try{let a=Xi(this.functions,Qi({url:wn?.cloudFunction?.sdkProxy,apiProxyDomain:this.configService?.getApiProxyDomain()}));yield pd({data:{type:"addUserInfoToOrganization",metadata:{organizationId:e},user:t},getSdkProxy:a,userId:t?.userId??""})}catch(a){this.loggingService.warn("Error in DocService addUserInfoToOrganization:",a)}})}setDocumentsImpl(s){return Q(this,arguments,function*({documents:e,options:t,source:r,skipPermissionValidation:a=!1}){try{this.loggingService.logContext("[CONTEXT] setDocumentsImpl called with documents:",JSON.parse(JSON.stringify(e??"nil")),"options:",JSON.parse(JSON.stringify(t??"nil")));let c=t?.organizationId??this.documentPaths$.value?.clientOrganizationId;if(!this.shouldSetDocumentsAgain(e,QH(D(E({},t),{organizationId:c})))){r==="external"&&this.loggingService.catch("setDocuments called with previous request");return}let p=vt();this.currentValidationToken=p;let g=this.getDocumentIdsFromDocuments({documents:e,setClientDocumentMetadataMap:!0});if(g?.length===0){this.loggingService.warn("Minimum one document must be set in setDocuments");return}let f=this.authService.getUser();if(!f){this.draftDocuments=e,this.draftOptions=t;return}this.documentPaths$.value?.organizationId&&t?.organizationId&&this.documentPaths$.value?.organizationId!==t?.organizationId?this.authService.resetServicesCache():this.unsetDocuments({source:"internal",unsetDocumentPaths:!1});let I=t?.organizationId??f?.clientOrganizationId;if(I&&this.addUserInfoToOrganization({organizationId:I,user:f}),g=yield this.filterRelevantDocuments({options:t,documentIds:g,skipPermissionValidation:a}),this.documentIds$.next(g),g?.length){let T=g[0]?.clientDocumentId;t?.rootDocumentId&&g.find(L=>L.clientDocumentId===t?.rootDocumentId)&&(T=t?.rootDocumentId),yield this.debounceSetDocuments({documentId:T,clientOrganizationId:t?.organizationId,options:t})}return}catch(c){this.loggingService.catch("Error in DocService setDocumentsImpl:",c)}})}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(Y.Events.Core.SET_DOCUMENTS_TRIGGERED,{payload:{id:e,clientOrganizationId:t,methodName:"setDocumentId",source:r}}),this.coreActionsService.triggerAction(ct.INIT_UPDATE,{event:Y.Events.Core.SET_DOCUMENTS_TRIGGERED,methodName:Fa.SET_DOCUMENT_ID,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(),c=s-this.lastSetDocumentIdCallTime,p=s-this.lastSetDocumentIdExecutionTime;if(this.lastSetDocumentIdCallTime=s,this.queueSize>=this.MAX_QUEUE_SIZE){this.loggingService.warn("SetDocumentId queue size exceeded limit");return}if(!this.documentPaths$.value&&!this.isDocumentIdInDebounceQueue||c>this.DEBOUNCE_TIME&&p>this.DEBOUNCE_TIME){yield this.setDocumentIdImpl(e,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 c=`${Nn(e)}`,p=r?.folderId,g=r?.folderId?$i(r?.folderId):void 0,f=r?.locationId,I=r?.allDocuments,T=a?.organizationId?t?Tt(t):a?.organizationId:void 0,L=vt();this.coreActionsService.triggerAction(ct.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:L,methodName:No.INIT_DOCUMENTS,source:"internal",payload:{documentIds:this.documentIds$.value.map(z=>z.clientDocumentId),organizationId:t??a?.clientOrganizationId??""}});let G=vt();if(this.coreActionsService.triggerAction(ct.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:G,methodName:Ho.INIT_DOCUMENTS,source:"internal",payload:{documentIds:this.documentIds$.value.map(z=>z.clientDocumentId),organizationId:t??a?.clientOrganizationId??""}}),yield Promise.allSettled([this.commentResolverService.resolveCommentAnnotations({documentIds:this.documentIds$.value.map(z=>z.clientDocumentId),organizationId:t??a?.clientOrganizationId??""},L),this.reactionResolverService.resolveReactionAnnotations({documentIds:this.documentIds$.value.map(z=>z.clientDocumentId),organizationId:t??a?.clientOrganizationId??""},G)]),this.currentDocumentId!==c||this.documentPaths$.value?.organizationId!==T){this.loggingService.log("setting new docid"),this.currentDocumentId=c;let z=new KR,J=new m9;z.clientDocumentId=e,J.clientDocumentId=e,z.folderId=p,J.folderId=p,z.locationId=f,J.locationId=f,z.allDocuments=I,J.allDocuments=I,z.veltFolderId=g,J.veltFolderId=g,z.documentId=c,J.documentId=c,T&&(z.organizationId=T,z.clientOrganizationId=t??a?.clientOrganizationId,J.organizationId=T,J.clientOrganizationId=t??a?.clientOrganizationId);let le=`${this.apiKey}`,_e=`apiKey/${this.apiKey}`;T&&(le=`${le}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${z.organizationId}`,_e=`${_e}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${z.organizationId}`),J.organization=`apiKey/${this.apiKey}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}`,J.document=`${_e}/${U.FIREBASE_PARTIAL_PATH_DOCS}`,z.presence=`${le}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_PRESENCE}/`,z.cursor=`${le}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_CURSOR}/`,z.comment=`${le}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_COMMENT}/`,J.comment=`${_e}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_COMMENT}`,z.multiThread=`${le}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_MULTI_THREAD}/`,J.multiThread=`${_e}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_MULTI_THREAD}`,z.tag=`${le}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_TAG}/`,z.area=`${le}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_AREA}/`,J.area=`${_e}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_AREA}`,z.arrow=`${le}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_ARROW}/`,z.selection=`${le}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_SELECTION}/`,z.audioHuddle=`${le}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_AUDIO_HUDDLE}/`,z.huddle=`${le}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_HUDDLE}/`,z.recorder=`${le}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_RECORDER}/`,J.recorder=`${_e}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_RECORDER}`,z.flock=`${le}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_FOLLOW_ALONG}/`,z.syncVideoPlayer=`${le}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_SYNC_VIDEO_PLAYER}/`,z.liveState=`${le}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_LIVE_STATE}/`,z.liveStateSingleEditorMode=`${le}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_LIVE_STATE}/default/singleEditorMode`,z.reaction=`${le}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_REACTION}/`,J.reaction=`${_e}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_REACTION}`,z.crdt=`${le}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_CRDT}/`,J.crdt=`${_e}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_CRDT}`,z.customerMetadata=`${this.apiKey}/${U.FIREBASE_PARTIAL_PATH_CUSTOMER_METADATA}/`,z.views=`${le}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_VIEWS}/`,J.notificationViews=`${_e}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_NOTIFICATION_VIEWS}`,J.documentViews=`${_e}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_DOCUMENT_VIEWS}`,J.locationViews=`${_e}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_LOCATION_VIEWS}`,z.notifications=`${le}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_NOTIFICATIONS}/`,z.metadata=`${le}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_METADATA}/`,z.users=`${le}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_USERS}/`,z.documentIam=`${le}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_IAM}/`,z.workspaceIam=`${this.apiKey}/${U.FIREBASE_PARTIAL_PATH_IAM}/`,z.groupContacts=`${le}/${U.FIREBASE_PARTIAL_PATH_CONTACTS}/${U.FIREBASE_PARTIAL_PATH_GROUPS}/`,z.globalContacts=`${le}/${U.FIREBASE_PARTIAL_PATH_CONTACTS}/${U.FIREBASE_PARTIAL_PATH_GLOBAL}/`,z.logins=`${le}/${U.FIREBASE_PARTIAL_PATH_CONTACTS}/${U.FIREBASE_PARTIAL_PATH_LOGINS}/`,z.userFeedback=`${le}/${U.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${U.FIREBASE_PARTIAL_PATH_FEEDBACK}/`,z.userReportBugs=`${le}/${U.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${U.FIREBASE_PARTIAL_PATH_BUGS}/`,z.userContactUs=`${le}/${U.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${U.FIREBASE_PARTIAL_PATH_CONTACT_US}/`,T&&(z.organizationMetadata=`${le}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATION_METADATA}/`,z.organizationIam=`${le}/${U.FIREBASE_PARTIAL_PATH_IAM}/`,z.organizationGroups=`${le}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATION_GROUPS}/`,z.organizationNotifications=`${le}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/`,c&&(z.organizationNotificationsWithDocumentId=`${le}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/`,z.heartbeatByDocument=`${le}/${U.FIREBASE_PARTIAL_PATH_HEARTBEAT_BY_DOCUMENT}/${c}/`),z.organizationNotificationsLastNotificationTimestamp=`${le}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${U.FIREBASE_PARTIAL_PATH_LAST_NOTIFICATION_TIMESTAMP}/${U.FIREBASE_PARTIAL_PATH_DOCS}/`,z.organizationNotificationsUsers=`${le}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${U.FIREBASE_PARTIAL_PATH_USERS}/`,z.heartbeat=`${le}/${U.FIREBASE_PARTIAL_PATH_HEARTBEAT}/`),J.organizationUsers=`${_e}/${U.FIREBASE_PARTIAL_PATH_ORGANIZATION_USERS}`,J.users=`${_e}/${U.FIREBASE_PARTIAL_PATH_CENTRAL_USERS}`,J.documentUsers=`${_e}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${U.FIREBASE_PARTIAL_PATH_DOCUMENT_USERS}`,J.notificationDocs=`${_e}/${U.FIREBASE_PARTIAL_PATH_NOTIFICATION_DOCS}`,J.notificationUsers=`${_e}/${U.FIREBASE_PARTIAL_PATH_NOTIFICATION_USERS}`,this.documentPaths$.next(z),this.firestorePaths$.next(J),z?.clientOrganizationId&&z?.organizationId&&!(z?.clientOrganizationId===this.getOrganizationConfig()?.clientOrganizationId&&z?.organizationId===this.getOrganizationConfig()?.organizationId)&&this.organizationConfig$.next({organizationId:z?.organizationId,clientOrganizationId:z?.clientOrganizationId}),Promise.allSettled([this.updateFolderMetadata(),this.updateDocumentMetadata(),this.fetchLocationMetadata(),this.updateOrganizationMetadata()]),s&&this.location$.value&&this.removeLocation({}),this.coreActionsService.triggerAction(ct.INIT_UPDATE,{event:Y.Events.Doc.SET_DOCUMENTS_SUCCESS,payload:{documentId:c,clientDocumentId:e}}),this.analyticsService.trackEvent(Y.Events.Doc.SET_DOCUMENTS_SUCCESS,{documentId:c,clientDocumentId:e},!0,this.getUserIdForAnalytics())}}else this.loggingService.catch("Error in setDocumentIdImpl: API key is not provided.")}catch(a){this.loggingService.catch("Error in setDocumentIdImpl: ",a)}})}unsetDocumentId({source:e,unsetDocumentPaths:t}){this.loggingService.log("%c[WB] Calling FUNCTION: unsetDocumentId","color: green;");try{e==="internal"&&this.analyticsService.trackEvent(Y.Events.Core.UNSET_DOCUMENTS_TRIGGERED,{payload:{methodName:"unsetDocumentId",source:e}}),this.coreActionsService.triggerAction(ct.INIT_UPDATE,{event:Y.Events.Doc.UNSET_DOCUMENTS_TRIGGERED,methodName:Fa.UNSET_DOCUMENT_ID,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),this.userPermissionService?.revokeAccessOnDocumentUnset(),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(ct.INIT_UPDATE,{event:Y.Events.Doc.UNSET_DOCUMENTS_SUCCESS,source:e}),this.analyticsService.trackEvent(Y.Events.Doc.UNSET_DOCUMENTS_SUCCESS,{documentId:this.currentDocumentId,documentMetadata:this.documentMetadata$.value?.[this.currentDocumentId??""],message:e==="external"?"User unset document id":"System unset document id",source:e},!0,this.getUserIdForAnalytics())}catch(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(Y.Events.Core.UNSET_DOCUMENTS_TRIGGERED,{payload:{methodName:"unsetDocuments",source:e}}),this.coreActionsService.triggerAction(ct.INIT_UPDATE,{event:Y.Events.Doc.UNSET_DOCUMENTS_TRIGGERED,source:e,methodName:Fa.UNSET_DOCUMENTS}),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(e){return Q(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: fetchOrganizationMetadata","color: green;");try{if(!e&&this.getOrganizationConfig()&&(e=this.getOrganizationConfig()),this.db&&e?.organizationId){let t=e?.organizationId;yield this.commonDbService?.getData({feature:"organizationMetadata",properties:{apiKey:this.apiKey??"",organizationId:t,field:"metadata"}}).then(r=>{r&&!r?.errorCode&&this.organizationMetadata$.next(D(E({},this.organizationMetadata$.value),{[t]:r}))}).catch(r=>{this.loggingService.catch("Error in fetchOrganizationMetadata: ",r)})}}catch(t){this.loggingService.catch("Error in fetchOrganizationMetadata: ",t)}})}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=[],c={organizationId:t?.clientOrganizationId,folderId:a},p=[],g=20;for(let I=0;I<e.length;I+=g)p.push(e.slice(I,I+g));p.forEach(I=>{let T=JSON.parse(JSON.stringify(c));T.documentIds=I.map(L=>L.clientDocumentId),s.push(this.fetchDocuments(T))});let f={};s.length>0&&(yield Promise.all(s).then(I=>{I?.forEach(T=>{T?.forEach(L=>{L?.metadata?.documentId&&(f[L.metadata.documentId]=L.metadata)})}),this.setAllDocumentMetadata(E(E({},this.documentMetadata$.value),f))}).catch(I=>{this.loggingService.catch("Error in fetchDocumentMetadata: ",I)}))}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.setDocumentMetadata(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=[],c={organizationId:e?.clientOrganizationId,folderId:r,allDocuments:a},p=[],g=20;for(let I=0;I<t.length;I+=g)p.push(t.slice(I,I+g));p.forEach(I=>{let T=JSON.parse(JSON.stringify(c));T.documentIds=I.map(L=>L.clientDocumentId),s.push(this.fetchLocations(T))});let f=this.locationMetadata$.value??{};s.length>0&&Promise.all(s).then(I=>{I?.forEach(T=>{T?.forEach(L=>{L?.metadata?.documentId&&(f[L.metadata.documentId]=D(E({},f?.[L.metadata.documentId]??{}),{[L.location.id]:L}))})}),Object.keys(f||{}).length>0&&this.locationMetadata$.next(f)}).catch(I=>{this.loggingService.catch("Error in fetchLocationMetadata: ",I)})}}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(zn(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`${Nn(e)}`}catch(t){return this.loggingService.catch("Error in generateDocumentId: ",t),""}}generateOrganizationId(e){try{return`${Tt(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(Y.Events.Core.SET_LOCATIONS_TRIGGERED,{payload:{locations:[e],options:void 0,methodName:"setLocation",source:t}}),this.coreActionsService.triggerAction(ct.INIT_UPDATE,{event:Y.Events.Core.SET_LOCATIONS_TRIGGERED,source:t,methodName:Fa.SET_LOCATION,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(Y.Events.Core.SET_LOCATIONS_TRIGGERED,{payload:{locations:e,options:t,methodName:"setLocations",source:r}}),this.coreActionsService.triggerAction(ct.INIT_UPDATE,{event:Y.Events.Core.SET_LOCATIONS_TRIGGERED,methodName:Fa.SET_LOCATIONS,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(Y.Events.Core.SET_ROOT_LOCATION_TRIGGERED,{payload:{location:e,methodName:"setRootLocation",source:t}}),this.coreActionsService.triggerAction(ct.INIT_UPDATE,{event:Y.Events.Core.SET_ROOT_LOCATION_TRIGGERED,methodName:Fa.SET_ROOT_LOCATION,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=D(E(E({},this.draftLocationMap.options??{}),t??{}),{rootLocationId:e[0].id})),this.draftLocationMap.locations=[...this.draftLocationMap.locations,...e],this.draftLocationMap.options=E(E({},this.draftLocationMap.options),t);return}let a=this.getValidLocations(e),s=[],c=[];this.location$.value?.location.id&&c.push(this.location$.value?.location.id),c=[...c,...Object.values(this.locations$.value).map(f=>f.location.id)].filter(f=>f!==void 0);let p;if(t?.rootLocationId&&t?.rootLocationId!==this.location$.value?.location.id&&(p=a.find(f=>f.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 f=or(p),I=Nn(JSON.stringify(f));f.id&&s.push({locationId:I,location:f}),this.location$.next({locationId:I,location:f})}}else{p||(p=a[0]);let f=or(p),I=Nn(JSON.stringify(f));f.id&&s.push({locationId:I,location:f}),this.location$.next({locationId:I,location:f})}let g=[];return a.slice(t?.appendLocation?0:1).forEach(f=>{if(f.id!==this.location$.value?.location.id){let I=E({},f),T=this.locations$.value;f?.id&&Object.keys(T).forEach(J=>{let le=T[J];le.location?.id===f.id&&(I=E(E({},le.location),f),delete T?.[J])});let L=this.genarateLocationId(I),G={locationId:L,location:I};I.id&&s.push({locationId:L,location:I}),g.push(G);let z=D(E({},T),{[L]:G});this.locations$.next(z)}}),this.updateDocumentLocationMetadata(s),this.coreActionsService.triggerAction(ct.INIT_UPDATE,{event:Y.Events.Doc.SET_LOCATIONS_SUCCESS,methodName:Fa.SET_LOCATIONS,payload:{locations:a,options:t}}),this.analyticsService.trackEvent(Y.Events.Doc.SET_LOCATIONS_SUCCESS,{locations:a,options:t},!0,this.getUserIdForAnalytics()),g}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(Y.Events.Core.SET_LOCATIONS_TRIGGERED,{payload:{locations:[e],options:{appendLocation:!0},methodName:"addLocation",source:t}}),this.coreActionsService.triggerAction(ct.INIT_UPDATE,{event:Y.Events.Core.SET_LOCATIONS_TRIGGERED,methodName:Fa.ADD_LOCATION,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(Y.Events.Core.REMOVE_LOCATIONS_TRIGGERED,{payload:{locations:[e],methodName:"removeLocation",source:t}}),this.coreActionsService.triggerAction(ct.INIT_UPDATE,{event:Y.Events.Core.REMOVE_LOCATIONS_TRIGGERED,source:t,methodName:Fa.REMOVE_LOCATION,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(Y.Events.Core.REMOVE_LOCATIONS_TRIGGERED,{payload:{locations:e,methodName:"removeLocations",source:t}}),this.coreActionsService.triggerAction(ct.INIT_UPDATE,{event:Y.Events.Core.REMOVE_LOCATIONS_TRIGGERED,methodName:Fa.REMOVE_LOCATIONS,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(Y.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(Y.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(ct.INIT_UPDATE,{event:Y.Events.Core.UNSET_LOCATIONS_TRIGGERED,methodName:Fa.UNSET_LOCATION_IDS,source:t,payload:{locationIds:e}}),t==="internal"&&this.analyticsService.trackEvent(Y.Events.Core.UNSET_LOCATIONS_TRIGGERED,{payload:{locationIds:e},methodName:"unsetLocationIds",message:"System unset location ids",source:t},!0,this.getUserIdForAnalytics()),e?.length?e.forEach(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.coreActionsService.triggerAction(ct.INIT_UPDATE,{event:Y.Events.Doc.REMOVE_LOCATIONS_SUCCESS,methodName:Fa.REMOVE_LOCATIONS_SUCCESS,source:t,payload:{locationIds:e}}),this.analyticsService.trackEvent(Y.Events.Doc.REMOVE_LOCATIONS_SUCCESS,{payload:{locationIds:e},source:t},!0,this.getUserIdForAnalytics())}catch(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(e){return Q(this,null,function*(){try{!e&&this.getOrganizationConfig()&&(e=this.getOrganizationConfig());let t=e?.organizationId,r=this.documentPaths$.value;if(this.db&&t&&r?.documentId){if(this.organizationMetadata$.value?.[t])return;let s=new a9;s.apiKey=this.configService?.getApiKey()??"",s.organizationId=t,s.clientOrganizationId=e?.clientOrganizationId,this.userPermissionService?.hasEditAccess({organizationId:t})&&(yield this.commonDbService?.updateData({feature:"organizationMetadata",data:JSON.parse(JSON.stringify(s)),properties:{organizationId:t,documentId:r?.documentId??""}})),yield this.fetchOrganizationMetadata(e)}}catch(t){this.loggingService.catch("Error in updateOrganizationMetadata: ",t)}})}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,clientOrganizationId:e?.clientOrganizationId,parentFolderId:"root"};if(this.userPermissionService?.hasEditAccess({folderId:this.documentPaths$.value?.veltFolderId??""})){let a=Xi(this.functions,Qi({url:wn?.cloudFunction?.sdkProxy,apiProxyDomain:this.configService?.getApiProxyDomain()}));yield pd({methodName:"createFolder",data:{type:"createFolder",metadata:r},getSdkProxy:a,userId:this.authService.getUser()?.userId??""})}}}}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 YR;this.clientDocumentMetadata&&(this.clientDocumentMetadata?.clientDocumentId===e.clientDocumentId&&this.clientDocumentMetadata?.documentMetadata&&(s=E(E({},this.clientDocumentMetadata.documentMetadata),s)),this.clientDocumentMetadata=void 0),this.clientDocumentMetadataMap?.[a.clientDocumentId]&&(s=E(E({},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=ki();let c=e?.folderId,p=e?.veltFolderId;s?.pageInfo?.deviceInfo&&delete s?.pageInfo?.deviceInfo;let g=!0,f=this.documentMetadata$.value?.[a.documentId];if(c&&p){let I=this.getDocumentMetadata(a?.documentId??"")??(yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:a?.documentId??"",organizationId:e?.organizationId??"",field:"metadata"}}));I?.clientDocumentId&&!I?.errorCode?I?.folderId&&(I?.folderId!==c||I?.veltFolderId!==p)?(this.loggingService.catch(`Folder id mismatch for document ${a?.clientDocumentId??""}`),g=!1):I?.folderId===c?(c&&(s.folderId=c),p&&(s.veltFolderId=p)):(this.loggingService.catch(`Document ${a?.clientDocumentId??""} is not in the folder ${c??""}`),g=!1):(c&&(s.folderId=c),p&&(s.veltFolderId=p))}if(f){let I={};Object.entries(s).forEach(([T,L])=>{I[T]=L}),ui(I,f)&&(g=!1)}g&&this.userPermissionService?.hasEditAccess({documentId:a?.documentId??"",folderId:e?.allDocuments&&e?.veltFolderId?e?.veltFolderId:void 0})&&(yield this.commonDbService?.updateData({feature:"documentMetadata",data:JSON.parse(JSON.stringify(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"}});s?.errorCode&&(s={});let c=[];for(let p of e){let g=new JR;g.locationId=p?.locationId,g.veltLocationId=YH(p?.location?.id??""),g.location=p?.location,g.pageInfo=ki(),g?.pageInfo?.deviceInfo&&delete g?.pageInfo?.deviceInfo;let f=D(E({},s),{[U.FIREBASE_PARTIAL_PATH_LOCATIONS]:D(E({},s[U.FIREBASE_PARTIAL_PATH_LOCATIONS]??{}),{[p?.locationId]:g})});this.commonDbService?.shouldUseFirestore()||c.push(this.commonDbService?.updateData({feature:"documentMetadata",data:JSON.parse(JSON.stringify(f)),properties:{documentId:a?.documentId??"",organizationId:t?.organizationId??""}}));let I=this.locationMetadata$.value;if(I||(I={}),p?.location?.id){let T=I?.[a.documentId],L=T?.[p?.location?.id??""];I&&(T||(I[a.documentId]={}),L||(I[a.documentId][p?.location?.id??""]={}),I[a.documentId][p?.location?.id??""]=D(E({},L),{location:p?.location})),Object.keys(I||{}).length>0&&this.locationMetadata$.next(I)}}yield Promise.allSettled(c)}}}}catch(t){this.loggingService.catch("Error in updateDocumentLocationMetadata: ",t)}})}genarateLocationId(e){try{return e&&typeof e=="object"?Nn(JSON.stringify(or(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(E({},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(E({},r)),t!=="internal"&&this.isDocumentIdInDebounceQueue&&(this.draftLocationMap.locations=this.draftLocationMap.locations.filter(c=>c.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(`[${U.ATTRIBUTES.VELT_LOCATION}]`),r=[];t.forEach(a=>{let s=a.getAttribute(U.ATTRIBUTES.VELT_LOCATION);if(s){let c=JSON.parse(s),p=this.genarateLocationId(c);r.push(p)}}),Object.keys(e).forEach(a=>{let s=e[a];r.includes(s.locationId)||delete e[a]}),this.locations$.next(E({},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(U.ATTRIBUTES.VELT_LOCATION)?t=e:t=e.closest(`[${U.ATTRIBUTES.VELT_LOCATION}]`),t){let r=t?.getAttribute(U.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(`[${U.ATTRIBUTES.VELT_LOCATION}], [${U.ATTRIBUTES.VELT_LOCATION_ID}]`).forEach(r=>{if(r.getAttribute(U.ATTRIBUTES.VELT_LOCATION)){let a=this.getLocationFromElement(r);a?.locationId&&(e[a.locationId]={element:r,location:a})}else if(r.getAttribute(U.ATTRIBUTES.VELT_LOCATION_ID)){let a=r.getAttribute(U.ATTRIBUTES.VELT_LOCATION_ID);if(a){let s=this.getLocationByClientLocationId(a);s?.locationId&&(e[s.locationId]={element:r,location:s});let c={id:a},p=this.genarateLocationId(c);e[a]={element:r,location:{locationId:p,location:c}}}}}),e}catch(e){return this.loggingService.catch("Error in DocService getElementMapWithLocation:",e),{}}}getAdditionLocationFromElement(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: getAdditionLocationFromElement","color: green;");let t;if(t=e?.closest(`[${U.ATTRIBUTES.VELT_LOCATION}], [${U.ATTRIBUTES.VELT_LOCATION_ID}]`),t){if(t?.getAttribute(U.ATTRIBUTES.VELT_LOCATION)){let r=t?.getAttribute(U.ATTRIBUTES.VELT_LOCATION);if(r)return JSON.parse(r)}else if(t?.getAttribute(U.ATTRIBUTES.VELT_LOCATION_ID)){let r=t?.getAttribute(U.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(`[${U.ATTRIBUTES.VELT_DOCUMENT_ID}]`)?.getAttribute(U.ATTRIBUTES.VELT_DOCUMENT_ID)||null}catch(t){return this.loggingService.catch("Error in DocService getAdditionalDocumentIdFromElement:",t),null}}getDocumentMetadata(e){try{return e?this.documentMetadata$.value?.[e]||null:this.documentMetadata$.value?.[this.documentPaths$.value?.documentId??""]||null}catch(t){return this.loggingService.catch("Error in DocService getDocumentMetadata:",t),null}}getAllDocumentMetadata$(e){return this.getAllDocumentMetadataMap$().pipe(de(t=>t?.[e??this.documentPaths$.value?.documentId??""]||null),_t(Xt))}getAllDocumentMetadata(){try{return Object.values(this.documentMetadata$.value||{})}catch(e){return this.loggingService.catch("Error in DocService getAllDocumentMetadata:",e),[]}}getAllDocumentMetadataMap$(){return this.documentMetadata$.asObservable().pipe(de(e=>e||{}),_t(Xt))}getAllDocumentMetadataMap(){try{return this.documentMetadata$.value||{}}catch(e){return this.loggingService.catch("Error in DocService getAllDocumentMetadata:",e),{}}}getDocumentMetadataOfAvailableDocuments(){try{this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentMetadataOfAvailableDocuments","color: green;");let e=this.documentMetadata$.value||{},t={},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(c=>{let p=e?.[c.documentId];p&&(t[c.documentId]=p)});else if(this.documentPaths$.value?.documentId){let c=e?.[this.documentPaths$.value?.documentId];c&&(t[this.documentPaths$.value?.documentId]=c)}}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),_t(Xt))}setDocumentMetadata(e,t){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocumentMetadata","color: green;");let r=JSON.parse(JSON.stringify(this.documentMetadata$.value??{}));r[e]=t,this.documentMetadata$.next(r)}catch(r){this.loggingService.catch("Error in DocService setDocumentMetadata:",r)}}setAllDocumentMetadata(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: setAllDocumentMetadata","color: green;"),this.documentMetadata$.next(e)}catch(t){this.loggingService.catch("Error in DocService setAllDocumentMetadata:",t)}}getOrganizationMetadata(e){return this.organizationMetadata$.value?.[e]||null}getOrganizationMetadata$(e){return this.organizationMetadata$.asObservable().pipe(de(t=>t?.[e]||null))}getOrganizationMetadataMap$(){return this.organizationMetadata$.asObservable().pipe(de(e=>e||{}),_t(Xt))}getCustomerMetadata(){return this.customerMetadata$.value}getCustomerMetadata$(){return this.customerMetadata$.asObservable()}getOrganizationConfig$(){return this.organizationConfig$.asObservable().pipe(_t(Xt))}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,c=this.getDocumentMetadata(s);if(!c)return;let p=c?.folderId,g=c?.veltFolderId;return E(E({apiKey:this.configService.getApiKey()??void 0,clientDocumentId:a,clientOrganizationId:r.clientOrganizationId,documentId:s,organizationId:r.organizationId},p?{folderId:p}:{}),g?{veltFolderId:g}:{})}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),c=this.getDefaultMetadata({clientDocumentId:r,documentId:a});return s||c||{}}catch(r){return this.loggingService.catch("Error in DocService getBaseMetadata:",r),{}}}getServerId({documentId:e,organizationId: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=$i(e?.folderId);r.push(ft("metadata.veltFolderId","==",s))}return e?.documentIds?.length&&!e?.allDocuments&&r.push(ft("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=$i(e?.folderId);r.push(ft("metadata.veltFolderId","==",s))}return e?.documentIds?.length&&!e?.allDocuments&&r.push(ft("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 c=os(r);if(!a||a.length===0)return this.loggingService.catch("Error in updateDocuments: documents is required"),[];let p=[],g=this.documentMetadata$.value??{};for(let f of a)if(f?.documentId){f.organizationId=c,f.clientOrganizationId=r,f.clientDocumentId=f.documentId;let I=Tr(f.documentId);f.documentId=I,f.apiKey=this.configService.getApiKey()??void 0,(s||this.documentPaths$.value?.folderId)&&(f.folderId=s||this.documentPaths$.value?.folderId,f.veltFolderId=$i(s||this.documentPaths$.value?.folderId||""));let T=()=>{if(s&&this.documentPaths$.value?.folderId&&s!==this.documentPaths$.value?.folderId)return;let G=g?.[I];G?g[I]=E(E({},G),f):g[I]=f},L=yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:I,organizationId:c,field:"metadata"}});if(L?.errorCode&&(L={}),L&&L.apiKey&&L.folderId&&s&&L.folderId!=f.folderId){this.loggingService.catch(`Error in updateDocuments: document ${f.clientDocumentId} already exists with different folderId: ${L.folderId}`);continue}if(L&&L.apiKey&&!L.folderId&&f.folderId){this.loggingService.catch(`Error in updateDocuments: document ${f.clientDocumentId} already exists, move this document to folder with REST API`);continue}T(),f&&this.commonDbService&&this.userPermissionService?.hasEditAccess({documentId:f?.documentId??""})&&p.push(this.commonDbService.updateData({feature:"documentMetadata",data:JSON.parse(JSON.stringify(f)),properties:{organizationId:c,documentId:I}}))}yield Promise.all(p),this.setAllDocumentMetadata(g)}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(f=>f.clientDocumentId)??[],s.length===0))return this.loggingService.catch("Error in updateLocations: documentId is required"),[];if(!r&&(r=this.documentPaths$.value?.clientOrganizationId,!r))return this.loggingService.catch("Error in updateLocations: organizationId is required"),[];if(!a||a.length===0)return this.loggingService.catch("Error in updateLocations: locations is required"),[];let c=s.map(f=>Tr(f)),p=[],g=this.locationMetadata$.value;g||(g={}),c.forEach(f=>{a.forEach(I=>{let T=this.location$.value;if(I?.id===T?.location?.id&&this.location$.next({locationId:T?.locationId,location:I}),I?.id){delete I?.metadata;let L=YH(I.id),G=g?.[f],z=G?.[I.id];g&&(G||(g[f]={}),z||(g[f][I.id]={}),g[f][I.id]=D(E({},z),{location:I})),I&&this.commonDbService&&p.push(this.commonDbService.updateData({feature:"locationMetadata",data:JSON.parse(JSON.stringify({location:I})),properties:{organizationId:os(r),documentId:f,id:L}}))}})}),yield Promise.all(p),Object.keys(g||{}).length>0&&this.locationMetadata$.next(g)}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 c=$i(e?.folderId);r=yield this.commonDbService?.getData({feature:"folder",properties:{folderId:c,apiKey:this.apiKey??"",organizationId:s,documentId:this.documentPaths$.value?.documentId}}),r&&(r=[r]),a=yield this.commonDbService?.queryData({feature:"allFolders",properties:{firestoreQuery:[ft("metadata.veltParentFolderId","==",c)],folderId:c,apiKey:this.apiKey??"",organizationId:s,documentId:this.documentPaths$.value?.documentId}})}else r=yield this.commonDbService?.queryData({feature:"allFolders",properties:{apiKey:this.apiKey??"",organizationId:s,documentId:this.documentPaths$.value?.documentId}});return{data:r,parentFolders:a}}catch(t){return this.loggingService.catch("Error in DocService getFoldersRequest:",t),{data:[],parentFolders:[]}}})}getDocumentIam$(){return this.authService.getUser$().pipe(fe(e=>e?this.documentPaths$.pipe(fe(t=>t?.documentIam?this.commonDbService?.dbListener({feature:"documentIam",properties:{documentId:t.documentId,organizationId:t.organizationId,isCollection:!1}}).pipe(de(r=>r?.data?.docIamConfig??r?.data),_t((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?xi.RESTRICTED:xi.PUBLIC:e&&e.documentAccessType?e.documentAccessType:xi.PUBLIC}catch(t){return this.loggingService.catch("Error in DocService getDocumentAccessType:",t),xi.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"}});if(r?.errorCode)return;switch(delete r.documentAccessType,r.features||(r.features={}),r.features.all||(r.features.all={}),e){case xi.PUBLIC:r.features.all.restricted=!1;break;case xi.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(E(E({},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)(ee(tt),ee(je),ee(In),ee(Le),ee(Ft),ee(y),ee(Js),ee(vm),ee(ni),ee(xo))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Ln=(()=>{let o=class o{constructor(e,t,r,a,s){this.analyticsService=e,this.authService=t,this.coreActionsService=r,this.docService=a,this.loggingService=s,this.resolveOrganizationUsers=new ve(!0),this.resolveFolderUsers=new ve(!0),this.resolveDocumentUsers=new ve(!0),this.unresolvedUsers=new ve([]),this.resolveTimeout=60*1e3,this.resolveAttempts=new Map,this.subscriptions=new Dn,this.userDataProvider$=new ve(null),this.userById$=new ve({}),this.userByIdCalled$=new ve({}),this.pendingResolutions=new Set,this.getUserById=c=>{try{return this.userById$.value?.[c]}catch(p){this.loggingService.catch("Error in UsersService getUserById:",p);return}};try{this.analyticsService.setUserService(this),this.authService.setUsersService(this),this.docService.getDocumentPaths$().pipe(Fe(c=>!!c),fe(()=>this.getUnresolvedUsers$().pipe(Fe(c=>c.length>0),Ao(300),ot(20),fe(c=>{let p=this.docService.getOrganizationConfig()?.organizationId;return this.commonDbService?this.commonDbService?.dbListener({feature:"allOrganizationUsers",properties:{organizationId:p,isCollection:!0,useQuery:!0,firestoreQuery:[yi(ft("user.userId","in",c.slice(0,20)))]}}).pipe(de(g=>g?.data),on(g=>{if(g&&typeof g=="object"){delete g.undefined,delete g.null;let f=Object.values(g??{});this.setUserByIds(f.map(T=>T.user));let I=c.filter(T=>!f.some(L=>L.user.userId===T));I.length!==c.length&&this.setUnresolvedUsers(I)}})):se([])})))).subscribe()}catch(c){this.loggingService.catch("Error in UsersService constructor:",c)}}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(p){return Q(this,arguments,function*({userIds:e,forceResolve:t,feature:r,organizationId:a,skipUserCheck:s=!1,uniqueId:c}){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: resolveUsers","color: green;");let g=!1;if(r&&(g=this.isResolverForFeatureDisabled(r)),g)return{};{let f={},I=[],T={};if(e?.forEach(L=>{let G=this.getUserById(L);G?f[L]=G:this.userByIdCalled$.getValue()[L]?t&&I.push(L):(I.push(L),this.userByIdCalled$.next(D(E({},this.userByIdCalled$.getValue()),{[L]:!0})))}),I.length>0){let L=c||vt();this.coreActionsService.triggerAction(ct.USER_RESOLVER,{event:Y.Events.Resolver.USER_RESOLUTION_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:L,methodName:Hr.RESOLVE_USERS,source:"internal",payload:{userIds:I,organizationId:a,feature:r,forceResolve:t,skipUserCheck:s,externalUserDataProviderAvailable:this.externalUserDataProviderAvailable()}});let G={};try{let z,J=new Promise((le,_e)=>{z=setTimeout(()=>{_e(new Error("User resolution timeout"))},this.userDataProvider$.getValue()?.config?.resolveTimeout||this.userDataProvider$.getValue()?.resolveTimeout||this.resolveTimeout)});G=yield Promise.race([this.getUsersFromDB({userIds:I,organizationId:a,skipUserCheck:s}).finally(()=>{clearTimeout(z)}),J]),this.analyticsService.trackEvent(Y.Events.Resolver.USER_RESOLVER_GET,{sourceMethod:"resolveUsers",source:"sdk",userIds:I}),this.coreActionsService.triggerAction(ct.USER_RESOLVER,{event:Y.Events.Resolver.USER_RESOLUTION_RESULT,timestamp:new Date().getTime(),uniqueId:L,methodName:Hr.RESOLVE_USERS,source:"internal",payload:{result:G,userIds:I,externalUserDataProviderAvailable:this.externalUserDataProviderAvailable()}})}catch(z){this.loggingService.catch("Error in UsersService resolveUsers getUsers:",z,{userIds:I}),this.coreActionsService.triggerAction(ct.USER_RESOLVER,{event:Y.Events.Resolver.USER_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:L,methodName:Hr.RESOLVE_USERS,source:"internal",payload:{error:z,userIds:I,externalUserDataProviderAvailable:this.externalUserDataProviderAvailable()}})}finally{I?.forEach(z=>{if(!G[z]){let J=new Set([...this.getUnresolvedUsers(),z]);this.unresolvedUsers.next(Array.from(J)),G[z]={userId:z,name:`User ${z}`}}})}Object.entries(G).forEach(([z,J])=>{J&&(f[z]=G?.[z],T[z]=G?.[z])})}return Object.keys(T).length>0&&(this.authService.setOptionalPropertiesToUsers(Object.values(T)),this.userById$.next(E(E({},this.userById$.getValue()),T))),f}}catch(g){this.loggingService.catch("Error in UsersService resolveUsers:",g);let f=c||vt();return this.coreActionsService.triggerAction(ct.USER_RESOLVER,{event:Y.Events.Resolver.USER_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:f,methodName:Hr.RESOLVE_USERS,source:"internal",payload:{error:g,userIds:e,externalUserDataProviderAvailable:this.externalUserDataProviderAvailable()}}),{}}})}getUnresolvedUsers$(){return this.unresolvedUsers.asObservable()}getUnresolvedUsers(){this.loggingService.log("%c[WB] Calling UsersService FUNCTION: getUnresolvedUsers","color: green;");try{return JSON.parse(JSON.stringify(this.unresolvedUsers.getValue()))}catch(e){return this.loggingService.catch("Error in UsersService getUnresolvedUsers:",e),[]}}setUnresolvedUsers(e){this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setUnresolvedUsers","color: green;");try{if(Array.isArray(e)){let t=JSON.parse(JSON.stringify(e));this.unresolvedUsers.next(t)}}catch(t){this.loggingService.catch("Error in UsersService setUnresolvedUsers:",t)}}getUsersFromDB(a){return 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();if(s)return s.get(e);if(t||(t=this.docService.getOrganizationConfig()?.organizationId),!t)return{};let c=(yield this.getUsersFromDBWithBatching({userIds:e,organizationId:t,skipUserCheck:r}))??[],p={};return c.forEach(g=>{g.forEach(f=>{f?.user?.userId&&(p[f.user.userId]=f.user)})}),p}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 g=0;g<e.length;g+=30)s.push(e.slice(g,g+30));let c=s.map((g,f)=>Q(this,null,function*(){try{return(yield this.commonDbService?.queryData({feature:"allOrganizationUsers",properties:{organizationId:t,useCollectionGroup:!1,isCollection:!0,firestoreQuery:[ft("user.userId","in",g)],skipUserCheck:r}}))||[]}catch(I){return this.loggingService.catch(`Error in batch ${f+1}:`,I),[]}}));return yield Promise.all(c)}catch(s){return this.loggingService.catch("Error in getUsersFromDBWithBatching:",s),[]}})}getTemporaryUsersFromDBWithBatching(a){return Q(this,arguments,function*({userIds:e,organizationId:t,resourceIds:r}){try{if(!e?.length||!r?.length)return[];let s=[];for(let G=0;G<e.length;G+=30)s.push(e.slice(G,G+30));let c=[];for(let G=0;G<r.length;G+=30)c.push(r.slice(G,G+30));let p=[],g=0,f=(G,z)=>Q(this,null,function*(){try{return((yield this.commonDbService?.queryData({feature:"allPermissionsUsers",properties:{organizationId:t,useCollectionGroup:!1,isCollection:!0,firestoreQuery:[yi(ft("userId","in",G),ft("veltResourceId","in",z))]}}))??[])||[]}catch(J){return this.loggingService.catch(`Error in batch ${g+1}:`,J),[]}});for(let G of s)for(let z of c)p.push(f(G,z)),g++;return(yield Promise.all(p)).flat().filter((G,z,J)=>z===J.findIndex(le=>le.userId===G.userId&&le.resourceId===G.resourceId))}catch(s){return this.loggingService.catch("Error in getTemporaryUsersFromDBWithBatching:",s),[]}})}getResolveOrganizationUsers$(){return this.resolveOrganizationUsers.asObservable()}getResolveFolderUsers$(){return this.resolveFolderUsers.asObservable()}getResolveDocumentUsers$(){return this.resolveDocumentUsers.asObservable()}getUserById$(){try{return this.loggingService.log("%c[WB] Calling UsersService FUNCTION: getUserById$","color: green;"),this.userById$.asObservable().pipe(_t(Xt))}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=JSON.parse(JSON.stringify(this.userById$.getValue()??{}));e.forEach(r=>{t[r.userId]=E(E({},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)}}externalUserDataProviderAvailable(){try{return this.loggingService.log("%c[WB] Calling UsersService FUNCTION: externalUserDataProviderAvailable","color: green;"),!!this.commonDbService?.shouldUseFirestore()&&!!this.userDataProvider$.getValue()}catch(e){return this.loggingService.catch("Error in UsersService externalUserDataProviderAvailable:",e),!1}}userDataProviderAvailable(){try{return this.loggingService.log("%c[WB] Calling UsersService FUNCTION: userDataProviderAvailable","color: green;"),!!this.commonDbService?.shouldUseFirestore()}catch(e){return this.loggingService.catch("Error in UsersService userDataProviderAvailable:",e),!1}}};o.\u0275fac=function(t){return new(t||o)(ee(tt),ee(je),ee(ni),ee(rt),ee(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Spe=(()=>{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)(ee(y),ee(Ln))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var bpe=(()=>{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)(ee(y),ee(Ln))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Jg=class{static getFirestoreProdDbName(o,n){return n?.databaseURL?.includes("snippyly-plugin.firebaseio.com")||n?.databaseURL?.includes("snippyly-plugin-staging.firebaseio.com")?"sfdb":n?.storeDbId??(this.isTestingDb(n?.databaseURL??"")?"sdktest":`apikey${o.toLowerCase()}`)}static isTestingDb(o){try{return o.includes("-test")}catch(n){return et.error("Error in isTestingDb:",n),!1}}};var eu=(()=>{let o=class o{constructor(e,t,r){this.coreActionsService=e,this.loggingService=t,this.analyticsService=r,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(a=>{a&&(a.config?.saveRetryConfig&&(this.retrySaveConfig=a.config.saveRetryConfig),a.config?.deleteRetryConfig&&(this.retryDeleteConfig=a.config.deleteRetryConfig))})}catch(a){this.loggingService.catch("Error in AttachmentResolverService constructor:",a)}}getProvider(){try{let e=this.attachmentDataProvider$.getValue();return e||void 0}catch(e){this.loggingService.catch("Error in AttachmentResolverService getProvider:",e);return}}saveAttachment(e,t){return Q(this,null,function*(){try{this.loggingService.log("%c[WB] Calling AttachmentResolverService FUNCTION: saveAttachment","color: green;");let r=this.getProvider();if(!this.attachmentDataProviderAvailable())throw new Error("Attachment save data provider not available");let a=t||vt();this.coreActionsService.triggerAction(ct.ATTACHMENT_RESOLVER,{event:Y.Events.Resolver.ATTACHMENT_SAVE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:a,methodName:kl.SAVE_ATTACHMENT,source:"internal",payload:{request:e}});let s=yield md(()=>r?.save({attachment:e.attachment,event:e.eventType,metadata:e.attachment.metadata})||Promise.resolve(void 0),"saveAttachment",this.retrySaveConfig);if(s?.statusCode!==200){this.loggingService.catch(s?.message??"Error in AttachmentResolverService saveAttachment:"),this.coreActionsService.triggerAction(ct.ATTACHMENT_RESOLVER,{event:Y.Events.Resolver.ATTACHMENT_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:kl.SAVE_ATTACHMENT,source:"internal",payload:{error:s,request:e}});return}return this.analyticsService.trackEvent(Y.Events.Resolver.ATTACHMENT_RESOLVER_SAVE,{sourceMethod:"saveAttachment",source:"sdk",attachmentId:e.attachment.attachmentId,eventType:e.eventType}),this.coreActionsService.triggerAction(ct.ATTACHMENT_RESOLVER,{event:Y.Events.Resolver.ATTACHMENT_SAVE_RESULT,timestamp:new Date().getTime(),uniqueId:a,methodName:kl.SAVE_ATTACHMENT,source:"internal",payload:{result:s,request:e}}),s}catch(r){this.loggingService.warn("Error in AttachmentResolverService saveAttachment:",r);let a=t||vt();this.coreActionsService.triggerAction(ct.ATTACHMENT_RESOLVER,{event:Y.Events.Resolver.ATTACHMENT_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:kl.SAVE_ATTACHMENT,source:"internal",payload:{error:r,request:e}});return}})}deleteAttachment(a,s){return Q(this,arguments,function*({attachmentId:e,metadata:t},r){try{this.loggingService.log("%c[WB] Calling AttachmentResolverService FUNCTION: deleteAttachment","color: green;");let c=this.getProvider();if(!this.attachmentDataProviderAvailable())throw new Error("Attachment delete data provider not available");let p=r||vt();this.coreActionsService.triggerAction(ct.ATTACHMENT_RESOLVER,{event:Y.Events.Resolver.ATTACHMENT_DELETE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:p,methodName:kl.DELETE_ATTACHMENT,source:"internal",payload:{attachmentId:e,metadata:t}});let g=yield md(()=>c?.delete({attachmentId:e,metadata:t,event:va.ATTACHMENT_DELETE})||Promise.resolve(void 0),"deleteAttachment",this.retryDeleteConfig);return g?.statusCode!==200?(this.loggingService.catch(g?.message??"Error in AttachmentResolverService deleteAttachment:"),this.coreActionsService.triggerAction(ct.ATTACHMENT_RESOLVER,{event:Y.Events.Resolver.ATTACHMENT_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:p,methodName:kl.DELETE_ATTACHMENT,source:"internal",payload:{error:g,attachmentId:e,metadata:t}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(Y.Events.Resolver.ATTACHMENT_RESOLVER_DELETE,{sourceMethod:"deleteAttachment",source:"sdk",attachmentId:e}),this.coreActionsService.triggerAction(ct.ATTACHMENT_RESOLVER,{event:Y.Events.Resolver.ATTACHMENT_DELETE_RESULT,timestamp:new Date().getTime(),uniqueId:p,methodName:kl.DELETE_ATTACHMENT,source:"internal",payload:{result:{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0},attachmentId:e,metadata:t}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0})}catch(c){this.loggingService.warn("Error in AttachmentResolverService deleteAttachment:",c);let p=r||vt();return this.coreActionsService.triggerAction(ct.ATTACHMENT_RESOLVER,{event:Y.Events.Resolver.ATTACHMENT_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:p,methodName:kl.DELETE_ATTACHMENT,source:"internal",payload:{error:c,attachmentId:e,metadata:t}}),{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)(ee(ni),ee(y),ee(tt))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var tu=(()=>{let o=class o{constructor(e,t,r,a,s,c,p,g){this.loggingService=e,this.usersService=t,this.authService=r,this.functions=a,this.configService=s,this.commentAnnotationsResolverService=c,this.attachmentResolverService=p,this.coreActionsService=g,this.notificationActionTypeMap={[zt.NEWLY_ADDED]:va.COMMENT_ANNOTATION_ADD,[zt.ADDED]:va.COMMENT_ADD,[zt.UPDATED]:va.COMMENT_UPDATE,[zt.DELETED]:va.COMMENT_DELETE}}setNotificationService(e){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: setNotificationService","color: green;"),this.notificationService=e}catch(t){this.loggingService.catch("Error in CommentUtilsService setNotificationService: ",t)}}setUserPermissionService(e){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: setUserPermissionService","color: green;"),this.userPermissionService=e}catch(t){this.loggingService.catch("Error in CommentUtilsService setUserPermissionService: ",t)}}getUserIdsToResolveFromComments(e){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: getUserIdsToResolveFromComments","color: green;");let t=new Set;for(let 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 E(E({},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,c)=>c.findIndex(p=>p.text===a.text)===s)||[]).forEach(a=>{if(a?.text){let s=new RegExp(cd(`{{${a.userId}}}`),"g");t.commentText?.includes(`@User ${a.userId}`)&&(s=new RegExp(cd(`@User ${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)}),e?.viewedBy&&delete e.viewedBy,e?.comments&&e.comments.forEach(t=>{t?.reactionAnnotations&&delete t.reactionAnnotations}),this.usersService.userDataProviderAvailable()){if(e?.from?.userId&&(e.from={userId:e.from.userId}),e?.assignedTo?.userId&&(e.assignedTo={userId:e.assignedTo.userId}),e?.subscribedUsers)for(let t of Object.keys(e?.subscribedUsers))e.subscribedUsers[t].user={userId:e?.subscribedUsers[t].user.userId};if(e?.unsubscribedUsers)for(let t of Object.keys(e?.unsubscribedUsers))e.unsubscribedUsers[t].user={userId:e?.unsubscribedUsers[t].user.userId}}return e?.comments&&(e.comments=e?.comments?.map(t=>this.formatCommentThreadData(t))),e}catch(t){return this.loggingService.catch("Error in CommentUtilsService formatCommentData:",t),e}}mergeStrippedDataWithCommentAnnotations(e){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: mergeStrippedDataWithCommentAnnotations","color: green;"),!this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable())return e;let t=this.commentAnnotationsResolverService.getAnnotationById(e?.annotationId),r=this.attachmentResolverService.attachmentDataProviderAvailable(),a=this.commentAnnotationsResolverService.getFieldsToRemove();return t&&(e?.comments?.forEach(s=>{let c=t?.comments?.[s?.commentId];if(c){s.commentHtml=c?.commentHtml,s.commentText=c?.commentText;let p=c?.attachments;r&&p&&s.attachments?.forEach(g=>{let f=g?.attachmentId;p?.[f]&&(g.name=p?.[f]?.name,g.url=p?.[f]?.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?!ui(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 fd;if(Object.assign(a,e),a.isCommentResolverUsed=t,r){let s=a.attachments?.map(c=>(c.isAttachmentResolverUsed=!0,delete c?.name,delete c?.url,c));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,commentId:r}){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: stripCommentAnnotationData","color: green;"),!this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable())return{originalData:e,strippedData:null};let a=this.attachmentResolverService.attachmentDataProviderAvailable(),s=this.commentAnnotationsResolverService.getFieldsToRemove(),c;t&&(c=this.notificationActionTypeMap?.[t]);let p={},g=null,f=!1;if(e&&e.annotationId){let T=e.annotationId;p[T]=E(E(E(E({annotationId:T,metadata:J0(e.metadata??{}),comments:{}},e?.from&&{from:e?.from}),e?.assignedTo&&{assignedTo:e?.assignedTo}),e?.resolvedByUserId&&{resolvedByUserId:e?.resolvedByUserId}),e?.targetTextRange?.text&&{targetTextRange:{text:e?.targetTextRange?.text}}),delete e?.targetTextRange?.text,s?.length>0&&s.forEach(G=>{e?.[G]&&(p[T][G]=e[G],delete e[G])}),e.comments?.forEach(G=>{if(G.commentId){let z;a&&(z={},G.attachments?.forEach(J=>{z[J.attachmentId]={attachmentId:J.attachmentId,name:J.name,url:J.url}})),p[T].comments[G.commentId]=E(E(E(E(E(E({commentId:G.commentId},G?.commentHtml&&{commentHtml:G?.commentHtml}),G?.commentText&&{commentText:G?.commentText}),z&&{attachments:z}),G?.from&&{from:G?.from}),G?.to&&{to:G?.to}),G?.taggedUserContacts&&{taggedUserContacts:G?.taggedUserContacts})}}),f=this.isCommentsDataChanged(p[T],T);let L=new Zo;Object.assign(L,e),L.comments=e.comments?.map(G=>this.stripCommentsFromAnnotationData({comment:G}))||[],g=L}let I=g?.comments?.find(T=>T.commentId===r);return I?.isDraft&&(c=g?.comments?.length&&g?.comments?.length>0?va.COMMENT_ADD:va.COMMENT_ANNOTATION_ADD),{strippedData:f&&(t||I?.isDraft)?p:null,originalData:g,eventType:c}}catch(a){return this.loggingService.catch("Error in CommentAnnotationsResolverService stripCommentAnnotationData:",a),{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?.userId?D(E({},r),{contact:{userId:r.contact.userId}}):r));let t=e?.taggedUserContacts?.filter((r,a,s)=>s.findIndex(c=>c.text===r.text)===a)||[];t.forEach(r=>{if(r?.text&&r?.contact?.userId){let a=new RegExp(cd(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?.contact?.userId&&(r.text="")})}return e}catch(t){return this.loggingService.catch("Error in CommentUtilsService formatCommentThreadData:",t),e}}getDeniedForYouUsers(t){return Q(this,arguments,function*({extraData:e}){try{let r=Object.values(e?.annotationData?.subscribedUsers||{}).map(s=>s.user.userId)??[],a=[];if(this.userPermissionService?.isPermissionProviderAvailable()&&r.length){let s=e?.metadata?.clientDocumentId,c=[];r.forEach(f=>{if(c.push({userId:f,resource:{id:s,type:Fo.DOCUMENT,source:Hi.SET_NOTIFICATIONS,organizationId:e?.metadata?.clientOrganizationId??""}}),e?.annotationData?.context?.access&&this.userPermissionService?.getIsContextEnabled()){let I=JSON.stringify(e?.annotationData?.context?.access);c.push({userId:f,resource:{id:I,type:Fo.CONTEXT,source:Hi.SET_NOTIFICATIONS,organizationId:e?.metadata?.clientOrganizationId??"",context:{access:e?.annotationData?.context?.access}}})}});let p=vt();this.coreActionsService.triggerAction(ct.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.RESOURCE_ACCESS_REQUEST_FORMED,methodName:Hi.SET_NOTIFICATIONS,uniqueId:p,timestamp:new Date().getTime(),source:"internal",payload:{requests:c}});let g=yield this.userPermissionService?.onResourceAccessRequired({requests:c,uniqueId:p,methodName:Hi.SET_NOTIFICATIONS});g?.success&&g?.data?.length&&g.data.forEach(f=>{f.hasAccess||a.push(f.userId)})}return a}catch(r){return this.loggingService.catch("Error in CommentUtilsService getDeniedForYouUsers:",r),[]}})}handleCommentEncryption(c){return Q(this,arguments,function*({data:e,firestorePath:t,extraData:r,eventType:a,metadata:s}){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: handleCommentEncryption","color: green;");let p=Dk(this.authService.getFirebaseConfig()?.firebaseOptions),g=Xi(this.functions,Qi({url:wn.cloudFunction?.[p]?.setEncryptedData,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:1200*1e3});if(r){r=this.notificationService?.processNotificationData(r),r.annotationData=e;let G=r?.targetAnnotationData?.commentId;if(G){let z=e?.comments?.find(J=>J?.commentId===G);z&&(r.targetAnnotationData=z)}try{let z=this.stripCommentAnnotationData({data:r.annotationData,actionType:r?.actionType??zt.NEWLY_ADDED});z?.originalData&&(r.annotationData=this.formatCommentData(z.originalData)),r?.targetAnnotationData&&(r.targetAnnotationData=this.formatCommentThreadData(this.stripCommentsFromAnnotationData({comment:r.targetAnnotationData})))}catch(z){this.loggingService.warn("Error in CommentUtilsService handleCommentEncryption:",z)}}let f=Jg.getFirestoreProdDbName(this.configService.getApiKey()??"",this.authService.getFirebaseConfig()?.firebaseOptions),I=yield this.getDeniedForYouUsers({extraData:r}),T={path:t??"",data:e??{},dbId:f??"",notificationData:r||void 0,notificationURL:wn.firebaseNotificationsDatabaseURL,feature:"comment",eventType:a??"PATCH",sdkVersion:_a(),deniedForYouUsers:I,isPermissionProviderUsed:this.userPermissionService?.isPermissionProviderAvailable(),isCommentResolverUsed:this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable(),metadata:s},L=yield Dl(T,this.authService.getUser()?.userId??"");yield g({veltData:L})}catch(p){this.loggingService.catch("Error in CommentUtilsService handleCommentEncryption:",p)}})}};o.\u0275fac=function(t){return new(t||o)(ee(y),ee(Ln),ee(je),ee(xo),ee(Ft),ee(Js),ee(eu),ee(ni))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Ipe=(()=>{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);if(t){let r=t;e?.user&&typeof e.user=="object"&&(r=E(E({},r),e.user)),e=D(E({},e),{user:r})}}return e}catch(t){return this.loggingService.catch("Error in ContactUtilsService mergeUserIamWithUser: ",t),e}}};o.\u0275fac=function(t){return new(t||o)(ee(y),ee(Ln))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Epe=(()=>{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=E(E({},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)(ee(y),ee(Ln))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var u9=(()=>{let o=class o{constructor(e,t,r){this.coreActionsService=e,this.loggingService=t,this.usersService=r}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=E(E({},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=vt();this.coreActionsService.triggerAction(ct.USER_RESOLVER,{event:Y.Events.Resolver.USER_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:r,methodName:Hr.RESOLVE_USERS_FROM_HUDDLE_MESSAGES,source:"internal",payload:{userIds:t}});let a=yield this.usersService.resolveUsers({userIds:t,uniqueId:r});for(let s of e)s?.from?.userId&&a[s.from.userId]&&(s.from=a[s.from.userId])}return e}catch(t){return this.loggingService.catch("Error in HuddleUtilsService resolveUsersFromHuddleMessages:",t),e}})}formatHuddleMessageData(e){try{return this.loggingService.log("%c[WB] Calling HuddleUtilsService FUNCTION: formatHuddleMessageData","color: green;"),this.usersService.userDataProviderAvailable()&&e?.from?.userId&&(e.from={userId:e.from.userId}),e}catch(t){return this.loggingService.catch("Error in HuddleUtilsService formatHuddleMessageData:",t),e}}};o.\u0275fac=function(t){return new(t||o)(ee(ni),ee(y),ee(Ln))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var h9=(()=>{let o=class o{constructor(e,t,r){this.coreActionsService=e,this.loggingService=t,this.usersService=r}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),[]}}getUserIdsToResolveFromLiveStateSingleEditorMode(e){try{let t=new Set;return e?.editor?.userId&&t.add(e?.editor?.userId),e?.requestEditorAccess?.user?.userId&&t.add(e?.requestEditorAccess?.user?.userId),Array.from(t)}catch(t){return this.loggingService.catch("Error in LiveStateUtilsService getUserIdsToResolveFromLiveStateSingleEditorMode:",t),[]}}mergeLiveStateWithUser(e){try{if(e?.default?.singleEditorMode?.editor?.userId){let t=this.usersService.getUserById(e?.default?.singleEditorMode?.editor?.userId);t&&(e.default.singleEditorMode.editor=t)}if(e?.default?.singleEditorMode?.requestEditorAccess?.user?.userId){let t=this.usersService.getUserById(e?.default?.singleEditorMode?.requestEditorAccess?.user?.userId);t&&(e.default.singleEditorMode.requestEditorAccess.user=t)}return e}catch(t){return this.loggingService.catch("Error in LiveStateUtilsService mergeLiveStateWithUser:",t),e}}mergeSingleEditorLiveStateDataWithUser(e){try{if(e?.editor?.userId){let t=this.usersService.getUserById(e?.editor?.userId);t&&(e.editor=t)}if(e?.requestEditorAccess?.user?.userId){let t=this.usersService.getUserById(e?.requestEditorAccess?.user?.userId);t&&(e.requestEditorAccess.user=t)}return e}catch(t){return this.loggingService.catch("Error in LiveStateUtilsService mergeSingleEditorLiveStateDataWithUser:",t),e}}resolveAndMergeSingleEditorLiveStateDataWithUser(e){return Q(this,null,function*(){try{let t=this.getUserIdsToResolveFromLiveStates({default:{singleEditorMode:e}});if(t.length){let r=vt();return this.coreActionsService.triggerAction(ct.USER_RESOLVER,{event:Y.Events.Resolver.USER_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:r,methodName:Hr.RESOLVE_AND_MERGE_SINGLE_EDITOR_LIVE_STATE_DATA_WITH_USER,source:"internal",payload:{userIds:t}}),yield this.usersService.resolveUsers({userIds:t,uniqueId:r}),this.mergeSingleEditorLiveStateDataWithUser(e)}return e}catch(t){return this.loggingService.catch("Error in LiveStateUtilsService resolveAndMergeSingleEditorLiveStateDataWithUser:",t),e}})}formatLiveStateSingleEditorModeData(e){try{return this.usersService.userDataProviderAvailable()&&(e?.editor?.userId&&(e.editor={userId:e.editor.userId}),e?.requestEditorAccess?.user?.userId&&(e.requestEditorAccess.user={userId:e.requestEditorAccess.user.userId})),e}catch(t){return this.loggingService.catch("Error in LiveStateUtilsService formatLiveStateSingleEditorModeData:",t),e}}mergeLiveStateCustomsWithUsers(e){try{for(let t of e)if(t?.updatedBy?.userId){let 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)(ee(ni),ee(y),ee(Ln))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Dpe=(()=>{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)(ee(y),ee(Ln))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var kC=(()=>{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?D(E({},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 Dl(e,this.authService.getUser()?.userId??"")}catch(t){this.loggingService.catch("Error in RecorderUtilsService encryptRecorderAnnotation:",t);return}})}};o.\u0275fac=function(t){return new(t||o)(ee(je),ee(y),ee(Ln))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var f9=(()=>{let o=class o{constructor(e,t,r,a,s,c){this.commentUtilsService=e,this.recorderUtilsService=t,this.loggingService=r,this.usersService=a,this.authService=s,this.commentAnnotationsResolverService=c}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 c of s)t.add(c)}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 Dl(e,r)}catch(r){return this.loggingService.catch("Error in NotificationUtilsService handleNotificationEncryption:",r),e}})}};o.\u0275fac=function(t){return new(t||o)(ee(tu),ee(kC),ee(y),ee(Ln),ee(je),ee(Js))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Ope=(()=>{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=E(E({},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)(ee(y),ee(Ln))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Ape=(()=>{let o=class o{constructor(e,t,r,a,s,c){this.loggingService=e,this.usersService=t,this.authService=r,this.functions=a,this.configService=s,this.reactionAnnotationsResolverService=c}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=Dk(this.authService.getFirebaseConfig()?.firebaseOptions),c=Xi(this.functions,Qi({url:wn.cloudFunction?.[s]?.setEncryptedData,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:1200*1e3}),p=Jg.getFirestoreProdDbName(this.configService.getApiKey()??"",this.authService.getFirebaseConfig()?.firebaseOptions),g=this.authService.getUser()?.userId??"",f={path:t??"",data:e??{},dbId:p??"",feature:"reaction",eventType:r??"PATCH",sdkVersion:_a()},I=yield Dl(f,g);yield c({veltData:I})}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?!ui(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]=E({annotationId:r,metadata:J0(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)(ee(y),ee(Ln),ee(je),ee(xo),ee(Ft),ee(vm))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Ppe=(()=>{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)(ee(y),ee(Ln))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Mpe=(()=>{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)(ee(y),ee(Ln))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Cm=(()=>{let o=class o{constructor(e,t,r,a,s,c,p,g,f,I,T,L,G,z,J,le,_e,De,Be,Ve){this.areaUtilsService=e,this.arrowUtilsService=t,this.commentUtilsService=r,this.contactUtilsService=a,this.coreActionsService=s,this.cursorUtilsService=c,this.huddleUtilsService=p,this.liveStateUtilsService=g,this.loggingService=f,this.multiThreadUtilsService=I,this.notificationUtilsService=T,this.presenceUtilsService=L,this.reactionUtilsService=G,this.recorderUtilsService=z,this.selectionUtilsService=J,this.tagUtilsService=le,this.usersService=_e,this.docService=De,this.commentAnnotationsResolverService=Be,this.reactionAnnotationsResolverService=Ve}getErrorForGetRequests({feature:e,error:t}){try{switch(e){case"organizationMetadata":case"documentMetadata":case"folderMetadata":return(t?.message??"")?.includes("Missing or insufficient permissions.")?{errorCode:"PERMISSION_DENIED"}:null;default:return null}}catch(r){return this.loggingService.catch("Error in CommonDbUtilsService getErrorForGetRequests:",r),null}}getFirestorePath({feature:e,properties:t,documentPaths:r,apiKey:a}){try{if(!a)return;let{documentId:s,organizationId:c,folderId:p}=t;c||(c=r?.organizationId);let g=new d9({apiKey:a,documentId:s?`${s}`:"",organizationId:c?`${c}`:"",veltFolderId:p?`${p}`:void 0});switch(e){case"userConfig":return t?.userId&&t?.documentId&&g?.userConfig?`${g?.userConfig}/${t?.userId}/${U.FIREBASE_PARTIAL_PATH_DOCUMENT_CONFIGURATIONS}/${t?.documentId}`:void 0;case"allPermissionsUsers":return g?.permissionsUsers?`${g?.permissionsUsers}`:void 0;case"comment":return t?.documentId&&t?.id&&g?.comment?`${g?.comment}/${t?.id}`:void 0;case"allComments":return t?.documentId&&g?.comment?`${g?.comment}`:void 0;case"multiThread":return t?.documentId&&t?.id&&g?.multiThread?`${g?.multiThread}/${t?.id}`:void 0;case"allMultiThreads":return t?.documentId&&g?.multiThread?`${g?.multiThread}`:void 0;case"crdt":return t?.documentId&&g?.crdt&&t?.id?`${g?.crdt}/${t?.id}`:void 0;case"allLastNotificationTimestamp":return g?.lastNotificationTimestamp?`${g?.lastNotificationTimestamp}`:void 0;case"lastNotificationTimestamp":return t?.id&&g?.lastNotificationTimestamp?`${g?.lastNotificationTimestamp}/${t?.id}`:void 0;case"area":return t?.documentId&&t?.id&&g?.area?`${g?.area}/${t?.id}`:void 0;case"allAreas":return t?.documentId&&g?.area?`${g?.area}`:void 0;case"allDocuments":return g?.document?`${g?.document}`:void 0;case"allLocations":return g?.location?`${g?.location}`:void 0;case"allFolders":return g?.folder?`${g?.folder}`:void 0;case"folder":return g?.folder&&t.folderId?`${g?.folder}/${t.folderId}`:void 0;case"documentUserAccess":return t?.documentId&&t?.id&&g?.documentUsers?`${g?.documentUsers}/${t?.id}`:void 0;case"reaction":return t?.documentId&&t?.id&&g?.reaction?`${g?.reaction}/${t?.id}`:void 0;case"allReactions":return t?.documentId&&g?.reaction?`${g?.reaction}`:void 0;case"recorder":return t?.documentId&&t?.id&&g?.recorder?`${g?.recorder}/${t?.id}`:void 0;case"allRecorders":return t?.documentId&&g?.recorder?`${g?.recorder}`:void 0;case"recorderTrackEvent":return t?.documentId&&t?.id&&g?.recorder?`${g?.recorder}/${t?.id}/trackRecorderEvent`:void 0;case"documentAccessType":return t?.documentId&&g?.document?`${g?.document}/${t?.documentId}`:void 0;case"organizationMetadata":return g?.organization?`${g?.organization}`:void 0;case"documentIam":case"documentMetadata":return t?.documentId&&g?.document?`${g?.document}/${t?.documentId}`:void 0;case"folderMetadata":return t?.folderId&&g?.folder?`${g?.folder}/${t?.folderId}`:void 0;case"locationMetadata":return t?.documentId&&g?.location&&t?.id?`${g?.location}/${t?.id}`:void 0;case"documentUser":return t?.documentId&&t?.id&&g?.documentUsers?`${g?.documentUsers}/${t?.id}`:void 0;case"allDocumentUsers":return g?.users?`${g?.users}`:void 0;case"allFolderUsers":return g?.users?`${g?.users}`:void 0;case"allOrganizationGroups":return g?.organizationGroups?`${g?.organizationGroups}`:void 0;case"allOrganizationUsers":return g?.users?`${g?.users}`:void 0;case"notificationViewsTimestamp":return t?.documentId&&t?.id&&g?.notificationViews?`${g?.notificationViews}/${t?.id}`:void 0;case"allDocumentViews":return t?.documentId&&g?.documentViews?`${g?.documentViews}`:void 0;case"documentViews":case"documentMetadataViews":case"documentDayViews":case"documentUsersViews":return t?.documentId&&t?.id&&g?.documentViews?`${g?.documentViews}/${t?.id}`:void 0;case"locationDayViews":case"locationUsersViews":case"locationViews":case"locationMetadataViews":case"location":return t?.documentId&&t?.id&&g?.locationViews?`${g?.locationViews}/${t?.id}`:void 0;case"allLocationViews":return t?.documentId&&g?.locationViews?`${g?.locationViews}`:void 0;case"allDocNotifications":return t?.documentId&&g?.docNotification?`${g?.docNotification}`:void 0;case"docNotificationViews":case"docNotification":return t?.documentId&&t?.id&&g?.docNotification?`${g?.docNotification}/${t?.id}`:void 0;case"userNotificationViews":case"userNotification":return t?.userId&&t?.id&&g?.notificationUsers?`${g?.notificationUsers}/${t?.userId}/${U.FIREBASE_PARTIAL_PATH_USER_NOTIFICATION}/${t?.id}`:void 0;case"allUserNotifications":return t?.userId&&g?.notificationUsers?`${g?.notificationUsers}/${t?.userId}/${U.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 U.FIREBASE_PARTIAL_PATH_COMMENT;case"allDocuments":return U.FIREBASE_PARTIAL_PATH_DOCS;case"allLocations":return U.FIREBASE_PARTIAL_PATH_LOCATION;case"allMultiThreads":return U.FIREBASE_PARTIAL_PATH_MULTI_THREAD;case"allAreas":return U.FIREBASE_PARTIAL_PATH_AREA;case"allReactions":return U.FIREBASE_PARTIAL_PATH_REACTION;case"allRecorders":return U.FIREBASE_PARTIAL_PATH_RECORDER;case"allDocumentViews":return U.FIREBASE_PARTIAL_PATH_DOCUMENT_VIEWS;case"allLocationViews":return U.FIREBASE_PARTIAL_PATH_LOCATION_VIEWS;case"allDocumentUsers":return U.FIREBASE_PARTIAL_PATH_DOCUMENT_USERS;case"allFolderUsers":return U.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:c,organizationId:p}=t;p||(p=r?.organizationId);let g=new fm({apiKey:a,documentId:c?`${c}`:"",organizationId:p?`${p}`:""});switch(e){case"userConfig":return t?.userId&&t?.documentId&&g?.userConfig?`${g?.userConfig}/${t?.userId}/${U.FIREBASE_PARTIAL_PATH_DOCUMENT_CONFIGURATIONS}/${t?.documentId}`:void 0;case"allComments":return!s&&t?.documentId&&g?.comment?`${g?.comment}`:void 0;case"allGlobalContacts":return t?.documentId&&g?.globalContacts?`${g?.globalContacts}`:void 0;case"globalContacts":return t?.documentId&&t?.userId&&g?.globalContacts?`${g?.globalContacts}${t?.userId}`:void 0;case"groupContacts":return t?.documentId&&t?.groupId&&g?.groupContacts?`${g?.groupContacts}${t?.groupId}`:void 0;case"groupContactsUser":return t?.documentId&&t?.groupId&&t?.userId&&g?.groupContacts?`${g?.groupContacts}${t?.groupId}/${t?.userId}`:void 0;case"allLoginContacts":return t?.documentId&&t?.userId&&g?.logins?`${g?.logins}${t?.userId}/contacts`:void 0;case"allLogins":return t?.documentId&&g?.logins?`${g?.logins}`:void 0;case"logins":return t?.documentId&&t?.userId&&g?.logins?`${g?.logins}${t?.userId}`:void 0;case"customerMetadata":return g?.customerMetadata?`${g?.customerMetadata}`:void 0;case"allArrows":return t?.documentId&&g?.arrow?`${g?.arrow}`:void 0;case"arrow":return t?.documentId&&g?.arrow&&t.id?`${g?.arrow}${t.id}`:void 0;case"allCursors":return t?.documentId&&g?.cursor?`${g?.cursor}`:void 0;case"cursor":return t?.documentId&&g?.cursor&&t.id?`${g?.cursor}${t.id}`:void 0;case"flockUser":return t?.documentId&&g?.flock&&t.id?`${g?.flock}users/${t.id}`:void 0;case"flockSession":return t?.documentId&&g?.flock&&t.id?`${g?.flock}sessions/${t.id}`:void 0;case"allHuddleAttendees":return t?.documentId&&g?.huddle?`${g?.huddle}attendees`:void 0;case"huddleAttendee":return t?.documentId&&g?.huddle&&t.id?`${g?.huddle}attendees/${t.id}`:void 0;case"huddleAttendeeState":return t?.documentId&&g?.huddle&&t.id?`${g?.huddle}attendees/${t.id}/state`:void 0;case"allHuddleInvitees":return t?.documentId&&g?.huddle?`${g?.huddle}invitees`:void 0;case"huddleConnection":return t?.documentId&&g?.huddle&&t.id?`${g?.huddle}connections/${t.id}`:void 0;case"huddleIceCandidate":return t?.documentId&&g?.huddle&&t.id?`${g?.huddle}iceCandidates/${t.id}`:void 0;case"allHuddleIceCandidates":return t?.documentId&&g?.huddle?`${g?.huddle}iceCandidates`:void 0;case"allHuddleMessages":return t?.documentId&&g?.huddle?`${g?.huddle}messages`:void 0;case"huddleMessage":return t?.documentId&&g?.huddle&&t.id?`${g?.huddle}messages/${t.id}`:void 0;case"allLiveStates":return t?.documentId&&g?.liveState?`${g?.liveState}`:void 0;case"allLiveStateCustoms":return t?.documentId&&g?.liveState?`${g?.liveState}custom`:void 0;case"liveStateCustom":return t?.documentId&&g?.liveState&&t?.id?`${g?.liveState}custom/${t.id}`:void 0;case"liveStateSingleEditorMode":return t?.documentId&&g?.liveStateSingleEditorMode?`${g?.liveStateSingleEditorMode}`:void 0;case"liveStateAutoSyncState":return t?.documentId&&g?.liveState?`${g?.liveState}default/autoSyncState`:void 0;case"liveStateAutoSyncStateCurrent":return t?.documentId&&g?.liveState?`${g?.liveState}default/autoSyncState/current`:void 0;case"liveStateAutoSyncStateHistoryId":return t?.documentId&&g?.liveState&&t?.id?`${g?.liveState}default/autoSyncState/history/${t.id}`:void 0;case"presence":return t?.documentId&&g?.presence&&t?.userId?`${g?.presence}${t?.userId}`:void 0;case"allPresence":return t?.documentId&&g?.presence?`${g?.presence}`:void 0;case"workspaceIam":return g?.workspaceIam?`${g?.workspaceIam}`:void 0;case"selection":return t?.documentId&&g?.selection&&t?.userId?`${g?.selection}${t?.userId}`:void 0;case"allSelections":return t?.documentId&&g?.selection?`${g?.selection}`:void 0;case"syncVideoPlayer":return t?.documentId&&g?.syncVideoPlayer?`${g?.syncVideoPlayer}`:void 0;case"allTags":return t?.documentId&&g?.tag?`${g?.tag}`:void 0;case"tag":return t?.documentId&&g?.tag&&t?.id?`${g?.tag}${t?.id}`:void 0;case"userContactUs":return t?.documentId&&g?.userContactUs?`${g?.userContactUs}`:void 0;case"userFeedback":return t?.documentId&&g?.userFeedback?`${g?.userFeedback}`:void 0;case"userReportBug":return t?.documentId&&g?.userReportBugs?`${g?.userReportBugs}`:void 0;case"comment":return!s&&t?.documentId&&t?.id&&g?.comment?`${g?.comment}${t?.id}`:void 0;case"allMultiThreads":return!s&&t?.documentId&&g?.multiThread?`${g?.multiThread}`:void 0;case"crdt":return!s&&t?.documentId&&g?.crdt?`${g?.crdt}`:void 0;case"crdtData":return t?.documentId&&g?.crdt&&t?.id?`${g?.crdt}/${t?.id}/data`:void 0;case"crdtSyncState":return t?.documentId&&g?.crdt&&t?.id?`${g?.crdt}/${t?.id}/sync/state`:void 0;case"crdtSyncPresence":return t?.documentId&&t.userId&&g?.crdt&&t?.id?`${g?.crdt}/${t?.id}/sync/presence/${t.userId}`:void 0;case"allCrdtSyncPresence":return t?.documentId&&g?.crdt&&t?.id?`${g?.crdt}/${t?.id}/sync/presence`:void 0;case"crdtPresence":return t?.documentId&&t.userId&&g?.crdt&&t?.id?`${g?.crdt}/${t?.id}/presence/${t.userId}`:void 0;case"allCrdtPresence":return t?.documentId&&g?.crdt&&t?.id?`${g?.crdt}/${t?.id}/presence`:void 0;case"crdtVersion":return t?.documentId&&g?.crdt&&t?.id&&t?.versionId?`${g?.crdt}/${t?.id}/versions/${t?.versionId}`:void 0;case"crdtVersions":return t?.documentId&&g?.crdt&&t?.id?`${g?.crdt}/${t?.id}/versions`:void 0;case"multiThread":return!s&&t?.documentId&&t?.id&&g?.multiThread?`${g?.multiThread}${t?.id}`:void 0;case"allLastNotificationTimestamp":return!s&&g?.organizationNotificationsLastNotificationTimestamp?`${g?.organizationNotificationsLastNotificationTimestamp}`:void 0;case"lastNotificationTimestamp":return!s&&t?.id&&g?.organizationNotificationsLastNotificationTimestamp?`${g?.organizationNotificationsLastNotificationTimestamp}${t?.id}`:void 0;case"documentIam":return!s&&t?.documentId&&g?.documentIam?`${g?.documentIam}`:void 0;case"allDocuments":return!s&&g?.docs&&t?.documentId?`${g?.docs}/${t?.documentId}/${U.FIREBASE_PARTIAL_PATH_METADATA}`:void 0;case"allAreas":return!s&&t?.documentId&&g?.area?`${g?.area}`:void 0;case"area":return!s&&t?.id&&g?.area?`${g?.area}${t?.id}`:void 0;case"folder":return!s&&t?.folderId&&g?.folder?`${g?.folder}${t?.folderId}`:void 0;case"documentUserAccess":return!s&&t?.id&&g?.documentIam?`${g?.documentIam}users/${t?.id}`:void 0;case"documentUser":return!s&&t?.documentId&&t?.id&&g?.documentIam?`${g?.documentIam}users/${t?.id}`:void 0;case"allDocumentUsers":return!s&&t?.documentId&&g?.documentIam?`${g?.documentIam}users/`:void 0;case"allOrganizationGroups":return!s&&g?.organizationGroups?`${g?.organizationGroups}`:void 0;case"allOrganizationUsers":return!s&&g?.organizationIam?`${g?.organizationIam}users/`:void 0;case"reaction":return!s&&t?.id&&g?.reaction?`${g?.reaction}${t?.id}`:void 0;case"allReactions":return!s&&t?.documentId&&g?.reaction?`${g?.reaction}`:void 0;case"recorder":return!s&&t?.documentId&&t?.id&&g?.recorder?`${g?.recorder}${t?.id}`:void 0;case"allRecorders":return!s&&t?.documentId&&g?.recorder?`${g?.recorder}`:void 0;case"organizationMetadata":return!s&&g?.organizationMetadata?`${g?.organizationMetadata}`:void 0;case"heartbeat":return t?.id&&g?.heartbeat?`${g?.heartbeat}${t?.id}`:void 0;case"allHeartbeats":return g?.heartbeat?`${g?.heartbeat}`:void 0;case"heartbeatByDocument":return t?.id&&g?.heartbeatByDocument?`${g?.heartbeatByDocument}${t?.id}`:void 0;case"allHeartbeatsByDocument":return g?.heartbeatByDocument?`${g?.heartbeatByDocument}`:void 0;case"documentAccessType":return!s&&g?.documentIam?`${g?.documentIam}`:void 0;case"documentMetadata":return!s&&t?.documentId&&g?.metadata?`${g?.metadata}`:void 0;case"allDocumentViews":return!s&&t?.documentId&&g?.views?`${g?.views}documentViews/`:void 0;case"documentViews":return!s&&t?.documentId&&t?.id&&g?.views?`${g?.views}documentViews/${t?.id}`:void 0;case"allLocationViews":return!s&&t?.documentId&&g?.views?`${g?.views}locationViews/`:void 0;case"notificationViewsTimestamp":return!s&&t?.id&&t?.user&&g?.views?`${g?.views}notification/${t?.id}/views/${t?.user}`:void 0;case"documentUsersViews":return!s&&t?.id&&t?.user&&t?.date&&g?.views?`${g?.views}documentViews/${t?.id}/users/${t?.user}/${t?.date}`:void 0;case"documentMetadataViews":return!s&&t?.id&&g?.views?`${g?.views}documentViews/${t?.id}/metadata`:void 0;case"documentDayViews":return!s&&t?.id&&t?.date&&t?.user&&g?.views?`${g?.views}documentViews/${t?.id}/day/${t?.date}/${t?.user}`:void 0;case"locationViews":return!s&&t?.id&&g?.views?`${g?.views}locationViews/${t?.id}/location`:void 0;case"location":return!s&&t?.id&&g?.views?`${g?.views}locationViews/${t?.id}`:void 0;case"locationUsersViews":return!s&&t?.id&&t?.user&&t?.date&&g?.views?`${g?.views}locationViews/${t?.id}/users/${t?.user}/${t?.date}`:void 0;case"locationMetadataViews":return!s&&t?.id&&g?.views?`${g?.views}locationViews/${t?.id}/metadata`:void 0;case"locationDayViews":return!s&&t?.id&&t?.date&&t?.user&&g?.views?`${g?.views}locationViews/${t?.id}/day/${t?.date}/${t?.user}`:void 0;case"docNotificationViews":case"docNotification":return t?.documentId&&t?.id&&g?.organizationNotificationsWithDocumentId?`${g?.organizationNotificationsWithDocumentId}${t?.id}`:void 0;case"allDocNotifications":return t?.documentId&&g?.organizationNotificationsWithDocumentId?`${g?.organizationNotificationsWithDocumentId}`:void 0;case"allUserNotifications":return t?.userId&&g?.organizationNotificationsUsers?`${g?.organizationNotificationsUsers}${t?.userId}`:void 0;case"userNotificationViews":case"userNotification":return t?.userId&&t?.id&&g?.organizationNotificationsUsers?`${g?.organizationNotificationsUsers}${t?.userId}/${t?.id}`:void 0;case"locationMetadata":return;case"allLocations":return;case"folderMetadata":return;case"allPermissionsUsers":return;default:throw new Error(`Unknown feature: ${e}`)}}catch(c){this.loggingService.catch("Error in CommonDbUtilsService getDocumentPath:",c);return}}resolveAnnotations(r){return Q(this,arguments,function*({data:e,feature:t}){try{if(e&&e?.length>0)switch(t){case"allComments":{if(this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable()){let a=vt();this.coreActionsService.triggerAction(ct.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:a,methodName:No.FORMAT_RESPONSE,source:"internal",payload:{commentAnnotationIds:e,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""}}),this.commentAnnotationsResolverService.resolveCommentAnnotations({commentAnnotationIds:e,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""},a)}break}case"allReactions":{if(this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable()){let a=vt();this.coreActionsService.triggerAction(ct.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:a,methodName:Ho.FORMAT_RESPONSE,source:"internal",payload:{reactionAnnotationIds:e,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""}}),this.reactionAnnotationsResolverService.resolveReactionAnnotations({reactionAnnotationIds:e,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""},a)}break}default:break}}catch(a){this.loggingService.catch(`Error in CommonDbUtilsService resolveAnnotations: ${t}`,a)}})}formatResponse(c){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"liveStateSingleEditorMode":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.liveStateUtilsService.getUserIdsToResolveFromLiveStateSingleEditorMode(t));break}case"allSelections":{t&&typeof t=="object"&&!Array.isArray(t)&&(p=this.selectionUtilsService.getUserIdsToResolveFromSelections(Object.values(t)));break}default:p=[]}if(p?.length){let g=vt();this.coreActionsService.triggerAction(ct.USER_RESOLVER,{event:Y.Events.Resolver.USER_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:g,methodName:Hr.FORMAT_RESPONSE,source:"internal",payload:{userIds:p,feature:e,forceResolve:a}}),r?yield this.usersService.resolveUsers({userIds:p,forceResolve:a,feature:e,uniqueId:g}):this.usersService.resolveUsers({userIds:p,forceResolve:a,feature:e,uniqueId:g})}}if(this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable()){let p=[];switch(e){case"allDocNotifications":{if(t&&typeof t=="object"){let g=this.notificationUtilsService.getTargetAnnotationIdsFromNotifications(t);p=[...p,...g],p=p.filter(f=>!this.commentAnnotationsResolverService.getCommentAnnotationById(f))}break}case"allUserNotifications":{if(t&&typeof t=="object"&&!Array.isArray(t)){let g=this.notificationUtilsService.getTargetAnnotationIdsFromNotifications(t);p=[...p,...g],p=p.filter(f=>!this.commentAnnotationsResolverService.getCommentAnnotationById(f))}break}default:p=[]}if(p?.length){let g=vt();this.coreActionsService.triggerAction(ct.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:g,methodName:No.FORMAT_RESPONSE,source:"internal",payload:{commentAnnotationIds:p,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??"",shouldCommentAnnotationsResolverAwait:s}}),s?yield this.commentAnnotationsResolverService.resolveCommentAnnotations({commentAnnotationIds:p,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""},g):this.commentAnnotationsResolverService.resolveCommentAnnotations({commentAnnotationIds:p,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""},g)}}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,c])=>(a[s]=this.commentUtilsService.mergeLocationWithCommentAnnotations(c,r),a),{}):e;case"allDocNotifications":case"allUserNotifications":return e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).reduce((a,[s,c])=>(a[s]=this.notificationUtilsService.mergeLocationWithNotification(c,r),a),{}):e;default:return e}return e}catch(a){return this.loggingService.catch("Error in CommonDbUtilsService mergeLocationMetadataWithData:",a),e}}mergeUsersWithData({feature:e,data: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"liveStateSingleEditorMode":return t&&typeof t=="object"&&!Array.isArray(t)?this.liveStateUtilsService.mergeSingleEditorLiveStateDataWithUser(t):t;case"allSelections":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((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}}),_t(Xt))}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}}),_t(Xt))}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}}),_t(Xt))}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}}),_t(Xt))}catch(r){return this.loggingService.catch(`Error in mergeLocationMetadataWithData for ${t}:`,r),se(e)}}handleDataStripping({feature:e,data:t,actionType:r,commentId:a}){try{switch(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: handleDataStripping","color: green;"),e){case"comment":return this.commentUtilsService.stripCommentAnnotationData({data:t,actionType:r,commentId:a});case"reaction":return this.reactionUtilsService.stripReactionAnnotationData(t);default:return{originalData:t,strippedData:null}}}catch(s){return this.loggingService.catch("Error in CommonDbUtilsService handleDataStripping:",s),{originalData:t,strippedData:null}}}formatData({feature:e,data:t,properties: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 c=new Date().getTime()+a;switch(e){case"documentAccessType":return delete t?.users,{docIamConfig:t};case"organizationMetadata":case"documentMetadata":return s?t:{metadata:t};case"documentCommentMetadata":return t;case"cursor":return this.cursorUtilsService.formatCursorUserData(t);case"comment":return this.commentUtilsService.formatCommentData(t);case"area":return this.areaUtilsService.formatAreaData(t);case"arrow":return this.arrowUtilsService.formatArrowData(t);case"liveStateCustom":return this.liveStateUtilsService.formatLiveStateCustomData(t);case"liveStateSingleEditorMode":return this.liveStateUtilsService.formatLiveStateSingleEditorModeData(t);case"multiThread":return this.multiThreadUtilsService.formatMultiThreadData(t);case"reaction":return this.reactionUtilsService.formatReactionData(t);case"recorder":return this.recorderUtilsService.formatRecorderData(t,c);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(c){return this.loggingService.catch("Error in CommonDbUtilsService formatData:",c),t}}modifyAndSetData(s){return Q(this,arguments,function*({feature:e,data:t,subscriber:r,operation:a=null}){try{let c=yield this.modifyData({feature:e,data:t});r.next({data:c,operation:a})}catch(c){this.loggingService.catch("Error in CommonDbUtilsService modifyAndSetData:",c)}})}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)?D(E({},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:c=null}){try{let f={comment:"allComments",reaction:"allReactions"}[e];if(!f)return null;let I=t?.metadata?.documentId,T=t?.metadata?.veltFolderId;return Object.keys(r).filter(L=>L.includes(f)&&(!I||L.includes(I)||T&&L.includes(T))).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:c})):r[L]?.subject?.next({data:D(E({},G?.data),{[t?.annotationId]:t}),operation:c})}),null}catch(g){return this.loggingService.catch("Error in CommonDbUtilsService setDataInLocal:",g),null}})}handleCommentEncryption(c){return Q(this,arguments,function*({data:e,firestorePath:t,extraData:r,eventType:a,metadata:s}){try{return yield this.commentUtilsService.handleCommentEncryption({data:e,firestorePath:t,extraData:r,eventType:a,metadata:s})}catch(p){return this.loggingService.catch("Error in CommonDbUtilsService handleCommentEncryption:",p),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}})}rtdbDefaultTransactionCallback(e,t){try{let r=E({},e||{});return Object.entries(t).forEach(([a,s])=>{s==null?delete r[a]:r[a]=s}),r}catch(r){return this.loggingService.catch("Error in CommonDbUtilsService rtdbDefaultTransactionCallback:",r),e}}};o.\u0275fac=function(t){return new(t||o)(ee(Spe),ee(bpe),ee(tu),ee(Ipe),ee(ni),ee(Epe),ee(u9),ee(h9),ee(y),ee(Dpe),ee(f9),ee(Ope),ee(Ape),ee(kC),ee(Ppe),ee(Mpe),ee(Ln),ee(rt),ee(Js),ee(vm))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var kpe=(()=>{let o=class o{constructor(e,t,r){this.configService=e,this.authService=t,this.loggingService=r,this.firestore$=new ve(null);try{mn([this.authService.getFirebaseConfig$(),this.configService.getApiKey$()]).pipe(Fe(([a,s])=>!!a&&!!s),ot(1)).subscribe(([a,s])=>{a&&s&&a?.firebaseOptions?.storeDbId&&this.firestore$.next(BR(Jg.getFirestoreProdDbName(s,a.firebaseOptions)))},a=>{})}catch{}}getFirestore(){return this.firestore$.asObservable()}getFirestoreValue(){return this.firestore$.value}generateFirestoreDocumentId(){try{let e=this.getFirestoreValue()||BR("DocumentIdDb");if(e){let t=RI(e,"generateDocumentId");return xC(t).id}return}catch(e){this.loggingService.catch("Error in FirestoreService generateFirestoreDocumentId: ",e);return}}};o.\u0275fac=function(t){return new(t||o)(ee(Ft),ee(je),ee(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var un=(()=>{let o=class o{constructor(e,t,r,a,s,c,p,g,f,I,T){this.authService=e,this.commonDbUtilsService=t,this.coreActionsService=r,this.loggingService=a,this.firestoreService=s,this.databaseService=c,this.configService=p,this.docService=g,this.usersService=f,this.commentAnnotationsResolverService=I,this.reactionAnnotationsResolverService=T,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(L=>{if(L){this.db=L;let G=Mi(L,".info/serverTimeOffset");this.offsetListener=wg(G,z=>{let J=z.val();this.offset=J})}})),this.subscriptions.push(this.firestoreService.getFirestore().subscribe(L=>{L&&(this.firestore=L)}))}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=Mi(this.db,e);return El(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){mn([this.databaseService.getDb(),this.firestoreService.getFirestore()]).pipe(Fe(([t,r])=>!!t),ot(1),on(([t,r])=>{e({db:t,firestore:r})})).subscribe({error:t=>{this.loggingService.catch("Error in CommonDbService subscription: ",t)}})}performDatabaseOperation(e,t,r,a,s,c){return Q(this,null,function*(){try{if(!t){this.loggingService.warn(`%c[WB] No properties found for ${e}`,"color: red;");return}return this.subscribeToServices(f=>Q(this,[f],function*({db:p,firestore:g}){let I;t?.skipFirestore||(I=this.commonDbUtilsService.getFirestorePath({feature:e,properties:t,documentPaths:this.docService.getDocumentPaths(),apiKey:t.apiKey??this.configService.getApiKey()}));let T=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{T&&(L=Mi(p,`${T}`))}catch{this.loggingService.catch("Error in dbRef")}try{I?.includes("/organizations")&&g&&I&&(G=xC(g,`${I}`))}catch{this.loggingService.catch("Error in docRef")}if(!this.authService.getUser())return;yield r({dbRef:L,firestoreRef:G,data:a,firestorePath:I}),c&&c({firestoreAvailable:!!g})}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:c}){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,g=>Q(this,null,function*(){if(g.dbRef){let f=this.commonDbUtilsService.formatData({feature:e,data:g.data,properties:r,offset:this.getOffset(),isRealtimeDb:!0});r?.rtdbTransaction?yield Hh(g.dbRef,()=>JSON.parse(JSON.stringify(f))):yield f0(g.dbRef,JSON.parse(JSON.stringify(f)))}try{if(g.firestoreRef&&g.data&&!r?.skipFirestore){let f=this.commonDbUtilsService.formatData({feature:e,data:g.data,properties:r,offset:this.getOffset()});typeof f=="object"&&(f=JSON.parse(JSON.stringify(f)));let{strippedData:I,originalData:T,eventType:L}=this.commonDbUtilsService.handleDataStripping({feature:e,data:f,actionType:c?.actionType,commentId:c?.targetAnnotationData?.commentId??r?.targetCommentId});if(e==="comment"){let G=null,z=vt();this.coreActionsService.triggerAction(ct.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:z,methodName:No.SET_DATA,source:"internal",payload:{strippedData:I,originalData:T,eventType:L,commentId:c?.targetAnnotationData?.commentId}}),I&&(G=yield this.commentAnnotationsResolverService.saveCommentAnnotation({commentAnnotation:I,eventType:L,commentId:c?.targetAnnotationData?.commentId},z)),T&&(G?.isSuccess||G===null)&&(yield this.commonDbUtilsService.handleCommentEncryption({data:T,firestorePath:g.firestorePath??"",extraData:c,metadata:r?.metadata}))}else if(e==="reaction"){let G=null,z=vt();this.coreActionsService.triggerAction(ct.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:z,methodName:Ho.SET_DATA,source:"internal",payload:{strippedData:I,originalData:T}}),I&&(G=yield this.reactionAnnotationsResolverService.saveReactionAnnotation(I,z)),T&&(G?.isSuccess||G===null)&&(yield this.commonDbUtilsService.handleReactionEncryption({data:T,firestorePath:g.firestorePath??""}))}else e==="recorder"?this.firestore&&(yield ope(this.firestore,G=>Q(this,null,function*(){G.set(g.firestoreRef,f)}))):yield NW(g.firestoreRef,f)}}catch(f){this.authService.getUser()&&this.loggingService.catch(`Error in setData for ${e}`,f)}}),t,s,a))}catch(g){this.loggingService.catch(`Error in setData for ${e}`,g)}})}updateData(p){return Q(this,arguments,function*({feature:e,data:t,properties:r,callback:a,errorCallback:s,extraData:c}){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,g=>Q(this,null,function*(){if(g.dbRef&&!r?.skipRtdb){let f=this.commonDbUtilsService.formatData({feature:e,data:g.data,properties:r,offset:this.getOffset(),isRealtimeDb:!0});r?.rtdbTransaction?yield Hh(g.dbRef,I=>{let T;return r?.rtdbTransactionCallback?T=r.rtdbTransactionCallback(I,f):T=this.commonDbUtilsService.rtdbDefaultTransactionCallback(I,f),JSON.parse(JSON.stringify(T))}):yield IM(g.dbRef,JSON.parse(JSON.stringify(f)))}try{if(g.firestoreRef&&g.data&&!r?.skipFirestore){let f=this.commonDbUtilsService.formatData({feature:e,data:g.data,properties:r,offset:this.getOffset()});typeof f=="object"&&(f=JSON.parse(JSON.stringify(f)));let{strippedData:I,originalData:T,eventType:L}=this.commonDbUtilsService.handleDataStripping({feature:e,data:f,actionType:c?.actionType,commentId:c?.targetAnnotationData?.commentId});if(e==="comment"){let G=null,z=vt();this.coreActionsService.triggerAction(ct.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:z,methodName:No.UPDATE_DATA,source:"internal",payload:{strippedData:I,originalData:T,eventType:L,commentId:c?.targetAnnotationData?.commentId}}),I&&(G=yield this.commentAnnotationsResolverService.saveCommentAnnotation({commentAnnotation:I,eventType:L,commentId:c?.targetAnnotationData?.commentId},z)),T&&(G?.isSuccess||G===null)&&(yield this.commonDbUtilsService.handleCommentEncryption({data:T,firestorePath:g.firestorePath??"",extraData:c,metadata:r?.metadata}))}else if(e==="reaction"){let G=null,z=vt();this.coreActionsService.triggerAction(ct.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:z,methodName:Ho.UPDATE_DATA,source:"internal",payload:{strippedData:I,originalData:T}}),I&&(G=yield this.reactionAnnotationsResolverService.saveReactionAnnotation(I,z)),T&&(G?.isSuccess||G===null)&&(yield this.commonDbUtilsService.handleReactionEncryption({data:T,firestorePath:g.firestorePath??""}))}else yield NW(g.firestoreRef,f,{merge:!0})}}catch(f){this.authService.getUser()&&this.loggingService.catch(`Error in updateDoc for ${e}`,f)}}),t,s,a))}catch(g){this.loggingService.catch(`Error in updateData for ${e}`,g)}})}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,c=>Q(this,null,function*(){c.dbRef&&(yield bM(c.dbRef));try{if(c.firestoreRef&&!t?.skipFirestore)if(e==="comment"){let p=null,g=vt();this.coreActionsService.triggerAction(ct.COMMENT_RESOLVER,{event:Y.Events.Resolver.COMMENT_DELETE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:g,methodName:No.DELETE_DATA,source:"internal",payload:{commentAnnotationId:t?.id??"",metadata:t?.metadata}}),p=yield this.commentAnnotationsResolverService.deleteCommentAnnotation(t?.id??"",t?.metadata,g),(p?.isSuccess||p===null)&&(yield this.commonDbUtilsService.handleCommentEncryption({firestorePath:c.firestorePath??"",eventType:"DELETE",metadata:t?.metadata}))}else if(e==="reaction"){let p=null,g=vt();this.coreActionsService.triggerAction(ct.REACTION_RESOLVER,{event:Y.Events.Resolver.REACTION_DELETE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:g,methodName:Ho.DELETE_DATA,source:"internal",payload:{reactionAnnotationId:t?.id??"",metadata:t?.metadata}}),p=yield this.reactionAnnotationsResolverService.deleteReactionAnnotation(t?.id??"",t?.metadata,g),(p?.isSuccess||p===null)&&(yield this.commonDbUtilsService.handleReactionEncryption({firestorePath:c.firestorePath??"",eventType:"DELETE"}))}else yield Jme(c.firestoreRef)}catch(p){this.authService.getUser()&&this.loggingService.catch(`Error in deleteData for ${e}`,p)}}),void 0,a,r)}catch(c){this.loggingService.catch(`Error in deleteData for ${e}`,c)}})}shouldUseFirestore(){try{return this.authService.getAdvancedQueriesEnabled()}catch(e){return this.loggingService.catch("Error in shouldUseFirestore:",e),!1}}generateDocumentId(){try{let e=this.firestoreService.generateFirestoreDocumentId();return e||(e=vt()),e||"noDocumentId"}catch(e){return this.loggingService.catch("Error in generateFirestoreDocumentId:",e),vt()||"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=RI(this.firestore,r);t?.useCollectionGroup&&(a=MW(this.firestore,r));let s=t?.firestoreQuery??[],c=RW(a,...s);if(!this.authService.getUser()&&!t?.skipUserCheck)return[];if(t?.getCount)try{let p=yield tpe(c).catch(g=>(this.authService.getUser()&&this.loggingService.catch(`Error in getCountFromServer for ${e}`,g),null));return p?p.data().count:0}catch(p){return this.authService.getUser()&&this.loggingService.catch(`Error in getCountFromServer for ${e}`,p),0}else try{let p=yield ipe(c).catch(f=>(this.authService.getUser()&&this.loggingService.catch(`Error in getDocs for ${e}`,f),null));if(!p)return[];let g=p.docs.map(f=>f.data());try{return yield this.commonDbUtilsService.modifyData({feature:e,data:g})}catch(f){return this.loggingService.catch(`Error in modifyData for ${e}`,f),g}}catch(p){return this.authService.getUser()&&this.loggingService.catch(`Error in getDocs for ${e}`,p),[]}}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=Mi(this.db,r),s=t?.rtdbQuery??[],c=a$(a,...s);if(!this.authService.getUser()&&!t?.skipUserCheck)return[];let p=yield o$(c).catch(f=>(this.authService.getUser()&&this.loggingService.catch(`Error in get for ${e}`,f),null));if(!p)return[];let g=p.val();return g?t?.skipObjectValues?g:Object.values(g??{}):[]}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 this.loggingService.catch("User not set. [source: getData]",void 0,void 0,!0),{};let c=yield npe(xC(this.firestore,s)).catch(g=>(this.authService.getUser()&&this.loggingService.catch(`Error in getDoc for ${e}`,g),this.commonDbUtilsService.getErrorForGetRequests({feature:e,error:g})));if(c){if(c?.errorCode)return c}else return this.loggingService.warn(`[WB] No document found at ${s}`),{};let p=c.data();return t?.field?p?.[t.field]??{}:p??{}}catch(c){return this.loggingService.catch(`Error fetching Firestore data for ${e}:`,c),{}}}if(this.db){let s=this.commonDbUtilsService.getDocumentPath({feature:e,properties: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 c=yield o$(Mi(this.db,s)).catch(g=>(this.authService.getUser()&&this.loggingService.catch(`Error in get for ${e}`,g),this.commonDbUtilsService.getErrorForGetRequests({feature:e,error:g})));if(c){if(c?.errorCode)return c}else return this.loggingService.warn(`[WB] No data found at ${s}`),{};let p=c.val();return t?.field?p?.[t.field]??{}:p??{}}catch(c){return this.loggingService.catch(`Error fetching RTDB data for ${e}:`,c),{}}}return this.loggingService.warn("[WB] No database connection available"),{}}catch(a){return this.loggingService.catch("Unexpected error in getData:",a),{}}})}dbListener({feature:e,properties:t}){let r=this.shouldUseFirestore();t?.skipFirestore&&(r=!1);let a=`${e}-${JSON.stringify(t)}`;return mn([this.databaseService.getDb(),this.firestoreService.getFirestore(),this.authService.getUser$().pipe(Fe(s=>!!s))]).pipe(Fe(([s,c])=>s?r&&!c?(this.loggingService.warn(`[WB] Firestore requested but not available for ${e}`),!1):!0:(this.loggingService.warn(`[WB] No database found for ${e}`),!1)),fe(([s,c])=>{try{if(r&&c){if(!!!this.observablesCache[a]){this.observablesCache[a]={subject:new ve({}),count:0};let f=this.handleFirestoreListener(e,t,c).subscribe(I=>{this.observablesCache[a]?.subject?.next(I)},I=>this.observablesCache[a]?.subject?.error(I));this.firestoreSubscriptions[a]=f}return new $t(g=>{let f=this.observablesCache[a]?.subject?.subscribe(I=>g.next(I),I=>g.error(I),()=>g.complete());return this.observablesCache[a].count+=1,()=>{f?.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 f=this.handleRealtimeDbListener(e,t,s).subscribe(I=>{this.observablesCache[a]?.subject?.next(I)},I=>this.observablesCache[a]?.subject?.error(I));this.rtdbSubscriptions[a]=f}return new $t(g=>{let f=this.observablesCache[a]?.subject?.subscribe(I=>g.next(I),I=>g.error(I),()=>g.complete());return this.observablesCache[a].count+=1,()=>{f?.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({})}}),Hu(()=>{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 $t(c=>{let p=t.isCollection?this.setupCollectionListener(r,a,e,c,t):this.setupDocumentListener(r,a,e,c,t);return()=>{c.complete(),c.unsubscribe(),p(),this.observablesCache[s]?.subject?.complete(),this.observablesCache[s]?.subject?.unsubscribe(),delete this.observablesCache[s]}}).pipe(fe(c=>this.commonDbUtilsService.mergeUsersWithData$({feature:e,data:c})),fe(c=>["allComments","allUserNotifications"].includes(e)?this.commonDbUtilsService.mergeCommentAnnotationsWithData$({data:c,feature:e}):se(c)),fe(c=>["allReactions"].includes(e)?this.commonDbUtilsService.mergeReactionAnnotationsWithData$({data:c,feature:e}):se(c)),_t(Xt)):(this.loggingService.warn(`[WB] No firestore path found for ${e} and key ${s}`),se({}))}setupCollectionListener(e,t,r,a,s){let c=`${r}-${JSON.stringify(s)}`,p=RI(e,t);if(s?.useCollectionGroup&&(p=MW(e,t)),s?.useQuery&&s?.firestoreQuery){let I=s?.firestoreQuery??[];p=RW(p,...I)}let g=!0,f=[];return r==="allComments"&&this.loggingService.logContext("[CONTEXT] setupCollectionListener called with path:",t,"feature:",r,"properties:",JSON.stringify(s??"nil")),kW(p,I=>{try{let T=JSON.parse(JSON.stringify(this.observablesCache[c]?.subject?.getValue()?.data??{})),L=null,G=!1;I?.docChanges()?.length?I.docChanges().forEach(z=>{["allComments","allReactions"].includes(r)&&!g&&z.type!=="removed"&&f.push(z.doc.id),this.commonDbUtilsService.isDataAlreadyProcessedInLocalCache({feature:r,change:z,cache:this.observablesCache[c]?.subject?.getValue()?.data??{}})||(G=!0,Object.assign(T,this.handleCollectionChange(z,T)),z.type==="removed"&&(L||(L={type:z.type,ids:[]}),L.ids.push(z.doc.id)))}):G=!0,G&&(["allComments","allReactions"].includes(r)&&f?.length&&(this.commonDbUtilsService.resolveAnnotations({data:f,feature:r}),f=[]),this.commonDbUtilsService.modifyAndSetData({feature:r,data:T,subscriber:a,operation:L})),g=!1}catch(T){this.handleListenerError(T,r,a)}},I=>this.handleListenerError(I,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 c=xC(e,t);return kW(c,p=>{try{let g=p.data()||{};s?.field&&(g=g?.[s?.field]??{}),this.commonDbUtilsService.modifyAndSetData({feature:r,data:g,subscriber:a,operation:null})}catch(g){this.handleListenerError(g,r,a)}},p=>this.handleListenerError(p,r,a))}handleListenerError(e,t,r){this.loggingService.catch(`Firestore listener error for ${t}:`,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=Mi(r,a);if(t?.useQuery&&t?.rtdbQuery){let c=t?.rtdbQuery??[];s=a$(s,...c)}return this.objectValFromChildEvents(s,e).pipe(zn(c=>(this.loggingService.catch(`RTDB listener error for ${e}:`,c),se({}))),de(c=>(c===null&&(c={}),c&&typeof c=="object"?Object.entries(c??{}).reduce((g,[f,I])=>(g[f]=this.commonDbUtilsService.addMetadata(I,t),g),{}):this.commonDbUtilsService.addMetadata(c,t))),fe(c=>this.commonDbUtilsService.modifyData({feature:e,data:c})),fe(c=>this.usersService.getUserById$().pipe(de(()=>({data:this.commonDbUtilsService.mergeUsersWithData({feature:e,data:c}),operation:null})))))}objectValFromChildEvents(e,t){return new $t(r=>{let a={},s=!1,c=null,p=z=>{try{this.loggingService.catch(`Realtime DB listener error for ${t}:`,z),r.error(z)}catch{}},g=z=>{try{if(!ui(z,c)){let J=JSON.parse(JSON.stringify(z));c=J,r.next(J)}}catch{}},f=z=>{try{z.key&&(a[z.key]=z.val(),s&&g(E({},a)))}catch{}},I=z=>{try{z.key&&(a[z.key]=z.val(),s&&g(E({},a)))}catch{}},T=z=>{try{z.key&&(delete a[z.key],s&&g(E({},a)))}catch{}},L=z=>{try{if(!s){let J=a&&typeof a=="object"?JSON.parse(JSON.stringify(a)):{};c=J,r.next(J),s=!0}}catch{}};hre(e,f,p),fre(e,I,p),vre(e,T,p);let G=wg(e,L,p,{onlyOnce:!0});return()=>{try{G&&typeof G=="function"&&G(),SM(e,"child_added",f),SM(e,"child_changed",I),SM(e,"child_removed",T)}catch{}}})}};o.\u0275fac=function(t){return new(t||o)(ee(je),ee(Cm),ee(ni),ee(y),ee(kpe),ee(In),ee(Ft),ee(rt),ee(Ln),ee(Js),ee(vm))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Si=(()=>{let o=class o{constructor(e,t,r,a,s,c,p,g,f){this.analyticsService=e,this.authService=t,this.configService=r,this.coreActionsService=a,this.databaseService=s,this.docService=c,this.loggingService=p,this.commonDbService=g,this.usersService=f,this.db=Ss(),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.userAccessFields$=new ve({}),this.userOrganizationContacts$=new ve([]),this.userFolderContacts$=new ve([]),this.userDocumentContacts$=new ve([]),this.userOrganizationGroups$=new ve([]),this.onContactSelectedSubject$=new nt,this.documentAccessType=null,this.atHereEnabled$=new ve(!1),this.atHereLabel$=new ve("here"),this.atHereDescription$=new ve(null),this.contactListScopeForOrganizationUsers$=new ve([Wi.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(fe(I=>this.docService.getDocumentPaths$().pipe(on(T=>{this.documentPaths=T}),de(()=>I)))).subscribe(I=>Q(this,null,function*(){if(this.user=I,I&&this.documentPaths)if(!I?.organizationId)this.getLoggedInUsers$().subscribe(),this.getUserContactsFromDb$(),yield this.migrateLoggedInUserFromEmailToUserIdPath(I),this.setLoggedInUser(I),yield this.moveGlobalContactUserFromEmailToUserIdPath(I),this.updateUserInGlobalContactsIfAvailable(I),I?.groupId&&(yield this.migrateGroupContactsFromEmailToUserIdPath(I?.groupId)),this.checkToSetLoggedInUserInGroupContacts();else{let T=this.userPermissionService?.getCurrentUserPermissions(),L=this.documentPaths.folderId,G=!0;L&&T?.[I?.userId]?.folders?.[L]?.errorCode===Lo.PERMISSION_DENIED&&(G=!1),this.getOrganizationContactsFromDb$(),G&&this.getFolderContactsFromDb$(),this.getDocumentContactsFromDb$(),this.getOrganizationGroupsFromDb$(),this.getTemporaryUsers()}else this.getUserContactSubscription?.unsubscribe(),this.getUserContactSubscription=void 0,this.getLoggedInUsersSubscription?.unsubscribe(),this.getLoggedInUsersSubscription=void 0,this.getOrganizationContactsSubscription?.unsubscribe(),this.getOrganizationContactsSubscription=void 0,this.getFolderContactsSubscription?.unsubscribe(),this.getFolderContactsSubscription=void 0,this.getDocumentContactsSubscription?.unsubscribe(),this.getDocumentContactsSubscription=void 0,this.getOrganizationGroupsSubscription?.unsubscribe(),this.getOrganizationGroupsSubscription=void 0}),I=>{this.loggingService.catch("Error in ContactService constructor getUser$: ",I)}),this.databaseService.getDb().pipe(Fe(I=>!!I),ot(1)).subscribe(I=>{I&&(this.db=I)},I=>{this.loggingService.catch("Error in ContactService constructor getDb: ",I)}),this.getOrganizationGroups$().subscribe(I=>{this.authService.setOrganizationUserGroups(I)}),mn([this.getInternalUserContacts$(),this.getCustomUserContacts$(),this.getCustomUserContactsConfig$()]).subscribe(([I,T,L])=>{T?L?.merge?this.userContacts$.next([...I||[],...T||[]]):this.userContacts$.next(T||[]):this.userContacts$.next(I||[])}),this.getUserContacts$().subscribe(I=>{try{I?.forEach(T=>{let L=T?.userSnippylyId||K0(this.configService.getApiKey(),T.userId);L&&this.userSnippylyIdContacts$.next(D(E({},this.userSnippylyIdContacts$.value),{[L]:T}))})}catch{}})}setUserPermissionService(e){try{this.userPermissionService=e}catch(t){this.loggingService.catch("Error in ContactService setUserPermissionService: ",t)}}clearCache(){this.loggingService.log("%c[WB] Calling FUNCTION: clearCache in ContactService","color: green;");try{this.documentPaths=null,this.usersByOrganizationId$.next({}),this.temporaryUserIds$.next([]),this.usersByOrganizationIdAndFolderId$.next({}),this.usersByOrganizationIdAndDocumentId$.next({}),this.userById$.next({}),this.userOrganizationContacts$.next([]),this.userFolderContacts$.next([]),this.userDocumentContacts$.next([]),this.userOrganizationGroups$.next([]),this.userContacts$.next([]),this.userSnippylyIdContacts$.next(null),this.userGlobalContact$.next(!1),this.userGroupContact$.next(null),this.users$.next([]),this.userPersonalContacts=[],this.userGroupContacts=[],this.userGlobalContacts=[],this.users=[]}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:Tt(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:Tt(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:Tt(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(D(E({},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:Tt(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 c=r.contacts[s];if(c?.userId){let p=Tt(c?.userId);a[p]=c}}),r.contacts=a}yield this.commonDbService.updateData({feature:"logins",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Tt(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:Tt(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:Tt(e?.userId),skipFirestore:!0},data:JSON.parse(JSON.stringify(e))})}catch(t){this.loggingService.catch("Error in ContactService addGlobalContact: ",t)}}getUserAccessFields(){return JSON.parse(JSON.stringify(this.userAccessFields$.value))}getUserAccessFieldsByUserId(e){return this.getUserAccessFields()?.[e]}setUserAccessFields(e){try{let t=this.getUserAccessFields();e.forEach(a=>{t[a.user.userId]=a.accessFields||[]});let r=this.authService.getUser()?.userId;if(r&&t?.[r]?.length){let a=this.userPermissionService?.getCurrentUserPermissions();a&&(a[r]||(a[r]={}),a[r].context={accessFields:t[r]},this.userPermissionService?.setCurrentUserPermissions(a))}this.userAccessFields$.next(JSON.parse(JSON.stringify(t)))}catch(t){this.loggingService.catch("Error in ContactService setUserAccessFields: ",t)}}updateUserInGlobalContactsIfAvailable(e){return Q(this,null,function*(){try{if(e?.userId&&this.documentPaths?.globalContacts&&(yield this.checkIfUserGlobalContact(e))){let r=new zo;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:Tt(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:Tt(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:Tt(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:Tt(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(c=>c?.visibility!=="group"),s=!1;this.authService.getUserOptions()&&(s=!!this.authService.getUserOptions()?.replaceContacts||!!this.authService.getUserOptions()?.replacePrivateContacts),a?.length?(r={},a?.forEach(c=>{if(c?.userId){let p=Tt(c?.userId);r[p]=c}}),s?this.commonDbService.setData({feature:"allLoginContacts",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",userId:Tt(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:Tt(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:Tt(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&&Tt(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:Tt(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(ot(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===xi.PUBLIC)r=!0;else if(a===xi.RESTRICTED){let s=Tt(this.user?.userId);if(t?.users?.[s]&&(r=!0),this.user?.email){let c=Tt(this.user?.email);t?.users?.[c]&&(r=!0)}}if(r){let s=new Dp;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:Tt(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:Tt(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?mn([this.usersByOrganizationId$,this.usersByOrganizationIdAndFolderId$,this.usersByOrganizationIdAndDocumentId$,this.userById$,this.customUserContacts$,this.customUserContactsConfig$,this.getContactListScopeForOrganizationUsers$(),this.temporaryUserIds$]).pipe(de(([s,c,p,g,f,I,T,L])=>{let G={},z=!1;I&&!I?.merge&&(z=!0);let J=Ve=>T.some(be=>Ve.includes(be)),le=J([Wi.ALL,Wi.ORGANIZATION])?Object.keys(s?.[t]||{}):[],_e=a?J([Wi.ALL,Wi.FOLDER])?Object.keys(c?.[t]?.[a]||{}):[]:[],De=J([Wi.ALL,Wi.DOCUMENT])?Object.keys(p?.[t]?.[r]||{}):[];if([...le,..._e||[],...De,...L].forEach(Ve=>{let be=g?.[Ve];be&&(G[Ve]=be)}),f){let{merge:Ve,options:be}=I||{},{organizationId:Se,documentId:Ae,folderId:Ce}=be||{},he=Ce?$i(Ce):void 0;(!Se||Se===t)&&(!Ae||Ae===r)&&(!he||he===a)&&(Ve||(G={}),f.forEach(Oe=>{Oe?.userId&&(G[Oe.userId]=Oe)}))}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()}getUserBySnippylyId(e){return this.userSnippylyIdContacts$.value?.[e]}getAtHereLabel(){return this.atHereLabel$.asObservable()}getAtHereDescription(){return this.atHereDescription$.asObservable()}getUserContactsFromDb$(){this.getUserContactSubscription||(this.getUserContactSubscription=this.authService.getUser$().pipe(Fe(e=>!!e),fe(e=>this.docService.getDocumentPaths$().pipe(Fe(t=>!!t),on(t=>{this.documentPaths=t}),de(()=>e))),fe(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),on(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),on(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:Tt(e?.userId)}}).pipe(de(r=>r?.data),on(r=>{r?this.userPersonalContacts=Object.values(r??{}):this.userPersonalContacts=[]}))),Uo(...t).pipe(Co(this.authService.getUser$().pipe(Fe(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().pipe(_t(Xt))}isUserGlobalContact(){return this.userGlobalContact$.value}isUserGroupContact$(){return this.userGroupContact$.asObservable()}isUserGroupContact(){return this.userGroupContact$.value}getLoggedInUsers$(){return this.getLoggedInUsersSubscription||(this.getLoggedInUsersSubscription=this.authService.getUser$().pipe(fe(e=>e?this.documentPaths?e?.userId&&this.documentPaths?.logins?this.commonDbService.dbListener({feature:"allLogins",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}}).pipe(de(t=>t?.data),on(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(fe(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(Fe(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:[ft("expiresAt",">",new Date().getTime())]}}))??[]).filter(a=>a?.userId!==e?.userId);if(r?.length){let a=r.map(p=>p?.userId),s=vt();this.coreActionsService.triggerAction(ct.USER_RESOLVER,{event:Y.Events.Resolver.USER_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:s,methodName:Hr.GET_TEMPORARY_USERS,source:"internal",payload:{userIds:a}});let c=yield this.usersService.resolveUsers({userIds:a,uniqueId:s});if(c){let p={};Object.entries(c).forEach(([f,I])=>{p[f]=I}),this.userById$.next(E(E({},this.userById$.value),p));let g=new Set([...this.temporaryUserIds$.value,...Object.keys(p)]);this.temporaryUserIds$.next(Array.from(g))}}}}))}catch(e){this.loggingService.catch("Error in ContactService getTemporaryUsers: ",e)}}getOrganizationContactsFromDb$(){try{this.getOrganizationContactsSubscription||(this.getOrganizationContactsSubscription=this.authService.getUser$().pipe(fe(e=>e?.organizationId?se(e).pipe(fe(t=>this.docService.getOrganizationConfig$().pipe(Fe(r=>!!r),de(()=>t))),fe(t=>this.usersService.getResolveOrganizationUsers$().pipe(Fe(r=>r),de(()=>t))),fe(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:[yi($R(ft("organizationIds","array-contains-any",[r]),ft("viewerOrganizationIds","array-contains-any",[r]))),Ji("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.setUserAccessFields(s),this.setUserOrganizationContacts(s,r)}else this.setUserOrganizationContacts([],r)})):se():se()}),fe(()=>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(fe(e=>e?se(e).pipe(fe(t=>this.docService.getOrganizationConfig$().pipe(Fe(r=>!!r),de(()=>t))),fe(t=>this.usersService.getResolveFolderUsers$().pipe(Fe(r=>r),de(()=>t))),fe(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:[yi($R(ft("folderIds","array-contains-any",[this.documentPaths?.veltFolderId]),ft("viewerFolderIds","array-contains-any",[this.documentPaths?.veltFolderId]))),Ji("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 c=Object.values(s??{});this.setUserAccessFields(c),this.setUserFolderContacts(c)}else this.setUserFolderContacts([])}))}),fe(()=>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(fe(e=>e?se(e).pipe(fe(t=>this.docService.getDocumentPaths$().pipe(Fe(r=>!!r),on(r=>{this.documentPaths=r}),de(()=>t))),fe(t=>this.usersService.getResolveDocumentUsers$().pipe(Fe(r=>r),de(()=>t))),fe(t=>(this.setUserDocumentContacts([]),t?this.documentPaths?this.docService.getDocumentIds$().pipe(fe(r=>{let a=r?.length>0?r.map(g=>g.documentId):[this.documentPaths?.documentId??""];if(a.some(g=>!g)||!this.documentPaths)return se();let s=se([]),c={isCollection:!0,useQuery:!0};this.commonDbService.shouldUseFirestore()||(c.documentId=a?.length?a[0]:void 0,c.organizationId=this.documentPaths?.organizationId);let p=[];for(let g=0;g<a.length;g+=U.LISTENER_BATCH_SIZE)p.push(a.slice(g,g+U.LISTENER_BATCH_SIZE));return s=mn(p.map(g=>this.commonDbService.dbListener({feature:"allDocumentUsers",properties:D(E({},c),{firestoreQuery:[yi($R(ft("documentIds","array-contains-any",g),ft("viewerDocumentIds","array-contains-any",g))),Ji("id")]})}).pipe(Or()))).pipe(de(g=>na(g)?.data)),s.pipe(de(g=>{if(g){typeof g=="object"&&(g?.undefined&&delete g.undefined,g?.null&&delete g.null);let f=Object.values(g??{});this.setUserAccessFields(f),this.setUserDocumentContacts(f)}else this.setUserDocumentContacts([])}))})):se():se())),fe(()=>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 c={};e.forEach(p=>{s[t][p.user.userId]=p,c[p.user.userId]=p.user}),this.userById$.next(E(E({},this.userById$.value),c)),this.usersByOrganizationId$.next(D(E({},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(fe(()=>this.checkContactListScopeForOrganizationUsers([Wi.ALL,Wi.ORGANIZATION])?this.userOrganizationContacts$.asObservable():se([])))}getUserOrganizationContacts(){return this.checkContactListScopeForOrganizationUsers([Wi.ALL,Wi.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:c}=s?.metadata||{};c&&(r[c]||(r[c]={}),s.folderIds?.forEach(p=>{r[c][p]||(r[c][p]={}),r[c][p][s.user.userId]=s,a[s.user.userId]=s.user}))}),this.userById$.next(E(E({},this.userById$.value),a)),this.usersByOrganizationIdAndFolderId$.next(r)}catch(t){this.loggingService.catch("Error in ContactService updateUserFolderContacts: ",t)}}getUserFolderContacts$(){return this.getContactListScopeForOrganizationUsers$().pipe(fe(()=>this.checkContactListScopeForOrganizationUsers([Wi.ALL,Wi.FOLDER])?this.userFolderContacts$.asObservable():se([])))}getUserFolderContacts(){return this.checkContactListScopeForOrganizationUsers([Wi.ALL,Wi.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:c}=s?.metadata||{};c&&(r[c]||(r[c]={}),s.documentIds?.forEach(p=>{r[c][p]||(r[c][p]={}),r[c][p][s.user.userId]=s,a[s.user.userId]=s.user}))}),this.userById$.next(E(E({},this.userById$.value),a)),this.usersByOrganizationIdAndDocumentId$.next(r)}catch(t){this.loggingService.catch("Error in ContactService updateUserDocumentContacts: ",t)}}getUserDocumentContacts$(){return this.getContactListScopeForOrganizationUsers$().pipe(fe(()=>this.checkContactListScopeForOrganizationUsers([Wi.ALL,Wi.DOCUMENT])?this.userDocumentContacts$.asObservable():se([])))}getUserDocumentContacts(){return this.checkContactListScopeForOrganizationUsers([Wi.ALL,Wi.DOCUMENT])?this.userDocumentContacts$.value:[]}getCurrentOrganizationUserIAM$(){return this.currentOrganizationUserIAM$.asObservable()}getCurrentOrganizationUserIAM(){return this.currentOrganizationUserIAM$.value}mergeOrganizationAndDocumentContacts(){try{let e=[];this.getContactListScopeForOrganizationUsers().includes(Wi.ALL)?e=[...this.getUserOrganizationContacts(),...this.getUserFolderContacts(),...this.getUserDocumentContacts()]:this.getContactListScopeForOrganizationUsers().includes(Wi.ORGANIZATION)?e=[...this.getUserOrganizationContacts()]:this.getContactListScopeForOrganizationUsers().includes(Wi.FOLDER)?e=[...this.getUserFolderContacts()]:this.getContactListScopeForOrganizationUsers().includes(Wi.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(fe(e=>e?.organizationId?se(e).pipe(fe(t=>this.docService.getOrganizationConfig$().pipe(Fe(r=>!!r),de(()=>t))),fe(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 xi.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(fe(()=>this.checkContactListScopeForOrganizationUsers([Wi.ALL,Wi.ORGANIZATION_USER_GROUP])?this.userOrganizationGroups$.asObservable():se([])))}enableAtHere(){try{if(this.analyticsService.setFeatureConfig({feature:Re.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:Re.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:Re.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:Re.COMMENT,config:{atHereEnabled:!1}}),this.atHereEnabled$.value===!1)return;this.atHereEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in ContactService disableAtHere: ",e)}}getAtHereEnabled$(){return this.getContactListScopeForOrganizationUsers$().pipe(fe(()=>this.checkContactListScopeForOrganizationUsers([Wi.ALL,Wi.DOCUMENT])?this.atHereEnabled$.asObservable():se(!1)))}getAtHereEnabled(){return this.checkContactListScopeForOrganizationUsers([Wi.ALL,Wi.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{this.analyticsService.trackEvent(Y.Events.Contact.UPDATE_CONTACT_LIST_TRIGGERED,{contactsCount:e?.length,config:t}),this.usersService.setUserByIds(e),this.customUserContacts$.next(e),this.customUserContactsConfig$.next(t)}catch(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=D(E({},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(fe(e=>e?mn([this.userOrganizationContacts$.asObservable(),this.userFolderContacts$.asObservable(),this.userDocumentContacts$.asObservable(),this.userOrganizationGroups$.asObservable(),this.customUserContacts$.asObservable()]).pipe(de(([t,r,a,s,c])=>{let p={};p.organizationUsers=t?.map(f=>this.convertToClientUser(f)),p.folderUsers=r?.map(f=>this.convertToClientUser(f)),p.documentUsers=a?.map(f=>this.convertToClientUser(f)),p.updatedContactList=c?.map(f=>this.convertToClientUser(f));let g=[];return s?.forEach(f=>{let I=this.convertToClientUserGroup(f,p.organizationUsers||[]);I&&g.push(I)}),p.userGroups=g,p}),_t(Xt)):se(null)),zn(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 c=Tt(s.userId);a[c]=s}}),Object.keys(e?.users??{}).forEach(s=>{a[s]&&r.users?.push(a[s])}),r}catch(r){return this.loggingService.catch("Error in ContactService convertToClientUserGroup: ",r),null}}convertToClientUser(e){try{return e&&(e=JSON.parse(JSON.stringify(e)),e?.clientGroupId&&(e.groupId=e.clientGroupId,delete e.clientGroupId),e?.clientOrganizationId&&(e.organizationId=e.clientOrganizationId,delete e.clientOrganizationId),e?.userSnippylyId&&delete e.userSnippylyId),e}catch(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)(ee(tt),ee(je),ee(Ft),ee(ni),ee(In),ee(rt),ee(y),ee(un),ee(Ln))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Rpe=i=>{try{let o={USE_PROFILES:{svg:!0,svgFilters:!0},FORBID_ATTR:["onerror","onload","onclick","onmouseover","onmouseout","onmouseenter","onmouseleave","onmousemove","onmousedown","onmouseup","onwheel","onscroll","onkeydown","onkeyup","onkeypress","onfocus","onblur","onchange","onsubmit","on*"],FORBID_TAGS:["script","style","iframe","object","embed","form"]};return qI.sanitize(i,o)}catch(o){return et.catch("Error in File utils sanitizeSvg: ",o),""}},Npe=i=>{try{return i.name.split(".").slice(0,-1).join(".")}catch(o){et.catch("Error in File utils getFileName: ",o);return}},qW=i=>{try{return/(?:\.([^.]+))?$/.exec(i?.name)[1]}catch(o){et.catch("Error in File utils getFileExtension: ",o);return}},Fpe=(i,o)=>{try{let n=i.slice(0,-1,i.type);return new File([n],o+"."+qW(i),{type:i.type})}catch(n){et.catch("Error in File utils updateFile: ",n);return}},Lpe=i=>new Promise((o,n)=>{let e=new FileReader;e.readAsDataURL(i),e.onload=()=>{o(e.result)},e.onerror=t=>{n(t)}}),YW={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 nu=(()=>{let o=class o{constructor(e,t,r,a,s){this.authService=e,this.configService=t,this.coreActionsService=r,this.loggingService=a,this.attachmentResolverService=s,this.storage=wb();try{this.configService.getApiKey$().subscribe(c=>{this.apiKey=c}),this.authService.getFirebaseConfig$().subscribe(c=>{c&&c.firebaseOptions?.storageBucket&&(this.storage=wb(void 0,c?.firebaseOptions?.storageBucket))},c=>{this.loggingService.catch("Error in StorageService constructor: ",c)})}catch(c){this.loggingService.catch("Error in StorageService constructor:",c)}}createAttachment({path:e,file:t}){try{let r=new TC;r.name=t.name;let a=Fpe(t,`${r.attachmentId}_${Npe(t)}`),s=`${this.apiKey}/${e}/${a?.name}`;return r.bucketPath=s,r.size=t.size,r.type=qW(t),r?.type&&(r.mimeType=YW[r?.type]),r}catch(r){return this.loggingService.catch("Error in StorageService createAttachment: ",r),null}}sanitizeSvgFile(e){return Q(this,null,function*(){if(e.type===YW.svg)try{let t=yield e.text(),r=Rpe(t);return new File([r],e.name,{type:e.type})}catch(t){return this.loggingService.catch("Error in StorageService sanitizeSvgFile: ",t),e}return e})}uploadAttachmentToStorage(s){return Q(this,arguments,function*({attachment:e,file:t,resolve:r,reject:a}){try{let c=Ob(this.storage,e.bucketPath),p=M$(c,t,{cacheControl:"public,max-age=3600"});p.on("state_changed",g=>{let f=g.bytesTransferred/g.totalBytes*100},g=>{a(g)},()=>{P$(p.snapshot.ref).then(g=>{e.url=g,r(e)})})}catch(c){this.loggingService.catch("Error in StorageService uploadAttachmentToStorage: ",c),a(c)}})}uploadToResolver(c){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},g=vt();this.coreActionsService.triggerAction(ct.ATTACHMENT_RESOLVER,{event:Y.Events.Resolver.ATTACHMENT_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:g,methodName:kl.UPLOAD_TO_RESOLVER,source:"internal",payload:{attachment:p,eventType:va.ATTACHMENT_ADD}});let f=yield this.attachmentResolverService.saveAttachment({attachment:p,eventType:va.ATTACHMENT_ADD},g);f&&f.data?.url?(t.url=f.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,c)=>Q(this,null,function*(){try{if(!this.apiKey)throw new Error("API key not configured");let p=yield this.sanitizeSvgFile(t),g=this.createAttachment({path:e,file:p});if(!g)throw new Error("Attachment not created");r?this.uploadToResolver({file:p,attachment:g,metadata:a,resolve:s,reject:c}):this.uploadAttachmentToStorage({attachment:g,file:p,resolve:s,reject:c})}catch(p){this.loggingService.catch("Error in StorageService uploadFile:",p),c(p)}}))}uploadChunk(e,t,r){return new Promise((a,s)=>{try{if(this.apiKey){let c=`${this.apiKey}/${e}/${t.name}`,p=Ob(this.storage,c),g=M$(p,t,{cacheControl:"public,max-age=3600"});g.on("state_changed",f=>{let I=f.bytesTransferred/f.totalBytes*100},f=>{s(f)},()=>{P$(g.snapshot.ref).then(f=>{a(f)}).catch(f=>{this.loggingService.catch(`[uploadChunk] Error getting download URL for chunk ${r}:`,f),s(f)})})}else{let c=new Error("API key not available");this.loggingService.catch("[uploadChunk] API key not available",c),s(c)}}catch(c){this.loggingService.catch(`[uploadChunk] Error in StorageService uploadChunk for chunk ${r}: `,c),s(c)}})}downloadAttachment(e){try{if(e.url){let 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(U.ATTRIBUTES.VELT_DOWNLOAD_BUTTON,"true"),a.classList.add("snippyly-overlay-panel"),a.href=s,e?.name&&(a.download=e?.name),document.body.appendChild(a);let c=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!1});a.dispatchEvent(c),window.URL.revokeObjectURL(s),a.remove()},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){let c=vt();this.coreActionsService.triggerAction(ct.ATTACHMENT_RESOLVER,{event:Y.Events.Resolver.ATTACHMENT_DELETE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:c,methodName:kl.DELETE_ATTACHMENT,source:"internal",payload:{attachmentId:e.attachmentId,metadata:t}}),this.attachmentResolverService.deleteAttachment({attachmentId:e.attachmentId,metadata:t},c).then(()=>{a(null)}).catch(p=>{s(p)})}else{let c=Ob(this.storage,e.bucketPath);A$(c).then(()=>{a(null)}).catch(p=>{a(null)})}})}deleteFileFromPath(e){return new Promise((t,r)=>{let a=Ob(this.storage,e);A$(a).then(()=>{t(null)}).catch(s=>{r(s)})})}};o.\u0275fac=function(t){return new(t||o)(ee(je),ee(Ft),ee(ni),ee(y),ee(eu))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var En=(()=>{let o=class o{constructor(e,t,r,a,s,c,p,g){this.analyticsService=e,this.authService=t,this.contactService=r,this.databaseService=a,this.docService=s,this.configService=c,this.loggingService=p,this.commonDbService=g,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(Fe(f=>!!f),ot(1)).subscribe(f=>{f&&(this.getUser(),this.getDocumentPaths())},f=>{this.loggingService.catch("Error in CommentService getDb subscription: ",f)}),this.getRole$().pipe(ot(1)).subscribe(f=>{this.authService?.getUser()&&!f&&this.analyticsService.trackEvent(Y.Events.Iam.USER_ACCESS_DENIED)}),this.documentIAM$.subscribe(f=>{f?.accessType&&this.contactService.setDocumentAccessType(f.accessType)})}catch(f){this.loggingService.catch("Error in IamService constructor: ",f)}}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(Fe(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(Fe(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 qR;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(zn(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),_t())}getDocumentIAM$(){return this.documentIAM$.asObservable()}getRoles$(){return this.roles$.asObservable().pipe(de(e=>e?.length?e:U.WorkspaceRoles))}getFeaturesAccessLevel$(){return this.documentIAM$.asObservable().pipe(de(e=>e?.features),fe(e=>this.getRole$().pipe(de(t=>(t===co.ADMIN&&(e=e&&JSON.parse(JSON.stringify(e||{})),e?.all?.disabled&&(e.all.disabled=!1)),e)))))}hasRole(e){try{return e===this.getRole()}catch(t){return this.loggingService.catch("Error in IamService hasRole: ",t),!1}}hasRoleAny(e=[]){try{return e?.includes(this.getRole()||"")}catch(t){return this.loggingService.catch("Error in IamService hasRoleAny: ",t),!1}}hasRole$(e){try{return this.authService.getUser$().pipe(fe(()=>this.documentIAM$.pipe(Fe(t=>!!t),fe(()=>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(fe(()=>this.configService.getSF$()),fe(()=>this.configService.getSF()?this.contactService.isUserGlobalContact$():se(null)),fe(()=>this.configService.getSF()?this.documentIAM$.pipe(Fe(e=>!!e),_t(Xt)):se(null)),fe(()=>this.workspaceIAM$.pipe(_t(Xt))),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 co.ADMIN;if(!e)return this.user?.isAdmin?co.ADMIN:co.COMMENTER;let t=null,r;if(this.user)switch((this.documentIAM$.value?this.documentIAM$.value?.features?.all?.restricted:!1)?xi.RESTRICTED:this.documentIAM$.value?this.documentIAM$.value?.documentAccessType||xi.PUBLIC:null){case xi.PUBLIC:r=this.getUserFromDocumentIAM(this.user?.email,this.user?.userId),r||(r=this.getUserFromWorkspaceIAM(this.user?.email,this.user?.userId)),t=r?.role?.name||co.COMMENTER;break;case xi.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===co.ADMIN),_t())}isUserAdmin(){try{return this.getRole()===co.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?.[Tt(e)]),!r&&t&&(r=this.documentIAM$.value?.users?.[Tt(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?.[Tt(e)]),!r&&t&&(r=this.workspaceIAM$.value?.users?.[Tt(t)]),r}else return}catch(r){this.loggingService.catch("Error in IamService getUserFromWorkspaceIAM: ",r)}}};o.\u0275fac=function(t){return new(t||o)(ee(tt),ee(je),ee(Si),ee(In),ee(rt),ee(Ft),ee(y),ee(un))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var ss=(()=>{let o=class o{constructor(e,t,r,a,s,c,p,g,f,I){this.authService=e,this.docService=t,this.loggingService=r,this.commonDbService=a,this.usersService=s,this.commentUtilsService=c,this.coreActionsService=p,this.functions=g,this.configService=f,this.contactService=I,this.currentUserPermissions$=new ve(null),this.permissionsCache$=new ve(null),this.permissionProvider$=new ve(null);try{this.docService.setUserPermissionService(this),this.authService.setUserPermissionService(this),this.commentUtilsService.setUserPermissionService(this),this.contactService.setUserPermissionService(this)}catch(T){this.loggingService.catch("Error in UserPermissionService constructor:",T)}}hasUserContextAccess({userId:e,accessFields:t}){try{if(!this.getIsContextEnabled()||t.includes(U.DEFAULT_VELT_CONTEXT))return!0;let r=this.contactService.getUserAccessFieldsByUserId(e);return r?t.every(a=>r.includes(a)):!0}catch(r){return this.loggingService.catch("Error in UserPermissionService hasUserContextAccess:",r),!1}}organizationDetails(e){return Q(this,null,function*(){try{let t=yield this.commonDbService?.getData({feature:"organizationMetadata",properties:{organizationId:e}});return t&&t?.errorCode?{errorCode:Lo.PERMISSION_DENIED,error:!0}:t&&!t?.metadata?{errorCode:Lo.DOES_NOT_EXIST,error:!0}:{error:!1}}catch(t){return this.loggingService.catch("Error in UserPermissionService organizationDetails:",t),{errorCode:Lo.SOMETHING_WENT_WRONG,error:!0}}})}documentDetails(r){return Q(this,arguments,function*({documentId:e,organizationId:t}){try{let a=yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:e,organizationId:t}});if(a&&a?.errorCode)return{errorCode:Lo.PERMISSION_DENIED,error:!0};if(a&&!a?.metadata)return{errorCode:Lo.DOES_NOT_EXIST,error:!0};let s=this.docService.getDocumentMetadata(e)??{};return this.docService.setDocumentMetadata(e,E(E({},s),a?.metadata??{})),{error:!1}}catch(a){return this.loggingService.catch("Error in UserPermissionService documentDetails:",a),{errorCode:Lo.SOMETHING_WENT_WRONG,error:!0}}})}folderDetails(r){return Q(this,arguments,function*({folderId:e,organizationId:t}){try{let a=yield this.commonDbService?.getData({feature:"folderMetadata",properties:{folderId:e,organizationId:t}});return a&&a?.errorCode?{errorCode:Lo.PERMISSION_DENIED,error:!0}:a&&!a?.metadata?{errorCode:Lo.DOES_NOT_EXIST,error:!0}:{error:!1}}catch(a){return this.loggingService.catch("Error in UserPermissionService folderDetails:",a),{errorCode:Lo.SOMETHING_WENT_WRONG,error:!0}}})}getUserPermissions(e){return Q(this,null,function*(){try{if(!this.authService.getUser())return this.loggingService.catch("User not set. [source: getUserPermissions]",void 0,void 0,!0),{};let t=this.extractResourceIds(e);if(!t.clientOrganizationId||!t.organizationId)return this.loggingService.catch("Client organization id or organization id not set during getUserPermissions",void 0,void 0,!0),{};let r=yield this.validateResources(t),[a,s]=yield this.fetchUserPermissionsFromDB(t),c=this.buildPermissionsResponse(t,r,a,s);return!e&&Object.keys(c).length>0&&this.setCurrentUserPermissions(c),c}catch(t){return this.loggingService.catch("Error in UserPermissionService getUserPermissions:",t),{}}})}extractResourceIds(e){let t=this.docService.getDocumentPaths(),r=this.docService.getDocumentIds();return{folderIds:e?.folderIds?.length?e.folderIds:t?.folderId?[t.folderId]:[],documentIds:e?.documentIds?.length?e.documentIds:r.map(a=>a.clientDocumentId),clientOrganizationId:e?.organizationId??t?.clientOrganizationId,organizationId:e?.organizationId??t?.clientOrganizationId?os(e?.organizationId??t?.clientOrganizationId??""):void 0}}validateResources(e){return Q(this,null,function*(){let{folderIds:t,documentIds:r,organizationId:a,clientOrganizationId:s}=e,c=[],p=[];a&&(c.push(this.organizationDetails(a)),p.push({id:s??"",type:"organization"})),t.forEach(f=>{c.push(this.folderDetails({folderId:$i(f),organizationId:a??""})),p.push({id:f,type:"folder"})}),r.forEach(f=>{c.push(this.documentDetails({documentId:Tr(f),organizationId:a??""})),p.push({id:f,type:"document"})});let g=yield Promise.allSettled(c);return this.processValidationResults(g,p)})}processValidationResults(e,t){let r=[],a=[],s,c=e.map((p,g)=>({result:p,metadata:t[g]})).filter(({result:p})=>p.status==="rejected"||p.status==="fulfilled"&&p.value.error);for(let{result:p,metadata:g}of c){let f=p.status==="fulfilled"?p.value.errorCode??Lo.SOMETHING_WENT_WRONG:Lo.SOMETHING_WENT_WRONG,I={id:g.id,errorCode:f};switch(g.type){case"organization":if(s=I,f===Lo.DOES_NOT_EXIST)throw new Error(`Organization with id '${g.id}' does not exist`);break;case"folder":r.push(I);break;case"document":a.push(I);break}}return{failedFolderIds:r,failedDocumentIds:a,failedOrganizationId:s}}fetchUserPermissionsFromDB(e){return Q(this,null,function*(){let{folderIds:t,documentIds:r,organizationId:a}=e,s=[this.authService.getUser()?.userId??""],c=[...t.map(f=>$i(f)),...r.map(f=>Tr(f)),a??""],[p,g]=yield Promise.allSettled([this.usersService.getUsersFromDBWithBatching({userIds:s,organizationId:a}),this.usersService.getTemporaryUsersFromDBWithBatching({userIds:s,organizationId:a,resourceIds:c})]);return[p.status==="fulfilled"?p.value:[],g.status==="fulfilled"?g.value:[]]})}buildPermissionsResponse(e,t,r,a){let{folderIds:s,documentIds:c,clientOrganizationId:p,organizationId:g}=e,{failedFolderIds:f,failedDocumentIds:I,failedOrganizationId:T}=t,L={};return this.processRegularUserPermissions(L,r,s,c,p??"",g??"",f,I,T),this.processTemporaryUserPermissions(L,a),this.processContextPermissions(L),L}processContextPermissions(e){try{let t=this.authService.getUser()?.userId;if(t){let r=this.contactService.getUserAccessFieldsByUserId(t);r?.length&&(e[t]||(e[t]={}),e[t].context={accessFields:r})}}catch(t){this.loggingService.catch("Error in UserPermissionService processContextPermissions:",t);return}}processRegularUserPermissions(e,t,r,a,s,c,p,g,f){for(let I of t)for(let T of I)T?.user?.userId&&(e[T.user.userId]=D(E({},r.length&&{folders:this.buildFolderPermissions(r,T,p)}),{documents:this.buildDocumentPermissions(a,T,g),organization:{[s]:this.buildOrganizationPermission(c,T,f)}}))}getErrorMessage(e,t){try{switch(this.loggingService.log(`Error in UserPermissionService getErrorMessage: ${e} ${t}`),e){case Lo.DOES_NOT_EXIST:return`${t} does not exist`;case Lo.PERMISSION_DENIED:return`User does not have access to ${t}`;case Lo.SOMETHING_WENT_WRONG:return"Something went wrong";default:return"Something went wrong"}}catch(r){return this.loggingService.catch("Error in UserPermissionService getErrorMessage:",r),"Something went wrong"}}buildFolderPermissions(e,t,r){return e.reduce((a,s)=>{let c=r.find(p=>p.id===s);return c?a[s]={error:this.getErrorMessage(c.errorCode,"folder"),errorCode:c.errorCode}:a[s]={accessRole:t.viewerFolderIds?.includes($i(s))?Qs.VIEWER:Qs.EDITOR},a},{})}buildDocumentPermissions(e,t,r){return e.reduce((a,s)=>{let c=r.find(p=>p.id===s);return c?a[s]={error:this.getErrorMessage(c.errorCode,"document"),errorCode:c.errorCode}:a[s]={accessRole:t.viewerDocumentIds?.includes(Tr(s))?Qs.VIEWER:Qs.EDITOR},a},{})}buildOrganizationPermission(e,t,r){return r?{error:this.getErrorMessage(r.errorCode,"organization"),errorCode:r.errorCode}:{accessRole:t.viewerOrganizationIds?.includes(e)?Qs.VIEWER:Qs.EDITOR}}processTemporaryUserPermissions(e,t){for(let r of t)if(r?.userId)switch(this.ensureUserPermissionStructure(e,r.userId),r.type){case"folder":this.addTemporaryFolderPermission(e,r);break;case"document":this.addTemporaryDocumentPermission(e,r);break;case"organization":this.addTemporaryOrganizationPermission(e,r);break}}ensureUserPermissionStructure(e,t){e[t]||(e[t]={})}addTemporaryFolderPermission(e,t){let{userId:r,resourceId:a,role:s,expiresAt:c}=t;e[r].folders||(e[r].folders={}),e[r].folders[a]||(e[r].folders[a]={accessRole:s??Qs.EDITOR,expiresAt:c})}addTemporaryDocumentPermission(e,t){let{userId:r,resourceId:a,role:s,expiresAt:c}=t;e[r].documents||(e[r].documents={}),e[r].documents[a]={accessRole:s??Qs.EDITOR,expiresAt:c}}addTemporaryOrganizationPermission(e,t){let{userId:r,resourceId:a,role:s,expiresAt:c}=t;e[r].organization||(e[r].organization={}),e[r].organization[a]={accessRole:s??Qs.EDITOR,expiresAt:c}}hasEditAccess({organizationId:e,folderId:t,documentId:r}){try{let a=!0,s=this.getCurrentUserPermissionsWithServerIds(),c=this.authService.getUser()?.userId??"";return s&&(e&&typeof e=="string"&&s?.[c]?.organization?.[e]&&(s?.[c]?.organization?.[e]?.accessRole===Qs.VIEWER||s?.[c]?.organization?.[e]?.errorCode===Lo.PERMISSION_DENIED)&&(a=!1),t&&typeof t=="string"&&s?.[c]?.folders?.[t]&&(s?.[c]?.folders?.[t]?.accessRole===Qs.VIEWER||s?.[c]?.folders?.[t]?.errorCode===Lo.PERMISSION_DENIED)&&(a=!1),r&&typeof r=="string"&&s?.[c]?.documents?.[r]&&(s?.[c]?.documents?.[r]?.accessRole===Qs.VIEWER||s?.[c]?.documents?.[r]?.errorCode===Lo.PERMISSION_DENIED)&&(a=!1)),a}catch{return!0}}getCurrentUserPermissions$(){return this.currentUserPermissions$.asObservable().pipe(_t(Xt))}getCurrentUserPermissions(){return this.currentUserPermissions$.value}refactorPermissionsWithServerIds(e){try{let t=JSON.parse(JSON.stringify(e??{})),r=this.authService.getUser()?.userId??"";if(t?.[r]){let a=this.docService.getDocumentPaths()?.clientOrganizationId??"";if(t?.[r]?.organization?.[a]){let s=os(a);t[r].organization&&(t[r].organization[s]=t[r].organization[a],delete t[r].organization[a])}t?.[r]?.folders&&(t[r].folders=Object.fromEntries(Object.entries(t?.[r]?.folders??{}).map(([s,c])=>[$i(s),c]))),t?.[r]?.documents&&(t[r].documents=Object.fromEntries(Object.entries(t?.[r]?.documents??{}).map(([s,c])=>[Tr(s),c])))}return t}catch(t){return this.loggingService.catch("Error in UsersPermissionService refactorPermissionsWithServerIds:",t),e}}getCurrentUserPermissionsWithServerIds$(){return this.currentUserPermissions$.asObservable().pipe(de(e=>this.refactorPermissionsWithServerIds(e)),_t(Xt))}getCurrentUserPermissionsWithServerIds(){return this.refactorPermissionsWithServerIds(this.currentUserPermissions$.value)}setCurrentUserPermissions(e){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setCurrentUserPermissions","color: green;");let t=null;e&&(t=JSON.parse(JSON.stringify(e))),this.currentUserPermissions$.next(t)}catch(t){this.loggingService.catch("Error in UsersPermissionService setCurrentUserPermissions:",t)}}getIsContextEnabled(){return this.loggingService.log("%c[WB] Calling FUNCTION: getIsContextEnabled","color: green;"),this.permissionProvider$.value?.isContextEnabled??!1}setPermissionProvider(e){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setPermissionProvider","color: green;"),this.permissionProvider$.next(e)}catch(t){this.loggingService.catch("Error in UsersPermissionService setPermissionProvider:",t)}}get isRevokeAccessOnDocumentUnsetEnabled(){return this.permissionProvider$.value?.revokeAccessOn?.some(e=>e.type===wC.DOCUMENT_UNSET)??!1}get isRevokeAccessOnUserLogoutEnabled(){return this.permissionProvider$.value?.revokeAccessOn?.some(e=>e.type===wC.USER_LOGOUT)??!1}get isRevokeOrganizationAccessOnUserLogoutEnabled(){return this.permissionProvider$.value?.revokeAccessOn?.some(e=>e.type===wC.USER_LOGOUT&&e.revokeOrganizationAccess)??!1}get isRevokeOrganizationAccessOnDocumentUnsetEnabled(){return this.permissionProvider$.value?.revokeAccessOn?.some(e=>e.type===wC.DOCUMENT_UNSET&&e.revokeOrganizationAccess)??!1}getPermissionProviderRetryConfig(){return this.permissionProvider$.value?.retryConfig??{retryCount:0,retryDelay:0}}revokeAccessOnUserLogout(){return Q(this,null,function*(){let e=vt();try{if(this.isRevokeAccessOnUserLogoutEnabled){let t=[],r=this.authService.getUser()?.userId??"";if((this.getPermissionsCache()??[]).forEach(s=>{s.userId===r&&s.hasAccess&&(s.type===Fo.ORGANIZATION?this.isRevokeOrganizationAccessOnUserLogoutEnabled&&t.push(D(E({},s),{hasAccess:!1})):t.push(D(E({},s),{hasAccess:!1})))}),t.length>0){this.coreActionsService.triggerAction(ct.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_USER_LOGOUT_FORMED,timestamp:new Date().getTime(),uniqueId:e,methodName:Hi.REVOKE_ACCESS_ON_USER_LOGOUT,source:"internal",payload:{requests:t}}),this.setPermissionsCache([]),this.coreActionsService.triggerAction(ct.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_USER_LOGOUT_TRIGGERED,timestamp:new Date().getTime(),uniqueId:e,methodName:Hi.REVOKE_ACCESS_ON_USER_LOGOUT,source:"internal",payload:{requests:t}});let s=yield this.revokeAccess({requests:t,userId:this.authService.getUser()?.userId??""});s.success?this.coreActionsService.triggerAction(ct.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_USER_LOGOUT_RESULT,timestamp:new Date().getTime(),uniqueId:e,methodName:Hi.REVOKE_ACCESS_ON_USER_LOGOUT,source:"internal",payload:{result:{data:s,success:!0,statusCode:200}}}):this.coreActionsService.triggerAction(ct.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_USER_LOGOUT_ERROR,timestamp:new Date().getTime(),uniqueId:e,methodName:Hi.REVOKE_ACCESS_ON_USER_LOGOUT,source:"internal",payload:{result:{data:s,success:!1,statusCode:500}}})}}}catch(t){this.coreActionsService.triggerAction(ct.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_USER_LOGOUT_ERROR,timestamp:new Date().getTime(),uniqueId:e,methodName:Hi.REVOKE_ACCESS_ON_USER_LOGOUT,source:"internal",payload:{error:t}}),this.loggingService.catch("Error in UsersPermissionService revokeAccessOnUserLogout:",t)}})}revokeAccessOnDocumentUnset(){return Q(this,null,function*(){let e=vt();try{if(this.isRevokeAccessOnDocumentUnsetEnabled){let t=[],r=this.docService.getDocumentIds(),a=this.docService.getOrganizationConfig()?.clientOrganizationId??"",s=this.docService.getDocumentPaths()?.folderId??"",c=this.authService.getUser()?.userId??"",p=this.getPermissionsCache()??[];if(r.forEach(g=>{p.find(f=>f.resourceId===g.clientDocumentId&&f.type===Fo.DOCUMENT&&f.organizationId===a&&f.userId===c)&&(t.push({userId:c,resourceId:g.clientDocumentId,organizationId:a,type:Fo.DOCUMENT,hasAccess:!1}),p=p.filter(f=>!(f.resourceId===g.clientDocumentId&&f.type===Fo.DOCUMENT&&f.organizationId===a&&f.userId===c)))}),s&&p.find(g=>g.resourceId===s&&g.type===Fo.FOLDER&&g.organizationId===a&&g.userId===c)&&(t.push({userId:c,resourceId:s,organizationId:a,type:Fo.FOLDER,hasAccess:!1}),p=p.filter(g=>!(g.resourceId===s&&g.type===Fo.FOLDER&&g.organizationId===a&&g.userId===c))),a&&this.isRevokeOrganizationAccessOnDocumentUnsetEnabled&&p.find(g=>g.resourceId===a&&g.type===Fo.ORGANIZATION&&g.organizationId===a&&g.userId===c)&&(t.push({userId:c,resourceId:a,organizationId:a,type:Fo.ORGANIZATION,hasAccess:!1}),p=p.filter(g=>!(g.resourceId===a&&g.type===Fo.ORGANIZATION&&g.organizationId===a&&g.userId===c))),this.setPermissionsCache(p),t.length>0){this.coreActionsService.triggerAction(ct.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_FORMED,timestamp:new Date().getTime(),uniqueId:e,methodName:Hi.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{requests:t}}),this.coreActionsService.triggerAction(ct.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_TRIGGERED,timestamp:new Date().getTime(),uniqueId:e,methodName:Hi.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{requests:t}});let g=yield this.revokeAccess({requests:t,userId:c});g.success?this.coreActionsService.triggerAction(ct.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_RESULT,timestamp:new Date().getTime(),uniqueId:e,methodName:Hi.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{result:{data:g,success:!0,statusCode:200}}}):this.coreActionsService.triggerAction(ct.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_ERROR,timestamp:new Date().getTime(),uniqueId:e,methodName:Hi.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{result:{data:g,success:!1,statusCode:500}}})}}}catch(t){this.coreActionsService.triggerAction(ct.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_ERROR,timestamp:new Date().getTime(),uniqueId:e,methodName:Hi.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{error:t}}),this.loggingService.catch("Error in UsersPermissionService revokeAccessOnDocumentUnset:",t)}})}getAccess(r){return Q(this,arguments,function*({requests:e,userId:t}){let a=Xi(this.functions,Qi({url:wn?.cloudFunction?.sdkProxy,apiProxyDomain:this.configService?.getApiProxyDomain()}));return yield pd({methodName:"getAccess",data:{type:"getAccess",data:e,metadata:{retryConfig:this.getPermissionProviderRetryConfig()}},getSdkProxy:a,userId:t})})}revokeAccess(r){return Q(this,arguments,function*({requests:e,userId:t}){let a=Xi(this.functions,Qi({url:wn?.cloudFunction?.sdkProxy,apiProxyDomain:this.configService?.getApiProxyDomain()}));return yield pd({methodName:"revokeAccess",data:{type:"revokeAccess",data:e,metadata:{retryConfig:this.getPermissionProviderRetryConfig()}},getSdkProxy:a,userId:t})})}onResourceAccessRequired(c){return Q(this,arguments,function*({requests:e,uniqueId:t,methodName:r,userId:a,fromCache:s=!0}){try{if(!e?.length)return;let p=[],g=this.getPermissionsCache()??[];if(!this.forceRefreshPermissions()&&s&&(e.forEach(f=>{let I=g?.find(T=>T.resourceId===f.resource.id&&T.type===f.resource.type&&T.userId===f.userId&&T.organizationId===f.resource.organizationId);I&&p.push(I)}),p.length>0&&(e=e.filter(f=>!p.find(I=>I.resourceId===f.resource.id&&I.type===f.resource.type&&I.userId===f.userId&&I.organizationId===f.resource.organizationId)))),e.length>0){this.coreActionsService.triggerAction(ct.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.RESOURCE_ACCESS_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:t,methodName:r,source:"internal",payload:{requests:e,fromCache:s}});let f=yield this.getAccess({requests:e,userId:this.authService.getUser()?.userId??a??""});return this.coreActionsService.triggerAction(ct.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.RESOURCE_ACCESS_RESULT,timestamp:new Date().getTime(),uniqueId:t,methodName:r,source:"internal",payload:{result:f}}),f?.success&&f?.data?.length&&(this.setPermissionsCache([...g,...f.data]),f.data=[...p,...f.data]),f}else if(p.length>0)return this.coreActionsService.triggerAction(ct.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.RESOURCE_ACCESS_RESULT_FROM_CACHE,timestamp:new Date().getTime(),methodName:r,source:"internal",uniqueId:t,payload:{results:p}}),{data:p,success:!0,statusCode:200};return}catch(p){this.loggingService.catch("Error in UsersPermissionService onResourceAccessRequired:",p),this.coreActionsService.triggerAction(ct.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.RESOURCE_ACCESS_ERROR,timestamp:new Date().getTime(),methodName:r,source:"internal",uniqueId:t,payload:{error:p,requests:e,fromCache:s}});return}})}getPermissionsCache(){return this.forceRefreshPermissions()?[]:this.permissionsCache$.getValue()}forceRefreshPermissions(){return this.getPermissionProvider()?.forceRefresh??!1}setPermissionsCache(e){try{let t=new Map;e.forEach(a=>{let s=`${a.userId}_${a.resourceId}_${a.organizationId}_${a.type}`;t.set(s,a)});let r=JSON.parse(JSON.stringify(Array.from(t.values())));this.permissionsCache$.next(r)}catch(t){this.loggingService.catch("Error in UsersPermissionService setPermissionsCache:",t)}}isPermissionProviderAvailable(){try{return!!this.permissionProvider$.getValue()}catch(e){return this.loggingService.catch("Error in UsersPermissionService isPermissionProviderAvailable:",e),!1}}getPermissionProvider(){try{return this.permissionProvider$.getValue()}catch(e){return this.loggingService.catch("Error in UsersPermissionService getPermissionProvider:",e),null}}getPermissionProvider$(){return this.permissionProvider$.asObservable()}};o.\u0275fac=function(t){return new(t||o)(ee(je),ee(rt),ee(y),ee(un),ee(Ln),ee(tu),ee(ni),ee(xo),ee(Ft),ee(Si))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Cn=(()=>{let o=class o{constructor(e,t,r,a,s,c,p,g,f,I,T,L,G,z,J,le,_e,De){this.afAuth=e,this.analyticsService=t,this.authService=r,this.configService=a,this.commonDbService=s,this.commonDbUtilsService=c,this.commentUtilsService=p,this.commentAnnotationsResolverService=g,this.databaseService=f,this.docService=I,this.domService=T,this.iamService=L,this.loggingService=G,this.notificationUtilsService=z,this.usersService=J,this.functions=le,this.userPermissionService=_e,this.coreActionsService=De,this.db=Ss(),this.notificationsDb=Ss(void 0,wn.firebaseNotificationsDatabaseURL),this.documentPaths=null,this.notifications$=new ve([]),this.rawNotificationsByIdMap$=new ve(new Map),this.processedNotifications$=new ve([]),this.userNotificationsFromServer$=new ve([]),this.readNotificationsOnForYouTab$=new ve(!1),this.currentDocumentOnly$=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(Fe(Be=>!!Be),ot(1)).subscribe(Be=>{Be&&(this.db=Be,this.getDocumentIds(),this.subscribeGetNotificationsForYou())},Be=>{this.loggingService.catch("Error in NotificationService getDb subscription: ",Be)}),this.authService.getUser$().subscribe(Be=>{Be?(this.subscribeGetNotificationsForYou(),this.getDocumentIds(),this.subscribeToUserSettings()):(Object.keys(this.notificationsByDocumentIdSubscription).forEach(Ve=>{this.notificationsByDocumentIdSubscription[Ve]?.unsubscribe()}),this.notificationForYouSubscription?.unsubscribe(),this.documentIdsSubscription?.unsubscribe(),this.resetCacheData())}),this.docService.getLocationMetadata$().subscribe(Be=>{if(Be){let Ve=this.notificationsByDocumentIdMap$.getValue()?JSON.parse(JSON.stringify(this.notificationsByDocumentIdMap$.getValue())):null;Object.keys(Be||{}).forEach(be=>{let Se=Ve?.[be]?.notifications;Se?.length&&Se.forEach(Ae=>{this.notificationUtilsService.mergeLocationWithNotification({notification:Ae},Be)?.notification})}),this.notificationsByDocumentIdMap$.next(Ve)}})}catch(Be){this.loggingService.catch("Error in NotificationService constructor: ",Be)}}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=Tt(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(c=>{if(c.enable){let p=c?.values?.find(g=>g.id===c.default);a[c.id]=p||c?.values?.[0]||{id:"NONE",name:"None"}}});let s={};Object.keys(a).forEach(c=>{s[c]=a[c].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=Tt(this.authService.getUser()?.userId??"");this.userSettingsSubscription=this.enableSettings$.pipe(Fe(t=>t===!0),fe(()=>this.docService.getDocumentPaths$().pipe(Fe(t=>!!t),fe(t=>Oo(this.getInitialConfigFromDB(t)).pipe(fe(()=>this.commonDbService.dbListener({feature:"userConfig",properties:{useCollectionGroup:!1,isCollection:!1,documentId:t?.documentId,userId:e}}).pipe(de(r=>{r?.data?.notificationsConfig&&!ui(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.setUserNotificationsFromServer([]),this.notificationsByDocumentIdMap$.next(null),this.notificationsForYou$.next(null),this.settingsConfig$.next(null)}catch(e){this.loggingService.catch("Error in NotificationService resetCacheData: ",e)}}subscribeGetNotificationsForYou(){try{this.notificationForYouSubscription&&this.notificationForYouSubscription.unsubscribe(),this.notificationForYouSubscription=this.getNotificationsForYou().subscribe(()=>{},e=>{this.loggingService.catch("Error in NotificationService getNotificationsForYou subscription: ",e)})}catch(e){this.loggingService.catch("Error in NotificationService subscriveGetNotificationsForYou: ",e)}}setCommentService(e){try{this.commentService=e}catch(t){this.loggingService.catch("Error in NotificationService setCommentService: ",t)}}getDocumentIds(){try{this.documentIdsSubscription&&this.documentIdsSubscription.unsubscribe(),this.documentIdsSubscription=this.selfNotifications$.pipe(fe(()=>this.getCurrentDocumentOnly$().pipe(fe(e=>e?this.docService.getDocumentPaths$().pipe(de(t=>{})):se(void 0)))),on(()=>{this.notificationsByDocumentIdMap$.next(null)}),fe(()=>this.getDocumentIdsByLastNotificationTimestamp().pipe(Di(),de(([e,t])=>{let r=e?.map(g=>g.documentId),a=t?.map(g=>g.documentId),s=r?.filter(g=>!a?.includes(g)),c=a?.map(g=>({documentId:g,timestamp:t?.find(f=>f.documentId===g)?.timestamp})).filter(g=>!r?.includes(g.documentId)),p=a?.map(g=>{let f=t?.find(I=>I.documentId===g)?.timestamp;return{documentId:g,timestamp:f}}).filter(g=>{let f=e?.find(I=>I.documentId===g.documentId)?.timestamp;return f&&g.timestamp&&f!==g.timestamp});c?.length&&this.fetchNotificationsForDocumentIds(c),p?.length&&this.fetchNotificationsForDocumentIds(p,1),s?.forEach(g=>{this.removeNotificationsForDocumentId(g)}),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(fe(t=>this.docService.getOrganizationConfig$().pipe(de(r=>{let a=null,s=this.configService.getApiKey(),c=r?.organizationId||t?.organizationId;return s&&c&&(a=new fm({apiKey:s,organizationId:c})),{user:t,documentPaths:a}}))),fe(t=>{let{user:r,documentPaths:a}=t;if(this.getCurrentDocumentOnly()&&!this.docService?.getDocumentPaths()?.documentId)return se(null);if(r&&a?.organizationNotificationsLastNotificationTimestamp){let s=new Date,c=this.maxNotificationDays$.getValue()>0?this.maxNotificationDays$.getValue():15;s.setDate(s.getDate()-c);let p=s.getTime(),g=[yi(ft("timestamp",">=",p),...this.getCurrentDocumentOnly()&&this.docService.getDocumentPaths()?.documentId?[ft("metadata.documentId","==",this.docService.getDocumentPaths()?.documentId)]:[])];return this.getCurrentDocumentOnly()||(g.push(Ji("timestamp","desc")),g.push(jR(e))),this.commonDbService.dbListener({feature:"allLastNotificationTimestamp",properties:{organizationId:a?.organizationId,isCollection:!0,useQuery:!0,firestoreQuery:g}}).pipe(de(f=>f?.data),de(f=>{let I=[];return Object.keys(f||{}).forEach(T=>{let L=this.commonDbService.shouldUseFirestore()?f[T]?.timestamp??0:f[T],G=this.commonDbService.shouldUseFirestore()?f[T]?.deletedNotification??!1:!1;if(G&&G.id&&G?.timestamp===L){let z=G.id,J=f[T]?.metadata?.documentId,le=JSON.parse(JSON.stringify(this.notificationsByDocumentIdMap$.getValue()??{})),_e=le?.[J]??{documentMetadata:null,notifications:[]},De=_e.notifications??[],Be=De?.findIndex(Ve=>Ve.id===z);Be!==-1&&(De.splice(Be,1),this.notificationsByDocumentIdMap$.next(D(E({},le),{[J]:D(E({},_e),{notifications:De})})))}I.push({documentId:T,timestamp:L})}),I}),zn(f=>(this.loggingService.catch("Error in NotificationService getDocumentIdsByLastNotificationTimestamp: ",f),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=Xi(this.functions,Qi({url:wn.cloudFunction.getNotificationsForDocuments,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:12e5}),a=this.docService.getOrganizationConfig()?.organizationId??"";if(!a)return[];let s=this.getStartAtTimestamp(),c={};if(e.forEach(De=>{if(De?.documentId){let Be=this.getAllowedDocumentMetadataByDocumentId(De.documentId);Be&&(c[De.documentId]=Be)}}),this.userPermissionService?.isPermissionProviderAvailable())try{let De=[];if(e.forEach(Ae=>{this.docService.getDocumentMetadata(Ae.documentId)||De.push(Ae.documentId)}),De.length){let Ae=this.authService.getUser(),Ce=Xi(this.functions,Qi({url:wn?.cloudFunction?.sdkProxy,apiProxyDomain:this.configService?.getApiProxyDomain()}));try{let he=yield pd({methodName:"getDocumentMetadataFromIds",data:{type:"getDocumentMetadataFromIds",metadata:{organizationId:Ae?.clientOrganizationId,folderId:this.documentPaths?.folderId},documentIds:De},getSdkProxy:Ce,userId:Ae?.userId??""});if(he?.data?.length){let Oe={};he.data.forEach(Ne=>{Ne?.documentId&&(Oe[Ne.documentId]=Ne)}),this.docService.setAllDocumentMetadata(E(E({},this.docService.getAllDocumentMetadataMap()),Oe))}}catch(he){this.loggingService.warn("Error in NotificationService fetchNotificationsForDocumentIds: ",he)}}let Be=[],Ve=[];e.forEach(Ae=>{let Ce=this.docService.getDocumentMetadata(Ae.documentId);Ce?.clientDocumentId?Be.push({userId:this.authService.getUser()?.userId??"",resource:{id:Ce.clientDocumentId,type:Fo.DOCUMENT,source:Hi.GET_NOTIFICATIONS,organizationId:this.docService.getOrganizationConfig()?.clientOrganizationId??""}}):Ve.push(Ae.documentId)}),Ve.length&&(e=e.filter(Ae=>!Ve.includes(Ae.documentId)));let be=vt();this.coreActionsService.triggerAction(ct.PERMISSION_PROVIDER,{event:Y.Events.PermissionProvider.RESOURCE_ACCESS_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:be,methodName:Hi.GET_NOTIFICATIONS,source:"internal",payload:{requests:Be}});let Se=yield this.userPermissionService?.onResourceAccessRequired({requests:Be,uniqueId:be,methodName:Hi.GET_NOTIFICATIONS});Se?.success&&Se?.data?.length?Se.data.forEach(Ae=>{!Ae.hasAccess&&Ae.resourceId&&(e=e.filter(Ce=>Ce.documentId!==Tr(Ae.resourceId)))}):e=[]}catch(De){this.loggingService.warn("Error in NotificationService fetchNotificationsForDocumentIds: ",De),e=[]}if(!e.length)return[];let p=this.userPermissionService?.getPermissionsCache()?.filter(De=>De.type===Fo.CONTEXT),g={organizationId:a,documentIds:e.filter(De=>!!De.documentId&&!!De.timestamp).map(De=>({documentId:De.documentId,timestamp:De.timestamp??0})),timestamp:s,limitToLast:t,selfNotifications:this.selfNotifications$.value,isPermissionProviderUsed:this.userPermissionService?.isPermissionProviderAvailable(),getUserNotifications:!0,isContextEnabled:this.userPermissionService?.getIsContextEnabled(),cachedData:p,retryConfig:this.userPermissionService?.getPermissionProviderRetryConfig()},f=yield this.notificationUtilsService.handleNotificationEncryption({data:g}),I=yield r({veltData:f}),T=I?.data?.data?.veltData||{},L=I?.data?.data?.veltAdditionalData||{},G="notificationwithdocumentidstoencryptanddecryptonsdk"+(this.authService.getUser()?.userId??""),z=yield W0(T,G),{userNotifications:J=[],userNotificationIdsInDocNotifications:le=[],permissionResults:_e=[]}=yield W0(L,G);if(this.userPermissionService?.getIsContextEnabled()){let De=[...this.userPermissionService?.getPermissionsCache()??[],..._e??[]];this.userPermissionService?.setPermissionsCache(De)}if(z&&typeof z=="object"){let De=this.usersService.userDataProviderAvailable(),Be=this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable(),Ve=[],be=[];Object.keys(z).forEach((Se,Ae)=>{let Ce=z[Se].documentMetadata;if(Ce){let Oe=this.allowedDocumentMetadataMap$.value||{};(!Oe?.[Se]||!ui(Oe?.[Se],Ce))&&this.allowedDocumentMetadataMap$.next(D(E({},Oe),{[Se]:Ce}))}let he=z[Se].notifications||[];he.forEach(Oe=>{le.includes(Oe.notificationId)&&!J.find(Ne=>Ne.notificationId===Oe.notificationId)&&J.push(JSON.parse(JSON.stringify(Oe))),Oe.notification=this.getClientNotificationObject(Oe)}),this.setNotificationForDocumentIdInCache(Se,Ce,he),De&&(Ve.push(this.commonDbUtilsService.formatResponse({feature:"allDocNotifications",data:he,shouldAwait:!0,forceResolve:!0})),Ve.push(this.commonDbUtilsService.formatResponse({feature:"allUserNotifications",data:J,shouldAwait:!0,forceResolve:!0}))),Be&&(be.push(this.commonDbUtilsService.formatResponse({feature:"allDocNotifications",data:he,shouldCommentAnnotationsResolverAwait:!0})),be.push(this.commonDbUtilsService.formatResponse({feature:"allUserNotifications",data:J,shouldCommentAnnotationsResolverAwait:!0})))}),this.setUserNotificationsFromServer([...this.getUserNotificationsFromServer(),...J]),De&&Promise.all(Ve).then(()=>{Object.keys(z).forEach(Se=>{let Ae=z?.[Se]?.documentMetadata||{},Ce=this.commonDbUtilsService.mergeUsersWithData({feature:"allDocNotifications",data:z?.[Se]?.notifications||[]});Ce.forEach(he=>{he.notification=this.getClientNotificationObject(he)}),this.setNotificationForDocumentIdInCache(Se,Ae,Ce)})}),Be&&Promise.all(be).then(()=>{Object.keys(z).forEach(Se=>{let Ae=z?.[Se]?.documentMetadata||{},Ce=z?.[Se]?.notifications?.reduce((he,Oe)=>(he[Oe.notificationId]=Oe,he),{});Ce=this.commonDbUtilsService.mergeCommentAnnotationsWithData({feature:"allDocNotifications",data:Ce}),Ce=Object.values(Ce??{}),Ce.forEach(he=>{he.notification=this.getClientNotificationObject(he)}),this.setNotificationForDocumentIdInCache(Se,Ae,Ce)})})}}}catch(r){return this.loggingService.catch("Error in NotificationService fetchNotificationsForDocumentIds: ",r),[]}})}getUserNotificationsFromServer$(){return this.userNotificationsFromServer$.asObservable()}setUserNotificationsFromServer(e){try{let t=JSON.parse(JSON.stringify(e));t=t.filter((r,a,s)=>a===s.findIndex(c=>c.notificationId===r.notificationId)),this.userNotificationsFromServer$.next(t)}catch(t){this.loggingService.catch("Error in NotificationService setUserNotificationsFromServer: ",t)}}getUserNotificationsFromServer(){return this.userNotificationsFromServer$.getValue()}setNotificationForDocumentIdInCache(e,t,r,a){try{let s=this.docService.getOrganizationConfig()?.organizationId??"",c=this.docService.getOrganizationMetadata(s);t||(t=JSON.parse(JSON.stringify(this.docService.getDocumentMetadata()||{}))),c||(c=JSON.parse(JSON.stringify(this.docService.getOrganizationMetadata(s)||{})));let p=this.notificationsByDocumentIdMap$.getValue(),g=p?.[e]?.notifications||[],f=this.docService.getLocationMetadatas(),I=r?.map(G=>{let z=G?.notification;return z?(z.metadata&&(z.metadata.documentName=t?.documentName||z.metadata.documentName,z.metadata.organizationMetadata=c||z.metadata.organizationMetadata,z.metadata.documentMetadata=t||z.metadata.documentMetadata),f&&(z=this.notificationUtilsService.mergeLocationWithNotification({notification:z},f)?.notification),z):null})?.filter(G=>!!G)||[],T=new Map(g.map(G=>[G.id,G]));I.forEach(G=>{T.set(G.id,G)});let L=Array.from(T.values()).sort((G,z)=>(z.timestamp||0)-(G.timestamp||0));this.notificationsByDocumentIdMap$.next(D(E({},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)}}getStartAtTimestamp(){try{let e=new Date,t=this.maxNotificationDays$.getValue()>0?this.maxNotificationDays$.getValue():15;return e.setDate(e.getDate()-t),e.getTime()}catch(e){return this.loggingService.catch("Error in NotificationService getStartAtTimestamp: ",e),0}}getNotificationsForYou(){try{return this.getUserNotificationsFromServer$().pipe(fe(e=>se(e).pipe(de(t=>{let r=this.usersService.userDataProviderAvailable(),a=this.commentAnnotationsResolverService?.commentAnnotationDataProviderAvailable();if(r||a){let c=t?.reduce((p,g)=>(p[g.notificationId]=g,p),{});r&&(c=this.commonDbUtilsService.mergeUsersWithData({feature:"allUserNotifications",data:c||[]})),a&&(c=this.commonDbUtilsService.mergeCommentAnnotationsWithData({feature:"allUserNotifications",data:c||[]})),t=Object.values(c??{})}return t.forEach(c=>{c.notification=this.getClientNotificationObject(c)}),t.sort((c,p)=>p.timestamp-c.timestamp),t.map(c=>c.notification).filter(c=>!!c)}),fe(t=>{let r={data:t?.reduce((a,s)=>(a[s.id]={notification:s},a),{}),operation:null};return this.commonDbUtilsService.mergeLocationMetadataWithData$({data:r,feature:"allUserNotifications"}).pipe(de(a=>Object.values(a?.data||{}).map(s=>s?.notification)))}))),fe(e=>{let t=this.docService.getOrganizationConfig()?.organizationId??"";return this.docService.getOrganizationMetadata$(t).pipe(de(()=>e))}),fe(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=Nn(e)),t&&typeof t=="object"){let s=or(t);r=Nn(JSON.stringify(s))}}catch(s){this.loggingService.catch("Error in ViewsService subscribeViewsData: ",s)}return ti(this.afAuth).pipe(Fe(s=>!!s),fe(s=>this.isFeatureAllowed({firebaseUser:s})),fe(s=>s.featureAllowed?this.iamService.isUserAllowed$().pipe(de(c=>(s.featureAllowed=c,s))):se(s)),fe(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(fe(c=>this.docService.getDocumentPaths$().pipe(de(p=>(this.documentPaths=p,c.documentPaths=p,c)))),fe(c=>this.getDataFromDocumentId(a)))))}isFeatureAllowed(e){return this.configService.getConfig$().pipe(Fe(t=>!!t),de(t=>D(E({},e),{config:t})),fe(t=>this.authService.getUser$().pipe(de(r=>D(E({},t),{user:r})))),fe(t=>no(t.config,t.user,Re.NOTIFICATION)?se(D(E({},t),{featureAllowed:!0})):(this.loggingService.warn("Notification feature is not allowed."),se(D(E({},t),{featureAllowed:!1})))))}getDataFromDocumentId(e){return this.databaseService.getDb().pipe(Fe(t=>!!t),fe(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+=`/${U.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${this.documentPaths.organizationId}`);let a=Mi(this.db,`${e?r+"/"+U.FIREBASE_PARTIAL_PATH_DOCS+"/"+e+"/"+U.FIREBASE_PARTIAL_PATH_VIEWS+"/":this.documentPaths?.notifications}`);return yM(a).pipe(zn(s=>(this.loggingService.catch("Error in NotificationService getDataFromDocumentId: ",s),se(null))),de(s=>{let c=[],p=new Map;s?.raw&&(Object.keys(s?.raw||{}).forEach(f=>{let I=s?.raw[f];I?.id&&c.push(I)}),c.forEach(f=>{f.id&&p.set(f.id,f)})),this.notifications$.next(c),this.rawNotificationsByIdMap$.next(p);let g=[];s?.processed&&Object.keys(s?.processed||{}).forEach(f=>{let I=s?.processed[f];I?.id&&g.push(I)}),this.processedNotifications$.next(g),this.setNotificationsByIdMap()}))}else return se(null)}))}setNotificationsByIdMap(){try{let e=this.authService.getUser();if(e){let t=this.notificationViews$.getValue(),r;e?.email&&(r=Tt(e?.email));let a;e?.userId&&(a=Tt(e?.userId));let s=new Map;this.processedNotifications$.getValue().forEach(p=>{if(p.id&&p?.displayHeadlineMessageTemplate){let g=!1;(r&&p.notifyUsers?.[r]||a&&p.notifyUsers?.[a])&&(g=!0);let f={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:g,notificationSourceData:p.notificationSourceData},I=this.getRawNotificationById(f.id);if(I?.metadata&&(f.metadata={apiKey:I.metadata.apiKey,organizationId:I.metadata.organizationId,clientOrganizationId:I.metadata.clientOrganizationId,documentId:I.metadata.documentId,clientDocumentId:I.metadata.clientDocumentId,location:I?.location,locationId:I?.locationId}),f?.notificationSource==="comment"&&f?.targetAnnotationId){let T=this.commentService?.getAnnotationById(f.targetAnnotationId);T||I?.annotationData&&(T=I.annotationData),T&&(f.notificationSourceData=this.commentService?.getCommentAnnotationForClient(T))}s.set(p.id,f)}}),s.forEach((p,g)=>{p.isUnread=p?.actionUser?.userSnippylyId!==e?.userSnippylyId&&!t?.notification?.[g]?.views?.[e?.userSnippylyId],s.set(g,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 c=this.authService.getUser(),p=s||e;if(p.id&&p?.displayHeadlineMessageTemplate&&c){let g=null;c?.email&&(g=Tt(c?.email));let f=null;c?.userId&&(f=Tt(c?.userId));let I=!1,T=!0;(g&&p.notifyUsers?.[g]||f&&p.notifyUsersByUserId?.[f])&&(I=!0),f&&a?.[f]&&(T=!1);let L={id:p.id};if(s?L=D(E(E({},L),s),{displayHeadlineMessage:this.getNotificationHeadlineMessage(s),displayBodyMessage:this.getNotificationBodyMessage(s),forYou:I,isUnread:T}):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:I,isUnread:T,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=this.commentService?.getCommentAnnotationForClient(G))}return t?.targetAnnotationData?.isCommentResolverUsed&&(L.isCommentResolverUsed=t?.targetAnnotationData?.isCommentResolverUsed),L}return}catch(c){this.loggingService.catch("Error in NotificationService getClientNotificationObject: ",c);return}}getNotificationsForYou$(){return this.notificationsForYou$.asObservable()}getNotificationsByDocumentId$(){return this.notificationsByDocumentIdMap$.asObservable().pipe(de(e=>e?Object.keys(e??{}).map(t=>{let r=e[t].notifications||[],a=r.filter(c=>c.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 fm({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 c=this.docService.getLocation();c&&(e.location=c?.location,e.locationId=c?.locationId),this.loggingService.log(`[NOTIFICATION] ${e?.notificationSource} ${e?.actionType}`,e);let p=this.commonDbService.getServerTimestamp(),g=this.notificationUtilsService.formatNotification(e,p);return JSON.parse(JSON.stringify(g))}catch(t){return this.loggingService.catch("Error in NotificationService processNotificationData: ",t),null}}updateNotificationDatabase(e){try{let t=Mi(this.notificationsDb),r=this.processNotificationData(e);dM(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(fe(t=>t?t.organizationId?this.getAllNotifications$().pipe(fe(r=>this.notificationsForYou$.pipe(de(a=>{if(r||a){let s=new Map;return(!e?.type||["all","documents"].includes(e.type))&&(r||[]).forEach(c=>{c.id&&s.set(c.id,c)}),(!e?.type||["all","forYou"].includes(e.type))&&(a||[]).forEach(c=>{c.id&&!s.has(c.id)&&s.set(c.id,c)}),Array.from(s.values()).sort((c,p)=>(p.timestamp||0)-(c.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)),zu()):se(null)),_t(Xt))}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,c=r.replace(s,(p,g)=>(g==="actionUser"||g==="recipientUser")&&a[g]?t?.email&&a[g].email===t?.email||t?.userId&&a[g]?.userId===t?.userId?"You":a[g].name||a[g].email||' <velt-skeleton-loader width="50px" height="20px" border-radius="4px"></velt-skeleton-loader> ':a[g]?a[g]:p);return this.domService.sanitizeHtml(c)}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>'),t=t?.replaceAll(`@User ${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(U.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL)?this.historyPanelVisible$.next(e):this.loggingService.catch("Error in NotificationService setHistoryPanelVisibility: ",`<${U.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL}> tag is not added.`):this.historyPanelVisible$.next(e),e?this.analyticsService.trackEvent(Y.Events.Notifications.NOTIFICATION_HISTORY_PANEL_OPENED):this.analyticsService.trackEvent(Y.Events.Notifications.NOTIFICATION_HISTORY_PANEL_CLOSED)}catch{this.loggingService.catch("Error in NotificationService setHistoryPanelVisibility: ",`<${U.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(U.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL)?(this.historyPanelVisible$.next(!this.historyPanelVisible$.value),this.historyPanelVisible$.value?this.analyticsService.trackEvent(Y.Events.Notifications.NOTIFICATION_HISTORY_PANEL_TOGGLED,{action:"closed"}):this.analyticsService.trackEvent(Y.Events.Notifications.NOTIFICATION_HISTORY_PANEL_TOGGLED,{action:"opened"})):this.loggingService.catch("Error in NotificationService toggleHistoryPanelVisibility: ",`<${U.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL}> tag is not added.`)}catch{this.loggingService.catch("Error in NotificationService toggleHistoryPanelVisibility: ",`<${U.TAGS.VELT_NOTIFICATIONS_HISTORY_PANEL}> tag is not added.`)}}getHistoryPanelVisibility$(){return this.historyPanelVisible$.asObservable()}setNotificationsAsRead(e){return Q(this,null,function*(){try{let t=JSON.parse(JSON.stringify(this.getUserNotificationsFromServer()));if(e?.length){for(let c=0;c<e.length;c+=50){let g=e.slice(c,c+50).filter(T=>T?.id),f=g.map(T=>this.setNotificationAsRead({notification:T,userNotifications:JSON.parse(JSON.stringify(t))})),I=yield Promise.all(f);g.forEach((T,L)=>{let G=I[L];if(!G.some(J=>J.notificationId===T.id))t=t.filter(J=>J.notificationId!==T.id);else{let J=t.find(_e=>_e.notificationId===T.id),le=G.find(_e=>_e.notificationId===T.id);J&&le?.views&&(J.views=le.views)}})}let a=JSON.parse(JSON.stringify(this.notificationsByDocumentIdMap$.getValue()||{}));e.forEach(c=>{let p=c.metadata?.documentId;if(p&&a?.[p]){let g=a?.[p]?.notifications||[],f=g.find(I=>I.id===c.id);f&&(f.isUnread=!1),a[p].notifications=g}}),this.notificationsByDocumentIdMap$.next(a),!ui(t,this.getUserNotificationsFromServer())&&this.setUserNotificationsFromServer(t)}}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(ot(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),fe(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(r){return Q(this,arguments,function*({notification:e,userNotifications:t}){try{let a=this.authService.getUser();if(a&&e?.id){let s=Tt(a?.userId),{metadata:c}=e;if(c){let{apiKey:p,organizationId:g,documentId:f}=c;if(p&&g&&f&&s){let I=yield this.commonDbService.getData({feature:"docNotification",properties:{id:e.id,organizationId:g,documentId:f,apiKey:p}});I?.notificationId&&(I?.views?.[s]||(I.views||(I.views={}),I.views[s]={timestamp:Date.now()},this.commonDbService.updateData({feature:"docNotificationViews",properties:{id:e.id,organizationId:g,documentId:f,apiKey:p},data:I})));let T=yield this.commonDbService.getData({feature:"userNotification",properties:{id:e.id,userId:s,documentId:f,organizationId:g}});if(T?.notificationId){if(!this.getReadNotificationsOnForYouTab())yield this.commonDbService.deleteData({feature:"userNotification",properties:{id:e.id,userId:s,documentId:f,organizationId:g}}),t=t.filter(L=>L.notificationId!==e.id);else if(!T?.views?.[s]){T.views||(T.views={}),T.views[s]={timestamp:Date.now()};let L=t.find(G=>G.notificationId===e.id);L&&(L.views=T.views),this.commonDbService.updateData({feature:"userNotificationViews",properties:{id:e.id,userId:s,documentId:f,organizationId:g},data:T})}}}}}return t}catch(a){return this.loggingService.catch("Error in NotificationService setNotificationAsRead: ",a),t}})}setMaxDays(e){try{e>0?this.maxNotificationDays$.next(e):this.maxNotificationDays$.next(15)}catch(t){this.loggingService.catch("Error in NotificationService setMaxDays: ",t)}}setTabConfig(e){try{e&&this.tabConfig$.next(e)}catch(t){this.loggingService.catch("Error in NotificationService setTabConfig: ",t)}}getTabConfig$(){return this.tabConfig$.asObservable()}getTabConfig(){return this.tabConfig$.value}enableReadNotificationsOnForYouTab(){this.readNotificationsOnForYouTab$.next(!0)}disableReadNotificationsOnForYouTab(){this.readNotificationsOnForYouTab$.next(!1)}getReadNotificationsOnForYouTab$(){return this.readNotificationsOnForYouTab$.asObservable()}getReadNotificationsOnForYouTab(){return this.readNotificationsOnForYouTab$.value}enableCurrentDocumentOnly(){try{if(this.currentDocumentOnly$.value===!0)return;this.currentDocumentOnly$.next(!0)}catch(e){this.loggingService.catch("Error in NotificationService enableCurrentDocumentOnly: ",e)}}disableCurrentDocumentOnly(){try{if(this.currentDocumentOnly$.value===!1)return;this.currentDocumentOnly$.next(!1)}catch(e){this.loggingService.catch("Error in NotificationService disableCurrentDocumentOnly: ",e)}}getCurrentDocumentOnly$(){return this.currentDocumentOnly$.asObservable()}getCurrentDocumentOnly(){return this.currentDocumentOnly$.value}markNotificationAsReadById(e){return Q(this,null,function*(){try{this.getNotifications$().pipe(ot(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=Tt(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)(ee(Pi),ee(tt),ee(je),ee(Ft),ee(un),ee(Cm),ee(tu),ee(Js),ee(In),ee(rt),ee(Le),ee(En),ee(y),ee(f9),ee(Ln),ee(xo),ee(ss),ee(ni))},o.\u0275prov=Pe({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(U.CommentAnnotationStatusMap),this._customPriorityMap=new ve(U.CommentAnnotationPriorityMap),this._customCategoryMap=new ve(U.CommentCategoryMap);try{let t=sessionStorage.getItem(U.SESSION_STORAGE.VELT_CUSTOM_PRIORITY_MAP);t&&this._customPriorityMap.next(JSON.parse(t));let r=sessionStorage.getItem(U.SESSION_STORAGE.VELT_CUSTOM_STATUS_MAP);r&&this._customStatusMap.next(JSON.parse(r));let a=sessionStorage.getItem(U.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(U.CommentAnnotationStatusMap),sessionStorage.setItem(U.SESSION_STORAGE.VELT_CUSTOM_STATUS_MAP,JSON.stringify(U.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(U.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(U.CommentAnnotationPriorityMap),sessionStorage.setItem(U.SESSION_STORAGE.VELT_CUSTOM_PRIORITY_MAP,JSON.stringify(U.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(U.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(U.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 U.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 U.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[U.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(([c,p])=>p.type==="ongoing");a&&(e.status=a[1]);break;case"resolved":let s=t.find(([c,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=U.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=>U.CommentCategoryMap[t]))}catch(t){this.loggingService.catch("Error in CustomFilterService convertLegacyCategory: ",t)}return e}};o.\u0275fac=function(t){return new(t||o)(ee(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Cd=(()=>{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">
|
|
208
208
|
<path d="M35.8477 11.6603L40.4962 5.23427" stroke="#B0BEC5" stroke-width="1.92685" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
|
|
209
209
|
<path d="M21.8298 11.617L17.4655 6.02428" stroke="#B0BEC5" stroke-width="1.92685" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
|
|
210
210
|
<path d="M28.7568 9.77682L28.7761 1" stroke="#B0BEC5" stroke-width="1.92685" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
|
|
@@ -515,7 +515,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
515
515
|
Provide one more option
|
|
516
516
|
<|im_end|>
|
|
517
517
|
`),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)(ee(tt),ee(je),ee(Ft),ee(Le),ee(y),ee(xo))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var G9=class extends mi{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(Y.Events.Rewriter.ENABLE_REWRITER_TRIGGERED),this.getService(bd).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(Y.Events.Rewriter.DISABLE_REWRITER_TRIGGERED),this.getService(bd).disableRewriter()}catch(o){this.getService(y).catch("Error in disableRewriter: ",o)}}};var NFe=()=>({}),Xo=(()=>{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),te(1),b()),t&2&&(jo(r.customClass),at("--velt-skeleton-loader-height",r.height||"100%")("--velt-skeleton-loader-width",r.width||"100%")("--velt-skeleton-loader-border-radius",r.borderRadius||"inherit"),d("ngStyle",r.customStyles||gt(10,NFe)),m(),ye(" ","\u200E ",`
|
|
518
|
-
`))},dependencies:[np],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 FFe=["userAvatarRef"],LFe=["*"];function BFe(i,o){if(i&1&&(_(0,"div",7),w(1,"span",8),b()),i&2){let n=l(2).ngIf,e=l();at("background-color",n.background||"#625DF5"),x("data-testid",e.componentId+"-initial-container"),m(),at("color",n.textColor||"#FFFFFF"),x("data-modal-author-initial",n.initial)("data-testid",e.componentId+"-initial")}}function VFe(i,o){if(i&1){let n=K();_(0,"img",9),W("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();at("display",n.imgLoaded?"":"none !important"),d("src",n.src,fn),x("alt","User avatar")("data-testid",e.componentId+"-image")}}function UFe(i,o){if(i&1&&(v(0),_(1,"div",4,1),u(3,BFe,2,7,"div",5)(4,VFe,1,5,"ng-template",6),jt(5),b(),C()),i&2){let n=l().ngIf,e=l();m(),x("data-testid",e.componentId+"-container")("aria-label","User avatar"),m(2),d("ngIf",!n.imgLoaded),m(),d("ngIf",!n.imgLoadError)}}function jFe(i,o){if(i&1&&w(0,"velt-skeleton-loader-internal",10),i&2){let n=l().ngIf;d("height",n.size?n.size+"px":"100%")("width",n.size?n.size+"px":"100%")}}function $Fe(i,o){if(i&1&&(v(0),u(1,UFe,6,4,"ng-container",3)(2,jFe,1,2,"ng-template",null,0,xe),C()),i&2){let n=o.ngIf,e=me(3);m(),d("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 Jn=(()=>{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=Ee({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=D(E({},r),{[t]:e[t].currentValue}),r))}),e?.user){let t=e.user.currentValue;t?.photoUrl!==this.componentConfigSignal().src&&this.componentConfigSignal.update(r=>(r=D(E({},r),{src:t?.photoUrl,imgLoaded:!1,imgLoadError:!1}),r)),this.componentConfigSignal.update(r=>(r=D(E({},r),{background:t?.color||this.authService.getUserAvatarColor(t?.userId)}),r)),this.componentConfigSignal.update(r=>(r=D(E({},r),{textColor:t?.textColor||this.authService.getUserTextColor(t?.userId)}),r)),this.componentConfigSignal.update(r=>(r=D(E({},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=D(E({},e),{imgLoadError:!0}),e))}catch(e){this.loggingService.catch("Error in UserAvatarComponent onImageLoadError: ",e)}}onImageLoaded(){try{this.componentConfigSignal.update(e=>(e=D(E({},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&&it(FFe,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:LFe,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&&(Ht(),u(0,$Fe,4,2,"ng-container",2)),t&2&&d("ngIf",r.componentConfigSignal())},dependencies:[X,Xo],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 HFe=["selectionElementPortalOverlay"],zFe=()=>["velt-overlay-panel"],GFe=i=>[i];function WFe(i,o){if(i&1&&(v(0),_(1,"span",10),te(2),P(3,"translate"),b(),C()),i&2){let n=l(),e=n.$implicit,t=n.index,r=l(5);m(),at("--velt-selection-color",e==null||e.user==null?null:e.user.color),x("data-testid",r.componentId+"-user-name-"+t),m(),Ge(M(3,4,(e==null||e.user==null?null:e.user.name)||(e==null||e.user==null?null:e.user.email)))}}function qFe(i,o){if(i&1&&(v(0),u(1,WFe,4,6,"ng-container",3),C()),i&2){let n=o.index,e=l(5);m(),d("ngIf",n<e.maxCount)}}function YFe(i,o){if(i&1&&(_(0,"span",11),te(1),b()),i&2){let n=l(4).ngIf,e=l();at("--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(),ye("+",(n.selections==null?null:n.selections.length)-e.maxCount)}}function KFe(i,o){if(i&1&&(v(0),_(1,"div",7),P(2,"translate"),u(3,qFe,2,1,"ng-container",8)(4,YFe,2,5,"span",9),b(),C()),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),d("ngForOf",n.selections),m(),d("ngIf",(n.selections==null?null:n.selections.length)>e.maxCount)}}function ZFe(i,o){if(i&1&&(v(0),w(1,"snippyly-user-avatar",13),C()),i&2){let n=l(),e=n.$implicit,t=n.index;m(),at("--velt-selection-color",e==null||e.user==null?null:e.user.color)("--velt-selection-user-index",t),d("size",20)("user",e==null?null:e.user)}}function XFe(i,o){if(i&1&&(v(0),u(1,ZFe,2,6,"ng-container",3),C()),i&2){let n=o.index,e=l(5);m(),d("ngIf",n<e.maxCount)}}function QFe(i,o){if(i&1&&(_(0,"div",14),P(1,"translate"),_(2,"span",15),te(3),b()()),i&2){let n=l(4).ngIf,e=l();at("--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),ye("+",(n.selections==null?null:n.selections.length)-e.maxCount)}}function JFe(i,o){if(i&1&&u(0,XFe,2,1,"ng-container",8)(1,QFe,4,9,"div",12),i&2){let n=l(3).ngIf,e=l();d("ngForOf",n.selections),m(),d("ngIf",(n.selections==null?null:n.selections.length)>e.maxCount)}}function eLe(i,o){if(i&1&&u(0,KFe,5,6,"ng-container",6)(1,JFe,2,2,"ng-template",null,2,xe),i&2){let n=me(2),e=l(2).ngIf,t=l();d("ngIf",(e==null?null:e.userIndicatorType)===(t.userIndicatorTypes==null?null:t.userIndicatorTypes.Label))("ngIfElse",n)}}function tLe(i,o){if(i&1&&(v(0),w(1,"div",4,0),u(3,eLe,3,2,"ng-template",5,1,xe),C()),i&2){let n=me(2),e=l().ngIf,t=l();m(),at("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"),d("id","selection-element-contianer-"+(t.highlight.user==null?null:t.highlight.user.userSnippylyId)),x("data-testid",t.componentId),m(2),d("cdkConnectedOverlayOrigin",n)("cdkConnectedOverlayOpen",!0)("cdkConnectedOverlayLockPosition",!1)("cdkConnectedOverlayGrowAfterOpen",!0)("cdkConnectedOverlayDisableClose",!0)("cdkConnectedOverlayPanelClass",gt(13,zFe))("cdkConnectedOverlayPositions",A(14,GFe,e==null?null:e.overlayPosition))}}function nLe(i,o){if(i&1&&(v(0),u(1,tLe,5,16,"ng-container",3),C()),i&2){let n=o.ngIf;m(),d("ngIf",n==null?null:n.position)}}var qpe=(()=>{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 Qg,this.position=null,this.userIndicatorTypes=PC,this.offsetLeft=0,this.offsetTop=0,this.maxCount=1,this.componentConfigSignal=Ee({userIndicatorPosition:BI.End,userIndicatorType:PC.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(c=>(c=D(E({},c),{userIndicatorPosition:a,userIndicatorType:s}),c)),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=D(E({},t),{selections:e}),t))}catch(t){this.loggingService.catch("Error in SelectionElementPortalComponent setSelections: ",t)}}addSelection(e){try{this.componentConfigSignal.update(t=>(t=E({},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=D(E({},t),{overlayPosition:{originX:"start",originY:"top",overlayX:"start",overlayY:"top"}}),t));break;default:this.componentConfigSignal.update(t=>(t=D(E({},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=aI(this.highlight.targetElement);if(e){let t=e.iterateNext(),r,a=null,s=null;try{r=JSON.parse(t?.getAttribute(U.ATTRIBUTES.VELT_SELECTION_CONFIG)||"{}"),a=t?.getAttribute(U.ATTRIBUTES.VELT_LIVE_SELECTION_USER_INDICATOR_POSITION)||this.componentConfigSignal().userIndicatorPosition,a&&this.setOverlayPosition(a),s=t?.getAttribute(U.ATTRIBUTES.VELT_LIVE_SELECTION_USER_INDICATOR_TYPE)||this.componentConfigSignal().userIndicatorType,this.componentConfigSignal.update(p=>(p=D(E({},p),{userIndicatorPosition:a,userIndicatorType:s}),p))}catch{}let c;if(r?.horizontal&&(c=r.horizontal),a==="start"?c="top-start":c="top-right",t){let p=t.getBoundingClientRect();if(p&&p.width&&p.height)switch(c){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=D(E({},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(tl),h(R))},o.\u0275cmp=O({type:o,selectors:[["app-selection-element-portal"]],viewQuery:function(t,r){if(t&1&&it(HFe,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","cdkConnectedOverlayPanelClass","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&&u(0,nLe,2,1,"ng-container",3),t&2&&d("ngIf",r.componentConfigSignal())},dependencies:[Et,X,dn,sn,Jn,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 $C=(i,o)=>{try{let n=oLe(i),e=[],t=[];return n.forEach(r=>{r?.parentElement?.closest(U.TAGS.SNIPPYLY_TEXT_HIGHLIGHT)?r?.parentElement?.normalize():t.push(r)}),t.forEach(r=>{let a=rLe(r,o);a&&e.push(a)}),e}catch(n){return et.catch("Error in highlighter highlightRange: ",n),[]}},oLe=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 et.catch("Error in highlighter getTextNodesInRange: ",o),[]}},rLe=(i,o)=>{try{let n=document.createElement(o||U.TAGS.SNIPPYLY_TEXT_HIGHLIGHT);return i.parentElement?.replaceChild(n,i),n.appendChild(i),n}catch(n){return et.catch("Error in highlighter highlightNode: ",n),null}};var tl=(()=>{let o=class o{constructor(e,t,r,a,s,c,p,g,f,I,T){this.afAuth=e,this.authService=t,this.configService=r,this.databaseService=a,this.docService=s,this.domService=c,this.componentFactoryResolver=p,this.injector=g,this.appRef=f,this.loggingService=I,this.commonDbService=T,this.documentPaths=null,this.textSelections={},this.enableSelections$=new ve(!1),this.userIndicatorEnabled$=new ve(!0),this.userIndicatorPosition$=new ve(BI.End),this.userIndicatorType$=new ve(PC.Avatar),this.defaultElementsTrackingEnabled$=new ve(!0),this.defaultStylingEnabled$=new ve(!0),this.elementSelections={},this.databaseService.getDb().pipe(Fe(L=>!!L),ot(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 z=this.domService.getXPath(G);if(z){let J=new Qg;J.type="click",J.targetElement=z,this.setSelection(J)}}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 z=this.domService.getXPath(G);if(z){let J=new Qg;J.type="focus",J.targetElement=z,this.setSelection(J)}}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(fe(()=>this.isFeatureAllowed$({})),Fe(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=Ble([L]),z=new Qg;z.type="selection",z.targetTextRange=G?.length?G[0]:null,this.setSelection(z)}}}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(Di()).subscribe(([L,G])=>{try{if(L){let z=[];Object.keys(L).forEach(J=>{let le=L[J],_e=G?G[J]:null;!ui(le,_e)&&J!==this.getUserIdHash(this.user)&&z.push(le)}),z.forEach(J=>{if(J.targetElement){let le=this.elementSelections[J?.targetElement]?.portalRef,De=(this.elementSelections[J?.targetElement]?.selections||[]).filter(Be=>this.getUserIdHash(Be.user)!==this.getUserIdHash(J?.user));De?.length?(le.instance.setSelections(De.slice()),this.elementSelections[J?.targetElement].selections=De.slice(),this.highlightElement(De[0])):(this.removeHighlightFromElement(J),this.removeSelectionElement(J))}else J.targetTextRange&&this.removeHighlightFromText(J)})}if(G){let z=[];Object.keys(G).forEach(J=>{let le=L?L[J]:null,_e=G[J];!ui(le,_e)&&J!==this.getUserIdHash(this.user)&&z.push(_e)}),z.forEach(J=>{J.targetElement?(this.highlightElement(J),this.getUserIndicatorEnabled()&&this.setElementHighlight(J)):J.targetTextRange&&this.highlightText(J)})}}catch(z){this.loggingService.catch("Error in SelectionService getSelectionsOnCurrentDocument: ",z)}},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(),Re.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;"),ti(this.afAuth).pipe(Fe(e=>!!e),fe(e=>this.isFeatureAllowed$({firebaseUser:e})),fe(e=>e.featureAllowed?se(e).pipe(fe(t=>this.docService.getDocumentPaths$().pipe(de(r=>(this.documentPaths=r,t)))),fe(t=>t?.user?t?.user?.isAnonymous?se(null):this.documentPaths?this.databaseService.getDb().pipe(Fe(r=>!!r),fe(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(Fe(t=>!!t),de(t=>D(E({},e),{config:t})),fe(t=>this.authService.getUser$().pipe(de(r=>(this.user=r,D(E({},t),{user:r}))))),fe(t=>no(t.config,t.user,Re.LIVE_SELECTION)?se(D(E({},t),{featureAllowed:!0})):(this.loggingService.warn("Live Selection feature is not allowed."),se(D(E({},t),{featureAllowed:!1})))),_t((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(U.ATTRIBUTES.VELT_SELECTION_CONFIG)&&(s=JSON.parse(r?.getAttribute(U.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=q0(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=$C(r,U.TAGS.SNIPPYLY_HIGHLIGHT_USER_TEXT),s=[],c=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,U.VELT_LIVE_SELECTION_ON_TEXT),this.getDefaultStylingEnabled()&&this.domService.addClassToElement(p,U.VELT_LIVE_SELECTION_ON_TEXT_DEFAULT),e.user?.color&&p.style.setProperty(U.VELT_SELECTION_COLOR,e.user?.color+"55"),s.push({element:p,textNode:p.childNodes[0]}))}),c)){let p=a.filter(f=>f?.textContent?.trim()),g=p?.length?p[p?.length-1]:null;g&&g.parentNode.insertBefore(c,g.nextSibling)}this.textSelections[this.getUserIdHash(e?.user)]={textNodes:s,marker:c}}}}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&&U.SELECTION_ENABLED_ELEMENTS[e.tagName?.toLowerCase()]?e:JH(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 lr(qpe),c=new cr(a,this.appRef,this.injector),p=c.attach(s);p.instance.highlight=e,p.instance.setSelections([e]),this.elementSelections[e.targetElement]={selectionHostDomPortalOutlet:c,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?Tt(e?.userId):null}catch(t){return this.loggingService.catch("Error in SelectionService getUserIdHash: ",t),null}}};o.\u0275fac=function(t){return new(t||o)(ee(Pi),ee(je),ee(Ft),ee(In),ee(rt),ee(Le),ee(ko),ee(yt),ee(ii),ee(y),ee(un))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var W9=class extends mi{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(Y.Events.Selection.ENABLE_LIVE_SELECTION_TRIGGERED),this.getService(tl).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(Y.Events.Selection.DISABLE_LIVE_SELECTION_TRIGGERED),this.getService(tl).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(Y.Events.Selection.ENABLE_USER_INDICATOR_TRIGGERED),this.getService(tl).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(Y.Events.Selection.DISABLE_USER_INDICATOR_TRIGGERED),this.getService(tl).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(Y.Events.Selection.SET_USER_INDICATOR_POSITION_TRIGGERED,{payload:{position:o}}),this.getService(tl).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(Y.Events.Selection.SET_USER_INDICATOR_TYPE_TRIGGERED,{payload:{type:o}}),this.getService(tl).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(Y.Events.Selection.ENABLE_DEFAULT_ELEMENTS_TRACKING_TRIGGERED),this.getService(tl).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(Y.Events.Selection.DISABLE_DEFAULT_ELEMENTS_TRACKING_TRIGGERED),this.getService(tl).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(Y.Events.Selection.ENABLE_DEFAULT_STYLING_TRIGGERED),this.getService(tl).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(Y.Events.Selection.DISABLE_DEFAULT_STYLING_TRIGGERED),this.getService(tl).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(Y.Events.Selection.GET_LIVE_SELECTION_DATA_TRIGGERED),this.getService(tl).getSelectionsOnCurrentDocument()}catch(o){return this.getService(y).catch("Error in _getLiveSelectionData: ",o),se(null)}}};var cs=(()=>{let o=class o{constructor(e,t,r,a,s,c,p,g,f,I,T,L,G,z,J){this.analyticsService=e,this.configService=t,this.docService=r,this.databaseService=a,this.authService=s,this.domService=c,this.afAuth=p,this.iamService=g,this.avatarService=f,this.contactService=I,this.storageService=T,this.dialog=L,this.loggingService=G,this.notificationService=z,this.commonDbService=J,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(Fe(le=>!!le),ot(1)).subscribe(le=>{le&&this.getDocumentPaths()},le=>{this.loggingService.catch("Error in TagService getDb subscription: ",le)}),this.domService.onWindowPointerMove$().subscribe(le=>{if(this.addTagMode$.value){this.hightlightElement&&this.domService.removeHighlightFromElement(this.hightlightElement);let _e=this.domService.getBackgroundElement(le.clientX,le.clientY);_e&&(this.isElementInsideAllowedElements(_e)?wk(le.target)?this.domService.removeClassFromElement(document.body,"show-pin-cursor"):(this.domService.addClassToElement(document.body,"show-pin-cursor"),this.hightlightElement=_e,this.domService.highlightElement(this.hightlightElement,U.CURSOR.TAG_PIN)):this.domService.removeClassFromElement(document.body,"show-pin-cursor"))}},le=>{this.loggingService.catch("Error in TagService onWindowPointerMove$ subscription: ",le)}),this.domService.onWindowKeyupEsc$().subscribe(le=>{this.addTagMode$.value&&this.disableAddTagMode()},le=>{this.loggingService.catch("Error in TagService onWindowKeyupEsc$ subscription: ",le)}),this.domService.onDocumentClick$().subscribe(le=>{if(le&&this.addTagMode$.value){if(le.preventDefault(),le.stopPropagation(),!wk(le.target)){let _e=this.domService.getBackgroundElement(le.clientX,le.clientY);_e&&this.isElementInsideAllowedElements(_e)&&this.addTag(le)}this.disableAddTagMode()}},le=>{this.loggingService.catch("Error in TagService onDocumentClick$ subscription: ",le)}),this.addTagMode$.subscribe(le=>{this.hightlightElement&&this.domService.removeHighlightFromElement(this.hightlightElement),le?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"))},le=>{this.loggingService.catch("Error in TagService addTagMode$ subscription: ",le)}),this.domService.onWindowKeyupBackspace$().subscribe(le=>{this.deleteTagPinAnnotations("keyupBackspace")},le=>{this.loggingService.catch("Error in TagService onWindowKeyupBackspace$ subscription: ",le)}),this.domService.onWindowKeyupDelete$().subscribe(le=>{this.deleteTagPinAnnotations("keyupDelete")},le=>{this.loggingService.catch("Error in TagService onWindowKeyupDelete$ subscription: ",le)}),this.domService.getDeleteCommmentAnnotations$().subscribe(le=>{le?.length&&(le?.filter(De=>De.type==="tag")).forEach(De=>Q(this,null,function*(){yield this.deleteTagPinAnnotation(De)}))},le=>{this.loggingService.catch("Error in TagService onWindowKeyupDelete$ subscription: ",le)})}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=Nn(e)),t&&typeof t=="object"){let c=or(t);a=Nn(JSON.stringify(c))}}catch(c){this.loggingService.catch("Error in TagService getAllTagAnnotations: ",c)}return ti(this.afAuth).pipe(Fe(c=>!!c),fe(c=>this.isFeatureAllowed({firebaseUser:c,annotations:[],filteredAnnotations:[]})),fe(c=>c.featureAllowed?this.iamService.isUserAllowed$().pipe(de(p=>(c.featureAllowed=p,c))):se(c)),fe(c=>c.featureAllowed?this.authService.isPlanExpired$().pipe(de(p=>(c.featureAllowed=!p,c))):se(c)),fe(c=>c.featureAllowed?se(c).pipe(fe(p=>this.docService.getDocumentPaths$().pipe(de(g=>(this.documentPaths=g,p.documentPaths=g,p)))),fe(p=>this.getDataFromDocumentId(s).pipe(de(g=>(p.annotations=g||[],E({},p))))),fe(p=>this.docService.getLocation$().pipe(de(g=>(p.location=g,p)))),fe(p=>this.docService.getLocations$().pipe(de(g=>(p.customLocations=g,p)))),de(p=>{if(p.filteredAnnotations=[],s&&!a)return p.filteredAnnotations=p.annotations?.slice(),p;{let g=[];return a?g.push(a):(g.push(p?.location?.locationId),g.push(...Object.values(p?.customLocations||[]).map(f=>f.locationId))),p.filteredAnnotations=this.filterAnnotationsByLocationIds(p?.annotations,g),p}}),fe(p=>r?se(p):p?.annotations?.length?this.domService.onWindowResize$().pipe(de(()=>p)):se(p)),fe(p=>r?se(p):p?.annotations?.length?this.domService.onDomChange$("TagService getAllTagAnnotations").pipe(de(()=>p)):se(p)),de(p=>(p?.filteredAnnotations?.forEach(g=>{this.calculateTagAnnotationPosition(g)}),p)),fe(p=>p?.filteredAnnotations?se(p?.filteredAnnotations||[]):se([]))):se([])))}isFeatureAllowed(e){return this.configService.getConfig$().pipe(Fe(t=>!!t),de(t=>D(E({},e),{config:t})),fe(t=>this.authService.getUser$().pipe(de(r=>D(E({},t),{user:r})))),fe(t=>no(t.config,t.user,Re.TAG)?se(D(E({},t),{featureAllowed:!0})):(this.loggingService.warn("Tag feature is not allowed."),se(D(E({},t),{featureAllowed:!1})))))}getDataFromDocumentId(e){return this.databaseService.getDb().pipe(Fe(t=>!!t),fe(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(D(E({},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&&wi(r)){let a=r.getBoundingClientRect();if(a&&a.width&&a.height){let{height:s,width:c}=Bg(r);e.position={top:s*e.targetElement.topPercentage/100,left:c*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((c,p)=>{c?.annotationId&&(c.annotationIndex=p+1)});let s=[];if(t)r?s=a.filter(c=>c.locationId===r):s=a.slice();else{let c=this.docService.getLocation();c&&c.locationId?s=a.filter(p=>p.locationId===c.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 UI;a.from=r,a.color=U.DEFAULT_ANNOTATION_COLOR,a.resolved=!1,a.lastUpdated=this.timestamp;let{topPositionX:s,topPositionY:c}=this.domService.getTopLeftPosition();a.positionX=s,a.positionY=c;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 g=this.domService.getXPath(a.targetElement.xpath);if(g){let f=g.iterateNext();f&&(wi(f)||(a.targetElement=null))}}this.setLocationToTagAnnotation(a),a.pageInfo=ki(),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(Re.TAG)&&this.docService.getDocumentPaths$().pipe(Fe(t=>!!t),ot(1),fe(t=>(this.documentPaths=t,this.loggingService.log(this.documentPaths),this.databaseService.getDb().pipe(Fe(r=>!!r),ot(1),fe(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(U.SESSION_STORAGE.SNIPPYLY_AUTO_SELECT_ANNOTATION_ID,e.annotationId),this.analyticsService.trackEvent(Y.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,rI.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,rI.RESOLVED),this.updateTagToDb(e),this.domService.updateSelectedAnnotationInMap([e]),this.analyticsService.trackEvent(Y.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&&(wi(r)||(e.targetElement=null))}}this.domService.updateSelectedAnnotationInMap([e]),this.authService.getUser()&&this.authService.isFeatureAllowed(Re.TAG)&&this.docService.getDocumentPaths$().pipe(Fe(t=>!!t),ot(1),fe(t=>(this.documentPaths=t,this.loggingService.log(this.documentPaths),this.databaseService.getDb().pipe(Fe(r=>!!r),ot(1),fe(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 c=t[s];c.type==="tag"&&r&&c.from&&(r?.isAdmin||c.from.userId===r.userId)&&a.push(c)})),a?.length&&(this.analyticsService.trackEvent(Y.Events.Tag.TAG_DELETE_TRIGGERED,{triggerType:e,annotationId:a.map(s=>s.annotationId).join()}),this.dialog.open(La,{panelClass:"velt-mat-dialog-container",data:{title:"Delete tag?",message:"This selected tag will be deleted.",yesButton:"Delete",noButton:"Cancel",variant:"tag"}}).afterClosed().pipe(ot(1)).subscribe(s=>{s&&(a.forEach(c=>Q(this,null,function*(){yield this.deleteTagPinAnnotation(c)})),setTimeout(()=>{document.querySelectorAll(`[${U.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(Re.TAG)&&this.documentPaths?.tag&&e?.annotationId?(this.updateNotificationsDatabase(e,rI.DELETED),this.analyticsService.trackEvent(Y.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(Re.TAG)?(this.analyticsService.trackEvent(Y.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(Y.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=ya(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 UI;t.from=e,t.color=U.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 c=this.docService.getLocation();return c&&(t.locationId=c.locationId,t.location=c.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=ki(),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=`${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentPaths?.documentId}/${U.FIREBASE_PARTIAL_PATH_TAG}/${t.annotationId}`;return this.documentPaths?.organizationId&&(r=`${U.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${this.documentPaths.organizationId}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentPaths?.documentId}/${U.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(U.URL_PARAMS.TAG_ID),t.searchParams.append(U.URL_PARAMS.TAG_ID,e.annotationId),t.href}};o.\u0275fac=function(t){return new(t||o)(ee(tt),ee(Ft),ee(rt),ee(In),ee(je),ee(Le),ee(Pi),ee(En),ee(hm),ee(Si),ee(nu),ee(lo),ee(y),ee(Cn),ee(un))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var q9=class extends mi{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(Y.Events.Tag.GET_ALL_TAG_ANNOTATIONS_TRIGGERED,{payload:{documentId:o,location:n}}),this.getService(cs).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(Y.Events.Tag.DELETE_TAG_TRIGGERED),this.getService(cs).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(Y.Events.Tag.ALLOWED_ELEMENT_IDS_TRIGGERED,{payload:{elementIds:o}}),this.getService(cs).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(Y.Events.Tag.ATTACH_TAG_TRIGGERED,{payload:{elementId:o}}),this.getService(cs).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(Y.Events.Tag.ADD_TAG_MODE_CHANGE_TRIGGERED),this.getService(cs).addTagModeChange()}catch(o){return this.getService(y).catch("Error in _addTagModeChange: ",o),se(!1)}}};var Y9=class extends mi{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(Y.Events.Views.GET_UNIQUE_VIEWS_BY_USER_TRIGGERED,{payload:{clientLocationId:o}}),this.getService(Os).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(Y.Events.Views.GET_UNIQUE_VIEWS_BY_DATE_TRIGGERED,{payload:{clientLocationId:o}}),this.getService(Os).getUniqueViewsByDate(o)}catch(n){return this.getService(y).catch("Error in getUniqueViewsByDate: ",n),se({})}}};var JI=(()=>{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??{},c=a?.metadata??{};c.disabled=!!s?.disabled,c.id=c?.clientDocumentId,c.documentId=c?.clientDocumentId,delete c?.clientDocumentId,c.organizationId=c?.clientOrganizationId,delete c?.clientOrganizationId,delete c?.pageInfo,delete c?.veltFolderId,r.push(c)}),{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 c=s?.metadata??{};return delete c?.veltFolderId,c.organizationId=c.clientOrganizationId,delete c?.clientOrganizationId,delete c?.veltParentFolderId,E({},c)});return{data:(t?.data?.map(s=>{let c=s?.metadata??{};return delete c?.veltFolderId,c.organizationId=c.clientOrganizationId,delete c?.clientOrganizationId,delete c?.veltParentFolderId,E(E({},c),e?.folderId?{subFolders:r}:{})})).reduce((s,c)=>(c?.folderId&&(s[c.folderId]=c),s),{})}}catch(t){return this.loggingService.catch("Error in CommentActionsService fetchFolders: ",t),{data:null}}})}};o.\u0275fac=function(t){return new(t||o)(ee(rt),ee(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var K9=(()=>{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 c=this.authService.getUser$(),p=this.docService.getDocumentPaths$(),g=this.iamService.isUserAllowed$();mn([c,p,g]).subscribe(([f,I,T])=>{f&&I&&T?this.veltInitState$.next(!0):this.veltInitState$.next(!1)}),this.getVeltInitState$().subscribe(f=>{this.coreActionsService.triggerAction(ct.DOCUMENT_INIT,f)})}catch(c){this.loggingService.catch("Error in VeltService constructor: ",c)}}getVeltInitState$(){try{return this.veltInitState$.asObservable().pipe(_t())}catch(e){return this.loggingService.catch("Error in VeltService getVeltInitState$: ",e),se(void 0)}}};o.\u0275fac=function(t){return new(t||o)(ee(je),ee(ni),ee(rt),ee(En),ee(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Z9=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(Ft).getApiKey(),c=K0(s,n.userId);if(t?.ha||this.getService(tt).trackEvent(Y.Events.Core.IDENTIFY,{apiKey:s,clientUserId:n.userId,snippylyUserId:c,forceReset:e?.forceReset,user:this.getService(je).getUserWithoutContacts(n),source:"client",fromProvider:t?.fromProvider},!0,c,n?.userId),!(n&&n.userId))this.getService(y).catch("Error in identify: ","Missing userId in config data."),e?.throwError?a("Missing userId in config data."):r(null);else if(typeof n.userId!="string")this.getService(y).catch("Error in identify: ","userId must be string."),e?.throwError?a("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."),e?.throwError?a("groupId must be string."):r(null);else{if(n?.groupId)if(n?.groupId?.match(/^[a-zA-Z0-9_]*$/))n.clientGroupId=n.groupId;else{let g=n.groupId;n.clientGroupId=g,n.groupId=Tt(g)}if(n?.organizationId){let g=n.organizationId;n.clientOrganizationId=g,n.organizationId=Tt(g)}delete n.isAdmin;let p=U.REGEX_URL_FOR_USER_NAME;n?.name&&p.test(n?.name)&&(n.name=n.name?.split(".")?.slice(0,-1)?.join(".")),n.clientUserName=n.name,n?.name&&n?.name?.length>30&&(n.name=n.name.slice(0,30)),this.getService(je).initializeClient(n,e||{},new Date().getTime(),void 0,"external").then(g=>{let f;try{g&&(f=JSON.parse(JSON.stringify(g)))}catch{}r(f)}).catch(g=>{this.getService(y).catch("Error in identify: ",g),e?.throwError?a(g):r(null)})}}catch(s){this.getService(y).catch("Error in identify: ",s),e?.throwError?a(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=Tt(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(Y.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(Y.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(rt).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(Y.Events.Core.SET_DOCUMENTS_TRIGGERED,{payload:{id:n,organizationId:e,methodName:"setDocumentId",source:"external"}}),n&&n.trim())return yield this.getService(rt).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(Y.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(rt).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(Y.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(rt).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(Y.Events.Core.UNSET_DOCUMENTS_TRIGGERED,{payload:{methodName:"unsetDocumentId",source:"external"}}),this.getService(rt).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(Y.Events.Core.UNSET_DOCUMENTS_TRIGGERED,{payload:{methodName:"unsetDocuments",source:"external"}}),this.getService(rt).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(Y.Events.Core.FETCH_DOCUMENTS_TRIGGERED,{payload:{options:n}}),this.getService(JI).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(Y.Events.Core.UPDATE_DOCUMENTS_TRIGGERED,{payload:{request:n}}),this.getService(JI).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(Y.Events.Core.UPDATE_LOCATIONS_TRIGGERED,{payload:{request:n}}),this.getService(JI).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(Y.Events.Core.FETCH_FOLDERS_TRIGGERED,{payload:{options:n}}),this.getService(JI).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(Y.Events.Core.SET_USER_DATA_PROVIDER_TRIGGERED),this.getService(Ln).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(Y.Events.Core.SET_DATA_PROVIDERS_TRIGGERED),n.comment&&this.getService(Js).setCommentAnnotationDataProvider(n.comment),n.user&&this.getService(Ln).setUserDataProvider(n.user),n.reaction&&this.getService(vm).setReactionAnnotationDataProvider(n.reaction),n.attachment)if(n.comment)this.getService(eu).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.setPermissionProvider=(n,e)=>{this.getService(y).log("%c[WB] Calling FUNCTION: setPermissionProvider","color: green;");try{e?.ha||this.trackEvent(Y.Events.Core.SET_PERMISSION_PROVIDER_TRIGGERED),this.getService(ss).setPermissionProvider(n)}catch(t){this.getService(y).catch("Error in setPermissionProvider: ",t)}},this.setEncryptionProvider=(n,e)=>{this.getService(y).log("%c[WB] Calling FUNCTION: setEncryptionProvider","color: green;");try{e?.ha||this.trackEvent(Y.Events.Core.SET_ENCRYPTION_PROVIDER_TRIGGERED),this.getService(Ft).setEncryptionProvider(n)}catch(t){this.getService(y).catch("Error in setEncryptionProvider: ",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(Y.Events.Core.GET_DOCUMENT_ID_TRIGGERED),this.getService(rt).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(Y.Events.Core.SET_LOCATIONS_TRIGGERED,{payload:{params:n,appendLocation:e,methodName:"setLocation",source:"external"}}),n&&typeof n=="object"?e?this.getService(rt).addLocation({location:n,source:"external"}):yield this.getService(rt).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(Y.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(rt).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(Y.Events.Core.SET_LOCATIONS_TRIGGERED,{payload:{locations:n,options:e,methodName:"setLocations",source:"external"}}),n&&Array.isArray(n)?yield this.getService(rt).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(Y.Events.Core.SET_LOCATIONS_TRIGGERED,{payload:{params:n,methodName:"addLocation",source:"external"}}),n&&typeof n=="object"?this.getService(rt).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(Y.Events.Core.SET_SCROLLABLE_ELEMENTS_IDS_TRIGGERED,{payload:{ids:n}}),n?this.getService(Le).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(Y.Events.Core.REMOVE_LOCATIONS_TRIGGERED,{payload:{location:n},methodName:"removeLocation",source:"external"}),this.getService(rt).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(Y.Events.Core.REMOVE_LOCATIONS_TRIGGERED,{payload:{locations:n},methodName:"removeLocations",source:"external"}),this.getService(rt).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(Y.Events.Core.UNSET_LOCATIONS_TRIGGERED,{payload:{locationIds:n},methodName:"unsetLocationIds",source:"external"}),this.getService(rt).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(Y.Events.Core.EXCLUDE_LOCATION_IDS_TRIGGERED,{payload:{ids:n}}),typeof n=="object"&&n instanceof Array&&(n=n.filter(t=>typeof t=="string"),this.getService(rt).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(Y.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(Si).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(Y.Events.Core.REMOVE_SCROLLABLE_ELEMENTS_IDS_TRIGGERED),this.getService(Le).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 j9(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 k9(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 T9(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 q9(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 W9(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 H9(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 D9(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 G9(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 N9(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 B9(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 I9(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 Y9(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 U9(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 x9(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 R9(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 S9(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 $9(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 w9(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(Y.Events.Core.GET_METADATA_TRIGGERED),this.getService(el).getGlobalMetadata()}catch(e){return this.getService(y).catch("Error in getMetadata: ",e),null}}),this.fetchDebugInfo=n=>Q(this,null,function*(){try{return n?.ha||this.trackEvent(Y.Events.Core.FETCH_DEBUG_INFO_TRIGGERED),this.getService(el).getDebugInfo()}catch(e){return this.getService(y).catch("Error in fetchDebugInfo: ",e),null}}),this.getDebugInfo=n=>{try{return n?.ha||this.trackEvent(Y.Events.Core.GET_DEBUG_INFO_TRIGGERED),this.getService(el).getDebugInfo$()}catch(e){return this.getService(y).catch("Error in getDebugInfo: ",e),se(null)}},this.disableFeatures=(n,e)=>{try{e?.ha||this.trackEvent(Y.Events.Core.DISABLE_FEATURES_TRIGGERED,{payload:{features:n}}),this.getService(Ft).disableFeatures(n)}catch(t){this.getService(y).catch("Error in disableFeatures: ",t)}},this.setDarkMode=(n,e)=>{try{e?.ha||this.trackEvent(Y.Events.Core.SET_DARK_MODE_TRIGGERED,{payload:{value:n}}),this.getService(Ye).setDarkMode(n)}catch(t){this.getService(y).catch("Error in setDarkMode: ",t)}},this.enableLogs=n=>{try{n?.ha||this.trackEvent(Y.Events.Core.ENABLE_LOGS_TRIGGERED),this.getService(Ft).enableLogs()}catch(e){this.getService(y).catch("Error in enableLogs: ",e)}},this.disableLogs=(n,e)=>{try{e?.ha||this.trackEvent(Y.Events.Core.DISABLE_LOGS_TRIGGERED),this.getService(Ft).disableLogs(n)}catch(t){this.getService(y).catch("Error in disableLogs: ",t)}},this.isUserAllowed$=n=>{try{return n?.ha||this.trackEvent(Y.Events.Core.IS_USER_ALLOWED_TRIGGERED),this.getService(En).isUserAllowed$()}catch(e){return this.getService(y).catch("Error in isUserAllowed$: ",e),se(!1)}},this.getUser=n=>{try{n?.ha||this.trackEvent(Y.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.getCurrentUser=n=>{try{return n?.ha||this.trackEvent(Y.Events.Core.GET_CURRENT_USER_TRIGGERED),this.getService(je).getUser$().pipe(de(e=>Dr(e)))}catch(e){return this.getService(y).catch("Error in getCurrentUser: ",e),se(null)}},this.getHeartbeat=(n,e)=>{try{return e?.ha||this.trackEvent(Y.Events.Core.GET_HEARTBEAT_TRIGGERED),this.getService(L9).getHeartbeat(n)}catch(t){return this.getService(y).catch("Error in getHeartbeat: ",t),se({data:null})}},this.getUserRole$=n=>{try{return n?.ha||this.trackEvent(Y.Events.Core.GET_USER_ROLE_TRIGGERED),this.getService(En).getRole$()}catch(e){return this.getService(y).catch("Error in getUserRole$: ",e),se("")}},this.getUserPermissions=(n,e)=>Q(this,null,function*(){try{return e?.ha||this.trackEvent(Y.Events.Core.GET_USER_PERMISSIONS_TRIGGERED,{payload:{request:n,source:"external"}}),this.getService(ss).getUserPermissions(n)}catch(t){return this.getService(y).catch("Error in getUserPermissions$: ",t),{}}}),this.getCurrentUserPermissions$=n=>{try{return n?.ha||this.trackEvent(Y.Events.Core.GET_CURRENT_USER_PERMISSIONS_TRIGGERED),this.getService(ss).getCurrentUserPermissions$()}catch(e){return this.getService(y).catch("Error in getCurrentUserPermissions$: ",e),se(null)}},this.getFeaturesAccessLevelIam$=n=>{try{return n?.ha||this.trackEvent(Y.Events.Core.GET_FEATURES_ACCESS_LEVEL_IAM_TRIGGERED),this.getService(En).getFeaturesAccessLevel$()}catch(e){return this.getService(y).catch("Error in getFeaturesAccessLevel$: ",e),se(void 0)}},this.isPlanExpired$=n=>{try{return n?.ha||this.trackEvent(Y.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(Y.Events.Core.GET_CUSTOMER_METADATA_TRIGGERED),this.getService(rt).getCustomerMetadata$()}catch(e){return this.getService(y).catch("Error in getCustomerMetadata$: ",e),se(null)}},this.getDocumentMetadata=n=>{try{return n?.ha||this.trackEvent(Y.Events.Core.GET_DOCUMENT_METADATA_TRIGGERED),this.getService(rt).getDocumentMetadata$()}catch(e){return this.getService(y).catch("Error in getDocumentMetadata: ",e),se(null)}},this.getVeltInitState=n=>{try{return n?.ha,this.getService(K9).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(Y.Events.Core.REMOVE_VELT_CONTENT_TRIGGERED),this.getService(Le).removeSnippylyContent(n)}catch(t){return this.getService(y).catch("Error in removeVeltContent: ",t),""}},this.injectCustomCss=(n,e)=>{try{e?.ha||this.trackEvent(Y.Events.Core.INJECT_CUSTOM_CSS_TRIGGERED),this.getService(y).log("%c[WB] Calling FUNCTION: injectCustomCss","color: green;"),this.getService(Le).setCustomCss(n)}catch(t){this.getService(y).catch("Error in injectCustomCss: ",t)}},this.setLanguage=(n,e)=>{try{e?.ha||this.trackEvent(Y.Events.Core.SET_LANGUAGE_TRIGGERED,{payload:{language:n}}),this.getService(Ll).setLanguage(n)}catch(t){this.getService(y).catch("Error in setLanguage: ",t)}},this.setTranslations=(n,e)=>{try{e?.ha||this.trackEvent(Y.Events.Core.SET_TRANSLATIONS_TRIGGERED,{payload:{translations:n}}),this.getService(Ll).setTranslations(n)}catch(t){this.getService(y).catch("Error in setTranslations: ",t)}},this.enableAutoTranslation=n=>{try{n?.ha||this.trackEvent(Y.Events.Core.ENABLE_AUTO_TRANSLATION_TRIGGERED),this.getService(Ll).enableAutoTranslation()}catch(e){this.getService(y).catch("Error in enableAutoTranslation: ",e)}},this.disableAutoTranslation=n=>{try{n?.ha||this.trackEvent(Y.Events.Core.DISABLE_AUTO_TRANSLATION_TRIGGERED),this.getService(Ll).disableAutoTranslation()}catch(e){this.getService(y).catch("Error in disableAutoTranslation: ",e)}},this.sf=(n,e)=>{try{e?.ha||this.trackEvent(Y.Events.Core.SF_TRIGGERED,{payload:{value:n}}),n?(document.querySelector(U.TAGS.SNIPPYLY_PLUGIN)||document.querySelector(U.TAGS.SUPERFLOW_TOOLBAR))&&this.getService(Ft).setSF(n):this.getService(Ft).setSF(n)}catch(t){this.getService(y).catch("Error in sf: ",t)}},this.st=(n,e)=>{try{e?.ha,this.getService(Ft).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.getService(ni).onAction(n)}catch(t){return this.getService(y).catch("Error in on: ",t),se(null)}},this.setUiState=(n,e)=>{try{e?.ha||this.trackEvent(Y.Events.Core.SET_UI_STATE_TRIGGERED,{payload:{uiState:n}}),this.getService(rt).setUIState(n)}catch(t){this.getService(y).catch("Error in setUiState: ",t)}},this.getUiState=n=>{try{return n?.ha||this.trackEvent(Y.Events.Core.GET_UI_STATE_TRIGGERED),this.getService(rt).getUIState$()}catch(e){return this.getService(y).catch("Error in getUiState: ",e),se({})}},this.enableSafeEval=n=>{try{n?.ha||this.trackEvent(Y.Events.Core.ENABLE_SAFE_EVAL_TRIGGERED),this.getService(Ft).enableSafeEval()}catch(e){this.getService(y).catch("Error in enableSafeEval: ",e)}},this.disableSafeEval=n=>{try{n?.ha||this.trackEvent(Y.Events.Core.DISABLE_SAFE_EVAL_TRIGGERED),this.getService(Ft).disableSafeEval()}catch(e){this.getService(y).catch("Error in disableSafeEval: ",e)}},this.resetVeltButtonState=(n,e)=>{try{e?.ha||this.trackEvent(Y.Events.Core.RESET_VELT_BUTTON_STATE_TRIGGERED,{payload:{config:n}}),this.getService(BC).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=D(E({},n),{source:"external"}),this.getService(tt).trackAuthenticatedEvent(o,n,e)}catch(t){this.getService(y).catch("Error in _trackEvent: ",t);return}}};var Ype=(()=>{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;touch-action:manipulation;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 .velt-overlay-panel.mat-mdc-dialog-panel{max-width:var(--mat-dialog-container-max-width, 80vw);min-width:var(--mat-dialog-container-min-width, 0)}.velt-mat-dialog-container mat-dialog-container .mat-mdc-dialog-surface.mdc-dialog__surface{background-color:#fff;padding:24px}.velt-mat-dialog-container mat-dialog-container .mat-mdc-dialog-surface.mdc-dialog__surface .mdc-dialog__title:before{height:unset}.velt-mat-dialog-container mat-dialog-container .mat-mdc-dialog-actions{padding:var(--mat-dialog-actions-padding, 8px)}.velt-overlay-panel{background-color:transparent;border:none;box-shadow:none}.velt-overlay-panel.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}.velt-menu.mat-mdc-menu-panel{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}
|
|
518
|
+
`))},dependencies:[np],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 FFe=["userAvatarRef"],LFe=["*"];function BFe(i,o){if(i&1&&(_(0,"div",7),w(1,"span",8),b()),i&2){let n=l(2).ngIf,e=l();at("background-color",n.background||"#625DF5"),x("data-testid",e.componentId+"-initial-container"),m(),at("color",n.textColor||"#FFFFFF"),x("data-modal-author-initial",n.initial)("data-testid",e.componentId+"-initial")}}function VFe(i,o){if(i&1){let n=K();_(0,"img",9),W("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();at("display",n.imgLoaded?"":"none !important"),d("src",n.src,fn),x("alt","User avatar")("data-testid",e.componentId+"-image")}}function UFe(i,o){if(i&1&&(v(0),_(1,"div",4,1),u(3,BFe,2,7,"div",5)(4,VFe,1,5,"ng-template",6),jt(5),b(),C()),i&2){let n=l().ngIf,e=l();m(),x("data-testid",e.componentId+"-container")("aria-label","User avatar"),m(2),d("ngIf",!n.imgLoaded),m(),d("ngIf",!n.imgLoadError)}}function jFe(i,o){if(i&1&&w(0,"velt-skeleton-loader-internal",10),i&2){let n=l().ngIf;d("height",n.size?n.size+"px":"100%")("width",n.size?n.size+"px":"100%")}}function $Fe(i,o){if(i&1&&(v(0),u(1,UFe,6,4,"ng-container",3)(2,jFe,1,2,"ng-template",null,0,xe),C()),i&2){let n=o.ngIf,e=me(3);m(),d("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 Jn=(()=>{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=Ee({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=D(E({},r),{[t]:e[t].currentValue}),r))}),e?.user){let t=e.user.currentValue;t?.photoUrl!==this.componentConfigSignal().src&&this.componentConfigSignal.update(r=>(r=D(E({},r),{src:t?.photoUrl,imgLoaded:!1,imgLoadError:!1}),r)),this.componentConfigSignal.update(r=>(r=D(E({},r),{background:t?.color||this.authService.getUserAvatarColor(t?.userId)}),r)),this.componentConfigSignal.update(r=>(r=D(E({},r),{textColor:t?.textColor||this.authService.getUserTextColor(t?.userId)}),r)),this.componentConfigSignal.update(r=>(r=D(E({},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=D(E({},e),{imgLoadError:!0}),e))}catch(e){this.loggingService.catch("Error in UserAvatarComponent onImageLoadError: ",e)}}onImageLoaded(){try{this.componentConfigSignal.update(e=>(e=D(E({},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&&it(FFe,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:LFe,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&&(Ht(),u(0,$Fe,4,2,"ng-container",2)),t&2&&d("ngIf",r.componentConfigSignal())},dependencies:[X,Xo],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 HFe=["selectionElementPortalOverlay"],zFe=()=>["velt-overlay-panel"],GFe=i=>[i];function WFe(i,o){if(i&1&&(v(0),_(1,"span",10),te(2),P(3,"translate"),b(),C()),i&2){let n=l(),e=n.$implicit,t=n.index,r=l(5);m(),at("--velt-selection-color",e==null||e.user==null?null:e.user.color),x("data-testid",r.componentId+"-user-name-"+t),m(),Ge(M(3,4,(e==null||e.user==null?null:e.user.name)||(e==null||e.user==null?null:e.user.email)))}}function qFe(i,o){if(i&1&&(v(0),u(1,WFe,4,6,"ng-container",3),C()),i&2){let n=o.index,e=l(5);m(),d("ngIf",n<e.maxCount)}}function YFe(i,o){if(i&1&&(_(0,"span",11),te(1),b()),i&2){let n=l(4).ngIf,e=l();at("--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(),ye("+",(n.selections==null?null:n.selections.length)-e.maxCount)}}function KFe(i,o){if(i&1&&(v(0),_(1,"div",7),P(2,"translate"),u(3,qFe,2,1,"ng-container",8)(4,YFe,2,5,"span",9),b(),C()),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),d("ngForOf",n.selections),m(),d("ngIf",(n.selections==null?null:n.selections.length)>e.maxCount)}}function ZFe(i,o){if(i&1&&(v(0),w(1,"snippyly-user-avatar",13),C()),i&2){let n=l(),e=n.$implicit,t=n.index;m(),at("--velt-selection-color",e==null||e.user==null?null:e.user.color)("--velt-selection-user-index",t),d("size",20)("user",e==null?null:e.user)}}function XFe(i,o){if(i&1&&(v(0),u(1,ZFe,2,6,"ng-container",3),C()),i&2){let n=o.index,e=l(5);m(),d("ngIf",n<e.maxCount)}}function QFe(i,o){if(i&1&&(_(0,"div",14),P(1,"translate"),_(2,"span",15),te(3),b()()),i&2){let n=l(4).ngIf,e=l();at("--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),ye("+",(n.selections==null?null:n.selections.length)-e.maxCount)}}function JFe(i,o){if(i&1&&u(0,XFe,2,1,"ng-container",8)(1,QFe,4,9,"div",12),i&2){let n=l(3).ngIf,e=l();d("ngForOf",n.selections),m(),d("ngIf",(n.selections==null?null:n.selections.length)>e.maxCount)}}function eLe(i,o){if(i&1&&u(0,KFe,5,6,"ng-container",6)(1,JFe,2,2,"ng-template",null,2,xe),i&2){let n=me(2),e=l(2).ngIf,t=l();d("ngIf",(e==null?null:e.userIndicatorType)===(t.userIndicatorTypes==null?null:t.userIndicatorTypes.Label))("ngIfElse",n)}}function tLe(i,o){if(i&1&&(v(0),w(1,"div",4,0),u(3,eLe,3,2,"ng-template",5,1,xe),C()),i&2){let n=me(2),e=l().ngIf,t=l();m(),at("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"),d("id","selection-element-contianer-"+(t.highlight.user==null?null:t.highlight.user.userSnippylyId)),x("data-testid",t.componentId),m(2),d("cdkConnectedOverlayOrigin",n)("cdkConnectedOverlayOpen",!0)("cdkConnectedOverlayLockPosition",!1)("cdkConnectedOverlayGrowAfterOpen",!0)("cdkConnectedOverlayDisableClose",!0)("cdkConnectedOverlayPanelClass",gt(13,zFe))("cdkConnectedOverlayPositions",A(14,GFe,e==null?null:e.overlayPosition))}}function nLe(i,o){if(i&1&&(v(0),u(1,tLe,5,16,"ng-container",3),C()),i&2){let n=o.ngIf;m(),d("ngIf",n==null?null:n.position)}}var qpe=(()=>{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 Qg,this.position=null,this.userIndicatorTypes=PC,this.offsetLeft=0,this.offsetTop=0,this.maxCount=1,this.componentConfigSignal=Ee({userIndicatorPosition:BI.End,userIndicatorType:PC.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(c=>(c=D(E({},c),{userIndicatorPosition:a,userIndicatorType:s}),c)),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=D(E({},t),{selections:e}),t))}catch(t){this.loggingService.catch("Error in SelectionElementPortalComponent setSelections: ",t)}}addSelection(e){try{this.componentConfigSignal.update(t=>(t=E({},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=D(E({},t),{overlayPosition:{originX:"start",originY:"top",overlayX:"start",overlayY:"top"}}),t));break;default:this.componentConfigSignal.update(t=>(t=D(E({},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=aI(this.highlight.targetElement);if(e){let t=e.iterateNext(),r,a=null,s=null;try{r=JSON.parse(t?.getAttribute(U.ATTRIBUTES.VELT_SELECTION_CONFIG)||"{}"),a=t?.getAttribute(U.ATTRIBUTES.VELT_LIVE_SELECTION_USER_INDICATOR_POSITION)||this.componentConfigSignal().userIndicatorPosition,a&&this.setOverlayPosition(a),s=t?.getAttribute(U.ATTRIBUTES.VELT_LIVE_SELECTION_USER_INDICATOR_TYPE)||this.componentConfigSignal().userIndicatorType,this.componentConfigSignal.update(p=>(p=D(E({},p),{userIndicatorPosition:a,userIndicatorType:s}),p))}catch{}let c;if(r?.horizontal&&(c=r.horizontal),a==="start"?c="top-start":c="top-right",t){let p=t.getBoundingClientRect();if(p&&p.width&&p.height)switch(c){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=D(E({},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(tl),h(R))},o.\u0275cmp=O({type:o,selectors:[["app-selection-element-portal"]],viewQuery:function(t,r){if(t&1&&it(HFe,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","cdkConnectedOverlayPanelClass","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&&u(0,nLe,2,1,"ng-container",3),t&2&&d("ngIf",r.componentConfigSignal())},dependencies:[Et,X,dn,sn,Jn,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 $C=(i,o)=>{try{let n=oLe(i),e=[],t=[];return n.forEach(r=>{r?.parentElement?.closest(U.TAGS.SNIPPYLY_TEXT_HIGHLIGHT)?r?.parentElement?.normalize():t.push(r)}),t.forEach(r=>{let a=rLe(r,o);a&&e.push(a)}),e}catch(n){return et.catch("Error in highlighter highlightRange: ",n),[]}},oLe=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 et.catch("Error in highlighter getTextNodesInRange: ",o),[]}},rLe=(i,o)=>{try{let n=document.createElement(o||U.TAGS.SNIPPYLY_TEXT_HIGHLIGHT);return i.parentElement?.replaceChild(n,i),n.appendChild(i),n}catch(n){return et.catch("Error in highlighter highlightNode: ",n),null}};var tl=(()=>{let o=class o{constructor(e,t,r,a,s,c,p,g,f,I,T){this.afAuth=e,this.authService=t,this.configService=r,this.databaseService=a,this.docService=s,this.domService=c,this.componentFactoryResolver=p,this.injector=g,this.appRef=f,this.loggingService=I,this.commonDbService=T,this.documentPaths=null,this.textSelections={},this.enableSelections$=new ve(!1),this.userIndicatorEnabled$=new ve(!0),this.userIndicatorPosition$=new ve(BI.End),this.userIndicatorType$=new ve(PC.Avatar),this.defaultElementsTrackingEnabled$=new ve(!0),this.defaultStylingEnabled$=new ve(!0),this.elementSelections={},this.databaseService.getDb().pipe(Fe(L=>!!L),ot(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 z=this.domService.getXPath(G);if(z){let J=new Qg;J.type="click",J.targetElement=z,this.setSelection(J)}}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 z=this.domService.getXPath(G);if(z){let J=new Qg;J.type="focus",J.targetElement=z,this.setSelection(J)}}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(fe(()=>this.isFeatureAllowed$({})),Fe(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=Ble([L]),z=new Qg;z.type="selection",z.targetTextRange=G?.length?G[0]:null,this.setSelection(z)}}}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(Di()).subscribe(([L,G])=>{try{if(L){let z=[];Object.keys(L).forEach(J=>{let le=L[J],_e=G?G[J]:null;!ui(le,_e)&&J!==this.getUserIdHash(this.user)&&z.push(le)}),z.forEach(J=>{if(J.targetElement){let le=this.elementSelections[J?.targetElement]?.portalRef,De=(this.elementSelections[J?.targetElement]?.selections||[]).filter(Be=>this.getUserIdHash(Be.user)!==this.getUserIdHash(J?.user));De?.length?(le.instance.setSelections(De.slice()),this.elementSelections[J?.targetElement].selections=De.slice(),this.highlightElement(De[0])):(this.removeHighlightFromElement(J),this.removeSelectionElement(J))}else J.targetTextRange&&this.removeHighlightFromText(J)})}if(G){let z=[];Object.keys(G).forEach(J=>{let le=L?L[J]:null,_e=G[J];!ui(le,_e)&&J!==this.getUserIdHash(this.user)&&z.push(_e)}),z.forEach(J=>{J.targetElement?(this.highlightElement(J),this.getUserIndicatorEnabled()&&this.setElementHighlight(J)):J.targetTextRange&&this.highlightText(J)})}}catch(z){this.loggingService.catch("Error in SelectionService getSelectionsOnCurrentDocument: ",z)}},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(),Re.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;"),ti(this.afAuth).pipe(Fe(e=>!!e),fe(e=>this.isFeatureAllowed$({firebaseUser:e})),fe(e=>e.featureAllowed?se(e).pipe(fe(t=>this.docService.getDocumentPaths$().pipe(de(r=>(this.documentPaths=r,t)))),fe(t=>t?.user?t?.user?.isAnonymous?se(null):this.documentPaths?this.databaseService.getDb().pipe(Fe(r=>!!r),fe(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(Fe(t=>!!t),de(t=>D(E({},e),{config:t})),fe(t=>this.authService.getUser$().pipe(de(r=>(this.user=r,D(E({},t),{user:r}))))),fe(t=>no(t.config,t.user,Re.LIVE_SELECTION)?se(D(E({},t),{featureAllowed:!0})):(this.loggingService.warn("Live Selection feature is not allowed."),se(D(E({},t),{featureAllowed:!1})))),_t((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(U.ATTRIBUTES.VELT_SELECTION_CONFIG)&&(s=JSON.parse(r?.getAttribute(U.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=q0(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=$C(r,U.TAGS.SNIPPYLY_HIGHLIGHT_USER_TEXT),s=[],c=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,U.VELT_LIVE_SELECTION_ON_TEXT),this.getDefaultStylingEnabled()&&this.domService.addClassToElement(p,U.VELT_LIVE_SELECTION_ON_TEXT_DEFAULT),e.user?.color&&p.style.setProperty(U.VELT_SELECTION_COLOR,e.user?.color+"55"),s.push({element:p,textNode:p.childNodes[0]}))}),c)){let p=a.filter(f=>f?.textContent?.trim()),g=p?.length?p[p?.length-1]:null;g&&g.parentNode.insertBefore(c,g.nextSibling)}this.textSelections[this.getUserIdHash(e?.user)]={textNodes:s,marker:c}}}}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&&U.SELECTION_ENABLED_ELEMENTS[e.tagName?.toLowerCase()]?e:JH(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 lr(qpe),c=new cr(a,this.appRef,this.injector),p=c.attach(s);p.instance.highlight=e,p.instance.setSelections([e]),this.elementSelections[e.targetElement]={selectionHostDomPortalOutlet:c,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?Tt(e?.userId):null}catch(t){return this.loggingService.catch("Error in SelectionService getUserIdHash: ",t),null}}};o.\u0275fac=function(t){return new(t||o)(ee(Pi),ee(je),ee(Ft),ee(In),ee(rt),ee(Le),ee(ko),ee(yt),ee(ii),ee(y),ee(un))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var W9=class extends mi{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(Y.Events.Selection.ENABLE_LIVE_SELECTION_TRIGGERED),this.getService(tl).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(Y.Events.Selection.DISABLE_LIVE_SELECTION_TRIGGERED),this.getService(tl).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(Y.Events.Selection.ENABLE_USER_INDICATOR_TRIGGERED),this.getService(tl).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(Y.Events.Selection.DISABLE_USER_INDICATOR_TRIGGERED),this.getService(tl).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(Y.Events.Selection.SET_USER_INDICATOR_POSITION_TRIGGERED,{payload:{position:o}}),this.getService(tl).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(Y.Events.Selection.SET_USER_INDICATOR_TYPE_TRIGGERED,{payload:{type:o}}),this.getService(tl).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(Y.Events.Selection.ENABLE_DEFAULT_ELEMENTS_TRACKING_TRIGGERED),this.getService(tl).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(Y.Events.Selection.DISABLE_DEFAULT_ELEMENTS_TRACKING_TRIGGERED),this.getService(tl).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(Y.Events.Selection.ENABLE_DEFAULT_STYLING_TRIGGERED),this.getService(tl).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(Y.Events.Selection.DISABLE_DEFAULT_STYLING_TRIGGERED),this.getService(tl).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(Y.Events.Selection.GET_LIVE_SELECTION_DATA_TRIGGERED),this.getService(tl).getSelectionsOnCurrentDocument()}catch(o){return this.getService(y).catch("Error in _getLiveSelectionData: ",o),se(null)}}};var cs=(()=>{let o=class o{constructor(e,t,r,a,s,c,p,g,f,I,T,L,G,z,J){this.analyticsService=e,this.configService=t,this.docService=r,this.databaseService=a,this.authService=s,this.domService=c,this.afAuth=p,this.iamService=g,this.avatarService=f,this.contactService=I,this.storageService=T,this.dialog=L,this.loggingService=G,this.notificationService=z,this.commonDbService=J,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(Fe(le=>!!le),ot(1)).subscribe(le=>{le&&this.getDocumentPaths()},le=>{this.loggingService.catch("Error in TagService getDb subscription: ",le)}),this.domService.onWindowPointerMove$().subscribe(le=>{if(this.addTagMode$.value){this.hightlightElement&&this.domService.removeHighlightFromElement(this.hightlightElement);let _e=this.domService.getBackgroundElement(le.clientX,le.clientY);_e&&(this.isElementInsideAllowedElements(_e)?wk(le.target)?this.domService.removeClassFromElement(document.body,"show-pin-cursor"):(this.domService.addClassToElement(document.body,"show-pin-cursor"),this.hightlightElement=_e,this.domService.highlightElement(this.hightlightElement,U.CURSOR.TAG_PIN)):this.domService.removeClassFromElement(document.body,"show-pin-cursor"))}},le=>{this.loggingService.catch("Error in TagService onWindowPointerMove$ subscription: ",le)}),this.domService.onWindowKeyupEsc$().subscribe(le=>{this.addTagMode$.value&&this.disableAddTagMode()},le=>{this.loggingService.catch("Error in TagService onWindowKeyupEsc$ subscription: ",le)}),this.domService.onDocumentClick$().subscribe(le=>{if(le&&this.addTagMode$.value){if(le.preventDefault(),le.stopPropagation(),!wk(le.target)){let _e=this.domService.getBackgroundElement(le.clientX,le.clientY);_e&&this.isElementInsideAllowedElements(_e)&&this.addTag(le)}this.disableAddTagMode()}},le=>{this.loggingService.catch("Error in TagService onDocumentClick$ subscription: ",le)}),this.addTagMode$.subscribe(le=>{this.hightlightElement&&this.domService.removeHighlightFromElement(this.hightlightElement),le?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"))},le=>{this.loggingService.catch("Error in TagService addTagMode$ subscription: ",le)}),this.domService.onWindowKeyupBackspace$().subscribe(le=>{this.deleteTagPinAnnotations("keyupBackspace")},le=>{this.loggingService.catch("Error in TagService onWindowKeyupBackspace$ subscription: ",le)}),this.domService.onWindowKeyupDelete$().subscribe(le=>{this.deleteTagPinAnnotations("keyupDelete")},le=>{this.loggingService.catch("Error in TagService onWindowKeyupDelete$ subscription: ",le)}),this.domService.getDeleteCommmentAnnotations$().subscribe(le=>{le?.length&&(le?.filter(De=>De.type==="tag")).forEach(De=>Q(this,null,function*(){yield this.deleteTagPinAnnotation(De)}))},le=>{this.loggingService.catch("Error in TagService onWindowKeyupDelete$ subscription: ",le)})}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=Nn(e)),t&&typeof t=="object"){let c=or(t);a=Nn(JSON.stringify(c))}}catch(c){this.loggingService.catch("Error in TagService getAllTagAnnotations: ",c)}return ti(this.afAuth).pipe(Fe(c=>!!c),fe(c=>this.isFeatureAllowed({firebaseUser:c,annotations:[],filteredAnnotations:[]})),fe(c=>c.featureAllowed?this.iamService.isUserAllowed$().pipe(de(p=>(c.featureAllowed=p,c))):se(c)),fe(c=>c.featureAllowed?this.authService.isPlanExpired$().pipe(de(p=>(c.featureAllowed=!p,c))):se(c)),fe(c=>c.featureAllowed?se(c).pipe(fe(p=>this.docService.getDocumentPaths$().pipe(de(g=>(this.documentPaths=g,p.documentPaths=g,p)))),fe(p=>this.getDataFromDocumentId(s).pipe(de(g=>(p.annotations=g||[],E({},p))))),fe(p=>this.docService.getLocation$().pipe(de(g=>(p.location=g,p)))),fe(p=>this.docService.getLocations$().pipe(de(g=>(p.customLocations=g,p)))),de(p=>{if(p.filteredAnnotations=[],s&&!a)return p.filteredAnnotations=p.annotations?.slice(),p;{let g=[];return a?g.push(a):(g.push(p?.location?.locationId),g.push(...Object.values(p?.customLocations||[]).map(f=>f.locationId))),p.filteredAnnotations=this.filterAnnotationsByLocationIds(p?.annotations,g),p}}),fe(p=>r?se(p):p?.annotations?.length?this.domService.onWindowResize$().pipe(de(()=>p)):se(p)),fe(p=>r?se(p):p?.annotations?.length?this.domService.onDomChange$("TagService getAllTagAnnotations").pipe(de(()=>p)):se(p)),de(p=>(p?.filteredAnnotations?.forEach(g=>{this.calculateTagAnnotationPosition(g)}),p)),fe(p=>p?.filteredAnnotations?se(p?.filteredAnnotations||[]):se([]))):se([])))}isFeatureAllowed(e){return this.configService.getConfig$().pipe(Fe(t=>!!t),de(t=>D(E({},e),{config:t})),fe(t=>this.authService.getUser$().pipe(de(r=>D(E({},t),{user:r})))),fe(t=>no(t.config,t.user,Re.TAG)?se(D(E({},t),{featureAllowed:!0})):(this.loggingService.warn("Tag feature is not allowed."),se(D(E({},t),{featureAllowed:!1})))))}getDataFromDocumentId(e){return this.databaseService.getDb().pipe(Fe(t=>!!t),fe(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(D(E({},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&&wi(r)){let a=r.getBoundingClientRect();if(a&&a.width&&a.height){let{height:s,width:c}=Bg(r);e.position={top:s*e.targetElement.topPercentage/100,left:c*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((c,p)=>{c?.annotationId&&(c.annotationIndex=p+1)});let s=[];if(t)r?s=a.filter(c=>c.locationId===r):s=a.slice();else{let c=this.docService.getLocation();c&&c.locationId?s=a.filter(p=>p.locationId===c.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 UI;a.from=r,a.color=U.DEFAULT_ANNOTATION_COLOR,a.resolved=!1,a.lastUpdated=this.timestamp;let{topPositionX:s,topPositionY:c}=this.domService.getTopLeftPosition();a.positionX=s,a.positionY=c;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 g=this.domService.getXPath(a.targetElement.xpath);if(g){let f=g.iterateNext();f&&(wi(f)||(a.targetElement=null))}}this.setLocationToTagAnnotation(a),a.pageInfo=ki(),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(Re.TAG)&&this.docService.getDocumentPaths$().pipe(Fe(t=>!!t),ot(1),fe(t=>(this.documentPaths=t,this.loggingService.log(this.documentPaths),this.databaseService.getDb().pipe(Fe(r=>!!r),ot(1),fe(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(U.SESSION_STORAGE.SNIPPYLY_AUTO_SELECT_ANNOTATION_ID,e.annotationId),this.analyticsService.trackEvent(Y.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,rI.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,rI.RESOLVED),this.updateTagToDb(e),this.domService.updateSelectedAnnotationInMap([e]),this.analyticsService.trackEvent(Y.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&&(wi(r)||(e.targetElement=null))}}this.domService.updateSelectedAnnotationInMap([e]),this.authService.getUser()&&this.authService.isFeatureAllowed(Re.TAG)&&this.docService.getDocumentPaths$().pipe(Fe(t=>!!t),ot(1),fe(t=>(this.documentPaths=t,this.loggingService.log(this.documentPaths),this.databaseService.getDb().pipe(Fe(r=>!!r),ot(1),fe(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 c=t[s];c.type==="tag"&&r&&c.from&&(r?.isAdmin||c.from.userId===r.userId)&&a.push(c)})),a?.length&&(this.analyticsService.trackEvent(Y.Events.Tag.TAG_DELETE_TRIGGERED,{triggerType:e,annotationId:a.map(s=>s.annotationId).join()}),this.dialog.open(La,{panelClass:"velt-mat-dialog-container",data:{title:"Delete tag?",message:"This selected tag will be deleted.",yesButton:"Delete",noButton:"Cancel",variant:"tag"}}).afterClosed().pipe(ot(1)).subscribe(s=>{s&&(a.forEach(c=>Q(this,null,function*(){yield this.deleteTagPinAnnotation(c)})),setTimeout(()=>{document.querySelectorAll(`[${U.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(Re.TAG)&&this.documentPaths?.tag&&e?.annotationId?(this.updateNotificationsDatabase(e,rI.DELETED),this.analyticsService.trackEvent(Y.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(Re.TAG)?(this.analyticsService.trackEvent(Y.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(Y.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=ya(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 UI;t.from=e,t.color=U.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 c=this.docService.getLocation();return c&&(t.locationId=c.locationId,t.location=c.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=ki(),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=`${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentPaths?.documentId}/${U.FIREBASE_PARTIAL_PATH_TAG}/${t.annotationId}`;return this.documentPaths?.organizationId&&(r=`${U.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${this.documentPaths.organizationId}/${U.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentPaths?.documentId}/${U.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(U.URL_PARAMS.TAG_ID),t.searchParams.append(U.URL_PARAMS.TAG_ID,e.annotationId),t.href}};o.\u0275fac=function(t){return new(t||o)(ee(tt),ee(Ft),ee(rt),ee(In),ee(je),ee(Le),ee(Pi),ee(En),ee(hm),ee(Si),ee(nu),ee(lo),ee(y),ee(Cn),ee(un))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var q9=class extends mi{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(Y.Events.Tag.GET_ALL_TAG_ANNOTATIONS_TRIGGERED,{payload:{documentId:o,location:n}}),this.getService(cs).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(Y.Events.Tag.DELETE_TAG_TRIGGERED),this.getService(cs).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(Y.Events.Tag.ALLOWED_ELEMENT_IDS_TRIGGERED,{payload:{elementIds:o}}),this.getService(cs).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(Y.Events.Tag.ATTACH_TAG_TRIGGERED,{payload:{elementId:o}}),this.getService(cs).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(Y.Events.Tag.ADD_TAG_MODE_CHANGE_TRIGGERED),this.getService(cs).addTagModeChange()}catch(o){return this.getService(y).catch("Error in _addTagModeChange: ",o),se(!1)}}};var Y9=class extends mi{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(Y.Events.Views.GET_UNIQUE_VIEWS_BY_USER_TRIGGERED,{payload:{clientLocationId:o}}),this.getService(Os).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(Y.Events.Views.GET_UNIQUE_VIEWS_BY_DATE_TRIGGERED,{payload:{clientLocationId:o}}),this.getService(Os).getUniqueViewsByDate(o)}catch(n){return this.getService(y).catch("Error in getUniqueViewsByDate: ",n),se({})}}};var JI=(()=>{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??{},c=a?.metadata??{};c.disabled=!!s?.disabled,c.id=c?.clientDocumentId,c.documentId=c?.clientDocumentId,delete c?.clientDocumentId,c.organizationId=c?.clientOrganizationId,delete c?.clientOrganizationId,delete c?.pageInfo,delete c?.veltFolderId,r.push(c)}),{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 c=s?.metadata??{};return delete c?.veltFolderId,c.organizationId=c.clientOrganizationId,delete c?.clientOrganizationId,delete c?.veltParentFolderId,E({},c)});return{data:(t?.data?.map(s=>{let c=s?.metadata??{};return delete c?.veltFolderId,c.organizationId=c.clientOrganizationId,delete c?.clientOrganizationId,delete c?.veltParentFolderId,E(E({},c),e?.folderId?{subFolders:r}:{})})).reduce((s,c)=>(c?.folderId&&(s[c.folderId]=c),s),{})}}catch(t){return this.loggingService.catch("Error in CommentActionsService fetchFolders: ",t),{data:null}}})}};o.\u0275fac=function(t){return new(t||o)(ee(rt),ee(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var K9=(()=>{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 c=this.authService.getUser$(),p=this.docService.getDocumentPaths$(),g=this.iamService.isUserAllowed$();mn([c,p,g]).subscribe(([f,I,T])=>{f&&I&&T?this.veltInitState$.next(!0):this.veltInitState$.next(!1)}),this.getVeltInitState$().subscribe(f=>{this.coreActionsService.triggerAction(ct.DOCUMENT_INIT,f)})}catch(c){this.loggingService.catch("Error in VeltService constructor: ",c)}}getVeltInitState$(){try{return this.veltInitState$.asObservable().pipe(_t())}catch(e){return this.loggingService.catch("Error in VeltService getVeltInitState$: ",e),se(void 0)}}};o.\u0275fac=function(t){return new(t||o)(ee(je),ee(ni),ee(rt),ee(En),ee(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Z9=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(Ft).getApiKey(),c=K0(s,n.userId);if(t?.ha||this.getService(tt).trackEvent(Y.Events.Core.IDENTIFY,{apiKey:s,clientUserId:n.userId,snippylyUserId:c,forceReset:e?.forceReset,user:this.getService(je).getUserWithoutContacts(n),source:"client",fromProvider:t?.fromProvider},!0,c,n?.userId),!(n&&n.userId))this.getService(y).catch("Error in identify: ","Missing userId in config data."),e?.throwError?a("Missing userId in config data."):r(null);else if(typeof n.userId!="string")this.getService(y).catch("Error in identify: ","userId must be string."),e?.throwError?a("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."),e?.throwError?a("groupId must be string."):r(null);else{if(n?.groupId)if(n?.groupId?.match(/^[a-zA-Z0-9_]*$/))n.clientGroupId=n.groupId;else{let g=n.groupId;n.clientGroupId=g,n.groupId=Tt(g)}if(n?.organizationId){let g=n.organizationId;n.clientOrganizationId=g,n.organizationId=Tt(g)}delete n.isAdmin;let p=U.REGEX_URL_FOR_USER_NAME;n?.name&&p.test(n?.name)&&(n.name=n.name?.split(".")?.slice(0,-1)?.join(".")),n.clientUserName=n.name,n?.name&&n?.name?.length>30&&(n.name=n.name.slice(0,30)),this.getService(je).initializeClient(n,e||{},new Date().getTime(),void 0,"external").then(g=>{let f;try{g&&(f=JSON.parse(JSON.stringify(g)))}catch{}r(f)}).catch(g=>{this.getService(y).catch("Error in identify: ",g),e?.throwError?a(g):r(null)})}}catch(s){this.getService(y).catch("Error in identify: ",s),e?.throwError?a(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=Tt(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(Y.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(Y.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(rt).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(Y.Events.Core.SET_DOCUMENTS_TRIGGERED,{payload:{id:n,organizationId:e,methodName:"setDocumentId",source:"external"}}),n&&n.trim())return yield this.getService(rt).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(Y.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(rt).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(Y.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(rt).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(Y.Events.Core.UNSET_DOCUMENTS_TRIGGERED,{payload:{methodName:"unsetDocumentId",source:"external"}}),this.getService(rt).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(Y.Events.Core.UNSET_DOCUMENTS_TRIGGERED,{payload:{methodName:"unsetDocuments",source:"external"}}),this.getService(rt).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(Y.Events.Core.FETCH_DOCUMENTS_TRIGGERED,{payload:{options:n}}),this.getService(JI).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(Y.Events.Core.UPDATE_DOCUMENTS_TRIGGERED,{payload:{request:n}}),this.getService(JI).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(Y.Events.Core.UPDATE_LOCATIONS_TRIGGERED,{payload:{request:n}}),this.getService(JI).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(Y.Events.Core.FETCH_FOLDERS_TRIGGERED,{payload:{options:n}}),this.getService(JI).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(Y.Events.Core.SET_USER_DATA_PROVIDER_TRIGGERED),this.getService(Ln).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(Y.Events.Core.SET_DATA_PROVIDERS_TRIGGERED),n.comment&&this.getService(Js).setCommentAnnotationDataProvider(n.comment),n.user&&this.getService(Ln).setUserDataProvider(n.user),n.reaction&&this.getService(vm).setReactionAnnotationDataProvider(n.reaction),n.attachment)if(n.comment)this.getService(eu).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.setPermissionProvider=(n,e)=>{this.getService(y).log("%c[WB] Calling FUNCTION: setPermissionProvider","color: green;");try{e?.ha||this.trackEvent(Y.Events.Core.SET_PERMISSION_PROVIDER_TRIGGERED),this.getService(ss).setPermissionProvider(n)}catch(t){this.getService(y).catch("Error in setPermissionProvider: ",t)}},this.setEncryptionProvider=(n,e)=>{this.getService(y).log("%c[WB] Calling FUNCTION: setEncryptionProvider","color: green;");try{e?.ha||this.trackEvent(Y.Events.Core.SET_ENCRYPTION_PROVIDER_TRIGGERED),this.getService(Ft).setEncryptionProvider(n)}catch(t){this.getService(y).catch("Error in setEncryptionProvider: ",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(Y.Events.Core.GET_DOCUMENT_ID_TRIGGERED),this.getService(rt).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(Y.Events.Core.SET_LOCATIONS_TRIGGERED,{payload:{params:n,appendLocation:e,methodName:"setLocation",source:"external"}}),n&&typeof n=="object"?e?this.getService(rt).addLocation({location:n,source:"external"}):yield this.getService(rt).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(Y.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(rt).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(Y.Events.Core.SET_LOCATIONS_TRIGGERED,{payload:{locations:n,options:e,methodName:"setLocations",source:"external"}}),n&&Array.isArray(n)?yield this.getService(rt).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(Y.Events.Core.SET_LOCATIONS_TRIGGERED,{payload:{params:n,methodName:"addLocation",source:"external"}}),n&&typeof n=="object"?this.getService(rt).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(Y.Events.Core.SET_SCROLLABLE_ELEMENTS_IDS_TRIGGERED,{payload:{ids:n}}),n?this.getService(Le).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(Y.Events.Core.REMOVE_LOCATIONS_TRIGGERED,{payload:{location:n},methodName:"removeLocation",source:"external"}),this.getService(rt).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(Y.Events.Core.REMOVE_LOCATIONS_TRIGGERED,{payload:{locations:n},methodName:"removeLocations",source:"external"}),this.getService(rt).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(Y.Events.Core.UNSET_LOCATIONS_TRIGGERED,{payload:{locationIds:n},methodName:"unsetLocationIds",source:"external"}),this.getService(rt).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(Y.Events.Core.EXCLUDE_LOCATION_IDS_TRIGGERED,{payload:{ids:n}}),typeof n=="object"&&n instanceof Array&&(n=n.filter(t=>typeof t=="string"),this.getService(rt).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(Y.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(Si).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(Y.Events.Core.REMOVE_SCROLLABLE_ELEMENTS_IDS_TRIGGERED),this.getService(Le).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 j9(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 k9(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 T9(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 q9(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 W9(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 H9(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 D9(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 G9(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 N9(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 B9(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 I9(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 Y9(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 U9(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 x9(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 R9(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 S9(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 $9(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 w9(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(Y.Events.Core.GET_METADATA_TRIGGERED),this.getService(el).getGlobalMetadata()}catch(e){return this.getService(y).catch("Error in getMetadata: ",e),null}}),this.fetchDebugInfo=n=>Q(this,null,function*(){try{return n?.ha||this.trackEvent(Y.Events.Core.FETCH_DEBUG_INFO_TRIGGERED),this.getService(el).getDebugInfo()}catch(e){return this.getService(y).catch("Error in fetchDebugInfo: ",e),null}}),this.getDebugInfo=n=>{try{return n?.ha||this.trackEvent(Y.Events.Core.GET_DEBUG_INFO_TRIGGERED),this.getService(el).getDebugInfo$()}catch(e){return this.getService(y).catch("Error in getDebugInfo: ",e),se(null)}},this.disableFeatures=(n,e)=>{try{e?.ha||this.trackEvent(Y.Events.Core.DISABLE_FEATURES_TRIGGERED,{payload:{features:n}}),this.getService(Ft).disableFeatures(n)}catch(t){this.getService(y).catch("Error in disableFeatures: ",t)}},this.setDarkMode=(n,e)=>{try{e?.ha||this.trackEvent(Y.Events.Core.SET_DARK_MODE_TRIGGERED,{payload:{value:n}}),this.getService(Ye).setDarkMode(n)}catch(t){this.getService(y).catch("Error in setDarkMode: ",t)}},this.enableLogs=n=>{try{n?.ha||this.trackEvent(Y.Events.Core.ENABLE_LOGS_TRIGGERED),this.getService(Ft).enableLogs()}catch(e){this.getService(y).catch("Error in enableLogs: ",e)}},this.disableLogs=(n,e)=>{try{e?.ha||this.trackEvent(Y.Events.Core.DISABLE_LOGS_TRIGGERED),this.getService(Ft).disableLogs(n)}catch(t){this.getService(y).catch("Error in disableLogs: ",t)}},this.isUserAllowed$=n=>{try{return n?.ha||this.trackEvent(Y.Events.Core.IS_USER_ALLOWED_TRIGGERED),this.getService(En).isUserAllowed$()}catch(e){return this.getService(y).catch("Error in isUserAllowed$: ",e),se(!1)}},this.getUser=n=>{try{n?.ha||this.trackEvent(Y.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.getCurrentUser=n=>{try{return n?.ha||this.trackEvent(Y.Events.Core.GET_CURRENT_USER_TRIGGERED),this.getService(je).getUser$().pipe(de(e=>Dr(e)))}catch(e){return this.getService(y).catch("Error in getCurrentUser: ",e),se(null)}},this.getHeartbeat=(n,e)=>{try{return e?.ha||this.trackEvent(Y.Events.Core.GET_HEARTBEAT_TRIGGERED),this.getService(L9).getHeartbeat(n)}catch(t){return this.getService(y).catch("Error in getHeartbeat: ",t),se({data:null})}},this.getUserRole$=n=>{try{return n?.ha||this.trackEvent(Y.Events.Core.GET_USER_ROLE_TRIGGERED),this.getService(En).getRole$()}catch(e){return this.getService(y).catch("Error in getUserRole$: ",e),se("")}},this.getUserPermissions=(n,e)=>Q(this,null,function*(){try{return e?.ha||this.trackEvent(Y.Events.Core.GET_USER_PERMISSIONS_TRIGGERED,{payload:{request:n,source:"external"}}),this.getService(ss).getUserPermissions(n)}catch(t){return this.getService(y).catch("Error in getUserPermissions$: ",t),{}}}),this.getCurrentUserPermissions=n=>{try{return n?.ha||this.trackEvent(Y.Events.Core.GET_CURRENT_USER_PERMISSIONS_TRIGGERED),this.getService(ss).getCurrentUserPermissions$()}catch(e){return this.getService(y).catch("Error in getCurrentUserPermissions: ",e),se(null)}},this.getFeaturesAccessLevelIam$=n=>{try{return n?.ha||this.trackEvent(Y.Events.Core.GET_FEATURES_ACCESS_LEVEL_IAM_TRIGGERED),this.getService(En).getFeaturesAccessLevel$()}catch(e){return this.getService(y).catch("Error in getFeaturesAccessLevel$: ",e),se(void 0)}},this.isPlanExpired$=n=>{try{return n?.ha||this.trackEvent(Y.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(Y.Events.Core.GET_CUSTOMER_METADATA_TRIGGERED),this.getService(rt).getCustomerMetadata$()}catch(e){return this.getService(y).catch("Error in getCustomerMetadata$: ",e),se(null)}},this.getDocumentMetadata=n=>{try{return n?.ha||this.trackEvent(Y.Events.Core.GET_DOCUMENT_METADATA_TRIGGERED),this.getService(rt).getDocumentMetadata$()}catch(e){return this.getService(y).catch("Error in getDocumentMetadata: ",e),se(null)}},this.getVeltInitState=n=>{try{return n?.ha,this.getService(K9).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(Y.Events.Core.REMOVE_VELT_CONTENT_TRIGGERED),this.getService(Le).removeSnippylyContent(n)}catch(t){return this.getService(y).catch("Error in removeVeltContent: ",t),""}},this.injectCustomCss=(n,e)=>{try{e?.ha||this.trackEvent(Y.Events.Core.INJECT_CUSTOM_CSS_TRIGGERED),this.getService(y).log("%c[WB] Calling FUNCTION: injectCustomCss","color: green;"),this.getService(Le).setCustomCss(n)}catch(t){this.getService(y).catch("Error in injectCustomCss: ",t)}},this.setLanguage=(n,e)=>{try{e?.ha||this.trackEvent(Y.Events.Core.SET_LANGUAGE_TRIGGERED,{payload:{language:n}}),this.getService(Ll).setLanguage(n)}catch(t){this.getService(y).catch("Error in setLanguage: ",t)}},this.setTranslations=(n,e)=>{try{e?.ha||this.trackEvent(Y.Events.Core.SET_TRANSLATIONS_TRIGGERED,{payload:{translations:n}}),this.getService(Ll).setTranslations(n)}catch(t){this.getService(y).catch("Error in setTranslations: ",t)}},this.enableAutoTranslation=n=>{try{n?.ha||this.trackEvent(Y.Events.Core.ENABLE_AUTO_TRANSLATION_TRIGGERED),this.getService(Ll).enableAutoTranslation()}catch(e){this.getService(y).catch("Error in enableAutoTranslation: ",e)}},this.disableAutoTranslation=n=>{try{n?.ha||this.trackEvent(Y.Events.Core.DISABLE_AUTO_TRANSLATION_TRIGGERED),this.getService(Ll).disableAutoTranslation()}catch(e){this.getService(y).catch("Error in disableAutoTranslation: ",e)}},this.sf=(n,e)=>{try{e?.ha||this.trackEvent(Y.Events.Core.SF_TRIGGERED,{payload:{value:n}}),n?(document.querySelector(U.TAGS.SNIPPYLY_PLUGIN)||document.querySelector(U.TAGS.SUPERFLOW_TOOLBAR))&&this.getService(Ft).setSF(n):this.getService(Ft).setSF(n)}catch(t){this.getService(y).catch("Error in sf: ",t)}},this.st=(n,e)=>{try{e?.ha,this.getService(Ft).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.getService(ni).onAction(n)}catch(t){return this.getService(y).catch("Error in on: ",t),se(null)}},this.setUiState=(n,e)=>{try{e?.ha||this.trackEvent(Y.Events.Core.SET_UI_STATE_TRIGGERED,{payload:{uiState:n}}),this.getService(rt).setUIState(n)}catch(t){this.getService(y).catch("Error in setUiState: ",t)}},this.getUiState=n=>{try{return n?.ha||this.trackEvent(Y.Events.Core.GET_UI_STATE_TRIGGERED),this.getService(rt).getUIState$()}catch(e){return this.getService(y).catch("Error in getUiState: ",e),se({})}},this.enableSafeEval=n=>{try{n?.ha||this.trackEvent(Y.Events.Core.ENABLE_SAFE_EVAL_TRIGGERED),this.getService(Ft).enableSafeEval()}catch(e){this.getService(y).catch("Error in enableSafeEval: ",e)}},this.disableSafeEval=n=>{try{n?.ha||this.trackEvent(Y.Events.Core.DISABLE_SAFE_EVAL_TRIGGERED),this.getService(Ft).disableSafeEval()}catch(e){this.getService(y).catch("Error in disableSafeEval: ",e)}},this.resetVeltButtonState=(n,e)=>{try{e?.ha||this.trackEvent(Y.Events.Core.RESET_VELT_BUTTON_STATE_TRIGGERED,{payload:{config:n}}),this.getService(BC).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=D(E({},n),{source:"external"}),this.getService(tt).trackAuthenticatedEvent(o,n,e)}catch(t){this.getService(y).catch("Error in _trackEvent: ",t);return}}};var Ype=(()=>{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;touch-action:manipulation;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 .velt-overlay-panel.mat-mdc-dialog-panel{max-width:var(--mat-dialog-container-max-width, 80vw);min-width:var(--mat-dialog-container-min-width, 0)}.velt-mat-dialog-container mat-dialog-container .mat-mdc-dialog-surface.mdc-dialog__surface{background-color:#fff;padding:24px}.velt-mat-dialog-container mat-dialog-container .mat-mdc-dialog-surface.mdc-dialog__surface .mdc-dialog__title:before{height:unset}.velt-mat-dialog-container mat-dialog-container .mat-mdc-dialog-actions{padding:var(--mat-dialog-actions-padding, 8px)}.velt-overlay-panel{background-color:transparent;border:none;box-shadow:none}.velt-overlay-panel.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}.velt-menu.mat-mdc-menu-panel{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}
|
|
519
519
|
`],encapsulation:2,changeDetection:0});let i=o;return i})();var Sm=(()=>{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&&Pc(e.duration).pipe(ot(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)(ee(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();function lLe(i,o){i&1&&(ce(),_(0,"svg",6),w(1,"path",7),b())}function cLe(i,o){i&1&&(ce(),_(0,"svg",6),w(1,"path",8)(2,"path",9),b())}function dLe(i,o){if(i&1){let n=K();_(0,"div",2),u(1,lLe,2,0,"svg",3)(2,cLe,3,0,"svg",3),te(3),P(4,"translate"),ce(),_(5,"svg",4),W("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;d("@fade",!0),m(),d("ngIf",n.type==="success"),m(),d("ngIf",n.type==="error"),m(),ye(" ",M(4,4,n.message)," ")}}var Kpe=(()=>{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(Sm),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),u(1,dLe,7,6,"div",1),b()),t&2&&(m(),d("ngForOf",r.toasts))},dependencies:[Et,X,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:[gH("fade",[QM("false",rm({opacity:0})),QM("true",rm({opacity:1})),JM("false => true",[rm({opacity:0}),XM(1e3,rm({opacity:1}))]),JM("true => false",[XM(1e3,rm({opacity:0}))])])]},changeDetection:0});let i=o;return i})();var tq=i=>({componentConfigSignal:i}),Zpe=(i,o)=>({condition:i,data:o}),pLe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-single-editor-mode-panel-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function gLe(i,o){i&1&&He(0)}function uLe(i,o){if(i&1&&(_(0,"velt-shadow-dom-internal"),u(1,gLe,1,0,"ng-container",4),b()),i&2){l(3);let n=me(2);m(),d("ngTemplateOutlet",n)}}function hLe(i,o){if(i&1&&(v(0),u(1,uLe,2,1,"velt-shadow-dom-internal",3),C()),i&2){let n=l().ngIf,e=l(),t=me(2);m(),d("ngIf",n.shadowDom&&!e.template)("ngIfElse",t)}}function fLe(i,o){if(i&1&&(v(0),u(1,hLe,2,2,"ng-container",2),C()),i&2){let n=l();m(),d("veltIf",k(3,Zpe,n.conditionSignal(),A(1,tq,n.componentConfigSignal)))}}function vLe(i,o){if(i&1&&(v(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(),C()),i&2){let n=l(6);m(2),d("componentConfigSignal",n.componentConfigSignal),m(),d("componentConfigSignal",n.componentConfigSignal),m(),d("componentConfigSignal",n.componentConfigSignal),m(),d("componentConfigSignal",n.componentConfigSignal),m(),d("componentConfigSignal",n.componentConfigSignal),m(),d("componentConfigSignal",n.componentConfigSignal)}}function CLe(i,o){if(i&1&&(v(0),u(1,vLe,8,6,"ng-container",7),C()),i&2){let n=l(3).ngIf,e=l(2);m(),d("veltDynamicTemplate",$(3,pLe,e.template,A(1,tq,e.componentConfigSignal),n.variant,e.setIfCondition.bind(e),e.elementRef))}}function _Le(i,o){if(i&1&&(_(0,"div",6),u(1,CLe,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(),d("veltIf",k(7,Zpe,e.conditionSignal(),A(5,tq,e.componentConfigSignal)))}}function yLe(i,o){if(i&1&&(v(0),u(1,_Le,2,10,"div",5),C()),i&2){let n=l().ngIf;m(),d("ngIf",n.leaderName!==""||n.type==="editor")}}function SLe(i,o){if(i&1&&(v(0),u(1,yLe,2,1,"ng-container",1),C()),i&2){let n=o.ngIf;m(),d("ngIf",n.singleEditorMode)}}function bLe(i,o){if(i&1&&u(0,SLe,2,1,"ng-container",1),i&2){let n=l();d("ngIf",n.componentConfigSignal())}}var xf=(()=>{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=D(E({},r),{shadowDom:t}),r))}catch(t){this.loggingService.catch("Error in SingleEditorModePanelComponent _shadowDom: ",t)}}constructor(e,t,r,a,s,c,p){super(e,s,void 0,void 0,void 0,c,a),this.elementRef=e,this.authService=t,this.liveStateService=r,this.loggingService=a,this.themeService=s,this.dynamicDataService=c,this.wireframeService=p,this.subscriptions=[],this.componentConfigSignal=Ee({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(g=>{this.componentConfigSignal.update(f=>D(E({},f),{singleEditorMode:g}))})),this.subscriptions.push(this.liveStateService.getDefaultSingleEditorUIEnabled$().subscribe(g=>{this.componentConfigSignal.update(f=>D(E({},f),{defaultSingleEditorUIEnabled:g}))})),this.subscriptions.push(this.liveStateService.getSingleEditorModeConfig$().subscribe(g=>{this.componentConfigSignal.update(f=>D(E({},f),{singleEditorConfig:g}))})),this.subscriptions.push(this.liveStateService.isUserEditor$().subscribe(g=>{this.componentConfigSignal.update(f=>D(E({},f),{isUserEditor:g}))})),this.subscriptions.push(this.liveStateService.getSingleEditorLiveStateData$().subscribe(g=>{let f=this.componentConfigSignal().singleEditorLiveStateData?.requestEditorAccess?.user?.userId,I=g?.requestEditorAccess?.user?.userId;if(f&&I&&f!==I&&this.componentConfigSignal().requestEditorAccessCountdown&&this.removeRequestEditorAccessCountdown(),this.componentConfigSignal.update(T=>D(E({},T),{singleEditorLiveStateData:g})),g){this.componentConfigSignal.update(L=>D(E({},L),{leaderName:g?.editor?.name||g?.editor?.email||""}));let T=this.authService.getUser();T?.userId===g?.editor?.userId?this.componentConfigSignal.update(L=>D(E({},L),{type:"editor"})):this.componentConfigSignal.update(L=>D(E({},L),{type:"reader"})),T?.userId===g?.requestEditorAccess?.user?.userId&&g?.requestEditorAccess?.status==="pending"?this.componentConfigSignal.update(L=>D(E({},L),{editAccessRequested:!0})):this.componentConfigSignal.update(L=>D(E({},L),{editAccessRequested:!1})),this.componentConfigSignal().type==="editor"&&!this.componentConfigSignal().requestEditorAccessCountdown&&g?.requestEditorAccess?.status==="pending"?this.showRequestEditorAccessCountdown():this.removeRequestEditorAccessCountdown()}}))}catch(g){this.loggingService.catch("Error in SingleEditorModePanelComponent constructor: ",g)}}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=D(E({},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=D(E({},e),{requestEditorAccessCountdown:e.singleEditorLiveStateData?.requestEditorAccess?.editorAccessTimeout||U.LIVE_STATE_REQUEST_EDITOR_ACCESS_WAIT_TIME}),e)),this.interval=setInterval(()=>{this.componentConfigSignal.update(e=>D(E({},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=>D(E({},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(Ri),h(y),h(Ye),h(S),h(ze))},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&&u(0,fLe,2,6,"ng-container",1)(1,bLe,1,1,"ng-template",null,0,xe),t&2&&d("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 ELe(i,o){if(i&1&&(v(0),_(1,"div",1),w(2,"velt-single-editor-mode-panel",2),b(),C()),i&2){let n=l(2);m(2),d("variant",n.variant)}}function xLe(i,o){if(i&1&&(v(0),u(1,ELe,3,1,"ng-container",0),C()),i&2){let n=o.ngIf;m(),d("ngIf",n.singleEditorMode&&n.defaultSingleEditorUIEnabled)}}var Xpe=(()=>{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=Ee({singleEditorMode:!1,defaultSingleEditorUIEnabled:!1,variant:this.variant}),this.componentId="velt-live-state-sync-overlay";try{this.subscriptions.push(this.liveStateService.getSingleEditorMode$().subscribe(c=>{this.componentConfigSignal.update(p=>D(E({},p),{singleEditorMode:c}))})),this.subscriptions.push(this.liveStateService.getDefaultSingleEditorUIEnabled$().subscribe(c=>{this.componentConfigSignal.update(p=>D(E({},p),{defaultSingleEditorUIEnabled:c}))}))}catch(c){this.loggingService.catch("Error in LiveStateSyncOverlayComponent constructor: ",c)}}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(Ye),h(S),h(y),h(Ri))},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&&u(0,xLe,2,1,"ng-container",0),t&2&&d("ngIf",r.componentConfigSignal())},dependencies:[X,xf],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}
|
|
520
520
|
`],encapsulation:3,changeDetection:0});let i=o;return i})();var nq=(()=>{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,c,p,g,f,I){this.docService=e,this.domService=t,this.loggingService=r,this.viewportRuler=a,this.themeService=s,this.breakpointObserver=c,this.translateService=p,this.notificationService=g,this.veltService=f,this.injector=I,this.snippyly=new Z9(this.injector),this.getSnippyly=new Me,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()},T=>{this.loggingService.catch("Error in AppComponent getDocumentPaths subscription:",T)})),this.updateDeviceType(),this.updateDeviceOrientation(),this.setVeltVersion()}catch(T){this.loggingService.catch("Error in AppComponent constructor:",T)}}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(U.LOCAL_STORAGE.VELT_VERSION,window.Velt.version)}catch(e){this.loggingService.catch("Error in AppComponent setVeltVersion: ",e)}}updateDeviceType(){try{Object.values(Ui).forEach(t=>{Yn.Breakpoints[t]=this.breakpointObserver.isMatched(t),this.subscriptions.push(this.breakpointObserver.observe(t).subscribe(r=>{Yn.Breakpoints[t]=r.matches}))})}catch(e){this.loggingService.catch("Error in AppComponent updateDeviceType: ",e)}}updateDeviceOrientation(){try{Object.values(G0).forEach(t=>{Yn.Orientations[t]=window.matchMedia(t).matches,this.subscriptions.push(this.breakpointObserver.observe(t).subscribe(r=>{Yn.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(U.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(U.VELT_VIEWPORT_WIDTH,e.width+"px"),t.style.setProperty(U.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(rt),h(Le),h(y),h(Ja),h(Ye),h(To),h(Ll),h(Cn),h(K9),h(yt))},o.\u0275cmp=O({type:o,selectors:[["app-root"]],hostVars:1,hostBindings:function(t,r){t&1&&W("resize",function(s){return r.onResize(s)},Gy),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:[Ype,Kpe,Xpe],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 pi=(()=>{let o=class o{constructor(){this.subscriptions=[]}ngAfterViewInit(){this.overlay instanceof dn?this.setOverlayZIndex(this.overlay):this.overlay instanceof zb?this.setMatAutocompleteZIndex(this.overlay):this.overlay instanceof HTMLElement&&this.setElementZIndex(this.overlay)}setOverlayZIndex(e){this.overlay instanceof dn&&this.subscriptions.push(e.positionChange.pipe(ot(1)).subscribe(()=>{e?.overlayRef&&e?.overlayRef?.hostElement&&this.zIndex&&(e.overlayRef.hostElement.style.zIndex=this.zIndex?.toString())},t=>{}))}setMatAutocompleteZIndex(e){try{this.overlay instanceof zb&&this.subscriptions.push(e.opened.pipe(ot(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=Wt({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 DLe=["*"],wLe=()=>["snippyly-overlay-panel","snippyly-lightbox-overlay-panel","velt-overlay-panel"];function OLe(i,o){if(i&1){let n=K();_(0,"div",5),W("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(),d("src",n.src,fn)("alt","Image preview"),x("data-testid",n.componentId+"-image")}}function ALe(i,o){if(i&1&&(v(0),jt(1),w(2,"div",3,0),u(4,OLe,2,5,"ng-template",4,1,xe),C()),i&2){let n=o.ngIf,e=me(3),t=me(5),r=l();m(2),x("data-testid",r.componentId+"-trigger"),m(2),d("cdkConnectedOverlayOrigin",e)("cdkConnectedOverlayOpen",n.showImageInFullScreen)("cdkConnectedOverlayPanelClass",gt(7,wLe))("cdkConnectedOverlayDisableClose",!0)("snippylyOverlay",t)("snippylyOverlayZIndex",2147483627)}}var Qpe=(()=>{let o=class o{constructor(e,t){this.loggingService=e,this.elementRef=t,this.componentConfigSignal=Ee({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=D(E({},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=D(E({},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:DLe,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&&(Ht(),u(0,ALe,6,8,"ng-container",2)),t&2&&d("ngIf",r.componentConfigSignal())},dependencies:[X,dn,sn,pi],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 PLe=["menuRef"],MLe=["menuTrigger"],kLe=["*"];function RLe(i,o){i&1&&(v(0),w(1,"button",5),C())}var iq=(()=>{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&&(it(PLe,5),it(MLe,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:kLe,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&&(Ht(),_(0,"div",2,0),jt(3),b(),_(4,"mat-menu",3,1),u(6,RLe,2,0,"ng-container",4),b()),t&2){let a=me(2),s=me(5);ue("active",a==null?null:a.menuOpen),d("matMenuTriggerFor",s),m(6),d("ngForOf",r.menuItems)}},dependencies:[Et,rc,xl,kg],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%] *[_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))}[_nghost-%COMP%] *[_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 NLe={provide:fp,useExisting:Cr(()=>t2),multi:!0},t2=(()=>{let o=class o extends Gb{};o.\u0275fac=(()=>{let e;return function(r){return(e||(e=Ka(o)))(r||o)}})(),o.\u0275dir=Wt({type:o,selectors:[["","contenteditable","","veltAutocomplete",""]],inputs:{veltAutocomplete:"veltAutocomplete"},exportAs:["snippylyUserSelectorTrigger"],standalone:!1,features:[V([NLe]),B]});let i=o;return i})();var nl=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 Jpe=i=>({componentConfigSignal:i}),FLe=(i,o)=>({condition:i,data:o}),LLe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-text-comment-tool-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function BLe(i,o){i&1&&He(0)}function VLe(i,o){if(i&1&&(_(0,"velt-shadow-dom-internal"),u(1,BLe,1,0,"ng-container",2),b()),i&2){l();let n=me(2);m(),d("ngTemplateOutlet",n)}}function ULe(i,o){i&1&&(_(0,"div",8),ce(),_(1,"svg",9)(2,"mask",10),w(3,"path",11),b(),w(4,"path",12)(5,"path",13),b()())}function jLe(i,o){if(i&1){let n=K();_(0,"div",6),P(1,"translate"),W("pointerdown",function(t){return N(n),l(2).ngIf.createAnnotation(),F(t.stopPropagation())}),u(2,ULe,6,0,"div",7),b()}if(i&2){let n=l(2).ngIf,e=l(2);at("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",n.showAdder?0:void 0),m(2),d("veltDynamicTemplate",$(16,LLe,e.template,A(14,Jpe,e.componentConfigSignal),n.variant,e.setIfCondition.bind(e),e.elementRef))}}function $Le(i,o){if(i&1&&(v(0),u(1,jLe,3,22,"div",5),C()),i&2){let n=l().ngIf;m(),d("ngIf",n&&!n.disabled&&n.commentToolEnabled&&!n.isPlanExpired&&n.isUserAllowed&&n.enableTextComments&&(n.user==null?null:n.user.userId)&&!n.rewriterEnabled)}}function HLe(i,o){if(i&1&&(v(0),u(1,$Le,2,1,"ng-container",4),C()),i&2){let n=l(2);m(),d("veltIf",k(3,FLe,n.conditionSignal(),A(1,Jpe,n.componentConfigSignal)))}}function zLe(i,o){if(i&1&&u(0,HLe,2,6,"ng-container",3),i&2){let n=l();d("ngIf",n.componentConfigSignal())}}var HC=(()=>{let o=class o extends Je{constructor(e,t,r,a,s,c){super(a,s,void 0,r,r.getTextCommentToolDarkMode$(),c,e),this.loggingService=e,this.wireframeService=t,this.commentService=r,this.elementRef=a,this.themeService=s,this.dynamicDataService=c,this.textCommentToolShadowDOM=!1,this.subscriptions=[],this.componentId="velt-text-comment-tool",super.initializeComponentConfigSignal(new nl),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");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(ze),h(we),h(R),h(Ye),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&&u(0,VLe,2,1,"velt-shadow-dom-internal",1)(1,zLe,1,1,"ng-template",null,0,xe),t&2){let a=me(2);d("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 ege=i=>({componentConfigSignal:i}),WLe=(i,o)=>({condition:i,data:o}),qLe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-text-comment-toolbar-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function YLe(i,o){i&1&&He(0)}function KLe(i,o){if(i&1&&(_(0,"velt-shadow-dom-internal"),u(1,YLe,1,0,"ng-container",2),b()),i&2){l();let n=me(2);m(),d("ngTemplateOutlet",n)}}function ZLe(i,o){if(i&1&&w(0,"app-text-comment-toolbar-comment-annotation",10),i&2){let n=l(6);d("componentConfigSignal",n.componentConfigSignal)}}function XLe(i,o){i&1&&w(0,"app-text-comment-toolbar-divider")}function QLe(i,o){if(i&1&&(_(0,"div",8),u(1,ZLe,1,1,"app-text-comment-toolbar-comment-annotation",9)(2,XLe,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(),d("ngIf",n.commentToolEnabled),m(),d("ngIf",n.commentToolEnabled),m(),d("componentConfigSignal",e.componentConfigSignal),m(),d("componentConfigSignal",e.componentConfigSignal)}}function JLe(i,o){if(i&1){let n=K();_(0,"div",6),P(1,"translate"),W("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())}),u(2,QLe,5,4,"div",7),b()}if(i&2){let n=l(2).ngIf,e=l(2);at("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),d("veltDynamicTemplate",$(21,qLe,e.template,A(19,ege,e.componentConfigSignal),n.variant,e.setIfCondition.bind(e),e.elementRef))}}function eBe(i,o){if(i&1&&(v(0),u(1,JLe,3,27,"div",5),C()),i&2){let n=l().ngIf;m(),d("ngIf",n&&!n.disabled&&!n.isPlanExpired&&n.isUserAllowed&&n.enableTextComments&&(n.user==null?null:n.user.userId)&&n.rewriterEnabled)}}function tBe(i,o){if(i&1&&(v(0),u(1,eBe,2,1,"ng-container",4),C()),i&2){let n=l(2);m(),d("veltIf",k(3,WLe,n.conditionSignal(),A(1,ege,n.componentConfigSignal)))}}function nBe(i,o){if(i&1&&u(0,tBe,2,6,"ng-container",3),i&2){let n=l();d("ngIf",n.componentConfigSignal())}}var zC=(()=>{let o=class o extends Je{constructor(e,t,r,a,s,c){super(a,s,void 0,r,r.getTextCommentToolbarDarkMode$(),c,e),this.loggingService=e,this.wireframeService=t,this.commentService=r,this.elementRef=a,this.themeService=s,this.dynamicDataService=c,this.textCommentToolbarShadowDOM=!1,this.subscriptions=[],this.componentId="velt-text-comment-toolbar",super.initializeComponentConfigSignal(new nl),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(ze),h(we),h(R),h(Ye),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&&u(0,KLe,2,1,"velt-shadow-dom-internal",1)(1,nBe,1,1,"ng-template",null,0,xe),t&2){let a=me(2);d("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 oBe=["commentAdderRef"],tge=(()=>{let o=class o{constructor(e,t,r,a,s,c,p,g){this.analyticsService=e,this.authService=t,this.domService=r,this.iamService=a,this.commentService=s,this.loggingService=c,this.rewriterService=p,this.elementRef=g,this.componentConfigSignal=Ee({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(f=>{this.componentConfigSignal.update(I=>(I=D(E({},I),{enableTextComments:f}),I))},f=>{this.loggingService.catch("Error in CommentAdderComponent getTextCommentMode$ subscription: ",f)})),this.subscriptions.push(this.commentService.getAllowedElementIds().subscribe(f=>{this.allowedElementIds=f},f=>{this.loggingService.catch("Error in CommentAdderComponent getAllowedElementIds subscription: ",f)})),this.subscriptions.push(this.commentService.getCommentTool$().subscribe(f=>{this.componentConfigSignal.update(I=>(I=D(E({},I),{commentToolEnabled:f}),I))})),this.subscriptions.push(this.iamService.getFeaturesAccessLevel$().subscribe(f=>{this.componentConfigSignal.update(I=>(I=D(E({},I),{disabled:!!f?.all?.disabled}),I))})),this.subscriptions.push(this.authService.getUser$().subscribe(f=>{this.componentConfigSignal.update(I=>(I=D(E({},I),{user:f}),I))},f=>{this.loggingService.catch("Error in CommentAdderComponent getUser$ subscription: ",f)})),this.subscriptions.push(this.rewriterService.getRewriterEnabled$().subscribe(f=>{this.componentConfigSignal.update(I=>(I=D(E({},I),{rewriterEnabled:f}),I))},f=>{this.loggingService.catch("Error in CommentAdderComponent getRewriterEnabled$ subscription: ",f)})),this.subscriptions.push(this.iamService.isUserAllowed$().subscribe(f=>{this.componentConfigSignal.update(I=>(I=D(E({},I),{isUserAllowed:f}),I))},f=>{this.loggingService.catch("Error in CommentAdderComponent isUserAllowed$ subscription: ",f)})),this.subscriptions.push(this.authService.isPlanExpired$().subscribe(f=>{this.componentConfigSignal.update(I=>(I=D(E({},I),{isPlanExpired:f}),I))},f=>{this.loggingService.catch("Error in CommentAdderComponent isPlanExpired$ subscription: ",f)}))}ngOnChanges(e){try{e&&Object.keys(e).forEach(t=>{this.componentConfigSignal.update(r=>(r=D(E({},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(Re.COMMENT)){if(window.getSelection()?.toString()){let e=window.getSelection()?.toString(),t=Rk(e||"").join(" ");this.componentConfigSignal.update(r=>(r=D(E({},r),{selectedWordsCount:t?.split(" ").length||0,selectedCharactersCount:t?.length||0}),r))}else this.componentConfigSignal.update(e=>(e=D(E({},e),{selectedWordsCount:0,selectedCharactersCount:0}),e));if(window.getSelection()?.toString()&&!Fk()){let e=window.getSelection()?.getRangeAt(0);e.commonAncestorContainer&&this.commentService.isElementInsideAllowedElements(e.commonAncestorContainer)&&(Cp(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=mn([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=D(E({},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=D(E({},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 lm(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 c=this.commentService.getInlineCommentSectionConfig(s);this.commentService.addComment(void 0,a,void 0,void 0,void 0,void 0,void 0,void 0,c)}},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(Y.Events.Rewriter.REWRITE_BUTTON_CLICKED,{charactersSelected:this.componentConfigSignal().selectedCharactersCount,wordsSelected:this.componentConfigSignal().selectedWordsCount,isMobileDevice:this.domService.isMobileDevice()}):this.analyticsService.trackEvent(Y.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(Y.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(Y.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=D(E({},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=D(E({},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(Le),h(En),h(we),h(y),h(bd),h(R))},o.\u0275cmp=O({type:o,selectors:[["snippyly-comment-adder"]],viewQuery:function(t,r){if(t&1&&it(oBe,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&&(d("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),d("componentConfigSignal",r.componentConfigSignal))},dependencies:[HC,zC],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 aBe=["overlay"],sBe=()=>["snippyly-overlay-panel","velt-overlay-panel"];function lBe(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.annotationNumber==null||(n=e.commentPinAnnotation.annotationNumber.toString())==null?null:n.length)===3),x("data-comment-annotation-number","#"+(e.commentPinAnnotation==null?null:e.commentPinAnnotation.annotationNumber))}}function cBe(i,o){if(i&1){let n=K();v(0),_(1,"velt-multi-thread-comment-dialog-internal",10),W("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(),C()}if(i&2){let n=l(2).ngIf;m(),d("multiThreadAnnotationId",n.commentPinAnnotation.annotationId)("annotation",n.commentPinAnnotation)("user",n.user)("commentPinSelected",n.commentPinSelected)}}function dBe(i,o){if(i&1){let n=K();_(0,"snippyly-comment-dialog",11),W("saveComment",function(t){N(n);let r=l(3);return F(r.saveComment(t))}),b()}if(i&2){let n=l(2).ngIf;d("annotation",n.commentPinAnnotation)("user",n.user)("commentPinSelected",n.commentPinSelected)("inlineCommentMode",n.inlineCommentMode)("isInsidePdfViewer",n.isInsidePdfViewer)}}function mBe(i,o){if(i&1&&u(0,cBe,2,4,"ng-container",9)(1,dBe,1,5,"ng-template",null,2,xe),i&2){let n=me(2),e=l().ngIf;d("ngIf",(e==null||e.commentPinAnnotation==null?null:e.commentPinAnnotation.type)==="multiThread")("ngIfElse",n)}}function pBe(i,o){if(i&1){let n=K();_(0,"snippyly-comment-bottom-sheet",12),W("saveComment",function(t){N(n);let r=l(2);return F(r.saveComment(t))}),b()}if(i&2){let n=l().ngIf;d("annotation",n.commentPinAnnotation)("user",n.user)("isInsidePdfViewer",n.isInsidePdfViewer)}}function gBe(i,o){if(i&1){let n=K();v(0),_(1,"snippyly-comment-text",4,0),W("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(),u(3,lBe,1,3,"span",5)(4,mBe,3,2,"ng-template",6,1,xe)(6,pBe,1,3,"snippyly-comment-bottom-sheet",7),C()}if(i&2){let n=o.ngIf,e=me(2),t=l();m(),ue("inline-comment-mode",n.inlineCommentMode&&!n.isInsidePdfViewer)("selected",n.commentPinHover||n.commentPinSelected),m(2),d("ngIf",n.last&&n.showCommentIndex&&(n.commentPinAnnotation==null?null:n.commentPinAnnotation.annotationNumber)),m(),d("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",gt(15,sBe))("cdkConnectedOverlayBackdropClass","snippyly-overlay-backdrop")("cdkConnectedOverlayLockPosition",!1)("cdkConnectedOverlayPositions",t.positions)("cdkConnectedOverlayGrowAfterOpen",!0)("cdkConnectedOverlayDisableClose",!0),m(2),d("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 X9=(()=>{let o=class o{onEnter(e){this.onKeyupEnter&&this.onKeyupEnter()}constructor(e,t,r,a,s,c,p,g){this.analyticsService=e,this.authService=t,this.breakpointObserver=r,this.domService=a,this.commentService=s,this.loggingService=c,this.recorderService=p,this.elementRef=g,this.subscriptions=[],this.selectedAnnotationsMap={},this.customScrollableParentEventsListenersSubscriptions=[],this.isDialogOnHoverEnabled=!1,this.componentConfigSignal=Ee({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=U.OVERLAY_POSITIONS.map(f=>new ci({originX:f.originX,originY:f.originY},{overlayX:f.overlayX,overlayY:f.overlayY})),this.veltElement=!0,this.componentId="velt-comment-text-portal",this.subscriptions.push(this.authService.getUser$().subscribe(f=>{this.componentConfigSignal.update(I=>(I=D(E({},I),{user:f}),I))},f=>{this.catchError("Error in CommentTextPortalComponent getUser$ subscription: ",f)})),this.subscriptions.push(this.commentService.getSidebarVisibility$().subscribe(f=>{this.componentConfigSignal.update(I=>(I=D(E({},I),{sidebarVisible:f}),I))},f=>{this.catchError("Error in CommentTextPortalComponent getSidebarVisibility$ subscription: ",f)})),this.subscriptions.push(this.commentService.showFloatingComments$().subscribe(f=>{this.componentConfigSignal.update(I=>(I=D(E({},I),{floatingCommentsEnabled:f}),I))},f=>{this.catchError("Error in CommentTextPortalComponent showFloatingComments$ subscription: ",f)})),this.subscriptions.push(this.commentService.getShowCommentIndex().subscribe(f=>{this.componentConfigSignal.update(I=>(I=D(E({},I),{showCommentIndex:f}),I))},f=>{this.catchError("Error in CommentTextPortalComponent getShowCommentIndex subscription: ",f)})),this.subscriptions.push(this.commentService.getEnableDialogOnHover$().subscribe(f=>{this.isDialogOnHoverEnabled=f},f=>{this.catchError("Error in CommentPinComponent getEnableDialogOnHover subscription: ",f)})),this.subscriptions.push(this.breakpointObserver.observe(Ui.XSmall).subscribe(f=>{let I=!1;f.matches?I=!0:I=!1,this.componentConfigSignal.update(T=>(T=D(E({},T),{isPhone:I}),T))},f=>{this.catchError("Error in CommentTextPortalComponent breakpointObserver subscription: ",f)}))}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=Q0(this.element,U.ATTRIBUTES.VELT_PDF_VIEWER);return r=D(E({},r),{isInsidePdfViewer:a}),r}),this.subscriptions.push(this.overlay?.positionChange?.subscribe(r=>{this.componentConfigSignal.update(a=>(a=D(E({},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=D(E({},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=D(E({},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=D(E({},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=D(E({},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=D(E({},t),{first:e}),t))}catch(t){this.catchError("Error in CommentTextPortalComponent setFirst: ",t)}}setLast(e){try{this.componentConfigSignal.update(t=>(t=D(E({},t),{last:e}),t))}catch(t){this.catchError("Error in CommentTextPortalComponent setLast: ",t)}}setCommentPinAnnotation(e){try{this.componentConfigSignal.update(t=>(t=D(E({},t),{commentPinAnnotation:e}),t))}catch(t){this.catchError("Error in CommentTextPortalComponent setCommentPinAnnotation: ",t)}}setElement(e){try{this.element=e,this.element?this.customScrollableParents=Fg(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=D(E({},e),{commentPinSelected:!0}),e)):this.componentConfigSignal.update(e=>(e=D(E({},e),{commentPinSelected:!1,textClicked:!1}),e)),sessionStorage.getItem(U.SESSION_STORAGE.SNIPPYLY_AUTO_SELECT_ANNOTATION_ID)===this.componentConfigSignal().commentPinAnnotation.annotationId&&this.componentConfigSignal().last&&(this.componentConfigSignal.update(e=>(e=D(E({},e),{textClicked:!0}),e)),sessionStorage.removeItem(U.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=D(E({},t),{commentPinHover:!1}),t)):!this.componentConfigSignal().commentPinHover&&this.isDialogOnHoverEnabled&&this.componentConfigSignal.update(t=>(t=D(E({},t),{commentPinHover:!0}),t))}catch(t){this.catchError("Error in CommentTextPortalComponent onPointerOver: ",t)}}onPointerOut(){this.componentConfigSignal.update(e=>(e=D(E({},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(`[${U.ATTRIBUTES.VELT_ANNOTATION_DRAFT}="${t?.annotationId}"]`)?this.domService.resetSelectedAnnotationsMap(!0,"comments"):(this.componentConfigSignal.update(a=>(a=D(E({},a),{textClicked:!0}),a)),this.domService.toggleAnnotationSelection(t)));else{let r=document.querySelector(`[${U.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);if(r||(r=(this.domService.getDraftCommentAnnotationDialogs()||[])[0]),r){let a=r.getAttribute(U.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=D(E({},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(fi(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,D(E({},r||{}),{annotationId:this.componentConfigSignal()?.commentPinAnnotation?.annotationId}))}catch{}}};o.\u0275fac=function(t){return new(t||o)(h(tt),h(je),h(To),h(Le),h(we),h(y),h(bn),h(R))},o.\u0275cmp=O({type:o,selectors:[["snippyly-comment-text-portal"]],viewQuery:function(t,r){if(t&1&&it(aBe,5),t&2){let a;Xe(a=Qe())&&(r.overlay=a.first)}},hostVars:1,hostBindings:function(t,r){t&1&&W("keyup.enter",function(s){return r.onEnter(s)},lh),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&&u(0,gBe,7,16,"ng-container",3),t&2&&d("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 Q9=(()=>{let o=class o{constructor(e,t,r,a,s,c,p){this.docService=e,this.domService=t,this.commentService=r,this.componentFactoryResolver=a,this.injector=s,this.appRef=c,this.loggingService=p,this.commentsTextById={},this.commonAncestorElementObservers=new Map,this.commonAncestorElementObserverCounts=new Map,this.inlineCommentMode=!1;try{this.commentService.getInlineCommentMode$().subscribe(g=>{this.inlineCommentMode=g})}catch(g){this.loggingService.catch("Error in CommentPinPortalService constructor: ",g)}}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(ui(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)}),t.annotation=e)}else this.removeTextCommentAnnotation(e),this.getCommonAncestorContainer(e);else this.getCommonAncestorContainer(e)}getCommonAncestorContainer(e){try{let t=this.domService.getElementFromTargetTextRange(e?.targetTextRange);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.getElementFromTargetTextRange(e?.targetTextRange);if(e?.locationId&&this.docService.getLocation()?.locationId!==e?.locationId){let p=this.docService.getElementMapWithLocation();p[e?.locationId]&&(r=p[e?.locationId]?.element)}let a=r?q0(e.targetTextRange?.text,r,e.targetTextRange?.occurrence):[],s=!1;if(a?.forEach(c=>{c?.textNode?.parentElement?.closest("script")&&(s=!0)}),!s){let c=new Range;try{c.setStart(a[0].textNode,a[0].startOffset||0),c.setEnd(a[a.length-1].textNode,a[a.length-1].endOffset||0)}catch{}if(c.toString()===e.targetTextRange?.text){let p=$C(c),g=[],f=p?.find(I=>!I?.textContent);if(f&&f?.remove(),p=p?.filter(I=>I?.textContent),p&&p.length){let I=-1,T=-1;if(p.forEach((L,G)=>{this.textHighlighterClass?this.domService.addClassToElement(L,this.textHighlighterClass):this.domService.addClassToElement(L,L.tagName?.toLowerCase()),L.setAttribute(U.ATTRIBUTES.VELT_ID,e.annotationId);let z=L.childNodes[0],J=new lr(X9),le=new cr(L,this.appRef,this.injector),_e=le.attach(J);_e.instance.setCommentPinAnnotation(e),_e.instance.setElement(L),_e.instance.onKeyupEnter=()=>{this.onCommonAncestorElementChange(e)},I<0&&(I=G),T=G,g.push({host:le,portal:J,portalRef:_e,element:L,textNode:z})}),I>=0&&g[I]?.portalRef&&g[I].portalRef.instance.setFirst(!0),T>=0&&g[T]?.portalRef&&g[T].portalRef.instance.setLast(!0),t.texts=g,this.inlineCommentMode&&!document.querySelector(`${U.TAGS.VELT_INLINE_COMMENT}[${U.ATTRIBUTES.VELT_INLINE_COMMENT_ID}="${e.annotationId}"]`)){let G=t.texts?.filter(J=>!!J?.element)?.map(J=>J?.element),z=G?.length?G[G.length-1]:null;if(z&&!Q0(z,U.ATTRIBUTES.VELT_PDF_VIEWER)){let le=z?.parentElement;if(le){let _e=document.createElement(U.TAGS.VELT_INLINE_COMMENT);_e.setAttribute(U.ATTRIBUTES.VELT_INLINE_COMMENT_ID,e.annotationId),le.insertAdjacentElement("afterend",_e),t.inlineCommentElement=_e}}}}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(`${U.TAGS.SNIPPYLY_TEXT_HIGHLIGHT}[data-velt-id="${e?.annotationId}"]`);r?.length&&r.forEach(a=>{let s=a?.parentNode;if(a?.textContent){let c=document.createTextNode(a.textContent);a.replaceWith(c)}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 c="";if(kk(t?.commonAncestorElement).forEach(g=>{g?.parentElement?.closest(".comment-annotation-number")||(c+=g.textContent)}),t?.commonAncestorText!==c&&s.filter(g=>[Node.ELEMENT_NODE,Node.TEXT_NODE].includes(g.target.nodeType)).filter(g=>g.target?.parentElement&&(g?.target?.parentElement?.classList?.contains("comment-text-highlight")||!qi(g.target?.parentElement))).length){this.commonAncestorElementObservers.get(t.commonAncestorElement)?.annotations?.forEach(L=>{this.onCommonAncestorElementChange(L)});let{count:f,lastUpdated:I}=this.commonAncestorElementObserverCounts.get(t.commonAncestorElement)||{count:0,lastUpdated:0},T=Date.now();this.commonAncestorElementObserverCounts.set(t.commonAncestorElement,{count:T-I<100?f+1:1,lastUpdated:Date.now()}),f>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(f=>r+=f.textNode?.textContent);let a=t.texts[0].textNode,s=[];document.querySelectorAll(`${U.TAGS.SNIPPYLY_TEXT_HIGHLIGHT}[data-velt-id="${e?.annotationId}"]`)?.forEach(f=>{s.push(f)});let c=!1;if(s?.length!==t?.texts?.length&&(c=!0),s?.length){let f="";s.forEach(I=>{f+=I?.textContent||""}),f&&(r=f,c&&this.removeTextCommentAnnotation(e))}let p=rf(t.commonAncestorContainer,0,a,0,r)+1,g={};g.commonAncestorContainer=e.targetTextRange?.commonAncestorContainer,g.text=r,g.occurrence=p,ui(e.targetTextRange,g)||(t.annotation.targetTextRange=g,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,c=X0(s?.replaceContentHtml)?null:s?.replaceContentHtml,p=s?.replaceContentText||s?.commentText||"";if(X0(c)&&!s?.replaceContentText&&(c=s?.commentHtml||""),e?.selectAllContent&&e?.targetElementId){let g=ya(e.targetElementId,["id","data-id"]);g&&(g.innerHTML=this.domService.sanitizeHtml(X0(c)?p||"":c||""))}else{if(c&&c!==p){let g=document.createElement("span");g.innerHTML=this.domService.sanitizeHtml(c||p||""),a.parentNode.replaceChild(g,a),t.texts[r].textNode=g}else t.texts[r].textNode.textContent=p||"";for(let g=0;g<r;g++){let f=t.texts[g].textNode;f&&(f.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)(ee(rt),ee(Le),ee(we),ee(ko),ee(yt),ee(ii),ee(y))},o.\u0275prov=Pe({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var bm=class{constructor(){this.type="contact"}};var ige=i=>({componentConfigSignal:i}),uBe=(i,o)=>({condition:i,data:o}),hBe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-autocomplete-chip-tooltip-description-wireframe",variant:n,setIfCondition:e,componentElementRef:t}),fBe=()=>({});function vBe(i,o){i&1&&He(0)}function CBe(i,o){if(i&1&&(v(0),u(1,vBe,1,0,"ng-container",6),C()),i&2){l(2);let n=me(3);m(),d("ngTemplateOutlet",n)}}function _Be(i,o){i&1&&He(0)}function yBe(i,o){if(i&1&&(v(0),u(1,_Be,1,0,"ng-container",6),C()),i&2){l(2);let n=me(5);m(),d("ngTemplateOutlet",n)}}function SBe(i,o){i&1&&He(0)}function bBe(i,o){if(i&1&&(v(0),u(1,SBe,1,0,"ng-container",6),C()),i&2){l(2);let n=me(7);m(),d("ngTemplateOutlet",n)}}function IBe(i,o){if(i&1&&(v(0),u(1,CBe,2,1,"ng-container",3)(2,yBe,2,1,"ng-container",3)(3,bBe,2,1,"ng-container",3),C()),i&2){let n=l(2).ngIf;m(),d("ngIf",(n==null?null:n.type)==="contact"),m(),d("ngIf",(n==null?null:n.type)==="custom"),m(),d("ngIf",(n==null?null:n.type)==="group")}}function EBe(i,o){if(i&1&&(te(0),P(1,"translate")),i&2){let n=l(2).ngIf;ye(" ",M(1,1,(n==null||n.contact==null?null:n.contact.email)||(n==null?null:n.email))," ")}}function xBe(i,o){if(i&1&&(te(0),P(1,"translate")),i&2){let n=l(2).ngIf;ye(" ",M(1,1,n==null||n.custom==null||n.custom.custom==null?null:n.custom.custom.description)," ")}}function TBe(i,o){if(i&1&&(v(0),te(1),P(2,"translate"),C()),i&2){let n,e=l(3).ngIf,t=l();m(),br(" ",(n=t.objectKeys((e==null||e.group==null||e.group.group==null?null:e.group.group.users)||gt(4,fBe)))==null?null:n.length," ",M(2,2,"members")," ")}}function DBe(i,o){if(i&1&&u(0,TBe,3,5,"ng-container",3),i&2){let n=l(2).ngIf;d("ngIf",n==null||n.group==null?null:n.group.group)}}function wBe(i,o){if(i&1&&(v(0),u(1,IBe,4,3,"ng-container",5)(2,EBe,2,3,"ng-template",null,0,xe)(4,xBe,2,3,"ng-template",null,1,xe)(6,DBe,1,1,"ng-template",null,2,xe),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(3,hBe,e.template,A(1,ige,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function OBe(i,o){if(i&1&&(v(0),u(1,wBe,8,9,"ng-container",4),C()),i&2){let n=l();m(),d("veltIf",k(3,uBe,n.conditionSignal(),A(1,ige,n.componentConfigSignal)))}}var n2=(()=>{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 bm)}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&&u(0,OBe,2,6,"ng-container",3),t&2&&d("ngIf",r.componentConfigSignal())},encapsulation:2,changeDetection:0});let i=o;return i})();var oge=i=>({componentConfigSignal:i}),ABe=(i,o)=>({condition:i,data:o}),PBe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-autocomplete-chip-tooltip-icon-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function MBe(i,o){i&1&&He(0)}function kBe(i,o){if(i&1&&(v(0),u(1,MBe,1,0,"ng-container",6),C()),i&2){l(2);let n=me(3);m(),d("ngTemplateOutlet",n)}}function RBe(i,o){i&1&&He(0)}function NBe(i,o){if(i&1&&(v(0),u(1,RBe,1,0,"ng-container",6),C()),i&2){l(2);let n=me(5);m(),d("ngTemplateOutlet",n)}}function FBe(i,o){i&1&&He(0)}function LBe(i,o){if(i&1&&(v(0),u(1,FBe,1,0,"ng-container",6),C()),i&2){l(2);let n=me(7);m(),d("ngTemplateOutlet",n)}}function BBe(i,o){if(i&1&&(v(0),u(1,kBe,2,1,"ng-container",3)(2,NBe,2,1,"ng-container",3)(3,LBe,2,1,"ng-container",3),C()),i&2){let n=l(2).ngIf;m(),d("ngIf",(n==null?null:n.type)==="contact"),m(),d("ngIf",(n==null?null:n.type)==="custom"),m(),d("ngIf",(n==null?null:n.type)==="group")}}function VBe(i,o){if(i&1&&w(0,"snippyly-user-avatar",7),i&2){let n=l(2).ngIf;d("size",32)("user",n==null?null:n.contact)}}function UBe(i,o){if(i&1&&(w(0,"div",11),P(1,"safeSvg")),i&2){let n=l(3).ngIf;d("innerHtml",M(1,1,n==null||n.custom==null||n.custom.custom==null||n.custom.custom.icon==null?null:n.custom.custom.icon.svg),to)}}function jBe(i,o){if(i&1&&w(0,"img",12),i&2){let n=l(3).ngIf;d("src",n==null||n.custom==null||n.custom.custom==null||n.custom.custom.icon==null?null:n.custom.custom.icon.url,fn)}}function $Be(i,o){if(i&1&&(u(0,UBe,2,3,"div",8),_(1,"div",9),u(2,jBe,1,1,"img",10),b()),i&2){let n=l(2).ngIf;d("ngIf",n==null||n.custom==null||n.custom.custom==null||n.custom.custom.icon==null?null:n.custom.custom.icon.svg),m(2),d("ngIf",n==null||n.custom==null||n.custom.custom==null||n.custom.custom.icon==null?null:n.custom.custom.icon.url)}}function HBe(i,o){i&1&&(_(0,"div",13),ce(),_(1,"svg",14),w(2,"path",15),b()())}function zBe(i,o){if(i&1&&(v(0),u(1,BBe,4,3,"ng-container",5)(2,VBe,1,2,"ng-template",null,0,xe)(4,$Be,3,2,"ng-template",null,1,xe)(6,HBe,3,0,"ng-template",null,2,xe),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(3,PBe,e.template,A(1,oge,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function GBe(i,o){if(i&1&&(v(0),u(1,zBe,8,9,"ng-container",4),C()),i&2){let n=l();m(),d("veltIf",k(3,ABe,n.conditionSignal(),A(1,oge,n.componentConfigSignal)))}}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,super.initializeComponentConfigSignal(new bm)}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&&u(0,GBe,2,6,"ng-container",3),t&2&&d("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 rge=i=>({componentConfigSignal:i}),WBe=(i,o)=>({condition:i,data:o}),qBe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-autocomplete-chip-tooltip-name-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function YBe(i,o){i&1&&He(0)}function KBe(i,o){if(i&1&&(v(0),u(1,YBe,1,0,"ng-container",6),C()),i&2){l(2);let n=me(3);m(),d("ngTemplateOutlet",n)}}function ZBe(i,o){i&1&&He(0)}function XBe(i,o){if(i&1&&(v(0),u(1,ZBe,1,0,"ng-container",6),C()),i&2){l(2);let n=me(5);m(),d("ngTemplateOutlet",n)}}function QBe(i,o){i&1&&He(0)}function JBe(i,o){if(i&1&&(v(0),u(1,QBe,1,0,"ng-container",6),C()),i&2){l(2);let n=me(7);m(),d("ngTemplateOutlet",n)}}function eVe(i,o){if(i&1&&(v(0),u(1,KBe,2,1,"ng-container",3)(2,XBe,2,1,"ng-container",3)(3,JBe,2,1,"ng-container",3),C()),i&2){let n=l(2).ngIf;m(),d("ngIf",(n==null?null:n.type)==="contact"),m(),d("ngIf",(n==null?null:n.type)==="custom"),m(),d("ngIf",(n==null?null:n.type)==="group")}}function tVe(i,o){if(i&1&&(te(0),P(1,"translate")),i&2){let n=l(2).ngIf;ye(" ",M(1,1,n==null||n.contact==null?null:n.contact.name)," ")}}function nVe(i,o){if(i&1&&(te(0),P(1,"translate")),i&2){let n=l(2).ngIf;ye(" ",M(1,1,n==null||n.custom==null||n.custom.custom==null?null:n.custom.custom.name)," ")}}function iVe(i,o){if(i&1&&(te(0),P(1,"translate")),i&2){let n=l(2).ngIf;ye(" ",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 oVe(i,o){if(i&1&&(v(0),u(1,eVe,4,3,"ng-container",5)(2,tVe,2,3,"ng-template",null,0,xe)(4,nVe,2,3,"ng-template",null,1,xe)(6,iVe,2,3,"ng-template",null,2,xe),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(3,qBe,e.template,A(1,rge,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function rVe(i,o){if(i&1&&(v(0),u(1,oVe,8,9,"ng-container",4),C()),i&2){let n=l();m(),d("veltIf",k(3,WBe,n.conditionSignal(),A(1,rge,n.componentConfigSignal)))}}var o2=(()=>{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 bm)}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&&u(0,rVe,2,6,"ng-container",3),t&2&&d("ngIf",r.componentConfigSignal())},encapsulation:2,changeDetection:0});let i=o;return i})();var age=i=>({componentConfigSignal:i}),aVe=(i,o)=>({condition:i,data:o}),sVe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-autocomplete-chip-tooltip-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function lVe(i,o){i&1&&He(0)}function cVe(i,o){if(i&1&&(_(0,"velt-shadow-dom-internal"),u(1,lVe,1,0,"ng-container",4),b()),i&2){l();let n=me(3);m(),d("ngTemplateOutlet",n)}}function dVe(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),d("componentConfigSignal",n.componentConfigSignal),m(3),d("componentConfigSignal",n.componentConfigSignal),m(2),d("componentConfigSignal",n.componentConfigSignal)}}function mVe(i,o){if(i&1&&u(0,dVe,8,3,"div",5),i&2){let n=l(2).ngIf,e=l();d("veltDynamicTemplate",$(3,sVe,e.template,A(1,age,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function pVe(i,o){if(i&1&&(v(0),u(1,cVe,2,1,"velt-shadow-dom-internal",3)(2,mVe,1,9,"ng-template",null,0,xe),C()),i&2){let n=me(3),e=l(2);m(),d("ngIf",e.shadowDom&&!e.template)("ngIfElse",n)}}function gVe(i,o){if(i&1&&(v(0),u(1,pVe,4,2,"ng-container",2),C()),i&2){let n=l();m(),d("veltIf",k(3,aVe,n.conditionSignal(),A(1,age,n.componentConfigSignal)))}}var GC=(()=>{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 bm)}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(ze),h(R),h(Ye),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&&u(0,gVe,2,6,"ng-container",1),t&2&&d("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 il=class{constructor(){this.onOptionClick=()=>{},this.newUserContactError=void 0,this.newUserContact=void 0,this.expandMentionGroups=!1,this.showMentionGroupsFirst=!1,this.showMentionGroupsOnly=!1,this.customGroupsEnabled=!1}},Im=class{constructor(){this.isGroupHeader=!1,this.isGroupMember=!1,this.isNewContact=!1,this.disabled=!1}};var oq=i=>({$implicit:i}),hVe=(i,o)=>({componentConfigSignal:i,userContact:o}),rq=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-autocomplete-option-description-wireframe",variant:n,setIfCondition:e,componentElementRef:t}),fVe=(i,o)=>({componentConfigSignal:i,custom:o}),vVe=(i,o)=>({componentConfigSignal:i,group:o}),sge=()=>({});function CVe(i,o){i&1&&He(0)}function _Ve(i,o){if(i&1&&(v(0),u(1,CVe,1,0,"ng-container",4),C()),i&2){l();let n=me(5),e=l();m(),d("ngTemplateOutlet",n)("ngTemplateOutletContext",A(2,oq,e.selectorItem==null?null:e.selectorItem.contact))}}function yVe(i,o){i&1&&He(0)}function SVe(i,o){if(i&1&&(v(0),u(1,yVe,1,0,"ng-container",4),C()),i&2){l();let n=me(7),e=l();m(),d("ngTemplateOutlet",n)("ngTemplateOutletContext",A(2,oq,e.selectorItem==null?null:e.selectorItem.custom))}}function bVe(i,o){i&1&&He(0)}function IVe(i,o){if(i&1&&(v(0),u(1,bVe,1,0,"ng-container",4),C()),i&2){l();let n=me(9),e=l();m(),d("ngTemplateOutlet",n)("ngTemplateOutletContext",A(2,oq,e.selectorItem==null?null:e.selectorItem.group))}}function EVe(i,o){if(i&1&&(_(0,"p",6),te(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(),ye(" ",e.field?n[e.field]:M(2,4,n.email)," ")}}function xVe(i,o){if(i&1&&(v(0),u(1,EVe,3,6,"p",5),C()),i&2){let n=l().$implicit,e=l().ngIf,t=l();m(),d("veltDynamicTemplate",$(4,rq,t.template,k(1,hVe,t.componentConfigSignal,n),e==null?null:e.variant,t.setIfCondition.bind(t),t.elementRef))}}function TVe(i,o){if(i&1&&u(0,xVe,2,10,"ng-container",3),i&2){let n=o.$implicit,e=l(2);d("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 DVe(i,o){if(i&1&&(_(0,"p",6),te(1),P(2,"translate"),b()),i&2){let n=l(2).$implicit;x("aria-label",n.description),m(),ye(" ",M(2,2,n.description)," ")}}function wVe(i,o){if(i&1&&(v(0),u(1,DVe,3,4,"p",7),C()),i&2){let n=l().$implicit,e=l().ngIf,t=l();m(),d("veltDynamicTemplate",$(4,rq,t.template,k(1,fVe,t.componentConfigSignal,n),e==null?null:e.variant,t.setIfCondition.bind(t),t.elementRef))}}function OVe(i,o){if(i&1&&u(0,wVe,2,10,"ng-container",3),i&2){let n=o.$implicit;d("ngIf",(n.description==null?null:n.description.length)>0)}}function AVe(i,o){if(i&1&&(_(0,"p",6),te(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)||gt(5,sge)))==null?null:n.length)+" members"),m(),br(" ",(e=r.objectKeys((t==null?null:t.users)||gt(6,sge)))==null?null:e.length," ",M(2,3,"members")," ")}}function PVe(i,o){if(i&1&&(v(0),u(1,AVe,3,7,"p",7),C()),i&2){let n=o.$implicit,e=l().ngIf,t=l();m(),d("veltDynamicTemplate",$(4,rq,t.template,k(1,vVe,t.componentConfigSignal,n),e==null?null:e.variant,t.setIfCondition.bind(t),t.elementRef))}}function MVe(i,o){if(i&1&&(v(0),u(1,_Ve,2,4,"ng-container",3)(2,SVe,2,4,"ng-container",3)(3,IVe,2,4,"ng-container",3)(4,TVe,1,1,"ng-template",null,0,xe)(6,OVe,1,1,"ng-template",null,1,xe)(8,PVe,2,10,"ng-template",null,2,xe),C()),i&2){let n=l();m(),d("ngIf",(n.selectorItem==null?null:n.selectorItem.type)==="contact"),m(),d("ngIf",(n.selectorItem==null?null:n.selectorItem.type)==="custom"),m(),d("ngIf",(n.selectorItem==null?null:n.selectorItem.type)==="group")}}var r2=(()=>{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 il)}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&&u(0,MVe,10,3,"ng-container",3),t&2&&d("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;white-space:nowrap;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 kVe=i=>({$implicit:i}),RVe=(i,o,n)=>({componentConfigSignal:i,isNewContact:o,userContact:n}),NVe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-autocomplete-option-error-icon-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function FVe(i,o){i&1&&He(0)}function LVe(i,o){if(i&1&&(v(0),u(1,FVe,1,0,"ng-container",2),C()),i&2){l();let n=me(3),e=l();m(),d("ngTemplateOutlet",n)("ngTemplateOutletContext",A(2,kVe,e.selectorItem==null?null:e.selectorItem.contact))}}function BVe(i,o){if(i&1&&(_(0,"div",6)(1,"div",7),ce(),_(2,"svg",8),w(3,"path",9)(4,"path",10),b()()()),i&2){let n=l(3).ngIf,e=l();m(),d("title",n.newUserContactError),x("title",n.newUserContactError)("data-testid",e.componentId+"-icon"),m(),x("data-testid",e.componentId+"-svg")}}function VVe(i,o){if(i&1&&(_(0,"div",4),P(1,"translate"),u(2,BVe,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),d("veltDynamicTemplate",$(9,NVe,t.template,$e(5,RVe,t.componentConfigSignal,t.isNewContact,n),e==null?null:e.variant,t.setIfCondition.bind(t),t.elementRef))}}function UVe(i,o){if(i&1&&u(0,VVe,3,15,"div",3),i&2){let n=l().ngIf,e=l();d("ngIf",e.isNewContact&&n.newUserContactError)}}function jVe(i,o){if(i&1&&(v(0),u(1,LVe,2,4,"ng-container",1)(2,UVe,1,1,"ng-template",null,0,xe),C()),i&2){let n=l();m(),d("ngIf",(n.selectorItem==null?null:n.selectorItem.type)==="contact")}}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-autocomplete-error-icon",super.initializeComponentConfigSignal(new il)}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&&u(0,jVe,4,1,"ng-container",1),t&2&&d("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 $Ve=(i,o)=>({componentConfigSignal:i,selectorItem:o}),HVe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-autocomplete-option-icon-wireframe",variant:n,setIfCondition:e,componentElementRef:t}),aq=i=>({$implicit:i});function zVe(i,o){i&1&&He(0)}function GVe(i,o){if(i&1&&(v(0),u(1,zVe,1,0,"ng-container",7),C()),i&2){l(2);let n=me(3),e=l();m(),d("ngTemplateOutlet",n)("ngTemplateOutletContext",A(2,aq,e.selectorItem==null?null:e.selectorItem.contact))}}function WVe(i,o){i&1&&He(0)}function qVe(i,o){if(i&1&&(v(0),u(1,WVe,1,0,"ng-container",7),C()),i&2){l(2);let n=me(5),e=l();m(),d("ngTemplateOutlet",n)("ngTemplateOutletContext",A(2,aq,e.selectorItem==null?null:e.selectorItem.custom))}}function YVe(i,o){i&1&&He(0)}function KVe(i,o){if(i&1&&(v(0),u(1,YVe,1,0,"ng-container",7),C()),i&2){l(2);let n=me(7),e=l();m(),d("ngTemplateOutlet",n)("ngTemplateOutletContext",A(2,aq,e.selectorItem==null?null:e.selectorItem.group))}}function ZVe(i,o){if(i&1&&(_(0,"div",6),u(1,GVe,2,4,"ng-container",4)(2,qVe,2,4,"ng-container",4)(3,KVe,2,4,"ng-container",4),b()),i&2){let n=l(2);x("data-testid",n.componentId)("aria-label","Option icon"),m(),d("ngIf",(n.selectorItem==null?null:n.selectorItem.type)==="contact"),m(),d("ngIf",(n.selectorItem==null?null:n.selectorItem.type)==="custom"),m(),d("ngIf",(n.selectorItem==null?null:n.selectorItem.type)==="group")}}function XVe(i,o){if(i&1&&(v(0),ce(),_(1,"svg",9),w(2,"path",10),b(),C()),i&2){let n=l(3);m(),x("data-testid",n.componentId+"-contact-at")}}function QVe(i,o){if(i&1&&w(0,"snippyly-user-avatar",11),i&2){let n=l().$implicit,e=l(2);d("size",32)("user",n),x("data-testid",e.componentId+"-contact-avatar")}}function JVe(i,o){if(i&1&&u(0,XVe,3,1,"ng-container",8)(1,QVe,1,3,"ng-template",null,3,xe),i&2){let n=o.$implicit,e=me(2);d("ngIf",(n==null?null:n.visibility)==="here")("ngIfElse",e)}}function eUe(i,o){if(i&1&&(v(0),w(1,"div",12),P(2,"safeSvg"),C()),i&2){let n=l().$implicit,e=l(2);m(),d("innerHTML",M(2,2,n.icon.svg),to),x("data-testid",e.componentId+"-custom-svg")}}function tUe(i,o){if(i&1&&(v(0),w(1,"img",13),C()),i&2){let n=l().$implicit,e=l(2);m(),d("src",n.icon.url,fn),x("alt",(n==null?null:n.description)||"Custom icon")("data-testid",e.componentId+"-custom-img")}}function nUe(i,o){if(i&1&&u(0,eUe,3,4,"ng-container",4)(1,tUe,2,3,"ng-container",4),i&2){let n=o.$implicit;d("ngIf",n==null||n.icon==null?null:n.icon.svg),m(),d("ngIf",n==null||n.icon==null?null:n.icon.url)}}function iUe(i,o){if(i&1&&(ce(),_(0,"svg",14),w(1,"path",15),b()),i&2){let n=l(2);x("data-testid",n.componentId+"-group-icon")}}function oUe(i,o){if(i&1&&(v(0),u(1,ZVe,4,5,"div",5)(2,JVe,3,2,"ng-template",null,0,xe)(4,nUe,2,2,"ng-template",null,1,xe)(6,iUe,2,1,"ng-template",null,2,xe),C()),i&2){let n=o.ngIf,e=l();m(),d("veltDynamicTemplate",$(4,HVe,e.template,k(1,$Ve,e.componentConfigSignal,e.selectorItem),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}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-autocomplete-icon",super.initializeComponentConfigSignal(new il)}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&&u(0,oUe,8,10,"ng-container",4),t&2&&d("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 sq=i=>({$implicit:i}),rUe=(i,o)=>({componentConfigSignal:i,userContact:o}),lq=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-autocomplete-option-name-wireframe",variant:n,setIfCondition:e,componentElementRef:t}),aUe=(i,o)=>({componentConfigSignal:i,custom:o}),sUe=(i,o)=>({componentConfigSignal:i,group:o});function lUe(i,o){i&1&&He(0)}function cUe(i,o){if(i&1&&(v(0),u(1,lUe,1,0,"ng-container",5),C()),i&2){l();let n=me(5),e=l();m(),d("ngTemplateOutlet",n)("ngTemplateOutletContext",A(2,sq,e.selectorItem==null?null:e.selectorItem.contact))}}function dUe(i,o){i&1&&He(0)}function mUe(i,o){if(i&1&&(v(0),u(1,dUe,1,0,"ng-container",5),C()),i&2){l();let n=me(7),e=l();m(),d("ngTemplateOutlet",n)("ngTemplateOutletContext",A(2,sq,e.selectorItem==null?null:e.selectorItem.custom))}}function pUe(i,o){i&1&&He(0)}function gUe(i,o){if(i&1&&(v(0),u(1,pUe,1,0,"ng-container",5),C()),i&2){l();let n=me(9),e=l();m(),d("ngTemplateOutlet",n)("ngTemplateOutletContext",A(2,sq,e.selectorItem==null?null:e.selectorItem.group))}}function uUe(i,o){if(i&1&&(_(0,"p",8),te(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(),ye(" ",M(2,3,n.name||n.email)," ")}}function hUe(i,o){if(i&1&&(v(0),u(1,uUe,3,5,"p",7),C()),i&2){let n=l().$implicit,e=l().ngIf,t=l();m(),d("veltDynamicTemplate",$(4,lq,t.template,k(1,rUe,t.componentConfigSignal,n),e==null?null:e.variant,t.setIfCondition.bind(t),t.elementRef))}}function fUe(i,o){i&1&&w(0,"velt-skeleton-loader-internal",9)}function vUe(i,o){if(i&1&&u(0,hUe,2,10,"ng-container",6)(1,fUe,1,0,"ng-template",null,3,xe),i&2){let n=o.$implicit,e=me(2);d("ngIf",(n.name==null?null:n.name.length)>0||(n==null||n.email==null?null:n.email.length)>0)("ngIfElse",e)}}function CUe(i,o){if(i&1&&(_(0,"p",8),te(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(),ye(" ",M(2,3,n.name)," ")}}function _Ue(i,o){if(i&1&&(v(0),u(1,CUe,3,5,"p",7),C()),i&2){let n=l().$implicit,e=l().ngIf,t=l();m(),d("veltDynamicTemplate",$(4,lq,t.template,k(1,aUe,t.componentConfigSignal,n),e==null?null:e.variant,t.setIfCondition.bind(t),t.elementRef))}}function yUe(i,o){if(i&1&&u(0,_Ue,2,10,"ng-container",4),i&2){let n=o.$implicit;d("ngIf",(n.name==null?null:n.name.length)>0)}}function SUe(i,o){if(i&1&&(_(0,"p",8),te(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(),ye(" ",M(2,3,n==null||n.metadata==null?null:n.metadata.groupName)," ")}}function bUe(i,o){if(i&1&&(v(0),u(1,SUe,3,5,"p",7),C()),i&2){let n=l().$implicit,e=l().ngIf,t=l();m(),d("veltDynamicTemplate",$(4,lq,t.template,k(1,sUe,t.componentConfigSignal,n),e==null?null:e.variant,t.setIfCondition.bind(t),t.elementRef))}}function IUe(i,o){if(i&1&&u(0,bUe,2,10,"ng-container",4),i&2){let n=o.$implicit;d("ngIf",(n==null||n.metadata==null||n.metadata.groupName==null?null:n.metadata.groupName.length)>0)}}function EUe(i,o){if(i&1&&(v(0),u(1,cUe,2,4,"ng-container",4)(2,mUe,2,4,"ng-container",4)(3,gUe,2,4,"ng-container",4)(4,vUe,3,2,"ng-template",null,0,xe)(6,yUe,1,1,"ng-template",null,1,xe)(8,IUe,1,1,"ng-template",null,2,xe),C()),i&2){let n=l();m(),d("ngIf",(n.selectorItem==null?null:n.selectorItem.type)==="contact"),m(),d("ngIf",(n.selectorItem==null?null:n.selectorItem.type)==="custom"),m(),d("ngIf",(n.selectorItem==null?null:n.selectorItem.type)==="group")}}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-autocomplete-name",super.initializeComponentConfigSignal(new il)}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&&u(0,EUe,10,3,"ng-container",4),t&2&&d("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;white-space:nowrap}"],changeDetection:0});let i=o;return i})();var xUe=(i,o,n)=>({componentConfigSignal:i,isNewContact:o,selectorItem:n}),TUe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-autocomplete-option-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function DUe(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(),d("selectorItem",e.selectorItem)("componentConfigSignal",e.componentConfigSignal),m(),x("data-testid",e.componentId+"-details"),m(),d("selectorItem",e.selectorItem)("componentConfigSignal",e.componentConfigSignal),m(),d("selectorItem",e.selectorItem)("componentConfigSignal",e.componentConfigSignal),m(),d("selectorItem",e.selectorItem)("isNewContact",e.isNewContact)("componentConfigSignal",e.componentConfigSignal)}}function wUe(i,o){if(i&1&&(v(0),u(1,DUe,6,13,"div",1),C()),i&2){let n=o.ngIf,e=l();m(),d("veltDynamicTemplate",$(5,TUe,e.template,$e(1,xUe,e.componentConfigSignal,e.isNewContact,e.selectorItem),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}var WC=(()=>{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 il)}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(ze),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&&u(0,wUe,2,11,"ng-container",0),t&2&&d("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 hr=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 AUe=i=>({componentConfigSignal:i}),PUe=(i,o)=>({condition:i,data:o}),MUe=i=>({componentConfigSignal:i,type:"audio"}),kUe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-media-source-settings-audio-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function RUe(i,o){if(i&1&&(v(0),_(1,"div",5)(2,"div",6),ce(),_(3,"svg",7),w(4,"path",8),b()(),ht(),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),C()),i&2){let n=l(4);m(),x("aria-hidden","true"),m(4),d("componentConfigSignal",n.componentConfigSignal)("template",n.template),x("data-testid",n.componentId+"-label"),m(),d("componentConfigSignal",n.componentConfigSignal)("template",n.template),x("data-testid",n.componentId+"-toggle"),m(),d("componentConfigSignal",n.componentConfigSignal)("template",n.template),x("data-testid",n.componentId+"-divider"),m(),d("componentConfigSignal",n.componentConfigSignal)("template",n.template),x("data-testid",n.componentId+"-options")("role","listbox")("aria-label","Audio source options")}}function NUe(i,o){if(i&1){let n=K();_(0,"div",3),P(1,"translate"),W("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))}),u(2,RUe,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),d("veltDynamicTemplate",$(13,kUe,e.template,A(11,MUe,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function FUe(i,o){if(i&1&&(v(0),u(1,NUe,3,19,"div",2),C()),i&2){let n=l().ngIf;m(),d("ngIf",n.settingsVisible==null?null:n.settingsVisible.audio)}}function LUe(i,o){if(i&1&&(v(0),u(1,FUe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,PUe,n.conditionSignal(),A(1,AUe,n.componentConfigSignal)))}}var c2=(()=>{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 hr)}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&&u(0,LUe,2,6,"ng-container",0),t&2&&d("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 BUe=i=>({componentConfigSignal:i}),VUe=(i,o)=>({condition:i,data:o}),UUe=(i,o,n,e)=>({template:i,componentName:"velt-media-source-settings-divider-wireframe",variant:o,setIfCondition:n,componentElementRef:e});function jUe(i,o){if(i&1&&(v(0),w(1,"div",3),C()),i&2){let n=l(4);m(),x("data-testid",n.componentId+"-divider")("role","separator")("aria-orientation","horizontal")("aria-hidden","true")}}function $Ue(i,o){if(i&1&&(_(0,"div"),u(1,jUe,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(),d("veltDynamicTemplate",mt(3,UUe,e.template,n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function HUe(i,o){if(i&1&&(v(0),u(1,$Ue,2,8,"div",0),C()),i&2){let n=l().ngIf,e=l();m(),d("ngIf",e.type==="audio"?n.isAudioPermissionOpen:n.isVideoPermissionOpen)}}function zUe(i,o){if(i&1&&(v(0),u(1,HUe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,VUe,n.conditionSignal(),A(1,BUe,n.componentConfigSignal)))}}var qC=(()=>{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 hr)}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&&u(0,zUe,2,6,"ng-container",0),t&2&&d("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 GUe=i=>({componentConfigSignal:i}),WUe=(i,o)=>({condition:i,data:o}),qUe=(i,o,n,e)=>({template:i,componentName:"velt-media-source-settings-options-item-icon-wireframe",variant:o,setIfCondition:n,componentElementRef:e});function YUe(i,o){i&1&&(v(0),ce(),_(1,"svg",4),w(2,"path",5),b(),C())}function KUe(i,o){if(i&1&&(v(0),_(1,"div",2),u(2,YUe,3,0,"ng-container",3),b(),C()),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(),d("veltDynamicTemplate",mt(6,qUe,e.template,n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function ZUe(i,o){if(i&1&&(v(0),u(1,KUe,3,11,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,WUe,n.conditionSignal(),A(1,GUe,n.componentConfigSignal)))}}var d2=(()=>{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 hr)}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&&u(0,ZUe,2,6,"ng-container",0),t&2&&d("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 XUe=i=>({componentConfigSignal:i}),QUe=(i,o)=>({condition:i,data:o}),JUe=(i,o,n,e)=>({template:i,componentName:"velt-media-source-settings-options-item-label-wireframe",variant:o,setIfCondition:n,componentElementRef:e});function eje(i,o){if(i&1&&(v(0),_(1,"p"),P(2,"translate"),te(3),P(4,"translate"),b(),C()),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),ye(" ",M(4,8,e.device.label)," ")}}function tje(i,o){if(i&1&&(v(0),u(1,eje,5,10,"ng-container",2),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",mt(1,JUe,e.template,n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function nje(i,o){if(i&1&&(v(0),u(1,tje,2,6,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,QUe,n.conditionSignal(),A(1,XUe,n.componentConfigSignal)))}}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.type="audio",this.componentId="velt-media-source-settings-options-item-label",super.initializeComponentConfigSignal(new hr)}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&&u(0,nje,2,6,"ng-container",0),t&2&&d("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 ije=i=>({componentConfigSignal:i}),oje=(i,o)=>({condition:i,data:o}),rje=(i,o,n)=>({device:i,type:o,componentConfigSignal:n}),aje=(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 sje(i,o){if(i&1&&(v(0),w(1,"velt-media-source-settings-options-item-icon",7)(2,"velt-media-source-settings-options-item-label",7),C()),i&2){let n=l().$implicit,e=l(4);m(),d("device",n)("type",e.type)("componentConfigSignal",e.componentConfigSignal),x("data-testid",e.componentId+"-option-icon-"+n.deviceId),m(),d("device",n)("type",e.type)("componentConfigSignal",e.componentConfigSignal),x("data-testid",e.componentId+"-option-label-"+n.deviceId)}}function lje(i,o){if(i&1){let n=K();_(0,"div",5),W("click",function(){let t=N(n).$implicit,r=l(3).ngIf,a=l();return F(a.type==="audio"?r.selectAudioDevice(t):r.selectVideoDevice(t))}),u(1,sje,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(),d("veltDynamicTemplate",$(9,aje,t.optionTemplate,$e(5,rje,n,t.type,t.componentConfigSignal),e==null?null:e.variant,t.setIfCondition.bind(t),t.elementRef))}}function cje(i,o){if(i&1&&(_(0,"div",3),u(1,lje,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(),d("ngForOf",e.type==="audio"?n.audioDevices:n.videoDevices)}}function dje(i,o){if(i&1&&(v(0),u(1,cje,2,4,"div",2),C()),i&2){let n=l().ngIf,e=l();m(),d("ngIf",e.type==="audio"?n.isAudioPermissionOpen:n.isVideoPermissionOpen)}}function mje(i,o){if(i&1&&(v(0),u(1,dje,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,oje,n.conditionSignal(),A(1,ije,n.componentConfigSignal)))}}var YC=(()=>{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 hr)}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");qe(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&&u(0,mje,2,6,"ng-container",0),t&2&&d("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 pje=i=>({componentConfigSignal:i}),gje=(i,o)=>({condition:i,data:o}),uje=(i,o,n,e)=>({template:i,componentName:"velt-media-source-settings-selected-label-wireframe",variant:o,setIfCondition:n,componentElementRef:e});function hje(i,o){if(i&1&&(v(0),_(1,"p",3),te(2),P(3,"translate"),P(4,"translate"),P(5,"translate"),P(6,"translate"),b(),C()),i&2){let n,e=l(3);m(),x("data-testid",e.componentId+"-selected-device-label")("role","status")("aria-live","polite"),m(),ye(" ",e.type==="audio"?M(3,4,(n=e.componentConfigSignal().selectedAudioDevice)==null?null:n.label)??M(4,6,"No device found"):M(5,8,(n=e.componentConfigSignal().selectedVideoDevice)==null?null:n.label)??M(6,10,"No device found")," ")}}function fje(i,o){if(i&1&&(v(0),u(1,hje,7,12,"ng-container",2),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",mt(1,uje,e.template,n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function vje(i,o){if(i&1&&(v(0),u(1,fje,2,6,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,gje,n.conditionSignal(),A(1,pje,n.componentConfigSignal)))}}var KC=(()=>{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 hr)}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&&u(0,vje,2,6,"ng-container",0),t&2&&d("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 Cje=i=>({componentConfigSignal:i}),_je=(i,o)=>({condition:i,data:o}),yje=(i,o,n,e)=>({template:i,componentName:"velt-media-source-settings-toggle-icon-close-wireframe",variant:o,setIfCondition:n,componentElementRef:e});function Sje(i,o){if(i&1&&(v(0),ce(),_(1,"svg",3),w(2,"path",4),b(),C()),i&2){let n=l(4);m(),x("data-testid",n.componentId+"-toggle-icon")("aria-hidden","true")}}function bje(i,o){if(i&1&&(v(0),u(1,Sje,3,2,"ng-container",2),C()),i&2){let n=l(2).ngIf,e=l();m(),d("veltDynamicTemplate",mt(1,yje,e.template,n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function Ije(i,o){if(i&1&&(v(0),u(1,bje,2,6,"ng-container",0),C()),i&2){let n=l().ngIf,e=l();m(),d("ngIf",e.type==="audio"?!n.isAudioPermissionOpen:!n.isVideoPermissionOpen)}}function Eje(i,o){if(i&1&&(v(0),u(1,Ije,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,_je,n.conditionSignal(),A(1,Cje,n.componentConfigSignal)))}}var p2=(()=>{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 hr)}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&&u(0,Eje,2,6,"ng-container",0),t&2&&d("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 xje=i=>({componentConfigSignal:i}),Tje=(i,o)=>({condition:i,data:o}),Dje=(i,o,n,e)=>({template:i,componentName:"velt-media-source-settings-toggle-icon-open-wireframe",variant:o,setIfCondition:n,componentElementRef:e});function wje(i,o){if(i&1&&(v(0),ce(),_(1,"svg",3),w(2,"path",4),b(),C()),i&2){let n=l(4);m(),x("data-testid",n.componentId+"-toggle-icon-open")("aria-hidden","true")}}function Oje(i,o){if(i&1&&(v(0),u(1,wje,3,2,"ng-container",2),C()),i&2){let n=l(2).ngIf,e=l();m(),d("veltDynamicTemplate",mt(1,Dje,e.template,n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function Aje(i,o){if(i&1&&(v(0),u(1,Oje,2,6,"ng-container",0),C()),i&2){let n=l().ngIf,e=l();m(),d("ngIf",e.type==="audio"?n.isAudioPermissionOpen:n.isVideoPermissionOpen)}}function Pje(i,o){if(i&1&&(v(0),u(1,Aje,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,Tje,n.conditionSignal(),A(1,xje,n.componentConfigSignal)))}}var g2=(()=>{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 hr)}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&&u(0,Pje,2,6,"ng-container",0),t&2&&d("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 Mje=i=>({componentConfigSignal:i}),kje=(i,o)=>({condition:i,data:o}),Rje=(i,o)=>({componentConfigSignal:i,type:o}),Nje=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-media-source-settings-toggle-icon-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function Fje(i,o){if(i&1&&(v(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(),C()),i&2){let n=l(3);m(),x("data-testid",n.componentId+"-toggle-container")("role","presentation")("aria-hidden","true"),m(),d("componentConfigSignal",n.componentConfigSignal)("type",n.type)("template",n.template),x("data-testid",n.componentId+"-toggle-open"),m(),d("componentConfigSignal",n.componentConfigSignal)("type",n.type)("template",n.template),x("data-testid",n.componentId+"-toggle-close")}}function Lje(i,o){if(i&1&&(v(0),u(1,Fje,4,11,"ng-container",2),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(4,Nje,e.template,k(1,Rje,e.componentConfigSignal,e.type),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function Bje(i,o){if(i&1&&(v(0),u(1,Lje,2,10,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,kje,n.conditionSignal(),A(1,Mje,n.componentConfigSignal)))}}var ZC=(()=>{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 hr)}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&&u(0,Bje,2,6,"ng-container",0),t&2&&d("ngIf",r.componentConfigSignal())},encapsulation:2,changeDetection:0});let i=o;return i})();var Vje=i=>({componentConfigSignal:i}),Uje=(i,o)=>({condition:i,data:o}),jje=i=>({componentConfigSignal:i,type:"video"}),$je=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-media-source-settings-video-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function Hje(i,o){if(i&1&&(v(0),_(1,"div",5)(2,"div",6),ce(),_(3,"svg",7),w(4,"path",8)(5,"path",9),b()(),ht(),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),C()),i&2){let n=l(4);m(),x("aria-hidden","true"),m(5),d("componentConfigSignal",n.componentConfigSignal)("template",n.template),x("data-testid",n.componentId+"-label"),m(),d("componentConfigSignal",n.componentConfigSignal)("template",n.template),x("data-testid",n.componentId+"-toggle"),m(),d("componentConfigSignal",n.componentConfigSignal)("template",n.template),x("data-testid",n.componentId+"-divider"),m(),d("componentConfigSignal",n.componentConfigSignal)("template",n.template),x("data-testid",n.componentId+"-options")}}function zje(i,o){if(i&1){let n=K();_(0,"div",3),P(1,"translate"),W("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))}),u(2,Hje,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),d("veltDynamicTemplate",$(13,$je,e.template,A(11,jje,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function Gje(i,o){if(i&1&&(v(0),u(1,zje,3,19,"div",2),C()),i&2){let n=l().ngIf;m(),d("ngIf",n.settingsVisible==null?null:n.settingsVisible.video)}}function Wje(i,o){if(i&1&&(v(0),u(1,Gje,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,Uje,n.conditionSignal(),A(1,Vje,n.componentConfigSignal)))}}var u2=(()=>{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 hr)}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&&u(0,Wje,2,6,"ng-container",0),t&2&&d("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 lge=i=>({componentConfigSignal:i}),qje=(i,o)=>({condition:i,data:o}),Yje=(i,o,n,e,t)=>({template:i,context:o,cloneTemplate:!0,componentName:"velt-media-source-settings-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function Kje(i,o){i&1&&He(0)}function Zje(i,o){if(i&1&&(_(0,"velt-shadow-dom-internal"),u(1,Kje,1,0,"ng-container",4),b()),i&2){l();let n=me(3);m(),d("ngTemplateOutlet",n)}}function Xje(i,o){if(i&1&&(v(0),_(1,"div",8),w(2,"velt-media-source-settings-audio-internal",9)(3,"velt-media-source-settings-video-internal",9),b(),C()),i&2){let n=l(5);m(),x("role","group")("aria-label","Media settings controls"),m(),d("componentConfigSignal",n.componentConfigSignal),x("data-testid",n.componentId+"-audio")("role","region")("aria-label","Audio settings"),m(),d("componentConfigSignal",n.componentConfigSignal),x("data-testid",n.componentId+"-video")("role","region")("aria-label","Video settings")}}function Qje(i,o){if(i&1&&(_(0,"div",6),P(1,"translate"),u(2,Xje,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),d("veltDynamicTemplate",$(9,Yje,e.template,A(7,lge,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function Jje(i,o){if(i&1&&u(0,Qje,3,15,"div",5),i&2){let n=l(2).ngIf;d("ngIf",n.isOpen||n.settingsEmbedded)}}function e$e(i,o){if(i&1&&(v(0),u(1,Zje,2,1,"velt-shadow-dom-internal",3)(2,Jje,1,1,"ng-template",null,0,xe),C()),i&2){let n=me(3),e=l().ngIf,t=l();m(),d("ngIf",e.shadowDom&&!t.template)("ngIfElse",n)}}function t$e(i,o){if(i&1&&(v(0),u(1,e$e,4,2,"ng-container",2),C()),i&2){let n=l();m(),d("veltIf",k(3,qje,n.conditionSignal(),A(1,lge,n.componentConfigSignal)))}}var h2=(()=>{let o=class o extends H{constructor(e,t,r,a,s,c){super(a,s,e),this.loggingService=e,this.wireframeService=t,this.devicePermissionService=r,this.elementRef=a,this.dynamicDataService=s,this.recorderService=c,this.isOpen=!1,this.showMicSettings=!0,this.showCamSettings=!0,this.config={},this.shadowDom=!0,this.devices=[],this.defaultMediaSourceOptions=dd(),this.subscriptions=[],this.veltElement=!0,this.componentConfigSignal=Ee({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(g=>D(E({},g),{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=D(E({},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=>D(E({},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 Yn;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=>D(E({},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=>D(E({},a),{selectedAudioDevice:r}))}this.componentConfigSignal().selectedAudioDevice||this.componentConfigSignal.update(r=>D(E({},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=>D(E({},a),{selectedVideoDevice:r}))}this.componentConfigSignal().selectedVideoDevice||this.componentConfigSignal.update(r=>D(E({},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=>D(E({},t),{selectedAudioDevice:e})),this.saveChanges()}catch(t){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent selectAudioDevice: ",t)}}selectVideoDevice(e){try{this.componentConfigSignal.update(t=>D(E({},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(U.LOCAL_STORAGE.SNIPPYLY_DEFAULT_MEDIA_SOURCE_OPTIONS,JSON.stringify(e||{})),this.defaultMediaSourceOptions=dd(),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=>D(E({},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=D(E({},t),{isVideoPermissionOpen:!t.isVideoPermissionOpen}),t))}catch(t){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent toggleVideoPermission: ",t)}}closeVideoDropdown(){try{this.componentConfigSignal.update(e=>(e=D(E({},e),{isVideoPermissionOpen:!1}),e))}catch(e){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent closeVideoDropdown: ",e)}}closeAudioDropdown(){try{this.componentConfigSignal.update(e=>(e=D(E({},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(ze),h(_m),h(R),h(S),h(bn))},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&&u(0,t$e,2,6,"ng-container",1),t&2&&d("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 xn=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 n$e=i=>({componentConfigSignal:i}),i$e=(i,o)=>({condition:i,data:o}),o$e=(i,o)=>({componentConfigSignal:i,variant:o}),r$e=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-recording-preview-steps-dialog-audio-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function a$e(i,o){i&1&&He(0)}function s$e(i,o){if(i&1&&(_(0,"velt-shadow-dom-internal"),u(1,a$e,1,0,"ng-container",5),b()),i&2){l();let n=me(3);m(),d("ngTemplateOutlet",n)}}function l$e(i,o){if(i&1&&(v(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()(),C()),i&2){let n=l(5);m(),x("data-testid",n.componentId+"-overlay"),m(),x("data-testid",n.componentId+"-header"),m(),d("componentConfigSignal",n.componentConfigSignal)("template",n.template)("variant",n.variant),m(),d("componentConfigSignal",n.componentConfigSignal)("template",n.template)("variant",n.variant),m(),d("componentConfigSignal",n.componentConfigSignal),m(),x("data-testid",n.componentId+"-settings")("role","group")("aria-label","Recording settings"),m(),d("componentConfigSignal",n.componentConfigSignal),m(),d("componentConfigSignal",n.componentConfigSignal)("template",n.template)("variant",n.variant),m(),d("componentConfigSignal",n.componentConfigSignal)("template",n.template)("variant",n.variant),m(),d("componentConfigSignal",n.componentConfigSignal)("template",n.template)("variant",n.variant),m(),d("componentConfigSignal",n.componentConfigSignal)("template",n.template)("variant",n.variant),m(),d("componentConfigSignal",n.componentConfigSignal)("template",n.template)("variant",n.variant)}}function c$e(i,o){if(i&1){let n=K();_(0,"div",7,1),P(2,"translate"),W("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))}),u(3,l$e,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),d("veltDynamicTemplate",$(9,r$e,n.template,k(6,o$e,n.componentConfigSignal,n.variant),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function d$e(i,o){if(i&1&&u(0,c$e,4,15,"div",6),i&2){let n=l(2).ngIf;d("ngIf",n.type==="audio")}}function m$e(i,o){if(i&1&&(v(0),u(1,s$e,2,1,"velt-shadow-dom-internal",4)(2,d$e,1,1,"ng-template",null,0,xe),C()),i&2){let n=me(3),e=l().ngIf,t=l();m(),d("ngIf",e.shadowDom&&!t.template)("ngIfElse",n)}}function p$e(i,o){if(i&1&&(v(0),u(1,m$e,4,2,"ng-container",3),C()),i&2){let n=l();m(),d("veltIf",k(3,i$e,n.conditionSignal(),A(1,n$e,n.componentConfigSignal)))}}var f2=(()=>{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 xn)}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(ze),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&&u(0,p$e,2,6,"ng-container",2),t&2&&d("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){ .velt-mat-dialog-container.snippyly-recording-preview-steps-dialog{width:calc(1 * var(--legacy-velt-viewport-width));max-width:calc(1 * var(--legacy-velt-viewport-width))} .velt-mat-dialog-container.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))} .velt-mat-dialog-container.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))} .velt-mat-dialog-container.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 g$e=i=>({componentConfigSignal:i}),u$e=(i,o)=>({condition:i,data:o}),h$e=(i,o)=>({componentConfigSignal:i,variant:o}),f$e=(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 v$e(i,o){if(i&1&&(v(0),_(1,"div",5),ce(),_(2,"svg",6),w(3,"path",7),b()(),C()),i&2){let n=l(4);m(),x("data-testid",n.componentId+"-icon")}}function C$e(i,o){if(i&1){let n=K();_(0,"div",3),P(1,"translate"),W("click",function(){N(n);let t=l(2).ngIf;return F(t.closeDialog())}),u(2,v$e,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),d("veltDynamicTemplate",$(8,f$e,n.template,k(5,h$e,n.componentConfigSignal,n.variant),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function _$e(i,o){if(i&1&&(v(0),u(1,C$e,3,14,"div",2),C()),i&2){let n=l().ngIf;m(),d("ngIf",n.countdownStarted)}}function y$e(i,o){if(i&1&&(v(0),u(1,_$e,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,u$e,n.conditionSignal(),A(1,g$e,n.componentConfigSignal)))}}var v2=(()=>{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 xn)}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&&u(0,y$e,2,6,"ng-container",0),t&2&&d("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 S$e=i=>({componentConfigSignal:i}),b$e=(i,o)=>({condition:i,data:o}),I$e=(i,o)=>({componentConfigSignal:i,variant:o}),E$e=(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 x$e(i,o){if(i&1&&(_(0,"div",4),te(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(),ye(" ",n.countdown," ")}}function T$e(i,o){if(i&1&&(v(0),u(1,x$e,2,3,"div",3),C()),i&2){let n=l(2).ngIf;m(),d("ngIf",n.countdownStarted)}}function D$e(i,o){if(i&1&&(v(0),u(1,T$e,2,1,"ng-container",2),C()),i&2){let n=l(2);m(),d("veltDynamicTemplate",$(4,E$e,n.template,k(1,I$e,n.componentConfigSignal,n.variant),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function w$e(i,o){if(i&1&&(v(0),u(1,D$e,2,10,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,b$e,n.conditionSignal(),A(1,S$e,n.componentConfigSignal)))}}var C2=(()=>{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 xn)}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&&u(0,w$e,2,6,"ng-container",0),t&2&&d("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 O$e=i=>({componentConfigSignal:i}),A$e=(i,o)=>({condition:i,data:o}),cq=(i,o)=>({componentConfigSignal:i,variant:o}),dq=(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 P$e(i,o){if(i&1&&(v(0),_(1,"div",5),ce(),_(2,"svg",6),w(3,"path",7)(4,"path",8),b()(),C()),i&2){let n=l(5);m(),x("data-testid",n.componentId+"-video")}}function M$e(i,o){if(i&1&&(v(0),u(1,P$e,5,1,"ng-container",4),C()),i&2){let n=l(4);m(),d("veltDynamicTemplate",$(4,dq,n.template,k(1,cq,n.componentConfigSignal,n.variant),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function k$e(i,o){if(i&1&&(v(0),_(1,"div",9),ce(),_(2,"svg",6),w(3,"path",10),b()(),C()),i&2){let n=l(5);m(),x("data-testid",n.componentId+"-screen")}}function R$e(i,o){if(i&1&&(v(0),u(1,k$e,4,1,"ng-container",4),C()),i&2){let n=l(4);m(),d("veltDynamicTemplate",$(4,dq,n.template,k(1,cq,n.componentConfigSignal,n.variant),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function N$e(i,o){if(i&1&&(v(0),_(1,"div",11),ce(),_(2,"svg",6),w(3,"path",12),b()(),C()),i&2){let n=l(5);m(),x("data-testid",n.componentId+"-audio")}}function F$e(i,o){if(i&1&&(v(0),u(1,N$e,4,1,"ng-container",4),C()),i&2){let n=l(4);m(),d("veltDynamicTemplate",$(4,dq,n.template,k(1,cq,n.componentConfigSignal,n.variant),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function L$e(i,o){if(i&1&&(v(0)(1,2),_(2,"div"),u(3,M$e,2,10,"ng-container",3)(4,R$e,2,10,"ng-container",3)(5,F$e,2,10,"ng-container",3),b(),C()()),i&2){let n=l(2).ngIf,e=l();m(),d("ngSwitch",n.type),m(),ue("velt-recording-preview--recording-started",n.countdownStarted),x("data-testid",e.componentId),m(),d("ngSwitchCase","video"),m(),d("ngSwitchCase","screen"),m(),d("ngSwitchCase","audio")}}function B$e(i,o){if(i&1&&(v(0),u(1,L$e,6,7,"ng-container",0),C()),i&2){let n=l().ngIf,e=l();m(),d("ngIf",!e.type||e.type===n.type)}}function V$e(i,o){if(i&1&&(v(0),u(1,B$e,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,A$e,n.conditionSignal(),A(1,O$e,n.componentConfigSignal)))}}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-recording-preview-steps-dialog-bottom-panel-icon",super.initializeComponentConfigSignal(new xn)}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&&u(0,V$e,2,6,"ng-container",0),t&2&&d("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 U$e=i=>({componentConfigSignal:i}),j$e=(i,o)=>({condition:i,data:o}),$$e=(i,o)=>({componentConfigSignal:i,variant:o}),H$e=(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 z$e(i,o){if(i&1&&(_(0,"div",6),te(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(),ye(" ",M(2,5,"Starting recording in")," "),m(2),d("componentConfigSignal",n.componentConfigSignal)("template",n.template)("variant",n.variant)}}function G$e(i,o){if(i&1&&(v(0),_(1,"div",3),P(2,"translate"),w(3,"app-recording-preview-steps-dialog-bottom-panel-icon",4),u(4,z$e,4,7,"div",5),w(5,"app-recording-preview-steps-dialog-bottom-panel-close",4),b(),C()),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),d("componentConfigSignal",e.componentConfigSignal)("template",e.template)("variant",e.variant),m(),d("ngIf",n.countdownStarted),m(),d("componentConfigSignal",e.componentConfigSignal)("template",e.template)("variant",e.variant)}}function W$e(i,o){if(i&1&&(v(0),u(1,G$e,6,13,"ng-container",2),C()),i&2){let n=l(2);m(),d("veltDynamicTemplate",$(4,H$e,n.template,k(1,$$e,n.componentConfigSignal,n.variant),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function q$e(i,o){if(i&1&&(v(0),u(1,W$e,2,10,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,j$e,n.conditionSignal(),A(1,U$e,n.componentConfigSignal)))}}var XC=(()=>{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 xn)}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&&u(0,q$e,2,6,"ng-container",0),t&2&&d("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 Y$e=["*"],K$e=i=>({componentConfigSignal:i}),Z$e=(i,o)=>({condition:i,data:o}),X$e=(i,o)=>({componentConfigSignal:i,variant:o}),Q$e=(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 J$e(i,o){i&1&&(v(0),jt(1),C())}function eHe(i,o){if(i&1&&(_(0,"div",3),P(1,"translate"),u(2,J$e,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),d("veltDynamicTemplate",$(9,Q$e,n.template,k(6,X$e,n.componentConfigSignal,n.variant),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function tHe(i,o){if(i&1&&(v(0),u(1,eHe,3,15,"div",2),C()),i&2){let n=l().ngIf;m(),d("ngIf",!n.countdownStarted)}}function nHe(i,o){if(i&1&&(v(0),u(1,tHe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,Z$e,n.conditionSignal(),A(1,K$e,n.componentConfigSignal)))}}var QC=(()=>{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 xn)}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:Y$e,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&&(Ht(),u(0,nHe,2,6,"ng-container",0)),t&2&&d("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 iHe=i=>({componentConfigSignal:i}),oHe=(i,o)=>({condition:i,data:o}),rHe=(i,o)=>({componentConfigSignal:i,variant:o}),aHe=(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 sHe(i,o){if(i&1&&(v(0),ce(),_(1,"svg",3),w(2,"path",4)(3,"path",5),b(),C()),i&2){let n=l(4);m(),x("data-testid",n.componentId+"-icon")}}function lHe(i,o){if(i&1&&(v(0),u(1,sHe,4,1,"ng-container",2),C()),i&2){let n=l(3);m(),d("veltDynamicTemplate",$(4,aHe,n.template,k(1,rHe,n.componentConfigSignal,n.variant),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function cHe(i,o){if(i&1&&(v(0),u(1,lHe,2,10,"ng-container",0),C()),i&2){let n=l().ngIf;m(),d("ngIf",!(n.mediaConfig.video!=null&&n.mediaConfig.video.enabled))}}function dHe(i,o){if(i&1&&(v(0),u(1,cHe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,oHe,n.conditionSignal(),A(1,iHe,n.componentConfigSignal)))}}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-recording-preview-steps-dialog-camera-button-off",super.initializeComponentConfigSignal(new xn)}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&&u(0,dHe,2,6,"ng-container",0),t&2&&d("ngIf",r.componentConfigSignal())},styles:["[_nghost-%COMP%]{display:flex}"],changeDetection:0});let i=o;return i})();var mHe=i=>({componentConfigSignal:i}),pHe=(i,o)=>({condition:i,data:o}),gHe=(i,o)=>({componentConfigSignal:i,variant:o}),uHe=(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 hHe(i,o){if(i&1&&(v(0),ce(),_(1,"svg",3),w(2,"path",4)(3,"path",5),b(),C()),i&2){let n=l(4);m(),x("data-testid",n.componentId+"-icon")}}function fHe(i,o){if(i&1&&(v(0),u(1,hHe,4,1,"ng-container",2),C()),i&2){let n=l(3);m(),d("veltDynamicTemplate",$(4,uHe,n.template,k(1,gHe,n.componentConfigSignal,n.variant),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function vHe(i,o){if(i&1&&(v(0),u(1,fHe,2,10,"ng-container",0),C()),i&2){let n=l().ngIf;m(),d("ngIf",n.mediaConfig.video==null?null:n.mediaConfig.video.enabled)}}function CHe(i,o){if(i&1&&(v(0),u(1,vHe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,pHe,n.conditionSignal(),A(1,mHe,n.componentConfigSignal)))}}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-recording-preview-steps-dialog-camera-button-on",super.initializeComponentConfigSignal(new xn)}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&&u(0,CHe,2,6,"ng-container",0),t&2&&d("ngIf",r.componentConfigSignal())},styles:["[_nghost-%COMP%]{display:flex}"],changeDetection:0});let i=o;return i})();var _He=i=>({componentConfigSignal:i}),yHe=(i,o)=>({condition:i,data:o}),SHe=(i,o)=>({componentConfigSignal:i,variant:o}),bHe=(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 IHe(i,o){if(i&1&&(v(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(),C()),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(),d("componentConfigSignal",e.componentConfigSignal)("template",e.template)("variant",e.variant),m(),d("componentConfigSignal",e.componentConfigSignal)("template",e.template)("variant",e.variant)}}function EHe(i,o){if(i&1){let n=K();_(0,"app-device-permission-button",3)(1,"div",4),P(2,"translate"),P(3,"translate"),P(4,"translate"),W("click",function(){N(n);let t=l(2).ngIf;return F(t.toggleVideo())}),u(5,IHe,4,9,"ng-container",5),b()()}if(i&2){let n=l(2).ngIf,e=l();d("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),d("veltDynamicTemplate",$(15,bHe,e.template,k(12,SHe,e.componentConfigSignal,e.variant),e.variant,e.setIfCondition.bind(e),e.elementRef))}}function xHe(i,o){if(i&1&&(v(0),u(1,EHe,6,21,"app-device-permission-button",2),C()),i&2){let n=l().ngIf;m(),d("ngIf",n.type==="screen")}}function THe(i,o){if(i&1&&(v(0),u(1,xHe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,yHe,n.conditionSignal(),A(1,_He,n.componentConfigSignal)))}}var b2=(()=>{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 xn)}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(_m),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&&u(0,THe,2,6,"ng-container",0),t&2&&d("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 cge=i=>({componentConfigSignal:i}),DHe=(i,o)=>({condition:i,data:o}),wHe=(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 OHe(i,o){if(i&1&&(v(0),ce(),_(1,"svg",3),w(2,"path",4)(3,"path",5),b(),C()),i&2){let n=l(4);m(),x("data-testid",n.componentId+"-icon")}}function AHe(i,o){if(i&1&&(v(0),u(1,OHe,4,1,"ng-container",2),C()),i&2){let n=l(3);m(),d("veltDynamicTemplate",$(3,wHe,n.template,A(1,cge,n.componentConfigSignal),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function PHe(i,o){if(i&1&&(v(0),u(1,AHe,2,9,"ng-container",0),C()),i&2){let n=l().ngIf;m(),d("ngIf",!(n.mediaConfig.audio!=null&&n.mediaConfig.audio.enabled))}}function MHe(i,o){if(i&1&&(v(0),u(1,PHe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,DHe,n.conditionSignal(),A(1,cge,n.componentConfigSignal)))}}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-recording-preview-steps-dialog-mic-button-off",super.initializeComponentConfigSignal(new xn)}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&&u(0,MHe,2,6,"ng-container",0),t&2&&d("ngIf",r.componentConfigSignal())},styles:["[_nghost-%COMP%]{display:flex}"],changeDetection:0});let i=o;return i})();var dge=i=>({componentConfigSignal:i}),kHe=(i,o)=>({condition:i,data:o}),RHe=(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 NHe(i,o){if(i&1&&(v(0),ce(),_(1,"svg",3),w(2,"path",4),b(),C()),i&2){let n=l(4);m(),x("data-testid",n.componentId+"-icon")}}function FHe(i,o){if(i&1&&(v(0),u(1,NHe,3,1,"ng-container",2),C()),i&2){let n=l(3);m(),d("veltDynamicTemplate",$(3,RHe,n.template,A(1,dge,n.componentConfigSignal),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function LHe(i,o){if(i&1&&(v(0),u(1,FHe,2,9,"ng-container",0),C()),i&2){let n=l().ngIf;m(),d("ngIf",n.mediaConfig.audio==null?null:n.mediaConfig.audio.enabled)}}function BHe(i,o){if(i&1&&(v(0),u(1,LHe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,kHe,n.conditionSignal(),A(1,dge,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-mic-button-on",super.initializeComponentConfigSignal(new xn)}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&&u(0,BHe,2,6,"ng-container",0),t&2&&d("ngIf",r.componentConfigSignal())},styles:["[_nghost-%COMP%]{display:flex}"],changeDetection:0});let i=o;return i})();var VHe=i=>({componentConfigSignal:i}),UHe=(i,o)=>({condition:i,data:o}),jHe=(i,o)=>({componentConfigSignal:i,variant:o}),$He=(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 HHe(i,o){if(i&1&&(v(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(),C()),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(),d("componentConfigSignal",e.componentConfigSignal)("template",e.template)("variant",e.variant),m(),d("componentConfigSignal",e.componentConfigSignal)("template",e.template)("variant",e.variant)}}function zHe(i,o){if(i&1){let n=K();v(0),_(1,"app-device-permission-button",2)(2,"div",3),P(3,"translate"),P(4,"translate"),P(5,"translate"),W("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())}),u(6,HHe,4,9,"ng-container",4),b()(),C()}if(i&2){let n=l().ngIf,e=l();m(),d("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),d("veltDynamicTemplate",$(15,$He,e.template,k(12,jHe,e.componentConfigSignal,e.variant),e.variant,e.setIfCondition.bind(e),e.elementRef))}}function GHe(i,o){if(i&1&&(v(0),u(1,zHe,7,21,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,UHe,n.conditionSignal(),A(1,VHe,n.componentConfigSignal)))}}var JC=(()=>{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 xn)}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(_m),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&&u(0,GHe,2,6,"ng-container",0),t&2&&d("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 mge=i=>({componentConfigSignal:i}),WHe=(i,o)=>({condition:i,data:o}),qHe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-recording-preview-steps-dialog-settings-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function YHe(i,o){if(i&1&&(v(0),_(1,"div",5),ce(),_(2,"svg",6),w(3,"path",7)(4,"path",8),b()(),C()),i&2){let n=l(4);m(),x("data-testid",n.componentId+"-icon-container"),m(),x("data-testid",n.componentId+"-icon")}}function KHe(i,o){if(i&1){let n=K();_(0,"div",3),P(1,"translate"),P(2,"translate"),P(3,"translate"),W("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))}),u(4,YHe,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),d("veltDynamicTemplate",$(15,qHe,e.template,A(13,mge,e.componentConfigSignal),e.variant,e.setIfCondition.bind(e),e.elementRef))}}function ZHe(i,o){if(i&1&&(v(0),u(1,KHe,5,21,"div",2),C()),i&2){let n=l().ngIf;m(),d("ngIf",!n.countdownStarted)}}function XHe(i,o){if(i&1&&(v(0),u(1,ZHe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,WHe,n.conditionSignal(),A(1,mge,n.componentConfigSignal)))}}var e_=(()=>{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 xn)}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&&u(0,XHe,2,6,"ng-container",0),t&2&&d("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 pge=i=>({componentConfigSignal:i}),QHe=(i,o)=>({condition:i,data:o}),JHe=(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 eze(i,o){if(i&1&&(v(0),_(1,"div",4),te(2),P(3,"translate"),b(),C()),i&2){let n=l(3);m(),x("data-testid",n.componentId+"-label"),m(),ye(" ",M(3,2,"Start Recording"))}}function tze(i,o){if(i&1){let n=K();v(0),_(1,"div",2),W("click",function(){N(n);let t=l().ngIf;return F(t.startCountdown())}),u(2,eze,4,4,"ng-container",3),b(),C()}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(),d("veltDynamicTemplate",$(6,JHe,e.template,A(4,pge,e.componentConfigSignal),e.variant,e.setIfCondition.bind(e),e.elementRef))}}function nze(i,o){if(i&1&&(v(0),u(1,tze,3,12,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,QHe,n.conditionSignal(),A(1,pge,n.componentConfigSignal)))}}var t_=(()=>{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 xn)}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&&u(0,nze,2,6,"ng-container",0),t&2&&d("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 ize=i=>({componentConfigSignal:i}),oze=(i,o)=>({condition:i,data:o}),rze=(i,o)=>({componentConfigSignal:i,variant:o}),aze=(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 sze(i,o){if(i&1&&(v(0),_(1,"h1",5),P(2,"translate"),te(3),P(4,"translate"),b(),C()),i&2){let n=l(4);m(),x("data-testid",n.componentId+"-text")("aria-label",M(2,3,"Camera is off")),m(2),Ge(M(4,5,"Camera is off"))}}function lze(i,o){if(i&1&&(_(0,"div",3),u(1,sze,5,7,"ng-container",4),b()),i&2){let n=l(3);x("data-testid",n.componentId),m(),d("veltDynamicTemplate",$(5,aze,n.template,k(2,rze,n.componentConfigSignal,n.variant),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function cze(i,o){if(i&1&&(v(0),u(1,lze,2,11,"div",2),C()),i&2){let n=l().ngIf;m(),d("ngIf",!n.countdownStarted&&(!(n.mediaConfig.video!=null&&n.mediaConfig.video.enabled)||!n.mediaState.video.enabled))}}function dze(i,o){if(i&1&&(v(0),u(1,cze,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,oze,n.conditionSignal(),A(1,ize,n.componentConfigSignal)))}}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-recording-preview-steps-dialog-camera-off-message",super.initializeComponentConfigSignal(new xn)}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&&u(0,dze,2,6,"ng-container",0),t&2&&d("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 gge=i=>({componentConfigSignal:i}),mze=(i,o)=>({condition:i,data:o}),pze=(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 gze(i,o){if(i&1&&(v(0),_(1,"div",4),ce(),_(2,"svg",5),w(3,"path",6),b()(),C()),i&2){let n=l(3);m(),x("data-testid",n.componentId+"-icon-container"),m(),x("data-testid",n.componentId+"-icon")}}function uze(i,o){if(i&1){let n=K();v(0),_(1,"div",2),P(2,"translate"),W("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())}),u(3,gze,4,2,"ng-container",3),b(),C()}if(i&2){let n=l(2);m(),x("data-testid",n.componentId)("aria-label",M(2,3,"Close recording preview")),m(2),d("veltDynamicTemplate",$(7,pze,n.template,A(5,gge,n.componentConfigSignal),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function hze(i,o){if(i&1&&(v(0),u(1,uze,4,13,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,mze,n.conditionSignal(),A(1,gge,n.componentConfigSignal)))}}var n_=(()=>{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 xn)}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&&u(0,hze,2,6,"ng-container",0),t&2&&d("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 uge=i=>({componentConfigSignal:i}),fze=(i,o)=>({condition:i,data:o}),vze=(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 Cze(i,o){if(i&1&&(v(0),_(1,"div",4),te(2),P(3,"translate"),b(),C()),i&2){let n=l(3);m(),x("data-testid",n.componentId+"-label"),m(),ye(" ",M(3,2,"Cancel")," ")}}function _ze(i,o){if(i&1){let n=K();v(0),_(1,"div",2),W("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())}),u(2,Cze,4,4,"ng-container",3),b(),C()}if(i&2){let n=l(2);m(),x("data-testid",n.componentId+"-button"),m(),d("veltDynamicTemplate",$(4,vze,n.template,A(2,uge,n.componentConfigSignal),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function yze(i,o){if(i&1&&(v(0),u(1,_ze,3,10,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,fze,n.conditionSignal(),A(1,uge,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-timer-cancel",super.initializeComponentConfigSignal(new xn)}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&&u(0,yze,2,6,"ng-container",0),t&2&&d("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 hge=i=>({componentConfigSignal:i}),Sze=(i,o)=>({condition:i,data:o}),bze=(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 Ize(i,o){if(i&1&&(_(0,"h1",4),te(1),b()),i&2){let n=l(3).ngIf,e=l();x("data-testid",e.componentId+"-value"),m(),ye(" ",n.countdown)}}function Eze(i,o){if(i&1&&(v(0),u(1,Ize,2,2,"h1",3),C()),i&2){let n=l(2).ngIf;m(),d("ngIf",n.countdown)}}function xze(i,o){if(i&1&&(v(0),u(1,Eze,2,1,"ng-container",2),C()),i&2){let n=l(2);m(),d("veltDynamicTemplate",$(3,bze,n.template,A(1,hge,n.componentConfigSignal),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function Tze(i,o){if(i&1&&(v(0),u(1,xze,2,9,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,Sze,n.conditionSignal(),A(1,hge,n.componentConfigSignal)))}}var D2=(()=>{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 xn)}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&&u(0,Tze,2,6,"ng-container",0),t&2&&d("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 fge=i=>({componentConfigSignal:i}),Dze=(i,o)=>({condition:i,data:o}),wze=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-recording-preview-steps-dialog-timer-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function Oze(i,o){if(i&1&&(v(0),_(1,"div",3),w(2,"app-recording-preview-steps-dialog-timer-countdown",4)(3,"app-recording-preview-steps-dialog-timer-cancel",4),b(),C()),i&2){let n=l(4);m(),x("data-testid",n.componentId),m(),d("componentConfigSignal",n.componentConfigSignal)("template",n.template)("variant",n.variant),m(),d("componentConfigSignal",n.componentConfigSignal)("template",n.template)("variant",n.variant)}}function Aze(i,o){if(i&1&&(v(0),u(1,Oze,4,7,"ng-container",2),C()),i&2){let n=l(3);m(),d("veltDynamicTemplate",$(3,wze,n.template,A(1,fge,n.componentConfigSignal),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function Pze(i,o){if(i&1&&(v(0),u(1,Aze,2,9,"ng-container",0),C()),i&2){let n=l().ngIf;m(),d("ngIf",n.countdownStarted)}}function Mze(i,o){if(i&1&&(v(0),u(1,Pze,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,Dze,n.conditionSignal(),A(1,fge,n.componentConfigSignal)))}}var i_=(()=>{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 xn)}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&&u(0,Mze,2,6,"ng-container",0),t&2&&d("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 kze=i=>({componentConfigSignal:i}),Rze=(i,o)=>({condition:i,data:o}),Nze=(i,o)=>({componentConfigSignal:i,variant:o}),Fze=(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 Lze(i,o){if(i&1&&(v(0),w(1,"video",3),C()),i&2){let n=l(2).ngIf,e=l();m(),d("srcObject",n.mediaStream)("volume",0),x("data-testid",e.componentId)}}function Bze(i,o){if(i&1&&(v(0),u(1,Lze,2,3,"ng-container",2),C()),i&2){let n=l(2);m(),d("veltDynamicTemplate",$(4,Fze,n.template,k(1,Nze,n.componentConfigSignal,n.variant),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function Vze(i,o){if(i&1&&(v(0),u(1,Bze,2,10,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,Rze,n.conditionSignal(),A(1,kze,n.componentConfigSignal)))}}var w2=(()=>{let o=class o extends H{get isScreenStreamAvailable(){return!!this.componentConfigSignal()?.mediaConfig?.screen?.stream}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 xn)}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"]],hostVars:2,hostBindings:function(t,r){t&2&&ue("velt-recording-preview-steps-dialog-screen-available",r.isScreenStreamAvailable)},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","role","application","aria-live","polite",1,"flip","velt-recording-preview-video--player",3,"srcObject","volume"]],template:function(t,r){t&1&&u(0,Vze,2,6,"ng-container",0),t&2&&d("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%;position:relative}.velt-recording-preview-steps-dialog-screen-available[_nghost-%COMP%]{position:absolute;bottom:20px;left:20px}.velt-recording-preview-steps-dialog-screen-available[_nghost-%COMP%] video[_ngcontent-%COMP%]{width:150px;height:150px;object-fit:cover;border-radius:var(--velt-border-radius-full)}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 Uze=i=>({componentConfigSignal:i}),jze=(i,o)=>({condition:i,data:o}),$ze=()=>["video","screen"],Hze=(i,o)=>({componentConfigSignal:i,variant:o}),zze=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-recording-preview-steps-dialog-video-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function Gze(i,o){i&1&&He(0)}function Wze(i,o){if(i&1&&(_(0,"velt-shadow-dom-internal"),u(1,Gze,1,0,"ng-container",5),b()),i&2){l();let n=me(3);m(),d("ngTemplateOutlet",n)}}function qze(i,o){if(i&1&&(v(0),w(1,"app-recording-preview-steps-dialog-video-player",9)(2,"app-recording-preview-steps-dialog-screen-player",9),_(3,"div",10)(4,"div",11),w(5,"app-recording-preview-steps-dialog-waveform",9)(6,"app-recording-preview-steps-dialog-close-button",12),b(),w(7,"app-recording-preview-steps-dialog-timer",12)(8,"app-recording-preview-steps-dialog-camera-off-message",12),_(9,"div",13),w(10,"velt-recording-preview-steps-dialog-settings-panel-internal",9),_(11,"app-recording-preview-steps-dialog-button-panel",12),w(12,"app-recording-preview-steps-dialog-start-recording",12)(13,"velt-recording-preview-steps-dialog-mic-button-internal",12)(14,"velt-recording-preview-steps-dialog-camera-button-internal",12)(15,"app-recording-preview-steps-dialog-settings",12),b(),w(16,"app-recording-preview-steps-dialog-bottom-panel",12),b()(),C()),i&2){let n=l(5);m(),d("componentConfigSignal",n.componentConfigSignal),m(),d("componentConfigSignal",n.componentConfigSignal),m(),x("data-testid",n.componentId+"-overlay"),m(),x("data-testid",n.componentId+"-header"),m(),d("componentConfigSignal",n.componentConfigSignal),m(),d("componentConfigSignal",n.componentConfigSignal)("template",n.template)("variant",n.variant),m(),d("componentConfigSignal",n.componentConfigSignal)("template",n.template)("variant",n.variant),m(),d("componentConfigSignal",n.componentConfigSignal)("template",n.template)("variant",n.variant),m(),x("data-testid",n.componentId+"-settings"),m(),d("componentConfigSignal",n.componentConfigSignal),m(),d("componentConfigSignal",n.componentConfigSignal)("template",n.template)("variant",n.variant),m(),d("componentConfigSignal",n.componentConfigSignal)("template",n.template)("variant",n.variant),m(),d("componentConfigSignal",n.componentConfigSignal)("template",n.template)("variant",n.variant),m(),d("componentConfigSignal",n.componentConfigSignal)("template",n.template)("variant",n.variant),m(),d("componentConfigSignal",n.componentConfigSignal)("template",n.template)("variant",n.variant),m(),d("componentConfigSignal",n.componentConfigSignal)("template",n.template)("variant",n.variant)}}function Yze(i,o){if(i&1){let n=K();_(0,"div",7,1),W("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))}),u(2,qze,17,34,"ng-container",8),b()}if(i&2){let n=l(4);x("data-testid",n.componentId),m(2),d("veltDynamicTemplate",$(5,zze,n.template,k(2,Hze,n.componentConfigSignal,n.variant),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function Kze(i,o){if(i&1&&u(0,Yze,3,11,"div",6),i&2){let n=l(2).ngIf;d("ngIf",gt(1,$ze).includes(n.type))}}function Zze(i,o){if(i&1&&(v(0),u(1,Wze,2,1,"velt-shadow-dom-internal",4)(2,Kze,1,2,"ng-template",null,0,xe),C()),i&2){let n=me(3),e=l().ngIf,t=l();m(),d("ngIf",e.shadowDom&&!t.template)("ngIfElse",n)}}function Xze(i,o){if(i&1&&(v(0),u(1,Zze,4,2,"ng-container",3),C()),i&2){let n=l();m(),d("veltIf",k(3,jze,n.conditionSignal(),A(1,Uze,n.componentConfigSignal)))}}var O2=(()=>{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 xn)}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=D(E({},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(ze),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&&u(0,Xze,2,6,"ng-container",2),t&2&&d("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){ .velt-mat-dialog-container.snippyly-recording-preview-steps-dialog{width:calc(1 * var(--legacy-velt-viewport-width));max-width:calc(1 * var(--legacy-velt-viewport-width))} .velt-mat-dialog-container.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))} .velt-mat-dialog-container.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))} .velt-mat-dialog-container.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 vge=i=>({componentConfigSignal:i}),Qze=(i,o)=>({condition:i,data:o}),Jze=(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}),eGe=()=>["video","screen"];function tGe(i,o){if(i&1&&(v(0),w(1,"velt-media-source-settings-internal",3),P(2,"translate"),C()),i&2){let n=l(2).ngIf;m(),d("showMicSettings",!0)("shadowDom",n.shadowDom)("showCamSettings",gt(8,eGe).includes(n.type))("isOpen",n.isSettingsOpen)("config",n),x("aria-label",M(2,6,"Media source settings"))}}function nGe(i,o){if(i&1&&(v(0),u(1,tGe,3,9,"ng-container",2),C()),i&2){let n=l(2);m(),d("veltDynamicTemplate",$(3,Jze,n.template,A(1,vge,n.componentConfigSignal),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function iGe(i,o){if(i&1&&(v(0),u(1,nGe,2,9,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,Qze,n.conditionSignal(),A(1,vge,n.componentConfigSignal)))}}var o_=(()=>{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 xn)}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&&u(0,iGe,2,6,"ng-container",0),t&2&&d("ngIf",r.componentConfigSignal())},encapsulation:2,changeDetection:0});let i=o;return i})();var oGe=i=>({componentConfigSignal:i}),rGe=(i,o)=>({condition:i,data:o}),aGe=(i,o)=>({componentConfigSignal:i,variant:o}),sGe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-recording-preview-steps-dialog-waveform-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function lGe(i,o){if(i&1&&(v(0),w(1,"app-audio-waveform",3),C()),i&2){let n=l(2).ngIf,e=l();m(),d("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 cGe(i,o){if(i&1&&(v(0),u(1,lGe,2,4,"ng-container",2),C()),i&2){let n=l(2);m(),d("veltDynamicTemplate",$(4,sGe,n.template,k(1,aGe,n.componentConfigSignal,n.variant),n.variant,n.setIfCondition.bind(n),n.elementRef))}}function dGe(i,o){if(i&1&&(v(0),u(1,cGe,2,10,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,rGe,n.conditionSignal(),A(1,oGe,n.componentConfigSignal)))}}var r_=(()=>{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=Ee(null),this.componentId="velt-recording-preview-steps-dialog-waveform",super.initializeComponentConfigSignal(new xn)}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&&u(0,dGe,2,6,"ng-container",0),t&2&&d("ngIf",r.componentConfigSignal())},encapsulation:2,changeDetection:0});let i=o;return i})();var Cge=i=>({componentConfigSignal:i}),mGe=(i,o)=>({condition:i,data:o}),pGe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-text-comment-toolbar-comment-annotation-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function gGe(i,o){i&1&&(_(0,"div",5),ce(),_(1,"svg",6),w(2,"path",7),b()())}function uGe(i,o){if(i&1){let n=K();_(0,"div",3),P(1,"translate"),W("pointerdown",function(t){return N(n),l(2).ngIf.createAnnotation(),F(t.stopPropagation())}),u(2,gGe,3,0,"div",4),b()}if(i&2){let n=l(2).ngIf,e=l();x("data-testid",e.componentId)("role","button")("aria-label",M(1,5,"Add comment annotation"))("tabindex",n.commentToolEnabled?0:void 0),m(2),d("veltDynamicTemplate",$(9,pGe,e.template,A(7,Cge,e.componentConfigSignal),e.componentConfigSignal().variant,e.setIfCondition.bind(e),e.elementRef))}}function hGe(i,o){if(i&1&&(v(0),u(1,uGe,3,15,"div",2),C()),i&2){let n=l().ngIf;m(),d("ngIf",n.commentToolEnabled)}}function fGe(i,o){if(i&1&&(v(0),u(1,hGe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,mGe,n.conditionSignal(),A(1,Cge,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-comment-annotation",super.initializeComponentConfigSignal(new nl)}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")}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(Ye),h(we),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&&u(0,fGe,2,6,"ng-container",0),t&2&&d("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 _ge=i=>({componentConfigSignal:i}),vGe=(i,o)=>({condition:i,data:o}),CGe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-text-comment-toolbar-copywriter-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function _Ge(i,o){if(i&1&&(_(0,"div",11),te(1),P(2,"translate"),P(3,"translate"),b()),i&2){let n=l(3).ngIf;m(),ye(" ",n.selectedCharactersCount>n.MAX_ALLOWED_CHARACTERS_COUNT?M(2,1,"Select a shorter text"):M(3,3,"Select a longer text")," ")}}function yGe(i,o){if(i&1&&(_(0,"div",4),u(1,_Ge,4,5,"div",5),ce(),_(2,"svg",6)(3,"g",7),w(4,"path",8),b(),_(5,"defs")(6,"clipPath",9),w(7,"rect",10),b()()(),te(8),P(9,"translate"),b()),i&2){let n=l(2).ngIf;m(),d("ngIf",n.selectedWordsCount<n.MIN_ALLOWED_WORDS_COUNT||n.selectedCharactersCount<n.MIN_ALLOWED_CHARACTERS_COUNT||n.selectedCharactersCount>n.MAX_ALLOWED_CHARACTERS_COUNT),m(7),ye(" ",M(9,2,"Rewrite")," ")}}function SGe(i,o){if(i&1){let n=K();v(0),_(1,"div",2),P(2,"translate"),W("pointerdown",function(t){return N(n),l().ngIf.createRewriter("copywriter"),F(t.stopPropagation())}),u(3,yGe,10,4,"div",3),b(),C()}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",n.selectedWordsCount<n.MIN_ALLOWED_WORDS_COUNT||n.selectedCharactersCount<n.MIN_ALLOWED_CHARACTERS_COUNT||n.selectedCharactersCount>n.MAX_ALLOWED_CHARACTERS_COUNT?void 0: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),d("veltDynamicTemplate",$(12,CGe,e.template,A(10,_ge,e.componentConfigSignal),n.variant,e.setIfCondition.bind(e),e.elementRef))}}function bGe(i,o){if(i&1&&(v(0),u(1,SGe,4,18,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,vGe,n.conditionSignal(),A(1,_ge,n.componentConfigSignal)))}}var P2=(()=>{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 nl)}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");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(Ye),h(we),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&&u(0,bGe,2,6,"ng-container",0),t&2&&d("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 yge=i=>({componentConfigSignal:i}),IGe=(i,o)=>({condition:i,data:o}),EGe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-text-comment-toolbar-generic-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function xGe(i,o){if(i&1&&(_(0,"div",15),te(1),P(2,"translate"),P(3,"translate"),b()),i&2){let n=l(3).ngIf;m(),ye(" ",n.selectedCharactersCount>n.MAX_ALLOWED_CHARACTERS_COUNT?M(2,1,"Select a shorter text"):M(3,3,"Select a longer text")," ")}}function TGe(i,o){if(i&1&&(_(0,"div",4),u(1,xGe,4,5,"div",5),ce(),_(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(),te(11),P(12,"translate"),b()),i&2){let n=l(2).ngIf;m(),d("ngIf",n.selectedWordsCount<n.MIN_ALLOWED_WORDS_COUNT||n.selectedCharactersCount<n.MIN_ALLOWED_CHARACTERS_COUNT||n.selectedCharactersCount>n.MAX_ALLOWED_CHARACTERS_COUNT),m(10),ye(" ",M(12,2,"Ask ChatGPT")," ")}}function DGe(i,o){if(i&1){let n=K();v(0),_(1,"div",2),W("pointerdown",function(t){return N(n),l().ngIf.createRewriter("generic"),F(t.stopPropagation())}),u(2,TGe,13,4,"div",3),b(),C()}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(),d("veltDynamicTemplate",$(8,EGe,e.template,A(6,yge,e.componentConfigSignal),n.variant,e.setIfCondition.bind(e),e.elementRef))}}function wGe(i,o){if(i&1&&(v(0),u(1,DGe,3,14,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,IGe,n.conditionSignal(),A(1,yge,n.componentConfigSignal)))}}var M2=(()=>{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 nl)}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(Ye),h(we),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&&u(0,wGe,2,6,"ng-container",0),t&2&&d("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 OGe=i=>({componentConfigSignal:i}),AGe=(i,o)=>({condition:i,data:o}),PGe=i=>({componentConfig:i}),MGe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-text-comment-toolbar-divider-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function kGe(i,o){if(i&1&&(_(0,"div",3),ce(),_(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 RGe(i,o){if(i&1&&(v(0),u(1,kGe,3,3,"div",2),C()),i&2){let n=l(2).ngIf,e=l();m(),d("veltDynamicTemplate",$(3,MGe,e.template,A(1,PGe,n),n.variant,e.setIfCondition.bind(e),e.elementRef))}}function NGe(i,o){if(i&1&&(v(0),u(1,RGe,2,9,"ng-container",0),C()),i&2){let n=l().ngIf;m(),d("ngIf",n.commentToolEnabled)}}function FGe(i,o){if(i&1&&(v(0),u(1,NGe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,AGe,n.conditionSignal(),A(1,OGe,n.componentConfigSignal)))}}var k2=(()=>{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 nl)}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(Ye),h(we),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&&u(0,FGe,2,6,"ng-container",0),t&2&&d("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 Pp=class{constructor(){this.annotations=[],this.unresolvedAnnotationsCount=0,this.showAvatar=!0,this.unreadCount=0,this.readOnly=!1,this.commentCountType=WH.TOTAL,this.selectedAnnotationsMap={},this.customStatusesShown=!1,this.selectedAnnotationsLocationMap={},this.commentPinSelected=!1,this.groupMatchedComments=!1}};var LGe=i=>({componentConfigSignal:i}),BGe=(i,o)=>({condition:i,data:o}),VGe=(i,o)=>({componentConfigSignal:i,wireframe:o}),UGe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-bubble-avatar-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function jGe(i,o){if(i&1&&(v(0),w(1,"snippyly-user-avatar",3),C()),i&2){let n=l(3).ngIf,e=l();m(),d("user",n==null||n.annotation==null?null:n.annotation.from),x("data-testid",e.componentId+"-user")}}function $Ge(i,o){if(i&1&&(v(0),u(1,jGe,2,2,"ng-container",0),C()),i&2){let n=l(2).ngIf;m(),d("ngIf",(n==null?null:n.showAvatar)&&(n==null||n.annotation==null?null:n.annotation.from))}}function HGe(i,o){if(i&1&&(v(0),u(1,$Ge,2,1,"ng-container",2),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(4,UGe,e.template,k(1,VGe,e.componentConfigSignal,e.wireframe),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function zGe(i,o){if(i&1&&(v(0),u(1,HGe,2,10,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,BGe,n.conditionSignal(),A(1,LGe,n.componentConfigSignal)))}}var R2=(()=>{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 Pp)}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&&u(0,zGe,2,6,"ng-container",0),t&2&&d("ngIf",r.componentConfigSignal())},encapsulation:2,changeDetection:0});let i=o;return i})();var GGe=i=>({componentConfigSignal:i}),WGe=(i,o)=>({condition:i,data:o}),qGe=(i,o)=>({componentConfigSignal:i,wireframe:o}),YGe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-bubble-comments-count-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function KGe(i,o){if(i&1&&(v(0),te(1),C()),i&2){let n=l(2).ngIf;m(),ye(" ",(n==null?null:n.unresolvedAnnotationsCount)||0," ")}}function ZGe(i,o){if(i&1&&(v(0),u(1,KGe,2,1,"ng-container",1),C()),i&2){let n=l().ngIf;m(),d("ngIf",n==null?null:n.unresolvedAnnotationsCount)}}function XGe(i,o){if(i&1&&(v(0),te(1),C()),i&2){let n=l(2).ngIf;m(),ye(" ",n.commentCountType==="total"?(n==null||n.annotation==null||n.annotation.comments==null?null:n.annotation.comments.length)||0:n.unreadCount||0," ")}}function QGe(i,o){if(i&1&&u(0,XGe,2,1,"ng-container",1),i&2){let n=l().ngIf;d("ngIf",n.commentCountType==="total"&&(n==null||n.annotation==null||n.annotation.comments==null?null:n.annotation.comments.length)||n.commentCountType!=="total"&&n.unreadCount)}}function JGe(i,o){if(i&1&&(v(0),u(1,ZGe,2,1,"ng-container",4)(2,QGe,1,1,"ng-template",null,0,xe),C()),i&2){let n=o.ngIf,e=me(3);m(),d("ngIf",(n==null||n.annotation==null?null:n.annotation.type)==="multiThread")("ngIfElse",e)}}function eWe(i,o){if(i&1&&(v(0),u(1,JGe,4,2,"ng-container",1),C()),i&2){let n=l(3);m(),d("ngIf",n.componentConfigSignal())}}function tWe(i,o){if(i&1&&(v(0),u(1,eWe,2,1,"ng-container",3),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(4,YGe,e.template,k(1,qGe,e.componentConfigSignal,e.wireframe),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function nWe(i,o){if(i&1&&(v(0),u(1,tWe,2,10,"ng-container",2),C()),i&2){let n=l();m(),d("veltIf",k(3,WGe,n.conditionSignal(),A(1,GGe,n.componentConfigSignal)))}}var N2=(()=>{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 Pp)}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&&u(0,nWe,2,6,"ng-container",1),t&2&&d("ngIf",r.componentConfigSignal())},styles:["[_nghost-%COMP%]:empty{display:none}"],changeDetection:0});let i=o;return i})();var Sge=(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=Sge(e,o);if(t!==void 0)return t}return}catch(n){et.catch("Error in utils findInjectionPointByAttribute: ",n)}},bge=(i,o,n)=>{try{let e=Sge(i,o);if(e===void 0)return;let t=e.getAttribute(o);if(t===null)return;if(Object.values(U.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){et.catch("Error in utils injectAttributeData: ",e)}},a_=i=>{let o={};return i.from?.photoUrl?o[U.INJECTION_ATTRIBUTES.VELT_AVATAR_IMG]=i.from?.photoUrl:o[U.INJECTION_ATTRIBUTES.VELT_AVATAR_IMG]=null,i.priority?o[U.INJECTION_STYLE_PROPS.VELT_COMMENT_PRIORITY_COLOR]=i.priority.color:o[U.INJECTION_STYLE_PROPS.VELT_COMMENT_PRIORITY_COLOR]=null,i.from?.color?o[U.INJECTION_STYLE_PROPS.VELT_AVATAR_COLOR]=i.from?.color:o[U.INJECTION_STYLE_PROPS.VELT_AVATAR_COLOR]=null,o[U.INJECTION_ATTRIBUTES.VELT_COMMENT_LENGTH]=i.comments?.length||0,o};var J9=(()=>{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))bge(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 Ige=i=>({componentConfigSignal:i}),iWe=(i,o)=>({condition:i,data:o}),oWe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-bubble-wireframe",variant:n,setIfCondition:e,componentElementRef:t}),rWe=(i,o,n)=>({"velt-comment-pin--status-default":i,"velt-comment-pin--status-ongoing":o,"velt-comment-pin--status-terminal":n});function aWe(i,o){i&1&&He(0)}function sWe(i,o){if(i&1&&(_(0,"velt-shadow-dom-internal"),u(1,aWe,1,0,"ng-container",2),b()),i&2){l();let n=me(2);m(),d("ngTemplateOutlet",n)}}function lWe(i,o){if(i&1&&(v(0),_(1,"div",8),ce(),_(2,"svg",9),w(3,"path",10),b(),ht(),w(4,"app-comment-bubble-comments-count",11),P(5,"translate"),b(),w(6,"app-comment-bubble-avatar",12),P(7,"translate"),C()),i&2){let n=l(3).ngIf,e=l(2);m(),at("--velt-internal-comment-pin-bg-color",(n.annotation==null||n.annotation.status==null?null:n.annotation.status.color)||"var(--velt-accent, #625DF5)"),d("ngClass",$e(16,rWe,!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),d("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),d("componentConfigSignal",e.componentConfigSignal),x("data-testid",e.componentId+"-avatar")("aria-label",M(7,14,"Avatar for comment author"))}}function cWe(i,o){if(i&1){let n=K();v(0),_(1,"velt-comment-dialog-portal-internal",5),W("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),W("click",function(t){return N(n),F(t.stopPropagation())})("pointerup",function(t){return N(n),l(4).togglePinSelection(),F(t.stopPropagation())}),u(3,lWe,8,20,"ng-container",7),b()(),C()}if(i&2){let n=l(2).ngIf,e=l(2);m(),d("annotation",n.annotation)("context",n.context)("commentPinType","bubble")("commentPinSelected",n.commentPinSelected)("commentBubbleTargetPinHover",e.commentBubbleTargetPinHover)("targetElement",e.targetElement)("readOnly",n.readOnly)("commentBubbleElementRef",e.elementRef)("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(),d("veltDynamicTemplate",$(19,oWe,e.template,A(17,Ige,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function dWe(i,o){if(i&1&&(v(0),u(1,cWe,4,25,"ng-container",3),C()),i&2){let n=l().ngIf;m(),d("ngIf",n.annotation)}}function mWe(i,o){if(i&1&&(v(0),u(1,dWe,2,1,"ng-container",4),C()),i&2){let n=l(2);m(),d("veltIf",k(3,iWe,n.conditionSignal(),A(1,Ige,n.componentConfigSignal)))}}function pWe(i,o){if(i&1&&u(0,mWe,2,6,"ng-container",3),i&2){let n=l();d("ngIf",n.componentConfigSignal())}}var s_=(()=>{let o=class o extends J9{set _targetCommentElementId(e){try{this.targetElementId=e}catch{}}set _commentCountType(e){try{this.componentConfigSignal.update(t=>(t=D(E({},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=D(E({},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=D(E({},r),{showAvatar:!!t}),r))}catch(t){this.catchError("Error in CommentBubbleComponent showAvatar setter: ",t)}}set _folderId(e){try{this.componentConfigSignal.update(t=>(t=D(E({},t),{folderId:e}),t?.folderId?t.veltFolderId=$i(t.folderId):t.veltFolderId=void 0,t)),this.checkCommentAnnotationAvailable()}catch{}}set _clientDocumentId(e){try{this.componentConfigSignal.update(t=>(t=D(E({},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=D(E({},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=D(E({},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=D(E({},r),{contextOptions:t}),r))}catch{}}set readOnly(e){try{let t=e;typeof e=="string"&&(t=JSON.parse(e)),this.componentConfigSignal.update(r=>(r=D(E({},r),{readOnly:!!t}),r))}catch{}}constructor(e,t,r,a,s,c,p,g){super(p,g,s),this.authService=e,this.commentService=t,this.docService=r,this.domService=a,this.loggingService=s,this.wireframeService=c,this.elementRef=p,this.dynamicDataService=g,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=Ee(new Pp),this.subscriptions=[],this.veltElement=!0,this.componentId="velt-comment-bubble",this.uniqueComponentId="velt-comment-bubble-"+vt(),super.initializeComponentConfigSignal(new Pp);try{this.multiThreadAnnotationId=`temp_${this.uniqueComponentId}`,this.subscriptions.push(this.authService.getUser$().subscribe(f=>{this.user=f},f=>{this.catchError("Error in CommentBubbleComponent getUser$ subscription: ",f)})),this.subscriptions.push(this.commentService.getUnreadCommentsMap$().subscribe(f=>{this.componentConfigSignal.update(I=>(I=D(E({},I),{unreadCount:f?.[this.componentConfigSignal().annotation?.annotationId||""]||0}),I))})),this.subscriptions.push(this.domService.getSelectedAnnotationsLocationMap$().subscribe(f=>{this.componentConfigSignal.update(I=>(I=D(E({},I),{selectedAnnotationsLocationMap:f}),I)),this.checkCommentPinSelected()})),this.subscriptions.push(this.commentService.getCustomStatusesShown$().subscribe(f=>{this.componentConfigSignal.update(I=>(I=D(E({},I),{customStatusesShown:f}),I))})),this.subscriptions.push(this.commentService.getGroupMatchedComments$().subscribe(f=>{this.componentConfigSignal.update(I=>(I=D(E({},I),{groupMatchedComments:f}),I))})),this.subscriptions.push(this.domService.getSelectedAnnotationsMap$().subscribe(f=>{this.selectedAnnotationsMap=f,this.componentConfigSignal.update(I=>(I=D(E({},I),{selectedAnnotationsMap:f}),I)),this.checkCommentPinSelected()},f=>{this.catchError("Error in CommentBubbleComponent getSelectedAnnotationsMap$ subscription: ",f)}))}catch(f){this.catchError("Error in CommentBubbleComponent constructor: ",f)}}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,a_(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(fe(r=>this.domService.getSelectedAnnotationsMap$().pipe(de(a=>(this.selectedAnnotationsMap=a,r)))),fe(r=>this.commentService.getResolvedCommentsOnDom$().pipe(de(a=>(this.resolvedCommentsOnDom=a,r))))).subscribe(r=>{let a=this.resolvedCommentsOnDom||this.componentConfigSignal().groupMatchedComments?r?.slice():r?.filter(g=>g.status.type!=="terminal"),s=null,c=!1;if(a?.length&&this.componentConfigSignal().groupMatchedComments&&(c=a?.length>1||!a?.[0]?.isDraft),c){s=new AC,s.annotationId=this.multiThreadAnnotationId,s.isTemporary=!0,s.from=a?.[0]?.from,s.metadata=a?.[0]?.metadata;let g,f=this.componentConfigSignal().locationId;f&&(g=this.docService.getLocationByClientLocationId(f),g||(g={id:f}));let I;g&&(I=this.docService.genarateLocationId(g)),g&&I&&(s.location=g,s.locationId=I),this.componentConfigSignal().context&&(s.context=this.componentConfigSignal().context),this.targetElementId&&(s.targetElementId=this.targetElementId),s.commentAnnotationsMap={},s.commentAnnotations={};for(let T of a||[])T.annotationId&&(s.commentAnnotationsMap||(s.commentAnnotationsMap={}),s.commentAnnotationsMap[T.annotationId]=T,s.commentAnnotations||(s.commentAnnotations={}),s.commentAnnotations[T.annotationId]=!0)}let p=a?.length?a[a?.length-1]:null;s&&(p=s),this.componentConfigSignal.update(g=>(g=D(E({},g),{annotation:p,annotations:a||[]}),g.unresolvedAnnotationsCount=a?.filter(f=>f.status.type!=="terminal")?.length||0,g)),this.resolvedCommentsOnDom||this.componentConfigSignal().annotation?.status?.type!=="terminal"||this.selectedAnnotationsMap[this.componentConfigSignal().annotation?.annotationId]||this.componentConfigSignal.update(g=>(g=D(E({},g),{annotation:null}),g)),this.componentConfigSignal().annotation!==null&&this.customContentRef!==void 0&&this.injectAttributeData(this.customContentRef,a_(this.componentConfigSignal().annotation)),this.veltAnnotationId=this.componentConfigSignal().annotation?.annotationId,this.veltAnnotationIds=r?.map(g=>g?.annotationId).join(","),this.commentService.addBubbleCommentAnnotationIds(r?.map(g=>g?.annotationId)||[]),this.checkCommentPinSelected(),setTimeout(()=>{this.commentService.addBubbleCommentAnnotationIds(r?.map(g=>g?.annotationId)||[])},100)},r=>{this.catchError("Error in CommentBubbleComponent getCommentAnnotationAvailableOnXPath subscription: ",r)}):(this.targetElement=void 0,this.componentConfigSignal.update(r=>(r=D(E({},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){let c;if((this.componentConfigSignal().folderId||this.componentConfigSignal().clientDocumentId||this.componentConfigSignal().locationId||this.componentConfigSignal().context)&&(c=this.commentService.generateComponentIdFromObject({folderId:this.componentConfigSignal().folderId,clientDocumentId:this.componentConfigSignal().clientDocumentId,locationId:this.componentConfigSignal().locationId,context:this.componentConfigSignal().context})),t?.isDraft){let p=r?.[t.annotationId];c&&p?s=p===c:t?.sourceId&&(s=t?.sourceId===a,s&&this.domService.setSelectedAnnotationLocation(t.annotationId,this.componentId))}else{let p=r?.[t.annotationId];p&&(s=p===this.componentId,!s&&c&&(s=p===c))}}s!==this.componentConfigSignal().commentPinSelected&&this.componentConfigSignal.update(c=>(c=D(E({},c),{commentPinSelected:s}),c))}}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(`[${U.ATTRIBUTES.VELT_ANNOTATION_DRAFT}="${t.annotationId}"]`)?this.domService.resetSelectedAnnotationsMap(!0,"comments"):this.domService.toggleAnnotationSelection(t,this.componentId);else{let r=document.querySelector(`[${U.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);if(r||(r=(this.domService.getDraftCommentAnnotationDialogs()||[])[0]),r){let a=r.getAttribute(U.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,D(E({},r||{}),{annotationId:this.componentConfigSignal()?.annotation?.annotationId}))}catch{}}};o.\u0275fac=function(t){return new(t||o)(h(je),h(we),h(rt),h(Le),h(y),h(ze),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"],readOnly:"readOnly"},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","readOnly","commentBubbleElementRef","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&&u(0,sWe,2,1,"velt-shadow-dom-internal",1)(1,pWe,1,1,"ng-template",null,0,xe),t&2){let a=me(2);d("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.showReplyComposer=!1,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.attachmentNameInMessage=!1,this.isPrivateComment=!1,this.isUserAdmin=!1,this.isPrivateCommentAllowed=!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.linkCallback=!1,this.readOnly=!1,this.dialogSelection=!0,this.expandOnSelection=!0,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 Zo,this.user=new zo,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=of.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 Ege=i=>({componentConfigSignal:i}),gWe=(i,o)=>({condition:i,data:o}),uWe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-all-comment-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function hWe(i,o){if(i&1&&(_(0,"div",5),P(1,"translate"),ce(),_(2,"svg",6),w(3,"path",7)(4,"path",8),b(),ht(),_(5,"div",9),te(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(),ye(" ",M(7,9,"All comments"))}}function fWe(i,o){if(i&1){let n=K();_(0,"div",3),W("click",function(t){N(n);let r=l(2).ngIf;return r==null||r.openAllComments(),F(t.stopPropagation())}),u(1,hWe,8,11,"div",4),b()}if(i&2){let n=l(2).ngIf,e=l();x("data-testid",e.componentId),m(),d("veltDynamicTemplate",$(4,uWe,e.template,A(2,Ege,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function vWe(i,o){if(i&1&&(v(0),u(1,fWe,2,10,"div",2),C()),i&2){let n=l().ngIf;m(),d("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 CWe(i,o){if(i&1&&(v(0),u(1,vWe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,gWe,n.conditionSignal(),A(1,Ege,n.componentConfigSignal)))}}var l_=(()=>{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&&u(0,CWe,2,6,"ng-container",0),t&2&&d("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 xge=i=>({componentConfigSignal:i}),yWe=(i,o)=>({condition:i,data:o}),SWe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-approve-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function bWe(i,o){if(i&1&&(v(0),w(1,"div",5),_(2,"div",6),te(3),P(4,"translate"),b(),C()),i&2){let n=l(4);m(),x("data-testid",n.componentId+"-fill"),m(),x("data-testid",n.componentId+"-label"),m(),ye(" ",M(4,3,"Approve"))}}function IWe(i,o){if(i&1){let n=K();_(0,"div",3),P(1,"translate"),W("click",function(t){N(n);let r=l(2).ngIf;return r==null||r.approveCommentPinAnnotation(),F(t.stopPropagation())}),u(2,bWe,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),d("veltDynamicTemplate",$(8,SWe,e.template,A(6,xge,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function EWe(i,o){if(i&1&&(v(0),u(1,IWe,3,14,"ng-template",2),C()),i&2){let n=l().ngIf;m(),d("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 xWe(i,o){if(i&1&&(v(0),u(1,EWe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,yWe,n.conditionSignal(),A(1,xge,n.componentConfigSignal)))}}var c_=(()=>{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&&u(0,xWe,2,6,"ng-container",0),t&2&&d("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 Tge=i=>({componentConfigSignal:i}),DWe=(i,o)=>({condition:i,data:o}),wWe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-assign-menu-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function OWe(i,o){if(i&1){let n=K();v(0),_(1,"velt-autocomplete-panel-internal",5),P(2,"translate"),P(3,"translate"),W("optionSelected",function(t){N(n);let r=l(3).ngIf;return F(r==null?null:r.assignCommentToUser(t))}),b(),C()}if(i&2){let n=l(3).ngIf,e=l();m(),d("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 AWe(i,o){if(i&1){let n=K();_(0,"div",3),P(1,"translate"),W("clickOutside",function(){N(n);let t=l(2).ngIf;return F(t==null?null:t.closeAssignToMenu())}),u(2,OWe,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),d("veltDynamicTemplate",$(8,wWe,e.template,A(6,Tge,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function PWe(i,o){if(i&1&&(v(0),u(1,AWe,3,14,"div",2),C()),i&2){let n=l().ngIf;m(),d("ngIf",n==null?null:n.assignToMenuOpened)}}function MWe(i,o){if(i&1&&(v(0),u(1,PWe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,DWe,n.conditionSignal(),A(1,Tge,n.componentConfigSignal)))}}var F2=(()=>{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&&u(0,MWe,2,6,"ng-container",0),t&2&&d("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 Dge=i=>({componentConfigSignal:i}),kWe=(i,o)=>({condition:i,data:o}),RWe=(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 NWe(i,o){if(i&1&&(ce(),_(0,"svg",4),w(1,"path",5),b()),i&2){let n=l(4);x("data-testid",n.componentId+"-icon")}}function FWe(i,o){if(i&1){let n=K();v(0),_(1,"app-resolve-button",2),W("changeStatus",function(t){N(n);let r=l(2).ngIf;return F(r==null?null:r.changeStatus(t))}),u(2,NWe,2,1,"svg",3),b(),C()}if(i&2){let n=l(2).ngIf,e=l();m(),d("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(),d("veltDynamicTemplate",$(8,RWe,e.template,A(6,Dge,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function LWe(i,o){if(i&1&&(v(0),u(1,FWe,3,14,"ng-container",0),C()),i&2){let n=l().ngIf;m(),d("ngIf",n==null?null:n.canResolveAnnotation)}}function BWe(i,o){if(i&1&&(v(0),u(1,LWe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,kWe,n.conditionSignal(),A(1,Dge,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-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&&u(0,BWe,2,6,"ng-container",0),t&2&&d("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 wge=i=>({componentConfigSignal:i}),VWe=(i,o)=>({condition:i,data:o}),UWe=(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 jWe(i,o){if(i&1&&(v(0),w(1,"snippyly-user-avatar",3),P(2,"translate"),C()),i&2){let n=l(2).ngIf,e=l();m(),d("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 $We(i,o){if(i&1&&(v(0),u(1,jWe,3,6,"ng-container",2),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(3,UWe,e.template,A(1,wge,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function HWe(i,o){if(i&1&&(v(0),u(1,$We,2,9,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,VWe,n.conditionSignal(),A(1,wge,n.componentConfigSignal)))}}var B2=(()=>{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&&u(0,HWe,2,6,"ng-container",0),t&2&&d("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 Oge=i=>({componentConfigSignal:i}),zWe=(i,o)=>({condition:i,data:o}),GWe=(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 WWe(i,o){if(i&1&&(_(0,"div",5),P(1,"translate"),te(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),ye(" ",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 qWe(i,o){if(i&1&&(v(0),u(1,WWe,4,7,"div",4),C()),i&2){let n=l(2).ngIf,e=me(3);m(),d("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 YWe(i,o){if(i&1&&(v(0),u(1,qWe,2,2,"ng-container",3),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(3,GWe,e.template,A(1,Oge,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function KWe(i,o){i&1&&w(0,"velt-skeleton-loader-internal",6)}function ZWe(i,o){if(i&1&&(v(0),u(1,YWe,2,9,"ng-container",2)(2,KWe,1,0,"ng-template",null,0,xe),C()),i&2){let n=l();m(),d("veltIf",k(3,zWe,n.conditionSignal(),A(1,Oge,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.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&&u(0,ZWe,4,6,"ng-container",1),t&2&&d("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 Age=i=>({componentConfigSignal:i}),XWe=(i,o)=>({condition:i,data:o}),QWe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-assignee-banner-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function JWe(i,o){if(i&1&&(v(0),w(1,"app-comment-dialog-assignee-banner-resolve-button",7)(2,"app-comment-dialog-assignee-banner-unresolve-button",8),C()),i&2){let n=l(5);m(),d("componentConfigSignal",n.componentConfigSignal),m(),d("componentConfigSignal",n.componentConfigSignal)}}function eqe(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),te(5),P(6,"translate"),b(),w(7,"app-comment-dialog-assignee-banner-user-name",4),b(),u(8,JWe,3,2,"ng-container",0),b()),i&2){let n=l(3).ngIf,e=l();at("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),d("componentConfigSignal",e.componentConfigSignal),m(),x("data-testid",e.componentId+"-author"),m(2),Ge(M(6,19,"Assigned to:")),m(2),d("componentConfigSignal",e.componentConfigSignal),m(),d("ngIf",!(n!=null&&n.readOnly))}}function tqe(i,o){if(i&1&&(v(0),u(1,eqe,9,21,"div",2),C()),i&2){let n=l(2).ngIf,e=l();m(),d("veltDynamicTemplate",$(3,QWe,e.template,A(1,Age,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function nqe(i,o){if(i&1&&(v(0),u(1,tqe,2,9,"ng-container",0),C()),i&2){let n=l().ngIf;m(),d("ngIf",(n==null||n.annotation==null?null:n.annotation.assignedTo)&&!(n!=null&&n.inlineCommentMode))}}function iqe(i,o){if(i&1&&(v(0),u(1,nqe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,XWe,n.conditionSignal(),A(1,Age,n.componentConfigSignal)))}}var d_=(()=>{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&&u(0,iqe,2,6,"ng-container",0),t&2&&d("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 rqe=["commentContainer"],aqe=i=>({componentConfigSignal:i}),sqe=(i,o)=>({condition:i,data:o}),lqe=(i,o)=>({componentConfigSignal:i,wireframe:o}),cqe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-body-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function dqe(i,o){if(i&1&&(v(0),w(1,"app-comment-dialog-reply-avatars",9),C()),i&2){let n=l(5);m(),d("componentConfigSignal",n.componentConfigSignal)}}function mqe(i,o){if(i&1&&(v(0),w(1,"app-comment-dialog-hide-reply",9),C()),i&2){let n=l(5);m(),d("componentConfigSignal",n.componentConfigSignal),x("data-testid",n.componentId+"-toggle-collapsed")}}function pqe(i,o){if(i&1){let n=K();_(0,"div",6),W("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),_(2,"div",8),u(3,dqe,2,1,"ng-container",1),w(4,"app-comment-dialog-toggle-reply",9),u(5,mqe,2,2,"ng-container",1),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(),d("componentConfigSignal",e.componentConfigSignal)("wireframe",e.wireframe),x("data-testid",e.componentId+"-threads"),m(),ue("velt-comment-dialog-body--reply-avatars-inline-mode",n.inlineCommentSectionMode),m(),d("ngIf",(n==null?null:n.replyAvatars)&&!(n!=null&&n.commentDialogSelected)&&!(n!=null&&n.readOnly)),m(),d("componentConfigSignal",e.componentConfigSignal),x("data-testid",e.componentId+"-toggle"),m(),d("ngIf",(n==null?null:n.inlineCommentSectionMode)&&!(n!=null&&n.readOnly))}}function gqe(i,o){if(i&1&&(_(0,"div",4,0),P(2,"translate"),u(3,pqe,6,12,"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),d("veltDynamicTemplate",$(15,cqe,e.template,k(12,lqe,e.componentConfigSignal,e.wireframe),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function uqe(i,o){if(i&1&&(v(0),u(1,gqe,4,21,"div",3),C()),i&2){let n=l().ngIf;m(),d("ngIf",n==null||n.annotation==null||n.annotation.comments==null?null:n.annotation.comments.length)}}function hqe(i,o){if(i&1&&(v(0),u(1,uqe,2,1,"ng-container",2),C()),i&2){let n=l();m(),d("veltIf",k(3,sqe,n.conditionSignal(),A(1,aqe,n.componentConfigSignal)))}}var m_=(()=>{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,D(E({},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&&it(rqe,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"],[1,"velt-comment-dialog-body--reply-avatars"],[3,"componentConfigSignal"]],template:function(t,r){t&1&&u(0,hqe,2,6,"ng-container",1),t&2&&d("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 Pge=i=>({componentConfigSignal:i}),vqe=(i,o)=>({condition:i,data:o}),Cqe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-comment-category-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function _qe(i,o){if(i&1&&(_(0,"div",3),P(1,"translate"),te(2),P(3,"translate"),b()),i&2){let n=l(3).ngIf,e=l();at("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),ye(" ",M(3,8,n==null?null:n.annotation.commentCategories[0].name))}}function yqe(i,o){if(i&1&&(v(0),u(1,_qe,4,10,"div",2),C()),i&2){let n=l(2).ngIf,e=l();m(),d("veltDynamicTemplate",$(3,Cqe,e.template,A(1,Pge,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function Sqe(i,o){if(i&1&&(v(0),u(1,yqe,2,9,"ng-container",0),C()),i&2){let n=l().ngIf;m(),d("ngIf",(n==null?null:n.enableAutoCategorize)&&(n==null||n.annotation==null||n.annotation.commentCategories==null?null:n.annotation.commentCategories.length))}}function bqe(i,o){if(i&1&&(v(0),u(1,Sqe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,vqe,n.conditionSignal(),A(1,Pge,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-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&&u(0,bqe,2,6,"ng-container",0),t&2&&d("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 Mge=i=>({componentConfigSignal:i}),Iqe=(i,o)=>({condition:i,data:o}),Eqe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-comment-index-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function xqe(i,o){if(i&1&&(_(0,"div",3),P(1,"translate"),te(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),ye(" #",n==null||n.annotation==null?null:n.annotation.annotationIndex)}}function Tqe(i,o){if(i&1&&(v(0),u(1,xqe,3,6,"div",2),C()),i&2){let n=l(2).ngIf,e=l();m(),d("veltDynamicTemplate",$(3,Eqe,e.template,A(1,Mge,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function Dqe(i,o){if(i&1&&(v(0),u(1,Tqe,2,9,"ng-container",0),C()),i&2){let n=l().ngIf;m(),d("ngIf",n==null||n.annotation==null?null:n.annotation.annotationIndex)}}function wqe(i,o){if(i&1&&(v(0),u(1,Dqe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,Iqe,n.conditionSignal(),A(1,Mge,n.componentConfigSignal)))}}var e7=(()=>{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&&u(0,wqe,2,6,"ng-container",0),t&2&&d("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((2rem + 0px) * var(--velt-base-rem-unit));height:calc((1rem + 0px) * var(--velt-base-rem-unit));font-style:normal;font-size:var(--velt-font-size-2xs);box-sizing:border-box;font-weight:400;background:var(--velt-gray);color:var(--velt-black)}"],changeDetection:0});let i=o;return i})();var kge=i=>({componentConfigSignal:i}),Oqe=(i,o)=>({condition:i,data:o}),Aqe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-comment-suggestion-status-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function Pqe(i,o){if(i&1&&(_(0,"div",3),P(1,"translate"),P(2,"translate"),te(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),ye(" ",M(4,11,(n==null||n.annotation==null||n.annotation.status==null?null:n.annotation.status.name)||"")," ")}}function Mqe(i,o){if(i&1&&(v(0),u(1,Pqe,5,13,"div",2),C()),i&2){let n=l(2).ngIf,e=l();m(),d("veltDynamicTemplate",$(3,Aqe,e.template,A(1,kge,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function kqe(i,o){if(i&1&&(v(0),u(1,Mqe,2,9,"ng-container",0),C()),i&2){let n=l().ngIf;m(),d("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 Rqe(i,o){if(i&1&&(v(0),u(1,kqe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,Oqe,n.conditionSignal(),A(1,kge,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-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&&u(0,Rqe,2,6,"ng-container",0),t&2&&d("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 p_=i=>({componentConfigSignal:i}),Nqe=(i,o)=>({condition:i,data:o}),g_=(i,o)=>({componentName:"velt-comment-dialog-composer-action-button-wireframe",variant:i,suffix:o}),$2=(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 Fqe(i,o){if(i&1){let n=K();_(0,"velt-autocomplete-tool-internal",6),P(1,"translate"),W("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();d("hotkey",e.hotkey)("template",e.template)("componentMeta",k(9,g_,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 Lqe(i,o){if(i&1){let n=K();_(0,"velt-autocomplete-tool-internal",6),P(1,"translate"),W("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();d("hotkey",e.hotkey)("template",e.template)("componentMeta",k(9,g_,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 Bqe(i,o){if(i&1&&(v(0),u(1,Fqe,2,12,"velt-autocomplete-tool-internal",5)(2,Lqe,2,12,"velt-autocomplete-tool-internal",5),C()),i&2){let n=l(4);m(),d("ngIf",!n.editMode),m(),d("ngIf",n.editMode)}}function Vqe(i,o){if(i&1&&(v(0),u(1,Bqe,3,2,"ng-container",0),C()),i&2){let n=l(2).ngIf;m(),d("ngIf",n==null?null:n.userMentions)}}function Uqe(i,o){if(i&1){let n=K();_(0,"velt-autocomplete-tool-internal",6),P(1,"translate"),W("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();d("hotkey",e.hotkey)("template",e.template)("componentMeta",k(9,g_,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 jqe(i,o){if(i&1){let n=K();_(0,"velt-autocomplete-tool-internal",6),P(1,"translate"),W("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();d("hotkey",e.hotkey)("template",e.template)("componentMeta",k(9,g_,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 $qe(i,o){if(i&1&&(v(0),u(1,Uqe,2,12,"velt-autocomplete-tool-internal",5)(2,jqe,2,12,"velt-autocomplete-tool-internal",5),C()),i&2){let n=l(4);m(),d("ngIf",!n.editMode),m(),d("ngIf",n.editMode)}}function Hqe(i,o){if(i&1&&(v(0),u(1,$qe,3,2,"ng-container",0),C()),i&2){let n=l(2).ngIf;m(),d("ngIf",n==null?null:n.userMentions)}}function zqe(i,o){if(i&1){let n=K();_(0,"app-attachment-button",8),P(1,"translate"),W("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();d("template",e.template)("darkMode",!!(n!=null&&n.darkMode))("componentMeta",k(8,g_,n==null?null:n.variant,e.type))("allowedFileTypes",n==null?null:n.allowedFileTypes),x("aria-label",M(1,6,"Add file attachment to comment"))("data-testid",e.componentId+"-attachment-button")}}function Gqe(i,o){if(i&1&&(v(0),u(1,zqe,2,11,"app-attachment-button",7),C()),i&2){let n=l(2).ngIf;m(),d("ngIf",n==null?null:n.enableAttachment)}}function Wqe(i,o){if(i&1){let n=K();_(0,"app-attachment-button",8),P(1,"translate"),W("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();d("template",e.template)("darkMode",!!(n!=null&&n.darkMode))("componentMeta",k(8,g_,n==null?null:n.variant,e.type))("allowedFileTypes",n==null?null:n.allowedFileTypes),x("aria-label",M(1,6,"Add file attachment to comment"))("data-testid",e.componentId+"-attachment-button")}}function qqe(i,o){if(i&1&&(v(0),u(1,Wqe,2,11,"app-attachment-button",7),C()),i&2){let n=l(2).ngIf;m(),d("ngIf",n==null?null:n.enableAttachment)}}function Yqe(i,o){if(i&1&&(v(0),_(1,"app-action-button",13),P(2,"translate"),ce(),_(3,"svg",14),w(4,"path",15)(5,"path",16),b()(),C()),i&2){let n=l(4).ngIf,e=l();m(),d("title",M(2,4,"Record voice"))("darkMode",!!(n!=null&&n.darkMode)),x("aria-label","Record voice message")("data-testid",e.componentId+"-audio-record")}}function Kqe(i,o){if(i&1){let n=K();_(0,"app-device-permission-button",10),P(1,"translate"),_(2,"div",11),P(3,"translate"),W("click",function(){N(n);let t=l(3).ngIf;return F(t!=null&&t.recorderInitConfig||t==null?null:t.initRecording("audio"))}),u(4,Yqe,6,6,"ng-container",12),b()()}if(i&2){let n=l(3).ngIf,e=l();d("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),d("veltDynamicTemplate",Vs(12,$2,e.template,A(10,p_,e.componentConfigSignal),n==null?null:n.variant,e.type,e.setIfCondition.bind(e),e.elementRef))}}function Zqe(i,o){if(i&1&&(v(0),u(1,Kqe,5,19,"app-device-permission-button",9),C()),i&2){let n=l(2).ngIf;m(),d("ngIf",n==null||n.allowedRecordings==null?null:n.allowedRecordings.includes("audio"))}}function Xqe(i,o){if(i&1&&(v(0),_(1,"app-action-button",13),P(2,"translate"),P(3,"translate"),ce(),_(4,"svg",19),w(5,"path",20),b()(),C()),i&2){let n=l(4).ngIf,e=l();m(),d("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 Qqe(i,o){if(i&1){let n=K();_(0,"app-device-permission-button",18),P(1,"translate"),_(2,"div",11),W("click",function(){N(n);let t=l(3).ngIf;return F(t!=null&&t.recorderInitConfig||t==null?null:t.initRecording("video"))}),u(3,Xqe,6,8,"ng-container",12),b()()}if(i&2){let n=l(3).ngIf,e=l();d("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(),d("veltDynamicTemplate",Vs(10,$2,e.template,A(8,p_,e.componentConfigSignal),n==null?null:n.variant,e.type,e.setIfCondition.bind(e),e.elementRef))}}function Jqe(i,o){if(i&1&&(v(0),u(1,Qqe,4,17,"app-device-permission-button",17),C()),i&2){let n=l(2).ngIf;m(),d("ngIf",n==null||n.allowedRecordings==null?null:n.allowedRecordings.includes("video"))}}function eYe(i,o){if(i&1&&(v(0),_(1,"app-action-button",13),P(2,"translate"),P(3,"translate"),ce(),_(4,"svg",22),w(5,"path",23)(6,"path",24)(7,"path",25)(8,"path",26),b()(),C()),i&2){let n=l(4).ngIf,e=l();m(),d("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 tYe(i,o){if(i&1){let n=K();_(0,"div",11),P(1,"translate"),W("click",function(){N(n);let t=l(3).ngIf;return F(t!=null&&t.recorderInitConfig||t==null?null:t.initRecording("screen"))}),u(2,eYe,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),d("veltDynamicTemplate",Vs(7,$2,e.template,A(5,p_,e.componentConfigSignal),n==null?null:n.variant,e.type,e.setIfCondition.bind(e),e.elementRef))}}function nYe(i,o){if(i&1&&(v(0),u(1,tYe,3,14,"div",21),C()),i&2){let n=l(2).ngIf;m(),d("ngIf",(n==null||n.allowedRecordings==null?null:n.allowedRecordings.includes("screen"))&&(n==null?null:n.screenSharingSupported))}}function iYe(i,o){i&1&&(_(0,"div",30),ce(),_(1,"svg",31),w(2,"path",32),b()())}function oYe(i,o){if(i&1){let n=K();_(0,"button",28),P(1,"translate"),W("click",function(t){N(n);let r=l(3).ngIf;return r==null||r.addComment(),F(t.stopPropagation())}),u(2,iYe,3,0,"div",29),b()}if(i&2){let n,e=l(3).ngIf,t=l();d("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),d("veltDynamicTemplate",Vs(8,$2,t.template,A(6,p_,t.componentConfigSignal),e==null?null:e.variant,t.type,t.setIfCondition.bind(t),t.elementRef))}}function rYe(i,o){i&1&&(_(0,"div",30),ce(),_(1,"svg",31),w(2,"path",33),b()())}function aYe(i,o){if(i&1){let n=K();_(0,"button",28),P(1,"translate"),W("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())}),u(2,rYe,3,0,"div",29),b()}if(i&2){let n,e=l(3).ngIf,t=l();d("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),d("veltDynamicTemplate",Vs(8,$2,t.template,A(6,p_,t.componentConfigSignal),e==null?null:e.variant,t.type,t.setIfCondition.bind(t),t.elementRef))}}function sYe(i,o){if(i&1&&(v(0),u(1,oYe,3,15,"button",27)(2,aYe,3,15,"button",27),C()),i&2){let n=l(3);m(),d("ngIf",!n.editMode),m(),d("ngIf",n.editMode)}}function lYe(i,o){if(i&1){let n=K();v(0),_(1,"div",2),P(2,"translate"),W("click",function(t){return N(n),F(t.stopPropagation())}),v(3,3),u(4,Vqe,2,1,"ng-container",4)(5,Hqe,2,1,"ng-container",4)(6,Gqe,2,1,"ng-container",4)(7,qqe,2,1,"ng-container",4)(8,Zqe,2,1,"ng-container",4)(9,Jqe,2,1,"ng-container",4)(10,nYe,2,1,"ng-container",4)(11,sYe,3,2,"ng-container",4),C(),b(),C()}if(i&2){let n=l(2);m(),x("aria-label",M(2,11,"Comment tools and actions"))("data-testid",n.componentId),m(2),d("ngSwitch",n.type),m(),d("ngSwitchCase","userMentions"),m(),d("ngSwitchCase","autocomplete"),m(),d("ngSwitchCase","file"),m(),d("ngSwitchCase","attachments"),m(),d("ngSwitchCase","audio"),m(),d("ngSwitchCase","video"),m(),d("ngSwitchCase","screen"),m(),d("ngSwitchCase","submit")}}function cYe(i,o){if(i&1&&(v(0),u(1,lYe,12,13,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,Nqe,n.conditionSignal(),A(1,p_,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.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","allowedFileTypes","clicked","selectFiles","setIfConditionEvent",4,"ngIf"],[3,"clicked","selectFiles","setIfConditionEvent","template","darkMode","componentMeta","allowedFileTypes"],["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&&u(0,cYe,2,6,"ng-container",0),t&2&&d("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 Rge=i=>({componentConfigSignal:i}),dYe=(i,o)=>({condition:i,data:o}),mYe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-composer-assign-user-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function pYe(i,o){if(i&1){let n=K();_(0,"app-assign-dropdown",4),P(1,"translate"),W("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();d("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 gYe(i,o){if(i&1&&(v(0),u(1,pYe,2,7,"app-assign-dropdown",3),C()),i&2){let n=l(2).ngIf;m(),d("ngIf",n==null?null:n.userMentions)}}function uYe(i,o){if(i&1&&(v(0),u(1,gYe,2,1,"ng-container",2),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(3,mYe,e.template,A(1,Rge,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function hYe(i,o){if(i&1&&(v(0),u(1,uYe,2,9,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,dYe,n.conditionSignal(),A(1,Rge,n.componentConfigSignal)))}}var z2=(()=>{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&&u(0,hYe,2,6,"ng-container",0),t&2&&d("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 fYe=(i,o,n,e)=>({componentConfigSignal:i,file:o,fileIndex:n,isEditMode:e}),vYe=(i,o)=>({condition:i,data:o}),CYe=(i,o,n,e)=>({componentConfigSignal:i,fileIndex:o,file:n,isEditMode:e}),_Ye=(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 yYe(i,o){if(i&1&&(v(0),w(1,"img",3),C()),i&2){let n=l(3);m(),d("src",n.file==null?null:n.file.url,fn)}}function SYe(i,o){if(i&1&&(v(0),u(1,yYe,2,1,"ng-container",2),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(6,_Ye,e.template,mt(1,CYe,e.componentConfigSignal,e.fileIndex,e.file,e.isEditMode),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function bYe(i,o){if(i&1&&(v(0),u(1,SYe,2,12,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(6,vYe,n.conditionSignal(),mt(1,fYe,n.componentConfigSignal,n.file,n.fileIndex,n.isEditMode)))}}var G2=(()=>{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&&u(0,bYe,2,9,"ng-container",0),t&2&&d("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 IYe=(i,o,n,e)=>({componentConfigSignal:i,file:o,fileIndex:n,isEditMode:e}),EYe=(i,o)=>({condition:i,data:o}),xYe=(i,o,n,e)=>({componentConfigSignal:i,fileIndex:o,file:n,isEditMode:e}),TYe=(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 DYe(i,o){i&1&&(v(0),ce(),_(1,"svg",5),w(2,"path",6)(3,"path",7),b(),C())}function wYe(i,o){if(i&1){let n=K();_(0,"button",3),P(1,"translate"),P(2,"translate"),W("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))}),u(3,DYe,4,0,"ng-container",4),b()}if(i&2){let n=l(2).ngIf,e=l();d("title",M(1,4,"Remove File")),x("data-testid",e.componentId)("aria-label",M(2,6,"Remove file")),m(3),d("veltDynamicTemplate",$(13,TYe,e.template,mt(8,xYe,e.componentConfigSignal,e.fileIndex,e.file,e.isEditMode),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function OYe(i,o){if(i&1&&(v(0),u(1,wYe,4,19,"button",2),C()),i&2){let n=l().ngIf;m(),d("ngIf",!(n!=null&&n.uploadingAttachments))}}function AYe(i,o){if(i&1&&(v(0),u(1,OYe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(6,EYe,n.conditionSignal(),mt(1,IYe,n.componentConfigSignal,n.file,n.fileIndex,n.isEditMode)))}}var W2=(()=>{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&&u(0,AYe,2,9,"ng-container",0),t&2&&d("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 PYe=(i,o,n,e)=>({componentConfigSignal:i,file:o,fileIndex:n,isEditMode:e}),MYe=(i,o)=>({condition:i,data:o}),kYe=(i,o,n,e)=>({componentConfigSignal:i,fileIndex:o,file:n,isEditMode:e}),RYe=(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 NYe(i,o){i&1&&(v(0),ce(),_(1,"svg",3)(2,"circle",4),w(3,"animateTransform",5),b()(),C())}function FYe(i,o){if(i&1&&(v(0),u(1,NYe,4,0,"ng-container",2),C()),i&2){let n=l(2).ngIf,e=l();m(),d("veltDynamicTemplate",$(6,RYe,e.template,mt(1,kYe,e.componentConfigSignal,e.fileIndex,e.file,e.isEditMode),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function LYe(i,o){if(i&1&&(v(0),u(1,FYe,2,12,"ng-container",0),C()),i&2){let n=l().ngIf,e=l();m(),d("ngIf",(n==null?null:n.uploadingAttachments)&&!e.isEditMode&&!(e.file!=null&&e.file.uploaded))}}function BYe(i,o){if(i&1&&(v(0),u(1,LYe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(6,MYe,n.conditionSignal(),mt(1,PYe,n.componentConfigSignal,n.file,n.fileIndex,n.isEditMode)))}}var q2=(()=>{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&&u(0,BYe,2,9,"ng-container",0),t&2&&d("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 VYe=(i,o,n,e)=>({componentConfigSignal:i,file:o,fileIndex:n,isEditMode:e}),UYe=(i,o)=>({condition:i,data:o}),jYe=(i,o,n,e)=>({componentConfigSignal:i,fileIndex:o,file:n,isEditMode:e}),$Ye=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-composer-attachments-image-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function HYe(i,o){if(i&1&&(v(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(),C()),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),d("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),d("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),d("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 zYe(i,o){if(i&1&&(v(0),u(1,HYe,16,44,"ng-container",2),C()),i&2){let n=l(2).ngIf,e=l();m(),d("veltDynamicTemplate",$(6,$Ye,e.template,mt(1,jYe,e.componentConfigSignal,e.fileIndex,e.file,e.isEditMode),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function GYe(i,o){if(i&1&&(v(0),u(1,zYe,2,12,"ng-container",0),C()),i&2){let n=l(2);m(),d("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 WYe(i,o){if(i&1&&(v(0),u(1,GYe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(6,UYe,n.conditionSignal(),mt(1,VYe,n.componentConfigSignal,n.file,n.fileIndex,n.isEditMode)))}}var Y2=(()=>{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(Le),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&&u(0,WYe,2,9,"ng-container",0),t&2&&d("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 qYe=(i,o,n)=>({componentConfigSignal:i,file:o,fileIndex:n}),YYe=(i,o)=>({condition:i,data:o}),KYe=(i,o,n)=>({componentConfigSignal:i,fileIndex:o,file:n}),ZYe=(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 XYe(i,o){if(i&1&&(v(0),w(1,"img",3),C()),i&2){let n=l(3);m(),d("src",n.file==null?null:n.file.url,fn)}}function QYe(i,o){if(i&1&&(v(0),u(1,XYe,2,1,"ng-container",2),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(5,ZYe,e.template,$e(1,KYe,e.componentConfigSignal,e.fileIndex,e.file),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function JYe(i,o){if(i&1&&(v(0),u(1,QYe,2,11,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(5,YYe,n.conditionSignal(),$e(1,qYe,n.componentConfigSignal,n.file,n.fileIndex)))}}var K2=(()=>{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&&u(0,JYe,2,8,"ng-container",0),t&2&&d("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 eKe=(i,o,n)=>({componentConfigSignal:i,file:o,fileIndex:n}),tKe=(i,o)=>({condition:i,data:o}),nKe=(i,o,n)=>({componentConfigSignal:i,fileIndex:o,file:n}),iKe=(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 oKe(i,o){if(i&1&&(v(0),_(1,"span",3),P(2,"translate"),P(3,"translate"),te(4),P(5,"translate"),b(),C()),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),ye(" ",M(5,7,n.file==null?null:n.file.errorMessage)," ")}}function rKe(i,o){if(i&1&&(v(0),u(1,oKe,6,9,"ng-container",2),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(5,iKe,e.template,$e(1,nKe,e.componentConfigSignal,e.fileIndex,e.file),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function aKe(i,o){if(i&1&&(v(0),u(1,rKe,2,11,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(5,tKe,n.conditionSignal(),$e(1,eKe,n.componentConfigSignal,n.file,n.fileIndex)))}}var Z2=(()=>{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&&u(0,aKe,2,8,"ng-container",0),t&2&&d("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 Nge=(i,o,n)=>({componentConfigSignal:i,file:o,fileIndex:n}),sKe=(i,o)=>({condition:i,data:o}),lKe=(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 cKe(i,o){i&1&&(v(0),ce(),_(1,"svg",4),w(2,"path",5)(3,"path",6),b(),C())}function dKe(i,o){if(i&1){let n=K();v(0),_(1,"button",2),P(2,"translate"),P(3,"translate"),P(4,"translate"),W("click",function(){N(n);let t=l().ngIf,r=l();return F(t==null?null:t.removeInvalidFile(r.fileIndex))}),u(5,cKe,4,0,"ng-container",3),b(),C()}if(i&2){let n=l().ngIf,e=l();m(),d("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),d("veltDynamicTemplate",$(14,lKe,e.template,$e(10,Nge,e.componentConfigSignal,e.file,e.fileIndex),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function mKe(i,o){if(i&1&&(v(0),u(1,dKe,6,20,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(5,sKe,n.conditionSignal(),$e(1,Nge,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&&u(0,mKe,2,8,"ng-container",0),t&2&&d("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 Fge=(i,o,n)=>({componentConfigSignal:i,file:o,fileIndex:n}),pKe=(i,o)=>({condition:i,data:o}),gKe=(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 uKe(i,o){if(i&1&&(v(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"),ce(),_(10,"svg",7),w(11,"path",8),b(),ht(),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(),C()),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),d("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),d("file",n.file)("componentConfigSignal",n.componentConfigSignal),x("data-testid",n.componentId+"-error-message-text"),m(),d("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 hKe(i,o){if(i&1&&(v(0),u(1,uKe,16,32,"ng-container",2),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(5,gKe,e.template,$e(1,Fge,e.componentConfigSignal,e.file,e.fileIndex),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function fKe(i,o){if(i&1&&(v(0),u(1,hKe,2,11,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(5,pKe,n.conditionSignal(),$e(1,Fge,n.componentConfigSignal,n.file,n.fileIndex)))}}var Q2=(()=>{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(Le),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&&u(0,fKe,2,8,"ng-container",0),t&2&&d("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 Lge=i=>({componentConfigSignal:i}),vKe=(i,o)=>({condition:i,data:o}),CKe=(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 _Ke(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),d("componentConfigSignal",t.componentConfigSignal)("file",n)("fileIndex",e)("itemWireframe",t.itemTemplate)}}function yKe(i,o){if(i&1&&(v(0),u(1,_Ke,4,10,"div",3),C()),i&2){let n=l(2).ngIf;m(),d("ngForOf",n==null?null:n.invalidSelectedFiles)}}function SKe(i,o){if(i&1&&(v(0),u(1,yKe,2,1,"ng-container",2),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(3,CKe,e.template,A(1,Lge,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function bKe(i,o){if(i&1&&(v(0),u(1,SKe,2,9,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,vKe,n.conditionSignal(),A(1,Lge,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-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");qe(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&&u(0,bKe,2,6,"ng-container",0),t&2&&d("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 IKe=(i,o,n,e)=>({componentConfigSignal:i,file:o,fileIndex:n,isEditMode:e}),EKe=(i,o)=>({condition:i,data:o}),xKe=(i,o,n,e)=>({componentConfigSignal:i,fileIndex:o,file:n,isEditMode:e}),TKe=(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 DKe(i,o){i&1&&(v(0),ce(),_(1,"svg",5),w(2,"path",6),b(),C())}function wKe(i,o){if(i&1){let n=K();_(0,"button",3),P(1,"translate"),P(2,"translate"),W("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))}),u(3,DKe,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),d("veltDynamicTemplate",$(12,TKe,e.template,mt(7,xKe,e.componentConfigSignal,e.fileIndex,e.file,e.isEditMode),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function OKe(i,o){if(i&1&&(v(0),u(1,wKe,4,18,"button",2),C()),i&2){let n=l().ngIf;m(),d("ngIf",!(n!=null&&n.uploadingAttachments))}}function AKe(i,o){if(i&1&&(v(0),u(1,OKe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(6,EKe,n.conditionSignal(),mt(1,IKe,n.componentConfigSignal,n.file,n.fileIndex,n.isEditMode)))}}var eE=(()=>{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&&u(0,AKe,2,9,"ng-container",0),t&2&&d("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 PKe=(i,o,n,e)=>({componentConfigSignal:i,file:o,fileIndex:n,isEditMode:e}),MKe=(i,o)=>({condition:i,data:o}),kKe=(i,o,n,e)=>({componentConfigSignal:i,fileIndex:o,file:n,isEditMode:e}),RKe=(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 NKe(i,o){if(i&1&&(v(0),_(1,"div",3),w(2,"velt-file-icon-internal",4),b(),C()),i&2){let n=l(3);m(),x("data-testid",n.componentId),m(),d("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 FKe(i,o){if(i&1&&(v(0),u(1,NKe,3,3,"ng-container",2),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(6,RKe,e.template,mt(1,kKe,e.componentConfigSignal,e.fileIndex,e.file,e.isEditMode),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function LKe(i,o){if(i&1&&(v(0),u(1,FKe,2,12,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(6,MKe,n.conditionSignal(),mt(1,PKe,n.componentConfigSignal,n.file,n.fileIndex,n.isEditMode)))}}var tE=(()=>{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&&u(0,LKe,2,9,"ng-container",0),t&2&&d("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 BKe=(i,o,n,e)=>({componentConfigSignal:i,file:o,fileIndex:n,isEditMode:e}),VKe=(i,o)=>({condition:i,data:o}),UKe=(i,o,n,e)=>({componentConfigSignal:i,fileIndex:o,file:n,isEditMode:e}),jKe=(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 $Ke(i,o){if(i&1&&(v(0),ce(),_(1,"svg",3)(2,"circle",4),w(3,"animateTransform",5),b()(),C()),i&2){let n=l(4);m(),x("data-testid",n.componentId+"-svg")}}function HKe(i,o){if(i&1&&(v(0),u(1,$Ke,4,1,"ng-container",2),C()),i&2){let n=l(2).ngIf,e=l();m(),d("veltDynamicTemplate",$(6,jKe,e.template,mt(1,UKe,e.componentConfigSignal,e.fileIndex,e.file,e.isEditMode),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function zKe(i,o){if(i&1&&(v(0),u(1,HKe,2,12,"ng-container",0),C()),i&2){let n=l().ngIf,e=l();m(),d("ngIf",!e.isEditMode&&(n==null?null:n.uploadingAttachments)&&!(e.file!=null&&e.file.uploaded))}}function GKe(i,o){if(i&1&&(v(0),u(1,zKe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(6,VKe,n.conditionSignal(),mt(1,BKe,n.componentConfigSignal,n.file,n.fileIndex,n.isEditMode)))}}var nE=(()=>{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&&u(0,GKe,2,9,"ng-container",0),t&2&&d("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 WKe=(i,o,n,e)=>({componentConfigSignal:i,file:o,fileIndex:n,isEditMode:e}),qKe=(i,o)=>({condition:i,data:o}),YKe=(i,o,n,e)=>({componentConfigSignal:i,fileIndex:o,file:n,isEditMode:e}),KKe=(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 ZKe(i,o){if(i&1&&(v(0),_(1,"span",3),P(2,"translate"),te(3),P(4,"translate"),b(),C()),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),ye(" ",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 XKe(i,o){if(i&1&&(v(0),u(1,ZKe,5,7,"ng-container",2),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(6,KKe,e.template,mt(1,YKe,e.componentConfigSignal,e.fileIndex,e.file,e.isEditMode),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function QKe(i,o){if(i&1&&(v(0),u(1,XKe,2,12,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(6,qKe,n.conditionSignal(),mt(1,WKe,n.componentConfigSignal,n.file,n.fileIndex,n.isEditMode)))}}var iE=(()=>{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&&u(0,QKe,2,9,"ng-container",0),t&2&&d("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 JKe=(i,o,n,e)=>({componentConfigSignal:i,file:o,fileIndex:n,isEditMode:e}),eZe=(i,o)=>({condition:i,data:o}),tZe=(i,o,n,e)=>({componentConfigSignal:i,fileIndex:o,file:n,isEditMode:e}),nZe=(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 iZe(i,o){if(i&1&&(v(0),_(1,"span",3),P(2,"fileSize"),te(3),P(4,"fileSize"),b(),C()),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),ye(" ",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 oZe(i,o){if(i&1&&(v(0),u(1,iZe,5,7,"ng-container",2),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(6,nZe,e.template,mt(1,tZe,e.componentConfigSignal,e.fileIndex,e.file,e.isEditMode),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function rZe(i,o){if(i&1&&(v(0),u(1,oZe,2,12,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(6,eZe,n.conditionSignal(),mt(1,JKe,n.componentConfigSignal,n.file,n.fileIndex,n.isEditMode)))}}var oE=(()=>{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&&u(0,rZe,2,9,"ng-container",0),t&2&&d("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 aZe=(i,o,n,e)=>({componentConfigSignal:i,file:o,fileIndex:n,isEditMode:e}),sZe=(i,o)=>({condition:i,data:o}),lZe=(i,o,n,e)=>({componentConfigSignal:i,fileIndex:o,file:n,isEditMode:e}),cZe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-composer-attachments-other-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function dZe(i,o){if(i&1&&(v(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()(),C()),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),d("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),d("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),d("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),d("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),d("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 mZe(i,o){if(i&1&&(v(0),u(1,dZe,25,68,"ng-container",2),C()),i&2){let n=l(2).ngIf,e=l();m(),d("veltDynamicTemplate",$(6,cZe,e.template,mt(1,lZe,e.componentConfigSignal,e.fileIndex,e.file,e.isEditMode),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function pZe(i,o){if(i&1&&(v(0),u(1,mZe,2,12,"ng-container",0),C()),i&2){let n=l(2);m(),d("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 gZe(i,o){if(i&1&&(v(0),u(1,pZe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(6,sZe,n.conditionSignal(),mt(1,aZe,n.componentConfigSignal,n.file,n.fileIndex,n.isEditMode)))}}var rE=(()=>{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(Le),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&&u(0,gZe,2,9,"ng-container",0),t&2&&d("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 Bge=i=>({componentConfigSignal:i}),uZe=(i,o)=>({condition:i,data:o}),hZe=(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 fZe(i,o){if(i&1&&(v(0),w(1,"app-comment-dialog-composer-attachments-other",7)(2,"app-comment-dialog-composer-attachments-image",8),C()),i&2){let n=o.$implicit,e=o.index,t=l(5);m(),d("componentConfigSignal",t.componentConfigSignal)("file",n)("fileIndex",e)("isEditMode",!0)("otherWireframe",t.otherTemplate),m(),d("componentConfigSignal",t.componentConfigSignal)("file",n)("fileIndex",e)("isEditMode",!0)("imageWireframe",t.imageTemplate)}}function vZe(i,o){if(i&1&&(v(0),w(1,"app-comment-dialog-composer-attachments-other",7)(2,"app-comment-dialog-composer-attachments-image",8),C()),i&2){let n=o.$implicit,e=o.index,t=l(5);m(),d("componentConfigSignal",t.componentConfigSignal)("file",n)("fileIndex",e)("isEditMode",!1)("otherWireframe",t.otherTemplate),m(),d("componentConfigSignal",t.componentConfigSignal)("file",n)("fileIndex",e)("isEditMode",!1)("imageWireframe",t.imageTemplate)}}function CZe(i,o){if(i&1&&(_(0,"div",4),P(1,"translate"),P(2,"translate"),u(3,fZe,3,10,"ng-container",5)(4,vZe,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),d("ngForOf",n==null||n.editComment==null?null:n.editComment.attachments)("ngForTrackBy",n==null?null:n.trackByAttachmentId),m(),d("ngForOf",n==null?null:n.selectedFiles)}}function _Ze(i,o){if(i&1&&(v(0),u(1,CZe,5,9,"div",3),C()),i&2){let n=l(2).ngIf;m(),d("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 yZe(i,o){if(i&1&&(v(0),u(1,_Ze,2,1,"ng-container",2),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(3,hZe,e.template,A(1,Bge,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function SZe(i,o){if(i&1&&(v(0),u(1,yZe,2,9,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,uZe,n.conditionSignal(),A(1,Bge,n.componentConfigSignal)))}}var aE=(()=>{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");qe(e)||(this.imageTemplate=e)}if(!this.otherTemplate){let e=this.template?.querySelector("velt-comment-dialog-composer-attachments-other-wireframe");qe(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&&u(0,SZe,2,6,"ng-container",0),t&2&&d("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 Vge=i=>({componentConfigSignal:i}),bZe=(i,o)=>({condition:i,data:o}),IZe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-composer-attachments-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function EZe(i,o){if(i&1&&(v(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(),C()),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),d("componentConfigSignal",e.componentConfigSignal),m(),d("componentConfigSignal",e.componentConfigSignal)}}function xZe(i,o){if(i&1&&(v(0),u(1,EZe,7,10,"ng-container",2),C()),i&2){let n=l(2).ngIf,e=l();m(),d("veltDynamicTemplate",$(3,IZe,e.template,A(1,Vge,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function TZe(i,o){if(i&1&&(v(0),u(1,xZe,2,9,"ng-container",0),C()),i&2){let n=l().ngIf;m(),d("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 DZe(i,o){if(i&1&&(v(0),u(1,TZe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,bZe,n.conditionSignal(),A(1,Vge,n.componentConfigSignal)))}}var sE=(()=>{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&&u(0,DZe,2,6,"ng-container",0),t&2&&d("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 wZe=["newCommentTextArea"],OZe=["editCommentTextArea"],AZe=["userSelector"],Uge=i=>({componentConfigSignal:i}),PZe=(i,o)=>({condition:i,data:o}),MZe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-composer-input-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function kZe(i,o){if(i&1){let n=K();_(0,"velt-autocomplete-panel-internal",11,1),W("userContactOptionSelected",function(t){N(n),l();let r=me(4),a=l(3).ngIf;return F(a==null?null:a.userContactSelected(t,r))})("customOptionSelected",function(t){N(n),l();let r=me(4),a=l(3).ngIf;return F(a==null?null:a.autocompleteItemSelected(t,r))})("groupOptionSelected",function(t){N(n),l();let r=me(4),a=l(3).ngIf;return F(a==null?null:a.groupSelected(t,r))})("atHereSelected",function(t){N(n),l();let r=me(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=me(5),e=l(3).ngIf;d("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 RZe(i,o){if(i&1){let n=K();_(0,"div",7),P(1,"translate"),W("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"),W("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){N(n);let r=l(4);return F(r.onKeyPress(t))})("keyup",function(t){N(n);let r=l(3).ngIf,a=l();return r==null||r.onEscapeKeyPressed(t),F(a.onKeyUp(t))})("keydown",function(t){N(n);let r=l(4);return r.onKeyPressedAddComment(t),F(r.onKeyDown(t))})("keydown.escape",function(t){N(n);let r=l(4);return F(r.onEscapeKeyPressed(t,r.userSelector))})("keydown.backspace",function(){N(n);let t=me(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=me(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()(),u(7,kZe,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),d("matAutocompleteDisabled",!(n!=null&&n.userMentions)),x("data-testid",e.componentId+"-new-textarea")("placeholder",M(6,8,e.newCommentPlaceholder)),m(4),d("ngIf",n==null?null:n.userMentions)}}function NZe(i,o){if(i&1){let n=K();_(0,"velt-autocomplete-panel-internal",11,1),W("userContactOptionSelected",function(t){N(n),l();let r=me(4),a=l(4).ngIf;return F(a==null?null:a.userContactSelected(t,r))})("customOptionSelected",function(t){N(n),l();let r=me(4),a=l(4).ngIf;return F(a==null?null:a.autocompleteItemSelected(t,r))})("groupOptionSelected",function(t){N(n),l();let r=me(4),a=l(4).ngIf;return F(a==null?null:a.groupSelected(t,r))})("atHereSelected",function(t){N(n),l();let r=me(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=me(5),e=l(4).ngIf;d("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 FZe(i,o){if(i&1){let n=K();_(0,"div",7),P(1,"translate"),W("click",function(t){return N(n),F(t.stopPropagation())}),_(2,"div",8)(3,"div",12,2),P(6,"translate"),W("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())})("keydown",function(t){N(n);let r=me(4),a=l(5);return a.onKeyPressedUpdateComment(t,a.i,r.innerText),F(a.onKeyDown(t))})("keypress",function(t){N(n);let r=l(5);return F(r.onKeyPress(t))})("keyup",function(t){N(n);let r=l(5);return F(r.onKeyUp(t))})("keydown.backspace",function(){N(n);let t=me(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=me(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 F(a.onEscapeKeyPressed(t,a.userSelector)||(r==null?null:r.cancelUpdate()))})("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(),u(7,NZe,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),d("matAutocompleteDisabled",!(n!=null&&n.userMentions)),x("data-testid",e.componentId+"-edit-textarea")("placeholder",M(6,8,e.editCommentPlaceholder)),m(4),d("ngIf",n==null?null:n.userMentions)}}function LZe(i,o){if(i&1&&(v(0),u(1,FZe,8,10,"div",6),C()),i&2){let n=l(3).ngIf;m(),d("ngIf",!(n!=null&&n.recorderInitConfig&&(n==null||n.recorderInitConfig==null?null:n.recorderInitConfig.panelId)===(n==null?null:n.commentDialogUniqueId)))}}function BZe(i,o){if(i&1&&(v(0),u(1,RZe,8,10,"div",6)(2,LZe,2,1,"ng-container",3),C()),i&2){let n=l(2).ngIf,e=l();m(),d("ngIf",!e.editMode&&!(n!=null&&n.recorderInitConfig&&(n==null||n.recorderInitConfig==null?null:n.recorderInitConfig.panelId)===(n==null?null:n.commentDialogUniqueId))),m(),d("ngIf",e.editMode&&e.commentObj)}}function VZe(i,o){if(i&1&&(v(0),u(1,BZe,3,2,"ng-container",5),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(3,MZe,e.template,A(1,Uge,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function UZe(i,o){if(i&1&&(v(0),u(1,VZe,2,9,"ng-container",4),C()),i&2){let n=l();m(),d("veltIf",k(3,PZe,n.conditionSignal(),A(1,Uge,n.componentConfigSignal)))}}var lE=(()=>{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.newCommentPlaceholder="",this.editCommentPlaceholder="",this.componentId="velt-comment-dialog-composer-input",super.initializeComponentConfigSignal(new ke),ro(()=>{this.componentConfigSignal()&&this.calculatePlaceholders()})}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes(),this.calculatePlaceholders()}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)}}calculatePlaceholders(){try{let e=this.componentConfigSignal();this.placeholder?(this.newCommentPlaceholder=this.placeholder,this.editCommentPlaceholder=this.placeholder):(e?.userMentions?e?.annotation?.comments?.length===0?(this.newCommentPlaceholder="Comment or add others with @",this.editCommentPlaceholder="Edit your comment..."):(this.newCommentPlaceholder="Reply or add others with @",this.editCommentPlaceholder="Edit your reply..."):e?.annotation?.comments?.length===0?(this.newCommentPlaceholder="Write a comment...",this.editCommentPlaceholder="Edit your comment..."):(this.newCommentPlaceholder="Write a reply...",this.editCommentPlaceholder="Edit your reply..."),(this.commentplaceholder||e?.commentplaceholder)&&e?.annotation?.comments?.length===0&&(this.newCommentPlaceholder=this.commentplaceholder||e?.commentplaceholder||this.newCommentPlaceholder,this.editCommentPlaceholder=this.commentplaceholder||e?.commentplaceholder||this.editCommentPlaceholder),(this.replyplaceholder||e?.replyplaceholder)&&e?.annotation?.comments?.length>0&&(this.newCommentPlaceholder=this.replyplaceholder||e?.replyplaceholder||this.newCommentPlaceholder,this.editCommentPlaceholder=this.replyplaceholder||e?.replyplaceholder||this.editCommentPlaceholder))}catch(e){this.loggingService.catch("Error in CommentDialogComposerInputComponent calculatePlaceholders:",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=D(E({},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=D(E({},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 c=["@","#","$"];if(Z0(s,c)){let g=window.getSelection();if(g&&g.rangeCount>0){let f=g.getRangeAt(0),I=f.startOffset,T=f.commonAncestorContainer?.textContent||"",L=-1;for(let G of c){let z=T.lastIndexOf(G,I);z>L&&(L=z)}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=D(E({},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=D(E({},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,D(E({},r||{}),{annotationId:this.componentConfigSignal()?.annotation?.annotationId}))}catch{}}onFocus(e){this.newCommentTextArea&&this.newCommentTextArea?.nativeElement.contains(e.target)&&this.componentConfigSignal.update(t=>(t=D(E({},t),{isInputFocused:!0}),t)),this.editCommentTextArea&&this.editCommentTextArea?.nativeElement.contains(e.target)&&this.componentConfigSignal.update(t=>(t=D(E({},t),{isInputFocused:!0}),t))}onBlur(e){this.newCommentTextArea&&this.newCommentTextArea?.nativeElement.contains(e.target)&&this.componentConfigSignal.update(t=>(t=D(E({},t),{isInputFocused:!1}),t)),this.editCommentTextArea&&this.editCommentTextArea?.nativeElement.contains(e.target)&&this.componentConfigSignal.update(t=>(t=D(E({},t),{isInputFocused:!1}),t))}onAutocompleteStateChanged(e){try{this.loggingService.log("%c[WB] Calling CommentDialogComposerInputComponent FUNCTION: onAutocompleteStateChanged","color: green;"),this.componentConfigSignal.update(t=>(t=D(E({},t),{isAutocompleteDropdownOpen:e}),t))}catch(t){this.catchError("Error in CommentDialogComposerInputComponent onAutocompleteStateChanged: ",t)}}onKeyUp(e){try{this.loggingService.log("%c[WB] Calling CommentDialogComposerInputComponent FUNCTION: onKeyUp","color: green;"),e.code!=="Escape"&&e.stopPropagation()}catch(t){this.catchError("Error in CommentDialogComposerInputComponent onKeyUp: ",t)}}onKeyDown(e){try{this.loggingService.log("%c[WB] Calling CommentDialogComposerInputComponent FUNCTION: onKeyDown","color: green;"),e.code!=="Escape"&&e.stopPropagation()}catch(t){this.catchError("Error in CommentDialogComposerInputComponent onKeyDown: ",t)}}onKeyPress(e){try{this.loggingService.log("%c[WB] Calling CommentDialogComposerInputComponent FUNCTION: onKeyPress","color: green;"),e.code!=="Escape"&&e.stopPropagation()}catch(t){this.catchError("Error in CommentDialogComposerInputComponent onKeyPress: ",t)}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(Gi),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-composer-input"]],viewQuery:function(t,r){if(t&1&&(it(wZe,5),it(OZe,5),it(AZe,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&&W("focusin",function(s){return r.onFocus(s)})("focusout",function(s){return r.onBlur(s)})},inputs:{editMode:"editMode",commentObj:"commentObj",i:"i",placeholder:"placeholder",commentplaceholder:"commentplaceholder",replyplaceholder:"replyplaceholder"},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","keydown","keypress","keyup","keydown.backspace","keydown.delete","keydown.escape","copy","dragover","dragenter","drop","click","matAutocompleteDisabled"]],template:function(t,r){t&1&&u(0,UZe,2,6,"ng-container",3),t&2&&d("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 jge=i=>({componentConfigSignal:i}),jZe=(i,o)=>({condition:i,data:o}),$Ze=(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 HZe(i,o){if(i&1){let n=K();v(0),_(1,"snippyly-recorder-player-internal",5),P(2,"translate"),P(3,"translate"),W("onDelete",function(t){N(n);let r=l(3).ngIf;return F(r==null?null:r.onDeleteRecorderAnnotation(t))}),b(),C()}if(i&2){let n=o.$implicit,e=l(3).ngIf,t=l();m(),d("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 zZe(i,o){if(i&1){let n=K();v(0),u(1,HZe,4,12,"ng-container",3),_(2,"snippyly-recorder-control-panel-internal",4),P(3,"translate"),W("onRecordedData",function(t){N(n);let r=l(2).ngIf;return F(r==null?null:r.onRecordedData(t))}),b(),C()}if(i&2){let n=l(2).ngIf,e=l();m(),d("ngForOf",n==null?null:n.localRecordedData)("ngForTrackBy",n==null?null:n.trackByRecorderId),m(),d("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 GZe(i,o){if(i&1&&(v(0),u(1,zZe,4,8,"ng-container",2),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(3,$Ze,e.template,A(1,jge,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function WZe(i,o){if(i&1&&(v(0),u(1,GZe,2,9,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,jZe,n.conditionSignal(),A(1,jge,n.componentConfigSignal)))}}var cE=(()=>{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&&u(0,WZe,2,6,"ng-container",0),t&2&&d("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 qZe=i=>({componentConfigSignal:i}),YZe=(i,o)=>({condition:i,data:o}),KZe=(i,o,n,e,t)=>({componentConfigSignal:i,editMode:o,commentObj:n,i:e,wireframe:t}),ZZe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-composer-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function XZe(i,o){if(i&1&&(v(0),w(1,"app-comment-dialog-composer-avatar",6),C()),i&2){let n=l(6);m(),d("componentConfigSignal",n.componentConfigSignal)}}function QZe(i,o){if(i&1&&w(0,"app-comment-dialog-composer-action-button",13),i&2){let n=l(7);d("type","submit")("componentConfigSignal",n.componentConfigSignal)("editMode",n.editMode)("commentObj",n.commentObj)("i",n.i)}}function JZe(i,o){if(i&1&&(_(0,"div",10),w(1,"app-comment-dialog-composer-input",11),u(2,QZe,1,5,"app-comment-dialog-composer-action-button",12),b()),i&2){let n=l(5).ngIf,e=l();m(),d("componentConfigSignal",e.componentConfigSignal)("editMode",e.editMode)("commentObj",e.commentObj)("i",e.i),m(),d("ngIf",n.composerMode==="default"&&!n.composerInOpenState)}}function eXe(i,o){i&1&&w(0,"div",18)}function tXe(i,o){if(i&1&&(v(0),u(1,eXe,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(),C()),i&2){let n=l(5).ngIf,e=l();m(),d("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),d("type","autocomplete")("componentConfigSignal",e.componentConfigSignal)("editMode",e.editMode)("commentObj",e.commentObj)("i",e.i),m(),d("type","attachments")("componentConfigSignal",e.componentConfigSignal),m(),d("type","audio")("componentConfigSignal",e.componentConfigSignal),m(),d("type","video")("componentConfigSignal",e.componentConfigSignal),m(),d("type","screen")("componentConfigSignal",e.componentConfigSignal),m(2),d("type","submit")("componentConfigSignal",e.componentConfigSignal)("editMode",e.editMode)("commentObj",e.commentObj)("i",e.i)}}function nXe(i,o){if(i&1&&(v(0),_(1,"div"),u(2,XZe,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),u(8,JZe,3,5,"div",9)(9,tXe,10,19,"ng-container",0),b()(),w(10,"app-comment-dialog-composer-assign-user",6),C()),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(),d("ngIf",n.inlineCommentSectionMode),m(2),d("componentConfigSignal",e.componentConfigSignal),m(),d("wireframe",e.wireframe)("componentConfigSignal",e.componentConfigSignal),m(),d("componentConfigSignal",e.componentConfigSignal),m(),d("componentConfigSignal",e.componentConfigSignal),m(),d("ngIf",!(n!=null&&n.recorderInitConfig&&(n==null||n.recorderInitConfig==null?null:n.recorderInitConfig.panelId)===(n==null?null:n.commentDialogUniqueId))),m(),d("ngIf",n.composerMode!=="default"||n.composerMode==="default"&&n.composerInOpenState),m(),d("componentConfigSignal",e.componentConfigSignal)}}function iXe(i,o){if(i&1){let n=K();_(0,"div",3),P(1,"translate"),P(2,"translate"),W("click",function(){N(n);let t=l(3).ngIf;return F(t==null?null:t.focusOnComposerInput())}),u(3,nXe,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),d("veltDynamicTemplate",$(27,ZZe,e.template,$(21,KZe,e.componentConfigSignal,e.editMode,e.commentObj,e.i,e.wireframe),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function oXe(i,o){if(i&1&&(v(0),u(1,iXe,4,33,"div",2),C()),i&2){let n=l(2).ngIf,e=l();m(),d("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 rXe(i,o){if(i&1&&(v(0),u(1,oXe,2,1,"ng-container",0),C()),i&2){let n=l().ngIf;m(),d("ngIf",!(!(n==null||n.annotation==null||n.annotation.comments==null)&&n.annotation.comments.length)||!(n!=null&&n.inlineCommentMode))}}function aXe(i,o){if(i&1&&(v(0),u(1,rXe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,YZe,n.conditionSignal(),A(1,qZe,n.componentConfigSignal)))}}var Tf=(()=>{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(Le),h(y),h(R),h(S))},o.\u0275cmp=O({type:o,selectors:[["app-comment-dialog-composer"]],hostBindings:function(t,r){t&1&&W("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&&u(0,aXe,2,6,"ng-container",0),t&2&&d("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 $ge=i=>({componentConfigSignal:i}),lXe=(i,o)=>({condition:i,data:o}),cXe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-ghost-banner-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function dXe(i,o){if(i&1&&(v(0),ce(),_(1,"svg",5),w(2,"path",6)(3,"path",7),b(),ht(),_(4,"span",8),te(5),P(6,"translate"),b(),C()),i&2){let n=l(3).ngIf,e=l();m(4),x("data-testid",e.componentId+"-message"),m(),ye(" ",M(6,2,n==null||n.ghostComment==null?null:n.ghostComment.message))}}function mXe(i,o){if(i&1&&(_(0,"div",3),P(1,"translate"),u(2,dXe,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),d("veltDynamicTemplate",$(7,cXe,e.template,A(5,$ge,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function pXe(i,o){if(i&1&&(v(0),u(1,mXe,3,13,"div",2),C()),i&2){let n=l().ngIf;m(),d("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 gXe(i,o){if(i&1&&(v(0),u(1,pXe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,lXe,n.conditionSignal(),A(1,$ge,n.componentConfigSignal)))}}var u_=(()=>{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&&u(0,gXe,2,6,"ng-container",0),t&2&&d("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 hXe=["customContainerRef"],fXe=["*"],Hge=i=>({componentConfigSignal:i}),vXe=(i,o)=>({condition:i,data:o}),CXe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-header-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function _Xe(i,o){if(i&1&&(_(0,"div",6,0),P(2,"translate"),jt(3),b()),i&2){let n=l(5);x("data-testid",n.componentId+"-custom")("aria-label",M(2,2,"Comment dialog header"))}}function yXe(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),d("componentConfigSignal",n.componentConfigSignal),x("data-testid",n.componentId+"-status"),m(),d("componentConfigSignal",n.componentConfigSignal),x("data-testid",n.componentId+"-priority"),m(),d("componentConfigSignal",n.componentConfigSignal),x("data-testid",n.componentId+"-custom-annotation-dropdown"),m(),x("data-testid",n.componentId+"-fill"),m(),d("componentConfigSignal",n.componentConfigSignal),x("data-testid",n.componentId+"-options"),m(),d("componentConfigSignal",n.componentConfigSignal),x("data-testid",n.componentId+"-copy-link"),m(),d("componentConfigSignal",n.componentConfigSignal),x("data-testid",n.componentId+"-resolve-button"),m(),d("componentConfigSignal",n.componentConfigSignal),x("data-testid",n.componentId+"-unresolve-button")}}function SXe(i,o){if(i&1&&(_(0,"div",9),w(1,"app-comment-dialog-comment-number",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(),d("componentConfigSignal",n.componentConfigSignal),x("data-testid",n.componentId+"-comment-number"),m(),d("componentConfigSignal",n.componentConfigSignal),x("data-testid",n.componentId+"-comment-category"),m(),x("data-testid",n.componentId+"-fill"),m(),d("componentConfigSignal",n.componentConfigSignal),x("data-testid",n.componentId+"-comment-suggestion-status"),m(),d("componentConfigSignal",n.componentConfigSignal),x("data-testid",n.componentId+"-priority"),m(),d("componentConfigSignal",n.componentConfigSignal),x("data-testid",n.componentId+"-status"),m(),d("componentConfigSignal",n.componentConfigSignal),x("data-testid",n.componentId+"-navigation-button")}}function bXe(i,o){if(i&1&&(v(0),u(1,_Xe,4,4,"div",4)(2,yXe,10,20,"div",4)(3,SXe,8,13,"div",5),C()),i&2){let n=l(3).ngIf,e=l();m(),d("ngIf",!e.showDefaultContent),m(),d("ngIf",e.showDefaultContent()&&!(n!=null&&n.sidebarMode)),m(),d("ngIf",e.showDefaultContent()&&(n==null?null:n.sidebarMode))}}function IXe(i,o){if(i&1&&(v(0),u(1,bXe,4,3,"ng-container",3),C()),i&2){let n=l(2).ngIf,e=l();m(),d("veltDynamicTemplate",$(3,CXe,e.template,A(1,Hge,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function EXe(i,o){if(i&1&&(v(0),u(1,IXe,2,9,"ng-container",1),C()),i&2){let n=l().ngIf;m(),d("ngIf",n==null||n.annotation==null||n.annotation.comments==null?null:n.annotation.comments.length)}}function xXe(i,o){if(i&1&&(v(0),u(1,EXe,2,1,"ng-container",2),C()),i&2){let n=l();m(),d("veltIf",k(3,vXe,n.conditionSignal(),A(1,Hge,n.componentConfigSignal)))}}var h_=(()=>{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=Ee(!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&&it(hXe,5),t&2){let a;Xe(a=Qe())&&(r.customContainerRef=a.first)}},standalone:!1,features:[V([S]),B],ngContentSelectors:fXe,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&&(Ht(),u(0,xXe,2,6,"ng-container",1)),t&2&&d("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 zge=i=>({componentConfigSignal:i}),DXe=(i,o)=>({condition:i,data:o}),wXe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-more-reply-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function OXe(i,o){if(i&1&&(_(0,"div",4),te(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(),ye(" ",(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 AXe(i,o){if(i&1){let n=K();v(0),_(1,"div",2),P(2,"translate"),P(3,"translate"),W("click",function(t){N(n);let r=l(2).ngIf;return r==null||r.onMoreRepliesClick(),F(t.stopPropagation())}),u(4,OXe,4,7,"div",3),b(),C()}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),d("veltDynamicTemplate",$(9,wXe,e.template,A(7,zge,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function PXe(i,o){if(i&1&&(v(0),u(1,AXe,5,15,"ng-container",0),C()),i&2){let n=l().ngIf,e=l();m(),d("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 MXe(i,o){if(i&1&&(v(0),u(1,PXe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,DXe,n.conditionSignal(),A(1,zge,n.componentConfigSignal)))}}var dE=(()=>{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(Le))},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&&u(0,MXe,2,6,"ng-container",0),t&2&&d("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 Gge=i=>({componentConfigSignal:i}),kXe=(i,o)=>({condition:i,data:o}),RXe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-options-wireframe",variant:n,setIfCondition:e,componentElementRef:t,replaceTemplate:!1});function NXe(i,o){if(i&1){let n=K();v(0),_(1,"app-comment-dialog-options-dropdown",3),W("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(),C()}if(i&2){let n=l(3).ngIf,e=l();m(),d("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.isPrivateCommentAllowed))("isUserAdmin",!!(n!=null&&n.isUserAdmin))("shadowDom",n.dialogShadowDOM)("contentTemplate",e.contentTemplate)("triggerTemplate",e.triggerTemplate)}}function FXe(i,o){if(i&1&&(v(0),w(1,"app-comment-dialog-assign-menu",4),C()),i&2){let n=l(4);m(),d("componentConfigSignal",n.componentConfigSignal)}}function LXe(i,o){if(i&1&&(v(0),u(1,NXe,2,12,"ng-container",0)(2,FXe,2,1,"ng-container",0),C()),i&2){let n=l(2).ngIf;m(),d("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(),d("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 BXe(i,o){if(i&1&&(v(0),u(1,LXe,3,2,"ng-container",2),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(3,RXe,e.template,A(1,Gge,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function VXe(i,o){if(i&1&&(v(0),u(1,BXe,2,9,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,kXe,n.conditionSignal(),A(1,Gge,n.componentConfigSignal)))}}var mE=(()=>{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");qe(e)||(this.triggerTemplate=e)}if(!this.contentTemplate&&this.template){let e=this.template.querySelector("velt-comment-dialog-options-dropdown-content-wireframe");qe(e)||(this.contentTemplate=e)}}catchError(e,t,r){try{this.loggingService.catch(e,t,D(E({},r||{}),{annotationId:this.componentConfigSignal()?.annotation?.annotationId}))}catch{}}};o.\u0275fac=function(t){return new(t||o)(h(R),h(y),h(S),h(ze))},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&&u(0,VXe,2,6,"ng-container",0),t&2&&d("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 Wge=i=>({componentConfigSignal:i}),UXe=(i,o)=>({condition:i,data:o}),jXe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-priority-wireframe",variant:n,setIfCondition:e,componentElementRef:t,replaceTemplate:!1});function $Xe(i,o){if(i&1){let n=K();v(0),_(1,"velt-comment-dialog-priority-dropdown-internal",3),W("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(),C()}if(i&2){let n=l(3).ngIf,e=l();m(),d("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 HXe(i,o){if(i&1&&(v(0),u(1,$Xe,2,9,"ng-container",0),C()),i&2){let n=l(2).ngIf;m(),d("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 zXe(i,o){if(i&1&&(v(0),u(1,HXe,2,1,"ng-container",2),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(3,jXe,e.template,A(1,Wge,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function GXe(i,o){if(i&1&&(v(0),u(1,zXe,2,9,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,UXe,n.conditionSignal(),A(1,Wge,n.componentConfigSignal)))}}var pE=(()=>{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");qe(e)||(this.triggerTemplate=e)}if(!this.contentTemplate&&this.template){let e=this.template.querySelector("velt-comment-dialog-priority-dropdown-content-wireframe");qe(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,D(E({},r||{}),{annotationId:this.componentConfigSignal()?.annotation?.annotationId}))}catch{}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(ze),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&&u(0,GXe,2,6,"ng-container",0),t&2&&d("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 qge=i=>({componentConfigSignal:i}),WXe=(i,o)=>({condition:i,data:o}),qXe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-private-badge-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function YXe(i,o){if(i&1&&(_(0,"button",3),P(1,"translate"),ce(),_(2,"svg",4),w(3,"path",5)(4,"path",6),b(),te(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),ye(" ",M(6,5,"Only for your team")," ")}}function KXe(i,o){if(i&1&&(v(0),u(1,YXe,7,7,"button",2),C()),i&2){let n=l(2).ngIf,e=l();m(),d("veltDynamicTemplate",$(3,qXe,e.template,A(1,qge,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function ZXe(i,o){if(i&1&&(v(0),u(1,KXe,2,9,"ng-container",0),C()),i&2){let n=l().ngIf;m(),d("ngIf",(n==null?null:n.isPrivateComment)&&!(!(n==null||n.annotation==null||n.annotation.comments==null)&&n.annotation.comments.length))}}function XXe(i,o){if(i&1&&(v(0),u(1,ZXe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,WXe,n.conditionSignal(),A(1,qge,n.componentConfigSignal)))}}var gE=(()=>{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&&u(0,XXe,2,6,"ng-container",0),t&2&&d("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 Yge=i=>({componentConfigSignal:i}),QXe=(i,o)=>({condition:i,data:o}),JXe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-private-banner-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function eQe(i,o){if(i&1&&(_(0,"div",3),P(1,"translate"),ce(),_(2,"svg",4),w(3,"path",5)(4,"path",6),b(),te(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),ye(" ",M(6,6,"Only for your team")," ")}}function tQe(i,o){if(i&1&&(v(0),u(1,eQe,7,8,"div",2),C()),i&2){let n=l(2).ngIf,e=l();m(),d("veltDynamicTemplate",$(3,JXe,e.template,A(1,Yge,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function nQe(i,o){if(i&1&&(v(0),u(1,tQe,2,9,"ng-container",0),C()),i&2){let n=l().ngIf;m(),d("ngIf",(n==null?null:n.isPrivateComment)&&(n==null||n.annotation==null||n.annotation.comments==null?null:n.annotation.comments.length))}}function iQe(i,o){if(i&1&&(v(0),u(1,nQe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,QXe,n.conditionSignal(),A(1,Yge,n.componentConfigSignal)))}}var f_=(()=>{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&&u(0,iQe,2,6,"ng-container",0),t&2&&d("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 Kge=i=>({componentConfigSignal:i}),rQe=(i,o)=>({condition:i,data:o}),aQe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-resolve-button-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function sQe(i,o){if(i&1&&(v(0),ce(),_(1,"svg",5),w(2,"path",6),b(),C()),i&2){let n=l(4);m(),x("data-testid",n.componentId+"-icon")}}function lQe(i,o){if(i&1){let n=K();_(0,"app-resolve-button",3),P(1,"translate"),W("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())}),u(2,sQe,3,1,"ng-container",4),b()}if(i&2){let n=l(2).ngIf,e=l();d("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),d("veltDynamicTemplate",$(11,aQe,e.template,A(9,Kge,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function cQe(i,o){if(i&1&&(v(0),u(1,lQe,3,17,"app-resolve-button",2),C()),i&2){let n=l().ngIf;m(),d("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 dQe(i,o){if(i&1&&(v(0),u(1,cQe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,rQe,n.conditionSignal(),A(1,Kge,n.componentConfigSignal)))}}var v_=(()=>{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&&u(0,dQe,2,6,"ng-container",0),t&2&&d("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 Zge=i=>({componentConfigSignal:i}),mQe=(i,o)=>({condition:i,data:o}),pQe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-sign-in-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function gQe(i,o){if(i&1&&(v(0),w(1,"div",5),_(2,"div",6),P(3,"translate"),te(4),P(5,"translate"),b(),C()),i&2){let n=l(4);m(2),x("data-testid",n.componentId+"-button")("aria-label",M(3,3,"Sign In")),m(2),ye(" ",M(5,5,"Sign In"))}}function uQe(i,o){if(i&1){let n=K();_(0,"div",3),W("click",function(t){N(n);let r=l(2).ngIf;return r==null||r.onSignInClick(),F(t.stopPropagation())}),u(1,gQe,6,7,"ng-container",4),b()}if(i&2){let n=l(2).ngIf,e=l();x("data-testid",e.componentId+"-container"),m(),d("veltDynamicTemplate",$(4,pQe,e.template,A(2,Zge,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function hQe(i,o){if(i&1&&(v(0),u(1,uQe,2,10,"ng-template",2),C()),i&2){let n=l().ngIf;m(),d("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 fQe(i,o){if(i&1&&(v(0),u(1,hQe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,mQe,n.conditionSignal(),A(1,Zge,n.componentConfigSignal)))}}var C_=(()=>{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&&u(0,fQe,2,6,"ng-container",0),t&2&&d("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 Xge=i=>({componentConfigSignal:i}),CQe=(i,o)=>({condition:i,data:o}),_Qe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-status-wireframe",variant:n,setIfCondition:e,componentElementRef:t,replaceTemplate:!1});function yQe(i,o){if(i&1){let n=K();_(0,"app-comment-dialog-status-dropdown",4),P(1,"translate"),W("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();d("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 SQe(i,o){if(i&1&&(v(0),u(1,yQe,2,15,"app-comment-dialog-status-dropdown",3),C()),i&2){let n=l(3).ngIf;m(),d("ngIf",n==null?null:n.enableStatus)}}function bQe(i,o){if(i&1&&(v(0),u(1,SQe,2,1,"ng-container",0),C()),i&2){let n=l(2).ngIf;m(),d("ngIf",(n==null||n.annotation==null||n.annotation.comments==null?null:n.annotation.comments.length)&&!(n!=null&&n.inlineCommentMode))}}function IQe(i,o){if(i&1&&(v(0),u(1,bQe,2,1,"ng-container",2),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(3,_Qe,e.template,A(1,Xge,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function EQe(i,o){if(i&1&&(v(0),u(1,IQe,2,9,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,CQe,n.conditionSignal(),A(1,Xge,n.componentConfigSignal)))}}var uE=(()=>{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");qe(e)||(this.triggerTemplate=e)}if(!this.contentTemplate&&this.template){let e=this.template.querySelector("velt-comment-dialog-status-dropdown-content-wireframe");qe(e)||(this.triggerTemplate=e)}}catchError(e,t,r){try{this.loggingService.catch(e,t,D(E({},r||{}),{annotationId:this.componentConfigSignal()?.annotation?.annotationId}))}catch{}}};o.\u0275fac=function(t){return new(t||o)(h(y),h(ze),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&&u(0,EQe,2,6,"ng-container",0),t&2&&d("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 Qge=i=>({componentConfigSignal:i}),xQe=(i,o)=>({condition:i,data:o}),TQe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-suggestion-action-accept-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function DQe(i,o){if(i&1&&(_(0,"div",4),P(1,"translate"),te(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),ye(" ",M(3,5,"Accept")," ")}}function wQe(i,o){if(i&1){let n=K();v(0),_(1,"div",2),W("click",function(t){N(n);let r=l().ngIf;return r==null||r.acceptCommentPinAnnotation(),F(t.stopPropagation())}),u(2,DQe,4,7,"div",3),b(),C()}if(i&2){let n=l().ngIf,e=l();m(),x("data-testid",e.componentId),m(),d("veltDynamicTemplate",$(4,TQe,e.template,A(2,Qge,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function OQe(i,o){if(i&1&&(v(0),u(1,wQe,3,10,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,xQe,n.conditionSignal(),A(1,Qge,n.componentConfigSignal)))}}var hE=(()=>{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&&u(0,OQe,2,6,"ng-container",0),t&2&&d("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 Jge=i=>({componentConfigSignal:i}),AQe=(i,o)=>({condition:i,data:o}),PQe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-suggestion-action-reject-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function MQe(i,o){if(i&1&&(_(0,"div",4),P(1,"translate"),te(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),ye(" ",M(3,5,"Reject")," ")}}function kQe(i,o){if(i&1){let n=K();v(0),_(1,"div",2),W("click",function(t){N(n);let r=l().ngIf;return r==null||r.rejectCommentPinAnnotation(),F(t.stopPropagation())}),u(2,MQe,4,7,"div",3),b(),C()}if(i&2){let n=l().ngIf,e=l();m(),x("data-testid",e.componentId),m(),d("veltDynamicTemplate",$(4,PQe,e.template,A(2,Jge,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function RQe(i,o){if(i&1&&(v(0),u(1,kQe,3,10,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,AQe,n.conditionSignal(),A(1,Jge,n.componentConfigSignal)))}}var fE=(()=>{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&&u(0,RQe,2,6,"ng-container",0),t&2&&d("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 eue=i=>({componentConfigSignal:i}),NQe=(i,o)=>({condition:i,data:o}),FQe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-suggestion-action-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function LQe(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),d("componentConfigSignal",n.componentConfigSignal),x("data-testid",n.componentId+"-accept"),m(),d("componentConfigSignal",n.componentConfigSignal),x("data-testid",n.componentId+"-reject")}}function BQe(i,o){if(i&1&&(v(0),u(1,LQe,4,8,"div",2),C()),i&2){let n=l(2).ngIf,e=l();m(),d("veltDynamicTemplate",$(3,FQe,e.template,A(1,eue,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function VQe(i,o){if(i&1&&(v(0),u(1,BQe,2,9,"ng-container",0),C()),i&2){let n=l().ngIf;m(),d("ngIf",n==null?null:n.showSuggestionModeActions)}}function UQe(i,o){if(i&1&&(v(0),u(1,VQe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(3,NQe,n.conditionSignal(),A(1,eue,n.componentConfigSignal)))}}var __=(()=>{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&&u(0,UQe,2,6,"ng-container",0),t&2&&d("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 tue=(i,o,n)=>({componentConfigSignal:i,commentObj:o,i:n}),$Qe=(i,o)=>({condition:i,data:o}),HQe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-thread-card-avatar-wireframe",variant:n,setIfCondition:e,componentElementRef:t});function zQe(i,o){if(i&1&&(v(0),w(1,"snippyly-user-avatar",3),P(2,"translate"),P(3,"translate"),C()),i&2){let n=l(4);m(),d("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 GQe(i,o){if(i&1&&(v(0),u(1,zQe,4,8,"ng-container",0),C()),i&2){let n=l(3);m(),d("ngIf",n.commentObj)}}function WQe(i,o){if(i&1&&(v(0),u(1,GQe,2,1,"ng-container",2),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(5,HQe,e.template,$e(1,tue,e.componentConfigSignal,e.commentObj,e.i),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function qQe(i,o){if(i&1&&(v(0),u(1,WQe,2,11,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(5,$Qe,n.conditionSignal(),$e(1,tue,n.componentConfigSignal,n.commentObj,n.i)))}}var vE=(()=>{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&&u(0,qQe,2,8,"ng-container",0),t&2&&d("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 nue=(i,o,n)=>({componentConfigSignal:i,commentObj:o,i:n}),YQe=(i,o)=>({condition:i,data:o}),KQe=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-thread-card-device-type-wireframe",variant:n,setIfCondition:e,componentElementRef:t}),ZQe=i=>({$implicit:i}),XQe=()=>[];function QQe(i,o){i&1&&He(0)}function JQe(i,o){if(i&1&&(_(0,"div",7),u(1,QQe,1,0,"ng-container",8),b()),i&2){l();let n=me(3),e=l(2).ngIf,t=l();x("data-testid",t.componentId),m(),d("ngTemplateOutlet",n)("ngTemplateOutletContext",A(3,ZQe,e==null?null:e.deviceType))}}function eJe(i,o){if(i&1&&w(0,"app-device-type-icons",10),i&2){let n=l().$implicit,e=l(4);d("deviceType",n),x("data-testid",e.componentId+"-icons")}}function tJe(i,o){if(i&1&&(_(0,"div",11)(1,"div"),te(2),P(3,"translate"),b(),_(4,"div"),te(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),Nv("",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),ye("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 nJe(i,o){if(i&1&&(_(0,"app-overlay-tooltip",9),u(1,eJe,1,2,"ng-template",null,1,xe)(3,tJe,7,11,"ng-template",null,2,xe),b()),i&2){let n=l(3).ngIf,e=l();d("positions",(n==null?null:n.deviceInfoTooltipPositions)||gt(2,XQe)),x("data-testid",e.componentId+"-tooltip")}}function iJe(i,o){if(i&1&&(v(0),u(1,JQe,2,5,"div",6)(2,nJe,5,3,"ng-template",null,0,xe),C()),i&2){let n=l(2).ngIf,e=l();m(),d("ngIf",!e.i&&(n==null?null:n.showScreenSizeInfo))}}function oJe(i,o){if(i&1&&(v(0),u(1,iJe,4,1,"ng-container",5),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(5,KQe,e.template,$e(1,nue,e.componentConfigSignal,e.commentObj,e.i),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function rJe(i,o){if(i&1&&(v(0),u(1,oJe,2,11,"ng-container",4),C()),i&2){let n=l();m(),d("veltIf",k(5,YQe,n.conditionSignal(),$e(1,nue,n.componentConfigSignal,n.commentObj,n.i)))}}var CE=(()=>{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&&u(0,rJe,2,8,"ng-container",3),t&2&&d("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 iue=(i,o,n,e)=>({componentConfigSignal:i,attachment:o,attachmentIndex:n,commentObj:e}),aJe=(i,o)=>({condition:i,data:o}),sJe=(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 lJe(i,o){if(i&1){let n=K();v(0),_(1,"snippyly-lightbox",4,0)(3,"img",5),P(4,"translate"),P(5,"translate"),W("click",function(){N(n);let t=me(2);return F(t==null?null:t.openImageInFullScreen())}),b()(),C()}if(i&2){let n=l(3);m(),d("src",n.attachment==null?null:n.attachment.url),x("data-testid",n.componentId+"-lightbox"),m(2),d("src",n.attachment==null?null:n.attachment.url,fn)("alt",M(4,5,"Attachment")+" "+M(5,7,(n.attachment==null?null:n.attachment.name)||"preview")),x("data-testid",n.componentId+"-image")}}function cJe(i,o){if(i&1&&(v(0),u(1,lJe,6,9,"ng-container",3),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(6,sJe,e.template,mt(1,iue,e.componentConfigSignal,e.attachment,e.attachmentIndex,e.commentObj),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function dJe(i,o){if(i&1&&(v(0),u(1,cJe,2,12,"ng-container",2),C()),i&2){let n=l();m(),d("veltIf",k(6,aJe,n.conditionSignal(),mt(1,iue,n.componentConfigSignal,n.attachment,n.attachmentIndex,n.commentObj)))}}var _E=(()=>{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&&u(0,dJe,2,9,"ng-container",1),t&2&&d("ngIf",r.componentConfigSignal())},styles:["img[_ngcontent-%COMP%]{width:100%;object-fit:cover}"],changeDetection:0});let i=o;return i})();var oue=(i,o,n,e)=>({componentConfigSignal:i,commentObj:o,attachmentIndex:n,attachment:e}),mJe=(i,o)=>({condition:i,data:o}),pJe=(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 gJe(i,o){if(i&1&&(v(0),_(1,"div",5),ce(),_(2,"svg",6),w(3,"path",7)(4,"path",8),b()(),C()),i&2){let n=l(4);m(2),x("data-testid",n.componentId+"-icon")}}function uJe(i,o){if(i&1){let n=K();_(0,"div",3),P(1,"translate"),P(2,"translate"),W("click",function(t){N(n);let r=l(2).ngIf,a=l();return r==null||r.removeAttachment(a.attachmentIndex,a.commentObj),F(t.stopPropagation())}),u(3,gJe,5,1,"ng-container",4),b()}if(i&2){let n=l(2).ngIf,e=l();d("title",M(1,4,"Delete Attachment")),x("aria-label",M(2,6,"Delete Attachment"))("data-testid",e.componentId),m(3),d("veltDynamicTemplate",$(13,pJe,e.template,mt(8,oue,e.componentConfigSignal,e.commentObj,e.attachmentIndex,e.attachment),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function hJe(i,o){if(i&1&&(v(0),u(1,uJe,4,19,"div",2),C()),i&2){let n=l().ngIf,e=l();m(),d("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 fJe(i,o){if(i&1&&(v(0),u(1,hJe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(6,mJe,n.conditionSignal(),mt(1,oue,n.componentConfigSignal,n.commentObj,n.attachmentIndex,n.attachment)))}}var yE=(()=>{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&&u(0,fJe,2,9,"ng-container",0),t&2&&d("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 rue=(i,o,n,e)=>({componentConfigSignal:i,commentObj:o,attachmentIndex:n,attachment:e}),vJe=(i,o)=>({condition:i,data:o}),CJe=(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 _Je(i,o){if(i&1&&(v(0),_(1,"div",5),ce(),_(2,"svg",6)(3,"g"),w(4,"rect",7),b(),_(5,"g"),w(6,"path",8),b()()(),C()),i&2){let n=l(4);m(2),x("data-testid",n.componentId+"-icon")}}function yJe(i,o){if(i&1){let n=K();_(0,"div",3),P(1,"translate"),P(2,"translate"),W("click",function(t){N(n);let r=l(2).ngIf,a=l();return r==null||r.downloadAttachment(a.attachment),F(t.stopPropagation())}),u(3,_Je,7,1,"ng-container",4),b()}if(i&2){let n=l(2).ngIf,e=l();d("title",M(1,4,"Download Attachment")),x("aria-label",M(2,6,"Download Attachment"))("data-testid",e.componentId),m(3),d("veltDynamicTemplate",$(13,CJe,e.template,mt(8,rue,e.componentConfigSignal,e.commentObj,e.attachmentIndex,e.attachment),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function SJe(i,o){if(i&1&&(v(0),u(1,yJe,4,19,"div",2),C()),i&2){let n=l().ngIf;m(),d("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 bJe(i,o){if(i&1&&(v(0),u(1,SJe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(6,vJe,n.conditionSignal(),mt(1,rue,n.componentConfigSignal,n.commentObj,n.attachmentIndex,n.attachment)))}}var SE=(()=>{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&&u(0,bJe,2,9,"ng-container",0),t&2&&d("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 aue=(i,o,n,e)=>({componentConfigSignal:i,attachmentIndex:o,attachment:n,commentObj:e}),IJe=(i,o)=>({condition:i,data:o}),EJe=(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 xJe(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),d("componentConfigSignal",n.componentConfigSignal)("attachmentIndex",n.attachmentIndex)("commentObj",n.commentObj)("attachment",n.attachment),m(),d("componentConfigSignal",n.componentConfigSignal)("attachmentIndex",n.attachmentIndex)("commentObj",n.commentObj)("attachment",n.attachment)}}function TJe(i,o){if(i&1&&(v(0),_(1,"div",5),P(2,"translate"),u(3,xJe,4,12,"div",6),w(4,"app-comment-dialog-thread-card-attachments-image-preview",7),b(),C()),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),d("ngIf",!(n!=null&&n.readOnly)),m(),d("componentConfigSignal",e.componentConfigSignal)("attachmentIndex",e.attachmentIndex)("commentObj",e.commentObj)("attachment",e.attachment)}}function DJe(i,o){if(i&1&&(v(0),u(1,TJe,5,9,"ng-container",4),C()),i&2){l(2);let n=me(3),e=l();m(),d("ngIf",!e.showLoadingTemplate)("ngIfElse",n)}}function wJe(i,o){if(i&1&&(v(0),u(1,DJe,2,2,"ng-container",3),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(6,EJe,e.template,mt(1,aue,e.componentConfigSignal,e.attachmentIndex,e.attachment,e.commentObj),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function OJe(i,o){i&1&&w(0,"velt-skeleton-loader-internal",9)}function AJe(i,o){if(i&1&&(v(0),u(1,wJe,2,12,"ng-container",2)(2,OJe,1,0,"ng-template",null,0,xe),C()),i&2){let n=l();m(),d("veltIf",k(6,IJe,n.conditionSignal(),mt(1,aue,n.componentConfigSignal,n.attachmentIndex,n.attachment,n.commentObj)))}}var bE=(()=>{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(Le),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&&u(0,AJe,4,9,"ng-container",1),t&2&&d("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 PJe=(i,o,n,e)=>({componentConfigSignal:i,commentObj:o,attachmentIndex:n,attachment:e}),MJe=(i,o)=>({condition:i,data:o}),kJe=i=>({componentConfigSignal:i}),RJe=(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 NJe(i,o){if(i&1&&(v(0),_(1,"div",5),ce(),_(2,"svg",6),w(3,"path",7),b()(),C()),i&2){let n=l(4);m(),x("data-testid",n.componentId+"-icon")}}function FJe(i,o){if(i&1){let n=K();_(0,"button",3),P(1,"translate"),W("click",function(t){N(n);let r=l(2).ngIf,a=l();return r==null||r.removeAttachment(a.attachmentIndex,a.commentObj),F(t.stopPropagation())}),u(2,NJe,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),d("veltDynamicTemplate",$(7,RJe,e.template,A(5,kJe,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function LJe(i,o){if(i&1&&(v(0),u(1,FJe,3,13,"button",2),C()),i&2){let n=l().ngIf,e=l();m(),d("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 BJe(i,o){if(i&1&&(v(0),u(1,LJe,2,1,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(6,MJe,n.conditionSignal(),mt(1,PJe,n.componentConfigSignal,n.commentObj,n.attachmentIndex,n.attachment)))}}var IE=(()=>{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&&u(0,BJe,2,9,"ng-container",0),t&2&&d("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 VJe=(i,o,n,e)=>({componentConfigSignal:i,commentObj:o,attachmentIndex:n,attachment:e}),UJe=(i,o)=>({condition:i,data:o}),jJe=i=>({componentConfigSignal:i}),$Je=(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 HJe(i,o){if(i&1&&(v(0),_(1,"div",4),ce(),_(2,"svg",5),w(3,"path",6),b()(),C()),i&2){let n=l(3);m(),x("data-testid",n.componentId+"-icon")}}function zJe(i,o){if(i&1){let n=K();v(0),_(1,"button",2),P(2,"translate"),P(3,"translate"),W("click",function(t){N(n);let r=l().ngIf,a=l();return r==null||r.downloadAttachment(a.attachment),F(t.stopPropagation())}),u(4,HJe,4,1,"ng-container",3),b(),C()}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),d("veltDynamicTemplate",$(10,$Je,e.template,A(8,jJe,e.componentConfigSignal),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function GJe(i,o){if(i&1&&(v(0),u(1,zJe,5,16,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(6,UJe,n.conditionSignal(),mt(1,VJe,n.componentConfigSignal,n.commentObj,n.attachmentIndex,n.attachment)))}}var EE=(()=>{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&&u(0,GJe,2,9,"ng-container",0),t&2&&d("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 sue=(i,o,n,e)=>({componentConfigSignal:i,attachment:o,attachmentIndex:n,commentObj:e}),WJe=(i,o)=>({condition:i,data:o}),qJe=(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 YJe(i,o){if(i&1&&(v(0),w(1,"velt-file-icon-internal",3),C()),i&2){let n=l(3);m(),d("type",n.attachment==null?null:n.attachment.mimeType),x("data-testid",n.componentId)}}function KJe(i,o){if(i&1&&(v(0),u(1,YJe,2,2,"ng-container",2),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(6,qJe,e.template,mt(1,sue,e.componentConfigSignal,e.attachment,e.attachmentIndex,e.commentObj),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function ZJe(i,o){if(i&1&&(v(0),u(1,KJe,2,12,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(6,WJe,n.conditionSignal(),mt(1,sue,n.componentConfigSignal,n.attachment,n.attachmentIndex,n.commentObj)))}}var xE=(()=>{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&&u(0,ZJe,2,9,"ng-container",0),t&2&&d("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 lue=(i,o,n,e)=>({componentConfigSignal:i,attachment:o,attachmentIndex:n,commentObj:e}),XJe=(i,o)=>({condition:i,data:o}),QJe=(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 JJe(i,o){if(i&1&&(v(0),_(1,"span",3),P(2,"translate"),te(3),P(4,"translate"),b(),C()),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),Ge(M(4,5,n.attachment==null?null:n.attachment.name))}}function eet(i,o){if(i&1&&(v(0),u(1,JJe,5,7,"ng-container",2),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(6,QJe,e.template,mt(1,lue,e.componentConfigSignal,e.attachment,e.attachmentIndex,e.commentObj),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function tet(i,o){if(i&1&&(v(0),u(1,eet,2,12,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(6,XJe,n.conditionSignal(),mt(1,lue,n.componentConfigSignal,n.attachment,n.attachmentIndex,n.commentObj)))}}var TE=(()=>{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&&u(0,tet,2,9,"ng-container",0),t&2&&d("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 cue=(i,o,n,e)=>({componentConfigSignal:i,attachment:o,attachmentIndex:n,commentObj:e}),net=(i,o)=>({condition:i,data:o}),iet=(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 oet(i,o){if(i&1&&(v(0),_(1,"span",3),P(2,"translate"),P(3,"fileSize"),te(4),P(5,"fileSize"),b(),C()),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),Ge(M(5,7,n.attachment==null?null:n.attachment.size))}}function ret(i,o){if(i&1&&(v(0),u(1,oet,6,9,"ng-container",2),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(6,iet,e.template,mt(1,cue,e.componentConfigSignal,e.attachment,e.attachmentIndex,e.commentObj),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function aet(i,o){if(i&1&&(v(0),u(1,ret,2,12,"ng-container",1),C()),i&2){let n=l();m(),d("veltIf",k(6,net,n.conditionSignal(),mt(1,cue,n.componentConfigSignal,n.attachment,n.attachmentIndex,n.commentObj)))}}var DE=(()=>{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&&u(0,aet,2,9,"ng-container",0),t&2&&d("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 due=(i,o,n,e)=>({componentConfigSignal:i,attachmentIndex:o,commentObj:n,attachment:e}),set=(i,o)=>({condition:i,data:o}),cet=(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 det(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(),d("componentConfigSignal",n.componentConfigSignal)("attachmentIndex",n.attachmentIndex)("commentObj",n.commentObj)("attachment",n.attachment),m(),d("componentConfigSignal",n.componentConfigSignal)("attachmentIndex",n.attachmentIndex)("commentObj",n.commentObj)("attachment",n.attachment)}}function met(i,o){if(i&1&&(v(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(),u(8,det,3,10,"div",9),b(),C()),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(),d("componentConfigSignal",e.componentConfigSignal)("attachmentIndex",e.attachmentIndex)("commentObj",e.commentObj)("attachment",e.attachment),m(),x("data-testid",e.componentId+"-details")("aria-label","Attachment details"),m(),d("componentConfigSignal",e.componentConfigSignal)("attachmentIndex",e.attachmentIndex)("commentObj",e.commentObj)("attachment",e.attachment),m(),d("componentConfigSignal",e.componentConfigSignal)("attachmentIndex",e.attachmentIndex)("commentObj",e.commentObj)("attachment",e.attachment),m(),d("ngIf",!(n!=null&&n.readOnly))}}function pet(i,o){if(i&1&&(v(0),u(1,met,9,20,"ng-container",4),C()),i&2){l(2);let n=me(3),e=l();m(),d("ngIf",!e.showLoadingTemplate)("ngIfElse",n)}}function get(i,o){if(i&1&&(v(0),u(1,pet,2,2,"ng-container",3),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(6,cet,e.template,mt(1,due,e.componentConfigSignal,e.attachmentIndex,e.commentObj,e.attachment),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function uet(i,o){i&1&&w(0,"velt-skeleton-loader-internal",11)}function het(i,o){if(i&1&&(v(0),u(1,get,2,12,"ng-container",2)(2,uet,1,0,"ng-template",null,0,xe),C()),i&2){let n=l();m(),d("veltIf",k(6,set,n.conditionSignal(),mt(1,due,n.componentConfigSignal,n.attachmentIndex,n.commentObj,n.attachment)))}}var wE=(()=>{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(Le),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&&u(0,het,4,9,"ng-container",1),t&2&&d("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 mue=(i,o,n)=>({componentConfigSignal:i,commentObj:o,i:n}),fet=(i,o)=>({condition:i,data:o}),vet=(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 Cet(i,o){i&1&&He(0)}function _et(i,o){if(i&1&&(v(0),u(1,Cet,1,0,"ng-container",9),C()),i&2){l();let n=me(5);m(),d("ngTemplateOutlet",n)}}function yet(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);d("componentConfigSignal",r.componentConfigSignal)("attachment",e)("commentObj",r.commentObj)("attachmentIndex",t)("otherWireframe",r.otherWireframe)}}function bet(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);d("componentConfigSignal",r.componentConfigSignal)("attachmentIndex",t)("commentObj",r.commentObj)("attachment",e)("imageWireframe",r.imageWireframe)}}function Iet(i,o){if(i&1&&(v(0),u(1,_et,2,1,"ng-container",8)(2,yet,1,5,"ng-template",null,0,xe)(4,bet,1,5,"ng-template",null,1,xe),C()),i&2){let n=o.$implicit,e=me(3);m(),d("ngIf",n==null||n.mimeType==null?null:n.mimeType.includes("image"))("ngIfElse",e)}}function Eet(i,o){if(i&1&&(_(0,"div",6),P(1,"translate"),u(2,Iet,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),d("ngForOf",e.commentObj==null?null:e.commentObj.attachments)("ngForTrackBy",n==null?null:n.trackByAttachmentId)}}function xet(i,o){if(i&1&&(v(0),u(1,Eet,3,6,"div",5),C()),i&2){let n=l(4);m(),d("ngIf",n.commentObj==null||n.commentObj.attachments==null?null:n.commentObj.attachments.length)}}function Tet(i,o){if(i&1&&(v(0),u(1,xet,2,1,"ng-container",2),C()),i&2){let n=l(3);m(),d("ngIf",n.commentObj)}}function Det(i,o){if(i&1&&(v(0),u(1,Tet,2,1,"ng-container",4),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(5,vet,e.template,$e(1,mue,e.componentConfigSignal,e.commentObj,e.i),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function wet(i,o){if(i&1&&(v(0),u(1,Det,2,11,"ng-container",3),C()),i&2){let n=l();m(),d("veltIf",k(5,fet,n.conditionSignal(),$e(1,mue,n.componentConfigSignal,n.commentObj,n.i)))}}var OE=(()=>{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&&u(0,wet,2,8,"ng-container",2),t&2&&d("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 pue=(i,o,n)=>({componentConfigSignal:i,commentObj:o,i:n}),Oet=(i,o)=>({condition:i,data:o}),Aet=(i,o,n,e,t)=>({template:i,context:o,componentName:"velt-comment-dialog-thread-card-message-wireframe",variant:n,setIfCondition:e,componentElementRef:t}),Pet=(i,o,n,e,t)=>[i,o,n,e,t];function Met(i,o){if(i&1){let n=K();_(0,"div",7),P(1,"translate"),W("copy",function(t){return N(n),F(t.stopPropagation())}),te(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,8,"Comment")+" "+(e.i+1))("data-comment-id",e.commentObj==null?null:e.commentObj.commentId),m(2),ye(" ",M(3,10,e.commentObj.commentText)," ")}}function ket(i,o){if(i&1){let n=K();_(0,"div",8),P(1,"sanitizeHtml"),P(2,"replaceAutocompleteList"),P(3,"safeHtml"),P(4,"translate"),W("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),d("innerHTML",Za(3,16,GL(2,10,$(21,Pet,M(1,8,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),to),x("data-testid",e.componentId+"-html")("aria-label",M(4,19,"Comment")+" "+(e.i+1))("data-comment-id",e.commentObj==null?null:e.commentObj.commentId)}}function Ret(i,o){if(i&1&&(v(0),u(1,Met,4,12,"div",5)(2,ket,5,27,"div",6),C()),i&2){let n=l(3).ngIf,e=l();m(),d("ngIf",(n==null?null:n.editCommentIndex)!==e.i&&e.commentObj.commentText&&!e.commentObj.commentHtml),m(),d("ngIf",(n==null?null:n.editCommentIndex)!==e.i&&e.commentObj.commentHtml)}}function Net(i,o){if(i&1&&(v(0),u(1,Ret,3,2,"ng-container",4),C()),i&2){l(2);let n=me(3),e=l();m(),d("ngIf",!e.showLoadingTemplate)("ngIfElse",n)}}function Fet(i,o){if(i&1&&(v(0),u(1,Net,2,2,"ng-container",3),C()),i&2){let n=l().ngIf,e=l();m(),d("veltDynamicTemplate",$(5,Aet,e.template,$e(1,pue,e.componentConfigSignal,e.commentObj,e.i),n==null?null:n.variant,e.setIfCondition.bind(e),e.elementRef))}}function Let(i,o){i&1&&w(0,"velt-skeleton-loader-internal",9)}function Bet(i,o){if(i&1&&(v(0),u(1,Fet,2,11,"ng-container",2)(2,Let,1,0,"ng-template",null,0,xe),C()),i&2){let n=l();m(),d("veltIf",k(5,Oet,n.conditionSignal(),$e(1,pue,n.componentConfigSignal,n.commentObj,n.i)))}}var AE=(()=>{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",`
|
|
521
521
|
.velt-comment-dialog-thread-card-message--email-chip[email="${t}"] {
|