@veltdev/sdk-staging 6.0.0-beta.9 → 6.0.0

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.
Files changed (69) hide show
  1. package/app/client/snippyly.model.d.ts +10 -0
  2. package/app/models/data/comment-events.data.model.d.ts +10 -0
  3. package/app/models/data/config.data.model.d.ts +154 -0
  4. package/app/models/data/notification.model.d.ts +14 -0
  5. package/app/models/data/suggestion.data.model.d.ts +52 -2
  6. package/app/utils/constants.d.ts +1 -0
  7. package/app/utils/enums.d.ts +2 -1
  8. package/{chunk-JSZMRBOR.js → chunk-3CWPPM3P.js} +1 -1
  9. package/{chunk-G56O673H.js → chunk-42DJQDO6.js} +1 -1
  10. package/{chunk-GUGGWPZ7.js → chunk-4MGSKBFZ.js} +1 -1
  11. package/chunk-5YVVMUVJ.js +1 -0
  12. package/{chunk-MJDGHV4Y.js → chunk-62665UII.js} +1 -1
  13. package/{chunk-ENIVQSM6.js → chunk-6SB63H3W.js} +1 -1
  14. package/chunk-ADSEZJIT.js +1 -0
  15. package/{chunk-ZMXXM7C4.js → chunk-AE6AKOBL.js} +1 -1
  16. package/{chunk-3OIAZGVH.js → chunk-AVNXQEE2.js} +1 -1
  17. package/{chunk-MX66OK5A.js → chunk-BPPXBXFT.js} +1 -1
  18. package/{chunk-2YJ3NBTO.js → chunk-CI2JGL4P.js} +1 -1
  19. package/{chunk-J3FNQGWW.js → chunk-CVMNWHT4.js} +2 -2
  20. package/{chunk-XAJ4ABBW.js → chunk-EIIBHBQX.js} +1 -1
  21. package/{chunk-AMBQ736A.js → chunk-EPT5TVX4.js} +1 -1
  22. package/chunk-FXK7BWOQ.js +167 -0
  23. package/{chunk-4QPJMZ5V.js → chunk-IE3AYTRD.js} +1 -1
  24. package/chunk-OPJU6Y6N.js +13 -0
  25. package/{chunk-MNGERQRW.js → chunk-OZMOWJWG.js} +1 -1
  26. package/{chunk-NR3CZ6OR.js → chunk-POBWY53V.js} +1 -1
  27. package/chunk-PRGWBNVO.js +1 -0
  28. package/{chunk-SQTBBRA3.js → chunk-PVOJRXAC.js} +1 -1
  29. package/{chunk-57VK6E6U.js → chunk-QD4B4F67.js} +1 -1
  30. package/{chunk-XJWB3IUW.js → chunk-QX6IGTVL.js} +1 -1
  31. package/{chunk-LAUYCNER.js → chunk-RSPIT2S4.js} +1 -1
  32. package/{chunk-QDQ2XJUX.js → chunk-S3KLTU2O.js} +1 -1
  33. package/{chunk-5W33SILU.js → chunk-SKH4QRW2.js} +1 -1
  34. package/chunk-SYUQPGKV.js +1 -0
  35. package/{chunk-3OILJMAX.js → chunk-UCTOPWFQ.js} +1 -1
  36. package/{chunk-G2POMKRC.js → chunk-UGCJET7Y.js} +1 -1
  37. package/{chunk-W4BGGBK5.js → chunk-UVG3AHTE.js} +1 -1
  38. package/{chunk-DP4GMASO.js → chunk-WOT7KXUQ.js} +1 -1
  39. package/chunk-YFYJFOMT.js +2 -0
  40. package/chunk-ZOLCVAWT.js +93 -0
  41. package/package.json +1 -1
  42. package/velt-activity-log.js +1 -1
  43. package/velt-area.js +1 -1
  44. package/velt-arrow.js +2 -2
  45. package/velt-comment.js +8 -8
  46. package/velt-crdt.js +1 -1
  47. package/velt-cursor.js +2 -2
  48. package/velt-huddle.js +3 -3
  49. package/velt-live-state-sync.js +2 -2
  50. package/velt-notification.js +1 -1
  51. package/velt-presence.js +1 -1
  52. package/velt-reaction.js +1 -1
  53. package/velt-recorder.js +1 -1
  54. package/velt-rewriter.js +2 -2
  55. package/velt-selection.js +1 -1
  56. package/velt-tag.js +1 -1
  57. package/velt-user-invite.js +1 -1
  58. package/velt-user-request.js +1 -1
  59. package/velt-video-player.js +1 -1
  60. package/velt-views.js +3 -3
  61. package/velt.js +264 -20
  62. package/chunk-52EPUXSU.js +0 -13
  63. package/chunk-5SSUFLRQ.js +0 -1
  64. package/chunk-6TORUSYX.js +0 -93
  65. package/chunk-EWNXINED.js +0 -1
  66. package/chunk-HDABOQPS.js +0 -1
  67. package/chunk-RMV5EWSF.js +0 -1
  68. package/chunk-TY3WZ4Q4.js +0 -167
  69. package/chunk-YSZQAETY.js +0 -1
