@veltdev/sdk-staging 6.0.0-beta.10 → 6.0.0-beta.12
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/models/data/config.data.model.d.ts +121 -0
- package/chunk-2JYR3ESH.js +1 -0
- package/{chunk-GUGGWPZ7.js → chunk-45CK3G4S.js} +1 -1
- package/{chunk-ENIVQSM6.js → chunk-63NMA3AQ.js} +1 -1
- package/chunk-6ILQARGU.js +1 -0
- package/{chunk-4QPJMZ5V.js → chunk-6LUTL3DR.js} +1 -1
- package/{chunk-W4BGGBK5.js → chunk-6RA26UDR.js} +1 -1
- package/{chunk-SQTBBRA3.js → chunk-6WCUWRDH.js} +1 -1
- package/{chunk-5W33SILU.js → chunk-A6QXRF3G.js} +1 -1
- package/chunk-ATB2ZI7G.js +1 -0
- package/chunk-BCSVTVMJ.js +167 -0
- package/{chunk-MJDGHV4Y.js → chunk-BSYABMZE.js} +1 -1
- package/{chunk-4IA5G3HQ.js → chunk-CECXGS4N.js} +1 -1
- package/chunk-DAHES7KJ.js +1 -0
- package/{chunk-57VK6E6U.js → chunk-DEGPUOWQ.js} +1 -1
- package/{chunk-3OILJMAX.js → chunk-FLGROJQW.js} +1 -1
- package/{chunk-NR3CZ6OR.js → chunk-G4N6XTDS.js} +1 -1
- package/{chunk-2YJ3NBTO.js → chunk-GW63A52V.js} +1 -1
- package/{chunk-MX66OK5A.js → chunk-HEIW3Q3Z.js} +1 -1
- package/{chunk-XAJ4ABBW.js → chunk-HRHOJT33.js} +1 -1
- package/{chunk-6TORUSYX.js → chunk-HZBOX5Z7.js} +4 -4
- package/{chunk-5SSUFLRQ.js → chunk-IE6GR57U.js} +1 -1
- package/{chunk-XJWB3IUW.js → chunk-KAYQA4GH.js} +1 -1
- package/{chunk-G56O673H.js → chunk-KBKI4VKD.js} +1 -1
- package/{chunk-ZMXXM7C4.js → chunk-NBO7Z72Y.js} +1 -1
- package/{chunk-J3FNQGWW.js → chunk-NVZIS23N.js} +2 -2
- package/chunk-S4SWAWDX.js +13 -0
- package/{chunk-JSZMRBOR.js → chunk-SLIE6W2D.js} +1 -1
- package/{chunk-DP4GMASO.js → chunk-TJFCTUCM.js} +1 -1
- package/{chunk-3OIAZGVH.js → chunk-TNSFEAOB.js} +1 -1
- package/{chunk-G2POMKRC.js → chunk-UQ2QOHQZ.js} +1 -1
- package/{chunk-AMBQ736A.js → chunk-WXTTF7HW.js} +1 -1
- package/{chunk-LAUYCNER.js → chunk-Z54SH2OU.js} +1 -1
- package/{chunk-QDQ2XJUX.js → chunk-ZZK5UGYN.js} +1 -1
- package/package.json +1 -1
- package/velt-activity-log.js +1 -1
- package/velt-area.js +1 -1
- package/velt-arrow.js +2 -2
- package/velt-comment.js +6 -6
- package/velt-crdt.js +1 -1
- package/velt-cursor.js +2 -2
- package/velt-huddle.js +3 -3
- package/velt-live-state-sync.js +2 -2
- package/velt-notification.js +1 -1
- package/velt-presence.js +1 -1
- package/velt-reaction.js +1 -1
- package/velt-recorder.js +1 -1
- package/velt-rewriter.js +2 -2
- package/velt-selection.js +1 -1
- package/velt-tag.js +1 -1
- package/velt-user-invite.js +1 -1
- package/velt-user-request.js +1 -1
- package/velt-video-player.js +1 -1
- package/velt-views.js +3 -3
- package/velt.js +264 -20
- package/chunk-52EPUXSU.js +0 -13
- package/chunk-EWNXINED.js +0 -1
- package/chunk-HDABOQPS.js +0 -1
- package/chunk-RMV5EWSF.js +0 -1
- package/chunk-TY3WZ4Q4.js +0 -167
- package/chunk-YSZQAETY.js +0 -1
package/velt-selection.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as nt}from"./chunk-DP4GMASO.js";import{t as tt}from"./chunk-JSZMRBOR.js";import"./chunk-2YJ3NBTO.js";import"./chunk-LAUYCNER.js";import"./chunk-4QPJMZ5V.js";import"./chunk-G2POMKRC.js";import"./chunk-NR3CZ6OR.js";import"./chunk-MX66OK5A.js";import{b as Ze,d as et}from"./chunk-XJWB3IUW.js";import{a as it}from"./chunk-G56O673H.js";import{G as Ae,H as we,I as Re,r as Ue,t as Ne,v as Le}from"./chunk-J3FNQGWW.js";import{$ as me,$f as ie,Bf as F,Cf as X,Ci as Ke,Db as Ie,Dd as Fe,De as te,Df as H,E as N,Eb as ye,Fa as p,Fb as Ce,Fc as Pe,Fg as ze,Gc as De,Gd as ee,Gg as je,Hd as $e,Hg as We,Hi as Qe,I as se,Ib as Q,J as ae,Jb as R,L as ce,M as ge,Ma as Se,Nb as j,Ob as Te,Pa as z,Pb as q,Pc as ke,Qf as Me,Qi as qe,Sd as Be,T,Ta as fe,Te as y,Ua as Ee,Va as be,W as G,Wd as He,X as he,_a as x,a as E,aa as de,ac as xe,b as I,bb as _e,bc as Oe,ca as b,db as L,g as le,je as S,kc as W,l as k,la as ue,lb as _,lc as V,lg as ne,mb as w,nb as B,ob as K,og as re,oi as Ve,pc as Z,pg as Ge,pi as g,qa as ve,qi as Xe,r as C,sb as O,tb as P,ui as Ye,v as U,vi as Je,wa as pe,zb as v}from"./chunk-TY3WZ4Q4.js";var ht=["selectionElementPortalOverlay"],mt=()=>["velt-overlay-panel"],dt=s=>[s];function ut(s,n){if(s&1&&(O(0),w(1,"span",10),j(2),W(3,"translate"),B(),P()),s&2){let r=v(),e=r.$implicit,t=r.index,i=v(5);p(),R("--velt-selection-color",e==null||e.user==null?null:e.user.color),L("data-testid",i.componentId+"-user-name-"+t),p(),Te(V(3,4,(e==null||e.user==null?null:e.user.name)||(e==null||e.user==null?null:e.user.email)))}}function vt(s,n){if(s&1&&(O(0),x(1,ut,4,6,"ng-container",3),P()),s&2){let r=n.index,e=v(5);p(),_("ngIf",r<e.maxCount)}}function pt(s,n){if(s&1&&(w(0,"span",11),j(1),B()),s&2){let r=v(4).ngIf,e=v();R("--velt-selection-color",(r.selections[0]==null||r.selections[0].user==null?null:r.selections[0].user.color)||"white"),L("data-testid",e.componentId+"-additional-count")("aria-label",(r.selections==null?null:r.selections.length)-e.maxCount+" additional users"),p(),q("+",(r.selections==null?null:r.selections.length)-e.maxCount)}}function St(s,n){if(s&1&&(O(0),w(1,"div",7),W(2,"translate"),x(3,vt,2,1,"ng-container",8)(4,pt,2,5,"span",9),B(),P()),s&2){let r=v(3).ngIf,e=v();p(),L("data-testid",e.componentId+"-label-container")("aria-label",V(2,4,"Selected users")),p(2),_("ngForOf",r.selections),p(),_("ngIf",(r.selections==null?null:r.selections.length)>e.maxCount)}}function ft(s,n){if(s&1&&(O(0),K(1,"snippyly-user-avatar",13),P()),s&2){let r=v(),e=r.$implicit,t=r.index;p(),R("--velt-selection-color",e==null||e.user==null?null:e.user.color)("--velt-selection-user-index",t),_("size",20)("user",e==null?null:e.user)}}function Et(s,n){if(s&1&&(O(0),x(1,ft,2,6,"ng-container",3),P()),s&2){let r=n.index,e=v(5);p(),_("ngIf",r<e.maxCount)}}function bt(s,n){if(s&1&&(w(0,"div",14),W(1,"translate"),w(2,"span",15),j(3),B()()),s&2){let r=v(4).ngIf,e=v();R("--velt-selection-user-index",r.selections==null?null:r.selections.length)("background-color",(r.selections[(r.selections==null?null:r.selections.length)-1]==null||r.selections[(r.selections==null?null:r.selections.length)-1].user==null?null:r.selections[(r.selections==null?null:r.selections.length)-1].user.color)||"white"),L("data-testid",e.componentId+"-additional-avatars")("aria-label",(r.selections==null?null:r.selections.length)-e.maxCount+" "+V(1,7,"additional users")),p(3),q("+",(r.selections==null?null:r.selections.length)-e.maxCount)}}function _t(s,n){if(s&1&&x(0,Et,2,1,"ng-container",8)(1,bt,4,9,"div",12),s&2){let r=v(3).ngIf,e=v();_("ngForOf",r.selections),p(),_("ngIf",(r.selections==null?null:r.selections.length)>e.maxCount)}}function It(s,n){if(s&1&&x(0,St,5,6,"ng-container",6)(1,_t,2,2,"ng-template",null,2,Z),s&2){let r=Q(2),e=v(2).ngIf,t=v();_("ngIf",(e==null?null:e.userIndicatorType)===(t.userIndicatorTypes==null?null:t.userIndicatorTypes.Label))("ngIfElse",r)}}function yt(s,n){if(s&1&&(O(0),K(1,"div",4,0),x(3,It,3,2,"ng-template",5,1,Z),P()),s&2){let r=Q(2),e=v().ngIf,t=v();p(),R("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"),_("id","selection-element-contianer-"+(t.highlight.user==null?null:t.highlight.user.userSnippylyId)),L("data-testid",t.componentId),p(2),_("cdkConnectedOverlayOrigin",r)("cdkConnectedOverlayOpen",!0)("cdkConnectedOverlayLockPosition",!1)("cdkConnectedOverlayGrowAfterOpen",!0)("cdkConnectedOverlayDisableClose",!0)("cdkConnectedOverlayPanelClass",xe(13,mt))("cdkConnectedOverlayPositions",Oe(14,dt,e==null?null:e.overlayPosition))}}function Ct(s,n){if(s&1&&(O(0),x(1,yt,5,16,"ng-container",3),P()),s&2){let r=n.ngIf;p(),_("ngIf",r==null?null:r.position)}}var oe=(()=>{let n=class n{get highlight(){return this._highlight}set highlight(e){this._highlight=e,this.calculatePosition()}constructor(e,t,i){this.loggingService=e,this.selectionService=t,this.elementRef=i,this._highlight=new F,this.position=null,this.userIndicatorTypes=H,this.offsetLeft=0,this.offsetTop=0,this.maxCount=1,this.componentConfigSignal=ve({userIndicatorPosition:X.End,userIndicatorType:H.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 o=this.selectionService.getUserIndicatorPosition(),h=this.selectionService.getUserIndicatorType();this.componentConfigSignal.update(d=>(d=I(E({},d),{userIndicatorPosition:o,userIndicatorType:h}),d)),this.setOverlayPosition(o)}catch(o){this.loggingService.log("Error in SelectionElementPortalComponent constructor: ",o)}}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=I(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{this.loggingService.log("%c[WB] Calling SelectionElementPortalComponent FUNCTION: setOverlayPosition","color: green;"),e==="start"?this.componentConfigSignal.update(t=>(t=I(E({},t),{overlayPosition:{originX:"start",originY:"top",overlayX:"start",overlayY:"top"}}),t)):this.componentConfigSignal.update(t=>(t=I(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=ze(this.highlight.targetElement);if(e){let t=e.iterateNext(),i,o=null,h=null;try{i=JSON.parse(t?.getAttribute(y.ATTRIBUTES.VELT_SELECTION_CONFIG)||"{}"),o=t?.getAttribute(y.ATTRIBUTES.VELT_LIVE_SELECTION_USER_INDICATOR_POSITION)||this.componentConfigSignal().userIndicatorPosition,o&&this.setOverlayPosition(o),h=t?.getAttribute(y.ATTRIBUTES.VELT_LIVE_SELECTION_USER_INDICATOR_TYPE)||this.componentConfigSignal().userIndicatorType,this.componentConfigSignal.update(a=>(a=I(E({},a),{userIndicatorPosition:o,userIndicatorType:h}),a))}catch{}let d;if(i?.horizontal&&(d=i.horizontal),o==="start"?d="top-start":d="top-right",t){let a=t.getBoundingClientRect();if(a&&a.width&&a.height)switch(d){case"left":this.position={top:a.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:a.width};break;case"bottom-left":this.position={top:a.height+4,left:0};break;case"bottom-right":this.position={top:a.height+4,left:a.width-32};break;case"center-left":this.position={top:a.height/2-16,left:-32};break;case"center-right":this.position={top:a.height/2-16,left:a.width+4};break;default:this.position={top:-32,left:a.width}}else this.position=null}else this.position=null}else this.position=null}this.componentConfigSignal.update(e=>(e=I(E({},e),{position:this.position}),e))}catch(e){this.loggingService.catch("Error in SelectionElementPortalComponent calculatePosition: ",e)}}};n.\u0275fac=function(t){return new(t||n)(z(g),z(f),z(pe))},n.\u0275cmp=Ee({type:n,selectors:[["app-selection-element-portal"]],viewQuery:function(t,i){if(t&1&&Ie(ht,5),t&2){let o;ye(o=Ce())&&(i.selectionElementPortalOverlay=o.first)}},hostVars:1,hostBindings:function(t,i){t&2&&L("data-velt-element",i.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,i){t&1&&x(0,Ct,2,1,"ng-container",3),t&2&&_("ngIf",i.componentConfigSignal())},dependencies:[Pe,De,we,Ae,et,Ze],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}[_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-agent-accent: #4495ff;--velt-agent-accent-transparent: rgba(68, 149, 255, .2);--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 s=n;return s})();var f=(()=>{let n=class n{constructor(e,t,i,o,h,d,a,D,J,lt,st,at){this.afAuth=e,this.analyticsService=t,this.authService=i,this.configService=o,this.databaseService=h,this.docService=d,this.domService=a,this.componentFactoryResolver=D,this.injector=J,this.appRef=lt,this.loggingService=st,this.commonDbService=at,this.documentPaths=null,this.textSelections={},this.enableSelections$=new k(!1),this.userIndicatorEnabled$=new k(!0),this.userIndicatorPosition$=new k(X.End),this.userIndicatorType$=new k(H.Avatar),this.defaultElementsTrackingEnabled$=new k(!0),this.defaultStylingEnabled$=new k(!0),this.inactivityTime=300*1e3,this.userIdleStateDetectionSubscription=null,this.elementSelections={},this.databaseService.getDb().pipe(N(l=>!!l),ae(1)).subscribe(l=>{l&&(this.updateOnDocumentFocusChange(),this.updateOnUserDbConnectionStateChange(l).subscribe(()=>{},m=>{this.loggingService.catch("Error in SelectionService constructor updateOnUserDbConnectionStateChange: ",m)}))},l=>{this.loggingService.catch("Error in SelectionService getDb subscription: ",l)}),this.authService.getUser$().subscribe(l=>{l?this.detectUserIdleState():this.unsubscribeUserIdleStateDetectionSubscription()}),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 m=this.getSelectionEnabledElement(l.target);if(m&&!ne(m)){let u=this.domService.getXPath(m);if(u){let c=new F;c.type="click",c.targetElement=u,c.timestamp=this.timestamp,this.setSelection(c)}}else this.removeSelection()}}catch(m){this.loggingService.catch("Error in SelectionService onDocumentClick$: ",m)}},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 m=this.getSelectionEnabledElement(l.target);if(m&&!ne(m)){let u=this.domService.getXPath(m);if(u){let c=new F;c.type="focus",c.targetElement=u,c.timestamp=this.timestamp,this.setSelection(c)}}else this.removeSelection()}}catch(m){this.loggingService.catch("Error in SelectionService onDocumentFocus$: ",m)}},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(T(()=>this.isFeatureAllowed$({})),N(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 m=je([l]),u=new F;u.type="selection",u.targetTextRange=m?.length?m[0]:null,u.timestamp=this.timestamp,this.setSelection(u)}}}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(ge()).subscribe(([l,m])=>{try{if(l){let u=[];Object.keys(l).forEach(c=>{let A=l[c],$=m?m[c]:null;!re(A,$)&&c!==this.getUserIdHash(this.user)&&u.push(A)}),u.forEach(c=>{if(c.targetElement){let A=this.elementSelections[c?.targetElement]?.portalRef,M=(this.elementSelections[c?.targetElement]?.selections||[]).filter(ct=>this.getUserIdHash(ct.user)!==this.getUserIdHash(c?.user));M?.length?(A.instance.setSelections(M.slice()),this.elementSelections[c?.targetElement].selections=M.slice(),this.highlightElement(M[0])):(this.removeHighlightFromElement(c),this.removeSelectionElement(c))}else c.targetTextRange&&this.removeHighlightFromText(c)})}if(m){let u=[];Object.keys(m).forEach(c=>{let A=l?l[c]:null,$=m[c];!re(A,$)&&c!==this.getUserIdHash(this.user)&&u.push($)}),u.forEach(c=>{c.targetElement?(this.highlightElement(c),this.getUserIndicatorEnabled()&&this.setElementHighlight(c)):c.targetTextRange&&this.highlightText(c)})}}catch(u){this.loggingService.catch("Error in SelectionService getSelectionsOnCurrentDocument: ",u)}},l=>{this.loggingService.catch("Error in SelectionService getSelectionsOnCurrentDocument subscription: ",l)}),this.authService.addPreSignOutFuction("highlight-signout",this.signOutUser.bind(this))}detectUserIdleState(){try{this.unsubscribeUserIdleStateDetectionSubscription();let e=!1;this.userIdleStateDetectionSubscription=this.domService.onWindowPointerMove$().pipe(he(2e3),G(()=>{e&&(e=!1)}),se(this.inactivityTime),G(()=>{this.removeSelection(),e=!0})).subscribe()}catch(e){this.loggingService.catch("Error in detectUserIdleState: ",e)}}unsubscribeUserIdleStateDetectionSubscription(){try{this.userIdleStateDetectionSubscription&&(this.userIdleStateDetectionSubscription.unsubscribe(),this.userIdleStateDetectionSubscription=null)}catch(e){this.loggingService.catch("Error in unsubscribeUserIdleStateDetectionSubscription: ",e)}}isFeatureAllowed(){return ie(this.configService.getConfig(),this.authService.getUser(),te.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;"),ee(this.afAuth).pipe(N(e=>!!e),T(e=>this.isFeatureAllowed$({firebaseUser:e})),T(e=>e.featureAllowed?C(e).pipe(T(t=>this.docService.getDocumentPaths$().pipe(U(i=>(this.documentPaths=i,t)))),T(t=>t?.user?t?.user?.isAnonymous?C(null):this.documentPaths?this.databaseService.getDb().pipe(N(i=>!!i),T(i=>this.documentPaths?.selection?this.commonDbService.dbListener({feature:"allSelections",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}}).pipe(U(o=>o?.data),U(o=>this.filterActiveSelections(o))):C(null))):C(null):C(null))):C(null)))}isFeatureAllowed$(e){return this.configService.getConfig$().pipe(N(t=>!!t),U(t=>I(E({},e),{config:t})),T(t=>this.authService.getUser$().pipe(U(i=>(this.user=i,I(E({},t),{user:i}))))),T(t=>ie(t.config,t.user,te.LIVE_SELECTION)?C(I(E({},t),{featureAllowed:!0})):(this.loggingService.warn("Live Selection feature is not allowed."),C(I(E({},t),{featureAllowed:!1})))),ce((t,i)=>t?.featureAllowed===i?.featureAllowed))}filterActiveSelections(e){this.loggingService.log("%c[WB] Calling FUNCTION: filterOnlineUsers","color: green;");try{if(e&&typeof e=="object"&&Object.keys(e).length){let t={},i=this.commonDbService.getServerTimestamp();return Object.keys(e).forEach(o=>{let h=e[o];h?.timestamp&&Math.abs(i-h.timestamp)<this.inactivityTime&&(t[o]=h)}),t}return e}catch(t){return this.loggingService.catch("Error in filterOnlineUsers:",t),e}}setSelection(e){try{if(this.user?.userId&&this.documentPaths?.selection){e.user=this.user;let t=JSON.parse(JSON.stringify(e));t&&!t?.timestamp&&(t.timestamp=this.timestamp),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)}}updateOnUserDbConnectionStateChange(e){return this.loggingService.log("%c[WB] Calling FUNCTION: updateOnUserDbConnectionStateChange","color: green;"),ee(this.afAuth).pipe(N(t=>!!t),T(t=>this.docService.getDocumentPaths$().pipe(U(i=>t))),G(t=>le(this,null,function*(){try{if(this.documentPaths&&t){let i=yield $e(t,!0).catch(h=>null);if(!i)return;let{user:o}=i.claims;if(o&&this.documentPaths?.selection){let h=this.getUserIdHash(o);if(h){let d=`${this.documentPaths.selection}/${h}`,a=He(e,d);Be(a).remove().catch(D=>{this.loggingService.catch("Error in SelectionService updateOnUserDbConnectionStateChange onDisconnect:",D)})}}}}catch(i){this.loggingService.catch("Error in SelectionService updateOnUserDbConnectionStateChange:",i)}})))}highlightElement(e){try{let t=this.domService.getXPath(e.targetElement);if(t){let i=t.iterateNext();if(i){let o=["input","textarea","select","button"],h;try{i?.getAttribute(y.ATTRIBUTES.VELT_SELECTION_CONFIG)&&(h=JSON.parse(i?.getAttribute(y.ATTRIBUTES.VELT_SELECTION_CONFIG)||"{}"))}catch{}(!h||h?.border)&&this.domService.highlightUserElement(i,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 i=t.iterateNext();i&&this.domService.removeHighlightUserFromElement(i)}}catch(t){this.loggingService.catch("Error in SelectionService removeHighlightFromElement: ",t)}}highlightText(e){try{if(e?.targetTextRange){let t=Ge(e.targetTextRange?.text,this.domService.getXPath(e.targetTextRange?.commonAncestorContainer).iterateNext(),e.targetTextRange?.occurrence),i=new Range;try{i.setStart(t[0].textNode,t[0].startOffset||0),i.setEnd(t[t.length-1].textNode,t[t.length-1].endOffset||0)}catch{}if(i.toString()===e.targetTextRange?.text){let o=nt(i,y.TAGS.SNIPPYLY_HIGHLIGHT_USER_TEXT),h=[],d=this.getSelectionUserMarker(e.user);if(o&&o.length&&(o.forEach(a=>{a?.textContent?.trim()&&(this.domService.addClassToElement(a,a.tagName?.toLowerCase()),this.domService.addClassToElement(a,y.VELT_LIVE_SELECTION_ON_TEXT),this.getDefaultStylingEnabled()&&this.domService.addClassToElement(a,y.VELT_LIVE_SELECTION_ON_TEXT_DEFAULT),e.user?.color&&a.style.setProperty(y.VELT_SELECTION_COLOR,e.user?.color+"55"),h.push({element:a,textNode:a.childNodes[0]}))}),d)){let a=o.filter(J=>J?.textContent?.trim()),D=a?.length?a[a?.length-1]:null;D&&D.parentNode.insertBefore(d,D.nextSibling)}this.textSelections[this.getUserIdHash(e?.user)]={textNodes:h,marker:d}}}}catch(t){this.loggingService.catch("Error in SelectionService highlightText: ",t)}}removeHighlightFromText(e){try{let t=this.getUserIdHash(e?.user);t&&this.textSelections[t]?.textNodes?.length&&(this.textSelections[t].textNodes.forEach(i=>{i?.element&&i?.textNode&&i.element.replaceWith(i.textNode),i.textNode&&i.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 i=document.createElement("span");i.classList.add("snippyly-user-marker-line");let o=document.createElement("span");return o.classList.add("snippyly-user-marker-dot"),i.appendChild(o),t.appendChild(i),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,i)=>{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(o=>{o&&this.commonDbService.deleteData({feature:"selection",errorCallback:h=>{i(h)},callback:()=>{t(null)},properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,userId:this.getUserIdHash(this.user)??"",skipFirestore:!0}}),t(null)}).catch(o=>{this.loggingService.catch("Error in SelectionService signOutUser subscription: ",o),i(o)}):t(null)}catch(o){this.loggingService.catch("Error in SelectionService signOutUser:",o),i(o)}})}setInactivityTime(e){try{this.inactivityTime=e,this.analyticsService.trackEvent(S.Events.Selection.SELECTION_SET_CUSTOM_INACTIVITY_TIMER,{inactivityTime:this.inactivityTime}),this.detectUserIdleState()}catch(t){this.loggingService.catch("Error in SelectionService setInactivityTime: ",t)}}getInactivityTime(){return this.inactivityTime}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&&y.SELECTION_ENABLED_ELEMENTS[e.tagName?.toLowerCase()]?e:We(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(o=>this.getUserIdHash(o.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 i=t.iterateNext();if(i){let o=this.domService.getHostElement(i),h=new Ue(oe),d=new Ne(o,this.appRef,this.injector),a=d.attach(h);a.instance.highlight=e,a.instance.setSelections([e]),this.elementSelections[e.targetElement]={selectionHostDomPortalOutlet:d,selectionElementPortal:h,portalRef:a,selections:[JSON.parse(JSON.stringify(e))],userTargetElement:i,selectionHostElement:o,targetElement:e.targetElement},this.updateElementOffset(e)}}}catch(t){this.loggingService.catch("Error in SelectionService setSelectionElement: ",t)}}updateElementOffset(e){try{let{portalRef:t,userTargetElement:i,selectionHostElement:o}=this.elementSelections[e.targetElement],h=this.domService.getElementOffset(i,o);t.instance.offsetLeft=h.offsetLeft,t.instance.offsetTop=h.offsetTop}catch(t){this.loggingService.catch("Error in SelectionService updateElementOffset: ",t)}}checkElementHighlightsToRemove(e){try{let t=e.map(i=>i.targetElement);Object.keys(this.elementSelections).forEach(i=>{if(!t.includes(i)){let o=this.elementSelections[i];o&&(o.selectionHostDomPortalOutlet.detach(),this.domService.removeHighlightFromElement(o.selectionHostElement)),delete this.elementSelections[i]}})}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?Me(e?.userId):null}catch(t){return this.loggingService.catch("Error in SelectionService getUserIdHash: ",t),null}}get timestamp(){return this.commonDbService.getServerTimestamp()}};n.\u0275fac=function(t){return new(t||n)(b(Fe),b(Ve),b(Je),b(Xe),b(Ke),b(Qe),b(Ye),b(Se),b(ue),b(_e),b(g),b(qe))},n.\u0275prov=me({token:n,factory:n.\u0275fac,providedIn:"root"});let s=n;return s})();var Y=class extends it{constructor(n){super(n),this.getService(g).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,this.setInactivityTime=this._setInactivityTime}_enableLiveSelection(){this.getService(g).log("%c[WB] Calling FUNCTION: _enableLiveSelection","color: green;");try{this.trackEvent(S.Events.Selection.ENABLE_LIVE_SELECTION_TRIGGERED),this.getService(f).enableSelections(!0)}catch(n){this.getService(g).catch("Error in enableLiveSelection: ",n)}}_disableLiveSelection(){this.getService(g).log("%c[WB] Calling FUNCTION: _disableLiveSelection","color: green;");try{this.trackEvent(S.Events.Selection.DISABLE_LIVE_SELECTION_TRIGGERED),this.getService(f).enableSelections(!1)}catch(n){this.getService(g).catch("Error in disableLiveSelection: ",n)}}_enableUserIndicator(){this.getService(g).log("%c[WB] Calling FUNCTION: enableUserIndicator","color: green;");try{this.trackEvent(S.Events.Selection.ENABLE_USER_INDICATOR_TRIGGERED),this.getService(f).enableUserIndicator()}catch(n){this.getService(g).catch("Error in _enableUserIndicator: ",n)}}_disableUserIndicator(){this.getService(g).log("%c[WB] Calling FUNCTION: disableUserIndicator","color: green;");try{this.trackEvent(S.Events.Selection.DISABLE_USER_INDICATOR_TRIGGERED),this.getService(f).disableUserIndicator()}catch(n){this.getService(g).catch("Error in _disableUserIndicator: ",n)}}_setUserIndicatorPosition(n){this.getService(g).log("%c[WB] Calling FUNCTION: setUserIndicatorPosition","color: green;");try{this.trackEvent(S.Events.Selection.SET_USER_INDICATOR_POSITION_TRIGGERED,{payload:{position:n}}),this.getService(f).setUserIndicatorPosition(n)}catch(r){this.getService(g).catch("Error in _setUserIndicatorPosition: ",r)}}_setUserIndicatorType(n){this.getService(g).log("%c[WB] Calling FUNCTION: setUserIndicatorType","color: green;");try{this.trackEvent(S.Events.Selection.SET_USER_INDICATOR_TYPE_TRIGGERED,{payload:{type:n}}),this.getService(f).setUserIndicatorType(n)}catch(r){this.getService(g).catch("Error in _setUserIndicatorType: ",r)}}_enableDefaultElementsTracking(){this.getService(g).log("%c[WB] Calling FUNCTION: enableDefaultElementsTracking","color: green;");try{this.trackEvent(S.Events.Selection.ENABLE_DEFAULT_ELEMENTS_TRACKING_TRIGGERED),this.getService(f).enableDefaultElementsTracking()}catch(n){this.getService(g).catch("Error in _enableDefaultElementsTracking: ",n)}}_disableDefaultElementsTracking(){this.getService(g).log("%c[WB] Calling FUNCTION: disableDefaultElementsTracking","color: green;");try{this.trackEvent(S.Events.Selection.DISABLE_DEFAULT_ELEMENTS_TRACKING_TRIGGERED),this.getService(f).disableDefaultElementsTracking()}catch(n){this.getService(g).catch("Error in _disableDefaultElementsTracking: ",n)}}_enableDefaultStyling(){this.getService(g).log("%c[WB] Calling FUNCTION: enableDefaultStyling","color: green;");try{this.trackEvent(S.Events.Selection.ENABLE_DEFAULT_STYLING_TRIGGERED),this.getService(f).enableDefaultStyling()}catch(n){this.getService(g).catch("Error in _enableDefaultStyling: ",n)}}_disableDefaultStyling(){this.getService(g).log("%c[WB] Calling FUNCTION: disableDefaultStyling","color: green;");try{this.trackEvent(S.Events.Selection.DISABLE_DEFAULT_STYLING_TRIGGERED),this.getService(f).disableDefaultStyling()}catch(n){this.getService(g).catch("Error in _disableDefaultStyling: ",n)}}_getLiveSelectionData(){this.getService(g).log("%c[WB] Calling FUNCTION: getLiveSelectionData","color: green;");try{return this.trackEvent(S.Events.Selection.GET_LIVE_SELECTION_DATA_TRIGGERED),this.getService(f).getSelectionsOnCurrentDocument()}catch(n){return this.getService(g).catch("Error in _getLiveSelectionData: ",n),C(null)}}_setInactivityTime(n){this.getService(g).log("%c[WB] Calling FUNCTION: _setInactivityTime","color: green;");try{this.trackEvent(S.Events.Selection.SET_INACTIVITY_TIME_TRIGGERED,{payload:{time:n}}),!isNaN(n)&&n>0?this.getService(f).setInactivityTime(n):this.getService(g).catch("Error in setInactivityTime: ","Provided value must be a positive number greater than zero.")}catch(r){this.getService(g).catch("Error in setInactivityTime: ",r)}}};var ot=(()=>{let n=class n{};n.\u0275fac=function(t){return new(t||n)},n.\u0275mod=be({type:n}),n.\u0275inj=de({imports:[ke,Re,Le,tt]});let s=n;return s})();function xt(s){return s.get(g).log("%c[WB] Loading selection feature chunk","color: blue;"),fe(ot,s),new Y(s)}export{xt as default};
|
|
1
|
+
import{a as et}from"./chunk-TJFCTUCM.js";import{t as qe}from"./chunk-SLIE6W2D.js";import"./chunk-GW63A52V.js";import"./chunk-Z54SH2OU.js";import"./chunk-6LUTL3DR.js";import"./chunk-UQ2QOHQZ.js";import"./chunk-G4N6XTDS.js";import"./chunk-HEIW3Q3Z.js";import{b as Ke,d as Qe}from"./chunk-KAYQA4GH.js";import{a as Ze}from"./chunk-KBKI4VKD.js";import{G as Le,H as Ae,I as we,r as ke,t as Ue,v as Ne}from"./chunk-NVZIS23N.js";import{$ as he,$f as ne,Bf as Fe,Db as _e,Dd as Re,De as y,E as N,Eb as Ie,Fa as p,Fb as ye,Fc as Oe,Gc as Pe,Gi as Ye,Hi as Je,I as le,Ib as Q,J as se,Jb as R,L as ae,M as ce,Ma as pe,Mf as te,Nb as z,Ob as Ce,Pa as j,Pb as q,Pc as De,T,Ta as Se,Ua as fe,Va as Ee,W as G,X as ge,Yf as ie,_a as x,a as b,aa as me,ac as Te,ag as $e,b as I,bb as be,bc as xe,bi as Ge,ca as E,ci as g,db as L,di as je,g as oe,kc as W,kf as F,ki as ze,l as k,la as de,lb as _,lc as V,lf as X,li as We,mb as w,mf as H,nb as B,ne as ee,ob as K,pc as Z,qa as ue,qg as Be,r as C,rg as He,sb as O,sg as Me,si as Ve,tb as P,uh as S,v as U,wa as ve,xi as Xe,zb as v}from"./chunk-BCSVTVMJ.js";var ct=["selectionElementPortalOverlay"],gt=()=>["velt-overlay-panel"],ht=s=>[s];function mt(s,n){if(s&1&&(O(0),w(1,"span",10),z(2),W(3,"translate"),B(),P()),s&2){let r=v(),e=r.$implicit,t=r.index,i=v(5);p(),R("--velt-selection-color",e==null||e.user==null?null:e.user.color),L("data-testid",i.componentId+"-user-name-"+t),p(),Ce(V(3,4,(e==null||e.user==null?null:e.user.name)||(e==null||e.user==null?null:e.user.email)))}}function dt(s,n){if(s&1&&(O(0),x(1,mt,4,6,"ng-container",3),P()),s&2){let r=n.index,e=v(5);p(),_("ngIf",r<e.maxCount)}}function ut(s,n){if(s&1&&(w(0,"span",11),z(1),B()),s&2){let r=v(4).ngIf,e=v();R("--velt-selection-color",(r.selections[0]==null||r.selections[0].user==null?null:r.selections[0].user.color)||"white"),L("data-testid",e.componentId+"-additional-count")("aria-label",(r.selections==null?null:r.selections.length)-e.maxCount+" additional users"),p(),q("+",(r.selections==null?null:r.selections.length)-e.maxCount)}}function vt(s,n){if(s&1&&(O(0),w(1,"div",7),W(2,"translate"),x(3,dt,2,1,"ng-container",8)(4,ut,2,5,"span",9),B(),P()),s&2){let r=v(3).ngIf,e=v();p(),L("data-testid",e.componentId+"-label-container")("aria-label",V(2,4,"Selected users")),p(2),_("ngForOf",r.selections),p(),_("ngIf",(r.selections==null?null:r.selections.length)>e.maxCount)}}function pt(s,n){if(s&1&&(O(0),K(1,"snippyly-user-avatar",13),P()),s&2){let r=v(),e=r.$implicit,t=r.index;p(),R("--velt-selection-color",e==null||e.user==null?null:e.user.color)("--velt-selection-user-index",t),_("size",20)("user",e==null?null:e.user)}}function St(s,n){if(s&1&&(O(0),x(1,pt,2,6,"ng-container",3),P()),s&2){let r=n.index,e=v(5);p(),_("ngIf",r<e.maxCount)}}function ft(s,n){if(s&1&&(w(0,"div",14),W(1,"translate"),w(2,"span",15),z(3),B()()),s&2){let r=v(4).ngIf,e=v();R("--velt-selection-user-index",r.selections==null?null:r.selections.length)("background-color",(r.selections[(r.selections==null?null:r.selections.length)-1]==null||r.selections[(r.selections==null?null:r.selections.length)-1].user==null?null:r.selections[(r.selections==null?null:r.selections.length)-1].user.color)||"white"),L("data-testid",e.componentId+"-additional-avatars")("aria-label",(r.selections==null?null:r.selections.length)-e.maxCount+" "+V(1,7,"additional users")),p(3),q("+",(r.selections==null?null:r.selections.length)-e.maxCount)}}function Et(s,n){if(s&1&&x(0,St,2,1,"ng-container",8)(1,ft,4,9,"div",12),s&2){let r=v(3).ngIf,e=v();_("ngForOf",r.selections),p(),_("ngIf",(r.selections==null?null:r.selections.length)>e.maxCount)}}function bt(s,n){if(s&1&&x(0,vt,5,6,"ng-container",6)(1,Et,2,2,"ng-template",null,2,Z),s&2){let r=Q(2),e=v(2).ngIf,t=v();_("ngIf",(e==null?null:e.userIndicatorType)===(t.userIndicatorTypes==null?null:t.userIndicatorTypes.Label))("ngIfElse",r)}}function _t(s,n){if(s&1&&(O(0),K(1,"div",4,0),x(3,bt,3,2,"ng-template",5,1,Z),P()),s&2){let r=Q(2),e=v().ngIf,t=v();p(),R("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"),_("id","selection-element-contianer-"+(t.highlight.user==null?null:t.highlight.user.userSnippylyId)),L("data-testid",t.componentId),p(2),_("cdkConnectedOverlayOrigin",r)("cdkConnectedOverlayOpen",!0)("cdkConnectedOverlayLockPosition",!1)("cdkConnectedOverlayGrowAfterOpen",!0)("cdkConnectedOverlayDisableClose",!0)("cdkConnectedOverlayPanelClass",Te(13,gt))("cdkConnectedOverlayPositions",xe(14,ht,e==null?null:e.overlayPosition))}}function It(s,n){if(s&1&&(O(0),x(1,_t,5,16,"ng-container",3),P()),s&2){let r=n.ngIf;p(),_("ngIf",r==null?null:r.position)}}var re=(()=>{let n=class n{get highlight(){return this._highlight}set highlight(e){this._highlight=e,this.calculatePosition()}constructor(e,t,i){this.loggingService=e,this.selectionService=t,this.elementRef=i,this._highlight=new F,this.position=null,this.userIndicatorTypes=H,this.offsetLeft=0,this.offsetTop=0,this.maxCount=1,this.componentConfigSignal=ue({userIndicatorPosition:X.End,userIndicatorType:H.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 o=this.selectionService.getUserIndicatorPosition(),h=this.selectionService.getUserIndicatorType();this.componentConfigSignal.update(d=>(d=I(b({},d),{userIndicatorPosition:o,userIndicatorType:h}),d)),this.setOverlayPosition(o)}catch(o){this.loggingService.log("Error in SelectionElementPortalComponent constructor: ",o)}}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=I(b({},t),{selections:e}),t))}catch(t){this.loggingService.catch("Error in SelectionElementPortalComponent setSelections: ",t)}}addSelection(e){try{this.componentConfigSignal.update(t=>(t=b({},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{this.loggingService.log("%c[WB] Calling SelectionElementPortalComponent FUNCTION: setOverlayPosition","color: green;"),e==="start"?this.componentConfigSignal.update(t=>(t=I(b({},t),{overlayPosition:{originX:"start",originY:"top",overlayX:"start",overlayY:"top"}}),t)):this.componentConfigSignal.update(t=>(t=I(b({},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=Be(this.highlight.targetElement);if(e){let t=e.iterateNext(),i,o=null,h=null;try{i=JSON.parse(t?.getAttribute(y.ATTRIBUTES.VELT_SELECTION_CONFIG)||"{}"),o=t?.getAttribute(y.ATTRIBUTES.VELT_LIVE_SELECTION_USER_INDICATOR_POSITION)||this.componentConfigSignal().userIndicatorPosition,o&&this.setOverlayPosition(o),h=t?.getAttribute(y.ATTRIBUTES.VELT_LIVE_SELECTION_USER_INDICATOR_TYPE)||this.componentConfigSignal().userIndicatorType,this.componentConfigSignal.update(a=>(a=I(b({},a),{userIndicatorPosition:o,userIndicatorType:h}),a))}catch{}let d;if(i?.horizontal&&(d=i.horizontal),o==="start"?d="top-start":d="top-right",t){let a=t.getBoundingClientRect();if(a&&a.width&&a.height)switch(d){case"left":this.position={top:a.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:a.width};break;case"bottom-left":this.position={top:a.height+4,left:0};break;case"bottom-right":this.position={top:a.height+4,left:a.width-32};break;case"center-left":this.position={top:a.height/2-16,left:-32};break;case"center-right":this.position={top:a.height/2-16,left:a.width+4};break;default:this.position={top:-32,left:a.width}}else this.position=null}else this.position=null}else this.position=null}this.componentConfigSignal.update(e=>(e=I(b({},e),{position:this.position}),e))}catch(e){this.loggingService.catch("Error in SelectionElementPortalComponent calculatePosition: ",e)}}};n.\u0275fac=function(t){return new(t||n)(j(g),j(f),j(ve))},n.\u0275cmp=fe({type:n,selectors:[["app-selection-element-portal"]],viewQuery:function(t,i){if(t&1&&_e(ct,5),t&2){let o;Ie(o=ye())&&(i.selectionElementPortalOverlay=o.first)}},hostVars:1,hostBindings:function(t,i){t&2&&L("data-velt-element",i.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,i){t&1&&x(0,It,2,1,"ng-container",3),t&2&&_("ngIf",i.componentConfigSignal())},dependencies:[Oe,Pe,Ae,Le,Qe,Ke],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}[_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-agent-accent: #4495ff;--velt-agent-accent-transparent: rgba(68, 149, 255, .2);--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 s=n;return s})();var f=(()=>{let n=class n{constructor(e,t,i,o,h,d,a,D,J,nt,rt,ot,lt){this.afAuth=e,this.analyticsService=t,this.authService=i,this.configService=o,this.databaseService=h,this.docService=d,this.domService=a,this.componentFactoryResolver=D,this.injector=J,this.appRef=nt,this.loggingService=rt,this.commonDbService=ot,this.realtimeAdapter=lt,this.documentPaths=null,this.textSelections={},this.enableSelections$=new k(!1),this.userIndicatorEnabled$=new k(!0),this.userIndicatorPosition$=new k(X.End),this.userIndicatorType$=new k(H.Avatar),this.defaultElementsTrackingEnabled$=new k(!0),this.defaultStylingEnabled$=new k(!0),this.inactivityTime=300*1e3,this.userIdleStateDetectionSubscription=null,this.elementSelections={},this.databaseService.getDb().pipe(N(l=>!!l),se(1)).subscribe(l=>{l&&(this.updateOnDocumentFocusChange(),this.updateOnUserDbConnectionStateChange(l).subscribe(()=>{},m=>{this.loggingService.catch("Error in SelectionService constructor updateOnUserDbConnectionStateChange: ",m)}))},l=>{this.loggingService.catch("Error in SelectionService getDb subscription: ",l)}),this.authService.getUser$().subscribe(l=>{l?this.detectUserIdleState():this.unsubscribeUserIdleStateDetectionSubscription()}),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 m=this.getSelectionEnabledElement(l.target);if(m&&!ie(m)){let u=this.domService.getXPath(m);if(u){let c=new F;c.type="click",c.targetElement=u,c.timestamp=this.timestamp,this.setSelection(c)}}else this.removeSelection()}}catch(m){this.loggingService.catch("Error in SelectionService onDocumentClick$: ",m)}},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 m=this.getSelectionEnabledElement(l.target);if(m&&!ie(m)){let u=this.domService.getXPath(m);if(u){let c=new F;c.type="focus",c.targetElement=u,c.timestamp=this.timestamp,this.setSelection(c)}}else this.removeSelection()}}catch(m){this.loggingService.catch("Error in SelectionService onDocumentFocus$: ",m)}},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(T(()=>this.isFeatureAllowed$({})),N(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 m=He([l]),u=new F;u.type="selection",u.targetTextRange=m?.length?m[0]:null,u.timestamp=this.timestamp,this.setSelection(u)}}}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(ce()).subscribe(([l,m])=>{try{if(l){let u=[];Object.keys(l).forEach(c=>{let A=l[c],$=m?m[c]:null;!ne(A,$)&&c!==this.getUserIdHash(this.user)&&u.push(A)}),u.forEach(c=>{if(c.targetElement){let A=this.elementSelections[c?.targetElement]?.portalRef,M=(this.elementSelections[c?.targetElement]?.selections||[]).filter(st=>this.getUserIdHash(st.user)!==this.getUserIdHash(c?.user));M?.length?(A.instance.setSelections(M.slice()),this.elementSelections[c?.targetElement].selections=M.slice(),this.highlightElement(M[0])):(this.removeHighlightFromElement(c),this.removeSelectionElement(c))}else c.targetTextRange&&this.removeHighlightFromText(c)})}if(m){let u=[];Object.keys(m).forEach(c=>{let A=l?l[c]:null,$=m[c];!ne(A,$)&&c!==this.getUserIdHash(this.user)&&u.push($)}),u.forEach(c=>{c.targetElement?(this.highlightElement(c),this.getUserIndicatorEnabled()&&this.setElementHighlight(c)):c.targetTextRange&&this.highlightText(c)})}}catch(u){this.loggingService.catch("Error in SelectionService getSelectionsOnCurrentDocument: ",u)}},l=>{this.loggingService.catch("Error in SelectionService getSelectionsOnCurrentDocument subscription: ",l)}),this.authService.addPreSignOutFuction("highlight-signout",this.signOutUser.bind(this))}detectUserIdleState(){try{this.unsubscribeUserIdleStateDetectionSubscription();let e=!1;this.userIdleStateDetectionSubscription=this.domService.onWindowPointerMove$().pipe(ge(2e3),G(()=>{e&&(e=!1)}),le(this.inactivityTime),G(()=>{this.removeSelection(),e=!0})).subscribe()}catch(e){this.loggingService.catch("Error in detectUserIdleState: ",e)}}unsubscribeUserIdleStateDetectionSubscription(){try{this.userIdleStateDetectionSubscription&&(this.userIdleStateDetectionSubscription.unsubscribe(),this.userIdleStateDetectionSubscription=null)}catch(e){this.loggingService.catch("Error in unsubscribeUserIdleStateDetectionSubscription: ",e)}}isFeatureAllowed(){return te(this.configService.getConfig(),this.authService.getUser(),ee.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;"),this.authService.getAuthState$().pipe(N(e=>!!e),T(e=>this.isFeatureAllowed$({firebaseUser:e})),T(e=>e.featureAllowed?C(e).pipe(T(t=>this.docService.getDocumentPaths$().pipe(U(i=>(this.documentPaths=i,t)))),T(t=>t?.user?t?.user?.isAnonymous?C(null):this.documentPaths?this.databaseService.getDb().pipe(N(i=>!!i),T(i=>this.documentPaths?.selection?this.commonDbService.dbListener({feature:"allSelections",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,skipFirestore:!0}}).pipe(U(o=>o?.data),U(o=>this.filterActiveSelections(o))):C(null))):C(null):C(null))):C(null)))}isFeatureAllowed$(e){return this.configService.getConfig$().pipe(N(t=>!!t),U(t=>I(b({},e),{config:t})),T(t=>this.authService.getUser$().pipe(U(i=>(this.user=i,I(b({},t),{user:i}))))),T(t=>te(t.config,t.user,ee.LIVE_SELECTION)?C(I(b({},t),{featureAllowed:!0})):(this.loggingService.warn("Live Selection feature is not allowed."),C(I(b({},t),{featureAllowed:!1})))),ae((t,i)=>t?.featureAllowed===i?.featureAllowed))}filterActiveSelections(e){this.loggingService.log("%c[WB] Calling FUNCTION: filterOnlineUsers","color: green;");try{if(e&&typeof e=="object"&&Object.keys(e).length){let t={},i=this.commonDbService.getServerTimestamp();return Object.keys(e).forEach(o=>{let h=e[o];h?.timestamp&&Math.abs(i-h.timestamp)<this.inactivityTime&&(t[o]=h)}),t}return e}catch(t){return this.loggingService.catch("Error in filterOnlineUsers:",t),e}}setSelection(e){try{if(this.user?.userId&&this.documentPaths?.selection){e.user=this.user;let t=JSON.parse(JSON.stringify(e));t&&!t?.timestamp&&(t.timestamp=this.timestamp),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)}}updateOnUserDbConnectionStateChange(e){return this.loggingService.log("%c[WB] Calling FUNCTION: updateOnUserDbConnectionStateChange","color: green;"),this.authService.getAuthState$().pipe(N(t=>!!t),T(t=>this.docService.getDocumentPaths$().pipe(U(i=>t))),G(t=>oe(this,null,function*(){try{if(this.documentPaths&&t){let i=yield this.authService.getIdTokenResultForUser(t,!0).catch(h=>null);if(!i)return;let{user:o}=i.claims;if(o&&this.documentPaths?.selection){let h=this.getUserIdHash(o);if(h){let d=`${this.documentPaths.selection}/${h}`,a=this.realtimeAdapter.rtdbRef(e,d);this.realtimeAdapter.rtdbOnDisconnectRemove("selection",a).catch(D=>{this.loggingService.catch("Error in SelectionService updateOnUserDbConnectionStateChange onDisconnect:",D)})}}}}catch(i){this.loggingService.catch("Error in SelectionService updateOnUserDbConnectionStateChange:",i)}})))}highlightElement(e){try{let t=this.domService.getXPath(e.targetElement);if(t){let i=t.iterateNext();if(i){let o=["input","textarea","select","button"],h;try{i?.getAttribute(y.ATTRIBUTES.VELT_SELECTION_CONFIG)&&(h=JSON.parse(i?.getAttribute(y.ATTRIBUTES.VELT_SELECTION_CONFIG)||"{}"))}catch{}(!h||h?.border)&&this.domService.highlightUserElement(i,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 i=t.iterateNext();i&&this.domService.removeHighlightUserFromElement(i)}}catch(t){this.loggingService.catch("Error in SelectionService removeHighlightFromElement: ",t)}}highlightText(e){try{if(e?.targetTextRange){let t=$e(e.targetTextRange?.text,this.domService.getXPath(e.targetTextRange?.commonAncestorContainer).iterateNext(),e.targetTextRange?.occurrence),i=new Range;try{i.setStart(t[0].textNode,t[0].startOffset||0),i.setEnd(t[t.length-1].textNode,t[t.length-1].endOffset||0)}catch{}if(i.toString()===e.targetTextRange?.text){let o=et(i,y.TAGS.SNIPPYLY_HIGHLIGHT_USER_TEXT),h=[],d=this.getSelectionUserMarker(e.user);if(o&&o.length&&(o.forEach(a=>{a?.textContent?.trim()&&(this.domService.addClassToElement(a,a.tagName?.toLowerCase()),this.domService.addClassToElement(a,y.VELT_LIVE_SELECTION_ON_TEXT),this.getDefaultStylingEnabled()&&this.domService.addClassToElement(a,y.VELT_LIVE_SELECTION_ON_TEXT_DEFAULT),e.user?.color&&a.style.setProperty(y.VELT_SELECTION_COLOR,e.user?.color+"55"),h.push({element:a,textNode:a.childNodes[0]}))}),d)){let a=o.filter(J=>J?.textContent?.trim()),D=a?.length?a[a?.length-1]:null;D&&D.parentNode.insertBefore(d,D.nextSibling)}this.textSelections[this.getUserIdHash(e?.user)]={textNodes:h,marker:d}}}}catch(t){this.loggingService.catch("Error in SelectionService highlightText: ",t)}}removeHighlightFromText(e){try{let t=this.getUserIdHash(e?.user);t&&this.textSelections[t]?.textNodes?.length&&(this.textSelections[t].textNodes.forEach(i=>{i?.element&&i?.textNode&&i.element.replaceWith(i.textNode),i.textNode&&i.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 i=document.createElement("span");i.classList.add("snippyly-user-marker-line");let o=document.createElement("span");return o.classList.add("snippyly-user-marker-dot"),i.appendChild(o),t.appendChild(i),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,i)=>{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(o=>{o&&this.commonDbService.deleteData({feature:"selection",errorCallback:h=>{i(h)},callback:()=>{t(null)},properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,userId:this.getUserIdHash(this.user)??"",skipFirestore:!0}}),t(null)}).catch(o=>{this.loggingService.catch("Error in SelectionService signOutUser subscription: ",o),i(o)}):t(null)}catch(o){this.loggingService.catch("Error in SelectionService signOutUser:",o),i(o)}})}setInactivityTime(e){try{this.inactivityTime=e,this.analyticsService.trackEvent(S.Events.Selection.SELECTION_SET_CUSTOM_INACTIVITY_TIMER,{inactivityTime:this.inactivityTime}),this.detectUserIdleState()}catch(t){this.loggingService.catch("Error in SelectionService setInactivityTime: ",t)}}getInactivityTime(){return this.inactivityTime}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&&y.SELECTION_ENABLED_ELEMENTS[e.tagName?.toLowerCase()]?e:Me(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(o=>this.getUserIdHash(o.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 i=t.iterateNext();if(i){let o=this.domService.getHostElement(i),h=new ke(re),d=new Ue(o,this.appRef,this.injector),a=d.attach(h);a.instance.highlight=e,a.instance.setSelections([e]),this.elementSelections[e.targetElement]={selectionHostDomPortalOutlet:d,selectionElementPortal:h,portalRef:a,selections:[JSON.parse(JSON.stringify(e))],userTargetElement:i,selectionHostElement:o,targetElement:e.targetElement},this.updateElementOffset(e)}}}catch(t){this.loggingService.catch("Error in SelectionService setSelectionElement: ",t)}}updateElementOffset(e){try{let{portalRef:t,userTargetElement:i,selectionHostElement:o}=this.elementSelections[e.targetElement],h=this.domService.getElementOffset(i,o);t.instance.offsetLeft=h.offsetLeft,t.instance.offsetTop=h.offsetTop}catch(t){this.loggingService.catch("Error in SelectionService updateElementOffset: ",t)}}checkElementHighlightsToRemove(e){try{let t=e.map(i=>i.targetElement);Object.keys(this.elementSelections).forEach(i=>{if(!t.includes(i)){let o=this.elementSelections[i];o&&(o.selectionHostDomPortalOutlet.detach(),this.domService.removeHighlightFromElement(o.selectionHostElement)),delete this.elementSelections[i]}})}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?Fe(e?.userId):null}catch(t){return this.loggingService.catch("Error in SelectionService getUserIdHash: ",t),null}}get timestamp(){return this.commonDbService.getServerTimestamp()}};n.\u0275fac=function(t){return new(t||n)(E(Re),E(Ge),E(We),E(je),E(Ve),E(Xe),E(ze),E(pe),E(de),E(be),E(g),E(Je),E(Ye))},n.\u0275prov=he({token:n,factory:n.\u0275fac,providedIn:"root"});let s=n;return s})();var Y=class extends Ze{constructor(n){super(n),this.getService(g).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,this.setInactivityTime=this._setInactivityTime}_enableLiveSelection(){this.getService(g).log("%c[WB] Calling FUNCTION: _enableLiveSelection","color: green;");try{this.trackEvent(S.Events.Selection.ENABLE_LIVE_SELECTION_TRIGGERED),this.getService(f).enableSelections(!0)}catch(n){this.getService(g).catch("Error in enableLiveSelection: ",n)}}_disableLiveSelection(){this.getService(g).log("%c[WB] Calling FUNCTION: _disableLiveSelection","color: green;");try{this.trackEvent(S.Events.Selection.DISABLE_LIVE_SELECTION_TRIGGERED),this.getService(f).enableSelections(!1)}catch(n){this.getService(g).catch("Error in disableLiveSelection: ",n)}}_enableUserIndicator(){this.getService(g).log("%c[WB] Calling FUNCTION: enableUserIndicator","color: green;");try{this.trackEvent(S.Events.Selection.ENABLE_USER_INDICATOR_TRIGGERED),this.getService(f).enableUserIndicator()}catch(n){this.getService(g).catch("Error in _enableUserIndicator: ",n)}}_disableUserIndicator(){this.getService(g).log("%c[WB] Calling FUNCTION: disableUserIndicator","color: green;");try{this.trackEvent(S.Events.Selection.DISABLE_USER_INDICATOR_TRIGGERED),this.getService(f).disableUserIndicator()}catch(n){this.getService(g).catch("Error in _disableUserIndicator: ",n)}}_setUserIndicatorPosition(n){this.getService(g).log("%c[WB] Calling FUNCTION: setUserIndicatorPosition","color: green;");try{this.trackEvent(S.Events.Selection.SET_USER_INDICATOR_POSITION_TRIGGERED,{payload:{position:n}}),this.getService(f).setUserIndicatorPosition(n)}catch(r){this.getService(g).catch("Error in _setUserIndicatorPosition: ",r)}}_setUserIndicatorType(n){this.getService(g).log("%c[WB] Calling FUNCTION: setUserIndicatorType","color: green;");try{this.trackEvent(S.Events.Selection.SET_USER_INDICATOR_TYPE_TRIGGERED,{payload:{type:n}}),this.getService(f).setUserIndicatorType(n)}catch(r){this.getService(g).catch("Error in _setUserIndicatorType: ",r)}}_enableDefaultElementsTracking(){this.getService(g).log("%c[WB] Calling FUNCTION: enableDefaultElementsTracking","color: green;");try{this.trackEvent(S.Events.Selection.ENABLE_DEFAULT_ELEMENTS_TRACKING_TRIGGERED),this.getService(f).enableDefaultElementsTracking()}catch(n){this.getService(g).catch("Error in _enableDefaultElementsTracking: ",n)}}_disableDefaultElementsTracking(){this.getService(g).log("%c[WB] Calling FUNCTION: disableDefaultElementsTracking","color: green;");try{this.trackEvent(S.Events.Selection.DISABLE_DEFAULT_ELEMENTS_TRACKING_TRIGGERED),this.getService(f).disableDefaultElementsTracking()}catch(n){this.getService(g).catch("Error in _disableDefaultElementsTracking: ",n)}}_enableDefaultStyling(){this.getService(g).log("%c[WB] Calling FUNCTION: enableDefaultStyling","color: green;");try{this.trackEvent(S.Events.Selection.ENABLE_DEFAULT_STYLING_TRIGGERED),this.getService(f).enableDefaultStyling()}catch(n){this.getService(g).catch("Error in _enableDefaultStyling: ",n)}}_disableDefaultStyling(){this.getService(g).log("%c[WB] Calling FUNCTION: disableDefaultStyling","color: green;");try{this.trackEvent(S.Events.Selection.DISABLE_DEFAULT_STYLING_TRIGGERED),this.getService(f).disableDefaultStyling()}catch(n){this.getService(g).catch("Error in _disableDefaultStyling: ",n)}}_getLiveSelectionData(){this.getService(g).log("%c[WB] Calling FUNCTION: getLiveSelectionData","color: green;");try{return this.trackEvent(S.Events.Selection.GET_LIVE_SELECTION_DATA_TRIGGERED),this.getService(f).getSelectionsOnCurrentDocument()}catch(n){return this.getService(g).catch("Error in _getLiveSelectionData: ",n),C(null)}}_setInactivityTime(n){this.getService(g).log("%c[WB] Calling FUNCTION: _setInactivityTime","color: green;");try{this.trackEvent(S.Events.Selection.SET_INACTIVITY_TIME_TRIGGERED,{payload:{time:n}}),!isNaN(n)&&n>0?this.getService(f).setInactivityTime(n):this.getService(g).catch("Error in setInactivityTime: ","Provided value must be a positive number greater than zero.")}catch(r){this.getService(g).catch("Error in setInactivityTime: ",r)}}};var it=(()=>{let n=class n{};n.\u0275fac=function(t){return new(t||n)},n.\u0275mod=Ee({type:n}),n.\u0275inj=me({imports:[De,we,Ne,qe]});let s=n;return s})();function Ct(s){return s.get(g).log("%c[WB] Loading selection feature chunk","color: blue;"),Se(it,s),new Y(s)}export{Ct as default};
|
package/velt-tag.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as xe}from"./chunk-EWNXINED.js";import"./chunk-XAJ4ABBW.js";import{b as Xt,c as Kt,d as Jt}from"./chunk-MJDGHV4Y.js";import{b as Ee,t as Ae}from"./chunk-JSZMRBOR.js";import"./chunk-2YJ3NBTO.js";import"./chunk-LAUYCNER.js";import"./chunk-4QPJMZ5V.js";import"./chunk-G2POMKRC.js";import"./chunk-NR3CZ6OR.js";import{b as ye}from"./chunk-MX66OK5A.js";import{b as be,d as Ie}from"./chunk-XJWB3IUW.js";import{a as we}from"./chunk-G56O673H.js";import{a as Oe}from"./chunk-GUGGWPZ7.js";import{a as ie}from"./chunk-ZMXXM7C4.js";import{A as Zt,G as te,H as ee,I as ne,Y as ae,ca as Ce,r as Qt,t as qt}from"./chunk-J3FNQGWW.js";import{$ as rt,$f as ce,Ab as Ft,Bb as Ht,Ci as Se,Db as Z,Dd as oe,De as V,E as D,Eb as tt,Ec as Wt,Eg as de,Fa as v,Fb as et,Ga as at,Gc as H,Gd as re,Gf as _t,Hi as _e,Ib as N,J as $,Jb as Vt,Kb as st,Kh as ue,Lc as zt,Ma as Dt,Nb as Q,Ob as Tt,Pa as m,Pb as St,Pc as Yt,Pf as Pt,Qb as Ut,Qg as pe,Qi as Pe,T as C,Ta as Mt,Te as d,Ua as k,Va as kt,_a as O,a as G,aa as wt,ac as jt,ag as le,b as K,bb as Bt,ca as f,cc as Gt,db as M,dg as ge,g as ot,ha as T,ia as S,ja as W,je as b,kc as R,l as J,la as xt,lb as u,lc as F,lh as me,mb as _,mh as he,nb as P,nf as se,ng as lt,ni as ve,ob as z,oi as B,pc as nt,pi as p,qi as fe,r as E,ri as Te,sb as Lt,tb as Nt,ub as ft,ui as L,v as I,vb as x,ve as ct,vi as U,wb as Rt,xb as A,xc as $t,xg as Ct,zb as h,zg as bt}from"./chunk-TY3WZ4Q4.js";var w=(()=>{let r=class r{constructor(t,e,n,i,l,s,c,y,X,ke,Be,Le,Ne,Re,Fe){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=ke,this.storageService=Be,this.dialog=Le,this.loggingService=Ne,this.serviceBook=Re,this.commonDbService=Fe,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(ue).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=ge(e);i=Pt(JSON.stringify(s))}}catch(s){this.loggingService.catch("Error in TagService getAllTagAnnotations: ",s)}return re(this.afAuth).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=>ce(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}=me(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(ye,{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=pe(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(fe),f(_e),f(Se),f(U),f(L),f(oe),f(Oe),f(Te),f(Ce),f(xe),f(ae),f(p),f(ve),f(Pe))},r.\u0275prov=rt({token:r,factory:r.\u0275fac,providedIn:"root"});let a=r;return a})();var He=["customBtnRef"],Ve=["*"];function Ue(a,r){a&1&&ft(0)}function je(a,r){if(a&1&&O(0,Ue,1,0,"ng-container",5),a&2){h();let o=N(5);u("ngTemplateOutlet",o)}}function Ge(a,r){a&1&&(_(0,"div",8),W(),_(1,"svg",9),z(2,"circle",10)(3,"path",11),P()())}function $e(a,r){a&1&&ft(0)}function We(a,r){if(a&1&&(O(0,Ge,4,0,"div",6),_(1,"div",7,2),O(3,$e,1,0,"ng-container",5),P()),a&2){let o=h(),t=N(5);u("ngIf",o.showDefaultBtn),v(3),u("ngTemplateOutlet",t)}}function ze(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(He,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:Ve,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,je,1,1,"ng-template",4)(2,We,4,2,"ng-template",null,0,nt),P(),O(4,ze,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 Ye(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 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,S(e.stopPropagation())}),Q(1),R(2,"translate"),P()}a&2&&(v(),Tt(F(2,1,"Reassign")))}function Ke(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 Je(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 Qe(a,r){if(a&1&&(_(0,"div",4)(1,"div",5),Q(2),R(3,"translate"),R(4,"translate"),P(),O(5,Ye,3,3,"div",6)(6,Xe,3,3,"div",6)(7,Ke,3,3,"div",6)(8,Je,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 Ze(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 se,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&&de(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,Qe,9,10,"div",2)(2,Ze,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,Ee,be],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 en=["overlay"],nn=["pin"],on=(a,r)=>({"tag-pin-selected":a,"mutiple-pins-selected":r}),rn=()=>["snippyly-overlay-panel","snippyly-tag-dialog-overlay-panel","velt-overlay-panel"];function an(a,r){a&1&&(W(),z(0,"path",8))}function sn(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 cn(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(en,5),Z(nn,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,an,1,0,"path",5),P(),O(5,sn,1,3,"snippyly-user-avatar",6),P(),O(6,cn,1,3,"ng-template",7,1,nt)}if(e&2){let i=N(1);u("ngClass",Gt(11,on,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,rn))("cdkConnectedOverlayOffsetY",n.overlayOriginY==="top"?-8:2)("cdkConnectedOverlayBackdropClass","snippyly-overlay-backdrop")("cdkConnectedOverlayLockPosition",!1)("cdkConnectedOverlayPositions",n.positions)("cdkConnectedOverlayGrowAfterOpen",!0)}},dependencies:[Wt,H,ee,te,Ie,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 gn(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)}}updateCurrentPinPosition(t){try{this.domService.removeHighlightFromElement(this.targetElement);let e=t.event,n=e?.touches?.length?e.touches[0]?.clientX:e.clientX,i=e?.touches?.length?e.touches[0]?.clientY:e.clientY,l=this.domService.getBackgroundElement(n,i);l&&(this.targetElement=l,this.domService.highlightElement(this.targetElement),this.pointerMoveEvent=t.event,this.dragPosition={top:i,left:n})}catch(e){this.loggingService.catch("Error in TagPinPortalComponent updateCurrentPinPosition: ",e)}}onPinRelease(){try{let t=document.getElementById(this.tagPinAnnotation.annotationId);t&&this.parentElement&&this.parentElement.appendChild(t);let e=this.domService.getElementFromXPath(this.tagPinAnnotation.targetElement?.xpath);this.pointerMoveEvent&&(this.tagPinAnnotation.targetElement=this.domService.getTargetElementForCursorPosition(this.pointerMoveEvent));let n=this.domService.getElementFromXPath(this.tagPinAnnotation.targetElement?.xpath),i=this.domService.isElementInsideAdditionalLocationContainer(e)||this.domService.isElementInsideAdditionalLocationContainer(n);this.tagService.updateTag(this.tagPinAnnotation,!1,i),setTimeout(()=>{this.annotationDraging=!1,this.dragPosition=null,this.domService.removeHighlightFromElement(this.targetElement)},100),this.analyticsService.trackEvent(b.Events.Tag.TAG_DRAGGED,{annotationId:this.tagPinAnnotation.annotationId})}catch(t){this.loggingService.catch("Error in TagPinPortalComponent onPinRelease: ",t)}}saveTag(t){}ngOnDestroy(){this.loggingService.log("%c[WB] Calling FUNCTION: ngOnDestroy","color: green;");try{this.unsubscribe()}catch(t){this.loggingService.catch("Error in TagPinPortalComponent 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 TagPinPortalComponent unsubscribe: ",t)}}};r.\u0275fac=function(e){return new(e||r)(m(B),m(U),m(L),m(w),m(p))},r.\u0275cmp=k({type:r,selectors:[["snippyly-tag-pin-portal"]],hostVars:2,hostBindings:function(e,n){e&2&&(Rt("id",n.id),M("data-velt-element",n.veltElement))},inputs:{tagPinAnnotation:"tagPinAnnotation",multipleTagPinsSelected:"multipleTagPinsSelected",avatarErrorImage:"avatarErrorImage",user:"user",offsetLeft:"offsetLeft",offsetTop:"offsetTop",targetElement:"targetElement"},standalone:!1,decls:1,vars:1,consts:[["class","tag-pin-portal","cdkDrag","","cdkDragHandle","",3,"id","pin-dragging","top","left","cdkDragDisabled","pointerup","pointerdown","click","cdkDragStarted","cdkDragMoved","cdkDragReleased",4,"ngIf"],["cdkDrag","","cdkDragHandle","",1,"tag-pin-portal",3,"pointerup","pointerdown","click","cdkDragStarted","cdkDragMoved","cdkDragReleased","id","cdkDragDisabled"],[3,"saveTag","tagPinAnnotation","tagPinSelected","multipleTagPinSelected","targetElement","user"]],template:function(e,n){e&1&&O(0,gn,2,13,"div",0),e&2&&u("ngIf",n.tagPinAnnotation==null?null:n.tagPinAnnotation.position)},dependencies:[H,Kt,Xt,At],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}[_nghost-%COMP%]{position:absolute!important;top:0!important;left:0!important;box-sizing:border-box!important;-webkit-tap-highlight-color:rgba(255,255,255,0)!important;outline:none!important;margin:0!important;padding:0!important;height:unset!important;width:unset!important;text-align:left!important}*[_ngcontent-%COMP%]{box-sizing:border-box;-webkit-tap-highlight-color:rgba(255,255,255,0)!important;outline:none!important;margin:0!important;padding:0!important;height:unset;width:unset;text-align:left!important;line-height:1.5!important;color:#000!important;font-size:calc((1rem + 0px) * var(--velt-base-rem-unit))}*[_ngcontent-%COMP%]:empty{display:revert!important}.tag-pin-portal[_ngcontent-%COMP%]{position:absolute;transform:none!important;transform-origin:0 0!important;transform-box:fill-box!important;top:0;left:0}.tag-pin-portal.pin-dragging[_ngcontent-%COMP%]{position:fixed;z-index:2147483557!important}"],changeDetection:0});let a=r;return a})();var De=(()=>{let r=class r{constructor(t,e,n,i,l){this.domService=t,this.componentFactoryResolver=e,this.injector=n,this.appRef=i,this.loggingService=l,this.tagsPinById={}}setTagPin(t){try{if(!this.tagsPinById[t.annotationId])this.setPinPortal(t);else if(t.targetElement?.xpath===this.tagsPinById[t.annotationId]?.annotation?.targetElement?.xpath){let e=this.tagsPinById[t.annotationId].portalRef,n=this.tagsPinById[t.annotationId].userTargetElement,i=this.tagsPinById[t.annotationId].pinHostElement;if(document.body.contains(n)&&document.body.contains(i))e&&(e.instance.tagPinAnnotation=JSON.parse(JSON.stringify(t)),this.updateElementOffset(t));else{let l=this.tagsPinById[t.annotationId].pinHostDomPortalOutlet;l&&(this.tagsPinById[t.annotationId].pinHostElement?.removeAttribute(d.ATTRIBUTES.VELT_TAG_PIN_HOST),this.tagsPinById[t.annotationId].pinHostElement?.removeAttribute(d.ATTRIBUTES.VELT_TAG_PIN_HOST_STATIC),l.detach(),delete this.tagsPinById[t.annotationId],this.setPinPortal(t))}}else{let e=this.tagsPinById[t.annotationId].pinHostDomPortalOutlet;e&&(this.tagsPinById[t.annotationId].pinHostElement?.removeAttribute(d.ATTRIBUTES.VELT_TAG_PIN_HOST),this.tagsPinById[t.annotationId].pinHostElement?.removeAttribute(d.ATTRIBUTES.VELT_TAG_PIN_HOST_STATIC),e.detach(),delete this.tagsPinById[t.annotationId],this.setPinPortal(t))}}catch(e){this.loggingService.catch("Error in TagPinPortalService setTagPin: ",e)}}setPinPortal(t){try{let e=this.domService.getXPath(t.targetElement?.xpath);if(e){let n=e.iterateNext();if(n){let i=this.domService.getHostElement(n),l=new Qt(Ot),s=new qt(i,this.appRef,this.injector),c=s.attach(l);c.instance.tagPinAnnotation=JSON.parse(JSON.stringify(t)),c.instance.targetElement=n,this.tagsPinById[t.annotationId]={pinHostDomPortalOutlet:s,pinPortal:l,portalRef:c,annotation:JSON.parse(JSON.stringify(t)),userTargetElement:n,pinHostElement:i},i.setAttribute(d.ATTRIBUTES.VELT_TAG_PIN_HOST,t.annotationId),window.getComputedStyle(i).position==="static"&&(he(i)||i.setAttribute(d.ATTRIBUTES.VELT_TAG_PIN_HOST_STATIC,"true")),this.updateElementOffset(t)}}}catch(e){this.loggingService.catch("Error in TagPinPortalService setPinPortal: ",e)}}updateElementOffset(t){try{let{portalRef:e,userTargetElement:n,pinHostElement:i}=this.tagsPinById[t.annotationId],l=this.domService.getElementOffset(n,i);e.instance.offsetLeft=l.offsetLeft,e.instance.offsetTop=l.offsetTop}catch(e){this.loggingService.catch("Error in TagPinPortalService updateElementOffset: ",e)}}checkPinsToRemove(t){try{let e=t.map(n=>n.annotationId);Object.keys(this.tagsPinById).forEach(n=>{if(!e.includes(n)){let i=this.tagsPinById[n];i.pinHostDomPortalOutlet.detach(),i.pinHostElement?.removeAttribute(d.ATTRIBUTES.VELT_TAG_PIN_HOST),i.pinHostElement?.removeAttribute(d.ATTRIBUTES.VELT_TAG_PIN_HOST_STATIC),this.domService.removeHighlightFromElement(i.pinHostElement),delete this.tagsPinById[n]}})}catch(e){this.loggingService.catch("Error in TagPinPortalService checkPinsToRemove: ",e)}}};r.\u0275fac=function(e){return new(e||r)(f(L),f(Dt),f(xt),f(Bt),f(p))},r.\u0275prov=rt({token:r,factory:r.\u0275fac,providedIn:"root"});let a=r;return a})();var mt=(()=>{let r=class r{get pinHighlighterClass(){return this._pinHighlighterClass}set pinHighlighterClass(t){this._pinHighlighterClass=t,this.domService.setPinHighlighterClass(t)}constructor(t,e,n,i,l,s){this.analyticsService=t,this.authService=e,this.domService=n,this.tagService=i,this.tagPinPortalService=l,this.loggingService=s,this._pinHighlighterClass=null,this.tagPinAnnotations=[],this.subscriptions=[],this.isFirstComponent=!0,this.selectedAnnotationsMap={},this.tagAnnotationFocused=!1,this.veltId=le(),this.veltElement=!0;try{this.loggingService.log("%c[WB] Creating CLASS: TagsContainerComponent","color: blue;");let c=new URL(window.location.href);this.focusTagAnnotationId=c.searchParams.get(d.URL_PARAMS.TAG_ID)}catch(c){this.loggingService.catch("Error in TagsContainerComponent constructor: ",c)}}ngOnInit(){this.loggingService.log("%c[WB] Calling FUNCTION: ngOnInit","color: green;")}ngAfterViewInit(){try{let t=document.querySelector(d.TAGS.SNIPPYLY_TAGS),e=document.querySelector(d.TAGS.VELT_TAGS);e?this.veltId===e?.getAttribute(d.ATTRIBUTES.VELT_ID)&&(this.isFirstComponent=!0,this.initComponent()):this.veltId===t?.getAttribute(d.ATTRIBUTES.VELT_ID)&&(this.isFirstComponent=!0,this.initComponent())}catch(t){this.loggingService.catch("Error in TagsContainerComponent AfterViewInit: ",t)}}initComponent(){try{this.subscriptions.push(this.authService.getUser$().pipe(D(t=>!!t)).subscribe(t=>{t&&this.setTagInstalledInAnalytics()},t=>{this.loggingService.catch("Error in getUser: ",t)})),this.subscriptions.push(this.domService.getSelectedAnnotationsMap$().subscribe(t=>{this.selectedAnnotationsMap=t},t=>{this.loggingService.catch("Error in TagsContainerComponent getSidebarVisibility$ subscription: ",t)})),this.getAllTagsOnCurrentDocument()}catch(t){this.loggingService.catch("Error in TagsContainerComponent initComponent: ",t)}}getAllTagsOnCurrentDocument(){this.loggingService.log("%c[WB] Calling FUNCTION: getAllTagsOnCurrentDocument","color: green;");try{this.subscriptions.push(this.tagService.getAllTagAnnotations().pipe(D(t=>!!t),C(t=>this.domService.getSelectedAnnotationsMap$().pipe(I(e=>({annotations:t,selectedAnnotationsMap:e||{}}))))).subscribe(t=>{try{this.loggingService.log(t),this.tagPinAnnotations=t?.annotations;let e=this.tagPinAnnotations.filter(n=>n.targetElement);e=e.filter(n=>!(n.resolved&&!t.selectedAnnotationsMap[n.annotationId])),this.tagPinPortalService.checkPinsToRemove(e),e.forEach(n=>{this.tagPinPortalService.setTagPin(n)}),this.focusTagAnnotation()}catch(e){this.loggingService.catch("Error in TagsContainerComponent getAllTagsOnCurrentDocument inside subscription: ",e)}},t=>{this.loggingService.catch("Error in TagsContainerComponent getAllTagsOnCurrentDocument subscription: ",t)}))}catch(t){this.loggingService.catch("Error in TagsContainerComponent getAllTagsOnCurrentDocument: ",t)}}ngOnDestroy(){this.loggingService.log("%c[WB] Calling FUNCTION: ngOnDestroy","color: green;");try{this.unsubscribe()}catch(t){this.loggingService.catch("Error in TagsContainerComponent 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 TagsContainerComponent unsubscribe: ",t)}}focusTagAnnotation(){if(this.focusTagAnnotationId&&!this.tagAnnotationFocused){let t=this.tagPinAnnotations.find(e=>e.annotationId===this.focusTagAnnotationId);t&&(this.tagAnnotationFocused=!0,this.selectedAnnotationsMap[t.annotationId]||this.domService.toggleAnnotationSelection(t),setTimeout(()=>{let e=null;t.targetElement?e=document.getElementById(`tag-pin-contianer-${t.annotationId}`):e=document.querySelector(`[data-velt-id='${t.annotationId}']`),e&&e.scrollIntoView({behavior:"auto",block:"center",inline:"nearest"})},100))}}setTagInstalledInAnalytics(){try{this.analyticsService.setInstalledFeature(V.TAG)}catch(t){this.loggingService.catch("Error in TagsContainerComponent setTagInstalledInAnalytics: ",t)}}};r.\u0275fac=function(e){return new(e||r)(m(B),m(U),m(L),m(w),m(De),m(p))},r.\u0275cmp=k({type:r,selectors:[["app-tags-container"]],hostVars:2,hostBindings:function(e,n){e&2&&M("data-velt-id",n.veltId)("data-velt-element",n.veltElement)},inputs:{pinHighlighterClass:"pinHighlighterClass"},standalone:!1,decls:0,vars:0,template:function(e,n){},encapsulation:2,changeDetection:0});let a=r;return a})();var ht=class extends we{constructor(r){super(r),this.getService(p).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(r,o){this.getService(p).log("%c[WB] Calling FUNCTION: getOnlineUsers","color: green;");try{return this.trackEvent(b.Events.Tag.GET_ALL_TAG_ANNOTATIONS_TRIGGERED,{payload:{documentId:r,location:o}}),this.getService(w).getAllTagAnnotations(r,o)}catch(t){return this.getService(p).catch("Error in _getLiveTagsOnCurrentDocument: ",t),E(null)}}_deleteTag(){this.getService(p).log("%c[WB] Calling FUNCTION: deleteTag","color: green;");try{this.trackEvent(b.Events.Tag.DELETE_TAG_TRIGGERED),this.getService(w).deleteTagPinAnnotations("tagElement")}catch(r){this.getService(p).catch("Error in _deleteTag: ",r)}}_allowedElementIds(r){this.getService(p).log("%c[WB] Calling FUNCTION: allowedElementIds","color: green;");try{this.trackEvent(b.Events.Tag.ALLOWED_ELEMENT_IDS_TRIGGERED,{payload:{elementIds:r}}),this.getService(w).setAllowedElementIds(r)}catch(o){this.getService(p).catch("Error in allowedElementIds: ",o)}}_attachTag(r){this.getService(p).log("%c[WB] Calling FUNCTION: attachTag","color: green;");try{this.trackEvent(b.Events.Tag.ATTACH_TAG_TRIGGERED,{payload:{elementId:r}}),this.getService(w).attachTag(r,["id","data-id"])}catch(o){this.getService(p).catch("Error in _attachTag: ",o)}}_addTagModeChange(){this.getService(p).log("%c[WB] Calling FUNCTION: addTagModeChange","color: green;");try{return this.trackEvent(b.Events.Tag.ADD_TAG_MODE_CHANGE_TRIGGERED),this.getService(w).addTagModeChange()}catch(r){return this.getService(p).catch("Error in _addTagModeChange: ",r),E(!1)}}};var Me=(()=>{let r=class r{};r.\u0275fac=function(e){return new(e||r)},r.\u0275mod=kt({type:r}),r.\u0275inj=wt({imports:[Yt,ne,Jt,Ae]});let a=r;return a})();function pn(a){a.get(p).log("%c[WB] Loading tag feature chunk","color: blue;");let t=Mt(Me,a).injector;return ut(t,d.TAGS.VELT_TAG_TOOL,pt),ut(t,d.TAGS.SNIPPYLY_TAG_TOOL,pt),ut(t,d.TAGS.VELT_TAGS,mt),ut(t,d.TAGS.SNIPPYLY_TAGS,mt),new ht(a)}function ut(a,r,o){if(customElements.get(r))return;let t=ie(o,{injector:a});customElements.define(r,t)}export{pn as default};
|
|
1
|
+
import{a as we}from"./chunk-DAHES7KJ.js";import"./chunk-HRHOJT33.js";import{b as Xt,c as Kt,d as Jt}from"./chunk-BSYABMZE.js";import{b as ye,t as Ie}from"./chunk-SLIE6W2D.js";import"./chunk-GW63A52V.js";import"./chunk-Z54SH2OU.js";import"./chunk-6LUTL3DR.js";import"./chunk-UQ2QOHQZ.js";import"./chunk-G4N6XTDS.js";import{b as be}from"./chunk-HEIW3Q3Z.js";import{b as Ce,d as Ee}from"./chunk-KAYQA4GH.js";import{a as Oe}from"./chunk-KBKI4VKD.js";import{a as Ae}from"./chunk-45CK3G4S.js";import{a as ie}from"./chunk-NBO7Z72Y.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-NVZIS23N.js";import{$ as rt,Ab as Ft,Af as Pt,Bb as Ht,Bg as de,Db as Z,Dd as oe,De as d,E as D,Eb as tt,Ec as Wt,Fa as v,Fb as et,Ga as at,Gc as H,Hi as _e,Ib as N,J as $,Jb as Vt,Kb as st,Lc as zt,Ma as Dt,Mf as se,Nb as Q,Nf as ce,Ob as Tt,Pa as m,Pb as St,Pc as Yt,Qb as Ut,Qf as le,T as C,Ta as Mt,Ua as k,Va as kt,Ye as ae,Yg as pe,Zg as me,_a as O,_f as lt,a as G,aa as wt,ac as jt,ai as ue,b as K,bb as Bt,bi as B,ca as f,cc as Gt,ci as p,db as M,di as ve,fe as ct,g as ot,ha as T,hi as fe,ia as S,ig as Ct,ja as W,kc as R,kg as bt,ki as L,l as J,la as xt,lb as u,lc as F,li as U,mb as _,nb as P,ne as V,ob as z,pc as nt,pf as _t,pg as ge,r as E,sb as Lt,si as Te,tb as Nt,ub as ft,uh as b,v as I,vb as x,wb as Rt,xb as A,xc as $t,xh as he,xi as Se,zb as h}from"./chunk-BCSVTVMJ.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)}}updateCurrentPinPosition(t){try{this.domService.removeHighlightFromElement(this.targetElement);let e=t.event,n=e?.touches?.length?e.touches[0]?.clientX:e.clientX,i=e?.touches?.length?e.touches[0]?.clientY:e.clientY,l=this.domService.getBackgroundElement(n,i);l&&(this.targetElement=l,this.domService.highlightElement(this.targetElement),this.pointerMoveEvent=t.event,this.dragPosition={top:i,left:n})}catch(e){this.loggingService.catch("Error in TagPinPortalComponent updateCurrentPinPosition: ",e)}}onPinRelease(){try{let t=document.getElementById(this.tagPinAnnotation.annotationId);t&&this.parentElement&&this.parentElement.appendChild(t);let e=this.domService.getElementFromXPath(this.tagPinAnnotation.targetElement?.xpath);this.pointerMoveEvent&&(this.tagPinAnnotation.targetElement=this.domService.getTargetElementForCursorPosition(this.pointerMoveEvent));let n=this.domService.getElementFromXPath(this.tagPinAnnotation.targetElement?.xpath),i=this.domService.isElementInsideAdditionalLocationContainer(e)||this.domService.isElementInsideAdditionalLocationContainer(n);this.tagService.updateTag(this.tagPinAnnotation,!1,i),setTimeout(()=>{this.annotationDraging=!1,this.dragPosition=null,this.domService.removeHighlightFromElement(this.targetElement)},100),this.analyticsService.trackEvent(b.Events.Tag.TAG_DRAGGED,{annotationId:this.tagPinAnnotation.annotationId})}catch(t){this.loggingService.catch("Error in TagPinPortalComponent onPinRelease: ",t)}}saveTag(t){}ngOnDestroy(){this.loggingService.log("%c[WB] Calling FUNCTION: ngOnDestroy","color: green;");try{this.unsubscribe()}catch(t){this.loggingService.catch("Error in TagPinPortalComponent 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 TagPinPortalComponent unsubscribe: ",t)}}};r.\u0275fac=function(e){return new(e||r)(m(B),m(U),m(L),m(w),m(p))},r.\u0275cmp=k({type:r,selectors:[["snippyly-tag-pin-portal"]],hostVars:2,hostBindings:function(e,n){e&2&&(Rt("id",n.id),M("data-velt-element",n.veltElement))},inputs:{tagPinAnnotation:"tagPinAnnotation",multipleTagPinsSelected:"multipleTagPinsSelected",avatarErrorImage:"avatarErrorImage",user:"user",offsetLeft:"offsetLeft",offsetTop:"offsetTop",targetElement:"targetElement"},standalone:!1,decls:1,vars:1,consts:[["class","tag-pin-portal","cdkDrag","","cdkDragHandle","",3,"id","pin-dragging","top","left","cdkDragDisabled","pointerup","pointerdown","click","cdkDragStarted","cdkDragMoved","cdkDragReleased",4,"ngIf"],["cdkDrag","","cdkDragHandle","",1,"tag-pin-portal",3,"pointerup","pointerdown","click","cdkDragStarted","cdkDragMoved","cdkDragReleased","id","cdkDragDisabled"],[3,"saveTag","tagPinAnnotation","tagPinSelected","multipleTagPinSelected","targetElement","user"]],template:function(e,n){e&1&&O(0,ln,2,13,"div",0),e&2&&u("ngIf",n.tagPinAnnotation==null?null:n.tagPinAnnotation.position)},dependencies:[H,Kt,Xt,At],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}[_nghost-%COMP%]{position:absolute!important;top:0!important;left:0!important;box-sizing:border-box!important;-webkit-tap-highlight-color:rgba(255,255,255,0)!important;outline:none!important;margin:0!important;padding:0!important;height:unset!important;width:unset!important;text-align:left!important}*[_ngcontent-%COMP%]{box-sizing:border-box;-webkit-tap-highlight-color:rgba(255,255,255,0)!important;outline:none!important;margin:0!important;padding:0!important;height:unset;width:unset;text-align:left!important;line-height:1.5!important;color:#000!important;font-size:calc((1rem + 0px) * var(--velt-base-rem-unit))}*[_ngcontent-%COMP%]:empty{display:revert!important}.tag-pin-portal[_ngcontent-%COMP%]{position:absolute;transform:none!important;transform-origin:0 0!important;transform-box:fill-box!important;top:0;left:0}.tag-pin-portal.pin-dragging[_ngcontent-%COMP%]{position:fixed;z-index:2147483557!important}"],changeDetection:0});let a=r;return a})();var xe=(()=>{let r=class r{constructor(t,e,n,i,l){this.domService=t,this.componentFactoryResolver=e,this.injector=n,this.appRef=i,this.loggingService=l,this.tagsPinById={}}setTagPin(t){try{if(!this.tagsPinById[t.annotationId])this.setPinPortal(t);else if(t.targetElement?.xpath===this.tagsPinById[t.annotationId]?.annotation?.targetElement?.xpath){let e=this.tagsPinById[t.annotationId].portalRef,n=this.tagsPinById[t.annotationId].userTargetElement,i=this.tagsPinById[t.annotationId].pinHostElement;if(document.body.contains(n)&&document.body.contains(i))e&&(e.instance.tagPinAnnotation=JSON.parse(JSON.stringify(t)),this.updateElementOffset(t));else{let l=this.tagsPinById[t.annotationId].pinHostDomPortalOutlet;l&&(this.tagsPinById[t.annotationId].pinHostElement?.removeAttribute(d.ATTRIBUTES.VELT_TAG_PIN_HOST),this.tagsPinById[t.annotationId].pinHostElement?.removeAttribute(d.ATTRIBUTES.VELT_TAG_PIN_HOST_STATIC),l.detach(),delete this.tagsPinById[t.annotationId],this.setPinPortal(t))}}else{let e=this.tagsPinById[t.annotationId].pinHostDomPortalOutlet;e&&(this.tagsPinById[t.annotationId].pinHostElement?.removeAttribute(d.ATTRIBUTES.VELT_TAG_PIN_HOST),this.tagsPinById[t.annotationId].pinHostElement?.removeAttribute(d.ATTRIBUTES.VELT_TAG_PIN_HOST_STATIC),e.detach(),delete this.tagsPinById[t.annotationId],this.setPinPortal(t))}}catch(e){this.loggingService.catch("Error in TagPinPortalService setTagPin: ",e)}}setPinPortal(t){try{let e=this.domService.getXPath(t.targetElement?.xpath);if(e){let n=e.iterateNext();if(n){let i=this.domService.getHostElement(n),l=new Qt(Ot),s=new qt(i,this.appRef,this.injector),c=s.attach(l);c.instance.tagPinAnnotation=JSON.parse(JSON.stringify(t)),c.instance.targetElement=n,this.tagsPinById[t.annotationId]={pinHostDomPortalOutlet:s,pinPortal:l,portalRef:c,annotation:JSON.parse(JSON.stringify(t)),userTargetElement:n,pinHostElement:i},i.setAttribute(d.ATTRIBUTES.VELT_TAG_PIN_HOST,t.annotationId),window.getComputedStyle(i).position==="static"&&(me(i)||i.setAttribute(d.ATTRIBUTES.VELT_TAG_PIN_HOST_STATIC,"true")),this.updateElementOffset(t)}}}catch(e){this.loggingService.catch("Error in TagPinPortalService setPinPortal: ",e)}}updateElementOffset(t){try{let{portalRef:e,userTargetElement:n,pinHostElement:i}=this.tagsPinById[t.annotationId],l=this.domService.getElementOffset(n,i);e.instance.offsetLeft=l.offsetLeft,e.instance.offsetTop=l.offsetTop}catch(e){this.loggingService.catch("Error in TagPinPortalService updateElementOffset: ",e)}}checkPinsToRemove(t){try{let e=t.map(n=>n.annotationId);Object.keys(this.tagsPinById).forEach(n=>{if(!e.includes(n)){let i=this.tagsPinById[n];i.pinHostDomPortalOutlet.detach(),i.pinHostElement?.removeAttribute(d.ATTRIBUTES.VELT_TAG_PIN_HOST),i.pinHostElement?.removeAttribute(d.ATTRIBUTES.VELT_TAG_PIN_HOST_STATIC),this.domService.removeHighlightFromElement(i.pinHostElement),delete this.tagsPinById[n]}})}catch(e){this.loggingService.catch("Error in TagPinPortalService checkPinsToRemove: ",e)}}};r.\u0275fac=function(e){return new(e||r)(f(L),f(Dt),f(xt),f(Bt),f(p))},r.\u0275prov=rt({token:r,factory:r.\u0275fac,providedIn:"root"});let a=r;return a})();var mt=(()=>{let r=class r{get pinHighlighterClass(){return this._pinHighlighterClass}set pinHighlighterClass(t){this._pinHighlighterClass=t,this.domService.setPinHighlighterClass(t)}constructor(t,e,n,i,l,s){this.analyticsService=t,this.authService=e,this.domService=n,this.tagService=i,this.tagPinPortalService=l,this.loggingService=s,this._pinHighlighterClass=null,this.tagPinAnnotations=[],this.subscriptions=[],this.isFirstComponent=!0,this.selectedAnnotationsMap={},this.tagAnnotationFocused=!1,this.veltId=ce(),this.veltElement=!0;try{this.loggingService.log("%c[WB] Creating CLASS: TagsContainerComponent","color: blue;");let c=new URL(window.location.href);this.focusTagAnnotationId=c.searchParams.get(d.URL_PARAMS.TAG_ID)}catch(c){this.loggingService.catch("Error in TagsContainerComponent constructor: ",c)}}ngOnInit(){this.loggingService.log("%c[WB] Calling FUNCTION: ngOnInit","color: green;")}ngAfterViewInit(){try{let t=document.querySelector(d.TAGS.SNIPPYLY_TAGS),e=document.querySelector(d.TAGS.VELT_TAGS);e?this.veltId===e?.getAttribute(d.ATTRIBUTES.VELT_ID)&&(this.isFirstComponent=!0,this.initComponent()):this.veltId===t?.getAttribute(d.ATTRIBUTES.VELT_ID)&&(this.isFirstComponent=!0,this.initComponent())}catch(t){this.loggingService.catch("Error in TagsContainerComponent AfterViewInit: ",t)}}initComponent(){try{this.subscriptions.push(this.authService.getUser$().pipe(D(t=>!!t)).subscribe(t=>{t&&this.setTagInstalledInAnalytics()},t=>{this.loggingService.catch("Error in getUser: ",t)})),this.subscriptions.push(this.domService.getSelectedAnnotationsMap$().subscribe(t=>{this.selectedAnnotationsMap=t},t=>{this.loggingService.catch("Error in TagsContainerComponent getSidebarVisibility$ subscription: ",t)})),this.getAllTagsOnCurrentDocument()}catch(t){this.loggingService.catch("Error in TagsContainerComponent initComponent: ",t)}}getAllTagsOnCurrentDocument(){this.loggingService.log("%c[WB] Calling FUNCTION: getAllTagsOnCurrentDocument","color: green;");try{this.subscriptions.push(this.tagService.getAllTagAnnotations().pipe(D(t=>!!t),C(t=>this.domService.getSelectedAnnotationsMap$().pipe(I(e=>({annotations:t,selectedAnnotationsMap:e||{}}))))).subscribe(t=>{try{this.loggingService.log(t),this.tagPinAnnotations=t?.annotations;let e=this.tagPinAnnotations.filter(n=>n.targetElement);e=e.filter(n=>!(n.resolved&&!t.selectedAnnotationsMap[n.annotationId])),this.tagPinPortalService.checkPinsToRemove(e),e.forEach(n=>{this.tagPinPortalService.setTagPin(n)}),this.focusTagAnnotation()}catch(e){this.loggingService.catch("Error in TagsContainerComponent getAllTagsOnCurrentDocument inside subscription: ",e)}},t=>{this.loggingService.catch("Error in TagsContainerComponent getAllTagsOnCurrentDocument subscription: ",t)}))}catch(t){this.loggingService.catch("Error in TagsContainerComponent getAllTagsOnCurrentDocument: ",t)}}ngOnDestroy(){this.loggingService.log("%c[WB] Calling FUNCTION: ngOnDestroy","color: green;");try{this.unsubscribe()}catch(t){this.loggingService.catch("Error in TagsContainerComponent 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 TagsContainerComponent unsubscribe: ",t)}}focusTagAnnotation(){if(this.focusTagAnnotationId&&!this.tagAnnotationFocused){let t=this.tagPinAnnotations.find(e=>e.annotationId===this.focusTagAnnotationId);t&&(this.tagAnnotationFocused=!0,this.selectedAnnotationsMap[t.annotationId]||this.domService.toggleAnnotationSelection(t),setTimeout(()=>{let e=null;t.targetElement?e=document.getElementById(`tag-pin-contianer-${t.annotationId}`):e=document.querySelector(`[data-velt-id='${t.annotationId}']`),e&&e.scrollIntoView({behavior:"auto",block:"center",inline:"nearest"})},100))}}setTagInstalledInAnalytics(){try{this.analyticsService.setInstalledFeature(V.TAG)}catch(t){this.loggingService.catch("Error in TagsContainerComponent setTagInstalledInAnalytics: ",t)}}};r.\u0275fac=function(e){return new(e||r)(m(B),m(U),m(L),m(w),m(xe),m(p))},r.\u0275cmp=k({type:r,selectors:[["app-tags-container"]],hostVars:2,hostBindings:function(e,n){e&2&&M("data-velt-id",n.veltId)("data-velt-element",n.veltElement)},inputs:{pinHighlighterClass:"pinHighlighterClass"},standalone:!1,decls:0,vars:0,template:function(e,n){},encapsulation:2,changeDetection:0});let a=r;return a})();var ht=class extends Oe{constructor(r){super(r),this.getService(p).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(r,o){this.getService(p).log("%c[WB] Calling FUNCTION: getOnlineUsers","color: green;");try{return this.trackEvent(b.Events.Tag.GET_ALL_TAG_ANNOTATIONS_TRIGGERED,{payload:{documentId:r,location:o}}),this.getService(w).getAllTagAnnotations(r,o)}catch(t){return this.getService(p).catch("Error in _getLiveTagsOnCurrentDocument: ",t),E(null)}}_deleteTag(){this.getService(p).log("%c[WB] Calling FUNCTION: deleteTag","color: green;");try{this.trackEvent(b.Events.Tag.DELETE_TAG_TRIGGERED),this.getService(w).deleteTagPinAnnotations("tagElement")}catch(r){this.getService(p).catch("Error in _deleteTag: ",r)}}_allowedElementIds(r){this.getService(p).log("%c[WB] Calling FUNCTION: allowedElementIds","color: green;");try{this.trackEvent(b.Events.Tag.ALLOWED_ELEMENT_IDS_TRIGGERED,{payload:{elementIds:r}}),this.getService(w).setAllowedElementIds(r)}catch(o){this.getService(p).catch("Error in allowedElementIds: ",o)}}_attachTag(r){this.getService(p).log("%c[WB] Calling FUNCTION: attachTag","color: green;");try{this.trackEvent(b.Events.Tag.ATTACH_TAG_TRIGGERED,{payload:{elementId:r}}),this.getService(w).attachTag(r,["id","data-id"])}catch(o){this.getService(p).catch("Error in _attachTag: ",o)}}_addTagModeChange(){this.getService(p).log("%c[WB] Calling FUNCTION: addTagModeChange","color: green;");try{return this.trackEvent(b.Events.Tag.ADD_TAG_MODE_CHANGE_TRIGGERED),this.getService(w).addTagModeChange()}catch(r){return this.getService(p).catch("Error in _addTagModeChange: ",r),E(!1)}}};var De=(()=>{let r=class r{};r.\u0275fac=function(e){return new(e||r)},r.\u0275mod=kt({type:r}),r.\u0275inj=wt({imports:[Yt,ne,Jt,Ie]});let a=r;return a})();function dn(a){a.get(p).log("%c[WB] Loading tag feature chunk","color: blue;");let t=Mt(De,a).injector;return ut(t,d.TAGS.VELT_TAG_TOOL,pt),ut(t,d.TAGS.SNIPPYLY_TAG_TOOL,pt),ut(t,d.TAGS.VELT_TAGS,mt),ut(t,d.TAGS.SNIPPYLY_TAGS,mt),new ht(a)}function ut(a,r,o){if(customElements.get(r))return;let t=ie(o,{injector:a});customElements.define(r,t)}export{dn as default};
|