@veltdev/sdk
Version:
Velt is an SDK to add collaborative features to your product within minutes. Example: Comments like Figma, Frame.io, Google docs or sheets, Recording like Loom, Huddles like Slack and much more.
1 lines • 64.3 kB
JavaScript
import{a as we}from"./chunk-RZ4WYBKV.js";import"./chunk-JP3HOBZL.js";import{b as Xt,c as Kt,d as Jt}from"./chunk-KEET32BV.js";import{b as ye,t as Ie}from"./chunk-BACKCNIG.js";import"./chunk-JFNRCHYR.js";import"./chunk-U4YN7DB7.js";import"./chunk-3HGEDPEP.js";import"./chunk-JDLRIKAZ.js";import"./chunk-3J52NZMN.js";import{b as be}from"./chunk-4ACOV475.js";import{b as Ce,d as Ee}from"./chunk-WTYACTR5.js";import{a as Oe}from"./chunk-6E3N35RF.js";import{a as Ae}from"./chunk-KEM6PWSD.js";import{a as ie}from"./chunk-UJRDSNTY.js";import{A as Zt,G as te,H as ee,I as ne,Y as re,ca as Pe,r as Qt,t as qt}from"./chunk-KU45CEXD.js";import{$ as rt,$f as lt,Ab as Ft,Bb as Ht,Bf as Pt,Cg as de,Db as Z,E as D,Eb as tt,Ec as Wt,Ed as oe,Ee as d,Fa as v,Fb as et,Ga as at,Gc as H,Ib as N,Ii as _e,J as $,Jb as Vt,Kb as st,Lc as zt,Ma as Dt,Nb as Q,Nf as se,Ob as Tt,Of as ce,Pa as m,Pb as St,Pc as Yt,Qb as Ut,Rf as le,T as C,Ta as Mt,Ua as k,Va as kt,Ze as ae,Zg as pe,_a as O,_g as me,a as G,aa as wt,ac as jt,b as K,bb as Bt,bi as ue,ca as f,cc as Gt,ci as B,db as M,di as p,ei as ve,g as ot,ge as ct,ha as T,ia as S,ii as fe,ja as W,jg as Ct,kc as R,l as J,la as xt,lb as u,lc as F,lg as bt,li as L,mb as _,mi as U,nb as P,ob as z,oe as V,pc as nt,qf as _t,qg as ge,r as E,sb as Lt,tb as Nt,ti as Te,ub as ft,v as I,vb as x,vh as b,wb as Rt,xb as A,xc as $t,yh as he,yi as Se,zb as h}from"./chunk-GR3NESUB.js";var w=(()=>{let r=class r{constructor(t,e,n,i,l,s,c,y,X,Me,ke,Be,Le,Ne,Re){this.analyticsService=t,this.configService=e,this.docService=n,this.databaseService=i,this.authService=l,this.domService=s,this.afAuth=c,this.iamService=y,this.avatarService=X,this.contactService=Me,this.storageService=ke,this.dialog=Be,this.loggingService=Le,this.serviceBook=Ne,this.commonDbService=Re,this.tagAnnotations$=new J({}),this.tagAnnotationsByDocumentId$=new J({}),this.documentPaths=null,this.allowedElementIds$=new J([]),this.addTagMode$=new J(!1),this.enableTextTags$=new J(!1),this.notificationService=null,this.loggingService.log("%c[WB] Creating CLASS: TagService","color: blue;"),this.serviceBook.observe(he).subscribe(g=>{this.notificationService=g}),this.databaseService.getDb().pipe(D(g=>!!g),$(1)).subscribe(g=>{g&&this.getDocumentPaths()},g=>{this.loggingService.catch("Error in TagService getDb subscription: ",g)}),this.domService.onWindowPointerMove$().subscribe(g=>{if(this.addTagMode$.value){this.hightlightElement&&this.domService.removeHighlightFromElement(this.hightlightElement);let j=this.domService.getBackgroundElement(g.clientX,g.clientY);j&&(this.isElementInsideAllowedElements(j)?bt(g.target)?this.domService.removeClassFromElement(document.body,"show-pin-cursor"):(this.domService.addClassToElement(document.body,"show-pin-cursor"),this.hightlightElement=j,this.domService.highlightElement(this.hightlightElement,d.CURSOR.TAG_PIN)):this.domService.removeClassFromElement(document.body,"show-pin-cursor"))}},g=>{this.loggingService.catch("Error in TagService onWindowPointerMove$ subscription: ",g)}),this.domService.onWindowKeyupEsc$().subscribe(g=>{this.addTagMode$.value&&this.disableAddTagMode()},g=>{this.loggingService.catch("Error in TagService onWindowKeyupEsc$ subscription: ",g)}),this.domService.onDocumentClick$().subscribe(g=>{if(g&&this.addTagMode$.value){if(g.preventDefault(),g.stopPropagation(),!bt(g.target)){let j=this.domService.getBackgroundElement(g.clientX,g.clientY);j&&this.isElementInsideAllowedElements(j)&&this.addTag(g)}this.disableAddTagMode()}},g=>{this.loggingService.catch("Error in TagService onDocumentClick$ subscription: ",g)}),this.addTagMode$.subscribe(g=>{this.hightlightElement&&this.domService.removeHighlightFromElement(this.hightlightElement),g?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"))},g=>{this.loggingService.catch("Error in TagService addTagMode$ subscription: ",g)}),this.domService.onWindowKeyupBackspace$().subscribe(g=>{this.deleteTagPinAnnotations("keyupBackspace")},g=>{this.loggingService.catch("Error in TagService onWindowKeyupBackspace$ subscription: ",g)}),this.domService.onWindowKeyupDelete$().subscribe(g=>{this.deleteTagPinAnnotations("keyupDelete")},g=>{this.loggingService.catch("Error in TagService onWindowKeyupDelete$ subscription: ",g)}),this.domService.getDeleteCommmentAnnotations$().subscribe(g=>{g?.length&&(g?.filter(vt=>vt.type==="tag")).forEach(vt=>ot(this,null,function*(){yield this.deleteTagPinAnnotation(vt)}))},g=>{this.loggingService.catch("Error in TagService onWindowKeyupDelete$ subscription: ",g)})}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(t){this.allowedElementIds$.next(t||[])}getAllowedElementIds(){return this.allowedElementIds$.asObservable()}getAllTagAnnotations(t,e,n){this.loggingService.log("%c[WB] Calling FUNCTION: getAllTagAnnotations","color: green;");let i,l;try{if(t&&(l=Pt(t)),e&&typeof e=="object"){let s=le(e);i=Pt(JSON.stringify(s))}}catch(s){this.loggingService.catch("Error in TagService getAllTagAnnotations: ",s)}return this.authService.getAuthState$().pipe(D(s=>!!s),C(s=>this.isFeatureAllowed({firebaseUser:s,annotations:[],filteredAnnotations:[]})),C(s=>s.featureAllowed?this.iamService.isUserAllowed$().pipe(I(c=>(s.featureAllowed=c,s))):E(s)),C(s=>s.featureAllowed?this.authService.isPlanExpired$().pipe(I(c=>(s.featureAllowed=!c,s))):E(s)),C(s=>s.featureAllowed?E(s).pipe(C(c=>this.docService.getDocumentPaths$().pipe(I(y=>(this.documentPaths=y,c.documentPaths=y,c)))),C(c=>this.getDataFromDocumentId(l).pipe(I(y=>(c.annotations=y||[],G({},c))))),C(c=>this.docService.getLocation$().pipe(I(y=>(c.location=y,c)))),C(c=>this.docService.getLocations$().pipe(I(y=>(c.customLocations=y,c)))),I(c=>{if(c.filteredAnnotations=[],l&&!i)return c.filteredAnnotations=c.annotations?.slice(),c;{let y=[];return i?y.push(i):(y.push(c?.location?.locationId),y.push(...Object.values(c?.customLocations||[]).map(X=>X.locationId))),c.filteredAnnotations=this.filterAnnotationsByLocationIds(c?.annotations,y),c}}),C(c=>n?E(c):c?.annotations?.length?this.domService.onWindowResize$().pipe(I(()=>c)):E(c)),C(c=>n?E(c):c?.annotations?.length?this.domService.onDomChange$("TagService getAllTagAnnotations").pipe(I(()=>c)):E(c)),I(c=>(c?.filteredAnnotations?.forEach(y=>{this.calculateTagAnnotationPosition(y)}),c)),C(c=>c?.filteredAnnotations?E(c?.filteredAnnotations||[]):E([]))):E([])))}isFeatureAllowed(t){return this.configService.getConfig$().pipe(D(e=>!!e),I(e=>K(G({},t),{config:e})),C(e=>this.authService.getUser$().pipe(I(n=>K(G({},e),{user:n})))),C(e=>se(e.config,e.user,V.TAG)?E(K(G({},e),{featureAllowed:!0})):(this.loggingService.warn("Tag feature is not allowed."),E(K(G({},e),{featureAllowed:!1})))))}getDataFromDocumentId(t){return this.databaseService.getDb().pipe(D(e=>!!e),C(e=>this.configService?.getApiKey()&&this.documentPaths?.tag?this.commonDbService.dbListener({feature:"allTags",properties:{documentId:t??this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}}).pipe(I(n=>n?.data),I(n=>{let i=[];return n&&(i=Object.values(n).filter(l=>typeof l=="object")),this.setTagAnnotationsByDocumentId(t||this.documentPaths?.documentId,i),i})):E([])))}setTagAnnotationsByDocumentId(t,e){try{t&&this.tagAnnotationsByDocumentId$.next(K(G({},this.tagAnnotationsByDocumentId$.value),{[t]:e}))}catch(n){this.loggingService.catch("Error in TagService setTagAnnotationsByDocumentId:",n)}}filterAnnotationsByLocationIds(t,e){try{return t.filter(n=>e.includes(n.locationId))}catch(n){return this.loggingService.catch("Error in TagService filterAnnotationsByLocations:",n),[]}}calculateTagAnnotationPosition(t){try{if(t.targetElement){let e=this.domService.getXPath(t.targetElement?.xpath);if(e){let n=e.iterateNext();if(n&<(n)){let i=n.getBoundingClientRect();if(i&&i.width&&i.height){let{height:l,width:s}=pe(n);t.position={top:l*t.targetElement.topPercentage/100,left:s*t.targetElement.leftPercentage/100}}else t.position=null}else t.position=null}else t.position=null}}catch(e){this.loggingService.catch("Error in TagService calculateTagAnnotationPosition:",e)}}filterPinAnnotations(t,e,n){this.loggingService.log("%c[WB] Calling FUNCTION: filterPinAnnotations","color: green;");try{let i=t?Object.values(t):[];i.forEach((s,c)=>{s?.annotationId&&(s.annotationIndex=c+1)});let l=[];if(e)n?l=i.filter(s=>s.locationId===n):l=i.slice();else{let s=this.docService.getLocation();s&&s.locationId?l=i.filter(c=>c.locationId===s.locationId):l=i.filter(c=>!c.locationId)}return l}catch(i){return this.loggingService.catch("Error in TagService filterPinAnnotations:",i),[]}}addTag(t,e){this.loggingService.log("%c[WB] Calling FUNCTION: addTag","color: green;");try{let n=this.authService.getUser();if(n)if(n.isReadOnly||n.isAnonymous)this.loggingService.catch("Anonymous/Readonly users cannot add tags.");else{let i=new _t;i.from=n,i.color=d.DEFAULT_ANNOTATION_COLOR,i.resolved=!1,i.lastUpdated=this.timestamp;let{topPositionX:l,topPositionY:s}=this.domService.getTopLeftPosition();i.positionX=l,i.positionY=s;let c=this.domService.getCurrentWindowSizeValue();if(i.screenWidth=c.screenWidth,i.screenHeight=c.screenHeight,i.screenScrollHeight=c.screenScrollHeight,i.taggedElementPath="",t&&(i.targetElement=this.domService.getTargetElementForCursorPosition(t)),e&&(i.targetTextRange=e),i?.targetElement?.xpath){let y=this.domService.getXPath(i.targetElement.xpath);if(y){let X=y.iterateNext();X&&(lt(X)||(i.targetElement=null))}}this.setLocationToTagAnnotation(i),i.pageInfo=Ct(),i.pageInfo&&(i.pageInfo.screenWidth=this.domService.getCurrentWindowSizeValue()?.screenWidth),this.saveTagToDb(i)}}catch(n){this.loggingService.catch("Error in TagService addTag: ",n)}}setLocationToTagAnnotation(t){try{let e=this.docService.getLocation();e?(t.locationId=e.locationId,t.location=e.location):(delete t.locationId,delete t.location);try{let n;t.targetElement?.xpath?n=this.domService.getElementFromXPath(t.targetElement.xpath):t.targetTextRange?.commonAncestorContainer&&(n=this.domService.getElementFromXPath(t.targetTextRange.commonAncestorContainer));let i=this.docService.getAdditionLocationFromElement(n);if(i){let l=this.docService.addLocation({location:i,source:"internal"});l?.[0]&&(t.locationId=l[0].locationId,t.location=l[0].location)}}catch{}}catch(e){this.loggingService.catch("Error in TagService setLocationToTagAnnotation:",e)}}saveTagToDb(t){this.loggingService.log("%c[WB] Calling FUNCTION: saveTagToDb","color: green;");try{this.authService.getUser()&&this.authService.isFeatureAllowed(V.TAG)&&this.docService.getDocumentPaths$().pipe(D(e=>!!e),$(1),C(e=>(this.documentPaths=e,this.loggingService.log(this.documentPaths),this.databaseService.getDb().pipe(D(n=>!!n),$(1),C(n=>{if(this.documentPaths?.tag){t.annotationId=this.commonDbService.generateDocumentId(),t.pageInfo&&(t.pageInfo.tagUrl=this.generateTagUrl(t));let i=JSON.parse(JSON.stringify(t));return i.position=null,this.domService.toggleAnnotationSelection(i),t.targetTextRange&&sessionStorage.setItem(d.SESSION_STORAGE.SNIPPYLY_AUTO_SELECT_ANNOTATION_ID,t.annotationId),this.analyticsService.trackEvent(b.Events.Tag.TAG_DRAFT_ADDED,{annotationId:t.annotationId}),this.commonDbService.setData({feature:"tag",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",id:t.annotationId,skipFirestore:!0},data:i})}else return E(null)}))))).subscribe(()=>{},e=>{this.loggingService.catch("Error in TagService saveTagToDb subscription: ",e)})}catch(e){this.loggingService.catch("Error in TagService saveTagToDb: ",e)}}updateTag(t,e=!1,n){try{n&&this.setLocationToTagAnnotation(t),e&&this.updateNotificationsDatabase(t,ct.UPDATED),this.updateTagToDb(t)}catch(i){this.loggingService.catch("Error in TagService updateTag: ",i)}}resolveTag(t){try{t.resolved=!0,this.domService.resetSelectedAnnotationsMap(!1),this.updateNotificationsDatabase(t,ct.RESOLVED),this.updateTagToDb(t),this.domService.updateSelectedAnnotationInMap([t]),this.analyticsService.trackEvent(b.Events.Tag.TAG_RESOLVED,{annotationId:t.annotationId})}catch(e){this.loggingService.catch("Error in TagService resolveTag: ",e)}}updateTagToDb(t){this.loggingService.log("%c[WB] Calling FUNCTION: updateTagToDb","color: green;");try{if(t?.targetElement?.xpath){let e=this.domService.getXPath(t.targetElement.xpath);if(e){let n=e.iterateNext();n&&(lt(n)||(t.targetElement=null))}}this.domService.updateSelectedAnnotationInMap([t]),this.authService.getUser()&&this.authService.isFeatureAllowed(V.TAG)&&this.docService.getDocumentPaths$().pipe(D(e=>!!e),$(1),C(e=>(this.documentPaths=e,this.loggingService.log(this.documentPaths),this.databaseService.getDb().pipe(D(n=>!!n),$(1),C(n=>{if(this.documentPaths?.tag&&t?.annotationId){let i=JSON.parse(JSON.stringify(t));return i.position=null,this.commonDbService.setData({feature:"tag",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",id:t.annotationId,skipFirestore:!0},data:i})}else return E(null)}))))).subscribe(()=>{},e=>{this.loggingService.catch("Error in TagService updateTagToDb subscription: ",e)})}catch(e){this.loggingService.catch("Error in TagService updateTagToDb: ",e)}}deleteTagPinAnnotations(t){try{let e=this.domService.getSelectedAnnotationsMap(),n=this.authService.getUser(),i=[];Object.keys(e).forEach(l=>ot(this,null,function*(){let s=e[l];s.type==="tag"&&n&&s.from&&(n?.isAdmin||s.from.userId===n.userId)&&i.push(s)})),i?.length&&(this.analyticsService.trackEvent(b.Events.Tag.TAG_DELETE_TRIGGERED,{triggerType:t,annotationId:i.map(l=>l.annotationId).join()}),this.dialog.open(be,{panelClass:"velt-mat-dialog-container",data:{title:"Delete tag?",message:"This selected tag will be deleted.",yesButton:"Delete",noButton:"Cancel",variant:"tag"}}).afterClosed().pipe($(1)).subscribe(l=>{l&&(i.forEach(s=>ot(this,null,function*(){yield this.deleteTagPinAnnotation(s)})),setTimeout(()=>{document.querySelectorAll(`[${d.SNIPPYLY_HIGHLIGHT}]`).forEach(c=>{this.domService.removeHighlightFromElement(c)})},100))})),this.domService.resetSelectedAnnotationsMap(!0,"tag")}catch(e){this.loggingService.catch("Error in TagService deleteTagPinAnnotations: ",e)}}deleteTagPinAnnotation(t){return this.authService.isFeatureAllowed(V.TAG)&&this.documentPaths?.tag&&t?.annotationId?(this.updateNotificationsDatabase(t,ct.DELETED),this.analyticsService.trackEvent(b.Events.Tag.TAG_DELETED,{annotationId:t.annotationId}),this.commonDbService.deleteData({feature:"tag",properties:{documentId:this.documentPaths?.documentId??"",organizationId:this.documentPaths?.organizationId??"",id:t.annotationId,skipFirestore:!0}})):Promise.resolve()}enableAddTagMode(){this.authService.isFeatureAllowed(V.TAG)?(this.analyticsService.trackEvent(b.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(b.Events.Tag.TAG_ADD_MODE_DISABLED),this.addTagMode$.next(!1)}addTagModeChange(){return this.addTagMode$.asObservable()}enableTextTags(t){this.enableTextTags$.next(t)}getEnableTextTags$(){return this.enableTextTags$.asObservable()}get timestamp(){return this.commonDbService.getServerTimestamp()}isElementInsideAllowedElements(t){try{return this.domService.isElementInsideListedElementIds(t,this.allowedElementIds$.value)}catch(e){return this.loggingService.catch("Error in TagService isElementInsideAllowedElements: ",e),!1}}attachTag(t,e=[]){let n=de(t,e);if(n){let i=this.domService.getXPath(n),l=this.getTagPinAnnotationObject();l&&(l.targetElement={xpath:i,topPercentage:50,leftPercentage:90},this.saveTagToDb(l))}}getTagPinAnnotationObject(){let t=this.authService.getUser();if(t)if(t.isReadOnly||t.isAnonymous)this.loggingService.catch("Anonymous/Readonly users cannot add tags.");else{let e=new _t;e.from=t,e.color=d.DEFAULT_ANNOTATION_COLOR,e.resolved=!1,e.lastUpdated=this.timestamp;let{topPositionX:n,topPositionY:i}=this.domService.getTopLeftPosition();e.positionX=n,e.positionY=i;let l=this.domService.getCurrentWindowSizeValue();e.screenWidth=l.screenWidth,e.screenHeight=l.screenHeight,e.screenScrollHeight=l.screenScrollHeight,e.taggedElementPath="";let s=this.docService.getLocation();return s&&(e.locationId=s.locationId,e.location=s.location),e}return null}updateNotificationsDatabase(t,e){try{let n={annotationData:t,actionType:e,notificationSource:"tag"};this.notificationService?.updateNotificationDatabase(n)}catch(n){this.loggingService.catch("Error in TagService updateNotificationsDatabase: ",n)}}getUserContacts$(){return this.contactService.getUserContacts$()}addUserContact(t){this.contactService.addUserContact(t)}getTagUrl(t){try{return t?.pageInfo?.tagUrl?t.pageInfo.tagUrl:(t?.pageInfo||(t.pageInfo=Ct(),t.pageInfo&&(t.pageInfo.screenWidth=this.domService.getCurrentWindowSizeValue()?.screenWidth)),t.pageInfo.tagUrl=this.generateTagUrl(t),this.updateTag(t),t.pageInfo?.tagUrl)}catch(e){this.loggingService.catch("Error in TagService getTagUrl: ",e);return}}uploadFile(t,e){let n=`${d.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentPaths?.documentId}/${d.FIREBASE_PARTIAL_PATH_TAG}/${e.annotationId}`;return this.documentPaths?.organizationId&&(n=`${d.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${this.documentPaths.organizationId}/${d.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentPaths?.documentId}/${d.FIREBASE_PARTIAL_PATH_TAG}/${e.annotationId}`),this.storageService.uploadFile({path:n,file:t})}downloadAttachment(t){this.storageService.downloadAttachment(t)}deleteAttachment(t){return this.storageService.deleteAttachment({attachment:t})}generateTagUrl(t){let e;try{e=new URL(t?.pageInfo?.url||window.location.href)}catch(n){this.loggingService.catch("Error in TagService generateTagUrl: ",n),e=new URL(window.location.href)}return e.searchParams.delete(d.URL_PARAMS.TAG_ID),e.searchParams.append(d.URL_PARAMS.TAG_ID,t.annotationId),e.href}};r.\u0275fac=function(e){return new(e||r)(f(B),f(ve),f(Se),f(Te),f(U),f(L),f(oe),f(Ae),f(fe),f(Pe),f(we),f(re),f(p),f(ue),f(_e))},r.\u0275prov=rt({token:r,factory:r.\u0275fac,providedIn:"root"});let a=r;return a})();var Fe=["customBtnRef"],He=["*"];function Ve(a,r){a&1&&ft(0)}function Ue(a,r){if(a&1&&O(0,Ve,1,0,"ng-container",5),a&2){h();let o=N(5);u("ngTemplateOutlet",o)}}function je(a,r){a&1&&(_(0,"div",8),W(),_(1,"svg",9),z(2,"circle",10)(3,"path",11),P()())}function Ge(a,r){a&1&&ft(0)}function $e(a,r){if(a&1&&(O(0,je,4,0,"div",6),_(1,"div",7,2),O(3,Ge,1,0,"ng-container",5),P()),a&2){let o=h(),t=N(5);u("ngIf",o.showDefaultBtn),v(3),u("ngTemplateOutlet",t)}}function We(a,r){a&1&&Ht(0)}var pt=(()=>{let r=class r{constructor(t,e,n,i,l){this.analyticsService=t,this.authService=e,this.tagService=n,this.loggingService=i,this.cdr=l,this.showDefaultBtn=!1,this.subscriptions=[],this.veltElement=!0,this.subscriptions.push(this.authService.getUser$().subscribe(s=>{this.user=s},s=>{this.loggingService.catch("Error in TagsToolComponent getUser$ subscription: ",s)}))}ngOnInit(){}ngAfterViewInit(){try{this.customBtnRef?.nativeElement?.children?.length||(this.showDefaultBtn=!0,this.cdr.detectChanges())}catch(t){this.loggingService.catch("Error in TagsToolComponent AfterViewInit: ",t)}}addTag(){this.loggingService.log("%c[WB] Calling FUNCTION: addTag","color: green;");try{this.analyticsService.trackEvent(b.Events.Tag.TAG_TOOL_CLICKED,{toolType:this.customBtnRef?.nativeElement?.children?.length?"custom":"default"}),this.user&&(this.user.isReadOnly||this.user.isAnonymous?this.loggingService.catch("Anonymous/Readonly users cannot add tags."):this.targetTagElementId?this.tagService.attachTag(this.targetTagElementId,["id","data-id"]):this.tagService.enableAddTagMode())}catch(t){this.loggingService.catch("Error in TagsToolComponent addTag: ",t)}}ngOnDestroy(){this.loggingService.log("%c[WB] Calling FUNCTION: ngOnDestroy","color: green;");try{this.unsubscribe()}catch(t){this.loggingService.catch("Error in TagsToolComponent ondestroy: ",t)}}unsubscribe(){this.loggingService.log("%c[WB] Calling FUNCTION: unsubscribe","color: green;");try{this.subscriptions.map(t=>{t.unsubscribe()}),this.subscriptions=[]}catch(t){this.loggingService.catch("Error in TagsToolComponent unsubscribe: ",t)}}};r.\u0275fac=function(e){return new(e||r)(m(B),m(U),m(w),m(p),m($t))},r.\u0275cmp=k({type:r,selectors:[["snippyly-tags-tool"]],viewQuery:function(e,n){if(e&1&&Z(Fe,5),e&2){let i;tt(i=et())&&(n.customBtnRef=i.first)}},hostVars:1,hostBindings:function(e,n){e&2&&M("data-velt-element",n.veltElement)},inputs:{targetTagElementId:"targetTagElementId"},standalone:!1,ngContentSelectors:He,decls:6,vars:2,consts:[["tagToolBtn",""],["content",""],["customBtnRef",""],[1,"snippyly-tag-btn-container",3,"click"],[3,"ngIf","ngIfElse"],[4,"ngTemplateOutlet"],["class","action-btn",4,"ngIf"],[1,"custom-btn-container"],[1,"action-btn"],["xmlns","http://www.w3.org/2000/svg",0,"xmlns","bx","https://boxy-svg.com","viewBox","0 0 32 32","width","32","height","32","fill","none",1,"action-btn-icon"],["cx","16","cy","10.751","r","3.751",0,"bx","origin","0.5 1.19976","has-stroke","",2,"stroke-width","2px"],["d","M 10 24.964 L 10 24.251 C 10 20.936 12.687 18.251 16 18.251 C 19.313 18.251 22 20.936 22 24.251 L 22 25","stroke-linecap","round",0,"bx","origin","0.5 -0.333481","has-stroke","",2,"stroke-width","2px"]],template:function(e,n){if(e&1){let i=x();Ft(),_(0,"div",3),A("click",function(s){return T(i),n.addTag(),S(s.stopPropagation())}),O(1,Ue,1,1,"ng-template",4)(2,$e,4,2,"ng-template",null,0,nt),P(),O(4,We,1,0,"ng-template",null,1,nt)}if(e&2){let i=N(3);v(),u("ngIf",n.targetTagElementId)("ngIfElse",i)}},dependencies:[H,zt],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}body.velt-pin-dragging[_ngcontent-%COMP%] iframe[_ngcontent-%COMP%]{pointer-events:none!important}*[_ngcontent-%COMP%]{box-sizing:border-box;-webkit-tap-highlight-color:rgba(255,255,255,0)!important;outline:none!important;margin:0!important;padding:0!important;height:unset;width:unset;text-align:left!important;line-height:1.5!important;color:#000!important;font-size:calc((1rem + 0px) * var(--velt-base-rem-unit))}*[_ngcontent-%COMP%]:empty{display:revert!important}.snippyly-tag-btn-container[_ngcontent-%COMP%]{display:inline-block}.action-btn[_ngcontent-%COMP%]{display:flex;justify-content:center;align-items:center}.action-btn-icon[_ngcontent-%COMP%]{width:32px;height:32px;border-radius:50px;cursor:pointer;transition:.5s!important}.action-btn-icon[_ngcontent-%COMP%] *[has-stroke][_ngcontent-%COMP%]{stroke:#8f95b2!important}.action-btn-icon[_ngcontent-%COMP%] *[_ngcontent-%COMP%]:not([has-stroke]){fill:#8f95b2!important}.action-btn-icon[_ngcontent-%COMP%]:hover{background:#eae8f9}.action-btn-icon[_ngcontent-%COMP%]:active, .action-btn-icon.active[_ngcontent-%COMP%]{background:#625df5}.action-btn-icon[_ngcontent-%COMP%]:active *[has-stroke][_ngcontent-%COMP%], .action-btn-icon.active[_ngcontent-%COMP%] *[has-stroke][_ngcontent-%COMP%]{stroke:#fff!important}.action-btn-icon[_ngcontent-%COMP%]:active *[_ngcontent-%COMP%]:not([has-stroke]), .action-btn-icon.active[_ngcontent-%COMP%] *[_ngcontent-%COMP%]:not([has-stroke]){fill:#fff!important}"],changeDetection:0});let a=r;return a})();function ze(a,r){if(a&1){let o=x();_(0,"div",7),A("click",function(e){return T(o),h(2).copyLink(),S(e.stopPropagation())}),Q(1),R(2,"translate"),P()}if(a&2){let o=h(2);v(),St(" ",F(2,1,o.copyLinkText))}}function Ye(a,r){if(a&1){let o=x();_(0,"div",7),A("click",function(e){T(o);let n=h(2);return n.editMode=!0,S(e.stopPropagation())}),Q(1),R(2,"translate"),P()}a&2&&(v(),Tt(F(2,1,"Reassign")))}function Xe(a,r){if(a&1){let o=x();_(0,"div",7),A("click",function(e){T(o);let n=h(2);return n.editMode=!0,n.resolveTag(),S(e.stopPropagation())}),Q(1),R(2,"translate"),P()}a&2&&(v(),Tt(F(2,1,"Resolve")))}function Ke(a,r){if(a&1){let o=x();_(0,"div",7),A("click",function(e){return T(o),h(2).removeTag(),S(e.stopPropagation())}),Q(1),R(2,"translate"),P()}a&2&&(v(),St(" ",F(2,1,"Remove")))}function Je(a,r){if(a&1&&(_(0,"div",4)(1,"div",5),Q(2),R(3,"translate"),R(4,"translate"),P(),O(5,ze,3,3,"div",6)(6,Ye,3,3,"div",6)(7,Xe,3,3,"div",6)(8,Ke,3,3,"div",6),P()),a&2){let o=h();v(2),Ut("",F(3,6,"Assigned to:")," ",!(o.annotation==null||o.annotation.to[0]==null)&&o.annotation.to[0].name?o.annotation==null||o.annotation.to[0]==null?null:o.annotation.to[0].name:F(4,8,o.annotation==null||o.annotation.to[0]==null?null:o.annotation.to[0].email)),v(3),u("ngIf",o.tagPinSelected),v(),u("ngIf",o.tagPinSelected&&(o.allowedActions==null?null:o.allowedActions.update)),v(),u("ngIf",o.tagPinSelected&&(o.allowedActions==null?null:o.allowedActions.resolve)),v(),u("ngIf",o.tagPinSelected&&(o.allowedActions==null?null:o.allowedActions.remove))}}function Qe(a,r){if(a&1){let o=x();W(),_(0,"svg",11),A("click",function(){T(o);let e=h(2);return S(!(e.annotation==null||e.annotation.to==null)&&e.annotation.to.length?e.editMode=!1:e.removeTag())}),z(1,"path",12)(2,"path",13),P()}}function qe(a,r){if(a&1){let o=x();Lt(0),_(1,"div",8)(2,"velt-autocomplete-panel-internal",9,0),R(4,"translate"),A("optionSelected",function(e){T(o);let n=h();return S(n.saveTag(e))}),P(),O(5,Qe,3,0,"svg",10),P(),Nt()}if(a&2){let o=N(3),t=h();v(2),u("placeholder",F(4,3,"Please select a contact to assign"))("enableOnFocus",!0),v(3),u("ngIf",(t.annotation==null||t.annotation.to==null?null:t.annotation.to.length)||!(!(o==null||o.userContacts==null)&&o.userContacts.length))}}var It=(()=>{let r=class r{get user(){return this._user}set user(t){this._user=t,this.checkToShowActions()}get tagPinSelected(){return this._tagPinSelected}set tagPinSelected(t){this._tagPinSelected=t,this.tagPinSelected&&this.setTagReadInAnalytics()}constructor(t,e,n){this.analyticsService=t,this.tagService=e,this.loggingService=n,this.subscriptions=[],this.editMode=!1,this.copyLinkText="Copy Link",this._user=new ae,this.allowedActions=null,this._tagPinSelected=!1,this.veltElement=!0}ngOnInit(){try{this.checkToShowActions(),this.annotation?.to?.length||(this.editMode=!0)}catch(t){this.loggingService.catch("Error in TagDialogComponent OnInit: ",t)}}ngAfterViewInit(){try{this.setTagReadInAnalytics()}catch(t){this.loggingService.catch("Error in TagDialogComponent view init: ",t)}}trackByUserContact(t,e){return e?.email||t}setTagReadInAnalytics(){try{this.annotation&&this.analyticsService.trackEvent(b.Events.Tag.TAG_READ,{annotationId:this.annotation.annotationId,readType:this.tagPinSelected?"open":"hover"})}catch(t){this.loggingService.catch("Error in CommentDialogComponent setCommentReadInAnalytics: ",t)}}saveTag(t){try{this.analyticsService.trackEvent(b.Events.Tag.TAG_ADDED,{annotationId:this.annotation.annotationId}),this.annotation.to=[t],this.tagService.updateTag(this.annotation,!0),this.editMode=!1}catch(e){this.loggingService.catch("Error in TagDialogComponent saveTag: ",e)}}checkToShowActions(){try{this.user&&this.annotation?this.annotation.from?.userId===this.user.userId?(this.allowedActions||(this.allowedActions={}),this.allowedActions.update=!0,this.allowedActions.remove=!0):!this.annotation?.resolved&&this.annotation?.to?.find(t=>t?.email===this.user?.email)&&(this.allowedActions||(this.allowedActions={}),this.allowedActions.resolve=!0):this.allowedActions=null}catch(t){this.loggingService.catch("Error in TagDialogComponent checkToShowActions: ",t)}}resolveTag(){try{this.tagService.resolveTag(this.annotation),this.editMode=!1}catch(t){this.loggingService.catch("Error in TagDialogComponent resolveTag: ",t)}}removeTag(){try{this.tagService.deleteTagPinAnnotations("deleteOption")}catch(t){this.loggingService.catch("Error in TagDialogComponent removeTag: ",t)}}copyLink(){try{let t=this.copyLinkText;this.copyLinkText="Link Copied!",setTimeout(()=>{this.copyLinkText=t},2e3);let e=this.tagService.getTagUrl(this.annotation);e&&ge(e),this.analyticsService.trackEvent(b.Events.Tag.TAG_LINK_COPIED,{annotationId:this.annotation.annotationId})}catch(t){this.loggingService.catch("Error in TagDialogComponent copyLink: ",t)}}};r.\u0275fac=function(e){return new(e||r)(m(B),m(w),m(p))},r.\u0275cmp=k({type:r,selectors:[["snippyly-tag-dialog"]],hostVars:1,hostBindings:function(e,n){e&2&&M("data-velt-element",n.veltElement)},inputs:{annotation:"annotation",user:"user",tagPinSelected:"tagPinSelected"},standalone:!1,decls:3,vars:5,consts:[["userSelectorRef",""],[1,"tag-dialog-container",3,"pointerdown","pointerup"],["velt-ignore-change-detection","true",4,"ngIf"],[4,"ngIf"],["velt-ignore-change-detection","true"],[1,"tag-user-details"],["class","tag-action-button",3,"click",4,"ngIf"],[1,"tag-action-button",3,"click"],[1,"tag-input-container"],[3,"optionSelected","placeholder","enableOnFocus"],["xmlns","http://www.w3.org/2000/svg","width","16","height","16","fill","currentColor","class","bi bi-x-circle","viewBox","0 0 16 16",3,"click",4,"ngIf"],["xmlns","http://www.w3.org/2000/svg","width","16","height","16","fill","currentColor","viewBox","0 0 16 16",1,"bi","bi-x-circle",3,"click"],["d","M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"],["d","M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z"]],template:function(e,n){e&1&&(_(0,"div",1),A("pointerdown",function(l){return l.stopPropagation()})("pointerup",function(l){return l.stopPropagation()}),O(1,Je,9,10,"div",2)(2,qe,6,5,"ng-container",3),P()),e&2&&(st("edit-mode",n.editMode),M("data-velt-annotation-draft",n.editMode?n.annotation==null?null:n.annotation.annotationId:null),v(),u("ngIf",(n.annotation==null||n.annotation.to==null?null:n.annotation.to.length)&&!n.editMode),v(),u("ngIf",n.editMode))},dependencies:[H,ye,Ce],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}body.velt-pin-dragging[_ngcontent-%COMP%] iframe[_ngcontent-%COMP%]{pointer-events:none!important}*[_ngcontent-%COMP%]{box-sizing:border-box;-webkit-tap-highlight-color:rgba(255,255,255,0)!important;outline:none!important;margin:0!important;padding:0!important;height:unset;width:unset;text-align:left!important;line-height:1.5!important;color:#000!important;font-size:calc((1rem + 0px) * var(--velt-base-rem-unit))}*[_ngcontent-%COMP%]:empty{display:revert!important}.tag-dialog-container[_ngcontent-%COMP%]{background-color:#fff;padding-top:calc((1rem + 0px) * var(--velt-base-rem-unit))!important;padding-bottom:calc((1rem + 0px) * var(--velt-base-rem-unit))!important;width:100%;padding-right:calc((.75rem + 0px) * var(--velt-base-rem-unit))!important;padding-left:calc((.75rem + 0px) * var(--velt-base-rem-unit))!important;margin-right:auto!important;margin-left:auto!important;font-size:calc((.875rem + 0px) * var(--velt-base-rem-unit));border-radius:10px!important;box-shadow:0 calc((1rem + 0px) * var(--velt-base-rem-unit)) calc((3rem + 0px) * var(--velt-base-rem-unit)) #0000002d!important;border:1px solid #dee2e6!important;max-height:fit-content!important;max-width:300px;min-width:300px}.tag-dialog-container[_ngcontent-%COMP%]:not(.edit-mode){background-color:#141416!important;padding-left:0!important;padding-right:0!important;max-width:250px;min-width:250px;border:none!important}.tag-dialog-container[_ngcontent-%COMP%]:not(.edit-mode) *[_ngcontent-%COMP%]{color:#fff!important}.tag-dialog-container[_ngcontent-%COMP%]:not(.edit-mode) .tag-user-details[_ngcontent-%COMP%]{margin-bottom:calc((.25rem + 0px) * var(--velt-base-rem-unit))!important;padding-right:calc((.75rem + 0px) * var(--velt-base-rem-unit))!important;padding-left:calc((.75rem + 0px) * var(--velt-base-rem-unit))!important;word-break:break-word}.tag-dialog-container[_ngcontent-%COMP%]:not(.edit-mode) .tag-action-button[_ngcontent-%COMP%]{padding:calc((.25rem + 0px) * var(--velt-base-rem-unit)) calc((.75rem + 0px) * var(--velt-base-rem-unit))!important;cursor:pointer}.tag-dialog-container[_ngcontent-%COMP%]:not(.edit-mode) .tag-action-button[_ngcontent-%COMP%]:hover{background-color:#353537}.tag-dialog-container[_ngcontent-%COMP%] .tag-input-container[_ngcontent-%COMP%]{display:flex}.tag-dialog-container[_ngcontent-%COMP%] .tag-input-container[_ngcontent-%COMP%] input[_ngcontent-%COMP%]{width:100%!important;border:0!important} .snippyly-tag-autocomplete-panel{box-shadow:0 calc((.3rem + 0px) * var(--velt-base-rem-unit)) calc((1.5rem + 0px) * var(--velt-base-rem-unit)) #0000002e!important} .snippyly-tag-autocomplete-panel::-webkit-scrollbar{display:none!important;width:0!important;height:0!important} .snippyly-tag-autocomplete-panel::-webkit-scrollbar{width:0;height:0} .snippyly-tag-autocomplete-panel::-webkit-scrollbar-button{width:0;height:0} .snippyly-tag-autocomplete-panel .user-selection-container{background:#fff;border-radius:8px;padding:calc((.5rem + 0px) * var(--velt-base-rem-unit)) 0!important} .snippyly-tag-autocomplete-panel .user-selection-container .mat-mdc-option{padding:calc((.5rem + 0px) * var(--velt-base-rem-unit))!important} .snippyly-tag-autocomplete-panel .user-selection-container .mat-mdc-option.mat-mdc-option-active{background-color:#f2f2f2!important}.contact-container[_ngcontent-%COMP%]{display:flex;align-items:center}.photo-container[_ngcontent-%COMP%]{min-width:calc((2.5rem + 0px) * var(--velt-base-rem-unit));width:calc((2.5rem + 0px) * var(--velt-base-rem-unit));min-height:calc((2.5rem + 0px) * var(--velt-base-rem-unit));height:calc((2.5rem + 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:calc((1rem + 0px) * var(--velt-base-rem-unit))!important}.photo-container-small[_ngcontent-%COMP%]{width:calc((2rem + 0px) * var(--velt-base-rem-unit));height:calc((2rem + 0px) * var(--velt-base-rem-unit));min-width:calc((2rem + 0px) * var(--velt-base-rem-unit));min-height:calc((2rem + 0px) * var(--velt-base-rem-unit));margin-right:calc((.8rem + 0px) * var(--velt-base-rem-unit))!important}.photo-container[_ngcontent-%COMP%]:before{content:"";position:absolute;inset:0;z-index:1;border-radius:inherit;background:inherit}.photo-container[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%;border-radius:50%;z-index:2;object-fit:cover}.contact-details[_ngcontent-%COMP%]{overflow:hidden}.contact-details[_ngcontent-%COMP%] .contact-name[_ngcontent-%COMP%], .contact-details[_ngcontent-%COMP%] .contact-email[_ngcontent-%COMP%]{overflow:hidden;text-overflow:ellipsis;line-height:calc((1rem + 0px) * var(--velt-base-rem-unit));font-size:calc((.875rem + 0px) * var(--velt-base-rem-unit))!important}.contact-details[_ngcontent-%COMP%] .contact-email[_ngcontent-%COMP%]{color:#6c757d!important}.photo-placeholder[_ngcontent-%COMP%]{z-index:2;opacity:.8}.tag-buttons-container[_ngcontent-%COMP%]{display:flex;flex-direction:row;align-items:center;padding-top:calc((1rem + 0px) * var(--velt-base-rem-unit))!important;background:#fff}.tag-button[_ngcontent-%COMP%]{background-color:#625df5;color:#fff!important;border:0;border-radius:4px;padding:calc((.5rem + 0px) * var(--velt-base-rem-unit)) calc((1rem + 0px) * var(--velt-base-rem-unit))!important;margin-right:calc((.5rem + 0px) * var(--velt-base-rem-unit))!important;cursor:pointer!important}.tag-button[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{color:#fff!important}.tag-button.green[_ngcontent-%COMP%]{background-color:#0dcf82!important}.tag-button[_ngcontent-%COMP%]:hover{background-color:#44aeff!important;color:#fff!important}.tag-button[_ngcontent-%COMP%]:hover.green{background-color:#10b372!important}.tag-button[disabled][_ngcontent-%COMP%], .tag-button[disabled][_ngcontent-%COMP%]:hover{background-color:#0000001a!important;color:#0006!important}.cancel-button[_ngcontent-%COMP%]{border:0;border-radius:4px;padding:calc((.5rem + 0px) * var(--velt-base-rem-unit)) calc((1rem + 0px) * var(--velt-base-rem-unit))!important;margin-right:calc((.5rem + 0px) * var(--velt-base-rem-unit))!important;cursor:pointer!important}.cancel-button[_ngcontent-%COMP%]:hover{color:#e91e63}.no-contacts-message[_ngcontent-%COMP%]{text-align:center!important} .tag-input-container velt-autocomplete-panel-internal{width:100%!important} .tag-input-container velt-autocomplete-panel-internal input{width:100%!important;border:0!important}'],changeDetection:0});let a=r;return a})();var tn=["overlay"],en=["pin"],nn=(a,r)=>({"tag-pin-selected":a,"mutiple-pins-selected":r}),on=()=>["snippyly-overlay-panel","snippyly-tag-dialog-overlay-panel","velt-overlay-panel"];function rn(a,r){a&1&&(W(),z(0,"path",8))}function an(a,r){if(a&1){let o=x();_(0,"snippyly-user-avatar",9),A("pointerover",function(e){return T(o),h().onPointerOver(e),S(e.stopPropagation())})("pointerout",function(){T(o);let e=h();return S(e.onPointerOut())}),P()}if(a&2){let o=h();u("user",o.tagPinAnnotation==null?null:o.tagPinAnnotation.to[0])("background","rgb(162, 89, 254) !important")("size",26)}}function sn(a,r){if(a&1){let o=x();_(0,"snippyly-tag-dialog",10),A("saveTag",function(e){T(o);let n=h();return S(n.saveTag.emit(e))}),P()}if(a&2){let o=h();u("annotation",o.tagPinAnnotation)("user",o.user)("tagPinSelected",o.tagPinSelected)}}var At=(()=>{let r=class r{get tagPinAnnotation(){return this._tagPinAnnotation}set tagPinAnnotation(t){this._tagPinAnnotation=t}get tagPinSelected(){return this._tagPinSelected}set tagPinSelected(t){this._tagPinSelected=t,this.updateHighlightOnElement()}get tagPinHover(){return this._tagPinHover}set tagPinHover(t){this._tagPinHover=t,this.updateHighlightOnElement()}constructor(t,e,n){this.tagService=t,this.domService=e,this.loggingService=n,this._tagPinSelected=!1,this.multipleTagPinsSelected=!1,this.avatarErrorImage="",this.deleteTagThread=new at,this.saveTag=new at,this.signInToAccessFeature=new at,this.overlayOriginX="start",this.overlayOriginY="top",this._tagPinHover=!1,this.subscriptions=[],this.positions=d.OVERLAY_POSITIONS.map(i=>new Zt({originX:i.originX,originY:i.originY},{overlayX:i.overlayX,overlayY:i.overlayY})),this.veltElement=!0,this.loggingService.log("%c[WB] Creating COMPONENT TagPinComponent","color: blue;")}ngOnInit(){this.loggingService.log("%c[WB] Calling FUNCTION: ngOnInit","color: green;")}ngAfterViewInit(){try{this.updateHighlightOnElement(),this.subscriptions.push(this.overlay.positionChange.subscribe(t=>{this.overlayOriginX=t.connectionPair.originX,this.overlayOriginY=t.connectionPair.originY},t=>{this.loggingService.catch("Error in TagPinComponent positionChange subscription: ",t)}))}catch(t){this.loggingService.catch("Error in TagPinComponent AfterViewInit: ",t)}}updateHighlightOnElement(){try{this.targetElement&&(this.tagPinSelected||this.tagPinHover?this.domService.highlightElement(this.targetElement):this.domService.removeHighlightFromElement(this.targetElement))}catch(t){this.loggingService.catch("Error in TagPinComponent updateHighlightOnElement: ",t)}}onPointerOver(t){try{t.buttons?this.tagPinHover&&(this.tagPinHover=!1):this.tagPinHover||(this.tagPinHover=!0)}catch(e){this.loggingService.catch("Error in TagPinComponent onPointerOver: ",e)}}onPointerOut(){this.tagPinHover=!1}ngOnDestroy(){this.loggingService.log("%c[WB] Calling FUNCTION: ngOnDestroy","color: green;");try{this.unsubscribe()}catch(t){this.loggingService.catch("Error in TagPinComponent ondestroy: ",t)}}unsubscribe(){this.loggingService.log("%c[WB] Calling FUNCTION: unsubscribe","color: green;");try{this.subscriptions.map(t=>{t.unsubscribe()}),this.subscriptions=[]}catch(t){this.loggingService.catch("Error in TagPinComponent unsubscribe: ",t)}}};r.\u0275fac=function(e){return new(e||r)(m(w),m(L),m(p))},r.\u0275cmp=k({type:r,selectors:[["snippyly-tag-pin"]],viewQuery:function(e,n){if(e&1&&(Z(tn,5),Z(en,5)),e&2){let i;tt(i=et())&&(n.overlay=i.first),tt(i=et())&&(n.pin=i.first)}},hostVars:1,hostBindings:function(e,n){e&2&&M("data-velt-element",n.veltElement)},inputs:{tagPinAnnotation:"tagPinAnnotation",tagPinSelected:"tagPinSelected",multipleTagPinsSelected:"multipleTagPinsSelected",avatarErrorImage:"avatarErrorImage",user:"user",targetElement:"targetElement"},outputs:{deleteTagThread:"deleteTagThread",saveTag:"saveTag",signInToAccessFeature:"signInToAccessFeature"},standalone:!1,decls:8,vars:15,consts:[["trigger","cdkOverlayOrigin"],["overlay","cdkConnectedOverlay"],["cdkOverlayOrigin","",1,"tag-pin-container",3,"click","ngClass"],["xmlns","http://www.w3.org/2000/svg","viewBox","0 0 100 100",1,"tag-pin"],["cx","50","cy","50","rx","50","ry","50",2,"stroke","rgb(0, 0, 0)","fill","rgb(162, 89, 254)","paint-order","fill","stroke-width","0px"],["d","M 24.999 77 C 24.999 77 20 77 20 72.001 C 20 66.999 24.999 51.999 50 51.999 C 75.001 51.999 80 66.999 80 72.001 C 80 77 75.001 77 75.001 77 L 24.999 77 Z M 50 47 C 61.548 47 68.764 34.5 62.991 24.499 C 60.312 19.857 55.359 17 50 17 C 38.452 17 31.236 29.5 37.009 39.499 C 39.688 44.14 44.641 47 50 47 Z","style","fill: rgb(255, 255, 255);",4,"ngIf"],["class","photo-container tag-user-avatar",3,"user","background","size","pointerover","pointerout",4,"ngIf"],["cdkConnectedOverlay","",3,"cdkConnectedOverlayOrigin","cdkConnectedOverlayOpen","cdkConnectedOverlayPanelClass","cdkConnectedOverlayOffsetY","cdkConnectedOverlayBackdropClass","cdkConnectedOverlayLockPosition","cdkConnectedOverlayPositions","cdkConnectedOverlayGrowAfterOpen"],["d","M 24.999 77 C 24.999 77 20 77 20 72.001 C 20 66.999 24.999 51.999 50 51.999 C 75.001 51.999 80 66.999 80 72.001 C 80 77 75.001 77 75.001 77 L 24.999 77 Z M 50 47 C 61.548 47 68.764 34.5 62.991 24.499 C 60.312 19.857 55.359 17 50 17 C 38.452 17 31.236 29.5 37.009 39.499 C 39.688 44.14 44.641 47 50 47 Z",2,"fill","rgb(255, 255, 255)"],[1,"photo-container","tag-user-avatar",3,"pointerover","pointerout","user","background","size"],[3,"saveTag","annotation","user","tagPinSelected"]],template:function(e,n){if(e&1){let i=x();_(0,"div",2,0),A("click",function(s){return T(i),S(s.preventDefault())}),W(),_(2,"svg",3),z(3,"ellipse",4),O(4,rn,1,0,"path",5),P(),O(5,an,1,3,"snippyly-user-avatar",6),P(),O(6,sn,1,3,"ng-template",7,1,nt)}if(e&2){let i=N(1);u("ngClass",Gt(11,nn,n.tagPinSelected,n.multipleTagPinsSelected)),v(4),u("ngIf",!(!(n.tagPinAnnotation==null||n.tagPinAnnotation.to==null)&&n.tagPinAnnotation.to.length&&(!(n.tagPinAnnotation==null||n.tagPinAnnotation.to[0]==null)&&n.tagPinAnnotation.to[0].photoUrl))),v(),u("ngIf",n.tagPinAnnotation==null||n.tagPinAnnotation.to==null?null:n.tagPinAnnotation.to.length),v(),u("cdkConnectedOverlayOrigin",i)("cdkConnectedOverlayOpen",n.tagPinSelected||n.tagPinHover)("cdkConnectedOverlayPanelClass",jt(14,on))("cdkConnectedOverlayOffsetY",n.overlayOriginY==="top"?-8:2)("cdkConnectedOverlayBackdropClass","snippyly-overlay-backdrop")("cdkConnectedOverlayLockPosition",!1)("cdkConnectedOverlayPositions",n.positions)("cdkConnectedOverlayGrowAfterOpen",!0)}},dependencies:[Wt,H,ee,te,Ee,It],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}body.velt-pin-dragging[_ngcontent-%COMP%] iframe[_ngcontent-%COMP%]{pointer-events:none!important}*[_ngcontent-%COMP%]{box-sizing:border-box;-webkit-tap-highlight-color:rgba(255,255,255,0)!important;outline:none!important;margin:0!important;padding:0!important;height:unset;width:unset;line-height:1.5!important;color:#000!important;font-size:calc((1rem + 0px) * var(--velt-base-rem-unit))}*[_ngcontent-%COMP%]:empty{display:revert!important}.tag-pin-container[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;width:32px;height:32px;text-align:center;color:#fff;font-size:calc((.8rem + 0px) * var(--velt-base-rem-unit));font-weight:500;cursor:pointer}.tag-pin[_ngcontent-%COMP%]{position:absolute;left:0;top:0;width:32px;height:32px;transition:left .12s ease-in-out,top .12s ease-in-out,width .12s ease-in-out,height .12s ease-in-out,transform .12s ease-in-out}.tag-pin-container[_ngcontent-%COMP%]:hover{filter:brightness(110%) saturate(110%)}.tag-pin-container[_ngcontent-%COMP%]:hover .tag-pin[_ngcontent-%COMP%], .tag-pin-selected[_ngcontent-%COMP%] .tag-pin[_ngcontent-%COMP%], .tag-pin-container[_ngcontent-%COMP%]:hover .photo-container[_ngcontent-%COMP%], .tag-pin-selected[_ngcontent-%COMP%] .photo-container[_ngcontent-%COMP%]{transform:scale(1.2) translateY(-4px);transition:left .12s ease-in-out,top .12s ease-in-out,width .12s ease-in-out,height .12s ease-in-out,transform .12s ease-in-out}.tag-index[_ngcontent-%COMP%]{position:absolute;border-radius:50%;border:1px solid #fff;width:20px;height:20px;text-align:center;top:-8px;right:-8px;font-size:calc((.8rem + 0px) * var(--velt-base-rem-unit));color:#000;background:#fff}.tag-pin-selected[_ngcontent-%COMP%]{filter:brightness(110%) saturate(110%)}.tag-resolved[_ngcontent-%COMP%]{background-color:#0dcf82!important}.bi-check-lg[_ngcontent-%COMP%]{color:#fff}.mutiple-pins-selected[_ngcontent-%COMP%]{border-color:#9746ff!important}.photo-container[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;position:absolute;width:32px;height:32px;box-sizing:border-box;background-clip:padding-box;border-radius:50%;padding:calc((.2rem + 0px) * var(--velt-base-rem-unit))!important;transition:top .12s ease-in-out,width .12s ease-in-out,height .12s ease-in-out,transform .12s ease-in-out;text-transform:capitalize}.photo-container[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%;border-radius:50%;object-fit:cover}.photo-placeholder[_ngcontent-%COMP%]{z-index:2;opacity:.8} snippyly-user-avatar.tag-user-avatar{background-color:#a259fe!important} snippyly-user-avatar.tag-user-avatar .s-user-avatar-initial{font-size:calc((1rem + 0px) * var(--velt-base-rem-unit))!important} .snippyly-tag-dialog-overlay-panel{z-index:2147483567!important}"],changeDetection:0});let a=r;return a})();function ln(a,r){if(a&1){let o=x();_(0,"div",1),A("pointerup",function(e){return T(o),h().togglePinSelection(),S(e.stopPropagation())})("pointerdown",function(e){return T(o),S(e.stopPropagation())})("click",function(e){return T(o),S(e.stopPropagation())})("cdkDragStarted",function(){T(o);let e=h();return S(e.onPinDragStart())})("cdkDragMoved",function(e){T(o);let n=h();return S(n.onPinMove(e))})("cdkDragReleased",function(){T(o);let e=h();return S(e.onPinRelease())}),_(1,"snippyly-tag-pin",2),A("saveTag",function(e){T(o);let n=h();return S(n.saveTag(e))}),P()()}if(a&2){let o=h();Vt("top",o.annotationDraging?(o.dragPosition==null?null:o.dragPosition.top)-16:(o.tagPinAnnotation==null||o.tagPinAnnotation.position==null?null:o.tagPinAnnotation.position.top)-16+o.offsetTop,"px")("left",o.annotationDraging?(o.dragPosition==null?null:o.dragPosition.left)-16:(o.tagPinAnnotation==null||o.tagPinAnnotation.position==null?null:o.tagPinAnnotation.position.left)-16+o.offsetLeft,"px"),st("pin-dragging",o.annotationDraging),u("id","tag-pin-contianer-"+(o.tagPinAnnotation==null?null:o.tagPinAnnotation.annotationId))("cdkDragDisabled",(o.tagPinAnnotation==null||o.tagPinAnnotation.from==null?null:o.tagPinAnnotation.from.userId)!==(o.user==null?null:o.user.userId)),v(),u("tagPinAnnotation",o.tagPinAnnotation)("tagPinSelected",o.selectedAnnotationsMap[o.tagPinAnnotation==null?null:o.tagPinAnnotation.annotationId]&&!o.annotationDraging&&o.objectKeys(o.selectedAnnotationsMap).length===1)("multipleTagPinSelected",o.selectedAnnotationsMap[o.tagPinAnnotation==null?null:o.tagPinAnnotation.annotationId]&&o.objectKeys(o.selectedAnnotationsMap).length>1)("targetElement",o.targetElement)("user",o.user)}}var Ot=(()=>{let r=class r{get tagPinAnnotation(){return this._tagPinAnnotation}set tagPinAnnotation(t){this._tagPinAnnotation=t,this.id=t.annotationId}constructor(t,e,n,i,l){this.analyticsService=t,this.authService=e,this.domService=n,this.tagService=i,this.loggingService=l,this.multipleTagPinsSelected=!1,this.avatarErrorImage="",this.offsetLeft=0,this.offsetTop=0,this.objectKeys=Object.keys,this.selectedAnnotationsMap={},this.subscriptions=[],this.annotationDraging=!1,this.dragPosition=null,this.veltElement=!0,this.subscriptions.push(this.authService.getUser$().subscribe(s=>{this.user=s},s=>{this.loggingService.catch("Error in TagPinPortalComponent getUser$ subscription: ",s)})),this.subscriptions.push(this.domService.getSelectedAnnotationsMap$().subscribe(s=>{this.selectedAnnotationsMap=s},s=>{this.loggingService.catch("Error in TagPinPortalComponent getSelectedAnnotationsMap$ subscription: ",s)}))}ngOnInit(){}togglePinSelection(){try{this.domService.toggleAnnotationSelection(this.tagPinAnnotation)}catch(t){this.loggingService.catch("Error in TagPinPortalComponent togglePinSelection: ",t)}}onPinDragStart(){this.selectedAnnotationsMap[this.tagPinAnnotation.annotationId]&&this.domService.toggleAnnotationSelection(this.tagPinAnnotation);let t=document.getElementById(this.tagPinAnnotation.annotationId);t&&(this.parentElement=t.parentElement,document.body.appendChild(t)),this.annotationDraging=!0}onPinMove(t){try{this.updateCurrentPinPosition(t)}catch(e){this.loggingService.catch("Error in TagPinPortalComponent onPinMove: ",e)}}