@veltdev/sdk-staging 6.0.43 → 6.0.45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/app/models/data/comment-events.data.model.d.ts +10 -0
  2. package/app/models/data/comment-sidebar-config.model.d.ts +35 -0
  3. package/app/models/element/comment-element.model.d.ts +6 -3
  4. package/{chunk-NIXY2MMJ.js → chunk-36A7ZG4L.js} +1 -1
  5. package/{chunk-HQICZ4KH.js → chunk-3SLQQKJ6.js} +1 -1
  6. package/{chunk-VXKVV74S.js → chunk-4GZCXZSN.js} +1 -1
  7. package/{chunk-HZJQNVS6.js → chunk-6E6YYWQ4.js} +1 -1
  8. package/{chunk-LWGJ3OWM.js → chunk-6K62XPB3.js} +1 -1
  9. package/{chunk-BCCFAKMJ.js → chunk-7KXS2DSG.js} +1 -1
  10. package/{chunk-4QD6BCPV.js → chunk-ACPZ3R7G.js} +1 -1
  11. package/{chunk-2Y2VEYTA.js → chunk-BB7YQNOZ.js} +1 -1
  12. package/{chunk-EMRT2TA4.js → chunk-BEMVY5TX.js} +1 -1
  13. package/{chunk-NJWJ6JQQ.js → chunk-BNG3HAKY.js} +1 -1
  14. package/{chunk-FU3PWZIS.js → chunk-CQ6HOISZ.js} +1 -1
  15. package/{chunk-WTN5DFZR.js → chunk-CU4CNZ3O.js} +1 -1
  16. package/{chunk-G3FQCUGP.js → chunk-D5QZV6VO.js} +1 -1
  17. package/{chunk-2FS2LLFT.js → chunk-E47OMTOM.js} +1 -1
  18. package/{chunk-BLBHPZRN.js → chunk-EFWZWZAR.js} +1 -1
  19. package/{chunk-AW22CHIF.js → chunk-I3POWLVT.js} +1 -1
  20. package/{chunk-YH3OHM33.js → chunk-I4SBC3EE.js} +1 -1
  21. package/{chunk-BEYATMPG.js → chunk-JV7MPTE5.js} +1 -1
  22. package/{chunk-OKVF43CR.js → chunk-LCF6FZ5S.js} +1 -1
  23. package/{chunk-KS76UKA5.js → chunk-LWTRRGHL.js} +1 -1
  24. package/{chunk-ZDLTYC4M.js → chunk-N65XETWG.js} +1 -1
  25. package/{chunk-ZOFOR5OQ.js → chunk-NZWI6NA5.js} +1 -1
  26. package/{chunk-HYYAUDDE.js → chunk-OXMSOSYV.js} +1 -1
  27. package/{chunk-XGRWIQXQ.js → chunk-QBZHSLQ3.js} +1 -1
  28. package/{chunk-BGMA2CZX.js → chunk-QNEPYZBW.js} +1 -1
  29. package/{chunk-RYIR6UVW.js → chunk-QT57U43N.js} +1 -1
  30. package/{chunk-Q6PUYIXT.js → chunk-QUMZPTVX.js} +1 -1
  31. package/{chunk-BSKC7PDG.js → chunk-R3KBXENN.js} +1 -1
  32. package/{chunk-RD3LXH2F.js → chunk-SP25RLYB.js} +1 -1
  33. package/{chunk-UCN46LMI.js → chunk-U52DCY3D.js} +1 -1
  34. package/{chunk-5PFE7VZH.js → chunk-VYRSFZO2.js} +1 -1
  35. package/{chunk-UMIQCTT5.js → chunk-XUBFTUBO.js} +1 -1
  36. package/{chunk-VNY7M5U6.js → chunk-XY7DGMPO.js} +1 -1
  37. package/{chunk-7D33ZDW3.js → chunk-YKZV3FEU.js} +1 -1
  38. package/{chunk-UPZ52FZB.js → chunk-ZMILEE6P.js} +1 -1
  39. package/chunk-ZOA2LIG4.js +1 -0
  40. package/package.json +1 -1
  41. package/velt-activity-log.js +1 -1
  42. package/velt-area.js +1 -1
  43. package/velt-arrow.js +1 -1
  44. package/velt-comment.js +17 -17
  45. package/velt-crdt.js +1 -1
  46. package/velt-cursor.js +1 -1
  47. package/velt-huddle.js +1 -1
  48. package/velt-live-state-sync.js +1 -1
  49. package/velt-notification.js +1 -1
  50. package/velt-portable.js +1 -1
  51. package/velt-presence.js +1 -1
  52. package/velt-reaction.js +1 -1
  53. package/velt-recorder.js +1 -1
  54. package/velt-rewriter.js +1 -1
  55. package/velt-selection.js +1 -1
  56. package/velt-tag.js +1 -1
  57. package/velt-user-invite.js +1 -1
  58. package/velt-user-request.js +1 -1
  59. package/velt-video-player.js +1 -1
  60. package/velt-views.js +1 -1
  61. package/velt.js +2 -2
  62. package/chunk-Q4R6KJCT.js +0 -1
