@veltdev/sdk 6.0.27 → 6.0.28

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 (59) hide show
  1. package/{chunk-4GWTY2QW.js → chunk-3BCXNETY.js} +1 -1
  2. package/{chunk-PIBUTN6R.js → chunk-3Q5TRC4E.js} +1 -1
  3. package/{chunk-T32PAZYN.js → chunk-4HAFXUDN.js} +1 -1
  4. package/chunk-4P3GYHGY.js +1 -0
  5. package/{chunk-Z7CCKSEO.js → chunk-5ACPKO6C.js} +1 -1
  6. package/{chunk-PBA6NIAI.js → chunk-67RGQF3Z.js} +1 -1
  7. package/{chunk-2MYJTN75.js → chunk-CR275X25.js} +1 -1
  8. package/{chunk-FHFEI7VF.js → chunk-EB7SHB2S.js} +1 -1
  9. package/{chunk-WWK6NPFJ.js → chunk-FWIDRPYU.js} +1 -1
  10. package/{chunk-K6LCTVYG.js → chunk-GAWI762G.js} +1 -1
  11. package/{chunk-DKI2JSNJ.js → chunk-GHN6NWBT.js} +1 -1
  12. package/{chunk-UKCZENKX.js → chunk-HCM2TAE7.js} +1 -1
  13. package/{chunk-IVZBIMXH.js → chunk-HIEV42PB.js} +1 -1
  14. package/{chunk-CXZSNTWV.js → chunk-IS7ZDK65.js} +1 -1
  15. package/{chunk-7J6SWBKB.js → chunk-J35LMO3C.js} +1 -1
  16. package/{chunk-V2VL4H4R.js → chunk-J3IQ7DYW.js} +1 -1
  17. package/{chunk-ABA7YQYU.js → chunk-JQZKADOA.js} +1 -1
  18. package/{chunk-KHGHU7FE.js → chunk-JWSICAW6.js} +1 -1
  19. package/{chunk-2C7WPTQD.js → chunk-JZCDUWAA.js} +1 -1
  20. package/{chunk-NZUJK3CJ.js → chunk-KNYRVMQK.js} +1 -1
  21. package/{chunk-ZVRUGR3J.js → chunk-MP2SDO2E.js} +1 -1
  22. package/{chunk-KWZM6CNH.js → chunk-N3IQEYGG.js} +1 -1
  23. package/{chunk-72TEWHMQ.js → chunk-NTFMMZRZ.js} +1 -1
  24. package/{chunk-4CPJN52I.js → chunk-R7EWRVMV.js} +1 -1
  25. package/{chunk-JR3BVUP3.js → chunk-R7PIAWZF.js} +1 -1
  26. package/{chunk-YI3LAD3Z.js → chunk-RPLZXBLF.js} +1 -1
  27. package/{chunk-M3XIT6ZY.js → chunk-SN6HOFPK.js} +1 -1
  28. package/{chunk-QQIKH4VS.js → chunk-SYLJZSJP.js} +1 -1
  29. package/{chunk-WBOPOSCN.js → chunk-TLEK2ADO.js} +1 -1
  30. package/{chunk-YUGCY3BB.js → chunk-TSC5TWPQ.js} +1 -1
  31. package/{chunk-HV37SAIK.js → chunk-URKI6WZP.js} +1 -1
  32. package/{chunk-J3DYWDYQ.js → chunk-VESMHAEV.js} +1 -1
  33. package/{chunk-DF2C2V7B.js → chunk-VJPZ6E4S.js} +1 -1
  34. package/{chunk-WNH4SCIB.js → chunk-XEXFF5FD.js} +1 -1
  35. package/{chunk-BTJTZEPV.js → chunk-YBLQ2JHR.js} +1 -1
  36. package/{chunk-G6V3RCTP.js → chunk-ZRITZXNF.js} +1 -1
  37. package/package.json +1 -1
  38. package/velt-activity-log.js +1 -1
  39. package/velt-area.js +1 -1
  40. package/velt-arrow.js +1 -1
  41. package/velt-comment.js +7 -7
  42. package/velt-crdt.js +1 -1
  43. package/velt-cursor.js +1 -1
  44. package/velt-huddle.js +1 -1
  45. package/velt-live-state-sync.js +1 -1
  46. package/velt-notification.js +1 -1
  47. package/velt-portable.js +1 -1
  48. package/velt-presence.js +1 -1
  49. package/velt-reaction.js +1 -1
  50. package/velt-recorder.js +1 -1
  51. package/velt-rewriter.js +1 -1
  52. package/velt-selection.js +1 -1
  53. package/velt-tag.js +1 -1
  54. package/velt-user-invite.js +1 -1
  55. package/velt-user-request.js +1 -1
  56. package/velt-video-player.js +1 -1
  57. package/velt-views.js +1 -1
  58. package/velt.js +2 -2
  59. package/chunk-4JE45AVC.js +0 -1
