@veltdev/sdk-dev 6.0.45 → 6.0.48
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/{chunk-LWTRRGHL.js → chunk-2JUCNJVT.js} +1 -1
- package/{chunk-6K62XPB3.js → chunk-3ZXDIHWH.js} +1 -1
- package/{chunk-6E6YYWQ4.js → chunk-4TJLDLXL.js} +1 -1
- package/{chunk-QT57U43N.js → chunk-4X4U6BCZ.js} +1 -1
- package/{chunk-N65XETWG.js → chunk-5BRGARUT.js} +1 -1
- package/{chunk-7KXS2DSG.js → chunk-5LVKB6WR.js} +1 -1
- package/{chunk-BB7YQNOZ.js → chunk-73NZOSQ7.js} +1 -1
- package/{chunk-3A34IHUM.js → chunk-75AXPP7W.js} +1 -1
- package/{chunk-U52DCY3D.js → chunk-7PJNDZBS.js} +1 -1
- package/{chunk-SP25RLYB.js → chunk-CA2ADXMI.js} +1 -1
- package/{chunk-I3POWLVT.js → chunk-DIJZXNYM.js} +1 -1
- package/{chunk-I4SBC3EE.js → chunk-DODWXAOU.js} +1 -1
- package/{chunk-ZOA2LIG4.js → chunk-DXHPEQ4G.js} +1 -1
- package/{chunk-CU4CNZ3O.js → chunk-ERR5JJQ6.js} +1 -1
- package/chunk-GMOKXYBV.js +1 -0
- package/chunk-IVILSRE6.js +174 -0
- package/{chunk-R3KBXENN.js → chunk-J4BNFYDJ.js} +1 -1
- package/{chunk-NZWI6NA5.js → chunk-JAY6MWIC.js} +1 -1
- package/{chunk-EFWZWZAR.js → chunk-JXGKDJNP.js} +1 -1
- package/{chunk-3SLQQKJ6.js → chunk-KQ2IQQ7I.js} +1 -1
- package/{chunk-ACPZ3R7G.js → chunk-KTYDD32V.js} +1 -1
- package/{chunk-VYRSFZO2.js → chunk-M73LQ5VH.js} +1 -1
- package/chunk-MZC3HS3Y.js +193 -0
- package/{chunk-LCF6FZ5S.js → chunk-N64P7BW5.js} +1 -1
- package/{chunk-XY7DGMPO.js → chunk-O4M4L56J.js} +1 -1
- package/{chunk-CQ6HOISZ.js → chunk-R76BH34P.js} +1 -1
- package/{chunk-4GZCXZSN.js → chunk-TYZHQEQS.js} +1 -1
- package/{chunk-QNEPYZBW.js → chunk-UC4FKE64.js} +1 -1
- package/{chunk-OXMSOSYV.js → chunk-UPOFOTYZ.js} +1 -1
- package/{chunk-BEMVY5TX.js → chunk-VXEM7LQL.js} +1 -1
- package/{chunk-36A7ZG4L.js → chunk-WAKKXWFR.js} +1 -1
- package/{chunk-XUBFTUBO.js → chunk-XWVAXYOL.js} +1 -1
- package/{chunk-D5QZV6VO.js → chunk-YI7Q4N2F.js} +1 -1
- package/chunk-ZAVZABAE.js +1 -0
- package/{chunk-QBZHSLQ3.js → chunk-ZIVW7HYM.js} +1 -1
- package/{chunk-E47OMTOM.js → chunk-ZIWWEHWC.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 +1 -1
- package/velt-comment.js +17 -17
- package/velt-crdt.js +1 -1
- package/velt-cursor.js +1 -1
- package/velt-huddle.js +1 -1
- package/velt-live-state-sync.js +1 -1
- package/velt-notification.js +1 -1
- package/velt-portable.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 +1 -1
- 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 +1 -1
- package/velt.js +3 -3
- package/chunk-JV7MPTE5.js +0 -1
- package/chunk-QUMZPTVX.js +0 -174
- package/chunk-YKZV3FEU.js +0 -1
- package/chunk-ZMILEE6P.js +0 -193
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as s}from"./chunk-
|
|
1
|
+
import{g as s}from"./chunk-IVILSRE6.js";function r(n){return s(this,null,function*(){if(n.portableSession)return!!n.getIdentifyUser()?.isAnonymous;let e=yield n.readTokenClaims();return e?!!e.claims.user?.isAnonymous:null})}export{r as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as i,b as r,pj as e,qj as a}from"./chunk-
|
|
1
|
+
import{a as i,b as r,pj as e,qj as a}from"./chunk-IVILSRE6.js";var h=class{constructor(t){this.injector=t,this.hideAnalytics=!1}ha(t){try{this.hideAnalytics=t}catch{}}getService(t){return this.injector.get(t)}trackEvent(t,c={},n=!0){try{this.hideAnalytics||(c||(c={}),c=r(i({},c),{source:"external"}),this.getService(e).trackAuthenticatedEvent(t,c,n))}catch(s){this.getService(a).catch("Error in _trackEvent: ",s);return}}};export{h as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{C as F,sa as b,ta as f,u as R,ua as H,v as E,va as j,w as O,wa as N,x as I}from"./chunk-
|
|
1
|
+
import{C as F,sa as b,ta as f,u as R,ua as H,v as E,va as j,w as O,wa as N,x as I}from"./chunk-5LVKB6WR.js";import{D as v,E as l,Ia as k,K as h,Mb as A,Vd as L,Wa as C,Wd as s,Xa as B,_a as w,a as c,ab as M,b as _,ba as y,ca as S,da as p,fa as r,fb as D,k as g,na as x,zb as T}from"./chunk-IVILSRE6.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,2 +1,2 @@
|
|
|
1
|
-
import{f as P,j as ae}from"./chunk-7KXS2DSG.js";import{G as he,H as fe}from"./chunk-YKZV3FEU.js";import{He as A,Kg as D,M as O,V as Z,Xa as ne,Xe as ge,Ya as se,Ze as ue,_i as U,a as b,aa as ee,ac as oe,b as M,ba as x,c as J,ca as te,de as p,di as z,ea as S,g as Y,i as C,k as B,l as Q,oj as de,qd as ce,qj as R,r as $,sa as re,ui as le,v as k,wa as ie,xg as _}from"./chunk-QUMZPTVX.js";var V=class{_totalWeight=0;_averageItemSize;_defaultItemSize;constructor(n=50){this._defaultItemSize=n,this._averageItemSize=n}getAverageItemSize(){return this._averageItemSize}addSample(n,a){let e=this._totalWeight+n.end-n.start;if(e){let t=(a+this._averageItemSize*this._totalWeight)/e;t&&(this._averageItemSize=t,this._totalWeight=e)}}reset(){this._averageItemSize=this._defaultItemSize,this._totalWeight=0}},H=class{scrolledIndexChange=new C(()=>{});_viewport=null;_minBufferPx;_maxBufferPx;_averager;_lastScrollOffset;_lastRenderedContentSize;_lastRenderedContentOffset;_removalFailures=0;constructor(n,a,e=new V){this._minBufferPx=n,this._maxBufferPx=a,this._averager=e}attach(n){this._averager.reset(),this._viewport=n,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(n,a){if(a<n)throw Error("CDK virtual scroll: maxBufferPx must be greater than or equal to minBufferPx");this._minBufferPx=n,this._maxBufferPx=a}_updateRenderedContentAfterScroll(){let n=this._viewport,a=n.measureScrollOffset(),e=a-this._lastScrollOffset,t=Math.abs(e),r=n.getRenderedRange(),i=0;if(e<0){let l=r.start*this._averager.getAverageItemSize()-this._lastRenderedContentOffset;i=Math.round(l*Math.max(0,Math.min(1,t/(a+t)))),e=e-i,t=Math.abs(e)}let o=this._lastScrollOffset-this._lastRenderedContentOffset,c=this._lastRenderedContentOffset+this._lastRenderedContentSize-(this._lastScrollOffset+n.getViewportSize()),u=t+this._minBufferPx-(e<0?o:c);if(u>0)if(t>=n.getViewportSize())this._renderContentForCurrentOffset();else{let g=Math.max(0,Math.ceil((u-this._minBufferPx+this._maxBufferPx)/this._averager.getAverageItemSize())),l=(e<0?c:o)-this._minBufferPx+t,h=Math.floor(l/this._averager.getAverageItemSize()/(this._removalFailures+1)),f=Math.min(r.end-r.start,Math.max(0,h)),d=this._expandRange(r,e<0?g:0,e>0?g:0);e<0?d.end=Math.max(d.start+1,d.end-f):d.start=Math.min(d.end-1,d.start+f);let v,E;if(e<0){let y=n.measureRangeSize({start:d.end,end:r.end});y<=l?(v=this._lastRenderedContentOffset+this._lastRenderedContentSize-y,this._removalFailures=0):(d.end=r.end,v=this._lastRenderedContentOffset+this._lastRenderedContentSize,this._removalFailures++),E="to-end"}else{let y=n.measureRangeSize({start:r.start,end:d.start});y<=l?(v=this._lastRenderedContentOffset+y,this._removalFailures=0):(d.start=r.start,v=this._lastRenderedContentOffset,this._removalFailures++),E="to-start"}n.setRenderedRange(d),n.setRenderedContentOffset(v+i,E)}else i&&n.setRenderedContentOffset(this._lastRenderedContentOffset+i);this._lastScrollOffset=a}_checkRenderedContentSize(){let n=this._viewport;this._lastRenderedContentSize=n.measureRenderedContentSize(),this._averager.addSample(n.getRenderedRange(),this._lastRenderedContentSize),this._updateTotalContentSize(this._lastRenderedContentSize)}_checkRenderedContentOffset(){let n=this._viewport;this._lastRenderedContentOffset=n.getOffsetToRenderedContentStart()}_renderContentForCurrentOffset(){let n=this._viewport,a=n.measureScrollOffset();this._lastScrollOffset=a,this._removalFailures=0;let e=this._averager.getAverageItemSize(),t=Math.min(n.getDataLength()-1,Math.floor(a/e)),r=Math.ceil(this._maxBufferPx/e),i=this._expandRange(this._getVisibleRangeForIndex(t),r,r);n.setRenderedRange(i),n.setRenderedContentOffset(e*i.start)}_getVisibleRangeForIndex(n){let a=this._viewport,e={start:n,end:n+Math.ceil(a.getViewportSize()/this._averager.getAverageItemSize())},t=e.end-a.getDataLength();return t>0&&(e.start=Math.max(0,e.start-t)),e}_expandRange(n,a,e){let t=this._viewport,r=Math.max(0,n.start-a),i=Math.min(t.getDataLength(),n.end+e);return{start:r,end:i}}_updateTotalContentSize(n){let a=this._viewport,e=a.getRenderedRange(),t=n+(a.getDataLength()-(e.end-e.start))*this._averager.getAverageItemSize();a.setTotalContentSize(t)}};function Ae(s){return s._scrollStrategy}var Ue=(()=>{class s{get minBufferPx(){return this._minBufferPx}set minBufferPx(a){this._minBufferPx=P(a)}_minBufferPx=100;get maxBufferPx(){return this._maxBufferPx}set maxBufferPx(a){this._maxBufferPx=P(a)}_maxBufferPx=200;_scrollStrategy=new H(this.minBufferPx,this.maxBufferPx);ngOnChanges(){this._scrollStrategy.updateBufferSize(this.minBufferPx,this.maxBufferPx)}static \u0275fac=function(e){return new(e||s)};static \u0275dir=se({type:s,selectors:[["cdk-virtual-scroll-viewport","autosize",""]],inputs:{minBufferPx:"minBufferPx",maxBufferPx:"maxBufferPx"},features:[oe([{provide:ae,useFactory:Ae,deps:[ee(()=>s)]}]),ie]})}return s})(),Ve=(()=>{class s{static \u0275fac=function(e){return new(e||s)};static \u0275mod=ne({type:s});static \u0275inj=te({})}return s})();var xe=["removed","added","contextBefore","contextAfter","occurrence"];function q(s){if(s==null)return{value:null,reason:null,droppedKeys:[]};let n=typeof s=="object"?Object.getPrototypeOf(s):void 0;if(n!==Object.prototype&&n!==null)return{value:null,reason:"it is not a plain object",droppedKeys:[]};let a=s;for(let i of["removed","added","contextBefore","contextAfter"])if(typeof a[i]!="string")return{value:null,reason:`"${i}" must be a string`,droppedKeys:[]};let e=a.occurrence;if(typeof e!="number"||!Number.isInteger(e)||e<1)return{value:null,reason:'"occurrence" must be an integer of 1 or more',droppedKeys:[]};let t={removed:a.removed,added:a.added,contextBefore:a.contextBefore,contextAfter:a.contextAfter,occurrence:e};if(t.removed.length+t.added.length>8192)return{value:null,reason:'"removed" and "added" together are longer than 8192 characters',droppedKeys:[]};let r=Object.keys(a).filter(i=>!xe.includes(i));return{value:t,reason:null,droppedKeys:r}}function _e(s,n,a){if(!n)return 0;let e=0,t=0;for(;;){let r=s.indexOf(n,t);if(r<0||r>=a)return e;e++,t=r+1}}var Re=s=>s>=55296&&s<=56319,we=s=>s>=56320&&s<=57343,I=(s,n)=>n>0&&n<s.length&&Re(s.charCodeAt(n-1))&&we(s.charCodeAt(n)),Oe=/[\p{L}\p{N}_]/u,w=s=>!!s&&Oe.test(s),m=s=>s.replace(/\u00a0/g," ");function Se(s,n){let a=m(s),e=m(n),t=Math.min(a.length,e.length),r=0;for(;r<t&&a.charCodeAt(r)===e.charCodeAt(r);)r++;let i=0;for(;i<t-r&&a.charCodeAt(a.length-1-i)===e.charCodeAt(e.length-1-i);)i++;let o=a.length-r-i,c=e.length-r-i;if(o>0&&c>0){for(;r>0&&w(a[r-1])&&(w(a[r])||w(e[r]));)r--;for(;i<t-r&&a.charCodeAt(a.length-1-i)===e.charCodeAt(e.length-1-i);)i++;for(;i>0&&w(a[a.length-i])&&(w(a[a.length-i-1])||w(e[e.length-i-1]));)i--}else if(o+c>0){let u=o>0?a:e,g=o+c,l=f=>w(u[f])&&!w(u[f-1]),h=r;for(let f=r;f>0&&u[f-1]===u[f+g-1];)f--,l(f)&&(h=f);!l(r)&&h!==r&&(i+=r-h,r=h)}for(;r>0&&(I(a,r)||I(e,r));)r--;for(;i>0&&(I(a,a.length-i)||I(e,e.length-i));)i--;return{prefix:r,suffix:i}}function N(s,n,a,e){if(n<0||a<n||a>s.length)return null;let t=s.slice(n,a);if(m(t)===m(e)||t.length+e.length>8192)return null;let r=Math.max(0,n-32);I(s,r)&&r++;let i=Math.min(s.length,a+32);I(s,i)&&i--;let o=s.slice(r,n),c=s.slice(a,i),u=o+t+c,g=1+_e(s,u,r);return{removed:t,added:e,contextBefore:o,contextAfter:c,occurrence:g}}function me(s,n,a){return m(n).includes(m(s.contextBefore+s.removed+s.contextAfter))&&m(a).includes(m(s.contextBefore+s.added+s.contextAfter))}function G(s){return{removed:m(s.removed),added:m(s.added),contextBefore:m(s.contextBefore),contextAfter:m(s.contextAfter),occurrence:s.occurrence}}function ve(s,n){if(m(s)===m(n))return null;let{prefix:a,suffix:e}=Se(s,n);return N(s,a,s.length-e,n.slice(a,n.length-e))}function qe(s,n){if(m(s)===m(n))return null;let{prefix:a,suffix:e}=Se(s,n);return{removed:s.slice(a,s.length-e),start:a,end:n.length-e}}var j=(()=>{let n=class n{constructor(e){this.loggingService=e,this.enabledSignal=re(!1),this.onTargetEditStart=null,this.onTargetEditCommit=null,this.autoCommit=!0;try{this.enabled$=ce(this.enabledSignal).pipe(O())}catch(t){this.loggingService.catch("Error in SuggestionModeService constructor: ",t),this.enabled$=new C}}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}}};n.\u0275fac=function(t){return new(t||n)(S(R))},n.\u0275prov=x({token:n,factory:n.\u0275fac,providedIn:"root"});let s=n;return s})();var L=(()=>{let n=class n{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(i){return _()&&this.loggingService.catch(`[velt] Suggestion target "${e}" getter threw: `,i),!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(i){return _()&&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.`,i),!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)}}};n.\u0275fac=function(t){return new(t||n)(S(R))},n.\u0275prov=x({token:n,factory:n.\u0275fac,providedIn:"root"});let s=n;return s})();var Ee=(()=>{let n=class n{constructor(e,t,r){this.loggingService=e,this.modeService=t,this.snapshotService=r,this.registry=new Map,this.warnedUnstableIds=new Set,this.latestEdit=new Map,this.editSeq=0,this.actionsService=null,this.typedEditSource=null}registerTarget(e,t,r){try{if(!e||typeof t!="function")return;this.warnIfUnstableId(e);let i=this.registry.get(e)??{};i.getter=t,i.setter=typeof r?.setter=="function"?r.setter:void 0,i.restoreOnCommit=r?.restoreOnCommit,this.registry.set(e,i)}catch(i){this.loggingService.catch("Error in SuggestionTargetRegistryService registerTarget: ",i)}}unregisterTarget(e){try{let t=this.registry.get(e);if(!t)return;delete t.getter,delete t.setter,delete t.restoreOnCommit,this.latestEdit.delete(e),t.node||this.registry.delete(e)}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService unregisterTarget: ",t)}}getSetter(e){try{return this.registry.get(e)?.setter}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService getSetter: ",t);return}}callSetter(e,t,r){return this.runSetter(e,t,r)!==null}runSetter(e,t,r){let i=this.registry.get(e)?.setter;if(!i)return null;let o=c=>this.loggingService.catch("Error in SuggestionTargetRegistryService: the target setter threw",c,{targetId:e,reason:r.reason});try{let c=i(t,b({targetId:e},r));if(c&&typeof c.then=="function")return Promise.resolve(c).catch(o)}catch(c){o(c)}return Promise.resolve()}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 i=r[0],o=this.registry.get(e)??{};return o.node=i,this.registry.set(e,o),i}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService getNode: ",t);return}}setTypedEditSource(e){this.typedEditSource=e}getTypedEdits(e){try{return this.typedEditSource?.(e)??[]}catch(t){return this.loggingService.catch("Error in SuggestionTargetRegistryService getTypedEdits: ",t),[]}}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(`[${A.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:[A.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.latestEdit.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),i={targetId:t.targetId,oldValue:r,newValue:r,element:t.element},o=this.modeService.getOnTargetEditStart();if(o)try{o(i)}catch(c){this.loggingService.catch("Error in SuggestionTargetRegistryService onTargetEditStart customer callback threw: ",c)}this.actionsService?.triggerAction(p.TARGET_EDIT_START,{details:i,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),i=this.readElementValue(e,t);if(D(r,i))return;let o=this.splitTypedEdits(t,r,i),c=this.restoreWhenCommitted(e,r,o?o.length:1);if(o){o.forEach((u,g)=>this.commitEdit(e,t,r,u.newValue,u.textChange,!0,c?.(g)));return}this.commitEdit(e,t,r,i,void 0,!1,c?.(0))}catch(r){this.loggingService.catch("Error in SuggestionTargetRegistryService processCommit: ",r)}}restoreWhenCommitted(e,t,r){let i=this.registry.get(e);if(!i?.setter||i.restoreOnCommit===!1){this.latestEdit.delete(e);return}let o=++this.editSeq;this.latestEdit.set(e,o);let c=new Set;return u=>g=>{try{if(!g||c.size===r||(c.add(u),c.size<r||this.latestEdit.get(e)!==o))return;this.latestEdit.delete(e);let l=this.runSetter(e,t,{reason:"restore"}),h=()=>{this.findTaggedAncestor(document.activeElement)?.targetId===e&&this.snapshotService.captureValue(e,t)};h(),l?.then(h,()=>{})}catch(l){this.loggingService.catch("Error in SuggestionTargetRegistryService restoreWhenCommitted: ",l)}}}splitTypedEdits(e,t,r){try{if(typeof t!="string"||typeof r!="string")return null;let i=this.getTypedEdits(e);if(i.length<2)return null;let o=g=>g.replace(/\u00a0/g," ");if(i.some(g=>o(g.base)!==o(t)))return null;let c=t;for(let g of[...i].sort((l,h)=>h.start-l.start))c=c.slice(0,g.start)+g.added+c.slice(g.end);if(o(c)!==o(r))return null;let u=[];for(let g of i){let l=N(t,g.start,g.end,g.added);if(!l)return null;u.push({newValue:t.slice(0,g.start)+o(g.added)+t.slice(g.end),textChange:G(l)})}return u}catch(i){return this.loggingService.catch("Error in SuggestionTargetRegistryService splitTypedEdits: ",i),null}}commitEdit(e,t,r,i,o,c=!1,u){try{let g={targetId:e,oldValue:r,newValue:i,element:t},l=this.modeService.getOnTargetEditCommit(),h=null;if(l){let d=null;try{d=l(g)}catch(v){this.loggingService.catch("Error in SuggestionTargetRegistryService onTargetEditCommit customer callback threw: ",v)}d&&(h=this.invokeAutoCommit({targetId:e,newValue:i,snapshot:c?{value:r}:void 0,summary:d.summary,summaryHtml:d.summaryHtml,metadata:d.metadata,textChange:d.textChange??o}),u&&h.then(u))}else this.modeService.isAutoCommitEnabled()&&(h=this.invokeAutoCommit({targetId:e,newValue:i,textChange:o,snapshot:c?{value:r}:void 0}),u&&h.then(u));let f=d=>Y(this,null,function*(){if(h&&(yield h))return null;let v=this.invokeAutoCommit({targetId:e,newValue:i,snapshot:c?{value:r}:void 0,summary:d?.summary,summaryHtml:d?.summaryHtml,metadata:d?.metadata,textChange:d?.textChange??o});return u&&v.then(u),v});this.actionsService?.triggerAction(p.TARGET_EDIT_COMMIT,{details:g,commitSuggestion:f,timestamp:Date.now()})}catch(g){this.loggingService.catch("Error in SuggestionTargetRegistryService commitEdit: ",g)}}invokeAutoCommit(r){var i=r,{snapshot:e}=i,t=J(i,["snapshot"]);try{return e&&this.snapshotService.captureValue(t.targetId,e.value),this.actionsService?this.actionsService.commitSuggestion(t).catch(o=>(_()&&this.loggingService.catch(`[velt] auto-commit for "${t.targetId}" rejected: `,o),null)):(_()&&this.loggingService.log("[velt] auto-commit skipped: actions service not wired. SuggestionActionsService constructor should call registry.setActionsService(this)."),Promise.resolve(null))}catch(o){return this.loggingService.catch("Error in SuggestionTargetRegistryService invokeAutoCommit: ",o),Promise.resolve(null)}}captureSnapshotForTarget(e,t){try{let r=this.registry.get(e);if(r?.getter){this.snapshotService.captureFromGetter(e,r.getter);return}let i=this.readElementValue(e,t);this.snapshotService.captureValue(e,i)}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 i=(t.type||"").toLowerCase();return i==="checkbox"||i==="radio"?t.checked:i==="number"||i==="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(`[${A.ATTRIBUTES.VELT_SUGGESTION_TARGET}]`);if(!t)return null;let r=t.getAttribute(A.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(`[${A.ATTRIBUTES.VELT_SUGGESTION_TARGET}="${t}"]`))}catch{return[]}}scanAndRefresh(e){try{e.querySelectorAll(`[${A.ATTRIBUTES.VELT_SUGGESTION_TARGET}]`).forEach(r=>{let i=r.getAttribute(A.ATTRIBUTES.VELT_SUGGESTION_TARGET);if(!i)return;let o=this.registry.get(i)??{};(!o.node||!o.node.isConnected)&&(o.node=r,this.registry.set(i,o))})}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService scanAndRefresh: ",t)}}warnIfUnstableId(e){try{if(!_()||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(!_())return;this.loggingService.catch(`[velt] Duplicate target id "${e}" \u2014 ${t} elements share this id. Cause: the same ${A.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)}}};n.\u0275fac=function(t){return new(t||n)(S(R),S(j),S(L))},n.\u0275prov=x({token:n,factory:n.\u0275fac,providedIn:"root"});let s=n;return s})();var Me=new Set(["apiKey","documentId","clientDocumentId","organizationId","clientOrganizationId","folderId","veltFolderId","parentVeltFolderId","documentMetadata","sdkVersion","pageInfo"]),St=(()=>{let n=class n{constructor(e,t,r,i,o,c,u){this.loggingService=e,this.modeService=t,this.snapshotService=r,this.targetRegistry=i,this.serviceBook=o,this.commonDbService=c,this.docService=u,this.actionSubjects=new Map,this.appliedValues=new Map,this.observingActive=!1,this.commentService=null,this.inlineSuggestionsEnabled$=new Q(!0);try{this.targetRegistry.setActionsService(this),this.serviceBook.observe(U).subscribe(g=>{this.commentService=g})}catch(g){this.loggingService.catch("Error in SuggestionActionsService constructor: ",g)}}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}}enableInlineSuggestions(){try{this.inlineSuggestionsEnabled$.value||this.inlineSuggestionsEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in SuggestionActionsService enableInlineSuggestions: ",e)}}disableInlineSuggestions(){try{this.inlineSuggestionsEnabled$.value&&this.inlineSuggestionsEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in SuggestionActionsService disableInlineSuggestions: ",e)}}isInlineSuggestionsEnabled$(){return this.inlineSuggestionsEnabled$.pipe(O())}isSuggestionModeEnabled$(){try{return this.modeService.enabled$}catch(e){return this.loggingService.catch("Error in SuggestionActionsService isSuggestionModeEnabled$: ",e),new C}}registerTarget(e){try{if(!e?.targetId||typeof e?.getter!="function")return;this.targetRegistry.registerTarget(e.targetId,e.getter,{setter:e.setter,restoreOnCommit:e.restoreOnCommit})}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 E=this.targetRegistry.getGetter(e.targetId);if(E){if(!this.snapshotService.captureFromGetter(e.targetId,E)){r(new Error("SNAPSHOT_FAILED"));return}}else{let y=this.targetRegistry.getFallbackValue(e.targetId);if(y.hasValue)this.snapshotService.captureValue(e.targetId,y.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),g=e.newValue;if(D(u,g)){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 l=new ge;l.type="suggestion",l.suggestion={status:"pending",targetId:e.targetId,targetType:"custom",oldValue:u,newValue:g,summary:e.summary??null,driftDetected:!1,rejectReason:null,resolvedBy:null,resolvedAt:null},this.setCustomerMetadata(l.suggestion,e.metadata),this.setTextChange(l.suggestion,e.targetId,e.textChange,u,g);let h=this.resolveSuggestionLocation(e),f=this.resolveSuggestionContext(e),d=Fe(e.summary,e.summaryHtml,u,g),v=new ue;if(v.commentText=d.commentText,v.commentHtml=d.commentHtml,l.comments=[v],!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,h?.location,void 0,void 0,void 0,void 0,void 0,E=>{try{this.snapshotService.clearSnapshot(e.targetId),this.projectAndTrigger(p.SUGGESTION_CREATED,E.annotation),t({id:E.annotation.annotationId})}catch(y){this.loggingService.catch("Error in SuggestionActionsService commitSuggestion callback: ",y),r(y)}},void 0,void 0,l,h?.locationId,f,!0,void 0,void 0,"internal",h?.locationId!==void 0?!0:void 0)}catch(i){this.loggingService.catch("Error in SuggestionActionsService commitSuggestion: ",i),r(i)}})}getSuggestions(e){try{let t=this.commentService?.getCommentAnnotationsOnCurrentOrganizationAndDocument()??[],r=[];for(let i of t){if(!i.suggestion)continue;let o=this.projectAnnotationToSuggestion(i);o&&this.matchesFilter(o,e)&&r.push(o)}return r}catch(t){return this.loggingService.catch("Error in SuggestionActionsService getSuggestions: ",t),[]}}getSuggestions$(e){try{return this.serviceBook.observe(U).pipe(Z(t=>t?t.getCommentAnnotationsOnCurrentOrganizationAndDocument$():$([]))).pipe(k(t=>{let r=[];for(let i of t??[]){if(!i.suggestion)continue;let o=this.projectAnnotationToSuggestion(i);o&&this.matchesFilter(o,e)&&r.push(o)}return r}),O(z))}catch(t){return this.loggingService.catch("Error in SuggestionActionsService getSuggestions$: ",t),new C}}getPendingSuggestion(e){try{if(!e)return null;let t=this.getSuggestions({targetId:e,status:"pending"});return t.length===0?null:t.sort((r,i)=>(i.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(k(t=>t.length===0?null:t.sort((r,i)=>(i.createdAt??0)-(r.createdAt??0))[0]),O(z)):new C}catch(t){return this.loggingService.catch("Error in SuggestionActionsService getPendingSuggestion$: ",t),new C}}triggerAction(e,t){try{this.actionSubjects.has(e)||this.actionSubjects.set(e,new B),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 B),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 i=this.timestamp;switch(e){case p.SUGGESTION_CREATED:{let o={suggestion:r,timestamp:i};this.triggerAction(p.SUGGESTION_CREATED,o);break}case p.SUGGESTION_APPROVED:{let o={suggestion:r,timestamp:i};this.triggerAction(p.SUGGESTION_APPROVED,o);break}case p.SUGGESTION_REJECTED:{let o={suggestion:r,timestamp:i};this.triggerAction(p.SUGGESTION_REJECTED,o);break}case p.SUGGESTION_STALE:{let o={suggestion:r,timestamp:i};this.triggerAction(p.SUGGESTION_STALE,o);break}}}catch(r){this.loggingService.catch("Error in SuggestionActionsService projectAndTrigger: ",r)}}resolveSuggestionContext(e){try{let t=e.context;if(t==null)return;if(typeof t!="object"||Array.isArray(t)){this.loggingService.warn('[velt] commitSuggestion: context was not saved. Cause: it is not an object. Fix: pass an object, e.g. { textEditorConfig: { editorId: "<editor id>" } }. Docs: velt.dev/docs/suggestions');return}let r;try{r=JSON.parse(JSON.stringify(t))}catch{this.loggingService.warn("[velt] commitSuggestion: context was not saved. Cause: it cannot be stored as JSON (e.g. it refers to itself). Fix: pass plain JSON data. Docs: velt.dev/docs/suggestions");return}if(r===null||typeof r!="object"||Array.isArray(r)){this.loggingService.warn('[velt] commitSuggestion: context was not saved. Cause: it is not stored as an object (e.g. a Date). Fix: pass an object, e.g. { textEditorConfig: { editorId: "<editor id>" } }. Docs: velt.dev/docs/suggestions');return}let i=De.filter(o=>o in r);return i.length&&(i.forEach(o=>delete r[o]),this.loggingService.warn(`[velt] commitSuggestion: context keys ${i.join(", ")} were not saved. Cause: the SDK sets them. Fix: leave them out (use \`access\` for context access). Docs: velt.dev/docs/suggestions`)),r}catch(t){this.loggingService.catch("Error in SuggestionActionsService resolveSuggestionContext: ",t);return}}resolveSuggestionLocation(e){try{let t=null,r=e.location;if(r!=null){let o=typeof r=="object"&&!Array.isArray(r)?r.id:void 0;typeof o=="string"&&o.trim()?t=r:this.loggingService.warn('[velt] commitSuggestion: location was not used. Cause: it is not an object with a non-empty string id. Fix: pass { id: "<location id>" }, or omit it to use the location around the target element. Docs: velt.dev/docs/suggestions')}if(!t){let o=this.targetRegistry.getNode(e.targetId);t=o?this.docService.getAdditionLocationFromElement(o):null}if(!t?.id)return null;let i=this.docService.getLocationMetadataByClientLocationId(t.id);return i?.location?{location:i.location,locationId:i.locationId}:{location:t}}catch(t){return this.loggingService.catch("Error in SuggestionActionsService resolveSuggestionLocation: ",t),null}}setCustomerMetadata(e,t){let r=this.cloneCustomerMetadata(t);r&&(e.metadata=r)}setTextChange(e,t,r,i,o){try{let c=q(r);c.reason?this.loggingService.warn(`[velt] commitSuggestion: textChange was not saved. Cause: ${c.reason}. Fix: pass { removed, added, contextBefore, contextAfter, occurrence }. Docs: velt.dev/docs/suggestions`):c.droppedKeys.length&&this.loggingService.warn(`[velt] commitSuggestion: textChange keys ${c.droppedKeys.join(", ")} were not saved. Cause: they are not textChange keys. Fix: put your own data in metadata. Docs: velt.dev/docs/suggestions`);let u=c.value??this.computeTextChange(t,i,o);u&&(e.textChange=u)}catch(c){this.loggingService.catch("Error in SuggestionActionsService setTextChange: ",c)}}computeTextChange(e,t,r){if(typeof t!="string"||typeof r!="string")return null;let i=this.targetRegistry.getNode(e);if(!(i instanceof HTMLElement)||!i.isConnected||!i.isContentEditable||i.closest(".ProseMirror"))return null;for(let c of this.targetRegistry.getTypedEdits(i)??[]){let u=N(c.base,c.start,c.end,c.added);if(u&&me(u,t,r))return G(u)}let o=ve(t,r);return o&&G(o)}getTextChange(e){return q(e.textChange).value}cloneCustomerMetadata(e){if(e==null)return;let t=typeof e=="object"?Object.getPrototypeOf(e):void 0;if(t!==Object.prototype&&t!==null){this.loggingService.warn('[velt] commitSuggestion: metadata was not saved. Cause: it is not a plain object. Fix: pass a plain JSON object, e.g. { kind: "replacement" }. Docs: velt.dev/docs/suggestions');return}try{let r=le(e);return r&&typeof r=="object"&&!Array.isArray(r)?r:void 0}catch{this.loggingService.warn("[velt] commitSuggestion: metadata was not saved. Cause: it cannot be serialized as JSON (BigInt or a circular reference). Fix: pass JSON-safe values only. Docs: velt.dev/docs/suggestions");return}}getCustomerMetadata(e){let t=e.suggestion?.metadata;if(t&&typeof t=="object"&&!Array.isArray(t))return b({},t);let r={},i=e.metadata;if(i&&typeof i=="object")for(let o of Object.keys(i))Me.has(o)||Object.defineProperty(r,o,{value:i[o],enumerable:!0,writable:!0,configurable:!0});return r}setAppliedValues(e,t){this.appliedValues.set(e,t)}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:this.getCustomerMetadata(e),textChange:this.getTextChange(t),driftDetected:!!t.driftDetected,createdBy:e.from,createdAt:e.createdAt??0};switch(t.status){case"pending":return M(b({},r),{status:"pending",rejectReason:null,resolvedBy:null,resolvedAt:null});case"accepted":case"apply_failed":{let i=t.status==="accepted"?this.appliedValues.get(e.annotationId):void 0;return M(b(b({},r),i??{}),{status:t.status,rejectReason:null,resolvedBy:t.resolvedBy,resolvedAt:t.resolvedAt??this.timestamp})}case"rejected":return M(b({},r),{status:"rejected",rejectReason:t.rejectReason??null,resolvedBy:t.resolvedBy,resolvedAt:t.resolvedAt??this.timestamp});case"stale":return M(b({},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}}};n.\u0275fac=function(t){return new(t||n)(S(R),S(j),S(L),S(Ee),S(de),S(he),S(fe))},n.\u0275prov=x({token:n,factory:n.\u0275fac,providedIn:"root"});let s=n;return s})();function be(s){try{return s.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}catch{return""}}function T(s){try{if(s==null)return"";if(typeof s=="string")return s;if(typeof s=="object")try{return JSON.stringify(s)}catch{return String(s)}return String(s)}catch{return""}}var De=["accessFields","_setAccessFields","_replaceAccessFields","_setVisibilityConfig"];function Te(s){try{if(s===null||typeof s!="object"||Array.isArray(s))return!1;let n=Object.getPrototypeOf(s);return n===Object.prototype||n===null}catch{return!1}}function Ce(s,n){try{let a=s==null,e=n==null;if(a&&!e)return[{op:"add",newText:T(n)}];if(!a&&e)return[{op:"remove",oldText:T(s)}];if(Te(s)&&Te(n)){let t=s,r=n,i=[...Object.keys(t),...Object.keys(r).filter(c=>!(c in t))],o=[];for(let c of i){let u=c in t,g=c in r;u&&g?D(t[c],r[c])||o.push({op:"replace",oldText:`${c}: ${T(t[c])}`,newText:`${c}: ${T(r[c])}`}):u?o.push({op:"remove",oldText:`${c}: ${T(t[c])}`}):o.push({op:"add",newText:`${c}: ${T(r[c])}`})}if(o.length>0)return o}return[{op:"replace",oldText:T(s),newText:T(n)}]}catch{return[{op:"replace",oldText:T(s),newText:T(n)}]}}function Ne(s,n){try{return Ce(s,n).map(a=>a.op==="add"?`Add: "${a.newText??""}"`:a.op==="remove"?`Remove: "${a.oldText??""}"`:`Replace: "${a.oldText??""}" with "${a.newText??""}"`).join(`
|
|
1
|
+
import{f as P,j as ae}from"./chunk-5LVKB6WR.js";import{G as he,H as fe}from"./chunk-ZAVZABAE.js";import{He as A,Kg as D,M as O,V as Z,Xa as ne,Xe as ge,Ya as se,Ze as ue,_i as U,a as b,aa as ee,ac as oe,b as M,ba as x,c as J,ca as te,de as p,di as z,ea as S,g as Y,i as C,k as B,l as Q,oj as de,qd as ce,qj as R,r as $,sa as re,ui as le,v as k,wa as ie,xg as _}from"./chunk-IVILSRE6.js";var V=class{_totalWeight=0;_averageItemSize;_defaultItemSize;constructor(n=50){this._defaultItemSize=n,this._averageItemSize=n}getAverageItemSize(){return this._averageItemSize}addSample(n,a){let e=this._totalWeight+n.end-n.start;if(e){let t=(a+this._averageItemSize*this._totalWeight)/e;t&&(this._averageItemSize=t,this._totalWeight=e)}}reset(){this._averageItemSize=this._defaultItemSize,this._totalWeight=0}},H=class{scrolledIndexChange=new C(()=>{});_viewport=null;_minBufferPx;_maxBufferPx;_averager;_lastScrollOffset;_lastRenderedContentSize;_lastRenderedContentOffset;_removalFailures=0;constructor(n,a,e=new V){this._minBufferPx=n,this._maxBufferPx=a,this._averager=e}attach(n){this._averager.reset(),this._viewport=n,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(n,a){if(a<n)throw Error("CDK virtual scroll: maxBufferPx must be greater than or equal to minBufferPx");this._minBufferPx=n,this._maxBufferPx=a}_updateRenderedContentAfterScroll(){let n=this._viewport,a=n.measureScrollOffset(),e=a-this._lastScrollOffset,t=Math.abs(e),r=n.getRenderedRange(),i=0;if(e<0){let l=r.start*this._averager.getAverageItemSize()-this._lastRenderedContentOffset;i=Math.round(l*Math.max(0,Math.min(1,t/(a+t)))),e=e-i,t=Math.abs(e)}let o=this._lastScrollOffset-this._lastRenderedContentOffset,c=this._lastRenderedContentOffset+this._lastRenderedContentSize-(this._lastScrollOffset+n.getViewportSize()),u=t+this._minBufferPx-(e<0?o:c);if(u>0)if(t>=n.getViewportSize())this._renderContentForCurrentOffset();else{let g=Math.max(0,Math.ceil((u-this._minBufferPx+this._maxBufferPx)/this._averager.getAverageItemSize())),l=(e<0?c:o)-this._minBufferPx+t,h=Math.floor(l/this._averager.getAverageItemSize()/(this._removalFailures+1)),f=Math.min(r.end-r.start,Math.max(0,h)),d=this._expandRange(r,e<0?g:0,e>0?g:0);e<0?d.end=Math.max(d.start+1,d.end-f):d.start=Math.min(d.end-1,d.start+f);let v,E;if(e<0){let y=n.measureRangeSize({start:d.end,end:r.end});y<=l?(v=this._lastRenderedContentOffset+this._lastRenderedContentSize-y,this._removalFailures=0):(d.end=r.end,v=this._lastRenderedContentOffset+this._lastRenderedContentSize,this._removalFailures++),E="to-end"}else{let y=n.measureRangeSize({start:r.start,end:d.start});y<=l?(v=this._lastRenderedContentOffset+y,this._removalFailures=0):(d.start=r.start,v=this._lastRenderedContentOffset,this._removalFailures++),E="to-start"}n.setRenderedRange(d),n.setRenderedContentOffset(v+i,E)}else i&&n.setRenderedContentOffset(this._lastRenderedContentOffset+i);this._lastScrollOffset=a}_checkRenderedContentSize(){let n=this._viewport;this._lastRenderedContentSize=n.measureRenderedContentSize(),this._averager.addSample(n.getRenderedRange(),this._lastRenderedContentSize),this._updateTotalContentSize(this._lastRenderedContentSize)}_checkRenderedContentOffset(){let n=this._viewport;this._lastRenderedContentOffset=n.getOffsetToRenderedContentStart()}_renderContentForCurrentOffset(){let n=this._viewport,a=n.measureScrollOffset();this._lastScrollOffset=a,this._removalFailures=0;let e=this._averager.getAverageItemSize(),t=Math.min(n.getDataLength()-1,Math.floor(a/e)),r=Math.ceil(this._maxBufferPx/e),i=this._expandRange(this._getVisibleRangeForIndex(t),r,r);n.setRenderedRange(i),n.setRenderedContentOffset(e*i.start)}_getVisibleRangeForIndex(n){let a=this._viewport,e={start:n,end:n+Math.ceil(a.getViewportSize()/this._averager.getAverageItemSize())},t=e.end-a.getDataLength();return t>0&&(e.start=Math.max(0,e.start-t)),e}_expandRange(n,a,e){let t=this._viewport,r=Math.max(0,n.start-a),i=Math.min(t.getDataLength(),n.end+e);return{start:r,end:i}}_updateTotalContentSize(n){let a=this._viewport,e=a.getRenderedRange(),t=n+(a.getDataLength()-(e.end-e.start))*this._averager.getAverageItemSize();a.setTotalContentSize(t)}};function Ae(s){return s._scrollStrategy}var Ue=(()=>{class s{get minBufferPx(){return this._minBufferPx}set minBufferPx(a){this._minBufferPx=P(a)}_minBufferPx=100;get maxBufferPx(){return this._maxBufferPx}set maxBufferPx(a){this._maxBufferPx=P(a)}_maxBufferPx=200;_scrollStrategy=new H(this.minBufferPx,this.maxBufferPx);ngOnChanges(){this._scrollStrategy.updateBufferSize(this.minBufferPx,this.maxBufferPx)}static \u0275fac=function(e){return new(e||s)};static \u0275dir=se({type:s,selectors:[["cdk-virtual-scroll-viewport","autosize",""]],inputs:{minBufferPx:"minBufferPx",maxBufferPx:"maxBufferPx"},features:[oe([{provide:ae,useFactory:Ae,deps:[ee(()=>s)]}]),ie]})}return s})(),Ve=(()=>{class s{static \u0275fac=function(e){return new(e||s)};static \u0275mod=ne({type:s});static \u0275inj=te({})}return s})();var xe=["removed","added","contextBefore","contextAfter","occurrence"];function q(s){if(s==null)return{value:null,reason:null,droppedKeys:[]};let n=typeof s=="object"?Object.getPrototypeOf(s):void 0;if(n!==Object.prototype&&n!==null)return{value:null,reason:"it is not a plain object",droppedKeys:[]};let a=s;for(let i of["removed","added","contextBefore","contextAfter"])if(typeof a[i]!="string")return{value:null,reason:`"${i}" must be a string`,droppedKeys:[]};let e=a.occurrence;if(typeof e!="number"||!Number.isInteger(e)||e<1)return{value:null,reason:'"occurrence" must be an integer of 1 or more',droppedKeys:[]};let t={removed:a.removed,added:a.added,contextBefore:a.contextBefore,contextAfter:a.contextAfter,occurrence:e};if(t.removed.length+t.added.length>8192)return{value:null,reason:'"removed" and "added" together are longer than 8192 characters',droppedKeys:[]};let r=Object.keys(a).filter(i=>!xe.includes(i));return{value:t,reason:null,droppedKeys:r}}function _e(s,n,a){if(!n)return 0;let e=0,t=0;for(;;){let r=s.indexOf(n,t);if(r<0||r>=a)return e;e++,t=r+1}}var Re=s=>s>=55296&&s<=56319,we=s=>s>=56320&&s<=57343,I=(s,n)=>n>0&&n<s.length&&Re(s.charCodeAt(n-1))&&we(s.charCodeAt(n)),Oe=/[\p{L}\p{N}_]/u,w=s=>!!s&&Oe.test(s),m=s=>s.replace(/\u00a0/g," ");function Se(s,n){let a=m(s),e=m(n),t=Math.min(a.length,e.length),r=0;for(;r<t&&a.charCodeAt(r)===e.charCodeAt(r);)r++;let i=0;for(;i<t-r&&a.charCodeAt(a.length-1-i)===e.charCodeAt(e.length-1-i);)i++;let o=a.length-r-i,c=e.length-r-i;if(o>0&&c>0){for(;r>0&&w(a[r-1])&&(w(a[r])||w(e[r]));)r--;for(;i<t-r&&a.charCodeAt(a.length-1-i)===e.charCodeAt(e.length-1-i);)i++;for(;i>0&&w(a[a.length-i])&&(w(a[a.length-i-1])||w(e[e.length-i-1]));)i--}else if(o+c>0){let u=o>0?a:e,g=o+c,l=f=>w(u[f])&&!w(u[f-1]),h=r;for(let f=r;f>0&&u[f-1]===u[f+g-1];)f--,l(f)&&(h=f);!l(r)&&h!==r&&(i+=r-h,r=h)}for(;r>0&&(I(a,r)||I(e,r));)r--;for(;i>0&&(I(a,a.length-i)||I(e,e.length-i));)i--;return{prefix:r,suffix:i}}function N(s,n,a,e){if(n<0||a<n||a>s.length)return null;let t=s.slice(n,a);if(m(t)===m(e)||t.length+e.length>8192)return null;let r=Math.max(0,n-32);I(s,r)&&r++;let i=Math.min(s.length,a+32);I(s,i)&&i--;let o=s.slice(r,n),c=s.slice(a,i),u=o+t+c,g=1+_e(s,u,r);return{removed:t,added:e,contextBefore:o,contextAfter:c,occurrence:g}}function me(s,n,a){return m(n).includes(m(s.contextBefore+s.removed+s.contextAfter))&&m(a).includes(m(s.contextBefore+s.added+s.contextAfter))}function G(s){return{removed:m(s.removed),added:m(s.added),contextBefore:m(s.contextBefore),contextAfter:m(s.contextAfter),occurrence:s.occurrence}}function ve(s,n){if(m(s)===m(n))return null;let{prefix:a,suffix:e}=Se(s,n);return N(s,a,s.length-e,n.slice(a,n.length-e))}function qe(s,n){if(m(s)===m(n))return null;let{prefix:a,suffix:e}=Se(s,n);return{removed:s.slice(a,s.length-e),start:a,end:n.length-e}}var j=(()=>{let n=class n{constructor(e){this.loggingService=e,this.enabledSignal=re(!1),this.onTargetEditStart=null,this.onTargetEditCommit=null,this.autoCommit=!0;try{this.enabled$=ce(this.enabledSignal).pipe(O())}catch(t){this.loggingService.catch("Error in SuggestionModeService constructor: ",t),this.enabled$=new C}}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}}};n.\u0275fac=function(t){return new(t||n)(S(R))},n.\u0275prov=x({token:n,factory:n.\u0275fac,providedIn:"root"});let s=n;return s})();var L=(()=>{let n=class n{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(i){return _()&&this.loggingService.catch(`[velt] Suggestion target "${e}" getter threw: `,i),!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(i){return _()&&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.`,i),!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)}}};n.\u0275fac=function(t){return new(t||n)(S(R))},n.\u0275prov=x({token:n,factory:n.\u0275fac,providedIn:"root"});let s=n;return s})();var Ee=(()=>{let n=class n{constructor(e,t,r){this.loggingService=e,this.modeService=t,this.snapshotService=r,this.registry=new Map,this.warnedUnstableIds=new Set,this.latestEdit=new Map,this.editSeq=0,this.actionsService=null,this.typedEditSource=null}registerTarget(e,t,r){try{if(!e||typeof t!="function")return;this.warnIfUnstableId(e);let i=this.registry.get(e)??{};i.getter=t,i.setter=typeof r?.setter=="function"?r.setter:void 0,i.restoreOnCommit=r?.restoreOnCommit,this.registry.set(e,i)}catch(i){this.loggingService.catch("Error in SuggestionTargetRegistryService registerTarget: ",i)}}unregisterTarget(e){try{let t=this.registry.get(e);if(!t)return;delete t.getter,delete t.setter,delete t.restoreOnCommit,this.latestEdit.delete(e),t.node||this.registry.delete(e)}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService unregisterTarget: ",t)}}getSetter(e){try{return this.registry.get(e)?.setter}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService getSetter: ",t);return}}callSetter(e,t,r){return this.runSetter(e,t,r)!==null}runSetter(e,t,r){let i=this.registry.get(e)?.setter;if(!i)return null;let o=c=>this.loggingService.catch("Error in SuggestionTargetRegistryService: the target setter threw",c,{targetId:e,reason:r.reason});try{let c=i(t,b({targetId:e},r));if(c&&typeof c.then=="function")return Promise.resolve(c).catch(o)}catch(c){o(c)}return Promise.resolve()}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 i=r[0],o=this.registry.get(e)??{};return o.node=i,this.registry.set(e,o),i}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService getNode: ",t);return}}setTypedEditSource(e){this.typedEditSource=e}getTypedEdits(e){try{return this.typedEditSource?.(e)??[]}catch(t){return this.loggingService.catch("Error in SuggestionTargetRegistryService getTypedEdits: ",t),[]}}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(`[${A.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:[A.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.latestEdit.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),i={targetId:t.targetId,oldValue:r,newValue:r,element:t.element},o=this.modeService.getOnTargetEditStart();if(o)try{o(i)}catch(c){this.loggingService.catch("Error in SuggestionTargetRegistryService onTargetEditStart customer callback threw: ",c)}this.actionsService?.triggerAction(p.TARGET_EDIT_START,{details:i,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),i=this.readElementValue(e,t);if(D(r,i))return;let o=this.splitTypedEdits(t,r,i),c=this.restoreWhenCommitted(e,r,o?o.length:1);if(o){o.forEach((u,g)=>this.commitEdit(e,t,r,u.newValue,u.textChange,!0,c?.(g)));return}this.commitEdit(e,t,r,i,void 0,!1,c?.(0))}catch(r){this.loggingService.catch("Error in SuggestionTargetRegistryService processCommit: ",r)}}restoreWhenCommitted(e,t,r){let i=this.registry.get(e);if(!i?.setter||i.restoreOnCommit===!1){this.latestEdit.delete(e);return}let o=++this.editSeq;this.latestEdit.set(e,o);let c=new Set;return u=>g=>{try{if(!g||c.size===r||(c.add(u),c.size<r||this.latestEdit.get(e)!==o))return;this.latestEdit.delete(e);let l=this.runSetter(e,t,{reason:"restore"}),h=()=>{this.findTaggedAncestor(document.activeElement)?.targetId===e&&this.snapshotService.captureValue(e,t)};h(),l?.then(h,()=>{})}catch(l){this.loggingService.catch("Error in SuggestionTargetRegistryService restoreWhenCommitted: ",l)}}}splitTypedEdits(e,t,r){try{if(typeof t!="string"||typeof r!="string")return null;let i=this.getTypedEdits(e);if(i.length<2)return null;let o=g=>g.replace(/\u00a0/g," ");if(i.some(g=>o(g.base)!==o(t)))return null;let c=t;for(let g of[...i].sort((l,h)=>h.start-l.start))c=c.slice(0,g.start)+g.added+c.slice(g.end);if(o(c)!==o(r))return null;let u=[];for(let g of i){let l=N(t,g.start,g.end,g.added);if(!l)return null;u.push({newValue:t.slice(0,g.start)+o(g.added)+t.slice(g.end),textChange:G(l)})}return u}catch(i){return this.loggingService.catch("Error in SuggestionTargetRegistryService splitTypedEdits: ",i),null}}commitEdit(e,t,r,i,o,c=!1,u){try{let g={targetId:e,oldValue:r,newValue:i,element:t},l=this.modeService.getOnTargetEditCommit(),h=null;if(l){let d=null;try{d=l(g)}catch(v){this.loggingService.catch("Error in SuggestionTargetRegistryService onTargetEditCommit customer callback threw: ",v)}d&&(h=this.invokeAutoCommit({targetId:e,newValue:i,snapshot:c?{value:r}:void 0,summary:d.summary,summaryHtml:d.summaryHtml,metadata:d.metadata,textChange:d.textChange??o}),u&&h.then(u))}else this.modeService.isAutoCommitEnabled()&&(h=this.invokeAutoCommit({targetId:e,newValue:i,textChange:o,snapshot:c?{value:r}:void 0}),u&&h.then(u));let f=d=>Y(this,null,function*(){if(h&&(yield h))return null;let v=this.invokeAutoCommit({targetId:e,newValue:i,snapshot:c?{value:r}:void 0,summary:d?.summary,summaryHtml:d?.summaryHtml,metadata:d?.metadata,textChange:d?.textChange??o});return u&&v.then(u),v});this.actionsService?.triggerAction(p.TARGET_EDIT_COMMIT,{details:g,commitSuggestion:f,timestamp:Date.now()})}catch(g){this.loggingService.catch("Error in SuggestionTargetRegistryService commitEdit: ",g)}}invokeAutoCommit(r){var i=r,{snapshot:e}=i,t=J(i,["snapshot"]);try{return e&&this.snapshotService.captureValue(t.targetId,e.value),this.actionsService?this.actionsService.commitSuggestion(t).catch(o=>(_()&&this.loggingService.catch(`[velt] auto-commit for "${t.targetId}" rejected: `,o),null)):(_()&&this.loggingService.log("[velt] auto-commit skipped: actions service not wired. SuggestionActionsService constructor should call registry.setActionsService(this)."),Promise.resolve(null))}catch(o){return this.loggingService.catch("Error in SuggestionTargetRegistryService invokeAutoCommit: ",o),Promise.resolve(null)}}captureSnapshotForTarget(e,t){try{let r=this.registry.get(e);if(r?.getter){this.snapshotService.captureFromGetter(e,r.getter);return}let i=this.readElementValue(e,t);this.snapshotService.captureValue(e,i)}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 i=(t.type||"").toLowerCase();return i==="checkbox"||i==="radio"?t.checked:i==="number"||i==="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(`[${A.ATTRIBUTES.VELT_SUGGESTION_TARGET}]`);if(!t)return null;let r=t.getAttribute(A.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(`[${A.ATTRIBUTES.VELT_SUGGESTION_TARGET}="${t}"]`))}catch{return[]}}scanAndRefresh(e){try{e.querySelectorAll(`[${A.ATTRIBUTES.VELT_SUGGESTION_TARGET}]`).forEach(r=>{let i=r.getAttribute(A.ATTRIBUTES.VELT_SUGGESTION_TARGET);if(!i)return;let o=this.registry.get(i)??{};(!o.node||!o.node.isConnected)&&(o.node=r,this.registry.set(i,o))})}catch(t){this.loggingService.catch("Error in SuggestionTargetRegistryService scanAndRefresh: ",t)}}warnIfUnstableId(e){try{if(!_()||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(!_())return;this.loggingService.catch(`[velt] Duplicate target id "${e}" \u2014 ${t} elements share this id. Cause: the same ${A.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)}}};n.\u0275fac=function(t){return new(t||n)(S(R),S(j),S(L))},n.\u0275prov=x({token:n,factory:n.\u0275fac,providedIn:"root"});let s=n;return s})();var Me=new Set(["apiKey","documentId","clientDocumentId","organizationId","clientOrganizationId","folderId","veltFolderId","parentVeltFolderId","documentMetadata","sdkVersion","pageInfo"]),St=(()=>{let n=class n{constructor(e,t,r,i,o,c,u){this.loggingService=e,this.modeService=t,this.snapshotService=r,this.targetRegistry=i,this.serviceBook=o,this.commonDbService=c,this.docService=u,this.actionSubjects=new Map,this.appliedValues=new Map,this.observingActive=!1,this.commentService=null,this.inlineSuggestionsEnabled$=new Q(!0);try{this.targetRegistry.setActionsService(this),this.serviceBook.observe(U).subscribe(g=>{this.commentService=g})}catch(g){this.loggingService.catch("Error in SuggestionActionsService constructor: ",g)}}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}}enableInlineSuggestions(){try{this.inlineSuggestionsEnabled$.value||this.inlineSuggestionsEnabled$.next(!0)}catch(e){this.loggingService.catch("Error in SuggestionActionsService enableInlineSuggestions: ",e)}}disableInlineSuggestions(){try{this.inlineSuggestionsEnabled$.value&&this.inlineSuggestionsEnabled$.next(!1)}catch(e){this.loggingService.catch("Error in SuggestionActionsService disableInlineSuggestions: ",e)}}isInlineSuggestionsEnabled$(){return this.inlineSuggestionsEnabled$.pipe(O())}isSuggestionModeEnabled$(){try{return this.modeService.enabled$}catch(e){return this.loggingService.catch("Error in SuggestionActionsService isSuggestionModeEnabled$: ",e),new C}}registerTarget(e){try{if(!e?.targetId||typeof e?.getter!="function")return;this.targetRegistry.registerTarget(e.targetId,e.getter,{setter:e.setter,restoreOnCommit:e.restoreOnCommit})}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 E=this.targetRegistry.getGetter(e.targetId);if(E){if(!this.snapshotService.captureFromGetter(e.targetId,E)){r(new Error("SNAPSHOT_FAILED"));return}}else{let y=this.targetRegistry.getFallbackValue(e.targetId);if(y.hasValue)this.snapshotService.captureValue(e.targetId,y.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),g=e.newValue;if(D(u,g)){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 l=new ge;l.type="suggestion",l.suggestion={status:"pending",targetId:e.targetId,targetType:"custom",oldValue:u,newValue:g,summary:e.summary??null,driftDetected:!1,rejectReason:null,resolvedBy:null,resolvedAt:null},this.setCustomerMetadata(l.suggestion,e.metadata),this.setTextChange(l.suggestion,e.targetId,e.textChange,u,g);let h=this.resolveSuggestionLocation(e),f=this.resolveSuggestionContext(e),d=Fe(e.summary,e.summaryHtml,u,g),v=new ue;if(v.commentText=d.commentText,v.commentHtml=d.commentHtml,l.comments=[v],!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,h?.location,void 0,void 0,void 0,void 0,void 0,E=>{try{this.snapshotService.clearSnapshot(e.targetId),this.projectAndTrigger(p.SUGGESTION_CREATED,E.annotation),t({id:E.annotation.annotationId})}catch(y){this.loggingService.catch("Error in SuggestionActionsService commitSuggestion callback: ",y),r(y)}},void 0,void 0,l,h?.locationId,f,!0,void 0,void 0,"internal",h?.locationId!==void 0?!0:void 0)}catch(i){this.loggingService.catch("Error in SuggestionActionsService commitSuggestion: ",i),r(i)}})}getSuggestions(e){try{let t=this.commentService?.getCommentAnnotationsOnCurrentOrganizationAndDocument()??[],r=[];for(let i of t){if(!i.suggestion)continue;let o=this.projectAnnotationToSuggestion(i);o&&this.matchesFilter(o,e)&&r.push(o)}return r}catch(t){return this.loggingService.catch("Error in SuggestionActionsService getSuggestions: ",t),[]}}getSuggestions$(e){try{return this.serviceBook.observe(U).pipe(Z(t=>t?t.getCommentAnnotationsOnCurrentOrganizationAndDocument$():$([]))).pipe(k(t=>{let r=[];for(let i of t??[]){if(!i.suggestion)continue;let o=this.projectAnnotationToSuggestion(i);o&&this.matchesFilter(o,e)&&r.push(o)}return r}),O(z))}catch(t){return this.loggingService.catch("Error in SuggestionActionsService getSuggestions$: ",t),new C}}getPendingSuggestion(e){try{if(!e)return null;let t=this.getSuggestions({targetId:e,status:"pending"});return t.length===0?null:t.sort((r,i)=>(i.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(k(t=>t.length===0?null:t.sort((r,i)=>(i.createdAt??0)-(r.createdAt??0))[0]),O(z)):new C}catch(t){return this.loggingService.catch("Error in SuggestionActionsService getPendingSuggestion$: ",t),new C}}triggerAction(e,t){try{this.actionSubjects.has(e)||this.actionSubjects.set(e,new B),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 B),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 i=this.timestamp;switch(e){case p.SUGGESTION_CREATED:{let o={suggestion:r,timestamp:i};this.triggerAction(p.SUGGESTION_CREATED,o);break}case p.SUGGESTION_APPROVED:{let o={suggestion:r,timestamp:i};this.triggerAction(p.SUGGESTION_APPROVED,o);break}case p.SUGGESTION_REJECTED:{let o={suggestion:r,timestamp:i};this.triggerAction(p.SUGGESTION_REJECTED,o);break}case p.SUGGESTION_STALE:{let o={suggestion:r,timestamp:i};this.triggerAction(p.SUGGESTION_STALE,o);break}}}catch(r){this.loggingService.catch("Error in SuggestionActionsService projectAndTrigger: ",r)}}resolveSuggestionContext(e){try{let t=e.context;if(t==null)return;if(typeof t!="object"||Array.isArray(t)){this.loggingService.warn('[velt] commitSuggestion: context was not saved. Cause: it is not an object. Fix: pass an object, e.g. { textEditorConfig: { editorId: "<editor id>" } }. Docs: velt.dev/docs/suggestions');return}let r;try{r=JSON.parse(JSON.stringify(t))}catch{this.loggingService.warn("[velt] commitSuggestion: context was not saved. Cause: it cannot be stored as JSON (e.g. it refers to itself). Fix: pass plain JSON data. Docs: velt.dev/docs/suggestions");return}if(r===null||typeof r!="object"||Array.isArray(r)){this.loggingService.warn('[velt] commitSuggestion: context was not saved. Cause: it is not stored as an object (e.g. a Date). Fix: pass an object, e.g. { textEditorConfig: { editorId: "<editor id>" } }. Docs: velt.dev/docs/suggestions');return}let i=De.filter(o=>o in r);return i.length&&(i.forEach(o=>delete r[o]),this.loggingService.warn(`[velt] commitSuggestion: context keys ${i.join(", ")} were not saved. Cause: the SDK sets them. Fix: leave them out (use \`access\` for context access). Docs: velt.dev/docs/suggestions`)),r}catch(t){this.loggingService.catch("Error in SuggestionActionsService resolveSuggestionContext: ",t);return}}resolveSuggestionLocation(e){try{let t=null,r=e.location;if(r!=null){let o=typeof r=="object"&&!Array.isArray(r)?r.id:void 0;typeof o=="string"&&o.trim()?t=r:this.loggingService.warn('[velt] commitSuggestion: location was not used. Cause: it is not an object with a non-empty string id. Fix: pass { id: "<location id>" }, or omit it to use the location around the target element. Docs: velt.dev/docs/suggestions')}if(!t){let o=this.targetRegistry.getNode(e.targetId);t=o?this.docService.getAdditionLocationFromElement(o):null}if(!t?.id)return null;let i=this.docService.getLocationMetadataByClientLocationId(t.id);return i?.location?{location:i.location,locationId:i.locationId}:{location:t}}catch(t){return this.loggingService.catch("Error in SuggestionActionsService resolveSuggestionLocation: ",t),null}}setCustomerMetadata(e,t){let r=this.cloneCustomerMetadata(t);r&&(e.metadata=r)}setTextChange(e,t,r,i,o){try{let c=q(r);c.reason?this.loggingService.warn(`[velt] commitSuggestion: textChange was not saved. Cause: ${c.reason}. Fix: pass { removed, added, contextBefore, contextAfter, occurrence }. Docs: velt.dev/docs/suggestions`):c.droppedKeys.length&&this.loggingService.warn(`[velt] commitSuggestion: textChange keys ${c.droppedKeys.join(", ")} were not saved. Cause: they are not textChange keys. Fix: put your own data in metadata. Docs: velt.dev/docs/suggestions`);let u=c.value??this.computeTextChange(t,i,o);u&&(e.textChange=u)}catch(c){this.loggingService.catch("Error in SuggestionActionsService setTextChange: ",c)}}computeTextChange(e,t,r){if(typeof t!="string"||typeof r!="string")return null;let i=this.targetRegistry.getNode(e);if(!(i instanceof HTMLElement)||!i.isConnected||!i.isContentEditable||i.closest(".ProseMirror"))return null;for(let c of this.targetRegistry.getTypedEdits(i)??[]){let u=N(c.base,c.start,c.end,c.added);if(u&&me(u,t,r))return G(u)}let o=ve(t,r);return o&&G(o)}getTextChange(e){return q(e.textChange).value}cloneCustomerMetadata(e){if(e==null)return;let t=typeof e=="object"?Object.getPrototypeOf(e):void 0;if(t!==Object.prototype&&t!==null){this.loggingService.warn('[velt] commitSuggestion: metadata was not saved. Cause: it is not a plain object. Fix: pass a plain JSON object, e.g. { kind: "replacement" }. Docs: velt.dev/docs/suggestions');return}try{let r=le(e);return r&&typeof r=="object"&&!Array.isArray(r)?r:void 0}catch{this.loggingService.warn("[velt] commitSuggestion: metadata was not saved. Cause: it cannot be serialized as JSON (BigInt or a circular reference). Fix: pass JSON-safe values only. Docs: velt.dev/docs/suggestions");return}}getCustomerMetadata(e){let t=e.suggestion?.metadata;if(t&&typeof t=="object"&&!Array.isArray(t))return b({},t);let r={},i=e.metadata;if(i&&typeof i=="object")for(let o of Object.keys(i))Me.has(o)||Object.defineProperty(r,o,{value:i[o],enumerable:!0,writable:!0,configurable:!0});return r}setAppliedValues(e,t){this.appliedValues.set(e,t)}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:this.getCustomerMetadata(e),textChange:this.getTextChange(t),driftDetected:!!t.driftDetected,createdBy:e.from,createdAt:e.createdAt??0};switch(t.status){case"pending":return M(b({},r),{status:"pending",rejectReason:null,resolvedBy:null,resolvedAt:null});case"accepted":case"apply_failed":{let i=t.status==="accepted"?this.appliedValues.get(e.annotationId):void 0;return M(b(b({},r),i??{}),{status:t.status,rejectReason:null,resolvedBy:t.resolvedBy,resolvedAt:t.resolvedAt??this.timestamp})}case"rejected":return M(b({},r),{status:"rejected",rejectReason:t.rejectReason??null,resolvedBy:t.resolvedBy,resolvedAt:t.resolvedAt??this.timestamp});case"stale":return M(b({},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}}};n.\u0275fac=function(t){return new(t||n)(S(R),S(j),S(L),S(Ee),S(de),S(he),S(fe))},n.\u0275prov=x({token:n,factory:n.\u0275fac,providedIn:"root"});let s=n;return s})();function be(s){try{return s.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}catch{return""}}function T(s){try{if(s==null)return"";if(typeof s=="string")return s;if(typeof s=="object")try{return JSON.stringify(s)}catch{return String(s)}return String(s)}catch{return""}}var De=["accessFields","_setAccessFields","_replaceAccessFields","_setVisibilityConfig"];function Te(s){try{if(s===null||typeof s!="object"||Array.isArray(s))return!1;let n=Object.getPrototypeOf(s);return n===Object.prototype||n===null}catch{return!1}}function Ce(s,n){try{let a=s==null,e=n==null;if(a&&!e)return[{op:"add",newText:T(n)}];if(!a&&e)return[{op:"remove",oldText:T(s)}];if(Te(s)&&Te(n)){let t=s,r=n,i=[...Object.keys(t),...Object.keys(r).filter(c=>!(c in t))],o=[];for(let c of i){let u=c in t,g=c in r;u&&g?D(t[c],r[c])||o.push({op:"replace",oldText:`${c}: ${T(t[c])}`,newText:`${c}: ${T(r[c])}`}):u?o.push({op:"remove",oldText:`${c}: ${T(t[c])}`}):o.push({op:"add",newText:`${c}: ${T(r[c])}`})}if(o.length>0)return o}return[{op:"replace",oldText:T(s),newText:T(n)}]}catch{return[{op:"replace",oldText:T(s),newText:T(n)}]}}function Ne(s,n){try{return Ce(s,n).map(a=>a.op==="add"?`Add: "${a.newText??""}"`:a.op==="remove"?`Remove: "${a.oldText??""}"`:`Replace: "${a.oldText??""}" with "${a.newText??""}"`).join(`
|
|
2
2
|
`)}catch{return'Replace: "" with ""'}}var X="color:#e0492b;font-style:italic;",W="color:#0f8a4d;font-style:italic;";function Ge(s,n){try{let a=Ce(s,n),e=t=>be(t??"");if(a.length===1){let t=a[0],r=(i,o,c)=>`<div class="velt-suggestion-default-line">${i} <span class="velt-suggestion-default-${c}" dir="auto" style="${c==="old"?X:W}">“${e(o)}”</span></div>`;return t.op==="add"?r("Add",t.newText,"new"):t.op==="remove"?r("Remove",t.oldText,"old"):r("Replace",t.oldText,"old")+r("with",t.newText,"new")}return a.map(t=>t.op==="add"?`<div>Add: <span style="${W}">“${e(t.newText)}”</span></div>`:t.op==="remove"?`<div>Remove: <span style="${X}">“${e(t.oldText)}”</span></div>`:`<div>Replace: <span style="${X}">“${e(t.oldText)}”</span> with <span style="${W}">“${e(t.newText)}”</span></div>`).join("")}catch{return"<div>Replace:</div><div>with</div>"}}function Fe(s,n,a,e){try{let t=s||Ne(a,e),r;return n?r=n:s?r=`<p>${be(s)}</p>`:r=Ge(a,e),{commentText:t,commentHtml:r}}catch{return{commentText:"",commentHtml:""}}}export{Ue as a,Ve as b,q as c,qe as d,j as e,Ee as f,St as g};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as N}from"./chunk-I4SBC3EE.js";import{G as K,H as W}from"./chunk-YKZV3FEU.js";import{E as P,Fh as V,G as x,Gh as L,He as m,Hh as H,Hk as J,Ih as z,Ik as b,J as C,Jh as R,K as f,Kh as F,Oa as j,Og as T,Qj as G,Tg as k,Tj as B,ba as v,db as X,ea as a,l as p,na as M,qj as g,r as A,vg as $,w as D,z as y}from"./chunk-QUMZPTVX.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(G),a(W),a(g),a(b),a(K),a(B))},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(J),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
|
+
import{a as N}from"./chunk-DODWXAOU.js";import{G as K,H as W}from"./chunk-ZAVZABAE.js";import{E as P,Fh as V,G as x,Gh as L,He as m,Hh as H,Hk as J,Ih as z,Ik as b,J as C,Jh as R,K as f,Kh as F,Oa as j,Og as T,Qj as G,Tg as k,Tj as B,ba as v,db as X,ea as a,l as p,na as M,qj as g,r as A,vg as $,w as D,z as y}from"./chunk-IVILSRE6.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(G),a(W),a(g),a(b),a(K),a(B))},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(J),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 +1 @@
|
|
|
1
|
-
import{a as o}from"./chunk-
|
|
1
|
+
import{a as o}from"./chunk-ERR5JJQ6.js";import{Ra as g,W as c,Ya as l,k as s,qj as v}from"./chunk-IVILSRE6.js";var p=(()=>{let i=class i{constructor(e,r){this.loggingService=e,this.dragDrop=r,this.currentX=0,this.currentY=0,this.destroy$=new s,this.subscriptions=[],this.loggingService.log("%c[WB] Creating CLASS: DraggableOverlayDirective","color: blue;")}ngOnInit(){try{this.loggingService.log("%c[WB] Calling DraggableOverlayDirective FUNCTION: ngOnInit","color: green;"),this.setupDraggableOverlay()}catch(e){this.loggingService.catch("Error in DraggableOverlayDirective ngOnInit: ",e)}}setupDraggableOverlay(){try{if(this.loggingService.log("%c[WB] Calling DraggableOverlayDirective FUNCTION: setupDraggableOverlay","color: green;"),this.connectedOverlay&&this.connectedOverlay.overlayRef){let e=this.connectedOverlay.overlayRef.overlayElement;this.dragRef=this.dragDrop.createDrag(e),this.subscriptions.push(this.dragRef.moved.pipe(c(this.destroy$)).subscribe(r=>{let a=this.connectedOverlay?.overlayRef.getConfig().positionStrategy;this.updatePosition(a,r.distance.x,r.distance.y)},r=>{this.loggingService.catch("Error in DraggableOverlayDirective dragRef.moved subscription: ",r)})),this.dragRef.ended.pipe(c(this.destroy$)).subscribe(r=>{this.currentX+=r.distance.x,this.currentY+=r.distance.y},r=>{this.loggingService.catch("Error in DraggableOverlayDirective dragRef.ended subscription: ",r)})}}catch(e){this.loggingService.catch("Error in DraggableOverlayDirective setupDraggableOverlay: ",e)}}updatePosition(e,r,a){try{if(e){let n=this.currentX+r,h=this.currentY+a;e.withDefaultOffsetX(n).withDefaultOffsetY(h),this.connectedOverlay?.overlayRef?.updatePosition()}}catch{}}cleanupDraggableOverlay(){try{this.loggingService.log("%c[WB] Calling DraggableOverlayDirective FUNCTION: cleanupDraggableOverlay","color: green;"),this.dragRef&&this.dragRef.dispose()}catch(e){this.loggingService.catch("Error in DraggableOverlayDirective cleanupDraggableOverlay: ",e)}}ngOnDestroy(){try{this.loggingService.log("%c[WB] Calling DraggableOverlayDirective FUNCTION: ngOnDestroy","color: green;"),this.cleanupDraggableOverlay(),this.destroy$.next(),this.destroy$.complete(),this.subscriptions.forEach(e=>{e.unsubscribe()})}catch(e){this.loggingService.catch("Error in DraggableOverlayDirective ngOnDestroy: ",e)}}};i.\u0275fac=function(r){return new(r||i)(g(v),g(o))},i.\u0275dir=l({type:i,selectors:[["","veltDraggableOverlay",""]],inputs:{connectedOverlay:[0,"veltDraggableOverlay","connectedOverlay"]}});let t=i;return t})();export{p as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{He as h,Vg as a,Yd as c}from"./chunk-
|
|
1
|
+
import{He as h,Vg as a,Yd as c}from"./chunk-IVILSRE6.js";var T=(t,n)=>{try{let e=d(t),r=[],o=[];return e.forEach(i=>{i?.parentElement?.closest(h.TAGS.SNIPPYLY_TEXT_HIGHLIGHT)?i?.parentElement?.normalize():i?.data&&o.push(i)}),o.forEach(i=>{let s=l(i,n);s&&r.push(s)}),r}catch(e){return c.catch("Error in highlighter highlightRange: ",e),[]}},d=t=>{try{if(t.collapsed)return[];let n=t.commonAncestorContainer;if(t.commonAncestorContainer.nodeType!==Node.ELEMENT_NODE&&(n=t.commonAncestorContainer.parentElement),!n)return[];let e=[],r=n.ownerDocument.createNodeIterator(n,NodeFilter.SHOW_TEXT),o,i=!1;for(;o=r.nextNode();)if(t.intersectsNode(o)){if(a(o))continue;let s=o?.length;if(t.startContainer===o&&t.startOffset>=s||t.endContainer===o&&t.endOffset===0)continue;t.startContainer===o&&t.startOffset>0&&(o.splitText(t.startOffset),i=!0),t.endContainer===o&&t.endOffset<s&&o.splitText(t.endOffset),e.push(o)}return i&&e.shift(),e}catch(n){return c.catch("Error in highlighter getTextNodesInRange: ",n),[]}},l=(t,n)=>{try{let e=document.createElement(n||h.TAGS.SNIPPYLY_TEXT_HIGHLIGHT),r=t.splitText(0);return r.parentNode?.replaceChild(e,r),e.appendChild(r),e.__veltPageTextNode=t,e}catch(e){return c.catch("Error in highlighter highlightNode: ",e),null}},u=(t,n)=>{try{if(!t)return;let e=n??(t.textContent?document.createTextNode(t.textContent):null),r=t.__veltPageTextNode;if(r){if(r.parentNode!==t.parentNode){t.remove();return}if(e?.nodeType===Node.TEXT_NODE){r.data||(r.data=e.data),t.remove();return}}e?t.replaceWith(e):t.remove()}catch(e){c.catch("Error in highlighter unwrapHighlightElement: ",e)}};export{T as a,u as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as V}from"./chunk-
|
|
1
|
+
import{i as V}from"./chunk-DXHPEQ4G.js";import{Ga as x,Ha as L,Ja as D,M as C,R as v,S as I}from"./chunk-5LVKB6WR.js";import{Wa as m,_a as d,_i as y,a as s,b as h,fa as o,oj as E,qj as U,sa as f,xc as u,ya as S,zc as p}from"./chunk-IVILSRE6.js";var A=(()=>{let r=class r extends D{set parentLocalUIState(t){try{t&&(this.localUIStateSignal=t,this.isLocalUIStateOwner=!1,this._localUIStateFromExplicitInput=!0)}catch{}}get elementRef(){try{return this.hostElementRef}catch{return null}}getServiceComponentConfigSignal(){}constructor(){let t=o(S),e=o(L),i=o(p),a=o(E).get(y),g=o(x),l=o(U);super(t,e,i,a??void 0,void 0,g,l),this.defaultCondition=u(!0,{transform:n=>{try{return typeof n=="string"?n==="true"||n==="":n}catch{return!0}}}),this.isLocalUIStateOwner=!1,this._localUIStateFromExplicitInput=!1,this.veltContextHost=new V({getHost:()=>this.hostElementRef?.nativeElement,ownerRef:this,getEntity:()=>this.getPublishedVeltEntity(),getLocalUIState:()=>this.isLocalUIStateOwner?this.localUIStateSignal:void 0,onContextChanged:()=>{this.adoptInheritedLocalUIState(),this.rebindServiceConfigFromPlacement(),this.onVeltContextChanged()},markForCheck:()=>this.cd?.markForCheck()}),this.isLocalUIStateRoot=!1,this.selfConnectedConfig=!1,this.ownsConfigSignal=!0;try{this.hostElementRef=t,this.themeService=e,this.dynamicDataService=g,this.loggingService=l,this.cd=i,this.commentService=a??void 0,this.initializeLocalUIState()}catch(n){this.loggingService=this.loggingService||l,this.loggingService?.catch?.("Error in V2PrimitiveThemedBase constructor:",n)}}initializeLocalUIState(){this.localUIStateSignal=f(this.getDefaultLocalUIState()),this.isLocalUIStateOwner=!0}getConditionalClassesContext(){return{componentConfigSignal:this.componentConfigSignal}}ngOnInit(){try{this.adoptInheritedLocalUIState(),this.connectToServiceSignalIfStandalone(),this.dynamicDataService.applyConditionalClasses(this.hostElementRef?.nativeElement,this.getConditionalClassesContext()),this.setupA11yAttributes(),this.isLocalUIStateOwner&&this.setupDarkModeSync(),this.finalizeVeltContext()}catch(t){this.loggingService.catch("Error in V2PrimitiveThemedBase ngOnInit:",t)}}adoptInheritedLocalUIState(){try{v({host:this.hostElementRef?.nativeElement,current:this.localUIStateSignal,isOwner:this.isLocalUIStateOwner,fromExplicitInput:this._localUIStateFromExplicitInput,isRoot:this.isLocalUIStateRoot,adopt:t=>{this.localUIStateSignal=t,this.isLocalUIStateOwner=!1}})}catch(t){this.loggingService.catch("Error in V2PrimitiveThemedBase adoptInheritedLocalUIState:",t)}}rebindServiceConfigFromPlacement(){try{if(!this.selfConnectedConfig)return;let t=this.getServiceComponentConfigSignal();if(!t||t===this.componentConfigSignal)return;let e=this.componentConfigSignal,i=this.ownsConfigSignal;if(this.componentConfigSignal=t,this.ownsConfigSignal=!1,i)try{e?.update(a=>s({},a))}catch{}this.cd?.markForCheck()}catch(t){this.loggingService.catch("Error in V2PrimitiveThemedBase rebindServiceConfigFromPlacement:",t)}}finalizeVeltContext(){this.veltContextHost.finalize()}getPublishedVeltEntity(){}getInheritedVeltEntity(){try{return I(this.hostElementRef?.nativeElement)}catch{return}}refreshVeltContextFromPlacement(){this.veltContextHost.refreshFromPlacement()}onVeltContextChanged(){}getInheritedVeltContextData(){try{return C(this.hostElementRef?.nativeElement)?.payload?.contextData||{}}catch{return{}}}connectToServiceSignalIfStandalone(){try{let t=this.componentConfigSignal();if(!t||!t?.uiState){this.selfConnectedConfig=!0;let e=this.getServiceComponentConfigSignal();e&&(this.componentConfigSignal=e,this.ownsConfigSignal=!1)}}catch(t){this.loggingService.catch("Error connecting to service signal:",t)}}ngOnDestroy(){try{this.darkModeConfigSyncSubscription&&this.darkModeConfigSyncSubscription.unsubscribe(),this.veltContextHost.destroy(),super.ngOnDestroy()}catch(t){this.loggingService.catch("Error in V2PrimitiveThemedBase ngOnDestroy:",t)}}setupA11yAttributes(){}setupDarkModeSync(){try{this.darkModeConfigSyncSubscription=this.onDarkModeChange().subscribe(t=>{try{if(this.componentConfigSignal&&typeof this.componentConfigSignal=="function"){let e=this.componentConfigSignal();e&&e.uiState&&e.uiState.darkMode!==t&&this.componentConfigSignal.update(i=>h(s({},i),{uiState:h(s({},i.uiState),{darkMode:t})}))}}catch(e){this.loggingService.catch("Error in darkMode sync subscription:",e)}})}catch(t){this.loggingService.catch("Error in V2PrimitiveThemedBase setupDarkModeSync:",t)}}};r.\u0275fac=function(e){return new(e||r)},r.\u0275cmp=m({type:r,selectors:[["app-v2-primitive-themed-base"]],inputs:{defaultCondition:[1,"defaultCondition"],parentLocalUIState:"parentLocalUIState"},standalone:!1,features:[d],decls:0,vars:0,template:function(e,i){},encapsulation:2});let c=r;return c})();export{A as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Hk as n,Ra as s,Za as a,Zc as c}from"./chunk-
|
|
1
|
+
import{Hk as n,Ra as s,Za as a,Zc as c}from"./chunk-IVILSRE6.js";var f=(()=>{let i=class i{constructor(t,r){this.domService=t,this.sanitizer=r}transform(t,r=!0){try{let o=r?this.domService.sanitizeHtml(t):t;return this.sanitizer.bypassSecurityTrustHtml(o)}catch{return t}}};i.\u0275fac=function(r){return new(r||i)(s(n,16),s(c,16))},i.\u0275pipe=a({name:"safeHtml",type:i,pure:!0});let e=i;return e})();export{f as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Ga as k,Ha as z,Ja as Z,xa as B,ya as F}from"./chunk-7KXS2DSG.js";import{Bb as s,Ha as c,Kb as j,Ra as g,Wa as W,_a as T,a as x,ab as p,ac as H,ba as I,dc as w,ea as D,ec as R,fb as C,hc as L,l as _,nb as v,ob as y,pb as M,qb as S,qj as b,sa as E,ub as h,v as O,vb as u,ya as P}from"./chunk-QUMZPTVX.js";var A=(()=>{let a=class a{constructor(e){this.loggingService=e,this.wireframeMap=new _(new Map);try{this.loggingService.log("%c[WB] Creating CLASS: WireframeService","color: blue;")}catch(t){this.loggingService.catch("Error in WireframeService constructor: ",t)}}setWireframe(e,t){try{let r=this.wireframeMap.value,o=r.get(e),i=t.children.length>0||t.innerHTML?.trim()?.length>0,d=o&&(o.children.length>0||o.innerHTML?.trim()?.length>0);(!o||i&&!d)&&(r.set(e,t),this.wireframeMap.next(r))}catch(r){this.loggingService.catch("Error in WireframeService setWireframe: ",r)}}setWireframeMap(e){try{let t=this.wireframeMap.value;e.forEach((r,o)=>{let i=t.get(o),d=r.children.length>0||r.innerHTML?.trim()?.length>0,f=i&&(i.children.length>0||i.innerHTML?.trim()?.length>0);(!i||d&&!f)&&t.set(o,r)}),this.wireframeMap.next(t)}catch(t){this.loggingService.catch("Error in WireframeService setWireframeMap: ",t)}}getWireframe(e,t=!0){try{let r=this.wireframeMap.value,o=r.get(e);if(!o&&t){let i=e?.split("---")[0];i&&(o=r.get(i))}return o&&(o?.children?.length>0||o?.innerHTML?.trim()?.length>0)?o:void 0}catch(r){this.loggingService.catch("Error in WireframeService getWireframe: ",r);return}}getConditionElement(e,t=!0){try{let r=this.wireframeMap.value,o=r.get(e);if(!o&&t){let i=e?.split("---")[0];i&&(o=r.get(i))}return o}catch(r){this.loggingService.catch("Error in WireframeService getConditionElement: ",r);return}}getWireframe$(e,t=!0){return this.wireframeMap.asObservable().pipe(O(r=>this.getWireframe(e,t)))}setChildren(e){try{this.wireframeMap.next(e)}catch(t){this.loggingService.catch("Error in WireframeService setChildren: ",t)}}getWireframeMap(){return this.wireframeMap.value}};a.\u0275fac=function(t){return new(t||a)(D(b))},a.\u0275prov=I({token:a,factory:a.\u0275fac,providedIn:"root"});let n=a;return n})();var N=n=>({componentConfigSignal:n}),U=(n,a)=>({condition:n,data:a}),q=(n,a,l,e,t)=>({template:n,context:a,componentName:"velt-confirm-dialog-wireframe",variant:l,setIfCondition:e,componentElementRef:t});function J(n,a){if(n&1&&(h(0),S(1,"app-confirm-dialog-title",5)(2,"app-confirm-dialog-message",5)(3,"app-confirm-dialog-preview",5),y(4,"div",6),S(5,"app-confirm-dialog-reject",5)(6,"app-confirm-dialog-approve",5),M(),u()),n&2){let l=s(3);c(),v("componentConfigSignal",l.componentConfigSignal),c(),v("componentConfigSignal",l.componentConfigSignal),c(),v("componentConfigSignal",l.componentConfigSignal),c(2),v("componentConfigSignal",l.componentConfigSignal),c(),v("componentConfigSignal",l.componentConfigSignal)}}function K(n,a){if(n&1&&(h(0),p(1,J,7,5,"ng-container",4),u()),n&2){let l=s().ngIf,e=s();c(),v("veltDynamicTemplate",L(3,q,e.template,w(1,N,e.componentConfigSignal),l==null?null:l.variant,e.setIfCondition.bind(e),e.elementRef))}}function Q(n,a){if(n&1&&(h(0),p(1,K,2,9,"ng-container",3),u()),n&2){let l=s();c(),v("veltIf",R(3,U,l.conditionSignal(),w(1,N,l.componentConfigSignal)))}}var pe=(()=>{let a=class a extends Z{constructor(e,t,r,o,i,d,f){super(i,o,void 0,void 0,void 0,f,e),this.loggingService=e,this.dialogRef=t,this.wireframeService=r,this.themeService=o,this.elementRef=i,this.dynamicDataService=f,this.subscriptions=[],this.componentConfigSignal=E({title:"",message:"",yesButton:"",noButton:"",variant:"",type:"",closeDialog:this.closeDialog.bind(this)}),this.componentId="velt-confirm-dialog",this.veltElement=!0;try{d&&(this.componentConfigSignal.update(m=>(m=x(x({},m),d),m)),d?.darkMode&&[!0,!1].includes(d?.darkMode)&&super.setComponentDarkMode(d?.darkMode)),this.setZIndex()}catch(m){this.loggingService.catch("Error in ConfirmDialogComponent constructor: ",m)}}ngOnInit(){try{this.loggingService.log("%c[WB] Calling FUNCTION: ngOnInit","color: green;");let e="velt-confirm-dialog-wireframe";super.ngOnInit(),this.componentConfigSignal()?.variant&&(e+=`---${this.componentConfigSignal()?.variant}`),this.subscriptions.push(this.wireframeService.getWireframe$(e).subscribe(t=>{if(t){let r=document.createElement(t.tagName);r.innerHTML=t.innerHTML,this.template=r}}))}catch(e){this.loggingService.catch("Error in ConfirmDialogComponent OnInit: ",e)}}ngOnDestroy(){super.ngOnDestroy();try{this.subscriptions.forEach(e=>e.unsubscribe())}catch(e){this.loggingService.catch("Error in ConfirmDialogComponent OnDestroy: ",e)}}setZIndex(){try{if(this.dialogRef){let e=this.dialogRef._overlayRef;e&&(e.backdropElement&&(e.backdropElement.style.zIndex="2147483647"),e.hostElement&&(e.hostElement.style.zIndex="2147483647"))}}catch(e){this.loggingService.catch("Error in ConfirmDialogComponent setZIndex: ",e)}}closeDialog(e){try{this.dialogRef.close(e)}catch(t){this.loggingService.catch("Error in ConfirmDialogComponent closeDialog: ",t)}}get variantClass(){return X(this.componentConfigSignal()?.type)}};a.\u0275fac=function(t){return new(t||a)(g(b),g(B),g(A),g(z),g(P),g(F,8),g(k))},a.\u0275cmp=W({type:a,selectors:[["snippyly-confirm-dialog"]],hostVars:1,hostBindings:function(t,r){t&2&&C("data-velt-element",r.veltElement)},standalone:!1,features:[H([k]),T],decls:3,vars:6,consts:[["floatingConfirmationRef",""],[1,"velt-confirm-dialog",3,"ngClass","snippylyOverlay","snippylyOverlayZIndex","snippylyOverlayBackdropZIndex"],[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[3,"componentConfigSignal"],["mat-dialog-actions","",1,"velt-confirm-dialog-actions"]],template:function(t,r){if(t&1&&(y(0,"div",1,0),p(2,Q,2,6,"ng-container",2),M()),t&2){let o=j(1);v("ngClass",r.variantClass)("snippylyOverlay",o)("snippylyOverlayZIndex",1200)("snippylyOverlayBackdropZIndex",1100),C("data-testid",r.componentId),c(2),v("ngIf",r.componentConfigSignal())}},styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}body.velt-pin-dragging[_ngcontent-%COMP%] iframe[_ngcontent-%COMP%]{pointer-events:none!important}[_nghost-%COMP%] *[_ngcontent-%COMP%]{outline:0}[_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)}[dark][_nghost-%COMP%]{--velt-green: var(--velt-dark-mode-green);--velt-magenta: var(--velt-dark-mode-magenta);--velt-amber: var(--velt-dark-mode-amber);--velt-purple: var(--velt-dark-mode-purple);--velt-cyan: var(--velt-dark-mode-cyan);--velt-orange: var(--velt-dark-mode-orange);--velt-black: var(--velt-dark-mode-black);--velt-white: var(--velt-dark-mode-white);--velt-gray: var(--velt-dark-mode-gray);--velt-error: var(--velt-dark-mode-error);--velt-error-hover: var(--velt-dark-mode-error-hover);--velt-error-foreground: var(--velt-dark-mode-error-foreground);--velt-error-light: var(--velt-dark-mode-error-light);--velt-error-transparent: var(--velt-dark-mode-error-transparent);--velt-warning: var(--velt-dark-mode-warning);--velt-warning-hover: var(--velt-dark-mode-warning-hover);--velt-warning-foreground: var(--velt-dark-mode-warning-foreground);--velt-warning-light: var(--velt-dark-mode-warning-light);--velt-warning-transparent: var(--velt-dark-mode-warning-transparent);--velt-agent-accent: #4495ff;--velt-agent-accent-transparent: rgba(68, 149, 255, .2);--velt-success: var(--velt-dark-mode-success);--velt-success-hover: var(--velt-dark-mode-success-hover);--velt-success-foreground: var(--velt-dark-mode-success-foreground);--velt-success-light: var(--velt-dark-mode-success-light);--velt-success-transparent: var(--velt-dark-mode-success-transparent);--velt-accent: var(--velt-dark-mode-accent);--velt-accent-text: var(--velt-dark-mode-accent-text);--velt-accent-hover: var(--velt-dark-mode-accent-hover);--velt-accent-foreground: var(--velt-dark-mode-accent-foreground);--velt-accent-light: var(--velt-dark-mode-accent-light);--velt-accent-transparent: var(--velt-dark-mode-accent-transparent);--velt-text-0: var(--velt-dark-mode-text-0);--velt-text-1: var(--velt-dark-mode-text-1);--velt-text-2: var(--velt-dark-mode-text-2);--velt-text-3: var(--velt-dark-mode-text-3);--velt-text-4: var(--velt-dark-mode-text-4);--velt-text-5: var(--velt-dark-mode-text-5);--velt-text-6: var(--velt-dark-mode-text-6);--velt-text-7: var(--velt-dark-mode-text-7);--velt-text-8: var(--velt-dark-mode-text-8);--velt-text-9: var(--velt-dark-mode-text-9);--velt-text-10: var(--velt-dark-mode-text-10);--velt-text-11: var(--velt-dark-mode-text-11);--velt-text-12: var(--velt-dark-mode-text-12);--velt-background-0: var(--velt-dark-mode-background-0);--velt-background-1: var(--velt-dark-mode-background-1);--velt-background-2: var(--velt-dark-mode-background-2);--velt-background-3: var(--velt-dark-mode-background-3);--velt-background-4: var(--velt-dark-mode-background-4);--velt-background-5: var(--velt-dark-mode-background-5);--velt-background-6: var(--velt-dark-mode-background-6);--velt-background-7: var(--velt-dark-mode-background-7);--velt-background-8: var(--velt-dark-mode-background-8);--velt-background-9: var(--velt-dark-mode-background-9);--velt-background-10: var(--velt-dark-mode-background-10);--velt-border-0: var(--velt-dark-mode-border-0);--velt-border-1: var(--velt-dark-mode-border-1);--velt-border-2: var(--velt-dark-mode-border-2);--velt-border-3: var(--velt-dark-mode-border-3);--velt-border-4: var(--velt-dark-mode-border-4);--velt-border-5: var(--velt-dark-mode-border-5);--velt-border-6: var(--velt-dark-mode-border-6);--velt-border-7: var(--velt-dark-mode-border-7);--velt-border-8: var(--velt-dark-mode-border-8);--velt-border-9: var(--velt-dark-mode-border-9);--velt-border-10: var(--velt-dark-mode-border-10);--velt-background-transparent: var(--velt-dark-mode-background-transparent);--velt-border-transparent: var(--velt-dark-mode-border-transparent);--velt-animation-transparent: var(--velt-dark-mode-animation-transparent)}.velt-confirm-dialog[_ngcontent-%COMP%]{width:455px;padding:40px;display:block;box-sizing:border-box;background-color:var(--velt-background-0)}.velt-confirm-dialog-actions[_ngcontent-%COMP%]{justify-content:space-between;gap:var(--velt-spacing-md);min-height:auto} .velt-mat-dialog-container mat-dialog-container .mat-mdc-dialog-surface.mdc-dialog__surface:has(snippyly-confirm-dialog){border-radius:var(--velt-border-radius-xl);padding:0}@media(max-width:768px){.velt-confirm-dialog[_ngcontent-%COMP%]{width:auto;max-width:455px;padding:24px}.velt-confirm-dialog--draft[_ngcontent-%COMP%] .velt-confirm-dialog-actions[_ngcontent-%COMP%]{flex-direction:column}.velt-confirm-dialog--draft[_ngcontent-%COMP%] .velt-confirm-dialog--approve, .velt-confirm-dialog--draft[_ngcontent-%COMP%] .velt-confirm-dialog--reject{min-height:44px}}.velt-confirm-dialog--draft[_ngcontent-%COMP%] .velt-confirm-dialog-title, .velt-confirm-dialog--draft[_ngcontent-%COMP%] .velt-confirm-dialog-message, .velt-confirm-dialog--draft[_ngcontent-%COMP%] .velt-confirm-dialog-preview{padding-left:0;padding-right:0;text-align:left}.velt-confirm-dialog--draft[_ngcontent-%COMP%] .velt-confirm-dialog-title{font-size:var(--velt-font-size-xl);line-height:1.3;padding-top:0;padding-bottom:0;margin-bottom:var(--velt-spacing-sm)}.velt-confirm-dialog--draft[_ngcontent-%COMP%] .velt-confirm-dialog-message{margin:0 0 var(--velt-spacing-lg);padding-top:0;padding-bottom:0;color:var(--velt-text-1)}.velt-confirm-dialog--draft[_ngcontent-%COMP%] .velt-confirm-dialog-preview{margin-bottom:var(--velt-spacing-lg)}.velt-confirm-dialog--draft[_ngcontent-%COMP%] .velt-confirm-dialog-actions[_ngcontent-%COMP%]{gap:var(--velt-spacing-md);margin:0;padding:0}.velt-confirm-dialog--draft[_ngcontent-%COMP%] .velt-confirm-dialog--approve, .velt-confirm-dialog--draft[_ngcontent-%COMP%] .velt-confirm-dialog--reject{border-radius:999px;min-height:48px;font-size:var(--velt-font-size-md);font-weight:600}.velt-confirm-dialog--draft[_ngcontent-%COMP%] .velt-confirm-dialog--approve:focus-visible, .velt-confirm-dialog--draft[_ngcontent-%COMP%] .velt-confirm-dialog--reject:focus-visible{outline:2px solid var(--velt-text-0);outline-offset:2px}"],changeDetection:0});let n=a;return n})();function X(n){return n?`velt-confirm-dialog--${n}`:""}export{A as a,pe as b};
|
|
1
|
+
import{Ga as k,Ha as z,Ja as Z,xa as B,ya as F}from"./chunk-5LVKB6WR.js";import{Bb as s,Ha as c,Kb as j,Ra as g,Wa as W,_a as T,a as x,ab as p,ac as H,ba as I,dc as w,ea as D,ec as R,fb as C,hc as L,l as _,nb as v,ob as y,pb as M,qb as S,qj as b,sa as E,ub as h,v as O,vb as u,ya as P}from"./chunk-IVILSRE6.js";var A=(()=>{let a=class a{constructor(e){this.loggingService=e,this.wireframeMap=new _(new Map);try{this.loggingService.log("%c[WB] Creating CLASS: WireframeService","color: blue;")}catch(t){this.loggingService.catch("Error in WireframeService constructor: ",t)}}setWireframe(e,t){try{let r=this.wireframeMap.value,o=r.get(e),i=t.children.length>0||t.innerHTML?.trim()?.length>0,d=o&&(o.children.length>0||o.innerHTML?.trim()?.length>0);(!o||i&&!d)&&(r.set(e,t),this.wireframeMap.next(r))}catch(r){this.loggingService.catch("Error in WireframeService setWireframe: ",r)}}setWireframeMap(e){try{let t=this.wireframeMap.value;e.forEach((r,o)=>{let i=t.get(o),d=r.children.length>0||r.innerHTML?.trim()?.length>0,f=i&&(i.children.length>0||i.innerHTML?.trim()?.length>0);(!i||d&&!f)&&t.set(o,r)}),this.wireframeMap.next(t)}catch(t){this.loggingService.catch("Error in WireframeService setWireframeMap: ",t)}}getWireframe(e,t=!0){try{let r=this.wireframeMap.value,o=r.get(e);if(!o&&t){let i=e?.split("---")[0];i&&(o=r.get(i))}return o&&(o?.children?.length>0||o?.innerHTML?.trim()?.length>0)?o:void 0}catch(r){this.loggingService.catch("Error in WireframeService getWireframe: ",r);return}}getConditionElement(e,t=!0){try{let r=this.wireframeMap.value,o=r.get(e);if(!o&&t){let i=e?.split("---")[0];i&&(o=r.get(i))}return o}catch(r){this.loggingService.catch("Error in WireframeService getConditionElement: ",r);return}}getWireframe$(e,t=!0){return this.wireframeMap.asObservable().pipe(O(r=>this.getWireframe(e,t)))}setChildren(e){try{this.wireframeMap.next(e)}catch(t){this.loggingService.catch("Error in WireframeService setChildren: ",t)}}getWireframeMap(){return this.wireframeMap.value}};a.\u0275fac=function(t){return new(t||a)(D(b))},a.\u0275prov=I({token:a,factory:a.\u0275fac,providedIn:"root"});let n=a;return n})();var N=n=>({componentConfigSignal:n}),U=(n,a)=>({condition:n,data:a}),q=(n,a,l,e,t)=>({template:n,context:a,componentName:"velt-confirm-dialog-wireframe",variant:l,setIfCondition:e,componentElementRef:t});function J(n,a){if(n&1&&(h(0),S(1,"app-confirm-dialog-title",5)(2,"app-confirm-dialog-message",5)(3,"app-confirm-dialog-preview",5),y(4,"div",6),S(5,"app-confirm-dialog-reject",5)(6,"app-confirm-dialog-approve",5),M(),u()),n&2){let l=s(3);c(),v("componentConfigSignal",l.componentConfigSignal),c(),v("componentConfigSignal",l.componentConfigSignal),c(),v("componentConfigSignal",l.componentConfigSignal),c(2),v("componentConfigSignal",l.componentConfigSignal),c(),v("componentConfigSignal",l.componentConfigSignal)}}function K(n,a){if(n&1&&(h(0),p(1,J,7,5,"ng-container",4),u()),n&2){let l=s().ngIf,e=s();c(),v("veltDynamicTemplate",L(3,q,e.template,w(1,N,e.componentConfigSignal),l==null?null:l.variant,e.setIfCondition.bind(e),e.elementRef))}}function Q(n,a){if(n&1&&(h(0),p(1,K,2,9,"ng-container",3),u()),n&2){let l=s();c(),v("veltIf",R(3,U,l.conditionSignal(),w(1,N,l.componentConfigSignal)))}}var pe=(()=>{let a=class a extends Z{constructor(e,t,r,o,i,d,f){super(i,o,void 0,void 0,void 0,f,e),this.loggingService=e,this.dialogRef=t,this.wireframeService=r,this.themeService=o,this.elementRef=i,this.dynamicDataService=f,this.subscriptions=[],this.componentConfigSignal=E({title:"",message:"",yesButton:"",noButton:"",variant:"",type:"",closeDialog:this.closeDialog.bind(this)}),this.componentId="velt-confirm-dialog",this.veltElement=!0;try{d&&(this.componentConfigSignal.update(m=>(m=x(x({},m),d),m)),d?.darkMode&&[!0,!1].includes(d?.darkMode)&&super.setComponentDarkMode(d?.darkMode)),this.setZIndex()}catch(m){this.loggingService.catch("Error in ConfirmDialogComponent constructor: ",m)}}ngOnInit(){try{this.loggingService.log("%c[WB] Calling FUNCTION: ngOnInit","color: green;");let e="velt-confirm-dialog-wireframe";super.ngOnInit(),this.componentConfigSignal()?.variant&&(e+=`---${this.componentConfigSignal()?.variant}`),this.subscriptions.push(this.wireframeService.getWireframe$(e).subscribe(t=>{if(t){let r=document.createElement(t.tagName);r.innerHTML=t.innerHTML,this.template=r}}))}catch(e){this.loggingService.catch("Error in ConfirmDialogComponent OnInit: ",e)}}ngOnDestroy(){super.ngOnDestroy();try{this.subscriptions.forEach(e=>e.unsubscribe())}catch(e){this.loggingService.catch("Error in ConfirmDialogComponent OnDestroy: ",e)}}setZIndex(){try{if(this.dialogRef){let e=this.dialogRef._overlayRef;e&&(e.backdropElement&&(e.backdropElement.style.zIndex="2147483647"),e.hostElement&&(e.hostElement.style.zIndex="2147483647"))}}catch(e){this.loggingService.catch("Error in ConfirmDialogComponent setZIndex: ",e)}}closeDialog(e){try{this.dialogRef.close(e)}catch(t){this.loggingService.catch("Error in ConfirmDialogComponent closeDialog: ",t)}}get variantClass(){return X(this.componentConfigSignal()?.type)}};a.\u0275fac=function(t){return new(t||a)(g(b),g(B),g(A),g(z),g(P),g(F,8),g(k))},a.\u0275cmp=W({type:a,selectors:[["snippyly-confirm-dialog"]],hostVars:1,hostBindings:function(t,r){t&2&&C("data-velt-element",r.veltElement)},standalone:!1,features:[H([k]),T],decls:3,vars:6,consts:[["floatingConfirmationRef",""],[1,"velt-confirm-dialog",3,"ngClass","snippylyOverlay","snippylyOverlayZIndex","snippylyOverlayBackdropZIndex"],[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[3,"componentConfigSignal"],["mat-dialog-actions","",1,"velt-confirm-dialog-actions"]],template:function(t,r){if(t&1&&(y(0,"div",1,0),p(2,Q,2,6,"ng-container",2),M()),t&2){let o=j(1);v("ngClass",r.variantClass)("snippylyOverlay",o)("snippylyOverlayZIndex",1200)("snippylyOverlayBackdropZIndex",1100),C("data-testid",r.componentId),c(2),v("ngIf",r.componentConfigSignal())}},styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}body.velt-pin-dragging[_ngcontent-%COMP%] iframe[_ngcontent-%COMP%]{pointer-events:none!important}[_nghost-%COMP%] *[_ngcontent-%COMP%]{outline:0}[_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)}[dark][_nghost-%COMP%]{--velt-green: var(--velt-dark-mode-green);--velt-magenta: var(--velt-dark-mode-magenta);--velt-amber: var(--velt-dark-mode-amber);--velt-purple: var(--velt-dark-mode-purple);--velt-cyan: var(--velt-dark-mode-cyan);--velt-orange: var(--velt-dark-mode-orange);--velt-black: var(--velt-dark-mode-black);--velt-white: var(--velt-dark-mode-white);--velt-gray: var(--velt-dark-mode-gray);--velt-error: var(--velt-dark-mode-error);--velt-error-hover: var(--velt-dark-mode-error-hover);--velt-error-foreground: var(--velt-dark-mode-error-foreground);--velt-error-light: var(--velt-dark-mode-error-light);--velt-error-transparent: var(--velt-dark-mode-error-transparent);--velt-warning: var(--velt-dark-mode-warning);--velt-warning-hover: var(--velt-dark-mode-warning-hover);--velt-warning-foreground: var(--velt-dark-mode-warning-foreground);--velt-warning-light: var(--velt-dark-mode-warning-light);--velt-warning-transparent: var(--velt-dark-mode-warning-transparent);--velt-agent-accent: #4495ff;--velt-agent-accent-transparent: rgba(68, 149, 255, .2);--velt-success: var(--velt-dark-mode-success);--velt-success-hover: var(--velt-dark-mode-success-hover);--velt-success-foreground: var(--velt-dark-mode-success-foreground);--velt-success-light: var(--velt-dark-mode-success-light);--velt-success-transparent: var(--velt-dark-mode-success-transparent);--velt-accent: var(--velt-dark-mode-accent);--velt-accent-text: var(--velt-dark-mode-accent-text);--velt-accent-hover: var(--velt-dark-mode-accent-hover);--velt-accent-foreground: var(--velt-dark-mode-accent-foreground);--velt-accent-light: var(--velt-dark-mode-accent-light);--velt-accent-transparent: var(--velt-dark-mode-accent-transparent);--velt-text-0: var(--velt-dark-mode-text-0);--velt-text-1: var(--velt-dark-mode-text-1);--velt-text-2: var(--velt-dark-mode-text-2);--velt-text-3: var(--velt-dark-mode-text-3);--velt-text-4: var(--velt-dark-mode-text-4);--velt-text-5: var(--velt-dark-mode-text-5);--velt-text-6: var(--velt-dark-mode-text-6);--velt-text-7: var(--velt-dark-mode-text-7);--velt-text-8: var(--velt-dark-mode-text-8);--velt-text-9: var(--velt-dark-mode-text-9);--velt-text-10: var(--velt-dark-mode-text-10);--velt-text-11: var(--velt-dark-mode-text-11);--velt-text-12: var(--velt-dark-mode-text-12);--velt-background-0: var(--velt-dark-mode-background-0);--velt-background-1: var(--velt-dark-mode-background-1);--velt-background-2: var(--velt-dark-mode-background-2);--velt-background-3: var(--velt-dark-mode-background-3);--velt-background-4: var(--velt-dark-mode-background-4);--velt-background-5: var(--velt-dark-mode-background-5);--velt-background-6: var(--velt-dark-mode-background-6);--velt-background-7: var(--velt-dark-mode-background-7);--velt-background-8: var(--velt-dark-mode-background-8);--velt-background-9: var(--velt-dark-mode-background-9);--velt-background-10: var(--velt-dark-mode-background-10);--velt-border-0: var(--velt-dark-mode-border-0);--velt-border-1: var(--velt-dark-mode-border-1);--velt-border-2: var(--velt-dark-mode-border-2);--velt-border-3: var(--velt-dark-mode-border-3);--velt-border-4: var(--velt-dark-mode-border-4);--velt-border-5: var(--velt-dark-mode-border-5);--velt-border-6: var(--velt-dark-mode-border-6);--velt-border-7: var(--velt-dark-mode-border-7);--velt-border-8: var(--velt-dark-mode-border-8);--velt-border-9: var(--velt-dark-mode-border-9);--velt-border-10: var(--velt-dark-mode-border-10);--velt-background-transparent: var(--velt-dark-mode-background-transparent);--velt-border-transparent: var(--velt-dark-mode-border-transparent);--velt-animation-transparent: var(--velt-dark-mode-animation-transparent)}.velt-confirm-dialog[_ngcontent-%COMP%]{width:455px;padding:40px;display:block;box-sizing:border-box;background-color:var(--velt-background-0)}.velt-confirm-dialog-actions[_ngcontent-%COMP%]{justify-content:space-between;gap:var(--velt-spacing-md);min-height:auto} .velt-mat-dialog-container mat-dialog-container .mat-mdc-dialog-surface.mdc-dialog__surface:has(snippyly-confirm-dialog){border-radius:var(--velt-border-radius-xl);padding:0}@media(max-width:768px){.velt-confirm-dialog[_ngcontent-%COMP%]{width:auto;max-width:455px;padding:24px}.velt-confirm-dialog--draft[_ngcontent-%COMP%] .velt-confirm-dialog-actions[_ngcontent-%COMP%]{flex-direction:column}.velt-confirm-dialog--draft[_ngcontent-%COMP%] .velt-confirm-dialog--approve, .velt-confirm-dialog--draft[_ngcontent-%COMP%] .velt-confirm-dialog--reject{min-height:44px}}.velt-confirm-dialog--draft[_ngcontent-%COMP%] .velt-confirm-dialog-title, .velt-confirm-dialog--draft[_ngcontent-%COMP%] .velt-confirm-dialog-message, .velt-confirm-dialog--draft[_ngcontent-%COMP%] .velt-confirm-dialog-preview{padding-left:0;padding-right:0;text-align:left}.velt-confirm-dialog--draft[_ngcontent-%COMP%] .velt-confirm-dialog-title{font-size:var(--velt-font-size-xl);line-height:1.3;padding-top:0;padding-bottom:0;margin-bottom:var(--velt-spacing-sm)}.velt-confirm-dialog--draft[_ngcontent-%COMP%] .velt-confirm-dialog-message{margin:0 0 var(--velt-spacing-lg);padding-top:0;padding-bottom:0;color:var(--velt-text-1)}.velt-confirm-dialog--draft[_ngcontent-%COMP%] .velt-confirm-dialog-preview{margin-bottom:var(--velt-spacing-lg)}.velt-confirm-dialog--draft[_ngcontent-%COMP%] .velt-confirm-dialog-actions[_ngcontent-%COMP%]{gap:var(--velt-spacing-md);margin:0;padding:0}.velt-confirm-dialog--draft[_ngcontent-%COMP%] .velt-confirm-dialog--approve, .velt-confirm-dialog--draft[_ngcontent-%COMP%] .velt-confirm-dialog--reject{border-radius:999px;min-height:48px;font-size:var(--velt-font-size-md);font-weight:600}.velt-confirm-dialog--draft[_ngcontent-%COMP%] .velt-confirm-dialog--approve:focus-visible, .velt-confirm-dialog--draft[_ngcontent-%COMP%] .velt-confirm-dialog--reject:focus-visible{outline:2px solid var(--velt-text-0);outline-offset:2px}"],changeDetection:0});let n=a;return n})();function X(n){return n?`velt-confirm-dialog--${n}`:""}export{A as a,pe as b};
|