@@ -1 +1 @@
1
- import{a as N}from"./chunk-YH3OHM33.js";import{G as K,H as W}from"./chunk-7D33ZDW3.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-Q6PUYIXT.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-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 +1 @@
1
- import{Fa as F}from"./chunk-BCCFAKMJ.js";import{G as C,H as w}from"./chunk-7D33ZDW3.js";import{E as h,G as d,He as $,Ii as D,Ik as U,K as v,M as l,Qj as k,V as n,_f as g,ba as A,di as I,ea as s,l as p,nf as M,pj as E,qj as R,r as u,rj as y,v as c,we as a,xe as m}from"./chunk-Q6PUYIXT.js";var Z=(()=>{let o=class o{constructor(e,t,r,b,f,W,T,j){this.analyticsService=e,this.authService=t,this.contactService=r,this.databaseService=b,this.docService=f,this.configService=W,this.loggingService=T,this.commonDbService=j,this.documentIAM$=new p(null),this.workspaceIAM$=new p(null),this.roles$=new p([]),this.getDocumentIamSubscription=null,this.getOrganizationIamSubscription=null,this.getWorkspaceIamSubscription=null;try{this.authService.setIamService(this),this.getUser(),this.databaseService.getDb().pipe(h(i=>!!i),v(1)).subscribe(i=>{i&&(this.user&&this.getDocumentIam(),this.getDocumentPaths())},i=>{this.loggingService.catch("Error in CommentService getDb subscription: ",i)}),this.getRole$().pipe(v(1)).subscribe(i=>{this.authService?.getUser()&&!i&&this.analyticsService.trackEvent(D.Events.Iam.USER_ACCESS_DENIED)}),this.documentIAM$.subscribe(i=>{i?.accessType&&this.contactService.setDocumentAccessType(i.accessType)})}catch(i){this.loggingService.catch("Error in IamService constructor: ",i)}}clearCache(){this.loggingService.log("%c[WB] Calling FUNCTION: clearCache in IamService","color: green;");try{this.documentIAM$.next(null),this.workspaceIAM$.next(null),this.roles$.next([]),this.documentPaths=null}catch(e){this.loggingService.catch("Error in IamService clearCache: ",e)}}getUser(){try{this.authService.getUser$().pipe(h(e=>!!e)).subscribe(e=>{this.user=e,this.user?this.databaseService.getDbValue()&&this.getDocumentIam():(this.getDocumentIamSubscription?.unsubscribe(),this.getOrganizationIamSubscription?.unsubscribe(),this.getWorkspaceIamSubscription?.unsubscribe())},e=>{this.loggingService.catch("Error in IamService getUser$ subscription: ",e)})}catch(e){this.loggingService.catch("Error in IamService getUser: ",e)}}getDocumentPaths(){try{this.docService.getDocumentPaths$().pipe(h(e=>!!e)).subscribe(e=>{this.documentPaths=e,this.getDocumentIam(),this.getWorkspaceIam()},e=>{this.loggingService.catch("Error in IamService getDocumentPaths$ subscription: ",e)})}catch(e){this.loggingService.catch("Error in IamService getDocumentPaths: ",e)}}getDocumentIam(){try{this.getDocumentIamSubscription&&(this.getDocumentIamSubscription.unsubscribe(),this.getDocumentIamSubscription=null),this.user?this.getDocumentIamSubscription=this.docService.getDocumentIam$().subscribe(e=>{let t=e||new M;this.documentIAM$.next(t)},e=>{this.loggingService.catch("Error in IamService getDocumentIam$ subscription: ",e)}):this.documentIAM$.next(null)}catch(e){this.loggingService.catch("Error in IamService getDocumentIam: ",e)}}getWorkspaceIam(){try{this.getWorkspaceIamSubscription||(this.getWorkspaceIamSubscription=this.commonDbService.dbListener({feature:"workspaceIam",properties:{skipFirestore:!0}}).pipe(d(e=>u(null))).subscribe(e=>{this.workspaceIAM$.next(e?.data),this.roles$.next(e?.data?.roles||[])}))}catch(e){this.loggingService.catch("Error in IamService getWorkspaceIam: ",e)}}isUserAllowed$(){return this.getRole$().pipe(c(e=>!!e),l())}getDocumentIAM$(){return this.documentIAM$.asObservable()}getRoles$(){return this.roles$.asObservable().pipe(c(e=>e?.length?e:$.WorkspaceRoles))}getFeaturesAccessLevel$(){return this.documentIAM$.asObservable().pipe(c(e=>e?.features),n(e=>this.getRole$().pipe(c(t=>(t===a.ADMIN&&(e=e&&JSON.parse(JSON.stringify(e||{})),e?.all?.disabled&&(e.all.disabled=!1)),e)))))}hasRole(e){try{return e===this.getRole()}catch(t){return this.loggingService.catch("Error in IamService hasRole: ",t),!1}}hasRoleAny(e=[]){try{return e?.includes(this.getRole()||"")}catch(t){return this.loggingService.catch("Error in IamService hasRoleAny: ",t),!1}}hasRole$(e){try{return this.authService.getUser$().pipe(n(()=>this.documentIAM$.pipe(h(t=>!!t),n(()=>this.workspaceIAM$.pipe(c(()=>e===this.getRole()))))))}catch(t){return this.loggingService.catch("Error in IamService hasRole$: ",t),u(!1)}}getRole$(){try{return this.authService.getUser$().pipe(n(()=>this.configService.getSF$()),n(()=>this.configService.getSF()?this.contactService.isUserGlobalContact$():u(null)),n(()=>this.configService.getSF()?this.documentIAM$.pipe(h(e=>!!e),l(I)):u(null)),n(()=>this.workspaceIAM$.pipe(l(I))),c(()=>this.getRole()))}catch(e){return this.loggingService.catch("Error in IamService getRole$: ",e),u(null)}}getRole(){try{let e=this.configService.getSF();if(this.user?.isAdmin)return a.ADMIN;return a.COMMENTER;if(this.user)switch((this.documentIAM$.value?this.documentIAM$.value?.features?.all?.restricted:!1)?m.RESTRICTED:this.documentIAM$.value?this.documentIAM$.value?.documentAccessType||m.PUBLIC:null){case m.PUBLIC:r=this.getUserFromDocumentIAM(this.user?.email,this.user?.userId),r||(r=this.getUserFromWorkspaceIAM(this.user?.email,this.user?.userId)),t=r?.role?.name||a.COMMENTER;break;case m.RESTRICTED:r=this.getUserFromDocumentIAM(this.user?.email,this.user?.userId),r||(r=this.getUserFromWorkspaceIAM(this.user?.email,this.user?.userId)),t=r?.role?.name||null;break;default:break}}catch(e){this.loggingService.catch("Error in IamService getRole: ",e)}return null}isUserAdmin$(){return this.getRole$().pipe(c(e=>e===a.ADMIN),l())}isUserAdmin(){try{return this.getRole()===a.ADMIN}catch(e){return this.loggingService.catch("Error in IamService isUserAdmin: ",e),!1}}getUserFromDocumentIAM(e,t){try{if(e||t){let r;return e&&(r=this.documentIAM$.value?.users?.[g(e)]),!r&&t&&(r=this.documentIAM$.value?.users?.[g(t)]),r}else return}catch(r){this.loggingService.catch("Error in IamService getUserFromDocumentIAM: ",r)}}getUserFromWorkspaceIAM(e,t){try{if(e||t){let r;return e&&(r=this.workspaceIAM$.value?.users?.[g(e)]),!r&&t&&(r=this.workspaceIAM$.value?.users?.[g(t)]),r}else return}catch(r){this.loggingService.catch("Error in IamService getUserFromWorkspaceIAM: ",r)}}};o.\u0275fac=function(t){return new(t||o)(s(E),s(U),s(F),s(k),s(w),s(y),s(R),s(C))},o.\u0275prov=A({token:o,factory:o.\u0275fac,providedIn:"root"});let S=o;return S})();export{Z as a};
1
+ import{Fa as F}from"./chunk-7KXS2DSG.js";import{G as C,H as w}from"./chunk-YKZV3FEU.js";import{E as h,G as d,He as $,Ii as D,Ik as U,K as v,M as l,Qj as k,V as n,_f as g,ba as A,di as I,ea as s,l as p,nf as M,pj as E,qj as R,r as u,rj as y,v as c,we as a,xe as m}from"./chunk-QUMZPTVX.js";var Z=(()=>{let o=class o{constructor(e,t,r,b,f,W,T,j){this.analyticsService=e,this.authService=t,this.contactService=r,this.databaseService=b,this.docService=f,this.configService=W,this.loggingService=T,this.commonDbService=j,this.documentIAM$=new p(null),this.workspaceIAM$=new p(null),this.roles$=new p([]),this.getDocumentIamSubscription=null,this.getOrganizationIamSubscription=null,this.getWorkspaceIamSubscription=null;try{this.authService.setIamService(this),this.getUser(),this.databaseService.getDb().pipe(h(i=>!!i),v(1)).subscribe(i=>{i&&(this.user&&this.getDocumentIam(),this.getDocumentPaths())},i=>{this.loggingService.catch("Error in CommentService getDb subscription: ",i)}),this.getRole$().pipe(v(1)).subscribe(i=>{this.authService?.getUser()&&!i&&this.analyticsService.trackEvent(D.Events.Iam.USER_ACCESS_DENIED)}),this.documentIAM$.subscribe(i=>{i?.accessType&&this.contactService.setDocumentAccessType(i.accessType)})}catch(i){this.loggingService.catch("Error in IamService constructor: ",i)}}clearCache(){this.loggingService.log("%c[WB] Calling FUNCTION: clearCache in IamService","color: green;");try{this.documentIAM$.next(null),this.workspaceIAM$.next(null),this.roles$.next([]),this.documentPaths=null}catch(e){this.loggingService.catch("Error in IamService clearCache: ",e)}}getUser(){try{this.authService.getUser$().pipe(h(e=>!!e)).subscribe(e=>{this.user=e,this.user?this.databaseService.getDbValue()&&this.getDocumentIam():(this.getDocumentIamSubscription?.unsubscribe(),this.getOrganizationIamSubscription?.unsubscribe(),this.getWorkspaceIamSubscription?.unsubscribe())},e=>{this.loggingService.catch("Error in IamService getUser$ subscription: ",e)})}catch(e){this.loggingService.catch("Error in IamService getUser: ",e)}}getDocumentPaths(){try{this.docService.getDocumentPaths$().pipe(h(e=>!!e)).subscribe(e=>{this.documentPaths=e,this.getDocumentIam(),this.getWorkspaceIam()},e=>{this.loggingService.catch("Error in IamService getDocumentPaths$ subscription: ",e)})}catch(e){this.loggingService.catch("Error in IamService getDocumentPaths: ",e)}}getDocumentIam(){try{this.getDocumentIamSubscription&&(this.getDocumentIamSubscription.unsubscribe(),this.getDocumentIamSubscription=null),this.user?this.getDocumentIamSubscription=this.docService.getDocumentIam$().subscribe(e=>{let t=e||new M;this.documentIAM$.next(t)},e=>{this.loggingService.catch("Error in IamService getDocumentIam$ subscription: ",e)}):this.documentIAM$.next(null)}catch(e){this.loggingService.catch("Error in IamService getDocumentIam: ",e)}}getWorkspaceIam(){try{this.getWorkspaceIamSubscription||(this.getWorkspaceIamSubscription=this.commonDbService.dbListener({feature:"workspaceIam",properties:{skipFirestore:!0}}).pipe(d(e=>u(null))).subscribe(e=>{this.workspaceIAM$.next(e?.data),this.roles$.next(e?.data?.roles||[])}))}catch(e){this.loggingService.catch("Error in IamService getWorkspaceIam: ",e)}}isUserAllowed$(){return this.getRole$().pipe(c(e=>!!e),l())}getDocumentIAM$(){return this.documentIAM$.asObservable()}getRoles$(){return this.roles$.asObservable().pipe(c(e=>e?.length?e:$.WorkspaceRoles))}getFeaturesAccessLevel$(){return this.documentIAM$.asObservable().pipe(c(e=>e?.features),n(e=>this.getRole$().pipe(c(t=>(t===a.ADMIN&&(e=e&&JSON.parse(JSON.stringify(e||{})),e?.all?.disabled&&(e.all.disabled=!1)),e)))))}hasRole(e){try{return e===this.getRole()}catch(t){return this.loggingService.catch("Error in IamService hasRole: ",t),!1}}hasRoleAny(e=[]){try{return e?.includes(this.getRole()||"")}catch(t){return this.loggingService.catch("Error in IamService hasRoleAny: ",t),!1}}hasRole$(e){try{return this.authService.getUser$().pipe(n(()=>this.documentIAM$.pipe(h(t=>!!t),n(()=>this.workspaceIAM$.pipe(c(()=>e===this.getRole()))))))}catch(t){return this.loggingService.catch("Error in IamService hasRole$: ",t),u(!1)}}getRole$(){try{return this.authService.getUser$().pipe(n(()=>this.configService.getSF$()),n(()=>this.configService.getSF()?this.contactService.isUserGlobalContact$():u(null)),n(()=>this.configService.getSF()?this.documentIAM$.pipe(h(e=>!!e),l(I)):u(null)),n(()=>this.workspaceIAM$.pipe(l(I))),c(()=>this.getRole()))}catch(e){return this.loggingService.catch("Error in IamService getRole$: ",e),u(null)}}getRole(){try{let e=this.configService.getSF();if(this.user?.isAdmin)return a.ADMIN;return a.COMMENTER;if(this.user)switch((this.documentIAM$.value?this.documentIAM$.value?.features?.all?.restricted:!1)?m.RESTRICTED:this.documentIAM$.value?this.documentIAM$.value?.documentAccessType||m.PUBLIC:null){case m.PUBLIC:r=this.getUserFromDocumentIAM(this.user?.email,this.user?.userId),r||(r=this.getUserFromWorkspaceIAM(this.user?.email,this.user?.userId)),t=r?.role?.name||a.COMMENTER;break;case m.RESTRICTED:r=this.getUserFromDocumentIAM(this.user?.email,this.user?.userId),r||(r=this.getUserFromWorkspaceIAM(this.user?.email,this.user?.userId)),t=r?.role?.name||null;break;default:break}}catch(e){this.loggingService.catch("Error in IamService getRole: ",e)}return null}isUserAdmin$(){return this.getRole$().pipe(c(e=>e===a.ADMIN),l())}isUserAdmin(){try{return this.getRole()===a.ADMIN}catch(e){return this.loggingService.catch("Error in IamService isUserAdmin: ",e),!1}}getUserFromDocumentIAM(e,t){try{if(e||t){let r;return e&&(r=this.documentIAM$.value?.users?.[g(e)]),!r&&t&&(r=this.documentIAM$.value?.users?.[g(t)]),r}else return}catch(r){this.loggingService.catch("Error in IamService getUserFromDocumentIAM: ",r)}}getUserFromWorkspaceIAM(e,t){try{if(e||t){let r;return e&&(r=this.workspaceIAM$.value?.users?.[g(e)]),!r&&t&&(r=this.workspaceIAM$.value?.users?.[g(t)]),r}else return}catch(r){this.loggingService.catch("Error in IamService getUserFromWorkspaceIAM: ",r)}}};o.\u0275fac=function(t){return new(t||o)(s(E),s(U),s(F),s(k),s(w),s(y),s(R),s(C))},o.\u0275prov=A({token:o,factory:o.\u0275fac,providedIn:"root"});let S=o;return S})();export{Z as a};
@@ -138,7 +138,7 @@ ${n.map((r,i)=>`${i+1}) ${r.toString()}`).join(`
138
138
  </defs>`,E.innerText="Preview backend running in this workspace."),E.setAttribute("id",g)}document.readyState==="loading"?window.addEventListener("DOMContentLoaded",h):h()}function Xt(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function Tp(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(Xt())}function LB(){var t;let e=(t=XT())===null||t===void 0?void 0:t.forceEnvironment;if(e==="node")return!0;if(e==="browser")return!1;try{return Object.prototype.toString.call(global.process)==="[object process]"}catch{return!1}}function MB(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function PB(){let t=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof t=="object"&&t.id!==void 0}function JT(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function xB(){let t=Xt();return t.indexOf("MSIE ")>=0||t.indexOf("Trident/")>=0}function co(){return WR.NODE_CLIENT===!0||WR.NODE_ADMIN===!0}function XR(){return!LB()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")}function QR(){return!LB()&&!!navigator.userAgent&&(navigator.userAgent.includes("Safari")||navigator.userAgent.includes("WebKit"))&&!navigator.userAgent.includes("Chrome")}function md(){try{return typeof indexedDB=="object"}catch{return!1}}function kB(){return new Promise((t,e)=>{try{let n=!0,r="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(r);i.onsuccess=()=>{i.result.close(),n||self.indexedDB.deleteDatabase(r),t(!0)},i.onupgradeneeded=()=>{n=!1},i.onerror=()=>{var o;e(((o=i.error)===null||o===void 0?void 0:o.message)||"")}}catch(n){e(n)}})}var LJ="FirebaseError",nr=class t extends Error{constructor(e,n,r){super(n),this.code=e,this.customData=r,this.name=LJ,Object.setPrototypeOf(this,t.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,mi.prototype.create)}},mi=class{constructor(e,n,r){this.service=e,this.serviceName=n,this.errors=r}create(e,...n){let r=n[0]||{},i=`${this.service}/${e}`,o=this.errors[e],s=o?MJ(o,r):"Error",a=`${this.serviceName}: ${s} (${i}).`;return new nr(i,a,r)}};function MJ(t,e){return t.replace(PJ,(n,r)=>{let i=e[r];return i!=null?String(i):`<${r}?>`})}var PJ=/\{\$([^}]+)}/g;function fd(t){return JSON.parse(t)}function xt(t){return JSON.stringify(t)}var FB=function(t){let e={},n={},r={},i="";try{let o=t.split(".");e=fd(hd(o[0])||""),n=fd(hd(o[1])||""),i=o[2],r=n.d||{},delete n.d}catch{}return{header:e,claims:n,data:r,signature:i}};var UB=function(t){let e=FB(t),n=e.claims;return!!n&&typeof n=="object"&&n.hasOwnProperty("iat")},VB=function(t){let e=FB(t).claims;return typeof e=="object"&&e.admin===!0};function zr(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function Ws(t,e){if(Object.prototype.hasOwnProperty.call(t,e))return t[e]}function yp(t){for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}function Ip(t,e,n){let r={};for(let i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=e.call(n,t[i],i,t));return r}function Ei(t,e){if(t===e)return!0;let n=Object.keys(t),r=Object.keys(e);for(let i of n){if(!r.includes(i))return!1;let o=t[i],s=e[i];if(DB(o)&&DB(s)){if(!Ei(o,s))return!1}else if(o!==s)return!1}for(let i of r)if(!n.includes(i))return!1;return!0}function DB(t){return t!==null&&typeof t=="object"}function vp(t){let e=[];for(let[n,r]of Object.entries(t))Array.isArray(r)?r.forEach(i=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(i))}):e.push(encodeURIComponent(n)+"="+encodeURIComponent(r));return e.length?"&"+e.join("&"):""}var KT=class{constructor(){this.chain_=[],this.buf_=[],this.W_=[],this.pad_=[],this.inbuf_=0,this.total_=0,this.blockSize=512/8,this.pad_[0]=128;for(let e=1;e<this.blockSize;++e)this.pad_[e]=0;this.reset()}reset(){this.chain_[0]=1732584193,this.chain_[1]=4023233417,this.chain_[2]=2562383102,this.chain_[3]=271733878,this.chain_[4]=3285377520,this.inbuf_=0,this.total_=0}compress_(e,n){n||(n=0);let r=this.W_;if(typeof e=="string")for(let h=0;h<16;h++)r[h]=e.charCodeAt(n)<<24|e.charCodeAt(n+1)<<16|e.charCodeAt(n+2)<<8|e.charCodeAt(n+3),n+=4;else for(let h=0;h<16;h++)r[h]=e[n]<<24|e[n+1]<<16|e[n+2]<<8|e[n+3],n+=4;for(let h=16;h<80;h++){let f=r[h-3]^r[h-8]^r[h-14]^r[h-16];r[h]=(f<<1|f>>>31)&4294967295}let i=this.chain_[0],o=this.chain_[1],s=this.chain_[2],a=this.chain_[3],c=this.chain_[4],l,d;for(let h=0;h<80;h++){h<40?h<20?(l=a^o&(s^a),d=1518500249):(l=o^s^a,d=1859775393):h<60?(l=o&s|a&(o|s),d=2400959708):(l=o^s^a,d=3395469782);let f=(i<<5|i>>>27)+l+c+d+r[h]&4294967295;c=a,a=s,s=(o<<30|o>>>2)&4294967295,o=i,i=f}this.chain_[0]=this.chain_[0]+i&4294967295,this.chain_[1]=this.chain_[1]+o&4294967295,this.chain_[2]=this.chain_[2]+s&4294967295,this.chain_[3]=this.chain_[3]+a&4294967295,this.chain_[4]=this.chain_[4]+c&4294967295}update(e,n){if(e==null)return;n===void 0&&(n=e.length);let r=n-this.blockSize,i=0,o=this.buf_,s=this.inbuf_;for(;i<n;){if(s===0)for(;i<=r;)this.compress_(e,i),i+=this.blockSize;if(typeof e=="string"){for(;i<n;)if(o[s]=e.charCodeAt(i),++s,++i,s===this.blockSize){this.compress_(o),s=0;break}}else for(;i<n;)if(o[s]=e[i],++s,++i,s===this.blockSize){this.compress_(o),s=0;break}}this.inbuf_=s,this.total_+=n}digest(){let e=[],n=this.total_*8;this.inbuf_<56?this.update(this.pad_,56-this.inbuf_):this.update(this.pad_,this.blockSize-(this.inbuf_-56));for(let i=this.blockSize-1;i>=56;i--)this.buf_[i]=n&255,n/=256;this.compress_(this.buf_);let r=0;for(let i=0;i<5;i++)for(let o=24;o>=0;o-=8)e[r]=this.chain_[i]>>o&255,++r;return e}};function BB(t,e){let n=new qR(t,e);return n.subscribe.bind(n)}var qR=class{constructor(e,n){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=n,this.task.then(()=>{e(this)}).catch(r=>{this.error(r)})}next(e){this.forEachObserver(n=>{n.next(e)})}error(e){this.forEachObserver(n=>{n.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,n,r){let i;if(e===void 0&&n===void 0&&r===void 0)throw new Error("Missing Observer.");xJ(e,["next","error","complete"])?i=e:i={next:e,error:n,complete:r},i.next===void 0&&(i.next=$R),i.error===void 0&&(i.error=$R),i.complete===void 0&&(i.complete=$R);let o=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?i.error(this.finalError):i.complete()}catch{}}),this.observers.push(i),o}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let n=0;n<this.observers.length;n++)this.sendOne(n,e)}sendOne(e,n){this.task.then(()=>{if(this.observers!==void 0&&this.observers[e]!==void 0)try{n(this.observers[e])}catch(r){typeof console<"u"&&console.error&&console.error(r)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}};function xJ(t,e){if(typeof t!="object"||t===null)return!1;for(let n of e)if(n in t&&typeof t[n]=="function")return!0;return!1}function $R(){}function zs(t,e){return`${t} failed: ${e} argument `}var GB=function(t){let e=[],n=0;for(let r=0;r<t.length;r++){let i=t.charCodeAt(r);if(i>=55296&&i<=56319){let o=i-55296;r++,Y(r<t.length,"Surrogate pair missing trail surrogate.");let s=t.charCodeAt(r)-56320;i=65536+(o<<10)+s}i<128?e[n++]=i:i<2048?(e[n++]=i>>6|192,e[n++]=i&63|128):i<65536?(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=i&63|128):(e[n++]=i>>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=i&63|128)}return e},Sp=function(t){let e=0;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);r<128?e++:r<2048?e+=2:r>=55296&&r<=56319?(e+=4,n++):e+=3}return e};var PMe=14400*1e3;function Pe(t){return t&&t._delegate?t._delegate:t}var Qt=class{constructor(e,n,r){this.name=e,this.instanceFactory=n,this.type=r,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}};var Kc="[DEFAULT]";var ZT=class{constructor(e,n){this.name=e,this.container=n,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){let n=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(n)){let r=new cn;if(this.instancesDeferred.set(n,r),this.isInitialized(n)||this.shouldAutoInitialize())try{let i=this.getOrInitializeService({instanceIdentifier:n});i&&r.resolve(i)}catch{}}return this.instancesDeferred.get(n).promise}getImmediate(e){var n;let r=this.normalizeInstanceIdentifier(e?.identifier),i=(n=e?.optional)!==null&&n!==void 0?n:!1;if(this.isInitialized(r)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:r})}catch(o){if(i)return null;throw o}else{if(i)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,!!this.shouldAutoInitialize()){if(FJ(e))try{this.getOrInitializeService({instanceIdentifier:Kc})}catch{}for(let[n,r]of this.instancesDeferred.entries()){let i=this.normalizeInstanceIdentifier(n);try{let o=this.getOrInitializeService({instanceIdentifier:i});r.resolve(o)}catch{}}}}clearInstance(e=Kc){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}delete(){return y(this,null,function*(){let e=Array.from(this.instances.values());yield Promise.all([...e.filter(n=>"INTERNAL"in n).map(n=>n.INTERNAL.delete()),...e.filter(n=>"_delete"in n).map(n=>n._delete())])})}isComponentSet(){return this.component!=null}isInitialized(e=Kc){return this.instances.has(e)}getOptions(e=Kc){return this.instancesOptions.get(e)||{}}initialize(e={}){let{options:n={}}=e,r=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(r))throw Error(`${this.name}(${r}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);let i=this.getOrInitializeService({instanceIdentifier:r,options:n});for(let[o,s]of this.instancesDeferred.entries()){let a=this.normalizeInstanceIdentifier(o);r===a&&s.resolve(i)}return i}onInit(e,n){var r;let i=this.normalizeInstanceIdentifier(n),o=(r=this.onInitCallbacks.get(i))!==null&&r!==void 0?r:new Set;o.add(e),this.onInitCallbacks.set(i,o);let s=this.instances.get(i);return s&&e(s,i),()=>{o.delete(e)}}invokeOnInitCallbacks(e,n){let r=this.onInitCallbacks.get(n);if(r)for(let i of r)try{i(e,n)}catch{}}getOrInitializeService({instanceIdentifier:e,options:n={}}){let r=this.instances.get(e);if(!r&&this.component&&(r=this.component.instanceFactory(this.container,{instanceIdentifier:kJ(e),options:n}),this.instances.set(e,r),this.instancesOptions.set(e,n),this.invokeOnInitCallbacks(r,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,r)}catch{}return r||null}normalizeInstanceIdentifier(e=Kc){return this.component?this.component.multipleInstances?e:Kc:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}};function kJ(t){return t===Kc?void 0:t}function FJ(t){return t.instantiationMode==="EAGER"}var Ap=class{constructor(e){this.name=e,this.providers=new Map}addComponent(e){let n=this.getProvider(e.name);if(n.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);n.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);let n=new ZT(e,this);return this.providers.set(e,n),n}getProviders(){return Array.from(this.providers.values())}};var jB=[],be=(function(t){return t[t.DEBUG=0]="DEBUG",t[t.VERBOSE=1]="VERBOSE",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.SILENT=5]="SILENT",t})(be||{}),UJ={debug:be.DEBUG,verbose:be.VERBOSE,info:be.INFO,warn:be.WARN,error:be.ERROR,silent:be.SILENT},VJ=be.INFO,BJ={[be.DEBUG]:"log",[be.VERBOSE]:"log",[be.INFO]:"info",[be.WARN]:"warn",[be.ERROR]:"error"},GJ=(t,e,...n)=>{if(e<t.logLevel)return;let r=new Date().toISOString(),i=BJ[e];if(i)console[i](`[${r}] ${t.name}:`,...n);else throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`)},qr=class{constructor(e){this.name=e,this._logLevel=VJ,this._logHandler=GJ,this._userLogHandler=null,jB.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in be))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel=typeof e=="string"?UJ[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if(typeof e!="function")throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,be.DEBUG,...e),this._logHandler(this,be.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,be.VERBOSE,...e),this._logHandler(this,be.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,be.INFO,...e),this._logHandler(this,be.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,be.WARN,...e),this._logHandler(this,be.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,be.ERROR,...e),this._logHandler(this,be.ERROR,...e)}};function HB(t){jB.forEach(e=>{e.setLogLevel(t)})}var jJ=(t,e)=>e.some(n=>t instanceof n),$B,WB;function HJ(){return $B||($B=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function $J(){return WB||(WB=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}var zB=new WeakMap,ZR=new WeakMap,qB=new WeakMap,JR=new WeakMap,tN=new WeakMap;function WJ(t){let e=new Promise((n,r)=>{let i=()=>{t.removeEventListener("success",o),t.removeEventListener("error",s)},o=()=>{n(lo(t.result)),i()},s=()=>{r(t.error),i()};t.addEventListener("success",o),t.addEventListener("error",s)});return e.then(n=>{n instanceof IDBCursor&&zB.set(n,t)}).catch(()=>{}),tN.set(e,t),e}function zJ(t){if(ZR.has(t))return;let e=new Promise((n,r)=>{let i=()=>{t.removeEventListener("complete",o),t.removeEventListener("error",s),t.removeEventListener("abort",s)},o=()=>{n(),i()},s=()=>{r(t.error||new DOMException("AbortError","AbortError")),i()};t.addEventListener("complete",o),t.addEventListener("error",s),t.addEventListener("abort",s)});ZR.set(t,e)}var eN={get(t,e,n){if(t instanceof IDBTransaction){if(e==="done")return ZR.get(t);if(e==="objectStoreNames")return t.objectStoreNames||qB.get(t);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return lo(t[e])},set(t,e,n){return t[e]=n,!0},has(t,e){return t instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in t}};function KB(t){eN=t(eN)}function qJ(t){return t===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...n){let r=t.call(ey(this),e,...n);return qB.set(r,e.sort?e.sort():[e]),lo(r)}:$J().includes(t)?function(...e){return t.apply(ey(this),e),lo(zB.get(this))}:function(...e){return lo(t.apply(ey(this),e))}}function KJ(t){return typeof t=="function"?qJ(t):(t instanceof IDBTransaction&&zJ(t),jJ(t,HJ())?new Proxy(t,eN):t)}function lo(t){if(t instanceof IDBRequest)return WJ(t);if(JR.has(t))return JR.get(t);let e=KJ(t);return e!==t&&(JR.set(t,e),tN.set(e,t)),e}var ey=t=>tN.get(t);function XB(t,e,{blocked:n,upgrade:r,blocking:i,terminated:o}={}){let s=indexedDB.open(t,e),a=lo(s);return r&&s.addEventListener("upgradeneeded",c=>{r(lo(s.result),c.oldVersion,c.newVersion,lo(s.transaction),c)}),n&&s.addEventListener("blocked",c=>n(c.oldVersion,c.newVersion,c)),a.then(c=>{o&&c.addEventListener("close",()=>o()),i&&c.addEventListener("versionchange",l=>i(l.oldVersion,l.newVersion,l))}).catch(()=>{}),a}var YJ=["get","getKey","getAll","getAllKeys","count"],XJ=["put","add","delete","clear"],nN=new Map;function YB(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(nN.get(e))return nN.get(e);let n=e.replace(/FromIndex$/,""),r=e!==n,i=XJ.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(i||YJ.includes(n)))return;let o=function(s,...a){return y(this,null,function*(){let c=this.transaction(s,i?"readwrite":"readonly"),l=c.store;return r&&(l=l.index(a.shift())),(yield Promise.all([l[n](...a),i&&c.done]))[0]})};return nN.set(e,o),o}KB(t=>le(V({},t),{get:(e,n,r)=>YB(e,n)||t.get(e,n,r),has:(e,n)=>!!YB(e,n)||t.has(e,n)}));var iN=class{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(QJ(n)){let r=n.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(n=>n).join(" ")}};function QJ(t){let e=t.getComponent();return e?.type==="VERSION"}var oN="@firebase/app",QB="0.13.2";var Xo=new qr("@firebase/app"),JJ="@firebase/app-compat",ZJ="@firebase/analytics-compat",eZ="@firebase/analytics",tZ="@firebase/app-check-compat",nZ="@firebase/app-check",rZ="@firebase/auth",iZ="@firebase/auth-compat",oZ="@firebase/database",sZ="@firebase/data-connect",aZ="@firebase/database-compat",cZ="@firebase/functions",lZ="@firebase/functions-compat",uZ="@firebase/installations",dZ="@firebase/installations-compat",hZ="@firebase/messaging",fZ="@firebase/messaging-compat",pZ="@firebase/performance",gZ="@firebase/performance-compat",mZ="@firebase/remote-config",EZ="@firebase/remote-config-compat",_Z="@firebase/storage",TZ="@firebase/storage-compat",yZ="@firebase/firestore",IZ="@firebase/ai",vZ="@firebase/firestore-compat",SZ="firebase",AZ="11.10.0";var sN="[DEFAULT]",CZ={[oN]:"fire-core",[JJ]:"fire-core-compat",[eZ]:"fire-analytics",[ZJ]:"fire-analytics-compat",[nZ]:"fire-app-check",[tZ]:"fire-app-check-compat",[rZ]:"fire-auth",[iZ]:"fire-auth-compat",[oZ]:"fire-rtdb",[sZ]:"fire-data-connect",[aZ]:"fire-rtdb-compat",[cZ]:"fire-fn",[lZ]:"fire-fn-compat",[uZ]:"fire-iid",[dZ]:"fire-iid-compat",[hZ]:"fire-fcm",[fZ]:"fire-fcm-compat",[pZ]:"fire-perf",[gZ]:"fire-perf-compat",[mZ]:"fire-rc",[EZ]:"fire-rc-compat",[_Z]:"fire-gcs",[TZ]:"fire-gcs-compat",[yZ]:"fire-fst",[vZ]:"fire-fst-compat",[IZ]:"fire-vertex","fire-js":"fire-js",[SZ]:"fire-js-all"};var Cp=new Map,DZ=new Map,aN=new Map;function JB(t,e){try{t.container.addComponent(e)}catch(n){Xo.debug(`Component ${e.name} failed to register with FirebaseApp ${t.name}`,n)}}function qn(t){let e=t.name;if(aN.has(e))return Xo.debug(`There were multiple attempts to register component ${e}.`),!1;aN.set(e,t);for(let n of Cp.values())JB(n,t);for(let n of DZ.values())JB(n,t);return!0}function uo(t,e){let n=t.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),t.container.getProvider(e)}function rr(t){return t==null?!1:t.settings!==void 0}var RZ={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},qs=new mi("app","Firebase",RZ);var cN=class{constructor(e,n,r){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},n),this._name=n.name,this._automaticDataCollectionEnabled=n.automaticDataCollectionEnabled,this._container=r,this.container.addComponent(new Qt("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw qs.create("app-deleted",{appName:this._name})}};var Ks=AZ;function dN(t,e={}){let n=t;typeof e!="object"&&(e={name:e});let r=Object.assign({name:sN,automaticDataCollectionEnabled:!0},e),i=r.name;if(typeof i!="string"||!i)throw qs.create("bad-app-name",{appName:String(i)});if(n||(n=YR()),!n)throw qs.create("no-options");let o=Cp.get(i);if(o){if(Ei(n,o.options)&&Ei(r,o.config))return o;throw qs.create("duplicate-app",{appName:i})}let s=new Ap(i);for(let c of aN.values())s.addComponent(c);let a=new cN(n,r,s);return Cp.set(i,a),a}function ir(t=sN){let e=Cp.get(t);if(!e&&t===sN&&YR())return dN();if(!e)throw qs.create("no-app",{appName:t});return e}function ty(){return Array.from(Cp.values())}function $e(t,e,n){var r;let i=(r=CZ[t])!==null&&r!==void 0?r:t;n&&(i+=`-${n}`);let o=i.match(/\s|\//),s=e.match(/\s|\//);if(o||s){let a=[`Unable to register library "${i}" with version "${e}":`];o&&a.push(`library name "${i}" contains illegal characters (whitespace or "/")`),o&&s&&a.push("and"),s&&a.push(`version name "${e}" contains illegal characters (whitespace or "/")`),Xo.warn(a.join(" "));return}qn(new Qt(`${i}-version`,()=>({library:i,version:e}),"VERSION"))}function NZ(t){HB(t)}var bZ="firebase-heartbeat-database",wZ=1,Dp="firebase-heartbeat-store",rN=null;function nG(){return rN||(rN=XB(bZ,wZ,{upgrade:(t,e)=>{switch(e){case 0:try{t.createObjectStore(Dp)}catch(n){console.warn(n)}}}}).catch(t=>{throw qs.create("idb-open",{originalErrorMessage:t.message})})),rN}function OZ(t){return y(this,null,function*(){try{let n=(yield nG()).transaction(Dp),r=yield n.objectStore(Dp).get(rG(t));return yield n.done,r}catch(e){if(e instanceof nr)Xo.warn(e.message);else{let n=qs.create("idb-get",{originalErrorMessage:e?.message});Xo.warn(n.message)}}})}function ZB(t,e){return y(this,null,function*(){try{let r=(yield nG()).transaction(Dp,"readwrite");yield r.objectStore(Dp).put(e,rG(t)),yield r.done}catch(n){if(n instanceof nr)Xo.warn(n.message);else{let r=qs.create("idb-set",{originalErrorMessage:n?.message});Xo.warn(r.message)}}})}function rG(t){return`${t.name}!${t.options.appId}`}var LZ=1024,MZ=30,lN=class{constructor(e){this.container=e,this._heartbeatsCache=null;let n=this.container.getProvider("app").getImmediate();this._storage=new uN(n),this._heartbeatsCachePromise=this._storage.read().then(r=>(this._heartbeatsCache=r,r))}triggerHeartbeat(){return y(this,null,function*(){var e,n;try{let i=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),o=eG();if(((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null&&(this._heartbeatsCache=yield this._heartbeatsCachePromise,((n=this._heartbeatsCache)===null||n===void 0?void 0:n.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===o||this._heartbeatsCache.heartbeats.some(s=>s.date===o))return;if(this._heartbeatsCache.heartbeats.push({date:o,agent:i}),this._heartbeatsCache.heartbeats.length>MZ){let s=xZ(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(s,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(r){Xo.warn(r)}})}getHeartbeatsHeader(){return y(this,null,function*(){var e;try{if(this._heartbeatsCache===null&&(yield this._heartbeatsCachePromise),((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";let n=eG(),{heartbeatsToSend:r,unsentEntries:i}=PZ(this._heartbeatsCache.heartbeats),o=_p(JSON.stringify({version:2,heartbeats:r}));return this._heartbeatsCache.lastSentHeartbeatDate=n,i.length>0?(this._heartbeatsCache.heartbeats=i,yield this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),o}catch(n){return Xo.warn(n),""}})}};function eG(){return new Date().toISOString().substring(0,10)}function PZ(t,e=LZ){let n=[],r=t.slice();for(let i of t){let o=n.find(s=>s.agent===i.agent);if(o){if(o.dates.push(i.date),tG(n)>e){o.dates.pop();break}}else if(n.push({agent:i.agent,dates:[i.date]}),tG(n)>e){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}var uN=class{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}runIndexedDBEnvironmentCheck(){return y(this,null,function*(){return md()?kB().then(()=>!0).catch(()=>!1):!1})}read(){return y(this,null,function*(){if(yield this._canUseIndexedDBPromise){let n=yield OZ(this.app);return n?.heartbeats?n:{heartbeats:[]}}else return{heartbeats:[]}})}overwrite(e){return y(this,null,function*(){var n;if(yield this._canUseIndexedDBPromise){let i=yield this.read();return ZB(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:i.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return})}add(e){return y(this,null,function*(){var n;if(yield this._canUseIndexedDBPromise){let i=yield this.read();return ZB(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:i.lastSentHeartbeatDate,heartbeats:[...i.heartbeats,...e.heartbeats]})}else return})}};function tG(t){return _p(JSON.stringify({version:2,heartbeats:t})).length}function xZ(t){if(t.length===0)return-1;let e=0,n=t[0].date;for(let r=1;r<t.length;r++)t[r].date<n&&(n=t[r].date,e=r);return e}function kZ(t){qn(new Qt("platform-logger",e=>new iN(e),"PRIVATE")),qn(new Qt("heartbeat",e=>new lN(e),"PRIVATE")),$e(oN,QB,t),$e(oN,QB,"esm2017"),$e("fire-js","")}kZ("");var FZ="firebase",UZ="11.10.0";$e(FZ,UZ,"app");function dPe(t){t||(t=Q(zn));let e=new he(n=>{if(t.destroyed){n.next();return}return t.onDestroy(n.next.bind(n))});return n=>n.pipe(Is(e))}function hPe(t,e){let n=e?.injector??Q(Ye),r=new cc(1),i=VD(()=>{let o;try{o=t()}catch(s){Wf(()=>r.error(s));return}Wf(()=>r.next(o))},{injector:n,manualCleanup:!0});return n.get(zn).onDestroy(()=>{i.destroy(),r.complete()}),r.asObservable()}function fPe(t,e){let r=!e?.manualCleanup?e?.injector?.get(zn)??Q(zn):null,i=VZ(e?.equal),o;e?.requireSync?o=Nc({kind:0},{equal:i}):o=Nc({kind:1,value:e?.initialValue},{equal:i});let s,a=t.subscribe({next:c=>o.set({kind:1,value:c}),error:c=>{o.set({kind:2,error:c}),s?.()},complete:()=>{s?.()}});if(e?.requireSync&&o().kind===0)throw new ee(601,!1);return s=r?.onDestroy(a.unsubscribe.bind(a)),zf(()=>{let c=o();switch(c.kind){case 1:return c.value;case 2:throw c.error;case 0:throw new ee(601,!1)}},{equal:e?.equal})}function VZ(t=Object.is){return(e,n)=>e.kind===1&&n.kind===1&&t(e.value,n.value)}function iG(t){t===void 0&&(t=Q(Ye));let e=t.get(Ji);return n=>new he(r=>{let i=e.add(),o=!1;function s(){o||(i(),o=!0)}let a=n.subscribe({next:c=>{r.next(c),s()},complete:()=>{r.complete(),s()},error:c=>{r.error(c),s()}});return a.add(()=>{r.unsubscribe(),s()}),a})}var _i=new fc("ANGULARFIRE2_VERSION");function Ys(t,e,n){if(e){if(e.length===1)return e[0];let o=e.filter(s=>s.app===n);if(o.length===1)return o[0]}return n.container.getProvider(t).getImmediate({optional:!0})}var Qo=(t,e)=>{let n=e?[e]:ty(),r=[];return n.forEach(i=>{i.container.getProvider(t).instances.forEach(s=>{r.includes(s)||r.push(s)})}),r},Ed=(function(t){return t[t.SILENT=0]="SILENT",t[t.WARN=1]="WARN",t[t.VERBOSE=2]="VERBOSE",t})(Ed||{}),oG=XD()&&typeof Zone<"u"?Ed.WARN:Ed.SILENT;var ny=class{zone;delegate;constructor(e,n=$S){this.zone=e,this.delegate=n}now(){return this.delegate.now()}schedule(e,n,r){let i=this.zone,o=function(s){i?i.runGuarded(()=>{e.apply(this,[s])}):e.apply(this,[s])};return this.delegate.schedule(o,n,r)}},Ti=(()=>{class t{outsideAngular;insideAngular;constructor(){let n=Q(Re);this.outsideAngular=n.runOutsideAngular(()=>new ny(typeof Zone>"u"?void 0:Zone.current)),this.insideAngular=n.run(()=>new ny(typeof Zone>"u"?void 0:Zone.current,Nn))}static \u0275fac=function(r){return new(r||t)};static \u0275prov=Z({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})(),sG=!1;function BZ(t,e){!sG&&(oG>Ed.SILENT||XD())&&(sG=!0,console.warn("Calling Firebase APIs outside of an Injection context may destabilize your application leading to subtle change-detection and hydration bugs. Find more at https://github.com/angular/angularfire/blob/main/docs/zones.md")),oG>=e&&console.warn(`Firebase API called outside injection context: ${t.name}`)}function GZ(t){let e=Q(Re,{optional:!0});return e?e.runOutsideAngular(()=>t()):t()}function Yc(t){let e=Q(Re,{optional:!0});return e?e.run(()=>t()):t()}var jZ=(t,e,n)=>(...r)=>(e&&setTimeout(e,0),Wi(n,()=>Yc(()=>t.apply(void 0,r)))),fe=(t,e,n)=>(n||=e?Ed.WARN:Ed.VERBOSE,function(){let r,i=arguments,o,s,a;try{o=Q(Ti),s=Q(Ji),a=Q(Ln)}catch{return BZ(t,n),t.apply(this,i)}for(let l=0;l<arguments.length;l++)typeof i[l]=="function"&&(e&&(r||=Yc(()=>s.add())),i[l]=jZ(i[l],r,a));let c=GZ(()=>t.apply(this,i));return e?c instanceof he?c.pipe(Ts(o.outsideAngular),_s(o.insideAngular),iG(a)):c instanceof Promise?Yc(()=>{let l=s.add();return new Promise((d,h)=>{c.then(f=>Wi(a,()=>Yc(()=>d(f))),f=>Wi(a,()=>Yc(()=>h(f)))).finally(l)})}):typeof c=="function"&&r?function(){return setTimeout(r,0),c.apply(this,arguments)}:Yc(()=>c):c instanceof he?c.pipe(Ts(o.outsideAngular),_s(o.insideAngular)):Yc(()=>c)});var yi=class{constructor(e){return e}},Jo=class{constructor(){return ty()}};function HZ(t){return t&&t.length===1?t[0]:new yi(ir())}var hN=new K("angularfire2._apps"),$Z={provide:yi,useFactory:HZ,deps:[[new zt,hN]]},WZ={provide:Jo,deps:[[new zt,hN]]};function zZ(t){return(e,n)=>{let r=n.get(Go);$e("angularfire",_i.full,"core"),$e("angularfire",_i.full,"app"),$e("angular",nA.full,r.toString());let i=e.runOutsideAngular(()=>t(n));return new yi(i)}}function OPe(t,...e){return er([$Z,WZ,{provide:hN,useFactory:zZ(t),multi:!0,deps:[Re,Ye,Ti,...e]}])}var LPe=fe(ir,!0);var MPe=fe(dN,!0);var qZ=new Map,KZ={activated:!1,tokenObservers:[]},YZ={initialized:!1,enabled:!1};function Ii(t){return qZ.get(t)||Object.assign({},KZ)}function uG(){return YZ}var XZ="https://content-firebaseappcheck.googleapis.com/v1";var QZ="exchangeDebugToken",aG={OFFSET_DURATION:300*1e3,RETRIAL_MIN_WAIT:30*1e3,RETRIAL_MAX_WAIT:960*1e3},jPe=1440*60*1e3;var gN=class{constructor(e,n,r,i,o){if(this.operation=e,this.retryPolicy=n,this.getWaitDuration=r,this.lowerBound=i,this.upperBound=o,this.pending=null,this.nextErrorWaitInterval=i,i>o)throw new Error("Proactive refresh lower bound greater than upper bound!")}start(){this.nextErrorWaitInterval=this.lowerBound,this.process(!0).catch(()=>{})}stop(){this.pending&&(this.pending.reject("cancelled"),this.pending=null)}isRunning(){return!!this.pending}process(e){return y(this,null,function*(){this.stop();try{this.pending=new cn,this.pending.promise.catch(n=>{}),yield JZ(this.getNextRun(e)),this.pending.resolve(),yield this.pending.promise,this.pending=new cn,this.pending.promise.catch(n=>{}),yield this.operation(),this.pending.resolve(),yield this.pending.promise,this.process(!0).catch(()=>{})}catch(n){this.retryPolicy(n)?this.process(!1).catch(()=>{}):this.stop()}})}getNextRun(e){if(e)return this.nextErrorWaitInterval=this.lowerBound,this.getWaitDuration();{let n=this.nextErrorWaitInterval;return this.nextErrorWaitInterval*=2,this.nextErrorWaitInterval>this.upperBound&&(this.nextErrorWaitInterval=this.upperBound),n}}};function JZ(t){return new Promise(e=>{setTimeout(e,t)})}var ZZ={"already-initialized":"You have already called initializeAppCheck() for FirebaseApp {$appName} with different options. To avoid this error, call initializeAppCheck() with the same options as when it was originally called. This will return the already initialized instance.","use-before-activation":"App Check is being used before initializeAppCheck() is called for FirebaseApp {$appName}. Call initializeAppCheck() before instantiating other Firebase services.","fetch-network-error":"Fetch failed to connect to a network. Check Internet connection. Original error: {$originalErrorMessage}.","fetch-parse-error":"Fetch client could not parse response. Original error: {$originalErrorMessage}.","fetch-status-error":"Fetch server returned an HTTP error status. HTTP status: {$httpStatus}.","storage-open":"Error thrown when opening storage. Original error: {$originalErrorMessage}.","storage-get":"Error thrown when reading from storage. Original error: {$originalErrorMessage}.","storage-set":"Error thrown when writing to storage. Original error: {$originalErrorMessage}.","recaptcha-error":"ReCAPTCHA error.","initial-throttle":"{$httpStatus} error. Attempts allowed again after {$time}",throttled:"Requests throttled due to previous {$httpStatus} error. Attempts allowed again after {$time}"},Xs=new mi("appCheck","AppCheck",ZZ);function dG(t){if(!Ii(t).activated)throw Xs.create("use-before-activation",{appName:t.name})}function hG(r,i){return y(this,arguments,function*({url:t,body:e},n){let o={"Content-Type":"application/json"},s=n.getImmediate({optional:!0});if(s){let g=yield s.getHeartbeatsHeader();g&&(o["X-Firebase-Client"]=g)}let a={method:"POST",body:JSON.stringify(e),headers:o},c;try{c=yield fetch(t,a)}catch(g){throw Xs.create("fetch-network-error",{originalErrorMessage:g?.message})}if(c.status!==200)throw Xs.create("fetch-status-error",{httpStatus:c.status});let l;try{l=yield c.json()}catch(g){throw Xs.create("fetch-parse-error",{originalErrorMessage:g?.message})}let d=l.ttl.match(/^([\d.]+)(s)$/);if(!d||!d[2]||isNaN(Number(d[1])))throw Xs.create("fetch-parse-error",{originalErrorMessage:`ttl field (timeToLive) is not in standard Protobuf Duration format: ${l.ttl}`});let h=Number(d[1])*1e3,f=Date.now();return{token:l.token,expireTimeMillis:f+h,issuedAtTimeMillis:f}})}function fG(t,e){let{projectId:n,appId:r,apiKey:i}=t.options;return{url:`${XZ}/projects/${n}/apps/${r}:${QZ}?key=${i}`,body:{debug_token:e}}}var eee="firebase-app-check-database",tee=1,mN="firebase-app-check-store";var ry=null;function nee(){return ry||(ry=new Promise((t,e)=>{try{let n=indexedDB.open(eee,tee);n.onsuccess=r=>{t(r.target.result)},n.onerror=r=>{var i;e(Xs.create("storage-open",{originalErrorMessage:(i=r.target.error)===null||i===void 0?void 0:i.message}))},n.onupgradeneeded=r=>{let i=r.target.result;r.oldVersion===0&&i.createObjectStore(mN,{keyPath:"compositeKey"})}}catch(n){e(Xs.create("storage-open",{originalErrorMessage:n?.message}))}}),ry)}function ree(t,e){return iee(oee(t),e)}function iee(t,e){return y(this,null,function*(){let r=(yield nee()).transaction(mN,"readwrite"),o=r.objectStore(mN).put({compositeKey:t,value:e});return new Promise((s,a)=>{o.onsuccess=c=>{s()},r.onerror=c=>{var l;a(Xs.create("storage-set",{originalErrorMessage:(l=c.target.error)===null||l===void 0?void 0:l.message}))}})})}function oee(t){return`${t.options.appId}-${t.name}`}var Rp=new qr("@firebase/app-check");function fN(t,e){return md()?ree(t,e).catch(n=>{Rp.warn(`Failed to write token to IndexedDB. Error: ${n}`)}):Promise.resolve()}function pG(){return uG().enabled}function gG(){return y(this,null,function*(){let t=uG();if(t.enabled&&t.token)return t.token.promise;throw Error(`
139
139
  Can't get debug token in production mode.
140
140
  `)})}var see={error:"UNKNOWN_ERROR"};function aee(t){return pd.encodeString(JSON.stringify(t),!1)}function EN(t,e=!1,n=!1){return y(this,null,function*(){let r=t.app;dG(r);let i=Ii(r),o=i.token,s;if(o&&!Np(o)&&(i.token=void 0,o=void 0),!o){let l=yield i.cachedTokenPromise;l&&(Np(l)?o=l:yield fN(r,void 0))}if(!e&&o&&Np(o))return{token:o.token};let a=!1;if(pG())try{i.exchangeTokenPromise||(i.exchangeTokenPromise=hG(fG(r,yield gG()),t.heartbeatServiceProvider).finally(()=>{i.exchangeTokenPromise=void 0}),a=!0);let l=yield i.exchangeTokenPromise;return yield fN(r,l),i.token=l,{token:l.token}}catch(l){return l.code==="appCheck/throttled"||l.code==="appCheck/initial-throttle"?Rp.warn(l.message):n&&Rp.error(l),pN(l)}try{i.exchangeTokenPromise||(i.exchangeTokenPromise=i.provider.getToken().finally(()=>{i.exchangeTokenPromise=void 0}),a=!0),o=yield Ii(r).exchangeTokenPromise}catch(l){l.code==="appCheck/throttled"||l.code==="appCheck/initial-throttle"?Rp.warn(l.message):n&&Rp.error(l),s=l}let c;return o?s?Np(o)?c={token:o.token,internalError:s}:c=pN(s):(c={token:o.token},i.token=o,yield fN(r,o)):c=pN(s),a&&dee(r,c),c})}function cee(t){return y(this,null,function*(){let e=t.app;dG(e);let{provider:n}=Ii(e);if(pG()){let r=yield gG(),{token:i}=yield hG(fG(e,r),t.heartbeatServiceProvider);return{token:i}}else{let{token:r}=yield n.getToken();return{token:r}}})}function lee(t,e,n,r){let{app:i}=t,o=Ii(i),s={next:n,error:r,type:e};if(o.tokenObservers=[...o.tokenObservers,s],o.token&&Np(o.token)){let a=o.token;Promise.resolve().then(()=>{n({token:a.token}),cG(t)}).catch(()=>{})}o.cachedTokenPromise.then(()=>cG(t))}function mG(t,e){let n=Ii(t),r=n.tokenObservers.filter(i=>i.next!==e);r.length===0&&n.tokenRefresher&&n.tokenRefresher.isRunning()&&n.tokenRefresher.stop(),n.tokenObservers=r}function cG(t){let{app:e}=t,n=Ii(e),r=n.tokenRefresher;r||(r=uee(t),n.tokenRefresher=r),!r.isRunning()&&n.isTokenAutoRefreshEnabled&&r.start()}function uee(t){let{app:e}=t;return new gN(()=>y(null,null,function*(){let n=Ii(e),r;if(n.token?r=yield EN(t,!0):r=yield EN(t),r.error)throw r.error;if(r.internalError)throw r.internalError}),()=>!0,()=>{let n=Ii(e);if(n.token){let r=n.token.issuedAtTimeMillis+(n.token.expireTimeMillis-n.token.issuedAtTimeMillis)*.5+3e5,i=n.token.expireTimeMillis-300*1e3;return r=Math.min(r,i),Math.max(0,r-Date.now())}else return 0},aG.RETRIAL_MIN_WAIT,aG.RETRIAL_MAX_WAIT)}function dee(t,e){let n=Ii(t).tokenObservers;for(let r of n)try{r.type==="EXTERNAL"&&e.error!=null?r.error(e.error):r.next(e)}catch{}}function Np(t){return t.expireTimeMillis-Date.now()>0}function pN(t){return{token:aee(see),error:t}}var _N=class{constructor(e,n){this.app=e,this.heartbeatServiceProvider=n}_delete(){let{tokenObservers:e}=Ii(this.app);for(let n of e)mG(this.app,n.next);return Promise.resolve()}};function hee(t,e){return new _N(t,e)}function fee(t){return{getToken:e=>EN(t,e),getLimitedUseToken:()=>cee(t),addTokenListener:e=>lee(t,"INTERNAL",e),removeTokenListener:e=>mG(t.app,e)}}var pee="@firebase/app-check",gee="0.10.1";var mee="app-check",lG="app-check-internal";function Eee(){qn(new Qt(mee,t=>{let e=t.getProvider("app").getImmediate(),n=t.getProvider("heartbeat");return hee(e,n)},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((t,e,n)=>{t.getProvider(lG).initialize()})),qn(new Qt(lG,t=>{let e=t.getProvider("app-check").getImmediate();return fee(e)},"PUBLIC").setInstantiationMode("EXPLICIT")),$e(pee,gee)}Eee();var _ee="app-check";var Qs=class{constructor(){return Qo(_ee)}};var Tee=["localhost","0.0.0.0","127.0.0.1"],txe=typeof window<"u"&&Tee.includes(window.location.hostname);function RG(){return{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}}var NG=RG,bG=new mi("auth","Firebase",RG());var sy=new qr("@firebase/auth");function yee(t,...e){sy.logLevel<=be.WARN&&sy.warn(`Auth (${Ks}): ${t}`,...e)}function oy(t,...e){sy.logLevel<=be.ERROR&&sy.error(`Auth (${Ks}): ${t}`,...e)}function ay(t,...e){throw MN(t,...e)}function LN(t,...e){return MN(t,...e)}function wG(t,e,n){let r=Object.assign(Object.assign({},NG()),{[e]:n});return new mi("auth","Firebase",r).create(e,{appName:t.name})}function bp(t){return wG(t,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function MN(t,...e){if(typeof t!="string"){let n=e[0],r=[...e.slice(1)];return r[0]&&(r[0].appName=t.name),t._errorFactory.create(n,...r)}return bG.create(t,...e)}function We(t,e,...n){if(!t)throw MN(e,...n)}function wp(t){let e="INTERNAL ASSERTION FAILED: "+t;throw oy(e),new Error(e)}function cy(t,e){t||wp(e)}function Iee(){return EG()==="http:"||EG()==="https:"}function EG(){var t;return typeof self<"u"&&((t=self.location)===null||t===void 0?void 0:t.protocol)||null}function vee(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(Iee()||PB()||"connection"in navigator)?navigator.onLine:!0}function See(){if(typeof navigator>"u")return null;let t=navigator;return t.languages&&t.languages[0]||t.language||null}var Qc=class{constructor(e,n){this.shortDelay=e,this.longDelay=n,cy(n>e,"Short delay should be less than long delay!"),this.isMobile=Tp()||JT()}get(){return vee()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}};function Aee(t,e){cy(t.emulator,"Emulator should always be set here");let{url:n}=t.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}var ly=class{static initialize(e,n,r){this.fetchImpl=e,n&&(this.headersImpl=n),r&&(this.responseImpl=r)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;wp("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;wp("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;wp("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}};var Cee={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"};var Dee=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],Ree=new Qc(3e4,6e4);function PN(t,e){return t.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:t.tenantId}):e}function Pp(o,s,a,c){return y(this,arguments,function*(t,e,n,r,i={}){return OG(t,i,()=>y(null,null,function*(){let l={},d={};r&&(e==="GET"?d=r:l={body:JSON.stringify(r)});let h=vp(Object.assign({key:t.config.apiKey},d)).slice(1),f=yield t._getAdditionalHeaders();f["Content-Type"]="application/json",t.languageCode&&(f["X-Firebase-Locale"]=t.languageCode);let g=Object.assign({method:e,headers:f},l);return MB()||(g.referrerPolicy="no-referrer"),t.emulatorConfig&&vr(t.emulatorConfig.host)&&(g.credentials="include"),ly.fetch()(yield LG(t,t.config.apiHost,n,h),g)}))})}function OG(t,e,n){return y(this,null,function*(){t._canInitEmulator=!1;let r=Object.assign(Object.assign({},Cee),e);try{let i=new IN(t),o=yield Promise.race([n(),i.promise]);i.clearNetworkTimeout();let s=yield o.json();if("needConfirmation"in s)throw iy(t,"account-exists-with-different-credential",s);if(o.ok&&!("errorMessage"in s))return s;{let a=o.ok?s.errorMessage:s.error.message,[c,l]=a.split(" : ");if(c==="FEDERATED_USER_ID_ALREADY_LINKED")throw iy(t,"credential-already-in-use",s);if(c==="EMAIL_EXISTS")throw iy(t,"email-already-in-use",s);if(c==="USER_DISABLED")throw iy(t,"user-disabled",s);let d=r[c]||c.toLowerCase().replace(/[_\s]+/g,"-");if(l)throw wG(t,d,l);ay(t,d)}}catch(i){if(i instanceof nr)throw i;ay(t,"network-request-failed",{message:String(i)})}})}function Nee(o,s,a,c){return y(this,arguments,function*(t,e,n,r,i={}){let l=yield Pp(t,e,n,r,i);return"mfaPendingCredential"in l&&ay(t,"multi-factor-auth-required",{_serverResponse:l}),l})}function LG(t,e,n,r){return y(this,null,function*(){let i=`${e}${n}?${r}`,o=t,s=o.config.emulator?Aee(t.config,i):`${t.config.apiScheme}://${i}`;return Dee.includes(n)&&(yield o._persistenceManagerAvailable,o._getPersistenceType()==="COOKIE")?o._getPersistence()._getFinalTarget(s).toString():s})}var IN=class{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((n,r)=>{this.timer=setTimeout(()=>r(LN(this.auth,"network-request-failed")),Ree.get())})}};function iy(t,e,n){let r={appName:t.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);let i=LN(t,e,r);return i.customData._tokenResponse=n,i}function bee(t,e){return y(this,null,function*(){return Pp(t,"POST","/v1/accounts:delete",e)})}function uy(t,e){return y(this,null,function*(){return Pp(t,"POST","/v1/accounts:lookup",e)})}function Op(t){if(t)try{let e=new Date(Number(t));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}function Ey(t,e=!1){return y(this,null,function*(){let n=Pe(t),r=yield n.getIdToken(e),i=MG(r);We(i&&i.exp&&i.auth_time&&i.iat,n.auth,"internal-error");let o=typeof i.firebase=="object"?i.firebase:void 0,s=o?.sign_in_provider;return{claims:i,token:r,authTime:Op(TN(i.auth_time)),issuedAtTime:Op(TN(i.iat)),expirationTime:Op(TN(i.exp)),signInProvider:s||null,signInSecondFactor:o?.sign_in_second_factor||null}})}function TN(t){return Number(t)*1e3}function MG(t){let[e,n,r]=t.split(".");if(e===void 0||n===void 0||r===void 0)return oy("JWT malformed, contained fewer than 3 sections"),null;try{let i=hd(n);return i?JSON.parse(i):(oy("Failed to decode base64 JWT payload"),null)}catch(i){return oy("Caught error parsing JWT payload as JSON",i?.toString()),null}}function _G(t){let e=MG(t);return We(e,"internal-error"),We(typeof e.exp<"u","internal-error"),We(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}function vN(t,e,n=!1){return y(this,null,function*(){if(n)return e;try{return yield e}catch(r){throw r instanceof nr&&wee(r)&&t.auth.currentUser===t&&(yield t.auth.signOut()),r}})}function wee({code:t}){return t==="auth/user-disabled"||t==="auth/user-token-expired"}var SN=class{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(e){var n;if(e){let r=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),r}else{this.errorBackoff=3e4;let i=((n=this.user.stsTokenManager.expirationTime)!==null&&n!==void 0?n:0)-Date.now()-3e5;return Math.max(0,i)}}schedule(e=!1){if(!this.isRunning)return;let n=this.getInterval(e);this.timerId=setTimeout(()=>y(this,null,function*(){yield this.iteration()}),n)}iteration(){return y(this,null,function*(){try{yield this.user.getIdToken(!0)}catch(e){e?.code==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()})}};var Mp=class{constructor(e,n){this.createdAt=e,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=Op(this.lastLoginAt),this.creationTime=Op(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}};function dy(t){return y(this,null,function*(){var e;let n=t.auth,r=yield t.getIdToken(),i=yield vN(t,uy(n,{idToken:r}));We(i?.users.length,n,"internal-error");let o=i.users[0];t._notifyReloadListener(o);let s=!((e=o.providerUserInfo)===null||e===void 0)&&e.length?PG(o.providerUserInfo):[],a=Oee(t.providerData,s),c=t.isAnonymous,l=!(t.email&&o.passwordHash)&&!a?.length,d=c?l:!1,h={uid:o.localId,displayName:o.displayName||null,photoURL:o.photoUrl||null,email:o.email||null,emailVerified:o.emailVerified||!1,phoneNumber:o.phoneNumber||null,tenantId:o.tenantId||null,providerData:a,metadata:new Mp(o.createdAt,o.lastLoginAt),isAnonymous:d};Object.assign(t,h)})}function xN(t){return y(this,null,function*(){let e=Pe(t);yield dy(e),yield e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)})}function Oee(t,e){return[...t.filter(r=>!e.some(i=>i.providerId===r.providerId)),...e]}function PG(t){return t.map(e=>{var{providerId:n}=e,r=AS(e,["providerId"]);return{providerId:n,uid:r.rawId||"",displayName:r.displayName||null,email:r.email||null,phoneNumber:r.phoneNumber||null,photoURL:r.photoUrl||null}})}function Lee(t,e){return y(this,null,function*(){let n=yield OG(t,{},()=>y(null,null,function*(){let r=vp({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:i,apiKey:o}=t.config,s=yield LG(t,i,"/v1/token",`key=${o}`),a=yield t._getAdditionalHeaders();a["Content-Type"]="application/x-www-form-urlencoded";let c={method:"POST",headers:a,body:r};return t.emulatorConfig&&vr(t.emulatorConfig.host)&&(c.credentials="include"),ly.fetch()(s,c)}));return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}})}function Mee(t,e){return y(this,null,function*(){return Pp(t,"POST","/v2/accounts:revokeToken",PN(t,e))})}var Lp=class t{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){We(e.idToken,"internal-error"),We(typeof e.idToken<"u","internal-error"),We(typeof e.refreshToken<"u","internal-error");let n="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):_G(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,n)}updateFromIdToken(e){We(e.length!==0,"internal-error");let n=_G(e);this.updateTokensAndExpiration(e,null,n)}getToken(e,n=!1){return y(this,null,function*(){return!n&&this.accessToken&&!this.isExpired?this.accessToken:(We(this.refreshToken,e,"user-token-expired"),this.refreshToken?(yield this.refresh(e,this.refreshToken),this.accessToken):null)})}clearRefreshToken(){this.refreshToken=null}refresh(e,n){return y(this,null,function*(){let{accessToken:r,refreshToken:i,expiresIn:o}=yield Lee(e,n);this.updateTokensAndExpiration(r,i,Number(o))})}updateTokensAndExpiration(e,n,r){this.refreshToken=n||null,this.accessToken=e||null,this.expirationTime=Date.now()+r*1e3}static fromJSON(e,n){let{refreshToken:r,accessToken:i,expirationTime:o}=n,s=new t;return r&&(We(typeof r=="string","internal-error",{appName:e}),s.refreshToken=r),i&&(We(typeof i=="string","internal-error",{appName:e}),s.accessToken=i),o&&(We(typeof o=="number","internal-error",{appName:e}),s.expirationTime=o),s}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new t,this.toJSON())}_performRefresh(){return wp("not implemented")}};function Js(t,e){We(typeof t=="string"||typeof t>"u","internal-error",{appName:e})}var Zs=class t{constructor(e){var{uid:n,auth:r,stsTokenManager:i}=e,o=AS(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new SN(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=n,this.auth=r,this.stsTokenManager=i,this.accessToken=i.accessToken,this.displayName=o.displayName||null,this.email=o.email||null,this.emailVerified=o.emailVerified||!1,this.phoneNumber=o.phoneNumber||null,this.photoURL=o.photoURL||null,this.isAnonymous=o.isAnonymous||!1,this.tenantId=o.tenantId||null,this.providerData=o.providerData?[...o.providerData]:[],this.metadata=new Mp(o.createdAt||void 0,o.lastLoginAt||void 0)}getIdToken(e){return y(this,null,function*(){let n=yield vN(this,this.stsTokenManager.getToken(this.auth,e));return We(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,yield this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n})}getIdTokenResult(e){return Ey(this,e)}reload(){return xN(this)}_assign(e){this!==e&&(We(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(n=>Object.assign({},n)),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){let n=new t(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}));return n.metadata._copy(this.metadata),n}_onReload(e){We(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}_updateTokensIfNecessary(e,n=!1){return y(this,null,function*(){let r=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),r=!0),n&&(yield dy(this)),yield this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)})}delete(){return y(this,null,function*(){if(rr(this.auth.app))return Promise.reject(bp(this.auth));let e=yield this.getIdToken();return yield vN(this,bee(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()})}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>Object.assign({},e)),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,n){var r,i,o,s,a,c,l,d;let h=(r=n.displayName)!==null&&r!==void 0?r:void 0,f=(i=n.email)!==null&&i!==void 0?i:void 0,g=(o=n.phoneNumber)!==null&&o!==void 0?o:void 0,E=(s=n.photoURL)!==null&&s!==void 0?s:void 0,I=(a=n.tenantId)!==null&&a!==void 0?a:void 0,S=(c=n._redirectEventId)!==null&&c!==void 0?c:void 0,R=(l=n.createdAt)!==null&&l!==void 0?l:void 0,U=(d=n.lastLoginAt)!==null&&d!==void 0?d:void 0,{uid:G,emailVerified:X,isAnonymous:ce,providerData:ne,stsTokenManager:A}=n;We(G&&A,e,"internal-error");let v=Lp.fromJSON(this.name,A);We(typeof G=="string",e,"internal-error"),Js(h,e.name),Js(f,e.name),We(typeof X=="boolean",e,"internal-error"),We(typeof ce=="boolean",e,"internal-error"),Js(g,e.name),Js(E,e.name),Js(I,e.name),Js(S,e.name),Js(R,e.name),Js(U,e.name);let C=new t({uid:G,auth:e,email:f,emailVerified:X,displayName:h,isAnonymous:ce,photoURL:E,phoneNumber:g,tenantId:I,stsTokenManager:v,createdAt:R,lastLoginAt:U});return ne&&Array.isArray(ne)&&(C.providerData=ne.map(w=>Object.assign({},w))),S&&(C._redirectEventId=S),C}static _fromIdTokenResponse(e,n,r=!1){return y(this,null,function*(){let i=new Lp;i.updateFromServerResponse(n);let o=new t({uid:n.localId,auth:e,stsTokenManager:i,isAnonymous:r});return yield dy(o),o})}static _fromGetAccountInfoResponse(e,n,r){return y(this,null,function*(){let i=n.users[0];We(i.localId!==void 0,"internal-error");let o=i.providerUserInfo!==void 0?PG(i.providerUserInfo):[],s=!(i.email&&i.passwordHash)&&!o?.length,a=new Lp;a.updateFromIdToken(r);let c=new t({uid:i.localId,auth:e,stsTokenManager:a,isAnonymous:s}),l={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:o,metadata:new Mp(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash)&&!o?.length};return Object.assign(c,l),c})}};var TG=new Map;function Xc(t){cy(t instanceof Function,"Expected a class definition");let e=TG.get(t);return e?(cy(e instanceof t,"Instance stored in cache mismatched with class"),e):(e=new t,TG.set(t,e),e)}var Pee=(()=>{class t{constructor(){this.type="NONE",this.storage={}}_isAvailable(){return y(this,null,function*(){return!0})}_set(n,r){return y(this,null,function*(){this.storage[n]=r})}_get(n){return y(this,null,function*(){let r=this.storage[n];return r===void 0?null:r})}_remove(n){return y(this,null,function*(){delete this.storage[n]})}_addListener(n,r){}_removeListener(n,r){}}return t.type="NONE",t})(),AN=Pee;function yN(t,e,n){return`firebase:${t}:${e}:${n}`}var hy=class t{constructor(e,n,r){this.persistence=e,this.auth=n,this.userKey=r;let{config:i,name:o}=this.auth;this.fullUserKey=yN(this.userKey,i.apiKey,o),this.fullPersistenceKey=yN("persistence",i.apiKey,o),this.boundEventHandler=n._onStorageEvent.bind(n),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}getCurrentUser(){return y(this,null,function*(){let e=yield this.persistence._get(this.fullUserKey);if(!e)return null;if(typeof e=="string"){let n=yield uy(this.auth,{idToken:e}).catch(()=>{});return n?Zs._fromGetAccountInfoResponse(this.auth,n,e):null}return Zs._fromJSON(this.auth,e)})}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}setPersistence(e){return y(this,null,function*(){if(this.persistence===e)return;let n=yield this.getCurrentUser();if(yield this.removeCurrentUser(),this.persistence=e,n)return this.setCurrentUser(n)})}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static create(e,n,r="authUser"){return y(this,null,function*(){if(!n.length)return new t(Xc(AN),e,r);let i=(yield Promise.all(n.map(l=>y(null,null,function*(){if(yield l._isAvailable())return l})))).filter(l=>l),o=i[0]||Xc(AN),s=yN(r,e.config.apiKey,e.name),a=null;for(let l of n)try{let d=yield l._get(s);if(d){let h;if(typeof d=="string"){let f=yield uy(e,{idToken:d}).catch(()=>{});if(!f)break;h=yield Zs._fromGetAccountInfoResponse(e,f,d)}else h=Zs._fromJSON(e,d);l!==o&&(a=h),o=l;break}}catch{}let c=i.filter(l=>l._shouldAllowMigration);return!o._shouldAllowMigration||!c.length?new t(o,e,r):(o=c[0],a&&(yield o._set(s,a.toJSON())),yield Promise.all(n.map(l=>y(null,null,function*(){if(l!==o)try{yield l._remove(s)}catch{}}))),new t(o,e,r))})}};function yG(t){let e=t.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(xG(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(xee(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(FG(e))return"Blackberry";if(UG(e))return"Webos";if(kee(e))return"Safari";if((e.includes("chrome/")||Fee(e))&&!e.includes("edge/"))return"Chrome";if(kG(e))return"Android";{let n=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,r=t.match(n);if(r?.length===2)return r[1]}return"Other"}function xee(t=Xt()){return/firefox\//i.test(t)}function kee(t=Xt()){let e=t.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function Fee(t=Xt()){return/crios\//i.test(t)}function xG(t=Xt()){return/iemobile/i.test(t)}function kG(t=Xt()){return/android/i.test(t)}function FG(t=Xt()){return/blackberry/i.test(t)}function UG(t=Xt()){return/webos/i.test(t)}function Uee(t=Xt()){return/iphone|ipad|ipod/i.test(t)||/macintosh/i.test(t)&&/mobile/i.test(t)}function Vee(){return xB()&&document.documentMode===10}function Bee(t=Xt()){return Uee(t)||kG(t)||UG(t)||FG(t)||/windows phone/i.test(t)||xG(t)}function VG(t,e=[]){let n;switch(t){case"Browser":n=yG(Xt());break;case"Worker":n=`${yG(Xt())}-${t}`;break;default:n=t}let r=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${Ks}/${r}`}var CN=class{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,n){let r=o=>new Promise((s,a)=>{try{let c=e(o);s(c)}catch(c){a(c)}});r.onAbort=n,this.queue.push(r);let i=this.queue.length-1;return()=>{this.queue[i]=()=>Promise.resolve()}}runMiddleware(e){return y(this,null,function*(){if(this.auth.currentUser===e)return;let n=[];try{for(let r of this.queue)yield r(e),r.onAbort&&n.push(r.onAbort)}catch(r){n.reverse();for(let i of n)try{i()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:r?.message})}})}};function Gee(n){return y(this,arguments,function*(t,e={}){return Pp(t,"GET","/v2/passwordPolicy",PN(t,e))})}var jee=6,DN=class{constructor(e){var n,r,i,o;let s=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=(n=s.minPasswordLength)!==null&&n!==void 0?n:jee,s.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=s.maxPasswordLength),s.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=s.containsLowercaseCharacter),s.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=s.containsUppercaseCharacter),s.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=s.containsNumericCharacter),s.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=s.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=(i=(r=e.allowedNonAlphanumericCharacters)===null||r===void 0?void 0:r.join(""))!==null&&i!==void 0?i:"",this.forceUpgradeOnSignin=(o=e.forceUpgradeOnSignin)!==null&&o!==void 0?o:!1,this.schemaVersion=e.schemaVersion}validatePassword(e){var n,r,i,o,s,a;let c={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,c),this.validatePasswordCharacterOptions(e,c),c.isValid&&(c.isValid=(n=c.meetsMinPasswordLength)!==null&&n!==void 0?n:!0),c.isValid&&(c.isValid=(r=c.meetsMaxPasswordLength)!==null&&r!==void 0?r:!0),c.isValid&&(c.isValid=(i=c.containsLowercaseLetter)!==null&&i!==void 0?i:!0),c.isValid&&(c.isValid=(o=c.containsUppercaseLetter)!==null&&o!==void 0?o:!0),c.isValid&&(c.isValid=(s=c.containsNumericCharacter)!==null&&s!==void 0?s:!0),c.isValid&&(c.isValid=(a=c.containsNonAlphanumericCharacter)!==null&&a!==void 0?a:!0),c}validatePasswordLengthOptions(e,n){let r=this.customStrengthOptions.minPasswordLength,i=this.customStrengthOptions.maxPasswordLength;r&&(n.meetsMinPasswordLength=e.length>=r),i&&(n.meetsMaxPasswordLength=e.length<=i)}validatePasswordCharacterOptions(e,n){this.updatePasswordCharacterOptionsStatuses(n,!1,!1,!1,!1);let r;for(let i=0;i<e.length;i++)r=e.charAt(i),this.updatePasswordCharacterOptionsStatuses(n,r>="a"&&r<="z",r>="A"&&r<="Z",r>="0"&&r<="9",this.allowedNonAlphanumericCharacters.includes(r))}updatePasswordCharacterOptionsStatuses(e,n,r,i,o){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=n)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=r)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=i)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=o))}};var RN=class{constructor(e,n,r,i){this.app=e,this.heartbeatServiceProvider=n,this.appCheckServiceProvider=r,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new fy(this),this.idTokenSubscription=new fy(this),this.beforeStateQueue=new CN(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=bG,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this._resolvePersistenceManagerAvailable=void 0,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=i.sdkClientVersion,this._persistenceManagerAvailable=new Promise(o=>this._resolvePersistenceManagerAvailable=o)}_initializeWithPersistence(e,n){return n&&(this._popupRedirectResolver=Xc(n)),this._initializationPromise=this.queue(()=>y(this,null,function*(){var r,i,o;if(!this._deleted&&(this.persistenceManager=yield hy.create(this,e),(r=this._resolvePersistenceManagerAvailable)===null||r===void 0||r.call(this),!this._deleted)){if(!((i=this._popupRedirectResolver)===null||i===void 0)&&i._shouldInitProactively)try{yield this._popupRedirectResolver._initialize(this)}catch{}yield this.initializeCurrentUser(n),this.lastNotifiedUid=((o=this.currentUser)===null||o===void 0?void 0:o.uid)||null,!this._deleted&&(this._isInitialized=!0)}})),this._initializationPromise}_onStorageEvent(){return y(this,null,function*(){if(this._deleted)return;let e=yield this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!e)){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),yield this.currentUser.getIdToken();return}yield this._updateCurrentUser(e,!0)}})}initializeCurrentUserFromIdToken(e){return y(this,null,function*(){try{let n=yield uy(this,{idToken:e}),r=yield Zs._fromGetAccountInfoResponse(this,n,e);yield this.directlySetCurrentUser(r)}catch(n){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",n),yield this.directlySetCurrentUser(null)}})}initializeCurrentUser(e){return y(this,null,function*(){var n;if(rr(this.app)){let s=this.app.settings.authIdToken;return s?new Promise(a=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(s).then(a,a))}):this.directlySetCurrentUser(null)}let r=yield this.assertedPersistence.getCurrentUser(),i=r,o=!1;if(e&&this.config.authDomain){yield this.getOrInitRedirectPersistenceManager();let s=(n=this.redirectUser)===null||n===void 0?void 0:n._redirectEventId,a=i?._redirectEventId,c=yield this.tryRedirectSignIn(e);(!s||s===a)&&c?.user&&(i=c.user,o=!0)}if(!i)return this.directlySetCurrentUser(null);if(!i._redirectEventId){if(o)try{yield this.beforeStateQueue.runMiddleware(i)}catch(s){i=r,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(s))}return i?this.reloadAndSetCurrentUserOrClear(i):this.directlySetCurrentUser(null)}return We(this._popupRedirectResolver,this,"argument-error"),yield this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===i._redirectEventId?this.directlySetCurrentUser(i):this.reloadAndSetCurrentUserOrClear(i)})}tryRedirectSignIn(e){return y(this,null,function*(){let n=null;try{n=yield this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{yield this._setRedirectUser(null)}return n})}reloadAndSetCurrentUserOrClear(e){return y(this,null,function*(){try{yield dy(e)}catch(n){if(n?.code!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)})}useDeviceLanguage(){this.languageCode=See()}_delete(){return y(this,null,function*(){this._deleted=!0})}updateCurrentUser(e){return y(this,null,function*(){if(rr(this.app))return Promise.reject(bp(this));let n=e?Pe(e):null;return n&&We(n.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(n&&n._clone(this))})}_updateCurrentUser(e,n=!1){return y(this,null,function*(){if(!this._deleted)return e&&We(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),n||(yield this.beforeStateQueue.runMiddleware(e)),this.queue(()=>y(this,null,function*(){yield this.directlySetCurrentUser(e),this.notifyAuthListeners()}))})}signOut(){return y(this,null,function*(){return rr(this.app)?Promise.reject(bp(this)):(yield this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&(yield this._setRedirectUser(null)),this._updateCurrentUser(null,!0))})}setPersistence(e){return rr(this.app)?Promise.reject(bp(this)):this.queue(()=>y(this,null,function*(){yield this.assertedPersistence.setPersistence(Xc(e))}))}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}validatePassword(e){return y(this,null,function*(){this._getPasswordPolicyInternal()||(yield this._updatePasswordPolicy());let n=this._getPasswordPolicyInternal();return n.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):n.validatePassword(e)})}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}_updatePasswordPolicy(){return y(this,null,function*(){let e=yield Gee(this),n=new DN(e);this.tenantId===null?this._projectPasswordPolicy=n:this._tenantPasswordPolicies[this.tenantId]=n})}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(e){this._errorFactory=new mi("auth","Firebase",e())}onAuthStateChanged(e,n,r){return this.registerStateListener(this.authStateSubscription,e,n,r)}beforeAuthStateChanged(e,n){return this.beforeStateQueue.pushCallback(e,n)}onIdTokenChanged(e,n,r){return this.registerStateListener(this.idTokenSubscription,e,n,r)}authStateReady(){return new Promise((e,n)=>{if(this.currentUser)e();else{let r=this.onAuthStateChanged(()=>{r(),e()},n)}})}revokeAccessToken(e){return y(this,null,function*(){if(this.currentUser){let n=yield this.currentUser.getIdToken(),r={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:n};this.tenantId!=null&&(r.tenantId=this.tenantId),yield Mee(this,r)}})}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:(e=this._currentUser)===null||e===void 0?void 0:e.toJSON()}}_setRedirectUser(e,n){return y(this,null,function*(){let r=yield this.getOrInitRedirectPersistenceManager(n);return e===null?r.removeCurrentUser():r.setCurrentUser(e)})}getOrInitRedirectPersistenceManager(e){return y(this,null,function*(){if(!this.redirectPersistenceManager){let n=e&&Xc(e)||this._popupRedirectResolver;We(n,this,"argument-error"),this.redirectPersistenceManager=yield hy.create(this,[Xc(n._redirectPersistence)],"redirectUser"),this.redirectUser=yield this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager})}_redirectUserForId(e){return y(this,null,function*(){var n,r;return this._isInitialized&&(yield this.queue(()=>y(this,null,function*(){}))),((n=this._currentUser)===null||n===void 0?void 0:n._redirectEventId)===e?this._currentUser:((r=this.redirectUser)===null||r===void 0?void 0:r._redirectEventId)===e?this.redirectUser:null})}_persistUserIfCurrent(e){return y(this,null,function*(){if(e===this.currentUser)return this.queue(()=>y(this,null,function*(){return this.directlySetCurrentUser(e)}))})}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var e,n;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);let r=(n=(e=this.currentUser)===null||e===void 0?void 0:e.uid)!==null&&n!==void 0?n:null;this.lastNotifiedUid!==r&&(this.lastNotifiedUid=r,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,n,r,i){if(this._deleted)return()=>{};let o=typeof n=="function"?n:n.next.bind(n),s=!1,a=this._isInitialized?Promise.resolve():this._initializationPromise;if(We(a,this,"internal-error"),a.then(()=>{s||o(this.currentUser)}),typeof n=="function"){let c=e.addObserver(n,r,i);return()=>{s=!0,c()}}else{let c=e.addObserver(n);return()=>{s=!0,c()}}}directlySetCurrentUser(e){return y(this,null,function*(){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?yield this.assertedPersistence.setCurrentUser(e):yield this.assertedPersistence.removeCurrentUser()})}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return We(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=VG(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}_getAdditionalHeaders(){return y(this,null,function*(){var e;let n={"X-Client-Version":this.clientVersion};this.app.options.appId&&(n["X-Firebase-gmpid"]=this.app.options.appId);let r=yield(e=this.heartbeatServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getHeartbeatsHeader();r&&(n["X-Firebase-Client"]=r);let i=yield this._getAppCheckToken();return i&&(n["X-Firebase-AppCheck"]=i),n})}_getAppCheckToken(){return y(this,null,function*(){var e;if(rr(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;let n=yield(e=this.appCheckServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getToken();return n?.error&&yee(`Error while retrieving App Check token: ${n.error}`),n?.token})}};function BG(t){return Pe(t)}var fy=class{constructor(e){this.auth=e,this.observer=null,this.addObserver=BB(n=>this.observer=n)}get next(){return We(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}};var Hee={loadJS(){return y(this,null,function*(){throw new Error("Unable to load external scripts")})},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function $ee(t){Hee=t}function Wee(t){return`__${t}${Math.floor(Math.random()*1e6)}`}function kN(t,e){let n=uo(t,"auth");if(n.isInitialized()){let i=n.getImmediate(),o=n.getOptions();if(Ei(o,e??{}))return i;ay(i,"already-initialized")}return n.initialize({options:e})}function zee(t,e){let n=e?.persistence||[],r=(Array.isArray(n)?n:[n]).map(Xc);e?.errorMap&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(r,e?.popupRedirectResolver)}var NN=class t{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static _fromIdTokenResponse(e,n,r,i=!1){return y(this,null,function*(){let o=yield Zs._fromIdTokenResponse(e,r,i),s=IG(r);return new t({user:o,providerId:s,_tokenResponse:r,operationType:n})})}static _forOperation(e,n,r){return y(this,null,function*(){yield e._updateTokensIfNecessary(r,!0);let i=IG(r);return new t({user:e,providerId:i,_tokenResponse:r,operationType:n})})}};function IG(t){return t.providerId?t.providerId:"phoneNumber"in t?"phone":null}function qee(t,e){return y(this,null,function*(){return Nee(t,"POST","/v1/accounts:signInWithCustomToken",PN(t,e))})}function FN(t,e){return y(this,null,function*(){if(rr(t.app))return Promise.reject(bp(t));let n=BG(t),r=yield qee(n,{token:e,returnSecureToken:!0}),i=yield NN._fromIdTokenResponse(n,"signIn",r);return yield n._updateCurrentUser(i.user),i})}function _y(t,e,n,r){return Pe(t).onAuthStateChanged(e,n,r)}function UN(t){return Pe(t).signOut()}var py="__sak";var gy=class{constructor(e,n){this.storageRetriever=e,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(py,"1"),this.storage.removeItem(py),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,n){return this.storage.setItem(e,JSON.stringify(n)),Promise.resolve()}_get(e){let n=this.storage.getItem(e);return Promise.resolve(n?JSON.parse(n):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}};var Kee=1e3,Yee=10,Xee=(()=>{class t extends gy{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(n,r)=>this.onStorageEvent(n,r),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=Bee(),this._shouldAllowMigration=!0}forAllChangedKeys(n){for(let r of Object.keys(this.listeners)){let i=this.storage.getItem(r),o=this.localCache[r];i!==o&&n(r,o,i)}}onStorageEvent(n,r=!1){if(!n.key){this.forAllChangedKeys((a,c,l)=>{this.notifyListeners(a,l)});return}let i=n.key;r?this.detachListener():this.stopPolling();let o=()=>{let a=this.storage.getItem(i);!r&&this.localCache[i]===a||this.notifyListeners(i,a)},s=this.storage.getItem(i);Vee()&&s!==n.newValue&&n.newValue!==n.oldValue?setTimeout(o,Yee):o()}notifyListeners(n,r){this.localCache[n]=r;let i=this.listeners[n];if(i)for(let o of Array.from(i))o(r&&JSON.parse(r))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((n,r,i)=>{this.onStorageEvent(new StorageEvent("storage",{key:n,oldValue:r,newValue:i}),!0)})},Kee)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(n,r){Object.keys(this.listeners).length===0&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[n]||(this.listeners[n]=new Set,this.localCache[n]=this.storage.getItem(n)),this.listeners[n].add(r)}_removeListener(n,r){this.listeners[n]&&(this.listeners[n].delete(r),this.listeners[n].size===0&&delete this.listeners[n]),Object.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}_set(n,r){return y(this,null,function*(){yield Za(t.prototype,this,"_set").call(this,n,r),this.localCache[n]=JSON.stringify(r)})}_get(n){return y(this,null,function*(){let r=yield Za(t.prototype,this,"_get").call(this,n);return this.localCache[n]=JSON.stringify(r),r})}_remove(n){return y(this,null,function*(){yield Za(t.prototype,this,"_remove").call(this,n),delete this.localCache[n]})}}return t.type="LOCAL",t})(),Qee=Xee;var Jee=(()=>{class t extends gy{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(n,r){}_removeListener(n,r){}}return t.type="SESSION",t})(),Zee=Jee;function ete(t){return Promise.all(t.map(e=>y(null,null,function*(){try{return{fulfilled:!0,value:yield e}}catch(n){return{fulfilled:!1,reason:n}}})))}var tte=(()=>{class t{constructor(n){this.eventTarget=n,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(n){let r=this.receivers.find(o=>o.isListeningto(n));if(r)return r;let i=new t(n);return this.receivers.push(i),i}isListeningto(n){return this.eventTarget===n}handleEvent(n){return y(this,null,function*(){let r=n,{eventId:i,eventType:o,data:s}=r.data,a=this.handlersMap[o];if(!a?.size)return;r.ports[0].postMessage({status:"ack",eventId:i,eventType:o});let c=Array.from(a).map(d=>y(this,null,function*(){return d(r.origin,s)})),l=yield ete(c);r.ports[0].postMessage({status:"done",eventId:i,eventType:o,response:l})})}_subscribe(n,r){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[n]||(this.handlersMap[n]=new Set),this.handlersMap[n].add(r)}_unsubscribe(n,r){this.handlersMap[n]&&r&&this.handlersMap[n].delete(r),(!r||this.handlersMap[n].size===0)&&delete this.handlersMap[n],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}t.receivers=[];return t})();function nte(t="",e=10){let n="";for(let r=0;r<e;r++)n+=Math.floor(Math.random()*10);return t+n}var bN=class{constructor(e){this.target=e,this.handlers=new Set}removeMessageHandler(e){e.messageChannel&&(e.messageChannel.port1.removeEventListener("message",e.onMessage),e.messageChannel.port1.close()),this.handlers.delete(e)}_send(e,n,r=50){return y(this,null,function*(){let i=typeof MessageChannel<"u"?new MessageChannel:null;if(!i)throw new Error("connection_unavailable");let o,s;return new Promise((a,c)=>{let l=nte("",20);i.port1.start();let d=setTimeout(()=>{c(new Error("unsupported_event"))},r);s={messageChannel:i,onMessage(h){let f=h;if(f.data.eventId===l)switch(f.data.status){case"ack":clearTimeout(d),o=setTimeout(()=>{c(new Error("timeout"))},3e3);break;case"done":clearTimeout(o),a(f.data.response);break;default:clearTimeout(d),clearTimeout(o),c(new Error("invalid_response"));break}}},this.handlers.add(s),i.port1.addEventListener("message",s.onMessage),this.target.postMessage({eventType:e,eventId:l,data:n},[i.port2])}).finally(()=>{s&&this.removeMessageHandler(s)})})}};function vG(){return window}function GG(){return typeof vG().WorkerGlobalScope<"u"&&typeof vG().importScripts=="function"}function rte(){return y(this,null,function*(){if(!navigator?.serviceWorker)return null;try{return(yield navigator.serviceWorker.ready).active}catch{return null}})}function ite(){var t;return((t=navigator?.serviceWorker)===null||t===void 0?void 0:t.controller)||null}function ote(){return GG()?self:null}var jG="firebaseLocalStorageDb",ste=1,my="firebaseLocalStorage",HG="fbase_key",Jc=class{constructor(e){this.request=e}toPromise(){return new Promise((e,n)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{n(this.request.error)})})}};function Ty(t,e){return t.transaction([my],e?"readwrite":"readonly").objectStore(my)}function ate(){let t=indexedDB.deleteDatabase(jG);return new Jc(t).toPromise()}function wN(){let t=indexedDB.open(jG,ste);return new Promise((e,n)=>{t.addEventListener("error",()=>{n(t.error)}),t.addEventListener("upgradeneeded",()=>{let r=t.result;try{r.createObjectStore(my,{keyPath:HG})}catch(i){n(i)}}),t.addEventListener("success",()=>y(null,null,function*(){let r=t.result;r.objectStoreNames.contains(my)?e(r):(r.close(),yield ate(),e(yield wN()))}))})}function SG(t,e,n){return y(this,null,function*(){let r=Ty(t,!0).put({[HG]:e,value:n});return new Jc(r).toPromise()})}function cte(t,e){return y(this,null,function*(){let n=Ty(t,!1).get(e),r=yield new Jc(n).toPromise();return r===void 0?null:r.value})}function AG(t,e){let n=Ty(t,!0).delete(e);return new Jc(n).toPromise()}var lte=800,ute=3,dte=(()=>{class t{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}_openDb(){return y(this,null,function*(){return this.db?this.db:(this.db=yield wN(),this.db)})}_withRetries(n){return y(this,null,function*(){let r=0;for(;;)try{let i=yield this._openDb();return yield n(i)}catch(i){if(r++>ute)throw i;this.db&&(this.db.close(),this.db=void 0)}})}initializeServiceWorkerMessaging(){return y(this,null,function*(){return GG()?this.initializeReceiver():this.initializeSender()})}initializeReceiver(){return y(this,null,function*(){this.receiver=tte._getInstance(ote()),this.receiver._subscribe("keyChanged",(n,r)=>y(this,null,function*(){return{keyProcessed:(yield this._poll()).includes(r.key)}})),this.receiver._subscribe("ping",(n,r)=>y(this,null,function*(){return["keyChanged"]}))})}initializeSender(){return y(this,null,function*(){var n,r;if(this.activeServiceWorker=yield rte(),!this.activeServiceWorker)return;this.sender=new bN(this.activeServiceWorker);let i=yield this.sender._send("ping",{},800);i&&!((n=i[0])===null||n===void 0)&&n.fulfilled&&!((r=i[0])===null||r===void 0)&&r.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)})}notifyServiceWorker(n){return y(this,null,function*(){if(!(!this.sender||!this.activeServiceWorker||ite()!==this.activeServiceWorker))try{yield this.sender._send("keyChanged",{key:n},this.serviceWorkerReceiverAvailable?800:50)}catch{}})}_isAvailable(){return y(this,null,function*(){try{if(!indexedDB)return!1;let n=yield wN();return yield SG(n,py,"1"),yield AG(n,py),!0}catch{}return!1})}_withPendingWrite(n){return y(this,null,function*(){this.pendingWrites++;try{yield n()}finally{this.pendingWrites--}})}_set(n,r){return y(this,null,function*(){return this._withPendingWrite(()=>y(this,null,function*(){return yield this._withRetries(i=>SG(i,n,r)),this.localCache[n]=r,this.notifyServiceWorker(n)}))})}_get(n){return y(this,null,function*(){let r=yield this._withRetries(i=>cte(i,n));return this.localCache[n]=r,r})}_remove(n){return y(this,null,function*(){return this._withPendingWrite(()=>y(this,null,function*(){return yield this._withRetries(r=>AG(r,n)),delete this.localCache[n],this.notifyServiceWorker(n)}))})}_poll(){return y(this,null,function*(){let n=yield this._withRetries(o=>{let s=Ty(o,!1).getAll();return new Jc(s).toPromise()});if(!n)return[];if(this.pendingWrites!==0)return[];let r=[],i=new Set;if(n.length!==0)for(let{fbase_key:o,value:s}of n)i.add(o),JSON.stringify(this.localCache[o])!==JSON.stringify(s)&&(this.notifyListeners(o,s),r.push(o));for(let o of Object.keys(this.localCache))this.localCache[o]&&!i.has(o)&&(this.notifyListeners(o,null),r.push(o));return r})}notifyListeners(n,r){this.localCache[n]=r;let i=this.listeners[n];if(i)for(let o of Array.from(i))o(r)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>y(this,null,function*(){return this._poll()}),lte)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(n,r){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[n]||(this.listeners[n]=new Set,this._get(n)),this.listeners[n].add(r)}_removeListener(n,r){this.listeners[n]&&(this.listeners[n].delete(r),this.listeners[n].size===0&&delete this.listeners[n]),Object.keys(this.listeners).length===0&&this.stopPolling()}}return t.type="LOCAL",t})(),hte=dte;var dxe=Wee("rcb"),hxe=new Qc(3e4,6e4);var fxe=new Qc(2e3,1e4);var pxe=600*1e3;var gxe=new Qc(3e4,6e4);var mxe=new Qc(5e3,15e3);var Exe=encodeURIComponent("fac");var CG="@firebase/auth",DG="1.10.8";var ON=class{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),((e=this.auth.currentUser)===null||e===void 0?void 0:e.uid)||null}getToken(e){return y(this,null,function*(){return this.assertAuthConfigured(),yield this.auth._initializationPromise,this.auth.currentUser?{accessToken:yield this.auth.currentUser.getIdToken(e)}:null})}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;let n=this.auth.onIdTokenChanged(r=>{e(r?.stsTokenManager.accessToken||null)});this.internalListeners.set(e,n),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();let n=this.internalListeners.get(e);n&&(this.internalListeners.delete(e),n(),this.updateProactiveRefresh())}assertAuthConfigured(){We(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}};function fte(t){switch(t){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function pte(t){qn(new Qt("auth",(e,{options:n})=>{let r=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),o=e.getProvider("app-check-internal"),{apiKey:s,authDomain:a}=r.options;We(s&&!s.includes(":"),"invalid-api-key",{appName:r.name});let c={apiKey:s,authDomain:a,clientPlatform:t,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:VG(t)},l=new RN(r,i,o,c);return zee(l,n),l},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,n,r)=>{e.getProvider("auth-internal").initialize()})),qn(new Qt("auth-internal",e=>{let n=BG(e.getProvider("auth").getImmediate());return(r=>new ON(r))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),$e(CG,DG,fte(t)),$e(CG,DG,"esm2017")}var gte=300,_xe=OB("authIdTokenMaxAge")||gte;function mte(){var t,e;return(e=(t=document.getElementsByTagName("head"))===null||t===void 0?void 0:t[0])!==null&&e!==void 0?e:document}$ee({loadJS(t){return new Promise((e,n)=>{let r=document.createElement("script");r.setAttribute("src",t),r.onload=e,r.onerror=i=>{let o=LN("internal-error");o.customData=i,n(o)},r.type="text/javascript",r.charset="UTF-8",mte().appendChild(r)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="});pte("Browser");function zG(t){return new he(function(e){var n=_y(t,e.next.bind(e),e.error.bind(e),e.complete.bind(e));return{unsubscribe:n}})}var qG="auth",Zc=class{constructor(e){return e}},el=class{constructor(){return Qo(qG)}};var VN=new K("angularfire2.auth-instances");function cne(t,e){let n=Ys(qG,t,e);return n&&new Zc(n)}function lne(t){return(e,n)=>{let r=e.runOutsideAngular(()=>t(n));return new Zc(r)}}var une={provide:el,deps:[[new zt,VN]]},dne={provide:Zc,useFactory:cne,deps:[[new zt,VN],yi]};function gke(t,...e){return $e("angularfire",_i.full,"auth"),er([dne,une,{provide:VN,useFactory:lne(t),multi:!0,deps:[Re,Ye,Ti,Jo,[new zt,Qs],...e]}])}var _d=fe(zG,!0);var xp=fe(Ey,!0);var mke=fe(kN,!0);var KG=fe(FN,!0,2);var YG=fe(UN,!0,2);var fne="type.googleapis.com/google.protobuf.Int64Value",pne="type.googleapis.com/google.protobuf.UInt64Value";function ZG(t,e){let n={};for(let r in t)t.hasOwnProperty(r)&&(n[r]=e(t[r]));return n}function yy(t){if(t==null)return null;if(t instanceof Number&&(t=t.valueOf()),typeof t=="number"&&isFinite(t)||t===!0||t===!1||Object.prototype.toString.call(t)==="[object String]")return t;if(t instanceof Date)return t.toISOString();if(Array.isArray(t))return t.map(e=>yy(e));if(typeof t=="function"||typeof t=="object")return ZG(t,e=>yy(e));throw new Error("Data cannot be encoded in JSON: "+t)}function Td(t){if(t==null)return t;if(t["@type"])switch(t["@type"]){case fne:case pne:{let e=Number(t.value);if(isNaN(e))throw new Error("Data cannot be decoded from JSON: "+t);return e}default:throw new Error("Data cannot be decoded from JSON: "+t)}return Array.isArray(t)?t.map(e=>Td(e)):typeof t=="function"||typeof t=="object"?ZG(t,e=>Td(e)):t}var HN="functions";var XG={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENTED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"},or=class t extends nr{constructor(e,n,r){super(`${HN}/${e}`,n||""),this.details=r,Object.setPrototypeOf(this,t.prototype)}};function gne(t){if(t>=200&&t<300)return"ok";switch(t){case 0:return"internal";case 400:return"invalid-argument";case 401:return"unauthenticated";case 403:return"permission-denied";case 404:return"not-found";case 409:return"aborted";case 429:return"resource-exhausted";case 499:return"cancelled";case 500:return"internal";case 501:return"unimplemented";case 503:return"unavailable";case 504:return"deadline-exceeded"}return"unknown"}function Iy(t,e){let n=gne(t),r=n,i;try{let o=e&&e.error;if(o){let s=o.status;if(typeof s=="string"){if(!XG[s])return new or("internal","internal");n=XG[s],r=s}let a=o.message;typeof a=="string"&&(r=a),i=o.details,i!==void 0&&(i=Td(i))}}catch{}return n==="ok"?null:new or(n,r,i)}var BN=class{constructor(e,n,r,i){this.app=e,this.auth=null,this.messaging=null,this.appCheck=null,this.serverAppAppCheckToken=null,rr(e)&&e.settings.appCheckToken&&(this.serverAppAppCheckToken=e.settings.appCheckToken),this.auth=n.getImmediate({optional:!0}),this.messaging=r.getImmediate({optional:!0}),this.auth||n.get().then(o=>this.auth=o,()=>{}),this.messaging||r.get().then(o=>this.messaging=o,()=>{}),this.appCheck||i?.get().then(o=>this.appCheck=o,()=>{})}getAuthToken(){return y(this,null,function*(){if(this.auth)try{let e=yield this.auth.getToken();return e?.accessToken}catch{return}})}getMessagingToken(){return y(this,null,function*(){if(!(!this.messaging||!("Notification"in self)||Notification.permission!=="granted"))try{return yield this.messaging.getToken()}catch{return}})}getAppCheckToken(e){return y(this,null,function*(){if(this.serverAppAppCheckToken)return this.serverAppAppCheckToken;if(this.appCheck){let n=e?yield this.appCheck.getLimitedUseToken():yield this.appCheck.getToken();return n.error?null:n.token}return null})}getContext(e){return y(this,null,function*(){let n=yield this.getAuthToken(),r=yield this.getMessagingToken(),i=yield this.getAppCheckToken(e);return{authToken:n,messagingToken:r,appCheckToken:i}})}};var GN="us-central1",mne=/^data: (.*?)(?:\n|$)/;function Ene(t){let e=null;return{promise:new Promise((n,r)=>{e=setTimeout(()=>{r(new or("deadline-exceeded","deadline-exceeded"))},t)}),cancel:()=>{e&&clearTimeout(e)}}}var jN=class{constructor(e,n,r,i,o=GN,s=(...a)=>fetch(...a)){this.app=e,this.fetchImpl=s,this.emulatorOrigin=null,this.contextProvider=new BN(e,n,r,i),this.cancelAllRequests=new Promise(a=>{this.deleteService=()=>Promise.resolve(a())});try{let a=new URL(o);this.customDomain=a.origin+(a.pathname==="/"?"":a.pathname),this.region=GN}catch{this.customDomain=null,this.region=o}}_delete(){return this.deleteService()}_url(e){let n=this.app.options.projectId;return this.emulatorOrigin!==null?`${this.emulatorOrigin}/${n}/${this.region}/${e}`:this.customDomain!==null?`${this.customDomain}/${e}`:`https://${this.region}-${n}.cloudfunctions.net/${e}`}};function _ne(t,e,n){let r=vr(e);t.emulatorOrigin=`http${r?"s":""}://${e}:${n}`,r&&($s(t.emulatorOrigin),qc("Functions",!0))}function Tne(t,e,n){let r=i=>Ine(t,e,i,n||{});return r.stream=(i,o)=>vne(t,e,i,o||{}),r}function yne(t,e,n,r){return y(this,null,function*(){n["Content-Type"]="application/json";let i;try{i=yield r(t,{method:"POST",body:JSON.stringify(e),headers:n})}catch{return{status:0,json:null}}let o=null;try{o=yield i.json()}catch{}return{status:i.status,json:o}})}function e2(t,e){return y(this,null,function*(){let n={},r=yield t.contextProvider.getContext(e.limitedUseAppCheckTokens);return r.authToken&&(n.Authorization="Bearer "+r.authToken),r.messagingToken&&(n["Firebase-Instance-ID-Token"]=r.messagingToken),r.appCheckToken!==null&&(n["X-Firebase-AppCheck"]=r.appCheckToken),n})}function Ine(t,e,n,r){return y(this,null,function*(){n=yy(n);let i={data:n},o=yield e2(t,r),s=r.timeout||7e4,a=Ene(s),c=yield Promise.race([yne(e,i,o,t.fetchImpl),a.promise,t.cancelAllRequests]);if(a.cancel(),!c)throw new or("cancelled","Firebase Functions instance was deleted.");let l=Iy(c.status,c.json);if(l)throw l;if(!c.json)throw new or("internal","Response is not valid JSON object.");let d=c.json.data;if(typeof d>"u"&&(d=c.json.result),typeof d>"u")throw new or("internal","Response is missing data field.");return{data:Td(d)}})}function vne(t,e,n,r){return y(this,null,function*(){var i;n=yy(n);let o={data:n},s=yield e2(t,r);s["Content-Type"]="application/json",s.Accept="text/event-stream";let a;try{a=yield t.fetchImpl(e,{method:"POST",body:JSON.stringify(o),headers:s,signal:r?.signal})}catch(g){if(g instanceof Error&&g.name==="AbortError"){let I=new or("cancelled","Request was cancelled.");return{data:Promise.reject(I),stream:{[Symbol.asyncIterator](){return{next(){return Promise.reject(I)}}}}}}let E=Iy(0,null);return{data:Promise.reject(E),stream:{[Symbol.asyncIterator](){return{next(){return Promise.reject(E)}}}}}}let c,l,d=new Promise((g,E)=>{c=g,l=E});(i=r?.signal)===null||i===void 0||i.addEventListener("abort",()=>{let g=new or("cancelled","Request was cancelled.");l(g)});let h=a.body.getReader(),f=Sne(h,c,l,r?.signal);return{stream:{[Symbol.asyncIterator](){let g=f.getReader();return{next(){return y(this,null,function*(){let{value:I,done:S}=yield g.read();return{value:I,done:S}})},return(){return y(this,null,function*(){return yield g.cancel(),{done:!0,value:void 0}})}}}},data:d}})}function Sne(t,e,n,r){let i=(s,a)=>{let c=s.match(mne);if(!c)return;let l=c[1];try{let d=JSON.parse(l);if("result"in d){e(Td(d.result));return}if("message"in d){a.enqueue(Td(d.message));return}if("error"in d){let h=Iy(0,d);a.error(h),n(h);return}}catch(d){if(d instanceof or){a.error(d),n(d);return}}},o=new TextDecoder;return new ReadableStream({start(s){let a="";return c();function c(){return y(this,null,function*(){if(r?.aborted){let l=new or("cancelled","Request was cancelled");return s.error(l),n(l),Promise.resolve()}try{let{value:l,done:d}=yield t.read();if(d){a.trim()&&i(a.trim(),s),s.close();return}if(r?.aborted){let f=new or("cancelled","Request was cancelled");s.error(f),n(f),yield t.cancel();return}a+=o.decode(l,{stream:!0});let h=a.split(`
141
- `);a=h.pop()||"";for(let f of h)f.trim()&&i(f.trim(),s);return c()}catch(l){let d=l instanceof or?l:Iy(0,null);s.error(d),n(d)}})}},cancel(){return t.cancel()}})}var QG="@firebase/functions",JG="0.12.9";var Ane="auth-internal",Cne="app-check-internal",Dne="messaging-internal";function Rne(t){let e=(n,{instanceIdentifier:r})=>{let i=n.getProvider("app").getImmediate(),o=n.getProvider(Ane),s=n.getProvider(Dne),a=n.getProvider(Cne);return new jN(i,o,s,a,r)};qn(new Qt(HN,e,"PUBLIC").setMultipleInstances(!0)),$e(QG,JG,t),$e(QG,JG,"esm2017")}function t2(t=ir(),e=GN){let r=uo(Pe(t),HN).getImmediate({identifier:e}),i=gd("functions");return i&&$N(r,...i),r}function $N(t,e,n){_ne(Pe(t),e,n)}function n2(t,e,n){return Tne(Pe(t),e,n)}Rne();var Zo=class{constructor(e){return e}},r2="functions",WN=class{constructor(){return Qo(r2)}};var zN=new K("angularfire2.functions-instances");function Nne(t,e){let n=Ys(r2,t,e);return n&&new Zo(n)}function bne(t){return(e,n)=>{let r=e.runOutsideAngular(()=>t(n));return new Zo(r)}}var wne={provide:WN,deps:[[new zt,zN]]},One={provide:Zo,useFactory:Nne,deps:[[new zt,zN],yi]};function Pke(t,...e){return $e("angularfire",_i.full,"fn"),er([One,wne,{provide:zN,useFactory:bne(t),multi:!0,deps:[Re,Ye,Ti,Jo,[new zt,el],[new zt,Qs],...e]}])}var xke=fe($N,!0),kke=fe(t2,!0);var i2=fe(n2,!0);var s2={httpsCallableFromURL:i2};function yd(t,e,n){return n?s2.httpsCallableFromURL(t,e,n):s2.httpsCallableFromURL(t,e)}var fo=(()=>{let e=class e{constructor(r,i){this.loggingService=r,this.analyticsService=i,this.config$=new de(null),this.disableLogsConfig$=new de({warnings:!0,suppressAll:!1}),this.apiKey$=new de(""),this.baseFeatureAllowList=[],this.runtimeDisabledFeatures=new Set,this.sf$=new de(!1),this.sdkType$=new de("core"),this.logsEnabled$=new de(!0),this.safeEval$=new de(!1),this.firestorePersistentCacheEnabled$=new de(!1),this.encryptionProvider$=new de(null);try{this.analyticsService.setConfigService(this),this.sdkType$.subscribe(o=>{this.analyticsService.updateDefaultProperties({sdkType:o})},o=>{this.loggingService.catch("Error in ConfigService sdkType$: ",o)}),this.logsEnabled$.subscribe(o=>{o?this.loggingService.enableLogs():this.loggingService.disableLogs(),O.logsEnabled=o},o=>{this.loggingService.catch("Error in ConfigService logsEnabled$: ",o)})}catch(o){this.loggingService.catch("Error in ConfigService constructor: ",o)}}initConfig(r){try{r.featureAllowList?.length||(r.featureAllowList=Object.values(_R)),this.baseFeatureAllowList=r.featureAllowList?.slice();try{r.proxyConfig?.authHost?localStorage.setItem(k.LOCAL_STORAGE.VELT_AUTH_PROXY_HOST,btoa(r.proxyConfig.authHost)):localStorage.removeItem(k.LOCAL_STORAGE.VELT_AUTH_PROXY_HOST)}catch{}this.config$.next(r)}catch(i){this.loggingService.catch("Error in ConfigService initConfig: ",i)}}setApiKey(r){this.apiKey$.next(r)}getApiKey(){return this.apiKey$.value}getApiKey$(){return this.apiKey$.asObservable()}getConfig(){return this.config$.value}getConfig$(){return this.config$.asObservable()}disableFeatures(r){try{let i=this.config$.value;this.runtimeDisabledFeatures=new Set(r??[]),i&&(r?.length?i.featureAllowList=this.baseFeatureAllowList.filter(o=>!r.includes(o)):i.featureAllowList=this.baseFeatureAllowList.slice()),this.config$.next(i)}catch(i){this.loggingService.catch("Error in ConfigService disableFeatures: ",i)}}enableFeatures(r){try{if(!r?.length)return;let i=this.config$.value;if(!i)return;let o=i.featureAllowList??[],s=r.filter(a=>!o.includes(a)&&!this.runtimeDisabledFeatures.has(a));if(s.length===0)return;i.featureAllowList=[...o,...s],this.baseFeatureAllowList=[...this.baseFeatureAllowList,...s.filter(a=>!this.baseFeatureAllowList.includes(a))],this.config$.next(i)}catch(i){this.loggingService.catch("Error in ConfigService enableFeatures: ",i)}}setSF(r){try{this.sf$.next(r),this.analyticsService.setSF(r)}catch(i){this.loggingService.catch("Error in ConfigService setSF: ",i)}}getSF(){try{return this.sf$.value}catch(r){return this.loggingService.catch("Error in ConfigService getSF: ",r),!1}}getSF$(){try{return this.sf$.asObservable().pipe(ai(gp))}catch(r){return this.loggingService.catch("Error in ConfigService getSF$: ",r),st(!1)}}setSdkType(r){try{this.sdkType$.next(r)}catch(i){this.loggingService.catch("Error in ConfigService setSdkType: ",i)}}getSdkType(){try{return this.sdkType$.value}catch(r){return this.loggingService.catch("Error in ConfigService getSdkType: ",r),"core"}}getSdkType$(){try{return this.sdkType$.asObservable()}catch(r){return this.loggingService.catch("Error in ConfigService getSdkType$: ",r),st("core")}}enableLogs(){try{if(this.logsEnabled$.value===!0)return;this.logsEnabled$.next(!0)}catch(r){this.loggingService.catch("Error in ConfigService enableLogs: ",r)}}disableLogs(r){try{r&&this.disableLogsConfig$.next({warnings:r.warnings??!0,suppressAll:r.suppressAll??!1}),r?.warnings!==!1&&this.logsEnabled$.next(!1)}catch(i){this.loggingService.catch("Error in ConfigService disableLogs: ",i)}}getDisableLogsConfig(){return this.disableLogsConfig$.value}getDisableLogsConfig$(){return this.disableLogsConfig$.asObservable()}getProxyConfig(){try{return this.config$.value?.proxyConfig}catch(r){this.loggingService.catch("Error in ConfigService getProxyConfig: ",r);return}}getAuthProxyHost(){try{let r=this.config$.value?.proxyConfig?.authHost;if(r)return r;let i=localStorage.getItem(k.LOCAL_STORAGE.VELT_AUTH_PROXY_HOST);return i?atob(i):void 0}catch(r){this.loggingService.catch("Error in ConfigService getAuthProxyHost: ",r);return}}getApiHost(){try{return this.getProxyConfig()?.apiHost||this.config$.value?.apiProxyDomain}catch(r){this.loggingService.catch("Error in ConfigService getApiHost: ",r);return}}getApiProxyDomain(){return this.getApiHost()}getSelfHostedConfig(){try{return this.config$.value?.selfHosted}catch(r){this.loggingService.catch("Error in ConfigService getSelfHostedConfig: ",r);return}}getEnablePortableBackend(){try{return this.config$.value?.selfHosted?.enablePortableBackend===!0}catch(r){return this.loggingService.catch("Error in ConfigService getEnablePortableBackend: ",r),!1}}enableSafeEval(){try{this.safeEval$.next(!0)}catch(r){this.loggingService.catch("Error in ConfigService enableSafeEval: ",r)}}disableSafeEval(){try{this.safeEval$.next(!1)}catch(r){this.loggingService.catch("Error in ConfigService disableSafeEval: ",r)}}getSafeEval(){try{return this.safeEval$.value}catch(r){return this.loggingService.catch("Error in ConfigService getSafeEval: ",r),!1}}getSafeEval$(){try{return this.safeEval$.asObservable()}catch(r){return this.loggingService.catch("Error in ConfigService getSafeEval$: ",r),st(!1)}}enableFirestorePersistentCache(){try{this.firestorePersistentCacheEnabled$.next(!0)}catch(r){this.loggingService.catch("Error in ConfigService enableFirestorePersistentCache: ",r)}}disableFirestorePersistentCache(){try{this.firestorePersistentCacheEnabled$.next(!1)}catch(r){this.loggingService.catch("Error in ConfigService disableFirestorePersistentCache: ",r)}}isFirestorePersistentCacheEnabled(){try{return this.firestorePersistentCacheEnabled$.value}catch(r){return this.loggingService.catch("Error in ConfigService isFirestorePersistentCacheEnabled: ",r),!1}}getFirestorePersistentCacheEnabled$(){try{return this.firestorePersistentCacheEnabled$.asObservable()}catch(r){return this.loggingService.catch("Error in ConfigService getFirestorePersistentCacheEnabled$: ",r),st(!1)}}setEncryptionProvider(r){try{this.loggingService.log("%c[WB] Calling FUNCTION: setEncryptionProvider","color: green;"),this.encryptionProvider$.next(r)}catch(i){this.loggingService.catch("Error in ConfigService setEncryptionProvider: ",i)}}getEncryptionProvider(){try{return this.encryptionProvider$.value}catch(r){return this.loggingService.catch("Error in ConfigService getEncryptionProvider: ",r),null}}getEncryptionProvider$(){try{return this.encryptionProvider$.asObservable()}catch(r){return this.loggingService.catch("Error in ConfigService getEncryptionProvider$: ",r),st(null)}}};e.\u0275fac=function(i){return new(i||e)(q(Nt),q(ea))},e.\u0275prov=Z({token:e,factory:e.\u0275fac,providedIn:"root"});let t=e;return t})();var tl={fetch:(t,e)=>fetch(t,e),timeoutMs:12e5,renewalTimeoutMs:3e4,renewalOfflineTimeoutMs:5e3,isOnline:()=>typeof navigator>"u"||navigator.onLine!==!1};function c2(){try{return tl.isOnline()?tl.renewalTimeoutMs:tl.renewalOfflineTimeoutMs}catch{return tl.renewalTimeoutMs}}var Wke=tl.timeoutMs,a2=Symbol("identify-timed-out");function nl(t){return Mne(t,{secure:"https:",loopback:"http:"})}var Lne=["localhost","127.0.0.1","[::1]"];function Mne(t,e){if(!t)return!1;try{let n=new URL(t);return n.protocol===e.secure?!0:n.protocol===e.loopback&&Lne.includes(n.hostname)}catch{return!1}}function l2(t){return`${t.replace(/\/+$/,"")}/identify`}function Pne(t,e="identify"){let n="Could not reach the self-hosted backend for "+e+" ("+t+"). If the SDK is running cross-origin, a likely cause is the gateway's CORS origin allowlist not including this origin (fail-closed deny-by-default) \u2014 verify the operator configured it. This is distinct from a server-side denial, which carries a specific error code.";return Sy(n)}function Sy(t){return{error:t,code:"network_error",message:t,source:"identify"}}function u2(t){return y(this,null,function*(){let e={apiKey:t.apiKey,originDomain:typeof window<"u"?window.location.origin:"",version:t.version,user:t.user};return t.authToken!=null&&(e.authToken=t.authToken),d2({url:t.url,body:e,timeoutMs:tl.timeoutMs,label:"identify"})})}function d2(t){return y(this,null,function*(){let e,n=t.timeoutMs,r=typeof AbortController<"u"?new AbortController:null,i,o=new Promise(a=>{i=setTimeout(()=>{try{r?.abort()}catch{}a(a2)},n)}),s=()=>y(null,null,function*(){let a=yield tl.fetch(t.url,V({method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t.body)},r?{signal:r.signal}:{}));try{return{body:yield a.json()}}catch{return{detail:`unreadable response (HTTP ${a.status}, non-JSON body)`}}});try{let a=yield Promise.race([s(),o]);if(a===a2)e=`no answer within ${n} ms (request timed out and was aborted)`;else{if("body"in a)return a.body;e=a.detail}}catch(a){e=`fetch failed: ${a?.message??a}`}finally{i!==void 0&&clearTimeout(i)}return console.error(`Velt [selfHosted.portableBackendUrl]: ${t.label} ${e} \u2014 ${t.url}`),Pne(e,t.label)})}var KN="refresh_token_invalid",kp=new Set(["domain_not_whitelisted","identify_not_configured","invalid-argument"]);function h2(t,e){return`${t.replace(/\/+$/,"")}/${e}`}function f2(t){let e={apiKey:t.apiKey,refreshToken:t.refreshToken};return d2({url:t.url,body:e,timeoutMs:t.timeoutMs,label:"identify/refresh"})}var es={validateClient:{endpointClass:"core",module:"core"},sdkProxy:{endpointClass:"core",module:"core"},getNotificationsForDocuments:{endpointClass:"core",module:"core"},getPlanDetails:{endpointClass:"advisory",module:"core"},sa:{endpointClass:"telemetry",module:"core"},getIceServers:{endpointClass:"optional",module:"huddle-webrtc"},chatgptCompletion:{endpointClass:"optional",module:"ai"},rewriterAskAi:{endpointClass:"optional",module:"ai"},whisperTranscription:{endpointClass:"optional",module:"recorder-media"},getAllowedDocuments:{endpointClass:"optional",module:"core"},videoBackend:{endpointClass:"optional",module:"recorder-media"},convertRecording:{endpointClass:"optional",module:"recorder-media"},processRecording:{endpointClass:"optional",module:"recorder-media"},screenshot:{endpointClass:"optional",module:"recorder-media"},setEncryptedData:{endpointClass:"core",module:"core"},firebaseNotificationsDatabaseURL:{endpointClass:"core",module:"core"},firebaseConfig:{endpointClass:"core",module:"core"}},xne=Object.keys(es).filter(t=>t!=="setEncryptedData"&&t!=="firebaseNotificationsDatabaseURL"&&t!=="firebaseConfig"&&es[t].endpointClass==="core"),kne=["notifications","analytics-telemetry","console"],p2=new Set;function Fne(t){try{let e=t.filter(o=>!aV.includes(o));if(!e.length)return;let n=[...e].sort().join(",");if(p2.has(n))return;p2.add(n);let r=e.filter(o=>kne.includes(o)),i=`Velt [selfHosted.deploymentProfile]: unknown module id(s) ignored: ${e.join(", ")}. Unknown ids enable nothing (fail-closed).`;r.length&&(i+=` Note: ${r.join(", ")} `+(r.length>1?"were":"was")+" absorbed into 'core' by the 2026-07-10 manifest restructure \u2014 the endpoints they used to gate (notifications hub, getNotificationsForDocuments, sa telemetry, console CFs) now follow 'core' and are ENABLED whenever core is. If you relied on omitting one of these ids to disable those endpoints, that opt-out no longer applies \u2014 regenerate your velt-deployment-profile.json."),console.warn(i)}catch{}}function rl(t,e){let n=t?.deploymentProfile;return!Array.isArray(n)||n.length===0?!0:(Fne(n),n.includes(e))}var g2={usCentral1:"us-central1",europeWest1:"europe-west1",asiaSouthEast1:"asia-southeast1",australiaSouthEast1:"australia-southeast1",asiaNorthEast1:"asia-northeast1"};function Une(t,e){let n=t?.dataRegions;if(!Array.isArray(n)||e==="usCentral1")return e;let r=g2[e];return r&&n.includes(r)?e:"usCentral1"}function Vne(t){let e=t.cloudFunction;if(e?.setEncryptedData)return!0;let n=t.dataRegions;if(!Array.isArray(n))return Object.values(e?.regions??{}).some(i=>!!i?.setEncryptedData);let r=i=>!!e?.regions?.[i]?.setEncryptedData;return r("usCentral1")?Object.entries(g2).filter(([i,o])=>i!=="usCentral1"&&n.includes(o)).every(([i])=>r(i)):!1}var Bne="__VELT_PRE_BOOTSTRAP_SELF_HOSTED__";function Gne(t){let e=t?.firebaseConfig;return e?V(V({},qt.firebaseConfig),e):qt.firebaseConfig}function e1e(){try{if(typeof window>"u")return;let t=window[Bne];return t&&typeof t=="object"?t:void 0}catch{return}}var Ay=(()=>{let e=class e{constructor(r){this.injector=r,this.strictCoreValidationReported=!1,this.portableUnservedProxyReported=!1,this.portableWithoutStrictReported=!1,this.portableIdentifyFlagMisconfigReported=!1,this.portableIdentifyInsecureUrlReported=!1}get configService(){return this._configService??=this.injector.get(fo)}get loggingService(){return this._loggingService??=this.injector.get(Nt)}getSelfHosted(){try{let r=this.configService.getSelfHostedConfig();return this.reportPortableWithoutStrictOnce(r),r}catch(r){this.loggingService.catch("Error in EndpointsService getSelfHosted: ",r);return}}resolveStrictMiss(r,i){return this.reportStrictCoreMisconfigurationOnce(r),`${Hc}${i}`}resolveProfileDisabled(r,i){return`${Hc}module.${r}/${i}`}isPortableBackendConfigured(r){let i=r?.portableBackendUrl;return r?.enablePortableBackend===!0&&!!i&&nl(i)}reportPortableWithoutStrictOnce(r){if(!this.portableWithoutStrictReported&&!(!this.isPortableBackendConfigured(r)||r?.strict)){this.portableWithoutStrictReported=!0;try{console.warn("Velt [selfHosted.portableBackendUrl]: portable backend configured WITHOUT `strict: true`. Velt-hosted endpoints (analytics `sa`, `sdkProxy`) still egress to Velt cloud, so this deployment is NOT air-gapped. The Tier B recipe pairs them: { enablePortableBackend: true, portableBackendUrl, strict: true }.")}catch{}}}reportStrictCoreMisconfigurationOnce(r){if(!this.strictCoreValidationReported&&!this.isPortableBackendConfigured(r)){this.strictCoreValidationReported=!0;try{let i=this.getMissingStrictCoreEndpoints(r);i.length&&console.error(`Velt [selfHosted.strict]: missing CORE endpoint config: ${i.join(", ")}. The SDK cannot function without these in strict self-hosted mode \u2014 there is no fallback to Velt infrastructure. Provide them via config.selfHosted, or unset \`strict\` for hybrid mode.`)}catch(i){this.loggingService.catch("Error in EndpointsService reportStrictCoreMisconfigurationOnce: ",i,void 0,!0)}}}getMissingStrictCoreEndpoints(r){let i=[];for(let o of xne)rl(r,es[o].module)&&(r.cloudFunction?.[o]||i.push(`cloudFunction.${o}`));return rl(r,es.setEncryptedData.module)&&!Vne(r)&&i.push("cloudFunction.setEncryptedData"),rl(r,es.firebaseNotificationsDatabaseURL.module)&&!r.firebaseNotificationsDatabaseURL&&i.push("firebaseNotificationsDatabaseURL"),rl(r,es.firebaseConfig.module)&&!r.firebaseConfig&&i.push("firebaseConfig"),i}getCloudFunctionUrl(r){let i=this.getSelfHosted(),o=es[r].module;if(!rl(i,o))return this.resolveProfileDisabled(o,`cloudFunction.${r}`);let s=i?.cloudFunction?.[r];return s||(i?.strict?(r==="sdkProxy"&&this.reportPortableUnservedProxyOnce(i),this.resolveStrictMiss(i,`cloudFunction.${r}`)):qt.cloudFunction?.[r])}reportPortableUnservedProxyOnce(r){if(!this.portableUnservedProxyReported&&this.isPortableBackendConfigured(r)){this.portableUnservedProxyReported=!0;try{console.warn("Velt [Tier B]: a Velt-hosted `sdkProxy` call was blocked (strict self-hosting \u2014 zero egress, no fallback). The portable gateway does not serve this operation class, so any feature that still calls it is unavailable on this deployment: today that is the AI rewriter (rewriterAskAi); a routed operation reaches it only if its portable activation wait expired. This warning fires once per session, on the first blocked call.")}catch{}}}getPortableIdentifyUrl(){try{let r=this.getSelfHosted(),i=r?.portableBackendUrl;return i?r?.enablePortableBackend!==!0?(this.portableIdentifyFlagMisconfigReported||(this.portableIdentifyFlagMisconfigReported=!0,console.error("Velt [selfHosted.portableBackendUrl]: set without `enablePortableBackend: true` \u2014 ignored. Identify will use the Velt-hosted endpoint. Set both options to route identify to your self-hosted backend.")),null):nl(i)?l2(i):(this.portableIdentifyInsecureUrlReported||(this.portableIdentifyInsecureUrlReported=!0,console.error(`Velt [selfHosted.portableBackendUrl]: insecure URL "${i}" \u2014 https:// is required (plain http:// is allowed for loopback hosts only). Identify is DISABLED (fail-closed): the SDK will not fall back to Velt infrastructure for a Tier B deployment.`)),`${Hc}portableBackendUrl/identify`):null}catch(r){return this.loggingService.catch("Error in EndpointsService getPortableIdentifyUrl: ",r),null}}getFirebaseConfig(){let r=this.getSelfHosted();return!r?.firebaseConfig&&r?.strict&&this.reportStrictCoreMisconfigurationOnce(r),Gne(r)}getNotificationsDbUrl(){let r=this.getSelfHosted(),i=es.firebaseNotificationsDatabaseURL.module;if(!rl(r,i))return this.resolveProfileDisabled(i,"firebaseNotificationsDatabaseURL");let o=r?.firebaseNotificationsDatabaseURL;return o||(r?.strict?this.resolveStrictMiss(r,"firebaseNotificationsDatabaseURL"):qt.firebaseNotificationsDatabaseURL)}getSetEncryptedDataUrl(r){let i=this.getSelfHosted(),o=es.setEncryptedData.module;if(!rl(i,o))return this.resolveProfileDisabled(o,`cloudFunction.setEncryptedData (region: ${r})`);r=Une(i,r);let s=i?.cloudFunction;if(s?.setEncryptedData)return s.setEncryptedData;let a=s?.regions?.[r]?.setEncryptedData;return a||(i?.strict?this.resolveStrictMiss(i,`cloudFunction.setEncryptedData (region: ${r})`):qt.cloudFunction?.[r]?.setEncryptedData)}};e.\u0275fac=function(i){return new(i||e)(q(Ye))},e.\u0275prov=Z({token:e,factory:e.\u0275fac,providedIn:"root"});let t=e;return t})();var ea=(()=>{let e=class e{constructor(r,i){this.functions=r,this.serviceBook=i,this.endpointsService=Q(Ay),this.sf=!1,this.defaultProperties={},this.draftEvents=[],this.liveStateSyncEvents=Object.values(St.Events.LiveStateSync||{}),this.eventRateLimitCache={},this.EVENT_LIMIT=50,this.TIME_WINDOW_MS=60*1e3,this.analyticsQueue=[],this.selfHostedAnalyticsSkipReported=!1,this.selfHostingTelemetrySources={},this.selfHostingTelemetryDropReported=!1,this.batchTimer=null,this.BATCH_WINDOW_MS=5*1e3,this.MAX_BATCH_SIZE=50,this.liveStateService=null;try{this.updateDefaultProperties({sdkVersion:Wc()}),window?.location?.href&&(this.defaultProperties.pageUrl=window.location.href),this.serviceBook.observe(RT).subscribe(o=>{this.commentService=o??void 0}),this.serviceBook.observe(NT).subscribe(o=>{this.reactionService=o??void 0}),this.serviceBook.observe(bT).subscribe(o=>{this.areaService=o??void 0}),this.serviceBook.observe(KU).subscribe(o=>{this.liveStateService=o??null})}catch(o){O.catch("Error in AnalyticsService constructor: ",o)}}updateDefaultProperties(r={}){this.defaultProperties=V(V({},this.defaultProperties),r)}setInstalledFeature(r){try{this.defaultProperties?.installedFeatures||(this.defaultProperties.installedFeatures=[]),this.defaultProperties.installedFeatures.includes(r)||this.defaultProperties.installedFeatures.push(r)}catch(i){O.catch("Error in AnalyticsService setInstalledFeature: ",i)}}setFeatureConfig({feature:r,config:i}){try{this.defaultProperties.featureConfigs||(this.defaultProperties.featureConfigs={}),this.defaultProperties.featureConfigs[r]||(this.defaultProperties.featureConfigs[r]={}),this.defaultProperties.featureConfigs[r]=V(V({},this.defaultProperties.featureConfigs[r]),i)}catch(o){O.catch("Error in AnalyticsService setFeatureConfig: ",o)}}setSF(r){try{this.sf=r}catch(i){O.catch("Error in AnalyticsService setSF: ",i)}}setAuthService(r){try{this.authService=r}catch(i){O.catch("Error in AnalyticsService setAuthService: ",i)}}setCommentService(r){try{this.commentService=r}catch(i){O.catch("Error in AnalyticsService setCommentService: ",i)}}setConfigService(r){try{this.configService=r}catch(i){O.catch("Error in AnalyticsService setConfigService: ",i)}}setDomService(r){try{this.domService=r}catch(i){O.catch("Error in AnalyticsService setDomService: ",i)}}registerSelfHostingTelemetrySource(r,i){try{this.selfHostingTelemetrySources||(this.selfHostingTelemetrySources={}),this.selfHostingTelemetrySources[r]=i}catch(o){O.catch("Error in AnalyticsService registerSelfHostingTelemetrySource: ",o)}}resolveSelfHostingTelemetryState(){let r=this.selfHostingTelemetrySources??{},i={},o=a=>{let c=r[a];if(!c)return!1;try{return!!c.configured()}catch{return!0}},s=a=>{let c=r[a]?.fieldsToRemove?.();return Array.isArray(c)?c:void 0};return o("comment")&&(i.comment={fieldsToRemove:s("comment")}),o("user")&&(i.user=!0),o("reaction")&&(i.reaction={fieldsToRemove:s("reaction")}),o("recorder")&&(i.recorder={fieldsToRemove:s("recorder")}),o("activity")&&(i.activity={fieldsToRemove:s("activity")}),o("attachment")&&(i.attachment=!0),HR(i)?i:null}applySelfHostingTelemetryRule(r,i){try{let o=this.resolveSelfHostingTelemetryState();return o?SB(r,o,{kind:i}):r}catch(o){return this.selfHostingTelemetryDropReported||(this.selfHostingTelemetryDropReported=!0,console.warn("Velt [selfHosted]: an analytics event was dropped because the self-hosting telemetry filter failed (reported once per session). ",o)),null}}setUserService(r){try{this.userService=r}catch(i){O.catch("Error in AnalyticsService setUserService: ",i)}}identifyUser(r,i,o={}){try{this.userId=r;let s=typeof i=="object"?JSON.parse(JSON.stringify(i)):i;this.userService?.userResolverConfigured?.()&&s?.userId&&(s={userId:s.userId}),this.user=s;let a=this.defaultProperties?this.defaultProperties.apiKey:null;if(qt.production||qt.staging){let c=Date.now(),l={userId:r,clientUserId:this.user?.userId,traits:le(V({},s),{apiKey:a,forceReset:o?.forceReset,eventTimestamp:c}),properties:le(V({},this.defaultProperties),{eventTimestamp:c}),sf:this.sf,context:this.getContext(),eventTimestamp:c};this.setAnalytics("identify",l)}if(this.userId&&this.draftEvents?.length){let c=this.draftEvents?.slice();this.draftEvents=[],c?.forEach(l=>{l.type==="track"&&l?.data?.eventName&&this.trackEvent(l.data.eventName,l.data.properties,l.data.mergeDefaultProperties,l.data.userId,l.data.clientUserId)})}}catch(s){O.catch("Error in AnalyticsService identifyUser: ",s)}}trackPage(r,i="",o={}){try{if((qt.production||qt.staging)&&this.userId){let s={userId:this.userId,clientUserId:this.user?.userId,name:r,properties:o,sf:this.sf,context:this.getContext()};this.setAnalytics("page",s)}}catch(s){O.catch("Error in AnalyticsService trackPage: ",s)}}trackEvent(c){return y(this,arguments,function*(r,i={},o=!0,s,a){try{if(this.sf&&XU.includes(r))return Promise.resolve();if(qt.production||qt.staging)if(this.userId||s){if(this.eventRateLimitCache[r]?.blockedForSession)return Promise.resolve();let l=Date.now();if(this.eventRateLimitCache[r]&&l-this.eventRateLimitCache[r].timestamp<this.TIME_WINDOW_MS){if(this.eventRateLimitCache[r].count>=this.EVENT_LIMIT){if(!this.eventRateLimitCache[r].rateLimitExceededEventTriggered){this.eventRateLimitCache[r].rateLimitExceededEventTriggered=!0,this.eventRateLimitCache[r].blockedForSession=!0;let d=V({eventName:r},i||{});this.triggerTrackEvent(St.Events.Core.SDK_EVENT_RATE_LIMIT_EXCEEDED,d,o,s,a)}return Promise.resolve()}this.eventRateLimitCache[r].count++}else this.eventRateLimitCache[r]={count:1,timestamp:l,rateLimitExceededEventTriggered:!1,blockedForSession:!1};return this.triggerTrackEvent(r,i,o,s,a)}else return i?.eventTimestamp||(i.eventTimestamp=Date.now()),this.draftEvents.push({type:"track",data:{eventName:r,properties:i,mergeDefaultProperties:o,userId:s,clientUserId:a}}),Promise.resolve();return Promise.resolve()}catch(l){return O.catch("Error in AnalyticsService trackEvent: ",l),Promise.resolve()}})}triggerTrackEvent(c){return y(this,arguments,function*(r,i={},o=!0,s,a){try{o&&(i||(i={}),i=V(V({},i),this.defaultProperties));let l;if(i?.annotationId){let h=i.annotationId;if(!l&&this.commentService){let f=this.commentService.getAnnotationById(h);f?.metadata&&(l=f.metadata),f?.targetElementId&&(i.targetElementId=f.targetElementId);let g=this.commentService.getMultiThreadAnnotationById(h);g?.metadata&&(l=g.metadata),g?.targetElementId&&(i.targetElementId=g.targetElementId)}if(!l){let f=this.serviceBook.get(DT)?.getAnnotationById(h);f?.metadata&&(l=f.metadata)}if(!l&&this.reactionService){let f=this.reactionService.getAnnotationById(h);f?.metadata&&(l=f.metadata),f?.targetElementId&&(i.targetElementId=f.targetElementId)}if(!l&&this.areaService){let f=this.areaService.getAnnotationById(h);f?.metadata&&(l=f.metadata)}}if(l&&typeof l=="object"&&(i=V(V({},i),l)),i&&typeof i=="object"&&(i=le(V({},i),{userId:this.userId||s,clientUserId:this.user?.userId||a}),i?.eventTimestamp||(i.eventTimestamp=Date.now()),i?.sessionTabId||(i.sessionTabId=this.domService?.getTabId()),this.liveStateSyncEvents.includes(r))){let h=this.liveStateService?.getSemStats();h&&!i?.semStats&&(i.semStats=h)}let d={userId:this.userId||s,clientUserId:this.user?.userId||a,event:r,properties:i,sf:this.sf,context:this.getContext(),eventTimestamp:i?.eventTimestamp};return this.setAnalytics("track",d)}catch(l){return O.catch("Error in AnalyticsService triggerTrackEvent: ",l),Promise.resolve()}})}setAnalytics(r,i){return y(this,null,function*(){try{let o=this.applySelfHostingTelemetryRule(i,r);return o===null?Promise.resolve():(i=o,navigator.onLine?new Promise((a,c)=>{this.analyticsQueue.push({type:r,body:i,resolve:a,reject:c}),this.analyticsQueue.length>=this.MAX_BATCH_SIZE?this.flushAnalyticsQueue():this.scheduleBatchFlush()}).catch(()=>{}):void 0)}catch(o){return O.catch("Error in AnalyticsService setAnalytics: ",o),Promise.resolve()}})}scheduleBatchFlush(){try{this.batchTimer||(this.batchTimer=setTimeout(()=>{this.batchTimer=null,this.flushAnalyticsQueue()},this.BATCH_WINDOW_MS))}catch(r){O.catch("Error in AnalyticsService scheduleBatchFlush: ",r)}}flushAnalyticsQueue(){return y(this,null,function*(){try{if(this.batchTimer&&(clearTimeout(this.batchTimer),this.batchTimer=null),this.analyticsQueue.length===0||!navigator.onLine)return;let r=[...this.analyticsQueue];this.analyticsQueue=[];try{let i=dd({url:this.endpointsService.getCloudFunctionUrl("sa"),apiProxyDomain:this.configService?.getApiProxyDomain()});if(cd(i)){this.selfHostedAnalyticsSkipReported||(this.selfHostedAnalyticsSkipReported=!0,O.log("Velt [selfHosted]: analytics telemetry is disabled on this deployment (the `sa` endpoint resolves to the inert self-hosted sentinel). Events are dropped locally with zero egress.")),r.forEach(a=>{try{a.resolve&&a.resolve()}catch(c){O.warn("Error resolving analytics promise: ",c)}});return}let o=yd(this.functions,i,{timeout:1200*1e3}),s=r.map(a=>({type:a.type,data:a.body}));try{yield o({type:"batch",data:s}),r.forEach(a=>{try{a.resolve&&a.resolve()}catch(c){O.warn("Error resolving analytics promise: ",c)}})}catch(a){O.warn("Error in AnalyticsService batch flush: ",a),r.forEach(c=>{try{c.reject&&c.reject(a)}catch(l){O.warn("Error rejecting analytics promise: ",l)}})}}catch(i){O.catch("Error in AnalyticsService flushAnalyticsQueue: ",i),r.forEach(o=>{try{o.reject&&o.reject(i)}catch(s){O.warn("Error rejecting analytics promise: ",s)}})}}catch(r){O.catch("Error in AnalyticsService flushAnalyticsQueue: ",r)}})}trackAuthenticatedEvent(r,i={},o=!0){try{this.authService?.getUser$&&typeof this.authService?.getUser$()?.subscribe=="function"&&(this.authService.getUser()?this.trackEvent(r,i,o):((!i||typeof i!="object")&&(i={}),i?.eventTimestamp||(i.eventTimestamp=Date.now()),this.authService?.getUser$()?.pipe(_n(s=>!!s),Tn(1))?.subscribe(()=>{this.trackEvent(r,i,o)})))}catch(s){O.catch("Error in AnalyticsService trackAuthenticatedEvent: ",s)}}getContext(){try{let r={},i=aB();return r.os={name:i?.deviceInfo?.osName,version:i?.deviceInfo?.osVersion},r.page={path:i?.path,title:i?.title,url:i?.url},r.screen={height:i?.deviceInfo?.screenHeight,width:i?.deviceInfo?.screenWidth},r.app={name:i?.deviceInfo?.browserName,version:i?.deviceInfo?.browserVersion},r.device={type:i?.deviceInfo?.deviceType},r.timezone=EB(),r.userAgent=i?.deviceInfo?.userAgent,r}catch(r){O.catch("Error in AnalyticsService getContext: ",r)}}};e.\u0275fac=function(i){return new(i||e)(q(Zo),q(wT))},e.\u0275prov=Z({token:e,factory:e.\u0275fac,providedIn:"root"});let t=e;return t})();var Nt=(()=>{let e=class e{get debugMode(){return rB()}get debugContextMode(){return iB()}get logsEnabled(){return this.logsEnabled$.value}constructor(r){this.analyticsService=r,this.logsEnabled$=new de(!0),this.log("%c[WB] Creating SERVICE LoggingService","color: blue;")}enableLogs(){try{if(this.logsEnabled$.value===!0)return;this.logsEnabled$.next(!0)}catch(r){this.catch("Error in LoggingService enableLogs: ",r)}}disableLogs(){try{if(this.logsEnabled$.value===!1)return;this.logsEnabled$.next(!1)}catch(r){this.catch("Error in LoggingService disableLogs: ",r)}}log(r,...i){this.debugMode&&console.log(r,...i)}logContext(r,...i){this.debugContextMode&&console.log(r,...i)}warn(r,...i){this.debugMode&&console.warn(r,...i)}error(r,...i){this.debugMode&&console.error(r,...i)}debug(r,...i){this.debugMode&&console.debug(r,...i)}info(r,...i){this.debugMode&&console.info(r,...i)}catch(r,i,o,s=!1){try{let a=i?.message;if(this.logsEnabled$.value&&(a?.toLowerCase()?.includes("permission denied")||a?.toLowerCase()?.includes("permission_denied")||(i!==void 0?console.warn("Velt: ",r,i):console.warn("Velt: ",r))),!s){let c=typeof i?.message=="string"?i.message:typeof i=="string"?i:void 0;this.analyticsService.trackEvent(St.Events.Core.SDK_ERROR,V({sourceMethod:r,message:c||r,clientUserId:this.analyticsService?.user?.userId,snippylyUserId:this.analyticsService?.user?.userSnippylyId,source:"sdk"},o||{}))}}catch{}}catchResolverFailure(r,i,o){try{this.logsEnabled$.value&&(i!==void 0?console.warn("Velt: ",r,i):console.warn("Velt: ",r));let s=typeof i?.statusCode=="number"?i.statusCode:void 0;this.analyticsService.trackEvent(St.Events.Core.SDK_ERROR,V(le(V({sourceMethod:r,message:`${r} ${vB(i)}`},s!==void 0?{statusCode:s}:{}),{clientUserId:this.analyticsService?.user?.userId,snippylyUserId:this.analyticsService?.user?.userSnippylyId,source:"sdk"}),o||{}))}catch{}}};e.\u0275fac=function(i){return new(i||e)(q(ea))},e.\u0275prov=Z({token:e,factory:e.\u0275fac,providedIn:"root"});let t=e;return t})();var jne=.2,YN=3e4,Hne=5*6e4,m2=1e3,$ne=5e3;function E2(t){try{if(typeof t!="string"||!t)return null;let e=t.split(".");if(e.length!==3||!e[1])return null;let n=e[1].replace(/-/g,"+").replace(/_/g,"/");n+="=".repeat((4-n.length%4)%4);let r=atob(n),i=new Uint8Array(r.length);for(let s=0;s<r.length;s++)i[s]=r.charCodeAt(s);let o=JSON.parse(new TextDecoder().decode(i));return o&&typeof o=="object"&&!Array.isArray(o)?o:null}catch{return null}}function _2(t){let e=E2(t)?.isAdmin;return e!==void 0&&typeof e!="boolean"&&O.log(`Velt [portable backend]: the session token's isAdmin claim is a ${e===null?"null":typeof e}, not a boolean; treating the user as not an admin.`),e===!0}function Up(t){try{let e=E2(t)?.exp;return typeof e!="number"||!Number.isFinite(e)||e<=0?null:e*1e3}catch{return null}}function T2(t,e){try{if(t===null||!Number.isFinite(e))return null;let n=t-e;if(n<=0)return null;if(n<=$ne)return m2;let r=Math.min(Math.max(n*jne,YN),Hne);return Math.max(n-r,m2)}catch{return null}}var Fp=3e4,Wne=16*6e4;function y2(t,e,n){if(t!==null&&Number.isFinite(e)&&t>e)return Fp;let r=Number.isFinite(n)&&n>=1?Math.floor(n):1;return Math.min(Fp*2**Math.min(r-1,30),Wne)}function XN(t,e){let n=Up(t);return n===null?!0:n-e<=0}var Cy=[],I2=new Set,ta={pings:0,pongs:0,lastPongAtMs:0};function I1e(t){try{t==="ping"?ta.pings++:(ta.pongs++,ta.lastPongAtMs=Date.now())}catch{}}function ze(t,e){try{for(Cy.push({t:Date.now(),kind:t,detail:e});Cy.length>60;)Cy.shift()}catch{}}function v2(t){return!Number.isFinite(t)||t<0?"?":t<1e3?`${Math.round(t)}ms`:t<6e4?`${Math.round(t/1e3)}s`:`${Math.floor(t/6e4)}m${String(Math.round(t%6e4/1e3)).padStart(2,"0")}s`}function v1e(t,e,n){try{let r=n??t;if(I2.has(r))return;I2.add(r);let i=Date.now(),o=Cy.map(a=>` -${v2(i-a.t).padStart(7)} ${a.kind}${a.detail?" "+a.detail:""}`),s=ta.pings?` Heartbeat: ${ta.pings} sent, ${ta.pongs} answered${ta.lastPongAtMs?`, last answer ${v2(i-ta.lastPongAtMs)} ago`:", NONE answered"}
141
+ `);a=h.pop()||"";for(let f of h)f.trim()&&i(f.trim(),s);return c()}catch(l){let d=l instanceof or?l:Iy(0,null);s.error(d),n(d)}})}},cancel(){return t.cancel()}})}var QG="@firebase/functions",JG="0.12.9";var Ane="auth-internal",Cne="app-check-internal",Dne="messaging-internal";function Rne(t){let e=(n,{instanceIdentifier:r})=>{let i=n.getProvider("app").getImmediate(),o=n.getProvider(Ane),s=n.getProvider(Dne),a=n.getProvider(Cne);return new jN(i,o,s,a,r)};qn(new Qt(HN,e,"PUBLIC").setMultipleInstances(!0)),$e(QG,JG,t),$e(QG,JG,"esm2017")}function t2(t=ir(),e=GN){let r=uo(Pe(t),HN).getImmediate({identifier:e}),i=gd("functions");return i&&$N(r,...i),r}function $N(t,e,n){_ne(Pe(t),e,n)}function n2(t,e,n){return Tne(Pe(t),e,n)}Rne();var Zo=class{constructor(e){return e}},r2="functions",WN=class{constructor(){return Qo(r2)}};var zN=new K("angularfire2.functions-instances");function Nne(t,e){let n=Ys(r2,t,e);return n&&new Zo(n)}function bne(t){return(e,n)=>{let r=e.runOutsideAngular(()=>t(n));return new Zo(r)}}var wne={provide:WN,deps:[[new zt,zN]]},One={provide:Zo,useFactory:Nne,deps:[[new zt,zN],yi]};function Pke(t,...e){return $e("angularfire",_i.full,"fn"),er([One,wne,{provide:zN,useFactory:bne(t),multi:!0,deps:[Re,Ye,Ti,Jo,[new zt,el],[new zt,Qs],...e]}])}var xke=fe($N,!0),kke=fe(t2,!0);var i2=fe(n2,!0);var s2={httpsCallableFromURL:i2};function yd(t,e,n){return n?s2.httpsCallableFromURL(t,e,n):s2.httpsCallableFromURL(t,e)}var fo=(()=>{let e=class e{constructor(r,i){this.loggingService=r,this.analyticsService=i,this.config$=new de(null),this.disableLogsConfig$=new de({warnings:!0,suppressAll:!1}),this.apiKey$=new de(""),this.baseFeatureAllowList=[],this.runtimeDisabledFeatures=new Set,this.sf$=new de(!1),this.sdkType$=new de("core"),this.logsEnabled$=new de(!0),this.safeEval$=new de(!1),this.firestorePersistentCacheEnabled$=new de(!1),this.encryptionProvider$=new de(null);try{this.analyticsService.setConfigService(this),this.sdkType$.subscribe(o=>{this.analyticsService.updateDefaultProperties({sdkType:o})},o=>{this.loggingService.catch("Error in ConfigService sdkType$: ",o)}),this.logsEnabled$.subscribe(o=>{o?this.loggingService.enableLogs():this.loggingService.disableLogs(),O.logsEnabled=o},o=>{this.loggingService.catch("Error in ConfigService logsEnabled$: ",o)})}catch(o){this.loggingService.catch("Error in ConfigService constructor: ",o)}}initConfig(r){try{r.featureAllowList?.length||(r.featureAllowList=Object.values(_R)),this.baseFeatureAllowList=r.featureAllowList?.slice();try{r.proxyConfig?.authHost?localStorage.setItem(k.LOCAL_STORAGE.VELT_AUTH_PROXY_HOST,btoa(r.proxyConfig.authHost)):localStorage.removeItem(k.LOCAL_STORAGE.VELT_AUTH_PROXY_HOST)}catch{}this.config$.next(r)}catch(i){this.loggingService.catch("Error in ConfigService initConfig: ",i)}}setApiKey(r){this.apiKey$.next(r)}getApiKey(){return this.apiKey$.value}getApiKey$(){return this.apiKey$.asObservable()}getConfig(){return this.config$.value}getConfig$(){return this.config$.asObservable()}disableFeatures(r){try{let i=this.config$.value;this.runtimeDisabledFeatures=new Set(r??[]),i&&(r?.length?i.featureAllowList=this.baseFeatureAllowList.filter(o=>!r.includes(o)):i.featureAllowList=this.baseFeatureAllowList.slice()),this.config$.next(i)}catch(i){this.loggingService.catch("Error in ConfigService disableFeatures: ",i)}}enableFeatures(r){try{if(!r?.length)return;let i=this.config$.value;if(!i)return;let o=i.featureAllowList??[],s=r.filter(a=>!o.includes(a)&&!this.runtimeDisabledFeatures.has(a));if(s.length===0)return;i.featureAllowList=[...o,...s],this.baseFeatureAllowList=[...this.baseFeatureAllowList,...s.filter(a=>!this.baseFeatureAllowList.includes(a))],this.config$.next(i)}catch(i){this.loggingService.catch("Error in ConfigService enableFeatures: ",i)}}setSF(r){try{this.sf$.next(r),this.analyticsService.setSF(r)}catch(i){this.loggingService.catch("Error in ConfigService setSF: ",i)}}getSF(){try{return this.sf$.value}catch(r){return this.loggingService.catch("Error in ConfigService getSF: ",r),!1}}getSF$(){try{return this.sf$.asObservable().pipe(ai(gp))}catch(r){return this.loggingService.catch("Error in ConfigService getSF$: ",r),st(!1)}}setSdkType(r){try{this.sdkType$.next(r)}catch(i){this.loggingService.catch("Error in ConfigService setSdkType: ",i)}}getSdkType(){try{return this.sdkType$.value}catch(r){return this.loggingService.catch("Error in ConfigService getSdkType: ",r),"core"}}getSdkType$(){try{return this.sdkType$.asObservable()}catch(r){return this.loggingService.catch("Error in ConfigService getSdkType$: ",r),st("core")}}enableLogs(){try{if(this.logsEnabled$.value===!0)return;this.logsEnabled$.next(!0)}catch(r){this.loggingService.catch("Error in ConfigService enableLogs: ",r)}}disableLogs(r){try{r&&this.disableLogsConfig$.next({warnings:r.warnings??!0,suppressAll:r.suppressAll??!1}),r?.warnings!==!1&&this.logsEnabled$.next(!1)}catch(i){this.loggingService.catch("Error in ConfigService disableLogs: ",i)}}getDisableLogsConfig(){return this.disableLogsConfig$.value}getDisableLogsConfig$(){return this.disableLogsConfig$.asObservable()}getProxyConfig(){try{return this.config$.value?.proxyConfig}catch(r){this.loggingService.catch("Error in ConfigService getProxyConfig: ",r);return}}getAuthProxyHost(){try{let r=this.config$.value?.proxyConfig?.authHost;if(r)return r;let i=localStorage.getItem(k.LOCAL_STORAGE.VELT_AUTH_PROXY_HOST);return i?atob(i):void 0}catch(r){this.loggingService.catch("Error in ConfigService getAuthProxyHost: ",r);return}}getApiHost(){try{return this.getProxyConfig()?.apiHost||this.config$.value?.apiProxyDomain}catch(r){this.loggingService.catch("Error in ConfigService getApiHost: ",r);return}}getApiProxyDomain(){return this.getApiHost()}getSelfHostedConfig(){try{return this.config$.value?.selfHosted}catch(r){this.loggingService.catch("Error in ConfigService getSelfHostedConfig: ",r);return}}getEnablePortableBackend(){try{return this.config$.value?.selfHosted?.enablePortableBackend===!0}catch(r){return this.loggingService.catch("Error in ConfigService getEnablePortableBackend: ",r),!1}}enableSafeEval(){try{this.safeEval$.next(!0)}catch(r){this.loggingService.catch("Error in ConfigService enableSafeEval: ",r)}}disableSafeEval(){try{this.safeEval$.next(!1)}catch(r){this.loggingService.catch("Error in ConfigService disableSafeEval: ",r)}}getSafeEval(){try{return this.safeEval$.value}catch(r){return this.loggingService.catch("Error in ConfigService getSafeEval: ",r),!1}}getSafeEval$(){try{return this.safeEval$.asObservable()}catch(r){return this.loggingService.catch("Error in ConfigService getSafeEval$: ",r),st(!1)}}enableFirestorePersistentCache(){try{this.firestorePersistentCacheEnabled$.next(!0)}catch(r){this.loggingService.catch("Error in ConfigService enableFirestorePersistentCache: ",r)}}disableFirestorePersistentCache(){try{this.firestorePersistentCacheEnabled$.next(!1)}catch(r){this.loggingService.catch("Error in ConfigService disableFirestorePersistentCache: ",r)}}isFirestorePersistentCacheEnabled(){try{return this.firestorePersistentCacheEnabled$.value}catch(r){return this.loggingService.catch("Error in ConfigService isFirestorePersistentCacheEnabled: ",r),!1}}getFirestorePersistentCacheEnabled$(){try{return this.firestorePersistentCacheEnabled$.asObservable()}catch(r){return this.loggingService.catch("Error in ConfigService getFirestorePersistentCacheEnabled$: ",r),st(!1)}}setEncryptionProvider(r){try{this.loggingService.log("%c[WB] Calling FUNCTION: setEncryptionProvider","color: green;"),this.encryptionProvider$.next(r)}catch(i){this.loggingService.catch("Error in ConfigService setEncryptionProvider: ",i)}}getEncryptionProvider(){try{return this.encryptionProvider$.value}catch(r){return this.loggingService.catch("Error in ConfigService getEncryptionProvider: ",r),null}}getEncryptionProvider$(){try{return this.encryptionProvider$.asObservable()}catch(r){return this.loggingService.catch("Error in ConfigService getEncryptionProvider$: ",r),st(null)}}};e.\u0275fac=function(i){return new(i||e)(q(Nt),q(ea))},e.\u0275prov=Z({token:e,factory:e.\u0275fac,providedIn:"root"});let t=e;return t})();var tl={fetch:(t,e)=>fetch(t,e),timeoutMs:12e5,renewalTimeoutMs:3e4,renewalOfflineTimeoutMs:5e3,isOnline:()=>typeof navigator>"u"||navigator.onLine!==!1};function c2(){try{return tl.isOnline()?tl.renewalTimeoutMs:tl.renewalOfflineTimeoutMs}catch{return tl.renewalTimeoutMs}}var Wke=tl.timeoutMs,a2=Symbol("identify-timed-out");function nl(t){return Mne(t,{secure:"https:",loopback:"http:"})}var Lne=["localhost","127.0.0.1","[::1]"];function Mne(t,e){if(!t)return!1;try{let n=new URL(t);return n.protocol===e.secure?!0:n.protocol===e.loopback&&Lne.includes(n.hostname)}catch{return!1}}function l2(t){return`${t.replace(/\/+$/,"")}/identify`}function Pne(t,e="identify"){let n="Could not reach the self-hosted backend for "+e+" ("+t+"). If the SDK is running cross-origin, a likely cause is the gateway's CORS origin allowlist not including this origin (fail-closed deny-by-default) \u2014 verify the operator configured it. This is distinct from a server-side denial, which carries a specific error code.";return Sy(n)}function Sy(t){return{error:t,code:"network_error",message:t,source:"identify"}}function u2(t){return y(this,null,function*(){let e={apiKey:t.apiKey,originDomain:typeof window<"u"?window.location.origin:"",version:t.version,user:t.user};return t.authToken!=null&&(e.authToken=t.authToken),d2({url:t.url,body:e,timeoutMs:tl.timeoutMs,label:"identify"})})}function d2(t){return y(this,null,function*(){let e,n=t.timeoutMs,r=typeof AbortController<"u"?new AbortController:null,i,o=new Promise(a=>{i=setTimeout(()=>{try{r?.abort()}catch{}a(a2)},n)}),s=()=>y(null,null,function*(){let a=yield tl.fetch(t.url,V({method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t.body)},r?{signal:r.signal}:{}));try{return{body:yield a.json()}}catch{return{detail:`unreadable response (HTTP ${a.status}, non-JSON body)`}}});try{let a=yield Promise.race([s(),o]);if(a===a2)e=`no answer within ${n} ms (request timed out and was aborted)`;else{if("body"in a)return a.body;e=a.detail}}catch(a){e=`fetch failed: ${a?.message??a}`}finally{i!==void 0&&clearTimeout(i)}return console.error(`Velt [selfHosted.portableBackendUrl]: ${t.label} ${e} \u2014 ${t.url}`),Pne(e,t.label)})}var KN="refresh_token_invalid",kp=new Set(["domain_not_whitelisted","identify_not_configured","invalid-argument"]);function h2(t,e){return`${t.replace(/\/+$/,"")}/${e}`}function f2(t){let e={apiKey:t.apiKey,refreshToken:t.refreshToken};return d2({url:t.url,body:e,timeoutMs:t.timeoutMs,label:"identify/refresh"})}var es={validateClient:{endpointClass:"core",module:"core"},sdkProxy:{endpointClass:"core",module:"core"},getNotificationsForDocuments:{endpointClass:"core",module:"core"},getPlanDetails:{endpointClass:"advisory",module:"core"},sa:{endpointClass:"telemetry",module:"core"},getIceServers:{endpointClass:"optional",module:"huddle-webrtc"},chatgptCompletion:{endpointClass:"optional",module:"ai"},rewriterAskAi:{endpointClass:"optional",module:"ai"},whisperTranscription:{endpointClass:"optional",module:"recorder-media"},getAllowedDocuments:{endpointClass:"optional",module:"core"},videoBackend:{endpointClass:"optional",module:"recorder-media"},convertRecording:{endpointClass:"optional",module:"recorder-media"},processRecording:{endpointClass:"optional",module:"recorder-media"},screenshot:{endpointClass:"optional",module:"recorder-media"},setEncryptedData:{endpointClass:"core",module:"core"},firebaseNotificationsDatabaseURL:{endpointClass:"core",module:"core"},firebaseConfig:{endpointClass:"core",module:"core"}},xne=Object.keys(es).filter(t=>t!=="setEncryptedData"&&t!=="firebaseNotificationsDatabaseURL"&&t!=="firebaseConfig"&&es[t].endpointClass==="core"),kne=["notifications","analytics-telemetry","console"],p2=new Set;function Fne(t){try{let e=t.filter(o=>!aV.includes(o));if(!e.length)return;let n=[...e].sort().join(",");if(p2.has(n))return;p2.add(n);let r=e.filter(o=>kne.includes(o)),i=`Velt [selfHosted.deploymentProfile]: unknown module id(s) ignored: ${e.join(", ")}. Unknown ids enable nothing (fail-closed).`;r.length&&(i+=` Note: ${r.join(", ")} `+(r.length>1?"were":"was")+" absorbed into 'core' by the 2026-07-10 manifest restructure \u2014 the endpoints they used to gate (notifications hub, getNotificationsForDocuments, sa telemetry, console CFs) now follow 'core' and are ENABLED whenever core is. If you relied on omitting one of these ids to disable those endpoints, that opt-out no longer applies \u2014 regenerate your velt-deployment-profile.json."),console.warn(i)}catch{}}function rl(t,e){let n=t?.deploymentProfile;return!Array.isArray(n)||n.length===0?!0:(Fne(n),n.includes(e))}var g2={usCentral1:"us-central1",europeWest1:"europe-west1",asiaSouthEast1:"asia-southeast1",australiaSouthEast1:"australia-southeast1",asiaNorthEast1:"asia-northeast1"};function Une(t,e){let n=t?.dataRegions;if(!Array.isArray(n)||e==="usCentral1")return e;let r=g2[e];return r&&n.includes(r)?e:"usCentral1"}function Vne(t){let e=t.cloudFunction;if(e?.setEncryptedData)return!0;let n=t.dataRegions;if(!Array.isArray(n))return Object.values(e?.regions??{}).some(i=>!!i?.setEncryptedData);let r=i=>!!e?.regions?.[i]?.setEncryptedData;return r("usCentral1")?Object.entries(g2).filter(([i,o])=>i!=="usCentral1"&&n.includes(o)).every(([i])=>r(i)):!1}var Bne="__VELT_PRE_BOOTSTRAP_SELF_HOSTED__";function Gne(t){let e=t?.firebaseConfig;return e?V(V({},qt.firebaseConfig),e):qt.firebaseConfig}function e1e(){try{if(typeof window>"u")return;let t=window[Bne];return t&&typeof t=="object"?t:void 0}catch{return}}var Ay=(()=>{let e=class e{constructor(r){this.injector=r,this.strictCoreValidationReported=!1,this.portableUnservedProxyReported=!1,this.portableWithoutStrictReported=!1,this.portableIdentifyFlagMisconfigReported=!1,this.portableIdentifyInsecureUrlReported=!1}get configService(){return this._configService??=this.injector.get(fo)}get loggingService(){return this._loggingService??=this.injector.get(Nt)}getSelfHosted(){try{let r=this.configService.getSelfHostedConfig();return this.reportPortableWithoutStrictOnce(r),r}catch(r){this.loggingService.catch("Error in EndpointsService getSelfHosted: ",r);return}}resolveStrictMiss(r,i){return this.reportStrictCoreMisconfigurationOnce(r),`${Hc}${i}`}resolveProfileDisabled(r,i){return`${Hc}module.${r}/${i}`}isPortableBackendConfigured(r){let i=r?.portableBackendUrl;return r?.enablePortableBackend===!0&&!!i&&nl(i)}reportPortableWithoutStrictOnce(r){if(!this.portableWithoutStrictReported&&!(!this.isPortableBackendConfigured(r)||r?.strict)){this.portableWithoutStrictReported=!0;try{console.warn("Velt [selfHosted.portableBackendUrl]: portable backend configured WITHOUT `strict: true`. Velt-hosted endpoints (analytics `sa`, `sdkProxy`) still egress to Velt cloud, so this deployment is NOT air-gapped. The Tier B recipe pairs them: { enablePortableBackend: true, portableBackendUrl, strict: true }.")}catch{}}}reportStrictCoreMisconfigurationOnce(r){if(!this.strictCoreValidationReported&&!this.isPortableBackendConfigured(r)){this.strictCoreValidationReported=!0;try{let i=this.getMissingStrictCoreEndpoints(r);i.length&&console.error(`Velt [selfHosted.strict]: missing CORE endpoint config: ${i.join(", ")}. The SDK cannot function without these in strict self-hosted mode \u2014 there is no fallback to Velt infrastructure. Provide them via config.selfHosted, or unset \`strict\` for hybrid mode.`)}catch(i){this.loggingService.catch("Error in EndpointsService reportStrictCoreMisconfigurationOnce: ",i,void 0,!0)}}}getMissingStrictCoreEndpoints(r){let i=[];for(let o of xne)rl(r,es[o].module)&&(r.cloudFunction?.[o]||i.push(`cloudFunction.${o}`));return rl(r,es.setEncryptedData.module)&&!Vne(r)&&i.push("cloudFunction.setEncryptedData"),rl(r,es.firebaseNotificationsDatabaseURL.module)&&!r.firebaseNotificationsDatabaseURL&&i.push("firebaseNotificationsDatabaseURL"),rl(r,es.firebaseConfig.module)&&!r.firebaseConfig&&i.push("firebaseConfig"),i}getCloudFunctionUrl(r){let i=this.getSelfHosted(),o=es[r].module;if(!rl(i,o))return this.resolveProfileDisabled(o,`cloudFunction.${r}`);let s=i?.cloudFunction?.[r];return s||(i?.strict?(r==="sdkProxy"&&this.reportPortableUnservedProxyOnce(i),this.resolveStrictMiss(i,`cloudFunction.${r}`)):qt.cloudFunction?.[r])}reportPortableUnservedProxyOnce(r){if(!this.portableUnservedProxyReported&&this.isPortableBackendConfigured(r)){this.portableUnservedProxyReported=!0;try{console.warn("Velt [Tier B]: a Velt-hosted `sdkProxy` call was blocked (strict self-hosting \u2014 zero egress, no fallback). The portable gateway does not serve this operation class, so any feature that still calls it is unavailable on this deployment: today that is the AI rewriter (rewriterAskAi); a routed operation reaches it only if its portable activation wait expired. This warning fires once per session, on the first blocked call.")}catch{}}}getPortableIdentifyUrl(){try{let r=this.getSelfHosted(),i=r?.portableBackendUrl;return i?r?.enablePortableBackend!==!0?(this.portableIdentifyFlagMisconfigReported||(this.portableIdentifyFlagMisconfigReported=!0,console.error("Velt [selfHosted.portableBackendUrl]: set without `enablePortableBackend: true` \u2014 ignored. Identify will use the Velt-hosted endpoint. Set both options to route identify to your self-hosted backend.")),null):nl(i)?l2(i):(this.portableIdentifyInsecureUrlReported||(this.portableIdentifyInsecureUrlReported=!0,console.error(`Velt [selfHosted.portableBackendUrl]: insecure URL "${i}" \u2014 https:// is required (plain http:// is allowed for loopback hosts only). Identify is DISABLED (fail-closed): the SDK will not fall back to Velt infrastructure for a Tier B deployment.`)),`${Hc}portableBackendUrl/identify`):null}catch(r){return this.loggingService.catch("Error in EndpointsService getPortableIdentifyUrl: ",r),null}}getFirebaseConfig(){let r=this.getSelfHosted();return!r?.firebaseConfig&&r?.strict&&this.reportStrictCoreMisconfigurationOnce(r),Gne(r)}getNotificationsDbUrl(){let r=this.getSelfHosted(),i=es.firebaseNotificationsDatabaseURL.module;if(!rl(r,i))return this.resolveProfileDisabled(i,"firebaseNotificationsDatabaseURL");let o=r?.firebaseNotificationsDatabaseURL;return o||(r?.strict?this.resolveStrictMiss(r,"firebaseNotificationsDatabaseURL"):qt.firebaseNotificationsDatabaseURL)}getSetEncryptedDataUrl(r){let i=this.getSelfHosted(),o=es.setEncryptedData.module;if(!rl(i,o))return this.resolveProfileDisabled(o,`cloudFunction.setEncryptedData (region: ${r})`);r=Une(i,r);let s=i?.cloudFunction;if(s?.setEncryptedData)return s.setEncryptedData;let a=s?.regions?.[r]?.setEncryptedData;return a||(i?.strict?this.resolveStrictMiss(i,`cloudFunction.setEncryptedData (region: ${r})`):qt.cloudFunction?.[r]?.setEncryptedData)}};e.\u0275fac=function(i){return new(i||e)(q(Ye))},e.\u0275prov=Z({token:e,factory:e.\u0275fac,providedIn:"root"});let t=e;return t})();var ea=(()=>{let e=class e{constructor(r,i){this.functions=r,this.serviceBook=i,this.endpointsService=Q(Ay),this.sf=!1,this.defaultProperties={},this.draftEvents=[],this.liveStateSyncEvents=Object.values(St.Events.LiveStateSync||{}),this.eventRateLimitCache={},this.EVENT_LIMIT=50,this.TIME_WINDOW_MS=60*1e3,this.analyticsQueue=[],this.selfHostedAnalyticsSkipReported=!1,this.selfHostingTelemetrySources={},this.selfHostingTelemetryDropReported=!1,this.batchTimer=null,this.BATCH_WINDOW_MS=5*1e3,this.MAX_BATCH_SIZE=50,this.liveStateService=null;try{this.updateDefaultProperties({sdkVersion:Wc()}),window?.location?.href&&(this.defaultProperties.pageUrl=window.location.href),this.serviceBook.observe(RT).subscribe(o=>{this.commentService=o??void 0}),this.serviceBook.observe(NT).subscribe(o=>{this.reactionService=o??void 0}),this.serviceBook.observe(bT).subscribe(o=>{this.areaService=o??void 0}),this.serviceBook.observe(KU).subscribe(o=>{this.liveStateService=o??null})}catch(o){O.catch("Error in AnalyticsService constructor: ",o)}}updateDefaultProperties(r={}){this.defaultProperties=V(V({},this.defaultProperties),r)}setInstalledFeature(r){try{this.defaultProperties?.installedFeatures||(this.defaultProperties.installedFeatures=[]),this.defaultProperties.installedFeatures.includes(r)||this.defaultProperties.installedFeatures.push(r)}catch(i){O.catch("Error in AnalyticsService setInstalledFeature: ",i)}}setFeatureConfig({feature:r,config:i}){try{this.defaultProperties.featureConfigs||(this.defaultProperties.featureConfigs={}),this.defaultProperties.featureConfigs[r]||(this.defaultProperties.featureConfigs[r]={}),this.defaultProperties.featureConfigs[r]=V(V({},this.defaultProperties.featureConfigs[r]),i)}catch(o){O.catch("Error in AnalyticsService setFeatureConfig: ",o)}}setSF(r){try{this.sf=r}catch(i){O.catch("Error in AnalyticsService setSF: ",i)}}setAuthService(r){try{this.authService=r}catch(i){O.catch("Error in AnalyticsService setAuthService: ",i)}}setCommentService(r){try{this.commentService=r}catch(i){O.catch("Error in AnalyticsService setCommentService: ",i)}}setConfigService(r){try{this.configService=r}catch(i){O.catch("Error in AnalyticsService setConfigService: ",i)}}setDomService(r){try{this.domService=r}catch(i){O.catch("Error in AnalyticsService setDomService: ",i)}}registerSelfHostingTelemetrySource(r,i){try{this.selfHostingTelemetrySources||(this.selfHostingTelemetrySources={}),this.selfHostingTelemetrySources[r]=i}catch(o){O.catch("Error in AnalyticsService registerSelfHostingTelemetrySource: ",o)}}resolveSelfHostingTelemetryState(){let r=this.selfHostingTelemetrySources??{},i={},o=a=>{let c=r[a];if(!c)return!1;try{return!!c.configured()}catch{return!0}},s=a=>{let c=r[a]?.fieldsToRemove?.();return Array.isArray(c)?c:void 0};return o("comment")&&(i.comment={fieldsToRemove:s("comment")}),o("user")&&(i.user=!0),o("reaction")&&(i.reaction={fieldsToRemove:s("reaction")}),o("recorder")&&(i.recorder={fieldsToRemove:s("recorder")}),o("activity")&&(i.activity={fieldsToRemove:s("activity")}),o("attachment")&&(i.attachment=!0),HR(i)?i:null}applySelfHostingTelemetryRule(r,i){try{let o=this.resolveSelfHostingTelemetryState();return o?SB(r,o,{kind:i}):r}catch(o){return this.selfHostingTelemetryDropReported||(this.selfHostingTelemetryDropReported=!0,console.warn("Velt [selfHosted]: an analytics event was dropped because the self-hosting telemetry filter failed (reported once per session). ",o)),null}}setUserService(r){try{this.userService=r}catch(i){O.catch("Error in AnalyticsService setUserService: ",i)}}identifyUser(r,i,o={}){try{this.userId=r;let s=typeof i=="object"?JSON.parse(JSON.stringify(i)):i;this.userService?.userResolverConfigured?.()&&s?.userId&&(s={userId:s.userId}),this.user=s;let a=this.defaultProperties?this.defaultProperties.apiKey:null;if(qt.production||qt.staging){let c=Date.now(),l={userId:r,clientUserId:this.user?.userId,traits:le(V({},s),{apiKey:a,forceReset:o?.forceReset,eventTimestamp:c}),properties:le(V({},this.defaultProperties),{eventTimestamp:c}),sf:this.sf,context:this.getContext(),eventTimestamp:c};this.setAnalytics("identify",l)}if(this.userId&&this.draftEvents?.length){let c=this.draftEvents?.slice();this.draftEvents=[],c?.forEach(l=>{l.type==="track"&&l?.data?.eventName&&this.trackEvent(l.data.eventName,l.data.properties,l.data.mergeDefaultProperties,l.data.userId,l.data.clientUserId)})}}catch(s){O.catch("Error in AnalyticsService identifyUser: ",s)}}trackPage(r,i="",o={}){try{if((qt.production||qt.staging)&&this.userId){let s={userId:this.userId,clientUserId:this.user?.userId,name:r,properties:o,sf:this.sf,context:this.getContext()};this.setAnalytics("page",s)}}catch(s){O.catch("Error in AnalyticsService trackPage: ",s)}}trackEvent(c){return y(this,arguments,function*(r,i={},o=!0,s,a){try{if(this.sf&&XU.includes(r))return Promise.resolve();if(qt.production||qt.staging)if(this.userId||s){if(this.eventRateLimitCache[r]?.blockedForSession)return Promise.resolve();let l=Date.now();if(this.eventRateLimitCache[r]&&l-this.eventRateLimitCache[r].timestamp<this.TIME_WINDOW_MS){if(this.eventRateLimitCache[r].count>=this.EVENT_LIMIT){if(!this.eventRateLimitCache[r].rateLimitExceededEventTriggered){this.eventRateLimitCache[r].rateLimitExceededEventTriggered=!0,this.eventRateLimitCache[r].blockedForSession=!0;let d=V({eventName:r},i||{});this.triggerTrackEvent(St.Events.Core.SDK_EVENT_RATE_LIMIT_EXCEEDED,d,o,s,a)}return Promise.resolve()}this.eventRateLimitCache[r].count++}else this.eventRateLimitCache[r]={count:1,timestamp:l,rateLimitExceededEventTriggered:!1,blockedForSession:!1};return this.triggerTrackEvent(r,i,o,s,a)}else return i?.eventTimestamp||(i.eventTimestamp=Date.now()),this.draftEvents.push({type:"track",data:{eventName:r,properties:i,mergeDefaultProperties:o,userId:s,clientUserId:a}}),Promise.resolve();return Promise.resolve()}catch(l){return O.catch("Error in AnalyticsService trackEvent: ",l),Promise.resolve()}})}triggerTrackEvent(c){return y(this,arguments,function*(r,i={},o=!0,s,a){try{o&&(i||(i={}),i=V(V({},i),this.defaultProperties));let l;if(i?.annotationId){let h=i.annotationId;if(!l&&this.commentService){let f=this.commentService.getAnnotationById(h);f?.metadata&&(l=f.metadata),f?.targetElementId&&(i.targetElementId=f.targetElementId);let g=this.commentService.getMultiThreadAnnotationById(h);g?.metadata&&(l=g.metadata),g?.targetElementId&&(i.targetElementId=g.targetElementId)}if(!l){let f=this.serviceBook.get(DT)?.getAnnotationById(h);f?.metadata&&(l=f.metadata)}if(!l&&this.reactionService){let f=this.reactionService.getAnnotationById(h);f?.metadata&&(l=f.metadata),f?.targetElementId&&(i.targetElementId=f.targetElementId)}if(!l&&this.areaService){let f=this.areaService.getAnnotationById(h);f?.metadata&&(l=f.metadata)}}if(l&&typeof l=="object"&&(i=V(V({},i),l)),i&&typeof i=="object"&&(i=le(V({},i),{userId:this.userId||s,clientUserId:this.user?.userId||a}),i?.eventTimestamp||(i.eventTimestamp=Date.now()),i?.sessionTabId||(i.sessionTabId=this.domService?.getTabId()),this.liveStateSyncEvents.includes(r))){let h=this.liveStateService?.getSemStats();h&&!i?.semStats&&(i.semStats=h)}let d={userId:this.userId||s,clientUserId:this.user?.userId||a,event:r,properties:i,sf:this.sf,context:this.getContext(),eventTimestamp:i?.eventTimestamp};return this.setAnalytics("track",d)}catch(l){return O.catch("Error in AnalyticsService triggerTrackEvent: ",l),Promise.resolve()}})}setAnalytics(r,i){return y(this,null,function*(){try{let o=this.applySelfHostingTelemetryRule(i,r);return o===null?Promise.resolve():(i=o,navigator.onLine?new Promise((a,c)=>{this.analyticsQueue.push({type:r,body:i,resolve:a,reject:c}),this.analyticsQueue.length>=this.MAX_BATCH_SIZE?this.flushAnalyticsQueue():this.scheduleBatchFlush()}).catch(()=>{}):void 0)}catch(o){return O.catch("Error in AnalyticsService setAnalytics: ",o),Promise.resolve()}})}scheduleBatchFlush(){try{this.batchTimer||(this.batchTimer=setTimeout(()=>{this.batchTimer=null,this.flushAnalyticsQueue()},this.BATCH_WINDOW_MS))}catch(r){O.catch("Error in AnalyticsService scheduleBatchFlush: ",r)}}flushAnalyticsQueue(){return y(this,null,function*(){try{if(this.batchTimer&&(clearTimeout(this.batchTimer),this.batchTimer=null),this.analyticsQueue.length===0||!navigator.onLine)return;let r=[...this.analyticsQueue];this.analyticsQueue=[];try{let i=dd({url:this.endpointsService.getCloudFunctionUrl("sa"),apiProxyDomain:this.configService?.getApiProxyDomain()});if(cd(i)){this.selfHostedAnalyticsSkipReported||(this.selfHostedAnalyticsSkipReported=!0,O.log("Velt [selfHosted]: analytics telemetry is disabled on this deployment (the `sa` endpoint resolves to the inert self-hosted sentinel). Events are dropped locally with zero egress.")),r.forEach(a=>{try{a.resolve&&a.resolve()}catch(c){O.warn("Error resolving analytics promise: ",c)}});return}let o=yd(this.functions,i,{timeout:1200*1e3}),s=r.map(a=>({type:a.type,data:a.body}));try{yield o({type:"batch",data:s}),r.forEach(a=>{try{a.resolve&&a.resolve()}catch(c){O.warn("Error resolving analytics promise: ",c)}})}catch(a){O.warn("Error in AnalyticsService batch flush: ",a),r.forEach(c=>{try{c.reject&&c.reject(a)}catch(l){O.warn("Error rejecting analytics promise: ",l)}})}}catch(i){O.catch("Error in AnalyticsService flushAnalyticsQueue: ",i),r.forEach(o=>{try{o.reject&&o.reject(i)}catch(s){O.warn("Error rejecting analytics promise: ",s)}})}}catch(r){O.catch("Error in AnalyticsService flushAnalyticsQueue: ",r)}})}trackAuthenticatedEvent(r,i={},o=!0){try{this.authService?.getUser$&&typeof this.authService?.getUser$()?.subscribe=="function"&&(this.authService.getUser()?this.trackEvent(r,i,o):((!i||typeof i!="object")&&(i={}),i?.eventTimestamp||(i.eventTimestamp=Date.now()),this.authService?.getUser$()?.pipe(_n(s=>!!s),Tn(1))?.subscribe(()=>{this.trackEvent(r,i,o)})))}catch(s){O.catch("Error in AnalyticsService trackAuthenticatedEvent: ",s)}}getContext(){try{let r={},i=aB();return r.os={name:i?.deviceInfo?.osName,version:i?.deviceInfo?.osVersion},r.page={path:i?.path,title:i?.title,url:i?.url},r.screen={height:i?.deviceInfo?.screenHeight,width:i?.deviceInfo?.screenWidth},r.app={name:i?.deviceInfo?.browserName,version:i?.deviceInfo?.browserVersion},r.device={type:i?.deviceInfo?.deviceType},r.timezone=EB(),r.userAgent=i?.deviceInfo?.userAgent,r}catch(r){O.catch("Error in AnalyticsService getContext: ",r)}}};e.\u0275fac=function(i){return new(i||e)(q(Zo),q(wT))},e.\u0275prov=Z({token:e,factory:e.\u0275fac,providedIn:"root"});let t=e;return t})();var Nt=(()=>{let e=class e{get debugMode(){return rB()}get debugContextMode(){return iB()}get logsEnabled(){return this.logsEnabled$.value}constructor(r){this.analyticsService=r,this.logsEnabled$=new de(!0),this.log("%c[WB] Creating SERVICE LoggingService","color: blue;")}enableLogs(){try{if(this.logsEnabled$.value===!0)return;this.logsEnabled$.next(!0)}catch(r){this.catch("Error in LoggingService enableLogs: ",r)}}disableLogs(){try{if(this.logsEnabled$.value===!1)return;this.logsEnabled$.next(!1)}catch(r){this.catch("Error in LoggingService disableLogs: ",r)}}log(r,...i){this.debugMode&&console.log(r,...i)}logContext(r,...i){this.debugContextMode&&console.log(r,...i)}warn(r,...i){this.debugMode&&console.warn(r,...i)}error(r,...i){this.debugMode&&console.error(r,...i)}debug(r,...i){this.debugMode&&console.debug(r,...i)}info(r,...i){this.debugMode&&console.info(r,...i)}catch(r,i,o,s=!1){try{let a=i?.message;this.logsEnabled$.value&&(a?.toLowerCase()?.includes("permission denied")||a?.toLowerCase()?.includes("permission_denied")||(i!==void 0?console.warn("Velt: ",r,i):console.warn("Velt: ",r))),s||this.reportToAnalytics(r,i,o)}catch{}}reportToAnalytics(r,i,o){try{let s=typeof i?.message=="string"?i.message:typeof i=="string"?i:void 0;this.analyticsService.trackEvent(St.Events.Core.SDK_ERROR,V({sourceMethod:r,message:s||r,clientUserId:this.analyticsService?.user?.userId,snippylyUserId:this.analyticsService?.user?.userSnippylyId,source:"sdk"},o||{}))}catch{}}catchResolverFailure(r,i,o){try{this.logsEnabled$.value&&(i!==void 0?console.warn("Velt: ",r,i):console.warn("Velt: ",r));let s=typeof i?.statusCode=="number"?i.statusCode:void 0;this.analyticsService.trackEvent(St.Events.Core.SDK_ERROR,V(le(V({sourceMethod:r,message:`${r} ${vB(i)}`},s!==void 0?{statusCode:s}:{}),{clientUserId:this.analyticsService?.user?.userId,snippylyUserId:this.analyticsService?.user?.userSnippylyId,source:"sdk"}),o||{}))}catch{}}};e.\u0275fac=function(i){return new(i||e)(q(ea))},e.\u0275prov=Z({token:e,factory:e.\u0275fac,providedIn:"root"});let t=e;return t})();var jne=.2,YN=3e4,Hne=5*6e4,m2=1e3,$ne=5e3;function E2(t){try{if(typeof t!="string"||!t)return null;let e=t.split(".");if(e.length!==3||!e[1])return null;let n=e[1].replace(/-/g,"+").replace(/_/g,"/");n+="=".repeat((4-n.length%4)%4);let r=atob(n),i=new Uint8Array(r.length);for(let s=0;s<r.length;s++)i[s]=r.charCodeAt(s);let o=JSON.parse(new TextDecoder().decode(i));return o&&typeof o=="object"&&!Array.isArray(o)?o:null}catch{return null}}function _2(t){let e=E2(t)?.isAdmin;return e!==void 0&&typeof e!="boolean"&&O.log(`Velt [portable backend]: the session token's isAdmin claim is a ${e===null?"null":typeof e}, not a boolean; treating the user as not an admin.`),e===!0}function Up(t){try{let e=E2(t)?.exp;return typeof e!="number"||!Number.isFinite(e)||e<=0?null:e*1e3}catch{return null}}function T2(t,e){try{if(t===null||!Number.isFinite(e))return null;let n=t-e;if(n<=0)return null;if(n<=$ne)return m2;let r=Math.min(Math.max(n*jne,YN),Hne);return Math.max(n-r,m2)}catch{return null}}var Fp=3e4,Wne=16*6e4;function y2(t,e,n){if(t!==null&&Number.isFinite(e)&&t>e)return Fp;let r=Number.isFinite(n)&&n>=1?Math.floor(n):1;return Math.min(Fp*2**Math.min(r-1,30),Wne)}function XN(t,e){let n=Up(t);return n===null?!0:n-e<=0}var Cy=[],I2=new Set,ta={pings:0,pongs:0,lastPongAtMs:0};function I1e(t){try{t==="ping"?ta.pings++:(ta.pongs++,ta.lastPongAtMs=Date.now())}catch{}}function ze(t,e){try{for(Cy.push({t:Date.now(),kind:t,detail:e});Cy.length>60;)Cy.shift()}catch{}}function v2(t){return!Number.isFinite(t)||t<0?"?":t<1e3?`${Math.round(t)}ms`:t<6e4?`${Math.round(t/1e3)}s`:`${Math.floor(t/6e4)}m${String(Math.round(t%6e4/1e3)).padStart(2,"0")}s`}function v1e(t,e,n){try{let r=n??t;if(I2.has(r))return;I2.add(r);let i=Date.now(),o=Cy.map(a=>` -${v2(i-a.t).padStart(7)} ${a.kind}${a.detail?" "+a.detail:""}`),s=ta.pings?` Heartbeat: ${ta.pings} sent, ${ta.pongs} answered${ta.lastPongAtMs?`, last answer ${v2(i-ta.lastPongAtMs)} ago`:", NONE answered"}
142
142
  `:` Heartbeat: never ran
143
143
  `;console.warn(`Velt [portable backend] SESSION DIAGNOSTIC \u2014 ${t}
144
144
  `+(e?` ${e}
@@ -1,2 +1,2 @@
1
- import{Cb as a,Db as h,Hk as l,Ra as o,Wa as c,fb as m,qj as g,ya as s}from"./chunk-Q6PUYIXT.js";var d=["*"],C=(()=>{let i=class i{constructor(t,e,n){this.elementRef=t,this.domService=e,this.loggingService=n,this.veltElement=!0}ngAfterViewInit(){try{this.customCssSubscription=this.domService.subscribeInjectCustomCss(this.elementRef)}catch(t){this.loggingService.catch("Error in ShadowDomComponent ngAfterViewInit: ",t)}}ngOnDestroy(){try{this.customCssSubscription?.unsubscribe()}catch(t){this.loggingService.catch("Error in ShadowDomComponent ngOnDestroy: ",t)}}};i.\u0275fac=function(e){return new(e||i)(o(s),o(l),o(g))},i.\u0275cmp=c({type:i,selectors:[["velt-shadow-dom-internal"]],hostVars:1,hostBindings:function(e,n){e&2&&m("data-velt-element",n.veltElement)},ngContentSelectors:d,decls:1,vars:0,template:function(e,n){e&1&&(a(),h(0))},styles:[`:host{width:100%}
1
+ import{Cb as a,Db as h,Hk as l,Ra as o,Wa as c,fb as m,qj as g,ya as s}from"./chunk-QUMZPTVX.js";var d=["*"],C=(()=>{let i=class i{constructor(t,e,n){this.elementRef=t,this.domService=e,this.loggingService=n,this.veltElement=!0}ngAfterViewInit(){try{this.customCssSubscription=this.domService.subscribeInjectCustomCss(this.elementRef)}catch(t){this.loggingService.catch("Error in ShadowDomComponent ngAfterViewInit: ",t)}}ngOnDestroy(){try{this.customCssSubscription?.unsubscribe()}catch(t){this.loggingService.catch("Error in ShadowDomComponent ngOnDestroy: ",t)}}};i.\u0275fac=function(e){return new(e||i)(o(s),o(l),o(g))},i.\u0275cmp=c({type:i,selectors:[["velt-shadow-dom-internal"]],hostVars:1,hostBindings:function(e,n){e&2&&m("data-velt-element",n.veltElement)},ngContentSelectors:d,decls:1,vars:0,template:function(e,n){e&1&&(a(),h(0))},styles:[`:host{width:100%}
2
2
  `],encapsulation:3,changeDetection:0});let r=i;return r})();export{C as a};