@@ -120,7 +120,7 @@ ${n.map((r,i)=>`${i+1}) ${r.toString()}`).join(`
120
120
  <a href="${this.videoPlayerUrl}" target="_blank">
121
121
  <img src="${e||this.thumbnailWithPlayIconUrl||this.thumbnailUrl}" />
122
122
  </a>
123
- `}};var iV=class{constructor(){this.type="recorder",this.recordingType="audio",this.mode="floating",this.attachment=null,this.attachments=[],this.pageInfo=new Et}};var oV=class{constructor(){this.type="rewriter",this.rewriterType="copywriter",this.pageInfo=new Et}};var rp=class{constructor(){this.screenWidth=0,this.screenHeight=0,this.screenScrollHeight=0}};var sV=class{constructor(){this.pageInfo=new Et}},dwe={Start:"start",End:"end"},hwe={Avatar:"avatar",Label:"label"};var aV=class{constructor(){this.sources=[],this.playerState=new rR}},rR=class{constructor(){this.volume=1}};var cV=class{constructor(){this.to=[],this.resolved=!1,this.type="tag",this.pageInfo=new Et}};var lV=class{constructor(){this.visibility="private"}};var dV=class{constructor(){this.reactions=[],this.type="reaction",this.pageInfo=new Et,this.isReactionResolverUsed=!1}};var hV=class{};var Wwe={EDITOR:"editor",VIEWER:"viewer"},zwe={DOES_NOT_EXIST:"does_not_exist",PERMISSION_DENIED:"permission_denied",SOMETHING_WENT_WRONG:"something_went_wrong"};var GX=(function(t){return t.INTERNAL="internal",t.EXTERNAL="external",t})(GX||{}),jX=(function(t){return t.UPDATE_DATA="updateData",t})(jX||{});var Tn=class t{constructor(){this._dataLength=0,this._bufferLength=0,this._state=new Int32Array(4),this._buffer=new ArrayBuffer(68),this._buffer8=new Uint8Array(this._buffer,0,68),this._buffer32=new Uint32Array(this._buffer,0,17),this.start()}static hashStr(e,n=!1){return this.onePassHasher.start().appendStr(e).end(n)}static hashAsciiStr(e,n=!1){return this.onePassHasher.start().appendAsciiStr(e).end(n)}static _hex(e){let n=t.hexChars,r=t.hexOut,i,o,s,a;for(a=0;a<4;a+=1)for(o=a*8,i=e[a],s=0;s<8;s+=2)r[o+1+s]=n.charAt(i&15),i>>>=4,r[o+0+s]=n.charAt(i&15),i>>>=4;return r.join("")}static _md5cycle(e,n){let r=e[0],i=e[1],o=e[2],s=e[3];r+=(i&o|~i&s)+n[0]-680876936|0,r=(r<<7|r>>>25)+i|0,s+=(r&i|~r&o)+n[1]-389564586|0,s=(s<<12|s>>>20)+r|0,o+=(s&r|~s&i)+n[2]+606105819|0,o=(o<<17|o>>>15)+s|0,i+=(o&s|~o&r)+n[3]-1044525330|0,i=(i<<22|i>>>10)+o|0,r+=(i&o|~i&s)+n[4]-176418897|0,r=(r<<7|r>>>25)+i|0,s+=(r&i|~r&o)+n[5]+1200080426|0,s=(s<<12|s>>>20)+r|0,o+=(s&r|~s&i)+n[6]-1473231341|0,o=(o<<17|o>>>15)+s|0,i+=(o&s|~o&r)+n[7]-45705983|0,i=(i<<22|i>>>10)+o|0,r+=(i&o|~i&s)+n[8]+1770035416|0,r=(r<<7|r>>>25)+i|0,s+=(r&i|~r&o)+n[9]-1958414417|0,s=(s<<12|s>>>20)+r|0,o+=(s&r|~s&i)+n[10]-42063|0,o=(o<<17|o>>>15)+s|0,i+=(o&s|~o&r)+n[11]-1990404162|0,i=(i<<22|i>>>10)+o|0,r+=(i&o|~i&s)+n[12]+1804603682|0,r=(r<<7|r>>>25)+i|0,s+=(r&i|~r&o)+n[13]-40341101|0,s=(s<<12|s>>>20)+r|0,o+=(s&r|~s&i)+n[14]-1502002290|0,o=(o<<17|o>>>15)+s|0,i+=(o&s|~o&r)+n[15]+1236535329|0,i=(i<<22|i>>>10)+o|0,r+=(i&s|o&~s)+n[1]-165796510|0,r=(r<<5|r>>>27)+i|0,s+=(r&o|i&~o)+n[6]-1069501632|0,s=(s<<9|s>>>23)+r|0,o+=(s&i|r&~i)+n[11]+643717713|0,o=(o<<14|o>>>18)+s|0,i+=(o&r|s&~r)+n[0]-373897302|0,i=(i<<20|i>>>12)+o|0,r+=(i&s|o&~s)+n[5]-701558691|0,r=(r<<5|r>>>27)+i|0,s+=(r&o|i&~o)+n[10]+38016083|0,s=(s<<9|s>>>23)+r|0,o+=(s&i|r&~i)+n[15]-660478335|0,o=(o<<14|o>>>18)+s|0,i+=(o&r|s&~r)+n[4]-405537848|0,i=(i<<20|i>>>12)+o|0,r+=(i&s|o&~s)+n[9]+568446438|0,r=(r<<5|r>>>27)+i|0,s+=(r&o|i&~o)+n[14]-1019803690|0,s=(s<<9|s>>>23)+r|0,o+=(s&i|r&~i)+n[3]-187363961|0,o=(o<<14|o>>>18)+s|0,i+=(o&r|s&~r)+n[8]+1163531501|0,i=(i<<20|i>>>12)+o|0,r+=(i&s|o&~s)+n[13]-1444681467|0,r=(r<<5|r>>>27)+i|0,s+=(r&o|i&~o)+n[2]-51403784|0,s=(s<<9|s>>>23)+r|0,o+=(s&i|r&~i)+n[7]+1735328473|0,o=(o<<14|o>>>18)+s|0,i+=(o&r|s&~r)+n[12]-1926607734|0,i=(i<<20|i>>>12)+o|0,r+=(i^o^s)+n[5]-378558|0,r=(r<<4|r>>>28)+i|0,s+=(r^i^o)+n[8]-2022574463|0,s=(s<<11|s>>>21)+r|0,o+=(s^r^i)+n[11]+1839030562|0,o=(o<<16|o>>>16)+s|0,i+=(o^s^r)+n[14]-35309556|0,i=(i<<23|i>>>9)+o|0,r+=(i^o^s)+n[1]-1530992060|0,r=(r<<4|r>>>28)+i|0,s+=(r^i^o)+n[4]+1272893353|0,s=(s<<11|s>>>21)+r|0,o+=(s^r^i)+n[7]-155497632|0,o=(o<<16|o>>>16)+s|0,i+=(o^s^r)+n[10]-1094730640|0,i=(i<<23|i>>>9)+o|0,r+=(i^o^s)+n[13]+681279174|0,r=(r<<4|r>>>28)+i|0,s+=(r^i^o)+n[0]-358537222|0,s=(s<<11|s>>>21)+r|0,o+=(s^r^i)+n[3]-722521979|0,o=(o<<16|o>>>16)+s|0,i+=(o^s^r)+n[6]+76029189|0,i=(i<<23|i>>>9)+o|0,r+=(i^o^s)+n[9]-640364487|0,r=(r<<4|r>>>28)+i|0,s+=(r^i^o)+n[12]-421815835|0,s=(s<<11|s>>>21)+r|0,o+=(s^r^i)+n[15]+530742520|0,o=(o<<16|o>>>16)+s|0,i+=(o^s^r)+n[2]-995338651|0,i=(i<<23|i>>>9)+o|0,r+=(o^(i|~s))+n[0]-198630844|0,r=(r<<6|r>>>26)+i|0,s+=(i^(r|~o))+n[7]+1126891415|0,s=(s<<10|s>>>22)+r|0,o+=(r^(s|~i))+n[14]-1416354905|0,o=(o<<15|o>>>17)+s|0,i+=(s^(o|~r))+n[5]-57434055|0,i=(i<<21|i>>>11)+o|0,r+=(o^(i|~s))+n[12]+1700485571|0,r=(r<<6|r>>>26)+i|0,s+=(i^(r|~o))+n[3]-1894986606|0,s=(s<<10|s>>>22)+r|0,o+=(r^(s|~i))+n[10]-1051523|0,o=(o<<15|o>>>17)+s|0,i+=(s^(o|~r))+n[1]-2054922799|0,i=(i<<21|i>>>11)+o|0,r+=(o^(i|~s))+n[8]+1873313359|0,r=(r<<6|r>>>26)+i|0,s+=(i^(r|~o))+n[15]-30611744|0,s=(s<<10|s>>>22)+r|0,o+=(r^(s|~i))+n[6]-1560198380|0,o=(o<<15|o>>>17)+s|0,i+=(s^(o|~r))+n[13]+1309151649|0,i=(i<<21|i>>>11)+o|0,r+=(o^(i|~s))+n[4]-145523070|0,r=(r<<6|r>>>26)+i|0,s+=(i^(r|~o))+n[11]-1120210379|0,s=(s<<10|s>>>22)+r|0,o+=(r^(s|~i))+n[2]+718787259|0,o=(o<<15|o>>>17)+s|0,i+=(s^(o|~r))+n[9]-343485551|0,i=(i<<21|i>>>11)+o|0,e[0]=r+e[0]|0,e[1]=i+e[1]|0,e[2]=o+e[2]|0,e[3]=s+e[3]|0}start(){return this._dataLength=0,this._bufferLength=0,this._state.set(t.stateIdentity),this}appendStr(e){let n=this._buffer8,r=this._buffer32,i=this._bufferLength,o,s;for(s=0;s<e.length;s+=1){if(o=e.charCodeAt(s),o<128)n[i++]=o;else if(o<2048)n[i++]=(o>>>6)+192,n[i++]=o&63|128;else if(o<55296||o>56319)n[i++]=(o>>>12)+224,n[i++]=o>>>6&63|128,n[i++]=o&63|128;else{if(o=(o-55296)*1024+(e.charCodeAt(++s)-56320)+65536,o>1114111)throw new Error("Unicode standard supports code points up to U+10FFFF");n[i++]=(o>>>18)+240,n[i++]=o>>>12&63|128,n[i++]=o>>>6&63|128,n[i++]=o&63|128}i>=64&&(this._dataLength+=64,t._md5cycle(this._state,r),i-=64,r[0]=r[16])}return this._bufferLength=i,this}appendAsciiStr(e){let n=this._buffer8,r=this._buffer32,i=this._bufferLength,o,s=0;for(;;){for(o=Math.min(e.length-s,64-i);o--;)n[i++]=e.charCodeAt(s++);if(i<64)break;this._dataLength+=64,t._md5cycle(this._state,r),i=0}return this._bufferLength=i,this}appendByteArray(e){let n=this._buffer8,r=this._buffer32,i=this._bufferLength,o,s=0;for(;;){for(o=Math.min(e.length-s,64-i);o--;)n[i++]=e[s++];if(i<64)break;this._dataLength+=64,t._md5cycle(this._state,r),i=0}return this._bufferLength=i,this}getState(){let e=this._state;return{buffer:String.fromCharCode.apply(null,Array.from(this._buffer8)),buflen:this._bufferLength,length:this._dataLength,state:[e[0],e[1],e[2],e[3]]}}setState(e){let n=e.buffer,r=e.state,i=this._state,o;for(this._dataLength=e.length,this._bufferLength=e.buflen,i[0]=r[0],i[1]=r[1],i[2]=r[2],i[3]=r[3],o=0;o<n.length;o+=1)this._buffer8[o]=n.charCodeAt(o)}end(e=!1){let n=this._bufferLength,r=this._buffer8,i=this._buffer32,o=(n>>2)+1;this._dataLength+=n;let s=this._dataLength*8;if(r[n]=128,r[n+1]=r[n+2]=r[n+3]=0,i.set(t.buffer32Identity.subarray(o),o),n>55&&(t._md5cycle(this._state,i),i.set(t.buffer32Identity)),s<=4294967295)i[14]=s;else{let a=s.toString(16).match(/(.*?)(.{0,8})$/);if(a===null)return;let c=parseInt(a[2],16),l=parseInt(a[1],16)||0;i[14]=c,i[15]=l}return t._md5cycle(this._state,i),e?this._state:t._hex(this._state)}};Tn.stateIdentity=new Int32Array([1732584193,-271733879,-1732584194,271733878]);Tn.buffer32Identity=new Int32Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);Tn.hexChars="0123456789abcdef";Tn.hexOut=[];Tn.onePassHasher=new Tn;if(Tn.hashStr("hello")!=="5d41402abc4b2a76b9719d911017c592")throw new Error("Md5 self test failed.");var fV=["annotationId","annotationNumber","visibilityConfig","actions","comments","commentCategories","from","color","resolved","inProgress","lastUpdated","createdAt","positionX","positionY","screenWidth","screenHeight","screenScrollHeight","screenScrollTop","taggedElementPath","taggedElementRect","targetElement","targetElementId","position","documentParamsId","documentParams","locationId","location","type","commentType","sourceType","metadata","targetTextRange","selectAllContent","approved","status","statusUpdatedByUserId","annotationIndex","pageInfo","assignedTo","priority","ghostComment","areaAnnotationId","context","contextId","iam","isPageAnnotation","targetInlineCommentElementId","inlineCommentSectionConfig","customList","subscribedUsers","unsubscribedUsers","subscribedGroups","resolvedByUserId","resolvedByUser","multiThreadAnnotationId","isDraft","sourceId","views","viewedByUserIds","viewedBy","unread","suggestion","agent","involvedUserIds","mentionedUserIds"],pV=["commentId","context","type","commentText","isCommentTextAvailable","isCommentResolverUsed","commentHtml","replaceContentHtml","replaceContentText","commentVoiceUrl","from","to","lastUpdated","createdAt","status","attachments","recorders","reactionAnnotationIds","taggedUserContacts","customList","toOrganizationUserGroup","isDraft","editedAt","isEdited","reactionAnnotations","sourceType","agent","metadata","actions","progress"],iR=["commentId","context","type","isCommentTextAvailable","isCommentResolverUsed","replaceContentHtml","replaceContentText","commentVoiceUrl","from","to","lastUpdated","createdAt","status","attachments","recorders","reactionAnnotationIds","taggedUserContacts","customList","toOrganizationUserGroup","isDraft","editedAt","isEdited","reactionAnnotations","sourceType","agent","metadata","actions","progress"];var gV=["annotationId","context","commentAnnotationId","reactions","lastUpdated","targetElement","targetElementId","position","locationId","location","type","annotationIndex","pageInfo","from","isReactionResolverUsed","iconUrl","iconEmoji","metadata","involvedUserIds"];var mV=["context","annotationId","commentAnnotationId","from","color","lastUpdated","positionX","positionY","screenWidth","screenHeight","screenScrollHeight","screenScrollTop","recorderedElementPath","recorderedElementRect","targetElement","position","locationId","location","type","recordingType","mode","approved","attachment","attachments","annotationIndex","pageInfo","recordedTime","waveformData","displayName","metadata","latestVersion","recordingEditVersions","chunkUrls","isRecorderResolverUsed","isUrlAvailable"];var XOe=["id","featureType","actionType","eventType","actionUser","timestamp","metadata","targetEntityId","targetSubEntityId","changes","entityData","entityTargetData","displayMessageTemplate","displayMessageTemplateData","displayMessage","actionIcon","immutable","isActivityResolverUsed"];var ST=["userId"];var oR=["commonAncestorContainer","commonAncestorContainerFXpath","commonAncestorContainerCFXpath","commonAncestorContainerAnchor","occurrence"],sR=["attachmentId","isAttachmentResolverUsed","name","bucketPath","size","type","url","thumbnail","thumbnailWithPlayIconUrl","metadata","mimeType","previewImages","clientOrganizationId","clientDocumentId"],aR=["attachmentId","isAttachmentResolverUsed","bucketPath","size","type","thumbnail","thumbnailWithPlayIconUrl","metadata","mimeType","previewImages","clientOrganizationId","clientDocumentId"];var EV=["id","tag","type","thumbnailUrl","thumbnailWithPlayIconUrl","videoUrl","audioUrl","videoPlayerUrl","chunkUrls"],cR=["status","targetId","targetType","oldValue","newValue","summary","driftDetected","rejectReason","resolvedBy","resolvedAt","metadata"],lR=["status","targetId","targetType","driftDetected","resolvedBy","resolvedAt"];var Lc="velt://self-hosted-disabled/",Pc=t=>typeof t=="string"&&t.startsWith(Lc),bV=(t,e)=>{try{if(Pc(t))return t;let n=new URL(t),r=n.hostname.split("."),i=r.length>=3?r[0]:"",o=t.replace(n.host,e);if(i){let s=o.includes("?")?"&":"?";o+=`${s}ns=${i}`}return o}catch(n){return M.catch("Error in getProxiedDatabaseUrl: ",n),t}},a0e=t=>{try{let e=localStorage.getItem(F.LOCAL_STORAGE.VELT_AUTH_PROXY_HOST);if(!e)return;let n=atob(e),r=t?.config;n&&r&&(r.apiHost=n,r.tokenApiHost=n)}catch(e){M.catch("Error in applyCachedAuthProxyHost: ",e)}},Mc=(t,e=0)=>{try{let n=3735928559^e,r=1103547991^e;for(let i=0,o;i<t.length;i++)o=t.charCodeAt(i),n=Math.imul(n^o,2654435761),r=Math.imul(r^o,1597334677);return n=Math.imul(n^n>>>16,2246822507)^Math.imul(r^r>>>13,3266489909),r=Math.imul(r^r>>>16,2246822507)^Math.imul(n^n>>>13,3266489909),4294967296*(2097151&r)+(n>>>0)}catch(n){return M.catch("Error in cyrb53: ",n),0}},HX=()=>{try{return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,t=>(+t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+t/4).toString(16))}catch(t){return M.catch("Error in uuidv4: ",t),""}},Vo=t=>{try{return Tn.hashStr(t)}catch(e){return M.catch("Error in hashStr: ",e),t}},OV=t=>{try{return!t||t.trim().length===0?void 0:Tn.hashStr(t)}catch(e){M.catch("Error in hashForAnchor: ",e);return}};function c0e(t,e){let n=[],r=e>=1?Math.floor(e):1;for(let i=0;i<t.length;i+=r)n.push(t.slice(i,i+r));return n}var l0e=t=>Mc(t).toString(),u0e=t=>Vo(t),MV=t=>Vo(t).toString(),d0e=t=>Vo(t).toString(),h0e=(t,e)=>{try{let n=t.userIds?.length?[...t.userIds]:[];return n.includes(e)||n.push(e),me(B({},t),{userIds:n})}catch(n){return M.catch("Error in ensureUserIdInVisibility: ",n),t}},f0e=t=>{try{if(!t)return!1;if(t.iam?.accessMode===dT.PRIVATE)return!0;let e=t.visibilityConfig?.type;return e==="restricted"||e==="organizationPrivate"}catch(e){return M.catch("Error in isAnnotationPrivate: ",e),!1}},p0e=(t,e)=>{let n=[];switch(t.type){case"public":return n.push(F.DEFAULT_VELT_CONTEXT),n;case"organizationPrivate":{let r=[...t.organizationId?[t.organizationId]:[],...t.organizationIds??[]].filter((i,o,s)=>!!i&&s.indexOf(i)===o);if(!r.length)throw new Error("organizationId is required for organizationPrivate visibility type");r.forEach(i=>{let o=MV(i);n.push(`${F.VISIBILITY_ORG_PREFIX}${o}`)});break}case"restricted":{if(!t.userIds?.length)throw new Error("userIds is required for restricted visibility type");t.userIds.filter((i,o,s)=>!!i&&s.indexOf(i)===o).forEach(i=>{let o=Vo(i).toString();n.push(`${F.VISIBILITY_SELF_PREFIX}${o}`)});break}default:throw new Error(`Invalid visibility type: ${t.type}`)}if(e){let r=`${F.VISIBILITY_SELF_PREFIX}${Vo(e).toString()}`;n.includes(r)||n.push(r)}return n},g0e=(t,e)=>{let n={type:t.type};try{if(t.type==="public")return n;t.organizationId&&(n.organizationId=t.organizationId),t.organizationIds?.length&&(n.organizationIds=t.organizationIds);let r=[...t.userIds??[],...e?[e]:[]].filter((i,o,s)=>!!i&&s.indexOf(i)===o);r.length&&(n.userIds=r)}catch(r){M.catch("Error in buildStoredVisibilityConfig: ",r)}return n},m0e=t=>{let e=[F.DEFAULT_VELT_CONTEXT];try{t?.userId&&e.push(`${F.VISIBILITY_SELF_PREFIX}${Vo(t.userId).toString()}`),t?.clientOrganizationId?e.push(`${F.VISIBILITY_ORG_PREFIX}${MV(t.clientOrganizationId)}`):t?.fallbackServerOrganizationId&&e.push(`${F.VISIBILITY_ORG_PREFIX}${t.fallbackServerOrganizationId}`)}catch(n){M.catch("Error in buildViewerVisibilityTokens: ",n)}return e},E0e=(t,e)=>{try{if(!t?.length)return t??[];let n=new Set(e?.tokens??[]);return t.filter(r=>{try{let i=r?.context?.accessFields,o=PV(i),s=r?.visibilityConfig?.type,a=s==="organizationPrivate"||s==="restricted",c=o.length>0&&!i?.includes(F.DEFAULT_VELT_CONTEXT);return!!(!a&&!c||!i?.length||e?.userId&&r?.from?.userId===e.userId||o.some(l=>n.has(l))||e?.userId&&r?.visibilityConfig?.userIds?.includes(e.userId))}catch(i){return M.catch("Error filtering annotation visibility: ",i),!0}})}catch(n){return M.catch("Error in filterAnnotationsVisibleToUser: ",n),t}},LV=t=>{try{return typeof t=="string"&&(t.startsWith(F.VISIBILITY_SELF_PREFIX)||t.startsWith(F.VISIBILITY_ORG_PREFIX))}catch(e){return M.catch("Error in isVisibilityAccessToken: ",e),!1}},PV=t=>{try{return(t||[]).filter(e=>LV(e))}catch(e){return M.catch("Error in extractVisibilityAccessTokens: ",e),[]}},_0e=t=>{try{return!!t&&typeof t=="object"&&Object.keys(t).some(e=>!(e==="default"&&t[e]==="velt"))}catch(e){return M.catch("Error in isCustomerContextAccess: ",e),!1}},T0e=(t,e)=>{try{let n=Array.isArray(e)?e:[],r=n.length>0&&!n.includes(F.DEFAULT_VELT_CONTEXT),i=t;if(r&&t?.access&&typeof t.access=="object"&&t.access.default==="velt"){let s=B({},t.access);delete s.default,i=me(B({},t),{access:s})}let o=pQ(i);return r&&(o=o.filter(s=>s!==F.DEFAULT_VELT_CONTEXT)),r?[...new Set([...n,...o])]:o}catch(n){return M.catch("Error in mergeAccessFieldTokenFamilies: ",n),Array.isArray(e)?e:[]}},$X=t=>{try{if(!t)return null;let e=t?.context?.accessFields??[];if(!e?.length)return null;let n=PV(e),r=t?.visibilityConfig?.type,i=r==="restricted"||r==="organizationPrivate",o=n.length>0&&!e.includes(F.DEFAULT_VELT_CONTEXT);if(!i&&!o)return null;let s=n.some(h=>h.startsWith(F.VISIBILITY_ORG_PREFIX)),c={type:i?r:s?"organizationPrivate":"restricted",accessTokens:n},l=t?.visibilityConfig?.userIds;l?.length&&(c.userIds=[...l]);let d=[...t?.visibilityConfig?.organizationId?[t.visibilityConfig.organizationId]:[],...t?.visibilityConfig?.organizationIds??[]].filter((h,f,g)=>!!h&&g.indexOf(h)===f);return d.length&&(c.organizationIds=d),c}catch(e){M.catch("Error in buildNotificationVisibilityStamp: ",e);try{let n=t?.visibilityConfig?.type;if(n==="restricted"||n==="organizationPrivate")return{type:n,accessTokens:[]}}catch{}return null}},y0e=(t,e)=>{try{if(!e?.length)return[];let n=$X(t);if(!n||n.type!=="restricted")return[];let r=new Set([...n.userIds??[],...t?.from?.userId?[t.from.userId]:[]]),i=new Set(n.accessTokens??[]);return e.filter(o=>!o||r.has(o)?!1:!i.has(`${F.VISIBILITY_SELF_PREFIX}${Vo(o).toString()}`))}catch(n){return M.catch("Error in getVisibilityDeniedUserIds: ",n),[]}},I0e=(t,e)=>{try{if(!t?.length)return t??[];let n=new Set([F.DEFAULT_VELT_CONTEXT,...e||[]]);return t.filter(r=>{try{let i=r?.context?.accessFields;if(!i?.length)return!0;let o=i.filter(s=>!LV(s));return o.length?o.some(s=>n.has(s)):!0}catch(i){return M.catch("Error filtering annotation doc-context match: ",i),!0}})}catch(n){return M.catch("Error in filterAnnotationsMatchingDocContext: ",n),t}},v0e=(t,e)=>{try{if(!t?.length)return t??[];let n=e?.statusIds?.filter(a=>a!=null),r=e?.locationIds?.filter(a=>a!=null),i=n?.length?new Set(n):null,o=r?.length?new Set(r):null,s=e?.veltFolderId||null;return!i&&!o&&!s?t:t.filter(a=>{try{return!(i&&!i.has(a?.status?.id)||s&&a?.metadata?.veltFolderId!==s||o&&!o.has(a?.location?.id))}catch(c){return M.catch("Error filtering annotation query scope: ",c),!0}})}catch(n){return M.catch("Error in filterAnnotationsMatchingQueryScope: ",n),t}},S0e=(t,e)=>{if(!e||!t?.length)return t;let n=new Set(e);return t.filter(r=>{let i=r?.context?.accessFields;return Array.isArray(i)&&i.some(o=>n.has(o))})},A0e=t=>{try{if(t)return typeof t=="string"?Tn.hashStr(t):Array.isArray(t)?Tn.hashStr(t.join("-")):"";{let e=HX();return Tn.hashStr(e)}}catch(e){return M.catch("Error in getMultiThreadAnnotationId: ",e),""}},xV=(t,e,n)=>{try{if(t&&e){if(t.featureAllowList&&t.featureAllowList.length&&!t.featureAllowList.includes(n)||t.userIdAllowList&&t.userIdAllowList.length&&!t.userIdAllowList.includes(e.userId)||t.userGroupIdAllowList&&t.userGroupIdAllowList.length&&!t.userGroupIdAllowList.includes(e.groupId||"")||t.userPlanAllowList&&t.userPlanAllowList.length&&!t.userPlanAllowList.includes(e.plan||""))return!1;if(t.urlAllowList){let r=window.location.href;if(t.urlAllowList.length&&!t.urlAllowList.filter(i=>r.includes(i)).length)return!1}return!0}return!1}catch(r){return M.catch("Error in isFeatureAllowed: ",r),!1}},rd=()=>{try{let t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e="";for(let n=0;n<20;n++)e+=t.charAt(Math.floor(Math.random()*t.length));return e}catch(t){return M.catch("Error in utils generateId: ",t),""}},C0e=t=>{try{let e=0;if(t){let n=new Date().getTime();e=Math.abs(n-t)}return e}catch(e){return M.catch("Error in utils getFirebaseTimeDiffInMins: ",e),0}};var kV=()=>{try{return qt.debugMode||!!sessionStorage.getItem("debugMode")||!!sessionStorage.getItem("forceDebugMode")}catch(t){return M.catch("Error in showLogs: ",t),!1}},FV=()=>{try{return!!sessionStorage.getItem("debugContextMode")}catch(t){return M.catch("Error in showContextLogs: ",t),!1}},UV=t=>{try{return typeof t!="object"?Object.assign({},...Object.keys(t).sort().map(e=>({[e]:t[e]&&typeof t[e]=="object"?UV(t[e]):t[e]}))):t}catch(e){return M.catch("Error in sortObjectByKeys: ",e),t}},uR=t=>{try{return t!==null&&typeof t=="object"&&!Array.isArray(t)}catch{return!1}},_V=t=>{try{return uR(t)?Object.fromEntries(Object.entries(t).sort(([e],[n])=>e.localeCompare(n)).map(([e,n])=>[e,uR(n)?_V(n):Array.isArray(n)?n.map(r=>uR(r)?_V(r):r):n])):t}catch{return t}},TV=(t,e)=>{try{return typeof e!="object"||e===null?t===e:typeof t!="object"||t===null?!1:Array.isArray(e)?Array.isArray(t)?e.every(n=>t.some(r=>TV(r,n))):!1:Object.keys(e).every(n=>Object.prototype.hasOwnProperty.call(t,n)?TV(t[n],e[n]):!1)}catch{return!1}},WX=(t,e,n)=>y(null,null,function*(){try{let r=yield KX(e),i=new Uint8Array(new TextEncoder().encode(n)).slice(0,16),o=new TextEncoder().encode(t),s=yield window.crypto.subtle.encrypt({name:"AES-CBC",iv:i},r,o);return btoa(String.fromCharCode(...new Uint8Array(s)))}catch(r){return M.catch("Error in encrypt: ",r),t}}),zX=(t,e,n)=>y(null,null,function*(){try{let r=yield qX(e),i=new Uint8Array(new TextEncoder().encode(n)).slice(0,16),o=new Uint8Array(atob(t).split("").map(a=>a.charCodeAt(0))),s=yield window.crypto.subtle.decrypt({name:"AES-CBC",iv:i},r,o);return new TextDecoder().decode(s)}catch(r){return M.catch("Error in decrypt: ",r),t}}),qX=t=>y(null,null,function*(){try{let e=new TextEncoder().encode(t),n=new Uint8Array(32);return n.fill(0),n.set(e.slice(0,32)),yield window.crypto.subtle.importKey("raw",n,"AES-CBC",!1,["decrypt"])}catch(e){throw M.catch("Error in importDecryptKey:",e),e}}),wT=(t,e)=>y(null,null,function*(){try{let n="Velt"+e;return yield WX(JSON.stringify(t),n,Vo(n))}catch(n){return M.catch("Error in encryptData: ",n),t}}),sp=(t,e)=>y(null,null,function*(){try{let n="Velt"+e,r=yield zX(t,n,Vo(n));return JSON.parse(r)}catch(n){return M.catch("Error in decryptData: ",n),null}}),D0e=t=>{try{switch(t?.region){case"asiaSouthEast1":return"asiaSouthEast1";case"asiaNorthEast1":return"asiaNorthEast1";case"europeWest1":return"europeWest1";case"australiaSouthEast1":return"australiaSouthEast1";default:return"usCentral1"}}catch(e){return M.catch("Error in getRegion: ",e),"usCentral1"}},KX=t=>y(null,null,function*(){try{let e=new TextEncoder().encode(t),n=new Uint8Array(32);return n.fill(0),n.set(e.slice(0,32)),yield window.crypto.subtle.importKey("raw",n,"AES-CBC",!1,["encrypt"])}catch(e){throw M.catch("Error in importKey:",e),e}}),R0e=t=>{try{if(t&&typeof t=="object"){let e=UV(t);return Mc(JSON.stringify(e))}else return null}catch(e){return M.catch("Error in utils generateLocationId: ",e),null}},qi=(t,e=[])=>(t?.tagName?.toLowerCase().indexOf("velt-")>=0&&![F.TAGS.VELT_VIDEO_PLAYER.toLowerCase()].includes(t?.tagName?.toLowerCase())||t?.tagName?.toLowerCase().indexOf("snippyly-")>=0||t?.className?.split&&(t?.className?.split(" ")?.indexOf("snippyly-overlay-panel")>=0||t?.className?.split(" ")?.indexOf("cdk-overlay-container")>=0))&&!e?.includes(t?.tagName?.toLowerCase())?!0:t?.parentNode&&qi(t?.parentNode,e),N0e=(t,e=[])=>{try{let n=typeof t.composedPath=="function"?t.composedPath():[],r=n.length>0?n:[t?.target];for(let i of r){let o=i;if(!(!o||typeof o.tagName!="string")&&qi(o,e))return!0}}catch(n){M.catch("Error in utils isSnippylyEventTarget: ",n)}return!1},id=t=>{try{return!!document?.body?.contains(t)}catch(e){return M.catch("Error in utils isElementInsideBody: ",e),!1}};var YX=(t,e)=>{try{return Object.prototype.toString.call(t)===Object.prototype.toString.call(e)?Object.prototype.toString.call(t)==="[object Object]"||Object.prototype.toString.call(t)==="[object Array]"?Object.keys(t).length!==Object.keys(e).length?!1:Object.keys(t).every(n=>YX(t[n],e[n])):t===e:!1}catch(n){return M.catch("Error in utils deepCompare: ",n),!1}},w0e=(t,e,n=1)=>{try{if(e){let r=yV(e.textContent,t,n);if(r>=0){let i=e.querySelector("script")!==null,o=(e?.ownerDocument).createNodeIterator(e,NodeFilter.SHOW_TEXT,i?{acceptNode:g=>g.parentElement?.tagName==="SCRIPT"?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}:null),s,a=[];for(;s=o.nextNode();)a.push(s);let c=r;if(i){let g=a.reduce((I,S)=>I+(S.textContent||""),""),E=yV(g,t,n);if(E<0)return[];c=E}let l=[],d=t.length,h=c+d,f=0;for(let g=0;g<a.length;g++){let E=a[g],I=f;if(f+=E.textContent?.length,f>=c&&!l.length?l.push({textNode:E,startOffset:c-I}):f>=c&&f<h&&l.push({textNode:E}),f>=h){if(l.length===1&&l[0].textNode===E){l.push({textNode:E,endOffset:c-I+t.length});break}let S=d;l.forEach(L=>{S-=L.textNode.textContent?.length-(L.startOffset||0)}),l.push({textNode:E,endOffset:S});break}}return l}}return[]}catch(r){return M.catch("Error in utils calculateNodes: ",r),[]}},yV=(t,e,n=1)=>{try{if(t?.includes(e)){let r=t.split(e,n);return r.length===n?r.join(e).length:-1}else return-1}catch(r){return M.catch("Error in utils getTextPosition: ",r),-1}},gR=(t,e,n,r,i)=>{try{let o=new Range;o.setStart(t,e),o.setEnd(n,r);let s=o.commonAncestorContainer,c=(s.nodeType===Node.ELEMENT_NODE?s:s.parentElement)?.querySelector("script")!==null,l;if(c){let h=o.cloneContents();h.querySelectorAll("script").forEach(f=>f.remove()),l=h.textContent||""}else l=o.toString();let d=0;if(t.nodeType===Node.TEXT_NODE){let h=t,f="";if(h)for(;h=h.previousSibling;)if(c){if(h.nodeType===Node.ELEMENT_NODE&&h.tagName==="SCRIPT")continue;if(h.nodeType===Node.ELEMENT_NODE){let g=h;if(g.querySelector("script")){let E=g.cloneNode(!0);E.querySelectorAll("script").forEach(I=>I.remove()),f=(E.textContent||"")+f}else f=(h.textContent||"")+f}else h.parentElement?.tagName!=="SCRIPT"&&(f=(h.textContent||"")+f)}else f=(h.textContent||"")+f;if(f){let g=new RegExp(IV(i),"g");d=(f.match(g)||[]).length}}if(l){let h=new RegExp(IV(i),"g");return(l.match(h)||[]).length+d}else return d}catch(o){return M.catch("Error in utils getSelectedTextOccurrenceInRange: ",o),0}},IV=t=>{try{return t&&typeof t=="string"?t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"):t}catch(e){return M.catch("Error in utils escapeRegExp: ",e),t}},XX=t=>{try{return t==null?null:t.scrollHeight>t.clientHeight?t:XX(t?.parentNode)}catch(e){return M.catch("Error in utils getScrollableParent: ",e),null}},DT=t=>{try{return t==null?[]:t.scrollHeight>t.clientHeight||t.scrollWidth>t.clientWidth?[t,...DT(t?.parentNode)]:DT(t?.parentNode)}catch(e){return M.catch("Error in utils getScrollableParents: ",e),[]}};function b0e(t){try{if(!t)return[];let e=DT(t),n=t;for(;n;){let r=n.getRootNode();if(r instanceof ShadowRoot)e.push(...DT(r.host)),n=r.host;else break}return e}catch(e){return M.catch("Error in utils getScrollableParentsCrossingShadowBoundary: ",e),[]}}var O0e=(t,e)=>{try{if(t&&e){let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),i=n.top-r.top+(e.tagName?.toLowerCase()==="html"?0:e.scrollTop),o=n.left-r.left;return{top:i,left:o}}else return null}catch(n){return M.catch("Error in utils getRelativeTopLeftPosition: ",n),null}},VV=(t,e)=>`${Mc(t+"_"+e)}`,BV=t=>{try{let e=TT(t),n=new Et(!1);return e&&Object.assign(n,e),n.url=e?.url??window.location.href,n.path=e?.path??window.location.pathname,n.queryParams=e?.queryParams??window.location.search,n.baseUrl=e?.baseUrl??window.location.origin,n.title=e?.title??document.title,n}catch(e){M.catch("Error in utils getPageInfo: ",e);return}},QX=t=>{try{return t?t?.hasAttribute&&t?.hasAttribute(F.ATTRIBUTES.VELT_COMMENT_DISABLED)?!0:QX(t?.parentElement):!1}catch(e){return M.catch("Error in utils isCommentDisabledOnElement: ",e),!1}},ap=".ProseMirror[contenteditable]",vV=new Set,od=(t,e)=>{try{if(vV.has(t))return;vV.add(t),M.catch(`Error in utils ${t} (treated as "not editor content"): `,e)}catch{}};var Oc=t=>{try{return!t||!t.isConnected?!1:!!(t.nodeType===Node.ELEMENT_NODE?t:t.parentElement)?.closest?.(ap)}catch(e){return od("isNodeInsideRichTextEditor",e),!1}},SV=t=>{if(!t||!t.isConnected)return null;let e=null,n=t.nodeType===Node.ELEMENT_NODE?t:t.parentElement;for(;n=n?.closest?.(ap)??null;)e=n,n=n.parentElement;return e},JX=t=>{try{return!!t?.querySelector?.(ap)}catch(e){return od("containsRichTextEditor",e),!1}},GV=(t,e)=>{let n=e.ownerDocument.createRange();return n.selectNodeContents(e),t.compareBoundaryPoints(Range.START_TO_START,n)>0&&n.setStart(t.startContainer,t.startOffset),t.compareBoundaryPoints(Range.END_TO_END,n)<0&&n.setEnd(t.endContainer,t.endOffset),n},ZX=(t,e)=>{let n=t;for(;n&&n!==e;){if(n.nextSibling)return n.nextSibling;n=n.parentNode}return null},eQ=(t,e)=>{let n=GV(t,e);if(n.collapsed)return!1;let{startContainer:r,startOffset:i,endContainer:o,endOffset:s}=n,a=d=>{let h=d===r?i:0;return(d===o?s:d.length)>h},c=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT),l;for(r.nodeType===Node.TEXT_NODE?l=r:(l=r.childNodes[i]??ZX(r,e),l&&l.nodeType!==Node.TEXT_NODE&&(c.currentNode=l,l=c.nextNode()));l;){if(n.comparePoint(l,0)>0)return!1;if(a(l))return!0;c.currentNode=l,l=c.nextNode()}return!1},jV=t=>{let e=new Set,n=SV(t.startContainer),r=SV(t.endContainer);n&&e.add(n),r&&e.add(r);let i=t.commonAncestorContainer,s=(i?.nodeType===Node.TEXT_NODE?i.parentElement:i)?.querySelectorAll?.(ap)??[];for(let a=0;a<s.length;a++)t.intersectsNode(s[a])&&e.add(s[a]);return e},AV=(t,e)=>{let n=e.parentNode;if(!n)return!1;let r=Array.prototype.indexOf.call(n.childNodes,e);return t.comparePoint(n,r)===0&&t.comparePoint(n,r+1)===0},tQ=t=>{try{if(!t||t.collapsed)return!1;for(let e of jV(t))if(eQ(t,e))return!0;return!1}catch(e){return od("doesRangeTouchRichTextEditor",e),!1}},M0e=t=>{try{if(!t||t.collapsed)return!1;if(tQ(t))return!0;for(let e of jV(t)){if(AV(t,e))return!0;let n=GV(t,e);if(n.collapsed)continue;let r=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT);for(;r.nextNode();)if(AV(n,r.currentNode))return!0}return!1}catch(e){return od("doesRangeIntersectRichTextEditorNode",e),!1}},nQ=t=>{try{if(!t||Oc(t))return;if(!JX(t)){t.normalize();return}Array.from(t.childNodes).forEach(e=>{e.nodeType===Node.ELEMENT_NODE&&!e.matches(ap)&&nQ(e)})}catch(e){od("normalizeOutsideRichTextEditors",e)}},L0e=t=>{try{let e=Oc(t.startContainer),n=Oc(t.endContainer);if(!e&&!n)return!0;let r=t.commonAncestorContainer,i=r.nodeType===Node.ELEMENT_NODE?r:r.parentNode;if(!i)return!1;let o=(i.ownerDocument||document).createTreeWalker(i,NodeFilter.SHOW_TEXT),s=null,a=null;for(;o.nextNode();){let c=o.currentNode;c.length&&t.intersectsNode(c)&&!Oc(c)&&(s=s||c,a=c)}return!s||!a?!1:(e&&t.setStart(s,0),n&&t.setEnd(a,a.length),!0)}catch(e){return od("moveRangeBoundariesOutOfRichTextEditors",e),!1}},rQ=t=>{try{return t?t?.hasAttribute&&t?.hasAttribute(F.ATTRIBUTES.VELT_TAG_DISABLED)?!0:rQ(t?.parentElement):!1}catch(e){return M.catch("Error in utils isTagDisabledOnElement: ",e),!1}},iQ=t=>{try{return t?t?.hasAttribute&&t?.hasAttribute(F.ATTRIBUTES.VELT_ARROW_DISABLED)?!0:iQ(t?.parentElement):!1}catch(e){return M.catch("Error in utils isArrowDisabledOnElement: ",e),!1}},oQ=t=>{try{return t?t?.hasAttribute&&t?.hasAttribute(F.ATTRIBUTES.VELT_AREA_DISABLED)?!0:oQ(t?.parentElement):!1}catch(e){return M.catch("Error in utils isAreaDisabledOnElement: ",e),!1}},sQ=t=>{try{return t?t?.hasAttribute&&t?.hasAttribute(F.ATTRIBUTES.VELT_RECORDER_DISABLED)?!0:sQ(t?.parentElement):!1}catch(e){return M.catch("Error in utils isRecorderDisabledOnElement: ",e),!1}};var xc=()=>{try{return window?.Snippyly?.version}catch(t){return M.catch("Error in utils getSdkVersion: ",t),null}},P0e=t=>{try{return Object.fromEntries(Object.entries(t).filter(([e,n])=>n!==void 0))}catch(e){return M.catch("Error in utils removeUndefinedKeys: ",e),t}},x0e=t=>{try{let e=new URL(t);return Object.values(F.URL_PARAMS).forEach(n=>{e.searchParams.delete(n)}),e.href}catch(e){return M.catch("Error in utils excludeSnippylyParamsFromUrl: ",e),t}},k0e=t=>{try{navigator.clipboard.writeText(t)}catch(e){M.catch("Error in copyToClipboard: ",e)}},dR=t=>{try{let e=HV(t);return e&&typeof e=="string"&&e.includes("/svg")&&(e=e.split("/svg")[0]+"/*[name()='svg']"),e}catch(e){M.catch("Error in utils getXPath:",e)}},HV=t=>{try{if(t){if(typeof t=="string")return document.evaluate(t,document,null,0,null);if(!t||t.nodeType!=1)return"";if(t.id&&t?.tagName?.toLowerCase()!=="svg"&&document.querySelectorAll(`[id='${t.id}']`)?.length===1)return"//*[@id='"+t.id+"']";let e=[].filter.call(t.parentNode?.children?t.parentNode?.children:[],function(n){return n.tagName==t.tagName});return HV(t.parentNode)+"/"+t.tagName.toLowerCase()+(e.length>1?"["+([].indexOf.call(e,t)+1)+"]":"")}}catch(e){M.catch("Error in utils calculateXPath:",e)}},F0e=t=>{try{let e=[];return t.forEach(n=>{let r={};r.commonAncestorContainer=aQ(n.commonAncestorContainer),r.text=n.toString(),r.occurrence=gR(n.commonAncestorContainer,0,n.startContainer,n.startOffset,n.toString())+1,e.push(r)}),e}catch{return[]}},aQ=t=>{try{if(t.nodeType===Node.TEXT_NODE){let e=1,n=t.previousSibling;for(;n;)n.nodeType===Node.TEXT_NODE&&e++,n=n.previousSibling;return dR(t.parentElement)}else return dR(t)}catch(e){return M.catch("Error in utils getXPathForText: ",e),dR(t)}},cQ=(t,e)=>{try{return t?t?.hasAttribute&&(e&&t.hasAttribute("contenteditable")||t?.getAttribute(F.ATTRIBUTES.VELT_LIVE_SELECTION_ENABLED)==="true")?t:cQ(t?.parentElement,e):null}catch(n){return M.catch("Error in utils getSelectionEnabledElement: ",n),null}},U0e=t=>{try{let e,n=[],r=document.createTreeWalker(t,NodeFilter.SHOW_TEXT,null);for(;e=r.nextNode();)n.push(e);return n}catch(e){return M.catch("Error in utils getTextNodesInsideElement: ",e),[]}},V0e=t=>{try{return t<576||t>=576&&t<767?"Mobile":t>=768&&t<992?"Tablet":t>=992&&t<1520?"Desktop":"Monitor"}catch(e){return M.catch("Error in utils getDeviceTypeFromDeviceWidth: ",e),""}},$V=t=>new Promise(e=>setTimeout(e,t)),B0e=(t,e=0)=>new Promise((n,r)=>{let i=document.createElement("video"),o=navigator.userAgent.includes("Firefox");o&&(i.preload="auto"),i.setAttribute("src",URL.createObjectURL(t)),i.load(),i.addEventListener("error",s=>{r("error when loading video file: "+s)}),i.addEventListener("loadedmetadata",()=>{let s=()=>{if(i.duration<e){r("video is too short.");return}setTimeout(()=>{i.currentTime=e},200),i.addEventListener("seeked",()=>{let a=document.createElement("canvas");a.width=i.videoWidth,a.height=i.videoHeight;let c=a.getContext("2d");c.drawImage(i,0,0,a.width,a.height),c.canvas.toBlob(l=>{i.remove(),n(l)},"image/jpeg",.75)})};if(o&&i.duration>0&&i.duration<10&&t.size>1e6){setTimeout(()=>{i.duration<e&&(e=Math.max(.1,i.duration/2)),s()},1e3);return}s()})}),G0e=t=>{try{return new Promise((e,n)=>{let r=new FileReader;r.onloadend=()=>e(r.result),r.readAsDataURL(t)})}catch(e){return M.catch("Error in utils blobToBase64: ",e),Promise.resolve("")}},j0e=(t,e="image/jpeg")=>{try{let n=atob(t.split(",")[1]),r=new ArrayBuffer(n.length),i=new Uint8Array(r);for(let o=0;o<n.length;o++)i[o]=n.charCodeAt(o);return new Blob([r],{type:e})}catch(n){return M.catch("Error in utils base64ToBlob: ",n),null}},H0e=(t,e,n=20)=>new Promise((r,i)=>{let o=new Image;o.crossOrigin="Anonymous",o.onload=()=>{let s=o.width,a=o.height,c=600,l=a/s*c,d="http://www.w3.org/2000/svg",h=document.createElementNS(d,"svg");h.setAttribute("xmlns",d),h.setAttribute("width",c.toString()),h.setAttribute("height",l.toString()),h.setAttribute("viewBox",`0 0 ${c} ${l}`);let f=document.createElementNS(d,"circle"),g=document.createElementNS(d,"polygon"),E=16,I=E+16,S=c/2,L=l/2;if(f.setAttribute("cx",S.toString()),f.setAttribute("cy",L.toString()),f.setAttribute("r",I.toString()),f.setAttribute("fill","lightgrey"),g.setAttribute("points",`${S-E/2},${L-E} ${S-E/2},${L+E} ${S+E},${L}`),g.setAttribute("fill","#ffffff"),h.appendChild(f),h.appendChild(g),e){let C=e.length*16-10,v=16*1.5,A=(c-C)/2,R=l-v-10,N=document.createElementNS(d,"rect");N.setAttribute("x",A.toString()),N.setAttribute("y",R.toString()),N.setAttribute("width",C.toString()),N.setAttribute("height",v.toString()),N.setAttribute("fill","#353945b3"),N.setAttribute("rx","12"),h.appendChild(N);let O=document.createElementNS(d,"text");O.textContent=e,O.setAttribute("x",(c/2).toString()),O.setAttribute("y",(R+16).toString()),O.setAttribute("font-size","16"),O.setAttribute("text-anchor","middle"),O.setAttribute("fill","white"),h.appendChild(O)}let V=new XMLSerializer().serializeToString(h),K=new Image,oe=new Blob([V],{type:"image/svg+xml;charset=utf-8"}),ge=URL.createObjectURL(oe);K.onload=()=>{let te=document.createElement("canvas");te.width=c,te.height=l;let C=te.getContext("2d");C.beginPath(),C.moveTo(n,0),C.lineTo(c-n,0),C.quadraticCurveTo(c,0,c,n),C.lineTo(c,l-n),C.quadraticCurveTo(c,l,c-n,l),C.lineTo(n,l),C.quadraticCurveTo(0,l,0,l-n),C.lineTo(0,n),C.quadraticCurveTo(0,0,n,0),C.closePath(),C.clip(),C.drawImage(o,0,0,c,l),C.drawImage(K,0,0,c,l);let v=te.toDataURL("image/png");r(v)},K.onerror=i,K.src=ge},o.onerror=i,o.src=t});var $0e=t=>{try{return t?.replace(/[\n\t\u200D]/g,"")?.split(/\s+/)?.filter(r=>r?.trim()?.length)||[]}catch(e){return M.catch("Error in utils getWords: ",e),[]}},W0e=(t,e=[])=>{try{let n=e.map(r=>`[${r}="${t}"]`).join(",");return document.querySelector(n)}catch(n){return M.catch("Error in utils getElementByAttributes: ",n),null}},z0e=(t,e=[])=>{try{let n=e.map(r=>`[${r}="${t}"]`).join(",");return document.querySelectorAll(n)}catch(n){return M.catch("Error in utils getElementsByAttributes: ",n),[]}},AT=t=>{try{let e=Math.floor(t/3600),n=Math.floor((t-e*3600)/60),r=Math.floor(t-e*3600-n*60);return e&&e<10&&(e="0"+e),n<10&&(n="0"+n),r<10&&(r="0"+r),(e?e+":":"")+n+":"+r}catch{return""}},lQ=10,q0e=t=>{try{if(typeof t!="number"||!isFinite(t))return 0;let e=1e3/lQ;return Math.round(t*e)/e}catch{return t}},K0e=t=>{try{if(!t||typeof t!="object")return;let e={videoPlayerId:t.videoPlayerId,currentMediaPosition:t.currentMediaPosition,locationName:t.locationName};return t.version?.id&&t.version?.name&&(e.version={id:t.version.id,name:t.version.name}),e}catch{return}},Y0e=(t,e=10)=>{try{if(!t||!t.currentTime)throw new Error("Invalid video element reference provided");let n=t.currentTime,r=Math.floor(n/e)*e,i=r+e;return{startSlot:AT(r),endSlot:AT(i),timeSlot:AT(r)+" - "+AT(i)}}catch{return null}},uQ=t=>{try{return t?typeof ShadowRoot<"u"&&t instanceof ShadowRoot?!0:Object.prototype.toString.call(t)==="[object ShadowRoot]":!1}catch{return!1}},WV=t=>{let e=[];try{let n=t;for(;n;){let r=n?.getRootNode?.();if(!r||r===n||!uQ(r))break;e.push(r),n=r.host}}catch(n){M.catch("Error in utils getShadowRootsForElement: ",n)}return e},hR=(t,e)=>{try{let n=r=>!!r&&(r===t||t.contains(r));return n(e.startContainer)&&n(e.endContainer)}catch{return!1}},CV=new Set,zV=(t,e)=>{try{let n=`${t}|${e}`;if(CV.has(n))return;CV.add(n),M.catch(`Caret resolution failed in ${t} (${e}). Mentions and text replacement may not work in this browser.`)}catch{}};var mR=t=>{try{if(!t)return{status:"failed",reason:"no-element"};let e=WV(t),n=window.getSelection(),r=!1,i=e[0];if(i&&typeof i.getSelection=="function"){let o=i.getSelection();if(o?.rangeCount){r=!0;let s=o.getRangeAt(0);if(hR(t,s))return{status:"resolved",range:s,selection:o}}}if(e.length&&typeof n?.getComposedRanges=="function")try{let s=n.getComposedRanges({shadowRoots:e})?.[0];if(s&&(r=!0,hR(t,s))){let a=document.createRange();return a.setStart(s.startContainer,s.startOffset),a.setEnd(s.endContainer,s.endOffset),{status:"resolved",range:a,selection:n}}}catch{}if(n?.rangeCount){r=!0;let o=n.getRangeAt(0);if(hR(t,o))return{status:"resolved",range:o,selection:n}}return r?{status:"failed",reason:"caret-not-resolvable-in-element"}:{status:"no-caret"}}catch(e){return M.catch("Error in utils resolveCaretRangeInElement: ",e),{status:"failed",reason:"threw"}}},X0e=t=>{try{let e=mR(t);if(e.status==="resolved"&&e.selection)return e.selection;let n=WV(t)[0];return n&&typeof n.getSelection=="function"?n.getSelection():window.getSelection()}catch(e){return M.catch("Error in utils getSelectionForElement: ",e),window.getSelection()}},DV=(t,e)=>{try{return!t||!e?!1:typeof t.setBaseAndExtent=="function"?(t.setBaseAndExtent(e.startContainer,e.startOffset,e.startContainer,e.startOffset),!0):(t.removeAllRanges(),t.addRange(e),!0)}catch(n){return M.catch("Error in utils setCaretToRangeStart: ",n),!1}},Q0e=(t,e=["@"])=>{try{let n="",r=mR(t);if(r.status==="failed")return zV("getWordAtCursor",r.reason),"";if(r.status==="resolved"){let i=r.range,o=i.endOffset,s=i?.commonAncestorContainer?.textContent;s?n=dQ(s,o,e):n=""}return n}catch(n){return M.catch("Error in utils getWordAtCursor: ",n),""}};var dQ=(t,e,n=["@"])=>{try{let r=-1,i=!1;for(let o of n){let s=t.lastIndexOf(o,e),a=s>0?t.lastIndexOf(o,s-1):-1;if(s>r){let c=RT(t,s,e),l=NT(t,s,e);if(c||l){if(a!==-1){let d=RT(t,a,s),h=NT(t,a,s);!d&&!h&&(r=a,i=!0)}}else r=s,i=!0}}return r!==-1&&i?t.substring(r,e):""}catch(r){return M.catch("Error in utils getStringFromLastAtSymbol: ",r),""}},RT=(t,e,n)=>{try{if(e===0)return!1;let r=t.charAt(e-1);return!(r===" "||r==="\xA0"||r===`
123
+ `}};var iV=class{constructor(){this.type="recorder",this.recordingType="audio",this.mode="floating",this.attachment=null,this.attachments=[],this.pageInfo=new Et}};var oV=class{constructor(){this.type="rewriter",this.rewriterType="copywriter",this.pageInfo=new Et}};var rp=class{constructor(){this.screenWidth=0,this.screenHeight=0,this.screenScrollHeight=0}};var sV=class{constructor(){this.pageInfo=new Et}},dwe={Start:"start",End:"end"},hwe={Avatar:"avatar",Label:"label"};var aV=class{constructor(){this.sources=[],this.playerState=new rR}},rR=class{constructor(){this.volume=1}};var cV=class{constructor(){this.to=[],this.resolved=!1,this.type="tag",this.pageInfo=new Et}};var lV=class{constructor(){this.visibility="private"}};var dV=class{constructor(){this.reactions=[],this.type="reaction",this.pageInfo=new Et,this.isReactionResolverUsed=!1}};var hV=class{};var Wwe={EDITOR:"editor",VIEWER:"viewer"},zwe={DOES_NOT_EXIST:"does_not_exist",PERMISSION_DENIED:"permission_denied",SOMETHING_WENT_WRONG:"something_went_wrong"};var GX=(function(t){return t.INTERNAL="internal",t.EXTERNAL="external",t})(GX||{}),jX=(function(t){return t.UPDATE_DATA="updateData",t})(jX||{});var Tn=class t{constructor(){this._dataLength=0,this._bufferLength=0,this._state=new Int32Array(4),this._buffer=new ArrayBuffer(68),this._buffer8=new Uint8Array(this._buffer,0,68),this._buffer32=new Uint32Array(this._buffer,0,17),this.start()}static hashStr(e,n=!1){return this.onePassHasher.start().appendStr(e).end(n)}static hashAsciiStr(e,n=!1){return this.onePassHasher.start().appendAsciiStr(e).end(n)}static _hex(e){let n=t.hexChars,r=t.hexOut,i,o,s,a;for(a=0;a<4;a+=1)for(o=a*8,i=e[a],s=0;s<8;s+=2)r[o+1+s]=n.charAt(i&15),i>>>=4,r[o+0+s]=n.charAt(i&15),i>>>=4;return r.join("")}static _md5cycle(e,n){let r=e[0],i=e[1],o=e[2],s=e[3];r+=(i&o|~i&s)+n[0]-680876936|0,r=(r<<7|r>>>25)+i|0,s+=(r&i|~r&o)+n[1]-389564586|0,s=(s<<12|s>>>20)+r|0,o+=(s&r|~s&i)+n[2]+606105819|0,o=(o<<17|o>>>15)+s|0,i+=(o&s|~o&r)+n[3]-1044525330|0,i=(i<<22|i>>>10)+o|0,r+=(i&o|~i&s)+n[4]-176418897|0,r=(r<<7|r>>>25)+i|0,s+=(r&i|~r&o)+n[5]+1200080426|0,s=(s<<12|s>>>20)+r|0,o+=(s&r|~s&i)+n[6]-1473231341|0,o=(o<<17|o>>>15)+s|0,i+=(o&s|~o&r)+n[7]-45705983|0,i=(i<<22|i>>>10)+o|0,r+=(i&o|~i&s)+n[8]+1770035416|0,r=(r<<7|r>>>25)+i|0,s+=(r&i|~r&o)+n[9]-1958414417|0,s=(s<<12|s>>>20)+r|0,o+=(s&r|~s&i)+n[10]-42063|0,o=(o<<17|o>>>15)+s|0,i+=(o&s|~o&r)+n[11]-1990404162|0,i=(i<<22|i>>>10)+o|0,r+=(i&o|~i&s)+n[12]+1804603682|0,r=(r<<7|r>>>25)+i|0,s+=(r&i|~r&o)+n[13]-40341101|0,s=(s<<12|s>>>20)+r|0,o+=(s&r|~s&i)+n[14]-1502002290|0,o=(o<<17|o>>>15)+s|0,i+=(o&s|~o&r)+n[15]+1236535329|0,i=(i<<22|i>>>10)+o|0,r+=(i&s|o&~s)+n[1]-165796510|0,r=(r<<5|r>>>27)+i|0,s+=(r&o|i&~o)+n[6]-1069501632|0,s=(s<<9|s>>>23)+r|0,o+=(s&i|r&~i)+n[11]+643717713|0,o=(o<<14|o>>>18)+s|0,i+=(o&r|s&~r)+n[0]-373897302|0,i=(i<<20|i>>>12)+o|0,r+=(i&s|o&~s)+n[5]-701558691|0,r=(r<<5|r>>>27)+i|0,s+=(r&o|i&~o)+n[10]+38016083|0,s=(s<<9|s>>>23)+r|0,o+=(s&i|r&~i)+n[15]-660478335|0,o=(o<<14|o>>>18)+s|0,i+=(o&r|s&~r)+n[4]-405537848|0,i=(i<<20|i>>>12)+o|0,r+=(i&s|o&~s)+n[9]+568446438|0,r=(r<<5|r>>>27)+i|0,s+=(r&o|i&~o)+n[14]-1019803690|0,s=(s<<9|s>>>23)+r|0,o+=(s&i|r&~i)+n[3]-187363961|0,o=(o<<14|o>>>18)+s|0,i+=(o&r|s&~r)+n[8]+1163531501|0,i=(i<<20|i>>>12)+o|0,r+=(i&s|o&~s)+n[13]-1444681467|0,r=(r<<5|r>>>27)+i|0,s+=(r&o|i&~o)+n[2]-51403784|0,s=(s<<9|s>>>23)+r|0,o+=(s&i|r&~i)+n[7]+1735328473|0,o=(o<<14|o>>>18)+s|0,i+=(o&r|s&~r)+n[12]-1926607734|0,i=(i<<20|i>>>12)+o|0,r+=(i^o^s)+n[5]-378558|0,r=(r<<4|r>>>28)+i|0,s+=(r^i^o)+n[8]-2022574463|0,s=(s<<11|s>>>21)+r|0,o+=(s^r^i)+n[11]+1839030562|0,o=(o<<16|o>>>16)+s|0,i+=(o^s^r)+n[14]-35309556|0,i=(i<<23|i>>>9)+o|0,r+=(i^o^s)+n[1]-1530992060|0,r=(r<<4|r>>>28)+i|0,s+=(r^i^o)+n[4]+1272893353|0,s=(s<<11|s>>>21)+r|0,o+=(s^r^i)+n[7]-155497632|0,o=(o<<16|o>>>16)+s|0,i+=(o^s^r)+n[10]-1094730640|0,i=(i<<23|i>>>9)+o|0,r+=(i^o^s)+n[13]+681279174|0,r=(r<<4|r>>>28)+i|0,s+=(r^i^o)+n[0]-358537222|0,s=(s<<11|s>>>21)+r|0,o+=(s^r^i)+n[3]-722521979|0,o=(o<<16|o>>>16)+s|0,i+=(o^s^r)+n[6]+76029189|0,i=(i<<23|i>>>9)+o|0,r+=(i^o^s)+n[9]-640364487|0,r=(r<<4|r>>>28)+i|0,s+=(r^i^o)+n[12]-421815835|0,s=(s<<11|s>>>21)+r|0,o+=(s^r^i)+n[15]+530742520|0,o=(o<<16|o>>>16)+s|0,i+=(o^s^r)+n[2]-995338651|0,i=(i<<23|i>>>9)+o|0,r+=(o^(i|~s))+n[0]-198630844|0,r=(r<<6|r>>>26)+i|0,s+=(i^(r|~o))+n[7]+1126891415|0,s=(s<<10|s>>>22)+r|0,o+=(r^(s|~i))+n[14]-1416354905|0,o=(o<<15|o>>>17)+s|0,i+=(s^(o|~r))+n[5]-57434055|0,i=(i<<21|i>>>11)+o|0,r+=(o^(i|~s))+n[12]+1700485571|0,r=(r<<6|r>>>26)+i|0,s+=(i^(r|~o))+n[3]-1894986606|0,s=(s<<10|s>>>22)+r|0,o+=(r^(s|~i))+n[10]-1051523|0,o=(o<<15|o>>>17)+s|0,i+=(s^(o|~r))+n[1]-2054922799|0,i=(i<<21|i>>>11)+o|0,r+=(o^(i|~s))+n[8]+1873313359|0,r=(r<<6|r>>>26)+i|0,s+=(i^(r|~o))+n[15]-30611744|0,s=(s<<10|s>>>22)+r|0,o+=(r^(s|~i))+n[6]-1560198380|0,o=(o<<15|o>>>17)+s|0,i+=(s^(o|~r))+n[13]+1309151649|0,i=(i<<21|i>>>11)+o|0,r+=(o^(i|~s))+n[4]-145523070|0,r=(r<<6|r>>>26)+i|0,s+=(i^(r|~o))+n[11]-1120210379|0,s=(s<<10|s>>>22)+r|0,o+=(r^(s|~i))+n[2]+718787259|0,o=(o<<15|o>>>17)+s|0,i+=(s^(o|~r))+n[9]-343485551|0,i=(i<<21|i>>>11)+o|0,e[0]=r+e[0]|0,e[1]=i+e[1]|0,e[2]=o+e[2]|0,e[3]=s+e[3]|0}start(){return this._dataLength=0,this._bufferLength=0,this._state.set(t.stateIdentity),this}appendStr(e){let n=this._buffer8,r=this._buffer32,i=this._bufferLength,o,s;for(s=0;s<e.length;s+=1){if(o=e.charCodeAt(s),o<128)n[i++]=o;else if(o<2048)n[i++]=(o>>>6)+192,n[i++]=o&63|128;else if(o<55296||o>56319)n[i++]=(o>>>12)+224,n[i++]=o>>>6&63|128,n[i++]=o&63|128;else{if(o=(o-55296)*1024+(e.charCodeAt(++s)-56320)+65536,o>1114111)throw new Error("Unicode standard supports code points up to U+10FFFF");n[i++]=(o>>>18)+240,n[i++]=o>>>12&63|128,n[i++]=o>>>6&63|128,n[i++]=o&63|128}i>=64&&(this._dataLength+=64,t._md5cycle(this._state,r),i-=64,r[0]=r[16])}return this._bufferLength=i,this}appendAsciiStr(e){let n=this._buffer8,r=this._buffer32,i=this._bufferLength,o,s=0;for(;;){for(o=Math.min(e.length-s,64-i);o--;)n[i++]=e.charCodeAt(s++);if(i<64)break;this._dataLength+=64,t._md5cycle(this._state,r),i=0}return this._bufferLength=i,this}appendByteArray(e){let n=this._buffer8,r=this._buffer32,i=this._bufferLength,o,s=0;for(;;){for(o=Math.min(e.length-s,64-i);o--;)n[i++]=e[s++];if(i<64)break;this._dataLength+=64,t._md5cycle(this._state,r),i=0}return this._bufferLength=i,this}getState(){let e=this._state;return{buffer:String.fromCharCode.apply(null,Array.from(this._buffer8)),buflen:this._bufferLength,length:this._dataLength,state:[e[0],e[1],e[2],e[3]]}}setState(e){let n=e.buffer,r=e.state,i=this._state,o;for(this._dataLength=e.length,this._bufferLength=e.buflen,i[0]=r[0],i[1]=r[1],i[2]=r[2],i[3]=r[3],o=0;o<n.length;o+=1)this._buffer8[o]=n.charCodeAt(o)}end(e=!1){let n=this._bufferLength,r=this._buffer8,i=this._buffer32,o=(n>>2)+1;this._dataLength+=n;let s=this._dataLength*8;if(r[n]=128,r[n+1]=r[n+2]=r[n+3]=0,i.set(t.buffer32Identity.subarray(o),o),n>55&&(t._md5cycle(this._state,i),i.set(t.buffer32Identity)),s<=4294967295)i[14]=s;else{let a=s.toString(16).match(/(.*?)(.{0,8})$/);if(a===null)return;let c=parseInt(a[2],16),l=parseInt(a[1],16)||0;i[14]=c,i[15]=l}return t._md5cycle(this._state,i),e?this._state:t._hex(this._state)}};Tn.stateIdentity=new Int32Array([1732584193,-271733879,-1732584194,271733878]);Tn.buffer32Identity=new Int32Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);Tn.hexChars="0123456789abcdef";Tn.hexOut=[];Tn.onePassHasher=new Tn;if(Tn.hashStr("hello")!=="5d41402abc4b2a76b9719d911017c592")throw new Error("Md5 self test failed.");var fV=["annotationId","annotationNumber","visibilityConfig","actions","comments","commentCategories","from","color","resolved","inProgress","lastUpdated","createdAt","positionX","positionY","screenWidth","screenHeight","screenScrollHeight","screenScrollTop","taggedElementPath","taggedElementRect","targetElement","targetElementId","position","documentParamsId","documentParams","locationId","location","type","commentType","sourceType","metadata","targetTextRange","selectAllContent","approved","status","statusUpdatedByUserId","annotationIndex","pageInfo","assignedTo","priority","ghostComment","areaAnnotationId","context","contextId","iam","isPageAnnotation","targetInlineCommentElementId","inlineCommentSectionConfig","customList","subscribedUsers","unsubscribedUsers","subscribedGroups","resolvedByUserId","resolvedByUser","multiThreadAnnotationId","isDraft","sourceId","views","viewedByUserIds","viewedBy","unread","suggestion","agent","involvedUserIds","mentionedUserIds"],pV=["commentId","context","type","commentText","isCommentTextAvailable","isCommentResolverUsed","commentHtml","replaceContentHtml","replaceContentText","commentVoiceUrl","from","to","lastUpdated","createdAt","status","attachments","recorders","reactionAnnotationIds","taggedUserContacts","customList","toOrganizationUserGroup","isDraft","editedAt","isEdited","reactionAnnotations","sourceType","agent","metadata","actions","progress"],iR=["commentId","context","type","isCommentTextAvailable","isCommentResolverUsed","replaceContentHtml","replaceContentText","commentVoiceUrl","from","to","lastUpdated","createdAt","status","attachments","recorders","reactionAnnotationIds","taggedUserContacts","customList","toOrganizationUserGroup","isDraft","editedAt","isEdited","reactionAnnotations","sourceType","agent","metadata","actions","progress"];var gV=["annotationId","context","commentAnnotationId","reactions","lastUpdated","targetElement","targetElementId","position","locationId","location","type","annotationIndex","pageInfo","from","isReactionResolverUsed","iconUrl","iconEmoji","metadata","involvedUserIds"];var mV=["context","annotationId","commentAnnotationId","from","color","lastUpdated","positionX","positionY","screenWidth","screenHeight","screenScrollHeight","screenScrollTop","recorderedElementPath","recorderedElementRect","targetElement","position","locationId","location","type","recordingType","mode","approved","attachment","attachments","annotationIndex","pageInfo","recordedTime","waveformData","displayName","metadata","latestVersion","recordingEditVersions","chunkUrls","isRecorderResolverUsed","isUrlAvailable"];var XOe=["id","featureType","actionType","eventType","actionUser","timestamp","metadata","targetEntityId","targetSubEntityId","changes","entityData","entityTargetData","displayMessageTemplate","displayMessageTemplateData","displayMessage","actionIcon","immutable","isActivityResolverUsed"];var ST=["userId"];var oR=["commonAncestorContainer","commonAncestorContainerFXpath","commonAncestorContainerCFXpath","commonAncestorContainerAnchor","occurrence"],sR=["attachmentId","isAttachmentResolverUsed","name","bucketPath","size","type","url","thumbnail","thumbnailWithPlayIconUrl","metadata","mimeType","previewImages","clientOrganizationId","clientDocumentId"],aR=["attachmentId","isAttachmentResolverUsed","bucketPath","size","type","thumbnail","thumbnailWithPlayIconUrl","metadata","mimeType","previewImages","clientOrganizationId","clientDocumentId"];var EV=["id","tag","type","thumbnailUrl","thumbnailWithPlayIconUrl","videoUrl","audioUrl","videoPlayerUrl","chunkUrls"],cR=["status","targetId","targetType","oldValue","newValue","summary","driftDetected","rejectReason","resolvedBy","resolvedAt","metadata"],lR=["status","targetId","targetType","driftDetected","resolvedBy","resolvedAt"];var Lc="velt://self-hosted-disabled/",Pc=t=>typeof t=="string"&&t.startsWith(Lc),bV=(t,e)=>{try{if(Pc(t))return t;let n=new URL(t),r=n.hostname.split("."),i=r.length>=3?r[0]:"",o=t.replace(n.host,e);if(i){let s=o.includes("?")?"&":"?";o+=`${s}ns=${i}`}return o}catch(n){return M.catch("Error in getProxiedDatabaseUrl: ",n),t}},a0e=t=>{try{let e=localStorage.getItem(F.LOCAL_STORAGE.VELT_AUTH_PROXY_HOST);if(!e)return;let n=atob(e),r=t?.config;n&&r&&(r.apiHost=n,r.tokenApiHost=n)}catch(e){M.catch("Error in applyCachedAuthProxyHost: ",e)}},Mc=(t,e=0)=>{try{let n=3735928559^e,r=1103547991^e;for(let i=0,o;i<t.length;i++)o=t.charCodeAt(i),n=Math.imul(n^o,2654435761),r=Math.imul(r^o,1597334677);return n=Math.imul(n^n>>>16,2246822507)^Math.imul(r^r>>>13,3266489909),r=Math.imul(r^r>>>16,2246822507)^Math.imul(n^n>>>13,3266489909),4294967296*(2097151&r)+(n>>>0)}catch(n){return M.catch("Error in cyrb53: ",n),0}},HX=()=>{try{return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,t=>(+t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+t/4).toString(16))}catch(t){return M.catch("Error in uuidv4: ",t),""}},Vo=t=>{try{return Tn.hashStr(t)}catch(e){return M.catch("Error in hashStr: ",e),t}},OV=t=>{try{return!t||t.trim().length===0?void 0:Tn.hashStr(t)}catch(e){M.catch("Error in hashForAnchor: ",e);return}};function c0e(t,e){let n=[],r=e>=1?Math.floor(e):1;for(let i=0;i<t.length;i+=r)n.push(t.slice(i,i+r));return n}var l0e=t=>Mc(t).toString(),u0e=t=>Vo(t),MV=t=>Vo(t).toString(),d0e=t=>Vo(t).toString(),h0e=(t,e)=>{try{let n=t.userIds?.length?[...t.userIds]:[];return n.includes(e)||n.push(e),me(B({},t),{userIds:n})}catch(n){return M.catch("Error in ensureUserIdInVisibility: ",n),t}},f0e=t=>{try{if(!t)return!1;if(t.iam?.accessMode===dT.PRIVATE)return!0;let e=t.visibilityConfig?.type;return e==="restricted"||e==="organizationPrivate"}catch(e){return M.catch("Error in isAnnotationPrivate: ",e),!1}},p0e=(t,e)=>{let n=[];switch(t.type){case"public":return n.push(F.DEFAULT_VELT_CONTEXT),n;case"organizationPrivate":{let r=[...t.organizationId?[t.organizationId]:[],...t.organizationIds??[]].filter((i,o,s)=>!!i&&s.indexOf(i)===o);if(!r.length)throw new Error("organizationId is required for organizationPrivate visibility type");r.forEach(i=>{let o=MV(i);n.push(`${F.VISIBILITY_ORG_PREFIX}${o}`)});break}case"restricted":{if(!t.userIds?.length)throw new Error("userIds is required for restricted visibility type");t.userIds.filter((i,o,s)=>!!i&&s.indexOf(i)===o).forEach(i=>{let o=Vo(i).toString();n.push(`${F.VISIBILITY_SELF_PREFIX}${o}`)});break}default:throw new Error(`Invalid visibility type: ${t.type}`)}if(e){let r=`${F.VISIBILITY_SELF_PREFIX}${Vo(e).toString()}`;n.includes(r)||n.push(r)}return n},g0e=(t,e)=>{let n={type:t.type};try{if(t.type==="public")return n;t.organizationId&&(n.organizationId=t.organizationId),t.organizationIds?.length&&(n.organizationIds=t.organizationIds);let r=[...t.userIds??[],...e?[e]:[]].filter((i,o,s)=>!!i&&s.indexOf(i)===o);r.length&&(n.userIds=r)}catch(r){M.catch("Error in buildStoredVisibilityConfig: ",r)}return n},m0e=t=>{let e=[F.DEFAULT_VELT_CONTEXT];try{t?.userId&&e.push(`${F.VISIBILITY_SELF_PREFIX}${Vo(t.userId).toString()}`),t?.clientOrganizationId?e.push(`${F.VISIBILITY_ORG_PREFIX}${MV(t.clientOrganizationId)}`):t?.fallbackServerOrganizationId&&e.push(`${F.VISIBILITY_ORG_PREFIX}${t.fallbackServerOrganizationId}`)}catch(n){M.catch("Error in buildViewerVisibilityTokens: ",n)}return e},E0e=(t,e)=>{try{if(!t?.length)return t??[];let n=new Set(e?.tokens??[]);return t.filter(r=>{try{let i=r?.context?.accessFields,o=PV(i),s=r?.visibilityConfig?.type,a=s==="organizationPrivate"||s==="restricted",c=o.length>0&&!i?.includes(F.DEFAULT_VELT_CONTEXT);return!!(!a&&!c||!i?.length||e?.userId&&r?.from?.userId===e.userId||o.some(l=>n.has(l))||e?.userId&&r?.visibilityConfig?.userIds?.includes(e.userId))}catch(i){return M.catch("Error filtering annotation visibility: ",i),!0}})}catch(n){return M.catch("Error in filterAnnotationsVisibleToUser: ",n),t}},LV=t=>{try{return typeof t=="string"&&(t.startsWith(F.VISIBILITY_SELF_PREFIX)||t.startsWith(F.VISIBILITY_ORG_PREFIX))}catch(e){return M.catch("Error in isVisibilityAccessToken: ",e),!1}},PV=t=>{try{return(t||[]).filter(e=>LV(e))}catch(e){return M.catch("Error in extractVisibilityAccessTokens: ",e),[]}},_0e=t=>{try{return!!t&&typeof t=="object"&&Object.keys(t).some(e=>!(e==="default"&&t[e]==="velt"))}catch(e){return M.catch("Error in isCustomerContextAccess: ",e),!1}},T0e=(t,e)=>{try{let n=Array.isArray(e)?e:[],r=n.length>0&&!n.includes(F.DEFAULT_VELT_CONTEXT),i=t;if(r&&t?.access&&typeof t.access=="object"&&t.access.default==="velt"){let s=B({},t.access);delete s.default,i=me(B({},t),{access:s})}let o=pQ(i);return r&&(o=o.filter(s=>s!==F.DEFAULT_VELT_CONTEXT)),r?[...new Set([...n,...o])]:o}catch(n){return M.catch("Error in mergeAccessFieldTokenFamilies: ",n),Array.isArray(e)?e:[]}},$X=t=>{try{if(!t)return null;let e=t?.context?.accessFields??[];if(!e?.length)return null;let n=PV(e),r=t?.visibilityConfig?.type,i=r==="restricted"||r==="organizationPrivate",o=n.length>0&&!e.includes(F.DEFAULT_VELT_CONTEXT);if(!i&&!o)return null;let s=n.some(h=>h.startsWith(F.VISIBILITY_ORG_PREFIX)),c={type:i?r:s?"organizationPrivate":"restricted",accessTokens:n},l=t?.visibilityConfig?.userIds;l?.length&&(c.userIds=[...l]);let d=[...t?.visibilityConfig?.organizationId?[t.visibilityConfig.organizationId]:[],...t?.visibilityConfig?.organizationIds??[]].filter((h,f,g)=>!!h&&g.indexOf(h)===f);return d.length&&(c.organizationIds=d),c}catch(e){M.catch("Error in buildNotificationVisibilityStamp: ",e);try{let n=t?.visibilityConfig?.type;if(n==="restricted"||n==="organizationPrivate")return{type:n,accessTokens:[]}}catch{}return null}},y0e=(t,e)=>{try{if(!e?.length)return[];let n=$X(t);if(!n||n.type!=="restricted")return[];let r=new Set([...n.userIds??[],...t?.from?.userId?[t.from.userId]:[]]),i=new Set(n.accessTokens??[]);return e.filter(o=>!o||r.has(o)?!1:!i.has(`${F.VISIBILITY_SELF_PREFIX}${Vo(o).toString()}`))}catch(n){return M.catch("Error in getVisibilityDeniedUserIds: ",n),[]}},I0e=(t,e)=>{try{if(!t?.length)return t??[];let n=new Set([F.DEFAULT_VELT_CONTEXT,...e||[]]);return t.filter(r=>{try{let i=r?.context?.accessFields;if(!i?.length)return!0;let o=i.filter(s=>!LV(s));return o.length?o.some(s=>n.has(s)):!0}catch(i){return M.catch("Error filtering annotation doc-context match: ",i),!0}})}catch(n){return M.catch("Error in filterAnnotationsMatchingDocContext: ",n),t}},v0e=(t,e)=>{try{if(!t?.length)return t??[];let n=e?.statusIds?.filter(a=>a!=null),r=e?.locationIds?.filter(a=>a!=null),i=n?.length?new Set(n):null,o=r?.length?new Set(r):null,s=e?.veltFolderId||null;return!i&&!o&&!s?t:t.filter(a=>{try{return!(i&&!i.has(a?.status?.id)||s&&a?.metadata?.veltFolderId!==s||o&&!o.has(a?.location?.id))}catch(c){return M.catch("Error filtering annotation query scope: ",c),!0}})}catch(n){return M.catch("Error in filterAnnotationsMatchingQueryScope: ",n),t}},S0e=(t,e)=>{if(!e||!t?.length)return t;let n=new Set(e);return t.filter(r=>{let i=r?.context?.accessFields;return Array.isArray(i)&&i.some(o=>n.has(o))})},A0e=t=>{try{if(t)return typeof t=="string"?Tn.hashStr(t):Array.isArray(t)?Tn.hashStr(t.join("-")):"";{let e=HX();return Tn.hashStr(e)}}catch(e){return M.catch("Error in getMultiThreadAnnotationId: ",e),""}},xV=(t,e,n)=>{try{if(t&&e){if(t.featureAllowList&&t.featureAllowList.length&&!t.featureAllowList.includes(n)||t.userIdAllowList&&t.userIdAllowList.length&&!t.userIdAllowList.includes(e.userId)||t.userGroupIdAllowList&&t.userGroupIdAllowList.length&&!t.userGroupIdAllowList.includes(e.groupId||"")||t.userPlanAllowList&&t.userPlanAllowList.length&&!t.userPlanAllowList.includes(e.plan||""))return!1;if(t.urlAllowList){let r=window.location.href;if(t.urlAllowList.length&&!t.urlAllowList.filter(i=>r.includes(i)).length)return!1}return!0}return!1}catch(r){return M.catch("Error in isFeatureAllowed: ",r),!1}},rd=()=>{try{let t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e="";for(let n=0;n<20;n++)e+=t.charAt(Math.floor(Math.random()*t.length));return e}catch(t){return M.catch("Error in utils generateId: ",t),""}},C0e=t=>{try{let e=0;if(t){let n=new Date().getTime();e=Math.abs(n-t)}return e}catch(e){return M.catch("Error in utils getFirebaseTimeDiffInMins: ",e),0}};var kV=()=>{try{return qt.debugMode||!!sessionStorage.getItem("debugMode")||!!sessionStorage.getItem("forceDebugMode")}catch(t){return M.catch("Error in showLogs: ",t),!1}},FV=()=>{try{return!!sessionStorage.getItem("debugContextMode")}catch(t){return M.catch("Error in showContextLogs: ",t),!1}},UV=t=>{try{return typeof t!="object"?Object.assign({},...Object.keys(t).sort().map(e=>({[e]:t[e]&&typeof t[e]=="object"?UV(t[e]):t[e]}))):t}catch(e){return M.catch("Error in sortObjectByKeys: ",e),t}},uR=t=>{try{return t!==null&&typeof t=="object"&&!Array.isArray(t)}catch{return!1}},_V=t=>{try{return uR(t)?Object.fromEntries(Object.entries(t).sort(([e],[n])=>e.localeCompare(n)).map(([e,n])=>[e,uR(n)?_V(n):Array.isArray(n)?n.map(r=>uR(r)?_V(r):r):n])):t}catch{return t}},TV=(t,e)=>{try{return typeof e!="object"||e===null?t===e:typeof t!="object"||t===null?!1:Array.isArray(e)?Array.isArray(t)?e.every(n=>t.some(r=>TV(r,n))):!1:Object.keys(e).every(n=>Object.prototype.hasOwnProperty.call(t,n)?TV(t[n],e[n]):!1)}catch{return!1}},WX=(t,e,n)=>y(null,null,function*(){try{let r=yield KX(e),i=new Uint8Array(new TextEncoder().encode(n)).slice(0,16),o=new TextEncoder().encode(t),s=yield window.crypto.subtle.encrypt({name:"AES-CBC",iv:i},r,o);return btoa(String.fromCharCode(...new Uint8Array(s)))}catch(r){return M.catch("Error in encrypt: ",r),t}}),zX=(t,e,n)=>y(null,null,function*(){try{let r=yield qX(e),i=new Uint8Array(new TextEncoder().encode(n)).slice(0,16),o=new Uint8Array(atob(t).split("").map(a=>a.charCodeAt(0))),s=yield window.crypto.subtle.decrypt({name:"AES-CBC",iv:i},r,o);return new TextDecoder().decode(s)}catch(r){return M.catch("Error in decrypt: ",r),t}}),qX=t=>y(null,null,function*(){try{let e=new TextEncoder().encode(t),n=new Uint8Array(32);return n.fill(0),n.set(e.slice(0,32)),yield window.crypto.subtle.importKey("raw",n,"AES-CBC",!1,["decrypt"])}catch(e){throw M.catch("Error in importDecryptKey:",e),e}}),wT=(t,e)=>y(null,null,function*(){try{let n="Velt"+e;return yield WX(JSON.stringify(t),n,Vo(n))}catch(n){return M.catch("Error in encryptData: ",n),t}}),sp=(t,e)=>y(null,null,function*(){try{let n="Velt"+e,r=yield zX(t,n,Vo(n));return JSON.parse(r)}catch(n){return M.catch("Error in decryptData: ",n),null}}),D0e=t=>{try{switch(t?.region){case"asiaSouthEast1":return"asiaSouthEast1";case"asiaNorthEast1":return"asiaNorthEast1";case"europeWest1":return"europeWest1";case"australiaSouthEast1":return"australiaSouthEast1";default:return"usCentral1"}}catch(e){return M.catch("Error in getRegion: ",e),"usCentral1"}},KX=t=>y(null,null,function*(){try{let e=new TextEncoder().encode(t),n=new Uint8Array(32);return n.fill(0),n.set(e.slice(0,32)),yield window.crypto.subtle.importKey("raw",n,"AES-CBC",!1,["encrypt"])}catch(e){throw M.catch("Error in importKey:",e),e}}),R0e=t=>{try{if(t&&typeof t=="object"){let e=UV(t);return Mc(JSON.stringify(e))}else return null}catch(e){return M.catch("Error in utils generateLocationId: ",e),null}},qi=(t,e=[])=>(t?.tagName?.toLowerCase().indexOf("velt-")>=0&&![F.TAGS.VELT_VIDEO_PLAYER.toLowerCase()].includes(t?.tagName?.toLowerCase())||t?.tagName?.toLowerCase().indexOf("snippyly-")>=0||t?.className?.split&&(t?.className?.split(" ")?.indexOf("snippyly-overlay-panel")>=0||t?.className?.split(" ")?.indexOf("cdk-overlay-container")>=0))&&!e?.includes(t?.tagName?.toLowerCase())?!0:t?.parentNode&&qi(t?.parentNode,e),N0e=(t,e=[])=>{try{let n=typeof t.composedPath=="function"?t.composedPath():[],r=n.length>0?n:[t?.target];for(let i of r){let o=i;if(!(!o||typeof o.tagName!="string")&&qi(o,e))return!0}}catch(n){M.catch("Error in utils isSnippylyEventTarget: ",n)}return!1},id=t=>{try{return!!document?.body?.contains(t)}catch(e){return M.catch("Error in utils isElementInsideBody: ",e),!1}};var YX=(t,e)=>{try{return Object.prototype.toString.call(t)===Object.prototype.toString.call(e)?Object.prototype.toString.call(t)==="[object Object]"||Object.prototype.toString.call(t)==="[object Array]"?Object.keys(t).length!==Object.keys(e).length?!1:Object.keys(t).every(n=>YX(t[n],e[n])):t===e:!1}catch(n){return M.catch("Error in utils deepCompare: ",n),!1}},w0e=(t,e,n=1)=>{try{if(e){let r=yV(e.textContent,t,n);if(r>=0){let i=e.querySelector("script")!==null,o=(e?.ownerDocument).createNodeIterator(e,NodeFilter.SHOW_TEXT,i?{acceptNode:g=>g.parentElement?.tagName==="SCRIPT"?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}:null),s,a=[];for(;s=o.nextNode();)a.push(s);let c=r;if(i){let g=a.reduce((I,S)=>I+(S.textContent||""),""),E=yV(g,t,n);if(E<0)return[];c=E}let l=[],d=t.length,h=c+d,f=0;for(let g=0;g<a.length;g++){let E=a[g],I=f;if(f+=E.textContent?.length,f>c&&!l.length?l.push({textNode:E,startOffset:c-I}):l.length&&f<h&&l.push({textNode:E}),f>=h){if(l.length===1&&l[0].textNode===E){l.push({textNode:E,endOffset:c-I+t.length});break}let S=d;l.forEach(L=>{S-=L.textNode.textContent?.length-(L.startOffset||0)}),l.push({textNode:E,endOffset:S});break}}return l}}return[]}catch(r){return M.catch("Error in utils calculateNodes: ",r),[]}},yV=(t,e,n=1)=>{try{if(t?.includes(e)){let r=t.split(e,n);return r.length===n?r.join(e).length:-1}else return-1}catch(r){return M.catch("Error in utils getTextPosition: ",r),-1}},gR=(t,e,n,r,i)=>{try{let o=new Range;o.setStart(t,e),o.setEnd(n,r);let s=o.commonAncestorContainer,c=(s.nodeType===Node.ELEMENT_NODE?s:s.parentElement)?.querySelector("script")!==null,l;if(c){let h=o.cloneContents();h.querySelectorAll("script").forEach(f=>f.remove()),l=h.textContent||""}else l=o.toString();let d=0;if(t.nodeType===Node.TEXT_NODE){let h=t,f="";if(h)for(;h=h.previousSibling;)if(c){if(h.nodeType===Node.ELEMENT_NODE&&h.tagName==="SCRIPT")continue;if(h.nodeType===Node.ELEMENT_NODE){let g=h;if(g.querySelector("script")){let E=g.cloneNode(!0);E.querySelectorAll("script").forEach(I=>I.remove()),f=(E.textContent||"")+f}else f=(h.textContent||"")+f}else h.parentElement?.tagName!=="SCRIPT"&&(f=(h.textContent||"")+f)}else f=(h.textContent||"")+f;if(f){let g=new RegExp(IV(i),"g");d=(f.match(g)||[]).length}}if(l){let h=new RegExp(IV(i),"g");return(l.match(h)||[]).length+d}else return d}catch(o){return M.catch("Error in utils getSelectedTextOccurrenceInRange: ",o),0}},IV=t=>{try{return t&&typeof t=="string"?t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"):t}catch(e){return M.catch("Error in utils escapeRegExp: ",e),t}},XX=t=>{try{return t==null?null:t.scrollHeight>t.clientHeight?t:XX(t?.parentNode)}catch(e){return M.catch("Error in utils getScrollableParent: ",e),null}},DT=t=>{try{return t==null?[]:t.scrollHeight>t.clientHeight||t.scrollWidth>t.clientWidth?[t,...DT(t?.parentNode)]:DT(t?.parentNode)}catch(e){return M.catch("Error in utils getScrollableParents: ",e),[]}};function b0e(t){try{if(!t)return[];let e=DT(t),n=t;for(;n;){let r=n.getRootNode();if(r instanceof ShadowRoot)e.push(...DT(r.host)),n=r.host;else break}return e}catch(e){return M.catch("Error in utils getScrollableParentsCrossingShadowBoundary: ",e),[]}}var O0e=(t,e)=>{try{if(t&&e){let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),i=n.top-r.top+(e.tagName?.toLowerCase()==="html"?0:e.scrollTop),o=n.left-r.left;return{top:i,left:o}}else return null}catch(n){return M.catch("Error in utils getRelativeTopLeftPosition: ",n),null}},VV=(t,e)=>`${Mc(t+"_"+e)}`,BV=t=>{try{let e=TT(t),n=new Et(!1);return e&&Object.assign(n,e),n.url=e?.url??window.location.href,n.path=e?.path??window.location.pathname,n.queryParams=e?.queryParams??window.location.search,n.baseUrl=e?.baseUrl??window.location.origin,n.title=e?.title??document.title,n}catch(e){M.catch("Error in utils getPageInfo: ",e);return}},QX=t=>{try{return t?t?.hasAttribute&&t?.hasAttribute(F.ATTRIBUTES.VELT_COMMENT_DISABLED)?!0:QX(t?.parentElement):!1}catch(e){return M.catch("Error in utils isCommentDisabledOnElement: ",e),!1}},ap=".ProseMirror[contenteditable]",vV=new Set,od=(t,e)=>{try{if(vV.has(t))return;vV.add(t),M.catch(`Error in utils ${t} (treated as "not editor content"): `,e)}catch{}};var Oc=t=>{try{return!t||!t.isConnected?!1:!!(t.nodeType===Node.ELEMENT_NODE?t:t.parentElement)?.closest?.(ap)}catch(e){return od("isNodeInsideRichTextEditor",e),!1}},SV=t=>{if(!t||!t.isConnected)return null;let e=null,n=t.nodeType===Node.ELEMENT_NODE?t:t.parentElement;for(;n=n?.closest?.(ap)??null;)e=n,n=n.parentElement;return e},JX=t=>{try{return!!t?.querySelector?.(ap)}catch(e){return od("containsRichTextEditor",e),!1}},GV=(t,e)=>{let n=e.ownerDocument.createRange();return n.selectNodeContents(e),t.compareBoundaryPoints(Range.START_TO_START,n)>0&&n.setStart(t.startContainer,t.startOffset),t.compareBoundaryPoints(Range.END_TO_END,n)<0&&n.setEnd(t.endContainer,t.endOffset),n},ZX=(t,e)=>{let n=t;for(;n&&n!==e;){if(n.nextSibling)return n.nextSibling;n=n.parentNode}return null},eQ=(t,e)=>{let n=GV(t,e);if(n.collapsed)return!1;let{startContainer:r,startOffset:i,endContainer:o,endOffset:s}=n,a=d=>{let h=d===r?i:0;return(d===o?s:d.length)>h},c=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT),l;for(r.nodeType===Node.TEXT_NODE?l=r:(l=r.childNodes[i]??ZX(r,e),l&&l.nodeType!==Node.TEXT_NODE&&(c.currentNode=l,l=c.nextNode()));l;){if(n.comparePoint(l,0)>0)return!1;if(a(l))return!0;c.currentNode=l,l=c.nextNode()}return!1},jV=t=>{let e=new Set,n=SV(t.startContainer),r=SV(t.endContainer);n&&e.add(n),r&&e.add(r);let i=t.commonAncestorContainer,s=(i?.nodeType===Node.TEXT_NODE?i.parentElement:i)?.querySelectorAll?.(ap)??[];for(let a=0;a<s.length;a++)t.intersectsNode(s[a])&&e.add(s[a]);return e},AV=(t,e)=>{let n=e.parentNode;if(!n)return!1;let r=Array.prototype.indexOf.call(n.childNodes,e);return t.comparePoint(n,r)===0&&t.comparePoint(n,r+1)===0},tQ=t=>{try{if(!t||t.collapsed)return!1;for(let e of jV(t))if(eQ(t,e))return!0;return!1}catch(e){return od("doesRangeTouchRichTextEditor",e),!1}},M0e=t=>{try{if(!t||t.collapsed)return!1;if(tQ(t))return!0;for(let e of jV(t)){if(AV(t,e))return!0;let n=GV(t,e);if(n.collapsed)continue;let r=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT);for(;r.nextNode();)if(AV(n,r.currentNode))return!0}return!1}catch(e){return od("doesRangeIntersectRichTextEditorNode",e),!1}},nQ=t=>{try{if(!t||Oc(t))return;if(!JX(t)){t.normalize();return}Array.from(t.childNodes).forEach(e=>{e.nodeType===Node.ELEMENT_NODE&&!e.matches(ap)&&nQ(e)})}catch(e){od("normalizeOutsideRichTextEditors",e)}},L0e=t=>{try{let e=Oc(t.startContainer),n=Oc(t.endContainer);if(!e&&!n)return!0;let r=t.commonAncestorContainer,i=r.nodeType===Node.ELEMENT_NODE?r:r.parentNode;if(!i)return!1;let o=(i.ownerDocument||document).createTreeWalker(i,NodeFilter.SHOW_TEXT),s=null,a=null;for(;o.nextNode();){let c=o.currentNode;c.length&&t.intersectsNode(c)&&!Oc(c)&&(s=s||c,a=c)}return!s||!a?!1:(e&&t.setStart(s,0),n&&t.setEnd(a,a.length),!0)}catch(e){return od("moveRangeBoundariesOutOfRichTextEditors",e),!1}},rQ=t=>{try{return t?t?.hasAttribute&&t?.hasAttribute(F.ATTRIBUTES.VELT_TAG_DISABLED)?!0:rQ(t?.parentElement):!1}catch(e){return M.catch("Error in utils isTagDisabledOnElement: ",e),!1}},iQ=t=>{try{return t?t?.hasAttribute&&t?.hasAttribute(F.ATTRIBUTES.VELT_ARROW_DISABLED)?!0:iQ(t?.parentElement):!1}catch(e){return M.catch("Error in utils isArrowDisabledOnElement: ",e),!1}},oQ=t=>{try{return t?t?.hasAttribute&&t?.hasAttribute(F.ATTRIBUTES.VELT_AREA_DISABLED)?!0:oQ(t?.parentElement):!1}catch(e){return M.catch("Error in utils isAreaDisabledOnElement: ",e),!1}},sQ=t=>{try{return t?t?.hasAttribute&&t?.hasAttribute(F.ATTRIBUTES.VELT_RECORDER_DISABLED)?!0:sQ(t?.parentElement):!1}catch(e){return M.catch("Error in utils isRecorderDisabledOnElement: ",e),!1}};var xc=()=>{try{return window?.Snippyly?.version}catch(t){return M.catch("Error in utils getSdkVersion: ",t),null}},P0e=t=>{try{return Object.fromEntries(Object.entries(t).filter(([e,n])=>n!==void 0))}catch(e){return M.catch("Error in utils removeUndefinedKeys: ",e),t}},x0e=t=>{try{let e=new URL(t);return Object.values(F.URL_PARAMS).forEach(n=>{e.searchParams.delete(n)}),e.href}catch(e){return M.catch("Error in utils excludeSnippylyParamsFromUrl: ",e),t}},k0e=t=>{try{navigator.clipboard.writeText(t)}catch(e){M.catch("Error in copyToClipboard: ",e)}},dR=t=>{try{let e=HV(t);return e&&typeof e=="string"&&e.includes("/svg")&&(e=e.split("/svg")[0]+"/*[name()='svg']"),e}catch(e){M.catch("Error in utils getXPath:",e)}},HV=t=>{try{if(t){if(typeof t=="string")return document.evaluate(t,document,null,0,null);if(!t||t.nodeType!=1)return"";if(t.id&&t?.tagName?.toLowerCase()!=="svg"&&document.querySelectorAll(`[id='${t.id}']`)?.length===1)return"//*[@id='"+t.id+"']";let e=[].filter.call(t.parentNode?.children?t.parentNode?.children:[],function(n){return n.tagName==t.tagName});return HV(t.parentNode)+"/"+t.tagName.toLowerCase()+(e.length>1?"["+([].indexOf.call(e,t)+1)+"]":"")}}catch(e){M.catch("Error in utils calculateXPath:",e)}},F0e=t=>{try{let e=[];return t.forEach(n=>{let r={};r.commonAncestorContainer=aQ(n.commonAncestorContainer),r.text=n.toString(),r.occurrence=gR(n.commonAncestorContainer,0,n.startContainer,n.startOffset,n.toString())+1,e.push(r)}),e}catch{return[]}},aQ=t=>{try{if(t.nodeType===Node.TEXT_NODE){let e=1,n=t.previousSibling;for(;n;)n.nodeType===Node.TEXT_NODE&&e++,n=n.previousSibling;return dR(t.parentElement)}else return dR(t)}catch(e){return M.catch("Error in utils getXPathForText: ",e),dR(t)}},cQ=(t,e)=>{try{return t?t?.hasAttribute&&(e&&t.hasAttribute("contenteditable")||t?.getAttribute(F.ATTRIBUTES.VELT_LIVE_SELECTION_ENABLED)==="true")?t:cQ(t?.parentElement,e):null}catch(n){return M.catch("Error in utils getSelectionEnabledElement: ",n),null}},U0e=t=>{try{let e,n=[],r=document.createTreeWalker(t,NodeFilter.SHOW_TEXT,null);for(;e=r.nextNode();)n.push(e);return n}catch(e){return M.catch("Error in utils getTextNodesInsideElement: ",e),[]}},V0e=t=>{try{return t<576||t>=576&&t<767?"Mobile":t>=768&&t<992?"Tablet":t>=992&&t<1520?"Desktop":"Monitor"}catch(e){return M.catch("Error in utils getDeviceTypeFromDeviceWidth: ",e),""}},$V=t=>new Promise(e=>setTimeout(e,t)),B0e=(t,e=0)=>new Promise((n,r)=>{let i=document.createElement("video"),o=navigator.userAgent.includes("Firefox");o&&(i.preload="auto"),i.setAttribute("src",URL.createObjectURL(t)),i.load(),i.addEventListener("error",s=>{r("error when loading video file: "+s)}),i.addEventListener("loadedmetadata",()=>{let s=()=>{if(i.duration<e){r("video is too short.");return}setTimeout(()=>{i.currentTime=e},200),i.addEventListener("seeked",()=>{let a=document.createElement("canvas");a.width=i.videoWidth,a.height=i.videoHeight;let c=a.getContext("2d");c.drawImage(i,0,0,a.width,a.height),c.canvas.toBlob(l=>{i.remove(),n(l)},"image/jpeg",.75)})};if(o&&i.duration>0&&i.duration<10&&t.size>1e6){setTimeout(()=>{i.duration<e&&(e=Math.max(.1,i.duration/2)),s()},1e3);return}s()})}),G0e=t=>{try{return new Promise((e,n)=>{let r=new FileReader;r.onloadend=()=>e(r.result),r.readAsDataURL(t)})}catch(e){return M.catch("Error in utils blobToBase64: ",e),Promise.resolve("")}},j0e=(t,e="image/jpeg")=>{try{let n=atob(t.split(",")[1]),r=new ArrayBuffer(n.length),i=new Uint8Array(r);for(let o=0;o<n.length;o++)i[o]=n.charCodeAt(o);return new Blob([r],{type:e})}catch(n){return M.catch("Error in utils base64ToBlob: ",n),null}},H0e=(t,e,n=20)=>new Promise((r,i)=>{let o=new Image;o.crossOrigin="Anonymous",o.onload=()=>{let s=o.width,a=o.height,c=600,l=a/s*c,d="http://www.w3.org/2000/svg",h=document.createElementNS(d,"svg");h.setAttribute("xmlns",d),h.setAttribute("width",c.toString()),h.setAttribute("height",l.toString()),h.setAttribute("viewBox",`0 0 ${c} ${l}`);let f=document.createElementNS(d,"circle"),g=document.createElementNS(d,"polygon"),E=16,I=E+16,S=c/2,L=l/2;if(f.setAttribute("cx",S.toString()),f.setAttribute("cy",L.toString()),f.setAttribute("r",I.toString()),f.setAttribute("fill","lightgrey"),g.setAttribute("points",`${S-E/2},${L-E} ${S-E/2},${L+E} ${S+E},${L}`),g.setAttribute("fill","#ffffff"),h.appendChild(f),h.appendChild(g),e){let C=e.length*16-10,v=16*1.5,A=(c-C)/2,R=l-v-10,N=document.createElementNS(d,"rect");N.setAttribute("x",A.toString()),N.setAttribute("y",R.toString()),N.setAttribute("width",C.toString()),N.setAttribute("height",v.toString()),N.setAttribute("fill","#353945b3"),N.setAttribute("rx","12"),h.appendChild(N);let O=document.createElementNS(d,"text");O.textContent=e,O.setAttribute("x",(c/2).toString()),O.setAttribute("y",(R+16).toString()),O.setAttribute("font-size","16"),O.setAttribute("text-anchor","middle"),O.setAttribute("fill","white"),h.appendChild(O)}let V=new XMLSerializer().serializeToString(h),K=new Image,oe=new Blob([V],{type:"image/svg+xml;charset=utf-8"}),ge=URL.createObjectURL(oe);K.onload=()=>{let te=document.createElement("canvas");te.width=c,te.height=l;let C=te.getContext("2d");C.beginPath(),C.moveTo(n,0),C.lineTo(c-n,0),C.quadraticCurveTo(c,0,c,n),C.lineTo(c,l-n),C.quadraticCurveTo(c,l,c-n,l),C.lineTo(n,l),C.quadraticCurveTo(0,l,0,l-n),C.lineTo(0,n),C.quadraticCurveTo(0,0,n,0),C.closePath(),C.clip(),C.drawImage(o,0,0,c,l),C.drawImage(K,0,0,c,l);let v=te.toDataURL("image/png");r(v)},K.onerror=i,K.src=ge},o.onerror=i,o.src=t});var $0e=t=>{try{return t?.replace(/[\n\t\u200D]/g,"")?.split(/\s+/)?.filter(r=>r?.trim()?.length)||[]}catch(e){return M.catch("Error in utils getWords: ",e),[]}},W0e=(t,e=[])=>{try{let n=e.map(r=>`[${r}="${t}"]`).join(",");return document.querySelector(n)}catch(n){return M.catch("Error in utils getElementByAttributes: ",n),null}},z0e=(t,e=[])=>{try{let n=e.map(r=>`[${r}="${t}"]`).join(",");return document.querySelectorAll(n)}catch(n){return M.catch("Error in utils getElementsByAttributes: ",n),[]}},AT=t=>{try{let e=Math.floor(t/3600),n=Math.floor((t-e*3600)/60),r=Math.floor(t-e*3600-n*60);return e&&e<10&&(e="0"+e),n<10&&(n="0"+n),r<10&&(r="0"+r),(e?e+":":"")+n+":"+r}catch{return""}},lQ=10,q0e=t=>{try{if(typeof t!="number"||!isFinite(t))return 0;let e=1e3/lQ;return Math.round(t*e)/e}catch{return t}},K0e=t=>{try{if(!t||typeof t!="object")return;let e={videoPlayerId:t.videoPlayerId,currentMediaPosition:t.currentMediaPosition,locationName:t.locationName};return t.version?.id&&t.version?.name&&(e.version={id:t.version.id,name:t.version.name}),e}catch{return}},Y0e=(t,e=10)=>{try{if(!t||!t.currentTime)throw new Error("Invalid video element reference provided");let n=t.currentTime,r=Math.floor(n/e)*e,i=r+e;return{startSlot:AT(r),endSlot:AT(i),timeSlot:AT(r)+" - "+AT(i)}}catch{return null}},uQ=t=>{try{return t?typeof ShadowRoot<"u"&&t instanceof ShadowRoot?!0:Object.prototype.toString.call(t)==="[object ShadowRoot]":!1}catch{return!1}},WV=t=>{let e=[];try{let n=t;for(;n;){let r=n?.getRootNode?.();if(!r||r===n||!uQ(r))break;e.push(r),n=r.host}}catch(n){M.catch("Error in utils getShadowRootsForElement: ",n)}return e},hR=(t,e)=>{try{let n=r=>!!r&&(r===t||t.contains(r));return n(e.startContainer)&&n(e.endContainer)}catch{return!1}},CV=new Set,zV=(t,e)=>{try{let n=`${t}|${e}`;if(CV.has(n))return;CV.add(n),M.catch(`Caret resolution failed in ${t} (${e}). Mentions and text replacement may not work in this browser.`)}catch{}};var mR=t=>{try{if(!t)return{status:"failed",reason:"no-element"};let e=WV(t),n=window.getSelection(),r=!1,i=e[0];if(i&&typeof i.getSelection=="function"){let o=i.getSelection();if(o?.rangeCount){r=!0;let s=o.getRangeAt(0);if(hR(t,s))return{status:"resolved",range:s,selection:o}}}if(e.length&&typeof n?.getComposedRanges=="function")try{let s=n.getComposedRanges({shadowRoots:e})?.[0];if(s&&(r=!0,hR(t,s))){let a=document.createRange();return a.setStart(s.startContainer,s.startOffset),a.setEnd(s.endContainer,s.endOffset),{status:"resolved",range:a,selection:n}}}catch{}if(n?.rangeCount){r=!0;let o=n.getRangeAt(0);if(hR(t,o))return{status:"resolved",range:o,selection:n}}return r?{status:"failed",reason:"caret-not-resolvable-in-element"}:{status:"no-caret"}}catch(e){return M.catch("Error in utils resolveCaretRangeInElement: ",e),{status:"failed",reason:"threw"}}},X0e=t=>{try{let e=mR(t);if(e.status==="resolved"&&e.selection)return e.selection;let n=WV(t)[0];return n&&typeof n.getSelection=="function"?n.getSelection():window.getSelection()}catch(e){return M.catch("Error in utils getSelectionForElement: ",e),window.getSelection()}},DV=(t,e)=>{try{return!t||!e?!1:typeof t.setBaseAndExtent=="function"?(t.setBaseAndExtent(e.startContainer,e.startOffset,e.startContainer,e.startOffset),!0):(t.removeAllRanges(),t.addRange(e),!0)}catch(n){return M.catch("Error in utils setCaretToRangeStart: ",n),!1}},Q0e=(t,e=["@"])=>{try{let n="",r=mR(t);if(r.status==="failed")return zV("getWordAtCursor",r.reason),"";if(r.status==="resolved"){let i=r.range,o=i.endOffset,s=i?.commonAncestorContainer?.textContent;s?n=dQ(s,o,e):n=""}return n}catch(n){return M.catch("Error in utils getWordAtCursor: ",n),""}};var dQ=(t,e,n=["@"])=>{try{let r=-1,i=!1;for(let o of n){let s=t.lastIndexOf(o,e),a=s>0?t.lastIndexOf(o,s-1):-1;if(s>r){let c=RT(t,s,e),l=NT(t,s,e);if(c||l){if(a!==-1){let d=RT(t,a,s),h=NT(t,a,s);!d&&!h&&(r=a,i=!0)}}else r=s,i=!0}}return r!==-1&&i?t.substring(r,e):""}catch(r){return M.catch("Error in utils getStringFromLastAtSymbol: ",r),""}},RT=(t,e,n)=>{try{if(e===0)return!1;let r=t.charAt(e-1);return!(r===" "||r==="\xA0"||r===`
124
124
  `||r===" "||[",",":",";"].includes(r))}catch(r){return M.catch("Error in utils isHotkeyDisabledForAutocomplete: ",r),!1}},NT=(t,e,n)=>{try{return!!t.substring(e+1,n).startsWith(" ")}catch(r){return M.catch("Error in utils isHotkeyFollowedBySpace: ",r),!1}},J0e=(t,e,n=["@"])=>{try{let r=mR(t);if(r.status==="failed"){zV("replaceWordAtCursor",r.reason);return}if(r.status==="resolved"){let i=r.selection,o=r.range,s=o.startOffset,a=o?.commonAncestorContainer?.textContent;if(a){let c=-1;for(let l of n){let d=a.lastIndexOf(l,s),h=d>0?a.lastIndexOf(l,d-1):-1;if(d>c){let f=RT(a,d,s),g=NT(a,d,s);if(f||g){if(h!==-1){let E=RT(a,h,d),I=NT(a,h,d);!E&&!I&&(c=h)}}else c=d}}if(c!==-1){let l=a.substring(0,c),d=a.substring(o.endOffset),h=document.createElement("span");h.textContent=e,h.style.color="var(--velt-accent)";let f=e.startsWith("@")?e.substring(1):e;h.classList.add("velt-mention"),h.classList.add(f.includes("@")?"velt-mention--email":"velt-mention--name");let g=Date.now()+"_"+Math.random().toString(36).substr(2,9);h.setAttribute("data-recently-added",g),setTimeout(()=>{h.hasAttribute("data-recently-added")&&h.removeAttribute("data-recently-added")},5e3);let E=o.commonAncestorContainer;if(E.nodeType===Node.TEXT_NODE){let I=E.parentNode;if(I){let S=document.createTextNode(l),L=document.createTextNode(d);I.replaceChild(L,E),I.insertBefore(h,L),I.insertBefore(S,h);try{let V=document.createRange();V.setStartAfter(h),V.collapse(!0),DV(i,V)}catch(V){M.catch("Error positioning cursor after span:",V);try{let K=document.createRange();K.selectNodeContents(t),K.collapse(!1),DV(i,K)}catch(K){M.catch("Error with fallback cursor positioning:",K)}}}}}}}}catch(r){M.catch("Error in utils replaceWordAtCursor: ",r)}},Z0e=()=>{try{let e=window.getSelection()?.getRangeAt(0),n=e?.commonAncestorContainer,r=e?.startContainer,i=e?.endContainer,o=[];o.push(n),o.push(r),o.push(i);let s=!1;for(let a of o)if(a&&qi(a,[F.TAGS.SNIPPYLY_TEXT_HIGHLIGHT,F.TAGS.SNIPPYLY_COMMENT_TEXT_PORTAL,F.TAGS.SNIPPYLY_HIGHLIGHT_USER_TEXT,F.TAGS.SNIPPYLY_COMMENT_TEXT])){s=!0;break}return s}catch(t){return M.catch("Error in utils isTextSelectionIncludesSnippylyElement: ",t),!1}},qV=(t,e,n)=>{try{let r=document.querySelector(`[id=${t}]`);if(r)r.name=e,r.content=n;else{let i=document.createElement("meta");i.id=t,i.name=e,i.content=n,document.getElementsByTagName("head")[0].appendChild(i)}}catch{}},KV=t=>{try{if(t){let e=document.querySelector(`[id=${t}]`);e&&e.remove()}}catch{}},YV=()=>{try{let e=new Date().getTimezoneOffset(),n=Math.floor(Math.abs(e)/60),r=Math.abs(e)%60;return`UTC${e>0?"-":"+"}${n?.toString()?.padStart(2,"0")}:${r?.toString()?.padStart(2,"0")}`}catch(t){return M.catch("Error in utils getTimezone: ",t),""}},eMe=()=>{try{let t=[];return document.querySelectorAll("*").forEach(n=>{(n.scrollHeight>n.clientHeight||n.scrollWidth>n.clientWidth||["auto","scroll"].includes(getComputedStyle(n).overflow))&&t.push(n)}),t}catch(t){return M.catch("Error in utils getScrollableElements: ",t),[]}},XV=(t,e)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2),tMe=(t,e={x:window.innerWidth/2,y:window.innerHeight/2})=>{try{let n=t;for(;n.children.length>0;){let r=null,i=Number.MAX_SAFE_INTEGER;for(let o=0;o<n.children.length;o++){let s=n.children[o],a=s.getBoundingClientRect(),c={x:a.left+a.width/2,y:a.top+a.height/2},l=XV(c,e);(a.top>=0||a.bottom<=window.innerHeight)&&a.width>0&&a.height>0&&l<=i&&(r=s,i=l)}if(r===null)break;n=r}return n}catch(n){return M.catch("Error in utils getInnermostElement: ",n),null}},nMe=t=>{try{let{offsetWidth:e,offsetHeight:n,scrollTop:r}=t,i=t,o={x:e/2,y:r+n/2};for(;i.children.length>0;){let s=null,a=Number.MAX_SAFE_INTEGER;for(let c=0;c<i.children.length;c++){let l=i.children[c],d={x:l.offsetLeft+l.offsetWidth/2,y:l.offsetTop+l.offsetHeight/2},h=XV(d,o);l.offsetTop>=0&&l.offsetWidth>0&&l.offsetHeight>0&&h<=a&&(s=l,a=h)}if(s===null)break;i=s}return i}catch(e){return M.catch("Error in utils getNestedInnermostElement: ",e),null}},rMe=()=>{try{let t=window.innerWidth/2,e=window.innerHeight/2,n=document.elementFromPoint(t,e);for(;n&&n.tagName==="BODY";)e+=2,n=document.elementFromPoint(t,e);return n}catch(t){return M.catch("Error in utils getCenteredBackgroundElement: ",t),null}},iMe=(t,e,n=!1)=>{try{let r=t.getBoundingClientRect(),i=e.getBoundingClientRect(),o=e.offsetTop;n&&(o=o-r.height/2+i.height/2),t.scrollTo({top:o,behavior:"smooth"})}catch(r){M.catch("Error in utils nestedScrollIntoView: ",r)}},oMe=(t,e=!0)=>{try{let n=document.body.getBoundingClientRect(),r=t.getBoundingClientRect(),i=r.top-n.top,o=window.innerHeight,s=i;e&&(s=s-o/2+r.height/2),window.scrollTo({top:s,behavior:"smooth"})}catch(n){M.catch("Error in utils scrollIntoView: ",n)}},sMe=(t=!1)=>{try{let e=!0;return t&&(e=/\sChrome\/[\d.]+ Mobile\s/.test(navigator.userAgent)),"ontouchstart"in window||navigator.maxTouchPoints>0||e}catch(e){return M.catch("Error in utils isTouchDevice: ",e),!1}},aMe=(t,e,n)=>{try{return(1-n)*t+n*e}catch(r){M.catch("Error in utils lerp: ",r)}return 0},cMe=(t,e)=>{try{if(t===void 0)return t;if(t=t.replace("#",""),t.length===6){let n=parseInt(t,16),r=(n>>16)+e;r>255&&(r=255),r<0&&(r=0);let i=(n&255)+e;i>255&&(i=255),i<0&&(i=0);let o=(n>>8&255)+e;return o>255&&(o=255),o<0&&(o=0),`#${(i|o<<8|r<<16).toString(16)}`}else return t}catch(n){M.catch("Error in utils multiplyColor: ",n)}return t},lMe=t=>{try{return t in F.TEXT_COLOR_MAP?F.TEXT_COLOR_MAP[t]:"#141416"}catch(e){return M.catch("Error in generateUserColor:",e),"#141416"}},uMe=()=>{try{let t=localStorage.getItem(F.LOCAL_STORAGE.SNIPPYLY_DEFAULT_MEDIA_SOURCE_OPTIONS);if(t)return JSON.parse(t)}catch(t){return M.catch("Error in getDefaultMediaStreamOptions:",t),{}}},dMe=(t,e)=>{try{let n=e*(Math.PI/180),r=Math.cos(n);return r?t/r:t}catch(n){return M.catch("Error in calculateHypotenuse:",n),0}},hMe=(t,e,n=!0)=>{try{let r=[],i=n?t:t.parentNode;for(;i;)r.push(i),i=i.parentNode;let o=n?e:e.parentNode;for(;o;){if(r.indexOf(o)!==-1)return o;o=o.parentNode}return null}catch(r){return M.catch("Error in utils findCommonParent: ",r),null}},fMe=(t,e,n,r,i=!1)=>{try{let o,s;if(i){let a=n,c=r;if(a===c)o=t,s=e;else{let l=0,d=0,h=a;for(;h&&h!==c;)l+=h.offsetLeft,d+=h.offsetTop,h=h.parentElement;o=l+t,s=d+e}}else{let a=n.getBoundingClientRect(),c=r.getBoundingClientRect(),l=a.left+t,d=a.top+e;o=l-c.left,s=d-c.top}return{x:o,y:s}}catch(o){return M.catch("Error in utils calculateParentCoordinates: ",o),{x:t,y:e}}},pMe=t=>{try{let e={height:0,width:0};if(typeof t?.getBBox=="function"){let n=t?.getBBox(),r=t?.getBoundingClientRect();e.height=parseFloat(r?.height||n.height||0),e.width=parseFloat(r?.width||n.width||0)}else{let n=window.getComputedStyle(t);if(e.height=t?.clientHeight||parseFloat(n.getPropertyValue("height"))||0,e.width=t?.clientWidth||parseFloat(n.getPropertyValue("width"))||0,t?.getBoundingClientRect&&typeof t?.getBoundingClientRect=="function"){let r=t?.getBoundingClientRect();e?.height||(e.height=r?.height||t?.clientHeight||t?.offsetHeight||0),e?.width||(e.width=r?.width||t?.clientWidth||t?.offsetWidth||0)}}return e}catch(e){return M.catch("Error in utils getElementDimensions: ",e),{height:0,width:0}}},gMe=t=>{try{let e=t;for(;e;){if(window?.getComputedStyle(e)?.getPropertyValue("background-clip")=="text")return!0;e=e?.parentElement}return!1}catch(e){return M.catch("Error in utils hasParentWithBackgroundClip: ",e),!1}},mMe=t=>{try{let e=["attachment","attachments","chunkUrls","transcription","color","position","positionX","positionY","resolved","inProgress","screenWidth","screenHeight","screenScrollHeight","screenScrollTop","taggedElementPath","taggedElementRect","targetElement","documentParamsId","documentParams","ghostComment","areaAnnotationId","iam","commentSource"],n=JSON.parse(JSON.stringify(t)),r={};return Object.keys(n).forEach(i=>{e.includes(i)||(r[i]=n[i])}),JSON.parse(JSON.stringify(r))}catch(e){return M.catch("Error in utils getRecorderAnnotationForClient: ",e),null}},EMe=t=>t===null||typeof t>"u",_Me=(t,e)=>{try{return!!t?.closest(`[${e}]`)}catch(n){return M.catch("Error in utils hasParentWithAttribute: ",n),!1}},hQ=(t,e=!0)=>{try{let n=[];if(!t||!(t instanceof HTMLElement))return[];e&&n.push(t);for(let r=0;r<t.children.length;r++){let i=t.children[r];n=n.concat(hQ(i))}return n}catch(n){return M.catch("Error in utils getAllNestedChildren: ",n),[]}},TMe=()=>{try{return document.visibilityState==="hidden"?!1:document.hasFocus()}catch(t){return M.catch("Error in utils isTabActive: ",t),!1}},yMe=t=>{try{let e="",n=t?.getAttribute("src");if(n)e=`${Mc(n)}`;else{let r=t?.querySelectorAll("source");if(r&&r.length>0){let o=r[0]?.getAttribute("src");o&&(e=`${Mc(o)}`)}}return e}catch{return""}},IMe=t=>{try{return!(t&&(t?.children?.length>0||t?.textContent?.trim()?.length>0))}catch(e){return M.catch("Error in utils isTemplateEmpty: ",e),!0}},RV=(t,e)=>{try{if(!t||!e)return;let n=[],r="",i=0;for(let c=0;c<e.length;c++){let l=e[c];l==="["?(i++,i===1&&r&&(n.push(r),r=""),r+=l):l==="]"?(i--,r+=l,i===0&&(n.push(r),r="")):l==="."&&i===0?r&&(n.push(r),r=""):r+=l}r&&n.push(r);let o,s=B({},t),a=n.reduce((c,l)=>{if(c==null)return;ki(c)&&(o=c,c=c());let d=l.match(/^\[([^\[\]]+|(\[[^\[\]]*\]))\]$/);if(d){let f=d[1];if(/^\d+$/.test(f)){let g=parseInt(f,10);return Array.isArray(c)?c[g]:void 0}if(f.startsWith("'")&&f.endsWith("'")||f.startsWith('"')&&f.endsWith('"')){let g=f.slice(1,-1);return c[g]}if(f.includes(".")||f.includes("[")){let g=RV(s,f);ki(g)&&(g=g());let E=g?.toString()||"";return c[E]}if(s[f]!==void 0){let g=s[f];return ki(g)&&(g=g()),c[g]}return c[f]}let h=l;return(l.startsWith("'")&&l.endsWith("'")||l.startsWith('"')&&l.endsWith('"'))&&(h=l.slice(1,-1)),h==="length"&&Array.isArray(c)?c.length:c[h]},t);return o?Vf(()=>{try{let c=B({},t);return n.reduce((l,d)=>{if(l==null)return;ki(l)&&(l=l());let h=d.match(/^\[([^\[\]]+|(\[[^\[\]]*\]))\]$/);if(h){let g=h[1];if(/^\d+$/.test(g)){let E=parseInt(g,10);return Array.isArray(l)?l[E]:void 0}if(g.startsWith("'")&&g.endsWith("'")||g.startsWith('"')&&g.endsWith('"')){let E=g.slice(1,-1);return l[E]}if(g.includes(".")||g.includes("[")){let E=RV(c,g);ki(E)&&(E=E());let I=E?.toString()||"";return l[I]}if(c[g]!==void 0){let E=c[g];return ki(E)&&(E=E()),l[E]}return l[g]}let f=d;return(d.startsWith("'")&&d.endsWith("'")||d.startsWith('"')&&d.endsWith('"'))&&(f=d.slice(1,-1)),l[f]},t)}catch{return""}}):a}catch{return""}},vMe=(t,e)=>{try{return!!(t?.locationId&&(t.locationId===e?.locationId||e?.location?.id===String(t.locationId))||t?.location?.id&&(t.location.id===e?.location?.id||t.location.id===String(e?.locationId)))}catch(n){return M.catch("Error in utils isLocationSame: ",n),!1}},SMe=()=>{try{let t=document.activeElement,e=new Set,n=10,r=0;for(;t&&t.shadowRoot&&!(e.has(t)||(e.add(t),t=t.shadowRoot.activeElement,r++,r>n)););return t}catch(t){return M.catch("Error in utils getActiveElement: ",t),null}},cp=(t,e)=>{try{return typeof t=="object"&&typeof e=="object"?JSON.stringify(t)===JSON.stringify(e):t===e}catch{return!1}},fQ=(t,e=0)=>{try{let n=JSON.parse(JSON.stringify(t));return t?.clientDocumentId&&(n.documentId=t.clientDocumentId),t?.clientOrganizationId&&(n.organizationId=t.clientOrganizationId),t?.documentMetadata&&e<5&&(n.documentMetadata=fQ(t.documentMetadata,e+1)),delete n?.clientDocumentId,delete n?.clientOrganizationId,delete n?.veltFolderId,delete n?.parentVeltFolderId,delete n?.pageInfo,n}catch{return t}},AMe=t=>{try{if(!t.some(s=>s?.value?.data))return{};let e=null,n=t.reduce((s,a)=>Math.max(s,a.timestamp),0),r=t.find(s=>s.timestamp===n);if(!r)return{};r?.value?.operation?.type==="removed"&&(e=r?.value?.operation);let o=t.map(s=>s.value).reduce((s,a)=>({data:B(B({},s?.data??{}),a?.data??{})}),{});return o.operation=e,o}catch{return{}}},CMe=(t,e,n)=>y(null,null,function*(){try{let r=0;for(;r<=(n.retryCount||0);)try{let i=yield t();if(!i)return{success:!1,statusCode:400,message:`${e} failed: No response received`};if(i.statusCode===void 0)return{success:!1,statusCode:400,message:`${e} failed: Response missing statusCode`};if(i.statusCode!==200){if(r++,r>(n.retryCount||0))return{success:!1,statusCode:i.statusCode,message:`${e} failed after ${r} attempts with status code ${i.statusCode}`};n.retryDelay&&(yield new Promise(o=>setTimeout(o,n.retryDelay)));continue}return i}catch(i){if(r++,r>(n.retryCount||0))return{success:!1,statusCode:500,message:`${e} failed with error: ${i instanceof Error?i.message:"Unknown error"}`};n.retryDelay&&(yield new Promise(o=>setTimeout(o,n.retryDelay)))}return{success:!1,statusCode:500,message:`${e} failed: Maximum retry attempts exceeded`}}catch(r){return{success:!1,statusCode:500,message:`${e} failed with unexpected error: ${r instanceof Error?r.message:"Unknown error"}`}}}),DMe=(t,e,n,r,i)=>y(null,null,function*(){try{let o=typeof e=="function"?yield e():e||{},a=B(B({},{"Content-Type":"application/json"}),o),c=yield fetch(t,B({method:"POST",headers:a,body:JSON.stringify(n)},i?{credentials:i}:{}));if(!c.ok)return M.catch(`Error in makeConfigBasedRequest: ${c.status} ${c.statusText}`),r?{data:{},success:!1,statusCode:c.status}:{success:!1,statusCode:c.status};let l=yield c.json();return r?{data:l?.data??{},success:!0,statusCode:200}:{success:!0,statusCode:200}}catch(o){return M.catch("Error in makeConfigBasedRequest:",o),r?{data:{},success:!1,statusCode:500}:{success:!1,statusCode:500}}}),RMe=t=>{try{return!t||!t?.access?[]:Object.keys(t.access).sort().map(i=>t.access?.[i]?.map(o=>`${i}:${o}`)??[]).reduce((i,o)=>i.flatMap(s=>o.map(a=>[...s,a])),[[]]).map(i=>i.join("_"))}catch(e){return M.catch("Error in utils generateProcessedContext: ",e),[]}},pQ=t=>{try{if(!t||!t?.access)return[];let e=Object.keys(t.access).sort(),r=(o=>{let s=[],a=Math.pow(2,o.length);for(let c=1;c<a;c++){let l=[];for(let d=0;d<o.length;d++)c&1<<d&&l.push(o[d]);s.push(l)}return s})(e),i=[];for(let o of r){let s=o.map(a=>{let c=t.access?.[a];return c==null?null:`${a}:${c}`}).filter(a=>a!==null);s.length>0&&i.push(s.join("_"))}return[...new Set(i)]}catch(e){return M.catch("Error in utils generateAllContextCombos: ",e),[]}},NMe=({input:t})=>{try{if(!t||!t?.access)return[];let e=t?.access,n=Object.keys(e).sort(),r=[];for(let o of n){let s=e[o];s!=null&&Array.isArray(s)&&s.length>0&&r.push({key:o,values:s})}return r.length===0?[]:r.reduce((o,{key:s,values:a})=>o.length===0?a.map(c=>[{key:s,value:c}]):o.flatMap(c=>a.map(l=>[...c,{key:s,value:l}])),[]).map(o=>{let s={};return o.forEach(({key:a,value:c})=>{s[a]=c}),{access:s}})}catch(e){return M.catch("Error in utils expandContextArraysToSingleValues: ",e),[]}},wMe=({input:t})=>{try{if(!t||t.length===0)return{access:{}};let e=new Set;t.forEach(r=>{r?.access&&Object.keys(r.access).forEach(i=>e.add(i))});let n={};for(let r of Array.from(e).sort()){let i=new Set;t.forEach(o=>{if(o?.access){let s=o.access[r];s!=null&&i.add(s)}}),n[r]=i.size>0?Array.from(i).sort():null}return{access:n}}catch(e){return M.catch("Error in utils combineContextsToArrays: ",e),{access:{}}}},QV=i=>y(null,[i],function*({data:t,getSdkProxy:e,userId:n,methodName:r}){try{let o="sdkproxyencryptionanddecryptiononsdk"+(n??""),s=yield gQ({data:t,key:o}),a=(yield e({veltData:s}))?.data?.data?.veltData||{};return yield sp(a,o)}catch(o){return M.catch("Error in utils sdkProxyEncryptDecrypt: "+(r??""),o),t}}),gQ=n=>y(null,[n],function*({data:t,key:e}){try{return yield wT(t,e)}catch{return t}}),ER=(t,e)=>y(null,null,function*(){try{let n=0;for(;n<=(e.retryCount||0);)try{let r=yield t();if(!r)throw new Error("No response received");return r}catch{if(n++,n>=(e.retryCount||0))return null;e.retryDelay&&(yield new Promise(i=>setTimeout(i,e.retryDelay)))}return null}catch{return null}}),_R=t=>{try{if(t&&typeof t=="object"){let e=JSON.parse(JSON.stringify(t));return e?.clientOrganizationId&&(e.organizationId=e.clientOrganizationId,delete e.clientOrganizationId),e?.clientGroupId&&(e.groupId=e.clientGroupId,delete e.clientGroupId),e?.userSnippylyId&&delete e.userSnippylyId,delete e?.email_lowercase,delete e?.name_lowercase,e}else return null}catch(e){return M.catch("Error in utils getUserForClient: ",e),null}},sd=({url:t,apiProxyDomain:e})=>{try{if(Pc(t))return t;if(e){let n=new URL(t);n.origin&&(t=t.replace(n.origin,e))}return t}catch(n){return M.catch("Error in utils getResolvedApiUrl: ",n),t}},bMe=(t,e)=>{try{if(!t||!(t instanceof Element))return!1;let n,r;if(e&&typeof e.x=="number"&&typeof e.y=="number")n=e.x,r=e.y;else{let o=t.getBoundingClientRect();n=o.left+o.width/2,r=o.top+o.height/2}let i=document.elementFromPoint(n,r);return!(!i||i===t||t.contains(i))}catch{return!1}};function op(t,e){if(t==null||typeof t!="object"||Array.isArray(t))return t;let n={};for(let r of e)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function Kt(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)}function Ps(t,e){switch(e.kind){case"type":return op(t,e.safeKeys);case"array":return Array.isArray(t)?t.map(n=>Ps(n,e.item)):t;case"record":{if(!Kt(t))return t;let n={};for(let r of Object.keys(t))n[r]=Ps(t[r],e.value);return n}case"object":{if(!Kt(t))return t;let n=e.selfKeys?op(t,e.selfKeys):B({},t);for(let r of Object.keys(e.fields))Object.prototype.hasOwnProperty.call(n,r)&&(n[r]=Ps(n[r],e.fields[r]));return n}case"omit":{if(!Kt(t))return t;let n=B({},t);for(let r of e.keys)delete n[r];return n}default:return t}}var Ln={kind:"type",safeKeys:ST},mQ={kind:"type",safeKeys:oR},EQ={kind:"type",safeKeys:EV},_Q={kind:"object",selfKeys:lR,fields:{resolvedBy:Ln}},bT={kind:"object",selfKeys:cR,fields:{resolvedBy:Ln}},Uo="textEditorConfig",nd="text";function OMe(t){let e=Kt(t)?t[Uo]:void 0;if(!(!Kt(e)||!Object.prototype.hasOwnProperty.call(e,nd)))return e[nd]}function MMe(t){let e=Kt(t)?t[Uo]:void 0;Kt(e)&&delete e[nd]}function LMe(t,e,n){if(!t||typeof t!="object")return;if(!Kt(t.context)){if(!n?.createContext)return;t.context={}}let r=t.context[Uo];r!==void 0&&!Kt(r)||(r===void 0&&(t.context[Uo]={}),t.context[Uo][nd]=e)}var TQ=new Set(lR),OT=cR.filter(t=>!TQ.has(t));function fR(t){return t===void 0?void 0:JSON.parse(JSON.stringify(t))}function PMe(t){return Kt(t)&&OT.some(e=>Object.prototype.hasOwnProperty.call(t,e))}function xMe(t){if(Kt(t))for(let e of OT)delete t[e]}function kMe(t,e){let n={};if(Kt(t))for(let r of OT)Object.prototype.hasOwnProperty.call(t,r)&&t[r]!==void 0&&(n[r]=fR(t[r]));if(Kt(e))for(let r of Object.keys(e))e[r]!==void 0&&(n[r]=fR(e[r]));return n}function FMe(t,e){if(!(!t||typeof t!="object")&&!(!Kt(t.suggestion)||!Kt(e)))for(let n of OT)Object.prototype.hasOwnProperty.call(e,n)&&(t.suggestion[n]=fR(e[n]))}var MT={kind:"object",fields:{[Uo]:{kind:"omit",keys:[nd]}}},LT={kind:"object",fields:{}},lp={kind:"type",safeKeys:aR},Fo={kind:"type",safeKeys:sR};function TR(t){return{kind:"object",selfKeys:iR,fields:{from:Ln,to:{kind:"array",item:Ln},attachments:{kind:"array",item:t},recorders:{kind:"array",item:EQ},taggedUserContacts:{kind:"array",item:{kind:"object",fields:{contact:Ln}}}}}}function xs(t,e=MT,n=_Q){return{kind:"object",selfKeys:fV,fields:{from:Ln,assignedTo:Ln,resolvedByUser:Ln,viewedBy:{kind:"array",item:Ln},subscribedUsers:{kind:"record",value:{kind:"object",fields:{user:Ln}}},unsubscribedUsers:{kind:"record",value:{kind:"object",fields:{user:Ln}}},suggestion:n,targetTextRange:mQ,context:e,comments:{kind:"array",item:TR(t)}}}}var yQ=xs(lp),JV=xs(Fo),IQ=xs(lp,LT),vQ=xs(Fo,LT),SQ=xs(lp,MT,bT),AQ=xs(Fo,MT,bT),CQ=xs(lp,LT,bT),DQ=xs(Fo,LT,bT),RQ=TR(lp),NQ=TR(Fo),wQ={kind:"object",fields:{from:Ln,context:MT,commentAnnotationsMap:{kind:"record",value:JV}}},bQ={kind:"object",selfKeys:gV,fields:{from:Ln,reactions:{kind:"array",item:{kind:"object",fields:{from:Ln}}}}},OQ={kind:"object",selfKeys:mV,fields:{from:Ln,attachment:Fo,attachments:{kind:"array",item:Fo},recordingEditVersions:{kind:"record",value:{kind:"object",fields:{from:Ln,attachment:Fo,attachments:{kind:"array",item:Fo}}}}}};function MQ(t,e){let n=!!e?.stripAttachmentFiles,r;return e?.keepSuggestionContent?r=e?.keepContextText?n?CQ:DQ:n?SQ:AQ:r=e?.keepContextText?n?IQ:vQ:n?yQ:JV,Ps(t,r)}function UMe(t,e){return Ps(t,e?.stripAttachmentFiles?RQ:NQ)}function VMe(t){return Ps(t,wQ)}var yR=["name","email","photoUrl","clientUserName","initial","name_lowercase","email_lowercase"];function IR(t){if(!Kt(t))return t;let e=B({},t);for(let n of yR)delete e[n];return e}var BMe=["oldCommentText","rejectReason"];function NV(t){return Kt(t)&&typeof t.userId=="string"&&("name"in t||"email"in t||"photoUrl"in t)}var ZV=/(text|html)$/i;function GMe(t,e){return typeof e=="string"&&ZV.test(t)}function LQ(t,e){if(!ZV.test(t))return!1;if(typeof e=="string")return!0;if(!Kt(e))return!1;let n=e;return typeof n.from=="string"||typeof n.to=="string"}function vR(t){return!!t&&!!(t.comment||t.user||t.reaction||t.recorder||t.activity||t.attachment)}var PQ=pV.filter(t=>!iR.includes(t)),xQ=sR.filter(t=>!aR.includes(t)),kQ=64;function eB(t){try{if(t&&typeof t=="object"){let e=t.statusCode;return typeof e=="number"?`statusCode ${e}`:t instanceof Error?`threw ${t.name||"Error"}`:"no statusCode"}return t==null?"no response":"no statusCode"}catch{return"no statusCode"}}function tB(t,e,n){return vR(e)?pR(t,e,0,{pageRoot:n?.kind==="page"}):t}function Ls(t,e){for(let n of e??[])Object.prototype.hasOwnProperty.call(t,n)&&delete t[n]}var Ue=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);function FQ(t){return!!(t instanceof Date||t instanceof RegExp||t instanceof Error||t instanceof Promise||t instanceof Map||t instanceof Set||t instanceof WeakMap||t instanceof WeakSet||t instanceof ArrayBuffer||ArrayBuffer.isView(t)||typeof Blob<"u"&&t instanceof Blob||typeof Node<"u"&&t instanceof Node)}function an(t){if(!Kt(t)||FQ(t))return!1;let e=Object.getPrototypeOf(t);return!(e!==Object.prototype&&e!==null&&Object.keys(t).length===0)}var UQ=["event","eventTimestamp","apiKey","sessionTabId","traits","properties"];function VQ(t){return UQ.some(e=>Ue(t,e))}var ip=t=>an(t)?op(t,ST):t;function BQ(t){for(let e of["from","assignedTo","resolvedByUser","actionUser"])Ue(t,e)&&(t[e]=ip(t[e]));for(let e of["to","viewedBy"])Array.isArray(t[e])&&(t[e]=t[e].map(ip));for(let e of["subscribedUsers","unsubscribedUsers"])if(an(t[e])){let n={};for(let r of Object.keys(t[e])){let i=t[e][r];n[r]=an(i)&&Ue(i,"user")?me(B({},i),{user:ip(i.user)}):i}t[e]=n}Array.isArray(t.taggedUserContacts)&&(t.taggedUserContacts=t.taggedUserContacts.map(e=>an(e)&&Ue(e,"contact")?me(B({},e),{contact:ip(e.contact)}):e)),an(t.suggestion)&&Ue(t.suggestion,"resolvedBy")&&(t.suggestion=me(B({},t.suggestion),{resolvedBy:ip(t.suggestion.resolvedBy)}))}function GQ(t){return Ue(t,"annotationId")&&(Ue(t,"reactions")||Ue(t,"iconEmoji")||Ue(t,"iconUrl"))}function jQ(t){return Ue(t,"annotationId")&&(Ue(t,"recordingType")||Ue(t,"recordedTime")||Ue(t,"attachment")||Ue(t,"transcription"))}function HQ(t){return Ue(t,"featureType")&&Ue(t,"actionType")&&(Ue(t,"changes")||Ue(t,"entityData")||Ue(t,"timestamp")||Ue(t,"id"))}var wV=t=>Array.isArray(t)?t.map(e=>an(e)?{attachmentId:e.attachmentId,name:e.name,bucketPath:e.bucketPath}:e):t;function $Q(t){if(Ue(t,"attachment")&&(t.attachment=null),Ue(t,"chunkUrls")&&an(t.chunkUrls)&&(t.chunkUrls={}),Ue(t,"attachments")&&(t.attachments=wV(t.attachments)),an(t.recordingEditVersions)){let e={};for(let n of Object.keys(t.recordingEditVersions)){let r=t.recordingEditVersions[n];if(!an(r)){e[n]=r;continue}let i=B({},r);Ue(i,"attachment")&&(i.attachment=null),Ue(i,"attachments")&&(i.attachments=wV(i.attachments)),delete i.transcription,e[n]=i}t.recordingEditVersions=e}}var CT=t=>an(t)&&Ue(t,"userId")?{userId:t.userId}:t;function WQ(t){if(Ue(t,"actionUser")&&(t.actionUser=CT(t.actionUser)),an(t.changes)){let e={};for(let n of Object.keys(t.changes)){let r=t.changes[n];e[n]=an(r)?B(B(B({},r),Ue(r,"from")?{from:CT(r.from)}:{}),Ue(r,"to")?{to:CT(r.to)}:{}):r}t.changes=e}if(an(t.displayMessageTemplateData)){let e={};for(let n of Object.keys(t.displayMessageTemplateData))e[n]=CT(t.displayMessageTemplateData[n]);t.displayMessageTemplateData=e}}var zQ=yR.filter(t=>t!=="name");function pR(t,e,n,r={}){if(n>kQ)throw new Error("self-hosting telemetry filter: nesting too deep");let i=r.recorderOwned?{recorderOwned:!0}:{};if(Array.isArray(t))return t.map(g=>pR(g,e,n+1,i));if(!an(t))return t;let o=B({},t),s=VQ(o),a=Ue(o,"annotationId"),c=!s&&GQ(o),l=!s&&jQ(o),d=!s&&!c&&!l&&(a||Ue(o,"commentId")),h=!!e.attachment&&!!e.comment;if(e.comment){if(Ls(o,PQ),an(o.targetTextRange)&&(o.targetTextRange=op(o.targetTextRange,oR)),an(o.context)&&an(o.context[Uo])){let g=B({},o.context[Uo]);delete g[nd],o.context=me(B({},o.context),{[Uo]:g})}d&&(BQ(o),a&&(Array.isArray(o.comments)&&(o=MQ(o,{stripAttachmentFiles:h})),Ls(o,e.comment.fieldsToRemove)))}if(e.activity&&!s&&HQ(o)&&(Ls(o,e.activity.fieldsToRemove),WQ(o),an(o.changes))){let g=B({},o.changes);for(let E of Object.keys(g))LQ(E,g[E])&&delete g[E];o.changes=g}e.user&&(!s&&NV(o)?o=op(o,ST):(NV(o)||typeof o.email=="string"||typeof o.photoUrl=="string")&&Ls(o,r.pageRoot?zQ:yR)),h&&!r.recorderOwned&&Ue(o,"attachmentId")&&Ls(o,xQ),e.reaction&&c&&(o=qQ(o),Ls(o,e.reaction.fieldsToRemove)),e.recorder&&(Ls(o,["transcription"]),l&&(o=KQ(o),$Q(o),Ls(o,e.recorder.fieldsToRemove)));let f=l&&e.recorder?{recorderOwned:!0}:i;for(let g of Object.keys(o))o[g]=pR(o[g],e,n+1,f);return o}function qQ(t){return Ps(t,bQ)}function KQ(t){return Ps(t,OQ)}var nB=()=>{};var AR={NODE_CLIENT:!1,NODE_ADMIN:!1,SDK_VERSION:"${JSCORE_VERSION}"};var q=function(t,e){if(!t)throw kc(e)},kc=function(t){return new Error("Firebase Database ("+AR.SDK_VERSION+") INTERNAL ASSERT FAILED: "+t)};var oB=function(t){let e=[],n=0;for(let r=0;r<t.length;r++){let i=t.charCodeAt(r);i<128?e[n++]=i:i<2048?(e[n++]=i>>6|192,e[n++]=i&63|128):(i&64512)===55296&&r+1<t.length&&(t.charCodeAt(r+1)&64512)===56320?(i=65536+((i&1023)<<10)+(t.charCodeAt(++r)&1023),e[n++]=i>>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=i&63|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=i&63|128)}return e},YQ=function(t){let e=[],n=0,r=0;for(;n<t.length;){let i=t[n++];if(i<128)e[r++]=String.fromCharCode(i);else if(i>191&&i<224){let o=t[n++];e[r++]=String.fromCharCode((i&31)<<6|o&63)}else if(i>239&&i<365){let o=t[n++],s=t[n++],a=t[n++],c=((i&7)<<18|(o&63)<<12|(s&63)<<6|a&63)-65536;e[r++]=String.fromCharCode(55296+(c>>10)),e[r++]=String.fromCharCode(56320+(c&1023))}else{let o=t[n++],s=t[n++];e[r++]=String.fromCharCode((i&15)<<12|(o&63)<<6|s&63)}}return e.join("")},ld={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(t,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();let n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let i=0;i<t.length;i+=3){let o=t[i],s=i+1<t.length,a=s?t[i+1]:0,c=i+2<t.length,l=c?t[i+2]:0,d=o>>2,h=(o&3)<<4|a>>4,f=(a&15)<<2|l>>6,g=l&63;c||(g=64,s||(f=64)),r.push(n[d],n[h],n[f],n[g])}return r.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(oB(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):YQ(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();let n=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let i=0;i<t.length;){let o=n[t.charAt(i++)],a=i<t.length?n[t.charAt(i)]:0;++i;let l=i<t.length?n[t.charAt(i)]:64;++i;let h=i<t.length?n[t.charAt(i)]:64;if(++i,o==null||a==null||l==null||h==null)throw new CR;let f=o<<2|a>>4;if(r.push(f),l!==64){let g=a<<4&240|l>>2;if(r.push(g),h!==64){let E=l<<6&192|h;r.push(E)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let t=0;t<this.ENCODED_VALS.length;t++)this.byteToCharMap_[t]=this.ENCODED_VALS.charAt(t),this.charToByteMap_[this.byteToCharMap_[t]]=t,this.byteToCharMapWebSafe_[t]=this.ENCODED_VALS_WEBSAFE.charAt(t),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[t]]=t,t>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}},CR=class extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}},RR=function(t){let e=oB(t);return ld.encodeByteArray(e,!0)},dp=function(t){return RR(t).replace(/\./g,"")},ad=function(t){try{return ld.decodeString(t,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};function sB(t){return aB(void 0,t)}function aB(t,e){if(!(e instanceof Object))return e;switch(e.constructor){case Date:let n=e;return new Date(n.getTime());case Object:t===void 0&&(t={});break;case Array:t=[];break;default:return e}for(let n in e)!e.hasOwnProperty(n)||!XQ(n)||(t[n]=aB(t[n],e[n]));return t}function XQ(t){return t!=="__proto__"}function xT(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}var QQ=()=>xT().__FIREBASE_DEFAULTS__,JQ=()=>{if(typeof process>"u"||typeof process.env>"u")return;let t=process.env.__FIREBASE_DEFAULTS__;if(t)return JSON.parse(t)},ZQ=()=>{if(typeof document>"u")return;let t;try{t=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}let e=t&&ad(t[1]);return e&&JSON.parse(e)},kT=()=>{try{return nB()||QQ()||JQ()||ZQ()}catch(t){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${t}`);return}},cB=t=>{var e,n;return(n=(e=kT())===null||e===void 0?void 0:e.emulatorHosts)===null||n===void 0?void 0:n[t]},ud=t=>{let e=cB(t);if(!e)return;let n=e.lastIndexOf(":");if(n<=0||n+1===e.length)throw new Error(`Invalid host ${e} with no separate hostname and port!`);let r=parseInt(e.substring(n+1),10);return e[0]==="["?[e.substring(1,n-1),r]:[e.substring(0,n),r]},NR=()=>{var t;return(t=kT())===null||t===void 0?void 0:t.config},lB=t=>{var e;return(e=kT())===null||e===void 0?void 0:e[`_${t}`]};var cn=class{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,n)=>{this.resolve=e,this.reject=n})}wrapCallback(e){return(n,r)=>{n?this.reject(n):this.resolve(r),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(n):e(n,r))}}};function _r(t){try{return(t.startsWith("http://")||t.startsWith("https://")?new URL(t).hostname:t).endsWith(".cloudworkstations.dev")}catch{return!1}}function ks(t){return y(this,null,function*(){return(yield fetch(t,{credentials:"include"})).ok})}function FT(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');let n={alg:"none",type:"JWT"},r=e||"demo-project",i=t.iat||0,o=t.sub||t.user_id;if(!o)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");let s=Object.assign({iss:`https://securetoken.google.com/${r}`,aud:r,iat:i,exp:i+3600,auth_time:i,sub:o,user_id:o,firebase:{sign_in_provider:"custom",identities:{}}},t);return[dp(JSON.stringify(n)),dp(JSON.stringify(s)),""].join(".")}var up={};function eJ(){let t={prod:[],emulator:[]};for(let e of Object.keys(up))up[e]?t.emulator.push(e):t.prod.push(e);return t}function tJ(t){let e=document.getElementById(t),n=!1;return e||(e=document.createElement("div"),e.setAttribute("id",t),n=!0),{created:n,element:e}}var rB=!1;function Fc(t,e){if(typeof window>"u"||typeof document>"u"||!_r(window.location.host)||up[t]===e||up[t]||rB)return;up[t]=e;function n(f){return`__firebase__banner__${f}`}let r="__firebase__banner",o=eJ().prod.length>0;function s(){let f=document.getElementById(r);f&&f.remove()}function a(f){f.style.display="flex",f.style.background="#7faaf0",f.style.position="fixed",f.style.bottom="5px",f.style.left="5px",f.style.padding=".5em",f.style.borderRadius="5px",f.style.alignItems="center"}function c(f,g){f.setAttribute("width","24"),f.setAttribute("id",g),f.setAttribute("height","24"),f.setAttribute("viewBox","0 0 24 24"),f.setAttribute("fill","none"),f.style.marginLeft="-6px"}function l(){let f=document.createElement("span");return f.style.cursor="pointer",f.style.marginLeft="16px",f.style.fontSize="24px",f.innerHTML=" &times;",f.onclick=()=>{rB=!0,s()},f}function d(f,g){f.setAttribute("id",g),f.innerText="Learn more",f.href="https://firebase.google.com/docs/studio/preview-apps#preview-backend",f.setAttribute("target","__blank"),f.style.paddingLeft="5px",f.style.textDecoration="underline"}function h(){let f=tJ(r),g=n("text"),E=document.getElementById(g)||document.createElement("span"),I=n("learnmore"),S=document.getElementById(I)||document.createElement("a"),L=n("preprendIcon"),V=document.getElementById(L)||document.createElementNS("http://www.w3.org/2000/svg","svg");if(f.created){let K=f.element;a(K),d(S,I);let oe=l();c(V,L),K.append(V,E,S,oe),document.body.appendChild(K)}o?(E.innerText="Preview backend disconnected.",V.innerHTML=`<g clip-path="url(#clip0_6013_33858)">
125
125
  <path d="M4.8 17.6L12 5.6L19.2 17.6H4.8ZM6.91667 16.4H17.0833L12 7.93333L6.91667 16.4ZM12 15.6C12.1667 15.6 12.3056 15.5444 12.4167 15.4333C12.5389 15.3111 12.6 15.1667 12.6 15C12.6 14.8333 12.5389 14.6944 12.4167 14.5833C12.3056 14.4611 12.1667 14.4 12 14.4C11.8333 14.4 11.6889 14.4611 11.5667 14.5833C11.4556 14.6944 11.4 14.8333 11.4 15C11.4 15.1667 11.4556 15.3111 11.5667 15.4333C11.6889 15.5444 11.8333 15.6 12 15.6ZM11.4 13.6H12.6V10.4H11.4V13.6Z" fill="#212121"/>
126
126
  </g>
@@ -1,2 +1,2 @@
1
- import{b as L}from"./chunk-4GWTY2QW.js";import{Ha as z,Ja as B}from"./chunk-DKI2JSNJ.js";import{Bb as c,Ha as r,Ia as S,Ic as N,Mb as T,Pb as f,Qb as D,Ra as s,Sb as h,Wa as I,_a as O,a as y,ab as m,b as u,ja as w,ka as _,mc as v,nb as p,nc as g,ob as a,pb as d,pj as j,rk as V,sa as C,ub as E,vb as k,xb as F,ya as b,zb as x}from"./chunk-J3DYWDYQ.js";function A(t,i){if(t&1&&(a(0,"span",6),f(1),v(2,"translate"),d()),t&2){let o=c(2).ngIf;r(),h("",g(2,2,"You are following")," ",o.leaderName)}}function P(t,i){t&1&&(a(0,"span",6),f(1),v(2,"translate"),d()),t&2&&(r(),D(g(2,1,"You are leading.")))}function R(t,i){if(t&1){let o=F();a(0,"div",2),x("click",function(){w(o);let e=c().ngIf,l=c();return _(e.type==="following"?l.closeOverlay():void 0)}),a(1,"div",3),m(2,A,3,4,"span",4)(3,P,3,3,"span",4),a(4,"button",5),x("click",function(){w(o);let e=c(2);return _(e.closeOverlay())}),f(5),v(6,"translate"),v(7,"translate"),d()()()}if(t&2){let o=c().ngIf;T("no-pointer",o.type==="leading"),r(2),p("ngIf",o.type==="following"),r(),p("ngIf",o.type==="leading"),r(2),h("",g(6,6,"Stop")," ",g(7,8,o.type))}}function Y(t,i){if(t&1&&(E(0),m(1,R,8,10,"div",1),k()),t&2){let o=i.ngIf;r(),p("ngIf",o.leaderName!==""||o.type==="leading")}}var te=(()=>{let i=class i extends B{closeOverlay(){this.closeOverlayEvent.emit()}constructor(n,e,l,M){super(e,l),this.loggingService=n,this.elementRef=e,this.themeService=l,this.domService=M,this.closeOverlayEvent=new S,this.componentConfigSignal=C({leaderName:"",type:"following"})}ngOnInit(){}ngAfterViewInit(){try{this.customCssSubscription=this.domService.subscribeInjectCustomCss(this.elementRef)}catch(n){this.loggingService.catch("Error in FollowOverlayComponent ngAfterViewInit: ",n)}}setLeaderName(n){try{this.componentConfigSignal.update(e=>(e=u(y({},e),{leaderName:n}),e))}catch(e){this.loggingService.catch("Error in FollowOverlayComponent setLeaderName: ",e)}}getLeaderName(){return this.componentConfigSignal().leaderName}setType(n){try{this.componentConfigSignal.update(e=>(e=u(y({},e),{type:n}),e))}catch(e){this.loggingService.catch("Error in FollowOverlayComponent setType: ",e)}}ngOnDestroy(){try{super.ngOnDestroy(),this.customCssSubscription?.unsubscribe()}catch(n){this.loggingService.catch("Error in FollowOverlayComponent ngOnDestroy: ",n)}}};i.\u0275fac=function(e){return new(e||i)(s(j),s(b),s(z),s(V))},i.\u0275cmp=I({type:i,selectors:[["snippyly-follow-overlay"]],outputs:{closeOverlayEvent:"closeOverlayEvent"},standalone:!1,features:[O],decls:1,vars:1,consts:[[4,"ngIf"],["data-velt-ignore","","class","follow-overlay-container",3,"no-pointer","click",4,"ngIf"],["data-velt-ignore","",1,"follow-overlay-container",3,"click"],["data-velt-ignore","",1,"follow-dialog"],["data-velt-ignore","","class","follow-text",4,"ngIf"],["data-velt-ignore","",1,"follow-btn",3,"click"],["data-velt-ignore","",1,"follow-text"]],template:function(e,l){e&1&&m(0,Y,2,1,"ng-container",0),e&2&&p("ngIf",l.componentConfigSignal())},dependencies:[N,L],styles:[`html{--velt-base-rem-unit: 1}*[data-snippyly-element=true],*[data-velt-element=true]{font-family:var(--velt-default-font-family)}velt-wireframe{display:none!important}body.velt-pin-dragging iframe{pointer-events:none!important}.follow-overlay-container{position:fixed;top:0;left:0;width:100%;height:100%;background-color:transparent;z-index:var(--velt-follow-mode-overlay-z-index);display:flex;justify-content:center;align-items:flex-end}.follow-overlay-container .follow-dialog{background-color:var(--legacy-velt-follow-overlay-bg-color);color:var(--legacy-velt-follow-overlay-text-color);font-size:12px;display:flex;justify-content:center;align-items:center;gap:calc((1.2rem + 0px) * var(--velt-base-rem-unit));padding:calc((.9rem + 0px) * var(--velt-base-rem-unit)) calc((1.1rem + 0px) * var(--velt-base-rem-unit));border-radius:90px;margin-bottom:calc((2rem + 0px) * var(--velt-base-rem-unit));box-shadow:0 8px 16px -8px #0f0f0f1a;border:1px solid var(--legacy-velt-follow-overlay-border-color)}.follow-overlay-container .follow-dialog .follow-btn{background-color:var(--legacy-velt-follow-overlay-btn-color);padding:8px 12px;border-radius:90px;display:inline-flex;justify-content:center;align-items:center;border:none;font-weight:600;font-size:14px;cursor:pointer;pointer-events:all}.follow-overlay-container .follow-dialog .follow-btn:hover{transition:background-color .5s;background-color:var(--legacy-velt-follow-overlay-btn-hover-color)}.follow-overlay-container.no-pointer{pointer-events:none}
1
+ import{b as L}from"./chunk-3BCXNETY.js";import{Ha as z,Ja as B}from"./chunk-GHN6NWBT.js";import{Bb as c,Ha as r,Ia as S,Ic as N,Mb as T,Pb as f,Qb as D,Ra as s,Sb as h,Wa as I,_a as O,a as y,ab as m,b as u,ja as w,ka as _,mc as v,nb as p,nc as g,ob as a,pb as d,pj as j,rk as V,sa as C,ub as E,vb as k,xb as F,ya as b,zb as x}from"./chunk-VESMHAEV.js";function A(t,i){if(t&1&&(a(0,"span",6),f(1),v(2,"translate"),d()),t&2){let o=c(2).ngIf;r(),h("",g(2,2,"You are following")," ",o.leaderName)}}function P(t,i){t&1&&(a(0,"span",6),f(1),v(2,"translate"),d()),t&2&&(r(),D(g(2,1,"You are leading.")))}function R(t,i){if(t&1){let o=F();a(0,"div",2),x("click",function(){w(o);let e=c().ngIf,l=c();return _(e.type==="following"?l.closeOverlay():void 0)}),a(1,"div",3),m(2,A,3,4,"span",4)(3,P,3,3,"span",4),a(4,"button",5),x("click",function(){w(o);let e=c(2);return _(e.closeOverlay())}),f(5),v(6,"translate"),v(7,"translate"),d()()()}if(t&2){let o=c().ngIf;T("no-pointer",o.type==="leading"),r(2),p("ngIf",o.type==="following"),r(),p("ngIf",o.type==="leading"),r(2),h("",g(6,6,"Stop")," ",g(7,8,o.type))}}function Y(t,i){if(t&1&&(E(0),m(1,R,8,10,"div",1),k()),t&2){let o=i.ngIf;r(),p("ngIf",o.leaderName!==""||o.type==="leading")}}var te=(()=>{let i=class i extends B{closeOverlay(){this.closeOverlayEvent.emit()}constructor(n,e,l,M){super(e,l),this.loggingService=n,this.elementRef=e,this.themeService=l,this.domService=M,this.closeOverlayEvent=new S,this.componentConfigSignal=C({leaderName:"",type:"following"})}ngOnInit(){}ngAfterViewInit(){try{this.customCssSubscription=this.domService.subscribeInjectCustomCss(this.elementRef)}catch(n){this.loggingService.catch("Error in FollowOverlayComponent ngAfterViewInit: ",n)}}setLeaderName(n){try{this.componentConfigSignal.update(e=>(e=u(y({},e),{leaderName:n}),e))}catch(e){this.loggingService.catch("Error in FollowOverlayComponent setLeaderName: ",e)}}getLeaderName(){return this.componentConfigSignal().leaderName}setType(n){try{this.componentConfigSignal.update(e=>(e=u(y({},e),{type:n}),e))}catch(e){this.loggingService.catch("Error in FollowOverlayComponent setType: ",e)}}ngOnDestroy(){try{super.ngOnDestroy(),this.customCssSubscription?.unsubscribe()}catch(n){this.loggingService.catch("Error in FollowOverlayComponent ngOnDestroy: ",n)}}};i.\u0275fac=function(e){return new(e||i)(s(j),s(b),s(z),s(V))},i.\u0275cmp=I({type:i,selectors:[["snippyly-follow-overlay"]],outputs:{closeOverlayEvent:"closeOverlayEvent"},standalone:!1,features:[O],decls:1,vars:1,consts:[[4,"ngIf"],["data-velt-ignore","","class","follow-overlay-container",3,"no-pointer","click",4,"ngIf"],["data-velt-ignore","",1,"follow-overlay-container",3,"click"],["data-velt-ignore","",1,"follow-dialog"],["data-velt-ignore","","class","follow-text",4,"ngIf"],["data-velt-ignore","",1,"follow-btn",3,"click"],["data-velt-ignore","",1,"follow-text"]],template:function(e,l){e&1&&m(0,Y,2,1,"ng-container",0),e&2&&p("ngIf",l.componentConfigSignal())},dependencies:[N,L],styles:[`html{--velt-base-rem-unit: 1}*[data-snippyly-element=true],*[data-velt-element=true]{font-family:var(--velt-default-font-family)}velt-wireframe{display:none!important}body.velt-pin-dragging iframe{pointer-events:none!important}.follow-overlay-container{position:fixed;top:0;left:0;width:100%;height:100%;background-color:transparent;z-index:var(--velt-follow-mode-overlay-z-index);display:flex;justify-content:center;align-items:flex-end}.follow-overlay-container .follow-dialog{background-color:var(--legacy-velt-follow-overlay-bg-color);color:var(--legacy-velt-follow-overlay-text-color);font-size:12px;display:flex;justify-content:center;align-items:center;gap:calc((1.2rem + 0px) * var(--velt-base-rem-unit));padding:calc((.9rem + 0px) * var(--velt-base-rem-unit)) calc((1.1rem + 0px) * var(--velt-base-rem-unit));border-radius:90px;margin-bottom:calc((2rem + 0px) * var(--velt-base-rem-unit));box-shadow:0 8px 16px -8px #0f0f0f1a;border:1px solid var(--legacy-velt-follow-overlay-border-color)}.follow-overlay-container .follow-dialog .follow-btn{background-color:var(--legacy-velt-follow-overlay-btn-color);padding:8px 12px;border-radius:90px;display:inline-flex;justify-content:center;align-items:center;border:none;font-weight:600;font-size:14px;cursor:pointer;pointer-events:all}.follow-overlay-container .follow-dialog .follow-btn:hover{transition:background-color .5s;background-color:var(--legacy-velt-follow-overlay-btn-hover-color)}.follow-overlay-container.no-pointer{pointer-events:none}
2
2
  `],encapsulation:3,changeDetection:0});let t=i;return t})();export{te as a};
@@ -1 +1 @@
1
- import{Ra as c,Za as o,rk as s}from"./chunk-J3DYWDYQ.js";var n=(()=>{let r=class r{constructor(t){this.domService=t}transform(t){try{return this.domService.sanitizeHtml(t)}catch{return t}}};r.\u0275fac=function(i){return new(i||r)(c(s,16))},r.\u0275pipe=o({name:"sanitizeHtml",type:r,pure:!0});let e=r;return e})();export{n as a};
1
+ import{Ra as c,Za as o,rk as s}from"./chunk-VESMHAEV.js";var n=(()=>{let r=class r{constructor(t){this.domService=t}transform(t){try{return this.domService.sanitizeHtml(t)}catch{return t}}};r.\u0275fac=function(i){return new(i||r)(c(s,16))},r.\u0275pipe=o({name:"sanitizeHtml",type:r,pure:!0});let e=r;return e})();export{n as a};
@@ -1 +1 @@
1
- import{a as N}from"./chunk-DF2C2V7B.js";import{D as K,E as W}from"./chunk-72TEWHMQ.js";import{E as P,Eh as V,Fh as L,G as x,Gh as H,He as m,Hh as z,Ih as R,Ij as G,J as C,Jh as F,K as f,Lj as B,Oa as j,Og as T,Tg as k,ba as v,db as X,ea as a,l as p,na as M,pj as g,r as A,rk as J,sk as b,vg as $,w as D,z as y}from"./chunk-J3DYWDYQ.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-VJPZ6E4S.js";import{D as K,E as W}from"./chunk-NTFMMZRZ.js";import{E as P,Eh as V,Fh as L,G as x,Gh as H,He as m,Hh as z,Ih as R,Ij as G,J as C,Jh as F,K as f,Lj as B,Oa as j,Og as T,Tg as k,ba as v,db as X,ea as a,l as p,na as M,pj as g,r as A,rk as J,sk as b,vg as $,w as D,z as y}from"./chunk-VESMHAEV.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-DKI2JSNJ.js";import{D as C,E as w}from"./chunk-72TEWHMQ.js";import{E as h,G as d,He as $,Hi as D,Ij as k,K as v,M as l,V as n,_f as g,ba as A,ci as I,ea as s,l as p,nf as M,oj as E,pj as R,qj as y,r as u,sk as U,v as c,we as a,xe as m}from"./chunk-J3DYWDYQ.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.databaseService.getDb().pipe(h(i=>!!i),v(1)).subscribe(i=>{i&&(this.getUser(),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.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-GHN6NWBT.js";import{D as C,E as w}from"./chunk-NTFMMZRZ.js";import{E as h,G as d,He as $,Hi as D,Ij as k,K as v,M as l,V as n,_f as g,ba as A,ci as I,ea as s,l as p,nf as M,oj as E,pj as R,qj as y,r as u,sk as U,v as c,we as a,xe as m}from"./chunk-VESMHAEV.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.databaseService.getDb().pipe(h(i=>!!i),v(1)).subscribe(i=>{i&&(this.getUser(),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.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};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veltdev/sdk",
3
- "version": "6.0.27",
3
+ "version": "6.0.28",
4
4
  "description": "Velt is an SDK to add collaborative features to your product within minutes. Example: Comments like Figma, Frame.io, Google docs or sheets, Recording like Loom, Huddles like Slack and much more.",
5
5
  "homepage": "https://velt.dev",
6
6
  "keywords": [