@veltdev/sdk-staging 6.0.45 → 6.0.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{chunk-EFWZWZAR.js → chunk-2SUZN4J5.js} +1 -1
- package/{chunk-BEMVY5TX.js → chunk-52H6CAP6.js} +1 -1
- package/{chunk-I4SBC3EE.js → chunk-BNBKJFCL.js} +1 -1
- package/{chunk-SP25RLYB.js → chunk-BYA5GRRA.js} +1 -1
- package/{chunk-7KXS2DSG.js → chunk-CY3Z6YM2.js} +1 -1
- package/{chunk-OXMSOSYV.js → chunk-FJG2GRJL.js} +1 -1
- package/{chunk-LWTRRGHL.js → chunk-GBXZKP4D.js} +1 -1
- package/{chunk-R3KBXENN.js → chunk-GE4WLXLO.js} +1 -1
- package/{chunk-D5QZV6VO.js → chunk-GUEKQYJC.js} +1 -1
- package/{chunk-6E6YYWQ4.js → chunk-H6OXSGUD.js} +1 -1
- package/{chunk-6K62XPB3.js → chunk-HA3O6G3U.js} +1 -1
- package/{chunk-CU4CNZ3O.js → chunk-HIABNFAR.js} +1 -1
- package/{chunk-E47OMTOM.js → chunk-J7IKUCX4.js} +1 -1
- package/chunk-JCXRUTKR.js +1 -0
- package/{chunk-BNG3HAKY.js → chunk-JINBMEFY.js} +1 -1
- package/{chunk-CQ6HOISZ.js → chunk-LQIQPPBC.js} +1 -1
- package/{chunk-U52DCY3D.js → chunk-LS6AUPI2.js} +1 -1
- package/chunk-MUCCS7W5.js +1 -0
- package/{chunk-QNEPYZBW.js → chunk-N6ZNIMPQ.js} +1 -1
- package/{chunk-XY7DGMPO.js → chunk-NRLY6QJV.js} +1 -1
- package/{chunk-VYRSFZO2.js → chunk-O45WUXKC.js} +1 -1
- package/{chunk-LCF6FZ5S.js → chunk-ODSR6WET.js} +1 -1
- package/{chunk-NZWI6NA5.js → chunk-R3OAQ2SS.js} +1 -1
- package/{chunk-ZOA2LIG4.js → chunk-RNR222BC.js} +1 -1
- package/{chunk-ZMILEE6P.js → chunk-STH6LBQ2.js} +1 -1
- package/{chunk-I3POWLVT.js → chunk-SV45FZNW.js} +1 -1
- package/{chunk-XUBFTUBO.js → chunk-TK5RUDIK.js} +1 -1
- package/{chunk-4GZCXZSN.js → chunk-U4NYWUIY.js} +1 -1
- package/{chunk-QUMZPTVX.js → chunk-U4QDCODY.js} +2 -2
- package/{chunk-QBZHSLQ3.js → chunk-U7Y5JM3R.js} +1 -1
- package/{chunk-ACPZ3R7G.js → chunk-UWT2NJAW.js} +1 -1
- package/{chunk-3SLQQKJ6.js → chunk-X4X6TTJD.js} +1 -1
- package/{chunk-N65XETWG.js → chunk-XWI56DIX.js} +1 -1
- package/{chunk-36A7ZG4L.js → chunk-YEXOMKD4.js} +1 -1
- package/{chunk-QT57U43N.js → chunk-YJ7CBMSQ.js} +1 -1
- package/{chunk-BB7YQNOZ.js → chunk-ZXD2KPSW.js} +1 -1
- package/package.json +1 -1
- package/velt-activity-log.js +1 -1
- package/velt-area.js +1 -1
- package/velt-arrow.js +1 -1
- package/velt-comment.js +17 -17
- package/velt-crdt.js +1 -1
- package/velt-cursor.js +1 -1
- package/velt-huddle.js +1 -1
- package/velt-live-state-sync.js +1 -1
- package/velt-notification.js +1 -1
- package/velt-portable.js +1 -1
- package/velt-presence.js +1 -1
- package/velt-reaction.js +1 -1
- package/velt-recorder.js +1 -1
- package/velt-rewriter.js +1 -1
- package/velt-selection.js +1 -1
- package/velt-tag.js +1 -1
- package/velt-user-invite.js +1 -1
- package/velt-user-request.js +1 -1
- package/velt-video-player.js +1 -1
- package/velt-views.js +1 -1
- package/velt.js +3 -3
- package/chunk-JV7MPTE5.js +0 -1
- package/chunk-YKZV3FEU.js +0 -1
|
@@ -116,7 +116,7 @@ ${n.map((r,i)=>`${i+1}) ${r.toString()}`).join(`
|
|
|
116
116
|
<path d="M3.33301 1.33333C3.33301 0.873096 3.7061 0.5 4.16634 0.5C4.62658 0.5 4.99967 0.873096 4.99967 1.33333V19.6667C4.99967 20.1269 4.62658 20.5 4.16634 20.5C3.7061 20.5 3.33301 20.1269 3.33301 19.6667V1.33333Z" fill="currentColor"/>
|
|
117
117
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.3086 12.167H3.33301V2.16699H8.33301C9.42152 2.16699 10.3476 2.86267 10.6908 3.83366H14.803C16.0419 3.83366 16.8477 5.13751 16.2937 6.24568L14.9997 8.83366L16.2937 11.4216C16.8477 12.5298 16.0419 13.8337 14.803 13.8337H11.6663C10.5778 13.8337 9.65179 13.138 9.3086 12.167ZM4.99967 3.83366H8.33301C8.79324 3.83366 9.16634 4.20675 9.16634 4.66699V10.5003H4.99967V3.83366ZM10.833 11.3337C10.833 11.7939 11.2061 12.167 11.6663 12.167H14.803L13.1363 8.83366L14.803 5.50033H10.833V11.3337Z" fill="currentColor"/>
|
|
118
118
|
</g>
|
|
119
|
-
</svg>`}},B.WorkspaceRoles=[{id:od.COMMENTER?.toLowerCase(),name:od.COMMENTER,description:"Can comment on this project",permissions:[]},{id:od.ADMIN?.toLowerCase(),name:od.ADMIN,description:"Can comment on all projects and has access to the portal",permissions:[]}],B.DocumentAccessTypeMap={[kn.PUBLIC]:{id:kn.PUBLIC,name:kn.PUBLIC,description:"Anyone with link can view"},[kn.RESTRICTED]:{id:kn.RESTRICTED,name:kn.RESTRICTED,description:"Only people with access can view"}},B.DocumentAccessTypeMapSF={[kn.PUBLIC]:{id:kn.PUBLIC,name:kn.PUBLIC,description:"Anyone with the link can comment after logging in."},[kn.RESTRICTED]:{id:kn.RESTRICTED,name:kn.RESTRICTED,description:"Only people added to this project can comment."}},B.CommentCategoryMap={bug:{id:"bug",name:"Bug",color:"#FF7162"},feedback:{id:"feedback",name:"Feedback",color:"#00C48C"},question:{id:"question",name:"Question",color:"#FFD166"}},B.OVERLAY_POSITIONS=[{originX:"end",originY:"top",overlayX:"start",overlayY:"top"},{originX:"start",originY:"bottom",overlayX:"start",overlayY:"top"},{originX:"end",originY:"bottom",overlayX:"end",overlayY:"top"},{originX:"center",originY:"bottom",overlayX:"center",overlayY:"top"},{originX:"start",originY:"top",overlayX:"start",overlayY:"bottom"},{originX:"end",originY:"top",overlayX:"end",overlayY:"bottom"},{originX:"center",originY:"top",overlayX:"center",overlayY:"bottom"},{originX:"start",originY:"top",overlayX:"end",overlayY:"top"},{originX:"start",originY:"bottom",overlayX:"end",overlayY:"bottom"},{originX:"start",originY:"center",overlayX:"end",overlayY:"center"},{originX:"end",originY:"bottom",overlayX:"start",overlayY:"bottom"},{originX:"end",originY:"center",overlayX:"start",overlayY:"center"}],B.OVERLAY_POSITIONS_FOR_POPOVER_MODE=[{originX:"end",originY:"top",overlayX:"start",overlayY:"top"},{originX:"end",originY:"center",overlayX:"start",overlayY:"center"},{originX:"end",originY:"bottom",overlayX:"start",overlayY:"bottom"},{originX:"start",originY:"top",overlayX:"end",overlayY:"top"},{originX:"start",originY:"center",overlayX:"end",overlayY:"center"},{originX:"start",originY:"bottom",overlayX:"end",overlayY:"bottom"}],B.VIDEO_EDITOR={ZOOM_IN_DURATION:500,ZOOM_OUT_DURATION:500,DEFAULT_ZOOM_FACTOR:1.5,MAX_ZOOM_FACTOR:3,ZOOM_FACTOR_OPTIONS:[{value:2,label:"2x"},{value:1.7,label:"1.7x"},{value:1.5,label:"1.5x"},{value:1.2,label:"1.2x"}],MIN_DRAG_AREA_MULTIPLIER:.015,PREFERRED_SECTION_DURATION_MULTIPLIER:.15,SELECTION_MIN_DRAG_DISTANCE:2,MIN_DURATION_THRESHOLD:.01,TIME_BUFFER:.1,SHORT_VIDEO_THRESHOLD:3,SMALL_VIDEO_THRESHOLD:5,MILLISECOND_PRECISION_MULTIPLIER:1e3,TENTH_SECOND_PRECISION_MULTIPLIER:10,DEBOUNCE_DELAY:200,DECIMAL_PRECISION:2,MAX_MARKER_COUNT:10,MARKER_INTERVAL:5,FAST_TIMEOUT:50,STANDARD_TIMEOUT:100,RECTANGLE_POSITIONING:{FULL_PERCENT:100,HALF_PERCENT:50,QUARTER_PERCENT:25},EASING:{QUAD_IN_OUT_MULTIPLIER:2,QUAD_IN_OUT_POWER:2,HALF_THRESHOLD:.5},PERCENTAGE:{HALF:50,FULL:100},MILLISECONDS_TO_SECONDS:1e3};var k=B;var wRe=new K("arrow-utils"),ORe=new K("notification-service"),LRe=new K("notifications-actions"),MRe=new K("notification-utils"),PRe=new K("cursor-service"),xRe=new K("cursor-utils"),kRe=new K("presence-service"),FRe=new K("presence-actions"),URe=new K("presence-utils"),VRe=new K("huddle-service"),BRe=new K("huddle-utils"),GRe=new K("recorder-service"),DT=new K("recorder-annotation-service"),jRe=new K("recorder-actions"),HRe=new K("recorder-utils"),$Re=new K("recorder-pin-portal"),RT=new K("comment-service"),WRe=new K("comment-actions"),zRe=new K("comment-dialog-core"),qRe=new K("comment-dialog-action"),KRe=new K("comment-text-service"),YRe=new K("comment-text-portal"),XRe=new K("comment-pin-portal"),QRe=new K("comment-views"),NT=new K("reaction-service"),JRe=new K("rewriter-service"),ZRe=new K("rewriter-actions"),bT=new K("area-service"),WU=new K("activity-service"),zU=new K("views-service"),qU=new K("crdt-service"),KU=new K("live-state-service");var wT=(()=>{let e=class e{constructor(){this.subjects=new Map,O.log("%c[WB] Creating CLASS: ServiceBook","color: blue;")}set(r,i){try{O.log(`%c[WB] ServiceBook.set: ${r.toString()}`,"color: green;"),this.getOrCreateSubject(r).next(i)}catch(o){O.catch("Error in ServiceBook set: ",o)}}get(r){return this.subjects.get(r)?.value??null}observe(r){return this.getOrCreateSubject(r).asObservable()}getOrCreateSubject(r){let i=this.subjects.get(r);return i||(i=new de(null),this.subjects.set(r,i)),i}};e.\u0275fac=function(i){return new(i||e)},e.\u0275prov=Z({token:e,factory:e.\u0275fac,providedIn:"root"});let t=e;return t})();var St=(()=>{let e=class e{};e.Events={Core:{IDENTIFY:"identify",SDK_VALIDATE_CLIENT_TRIGGERED:"sdkValidateClientTriggered",SDK_VALIDATE_CLIENT_SUCCESS:"sdkValidateClientSuccess",SDK_VALIDATE_CLIENT_FAILED:"sdkValidateClientFailed",SDK_USER_AUTH_SUCCESS:"sdkUserAuthSuccess",SDK_USER_AUTH_FAILED:"sdkUserAuthFailed",SDK_USER_SIGN_OUT:"sdkUserSignOut",SDK_PLAN_EXPIRED:"sdkPlanExpired",SDK_ERROR:"error",SDK_UNCAUGHT_ERROR:"uncaughtError",SDK_SESSION_RE_LOGIN_TRIGGERED:"sdkSessionReLoginTriggered",SDK_SESSION_TOKEN_EXPIRED:"sdkSessionTokenExpired",SDK_SESSION_RE_LOGIN_COUNT_EXCEEDED:"sdkSessionReLoginCountExceeded",SDK_JWT_EXPIRED_RETRY_EXCEEDED:"sdkJwtExpiredRetryExceeded",SDK_EVENT_RATE_LIMIT_EXCEEDED:"sdkEventRateLimitExceeded",SET_PERMISSION_PROVIDER_TRIGGERED:"setPermissionProviderTriggered",SIGN_OUT_USER_TRIGGERED:"signOutUserTriggered",SET_DOCUMENTS_TRIGGERED:"setDocumentsTriggered",SET_ROOT_LOCATION_TRIGGERED:"setRootLocationTriggered",SET_ROOT_DOCUMENT_TRIGGERED:"setRootDocumentTriggered",UNSET_DOCUMENTS_TRIGGERED:"unsetDocumentsTriggered",FETCH_DOCUMENTS_TRIGGERED:"fetchDocumentsTriggered",UPDATE_DOCUMENTS_TRIGGERED:"updateDocumentsTriggered",UPDATE_LOCATIONS_TRIGGERED:"updateLocationsTriggered",FETCH_FOLDERS_TRIGGERED:"fetchFoldersTriggered",SET_USER_DATA_PROVIDER_TRIGGERED:"setUserDataProviderTriggered",SET_ANONYMOUS_USER_DATA_PROVIDER_TRIGGERED:"setAnonymousUserDataProviderTriggered",SET_DATA_PROVIDERS_TRIGGERED:"setDataProvidersTriggered",SET_ENCRYPTION_PROVIDER_TRIGGERED:"setEncryptionProviderTriggered",SET_VELT_AUTH_PROVIDER_TRIGGERED:"setVeltAuthProviderTriggered",GET_DOCUMENT_ID_TRIGGERED:"getDocumentIdTriggered",SET_LOCATIONS_TRIGGERED:"setLocationsTriggered",SET_SCROLLABLE_ELEMENTS_IDS_TRIGGERED:"setScrollableElementsIdsTriggered",REMOVE_LOCATIONS_TRIGGERED:"removeLocationsTriggered",UNSET_LOCATIONS_TRIGGERED:"unsetLocationsTriggered",EXCLUDE_LOCATION_IDS_TRIGGERED:"excludeLocationIdsTriggered",UPDATE_CONTACT_LIST_TRIGGERED:"updateContactListTriggered",UPDATE_ORG_LIST_TRIGGERED:"updateOrgListTriggered",REMOVE_SCROLLABLE_ELEMENTS_IDS_TRIGGERED:"removeScrollableElementsIdsTriggered",GET_PRESENCE_ELEMENT_TRIGGERED:"getPresenceElementTriggered",GET_CURSOR_ELEMENT_TRIGGERED:"getCursorElementTriggered",GET_COMMENT_ELEMENT_TRIGGERED:"getCommentElementTriggered",GET_TAG_ELEMENT_TRIGGERED:"getTagElementTriggered",GET_SELECTION_ELEMENT_TRIGGERED:"getSelectionElementTriggered",GET_RECORDER_ELEMENT_TRIGGERED:"getRecorderElementTriggered",GET_CONTACT_ELEMENT_TRIGGERED:"getContactElementTriggered",GET_REWRITER_ELEMENT_TRIGGERED:"getRewriterElementTriggered",GET_HUDDLE_ELEMENT_TRIGGERED:"getHuddleElementTriggered",GET_LIVE_STATE_SYNC_ELEMENT_TRIGGERED:"getLiveStateSyncElementTriggered",GET_ARROW_ELEMENT_TRIGGERED:"getArrowElementTriggered",GET_VIEWS_ELEMENT_TRIGGERED:"getViewsElementTriggered",GET_NOTIFICATION_ELEMENT_TRIGGERED:"getNotificationElementTriggered",GET_AUTOCOMPLETE_ELEMENT_TRIGGERED:"getAutocompleteElementTriggered",GET_DOC_ELEMENT_TRIGGERED:"getDocElementTriggered",GET_AREA_ELEMENT_TRIGGERED:"getAreaElementTriggered",GET_REACTION_ELEMENT_TRIGGERED:"getReactionElementTriggered",GET_METADATA_TRIGGERED:"getMetadataTriggered",FETCH_DEBUG_INFO_TRIGGERED:"fetchDebugInfoTriggered",GET_DEBUG_INFO_TRIGGERED:"getDebugInfoTriggered",DISABLE_FEATURES_TRIGGERED:"disableFeaturesTriggered",SET_DARK_MODE_TRIGGERED:"setDarkModeTriggered",SET_UNSTYLED_MODE_TRIGGERED:"setUnstyledModeTriggered",ENABLE_LOGS_TRIGGERED:"enableLogsTriggered",DISABLE_LOGS_TRIGGERED:"disableLogsTriggered",IS_USER_ALLOWED_TRIGGERED:"isUserAllowedTriggered",GET_USER_TRIGGERED:"getUserTriggered",GET_CURRENT_USER_TRIGGERED:"getCurrentUserTriggered",GET_HEARTBEAT_TRIGGERED:"getHeartbeatTriggered",GET_USER_ROLE_TRIGGERED:"getUserRoleTriggered",GET_USER_PERMISSIONS_TRIGGERED:"getUserPermissionsTriggered",GET_CURRENT_USER_PERMISSIONS_TRIGGERED:"getCurrentUserPermissionsTriggered",GET_FEATURES_ACCESS_LEVEL_IAM_TRIGGERED:"getFeaturesAccessLevelIamTriggered",IS_PLAN_EXPIRED_TRIGGERED:"isPlanExpiredTriggered",GET_CUSTOMER_METADATA_TRIGGERED:"getCustomerMetadataTriggered",GET_DOCUMENT_METADATA_TRIGGERED:"getDocumentMetadataTriggered",REMOVE_VELT_CONTENT_TRIGGERED:"removeVeltContentTriggered",INJECT_CUSTOM_CSS_TRIGGERED:"injectCustomCssTriggered",SET_LANGUAGE_TRIGGERED:"setLanguageTriggered",SET_TRANSLATIONS_TRIGGERED:"setTranslationsTriggered",ENABLE_AUTO_TRANSLATION_TRIGGERED:"enableAutoTranslationTriggered",DISABLE_AUTO_TRANSLATION_TRIGGERED:"disableAutoTranslationTriggered",SF_TRIGGERED:"sfTriggered",SET_UI_STATE_TRIGGERED:"setUiStateTriggered",GET_UI_STATE_TRIGGERED:"getUiStateTriggered",ENABLE_SAFE_EVAL_TRIGGERED:"enableSafeEvalTriggered",DISABLE_SAFE_EVAL_TRIGGERED:"disableSafeEvalTriggered",ENABLE_FIRESTORE_PERSISTENT_CACHE_TRIGGERED:"enableFirestorePersistentCacheTriggered",DISABLE_FIRESTORE_PERSISTENT_CACHE_TRIGGERED:"disableFirestorePersistentCacheTriggered",RESET_VELT_BUTTON_STATE_TRIGGERED:"resetVeltButtonStateTriggered"},PermissionProvider:{RESOURCE_ACCESS_REQUEST_FORMED:"resourceAccessRequestFormed",RESOURCE_ACCESS_REQUEST_TRIGGERED:"resourceAccessRequestTriggered",REVOKE_ACCESS_ON_DOCUMENT_UNSET_TRIGGERED:"revokeAccessOnDocumentUnsetTriggered",REVOKE_ACCESS_ON_DOCUMENT_UNSET_FORMED:"revokeAccessOnDocumentUnsetFormed",REVOKE_ACCESS_ON_DOCUMENT_UNSET_RESULT:"revokeAccessOnDocumentUnsetResult",REVOKE_ACCESS_ON_USER_LOGOUT_TRIGGERED:"revokeAccessOnUserLogoutTriggered",REVOKE_ACCESS_ON_USER_LOGOUT_FORMED:"revokeAccessOnUserLogoutFormed",REVOKE_ACCESS_ON_USER_LOGOUT_RESULT:"revokeAccessOnUserLogoutResult",RESOURCE_ACCESS_RESULT:"resourceAccessResult",RESOURCE_ACCESS_ERROR:"resourceAccessError",RESOURCE_ACCESS_RESULT_FROM_CACHE:"resourceAccessResultFromCache",REVOKE_ACCESS_ON_DOCUMENT_UNSET_ERROR:"revokeAccessOnDocumentUnsetError",REVOKE_ACCESS_ON_USER_LOGOUT_ERROR:"revokeAccessOnUserLogoutError"},Resolver:{COMMENT_RESOLVER_GET:"comment_resolver_get",COMMENT_RESOLVER_SAVE:"comment_resolver_save",COMMENT_RESOLVER_DELETE:"comment_resolver_delete",COMMENT_RESOLUTION_REQUEST_FORMED:"commentResolutionRequestFormed",COMMENT_RESOLUTION_REQUEST_TRIGGERED:"commentResolutionRequestTriggered",COMMENT_RESOLUTION_RESULT:"commentResolutionResult",COMMENT_RESOLUTION_ERROR:"commentResolutionError",COMMENT_RESOLUTION_RESULT_FROM_CACHE:"commentResolutionResultFromCache",COMMENT_SAVE_REQUEST_FORMED:"commentSaveRequestFormed",COMMENT_SAVE_REQUEST_TRIGGERED:"commentSaveRequestTriggered",COMMENT_SAVE_RESULT:"commentSaveResult",COMMENT_SAVE_ERROR:"commentSaveError",COMMENT_DELETE_REQUEST_FORMED:"commentDeleteRequestFormed",COMMENT_DELETE_REQUEST_TRIGGERED:"commentDeleteRequestTriggered",COMMENT_DELETE_RESULT:"commentDeleteResult",COMMENT_DELETE_ERROR:"commentDeleteError",REACTION_RESOLVER_GET:"reaction_resolver_get",REACTION_RESOLVER_SAVE:"reaction_resolver_save",REACTION_RESOLVER_DELETE:"reaction_resolver_delete",REACTION_RESOLUTION_REQUEST_FORMED:"reactionResolutionRequestFormed",REACTION_RESOLUTION_REQUEST_TRIGGERED:"reactionResolutionRequestTriggered",REACTION_RESOLUTION_RESULT:"reactionResolutionResult",REACTION_RESOLUTION_ERROR:"reactionResolutionError",REACTION_RESOLUTION_RESULT_FROM_CACHE:"reactionResolutionResultFromCache",REACTION_SAVE_REQUEST_FORMED:"reactionSaveRequestFormed",REACTION_SAVE_REQUEST_TRIGGERED:"reactionSaveRequestTriggered",REACTION_SAVE_RESULT:"reactionSaveResult",REACTION_SAVE_ERROR:"reactionSaveError",REACTION_DELETE_REQUEST_FORMED:"reactionDeleteRequestFormed",REACTION_DELETE_REQUEST_TRIGGERED:"reactionDeleteRequestTriggered",REACTION_DELETE_RESULT:"reactionDeleteResult",REACTION_DELETE_ERROR:"reactionDeleteError",NOTIFICATION_RESOLVER_GET:"notification_resolver_get",NOTIFICATION_RESOLVER_DELETE:"notification_resolver_delete",NOTIFICATION_RESOLUTION_REQUEST_FORMED:"notificationResolutionRequestFormed",NOTIFICATION_RESOLUTION_REQUEST_TRIGGERED:"notificationResolutionRequestTriggered",NOTIFICATION_RESOLUTION_RESULT:"notificationResolutionResult",NOTIFICATION_RESOLUTION_ERROR:"notificationResolutionError",NOTIFICATION_DELETE_REQUEST_FORMED:"notificationDeleteRequestFormed",NOTIFICATION_DELETE_REQUEST_TRIGGERED:"notificationDeleteRequestTriggered",NOTIFICATION_DELETE_RESULT:"notificationDeleteResult",NOTIFICATION_DELETE_ERROR:"notificationDeleteError",USER_RESOLVER_GET:"user_resolver_get",USER_RESOLUTION_REQUEST_FORMED:"userResolutionRequestFormed",USER_RESOLUTION_REQUEST_TRIGGERED:"userResolutionRequestTriggered",USER_RESOLUTION_RESULT:"userResolutionResult",USER_RESOLUTION_ERROR:"userResolutionError",USER_RESOLUTION_RESULT_FROM_CACHE:"userResolutionResultFromCache",EMAIL_USER_ID_RESOLUTION_REQUEST_FORMED:"emailUserIdResolutionRequestFormed",EMAIL_USER_ID_RESOLUTION_REQUEST_TRIGGERED:"emailUserIdResolutionRequestTriggered",EMAIL_USER_ID_RESOLUTION_RESULT:"emailUserIdResolutionResult",EMAIL_USER_ID_RESOLUTION_ERROR:"emailUserIdResolutionError",ATTACHMENT_RESOLVER_SAVE:"attachment_resolver_save",ATTACHMENT_RESOLVER_DELETE:"attachment_resolver_delete",ATTACHMENT_SAVE_REQUEST_FORMED:"attachmentSaveRequestFormed",ATTACHMENT_SAVE_REQUEST_TRIGGERED:"attachmentSaveRequestTriggered",ATTACHMENT_SAVE_RESULT:"attachmentSaveResult",ATTACHMENT_SAVE_ERROR:"attachmentSaveError",ATTACHMENT_DELETE_REQUEST_FORMED:"attachmentDeleteRequestFormed",ATTACHMENT_DELETE_REQUEST_TRIGGERED:"attachmentDeleteRequestTriggered",ATTACHMENT_DELETE_RESULT:"attachmentDeleteResult",ATTACHMENT_DELETE_ERROR:"attachmentDeleteError",RECORDER_RESOLVER_GET:"recorder_resolver_get",RECORDER_RESOLVER_SAVE:"recorder_resolver_save",RECORDER_RESOLVER_DELETE:"recorder_resolver_delete",RECORDER_RESOLUTION_REQUEST_FORMED:"recorderResolutionRequestFormed",RECORDER_RESOLUTION_REQUEST_TRIGGERED:"recorderResolutionRequestTriggered",RECORDER_RESOLUTION_RESULT:"recorderResolutionResult",RECORDER_RESOLUTION_ERROR:"recorderResolutionError",RECORDER_RESOLUTION_RESULT_FROM_CACHE:"recorderResolutionResultFromCache",RECORDER_SAVE_REQUEST_FORMED:"recorderSaveRequestFormed",RECORDER_SAVE_REQUEST_TRIGGERED:"recorderSaveRequestTriggered",RECORDER_SAVE_RESULT:"recorderSaveResult",RECORDER_SAVE_ERROR:"recorderSaveError",RECORDER_DELETE_REQUEST_FORMED:"recorderDeleteRequestFormed",RECORDER_DELETE_REQUEST_TRIGGERED:"recorderDeleteRequestTriggered",RECORDER_DELETE_RESULT:"recorderDeleteResult",RECORDER_DELETE_ERROR:"recorderDeleteError",ACTIVITY_RESOLVER_GET:"activity_resolver_get",ACTIVITY_RESOLVER_SAVE:"activity_resolver_save",ACTIVITY_RESOLUTION_REQUEST_FORMED:"activityResolutionRequestFormed",ACTIVITY_RESOLUTION_REQUEST_TRIGGERED:"activityResolutionRequestTriggered",ACTIVITY_RESOLUTION_RESULT:"activityResolutionResult",ACTIVITY_RESOLUTION_ERROR:"activityResolutionError",ACTIVITY_RESOLUTION_RESULT_FROM_CACHE:"activityResolutionResultFromCache",ACTIVITY_SAVE_REQUEST_FORMED:"activitySaveRequestFormed",ACTIVITY_SAVE_REQUEST_TRIGGERED:"activitySaveRequestTriggered",ACTIVITY_SAVE_RESULT:"activitySaveResult",ACTIVITY_SAVE_ERROR:"activitySaveError"},Autocomplete:{CREATE_TRIGGERED:"createTriggered",ON_AUTOCOMPLETE_CHIP_CLICK_TRIGGERED:"onAutocompleteChipClickTriggered"},Comments:{COMMENT_TOOL_CLICKED:"commentToolClicked",COMMENT_DRAFT_ADDED:"commentDraftAdded",COMMENT_ADD_CONTEXT_TRIGGERED:"commentAddContextTriggered",COMMENT_UPDATE_CONTEXT_TRIGGERED:"commentUpdateContextTriggered",COMMENT_UPDATE_CONTEXT_SUCCESS:"commentUpdateContextSuccess",COMMENT_UPDATE_CONTEXT_FAILED:"commentUpdateContextFailed",COMMENT_ADDED:"commentAdded",COMMENT_READ:"commentRead",COMMENT_STATUS_CHANGED:"commentStatusChanged",COMMENT_PRIORITY_CHANGED:"commentPriorityChanged",COMMENT_CUSTOM_CHIPS_CHANGED:"commentCustomChipsChanged",COMMENT_APPROVED:"commentApproved",COMMENT_ACCEPTED:"commentAccepted",COMMENT_REJECTED:"commentRejected",COMMENT_ASSIGNED:"commentAssigned",COMMENT_DELETE_TRIGGERED:"commentDeleteTriggered",COMMENT_DELETED:"commentDeleted",COMMENT_THREAD_DELETED:"commentThreadDeleted",COMMENT_LINK_COPIED:"commentLinkCopied",COMMENT_EDIT_BUTTON_CLICKED:"commentEditButtonClicked",COMMENT_EDITED:"commentEdited",COMMENT_SIDEBAR_OPENED:"commentSidebarOpened",COMMENT_SIDEBAR_CLOSED:"commentSidebarClosed",COMMENT_SIDEBAR_TOGGLED:"commentSidebarToggled",COMMENT_TAG_BUTTON_CLICKED:"commentTagButtonClicked",COMMENT_TAG_ADDED:"commentTagAdded",COMMENT_PIN_DRAGGED:"commentPinDragged",COMMENT_ADD_MODE_ENABLED:"commentAddModeEnabled",COMMENT_ADD_MODE_DISABLED:"commentAddModeDisabled",COMMENT_TEXT_MODE_ENABLED:"commentTextModeEnabled",COMMENT_TEXT_MODE_DISABLED:"commentTextModeDisabled",COMMENT_POPOVER_MODE_ENABLED:"commentPopoverModeEnabled",COMMENT_POPOVER_MODE_DISABLED:"commentPopoverModeDisabled",COMMENT_STREAM_MODE_ENABLED:"commentStreamModeEnabled",COMMENT_STREAM_MODE_DISABLED:"commentStreamModeDisabled",COMMENT_SIDEBAR_EMBED_MODE_ENABLED:"commentSidebarEmbedModeEnabled",COMMENT_SIDEBAR_FLOATING_MODE_ENABLED:"commentSidebarFloatingModeEnabled",COMMENT_ATTACHMENT_SET_ALLOWED_FILE_TYPES_TRIGGERED:"commentAttachmentSetAllowedFileTypesTriggered",ENABLE_FORCE_CLOSE_ALL_ON_ESC_TRIGGERED:"enableForceCloseAllOnEscTriggered",DISABLE_FORCE_CLOSE_ALL_ON_ESC_TRIGGERED:"disableForceCloseAllOnEscTriggered",COMMENT_ATTACHMENT_BUTTON_CLICKED:"commentAttachmentButtonClicked",COMMENT_ATTACHMENT_ADDED:"commentAttachmentAdded",COMMENT_ATTACHMENT_DOWNLOADED:"commentAttachmentDownloaded",COMMENT_ATTACHMENT_DELETED:"commentAttachmentDeleted",COMMENT_ATTACHMENT_SIZE_EXCEEDED:"commentAttachmentSizeExceeded",COMMENT_SUBMIT_TRIGGERED:"commentSubmitTriggered",COMMENT_APPROVE_BUTTON_CLICKED:"commentApproveButtonClicked",COMMENT_ACCEPT_BUTTON_CLICKED:"commentAcceptButtonClicked",COMMENT_REJECT_BUTTON_CLICKED:"commentRejectButtonClicked",SUGGESTION_ACCEPTED:"suggestionAccepted",SUGGESTION_REJECTED:"suggestionRejected",COMMENT_SIGN_IN_BUTTON_CLICKED:"commentSignInButtonClicked",COMMENT_UPGRADE_BUTTON_CLICKED:"commentUpgradeButtonClicked",COMMENT_RECORDING_TOOL_CLICKED:"commentRecordingToolClicked",COMMENT_RECORDING_ADDED:"commentRecordingAdded",COMMENT_RECORDING_DELETED:"commentRecordingDeleted",COMMENT_MORE_REPLY_OPTION_CLICKED:"commentMoreReplyOptionClicked",COMMENT_PRIVATE_COMMENT_MODE_ENABLED:"commentPrivateCommentModeEnabled",COMMENT_PRIVATE_COMMENT_MODE_DISABLED:"commentPrivateCommentModeDisabled",COMMENT_ACCESS_MODE_CHANGED:"commentAccessModeChanged",SET_COMPOSER_FILE_ATTACHMENTS_TRIGGERED:"setComposerFileAttachmentsTriggered",GET_ALL_COMMENT_ANNOTATIONS_TRIGGERED_INTERNAL:"getAllCommentAnnotationsTriggered_internal",GET_ALL_COMMENT_ANNOTATIONS_TRIGGERED:"getAllCommentAnnotationsTriggered",DELETE_SELECTED_COMMENT_TRIGGERED:"deleteSelectedCommentTriggered",ENABLE_TEXT_COMMENTS_TRIGGERED:"enableTextCommentsTriggered",DISABLE_TEXT_COMMENTS_TRIGGERED:"disableTextCommentsTriggered",ALLOWED_ELEMENT_IDS_TRIGGERED:"allowedElementIdsTriggered",ALLOWED_ELEMENT_CLASS_NAMES_TRIGGERED:"allowedElementClassNamesTriggered",ALLOWED_ELEMENT_QUERY_SELECTORS_TRIGGERED:"allowedElementQuerySelectorsTriggered",ENABLE_FLOATING_COMMENT_DIALOG_TRIGGERED:"enableFloatingCommentDialogTriggered",DISABLE_FLOATING_COMMENT_DIALOG_TRIGGERED:"disableFloatingCommentDialogTriggered",ATTACH_COMMENT_TRIGGERED:"attachCommentTriggered",OPEN_COMMENT_SIDEBAR_TRIGGERED:"openCommentSidebarTriggered",CLOSE_COMMENT_SIDEBAR_TRIGGERED:"closeCommentSidebarTriggered",TOGGLE_COMMENT_SIDEBAR_TRIGGERED:"toggleCommentSidebarTriggered",SET_ASSIGN_TO_TYPE_TRIGGERED:"setAssignToTypeTriggered",ENABLE_CONTEXT_IN_PAGE_MODE_COMPOSER_TRIGGERED:"enableContextInPageModeComposerTriggered",DISABLE_CONTEXT_IN_PAGE_MODE_COMPOSER_TRIGGERED:"disableContextInPageModeComposerTriggered",CLEAR_PAGE_MODE_COMPOSER_CONTEXT_TRIGGERED:"clearPageModeComposerContextTriggered",SET_CONTEXT_IN_PAGE_MODE_COMPOSER_TRIGGERED:"setContextInPageModeComposerTriggered",FOCUS_PAGE_MODE_COMPOSER_TRIGGERED:"focusPageModeComposerTriggered",ENABLE_MODERATOR_MODE_TRIGGERED:"enableModeratorModeTriggered",DISABLE_MODERATOR_MODE_TRIGGERED:"disableModeratorModeTriggered",ENABLE_STREAM_MODE_TRIGGERED:"enableStreamModeTriggered",DISABLE_STREAM_MODE_TRIGGERED:"disableStreamModeTriggered",ENABLE_SIGN_IN_BUTTON_TRIGGERED:"enableSignInButtonTriggered",DISABLE_SIGN_IN_BUTTON_TRIGGERED:"disableSignInButtonTriggered",ENABLE_UPGRADE_BUTTON_TRIGGERED:"enableUpgradeButtonTriggered",DISABLE_UPGRADE_BUTTON_TRIGGERED:"disableUpgradeButtonTriggered",ON_COMMENT_MODE_CHANGE_TRIGGERED:"onCommentModeChangeTriggered",ENABLE_ATTACHMENTS_TRIGGERED:"enableAttachmentsTriggered",DISABLE_ATTACHMENTS_TRIGGERED:"disableAttachmentsTriggered",ENABLE_ATTACHMENT_DOWNLOAD_TRIGGERED:"enableAttachmentDownloadTriggered",DISABLE_ATTACHMENT_DOWNLOAD_TRIGGERED:"disableAttachmentDownloadTriggered",IS_USER_GLOBAL_CONTACT_TRIGGERED:"isUserGlobalContactTriggered",ENABLE_DEVICE_INFO_TRIGGERED:"enableDeviceInfoTriggered",DISABLE_DEVICE_INFO_TRIGGERED:"disableDeviceInfoTriggered",ENABLE_COMMENT_MODE_TRIGGERED:"enableCommentModeTriggered",DISABLE_COMMENT_MODE_TRIGGERED:"disableCommentModeTriggered",ENABLE_PERSISTENT_COMMENT_MODE_TRIGGERED:"enablePersistentCommentModeTriggered",DISABLE_PERSISTENT_COMMENT_MODE_TRIGGERED:"disablePersistentCommentModeTriggered",SHOW_COMMENT_INDEX_TRIGGERED:"showCommentIndexTriggered",ENABLE_COMMENT_INDEX_TRIGGERED:"enableCommentIndexTriggered",DISABLE_COMMENT_INDEX_TRIGGERED:"disableCommentIndexTriggered",ENABLE_POPOVER_MODE_TRIGGERED:"enablePopoverModeTriggered",DISABLE_POPOVER_MODE_TRIGGERED:"disablePopoverModeTriggered",ENABLE_POPOVER_TRIANGLE_COMPONENT_TRIGGERED:"enablePopoverTriangleComponentTriggered",DISABLE_POPOVER_TRIANGLE_COMPONENT_TRIGGERED:"disablePopoverTriangleComponentTriggered",ENABLE_DIALOG_ON_HOVER_TRIGGERED:"enableDialogOnHoverTriggered",DISABLE_DIALOG_ON_HOVER_TRIGGERED:"disableDialogOnHoverTriggered",ENABLE_DIALOG_ON_TARGET_ELEMENT_CLICK_TRIGGERED:"enableDialogOnTargetElementClickTriggered",DISABLE_DIALOG_ON_TARGET_ELEMENT_CLICK_TRIGGERED:"disableDialogOnTargetElementClickTriggered",ENABLE_PRIORITY_TRIGGERED:"enablePriorityTriggered",DISABLE_PRIORITY_TRIGGERED:"disablePriorityTriggered",ENABLE_STATUS_TRIGGERED:"enableStatusTriggered",DISABLE_STATUS_TRIGGERED:"disableStatusTriggered",ENABLE_VISIBILITY_OPTIONS_TRIGGERED:"enableVisibilityOptionsTriggered",DISABLE_VISIBILITY_OPTIONS_TRIGGERED:"disableVisibilityOptionsTriggered",ENABLE_RESOLVE_BUTTON_TRIGGERED:"enableResolveButtonTriggered",DISABLE_RESOLVE_BUTTON_TRIGGERED:"disableResolveButtonTriggered",ENABLE_GHOST_COMMENTS_TRIGGERED:"enableGhostCommentsTriggered",DISABLE_GHOST_COMMENTS_TRIGGERED:"disableGhostCommentsTriggered",ENABLE_GHOST_COMMENTS_INDICATOR_TRIGGERED:"enableGhostCommentsIndicatorTriggered",DISABLE_GHOST_COMMENTS_INDICATOR_TRIGGERED:"disableGhostCommentsIndicatorTriggered",SET_CUSTOM_STATUS_TRIGGERED:"setCustomStatusTriggered",SET_CUSTOM_PRIORITY_TRIGGERED:"setCustomPriorityTriggered",SET_CUSTOM_CATEGORY_TRIGGERED:"setCustomCategoryTriggered",ENABLE_INBOX_MODE_TRIGGERED:"enableInboxModeTriggered",DISABLE_INBOX_MODE_TRIGGERED:"disableInboxModeTriggered",ENABLE_AUTO_CATEGORIZE_TRIGGERED:"enableAutoCategorizeTriggered",DISABLE_AUTO_CATEGORIZE_TRIGGERED:"disableAutoCategorizeTriggered",ENABLE_DARK_MODE_TRIGGERED:"enableDarkModeTriggered",DISABLE_DARK_MODE_TRIGGERED:"disableDarkModeTriggered",SET_CONTEXT_PROVIDER_TRIGGERED:"setContextProviderTriggered",ENABLE_SUGGESTION_MODE_TRIGGERED:"enableSuggestionModeTriggered",DISABLE_SUGGESTION_MODE_TRIGGERED:"disableSuggestionModeTriggered",ENABLE_MOBILE_MODE_TRIGGERED:"enableMobileModeTriggered",DISABLE_MOBILE_MODE_TRIGGERED:"disableMobileModeTriggered",ENABLE_INLINE_COMMENT_MODE_TRIGGERED:"enableInlineCommentModeTriggered",DISABLE_INLINE_COMMENT_MODE_TRIGGERED:"disableInlineCommentModeTriggered",ENABLE_MINIMAP_TRIGGERED:"enableMinimapTriggered",DISABLE_MINIMAP_TRIGGERED:"disableMinimapTriggered",SHOW_COMMENTS_ON_DOM_TRIGGERED:"showCommentsOnDomTriggered",HIDE_COMMENTS_ON_DOM_TRIGGERED:"hideCommentsOnDomTriggered",ENABLE_COMMENT_TOOL_TRIGGERED:"enableCommentToolTriggered",DISABLE_COMMENT_TOOL_TRIGGERED:"disableCommentToolTriggered",SET_TOTAL_MEDIA_LENGTH_TRIGGERED:"setTotalMediaLengthTriggered",ON_COMMENT_ADD_TRIGGERED:"onCommentAddTriggered",ON_COMMENT_UPDATE_TRIGGERED:"onCommentUpdateTriggered",ADD_COMMENT_ON_SELECTED_TEXT_TRIGGERED:"addCommentOnSelectedTextTriggered",ENABLE_SIDEBAR_URL_NAVIGATION_TRIGGERED:"enableSidebarUrlNavigationTriggered",DISABLE_SIDEBAR_URL_NAVIGATION_TRIGGERED:"disableSidebarUrlNavigationTriggered",SET_D_STRATEGY_TRIGGERED:"setDStrategyTriggered",ENABLE_SIDEBAR_BUTTON_ON_COMMENT_DIALOG_TRIGGERED:"enableSidebarButtonOnCommentDialogTriggered",DISABLE_SIDEBAR_BUTTON_ON_COMMENT_DIALOG_TRIGGERED:"disableSidebarButtonOnCommentDialogTriggered",ON_SIDEBAR_BUTTON_ON_COMMENT_DIALOG_CLICK_TRIGGERED:"onSidebarButtonOnCommentDialogClickTriggered",ENABLE_REACTIONS_TRIGGERED:"enableReactionsTriggered",DISABLE_REACTIONS_TRIGGERED:"disableReactionsTriggered",ENABLE_ANONYMOUS_EMAIL_TRIGGERED:"enableAnonymousEmailTriggered",DISABLE_ANONYMOUS_EMAIL_TRIGGERED:"disableAnonymousEmailTriggered",SET_RECORDINGS_TRIGGERED:"setRecordingsTriggered",ADD_COMMENT_ON_ELEMENT_TRIGGERED:"addCommentOnElementTriggered",ENABLE_PRIVATE_COMMENT_MODE_TRIGGERED:"enablePrivateCommentModeTriggered",DISABLE_PRIVATE_COMMENT_MODE_TRIGGERED:"disablePrivateCommentModeTriggered",ENABLE_PRIVATE_MODE_TRIGGERED:"enablePrivateModeTriggered",DISABLE_PRIVATE_MODE_TRIGGERED:"disablePrivateModeTriggered",ENABLE_SCROLL_TO_COMMENT_TRIGGERED:"enableScrollToCommentTriggered",DISABLE_SCROLL_TO_COMMENT_TRIGGERED:"disableScrollToCommentTriggered",ENABLE_USER_MENTIONS_TRIGGERED:"enableUserMentionsTriggered",DISABLE_USER_MENTIONS_TRIGGERED:"disableUserMentionsTriggered",SET_COMMENT_SIDEBAR_FILTERS_TRIGGERED:"setCommentSidebarFiltersTriggered",SET_SYSTEM_FILTERS_OPERATOR_TRIGGERED:"setSystemFiltersOperatorTriggered",ENABLE_COMMENT_PIN_HIGHLIGHTER_TRIGGERED:"enableCommentPinHighlighterTriggered",DISABLE_COMMENT_PIN_HIGHLIGHTER_TRIGGERED:"disableCommentPinHighlighterTriggered",ENABLE_DELETE_ON_BACKSPACE_TRIGGERED:"enableDeleteOnBackspaceTriggered",DISABLE_DELETE_ON_BACKSPACE_TRIGGERED:"disableDeleteOnBackspaceTriggered",ENABLE_HOTKEY_TRIGGERED:"enableHotkeyTriggered",DISABLE_HOTKEY_TRIGGERED:"disableHotkeyTriggered",ENABLE_DEVICE_INDICATOR_ON_COMMENT_PINS_TRIGGERED:"enableDeviceIndicatorOnCommentPinsTriggered",DISABLE_DEVICE_INDICATOR_ON_COMMENT_PINS_TRIGGERED:"disableDeviceIndicatorOnCommentPinsTriggered",GET_ELEMENT_REF_BY_ANNOTATION_ID_TRIGGERED:"getElementRefByAnnotationIdTriggered",SCROLL_TO_COMMENT_BY_ANNOTATION_ID_TRIGGERED:"scrollToCommentByAnnotationIdTriggered",SELECT_COMMENT_BY_ANNOTATION_ID_TRIGGERED:"selectCommentByAnnotationIdTriggered",ENABLE_RECORDING_SUMMARY_TRIGGERED:"enableRecordingSummaryTriggered",DISABLE_RECORDING_SUMMARY_TRIGGERED:"disableRecordingSummaryTriggered",ENABLE_RECORDING_TRANSCRIPTION_TRIGGERED:"enableRecordingTranscriptionTriggered",DISABLE_RECORDING_TRANSCRIPTION_TRIGGERED:"disableRecordingTranscriptionTriggered",ENABLE_RECORDING_COUNTDOWN_TRIGGERED:"enableRecordingCountdownTriggered",DISABLE_RECORDING_COUNTDOWN_TRIGGERED:"disableRecordingCountdownTriggered",SET_UNREAD_INDICATOR_MODE_TRIGGERED:"setUnreadIndicatorModeTriggered",ENABLE_ENTER_KEY_TO_SUBMIT_TRIGGERED:"enableEnterKeyToSubmitTriggered",DISABLE_ENTER_KEY_TO_SUBMIT_TRIGGERED:"disableEnterKeyToSubmitTriggered",ENABLE_PIN_SHADOW_DOM_TRIGGERED:"enablePinShadowDOMTriggered",DISABLE_PIN_SHADOW_DOM_TRIGGERED:"disablePinShadowDOMTriggered",ENABLE_DIALOG_SHADOW_DOM_TRIGGERED:"enableDialogShadowDOMTriggered",DISABLE_DIALOG_SHADOW_DOM_TRIGGERED:"disableDialogShadowDOMTriggered",ENABLE_SIDEBAR_SHADOW_DOM_TRIGGERED:"enableSidebarShadowDOMTriggered",DISABLE_SIDEBAR_SHADOW_DOM_TRIGGERED:"disableSidebarShadowDOMTriggered",ENABLE_CHANGE_DETECTION_IN_COMMENT_MODE_TRIGGERED:"enableChangeDetectionInCommentModeTriggered",DISABLE_CHANGE_DETECTION_IN_COMMENT_MODE_TRIGGERED:"disableChangeDetectionInCommentModeTriggered",SHOW_RESOLVED_COMMENTS_ON_DOM_TRIGGERED:"showResolvedCommentsOnDomTriggered",HIDE_RESOLVED_COMMENTS_ON_DOM_TRIGGERED:"hideResolvedCommentsOnDomTriggered",SET_CUSTOM_REACTIONS_TRIGGERED:"setCustomReactionsTriggered",ON_COMMENT_SELECTION_CHANGE_TRIGGERED:"onCommentSelectionChangeTriggered",GET_UNREAD_COMMENT_COUNT_BY_ANNOTATION_ID_TRIGGERED:"getUnreadCommentCountByAnnotationIdTriggered",GET_UNREAD_COMMENT_ANNOTATION_COUNT_ON_CURRENT_DOCUMENT_TRIGGERED:"getUnreadCommentAnnotationCountOnCurrentDocumentTriggered",GET_UNREAD_COMMENT_COUNT_ON_CURRENT_DOCUMENT_TRIGGERED:"getUnreadCommentCountOnCurrentDocumentTriggered",GET_UNREAD_COMMENT_ANNOTATION_COUNT_BY_LOCATION_ID_TRIGGERED:"getUnreadCommentAnnotationCountByLocationIdTriggered",GET_UNREAD_COMMENT_COUNT_BY_LOCATION_ID_TRIGGERED:"getUnreadCommentCountByLocationIdTriggered",UPDATE_COMMENT_DIALOG_POSITION_TRIGGERED:"updateCommentDialogPositionTriggered",ENABLE_AREA_COMMENT_TRIGGERED:"enableAreaCommentTriggered",DISABLE_AREA_COMMENT_TRIGGERED:"disableAreaCommentTriggered",SET_PIN_CURSOR_IMAGE_TRIGGERED:"setPinCursorImageTriggered",ADD_MANUAL_COMMENT_TRIGGERED:"addManualCommentTriggered",CREATE_CUSTOM_LIST_DATA_ON_ANNOTATION_TRIGGERED:"createCustomListDataOnAnnotationTriggered",CREATE_CUSTOM_LIST_DATA_ON_COMMENT_TRIGGERED:"createCustomListDataOnCommentTriggered",EXCLUDE_LOCATION_IDS_FROM_SIDEBAR_TRIGGERED:"excludeLocationIdsFromSidebarTriggered",ENABLE_BUBBLE_ON_PIN_TRIGGERED:"enableBubbleOnPinTriggered",DISABLE_BUBBLE_ON_PIN_TRIGGERED:"disableBubbleOnPinTriggered",ENABLE_BUBBLE_ON_PIN_HOVER_TRIGGERED:"enableBubbleOnPinHoverTriggered",DISABLE_BUBBLE_ON_PIN_HOVER_TRIGGERED:"disableBubbleOnPinHoverTriggered",ENABLE_PIN_DRAG_TRIGGERED:"enablePinDragTriggered",DISABLE_PIN_DRAG_TRIGGERED:"disablePinDragTriggered",ENABLE_MULTI_THREAD_MODE_TRIGGERED:"enableMultiThreadModeTriggered",DISABLE_MULTI_THREAD_MODE_TRIGGERED:"disableMultiThreadModeTriggered",ENABLE_MULTI_THREAD_TRIGGERED:"enableMultiThreadTriggered",DISABLE_MULTI_THREAD_TRIGGERED:"disableMultiThreadTriggered",ENABLE_GROUP_MATCHED_COMMENTS_TRIGGERED:"enableGroupMatchedCommentsTriggered",DISABLE_GROUP_MATCHED_COMMENTS_TRIGGERED:"disableGroupMatchedCommentsTriggered",ENABLE_RESTRICT_TEXT_SEARCH_TO_ANCHOR_TRIGGERED:"enableRestrictTextSearchToAnchorTriggered",DISABLE_RESTRICT_TEXT_SEARCH_TO_ANCHOR_TRIGGERED:"disableRestrictTextSearchToAnchorTriggered",UPDATE_CONTEXT_TRIGGERED:"updateContextTriggered",UPDATE_VISIBILITY_TRIGGERED:"updateVisibilityTriggered",GET_SELECTED_COMMENTS_TRIGGERED:"getSelectedCommentsTriggered",ENABLE_DELETE_REPLY_CONFIRMATION_TRIGGERED:"enableDeleteReplyConfirmationTriggered",DISABLE_DELETE_REPLY_CONFIRMATION_TRIGGERED:"disableDeleteReplyConfirmationTriggered",ON_COPY_LINK_TRIGGERED:"onCopyLinkTriggered",GET_COMMENT_ANNOTATION_BY_ID_TRIGGERED:"getCommentAnnotationByIdTriggered",ENABLE_COLLAPSED_COMMENTS_TRIGGERED:"enableCollapsedCommentsTriggered",DISABLE_COLLAPSED_COMMENTS_TRIGGERED:"disableCollapsedCommentsTriggered",SET_COMMENT_SIDEBAR_DATA_TRIGGERED:"setCommentSidebarDataTriggered",ON_COMMENT_SIDEBAR_INIT_TRIGGERED:"onCommentSidebarInitTriggered",ON_COMMENT_SIDEBAR_DATA_TRIGGERED:"onCommentSidebarDataTriggered",SET_COMMENT_SIDEBAR_DEFAULT_CUSTOM_ACTIONS_TRIGGERED:"setCommentSidebarDefaultCustomActionsTriggered",ENABLE_SIDEBAR_CUSTOM_ACTIONS_TRIGGERED:"enableSidebarCustomActionsTriggered",DISABLE_SIDEBAR_CUSTOM_ACTIONS_TRIGGERED:"disableSidebarCustomActionsTriggered",ENABLE_QUERY_PARAMS_COMMENTS_TRIGGERED:"enableQueryParamsCommentsTriggered",DISABLE_QUERY_PARAMS_COMMENTS_TRIGGERED:"disableQueryParamsCommentsTriggered",ENABLE_RESOLVE_STATUS_ACCESS_ADMIN_ONLY_TRIGGERED:"enableResolveStatusAccessAdminOnlyTriggered",DISABLE_RESOLVE_STATUS_ACCESS_ADMIN_ONLY_TRIGGERED:"disableResolveStatusAccessAdminOnlyTriggered",ENABLE_LINK_CALLBACK_TRIGGERED:"enableLinkCallbackTriggered",DISABLE_LINK_CALLBACK_TRIGGERED:"disableLinkCallbackTriggered",ENABLE_SEEN_BY_USERS_TRIGGERED:"enableSeenByUsersTriggered",DISABLE_SEEN_BY_USERS_TRIGGERED:"disableSeenByUsersTriggered",ENABLE_SHORT_USER_NAME_TRIGGERED:"enableShortUserNameTriggered",DISABLE_SHORT_USER_NAME_TRIGGERED:"disableShortUserNameTriggered",ENABLE_READ_ONLY_TRIGGERED:"enableReadOnlyTriggered",DISABLE_READ_ONLY_TRIGGERED:"disableReadOnlyTriggered",ADD_COMMENT_ANNOTATION_TRIGGERED:"addCommentAnnotationTriggered",APPROVE_COMMENT_ANNOTATION_TRIGGERED:"approveCommentAnnotationTriggered",ACCEPT_COMMENT_ANNOTATION_TRIGGERED:"acceptCommentAnnotationTriggered",REJECT_COMMENT_ANNOTATION_TRIGGERED:"rejectCommentAnnotationTriggered",ACCEPT_SUGGESTION_TRIGGERED:"acceptSuggestionTriggered",REJECT_SUGGESTION_TRIGGERED:"rejectSuggestionTriggered",SUBSCRIBE_COMMENT_ANNOTATION_TRIGGERED:"subscribeCommentAnnotationTriggered",UNSUBSCRIBE_COMMENT_ANNOTATION_TRIGGERED:"unsubscribeCommentAnnotationTriggered",DELETE_COMMENT_ANNOTATION_TRIGGERED:"deleteCommentAnnotationTriggered",GET_COMMENT_ANNOTATIONS_TRIGGERED:"getCommentAnnotationsTriggered",GET_COMMENT_ANNOTATIONS_COUNT_TRIGGERED:"getCommentAnnotationsCountTriggered",ASSIGN_USER_TRIGGERED:"assignUserTriggered",UPDATE_PRIORITY_TRIGGERED:"updatePriorityTriggered",UPDATE_STATUS_TRIGGERED:"updateStatusTriggered",UPDATE_ACCESS_TRIGGERED:"updateAccessTriggered",RESOLVE_COMMENT_ANNOTATION_TRIGGERED:"resolveCommentAnnotationTriggered",GET_LINK_TRIGGERED:"getLinkTriggered",COPY_LINK_TRIGGERED:"copyLinkTriggered",ADD_COMMENT_TRIGGERED:"addCommentTriggered",UPDATE_COMMENT_TRIGGERED:"updateCommentTriggered",DELETE_COMMENT_TRIGGERED:"deleteCommentTriggered",GET_COMMENT_TRIGGERED:"getCommentTriggered",MARK_AS_READ_TRIGGERED:"markAsReadTriggered",MARK_AS_UNREAD_TRIGGERED:"markAsUnreadTriggered",ENABLE_SCREENSHOT_TRIGGERED:"enableScreenshotTriggered",DISABLE_SCREENSHOT_TRIGGERED:"disableScreenshotTriggered",ENABLE_PAGINATED_CONTACT_LIST_TRIGGERED:"enablePaginatedContactListTriggered",DISABLE_PAGINATED_CONTACT_LIST_TRIGGERED:"disablePaginatedContactListTriggered",SUBMIT_COMMENT_TRIGGERED:"submitCommentTriggered",CLEAR_COMPOSER_TRIGGERED:"clearComposerTriggered",GET_COMPOSER_DATA_TRIGGERED:"getComposerDataTriggered",ENABLE_FORMAT_OPTIONS_TRIGGERED:"enableFormatOptionsTriggered",DISABLE_FORMAT_OPTIONS_TRIGGERED:"disableFormatOptionsTriggered",SET_FORMAT_CONFIG_TRIGGERED:"setFormatConfigTriggered",ADD_ATTACHMENT_TRIGGERED:"addAttachmentTriggered",DELETE_ATTACHMENT_TRIGGERED:"deleteAttachmentTriggered",GET_ATTACHMENT_TRIGGERED:"getAttachmentTriggered",DELETE_RECORDING_TRIGGERED:"deleteRecordingTriggered",GET_RECORDING_TRIGGERED:"getRecordingTriggered",REACTION_ADDED:"reactionAdded",REACTION_DELETED:"reactionDeleted",ADD_REACTION_TRIGGERED:"addReactionTriggered",DELETE_REACTION_TRIGGERED:"deleteReactionTriggered",TOGGLE_REACTION_TRIGGERED:"toggleReactionTriggered",ENABLE_CUSTOM_AUTOCOMPLETE_SEARCH_TRIGGERED:"enableCustomAutocompleteSearchTriggered",DISABLE_CUSTOM_AUTOCOMPLETE_SEARCH_TRIGGERED:"disableCustomAutocompleteSearchTriggered",FETCH_COMMENT_ANNOTATIONS_TRIGGERED:"fetchCommentAnnotationsTriggered",SET_TRANSFORM_CONTEXT_TRIGGERED:"setTransformContextTriggered",ENABLE_SVG_AS_IMG_TRIGGERED:"enableSvgAsImgTriggered",DISABLE_SVG_AS_IMG_TRIGGERED:"disableSvgAsImgTriggered",ENABLE_FULL_EXPANDED_TRIGGERED:"enableFullExpandedTriggered",DISABLE_FULL_EXPANDED_TRIGGERED:"disableFullExpandedTriggered",ENABLE_COMMENT_TO_NEAREST_ALLOWED_ELEMENT_TRIGGERED:"enableCommentToNearestAllowedElementTriggered",DISABLE_COMMENT_TO_NEAREST_ALLOWED_ELEMENT_TRIGGERED:"disableCommentToNearestAllowedElementTriggered",ENABLE_DRAFT_MODE_TRIGGERED:"enableDraftModeTriggered",DISABLE_DRAFT_MODE_TRIGGERED:"disableDraftModeTriggered",ENABLE_DRAFT_CONFIRMATION_TRIGGERED:"enableDraftConfirmationTriggered",DISABLE_DRAFT_CONFIRMATION_TRIGGERED:"disableDraftConfirmationTriggered",ENABLE_ID_SCOPED_ANCHORING_TRIGGERED:"enableIdScopedAnchoringTriggered",DISABLE_ID_SCOPED_ANCHORING_TRIGGERED:"disableIdScopedAnchoringTriggered",ENABLE_FILTER_COMMENTS_ON_DOM_TRIGGERED:"enableFilterCommentsOnDomTriggered",DISABLE_FILTER_COMMENTS_ON_DOM_TRIGGERED:"disableFilterCommentsOnDomTriggered",ENABLE_REPLY_AVATARS_TRIGGERED:"enableReplyAvatarsTriggered",DISABLE_REPLY_AVATARS_TRIGGERED:"disableReplyAvatarsTriggered",SET_MAX_REPLY_AVATARS_TRIGGERED:"setMaxReplyAvatarsTriggered",SET_SIDEBAR_BUTTON_COUNT_TYPE_TRIGGERED:"setSidebarButtonCountTypeTriggered",ENABLE_FILTER_GHOST_COMMENTS_IN_SIDEBAR_TRIGGERED:"enableFilterGhostCommentsInSidebarTriggered",DISABLE_FILTER_GHOST_COMMENTS_IN_SIDEBAR_TRIGGERED:"disableFilterGhostCommentsInSidebarTriggered",ENABLE_FULL_SCREEN_IN_SIDEBAR_TRIGGERED:"enableFullScreenInSidebarTriggered",DISABLE_FULL_SCREEN_IN_SIDEBAR_TRIGGERED:"disableFullScreenInSidebarTriggered"},Recording:{RECORDING_TOOL_CLICKED:"recordingToolClicked",RECORDING_ADDED:"recordingAdded",RECORDING_PANEL_SAVE_BUTTON_CLICKED:"recordingPanelSaveButtonClicked",RECORDING_PANEL_CANCEL_BUTTON_CLICKED:"recordingPanelCancelButtonClicked",RECORDING_PANEL_PAUSE_BUTTON_CLICKED:"recordingPanelPauseButtonClicked",RECORDING_PANEL_RESUME_BUTTON_CLICKED:"recordingPanelResumeButtonClicked",RECORDING_PANEL_VIDEO_ON_BUTTON_CLICKED:"recordingPanelVideoOnButtonClicked",RECORDING_PANEL_VIDEO_OFF_BUTTON_CLICKED:"recordingPanelVideoOffButtonClicked",RECORDING_PANEL_AUDIO_ON_BUTTON_CLICKED:"recordingPanelAudioOnButtonClicked",RECORDING_PANEL_AUDIO_OFF_BUTTON_CLICKED:"recordingPanelAudioOffButtonClicked",RECORDING_PANEL_START_BUTTON_CLICKED:"recordingPanelStartButtonClicked",RECORDING_PANEL_PIP_BUTTON_CLICKED:"recordingPanelPipButtonClicked",RECORDING_PLAYED:"recordingPlayed",RECORDING_PAUSED:"recordingPaused",RECORDING_DELETE_TRIGGERED:"recordingDeleteTriggered",RECORDING_DELETED:"recordingDeleted",RECORDING_DRAGGED:"recordingDragged",RECORDING_DRAFT_DRAGGED:"recordingDraftDragged",TRANSCRIPTION_CLICKED:"transcriptionClicked",SUBTITLES_CLICKED:"subtitlesClicked",VIEW_TRANSCRIPTION_SUMMARY_CLICKED:"viewTranscriptionSummaryClicked",TRANSCRIPTION_SUMMARY_COPIED:"transcriptionSummaryCopied",TRANSCRIPTION_TIMESTAMP_CLICKED:"transcriptionTimestampClicked",TRANSCRIPTION_PANEL_DRAGGED:"transcriptionPanelDragged",SUBTITLES_PANEL_DRAGGED:"subtitlesPanelDragged",ENABLE_PLAYBACK_ON_PREVIEW_CLICK_TRIGGERED:"enablePlaybackOnPreviewClickTriggered",DISABLE_PLAYBACK_ON_PREVIEW_CLICK_TRIGGERED:"disablePlaybackOnPreviewClickTriggered",REQUEST_SCREEN_PERMISSION_TRIGGERED:"requestScreenPermissionTriggered",INIT_RECORDING_TRIGGERED:"initRecordingTriggered",ON_RECORDED_DATA_TRIGGERED:"onRecordedDataTriggered",ENABLE_DARK_MODE_TRIGGERED:"enableDarkModeTriggered",DISABLE_DARK_MODE_TRIGGERED:"disableDarkModeTriggered",ENABLE_RECORDING_COUNTDOWN_TRIGGERED:"enableRecordingCountdownTriggered",DISABLE_RECORDING_COUNTDOWN_TRIGGERED:"disableRecordingCountdownTriggered",GET_RECORDING_DATA_BY_RECORDER_ID_TRIGGERED:"getRecordingDataByRecorderIdTriggered",GET_RECORDINGS_TRIGGERED:"getRecordingsTriggered",ENABLE_RECORDING_TRANSCRIPTION_TRIGGERED:"enableRecordingTranscriptionTriggered",DISABLE_RECORDING_TRANSCRIPTION_TRIGGERED:"disableRecordingTranscriptionTriggered",GET_RECORDING_DATA_TRIGGERED:"getRecordingDataTriggered",FETCH_RECORDINGS_TRIGGERED:"fetchRecordingsTriggered",DELETE_RECORDING_TRIGGERED:"deleteRecordingTriggered",ENABLE_VIDEO_EDITOR_TRIGGERED:"enableVideoEditorTriggered",DISABLE_VIDEO_EDITOR_TRIGGERED:"disableVideoEditorTriggered",SET_RECORDING_QUALITY_CONSTRAINTS_TRIGGERED:"setRecordingQualityConstraintsTriggered",SET_RECORDING_ENCODING_OPTIONS_TRIGGERED:"setRecordingEncodingOptionsTriggered",DOWNLOAD_LATEST_VIDEO_TRIGGERED:"downloadLatestVideoTriggered",ENABLE_RECORDING_MIC_TRIGGERED:"enableRecordingMicTriggered",DISABLE_RECORDING_MIC_TRIGGERED:"disableRecordingMicTriggered",ENABLE_RETAKE_ON_VIDEO_EDITOR_TRIGGERED:"enableRetakeOnVideoEditorTriggered",DISABLE_RETAKE_ON_VIDEO_EDITOR_TRIGGERED:"disableRetakeOnVideoEditorTriggered",ASK_DEVICE_PERMISSION_TRIGGERED:"askDevicePermissionTriggered",ENABLE_ONBOARDING_TOOLTIP_TRIGGERED:"enableOnboardingTooltipTriggered",DISABLE_ONBOARDING_TOOLTIP_TRIGGERED:"disableOnboardingTooltipTriggered",SET_MAX_LENGTH_TRIGGERED:"setMaxLengthTriggered",OPEN_PICTURE_IN_PICTURE_TRIGGERED:"openPictureInPictureTriggered",EXIT_PICTURE_IN_PICTURE_TRIGGERED:"exitPictureInPictureTriggered",ENABLE_PICTURE_IN_PICTURE_TRIGGERED:"enablePictureInPictureTriggered",DISABLE_PICTURE_IN_PICTURE_TRIGGERED:"disablePictureInPictureTriggered"},Huddle:{HUDDLE_TOOL_CLICKED:"huddleToolClicked",HUDDLE_CREATED:"huddleCreated",HUDDLE_JOIN_BUTTON_CLICKED:"huddleJoinButtonClicked",HUDDLE_JOINED:"huddleJoined",HUDDLE_LEFT:"huddleLeft",HUDDLE_AUDIO_BUTTON_CLICKED:"huddleAudioButtonClicked",HUDDLE_AUDIO_MUTED:"huddleAudioMuted",HUDDLE_AUDIO_UNMUTED:"huddleAudioUnmuted",HUDDLE_VIDEO_BUTTON_CLICKED:"huddleVideoButtonClicked",HUDDLE_VIDEO_TURNED_ON:"huddleVideoTurnedOn",HUDDLE_VIDEO_TURNED_OFF:"huddleVideoTurnedOff",HUDDLE_SCREENSHARING_BUTTON_CLICKED:"huddleScreensharingButtonClicked",HUDDLE_SCREENSHARING_STARTED:"huddleScreensharingStarted",HUDDLE_SCREENSHARING_STOPPED:"huddleScreensharingStopped",ENABLE_HUDDLE_ON_CURSOR_MODE_TRIGGERED:"enableHuddleOnCursorModeTriggered",DISABLE_HUDDLE_ON_CURSOR_MODE_TRIGGERED:"disableHuddleOnCursorModeTriggered",ENABLE_CHAT_TRIGGERED:"enableChatTriggered",DISABLE_CHAT_TRIGGERED:"disableChatTriggered",ENABLE_FLOCK_MODE_ON_AVATAR_CLICK_TRIGGERED:"enableFlockModeOnAvatarClickTriggered",DISABLE_FLOCK_MODE_ON_AVATAR_CLICK_TRIGGERED:"disableFlockModeOnAvatarClickTriggered"},Presence:{PRESENCE_MULTIPLE_USERS_DETECTED:"presenceMultipleUsersDetected",PRESENCE_USER_STATUS_CHANGED:"presenceUserStatusChanged",PRESENCE_USER_CLICKED:"presenceUserClicked",PRESENCE_SET_CUSTOM_INACTIVITY_TIMER:"presenceSetCustomInactivityTimer",PRESENCE_SET_CUSTOM_OFFLINE_INACTIVITY_TIMER:"presenceSetCustomOfflineInactivityTimer",PRESENCE_SET_CUSTOM_MAX_USERS:"presenceSetCustomMaxUsers",MULTIPLE_USERS_ONLINE:"multipleUsersOnline",ON_USER_STATE_CHANGE:"onUserStateChange",GET_PRESENCE_DATA_TRIGGERED:"getPresenceDataTriggered",GET_ONLINE_USERS_ON_CURRENT_DOCUMENT_TRIGGERED:"getOnlineUsersOnCurrentDocumentTriggered",SET_INACTIVITY_TIME_TRIGGERED:"setInactivityTimeTriggered",ENABLE_FLOCK_MODE_TRIGGERED:"enableFlockModeTriggered",DISABLE_FLOCK_MODE_TRIGGERED:"disableFlockModeTriggered",START_FOLLOWING_USER_TRIGGERED:"startFollowingUserTriggered",STOP_FOLLOWING_USER_TRIGGERED:"stopFollowingUserTriggered",ENABLE_SELF_TRIGGERED:"enableSelfTriggered",DISABLE_SELF_TRIGGERED:"disableSelfTriggered",ADD_USER_TRIGGERED:"addUserTriggered",REMOVE_USER_TRIGGERED:"removeUserTriggered"},Cursor:{CURSOR_MULTIPLE_USERS_DETECTED:"cursorMultipleUsersDetected",CURSOR_SET_CUSTOM_INACTIVITY_TIMER:"cursorSetCustomInactivityTimer",GET_LIVE_CURSORS_ON_CURRENT_DOCUMENT_TRIGGERED:"getLiveCursorsOnCurrentDocumentTriggered",SET_INACTIVITY_TIME_TRIGGERED:"setInactivityTimeTriggered",ALLOWED_ELEMENT_IDS_TRIGGERED:"allowedElementIdsTriggered"},Selection:{SELECTION_CREATED_WHEN_MULTIPLE_USERS_DETECTED:"selectionCreatedWhenMultipleUsersDetected",SELECTION_SET_CUSTOM_INACTIVITY_TIMER:"selectionSetCustomInactivityTimer",ENABLE_LIVE_SELECTION_TRIGGERED:"enableLiveSelectionTriggered",DISABLE_LIVE_SELECTION_TRIGGERED:"disableLiveSelectionTriggered",ENABLE_USER_INDICATOR_TRIGGERED:"enableUserIndicatorTriggered",DISABLE_USER_INDICATOR_TRIGGERED:"disableUserIndicatorTriggered",SET_USER_INDICATOR_POSITION_TRIGGERED:"setUserIndicatorPositionTriggered",SET_USER_INDICATOR_TYPE_TRIGGERED:"setUserIndicatorTypeTriggered",ENABLE_DEFAULT_ELEMENTS_TRACKING_TRIGGERED:"enableDefaultElementsTrackingTriggered",DISABLE_DEFAULT_ELEMENTS_TRACKING_TRIGGERED:"disableDefaultElementsTrackingTriggered",ENABLE_DEFAULT_STYLING_TRIGGERED:"enableDefaultStylingTriggered",DISABLE_DEFAULT_STYLING_TRIGGERED:"disableDefaultStylingTriggered",GET_LIVE_SELECTION_DATA_TRIGGERED:"getLiveSelectionDataTriggered",SET_INACTIVITY_TIME_TRIGGERED:"setInactivityTimeTriggered"},LiveStateSync:{SET_USER_AS_EDITOR_TRIGGERED:"setUserAsEditorTriggered",SET_USER_AS_EDITOR_ERROR:"setUserAsEditorError",REQUEST_EDITOR_ACCESS_TRIGGERED:"requestEditorAccessTriggered",ACCEPT_EDITOR_ACCESS_REQUEST_TRIGGERED:"acceptEditorAccessRequestTriggered",REJECT_EDITOR_ACCESS_REQUEST_TRIGGERED:"rejectEditorAccessRequestTriggered",CANCEL_EDITOR_ACCESS_REQUEST_TRIGGERED:"cancelEditorAccessRequestTriggered",EDIT_CURRENT_TAB_TRIGGERED:"editCurrentTabTriggered",SEM_ACCESS_REQUESTED:"semAccessRequested",SEM_ACCESS_REQUEST_CANCELED:"semAccessRequestCanceled",SEM_ACCESS_ACCEPTED:"semAccessAccepted",SEM_ACCESS_REJECTED:"semAccessRejected",SEM_EDITOR_ASSIGNED:"semEditorAssigned",SEM_VIEWER_ASSIGNED:"semViewerAssigned",SEM_EDITOR_ON_DIFFERENT_TAB_DETECTED:"semEditorOnDifferentTabDetected",SEM_MAKE_EDITOR_TRIGGERED:"semMakeEditorTriggered",SEM_MAKE_READER_TRIGGERED:"semMakeReaderTriggered",SEM_SINGLE_EDITOR_LIVE_STATE_DATA_STATS:"semSingleEditorLiveStateDataStats",SEM_SINGLE_EDITOR_LIVE_STATE_EMPTY_DATA_STATS:"semSingleEditorLiveStateEmptyDataStats",SEM_SINGLE_EDITOR_DETERMINE_EDITOR_STATUS:"semSingleEditorDetermineEditorStatus",SEM_SINGLE_EDITOR_LIVE_STATE_DATA_MISMATCH:"semSingleEditorLiveStateDataMismatch",SEM_SINGLE_EDITOR_DATA_MISMATCH_WITH_EXTERNAL:"semSingleEditorLiveStateDataMismatchWithExternal",SEM_USER_EDITOR_STATS:"semUserEditorStats",REMOVE_EDITOR_ACCESS:"removeEditorAccess",REMOVE_EDITOR_ACCESS_ERROR:"removeEditorAccessError",SEM_SINGLE_EDITOR_LIVE_STATE_DATA_ON_MAKE_EDITOR:"semSingleEditorLiveStateDataOnMakeEditor",SEM_SINGLE_EDITOR_LIVE_STATE_DATA_ON_MAKE_READER:"semSingleEditorLiveStateDataOnMakeReader",GET_LIVE_STATE_DATA_TRIGGERED:"getLiveStateDataTriggered",FETCH_LIVE_STATE_DATA_TRIGGERED:"fetchLiveStateDataTriggered",ENABLE_SINGLE_EDITOR_MODE_TRIGGERED:"enableSingleEditorModeTriggered",DISABLE_SINGLE_EDITOR_MODE_TRIGGERED:"disableSingleEditorModeTriggered",IS_USER_EDITOR_TRIGGERED:"isUserEditorTriggered",GET_EDITOR_TRIGGERED:"getEditorTriggered",RESET_USER_ACCESS_TRIGGERED:"resetUserAccessTriggered",SINGLE_EDITOR_MODE_CONTAINER_IDS_TRIGGERED:"singleEditorModeContainerIdsTriggered",ENABLE_AUTO_SYNC_STATE_TRIGGERED:"enableAutoSyncStateTriggered",DISABLE_AUTO_SYNC_STATE_TRIGGERED:"disableAutoSyncStateTriggered",IS_EDITOR_ACCESS_REQUESTED_TRIGGERED:"isEditorAccessRequestedTriggered",EDITOR_ACCESS_REQUESTED_BY_TRIGGERED:"editorAccessRequestedByTriggered",EDITOR_ACCESS_TRANSFER_ON_TIMEOUT_TRIGGERED:"editorAccessTransferOnTimeoutTriggered",SET_EDITOR_ACCESS_TIMEOUT_TRIGGERED:"setEditorAccessTimeoutTriggered",ENABLE_EDITOR_ACCESS_TRANSFER_ON_TIMEOUT_TRIGGERED:"enableEditorAccessTransferOnTimeoutTriggered",DISABLE_EDITOR_ACCESS_TRANSFER_ON_TIMEOUT_TRIGGERED:"disableEditorAccessTransferOnTimeoutTriggered",ENABLE_DEFAULT_SINGLE_EDITOR_UI_TRIGGERED:"enableDefaultSingleEditorUiTriggered",DISABLE_DEFAULT_SINGLE_EDITOR_UI_TRIGGERED:"disableDefaultSingleEditorUiTriggered",GET_EDITOR_ACCESS_TIMER_TRIGGERED:"getEditorAccessTimerTriggered",ON_SERVER_CONNECTION_STATE_CHANGE_TRIGGERED:"onServerConnectionStateChangeTriggered",UPDATE_USER_PRESENCE_TRIGGERED:"updateUserPresenceTriggered",ENABLE_HEARTBEAT_TRIGGERED:"enableHeartbeatTriggered",DISABLE_HEARTBEAT_TRIGGERED:"disableHeartbeatTriggered"},Tag:{TAG_TOOL_CLICKED:"tagToolClicked",TAG_DRAFT_ADDED:"tagDraftAdded",TAG_ADDED:"tagAdded",TAG_READ:"tagRead",TAG_RESOLVED:"tagResolved",TAG_DRAGGED:"tagDragged",TAG_LINK_COPIED:"tagLinkCopied",TAG_ADD_MODE_ENABLED:"tagAddModeEnabled",TAG_ADD_MODE_DISABLED:"tagAddModeDisabled",TAG_DELETE_TRIGGERED:"tagDeleteTriggered",TAG_DELETED:"tagDeleted",GET_ALL_TAG_ANNOTATIONS_TRIGGERED:"getAllTagAnnotationsTriggered",DELETE_TAG_TRIGGERED:"deleteTagTriggered",ALLOWED_ELEMENT_IDS_TRIGGERED:"allowedElementIdsTriggered",ATTACH_TAG_TRIGGERED:"attachTagTriggered",ADD_TAG_MODE_CHANGE_TRIGGERED:"addTagModeChangeTriggered"},Rewriter:{REWRITER_ENABLED:"rewriterEnabled",REWRITER_MIN_CHARACTER_NOT_MET:"rewriterMinCharacterNotMet",REWRITER_MAX_CHARACTER_NOT_MET:"rewriterMaxCharacterNotMet",REWRITE_BUTTON_CLICKED:"rewriteButtonClicked",REWRITE_PROMPT_BUTTON_CLICKED:"rewritePromptButtonClicked",REWRITE_REFRESH_BUTTON_CLICKED:"rewriteRefreshButtonClicked",REWRITE_OPTION_SELECTED:"rewriteOptionSelected",REWRITE_TASK_CREATED:"rewriteTaskCreated",REWRITE_DIALOG_DRAGGED:"rewriteDialogDragged",REWRITE_SHOW_ORIGINAL_TEXT_CLICKED:"rewriteShowOriginalTextClicked",REWRITE_CLOSE_BUTTON_CLICKED:"rewriteCloseButtonClicked",REWRITE_PROMPT_SUBMITTED:"rewritePromptSubmitted",ENABLE_REWRITER_TRIGGERED:"enableRewriterTriggered",DISABLE_REWRITER_TRIGGERED:"disableRewriterTriggered",ON_TEXT_SELECTED_SUBSCRIBED:"onTextSelectedSubscribed",ASK_AI_TRIGGERED:"askAiTriggered",REPLACE_TEXT_TRIGGERED:"replaceTextTriggered",ADD_COMMENT_FROM_AI_TRIGGERED:"addCommentFromAITriggered"},Feedback:{FEEDBACK_BUTTON_CLICKED:"feedbackButtonClicked",FEEDBACK_SUBMITTED:"feedbackSubmitted"},Contact:{UPDATE_CONTACT_LIST_TRIGGERED:"updateContactListTriggered",UPDATE_ORG_LIST_TRIGGERED:"updateOrgListTriggered",IS_USER_GLOBAL_CONTACT_TRIGGERED:"isUserGlobalContactTriggered",ON_CONTACT_SELECTED_TRIGGERED:"onContactSelectedTriggered",ENABLE_AT_HERE_TRIGGERED:"enableAtHereTriggered",DISABLE_AT_HERE_TRIGGERED:"disableAtHereTriggered",SET_AT_HERE_LABEL_TRIGGERED:"setAtHereLabelTriggered",SET_AT_HERE_DESCRIPTION_TRIGGERED:"setAtHereDescriptionTriggered",UPDATE_CONTACT_LIST_SCOPE_FOR_ORGANIZATION_USERS_TRIGGERED:"updateContactListScopeForOrganizationUsersTriggered",GET_CONTACT_LIST_TRIGGERED:"getContactListTriggered"},ContactUs:{CONTACT_BUTTON_CLICKED:"contactButtonClicked",CONTACT_SUBMITTED:"contactSubmitted"},Bug:{BUG_BUTTON_CLICKED:"bugButtonClicked",BUG_SUBMITTED:"bugSubmitted"},ShareDialog:{SHARE_BUTTON_CLICKED:"shareButtonClicked",DOCUMENT_ACCESS_CHANGED:"documentAccessChanged",DOCUMENT_USER_ACCESS_ADDED:"documentUserAccessAdded",DOCUMENT_USER_ACCESS_REMOVED:"documentUserAccessRemoved",SHARE_LINK_COPIED:"shareLinkCopied"},InviteDialog:{USER_INVITED:"userInvited",INVITE_LINK_COPIED:"inviteLinkCopied"},Iam:{USER_ACCESS_DENIED:"userAccessDenied"},Arrow:{ARROW_TOOL_CLICKED:"arrowToolClicked",ARROW_DRAFT_ADDED:"arrowDraftAdded",ARROW_ADDED:"arrowAdded",ARROW_READ:"arrowRead",ARROW_RESOLVED:"arrowResolved",ARROW_DRAGGED:"arrowDragged",ARROW_LINK_COPIED:"arrowLinkCopied",ARROW_ADD_MODE_ENABLED:"arrowAddModeEnabled",ARROW_ADD_MODE_DISABLED:"arrowAddModeDisabled",ARROW_DELETE_TRIGGERED:"arrowDeleteTriggered",ARROW_DELETED:"arrowDeleted",ALLOWED_ELEMENT_IDS_TRIGGERED:"allowedElementIdsTriggered"},Area:{AREA_TOOL_CLICKED:"areaToolClicked",AREA_ADDED:"areaAdded",AREA_DRAGGED:"areaDragged",AREA_LINK_COPIED:"areaLinkCopied",AREA_ADD_MODE_ENABLED:"areaAddModeEnabled",AREA_ADD_MODE_DISABLED:"areaAddModeDisabled",AREA_DELETE_TRIGGERED:"areaDeleteTriggered",AREA_DELETED:"areaDeleted",ENABLE_AREA_COMMENT_TRIGGERED:"enableAreaCommentTriggered",DISABLE_AREA_COMMENT_TRIGGERED:"disableAreaCommentTriggered"},Doc:{DOCUMENT_ID_SET_TRIGGERED:"documentIdSetTriggered",SET_DOCUMENTS_SUCCESS:"setDocumentsSuccess",SET_LOCATIONS_SUCCESS:"setLocationsSuccess",REMOVE_LOCATIONS_SUCCESS:"removeLocationsSuccess",UNSET_LOCATIONS_SUCCESS:"unsetLocationsSuccess",DOCUMENT_SET_TRIGGERED:"documentSetTriggered",UNSET_DOCUMENTS_TRIGGERED:"unsetDocumentsTriggered",UNSET_DOCUMENTS_SUCCESS:"unsetDocumentsSuccess",DOCUMENTS_SET_TRIGGERED:"documentsSetTriggered",GET_DOCUMENT_METADATA_TRIGGERED:"getDocumentMetadataTriggered"},Reactions:{ENABLE_DARK_MODE_TRIGGERED:"enableDarkModeTriggered",DISABLE_DARK_MODE_TRIGGERED:"disableDarkModeTriggered",SET_CUSTOM_REACTIONS_TRIGGERED:"setCustomReactionsTriggered"},Views:{GET_UNIQUE_VIEWS_BY_USER_TRIGGERED:"getUniqueViewsByUserTriggered",GET_UNIQUE_VIEWS_BY_DATE_TRIGGERED:"getUniqueViewsByDateTriggered"},Notifications:{NOTIFICATION_HISTORY_PANEL_OPENED:"notificationHistoryPanelOpened",ENABLE_SETTINGS_AT_ORGANIZATION_LEVEL_TRIGGERED:"enableSettingsAtOrganizationLevelTriggered",DISABLE_SETTINGS_AT_ORGANIZATION_LEVEL_TRIGGERED:"disableSettingsAtOrganizationLevelTriggered",NOTIFICATION_HISTORY_PANEL_CLOSED:"notificationHistoryPanelClosed",NOTIFICATION_HISTORY_PANEL_TOGGLED:"notificationHistoryPanelToggled",NOTIFICATION_MARK_ALL_AS_READ_CLICKED:"notificationMarkAllAsReadClicked",NOTIFICATION_CLICKED:"notificationClicked",NOTIFICATION_TAB_CLICKED:"notificationTabClicked",NOTIFICATION_READ:"notificationRead",GET_NOTIFICATIONS_FOR_YOU$_TRIGGERED_INTERNAL:"getNotificationsForYou$Triggered_internal",GET_NOTIFICATIONS_BY_DOCUMENT_ID$_TRIGGERED_INTERNAL:"getNotificationsByDocumentId$Triggered_internal",GET_ALL_NOTIFICATIONS$_TRIGGERED_INTERNAL:"getAllNotifications$Triggered_internal",GET_NOTIFICATIONS$_TRIGGERED_INTERNAL:"getNotifications$Triggered_internal",OPEN_HISTORY_PANEL_TRIGGERED:"openHistoryPanelTriggered",CLOSE_HISTORY_PANEL_TRIGGERED:"closeHistoryPanelTriggered",TOGGLE_HISTORY_PANEL_TRIGGERED:"toggleHistoryPanelTriggered",GET_NOTIFICATIONS_DATA_TRIGGERED:"getNotificationsDataTriggered",SET_MAX_DAYS_TRIGGERED:"setMaxDaysTriggered",SET_TAB_CONFIG_TRIGGERED:"setTabConfigTriggered",ENABLE_READ_NOTIFICATIONS_ON_FOR_YOU_TAB_TRIGGERED:"enableReadNotificationsOnForYouTabTriggered",DISABLE_READ_NOTIFICATIONS_ON_FOR_YOU_TAB_TRIGGERED:"disableReadNotificationsOnForYouTabTriggered",SET_ALL_NOTIFICATIONS_AS_READ_TRIGGERED:"setAllNotificationsAsReadTriggered",GET_UNREAD_NOTIFICATIONS_COUNT_TRIGGERED:"getUnreadNotificationsCountTriggered",MARK_NOTIFICATION_AS_READ_BY_ID_TRIGGERED:"markNotificationAsReadByIdTriggered",SET_SETTINGS_TRIGGERED:"setSettingsTriggered",GET_SETTINGS_TRIGGERED:"getSettingsTriggered",MUTE_ALL_NOTIFICATIONS_TRIGGERED:"muteAllNotificationsTriggered",ENABLE_SETTINGS_TRIGGERED:"enableSettingsTriggered",ENABLE_SELF_NOTIFICATIONS_TRIGGERED:"enableSelfNotificationsTriggered",DISABLE_SELF_NOTIFICATIONS_TRIGGERED:"disableSelfNotificationsTriggered",ENABLE_USER_SCOPED_NOTIFICATIONS_TRIGGERED:"enableUserScopedNotificationsTriggered",DISABLE_USER_SCOPED_NOTIFICATIONS_TRIGGERED:"disableUserScopedNotificationsTriggered",DISABLE_SETTINGS_TRIGGERED:"disableSettingsTriggered",SET_SETTINGS_INITIAL_CONFIG_TRIGGERED:"setSettingsInitialConfigTriggered",OPEN_NOTIFICATIONS_PANEL_TRIGGERED:"openNotificationsPanelTriggered",CLOSE_NOTIFICATIONS_PANEL_TRIGGERED:"closeNotificationsPanelTriggered",ENABLE_CURRENT_DOCUMENT_ONLY_TRIGGERED:"enableCurrentDocumentOnlyTriggered",DISABLE_CURRENT_DOCUMENT_ONLY_TRIGGERED:"disableCurrentDocumentOnlyTriggered"},Crdt:{CRDT_DATA_UPDATED:"crdtDataUpdated"},Suggestions:{ENABLE_SUGGESTION_MODE_TRIGGERED:"suggestionsEnableSuggestionModeTriggered",DISABLE_SUGGESTION_MODE_TRIGGERED:"suggestionsDisableSuggestionModeTriggered",IS_SUGGESTION_MODE_ENABLED_TRIGGERED:"suggestionsIsSuggestionModeEnabledTriggered",IS_SUGGESTION_MODE_ENABLED_STREAM_TRIGGERED:"suggestionsIsSuggestionModeEnabledStreamTriggered",ENABLE_INLINE_SUGGESTIONS_TRIGGERED:"suggestionsEnableInlineSuggestionsTriggered",DISABLE_INLINE_SUGGESTIONS_TRIGGERED:"suggestionsDisableInlineSuggestionsTriggered",REGISTER_TARGET_TRIGGERED:"suggestionsRegisterTargetTriggered",UNREGISTER_TARGET_TRIGGERED:"suggestionsUnregisterTargetTriggered",START_SUGGESTION_TRIGGERED:"suggestionsStartSuggestionTriggered",COMMIT_SUGGESTION_TRIGGERED:"suggestionsCommitSuggestionTriggered",GET_SUGGESTIONS_TRIGGERED:"suggestionsGetSuggestionsTriggered",GET_SUGGESTIONS_STREAM_TRIGGERED:"suggestionsGetSuggestionsStreamTriggered",GET_PENDING_SUGGESTION_TRIGGERED:"suggestionsGetPendingSuggestionTriggered",GET_PENDING_SUGGESTION_STREAM_TRIGGERED:"suggestionsGetPendingSuggestionStreamTriggered",ON_TRIGGERED:"suggestionsOnTriggered"}};let t=e;return t})(),XU=[St.Events.Rewriter.REWRITER_ENABLED];var QU=class{constructor(){this.attachmentId=Math.floor(1e5+Math.random()*9e5)}};var aNe={ANNOTATION_ADD:"comment_annotation.add",ANNOTATION_DELETE:"comment_annotation.delete",COMMENT_ADD:"comment.add",COMMENT_UPDATE:"comment.update",COMMENT_DELETE:"comment.delete",STATUS_CHANGE:"comment_annotation.status_change",PRIORITY_CHANGE:"comment_annotation.priority_change",ASSIGN:"comment_annotation.assign",ACCESS_MODE_CHANGE:"comment_annotation.access_mode_change",CUSTOM_LIST_CHANGE:"comment_annotation.custom_list_change",APPROVE:"comment_annotation.approve",ACCEPT:"comment.accept",REJECT:"comment.reject",SUGGESTION_ACCEPT:"comment_annotation.suggestion_accept",SUGGESTION_REJECT:"comment_annotation.suggestion_reject",REACTION_ADD:"comment.reaction_add",REACTION_DELETE:"comment.reaction_delete",SUBSCRIBE:"comment_annotation.subscribe",UNSUBSCRIBE:"comment_annotation.unsubscribe"},cNe={RECORDING_ADD:"recording.add",RECORDING_DELETE:"recording.delete"},lNe={REACTION_ADD:"reaction.add",REACTION_DELETE:"reaction.delete"},uNe={EDITOR_EDIT:"crdt.editor_edit"};var sd=class{};var TR,OT=new Map,JU,LT=t=>t!=null?String(t):void 0,tQ=t=>{if(t.url)try{let e=new URL(t.url);t.baseUrl===void 0&&(t.baseUrl=e.origin),t.path===void 0&&(t.path=e.pathname),t.queryParams===void 0&&(t.queryParams=e.search)}catch{}},pNe=t=>{JU=t},gNe=(t,e)=>{try{if(!t||typeof t!="object")return;let n=JSON.parse(JSON.stringify(t));tQ(n);let r=LT(e);r?OT.set(r,n):TR=n}catch(n){O.catch("Error in setClientPageInfo: ",n)}},mNe=t=>{try{let e=LT(t);e?OT.delete(e):TR=void 0}catch(e){O.catch("Error in clearClientPageInfo: ",e)}},MT=t=>{try{let e=LT(t)??LT(JU?.());return e&&OT.has(e)?OT.get(e):TR}catch(e){O.catch("Error in getClientPageInfo: ",e);return}};var yR;try{yR=typeof Intl<"u"&&Intl.v8BreakIterator}catch{yR=!1}var ZU=(()=>{class t{_platformId=Q(Go);isBrowser=this._platformId?IU(this._platformId):typeof document=="object"&&!!document;EDGE=this.isBrowser&&/(edge)/i.test(navigator.userAgent);TRIDENT=this.isBrowser&&/(msie|trident)/i.test(navigator.userAgent);BLINK=this.isBrowser&&!!(window.chrome||yR)&&typeof CSS<"u"&&!this.EDGE&&!this.TRIDENT;WEBKIT=this.isBrowser&&/AppleWebKit/i.test(navigator.userAgent)&&!this.BLINK&&!this.EDGE&&!this.TRIDENT;IOS=this.isBrowser&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!("MSStream"in window);FIREFOX=this.isBrowser&&/(firefox|minefield)/i.test(navigator.userAgent);ANDROID=this.isBrowser&&/android/i.test(navigator.userAgent)&&!this.TRIDENT;SAFARI=this.isBrowser&&/safari/i.test(navigator.userAgent)&&this.WEBKIT;constructor(){}static \u0275fac=function(r){return new(r||t)};static \u0275prov=Z({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();function IR(t){return Array.isArray(t)?t:[t]}var eV=new Set,Bc,nV=(()=>{class t{_platform=Q(ZU);_nonce=Q(Zu,{optional:!0});_matchMedia;constructor(){this._matchMedia=this._platform.isBrowser&&window.matchMedia?window.matchMedia.bind(window):rQ}matchMedia(n){return(this._platform.WEBKIT||this._platform.BLINK)&&nQ(n,this._nonce),this._matchMedia(n)}static \u0275fac=function(r){return new(r||t)};static \u0275prov=Z({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();function nQ(t,e){if(!eV.has(t))try{Bc||(Bc=document.createElement("style"),e&&Bc.setAttribute("nonce",e),Bc.setAttribute("type","text/css"),document.head.appendChild(Bc)),Bc.sheet&&(Bc.sheet.insertRule(`@media ${t} {body{ }}`,0),eV.add(t))}catch(n){console.error(n)}}function rQ(t){return{matches:t==="all"||t==="",media:t,addListener:()=>{},removeListener:()=>{}}}var iQ=(()=>{class t{_mediaMatcher=Q(nV);_zone=Q(Re);_queries=new Map;_destroySubject=new Be;constructor(){}ngOnDestroy(){this._destroySubject.next(),this._destroySubject.complete()}isMatched(n){return tV(IR(n)).some(i=>this._registerQuery(i).mql.matches)}observe(n){let i=tV(IR(n)).map(s=>this._registerQuery(s).observable),o=sc(i);return o=ys(o.pipe(Tn(1)),o.pipe(fE(1),dE(0))),o.pipe(De(s=>{let a={matches:!1,breakpoints:{}};return s.forEach(({matches:c,query:l})=>{a.matches=a.matches||c,a.breakpoints[l]=c}),a}))}_registerQuery(n){if(this._queries.has(n))return this._queries.get(n);let r=this._mediaMatcher.matchMedia(n),o={observable:new he(s=>{let a=c=>this._zone.run(()=>s.next(c));return r.addListener(a),()=>{r.removeListener(a)}}).pipe(rn(r),De(({matches:s})=>({query:n,matches:s})),Is(this._destroySubject)),mql:r};return this._queries.set(n,o),o}static \u0275fac=function(r){return new(r||t)};static \u0275prov=Z({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();function tV(t){return t.map(e=>e.split(",")).reduce((e,n)=>e.concat(n)).map(e=>e.trim())}var lp={XSmall:"(max-width: 599.98px)",Small:"(min-width: 600px) and (max-width: 959.98px)",Medium:"(min-width: 960px) and (max-width: 1279.98px)",Large:"(min-width: 1280px) and (max-width: 1919.98px)",XLarge:"(min-width: 1920px)",Handset:"(max-width: 599.98px) and (orientation: portrait), (max-width: 959.98px) and (orientation: landscape)",Tablet:"(min-width: 600px) and (max-width: 839.98px) and (orientation: portrait), (min-width: 960px) and (max-width: 1279.98px) and (orientation: landscape)",Web:"(min-width: 840px) and (orientation: portrait), (min-width: 1280px) and (orientation: landscape)",HandsetPortrait:"(max-width: 599.98px) and (orientation: portrait)",TabletPortrait:"(min-width: 600px) and (max-width: 839.98px) and (orientation: portrait)",WebPortrait:"(min-width: 840px) and (orientation: portrait)",HandsetLandscape:"(max-width: 959.98px) and (orientation: landscape)",TabletLandscape:"(min-width: 960px) and (max-width: 1279.98px) and (orientation: landscape)",WebLandscape:"(min-width: 1280px) and (orientation: landscape)"};var Wr=(()=>{let e=class e{constructor(){try{this.userAgent=navigator.userAgent,this.browserName=this.getBrowserName(),this.browserVersion=this.getBrowserVersion(),this.deviceType=this.getDeviceType(),this.orientation=this.getOrientation(),this.osName=this.getOSName(),this.osVersion=this.getOSVersion(),this.screenWidth=this.getScreenWidth(),this.screenHeight=this.getScreenHeight()}catch{}}getBrowserName(){try{return(navigator.userAgent.indexOf("Opera")||navigator.userAgent.indexOf("OPR"))!=-1?"Opera":navigator.userAgent.indexOf("Chrome")!=-1?"Chrome":navigator.userAgent.indexOf("Safari")!=-1?"Safari":navigator.userAgent.indexOf("Firefox")!=-1?"Firefox":navigator.userAgent.indexOf("MSIE")!=-1||document?.documentMode?"IE":"Unknown"}catch{return"Unknown"}}getDeviceType(){try{return e.Breakpoints[lp.Handset]?Ir.MOBILE:e.Breakpoints[lp.Tablet]?Ir.TABLET:e.Breakpoints[lp.XLarge]?Ir.MONITOR:e.Breakpoints[lp.Web]?Ir.DESKTOP:Ir.UNKNOWN}catch{return Ir.UNKNOWN}}getOrientation(){try{return e.Orientations[AT.Portrait]?id.PORTRAIT:e.Orientations[AT.Landscape]?id.LANDSCAPE:id.UNKNOWN}catch{return id.UNKNOWN}}getOSName(){try{return navigator.userAgent.indexOf("Windows")!=-1?"Windows":navigator.userAgent.indexOf("Macintosh")!=-1?"Macintosh":navigator.userAgent.indexOf("Linux")!=-1?"Linux":"Unknown"}catch{return"Unknown"}}getOSVersion(){try{let s=navigator?.userAgent,a="Unknown";if(s.indexOf("Windows")!==-1)s.indexOf("Windows NT 5.1")!==-1?a="Windows XP":s.indexOf("Windows NT 6.0")!==-1?a="Windows Vista":s.indexOf("Windows NT 6.1")!==-1?a="Windows 7":s.indexOf("Windows NT 6.2")!==-1?a="Windows 8":s.indexOf("Windows NT 6.3")!==-1?a="Windows 8.1":s.indexOf("Windows NT 10.0")!==-1&&(a="Windows 10");else if(s.indexOf("Mac OS X")!==-1)a=s.match(/Mac OS X ([0-9_.]+)/)[1],a=a.replace(/_/g,".");else if(s.indexOf("iOS")!==-1)a=s.match(/OS ([0-9_.]+) like Mac OS X/)[1],a=a.replace(/_/g,".");else if(s.indexOf("Firefox")!==-1){var r=/\(([^)]+)\)/,i=r.exec(s)[1],o=i.split("; ");a=o[2]}return a||"Unknown"}catch{return"Unknown"}}getBrowserVersion(){try{return this.browserName=="Opera"?this.getOperaVersion():this.browserName=="Chrome"?this.getChromeVersion():this.browserName=="Safari"?this.getSafariVersion():this.browserName=="Firefox"?this.getFirefoxVersion():this.browserName=="IE"?this.getIEVersion():"Unknown"}catch{return"Unknown"}}getOperaVersion(){try{var r=navigator.userAgent.match(/(?:Opera|OPR)\/(\d+)/);return r?r[1]:"Unknown"}catch{return"Unknown"}}getChromeVersion(){try{var r=navigator.userAgent.match(/(?:Chrome|Chromium)\/(\d+)/);return r?r[1]:"Unknown"}catch{return"Unknown"}}getSafariVersion(){try{var r=navigator.userAgent.match(/Version\/(\d+)/);return r?r[1]:"Unknown"}catch{return"Unknown"}}getFirefoxVersion(){try{var r=navigator.userAgent.match(/Firefox\/(\d+)/);return r?r[1]:"Unknown"}catch{return"Unknown"}}getIEVersion(){try{var r=navigator.userAgent.match(/MSIE (\d+)/);return r?r[1]:"Unknown"}catch{return"Unknown"}}getScreenWidth(){try{return window.screen.width}catch{return 0}}getScreenHeight(){try{return window.screen.height}catch{return 0}}getDeviceInfo(){try{return this.userAgent=navigator.userAgent,this.browserName=this.getBrowserName(),this.browserVersion=this.getBrowserVersion(),this.deviceType=this.getDeviceType(),this.orientation=this.getOrientation(),this.osName=this.getOSName(),this.osVersion=this.getOSVersion(),this.screenWidth=this.getScreenWidth(),this.screenHeight=this.getScreenHeight(),JSON.parse(JSON.stringify(this))}catch{return{browserName:"Unknown",browserVersion:"Unknown",deviceType:"Unknown",osName:"Unknown",osVersion:"Unknown",screenWidth:0,screenHeight:0,userAgent:"Unknown"}}}};e.Breakpoints={},e.Orientations={};let t=e;return t})();var _t=class{constructor(e=!0){this.deviceInfo=new Wr().getDeviceInfo();try{if(e){let n=MT();n&&Object.assign(this,n)}}catch{}}};var rV=class{constructor(){this.targetElements=[],this.type="area",this.props=new sd,this.pageInfo=new _t,this.targetAnnotations=[]}};var iV=class{constructor(){this.type="arrow",this.props=new sd,this.pageInfo=new _t}};var WNe={COPY_LINK:"copy-link",DELETE:"delete"},zNe={COPY_LINK:"Copy link",LINK_COPIED:"Link copied!",DELETE_THREAD:"Delete thread"};var oV=class{constructor(){this.comments=[],this.commentCategories=[],this.type="comment",this.status=k.CommentAnnotationStatusMap.OPEN,this.pageInfo=new _t,this.iam=new vR,this.customList=[],this.subscribedUsers={},this.unsubscribedUsers={},this.subscribedGroups={}}};var vR=class{constructor(){this.accessMode=CT.PUBLIC}};var sV=class{constructor(){this.commentId=Math.floor(1e5+Math.random()*9e5),this.type="text",this.to=[],this.status="added",this.attachments=[],this.recorders=[],this.reactionAnnotationIds=[],this.taggedUserContacts=[],this.customList=[],this.toOrganizationUserGroup=[],this.reactionAnnotations=[]}};var PT=class{constructor(){this.urlAllowList=[],this.featureAllowList=[],this.userPlanAllowList=[],this.userIdAllowList=[],this.userGroupIdAllowList=[],this.debugMode=!1,this.usePrefersColorScheme=!1,this.advancedQueriesDisabled=!1,this.globalStyles=!0}},aV=["core","rest-api","recorder-media","ai","agents","huddle-webrtc","integrations-workflow","superflow","billing-stripe","migrations","legacy-v1","velt-internal"];var SR=(function(t){return t.RESOLVE_USERS="resolveUsers",t.FORMAT_RESPONSE="formatResponse",t.MERGE_USER_WITH_PROVIDED_USER_DATA="mergeUserWithProvidedUserData",t.GET_TEMPORARY_USERS="getTemporaryUsers",t.SET_SINGLE_EDITOR_MODE_LIVE_STATE_DATA_FOR_DIFFERENT_USER_PRESENT_ON_TAB="setSingleEditorModeLiveStateDataForDifferentUserPresentOnTab",t.RESOLVE_AND_MERGE_SINGLE_EDITOR_LIVE_STATE_DATA_WITH_USER="resolveAndMergeSingleEditorLiveStateDataWithUser",t.GET_SINGLE_EDITOR_MODE_DATA="getSingleEditorModeData",t.RESOLVE_USERS_FROM_HUDDLE_MESSAGES="resolveUsersFromHuddleMessages",t.RESOLVE_USER_IDS_BY_EMAIL="resolveUserIdsByEmail",t})(SR||{}),xT=(function(t){return t.IDENTIFY="identify/authProvider",t.GET_TEMPORARY_USERS="getTemporaryUsers",t.GET_USERS="getUsers",t.GET_HUDDLE_USERS="getHuddleUsers",t.GET_SINGLE_EDITOR_USERS="getSingleEditorUsers",t})(xT||{}),oQ=(function(t){return t.RESOLVE_COMMENT_ANNOTATIONS="resolveCommentAnnotations",t.SAVE_COMMENT_ANNOTATION="saveCommentAnnotation",t.DELETE_COMMENT_ANNOTATION="deleteCommentAnnotation",t.FORMAT_RESPONSE="formatResponse",t.INIT_DOCUMENTS="initDocuments",t.SET_DATA="setData",t.UPDATE_DATA="updateData",t.DELETE_DATA="deleteData",t})(oQ||{}),sQ=(function(t){return t.SAVE_ATTACHMENT="saveAttachment",t.DELETE_ATTACHMENT="deleteAttachment",t.UPLOAD_TO_RESOLVER="uploadToResolver",t})(sQ||{}),aQ=(function(t){return t.RESOLVE_REACTION_ANNOTATIONS="resolveReactionAnnotations",t.SAVE_REACTION_ANNOTATION="saveReactionAnnotation",t.DELETE_REACTION_ANNOTATION="deleteReactionAnnotation",t.FORMAT_RESPONSE="formatResponse",t.INIT_DOCUMENTS="initDocuments",t.SET_DATA="setData",t.UPDATE_DATA="updateData",t.DELETE_DATA="deleteData",t})(aQ||{}),cV;cV||(cV={});var cQ=(function(t){return t.SET_DOCUMENTS="setDocuments",t.GET_COMMENT_ANNOTATIONS="getCommentAnnotations",t.GET_NOTIFICATIONS="getNotifications",t})(cQ||{}),lV;lV||(lV={});var lQ=(function(t){return t.SET_DOCUMENTS="setDocuments",t.GET_REACTION_ANNOTATIONS="getReactionAnnotations",t})(lQ||{}),uQ=(function(t){return t.RESOLVE_RECORDER_ANNOTATIONS="resolveRecorderAnnotations",t.SAVE_RECORDER_ANNOTATION="saveRecorderAnnotation",t.DELETE_RECORDER_ANNOTATION="deleteRecorderAnnotation",t.FORMAT_RESPONSE="formatResponse",t.INIT_DOCUMENTS="initDocuments",t.SET_DATA="setData",t.UPDATE_DATA="updateData",t.DELETE_DATA="deleteData",t})(uQ||{}),dQ=(function(t){return t.GET_RECORDER_ANNOTATIONS="getRecorderAnnotations",t})(dQ||{}),hQ=(function(t){return t.RESOLVE_NOTIFICATIONS="resolveNotifications",t.DELETE_NOTIFICATION="deleteNotification",t.DELETE_DATA="deleteData",t.FORMAT_RESPONSE="formatResponse",t})(hQ||{}),fQ=(function(t){return t.GET_NOTIFICATIONS="getNotifications",t})(fQ||{}),pQ=(function(t){return t.RESOLVE_ACTIVITIES="resolveActivities",t.SAVE_ACTIVITY="saveActivity",t.FORMAT_RESPONSE="formatResponse",t})(pQ||{}),gQ=(function(t){return t.GET_ACTIVITIES="getActivities",t})(gQ||{}),mQ=(function(t){return t.SET_DOCUMENTS="setDocuments",t.SET_ROOT_DOCUMENT="setRootDocument",t.SET_DOCUMENT_ID="setDocumentId",t.UNSET_DOCUMENT_ID="unsetDocumentId",t.UNSET_DOCUMENTS="unsetDocuments",t.SET_LOCATION="setLocation",t.SET_LOCATIONS="setLocations",t.SET_ROOT_LOCATION="setRootLocation",t.ADD_LOCATION="addLocation",t.REMOVE_LOCATION="removeLocation",t.REMOVE_LOCATIONS="removeLocations",t.UNSET_LOCATION_IDS="unsetLocationIds",t.REMOVE_LOCATIONS_SUCCESS="removeLocationsSuccess",t})(mQ||{});var uV=class{constructor(){this.pageInfo=new _t}};var dV=class{constructor(){this.documentAccessType=kn.PUBLIC,this.accessType=kn.PUBLIC,this.disabled=!1,this.features={},this.users={}}};var hV=class{};var fV=class{};var pV=class{};var so=class{constructor(){this.contacts=[]}};var Ebe={DOCUMENT_UNSET:"document_unset",USER_LOGOUT:"user_logout"},kT={SET_DOCUMENTS:"setDocuments",IDENTIFY:"identify",GET_NOTIFICATIONS:"getNotifications",SET_NOTIFICATIONS:"setNotifications",REVOKE_ACCESS_ON_USER_LOGOUT:"revokeAccessOnUserLogout",REVOKE_ACCESS_ON_DOCUMENT_UNSET:"revokeAccessOnDocumentUnset"},gV={FOLDER:"folder",DOCUMENT:"document",ORGANIZATION:"organization",CONTEXT:"context"};var mV=class{constructor(){this.id=Math.floor(1e5+Math.random()*9e5)}};var EV=class{constructor(){this.singleTabEditor=!0}};var _V=class{constructor(){this.state="idle"}};var Gc=class{};var TV=class{};var yV=class{constructor(){this.type="multiThread"}};var IV=class{constructor(){this.pageInfo=new _t}};var vV=class{constructor(){this.type="audio"}},SV=class{constructor(){this.type="audio"}},AV=class{constructor(){this.getThumbnailTag=e=>`
|
|
119
|
+
</svg>`}},B.WorkspaceRoles=[{id:od.COMMENTER?.toLowerCase(),name:od.COMMENTER,description:"Can comment on this project",permissions:[]},{id:od.ADMIN?.toLowerCase(),name:od.ADMIN,description:"Can comment on all projects and has access to the portal",permissions:[]}],B.DocumentAccessTypeMap={[kn.PUBLIC]:{id:kn.PUBLIC,name:kn.PUBLIC,description:"Anyone with link can view"},[kn.RESTRICTED]:{id:kn.RESTRICTED,name:kn.RESTRICTED,description:"Only people with access can view"}},B.DocumentAccessTypeMapSF={[kn.PUBLIC]:{id:kn.PUBLIC,name:kn.PUBLIC,description:"Anyone with the link can comment after logging in."},[kn.RESTRICTED]:{id:kn.RESTRICTED,name:kn.RESTRICTED,description:"Only people added to this project can comment."}},B.CommentCategoryMap={bug:{id:"bug",name:"Bug",color:"#FF7162"},feedback:{id:"feedback",name:"Feedback",color:"#00C48C"},question:{id:"question",name:"Question",color:"#FFD166"}},B.OVERLAY_POSITIONS=[{originX:"end",originY:"top",overlayX:"start",overlayY:"top"},{originX:"start",originY:"bottom",overlayX:"start",overlayY:"top"},{originX:"end",originY:"bottom",overlayX:"end",overlayY:"top"},{originX:"center",originY:"bottom",overlayX:"center",overlayY:"top"},{originX:"start",originY:"top",overlayX:"start",overlayY:"bottom"},{originX:"end",originY:"top",overlayX:"end",overlayY:"bottom"},{originX:"center",originY:"top",overlayX:"center",overlayY:"bottom"},{originX:"start",originY:"top",overlayX:"end",overlayY:"top"},{originX:"start",originY:"bottom",overlayX:"end",overlayY:"bottom"},{originX:"start",originY:"center",overlayX:"end",overlayY:"center"},{originX:"end",originY:"bottom",overlayX:"start",overlayY:"bottom"},{originX:"end",originY:"center",overlayX:"start",overlayY:"center"}],B.OVERLAY_POSITIONS_FOR_POPOVER_MODE=[{originX:"end",originY:"top",overlayX:"start",overlayY:"top"},{originX:"end",originY:"center",overlayX:"start",overlayY:"center"},{originX:"end",originY:"bottom",overlayX:"start",overlayY:"bottom"},{originX:"start",originY:"top",overlayX:"end",overlayY:"top"},{originX:"start",originY:"center",overlayX:"end",overlayY:"center"},{originX:"start",originY:"bottom",overlayX:"end",overlayY:"bottom"}],B.VIDEO_EDITOR={ZOOM_IN_DURATION:500,ZOOM_OUT_DURATION:500,DEFAULT_ZOOM_FACTOR:1.5,MAX_ZOOM_FACTOR:3,ZOOM_FACTOR_OPTIONS:[{value:2,label:"2x"},{value:1.7,label:"1.7x"},{value:1.5,label:"1.5x"},{value:1.2,label:"1.2x"}],MIN_DRAG_AREA_MULTIPLIER:.015,PREFERRED_SECTION_DURATION_MULTIPLIER:.15,SELECTION_MIN_DRAG_DISTANCE:2,MIN_DURATION_THRESHOLD:.01,TIME_BUFFER:.1,SHORT_VIDEO_THRESHOLD:3,SMALL_VIDEO_THRESHOLD:5,MILLISECOND_PRECISION_MULTIPLIER:1e3,TENTH_SECOND_PRECISION_MULTIPLIER:10,DEBOUNCE_DELAY:200,DECIMAL_PRECISION:2,MAX_MARKER_COUNT:10,MARKER_INTERVAL:5,FAST_TIMEOUT:50,STANDARD_TIMEOUT:100,RECTANGLE_POSITIONING:{FULL_PERCENT:100,HALF_PERCENT:50,QUARTER_PERCENT:25},EASING:{QUAD_IN_OUT_MULTIPLIER:2,QUAD_IN_OUT_POWER:2,HALF_THRESHOLD:.5},PERCENTAGE:{HALF:50,FULL:100},MILLISECONDS_TO_SECONDS:1e3};var k=B;var wRe=new K("arrow-utils"),ORe=new K("notification-service"),LRe=new K("notifications-actions"),MRe=new K("notification-utils"),PRe=new K("cursor-service"),xRe=new K("cursor-utils"),kRe=new K("presence-service"),FRe=new K("presence-actions"),URe=new K("presence-utils"),VRe=new K("huddle-service"),BRe=new K("huddle-utils"),GRe=new K("recorder-service"),DT=new K("recorder-annotation-service"),jRe=new K("recorder-actions"),HRe=new K("recorder-utils"),$Re=new K("recorder-pin-portal"),RT=new K("comment-service"),WRe=new K("comment-actions"),zRe=new K("comment-dialog-core"),qRe=new K("comment-dialog-action"),KRe=new K("comment-text-service"),YRe=new K("comment-text-portal"),XRe=new K("comment-pin-portal"),QRe=new K("comment-views"),NT=new K("reaction-service"),JRe=new K("rewriter-service"),ZRe=new K("rewriter-actions"),bT=new K("area-service"),WU=new K("activity-service"),zU=new K("views-service"),qU=new K("crdt-service"),KU=new K("live-state-service");var wT=(()=>{let e=class e{constructor(){this.subjects=new Map,O.log("%c[WB] Creating CLASS: ServiceBook","color: blue;")}set(r,i){try{O.log(`%c[WB] ServiceBook.set: ${r.toString()}`,"color: green;"),this.getOrCreateSubject(r).next(i)}catch(o){O.catch("Error in ServiceBook set: ",o)}}get(r){return this.subjects.get(r)?.value??null}observe(r){return this.getOrCreateSubject(r).asObservable()}getOrCreateSubject(r){let i=this.subjects.get(r);return i||(i=new de(null),this.subjects.set(r,i)),i}};e.\u0275fac=function(i){return new(i||e)},e.\u0275prov=Z({token:e,factory:e.\u0275fac,providedIn:"root"});let t=e;return t})();var St=(()=>{let e=class e{};e.Events={Core:{IDENTIFY:"identify",SDK_VALIDATE_CLIENT_TRIGGERED:"sdkValidateClientTriggered",SDK_VALIDATE_CLIENT_SUCCESS:"sdkValidateClientSuccess",SDK_VALIDATE_CLIENT_FAILED:"sdkValidateClientFailed",SDK_USER_AUTH_SUCCESS:"sdkUserAuthSuccess",SDK_USER_AUTH_FAILED:"sdkUserAuthFailed",SDK_USER_SIGN_OUT:"sdkUserSignOut",SDK_PLAN_EXPIRED:"sdkPlanExpired",SDK_ERROR:"error",SDK_UNCAUGHT_ERROR:"uncaughtError",SDK_SESSION_RE_LOGIN_TRIGGERED:"sdkSessionReLoginTriggered",SDK_SESSION_TOKEN_EXPIRED:"sdkSessionTokenExpired",SDK_SESSION_RE_LOGIN_COUNT_EXCEEDED:"sdkSessionReLoginCountExceeded",SDK_JWT_EXPIRED_RETRY_EXCEEDED:"sdkJwtExpiredRetryExceeded",SDK_EVENT_RATE_LIMIT_EXCEEDED:"sdkEventRateLimitExceeded",SET_PERMISSION_PROVIDER_TRIGGERED:"setPermissionProviderTriggered",SIGN_OUT_USER_TRIGGERED:"signOutUserTriggered",SET_DOCUMENTS_TRIGGERED:"setDocumentsTriggered",SET_ROOT_LOCATION_TRIGGERED:"setRootLocationTriggered",SET_ROOT_DOCUMENT_TRIGGERED:"setRootDocumentTriggered",UNSET_DOCUMENTS_TRIGGERED:"unsetDocumentsTriggered",FETCH_DOCUMENTS_TRIGGERED:"fetchDocumentsTriggered",UPDATE_DOCUMENTS_TRIGGERED:"updateDocumentsTriggered",UPDATE_LOCATIONS_TRIGGERED:"updateLocationsTriggered",FETCH_FOLDERS_TRIGGERED:"fetchFoldersTriggered",SET_USER_DATA_PROVIDER_TRIGGERED:"setUserDataProviderTriggered",SET_ANONYMOUS_USER_DATA_PROVIDER_TRIGGERED:"setAnonymousUserDataProviderTriggered",SET_DATA_PROVIDERS_TRIGGERED:"setDataProvidersTriggered",SET_ENCRYPTION_PROVIDER_TRIGGERED:"setEncryptionProviderTriggered",SET_VELT_AUTH_PROVIDER_TRIGGERED:"setVeltAuthProviderTriggered",GET_DOCUMENT_ID_TRIGGERED:"getDocumentIdTriggered",SET_LOCATIONS_TRIGGERED:"setLocationsTriggered",SET_SCROLLABLE_ELEMENTS_IDS_TRIGGERED:"setScrollableElementsIdsTriggered",REMOVE_LOCATIONS_TRIGGERED:"removeLocationsTriggered",UNSET_LOCATIONS_TRIGGERED:"unsetLocationsTriggered",EXCLUDE_LOCATION_IDS_TRIGGERED:"excludeLocationIdsTriggered",UPDATE_CONTACT_LIST_TRIGGERED:"updateContactListTriggered",UPDATE_ORG_LIST_TRIGGERED:"updateOrgListTriggered",REMOVE_SCROLLABLE_ELEMENTS_IDS_TRIGGERED:"removeScrollableElementsIdsTriggered",GET_PRESENCE_ELEMENT_TRIGGERED:"getPresenceElementTriggered",GET_CURSOR_ELEMENT_TRIGGERED:"getCursorElementTriggered",GET_COMMENT_ELEMENT_TRIGGERED:"getCommentElementTriggered",GET_TAG_ELEMENT_TRIGGERED:"getTagElementTriggered",GET_SELECTION_ELEMENT_TRIGGERED:"getSelectionElementTriggered",GET_RECORDER_ELEMENT_TRIGGERED:"getRecorderElementTriggered",GET_CONTACT_ELEMENT_TRIGGERED:"getContactElementTriggered",GET_REWRITER_ELEMENT_TRIGGERED:"getRewriterElementTriggered",GET_HUDDLE_ELEMENT_TRIGGERED:"getHuddleElementTriggered",GET_LIVE_STATE_SYNC_ELEMENT_TRIGGERED:"getLiveStateSyncElementTriggered",GET_ARROW_ELEMENT_TRIGGERED:"getArrowElementTriggered",GET_VIEWS_ELEMENT_TRIGGERED:"getViewsElementTriggered",GET_NOTIFICATION_ELEMENT_TRIGGERED:"getNotificationElementTriggered",GET_AUTOCOMPLETE_ELEMENT_TRIGGERED:"getAutocompleteElementTriggered",GET_DOC_ELEMENT_TRIGGERED:"getDocElementTriggered",GET_AREA_ELEMENT_TRIGGERED:"getAreaElementTriggered",GET_REACTION_ELEMENT_TRIGGERED:"getReactionElementTriggered",GET_METADATA_TRIGGERED:"getMetadataTriggered",FETCH_DEBUG_INFO_TRIGGERED:"fetchDebugInfoTriggered",GET_DEBUG_INFO_TRIGGERED:"getDebugInfoTriggered",DISABLE_FEATURES_TRIGGERED:"disableFeaturesTriggered",SET_DARK_MODE_TRIGGERED:"setDarkModeTriggered",SET_UNSTYLED_MODE_TRIGGERED:"setUnstyledModeTriggered",ENABLE_LOGS_TRIGGERED:"enableLogsTriggered",DISABLE_LOGS_TRIGGERED:"disableLogsTriggered",IS_USER_ALLOWED_TRIGGERED:"isUserAllowedTriggered",GET_USER_TRIGGERED:"getUserTriggered",GET_CURRENT_USER_TRIGGERED:"getCurrentUserTriggered",GET_HEARTBEAT_TRIGGERED:"getHeartbeatTriggered",GET_USER_ROLE_TRIGGERED:"getUserRoleTriggered",GET_USER_PERMISSIONS_TRIGGERED:"getUserPermissionsTriggered",GET_CURRENT_USER_PERMISSIONS_TRIGGERED:"getCurrentUserPermissionsTriggered",GET_FEATURES_ACCESS_LEVEL_IAM_TRIGGERED:"getFeaturesAccessLevelIamTriggered",IS_PLAN_EXPIRED_TRIGGERED:"isPlanExpiredTriggered",GET_CUSTOMER_METADATA_TRIGGERED:"getCustomerMetadataTriggered",GET_DOCUMENT_METADATA_TRIGGERED:"getDocumentMetadataTriggered",REMOVE_VELT_CONTENT_TRIGGERED:"removeVeltContentTriggered",INJECT_CUSTOM_CSS_TRIGGERED:"injectCustomCssTriggered",SET_LANGUAGE_TRIGGERED:"setLanguageTriggered",SET_TRANSLATIONS_TRIGGERED:"setTranslationsTriggered",ENABLE_AUTO_TRANSLATION_TRIGGERED:"enableAutoTranslationTriggered",DISABLE_AUTO_TRANSLATION_TRIGGERED:"disableAutoTranslationTriggered",SF_TRIGGERED:"sfTriggered",SET_UI_STATE_TRIGGERED:"setUiStateTriggered",GET_UI_STATE_TRIGGERED:"getUiStateTriggered",ENABLE_SAFE_EVAL_TRIGGERED:"enableSafeEvalTriggered",DISABLE_SAFE_EVAL_TRIGGERED:"disableSafeEvalTriggered",ENABLE_FIRESTORE_PERSISTENT_CACHE_TRIGGERED:"enableFirestorePersistentCacheTriggered",DISABLE_FIRESTORE_PERSISTENT_CACHE_TRIGGERED:"disableFirestorePersistentCacheTriggered",RESET_VELT_BUTTON_STATE_TRIGGERED:"resetVeltButtonStateTriggered"},PermissionProvider:{RESOURCE_ACCESS_REQUEST_FORMED:"resourceAccessRequestFormed",RESOURCE_ACCESS_REQUEST_TRIGGERED:"resourceAccessRequestTriggered",REVOKE_ACCESS_ON_DOCUMENT_UNSET_TRIGGERED:"revokeAccessOnDocumentUnsetTriggered",REVOKE_ACCESS_ON_DOCUMENT_UNSET_FORMED:"revokeAccessOnDocumentUnsetFormed",REVOKE_ACCESS_ON_DOCUMENT_UNSET_RESULT:"revokeAccessOnDocumentUnsetResult",REVOKE_ACCESS_ON_USER_LOGOUT_TRIGGERED:"revokeAccessOnUserLogoutTriggered",REVOKE_ACCESS_ON_USER_LOGOUT_FORMED:"revokeAccessOnUserLogoutFormed",REVOKE_ACCESS_ON_USER_LOGOUT_RESULT:"revokeAccessOnUserLogoutResult",RESOURCE_ACCESS_RESULT:"resourceAccessResult",RESOURCE_ACCESS_ERROR:"resourceAccessError",RESOURCE_ACCESS_RESULT_FROM_CACHE:"resourceAccessResultFromCache",REVOKE_ACCESS_ON_DOCUMENT_UNSET_ERROR:"revokeAccessOnDocumentUnsetError",REVOKE_ACCESS_ON_USER_LOGOUT_ERROR:"revokeAccessOnUserLogoutError"},Resolver:{COMMENT_RESOLVER_GET:"comment_resolver_get",COMMENT_RESOLVER_SAVE:"comment_resolver_save",COMMENT_RESOLVER_DELETE:"comment_resolver_delete",COMMENT_RESOLUTION_REQUEST_FORMED:"commentResolutionRequestFormed",COMMENT_RESOLUTION_REQUEST_TRIGGERED:"commentResolutionRequestTriggered",COMMENT_RESOLUTION_RESULT:"commentResolutionResult",COMMENT_RESOLUTION_ERROR:"commentResolutionError",COMMENT_RESOLUTION_RESULT_FROM_CACHE:"commentResolutionResultFromCache",COMMENT_SAVE_REQUEST_FORMED:"commentSaveRequestFormed",COMMENT_SAVE_REQUEST_TRIGGERED:"commentSaveRequestTriggered",COMMENT_SAVE_RESULT:"commentSaveResult",COMMENT_SAVE_ERROR:"commentSaveError",COMMENT_DELETE_REQUEST_FORMED:"commentDeleteRequestFormed",COMMENT_DELETE_REQUEST_TRIGGERED:"commentDeleteRequestTriggered",COMMENT_DELETE_RESULT:"commentDeleteResult",COMMENT_DELETE_ERROR:"commentDeleteError",REACTION_RESOLVER_GET:"reaction_resolver_get",REACTION_RESOLVER_SAVE:"reaction_resolver_save",REACTION_RESOLVER_DELETE:"reaction_resolver_delete",REACTION_RESOLUTION_REQUEST_FORMED:"reactionResolutionRequestFormed",REACTION_RESOLUTION_REQUEST_TRIGGERED:"reactionResolutionRequestTriggered",REACTION_RESOLUTION_RESULT:"reactionResolutionResult",REACTION_RESOLUTION_ERROR:"reactionResolutionError",REACTION_RESOLUTION_RESULT_FROM_CACHE:"reactionResolutionResultFromCache",REACTION_SAVE_REQUEST_FORMED:"reactionSaveRequestFormed",REACTION_SAVE_REQUEST_TRIGGERED:"reactionSaveRequestTriggered",REACTION_SAVE_RESULT:"reactionSaveResult",REACTION_SAVE_ERROR:"reactionSaveError",REACTION_DELETE_REQUEST_FORMED:"reactionDeleteRequestFormed",REACTION_DELETE_REQUEST_TRIGGERED:"reactionDeleteRequestTriggered",REACTION_DELETE_RESULT:"reactionDeleteResult",REACTION_DELETE_ERROR:"reactionDeleteError",NOTIFICATION_RESOLVER_GET:"notification_resolver_get",NOTIFICATION_RESOLVER_DELETE:"notification_resolver_delete",NOTIFICATION_RESOLUTION_REQUEST_FORMED:"notificationResolutionRequestFormed",NOTIFICATION_RESOLUTION_REQUEST_TRIGGERED:"notificationResolutionRequestTriggered",NOTIFICATION_RESOLUTION_RESULT:"notificationResolutionResult",NOTIFICATION_RESOLUTION_ERROR:"notificationResolutionError",NOTIFICATION_DELETE_REQUEST_FORMED:"notificationDeleteRequestFormed",NOTIFICATION_DELETE_REQUEST_TRIGGERED:"notificationDeleteRequestTriggered",NOTIFICATION_DELETE_RESULT:"notificationDeleteResult",NOTIFICATION_DELETE_ERROR:"notificationDeleteError",USER_RESOLVER_GET:"user_resolver_get",USER_RESOLUTION_REQUEST_FORMED:"userResolutionRequestFormed",USER_RESOLUTION_REQUEST_TRIGGERED:"userResolutionRequestTriggered",USER_RESOLUTION_RESULT:"userResolutionResult",USER_RESOLUTION_ERROR:"userResolutionError",USER_RESOLUTION_RESULT_FROM_CACHE:"userResolutionResultFromCache",EMAIL_USER_ID_RESOLUTION_REQUEST_FORMED:"emailUserIdResolutionRequestFormed",EMAIL_USER_ID_RESOLUTION_REQUEST_TRIGGERED:"emailUserIdResolutionRequestTriggered",EMAIL_USER_ID_RESOLUTION_RESULT:"emailUserIdResolutionResult",EMAIL_USER_ID_RESOLUTION_ERROR:"emailUserIdResolutionError",ATTACHMENT_RESOLVER_SAVE:"attachment_resolver_save",ATTACHMENT_RESOLVER_DELETE:"attachment_resolver_delete",ATTACHMENT_SAVE_REQUEST_FORMED:"attachmentSaveRequestFormed",ATTACHMENT_SAVE_REQUEST_TRIGGERED:"attachmentSaveRequestTriggered",ATTACHMENT_SAVE_RESULT:"attachmentSaveResult",ATTACHMENT_SAVE_ERROR:"attachmentSaveError",ATTACHMENT_DELETE_REQUEST_FORMED:"attachmentDeleteRequestFormed",ATTACHMENT_DELETE_REQUEST_TRIGGERED:"attachmentDeleteRequestTriggered",ATTACHMENT_DELETE_RESULT:"attachmentDeleteResult",ATTACHMENT_DELETE_ERROR:"attachmentDeleteError",RECORDER_RESOLVER_GET:"recorder_resolver_get",RECORDER_RESOLVER_SAVE:"recorder_resolver_save",RECORDER_RESOLVER_DELETE:"recorder_resolver_delete",RECORDER_RESOLUTION_REQUEST_FORMED:"recorderResolutionRequestFormed",RECORDER_RESOLUTION_REQUEST_TRIGGERED:"recorderResolutionRequestTriggered",RECORDER_RESOLUTION_RESULT:"recorderResolutionResult",RECORDER_RESOLUTION_ERROR:"recorderResolutionError",RECORDER_RESOLUTION_RESULT_FROM_CACHE:"recorderResolutionResultFromCache",RECORDER_SAVE_REQUEST_FORMED:"recorderSaveRequestFormed",RECORDER_SAVE_REQUEST_TRIGGERED:"recorderSaveRequestTriggered",RECORDER_SAVE_RESULT:"recorderSaveResult",RECORDER_SAVE_ERROR:"recorderSaveError",RECORDER_DELETE_REQUEST_FORMED:"recorderDeleteRequestFormed",RECORDER_DELETE_REQUEST_TRIGGERED:"recorderDeleteRequestTriggered",RECORDER_DELETE_RESULT:"recorderDeleteResult",RECORDER_DELETE_ERROR:"recorderDeleteError",ACTIVITY_RESOLVER_GET:"activity_resolver_get",ACTIVITY_RESOLVER_SAVE:"activity_resolver_save",ACTIVITY_RESOLUTION_REQUEST_FORMED:"activityResolutionRequestFormed",ACTIVITY_RESOLUTION_REQUEST_TRIGGERED:"activityResolutionRequestTriggered",ACTIVITY_RESOLUTION_RESULT:"activityResolutionResult",ACTIVITY_RESOLUTION_ERROR:"activityResolutionError",ACTIVITY_RESOLUTION_RESULT_FROM_CACHE:"activityResolutionResultFromCache",ACTIVITY_SAVE_REQUEST_FORMED:"activitySaveRequestFormed",ACTIVITY_SAVE_REQUEST_TRIGGERED:"activitySaveRequestTriggered",ACTIVITY_SAVE_RESULT:"activitySaveResult",ACTIVITY_SAVE_ERROR:"activitySaveError"},Autocomplete:{CREATE_TRIGGERED:"createTriggered",ON_AUTOCOMPLETE_CHIP_CLICK_TRIGGERED:"onAutocompleteChipClickTriggered"},Comments:{COMMENT_TOOL_CLICKED:"commentToolClicked",COMMENT_DRAFT_ADDED:"commentDraftAdded",COMMENT_ADD_CONTEXT_TRIGGERED:"commentAddContextTriggered",COMMENT_UPDATE_CONTEXT_TRIGGERED:"commentUpdateContextTriggered",COMMENT_UPDATE_CONTEXT_SUCCESS:"commentUpdateContextSuccess",COMMENT_UPDATE_CONTEXT_FAILED:"commentUpdateContextFailed",COMMENT_ADDED:"commentAdded",COMMENT_READ:"commentRead",COMMENT_STATUS_CHANGED:"commentStatusChanged",COMMENT_PRIORITY_CHANGED:"commentPriorityChanged",COMMENT_CUSTOM_CHIPS_CHANGED:"commentCustomChipsChanged",COMMENT_APPROVED:"commentApproved",COMMENT_ACCEPTED:"commentAccepted",COMMENT_REJECTED:"commentRejected",COMMENT_ASSIGNED:"commentAssigned",COMMENT_DELETE_TRIGGERED:"commentDeleteTriggered",COMMENT_DELETED:"commentDeleted",COMMENT_THREAD_DELETED:"commentThreadDeleted",COMMENT_LINK_COPIED:"commentLinkCopied",COMMENT_EDIT_BUTTON_CLICKED:"commentEditButtonClicked",COMMENT_EDITED:"commentEdited",COMMENT_SIDEBAR_OPENED:"commentSidebarOpened",COMMENT_SIDEBAR_CLOSED:"commentSidebarClosed",COMMENT_SIDEBAR_TOGGLED:"commentSidebarToggled",COMMENT_TAG_BUTTON_CLICKED:"commentTagButtonClicked",COMMENT_TAG_ADDED:"commentTagAdded",COMMENT_PIN_DRAGGED:"commentPinDragged",COMMENT_ADD_MODE_ENABLED:"commentAddModeEnabled",COMMENT_ADD_MODE_DISABLED:"commentAddModeDisabled",COMMENT_TEXT_MODE_ENABLED:"commentTextModeEnabled",COMMENT_TEXT_MODE_DISABLED:"commentTextModeDisabled",COMMENT_POPOVER_MODE_ENABLED:"commentPopoverModeEnabled",COMMENT_POPOVER_MODE_DISABLED:"commentPopoverModeDisabled",COMMENT_STREAM_MODE_ENABLED:"commentStreamModeEnabled",COMMENT_STREAM_MODE_DISABLED:"commentStreamModeDisabled",COMMENT_SIDEBAR_EMBED_MODE_ENABLED:"commentSidebarEmbedModeEnabled",COMMENT_SIDEBAR_FLOATING_MODE_ENABLED:"commentSidebarFloatingModeEnabled",COMMENT_ATTACHMENT_SET_ALLOWED_FILE_TYPES_TRIGGERED:"commentAttachmentSetAllowedFileTypesTriggered",ENABLE_FORCE_CLOSE_ALL_ON_ESC_TRIGGERED:"enableForceCloseAllOnEscTriggered",DISABLE_FORCE_CLOSE_ALL_ON_ESC_TRIGGERED:"disableForceCloseAllOnEscTriggered",COMMENT_ATTACHMENT_BUTTON_CLICKED:"commentAttachmentButtonClicked",COMMENT_ATTACHMENT_ADDED:"commentAttachmentAdded",COMMENT_ATTACHMENT_DOWNLOADED:"commentAttachmentDownloaded",COMMENT_ATTACHMENT_DELETED:"commentAttachmentDeleted",COMMENT_ATTACHMENT_SIZE_EXCEEDED:"commentAttachmentSizeExceeded",COMMENT_ATTACHMENT_TYPE_NOT_ALLOWED:"commentAttachmentTypeNotAllowed",COMMENT_SUBMIT_TRIGGERED:"commentSubmitTriggered",COMMENT_APPROVE_BUTTON_CLICKED:"commentApproveButtonClicked",COMMENT_ACCEPT_BUTTON_CLICKED:"commentAcceptButtonClicked",COMMENT_REJECT_BUTTON_CLICKED:"commentRejectButtonClicked",SUGGESTION_ACCEPTED:"suggestionAccepted",SUGGESTION_REJECTED:"suggestionRejected",COMMENT_SIGN_IN_BUTTON_CLICKED:"commentSignInButtonClicked",COMMENT_UPGRADE_BUTTON_CLICKED:"commentUpgradeButtonClicked",COMMENT_RECORDING_TOOL_CLICKED:"commentRecordingToolClicked",COMMENT_RECORDING_ADDED:"commentRecordingAdded",COMMENT_RECORDING_DELETED:"commentRecordingDeleted",COMMENT_MORE_REPLY_OPTION_CLICKED:"commentMoreReplyOptionClicked",COMMENT_PRIVATE_COMMENT_MODE_ENABLED:"commentPrivateCommentModeEnabled",COMMENT_PRIVATE_COMMENT_MODE_DISABLED:"commentPrivateCommentModeDisabled",COMMENT_ACCESS_MODE_CHANGED:"commentAccessModeChanged",SET_COMPOSER_FILE_ATTACHMENTS_TRIGGERED:"setComposerFileAttachmentsTriggered",GET_ALL_COMMENT_ANNOTATIONS_TRIGGERED_INTERNAL:"getAllCommentAnnotationsTriggered_internal",GET_ALL_COMMENT_ANNOTATIONS_TRIGGERED:"getAllCommentAnnotationsTriggered",DELETE_SELECTED_COMMENT_TRIGGERED:"deleteSelectedCommentTriggered",ENABLE_TEXT_COMMENTS_TRIGGERED:"enableTextCommentsTriggered",DISABLE_TEXT_COMMENTS_TRIGGERED:"disableTextCommentsTriggered",ALLOWED_ELEMENT_IDS_TRIGGERED:"allowedElementIdsTriggered",ALLOWED_ELEMENT_CLASS_NAMES_TRIGGERED:"allowedElementClassNamesTriggered",ALLOWED_ELEMENT_QUERY_SELECTORS_TRIGGERED:"allowedElementQuerySelectorsTriggered",ENABLE_FLOATING_COMMENT_DIALOG_TRIGGERED:"enableFloatingCommentDialogTriggered",DISABLE_FLOATING_COMMENT_DIALOG_TRIGGERED:"disableFloatingCommentDialogTriggered",ATTACH_COMMENT_TRIGGERED:"attachCommentTriggered",OPEN_COMMENT_SIDEBAR_TRIGGERED:"openCommentSidebarTriggered",CLOSE_COMMENT_SIDEBAR_TRIGGERED:"closeCommentSidebarTriggered",TOGGLE_COMMENT_SIDEBAR_TRIGGERED:"toggleCommentSidebarTriggered",SET_ASSIGN_TO_TYPE_TRIGGERED:"setAssignToTypeTriggered",ENABLE_CONTEXT_IN_PAGE_MODE_COMPOSER_TRIGGERED:"enableContextInPageModeComposerTriggered",DISABLE_CONTEXT_IN_PAGE_MODE_COMPOSER_TRIGGERED:"disableContextInPageModeComposerTriggered",CLEAR_PAGE_MODE_COMPOSER_CONTEXT_TRIGGERED:"clearPageModeComposerContextTriggered",SET_CONTEXT_IN_PAGE_MODE_COMPOSER_TRIGGERED:"setContextInPageModeComposerTriggered",FOCUS_PAGE_MODE_COMPOSER_TRIGGERED:"focusPageModeComposerTriggered",ENABLE_MODERATOR_MODE_TRIGGERED:"enableModeratorModeTriggered",DISABLE_MODERATOR_MODE_TRIGGERED:"disableModeratorModeTriggered",ENABLE_STREAM_MODE_TRIGGERED:"enableStreamModeTriggered",DISABLE_STREAM_MODE_TRIGGERED:"disableStreamModeTriggered",ENABLE_SIGN_IN_BUTTON_TRIGGERED:"enableSignInButtonTriggered",DISABLE_SIGN_IN_BUTTON_TRIGGERED:"disableSignInButtonTriggered",ENABLE_UPGRADE_BUTTON_TRIGGERED:"enableUpgradeButtonTriggered",DISABLE_UPGRADE_BUTTON_TRIGGERED:"disableUpgradeButtonTriggered",ON_COMMENT_MODE_CHANGE_TRIGGERED:"onCommentModeChangeTriggered",ENABLE_ATTACHMENTS_TRIGGERED:"enableAttachmentsTriggered",DISABLE_ATTACHMENTS_TRIGGERED:"disableAttachmentsTriggered",ENABLE_ATTACHMENT_DOWNLOAD_TRIGGERED:"enableAttachmentDownloadTriggered",DISABLE_ATTACHMENT_DOWNLOAD_TRIGGERED:"disableAttachmentDownloadTriggered",IS_USER_GLOBAL_CONTACT_TRIGGERED:"isUserGlobalContactTriggered",ENABLE_DEVICE_INFO_TRIGGERED:"enableDeviceInfoTriggered",DISABLE_DEVICE_INFO_TRIGGERED:"disableDeviceInfoTriggered",ENABLE_COMMENT_MODE_TRIGGERED:"enableCommentModeTriggered",DISABLE_COMMENT_MODE_TRIGGERED:"disableCommentModeTriggered",ENABLE_PERSISTENT_COMMENT_MODE_TRIGGERED:"enablePersistentCommentModeTriggered",DISABLE_PERSISTENT_COMMENT_MODE_TRIGGERED:"disablePersistentCommentModeTriggered",SHOW_COMMENT_INDEX_TRIGGERED:"showCommentIndexTriggered",ENABLE_COMMENT_INDEX_TRIGGERED:"enableCommentIndexTriggered",DISABLE_COMMENT_INDEX_TRIGGERED:"disableCommentIndexTriggered",ENABLE_POPOVER_MODE_TRIGGERED:"enablePopoverModeTriggered",DISABLE_POPOVER_MODE_TRIGGERED:"disablePopoverModeTriggered",ENABLE_POPOVER_TRIANGLE_COMPONENT_TRIGGERED:"enablePopoverTriangleComponentTriggered",DISABLE_POPOVER_TRIANGLE_COMPONENT_TRIGGERED:"disablePopoverTriangleComponentTriggered",ENABLE_DIALOG_ON_HOVER_TRIGGERED:"enableDialogOnHoverTriggered",DISABLE_DIALOG_ON_HOVER_TRIGGERED:"disableDialogOnHoverTriggered",ENABLE_DIALOG_ON_TARGET_ELEMENT_CLICK_TRIGGERED:"enableDialogOnTargetElementClickTriggered",DISABLE_DIALOG_ON_TARGET_ELEMENT_CLICK_TRIGGERED:"disableDialogOnTargetElementClickTriggered",ENABLE_PRIORITY_TRIGGERED:"enablePriorityTriggered",DISABLE_PRIORITY_TRIGGERED:"disablePriorityTriggered",ENABLE_STATUS_TRIGGERED:"enableStatusTriggered",DISABLE_STATUS_TRIGGERED:"disableStatusTriggered",ENABLE_VISIBILITY_OPTIONS_TRIGGERED:"enableVisibilityOptionsTriggered",DISABLE_VISIBILITY_OPTIONS_TRIGGERED:"disableVisibilityOptionsTriggered",ENABLE_RESOLVE_BUTTON_TRIGGERED:"enableResolveButtonTriggered",DISABLE_RESOLVE_BUTTON_TRIGGERED:"disableResolveButtonTriggered",ENABLE_GHOST_COMMENTS_TRIGGERED:"enableGhostCommentsTriggered",DISABLE_GHOST_COMMENTS_TRIGGERED:"disableGhostCommentsTriggered",ENABLE_GHOST_COMMENTS_INDICATOR_TRIGGERED:"enableGhostCommentsIndicatorTriggered",DISABLE_GHOST_COMMENTS_INDICATOR_TRIGGERED:"disableGhostCommentsIndicatorTriggered",SET_CUSTOM_STATUS_TRIGGERED:"setCustomStatusTriggered",SET_CUSTOM_PRIORITY_TRIGGERED:"setCustomPriorityTriggered",SET_CUSTOM_CATEGORY_TRIGGERED:"setCustomCategoryTriggered",ENABLE_INBOX_MODE_TRIGGERED:"enableInboxModeTriggered",DISABLE_INBOX_MODE_TRIGGERED:"disableInboxModeTriggered",ENABLE_AUTO_CATEGORIZE_TRIGGERED:"enableAutoCategorizeTriggered",DISABLE_AUTO_CATEGORIZE_TRIGGERED:"disableAutoCategorizeTriggered",ENABLE_DARK_MODE_TRIGGERED:"enableDarkModeTriggered",DISABLE_DARK_MODE_TRIGGERED:"disableDarkModeTriggered",SET_CONTEXT_PROVIDER_TRIGGERED:"setContextProviderTriggered",ENABLE_SUGGESTION_MODE_TRIGGERED:"enableSuggestionModeTriggered",DISABLE_SUGGESTION_MODE_TRIGGERED:"disableSuggestionModeTriggered",ENABLE_MOBILE_MODE_TRIGGERED:"enableMobileModeTriggered",DISABLE_MOBILE_MODE_TRIGGERED:"disableMobileModeTriggered",ENABLE_INLINE_COMMENT_MODE_TRIGGERED:"enableInlineCommentModeTriggered",DISABLE_INLINE_COMMENT_MODE_TRIGGERED:"disableInlineCommentModeTriggered",ENABLE_MINIMAP_TRIGGERED:"enableMinimapTriggered",DISABLE_MINIMAP_TRIGGERED:"disableMinimapTriggered",SHOW_COMMENTS_ON_DOM_TRIGGERED:"showCommentsOnDomTriggered",HIDE_COMMENTS_ON_DOM_TRIGGERED:"hideCommentsOnDomTriggered",ENABLE_COMMENT_TOOL_TRIGGERED:"enableCommentToolTriggered",DISABLE_COMMENT_TOOL_TRIGGERED:"disableCommentToolTriggered",SET_TOTAL_MEDIA_LENGTH_TRIGGERED:"setTotalMediaLengthTriggered",ON_COMMENT_ADD_TRIGGERED:"onCommentAddTriggered",ON_COMMENT_UPDATE_TRIGGERED:"onCommentUpdateTriggered",ADD_COMMENT_ON_SELECTED_TEXT_TRIGGERED:"addCommentOnSelectedTextTriggered",ENABLE_SIDEBAR_URL_NAVIGATION_TRIGGERED:"enableSidebarUrlNavigationTriggered",DISABLE_SIDEBAR_URL_NAVIGATION_TRIGGERED:"disableSidebarUrlNavigationTriggered",SET_D_STRATEGY_TRIGGERED:"setDStrategyTriggered",ENABLE_SIDEBAR_BUTTON_ON_COMMENT_DIALOG_TRIGGERED:"enableSidebarButtonOnCommentDialogTriggered",DISABLE_SIDEBAR_BUTTON_ON_COMMENT_DIALOG_TRIGGERED:"disableSidebarButtonOnCommentDialogTriggered",ON_SIDEBAR_BUTTON_ON_COMMENT_DIALOG_CLICK_TRIGGERED:"onSidebarButtonOnCommentDialogClickTriggered",ENABLE_REACTIONS_TRIGGERED:"enableReactionsTriggered",DISABLE_REACTIONS_TRIGGERED:"disableReactionsTriggered",ENABLE_ANONYMOUS_EMAIL_TRIGGERED:"enableAnonymousEmailTriggered",DISABLE_ANONYMOUS_EMAIL_TRIGGERED:"disableAnonymousEmailTriggered",SET_RECORDINGS_TRIGGERED:"setRecordingsTriggered",ADD_COMMENT_ON_ELEMENT_TRIGGERED:"addCommentOnElementTriggered",ENABLE_PRIVATE_COMMENT_MODE_TRIGGERED:"enablePrivateCommentModeTriggered",DISABLE_PRIVATE_COMMENT_MODE_TRIGGERED:"disablePrivateCommentModeTriggered",ENABLE_PRIVATE_MODE_TRIGGERED:"enablePrivateModeTriggered",DISABLE_PRIVATE_MODE_TRIGGERED:"disablePrivateModeTriggered",ENABLE_SCROLL_TO_COMMENT_TRIGGERED:"enableScrollToCommentTriggered",DISABLE_SCROLL_TO_COMMENT_TRIGGERED:"disableScrollToCommentTriggered",ENABLE_USER_MENTIONS_TRIGGERED:"enableUserMentionsTriggered",DISABLE_USER_MENTIONS_TRIGGERED:"disableUserMentionsTriggered",SET_COMMENT_SIDEBAR_FILTERS_TRIGGERED:"setCommentSidebarFiltersTriggered",SET_SYSTEM_FILTERS_OPERATOR_TRIGGERED:"setSystemFiltersOperatorTriggered",ENABLE_COMMENT_PIN_HIGHLIGHTER_TRIGGERED:"enableCommentPinHighlighterTriggered",DISABLE_COMMENT_PIN_HIGHLIGHTER_TRIGGERED:"disableCommentPinHighlighterTriggered",ENABLE_DELETE_ON_BACKSPACE_TRIGGERED:"enableDeleteOnBackspaceTriggered",DISABLE_DELETE_ON_BACKSPACE_TRIGGERED:"disableDeleteOnBackspaceTriggered",ENABLE_HOTKEY_TRIGGERED:"enableHotkeyTriggered",DISABLE_HOTKEY_TRIGGERED:"disableHotkeyTriggered",ENABLE_DEVICE_INDICATOR_ON_COMMENT_PINS_TRIGGERED:"enableDeviceIndicatorOnCommentPinsTriggered",DISABLE_DEVICE_INDICATOR_ON_COMMENT_PINS_TRIGGERED:"disableDeviceIndicatorOnCommentPinsTriggered",GET_ELEMENT_REF_BY_ANNOTATION_ID_TRIGGERED:"getElementRefByAnnotationIdTriggered",SCROLL_TO_COMMENT_BY_ANNOTATION_ID_TRIGGERED:"scrollToCommentByAnnotationIdTriggered",SELECT_COMMENT_BY_ANNOTATION_ID_TRIGGERED:"selectCommentByAnnotationIdTriggered",ENABLE_RECORDING_SUMMARY_TRIGGERED:"enableRecordingSummaryTriggered",DISABLE_RECORDING_SUMMARY_TRIGGERED:"disableRecordingSummaryTriggered",ENABLE_RECORDING_TRANSCRIPTION_TRIGGERED:"enableRecordingTranscriptionTriggered",DISABLE_RECORDING_TRANSCRIPTION_TRIGGERED:"disableRecordingTranscriptionTriggered",ENABLE_RECORDING_COUNTDOWN_TRIGGERED:"enableRecordingCountdownTriggered",DISABLE_RECORDING_COUNTDOWN_TRIGGERED:"disableRecordingCountdownTriggered",SET_UNREAD_INDICATOR_MODE_TRIGGERED:"setUnreadIndicatorModeTriggered",ENABLE_ENTER_KEY_TO_SUBMIT_TRIGGERED:"enableEnterKeyToSubmitTriggered",DISABLE_ENTER_KEY_TO_SUBMIT_TRIGGERED:"disableEnterKeyToSubmitTriggered",ENABLE_PIN_SHADOW_DOM_TRIGGERED:"enablePinShadowDOMTriggered",DISABLE_PIN_SHADOW_DOM_TRIGGERED:"disablePinShadowDOMTriggered",ENABLE_DIALOG_SHADOW_DOM_TRIGGERED:"enableDialogShadowDOMTriggered",DISABLE_DIALOG_SHADOW_DOM_TRIGGERED:"disableDialogShadowDOMTriggered",ENABLE_SIDEBAR_SHADOW_DOM_TRIGGERED:"enableSidebarShadowDOMTriggered",DISABLE_SIDEBAR_SHADOW_DOM_TRIGGERED:"disableSidebarShadowDOMTriggered",ENABLE_CHANGE_DETECTION_IN_COMMENT_MODE_TRIGGERED:"enableChangeDetectionInCommentModeTriggered",DISABLE_CHANGE_DETECTION_IN_COMMENT_MODE_TRIGGERED:"disableChangeDetectionInCommentModeTriggered",SHOW_RESOLVED_COMMENTS_ON_DOM_TRIGGERED:"showResolvedCommentsOnDomTriggered",HIDE_RESOLVED_COMMENTS_ON_DOM_TRIGGERED:"hideResolvedCommentsOnDomTriggered",SET_CUSTOM_REACTIONS_TRIGGERED:"setCustomReactionsTriggered",ON_COMMENT_SELECTION_CHANGE_TRIGGERED:"onCommentSelectionChangeTriggered",GET_UNREAD_COMMENT_COUNT_BY_ANNOTATION_ID_TRIGGERED:"getUnreadCommentCountByAnnotationIdTriggered",GET_UNREAD_COMMENT_ANNOTATION_COUNT_ON_CURRENT_DOCUMENT_TRIGGERED:"getUnreadCommentAnnotationCountOnCurrentDocumentTriggered",GET_UNREAD_COMMENT_COUNT_ON_CURRENT_DOCUMENT_TRIGGERED:"getUnreadCommentCountOnCurrentDocumentTriggered",GET_UNREAD_COMMENT_ANNOTATION_COUNT_BY_LOCATION_ID_TRIGGERED:"getUnreadCommentAnnotationCountByLocationIdTriggered",GET_UNREAD_COMMENT_COUNT_BY_LOCATION_ID_TRIGGERED:"getUnreadCommentCountByLocationIdTriggered",UPDATE_COMMENT_DIALOG_POSITION_TRIGGERED:"updateCommentDialogPositionTriggered",ENABLE_AREA_COMMENT_TRIGGERED:"enableAreaCommentTriggered",DISABLE_AREA_COMMENT_TRIGGERED:"disableAreaCommentTriggered",SET_PIN_CURSOR_IMAGE_TRIGGERED:"setPinCursorImageTriggered",ADD_MANUAL_COMMENT_TRIGGERED:"addManualCommentTriggered",CREATE_CUSTOM_LIST_DATA_ON_ANNOTATION_TRIGGERED:"createCustomListDataOnAnnotationTriggered",CREATE_CUSTOM_LIST_DATA_ON_COMMENT_TRIGGERED:"createCustomListDataOnCommentTriggered",EXCLUDE_LOCATION_IDS_FROM_SIDEBAR_TRIGGERED:"excludeLocationIdsFromSidebarTriggered",ENABLE_BUBBLE_ON_PIN_TRIGGERED:"enableBubbleOnPinTriggered",DISABLE_BUBBLE_ON_PIN_TRIGGERED:"disableBubbleOnPinTriggered",ENABLE_BUBBLE_ON_PIN_HOVER_TRIGGERED:"enableBubbleOnPinHoverTriggered",DISABLE_BUBBLE_ON_PIN_HOVER_TRIGGERED:"disableBubbleOnPinHoverTriggered",ENABLE_PIN_DRAG_TRIGGERED:"enablePinDragTriggered",DISABLE_PIN_DRAG_TRIGGERED:"disablePinDragTriggered",ENABLE_MULTI_THREAD_MODE_TRIGGERED:"enableMultiThreadModeTriggered",DISABLE_MULTI_THREAD_MODE_TRIGGERED:"disableMultiThreadModeTriggered",ENABLE_MULTI_THREAD_TRIGGERED:"enableMultiThreadTriggered",DISABLE_MULTI_THREAD_TRIGGERED:"disableMultiThreadTriggered",ENABLE_GROUP_MATCHED_COMMENTS_TRIGGERED:"enableGroupMatchedCommentsTriggered",DISABLE_GROUP_MATCHED_COMMENTS_TRIGGERED:"disableGroupMatchedCommentsTriggered",ENABLE_RESTRICT_TEXT_SEARCH_TO_ANCHOR_TRIGGERED:"enableRestrictTextSearchToAnchorTriggered",DISABLE_RESTRICT_TEXT_SEARCH_TO_ANCHOR_TRIGGERED:"disableRestrictTextSearchToAnchorTriggered",UPDATE_CONTEXT_TRIGGERED:"updateContextTriggered",UPDATE_VISIBILITY_TRIGGERED:"updateVisibilityTriggered",GET_SELECTED_COMMENTS_TRIGGERED:"getSelectedCommentsTriggered",ENABLE_DELETE_REPLY_CONFIRMATION_TRIGGERED:"enableDeleteReplyConfirmationTriggered",DISABLE_DELETE_REPLY_CONFIRMATION_TRIGGERED:"disableDeleteReplyConfirmationTriggered",ON_COPY_LINK_TRIGGERED:"onCopyLinkTriggered",GET_COMMENT_ANNOTATION_BY_ID_TRIGGERED:"getCommentAnnotationByIdTriggered",ENABLE_COLLAPSED_COMMENTS_TRIGGERED:"enableCollapsedCommentsTriggered",DISABLE_COLLAPSED_COMMENTS_TRIGGERED:"disableCollapsedCommentsTriggered",SET_COMMENT_SIDEBAR_DATA_TRIGGERED:"setCommentSidebarDataTriggered",ON_COMMENT_SIDEBAR_INIT_TRIGGERED:"onCommentSidebarInitTriggered",ON_COMMENT_SIDEBAR_DATA_TRIGGERED:"onCommentSidebarDataTriggered",SET_COMMENT_SIDEBAR_DEFAULT_CUSTOM_ACTIONS_TRIGGERED:"setCommentSidebarDefaultCustomActionsTriggered",ENABLE_SIDEBAR_CUSTOM_ACTIONS_TRIGGERED:"enableSidebarCustomActionsTriggered",DISABLE_SIDEBAR_CUSTOM_ACTIONS_TRIGGERED:"disableSidebarCustomActionsTriggered",ENABLE_QUERY_PARAMS_COMMENTS_TRIGGERED:"enableQueryParamsCommentsTriggered",DISABLE_QUERY_PARAMS_COMMENTS_TRIGGERED:"disableQueryParamsCommentsTriggered",ENABLE_RESOLVE_STATUS_ACCESS_ADMIN_ONLY_TRIGGERED:"enableResolveStatusAccessAdminOnlyTriggered",DISABLE_RESOLVE_STATUS_ACCESS_ADMIN_ONLY_TRIGGERED:"disableResolveStatusAccessAdminOnlyTriggered",ENABLE_LINK_CALLBACK_TRIGGERED:"enableLinkCallbackTriggered",DISABLE_LINK_CALLBACK_TRIGGERED:"disableLinkCallbackTriggered",ENABLE_SEEN_BY_USERS_TRIGGERED:"enableSeenByUsersTriggered",DISABLE_SEEN_BY_USERS_TRIGGERED:"disableSeenByUsersTriggered",ENABLE_SHORT_USER_NAME_TRIGGERED:"enableShortUserNameTriggered",DISABLE_SHORT_USER_NAME_TRIGGERED:"disableShortUserNameTriggered",ENABLE_READ_ONLY_TRIGGERED:"enableReadOnlyTriggered",DISABLE_READ_ONLY_TRIGGERED:"disableReadOnlyTriggered",ADD_COMMENT_ANNOTATION_TRIGGERED:"addCommentAnnotationTriggered",APPROVE_COMMENT_ANNOTATION_TRIGGERED:"approveCommentAnnotationTriggered",ACCEPT_COMMENT_ANNOTATION_TRIGGERED:"acceptCommentAnnotationTriggered",REJECT_COMMENT_ANNOTATION_TRIGGERED:"rejectCommentAnnotationTriggered",ACCEPT_SUGGESTION_TRIGGERED:"acceptSuggestionTriggered",REJECT_SUGGESTION_TRIGGERED:"rejectSuggestionTriggered",SUBSCRIBE_COMMENT_ANNOTATION_TRIGGERED:"subscribeCommentAnnotationTriggered",UNSUBSCRIBE_COMMENT_ANNOTATION_TRIGGERED:"unsubscribeCommentAnnotationTriggered",DELETE_COMMENT_ANNOTATION_TRIGGERED:"deleteCommentAnnotationTriggered",GET_COMMENT_ANNOTATIONS_TRIGGERED:"getCommentAnnotationsTriggered",GET_COMMENT_ANNOTATIONS_COUNT_TRIGGERED:"getCommentAnnotationsCountTriggered",ASSIGN_USER_TRIGGERED:"assignUserTriggered",UPDATE_PRIORITY_TRIGGERED:"updatePriorityTriggered",UPDATE_STATUS_TRIGGERED:"updateStatusTriggered",UPDATE_ACCESS_TRIGGERED:"updateAccessTriggered",RESOLVE_COMMENT_ANNOTATION_TRIGGERED:"resolveCommentAnnotationTriggered",GET_LINK_TRIGGERED:"getLinkTriggered",COPY_LINK_TRIGGERED:"copyLinkTriggered",ADD_COMMENT_TRIGGERED:"addCommentTriggered",UPDATE_COMMENT_TRIGGERED:"updateCommentTriggered",DELETE_COMMENT_TRIGGERED:"deleteCommentTriggered",GET_COMMENT_TRIGGERED:"getCommentTriggered",MARK_AS_READ_TRIGGERED:"markAsReadTriggered",MARK_AS_UNREAD_TRIGGERED:"markAsUnreadTriggered",ENABLE_SCREENSHOT_TRIGGERED:"enableScreenshotTriggered",DISABLE_SCREENSHOT_TRIGGERED:"disableScreenshotTriggered",ENABLE_PAGINATED_CONTACT_LIST_TRIGGERED:"enablePaginatedContactListTriggered",DISABLE_PAGINATED_CONTACT_LIST_TRIGGERED:"disablePaginatedContactListTriggered",SUBMIT_COMMENT_TRIGGERED:"submitCommentTriggered",CLEAR_COMPOSER_TRIGGERED:"clearComposerTriggered",GET_COMPOSER_DATA_TRIGGERED:"getComposerDataTriggered",ENABLE_FORMAT_OPTIONS_TRIGGERED:"enableFormatOptionsTriggered",DISABLE_FORMAT_OPTIONS_TRIGGERED:"disableFormatOptionsTriggered",SET_FORMAT_CONFIG_TRIGGERED:"setFormatConfigTriggered",ADD_ATTACHMENT_TRIGGERED:"addAttachmentTriggered",DELETE_ATTACHMENT_TRIGGERED:"deleteAttachmentTriggered",GET_ATTACHMENT_TRIGGERED:"getAttachmentTriggered",DELETE_RECORDING_TRIGGERED:"deleteRecordingTriggered",GET_RECORDING_TRIGGERED:"getRecordingTriggered",REACTION_ADDED:"reactionAdded",REACTION_DELETED:"reactionDeleted",ADD_REACTION_TRIGGERED:"addReactionTriggered",DELETE_REACTION_TRIGGERED:"deleteReactionTriggered",TOGGLE_REACTION_TRIGGERED:"toggleReactionTriggered",ENABLE_CUSTOM_AUTOCOMPLETE_SEARCH_TRIGGERED:"enableCustomAutocompleteSearchTriggered",DISABLE_CUSTOM_AUTOCOMPLETE_SEARCH_TRIGGERED:"disableCustomAutocompleteSearchTriggered",FETCH_COMMENT_ANNOTATIONS_TRIGGERED:"fetchCommentAnnotationsTriggered",SET_TRANSFORM_CONTEXT_TRIGGERED:"setTransformContextTriggered",ENABLE_SVG_AS_IMG_TRIGGERED:"enableSvgAsImgTriggered",DISABLE_SVG_AS_IMG_TRIGGERED:"disableSvgAsImgTriggered",ENABLE_FULL_EXPANDED_TRIGGERED:"enableFullExpandedTriggered",DISABLE_FULL_EXPANDED_TRIGGERED:"disableFullExpandedTriggered",ENABLE_COMMENT_TO_NEAREST_ALLOWED_ELEMENT_TRIGGERED:"enableCommentToNearestAllowedElementTriggered",DISABLE_COMMENT_TO_NEAREST_ALLOWED_ELEMENT_TRIGGERED:"disableCommentToNearestAllowedElementTriggered",ENABLE_DRAFT_MODE_TRIGGERED:"enableDraftModeTriggered",DISABLE_DRAFT_MODE_TRIGGERED:"disableDraftModeTriggered",ENABLE_DRAFT_CONFIRMATION_TRIGGERED:"enableDraftConfirmationTriggered",DISABLE_DRAFT_CONFIRMATION_TRIGGERED:"disableDraftConfirmationTriggered",ENABLE_ID_SCOPED_ANCHORING_TRIGGERED:"enableIdScopedAnchoringTriggered",DISABLE_ID_SCOPED_ANCHORING_TRIGGERED:"disableIdScopedAnchoringTriggered",ENABLE_FILTER_COMMENTS_ON_DOM_TRIGGERED:"enableFilterCommentsOnDomTriggered",DISABLE_FILTER_COMMENTS_ON_DOM_TRIGGERED:"disableFilterCommentsOnDomTriggered",ENABLE_REPLY_AVATARS_TRIGGERED:"enableReplyAvatarsTriggered",DISABLE_REPLY_AVATARS_TRIGGERED:"disableReplyAvatarsTriggered",SET_MAX_REPLY_AVATARS_TRIGGERED:"setMaxReplyAvatarsTriggered",SET_SIDEBAR_BUTTON_COUNT_TYPE_TRIGGERED:"setSidebarButtonCountTypeTriggered",ENABLE_FILTER_GHOST_COMMENTS_IN_SIDEBAR_TRIGGERED:"enableFilterGhostCommentsInSidebarTriggered",DISABLE_FILTER_GHOST_COMMENTS_IN_SIDEBAR_TRIGGERED:"disableFilterGhostCommentsInSidebarTriggered",ENABLE_FULL_SCREEN_IN_SIDEBAR_TRIGGERED:"enableFullScreenInSidebarTriggered",DISABLE_FULL_SCREEN_IN_SIDEBAR_TRIGGERED:"disableFullScreenInSidebarTriggered"},Recording:{RECORDING_TOOL_CLICKED:"recordingToolClicked",RECORDING_ADDED:"recordingAdded",RECORDING_PANEL_SAVE_BUTTON_CLICKED:"recordingPanelSaveButtonClicked",RECORDING_PANEL_CANCEL_BUTTON_CLICKED:"recordingPanelCancelButtonClicked",RECORDING_PANEL_PAUSE_BUTTON_CLICKED:"recordingPanelPauseButtonClicked",RECORDING_PANEL_RESUME_BUTTON_CLICKED:"recordingPanelResumeButtonClicked",RECORDING_PANEL_VIDEO_ON_BUTTON_CLICKED:"recordingPanelVideoOnButtonClicked",RECORDING_PANEL_VIDEO_OFF_BUTTON_CLICKED:"recordingPanelVideoOffButtonClicked",RECORDING_PANEL_AUDIO_ON_BUTTON_CLICKED:"recordingPanelAudioOnButtonClicked",RECORDING_PANEL_AUDIO_OFF_BUTTON_CLICKED:"recordingPanelAudioOffButtonClicked",RECORDING_PANEL_START_BUTTON_CLICKED:"recordingPanelStartButtonClicked",RECORDING_PANEL_PIP_BUTTON_CLICKED:"recordingPanelPipButtonClicked",RECORDING_PLAYED:"recordingPlayed",RECORDING_PAUSED:"recordingPaused",RECORDING_DELETE_TRIGGERED:"recordingDeleteTriggered",RECORDING_DELETED:"recordingDeleted",RECORDING_DRAGGED:"recordingDragged",RECORDING_DRAFT_DRAGGED:"recordingDraftDragged",TRANSCRIPTION_CLICKED:"transcriptionClicked",SUBTITLES_CLICKED:"subtitlesClicked",VIEW_TRANSCRIPTION_SUMMARY_CLICKED:"viewTranscriptionSummaryClicked",TRANSCRIPTION_SUMMARY_COPIED:"transcriptionSummaryCopied",TRANSCRIPTION_TIMESTAMP_CLICKED:"transcriptionTimestampClicked",TRANSCRIPTION_PANEL_DRAGGED:"transcriptionPanelDragged",SUBTITLES_PANEL_DRAGGED:"subtitlesPanelDragged",ENABLE_PLAYBACK_ON_PREVIEW_CLICK_TRIGGERED:"enablePlaybackOnPreviewClickTriggered",DISABLE_PLAYBACK_ON_PREVIEW_CLICK_TRIGGERED:"disablePlaybackOnPreviewClickTriggered",REQUEST_SCREEN_PERMISSION_TRIGGERED:"requestScreenPermissionTriggered",INIT_RECORDING_TRIGGERED:"initRecordingTriggered",ON_RECORDED_DATA_TRIGGERED:"onRecordedDataTriggered",ENABLE_DARK_MODE_TRIGGERED:"enableDarkModeTriggered",DISABLE_DARK_MODE_TRIGGERED:"disableDarkModeTriggered",ENABLE_RECORDING_COUNTDOWN_TRIGGERED:"enableRecordingCountdownTriggered",DISABLE_RECORDING_COUNTDOWN_TRIGGERED:"disableRecordingCountdownTriggered",GET_RECORDING_DATA_BY_RECORDER_ID_TRIGGERED:"getRecordingDataByRecorderIdTriggered",GET_RECORDINGS_TRIGGERED:"getRecordingsTriggered",ENABLE_RECORDING_TRANSCRIPTION_TRIGGERED:"enableRecordingTranscriptionTriggered",DISABLE_RECORDING_TRANSCRIPTION_TRIGGERED:"disableRecordingTranscriptionTriggered",GET_RECORDING_DATA_TRIGGERED:"getRecordingDataTriggered",FETCH_RECORDINGS_TRIGGERED:"fetchRecordingsTriggered",DELETE_RECORDING_TRIGGERED:"deleteRecordingTriggered",ENABLE_VIDEO_EDITOR_TRIGGERED:"enableVideoEditorTriggered",DISABLE_VIDEO_EDITOR_TRIGGERED:"disableVideoEditorTriggered",SET_RECORDING_QUALITY_CONSTRAINTS_TRIGGERED:"setRecordingQualityConstraintsTriggered",SET_RECORDING_ENCODING_OPTIONS_TRIGGERED:"setRecordingEncodingOptionsTriggered",DOWNLOAD_LATEST_VIDEO_TRIGGERED:"downloadLatestVideoTriggered",ENABLE_RECORDING_MIC_TRIGGERED:"enableRecordingMicTriggered",DISABLE_RECORDING_MIC_TRIGGERED:"disableRecordingMicTriggered",ENABLE_RETAKE_ON_VIDEO_EDITOR_TRIGGERED:"enableRetakeOnVideoEditorTriggered",DISABLE_RETAKE_ON_VIDEO_EDITOR_TRIGGERED:"disableRetakeOnVideoEditorTriggered",ASK_DEVICE_PERMISSION_TRIGGERED:"askDevicePermissionTriggered",ENABLE_ONBOARDING_TOOLTIP_TRIGGERED:"enableOnboardingTooltipTriggered",DISABLE_ONBOARDING_TOOLTIP_TRIGGERED:"disableOnboardingTooltipTriggered",SET_MAX_LENGTH_TRIGGERED:"setMaxLengthTriggered",OPEN_PICTURE_IN_PICTURE_TRIGGERED:"openPictureInPictureTriggered",EXIT_PICTURE_IN_PICTURE_TRIGGERED:"exitPictureInPictureTriggered",ENABLE_PICTURE_IN_PICTURE_TRIGGERED:"enablePictureInPictureTriggered",DISABLE_PICTURE_IN_PICTURE_TRIGGERED:"disablePictureInPictureTriggered"},Huddle:{HUDDLE_TOOL_CLICKED:"huddleToolClicked",HUDDLE_CREATED:"huddleCreated",HUDDLE_JOIN_BUTTON_CLICKED:"huddleJoinButtonClicked",HUDDLE_JOINED:"huddleJoined",HUDDLE_LEFT:"huddleLeft",HUDDLE_AUDIO_BUTTON_CLICKED:"huddleAudioButtonClicked",HUDDLE_AUDIO_MUTED:"huddleAudioMuted",HUDDLE_AUDIO_UNMUTED:"huddleAudioUnmuted",HUDDLE_VIDEO_BUTTON_CLICKED:"huddleVideoButtonClicked",HUDDLE_VIDEO_TURNED_ON:"huddleVideoTurnedOn",HUDDLE_VIDEO_TURNED_OFF:"huddleVideoTurnedOff",HUDDLE_SCREENSHARING_BUTTON_CLICKED:"huddleScreensharingButtonClicked",HUDDLE_SCREENSHARING_STARTED:"huddleScreensharingStarted",HUDDLE_SCREENSHARING_STOPPED:"huddleScreensharingStopped",ENABLE_HUDDLE_ON_CURSOR_MODE_TRIGGERED:"enableHuddleOnCursorModeTriggered",DISABLE_HUDDLE_ON_CURSOR_MODE_TRIGGERED:"disableHuddleOnCursorModeTriggered",ENABLE_CHAT_TRIGGERED:"enableChatTriggered",DISABLE_CHAT_TRIGGERED:"disableChatTriggered",ENABLE_FLOCK_MODE_ON_AVATAR_CLICK_TRIGGERED:"enableFlockModeOnAvatarClickTriggered",DISABLE_FLOCK_MODE_ON_AVATAR_CLICK_TRIGGERED:"disableFlockModeOnAvatarClickTriggered"},Presence:{PRESENCE_MULTIPLE_USERS_DETECTED:"presenceMultipleUsersDetected",PRESENCE_USER_STATUS_CHANGED:"presenceUserStatusChanged",PRESENCE_USER_CLICKED:"presenceUserClicked",PRESENCE_SET_CUSTOM_INACTIVITY_TIMER:"presenceSetCustomInactivityTimer",PRESENCE_SET_CUSTOM_OFFLINE_INACTIVITY_TIMER:"presenceSetCustomOfflineInactivityTimer",PRESENCE_SET_CUSTOM_MAX_USERS:"presenceSetCustomMaxUsers",MULTIPLE_USERS_ONLINE:"multipleUsersOnline",ON_USER_STATE_CHANGE:"onUserStateChange",GET_PRESENCE_DATA_TRIGGERED:"getPresenceDataTriggered",GET_ONLINE_USERS_ON_CURRENT_DOCUMENT_TRIGGERED:"getOnlineUsersOnCurrentDocumentTriggered",SET_INACTIVITY_TIME_TRIGGERED:"setInactivityTimeTriggered",ENABLE_FLOCK_MODE_TRIGGERED:"enableFlockModeTriggered",DISABLE_FLOCK_MODE_TRIGGERED:"disableFlockModeTriggered",START_FOLLOWING_USER_TRIGGERED:"startFollowingUserTriggered",STOP_FOLLOWING_USER_TRIGGERED:"stopFollowingUserTriggered",ENABLE_SELF_TRIGGERED:"enableSelfTriggered",DISABLE_SELF_TRIGGERED:"disableSelfTriggered",ADD_USER_TRIGGERED:"addUserTriggered",REMOVE_USER_TRIGGERED:"removeUserTriggered"},Cursor:{CURSOR_MULTIPLE_USERS_DETECTED:"cursorMultipleUsersDetected",CURSOR_SET_CUSTOM_INACTIVITY_TIMER:"cursorSetCustomInactivityTimer",GET_LIVE_CURSORS_ON_CURRENT_DOCUMENT_TRIGGERED:"getLiveCursorsOnCurrentDocumentTriggered",SET_INACTIVITY_TIME_TRIGGERED:"setInactivityTimeTriggered",ALLOWED_ELEMENT_IDS_TRIGGERED:"allowedElementIdsTriggered"},Selection:{SELECTION_CREATED_WHEN_MULTIPLE_USERS_DETECTED:"selectionCreatedWhenMultipleUsersDetected",SELECTION_SET_CUSTOM_INACTIVITY_TIMER:"selectionSetCustomInactivityTimer",ENABLE_LIVE_SELECTION_TRIGGERED:"enableLiveSelectionTriggered",DISABLE_LIVE_SELECTION_TRIGGERED:"disableLiveSelectionTriggered",ENABLE_USER_INDICATOR_TRIGGERED:"enableUserIndicatorTriggered",DISABLE_USER_INDICATOR_TRIGGERED:"disableUserIndicatorTriggered",SET_USER_INDICATOR_POSITION_TRIGGERED:"setUserIndicatorPositionTriggered",SET_USER_INDICATOR_TYPE_TRIGGERED:"setUserIndicatorTypeTriggered",ENABLE_DEFAULT_ELEMENTS_TRACKING_TRIGGERED:"enableDefaultElementsTrackingTriggered",DISABLE_DEFAULT_ELEMENTS_TRACKING_TRIGGERED:"disableDefaultElementsTrackingTriggered",ENABLE_DEFAULT_STYLING_TRIGGERED:"enableDefaultStylingTriggered",DISABLE_DEFAULT_STYLING_TRIGGERED:"disableDefaultStylingTriggered",GET_LIVE_SELECTION_DATA_TRIGGERED:"getLiveSelectionDataTriggered",SET_INACTIVITY_TIME_TRIGGERED:"setInactivityTimeTriggered"},LiveStateSync:{SET_USER_AS_EDITOR_TRIGGERED:"setUserAsEditorTriggered",SET_USER_AS_EDITOR_ERROR:"setUserAsEditorError",REQUEST_EDITOR_ACCESS_TRIGGERED:"requestEditorAccessTriggered",ACCEPT_EDITOR_ACCESS_REQUEST_TRIGGERED:"acceptEditorAccessRequestTriggered",REJECT_EDITOR_ACCESS_REQUEST_TRIGGERED:"rejectEditorAccessRequestTriggered",CANCEL_EDITOR_ACCESS_REQUEST_TRIGGERED:"cancelEditorAccessRequestTriggered",EDIT_CURRENT_TAB_TRIGGERED:"editCurrentTabTriggered",SEM_ACCESS_REQUESTED:"semAccessRequested",SEM_ACCESS_REQUEST_CANCELED:"semAccessRequestCanceled",SEM_ACCESS_ACCEPTED:"semAccessAccepted",SEM_ACCESS_REJECTED:"semAccessRejected",SEM_EDITOR_ASSIGNED:"semEditorAssigned",SEM_VIEWER_ASSIGNED:"semViewerAssigned",SEM_EDITOR_ON_DIFFERENT_TAB_DETECTED:"semEditorOnDifferentTabDetected",SEM_MAKE_EDITOR_TRIGGERED:"semMakeEditorTriggered",SEM_MAKE_READER_TRIGGERED:"semMakeReaderTriggered",SEM_SINGLE_EDITOR_LIVE_STATE_DATA_STATS:"semSingleEditorLiveStateDataStats",SEM_SINGLE_EDITOR_LIVE_STATE_EMPTY_DATA_STATS:"semSingleEditorLiveStateEmptyDataStats",SEM_SINGLE_EDITOR_DETERMINE_EDITOR_STATUS:"semSingleEditorDetermineEditorStatus",SEM_SINGLE_EDITOR_LIVE_STATE_DATA_MISMATCH:"semSingleEditorLiveStateDataMismatch",SEM_SINGLE_EDITOR_DATA_MISMATCH_WITH_EXTERNAL:"semSingleEditorLiveStateDataMismatchWithExternal",SEM_USER_EDITOR_STATS:"semUserEditorStats",REMOVE_EDITOR_ACCESS:"removeEditorAccess",REMOVE_EDITOR_ACCESS_ERROR:"removeEditorAccessError",SEM_SINGLE_EDITOR_LIVE_STATE_DATA_ON_MAKE_EDITOR:"semSingleEditorLiveStateDataOnMakeEditor",SEM_SINGLE_EDITOR_LIVE_STATE_DATA_ON_MAKE_READER:"semSingleEditorLiveStateDataOnMakeReader",GET_LIVE_STATE_DATA_TRIGGERED:"getLiveStateDataTriggered",FETCH_LIVE_STATE_DATA_TRIGGERED:"fetchLiveStateDataTriggered",ENABLE_SINGLE_EDITOR_MODE_TRIGGERED:"enableSingleEditorModeTriggered",DISABLE_SINGLE_EDITOR_MODE_TRIGGERED:"disableSingleEditorModeTriggered",IS_USER_EDITOR_TRIGGERED:"isUserEditorTriggered",GET_EDITOR_TRIGGERED:"getEditorTriggered",RESET_USER_ACCESS_TRIGGERED:"resetUserAccessTriggered",SINGLE_EDITOR_MODE_CONTAINER_IDS_TRIGGERED:"singleEditorModeContainerIdsTriggered",ENABLE_AUTO_SYNC_STATE_TRIGGERED:"enableAutoSyncStateTriggered",DISABLE_AUTO_SYNC_STATE_TRIGGERED:"disableAutoSyncStateTriggered",IS_EDITOR_ACCESS_REQUESTED_TRIGGERED:"isEditorAccessRequestedTriggered",EDITOR_ACCESS_REQUESTED_BY_TRIGGERED:"editorAccessRequestedByTriggered",EDITOR_ACCESS_TRANSFER_ON_TIMEOUT_TRIGGERED:"editorAccessTransferOnTimeoutTriggered",SET_EDITOR_ACCESS_TIMEOUT_TRIGGERED:"setEditorAccessTimeoutTriggered",ENABLE_EDITOR_ACCESS_TRANSFER_ON_TIMEOUT_TRIGGERED:"enableEditorAccessTransferOnTimeoutTriggered",DISABLE_EDITOR_ACCESS_TRANSFER_ON_TIMEOUT_TRIGGERED:"disableEditorAccessTransferOnTimeoutTriggered",ENABLE_DEFAULT_SINGLE_EDITOR_UI_TRIGGERED:"enableDefaultSingleEditorUiTriggered",DISABLE_DEFAULT_SINGLE_EDITOR_UI_TRIGGERED:"disableDefaultSingleEditorUiTriggered",GET_EDITOR_ACCESS_TIMER_TRIGGERED:"getEditorAccessTimerTriggered",ON_SERVER_CONNECTION_STATE_CHANGE_TRIGGERED:"onServerConnectionStateChangeTriggered",UPDATE_USER_PRESENCE_TRIGGERED:"updateUserPresenceTriggered",ENABLE_HEARTBEAT_TRIGGERED:"enableHeartbeatTriggered",DISABLE_HEARTBEAT_TRIGGERED:"disableHeartbeatTriggered"},Tag:{TAG_TOOL_CLICKED:"tagToolClicked",TAG_DRAFT_ADDED:"tagDraftAdded",TAG_ADDED:"tagAdded",TAG_READ:"tagRead",TAG_RESOLVED:"tagResolved",TAG_DRAGGED:"tagDragged",TAG_LINK_COPIED:"tagLinkCopied",TAG_ADD_MODE_ENABLED:"tagAddModeEnabled",TAG_ADD_MODE_DISABLED:"tagAddModeDisabled",TAG_DELETE_TRIGGERED:"tagDeleteTriggered",TAG_DELETED:"tagDeleted",GET_ALL_TAG_ANNOTATIONS_TRIGGERED:"getAllTagAnnotationsTriggered",DELETE_TAG_TRIGGERED:"deleteTagTriggered",ALLOWED_ELEMENT_IDS_TRIGGERED:"allowedElementIdsTriggered",ATTACH_TAG_TRIGGERED:"attachTagTriggered",ADD_TAG_MODE_CHANGE_TRIGGERED:"addTagModeChangeTriggered"},Rewriter:{REWRITER_ENABLED:"rewriterEnabled",REWRITER_MIN_CHARACTER_NOT_MET:"rewriterMinCharacterNotMet",REWRITER_MAX_CHARACTER_NOT_MET:"rewriterMaxCharacterNotMet",REWRITE_BUTTON_CLICKED:"rewriteButtonClicked",REWRITE_PROMPT_BUTTON_CLICKED:"rewritePromptButtonClicked",REWRITE_REFRESH_BUTTON_CLICKED:"rewriteRefreshButtonClicked",REWRITE_OPTION_SELECTED:"rewriteOptionSelected",REWRITE_TASK_CREATED:"rewriteTaskCreated",REWRITE_DIALOG_DRAGGED:"rewriteDialogDragged",REWRITE_SHOW_ORIGINAL_TEXT_CLICKED:"rewriteShowOriginalTextClicked",REWRITE_CLOSE_BUTTON_CLICKED:"rewriteCloseButtonClicked",REWRITE_PROMPT_SUBMITTED:"rewritePromptSubmitted",ENABLE_REWRITER_TRIGGERED:"enableRewriterTriggered",DISABLE_REWRITER_TRIGGERED:"disableRewriterTriggered",ON_TEXT_SELECTED_SUBSCRIBED:"onTextSelectedSubscribed",ASK_AI_TRIGGERED:"askAiTriggered",REPLACE_TEXT_TRIGGERED:"replaceTextTriggered",ADD_COMMENT_FROM_AI_TRIGGERED:"addCommentFromAITriggered"},Feedback:{FEEDBACK_BUTTON_CLICKED:"feedbackButtonClicked",FEEDBACK_SUBMITTED:"feedbackSubmitted"},Contact:{UPDATE_CONTACT_LIST_TRIGGERED:"updateContactListTriggered",UPDATE_ORG_LIST_TRIGGERED:"updateOrgListTriggered",IS_USER_GLOBAL_CONTACT_TRIGGERED:"isUserGlobalContactTriggered",ON_CONTACT_SELECTED_TRIGGERED:"onContactSelectedTriggered",ENABLE_AT_HERE_TRIGGERED:"enableAtHereTriggered",DISABLE_AT_HERE_TRIGGERED:"disableAtHereTriggered",SET_AT_HERE_LABEL_TRIGGERED:"setAtHereLabelTriggered",SET_AT_HERE_DESCRIPTION_TRIGGERED:"setAtHereDescriptionTriggered",UPDATE_CONTACT_LIST_SCOPE_FOR_ORGANIZATION_USERS_TRIGGERED:"updateContactListScopeForOrganizationUsersTriggered",GET_CONTACT_LIST_TRIGGERED:"getContactListTriggered"},ContactUs:{CONTACT_BUTTON_CLICKED:"contactButtonClicked",CONTACT_SUBMITTED:"contactSubmitted"},Bug:{BUG_BUTTON_CLICKED:"bugButtonClicked",BUG_SUBMITTED:"bugSubmitted"},ShareDialog:{SHARE_BUTTON_CLICKED:"shareButtonClicked",DOCUMENT_ACCESS_CHANGED:"documentAccessChanged",DOCUMENT_USER_ACCESS_ADDED:"documentUserAccessAdded",DOCUMENT_USER_ACCESS_REMOVED:"documentUserAccessRemoved",SHARE_LINK_COPIED:"shareLinkCopied"},InviteDialog:{USER_INVITED:"userInvited",INVITE_LINK_COPIED:"inviteLinkCopied"},Iam:{USER_ACCESS_DENIED:"userAccessDenied"},Arrow:{ARROW_TOOL_CLICKED:"arrowToolClicked",ARROW_DRAFT_ADDED:"arrowDraftAdded",ARROW_ADDED:"arrowAdded",ARROW_READ:"arrowRead",ARROW_RESOLVED:"arrowResolved",ARROW_DRAGGED:"arrowDragged",ARROW_LINK_COPIED:"arrowLinkCopied",ARROW_ADD_MODE_ENABLED:"arrowAddModeEnabled",ARROW_ADD_MODE_DISABLED:"arrowAddModeDisabled",ARROW_DELETE_TRIGGERED:"arrowDeleteTriggered",ARROW_DELETED:"arrowDeleted",ALLOWED_ELEMENT_IDS_TRIGGERED:"allowedElementIdsTriggered"},Area:{AREA_TOOL_CLICKED:"areaToolClicked",AREA_ADDED:"areaAdded",AREA_DRAGGED:"areaDragged",AREA_LINK_COPIED:"areaLinkCopied",AREA_ADD_MODE_ENABLED:"areaAddModeEnabled",AREA_ADD_MODE_DISABLED:"areaAddModeDisabled",AREA_DELETE_TRIGGERED:"areaDeleteTriggered",AREA_DELETED:"areaDeleted",ENABLE_AREA_COMMENT_TRIGGERED:"enableAreaCommentTriggered",DISABLE_AREA_COMMENT_TRIGGERED:"disableAreaCommentTriggered"},Doc:{DOCUMENT_ID_SET_TRIGGERED:"documentIdSetTriggered",SET_DOCUMENTS_SUCCESS:"setDocumentsSuccess",SET_LOCATIONS_SUCCESS:"setLocationsSuccess",REMOVE_LOCATIONS_SUCCESS:"removeLocationsSuccess",UNSET_LOCATIONS_SUCCESS:"unsetLocationsSuccess",DOCUMENT_SET_TRIGGERED:"documentSetTriggered",UNSET_DOCUMENTS_TRIGGERED:"unsetDocumentsTriggered",UNSET_DOCUMENTS_SUCCESS:"unsetDocumentsSuccess",DOCUMENTS_SET_TRIGGERED:"documentsSetTriggered",GET_DOCUMENT_METADATA_TRIGGERED:"getDocumentMetadataTriggered"},Reactions:{ENABLE_DARK_MODE_TRIGGERED:"enableDarkModeTriggered",DISABLE_DARK_MODE_TRIGGERED:"disableDarkModeTriggered",SET_CUSTOM_REACTIONS_TRIGGERED:"setCustomReactionsTriggered"},Views:{GET_UNIQUE_VIEWS_BY_USER_TRIGGERED:"getUniqueViewsByUserTriggered",GET_UNIQUE_VIEWS_BY_DATE_TRIGGERED:"getUniqueViewsByDateTriggered"},Notifications:{NOTIFICATION_HISTORY_PANEL_OPENED:"notificationHistoryPanelOpened",ENABLE_SETTINGS_AT_ORGANIZATION_LEVEL_TRIGGERED:"enableSettingsAtOrganizationLevelTriggered",DISABLE_SETTINGS_AT_ORGANIZATION_LEVEL_TRIGGERED:"disableSettingsAtOrganizationLevelTriggered",NOTIFICATION_HISTORY_PANEL_CLOSED:"notificationHistoryPanelClosed",NOTIFICATION_HISTORY_PANEL_TOGGLED:"notificationHistoryPanelToggled",NOTIFICATION_MARK_ALL_AS_READ_CLICKED:"notificationMarkAllAsReadClicked",NOTIFICATION_CLICKED:"notificationClicked",NOTIFICATION_TAB_CLICKED:"notificationTabClicked",NOTIFICATION_READ:"notificationRead",GET_NOTIFICATIONS_FOR_YOU$_TRIGGERED_INTERNAL:"getNotificationsForYou$Triggered_internal",GET_NOTIFICATIONS_BY_DOCUMENT_ID$_TRIGGERED_INTERNAL:"getNotificationsByDocumentId$Triggered_internal",GET_ALL_NOTIFICATIONS$_TRIGGERED_INTERNAL:"getAllNotifications$Triggered_internal",GET_NOTIFICATIONS$_TRIGGERED_INTERNAL:"getNotifications$Triggered_internal",OPEN_HISTORY_PANEL_TRIGGERED:"openHistoryPanelTriggered",CLOSE_HISTORY_PANEL_TRIGGERED:"closeHistoryPanelTriggered",TOGGLE_HISTORY_PANEL_TRIGGERED:"toggleHistoryPanelTriggered",GET_NOTIFICATIONS_DATA_TRIGGERED:"getNotificationsDataTriggered",SET_MAX_DAYS_TRIGGERED:"setMaxDaysTriggered",SET_TAB_CONFIG_TRIGGERED:"setTabConfigTriggered",ENABLE_READ_NOTIFICATIONS_ON_FOR_YOU_TAB_TRIGGERED:"enableReadNotificationsOnForYouTabTriggered",DISABLE_READ_NOTIFICATIONS_ON_FOR_YOU_TAB_TRIGGERED:"disableReadNotificationsOnForYouTabTriggered",SET_ALL_NOTIFICATIONS_AS_READ_TRIGGERED:"setAllNotificationsAsReadTriggered",GET_UNREAD_NOTIFICATIONS_COUNT_TRIGGERED:"getUnreadNotificationsCountTriggered",MARK_NOTIFICATION_AS_READ_BY_ID_TRIGGERED:"markNotificationAsReadByIdTriggered",SET_SETTINGS_TRIGGERED:"setSettingsTriggered",GET_SETTINGS_TRIGGERED:"getSettingsTriggered",MUTE_ALL_NOTIFICATIONS_TRIGGERED:"muteAllNotificationsTriggered",ENABLE_SETTINGS_TRIGGERED:"enableSettingsTriggered",ENABLE_SELF_NOTIFICATIONS_TRIGGERED:"enableSelfNotificationsTriggered",DISABLE_SELF_NOTIFICATIONS_TRIGGERED:"disableSelfNotificationsTriggered",ENABLE_USER_SCOPED_NOTIFICATIONS_TRIGGERED:"enableUserScopedNotificationsTriggered",DISABLE_USER_SCOPED_NOTIFICATIONS_TRIGGERED:"disableUserScopedNotificationsTriggered",DISABLE_SETTINGS_TRIGGERED:"disableSettingsTriggered",SET_SETTINGS_INITIAL_CONFIG_TRIGGERED:"setSettingsInitialConfigTriggered",OPEN_NOTIFICATIONS_PANEL_TRIGGERED:"openNotificationsPanelTriggered",CLOSE_NOTIFICATIONS_PANEL_TRIGGERED:"closeNotificationsPanelTriggered",ENABLE_CURRENT_DOCUMENT_ONLY_TRIGGERED:"enableCurrentDocumentOnlyTriggered",DISABLE_CURRENT_DOCUMENT_ONLY_TRIGGERED:"disableCurrentDocumentOnlyTriggered"},Crdt:{CRDT_DATA_UPDATED:"crdtDataUpdated"},Suggestions:{ENABLE_SUGGESTION_MODE_TRIGGERED:"suggestionsEnableSuggestionModeTriggered",DISABLE_SUGGESTION_MODE_TRIGGERED:"suggestionsDisableSuggestionModeTriggered",IS_SUGGESTION_MODE_ENABLED_TRIGGERED:"suggestionsIsSuggestionModeEnabledTriggered",IS_SUGGESTION_MODE_ENABLED_STREAM_TRIGGERED:"suggestionsIsSuggestionModeEnabledStreamTriggered",ENABLE_INLINE_SUGGESTIONS_TRIGGERED:"suggestionsEnableInlineSuggestionsTriggered",DISABLE_INLINE_SUGGESTIONS_TRIGGERED:"suggestionsDisableInlineSuggestionsTriggered",REGISTER_TARGET_TRIGGERED:"suggestionsRegisterTargetTriggered",UNREGISTER_TARGET_TRIGGERED:"suggestionsUnregisterTargetTriggered",START_SUGGESTION_TRIGGERED:"suggestionsStartSuggestionTriggered",COMMIT_SUGGESTION_TRIGGERED:"suggestionsCommitSuggestionTriggered",GET_SUGGESTIONS_TRIGGERED:"suggestionsGetSuggestionsTriggered",GET_SUGGESTIONS_STREAM_TRIGGERED:"suggestionsGetSuggestionsStreamTriggered",GET_PENDING_SUGGESTION_TRIGGERED:"suggestionsGetPendingSuggestionTriggered",GET_PENDING_SUGGESTION_STREAM_TRIGGERED:"suggestionsGetPendingSuggestionStreamTriggered",ON_TRIGGERED:"suggestionsOnTriggered"}};let t=e;return t})(),XU=[St.Events.Rewriter.REWRITER_ENABLED];var QU=class{constructor(){this.attachmentId=Math.floor(1e5+Math.random()*9e5)}};var aNe={ANNOTATION_ADD:"comment_annotation.add",ANNOTATION_DELETE:"comment_annotation.delete",COMMENT_ADD:"comment.add",COMMENT_UPDATE:"comment.update",COMMENT_DELETE:"comment.delete",STATUS_CHANGE:"comment_annotation.status_change",PRIORITY_CHANGE:"comment_annotation.priority_change",ASSIGN:"comment_annotation.assign",ACCESS_MODE_CHANGE:"comment_annotation.access_mode_change",CUSTOM_LIST_CHANGE:"comment_annotation.custom_list_change",APPROVE:"comment_annotation.approve",ACCEPT:"comment.accept",REJECT:"comment.reject",SUGGESTION_ACCEPT:"comment_annotation.suggestion_accept",SUGGESTION_REJECT:"comment_annotation.suggestion_reject",REACTION_ADD:"comment.reaction_add",REACTION_DELETE:"comment.reaction_delete",SUBSCRIBE:"comment_annotation.subscribe",UNSUBSCRIBE:"comment_annotation.unsubscribe"},cNe={RECORDING_ADD:"recording.add",RECORDING_DELETE:"recording.delete"},lNe={REACTION_ADD:"reaction.add",REACTION_DELETE:"reaction.delete"},uNe={EDITOR_EDIT:"crdt.editor_edit"};var sd=class{};var TR,OT=new Map,JU,LT=t=>t!=null?String(t):void 0,tQ=t=>{if(t.url)try{let e=new URL(t.url);t.baseUrl===void 0&&(t.baseUrl=e.origin),t.path===void 0&&(t.path=e.pathname),t.queryParams===void 0&&(t.queryParams=e.search)}catch{}},pNe=t=>{JU=t},gNe=(t,e)=>{try{if(!t||typeof t!="object")return;let n=JSON.parse(JSON.stringify(t));tQ(n);let r=LT(e);r?OT.set(r,n):TR=n}catch(n){O.catch("Error in setClientPageInfo: ",n)}},mNe=t=>{try{let e=LT(t);e?OT.delete(e):TR=void 0}catch(e){O.catch("Error in clearClientPageInfo: ",e)}},MT=t=>{try{let e=LT(t)??LT(JU?.());return e&&OT.has(e)?OT.get(e):TR}catch(e){O.catch("Error in getClientPageInfo: ",e);return}};var yR;try{yR=typeof Intl<"u"&&Intl.v8BreakIterator}catch{yR=!1}var ZU=(()=>{class t{_platformId=Q(Go);isBrowser=this._platformId?IU(this._platformId):typeof document=="object"&&!!document;EDGE=this.isBrowser&&/(edge)/i.test(navigator.userAgent);TRIDENT=this.isBrowser&&/(msie|trident)/i.test(navigator.userAgent);BLINK=this.isBrowser&&!!(window.chrome||yR)&&typeof CSS<"u"&&!this.EDGE&&!this.TRIDENT;WEBKIT=this.isBrowser&&/AppleWebKit/i.test(navigator.userAgent)&&!this.BLINK&&!this.EDGE&&!this.TRIDENT;IOS=this.isBrowser&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!("MSStream"in window);FIREFOX=this.isBrowser&&/(firefox|minefield)/i.test(navigator.userAgent);ANDROID=this.isBrowser&&/android/i.test(navigator.userAgent)&&!this.TRIDENT;SAFARI=this.isBrowser&&/safari/i.test(navigator.userAgent)&&this.WEBKIT;constructor(){}static \u0275fac=function(r){return new(r||t)};static \u0275prov=Z({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();function IR(t){return Array.isArray(t)?t:[t]}var eV=new Set,Bc,nV=(()=>{class t{_platform=Q(ZU);_nonce=Q(Zu,{optional:!0});_matchMedia;constructor(){this._matchMedia=this._platform.isBrowser&&window.matchMedia?window.matchMedia.bind(window):rQ}matchMedia(n){return(this._platform.WEBKIT||this._platform.BLINK)&&nQ(n,this._nonce),this._matchMedia(n)}static \u0275fac=function(r){return new(r||t)};static \u0275prov=Z({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();function nQ(t,e){if(!eV.has(t))try{Bc||(Bc=document.createElement("style"),e&&Bc.setAttribute("nonce",e),Bc.setAttribute("type","text/css"),document.head.appendChild(Bc)),Bc.sheet&&(Bc.sheet.insertRule(`@media ${t} {body{ }}`,0),eV.add(t))}catch(n){console.error(n)}}function rQ(t){return{matches:t==="all"||t==="",media:t,addListener:()=>{},removeListener:()=>{}}}var iQ=(()=>{class t{_mediaMatcher=Q(nV);_zone=Q(Re);_queries=new Map;_destroySubject=new Be;constructor(){}ngOnDestroy(){this._destroySubject.next(),this._destroySubject.complete()}isMatched(n){return tV(IR(n)).some(i=>this._registerQuery(i).mql.matches)}observe(n){let i=tV(IR(n)).map(s=>this._registerQuery(s).observable),o=sc(i);return o=ys(o.pipe(Tn(1)),o.pipe(fE(1),dE(0))),o.pipe(De(s=>{let a={matches:!1,breakpoints:{}};return s.forEach(({matches:c,query:l})=>{a.matches=a.matches||c,a.breakpoints[l]=c}),a}))}_registerQuery(n){if(this._queries.has(n))return this._queries.get(n);let r=this._mediaMatcher.matchMedia(n),o={observable:new he(s=>{let a=c=>this._zone.run(()=>s.next(c));return r.addListener(a),()=>{r.removeListener(a)}}).pipe(rn(r),De(({matches:s})=>({query:n,matches:s})),Is(this._destroySubject)),mql:r};return this._queries.set(n,o),o}static \u0275fac=function(r){return new(r||t)};static \u0275prov=Z({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();function tV(t){return t.map(e=>e.split(",")).reduce((e,n)=>e.concat(n)).map(e=>e.trim())}var lp={XSmall:"(max-width: 599.98px)",Small:"(min-width: 600px) and (max-width: 959.98px)",Medium:"(min-width: 960px) and (max-width: 1279.98px)",Large:"(min-width: 1280px) and (max-width: 1919.98px)",XLarge:"(min-width: 1920px)",Handset:"(max-width: 599.98px) and (orientation: portrait), (max-width: 959.98px) and (orientation: landscape)",Tablet:"(min-width: 600px) and (max-width: 839.98px) and (orientation: portrait), (min-width: 960px) and (max-width: 1279.98px) and (orientation: landscape)",Web:"(min-width: 840px) and (orientation: portrait), (min-width: 1280px) and (orientation: landscape)",HandsetPortrait:"(max-width: 599.98px) and (orientation: portrait)",TabletPortrait:"(min-width: 600px) and (max-width: 839.98px) and (orientation: portrait)",WebPortrait:"(min-width: 840px) and (orientation: portrait)",HandsetLandscape:"(max-width: 959.98px) and (orientation: landscape)",TabletLandscape:"(min-width: 960px) and (max-width: 1279.98px) and (orientation: landscape)",WebLandscape:"(min-width: 1280px) and (orientation: landscape)"};var Wr=(()=>{let e=class e{constructor(){try{this.userAgent=navigator.userAgent,this.browserName=this.getBrowserName(),this.browserVersion=this.getBrowserVersion(),this.deviceType=this.getDeviceType(),this.orientation=this.getOrientation(),this.osName=this.getOSName(),this.osVersion=this.getOSVersion(),this.screenWidth=this.getScreenWidth(),this.screenHeight=this.getScreenHeight()}catch{}}getBrowserName(){try{return(navigator.userAgent.indexOf("Opera")||navigator.userAgent.indexOf("OPR"))!=-1?"Opera":navigator.userAgent.indexOf("Chrome")!=-1?"Chrome":navigator.userAgent.indexOf("Safari")!=-1?"Safari":navigator.userAgent.indexOf("Firefox")!=-1?"Firefox":navigator.userAgent.indexOf("MSIE")!=-1||document?.documentMode?"IE":"Unknown"}catch{return"Unknown"}}getDeviceType(){try{return e.Breakpoints[lp.Handset]?Ir.MOBILE:e.Breakpoints[lp.Tablet]?Ir.TABLET:e.Breakpoints[lp.XLarge]?Ir.MONITOR:e.Breakpoints[lp.Web]?Ir.DESKTOP:Ir.UNKNOWN}catch{return Ir.UNKNOWN}}getOrientation(){try{return e.Orientations[AT.Portrait]?id.PORTRAIT:e.Orientations[AT.Landscape]?id.LANDSCAPE:id.UNKNOWN}catch{return id.UNKNOWN}}getOSName(){try{return navigator.userAgent.indexOf("Windows")!=-1?"Windows":navigator.userAgent.indexOf("Macintosh")!=-1?"Macintosh":navigator.userAgent.indexOf("Linux")!=-1?"Linux":"Unknown"}catch{return"Unknown"}}getOSVersion(){try{let s=navigator?.userAgent,a="Unknown";if(s.indexOf("Windows")!==-1)s.indexOf("Windows NT 5.1")!==-1?a="Windows XP":s.indexOf("Windows NT 6.0")!==-1?a="Windows Vista":s.indexOf("Windows NT 6.1")!==-1?a="Windows 7":s.indexOf("Windows NT 6.2")!==-1?a="Windows 8":s.indexOf("Windows NT 6.3")!==-1?a="Windows 8.1":s.indexOf("Windows NT 10.0")!==-1&&(a="Windows 10");else if(s.indexOf("Mac OS X")!==-1)a=s.match(/Mac OS X ([0-9_.]+)/)[1],a=a.replace(/_/g,".");else if(s.indexOf("iOS")!==-1)a=s.match(/OS ([0-9_.]+) like Mac OS X/)[1],a=a.replace(/_/g,".");else if(s.indexOf("Firefox")!==-1){var r=/\(([^)]+)\)/,i=r.exec(s)[1],o=i.split("; ");a=o[2]}return a||"Unknown"}catch{return"Unknown"}}getBrowserVersion(){try{return this.browserName=="Opera"?this.getOperaVersion():this.browserName=="Chrome"?this.getChromeVersion():this.browserName=="Safari"?this.getSafariVersion():this.browserName=="Firefox"?this.getFirefoxVersion():this.browserName=="IE"?this.getIEVersion():"Unknown"}catch{return"Unknown"}}getOperaVersion(){try{var r=navigator.userAgent.match(/(?:Opera|OPR)\/(\d+)/);return r?r[1]:"Unknown"}catch{return"Unknown"}}getChromeVersion(){try{var r=navigator.userAgent.match(/(?:Chrome|Chromium)\/(\d+)/);return r?r[1]:"Unknown"}catch{return"Unknown"}}getSafariVersion(){try{var r=navigator.userAgent.match(/Version\/(\d+)/);return r?r[1]:"Unknown"}catch{return"Unknown"}}getFirefoxVersion(){try{var r=navigator.userAgent.match(/Firefox\/(\d+)/);return r?r[1]:"Unknown"}catch{return"Unknown"}}getIEVersion(){try{var r=navigator.userAgent.match(/MSIE (\d+)/);return r?r[1]:"Unknown"}catch{return"Unknown"}}getScreenWidth(){try{return window.screen.width}catch{return 0}}getScreenHeight(){try{return window.screen.height}catch{return 0}}getDeviceInfo(){try{return this.userAgent=navigator.userAgent,this.browserName=this.getBrowserName(),this.browserVersion=this.getBrowserVersion(),this.deviceType=this.getDeviceType(),this.orientation=this.getOrientation(),this.osName=this.getOSName(),this.osVersion=this.getOSVersion(),this.screenWidth=this.getScreenWidth(),this.screenHeight=this.getScreenHeight(),JSON.parse(JSON.stringify(this))}catch{return{browserName:"Unknown",browserVersion:"Unknown",deviceType:"Unknown",osName:"Unknown",osVersion:"Unknown",screenWidth:0,screenHeight:0,userAgent:"Unknown"}}}};e.Breakpoints={},e.Orientations={};let t=e;return t})();var _t=class{constructor(e=!0){this.deviceInfo=new Wr().getDeviceInfo();try{if(e){let n=MT();n&&Object.assign(this,n)}}catch{}}};var rV=class{constructor(){this.targetElements=[],this.type="area",this.props=new sd,this.pageInfo=new _t,this.targetAnnotations=[]}};var iV=class{constructor(){this.type="arrow",this.props=new sd,this.pageInfo=new _t}};var WNe={COPY_LINK:"copy-link",DELETE:"delete"},zNe={COPY_LINK:"Copy link",LINK_COPIED:"Link copied!",DELETE_THREAD:"Delete thread"};var oV=class{constructor(){this.comments=[],this.commentCategories=[],this.type="comment",this.status=k.CommentAnnotationStatusMap.OPEN,this.pageInfo=new _t,this.iam=new vR,this.customList=[],this.subscribedUsers={},this.unsubscribedUsers={},this.subscribedGroups={}}};var vR=class{constructor(){this.accessMode=CT.PUBLIC}};var sV=class{constructor(){this.commentId=Math.floor(1e5+Math.random()*9e5),this.type="text",this.to=[],this.status="added",this.attachments=[],this.recorders=[],this.reactionAnnotationIds=[],this.taggedUserContacts=[],this.customList=[],this.toOrganizationUserGroup=[],this.reactionAnnotations=[]}};var PT=class{constructor(){this.urlAllowList=[],this.featureAllowList=[],this.userPlanAllowList=[],this.userIdAllowList=[],this.userGroupIdAllowList=[],this.debugMode=!1,this.usePrefersColorScheme=!1,this.advancedQueriesDisabled=!1,this.globalStyles=!0}},aV=["core","rest-api","recorder-media","ai","agents","huddle-webrtc","integrations-workflow","superflow","billing-stripe","migrations","legacy-v1","velt-internal"];var SR=(function(t){return t.RESOLVE_USERS="resolveUsers",t.FORMAT_RESPONSE="formatResponse",t.MERGE_USER_WITH_PROVIDED_USER_DATA="mergeUserWithProvidedUserData",t.GET_TEMPORARY_USERS="getTemporaryUsers",t.SET_SINGLE_EDITOR_MODE_LIVE_STATE_DATA_FOR_DIFFERENT_USER_PRESENT_ON_TAB="setSingleEditorModeLiveStateDataForDifferentUserPresentOnTab",t.RESOLVE_AND_MERGE_SINGLE_EDITOR_LIVE_STATE_DATA_WITH_USER="resolveAndMergeSingleEditorLiveStateDataWithUser",t.GET_SINGLE_EDITOR_MODE_DATA="getSingleEditorModeData",t.RESOLVE_USERS_FROM_HUDDLE_MESSAGES="resolveUsersFromHuddleMessages",t.RESOLVE_USER_IDS_BY_EMAIL="resolveUserIdsByEmail",t})(SR||{}),xT=(function(t){return t.IDENTIFY="identify/authProvider",t.GET_TEMPORARY_USERS="getTemporaryUsers",t.GET_USERS="getUsers",t.GET_HUDDLE_USERS="getHuddleUsers",t.GET_SINGLE_EDITOR_USERS="getSingleEditorUsers",t})(xT||{}),oQ=(function(t){return t.RESOLVE_COMMENT_ANNOTATIONS="resolveCommentAnnotations",t.SAVE_COMMENT_ANNOTATION="saveCommentAnnotation",t.DELETE_COMMENT_ANNOTATION="deleteCommentAnnotation",t.FORMAT_RESPONSE="formatResponse",t.INIT_DOCUMENTS="initDocuments",t.SET_DATA="setData",t.UPDATE_DATA="updateData",t.DELETE_DATA="deleteData",t})(oQ||{}),sQ=(function(t){return t.SAVE_ATTACHMENT="saveAttachment",t.DELETE_ATTACHMENT="deleteAttachment",t.UPLOAD_TO_RESOLVER="uploadToResolver",t})(sQ||{}),aQ=(function(t){return t.RESOLVE_REACTION_ANNOTATIONS="resolveReactionAnnotations",t.SAVE_REACTION_ANNOTATION="saveReactionAnnotation",t.DELETE_REACTION_ANNOTATION="deleteReactionAnnotation",t.FORMAT_RESPONSE="formatResponse",t.INIT_DOCUMENTS="initDocuments",t.SET_DATA="setData",t.UPDATE_DATA="updateData",t.DELETE_DATA="deleteData",t})(aQ||{}),cV;cV||(cV={});var cQ=(function(t){return t.SET_DOCUMENTS="setDocuments",t.GET_COMMENT_ANNOTATIONS="getCommentAnnotations",t.GET_NOTIFICATIONS="getNotifications",t})(cQ||{}),lV;lV||(lV={});var lQ=(function(t){return t.SET_DOCUMENTS="setDocuments",t.GET_REACTION_ANNOTATIONS="getReactionAnnotations",t})(lQ||{}),uQ=(function(t){return t.RESOLVE_RECORDER_ANNOTATIONS="resolveRecorderAnnotations",t.SAVE_RECORDER_ANNOTATION="saveRecorderAnnotation",t.DELETE_RECORDER_ANNOTATION="deleteRecorderAnnotation",t.FORMAT_RESPONSE="formatResponse",t.INIT_DOCUMENTS="initDocuments",t.SET_DATA="setData",t.UPDATE_DATA="updateData",t.DELETE_DATA="deleteData",t})(uQ||{}),dQ=(function(t){return t.GET_RECORDER_ANNOTATIONS="getRecorderAnnotations",t})(dQ||{}),hQ=(function(t){return t.RESOLVE_NOTIFICATIONS="resolveNotifications",t.DELETE_NOTIFICATION="deleteNotification",t.DELETE_DATA="deleteData",t.FORMAT_RESPONSE="formatResponse",t})(hQ||{}),fQ=(function(t){return t.GET_NOTIFICATIONS="getNotifications",t})(fQ||{}),pQ=(function(t){return t.RESOLVE_ACTIVITIES="resolveActivities",t.SAVE_ACTIVITY="saveActivity",t.FORMAT_RESPONSE="formatResponse",t})(pQ||{}),gQ=(function(t){return t.GET_ACTIVITIES="getActivities",t})(gQ||{}),mQ=(function(t){return t.SET_DOCUMENTS="setDocuments",t.SET_ROOT_DOCUMENT="setRootDocument",t.SET_DOCUMENT_ID="setDocumentId",t.UNSET_DOCUMENT_ID="unsetDocumentId",t.UNSET_DOCUMENTS="unsetDocuments",t.SET_LOCATION="setLocation",t.SET_LOCATIONS="setLocations",t.SET_ROOT_LOCATION="setRootLocation",t.ADD_LOCATION="addLocation",t.REMOVE_LOCATION="removeLocation",t.REMOVE_LOCATIONS="removeLocations",t.UNSET_LOCATION_IDS="unsetLocationIds",t.REMOVE_LOCATIONS_SUCCESS="removeLocationsSuccess",t})(mQ||{});var uV=class{constructor(){this.pageInfo=new _t}};var dV=class{constructor(){this.documentAccessType=kn.PUBLIC,this.accessType=kn.PUBLIC,this.disabled=!1,this.features={},this.users={}}};var hV=class{};var fV=class{};var pV=class{};var so=class{constructor(){this.contacts=[]}};var Ebe={DOCUMENT_UNSET:"document_unset",USER_LOGOUT:"user_logout"},kT={SET_DOCUMENTS:"setDocuments",IDENTIFY:"identify",GET_NOTIFICATIONS:"getNotifications",SET_NOTIFICATIONS:"setNotifications",REVOKE_ACCESS_ON_USER_LOGOUT:"revokeAccessOnUserLogout",REVOKE_ACCESS_ON_DOCUMENT_UNSET:"revokeAccessOnDocumentUnset"},gV={FOLDER:"folder",DOCUMENT:"document",ORGANIZATION:"organization",CONTEXT:"context"};var mV=class{constructor(){this.id=Math.floor(1e5+Math.random()*9e5)}};var EV=class{constructor(){this.singleTabEditor=!0}};var _V=class{constructor(){this.state="idle"}};var Gc=class{};var TV=class{};var yV=class{constructor(){this.type="multiThread"}};var IV=class{constructor(){this.pageInfo=new _t}};var vV=class{constructor(){this.type="audio"}},SV=class{constructor(){this.type="audio"}},AV=class{constructor(){this.getThumbnailTag=e=>`
|
|
120
120
|
<a href="${this.videoPlayerUrl}" target="_blank">
|
|
121
121
|
<img src="${e||this.thumbnailWithPlayIconUrl||this.thumbnailUrl}" />
|
|
122
122
|
</a>
|
|
@@ -147,7 +147,7 @@ ${n.map((r,i)=>`${i+1}) ${r.toString()}`).join(`
|
|
|
147
147
|
`):" (no events recorded)")+`
|
|
148
148
|
This block prints once per distinct problem. If a realtime feature looks stuck, copy it into the issue \u2014 it contains no credentials.`)}catch{}}var A2="license_terminated",QN=5*6e4,C2=.2,Vp="internal-licenseRetry",D2=Math.round(QN*(1+C2)),zne={unlicensed:!0,valid:!0,"expiring-soon":!0,"in-grace":!0,terminated:!0},qne=new Set(Object.keys(zne)),Kne=64,Yne=300;function il(t){try{if(!t||typeof t!="object"||Array.isArray(t))return null;let e=t;if(typeof e.state!="string"||!qne.has(e.state))return null;let n=S2(e.expiresAt),r=S2(e.terminatesAt);return V(V({state:e.state},n?{expiresAt:n}:{}),r?{terminatesAt:r}:{})}catch{return null}}var Xne=/^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}(:\d{2}(\.\d{1,9})?)?(Z|[+-]\d{2}:\d{2})?)?$/;function S2(t){return typeof t=="string"&&t.length<=Kne&&Xne.test(t)&&Number.isFinite(Date.parse(t))?t:void 0}function JN(t){return typeof t=="string"&&t?t.slice(0,Yne):void 0}function Ny(t){try{return t?.code===A2}catch{return!1}}function D1e(t){try{let e=t;return!e||typeof e!="object"||e.ok===!0?!1:e.reasonCode===A2}catch{return!1}}function ZN(t){let e=Number.isFinite(t)?Math.min(Math.max(t,0),1):0;return Math.round(QN*(1+C2*e))}var Qne=new Set(["internal","unavailable","deadline-exceeded","resource-exhausted","cancelled","aborted","unknown"]);function R2(t){try{let e=t?.code;return typeof e!="string"||e===""?!0:Qne.has(e.startsWith("functions/")?e.slice(10):e)}catch{return!0}}function R1e(t,e){let n=e&&typeof e=="object"?e:{},r=JN(n.message);return V({source:t,license:il(n.license)},r?{message:r}:{})}var N2=null;function b2(t){N2=t}function N1e(t){try{N2?.(t)}catch(e){O.catch("Error in the portable license refusal listener: ",e)}}var Dy={gateway:{prefix:"Velt [portable backend]",refuses:"its gateway refuses new sessions",stops:"its gateway stops accepting new sessions",open:"Connections that are already open keep working.",asks:"it asks the gateway again",label:"Gateway"},"hosted-callable":{prefix:"Velt [self-hosted]",refuses:"it refuses new sign-ins",stops:"it stops accepting new sign-ins",open:"Users who are already signed in stay signed in.",asks:"it asks again",label:"Backend"}},Ry=class{constructor(e){this.emit=e,this.refusedState=null,this.namedRefusedState=null,this.servedState=null,this.dates={},this.warned=new Set}refused(e,n,r="gateway"){try{let i=e&&(e.state==="terminated"||e.state==="unlicensed")?e.state:null;i&&(this.namedRefusedState=i),this.rememberDates(e);let o=i??this.namedRefusedState??"terminated";if(this.refusedState===o)return;this.refusedState=o;let s=Dy[r]??Dy.gateway,a=o==="unlicensed"?`This self-hosted Velt deployment has no license installed, so ${s.refuses} until the operator uploads one.`:`This self-hosted Velt deployment's license has been terminated${this.dates.terminatesAt?` (since ${this.dates.terminatesAt})`:""}, so ${s.refuses} until the operator uploads a renewal.`;this.emit(le(V({code:"license_terminated",state:o},this.dates),{message:a}));let c=Math.round(QN/6e4);this.warnOnce("refused",`${s.prefix}: ${a} ${s.open} The SDK does not retry in a loop: ${s.asks} after ${c} minutes or more, and on the next identify() or page load. The app gets one 'error' event per state change (code 'license_terminated'), and 'license_restored' once a session is granted again.`,n,s.label)}catch{}}served(e,n,r="gateway"){try{let i=this.refusedState!==null;this.refusedState=null,this.namedRefusedState=null,this.rememberDates(e);let o=e?.state??null;i&&this.emit(le(V(V({code:"license_restored"},o?{state:o}:{}),this.dates),{message:"This self-hosted Velt deployment accepts new sessions again."}));let s=o!==this.servedState;if(this.servedState=o,o!=="in-grace"&&o!=="expiring-soon"||n==="renewal"&&!s)return;let a=this.dates,c=Dy[r]??Dy.gateway;if(o==="in-grace"){let l=`This self-hosted Velt deployment's license expired${a.expiresAt?` on ${a.expiresAt}`:""} and is in its grace period: everything keeps working until ${a.terminatesAt??"the grace period ends"}, when ${c.stops}.`;this.emit(le(V({code:"license_in_grace",state:o},a),{message:l})),this.warnOnce("in-grace",`${c.prefix}: ${l} Ask the operator to upload a renewal.`);return}this.emit(le(V({code:"license_expiring_soon",state:o},a),{message:`This self-hosted Velt deployment's license expires${a.expiresAt?` on ${a.expiresAt}`:" soon"}.`}))}catch{}}rememberDates(e){e&&(this.dates=V(V({},e.expiresAt?{expiresAt:e.expiresAt}:{}),e.terminatesAt?{terminatesAt:e.terminatesAt}:{}))}warnOnce(e,n,r,i="Gateway"){this.warned.has(e)||(this.warned.add(e),r?console.warn(n,`${i}: ${r}`):console.warn(n))}};var Jne="api_key_disabled";function L1e(t){try{let e=t;return!e||typeof e!="object"||e.ok===!0?!1:e.reasonCode===Jne}catch{return!1}}var w2=null;function O2(t){w2=t}function M1e(){try{w2?.()}catch(t){O.catch("Error in the portable API-key refusal listener: ",t)}}var Zne={fetch:(t,e)=>fetch(t,e)},ere=5e3;function tre(t){return`${t.replace(/\/+$/,"")}/operations/getProjectConfig`}function nre(t,e){return y(this,null,function*(){let n=typeof AbortController<"u"?new AbortController:null,r,i=new Promise(o=>{r=setTimeout(()=>{try{n?.abort()}catch{}o(null)},ere)});try{return yield Promise.race([Zne.fetch(t,n?le(V({},e),{signal:n.signal}):e),i])}finally{r!==void 0&&clearTimeout(r)}})}function eb(t){return y(this,null,function*(){let{apiEndpoint:e,token:n}=t;if(!e||!n)return null;if(!nl(e))return console.error(`Velt [portable backend]: refusing to send the session token to an insecure apiEndpoint (${e}). Project config was not read; https is required (http is allowed on loopback only).`),null;try{let r=yield nre(tre(e),{method:"POST",headers:{Authorization:`Bearer ${n}`,"Content-Type":"application/json"},body:JSON.stringify({})});if(!r)return null;let i=yield r.json();return!i||i.ok!==!0||!i.data?null:{isPrivateCommentsEnabled:i.data.isPrivateCommentsEnabled===!0,activityConfig:i.data.activityConfig??null}}catch{return null}})}function tb(t,e,n){return t.userSnippylyId!==e?.userSnippylyId||e?.groupId!==t.groupId||e?.organizationId!==t.organizationId||!!n?.forceReset}function nb(t,e){let{provided:n,resolved:r}=e;return t.name=r?r?.name:n?.name||t.name,t.clientUserName=r?r?.clientUserName:n?.clientUserName||t.clientUserName,t.photoUrl=r?r?.photoUrl:n?.photoUrl||t.photoUrl,t?.photoUrl===void 0&&(t.photoUrl=null),t.email=r?r?.email:n?.email||t.email,t.color=r?.color||n?.color||e.avatarColor(t.userId),t.textColor=r?.textColor||n?.textColor||e.textColor(t.userId),t.initial=r?.initial||n?.initial||t.initial||t.name?.charAt(0).toUpperCase()||t.email?.charAt(0).toUpperCase(),t.contacts=n?.contacts||t.contacts,t.plan=n?.plan||t.plan,t.groupId=n?.groupId||t.groupId,t.clientGroupId=n?.clientGroupId||t.clientGroupId,t.clientOrganizationId=n?.clientOrganizationId||t.clientOrganizationId,t.organizationId=n?.organizationId||t.organizationId,t.isAdmin=n?.isAdmin,t.isReadOnly=n?.isReadOnly,t.isAnonymous=n?.isAnonymous,t.isGuest=n?.isGuest,t}var rre=["unauthenticated","permission-denied","not-found","invalid-argument","failed-precondition","resource-exhausted"],L2=[...rre,"unimplemented"];function M2(t){return!!t&&t.backend==="portable"&&typeof t.wsEndpoint=="string"&&typeof t.apiEndpoint=="string"}var B1e="getaccess-any-user",G1e="ordered-deltas",j1e="doc-notification-views",H1e="fetch-folders-include-children",$1e="notification-timestamp-by-document",W1e="per-editor-crdt-fold",z1e="attachments",q1e="comment-views-updated-at",K1e="organization-user-config",Y1e="organization-directory",X1e="customer-metadata",Q1e="multi-thread",J1e="organization-user-search";var by={import:()=>import("./velt-portable.js")},Sr=null,Bp=!1;function P2(t){if(Sr)Sr=Sr.then(()=>by.import().then(e=>{Bp=!0,e.default(t)})).catch(e=>{O.catch("Error re-establishing portable session after re-identify: ",e)});else{let e=by.import().then(n=>{Bp=!0,n.default(t)}).catch(n=>{Sr===e&&(Sr=null),Bp=!1,console.warn("Velt [portable backend]: failed to load the portable transport chunk (velt-portable.js). Portable features are disabled for this page load.",n)});Sr=e}return Sr}function x2(){Sr&&(Sr=Sr.then(()=>Bp?by.import().then(t=>{t.teardownPortableBackend()}):void 0).catch(t=>{O.catch("Error tearing down portable backend session: ",t)}))}function k2(){Sr&&(Sr=Sr.then(()=>Bp?by.import().then(t=>{t.checkPortableBackendLiveness?.()}):void 0).catch(t=>{O.catch("Error checking portable backend liveness: ",t)}))}var F2=(()=>{let e=class e{constructor(r){this.loggingService=r,this.initLocalStorageData()}initLocalStorageData(){this.loggingService.log("%c[WB] Calling FUNCTION: initLocalStorageData","color: green;"),this.getLocalStorageData(),this.getSessionStorageData()}getLocalStorageData(){this.loggingService.log("%c[WB] Calling FUNCTION: getLocalStorageData","color: green;");try{let r=localStorage?.getItem(k.LOCALSTORAGE_DATA_ID);if(r)return JSON.parse(r);{let i=new Gc;return this.setLocalStorageData(i),i}}catch(r){return this.loggingService.catch("Error in getLocalStorageData:",r),new Gc}}setLocalStorageData(r){this.loggingService.log("%c[WB] Calling FUNCTION: setLocalStorageData","color: green;");try{if(r){let i=JSON.stringify(r);localStorage?.setItem(k.LOCALSTORAGE_DATA_ID,i)}}catch(i){this.loggingService.catch("Error in setLocalStorageData:",i)}}deleteLocalStorageData(){this.loggingService.log("%c[WB] Calling FUNCTION: deleteLocalStorageData","color: green;"),localStorage?.removeItem(k.LOCALSTORAGE_DATA_ID)}getSessionStorageData(){this.loggingService.log("%c[WB] Calling FUNCTION: getSessionStorageData","color: green;");try{let r=sessionStorage?.getItem(k.LOCALSTORAGE_DATA_ID);if(r)return JSON.parse(r);{let i=new Gc;return this.setSessionStorageData(i),i}}catch(r){return this.loggingService.catch("Error in getSessionStorageData:",r),new Gc}}setSessionStorageData(r){this.loggingService.log("%c[WB] Calling FUNCTION: setSessionStorageData","color: green;");try{if(r){let i=JSON.stringify(r);sessionStorage?.setItem(k.LOCALSTORAGE_DATA_ID,i)}}catch(i){this.loggingService.catch("Error in setSessionStorageData:",i)}}deleteSessionStorageData(){this.loggingService.log("%c[WB] Calling FUNCTION: deleteSessionStorageData","color: green;");try{sessionStorage?.removeItem(k.LOCALSTORAGE_DATA_ID)}catch(r){this.loggingService.catch("Error in deleteSessionStorageData:",r)}}};e.\u0275fac=function(i){return new(i||e)(q(Nt))},e.\u0275prov=Z({token:e,factory:e.\u0275fac,providedIn:"root"});let t=e;return t})();var U2=(()=>{let e=class e{constructor(r,i){this.localStorageService=r,this.loggingService=i,this.avatarList=[{userId:"1",name:"Bear",photoUrl:"https://snippyly.com/assets/avatars/avatar-bear.svg",type:"anonymous"},{userId:"2",name:"Beaver",photoUrl:"https://snippyly.com/assets/avatars/avatar-beaver.svg",type:"anonymous"},{userId:"3",name:"Bunny",photoUrl:"https://snippyly.com/assets/avatars/avatar-bunny.svg",type:"anonymous"},{userId:"4",name:"Cat",photoUrl:"https://snippyly.com/assets/avatars/avatar-cat.svg",type:"anonymous"},{userId:"5",name:"Cow",photoUrl:"https://snippyly.com/assets/avatars/avatar-cow.svg",type:"anonymous"},{userId:"6",name:"Dinosaur",photoUrl:"https://snippyly.com/assets/avatars/avatar-dinosaur.svg",type:"anonymous"},{userId:"7",name:"Elephant",photoUrl:"https://snippyly.com/assets/avatars/avatar-elephant.svg",type:"anonymous"},{userId:"8",name:"Monkey",photoUrl:"https://snippyly.com/assets/avatars/avatar-monkey.svg",type:"anonymous"},{userId:"9",name:"Hedgehog",photoUrl:"https://snippyly.com/assets/avatars/avatar-hedgehog.svg",type:"anonymous"},{userId:"10",name:"Hippo",photoUrl:"https://snippyly.com/assets/avatars/avatar-hippo.svg",type:"anonymous"},{userId:"11",name:"Horse",photoUrl:"https://snippyly.com/assets/avatars/avatar-horse.svg",type:"anonymous"},{userId:"12",name:"Kitten",photoUrl:"https://snippyly.com/assets/avatars/avatar-kitten.svg",type:"anonymous"},{userId:"13",name:"Octopus",photoUrl:"https://snippyly.com/assets/avatars/avatar-octopus.svg",type:"anonymous"},{userId:"14",name:"Oink",photoUrl:"https://snippyly.com/assets/avatars/avatar-oink.svg",type:"anonymous"},{userId:"15",name:"Panda",photoUrl:"https://snippyly.com/assets/avatars/avatar-panda.svg",type:"anonymous"},{userId:"16",name:"Penguin",photoUrl:"https://snippyly.com/assets/avatars/avatar-penguin.svg",type:"anonymous"},{userId:"17",name:"Rabbit",photoUrl:"https://snippyly.com/assets/avatars/avatar-rabbit.svg",type:"anonymous"},{userId:"18",name:"Tiger",photoUrl:"https://snippyly.com/assets/avatars/avatar-tiger.svg",type:"anonymous"}],this.loggingService.log("%c[WB] Creating SERVICE AvatarService","color: blue;")}getSessionAvatar(){this.loggingService.log("%c[WB] Calling FUNCTION: getSessionAvatar","color: green;");try{let r=new so,i=this.localStorageService.getSessionStorageData();if(i.snippylyAvatar)r=i.snippylyAvatar;else{let o=this.generateUserAvatar();i.snippylyAvatar=o,this.localStorageService.setSessionStorageData(i)}return r}catch(r){return this.loggingService.catch("Error in getSessionAvatar:",r),new so}}generateUserAvatar(){this.loggingService.log("%c[WB] Calling FUNCTION: generateUserAvatar","color: green;");try{let r=Math.floor(Math.random()*this.avatarList.length),i=this.avatarList[r];return i.color=this.generateUserColor(),i}catch(r){return this.loggingService.catch("Error in generateUserAvatar:",r),this.avatarList[0]}}generateUserColor(r){this.loggingService.log("%c[WB] Calling FUNCTION: generateUserColor","color: green;");try{if(r)return k.AVATAR_COLOR_LIST[r%k.AVATAR_COLOR_LIST.length];let i=Math.floor(Math.random()*k.AVATAR_COLOR_LIST.length);return k.AVATAR_COLOR_LIST[i]}catch(i){return this.loggingService.catch("Error in generateUserColor:",i),""}}generateUserImage(){this.loggingService.log("%c[WB] Calling FUNCTION: generateUserImage","color: green;");try{return this.getSessionAvatar().photoUrl}catch(r){return this.loggingService.catch("Error in generateUserImage:",r),""}}};e.\u0275fac=function(i){return new(i||e)(q(F2),q(Nt))},e.\u0275prov=Z({token:e,factory:e.\u0275fac,providedIn:"root"});let t=e;return t})();var V2=(()=>{let e=class e{constructor(r){this.loggingService=r,this.actionSubjects=new Map,this.subscriptions=[]}triggerAction(r,i){try{this.actionSubjects.has(r)||this.actionSubjects.set(r,new Be),this.actionSubjects.get(r)?.next(i)}catch(o){this.loggingService.catch("Error in CoreActionsService triggerAction: ",o)}}onAction(r){try{this.actionSubjects.has(r)||this.actionSubjects.set(r,new Be);let i=this.actionSubjects.get(r);return i?i.asObservable():st(null)}catch(i){return this.loggingService.catch("Error in CoreActionsService onAction: ",i),st(null)}}};e.\u0275fac=function(i){return new(i||e)(q(Nt))},e.\u0275prov=Z({token:e,factory:e.\u0275fac,providedIn:"root"});let t=e;return t})();function are(t,e){this.v=t,this.k=e}function B2(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function cre(t){if(Array.isArray(t))return t}function lre(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,o,s,a=[],c=!0,l=!1;try{if(o=(n=n.call(t)).next,e===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(a.push(r.value),a.length!==e);c=!0);}catch(d){l=!0,i=d}finally{try{if(!c&&n.return!=null&&(s=n.return(),Object(s)!==s))return}finally{if(l)throw i}}return a}}function ure(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
149
149
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function dre(t,e){return cre(t)||lre(t,e)||hre(t,e)||ure()}function hre(t,e){if(t){if(typeof t=="string")return B2(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?B2(t,e):void 0}}function wy(t){var e,n;function r(o,s){try{var a=t[o](s),c=a.value,l=c instanceof are;Promise.resolve(l?c.v:c).then(function(d){if(l){var h=o==="return"&&c.k?o:"next";if(!c.k||d.done)return r(h,d);d=t[h](d).value}i(!!a.done,d)},function(d){r("throw",d)})}catch(d){i(2,d)}}function i(o,s){o===2?e.reject(s):e.resolve({value:s,done:o}),(e=e.next)?r(e.key,e.arg):n=null}this._invoke=function(o,s){return new Promise(function(a,c){var l={key:o,arg:s,resolve:a,reject:c,next:null};n?n=n.next=l:(e=n=l,r(o,s))})},typeof t.return!="function"&&(this.return=void 0)}wy.prototype[typeof Symbol=="function"&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},wy.prototype.next=function(t){return this._invoke("next",t)},wy.prototype.throw=function(t){return this._invoke("throw",t)},wy.prototype.return=function(t){return this._invoke("return",t)};var tj=Object.entries,G2=Object.setPrototypeOf,fre=Object.isFrozen,nj=Object.getPrototypeOf,rj=Object.getOwnPropertyDescriptor,ln=Object.freeze,Sn=Object.seal,Id=Object.create,ij=typeof Reflect<"u"&&Reflect,hb=ij.apply,fb=ij.construct;ln||(ln=function(e){return e});Sn||(Sn=function(e){return e});hb||(hb=function(e,n){for(var r=arguments.length,i=new Array(r>2?r-2:0),o=2;o<r;o++)i[o-2]=arguments[o];return e.apply(n,i)});fb||(fb=function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return new e(...r)});var ts=Tt(Array.prototype.forEach);Array.prototype.indexOf;var pre=Tt(Array.prototype.lastIndexOf),j2=Tt(Array.prototype.pop),Gp=Tt(Array.prototype.push),gre=Tt(Array.prototype.slice),mre=Tt(Array.prototype.splice),vd=Array.isArray,rb=oj(Set),ib=Tt(Set.prototype.add),jp=Tt(Set.prototype.has),ol=Tt(String.prototype.toLowerCase),ob=Tt(String.prototype.toString),H2=Tt(String.prototype.match),Hp=Tt(String.prototype.replace),$2=Tt(String.prototype.indexOf),Ere=Tt(String.prototype.trim),_re=Tt(Number.prototype.toString),Tre=Tt(Boolean.prototype.toString),W2=typeof BigInt>"u"?null:Tt(BigInt.prototype.toString),z2=typeof Symbol>"u"?null:Tt(Symbol.prototype.toString),sr=Tt(Object.prototype.hasOwnProperty),$p=Tt(Object.prototype.toString),vn=Tt(RegExp.prototype.test),ns=oj(TypeError);function Tt(t){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return hb(t,e,r)}}function oj(t){return function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return fb(t,n)}}function Fe(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ol;if(G2&&G2(t,null),!vd(e))return t;let r=e.length;for(;r--;){let i=e[r];if(typeof i=="string"){let o=n(i);o!==i&&(fre(e)||(e[r]=o),i=o)}t[i]=!0}return t}function yre(t){for(let e=0;e<t.length;e++)sr(t,e)||(t[e]=null);return t}function Ar(t){let e=Id(null);for(let r of tj(t)){var n=dre(r,2);let i=n[0],o=n[1];sr(t,i)&&(vd(o)?e[i]=yre(o):o&&typeof o=="object"&&o.constructor===Object?e[i]=Ar(o):e[i]=o)}return e}function Ire(t){switch(typeof t){case"string":return t;case"number":return _re(t);case"boolean":return Tre(t);case"bigint":return W2?W2(t):"0";case"symbol":return z2?z2(t):"Symbol()";case"undefined":return $p(t);case"function":case"object":{if(t===null)return $p(t);let e=t,n=Kr(e,"toString");if(typeof n=="function"){let r=n(e);return typeof r=="string"?r:$p(r)}return $p(t)}default:return $p(t)}}function Kr(t,e){for(;t!==null;){let r=rj(t,e);if(r){if(r.get)return Tt(r.get);if(typeof r.value=="function")return Tt(r.value)}t=nj(t)}function n(){return null}return n}function vre(t,e){for(;t!==null;){let n=rj(t,e);if(n)return n.get?Tt(n.get):null;t=nj(t)}return null}function Sre(t){try{return vn(t,""),!0}catch{return!1}}var q2=ln(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),sb=ln(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),ab=ln(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Are=ln(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),cb=ln(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Cre=ln(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),K2=ln(["#text"]),Y2=ln(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),lb=ln(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","pointer-events","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","vector-effect","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),X2=ln(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Oy=ln(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Dre=Sn(/{{[\w\W]*|^[\w\W]*}}/g),Rre=Sn(/<%[\w\W]*|^[\w\W]*%>/g),Nre=Sn(/\${[\w\W]*/g),bre=Sn(/^data-[\-\w.\u00B7-\uFFFF]+$/),wre=Sn(/^aria-[\-\w]+$/),Q2=Sn(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Ore=Sn(/^(?:\w+script|data):/i),Lre=Sn(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Mre=Sn(/^html$/i),Pre=Sn(/^[a-z][.\w]*(-[.\w]+)+$/i),ub=Sn(/<[/\w!]/g),J2=Sn(/<[/\w]/g),xre=Sn(/<\/no(script|embed|frames)/i),Z2=Sn(/\/>/i),kt={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},kre=ln(Fe({},["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"])),Fre=function(){return typeof window>"u"?null:window},Ure=function(e,n){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let r=null,i="data-tt-policy-suffix";n&&n.hasAttribute(i)&&(r=n.getAttribute(i));let o="dompurify"+(r?"#"+r:"");try{return e.createPolicy(o,{createHTML(s){return s},createScriptURL(s){return s}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},ej=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},na=function(e,n,r,i){return sr(e,n)&&vd(e[n])?Fe(i.base?Ar(i.base):{},e[n],i.transform):r},db=function(e,n,r){let i=sr(e,n)?e[n]:void 0;return i&&typeof i=="object"?Ar(i):r()};function sj(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Fre(),e=$=>sj($);if(e.version="3.4.17",e.removed=[],!t||!t.document||t.document.nodeType!==kt.document||!t.Element)return e.isSupported=!1,e;let n=t.document,r=n,i=r.currentScript;t.DocumentFragment;let o=t.HTMLTemplateElement,s=t.Node,a=t.Element,c=t.NodeFilter;t.NamedNodeMap===void 0&&(t.NamedNodeMap||t.MozNamedAttrMap),t.HTMLFormElement;let l=t.DOMParser,d=t.trustedTypes,h=a.prototype,f=Kr(h,"cloneNode"),g=Kr(h,"remove"),E=Kr(h,"removeAttributeNode"),I=Kr(h,"nextSibling"),S=Kr(h,"childNodes"),R=Kr(h,"parentNode"),U=Kr(h,"shadowRoot"),G=Kr(h,"attributes"),X=s&&s.prototype?Kr(s.prototype,"nodeType"):null,ce=s&&s.prototype?Kr(s.prototype,"nodeName"):null,ne=s&&s.prototype?Kr(s.prototype,"ownerDocument"):null,A=function(T){return X?X(T):T.nodeType},v=function(T){return ce?ce(T):T.nodeName},C=vre(h,"namespaceURI"),w=function(T){return C?C(T):T.namespaceURI};if(typeof o=="function"){let $=n.createElement("template");$.content&&$.content.ownerDocument&&(n=$.content.ownerDocument)}let N,L="",D,Lr=!1,Jr=0,Sm=function(){if(Jr>0)throw ns('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},Mr=function(T){Sm(),Jr++;try{return N.createHTML(T)}finally{Jr--}},xa=function(T){Sm(),Jr++;try{return N.createScriptURL(T)}finally{Jr--}},Ph=function(){return Lr||(D=Ure(d,i),Lr=!0),D},ka=n,xh=ka.implementation,Zr=ka.createNodeIterator,nn=ka.createDocumentFragment,rS=ka.getElementsByTagName,Fa=r.importNode,rt=ej();e.isSupported=typeof tj=="function"&&typeof R=="function"&&xh&&xh.createHTMLDocument!==void 0;let Ua=Dre,iS=Rre,oS=Nre,ql=bre,Kl=wre,kh=Ore,Yl=Lre,Fh=Pre,Xl=Q2,it=null,Ql=Fe({},[...q2,...sb,...ab,...cb,...K2]),ut=null,Jl=Fe({},[...Y2,...lb,...X2,...Oy]),ur=Object.seal(Id(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),So=null,Uh=null,wi=Object.seal(Id(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Zl=!0,Va=!0,eu=!1,Ot=!0,ht=!1,Pr=!0,Oi=!1,tu=!1,nu=null,Li=null,ru=!1,Ao=!1,hs=!1,iu=!1,Am=!0,ou=!1,Vh="user-content-",su=!0,Co=!1,ei=null,Mi={},jn=null,Bh=Fe({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]),Ba=null,Gh=Fe({},["audio","video","img","source","image","track"]),fs=null,jh=Fe({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Lt="http://www.w3.org/1998/Math/MathML",Ga="http://www.w3.org/2000/svg",Cn="http://www.w3.org/1999/xhtml",xr=Cn,Hh=!1,$h=null,ps=Fe({},[Lt,Ga,Cn],ob),Cm=ln(["mi","mo","mn","ms","mtext"]),Wh=Fe({},Cm),ja=ln(["annotation-xml"]),au=Fe({},ja),zh=Fe({},["title","style","font","a","script"]),Pi=null,xi=["application/xhtml+xml","text/html"],Dm="text/html",gt=null,ki=null,qh=n.createElement("form"),Kh=function(T){return T instanceof RegExp||T instanceof Function},cu=function(){let T=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(ki&&ki===T)return;(!T||typeof T!="object")&&(T={}),T=Ar(T),Pi=xi.indexOf(T.PARSER_MEDIA_TYPE)===-1?Dm:T.PARSER_MEDIA_TYPE,gt=Pi==="application/xhtml+xml"?ob:ol,it=na(T,"ALLOWED_TAGS",Ql,{transform:gt}),ut=na(T,"ALLOWED_ATTR",Jl,{transform:gt}),$h=na(T,"ALLOWED_NAMESPACES",ps,{transform:ob}),fs=na(T,"ADD_URI_SAFE_ATTR",jh,{transform:gt,base:jh}),Ba=na(T,"ADD_DATA_URI_TAGS",Gh,{transform:gt,base:Gh}),jn=na(T,"FORBID_CONTENTS",Bh,{transform:gt}),So=na(T,"FORBID_TAGS",Ar({}),{transform:gt}),Uh=na(T,"FORBID_ATTR",Ar({}),{transform:gt}),Mi=sr(T,"USE_PROFILES")?T.USE_PROFILES&&typeof T.USE_PROFILES=="object"?Ar(T.USE_PROFILES):T.USE_PROFILES:!1,Zl=T.ALLOW_ARIA_ATTR!==!1,Va=T.ALLOW_DATA_ATTR!==!1,eu=T.ALLOW_UNKNOWN_PROTOCOLS||!1,Ot=T.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ht=T.SAFE_FOR_TEMPLATES||!1,Pr=T.SAFE_FOR_XML!==!1,Oi=T.WHOLE_DOCUMENT||!1,Ao=T.RETURN_DOM||!1,hs=T.RETURN_DOM_FRAGMENT||!1,iu=T.RETURN_TRUSTED_TYPE||!1,ru=T.FORCE_BODY||!1,Am=T.SANITIZE_DOM!==!1,ou=T.SANITIZE_NAMED_PROPS||!1,su=T.KEEP_CONTENT!==!1,Co=T.IN_PLACE||!1,Xl=Sre(T.ALLOWED_URI_REGEXP)?T.ALLOWED_URI_REGEXP:Q2,xr=typeof T.NAMESPACE=="string"?T.NAMESPACE:Cn,Wh=db(T,"MATHML_TEXT_INTEGRATION_POINTS",()=>Fe({},Cm)),au=db(T,"HTML_INTEGRATION_POINTS",()=>Fe({},ja));let b=db(T,"CUSTOM_ELEMENT_HANDLING",()=>Id(null));if(ur=Id(null),sr(b,"tagNameCheck")&&Kh(b.tagNameCheck)&&(ur.tagNameCheck=b.tagNameCheck),sr(b,"attributeNameCheck")&&Kh(b.attributeNameCheck)&&(ur.attributeNameCheck=b.attributeNameCheck),sr(b,"allowCustomizedBuiltInElements")&&typeof b.allowCustomizedBuiltInElements=="boolean"&&(ur.allowCustomizedBuiltInElements=b.allowCustomizedBuiltInElements),Sn(ur),ht&&(Va=!1),hs&&(Ao=!0),Mi&&(it=Fe({},K2),ut=Id(null),Mi.html===!0&&(Fe(it,q2),Fe(ut,Y2)),Mi.svg===!0&&(Fe(it,sb),Fe(ut,lb),Fe(ut,Oy)),Mi.svgFilters===!0&&(Fe(it,ab),Fe(ut,lb),Fe(ut,Oy)),Mi.mathMl===!0&&(Fe(it,cb),Fe(ut,X2),Fe(ut,Oy))),wi.tagCheck=null,wi.attributeCheck=null,sr(T,"ADD_TAGS")&&(typeof T.ADD_TAGS=="function"?wi.tagCheck=T.ADD_TAGS:vd(T.ADD_TAGS)&&(it===Ql&&(it=Ar(it)),Fe(it,T.ADD_TAGS,gt))),sr(T,"ADD_ATTR")&&(typeof T.ADD_ATTR=="function"?wi.attributeCheck=T.ADD_ATTR:vd(T.ADD_ATTR)&&(ut===Jl&&(ut=Ar(ut)),Fe(ut,T.ADD_ATTR,gt))),sr(T,"ADD_FORBID_CONTENTS")&&vd(T.ADD_FORBID_CONTENTS)&&(jn===Bh&&(jn=Ar(jn)),Fe(jn,T.ADD_FORBID_CONTENTS,gt)),su&&(it["#text"]=!0),Oi&&Fe(it,["html","head","body"]),it.table&&(Fe(it,["tbody"]),delete So.tbody),T.TRUSTED_TYPES_POLICY){if(typeof T.TRUSTED_TYPES_POLICY.createHTML!="function")throw ns('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof T.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw ns('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');let H=N;N=T.TRUSTED_TYPES_POLICY;try{L=Mr("")}catch(j){throw N=H,j}}else T.TRUSTED_TYPES_POLICY===null?(N=void 0,L=""):(N===void 0&&(N=Ph()),N&&typeof L=="string"&&(L=Mr("")));ln&&ln(T),ki=T},Rm=Fe({},[...sb,...ab,...Are]),Ha=Fe({},[...cb,...Cre]),Nm=function(T,b,H){return b.namespaceURI===Cn?T==="svg":b.namespaceURI===Lt?T==="svg"&&(H==="annotation-xml"||Wh[H]):!!Rm[T]},Yh=function(T,b,H){return b.namespaceURI===Cn?T==="math":b.namespaceURI===Ga?T==="math"&&au[H]:!!Ha[T]},$a=function(T,b,H){return b.namespaceURI===Ga&&!au[H]||b.namespaceURI===Lt&&!Wh[H]?!1:!Ha[T]&&(zh[T]||!Rm[T])},Do=function(T){let b=w(T),H=ol(v(T)),j=R(T),ae,me;return j&&A(j)===kt.element?(ae={namespaceURI:w(j)},me=ol(v(j))):(ae={namespaceURI:xr},me="template"),$h[b]?b===Ga?Nm(H,ae,me):b===Lt?Yh(H,ae,me):b===Cn?$a(H,ae,me):!!(Pi==="application/xhtml+xml"&&$h[b]):!1},kr=function(T){Gp(e.removed,{element:T});try{R(T).removeChild(T)}catch{if(g(T),!R(T))throw ns("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},bm=function(T,b,H){try{E(T,b)}catch{try{T.removeAttribute(H)}catch{}}},lu=function(T){za(T);let b=S(T);b&&ts(gre(b),j=>{try{g(j)}catch{}});let H=A(T)===kt.element?G(T):null;if(H)for(let j=H.length-1;j>=0;--j){let ae=H[j],me=ae&&ae.name;typeof me=="string"&&bm(T,ae,me)}},Ro=function(T,b,H){if(!H)try{H=b.getAttributeNode(T)}catch{H=null}Gp(e.removed,{attribute:H||null,from:b});try{H?E(b,H):b.removeAttribute(T)}catch{try{b.removeAttribute(T)}catch{}}if(T==="is")if(Ao||hs)try{kr(b)}catch{}else try{b.setAttribute(T,"")}catch{}},Xh=function(T){let b=G(T);if(b)for(let H=b.length-1;H>=0;--H){let j=b[H],ae=j&&j.name;typeof ae!="string"||ut[gt(ae)]||bm(T,j,ae)}},Wa=function(T,b){let H=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,j=[T];for(;j.length>0;){let ae=j.pop();if(b(ae)===!1)continue;if(H&&A(ae)===kt.element){let Se=U(ae);Xn(Se)&&j.push(Se)}let me=S(ae);if(me)for(let Se=me.length-1;Se>=0;--Se)j.push(me[Se])}},za=function(T){Wa(T,b=>{A(b)===kt.element&&Xh(b)})},uu=function(T){let b=[];return Wa(T,H=>{b.push(H)},!0),b},wm=function(T,b){let H=rb();ts(uu(T),j=>{A(j)===kt.element&&ib(H,j)}),ts(b,j=>{A(j)===kt.element&&!jp(H,j)&&Xh(j)})},Om=function(T,b){let H=!1;return ts(e.removed,j=>{j.element&&(H=H||j.element===T,za(j.element))}),wm(T,b),H},sS=8,Lm=function(T,b){let H=ei,j=null,ae=()=>(j||(j=rb(),ts(b,me=>{ib(j,me)})),j);for(let me=0;;me++){let Se=uu(T),Ae=[T],Vr=!1;if(ts(Se,pn=>{A(pn)===kt.documentFragment?Gp(Ae,pn):!Vr&&!jp(H,pn)&&(Vr=jp(ae(),pn))}),!Vr)return;if(me>=sS)throw ns("the tree kept changing during in-place sanitization; refusing to return it");ts(Ae,(pn,gn)=>{Mm(pn,gn>0,T,ae())})}},Mm=function(T,b,H,j){let ae=gs(T),me;for(;me=ae.nextNode();)!jp(j,me)||jp(ei,me)||(b&&Qn(rt.uponSanitizeShadowNode,me,null),Ur(me,H),Zh(me,H),Xn(me.content)&&Jn(me.content))},aS=function(T){ei&&ib(ei,T)},Fi=function(T,b){return Pr?T==="patchsrc"?!0:T==="for"&&b!=="label"&&b!=="output":!1},ti=function(T){Pr&&Wa(T,b=>{let H=A(b);if(H===kt.processingInstruction||H===kt.comment&&vn(J2,b.data)){try{g(b)}catch{}return!1}if(H===kt.element){let j=b,ae=gt(v(b));try{j.hasAttribute&&j.hasAttribute("patchsrc")&&j.removeAttribute("patchsrc"),j.hasAttribute&&j.hasAttribute("for")&&Fi("for",ae)&&j.removeAttribute("for")}catch{}}return!0})},qa=function(T){let b=null,H=null;if(ru)T="<remove></remove>"+T;else{let me=H2(T,/^[\r\n\t ]+/);H=me&&me[0]}Pi==="application/xhtml+xml"&&xr===Cn&&(T='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+T+"</body></html>");let j=N?Mr(T):T;if(xr===Cn)try{b=new l().parseFromString(j,Pi)}catch{}if(!b||!b.documentElement){b=xh.createDocument(xr,"template",null);try{b.documentElement.innerHTML=Hh?L:j}catch{}}let ae=b.body||b.documentElement;return T&&H&&ae.insertBefore(n.createTextNode(H),ae.childNodes[0]||null),xr===Cn?rS.call(b,Oi?"html":"body")[0]:Oi?b.documentElement:ae},gs=function(T){let b=ne?ne(T):T.ownerDocument;return Zr.call(b||T,T,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Ka=function(T){return T=Hp(T,Ua," "),T=Hp(T,iS," "),T=Hp(T,oS," "),T},Ke=function(T){var b;Ya(T);let H=(b=T.querySelectorAll)===null||b===void 0?void 0:b.call(T,"template");H&&ts(H,j=>{Xn(j.content)&&Ke(j.content)})},Ya=function(T){T.normalize();let b=ne?ne(T):T.ownerDocument,H=Zr.call(b||T,T,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),j=H.nextNode();for(;j;)j.data=Ka(j.data),j=H.nextNode()},Ui=function(T){let b=ce?ce(T):null;return typeof b!="string"||gt(b)!=="form"?!1:typeof T.nodeName!="string"||typeof T.textContent!="string"||typeof T.removeChild!="function"||T.attributes!==G(T)||typeof T.removeAttribute!="function"||typeof T.removeAttributeNode!="function"||typeof T.getAttributeNode!="function"||typeof T.setAttribute!="function"||typeof T.namespaceURI!="string"||typeof T.insertBefore!="function"||typeof T.hasChildNodes!="function"||T.nodeType!==X(T)||T.childNodes!==S(T)},Xn=function(T){if(!X||typeof T!="object"||T===null)return!1;try{return X(T)===kt.documentFragment}catch{return!1}},Xa=function(T){if(!X||typeof T!="object"||T===null)return!1;try{return typeof X(T)=="number"}catch{return!1}};function Qn($,T,b){$.length!==0&&ts($,H=>{H.call(e,T,b,ki)})}let cS=function(T,b){return!!(Pr&&T.hasChildNodes()&&!Xa(T.firstElementChild)&&vn(ub,T.textContent)&&vn(ub,T.innerHTML)||Pr&&kre[b]&&A(T)===kt.element&&w(T)===Cn&&(Xa(T.firstElementChild)||typeof T.textContent=="string"&&vn(ub,T.textContent))||T.nodeType===kt.processingInstruction||Pr&&T.nodeType===kt.comment&&vn(J2,T.data))},du=function(T,b){if(T instanceof RegExp)return vn(T,b);if(T instanceof Function){for(var H=arguments.length,j=new Array(H>2?H-2:0),ae=2;ae<H;ae++)j[ae-2]=arguments[ae];return!!T(b,...j)}return!1},lS=function(T,b,H){if(!So[b]&&Jh(b)&&du(ur.tagNameCheck,b))return!1;if(su&&!jn[b]&&!jn[ol(b)]){let j=R(T),ae=S(T);if(ae&&j){let me=ae.length;for(let Se=me-1;Se>=0;--Se){let Ae=T===H?f(ae[Se],!0):ae[Se];j.insertBefore(Ae,I(T))}}}return kr(T),!0},Pm=function(T,b,H,j){return T.length===0?b:b===H||b===j?Ar(b):b},Fr=function(T,b){return T===b||R(T)!==null?!1:(Co&&za(T),!0)},Ur=function(T,b){if(aS(T),Qn(rt.beforeSanitizeElements,T,null),Fr(T,b))return!0;if(Ui(T))return kr(T),!0;let H=gt(v(T));if(it=Pm(rt.uponSanitizeElement,it,Ql,nu),Qn(rt.uponSanitizeElement,T,{tagName:H,allowedTags:it}),Fr(T,b))return!0;if(cS(T,H))return kr(T),!0;if(So[H]||!(wi.tagCheck instanceof Function&&wi.tagCheck(H))&&!it[H]){let j=lS(T,H,b);return j===!1&&(Qn(rt.afterSanitizeElements,T,null),Fr(T,b))?!0:j}if(A(T)===kt.element&&!Do(T)||(H==="noscript"||H==="noembed"||H==="noframes")&&vn(xre,T.innerHTML))return kr(T),!0;if(ht&&T.nodeType===kt.text){let j=Ka(T.textContent);T.textContent!==j&&(Gp(e.removed,{element:T.cloneNode()}),T.textContent=j)}return Qn(rt.afterSanitizeElements,T,null),Fr(T,b)},Qh=function(T,b,H){if(Uh[b]||Fi(b,T)||Am&&(b==="id"||b==="name")&&(H in n||H in qh))return!1;let j=ut[b]||wi.attributeCheck instanceof Function&&wi.attributeCheck(b,T);return Va&&vn(ql,b)||Zl&&vn(Kl,b)?!0:j?fs[b]||vn(Xl,Hp(H,Yl,""))||(b==="src"||b==="xlink:href"||b==="href")&&T!=="script"&&$2(H,"data:")===0&&Ba[T]||eu&&!vn(kh,Hp(H,Yl,""))?!0:!H:Jh(T)&&du(ur.tagNameCheck,T)&&du(ur.attributeNameCheck,b,T)||b==="is"&&ur.allowCustomizedBuiltInElements&&du(ur.tagNameCheck,H)},xm=Fe({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Jh=function(T){return!xm[ol(T)]&&vn(Fh,T)},ms=function(T,b,H,j){if(N&&typeof d=="object"&&typeof d.getAttributeType=="function"&&!H)switch(d.getAttributeType(T,b)){case"TrustedHTML":return Mr(j);case"TrustedScriptURL":return xa(j)}return j},uS=function(T,b,H,j){try{return H?T.setAttributeNS(H,b,j):T.setAttribute(b,j),Ui(T)?(kr(T),!1):!0}catch{return Ro(b,T),!1}},km=function(T,b){return Pr&&vn(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,b)?!0:ol(T)==="attributename"&&H2(b,"href")!==null},Zh=function(T,b){if(Qn(rt.beforeSanitizeAttributes,T,null),Fr(T,b))return;let H=T.attributes;if(!H||Ui(T))return;ut=Pm(rt.uponSanitizeAttribute,ut,Jl,Li);let j={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ut,forceKeepAttr:void 0},ae=H.length,me=gt(T.nodeName);for(;ae--;){let Se=H[ae],Ae=Se.name,Vr=Se.namespaceURI,pn=Se.value,gn=gt(Ae),No=pn,mn=Ae==="value"?No:Ere(No),Qa=!1;if(j.attrName=gn,j.attrValue=mn,j.keepAttr=!0,j.forceKeepAttr=void 0,Qn(rt.uponSanitizeAttribute,T,j),mn=j.attrValue,ou&&(gn==="id"||gn==="name")&&$2(mn,Vh)!==0&&(Ro(Ae,T,Se),mn=Vh+mn,Qa=!0),km(Ae,mn)){Ro(Ae,T,Se);continue}if(!j.forceKeepAttr){if(!j.keepAttr){Ro(Ae,T,Se);continue}if(!Ot&&vn(Z2,mn)){Ro(Ae,T,Se);continue}if(ht&&(mn=Ka(mn)),!Qh(me,gn,mn)){Ro(Ae,T,Se);continue}mn=ms(me,gn,Vr,mn),mn!==No&&uS(T,Ae,Vr,mn)&&Qa&&j2(e.removed)}}Qn(rt.afterSanitizeAttributes,T,null),Fr(T,b)},Jn=function(T){let b=null,H=gs(T);for(Qn(rt.beforeSanitizeShadowDOM,T,null);b=H.nextNode();)if(Qn(rt.uponSanitizeShadowNode,b,null),Ur(b,T),Zh(b,T),Xn(b.content)&&Jn(b.content),A(b)===kt.element){let j=U(b);Xn(j)&&(ef(j),Jn(j))}ht&&Ya(T),Qn(rt.afterSanitizeShadowDOM,T,null)},ef=function(T){let b=[{node:T,shadow:null}];for(;b.length>0;){let H=b.pop();if(H.shadow){Jn(H.shadow);continue}let j=H.node,ae=A(j)===kt.element,me=S(j);if(me)for(let Se=me.length-1;Se>=0;--Se)b.push({node:me[Se],shadow:null});if(ae){let Se=ce?ce(j):null;if(typeof Se=="string"&>(Se)==="template"){let Ae=j.content;Xn(Ae)&&b.push({node:Ae,shadow:null})}}if(ae){let Se=U(j);Xn(Se)&&b.push({node:null,shadow:Se},{node:Se,shadow:null})}}};return e.sanitize=function($){let T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},b=null,H=null,j=null,ae=null;if(Hh=!$,Hh&&($="<!-->"),typeof $!="string"&&!Xa($)&&($=Ire($),typeof $!="string"))throw ns("dirty is not a string, aborting");if(!e.isSupported)return $;tu?(it=nu,ut=Li):cu(T),(rt.uponSanitizeElement.length>0||rt.uponSanitizeAttribute.length>0)&&(it=Ar(it)),rt.uponSanitizeAttribute.length>0&&(ut=Ar(ut)),e.removed=[];let me=Co&&typeof $!="string"&&Xa($),Se=[],Ae=ei;if(me){ti($);let gn=v($);if(typeof gn=="string"){let No=gt(gn);if(!it[No]||So[No])throw lu($),ns("root node is forbidden and cannot be sanitized in-place")}if(Ui($))throw lu($),ns("root node is clobbered and cannot be sanitized in-place");Se=uu($),ei=rb()}else if(Xa($))b=qa("<!---->"),H=b.ownerDocument.importNode($,!0),H.nodeType===kt.element&&H.nodeName==="BODY"||H.nodeName==="HTML"?b=H:b.appendChild(H),ef(b);else{if(!Ao&&!ht&&!Oi&&$.indexOf("<")===-1)return N&&iu?Mr($):$;if(b=qa($),!b)return Ao?null:iu?L:""}b&&ru&&kr(b.firstChild);let Vr=me?$:b;try{me&&ef($);let gn=gs(Vr);for(;j=gn.nextNode();)Ur(j,Vr),Zh(j,Vr),Xn(j.content)&&Jn(j.content);me&&Lm($,Se)}catch(gn){throw me&&(lu($),Om($,Se)),gn}finally{ei=Ae}if(me){if(Om($,Se))throw ns("a node selected for removal could not be safely returned; refusing to sanitize in place");return ht&&Ke($),$}if(Ao){if(ht&&Ke(b),hs)for(ae=nn.call(b.ownerDocument);b.firstChild;)ae.appendChild(b.firstChild);else ae=b;return(ut.shadowroot||ut.shadowrootmode)&&(ae=Fa.call(r,ae,!0)),ae}let pn=Oi?b.outerHTML:b.innerHTML;return Oi&&it["!doctype"]&&b.ownerDocument&&b.ownerDocument.doctype&&b.ownerDocument.doctype.name&&vn(Mre,b.ownerDocument.doctype.name)&&(pn="<!DOCTYPE "+b.ownerDocument.doctype.name+`>
|
|
150
|
-
`+pn),ht&&(pn=Ka(pn)),N&&iu?Mr(pn):pn},e.setConfig=function(){let $=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};cu($),tu=!0,nu=it,Li=ut},e.clearConfig=function(){ki=null,tu=!1,nu=null,Li=null,N=D,L=""},e.isValidAttribute=function($,T,b){ki||cu({});let H=gt($),j=gt(T);return typeof b=="string"&&(km(T,b)||!Ot&&vn(Z2,b))?!1:Qh(H,j,b)},e.addHook=function($,T){typeof T=="function"&&sr(rt,$)&&Gp(rt[$],T)},e.removeHook=function($,T){if(sr(rt,$)){if(T!==void 0){let b=pre(rt[$],T);return b===-1?void 0:mre(rt[$],b,1)[0]}return j2(rt[$])}},e.removeHooks=function($){sr(rt,$)&&(rt[$]=[])},e.removeAllHooks=function(){rt=ej()},e}var Ly=sj();var Vre=/^\/\/\*\[@id='([^']+)'\]/;function pb(t){try{if(typeof t!="string")return null;let e=Vre.exec(t);if(!e)return null;let n=e[1],r=t.slice(e[0].length);if(!r)return{rootId:n,segments:[]};if(!r.startsWith("/"))return null;let i=[],o="",s=0,a=null;for(let c=1;c<r.length;c++){let l=r[c];if(a){l===a&&(a=null),o+=l;continue}if(l==="'"||l==='"')a=l;else if(l==="[")s++;else if(l==="]")s--;else if(l==="/"&&s===0){if(!o)return null;i.push(o),o="";continue}o+=l}return!o||a||s!==0?null:(i.push(o),{rootId:n,segments:i})}catch{return null}}var Bre=[/:r[0-9a-z]+:/i,/_r_[0-9a-z]+_/i,/«r[0-9a-z]+»/i,/^radix-/i];function cj(t){try{return t?Bre.some(e=>e.test(t)):!1}catch{return!1}}function cFe(t){if(Array.isArray(t))return aj(t);if(!t||typeof t!="object"||!("documentIds"in t))return{documentIds:null};let e=t.documentIds;return Array.isArray(e)?aj(e):{documentIds:[],problem:"not-an-array"}}function aj(t){let e=t.filter(n=>typeof n=="string"||typeof n=="number"&&Number.isFinite(n)).map(n=>String(n)).filter(n=>n.length>0);return V({documentIds:Array.from(new Set(e)).sort()},e.length<t.length?{problem:"dropped-entries"}:{})}function lFe(t,e){return t===null||e===null?t===e:t.length===e.length&&t.every((n,r)=>n===e[r])}var lj={ADD_TAGS:["velt-skeleton-loader"],ADD_ATTR:["border-radius","target"]};function Wp(t,e,n){if(!t)return!0;try{return t(e)!==!1}catch(r){return n?.catch("Error in DomService target filter: ",r),!0}}var Gre=new Set([k.ATTRIBUTES.VELT_ELEMENT_CACHE_ID,k.ATTRIBUTES.VELT_COMMENT_PIN_HOST]);function uj(t){try{if(!t)return"";let e=uj(t.parent);return e===null?null:[t.id,t.tagName,t.elementSelector,t.robustXPath,t.xPath,t.cfXPath,t.fXPath,t.contentHash?.value].map(n=>n??"").join("")+""+e}catch(e){return O.catch("Error in DomService getAnchorSignature: ",e),null}}function jre(t){let e=(t??"").replace(/\+position$/,"");return e==="id"||e==="id-duplicate"?0:e==="element-selector"||e==="element-selector-duplicate"?1:e==="robustXPath"?2:3}function Hre(t,e){try{if(!t||!e?.cacheKey&&e?.accept)return null;let n=uj(t);return n===null?null:e?.cacheKey?`k${e.cacheKey}${n}`:`a${n}`}catch(n){return O.catch("Error in DomService getAnchorCacheKey: ",n),null}}var dj=(()=>{let e=class e{constructor(r,i,o,s){this.analyticsService=r,this.rendererFactory2=i,this.loggingService=o,this.sanitizer=s,this.smoothScrollShieldHandler=null,this.smoothScrollShieldLoadListener=null,this.isVideoEditorHandlingDelete=!1,this.pageScrollHeight=0,this.enableRectSelectionSubject$=new de(!1),this.enableRectSelection$=this.enableRectSelectionSubject$.asObservable(),this.scrollableElementsIds$=new de([]),this.mousedown=!1,this.windowMouseDown$=new Be,this.windowPointerMove$=new de(null),this.windowPointerUp$=new Be,this.documentSelectionChange$=new Be,this.windowClick$=new Be,this.windowScroll$=new de(null),this.windowResize$=new de(null),this.windowKeyupBackspace$=new Be,this.windowKeyupDelete$=new Be,this.windowKeyupEsc$=new Be,this.windowPopState$=new de(null),this.documentClick$=new Be,this.lastDocumentClickTarget=null,this.documentClickSubject$=new Be,this.documentFocus$=new Be,this.isShiftKeyPressed=!1,this.mutation$=new Be,this.pendingMutations=[],this.frameTasks=new Map,this.childListMutation$=new Be,this.networkStatus$=new de(!1),this.xpathCache=new Map,this.anchorResolutionCache=new Map,this.passMemo=null,this.passDepth=0,this.xpathCacheId=new Map,this.selectedAnnotationsMap$=new de({}),this.selectedAnnotationsLocationMap$=new de({}),this.selectedAnnotationsContextIdMap$=new de({}),this.recordingInProgress$=new de({}),this.deleteAnnotations$=new de([]),this.pinHighlighterClass$=new de(null),this.dialogOpenedInSidebar$=new de(!1),this.textHighlighterClass$=new de(null),this.commentPinHighlighter$=new de(!1),this.deviceInfo$=new de(new Wr),this.customCss$=new de(null),this.mutationObserver=null,this.animationFilterEnabled=!1,this.animationLibraryDetected=null,this.staticAnimationCache=new WeakMap,this.ANIMATION_LIBRARY_SELECTOR=["[data-gsap]",".gsap-marker-start",".gsap-marker-end","[data-gsap-id]",".swiper-slide",".swiper-wrapper",".swiper-pagination",".swiper-pagination-bullet","[data-aos]"].join(", "),this.previousMousePosition={pageX:0,pageY:0,clientX:0,clientY:0},this.currentMousePosition={pageX:0,pageY:0,clientX:0,clientY:0,element:{xpath:"",topPercentage:0,leftPercentage:0}},this.unlistenElementScroll={},this.tabId=null,this.dynamicIdPatterns=[/^yui_[a-z0-9_]+$/i],this.excludeClassList=["show-pin-cursor"],this.annotationDraftContentReader=null,this.filterSnippylyNodes=a=>{try{let c=[];return a.forEach(l=>{if(!ao(l))if(l instanceof HTMLElement){if(l.className.includes("cdk-overlay-container")||l.className.includes("cdk-overlay-connected-position-bounding-box"))return;if(l.className.includes("cdk-overlay")){let d=!1;l.childNodes.forEach(h=>{ao(h)&&(d=!0)}),d||c.push(l)}else c.push(l)}else c.push(l)}),c}catch(c){return this.loggingService.catch("Error in DomService filterSnippylyNodes: ",c),[]}},this.loggingService.log("%c[WB] Creating CLASS: DomService","color: blue;");try{this.analyticsService.setDomService(this),this.renderer=this.rendererFactory2.createRenderer(null,null);let a=this.calculateScreenSize();this.currentScreenSize$=new de(a),this.currentMousePosition$=new de(this.currentMousePosition),this.detectNetworkStatusChange(),this.getScrollableElementsIds$().pipe(ac(),pE(([c,l])=>{try{let d=l.filter(f=>!c.includes(f)),h=c.filter(f=>!l.includes(f));h.length&&h.map(g=>document.getElementById(g)).filter(g=>g).forEach(g=>{this.unlistenElementScroll&&this.unlistenElementScroll[g.id]&&this.unlistenElementScroll[g.id]()}),d.length&&d.map(g=>document.getElementById(g)).filter(g=>g).forEach(g=>{this.unlistenElementScroll[g.id]=this.renderer.listen(g,"scroll",()=>{this.runOncePerFrame("screen-size",()=>this.currentScreenSize$.next(this.calculateScreenSize()))})})}catch(d){this.loggingService.catch("Error in DomService getScrollableElementsIds subscription: ",d)}})).subscribe(()=>{},c=>{this.loggingService.catch("Error in DomService getScrollableElementsIds subscription: ",c)}),this.getSelectedAnnotationsMap$().subscribe(c=>{Object.keys(c||{})?.length?gB("snippylyUserScalableNo","viewport","width=device-width, user-scalable=no"):mB("snippylyUserScalableNo")},c=>{this.loggingService.catch("Error in DomService getSelectedAnnotationsMap$ subscription: ",c)})}catch(a){this.loggingService.catch("Error in DomService constructor: ",a)}}setDocService(r){try{this.docService=r,this.subscribeToDomEvents()}catch(i){this.loggingService.catch("Error in DomService setDocService: ",i)}}setDynamicIdPatterns(r){try{let i=r.map(o=>typeof o=="string"?new RegExp(o):o).filter(Boolean);i.length&&(this.dynamicIdPatterns=i)}catch(i){this.loggingService.catch("Error in DomService setDynamicIdPatterns: ",i)}}isLikelyDynamicId(r){try{return r?this.dynamicIdPatterns.some(i=>i.test(r)):!1}catch{return!1}}isGeneratedId(r){return this.isLikelyDynamicId(r)||cj(r)}getStableAttributes(r){try{let i={};if(!r.getAttributeNames)return i;let o=new Set(["id","class","style"]);return r.getAttributeNames().forEach(a=>{if(o.has(a)||a.includes("snippyly")||a.includes("velt"))return;let c=r.getAttribute(a);c&&c.length<=256&&(i[a]=c)}),i}catch{return{}}}buildStableElementSelector(r,i){try{if(Object.keys(i).length===0)return;let s=[r.tagName?.toLowerCase()],a=["data-","aria-","role","name","title","type"];return Object.keys(i).sort((l,d)=>{let h=a.findIndex(g=>l.startsWith(g)),f=a.findIndex(g=>d.startsWith(g));return(h===-1?99:h)-(f===-1?99:f)}).slice(0,4).forEach(l=>{let d=CSS.escape(i[l]);s.push(`[${l}="${d}"]`)}),s.join("")}catch{return}}getVisibleText(r,i=400){try{let o=document.createTreeWalker(r,NodeFilter.SHOW_TEXT,null),s="",a,c=0;for(;(a=o.nextNode())&&s.length<i;){let l=(a.textContent||"").replace(/\s+/g," ").trim();if(l&&(s+=(s?" ":"")+l),c++,c>100)break}return s.slice(0,i)}catch{return""}}hashText(r){try{return JV(r)}catch{return}}generateRobustXPath(r,i){try{let o=i?.maxDepth||10,s=i?.useAbsolutePath||!1,a=[],c=r,l=0;for(;c&&c!==document.documentElement&&l<o;){let g=this.buildRobustXPathSegment(c);if(g&&(a.unshift(g),this.isStrongAnchorSegment(g)))break;c=c.parentElement,l++}if(a.length===0)return;let h=(s?"/":"//")+a.join("/");return a.some(g=>g.includes("[@")||g.includes("[contains(@class"))?h:void 0}catch{return}}buildRobustXPathSegment(r){try{let i=r.tagName.toLowerCase(),o=r.id;if(o&&!this.isLikelyDynamicId(o)&&document.querySelectorAll(`[id="${CSS.escape(o)}"]`).length===1)return`*[@id=${this.escapeXPathValue(o)}]`;let s=["data-region","data-instanceid","data-action","data-key","data-block","data-activityid"];for(let g of s){let E=r.getAttribute(g);if(E)return`${i}[@${g}=${this.escapeXPathValue(E)}]`}let a=Array.from(r.attributes).filter(g=>g.name.startsWith("data-")&&!g.name.includes("snippyly")&&!g.name.includes("velt")&&g.value.length<100).sort((g,E)=>g.value.length-E.value.length);if(a.length>0){let g=a[0];return`${i}[@${g.name}=${this.escapeXPathValue(g.value)}]`}let c=r.getAttribute("role");if(c)return`${i}[@role=${this.escapeXPathValue(c)}]`;let l=r.getAttribute("aria-label");if(l&&l.length<50)return`${i}[@aria-label=${this.escapeXPathValue(l)}]`;let d=r.getAttribute("name");if(d)return`${i}[@name=${this.escapeXPathValue(d)}]`;let h=r.getAttribute("type");if(h)return`${i}[@type=${this.escapeXPathValue(h)}]`;let f=Array.from(r.classList||[]).filter(g=>g.length>0&&g.length<40&&!g.includes("yui")&&!g.includes("velt")&&!g.includes("snippyly")&&!this.excludeClassList.includes(g)).slice(0,2);if(f.length>0){let g=f.map(E=>`contains(@class, ${this.escapeXPathValue(E)})`).join(" and ");return`${i}[${g}]`}if(r.parentElement){let g=Array.from(r.parentElement.children).filter(E=>E.tagName===r.tagName);if(g.length>1){let E=g.indexOf(r)+1;return`${i}[${E}]`}}return i}catch{return}}isStrongAnchorSegment(r){try{return!!(r.includes("[@id=")||["main","navigation","banner","contentinfo","complementary","search"].some(s=>r.includes(`[@role='${s}']`))||["data-region","data-instanceid","data-activityid"].some(s=>r.includes(`[@${s}=`)))}catch{return!1}}escapeXPathValue(r,i=!0){try{return r.includes("'")?r.includes('"')?`concat(${r.split("'").map(a=>`'${a}'`).join(`,"'",`)})`:i?`"${r}"`:r:i?`'${r}'`:r}catch{try{return`concat(${r.split("'").map(c=>`'${c}'`).join(`,"'",`)})`}catch{return i?`'${r}'`:r}}}getElementFromRobustXPath(r){try{return document.evaluate(r,document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue}catch{return null}}runPositionPass(r){this.passDepth===0&&(this.passMemo={robustXPath:new Map,selector:new Map,visibleTextHash:new WeakMap}),this.passDepth++;try{return r()}finally{this.passDepth--,this.passDepth===0&&(this.passMemo=null)}}hashVisibleText(r){let i=this.passMemo?.visibleTextHash;if(i?.has(r))return i.get(r);let o=this.hashText(this.getVisibleText(r));return i?.set(r,o),o}getAllElementsFromRobustXPath(r){let i=this.passMemo?.robustXPath,o=i?.get(r);if(o)return o;let s=this.evaluateRobustXPath(r);return i?.set(r,s),s}getAllElementsFromSelector(r){let i=this.passMemo?.selector,o=i?.get(r);if(o)return o;let s=Array.from(document.querySelectorAll(r));return i?.set(r,s),s}evaluateRobustXPath(r){try{let i=document.evaluate(r,document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null),o=[];for(let s=0;s<i.snapshotLength;s++){let a=i.snapshotItem(s);a instanceof Element&&o.push(a)}return o}catch{return[]}}generateAnchorRecord(r,i){try{let o=this.generateAnchorRecordForElement(r,i),s=null;if(r.parentElement&&r.parentElement instanceof HTMLElement&&ld(r.parentElement)&&r.parentElement!==document.body&&(s=r.parentElement),o&&s){let a=this.generateAnchorRecordForElement(s,i);a&&(o.parent=a)}return o}catch(o){return this.loggingService.catch("Error in DomService generateAnchorRecord: ",o),null}}generateAnchorRecordForElement(r,i){try{if(!r)return null;let o=r,s=o.tagName?.toUpperCase();if(!s)return null;let a=o.id&&!this.isLikelyDynamicId(o.id)?o.id:void 0,c=this.getStableAttributes(o),l=this.buildStableElementSelector(o,c),d=this.getVisibleText(o),h=this.hashText(d||""),f=this.generateRobustXPath(o),g=this.getXPath(o,!1,!1,void 0,{ignoreGeneratedIds:i?.ignoreGeneratedIds}),E=this.getXPath(o,!0),I=this.getXPath(o,!0,!0);return{version:"1.0",id:a,tagName:s,elementSelector:l,robustXPath:f||void 0,xPath:g||void 0,fXPath:E||void 0,cfXPath:I||void 0,contentHash:h?{value:h,algorithm:"md5",source:"textContent"}:void 0,createdAt:Date.now()}}catch(o){return this.loggingService.catch("Error in DomService generateAnchorRecordForElement: ",o),null}}resolveAnchorRecord(r,i){try{let o=Hre(r,i);if(o){let a=this.getVerifiedCachedAnchor(o,r,i?.accept);if(a)return a}let s=this.resolveAnchorRecordUncached(r,i);return o&&this.cacheAnchorResolution(o,r,s),s}catch(o){return this.loggingService.catch("Error in DomService resolveAnchorRecord: ",o),this.resolveAnchorRecordUncached(r,i)}}getVerifiedCachedAnchor(r,i,o){try{let s=this.anchorResolutionCache.get(r);if(!s)return null;let a=s.element.deref();return!!a&&a.isConnected&&Wp(o,a,this.loggingService)&&(!i.tagName||a.tagName?.toUpperCase()===i.tagName)&&(!i.contentHash?.value||this.hashVisibleText(a)===i.contentHash.value)&&(!i.id||a.id===i.id)&&!this.isOutrankedByStrongerLocator(i,s.resolution,a,o)?le(V({},s.resolution),{element:a}):(this.anchorResolutionCache.delete(r),null)}catch(s){return this.loggingService.catch("Error in DomService getVerifiedCachedAnchor: ",s),null}}isOutrankedByStrongerLocator(r,i,o,s){try{let a=jre(i.matchedBy),c=i.score??0,l=h=>h!==o&&Wp(s,h,this.loggingService),d=(h,f)=>f+(r.tagName&&h.tagName?.toUpperCase()===r.tagName?10:0)+(r.contentHash?.value&&this.hashVisibleText(h)===r.contentHash.value?30:0);if(a>1&&r.elementSelector){let h=this.getAllElementsFromSelector(r.elementSelector);if(h.length===1&&l(h[0])||h.some(f=>l(f)&&d(f,60)>=c))return!0}return!!(a>2&&r.robustXPath&&this.getAllElementsFromRobustXPath(r.robustXPath).slice(0,e.MAX_ROBUST_XPATH_CANDIDATES).some(f=>l(f)&&d(f,50)>=c))}catch(a){return this.loggingService.catch("Error in DomService isOutrankedByStrongerLocator: ",a),!0}}cacheAnchorResolution(r,i,o){try{if(!o?.element){this.anchorResolutionCache.delete(r);return}let a=!!i.contentHash?.value&&!!o.scoreBreakdown?.some(h=>h.method==="contentHash-match"),c=o.matchedBy==="id";if(!a&&!c){this.anchorResolutionCache.delete(r);return}this.anchorResolutionCache.size>=e.ANCHOR_CACHE_LIMIT&&this.anchorResolutionCache.clear();let s=o,{element:l}=s,d=mS(s,["element"]);this.anchorResolutionCache.set(r,{element:new WeakRef(l),resolution:d})}catch(a){this.loggingService.catch("Error in DomService cacheAnchorResolution: ",a)}}resolveAnchorRecordUncached(r,i){try{let o=[],s=null,a=i?.accept,c=R=>Wp(a,R,this.loggingService),l=(R,U,G=0)=>{if(!c(R))return;let X=[],ce=G;X.push({method:U,score:G}),r.tagName&&R.tagName?.toUpperCase()===r.tagName&&(ce+=10,X.push({method:"tagName-match",score:10})),r.contentHash?.value&&this.hashVisibleText(R)===r.contentHash.value&&(ce+=30,X.push({method:"contentHash-match",score:30})),o.push({el:R,score:ce,by:U,scoreBreakdown:X})};if(r.id){let R=document.querySelectorAll(`#${CSS.escape(r.id)}`);if(R.length===1&&c(R[0]))return{element:R[0],matchedBy:"id",score:90};R.length>1&&R.forEach(U=>l(U,"id-duplicate",70))}if(r.elementSelector){let R=document.querySelectorAll(r.elementSelector);if(R.length===1&&c(R[0]))return{element:R[0],matchedBy:"element-selector",score:80};R.forEach(U=>l(U,"element-selector-duplicate",60))}r.robustXPath&&this.getAllElementsFromRobustXPath(r.robustXPath).slice(0,e.MAX_ROBUST_XPATH_CANDIDATES).forEach(G=>l(G,"robustXPath",50));let d=()=>o.reduce((R,U)=>Math.max(R,U.score),-1/0),h=80,f=70;r?.parent&&d()<=h&&(s=this.resolveAnchorRecord(r.parent,le(V({},i),{cacheKey:i?.cacheKey?`${i.cacheKey}#parent`:void 0})),s.element&&s.element.querySelectorAll(r.tagName?.toLowerCase()||"*").forEach(U=>l(U,"parent+tag",40)));let g=(R,U,G)=>{if(!R)return;let X=this.getElementFromXPathAccepted(R,a);X&&l(X,U||"xpath",G||30)};if(d()<=f&&(g(r.xPath,"xPath",30),g(r.cfXPath,"cfXPath",30),g(r.fXPath,"fXPath",30)),r.contentHash?.value&&o.length===0){let U=G=>{let X=0;for(let ce=0;ce<G.length&&X<400;ce++){let ne=G[ce];if(X++,!this.isElementVisible(ne))continue;let A=this.hashVisibleText(ne);A&&A===r.contentHash?.value&&l(ne,"contentHash",15)}};if(s?.element&&s?.element instanceof Element){let G=s?.element?.querySelectorAll("*");U(G)}}if(!o.length)return{element:null};o.sort((R,U)=>U.score-R.score);let E=o[0].score,I=o.filter(R=>R.score===E);if(I.length>1){let R=[{path:r.xPath,label:"xPath"},{path:r.cfXPath,label:"cfXPath"},{path:r.fXPath,label:"fXPath"}];for(let U of R)if(U.path){let G=this.getElementFromXPathAccepted(U.path,a);if(G){let X=I.find(ce=>ce.el===G);if(X)return{element:X.el,matchedBy:`${X.by}+position`,score:X.score,scoreBreakdown:X.scoreBreakdown}}}}let S=o[0];return{element:S.el,matchedBy:S.by,score:S.score,scoreBreakdown:S.scoreBreakdown}}catch(o){return this.loggingService.catch("Error in DomService resolveAnchorRecord: ",o),{element:null}}}subscribeToDomEvents(){try{this.docService?.getDocumentPaths$().pipe(De(r=>{r?(this.onWindowResize(),this.onWindowScroll(),this.onPointerDown(),this.onWindowClick(),this.onWindowKeyupBackspace(),this.onWindowKeyupDelete(),this.onWindowKeyupEsc(),this.onWindowPopState(),this.onWindowKeydownShift(),this.onWindowKeyupShift(),this.addPointerMoveListener(),this.addPointerUpListener(),this.addSelectionChangeListener(),this.onDocumentFocus(),this.setupSmoothScrollShield()):(this.unsubscribeFromWindowResize(),this.unsubscribeFromWindowScroll(),this.unsubscribeFromPointerDown(),this.unsubscribeFromWindowClick(),this.unsubscribeFromWindowKeyupBackspace(),this.unsubscribeFromWindowKeyupDelete(),this.unsubscribeFromWindowKeyupEsc(),this.unsubscribeFromWindowPopState(),this.unsubscribeFromWindowKeydownShift(),this.unsubscribeFromWindowKeyupShift(),this.unsubscribeFromPointerMoveListener(),this.unsubscribeFromPointerUpListener(),this.unsubscribeFromSelectionChangeListener(),this.unsubscribeFromDocumentFocus(),this.unsetMutationObserver(),this.teardownSmoothScrollShield())})).subscribe(),this.onDocumentClick()}catch(r){this.loggingService.catch("Error in DomService subscribeToDomEvents: ",r)}}setScrollableElementsIds(r){try{r&&r.length&&this.scrollableElementsIds$.next(Array.from(new Set(r)))}catch(i){this.loggingService.catch("Error in DomService setScrollableElementsIds: ",i)}}getScrollableElementsIds$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getScrollableElementsIds$","color: green;"),this.scrollableElementsIds$.asObservable()}removeScrollableElementsIds(){this.scrollableElementsIds$.next([])}setMutationObserver(r){try{this.mutationObserver||(this.loggingService.log("%c[WB] Calling DomService FUNCTION: setMutationObserver","color: green;"),this.loggingService.log("%c[WB] setMutationObserver from: "+r,"color: green;"),this.animationFilterEnabled=this.detectAnimationLibraries(),this.loggingService.log("%c[WB] Animation filter:","color: green;",this.animationFilterEnabled?"ENABLED (library detected)":"DISABLED (no library)"),this.mutationObserver=new MutationObserver(i=>{try{if(i?.find(s=>s?.attributeName===k.VELT_IGNORE_CHANGE_DETECTION))return;let o=i.filter(s=>s.type==="childList").filter(s=>{let a=s.target;return s.removedNodes.forEach(c=>{let l=c;if(typeof l.getAttribute=="function"){let d=l.getAttribute(k.ATTRIBUTES.VELT_ELEMENT_CACHE_ID);if(d!==null&&d!==""){let h=this.xpathCacheId.get(d);h!==void 0&&(this.xpathCacheId.delete(d),this.xpathCache.delete(h))}}}),ao(a)?!1:!!(this.filterSnippylyNodes(s.addedNodes).length||this.filterSnippylyNodes(s.removedNodes).length)});this.animationFilterEnabled?this.childListMutation$.next(o.filter(s=>!this.isAnimatingElement(s.target))):this.childListMutation$.next(o),o.push(...i.filter(s=>s.type==="attributes").filter(s=>!Gre.has(s.attributeName??"")).filter(s=>!ao(s.target)).filter(s=>this.filterSnippylyNodes([s.target]).length).filter(s=>{if(s){let a=s.target;return a?.classList?.contains("snippyly-sidebar-panel")?!1:a?!a.getAttribute(k.VELT_IGNORE_CHANGE_DETECTION):!0}return!0})),o=o.filter(s=>{let a=!0;return Object.keys(k.INGNORE_MUTATION_OBSERVER_CHANGE_TAGS).forEach(c=>{s.target?.closest(c)&&(a=!1)}),a}),o=o.filter(s=>s.target&&ld(s.target)),this.animationFilterEnabled&&(o=o.filter(s=>!this.isAnimatingElement(s.target))),o.length&&(this.pendingMutations.push(...o),this.runOncePerFrame("mutations",()=>{let s=this.pendingMutations;this.pendingMutations=[],s.length&&this.mutation$.next(s)}))}catch(o){this.loggingService.catch("Error in DomService change detection: ",o)}}),this.mutationObserver.observe(document.body,{childList:!0,subtree:!0,attributes:!0}))}catch(i){this.loggingService.catch("Error in DomService change detection: ",i)}}detectAnimationLibraries(){try{if(this.animationLibraryDetected!==null)return this.animationLibraryDetected;let r=window;return r.gsap||r.TweenMax||r.TweenLite||r.TimelineMax||r.TimelineLite?(this.loggingService.log("%c[WB] Detected animation library: GSAP","color: green;"),this.animationLibraryDetected=!0,!0):r.Swiper?(this.loggingService.log("%c[WB] Detected animation library: Swiper","color: green;"),this.animationLibraryDetected=!0,!0):r.AOS?(this.loggingService.log("%c[WB] Detected animation library: AOS","color: green;"),this.animationLibraryDetected=!0,!0):r.anime?(this.loggingService.log("%c[WB] Detected animation library: Anime.js","color: green;"),this.animationLibraryDetected=!0,!0):r.lottie||r.Lottie||r.bodymovin?(this.loggingService.log("%c[WB] Detected animation library: Lottie","color: green;"),this.animationLibraryDetected=!0,!0):document.querySelector("[data-framer-component-type]")?(this.loggingService.log("%c[WB] Detected animation library: Framer Motion","color: green;"),this.animationLibraryDetected=!0,!0):document.querySelector(this.ANIMATION_LIBRARY_SELECTOR)?(this.loggingService.log("%c[WB] Detected animation library: DOM markers","color: green;"),this.animationLibraryDetected=!0,!0):(this.loggingService.log("%c[WB] No animation library detected","color: green;"),this.animationLibraryDetected=!1,!1)}catch{return this.animationLibraryDetected=!1,!1}}isAnimatingElement(r){try{if(!r||typeof r.closest!="function")return!1;let i=window;if(i.gsap&&typeof i.gsap.isTweening=="function"){if(i.gsap.isTweening(r))return!0;if(typeof i.gsap.getTweensOf=="function")try{if(i.gsap.getTweensOf(r).length>0)return!0}catch{}}else if(i.TweenMax&&typeof i.TweenMax.isTweening=="function"){if(i.TweenMax.isTweening(r))return!0;if(typeof i.TweenMax.getTweensOf=="function")try{if(i.TweenMax.getTweensOf(r).length>0)return!0}catch{}}let o=r.style?.cssText||"";if(o){let l=o.includes("transform")||o.includes("translate3d")||o.includes("translate(")||o.includes("scale3d")||o.includes("rotate"),d=o.includes("will-change")&&o.includes("transform"),h=o.includes("transform-style")&&o.includes("preserve-3d");if(l&&(d||h))return!0}if(r.style&&(r.style.animation!==""&&r.style.animation!=="none"||r.style.transition!==""&&r.style.transition!=="none")||r.classList?.contains("animate")||r.classList?.contains("animating")||r.classList?.contains("animated")||r.classList?.contains("animation"))return!0;let s=this.staticAnimationCache.get(r);if(s!==void 0)return s;let a=!1,c=r.className||"";return typeof c=="string"&&(c.includes("slider")&&(c.includes("bullet")||c.includes("pagination"))&&(a=!0),c.includes("swiper-pagination")&&(a=!0)),!a&&(r.hasAttribute("data-aos")||r.hasAttribute("data-motion"))&&(a=!0),!a&&r.closest(this.ANIMATION_LIBRARY_SELECTOR)&&(a=!0),this.staticAnimationCache.set(r,a),a}catch{return!1}}runOncePerFrame(r,i){let o=this.frameTasks.has(r);if(this.frameTasks.set(r,i),o)return;let s=!1,a,c,l=()=>{if(s)return;s=!0,a!==void 0&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(a),c!==void 0&&clearTimeout(c);let d=this.frameTasks.get(r);this.frameTasks.delete(r);try{d?.()}catch(h){this.loggingService.catch(`Error in DomService frame task ${r}: `,h)}};typeof requestAnimationFrame=="function"&&(a=requestAnimationFrame(l)),c=setTimeout(l,100)}unsetMutationObserver(){try{this.mutationObserver&&(this.mutationObserver.disconnect(),this.mutationObserver=null,this.pendingMutations=[],this.staticAnimationCache=new WeakMap,this.animationLibraryDetected=null,this.animationFilterEnabled=!1)}catch(r){this.loggingService.catch("Error in DomService unsetMutationObserver: ",r)}}detectNetworkStatusChange(){this.loggingService.log("%c[WB] Calling FUNCTION: detectNetworkStatusChange","color: green;");try{vs($i(window,"offline").pipe(De(()=>!1)),$i(window,"online").pipe(De(()=>!0)),new he(r=>{r.next(navigator.onLine),r.complete()})).subscribe(r=>{this.networkStatus$.next(r)})}catch(r){this.loggingService.catch("Error in DomService detectNetworkStatusChange: ",r)}}onWindowResize(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowResize","color: green;");try{this.unsubscribeFromWindowResize();let r=null;this.unlistenWindowResize=this.renderer.listen("window","resize",i=>{r=i,this.runOncePerFrame("resize",()=>{let o=r;r=null,this.windowResize$.next(o);let s=this.calculateScreenSize();this.deviceInfo$.next(new Wr),this.currentScreenSize$.next(s)})})}catch(r){this.loggingService.catch("Error in DomService onWindowResize: ",r)}}unsubscribeFromWindowResize(){try{this.unlistenWindowResize&&typeof this.unlistenWindowResize=="function"&&(this.unlistenWindowResize(),this.unlistenWindowResize=null)}catch(r){this.loggingService.catch("Error in DomService unsubscribeFromWindowResize: ",r)}}onWindowScroll(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowScroll","color: green;");try{this.unsubscribeFromWindowScroll(),this.unlistenWindowScroll=this.renderer.listen("window","scroll",r=>{this.windowScroll$.next(r),this.runOncePerFrame("screen-size",()=>this.currentScreenSize$.next(this.calculateScreenSize()))})}catch(r){this.loggingService.catch("Error in DomService onWindowScroll: ",r)}}unsubscribeFromWindowScroll(){try{this.unlistenWindowScroll&&typeof this.unlistenWindowScroll=="function"&&(this.unlistenWindowScroll(),this.unlistenWindowScroll=null)}catch(r){this.loggingService.catch("Error in DomService unsubscribeFromWindowScroll: ",r)}}setupSmoothScrollShield(){this.loggingService.log("%c[WB] Calling FUNCTION: setupSmoothScrollShield","color: green;");try{if(typeof window>"u"||typeof document>"u"||this.smoothScrollShieldHandler)return;if(this.isSmoothScrollLibPresent()){this.attachSmoothScrollShield();return}if(document.readyState!=="complete"&&!this.smoothScrollShieldLoadListener){let r=()=>{this.smoothScrollShieldLoadListener=null;try{if(this.smoothScrollShieldHandler)return;this.isSmoothScrollLibPresent()&&this.attachSmoothScrollShield()}catch(i){this.loggingService.catch("Error in DomService smooth-scroll shield load re-check: ",i)}};window.addEventListener("load",r,{once:!0}),this.smoothScrollShieldLoadListener=()=>window.removeEventListener("load",r)}}catch(r){this.loggingService.catch("Error in DomService setupSmoothScrollShield: ",r)}}isSmoothScrollLibPresent(){try{if(typeof window>"u"||typeof document>"u")return!1;if(window.ET_SmoothScroll)return!0;let i=document.body;return!!(i&&i.classList&&i.classList.contains("et_smooth_scroll"))}catch(r){return this.loggingService.catch("Error in DomService isSmoothScrollLibPresent: ",r),!1}}attachSmoothScrollShield(){if(this.smoothScrollShieldHandler)return;let r=/^(VELT-|SUPERFLOW-|SNIPPYLY-)/,i=s=>{try{let a=typeof s.composedPath=="function"?s.composedPath():[];for(let c=0;c<a.length;c++){let l=a[c];if(!(!l||l.nodeType!==1)&&l.tagName&&r.test(l.tagName)){s.stopImmediatePropagation();return}}}catch(a){this.loggingService.catch("Error in DomService smoothScrollShield handler: ",a)}};this.smoothScrollShieldHandler=i;let o={capture:!0,passive:!0};window.addEventListener("wheel",i,o),window.addEventListener("mousewheel",i,o),window.addEventListener("touchmove",i,o),this.unlistenWindowWheelShield=()=>window.removeEventListener("wheel",i,o),this.unlistenWindowMouseWheelShield=()=>window.removeEventListener("mousewheel",i,o),this.unlistenWindowTouchMoveShield=()=>window.removeEventListener("touchmove",i,o)}teardownSmoothScrollShield(){this.loggingService.log("%c[WB] Calling FUNCTION: teardownSmoothScrollShield","color: green;");try{try{this.smoothScrollShieldLoadListener&&typeof this.smoothScrollShieldLoadListener=="function"&&(this.smoothScrollShieldLoadListener(),this.smoothScrollShieldLoadListener=null)}catch(r){this.loggingService.catch("Error in DomService teardownSmoothScrollShield (load): ",r)}try{this.unlistenWindowWheelShield&&typeof this.unlistenWindowWheelShield=="function"&&(this.unlistenWindowWheelShield(),this.unlistenWindowWheelShield=null)}catch(r){this.loggingService.catch("Error in DomService teardownSmoothScrollShield (wheel): ",r)}try{this.unlistenWindowMouseWheelShield&&typeof this.unlistenWindowMouseWheelShield=="function"&&(this.unlistenWindowMouseWheelShield(),this.unlistenWindowMouseWheelShield=null)}catch(r){this.loggingService.catch("Error in DomService teardownSmoothScrollShield (mousewheel): ",r)}try{this.unlistenWindowTouchMoveShield&&typeof this.unlistenWindowTouchMoveShield=="function"&&(this.unlistenWindowTouchMoveShield(),this.unlistenWindowTouchMoveShield=null)}catch(r){this.loggingService.catch("Error in DomService teardownSmoothScrollShield (touchmove): ",r)}this.smoothScrollShieldHandler=null}catch(r){this.loggingService.catch("Error in DomService teardownSmoothScrollShield: ",r)}}onPointerDown(){this.loggingService.log("%c[WB] Calling FUNCTION: onPointerDown","color: green;");try{this.unsubscribeFromPointerDown(),this.unlistenPointerDown=this.renderer.listen("window","pointerdown",r=>{this.mousedown=!0,this.windowMouseDown$.next(r),this.setPointerPosition(r)})}catch(r){this.loggingService.catch("Error in DomService onPointerDown: ",r)}}unsubscribeFromPointerDown(){try{this.unlistenPointerDown&&typeof this.unlistenPointerDown=="function"&&(this.unlistenPointerDown(),this.unlistenPointerDown=null)}catch(r){this.loggingService.catch("Error in DomService unsubscribeFromPointerDown: ",r)}}onWindowClick(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeyupBackspace","color: green;");try{this.unsubscribeFromWindowClick(),this.unlistenWindowClick=this.renderer.listen("window","click",r=>{this.windowClick$.next(r)})}catch(r){this.loggingService.catch("Error in DomService onWindowClick: ",r)}}unsubscribeFromWindowClick(){try{this.unlistenWindowClick&&typeof this.unlistenWindowClick=="function"&&(this.unlistenWindowClick(),this.unlistenWindowClick=null)}catch(r){this.loggingService.catch("Error in DomService unsubscribeFromWindowClick: ",r)}}onWindowKeyupBackspace(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeyupBackspace","color: green;");try{this.unsubscribeFromWindowKeyupBackspace(),this.unlistenWindowKeyupBackspace=this.renderer.listen("window","keyup.backspace",r=>{this.isVideoEditorHandlingDelete||this.windowKeyupBackspace$.next(r)})}catch(r){this.loggingService.catch("Error in DomService onWindowKeyupBackspace: ",r)}}unsubscribeFromWindowKeyupBackspace(){try{this.unlistenWindowKeyupBackspace&&typeof this.unlistenWindowKeyupBackspace=="function"&&(this.unlistenWindowKeyupBackspace(),this.unlistenWindowKeyupBackspace=null)}catch(r){this.loggingService.catch("Error in DomService unsubscribeFromWindowKeyupBackspace: ",r)}}onWindowKeyupDelete(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeyupDelete","color: green;");try{this.unsubscribeFromWindowKeyupDelete(),this.unlistenWindowKeyupDelete=this.renderer.listen("window","keyup.delete",r=>{this.isVideoEditorHandlingDelete||this.windowKeyupDelete$.next(r)})}catch(r){this.loggingService.catch("Error in DomService onWindowKeyupDelete: ",r)}}unsubscribeFromWindowKeyupDelete(){try{this.unlistenWindowKeyupDelete&&typeof this.unlistenWindowKeyupDelete=="function"&&(this.unlistenWindowKeyupDelete(),this.unlistenWindowKeyupDelete=null)}catch(r){this.loggingService.catch("Error in DomService unsubscribeFromWindowKeyupDelete: ",r)}}onWindowKeyupEsc(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeyupEsc","color: green;");try{this.unsubscribeFromWindowKeyupEsc(),this.unlistenWindowKeyupEsc=this.renderer.listen("window","keyup.esc",r=>{this.windowKeyupEsc$.next(r)})}catch(r){this.loggingService.catch("Error in DomService onWindowKeyupEsc: ",r)}}unsubscribeFromWindowKeyupEsc(){try{this.unlistenWindowKeyupEsc&&typeof this.unlistenWindowKeyupEsc=="function"&&(this.unlistenWindowKeyupEsc(),this.unlistenWindowKeyupEsc=null)}catch(r){this.loggingService.catch("Error in DomService unsubscribeFromWindowKeyupEsc: ",r)}}onWindowPopState(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowPopState","color: green;");try{this.unsubscribeFromWindowPopState(),this.unlistenWindowPopState=this.renderer.listen("window","popstate",r=>{this.windowPopState$.next(r)})}catch(r){this.loggingService.catch("Error in DomService onWindowPopState: ",r)}}unsubscribeFromWindowPopState(){try{this.unlistenWindowPopState&&typeof this.unlistenWindowPopState=="function"&&(this.unlistenWindowPopState(),this.unlistenWindowPopState=null)}catch(r){this.loggingService.catch("Error in DomService unsubscribeFromWindowPopState: ",r)}}onDocumentClick(){this.loggingService.log("%c[WB] Calling FUNCTION: onDocumentClick","color: green;");try{this.unsubscribeFromDocumentClick(),this.documentClickListener=r=>{r?.target?.tagName?.toLowerCase()!==k.TAGS.SUPERFLOW_TOOLBAR&&(this.lastDocumentClickTarget=r?.target?new WeakRef(r.target):null,this.documentClick$.next(r),this.documentClickSubject$.next(r))},document.addEventListener("click",this.documentClickListener,!0)}catch(r){this.loggingService.catch("Error in DomService onDocumentClick: ",r)}}unsubscribeFromDocumentClick(){try{this.documentClickListener&&typeof this.documentClickListener=="function"&&(document.removeEventListener("click",this.documentClickListener,!0),this.documentClickListener=null)}catch(r){this.loggingService.catch("Error in DomService unsubscribeFromDocumentClick: ",r)}}onDocumentFocus(){this.loggingService.log("%c[WB] Calling FUNCTION: onDocumentFocus","color: green;");try{this.unsubscribeFromDocumentFocus(),this.documentFocusListener=r=>{this.documentFocus$.next(r)},document.addEventListener("focus",this.documentFocusListener,!0)}catch(r){this.loggingService.catch("Error in DomService onDocumentFocus: ",r)}}unsubscribeFromDocumentFocus(){try{this.documentFocusListener&&typeof this.documentFocusListener=="function"&&(document.removeEventListener("focus",this.documentFocusListener,!0),this.documentFocusListener=null)}catch(r){this.loggingService.catch("Error in DomService unsubscribeFromDocumentFocus: ",r)}}onWindowKeydownShift(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeydownShift","color: green;");try{this.unsubscribeFromWindowKeydownShift(),this.unlistenWindowKeydownShift=this.renderer.listen("window","keydown.shift",()=>{this.isShiftKeyPressed=!0})}catch(r){this.loggingService.catch("Error in DomService onWindowKeydownShift: ",r)}}unsubscribeFromWindowKeydownShift(){try{this.unlistenWindowKeydownShift&&typeof this.unlistenWindowKeydownShift=="function"&&(this.unlistenWindowKeydownShift(),this.unlistenWindowKeydownShift=null)}catch(r){this.loggingService.catch("Error in DomService unsubscribeFromWindowKeydownShift: ",r)}}onWindowKeyupShift(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeyupShift","color: green;");try{this.unsubscribeFromWindowKeyupShift(),this.unlistenWindowKeyupShift=this.renderer.listen("window","keyup.shift",()=>{this.isShiftKeyPressed=!1})}catch(r){this.loggingService.catch("Error in DomService onWindowKeyupShift: ",r)}}unsubscribeFromWindowKeyupShift(){try{this.unlistenWindowKeyupShift&&typeof this.unlistenWindowKeyupShift=="function"&&(this.unlistenWindowKeyupShift(),this.unlistenWindowKeyupShift=null)}catch(r){this.loggingService.catch("Error in DomService unsubscribeFromWindowKeyupShift: ",r)}}onWindowKeydown$(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeydown$","color: green;");try{return $i(window,"keydown")}catch(r){return this.loggingService.catch("Error in DomService onWindowKeydown$: ",r),rc}}addPointerMoveListener(){this.loggingService.log("%c[WB] Calling FUNCTION: addPointerMoveListener","color: green;");try{this.unsubscribeFromPointerMoveListener(),this.unlistenPointerMoveListener=this.renderer.listen("document","pointermove",r=>{this.windowPointerMove$.next(r),this.mouseMoveEvent=r})}catch(r){this.loggingService.catch("Error in DomService addPointerMoveListener: ",r)}}unsubscribeFromPointerMoveListener(){try{this.unlistenPointerMoveListener&&typeof this.unlistenPointerMoveListener=="function"&&(this.unlistenPointerMoveListener(),this.unlistenPointerMoveListener=null)}catch(r){this.loggingService.catch("Error in DomService unsubscribeFromPointerMoveListener: ",r)}}addPointerUpListener(){this.loggingService.log("%c[WB] Calling FUNCTION: addPointerUpListener","color: green;");try{this.unsubscribeFromPointerUpListener(),this.unlistenPointerUpListener=this.renderer.listen("document","pointerup",r=>{this.windowPointerUp$.next(r)})}catch(r){this.loggingService.catch("Error in DomService addPointerUpListener: ",r)}}unsubscribeFromPointerUpListener(){try{this.unlistenPointerUpListener&&typeof this.unlistenPointerUpListener=="function"&&(this.unlistenPointerUpListener(),this.unlistenPointerUpListener=null)}catch(r){this.loggingService.catch("Error in DomService unsubscribeFromPointerUpListener: ",r)}}addSelectionChangeListener(){this.loggingService.log("%c[WB] Calling FUNCTION: addPointerUpListener","color: green;");try{this.unsubscribeFromSelectionChangeListener(),this.unlistenSelectionChangeListener=this.renderer.listen("document","selectionchange",r=>{this.documentSelectionChange$.next(r)})}catch(r){this.loggingService.catch("Error in DomService addPointerUpListener: ",r)}}unsubscribeFromSelectionChangeListener(){try{this.unlistenSelectionChangeListener&&typeof this.unlistenSelectionChangeListener=="function"&&(this.unlistenSelectionChangeListener(),this.unlistenSelectionChangeListener=null)}catch(r){this.loggingService.catch("Error in DomService unsubscribeFromSelectionChangeListener: ",r)}}updateCurrentMousePosition(r){try{if(this.currentMousePosition.pageX=r.pageX,this.currentMousePosition.pageY=r.pageY,this.currentMousePosition.clientX=r.clientX,this.currentMousePosition.clientY=r.clientY,r.target){let i=this.getXPath(r.target),o=r.target;if(i?.includes("name()='svg'")){let h=this.getXPath(i);h&&(o=h.iterateNext()||r.target)}let s=o.getBoundingClientRect(),a=r.clientX-s.x,c=r.clientY-s.y,l=a*100/(s.width||1),d=c*100/(s.height||1);this.currentMousePosition.element={xpath:i,topPercentage:d,leftPercentage:l}}else this.currentMousePosition.element=null;this.currentMousePosition$.next(this.currentMousePosition)}catch(i){this.loggingService.catch("Error in DomService updateCurrentMousePosition: ",i)}}getTargetElementForCursorPosition(r,i=!0,o=!1,s=!0,a,c=!0,l,d){try{let h=r,f=h?.touches?.length?h.touches[0]?.clientX:h?.clientX,g=h?.touches?.length?h.touches[0]?.clientY:h?.clientY;l&&(f=l.clientX,g=l.clientY);let E=this.getBackgroundElement(f,g,i,o);if(E&&a&&typeof a=="function"&&(E=a(E)),E){let I=this.getXPath(E,!1,!1,void 0,d),S=this.getXPath(E,!0),R=E.getBoundingClientRect(),U=f-R.x,G=g-R.y,X=U*100/(R.width||1),ce=G*100/(R.height||1),ne={xpath:I,fXpath:S,leftPercentage:X,topPercentage:ce};if(s){let A=this.getXPath(E,!0,!0);ne.cfXpath=A}if(c){let A=this.generateAnchorRecord(E,d);A&&(ne.anchor=A)}return ne}else return null}catch(h){return this.loggingService.catch("Error in DomService getTargetElementForCommentPinAnnotation: ",h),null}}getBackgroundElement(r,i,o=!0,s=!1){try{let a=document.elementsFromPoint(r,i),c=[];a.forEach(d=>{ao(d)?c=[]:ld(d)&&c.push(d)}),s&&(c=c.filter(d=>this.isElementVisibleOnScreen(d)));let l=0;return o||c?.forEach((d,h)=>{d.tagName.toLowerCase()==="svg"&&(l=h)}),c[l]}catch(a){return this.loggingService.catch("Error in DomService getBackgroundElement: ",a),null}}getBackgroundVeltElement(r,i){try{let o=document.elementsFromPoint(r,i),s=[];return o.forEach(a=>{ao(a)&&ld(a)&&s.push(a)}),s[0]}catch(o){return this.loggingService.catch("Error in DomService getBackgroundSnippylyElement: ",o),null}}setPointerPosition(r){this.loggingService.log("%c[WB] Calling FUNCTION: setPointerPosition","color: green;");try{this.previousMousePosition.pageX=r.pageX,this.previousMousePosition.pageY=r.pageY,this.currentMousePosition.pageX=r.pageX,this.currentMousePosition.pageY=r.pageY}catch(i){this.loggingService.catch("Error in DomService setPointerPosition: ",i)}}getCurrentWindowSize$(r){return this.loggingService.log("%c[WB] Calling FUNCTION: getCurrentWindowSize","color: green;"),this.currentScreenSize$.asObservable()}getCurrentMousePosition$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getCurrentMousePosition","color: green;"),this.currentMousePosition$.asObservable()}getCurrentWindowSizeValue(){return this.loggingService.log("%c[WB] Calling FUNCTION: getCurrentWindowSizeValue","color: green;"),this.currentScreenSize$.value}getTopLeftPosition(){this.loggingService.log("%c[WB] Calling FUNCTION: getTopLeftPosition","color: green;");try{let r=document?.body?.getBoundingClientRect()||document?.documentElement?.getBoundingClientRect(),i=this.currentMousePosition?.pageX||r.x+200,o=Math.min(i,r.width/2),s=Math.abs(r.y),a=r.y-20;return s>50&&(a=Math.abs(r.y)+180),this.loggingService.log(r),this.loggingService.log(o),this.loggingService.log(a),{topPositionX:o,topPositionY:a}}catch(r){return this.loggingService.catch("Error in DomService getTopLeftPosition: ",r),{topPositionX:0,topPositionY:0}}}toggleSelection(){this.enableRectSelectionSubject$.next(!this.enableRectSelectionSubject$.value)}enableSelection(){this.enableRectSelectionSubject$.next(!0)}disableSelection(){this.enableRectSelectionSubject$.next(!1)}setPinHighlighterClass(r){this.pinHighlighterClass$.next(r)}setTextHighlighterClass(r){this.textHighlighterClass$.next(r)}getTextHighlighterClass(){return this.textHighlighterClass$.asObservable()}enableCommentPinHighlighter(){this.commentPinHighlighter$.next(!0)}disableCommentPinHighlighter(){this.commentPinHighlighter$.next(!1)}getCommentPinHighlighter$(){return this.commentPinHighlighter$.asObservable()}getCommentPinHighlighter(){return this.commentPinHighlighter$?.value}highlightElement(r,i,o){if(r&&!Gs(r)){if(!o&&this.getCommentPinHighlighter()&&(this.pinHighlighterClass$.value?this.addClassToElement(r,this.pinHighlighterClass$.value):this.addClassToElement(r,k.SNIPPYLY_HIGHLIGHT)),i&&!r.hasAttribute(k.ATTRIBUTES.DEFAULT_CURSOR)){let s=r.style.getPropertyValue("cursor"),a=r.style.getPropertyPriority("cursor"),c=s?{defaultCursorValue:s,defaultCursorPriority:a}:"";r.setAttribute(k.ATTRIBUTES.DEFAULT_CURSOR,c?JSON.stringify(c):""),r.style.setProperty("cursor",i,"important")}r.setAttribute(k.SNIPPYLY_HIGHLIGHT,"true"),r.setAttribute(k.VELT_IGNORE_CHANGE_DETECTION,"true")}}removeHighlightFromElement(r){if(r&&(this.pinHighlighterClass$.value&&this.removeClassFromElement(r,this.pinHighlighterClass$.value),this.removeClassFromElement(r,k.SNIPPYLY_HIGHLIGHT),r.removeAttribute(k.SNIPPYLY_HIGHLIGHT),r.removeAttribute(k.VELT_IGNORE_CHANGE_DETECTION),r.hasAttribute(k.ATTRIBUTES.DEFAULT_CURSOR))){try{if(r.style.removeProperty("cursor"),r.getAttribute(k.ATTRIBUTES.DEFAULT_CURSOR)){let i=JSON.parse(r.getAttribute(k.ATTRIBUTES.DEFAULT_CURSOR));r.style.setProperty("cursor",i.defaultCursorValue,i.defaultCursorPriority)}}catch{}r.removeAttribute(k.ATTRIBUTES.DEFAULT_CURSOR)}}highlightUserElement(r,i,o,s=!1){try{r&&(this.addClassToElement(r,k.VELT_LIVE_SELECTION_ON_ELEMENT),s&&this.addClassToElement(r,k.VELT_LIVE_SELECTION_ON_ELEMENT_DEFAULT),r.setAttribute(k.SNIPPYLY_HIGHLIGHT,"true"),r.setAttribute(k.VELT_IGNORE_CHANGE_DETECTION,"true"),i&&!r.style.getPropertyValue(k.VELT_SELECTION_COLOR)&&r.style.setProperty(k.VELT_SELECTION_COLOR,i),o&&r.setAttribute(k.SNIPPYLY_HIGHLIGHT_USER_NAME,o))}catch(a){this.loggingService.catch("Error in DomService highlightUserElement: ",a)}}removeHighlightUserFromElement(r){try{r&&(this.removeClassFromElement(r,k.VELT_LIVE_SELECTION_ON_ELEMENT),this.removeClassFromElement(r,k.VELT_LIVE_SELECTION_ON_ELEMENT_DEFAULT),r.removeAttribute(k.SNIPPYLY_HIGHLIGHT),r.removeAttribute(k.VELT_IGNORE_CHANGE_DETECTION),r.removeAttribute(k.VELT_SELECTION_COLOR),r.removeAttribute(k.SNIPPYLY_HIGHLIGHT_USER_NAME),r.style.removeProperty(k.VELT_SELECTION_COLOR))}catch(i){this.loggingService.catch("Error in DomService removeHighlightUserFromElement: ",i)}}previewHighlightElement(r){r&&r.setAttribute(k.SNIPPYLY_HIGHLIGHT_PREVIEW,"true")}removePreviewHighlightFromElement(r){r&&r.removeAttribute(k.SNIPPYLY_HIGHLIGHT_PREVIEW)}getXPath(r,i=!1,o=!1,s,a){try{let c=this.calculateXPath(r,i,o,s,a);if(c&&typeof c=="string"&&c.includes("/svg")){let l=c.split("/"),d=!1;l.forEach((h,f)=>{h.includes("svg")&&(d=!0),d&&(l[f]="svg:"+h)}),c=l.join("/")}return c}catch(c){this.loggingService.catch("Error in DomService getXPath:",c)}}namespaceResolver(r){return r==="svg"?"http://www.w3.org/2000/svg":null}calculateXPath(r,i,o,s,a){try{if(r){if(typeof r=="string")return document.evaluate(r,s||document,this.namespaceResolver,XPathResult.ANY_TYPE,null);if(!r||r.nodeType!=1)return"";if(r.id&&document.querySelectorAll(`[id='${r.id}']`)?.length===1&&!i&&!(a?.ignoreGeneratedIds&&this.isGeneratedId(r.id)))return"//*[@id='"+r.id+"']";if(o&&r.className&&r.className.split){let l=r.className?.split(" ")?.filter(d=>!d?.includes("snippyly")&&!d?.includes("velt")&&!["show-pin-cursor"].includes(d))[0];if(l){let d=this.calculateXPath(r.parentNode,i,o,s,a)+"/"+r.tagName.toLowerCase(),h=Array.from(r.parentNode?.children||[]).filter(f=>f.nodeType===1&&f.tagName===r.tagName?f.className?.split(" ")?.filter(E=>E?.includes("snippyly")||E?.includes("velt")||["show-pin-cursor"].includes(E))[0]===l:!1);if(h.length>1){let f=h.indexOf(r)+1;d+=`[contains(concat(' ', normalize-space(@class), ' '), ' ${l} ')][${f}]`}else d+=`[contains(concat(' ', normalize-space(@class), ' '), ' ${l} ')]`;return d}}let c=[].filter.call(r.parentNode?.children?r.parentNode?.children:[],function(l){return l.tagName==r.tagName});return this.calculateXPath(r.parentNode,i,o,void 0,a)+"/"+r.tagName.toLowerCase()+(c.length>1?"["+([].indexOf.call(c,r)+1)+"]":"")}}catch(c){this.loggingService.catch("Error in DomService calculateXPath:",c)}}getElementFromXPath(r,i=document){try{if(this.xpathCache.has(r)){let s=this.xpathCache.get(r);if(s!==void 0&&document.contains(s))return s;this.xpathCache.delete(r)}let o=this.getXPath(r,!1,!1,i);if(o){let s=o?.iterateNext();if(s!==null&&typeof s.setAttribute=="function"&&!Gs(s)){let a=$c();s.setAttribute(k.ATTRIBUTES.VELT_ELEMENT_CACHE_ID,a),this.xpathCacheId.set(a,r)}return this.xpathCache.set(r,s),s}return null}catch(o){return this.loggingService.catch("Error in DomService getElementFromXPath:",o),null}}getElementFromXPathAccepted(r,i){let o=this.getElementFromXPath(r);if(!i||!o||Wp(i,o,this.loggingService))return o;try{let s=this.getXPath(r,!1,!1,document)?.iterateNext();if(s&&s!==o&&Wp(i,s,this.loggingService)){if(typeof s.setAttribute=="function"&&!Gs(s)){let a=$c();s.setAttribute(k.ATTRIBUTES.VELT_ELEMENT_CACHE_ID,a),this.xpathCacheId.set(a,r)}return this.xpathCache.set(r,s),s}}catch(s){this.loggingService.catch("Error in DomService getElementFromXPathAccepted:",s)}return o}getElementFromTargetElement(r){try{let i=null;if(r?.anchor){let o=this.resolveAnchorRecord(r.anchor);o?.element&&(i=o.element)}else r?.xpath?i=this.getElementFromXPath(r.xpath):r?.cfXpath?i=this.getElementFromXPath(r.cfXpath):r?.fXpath&&(i=this.getElementFromXPath(r.fXpath));return i}catch(i){return this.loggingService.catch("Error in DomService getElementFromTargetElement:",i),null}}resolveIdScopedTarget(r){try{let i=r?.anchor?.xPath||r?.xpath,o=pb(i);if(!i||!o||this.isGeneratedId(o.rootId))return{applicable:!1,element:null};let s=this.getUniqueElementById(o.rootId);if(!s||!this.isElementVisible(s)||!ld(s))return{applicable:!0,element:null};let a=d=>!!d&&s.contains(d)&&this.isElementVisible(d),c=this.getElementFromXPath(i);if(a(c))return{applicable:!0,element:c,matchedBy:"exact"};let l=r?.anchor?.robustXPath;if(l&&pb(l)?.rootId===o.rootId){let d=this.getElementFromRobustXPath(l);if(a(d))return{applicable:!0,element:d,matchedBy:"robust"}}return{applicable:!0,element:s,matchedBy:"root"}}catch(i){return this.loggingService.catch("Error in DomService resolveIdScopedTarget: ",i),{applicable:!1,element:null}}}getUniqueElementById(r){try{let i=document.querySelectorAll(`[id="${CSS.escape(r)}"]`);return i.length===1?i[0]:null}catch{return null}}getElementFromTargetTextRange(r){try{let i=null;if(r?.commonAncestorContainerAnchor){let o=this.resolveAnchorRecord(r.commonAncestorContainerAnchor);o?.element&&(i=o.element)}else r?.commonAncestorContainer&&(i=this.getElementFromXPath(r.commonAncestorContainer));return i}catch(i){return this.loggingService.catch("Error in DomService getElementFromTargetTextRange:",i),null}}calculateScreenSize(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowResize","color: green;");try{let r=[document?.body?.clientHeight||0,document?.documentElement?.clientHeight||0,window?.innerHeight||0],i=[document?.body?.clientWidth||0,document?.documentElement?.clientWidth||0,window?.innerWidth||0];this.calculatePageScrollHeight(),this.loggingService.log(this.pageScrollHeight);let o=new up;return o.screenWidth=Math.max(...i),o.screenHeight=Math.max(...r),o.screenScrollHeight=this.pageScrollHeight,o}catch(r){return this.loggingService.catch("Error in DomService calculateScreenSize:",r),new up}}calculatePageScrollHeight(){this.loggingService.log("%c[WB] Calling FUNCTION: calculatePageScrollHeight","color: green;");try{this.pageScrollHeight=0,this.highestNode=void 0;let r=this.findLongestNode(document?.documentElement?.childNodes);this.highestNode=r?new WeakRef(r):void 0}catch(r){this.loggingService.catch("Error in DomService calculatePageScrollHeight: ",r)}}removeSnippylyContent(r){this.loggingService.log("%c[WB] Calling FUNCTION: removeSnippylyContent","color: green;");try{let o=new DOMParser().parseFromString(r,"text/html");o.querySelectorAll("[data-snippyly-cache-id]").forEach(f=>{f.removeAttribute("data-snippyly-cache-id")}),o.querySelectorAll("[data-velt-cache-id]").forEach(f=>{f.removeAttribute("data-velt-cache-id")}),o.querySelectorAll(".comment-text-highlight").forEach(f=>{f?.parentNode?.insertBefore(document.createTextNode(f?.textContent),f),f.remove()});let l=document.createNodeIterator(o,NodeFilter.SHOW_COMMENT),d;for(;d=l.nextNode();)d?.remove();return this.mergeAdjacentTextNodes(o.body),this.sanitizeHtml(o.body.innerHTML)}catch(i){return this.loggingService.catch("Error in DomService removeSnippylyContent: ",i),r}}mergeAdjacentTextNodes(r){try{let i=r.firstChild;for(;i;){if(i.nodeType===Node.TEXT_NODE){let o=i.nextSibling;for(;o&&o.nodeType===Node.TEXT_NODE;)i.textContent+=o.textContent,o.remove(),o=i.nextSibling}i=i.nextSibling}}catch(i){this.loggingService.catch("Error in DomService mergeAdjacentTextNodes: ",i)}}findLongestNode(r){let i;try{for(let o=r.length-1;o>=0;o--){if(r[o]?.scrollHeight&&r[o]?.clientHeight){let s=Math.max(r[o]?.scrollHeight,r[o]?.clientHeight);s>=this.pageScrollHeight&&(this.pageScrollHeight=s,i=r[o])}r[o]?.childNodes?.length&&(i=this.findLongestNode(r[o]?.childNodes)??i)}}catch(o){this.loggingService.catch("Error in DomService findLongestNode: ",o)}return i}resetSelectedAnnotationsMap(r=!0,i){try{let s=this.getDraftAnnotationRefs().map(d=>d.classList.contains("velt-annotation-draft-checked")?(d.classList.remove("velt-annotation-draft-checked"),null):(this.removeClassFromElement(d,"velt-comment-dialog-shake"),setTimeout(()=>{this.addClassToElement(d,"velt-comment-dialog-shake"),d.getAttribute(k.ATTRIBUTES.VELT_ANNOTATION_EDIT_COMMENT)||d.classList.contains("velt-annotation-draft-checked")||this.addClassToElement(d,"velt-annotation-draft-checked")},100),d.getAttribute(k.ATTRIBUTES.VELT_ANNOTATION_DRAFT))).filter(d=>d),a=Object.keys(this.getRecordingInProgress()||{});s=[...s,...a];let c=this.selectedAnnotationsMap$.value;if(r&&this.selectedAnnotationsMap$.value&&Object.keys(this.selectedAnnotationsMap$.value).length){let d=[];Object.keys(c).forEach(h=>{if(c[h]?.type==="tag"){let f=c[h];f?.to?.length||s.includes(h)||d.push(f)}else c[h]?.comments?.length||s.includes(h)||d.push(c[h])}),this.deleteAnnotations$.next(d),this.deleteAnnotations$.next([])}let l={};Object.keys(c).forEach(d=>{s.includes(d)&&(l[d]=c[d]),i&&(i==="comment"?["comment","videoPin"].includes(c[d]?.type)||(l[d]=c[d]):c[d]?.type!==i&&(l[d]=c[d]))}),Object.keys(l).forEach(d=>{let h=l[d]?.multiThreadAnnotationId;h&&!l[h]&&(l[h]={annotationId:h,type:"multiThread"})}),JSON.stringify(this.selectedAnnotationsMap$.value)!==JSON.stringify(l)&&this.selectedAnnotationsMap$.next(l),this.setDialogOpenedInSidebar(!1)}catch(o){this.loggingService.catch("Error in DomService resetSelectedAnnotationsMap: ",o)}}getDraftAnnotationRefs(){let r=Array.from(document.querySelectorAll(`[${k.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`));return r.push(...this.getDraftCommentAnnotationDialogs()||[]),Array.from(new Set(r))}isEmptyDraftAnnotation(r){try{let i=this.selectedAnnotationsMap$.value?.[r];if(!i||i.type==="tag"||i.type==="multiThread"||i.comments?.length||Object.prototype.hasOwnProperty.call(this.getRecordingInProgress()||{},r))return!1;let o=this.readAnnotationDraftContent(r);return o!==void 0?!o:!this.getDraftAnnotationRefs().some(s=>s.getAttribute(k.ATTRIBUTES.VELT_ANNOTATION_DRAFT)===r)}catch(i){return this.loggingService.catch("Error in DomService isEmptyDraftAnnotation: ",i),!1}}registerAnnotationDraftContentReader(r){this.annotationDraftContentReader=r}readAnnotationDraftContent(r){try{return this.annotationDraftContentReader?.(r)}catch(i){this.loggingService.catch("Error in DomService readAnnotationDraftContent: ",i);return}}discardEmptyDraftAnnotation(r){try{let i=this.selectedAnnotationsMap$.value||{};if(!r||!this.isEmptyDraftAnnotation(r))return!1;this.deleteAnnotations$.next([i[r]]),this.deleteAnnotations$.next([]);let o=V({},i);return delete o[r],this.selectedAnnotationsMap$.next(o),!0}catch(i){return this.loggingService.catch("Error in DomService discardEmptyDraftAnnotation: ",i),!1}}setRecordingInProgress(r,i){try{if(i)this.recordingInProgress$.next(le(V({},this.recordingInProgress$.value),{[r]:i}));else{let o=this.recordingInProgress$.value;delete o[r],this.recordingInProgress$.next(o)}}catch(o){this.loggingService.catch("Error in DomService setRecordingInProgress: ",o)}}resetRecordingInProgress(){try{this.recordingInProgress$.next({})}catch(r){this.loggingService.catch("Error in DomService resetRecordingInProgress: ",r)}}getRecordingInProgress(){try{return this.recordingInProgress$.value}catch(r){return this.loggingService.catch("Error in DomService getRecordingInProgress: ",r),{}}}getDraftCommentAnnotationDialogs(){try{let r=[],i=Array.from(document.querySelectorAll(`${k.TAGS.SNIPPYLY_COMMENT_DIALOG}`)),o=Array.from(document.querySelectorAll(`${k.TAGS.VELT_COMMENT_DIALOG}`));return[...i,...o].forEach(a=>{if(a?.shadowRoot){let c=a.shadowRoot.querySelector(`[${k.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);c&&r.push(c)}else{let c=a.querySelector(`${k.TAGS.VELT_SHADOW_DOM_INTERNAL}`);if(c?.shadowRoot){let l=c.shadowRoot?.querySelector(`[${k.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);l&&r.push(l)}else{let l=a.querySelector(`[${k.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);l&&r.push(l)}}}),r}catch(r){return this.loggingService.catch("Error in DomService getDraftCommentAnnotationDialogs: ",r),[]}}getSelectedAnnotationsMap(r){try{let i=this.selectedAnnotationsMap$.value;if(r){let o={};return Object.keys(i).forEach(s=>{r==="comment"?["comment","videoPin"].includes(i[s].type)&&(o[s]=i[s]):i[s].type===r&&(o[s]=i[s])}),o}else return i}catch(i){return this.loggingService.catch("Error in DomService getSelectedAnnotationsMap: ",i),{}}}getSelectedAnnotationsMap$(r){return this.selectedAnnotationsMap$.asObservable().pipe(De(i=>{if(r){let o={};return Object.keys(i).forEach(s=>{i[s].type===r&&(o[s]=i[s])}),o}else return i}))}getSelectedComments$(){return this.selectedAnnotationsMap$.asObservable().pipe(De(r=>Object.values(r)))}getSelectedAnnotationsLocationMap(){try{return this.selectedAnnotationsLocationMap$.value}catch(r){return this.loggingService.catch("Error in DomService getSelectedAnnotationsLocationMap: ",r),{}}}getSelectedAnnotationsLocationMap$(){return this.selectedAnnotationsLocationMap$.asObservable()}getSelectedAnnotationsContextIdMap(){try{return this.selectedAnnotationsContextIdMap$.value}catch(r){return this.loggingService.catch("Error in DomService getSelectedAnnotationsContextIdMap: ",r),{}}}getSelectedAnnotationsContextIdMap$(){return this.selectedAnnotationsContextIdMap$.asObservable()}toggleAnnotationSelection(r,i,o,s=!1,a,c){try{o==="sidebarShowReplies"?this.setDialogOpenedInSidebar(!0):this.setDialogOpenedInSidebar(!1);let l=JSON.parse(JSON.stringify(this.selectedAnnotationsMap$.value||{})),d=JSON.parse(JSON.stringify(this.selectedAnnotationsLocationMap$.value||{})),h=JSON.parse(JSON.stringify(this.selectedAnnotationsContextIdMap$.value||{}));l[r.annotationId]&&!s?delete l[r.annotationId]:((!this.isShiftKeyPressed||s)&&(l={}),l[r.annotationId]=r,d[r.annotationId]=i,c&&(h[r.annotationId]=c),a=r?.multiThreadAnnotationId||a,a&&(l[a]={annotationId:a,type:"multiThread"},d[a]=i,c&&(h[a]=c))),this.selectedAnnotationsMap$.next(l),Object.keys(d).forEach(f=>{l[f]||delete d[f]}),this.selectedAnnotationsLocationMap$.next(d),Object.keys(h).forEach(f=>{l[f]||delete h[f]}),this.selectedAnnotationsContextIdMap$.next(h)}catch(l){this.loggingService.catch("Error in DomService toggleAnnotationSelection: ",l)}}setSelectedAnnotationLocation(r,i){try{let o=JSON.parse(JSON.stringify(this.getSelectedAnnotationsLocationMap()||{}));o?.[r]!==i&&(o[r]=i,this.selectedAnnotationsLocationMap$.next(o))}catch(o){this.loggingService.catch("Error in DomService setSelectedAnnotationLocation: ",o)}}updateSelectedAnnotationInMap(r){try{let i=this.selectedAnnotationsMap$.value;r.forEach(o=>{i[o.annotationId]&&(i[o.annotationId]=o)}),this.selectedAnnotationsMap$.next(i)}catch(i){this.loggingService.catch("Error in DomService updateSelectedAnnotationInMap: ",i)}}getDeleteCommmentAnnotations$(){try{return this.deleteAnnotations$.asObservable()}catch(r){return this.loggingService.catch("Error in DomService getDeleteCommmentAnnotations$: ",r),st([])}}getHighestNode(){return this.loggingService.log("%c[WB] Calling FUNCTION: getHighestNode","color: green;"),this.highestNode?.deref()}onWindowMouseDown$(){return this.windowMouseDown$.asObservable()}onWindowPointerMove$(){return this.windowPointerMove$.asObservable()}onWindowPointerMove(){return this.windowPointerMove$.value}onWindowPointerUp$(){return this.windowPointerUp$.pipe(rn(null))}onSelectionChange$(){return this.documentSelectionChange$.pipe(rn(null))}onWindowClick$(){return this.windowClick$.pipe(rn(null))}onWindowScroll$(){return this.windowScroll$.asObservable()}onWindowResize$(){return this.windowResize$.asObservable()}onWindowKeyupBackspace$(){return this.windowKeyupBackspace$.pipe(rn(null))}onWindowKeyupDelete$(){return this.windowKeyupDelete$.pipe(rn(null))}onWindowKeyupEsc$(){return this.windowKeyupEsc$.pipe(rn(null))}onWindowPopState$(){return this.windowPopState$.asObservable()}onDocumentClick$(){return this.documentClick$.pipe(rn(null))}getLastDocumentClickTarget(){return this.lastDocumentClickTarget?.deref()??null}onDocumentClickSubject$(){return this.documentClickSubject$.asObservable()}onDocumentFocus$(){return this.documentFocus$.pipe(rn(null))}onDomChange$(r){try{return this.mutationObserver||this.setMutationObserver(r),this.mutation$.pipe(rn(null))}catch(i){return this.loggingService.catch("Error in DomService onDomChange$: ",i),st([])}}getChildListMutation$(){return this.childListMutation$.pipe(rn(null))}onNetworkStatusChange$(){return this.networkStatus$.asObservable()}getNetworkStatus(){return this.networkStatus$.value}getElementOffset(r,i){try{let o={offsetTop:0,offsetLeft:0},s=r;if(s===i){let a=window.getComputedStyle(r);a.position==="static"&&a.transformStyle!="preserve-3d"&&a.transform=="none"&&(o.offsetLeft=r?.offsetLeft||0,o.offsetTop=r?.offsetTop||0)}if(s!==i)if(r?.closest("svg"))for(;s&&s!==i;){let c=window.getComputedStyle(s);if(s.tagName.toLowerCase()==="svg"||s instanceof SVGElement){let l=s.parentElement;if(l){let d=l.getBoundingClientRect(),h=s.getBoundingClientRect();o.offsetLeft+=h.left-d.left,o.offsetTop+=h.top-d.top}}else c.position==="static"?c.transformStyle!="preserve-3d"&&c.transform=="none"&&(o.offsetLeft+=s?.offsetLeft||0,o.offsetTop+=s?.offsetTop||0):(o.offsetLeft+=s.offsetLeft,o.offsetTop+=s.offsetTop);if(s=s.parentElement,r instanceof SVGElement&&s===i){let l=window.getComputedStyle(s);l.position==="static"&&l.transformStyle!="preserve-3d"&&l.transform=="none"&&(o.offsetLeft+=s?.offsetLeft||0,o.offsetTop+=s?.offsetTop||0)}}else{let c=window.getComputedStyle(s);c.position==="static"?c.transformStyle!="preserve-3d"&&c.transform=="none"&&(o.offsetLeft+=s?.offsetLeft||0,o.offsetTop+=s?.offsetTop||0):(o.offsetLeft+=s.offsetLeft,o.offsetTop+=s.offsetTop)}return o}catch(o){return this.loggingService.catch("Error in DomService getElementOffset: ",o),{offsetTop:0,offsetLeft:0}}}isElementVisible(r){try{if(typeof r?.getBoundingClientRect=="function"){let{width:i,height:o,top:s,bottom:a}=r?.getBoundingClientRect();return i>0||o>0||s<window.innerHeight&&a>0}else return!1}catch(i){return this.loggingService.catch("Error in DomService isElementVisible: ",i),!1}}isElementVisibleOnScreen(r){try{if(r){if(!(r instanceof Element))return!1;let i=r,o=window.getComputedStyle(i);return!(o.display==="none"||o.visibility==="hidden"||parseFloat(o.opacity)===0)}return!1}catch(i){return this.loggingService.catch("Error in DomService isElementVisibleOnScreen: ",i),!1}}getClickAndDragPointsObservable(){return new he(r=>{let i=$i(document,"mousedown").pipe(De(l=>({type:l.type,x:l.clientX+window.scrollX,y:l.clientY+window.scrollY,event:l}))),o=$i(document,"mousemove").pipe(De(l=>({type:l.type,x:l.clientX+window.scrollX,y:l.clientY+window.scrollY,event:l}))),s=$i(document,"mouseup").pipe(De(l=>({type:l.type,x:l.clientX+window.scrollX,y:l.clientY+window.scrollY,event:l}))),c=i.pipe(Zn(l=>o.pipe(ac(),De(([d,h])=>({startPoint:l,prevPoint:d,curPoint:h})),Is(s)))).subscribe(r);return()=>c.unsubscribe()})}drawRectangle(r,i){let o=document.querySelector(".rectangle");o||(o=document.createElement("div"),this.addClassToElement(o,"rectangle"),o.setAttribute(k.ATTRIBUTES.VELT_COMMENT_DISABLED,"true"),o.setAttribute(k.VELT_IGNORE_CHANGE_DETECTION,"true"),document.body.appendChild(o));let s=Math.abs(i.x-r.x),a=Math.abs(i.y-r.y),c=Math.min(r.x,i.x),l=Math.min(r.y,i.y);return o.style.width=`${s}px`,o.style.height=`${a}px`,o.style.left=`${c}px`,o.style.top=`${l}px`,o.style.position="absolute",o.style.border="2px dashed #f00",o.style.pointerEvents="none",o.style.zIndex="2147483577",o}getRange(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: getRange","color: green;"),window.getSelection()?.toString()){let r=window.getSelection();if(r?.rangeCount)return r.getRangeAt(0)}return null}catch(r){return this.loggingService.catch("Error in DomService getRange: ",r),null}}clearTextSelection(){try{this.loggingService.log("%c[WB] Calling FUNCTION: clearTextSelection","color: green;"),window.getSelection&&(window.getSelection()?.empty?window.getSelection()?.empty():window.getSelection()?.removeAllRanges&&window.getSelection()?.removeAllRanges())}catch(r){this.loggingService.catch("Error in DomService clearTextSelection: ",r)}}getTargetTextRangeFromSelectionRange(r){try{let i={},o=r.commonAncestorContainer;o?.nodeType===Node.TEXT_NODE&&(o=o.parentElement);let s=document.body;if(o){let c=this.getTextXPath(o);this.isXpathWithId(c)&&(s=o)}let a=this.getAdditionalLocationContainer(o);if(a&&(s=a),i.commonAncestorContainer=this.getTextXPath(s),i.commonAncestorContainer){let c=this.getElementFromXPath(i.commonAncestorContainer);if(c){i.commonAncestorContainerFXpath=this.getXPath(c,!0),i.commonAncestorContainerCFXpath=this.getXPath(c,!0,!0);let l=this.generateAnchorRecord(c);l&&(i.commonAncestorContainerAnchor=l)}}return i.text=r.toString(),i.occurrence=kR(s,0,r.startContainer,r.startOffset,r.toString())+1,i}catch(i){this.loggingService.catch("Error in DomService getTargetTextRangeFromSelectionRange: ",i);return}}getTextXPath(r){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: getTextXPath","color: green;"),r.nodeType===Node.TEXT_NODE){let i=1,o=r.previousSibling;for(;o;)o.nodeType===Node.TEXT_NODE&&i++,o=o.previousSibling;return this.getXPath(r.parentElement)}else return this.getXPath(r)}catch(i){this.loggingService.catch("Error in DomService getTextXPath: ",i);return}}getHostElement(r){try{if(k.NON_NESTABLE_ELEMENTS[r?.tagName?.toLowerCase()]){let o=r?.closest("picture");return o?o?.parentElement:r.parentElement}let i=r.closest("svg");return i?i?.parentElement:r}catch(i){return this.loggingService.catch("Error in DomService getHostElement: ",i),r}}isElementInsideAdditionalLocationContainer(r){try{return!!r?.closest(`[${k.ATTRIBUTES.VELT_LOCATION}], [${k.ATTRIBUTES.VELT_LOCATION_ID}]`)}catch(i){return this.loggingService.catch("Error in DomService isElementInsideAdditionalLocationContainer: ",i),!1}}getAdditionalLocationContainer(r){try{return r?.closest(`[${k.ATTRIBUTES.VELT_LOCATION}], [${k.ATTRIBUTES.VELT_LOCATION_ID}]`)||null}catch(i){return this.loggingService.catch("Error in DomService getAdditionalLocationContainer: ",i),null}}isXpathWithId(r){try{return typeof r=="string"?!!r?.includes("[@id="):!1}catch(i){return this.loggingService.catch("Error in DomService isXpathWithId: ",i),!1}}getListedElements({elementIds:r,elementClassNames:i,elementQuerySelectors:o}){try{let s=[];if(r?.length)for(let a=0;a<r.length;a++){let c=document.getElementById(r[a]);c&&s.push(c)}if(i?.length)for(let a=0;a<i.length;a++){let c=document.getElementsByClassName(i[a]);for(let l=0;l<c.length;l++){let d=c[l];d&&d instanceof HTMLElement&&s.push(d)}}if(o?.length)for(let a=0;a<o.length;a++){let c=document.querySelectorAll(o[a]);for(let l=0;l<c.length;l++){let d=c[l];d&&d instanceof HTMLElement&&s.push(d)}}return s}catch(s){return this.loggingService.catch("Error in DomService getListedElements: ",s),[]}}isElementInsideListedElementIds(r,i){try{if(i?.length){for(let o=0;o<i.length;o++){let s=document.getElementById(i[o]);if(s&&s.contains(r))return!0}return!1}return!0}catch(o){return this.loggingService.catch("Error in DomService isElementInsideListedElementIds: ",o),!1}}isElementInsideListedElementClassNames(r,i){try{if(i?.length){for(let o=0;o<i.length;o++){let s=document.getElementsByClassName(i[o]);for(let a=0;a<s.length;a++)if(s[a].contains(r))return!0}return!1}return!0}catch(o){return this.loggingService.catch("Error in DomService isElementInsideListedElementClassNames: ",o),!1}}isElementInsideListedElementQuerySelectors(r,i){try{if(i?.length){for(let o=0;o<i.length;o++){let s=document.querySelectorAll(i[o]);for(let a=0;a<s.length;a++)if(s[a].contains(r))return!0}return!1}return!0}catch(o){return this.loggingService.catch("Error in DomService isElementInsideListedElementQuerySelectors: ",o),!1}}addClassToElement(r,i){try{this.loggingService.log("%c[WB] Calling FUNCTION: addClassToElement","color: green;"),r&&(r.classList?.contains(i)||r.classList?.add(i))}catch(o){this.loggingService.catch("Error in DomService addClassToElement: ",o)}}removeClassFromElement(r,i){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeClassFromElement","color: green;"),r&&r.classList?.contains(i)&&r.classList?.remove(i)}catch(o){this.loggingService.catch("Error in DomService removeClassFromElement: ",o)}}isElementInsideParentWithAttribute(r,i,o){try{let s=r;for(;s&&s!==document.body;){if(s?.getAttribute&&s?.getAttribute(i)===o)return!0;s=s.parentElement}return!1}catch(s){return this.loggingService.catch("Error in DomService isElementInsideParentWithAttribute: ",s),!1}}setVideoEditorHandlingDelete(r){try{this.isVideoEditorHandlingDelete=r}catch(i){this.loggingService.catch("Error in DomService setVideoEditorHandlingDelete: ",i)}}isVideoEditorHandlingDeleteKey(){try{return this.isVideoEditorHandlingDelete}catch(r){return this.loggingService.catch("Error in DomService isVideoEditorHandlingDeleteKey: ",r),!1}}setCustomCss(r){try{this.loggingService.log("%c[WB] Calling FUNCTION: setCustomCss","color: green;"),this.customCss$.next(r)}catch(i){this.loggingService.catch("Error in DomService setCustomCss: ",i)}}getCustomCss$(){try{return this.loggingService.log("%c[WB] Calling FUNCTION: getCustomCss$","color: green;"),this.customCss$.asObservable()}catch(r){return this.loggingService.catch("Error in DomService getCustomCss$: ",r),st(null)}}injectCustomCss(r){try{this.loggingService.log("%c[WB] Calling FUNCTION: injectCustomCss","color: green;");let i=this.customCss$.value;if(i){let o=r?.shadowRoot?.querySelector(`[${k.VELT_CUSTOM_CSS}]`);if(o&&o.remove(),i?.type==="link"){let s=document.createElement("link");s.href=i?.value,s.rel="stylesheet",s.setAttribute(k.VELT_CUSTOM_CSS,"true"),r?.shadowRoot?.appendChild(s)}else{let s=document.createElement("style");s.innerHTML=this.sanitizeHtml(i?.value),s.setAttribute(k.VELT_CUSTOM_CSS,"true"),r?.shadowRoot?.appendChild(s)}}}catch(i){this.loggingService.catch("Error in DomService injectCustomCss: ",i)}}subscribeInjectCustomCss(r){try{return this.customCss$.subscribe(()=>{this.injectCustomCss(r?.nativeElement)})}catch(i){return this.loggingService.catch("Error in DomService subscribeInjectCustomCss: ",i),new mt}}trimCommentHtml(r){try{let i=document.createElement("div");i.innerHTML=r,this.removeEmptyElements(i);let o=i.innerHTML;return o=o.replace(e.MULTIPLE_NBSP_REGEX," ").replace(e.TRIM_NBSP_REGEX,"").trim(),o}catch(i){return this.loggingService.catch("Error in DomService trimCommentHtml: ",i),r}}removeEmptyElements(r){try{let s=function(a){return o.test(a.innerHTML)};var i=s;let o=/^\s*(<br\s*\/?>)?\s*$/;for(;r.firstChild&&s(r.firstChild);)r.removeChild(r.firstChild);for(;r.lastChild&&s(r.lastChild);)r.removeChild(r.lastChild)}catch(o){this.loggingService.catch("Error in DomService removeEmptyElements: ",o)}}normalizeWhitespace(r){try{r.childNodes.forEach(i=>{i.nodeType===Node.TEXT_NODE?i.nodeValue=i.nodeValue?.replace(/\s+/g," ").trim()??"":i.nodeType===Node.ELEMENT_NODE&&this.normalizeWhitespace(i)})}catch(i){this.loggingService.catch("Error in DomService normalizeWhitespace: ",i)}}sanitizeHtml(r){try{return this.loggingService.log("%c[WB] Calling FUNCTION: sanitizeHtml","color: green;"),Ly.sanitize(r,lj)}catch(i){return this.loggingService.catch("Error in DomService sanitizeHtml: ",i),""}}sanitizeHtmlForPaste(r){try{let i=this.convertStylesToTags(r);return Ly.sanitize(i,{ALLOWED_TAGS:["b","strong","i","em","u","a","br"],ALLOWED_ATTR:["href","target","rel"]})}catch(i){return this.loggingService.catch("Error in DomService sanitizeHtmlForPaste: ",i),""}}convertStylesToTags(r){try{let i=document.createElement("div");return i.innerHTML=r,this.convertBlockElementsToBr(i),this.processNodeStyles(i),i.innerHTML}catch(i){return this.loggingService.catch("Error in DomService convertStylesToTags: ",i),r}}convertBlockElementsToBr(r){try{let i=["P","DIV","H1","H2","H3","H4","H5","H6","LI","BLOCKQUOTE","PRE","SECTION","ARTICLE","HEADER","FOOTER"],o;for(;(o=r.querySelector(i.join(",")))!==null;){let s=o.parentNode;if(!s)break;for(;o.firstChild;)s.insertBefore(o.firstChild,o);o.nextSibling&&s.insertBefore(document.createElement("br"),o),s.removeChild(o)}}catch(i){this.loggingService.catch("Error in DomService convertBlockElementsToBr: ",i)}}processNodeStyles(r){try{let i=Array.from(r.childNodes);for(let o of i)if(o.nodeType===Node.ELEMENT_NODE){this.processNodeStyles(o);let s=o,a=s.style,c=o,l=a?.fontWeight;if(l==="bold"||l==="700"||l==="800"||l==="900"){let d=s.tagName?.toLowerCase();if(d!=="b"&&d!=="strong"){let h=document.createElement("b");c.parentNode.insertBefore(h,c),h.appendChild(c),c=h}}if(a?.fontStyle==="italic"){let d=s.tagName?.toLowerCase();if(d!=="i"&&d!=="em"){let h=document.createElement("i");c.parentNode.insertBefore(h,c),h.appendChild(c),c=h}}if((a?.textDecorationLine?.includes("underline")||a?.textDecoration?.includes("underline"))&&s.tagName?.toLowerCase()!=="u"){let h=document.createElement("u");c.parentNode.insertBefore(h,c),h.appendChild(c),c=h}}}catch(i){this.loggingService.catch("Error in DomService processNodeStyles: ",i)}}sanitizeSvg(r){try{return Ly.sanitize(r,lj)}catch(i){return this.loggingService.catch("Error in DomService sanitizeSvg: ",i),r}}setDeviceInfo(){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDeviceInfo","color: green;");let r=new Wr;this.deviceInfo$.next(r)}catch(r){this.loggingService.catch("Error in DomService setDeviceInfo: ",r)}}getDeviceInfo$(){try{return this.loggingService.log("%c[WB] Calling FUNCTION: getDeviceInfo$","color: green;"),this.deviceInfo$.asObservable()}catch(r){return this.loggingService.catch("Error in DomService getDeviceInfo$: ",r),st(new Wr)}}getTabId(){try{let r=sessionStorage.getItem(k.SESSION_STORAGE.VELT_TAB_ID);!r&&this.tabId&&(r=this.tabId,sessionStorage.setItem(k.SESSION_STORAGE.VELT_TAB_ID,r)),!this.tabId&&r&&(this.tabId=r);let i=this.getTabIdFromWindowName();return(!r||r!==i)&&(r=$c(),this.tabId=r,sessionStorage.setItem(k.SESSION_STORAGE.VELT_TAB_ID,r),this.setTabIdToWindowName(r)),r}catch(r){return this.loggingService.catch("Error in DomService getTabId: ",r),null}}getTabIdFromWindowName(){try{return window.name}catch(r){return this.loggingService.catch("Error in DomService getTabIdFromWindowName: ",r),null}}setTabIdToWindowName(r){try{window.name=r}catch(i){this.loggingService.catch("Error in DomService setTabIdToWindowName: ",i)}}getDeviceInfo(){try{return this.loggingService.log("%c[WB] Calling FUNCTION: getDeviceInfo","color: green;"),this.deviceInfo$.value}catch(r){return this.loggingService.catch("Error in DomService getDeviceInfo: ",r),new Wr}}isMobileDevice(){try{return new Wr().getDeviceType()===Ir.MOBILE}catch(r){return this.loggingService.catch("Error in DomService isMobileDevice: ",r),!1}}isTabletDevice(){try{return new Wr().getDeviceType()===Ir.TABLET}catch(r){return this.loggingService.catch("Error in DomService isTabletDevice: ",r),!1}}isDesktopDevice(){try{return new Wr().getDeviceType()===Ir.DESKTOP}catch(r){return this.loggingService.catch("Error in DomService isDesktopDevice: ",r),!1}}deepCloneElement(r){try{var i=document.createElement(r?.tagName);return Array.from(r.attributes).forEach(o=>{i.setAttribute(o.nodeName,o.nodeValue)}),r.childNodes.forEach(o=>{o.nodeType===Node.ELEMENT_NODE?i.appendChild(this.deepCloneElement(o)):o.nodeType===Node.TEXT_NODE&&i.appendChild(document.createTextNode(o.nodeValue))}),i}catch(o){return this.loggingService.catch("Error in DomService deepCloneElement: ",o),r}}setRandomNumberToElementRecursive(r){try{if(!r)return;let i=Math.random().toString(36).substring(7);r&&r.setAttribute&&typeof r.setAttribute=="function"&&(r.getAttribute("velt-wireframe-id")||r.setAttribute("velt-wireframe-id",i)),Array.from(r.children).forEach(s=>{this.setRandomNumberToElementRecursive(s)})}catch(i){this.loggingService.catch("Error in DomService setRandomNumberToElementRecursive: ",i)}}setDialogOpenedInSidebar(r){this.dialogOpenedInSidebar$.next(r)}getDialogOpenedInSidebar(){return this.dialogOpenedInSidebar$.asObservable()}removeWireframeSuffixFromTags(r){if(!r)return;Array.from(r.children).forEach(o=>{if(this.removeWireframeSuffixFromTags(o),o.tagName.toLowerCase().endsWith("-wireframe")){let s=o.tagName.toLowerCase().replace("-wireframe",""),a=document.createElement(s);for(Array.from(o.attributes).forEach(c=>{a.setAttribute(c.name,c.value)});o.firstChild;)a.appendChild(o.firstChild);o.parentNode.replaceChild(a,o)}})}isMonitorDevice(){try{return new Wr().getDeviceType()===Ir.MONITOR}catch(r){return this.loggingService.catch("Error in DomService isMonitorDevice: ",r),!1}}isElementOriginallyStatic(r){try{return window.getComputedStyle(r).position==="static"||r.hasAttribute(k.ATTRIBUTES.VELT_COMMENT_PIN_HOST_STATIC)||r.hasAttribute(k.ATTRIBUTES.VELT_AREA_PIN_HOST_STATIC)||r.hasAttribute(k.ATTRIBUTES.VELT_TAG_PIN_HOST_STATIC)||r.hasAttribute(k.ATTRIBUTES.VELT_RECORDER_PIN_HOST_STATIC)||r.hasAttribute(k.ATTRIBUTES.VELT_ARROW_PIN_HOST_STATIC)}catch(i){return this.loggingService.catch("Error in DomService isElementOriginallyStatic: ",i),!1}}};e.ANCHOR_CACHE_LIMIT=2e4,e.MAX_ROBUST_XPATH_CANDIDATES=20,e.MULTIPLE_NBSP_REGEX=/(?: \s*){2,}/g,e.TRIM_NBSP_REGEX=/^(?: \s*)+|(?: \s*)+$/g,e.\u0275fac=function(i){return new(i||e)(q(ea),q(Bo),q(Nt),q(ER))},e.\u0275prov=Z({token:e,factory:e.\u0275fac,providedIn:"root"});let t=e;return t})();function sl(t){let e=t?.refreshToken;return typeof e=="string"&&e.length>0?e:void 0}var gb=Symbol("velt-auth-state-pending");function Wre(t,e){let n=V(V({},t),e||{});return n.userId=t.userId,n.userSnippylyId=t.userSnippylyId,n.type=t.type,n.organizationId=t.organizationId,n.clientOrganizationId=t.clientOrganizationId,n.groupId=t.groupId,n.clientGroupId=t.clientGroupId,n.contacts=t.contacts,n.plan=t.plan,n.isAdmin=t.isAdmin,n.isReadOnly=t.isReadOnly,n.isAnonymous=t.isAnonymous,n.isGuest=t.isGuest,n.color=e?.color||t.color,n.textColor=e?.textColor||t.textColor,n.initial=e?.initial||n.name?.charAt(0).toUpperCase()||n.email?.charAt(0).toUpperCase()||t.initial,n?.photoUrl===void 0&&(n.photoUrl=null),n}var zre=["userId","userSnippylyId","organizationId","clientOrganizationId","isAdmin","isReadOnly","isAnonymous","isGuest","plan","contacts"];function qre(t){if(!t||typeof t!="object")return{};let e=V({},t);for(let n of zre)delete e[n];return e}function hj(t,e){if(!e.length)return!0;if(t.length!==e.length)return!1;let n=new Set(t);return e.every(r=>n.has(r))}var Sd=(()=>{let e=class e{constructor(r,i,o,s,a,c,l,d,h){this.afAuth=r,this.configService=i,this.avatarService=o,this.coreActionsService=s,this.domService=a,this.functions=c,this.analyticsService=l,this.loggingService=d,this.serviceBook=h,this.endpointsService=Q(Ay),this.portableBackend$=new de(null),this.portableAuthUser$=new de(null),this.user$=new de(null),this.userOptions$=new de(null),this.userContacts$=new de(null),this.userOrganization$=new de(null),this.isPrivateCommentsEnabled$=new de(!1),this.providedUser=new so,this.portableRefreshTimer=null,this.portableToken=null,this.portableRefreshInFlightEpoch=null,this.portableRefreshFailures=0,this.portableRefreshFailuresPastExpiry=0,this.portableRefreshWarnedEpoch=null,this.portableApiKeyRefusalWarned=!1,this.portableApiKeyRenewalAskedAt=null,this.portableLicensePause=null,this.portableLicenseRetry=null,this.portableLicenseRetryRunSince=null,this.portableLicenseRetryRun=Promise.resolve(),this.portableLicenseNotices=new Ry(f=>this.coreActionsService.triggerAction(gi.ERROR,f)),this.portableVisibilityHandler=null,this.loggedInUserResolveRetryDelaysMs=[2e3,8e3,3e4],this.loggedInUserResolveRetryInFlightUserId=null,this.firebaseConfig$=new de(null),this.advancedQueries$=new de(null),this.planDetails$=new de(null),this.signOutPreviousUser$=new de(null),this.preSignOutFunctions=new Map,this.autoLoginCalled=!1,this.portableAutoLoginCalled=!1,this.portableAutoLoginInFlight=Promise.resolve(),this.portableSessionEpoch=0,this.portableLocalSessionEnds=0,this.portableSignOutOwnsEpochBump=!1,this.pendingPortableRestore=null,this.portableResumeUserId=null,this.portableStorageHandler=null,this.portableSessionIdentity=null,this.reportedPortableRefreshCodes=new Set,this.autoLoginRequired=!0,this.config=null,this.getPlanDetailsCalled=!1,this.portablePlanSeeded=!1,this.forceReLoggedIn=!1,this.lastLoggedInUserData=null,this.sessionReLoginCount=0,this.SESSION_RE_LOGIN_COUNT_LIMIT=10,this.sessionReLoginSubscription=null,this.onRetrySubscription=null,this.authProviderListenerGeneration=0,this.TOKEN_EXPIRED_ERROR_COUNT_LIMIT=3,this.tokenExpiredErrorCount=0,this.cachedActivityConfig=null,this.portableChunkReady=null,this.viewsService=null,this.crdtService=null,this.portableSavedSessionRaw=null,this.portableRenewalStopped=null,this.portableSessionStartedAt=0,this.portablePersistInFlight=Promise.resolve(),this.loggingService.log("%c[WB] Creating CLASS: AuthService","color: blue;"),this.serviceBook.observe(RT).subscribe(f=>{this.commentService=f??void 0}),this.serviceBook.observe(NT).subscribe(f=>{this.reactionService=f??void 0}),this.serviceBook.observe(bT).subscribe(f=>{this.areaService=f??void 0}),this.serviceBook.observe(WU).subscribe(f=>{this.activityService=f??void 0,f&&this.cachedActivityConfig&&f.setActivityFeatureConfig(this.cachedActivityConfig)}),this.serviceBook.observe(zU).subscribe(f=>{this.viewsService=f??null}),this.serviceBook.observe(qU).subscribe(f=>{this.crdtService=f??null});try{try{let f=this.configService.getAuthProxyHost();if(f){let g=this.afAuth?.config;g&&(g.apiHost=f,g.tokenApiHost=f)}}catch{}this.analyticsService.setAuthService(this),this.configService.getConfig$().subscribe(f=>{this.config=f}),this.forceReLoggedIn=localStorage.getItem(k.LOCAL_STORAGE.VELT_USER_FORCE_RE_LOGGED_IN)==="true",this.sessionReLoginSubscription=_d(this.afAuth).pipe(rn(this.afAuth.currentUser),ac(),Zn(([f,g])=>this.domService.onNetworkStatusChange$().pipe(_n(E=>E),Tn(1),De(()=>({previousUser:f,currentUser:g}))))).subscribe(E=>y(this,[E],function*({previousUser:f,currentUser:g}){if(!g&&f){let I=f?.stsTokenManager?.expirationTime,S=new Date().getTime(),R=I-S;S>I&&(this.analyticsService.trackEvent(St.Events.Core.SDK_SESSION_TOKEN_EXPIRED,{apiKey:this.apiKey,user:this.getUserForTelemetry(this.user$.value??void 0),lastLoggedInUserData:this.lastLoggedInUserData?{user:this.getUserForTelemetry(this.lastLoggedInUserData.user),autoLogin:this.lastLoggedInUserData.autoLogin,hasAuthToken:!!this.lastLoggedInUserData.userOptions?.authToken}:null,timeLeft:R,forceReset:this.userOptions$.value?.forceReset,sessionReLoginCount:this.sessionReLoginCount},!0,this.user$.value?.userSnippylyId),this.user$.value&&f?.uid===this.user$.value?.userSnippylyId&&this.lastLoggedInUserData?.user?.userSnippylyId===this.user$.value?.userSnippylyId&&(this.sessionReLoginCount>this.SESSION_RE_LOGIN_COUNT_LIMIT?(this.analyticsService.trackEvent(St.Events.Core.SDK_SESSION_RE_LOGIN_COUNT_EXCEEDED,{apiKey:this.apiKey,clientUserId:this.lastLoggedInUserData.user.userId,snippylyUserId:this.lastLoggedInUserData.user.userSnippylyId,timeLeft:R,forceReset:this.userOptions$.value?.forceReset,sessionReLoginCount:this.sessionReLoginCount},!0,this.user$.value?.userSnippylyId),this.sessionReLoginSubscription?.unsubscribe()):(this.sessionReLoginCount++,this.analyticsService.trackEvent(St.Events.Core.SDK_SESSION_RE_LOGIN_TRIGGERED,{apiKey:this.apiKey,clientUserId:this.lastLoggedInUserData.user.userId,snippylyUserId:this.lastLoggedInUserData.user.userSnippylyId,user:this.getUserForTelemetry(this.lastLoggedInUserData.user),timeLeft:R,forceReset:this.userOptions$.value?.forceReset,sessionReLoginCount:this.sessionReLoginCount},!0,this.lastLoggedInUserData.user.userSnippylyId),this.lastLoggedInUserData.user=yield this.updateUserWithColorAndTextColor(this.lastLoggedInUserData.user),this.initializeClient(this.lastLoggedInUserData.user,this.lastLoggedInUserData.userOptions,this.lastLoggedInUserData.initializeClientToken,this.lastLoggedInUserData.autoLogin,"internal-sessionReLogin"))))}}),f=>{this.loggingService.catch("Error in AuthService sessionReLoginSubscription: ",f)}),this.getUser$().pipe(ai(gp)).subscribe(f=>{let g=VR(f);this.coreActionsService.triggerAction(gi.USER_UPDATE,g),this.coreActionsService.triggerAction(gi.INIT_UPDATE,{event:gi.USER_UPDATE,payload:{user:g}})})}catch(f){this.loggingService.catch("Error in AuthService constructor: ",f)}}setApiKey(r,i){this.loggingService.log("%c[WB] Calling FUNCTION: setApiKey","color: green;",r);try{if(this.apiKey){this.loggingService.log("API key is already set");return}this.apiKey=r,this.configService.setApiKey(this.apiKey),i||(i=new PT),this.configService.initConfig(i);let o=this.configService.getProxyConfig();if(o?.authHost)try{let s=this.afAuth?.config;s&&(s.apiHost=o.authHost,s.tokenApiHost=o.authHost)}catch(s){this.loggingService.catch("Error setting auth proxy config: ",s)}else try{let s=this.afAuth?.config;s&&s.apiHost!=="identitytoolkit.googleapis.com"&&(s.apiHost="identitytoolkit.googleapis.com",s.tokenApiHost="securetoken.googleapis.com")}catch(s){this.loggingService.catch("Error resetting auth proxy config: ",s)}i.debugMode?sessionStorage.setItem("debugMode","true"):sessionStorage.removeItem("debugMode"),this.autoLoginCalled||_d(this.afAuth).pipe(Tn(1)).subscribe(s=>y(this,null,function*(){if(this.autoLoginCalled=!0,s){let a=yield xp(s,!0).catch(c=>null);if(a){let{user:c}=a?.claims;this.autoLoginRequired&&(c=yield this.updateUserWithColorAndTextColor(c),this.initializeClient(c,this.buildAutoLoginOptions(),new Date().getTime(),!0,"internal-autoLogin"))}}})),!this.portableAutoLoginCalled&&this.configService.getEnablePortableBackend()===!0&&(this.portableAutoLoginCalled=!0,this.portableAutoLoginInFlight=this.autoLoginPortableSession())}catch(o){this.loggingService.catch("Error in setApiKey: ",o)}}setUsersService(r){try{this.loggingService.log("%c[WB] Calling FUNCTION: setUsersService","color: green;"),this.usersService=r}catch(i){this.loggingService.catch("Error in setUsersService: ",i)}}setUserPermissionService(r){try{this.loggingService.log("%c[WB] Calling FUNCTION: setUserPermissionService","color: green;"),this.userPermissionService=r}catch(i){this.loggingService.catch("Error in setUserPermissionService: ",i)}}setDocService(r){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocService","color: green;"),this.docService=r}catch(i){this.loggingService.catch("Error in setDocService: ",i)}}setContactService(r){try{this.loggingService.log("%c[WB] Calling FUNCTION: setContactService","color: green;"),this.contactService=r}catch(i){this.loggingService.catch("Error in setContactService: ",i)}}setIamService(r){try{this.loggingService.log("%c[WB] Calling FUNCTION: setIamService","color: green;"),this.iamService=r}catch(i){this.loggingService.catch("Error in setIamService: ",i)}}setCommentService(r){try{this.loggingService.log("%c[WB] Calling FUNCTION: setCommentService","color: green;"),this.commentService=r}catch(i){this.loggingService.catch("Error in setCommentService: ",i)}}setCommonDbService(r){try{this.loggingService.log("%c[WB] Calling FUNCTION: setCommonDbService","color: green;"),this.commonDbService=r}catch(i){this.loggingService.catch("Error in setCommonDbService: ",i)}}validateOrganizationId(r){if(this.isVersionGreaterThanOrEqualTo4()&&!r?.organizationId)if(this.analyticsService.trackEvent(St.Events.Core.SDK_VALIDATE_CLIENT_FAILED,{apiKey:this.apiKey,clientUserId:r.userId,snippylyUserId:r.userSnippylyId,message:"Organization Id is not set",forceReset:this.userOptions$.value?.forceReset,user:this.getUserForTelemetry(r)},!0,r.userSnippylyId),this.configService.getSF())this.loggingService.catch("OrganizationId is not set in Identify method",void 0,void 0,!0);else throw new Error("OrganizationId is not set in Identify method")}setVeltAuthProvider(r){return y(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: setVeltAuthProvider","color: green;");try{this.onRetrySubscription?.unsubscribe(),this.authProviderListenerGeneration++,this.cancelPortableLicenseRetry();let i=null;if(!r.user)return null;r.generateToken&&typeof r.generateToken=="function"&&(i=yield r.generateToken());let o=yield UR(()=>window.Velt.identify(r.user,V(V({},r.options||{}),i&&{authToken:i}),{fromProvider:!0}).catch(s=>(r.onError&&typeof r.onError=="function"&&r.onError(s),Promise.reject(s))),r.retryConfig||{retryCount:0,retryDelay:0});return o&&r.generateToken&&typeof r.generateToken=="function"&&(this.onRetrySubscription=this.coreActionsService.onAction(gi.ERROR).pipe(_n(s=>s.code==="token_expired"),Tn(10)).subscribe(s=>y(this,null,function*(){if(s.code==="token_expired"){let a=this.authProviderListenerGeneration,c=()=>a===this.authProviderListenerGeneration,l=this.docService?.getDocumentIds()?.map(I=>({id:I.clientDocumentId}))??[],d=this.docService?.getOptionsFromDocumentPaths()??void 0,h=[],f=this.docService?.getLocation();f&&h.push(f.location);let g=this.docService?.getLocations();if(g&&Object.values(g).forEach(I=>{h.push(I.location)}),(yield UR(()=>y(this,null,function*(){try{let I=yield r.generateToken?.();return c()&&I?window.Velt.identify(r.user,V(V({},r.options||{}),I&&{authToken:I}),{fromProvider:!0}):!0}catch{return!1}}),r.retryConfig||{retryCount:0,retryDelay:0}))&&c()){let I=this.docService?.getDocumentIds()?.map(U=>U.clientDocumentId)??[];hj(l.map(U=>U.id),I)&&(yield this.docService?.setDocuments({documents:l,options:d,source:"internal"}));let S=[],R=this.docService?.getLocation();R?.location?.id&&S.push(R.location.id),Object.values(this.docService?.getLocations()??{}).forEach(U=>{U?.location?.id&&S.push(U.location.id)}),hj(h.map(U=>U?.id).filter(Boolean),S)&&(yield this.docService?.setLocations({locations:h,source:"internal",options:{appendLocation:!f}}))}}}))),o}catch(i){return this.loggingService.catch("Error in setVeltAuthProvider: ",i),null}})}setUserToStorage(r){return y(this,null,function*(){try{if(r){let i=yield HT(r,r?.userId??"");localStorage.setItem(k.LOCAL_STORAGE.VELT_IDENTIFY_USER,i)}}catch(i){this.loggingService.catch("Error in setUserToStorage: ",i)}})}getUserFromStorage(r){return y(this,null,function*(){try{let i=localStorage.getItem(k.LOCAL_STORAGE.VELT_IDENTIFY_USER);return i?yield fp(i,r?.userId??""):null}catch(i){return this.loggingService.catch("Error in getUserFromStorage: ",i),null}})}setIsPrivateCommentsEnabled(r){try{this.isPrivateCommentsEnabled$.next(r)}catch(i){this.loggingService.catch("Error in setIsPrivateCommentsEnabled: ",i)}}getIsPrivateCommentsEnabled(){return this.isPrivateCommentsEnabled$.value}getIsPrivateCommentsEnabled$(){return this.isPrivateCommentsEnabled$.asObservable()}updateUserWithColorAndTextColor(r){return y(this,null,function*(){try{let i=JSON.parse(JSON.stringify(r??{})),o=yield this.getUserFromStorage(i);return!o||Object.keys(o).length===0?(delete i?.color,delete i?.textColor,i):(o?.color&&(i.color=o?.color),o?.textColor&&(i.textColor=o?.textColor),i)}catch(i){return this.loggingService.catch("Error in updateUserWithColorAndTextColor: ",i),r}})}updateUserIfRequired(r){return y(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: updateUserIfRequired","color: green;");try{let i=yield this.getUserFromStorage(r),o={};r.color&&r.color!==i?.color&&(o.color=r.color),r.textColor&&r.textColor!==i?.textColor&&(o.textColor=r.textColor),Object.keys(o).length>0&&r.clientOrganizationId&&this.docService?.addUserInfoToOrganization({organizationId:r.clientOrganizationId,user:le(V({},o),{userId:r.userId})})}catch(i){this.loggingService.catch("Error in updateUserIfRequired: ",i)}})}initializeClient(r,i,o,s,a){return y(this,null,function*(){try{if(this.autoLoginRequired=!1,this.portableResumeUserId=null,this.userOptions$.next(i),this.initializeClientToken)this.pendingUserLogin=r,this.pendingUserLoginSource=a;else{a!==Vp&&this.cancelPortableLicenseRetry(),r.userSnippylyId=sB(this.configService.getApiKey(),r.userId),this.pendingUserLogin=void 0,this.pendingUserLoginSource=void 0,this.initializeClientToken=o;let c=this.portableSessionEpoch,l=this.portableLocalSessionEnds,d=yield _d(this.afAuth).pipe(Tn(1)).toPromise().catch(E=>null),h=!0;this.providedUser=JSON.parse(JSON.stringify(r));let f=!d&&s?this.takePendingPortableRestore(r,i):null,g=f?.envelope??null;if(g){if(this.loggingService.log("%c[WB] Calling FUNCTION: restorePortableSession","color: green;"),this.validateOrganizationId(r),!(yield this.applyIdentifyResponse(r,g.res,s)))return;h=!1,this.trackAutoAuthSuccess(r,a)}else if(!d&&s&&a==="internal-autoLogin"&&this.configService?.getEnablePortableBackend()===!0)return f?.resume?(ze("session.resume-skipped",f.overtaken?"overtaken":"not restorable"),this.loggingService.log("Velt [portable backend]: not following the session another page saved; waiting for identify().")):f?.overtaken?(ze("session.restore-discarded"),this.loggingService.log("Velt [portable backend]: discarding a reload restore that a sign-out or a new identify overtook."),this.clearPersistedPortableSessionIfUnchanged(f.raw)):(this.loggingService.log("Velt [portable backend]: nothing restorable on reload; waiting for identify()."),this.clearPersistedPortableSession()),this.initializeClientToken=0,this.checkForPendingLogin(),null;if(d){let E=yield xp(d,!0).catch(U=>null);if(!E)return;let{user:I,firebaseConfig:S,advancedQueries:R}=E.claims;if(tb({userSnippylyId:d?.uid,groupId:I?.groupId,organizationId:I?.organizationId},r,i)||!s&&r?.organizationId&&!this.forceReLoggedIn||this.forceReLoginRequiredForAdvancedQueries(r)||this.forceReLoginRequiredForRegion(r,S)||this.forceReLoginRequiredForCommentViews(r)){localStorage.setItem(k.LOCAL_STORAGE.VELT_USER_FORCE_RE_LOGGED_IN,"true"),localStorage.setItem(k.LOCAL_STORAGE.VELT_COMMENT_VIEWS_MIGRATED,"true"),this.forceReLoggedIn=!0;let U=this.portableSessionEpoch,G=this.portableLocalSessionEnds,X=this.signOutUser("internal");c+=this.portableSessionEpoch-U,l+=this.portableLocalSessionEnds-G,yield X}else this.loggingService.log("%c[WB] Calling FUNCTION: reinitializeCurrentUser","color: green;"),this.loggingService.log("Keeping user"),yield this.updateUserIfRequired(r),this.validateOrganizationId(r),this.setFirebaseConfig(S),this.setAdvancedQueries(R),I&&(this.providedUser.isAdmin=!!I.isAdmin),this.initializeSignedInUser(d,s,r),h=!1,this.configService?.getEnablePortableBackend()!==!0&&this.portableLicenseNotices.served(null,"identify","hosted-callable"),this.trackAutoAuthSuccess(r,a)}else if(h&&c===this.portableSessionEpoch&&this.isPortableIdentityChange(r,i)){let E=this.signOutUser("internal");c=this.portableSessionEpoch,l=this.portableLocalSessionEnds,yield E}if(h){this.analyticsService.trackEvent(St.Events.Core.SDK_VALIDATE_CLIENT_TRIGGERED,{apiKey:this.apiKey,clientUserId:r.userId,snippylyUserId:r.userSnippylyId,forceReset:this.userOptions$.value?.forceReset,user:this.getUserForTelemetry(r),source:a},!0,r.userSnippylyId,r.userId);let E=Date.now(),I=a===Vp,S=this.endpointsService?.getPortableIdentifyUrl?.()?"gateway":"hosted-callable",R=I&&S==="hosted-callable"?yield this.requestIdentify(r,i?.authToken).catch(G=>{if(R2(G))return Sy("the license re-run of identify could not reach the deployment");throw G}):yield this.requestIdentify(r,i?.authToken);if(I&&this.pendingUserLogin)return ze("credential.license-retry-discarded","pending identify"),this.initializeClientToken=0,this.checkForPendingLogin(),null;if(I&&S==="hosted-callable"&&this.isCallableLicenseRetryOvertaken(r,c,l,s))return ze("credential.license-retry-discarded","overtaken"),this.endLicenseRetryRunQuietly();if(R.error){if(this.analyticsService.trackEvent(St.Events.Core.SDK_VALIDATE_CLIENT_FAILED,le(V({apiKey:this.apiKey,clientUserId:r.userId,snippylyUserId:r.userSnippylyId,message:R.error,forceReset:this.userOptions$.value?.forceReset,user:this.getUserForTelemetry(r)},R),{source:a}),!0,r.userSnippylyId,r.userId),Ny(R)){let G=I?this.portableLicenseRetryRunSince??E:E;if(this.isPortableIdentifyOvertaken(c,l,s)||(this.notePortableLicenseRefusalAnswer(R,S),S==="gateway"?!this.pauseLivePortableSessionForLicense("identify")&&!s&&this.armLicenseRefusedIdentifyRetry(r,i,G):this.armLicenseRefusedIdentifyRetry(r,i,G,"hosted-callable",s)),I)return this.endLicenseRetryRunQuietly()}else if(I&&this.isTransientLicenseRetryFailure(R)){if(!this.isPortableIdentifyOvertaken(c,l,s)){let G=this.portableLicenseRetryRunSince??E;S==="gateway"?this.armLicenseRefusedIdentifyRetry(r,i,G):this.armLicenseRefusedIdentifyRetry(r,i,G,"hosted-callable",s)}return this.endLicenseRetryRunQuietly()}else if(R.error&&typeof R.error=="string")if(this.isTokenExpiredIdentifyError(R))this.emitIdentifyTokenExpiredError(R,r,a);else{let G=R;this.coreActionsService.triggerAction(gi.ERROR,G)}throw R}else this.tokenExpiredErrorCount=0;if(this.shouldHandlePortableBackend(R)&&this.isPortableIdentifyOvertaken(c,l,s))return this.loggingService.log("Velt [portable backend]: discarding an identify response that a sign-out overtook."),this.initializeClientToken=0,this.checkForPendingLogin(),null;if(this.shouldHandlePortableBackend(R)?this.portableLicenseNotices.served(il(R?.license),"identify",S):S==="hosted-callable"&&R?.firebaseConfig&&this.portableLicenseNotices.served(il(R?.license),"identify","hosted-callable"),this.shouldHandlePortableBackend(R)&&c!==this.portableSessionEpoch&&(this.autoLoginRequired=!1,this.portableResumeUserId=null),this.analyticsService.trackEvent(St.Events.Core.SDK_VALIDATE_CLIENT_SUCCESS,{apiKey:this.apiKey,clientUserId:r.userId,snippylyUserId:r.userSnippylyId,forceReset:this.userOptions$.value?.forceReset,user:this.getUserForTelemetry(r),source:a},!0,r.userSnippylyId,r.userId),this.validateOrganizationId(r),!(yield this.applyIdentifyResponse(r,R,s)))return}this.initializeClientToken=0,this.lastLoggedInUserData={user:r,userOptions:i,initializeClientToken:o,autoLogin:s},this.checkForPendingLogin()}return r}catch(c){return this.initializeClientToken=0,this.checkForPendingLogin(),this.loggingService.catch("Error in initializeClient: ",c),i?.throwError?Promise.reject(c):Promise.resolve(null)}})}isPortableIdentifyOvertaken(r,i,o){let s=this.portableSessionEpoch-r;return o?s!==0:s!==this.portableLocalSessionEnds-i}isCallableLicenseRetryOvertaken(r,i,o,s){try{if(this.isPortableIdentifyOvertaken(i,o,s))return!0;let a=this.afAuth?.currentUser;return!!a&&a.uid!==r?.userSnippylyId}catch{return!0}}isPortableIdentityChange(r,i){try{if(!this.portableAuthUser$.value)return!1;let o=this.portableSessionIdentity?.user??this.user$.value;return o?tb(o,r,i):!1}catch(o){return this.loggingService.catch("Error in isPortableIdentityChange: ",o),!1}}isVersionGreaterThanOrEqualTo4(){try{let r=Wc();return(r?parseInt(r.split(".")?.[0]||"0"):0)>=4}catch(r){return this.loggingService.catch("Error in isVersionGreaterThanOrEqualTo4: ",r),!1}}isVersion4Point5(){try{let r=Wc();if(r){let i=r.split("."),o=parseInt(i[0]||"0"),s=parseInt(i[1]||"0"),a=parseInt(i[2]||"0");if(o>=4&&s>=5)return o===4&&s===5&&a===0?!r.toLowerCase().includes("beta"):!0}return!1}catch(r){return this.loggingService.catch("Error in isVersion4Point5: ",r),!1}}forceReLoginRequiredForAdvancedQueries(r){try{let i=this.isVersionGreaterThanOrEqualTo4(),o=!1;try{let s=localStorage.getItem(k.LOCAL_STORAGE.VELT_ADVANCED_QUERIES);s&&(o=JSON.parse(s)?.advancedQueriesEnabled)}catch(s){this.loggingService.catch("Error in forceReLoginRequiredForAdvancedQueries: ",s)}return!!(i&&r.organizationId&&!o)}catch(i){return this.loggingService.catch("Error in forceReLoginRequiredForAdvancedQueries: ",i),!1}}forceReLoginRequiredForCommentViews(r){try{let i=this.isVersion4Point5(),o=!1;try{let s=localStorage.getItem(k.LOCAL_STORAGE.VELT_COMMENT_VIEWS_MIGRATED);s&&(o=JSON.parse(s))}catch(s){this.loggingService.catch("Error in forceReLoginRequiredForCommentViews: ",s)}return!!(i&&r.organizationId&&!o)}catch(i){return this.loggingService.catch("Error in forceReLoginRequiredForCommentViews: ",i),!1}}forceReLoginRequiredForRegion(r,i){try{return!!(this.isVersionGreaterThanOrEqualTo4()&&r.organizationId&&!i?.region)}catch(o){return this.loggingService.catch("Error in forceReLoginRequiredForRegion: ",o),!1}}checkForPendingLogin(){this.pendingUserLogin&&this.initializeClient(this.pendingUserLogin,this.userOptions$?.value||{},new Date().getTime(),void 0,this.pendingUserLoginSource)}setFirebaseConfig(r){this.loggingService.log("%c[WB] Calling FUNCTION: setFirebaseConfig","color: green;");try{this.firebaseConfig$.value||this.firebaseConfig$.next({firebaseOptions:V(V({},this.endpointsService.getFirebaseConfig()),r)})}catch(i){this.loggingService.catch("Error in setFirebaseConfig: ",i)}}requestIdentify(r,i){return y(this,null,function*(){let o=Wc();this.usersService?.userResolverConfigured?.()&&(r=jR(r));let s=this.endpointsService.getPortableIdentifyUrl();return s?u2({url:s,apiKey:this.apiKey,user:r,version:o,authToken:i}):(yield yd(this.functions,dd({url:this.endpointsService.getCloudFunctionUrl("validateClient"),apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:1200*1e3})({apiKey:this.apiKey,user:r,version:o,authToken:i}))?.data})}requestPortableRefresh(r){return y(this,null,function*(){let i=this.getConfiguredPortableIdentifyUrl();return i?f2({url:h2(i,"refresh"),apiKey:this.apiKey,refreshToken:r,timeoutMs:c2()}):Sy("the portable identify URL is not configured; the renewal credential was not sent")})}reportPortableRefreshMisconfigured(r){try{let i=String(r?.code??"unknown");if(this.reportedPortableRefreshCodes.has(i))return;if(this.reportedPortableRefreshCodes.add(i),i===e.PORTABLE_NO_CREDENTIAL_ENVELOPE.code){console.error("Velt [portable backend]: this session has no renewal credential for the configured gateway (the identify answer carried no refreshToken, or selfHosted.portableBackendUrl changed after sign-in), so it cannot be renewed: it is signed out and the app must identify() again. Every identify answer from portable-v0.1.6 or later carries one.");return}let o=r?.message?` (${r.message})`:"";console.error(i==="invalid-argument"?`Velt [portable backend]: the gateway rejected the session renewal as malformed: invalid-argument${o}. The SDK and gateway versions disagree on /identify/refresh; renewal is stopped for this session.`:`Velt [portable backend]: the gateway refused the session renewal: ${i}${o}. A deployment setting is wrong (the allowed origins, or the identify configuration for this API key). Renewal is stopped for this session; after the setting is fixed, a reload renews from the saved session.`)}catch{}}emitIdentifyTokenExpiredError(r,i,o){if(this.tokenExpiredErrorCount++,this.tokenExpiredErrorCount<=this.TOKEN_EXPIRED_ERROR_COUNT_LIMIT){let s={code:"token_expired",message:"Token expired",error:r?.error,source:r?.source};this.coreActionsService.triggerAction(gi.ERROR,s)}else{let s={code:"too_many_retries",message:"Token expired. Too many retries.",error:r?.error,source:r?.source};this.coreActionsService.triggerAction(gi.ERROR,s),this.analyticsService.trackEvent(St.Events.Core.SDK_JWT_EXPIRED_RETRY_EXCEEDED,{apiKey:this.apiKey,clientUserId:i.userId,snippylyUserId:i.userSnippylyId,forceReset:this.userOptions$.value?.forceReset,source:o},!0,i.userSnippylyId,i.userId)}}getConfiguredPortableIdentifyUrl(){try{let r=this.endpointsService?.getPortableIdentifyUrl?.();return r&&!cd(r)?r:null}catch{return null}}notePortableLicenseRefusalAnswer(r,i="gateway"){this.portableLicenseNotices.refused(il(r?.license),JN(r?.message),i)}isTokenExpiredIdentifyError(r){try{return r?.code==="token_expired"||!!r?.error?.toLowerCase?.()?.includes("token expired")}catch{return!1}}shouldHandlePortableBackend(r){try{return this.configService?.getEnablePortableBackend()===!0&&M2(r)}catch(i){return this.loggingService.catch("Error in shouldHandlePortableBackend: ",i),!1}}applyIdentifyResponse(r,i,o){return y(this,null,function*(){if(this.shouldHandlePortableBackend(i)){this.portableSessionEpoch++;let s=this.portableSessionEpoch,a=sl(i),c=a?this.endpointsService.getPortableIdentifyUrl()??void 0:void 0;this.portableSessionIdentity=V({user:r,epoch:s},a?{refreshToken:a,refreshTokenIssuer:c}:{}),this.portableSessionStartedAt=Date.now();let l=this.handlePortableBackendResponse(i);this.planDetails$.value||(this.getPlanDetailsCalled=!0,this.portablePlanSeeded=!0,this.planDetails$.next({planInfo:null,isPlanExpired:!1})),yield this.applyPortableProjectConfig(i);let d=null;if(i?.token&&this.usersService?.externalUserDataProviderAvailable())try{d=yield this.resolveSignedInUserWithProvider(r,this.providedUser?.clientOrganizationId||r.clientOrganizationId)}catch(f){this.loggingService.catch("Error in resolveSignedInUserWithProvider (Tier B sign-in): ",f),d=null}if(s!==this.portableSessionEpoch)return ze("session.adopt-discarded"),this.loggingService.log("Velt [portable backend]: discarding a portable sign-in that a sign-out or a new identify overtook."),!0;let h=this.initializePortableSignedInUser(r,i,d);h&&this.probeIdentifyPermissionWhenPortableReady(h,s,l)}else if(i.firebaseConfig){this.clearPortableBackendState(),this.setFirebaseConfig(i.firebaseConfig),yield this.signInWithCustomToken(r,i.token),this.loggingService.log("new signed in user",this.afAuth.currentUser);let s=yield xp(this.afAuth.currentUser,!0).catch(l=>null);if(!s)return!1;let{user:a,advancedQueries:c}=s.claims;this.setAdvancedQueries(c),this.providedUser.isAdmin=!!a?.isAdmin,this.initializeSignedInUser(this.afAuth.currentUser,o,r)}return!0})}applyPortableProjectConfig(r){return y(this,null,function*(){try{let i=yield eb({apiEndpoint:r?.apiEndpoint,token:r?.token});if(!i)return;this.applyProjectConfig(i)}catch(i){this.loggingService.catch("Error in applyPortableProjectConfig: ",i)}})}applyProjectConfig(r){this.setIsPrivateCommentsEnabled(!!r?.isPrivateCommentsEnabled);let i=r?.activityConfig??{immutable:!1,isEnabled:!1};this.cachedActivityConfig=i,this.activityService?.setActivityFeatureConfig(i)}handlePortableBackendResponse(r){try{this.loggingService.log("%c[WB] Calling FUNCTION: handlePortableBackendResponse","color: green;"),this.portableBackend$.next({backend:r?.backend,wsEndpoint:r?.wsEndpoint,apiEndpoint:r?.apiEndpoint});let i=P2({backend:r?.backend,token:r?.token??null,wsEndpoint:r?.wsEndpoint,apiEndpoint:r?.apiEndpoint});return this.portableChunkReady=i,b2(o=>this.onPortableLicenseRefusalReported(o)),O2(()=>this.onPortableApiKeyRefusalReported()),this.schedulePortableTokenRefresh(r?.token??null),i}catch(i){return this.loggingService.catch("Error in handlePortableBackendResponse: ",i),null}}schedulePortableTokenRefresh(r){try{if(this.clearPortableTokenRefresh(),this.portableLicensePause=null,this.cancelPortableLicenseRetry(),this.portableToken=r,!r)return;this.portableRefreshFailures=0,this.portableRefreshFailuresPastExpiry=0;let i=T2(Up(r),Date.now());if(i!==null?this.armPortableRefreshTimer(i,"expiry"):this.loggingService.log("Velt [portable backend]: no proactive token refresh scheduled (token expiry unreadable or already past)."),typeof document<"u"&&typeof document.addEventListener=="function"){this.portableVisibilityHandler=o=>{try{let s=XN(this.portableToken,Date.now());if(ze(`page.${o?.type??"lifecycle"}`,`visibility=${typeof document<"u"?document.visibilityState:"?"} credentialExpired=${s}`),o?.type==="pageshow"&&o.persisted===!1)return;s?this.refreshPortableToken("focus"):this.checkPortableSessionAgainstStorage(`page.${o?.type??"lifecycle"}`),k2()}catch{}};for(let o of e.PORTABLE_DOCUMENT_LIFECYCLE_EVENTS)document.addEventListener(o,this.portableVisibilityHandler);typeof window<"u"&&typeof window.addEventListener=="function"&&window.addEventListener("pageshow",this.portableVisibilityHandler)}this.armPortableStorageListener()}catch(i){this.loggingService.catch("Error scheduling portable token refresh: ",i)}}readStoredPortableSessionRaw(){try{return localStorage.getItem(k.LOCAL_STORAGE.VELT_PORTABLE_SESSION)}catch{return}}readPortableSavedSession(r){return y(this,null,function*(){try{let i;try{i=localStorage.getItem(k.LOCAL_STORAGE.VELT_PORTABLE_SESSION)}catch{return{verdict:"persist"}}if(!i){let a=this.readPortableSignOutAt();return{verdict:a!==null&&a>=this.portableSessionStartedAt?"stop":"persist"}}if(i===this.portableSavedSessionRaw)return{verdict:"persist"};let o=null;try{o=yield fp(i,this.apiKey??"")}catch{o=null}return o?.v!==1||o?.apiKey!==this.apiKey||!o?.user?.userId?{verdict:"renew-only"}:o.user.userId!==r?{verdict:"stop"}:{verdict:"persist",sharedRefreshToken:(o?.portableBackendUrl??null)===(this.configService?.getSelfHostedConfig?.()?.portableBackendUrl??null)?sl(o?.res):void 0}}catch(i){return this.loggingService.catch("Error in AuthService readPortableSavedSession: ",i),{verdict:"persist"}}})}recordPortableSignOut(){try{if(!this.apiKey)return;let r={};try{let i=JSON.parse(localStorage.getItem(k.LOCAL_STORAGE.VELT_PORTABLE_SIGNED_OUT)??"{}");i&&typeof i=="object"&&!Array.isArray(i)&&(r=i)}catch{r={}}r[this.apiKey]=Date.now(),localStorage.setItem(k.LOCAL_STORAGE.VELT_PORTABLE_SIGNED_OUT,JSON.stringify(r))}catch{}}armPortableRefreshTimer(r,i){this.cancelPortableRefreshTimer(),this.portableRefreshTimer=setTimeout(()=>this.refreshPortableToken(i),r)}cancelPortableRefreshTimer(){this.portableRefreshTimer&&(clearTimeout(this.portableRefreshTimer),this.portableRefreshTimer=null)}readPortableSignOutAt(){try{let r=JSON.parse(localStorage.getItem(k.LOCAL_STORAGE.VELT_PORTABLE_SIGNED_OUT)??"null"),i=r&&this.apiKey?r[this.apiKey]:void 0;return typeof i=="number"&&Number.isFinite(i)?i:null}catch{return null}}clearPortableTokenRefresh(){try{if(this.cancelPortableRefreshTimer(),this.portableVisibilityHandler&&typeof document<"u")for(let r of e.PORTABLE_DOCUMENT_LIFECYCLE_EVENTS)document.removeEventListener(r,this.portableVisibilityHandler);this.portableVisibilityHandler&&typeof window<"u"&&typeof window.removeEventListener=="function"&&window.removeEventListener("pageshow",this.portableVisibilityHandler),this.portableVisibilityHandler=null,this.portableStorageHandler&&typeof window<"u"&&typeof window.removeEventListener=="function"&&window.removeEventListener("storage",this.portableStorageHandler),this.portableStorageHandler=null}catch{}}refreshPortableToken(r){return y(this,null,function*(){let i=this.portableSessionEpoch;if(this.portableRefreshInFlightEpoch!==i){this.portableRefreshInFlightEpoch=i;try{let o=this.portableSessionIdentity,s=o?.user;if(!o||o.epoch!==i||!s?.userId||!this.portableBackend$.value)return;if(this.portableRenewalStopped?.epoch===i){ze("credential.refresh-skipped",`${this.portableRenewalStopped.reason}; waiting for identify()`);return}if(this.holdRefreshForLicensePause(i,r))return;let a=yield this.readPortableSavedSession(s.userId);if(i!==this.portableSessionEpoch)return;if(a.verdict==="stop"){this.endPortableSessionFromAnotherPage(s,`refresh:${r}`);return}let c=a.sharedRefreshToken,l=this.endpointsService.getPortableIdentifyUrl()??void 0;c&&l&&this.portableSessionIdentity&&c!==this.portableSessionIdentity.refreshToken&&(ze("credential.shared-adopted"),this.portableSessionIdentity=le(V({},this.portableSessionIdentity),{refreshToken:c,refreshTokenIssuer:l}));let d=this.portableSessionIdentity??o,h=d.refreshToken&&d.refreshTokenIssuer===l?d.refreshToken:void 0;if(!h){this.reportPortableRefreshMisconfigured(e.PORTABLE_NO_CREDENTIAL_ENVELOPE),this.endPortableSessionForDeadCredential(s,e.PORTABLE_NO_CREDENTIAL_ENVELOPE,r);return}this.loggingService.log(`Velt [portable backend]: refreshing the gateway credential (${r}).`),ze("credential.refresh-requested",`reason=${r} via=refresh`);let f=yield this.requestPortableRefresh(h);if(i!==this.portableSessionEpoch){ze("credential.refresh-discarded",`reason=${r}`),this.loggingService.log("Velt [portable backend]: discarding a credential refresh that a sign-out or a new identify overtook.");return}if(!this.shouldHandlePortableBackend(f)||!f?.token){if(Ny(f)){ze("credential.refresh-license-refused",`reason=${r}`),this.notePortableLicenseRefusalAnswer(f),this.pausePortableRenewalsForLicense(i,!0);return}if(f?.code===KN){this.endPortableSessionForDeadCredential(s,f,r);return}if(kp.has(f?.code)){ze("credential.refresh-misconfigured",`code=${f?.code}`),this.portableRenewalStopped={epoch:i,reason:`renewal refused: ${f?.code}`},this.cancelPortableRefreshTimer(),this.reportPortableRefreshMisconfigured(f);return}this.portableRefreshFailures++,this.portableRefreshFailures>=e.PORTABLE_REFRESH_WARN_AFTER_FAILURES&&this.reportPortableRefreshFailing(f,i);let S=Date.now();XN(this.portableToken,S)&&this.portableRefreshFailuresPastExpiry++,this.armPortableRefreshTimer(y2(Up(this.portableToken),S,this.portableRefreshFailuresPastExpiry),r);return}let g=this.readStoredPortableSessionRaw(),E=yield this.readPortableSavedSession(s.userId);if(i!==this.portableSessionEpoch){ze("credential.refresh-discarded",`reason=${r}`);return}if(E.verdict==="stop"){this.endPortableSessionFromAnotherPage(s,`refresh-answered:${r}`);return}ze("credential.refreshed"),this.portableLicenseNotices.served(il(f?.license),"renewal"),this.handlePortableBackendResponse(f);let I=sl(f)??h;this.portableSessionIdentity?.epoch===i&&(this.portableSessionIdentity=le(V({},this.portableSessionIdentity),{refreshToken:I,refreshTokenIssuer:l})),E.verdict==="persist"&&this.persistPortableSession(s,le(V({},f),{refreshToken:I}),{expectStoredRaw:g})}catch(o){this.loggingService.catch("Error refreshing portable token: ",o)}finally{this.portableRefreshInFlightEpoch===i&&(this.portableRefreshInFlightEpoch=null)}}})}holdRefreshForLicensePause(r,i){let o=this.portableLicensePause;if(o?.epoch!==r||i==="license")return!1;let s=Date.now(),a=Math.min(o.retryAt-s,D2);return a<=0?!1:(o.retryAt=s+a,ze("credential.refresh-skipped",`license paused; next retry in ${Math.round(a/1e3)}s`),this.armPortableRefreshTimer(a,"license"),this.checkPortableSessionAgainstStorage(`license-paused:${i}`),!0)}pausePortableRenewalsForLicense(r,i){try{let o=this.portableLicensePause?.epoch===r?this.portableLicensePause:null;if(o&&!i)return;let s=(o?.refusals??0)+(i?1:0),a=ZN(Math.random());this.portableLicensePause={epoch:r,refusals:s,retryAt:Date.now()+a},ze("credential.license-paused",`refusals=${s} retryInS=${Math.round(a/1e3)}`),this.armPortableRefreshTimer(a,"license")}catch(o){this.loggingService.catch("Error pausing portable renewals for the license: ",o)}}onPortableLicenseRefusalReported(r){try{this.portableLicenseNotices.refused(r?.license??null,r?.message),this.pauseLivePortableSessionForLicense(r?.source??"?")}catch(i){this.loggingService.catch("Error handling a portable license refusal: ",i)}}onPortableApiKeyRefusalReported(){try{let r=this.portableSessionIdentity;if(!r||r.epoch!==this.portableSessionEpoch||!this.portableBackend$.value){ze("credential.api-key-refused","no live session");return}if(this.portableApiKeyRefusalWarned||(this.portableApiKeyRefusalWarned=!0,console.warn("Velt [portable backend]: the gateway refused the realtime session because the API key is disabled. The SDK does not reconnect in a loop: it renews the session (every 30 s while the token is valid, less often after it expires) and reconnects once the key is enabled again.")),this.portableRefreshFailures>0){ze("credential.api-key-refused","renewal retry already running");return}let i=Date.now(),o=this.portableApiKeyRenewalAskedAt;if(o?.epoch===r.epoch&&i-o.at<Fp){ze("credential.api-key-refused","renewal floor"),this.armPortableRefreshTimer(Fp-(i-o.at),"focus");return}this.portableApiKeyRenewalAskedAt={epoch:r.epoch,at:i},ze("credential.api-key-refused","renewing now"),this.refreshPortableToken("focus")}catch(r){this.loggingService.catch("Error handling a portable API-key refusal: ",r)}}pauseLivePortableSessionForLicense(r){let i=this.portableSessionIdentity;return!i||i.epoch!==this.portableSessionEpoch||!this.portableBackend$.value?!1:(ze("credential.license-reported",`source=${r}`),this.pausePortableRenewalsForLicense(i.epoch,!1),!0)}armPortableLicenseRetry(r,i){try{this.cancelPortableLicenseRetry();let o=ZN(Math.random()),s=setTimeout(()=>this.runPortableLicenseRetry(),o);this.portableLicenseRetry={timer:s,epoch:this.portableSessionEpoch,dueAt:Date.now()+o,what:r,rerun:i},ze("credential.license-retry-armed",`${r} retryInS=${Math.round(o/1e3)}`)}catch(o){this.loggingService.catch("Error arming the portable license retry: ",o)}}runPortableLicenseRetry(){let r=this.portableLicenseRetry;if(r){this.portableLicenseRetry=null,clearTimeout(r.timer);try{if(r.epoch!==this.portableSessionEpoch||this.portableSessionIdentity||this.initializeClientToken){ze("credential.license-retry-skipped",r.what);return}ze("credential.license-retry",r.what),r.rerun()}catch(i){this.loggingService.catch("Error running the portable license retry: ",i)}}}cancelPortableLicenseRetry(){let r=this.portableLicenseRetry;r&&(clearTimeout(r.timer),this.portableLicenseRetry=null),this.portableLicenseRetryRunSince=null}armLicenseRefusedIdentifyRetry(r,i,o,s="gateway",a){this.armPortableLicenseRetry("identify",()=>{this.portableLicenseRetryRun=this.rerunLicenseRefusedIdentify(r,i,o,s,a)})}rerunLicenseRefusedIdentify(r,i,o,s="gateway",a){return y(this,null,function*(){try{if(s==="hosted-callable"){let f=this.afAuth?.currentUser;if(f&&f.uid!==r?.userSnippylyId){ze("credential.license-retry-skipped","another user signed in");return}if(this.initializeClientToken)return;this.portableLicenseRetryRunSince=o,yield this.initializeClient(r,i,new Date().getTime(),a,Vp).catch(()=>{});return}let c=this.portableSessionEpoch,l=this.readPortableSignOutAt();if(l!==null&&l>o){ze("credential.license-retry-skipped","signed out in another page");return}let d=yield this.readPersistedPortableSession();if(c!==this.portableSessionEpoch||this.portableSessionIdentity||this.initializeClientToken)return;let h=d?.envelope?.user?.userId;if(h&&h!==r?.userId){ze("credential.license-retry-skipped","another user signed in");return}this.portableLicenseRetryRunSince=o,yield this.initializeClient(r,i,new Date().getTime(),void 0,Vp).catch(()=>{})}catch(c){this.loggingService.catch("Error re-running the license-refused identify: ",c)}finally{this.portableLicenseRetryRunSince=null}})}endLicenseRetryRunQuietly(){return this.initializeClientToken=0,this.checkForPendingLogin(),null}isTransientLicenseRetryFailure(r){let i=r?.code;return!this.isTokenExpiredIdentifyError(r)&&!kp.has(i)&&i!=="missing_jwt_token"&&i!=="unauthenticated"&&i!=="permission-denied"}armRestoreLicenseRetry(r){this.armPortableLicenseRetry("restore",()=>{this.portableAutoLoginInFlight=this.portableAutoLoginInFlight.then(()=>this.autoLoginPortableSession(le(V({},r??{}),{licenseRetry:!0}))).catch(()=>{})})}reportPortableRefreshFailing(r,i){try{if(this.portableRefreshWarnedEpoch===i)return;this.portableRefreshWarnedEpoch=i,console.warn(`Velt [portable backend]: could not renew the gateway credential (${this.portableRefreshFailures} attempts in a row${r?.code?`, last: ${r.code}`:""}). The SDK keeps retrying \u2014 every 30 s while the current token is valid; once it has expired, after 30 s, doubling up to every 16 minutes, and each time the page becomes active again \u2014 and the realtime session is unavailable from the moment the token expires until a renewal succeeds. Check that the gateway's /identify/refresh endpoint is reachable and the API key is enabled.`)}catch{}}endPortableSessionForDeadCredential(r,i,o){ze("credential.refresh-credential-invalid",`reason=${o}`),this.portableSavedSessionRaw&&this.clearPersistedPortableSessionIfUnchanged(this.portableSavedSessionRaw),this.endPortableSessionLocally(r),this.emitIdentifyTokenExpiredError(i,r,"internal-portableRefresh")}endPortableSessionFromAnotherPage(r,i){ze("session.ended-elsewhere",i),this.loggingService.log("Velt [portable backend]: another page signed out or signed in another user; this page's session ends too."),this.endPortableSessionLocally(r)}checkPortableSessionAgainstStorage(r){return y(this,null,function*(){try{let i=this.portableSessionEpoch,o=this.portableSessionIdentity;if(!o||o.epoch!==i||!o.user?.userId)return;let{verdict:s}=yield this.readPortableSavedSession(o.user.userId);s==="stop"&&i===this.portableSessionEpoch&&this.endPortableSessionFromAnotherPage(o.user,r)}catch(i){this.loggingService.catch("Error checking the portable session against storage: ",i)}})}armPortableStorageListener(){try{if(this.portableStorageHandler||typeof window>"u"||typeof window.addEventListener!="function")return;this.portableStorageHandler=r=>{try{let i=r?.key;if(i!==null&&i!==k.LOCAL_STORAGE.VELT_PORTABLE_SESSION&&i!==k.LOCAL_STORAGE.VELT_PORTABLE_SIGNED_OUT)return;this.portableSessionIdentity?this.checkPortableSessionAgainstStorage("storage"):this.portableResumeUserId&&this.resumePortableSessionFromAnotherPage()}catch{}},window.addEventListener("storage",this.portableStorageHandler)}catch(r){this.loggingService.catch("Error arming the portable storage listener: ",r)}}resumePortableSessionFromAnotherPage(){let r=this.portableResumeUserId;!r||this.portableSessionIdentity||this.initializeClientToken||!this.autoLoginRequired||this.configService?.getEnablePortableBackend()!==!0||(this.portableAutoLoginInFlight=this.portableAutoLoginInFlight.then(()=>this.autoLoginPortableSession({onlyUserId:r})).catch(()=>{}))}initializePortableSignedInUser(r,i,o=null){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: initializePortableSignedInUser","color: green;"),!i?.token)return this.portableAuthUser$.value&&(this.userPermissionService?.invalidateAllPermissionsState(),this.releaseLiveUserSession("clear")),null;let s=new so;s.type="signedIn",s=V(V(V({},s),r),qre(o)),nb(s,{provided:le(V({},r),{isAdmin:_2(i?.token)}),resolved:o,avatarColor:c=>this.getUserAvatarColor(c),textColor:c=>this.getUserTextColor(c)}),this.setUserToStorage(s),this.persistPortableSession(s,i);let a=Object.assign({},s);return delete a.contacts,this.analyticsService.identifyUser(s.userSnippylyId,a,{forceReset:this.userOptions$.value?.forceReset}),this.user$.next(s),this.portableAuthUser$.next({uid:s.userSnippylyId}),s}catch(s){return this.loggingService.catch("Error in initializePortableSignedInUser: ",s),null}}clearPortableBackendState(){try{this.portableSignOutOwnsEpochBump||this.portableSessionEpoch++,this.releasePortableSession({clearStorage:!0})}catch(r){this.loggingService.catch("Error clearing portable backend state: ",r)}}releaseLiveUserSession(r){this.resetServicesCache(),this.user$.next(null),r==="local"?this.releasePortableSession({clearStorage:!1}):this.clearPortableBackendState()}releasePortableSession(r){this.portablePlanSeeded&&(this.portablePlanSeeded=!1,this.getPlanDetailsCalled=!1),this.pendingPortableRestore=null,this.portableSessionIdentity=null,this.cancelPortableLicenseRetry(),r.clearStorage&&(this.portableAutoLoginCalled||this.configService?.getEnablePortableBackend()===!0)&&this.clearPersistedPortableSession(),!(!this.portableBackend$.value&&!this.portableAuthUser$.value)&&(this.clearPortableTokenRefresh(),this.portableToken=null,this.portableChunkReady=null,this.portableRefreshFailures=0,this.portableRefreshFailuresPastExpiry=0,this.portableLicensePause=null,this.portableBackend$.next(null),this.portableAuthUser$.next(null),this.user$.next(null),x2())}endPortableSessionLocally(r){try{this.userPermissionService?.invalidateAllPermissionsState(),this.portableSessionEpoch++,this.portableLocalSessionEnds++,this.releaseLiveUserSession("local"),this.autoLoginRequired=!0,this.portableResumeUserId=r?.userId??null,this.armPortableStorageListener()}catch(i){this.loggingService.catch("Error ending the portable session: ",i)}}trackAutoAuthSuccess(r,i){this.analyticsService.trackEvent(St.Events.Core.SDK_USER_AUTH_SUCCESS,{apiKey:this.apiKey,clientUserId:r.userId,snippylyUserId:r.userSnippylyId,authType:"auto",forceReset:this.userOptions$.value?.forceReset,user:this.getUserForTelemetry(r),source:i})}buildAutoLoginOptions(){return this.userOptions$?.value?le(V({},this.userOptions$.value),{replaceContacts:!1,replaceGroupContacts:!1,replacePrivateContacts:!1}):{}}persistPortableSession(r,i,o){let s=this.portableSessionEpoch;return this.portablePersistInFlight=this.portablePersistInFlight.then(()=>this.writePortableSessionEnvelope(r,i,s,o?.expectStoredRaw)).catch(()=>{}),this.portablePersistInFlight}writePortableSessionEnvelope(r,i,o,s){return y(this,null,function*(){try{if(!i?.token||!r?.userId||!this.apiKey)return;let a=this.user$.value;if(a?.userSnippylyId&&r.userSnippylyId&&a.userSnippylyId!==r.userSnippylyId)return;let c=this.getUserWithoutContacts(r);if(!c)return;let l={v:1,apiKey:this.apiKey,portableBackendUrl:this.configService?.getSelfHostedConfig?.()?.portableBackendUrl??null,user:c,res:V({backend:i.backend,wsEndpoint:i.wsEndpoint,apiEndpoint:i.apiEndpoint,token:i.token},sl(i)?{refreshToken:sl(i)}:{})},d=yield HT(l,this.apiKey);if(o!==this.portableSessionEpoch){this.loggingService.log("Velt [portable backend]: dropping a session envelope write that a sign-out or a new identify overtook.");return}if(s!==void 0&&localStorage.getItem(k.LOCAL_STORAGE.VELT_PORTABLE_SESSION)!==s){this.loggingService.log("Velt [portable backend]: not re-persisting a refreshed credential \u2014 another page changed the saved session meanwhile.");return}let h=this.readPortableSignOutAt();if(h!==null&&h>this.portableSessionStartedAt){this.loggingService.log("Velt [portable backend]: not persisting the session \u2014 another page signed out after it began.");return}typeof d=="string"&&!d.startsWith("{")&&d!==JSON.stringify(l)&&(localStorage.setItem(k.LOCAL_STORAGE.VELT_PORTABLE_SESSION,d),this.portableSavedSessionRaw=d)}catch(a){this.loggingService.catch("Error in writePortableSessionEnvelope: ",a)}})}readPersistedPortableSession(){return y(this,null,function*(){try{let r=localStorage.getItem(k.LOCAL_STORAGE.VELT_PORTABLE_SESSION);if(!r)return null;let i=yield fp(r,this.apiKey??"");return i?i.v!==1||i.apiKey!==this.apiKey||!i.user?.userId||!i.res?.token?(this.clearPersistedPortableSession(),null):(this.portableSavedSessionRaw=r,{envelope:i,raw:r}):null}catch(r){return this.loggingService.catch("Error in readPersistedPortableSession: ",r),null}})}clearPersistedPortableSession(){this.portableSavedSessionRaw=null;try{localStorage.removeItem(k.LOCAL_STORAGE.VELT_PORTABLE_SESSION)}catch{}}clearPersistedPortableSessionIfUnchanged(r){try{r&&localStorage.getItem(k.LOCAL_STORAGE.VELT_PORTABLE_SESSION)===r&&this.clearPersistedPortableSession()}catch{}}isPortableTokenNearExpiry(r){let i=Up(r);return i===null||i-Date.now()<=YN}isPortableRestoreConfigured(){try{return this.configService?.getEnablePortableBackend()===!0&&!!this.getConfiguredPortableIdentifyUrl()}catch{return!1}}isRestorablePortableSession(r,i,o){try{if(!this.isPortableRestoreConfigured()||o?.forceReset||r.portableBackendUrl!==(this.configService?.getSelfHostedConfig?.()?.portableBackendUrl??null)||!nl(r.res?.apiEndpoint)||r.user?.userSnippylyId!==i?.userSnippylyId)return!1;let s=this.user$.value;return s?.userSnippylyId&&s.userSnippylyId!==r.user.userSnippylyId||this.isPortableTokenNearExpiry(r.res.token)?!1:this.shouldHandlePortableBackend(r.res)}catch(s){return this.loggingService.catch("Error in isRestorablePortableSession: ",s),!1}}takePendingPortableRestore(r,i){let o=this.pendingPortableRestore;if(this.pendingPortableRestore=null,!o)return null;let s=o.resume===!0;return o.epoch!==this.portableSessionEpoch?{envelope:null,overtaken:!0,raw:o.raw,resume:s}:{envelope:this.isRestorablePortableSession(o.envelope,r,i)?o.envelope:null,overtaken:!1,raw:o.raw,resume:s}}autoLoginPortableSession(r){return y(this,null,function*(){let i=this.portableSessionEpoch,o=()=>i!==this.portableSessionEpoch||!this.autoLoginRequired,s=!!r?.onlyUserId;try{let a=yield this.readPersistedPortableSession(),c=a?.envelope;if(!a||!c||o()||s&&c.user?.userId!==r?.onlyUserId)return;if(!this.isPortableRestoreConfigured()){s||this.clearPersistedPortableSession();return}if(c.portableBackendUrl!==(this.configService?.getSelfHostedConfig?.()?.portableBackendUrl??null)){s||(this.loggingService.log("Velt [portable backend]: the persisted session belongs to a different gateway; dropped."),this.clearPersistedPortableSession());return}let l=c;if(this.isPortableTokenNearExpiry(c.res.token)){let h=sl(c.res);if(!h){this.loggingService.log("Velt [portable backend]: the persisted session has no renewal credential; waiting for identify()."),this.clearPersistedPortableSessionIfUnchanged(a.raw);return}ze("credential.restore-renew","via=refresh");let f=yield this.requestPortableRefresh(h);if(o())return;if(!this.shouldHandlePortableBackend(f)||!f?.token){if(Ny(f)){this.notePortableLicenseRefusalAnswer(f),this.loggingService.log("Velt [portable backend]: the persisted session was not renewed: the deployment refuses new sessions (license). Keeping it and asking again in 5 minutes or more."),this.armRestoreLicenseRetry(r);return}if(f?.code==="network_error"){this.loggingService.log("Velt [portable backend]: could not reach the gateway to renew the persisted session; keeping it for the next attempt."),r?.licenseRetry&&this.armRestoreLicenseRetry(r);return}if(kp.has(f?.code)&&this.reportPortableRefreshMisconfigured(f),f?.code!==KN){this.loggingService.log(`Velt [portable backend]: the persisted session's renewal was refused for now (${f?.code??"no code"}); keeping it for the next attempt.`),r?.licenseRetry&&!kp.has(f?.code)&&this.armRestoreLicenseRetry(r);return}this.loggingService.log("Velt [portable backend]: the persisted session could not be renewed on reload; waiting for identify()."),this.clearPersistedPortableSessionIfUnchanged(a.raw);return}this.portableLicenseNotices.served(il(f?.license),"renewal");let g=sl(f)??h;l=le(V({},c),{res:{backend:f.backend,wsEndpoint:f.wsEndpoint,apiEndpoint:f.apiEndpoint,token:f.token,refreshToken:g}})}if(o())return;this.pendingPortableRestore=V({envelope:l,epoch:i,raw:a.raw},s?{resume:!0}:{});let d=this.buildAutoLoginOptions();s&&delete d.forceReset,yield this.initializeClient(V({},l.user),d,new Date().getTime(),!0,"internal-autoLogin")}catch(a){this.loggingService.catch("Error in autoLoginPortableSession: ",a)}finally{this.pendingPortableRestore=null}})}getPortableBackend(){return this.portableBackend$.value}getFirebaseConfig$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getFirebaseConfig","color: green;"),this.firebaseConfig$.asObservable()}getFirebaseConfig(){return this.loggingService.log("%c[WB] Calling FUNCTION: getFirebaseConfig","color: green;"),this.firebaseConfig$.value}setAdvancedQueries(r){this.loggingService.log("%c[WB] Calling FUNCTION: setAdvancedQueries","color: green;");try{r&&typeof r=="object"&&localStorage.setItem(k.LOCAL_STORAGE.VELT_ADVANCED_QUERIES,JSON.stringify(r)),this.advancedQueries$.next(r)}catch(i){this.loggingService.catch("Error in setAdvancedQueries: ",i)}}getAdvancedQueries$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getAdvancedQueries$","color: green;"),this.advancedQueries$.asObservable()}getAdvancedQueries(){return this.loggingService.log("%c[WB] Calling FUNCTION: getAdvancedQueries","color: green;"),this.advancedQueries$.value}getAdvancedQueriesEnabled(r){try{return!this.configService.getConfig()?.advancedQueriesDisabled&&(r||!!this.getAdvancedQueries()?.advancedQueriesEnabled)}catch(i){return this.loggingService.catch("Error in getAdvancedQueriesEnabled: ",i),!1}}signOutPreviousUser(){return this.signOutPreviousUser$.asObservable()}getUser(){return this.loggingService.log("%c[WB] Calling FUNCTION: getUser","color: green;"),this.afAuth?.currentUser||this.portableAuthUser$.value?this.user$.value:null}getProvidedOrCurrentUserId(){try{return this.providedUser?.userId??this.user$.value?.userId??void 0}catch(r){this.loggingService.catch("Error in getProvidedOrCurrentUserId: ",r);return}}scheduleLoggedInUserResolveRetry(r,i){return y(this,null,function*(){try{if(!r||this.loggedInUserResolveRetryInFlightUserId===r)return;this.loggedInUserResolveRetryInFlightUserId=r;let o=this.loggedInUserResolveRetryDelaysMs;for(let s=0;s<o.length;s++){if(yield new Promise(l=>setTimeout(l,o[s])),(this.providedUser?.userId??this.user$.value?.userId)!==r)return;let a=yield this.usersService?.resolveUsers({userIds:[r],organizationId:i,skipUserCheck:!0,forceResolve:!0,moduleName:xT.IDENTIFY});if((this.providedUser?.userId??this.user$.value?.userId)!==r)return;let c=a?.[r];if(c&&this.applyLateResolvedLoggedInUser(r,c))return}this.loggingService.catch(`User resolver did not return the logged-in user after ${o.length} retry attempts \u2014 comments created by this author will have no resolved profile until the resolver returns them`,{userId:r,organizationId:i,attempts:o.length})}catch(o){this.loggingService.catch("Error in scheduleLoggedInUserResolveRetry: ",o)}finally{this.loggedInUserResolveRetryInFlightUserId===r&&(this.loggedInUserResolveRetryInFlightUserId=null)}})}applyLateResolvedLoggedInUser(r,i){try{let o=this.user$.value;if(!o||o.userId!==r)return!1;if(!this.afAuth?.currentUser&&!this.portableAuthUser$.value)return!0;let s=Wre(o,i);return this.setUserToStorage(s),this.user$.next(s),!0}catch(o){return this.loggingService.catch("Error in applyLateResolvedLoggedInUser: ",o),!1}}combinedAuthBearer$(){let r=!1;return sc([_d(this.afAuth).pipe(rn(gb)),this.portableAuthUser$]).pipe(_n(([i,o])=>(o!==null&&(r=!0),!!(i!==gb||o!==null||r))),De(([i,o])=>(i===gb?null:i)??o))}getUser$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getUser$","color: green;"),this.combinedAuthBearer$().pipe(Zn(r=>r?this.user$.asObservable():st(null)),ai(gp))}getAuthUser(){return this.loggingService.log("%c[WB] Calling FUNCTION: getAuthUser","color: green;"),this.afAuth?.currentUser}getAuthState$(){return this.combinedAuthBearer$()}getIdTokenResultForUser(r,i){return xp(r,i)}getUserOptions(){return this.loggingService.log("%c[WB] Calling FUNCTION: getUserOptions","color: green;"),this.userOptions$.value}getUserOptions$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getUserOptions$","color: green;"),this.userOptions$.asObservable()}updateUser(r){this.loggingService.log("%c[WB] Calling FUNCTION: updateUser","color: green;");try{let i=this.user$.value;if(r.userId&&r.userId!==i?.userId||r?.groupId&&r?.groupId!==i?.groupId||r?.organizationId&&r?.organizationId!==i?.organizationId)this.providedUser=r,this.initializeClient(r,this.userOptions$?.value||{},new Date().getTime(),void 0,"internal-updateUser");else if(this.providedUser=V(V({},this.providedUser),r),i){let o=V(V({},i),r);this.updateUserInternally(o)}}catch(i){this.loggingService.catch("Error in updateUser: ",i)}}signInWithCustomToken(r,i,o="manual"){this.loggingService.log("%c[WB] Calling FUNCTION: signInWithCustomToken","color: green;");try{return KG(this.afAuth,i).then(s=>(this.analyticsService.trackEvent(St.Events.Core.SDK_USER_AUTH_SUCCESS,{apiKey:this.apiKey,clientUserId:r.userId,snippylyUserId:r.userSnippylyId,authType:o,forceReset:this.userOptions$.value?.forceReset,user:this.getUserForTelemetry(r)}),s)).catch(s=>(this.analyticsService.trackEvent(St.Events.Core.SDK_USER_AUTH_FAILED,{apiKey:this.apiKey,clientUserId:r.userId,snippylyUserId:r.userSnippylyId,authType:o,forceReset:this.userOptions$.value?.forceReset,message:s.message,user:this.getUserForTelemetry(r)}),s))}catch(s){return this.loggingService.catch("Error in signInWithCustomToken: ",s),Promise.reject(s)}}clearCache(){this.loggingService.log("%c[WB] Calling FUNCTION: clearCache","color: green;");try{this.activityService?.resetActivityFeatureConfig()}catch(r){this.loggingService.catch("Error in clearCache: ",r)}}resetServicesCache(){this.loggingService.log("%c[WB] Calling FUNCTION: resetServicesCache in AuthService","color: green;");try{this.crdtService?.flushAllEditorActivities(),this.clearCache(),this.commonDbService?.unsubscribeFromObservables(),this.activityService?.destroy(),this.docService?.clearCacheOnUserCascade(),this.contactService?.clearCache(),this.iamService?.clearCache(),this.areaService?.clearCache(),this.commentService?.clearCache(),this.reactionService?.clearCache(),this.serviceBook.get(DT)?.clearCache(),this.viewsService?.clearCache()}catch(r){this.loggingService.catch("Error in resetServicesCache: ",r)}}initializeSignedInUser(r,i,o){this.loggingService.log("%c[WB] Calling FUNCTION: initializeSignedInUser","color: green;");try{let s=new so;s.userSnippylyId=r.uid,s.type="signedIn",o&&(s=V(V({},s),o)),this.setUserToStorage(s),this.mergeUserWithProvidedUserData(s,i)}catch(s){this.loggingService.catch("Error in initializeSignedInUser: ",s)}}resolveSignedInUserWithProvider(r,i){return y(this,null,function*(){{let o=$c(),s=xT.IDENTIFY;this.coreActionsService.triggerAction(gi.USER_RESOLVER,{event:St.Events.Resolver.USER_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:o,methodName:SR.MERGE_USER_WITH_PROVIDED_USER_DATA,moduleName:s,source:"internal",payload:{userIds:[r.userId],organizationId:i}});let a=yield this.usersService?.resolveUsers({userIds:[r.userId],organizationId:i,skipUserCheck:!0,uniqueId:o,moduleName:s});return a&&a[r.userId]?JSON.parse(JSON.stringify(a[r.userId]||{})):(this.scheduleLoggedInUserResolveRetry(r.userId,i),null)}})}mergeUserWithProvidedUserData(r,i){return y(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: mergeUserWithProvidedUserData","color: green;");try{r.userId=this.providedUser?.userId||r.userId;let o=null;if(this.usersService?.externalUserDataProviderAvailable()){let s=this.providedUser?.clientOrganizationId||r.clientOrganizationId;o=yield this.resolveSignedInUserWithProvider(r,s),r=V(V({},r),o||{})}nb(r,{provided:this.providedUser,resolved:o,avatarColor:s=>this.getUserAvatarColor(s),textColor:s=>this.getUserTextColor(s)}),this.updateUserInternally(r)}catch(o){this.loggingService.catch("Error in mergeUserWithProvidedUserData: ",o)}})}updateUserInternally(r){return y(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: updateUserInternally","color: green;");try{let i=Object.assign({},r);delete i.contacts,this.analyticsService.identifyUser(r.userSnippylyId,i,{forceReset:this.userOptions$.value?.forceReset});let o=this.portableBackend$.value,s=this.portableSessionEpoch;!this.getPlanDetailsCalled&&!o&&this.getPlanDetailsFromDb();let a;if(o)a=eb({apiEndpoint:o.apiEndpoint,token:this.portableToken});else{let h=yd(this.functions,dd({url:this.endpointsService.getCloudFunctionUrl("sdkProxy"),apiProxyDomain:this.configService?.getApiProxyDomain()}));a=TB({methodName:"updateUserInternally",data:{type:"getProjectConfig"},getSdkProxy:h,userId:r?.userId??""})}let c=Promise.resolve();o?this.probeIdentifyPermissionWhenPortableReady(r,s,this.portableChunkReady):c=this.buildIdentifyPermissionProbe(r);let[l,d]=yield Promise.allSettled([a,c]);if(o){if(s!==this.portableSessionEpoch){this.loggingService.log("Velt [portable backend]: discarding an updateUser() that a sign-out or a new identify overtook.");return}l.status==="fulfilled"&&l.value&&this.applyProjectConfig(l.value)}else l.status==="fulfilled"?this.applyProjectConfig(l.value?.data):this.loggingService.warn("Failed to fetch project config:",l.reason);this.afAuth.currentUser?(this.user$.next(r),this.updateUserToFirebase(r)):this.portableAuthUser$.value&&this.user$.next(r)}catch(i){this.loggingService.catch("Error in updateUserInternally: ",i)}})}buildIdentifyPermissionProbe(r){if(this.userPermissionService?.isPermissionProviderAvailable()&&r.clientOrganizationId){let i=[{userId:r.userId,resource:{id:r.clientOrganizationId,type:gV.ORGANIZATION,source:kT.IDENTIFY,organizationId:r.clientOrganizationId}}],o=$c();return this.coreActionsService.triggerAction(gi.PERMISSION_PROVIDER,{event:St.Events.PermissionProvider.RESOURCE_ACCESS_REQUEST_FORMED,methodName:kT.IDENTIFY,uniqueId:o,timestamp:new Date().getTime(),source:"internal",payload:{requests:i}}),this.userPermissionService?.onResourceAccessRequired({requests:i,uniqueId:o,userId:r.userId,methodName:kT.IDENTIFY,fromCache:!1})??Promise.resolve()}return Promise.resolve()}probeIdentifyPermissionWhenPortableReady(r,i,o){return y(this,null,function*(){try{if(yield o,i!==this.portableSessionEpoch||this.user$.value?.userId!==r.userId||!fj()||this.commonDbService?.isPortableBackendActive?.()!==!0)return;yield this.buildIdentifyPermissionProbe(r)}catch(s){this.loggingService.catch("Error in probeIdentifyPermissionWhenPortableReady: ",s)}})}updateUserToFirebase(r){this.loggingService.log("%c[WB] Calling FUNCTION: updateUserToFirebase","color: green;");try{let i=JSON.parse(JSON.stringify(r)),o=le(V({},i),{lastUpdated:new Date})}catch(i){this.loggingService.catch("Error in updateUserToFirebase: ",i)}}getPlanDetailsFromDb(){return y(this,null,function*(){try{this.getPlanDetailsCalled=!0;let i=yield yd(this.functions,dd({url:this.endpointsService.getCloudFunctionUrl("getPlanDetails"),apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:1200*1e3})({apiKey:this.configService.getApiKey(),sdkVersion:Wc(),sdkType:this.configService.getSdkType()});return i?.data?.isPlanExpired&&(this.analyticsService.trackEvent(St.Events.Core.SDK_PLAN_EXPIRED),this.configService.getSF()||console.warn("Velt SDK plan has expired.")),this.planDetails$.next(i?.data||{planInfo:null,isPlanExpired:!1}),i}catch(r){return this.loggingService.catch("Error in getPlanDetailsFromDb: ",r),this.planDetails$.next({planInfo:null,isPlanExpired:!1}),Promise.resolve(null)}})}isPlanExpired$(){return this.planDetails$.pipe(_n(r=>!!r),De(r=>!!r?.isPlanExpired))}isPlanExpired(){return this.planDetails$.getValue()?.isPlanExpired}addPreSignOutFuction(r,i){try{this.preSignOutFunctions.set(r,i)}catch(o){this.loggingService.catch("Error in addPreSignOutFuction: ",o)}}setUserOrganization(r){try{this.loggingService.log("%c[WB] Calling FUNCTION: setUserOrganization","color: green;");let i=JSON.parse(JSON.stringify(this.userOrganization$.value||{}));this.getUser()?.organizationId===r?.organizationId?(i.metadata=r,this.userOrganization$.next(i)):this.userOrganization$.next(null)}catch(i){this.loggingService.catch("Error in setUserOrganization: ",i)}}setOrganizationUserGroups(r){try{this.loggingService.log("%c[WB] Calling FUNCTION: setUserOrganizationGroups","color: green;");let i=JSON.parse(JSON.stringify(this.userOrganization$.value||{}));this.getUser()?.organizationId===i?.metadata?.organizationId&&(i.groups=r,this.userOrganization$.next(i))}catch(i){this.loggingService.catch("Error in setUserOrganizationGroups: ",i)}}getUserOrganization$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getUserOrganization$","color: green;"),this.getUser$().pipe(Zn(r=>r?this.userOrganization$.asObservable().pipe(De(i=>i?.metadata?.organizationId===r.organizationId?i:null)):st(null)))}signOutUser(r="internal"){return y(this,null,function*(){try{this.userPermissionService?.invalidateAllPermissionsState(),this.portableSessionEpoch++,this.portableSignOutOwnsEpochBump=!0,this.pendingPortableRestore=null,this.cancelPortableLicenseRetry(),this.portableResumeUserId=null,this.portableSessionIdentity=null,(this.portableAutoLoginCalled||this.configService?.getEnablePortableBackend()===!0)&&(this.clearPersistedPortableSession(),this.recordPortableSignOut(),this.clearPortableTokenRefresh()),r==="external"&&(this.onRetrySubscription?.unsubscribe(),this.authProviderListenerGeneration++),this.userPermissionService?.revokeAccessOnUserLogout(),this.analyticsService.trackEvent(St.Events.Core.SDK_USER_SIGN_OUT,{apiKey:this.apiKey,clientUserId:this.user$?.value?.userId,snippylyUserId:this.user$?.value?.userSnippylyId,message:r==="external"?"User Sign out":"System Sign out",user:this.user$?.value?this.getUserForTelemetry(this.user$?.value):null,forceReset:this.userOptions$.value?.forceReset,source:r});let i=yield _d(this.afAuth).pipe(Tn(1)).toPromise().catch(o=>null);if(i){this.releaseLiveUserSession("clear");for(let[o,s]of this.preSignOutFunctions)try{yield s(i)}catch(a){this.loggingService.catch(`Error in signOutUser ${o} function: `,a)}return this.user$.next(null),yield hB(1e3),YG(this.afAuth).catch(o=>{this.loggingService.catch("Error in signOutUser:",o)})}else return(this.portableAuthUser$.value||this.portableBackend$.value)&&this.releaseLiveUserSession("clear"),Promise.resolve()}catch(i){this.loggingService.catch("Error in signOutUser: ",i)}finally{this.portableSignOutOwnsEpochBump=!1}})}isFeatureAllowed(r){return nB(this.config,this.user$.value,r)}getUserWithoutContacts(r){try{if(r){let i=JSON.parse(JSON.stringify(r));return delete i.contacts,i}else return null}catch(i){return this.loggingService.catch("Error in getUserWithoutContacts: ",i),null}}getUserForTelemetry(r){try{let i=this.getUserWithoutContacts(r);return i?this.usersService?.userResolverConfigured?.()?jR(i):i:null}catch(i){return this.loggingService.catch("Error in getUserForTelemetry: ",i),null}}getUserForClient(r){try{return VR(r)}catch(i){return this.loggingService.catch("Error in getUserForClient: ",i),null}}getUserAvatarColor(r){try{return r?this.avatarService.generateUserColor(jc(r)):"#625DF5"}catch{return"#625DF5"}}getUserTextColor(r){try{return"#FFFFFF"}catch{return"#FFFFFF"}}setOptionalPropertiesToUsers(r){try{r.forEach(i=>{try{i?.color||(i.color=this.getUserAvatarColor(i?.userId)),i?.textColor||(i.textColor=this.getUserTextColor(i?.userId)),!i?.initial&&(i?.name||i?.email)&&(i.initial=i.name?.charAt(0).toUpperCase()||i.email?.charAt(0).toUpperCase())}catch{}})}catch{}}};e.PORTABLE_REFRESH_WARN_AFTER_FAILURES=3,e.PORTABLE_DOCUMENT_LIFECYCLE_EVENTS=["visibilitychange","resume"],e.PORTABLE_NO_CREDENTIAL_ENVELOPE={error:"No renewal credential.",code:"no_renewal_credential",message:"the session has no renewal credential for the configured gateway",source:"identify"},e.\u0275fac=function(i){return new(i||e)(q(Zc),q(fo),q(U2),q(V2),q(dj),q(Zo),q(ea),q(Nt),q(wT))},e.\u0275prov=Z({token:e,factory:e.\u0275fac,providedIn:"root"});let t=e;return t})();var gj="@firebase/database",mj="1.0.20";var Iw="";function Kre(t){Iw=t}var Sb=class{constructor(e){this.domStorage_=e,this.prefix_="firebase:"}set(e,n){n==null?this.domStorage_.removeItem(this.prefixedName_(e)):this.domStorage_.setItem(this.prefixedName_(e),xt(n))}get(e){let n=this.domStorage_.getItem(this.prefixedName_(e));return n==null?null:fd(n)}remove(e){this.domStorage_.removeItem(this.prefixedName_(e))}prefixedName_(e){return this.prefix_+e}toString(){return this.domStorage_.toString()}};var Ab=class{constructor(){this.cache_={},this.isInMemoryStorage=!0}set(e,n){n==null?delete this.cache_[e]:this.cache_[e]=n}get(e){return zr(this.cache_,e)?this.cache_[e]:null}remove(e){delete this.cache_[e]}};var Kj=function(t){try{if(typeof window<"u"&&typeof window[t]<"u"){let e=window[t];return e.setItem("firebase:sentinel","cache"),e.removeItem("firebase:sentinel"),new Sb(e)}}catch{}return new Ab},cl=Kj("localStorage"),Cb=Kj("sessionStorage");var Rd=new qr("@firebase/database"),Yj=(function(){let t=1;return function(){return t++}})(),Xj=function(t){let e=GB(t),n=new KT;n.update(e);let r=n.digest();return pd.encodeByteArray(r)},fg=function(...t){let e="";for(let n=0;n<t.length;n++){let r=t[n];Array.isArray(r)||r&&typeof r=="object"&&typeof r.length=="number"?e+=fg.apply(null,r):typeof r=="object"?e+=xt(r):e+=r,e+=" "}return e},ll=null,Ej=!0,Yre=function(t,e){Y(!e||t===!0||t===!1,"Can't turn on custom loggers persistently."),t===!0?(Rd.logLevel=be.VERBOSE,ll=Rd.log.bind(Rd),e&&Cb.set("logging_enabled",!0)):typeof t=="function"?ll=t:(ll=null,Cb.remove("logging_enabled"))},un=function(...t){if(Ej===!0&&(Ej=!1,ll===null&&Cb.get("logging_enabled")===!0&&Yre(!0)),ll){let e=fg.apply(null,t);ll(e)}},pg=function(t){return function(...e){un(t,...e)}},Db=function(...t){let e="FIREBASE INTERNAL ERROR: "+fg(...t);Rd.error(e)},rs=function(...t){let e=`FIREBASE FATAL ERROR: ${fg(...t)}`;throw Rd.error(e),new Error(e)},Un=function(...t){let e="FIREBASE WARNING: "+fg(...t);Rd.warn(e)},Xre=function(){typeof window<"u"&&window.location&&window.location.protocol&&window.location.protocol.indexOf("https:")!==-1&&Un("Insecure Firebase access from a secure page. Please use https in calls to new Firebase().")},oI=function(t){return typeof t=="number"&&(t!==t||t===Number.POSITIVE_INFINITY||t===Number.NEGATIVE_INFINITY)},Qre=function(t){if(co()||document.readyState==="complete")t();else{let e=!1,n=function(){if(!document.body){setTimeout(n,Math.floor(10));return}e||(e=!0,t())};document.addEventListener?(document.addEventListener("DOMContentLoaded",n,!1),window.addEventListener("load",n,!1)):document.attachEvent&&(document.attachEvent("onreadystatechange",()=>{document.readyState==="complete"&&n()}),window.attachEvent("onload",n))}},dl="[MIN_NAME]",aa="[MAX_NAME]",El=function(t,e){if(t===e)return 0;if(t===dl||e===aa)return-1;if(e===dl||t===aa)return 1;{let n=_j(t),r=_j(e);return n!==null?r!==null?n-r===0?t.length-e.length:n-r:-1:r!==null?1:t<e?-1:1}},Jre=function(t,e){return t===e?0:t<e?-1:1},zp=function(t,e){if(e&&t in e)return e[t];throw new Error("Missing required key ("+t+") in object: "+xt(e))},vw=function(t){if(typeof t!="object"||t===null)return xt(t);let e=[];for(let r in t)e.push(r);e.sort();let n="{";for(let r=0;r<e.length;r++)r!==0&&(n+=","),n+=xt(e[r]),n+=":",n+=vw(t[e[r]]);return n+="}",n},Qj=function(t,e){let n=t.length;if(n<=e)return[t];let r=[];for(let i=0;i<n;i+=e)i+e>n?r.push(t.substring(i,n)):r.push(t.substring(i,i+e));return r};function dn(t,e){for(let n in t)t.hasOwnProperty(n)&&e(n,t[n])}var Jj=function(t){Y(!oI(t),"Invalid JSON number");let e=11,n=52,r=(1<<e-1)-1,i,o,s,a,c;t===0?(o=0,s=0,i=1/t===-1/0?1:0):(i=t<0,t=Math.abs(t),t>=Math.pow(2,1-r)?(a=Math.min(Math.floor(Math.log(t)/Math.LN2),r),o=a+r,s=Math.round(t*Math.pow(2,n-a)-Math.pow(2,n))):(o=0,s=Math.round(t/Math.pow(2,1-r-n))));let l=[];for(c=n;c;c-=1)l.push(s%2?1:0),s=Math.floor(s/2);for(c=e;c;c-=1)l.push(o%2?1:0),o=Math.floor(o/2);l.push(i?1:0),l.reverse();let d=l.join(""),h="";for(c=0;c<64;c+=8){let f=parseInt(d.substr(c,8),2).toString(16);f.length===1&&(f="0"+f),h=h+f}return h.toLowerCase()},Zre=function(){return!!(typeof window=="object"&&window.chrome&&window.chrome.extension&&!/^chrome/.test(window.location.href))},eie=function(){return typeof Windows=="object"&&typeof Windows.UI=="object"};function tie(t,e){let n="Unknown Error";t==="too_big"?n="The data requested exceeds the maximum size that can be accessed with a single request.":t==="permission_denied"?n="Client doesn't have permission to access the desired data.":t==="unavailable"&&(n="The service is unavailable");let r=new Error(t+" at "+e._path.toString()+": "+n);return r.code=t.toUpperCase(),r}var nie=new RegExp("^-?(0*)\\d{1,10}$"),rie=-2147483648,iie=2147483647,_j=function(t){if(nie.test(t)){let e=Number(t);if(e>=rie&&e<=iie)return e}return null},kd=function(t){try{t()}catch(e){setTimeout(()=>{let n=e.stack||"";throw Un("Exception was thrown by user callback.",n),e},Math.floor(0))}},oie=function(){return(typeof window=="object"&&window.navigator&&window.navigator.userAgent||"").search(/googlebot|google webmaster tools|bingbot|yahoo! slurp|baiduspider|yandexbot|duckduckbot/i)>=0},Xp=function(t,e){let n=setTimeout(t,e);return typeof n=="number"&&typeof Deno<"u"&&Deno.unrefTimer?Deno.unrefTimer(n):typeof n=="object"&&n.unref&&n.unref(),n};var Rb=class{constructor(e,n){this.appCheckProvider=n,this.appName=e.name,rr(e)&&e.settings.appCheckToken&&(this.serverAppAppCheckToken=e.settings.appCheckToken),this.appCheck=n?.getImmediate({optional:!0}),this.appCheck||n?.get().then(r=>this.appCheck=r)}getToken(e){if(this.serverAppAppCheckToken){if(e)throw new Error("Attempted reuse of `FirebaseServerApp.appCheckToken` after previous usage failed.");return Promise.resolve({token:this.serverAppAppCheckToken})}return this.appCheck?this.appCheck.getToken(e):new Promise((n,r)=>{setTimeout(()=>{this.appCheck?this.getToken(e).then(n,r):n(null)},0)})}addTokenChangeListener(e){var n;(n=this.appCheckProvider)===null||n===void 0||n.get().then(r=>r.addTokenListener(e))}notifyForInvalidToken(){Un(`Provided AppCheck credentials for the app named "${this.appName}" are invalid. This usually indicates your app was not initialized correctly.`)}};var Nb=class{constructor(e,n,r){this.appName_=e,this.firebaseOptions_=n,this.authProvider_=r,this.auth_=null,this.auth_=r.getImmediate({optional:!0}),this.auth_||r.onInit(i=>this.auth_=i)}getToken(e){return this.auth_?this.auth_.getToken(e).catch(n=>n&&n.code==="auth/token-not-initialized"?(un("Got auth/token-not-initialized error. Treating as null token."),null):Promise.reject(n)):new Promise((n,r)=>{setTimeout(()=>{this.auth_?this.getToken(e).then(n,r):n(null)},0)})}addTokenChangeListener(e){this.auth_?this.auth_.addAuthTokenListener(e):this.authProvider_.get().then(n=>n.addAuthTokenListener(e))}removeTokenChangeListener(e){this.authProvider_.get().then(n=>n.removeAuthTokenListener(e))}notifyForInvalidToken(){let e='Provided authentication credentials for the app named "'+this.appName_+'" are invalid. This usually indicates your app was not initialized correctly. ';"credential"in this.firebaseOptions_?e+='Make sure the "credential" property provided to initializeApp() is authorized to access the specified "databaseURL" and is from the correct project.':"serviceAccount"in this.firebaseOptions_?e+='Make sure the "serviceAccount" property provided to initializeApp() is authorized to access the specified "databaseURL" and is from the correct project.':e+='Make sure the "apiKey" and "databaseURL" properties provided to initializeApp() match the values provided for your app at https://console.firebase.google.com/.',Un(e)}},Qp=(()=>{class t{constructor(n){this.accessToken=n}getToken(n){return Promise.resolve({accessToken:this.accessToken})}addTokenChangeListener(n){n(this.accessToken)}removeTokenChangeListener(n){}notifyForInvalidToken(){}}t.OWNER="owner";return t})(),Py="5",Zj="v",eH="s",tH="r",nH="f",rH=/(console\.firebase|firebase-console-\w+\.corp|firebase\.corp)\.google\.com/,iH="ls",oH="p",bb="ac",sH="websocket",aH="long_polling";var xy=class{constructor(e,n,r,i,o=!1,s="",a=!1,c=!1,l=null){this.secure=n,this.namespace=r,this.webSocketOnly=i,this.nodeAdmin=o,this.persistenceKey=s,this.includeNamespaceInQueryParams=a,this.isUsingEmulator=c,this.emulatorOptions=l,this._host=e.toLowerCase(),this._domain=this._host.substr(this._host.indexOf(".")+1),this.internalHost=cl.get("host:"+e)||this._host}isCacheableHost(){return this.internalHost.substr(0,2)==="s-"}isCustomHost(){return this._domain!=="firebaseio.com"&&this._domain!=="firebaseio-demo.com"}get host(){return this._host}set host(e){e!==this.internalHost&&(this.internalHost=e,this.isCacheableHost()&&cl.set("host:"+this._host,this.internalHost))}toString(){let e=this.toURLString();return this.persistenceKey&&(e+="<"+this.persistenceKey+">"),e}toURLString(){let e=this.secure?"https://":"http://",n=this.includeNamespaceInQueryParams?`?ns=${this.namespace}`:"";return`${e}${this.host}/${n}`}};function sie(t){return t.host!==t.internalHost||t.isCustomHost()||t.includeNamespaceInQueryParams}function cH(t,e,n){Y(typeof e=="string","typeof type must == string"),Y(typeof n=="object","typeof params must == object");let r;if(e===sH)r=(t.secure?"wss://":"ws://")+t.internalHost+"/.ws?";else if(e===aH)r=(t.secure?"https://":"http://")+t.internalHost+"/.lp?";else throw new Error("Unknown connection type: "+e);sie(t)&&(n.ns=t.namespace);let i=[];return dn(n,(o,s)=>{i.push(o+"="+s)}),r+i.join("&")}var wb=class{constructor(){this.counters_={}}incrementCounter(e,n=1){zr(this.counters_,e)||(this.counters_[e]=0),this.counters_[e]+=n}get(){return NB(this.counters_)}};var mb={},Eb={};function Sw(t){let e=t.toString();return mb[e]||(mb[e]=new wb),mb[e]}function aie(t,e){let n=t.toString();return Eb[n]||(Eb[n]=e()),Eb[n]}var Ob=class{constructor(e){this.onMessage_=e,this.pendingResponses=[],this.currentResponseNum=0,this.closeAfterResponse=-1,this.onClose=null}closeAfter(e,n){this.closeAfterResponse=e,this.onClose=n,this.closeAfterResponse<this.currentResponseNum&&(this.onClose(),this.onClose=null)}handleResponse(e,n){for(this.pendingResponses[e]=n;this.pendingResponses[this.currentResponseNum];){let r=this.pendingResponses[this.currentResponseNum];delete this.pendingResponses[this.currentResponseNum];for(let i=0;i<r.length;++i)r[i]&&kd(()=>{this.onMessage_(r[i])});if(this.currentResponseNum===this.closeAfterResponse){this.onClose&&(this.onClose(),this.onClose=null);break}this.currentResponseNum++}}};var Tj="start",cie="close",lie="pLPCommand",uie="pRTLPCB",lH="id",uH="pw",dH="ser",die="cb",hie="seg",fie="ts",pie="d",gie="dframe",hH=1870,fH=30,mie=hH-fH,Eie=25e3,_ie=3e4,ky=class t{constructor(e,n,r,i,o,s,a){this.connId=e,this.repoInfo=n,this.applicationId=r,this.appCheckToken=i,this.authToken=o,this.transportSessionId=s,this.lastSessionId=a,this.bytesSent=0,this.bytesReceived=0,this.everConnected_=!1,this.log_=pg(e),this.stats_=Sw(n),this.urlFn=c=>(this.appCheckToken&&(c[bb]=this.appCheckToken),cH(n,aH,c))}open(e,n){this.curSegmentNum=0,this.onDisconnect_=n,this.myPacketOrderer=new Ob(e),this.isClosed_=!1,this.connectTimeoutTimer_=setTimeout(()=>{this.log_("Timed out trying to connect."),this.onClosed_(),this.connectTimeoutTimer_=null},Math.floor(_ie)),Qre(()=>{if(this.isClosed_)return;this.scriptTagHolder=new Lb((...o)=>{let[s,a,c,l,d]=o;if(this.incrementIncomingBytes_(o),!!this.scriptTagHolder)if(this.connectTimeoutTimer_&&(clearTimeout(this.connectTimeoutTimer_),this.connectTimeoutTimer_=null),this.everConnected_=!0,s===Tj)this.id=a,this.password=c;else if(s===cie)a?(this.scriptTagHolder.sendNewPolls=!1,this.myPacketOrderer.closeAfter(a,()=>{this.onClosed_()})):this.onClosed_();else throw new Error("Unrecognized command received: "+s)},(...o)=>{let[s,a]=o;this.incrementIncomingBytes_(o),this.myPacketOrderer.handleResponse(s,a)},()=>{this.onClosed_()},this.urlFn);let r={};r[Tj]="t",r[dH]=Math.floor(Math.random()*1e8),this.scriptTagHolder.uniqueCallbackIdentifier&&(r[die]=this.scriptTagHolder.uniqueCallbackIdentifier),r[Zj]=Py,this.transportSessionId&&(r[eH]=this.transportSessionId),this.lastSessionId&&(r[iH]=this.lastSessionId),this.applicationId&&(r[oH]=this.applicationId),this.appCheckToken&&(r[bb]=this.appCheckToken),typeof location<"u"&&location.hostname&&rH.test(location.hostname)&&(r[tH]=nH);let i=this.urlFn(r);this.log_("Connecting via long-poll to "+i),this.scriptTagHolder.addTag(i,()=>{})})}start(){this.scriptTagHolder.startLongPoll(this.id,this.password),this.addDisconnectPingFrame(this.id,this.password)}static forceAllow(){t.forceAllow_=!0}static forceDisallow(){t.forceDisallow_=!0}static isAvailable(){return co()?!1:t.forceAllow_?!0:!t.forceDisallow_&&typeof document<"u"&&document.createElement!=null&&!Zre()&&!eie()}markConnectionHealthy(){}shutdown_(){this.isClosed_=!0,this.scriptTagHolder&&(this.scriptTagHolder.close(),this.scriptTagHolder=null),this.myDisconnFrame&&(document.body.removeChild(this.myDisconnFrame),this.myDisconnFrame=null),this.connectTimeoutTimer_&&(clearTimeout(this.connectTimeoutTimer_),this.connectTimeoutTimer_=null)}onClosed_(){this.isClosed_||(this.log_("Longpoll is closing itself"),this.shutdown_(),this.onDisconnect_&&(this.onDisconnect_(this.everConnected_),this.onDisconnect_=null))}close(){this.isClosed_||(this.log_("Longpoll is being closed."),this.shutdown_())}send(e){let n=xt(e);this.bytesSent+=n.length,this.stats_.incrementCounter("bytes_sent",n.length);let r=KR(n),i=Qj(r,mie);for(let o=0;o<i.length;o++)this.scriptTagHolder.enqueueSegment(this.curSegmentNum,i.length,i[o]),this.curSegmentNum++}addDisconnectPingFrame(e,n){if(co())return;this.myDisconnFrame=document.createElement("iframe");let r={};r[gie]="t",r[lH]=e,r[uH]=n,this.myDisconnFrame.src=this.urlFn(r),this.myDisconnFrame.style.display="none",document.body.appendChild(this.myDisconnFrame)}incrementIncomingBytes_(e){let n=xt(e).length;this.bytesReceived+=n,this.stats_.incrementCounter("bytes_received",n)}},Lb=class t{constructor(e,n,r,i){if(this.onDisconnect=r,this.urlFn=i,this.outstandingRequests=new Set,this.pendingSegs=[],this.currentSerial=Math.floor(Math.random()*1e8),this.sendNewPolls=!0,co())this.commandCB=e,this.onMessageCB=n;else{this.uniqueCallbackIdentifier=Yj(),window[lie+this.uniqueCallbackIdentifier]=e,window[uie+this.uniqueCallbackIdentifier]=n,this.myIFrame=t.createIFrame_();let o="";this.myIFrame.src&&this.myIFrame.src.substr(0,11)==="javascript:"&&(o='<script>document.domain="'+document.domain+'";<\/script>');let s="<html><body>"+o+"</body></html>";try{this.myIFrame.doc.open(),this.myIFrame.doc.write(s),this.myIFrame.doc.close()}catch(a){un("frame writing exception"),a.stack&&un(a.stack),un(a)}}}static createIFrame_(){let e=document.createElement("iframe");if(e.style.display="none",document.body){document.body.appendChild(e);try{e.contentWindow.document||un("No IE domain setting required")}catch{let r=document.domain;e.src="javascript:void((function(){document.open();document.domain='"+r+"';document.close();})())"}}else throw"Document body has not initialized. Wait to initialize Firebase until after the document is ready.";return e.contentDocument?e.doc=e.contentDocument:e.contentWindow?e.doc=e.contentWindow.document:e.document&&(e.doc=e.document),e}close(){this.alive=!1,this.myIFrame&&(this.myIFrame.doc.body.textContent="",setTimeout(()=>{this.myIFrame!==null&&(document.body.removeChild(this.myIFrame),this.myIFrame=null)},Math.floor(0)));let e=this.onDisconnect;e&&(this.onDisconnect=null,e())}startLongPoll(e,n){for(this.myID=e,this.myPW=n,this.alive=!0;this.newRequest_(););}newRequest_(){if(this.alive&&this.sendNewPolls&&this.outstandingRequests.size<(this.pendingSegs.length>0?2:1)){this.currentSerial++;let e={};e[lH]=this.myID,e[uH]=this.myPW,e[dH]=this.currentSerial;let n=this.urlFn(e),r="",i=0;for(;this.pendingSegs.length>0&&this.pendingSegs[0].d.length+fH+r.length<=hH;){let s=this.pendingSegs.shift();r=r+"&"+hie+i+"="+s.seg+"&"+fie+i+"="+s.ts+"&"+pie+i+"="+s.d,i++}return n=n+r,this.addLongPollTag_(n,this.currentSerial),!0}else return!1}enqueueSegment(e,n,r){this.pendingSegs.push({seg:e,ts:n,d:r}),this.alive&&this.newRequest_()}addLongPollTag_(e,n){this.outstandingRequests.add(n);let r=()=>{this.outstandingRequests.delete(n),this.newRequest_()},i=setTimeout(r,Math.floor(Eie)),o=()=>{clearTimeout(i),r()};this.addTag(e,o)}addTag(e,n){co()?this.doNodeLongPoll(e,n):setTimeout(()=>{try{if(!this.sendNewPolls)return;let r=this.myIFrame.doc.createElement("script");r.type="text/javascript",r.async=!0,r.src=e,r.onload=r.onreadystatechange=function(){let i=r.readyState;(!i||i==="loaded"||i==="complete")&&(r.onload=r.onreadystatechange=null,r.parentNode&&r.parentNode.removeChild(r),n())},r.onerror=()=>{un("Long-poll script failed to load: "+e),this.sendNewPolls=!1,this.close()},this.myIFrame.doc.body.appendChild(r)}catch{}},Math.floor(1))}};var Tie=16384,yie=45e3,Fy=null;typeof MozWebSocket<"u"?Fy=MozWebSocket:typeof WebSocket<"u"&&(Fy=WebSocket);var Cd=(()=>{class t{constructor(n,r,i,o,s,a,c){this.connId=n,this.applicationId=i,this.appCheckToken=o,this.authToken=s,this.keepaliveTimer=null,this.frames=null,this.totalFrames=0,this.bytesSent=0,this.bytesReceived=0,this.log_=pg(this.connId),this.stats_=Sw(r),this.connURL=t.connectionURL_(r,a,c,o,i),this.nodeAdmin=r.nodeAdmin}static connectionURL_(n,r,i,o,s){let a={};return a[Zj]=Py,!co()&&typeof location<"u"&&location.hostname&&rH.test(location.hostname)&&(a[tH]=nH),r&&(a[eH]=r),i&&(a[iH]=i),o&&(a[bb]=o),s&&(a[oH]=s),cH(n,sH,a)}open(n,r){this.onDisconnect=r,this.onMessage=n,this.log_("Websocket connecting to "+this.connURL),this.everConnected_=!1,cl.set("previous_websocket_failure",!0);try{let i;if(co()){let o=this.nodeAdmin?"AdminNode":"Node";i={headers:{"User-Agent":`Firebase/${Py}/${Iw}/${process.platform}/${o}`,"X-Firebase-GMPID":this.applicationId||""}},this.authToken&&(i.headers.Authorization=`Bearer ${this.authToken}`),this.appCheckToken&&(i.headers["X-Firebase-AppCheck"]=this.appCheckToken);let s=process.env,a=this.connURL.indexOf("wss://")===0?s.HTTPS_PROXY||s.https_proxy:s.HTTP_PROXY||s.http_proxy;a&&(i.proxy={origin:a})}this.mySock=new Fy(this.connURL,[],i)}catch(i){this.log_("Error instantiating WebSocket.");let o=i.message||i.data;o&&this.log_(o),this.onClosed_();return}this.mySock.onopen=()=>{this.log_("Websocket connected."),this.everConnected_=!0},this.mySock.onclose=()=>{this.log_("Websocket connection was disconnected."),this.mySock=null,this.onClosed_()},this.mySock.onmessage=i=>{this.handleIncomingFrame(i)},this.mySock.onerror=i=>{this.log_("WebSocket error. Closing connection.");let o=i.message||i.data;o&&this.log_(o),this.onClosed_()}}start(){}static forceDisallow(){t.forceDisallow_=!0}static isAvailable(){let n=!1;if(typeof navigator<"u"&&navigator.userAgent){let r=/Android ([0-9]{0,}\.[0-9]{0,})/,i=navigator.userAgent.match(r);i&&i.length>1&&parseFloat(i[1])<4.4&&(n=!0)}return!n&&Fy!==null&&!t.forceDisallow_}static previouslyFailed(){return cl.isInMemoryStorage||cl.get("previous_websocket_failure")===!0}markConnectionHealthy(){cl.remove("previous_websocket_failure")}appendFrame_(n){if(this.frames.push(n),this.frames.length===this.totalFrames){let r=this.frames.join("");this.frames=null;let i=fd(r);this.onMessage(i)}}handleNewFrameCount_(n){this.totalFrames=n,this.frames=[]}extractFrameCount_(n){if(Y(this.frames===null,"We already have a frame buffer"),n.length<=6){let r=Number(n);if(!isNaN(r))return this.handleNewFrameCount_(r),null}return this.handleNewFrameCount_(1),n}handleIncomingFrame(n){if(this.mySock===null)return;let r=n.data;if(this.bytesReceived+=r.length,this.stats_.incrementCounter("bytes_received",r.length),this.resetKeepAlive(),this.frames!==null)this.appendFrame_(r);else{let i=this.extractFrameCount_(r);i!==null&&this.appendFrame_(i)}}send(n){this.resetKeepAlive();let r=xt(n);this.bytesSent+=r.length,this.stats_.incrementCounter("bytes_sent",r.length);let i=Qj(r,Tie);i.length>1&&this.sendString_(String(i.length));for(let o=0;o<i.length;o++)this.sendString_(i[o])}shutdown_(){this.isClosed_=!0,this.keepaliveTimer&&(clearInterval(this.keepaliveTimer),this.keepaliveTimer=null),this.mySock&&(this.mySock.close(),this.mySock=null)}onClosed_(){this.isClosed_||(this.log_("WebSocket is closing itself"),this.shutdown_(),this.onDisconnect&&(this.onDisconnect(this.everConnected_),this.onDisconnect=null))}close(){this.isClosed_||(this.log_("WebSocket is being closed"),this.shutdown_())}resetKeepAlive(){clearInterval(this.keepaliveTimer),this.keepaliveTimer=setInterval(()=>{this.mySock&&this.sendString_("0"),this.resetKeepAlive()},Math.floor(yie))}sendString_(n){try{this.mySock.send(n)}catch(r){this.log_("Exception thrown from WebSocket.send():",r.message||r.data,"Closing connection."),setTimeout(this.onClosed_.bind(this),0)}}}t.responsesRequiredToBeHealthy=2,t.healthyTimeout=3e4;return t})(),pH=(()=>{class t{static get ALL_TRANSPORTS(){return[ky,Cd]}static get IS_TRANSPORT_INITIALIZED(){return this.globalTransportInitialized_}constructor(n){this.initTransports_(n)}initTransports_(n){let r=Cd&&Cd.isAvailable(),i=r&&!Cd.previouslyFailed();if(n.webSocketOnly&&(r||Un("wss:// URL used, but browser isn't known to support websockets. Trying anyway."),i=!0),i)this.transports_=[Cd];else{let o=this.transports_=[];for(let s of t.ALL_TRANSPORTS)s&&s.isAvailable()&&o.push(s);t.globalTransportInitialized_=!0}}initialTransport(){if(this.transports_.length>0)return this.transports_[0];throw new Error("No transports available")}upgradeTransport(){return this.transports_.length>1?this.transports_[1]:null}}t.globalTransportInitialized_=!1;return t})(),Iie=6e4,vie=5e3,Sie=10*1024,Aie=100*1024,_b="t",yj="d",Cie="s",Ij="r",Die="e",vj="o",Sj="a",Aj="n",Cj="p",Rie="h",Mb=class{constructor(e,n,r,i,o,s,a,c,l,d){this.id=e,this.repoInfo_=n,this.applicationId_=r,this.appCheckToken_=i,this.authToken_=o,this.onMessage_=s,this.onReady_=a,this.onDisconnect_=c,this.onKill_=l,this.lastSessionId=d,this.connectionCount=0,this.pendingDataMessages=[],this.state_=0,this.log_=pg("c:"+this.id+":"),this.transportManager_=new pH(n),this.log_("Connection created"),this.start_()}start_(){let e=this.transportManager_.initialTransport();this.conn_=new e(this.nextTransportId_(),this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,null,this.lastSessionId),this.primaryResponsesRequired_=e.responsesRequiredToBeHealthy||0;let n=this.connReceiver_(this.conn_),r=this.disconnReceiver_(this.conn_);this.tx_=this.conn_,this.rx_=this.conn_,this.secondaryConn_=null,this.isHealthy_=!1,setTimeout(()=>{this.conn_&&this.conn_.open(n,r)},Math.floor(0));let i=e.healthyTimeout||0;i>0&&(this.healthyTimeout_=Xp(()=>{this.healthyTimeout_=null,this.isHealthy_||(this.conn_&&this.conn_.bytesReceived>Aie?(this.log_("Connection exceeded healthy timeout but has received "+this.conn_.bytesReceived+" bytes. Marking connection healthy."),this.isHealthy_=!0,this.conn_.markConnectionHealthy()):this.conn_&&this.conn_.bytesSent>Sie?this.log_("Connection exceeded healthy timeout but has sent "+this.conn_.bytesSent+" bytes. Leaving connection alive."):(this.log_("Closing unhealthy connection after timeout."),this.close()))},Math.floor(i)))}nextTransportId_(){return"c:"+this.id+":"+this.connectionCount++}disconnReceiver_(e){return n=>{e===this.conn_?this.onConnectionLost_(n):e===this.secondaryConn_?(this.log_("Secondary connection lost."),this.onSecondaryConnectionLost_()):this.log_("closing an old connection")}}connReceiver_(e){return n=>{this.state_!==2&&(e===this.rx_?this.onPrimaryMessageReceived_(n):e===this.secondaryConn_?this.onSecondaryMessageReceived_(n):this.log_("message on old connection"))}}sendRequest(e){let n={t:"d",d:e};this.sendData_(n)}tryCleanupConnection(){this.tx_===this.secondaryConn_&&this.rx_===this.secondaryConn_&&(this.log_("cleaning up and promoting a connection: "+this.secondaryConn_.connId),this.conn_=this.secondaryConn_,this.secondaryConn_=null)}onSecondaryControl_(e){if(_b in e){let n=e[_b];n===Sj?this.upgradeIfSecondaryHealthy_():n===Ij?(this.log_("Got a reset on secondary, closing it"),this.secondaryConn_.close(),(this.tx_===this.secondaryConn_||this.rx_===this.secondaryConn_)&&this.close()):n===vj&&(this.log_("got pong on secondary."),this.secondaryResponsesRequired_--,this.upgradeIfSecondaryHealthy_())}}onSecondaryMessageReceived_(e){let n=zp("t",e),r=zp("d",e);if(n==="c")this.onSecondaryControl_(r);else if(n==="d")this.pendingDataMessages.push(r);else throw new Error("Unknown protocol layer: "+n)}upgradeIfSecondaryHealthy_(){this.secondaryResponsesRequired_<=0?(this.log_("Secondary connection is healthy."),this.isHealthy_=!0,this.secondaryConn_.markConnectionHealthy(),this.proceedWithUpgrade_()):(this.log_("sending ping on secondary."),this.secondaryConn_.send({t:"c",d:{t:Cj,d:{}}}))}proceedWithUpgrade_(){this.secondaryConn_.start(),this.log_("sending client ack on secondary"),this.secondaryConn_.send({t:"c",d:{t:Sj,d:{}}}),this.log_("Ending transmission on primary"),this.conn_.send({t:"c",d:{t:Aj,d:{}}}),this.tx_=this.secondaryConn_,this.tryCleanupConnection()}onPrimaryMessageReceived_(e){let n=zp("t",e),r=zp("d",e);n==="c"?this.onControl_(r):n==="d"&&this.onDataMessage_(r)}onDataMessage_(e){this.onPrimaryResponse_(),this.onMessage_(e)}onPrimaryResponse_(){this.isHealthy_||(this.primaryResponsesRequired_--,this.primaryResponsesRequired_<=0&&(this.log_("Primary connection is healthy."),this.isHealthy_=!0,this.conn_.markConnectionHealthy()))}onControl_(e){let n=zp(_b,e);if(yj in e){let r=e[yj];if(n===Rie){let i=Object.assign({},r);this.repoInfo_.isUsingEmulator&&(i.h=this.repoInfo_.host),this.onHandshake_(i)}else if(n===Aj){this.log_("recvd end transmission on primary"),this.rx_=this.secondaryConn_;for(let i=0;i<this.pendingDataMessages.length;++i)this.onDataMessage_(this.pendingDataMessages[i]);this.pendingDataMessages=[],this.tryCleanupConnection()}else n===Cie?this.onConnectionShutdown_(r):n===Ij?this.onReset_(r):n===Die?Db("Server Error: "+r):n===vj?(this.log_("got pong on primary."),this.onPrimaryResponse_(),this.sendPingOnPrimaryIfNecessary_()):Db("Unknown control packet command: "+n)}}onHandshake_(e){let n=e.ts,r=e.v,i=e.h;this.sessionId=e.s,this.repoInfo_.host=i,this.state_===0&&(this.conn_.start(),this.onConnectionEstablished_(this.conn_,n),Py!==r&&Un("Protocol version mismatch detected"),this.tryStartUpgrade_())}tryStartUpgrade_(){let e=this.transportManager_.upgradeTransport();e&&this.startUpgrade_(e)}startUpgrade_(e){this.secondaryConn_=new e(this.nextTransportId_(),this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,this.sessionId),this.secondaryResponsesRequired_=e.responsesRequiredToBeHealthy||0;let n=this.connReceiver_(this.secondaryConn_),r=this.disconnReceiver_(this.secondaryConn_);this.secondaryConn_.open(n,r),Xp(()=>{this.secondaryConn_&&(this.log_("Timed out trying to upgrade."),this.secondaryConn_.close())},Math.floor(Iie))}onReset_(e){this.log_("Reset packet received. New host: "+e),this.repoInfo_.host=e,this.state_===1?this.close():(this.closeConnections_(),this.start_())}onConnectionEstablished_(e,n){this.log_("Realtime connection established."),this.conn_=e,this.state_=1,this.onReady_&&(this.onReady_(n,this.sessionId),this.onReady_=null),this.primaryResponsesRequired_===0?(this.log_("Primary connection is healthy."),this.isHealthy_=!0):Xp(()=>{this.sendPingOnPrimaryIfNecessary_()},Math.floor(vie))}sendPingOnPrimaryIfNecessary_(){!this.isHealthy_&&this.state_===1&&(this.log_("sending ping on primary."),this.sendData_({t:"c",d:{t:Cj,d:{}}}))}onSecondaryConnectionLost_(){let e=this.secondaryConn_;this.secondaryConn_=null,(this.tx_===e||this.rx_===e)&&this.close()}onConnectionLost_(e){this.conn_=null,!e&&this.state_===0?(this.log_("Realtime connection failed."),this.repoInfo_.isCacheableHost()&&(cl.remove("host:"+this.repoInfo_.host),this.repoInfo_.internalHost=this.repoInfo_.host)):this.state_===1&&this.log_("Realtime connection lost."),this.close()}onConnectionShutdown_(e){this.log_("Connection shutdown command received. Shutting down..."),this.onKill_&&(this.onKill_(e),this.onKill_=null),this.onDisconnect_=null,this.close()}sendData_(e){if(this.state_!==1)throw"Connection is not connected";this.tx_.send(e)}close(){this.state_!==2&&(this.log_("Closing realtime connection."),this.state_=2,this.closeConnections_(),this.onDisconnect_&&(this.onDisconnect_(),this.onDisconnect_=null))}closeConnections_(){this.log_("Shutting down all connections"),this.conn_&&(this.conn_.close(),this.conn_=null),this.secondaryConn_&&(this.secondaryConn_.close(),this.secondaryConn_=null),this.healthyTimeout_&&(clearTimeout(this.healthyTimeout_),this.healthyTimeout_=null)}};var Uy=class{put(e,n,r,i){}merge(e,n,r,i){}refreshAuthToken(e){}refreshAppCheckToken(e){}onDisconnectPut(e,n,r){}onDisconnectMerge(e,n,r){}onDisconnectCancel(e,n){}reportStats(e){}};var Vy=class{constructor(e){this.allowedEvents_=e,this.listeners_={},Y(Array.isArray(e)&&e.length>0,"Requires a non-empty array")}trigger(e,...n){if(Array.isArray(this.listeners_[e])){let r=[...this.listeners_[e]];for(let i=0;i<r.length;i++)r[i].callback.apply(r[i].context,n)}}on(e,n,r){this.validateEventType_(e),this.listeners_[e]=this.listeners_[e]||[],this.listeners_[e].push({callback:n,context:r});let i=this.getInitialEvent(e);i&&n.apply(r,i)}off(e,n,r){this.validateEventType_(e);let i=this.listeners_[e]||[];for(let o=0;o<i.length;o++)if(i[o].callback===n&&(!r||r===i[o].context)){i.splice(o,1);return}}validateEventType_(e){Y(this.allowedEvents_.find(n=>n===e),"Unknown event: "+e)}};var By=class t extends Vy{static getInstance(){return new t}constructor(){super(["online"]),this.online_=!0,typeof window<"u"&&typeof window.addEventListener<"u"&&!Tp()&&(window.addEventListener("online",()=>{this.online_||(this.online_=!0,this.trigger("online",!0))},!1),window.addEventListener("offline",()=>{this.online_&&(this.online_=!1,this.trigger("online",!1))},!1))}getInitialEvent(e){return Y(e==="online","Unknown event type: "+e),[this.online_]}currentlyOnline(){return this.online_}};var Dj=32,Rj=768,He=class{constructor(e,n){if(n===void 0){this.pieces_=e.split("/");let r=0;for(let i=0;i<this.pieces_.length;i++)this.pieces_[i].length>0&&(this.pieces_[r]=this.pieces_[i],r++);this.pieces_.length=r,this.pieceNum_=0}else this.pieces_=e,this.pieceNum_=n}toString(){let e="";for(let n=this.pieceNum_;n<this.pieces_.length;n++)this.pieces_[n]!==""&&(e+="/"+this.pieces_[n]);return e||"/"}};function je(){return new He("")}function we(t){return t.pieceNum_>=t.pieces_.length?null:t.pieces_[t.pieceNum_]}function ca(t){return t.pieces_.length-t.pieceNum_}function lt(t){let e=t.pieceNum_;return e<t.pieces_.length&&e++,new He(t.pieces_,e)}function Aw(t){return t.pieceNum_<t.pieces_.length?t.pieces_[t.pieces_.length-1]:null}function Nie(t){let e="";for(let n=t.pieceNum_;n<t.pieces_.length;n++)t.pieces_[n]!==""&&(e+="/"+encodeURIComponent(String(t.pieces_[n])));return e||"/"}function tg(t,e=0){return t.pieces_.slice(t.pieceNum_+e)}function gH(t){if(t.pieceNum_>=t.pieces_.length)return null;let e=[];for(let n=t.pieceNum_;n<t.pieces_.length-1;n++)e.push(t.pieces_[n]);return new He(e,0)}function Ct(t,e){let n=[];for(let r=t.pieceNum_;r<t.pieces_.length;r++)n.push(t.pieces_[r]);if(e instanceof He)for(let r=e.pieceNum_;r<e.pieces_.length;r++)n.push(e.pieces_[r]);else{let r=e.split("/");for(let i=0;i<r.length;i++)r[i].length>0&&n.push(r[i])}return new He(n,0)}function Oe(t){return t.pieceNum_>=t.pieces_.length}function Kn(t,e){let n=we(t),r=we(e);if(n===null)return e;if(n===r)return Kn(lt(t),lt(e));throw new Error("INTERNAL ERROR: innerPath ("+e+") is not within outerPath ("+t+")")}function bie(t,e){let n=tg(t,0),r=tg(e,0);for(let i=0;i<n.length&&i<r.length;i++){let o=El(n[i],r[i]);if(o!==0)return o}return n.length===r.length?0:n.length<r.length?-1:1}function Cw(t,e){if(ca(t)!==ca(e))return!1;for(let n=t.pieceNum_,r=e.pieceNum_;n<=t.pieces_.length;n++,r++)if(t.pieces_[n]!==e.pieces_[r])return!1;return!0}function Yr(t,e){let n=t.pieceNum_,r=e.pieceNum_;if(ca(t)>ca(e))return!1;for(;n<t.pieces_.length;){if(t.pieces_[n]!==e.pieces_[r])return!1;++n,++r}return!0}var Pb=class{constructor(e,n){this.errorPrefix_=n,this.parts_=tg(e,0),this.byteLength_=Math.max(1,this.parts_.length);for(let r=0;r<this.parts_.length;r++)this.byteLength_+=Sp(this.parts_[r]);mH(this)}};function wie(t,e){t.parts_.length>0&&(t.byteLength_+=1),t.parts_.push(e),t.byteLength_+=Sp(e),mH(t)}function Oie(t){let e=t.parts_.pop();t.byteLength_-=Sp(e),t.parts_.length>0&&(t.byteLength_-=1)}function mH(t){if(t.byteLength_>Rj)throw new Error(t.errorPrefix_+"has a key path longer than "+Rj+" bytes ("+t.byteLength_+").");if(t.parts_.length>Dj)throw new Error(t.errorPrefix_+"path specified exceeds the maximum depth that can be written ("+Dj+") or object contains a cycle "+al(t))}function al(t){return t.parts_.length===0?"":"in property '"+t.parts_.join(".")+"'"}var xb=class t extends Vy{static getInstance(){return new t}constructor(){super(["visible"]);let e,n;typeof document<"u"&&typeof document.addEventListener<"u"&&(typeof document.hidden<"u"?(n="visibilitychange",e="hidden"):typeof document.mozHidden<"u"?(n="mozvisibilitychange",e="mozHidden"):typeof document.msHidden<"u"?(n="msvisibilitychange",e="msHidden"):typeof document.webkitHidden<"u"&&(n="webkitvisibilitychange",e="webkitHidden")),this.visible_=!0,n&&document.addEventListener(n,()=>{let r=!document[e];r!==this.visible_&&(this.visible_=r,this.trigger("visible",r))},!1)}getInitialEvent(e){return Y(e==="visible","Unknown event type: "+e),[this.visible_]}};var qp=1e3,Lie=300*1e3,Nj=30*1e3,Mie=1.3,Pie=3e4,xie="server_kill",bj=3,Dw=(()=>{class t extends Uy{constructor(n,r,i,o,s,a,c,l){if(super(),this.repoInfo_=n,this.applicationId_=r,this.onDataUpdate_=i,this.onConnectStatus_=o,this.onServerInfoUpdate_=s,this.authTokenProvider_=a,this.appCheckTokenProvider_=c,this.authOverride_=l,this.id=t.nextPersistentConnectionId_++,this.log_=pg("p:"+this.id+":"),this.interruptReasons_={},this.listens=new Map,this.outstandingPuts_=[],this.outstandingGets_=[],this.outstandingPutCount_=0,this.outstandingGetCount_=0,this.onDisconnectRequestQueue_=[],this.connected_=!1,this.reconnectDelay_=qp,this.maxReconnectDelay_=Lie,this.securityDebugCallback_=null,this.lastSessionId=null,this.establishConnectionTimer_=null,this.visible_=!1,this.requestCBHash_={},this.requestNumber_=0,this.realtime_=null,this.authToken_=null,this.appCheckToken_=null,this.forceTokenRefresh_=!1,this.invalidAuthTokenCount_=0,this.invalidAppCheckTokenCount_=0,this.firstConnection_=!0,this.lastConnectionAttemptTime_=null,this.lastConnectionEstablishedTime_=null,l&&!co())throw new Error("Auth override specified in options, but not supported on non Node.js platforms");xb.getInstance().on("visible",this.onVisible_,this),n.host.indexOf("fblocal")===-1&&By.getInstance().on("online",this.onOnline_,this)}sendRequest(n,r,i){let o=++this.requestNumber_,s={r:o,a:n,b:r};this.log_(xt(s)),Y(this.connected_,"sendRequest call when we're not connected not allowed."),this.realtime_.sendRequest(s),i&&(this.requestCBHash_[o]=i)}get(n){this.initConnection_();let r=new cn,o={action:"g",request:{p:n._path.toString(),q:n._queryObject},onComplete:a=>{let c=a.d;a.s==="ok"?r.resolve(c):r.reject(c)}};this.outstandingGets_.push(o),this.outstandingGetCount_++;let s=this.outstandingGets_.length-1;return this.connected_&&this.sendGet_(s),r.promise}listen(n,r,i,o){this.initConnection_();let s=n._queryIdentifier,a=n._path.toString();this.log_("Listen called for "+a+" "+s),this.listens.has(a)||this.listens.set(a,new Map),Y(n._queryParams.isDefault()||!n._queryParams.loadsAllData(),"listen() called for non-default but complete query"),Y(!this.listens.get(a).has(s),"listen() called twice for same path/queryId.");let c={onComplete:o,hashFn:r,query:n,tag:i};this.listens.get(a).set(s,c),this.connected_&&this.sendListen_(c)}sendGet_(n){let r=this.outstandingGets_[n];this.sendRequest("g",r.request,i=>{delete this.outstandingGets_[n],this.outstandingGetCount_--,this.outstandingGetCount_===0&&(this.outstandingGets_=[]),r.onComplete&&r.onComplete(i)})}sendListen_(n){let r=n.query,i=r._path.toString(),o=r._queryIdentifier;this.log_("Listen on "+i+" for "+o);let s={p:i},a="q";n.tag&&(s.q=r._queryObject,s.t=n.tag),s.h=n.hashFn(),this.sendRequest(a,s,c=>{let l=c.d,d=c.s;t.warnOnListenWarnings_(l,r),(this.listens.get(i)&&this.listens.get(i).get(o))===n&&(this.log_("listen response",c),d!=="ok"&&this.removeListen_(i,o),n.onComplete&&n.onComplete(d,l))})}static warnOnListenWarnings_(n,r){if(n&&typeof n=="object"&&zr(n,"w")){let i=Ws(n,"w");if(Array.isArray(i)&&~i.indexOf("no_index")){let o='".indexOn": "'+r._queryParams.getIndex().toString()+'"',s=r._path.toString();Un(`Using an unspecified index. Your data will be downloaded and filtered on the client. Consider adding ${o} at ${s} to your security rules for better performance.`)}}}refreshAuthToken(n){this.authToken_=n,this.log_("Auth token refreshed"),this.authToken_?this.tryAuth():this.connected_&&this.sendRequest("unauth",{},()=>{}),this.reduceReconnectDelayIfAdminCredential_(n)}reduceReconnectDelayIfAdminCredential_(n){(n&&n.length===40||VB(n))&&(this.log_("Admin auth credential detected. Reducing max reconnect time."),this.maxReconnectDelay_=Nj)}refreshAppCheckToken(n){this.appCheckToken_=n,this.log_("App check token refreshed"),this.appCheckToken_?this.tryAppCheck():this.connected_&&this.sendRequest("unappeck",{},()=>{})}tryAuth(){if(this.connected_&&this.authToken_){let n=this.authToken_,r=UB(n)?"auth":"gauth",i={cred:n};this.authOverride_===null?i.noauth=!0:typeof this.authOverride_=="object"&&(i.authvar=this.authOverride_),this.sendRequest(r,i,o=>{let s=o.s,a=o.d||"error";this.authToken_===n&&(s==="ok"?this.invalidAuthTokenCount_=0:this.onAuthRevoked_(s,a))})}}tryAppCheck(){this.connected_&&this.appCheckToken_&&this.sendRequest("appcheck",{token:this.appCheckToken_},n=>{let r=n.s,i=n.d||"error";r==="ok"?this.invalidAppCheckTokenCount_=0:this.onAppCheckRevoked_(r,i)})}unlisten(n,r){let i=n._path.toString(),o=n._queryIdentifier;this.log_("Unlisten called for "+i+" "+o),Y(n._queryParams.isDefault()||!n._queryParams.loadsAllData(),"unlisten() called for non-default but complete query"),this.removeListen_(i,o)&&this.connected_&&this.sendUnlisten_(i,o,n._queryObject,r)}sendUnlisten_(n,r,i,o){this.log_("Unlisten on "+n+" for "+r);let s={p:n},a="n";o&&(s.q=i,s.t=o),this.sendRequest(a,s)}onDisconnectPut(n,r,i){this.initConnection_(),this.connected_?this.sendOnDisconnect_("o",n,r,i):this.onDisconnectRequestQueue_.push({pathString:n,action:"o",data:r,onComplete:i})}onDisconnectMerge(n,r,i){this.initConnection_(),this.connected_?this.sendOnDisconnect_("om",n,r,i):this.onDisconnectRequestQueue_.push({pathString:n,action:"om",data:r,onComplete:i})}onDisconnectCancel(n,r){this.initConnection_(),this.connected_?this.sendOnDisconnect_("oc",n,null,r):this.onDisconnectRequestQueue_.push({pathString:n,action:"oc",data:null,onComplete:r})}sendOnDisconnect_(n,r,i,o){let s={p:r,d:i};this.log_("onDisconnect "+n,s),this.sendRequest(n,s,a=>{o&&setTimeout(()=>{o(a.s,a.d)},Math.floor(0))})}put(n,r,i,o){this.putInternal("p",n,r,i,o)}merge(n,r,i,o){this.putInternal("m",n,r,i,o)}putInternal(n,r,i,o,s){this.initConnection_();let a={p:r,d:i};s!==void 0&&(a.h=s),this.outstandingPuts_.push({action:n,request:a,onComplete:o}),this.outstandingPutCount_++;let c=this.outstandingPuts_.length-1;this.connected_?this.sendPut_(c):this.log_("Buffering put: "+r)}sendPut_(n){let r=this.outstandingPuts_[n].action,i=this.outstandingPuts_[n].request,o=this.outstandingPuts_[n].onComplete;this.outstandingPuts_[n].queued=this.connected_,this.sendRequest(r,i,s=>{this.log_(r+" response",s),delete this.outstandingPuts_[n],this.outstandingPutCount_--,this.outstandingPutCount_===0&&(this.outstandingPuts_=[]),o&&o(s.s,s.d)})}reportStats(n){if(this.connected_){let r={c:n};this.log_("reportStats",r),this.sendRequest("s",r,i=>{if(i.s!=="ok"){let s=i.d;this.log_("reportStats","Error sending stats: "+s)}})}}onDataMessage_(n){if("r"in n){this.log_("from server: "+xt(n));let r=n.r,i=this.requestCBHash_[r];i&&(delete this.requestCBHash_[r],i(n.b))}else{if("error"in n)throw"A server-side error has occurred: "+n.error;"a"in n&&this.onDataPush_(n.a,n.b)}}onDataPush_(n,r){this.log_("handleServerMessage",n,r),n==="d"?this.onDataUpdate_(r.p,r.d,!1,r.t):n==="m"?this.onDataUpdate_(r.p,r.d,!0,r.t):n==="c"?this.onListenRevoked_(r.p,r.q):n==="ac"?this.onAuthRevoked_(r.s,r.d):n==="apc"?this.onAppCheckRevoked_(r.s,r.d):n==="sd"?this.onSecurityDebugPacket_(r):Db("Unrecognized action received from server: "+xt(n)+`
|
|
150
|
+
`+pn),ht&&(pn=Ka(pn)),N&&iu?Mr(pn):pn},e.setConfig=function(){let $=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};cu($),tu=!0,nu=it,Li=ut},e.clearConfig=function(){ki=null,tu=!1,nu=null,Li=null,N=D,L=""},e.isValidAttribute=function($,T,b){ki||cu({});let H=gt($),j=gt(T);return typeof b=="string"&&(km(T,b)||!Ot&&vn(Z2,b))?!1:Qh(H,j,b)},e.addHook=function($,T){typeof T=="function"&&sr(rt,$)&&Gp(rt[$],T)},e.removeHook=function($,T){if(sr(rt,$)){if(T!==void 0){let b=pre(rt[$],T);return b===-1?void 0:mre(rt[$],b,1)[0]}return j2(rt[$])}},e.removeHooks=function($){sr(rt,$)&&(rt[$]=[])},e.removeAllHooks=function(){rt=ej()},e}var Ly=sj();var Vre=/^\/\/\*\[@id='([^']+)'\]/;function pb(t){try{if(typeof t!="string")return null;let e=Vre.exec(t);if(!e)return null;let n=e[1],r=t.slice(e[0].length);if(!r)return{rootId:n,segments:[]};if(!r.startsWith("/"))return null;let i=[],o="",s=0,a=null;for(let c=1;c<r.length;c++){let l=r[c];if(a){l===a&&(a=null),o+=l;continue}if(l==="'"||l==='"')a=l;else if(l==="[")s++;else if(l==="]")s--;else if(l==="/"&&s===0){if(!o)return null;i.push(o),o="";continue}o+=l}return!o||a||s!==0?null:(i.push(o),{rootId:n,segments:i})}catch{return null}}var Bre=[/:r[0-9a-z]+:/i,/_r_[0-9a-z]+_/i,/«r[0-9a-z]+»/i,/^radix-/i];function cj(t){try{return t?Bre.some(e=>e.test(t)):!1}catch{return!1}}function cFe(t){if(Array.isArray(t))return aj(t);if(!t||typeof t!="object"||!("documentIds"in t))return{documentIds:null};let e=t.documentIds;return Array.isArray(e)?aj(e):{documentIds:[],problem:"not-an-array"}}function aj(t){let e=t.filter(n=>typeof n=="string"||typeof n=="number"&&Number.isFinite(n)).map(n=>String(n)).filter(n=>n.length>0);return V({documentIds:Array.from(new Set(e)).sort()},e.length<t.length?{problem:"dropped-entries"}:{})}function lFe(t,e){return t===null||e===null?t===e:t.length===e.length&&t.every((n,r)=>n===e[r])}var lj={ADD_TAGS:["velt-skeleton-loader"],ADD_ATTR:["border-radius","target"]};function Wp(t,e,n){if(!t)return!0;try{return t(e)!==!1}catch(r){return n?.catch("Error in DomService target filter: ",r),!0}}var Gre=new Set([k.ATTRIBUTES.VELT_ELEMENT_CACHE_ID,k.ATTRIBUTES.VELT_COMMENT_PIN_HOST]);function uj(t){try{if(!t)return"";let e=uj(t.parent);return e===null?null:[t.id,t.tagName,t.elementSelector,t.robustXPath,t.xPath,t.cfXPath,t.fXPath,t.contentHash?.value].map(n=>n??"").join("")+""+e}catch(e){return O.catch("Error in DomService getAnchorSignature: ",e),null}}function jre(t){let e=(t??"").replace(/\+position$/,"");return e==="id"||e==="id-duplicate"?0:e==="element-selector"||e==="element-selector-duplicate"?1:e==="robustXPath"?2:3}function Hre(t,e){try{if(!t||!e?.cacheKey&&e?.accept)return null;let n=uj(t);return n===null?null:e?.cacheKey?`k${e.cacheKey}${n}`:`a${n}`}catch(n){return O.catch("Error in DomService getAnchorCacheKey: ",n),null}}var dj=(()=>{let e=class e{constructor(r,i,o,s){this.analyticsService=r,this.rendererFactory2=i,this.loggingService=o,this.sanitizer=s,this.smoothScrollShieldHandler=null,this.smoothScrollShieldLoadListener=null,this.isVideoEditorHandlingDelete=!1,this.pageScrollHeight=0,this.enableRectSelectionSubject$=new de(!1),this.enableRectSelection$=this.enableRectSelectionSubject$.asObservable(),this.scrollableElementsIds$=new de([]),this.mousedown=!1,this.windowMouseDown$=new Be,this.windowPointerMove$=new de(null),this.windowPointerUp$=new Be,this.documentSelectionChange$=new Be,this.windowClick$=new Be,this.windowScroll$=new de(null),this.windowResize$=new de(null),this.windowKeyupBackspace$=new Be,this.windowKeyupDelete$=new Be,this.windowKeyupEsc$=new Be,this.windowPopState$=new de(null),this.documentClick$=new Be,this.lastDocumentClickTarget=null,this.documentClickSubject$=new Be,this.documentFocus$=new Be,this.isShiftKeyPressed=!1,this.mutation$=new Be,this.pendingMutations=[],this.frameTasks=new Map,this.childListMutation$=new Be,this.networkStatus$=new de(!1),this.xpathCache=new Map,this.anchorResolutionCache=new Map,this.passMemo=null,this.passDepth=0,this.xpathCacheId=new Map,this.selectedAnnotationsMap$=new de({}),this.selectedAnnotationsLocationMap$=new de({}),this.selectedAnnotationsContextIdMap$=new de({}),this.recordingInProgress$=new de({}),this.deleteAnnotations$=new de([]),this.pinHighlighterClass$=new de(null),this.dialogOpenedInSidebar$=new de(!1),this.textHighlighterClass$=new de(null),this.commentPinHighlighter$=new de(!1),this.deviceInfo$=new de(new Wr),this.customCss$=new de(null),this.mutationObserver=null,this.animationFilterEnabled=!1,this.animationLibraryDetected=null,this.staticAnimationCache=new WeakMap,this.ANIMATION_LIBRARY_SELECTOR=["[data-gsap]",".gsap-marker-start",".gsap-marker-end","[data-gsap-id]",".swiper-slide",".swiper-wrapper",".swiper-pagination",".swiper-pagination-bullet","[data-aos]"].join(", "),this.previousMousePosition={pageX:0,pageY:0,clientX:0,clientY:0},this.currentMousePosition={pageX:0,pageY:0,clientX:0,clientY:0,element:{xpath:"",topPercentage:0,leftPercentage:0}},this.unlistenElementScroll={},this.tabId=null,this.dynamicIdPatterns=[/^yui_[a-z0-9_]+$/i],this.excludeClassList=["show-pin-cursor"],this.annotationDraftContentReader=null,this.filterSnippylyNodes=a=>{try{let c=[];return a.forEach(l=>{if(!ao(l))if(l instanceof HTMLElement){if(l.className.includes("cdk-overlay-container")||l.className.includes("cdk-overlay-connected-position-bounding-box"))return;if(l.className.includes("cdk-overlay")){let d=!1;l.childNodes.forEach(h=>{ao(h)&&(d=!0)}),d||c.push(l)}else c.push(l)}else c.push(l)}),c}catch(c){return this.loggingService.catch("Error in DomService filterSnippylyNodes: ",c),[]}},this.loggingService.log("%c[WB] Creating CLASS: DomService","color: blue;");try{this.analyticsService.setDomService(this),this.renderer=this.rendererFactory2.createRenderer(null,null);let a=this.calculateScreenSize();this.currentScreenSize$=new de(a),this.currentMousePosition$=new de(this.currentMousePosition),this.detectNetworkStatusChange(),this.getScrollableElementsIds$().pipe(ac(),pE(([c,l])=>{try{let d=l.filter(f=>!c.includes(f)),h=c.filter(f=>!l.includes(f));h.length&&h.map(g=>document.getElementById(g)).filter(g=>g).forEach(g=>{this.unlistenElementScroll&&this.unlistenElementScroll[g.id]&&this.unlistenElementScroll[g.id]()}),d.length&&d.map(g=>document.getElementById(g)).filter(g=>g).forEach(g=>{this.unlistenElementScroll[g.id]=this.renderer.listen(g,"scroll",()=>{this.runOncePerFrame("screen-size",()=>this.currentScreenSize$.next(this.calculateScreenSize()))})})}catch(d){this.loggingService.catch("Error in DomService getScrollableElementsIds subscription: ",d)}})).subscribe(()=>{},c=>{this.loggingService.catch("Error in DomService getScrollableElementsIds subscription: ",c)}),this.getSelectedAnnotationsMap$().subscribe(c=>{Object.keys(c||{})?.length?gB("snippylyUserScalableNo","viewport","width=device-width, user-scalable=no"):mB("snippylyUserScalableNo")},c=>{this.loggingService.catch("Error in DomService getSelectedAnnotationsMap$ subscription: ",c)})}catch(a){this.loggingService.catch("Error in DomService constructor: ",a)}}setDocService(r){try{this.docService=r,this.subscribeToDomEvents()}catch(i){this.loggingService.catch("Error in DomService setDocService: ",i)}}setDynamicIdPatterns(r){try{let i=r.map(o=>typeof o=="string"?new RegExp(o):o).filter(Boolean);i.length&&(this.dynamicIdPatterns=i)}catch(i){this.loggingService.catch("Error in DomService setDynamicIdPatterns: ",i)}}isLikelyDynamicId(r){try{return r?this.dynamicIdPatterns.some(i=>i.test(r)):!1}catch{return!1}}isGeneratedId(r){return this.isLikelyDynamicId(r)||cj(r)}getStableAttributes(r){try{let i={};if(!r.getAttributeNames)return i;let o=new Set(["id","class","style"]);return r.getAttributeNames().forEach(a=>{if(o.has(a)||a.includes("snippyly")||a.includes("velt"))return;let c=r.getAttribute(a);c&&c.length<=256&&(i[a]=c)}),i}catch{return{}}}buildStableElementSelector(r,i){try{if(Object.keys(i).length===0)return;let s=[r.tagName?.toLowerCase()],a=["data-","aria-","role","name","title","type"];return Object.keys(i).sort((l,d)=>{let h=a.findIndex(g=>l.startsWith(g)),f=a.findIndex(g=>d.startsWith(g));return(h===-1?99:h)-(f===-1?99:f)}).slice(0,4).forEach(l=>{let d=CSS.escape(i[l]);s.push(`[${l}="${d}"]`)}),s.join("")}catch{return}}getVisibleText(r,i=400){try{let o=document.createTreeWalker(r,NodeFilter.SHOW_TEXT,null),s="",a,c=0;for(;(a=o.nextNode())&&s.length<i;){let l=(a.textContent||"").replace(/\s+/g," ").trim();if(l&&(s+=(s?" ":"")+l),c++,c>100)break}return s.slice(0,i)}catch{return""}}hashText(r){try{return JV(r)}catch{return}}generateRobustXPath(r,i){try{let o=i?.maxDepth||10,s=i?.useAbsolutePath||!1,a=[],c=r,l=0;for(;c&&c!==document.documentElement&&l<o;){let g=this.buildRobustXPathSegment(c);if(g&&(a.unshift(g),this.isStrongAnchorSegment(g)))break;c=c.parentElement,l++}if(a.length===0)return;let h=(s?"/":"//")+a.join("/");return a.some(g=>g.includes("[@")||g.includes("[contains(@class"))?h:void 0}catch{return}}buildRobustXPathSegment(r){try{let i=r.tagName.toLowerCase(),o=r.id;if(o&&!this.isLikelyDynamicId(o)&&document.querySelectorAll(`[id="${CSS.escape(o)}"]`).length===1)return`*[@id=${this.escapeXPathValue(o)}]`;let s=["data-region","data-instanceid","data-action","data-key","data-block","data-activityid"];for(let g of s){let E=r.getAttribute(g);if(E)return`${i}[@${g}=${this.escapeXPathValue(E)}]`}let a=Array.from(r.attributes).filter(g=>g.name.startsWith("data-")&&!g.name.includes("snippyly")&&!g.name.includes("velt")&&g.value.length<100).sort((g,E)=>g.value.length-E.value.length);if(a.length>0){let g=a[0];return`${i}[@${g.name}=${this.escapeXPathValue(g.value)}]`}let c=r.getAttribute("role");if(c)return`${i}[@role=${this.escapeXPathValue(c)}]`;let l=r.getAttribute("aria-label");if(l&&l.length<50)return`${i}[@aria-label=${this.escapeXPathValue(l)}]`;let d=r.getAttribute("name");if(d)return`${i}[@name=${this.escapeXPathValue(d)}]`;let h=r.getAttribute("type");if(h)return`${i}[@type=${this.escapeXPathValue(h)}]`;let f=Array.from(r.classList||[]).filter(g=>g.length>0&&g.length<40&&!g.includes("yui")&&!g.includes("velt")&&!g.includes("snippyly")&&!this.excludeClassList.includes(g)).slice(0,2);if(f.length>0){let g=f.map(E=>`contains(@class, ${this.escapeXPathValue(E)})`).join(" and ");return`${i}[${g}]`}if(r.parentElement){let g=Array.from(r.parentElement.children).filter(E=>E.tagName===r.tagName);if(g.length>1){let E=g.indexOf(r)+1;return`${i}[${E}]`}}return i}catch{return}}isStrongAnchorSegment(r){try{return!!(r.includes("[@id=")||["main","navigation","banner","contentinfo","complementary","search"].some(s=>r.includes(`[@role='${s}']`))||["data-region","data-instanceid","data-activityid"].some(s=>r.includes(`[@${s}=`)))}catch{return!1}}escapeXPathValue(r,i=!0){try{return r.includes("'")?r.includes('"')?`concat(${r.split("'").map(a=>`'${a}'`).join(`,"'",`)})`:i?`"${r}"`:r:i?`'${r}'`:r}catch{try{return`concat(${r.split("'").map(c=>`'${c}'`).join(`,"'",`)})`}catch{return i?`'${r}'`:r}}}getElementFromRobustXPath(r){try{return document.evaluate(r,document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue}catch{return null}}runPositionPass(r){this.passDepth===0&&(this.passMemo={robustXPath:new Map,selector:new Map,visibleTextHash:new WeakMap}),this.passDepth++;try{return r()}finally{this.passDepth--,this.passDepth===0&&(this.passMemo=null)}}hashVisibleText(r){let i=this.passMemo?.visibleTextHash;if(i?.has(r))return i.get(r);let o=this.hashText(this.getVisibleText(r));return i?.set(r,o),o}getAllElementsFromRobustXPath(r){let i=this.passMemo?.robustXPath,o=i?.get(r);if(o)return o;let s=this.evaluateRobustXPath(r);return i?.set(r,s),s}getAllElementsFromSelector(r){let i=this.passMemo?.selector,o=i?.get(r);if(o)return o;let s=Array.from(document.querySelectorAll(r));return i?.set(r,s),s}evaluateRobustXPath(r){try{let i=document.evaluate(r,document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null),o=[];for(let s=0;s<i.snapshotLength;s++){let a=i.snapshotItem(s);a instanceof Element&&o.push(a)}return o}catch{return[]}}generateAnchorRecord(r,i){try{let o=this.generateAnchorRecordForElement(r,i),s=null;if(r.parentElement&&r.parentElement instanceof HTMLElement&&ld(r.parentElement)&&r.parentElement!==document.body&&(s=r.parentElement),o&&s){let a=this.generateAnchorRecordForElement(s,i);a&&(o.parent=a)}return o}catch(o){return this.loggingService.catch("Error in DomService generateAnchorRecord: ",o),null}}generateAnchorRecordForElement(r,i){try{if(!r)return null;let o=r,s=o.tagName?.toUpperCase();if(!s)return null;let a=o.id&&!this.isLikelyDynamicId(o.id)?o.id:void 0,c=this.getStableAttributes(o),l=this.buildStableElementSelector(o,c),d=this.getVisibleText(o),h=this.hashText(d||""),f=this.generateRobustXPath(o),g=this.getXPath(o,!1,!1,void 0,{ignoreGeneratedIds:i?.ignoreGeneratedIds}),E=this.getXPath(o,!0),I=this.getXPath(o,!0,!0);return{version:"1.0",id:a,tagName:s,elementSelector:l,robustXPath:f||void 0,xPath:g||void 0,fXPath:E||void 0,cfXPath:I||void 0,contentHash:h?{value:h,algorithm:"md5",source:"textContent"}:void 0,createdAt:Date.now()}}catch(o){return this.loggingService.catch("Error in DomService generateAnchorRecordForElement: ",o),null}}resolveAnchorRecord(r,i){try{let o=Hre(r,i);if(o){let a=this.getVerifiedCachedAnchor(o,r,i?.accept);if(a)return a}let s=this.resolveAnchorRecordUncached(r,i);return o&&this.cacheAnchorResolution(o,r,s),s}catch(o){return this.loggingService.catch("Error in DomService resolveAnchorRecord: ",o),this.resolveAnchorRecordUncached(r,i)}}getVerifiedCachedAnchor(r,i,o){try{let s=this.anchorResolutionCache.get(r);if(!s)return null;let a=s.element.deref();return!!a&&a.isConnected&&Wp(o,a,this.loggingService)&&(!i.tagName||a.tagName?.toUpperCase()===i.tagName)&&(!i.contentHash?.value||this.hashVisibleText(a)===i.contentHash.value)&&(!i.id||a.id===i.id)&&!this.isOutrankedByStrongerLocator(i,s.resolution,a,o)?le(V({},s.resolution),{element:a}):(this.anchorResolutionCache.delete(r),null)}catch(s){return this.loggingService.catch("Error in DomService getVerifiedCachedAnchor: ",s),null}}isOutrankedByStrongerLocator(r,i,o,s){try{let a=jre(i.matchedBy),c=i.score??0,l=h=>h!==o&&Wp(s,h,this.loggingService),d=(h,f)=>f+(r.tagName&&h.tagName?.toUpperCase()===r.tagName?10:0)+(r.contentHash?.value&&this.hashVisibleText(h)===r.contentHash.value?30:0);if(a>1&&r.elementSelector){let h=this.getAllElementsFromSelector(r.elementSelector);if(h.length===1&&l(h[0])||h.some(f=>l(f)&&d(f,60)>=c))return!0}return!!(a>2&&r.robustXPath&&this.getAllElementsFromRobustXPath(r.robustXPath).slice(0,e.MAX_ROBUST_XPATH_CANDIDATES).some(f=>l(f)&&d(f,50)>=c))}catch(a){return this.loggingService.catch("Error in DomService isOutrankedByStrongerLocator: ",a),!0}}cacheAnchorResolution(r,i,o){try{if(!o?.element){this.anchorResolutionCache.delete(r);return}let a=!!i.contentHash?.value&&!!o.scoreBreakdown?.some(h=>h.method==="contentHash-match"),c=o.matchedBy==="id";if(!a&&!c){this.anchorResolutionCache.delete(r);return}this.anchorResolutionCache.size>=e.ANCHOR_CACHE_LIMIT&&this.anchorResolutionCache.clear();let s=o,{element:l}=s,d=mS(s,["element"]);this.anchorResolutionCache.set(r,{element:new WeakRef(l),resolution:d})}catch(a){this.loggingService.catch("Error in DomService cacheAnchorResolution: ",a)}}resolveAnchorRecordUncached(r,i){try{let o=[],s=null,a=i?.accept,c=R=>Wp(a,R,this.loggingService),l=(R,U,G=0)=>{if(!c(R))return;let X=[],ce=G;X.push({method:U,score:G}),r.tagName&&R.tagName?.toUpperCase()===r.tagName&&(ce+=10,X.push({method:"tagName-match",score:10})),r.contentHash?.value&&this.hashVisibleText(R)===r.contentHash.value&&(ce+=30,X.push({method:"contentHash-match",score:30})),o.push({el:R,score:ce,by:U,scoreBreakdown:X})};if(r.id){let R=document.querySelectorAll(`#${CSS.escape(r.id)}`);if(R.length===1&&c(R[0]))return{element:R[0],matchedBy:"id",score:90};R.length>1&&R.forEach(U=>l(U,"id-duplicate",70))}if(r.elementSelector){let R=document.querySelectorAll(r.elementSelector);if(R.length===1&&c(R[0]))return{element:R[0],matchedBy:"element-selector",score:80};R.forEach(U=>l(U,"element-selector-duplicate",60))}r.robustXPath&&this.getAllElementsFromRobustXPath(r.robustXPath).slice(0,e.MAX_ROBUST_XPATH_CANDIDATES).forEach(G=>l(G,"robustXPath",50));let d=()=>o.reduce((R,U)=>Math.max(R,U.score),-1/0),h=80,f=70;r?.parent&&d()<=h&&(s=this.resolveAnchorRecord(r.parent,le(V({},i),{cacheKey:i?.cacheKey?`${i.cacheKey}#parent`:void 0})),s.element&&s.element.querySelectorAll(r.tagName?.toLowerCase()||"*").forEach(U=>l(U,"parent+tag",40)));let g=(R,U,G)=>{if(!R)return;let X=this.getElementFromXPathAccepted(R,a);X&&l(X,U||"xpath",G||30)};if(d()<=f&&(g(r.xPath,"xPath",30),g(r.cfXPath,"cfXPath",30),g(r.fXPath,"fXPath",30)),r.contentHash?.value&&o.length===0){let U=G=>{let X=0;for(let ce=0;ce<G.length&&X<400;ce++){let ne=G[ce];if(X++,!this.isElementVisible(ne))continue;let A=this.hashVisibleText(ne);A&&A===r.contentHash?.value&&l(ne,"contentHash",15)}};if(s?.element&&s?.element instanceof Element){let G=s?.element?.querySelectorAll("*");U(G)}}if(!o.length)return{element:null};o.sort((R,U)=>U.score-R.score);let E=o[0].score,I=o.filter(R=>R.score===E);if(I.length>1){let R=[{path:r.xPath,label:"xPath"},{path:r.cfXPath,label:"cfXPath"},{path:r.fXPath,label:"fXPath"}];for(let U of R)if(U.path){let G=this.getElementFromXPathAccepted(U.path,a);if(G){let X=I.find(ce=>ce.el===G);if(X)return{element:X.el,matchedBy:`${X.by}+position`,score:X.score,scoreBreakdown:X.scoreBreakdown}}}}let S=o[0];return{element:S.el,matchedBy:S.by,score:S.score,scoreBreakdown:S.scoreBreakdown}}catch(o){return this.loggingService.catch("Error in DomService resolveAnchorRecord: ",o),{element:null}}}subscribeToDomEvents(){try{this.docService?.getDocumentPaths$().pipe(De(r=>{r?(this.onWindowResize(),this.onWindowScroll(),this.onPointerDown(),this.onWindowClick(),this.onWindowKeyupBackspace(),this.onWindowKeyupDelete(),this.onWindowKeyupEsc(),this.onWindowPopState(),this.onWindowKeydownShift(),this.onWindowKeyupShift(),this.addPointerMoveListener(),this.addPointerUpListener(),this.addSelectionChangeListener(),this.onDocumentFocus(),this.setupSmoothScrollShield()):(this.unsubscribeFromWindowResize(),this.unsubscribeFromWindowScroll(),this.unsubscribeFromPointerDown(),this.unsubscribeFromWindowClick(),this.unsubscribeFromWindowKeyupBackspace(),this.unsubscribeFromWindowKeyupDelete(),this.unsubscribeFromWindowKeyupEsc(),this.unsubscribeFromWindowPopState(),this.unsubscribeFromWindowKeydownShift(),this.unsubscribeFromWindowKeyupShift(),this.unsubscribeFromPointerMoveListener(),this.unsubscribeFromPointerUpListener(),this.unsubscribeFromSelectionChangeListener(),this.unsubscribeFromDocumentFocus(),this.unsetMutationObserver(),this.teardownSmoothScrollShield())})).subscribe(),this.onDocumentClick()}catch(r){this.loggingService.catch("Error in DomService subscribeToDomEvents: ",r)}}setScrollableElementsIds(r){try{r&&r.length&&this.scrollableElementsIds$.next(Array.from(new Set(r)))}catch(i){this.loggingService.catch("Error in DomService setScrollableElementsIds: ",i)}}getScrollableElementsIds$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getScrollableElementsIds$","color: green;"),this.scrollableElementsIds$.asObservable()}removeScrollableElementsIds(){this.scrollableElementsIds$.next([])}setMutationObserver(r){try{this.mutationObserver||(this.loggingService.log("%c[WB] Calling DomService FUNCTION: setMutationObserver","color: green;"),this.loggingService.log("%c[WB] setMutationObserver from: "+r,"color: green;"),this.animationFilterEnabled=this.detectAnimationLibraries(),this.loggingService.log("%c[WB] Animation filter:","color: green;",this.animationFilterEnabled?"ENABLED (library detected)":"DISABLED (no library)"),this.mutationObserver=new MutationObserver(i=>{try{if(i?.find(s=>s?.attributeName===k.VELT_IGNORE_CHANGE_DETECTION))return;let o=i.filter(s=>s.type==="childList").filter(s=>{let a=s.target;return s.removedNodes.forEach(c=>{let l=c;if(typeof l.getAttribute=="function"){let d=l.getAttribute(k.ATTRIBUTES.VELT_ELEMENT_CACHE_ID);if(d!==null&&d!==""){let h=this.xpathCacheId.get(d);h!==void 0&&(this.xpathCacheId.delete(d),this.xpathCache.delete(h))}}}),ao(a)?!1:!!(this.filterSnippylyNodes(s.addedNodes).length||this.filterSnippylyNodes(s.removedNodes).length)});this.animationFilterEnabled?this.childListMutation$.next(o.filter(s=>!this.isAnimatingElement(s.target))):this.childListMutation$.next(o),o.push(...i.filter(s=>s.type==="attributes").filter(s=>!Gre.has(s.attributeName??"")).filter(s=>!ao(s.target)).filter(s=>this.filterSnippylyNodes([s.target]).length).filter(s=>{if(s){let a=s.target;return a?.classList?.contains("snippyly-sidebar-panel")?!1:a?!a.getAttribute(k.VELT_IGNORE_CHANGE_DETECTION):!0}return!0})),o=o.filter(s=>{let a=!0;return Object.keys(k.INGNORE_MUTATION_OBSERVER_CHANGE_TAGS).forEach(c=>{s.target?.closest(c)&&(a=!1)}),a}),o=o.filter(s=>s.target&&ld(s.target)),this.animationFilterEnabled&&(o=o.filter(s=>!this.isAnimatingElement(s.target))),o.length&&(this.pendingMutations.push(...o),this.runOncePerFrame("mutations",()=>{let s=this.pendingMutations;this.pendingMutations=[],s.length&&this.mutation$.next(s)}))}catch(o){this.loggingService.catch("Error in DomService change detection: ",o)}}),this.mutationObserver.observe(document.body,{childList:!0,subtree:!0,attributes:!0}))}catch(i){this.loggingService.catch("Error in DomService change detection: ",i)}}detectAnimationLibraries(){try{if(this.animationLibraryDetected!==null)return this.animationLibraryDetected;let r=window;return r.gsap||r.TweenMax||r.TweenLite||r.TimelineMax||r.TimelineLite?(this.loggingService.log("%c[WB] Detected animation library: GSAP","color: green;"),this.animationLibraryDetected=!0,!0):r.Swiper?(this.loggingService.log("%c[WB] Detected animation library: Swiper","color: green;"),this.animationLibraryDetected=!0,!0):r.AOS?(this.loggingService.log("%c[WB] Detected animation library: AOS","color: green;"),this.animationLibraryDetected=!0,!0):r.anime?(this.loggingService.log("%c[WB] Detected animation library: Anime.js","color: green;"),this.animationLibraryDetected=!0,!0):r.lottie||r.Lottie||r.bodymovin?(this.loggingService.log("%c[WB] Detected animation library: Lottie","color: green;"),this.animationLibraryDetected=!0,!0):document.querySelector("[data-framer-component-type]")?(this.loggingService.log("%c[WB] Detected animation library: Framer Motion","color: green;"),this.animationLibraryDetected=!0,!0):document.querySelector(this.ANIMATION_LIBRARY_SELECTOR)?(this.loggingService.log("%c[WB] Detected animation library: DOM markers","color: green;"),this.animationLibraryDetected=!0,!0):(this.loggingService.log("%c[WB] No animation library detected","color: green;"),this.animationLibraryDetected=!1,!1)}catch{return this.animationLibraryDetected=!1,!1}}isAnimatingElement(r){try{if(!r||typeof r.closest!="function")return!1;let i=window;if(i.gsap&&typeof i.gsap.isTweening=="function"){if(i.gsap.isTweening(r))return!0;if(typeof i.gsap.getTweensOf=="function")try{if(i.gsap.getTweensOf(r).length>0)return!0}catch{}}else if(i.TweenMax&&typeof i.TweenMax.isTweening=="function"){if(i.TweenMax.isTweening(r))return!0;if(typeof i.TweenMax.getTweensOf=="function")try{if(i.TweenMax.getTweensOf(r).length>0)return!0}catch{}}let o=r.style?.cssText||"";if(o){let l=o.includes("transform")||o.includes("translate3d")||o.includes("translate(")||o.includes("scale3d")||o.includes("rotate"),d=o.includes("will-change")&&o.includes("transform"),h=o.includes("transform-style")&&o.includes("preserve-3d");if(l&&(d||h))return!0}if(r.style&&(r.style.animation!==""&&r.style.animation!=="none"||r.style.transition!==""&&r.style.transition!=="none")||r.classList?.contains("animate")||r.classList?.contains("animating")||r.classList?.contains("animated")||r.classList?.contains("animation"))return!0;let s=this.staticAnimationCache.get(r);if(s!==void 0)return s;let a=!1,c=r.className||"";return typeof c=="string"&&(c.includes("slider")&&(c.includes("bullet")||c.includes("pagination"))&&(a=!0),c.includes("swiper-pagination")&&(a=!0)),!a&&(r.hasAttribute("data-aos")||r.hasAttribute("data-motion"))&&(a=!0),!a&&r.closest(this.ANIMATION_LIBRARY_SELECTOR)&&(a=!0),this.staticAnimationCache.set(r,a),a}catch{return!1}}runOncePerFrame(r,i){let o=this.frameTasks.has(r);if(this.frameTasks.set(r,i),o)return;let s=!1,a,c,l=()=>{if(s)return;s=!0,a!==void 0&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(a),c!==void 0&&clearTimeout(c);let d=this.frameTasks.get(r);this.frameTasks.delete(r);try{d?.()}catch(h){this.loggingService.catch(`Error in DomService frame task ${r}: `,h)}};typeof requestAnimationFrame=="function"&&(a=requestAnimationFrame(l)),c=setTimeout(l,100)}unsetMutationObserver(){try{this.mutationObserver&&(this.mutationObserver.disconnect(),this.mutationObserver=null,this.pendingMutations=[],this.staticAnimationCache=new WeakMap,this.animationLibraryDetected=null,this.animationFilterEnabled=!1)}catch(r){this.loggingService.catch("Error in DomService unsetMutationObserver: ",r)}}detectNetworkStatusChange(){this.loggingService.log("%c[WB] Calling FUNCTION: detectNetworkStatusChange","color: green;");try{vs($i(window,"offline").pipe(De(()=>!1)),$i(window,"online").pipe(De(()=>!0)),new he(r=>{r.next(navigator.onLine),r.complete()})).subscribe(r=>{this.networkStatus$.next(r)})}catch(r){this.loggingService.catch("Error in DomService detectNetworkStatusChange: ",r)}}onWindowResize(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowResize","color: green;");try{this.unsubscribeFromWindowResize();let r=null;this.unlistenWindowResize=this.renderer.listen("window","resize",i=>{r=i,this.runOncePerFrame("resize",()=>{let o=r;r=null,this.windowResize$.next(o);let s=this.calculateScreenSize();this.deviceInfo$.next(new Wr),this.currentScreenSize$.next(s)})})}catch(r){this.loggingService.catch("Error in DomService onWindowResize: ",r)}}unsubscribeFromWindowResize(){try{this.unlistenWindowResize&&typeof this.unlistenWindowResize=="function"&&(this.unlistenWindowResize(),this.unlistenWindowResize=null)}catch(r){this.loggingService.catch("Error in DomService unsubscribeFromWindowResize: ",r)}}onWindowScroll(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowScroll","color: green;");try{this.unsubscribeFromWindowScroll(),this.unlistenWindowScroll=this.renderer.listen("window","scroll",r=>{this.windowScroll$.next(r),this.runOncePerFrame("screen-size",()=>this.currentScreenSize$.next(this.calculateScreenSize()))})}catch(r){this.loggingService.catch("Error in DomService onWindowScroll: ",r)}}unsubscribeFromWindowScroll(){try{this.unlistenWindowScroll&&typeof this.unlistenWindowScroll=="function"&&(this.unlistenWindowScroll(),this.unlistenWindowScroll=null)}catch(r){this.loggingService.catch("Error in DomService unsubscribeFromWindowScroll: ",r)}}setupSmoothScrollShield(){this.loggingService.log("%c[WB] Calling FUNCTION: setupSmoothScrollShield","color: green;");try{if(typeof window>"u"||typeof document>"u"||this.smoothScrollShieldHandler)return;if(this.isSmoothScrollLibPresent()){this.attachSmoothScrollShield();return}if(document.readyState!=="complete"&&!this.smoothScrollShieldLoadListener){let r=()=>{this.smoothScrollShieldLoadListener=null;try{if(this.smoothScrollShieldHandler)return;this.isSmoothScrollLibPresent()&&this.attachSmoothScrollShield()}catch(i){this.loggingService.catch("Error in DomService smooth-scroll shield load re-check: ",i)}};window.addEventListener("load",r,{once:!0}),this.smoothScrollShieldLoadListener=()=>window.removeEventListener("load",r)}}catch(r){this.loggingService.catch("Error in DomService setupSmoothScrollShield: ",r)}}isSmoothScrollLibPresent(){try{if(typeof window>"u"||typeof document>"u")return!1;if(window.ET_SmoothScroll)return!0;let i=document.body;return!!(i&&i.classList&&i.classList.contains("et_smooth_scroll"))}catch(r){return this.loggingService.catch("Error in DomService isSmoothScrollLibPresent: ",r),!1}}attachSmoothScrollShield(){if(this.smoothScrollShieldHandler)return;let r=/^(VELT-|SUPERFLOW-|SNIPPYLY-)/,i=s=>{try{let a=typeof s.composedPath=="function"?s.composedPath():[];for(let c=0;c<a.length;c++){let l=a[c];if(!(!l||l.nodeType!==1)&&l.tagName&&r.test(l.tagName)){s.stopImmediatePropagation();return}}}catch(a){this.loggingService.catch("Error in DomService smoothScrollShield handler: ",a)}};this.smoothScrollShieldHandler=i;let o={capture:!0,passive:!0};window.addEventListener("wheel",i,o),window.addEventListener("mousewheel",i,o),window.addEventListener("touchmove",i,o),this.unlistenWindowWheelShield=()=>window.removeEventListener("wheel",i,o),this.unlistenWindowMouseWheelShield=()=>window.removeEventListener("mousewheel",i,o),this.unlistenWindowTouchMoveShield=()=>window.removeEventListener("touchmove",i,o)}teardownSmoothScrollShield(){this.loggingService.log("%c[WB] Calling FUNCTION: teardownSmoothScrollShield","color: green;");try{try{this.smoothScrollShieldLoadListener&&typeof this.smoothScrollShieldLoadListener=="function"&&(this.smoothScrollShieldLoadListener(),this.smoothScrollShieldLoadListener=null)}catch(r){this.loggingService.catch("Error in DomService teardownSmoothScrollShield (load): ",r)}try{this.unlistenWindowWheelShield&&typeof this.unlistenWindowWheelShield=="function"&&(this.unlistenWindowWheelShield(),this.unlistenWindowWheelShield=null)}catch(r){this.loggingService.catch("Error in DomService teardownSmoothScrollShield (wheel): ",r)}try{this.unlistenWindowMouseWheelShield&&typeof this.unlistenWindowMouseWheelShield=="function"&&(this.unlistenWindowMouseWheelShield(),this.unlistenWindowMouseWheelShield=null)}catch(r){this.loggingService.catch("Error in DomService teardownSmoothScrollShield (mousewheel): ",r)}try{this.unlistenWindowTouchMoveShield&&typeof this.unlistenWindowTouchMoveShield=="function"&&(this.unlistenWindowTouchMoveShield(),this.unlistenWindowTouchMoveShield=null)}catch(r){this.loggingService.catch("Error in DomService teardownSmoothScrollShield (touchmove): ",r)}this.smoothScrollShieldHandler=null}catch(r){this.loggingService.catch("Error in DomService teardownSmoothScrollShield: ",r)}}onPointerDown(){this.loggingService.log("%c[WB] Calling FUNCTION: onPointerDown","color: green;");try{this.unsubscribeFromPointerDown(),this.unlistenPointerDown=this.renderer.listen("window","pointerdown",r=>{this.mousedown=!0,this.windowMouseDown$.next(r),this.setPointerPosition(r)})}catch(r){this.loggingService.catch("Error in DomService onPointerDown: ",r)}}unsubscribeFromPointerDown(){try{this.unlistenPointerDown&&typeof this.unlistenPointerDown=="function"&&(this.unlistenPointerDown(),this.unlistenPointerDown=null)}catch(r){this.loggingService.catch("Error in DomService unsubscribeFromPointerDown: ",r)}}onWindowClick(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeyupBackspace","color: green;");try{this.unsubscribeFromWindowClick(),this.unlistenWindowClick=this.renderer.listen("window","click",r=>{this.windowClick$.next(r)})}catch(r){this.loggingService.catch("Error in DomService onWindowClick: ",r)}}unsubscribeFromWindowClick(){try{this.unlistenWindowClick&&typeof this.unlistenWindowClick=="function"&&(this.unlistenWindowClick(),this.unlistenWindowClick=null)}catch(r){this.loggingService.catch("Error in DomService unsubscribeFromWindowClick: ",r)}}onWindowKeyupBackspace(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeyupBackspace","color: green;");try{this.unsubscribeFromWindowKeyupBackspace(),this.unlistenWindowKeyupBackspace=this.renderer.listen("window","keyup.backspace",r=>{this.isVideoEditorHandlingDelete||this.windowKeyupBackspace$.next(r)})}catch(r){this.loggingService.catch("Error in DomService onWindowKeyupBackspace: ",r)}}unsubscribeFromWindowKeyupBackspace(){try{this.unlistenWindowKeyupBackspace&&typeof this.unlistenWindowKeyupBackspace=="function"&&(this.unlistenWindowKeyupBackspace(),this.unlistenWindowKeyupBackspace=null)}catch(r){this.loggingService.catch("Error in DomService unsubscribeFromWindowKeyupBackspace: ",r)}}onWindowKeyupDelete(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeyupDelete","color: green;");try{this.unsubscribeFromWindowKeyupDelete(),this.unlistenWindowKeyupDelete=this.renderer.listen("window","keyup.delete",r=>{this.isVideoEditorHandlingDelete||this.windowKeyupDelete$.next(r)})}catch(r){this.loggingService.catch("Error in DomService onWindowKeyupDelete: ",r)}}unsubscribeFromWindowKeyupDelete(){try{this.unlistenWindowKeyupDelete&&typeof this.unlistenWindowKeyupDelete=="function"&&(this.unlistenWindowKeyupDelete(),this.unlistenWindowKeyupDelete=null)}catch(r){this.loggingService.catch("Error in DomService unsubscribeFromWindowKeyupDelete: ",r)}}onWindowKeyupEsc(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeyupEsc","color: green;");try{this.unsubscribeFromWindowKeyupEsc(),this.unlistenWindowKeyupEsc=this.renderer.listen("window","keyup.esc",r=>{this.windowKeyupEsc$.next(r)})}catch(r){this.loggingService.catch("Error in DomService onWindowKeyupEsc: ",r)}}unsubscribeFromWindowKeyupEsc(){try{this.unlistenWindowKeyupEsc&&typeof this.unlistenWindowKeyupEsc=="function"&&(this.unlistenWindowKeyupEsc(),this.unlistenWindowKeyupEsc=null)}catch(r){this.loggingService.catch("Error in DomService unsubscribeFromWindowKeyupEsc: ",r)}}onWindowPopState(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowPopState","color: green;");try{this.unsubscribeFromWindowPopState(),this.unlistenWindowPopState=this.renderer.listen("window","popstate",r=>{this.windowPopState$.next(r)})}catch(r){this.loggingService.catch("Error in DomService onWindowPopState: ",r)}}unsubscribeFromWindowPopState(){try{this.unlistenWindowPopState&&typeof this.unlistenWindowPopState=="function"&&(this.unlistenWindowPopState(),this.unlistenWindowPopState=null)}catch(r){this.loggingService.catch("Error in DomService unsubscribeFromWindowPopState: ",r)}}onDocumentClick(){this.loggingService.log("%c[WB] Calling FUNCTION: onDocumentClick","color: green;");try{this.unsubscribeFromDocumentClick(),this.documentClickListener=r=>{r?.target?.tagName?.toLowerCase()!==k.TAGS.SUPERFLOW_TOOLBAR&&(this.lastDocumentClickTarget=r?.target?new WeakRef(r.target):null,this.documentClick$.next(r),this.documentClickSubject$.next(r))},document.addEventListener("click",this.documentClickListener,!0)}catch(r){this.loggingService.catch("Error in DomService onDocumentClick: ",r)}}unsubscribeFromDocumentClick(){try{this.documentClickListener&&typeof this.documentClickListener=="function"&&(document.removeEventListener("click",this.documentClickListener,!0),this.documentClickListener=null)}catch(r){this.loggingService.catch("Error in DomService unsubscribeFromDocumentClick: ",r)}}onDocumentFocus(){this.loggingService.log("%c[WB] Calling FUNCTION: onDocumentFocus","color: green;");try{this.unsubscribeFromDocumentFocus(),this.documentFocusListener=r=>{this.documentFocus$.next(r)},document.addEventListener("focus",this.documentFocusListener,!0)}catch(r){this.loggingService.catch("Error in DomService onDocumentFocus: ",r)}}unsubscribeFromDocumentFocus(){try{this.documentFocusListener&&typeof this.documentFocusListener=="function"&&(document.removeEventListener("focus",this.documentFocusListener,!0),this.documentFocusListener=null)}catch(r){this.loggingService.catch("Error in DomService unsubscribeFromDocumentFocus: ",r)}}onWindowKeydownShift(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeydownShift","color: green;");try{this.unsubscribeFromWindowKeydownShift(),this.unlistenWindowKeydownShift=this.renderer.listen("window","keydown.shift",()=>{this.isShiftKeyPressed=!0})}catch(r){this.loggingService.catch("Error in DomService onWindowKeydownShift: ",r)}}unsubscribeFromWindowKeydownShift(){try{this.unlistenWindowKeydownShift&&typeof this.unlistenWindowKeydownShift=="function"&&(this.unlistenWindowKeydownShift(),this.unlistenWindowKeydownShift=null)}catch(r){this.loggingService.catch("Error in DomService unsubscribeFromWindowKeydownShift: ",r)}}onWindowKeyupShift(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeyupShift","color: green;");try{this.unsubscribeFromWindowKeyupShift(),this.unlistenWindowKeyupShift=this.renderer.listen("window","keyup.shift",()=>{this.isShiftKeyPressed=!1})}catch(r){this.loggingService.catch("Error in DomService onWindowKeyupShift: ",r)}}unsubscribeFromWindowKeyupShift(){try{this.unlistenWindowKeyupShift&&typeof this.unlistenWindowKeyupShift=="function"&&(this.unlistenWindowKeyupShift(),this.unlistenWindowKeyupShift=null)}catch(r){this.loggingService.catch("Error in DomService unsubscribeFromWindowKeyupShift: ",r)}}onWindowKeydown$(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowKeydown$","color: green;");try{return $i(window,"keydown")}catch(r){return this.loggingService.catch("Error in DomService onWindowKeydown$: ",r),rc}}addPointerMoveListener(){this.loggingService.log("%c[WB] Calling FUNCTION: addPointerMoveListener","color: green;");try{this.unsubscribeFromPointerMoveListener(),this.unlistenPointerMoveListener=this.renderer.listen("document","pointermove",r=>{this.windowPointerMove$.next(r),this.mouseMoveEvent=r})}catch(r){this.loggingService.catch("Error in DomService addPointerMoveListener: ",r)}}unsubscribeFromPointerMoveListener(){try{this.unlistenPointerMoveListener&&typeof this.unlistenPointerMoveListener=="function"&&(this.unlistenPointerMoveListener(),this.unlistenPointerMoveListener=null)}catch(r){this.loggingService.catch("Error in DomService unsubscribeFromPointerMoveListener: ",r)}}addPointerUpListener(){this.loggingService.log("%c[WB] Calling FUNCTION: addPointerUpListener","color: green;");try{this.unsubscribeFromPointerUpListener(),this.unlistenPointerUpListener=this.renderer.listen("document","pointerup",r=>{this.windowPointerUp$.next(r)})}catch(r){this.loggingService.catch("Error in DomService addPointerUpListener: ",r)}}unsubscribeFromPointerUpListener(){try{this.unlistenPointerUpListener&&typeof this.unlistenPointerUpListener=="function"&&(this.unlistenPointerUpListener(),this.unlistenPointerUpListener=null)}catch(r){this.loggingService.catch("Error in DomService unsubscribeFromPointerUpListener: ",r)}}addSelectionChangeListener(){this.loggingService.log("%c[WB] Calling FUNCTION: addPointerUpListener","color: green;");try{this.unsubscribeFromSelectionChangeListener(),this.unlistenSelectionChangeListener=this.renderer.listen("document","selectionchange",r=>{this.documentSelectionChange$.next(r)})}catch(r){this.loggingService.catch("Error in DomService addPointerUpListener: ",r)}}unsubscribeFromSelectionChangeListener(){try{this.unlistenSelectionChangeListener&&typeof this.unlistenSelectionChangeListener=="function"&&(this.unlistenSelectionChangeListener(),this.unlistenSelectionChangeListener=null)}catch(r){this.loggingService.catch("Error in DomService unsubscribeFromSelectionChangeListener: ",r)}}updateCurrentMousePosition(r){try{if(this.currentMousePosition.pageX=r.pageX,this.currentMousePosition.pageY=r.pageY,this.currentMousePosition.clientX=r.clientX,this.currentMousePosition.clientY=r.clientY,r.target){let i=this.getXPath(r.target),o=r.target;if(i?.includes("name()='svg'")){let h=this.getXPath(i);h&&(o=h.iterateNext()||r.target)}let s=o.getBoundingClientRect(),a=r.clientX-s.x,c=r.clientY-s.y,l=a*100/(s.width||1),d=c*100/(s.height||1);this.currentMousePosition.element={xpath:i,topPercentage:d,leftPercentage:l}}else this.currentMousePosition.element=null;this.currentMousePosition$.next(this.currentMousePosition)}catch(i){this.loggingService.catch("Error in DomService updateCurrentMousePosition: ",i)}}getTargetElementForCursorPosition(r,i=!0,o=!1,s=!0,a,c=!0,l,d){try{let h=r,f=h?.touches?.length?h.touches[0]?.clientX:h?.clientX,g=h?.touches?.length?h.touches[0]?.clientY:h?.clientY;l&&(f=l.clientX,g=l.clientY);let E=this.getBackgroundElement(f,g,i,o);if(E&&a&&typeof a=="function"&&(E=a(E)),E){let I=this.getXPath(E,!1,!1,void 0,d),S=this.getXPath(E,!0),R=E.getBoundingClientRect(),U=f-R.x,G=g-R.y,X=U*100/(R.width||1),ce=G*100/(R.height||1),ne={xpath:I,fXpath:S,leftPercentage:X,topPercentage:ce};if(s){let A=this.getXPath(E,!0,!0);ne.cfXpath=A}if(c){let A=this.generateAnchorRecord(E,d);A&&(ne.anchor=A)}return ne}else return null}catch(h){return this.loggingService.catch("Error in DomService getTargetElementForCommentPinAnnotation: ",h),null}}getBackgroundElement(r,i,o=!0,s=!1){try{let a=document.elementsFromPoint(r,i),c=[];a.forEach(d=>{ao(d)?c=[]:ld(d)&&c.push(d)}),s&&(c=c.filter(d=>this.isElementVisibleOnScreen(d)));let l=0;return o||c?.forEach((d,h)=>{d.tagName.toLowerCase()==="svg"&&(l=h)}),c[l]}catch(a){return this.loggingService.catch("Error in DomService getBackgroundElement: ",a),null}}getBackgroundVeltElement(r,i){try{let o=document.elementsFromPoint(r,i),s=[];return o.forEach(a=>{ao(a)&&ld(a)&&s.push(a)}),s[0]}catch(o){return this.loggingService.catch("Error in DomService getBackgroundSnippylyElement: ",o),null}}setPointerPosition(r){this.loggingService.log("%c[WB] Calling FUNCTION: setPointerPosition","color: green;");try{this.previousMousePosition.pageX=r.pageX,this.previousMousePosition.pageY=r.pageY,this.currentMousePosition.pageX=r.pageX,this.currentMousePosition.pageY=r.pageY}catch(i){this.loggingService.catch("Error in DomService setPointerPosition: ",i)}}getCurrentWindowSize$(r){return this.loggingService.log("%c[WB] Calling FUNCTION: getCurrentWindowSize","color: green;"),this.currentScreenSize$.asObservable()}getCurrentMousePosition$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getCurrentMousePosition","color: green;"),this.currentMousePosition$.asObservable()}getCurrentWindowSizeValue(){return this.loggingService.log("%c[WB] Calling FUNCTION: getCurrentWindowSizeValue","color: green;"),this.currentScreenSize$.value}getTopLeftPosition(){this.loggingService.log("%c[WB] Calling FUNCTION: getTopLeftPosition","color: green;");try{let r=document?.body?.getBoundingClientRect()||document?.documentElement?.getBoundingClientRect(),i=this.currentMousePosition?.pageX||r.x+200,o=Math.min(i,r.width/2),s=Math.abs(r.y),a=r.y-20;return s>50&&(a=Math.abs(r.y)+180),this.loggingService.log(r),this.loggingService.log(o),this.loggingService.log(a),{topPositionX:o,topPositionY:a}}catch(r){return this.loggingService.catch("Error in DomService getTopLeftPosition: ",r),{topPositionX:0,topPositionY:0}}}toggleSelection(){this.enableRectSelectionSubject$.next(!this.enableRectSelectionSubject$.value)}enableSelection(){this.enableRectSelectionSubject$.next(!0)}disableSelection(){this.enableRectSelectionSubject$.next(!1)}setPinHighlighterClass(r){this.pinHighlighterClass$.next(r)}setTextHighlighterClass(r){this.textHighlighterClass$.next(r)}getTextHighlighterClass(){return this.textHighlighterClass$.asObservable()}enableCommentPinHighlighter(){this.commentPinHighlighter$.next(!0)}disableCommentPinHighlighter(){this.commentPinHighlighter$.next(!1)}getCommentPinHighlighter$(){return this.commentPinHighlighter$.asObservable()}getCommentPinHighlighter(){return this.commentPinHighlighter$?.value}highlightElement(r,i,o){if(r&&!Gs(r)){if(!o&&this.getCommentPinHighlighter()&&(this.pinHighlighterClass$.value?this.addClassToElement(r,this.pinHighlighterClass$.value):this.addClassToElement(r,k.SNIPPYLY_HIGHLIGHT)),i&&!r.hasAttribute(k.ATTRIBUTES.DEFAULT_CURSOR)){let s=r.style.getPropertyValue("cursor"),a=r.style.getPropertyPriority("cursor"),c=s?{defaultCursorValue:s,defaultCursorPriority:a}:"";r.setAttribute(k.ATTRIBUTES.DEFAULT_CURSOR,c?JSON.stringify(c):""),r.style.setProperty("cursor",i,"important")}r.setAttribute(k.SNIPPYLY_HIGHLIGHT,"true"),r.setAttribute(k.VELT_IGNORE_CHANGE_DETECTION,"true")}}removeHighlightFromElement(r){if(r&&(this.pinHighlighterClass$.value&&this.removeClassFromElement(r,this.pinHighlighterClass$.value),this.removeClassFromElement(r,k.SNIPPYLY_HIGHLIGHT),r.removeAttribute(k.SNIPPYLY_HIGHLIGHT),r.removeAttribute(k.VELT_IGNORE_CHANGE_DETECTION),r.hasAttribute(k.ATTRIBUTES.DEFAULT_CURSOR))){try{if(r.style.removeProperty("cursor"),r.getAttribute(k.ATTRIBUTES.DEFAULT_CURSOR)){let i=JSON.parse(r.getAttribute(k.ATTRIBUTES.DEFAULT_CURSOR));r.style.setProperty("cursor",i.defaultCursorValue,i.defaultCursorPriority)}}catch{}r.removeAttribute(k.ATTRIBUTES.DEFAULT_CURSOR)}}highlightUserElement(r,i,o,s=!1){try{r&&(this.addClassToElement(r,k.VELT_LIVE_SELECTION_ON_ELEMENT),s&&this.addClassToElement(r,k.VELT_LIVE_SELECTION_ON_ELEMENT_DEFAULT),r.setAttribute(k.SNIPPYLY_HIGHLIGHT,"true"),r.setAttribute(k.VELT_IGNORE_CHANGE_DETECTION,"true"),i&&!r.style.getPropertyValue(k.VELT_SELECTION_COLOR)&&r.style.setProperty(k.VELT_SELECTION_COLOR,i),o&&r.setAttribute(k.SNIPPYLY_HIGHLIGHT_USER_NAME,o))}catch(a){this.loggingService.catch("Error in DomService highlightUserElement: ",a)}}removeHighlightUserFromElement(r){try{r&&(this.removeClassFromElement(r,k.VELT_LIVE_SELECTION_ON_ELEMENT),this.removeClassFromElement(r,k.VELT_LIVE_SELECTION_ON_ELEMENT_DEFAULT),r.removeAttribute(k.SNIPPYLY_HIGHLIGHT),r.removeAttribute(k.VELT_IGNORE_CHANGE_DETECTION),r.removeAttribute(k.VELT_SELECTION_COLOR),r.removeAttribute(k.SNIPPYLY_HIGHLIGHT_USER_NAME),r.style.removeProperty(k.VELT_SELECTION_COLOR))}catch(i){this.loggingService.catch("Error in DomService removeHighlightUserFromElement: ",i)}}previewHighlightElement(r){r&&r.setAttribute(k.SNIPPYLY_HIGHLIGHT_PREVIEW,"true")}removePreviewHighlightFromElement(r){r&&r.removeAttribute(k.SNIPPYLY_HIGHLIGHT_PREVIEW)}getXPath(r,i=!1,o=!1,s,a){try{let c=this.calculateXPath(r,i,o,s,a);if(c&&typeof c=="string"&&c.includes("/svg")){let l=c.split("/"),d=!1;l.forEach((h,f)=>{h.includes("svg")&&(d=!0),d&&(l[f]="svg:"+h)}),c=l.join("/")}return c}catch(c){this.loggingService.catch("Error in DomService getXPath:",c)}}namespaceResolver(r){return r==="svg"?"http://www.w3.org/2000/svg":null}calculateXPath(r,i,o,s,a){try{if(r){if(typeof r=="string")return document.evaluate(r,s||document,this.namespaceResolver,XPathResult.ANY_TYPE,null);if(!r||r.nodeType!=1)return"";if(r.id&&document.querySelectorAll(`[id='${r.id}']`)?.length===1&&!i&&!(a?.ignoreGeneratedIds&&this.isGeneratedId(r.id)))return"//*[@id='"+r.id+"']";if(o&&r.className&&r.className.split){let l=r.className?.split(" ")?.filter(d=>!d?.includes("snippyly")&&!d?.includes("velt")&&!["show-pin-cursor"].includes(d))[0];if(l){let d=this.calculateXPath(r.parentNode,i,o,s,a)+"/"+r.tagName.toLowerCase(),h=Array.from(r.parentNode?.children||[]).filter(f=>f.nodeType===1&&f.tagName===r.tagName?f.className?.split(" ")?.filter(E=>E?.includes("snippyly")||E?.includes("velt")||["show-pin-cursor"].includes(E))[0]===l:!1);if(h.length>1){let f=h.indexOf(r)+1;d+=`[contains(concat(' ', normalize-space(@class), ' '), ' ${l} ')][${f}]`}else d+=`[contains(concat(' ', normalize-space(@class), ' '), ' ${l} ')]`;return d}}let c=[].filter.call(r.parentNode?.children?r.parentNode?.children:[],function(l){return l.tagName==r.tagName});return this.calculateXPath(r.parentNode,i,o,void 0,a)+"/"+r.tagName.toLowerCase()+(c.length>1?"["+([].indexOf.call(c,r)+1)+"]":"")}}catch(c){this.loggingService.catch("Error in DomService calculateXPath:",c)}}getElementFromXPath(r,i=document){try{if(this.xpathCache.has(r)){let s=this.xpathCache.get(r);if(s!==void 0&&document.contains(s))return s;this.xpathCache.delete(r)}let o=this.getXPath(r,!1,!1,i);if(o){let s=o?.iterateNext();if(s!==null&&typeof s.setAttribute=="function"&&!Gs(s)){let a=$c();s.setAttribute(k.ATTRIBUTES.VELT_ELEMENT_CACHE_ID,a),this.xpathCacheId.set(a,r)}return this.xpathCache.set(r,s),s}return null}catch(o){return this.loggingService.catch("Error in DomService getElementFromXPath:",o),null}}getElementFromXPathAccepted(r,i){let o=this.getElementFromXPath(r);if(!i||!o||Wp(i,o,this.loggingService))return o;try{let s=this.getXPath(r,!1,!1,document)?.iterateNext();if(s&&s!==o&&Wp(i,s,this.loggingService)){if(typeof s.setAttribute=="function"&&!Gs(s)){let a=$c();s.setAttribute(k.ATTRIBUTES.VELT_ELEMENT_CACHE_ID,a),this.xpathCacheId.set(a,r)}return this.xpathCache.set(r,s),s}}catch(s){this.loggingService.catch("Error in DomService getElementFromXPathAccepted:",s)}return o}getElementFromTargetElement(r){try{let i=null;if(r?.anchor){let o=this.resolveAnchorRecord(r.anchor);o?.element&&(i=o.element)}else r?.xpath?i=this.getElementFromXPath(r.xpath):r?.cfXpath?i=this.getElementFromXPath(r.cfXpath):r?.fXpath&&(i=this.getElementFromXPath(r.fXpath));return i}catch(i){return this.loggingService.catch("Error in DomService getElementFromTargetElement:",i),null}}resolveIdScopedTarget(r){try{let i=r?.anchor?.xPath||r?.xpath,o=pb(i);if(!i||!o||this.isGeneratedId(o.rootId))return{applicable:!1,element:null};let s=this.getUniqueElementById(o.rootId);if(!s||!this.isElementVisible(s)||!ld(s))return{applicable:!0,element:null};let a=d=>!!d&&s.contains(d)&&this.isElementVisible(d),c=this.getElementFromXPath(i);if(a(c))return{applicable:!0,element:c,matchedBy:"exact"};let l=r?.anchor?.robustXPath;if(l&&pb(l)?.rootId===o.rootId){let d=this.getElementFromRobustXPath(l);if(a(d))return{applicable:!0,element:d,matchedBy:"robust"}}return{applicable:!0,element:s,matchedBy:"root"}}catch(i){return this.loggingService.catch("Error in DomService resolveIdScopedTarget: ",i),{applicable:!1,element:null}}}getUniqueElementById(r){try{let i=document.querySelectorAll(`[id="${CSS.escape(r)}"]`);return i.length===1?i[0]:null}catch{return null}}getElementFromTargetTextRange(r){try{let i=null;if(r?.commonAncestorContainerAnchor){let o=this.resolveAnchorRecord(r.commonAncestorContainerAnchor);o?.element&&(i=o.element)}else r?.commonAncestorContainer&&(i=this.getElementFromXPath(r.commonAncestorContainer));return i}catch(i){return this.loggingService.catch("Error in DomService getElementFromTargetTextRange:",i),null}}calculateScreenSize(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowResize","color: green;");try{let r=[document?.body?.clientHeight||0,document?.documentElement?.clientHeight||0,window?.innerHeight||0],i=[document?.body?.clientWidth||0,document?.documentElement?.clientWidth||0,window?.innerWidth||0];this.calculatePageScrollHeight(),this.loggingService.log(this.pageScrollHeight);let o=new up;return o.screenWidth=Math.max(...i),o.screenHeight=Math.max(...r),o.screenScrollHeight=this.pageScrollHeight,o}catch(r){return this.loggingService.catch("Error in DomService calculateScreenSize:",r),new up}}calculatePageScrollHeight(){this.loggingService.log("%c[WB] Calling FUNCTION: calculatePageScrollHeight","color: green;");try{this.pageScrollHeight=0,this.highestNode=void 0;let r=this.findLongestNode(document?.documentElement?.childNodes);this.highestNode=r?new WeakRef(r):void 0}catch(r){this.loggingService.catch("Error in DomService calculatePageScrollHeight: ",r)}}removeSnippylyContent(r){this.loggingService.log("%c[WB] Calling FUNCTION: removeSnippylyContent","color: green;");try{let o=new DOMParser().parseFromString(r,"text/html");o.querySelectorAll("[data-snippyly-cache-id]").forEach(f=>{f.removeAttribute("data-snippyly-cache-id")}),o.querySelectorAll("[data-velt-cache-id]").forEach(f=>{f.removeAttribute("data-velt-cache-id")}),o.querySelectorAll(".comment-text-highlight").forEach(f=>{f?.parentNode?.insertBefore(document.createTextNode(f?.textContent),f),f.remove()});let l=document.createNodeIterator(o,NodeFilter.SHOW_COMMENT),d;for(;d=l.nextNode();)d?.remove();return this.mergeAdjacentTextNodes(o.body),this.sanitizeHtml(o.body.innerHTML)}catch(i){return this.loggingService.catch("Error in DomService removeSnippylyContent: ",i),r}}mergeAdjacentTextNodes(r){try{let i=r.firstChild;for(;i;){if(i.nodeType===Node.TEXT_NODE){let o=i.nextSibling;for(;o&&o.nodeType===Node.TEXT_NODE;)i.textContent+=o.textContent,o.remove(),o=i.nextSibling}i=i.nextSibling}}catch(i){this.loggingService.catch("Error in DomService mergeAdjacentTextNodes: ",i)}}findLongestNode(r){let i;try{for(let o=r.length-1;o>=0;o--){if(r[o]?.scrollHeight&&r[o]?.clientHeight){let s=Math.max(r[o]?.scrollHeight,r[o]?.clientHeight);s>=this.pageScrollHeight&&(this.pageScrollHeight=s,i=r[o])}r[o]?.childNodes?.length&&(i=this.findLongestNode(r[o]?.childNodes)??i)}}catch(o){this.loggingService.catch("Error in DomService findLongestNode: ",o)}return i}resetSelectedAnnotationsMap(r=!0,i){try{let s=this.getDraftAnnotationRefs().map(d=>d.classList.contains("velt-annotation-draft-checked")?(d.classList.remove("velt-annotation-draft-checked"),null):(this.removeClassFromElement(d,"velt-comment-dialog-shake"),setTimeout(()=>{this.addClassToElement(d,"velt-comment-dialog-shake"),d.getAttribute(k.ATTRIBUTES.VELT_ANNOTATION_EDIT_COMMENT)||d.classList.contains("velt-annotation-draft-checked")||this.addClassToElement(d,"velt-annotation-draft-checked")},100),d.getAttribute(k.ATTRIBUTES.VELT_ANNOTATION_DRAFT))).filter(d=>d),a=Object.keys(this.getRecordingInProgress()||{});s=[...s,...a];let c=this.selectedAnnotationsMap$.value;if(r&&this.selectedAnnotationsMap$.value&&Object.keys(this.selectedAnnotationsMap$.value).length){let d=[];Object.keys(c).forEach(h=>{if(c[h]?.type==="tag"){let f=c[h];f?.to?.length||s.includes(h)||d.push(f)}else c[h]?.comments?.length||s.includes(h)||d.push(c[h])}),this.deleteAnnotations$.next(d),this.deleteAnnotations$.next([])}let l={};Object.keys(c).forEach(d=>{s.includes(d)&&(l[d]=c[d]),i&&(i==="comment"?["comment","videoPin"].includes(c[d]?.type)||(l[d]=c[d]):c[d]?.type!==i&&(l[d]=c[d]))}),Object.keys(l).forEach(d=>{let h=l[d]?.multiThreadAnnotationId;h&&!l[h]&&(l[h]={annotationId:h,type:"multiThread"})}),JSON.stringify(this.selectedAnnotationsMap$.value)!==JSON.stringify(l)&&this.selectedAnnotationsMap$.next(l),this.setDialogOpenedInSidebar(!1)}catch(o){this.loggingService.catch("Error in DomService resetSelectedAnnotationsMap: ",o)}}getDraftAnnotationRefs(){let r=Array.from(document.querySelectorAll(`[${k.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`));return r.push(...this.getDraftCommentAnnotationDialogs()||[]),Array.from(new Set(r))}isEmptyDraftAnnotation(r){try{let i=this.selectedAnnotationsMap$.value?.[r];if(!i||i.type==="tag"||i.type==="multiThread"||i.comments?.length||Object.prototype.hasOwnProperty.call(this.getRecordingInProgress()||{},r))return!1;let o=this.readAnnotationDraftContent(r);return o!==void 0?!o:!this.getDraftAnnotationRefs().some(s=>s.getAttribute(k.ATTRIBUTES.VELT_ANNOTATION_DRAFT)===r)}catch(i){return this.loggingService.catch("Error in DomService isEmptyDraftAnnotation: ",i),!1}}registerAnnotationDraftContentReader(r){this.annotationDraftContentReader=r}readAnnotationDraftContent(r){try{return this.annotationDraftContentReader?.(r)}catch(i){this.loggingService.catch("Error in DomService readAnnotationDraftContent: ",i);return}}discardEmptyDraftAnnotation(r){try{let i=this.selectedAnnotationsMap$.value||{};if(!r||!this.isEmptyDraftAnnotation(r))return!1;this.deleteAnnotations$.next([i[r]]),this.deleteAnnotations$.next([]);let o=V({},i);return delete o[r],this.selectedAnnotationsMap$.next(o),!0}catch(i){return this.loggingService.catch("Error in DomService discardEmptyDraftAnnotation: ",i),!1}}setRecordingInProgress(r,i){try{if(i)this.recordingInProgress$.next(le(V({},this.recordingInProgress$.value),{[r]:i}));else{let o=this.recordingInProgress$.value;delete o[r],this.recordingInProgress$.next(o)}}catch(o){this.loggingService.catch("Error in DomService setRecordingInProgress: ",o)}}resetRecordingInProgress(){try{this.recordingInProgress$.next({})}catch(r){this.loggingService.catch("Error in DomService resetRecordingInProgress: ",r)}}getRecordingInProgress(){try{return this.recordingInProgress$.value}catch(r){return this.loggingService.catch("Error in DomService getRecordingInProgress: ",r),{}}}getDraftCommentAnnotationDialogs(){try{let r=[],i=Array.from(document.querySelectorAll(`${k.TAGS.SNIPPYLY_COMMENT_DIALOG}`)),o=Array.from(document.querySelectorAll(`${k.TAGS.VELT_COMMENT_DIALOG}`));return[...i,...o].forEach(a=>{if(a?.shadowRoot){let c=a.shadowRoot.querySelector(`[${k.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);c&&r.push(c)}else{let c=a.querySelector(`${k.TAGS.VELT_SHADOW_DOM_INTERNAL}`);if(c?.shadowRoot){let l=c.shadowRoot?.querySelector(`[${k.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);l&&r.push(l)}else{let l=a.querySelector(`[${k.ATTRIBUTES.VELT_ANNOTATION_DRAFT}]`);l&&r.push(l)}}}),r}catch(r){return this.loggingService.catch("Error in DomService getDraftCommentAnnotationDialogs: ",r),[]}}getSelectedAnnotationsMap(r){try{let i=this.selectedAnnotationsMap$.value;if(r){let o={};return Object.keys(i).forEach(s=>{r==="comment"?["comment","videoPin"].includes(i[s].type)&&(o[s]=i[s]):i[s].type===r&&(o[s]=i[s])}),o}else return i}catch(i){return this.loggingService.catch("Error in DomService getSelectedAnnotationsMap: ",i),{}}}getSelectedAnnotationsMap$(r){return this.selectedAnnotationsMap$.asObservable().pipe(De(i=>{if(r){let o={};return Object.keys(i).forEach(s=>{i[s].type===r&&(o[s]=i[s])}),o}else return i}))}getSelectedComments$(){return this.selectedAnnotationsMap$.asObservable().pipe(De(r=>Object.values(r)))}getSelectedAnnotationsLocationMap(){try{return this.selectedAnnotationsLocationMap$.value}catch(r){return this.loggingService.catch("Error in DomService getSelectedAnnotationsLocationMap: ",r),{}}}getSelectedAnnotationsLocationMap$(){return this.selectedAnnotationsLocationMap$.asObservable()}getSelectedAnnotationsContextIdMap(){try{return this.selectedAnnotationsContextIdMap$.value}catch(r){return this.loggingService.catch("Error in DomService getSelectedAnnotationsContextIdMap: ",r),{}}}getSelectedAnnotationsContextIdMap$(){return this.selectedAnnotationsContextIdMap$.asObservable()}toggleAnnotationSelection(r,i,o,s=!1,a,c){try{o==="sidebarShowReplies"?this.setDialogOpenedInSidebar(!0):this.setDialogOpenedInSidebar(!1);let l=JSON.parse(JSON.stringify(this.selectedAnnotationsMap$.value||{})),d=JSON.parse(JSON.stringify(this.selectedAnnotationsLocationMap$.value||{})),h=JSON.parse(JSON.stringify(this.selectedAnnotationsContextIdMap$.value||{}));l[r.annotationId]&&!s?delete l[r.annotationId]:((!this.isShiftKeyPressed||s)&&(l={}),l[r.annotationId]=r,d[r.annotationId]=i,c&&(h[r.annotationId]=c),a=r?.multiThreadAnnotationId||a,a&&(l[a]={annotationId:a,type:"multiThread"},d[a]=i,c&&(h[a]=c))),this.selectedAnnotationsMap$.next(l),Object.keys(d).forEach(f=>{l[f]||delete d[f]}),this.selectedAnnotationsLocationMap$.next(d),Object.keys(h).forEach(f=>{l[f]||delete h[f]}),this.selectedAnnotationsContextIdMap$.next(h)}catch(l){this.loggingService.catch("Error in DomService toggleAnnotationSelection: ",l)}}setSelectedAnnotationLocation(r,i){try{let o=JSON.parse(JSON.stringify(this.getSelectedAnnotationsLocationMap()||{}));o?.[r]!==i&&(o[r]=i,this.selectedAnnotationsLocationMap$.next(o))}catch(o){this.loggingService.catch("Error in DomService setSelectedAnnotationLocation: ",o)}}updateSelectedAnnotationInMap(r){try{let i=this.selectedAnnotationsMap$.value;r.forEach(o=>{i[o.annotationId]&&(i[o.annotationId]=o)}),this.selectedAnnotationsMap$.next(i)}catch(i){this.loggingService.catch("Error in DomService updateSelectedAnnotationInMap: ",i)}}getDeleteCommmentAnnotations$(){try{return this.deleteAnnotations$.asObservable()}catch(r){return this.loggingService.catch("Error in DomService getDeleteCommmentAnnotations$: ",r),st([])}}getHighestNode(){return this.loggingService.log("%c[WB] Calling FUNCTION: getHighestNode","color: green;"),this.highestNode?.deref()}onWindowMouseDown$(){return this.windowMouseDown$.asObservable()}onWindowPointerMove$(){return this.windowPointerMove$.asObservable()}onWindowPointerMove(){return this.windowPointerMove$.value}onWindowPointerUp$(){return this.windowPointerUp$.pipe(rn(null))}onSelectionChange$(){return this.documentSelectionChange$.pipe(rn(null))}onWindowClick$(){return this.windowClick$.pipe(rn(null))}onWindowScroll$(){return this.windowScroll$.asObservable()}onWindowResize$(){return this.windowResize$.asObservable()}onWindowKeyupBackspace$(){return this.windowKeyupBackspace$.pipe(rn(null))}onWindowKeyupDelete$(){return this.windowKeyupDelete$.pipe(rn(null))}onWindowKeyupEsc$(){return this.windowKeyupEsc$.pipe(rn(null))}onWindowPopState$(){return this.windowPopState$.asObservable()}onDocumentClick$(){return this.documentClick$.pipe(rn(null))}getLastDocumentClickTarget(){return this.lastDocumentClickTarget?.deref()??null}onDocumentClickSubject$(){return this.documentClickSubject$.asObservable()}onDocumentFocus$(){return this.documentFocus$.pipe(rn(null))}onDomChange$(r){try{return this.mutationObserver||this.setMutationObserver(r),this.mutation$.pipe(rn(null))}catch(i){return this.loggingService.catch("Error in DomService onDomChange$: ",i),st([])}}getChildListMutation$(){return this.childListMutation$.pipe(rn(null))}onNetworkStatusChange$(){return this.networkStatus$.asObservable()}getNetworkStatus(){return this.networkStatus$.value}getElementOffset(r,i){try{let o={offsetTop:0,offsetLeft:0},s=r;if(s===i){let a=window.getComputedStyle(r);a.position==="static"&&a.transformStyle!="preserve-3d"&&a.transform=="none"&&(o.offsetLeft=r?.offsetLeft||0,o.offsetTop=r?.offsetTop||0)}if(s!==i)if(r?.closest("svg"))for(;s&&s!==i;){let c=window.getComputedStyle(s);if(s.tagName.toLowerCase()==="svg"||s instanceof SVGElement){let l=s.parentElement;if(l){let d=l.getBoundingClientRect(),h=s.getBoundingClientRect();o.offsetLeft+=h.left-d.left,o.offsetTop+=h.top-d.top}}else c.position==="static"?c.transformStyle!="preserve-3d"&&c.transform=="none"&&(o.offsetLeft+=s?.offsetLeft||0,o.offsetTop+=s?.offsetTop||0):(o.offsetLeft+=s.offsetLeft,o.offsetTop+=s.offsetTop);if(s=s.parentElement,r instanceof SVGElement&&s===i){let l=window.getComputedStyle(s);l.position==="static"&&l.transformStyle!="preserve-3d"&&l.transform=="none"&&(o.offsetLeft+=s?.offsetLeft||0,o.offsetTop+=s?.offsetTop||0)}}else{let c=window.getComputedStyle(s);c.position==="static"?c.transformStyle!="preserve-3d"&&c.transform=="none"&&(o.offsetLeft+=s?.offsetLeft||0,o.offsetTop+=s?.offsetTop||0):(o.offsetLeft+=s.offsetLeft,o.offsetTop+=s.offsetTop)}return o}catch(o){return this.loggingService.catch("Error in DomService getElementOffset: ",o),{offsetTop:0,offsetLeft:0}}}isElementVisible(r){try{if(typeof r?.getBoundingClientRect=="function"){let{width:i,height:o,top:s,bottom:a}=r?.getBoundingClientRect();return i>0||o>0||s<window.innerHeight&&a>0}else return!1}catch(i){return this.loggingService.catch("Error in DomService isElementVisible: ",i),!1}}isElementVisibleOnScreen(r){try{if(r){if(!(r instanceof Element))return!1;let i=r,o=window.getComputedStyle(i);return!(o.display==="none"||o.visibility==="hidden"||parseFloat(o.opacity)===0)}return!1}catch(i){return this.loggingService.catch("Error in DomService isElementVisibleOnScreen: ",i),!1}}getClickAndDragPointsObservable(){return new he(r=>{let i=$i(document,"mousedown").pipe(De(l=>({type:l.type,x:l.clientX+window.scrollX,y:l.clientY+window.scrollY,event:l}))),o=$i(document,"mousemove").pipe(De(l=>({type:l.type,x:l.clientX+window.scrollX,y:l.clientY+window.scrollY,event:l}))),s=$i(document,"mouseup").pipe(De(l=>({type:l.type,x:l.clientX+window.scrollX,y:l.clientY+window.scrollY,event:l}))),c=i.pipe(Zn(l=>o.pipe(ac(),De(([d,h])=>({startPoint:l,prevPoint:d,curPoint:h})),Is(s)))).subscribe(r);return()=>c.unsubscribe()})}drawRectangle(r,i){let o=document.querySelector(".rectangle");o||(o=document.createElement("div"),this.addClassToElement(o,"rectangle"),o.setAttribute(k.ATTRIBUTES.VELT_COMMENT_DISABLED,"true"),o.setAttribute(k.VELT_IGNORE_CHANGE_DETECTION,"true"),document.body.appendChild(o));let s=Math.abs(i.x-r.x),a=Math.abs(i.y-r.y),c=Math.min(r.x,i.x),l=Math.min(r.y,i.y);return o.style.width=`${s}px`,o.style.height=`${a}px`,o.style.left=`${c}px`,o.style.top=`${l}px`,o.style.position="absolute",o.style.border="2px dashed #f00",o.style.pointerEvents="none",o.style.zIndex="2147483577",o}getRange(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: getRange","color: green;"),window.getSelection()?.toString()){let r=window.getSelection();if(r?.rangeCount)return r.getRangeAt(0)}return null}catch(r){return this.loggingService.catch("Error in DomService getRange: ",r),null}}clearTextSelection(){try{this.loggingService.log("%c[WB] Calling FUNCTION: clearTextSelection","color: green;"),window.getSelection&&(window.getSelection()?.empty?window.getSelection()?.empty():window.getSelection()?.removeAllRanges&&window.getSelection()?.removeAllRanges())}catch(r){this.loggingService.catch("Error in DomService clearTextSelection: ",r)}}getTargetTextRangeFromSelectionRange(r){try{let i={},o=r.commonAncestorContainer;o?.nodeType===Node.TEXT_NODE&&(o=o.parentElement);let s=document.body;if(o){let c=this.getTextXPath(o);this.isXpathWithId(c)&&(s=o)}let a=this.getAdditionalLocationContainer(o);if(a&&(s=a),i.commonAncestorContainer=this.getTextXPath(s),i.commonAncestorContainer){let c=this.getElementFromXPath(i.commonAncestorContainer);if(c){i.commonAncestorContainerFXpath=this.getXPath(c,!0),i.commonAncestorContainerCFXpath=this.getXPath(c,!0,!0);let l=this.generateAnchorRecord(c);l&&(i.commonAncestorContainerAnchor=l)}}return i.text=r.toString(),i.occurrence=kR(s,0,r.startContainer,r.startOffset,r.toString())+1,i}catch(i){this.loggingService.catch("Error in DomService getTargetTextRangeFromSelectionRange: ",i);return}}getTextXPath(r){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: getTextXPath","color: green;"),r.nodeType===Node.TEXT_NODE){let i=1,o=r.previousSibling;for(;o;)o.nodeType===Node.TEXT_NODE&&i++,o=o.previousSibling;return this.getXPath(r.parentElement)}else return this.getXPath(r)}catch(i){this.loggingService.catch("Error in DomService getTextXPath: ",i);return}}getHostElement(r){try{if(k.NON_NESTABLE_ELEMENTS[r?.tagName?.toLowerCase()]){let o=r?.closest("picture");return o?o?.parentElement:r.parentElement}let i=r.closest("svg");return i?i?.parentElement:r}catch(i){return this.loggingService.catch("Error in DomService getHostElement: ",i),r}}isElementInsideAdditionalLocationContainer(r){try{return!!r?.closest(`[${k.ATTRIBUTES.VELT_LOCATION}], [${k.ATTRIBUTES.VELT_LOCATION_ID}]`)}catch(i){return this.loggingService.catch("Error in DomService isElementInsideAdditionalLocationContainer: ",i),!1}}getAdditionalLocationContainer(r){try{return r?.closest(`[${k.ATTRIBUTES.VELT_LOCATION}], [${k.ATTRIBUTES.VELT_LOCATION_ID}]`)||null}catch(i){return this.loggingService.catch("Error in DomService getAdditionalLocationContainer: ",i),null}}isXpathWithId(r){try{return typeof r=="string"?!!r?.includes("[@id="):!1}catch(i){return this.loggingService.catch("Error in DomService isXpathWithId: ",i),!1}}getListedElements({elementIds:r,elementClassNames:i,elementQuerySelectors:o}){try{let s=[];if(r?.length)for(let a=0;a<r.length;a++){let c=document.getElementById(r[a]);c&&s.push(c)}if(i?.length)for(let a=0;a<i.length;a++){let c=document.getElementsByClassName(i[a]);for(let l=0;l<c.length;l++){let d=c[l];d&&d instanceof HTMLElement&&s.push(d)}}if(o?.length)for(let a=0;a<o.length;a++){let c=document.querySelectorAll(o[a]);for(let l=0;l<c.length;l++){let d=c[l];d&&d instanceof HTMLElement&&s.push(d)}}return s}catch(s){return this.loggingService.catch("Error in DomService getListedElements: ",s),[]}}isElementInsideListedElementIds(r,i){try{if(i?.length){for(let o=0;o<i.length;o++){let s=document.getElementById(i[o]);if(s&&s.contains(r))return!0}return!1}return!0}catch(o){return this.loggingService.catch("Error in DomService isElementInsideListedElementIds: ",o),!1}}isElementInsideListedElementClassNames(r,i){try{if(i?.length){for(let o=0;o<i.length;o++){let s=document.getElementsByClassName(i[o]);for(let a=0;a<s.length;a++)if(s[a].contains(r))return!0}return!1}return!0}catch(o){return this.loggingService.catch("Error in DomService isElementInsideListedElementClassNames: ",o),!1}}isElementInsideListedElementQuerySelectors(r,i){try{if(i?.length){for(let o=0;o<i.length;o++){let s=document.querySelectorAll(i[o]);for(let a=0;a<s.length;a++)if(s[a].contains(r))return!0}return!1}return!0}catch(o){return this.loggingService.catch("Error in DomService isElementInsideListedElementQuerySelectors: ",o),!1}}addClassToElement(r,i){try{this.loggingService.log("%c[WB] Calling FUNCTION: addClassToElement","color: green;"),r&&(r.classList?.contains(i)||r.classList?.add(i))}catch(o){this.loggingService.catch("Error in DomService addClassToElement: ",o)}}removeClassFromElement(r,i){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeClassFromElement","color: green;"),r&&r.classList?.contains(i)&&r.classList?.remove(i)}catch(o){this.loggingService.catch("Error in DomService removeClassFromElement: ",o)}}isElementInsideParentWithAttribute(r,i,o){try{let s=r;for(;s&&s!==document.body;){if(s?.getAttribute&&s?.getAttribute(i)===o)return!0;s=s.parentElement}return!1}catch(s){return this.loggingService.catch("Error in DomService isElementInsideParentWithAttribute: ",s),!1}}setVideoEditorHandlingDelete(r){try{this.isVideoEditorHandlingDelete=r}catch(i){this.loggingService.catch("Error in DomService setVideoEditorHandlingDelete: ",i)}}isVideoEditorHandlingDeleteKey(){try{return this.isVideoEditorHandlingDelete}catch(r){return this.loggingService.catch("Error in DomService isVideoEditorHandlingDeleteKey: ",r),!1}}setCustomCss(r){try{this.loggingService.log("%c[WB] Calling FUNCTION: setCustomCss","color: green;"),this.customCss$.next(r)}catch(i){this.loggingService.catch("Error in DomService setCustomCss: ",i)}}getCustomCss$(){try{return this.loggingService.log("%c[WB] Calling FUNCTION: getCustomCss$","color: green;"),this.customCss$.asObservable()}catch(r){return this.loggingService.catch("Error in DomService getCustomCss$: ",r),st(null)}}injectCustomCss(r){try{this.loggingService.log("%c[WB] Calling FUNCTION: injectCustomCss","color: green;");let i=this.customCss$.value;if(i){let o=r?.shadowRoot?.querySelector(`[${k.VELT_CUSTOM_CSS}]`);if(o&&o.remove(),i?.type==="link"){let s=document.createElement("link");s.href=i?.value,s.rel="stylesheet",s.setAttribute(k.VELT_CUSTOM_CSS,"true"),r?.shadowRoot?.appendChild(s)}else{let s=document.createElement("style");s.innerHTML=this.sanitizeHtml(i?.value),s.setAttribute(k.VELT_CUSTOM_CSS,"true"),r?.shadowRoot?.appendChild(s)}}}catch(i){this.loggingService.catch("Error in DomService injectCustomCss: ",i)}}subscribeInjectCustomCss(r){try{return this.customCss$.subscribe(()=>{this.injectCustomCss(r?.nativeElement)})}catch(i){return this.loggingService.catch("Error in DomService subscribeInjectCustomCss: ",i),new mt}}trimCommentHtml(r){try{let i=this.parseHtmlInInertDocument(r);this.removeEmptyElements(i);let o=i.innerHTML;return o=o.replace(e.MULTIPLE_NBSP_REGEX," ").replace(e.TRIM_NBSP_REGEX,"").trim(),o}catch(i){return this.loggingService.catch("Error in DomService trimCommentHtml: ",i),r}}removeEmptyElements(r){try{let s=function(a){return o.test(a.innerHTML)};var i=s;let o=/^\s*(<br\s*\/?>)?\s*$/;for(;r.firstChild&&s(r.firstChild);)r.removeChild(r.firstChild);for(;r.lastChild&&s(r.lastChild);)r.removeChild(r.lastChild)}catch(o){this.loggingService.catch("Error in DomService removeEmptyElements: ",o)}}normalizeWhitespace(r){try{r.childNodes.forEach(i=>{i.nodeType===Node.TEXT_NODE?i.nodeValue=i.nodeValue?.replace(/\s+/g," ").trim()??"":i.nodeType===Node.ELEMENT_NODE&&this.normalizeWhitespace(i)})}catch(i){this.loggingService.catch("Error in DomService normalizeWhitespace: ",i)}}sanitizeHtml(r){try{return this.loggingService.log("%c[WB] Calling FUNCTION: sanitizeHtml","color: green;"),Ly.sanitize(r,lj)}catch(i){return this.loggingService.catch("Error in DomService sanitizeHtml: ",i),""}}sanitizeHtmlForPaste(r){try{let i=this.convertStylesToTags(r);return Ly.sanitize(i,{ALLOWED_TAGS:["b","strong","i","em","u","a","br"],ALLOWED_ATTR:["href","target","rel"]})}catch(i){return this.loggingService.catch("Error in DomService sanitizeHtmlForPaste: ",i),""}}parseHtmlInInertDocument(r){let o=document.implementation.createHTMLDocument("").createElement("div");return o.innerHTML=r,o}convertStylesToTags(r){try{let i=this.parseHtmlInInertDocument(r);return this.convertBlockElementsToBr(i),this.processNodeStyles(i),i.innerHTML}catch(i){return this.loggingService.catch("Error in DomService convertStylesToTags: ",i),r}}convertBlockElementsToBr(r){try{let i=["P","DIV","H1","H2","H3","H4","H5","H6","LI","BLOCKQUOTE","PRE","SECTION","ARTICLE","HEADER","FOOTER"],o;for(;(o=r.querySelector(i.join(",")))!==null;){let s=o.parentNode;if(!s)break;for(;o.firstChild;)s.insertBefore(o.firstChild,o);o.nextSibling&&s.insertBefore(r.ownerDocument.createElement("br"),o),s.removeChild(o)}}catch(i){this.loggingService.catch("Error in DomService convertBlockElementsToBr: ",i)}}processNodeStyles(r){try{let i=Array.from(r.childNodes);for(let o of i)if(o.nodeType===Node.ELEMENT_NODE){this.processNodeStyles(o);let s=o,a=s.ownerDocument,c=s.style,l=o,d=c?.fontWeight;if(d==="bold"||d==="700"||d==="800"||d==="900"){let h=s.tagName?.toLowerCase();if(h!=="b"&&h!=="strong"){let f=a.createElement("b");l.parentNode.insertBefore(f,l),f.appendChild(l),l=f}}if(c?.fontStyle==="italic"){let h=s.tagName?.toLowerCase();if(h!=="i"&&h!=="em"){let f=a.createElement("i");l.parentNode.insertBefore(f,l),f.appendChild(l),l=f}}if((c?.textDecorationLine?.includes("underline")||c?.textDecoration?.includes("underline"))&&s.tagName?.toLowerCase()!=="u"){let f=a.createElement("u");l.parentNode.insertBefore(f,l),f.appendChild(l),l=f}}}catch(i){this.loggingService.catch("Error in DomService processNodeStyles: ",i)}}sanitizeSvg(r){try{return Ly.sanitize(r,lj)}catch(i){return this.loggingService.catch("Error in DomService sanitizeSvg: ",i),r}}setDeviceInfo(){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDeviceInfo","color: green;");let r=new Wr;this.deviceInfo$.next(r)}catch(r){this.loggingService.catch("Error in DomService setDeviceInfo: ",r)}}getDeviceInfo$(){try{return this.loggingService.log("%c[WB] Calling FUNCTION: getDeviceInfo$","color: green;"),this.deviceInfo$.asObservable()}catch(r){return this.loggingService.catch("Error in DomService getDeviceInfo$: ",r),st(new Wr)}}getTabId(){try{let r=sessionStorage.getItem(k.SESSION_STORAGE.VELT_TAB_ID);!r&&this.tabId&&(r=this.tabId,sessionStorage.setItem(k.SESSION_STORAGE.VELT_TAB_ID,r)),!this.tabId&&r&&(this.tabId=r);let i=this.getTabIdFromWindowName();return(!r||r!==i)&&(r=$c(),this.tabId=r,sessionStorage.setItem(k.SESSION_STORAGE.VELT_TAB_ID,r),this.setTabIdToWindowName(r)),r}catch(r){return this.loggingService.catch("Error in DomService getTabId: ",r),null}}getTabIdFromWindowName(){try{return window.name}catch(r){return this.loggingService.catch("Error in DomService getTabIdFromWindowName: ",r),null}}setTabIdToWindowName(r){try{window.name=r}catch(i){this.loggingService.catch("Error in DomService setTabIdToWindowName: ",i)}}getDeviceInfo(){try{return this.loggingService.log("%c[WB] Calling FUNCTION: getDeviceInfo","color: green;"),this.deviceInfo$.value}catch(r){return this.loggingService.catch("Error in DomService getDeviceInfo: ",r),new Wr}}isMobileDevice(){try{return new Wr().getDeviceType()===Ir.MOBILE}catch(r){return this.loggingService.catch("Error in DomService isMobileDevice: ",r),!1}}isTabletDevice(){try{return new Wr().getDeviceType()===Ir.TABLET}catch(r){return this.loggingService.catch("Error in DomService isTabletDevice: ",r),!1}}isDesktopDevice(){try{return new Wr().getDeviceType()===Ir.DESKTOP}catch(r){return this.loggingService.catch("Error in DomService isDesktopDevice: ",r),!1}}deepCloneElement(r){try{var i=document.createElement(r?.tagName);return Array.from(r.attributes).forEach(o=>{i.setAttribute(o.nodeName,o.nodeValue)}),r.childNodes.forEach(o=>{o.nodeType===Node.ELEMENT_NODE?i.appendChild(this.deepCloneElement(o)):o.nodeType===Node.TEXT_NODE&&i.appendChild(document.createTextNode(o.nodeValue))}),i}catch(o){return this.loggingService.catch("Error in DomService deepCloneElement: ",o),r}}setRandomNumberToElementRecursive(r){try{if(!r)return;let i=Math.random().toString(36).substring(7);r&&r.setAttribute&&typeof r.setAttribute=="function"&&(r.getAttribute("velt-wireframe-id")||r.setAttribute("velt-wireframe-id",i)),Array.from(r.children).forEach(s=>{this.setRandomNumberToElementRecursive(s)})}catch(i){this.loggingService.catch("Error in DomService setRandomNumberToElementRecursive: ",i)}}setDialogOpenedInSidebar(r){this.dialogOpenedInSidebar$.next(r)}getDialogOpenedInSidebar(){return this.dialogOpenedInSidebar$.asObservable()}removeWireframeSuffixFromTags(r){if(!r)return;Array.from(r.children).forEach(o=>{if(this.removeWireframeSuffixFromTags(o),o.tagName.toLowerCase().endsWith("-wireframe")){let s=o.tagName.toLowerCase().replace("-wireframe",""),a=document.createElement(s);for(Array.from(o.attributes).forEach(c=>{a.setAttribute(c.name,c.value)});o.firstChild;)a.appendChild(o.firstChild);o.parentNode.replaceChild(a,o)}})}isMonitorDevice(){try{return new Wr().getDeviceType()===Ir.MONITOR}catch(r){return this.loggingService.catch("Error in DomService isMonitorDevice: ",r),!1}}isElementOriginallyStatic(r){try{return window.getComputedStyle(r).position==="static"||r.hasAttribute(k.ATTRIBUTES.VELT_COMMENT_PIN_HOST_STATIC)||r.hasAttribute(k.ATTRIBUTES.VELT_AREA_PIN_HOST_STATIC)||r.hasAttribute(k.ATTRIBUTES.VELT_TAG_PIN_HOST_STATIC)||r.hasAttribute(k.ATTRIBUTES.VELT_RECORDER_PIN_HOST_STATIC)||r.hasAttribute(k.ATTRIBUTES.VELT_ARROW_PIN_HOST_STATIC)}catch(i){return this.loggingService.catch("Error in DomService isElementOriginallyStatic: ",i),!1}}};e.ANCHOR_CACHE_LIMIT=2e4,e.MAX_ROBUST_XPATH_CANDIDATES=20,e.MULTIPLE_NBSP_REGEX=/(?: \s*){2,}/g,e.TRIM_NBSP_REGEX=/^(?: \s*)+|(?: \s*)+$/g,e.\u0275fac=function(i){return new(i||e)(q(ea),q(Bo),q(Nt),q(ER))},e.\u0275prov=Z({token:e,factory:e.\u0275fac,providedIn:"root"});let t=e;return t})();function sl(t){let e=t?.refreshToken;return typeof e=="string"&&e.length>0?e:void 0}var gb=Symbol("velt-auth-state-pending");function Wre(t,e){let n=V(V({},t),e||{});return n.userId=t.userId,n.userSnippylyId=t.userSnippylyId,n.type=t.type,n.organizationId=t.organizationId,n.clientOrganizationId=t.clientOrganizationId,n.groupId=t.groupId,n.clientGroupId=t.clientGroupId,n.contacts=t.contacts,n.plan=t.plan,n.isAdmin=t.isAdmin,n.isReadOnly=t.isReadOnly,n.isAnonymous=t.isAnonymous,n.isGuest=t.isGuest,n.color=e?.color||t.color,n.textColor=e?.textColor||t.textColor,n.initial=e?.initial||n.name?.charAt(0).toUpperCase()||n.email?.charAt(0).toUpperCase()||t.initial,n?.photoUrl===void 0&&(n.photoUrl=null),n}var zre=["userId","userSnippylyId","organizationId","clientOrganizationId","isAdmin","isReadOnly","isAnonymous","isGuest","plan","contacts"];function qre(t){if(!t||typeof t!="object")return{};let e=V({},t);for(let n of zre)delete e[n];return e}function hj(t,e){if(!e.length)return!0;if(t.length!==e.length)return!1;let n=new Set(t);return e.every(r=>n.has(r))}var Sd=(()=>{let e=class e{constructor(r,i,o,s,a,c,l,d,h){this.afAuth=r,this.configService=i,this.avatarService=o,this.coreActionsService=s,this.domService=a,this.functions=c,this.analyticsService=l,this.loggingService=d,this.serviceBook=h,this.endpointsService=Q(Ay),this.portableBackend$=new de(null),this.portableAuthUser$=new de(null),this.user$=new de(null),this.userOptions$=new de(null),this.userContacts$=new de(null),this.userOrganization$=new de(null),this.isPrivateCommentsEnabled$=new de(!1),this.providedUser=new so,this.portableRefreshTimer=null,this.portableToken=null,this.portableRefreshInFlightEpoch=null,this.portableRefreshFailures=0,this.portableRefreshFailuresPastExpiry=0,this.portableRefreshWarnedEpoch=null,this.portableApiKeyRefusalWarned=!1,this.portableApiKeyRenewalAskedAt=null,this.portableLicensePause=null,this.portableLicenseRetry=null,this.portableLicenseRetryRunSince=null,this.portableLicenseRetryRun=Promise.resolve(),this.portableLicenseNotices=new Ry(f=>this.coreActionsService.triggerAction(gi.ERROR,f)),this.portableVisibilityHandler=null,this.loggedInUserResolveRetryDelaysMs=[2e3,8e3,3e4],this.loggedInUserResolveRetryInFlightUserId=null,this.firebaseConfig$=new de(null),this.advancedQueries$=new de(null),this.planDetails$=new de(null),this.signOutPreviousUser$=new de(null),this.preSignOutFunctions=new Map,this.autoLoginCalled=!1,this.portableAutoLoginCalled=!1,this.portableAutoLoginInFlight=Promise.resolve(),this.portableSessionEpoch=0,this.portableLocalSessionEnds=0,this.portableSignOutOwnsEpochBump=!1,this.pendingPortableRestore=null,this.portableResumeUserId=null,this.portableStorageHandler=null,this.portableSessionIdentity=null,this.reportedPortableRefreshCodes=new Set,this.autoLoginRequired=!0,this.config=null,this.getPlanDetailsCalled=!1,this.portablePlanSeeded=!1,this.forceReLoggedIn=!1,this.lastLoggedInUserData=null,this.sessionReLoginCount=0,this.SESSION_RE_LOGIN_COUNT_LIMIT=10,this.sessionReLoginSubscription=null,this.onRetrySubscription=null,this.authProviderListenerGeneration=0,this.TOKEN_EXPIRED_ERROR_COUNT_LIMIT=3,this.tokenExpiredErrorCount=0,this.cachedActivityConfig=null,this.portableChunkReady=null,this.viewsService=null,this.crdtService=null,this.portableSavedSessionRaw=null,this.portableRenewalStopped=null,this.portableSessionStartedAt=0,this.portablePersistInFlight=Promise.resolve(),this.loggingService.log("%c[WB] Creating CLASS: AuthService","color: blue;"),this.serviceBook.observe(RT).subscribe(f=>{this.commentService=f??void 0}),this.serviceBook.observe(NT).subscribe(f=>{this.reactionService=f??void 0}),this.serviceBook.observe(bT).subscribe(f=>{this.areaService=f??void 0}),this.serviceBook.observe(WU).subscribe(f=>{this.activityService=f??void 0,f&&this.cachedActivityConfig&&f.setActivityFeatureConfig(this.cachedActivityConfig)}),this.serviceBook.observe(zU).subscribe(f=>{this.viewsService=f??null}),this.serviceBook.observe(qU).subscribe(f=>{this.crdtService=f??null});try{try{let f=this.configService.getAuthProxyHost();if(f){let g=this.afAuth?.config;g&&(g.apiHost=f,g.tokenApiHost=f)}}catch{}this.analyticsService.setAuthService(this),this.configService.getConfig$().subscribe(f=>{this.config=f}),this.forceReLoggedIn=localStorage.getItem(k.LOCAL_STORAGE.VELT_USER_FORCE_RE_LOGGED_IN)==="true",this.sessionReLoginSubscription=_d(this.afAuth).pipe(rn(this.afAuth.currentUser),ac(),Zn(([f,g])=>this.domService.onNetworkStatusChange$().pipe(_n(E=>E),Tn(1),De(()=>({previousUser:f,currentUser:g}))))).subscribe(E=>y(this,[E],function*({previousUser:f,currentUser:g}){if(!g&&f){let I=f?.stsTokenManager?.expirationTime,S=new Date().getTime(),R=I-S;S>I&&(this.analyticsService.trackEvent(St.Events.Core.SDK_SESSION_TOKEN_EXPIRED,{apiKey:this.apiKey,user:this.getUserForTelemetry(this.user$.value??void 0),lastLoggedInUserData:this.lastLoggedInUserData?{user:this.getUserForTelemetry(this.lastLoggedInUserData.user),autoLogin:this.lastLoggedInUserData.autoLogin,hasAuthToken:!!this.lastLoggedInUserData.userOptions?.authToken}:null,timeLeft:R,forceReset:this.userOptions$.value?.forceReset,sessionReLoginCount:this.sessionReLoginCount},!0,this.user$.value?.userSnippylyId),this.user$.value&&f?.uid===this.user$.value?.userSnippylyId&&this.lastLoggedInUserData?.user?.userSnippylyId===this.user$.value?.userSnippylyId&&(this.sessionReLoginCount>this.SESSION_RE_LOGIN_COUNT_LIMIT?(this.analyticsService.trackEvent(St.Events.Core.SDK_SESSION_RE_LOGIN_COUNT_EXCEEDED,{apiKey:this.apiKey,clientUserId:this.lastLoggedInUserData.user.userId,snippylyUserId:this.lastLoggedInUserData.user.userSnippylyId,timeLeft:R,forceReset:this.userOptions$.value?.forceReset,sessionReLoginCount:this.sessionReLoginCount},!0,this.user$.value?.userSnippylyId),this.sessionReLoginSubscription?.unsubscribe()):(this.sessionReLoginCount++,this.analyticsService.trackEvent(St.Events.Core.SDK_SESSION_RE_LOGIN_TRIGGERED,{apiKey:this.apiKey,clientUserId:this.lastLoggedInUserData.user.userId,snippylyUserId:this.lastLoggedInUserData.user.userSnippylyId,user:this.getUserForTelemetry(this.lastLoggedInUserData.user),timeLeft:R,forceReset:this.userOptions$.value?.forceReset,sessionReLoginCount:this.sessionReLoginCount},!0,this.lastLoggedInUserData.user.userSnippylyId),this.lastLoggedInUserData.user=yield this.updateUserWithColorAndTextColor(this.lastLoggedInUserData.user),this.initializeClient(this.lastLoggedInUserData.user,this.lastLoggedInUserData.userOptions,this.lastLoggedInUserData.initializeClientToken,this.lastLoggedInUserData.autoLogin,"internal-sessionReLogin"))))}}),f=>{this.loggingService.catch("Error in AuthService sessionReLoginSubscription: ",f)}),this.getUser$().pipe(ai(gp)).subscribe(f=>{let g=VR(f);this.coreActionsService.triggerAction(gi.USER_UPDATE,g),this.coreActionsService.triggerAction(gi.INIT_UPDATE,{event:gi.USER_UPDATE,payload:{user:g}})})}catch(f){this.loggingService.catch("Error in AuthService constructor: ",f)}}setApiKey(r,i){this.loggingService.log("%c[WB] Calling FUNCTION: setApiKey","color: green;",r);try{if(this.apiKey){this.loggingService.log("API key is already set");return}this.apiKey=r,this.configService.setApiKey(this.apiKey),i||(i=new PT),this.configService.initConfig(i);let o=this.configService.getProxyConfig();if(o?.authHost)try{let s=this.afAuth?.config;s&&(s.apiHost=o.authHost,s.tokenApiHost=o.authHost)}catch(s){this.loggingService.catch("Error setting auth proxy config: ",s)}else try{let s=this.afAuth?.config;s&&s.apiHost!=="identitytoolkit.googleapis.com"&&(s.apiHost="identitytoolkit.googleapis.com",s.tokenApiHost="securetoken.googleapis.com")}catch(s){this.loggingService.catch("Error resetting auth proxy config: ",s)}i.debugMode?sessionStorage.setItem("debugMode","true"):sessionStorage.removeItem("debugMode"),this.autoLoginCalled||_d(this.afAuth).pipe(Tn(1)).subscribe(s=>y(this,null,function*(){if(this.autoLoginCalled=!0,s){let a=yield xp(s,!0).catch(c=>null);if(a){let{user:c}=a?.claims;this.autoLoginRequired&&(c=yield this.updateUserWithColorAndTextColor(c),this.initializeClient(c,this.buildAutoLoginOptions(),new Date().getTime(),!0,"internal-autoLogin"))}}})),!this.portableAutoLoginCalled&&this.configService.getEnablePortableBackend()===!0&&(this.portableAutoLoginCalled=!0,this.portableAutoLoginInFlight=this.autoLoginPortableSession())}catch(o){this.loggingService.catch("Error in setApiKey: ",o)}}setUsersService(r){try{this.loggingService.log("%c[WB] Calling FUNCTION: setUsersService","color: green;"),this.usersService=r}catch(i){this.loggingService.catch("Error in setUsersService: ",i)}}setUserPermissionService(r){try{this.loggingService.log("%c[WB] Calling FUNCTION: setUserPermissionService","color: green;"),this.userPermissionService=r}catch(i){this.loggingService.catch("Error in setUserPermissionService: ",i)}}setDocService(r){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocService","color: green;"),this.docService=r}catch(i){this.loggingService.catch("Error in setDocService: ",i)}}setContactService(r){try{this.loggingService.log("%c[WB] Calling FUNCTION: setContactService","color: green;"),this.contactService=r}catch(i){this.loggingService.catch("Error in setContactService: ",i)}}setIamService(r){try{this.loggingService.log("%c[WB] Calling FUNCTION: setIamService","color: green;"),this.iamService=r}catch(i){this.loggingService.catch("Error in setIamService: ",i)}}setCommentService(r){try{this.loggingService.log("%c[WB] Calling FUNCTION: setCommentService","color: green;"),this.commentService=r}catch(i){this.loggingService.catch("Error in setCommentService: ",i)}}setCommonDbService(r){try{this.loggingService.log("%c[WB] Calling FUNCTION: setCommonDbService","color: green;"),this.commonDbService=r}catch(i){this.loggingService.catch("Error in setCommonDbService: ",i)}}validateOrganizationId(r){if(this.isVersionGreaterThanOrEqualTo4()&&!r?.organizationId)if(this.analyticsService.trackEvent(St.Events.Core.SDK_VALIDATE_CLIENT_FAILED,{apiKey:this.apiKey,clientUserId:r.userId,snippylyUserId:r.userSnippylyId,message:"Organization Id is not set",forceReset:this.userOptions$.value?.forceReset,user:this.getUserForTelemetry(r)},!0,r.userSnippylyId),this.configService.getSF())this.loggingService.catch("OrganizationId is not set in Identify method",void 0,void 0,!0);else throw new Error("OrganizationId is not set in Identify method")}setVeltAuthProvider(r){return y(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: setVeltAuthProvider","color: green;");try{this.onRetrySubscription?.unsubscribe(),this.authProviderListenerGeneration++,this.cancelPortableLicenseRetry();let i=null;if(!r.user)return null;r.generateToken&&typeof r.generateToken=="function"&&(i=yield r.generateToken());let o=yield UR(()=>window.Velt.identify(r.user,V(V({},r.options||{}),i&&{authToken:i}),{fromProvider:!0}).catch(s=>(r.onError&&typeof r.onError=="function"&&r.onError(s),Promise.reject(s))),r.retryConfig||{retryCount:0,retryDelay:0});return o&&r.generateToken&&typeof r.generateToken=="function"&&(this.onRetrySubscription=this.coreActionsService.onAction(gi.ERROR).pipe(_n(s=>s.code==="token_expired"),Tn(10)).subscribe(s=>y(this,null,function*(){if(s.code==="token_expired"){let a=this.authProviderListenerGeneration,c=()=>a===this.authProviderListenerGeneration,l=this.docService?.getDocumentIds()?.map(I=>({id:I.clientDocumentId}))??[],d=this.docService?.getOptionsFromDocumentPaths()??void 0,h=[],f=this.docService?.getLocation();f&&h.push(f.location);let g=this.docService?.getLocations();if(g&&Object.values(g).forEach(I=>{h.push(I.location)}),(yield UR(()=>y(this,null,function*(){try{let I=yield r.generateToken?.();return c()&&I?window.Velt.identify(r.user,V(V({},r.options||{}),I&&{authToken:I}),{fromProvider:!0}):!0}catch{return!1}}),r.retryConfig||{retryCount:0,retryDelay:0}))&&c()){let I=this.docService?.getDocumentIds()?.map(U=>U.clientDocumentId)??[];hj(l.map(U=>U.id),I)&&(yield this.docService?.setDocuments({documents:l,options:d,source:"internal"}));let S=[],R=this.docService?.getLocation();R?.location?.id&&S.push(R.location.id),Object.values(this.docService?.getLocations()??{}).forEach(U=>{U?.location?.id&&S.push(U.location.id)}),hj(h.map(U=>U?.id).filter(Boolean),S)&&(yield this.docService?.setLocations({locations:h,source:"internal",options:{appendLocation:!f}}))}}}))),o}catch(i){return this.loggingService.catch("Error in setVeltAuthProvider: ",i),null}})}setUserToStorage(r){return y(this,null,function*(){try{if(r){let i=yield HT(r,r?.userId??"");localStorage.setItem(k.LOCAL_STORAGE.VELT_IDENTIFY_USER,i)}}catch(i){this.loggingService.catch("Error in setUserToStorage: ",i)}})}getUserFromStorage(r){return y(this,null,function*(){try{let i=localStorage.getItem(k.LOCAL_STORAGE.VELT_IDENTIFY_USER);return i?yield fp(i,r?.userId??""):null}catch(i){return this.loggingService.catch("Error in getUserFromStorage: ",i),null}})}setIsPrivateCommentsEnabled(r){try{this.isPrivateCommentsEnabled$.next(r)}catch(i){this.loggingService.catch("Error in setIsPrivateCommentsEnabled: ",i)}}getIsPrivateCommentsEnabled(){return this.isPrivateCommentsEnabled$.value}getIsPrivateCommentsEnabled$(){return this.isPrivateCommentsEnabled$.asObservable()}updateUserWithColorAndTextColor(r){return y(this,null,function*(){try{let i=JSON.parse(JSON.stringify(r??{})),o=yield this.getUserFromStorage(i);return!o||Object.keys(o).length===0?(delete i?.color,delete i?.textColor,i):(o?.color&&(i.color=o?.color),o?.textColor&&(i.textColor=o?.textColor),i)}catch(i){return this.loggingService.catch("Error in updateUserWithColorAndTextColor: ",i),r}})}updateUserIfRequired(r){return y(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: updateUserIfRequired","color: green;");try{let i=yield this.getUserFromStorage(r),o={};r.color&&r.color!==i?.color&&(o.color=r.color),r.textColor&&r.textColor!==i?.textColor&&(o.textColor=r.textColor),Object.keys(o).length>0&&r.clientOrganizationId&&this.docService?.addUserInfoToOrganization({organizationId:r.clientOrganizationId,user:le(V({},o),{userId:r.userId})})}catch(i){this.loggingService.catch("Error in updateUserIfRequired: ",i)}})}initializeClient(r,i,o,s,a){return y(this,null,function*(){try{if(this.autoLoginRequired=!1,this.portableResumeUserId=null,this.userOptions$.next(i),this.initializeClientToken)this.pendingUserLogin=r,this.pendingUserLoginSource=a;else{a!==Vp&&this.cancelPortableLicenseRetry(),r.userSnippylyId=sB(this.configService.getApiKey(),r.userId),this.pendingUserLogin=void 0,this.pendingUserLoginSource=void 0,this.initializeClientToken=o;let c=this.portableSessionEpoch,l=this.portableLocalSessionEnds,d=yield _d(this.afAuth).pipe(Tn(1)).toPromise().catch(E=>null),h=!0;this.providedUser=JSON.parse(JSON.stringify(r));let f=!d&&s?this.takePendingPortableRestore(r,i):null,g=f?.envelope??null;if(g){if(this.loggingService.log("%c[WB] Calling FUNCTION: restorePortableSession","color: green;"),this.validateOrganizationId(r),!(yield this.applyIdentifyResponse(r,g.res,s)))return;h=!1,this.trackAutoAuthSuccess(r,a)}else if(!d&&s&&a==="internal-autoLogin"&&this.configService?.getEnablePortableBackend()===!0)return f?.resume?(ze("session.resume-skipped",f.overtaken?"overtaken":"not restorable"),this.loggingService.log("Velt [portable backend]: not following the session another page saved; waiting for identify().")):f?.overtaken?(ze("session.restore-discarded"),this.loggingService.log("Velt [portable backend]: discarding a reload restore that a sign-out or a new identify overtook."),this.clearPersistedPortableSessionIfUnchanged(f.raw)):(this.loggingService.log("Velt [portable backend]: nothing restorable on reload; waiting for identify()."),this.clearPersistedPortableSession()),this.initializeClientToken=0,this.checkForPendingLogin(),null;if(d){let E=yield xp(d,!0).catch(U=>null);if(!E)return;let{user:I,firebaseConfig:S,advancedQueries:R}=E.claims;if(tb({userSnippylyId:d?.uid,groupId:I?.groupId,organizationId:I?.organizationId},r,i)||!s&&r?.organizationId&&!this.forceReLoggedIn||this.forceReLoginRequiredForAdvancedQueries(r)||this.forceReLoginRequiredForRegion(r,S)||this.forceReLoginRequiredForCommentViews(r)){localStorage.setItem(k.LOCAL_STORAGE.VELT_USER_FORCE_RE_LOGGED_IN,"true"),localStorage.setItem(k.LOCAL_STORAGE.VELT_COMMENT_VIEWS_MIGRATED,"true"),this.forceReLoggedIn=!0;let U=this.portableSessionEpoch,G=this.portableLocalSessionEnds,X=this.signOutUser("internal");c+=this.portableSessionEpoch-U,l+=this.portableLocalSessionEnds-G,yield X}else this.loggingService.log("%c[WB] Calling FUNCTION: reinitializeCurrentUser","color: green;"),this.loggingService.log("Keeping user"),yield this.updateUserIfRequired(r),this.validateOrganizationId(r),this.setFirebaseConfig(S),this.setAdvancedQueries(R),I&&(this.providedUser.isAdmin=!!I.isAdmin),this.initializeSignedInUser(d,s,r),h=!1,this.configService?.getEnablePortableBackend()!==!0&&this.portableLicenseNotices.served(null,"identify","hosted-callable"),this.trackAutoAuthSuccess(r,a)}else if(h&&c===this.portableSessionEpoch&&this.isPortableIdentityChange(r,i)){let E=this.signOutUser("internal");c=this.portableSessionEpoch,l=this.portableLocalSessionEnds,yield E}if(h){this.analyticsService.trackEvent(St.Events.Core.SDK_VALIDATE_CLIENT_TRIGGERED,{apiKey:this.apiKey,clientUserId:r.userId,snippylyUserId:r.userSnippylyId,forceReset:this.userOptions$.value?.forceReset,user:this.getUserForTelemetry(r),source:a},!0,r.userSnippylyId,r.userId);let E=Date.now(),I=a===Vp,S=this.endpointsService?.getPortableIdentifyUrl?.()?"gateway":"hosted-callable",R=I&&S==="hosted-callable"?yield this.requestIdentify(r,i?.authToken).catch(G=>{if(R2(G))return Sy("the license re-run of identify could not reach the deployment");throw G}):yield this.requestIdentify(r,i?.authToken);if(I&&this.pendingUserLogin)return ze("credential.license-retry-discarded","pending identify"),this.initializeClientToken=0,this.checkForPendingLogin(),null;if(I&&S==="hosted-callable"&&this.isCallableLicenseRetryOvertaken(r,c,l,s))return ze("credential.license-retry-discarded","overtaken"),this.endLicenseRetryRunQuietly();if(R.error){if(this.analyticsService.trackEvent(St.Events.Core.SDK_VALIDATE_CLIENT_FAILED,le(V({apiKey:this.apiKey,clientUserId:r.userId,snippylyUserId:r.userSnippylyId,message:R.error,forceReset:this.userOptions$.value?.forceReset,user:this.getUserForTelemetry(r)},R),{source:a}),!0,r.userSnippylyId,r.userId),Ny(R)){let G=I?this.portableLicenseRetryRunSince??E:E;if(this.isPortableIdentifyOvertaken(c,l,s)||(this.notePortableLicenseRefusalAnswer(R,S),S==="gateway"?!this.pauseLivePortableSessionForLicense("identify")&&!s&&this.armLicenseRefusedIdentifyRetry(r,i,G):this.armLicenseRefusedIdentifyRetry(r,i,G,"hosted-callable",s)),I)return this.endLicenseRetryRunQuietly()}else if(I&&this.isTransientLicenseRetryFailure(R)){if(!this.isPortableIdentifyOvertaken(c,l,s)){let G=this.portableLicenseRetryRunSince??E;S==="gateway"?this.armLicenseRefusedIdentifyRetry(r,i,G):this.armLicenseRefusedIdentifyRetry(r,i,G,"hosted-callable",s)}return this.endLicenseRetryRunQuietly()}else if(R.error&&typeof R.error=="string")if(this.isTokenExpiredIdentifyError(R))this.emitIdentifyTokenExpiredError(R,r,a);else{let G=R;this.coreActionsService.triggerAction(gi.ERROR,G)}throw R}else this.tokenExpiredErrorCount=0;if(this.shouldHandlePortableBackend(R)&&this.isPortableIdentifyOvertaken(c,l,s))return this.loggingService.log("Velt [portable backend]: discarding an identify response that a sign-out overtook."),this.initializeClientToken=0,this.checkForPendingLogin(),null;if(this.shouldHandlePortableBackend(R)?this.portableLicenseNotices.served(il(R?.license),"identify",S):S==="hosted-callable"&&R?.firebaseConfig&&this.portableLicenseNotices.served(il(R?.license),"identify","hosted-callable"),this.shouldHandlePortableBackend(R)&&c!==this.portableSessionEpoch&&(this.autoLoginRequired=!1,this.portableResumeUserId=null),this.analyticsService.trackEvent(St.Events.Core.SDK_VALIDATE_CLIENT_SUCCESS,{apiKey:this.apiKey,clientUserId:r.userId,snippylyUserId:r.userSnippylyId,forceReset:this.userOptions$.value?.forceReset,user:this.getUserForTelemetry(r),source:a},!0,r.userSnippylyId,r.userId),this.validateOrganizationId(r),!(yield this.applyIdentifyResponse(r,R,s)))return}this.initializeClientToken=0,this.lastLoggedInUserData={user:r,userOptions:i,initializeClientToken:o,autoLogin:s},this.checkForPendingLogin()}return r}catch(c){return this.initializeClientToken=0,this.checkForPendingLogin(),this.loggingService.catch("Error in initializeClient: ",c),i?.throwError?Promise.reject(c):Promise.resolve(null)}})}isPortableIdentifyOvertaken(r,i,o){let s=this.portableSessionEpoch-r;return o?s!==0:s!==this.portableLocalSessionEnds-i}isCallableLicenseRetryOvertaken(r,i,o,s){try{if(this.isPortableIdentifyOvertaken(i,o,s))return!0;let a=this.afAuth?.currentUser;return!!a&&a.uid!==r?.userSnippylyId}catch{return!0}}isPortableIdentityChange(r,i){try{if(!this.portableAuthUser$.value)return!1;let o=this.portableSessionIdentity?.user??this.user$.value;return o?tb(o,r,i):!1}catch(o){return this.loggingService.catch("Error in isPortableIdentityChange: ",o),!1}}isVersionGreaterThanOrEqualTo4(){try{let r=Wc();return(r?parseInt(r.split(".")?.[0]||"0"):0)>=4}catch(r){return this.loggingService.catch("Error in isVersionGreaterThanOrEqualTo4: ",r),!1}}isVersion4Point5(){try{let r=Wc();if(r){let i=r.split("."),o=parseInt(i[0]||"0"),s=parseInt(i[1]||"0"),a=parseInt(i[2]||"0");if(o>=4&&s>=5)return o===4&&s===5&&a===0?!r.toLowerCase().includes("beta"):!0}return!1}catch(r){return this.loggingService.catch("Error in isVersion4Point5: ",r),!1}}forceReLoginRequiredForAdvancedQueries(r){try{let i=this.isVersionGreaterThanOrEqualTo4(),o=!1;try{let s=localStorage.getItem(k.LOCAL_STORAGE.VELT_ADVANCED_QUERIES);s&&(o=JSON.parse(s)?.advancedQueriesEnabled)}catch(s){this.loggingService.catch("Error in forceReLoginRequiredForAdvancedQueries: ",s)}return!!(i&&r.organizationId&&!o)}catch(i){return this.loggingService.catch("Error in forceReLoginRequiredForAdvancedQueries: ",i),!1}}forceReLoginRequiredForCommentViews(r){try{let i=this.isVersion4Point5(),o=!1;try{let s=localStorage.getItem(k.LOCAL_STORAGE.VELT_COMMENT_VIEWS_MIGRATED);s&&(o=JSON.parse(s))}catch(s){this.loggingService.catch("Error in forceReLoginRequiredForCommentViews: ",s)}return!!(i&&r.organizationId&&!o)}catch(i){return this.loggingService.catch("Error in forceReLoginRequiredForCommentViews: ",i),!1}}forceReLoginRequiredForRegion(r,i){try{return!!(this.isVersionGreaterThanOrEqualTo4()&&r.organizationId&&!i?.region)}catch(o){return this.loggingService.catch("Error in forceReLoginRequiredForRegion: ",o),!1}}checkForPendingLogin(){this.pendingUserLogin&&this.initializeClient(this.pendingUserLogin,this.userOptions$?.value||{},new Date().getTime(),void 0,this.pendingUserLoginSource)}setFirebaseConfig(r){this.loggingService.log("%c[WB] Calling FUNCTION: setFirebaseConfig","color: green;");try{this.firebaseConfig$.value||this.firebaseConfig$.next({firebaseOptions:V(V({},this.endpointsService.getFirebaseConfig()),r)})}catch(i){this.loggingService.catch("Error in setFirebaseConfig: ",i)}}requestIdentify(r,i){return y(this,null,function*(){let o=Wc();this.usersService?.userResolverConfigured?.()&&(r=jR(r));let s=this.endpointsService.getPortableIdentifyUrl();return s?u2({url:s,apiKey:this.apiKey,user:r,version:o,authToken:i}):(yield yd(this.functions,dd({url:this.endpointsService.getCloudFunctionUrl("validateClient"),apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:1200*1e3})({apiKey:this.apiKey,user:r,version:o,authToken:i}))?.data})}requestPortableRefresh(r){return y(this,null,function*(){let i=this.getConfiguredPortableIdentifyUrl();return i?f2({url:h2(i,"refresh"),apiKey:this.apiKey,refreshToken:r,timeoutMs:c2()}):Sy("the portable identify URL is not configured; the renewal credential was not sent")})}reportPortableRefreshMisconfigured(r){try{let i=String(r?.code??"unknown");if(this.reportedPortableRefreshCodes.has(i))return;if(this.reportedPortableRefreshCodes.add(i),i===e.PORTABLE_NO_CREDENTIAL_ENVELOPE.code){console.error("Velt [portable backend]: this session has no renewal credential for the configured gateway (the identify answer carried no refreshToken, or selfHosted.portableBackendUrl changed after sign-in), so it cannot be renewed: it is signed out and the app must identify() again. Every identify answer from portable-v0.1.6 or later carries one.");return}let o=r?.message?` (${r.message})`:"";console.error(i==="invalid-argument"?`Velt [portable backend]: the gateway rejected the session renewal as malformed: invalid-argument${o}. The SDK and gateway versions disagree on /identify/refresh; renewal is stopped for this session.`:`Velt [portable backend]: the gateway refused the session renewal: ${i}${o}. A deployment setting is wrong (the allowed origins, or the identify configuration for this API key). Renewal is stopped for this session; after the setting is fixed, a reload renews from the saved session.`)}catch{}}emitIdentifyTokenExpiredError(r,i,o){if(this.tokenExpiredErrorCount++,this.tokenExpiredErrorCount<=this.TOKEN_EXPIRED_ERROR_COUNT_LIMIT){let s={code:"token_expired",message:"Token expired",error:r?.error,source:r?.source};this.coreActionsService.triggerAction(gi.ERROR,s)}else{let s={code:"too_many_retries",message:"Token expired. Too many retries.",error:r?.error,source:r?.source};this.coreActionsService.triggerAction(gi.ERROR,s),this.analyticsService.trackEvent(St.Events.Core.SDK_JWT_EXPIRED_RETRY_EXCEEDED,{apiKey:this.apiKey,clientUserId:i.userId,snippylyUserId:i.userSnippylyId,forceReset:this.userOptions$.value?.forceReset,source:o},!0,i.userSnippylyId,i.userId)}}getConfiguredPortableIdentifyUrl(){try{let r=this.endpointsService?.getPortableIdentifyUrl?.();return r&&!cd(r)?r:null}catch{return null}}notePortableLicenseRefusalAnswer(r,i="gateway"){this.portableLicenseNotices.refused(il(r?.license),JN(r?.message),i)}isTokenExpiredIdentifyError(r){try{return r?.code==="token_expired"||!!r?.error?.toLowerCase?.()?.includes("token expired")}catch{return!1}}shouldHandlePortableBackend(r){try{return this.configService?.getEnablePortableBackend()===!0&&M2(r)}catch(i){return this.loggingService.catch("Error in shouldHandlePortableBackend: ",i),!1}}applyIdentifyResponse(r,i,o){return y(this,null,function*(){if(this.shouldHandlePortableBackend(i)){this.portableSessionEpoch++;let s=this.portableSessionEpoch,a=sl(i),c=a?this.endpointsService.getPortableIdentifyUrl()??void 0:void 0;this.portableSessionIdentity=V({user:r,epoch:s},a?{refreshToken:a,refreshTokenIssuer:c}:{}),this.portableSessionStartedAt=Date.now();let l=this.handlePortableBackendResponse(i);this.planDetails$.value||(this.getPlanDetailsCalled=!0,this.portablePlanSeeded=!0,this.planDetails$.next({planInfo:null,isPlanExpired:!1})),yield this.applyPortableProjectConfig(i);let d=null;if(i?.token&&this.usersService?.externalUserDataProviderAvailable())try{d=yield this.resolveSignedInUserWithProvider(r,this.providedUser?.clientOrganizationId||r.clientOrganizationId)}catch(f){this.loggingService.catch("Error in resolveSignedInUserWithProvider (Tier B sign-in): ",f),d=null}if(s!==this.portableSessionEpoch)return ze("session.adopt-discarded"),this.loggingService.log("Velt [portable backend]: discarding a portable sign-in that a sign-out or a new identify overtook."),!0;let h=this.initializePortableSignedInUser(r,i,d);h&&this.probeIdentifyPermissionWhenPortableReady(h,s,l)}else if(i.firebaseConfig){this.clearPortableBackendState(),this.setFirebaseConfig(i.firebaseConfig),yield this.signInWithCustomToken(r,i.token),this.loggingService.log("new signed in user",this.afAuth.currentUser);let s=yield xp(this.afAuth.currentUser,!0).catch(l=>null);if(!s)return!1;let{user:a,advancedQueries:c}=s.claims;this.setAdvancedQueries(c),this.providedUser.isAdmin=!!a?.isAdmin,this.initializeSignedInUser(this.afAuth.currentUser,o,r)}return!0})}applyPortableProjectConfig(r){return y(this,null,function*(){try{let i=yield eb({apiEndpoint:r?.apiEndpoint,token:r?.token});if(!i)return;this.applyProjectConfig(i)}catch(i){this.loggingService.catch("Error in applyPortableProjectConfig: ",i)}})}applyProjectConfig(r){this.setIsPrivateCommentsEnabled(!!r?.isPrivateCommentsEnabled);let i=r?.activityConfig??{immutable:!1,isEnabled:!1};this.cachedActivityConfig=i,this.activityService?.setActivityFeatureConfig(i)}handlePortableBackendResponse(r){try{this.loggingService.log("%c[WB] Calling FUNCTION: handlePortableBackendResponse","color: green;"),this.portableBackend$.next({backend:r?.backend,wsEndpoint:r?.wsEndpoint,apiEndpoint:r?.apiEndpoint});let i=P2({backend:r?.backend,token:r?.token??null,wsEndpoint:r?.wsEndpoint,apiEndpoint:r?.apiEndpoint});return this.portableChunkReady=i,b2(o=>this.onPortableLicenseRefusalReported(o)),O2(()=>this.onPortableApiKeyRefusalReported()),this.schedulePortableTokenRefresh(r?.token??null),i}catch(i){return this.loggingService.catch("Error in handlePortableBackendResponse: ",i),null}}schedulePortableTokenRefresh(r){try{if(this.clearPortableTokenRefresh(),this.portableLicensePause=null,this.cancelPortableLicenseRetry(),this.portableToken=r,!r)return;this.portableRefreshFailures=0,this.portableRefreshFailuresPastExpiry=0;let i=T2(Up(r),Date.now());if(i!==null?this.armPortableRefreshTimer(i,"expiry"):this.loggingService.log("Velt [portable backend]: no proactive token refresh scheduled (token expiry unreadable or already past)."),typeof document<"u"&&typeof document.addEventListener=="function"){this.portableVisibilityHandler=o=>{try{let s=XN(this.portableToken,Date.now());if(ze(`page.${o?.type??"lifecycle"}`,`visibility=${typeof document<"u"?document.visibilityState:"?"} credentialExpired=${s}`),o?.type==="pageshow"&&o.persisted===!1)return;s?this.refreshPortableToken("focus"):this.checkPortableSessionAgainstStorage(`page.${o?.type??"lifecycle"}`),k2()}catch{}};for(let o of e.PORTABLE_DOCUMENT_LIFECYCLE_EVENTS)document.addEventListener(o,this.portableVisibilityHandler);typeof window<"u"&&typeof window.addEventListener=="function"&&window.addEventListener("pageshow",this.portableVisibilityHandler)}this.armPortableStorageListener()}catch(i){this.loggingService.catch("Error scheduling portable token refresh: ",i)}}readStoredPortableSessionRaw(){try{return localStorage.getItem(k.LOCAL_STORAGE.VELT_PORTABLE_SESSION)}catch{return}}readPortableSavedSession(r){return y(this,null,function*(){try{let i;try{i=localStorage.getItem(k.LOCAL_STORAGE.VELT_PORTABLE_SESSION)}catch{return{verdict:"persist"}}if(!i){let a=this.readPortableSignOutAt();return{verdict:a!==null&&a>=this.portableSessionStartedAt?"stop":"persist"}}if(i===this.portableSavedSessionRaw)return{verdict:"persist"};let o=null;try{o=yield fp(i,this.apiKey??"")}catch{o=null}return o?.v!==1||o?.apiKey!==this.apiKey||!o?.user?.userId?{verdict:"renew-only"}:o.user.userId!==r?{verdict:"stop"}:{verdict:"persist",sharedRefreshToken:(o?.portableBackendUrl??null)===(this.configService?.getSelfHostedConfig?.()?.portableBackendUrl??null)?sl(o?.res):void 0}}catch(i){return this.loggingService.catch("Error in AuthService readPortableSavedSession: ",i),{verdict:"persist"}}})}recordPortableSignOut(){try{if(!this.apiKey)return;let r={};try{let i=JSON.parse(localStorage.getItem(k.LOCAL_STORAGE.VELT_PORTABLE_SIGNED_OUT)??"{}");i&&typeof i=="object"&&!Array.isArray(i)&&(r=i)}catch{r={}}r[this.apiKey]=Date.now(),localStorage.setItem(k.LOCAL_STORAGE.VELT_PORTABLE_SIGNED_OUT,JSON.stringify(r))}catch{}}armPortableRefreshTimer(r,i){this.cancelPortableRefreshTimer(),this.portableRefreshTimer=setTimeout(()=>this.refreshPortableToken(i),r)}cancelPortableRefreshTimer(){this.portableRefreshTimer&&(clearTimeout(this.portableRefreshTimer),this.portableRefreshTimer=null)}readPortableSignOutAt(){try{let r=JSON.parse(localStorage.getItem(k.LOCAL_STORAGE.VELT_PORTABLE_SIGNED_OUT)??"null"),i=r&&this.apiKey?r[this.apiKey]:void 0;return typeof i=="number"&&Number.isFinite(i)?i:null}catch{return null}}clearPortableTokenRefresh(){try{if(this.cancelPortableRefreshTimer(),this.portableVisibilityHandler&&typeof document<"u")for(let r of e.PORTABLE_DOCUMENT_LIFECYCLE_EVENTS)document.removeEventListener(r,this.portableVisibilityHandler);this.portableVisibilityHandler&&typeof window<"u"&&typeof window.removeEventListener=="function"&&window.removeEventListener("pageshow",this.portableVisibilityHandler),this.portableVisibilityHandler=null,this.portableStorageHandler&&typeof window<"u"&&typeof window.removeEventListener=="function"&&window.removeEventListener("storage",this.portableStorageHandler),this.portableStorageHandler=null}catch{}}refreshPortableToken(r){return y(this,null,function*(){let i=this.portableSessionEpoch;if(this.portableRefreshInFlightEpoch!==i){this.portableRefreshInFlightEpoch=i;try{let o=this.portableSessionIdentity,s=o?.user;if(!o||o.epoch!==i||!s?.userId||!this.portableBackend$.value)return;if(this.portableRenewalStopped?.epoch===i){ze("credential.refresh-skipped",`${this.portableRenewalStopped.reason}; waiting for identify()`);return}if(this.holdRefreshForLicensePause(i,r))return;let a=yield this.readPortableSavedSession(s.userId);if(i!==this.portableSessionEpoch)return;if(a.verdict==="stop"){this.endPortableSessionFromAnotherPage(s,`refresh:${r}`);return}let c=a.sharedRefreshToken,l=this.endpointsService.getPortableIdentifyUrl()??void 0;c&&l&&this.portableSessionIdentity&&c!==this.portableSessionIdentity.refreshToken&&(ze("credential.shared-adopted"),this.portableSessionIdentity=le(V({},this.portableSessionIdentity),{refreshToken:c,refreshTokenIssuer:l}));let d=this.portableSessionIdentity??o,h=d.refreshToken&&d.refreshTokenIssuer===l?d.refreshToken:void 0;if(!h){this.reportPortableRefreshMisconfigured(e.PORTABLE_NO_CREDENTIAL_ENVELOPE),this.endPortableSessionForDeadCredential(s,e.PORTABLE_NO_CREDENTIAL_ENVELOPE,r);return}this.loggingService.log(`Velt [portable backend]: refreshing the gateway credential (${r}).`),ze("credential.refresh-requested",`reason=${r} via=refresh`);let f=yield this.requestPortableRefresh(h);if(i!==this.portableSessionEpoch){ze("credential.refresh-discarded",`reason=${r}`),this.loggingService.log("Velt [portable backend]: discarding a credential refresh that a sign-out or a new identify overtook.");return}if(!this.shouldHandlePortableBackend(f)||!f?.token){if(Ny(f)){ze("credential.refresh-license-refused",`reason=${r}`),this.notePortableLicenseRefusalAnswer(f),this.pausePortableRenewalsForLicense(i,!0);return}if(f?.code===KN){this.endPortableSessionForDeadCredential(s,f,r);return}if(kp.has(f?.code)){ze("credential.refresh-misconfigured",`code=${f?.code}`),this.portableRenewalStopped={epoch:i,reason:`renewal refused: ${f?.code}`},this.cancelPortableRefreshTimer(),this.reportPortableRefreshMisconfigured(f);return}this.portableRefreshFailures++,this.portableRefreshFailures>=e.PORTABLE_REFRESH_WARN_AFTER_FAILURES&&this.reportPortableRefreshFailing(f,i);let S=Date.now();XN(this.portableToken,S)&&this.portableRefreshFailuresPastExpiry++,this.armPortableRefreshTimer(y2(Up(this.portableToken),S,this.portableRefreshFailuresPastExpiry),r);return}let g=this.readStoredPortableSessionRaw(),E=yield this.readPortableSavedSession(s.userId);if(i!==this.portableSessionEpoch){ze("credential.refresh-discarded",`reason=${r}`);return}if(E.verdict==="stop"){this.endPortableSessionFromAnotherPage(s,`refresh-answered:${r}`);return}ze("credential.refreshed"),this.portableLicenseNotices.served(il(f?.license),"renewal"),this.handlePortableBackendResponse(f);let I=sl(f)??h;this.portableSessionIdentity?.epoch===i&&(this.portableSessionIdentity=le(V({},this.portableSessionIdentity),{refreshToken:I,refreshTokenIssuer:l})),E.verdict==="persist"&&this.persistPortableSession(s,le(V({},f),{refreshToken:I}),{expectStoredRaw:g})}catch(o){this.loggingService.catch("Error refreshing portable token: ",o)}finally{this.portableRefreshInFlightEpoch===i&&(this.portableRefreshInFlightEpoch=null)}}})}holdRefreshForLicensePause(r,i){let o=this.portableLicensePause;if(o?.epoch!==r||i==="license")return!1;let s=Date.now(),a=Math.min(o.retryAt-s,D2);return a<=0?!1:(o.retryAt=s+a,ze("credential.refresh-skipped",`license paused; next retry in ${Math.round(a/1e3)}s`),this.armPortableRefreshTimer(a,"license"),this.checkPortableSessionAgainstStorage(`license-paused:${i}`),!0)}pausePortableRenewalsForLicense(r,i){try{let o=this.portableLicensePause?.epoch===r?this.portableLicensePause:null;if(o&&!i)return;let s=(o?.refusals??0)+(i?1:0),a=ZN(Math.random());this.portableLicensePause={epoch:r,refusals:s,retryAt:Date.now()+a},ze("credential.license-paused",`refusals=${s} retryInS=${Math.round(a/1e3)}`),this.armPortableRefreshTimer(a,"license")}catch(o){this.loggingService.catch("Error pausing portable renewals for the license: ",o)}}onPortableLicenseRefusalReported(r){try{this.portableLicenseNotices.refused(r?.license??null,r?.message),this.pauseLivePortableSessionForLicense(r?.source??"?")}catch(i){this.loggingService.catch("Error handling a portable license refusal: ",i)}}onPortableApiKeyRefusalReported(){try{let r=this.portableSessionIdentity;if(!r||r.epoch!==this.portableSessionEpoch||!this.portableBackend$.value){ze("credential.api-key-refused","no live session");return}if(this.portableApiKeyRefusalWarned||(this.portableApiKeyRefusalWarned=!0,console.warn("Velt [portable backend]: the gateway refused the realtime session because the API key is disabled. The SDK does not reconnect in a loop: it renews the session (every 30 s while the token is valid, less often after it expires) and reconnects once the key is enabled again.")),this.portableRefreshFailures>0){ze("credential.api-key-refused","renewal retry already running");return}let i=Date.now(),o=this.portableApiKeyRenewalAskedAt;if(o?.epoch===r.epoch&&i-o.at<Fp){ze("credential.api-key-refused","renewal floor"),this.armPortableRefreshTimer(Fp-(i-o.at),"focus");return}this.portableApiKeyRenewalAskedAt={epoch:r.epoch,at:i},ze("credential.api-key-refused","renewing now"),this.refreshPortableToken("focus")}catch(r){this.loggingService.catch("Error handling a portable API-key refusal: ",r)}}pauseLivePortableSessionForLicense(r){let i=this.portableSessionIdentity;return!i||i.epoch!==this.portableSessionEpoch||!this.portableBackend$.value?!1:(ze("credential.license-reported",`source=${r}`),this.pausePortableRenewalsForLicense(i.epoch,!1),!0)}armPortableLicenseRetry(r,i){try{this.cancelPortableLicenseRetry();let o=ZN(Math.random()),s=setTimeout(()=>this.runPortableLicenseRetry(),o);this.portableLicenseRetry={timer:s,epoch:this.portableSessionEpoch,dueAt:Date.now()+o,what:r,rerun:i},ze("credential.license-retry-armed",`${r} retryInS=${Math.round(o/1e3)}`)}catch(o){this.loggingService.catch("Error arming the portable license retry: ",o)}}runPortableLicenseRetry(){let r=this.portableLicenseRetry;if(r){this.portableLicenseRetry=null,clearTimeout(r.timer);try{if(r.epoch!==this.portableSessionEpoch||this.portableSessionIdentity||this.initializeClientToken){ze("credential.license-retry-skipped",r.what);return}ze("credential.license-retry",r.what),r.rerun()}catch(i){this.loggingService.catch("Error running the portable license retry: ",i)}}}cancelPortableLicenseRetry(){let r=this.portableLicenseRetry;r&&(clearTimeout(r.timer),this.portableLicenseRetry=null),this.portableLicenseRetryRunSince=null}armLicenseRefusedIdentifyRetry(r,i,o,s="gateway",a){this.armPortableLicenseRetry("identify",()=>{this.portableLicenseRetryRun=this.rerunLicenseRefusedIdentify(r,i,o,s,a)})}rerunLicenseRefusedIdentify(r,i,o,s="gateway",a){return y(this,null,function*(){try{if(s==="hosted-callable"){let f=this.afAuth?.currentUser;if(f&&f.uid!==r?.userSnippylyId){ze("credential.license-retry-skipped","another user signed in");return}if(this.initializeClientToken)return;this.portableLicenseRetryRunSince=o,yield this.initializeClient(r,i,new Date().getTime(),a,Vp).catch(()=>{});return}let c=this.portableSessionEpoch,l=this.readPortableSignOutAt();if(l!==null&&l>o){ze("credential.license-retry-skipped","signed out in another page");return}let d=yield this.readPersistedPortableSession();if(c!==this.portableSessionEpoch||this.portableSessionIdentity||this.initializeClientToken)return;let h=d?.envelope?.user?.userId;if(h&&h!==r?.userId){ze("credential.license-retry-skipped","another user signed in");return}this.portableLicenseRetryRunSince=o,yield this.initializeClient(r,i,new Date().getTime(),void 0,Vp).catch(()=>{})}catch(c){this.loggingService.catch("Error re-running the license-refused identify: ",c)}finally{this.portableLicenseRetryRunSince=null}})}endLicenseRetryRunQuietly(){return this.initializeClientToken=0,this.checkForPendingLogin(),null}isTransientLicenseRetryFailure(r){let i=r?.code;return!this.isTokenExpiredIdentifyError(r)&&!kp.has(i)&&i!=="missing_jwt_token"&&i!=="unauthenticated"&&i!=="permission-denied"}armRestoreLicenseRetry(r){this.armPortableLicenseRetry("restore",()=>{this.portableAutoLoginInFlight=this.portableAutoLoginInFlight.then(()=>this.autoLoginPortableSession(le(V({},r??{}),{licenseRetry:!0}))).catch(()=>{})})}reportPortableRefreshFailing(r,i){try{if(this.portableRefreshWarnedEpoch===i)return;this.portableRefreshWarnedEpoch=i,console.warn(`Velt [portable backend]: could not renew the gateway credential (${this.portableRefreshFailures} attempts in a row${r?.code?`, last: ${r.code}`:""}). The SDK keeps retrying \u2014 every 30 s while the current token is valid; once it has expired, after 30 s, doubling up to every 16 minutes, and each time the page becomes active again \u2014 and the realtime session is unavailable from the moment the token expires until a renewal succeeds. Check that the gateway's /identify/refresh endpoint is reachable and the API key is enabled.`)}catch{}}endPortableSessionForDeadCredential(r,i,o){ze("credential.refresh-credential-invalid",`reason=${o}`),this.portableSavedSessionRaw&&this.clearPersistedPortableSessionIfUnchanged(this.portableSavedSessionRaw),this.endPortableSessionLocally(r),this.emitIdentifyTokenExpiredError(i,r,"internal-portableRefresh")}endPortableSessionFromAnotherPage(r,i){ze("session.ended-elsewhere",i),this.loggingService.log("Velt [portable backend]: another page signed out or signed in another user; this page's session ends too."),this.endPortableSessionLocally(r)}checkPortableSessionAgainstStorage(r){return y(this,null,function*(){try{let i=this.portableSessionEpoch,o=this.portableSessionIdentity;if(!o||o.epoch!==i||!o.user?.userId)return;let{verdict:s}=yield this.readPortableSavedSession(o.user.userId);s==="stop"&&i===this.portableSessionEpoch&&this.endPortableSessionFromAnotherPage(o.user,r)}catch(i){this.loggingService.catch("Error checking the portable session against storage: ",i)}})}armPortableStorageListener(){try{if(this.portableStorageHandler||typeof window>"u"||typeof window.addEventListener!="function")return;this.portableStorageHandler=r=>{try{let i=r?.key;if(i!==null&&i!==k.LOCAL_STORAGE.VELT_PORTABLE_SESSION&&i!==k.LOCAL_STORAGE.VELT_PORTABLE_SIGNED_OUT)return;this.portableSessionIdentity?this.checkPortableSessionAgainstStorage("storage"):this.portableResumeUserId&&this.resumePortableSessionFromAnotherPage()}catch{}},window.addEventListener("storage",this.portableStorageHandler)}catch(r){this.loggingService.catch("Error arming the portable storage listener: ",r)}}resumePortableSessionFromAnotherPage(){let r=this.portableResumeUserId;!r||this.portableSessionIdentity||this.initializeClientToken||!this.autoLoginRequired||this.configService?.getEnablePortableBackend()!==!0||(this.portableAutoLoginInFlight=this.portableAutoLoginInFlight.then(()=>this.autoLoginPortableSession({onlyUserId:r})).catch(()=>{}))}initializePortableSignedInUser(r,i,o=null){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: initializePortableSignedInUser","color: green;"),!i?.token)return this.portableAuthUser$.value&&(this.userPermissionService?.invalidateAllPermissionsState(),this.releaseLiveUserSession("clear")),null;let s=new so;s.type="signedIn",s=V(V(V({},s),r),qre(o)),nb(s,{provided:le(V({},r),{isAdmin:_2(i?.token)}),resolved:o,avatarColor:c=>this.getUserAvatarColor(c),textColor:c=>this.getUserTextColor(c)}),this.setUserToStorage(s),this.persistPortableSession(s,i);let a=Object.assign({},s);return delete a.contacts,this.analyticsService.identifyUser(s.userSnippylyId,a,{forceReset:this.userOptions$.value?.forceReset}),this.user$.next(s),this.portableAuthUser$.next({uid:s.userSnippylyId}),s}catch(s){return this.loggingService.catch("Error in initializePortableSignedInUser: ",s),null}}clearPortableBackendState(){try{this.portableSignOutOwnsEpochBump||this.portableSessionEpoch++,this.releasePortableSession({clearStorage:!0})}catch(r){this.loggingService.catch("Error clearing portable backend state: ",r)}}releaseLiveUserSession(r){this.resetServicesCache(),this.user$.next(null),r==="local"?this.releasePortableSession({clearStorage:!1}):this.clearPortableBackendState()}releasePortableSession(r){this.portablePlanSeeded&&(this.portablePlanSeeded=!1,this.getPlanDetailsCalled=!1),this.pendingPortableRestore=null,this.portableSessionIdentity=null,this.cancelPortableLicenseRetry(),r.clearStorage&&(this.portableAutoLoginCalled||this.configService?.getEnablePortableBackend()===!0)&&this.clearPersistedPortableSession(),!(!this.portableBackend$.value&&!this.portableAuthUser$.value)&&(this.clearPortableTokenRefresh(),this.portableToken=null,this.portableChunkReady=null,this.portableRefreshFailures=0,this.portableRefreshFailuresPastExpiry=0,this.portableLicensePause=null,this.portableBackend$.next(null),this.portableAuthUser$.next(null),this.user$.next(null),x2())}endPortableSessionLocally(r){try{this.userPermissionService?.invalidateAllPermissionsState(),this.portableSessionEpoch++,this.portableLocalSessionEnds++,this.releaseLiveUserSession("local"),this.autoLoginRequired=!0,this.portableResumeUserId=r?.userId??null,this.armPortableStorageListener()}catch(i){this.loggingService.catch("Error ending the portable session: ",i)}}trackAutoAuthSuccess(r,i){this.analyticsService.trackEvent(St.Events.Core.SDK_USER_AUTH_SUCCESS,{apiKey:this.apiKey,clientUserId:r.userId,snippylyUserId:r.userSnippylyId,authType:"auto",forceReset:this.userOptions$.value?.forceReset,user:this.getUserForTelemetry(r),source:i})}buildAutoLoginOptions(){return this.userOptions$?.value?le(V({},this.userOptions$.value),{replaceContacts:!1,replaceGroupContacts:!1,replacePrivateContacts:!1}):{}}persistPortableSession(r,i,o){let s=this.portableSessionEpoch;return this.portablePersistInFlight=this.portablePersistInFlight.then(()=>this.writePortableSessionEnvelope(r,i,s,o?.expectStoredRaw)).catch(()=>{}),this.portablePersistInFlight}writePortableSessionEnvelope(r,i,o,s){return y(this,null,function*(){try{if(!i?.token||!r?.userId||!this.apiKey)return;let a=this.user$.value;if(a?.userSnippylyId&&r.userSnippylyId&&a.userSnippylyId!==r.userSnippylyId)return;let c=this.getUserWithoutContacts(r);if(!c)return;let l={v:1,apiKey:this.apiKey,portableBackendUrl:this.configService?.getSelfHostedConfig?.()?.portableBackendUrl??null,user:c,res:V({backend:i.backend,wsEndpoint:i.wsEndpoint,apiEndpoint:i.apiEndpoint,token:i.token},sl(i)?{refreshToken:sl(i)}:{})},d=yield HT(l,this.apiKey);if(o!==this.portableSessionEpoch){this.loggingService.log("Velt [portable backend]: dropping a session envelope write that a sign-out or a new identify overtook.");return}if(s!==void 0&&localStorage.getItem(k.LOCAL_STORAGE.VELT_PORTABLE_SESSION)!==s){this.loggingService.log("Velt [portable backend]: not re-persisting a refreshed credential \u2014 another page changed the saved session meanwhile.");return}let h=this.readPortableSignOutAt();if(h!==null&&h>this.portableSessionStartedAt){this.loggingService.log("Velt [portable backend]: not persisting the session \u2014 another page signed out after it began.");return}typeof d=="string"&&!d.startsWith("{")&&d!==JSON.stringify(l)&&(localStorage.setItem(k.LOCAL_STORAGE.VELT_PORTABLE_SESSION,d),this.portableSavedSessionRaw=d)}catch(a){this.loggingService.catch("Error in writePortableSessionEnvelope: ",a)}})}readPersistedPortableSession(){return y(this,null,function*(){try{let r=localStorage.getItem(k.LOCAL_STORAGE.VELT_PORTABLE_SESSION);if(!r)return null;let i=yield fp(r,this.apiKey??"");return i?i.v!==1||i.apiKey!==this.apiKey||!i.user?.userId||!i.res?.token?(this.clearPersistedPortableSession(),null):(this.portableSavedSessionRaw=r,{envelope:i,raw:r}):null}catch(r){return this.loggingService.catch("Error in readPersistedPortableSession: ",r),null}})}clearPersistedPortableSession(){this.portableSavedSessionRaw=null;try{localStorage.removeItem(k.LOCAL_STORAGE.VELT_PORTABLE_SESSION)}catch{}}clearPersistedPortableSessionIfUnchanged(r){try{r&&localStorage.getItem(k.LOCAL_STORAGE.VELT_PORTABLE_SESSION)===r&&this.clearPersistedPortableSession()}catch{}}isPortableTokenNearExpiry(r){let i=Up(r);return i===null||i-Date.now()<=YN}isPortableRestoreConfigured(){try{return this.configService?.getEnablePortableBackend()===!0&&!!this.getConfiguredPortableIdentifyUrl()}catch{return!1}}isRestorablePortableSession(r,i,o){try{if(!this.isPortableRestoreConfigured()||o?.forceReset||r.portableBackendUrl!==(this.configService?.getSelfHostedConfig?.()?.portableBackendUrl??null)||!nl(r.res?.apiEndpoint)||r.user?.userSnippylyId!==i?.userSnippylyId)return!1;let s=this.user$.value;return s?.userSnippylyId&&s.userSnippylyId!==r.user.userSnippylyId||this.isPortableTokenNearExpiry(r.res.token)?!1:this.shouldHandlePortableBackend(r.res)}catch(s){return this.loggingService.catch("Error in isRestorablePortableSession: ",s),!1}}takePendingPortableRestore(r,i){let o=this.pendingPortableRestore;if(this.pendingPortableRestore=null,!o)return null;let s=o.resume===!0;return o.epoch!==this.portableSessionEpoch?{envelope:null,overtaken:!0,raw:o.raw,resume:s}:{envelope:this.isRestorablePortableSession(o.envelope,r,i)?o.envelope:null,overtaken:!1,raw:o.raw,resume:s}}autoLoginPortableSession(r){return y(this,null,function*(){let i=this.portableSessionEpoch,o=()=>i!==this.portableSessionEpoch||!this.autoLoginRequired,s=!!r?.onlyUserId;try{let a=yield this.readPersistedPortableSession(),c=a?.envelope;if(!a||!c||o()||s&&c.user?.userId!==r?.onlyUserId)return;if(!this.isPortableRestoreConfigured()){s||this.clearPersistedPortableSession();return}if(c.portableBackendUrl!==(this.configService?.getSelfHostedConfig?.()?.portableBackendUrl??null)){s||(this.loggingService.log("Velt [portable backend]: the persisted session belongs to a different gateway; dropped."),this.clearPersistedPortableSession());return}let l=c;if(this.isPortableTokenNearExpiry(c.res.token)){let h=sl(c.res);if(!h){this.loggingService.log("Velt [portable backend]: the persisted session has no renewal credential; waiting for identify()."),this.clearPersistedPortableSessionIfUnchanged(a.raw);return}ze("credential.restore-renew","via=refresh");let f=yield this.requestPortableRefresh(h);if(o())return;if(!this.shouldHandlePortableBackend(f)||!f?.token){if(Ny(f)){this.notePortableLicenseRefusalAnswer(f),this.loggingService.log("Velt [portable backend]: the persisted session was not renewed: the deployment refuses new sessions (license). Keeping it and asking again in 5 minutes or more."),this.armRestoreLicenseRetry(r);return}if(f?.code==="network_error"){this.loggingService.log("Velt [portable backend]: could not reach the gateway to renew the persisted session; keeping it for the next attempt."),r?.licenseRetry&&this.armRestoreLicenseRetry(r);return}if(kp.has(f?.code)&&this.reportPortableRefreshMisconfigured(f),f?.code!==KN){this.loggingService.log(`Velt [portable backend]: the persisted session's renewal was refused for now (${f?.code??"no code"}); keeping it for the next attempt.`),r?.licenseRetry&&!kp.has(f?.code)&&this.armRestoreLicenseRetry(r);return}this.loggingService.log("Velt [portable backend]: the persisted session could not be renewed on reload; waiting for identify()."),this.clearPersistedPortableSessionIfUnchanged(a.raw);return}this.portableLicenseNotices.served(il(f?.license),"renewal");let g=sl(f)??h;l=le(V({},c),{res:{backend:f.backend,wsEndpoint:f.wsEndpoint,apiEndpoint:f.apiEndpoint,token:f.token,refreshToken:g}})}if(o())return;this.pendingPortableRestore=V({envelope:l,epoch:i,raw:a.raw},s?{resume:!0}:{});let d=this.buildAutoLoginOptions();s&&delete d.forceReset,yield this.initializeClient(V({},l.user),d,new Date().getTime(),!0,"internal-autoLogin")}catch(a){this.loggingService.catch("Error in autoLoginPortableSession: ",a)}finally{this.pendingPortableRestore=null}})}getPortableBackend(){return this.portableBackend$.value}getFirebaseConfig$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getFirebaseConfig","color: green;"),this.firebaseConfig$.asObservable()}getFirebaseConfig(){return this.loggingService.log("%c[WB] Calling FUNCTION: getFirebaseConfig","color: green;"),this.firebaseConfig$.value}setAdvancedQueries(r){this.loggingService.log("%c[WB] Calling FUNCTION: setAdvancedQueries","color: green;");try{r&&typeof r=="object"&&localStorage.setItem(k.LOCAL_STORAGE.VELT_ADVANCED_QUERIES,JSON.stringify(r)),this.advancedQueries$.next(r)}catch(i){this.loggingService.catch("Error in setAdvancedQueries: ",i)}}getAdvancedQueries$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getAdvancedQueries$","color: green;"),this.advancedQueries$.asObservable()}getAdvancedQueries(){return this.loggingService.log("%c[WB] Calling FUNCTION: getAdvancedQueries","color: green;"),this.advancedQueries$.value}getAdvancedQueriesEnabled(r){try{return!this.configService.getConfig()?.advancedQueriesDisabled&&(r||!!this.getAdvancedQueries()?.advancedQueriesEnabled)}catch(i){return this.loggingService.catch("Error in getAdvancedQueriesEnabled: ",i),!1}}signOutPreviousUser(){return this.signOutPreviousUser$.asObservable()}getUser(){return this.loggingService.log("%c[WB] Calling FUNCTION: getUser","color: green;"),this.afAuth?.currentUser||this.portableAuthUser$.value?this.user$.value:null}getProvidedOrCurrentUserId(){try{return this.providedUser?.userId??this.user$.value?.userId??void 0}catch(r){this.loggingService.catch("Error in getProvidedOrCurrentUserId: ",r);return}}scheduleLoggedInUserResolveRetry(r,i){return y(this,null,function*(){try{if(!r||this.loggedInUserResolveRetryInFlightUserId===r)return;this.loggedInUserResolveRetryInFlightUserId=r;let o=this.loggedInUserResolveRetryDelaysMs;for(let s=0;s<o.length;s++){if(yield new Promise(l=>setTimeout(l,o[s])),(this.providedUser?.userId??this.user$.value?.userId)!==r)return;let a=yield this.usersService?.resolveUsers({userIds:[r],organizationId:i,skipUserCheck:!0,forceResolve:!0,moduleName:xT.IDENTIFY});if((this.providedUser?.userId??this.user$.value?.userId)!==r)return;let c=a?.[r];if(c&&this.applyLateResolvedLoggedInUser(r,c))return}this.loggingService.catch(`User resolver did not return the logged-in user after ${o.length} retry attempts \u2014 comments created by this author will have no resolved profile until the resolver returns them`,{userId:r,organizationId:i,attempts:o.length})}catch(o){this.loggingService.catch("Error in scheduleLoggedInUserResolveRetry: ",o)}finally{this.loggedInUserResolveRetryInFlightUserId===r&&(this.loggedInUserResolveRetryInFlightUserId=null)}})}applyLateResolvedLoggedInUser(r,i){try{let o=this.user$.value;if(!o||o.userId!==r)return!1;if(!this.afAuth?.currentUser&&!this.portableAuthUser$.value)return!0;let s=Wre(o,i);return this.setUserToStorage(s),this.user$.next(s),!0}catch(o){return this.loggingService.catch("Error in applyLateResolvedLoggedInUser: ",o),!1}}combinedAuthBearer$(){let r=!1;return sc([_d(this.afAuth).pipe(rn(gb)),this.portableAuthUser$]).pipe(_n(([i,o])=>(o!==null&&(r=!0),!!(i!==gb||o!==null||r))),De(([i,o])=>(i===gb?null:i)??o))}getUser$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getUser$","color: green;"),this.combinedAuthBearer$().pipe(Zn(r=>r?this.user$.asObservable():st(null)),ai(gp))}getAuthUser(){return this.loggingService.log("%c[WB] Calling FUNCTION: getAuthUser","color: green;"),this.afAuth?.currentUser}getAuthState$(){return this.combinedAuthBearer$()}getIdTokenResultForUser(r,i){return xp(r,i)}getUserOptions(){return this.loggingService.log("%c[WB] Calling FUNCTION: getUserOptions","color: green;"),this.userOptions$.value}getUserOptions$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getUserOptions$","color: green;"),this.userOptions$.asObservable()}updateUser(r){this.loggingService.log("%c[WB] Calling FUNCTION: updateUser","color: green;");try{let i=this.user$.value;if(r.userId&&r.userId!==i?.userId||r?.groupId&&r?.groupId!==i?.groupId||r?.organizationId&&r?.organizationId!==i?.organizationId)this.providedUser=r,this.initializeClient(r,this.userOptions$?.value||{},new Date().getTime(),void 0,"internal-updateUser");else if(this.providedUser=V(V({},this.providedUser),r),i){let o=V(V({},i),r);this.updateUserInternally(o)}}catch(i){this.loggingService.catch("Error in updateUser: ",i)}}signInWithCustomToken(r,i,o="manual"){this.loggingService.log("%c[WB] Calling FUNCTION: signInWithCustomToken","color: green;");try{return KG(this.afAuth,i).then(s=>(this.analyticsService.trackEvent(St.Events.Core.SDK_USER_AUTH_SUCCESS,{apiKey:this.apiKey,clientUserId:r.userId,snippylyUserId:r.userSnippylyId,authType:o,forceReset:this.userOptions$.value?.forceReset,user:this.getUserForTelemetry(r)}),s)).catch(s=>(this.analyticsService.trackEvent(St.Events.Core.SDK_USER_AUTH_FAILED,{apiKey:this.apiKey,clientUserId:r.userId,snippylyUserId:r.userSnippylyId,authType:o,forceReset:this.userOptions$.value?.forceReset,message:s.message,user:this.getUserForTelemetry(r)}),s))}catch(s){return this.loggingService.catch("Error in signInWithCustomToken: ",s),Promise.reject(s)}}clearCache(){this.loggingService.log("%c[WB] Calling FUNCTION: clearCache","color: green;");try{this.activityService?.resetActivityFeatureConfig()}catch(r){this.loggingService.catch("Error in clearCache: ",r)}}resetServicesCache(){this.loggingService.log("%c[WB] Calling FUNCTION: resetServicesCache in AuthService","color: green;");try{this.crdtService?.flushAllEditorActivities(),this.clearCache(),this.commonDbService?.unsubscribeFromObservables(),this.activityService?.destroy(),this.docService?.clearCacheOnUserCascade(),this.contactService?.clearCache(),this.iamService?.clearCache(),this.areaService?.clearCache(),this.commentService?.clearCache(),this.reactionService?.clearCache(),this.serviceBook.get(DT)?.clearCache(),this.viewsService?.clearCache()}catch(r){this.loggingService.catch("Error in resetServicesCache: ",r)}}initializeSignedInUser(r,i,o){this.loggingService.log("%c[WB] Calling FUNCTION: initializeSignedInUser","color: green;");try{let s=new so;s.userSnippylyId=r.uid,s.type="signedIn",o&&(s=V(V({},s),o)),this.setUserToStorage(s),this.mergeUserWithProvidedUserData(s,i)}catch(s){this.loggingService.catch("Error in initializeSignedInUser: ",s)}}resolveSignedInUserWithProvider(r,i){return y(this,null,function*(){{let o=$c(),s=xT.IDENTIFY;this.coreActionsService.triggerAction(gi.USER_RESOLVER,{event:St.Events.Resolver.USER_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:o,methodName:SR.MERGE_USER_WITH_PROVIDED_USER_DATA,moduleName:s,source:"internal",payload:{userIds:[r.userId],organizationId:i}});let a=yield this.usersService?.resolveUsers({userIds:[r.userId],organizationId:i,skipUserCheck:!0,uniqueId:o,moduleName:s});return a&&a[r.userId]?JSON.parse(JSON.stringify(a[r.userId]||{})):(this.scheduleLoggedInUserResolveRetry(r.userId,i),null)}})}mergeUserWithProvidedUserData(r,i){return y(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: mergeUserWithProvidedUserData","color: green;");try{r.userId=this.providedUser?.userId||r.userId;let o=null;if(this.usersService?.externalUserDataProviderAvailable()){let s=this.providedUser?.clientOrganizationId||r.clientOrganizationId;o=yield this.resolveSignedInUserWithProvider(r,s),r=V(V({},r),o||{})}nb(r,{provided:this.providedUser,resolved:o,avatarColor:s=>this.getUserAvatarColor(s),textColor:s=>this.getUserTextColor(s)}),this.updateUserInternally(r)}catch(o){this.loggingService.catch("Error in mergeUserWithProvidedUserData: ",o)}})}updateUserInternally(r){return y(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: updateUserInternally","color: green;");try{let i=Object.assign({},r);delete i.contacts,this.analyticsService.identifyUser(r.userSnippylyId,i,{forceReset:this.userOptions$.value?.forceReset});let o=this.portableBackend$.value,s=this.portableSessionEpoch;!this.getPlanDetailsCalled&&!o&&this.getPlanDetailsFromDb();let a;if(o)a=eb({apiEndpoint:o.apiEndpoint,token:this.portableToken});else{let h=yd(this.functions,dd({url:this.endpointsService.getCloudFunctionUrl("sdkProxy"),apiProxyDomain:this.configService?.getApiProxyDomain()}));a=TB({methodName:"updateUserInternally",data:{type:"getProjectConfig"},getSdkProxy:h,userId:r?.userId??""})}let c=Promise.resolve();o?this.probeIdentifyPermissionWhenPortableReady(r,s,this.portableChunkReady):c=this.buildIdentifyPermissionProbe(r);let[l,d]=yield Promise.allSettled([a,c]);if(o){if(s!==this.portableSessionEpoch){this.loggingService.log("Velt [portable backend]: discarding an updateUser() that a sign-out or a new identify overtook.");return}l.status==="fulfilled"&&l.value&&this.applyProjectConfig(l.value)}else l.status==="fulfilled"?this.applyProjectConfig(l.value?.data):this.loggingService.warn("Failed to fetch project config:",l.reason);this.afAuth.currentUser?(this.user$.next(r),this.updateUserToFirebase(r)):this.portableAuthUser$.value&&this.user$.next(r)}catch(i){this.loggingService.catch("Error in updateUserInternally: ",i)}})}buildIdentifyPermissionProbe(r){if(this.userPermissionService?.isPermissionProviderAvailable()&&r.clientOrganizationId){let i=[{userId:r.userId,resource:{id:r.clientOrganizationId,type:gV.ORGANIZATION,source:kT.IDENTIFY,organizationId:r.clientOrganizationId}}],o=$c();return this.coreActionsService.triggerAction(gi.PERMISSION_PROVIDER,{event:St.Events.PermissionProvider.RESOURCE_ACCESS_REQUEST_FORMED,methodName:kT.IDENTIFY,uniqueId:o,timestamp:new Date().getTime(),source:"internal",payload:{requests:i}}),this.userPermissionService?.onResourceAccessRequired({requests:i,uniqueId:o,userId:r.userId,methodName:kT.IDENTIFY,fromCache:!1})??Promise.resolve()}return Promise.resolve()}probeIdentifyPermissionWhenPortableReady(r,i,o){return y(this,null,function*(){try{if(yield o,i!==this.portableSessionEpoch||this.user$.value?.userId!==r.userId||!fj()||this.commonDbService?.isPortableBackendActive?.()!==!0)return;yield this.buildIdentifyPermissionProbe(r)}catch(s){this.loggingService.catch("Error in probeIdentifyPermissionWhenPortableReady: ",s)}})}updateUserToFirebase(r){this.loggingService.log("%c[WB] Calling FUNCTION: updateUserToFirebase","color: green;");try{let i=JSON.parse(JSON.stringify(r)),o=le(V({},i),{lastUpdated:new Date})}catch(i){this.loggingService.catch("Error in updateUserToFirebase: ",i)}}getPlanDetailsFromDb(){return y(this,null,function*(){try{this.getPlanDetailsCalled=!0;let i=yield yd(this.functions,dd({url:this.endpointsService.getCloudFunctionUrl("getPlanDetails"),apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:1200*1e3})({apiKey:this.configService.getApiKey(),sdkVersion:Wc(),sdkType:this.configService.getSdkType()});return i?.data?.isPlanExpired&&(this.analyticsService.trackEvent(St.Events.Core.SDK_PLAN_EXPIRED),this.configService.getSF()||console.warn("Velt SDK plan has expired.")),this.planDetails$.next(i?.data||{planInfo:null,isPlanExpired:!1}),i}catch(r){return this.loggingService.catch("Error in getPlanDetailsFromDb: ",r),this.planDetails$.next({planInfo:null,isPlanExpired:!1}),Promise.resolve(null)}})}isPlanExpired$(){return this.planDetails$.pipe(_n(r=>!!r),De(r=>!!r?.isPlanExpired))}isPlanExpired(){return this.planDetails$.getValue()?.isPlanExpired}addPreSignOutFuction(r,i){try{this.preSignOutFunctions.set(r,i)}catch(o){this.loggingService.catch("Error in addPreSignOutFuction: ",o)}}setUserOrganization(r){try{this.loggingService.log("%c[WB] Calling FUNCTION: setUserOrganization","color: green;");let i=JSON.parse(JSON.stringify(this.userOrganization$.value||{}));this.getUser()?.organizationId===r?.organizationId?(i.metadata=r,this.userOrganization$.next(i)):this.userOrganization$.next(null)}catch(i){this.loggingService.catch("Error in setUserOrganization: ",i)}}setOrganizationUserGroups(r){try{this.loggingService.log("%c[WB] Calling FUNCTION: setUserOrganizationGroups","color: green;");let i=JSON.parse(JSON.stringify(this.userOrganization$.value||{}));this.getUser()?.organizationId===i?.metadata?.organizationId&&(i.groups=r,this.userOrganization$.next(i))}catch(i){this.loggingService.catch("Error in setUserOrganizationGroups: ",i)}}getUserOrganization$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getUserOrganization$","color: green;"),this.getUser$().pipe(Zn(r=>r?this.userOrganization$.asObservable().pipe(De(i=>i?.metadata?.organizationId===r.organizationId?i:null)):st(null)))}signOutUser(r="internal"){return y(this,null,function*(){try{this.userPermissionService?.invalidateAllPermissionsState(),this.portableSessionEpoch++,this.portableSignOutOwnsEpochBump=!0,this.pendingPortableRestore=null,this.cancelPortableLicenseRetry(),this.portableResumeUserId=null,this.portableSessionIdentity=null,(this.portableAutoLoginCalled||this.configService?.getEnablePortableBackend()===!0)&&(this.clearPersistedPortableSession(),this.recordPortableSignOut(),this.clearPortableTokenRefresh()),r==="external"&&(this.onRetrySubscription?.unsubscribe(),this.authProviderListenerGeneration++),this.userPermissionService?.revokeAccessOnUserLogout(),this.analyticsService.trackEvent(St.Events.Core.SDK_USER_SIGN_OUT,{apiKey:this.apiKey,clientUserId:this.user$?.value?.userId,snippylyUserId:this.user$?.value?.userSnippylyId,message:r==="external"?"User Sign out":"System Sign out",user:this.user$?.value?this.getUserForTelemetry(this.user$?.value):null,forceReset:this.userOptions$.value?.forceReset,source:r});let i=yield _d(this.afAuth).pipe(Tn(1)).toPromise().catch(o=>null);if(i){this.releaseLiveUserSession("clear");for(let[o,s]of this.preSignOutFunctions)try{yield s(i)}catch(a){this.loggingService.catch(`Error in signOutUser ${o} function: `,a)}return this.user$.next(null),yield hB(1e3),YG(this.afAuth).catch(o=>{this.loggingService.catch("Error in signOutUser:",o)})}else return(this.portableAuthUser$.value||this.portableBackend$.value)&&this.releaseLiveUserSession("clear"),Promise.resolve()}catch(i){this.loggingService.catch("Error in signOutUser: ",i)}finally{this.portableSignOutOwnsEpochBump=!1}})}isFeatureAllowed(r){return nB(this.config,this.user$.value,r)}getUserWithoutContacts(r){try{if(r){let i=JSON.parse(JSON.stringify(r));return delete i.contacts,i}else return null}catch(i){return this.loggingService.catch("Error in getUserWithoutContacts: ",i),null}}getUserForTelemetry(r){try{let i=this.getUserWithoutContacts(r);return i?this.usersService?.userResolverConfigured?.()?jR(i):i:null}catch(i){return this.loggingService.catch("Error in getUserForTelemetry: ",i),null}}getUserForClient(r){try{return VR(r)}catch(i){return this.loggingService.catch("Error in getUserForClient: ",i),null}}getUserAvatarColor(r){try{return r?this.avatarService.generateUserColor(jc(r)):"#625DF5"}catch{return"#625DF5"}}getUserTextColor(r){try{return"#FFFFFF"}catch{return"#FFFFFF"}}setOptionalPropertiesToUsers(r){try{r.forEach(i=>{try{i?.color||(i.color=this.getUserAvatarColor(i?.userId)),i?.textColor||(i.textColor=this.getUserTextColor(i?.userId)),!i?.initial&&(i?.name||i?.email)&&(i.initial=i.name?.charAt(0).toUpperCase()||i.email?.charAt(0).toUpperCase())}catch{}})}catch{}}};e.PORTABLE_REFRESH_WARN_AFTER_FAILURES=3,e.PORTABLE_DOCUMENT_LIFECYCLE_EVENTS=["visibilitychange","resume"],e.PORTABLE_NO_CREDENTIAL_ENVELOPE={error:"No renewal credential.",code:"no_renewal_credential",message:"the session has no renewal credential for the configured gateway",source:"identify"},e.\u0275fac=function(i){return new(i||e)(q(Zc),q(fo),q(U2),q(V2),q(dj),q(Zo),q(ea),q(Nt),q(wT))},e.\u0275prov=Z({token:e,factory:e.\u0275fac,providedIn:"root"});let t=e;return t})();var gj="@firebase/database",mj="1.0.20";var Iw="";function Kre(t){Iw=t}var Sb=class{constructor(e){this.domStorage_=e,this.prefix_="firebase:"}set(e,n){n==null?this.domStorage_.removeItem(this.prefixedName_(e)):this.domStorage_.setItem(this.prefixedName_(e),xt(n))}get(e){let n=this.domStorage_.getItem(this.prefixedName_(e));return n==null?null:fd(n)}remove(e){this.domStorage_.removeItem(this.prefixedName_(e))}prefixedName_(e){return this.prefix_+e}toString(){return this.domStorage_.toString()}};var Ab=class{constructor(){this.cache_={},this.isInMemoryStorage=!0}set(e,n){n==null?delete this.cache_[e]:this.cache_[e]=n}get(e){return zr(this.cache_,e)?this.cache_[e]:null}remove(e){delete this.cache_[e]}};var Kj=function(t){try{if(typeof window<"u"&&typeof window[t]<"u"){let e=window[t];return e.setItem("firebase:sentinel","cache"),e.removeItem("firebase:sentinel"),new Sb(e)}}catch{}return new Ab},cl=Kj("localStorage"),Cb=Kj("sessionStorage");var Rd=new qr("@firebase/database"),Yj=(function(){let t=1;return function(){return t++}})(),Xj=function(t){let e=GB(t),n=new KT;n.update(e);let r=n.digest();return pd.encodeByteArray(r)},fg=function(...t){let e="";for(let n=0;n<t.length;n++){let r=t[n];Array.isArray(r)||r&&typeof r=="object"&&typeof r.length=="number"?e+=fg.apply(null,r):typeof r=="object"?e+=xt(r):e+=r,e+=" "}return e},ll=null,Ej=!0,Yre=function(t,e){Y(!e||t===!0||t===!1,"Can't turn on custom loggers persistently."),t===!0?(Rd.logLevel=be.VERBOSE,ll=Rd.log.bind(Rd),e&&Cb.set("logging_enabled",!0)):typeof t=="function"?ll=t:(ll=null,Cb.remove("logging_enabled"))},un=function(...t){if(Ej===!0&&(Ej=!1,ll===null&&Cb.get("logging_enabled")===!0&&Yre(!0)),ll){let e=fg.apply(null,t);ll(e)}},pg=function(t){return function(...e){un(t,...e)}},Db=function(...t){let e="FIREBASE INTERNAL ERROR: "+fg(...t);Rd.error(e)},rs=function(...t){let e=`FIREBASE FATAL ERROR: ${fg(...t)}`;throw Rd.error(e),new Error(e)},Un=function(...t){let e="FIREBASE WARNING: "+fg(...t);Rd.warn(e)},Xre=function(){typeof window<"u"&&window.location&&window.location.protocol&&window.location.protocol.indexOf("https:")!==-1&&Un("Insecure Firebase access from a secure page. Please use https in calls to new Firebase().")},oI=function(t){return typeof t=="number"&&(t!==t||t===Number.POSITIVE_INFINITY||t===Number.NEGATIVE_INFINITY)},Qre=function(t){if(co()||document.readyState==="complete")t();else{let e=!1,n=function(){if(!document.body){setTimeout(n,Math.floor(10));return}e||(e=!0,t())};document.addEventListener?(document.addEventListener("DOMContentLoaded",n,!1),window.addEventListener("load",n,!1)):document.attachEvent&&(document.attachEvent("onreadystatechange",()=>{document.readyState==="complete"&&n()}),window.attachEvent("onload",n))}},dl="[MIN_NAME]",aa="[MAX_NAME]",El=function(t,e){if(t===e)return 0;if(t===dl||e===aa)return-1;if(e===dl||t===aa)return 1;{let n=_j(t),r=_j(e);return n!==null?r!==null?n-r===0?t.length-e.length:n-r:-1:r!==null?1:t<e?-1:1}},Jre=function(t,e){return t===e?0:t<e?-1:1},zp=function(t,e){if(e&&t in e)return e[t];throw new Error("Missing required key ("+t+") in object: "+xt(e))},vw=function(t){if(typeof t!="object"||t===null)return xt(t);let e=[];for(let r in t)e.push(r);e.sort();let n="{";for(let r=0;r<e.length;r++)r!==0&&(n+=","),n+=xt(e[r]),n+=":",n+=vw(t[e[r]]);return n+="}",n},Qj=function(t,e){let n=t.length;if(n<=e)return[t];let r=[];for(let i=0;i<n;i+=e)i+e>n?r.push(t.substring(i,n)):r.push(t.substring(i,i+e));return r};function dn(t,e){for(let n in t)t.hasOwnProperty(n)&&e(n,t[n])}var Jj=function(t){Y(!oI(t),"Invalid JSON number");let e=11,n=52,r=(1<<e-1)-1,i,o,s,a,c;t===0?(o=0,s=0,i=1/t===-1/0?1:0):(i=t<0,t=Math.abs(t),t>=Math.pow(2,1-r)?(a=Math.min(Math.floor(Math.log(t)/Math.LN2),r),o=a+r,s=Math.round(t*Math.pow(2,n-a)-Math.pow(2,n))):(o=0,s=Math.round(t/Math.pow(2,1-r-n))));let l=[];for(c=n;c;c-=1)l.push(s%2?1:0),s=Math.floor(s/2);for(c=e;c;c-=1)l.push(o%2?1:0),o=Math.floor(o/2);l.push(i?1:0),l.reverse();let d=l.join(""),h="";for(c=0;c<64;c+=8){let f=parseInt(d.substr(c,8),2).toString(16);f.length===1&&(f="0"+f),h=h+f}return h.toLowerCase()},Zre=function(){return!!(typeof window=="object"&&window.chrome&&window.chrome.extension&&!/^chrome/.test(window.location.href))},eie=function(){return typeof Windows=="object"&&typeof Windows.UI=="object"};function tie(t,e){let n="Unknown Error";t==="too_big"?n="The data requested exceeds the maximum size that can be accessed with a single request.":t==="permission_denied"?n="Client doesn't have permission to access the desired data.":t==="unavailable"&&(n="The service is unavailable");let r=new Error(t+" at "+e._path.toString()+": "+n);return r.code=t.toUpperCase(),r}var nie=new RegExp("^-?(0*)\\d{1,10}$"),rie=-2147483648,iie=2147483647,_j=function(t){if(nie.test(t)){let e=Number(t);if(e>=rie&&e<=iie)return e}return null},kd=function(t){try{t()}catch(e){setTimeout(()=>{let n=e.stack||"";throw Un("Exception was thrown by user callback.",n),e},Math.floor(0))}},oie=function(){return(typeof window=="object"&&window.navigator&&window.navigator.userAgent||"").search(/googlebot|google webmaster tools|bingbot|yahoo! slurp|baiduspider|yandexbot|duckduckbot/i)>=0},Xp=function(t,e){let n=setTimeout(t,e);return typeof n=="number"&&typeof Deno<"u"&&Deno.unrefTimer?Deno.unrefTimer(n):typeof n=="object"&&n.unref&&n.unref(),n};var Rb=class{constructor(e,n){this.appCheckProvider=n,this.appName=e.name,rr(e)&&e.settings.appCheckToken&&(this.serverAppAppCheckToken=e.settings.appCheckToken),this.appCheck=n?.getImmediate({optional:!0}),this.appCheck||n?.get().then(r=>this.appCheck=r)}getToken(e){if(this.serverAppAppCheckToken){if(e)throw new Error("Attempted reuse of `FirebaseServerApp.appCheckToken` after previous usage failed.");return Promise.resolve({token:this.serverAppAppCheckToken})}return this.appCheck?this.appCheck.getToken(e):new Promise((n,r)=>{setTimeout(()=>{this.appCheck?this.getToken(e).then(n,r):n(null)},0)})}addTokenChangeListener(e){var n;(n=this.appCheckProvider)===null||n===void 0||n.get().then(r=>r.addTokenListener(e))}notifyForInvalidToken(){Un(`Provided AppCheck credentials for the app named "${this.appName}" are invalid. This usually indicates your app was not initialized correctly.`)}};var Nb=class{constructor(e,n,r){this.appName_=e,this.firebaseOptions_=n,this.authProvider_=r,this.auth_=null,this.auth_=r.getImmediate({optional:!0}),this.auth_||r.onInit(i=>this.auth_=i)}getToken(e){return this.auth_?this.auth_.getToken(e).catch(n=>n&&n.code==="auth/token-not-initialized"?(un("Got auth/token-not-initialized error. Treating as null token."),null):Promise.reject(n)):new Promise((n,r)=>{setTimeout(()=>{this.auth_?this.getToken(e).then(n,r):n(null)},0)})}addTokenChangeListener(e){this.auth_?this.auth_.addAuthTokenListener(e):this.authProvider_.get().then(n=>n.addAuthTokenListener(e))}removeTokenChangeListener(e){this.authProvider_.get().then(n=>n.removeAuthTokenListener(e))}notifyForInvalidToken(){let e='Provided authentication credentials for the app named "'+this.appName_+'" are invalid. This usually indicates your app was not initialized correctly. ';"credential"in this.firebaseOptions_?e+='Make sure the "credential" property provided to initializeApp() is authorized to access the specified "databaseURL" and is from the correct project.':"serviceAccount"in this.firebaseOptions_?e+='Make sure the "serviceAccount" property provided to initializeApp() is authorized to access the specified "databaseURL" and is from the correct project.':e+='Make sure the "apiKey" and "databaseURL" properties provided to initializeApp() match the values provided for your app at https://console.firebase.google.com/.',Un(e)}},Qp=(()=>{class t{constructor(n){this.accessToken=n}getToken(n){return Promise.resolve({accessToken:this.accessToken})}addTokenChangeListener(n){n(this.accessToken)}removeTokenChangeListener(n){}notifyForInvalidToken(){}}t.OWNER="owner";return t})(),Py="5",Zj="v",eH="s",tH="r",nH="f",rH=/(console\.firebase|firebase-console-\w+\.corp|firebase\.corp)\.google\.com/,iH="ls",oH="p",bb="ac",sH="websocket",aH="long_polling";var xy=class{constructor(e,n,r,i,o=!1,s="",a=!1,c=!1,l=null){this.secure=n,this.namespace=r,this.webSocketOnly=i,this.nodeAdmin=o,this.persistenceKey=s,this.includeNamespaceInQueryParams=a,this.isUsingEmulator=c,this.emulatorOptions=l,this._host=e.toLowerCase(),this._domain=this._host.substr(this._host.indexOf(".")+1),this.internalHost=cl.get("host:"+e)||this._host}isCacheableHost(){return this.internalHost.substr(0,2)==="s-"}isCustomHost(){return this._domain!=="firebaseio.com"&&this._domain!=="firebaseio-demo.com"}get host(){return this._host}set host(e){e!==this.internalHost&&(this.internalHost=e,this.isCacheableHost()&&cl.set("host:"+this._host,this.internalHost))}toString(){let e=this.toURLString();return this.persistenceKey&&(e+="<"+this.persistenceKey+">"),e}toURLString(){let e=this.secure?"https://":"http://",n=this.includeNamespaceInQueryParams?`?ns=${this.namespace}`:"";return`${e}${this.host}/${n}`}};function sie(t){return t.host!==t.internalHost||t.isCustomHost()||t.includeNamespaceInQueryParams}function cH(t,e,n){Y(typeof e=="string","typeof type must == string"),Y(typeof n=="object","typeof params must == object");let r;if(e===sH)r=(t.secure?"wss://":"ws://")+t.internalHost+"/.ws?";else if(e===aH)r=(t.secure?"https://":"http://")+t.internalHost+"/.lp?";else throw new Error("Unknown connection type: "+e);sie(t)&&(n.ns=t.namespace);let i=[];return dn(n,(o,s)=>{i.push(o+"="+s)}),r+i.join("&")}var wb=class{constructor(){this.counters_={}}incrementCounter(e,n=1){zr(this.counters_,e)||(this.counters_[e]=0),this.counters_[e]+=n}get(){return NB(this.counters_)}};var mb={},Eb={};function Sw(t){let e=t.toString();return mb[e]||(mb[e]=new wb),mb[e]}function aie(t,e){let n=t.toString();return Eb[n]||(Eb[n]=e()),Eb[n]}var Ob=class{constructor(e){this.onMessage_=e,this.pendingResponses=[],this.currentResponseNum=0,this.closeAfterResponse=-1,this.onClose=null}closeAfter(e,n){this.closeAfterResponse=e,this.onClose=n,this.closeAfterResponse<this.currentResponseNum&&(this.onClose(),this.onClose=null)}handleResponse(e,n){for(this.pendingResponses[e]=n;this.pendingResponses[this.currentResponseNum];){let r=this.pendingResponses[this.currentResponseNum];delete this.pendingResponses[this.currentResponseNum];for(let i=0;i<r.length;++i)r[i]&&kd(()=>{this.onMessage_(r[i])});if(this.currentResponseNum===this.closeAfterResponse){this.onClose&&(this.onClose(),this.onClose=null);break}this.currentResponseNum++}}};var Tj="start",cie="close",lie="pLPCommand",uie="pRTLPCB",lH="id",uH="pw",dH="ser",die="cb",hie="seg",fie="ts",pie="d",gie="dframe",hH=1870,fH=30,mie=hH-fH,Eie=25e3,_ie=3e4,ky=class t{constructor(e,n,r,i,o,s,a){this.connId=e,this.repoInfo=n,this.applicationId=r,this.appCheckToken=i,this.authToken=o,this.transportSessionId=s,this.lastSessionId=a,this.bytesSent=0,this.bytesReceived=0,this.everConnected_=!1,this.log_=pg(e),this.stats_=Sw(n),this.urlFn=c=>(this.appCheckToken&&(c[bb]=this.appCheckToken),cH(n,aH,c))}open(e,n){this.curSegmentNum=0,this.onDisconnect_=n,this.myPacketOrderer=new Ob(e),this.isClosed_=!1,this.connectTimeoutTimer_=setTimeout(()=>{this.log_("Timed out trying to connect."),this.onClosed_(),this.connectTimeoutTimer_=null},Math.floor(_ie)),Qre(()=>{if(this.isClosed_)return;this.scriptTagHolder=new Lb((...o)=>{let[s,a,c,l,d]=o;if(this.incrementIncomingBytes_(o),!!this.scriptTagHolder)if(this.connectTimeoutTimer_&&(clearTimeout(this.connectTimeoutTimer_),this.connectTimeoutTimer_=null),this.everConnected_=!0,s===Tj)this.id=a,this.password=c;else if(s===cie)a?(this.scriptTagHolder.sendNewPolls=!1,this.myPacketOrderer.closeAfter(a,()=>{this.onClosed_()})):this.onClosed_();else throw new Error("Unrecognized command received: "+s)},(...o)=>{let[s,a]=o;this.incrementIncomingBytes_(o),this.myPacketOrderer.handleResponse(s,a)},()=>{this.onClosed_()},this.urlFn);let r={};r[Tj]="t",r[dH]=Math.floor(Math.random()*1e8),this.scriptTagHolder.uniqueCallbackIdentifier&&(r[die]=this.scriptTagHolder.uniqueCallbackIdentifier),r[Zj]=Py,this.transportSessionId&&(r[eH]=this.transportSessionId),this.lastSessionId&&(r[iH]=this.lastSessionId),this.applicationId&&(r[oH]=this.applicationId),this.appCheckToken&&(r[bb]=this.appCheckToken),typeof location<"u"&&location.hostname&&rH.test(location.hostname)&&(r[tH]=nH);let i=this.urlFn(r);this.log_("Connecting via long-poll to "+i),this.scriptTagHolder.addTag(i,()=>{})})}start(){this.scriptTagHolder.startLongPoll(this.id,this.password),this.addDisconnectPingFrame(this.id,this.password)}static forceAllow(){t.forceAllow_=!0}static forceDisallow(){t.forceDisallow_=!0}static isAvailable(){return co()?!1:t.forceAllow_?!0:!t.forceDisallow_&&typeof document<"u"&&document.createElement!=null&&!Zre()&&!eie()}markConnectionHealthy(){}shutdown_(){this.isClosed_=!0,this.scriptTagHolder&&(this.scriptTagHolder.close(),this.scriptTagHolder=null),this.myDisconnFrame&&(document.body.removeChild(this.myDisconnFrame),this.myDisconnFrame=null),this.connectTimeoutTimer_&&(clearTimeout(this.connectTimeoutTimer_),this.connectTimeoutTimer_=null)}onClosed_(){this.isClosed_||(this.log_("Longpoll is closing itself"),this.shutdown_(),this.onDisconnect_&&(this.onDisconnect_(this.everConnected_),this.onDisconnect_=null))}close(){this.isClosed_||(this.log_("Longpoll is being closed."),this.shutdown_())}send(e){let n=xt(e);this.bytesSent+=n.length,this.stats_.incrementCounter("bytes_sent",n.length);let r=KR(n),i=Qj(r,mie);for(let o=0;o<i.length;o++)this.scriptTagHolder.enqueueSegment(this.curSegmentNum,i.length,i[o]),this.curSegmentNum++}addDisconnectPingFrame(e,n){if(co())return;this.myDisconnFrame=document.createElement("iframe");let r={};r[gie]="t",r[lH]=e,r[uH]=n,this.myDisconnFrame.src=this.urlFn(r),this.myDisconnFrame.style.display="none",document.body.appendChild(this.myDisconnFrame)}incrementIncomingBytes_(e){let n=xt(e).length;this.bytesReceived+=n,this.stats_.incrementCounter("bytes_received",n)}},Lb=class t{constructor(e,n,r,i){if(this.onDisconnect=r,this.urlFn=i,this.outstandingRequests=new Set,this.pendingSegs=[],this.currentSerial=Math.floor(Math.random()*1e8),this.sendNewPolls=!0,co())this.commandCB=e,this.onMessageCB=n;else{this.uniqueCallbackIdentifier=Yj(),window[lie+this.uniqueCallbackIdentifier]=e,window[uie+this.uniqueCallbackIdentifier]=n,this.myIFrame=t.createIFrame_();let o="";this.myIFrame.src&&this.myIFrame.src.substr(0,11)==="javascript:"&&(o='<script>document.domain="'+document.domain+'";<\/script>');let s="<html><body>"+o+"</body></html>";try{this.myIFrame.doc.open(),this.myIFrame.doc.write(s),this.myIFrame.doc.close()}catch(a){un("frame writing exception"),a.stack&&un(a.stack),un(a)}}}static createIFrame_(){let e=document.createElement("iframe");if(e.style.display="none",document.body){document.body.appendChild(e);try{e.contentWindow.document||un("No IE domain setting required")}catch{let r=document.domain;e.src="javascript:void((function(){document.open();document.domain='"+r+"';document.close();})())"}}else throw"Document body has not initialized. Wait to initialize Firebase until after the document is ready.";return e.contentDocument?e.doc=e.contentDocument:e.contentWindow?e.doc=e.contentWindow.document:e.document&&(e.doc=e.document),e}close(){this.alive=!1,this.myIFrame&&(this.myIFrame.doc.body.textContent="",setTimeout(()=>{this.myIFrame!==null&&(document.body.removeChild(this.myIFrame),this.myIFrame=null)},Math.floor(0)));let e=this.onDisconnect;e&&(this.onDisconnect=null,e())}startLongPoll(e,n){for(this.myID=e,this.myPW=n,this.alive=!0;this.newRequest_(););}newRequest_(){if(this.alive&&this.sendNewPolls&&this.outstandingRequests.size<(this.pendingSegs.length>0?2:1)){this.currentSerial++;let e={};e[lH]=this.myID,e[uH]=this.myPW,e[dH]=this.currentSerial;let n=this.urlFn(e),r="",i=0;for(;this.pendingSegs.length>0&&this.pendingSegs[0].d.length+fH+r.length<=hH;){let s=this.pendingSegs.shift();r=r+"&"+hie+i+"="+s.seg+"&"+fie+i+"="+s.ts+"&"+pie+i+"="+s.d,i++}return n=n+r,this.addLongPollTag_(n,this.currentSerial),!0}else return!1}enqueueSegment(e,n,r){this.pendingSegs.push({seg:e,ts:n,d:r}),this.alive&&this.newRequest_()}addLongPollTag_(e,n){this.outstandingRequests.add(n);let r=()=>{this.outstandingRequests.delete(n),this.newRequest_()},i=setTimeout(r,Math.floor(Eie)),o=()=>{clearTimeout(i),r()};this.addTag(e,o)}addTag(e,n){co()?this.doNodeLongPoll(e,n):setTimeout(()=>{try{if(!this.sendNewPolls)return;let r=this.myIFrame.doc.createElement("script");r.type="text/javascript",r.async=!0,r.src=e,r.onload=r.onreadystatechange=function(){let i=r.readyState;(!i||i==="loaded"||i==="complete")&&(r.onload=r.onreadystatechange=null,r.parentNode&&r.parentNode.removeChild(r),n())},r.onerror=()=>{un("Long-poll script failed to load: "+e),this.sendNewPolls=!1,this.close()},this.myIFrame.doc.body.appendChild(r)}catch{}},Math.floor(1))}};var Tie=16384,yie=45e3,Fy=null;typeof MozWebSocket<"u"?Fy=MozWebSocket:typeof WebSocket<"u"&&(Fy=WebSocket);var Cd=(()=>{class t{constructor(n,r,i,o,s,a,c){this.connId=n,this.applicationId=i,this.appCheckToken=o,this.authToken=s,this.keepaliveTimer=null,this.frames=null,this.totalFrames=0,this.bytesSent=0,this.bytesReceived=0,this.log_=pg(this.connId),this.stats_=Sw(r),this.connURL=t.connectionURL_(r,a,c,o,i),this.nodeAdmin=r.nodeAdmin}static connectionURL_(n,r,i,o,s){let a={};return a[Zj]=Py,!co()&&typeof location<"u"&&location.hostname&&rH.test(location.hostname)&&(a[tH]=nH),r&&(a[eH]=r),i&&(a[iH]=i),o&&(a[bb]=o),s&&(a[oH]=s),cH(n,sH,a)}open(n,r){this.onDisconnect=r,this.onMessage=n,this.log_("Websocket connecting to "+this.connURL),this.everConnected_=!1,cl.set("previous_websocket_failure",!0);try{let i;if(co()){let o=this.nodeAdmin?"AdminNode":"Node";i={headers:{"User-Agent":`Firebase/${Py}/${Iw}/${process.platform}/${o}`,"X-Firebase-GMPID":this.applicationId||""}},this.authToken&&(i.headers.Authorization=`Bearer ${this.authToken}`),this.appCheckToken&&(i.headers["X-Firebase-AppCheck"]=this.appCheckToken);let s=process.env,a=this.connURL.indexOf("wss://")===0?s.HTTPS_PROXY||s.https_proxy:s.HTTP_PROXY||s.http_proxy;a&&(i.proxy={origin:a})}this.mySock=new Fy(this.connURL,[],i)}catch(i){this.log_("Error instantiating WebSocket.");let o=i.message||i.data;o&&this.log_(o),this.onClosed_();return}this.mySock.onopen=()=>{this.log_("Websocket connected."),this.everConnected_=!0},this.mySock.onclose=()=>{this.log_("Websocket connection was disconnected."),this.mySock=null,this.onClosed_()},this.mySock.onmessage=i=>{this.handleIncomingFrame(i)},this.mySock.onerror=i=>{this.log_("WebSocket error. Closing connection.");let o=i.message||i.data;o&&this.log_(o),this.onClosed_()}}start(){}static forceDisallow(){t.forceDisallow_=!0}static isAvailable(){let n=!1;if(typeof navigator<"u"&&navigator.userAgent){let r=/Android ([0-9]{0,}\.[0-9]{0,})/,i=navigator.userAgent.match(r);i&&i.length>1&&parseFloat(i[1])<4.4&&(n=!0)}return!n&&Fy!==null&&!t.forceDisallow_}static previouslyFailed(){return cl.isInMemoryStorage||cl.get("previous_websocket_failure")===!0}markConnectionHealthy(){cl.remove("previous_websocket_failure")}appendFrame_(n){if(this.frames.push(n),this.frames.length===this.totalFrames){let r=this.frames.join("");this.frames=null;let i=fd(r);this.onMessage(i)}}handleNewFrameCount_(n){this.totalFrames=n,this.frames=[]}extractFrameCount_(n){if(Y(this.frames===null,"We already have a frame buffer"),n.length<=6){let r=Number(n);if(!isNaN(r))return this.handleNewFrameCount_(r),null}return this.handleNewFrameCount_(1),n}handleIncomingFrame(n){if(this.mySock===null)return;let r=n.data;if(this.bytesReceived+=r.length,this.stats_.incrementCounter("bytes_received",r.length),this.resetKeepAlive(),this.frames!==null)this.appendFrame_(r);else{let i=this.extractFrameCount_(r);i!==null&&this.appendFrame_(i)}}send(n){this.resetKeepAlive();let r=xt(n);this.bytesSent+=r.length,this.stats_.incrementCounter("bytes_sent",r.length);let i=Qj(r,Tie);i.length>1&&this.sendString_(String(i.length));for(let o=0;o<i.length;o++)this.sendString_(i[o])}shutdown_(){this.isClosed_=!0,this.keepaliveTimer&&(clearInterval(this.keepaliveTimer),this.keepaliveTimer=null),this.mySock&&(this.mySock.close(),this.mySock=null)}onClosed_(){this.isClosed_||(this.log_("WebSocket is closing itself"),this.shutdown_(),this.onDisconnect&&(this.onDisconnect(this.everConnected_),this.onDisconnect=null))}close(){this.isClosed_||(this.log_("WebSocket is being closed"),this.shutdown_())}resetKeepAlive(){clearInterval(this.keepaliveTimer),this.keepaliveTimer=setInterval(()=>{this.mySock&&this.sendString_("0"),this.resetKeepAlive()},Math.floor(yie))}sendString_(n){try{this.mySock.send(n)}catch(r){this.log_("Exception thrown from WebSocket.send():",r.message||r.data,"Closing connection."),setTimeout(this.onClosed_.bind(this),0)}}}t.responsesRequiredToBeHealthy=2,t.healthyTimeout=3e4;return t})(),pH=(()=>{class t{static get ALL_TRANSPORTS(){return[ky,Cd]}static get IS_TRANSPORT_INITIALIZED(){return this.globalTransportInitialized_}constructor(n){this.initTransports_(n)}initTransports_(n){let r=Cd&&Cd.isAvailable(),i=r&&!Cd.previouslyFailed();if(n.webSocketOnly&&(r||Un("wss:// URL used, but browser isn't known to support websockets. Trying anyway."),i=!0),i)this.transports_=[Cd];else{let o=this.transports_=[];for(let s of t.ALL_TRANSPORTS)s&&s.isAvailable()&&o.push(s);t.globalTransportInitialized_=!0}}initialTransport(){if(this.transports_.length>0)return this.transports_[0];throw new Error("No transports available")}upgradeTransport(){return this.transports_.length>1?this.transports_[1]:null}}t.globalTransportInitialized_=!1;return t})(),Iie=6e4,vie=5e3,Sie=10*1024,Aie=100*1024,_b="t",yj="d",Cie="s",Ij="r",Die="e",vj="o",Sj="a",Aj="n",Cj="p",Rie="h",Mb=class{constructor(e,n,r,i,o,s,a,c,l,d){this.id=e,this.repoInfo_=n,this.applicationId_=r,this.appCheckToken_=i,this.authToken_=o,this.onMessage_=s,this.onReady_=a,this.onDisconnect_=c,this.onKill_=l,this.lastSessionId=d,this.connectionCount=0,this.pendingDataMessages=[],this.state_=0,this.log_=pg("c:"+this.id+":"),this.transportManager_=new pH(n),this.log_("Connection created"),this.start_()}start_(){let e=this.transportManager_.initialTransport();this.conn_=new e(this.nextTransportId_(),this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,null,this.lastSessionId),this.primaryResponsesRequired_=e.responsesRequiredToBeHealthy||0;let n=this.connReceiver_(this.conn_),r=this.disconnReceiver_(this.conn_);this.tx_=this.conn_,this.rx_=this.conn_,this.secondaryConn_=null,this.isHealthy_=!1,setTimeout(()=>{this.conn_&&this.conn_.open(n,r)},Math.floor(0));let i=e.healthyTimeout||0;i>0&&(this.healthyTimeout_=Xp(()=>{this.healthyTimeout_=null,this.isHealthy_||(this.conn_&&this.conn_.bytesReceived>Aie?(this.log_("Connection exceeded healthy timeout but has received "+this.conn_.bytesReceived+" bytes. Marking connection healthy."),this.isHealthy_=!0,this.conn_.markConnectionHealthy()):this.conn_&&this.conn_.bytesSent>Sie?this.log_("Connection exceeded healthy timeout but has sent "+this.conn_.bytesSent+" bytes. Leaving connection alive."):(this.log_("Closing unhealthy connection after timeout."),this.close()))},Math.floor(i)))}nextTransportId_(){return"c:"+this.id+":"+this.connectionCount++}disconnReceiver_(e){return n=>{e===this.conn_?this.onConnectionLost_(n):e===this.secondaryConn_?(this.log_("Secondary connection lost."),this.onSecondaryConnectionLost_()):this.log_("closing an old connection")}}connReceiver_(e){return n=>{this.state_!==2&&(e===this.rx_?this.onPrimaryMessageReceived_(n):e===this.secondaryConn_?this.onSecondaryMessageReceived_(n):this.log_("message on old connection"))}}sendRequest(e){let n={t:"d",d:e};this.sendData_(n)}tryCleanupConnection(){this.tx_===this.secondaryConn_&&this.rx_===this.secondaryConn_&&(this.log_("cleaning up and promoting a connection: "+this.secondaryConn_.connId),this.conn_=this.secondaryConn_,this.secondaryConn_=null)}onSecondaryControl_(e){if(_b in e){let n=e[_b];n===Sj?this.upgradeIfSecondaryHealthy_():n===Ij?(this.log_("Got a reset on secondary, closing it"),this.secondaryConn_.close(),(this.tx_===this.secondaryConn_||this.rx_===this.secondaryConn_)&&this.close()):n===vj&&(this.log_("got pong on secondary."),this.secondaryResponsesRequired_--,this.upgradeIfSecondaryHealthy_())}}onSecondaryMessageReceived_(e){let n=zp("t",e),r=zp("d",e);if(n==="c")this.onSecondaryControl_(r);else if(n==="d")this.pendingDataMessages.push(r);else throw new Error("Unknown protocol layer: "+n)}upgradeIfSecondaryHealthy_(){this.secondaryResponsesRequired_<=0?(this.log_("Secondary connection is healthy."),this.isHealthy_=!0,this.secondaryConn_.markConnectionHealthy(),this.proceedWithUpgrade_()):(this.log_("sending ping on secondary."),this.secondaryConn_.send({t:"c",d:{t:Cj,d:{}}}))}proceedWithUpgrade_(){this.secondaryConn_.start(),this.log_("sending client ack on secondary"),this.secondaryConn_.send({t:"c",d:{t:Sj,d:{}}}),this.log_("Ending transmission on primary"),this.conn_.send({t:"c",d:{t:Aj,d:{}}}),this.tx_=this.secondaryConn_,this.tryCleanupConnection()}onPrimaryMessageReceived_(e){let n=zp("t",e),r=zp("d",e);n==="c"?this.onControl_(r):n==="d"&&this.onDataMessage_(r)}onDataMessage_(e){this.onPrimaryResponse_(),this.onMessage_(e)}onPrimaryResponse_(){this.isHealthy_||(this.primaryResponsesRequired_--,this.primaryResponsesRequired_<=0&&(this.log_("Primary connection is healthy."),this.isHealthy_=!0,this.conn_.markConnectionHealthy()))}onControl_(e){let n=zp(_b,e);if(yj in e){let r=e[yj];if(n===Rie){let i=Object.assign({},r);this.repoInfo_.isUsingEmulator&&(i.h=this.repoInfo_.host),this.onHandshake_(i)}else if(n===Aj){this.log_("recvd end transmission on primary"),this.rx_=this.secondaryConn_;for(let i=0;i<this.pendingDataMessages.length;++i)this.onDataMessage_(this.pendingDataMessages[i]);this.pendingDataMessages=[],this.tryCleanupConnection()}else n===Cie?this.onConnectionShutdown_(r):n===Ij?this.onReset_(r):n===Die?Db("Server Error: "+r):n===vj?(this.log_("got pong on primary."),this.onPrimaryResponse_(),this.sendPingOnPrimaryIfNecessary_()):Db("Unknown control packet command: "+n)}}onHandshake_(e){let n=e.ts,r=e.v,i=e.h;this.sessionId=e.s,this.repoInfo_.host=i,this.state_===0&&(this.conn_.start(),this.onConnectionEstablished_(this.conn_,n),Py!==r&&Un("Protocol version mismatch detected"),this.tryStartUpgrade_())}tryStartUpgrade_(){let e=this.transportManager_.upgradeTransport();e&&this.startUpgrade_(e)}startUpgrade_(e){this.secondaryConn_=new e(this.nextTransportId_(),this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,this.sessionId),this.secondaryResponsesRequired_=e.responsesRequiredToBeHealthy||0;let n=this.connReceiver_(this.secondaryConn_),r=this.disconnReceiver_(this.secondaryConn_);this.secondaryConn_.open(n,r),Xp(()=>{this.secondaryConn_&&(this.log_("Timed out trying to upgrade."),this.secondaryConn_.close())},Math.floor(Iie))}onReset_(e){this.log_("Reset packet received. New host: "+e),this.repoInfo_.host=e,this.state_===1?this.close():(this.closeConnections_(),this.start_())}onConnectionEstablished_(e,n){this.log_("Realtime connection established."),this.conn_=e,this.state_=1,this.onReady_&&(this.onReady_(n,this.sessionId),this.onReady_=null),this.primaryResponsesRequired_===0?(this.log_("Primary connection is healthy."),this.isHealthy_=!0):Xp(()=>{this.sendPingOnPrimaryIfNecessary_()},Math.floor(vie))}sendPingOnPrimaryIfNecessary_(){!this.isHealthy_&&this.state_===1&&(this.log_("sending ping on primary."),this.sendData_({t:"c",d:{t:Cj,d:{}}}))}onSecondaryConnectionLost_(){let e=this.secondaryConn_;this.secondaryConn_=null,(this.tx_===e||this.rx_===e)&&this.close()}onConnectionLost_(e){this.conn_=null,!e&&this.state_===0?(this.log_("Realtime connection failed."),this.repoInfo_.isCacheableHost()&&(cl.remove("host:"+this.repoInfo_.host),this.repoInfo_.internalHost=this.repoInfo_.host)):this.state_===1&&this.log_("Realtime connection lost."),this.close()}onConnectionShutdown_(e){this.log_("Connection shutdown command received. Shutting down..."),this.onKill_&&(this.onKill_(e),this.onKill_=null),this.onDisconnect_=null,this.close()}sendData_(e){if(this.state_!==1)throw"Connection is not connected";this.tx_.send(e)}close(){this.state_!==2&&(this.log_("Closing realtime connection."),this.state_=2,this.closeConnections_(),this.onDisconnect_&&(this.onDisconnect_(),this.onDisconnect_=null))}closeConnections_(){this.log_("Shutting down all connections"),this.conn_&&(this.conn_.close(),this.conn_=null),this.secondaryConn_&&(this.secondaryConn_.close(),this.secondaryConn_=null),this.healthyTimeout_&&(clearTimeout(this.healthyTimeout_),this.healthyTimeout_=null)}};var Uy=class{put(e,n,r,i){}merge(e,n,r,i){}refreshAuthToken(e){}refreshAppCheckToken(e){}onDisconnectPut(e,n,r){}onDisconnectMerge(e,n,r){}onDisconnectCancel(e,n){}reportStats(e){}};var Vy=class{constructor(e){this.allowedEvents_=e,this.listeners_={},Y(Array.isArray(e)&&e.length>0,"Requires a non-empty array")}trigger(e,...n){if(Array.isArray(this.listeners_[e])){let r=[...this.listeners_[e]];for(let i=0;i<r.length;i++)r[i].callback.apply(r[i].context,n)}}on(e,n,r){this.validateEventType_(e),this.listeners_[e]=this.listeners_[e]||[],this.listeners_[e].push({callback:n,context:r});let i=this.getInitialEvent(e);i&&n.apply(r,i)}off(e,n,r){this.validateEventType_(e);let i=this.listeners_[e]||[];for(let o=0;o<i.length;o++)if(i[o].callback===n&&(!r||r===i[o].context)){i.splice(o,1);return}}validateEventType_(e){Y(this.allowedEvents_.find(n=>n===e),"Unknown event: "+e)}};var By=class t extends Vy{static getInstance(){return new t}constructor(){super(["online"]),this.online_=!0,typeof window<"u"&&typeof window.addEventListener<"u"&&!Tp()&&(window.addEventListener("online",()=>{this.online_||(this.online_=!0,this.trigger("online",!0))},!1),window.addEventListener("offline",()=>{this.online_&&(this.online_=!1,this.trigger("online",!1))},!1))}getInitialEvent(e){return Y(e==="online","Unknown event type: "+e),[this.online_]}currentlyOnline(){return this.online_}};var Dj=32,Rj=768,He=class{constructor(e,n){if(n===void 0){this.pieces_=e.split("/");let r=0;for(let i=0;i<this.pieces_.length;i++)this.pieces_[i].length>0&&(this.pieces_[r]=this.pieces_[i],r++);this.pieces_.length=r,this.pieceNum_=0}else this.pieces_=e,this.pieceNum_=n}toString(){let e="";for(let n=this.pieceNum_;n<this.pieces_.length;n++)this.pieces_[n]!==""&&(e+="/"+this.pieces_[n]);return e||"/"}};function je(){return new He("")}function we(t){return t.pieceNum_>=t.pieces_.length?null:t.pieces_[t.pieceNum_]}function ca(t){return t.pieces_.length-t.pieceNum_}function lt(t){let e=t.pieceNum_;return e<t.pieces_.length&&e++,new He(t.pieces_,e)}function Aw(t){return t.pieceNum_<t.pieces_.length?t.pieces_[t.pieces_.length-1]:null}function Nie(t){let e="";for(let n=t.pieceNum_;n<t.pieces_.length;n++)t.pieces_[n]!==""&&(e+="/"+encodeURIComponent(String(t.pieces_[n])));return e||"/"}function tg(t,e=0){return t.pieces_.slice(t.pieceNum_+e)}function gH(t){if(t.pieceNum_>=t.pieces_.length)return null;let e=[];for(let n=t.pieceNum_;n<t.pieces_.length-1;n++)e.push(t.pieces_[n]);return new He(e,0)}function Ct(t,e){let n=[];for(let r=t.pieceNum_;r<t.pieces_.length;r++)n.push(t.pieces_[r]);if(e instanceof He)for(let r=e.pieceNum_;r<e.pieces_.length;r++)n.push(e.pieces_[r]);else{let r=e.split("/");for(let i=0;i<r.length;i++)r[i].length>0&&n.push(r[i])}return new He(n,0)}function Oe(t){return t.pieceNum_>=t.pieces_.length}function Kn(t,e){let n=we(t),r=we(e);if(n===null)return e;if(n===r)return Kn(lt(t),lt(e));throw new Error("INTERNAL ERROR: innerPath ("+e+") is not within outerPath ("+t+")")}function bie(t,e){let n=tg(t,0),r=tg(e,0);for(let i=0;i<n.length&&i<r.length;i++){let o=El(n[i],r[i]);if(o!==0)return o}return n.length===r.length?0:n.length<r.length?-1:1}function Cw(t,e){if(ca(t)!==ca(e))return!1;for(let n=t.pieceNum_,r=e.pieceNum_;n<=t.pieces_.length;n++,r++)if(t.pieces_[n]!==e.pieces_[r])return!1;return!0}function Yr(t,e){let n=t.pieceNum_,r=e.pieceNum_;if(ca(t)>ca(e))return!1;for(;n<t.pieces_.length;){if(t.pieces_[n]!==e.pieces_[r])return!1;++n,++r}return!0}var Pb=class{constructor(e,n){this.errorPrefix_=n,this.parts_=tg(e,0),this.byteLength_=Math.max(1,this.parts_.length);for(let r=0;r<this.parts_.length;r++)this.byteLength_+=Sp(this.parts_[r]);mH(this)}};function wie(t,e){t.parts_.length>0&&(t.byteLength_+=1),t.parts_.push(e),t.byteLength_+=Sp(e),mH(t)}function Oie(t){let e=t.parts_.pop();t.byteLength_-=Sp(e),t.parts_.length>0&&(t.byteLength_-=1)}function mH(t){if(t.byteLength_>Rj)throw new Error(t.errorPrefix_+"has a key path longer than "+Rj+" bytes ("+t.byteLength_+").");if(t.parts_.length>Dj)throw new Error(t.errorPrefix_+"path specified exceeds the maximum depth that can be written ("+Dj+") or object contains a cycle "+al(t))}function al(t){return t.parts_.length===0?"":"in property '"+t.parts_.join(".")+"'"}var xb=class t extends Vy{static getInstance(){return new t}constructor(){super(["visible"]);let e,n;typeof document<"u"&&typeof document.addEventListener<"u"&&(typeof document.hidden<"u"?(n="visibilitychange",e="hidden"):typeof document.mozHidden<"u"?(n="mozvisibilitychange",e="mozHidden"):typeof document.msHidden<"u"?(n="msvisibilitychange",e="msHidden"):typeof document.webkitHidden<"u"&&(n="webkitvisibilitychange",e="webkitHidden")),this.visible_=!0,n&&document.addEventListener(n,()=>{let r=!document[e];r!==this.visible_&&(this.visible_=r,this.trigger("visible",r))},!1)}getInitialEvent(e){return Y(e==="visible","Unknown event type: "+e),[this.visible_]}};var qp=1e3,Lie=300*1e3,Nj=30*1e3,Mie=1.3,Pie=3e4,xie="server_kill",bj=3,Dw=(()=>{class t extends Uy{constructor(n,r,i,o,s,a,c,l){if(super(),this.repoInfo_=n,this.applicationId_=r,this.onDataUpdate_=i,this.onConnectStatus_=o,this.onServerInfoUpdate_=s,this.authTokenProvider_=a,this.appCheckTokenProvider_=c,this.authOverride_=l,this.id=t.nextPersistentConnectionId_++,this.log_=pg("p:"+this.id+":"),this.interruptReasons_={},this.listens=new Map,this.outstandingPuts_=[],this.outstandingGets_=[],this.outstandingPutCount_=0,this.outstandingGetCount_=0,this.onDisconnectRequestQueue_=[],this.connected_=!1,this.reconnectDelay_=qp,this.maxReconnectDelay_=Lie,this.securityDebugCallback_=null,this.lastSessionId=null,this.establishConnectionTimer_=null,this.visible_=!1,this.requestCBHash_={},this.requestNumber_=0,this.realtime_=null,this.authToken_=null,this.appCheckToken_=null,this.forceTokenRefresh_=!1,this.invalidAuthTokenCount_=0,this.invalidAppCheckTokenCount_=0,this.firstConnection_=!0,this.lastConnectionAttemptTime_=null,this.lastConnectionEstablishedTime_=null,l&&!co())throw new Error("Auth override specified in options, but not supported on non Node.js platforms");xb.getInstance().on("visible",this.onVisible_,this),n.host.indexOf("fblocal")===-1&&By.getInstance().on("online",this.onOnline_,this)}sendRequest(n,r,i){let o=++this.requestNumber_,s={r:o,a:n,b:r};this.log_(xt(s)),Y(this.connected_,"sendRequest call when we're not connected not allowed."),this.realtime_.sendRequest(s),i&&(this.requestCBHash_[o]=i)}get(n){this.initConnection_();let r=new cn,o={action:"g",request:{p:n._path.toString(),q:n._queryObject},onComplete:a=>{let c=a.d;a.s==="ok"?r.resolve(c):r.reject(c)}};this.outstandingGets_.push(o),this.outstandingGetCount_++;let s=this.outstandingGets_.length-1;return this.connected_&&this.sendGet_(s),r.promise}listen(n,r,i,o){this.initConnection_();let s=n._queryIdentifier,a=n._path.toString();this.log_("Listen called for "+a+" "+s),this.listens.has(a)||this.listens.set(a,new Map),Y(n._queryParams.isDefault()||!n._queryParams.loadsAllData(),"listen() called for non-default but complete query"),Y(!this.listens.get(a).has(s),"listen() called twice for same path/queryId.");let c={onComplete:o,hashFn:r,query:n,tag:i};this.listens.get(a).set(s,c),this.connected_&&this.sendListen_(c)}sendGet_(n){let r=this.outstandingGets_[n];this.sendRequest("g",r.request,i=>{delete this.outstandingGets_[n],this.outstandingGetCount_--,this.outstandingGetCount_===0&&(this.outstandingGets_=[]),r.onComplete&&r.onComplete(i)})}sendListen_(n){let r=n.query,i=r._path.toString(),o=r._queryIdentifier;this.log_("Listen on "+i+" for "+o);let s={p:i},a="q";n.tag&&(s.q=r._queryObject,s.t=n.tag),s.h=n.hashFn(),this.sendRequest(a,s,c=>{let l=c.d,d=c.s;t.warnOnListenWarnings_(l,r),(this.listens.get(i)&&this.listens.get(i).get(o))===n&&(this.log_("listen response",c),d!=="ok"&&this.removeListen_(i,o),n.onComplete&&n.onComplete(d,l))})}static warnOnListenWarnings_(n,r){if(n&&typeof n=="object"&&zr(n,"w")){let i=Ws(n,"w");if(Array.isArray(i)&&~i.indexOf("no_index")){let o='".indexOn": "'+r._queryParams.getIndex().toString()+'"',s=r._path.toString();Un(`Using an unspecified index. Your data will be downloaded and filtered on the client. Consider adding ${o} at ${s} to your security rules for better performance.`)}}}refreshAuthToken(n){this.authToken_=n,this.log_("Auth token refreshed"),this.authToken_?this.tryAuth():this.connected_&&this.sendRequest("unauth",{},()=>{}),this.reduceReconnectDelayIfAdminCredential_(n)}reduceReconnectDelayIfAdminCredential_(n){(n&&n.length===40||VB(n))&&(this.log_("Admin auth credential detected. Reducing max reconnect time."),this.maxReconnectDelay_=Nj)}refreshAppCheckToken(n){this.appCheckToken_=n,this.log_("App check token refreshed"),this.appCheckToken_?this.tryAppCheck():this.connected_&&this.sendRequest("unappeck",{},()=>{})}tryAuth(){if(this.connected_&&this.authToken_){let n=this.authToken_,r=UB(n)?"auth":"gauth",i={cred:n};this.authOverride_===null?i.noauth=!0:typeof this.authOverride_=="object"&&(i.authvar=this.authOverride_),this.sendRequest(r,i,o=>{let s=o.s,a=o.d||"error";this.authToken_===n&&(s==="ok"?this.invalidAuthTokenCount_=0:this.onAuthRevoked_(s,a))})}}tryAppCheck(){this.connected_&&this.appCheckToken_&&this.sendRequest("appcheck",{token:this.appCheckToken_},n=>{let r=n.s,i=n.d||"error";r==="ok"?this.invalidAppCheckTokenCount_=0:this.onAppCheckRevoked_(r,i)})}unlisten(n,r){let i=n._path.toString(),o=n._queryIdentifier;this.log_("Unlisten called for "+i+" "+o),Y(n._queryParams.isDefault()||!n._queryParams.loadsAllData(),"unlisten() called for non-default but complete query"),this.removeListen_(i,o)&&this.connected_&&this.sendUnlisten_(i,o,n._queryObject,r)}sendUnlisten_(n,r,i,o){this.log_("Unlisten on "+n+" for "+r);let s={p:n},a="n";o&&(s.q=i,s.t=o),this.sendRequest(a,s)}onDisconnectPut(n,r,i){this.initConnection_(),this.connected_?this.sendOnDisconnect_("o",n,r,i):this.onDisconnectRequestQueue_.push({pathString:n,action:"o",data:r,onComplete:i})}onDisconnectMerge(n,r,i){this.initConnection_(),this.connected_?this.sendOnDisconnect_("om",n,r,i):this.onDisconnectRequestQueue_.push({pathString:n,action:"om",data:r,onComplete:i})}onDisconnectCancel(n,r){this.initConnection_(),this.connected_?this.sendOnDisconnect_("oc",n,null,r):this.onDisconnectRequestQueue_.push({pathString:n,action:"oc",data:null,onComplete:r})}sendOnDisconnect_(n,r,i,o){let s={p:r,d:i};this.log_("onDisconnect "+n,s),this.sendRequest(n,s,a=>{o&&setTimeout(()=>{o(a.s,a.d)},Math.floor(0))})}put(n,r,i,o){this.putInternal("p",n,r,i,o)}merge(n,r,i,o){this.putInternal("m",n,r,i,o)}putInternal(n,r,i,o,s){this.initConnection_();let a={p:r,d:i};s!==void 0&&(a.h=s),this.outstandingPuts_.push({action:n,request:a,onComplete:o}),this.outstandingPutCount_++;let c=this.outstandingPuts_.length-1;this.connected_?this.sendPut_(c):this.log_("Buffering put: "+r)}sendPut_(n){let r=this.outstandingPuts_[n].action,i=this.outstandingPuts_[n].request,o=this.outstandingPuts_[n].onComplete;this.outstandingPuts_[n].queued=this.connected_,this.sendRequest(r,i,s=>{this.log_(r+" response",s),delete this.outstandingPuts_[n],this.outstandingPutCount_--,this.outstandingPutCount_===0&&(this.outstandingPuts_=[]),o&&o(s.s,s.d)})}reportStats(n){if(this.connected_){let r={c:n};this.log_("reportStats",r),this.sendRequest("s",r,i=>{if(i.s!=="ok"){let s=i.d;this.log_("reportStats","Error sending stats: "+s)}})}}onDataMessage_(n){if("r"in n){this.log_("from server: "+xt(n));let r=n.r,i=this.requestCBHash_[r];i&&(delete this.requestCBHash_[r],i(n.b))}else{if("error"in n)throw"A server-side error has occurred: "+n.error;"a"in n&&this.onDataPush_(n.a,n.b)}}onDataPush_(n,r){this.log_("handleServerMessage",n,r),n==="d"?this.onDataUpdate_(r.p,r.d,!1,r.t):n==="m"?this.onDataUpdate_(r.p,r.d,!0,r.t):n==="c"?this.onListenRevoked_(r.p,r.q):n==="ac"?this.onAuthRevoked_(r.s,r.d):n==="apc"?this.onAppCheckRevoked_(r.s,r.d):n==="sd"?this.onSecurityDebugPacket_(r):Db("Unrecognized action received from server: "+xt(n)+`
|
|
151
151
|
Are you using the latest client?`)}onReady_(n,r){this.log_("connection ready"),this.connected_=!0,this.lastConnectionEstablishedTime_=new Date().getTime(),this.handleTimestamp_(n),this.lastSessionId=r,this.firstConnection_&&this.sendConnectStats_(),this.restoreState_(),this.firstConnection_=!1,this.onConnectStatus_(!0)}scheduleConnect_(n){Y(!this.realtime_,"Scheduling a connect when we're already connected/ing?"),this.establishConnectionTimer_&&clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=setTimeout(()=>{this.establishConnectionTimer_=null,this.establishConnection_()},Math.floor(n))}initConnection_(){!this.realtime_&&this.firstConnection_&&this.scheduleConnect_(0)}onVisible_(n){n&&!this.visible_&&this.reconnectDelay_===this.maxReconnectDelay_&&(this.log_("Window became visible. Reducing delay."),this.reconnectDelay_=qp,this.realtime_||this.scheduleConnect_(0)),this.visible_=n}onOnline_(n){n?(this.log_("Browser went online."),this.reconnectDelay_=qp,this.realtime_||this.scheduleConnect_(0)):(this.log_("Browser went offline. Killing connection."),this.realtime_&&this.realtime_.close())}onRealtimeDisconnect_(){if(this.log_("data client disconnected"),this.connected_=!1,this.realtime_=null,this.cancelSentTransactions_(),this.requestCBHash_={},this.shouldReconnect_()){this.visible_?this.lastConnectionEstablishedTime_&&(new Date().getTime()-this.lastConnectionEstablishedTime_>Pie&&(this.reconnectDelay_=qp),this.lastConnectionEstablishedTime_=null):(this.log_("Window isn't visible. Delaying reconnect."),this.reconnectDelay_=this.maxReconnectDelay_,this.lastConnectionAttemptTime_=new Date().getTime());let n=Math.max(0,new Date().getTime()-this.lastConnectionAttemptTime_),r=Math.max(0,this.reconnectDelay_-n);r=Math.random()*r,this.log_("Trying to reconnect in "+r+"ms"),this.scheduleConnect_(r),this.reconnectDelay_=Math.min(this.maxReconnectDelay_,this.reconnectDelay_*Mie)}this.onConnectStatus_(!1)}establishConnection_(){return y(this,null,function*(){if(this.shouldReconnect_()){this.log_("Making a connection attempt"),this.lastConnectionAttemptTime_=new Date().getTime(),this.lastConnectionEstablishedTime_=null;let n=this.onDataMessage_.bind(this),r=this.onReady_.bind(this),i=this.onRealtimeDisconnect_.bind(this),o=this.id+":"+t.nextConnectionId_++,s=this.lastSessionId,a=!1,c=null,l=function(){c?c.close():(a=!0,i())},d=function(f){Y(c,"sendRequest call when we're not connected not allowed."),c.sendRequest(f)};this.realtime_={close:l,sendRequest:d};let h=this.forceTokenRefresh_;this.forceTokenRefresh_=!1;try{let[f,g]=yield Promise.all([this.authTokenProvider_.getToken(h),this.appCheckTokenProvider_.getToken(h)]);a?un("getToken() completed but was canceled"):(un("getToken() completed. Creating connection."),this.authToken_=f&&f.accessToken,this.appCheckToken_=g&&g.token,c=new Mb(o,this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,n,r,i,E=>{Un(E+" ("+this.repoInfo_.toString()+")"),this.interrupt(xie)},s))}catch(f){this.log_("Failed to get token: "+f),a||(this.repoInfo_.nodeAdmin&&Un(f),l())}}})}interrupt(n){un("Interrupting connection for reason: "+n),this.interruptReasons_[n]=!0,this.realtime_?this.realtime_.close():(this.establishConnectionTimer_&&(clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=null),this.connected_&&this.onRealtimeDisconnect_())}resume(n){un("Resuming connection for reason: "+n),delete this.interruptReasons_[n],yp(this.interruptReasons_)&&(this.reconnectDelay_=qp,this.realtime_||this.scheduleConnect_(0))}handleTimestamp_(n){let r=n-new Date().getTime();this.onServerInfoUpdate_({serverTimeOffset:r})}cancelSentTransactions_(){for(let n=0;n<this.outstandingPuts_.length;n++){let r=this.outstandingPuts_[n];r&&"h"in r.request&&r.queued&&(r.onComplete&&r.onComplete("disconnect"),delete this.outstandingPuts_[n],this.outstandingPutCount_--)}this.outstandingPutCount_===0&&(this.outstandingPuts_=[])}onListenRevoked_(n,r){let i;r?i=r.map(s=>vw(s)).join("$"):i="default";let o=this.removeListen_(n,i);o&&o.onComplete&&o.onComplete("permission_denied")}removeListen_(n,r){let i=new He(n).toString(),o;if(this.listens.has(i)){let s=this.listens.get(i);o=s.get(r),s.delete(r),s.size===0&&this.listens.delete(i)}else o=void 0;return o}onAuthRevoked_(n,r){un("Auth token revoked: "+n+"/"+r),this.authToken_=null,this.forceTokenRefresh_=!0,this.realtime_.close(),(n==="invalid_token"||n==="permission_denied")&&(this.invalidAuthTokenCount_++,this.invalidAuthTokenCount_>=bj&&(this.reconnectDelay_=Nj,this.authTokenProvider_.notifyForInvalidToken()))}onAppCheckRevoked_(n,r){un("App check token revoked: "+n+"/"+r),this.appCheckToken_=null,this.forceTokenRefresh_=!0,(n==="invalid_token"||n==="permission_denied")&&(this.invalidAppCheckTokenCount_++,this.invalidAppCheckTokenCount_>=bj&&this.appCheckTokenProvider_.notifyForInvalidToken())}onSecurityDebugPacket_(n){this.securityDebugCallback_?this.securityDebugCallback_(n):"msg"in n&&console.log("FIREBASE: "+n.msg.replace(`
|
|
152
152
|
`,`
|
|
153
153
|
FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(let n of this.listens.values())for(let r of n.values())this.sendListen_(r);for(let n=0;n<this.outstandingPuts_.length;n++)this.outstandingPuts_[n]&&this.sendPut_(n);for(;this.onDisconnectRequestQueue_.length;){let n=this.onDisconnectRequestQueue_.shift();this.sendOnDisconnect_(n.action,n.pathString,n.data,n.onComplete)}for(let n=0;n<this.outstandingGets_.length;n++)this.outstandingGets_[n]&&this.sendGet_(n)}sendConnectStats_(){let n={},r="js";co()&&(this.repoInfo_.nodeAdmin?r="admin_node":r="node"),n["sdk."+r+"."+Iw.replace(/\./g,"-")]=1,Tp()?n["framework.cordova"]=1:JT()&&(n["framework.reactnative"]=1),this.reportStats(n)}shouldReconnect_(){let n=By.getInstance().currentlyOnline();return yp(this.interruptReasons_)&&n}}t.nextPersistentConnectionId_=0,t.nextConnectionId_=0;return t})(),Me=class t{constructor(e,n){this.name=e,this.node=n}static Wrap(e,n){return new t(e,n)}};var Nd=class{getCompare(){return this.compare.bind(this)}indexedValueChanged(e,n){let r=new Me(dl,e),i=new Me(dl,n);return this.compare(r,i)!==0}minPost(){return Me.MIN}};var My,Gy=class extends Nd{static get __EMPTY_NODE(){return My}static set __EMPTY_NODE(e){My=e}compare(e,n){return El(e.name,n.name)}isDefinedOn(e){throw zc("KeyIndex.isDefinedOn not expected to be called.")}indexedValueChanged(e,n){return!1}minPost(){return Me.MIN}maxPost(){return new Me(aa,My)}makePost(e,n){return Y(typeof e=="string","KeyIndex indexValue must always be a string."),new Me(e,My)}toString(){return".key"}},ul=new Gy;var Dd=class{constructor(e,n,r,i,o=null){this.isReverse_=i,this.resultGenerator_=o,this.nodeStack_=[];let s=1;for(;!e.isEmpty();)if(e=e,s=n?r(e.key,n):1,i&&(s*=-1),s<0)this.isReverse_?e=e.left:e=e.right;else if(s===0){this.nodeStack_.push(e);break}else this.nodeStack_.push(e),this.isReverse_?e=e.right:e=e.left}getNext(){if(this.nodeStack_.length===0)return null;let e=this.nodeStack_.pop(),n;if(this.resultGenerator_?n=this.resultGenerator_(e.key,e.value):n={key:e.key,value:e.value},this.isReverse_)for(e=e.left;!e.isEmpty();)this.nodeStack_.push(e),e=e.right;else for(e=e.right;!e.isEmpty();)this.nodeStack_.push(e),e=e.left;return n}hasNext(){return this.nodeStack_.length>0}peek(){if(this.nodeStack_.length===0)return null;let e=this.nodeStack_[this.nodeStack_.length-1];return this.resultGenerator_?this.resultGenerator_(e.key,e.value):{key:e.key,value:e.value}}},vi=(()=>{class t{constructor(n,r,i,o,s){this.key=n,this.value=r,this.color=i??t.RED,this.left=o??Xr.EMPTY_NODE,this.right=s??Xr.EMPTY_NODE}copy(n,r,i,o,s){return new t(n??this.key,r??this.value,i??this.color,o??this.left,s??this.right)}count(){return this.left.count()+1+this.right.count()}isEmpty(){return!1}inorderTraversal(n){return this.left.inorderTraversal(n)||!!n(this.key,this.value)||this.right.inorderTraversal(n)}reverseTraversal(n){return this.right.reverseTraversal(n)||n(this.key,this.value)||this.left.reverseTraversal(n)}min_(){return this.left.isEmpty()?this:this.left.min_()}minKey(){return this.min_().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(n,r,i){let o=this,s=i(n,o.key);return s<0?o=o.copy(null,null,null,o.left.insert(n,r,i),null):s===0?o=o.copy(null,r,null,null,null):o=o.copy(null,null,null,null,o.right.insert(n,r,i)),o.fixUp_()}removeMin_(){if(this.left.isEmpty())return Xr.EMPTY_NODE;let n=this;return!n.left.isRed_()&&!n.left.left.isRed_()&&(n=n.moveRedLeft_()),n=n.copy(null,null,null,n.left.removeMin_(),null),n.fixUp_()}remove(n,r){let i,o;if(i=this,r(n,i.key)<0)!i.left.isEmpty()&&!i.left.isRed_()&&!i.left.left.isRed_()&&(i=i.moveRedLeft_()),i=i.copy(null,null,null,i.left.remove(n,r),null);else{if(i.left.isRed_()&&(i=i.rotateRight_()),!i.right.isEmpty()&&!i.right.isRed_()&&!i.right.left.isRed_()&&(i=i.moveRedRight_()),r(n,i.key)===0){if(i.right.isEmpty())return Xr.EMPTY_NODE;o=i.right.min_(),i=i.copy(o.key,o.value,null,null,i.right.removeMin_())}i=i.copy(null,null,null,null,i.right.remove(n,r))}return i.fixUp_()}isRed_(){return this.color}fixUp_(){let n=this;return n.right.isRed_()&&!n.left.isRed_()&&(n=n.rotateLeft_()),n.left.isRed_()&&n.left.left.isRed_()&&(n=n.rotateRight_()),n.left.isRed_()&&n.right.isRed_()&&(n=n.colorFlip_()),n}moveRedLeft_(){let n=this.colorFlip_();return n.right.left.isRed_()&&(n=n.copy(null,null,null,null,n.right.rotateRight_()),n=n.rotateLeft_(),n=n.colorFlip_()),n}moveRedRight_(){let n=this.colorFlip_();return n.left.left.isRed_()&&(n=n.rotateRight_(),n=n.colorFlip_()),n}rotateLeft_(){let n=this.copy(null,null,t.RED,null,this.right.left);return this.right.copy(null,null,this.color,n,null)}rotateRight_(){let n=this.copy(null,null,t.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,n)}colorFlip_(){let n=this.left.copy(null,null,!this.left.color,null,null),r=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,n,r)}checkMaxDepth_(){let n=this.check_();return Math.pow(2,n)<=this.count()+1}check_(){if(this.isRed_()&&this.left.isRed_())throw new Error("Red node has red child("+this.key+","+this.value+")");if(this.right.isRed_())throw new Error("Right child of ("+this.key+","+this.value+") is red");let n=this.left.check_();if(n!==this.right.check_())throw new Error("Black depths differ");return n+(this.isRed_()?0:1)}}return t.RED=!0,t.BLACK=!1,t})(),kb=class{copy(e,n,r,i,o){return this}insert(e,n,r){return new vi(e,n,null)}remove(e,n){return this}count(){return 0}isEmpty(){return!0}inorderTraversal(e){return!1}reverseTraversal(e){return!1}minKey(){return null}maxKey(){return null}check_(){return 0}isRed_(){return!1}},Xr=class t{constructor(e,n=t.EMPTY_NODE){this.comparator_=e,this.root_=n}insert(e,n){return new t(this.comparator_,this.root_.insert(e,n,this.comparator_).copy(null,null,vi.BLACK,null,null))}remove(e){return new t(this.comparator_,this.root_.remove(e,this.comparator_).copy(null,null,vi.BLACK,null,null))}get(e){let n,r=this.root_;for(;!r.isEmpty();){if(n=this.comparator_(e,r.key),n===0)return r.value;n<0?r=r.left:n>0&&(r=r.right)}return null}getPredecessorKey(e){let n,r=this.root_,i=null;for(;!r.isEmpty();)if(n=this.comparator_(e,r.key),n===0){if(r.left.isEmpty())return i?i.key:null;for(r=r.left;!r.right.isEmpty();)r=r.right;return r.key}else n<0?r=r.left:n>0&&(i=r,r=r.right);throw new Error("Attempted to find predecessor key for a nonexistent key. What gives?")}isEmpty(){return this.root_.isEmpty()}count(){return this.root_.count()}minKey(){return this.root_.minKey()}maxKey(){return this.root_.maxKey()}inorderTraversal(e){return this.root_.inorderTraversal(e)}reverseTraversal(e){return this.root_.reverseTraversal(e)}getIterator(e){return new Dd(this.root_,null,this.comparator_,!1,e)}getIteratorFrom(e,n){return new Dd(this.root_,e,this.comparator_,!1,n)}getReverseIteratorFrom(e,n){return new Dd(this.root_,e,this.comparator_,!0,n)}getReverseIterator(e){return new Dd(this.root_,null,this.comparator_,!0,e)}};Xr.EMPTY_NODE=new kb;function kie(t,e){return El(t.name,e.name)}function Rw(t,e){return El(t,e)}var Fb;function Fie(t){Fb=t}var EH=function(t){return typeof t=="number"?"number:"+Jj(t):"string:"+t},_H=function(t){if(t.isLeafNode()){let e=t.val();Y(typeof e=="string"||typeof e=="number"||typeof e=="object"&&zr(e,".sv"),"Priority must be a string or number.")}else Y(t===Fb||t.isEmpty(),"priority of unexpected type.");Y(t===Fb||t.getPriority().isEmpty(),"Priority nodes can't have a priority of their own.")};var wj,bd=(()=>{class t{static set __childrenNodeConstructor(n){wj=n}static get __childrenNodeConstructor(){return wj}constructor(n,r=t.__childrenNodeConstructor.EMPTY_NODE){this.value_=n,this.priorityNode_=r,this.lazyHash_=null,Y(this.value_!==void 0&&this.value_!==null,"LeafNode shouldn't be created with null/undefined value."),_H(this.priorityNode_)}isLeafNode(){return!0}getPriority(){return this.priorityNode_}updatePriority(n){return new t(this.value_,n)}getImmediateChild(n){return n===".priority"?this.priorityNode_:t.__childrenNodeConstructor.EMPTY_NODE}getChild(n){return Oe(n)?this:we(n)===".priority"?this.priorityNode_:t.__childrenNodeConstructor.EMPTY_NODE}hasChild(){return!1}getPredecessorChildName(n,r){return null}updateImmediateChild(n,r){return n===".priority"?this.updatePriority(r):r.isEmpty()&&n!==".priority"?this:t.__childrenNodeConstructor.EMPTY_NODE.updateImmediateChild(n,r).updatePriority(this.priorityNode_)}updateChild(n,r){let i=we(n);return i===null?r:r.isEmpty()&&i!==".priority"?this:(Y(i!==".priority"||ca(n)===1,".priority must be the last token in a path"),this.updateImmediateChild(i,t.__childrenNodeConstructor.EMPTY_NODE.updateChild(lt(n),r)))}isEmpty(){return!1}numChildren(){return 0}forEachChild(n,r){return!1}val(n){return n&&!this.getPriority().isEmpty()?{".value":this.getValue(),".priority":this.getPriority().val()}:this.getValue()}hash(){if(this.lazyHash_===null){let n="";this.priorityNode_.isEmpty()||(n+="priority:"+EH(this.priorityNode_.val())+":");let r=typeof this.value_;n+=r+":",r==="number"?n+=Jj(this.value_):n+=this.value_,this.lazyHash_=Xj(n)}return this.lazyHash_}getValue(){return this.value_}compareTo(n){return n===t.__childrenNodeConstructor.EMPTY_NODE?1:n instanceof t.__childrenNodeConstructor?-1:(Y(n.isLeafNode(),"Unknown node type"),this.compareToLeafNode_(n))}compareToLeafNode_(n){let r=typeof n.value_,i=typeof this.value_,o=t.VALUE_TYPE_ORDER.indexOf(r),s=t.VALUE_TYPE_ORDER.indexOf(i);return Y(o>=0,"Unknown leaf type: "+r),Y(s>=0,"Unknown leaf type: "+i),o===s?i==="object"?0:this.value_<n.value_?-1:this.value_===n.value_?0:1:s-o}withIndex(){return this}isIndexed(){return!0}equals(n){if(n===this)return!0;if(n.isLeafNode()){let r=n;return this.value_===r.value_&&this.priorityNode_.equals(r.priorityNode_)}else return!1}}t.VALUE_TYPE_ORDER=["object","boolean","number","string"];return t})(),TH,yH;function Uie(t){TH=t}function Vie(t){yH=t}var Ub=class extends Nd{compare(e,n){let r=e.node.getPriority(),i=n.node.getPriority(),o=r.compareTo(i);return o===0?El(e.name,n.name):o}isDefinedOn(e){return!e.getPriority().isEmpty()}indexedValueChanged(e,n){return!e.getPriority().equals(n.getPriority())}minPost(){return Me.MIN}maxPost(){return new Me(aa,new bd("[PRIORITY-POST]",yH))}makePost(e,n){let r=TH(e);return new Me(n,new bd("[PRIORITY-POST]",r))}toString(){return".priority"}},ft=new Ub;var Bie=Math.log(2),Vb=class{constructor(e){let n=o=>parseInt(Math.log(o)/Bie,10),r=o=>parseInt(Array(o+1).join("1"),2);this.count=n(e+1),this.current_=this.count-1;let i=r(this.count);this.bits_=e+1&i}nextBitIsOne(){let e=!(this.bits_&1<<this.current_);return this.current_--,e}},jy=function(t,e,n,r){t.sort(e);let i=function(c,l){let d=l-c,h,f;if(d===0)return null;if(d===1)return h=t[c],f=n?n(h):h,new vi(f,h.node,vi.BLACK,null,null);{let g=parseInt(d/2,10)+c,E=i(c,g),I=i(g+1,l);return h=t[g],f=n?n(h):h,new vi(f,h.node,vi.BLACK,E,I)}},o=function(c){let l=null,d=null,h=t.length,f=function(E,I){let S=h-E,R=h;h-=E;let U=i(S+1,R),G=t[S],X=n?n(G):G;g(new vi(X,G.node,I,null,U))},g=function(E){l?(l.left=E,l=E):(d=E,l=E)};for(let E=0;E<c.count;++E){let I=c.nextBitIsOne(),S=Math.pow(2,c.count-(E+1));I?f(S,vi.BLACK):(f(S,vi.BLACK),f(S,vi.RED))}return d},s=new Vb(t.length),a=o(s);return new Xr(r||e,a)};var Tb,Ad={},wd=class t{static get Default(){return Y(Ad&&ft,"ChildrenNode.ts has not been loaded"),Tb=Tb||new t({".priority":Ad},{".priority":ft}),Tb}constructor(e,n){this.indexes_=e,this.indexSet_=n}get(e){let n=Ws(this.indexes_,e);if(!n)throw new Error("No index defined for "+e);return n instanceof Xr?n:null}hasIndex(e){return zr(this.indexSet_,e.toString())}addIndex(e,n){Y(e!==ul,"KeyIndex always exists and isn't meant to be added to the IndexMap.");let r=[],i=!1,o=n.getIterator(Me.Wrap),s=o.getNext();for(;s;)i=i||e.isDefinedOn(s.node),r.push(s),s=o.getNext();let a;i?a=jy(r,e.getCompare()):a=Ad;let c=e.toString(),l=Object.assign({},this.indexSet_);l[c]=e;let d=Object.assign({},this.indexes_);return d[c]=a,new t(d,l)}addToIndexes(e,n){let r=Ip(this.indexes_,(i,o)=>{let s=Ws(this.indexSet_,o);if(Y(s,"Missing index implementation for "+o),i===Ad)if(s.isDefinedOn(e.node)){let a=[],c=n.getIterator(Me.Wrap),l=c.getNext();for(;l;)l.name!==e.name&&a.push(l),l=c.getNext();return a.push(e),jy(a,s.getCompare())}else return Ad;else{let a=n.get(e.name),c=i;return a&&(c=c.remove(new Me(e.name,a))),c.insert(e,e.node)}});return new t(r,this.indexSet_)}removeFromIndexes(e,n){let r=Ip(this.indexes_,i=>{if(i===Ad)return i;{let o=n.get(e.name);return o?i.remove(new Me(e.name,o)):i}});return new t(r,this.indexSet_)}};var Kp,ve=(()=>{class t{static get EMPTY_NODE(){return Kp||(Kp=new t(new Xr(Rw),null,wd.Default))}constructor(n,r,i){this.children_=n,this.priorityNode_=r,this.indexMap_=i,this.lazyHash_=null,this.priorityNode_&&_H(this.priorityNode_),this.children_.isEmpty()&&Y(!this.priorityNode_||this.priorityNode_.isEmpty(),"An empty node cannot have a priority")}isLeafNode(){return!1}getPriority(){return this.priorityNode_||Kp}updatePriority(n){return this.children_.isEmpty()?this:new t(this.children_,n,this.indexMap_)}getImmediateChild(n){if(n===".priority")return this.getPriority();{let r=this.children_.get(n);return r===null?Kp:r}}getChild(n){let r=we(n);return r===null?this:this.getImmediateChild(r).getChild(lt(n))}hasChild(n){return this.children_.get(n)!==null}updateImmediateChild(n,r){if(Y(r,"We should always be passing snapshot nodes"),n===".priority")return this.updatePriority(r);{let i=new Me(n,r),o,s;r.isEmpty()?(o=this.children_.remove(n),s=this.indexMap_.removeFromIndexes(i,this.children_)):(o=this.children_.insert(n,r),s=this.indexMap_.addToIndexes(i,this.children_));let a=o.isEmpty()?Kp:this.priorityNode_;return new t(o,a,s)}}updateChild(n,r){let i=we(n);if(i===null)return r;{Y(we(n)!==".priority"||ca(n)===1,".priority must be the last token in a path");let o=this.getImmediateChild(i).updateChild(lt(n),r);return this.updateImmediateChild(i,o)}}isEmpty(){return this.children_.isEmpty()}numChildren(){return this.children_.count()}val(n){if(this.isEmpty())return null;let r={},i=0,o=0,s=!0;if(this.forEachChild(ft,(a,c)=>{r[a]=c.val(n),i++,s&&t.INTEGER_REGEXP_.test(a)?o=Math.max(o,Number(a)):s=!1}),!n&&s&&o<2*i){let a=[];for(let c in r)a[c]=r[c];return a}else return n&&!this.getPriority().isEmpty()&&(r[".priority"]=this.getPriority().val()),r}hash(){if(this.lazyHash_===null){let n="";this.getPriority().isEmpty()||(n+="priority:"+EH(this.getPriority().val())+":"),this.forEachChild(ft,(r,i)=>{let o=i.hash();o!==""&&(n+=":"+r+":"+o)}),this.lazyHash_=n===""?"":Xj(n)}return this.lazyHash_}getPredecessorChildName(n,r,i){let o=this.resolveIndex_(i);if(o){let s=o.getPredecessorKey(new Me(n,r));return s?s.name:null}else return this.children_.getPredecessorKey(n)}getFirstChildName(n){let r=this.resolveIndex_(n);if(r){let i=r.minKey();return i&&i.name}else return this.children_.minKey()}getFirstChild(n){let r=this.getFirstChildName(n);return r?new Me(r,this.children_.get(r)):null}getLastChildName(n){let r=this.resolveIndex_(n);if(r){let i=r.maxKey();return i&&i.name}else return this.children_.maxKey()}getLastChild(n){let r=this.getLastChildName(n);return r?new Me(r,this.children_.get(r)):null}forEachChild(n,r){let i=this.resolveIndex_(n);return i?i.inorderTraversal(o=>r(o.name,o.node)):this.children_.inorderTraversal(r)}getIterator(n){return this.getIteratorFrom(n.minPost(),n)}getIteratorFrom(n,r){let i=this.resolveIndex_(r);if(i)return i.getIteratorFrom(n,o=>o);{let o=this.children_.getIteratorFrom(n.name,Me.Wrap),s=o.peek();for(;s!=null&&r.compare(s,n)<0;)o.getNext(),s=o.peek();return o}}getReverseIterator(n){return this.getReverseIteratorFrom(n.maxPost(),n)}getReverseIteratorFrom(n,r){let i=this.resolveIndex_(r);if(i)return i.getReverseIteratorFrom(n,o=>o);{let o=this.children_.getReverseIteratorFrom(n.name,Me.Wrap),s=o.peek();for(;s!=null&&r.compare(s,n)>0;)o.getNext(),s=o.peek();return o}}compareTo(n){return this.isEmpty()?n.isEmpty()?0:-1:n.isLeafNode()||n.isEmpty()?1:n===gg?-1:0}withIndex(n){if(n===ul||this.indexMap_.hasIndex(n))return this;{let r=this.indexMap_.addIndex(n,this.children_);return new t(this.children_,this.priorityNode_,r)}}isIndexed(n){return n===ul||this.indexMap_.hasIndex(n)}equals(n){if(n===this)return!0;if(n.isLeafNode())return!1;{let r=n;if(this.getPriority().equals(r.getPriority()))if(this.children_.count()===r.children_.count()){let i=this.getIterator(ft),o=r.getIterator(ft),s=i.getNext(),a=o.getNext();for(;s&&a;){if(s.name!==a.name||!s.node.equals(a.node))return!1;s=i.getNext(),a=o.getNext()}return s===null&&a===null}else return!1;else return!1}}resolveIndex_(n){return n===ul?null:this.indexMap_.get(n.toString())}}return t.INTEGER_REGEXP_=/^(0|[1-9]\d*)$/,t})(),Bb=class extends ve{constructor(){super(new Xr(Rw),ve.EMPTY_NODE,wd.Default)}compareTo(e){return e===this?0:1}equals(e){return e===this}getPriority(){return this}getImmediateChild(e){return ve.EMPTY_NODE}isEmpty(){return!1}},gg=new Bb;Object.defineProperties(Me,{MIN:{value:new Me(dl,ve.EMPTY_NODE)},MAX:{value:new Me(aa,gg)}});Gy.__EMPTY_NODE=ve.EMPTY_NODE;bd.__childrenNodeConstructor=ve;Fie(gg);Vie(gg);var Gie=!0;function At(t,e=null){if(t===null)return ve.EMPTY_NODE;if(typeof t=="object"&&".priority"in t&&(e=t[".priority"]),Y(e===null||typeof e=="string"||typeof e=="number"||typeof e=="object"&&".sv"in e,"Invalid priority type found: "+typeof e),typeof t=="object"&&".value"in t&&t[".value"]!==null&&(t=t[".value"]),typeof t!="object"||".sv"in t){let n=t;return new bd(n,At(e))}if(!(t instanceof Array)&&Gie){let n=[],r=!1;if(dn(t,(s,a)=>{if(s.substring(0,1)!=="."){let c=At(a);c.isEmpty()||(r=r||!c.getPriority().isEmpty(),n.push(new Me(s,c)))}}),n.length===0)return ve.EMPTY_NODE;let o=jy(n,kie,s=>s.name,Rw);if(r){let s=jy(n,ft.getCompare());return new ve(o,At(e),new wd({".priority":s},{".priority":ft}))}else return new ve(o,At(e),wd.Default)}else{let n=ve.EMPTY_NODE;return dn(t,(r,i)=>{if(zr(t,r)&&r.substring(0,1)!=="."){let o=At(i);(o.isLeafNode()||!o.isEmpty())&&(n=n.updateImmediateChild(r,o))}}),n.updatePriority(At(e))}}Uie(At);var ng=class extends Nd{constructor(e){super(),this.indexPath_=e,Y(!Oe(e)&&we(e)!==".priority","Can't create PathIndex with empty path or .priority key")}extractChild(e){return e.getChild(this.indexPath_)}isDefinedOn(e){return!e.getChild(this.indexPath_).isEmpty()}compare(e,n){let r=this.extractChild(e.node),i=this.extractChild(n.node),o=r.compareTo(i);return o===0?El(e.name,n.name):o}makePost(e,n){let r=At(e),i=ve.EMPTY_NODE.updateChild(this.indexPath_,r);return new Me(n,i)}maxPost(){let e=ve.EMPTY_NODE.updateChild(this.indexPath_,gg);return new Me(aa,e)}toString(){return tg(this.indexPath_,0).join("/")}};var Gb=class extends Nd{compare(e,n){let r=e.node.compareTo(n.node);return r===0?El(e.name,n.name):r}isDefinedOn(e){return!0}indexedValueChanged(e,n){return!e.equals(n)}minPost(){return Me.MIN}maxPost(){return Me.MAX}makePost(e,n){let r=At(e);return new Me(n,r)}toString(){return".value"}},IH=new Gb;function vH(t){return{type:"value",snapshotNode:t}}function Od(t,e){return{type:"child_added",snapshotNode:e,childName:t}}function rg(t,e){return{type:"child_removed",snapshotNode:e,childName:t}}function ig(t,e,n){return{type:"child_changed",snapshotNode:e,childName:t,oldSnap:n}}function jie(t,e){return{type:"child_moved",snapshotNode:e,childName:t}}var og=class{constructor(e){this.index_=e}updateChild(e,n,r,i,o,s){Y(e.isIndexed(this.index_),"A node must be indexed if only a child is updated");let a=e.getImmediateChild(n);return a.getChild(i).equals(r.getChild(i))&&a.isEmpty()===r.isEmpty()||(s!=null&&(r.isEmpty()?e.hasChild(n)?s.trackChildChange(rg(n,a)):Y(e.isLeafNode(),"A child remove without an old child only makes sense on a leaf node"):a.isEmpty()?s.trackChildChange(Od(n,r)):s.trackChildChange(ig(n,r,a))),e.isLeafNode()&&r.isEmpty())?e:e.updateImmediateChild(n,r).withIndex(this.index_)}updateFullNode(e,n,r){return r!=null&&(e.isLeafNode()||e.forEachChild(ft,(i,o)=>{n.hasChild(i)||r.trackChildChange(rg(i,o))}),n.isLeafNode()||n.forEachChild(ft,(i,o)=>{if(e.hasChild(i)){let s=e.getImmediateChild(i);s.equals(o)||r.trackChildChange(ig(i,o,s))}else r.trackChildChange(Od(i,o))})),n.withIndex(this.index_)}updatePriority(e,n){return e.isEmpty()?ve.EMPTY_NODE:e.updatePriority(n)}filtersNodes(){return!1}getIndexedFilter(){return this}getIndex(){return this.index_}};var Hy=class t{constructor(e){this.indexedFilter_=new og(e.getIndex()),this.index_=e.getIndex(),this.startPost_=t.getStartPost_(e),this.endPost_=t.getEndPost_(e),this.startIsInclusive_=!e.startAfterSet_,this.endIsInclusive_=!e.endBeforeSet_}getStartPost(){return this.startPost_}getEndPost(){return this.endPost_}matches(e){let n=this.startIsInclusive_?this.index_.compare(this.getStartPost(),e)<=0:this.index_.compare(this.getStartPost(),e)<0,r=this.endIsInclusive_?this.index_.compare(e,this.getEndPost())<=0:this.index_.compare(e,this.getEndPost())<0;return n&&r}updateChild(e,n,r,i,o,s){return this.matches(new Me(n,r))||(r=ve.EMPTY_NODE),this.indexedFilter_.updateChild(e,n,r,i,o,s)}updateFullNode(e,n,r){n.isLeafNode()&&(n=ve.EMPTY_NODE);let i=n.withIndex(this.index_);i=i.updatePriority(ve.EMPTY_NODE);let o=this;return n.forEachChild(ft,(s,a)=>{o.matches(new Me(s,a))||(i=i.updateImmediateChild(s,ve.EMPTY_NODE))}),this.indexedFilter_.updateFullNode(e,i,r)}updatePriority(e,n){return e}filtersNodes(){return!0}getIndexedFilter(){return this.indexedFilter_}getIndex(){return this.index_}static getStartPost_(e){if(e.hasStart()){let n=e.getIndexStartName();return e.getIndex().makePost(e.getIndexStartValue(),n)}else return e.getIndex().minPost()}static getEndPost_(e){if(e.hasEnd()){let n=e.getIndexEndName();return e.getIndex().makePost(e.getIndexEndValue(),n)}else return e.getIndex().maxPost()}};var jb=class{constructor(e){this.withinDirectionalStart=n=>this.reverse_?this.withinEndPost(n):this.withinStartPost(n),this.withinDirectionalEnd=n=>this.reverse_?this.withinStartPost(n):this.withinEndPost(n),this.withinStartPost=n=>{let r=this.index_.compare(this.rangedFilter_.getStartPost(),n);return this.startIsInclusive_?r<=0:r<0},this.withinEndPost=n=>{let r=this.index_.compare(n,this.rangedFilter_.getEndPost());return this.endIsInclusive_?r<=0:r<0},this.rangedFilter_=new Hy(e),this.index_=e.getIndex(),this.limit_=e.getLimit(),this.reverse_=!e.isViewFromLeft(),this.startIsInclusive_=!e.startAfterSet_,this.endIsInclusive_=!e.endBeforeSet_}updateChild(e,n,r,i,o,s){return this.rangedFilter_.matches(new Me(n,r))||(r=ve.EMPTY_NODE),e.getImmediateChild(n).equals(r)?e:e.numChildren()<this.limit_?this.rangedFilter_.getIndexedFilter().updateChild(e,n,r,i,o,s):this.fullLimitUpdateChild_(e,n,r,o,s)}updateFullNode(e,n,r){let i;if(n.isLeafNode()||n.isEmpty())i=ve.EMPTY_NODE.withIndex(this.index_);else if(this.limit_*2<n.numChildren()&&n.isIndexed(this.index_)){i=ve.EMPTY_NODE.withIndex(this.index_);let o;this.reverse_?o=n.getReverseIteratorFrom(this.rangedFilter_.getEndPost(),this.index_):o=n.getIteratorFrom(this.rangedFilter_.getStartPost(),this.index_);let s=0;for(;o.hasNext()&&s<this.limit_;){let a=o.getNext();if(this.withinDirectionalStart(a))if(this.withinDirectionalEnd(a))i=i.updateImmediateChild(a.name,a.node),s++;else break;else continue}}else{i=n.withIndex(this.index_),i=i.updatePriority(ve.EMPTY_NODE);let o;this.reverse_?o=i.getReverseIterator(this.index_):o=i.getIterator(this.index_);let s=0;for(;o.hasNext();){let a=o.getNext();s<this.limit_&&this.withinDirectionalStart(a)&&this.withinDirectionalEnd(a)?s++:i=i.updateImmediateChild(a.name,ve.EMPTY_NODE)}}return this.rangedFilter_.getIndexedFilter().updateFullNode(e,i,r)}updatePriority(e,n){return e}filtersNodes(){return!0}getIndexedFilter(){return this.rangedFilter_.getIndexedFilter()}getIndex(){return this.index_}fullLimitUpdateChild_(e,n,r,i,o){let s;if(this.reverse_){let h=this.index_.getCompare();s=(f,g)=>h(g,f)}else s=this.index_.getCompare();let a=e;Y(a.numChildren()===this.limit_,"");let c=new Me(n,r),l=this.reverse_?a.getFirstChild(this.index_):a.getLastChild(this.index_),d=this.rangedFilter_.matches(c);if(a.hasChild(n)){let h=a.getImmediateChild(n),f=i.getChildAfterChild(this.index_,l,this.reverse_);for(;f!=null&&(f.name===n||a.hasChild(f.name));)f=i.getChildAfterChild(this.index_,f,this.reverse_);let g=f==null?1:s(f,c);if(d&&!r.isEmpty()&&g>=0)return o?.trackChildChange(ig(n,r,h)),a.updateImmediateChild(n,r);{o?.trackChildChange(rg(n,h));let I=a.updateImmediateChild(n,ve.EMPTY_NODE);return f!=null&&this.rangedFilter_.matches(f)?(o?.trackChildChange(Od(f.name,f.node)),I.updateImmediateChild(f.name,f.node)):I}}else return r.isEmpty()?e:d&&s(l,c)>=0?(o!=null&&(o.trackChildChange(rg(l.name,l.node)),o.trackChildChange(Od(n,r))),a.updateImmediateChild(n,r).updateImmediateChild(l.name,ve.EMPTY_NODE)):e}};var Hb=class t{constructor(){this.limitSet_=!1,this.startSet_=!1,this.startNameSet_=!1,this.startAfterSet_=!1,this.endSet_=!1,this.endNameSet_=!1,this.endBeforeSet_=!1,this.limit_=0,this.viewFrom_="",this.indexStartValue_=null,this.indexStartName_="",this.indexEndValue_=null,this.indexEndName_="",this.index_=ft}hasStart(){return this.startSet_}isViewFromLeft(){return this.viewFrom_===""?this.startSet_:this.viewFrom_==="l"}getIndexStartValue(){return Y(this.startSet_,"Only valid if start has been set"),this.indexStartValue_}getIndexStartName(){return Y(this.startSet_,"Only valid if start has been set"),this.startNameSet_?this.indexStartName_:dl}hasEnd(){return this.endSet_}getIndexEndValue(){return Y(this.endSet_,"Only valid if end has been set"),this.indexEndValue_}getIndexEndName(){return Y(this.endSet_,"Only valid if end has been set"),this.endNameSet_?this.indexEndName_:aa}hasLimit(){return this.limitSet_}hasAnchoredLimit(){return this.limitSet_&&this.viewFrom_!==""}getLimit(){return Y(this.limitSet_,"Only valid if limit has been set"),this.limit_}getIndex(){return this.index_}loadsAllData(){return!(this.startSet_||this.endSet_||this.limitSet_)}isDefault(){return this.loadsAllData()&&this.index_===ft}copy(){let e=new t;return e.limitSet_=this.limitSet_,e.limit_=this.limit_,e.startSet_=this.startSet_,e.startAfterSet_=this.startAfterSet_,e.indexStartValue_=this.indexStartValue_,e.startNameSet_=this.startNameSet_,e.indexStartName_=this.indexStartName_,e.endSet_=this.endSet_,e.endBeforeSet_=this.endBeforeSet_,e.indexEndValue_=this.indexEndValue_,e.endNameSet_=this.endNameSet_,e.indexEndName_=this.indexEndName_,e.index_=this.index_,e.viewFrom_=this.viewFrom_,e}};function Hie(t){return t.loadsAllData()?new og(t.getIndex()):t.hasLimit()?new jb(t):new Hy(t)}function $ie(t,e){let n=t.copy();return n.limitSet_=!0,n.limit_=e,n.viewFrom_="r",n}function Wie(t,e,n){let r=t.copy();return r.startSet_=!0,e===void 0&&(e=null),r.indexStartValue_=e,n!=null?(r.startNameSet_=!0,r.indexStartName_=n):(r.startNameSet_=!1,r.indexStartName_=""),r}function zie(t,e,n){let r=t.copy();return r.endSet_=!0,e===void 0&&(e=null),r.indexEndValue_=e,n!==void 0?(r.endNameSet_=!0,r.indexEndName_=n):(r.endNameSet_=!1,r.indexEndName_=""),r}function qie(t,e){let n=t.copy();return n.index_=e,n}function Oj(t){let e={};if(t.isDefault())return e;let n;if(t.index_===ft?n="$priority":t.index_===IH?n="$value":t.index_===ul?n="$key":(Y(t.index_ instanceof ng,"Unrecognized index type!"),n=t.index_.toString()),e.orderBy=xt(n),t.startSet_){let r=t.startAfterSet_?"startAfter":"startAt";e[r]=xt(t.indexStartValue_),t.startNameSet_&&(e[r]+=","+xt(t.indexStartName_))}if(t.endSet_){let r=t.endBeforeSet_?"endBefore":"endAt";e[r]=xt(t.indexEndValue_),t.endNameSet_&&(e[r]+=","+xt(t.indexEndName_))}return t.limitSet_&&(t.isViewFromLeft()?e.limitToFirst=t.limit_:e.limitToLast=t.limit_),e}function Lj(t){let e={};if(t.startSet_&&(e.sp=t.indexStartValue_,t.startNameSet_&&(e.sn=t.indexStartName_),e.sin=!t.startAfterSet_),t.endSet_&&(e.ep=t.indexEndValue_,t.endNameSet_&&(e.en=t.indexEndName_),e.ein=!t.endBeforeSet_),t.limitSet_){e.l=t.limit_;let n=t.viewFrom_;n===""&&(t.isViewFromLeft()?n="l":n="r"),e.vf=n}return t.index_!==ft&&(e.i=t.index_.toString()),e}var $b=class t extends Uy{reportStats(e){throw new Error("Method not implemented.")}static getListenId_(e,n){return n!==void 0?"tag$"+n:(Y(e._queryParams.isDefault(),"should have a tag if it's not a default query."),e._path.toString())}constructor(e,n,r,i){super(),this.repoInfo_=e,this.onDataUpdate_=n,this.authTokenProvider_=r,this.appCheckTokenProvider_=i,this.log_=pg("p:rest:"),this.listens_={}}listen(e,n,r,i){let o=e._path.toString();this.log_("Listen called for "+o+" "+e._queryIdentifier);let s=t.getListenId_(e,r),a={};this.listens_[s]=a;let c=Oj(e._queryParams);this.restRequest_(o+".json",c,(l,d)=>{let h=d;if(l===404&&(h=null,l=null),l===null&&this.onDataUpdate_(o,h,!1,r),Ws(this.listens_,s)===a){let f;l?l===401?f="permission_denied":f="rest_error:"+l:f="ok",i(f,null)}})}unlisten(e,n){let r=t.getListenId_(e,n);delete this.listens_[r]}get(e){let n=Oj(e._queryParams),r=e._path.toString(),i=new cn;return this.restRequest_(r+".json",n,(o,s)=>{let a=s;o===404&&(a=null,o=null),o===null?(this.onDataUpdate_(r,a,!1,null),i.resolve(a)):i.reject(new Error(a))}),i.promise}refreshAuthToken(e){}restRequest_(e,n={},r){return n.format="export",Promise.all([this.authTokenProvider_.getToken(!1),this.appCheckTokenProvider_.getToken(!1)]).then(([i,o])=>{i&&i.accessToken&&(n.auth=i.accessToken),o&&o.token&&(n.ac=o.token);let s=(this.repoInfo_.secure?"https://":"http://")+this.repoInfo_.host+e+"?ns="+this.repoInfo_.namespace+vp(n);this.log_("Sending REST request for "+s);let a=new XMLHttpRequest;a.onreadystatechange=()=>{if(r&&a.readyState===4){this.log_("REST Response for "+s+" received. status:",a.status,"response:",a.responseText);let c=null;if(a.status>=200&&a.status<300){try{c=fd(a.responseText)}catch{Un("Failed to parse JSON response for "+s+": "+a.responseText)}r(null,c)}else a.status!==401&&a.status!==404&&Un("Got unsuccessful REST response for "+s+" Status: "+a.status),r(a.status);r=null}},a.open("GET",s,!0),a.send()})}};var Wb=class{constructor(){this.rootNode_=ve.EMPTY_NODE}getNode(e){return this.rootNode_.getChild(e)}updateSnapshot(e,n){this.rootNode_=this.rootNode_.updateChild(e,n)}};function $y(){return{value:null,children:new Map}}function Fd(t,e,n){if(Oe(e))t.value=n,t.children.clear();else if(t.value!==null)t.value=t.value.updateChild(e,n);else{let r=we(e);t.children.has(r)||t.children.set(r,$y());let i=t.children.get(r);e=lt(e),Fd(i,e,n)}}function zb(t,e){if(Oe(e))return t.value=null,t.children.clear(),!0;if(t.value!==null){if(t.value.isLeafNode())return!1;{let n=t.value;return t.value=null,n.forEachChild(ft,(r,i)=>{Fd(t,new He(r),i)}),zb(t,e)}}else if(t.children.size>0){let n=we(e);return e=lt(e),t.children.has(n)&&zb(t.children.get(n),e)&&t.children.delete(n),t.children.size===0}else return!0}function qb(t,e,n){t.value!==null?n(e,t.value):Kie(t,(r,i)=>{let o=new He(e.toString()+"/"+r);qb(i,o,n)})}function Kie(t,e){t.children.forEach((n,r)=>{e(r,n)})}var Kb=class{constructor(e){this.collection_=e,this.last_=null}get(){let e=this.collection_.get(),n=Object.assign({},e);return this.last_&&dn(this.last_,(r,i)=>{n[r]=n[r]-i}),this.last_=e,n}};var Mj=10*1e3,Yie=30*1e3,Xie=300*1e3,Yb=class{constructor(e,n){this.server_=n,this.statsToReport_={},this.statsListener_=new Kb(e);let r=Mj+(Yie-Mj)*Math.random();Xp(this.reportStats_.bind(this),Math.floor(r))}reportStats_(){let e=this.statsListener_.get(),n={},r=!1;dn(e,(i,o)=>{o>0&&zr(this.statsToReport_,i)&&(n[i]=o,r=!0)}),r&&this.server_.reportStats(n),Xp(this.reportStats_.bind(this),Math.floor(Math.random()*2*Xie))}};var po=(function(t){return t[t.OVERWRITE=0]="OVERWRITE",t[t.MERGE=1]="MERGE",t[t.ACK_USER_WRITE=2]="ACK_USER_WRITE",t[t.LISTEN_COMPLETE=3]="LISTEN_COMPLETE",t})(po||{});function Nw(){return{fromUser:!0,fromServer:!1,queryId:null,tagged:!1}}function bw(){return{fromUser:!1,fromServer:!0,queryId:null,tagged:!1}}function ww(t){return{fromUser:!1,fromServer:!0,queryId:t,tagged:!0}}var Xb=class t{constructor(e,n,r){this.path=e,this.affectedTree=n,this.revert=r,this.type=po.ACK_USER_WRITE,this.source=Nw()}operationForChild(e){if(Oe(this.path)){if(this.affectedTree.value!=null)return Y(this.affectedTree.children.isEmpty(),"affectedTree should not have overlapping affected paths."),this;{let n=this.affectedTree.subtree(new He(e));return new t(je(),n,this.revert)}}else return Y(we(this.path)===e,"operationForChild called for unrelated child."),new t(lt(this.path),this.affectedTree,this.revert)}};var Wy=class t{constructor(e,n){this.source=e,this.path=n,this.type=po.LISTEN_COMPLETE}operationForChild(e){return Oe(this.path)?new t(this.source,je()):new t(this.source,lt(this.path))}};var Ld=class t{constructor(e,n,r){this.source=e,this.path=n,this.snap=r,this.type=po.OVERWRITE}operationForChild(e){return Oe(this.path)?new t(this.source,je(),this.snap.getImmediateChild(e)):new t(this.source,lt(this.path),this.snap)}};var sg=class t{constructor(e,n,r){this.source=e,this.path=n,this.children=r,this.type=po.MERGE}operationForChild(e){if(Oe(this.path)){let n=this.children.subtree(new He(e));return n.isEmpty()?null:n.value?new Ld(this.source,je(),n.value):new t(this.source,je(),n)}else return Y(we(this.path)===e,"Can't get a merge for a child not on the path of the operation"),new t(this.source,lt(this.path),this.children)}toString(){return"Operation("+this.path+": "+this.source.toString()+" merge: "+this.children.toString()+")"}};var go=class{constructor(e,n,r){this.node_=e,this.fullyInitialized_=n,this.filtered_=r}isFullyInitialized(){return this.fullyInitialized_}isFiltered(){return this.filtered_}isCompleteForPath(e){if(Oe(e))return this.isFullyInitialized()&&!this.filtered_;let n=we(e);return this.isCompleteForChild(n)}isCompleteForChild(e){return this.isFullyInitialized()&&!this.filtered_||this.node_.hasChild(e)}getNode(){return this.node_}};var Qb=class{constructor(e){this.query_=e,this.index_=this.query_._queryParams.getIndex()}};function Qie(t,e,n,r){let i=[],o=[];return e.forEach(s=>{s.type==="child_changed"&&t.index_.indexedValueChanged(s.oldSnap,s.snapshotNode)&&o.push(jie(s.childName,s.snapshotNode))}),Yp(t,i,"child_removed",e,r,n),Yp(t,i,"child_added",e,r,n),Yp(t,i,"child_moved",o,r,n),Yp(t,i,"child_changed",e,r,n),Yp(t,i,"value",e,r,n),i}function Yp(t,e,n,r,i,o){let s=r.filter(a=>a.type===n);s.sort((a,c)=>Zie(t,a,c)),s.forEach(a=>{let c=Jie(t,a,o);i.forEach(l=>{l.respondsTo(a.type)&&e.push(l.createEvent(c,t.query_))})})}function Jie(t,e,n){return e.type==="value"||e.type==="child_removed"||(e.prevName=n.getPredecessorChildName(e.childName,e.snapshotNode,t.index_)),e}function Zie(t,e,n){if(e.childName==null||n.childName==null)throw zc("Should only compare child_ events.");let r=new Me(e.childName,e.snapshotNode),i=new Me(n.childName,n.snapshotNode);return t.index_.compare(r,i)}function sI(t,e){return{eventCache:t,serverCache:e}}function Jp(t,e,n,r){return sI(new go(e,n,r),t.serverCache)}function SH(t,e,n,r){return sI(t.eventCache,new go(e,n,r))}function zy(t){return t.eventCache.isFullyInitialized()?t.eventCache.getNode():null}function hl(t){return t.serverCache.isFullyInitialized()?t.serverCache.getNode():null}var yb,eoe=()=>(yb||(yb=new Xr(Jre)),yb),Yn=class t{static fromObject(e){let n=new t(null);return dn(e,(r,i)=>{n=n.set(new He(r),i)}),n}constructor(e,n=eoe()){this.value=e,this.children=n}isEmpty(){return this.value===null&&this.children.isEmpty()}findRootMostMatchingPathAndValue(e,n){if(this.value!=null&&n(this.value))return{path:je(),value:this.value};if(Oe(e))return null;{let r=we(e),i=this.children.get(r);if(i!==null){let o=i.findRootMostMatchingPathAndValue(lt(e),n);return o!=null?{path:Ct(new He(r),o.path),value:o.value}:null}else return null}}findRootMostValueAndPath(e){return this.findRootMostMatchingPathAndValue(e,()=>!0)}subtree(e){if(Oe(e))return this;{let n=we(e),r=this.children.get(n);return r!==null?r.subtree(lt(e)):new t(null)}}set(e,n){if(Oe(e))return new t(n,this.children);{let r=we(e),o=(this.children.get(r)||new t(null)).set(lt(e),n),s=this.children.insert(r,o);return new t(this.value,s)}}remove(e){if(Oe(e))return this.children.isEmpty()?new t(null):new t(null,this.children);{let n=we(e),r=this.children.get(n);if(r){let i=r.remove(lt(e)),o;return i.isEmpty()?o=this.children.remove(n):o=this.children.insert(n,i),this.value===null&&o.isEmpty()?new t(null):new t(this.value,o)}else return this}}get(e){if(Oe(e))return this.value;{let n=we(e),r=this.children.get(n);return r?r.get(lt(e)):null}}setTree(e,n){if(Oe(e))return n;{let r=we(e),o=(this.children.get(r)||new t(null)).setTree(lt(e),n),s;return o.isEmpty()?s=this.children.remove(r):s=this.children.insert(r,o),new t(this.value,s)}}fold(e){return this.fold_(je(),e)}fold_(e,n){let r={};return this.children.inorderTraversal((i,o)=>{r[i]=o.fold_(Ct(e,i),n)}),n(e,this.value,r)}findOnPath(e,n){return this.findOnPath_(e,je(),n)}findOnPath_(e,n,r){let i=this.value?r(n,this.value):!1;if(i)return i;if(Oe(e))return null;{let o=we(e),s=this.children.get(o);return s?s.findOnPath_(lt(e),Ct(n,o),r):null}}foreachOnPath(e,n){return this.foreachOnPath_(e,je(),n)}foreachOnPath_(e,n,r){if(Oe(e))return this;{this.value&&r(n,this.value);let i=we(e),o=this.children.get(i);return o?o.foreachOnPath_(lt(e),Ct(n,i),r):new t(null)}}foreach(e){this.foreach_(je(),e)}foreach_(e,n){this.children.inorderTraversal((r,i)=>{i.foreach_(Ct(e,r),n)}),this.value&&n(e,this.value)}foreachChild(e){this.children.inorderTraversal((n,r)=>{r.value&&e(n,r.value)})}};var Si=class t{constructor(e){this.writeTree_=e}static empty(){return new t(new Yn(null))}};function Zp(t,e,n){if(Oe(e))return new Si(new Yn(n));{let r=t.writeTree_.findRootMostValueAndPath(e);if(r!=null){let i=r.path,o=r.value,s=Kn(i,e);return o=o.updateChild(s,n),new Si(t.writeTree_.set(i,o))}else{let i=new Yn(n),o=t.writeTree_.setTree(e,i);return new Si(o)}}}function Jb(t,e,n){let r=t;return dn(n,(i,o)=>{r=Zp(r,Ct(e,i),o)}),r}function Pj(t,e){if(Oe(e))return Si.empty();{let n=t.writeTree_.setTree(e,new Yn(null));return new Si(n)}}function Zb(t,e){return _l(t,e)!=null}function _l(t,e){let n=t.writeTree_.findRootMostValueAndPath(e);return n!=null?t.writeTree_.get(n.path).getChild(Kn(n.path,e)):null}function xj(t){let e=[],n=t.writeTree_.value;return n!=null?n.isLeafNode()||n.forEachChild(ft,(r,i)=>{e.push(new Me(r,i))}):t.writeTree_.children.inorderTraversal((r,i)=>{i.value!=null&&e.push(new Me(r,i.value))}),e}function oa(t,e){if(Oe(e))return t;{let n=_l(t,e);return n!=null?new Si(new Yn(n)):new Si(t.writeTree_.subtree(e))}}function ew(t){return t.writeTree_.isEmpty()}function Md(t,e){return AH(je(),t.writeTree_,e)}function AH(t,e,n){if(e.value!=null)return n.updateChild(t,e.value);{let r=null;return e.children.inorderTraversal((i,o)=>{i===".priority"?(Y(o.value!==null,"Priority writes must always be leaf nodes"),r=o.value):n=AH(Ct(t,i),o,n)}),!n.getChild(t).isEmpty()&&r!==null&&(n=n.updateChild(Ct(t,".priority"),r)),n}}function aI(t,e){return NH(e,t)}function toe(t,e,n,r,i){Y(r>t.lastWriteId,"Stacking an older write on top of newer ones"),i===void 0&&(i=!0),t.allWrites.push({path:e,snap:n,writeId:r,visible:i}),i&&(t.visibleWrites=Zp(t.visibleWrites,e,n)),t.lastWriteId=r}function noe(t,e,n,r){Y(r>t.lastWriteId,"Stacking an older merge on top of newer ones"),t.allWrites.push({path:e,children:n,writeId:r,visible:!0}),t.visibleWrites=Jb(t.visibleWrites,e,n),t.lastWriteId=r}function roe(t,e){for(let n=0;n<t.allWrites.length;n++){let r=t.allWrites[n];if(r.writeId===e)return r}return null}function ioe(t,e){let n=t.allWrites.findIndex(a=>a.writeId===e);Y(n>=0,"removeWrite called with nonexistent writeId.");let r=t.allWrites[n];t.allWrites.splice(n,1);let i=r.visible,o=!1,s=t.allWrites.length-1;for(;i&&s>=0;){let a=t.allWrites[s];a.visible&&(s>=n&&ooe(a,r.path)?i=!1:Yr(r.path,a.path)&&(o=!0)),s--}if(i){if(o)return soe(t),!0;if(r.snap)t.visibleWrites=Pj(t.visibleWrites,r.path);else{let a=r.children;dn(a,c=>{t.visibleWrites=Pj(t.visibleWrites,Ct(r.path,c))})}return!0}else return!1}function ooe(t,e){if(t.snap)return Yr(t.path,e);for(let n in t.children)if(t.children.hasOwnProperty(n)&&Yr(Ct(t.path,n),e))return!0;return!1}function soe(t){t.visibleWrites=CH(t.allWrites,aoe,je()),t.allWrites.length>0?t.lastWriteId=t.allWrites[t.allWrites.length-1].writeId:t.lastWriteId=-1}function aoe(t){return t.visible}function CH(t,e,n){let r=Si.empty();for(let i=0;i<t.length;++i){let o=t[i];if(e(o)){let s=o.path,a;if(o.snap)Yr(n,s)?(a=Kn(n,s),r=Zp(r,a,o.snap)):Yr(s,n)&&(a=Kn(s,n),r=Zp(r,je(),o.snap.getChild(a)));else if(o.children){if(Yr(n,s))a=Kn(n,s),r=Jb(r,a,o.children);else if(Yr(s,n))if(a=Kn(s,n),Oe(a))r=Jb(r,je(),o.children);else{let c=Ws(o.children,we(a));if(c){let l=c.getChild(lt(a));r=Zp(r,je(),l)}}}else throw zc("WriteRecord should have .snap or .children")}}return r}function DH(t,e,n,r,i){if(!r&&!i){let o=_l(t.visibleWrites,e);if(o!=null)return o;{let s=oa(t.visibleWrites,e);if(ew(s))return n;if(n==null&&!Zb(s,je()))return null;{let a=n||ve.EMPTY_NODE;return Md(s,a)}}}else{let o=oa(t.visibleWrites,e);if(!i&&ew(o))return n;if(!i&&n==null&&!Zb(o,je()))return null;{let s=function(l){return(l.visible||i)&&(!r||!~r.indexOf(l.writeId))&&(Yr(l.path,e)||Yr(e,l.path))},a=CH(t.allWrites,s,e),c=n||ve.EMPTY_NODE;return Md(a,c)}}}function coe(t,e,n){let r=ve.EMPTY_NODE,i=_l(t.visibleWrites,e);if(i)return i.isLeafNode()||i.forEachChild(ft,(o,s)=>{r=r.updateImmediateChild(o,s)}),r;if(n){let o=oa(t.visibleWrites,e);return n.forEachChild(ft,(s,a)=>{let c=Md(oa(o,new He(s)),a);r=r.updateImmediateChild(s,c)}),xj(o).forEach(s=>{r=r.updateImmediateChild(s.name,s.node)}),r}else{let o=oa(t.visibleWrites,e);return xj(o).forEach(s=>{r=r.updateImmediateChild(s.name,s.node)}),r}}function loe(t,e,n,r,i){Y(r||i,"Either existingEventSnap or existingServerSnap must exist");let o=Ct(e,n);if(Zb(t.visibleWrites,o))return null;{let s=oa(t.visibleWrites,o);return ew(s)?i.getChild(n):Md(s,i.getChild(n))}}function uoe(t,e,n,r){let i=Ct(e,n),o=_l(t.visibleWrites,i);if(o!=null)return o;if(r.isCompleteForChild(n)){let s=oa(t.visibleWrites,i);return Md(s,r.getNode().getImmediateChild(n))}else return null}function doe(t,e){return _l(t.visibleWrites,e)}function hoe(t,e,n,r,i,o,s){let a,c=oa(t.visibleWrites,e),l=_l(c,je());if(l!=null)a=l;else if(n!=null)a=Md(c,n);else return[];if(a=a.withIndex(s),!a.isEmpty()&&!a.isLeafNode()){let d=[],h=s.getCompare(),f=o?a.getReverseIteratorFrom(r,s):a.getIteratorFrom(r,s),g=f.getNext();for(;g&&d.length<i;)h(g,r)!==0&&d.push(g),g=f.getNext();return d}else return[]}function foe(){return{visibleWrites:Si.empty(),allWrites:[],lastWriteId:-1}}function qy(t,e,n,r){return DH(t.writeTree,t.treePath,e,n,r)}function Ow(t,e){return coe(t.writeTree,t.treePath,e)}function kj(t,e,n,r){return loe(t.writeTree,t.treePath,e,n,r)}function Ky(t,e){return doe(t.writeTree,Ct(t.treePath,e))}function poe(t,e,n,r,i,o){return hoe(t.writeTree,t.treePath,e,n,r,i,o)}function Lw(t,e,n){return uoe(t.writeTree,t.treePath,e,n)}function RH(t,e){return NH(Ct(t.treePath,e),t.writeTree)}function NH(t,e){return{treePath:t,writeTree:e}}var tw=class{constructor(){this.changeMap=new Map}trackChildChange(e){let n=e.type,r=e.childName;Y(n==="child_added"||n==="child_changed"||n==="child_removed","Only child changes supported for tracking"),Y(r!==".priority","Only non-priority child changes can be tracked.");let i=this.changeMap.get(r);if(i){let o=i.type;if(n==="child_added"&&o==="child_removed")this.changeMap.set(r,ig(r,e.snapshotNode,i.snapshotNode));else if(n==="child_removed"&&o==="child_added")this.changeMap.delete(r);else if(n==="child_removed"&&o==="child_changed")this.changeMap.set(r,rg(r,i.oldSnap));else if(n==="child_changed"&&o==="child_added")this.changeMap.set(r,Od(r,e.snapshotNode));else if(n==="child_changed"&&o==="child_changed")this.changeMap.set(r,ig(r,e.snapshotNode,i.oldSnap));else throw zc("Illegal combination of changes: "+e+" occurred after "+i)}else this.changeMap.set(r,e)}getChanges(){return Array.from(this.changeMap.values())}};var nw=class{getCompleteChild(e){return null}getChildAfterChild(e,n,r){return null}},bH=new nw,ag=class{constructor(e,n,r=null){this.writes_=e,this.viewCache_=n,this.optCompleteServerCache_=r}getCompleteChild(e){let n=this.viewCache_.eventCache;if(n.isCompleteForChild(e))return n.getNode().getImmediateChild(e);{let r=this.optCompleteServerCache_!=null?new go(this.optCompleteServerCache_,!0,!1):this.viewCache_.serverCache;return Lw(this.writes_,e,r)}}getChildAfterChild(e,n,r){let i=this.optCompleteServerCache_!=null?this.optCompleteServerCache_:hl(this.viewCache_),o=poe(this.writes_,i,n,1,r,e);return o.length===0?null:o[0]}};function goe(t){return{filter:t}}function moe(t,e){Y(e.eventCache.getNode().isIndexed(t.filter.getIndex()),"Event snap not indexed"),Y(e.serverCache.getNode().isIndexed(t.filter.getIndex()),"Server snap not indexed")}function Eoe(t,e,n,r,i){let o=new tw,s,a;if(n.type===po.OVERWRITE){let l=n;l.source.fromUser?s=rw(t,e,l.path,l.snap,r,i,o):(Y(l.source.fromServer,"Unknown source."),a=l.source.tagged||e.serverCache.isFiltered()&&!Oe(l.path),s=Yy(t,e,l.path,l.snap,r,i,a,o))}else if(n.type===po.MERGE){let l=n;l.source.fromUser?s=Toe(t,e,l.path,l.children,r,i,o):(Y(l.source.fromServer,"Unknown source."),a=l.source.tagged||e.serverCache.isFiltered(),s=iw(t,e,l.path,l.children,r,i,a,o))}else if(n.type===po.ACK_USER_WRITE){let l=n;l.revert?s=voe(t,e,l.path,r,i,o):s=yoe(t,e,l.path,l.affectedTree,r,i,o)}else if(n.type===po.LISTEN_COMPLETE)s=Ioe(t,e,n.path,r,o);else throw zc("Unknown operation type: "+n.type);let c=o.getChanges();return _oe(e,s,c),{viewCache:s,changes:c}}function _oe(t,e,n){let r=e.eventCache;if(r.isFullyInitialized()){let i=r.getNode().isLeafNode()||r.getNode().isEmpty(),o=zy(t);(n.length>0||!t.eventCache.isFullyInitialized()||i&&!r.getNode().equals(o)||!r.getNode().getPriority().equals(o.getPriority()))&&n.push(vH(zy(e)))}}function wH(t,e,n,r,i,o){let s=e.eventCache;if(Ky(r,n)!=null)return e;{let a,c;if(Oe(n))if(Y(e.serverCache.isFullyInitialized(),"If change path is empty, we must have complete server data"),e.serverCache.isFiltered()){let l=hl(e),d=l instanceof ve?l:ve.EMPTY_NODE,h=Ow(r,d);a=t.filter.updateFullNode(e.eventCache.getNode(),h,o)}else{let l=qy(r,hl(e));a=t.filter.updateFullNode(e.eventCache.getNode(),l,o)}else{let l=we(n);if(l===".priority"){Y(ca(n)===1,"Can't have a priority with additional path components");let d=s.getNode();c=e.serverCache.getNode();let h=kj(r,n,d,c);h!=null?a=t.filter.updatePriority(d,h):a=s.getNode()}else{let d=lt(n),h;if(s.isCompleteForChild(l)){c=e.serverCache.getNode();let f=kj(r,n,s.getNode(),c);f!=null?h=s.getNode().getImmediateChild(l).updateChild(d,f):h=s.getNode().getImmediateChild(l)}else h=Lw(r,l,e.serverCache);h!=null?a=t.filter.updateChild(s.getNode(),l,h,d,i,o):a=s.getNode()}}return Jp(e,a,s.isFullyInitialized()||Oe(n),t.filter.filtersNodes())}}function Yy(t,e,n,r,i,o,s,a){let c=e.serverCache,l,d=s?t.filter:t.filter.getIndexedFilter();if(Oe(n))l=d.updateFullNode(c.getNode(),r,null);else if(d.filtersNodes()&&!c.isFiltered()){let g=c.getNode().updateChild(n,r);l=d.updateFullNode(c.getNode(),g,null)}else{let g=we(n);if(!c.isCompleteForPath(n)&&ca(n)>1)return e;let E=lt(n),S=c.getNode().getImmediateChild(g).updateChild(E,r);g===".priority"?l=d.updatePriority(c.getNode(),S):l=d.updateChild(c.getNode(),g,S,E,bH,null)}let h=SH(e,l,c.isFullyInitialized()||Oe(n),d.filtersNodes()),f=new ag(i,h,o);return wH(t,h,n,i,f,a)}function rw(t,e,n,r,i,o,s){let a=e.eventCache,c,l,d=new ag(i,e,o);if(Oe(n))l=t.filter.updateFullNode(e.eventCache.getNode(),r,s),c=Jp(e,l,!0,t.filter.filtersNodes());else{let h=we(n);if(h===".priority")l=t.filter.updatePriority(e.eventCache.getNode(),r),c=Jp(e,l,a.isFullyInitialized(),a.isFiltered());else{let f=lt(n),g=a.getNode().getImmediateChild(h),E;if(Oe(f))E=r;else{let I=d.getCompleteChild(h);I!=null?Aw(f)===".priority"&&I.getChild(gH(f)).isEmpty()?E=I:E=I.updateChild(f,r):E=ve.EMPTY_NODE}if(g.equals(E))c=e;else{let I=t.filter.updateChild(a.getNode(),h,E,f,d,s);c=Jp(e,I,a.isFullyInitialized(),t.filter.filtersNodes())}}}return c}function Fj(t,e){return t.eventCache.isCompleteForChild(e)}function Toe(t,e,n,r,i,o,s){let a=e;return r.foreach((c,l)=>{let d=Ct(n,c);Fj(e,we(d))&&(a=rw(t,a,d,l,i,o,s))}),r.foreach((c,l)=>{let d=Ct(n,c);Fj(e,we(d))||(a=rw(t,a,d,l,i,o,s))}),a}function Uj(t,e,n){return n.foreach((r,i)=>{e=e.updateChild(r,i)}),e}function iw(t,e,n,r,i,o,s,a){if(e.serverCache.getNode().isEmpty()&&!e.serverCache.isFullyInitialized())return e;let c=e,l;Oe(n)?l=r:l=new Yn(null).setTree(n,r);let d=e.serverCache.getNode();return l.children.inorderTraversal((h,f)=>{if(d.hasChild(h)){let g=e.serverCache.getNode().getImmediateChild(h),E=Uj(t,g,f);c=Yy(t,c,new He(h),E,i,o,s,a)}}),l.children.inorderTraversal((h,f)=>{let g=!e.serverCache.isCompleteForChild(h)&&f.value===null;if(!d.hasChild(h)&&!g){let E=e.serverCache.getNode().getImmediateChild(h),I=Uj(t,E,f);c=Yy(t,c,new He(h),I,i,o,s,a)}}),c}function yoe(t,e,n,r,i,o,s){if(Ky(i,n)!=null)return e;let a=e.serverCache.isFiltered(),c=e.serverCache;if(r.value!=null){if(Oe(n)&&c.isFullyInitialized()||c.isCompleteForPath(n))return Yy(t,e,n,c.getNode().getChild(n),i,o,a,s);if(Oe(n)){let l=new Yn(null);return c.getNode().forEachChild(ul,(d,h)=>{l=l.set(new He(d),h)}),iw(t,e,n,l,i,o,a,s)}else return e}else{let l=new Yn(null);return r.foreach((d,h)=>{let f=Ct(n,d);c.isCompleteForPath(f)&&(l=l.set(d,c.getNode().getChild(f)))}),iw(t,e,n,l,i,o,a,s)}}function Ioe(t,e,n,r,i){let o=e.serverCache,s=SH(e,o.getNode(),o.isFullyInitialized()||Oe(n),o.isFiltered());return wH(t,s,n,r,bH,i)}function voe(t,e,n,r,i,o){let s;if(Ky(r,n)!=null)return e;{let a=new ag(r,e,i),c=e.eventCache.getNode(),l;if(Oe(n)||we(n)===".priority"){let d;if(e.serverCache.isFullyInitialized())d=qy(r,hl(e));else{let h=e.serverCache.getNode();Y(h instanceof ve,"serverChildren would be complete if leaf node"),d=Ow(r,h)}d=d,l=t.filter.updateFullNode(c,d,o)}else{let d=we(n),h=Lw(r,d,e.serverCache);h==null&&e.serverCache.isCompleteForChild(d)&&(h=c.getImmediateChild(d)),h!=null?l=t.filter.updateChild(c,d,h,lt(n),a,o):e.eventCache.getNode().hasChild(d)?l=t.filter.updateChild(c,d,ve.EMPTY_NODE,lt(n),a,o):l=c,l.isEmpty()&&e.serverCache.isFullyInitialized()&&(s=qy(r,hl(e)),s.isLeafNode()&&(l=t.filter.updateFullNode(l,s,o)))}return s=e.serverCache.isFullyInitialized()||Ky(r,je())!=null,Jp(e,l,s,t.filter.filtersNodes())}}var ow=class{constructor(e,n){this.query_=e,this.eventRegistrations_=[];let r=this.query_._queryParams,i=new og(r.getIndex()),o=Hie(r);this.processor_=goe(o);let s=n.serverCache,a=n.eventCache,c=i.updateFullNode(ve.EMPTY_NODE,s.getNode(),null),l=o.updateFullNode(ve.EMPTY_NODE,a.getNode(),null),d=new go(c,s.isFullyInitialized(),i.filtersNodes()),h=new go(l,a.isFullyInitialized(),o.filtersNodes());this.viewCache_=sI(h,d),this.eventGenerator_=new Qb(this.query_)}get query(){return this.query_}};function Soe(t){return t.viewCache_.serverCache.getNode()}function Aoe(t){return zy(t.viewCache_)}function Coe(t,e){let n=hl(t.viewCache_);return n&&(t.query._queryParams.loadsAllData()||!Oe(e)&&!n.getImmediateChild(we(e)).isEmpty())?n.getChild(e):null}function Vj(t){return t.eventRegistrations_.length===0}function Doe(t,e){t.eventRegistrations_.push(e)}function Bj(t,e,n){let r=[];if(n){Y(e==null,"A cancel should cancel all event registrations.");let i=t.query._path;t.eventRegistrations_.forEach(o=>{let s=o.createCancelEvent(n,i);s&&r.push(s)})}if(e){let i=[];for(let o=0;o<t.eventRegistrations_.length;++o){let s=t.eventRegistrations_[o];if(!s.matches(e))i.push(s);else if(e.hasAnyCallback()){i=i.concat(t.eventRegistrations_.slice(o+1));break}}t.eventRegistrations_=i}else t.eventRegistrations_=[];return r}function Gj(t,e,n,r){e.type===po.MERGE&&e.source.queryId!==null&&(Y(hl(t.viewCache_),"We should always have a full cache before handling merges"),Y(zy(t.viewCache_),"Missing event cache, even though we have a server cache"));let i=t.viewCache_,o=Eoe(t.processor_,i,e,n,r);return moe(t.processor_,o.viewCache),Y(o.viewCache.serverCache.isFullyInitialized()||!i.serverCache.isFullyInitialized(),"Once a server snap is complete, it should never go back"),t.viewCache_=o.viewCache,OH(t,o.changes,o.viewCache.eventCache.getNode(),null)}function Roe(t,e){let n=t.viewCache_.eventCache,r=[];return n.getNode().isLeafNode()||n.getNode().forEachChild(ft,(o,s)=>{r.push(Od(o,s))}),n.isFullyInitialized()&&r.push(vH(n.getNode())),OH(t,r,n.getNode(),e)}function OH(t,e,n,r){let i=r?[r]:t.eventRegistrations_;return Qie(t.eventGenerator_,e,n,i)}var Xy,Qy=class{constructor(){this.views=new Map}};function Noe(t){Y(!Xy,"__referenceConstructor has already been defined"),Xy=t}function boe(){return Y(Xy,"Reference.ts has not been loaded"),Xy}function woe(t){return t.views.size===0}function Mw(t,e,n,r){let i=e.source.queryId;if(i!==null){let o=t.views.get(i);return Y(o!=null,"SyncTree gave us an op for an invalid query."),Gj(o,e,n,r)}else{let o=[];for(let s of t.views.values())o=o.concat(Gj(s,e,n,r));return o}}function LH(t,e,n,r,i){let o=e._queryIdentifier,s=t.views.get(o);if(!s){let a=qy(n,i?r:null),c=!1;a?c=!0:r instanceof ve?(a=Ow(n,r),c=!1):(a=ve.EMPTY_NODE,c=!1);let l=sI(new go(a,c,!1),new go(r,i,!1));return new ow(e,l)}return s}function Ooe(t,e,n,r,i,o){let s=LH(t,e,r,i,o);return t.views.has(e._queryIdentifier)||t.views.set(e._queryIdentifier,s),Doe(s,n),Roe(s,n)}function Loe(t,e,n,r){let i=e._queryIdentifier,o=[],s=[],a=la(t);if(i==="default")for(let[c,l]of t.views.entries())s=s.concat(Bj(l,n,r)),Vj(l)&&(t.views.delete(c),l.query._queryParams.loadsAllData()||o.push(l.query));else{let c=t.views.get(i);c&&(s=s.concat(Bj(c,n,r)),Vj(c)&&(t.views.delete(i),c.query._queryParams.loadsAllData()||o.push(c.query)))}return a&&!la(t)&&o.push(new(boe())(e._repo,e._path)),{removed:o,events:s}}function MH(t){let e=[];for(let n of t.views.values())n.query._queryParams.loadsAllData()||e.push(n);return e}function sa(t,e){let n=null;for(let r of t.views.values())n=n||Coe(r,e);return n}function PH(t,e){if(e._queryParams.loadsAllData())return cI(t);{let r=e._queryIdentifier;return t.views.get(r)}}function xH(t,e){return PH(t,e)!=null}function la(t){return cI(t)!=null}function cI(t){for(let e of t.views.values())if(e.query._queryParams.loadsAllData())return e;return null}var Jy;function Moe(t){Y(!Jy,"__referenceConstructor has already been defined"),Jy=t}function Poe(){return Y(Jy,"Reference.ts has not been loaded"),Jy}var xoe=1,Zy=class{constructor(e){this.listenProvider_=e,this.syncPointTree_=new Yn(null),this.pendingWriteTree_=foe(),this.tagToQueryMap=new Map,this.queryToTagMap=new Map}};function Pw(t,e,n,r,i){return toe(t.pendingWriteTree_,e,n,r,i),i?Ud(t,new Ld(Nw(),e,n)):[]}function koe(t,e,n,r){noe(t.pendingWriteTree_,e,n,r);let i=Yn.fromObject(n);return Ud(t,new sg(Nw(),e,i))}function ra(t,e,n=!1){let r=roe(t.pendingWriteTree_,e);if(ioe(t.pendingWriteTree_,e)){let o=new Yn(null);return r.snap!=null?o=o.set(je(),!0):dn(r.children,s=>{o=o.set(new He(s),!0)}),Ud(t,new Xb(r.path,o,n))}else return[]}function mg(t,e,n){return Ud(t,new Ld(bw(),e,n))}function Foe(t,e,n){let r=Yn.fromObject(n);return Ud(t,new sg(bw(),e,r))}function Uoe(t,e){return Ud(t,new Wy(bw(),e))}function Voe(t,e,n){let r=xw(t,n);if(r){let i=kw(r),o=i.path,s=i.queryId,a=Kn(o,e),c=new Wy(ww(s),a);return Fw(t,o,c)}else return[]}function eI(t,e,n,r,i=!1){let o=e._path,s=t.syncPointTree_.get(o),a=[];if(s&&(e._queryIdentifier==="default"||xH(s,e))){let c=Loe(s,e,n,r);woe(s)&&(t.syncPointTree_=t.syncPointTree_.remove(o));let l=c.removed;if(a=c.events,!i){let d=l.findIndex(f=>f._queryParams.loadsAllData())!==-1,h=t.syncPointTree_.findOnPath(o,(f,g)=>la(g));if(d&&!h){let f=t.syncPointTree_.subtree(o);if(!f.isEmpty()){let g=joe(f);for(let E=0;E<g.length;++E){let I=g[E],S=I.query,R=VH(t,I);t.listenProvider_.startListening(eg(S),cg(t,S),R.hashFn,R.onComplete)}}}!h&&l.length>0&&!r&&(d?t.listenProvider_.stopListening(eg(e),null):l.forEach(f=>{let g=t.queryToTagMap.get(uI(f));t.listenProvider_.stopListening(eg(f),g)}))}Hoe(t,l)}return a}function kH(t,e,n,r){let i=xw(t,r);if(i!=null){let o=kw(i),s=o.path,a=o.queryId,c=Kn(s,e),l=new Ld(ww(a),c,n);return Fw(t,s,l)}else return[]}function Boe(t,e,n,r){let i=xw(t,r);if(i){let o=kw(i),s=o.path,a=o.queryId,c=Kn(s,e),l=Yn.fromObject(n),d=new sg(ww(a),c,l);return Fw(t,s,d)}else return[]}function sw(t,e,n,r=!1){let i=e._path,o=null,s=!1;t.syncPointTree_.foreachOnPath(i,(f,g)=>{let E=Kn(f,i);o=o||sa(g,E),s=s||la(g)});let a=t.syncPointTree_.get(i);a?(s=s||la(a),o=o||sa(a,je())):(a=new Qy,t.syncPointTree_=t.syncPointTree_.set(i,a));let c;o!=null?c=!0:(c=!1,o=ve.EMPTY_NODE,t.syncPointTree_.subtree(i).foreachChild((g,E)=>{let I=sa(E,je());I&&(o=o.updateImmediateChild(g,I))}));let l=xH(a,e);if(!l&&!e._queryParams.loadsAllData()){let f=uI(e);Y(!t.queryToTagMap.has(f),"View does not exist, but we have a tag");let g=$oe();t.queryToTagMap.set(f,g),t.tagToQueryMap.set(g,f)}let d=aI(t.pendingWriteTree_,i),h=Ooe(a,e,n,d,o,c);if(!l&&!s&&!r){let f=PH(a,e);h=h.concat(Woe(t,e,f))}return h}function lI(t,e,n){let i=t.pendingWriteTree_,o=t.syncPointTree_.findOnPath(e,(s,a)=>{let c=Kn(s,e),l=sa(a,c);if(l)return l});return DH(i,e,o,n,!0)}function Goe(t,e){let n=e._path,r=null;t.syncPointTree_.foreachOnPath(n,(l,d)=>{let h=Kn(l,n);r=r||sa(d,h)});let i=t.syncPointTree_.get(n);i?r=r||sa(i,je()):(i=new Qy,t.syncPointTree_=t.syncPointTree_.set(n,i));let o=r!=null,s=o?new go(r,!0,!1):null,a=aI(t.pendingWriteTree_,e._path),c=LH(i,e,a,o?s.getNode():ve.EMPTY_NODE,o);return Aoe(c)}function Ud(t,e){return FH(e,t.syncPointTree_,null,aI(t.pendingWriteTree_,je()))}function FH(t,e,n,r){if(Oe(t.path))return UH(t,e,n,r);{let i=e.get(je());n==null&&i!=null&&(n=sa(i,je()));let o=[],s=we(t.path),a=t.operationForChild(s),c=e.children.get(s);if(c&&a){let l=n?n.getImmediateChild(s):null,d=RH(r,s);o=o.concat(FH(a,c,l,d))}return i&&(o=o.concat(Mw(i,t,r,n))),o}}function UH(t,e,n,r){let i=e.get(je());n==null&&i!=null&&(n=sa(i,je()));let o=[];return e.children.inorderTraversal((s,a)=>{let c=n?n.getImmediateChild(s):null,l=RH(r,s),d=t.operationForChild(s);d&&(o=o.concat(UH(d,a,c,l)))}),i&&(o=o.concat(Mw(i,t,r,n))),o}function VH(t,e){let n=e.query,r=cg(t,n);return{hashFn:()=>(Soe(e)||ve.EMPTY_NODE).hash(),onComplete:i=>{if(i==="ok")return r?Voe(t,n._path,r):Uoe(t,n._path);{let o=tie(i,n);return eI(t,n,null,o)}}}}function cg(t,e){let n=uI(e);return t.queryToTagMap.get(n)}function uI(t){return t._path.toString()+"$"+t._queryIdentifier}function xw(t,e){return t.tagToQueryMap.get(e)}function kw(t){let e=t.indexOf("$");return Y(e!==-1&&e<t.length-1,"Bad queryKey."),{queryId:t.substr(e+1),path:new He(t.substr(0,e))}}function Fw(t,e,n){let r=t.syncPointTree_.get(e);Y(r,"Missing sync point for query tag that we're tracking");let i=aI(t.pendingWriteTree_,e);return Mw(r,n,i,null)}function joe(t){return t.fold((e,n,r)=>{if(n&&la(n))return[cI(n)];{let i=[];return n&&(i=MH(n)),dn(r,(o,s)=>{i=i.concat(s)}),i}})}function eg(t){return t._queryParams.loadsAllData()&&!t._queryParams.isDefault()?new(Poe())(t._repo,t._path):t}function Hoe(t,e){for(let n=0;n<e.length;++n){let r=e[n];if(!r._queryParams.loadsAllData()){let i=uI(r),o=t.queryToTagMap.get(i);t.queryToTagMap.delete(i),t.tagToQueryMap.delete(o)}}}function $oe(){return xoe++}function Woe(t,e,n){let r=e._path,i=cg(t,e),o=VH(t,n),s=t.listenProvider_.startListening(eg(e),i,o.hashFn,o.onComplete),a=t.syncPointTree_.subtree(r);if(i)Y(!la(a.value),"If we're adding a query, it shouldn't be shadowed");else{let c=a.fold((l,d,h)=>{if(!Oe(l)&&d&&la(d))return[cI(d).query];{let f=[];return d&&(f=f.concat(MH(d).map(g=>g.query))),dn(h,(g,E)=>{f=f.concat(E)}),f}});for(let l=0;l<c.length;++l){let d=c[l];t.listenProvider_.stopListening(eg(d),cg(t,d))}}return s}var aw=class t{constructor(e){this.node_=e}getImmediateChild(e){let n=this.node_.getImmediateChild(e);return new t(n)}node(){return this.node_}},cw=class t{constructor(e,n){this.syncTree_=e,this.path_=n}getImmediateChild(e){let n=Ct(this.path_,e);return new t(this.syncTree_,n)}node(){return lI(this.syncTree_,this.path_)}},zoe=function(t){return t=t||{},t.timestamp=t.timestamp||new Date().getTime(),t},jj=function(t,e,n){if(!t||typeof t!="object")return t;if(Y(".sv"in t,"Unexpected leaf node or priority contents"),typeof t[".sv"]=="string")return qoe(t[".sv"],e,n);if(typeof t[".sv"]=="object")return Koe(t[".sv"],e);Y(!1,"Unexpected server value: "+JSON.stringify(t,null,2))},qoe=function(t,e,n){if(t==="timestamp")return n.timestamp;Y(!1,"Unexpected server value: "+t)},Koe=function(t,e,n){t.hasOwnProperty("increment")||Y(!1,"Unexpected server value: "+JSON.stringify(t,null,2));let r=t.increment;typeof r!="number"&&Y(!1,"Unexpected increment value: "+r);let i=e.node();if(Y(i!==null&&typeof i<"u","Expected ChildrenNode.EMPTY_NODE for nulls"),!i.isLeafNode())return r;let s=i.getValue();return typeof s!="number"?r:s+r},BH=function(t,e,n,r){return Vw(e,new cw(n,t),r)},Uw=function(t,e,n){return Vw(t,new aw(e),n)};function Vw(t,e,n){let r=t.getPriority().val(),i=jj(r,e.getImmediateChild(".priority"),n),o;if(t.isLeafNode()){let s=t,a=jj(s.getValue(),e,n);return a!==s.getValue()||i!==s.getPriority().val()?new bd(a,At(i)):t}else{let s=t;return o=s,i!==s.getPriority().val()&&(o=o.updatePriority(new bd(i))),s.forEachChild(ft,(a,c)=>{let l=Vw(c,e.getImmediateChild(a),n);l!==c&&(o=o.updateImmediateChild(a,l))}),o}}var lg=class{constructor(e="",n=null,r={children:{},childCount:0}){this.name=e,this.parent=n,this.node=r}};function dI(t,e){let n=e instanceof He?e:new He(e),r=t,i=we(n);for(;i!==null;){let o=Ws(r.node.children,i)||{children:{},childCount:0};r=new lg(i,r,o),n=lt(n),i=we(n)}return r}function Tl(t){return t.node.value}function Bw(t,e){t.node.value=e,lw(t)}function GH(t){return t.node.childCount>0}function Yoe(t){return Tl(t)===void 0&&!GH(t)}function hI(t,e){dn(t.node.children,(n,r)=>{e(new lg(n,t,r))})}function jH(t,e,n,r){n&&!r&&e(t),hI(t,i=>{jH(i,e,!0,r)}),n&&r&&e(t)}function Xoe(t,e,n){let r=n?t:t.parent;for(;r!==null;){if(e(r))return!0;r=r.parent}return!1}function Eg(t){return new He(t.parent===null?t.name:Eg(t.parent)+"/"+t.name)}function lw(t){t.parent!==null&&Qoe(t.parent,t.name,t)}function Qoe(t,e,n){let r=Yoe(n),i=zr(t.node.children,e);r&&i?(delete t.node.children[e],t.node.childCount--,lw(t)):!r&&!i&&(t.node.children[e]=n.node,t.node.childCount++,lw(t))}var Joe=/[\[\].#$\/\u0000-\u001F\u007F]/,Zoe=/[\[\].#$\u0000-\u001F\u007F]/,Ib=10*1024*1024,fI=function(t){return typeof t=="string"&&t.length!==0&&!Joe.test(t)},HH=function(t){return typeof t=="string"&&t.length!==0&&!Zoe.test(t)},ese=function(t){return t&&(t=t.replace(/^\/*\.info(\/|$)/,"/")),HH(t)},ug=function(t){return t===null||typeof t=="string"||typeof t=="number"&&!oI(t)||t&&typeof t=="object"&&zr(t,".sv")},fl=function(t,e,n,r){r&&e===void 0||_g(zs(t,"value"),e,n)},_g=function(t,e,n){let r=n instanceof He?new Pb(n,t):n;if(e===void 0)throw new Error(t+"contains undefined "+al(r));if(typeof e=="function")throw new Error(t+"contains a function "+al(r)+" with contents = "+e.toString());if(oI(e))throw new Error(t+"contains "+e.toString()+" "+al(r));if(typeof e=="string"&&e.length>Ib/3&&Sp(e)>Ib)throw new Error(t+"contains a string greater than "+Ib+" utf8 bytes "+al(r)+" ('"+e.substring(0,50)+"...')");if(e&&typeof e=="object"){let i=!1,o=!1;if(dn(e,(s,a)=>{if(s===".value")i=!0;else if(s!==".priority"&&s!==".sv"&&(o=!0,!fI(s)))throw new Error(t+" contains an invalid key ("+s+") "+al(r)+`. Keys must be non-empty strings and can't contain ".", "#", "$", "/", "[", or "]"`);wie(r,s),_g(t,a,r),Oie(r)}),i&&o)throw new Error(t+' contains ".value" child '+al(r)+" in addition to actual children.")}},tse=function(t,e){let n,r;for(n=0;n<e.length;n++){r=e[n];let o=tg(r);for(let s=0;s<o.length;s++)if(!(o[s]===".priority"&&s===o.length-1)){if(!fI(o[s]))throw new Error(t+"contains an invalid key ("+o[s]+") in path "+r.toString()+`. Keys must be non-empty strings and can't contain ".", "#", "$", "/", "[", or "]"`)}}e.sort(bie);let i=null;for(n=0;n<e.length;n++){if(r=e[n],i!==null&&Yr(i,r))throw new Error(t+"contains a path "+i.toString()+" that is ancestor of another path "+r.toString());i=r}},$H=function(t,e,n,r){if(r&&e===void 0)return;let i=zs(t,"values");if(!(e&&typeof e=="object")||Array.isArray(e))throw new Error(i+" must be an object containing the children to replace.");let o=[];dn(e,(s,a)=>{let c=new He(s);if(_g(i,a,Ct(n,c)),Aw(c)===".priority"&&!ug(a))throw new Error(i+"contains an invalid value for '"+c.toString()+"', which must be a valid Firebase priority (a string, finite number, server value, or null).");o.push(c)}),tse(i,o)},nse=function(t,e,n){if(!(n&&e===void 0)){if(oI(e))throw new Error(zs(t,"priority")+"is "+e.toString()+", but must be a valid Firebase priority (a string, finite number, server value, or null).");if(!ug(e))throw new Error(zs(t,"priority")+"must be a valid Firebase priority (a string, finite number, server value, or null).")}},WH=function(t,e,n,r){if(!(r&&n===void 0)&&!fI(n))throw new Error(zs(t,e)+'was an invalid key = "'+n+`". Firebase keys must be non-empty strings and can't contain ".", "#", "$", "/", "[", or "]").`)},Gw=function(t,e,n,r){if(!(r&&n===void 0)&&!HH(n))throw new Error(zs(t,e)+'was an invalid path = "'+n+`". Paths must be non-empty strings and can't contain ".", "#", "$", "[", or "]"`)},rse=function(t,e,n,r){n&&(n=n.replace(/^\/*\.info(\/|$)/,"/")),Gw(t,e,n,r)},ia=function(t,e){if(we(e)===".info")throw new Error(t+" failed = Can't modify data under /.info/")},ise=function(t,e){let n=e.path.toString();if(typeof e.repoInfo.host!="string"||e.repoInfo.host.length===0||!fI(e.repoInfo.namespace)&&e.repoInfo.host.split(":")[0]!=="localhost"||n.length!==0&&!ese(n))throw new Error(zs(t,"url")+`must be a valid firebase URL and the path can't contain ".", "#", "$", "[", or "]".`)};var uw=class{constructor(){this.eventLists_=[],this.recursionDepth_=0}};function pI(t,e){let n=null;for(let r=0;r<e.length;r++){let i=e[r],o=i.getPath();n!==null&&!Cw(o,n.path)&&(t.eventLists_.push(n),n=null),n===null&&(n={events:[],path:o}),n.events.push(i)}n&&t.eventLists_.push(n)}function zH(t,e,n){pI(t,n),qH(t,r=>Cw(r,e))}function Cr(t,e,n){pI(t,n),qH(t,r=>Yr(r,e)||Yr(e,r))}function qH(t,e){t.recursionDepth_++;let n=!0;for(let r=0;r<t.eventLists_.length;r++){let i=t.eventLists_[r];if(i){let o=i.path;e(o)?(ose(t.eventLists_[r]),t.eventLists_[r]=null):n=!1}}n&&(t.eventLists_=[]),t.recursionDepth_--}function ose(t){for(let e=0;e<t.events.length;e++){let n=t.events[e];if(n!==null){t.events[e]=null;let r=n.getEventRunner();ll&&un("event: "+n.toString()),kd(r)}}}var sse="repo_interrupt",ase=25,dw=class{constructor(e,n,r,i){this.repoInfo_=e,this.forceRestClient_=n,this.authTokenProvider_=r,this.appCheckProvider_=i,this.dataUpdateCount=0,this.statsListener_=null,this.eventQueue_=new uw,this.nextWriteId_=1,this.interceptServerDataCallback_=null,this.onDisconnect_=$y(),this.transactionQueueTree_=new lg,this.persistentConnection_=null,this.key=this.repoInfo_.toURLString()}toString(){return(this.repoInfo_.secure?"https://":"http://")+this.repoInfo_.host}};function cse(t,e,n){if(t.stats_=Sw(t.repoInfo_),t.forceRestClient_||oie())t.server_=new $b(t.repoInfo_,(r,i,o,s)=>{Hj(t,r,i,o,s)},t.authTokenProvider_,t.appCheckProvider_),setTimeout(()=>$j(t,!0),0);else{if(typeof n<"u"&&n!==null){if(typeof n!="object")throw new Error("Only objects are supported for option databaseAuthVariableOverride");try{xt(n)}catch(r){throw new Error("Invalid authOverride provided: "+r)}}t.persistentConnection_=new Dw(t.repoInfo_,e,(r,i,o,s)=>{Hj(t,r,i,o,s)},r=>{$j(t,r)},r=>{lse(t,r)},t.authTokenProvider_,t.appCheckProvider_,n),t.server_=t.persistentConnection_}t.authTokenProvider_.addTokenChangeListener(r=>{t.server_.refreshAuthToken(r)}),t.appCheckProvider_.addTokenChangeListener(r=>{t.server_.refreshAppCheckToken(r.token)}),t.statsReporter_=aie(t.repoInfo_,()=>new Yb(t.stats_,t.server_)),t.infoData_=new Wb,t.infoSyncTree_=new Zy({startListening:(r,i,o,s)=>{let a=[],c=t.infoData_.getNode(r._path);return c.isEmpty()||(a=mg(t.infoSyncTree_,r._path,c),setTimeout(()=>{s("ok")},0)),a},stopListening:()=>{}}),jw(t,"connected",!1),t.serverSyncTree_=new Zy({startListening:(r,i,o,s)=>(t.server_.listen(r,o,i,(a,c)=>{let l=s(a,c);Cr(t.eventQueue_,r._path,l)}),[]),stopListening:(r,i)=>{t.server_.unlisten(r,i)}})}function KH(t){let n=t.infoData_.getNode(new He(".info/serverTimeOffset")).val()||0;return new Date().getTime()+n}function Tg(t){return zoe({timestamp:KH(t)})}function Hj(t,e,n,r,i){t.dataUpdateCount++;let o=new He(e);n=t.interceptServerDataCallback_?t.interceptServerDataCallback_(e,n):n;let s=[];if(i)if(r){let c=Ip(n,l=>At(l));s=Boe(t.serverSyncTree_,o,c,i)}else{let c=At(n);s=kH(t.serverSyncTree_,o,c,i)}else if(r){let c=Ip(n,l=>At(l));s=Foe(t.serverSyncTree_,o,c)}else{let c=At(n);s=mg(t.serverSyncTree_,o,c)}let a=o;s.length>0&&(a=Pd(t,o)),Cr(t.eventQueue_,a,s)}function $j(t,e){jw(t,"connected",e),e===!1&&fse(t)}function lse(t,e){dn(e,(n,r)=>{jw(t,n,r)})}function jw(t,e,n){let r=new He("/.info/"+e),i=At(n);t.infoData_.updateSnapshot(r,i);let o=mg(t.infoSyncTree_,r,i);Cr(t.eventQueue_,r,o)}function gI(t){return t.nextWriteId_++}function use(t,e,n){let r=Goe(t.serverSyncTree_,e);return r!=null?Promise.resolve(r):t.server_.get(e).then(i=>{let o=At(i).withIndex(e._queryParams.getIndex());sw(t.serverSyncTree_,e,n,!0);let s;if(e._queryParams.loadsAllData())s=mg(t.serverSyncTree_,e._path,o);else{let a=cg(t.serverSyncTree_,e);s=kH(t.serverSyncTree_,e._path,o,a)}return Cr(t.eventQueue_,e._path,s),eI(t.serverSyncTree_,e,n,null,!0),o},i=>(Vd(t,"get for query "+xt(e)+" failed: "+i),Promise.reject(new Error(i))))}function dse(t,e,n,r,i){Vd(t,"set",{path:e.toString(),value:n,priority:r});let o=Tg(t),s=At(n,r),a=lI(t.serverSyncTree_,e),c=Uw(s,a,o),l=gI(t),d=Pw(t.serverSyncTree_,e,c,l,!0);pI(t.eventQueue_,d),t.server_.put(e.toString(),s.val(!0),(f,g)=>{let E=f==="ok";E||Un("set at "+e+" failed: "+f);let I=ra(t.serverSyncTree_,l,!E);Cr(t.eventQueue_,e,I),ua(t,i,f,g)});let h=$w(t,e);Pd(t,h),Cr(t.eventQueue_,h,[])}function hse(t,e,n,r){Vd(t,"update",{path:e.toString(),value:n});let i=!0,o=Tg(t),s={};if(dn(n,(a,c)=>{i=!1,s[a]=BH(Ct(e,a),At(c),t.serverSyncTree_,o)}),i)un("update() called with empty data. Don't do anything."),ua(t,r,"ok",void 0);else{let a=gI(t),c=koe(t.serverSyncTree_,e,s,a);pI(t.eventQueue_,c),t.server_.merge(e.toString(),n,(l,d)=>{let h=l==="ok";h||Un("update at "+e+" failed: "+l);let f=ra(t.serverSyncTree_,a,!h),g=f.length>0?Pd(t,e):e;Cr(t.eventQueue_,g,f),ua(t,r,l,d)}),dn(n,l=>{let d=$w(t,Ct(e,l));Pd(t,d)}),Cr(t.eventQueue_,e,[])}}function fse(t){Vd(t,"onDisconnectEvents");let e=Tg(t),n=$y();qb(t.onDisconnect_,je(),(i,o)=>{let s=BH(i,o,t.serverSyncTree_,e);Fd(n,i,s)});let r=[];qb(n,je(),(i,o)=>{r=r.concat(mg(t.serverSyncTree_,i,o));let s=$w(t,i);Pd(t,s)}),t.onDisconnect_=$y(),Cr(t.eventQueue_,je(),r)}function pse(t,e,n){t.server_.onDisconnectCancel(e.toString(),(r,i)=>{r==="ok"&&zb(t.onDisconnect_,e),ua(t,n,r,i)})}function Wj(t,e,n,r){let i=At(n);t.server_.onDisconnectPut(e.toString(),i.val(!0),(o,s)=>{o==="ok"&&Fd(t.onDisconnect_,e,i),ua(t,r,o,s)})}function gse(t,e,n,r,i){let o=At(n,r);t.server_.onDisconnectPut(e.toString(),o.val(!0),(s,a)=>{s==="ok"&&Fd(t.onDisconnect_,e,o),ua(t,i,s,a)})}function mse(t,e,n,r){if(yp(n)){un("onDisconnect().update() called with empty data. Don't do anything."),ua(t,r,"ok",void 0);return}t.server_.onDisconnectMerge(e.toString(),n,(i,o)=>{i==="ok"&&dn(n,(s,a)=>{let c=At(a);Fd(t.onDisconnect_,Ct(e,s),c)}),ua(t,r,i,o)})}function Ese(t,e,n){let r;we(e._path)===".info"?r=sw(t.infoSyncTree_,e,n):r=sw(t.serverSyncTree_,e,n),zH(t.eventQueue_,e._path,r)}function hw(t,e,n){let r;we(e._path)===".info"?r=eI(t.infoSyncTree_,e,n):r=eI(t.serverSyncTree_,e,n),zH(t.eventQueue_,e._path,r)}function _se(t){t.persistentConnection_&&t.persistentConnection_.interrupt(sse)}function Vd(t,...e){let n="";t.persistentConnection_&&(n=t.persistentConnection_.id+":"),un(n,...e)}function ua(t,e,n,r){e&&kd(()=>{if(n==="ok")e(null);else{let i=(n||"error").toUpperCase(),o=i;r&&(o+=": "+r);let s=new Error(o);s.code=i,e(s)}})}function Tse(t,e,n,r,i,o){Vd(t,"transaction on "+e);let s={path:e,update:n,onComplete:r,status:null,order:Yj(),applyLocally:o,retryCount:0,unwatcher:i,abortReason:null,currentWriteId:null,currentInputSnapshot:null,currentOutputSnapshotRaw:null,currentOutputSnapshotResolved:null},a=Hw(t,e,void 0);s.currentInputSnapshot=a;let c=s.update(a.val());if(c===void 0)s.unwatcher(),s.currentOutputSnapshotRaw=null,s.currentOutputSnapshotResolved=null,s.onComplete&&s.onComplete(null,!1,s.currentInputSnapshot);else{_g("transaction failed: Data returned ",c,s.path),s.status=0;let l=dI(t.transactionQueueTree_,e),d=Tl(l)||[];d.push(s),Bw(l,d);let h;typeof c=="object"&&c!==null&&zr(c,".priority")?(h=Ws(c,".priority"),Y(ug(h),"Invalid priority returned by transaction. Priority must be a valid string, finite number, server value, or null.")):h=(lI(t.serverSyncTree_,e)||ve.EMPTY_NODE).getPriority().val();let f=Tg(t),g=At(c,h),E=Uw(g,a,f);s.currentOutputSnapshotRaw=g,s.currentOutputSnapshotResolved=E,s.currentWriteId=gI(t);let I=Pw(t.serverSyncTree_,e,E,s.currentWriteId,s.applyLocally);Cr(t.eventQueue_,e,I),mI(t,t.transactionQueueTree_)}}function Hw(t,e,n){return lI(t.serverSyncTree_,e,n)||ve.EMPTY_NODE}function mI(t,e=t.transactionQueueTree_){if(e||EI(t,e),Tl(e)){let n=XH(t,e);Y(n.length>0,"Sending zero length transaction queue"),n.every(i=>i.status===0)&&yse(t,Eg(e),n)}else GH(e)&&hI(e,n=>{mI(t,n)})}function yse(t,e,n){let r=n.map(l=>l.currentWriteId),i=Hw(t,e,r),o=i,s=i.hash();for(let l=0;l<n.length;l++){let d=n[l];Y(d.status===0,"tryToSendTransactionQueue_: items in queue should all be run."),d.status=1,d.retryCount++;let h=Kn(e,d.path);o=o.updateChild(h,d.currentOutputSnapshotRaw)}let a=o.val(!0),c=e;t.server_.put(c.toString(),a,l=>{Vd(t,"transaction put response",{path:c.toString(),status:l});let d=[];if(l==="ok"){let h=[];for(let f=0;f<n.length;f++)n[f].status=2,d=d.concat(ra(t.serverSyncTree_,n[f].currentWriteId)),n[f].onComplete&&h.push(()=>n[f].onComplete(null,!0,n[f].currentOutputSnapshotResolved)),n[f].unwatcher();EI(t,dI(t.transactionQueueTree_,e)),mI(t,t.transactionQueueTree_),Cr(t.eventQueue_,e,d);for(let f=0;f<h.length;f++)kd(h[f])}else{if(l==="datastale")for(let h=0;h<n.length;h++)n[h].status===3?n[h].status=4:n[h].status=0;else{Un("transaction at "+c.toString()+" failed: "+l);for(let h=0;h<n.length;h++)n[h].status=4,n[h].abortReason=l}Pd(t,e)}},s)}function Pd(t,e){let n=YH(t,e),r=Eg(n),i=XH(t,n);return Ise(t,i,r),r}function Ise(t,e,n){if(e.length===0)return;let r=[],i=[],s=e.filter(a=>a.status===0).map(a=>a.currentWriteId);for(let a=0;a<e.length;a++){let c=e[a],l=Kn(n,c.path),d=!1,h;if(Y(l!==null,"rerunTransactionsUnderNode_: relativePath should not be null."),c.status===4)d=!0,h=c.abortReason,i=i.concat(ra(t.serverSyncTree_,c.currentWriteId,!0));else if(c.status===0)if(c.retryCount>=ase)d=!0,h="maxretry",i=i.concat(ra(t.serverSyncTree_,c.currentWriteId,!0));else{let f=Hw(t,c.path,s);c.currentInputSnapshot=f;let g=e[a].update(f.val());if(g!==void 0){_g("transaction failed: Data returned ",g,c.path);let E=At(g);typeof g=="object"&&g!=null&&zr(g,".priority")||(E=E.updatePriority(f.getPriority()));let S=c.currentWriteId,R=Tg(t),U=Uw(E,f,R);c.currentOutputSnapshotRaw=E,c.currentOutputSnapshotResolved=U,c.currentWriteId=gI(t),s.splice(s.indexOf(S),1),i=i.concat(Pw(t.serverSyncTree_,c.path,U,c.currentWriteId,c.applyLocally)),i=i.concat(ra(t.serverSyncTree_,S,!0))}else d=!0,h="nodata",i=i.concat(ra(t.serverSyncTree_,c.currentWriteId,!0))}Cr(t.eventQueue_,n,i),i=[],d&&(e[a].status=2,(function(f){setTimeout(f,Math.floor(0))})(e[a].unwatcher),e[a].onComplete&&(h==="nodata"?r.push(()=>e[a].onComplete(null,!1,e[a].currentInputSnapshot)):r.push(()=>e[a].onComplete(new Error(h),!1,null))))}EI(t,t.transactionQueueTree_);for(let a=0;a<r.length;a++)kd(r[a]);mI(t,t.transactionQueueTree_)}function YH(t,e){let n,r=t.transactionQueueTree_;for(n=we(e);n!==null&&Tl(r)===void 0;)r=dI(r,n),e=lt(e),n=we(e);return r}function XH(t,e){let n=[];return QH(t,e,n),n.sort((r,i)=>r.order-i.order),n}function QH(t,e,n){let r=Tl(e);if(r)for(let i=0;i<r.length;i++)n.push(r[i]);hI(e,i=>{QH(t,i,n)})}function EI(t,e){let n=Tl(e);if(n){let r=0;for(let i=0;i<n.length;i++)n[i].status!==2&&(n[r]=n[i],r++);n.length=r,Bw(e,n.length>0?n:void 0)}hI(e,r=>{EI(t,r)})}function $w(t,e){let n=Eg(YH(t,e)),r=dI(t.transactionQueueTree_,e);return Xoe(r,i=>{vb(t,i)}),vb(t,r),jH(r,i=>{vb(t,i)}),n}function vb(t,e){let n=Tl(e);if(n){let r=[],i=[],o=-1;for(let s=0;s<n.length;s++)n[s].status===3||(n[s].status===1?(Y(o===s-1,"All SENT items should be at beginning of queue."),o=s,n[s].status=3,n[s].abortReason="set"):(Y(n[s].status===0,"Unexpected transaction status in abort"),n[s].unwatcher(),i=i.concat(ra(t.serverSyncTree_,n[s].currentWriteId,!0)),n[s].onComplete&&r.push(n[s].onComplete.bind(null,new Error("set"),!1,null))));o===-1?Bw(e,void 0):n.length=o+1,Cr(t.eventQueue_,Eg(e),i);for(let s=0;s<r.length;s++)kd(r[s])}}function vse(t){let e="",n=t.split("/");for(let r=0;r<n.length;r++)if(n[r].length>0){let i=n[r];try{i=decodeURIComponent(i.replace(/\+/g," "))}catch{}e+="/"+i}return e}function Sse(t){let e={};t.charAt(0)==="?"&&(t=t.substring(1));for(let n of t.split("&")){if(n.length===0)continue;let r=n.split("=");r.length===2?e[decodeURIComponent(r[0])]=decodeURIComponent(r[1]):Un(`Invalid query segment '${n}' in query '${t}'`)}return e}var zj=function(t,e){let n=Ase(t),r=n.namespace;n.domain==="firebase.com"&&rs(n.host+" is no longer supported. Please use <YOUR FIREBASE>.firebaseio.com instead"),(!r||r==="undefined")&&n.domain!=="localhost"&&rs("Cannot parse Firebase url. Please use https://<YOUR FIREBASE>.firebaseio.com"),n.secure||Xre();let i=n.scheme==="ws"||n.scheme==="wss";return{repoInfo:new xy(n.host,n.secure,r,i,e,"",r!==n.subdomain),path:new He(n.pathString)}},Ase=function(t){let e="",n="",r="",i="",o="",s=!0,a="https",c=443;if(typeof t=="string"){let l=t.indexOf("//");l>=0&&(a=t.substring(0,l-1),t=t.substring(l+2));let d=t.indexOf("/");d===-1&&(d=t.length);let h=t.indexOf("?");h===-1&&(h=t.length),e=t.substring(0,Math.min(d,h)),d<h&&(i=vse(t.substring(d,h)));let f=Sse(t.substring(Math.min(t.length,h)));l=e.indexOf(":"),l>=0?(s=a==="https"||a==="wss",c=parseInt(e.substring(l+1),10)):l=e.length;let g=e.slice(0,l);if(g.toLowerCase()==="localhost")n="localhost";else if(g.split(".").length<=2)n=g;else{let E=e.indexOf(".");r=e.substring(0,E).toLowerCase(),n=e.substring(E+1),o=r}"ns"in f&&(o=f.ns)}return{host:e,port:c,domain:n,subdomain:r,secure:s,scheme:a,pathString:i,namespace:o}};var qj="-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz",Cse=(function(){let t=0,e=[];return function(n){let r=n===t;t=n;let i,o=new Array(8);for(i=7;i>=0;i--)o[i]=qj.charAt(n%64),n=Math.floor(n/64);Y(n===0,"Cannot push at time == 0");let s=o.join("");if(r){for(i=11;i>=0&&e[i]===63;i--)e[i]=0;e[i]++}else for(i=0;i<12;i++)e[i]=Math.floor(Math.random()*64);for(i=0;i<12;i++)s+=qj.charAt(e[i]);return Y(s.length===20,"nextPushId: Length should be 20."),s}})();var tI=class{constructor(e,n,r,i){this.eventType=e,this.eventRegistration=n,this.snapshot=r,this.prevName=i}getPath(){let e=this.snapshot.ref;return this.eventType==="value"?e._path:e.parent._path}getEventType(){return this.eventType}getEventRunner(){return this.eventRegistration.getEventRunner(this)}toString(){return this.getPath().toString()+":"+this.eventType+":"+xt(this.snapshot.exportVal())}},nI=class{constructor(e,n,r){this.eventRegistration=e,this.error=n,this.path=r}getPath(){return this.path}getEventType(){return"cancel"}getEventRunner(){return this.eventRegistration.getEventRunner(this)}toString(){return this.path.toString()+":cancel"}};var dg=class{constructor(e,n){this.snapshotCallback=e,this.cancelCallback=n}onValue(e,n){this.snapshotCallback.call(null,e,n)}onCancel(e){return Y(this.hasCancelCallback,"Raising a cancel event on a listener with no cancel callback"),this.cancelCallback.call(null,e)}get hasCancelCallback(){return!!this.cancelCallback}matches(e){return this.snapshotCallback===e.snapshotCallback||this.snapshotCallback.userCallback!==void 0&&this.snapshotCallback.userCallback===e.snapshotCallback.userCallback&&this.snapshotCallback.context===e.snapshotCallback.context}};var fw=class{constructor(e,n){this._repo=e,this._path=n}cancel(){let e=new cn;return pse(this._repo,this._path,e.wrapCallback(()=>{})),e.promise}remove(){ia("OnDisconnect.remove",this._path);let e=new cn;return Wj(this._repo,this._path,null,e.wrapCallback(()=>{})),e.promise}set(e){ia("OnDisconnect.set",this._path),fl("OnDisconnect.set",e,this._path,!1);let n=new cn;return Wj(this._repo,this._path,e,n.wrapCallback(()=>{})),n.promise}setWithPriority(e,n){ia("OnDisconnect.setWithPriority",this._path),fl("OnDisconnect.setWithPriority",e,this._path,!1),nse("OnDisconnect.setWithPriority",n,!1);let r=new cn;return gse(this._repo,this._path,e,n,r.wrapCallback(()=>{})),r.promise}update(e){ia("OnDisconnect.update",this._path),$H("OnDisconnect.update",e,this._path,!1);let n=new cn;return mse(this._repo,this._path,e,n.wrapCallback(()=>{})),n.promise}};var pl=class t{constructor(e,n,r,i){this._repo=e,this._path=n,this._queryParams=r,this._orderByCalled=i}get key(){return Oe(this._path)?null:Aw(this._path)}get ref(){return new Ai(this._repo,this._path)}get _queryIdentifier(){let e=Lj(this._queryParams),n=vw(e);return n==="{}"?"default":n}get _queryObject(){return Lj(this._queryParams)}isEqual(e){if(e=Pe(e),!(e instanceof t))return!1;let n=this._repo===e._repo,r=Cw(this._path,e._path),i=this._queryIdentifier===e._queryIdentifier;return n&&r&&i}toJSON(){return this.toString()}toString(){return this._repo.toString()+Nie(this._path)}};function Dse(t,e){if(t._orderByCalled===!0)throw new Error(e+": You can't combine multiple orderBy calls.")}function Ww(t){let e=null,n=null;if(t.hasStart()&&(e=t.getIndexStartValue()),t.hasEnd()&&(n=t.getIndexEndValue()),t.getIndex()===ul){let r="Query: When ordering by key, you may only pass one argument to startAt(), endAt(), or equalTo().",i="Query: When ordering by key, the argument passed to startAt(), startAfter(), endAt(), endBefore(), or equalTo() must be a string.";if(t.hasStart()){if(t.getIndexStartName()!==dl)throw new Error(r);if(typeof e!="string")throw new Error(i)}if(t.hasEnd()){if(t.getIndexEndName()!==aa)throw new Error(r);if(typeof n!="string")throw new Error(i)}}else if(t.getIndex()===ft){if(e!=null&&!ug(e)||n!=null&&!ug(n))throw new Error("Query: When ordering by priority, the first argument passed to startAt(), startAfter() endAt(), endBefore(), or equalTo() must be a valid priority value (null, a number, or a string).")}else if(Y(t.getIndex()instanceof ng||t.getIndex()===IH,"unknown index type."),e!=null&&typeof e=="object"||n!=null&&typeof n=="object")throw new Error("Query: First argument passed to startAt(), startAfter(), endAt(), endBefore(), or equalTo() cannot be an object.")}function JH(t){if(t.hasStart()&&t.hasEnd()&&t.hasLimit()&&!t.hasAnchoredLimit())throw new Error("Query: Can't combine startAt(), startAfter(), endAt(), endBefore(), and limit(). Use limitToFirst() or limitToLast() instead.")}var Ai=class t extends pl{constructor(e,n){super(e,n,new Hb,!1)}get parent(){let e=gH(this._path);return e===null?null:new t(this._repo,e)}get root(){let e=this;for(;e.parent!==null;)e=e.parent;return e}},xd=class t{constructor(e,n,r){this._node=e,this.ref=n,this._index=r}get priority(){return this._node.getPriority().val()}get key(){return this.ref.key}get size(){return this._node.numChildren()}child(e){let n=new He(e),r=gl(this.ref,e);return new t(this._node.getChild(n),r,ft)}exists(){return!this._node.isEmpty()}exportVal(){return this._node.val(!0)}forEach(e){return this._node.isLeafNode()?!1:!!this._node.forEachChild(this._index,(r,i)=>e(new t(i,gl(this.ref,r),ft)))}hasChild(e){let n=new He(e);return!this._node.getChild(n).isEmpty()}hasChildren(){return this._node.isLeafNode()?!1:!this._node.isEmpty()}toJSON(){return this.exportVal()}val(){return this._node.val()}};function ZH(t,e){return t=Pe(t),t._checkNotDeleted("ref"),e!==void 0?gl(t._root,e):t._root}function gl(t,e){return t=Pe(t),we(t._path)===null?rse("child","path",e,!1):Gw("child","path",e,!1),new Ai(t._repo,Ct(t._path,e))}function e$(t){return t=Pe(t),new fw(t._repo,t._path)}function t$(t,e){t=Pe(t),ia("push",t._path),fl("push",e,t._path,!0);let n=KH(t._repo),r=Cse(n),i=gl(t,r),o=gl(t,r),s;return e!=null?s=_I(o,e).then(()=>o):s=Promise.resolve(o),i.then=s.then.bind(s),i.catch=s.then.bind(s,void 0),i}function n$(t){return ia("remove",t._path),_I(t,null)}function _I(t,e){t=Pe(t),ia("set",t._path),fl("set",e,t._path,!1);let n=new cn;return dse(t._repo,t._path,e,null,n.wrapCallback(()=>{})),n.promise}function r$(t,e){$H("update",e,t._path,!1);let n=new cn;return hse(t._repo,t._path,e,n.wrapCallback(()=>{})),n.promise}function TI(t){t=Pe(t);let e=new dg(()=>{}),n=new hg(e);return use(t._repo,t,n).then(r=>new xd(r,new Ai(t._repo,t._path),t._queryParams.getIndex()))}var hg=class t{constructor(e){this.callbackContext=e}respondsTo(e){return e==="value"}createEvent(e,n){let r=n._queryParams.getIndex();return new tI("value",this,new xd(e.snapshotNode,new Ai(n._repo,n._path),r))}getEventRunner(e){return e.getEventType()==="cancel"?()=>this.callbackContext.onCancel(e.error):()=>this.callbackContext.onValue(e.snapshot,null)}createCancelEvent(e,n){return this.callbackContext.hasCancelCallback?new nI(this,e,n):null}matches(e){return e instanceof t?!e.callbackContext||!this.callbackContext?!0:e.callbackContext.matches(this.callbackContext):!1}hasAnyCallback(){return this.callbackContext!==null}},rI=class t{constructor(e,n){this.eventType=e,this.callbackContext=n}respondsTo(e){let n=e==="children_added"?"child_added":e;return n=n==="children_removed"?"child_removed":n,this.eventType===n}createCancelEvent(e,n){return this.callbackContext.hasCancelCallback?new nI(this,e,n):null}createEvent(e,n){Y(e.childName!=null,"Child events should have a childName.");let r=gl(new Ai(n._repo,n._path),e.childName),i=n._queryParams.getIndex();return new tI(e.type,this,new xd(e.snapshotNode,r,i),e.prevName)}getEventRunner(e){return e.getEventType()==="cancel"?()=>this.callbackContext.onCancel(e.error):()=>this.callbackContext.onValue(e.snapshot,e.prevName)}matches(e){return e instanceof t?this.eventType===e.eventType&&(!this.callbackContext||!e.callbackContext||this.callbackContext.matches(e.callbackContext)):!1}hasAnyCallback(){return!!this.callbackContext}};function yg(t,e,n,r,i){let o;if(typeof r=="object"&&(o=void 0,i=r),typeof r=="function"&&(o=r),i&&i.onlyOnce){let c=n,l=(d,h)=>{hw(t._repo,t,a),c(d,h)};l.userCallback=n.userCallback,l.context=n.context,n=l}let s=new dg(n,o||void 0),a=e==="value"?new hg(s):new rI(e,s);return Ese(t._repo,t,a),()=>hw(t._repo,t,a)}function Ig(t,e,n,r){return yg(t,"value",e,n,r)}function yI(t,e,n,r){return yg(t,"child_added",e,n,r)}function II(t,e,n,r){return yg(t,"child_changed",e,n,r)}function zw(t,e,n,r){return yg(t,"child_moved",e,n,r)}function vI(t,e,n,r){return yg(t,"child_removed",e,n,r)}function SI(t,e,n){let r=null,i=n?new dg(n):null;e==="value"?r=new hg(i):e&&(r=new rI(e,i)),hw(t._repo,t,r)}var ml=class{},pw=class extends ml{constructor(e,n){super(),this._value=e,this._key=n,this.type="endAt"}_apply(e){fl("endAt",this._value,e._path,!0);let n=zie(e._queryParams,this._value,this._key);if(JH(n),Ww(n),e._queryParams.hasEnd())throw new Error("endAt: Starting point was already set (by another call to endAt, endBefore or equalTo).");return new pl(e._repo,e._path,n,e._orderByCalled)}};var iI=class extends ml{constructor(e,n){super(),this._value=e,this._key=n,this.type="startAt"}_apply(e){fl("startAt",this._value,e._path,!0);let n=Wie(e._queryParams,this._value,this._key);if(JH(n),Ww(n),e._queryParams.hasStart())throw new Error("startAt: Starting point was already set (by another call to startAt, startBefore or equalTo).");return new pl(e._repo,e._path,n,e._orderByCalled)}};function i$(t=null,e){return WH("startAt","key",e,!0),new iI(t,e)}var gw=class extends ml{constructor(e){super(),this._limit=e,this.type="limitToLast"}_apply(e){if(e._queryParams.hasLimit())throw new Error("limitToLast: Limit was already set (by another call to limitToFirst or limitToLast).");return new pl(e._repo,e._path,$ie(e._queryParams,this._limit),e._orderByCalled)}};function o$(t){if(typeof t!="number"||Math.floor(t)!==t||t<=0)throw new Error("limitToLast: First argument must be a positive integer.");return new gw(t)}var mw=class extends ml{constructor(e){super(),this._path=e,this.type="orderByChild"}_apply(e){Dse(e,"orderByChild");let n=new He(this._path);if(Oe(n))throw new Error("orderByChild: cannot pass in empty path. Use orderByValue() instead.");let r=new ng(n),i=qie(e._queryParams,r);return Ww(i),new pl(e._repo,e._path,i,!0)}};function s$(t){if(t==="$key")throw new Error('orderByChild: "$key" is invalid. Use orderByKey() instead.');if(t==="$priority")throw new Error('orderByChild: "$priority" is invalid. Use orderByPriority() instead.');if(t==="$value")throw new Error('orderByChild: "$value" is invalid. Use orderByValue() instead.');return Gw("orderByChild","path",t,!1),new mw(t)}var Ew=class extends ml{constructor(e,n){super(),this._value=e,this._key=n,this.type="equalTo"}_apply(e){if(fl("equalTo",this._value,e._path,!1),e._queryParams.hasStart())throw new Error("equalTo: Starting point was already set (by another call to startAt/startAfter or equalTo).");if(e._queryParams.hasEnd())throw new Error("equalTo: Ending point was already set (by another call to endAt/endBefore or equalTo).");return new pw(this._value,this._key)._apply(new iI(this._value,this._key)._apply(e))}};function a$(t,e){return WH("equalTo","key",e,!0),new Ew(t,e)}function c$(t,...e){let n=Pe(t);for(let r of e)n=r._apply(n);return n}Noe(Ai);Moe(Ai);var Rse="FIREBASE_DATABASE_EMULATOR_HOST",_w={},Nse=!1;function bse(t,e,n,r){let i=e.lastIndexOf(":"),o=e.substring(0,i),s=vr(o);t.repoInfo_=new xy(e,s,t.repoInfo_.namespace,t.repoInfo_.webSocketOnly,t.repoInfo_.nodeAdmin,t.repoInfo_.persistenceKey,t.repoInfo_.includeNamespaceInQueryParams,!0,n),r&&(t.authTokenProvider_=r)}function wse(t,e,n,r,i){let o=r||t.options.databaseURL;o===void 0&&(t.options.projectId||rs("Can't determine Firebase Database URL. Be sure to include a Project ID when calling firebase.initializeApp()."),un("Using default host for project ",t.options.projectId),o=`${t.options.projectId}-default-rtdb.firebaseio.com`);let s=zj(o,i),a=s.repoInfo,c,l;typeof process<"u"&&process.env&&(l=process.env[Rse]),l?(c=!0,o=`http://${l}?ns=${a.namespace}`,s=zj(o,i),a=s.repoInfo):c=!s.repoInfo.secure;let d=i&&c?new Qp(Qp.OWNER):new Nb(t.name,t.options,e);ise("Invalid Firebase Database URL",s),Oe(s.path)||rs("Database URL must point to the root of a Firebase Database (not including a child path).");let h=Lse(a,t,d,new Rb(t,n));return new Tw(h,t)}function Ose(t,e){let n=_w[e];(!n||n[t.key]!==t)&&rs(`Database ${e}(${t.repoInfo_}) has already been deleted.`),_se(t),delete n[t.key]}function Lse(t,e,n,r){let i=_w[e.name];i||(i={},_w[e.name]=i);let o=i[t.toURLString()];return o&&rs("Database initialized multiple times. Please make sure the format of the database URL matches with each database() call."),o=new dw(t,Nse,n,r),i[t.toURLString()]=o,o}var Tw=class{constructor(e,n){this._repoInternal=e,this.app=n,this.type="database",this._instanceStarted=!1}get _repo(){return this._instanceStarted||(cse(this._repoInternal,this.app.options.appId,this.app.options.databaseAuthVariableOverride),this._instanceStarted=!0),this._repoInternal}get _root(){return this._rootInternal||(this._rootInternal=new Ai(this._repo,je())),this._rootInternal}_delete(){return this._rootInternal!==null&&(Ose(this._repo,this.app.name),this._repoInternal=null,this._rootInternal=null),Promise.resolve()}_checkNotDeleted(e){this._rootInternal===null&&rs("Cannot call "+e+" on a deleted database.")}};function Mse(){pH.IS_TRANSPORT_INITIALIZED&&Un("Transport has already been initialized. Please call this function before calling ref or setting up a listener")}function qw(){Mse(),Cd.forceDisallow(),ky.forceAllow()}function Bd(t=ir(),e){let n=uo(t,"database").getImmediate({identifier:e});if(!n._instanceStarted){let r=gd("database");r&&l$(n,...r)}return n}function l$(t,e,n,r={}){t=Pe(t),t._checkNotDeleted("useEmulator");let i=`${e}:${n}`,o=t._repoInternal;if(t._instanceStarted){if(i===t._repoInternal.repoInfo_.host&&Ei(r,o.repoInfo_.emulatorOptions))return;rs("connectDatabaseEmulator() cannot initialize or alter the emulator configuration after the database instance has started.")}let s;if(o.repoInfo_.nodeAdmin)r.mockUserToken&&rs('mockUserToken is not supported by the Admin SDK. For client access with mock users, please use the "firebase" package instead of "firebase-admin".'),s=new Qp(Qp.OWNER);else if(r.mockUserToken){let a=typeof r.mockUserToken=="string"?r.mockUserToken:QT(r.mockUserToken,t.app.options.projectId);s=new Qp(a)}vr(e)&&($s(e),qc("Database",!0)),bse(o,i,r,s)}function Pse(t){Kre(Ks),qn(new Qt("database",(e,{instanceIdentifier:n})=>{let r=e.getProvider("app").getImmediate(),i=e.getProvider("auth-internal"),o=e.getProvider("app-check-internal");return wse(r,i,o,n)},"PUBLIC").setMultipleInstances(!0)),$e(gj,mj,t),$e(gj,mj,"esm2017")}var yw=class{constructor(e,n){this.committed=e,this.snapshot=n}toJSON(){return{committed:this.committed,snapshot:this.snapshot.toJSON()}}};function u$(t,e,n){var r;if(t=Pe(t),ia("Reference.transaction",t._path),t.key===".length"||t.key===".keys")throw"Reference.transaction failed: "+t.key+" is a read-only object.";let i=(r=n?.applyLocally)!==null&&r!==void 0?r:!0,o=new cn,s=(c,l,d)=>{let h=null;c?o.reject(c):(h=new xd(d,new Ai(t._repo,t._path),ft),o.resolve(new yw(l,h)))},a=Ig(t,()=>{});return Tse(t._repo,t._path,e,s,a,i),o.promise}Dw.prototype.simpleListen=function(t,e){this.sendRequest("q",{p:t},e)};Dw.prototype.echo=function(t,e){this.sendRequest("echo",{d:t},e)};Pse();var yl,hn=(function(t){return t.added="child_added",t.removed="child_removed",t.changed="child_changed",t.moved="child_moved",t.value="value",t})(hn||{}),xse=Object.freeze((yl={},yl[hn.added]=yI,yl[hn.removed]=vI,yl[hn.changed]=II,yl[hn.moved]=zw,yl[hn.value]=Ig,yl));function CI(t,e){return new he(function(n){var r=xse[e](t,function(i,o){n.next({snapshot:i,prevKey:o,event:e})},n.error.bind(n));return{unsubscribe:function(){SI(t,e,r)}}}).pipe(wS(0))}var AI=function(){return AI=Object.assign||function(e){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},AI.apply(this,arguments)};function Kw(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,o;r<i;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))}function d$(t){return(t==null||t.length===0)&&(t=[hn.added,hn.removed,hn.changed,hn.moved]),t}function h$(t,e){return e===void 0&&(e={}),CI(t,hn.value).pipe(De(function(n){return Yw(n,e)}))}function Yw(t,e){var n;e===void 0&&(e={});var r=t.snapshot.val();return!t.snapshot.exists()||typeof r!="object"?r:AI(AI({},r),e.keyField?(n={},n[e.keyField]=t.snapshot.key,n):null)}function f$(t,e){e===void 0&&(e={});var n=d$(e.events),r=n.map(function(i){return CI(t,i)});return vs.apply(void 0,r)}function kse(t){return hr(TI(t)).pipe(De(function(e){var n=hn.value;return{snapshot:e,prevKey:null,event:n}}))}function p$(t,e){e===void 0&&(e={});var n=d$(e.events);return kse(t).pipe(Zn(function(r){var i=[st(r)];return n.forEach(function(o){i.push(CI(t,o))}),vs.apply(void 0,i).pipe(hE(Use,[]))}),ai())}function g$(t,e){return e===void 0&&(e={}),p$(t).pipe(De(function(n){return n.map(function(r){return Yw(r,e)})}))}function m$(t,e){for(var n=t.length,r=0;r<n;r++)if(t[r].snapshot.key===e)return r;return-1}function Fse(t,e){if(e==null)return 0;var n=m$(t,e);return n===-1?t.length:n+1}function Use(t,e){var n=e.snapshot,r=e.prevKey,i=e.event,o=n.key,s=m$(t,o),a=Fse(t,r||void 0);switch(i){case hn.value:if(e.snapshot&&e.snapshot.exists()){var c=null;e.snapshot.forEach(function(h){var f={snapshot:h,event:hn.value,prevKey:c};return c=h.key,t=Kw(Kw([],t,!0),[f],!1),!1})}return t;case hn.added:if(s>-1){var l=t[s-1];(l&&l.snapshot.key||null)!==r&&(t=t.filter(function(h){return h.snapshot.key!==n.key}),t.splice(a,0,e))}else{if(r==null)return Kw([e],t,!0);t=t.slice(),t.splice(a,0,e)}return t;case hn.removed:return t.filter(function(h){return h.snapshot.key!==n.key});case hn.changed:return t.map(function(h){return h.snapshot.key===o?e:h});case hn.moved:if(s>-1){var d=t.splice(s,1)[0];return t=t.slice(),t.splice(a,0,d),t}return t;default:return t}}var vg=class{constructor(e){return e}},E$="database",Xw=class{constructor(){return Qo(E$)}};var Qw=new K("angularfire2.database-instances");function Vse(t,e){let n=Ys(E$,t,e);return n&&new vg(n)}function Bse(t){return(e,n)=>{let r=e.runOutsideAngular(()=>t(n));return new vg(r)}}var Gse={provide:Xw,deps:[[new zt,Qw]]},jse={provide:vg,useFactory:Vse,deps:[[new zt,Qw],yi]};function xUe(t,...e){return $e("angularfire",_i.full,"rtdb"),er([jse,Gse,{provide:Qw,useFactory:Bse(t),multi:!0,deps:[Re,Ye,Ti,Jo,[new zt,el],[new zt,Qs],...e]}])}var _$=fe(g$,!0);var T$=fe(h$,!0),y$=fe(f$,!0);var kUe=fe(a$,!0,2);var Sg=fe(TI,!0),FUe=fe(Bd,!0);var UUe=fe(o$,!0,2),I$=fe(SI,!0),v$=fe(yI,!0),S$=fe(II,!0);var A$=fe(vI,!0),C$=fe(e$,!0),Jw=fe(Ig,!0),VUe=fe(s$,!0,2);var D$=fe(t$,!0,2),R$=fe(c$,!0,2),Gd=fe(ZH,!0,2);var N$=fe(n$,!0,2),b$=fe(u$,!0),w$=fe(_I,!0,2);var BUe=fe(i$,!0,2),O$=fe(r$,!0,2);var L$=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},M$={};var is,Zw;(function(){var t;function e(A,v){function C(){}C.prototype=v.prototype,A.D=v.prototype,A.prototype=new C,A.prototype.constructor=A,A.C=function(w,N,L){for(var D=Array(arguments.length-2),Lr=2;Lr<arguments.length;Lr++)D[Lr-2]=arguments[Lr];return v.prototype[N].apply(w,D)}}function n(){this.blockSize=-1}function r(){this.blockSize=-1,this.blockSize=64,this.g=Array(4),this.B=Array(this.blockSize),this.o=this.h=0,this.s()}e(r,n),r.prototype.s=function(){this.g[0]=1732584193,this.g[1]=4023233417,this.g[2]=2562383102,this.g[3]=271733878,this.o=this.h=0};function i(A,v,C){C||(C=0);var w=Array(16);if(typeof v=="string")for(var N=0;16>N;++N)w[N]=v.charCodeAt(C++)|v.charCodeAt(C++)<<8|v.charCodeAt(C++)<<16|v.charCodeAt(C++)<<24;else for(N=0;16>N;++N)w[N]=v[C++]|v[C++]<<8|v[C++]<<16|v[C++]<<24;v=A.g[0],C=A.g[1],N=A.g[2];var L=A.g[3],D=v+(L^C&(N^L))+w[0]+3614090360&4294967295;v=C+(D<<7&4294967295|D>>>25),D=L+(N^v&(C^N))+w[1]+3905402710&4294967295,L=v+(D<<12&4294967295|D>>>20),D=N+(C^L&(v^C))+w[2]+606105819&4294967295,N=L+(D<<17&4294967295|D>>>15),D=C+(v^N&(L^v))+w[3]+3250441966&4294967295,C=N+(D<<22&4294967295|D>>>10),D=v+(L^C&(N^L))+w[4]+4118548399&4294967295,v=C+(D<<7&4294967295|D>>>25),D=L+(N^v&(C^N))+w[5]+1200080426&4294967295,L=v+(D<<12&4294967295|D>>>20),D=N+(C^L&(v^C))+w[6]+2821735955&4294967295,N=L+(D<<17&4294967295|D>>>15),D=C+(v^N&(L^v))+w[7]+4249261313&4294967295,C=N+(D<<22&4294967295|D>>>10),D=v+(L^C&(N^L))+w[8]+1770035416&4294967295,v=C+(D<<7&4294967295|D>>>25),D=L+(N^v&(C^N))+w[9]+2336552879&4294967295,L=v+(D<<12&4294967295|D>>>20),D=N+(C^L&(v^C))+w[10]+4294925233&4294967295,N=L+(D<<17&4294967295|D>>>15),D=C+(v^N&(L^v))+w[11]+2304563134&4294967295,C=N+(D<<22&4294967295|D>>>10),D=v+(L^C&(N^L))+w[12]+1804603682&4294967295,v=C+(D<<7&4294967295|D>>>25),D=L+(N^v&(C^N))+w[13]+4254626195&4294967295,L=v+(D<<12&4294967295|D>>>20),D=N+(C^L&(v^C))+w[14]+2792965006&4294967295,N=L+(D<<17&4294967295|D>>>15),D=C+(v^N&(L^v))+w[15]+1236535329&4294967295,C=N+(D<<22&4294967295|D>>>10),D=v+(N^L&(C^N))+w[1]+4129170786&4294967295,v=C+(D<<5&4294967295|D>>>27),D=L+(C^N&(v^C))+w[6]+3225465664&4294967295,L=v+(D<<9&4294967295|D>>>23),D=N+(v^C&(L^v))+w[11]+643717713&4294967295,N=L+(D<<14&4294967295|D>>>18),D=C+(L^v&(N^L))+w[0]+3921069994&4294967295,C=N+(D<<20&4294967295|D>>>12),D=v+(N^L&(C^N))+w[5]+3593408605&4294967295,v=C+(D<<5&4294967295|D>>>27),D=L+(C^N&(v^C))+w[10]+38016083&4294967295,L=v+(D<<9&4294967295|D>>>23),D=N+(v^C&(L^v))+w[15]+3634488961&4294967295,N=L+(D<<14&4294967295|D>>>18),D=C+(L^v&(N^L))+w[4]+3889429448&4294967295,C=N+(D<<20&4294967295|D>>>12),D=v+(N^L&(C^N))+w[9]+568446438&4294967295,v=C+(D<<5&4294967295|D>>>27),D=L+(C^N&(v^C))+w[14]+3275163606&4294967295,L=v+(D<<9&4294967295|D>>>23),D=N+(v^C&(L^v))+w[3]+4107603335&4294967295,N=L+(D<<14&4294967295|D>>>18),D=C+(L^v&(N^L))+w[8]+1163531501&4294967295,C=N+(D<<20&4294967295|D>>>12),D=v+(N^L&(C^N))+w[13]+2850285829&4294967295,v=C+(D<<5&4294967295|D>>>27),D=L+(C^N&(v^C))+w[2]+4243563512&4294967295,L=v+(D<<9&4294967295|D>>>23),D=N+(v^C&(L^v))+w[7]+1735328473&4294967295,N=L+(D<<14&4294967295|D>>>18),D=C+(L^v&(N^L))+w[12]+2368359562&4294967295,C=N+(D<<20&4294967295|D>>>12),D=v+(C^N^L)+w[5]+4294588738&4294967295,v=C+(D<<4&4294967295|D>>>28),D=L+(v^C^N)+w[8]+2272392833&4294967295,L=v+(D<<11&4294967295|D>>>21),D=N+(L^v^C)+w[11]+1839030562&4294967295,N=L+(D<<16&4294967295|D>>>16),D=C+(N^L^v)+w[14]+4259657740&4294967295,C=N+(D<<23&4294967295|D>>>9),D=v+(C^N^L)+w[1]+2763975236&4294967295,v=C+(D<<4&4294967295|D>>>28),D=L+(v^C^N)+w[4]+1272893353&4294967295,L=v+(D<<11&4294967295|D>>>21),D=N+(L^v^C)+w[7]+4139469664&4294967295,N=L+(D<<16&4294967295|D>>>16),D=C+(N^L^v)+w[10]+3200236656&4294967295,C=N+(D<<23&4294967295|D>>>9),D=v+(C^N^L)+w[13]+681279174&4294967295,v=C+(D<<4&4294967295|D>>>28),D=L+(v^C^N)+w[0]+3936430074&4294967295,L=v+(D<<11&4294967295|D>>>21),D=N+(L^v^C)+w[3]+3572445317&4294967295,N=L+(D<<16&4294967295|D>>>16),D=C+(N^L^v)+w[6]+76029189&4294967295,C=N+(D<<23&4294967295|D>>>9),D=v+(C^N^L)+w[9]+3654602809&4294967295,v=C+(D<<4&4294967295|D>>>28),D=L+(v^C^N)+w[12]+3873151461&4294967295,L=v+(D<<11&4294967295|D>>>21),D=N+(L^v^C)+w[15]+530742520&4294967295,N=L+(D<<16&4294967295|D>>>16),D=C+(N^L^v)+w[2]+3299628645&4294967295,C=N+(D<<23&4294967295|D>>>9),D=v+(N^(C|~L))+w[0]+4096336452&4294967295,v=C+(D<<6&4294967295|D>>>26),D=L+(C^(v|~N))+w[7]+1126891415&4294967295,L=v+(D<<10&4294967295|D>>>22),D=N+(v^(L|~C))+w[14]+2878612391&4294967295,N=L+(D<<15&4294967295|D>>>17),D=C+(L^(N|~v))+w[5]+4237533241&4294967295,C=N+(D<<21&4294967295|D>>>11),D=v+(N^(C|~L))+w[12]+1700485571&4294967295,v=C+(D<<6&4294967295|D>>>26),D=L+(C^(v|~N))+w[3]+2399980690&4294967295,L=v+(D<<10&4294967295|D>>>22),D=N+(v^(L|~C))+w[10]+4293915773&4294967295,N=L+(D<<15&4294967295|D>>>17),D=C+(L^(N|~v))+w[1]+2240044497&4294967295,C=N+(D<<21&4294967295|D>>>11),D=v+(N^(C|~L))+w[8]+1873313359&4294967295,v=C+(D<<6&4294967295|D>>>26),D=L+(C^(v|~N))+w[15]+4264355552&4294967295,L=v+(D<<10&4294967295|D>>>22),D=N+(v^(L|~C))+w[6]+2734768916&4294967295,N=L+(D<<15&4294967295|D>>>17),D=C+(L^(N|~v))+w[13]+1309151649&4294967295,C=N+(D<<21&4294967295|D>>>11),D=v+(N^(C|~L))+w[4]+4149444226&4294967295,v=C+(D<<6&4294967295|D>>>26),D=L+(C^(v|~N))+w[11]+3174756917&4294967295,L=v+(D<<10&4294967295|D>>>22),D=N+(v^(L|~C))+w[2]+718787259&4294967295,N=L+(D<<15&4294967295|D>>>17),D=C+(L^(N|~v))+w[9]+3951481745&4294967295,A.g[0]=A.g[0]+v&4294967295,A.g[1]=A.g[1]+(N+(D<<21&4294967295|D>>>11))&4294967295,A.g[2]=A.g[2]+N&4294967295,A.g[3]=A.g[3]+L&4294967295}r.prototype.u=function(A,v){v===void 0&&(v=A.length);for(var C=v-this.blockSize,w=this.B,N=this.h,L=0;L<v;){if(N==0)for(;L<=C;)i(this,A,L),L+=this.blockSize;if(typeof A=="string"){for(;L<v;)if(w[N++]=A.charCodeAt(L++),N==this.blockSize){i(this,w),N=0;break}}else for(;L<v;)if(w[N++]=A[L++],N==this.blockSize){i(this,w),N=0;break}}this.h=N,this.o+=v},r.prototype.v=function(){var A=Array((56>this.h?this.blockSize:2*this.blockSize)-this.h);A[0]=128;for(var v=1;v<A.length-8;++v)A[v]=0;var C=8*this.o;for(v=A.length-8;v<A.length;++v)A[v]=C&255,C/=256;for(this.u(A),A=Array(16),v=C=0;4>v;++v)for(var w=0;32>w;w+=8)A[C++]=this.g[v]>>>w&255;return A};function o(A,v){var C=a;return Object.prototype.hasOwnProperty.call(C,A)?C[A]:C[A]=v(A)}function s(A,v){this.h=v;for(var C=[],w=!0,N=A.length-1;0<=N;N--){var L=A[N]|0;w&&L==v||(C[N]=L,w=!1)}this.g=C}var a={};function c(A){return-128<=A&&128>A?o(A,function(v){return new s([v|0],0>v?-1:0)}):new s([A|0],0>A?-1:0)}function l(A){if(isNaN(A)||!isFinite(A))return h;if(0>A)return S(l(-A));for(var v=[],C=1,w=0;A>=C;w++)v[w]=A/C|0,C*=4294967296;return new s(v,0)}function d(A,v){if(A.length==0)throw Error("number format error: empty string");if(v=v||10,2>v||36<v)throw Error("radix out of range: "+v);if(A.charAt(0)=="-")return S(d(A.substring(1),v));if(0<=A.indexOf("-"))throw Error('number format error: interior "-" character');for(var C=l(Math.pow(v,8)),w=h,N=0;N<A.length;N+=8){var L=Math.min(8,A.length-N),D=parseInt(A.substring(N,N+L),v);8>L?(L=l(Math.pow(v,L)),w=w.j(L).add(l(D))):(w=w.j(C),w=w.add(l(D)))}return w}var h=c(0),f=c(1),g=c(16777216);t=s.prototype,t.m=function(){if(I(this))return-S(this).m();for(var A=0,v=1,C=0;C<this.g.length;C++){var w=this.i(C);A+=(0<=w?w:4294967296+w)*v,v*=4294967296}return A},t.toString=function(A){if(A=A||10,2>A||36<A)throw Error("radix out of range: "+A);if(E(this))return"0";if(I(this))return"-"+S(this).toString(A);for(var v=l(Math.pow(A,6)),C=this,w="";;){var N=X(C,v).g;C=R(C,N.j(v));var L=((0<C.g.length?C.g[0]:C.h)>>>0).toString(A);if(C=N,E(C))return L+w;for(;6>L.length;)L="0"+L;w=L+w}},t.i=function(A){return 0>A?0:A<this.g.length?this.g[A]:this.h};function E(A){if(A.h!=0)return!1;for(var v=0;v<A.g.length;v++)if(A.g[v]!=0)return!1;return!0}function I(A){return A.h==-1}t.l=function(A){return A=R(this,A),I(A)?-1:E(A)?0:1};function S(A){for(var v=A.g.length,C=[],w=0;w<v;w++)C[w]=~A.g[w];return new s(C,~A.h).add(f)}t.abs=function(){return I(this)?S(this):this},t.add=function(A){for(var v=Math.max(this.g.length,A.g.length),C=[],w=0,N=0;N<=v;N++){var L=w+(this.i(N)&65535)+(A.i(N)&65535),D=(L>>>16)+(this.i(N)>>>16)+(A.i(N)>>>16);w=D>>>16,L&=65535,D&=65535,C[N]=D<<16|L}return new s(C,C[C.length-1]&-2147483648?-1:0)};function R(A,v){return A.add(S(v))}t.j=function(A){if(E(this)||E(A))return h;if(I(this))return I(A)?S(this).j(S(A)):S(S(this).j(A));if(I(A))return S(this.j(S(A)));if(0>this.l(g)&&0>A.l(g))return l(this.m()*A.m());for(var v=this.g.length+A.g.length,C=[],w=0;w<2*v;w++)C[w]=0;for(w=0;w<this.g.length;w++)for(var N=0;N<A.g.length;N++){var L=this.i(w)>>>16,D=this.i(w)&65535,Lr=A.i(N)>>>16,Jr=A.i(N)&65535;C[2*w+2*N]+=D*Jr,U(C,2*w+2*N),C[2*w+2*N+1]+=L*Jr,U(C,2*w+2*N+1),C[2*w+2*N+1]+=D*Lr,U(C,2*w+2*N+1),C[2*w+2*N+2]+=L*Lr,U(C,2*w+2*N+2)}for(w=0;w<v;w++)C[w]=C[2*w+1]<<16|C[2*w];for(w=v;w<2*v;w++)C[w]=0;return new s(C,0)};function U(A,v){for(;(A[v]&65535)!=A[v];)A[v+1]+=A[v]>>>16,A[v]&=65535,v++}function G(A,v){this.g=A,this.h=v}function X(A,v){if(E(v))throw Error("division by zero");if(E(A))return new G(h,h);if(I(A))return v=X(S(A),v),new G(S(v.g),S(v.h));if(I(v))return v=X(A,S(v)),new G(S(v.g),v.h);if(30<A.g.length){if(I(A)||I(v))throw Error("slowDivide_ only works with positive integers.");for(var C=f,w=v;0>=w.l(A);)C=ce(C),w=ce(w);var N=ne(C,1),L=ne(w,1);for(w=ne(w,2),C=ne(C,2);!E(w);){var D=L.add(w);0>=D.l(A)&&(N=N.add(C),L=D),w=ne(w,1),C=ne(C,1)}return v=R(A,N.j(v)),new G(N,v)}for(N=h;0<=A.l(v);){for(C=Math.max(1,Math.floor(A.m()/v.m())),w=Math.ceil(Math.log(C)/Math.LN2),w=48>=w?1:Math.pow(2,w-48),L=l(C),D=L.j(v);I(D)||0<D.l(A);)C-=w,L=l(C),D=L.j(v);E(L)&&(L=f),N=N.add(L),A=R(A,D)}return new G(N,A)}t.A=function(A){return X(this,A).h},t.and=function(A){for(var v=Math.max(this.g.length,A.g.length),C=[],w=0;w<v;w++)C[w]=this.i(w)&A.i(w);return new s(C,this.h&A.h)},t.or=function(A){for(var v=Math.max(this.g.length,A.g.length),C=[],w=0;w<v;w++)C[w]=this.i(w)|A.i(w);return new s(C,this.h|A.h)},t.xor=function(A){for(var v=Math.max(this.g.length,A.g.length),C=[],w=0;w<v;w++)C[w]=this.i(w)^A.i(w);return new s(C,this.h^A.h)};function ce(A){for(var v=A.g.length+1,C=[],w=0;w<v;w++)C[w]=A.i(w)<<1|A.i(w-1)>>>31;return new s(C,A.h)}function ne(A,v){var C=v>>5;v%=32;for(var w=A.g.length-C,N=[],L=0;L<w;L++)N[L]=0<v?A.i(L+C)>>>v|A.i(L+C+1)<<32-v:A.i(L+C);return new s(N,A.h)}r.prototype.digest=r.prototype.v,r.prototype.reset=r.prototype.s,r.prototype.update=r.prototype.u,Zw=M$.Md5=r,s.prototype.add=s.prototype.add,s.prototype.multiply=s.prototype.j,s.prototype.modulo=s.prototype.A,s.prototype.compare=s.prototype.l,s.prototype.toNumber=s.prototype.m,s.prototype.toString=s.prototype.toString,s.prototype.getBits=s.prototype.i,s.fromNumber=l,s.fromString=d,is=M$.Integer=s}).apply(typeof L$<"u"?L$:typeof self<"u"?self:typeof window<"u"?window:{});var DI=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},os={};var eO,Hse,jd,tO,Ag,RI,nO,rO,iO;(function(){var t,e=typeof Object.defineProperties=="function"?Object.defineProperty:function(u,p,m){return u==Array.prototype||u==Object.prototype||(u[p]=m.value),u};function n(u){u=[typeof globalThis=="object"&&globalThis,u,typeof window=="object"&&window,typeof self=="object"&&self,typeof DI=="object"&&DI];for(var p=0;p<u.length;++p){var m=u[p];if(m&&m.Math==Math)return m}throw Error("Cannot find global object")}var r=n(this);function i(u,p){if(p)e:{var m=r;u=u.split(".");for(var _=0;_<u.length-1;_++){var M=u[_];if(!(M in m))break e;m=m[M]}u=u[u.length-1],_=m[u],p=p(_),p!=_&&p!=null&&e(m,u,{configurable:!0,writable:!0,value:p})}}function o(u,p){u instanceof String&&(u+="");var m=0,_=!1,M={next:function(){if(!_&&m<u.length){var F=m++;return{value:p(F,u[F]),done:!1}}return _=!0,{done:!0,value:void 0}}};return M[Symbol.iterator]=function(){return M},M}i("Array.prototype.values",function(u){return u||function(){return o(this,function(p,m){return m})}});var s=s||{},a=this||self;function c(u){var p=typeof u;return p=p!="object"?p:u?Array.isArray(u)?"array":p:"null",p=="array"||p=="object"&&typeof u.length=="number"}function l(u){var p=typeof u;return p=="object"&&u!=null||p=="function"}function d(u,p,m){return u.call.apply(u.bind,arguments)}function h(u,p,m){if(!u)throw Error();if(2<arguments.length){var _=Array.prototype.slice.call(arguments,2);return function(){var M=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(M,_),u.apply(p,M)}}return function(){return u.apply(p,arguments)}}function f(u,p,m){return f=Function.prototype.bind&&Function.prototype.bind.toString().indexOf("native code")!=-1?d:h,f.apply(null,arguments)}function g(u,p){var m=Array.prototype.slice.call(arguments,1);return function(){var _=m.slice();return _.push.apply(_,arguments),u.apply(this,_)}}function E(u,p){function m(){}m.prototype=p.prototype,u.aa=p.prototype,u.prototype=new m,u.prototype.constructor=u,u.Qb=function(_,M,F){for(var J=Array(arguments.length-2),ot=2;ot<arguments.length;ot++)J[ot-2]=arguments[ot];return p.prototype[M].apply(_,J)}}function I(u){let p=u.length;if(0<p){let m=Array(p);for(let _=0;_<p;_++)m[_]=u[_];return m}return[]}function S(u,p){for(let m=1;m<arguments.length;m++){let _=arguments[m];if(c(_)){let M=u.length||0,F=_.length||0;u.length=M+F;for(let J=0;J<F;J++)u[M+J]=_[J]}else u.push(_)}}class R{constructor(p,m){this.i=p,this.j=m,this.h=0,this.g=null}get(){let p;return 0<this.h?(this.h--,p=this.g,this.g=p.next,p.next=null):p=this.i(),p}}function U(u){return/^[\s\xa0]*$/.test(u)}function G(){var u=a.navigator;return u&&(u=u.userAgent)?u:""}function X(u){return X[" "](u),u}X[" "]=function(){};var ce=G().indexOf("Gecko")!=-1&&!(G().toLowerCase().indexOf("webkit")!=-1&&G().indexOf("Edge")==-1)&&!(G().indexOf("Trident")!=-1||G().indexOf("MSIE")!=-1)&&G().indexOf("Edge")==-1;function ne(u,p,m){for(let _ in u)p.call(m,u[_],_,u)}function A(u,p){for(let m in u)p.call(void 0,u[m],m,u)}function v(u){let p={};for(let m in u)p[m]=u[m];return p}let C="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function w(u,p){let m,_;for(let M=1;M<arguments.length;M++){_=arguments[M];for(m in _)u[m]=_[m];for(let F=0;F<C.length;F++)m=C[F],Object.prototype.hasOwnProperty.call(_,m)&&(u[m]=_[m])}}function N(u){var p=1;u=u.split(":");let m=[];for(;0<p&&u.length;)m.push(u.shift()),p--;return u.length&&m.push(u.join(":")),m}function L(u){a.setTimeout(()=>{throw u},0)}function D(){var u=Ph;let p=null;return u.g&&(p=u.g,u.g=u.g.next,u.g||(u.h=null),p.next=null),p}class Lr{constructor(){this.h=this.g=null}add(p,m){let _=Jr.get();_.set(p,m),this.h?this.h.next=_:this.g=_,this.h=_}}var Jr=new R(()=>new Sm,u=>u.reset());class Sm{constructor(){this.next=this.g=this.h=null}set(p,m){this.h=p,this.g=m,this.next=null}reset(){this.next=this.g=this.h=null}}let Mr,xa=!1,Ph=new Lr,ka=()=>{let u=a.Promise.resolve(void 0);Mr=()=>{u.then(xh)}};var xh=()=>{for(var u;u=D();){try{u.h.call(u.g)}catch(m){L(m)}var p=Jr;p.j(u),100>p.h&&(p.h++,u.next=p.g,p.g=u)}xa=!1};function Zr(){this.s=this.s,this.C=this.C}Zr.prototype.s=!1,Zr.prototype.ma=function(){this.s||(this.s=!0,this.N())},Zr.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()};function nn(u,p){this.type=u,this.g=this.target=p,this.defaultPrevented=!1}nn.prototype.h=function(){this.defaultPrevented=!0};var rS=(function(){if(!a.addEventListener||!Object.defineProperty)return!1;var u=!1,p=Object.defineProperty({},"passive",{get:function(){u=!0}});try{let m=()=>{};a.addEventListener("test",m,p),a.removeEventListener("test",m,p)}catch{}return u})();function Fa(u,p){if(nn.call(this,u?u.type:""),this.relatedTarget=this.g=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.pointerId=0,this.pointerType="",this.i=null,u){var m=this.type=u.type,_=u.changedTouches&&u.changedTouches.length?u.changedTouches[0]:null;if(this.target=u.target||u.srcElement,this.g=p,p=u.relatedTarget){if(ce){e:{try{X(p.nodeName);var M=!0;break e}catch{}M=!1}M||(p=null)}}else m=="mouseover"?p=u.fromElement:m=="mouseout"&&(p=u.toElement);this.relatedTarget=p,_?(this.clientX=_.clientX!==void 0?_.clientX:_.pageX,this.clientY=_.clientY!==void 0?_.clientY:_.pageY,this.screenX=_.screenX||0,this.screenY=_.screenY||0):(this.clientX=u.clientX!==void 0?u.clientX:u.pageX,this.clientY=u.clientY!==void 0?u.clientY:u.pageY,this.screenX=u.screenX||0,this.screenY=u.screenY||0),this.button=u.button,this.key=u.key||"",this.ctrlKey=u.ctrlKey,this.altKey=u.altKey,this.shiftKey=u.shiftKey,this.metaKey=u.metaKey,this.pointerId=u.pointerId||0,this.pointerType=typeof u.pointerType=="string"?u.pointerType:rt[u.pointerType]||"",this.state=u.state,this.i=u,u.defaultPrevented&&Fa.aa.h.call(this)}}E(Fa,nn);var rt={2:"touch",3:"pen",4:"mouse"};Fa.prototype.h=function(){Fa.aa.h.call(this);var u=this.i;u.preventDefault?u.preventDefault():u.returnValue=!1};var Ua="closure_listenable_"+(1e6*Math.random()|0),iS=0;function oS(u,p,m,_,M){this.listener=u,this.proxy=null,this.src=p,this.type=m,this.capture=!!_,this.ha=M,this.key=++iS,this.da=this.fa=!1}function ql(u){u.da=!0,u.listener=null,u.proxy=null,u.src=null,u.ha=null}function Kl(u){this.src=u,this.g={},this.h=0}Kl.prototype.add=function(u,p,m,_,M){var F=u.toString();u=this.g[F],u||(u=this.g[F]=[],this.h++);var J=Yl(u,p,_,M);return-1<J?(p=u[J],m||(p.fa=!1)):(p=new oS(p,this.src,F,!!_,M),p.fa=m,u.push(p)),p};function kh(u,p){var m=p.type;if(m in u.g){var _=u.g[m],M=Array.prototype.indexOf.call(_,p,void 0),F;(F=0<=M)&&Array.prototype.splice.call(_,M,1),F&&(ql(p),u.g[m].length==0&&(delete u.g[m],u.h--))}}function Yl(u,p,m,_){for(var M=0;M<u.length;++M){var F=u[M];if(!F.da&&F.listener==p&&F.capture==!!m&&F.ha==_)return M}return-1}var Fh="closure_lm_"+(1e6*Math.random()|0),Xl={};function it(u,p,m,_,M){if(_&&_.once)return Jl(u,p,m,_,M);if(Array.isArray(p)){for(var F=0;F<p.length;F++)it(u,p[F],m,_,M);return null}return m=eu(m),u&&u[Ua]?u.K(p,m,l(_)?!!_.capture:!!_,M):Ql(u,p,m,!1,_,M)}function Ql(u,p,m,_,M,F){if(!p)throw Error("Invalid event type");var J=l(M)?!!M.capture:!!M,ot=Zl(u);if(ot||(u[Fh]=ot=new Kl(u)),m=ot.add(p,m,_,J,F),m.proxy)return m;if(_=ut(),m.proxy=_,_.src=u,_.listener=m,u.addEventListener)rS||(M=J),M===void 0&&(M=!1),u.addEventListener(p.toString(),_,M);else if(u.attachEvent)u.attachEvent(Uh(p.toString()),_);else if(u.addListener&&u.removeListener)u.addListener(_);else throw Error("addEventListener and attachEvent are unavailable.");return m}function ut(){function u(m){return p.call(u.src,u.listener,m)}let p=wi;return u}function Jl(u,p,m,_,M){if(Array.isArray(p)){for(var F=0;F<p.length;F++)Jl(u,p[F],m,_,M);return null}return m=eu(m),u&&u[Ua]?u.L(p,m,l(_)?!!_.capture:!!_,M):Ql(u,p,m,!0,_,M)}function ur(u,p,m,_,M){if(Array.isArray(p))for(var F=0;F<p.length;F++)ur(u,p[F],m,_,M);else _=l(_)?!!_.capture:!!_,m=eu(m),u&&u[Ua]?(u=u.i,p=String(p).toString(),p in u.g&&(F=u.g[p],m=Yl(F,m,_,M),-1<m&&(ql(F[m]),Array.prototype.splice.call(F,m,1),F.length==0&&(delete u.g[p],u.h--)))):u&&(u=Zl(u))&&(p=u.g[p.toString()],u=-1,p&&(u=Yl(p,m,_,M)),(m=-1<u?p[u]:null)&&So(m))}function So(u){if(typeof u!="number"&&u&&!u.da){var p=u.src;if(p&&p[Ua])kh(p.i,u);else{var m=u.type,_=u.proxy;p.removeEventListener?p.removeEventListener(m,_,u.capture):p.detachEvent?p.detachEvent(Uh(m),_):p.addListener&&p.removeListener&&p.removeListener(_),(m=Zl(p))?(kh(m,u),m.h==0&&(m.src=null,p[Fh]=null)):ql(u)}}}function Uh(u){return u in Xl?Xl[u]:Xl[u]="on"+u}function wi(u,p){if(u.da)u=!0;else{p=new Fa(p,this);var m=u.listener,_=u.ha||u.src;u.fa&&So(u),u=m.call(_,p)}return u}function Zl(u){return u=u[Fh],u instanceof Kl?u:null}var Va="__closure_events_fn_"+(1e9*Math.random()>>>0);function eu(u){return typeof u=="function"?u:(u[Va]||(u[Va]=function(p){return u.handleEvent(p)}),u[Va])}function Ot(){Zr.call(this),this.i=new Kl(this),this.M=this,this.F=null}E(Ot,Zr),Ot.prototype[Ua]=!0,Ot.prototype.removeEventListener=function(u,p,m,_){ur(this,u,p,m,_)};function ht(u,p){var m,_=u.F;if(_)for(m=[];_;_=_.F)m.push(_);if(u=u.M,_=p.type||p,typeof p=="string")p=new nn(p,u);else if(p instanceof nn)p.target=p.target||u;else{var M=p;p=new nn(_,u),w(p,M)}if(M=!0,m)for(var F=m.length-1;0<=F;F--){var J=p.g=m[F];M=Pr(J,_,!0,p)&&M}if(J=p.g=u,M=Pr(J,_,!0,p)&&M,M=Pr(J,_,!1,p)&&M,m)for(F=0;F<m.length;F++)J=p.g=m[F],M=Pr(J,_,!1,p)&&M}Ot.prototype.N=function(){if(Ot.aa.N.call(this),this.i){var u=this.i,p;for(p in u.g){for(var m=u.g[p],_=0;_<m.length;_++)ql(m[_]);delete u.g[p],u.h--}}this.F=null},Ot.prototype.K=function(u,p,m,_){return this.i.add(String(u),p,!1,m,_)},Ot.prototype.L=function(u,p,m,_){return this.i.add(String(u),p,!0,m,_)};function Pr(u,p,m,_){if(p=u.i.g[String(p)],!p)return!0;p=p.concat();for(var M=!0,F=0;F<p.length;++F){var J=p[F];if(J&&!J.da&&J.capture==m){var ot=J.listener,En=J.ha||J.src;J.fa&&kh(u.i,J),M=ot.call(En,_)!==!1&&M}}return M&&!_.defaultPrevented}function Oi(u,p,m){if(typeof u=="function")m&&(u=f(u,m));else if(u&&typeof u.handleEvent=="function")u=f(u.handleEvent,u);else throw Error("Invalid listener argument");return 2147483647<Number(p)?-1:a.setTimeout(u,p||0)}function tu(u){u.g=Oi(()=>{u.g=null,u.i&&(u.i=!1,tu(u))},u.l);let p=u.h;u.h=null,u.m.apply(null,p)}class nu extends Zr{constructor(p,m){super(),this.m=p,this.l=m,this.h=null,this.i=!1,this.g=null}j(p){this.h=arguments,this.g?this.i=!0:tu(this)}N(){super.N(),this.g&&(a.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function Li(u){Zr.call(this),this.h=u,this.g={}}E(Li,Zr);var ru=[];function Ao(u){ne(u.g,function(p,m){this.g.hasOwnProperty(m)&&So(p)},u),u.g={}}Li.prototype.N=function(){Li.aa.N.call(this),Ao(this)},Li.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var hs=a.JSON.stringify,iu=a.JSON.parse,Am=class{stringify(u){return a.JSON.stringify(u,void 0)}parse(u){return a.JSON.parse(u,void 0)}};function ou(){}ou.prototype.h=null;function Vh(u){return u.h||(u.h=u.i())}function su(){}var Co={OPEN:"a",kb:"b",Ja:"c",wb:"d"};function ei(){nn.call(this,"d")}E(ei,nn);function Mi(){nn.call(this,"c")}E(Mi,nn);var jn={},Bh=null;function Ba(){return Bh=Bh||new Ot}jn.La="serverreachability";function Gh(u){nn.call(this,jn.La,u)}E(Gh,nn);function fs(u){let p=Ba();ht(p,new Gh(p))}jn.STAT_EVENT="statevent";function jh(u,p){nn.call(this,jn.STAT_EVENT,u),this.stat=p}E(jh,nn);function Lt(u){let p=Ba();ht(p,new jh(p,u))}jn.Ma="timingevent";function Ga(u,p){nn.call(this,jn.Ma,u),this.size=p}E(Ga,nn);function Cn(u,p){if(typeof u!="function")throw Error("Fn must not be null and must be a function");return a.setTimeout(function(){u()},p)}function xr(){this.g=!0}xr.prototype.xa=function(){this.g=!1};function Hh(u,p,m,_,M,F){u.info(function(){if(u.g)if(F)for(var J="",ot=F.split("&"),En=0;En<ot.length;En++){var Ve=ot[En].split("=");if(1<Ve.length){var Dn=Ve[0];Ve=Ve[1];var Rn=Dn.split("_");J=2<=Rn.length&&Rn[1]=="type"?J+(Dn+"="+Ve+"&"):J+(Dn+"=redacted&")}}else J=null;else J=F;return"XMLHTTP REQ ("+_+") [attempt "+M+"]: "+p+`
|