@@ -0,0 +1 @@
1
+ import{a as N}from"./chunk-6SB63H3W.js";import{$ as v,Ai as B,E as P,Ee as m,Fi as J,G as x,I as C,J as f,Ma as j,Oi as K,Pi as W,Sg as V,Tg as L,Ug as H,Vf as $,Vg as z,Wg as R,Xg as F,bb as X,ca as a,ki as g,l as p,la as M,lg as T,qg as k,r as A,si as G,ti as b,w as D,z as y}from"./chunk-FXK7BWOQ.js";var h=(function(l){return l.CLICK="click",l.HOVER="hover",l.SCROLL="scroll",l.NAVIGATE="navigate",l})(h||{}),u=class{constructor(){this.type=h.HOVER,this.data=null,this.pageInfo=k(),this.timestamp=Date.now()}},U=class{constructor(n,w){this.targetXpath=n,this.xpath=w}};var E=class{constructor(){this.sessionId=null,this.isLeader=!1,this.lastProcessedActionTimestamp=null}};var S=class{constructor(n){this.snippylyId=n,this.joinTimestamp=Date.now()}};var I=class{constructor(n,w,e){this.followers=[],this.actionStack=[],this.id=$(),this.leaderId=n,this.leaderName=w,this.followers.push(new S(e))}};var Q=(()=>{let n=class n{constructor(e,t,r,i,o,s){this.databaseService=e,this.docService=t,this.loggingService=r,this.authService=i,this.commonDbService=o,this.realtimeAdapter=s,this.currentUser$=new p(null),this.currentSession$=new p(null);try{this.databaseService.getDb().pipe(P(c=>!!c),f(1)).subscribe(c=>{c&&(this.db=c)},c=>{this.loggingService.catch("Error in FlockSessionService getDb subscription: ",c)}),this.authService.getUser$().subscribe(c=>{c&&c.userSnippylyId&&(this.user=c)})}catch(c){this.loggingService.catch("Error in FlockSessionService constructor: ",c)}}startCurrentFlockUserSubscription(e){try{this.currentUserSub?.unsubscribe(),e&&e.userSnippylyId&&(this.user=e,this.subscribeToCurrentFlockUser(e?.userSnippylyId))}catch(t){this.loggingService.catch("Error in FlockSessionService startCurrentFlockUserSubscription: ",t)}}stopCurrentFlockUserSubscription(){try{this.currentUserSub?.unsubscribe()}catch(e){this.loggingService.catch("Error in FlockSessionService stopCurrentFlockUserSubscription: ",e)}}provisionFlockSession(e,t,r){try{let i=this.docService.getDocumentPaths();i&&this.db&&this.commonDbService.dbListener({feature:"flockUser",properties:{documentId:i?.documentId,organizationId:i?.organizationId,id:e,skipFirestore:!0}}).pipe(f(1)).subscribe(o=>{o?.data&&o?.data?.sessionId?this.subscribeToCurrentSession(o?.data?.sessionId,r):this.createFlockSession(e,t,r)})}catch(i){this.loggingService.catch("Error in FlockSessionService provisionFlockSession: ",i)}return null}swapLeader(e,t,r){try{if(this.updateRemoteFlockUser(e,{isLeader:!1}),this.updateRemoteFlockUser(t,{isLeader:!0}),this.currentSession){this.currentSession.leaderId=t,this.currentSession.leaderName=r,this.currentSession.followers.push(new S(e));let i=this.currentSession.followers.findIndex(o=>o.snippylyId===t);i>-1&&this.currentSession.followers.splice(i,1),this.updateSession(this.currentSession.id,this.currentSession)}}catch(i){this.loggingService.catch("Error in FlockSessionService swapLeader: ",i)}}createFlockSession(e,t,r){try{let i=new I(e,t,r);return this.updateRemoteFlockUser(e,{snippylyId:e,sessionId:i.id,isLeader:!0}),this.updateSession(i.id,i),this.subscribeToCurrentSession(i.id),i.id}catch(i){this.loggingService.catch("Error in FlockSessionService createFlockSession: ",i)}return null}removeFollowerFromCurrentSession(e){try{if(this.currentSession){this.updateRemoteFlockUser(e,{sessionId:null,lastProcessedActionTimestamp:null});let t=this.currentSession.followers.findIndex(r=>r.snippylyId===e);if(t>-1){if(this.currentSession.followers.splice(t,1),this.currentSession.followers.length===0){this.deleteSession(this.currentSession.id);return}this.updateSession(this.currentSession.id,this.currentSession),this.user&&this.user.userSnippylyId&&this.user.userSnippylyId===e&&(this.sessionSub?.unsubscribe(),this.currentSession=void 0,this.currentSession$?.next(null))}}}catch(t){this.loggingService.catch("Error in FlockSessionService removeFollowerFromSession: ",t)}}updateRemoteFlockUser(e,t={}){try{if(!e)return;let r=this.docService.getDocumentPaths();for(let i in t)t.hasOwnProperty(i)&&t[i]===void 0&&delete t[i];r&&this.db&&this.commonDbService.updateData({feature:"flockUser",properties:{documentId:r?.documentId??"",organizationId:r?.organizationId??"",id:e,skipFirestore:!0},data:JSON.parse(JSON.stringify(t))})}catch(r){this.loggingService.catch("Error in FlockSessionService updateRemoteFlockUser: ",r)}}subscribeToCurrentSession(e,t=void 0){try{let r=this.docService.getDocumentPaths();r&&this.db&&(this.sessionSub&&this.sessionSub.unsubscribe(),this.sessionSub=this.commonDbService.dbListener({feature:"flockSession",properties:{documentId:r?.documentId,organizationId:r?.organizationId,id:e,skipFirestore:!0}}).subscribe(i=>{i?.data&&typeof i?.data=="object"&&Object.keys(i?.data)?.length>0?(this.currentSession=i?.data,t!==void 0&&this.currentSession?.followers.findIndex(o=>o.snippylyId===t)===-1&&(this.currentSession.followers.push(new S(t)),this.updateSession(this.currentSession.id,this.currentSession)),this.currentSession$.next(this.currentSession??null)):(this.currentSession=void 0,this.currentSession$.next(null))}))}catch(r){this.loggingService.catch("Error in FlockSessionService subscribeToCurrentSession: ",r)}}subscribeToCurrentFlockUser(e){try{let t=this.docService.getDocumentPaths();t&&this.db&&(this.currentUserSub&&this.currentUserSub.unsubscribe(),this.currentUserSub=this.commonDbService.dbListener({feature:"flockUser",properties:{documentId:t?.documentId,organizationId:t?.organizationId,id:e,skipFirestore:!0}}).pipe(x(r=>(this.loggingService.catch("Error in FlockSessionService subscribeToCurrentFlockUser: ",r),A(null)))).subscribe(r=>{r?.data&&typeof r?.data=="object"&&Object.keys(r?.data)?.length>0&&(this.currentUser$.next(r?.data),r?.data?.sessionId&&this.subscribeToCurrentSession(r?.data?.sessionId))},r=>{this.loggingService.catch("Error in FlockSessionService subscribeToCurrentFlockUser subscription: ",r)}))}catch(t){this.loggingService.catch("Error in FlockSessionService subscribeToCurrentFlockUser: ",t)}}updateSession(e,t={}){try{if(!e)return;let r=this.docService.getDocumentPaths();for(let i in t)t.hasOwnProperty(i)&&t[i]===void 0&&delete t[i];r&&this.db&&this.commonDbService.updateData({feature:"flockSession",properties:{documentId:r?.documentId??"",organizationId:r?.organizationId??"",id:e,skipFirestore:!0},data:JSON.parse(JSON.stringify(t))})}catch(r){this.loggingService.catch("Error in FlockSessionService updateSession: ",r)}}deleteSession(e){try{let t=this.docService.getDocumentPaths();t&&this.db&&(this.commonDbService.deleteData({feature:"flockSession",properties:{documentId:t?.documentId??"",organizationId:t?.organizationId??"",id:e,skipFirestore:!0}}),this.currentSession&&e===this.currentSession.id&&(this.updateRemoteFlockUser(this.currentSession.leaderId,{sessionId:null,isLeader:!1,lastProcessedActionTimestamp:null}),this.currentSession.followers.forEach(r=>{this.updateRemoteFlockUser(r.snippylyId,{sessionId:null,lastProcessedActionTimestamp:null})}),this.currentSession=void 0,this.currentSession$.next(null),this.sessionSub?.unsubscribe()))}catch(t){this.loggingService.catch("Error in FlockSessionService deleteSession: ",t)}}addActionToStack(e,t){try{t=t&&JSON.parse(JSON.stringify(t));let r=this.docService.getDocumentPaths();if(r&&this.db&&e){let i=this.realtimeAdapter.rtdbRef(this.db,`${r.flock}/sessions/${e}/actionStack`);this.realtimeAdapter.rtdbRunTransaction("flockSession",i,o=>o?(o.unshift(t),o.slice(0,5)):[t]),t.type===h.NAVIGATE&&this.updateSession(e,{pageInfo:t.pageInfo})}}catch(r){this.loggingService.catch("Error in FlockSessionService addActionToStack: ",r)}}};n.\u0275fac=function(t){return new(t||n)(a(B),a(J),a(g),a(b),a(W),a(K))},n.\u0275prov=v({token:n,factory:n.\u0275fac,providedIn:"root"});let l=n;return l})();var Z=(()=>{let n=class n{constructor(e,t,r,i){this.componentFactoryResolver=e,this.applicationRef=t,this.injector=r,this.loggingService=i,this.darkMode=!1}createFollowOverlay(e,t){try{let i=this.componentFactoryResolver.resolveComponentFactory(N).create(this.injector);i.instance.setLeaderName(e),i.instance.closeOverlayEvent.pipe(f(1)).subscribe(()=>{this.removeOverlay(),t()}),this.applicationRef.attachView(i.hostView),this.overlayRef=i,this.overlayRef.instance.darkMode=this.darkMode;let o=this.overlayRef.location.nativeElement;o.id="snippyly-follow-overlay",o.setAttribute(m.ATTRIBUTES.VELT_IGNORE,""),document.body.appendChild(o)}catch(r){this.loggingService.catch("Error in FlockOverlayService createFollowOverlay: ",r)}}createLeaderOverlay(e){let r=this.componentFactoryResolver.resolveComponentFactory(N).create(this.injector);r.instance.setType("leading"),r.instance.closeOverlayEvent.pipe(f(1)).subscribe(()=>{this.removeOverlay(),e()}),this.applicationRef.attachView(r.hostView),this.overlayRef=r,this.overlayRef.instance.darkMode=this.darkMode;let i=this.overlayRef.location.nativeElement;i.id="snippyly-follow-overlay",i.setAttribute(m.ATTRIBUTES.VELT_IGNORE,""),document.body.appendChild(i)}changeLeaderName(e){this.overlayRef&&this.overlayRef.instance.setLeaderName(e)}getLeaderName(){return this.overlayRef?this.overlayRef.instance.getLeaderName():null}removeOverlay(){if(this.overlayRef){let e=this.overlayRef.location.nativeElement;this.applicationRef.detachView(this.overlayRef.hostView),this.overlayRef.destroy(),e.shadowRoot&&e.shadowRoot.removeChild(e.shadowRoot.childNodes[0]),e.remove(),this.overlayRef=void 0}}setDarkMode(e){try{this.darkMode=e,this.overlayRef&&(this.overlayRef.instance.darkMode=e)}catch(t){this.loggingService.catch("Error in FlockOverlayService setDarkMode: ",t)}}};n.\u0275fac=function(t){return new(t||n)(a(j),a(X),a(M),a(g))},n.\u0275prov=v({token:n,factory:n.\u0275fac,providedIn:"root"});let l=n;return l})();var Ce=(()=>{let n=class n{constructor(e,t,r,i,o){this.authService=e,this.domService=t,this.loggingService=r,this.flockSessionService=i,this.flockOverlayService=o,this.flockLeader$=new p({userId:"",name:""}),this.flockMode$=new p(!1),this.currentFlockUser=null,this.localScrollData=[],this.domSubscriptions=[],this.followOverlayCreated=!1,this.leaderOverlayCreated=!1,this.windowFocused=!0,this.tabFocused=!0,this.useHistoryAPI=!0,this.disableDefaultNavigation=!1;try{this.flockLeader$.subscribe(s=>{let{userId:c,name:d}=s,O=c;if(this.provisionFollowUser(),O&&this.currentFlockUser&&this.currentFlockUser.snippylyId)if(this.currentFlockUser.sessionId){if(this.currentFlockUser.snippylyId&&this.currentFlockUser.isLeader){this.flockSessionService.swapLeader(this.currentFlockUser.snippylyId,O,d);return}this.removeCurrentUserFromSession()}else this.flockSessionService.provisionFlockSession(O,d,this.currentFlockUser.snippylyId)},s=>{this.loggingService.catch("Error in FlockService flockLeader$ subscription: ",s)}),this.flockSessionService.currentSession$.subscribe(s=>{if(s!==null){if(this.currentFlockUser&&(this.currentFlockUser.sessionId===null||this.currentFlockUser.sessionId===void 0)&&this.currentFlockUser.snippylyId&&(this.currentFlockUser.sessionId=s.id,this.flockSessionService.updateRemoteFlockUser(this.currentFlockUser.snippylyId,this.currentFlockUser)),this.currentFlockUser&&!this.currentFlockUser.isLeader&&!this.followOverlayCreated&&(this.leaderOverlayCreated&&(this.flockOverlayService.removeOverlay(),this.leaderOverlayCreated=!1),this.followOverlayCreated=!0,this.flockOverlayService.createFollowOverlay(s.leaderName,()=>{this.removeCurrentUserFromSession(),this.followOverlayCreated=!1})),this.currentFlockUser&&this.currentFlockUser.isLeader&&!this.leaderOverlayCreated&&(this.followOverlayCreated&&(this.flockOverlayService.removeOverlay(),this.followOverlayCreated=!1),this.leaderOverlayCreated=!0,this.flockOverlayService.createLeaderOverlay(()=>{this.removeCurrentUserFromSession(),this.leaderOverlayCreated=!1})),this.currentFlockUser&&!this.currentFlockUser.isLeader&&s.actionStack){let c=s.actionStack[0];c&&this.currentFlockUser.lastProcessedActionTimestamp!==c.timestamp&&this.processAction(c)}if(this.currentFlockUser&&!this.currentFlockUser.isLeader&&this.followOverlayCreated&&this.flockOverlayService.getLeaderName()!==null&&s.leaderName!==this.flockOverlayService.getLeaderName()&&this.flockOverlayService.changeLeaderName(s.leaderName),this.currentFlockUser&&this.currentFlockUser.isLeader){let c=k();if(s.pageInfo){if(c&&c.url!==s.pageInfo.url){let d=new u;d.type=h.NAVIGATE,this.flockSessionService.addActionToStack(s.id,d)}}else{this.flockSessionService.updateSession(s.id,{pageInfo:c});let d=new u;d.type=h.NAVIGATE,this.flockSessionService.addActionToStack(s.id,d)}}}else this.currentFlockUser&&this.leaderOverlayCreated&&(this.flockOverlayService.removeOverlay(),this.leaderOverlayCreated=!1),this.currentFlockUser&&this.followOverlayCreated&&(this.flockOverlayService.removeOverlay(),this.followOverlayCreated=!1)}),this.flockSessionService.currentUser$.subscribe(s=>{if(s!==null&&(this.currentFlockUser&&this.currentFlockUser.isLeader!==s.isLeader&&(this.domSubscriptions.forEach(c=>c.unsubscribe()),this.domSubscriptions=[]),this.currentFlockUser=s,s.sessionId&&this.domSubscriptions.length===0))if(s.isLeader){if(!this.tabFocused||!this.windowFocused)return;this.subscribeToLeaderDOMEvents()}else this.subscribeToFollowerDOMEvents()}),D([this.authService.getUser$(),this.getFlockMode$()]).subscribe(([s,c])=>{s&&s.userSnippylyId&&c?this.flockSessionService.startCurrentFlockUserSubscription(s):this.flockSessionService.stopCurrentFlockUserSubscription()})}catch(s){this.loggingService.catch("Error in FlockService constructor: ",s)}}provisionFollowUser(){try{if(this.currentFlockUser===null){let e=this.authService.getUser();e&&e.userSnippylyId&&(this.currentFlockUser=new E,this.currentFlockUser.snippylyId=e.userSnippylyId)}}catch(e){this.loggingService.catch("Error in FlockService provisionFollowUser: ",e)}}startFollowingUser(e,t){try{if(this.provisionFollowUser(),e&&this.currentFlockUser&&this.currentFlockUser.snippylyId){if(this.currentFlockUser.sessionId){if(this.currentFlockUser.snippylyId&&this.currentFlockUser.isLeader){this.flockSessionService.swapLeader(this.currentFlockUser.snippylyId,e,t);return}this.removeCurrentUserFromSession()}this.flockSessionService.provisionFlockSession(e,t,this.currentFlockUser.snippylyId)}}catch(r){this.loggingService.catch("Error in FlockService startFollowingUser: ",r)}}stopFollowingUser(){try{this.removeCurrentUserFromSession()}catch(e){this.loggingService.catch("Error in FlockService stopFollowingUser: ",e)}}subscribeToUrlChanges(){try{if(this.useHistoryAPI){let e=window.history.pushState,t=window.history.replaceState;window.history.pushState=(...r)=>{e.apply(window.history,r),this.onUrlChange()},window.history.replaceState=(...r)=>{t.apply(window.history,r),this.onUrlChange()},this.domSubscriptions.push({unsubscribe:()=>{window.history.pushState=e,window.history.replaceState=t}}),this.domSubscriptions.push(y(window,"popstate").subscribe(()=>{this.onUrlChange()}))}}catch(e){this.loggingService.catch("Error in FlockService subscribeToUrlChanges: ",e)}}onUrlChange(){try{if(this.currentFlockUser&&this.currentFlockUser.sessionId&&this.currentFlockUser.isLeader){let e=new u;e.type=h.NAVIGATE,this.flockSessionService.addActionToStack(this.currentFlockUser.sessionId,e)}}catch(e){this.loggingService.catch("Error in FlockService onUrlChange: ",e)}}processAction(e){try{switch(e.type){case h.CLICK:this.clickUserElement(e.data);break;case h.HOVER:this.scrollToHoveredElement(e.data);break;case h.SCROLL:this.scrollToFollowedUser(e.data);break;case h.NAVIGATE:this.checkMatchingUrl(e.pageInfo);break}this.currentFlockUser&&this.currentFlockUser.snippylyId&&this.flockSessionService.updateRemoteFlockUser(this.currentFlockUser.snippylyId,{lastProcessedActionTimestamp:e.timestamp})}catch(t){this.loggingService.catch("Error in FlockService processAction: ",t)}}subscribeToLeaderDOMEvents(){try{this.domSubscriptions.length>0&&(this.domSubscriptions.forEach(e=>e.unsubscribe()),this.domSubscriptions=[]),this.domSubscriptions.push(y(window,"mouseover").pipe(C(500)).subscribe(e=>{let t=e?.target;if(t){let r=window.getComputedStyle(t);if(r.position==="fixed"||r.position==="sticky"||t.hasAttribute(m.ATTRIBUTES.VELT_IGNORE))return;t=L(t,{x:e.clientX,y:e.clientY}),this.updateHoveredElement(t)}})),this.domSubscriptions.push(this.domService.onWindowClick$().subscribe(e=>{let t=e?.target;if(t){if(t.hasAttribute(m.ATTRIBUTES.VELT_IGNORE))return;this.updateClickedElement(t)}})),this.subscribeToUrlChanges(),this.subscribeToScrollables()}catch(e){this.loggingService.catch("Error in FlockService subscribeToLeaderDOMEvents: ",e)}}subscribeToFollowerDOMEvents(){}updateClickedElement(e){try{if(this.currentFlockUser&&this.currentFlockUser.sessionId){let t=this.domService.getXPath(e),r=T(e),i=this.domService.getXPath(r),o={id:Math.random().toString(36).substring(2),xpath:t,parentXpath:i},s=new u;s.type=h.CLICK,s.data=o,this.flockSessionService.addActionToStack(this.currentFlockUser.sessionId,s)}}catch(t){this.loggingService.catch("Error in FlockService updateClickedElement: ",t)}}updateHoveredElement(e){try{if(this.currentFlockUser&&this.currentFlockUser.sessionId){let t=this.domService.getXPath(e),r=T(e),i=this.domService.getXPath(r),o={id:Math.random().toString(36).substring(2),xpath:t,parentXpath:i},s=new u;s.type=h.HOVER,s.data=o,this.flockSessionService.addActionToStack(this.currentFlockUser.sessionId,s)}}catch(t){this.loggingService.catch("Error in FlockService updateHoveredElement: ",t)}}subscribeToScrollables(){try{let e=V();e.push(document),e?.forEach(t=>{this.domSubscriptions.push(y(t,"scroll").pipe(C(100)).subscribe(r=>{this.currentFlockUser&&this.currentFlockUser.sessionId&&this.currentFlockUser.isLeader&&this.updateScrollPositionOfElement(t)}))})}catch(e){this.loggingService.catch("Error in FlockService getScrollableElements: ",e)}}updateScrollPositionOfElement(e){try{if(this.currentFlockUser&&this.currentFlockUser.sessionId){let t=new U("","");if(e===document){let o=z();if(o){let s=L(o);s&&(t.targetXpath=this.domService.getXPath(s))}t.xpath=""}else{let o=H(e);t.targetXpath=this.domService.getXPath(o),t.xpath=this.domService.getXPath(e)}let r=!1,i=!1;if(this.localScrollData.forEach((o,s)=>{o.xpath===o.xpath&&(t.targetXpath!==o.targetXpath&&(r=!0),this.localScrollData[s]=Object.assign(o,t),i=!0)}),i||this.localScrollData.push(t),r||!i){let o=new u;o.type=h.SCROLL,o.data=t,this.flockSessionService.addActionToStack(this.currentFlockUser.sessionId,o)}}}catch(t){this.loggingService.catch("Error in FlockService calculateScrollPositionOfAnElement: ",t)}}enableFlockMode(e){try{if(this.flockMode$.next(!0),e){let{useHistoryAPI:t,onNavigate:r,disableDefaultNavigation:i,darkMode:o}=e;t!==void 0&&(this.useHistoryAPI=t),r!==void 0&&typeof r=="function"&&(this.onNavigate=r),i!==void 0&&(this.disableDefaultNavigation=i),this.flockOverlayService.setDarkMode(o)}}catch(t){this.loggingService.catch("Error in FlockService enableFlockMode: ",t)}}disableFlockMode(){try{this.flockMode$.next(!1),this.onNavigateEmitter=void 0,this.useHistoryAPI=!0,this.onNavigate=void 0}catch(e){this.loggingService.catch("Error in FlockService disableFlockMode: ",e)}}setDisableFlockNavigation(e){try{this.disableDefaultNavigation=e}catch(t){this.loggingService.catch("Error in FlockService setDisableFlockNavigation: ",t)}}getFlockMode$(){return this.flockMode$.asObservable()}getFlockMode(){return this.flockMode$.value}setNavigateEmitter(e){try{this.onNavigateEmitter=e}catch(t){this.loggingService.catch("Error in FlockService setNavigateEmitter: ",t)}}setTabFocused(e){try{if(this.tabFocused=e,!this.currentFlockUser)return;this.currentFlockUser.isLeader&&this.currentFlockUser.sessionId&&(this.tabFocused&&this.domSubscriptions.length===0?this.subscribeToLeaderDOMEvents():!this.tabFocused&&this.domSubscriptions.length>0&&(this.domSubscriptions.forEach(r=>{r.unsubscribe()}),this.domSubscriptions=[]))}catch(t){this.loggingService.catch("Error in FlockService setTabFocused: ",t)}}setWindowFocused(e){try{if(this.windowFocused=e,!this.currentFlockUser)return;this.currentFlockUser.isLeader&&this.currentFlockUser.sessionId&&(this.windowFocused&&this.domSubscriptions.length===0?this.subscribeToLeaderDOMEvents():!this.windowFocused&&this.domSubscriptions.length>0&&(this.domSubscriptions.forEach(r=>{r.unsubscribe()}),this.domSubscriptions=[]))}catch(t){this.loggingService.catch("Error in FlockService setWindowFocused: ",t)}}setFlockLeader(e,t){try{this.flockLeader$.next({userId:e,name:t})}catch(r){this.loggingService.catch("Error in FlockService setFlockLeader: ",r)}}isInSession(){try{return!!(this.currentFlockUser&&this.currentFlockUser.sessionId)}catch(e){this.loggingService.catch("Error in FlockService isFollowing: ",e)}return!1}removeCurrentUserFromSession(){try{this.domSubscriptions.forEach(e=>e.unsubscribe()),this.domSubscriptions=[],this.currentFlockUser&&(this.currentFlockUser.isLeader?this.currentFlockUser.sessionId&&this.flockSessionService.deleteSession(this.currentFlockUser.sessionId):this.currentFlockUser.snippylyId&&this.flockSessionService.removeFollowerFromCurrentSession(this.currentFlockUser.snippylyId))}catch(e){this.loggingService.catch("Error in FlockService removeCurrentUserFromSession: ",e)}}checkMatchingUrl(e){try{let r=k()?.url,i=e.url;if(r!==i&&i!==void 0){let{url:o,path:s,baseUrl:c}=e;if(this.onNavigate!==void 0&&typeof this.onNavigate=="function"){this.onNavigate({url:o,path:s,baseUrl:c});return}if(this.onNavigateEmitter&&this.onNavigateEmitter.emit({url:o,path:s,baseUrl:c}),this.disableDefaultNavigation)return;window.location.href=i}}catch(t){this.loggingService.catch("Error in FlockService checkMatchingUrl: ",t)}}scrollToFollowedUser(e){try{if(e.xpath===""){let t=this.domService.getElementFromXPath(e.targetXpath);t&&F(t)}else{let t=this.domService.getElementFromXPath(e.xpath),r=this.domService.getElementFromXPath(e.targetXpath);t&&r&&(F(t),R(t,r))}}catch(t){this.loggingService.catch("Error in FlockService scrollToFollowedUser: ",t)}}clickUserElement(e){try{let t=this.domService.getElementFromXPath(e.xpath);t&&this.lastClickedElement?.id!==e.id&&(t?.click(),this.lastClickedElement=e)}catch(t){this.loggingService.catch("Error in FlockService clickUserElement: ",t)}}scrollToHoveredElement(e){try{let t=this.domService.getElementFromXPath(e.xpath);if(t&&e.parentXpath)if(e.parentXpath==="/html")F(t);else{let r=this.domService.getElementFromXPath(e.parentXpath);r&&R(r,t,!0)}}catch(t){this.loggingService.catch("Error in FlockService clickUserElement: ",t)}}};n.\u0275fac=function(t){return new(t||n)(a(b),a(G),a(g),a(Q),a(Z))},n.\u0275prov=v({token:n,factory:n.\u0275fac,providedIn:"root"});let l=n;return l})();export{Ce as a};
@@ -1,2 +1,2 @@
1
- import{C as F,R as b,S as f,T as H,U as j,V as N,u as R,v as E,w as O,x as I}from"./chunk-J3FNQGWW.js";import{$ as y,D as v,E as l,Ga as k,J as h,Kb as A,Ua as C,Va as B,Ya as w,_a as M,a as c,aa as S,b as _,ba as p,da as r,db as D,ge as L,he as s,k as g,la as x,xb as T}from"./chunk-TY3WZ4Q4.js";function X(i,m){}var z="_mat-bottom-sheet-enter",P="_mat-bottom-sheet-exit",G=(()=>{class i extends H{_breakpointSubscription;_animationsDisabled=b();_animationState="void";_animationStateChanged=new k;_destroyed;constructor(){super();let e=r(L);this._breakpointSubscription=e.observe([s.Medium,s.Large,s.XLarge]).subscribe(()=>{let o=this._elementRef.nativeElement.classList;o.toggle("mat-bottom-sheet-container-medium",e.isMatched(s.Medium)),o.toggle("mat-bottom-sheet-container-large",e.isMatched(s.Large)),o.toggle("mat-bottom-sheet-container-xlarge",e.isMatched(s.XLarge))})}enter(){this._destroyed||(this._animationState="visible",this._changeDetectorRef.markForCheck(),this._changeDetectorRef.detectChanges(),this._animationsDisabled&&this._simulateAnimation(z))}exit(){this._destroyed||(this._elementRef.nativeElement.setAttribute("mat-exit",""),this._animationState="hidden",this._changeDetectorRef.markForCheck(),this._animationsDisabled&&this._simulateAnimation(P))}ngOnDestroy(){super.ngOnDestroy(),this._breakpointSubscription.unsubscribe(),this._destroyed=!0}_simulateAnimation(e){this._ngZone.run(()=>{this._handleAnimationEvent(!0,e),setTimeout(()=>this._handleAnimationEvent(!1,e))})}_trapFocus(){super._trapFocus({preventScroll:!0})}_handleAnimationEvent(e,o){let t=o===z;(t||o===P)&&this._animationStateChanged.emit({toState:t?"visible":"hidden",phase:e?"start":"done"})}static \u0275fac=function(o){return new(o||i)};static \u0275cmp=C({type:i,selectors:[["mat-bottom-sheet-container"]],hostAttrs:["tabindex","-1",1,"mat-bottom-sheet-container"],hostVars:9,hostBindings:function(o,t){o&1&&T("animationstart",function(a){return t._handleAnimationEvent(!0,a.animationName)})("animationend",function(a){return t._handleAnimationEvent(!1,a.animationName)})("animationcancel",function(a){return t._handleAnimationEvent(!1,a.animationName)}),o&2&&(D("role",t._config.role)("aria-modal",t._config.ariaModal)("aria-label",t._config.ariaLabel),A("mat-bottom-sheet-container-animations-enabled",!t._animationsDisabled)("mat-bottom-sheet-container-enter",t._animationState==="visible")("mat-bottom-sheet-container-exit",t._animationState==="hidden"))},features:[w],decls:1,vars:0,consts:[["cdkPortalOutlet",""]],template:function(o,t){o&1&&M(0,X,0,0,"ng-template",0)},dependencies:[R],styles:[`@keyframes _mat-bottom-sheet-enter{from{transform:translateY(100%)}to{transform:none}}@keyframes _mat-bottom-sheet-exit{from{transform:none}to{transform:translateY(100%)}}.mat-bottom-sheet-container{box-shadow:0px 8px 10px -5px rgba(0, 0, 0, 0.2), 0px 16px 24px 2px rgba(0, 0, 0, 0.14), 0px 6px 30px 5px rgba(0, 0, 0, 0.12);padding:8px 16px;min-width:100vw;box-sizing:border-box;display:block;outline:0;max-height:80vh;overflow:auto;position:relative;background:var(--mat-bottom-sheet-container-background-color, var(--mat-sys-surface-container-low));color:var(--mat-bottom-sheet-container-text-color, var(--mat-sys-on-surface));font-family:var(--mat-bottom-sheet-container-text-font, var(--mat-sys-body-large-font));font-size:var(--mat-bottom-sheet-container-text-size, var(--mat-sys-body-large-size));line-height:var(--mat-bottom-sheet-container-text-line-height, var(--mat-sys-body-large-line-height));font-weight:var(--mat-bottom-sheet-container-text-weight, var(--mat-sys-body-large-weight));letter-spacing:var(--mat-bottom-sheet-container-text-tracking, var(--mat-sys-body-large-tracking))}@media(forced-colors: active){.mat-bottom-sheet-container{outline:1px solid}}.mat-bottom-sheet-container-animations-enabled{transform:translateY(100%)}.mat-bottom-sheet-container-animations-enabled.mat-bottom-sheet-container-enter{animation:_mat-bottom-sheet-enter 195ms cubic-bezier(0, 0, 0.2, 1) forwards}.mat-bottom-sheet-container-animations-enabled.mat-bottom-sheet-container-exit{animation:_mat-bottom-sheet-exit 375ms cubic-bezier(0.4, 0, 1, 1) backwards}.mat-bottom-sheet-container-xlarge,.mat-bottom-sheet-container-large,.mat-bottom-sheet-container-medium{border-top-left-radius:var(--mat-bottom-sheet-container-shape, 28px);border-top-right-radius:var(--mat-bottom-sheet-container-shape, 28px)}.mat-bottom-sheet-container-medium{min-width:384px;max-width:calc(100vw - 128px)}.mat-bottom-sheet-container-large{min-width:512px;max-width:calc(100vw - 256px)}.mat-bottom-sheet-container-xlarge{min-width:576px;max-width:calc(100vw - 384px)}
1
+ import{C as F,R as b,S as f,T as H,U as j,V as N,u as R,v as E,w as O,x as I}from"./chunk-CVMNWHT4.js";import{$ as y,D as v,E as l,Ga as k,J as h,Kb as A,Td as L,Ua as C,Ud as s,Va as B,Ya as w,_a as M,a as c,aa as S,b as _,ba as p,da as r,db as D,k as g,la as x,xb as T}from"./chunk-FXK7BWOQ.js";function X(i,m){}var z="_mat-bottom-sheet-enter",P="_mat-bottom-sheet-exit",G=(()=>{class i extends H{_breakpointSubscription;_animationsDisabled=b();_animationState="void";_animationStateChanged=new k;_destroyed;constructor(){super();let e=r(L);this._breakpointSubscription=e.observe([s.Medium,s.Large,s.XLarge]).subscribe(()=>{let o=this._elementRef.nativeElement.classList;o.toggle("mat-bottom-sheet-container-medium",e.isMatched(s.Medium)),o.toggle("mat-bottom-sheet-container-large",e.isMatched(s.Large)),o.toggle("mat-bottom-sheet-container-xlarge",e.isMatched(s.XLarge))})}enter(){this._destroyed||(this._animationState="visible",this._changeDetectorRef.markForCheck(),this._changeDetectorRef.detectChanges(),this._animationsDisabled&&this._simulateAnimation(z))}exit(){this._destroyed||(this._elementRef.nativeElement.setAttribute("mat-exit",""),this._animationState="hidden",this._changeDetectorRef.markForCheck(),this._animationsDisabled&&this._simulateAnimation(P))}ngOnDestroy(){super.ngOnDestroy(),this._breakpointSubscription.unsubscribe(),this._destroyed=!0}_simulateAnimation(e){this._ngZone.run(()=>{this._handleAnimationEvent(!0,e),setTimeout(()=>this._handleAnimationEvent(!1,e))})}_trapFocus(){super._trapFocus({preventScroll:!0})}_handleAnimationEvent(e,o){let t=o===z;(t||o===P)&&this._animationStateChanged.emit({toState:t?"visible":"hidden",phase:e?"start":"done"})}static \u0275fac=function(o){return new(o||i)};static \u0275cmp=C({type:i,selectors:[["mat-bottom-sheet-container"]],hostAttrs:["tabindex","-1",1,"mat-bottom-sheet-container"],hostVars:9,hostBindings:function(o,t){o&1&&T("animationstart",function(a){return t._handleAnimationEvent(!0,a.animationName)})("animationend",function(a){return t._handleAnimationEvent(!1,a.animationName)})("animationcancel",function(a){return t._handleAnimationEvent(!1,a.animationName)}),o&2&&(D("role",t._config.role)("aria-modal",t._config.ariaModal)("aria-label",t._config.ariaLabel),A("mat-bottom-sheet-container-animations-enabled",!t._animationsDisabled)("mat-bottom-sheet-container-enter",t._animationState==="visible")("mat-bottom-sheet-container-exit",t._animationState==="hidden"))},features:[w],decls:1,vars:0,consts:[["cdkPortalOutlet",""]],template:function(o,t){o&1&&M(0,X,0,0,"ng-template",0)},dependencies:[R],styles:[`@keyframes _mat-bottom-sheet-enter{from{transform:translateY(100%)}to{transform:none}}@keyframes _mat-bottom-sheet-exit{from{transform:none}to{transform:translateY(100%)}}.mat-bottom-sheet-container{box-shadow:0px 8px 10px -5px rgba(0, 0, 0, 0.2), 0px 16px 24px 2px rgba(0, 0, 0, 0.14), 0px 6px 30px 5px rgba(0, 0, 0, 0.12);padding:8px 16px;min-width:100vw;box-sizing:border-box;display:block;outline:0;max-height:80vh;overflow:auto;position:relative;background:var(--mat-bottom-sheet-container-background-color, var(--mat-sys-surface-container-low));color:var(--mat-bottom-sheet-container-text-color, var(--mat-sys-on-surface));font-family:var(--mat-bottom-sheet-container-text-font, var(--mat-sys-body-large-font));font-size:var(--mat-bottom-sheet-container-text-size, var(--mat-sys-body-large-size));line-height:var(--mat-bottom-sheet-container-text-line-height, var(--mat-sys-body-large-line-height));font-weight:var(--mat-bottom-sheet-container-text-weight, var(--mat-sys-body-large-weight));letter-spacing:var(--mat-bottom-sheet-container-text-tracking, var(--mat-sys-body-large-tracking))}@media(forced-colors: active){.mat-bottom-sheet-container{outline:1px solid}}.mat-bottom-sheet-container-animations-enabled{transform:translateY(100%)}.mat-bottom-sheet-container-animations-enabled.mat-bottom-sheet-container-enter{animation:_mat-bottom-sheet-enter 195ms cubic-bezier(0, 0, 0.2, 1) forwards}.mat-bottom-sheet-container-animations-enabled.mat-bottom-sheet-container-exit{animation:_mat-bottom-sheet-exit 375ms cubic-bezier(0.4, 0, 1, 1) backwards}.mat-bottom-sheet-container-xlarge,.mat-bottom-sheet-container-large,.mat-bottom-sheet-container-medium{border-top-left-radius:var(--mat-bottom-sheet-container-shape, 28px);border-top-right-radius:var(--mat-bottom-sheet-container-shape, 28px)}.mat-bottom-sheet-container-medium{min-width:384px;max-width:calc(100vw - 128px)}.mat-bottom-sheet-container-large{min-width:512px;max-width:calc(100vw - 256px)}.mat-bottom-sheet-container-xlarge{min-width:576px;max-width:calc(100vw - 384px)}
2
2
  `],encapsulation:2})}return i})(),K=new p("MatBottomSheetData"),u=class{viewContainerRef;panelClass;direction;data=null;hasBackdrop=!0;backdropClass;disableClose=!1;ariaLabel=null;ariaModal=!1;closeOnNavigation=!0;autoFocus="first-tabbable";restoreFocus=!0;scrollStrategy;height="";minHeight;maxHeight},d=class{_ref;get instance(){return this._ref.componentInstance}get componentRef(){return this._ref.componentRef}containerInstance;disableClose;_afterOpened=new g;_result;_closeFallbackTimeout;constructor(m,e,o){this._ref=m,this.containerInstance=o,this.disableClose=e.disableClose,o._animationStateChanged.pipe(l(t=>t.phase==="done"&&t.toState==="visible"),h(1)).subscribe(()=>{this._afterOpened.next(),this._afterOpened.complete()}),o._animationStateChanged.pipe(l(t=>t.phase==="done"&&t.toState==="hidden"),h(1)).subscribe(()=>{clearTimeout(this._closeFallbackTimeout),this._ref.close(this._result)}),m.overlayRef.detachments().subscribe(()=>{this._ref.close(this._result)}),v(this.backdropClick(),this.keydownEvents().pipe(l(t=>t.keyCode===27))).subscribe(t=>{!this.disableClose&&(t.type!=="keydown"||!O(t))&&(t.preventDefault(),this.dismiss())})}dismiss(m){this.containerInstance&&(this.containerInstance._animationStateChanged.pipe(l(e=>e.phase==="start"),h(1)).subscribe(()=>{this._closeFallbackTimeout=setTimeout(()=>this._ref.close(this._result),500),this._ref.overlayRef.detachBackdrop()}),this._result=m,this.containerInstance.exit(),this.containerInstance=null)}afterDismissed(){return this._ref.closed}afterOpened(){return this._afterOpened}backdropClick(){return this._ref.backdropClick}keydownEvents(){return this._ref.keydownEvents}},U=new p("mat-bottom-sheet-default-options"),W=(()=>{class i{_injector=r(x);_parentBottomSheet=r(i,{optional:!0,skipSelf:!0});_animationsDisabled=b();_defaultOptions=r(U,{optional:!0});_bottomSheetRefAtThisLevel=null;_dialog=r(j);get _openedBottomSheetRef(){let e=this._parentBottomSheet;return e?e._openedBottomSheetRef:this._bottomSheetRefAtThisLevel}set _openedBottomSheetRef(e){this._parentBottomSheet?this._parentBottomSheet._openedBottomSheetRef=e:this._bottomSheetRefAtThisLevel=e}constructor(){}open(e,o){let t=c(c({},this._defaultOptions||new u),o),n;return this._dialog.open(e,_(c({},t),{disableClose:!0,closeOnOverlayDetachments:!1,maxWidth:"100%",container:G,scrollStrategy:t.scrollStrategy||I(this._injector),positionStrategy:F(this._injector).centerHorizontally().bottom("0"),disableAnimations:this._animationsDisabled,templateContext:()=>({bottomSheetRef:n}),providers:(a,Z,Y)=>(n=new d(a,t,Y),[{provide:d,useValue:n},{provide:K,useValue:t.data}])})),n.afterDismissed().subscribe(()=>{this._openedBottomSheetRef===n&&(this._openedBottomSheetRef=null)}),this._openedBottomSheetRef?(this._openedBottomSheetRef.afterDismissed().subscribe(()=>n.containerInstance?.enter()),this._openedBottomSheetRef.dismiss()):n.containerInstance.enter(),this._openedBottomSheetRef=n,n}dismiss(e){this._openedBottomSheetRef&&this._openedBottomSheetRef.dismiss(e)}ngOnDestroy(){this._bottomSheetRefAtThisLevel&&this._bottomSheetRefAtThisLevel.dismiss()}static \u0275fac=function(o){return new(o||i)};static \u0275prov=y({token:i,factory:i.\u0275fac,providedIn:"root"})}return i})(),dt=(()=>{class i{static \u0275fac=function(o){return new(o||i)};static \u0275mod=B({type:i});static \u0275inj=S({providers:[W],imports:[N,f,E,f]})}return i})();export{K as a,d as b,W as c,dt as d};
@@ -1 +1 @@
1
- import{Ga as c,Pa as n,Wa as o,ua as a,ui as h,wa as r}from"./chunk-TY3WZ4Q4.js";var I=(()=>{let e=class e{constructor(t,i){this.domService=t,this.elementRef=i,this.clickOutside=new c}ngOnInit(){}ngAfterViewInit(){setTimeout(()=>{this.subscription=this.domService.onDocumentClickSubject$().subscribe(t=>{let i=this.checkInsideClick(t,this.elementRef.nativeElement);!i&&this.clickOutsideHandler&&typeof this.clickOutsideHandler=="function"&&(i=this.clickOutsideHandler(t.target,this.elementRef.nativeElement)),i||this.clickOutside.emit()})},500)}ngOnDestroy(){this.subscription?.unsubscribe()}checkInsideClick(t,i){return t.composedPath().includes(i)}};e.\u0275fac=function(i){return new(i||e)(n(h),n(r))},e.\u0275dir=o({type:e,selectors:[["","snippylyClickOutside",""]],inputs:{clickOutsideHandler:"clickOutsideHandler"},outputs:{clickOutside:"clickOutside"}});let s=e;return s})();var b=(()=>{let e=class e{constructor(t){this.elementRef=t,this.lastPosition=null,this.positionChange=new c,this.disabled=!1,this.timeSpentInMs=0,this.MAX_TIME_SPENT_IN_MS=6e4}ngAfterViewInit(){try{this.toggleTrackingPosition()}catch{}}toggleTrackingPosition(){try{this.disabled?this.stopTracking():this.startTrackingPosition()}catch{}}startTrackingPosition(){try{if(this.intervalId)return;this.intervalId=setInterval(()=>{if(this.timeSpentInMs+=10,this.timeSpentInMs>this.MAX_TIME_SPENT_IN_MS){this.stopTracking();return}let t=this.elementRef.nativeElement.getBoundingClientRect();(!this.lastPosition||!this.arePositionsEqual(this.lastPosition,t))&&(this.lastPosition=t,this.positionChange.emit(t))},10)}catch{}}stopTracking(){try{this.intervalId&&(clearInterval(this.intervalId),this.intervalId=null,this.timeSpentInMs=0)}catch{}}arePositionsEqual(t,i){try{return t.top===i.top&&t.left===i.left&&t.bottom===i.bottom&&t.right===i.right&&t.width===i.width&&t.height===i.height}catch{return!0}}ngOnChanges(){try{this.toggleTrackingPosition()}catch{}}ngOnDestroy(){try{this.stopTracking()}catch{}}};e.\u0275fac=function(i){return new(i||e)(n(r))},e.\u0275dir=o({type:e,selectors:[["","veltPositionObserver",""]],inputs:{disabled:[0,"veltPositionObserverDisabled","disabled"]},outputs:{positionChange:"positionChange"},features:[a]});let s=e;return s})();export{I as a,b};
1
+ import{Ga as c,Pa as n,Wa as o,si as h,ua as a,wa as r}from"./chunk-FXK7BWOQ.js";var I=(()=>{let e=class e{constructor(t,i){this.domService=t,this.elementRef=i,this.clickOutside=new c}ngOnInit(){}ngAfterViewInit(){setTimeout(()=>{this.subscription=this.domService.onDocumentClickSubject$().subscribe(t=>{let i=this.checkInsideClick(t,this.elementRef.nativeElement);!i&&this.clickOutsideHandler&&typeof this.clickOutsideHandler=="function"&&(i=this.clickOutsideHandler(t.target,this.elementRef.nativeElement)),i||this.clickOutside.emit()})},500)}ngOnDestroy(){this.subscription?.unsubscribe()}checkInsideClick(t,i){return t.composedPath().includes(i)}};e.\u0275fac=function(i){return new(i||e)(n(h),n(r))},e.\u0275dir=o({type:e,selectors:[["","snippylyClickOutside",""]],inputs:{clickOutsideHandler:"clickOutsideHandler"},outputs:{clickOutside:"clickOutside"}});let s=e;return s})();var b=(()=>{let e=class e{constructor(t){this.elementRef=t,this.lastPosition=null,this.positionChange=new c,this.disabled=!1,this.timeSpentInMs=0,this.MAX_TIME_SPENT_IN_MS=6e4}ngAfterViewInit(){try{this.toggleTrackingPosition()}catch{}}toggleTrackingPosition(){try{this.disabled?this.stopTracking():this.startTrackingPosition()}catch{}}startTrackingPosition(){try{if(this.intervalId)return;this.intervalId=setInterval(()=>{if(this.timeSpentInMs+=10,this.timeSpentInMs>this.MAX_TIME_SPENT_IN_MS){this.stopTracking();return}let t=this.elementRef.nativeElement.getBoundingClientRect();(!this.lastPosition||!this.arePositionsEqual(this.lastPosition,t))&&(this.lastPosition=t,this.positionChange.emit(t))},10)}catch{}}stopTracking(){try{this.intervalId&&(clearInterval(this.intervalId),this.intervalId=null,this.timeSpentInMs=0)}catch{}}arePositionsEqual(t,i){try{return t.top===i.top&&t.left===i.left&&t.bottom===i.bottom&&t.right===i.right&&t.width===i.width&&t.height===i.height}catch{return!0}}ngOnChanges(){try{this.toggleTrackingPosition()}catch{}}ngOnDestroy(){try{this.stopTracking()}catch{}}};e.\u0275fac=function(i){return new(i||e)(n(r))},e.\u0275dir=o({type:e,selectors:[["","veltPositionObserver",""]],inputs:{disabled:[0,"veltPositionObserverDisabled","disabled"]},outputs:{positionChange:"positionChange"},features:[a]});let s=e;return s})();export{I as a,b};
@@ -1 +1 @@
1
- import{a as m}from"./chunk-XJWB3IUW.js";import{Pa as c,Xa as f}from"./chunk-TY3WZ4Q4.js";var l=(()=>{let t=class t{constructor(r){this.translateService=r}transform(r,...i){try{let n=(new Date().getTime()-new Date(r).getTime())/1e3;if(n<1)return this.translateService.translate("now");let s={y:31536e3,mo:2592e3,w:604800,d:86400,h:3600,m:60,s:1};for(let a in s){let o=Math.floor(n/s[a]);if(o>0)return`${o}${this.translateService.translate(a)}`}return r}catch{return r}}};t.\u0275fac=function(i){return new(i||t)(c(m,16))},t.\u0275pipe=f({name:"timeAgo",type:t,pure:!0});let e=t;return e})();export{l as a};
1
+ import{a as m}from"./chunk-QX6IGTVL.js";import{Pa as c,Xa as f}from"./chunk-FXK7BWOQ.js";var l=(()=>{let t=class t{constructor(r){this.translateService=r}transform(r,...i){try{let n=(new Date().getTime()-new Date(r).getTime())/1e3;if(n<1)return this.translateService.translate("now");let s={y:31536e3,mo:2592e3,w:604800,d:86400,h:3600,m:60,s:1};for(let a in s){let o=Math.floor(n/s[a]);if(o>0)return`${o}${this.translateService.translate(a)}`}return r}catch{return r}}};t.\u0275fac=function(i){return new(i||t)(c(m,16))},t.\u0275pipe=f({name:"timeAgo",type:t,pure:!0});let e=t;return e})();export{l as a};
@@ -1 +1 @@
1
- import{Te as h,Xe as c}from"./chunk-TY3WZ4Q4.js";var d=(t,r)=>{try{let e=l(t),i=[],n=[];return e.forEach(o=>{o?.parentElement?.closest(h.TAGS.SNIPPYLY_TEXT_HIGHLIGHT)?o?.parentElement?.normalize():n.push(o)}),n.forEach(o=>{let s=a(o,r);s&&i.push(s)}),i}catch(e){return c.catch("Error in highlighter highlightRange: ",e),[]}},l=t=>{try{if(t.collapsed)return[];let r=t.commonAncestorContainer;if(t.commonAncestorContainer.nodeType!==Node.ELEMENT_NODE&&(r=t.commonAncestorContainer.parentElement),!r)return[];let e=[],i=r.ownerDocument.createNodeIterator(r,NodeFilter.SHOW_TEXT),n,o=!1;for(;n=i.nextNode();)if(t.intersectsNode(n)){let s=n?.length;t.startContainer===n&&t.startOffset>0&&(n.splitText(t.startOffset),o=!0),t.endContainer===n&&t.endOffset<s&&n.splitText(t.endOffset),e.push(n)}return o&&e.shift(),e}catch(r){return c.catch("Error in highlighter getTextNodesInRange: ",r),[]}},a=(t,r)=>{try{let e=document.createElement(r||h.TAGS.SNIPPYLY_TEXT_HIGHLIGHT);return t.parentElement?.replaceChild(e,t),e.appendChild(t),e}catch(e){return c.catch("Error in highlighter highlightNode: ",e),null}};export{d as a};
1
+ import{Ee as h,Wd as c}from"./chunk-FXK7BWOQ.js";var d=(t,r)=>{try{let e=l(t),i=[],n=[];return e.forEach(o=>{o?.parentElement?.closest(h.TAGS.SNIPPYLY_TEXT_HIGHLIGHT)?o?.parentElement?.normalize():n.push(o)}),n.forEach(o=>{let s=a(o,r);s&&i.push(s)}),i}catch(e){return c.catch("Error in highlighter highlightRange: ",e),[]}},l=t=>{try{if(t.collapsed)return[];let r=t.commonAncestorContainer;if(t.commonAncestorContainer.nodeType!==Node.ELEMENT_NODE&&(r=t.commonAncestorContainer.parentElement),!r)return[];let e=[],i=r.ownerDocument.createNodeIterator(r,NodeFilter.SHOW_TEXT),n,o=!1;for(;n=i.nextNode();)if(t.intersectsNode(n)){let s=n?.length;t.startContainer===n&&t.startOffset>0&&(n.splitText(t.startOffset),o=!0),t.endContainer===n&&t.endOffset<s&&n.splitText(t.endOffset),e.push(n)}return o&&e.shift(),e}catch(r){return c.catch("Error in highlighter getTextNodesInRange: ",r),[]}},a=(t,r)=>{try{let e=document.createElement(r||h.TAGS.SNIPPYLY_TEXT_HIGHLIGHT);return t.parentElement?.replaceChild(e,t),e.appendChild(t),e}catch(e){return c.catch("Error in highlighter highlightNode: ",e),null}};export{d as a};
@@ -0,0 +1,2 @@
1
+ import{f as B,j as Z}from"./chunk-CVMNWHT4.js";import{$ as y,Ee as p,L as w,Pi as ne,Qe as te,Se as re,T as q,Uh as k,Va as Y,Wa as X,Xf as T,_ as H,_b as Q,a as _,aa as W,ae as d,b as C,ca as h,g as V,hg as O,i as v,ii as ie,k as N,ki as E,od as ee,qa as J,qh as j,r as $,ua as K,v as L}from"./chunk-FXK7BWOQ.js";var P=class{_totalWeight=0;_averageItemSize;_defaultItemSize;constructor(i=50){this._defaultItemSize=i,this._averageItemSize=i}getAverageItemSize(){return this._averageItemSize}addSample(i,o){let e=this._totalWeight+i.end-i.start;if(e){let t=(o+this._averageItemSize*this._totalWeight)/e;t&&(this._averageItemSize=t,this._totalWeight=e)}}reset(){this._averageItemSize=this._defaultItemSize,this._totalWeight=0}},z=class{scrolledIndexChange=new v(()=>{});_viewport=null;_minBufferPx;_maxBufferPx;_averager;_lastScrollOffset;_lastRenderedContentSize;_lastRenderedContentOffset;_removalFailures=0;constructor(i,o,e=new P){this._minBufferPx=i,this._maxBufferPx=o,this._averager=e}attach(i){this._averager.reset(),this._viewport=i,this._renderContentForCurrentOffset()}detach(){this._viewport=null}onContentScrolled(){this._viewport&&this._updateRenderedContentAfterScroll()}onDataLengthChanged(){this._viewport&&(this._renderContentForCurrentOffset(),this._checkRenderedContentSize())}onContentRendered(){this._viewport&&this._checkRenderedContentSize()}onRenderedOffsetChanged(){this._viewport&&this._checkRenderedContentOffset()}scrollToIndex(){}updateBufferSize(i,o){if(o<i)throw Error("CDK virtual scroll: maxBufferPx must be greater than or equal to minBufferPx");this._minBufferPx=i,this._maxBufferPx=o}_updateRenderedContentAfterScroll(){let i=this._viewport,o=i.measureScrollOffset(),e=o-this._lastScrollOffset,t=Math.abs(e),r=i.getRenderedRange(),s=0;if(e<0){let g=r.start*this._averager.getAverageItemSize()-this._lastRenderedContentOffset;s=Math.round(g*Math.max(0,Math.min(1,t/(o+t)))),e=e-s,t=Math.abs(e)}let a=this._lastScrollOffset-this._lastRenderedContentOffset,c=this._lastRenderedContentOffset+this._lastRenderedContentSize-(this._lastScrollOffset+i.getViewportSize()),u=t+this._minBufferPx-(e<0?a:c);if(u>0)if(t>=i.getViewportSize())this._renderContentForCurrentOffset();else{let f=Math.max(0,Math.ceil((u-this._minBufferPx+this._maxBufferPx)/this._averager.getAverageItemSize())),g=(e<0?c:a)-this._minBufferPx+t,b=Math.floor(g/this._averager.getAverageItemSize()/(this._removalFailures+1)),A=Math.min(r.end-r.start,Math.max(0,b)),l=this._expandRange(r,e<0?f:0,e>0?f:0);e<0?l.end=Math.max(l.start+1,l.end-A):l.start=Math.min(l.end-1,l.start+A);let S,G;if(e<0){let R=i.measureRangeSize({start:l.end,end:r.end});R<=g?(S=this._lastRenderedContentOffset+this._lastRenderedContentSize-R,this._removalFailures=0):(l.end=r.end,S=this._lastRenderedContentOffset+this._lastRenderedContentSize,this._removalFailures++),G="to-end"}else{let R=i.measureRangeSize({start:r.start,end:l.start});R<=g?(S=this._lastRenderedContentOffset+R,this._removalFailures=0):(l.start=r.start,S=this._lastRenderedContentOffset,this._removalFailures++),G="to-start"}i.setRenderedRange(l),i.setRenderedContentOffset(S+s,G)}else s&&i.setRenderedContentOffset(this._lastRenderedContentOffset+s);this._lastScrollOffset=o}_checkRenderedContentSize(){let i=this._viewport;this._lastRenderedContentSize=i.measureRenderedContentSize(),this._averager.addSample(i.getRenderedRange(),this._lastRenderedContentSize),this._updateTotalContentSize(this._lastRenderedContentSize)}_checkRenderedContentOffset(){let i=this._viewport;this._lastRenderedContentOffset=i.getOffsetToRenderedContentStart()}_renderContentForCurrentOffset(){let i=this._viewport,o=i.measureScrollOffset();this._lastScrollOffset=o,this._removalFailures=0;let e=this._averager.getAverageItemSize(),t=Math.min(i.getDataLength()-1,Math.floor(o/e)),r=Math.ceil(this._maxBufferPx/e),s=this._expandRange(this._getVisibleRangeForIndex(t),r,r);i.setRenderedRange(s),i.setRenderedContentOffset(e*s.start)}_getVisibleRangeForIndex(i){let o=this._viewport,e={start:i,end:i+Math.ceil(o.getViewportSize()/this._averager.getAverageItemSize())},t=e.end-o.getDataLength();return t>0&&(e.start=Math.max(0,e.start-t)),e}_expandRange(i,o,e){let t=this._viewport,r=Math.max(0,i.start-o),s=Math.min(t.getDataLength(),i.end+e);return{start:r,end:s}}_updateTotalContentSize(i){let o=this._viewport,e=o.getRenderedRange(),t=i+(o.getDataLength()-(e.end-e.start))*this._averager.getAverageItemSize();o.setTotalContentSize(t)}};function le(n){return n._scrollStrategy}var Ae=(()=>{class n{get minBufferPx(){return this._minBufferPx}set minBufferPx(o){this._minBufferPx=B(o)}_minBufferPx=100;get maxBufferPx(){return this._maxBufferPx}set maxBufferPx(o){this._maxBufferPx=B(o)}_maxBufferPx=200;_scrollStrategy=new z(this.minBufferPx,this.maxBufferPx);ngOnChanges(){this._scrollStrategy.updateBufferSize(this.minBufferPx,this.maxBufferPx)}static \u0275fac=function(e){return new(e||n)};static \u0275dir=X({type:n,selectors:[["cdk-virtual-scroll-viewport","autosize",""]],inputs:{minBufferPx:"minBufferPx",maxBufferPx:"maxBufferPx"},features:[Q([{provide:Z,useFactory:le,deps:[H(()=>n)]}]),K]})}return n})(),Re=(()=>{class n{static \u0275fac=function(e){return new(e||n)};static \u0275mod=Y({type:n});static \u0275inj=W({})}return n})();var I=(()=>{let i=class i{constructor(e){this.loggingService=e,this.enabledSignal=J(!1),this.onTargetEditStart=null,this.onTargetEditCommit=null,this.autoCommit=!0;try{this.enabled$=ee(this.enabledSignal).pipe(w())}catch(t){this.loggingService.catch("Error in SuggestionModeService constructor: ",t),this.enabled$=new v}}enable(e){try{this.onTargetEditStart=e?.onTargetEditStart??null,this.onTargetEditCommit=e?.onTargetEditCommit??null,this.autoCommit=e?.autoCommit!==!1,this.enabledSignal.set(!0)}catch(t){this.loggingService.catch("Error in SuggestionModeService enable: ",t)}}disable(){try{this.onTargetEditStart=null,this.onTargetEditCommit=null,this.autoCommit=!0,this.enabledSignal.set(!1)}catch(e){this.loggingService.catch("Error in SuggestionModeService disable: ",e)}}isEnabled(){try{return this.enabledSignal()}catch(e){return this.loggingService.catch("Error in SuggestionModeService isEnabled: ",e),!1}}getOnTargetEditStart(){try{return this.onTargetEditStart}catch(e){return this.loggingService.catch("Error in SuggestionModeService getOnTargetEditStart: ",e),null}}getOnTargetEditCommit(){try{return this.onTargetEditCommit}catch(e){return this.loggingService.catch("Error in SuggestionModeService getOnTargetEditCommit: ",e),null}}isAutoCommitEnabled(){try{return this.autoCommit}catch(e){return this.loggingService.catch("Error in SuggestionModeService isAutoCommitEnabled: ",e),!1}}};i.\u0275fac=function(t){return new(t||i)(h(E))},i.\u0275prov=y({token:i,factory:i.\u0275fac,providedIn:"root"});let n=i;return n})();var D=(()=>{let i=class i{constructor(e){this.loggingService=e,this.snapshots=new Map}captureFromGetter(e,t){try{if(!e||typeof t!="function")return!1;let r;try{r=t()}catch(s){return T()&&this.loggingService.catch(`[velt] Suggestion target "${e}" getter threw: `,s),!1}return this.captureValue(e,r)}catch(r){return this.loggingService.catch("Error in SuggestionSnapshotService captureFromGetter: ",r),!1}}captureValue(e,t){try{if(!e)return!1;let r;try{r=structuredClone(t)}catch(s){return T()&&this.loggingService.catch(`[velt] Suggestion target "${e}" snapshot failed (value not cloneable). Cause: structuredClone rejected the value (cyclic refs, DOM nodes, or functions are common culprits). Fix: ensure your getter returns plain JSON-serializable data.`,s),!1}return this.snapshots.set(e,r),!0}catch(r){return this.loggingService.catch("Error in SuggestionSnapshotService captureValue: ",r),!1}}getSnapshot(e){try{return this.snapshots.has(e)?this.snapshots.get(e):void 0}catch(t){this.loggingService.catch("Error in SuggestionSnapshotService getSnapshot: ",t);return}}hasSnapshot(e){try{return this.snapshots.has(e)}catch(t){return this.loggingService.catch("Error in SuggestionSnapshotService hasSnapshot: ",t),!1}}clearSnapshot(e){try{this.snapshots.delete(e)}catch(t){this.loggingService.catch("Error in SuggestionSnapshotService clearSnapshot: ",t)}}clearAllSnapshots(){try{this.snapshots.clear()}catch(e){this.loggingService.catch("Error in SuggestionSnapshotService clearAllSnapshots: ",e)}}};i.\u0275fac=function(t){return new(t||i)(h(E))},i.\u0275prov=y({token:i,factory:i.\u0275fac,providedIn:"root"});let n=i;return n})();var ae=(()=>{let i=class i{constructor(e,t,r){this.loggingService=e,this.modeService=t,this.snapshotService=r,this.registry=new Map,this.warnedUnstableIds=new Set,this.actionsService=null}registerTarget(e,t){try{if(!e||typeof t!="function")return;this.warnIfUnstableId(e);let r=this.registry.get(e)??{};r.getter=t,this.registry.set(e,r)}catch(r){this.loggingService.catch("Error in SuggestionTargetRegistryService registerTarget: ",r)}}unregisterTarget(e){try{let t=this.registry.get(e);if(!t)return;delete t.getter,t.node||this.registry.delete(e)}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService unregisterTarget: ",t)}}getGetter(e){try{return this.registry.get(e)?.getter}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService getGetter: ",t);return}}setActionsService(e){try{this.actionsService=e}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService setActionsService: ",t)}}getNode(e){try{if(!e)return;let t=this.registry.get(e)?.node;if(t&&t.isConnected)return t;let r=this.queryAll(e);if(r.length===0)return;r.length>1&&this.warnDuplicateId(e,r.length);let s=r[0],a=this.registry.get(e)??{};return a.node=s,this.registry.set(e,a),s}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService getNode: ",t);return}}getFallbackValue(e){try{let t=this.getNode(e);if(!t)return{hasValue:!1};let r=t.textContent??"";return r.length>0?{hasValue:!0,value:r}:{hasValue:!1}}catch(t){return this.loggingService.catch("Error in SuggestionTargetRegistryService getFallbackValue: ",t),{hasValue:!1}}}isRegistered(e){try{return this.registry.get(e)?.getter?!0:!!this.getNode(e)}catch(t){return this.loggingService.catch("Error in SuggestionTargetRegistryService isRegistered: ",t),!1}}countTaggedElements(e){try{let t=e??this.rootEl??document.body;return t?t.querySelectorAll(`[${p.ATTRIBUTES.VELT_SUGGESTION_TARGET}]`).length:0}catch(t){return this.loggingService.catch("Error in SuggestionTargetRegistryService countTaggedElements: ",t),0}}startObserving(e=document.body){try{if(this.observer)return;this.rootEl=e,this.scanAndRefresh(e),this.observer=new MutationObserver(()=>{try{this.scanAndRefresh(this.rootEl??document.body)}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService observer callback: ",t)}}),this.observer.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[p.ATTRIBUTES.VELT_SUGGESTION_TARGET]}),this.installDelegatedListeners(e)}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService startObserving: ",t)}}stopObserving(){try{this.observer?.disconnect(),this.observer=void 0,this.rootEl&&this.removeDelegatedListeners(this.rootEl),this.rootEl=void 0}catch(e){this.loggingService.catch("Error in SuggestionTargetRegistryService stopObserving: ",e)}}clear(){try{this.registry.clear(),this.warnedUnstableIds.clear()}catch(e){this.loggingService.catch("Error in SuggestionTargetRegistryService clear: ",e)}}installDelegatedListeners(e){try{this.boundFocusIn=t=>this.handleFocusIn(t),this.boundChange=t=>this.handleChange(t),this.boundFocusOut=t=>this.handleFocusOut(t),e.addEventListener("focusin",this.boundFocusIn,!0),e.addEventListener("change",this.boundChange,!0),e.addEventListener("focusout",this.boundFocusOut,!0)}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService installDelegatedListeners: ",t)}}removeDelegatedListeners(e){try{this.boundFocusIn&&e.removeEventListener("focusin",this.boundFocusIn,!0),this.boundChange&&e.removeEventListener("change",this.boundChange,!0),this.boundFocusOut&&e.removeEventListener("focusout",this.boundFocusOut,!0),this.boundFocusIn=void 0,this.boundChange=void 0,this.boundFocusOut=void 0}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService removeDelegatedListeners: ",t)}}handleFocusIn(e){try{if(!this.modeService.isEnabled())return;let t=this.findTaggedAncestor(e.target);if(!t)return;this.captureSnapshotForTarget(t.targetId,t.element);let r=this.snapshotService.getSnapshot(t.targetId),s={targetId:t.targetId,oldValue:r,newValue:r,element:t.element},a=this.modeService.getOnTargetEditStart();if(a)try{a(s)}catch(c){this.loggingService.catch("Error in SuggestionTargetRegistryService onTargetEditStart customer callback threw: ",c)}this.actionsService?.triggerAction(d.TARGET_EDIT_START,{details:s,timestamp:Date.now()})}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService handleFocusIn: ",t)}}handleChange(e){try{if(!this.modeService.isEnabled())return;let t=this.findTaggedAncestor(e.target);if(!t||!this.isAtomicCommitTarget(e.target))return;this.processCommit(t.targetId,t.element)}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService handleChange: ",t)}}handleFocusOut(e){try{if(!this.modeService.isEnabled())return;let t=this.findTaggedAncestor(e.target);if(!t||this.isAtomicCommitTarget(e.target))return;this.processCommit(t.targetId,t.element)}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService handleFocusOut: ",t)}}isAtomicCommitTarget(e){try{if(e instanceof HTMLSelectElement)return!0;if(e instanceof HTMLInputElement){let t=(e.type||"").toLowerCase();return t==="checkbox"||t==="radio"}return!1}catch(t){return this.loggingService.catch("Error in SuggestionTargetRegistryService isAtomicCommitTarget: ",t),!1}}processCommit(e,t){try{let r=this.snapshotService.getSnapshot(e),s=this.readElementValue(e,t);if(O(r,s))return;let a={targetId:e,oldValue:r,newValue:s,element:t},c=this.modeService.getOnTargetEditCommit(),u=null;if(c){let g=null;try{g=c(a)}catch(b){this.loggingService.catch("Error in SuggestionTargetRegistryService onTargetEditCommit customer callback threw: ",b)}g&&(u=this.invokeAutoCommit({targetId:e,newValue:s,summary:g.summary,summaryHtml:g.summaryHtml,metadata:g.metadata}))}else this.modeService.isAutoCommitEnabled()&&(u=this.invokeAutoCommit({targetId:e,newValue:s}));let f=g=>V(this,null,function*(){return u&&(yield u)?null:this.invokeAutoCommit({targetId:e,newValue:s,summary:g?.summary,summaryHtml:g?.summaryHtml,metadata:g?.metadata})});this.actionsService?.triggerAction(d.TARGET_EDIT_COMMIT,{details:a,commitSuggestion:f,timestamp:Date.now()})}catch(r){this.loggingService.catch("Error in SuggestionTargetRegistryService processCommit: ",r)}}invokeAutoCommit(e){try{return this.actionsService?this.actionsService.commitSuggestion(e).catch(t=>(T()&&this.loggingService.catch(`[velt] auto-commit for "${e.targetId}" rejected: `,t),null)):(T()&&this.loggingService.log("[velt] auto-commit skipped: actions service not wired. SuggestionActionsService constructor should call registry.setActionsService(this)."),Promise.resolve(null))}catch(t){return this.loggingService.catch("Error in SuggestionTargetRegistryService invokeAutoCommit: ",t),Promise.resolve(null)}}captureSnapshotForTarget(e,t){try{let r=this.registry.get(e);if(r?.getter){this.snapshotService.captureFromGetter(e,r.getter);return}let s=this.readElementValue(e,t);this.snapshotService.captureValue(e,s)}catch(r){this.loggingService.catch("Error in SuggestionTargetRegistryService captureSnapshotForTarget: ",r)}}readElementValue(e,t){try{let r=this.registry.get(e);if(r?.getter)try{return r.getter()}catch{return}if(t instanceof HTMLInputElement){let s=(t.type||"").toLowerCase();return s==="checkbox"||s==="radio"?t.checked:s==="number"||s==="range"?Number.isNaN(t.valueAsNumber)?t.value:t.valueAsNumber:t.value}return t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement?t.value:(t instanceof HTMLElement&&t.isContentEditable,t.textContent??"")}catch(r){this.loggingService.catch("Error in SuggestionTargetRegistryService readElementValue: ",r);return}}findTaggedAncestor(e){try{if(!(e instanceof Element))return null;let t=e.closest(`[${p.ATTRIBUTES.VELT_SUGGESTION_TARGET}]`);if(!t)return null;let r=t.getAttribute(p.ATTRIBUTES.VELT_SUGGESTION_TARGET);return r?{element:t,targetId:r}:null}catch(t){return this.loggingService.catch("Error in SuggestionTargetRegistryService findTaggedAncestor: ",t),null}}queryAll(e){try{let t=window.CSS?.escape?window.CSS.escape(e):e.replace(/"/g,'\\"');return Array.from(document.querySelectorAll(`[${p.ATTRIBUTES.VELT_SUGGESTION_TARGET}="${t}"]`))}catch{return[]}}scanAndRefresh(e){try{e.querySelectorAll(`[${p.ATTRIBUTES.VELT_SUGGESTION_TARGET}]`).forEach(r=>{let s=r.getAttribute(p.ATTRIBUTES.VELT_SUGGESTION_TARGET);if(!s)return;let a=this.registry.get(s)??{};(!a.node||!a.node.isConnected)&&(a.node=r,this.registry.set(s,a))})}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService scanAndRefresh: ",t)}}warnIfUnstableId(e){try{if(!T()||this.warnedUnstableIds.has(e))return;let t=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i.test(e),r=/\d{10,}/.test(e);(t||r)&&(this.warnedUnstableIds.add(e),this.loggingService.catch(`[velt] Target id "${e}" appears unstable. Cause: contains a UUID or timestamp shape \u2014 these typically change across re-renders. Fix: use a stable customer-owned id (the same one you use in your state). Docs: velt.dev/docs/suggestions/target-ids`,new Error("UNSTABLE_TARGET_ID")))}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService warnIfUnstableId: ",t)}}warnDuplicateId(e,t){try{if(!T())return;this.loggingService.catch(`[velt] Duplicate target id "${e}" \u2014 ${t} elements share this id. Cause: the same ${p.ATTRIBUTES.VELT_SUGGESTION_TARGET} appears on multiple DOM nodes. Fix: ensure each suggestable element has a unique id. Velt is using the first registered element. Docs: velt.dev/docs/suggestions/target-ids`,new Error("DUPLICATE_TARGET_ID"))}catch(r){this.loggingService.catch("Error in SuggestionTargetRegistryService warnDuplicateId: ",r)}}};i.\u0275fac=function(t){return new(t||i)(h(E),h(I),h(D))},i.\u0275prov=y({token:i,factory:i.\u0275fac,providedIn:"root"});let n=i;return n})();var Ve=(()=>{let i=class i{constructor(e,t,r,s,a,c){this.loggingService=e,this.modeService=t,this.snapshotService=r,this.targetRegistry=s,this.serviceBook=a,this.commonDbService=c,this.actionSubjects=new Map,this.observingActive=!1,this.commentService=null;try{this.targetRegistry.setActionsService(this),this.serviceBook.observe(k).subscribe(u=>{this.commentService=u})}catch(u){this.loggingService.catch("Error in SuggestionActionsService constructor: ",u)}}enableSuggestionMode(e){try{this.modeService.enable(e),this.startObservingIfNeeded(),this.warnIfNoTaggedElements()}catch(t){this.loggingService.catch("Error in SuggestionActionsService enableSuggestionMode: ",t)}}disableSuggestionMode(){try{this.modeService.disable(),this.stopObservingIfNeeded()}catch(e){this.loggingService.catch("Error in SuggestionActionsService disableSuggestionMode: ",e)}}isSuggestionModeEnabled(){try{return this.modeService.isEnabled()}catch(e){return this.loggingService.catch("Error in SuggestionActionsService isSuggestionModeEnabled: ",e),!1}}isSuggestionModeEnabled$(){try{return this.modeService.enabled$}catch(e){return this.loggingService.catch("Error in SuggestionActionsService isSuggestionModeEnabled$: ",e),new v}}registerTarget(e){try{if(!e?.targetId||typeof e?.getter!="function")return;this.targetRegistry.registerTarget(e.targetId,e.getter)}catch(t){this.loggingService.catch("Error in SuggestionActionsService registerTarget: ",t)}}unregisterTarget(e){try{this.targetRegistry.unregisterTarget(e)}catch(t){this.loggingService.catch("Error in SuggestionActionsService unregisterTarget: ",t)}}startSuggestion(e){try{let t=this.targetRegistry.getGetter(e);if(t){this.snapshotService.captureFromGetter(e,t);return}let r=this.targetRegistry.getFallbackValue(e);r.hasValue?this.snapshotService.captureValue(e,r.value):this.loggingService.warn(`[velt] startSuggestion: target "${e}" not registered. Cause: no getter via registerTarget() and no textContent fallback. Fix: tag the element with data-velt-suggestion-target and register a getter via registerTarget(). Docs: velt.dev/docs/suggestions/targets`)}catch(t){this.loggingService.catch("Error in SuggestionActionsService startSuggestion: ",t)}}commitSuggestion(e){return new Promise((t,r)=>{try{if(!e?.targetId){r(new Error("INVALID_CONFIG"));return}if(!this.modeService.isEnabled()){this.loggingService.warn("[velt] commitSuggestion called while suggestion mode is disabled. Cause: enableSuggestionMode() has not been called (or disableSuggestionMode() was called). Fix: call enableSuggestionMode() before commit, or branch on isSuggestionModeEnabled() in your onSave handler. Docs: velt.dev/docs/suggestions/mode"),r(new Error("MODE_NOT_SUGGESTING"));return}if(!this.targetRegistry.isRegistered(e.targetId)){this.loggingService.warn(`[velt] commitSuggestion: target "${e.targetId}" not registered. Cause: no element has data-velt-suggestion-target="${e.targetId}" and no registerTarget() call provided a getter. Fix: tag the element or register a getter at app boot. Docs: velt.dev/docs/suggestions/targets`),r(new Error("TARGET_NOT_REGISTERED"));return}if(!this.snapshotService.hasSnapshot(e.targetId)){let l=this.targetRegistry.getGetter(e.targetId);if(l){if(!this.snapshotService.captureFromGetter(e.targetId,l)){r(new Error("SNAPSHOT_FAILED"));return}}else{let S=this.targetRegistry.getFallbackValue(e.targetId);if(S.hasValue)this.snapshotService.captureValue(e.targetId,S.value);else{this.loggingService.warn(`[velt] commitSuggestion: target "${e.targetId}" requires registerTarget() for complex values. Cause: complex objects need a getter so the SDK can deep-clone the snapshot. Fix: call velt.getSuggestionElement().registerTarget("${e.targetId}", () => yourState.${e.targetId}) at app boot. Docs: velt.dev/docs/suggestions/getter`),r(new Error("NO_GETTER_FOR_COMPLEX"));return}}}let u=this.snapshotService.getSnapshot(e.targetId),f=e.newValue;if(O(u,f)){this.loggingService.warn(`[velt] commitSuggestion: no change detected for target "${e.targetId}". Cause: oldValue and newValue are deeply equal. Fix: only call commitSuggestion when the customer actually changed the value. Docs: velt.dev/docs/suggestions/edge-cases`),r(new Error("NO_CHANGE_TO_SUGGEST"));return}let g=new te;g.type="suggestion",g.suggestion={status:"pending",targetId:e.targetId,targetType:"custom",oldValue:u,newValue:f,summary:e.summary??null,driftDetected:!1,rejectReason:null,resolvedBy:null,resolvedAt:null},g.metadata=e.metadata??{};let b=fe(e.summary,e.summaryHtml,u,f),A=new re;if(A.commentText=b.commentText,A.commentHtml=b.commentHtml,g.comments=[A],!this.commentService){this.loggingService.catch('SuggestionActionsService.commitSuggestion: comment chunk not loaded \u2014 call Snippyly.preloadComment() first or include "comment" in featureAllowList.',new Error("comment chunk unavailable")),r(new Error("comment chunk not loaded"));return}this.commentService.addComment(void 0,void 0,void 0,void 0,!1,[],void 0,void 0,void 0,void 0,void 0,void 0,void 0,l=>{try{this.snapshotService.clearSnapshot(e.targetId),this.projectAndTrigger(d.SUGGESTION_CREATED,l.annotation),t({id:l.annotation.annotationId})}catch(S){this.loggingService.catch("Error in SuggestionActionsService commitSuggestion callback: ",S),r(S)}},void 0,void 0,g,void 0,void 0,!0,void 0,void 0,"internal",void 0)}catch(s){this.loggingService.catch("Error in SuggestionActionsService commitSuggestion: ",s),r(s)}})}getSuggestions(e){try{let t=this.commentService?.getCommentAnnotationsOnCurrentOrganizationAndDocument()??[],r=[];for(let s of t){if(!s.suggestion)continue;let a=this.projectAnnotationToSuggestion(s);a&&this.matchesFilter(a,e)&&r.push(a)}return r}catch(t){return this.loggingService.catch("Error in SuggestionActionsService getSuggestions: ",t),[]}}getSuggestions$(e){try{return this.serviceBook.observe(k).pipe(q(t=>t?t.getCommentAnnotationsOnCurrentOrganizationAndDocument$():$([]))).pipe(L(t=>{let r=[];for(let s of t??[]){if(!s.suggestion)continue;let a=this.projectAnnotationToSuggestion(s);a&&this.matchesFilter(a,e)&&r.push(a)}return r}),w(j))}catch(t){return this.loggingService.catch("Error in SuggestionActionsService getSuggestions$: ",t),new v}}getPendingSuggestion(e){try{if(!e)return null;let t=this.getSuggestions({targetId:e,status:"pending"});return t.length===0?null:t.sort((r,s)=>(s.createdAt??0)-(r.createdAt??0))[0]}catch(t){return this.loggingService.catch("Error in SuggestionActionsService getPendingSuggestion: ",t),null}}getPendingSuggestion$(e){try{return e?this.getSuggestions$({targetId:e,status:"pending"}).pipe(L(t=>t.length===0?null:t.sort((r,s)=>(s.createdAt??0)-(r.createdAt??0))[0]),w(j)):new v}catch(t){return this.loggingService.catch("Error in SuggestionActionsService getPendingSuggestion$: ",t),new v}}triggerAction(e,t){try{this.actionSubjects.has(e)||this.actionSubjects.set(e,new N),this.actionSubjects.get(e)?.next(t)}catch(r){this.loggingService.catch("Error in SuggestionActionsService triggerAction: ",r)}}onAction(e){try{return this.actionSubjects.has(e)||this.actionSubjects.set(e,new N),this.actionSubjects.get(e)?.asObservable()}catch(t){return this.loggingService.catch("Error in SuggestionActionsService onAction: ",t),$(null)}}projectAndTrigger(e,t){try{if(!t||!t.suggestion)return;let r=this.projectAnnotationToSuggestion(t);if(!r)return;let s=this.timestamp;switch(e){case d.SUGGESTION_CREATED:{let a={suggestion:r,timestamp:s};this.triggerAction(d.SUGGESTION_CREATED,a);break}case d.SUGGESTION_APPROVED:{let a={suggestion:r,timestamp:s};this.triggerAction(d.SUGGESTION_APPROVED,a);break}case d.SUGGESTION_REJECTED:{let a={suggestion:r,timestamp:s};this.triggerAction(d.SUGGESTION_REJECTED,a);break}case d.SUGGESTION_STALE:{let a={suggestion:r,timestamp:s};this.triggerAction(d.SUGGESTION_STALE,a);break}}}catch(r){this.loggingService.catch("Error in SuggestionActionsService projectAndTrigger: ",r)}}projectAnnotationToSuggestion(e){try{let t=e.suggestion;if(!t)return;let r={annotationId:e.annotationId,targetId:t.targetId,targetType:t.targetType,oldValue:t.oldValue,newValue:t.newValue,summary:t.summary,metadata:e.metadata??{},driftDetected:!!t.driftDetected,createdBy:e.from,createdAt:e.createdAt??0};switch(t.status){case"pending":return C(_({},r),{status:"pending",rejectReason:null,resolvedBy:null,resolvedAt:null});case"accepted":case"apply_failed":return C(_({},r),{status:t.status,rejectReason:null,resolvedBy:t.resolvedBy,resolvedAt:t.resolvedAt??this.timestamp});case"rejected":return C(_({},r),{status:"rejected",rejectReason:t.rejectReason??null,resolvedBy:t.resolvedBy,resolvedAt:t.resolvedAt??this.timestamp});case"stale":return C(_({},r),{status:"stale",rejectReason:null,resolvedBy:t.resolvedBy,resolvedAt:t.resolvedAt});default:return}}catch(t){this.loggingService.catch("Error in SuggestionActionsService projectAnnotationToSuggestion: ",t);return}}startObservingIfNeeded(){try{if(this.observingActive)return;this.observingActive=!0,this.targetRegistry.startObserving()}catch(e){this.loggingService.catch("Error in SuggestionActionsService startObservingIfNeeded: ",e)}}stopObservingIfNeeded(){try{if(!this.observingActive)return;this.observingActive=!1,this.targetRegistry.stopObserving()}catch(e){this.loggingService.catch("Error in SuggestionActionsService stopObservingIfNeeded: ",e)}}warnIfNoTaggedElements(){try{this.targetRegistry.countTaggedElements()===0&&this.loggingService.warn('[velt] No suggestable elements found on this page. Cause: no DOM elements have a data-velt-suggestion-target attribute. Fix: tag at least one element with data-velt-suggestion-target="your.id" before enabling suggestion mode. Docs: velt.dev/docs/suggestions/getting-started')}catch(e){this.loggingService.catch("Error in SuggestionActionsService warnIfNoTaggedElements: ",e)}}get timestamp(){return this.commonDbService.getServerTimestamp()}matchesFilter(e,t){try{return t?!(t.targetId&&e.targetId!==t.targetId||t.status&&!(Array.isArray(t.status)?t.status:[t.status]).includes(e.status)):!0}catch(r){return this.loggingService.catch("Error in SuggestionActionsService matchesFilter: ",r),!1}}};i.\u0275fac=function(t){return new(t||i)(h(E),h(I),h(D),h(ae),h(ie),h(ne))},i.\u0275prov=y({token:i,factory:i.\u0275fac,providedIn:"root"});let n=i;return n})();function ge(n){try{return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}catch{return""}}function m(n){try{if(n==null)return"";if(typeof n=="string")return n;if(typeof n=="object")try{return JSON.stringify(n)}catch{return String(n)}return String(n)}catch{return""}}function ce(n){try{if(n===null||typeof n!="object"||Array.isArray(n))return!1;let i=Object.getPrototypeOf(n);return i===Object.prototype||i===null}catch{return!1}}function ue(n,i){try{let o=n==null,e=i==null;if(o&&!e)return[{op:"add",newText:m(i)}];if(!o&&e)return[{op:"remove",oldText:m(n)}];if(ce(n)&&ce(i)){let t=n,r=i,s=[...Object.keys(t),...Object.keys(r).filter(c=>!(c in t))],a=[];for(let c of s){let u=c in t,f=c in r;u&&f?O(t[c],r[c])||a.push({op:"replace",oldText:`${c}: ${m(t[c])}`,newText:`${c}: ${m(r[c])}`}):u?a.push({op:"remove",oldText:`${c}: ${m(t[c])}`}):a.push({op:"add",newText:`${c}: ${m(r[c])}`})}if(a.length>0)return a}return[{op:"replace",oldText:m(n),newText:m(i)}]}catch{return[{op:"replace",oldText:m(n),newText:m(i)}]}}function de(n,i){try{return ue(n,i).map(o=>o.op==="add"?`Add: "${o.newText??""}"`:o.op==="remove"?`Remove: "${o.oldText??""}"`:`Replace: "${o.oldText??""}" with "${o.newText??""}"`).join(`
2
+ `)}catch{return'Replace: "" with ""'}}var F="color:#e0492b;font-style:italic;",M="color:#0f8a4d;font-style:italic;";function Se(n,i){try{let o=ue(n,i),e=t=>ge(t??"");if(o.length===1){let t=o[0];return t.op==="add"?`<div>Add:</div><div style="${M}">&ldquo;${e(t.newText)}&rdquo;</div>`:t.op==="remove"?`<div>Remove:</div><div style="${F}">&ldquo;${e(t.oldText)}&rdquo;</div>`:`<div>Replace:</div><div style="${F}">&ldquo;${e(t.oldText)}&rdquo;</div><div>with</div><div style="${M}">&ldquo;${e(t.newText)}&rdquo;</div>`}return o.map(t=>t.op==="add"?`<div>Add: <span style="${M}">&ldquo;${e(t.newText)}&rdquo;</span></div>`:t.op==="remove"?`<div>Remove: <span style="${F}">&ldquo;${e(t.oldText)}&rdquo;</span></div>`:`<div>Replace: <span style="${F}">&ldquo;${e(t.oldText)}&rdquo;</span> with <span style="${M}">&ldquo;${e(t.newText)}&rdquo;</span></div>`).join("")}catch{return"<div>Replace:</div><div>with</div>"}}function fe(n,i,o,e){try{let t=n||de(o,e),r;return i?r=i:n?r=`<p>${ge(n)}</p>`:r=Se(o,e),{commentText:t,commentHtml:r}}catch{return{commentText:"",commentHtml:""}}}export{Ae as a,Re as b,ae as c,Ve as d};