@usesuperflow/toolbar-staging 1.0.807 → 1.0.808
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/package.json +1 -1
- package/superflow.js +8 -7
- package/superflow.min.js +8 -7
package/superflow.min.js
CHANGED
|
@@ -68,7 +68,7 @@ const lt=1,ct=2,dt=t=>(...e)=>({_$litDirective$:t,values:e});class ht{constructo
|
|
|
68
68
|
* @license
|
|
69
69
|
* Copyright 2017 Google LLC
|
|
70
70
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
71
|
-
*/class pt extends ht{constructor(t){if(super(t),this.it=D,t.type!==ct)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===D||null==t)return this.ft=void 0,this.it=t;if(t===P)return t;if("string"!=typeof t)throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this.ft;this.it=t;const e=[t];return e.raw=e,this.ft={_$litType$:this.constructor.resultType,strings:e,values:[]}}}pt.directiveName="unsafeHTML",pt.resultType=1;const vt=dt(pt);class gt{}gt.Events={GUEST_MODE_SIGN_IN_DIALOG_SHOWN:"guestModeSignInDialogShown",GUEST_MODE_NAME_DIALOG_SHOWN:"guestModeNameDialogShown",GUEST_MODE_SIGN_IN_BANNER_SHOWN:"guestModeSignInBannerShown",GUEST_MODE_SIGN_IN_BUTTON_CLICKED:"guestModeSignInButtonClicked",PASSWORD_PROTECTED_MODAL_CLOSE_BUTTON_CLICKED:"passwordProtectedModalCloseButtonClicked",PASSWORD_PROTECTED_MODAL_OPEN_BUTTON_CLICKED:"passwordProtectedModalOpenButtonClicked",TOOLBAR_EXPANDED:"toolbarExpanded",TOOLBAR_COLLAPSED:"toolbarCollapsed",TOOLBAR_NOTIFICATION_CLICKED:"toolbarNotificationClicked",GUEST_MODE_SKIP_BUTTON_CLICKED:"guestModeSkipButtonClicked",GUEST_MODE_SIGN_IN_NUDGE_SHOWN:"guestModeSignInNudgeShown",GUEST_MODE_NAME_NUDGE_SHOWN:"guestModeNameNudgeShown",GUEST_MODE_SIGN_IN_CLICKED:"guestModeSignInClicked",GUEST_MODE_PRESENT:"guestModePresent",GUEST_MODE_NAME_ADDED:"guestModeNameAdded",REVIEW_PASSWORD_ADDED:"reviewPasswordAdded",REVIEW_PASSWORD_REJECTED:"reviewPasswordRejected",REVIEW_PASSWORD_ACCEPTED:"reviewPasswordAccepted",PRIVATE_MODE_ENABLED:"privateModeEnabled",PRIVATE_MODE_DISABLED:"privateModeDisabled",VISIBILITY_OPTIONS_ENABLED:"visibilityOptionsEnabled",VISIBILITY_OPTIONS_DISABLED:"visibilityOptionsDisabled",VIEW_PROJECT_CLICKED:"viewProjectClicked",REPORT_BUG_CLICKED:"reportBugClicked",REPORT_BUG_SUBMITTED:"reportBugSubmitted",OPEN_MOBILE_CLICKED:"openMobileClicked",EXIT_REVIEW_MODE_CLICKED:"exitReviewModeClicked",SIGNOUT_CLICKED:"signoutClicked",SIGNIN_CLICKED:"signinClicked",SIGN_IN_REQUIRED:"signInRequired",USER_EMAIL_NOT_WHITELISTED:"userEmailNotWhitelisted",DOMAIN_NOT_WHITELISTED:"domainNotWhitelisted",DUPLICATE_SCRIPT_INSTALLED:"duplicateScriptInstalled",TOOLBAR_DISABLED:"toolbarDisabled",INVITE_MODAL_OPENED:"inviteModalOpened",INVITE_SENT:"inviteSent",QUALITY_CHECK_RUN_TOOLBAR_CLICKED:"qualityCheckRunFromToolbarClicked",REQUEST_MODE_LOADED:"requestModeLoaded",REQUEST_ADDED:"requestAdded",REQUEST_MODE_SIGN_IN_CLICKED:"requestModeSignInClicked",REQUEST_MODE_OPENED:"requestModeOpened"};const ft="1.0.806",mt="6.0.45",wt="6.0.45",yt="Superflow Organization",bt=["v3ogId1G43AFHehEOewv","rNYzMJd13L27xtfipmSK","aU1MxKP0rca2UXwKi8bl"],Ct=["ockkGlKLaApkEOBShhbR"],Et="sfSidebarV2Enabled",xt="sfUseProxy",kt=["v3ogId1G43AFHehEOewv"],St=[],Mt="review",At="feedback",Tt="sembed",It="scommentmode",_t="sreadonly",$t="sagentcomments",Ot="spath",Nt="sonboarding",Lt="sagentstatus",Rt="sagentsidebar",Pt="Running checks",Dt="sf-onboarding-agent-status",Ft="sf-onboarding-ready",Vt="sf-onboarding-diagnostics-request",jt="sf-onboarding-diagnostics",Ut=3e5,Bt=["failed","systemError","error"],zt={SDK_NOT_READY:"sdk-not-ready",SDK_RETURNED_NULL:"sdk-returned-null",FETCH_THREW:"fetch-threw"},Ht="sfOnboardingSidebarDismissed",qt="sfOnboardingAgentsSidebar",Gt="Unknown Agent",Wt=[{hostSuffix:"cloudfunctions.net",pathPrefix:"/previewproxy"},{hostSuffix:"api.velt.dev",pathPrefix:"/previewproxy"}],Zt=["superflow-preview.com","stg.superflow-preview.com"],Kt=/^[a-z2-7]+-[a-z2-7]{16}$/,Yt="sf-preview-navigate",Jt="sf-preview-show-comment",Qt=1e4,Xt="sf-preview-location",te="sf-preview-leaving",ee="sfPageCommentsHidden",ie="sreviewId",ne="scommentId",oe="snippyly-user",re="st",se="_sfut",ae="_sfuc",le=6e4,ce="_sfgut",de="sfGuestMigrationRefused",he="projectVersionKey",ue="projectVersion",pe="sversion",ve="sprojectInstall",ge="sflivedemo",fe="sffigmademo",me=[Mt,At,ie,ne,ve,ge],we="srender",ye="sfTourCommentTooltip",be="sfUserAdmin",Ce="sfGuestMode",Ee="sfPasswordProtected",xe="sfQueryParamsComments",ke="sfUsePageTitleAsLocationName",Se="sfPasswordIsValid",Me="sfPrivateMode",Ae="organizationPrivate",Te="sfGuestModeAllowSignIn",Ie="sfGuestUserModelOpened",_e="sfGuestUserNameUpdated",$e="sfGuestUserBannerOpened",Oe="sfCustomerMetadata",Ne="sfContentWarningSidebarOpen",Le={LOADING:"loading",RUNNING:"running",FINDINGS:"findings",CLEAN:"clean",IDLE:"idle"},Re={QA_AGENTS:"QA Agents",LOADING:"Running QA Agents",RUNNING:"Running",RUNNING_SINGLE:"Running 1 QA Agent",FINDING_SINGLE:"1 Agent Finding",FINDINGS:"Agent Findings",NO_FINDINGS_FOUND:"No Findings"},Pe="sfNativeScreenshotPermission",De="sfSamlConfig",Fe=[{hostSuffix:"drive.usesuperflow.com",pathPrefix:"/"},{hostSuffix:"superflow-file-viewer-staging.web.app",pathPrefix:"/"},{hostSuffix:"app.usesuperflow.com",pathPrefix:"/drive"},{hostSuffix:"superflow-portal-v2-staging.firebaseapp.com",pathPrefix:"/drive"},{hostSuffix:"superflow-portal-v2-staging.web.app",pathPrefix:"/drive"},{hostSuffix:"superflow-portal-v2-prod.firebaseapp.com",pathPrefix:"/drive"},{hostSuffix:"superflow-portal-v2-prod.web.app",pathPrefix:"/drive"}],Ve=["app.usesuperflow.com","superflow-portal-v2-staging.firebaseapp.com"],je="suggestion",Ue={AGENT:"agent:",AGENT_TYPE_CUSTOM:"agentType:custom"},Be={SPELL_CHECK:"spell-check",BROKEN_LINKS:"broken-links",GRAMMAR_CHECK:"grammar-check"},ze={VELT_ROOT:"velt-root",VELT_PRESENCE:"velt-presence",VELT_CURSOR:"velt-cursor",VELT_COMMENT_TOOL:"velt-comment-tool",VELT_COMMENTS:"velt-comments",SNIPPYLY_TEXT_HIGHLIGHT:"snippyly-text-highlight",VELT_COMMENTS_SIDEBAR_LEGACY:"velt-comments-sidebar",VELT_COMMENTS_SIDEBAR_V2:"velt-comments-sidebar-v2",VELT_HUDDLE:"velt-huddle",VELT_RECORDER_NOTES:"velt-recorder-notes",VELT_RECORDER_CONTROL_PANEL:"velt-recorder-control-panel",VELT_ARROWS:"velt-arrows",VELT_NOTIFICATIONS_HISTORY_PANEL:"velt-notifications-history-panel"},He={ENABLE_URL_NAVIGATION:"enable-url-navigation",URL_NAVIGATION:"url-navigation",CURRENT_LOCATION_SUFFIX:"current-location-suffix",SIDEBAR_BUTTON_COUNT_TYPE:"sidebar-button-count-type",CUSTOM_ACTIONS:"custom-actions"},qe="filter",Ge={customBranding:{logo:{logoMark:{lightUrl:'\n\t\t\t\t<svg viewBox="0 0 49 48" fill="none" xmlns="http://www.w3.org/2000/svg">\n\t\t\t\t\t<path d="M8 8C8 3.58172 11.5817 0 16 0V0C20.4183 0 24 3.58172 24 8V16H16C11.5817 16 8 12.4183 8 8V8Z" fill="#FFCD2E"/>\n\t\t\t\t\t<path d="M0 29C0 22.3726 5.37258 17 12 17H24V29C24 35.6274 18.6274 41 12 41V41C5.37258 41 0 35.6274 0 29V29Z" fill="#A259FE"/>\n\t\t\t\t\t<path d="M25 19C25 12.3726 30.3726 7 37 7V7C43.6274 7 49 12.3726 49 19V19C49 25.6274 43.6274 31 37 31H25V19Z" fill="#FF7162"/>\n\t\t\t\t\t<path d="M25 32H33C37.4183 32 41 35.5817 41 40V40C41 44.4183 37.4183 48 33 48V48C28.5817 48 25 44.4183 25 40V32Z" fill="#0DCF82"/>\n\t\t\t\t</svg>\n\t\t\t\t',darkUrl:'\n\t\t\t\t<svg viewBox="0 0 49 48" fill="none" xmlns="http://www.w3.org/2000/svg">\n\t\t\t\t\t<path d="M8 8C8 3.58172 11.5817 0 16 0V0C20.4183 0 24 3.58172 24 8V16H16C11.5817 16 8 12.4183 8 8V8Z" fill="#FFCD2E"/>\n\t\t\t\t\t<path d="M0 29C0 22.3726 5.37258 17 12 17H24V29C24 35.6274 18.6274 41 12 41V41C5.37258 41 0 35.6274 0 29V29Z" fill="#A259FE"/>\n\t\t\t\t\t<path d="M25 19C25 12.3726 30.3726 7 37 7V7C43.6274 7 49 12.3726 49 19V19C49 25.6274 43.6274 31 37 31H25V19Z" fill="#FF7162"/>\n\t\t\t\t\t<path d="M25 32H33C37.4183 32 41 35.5817 41 40V40C41 44.4183 37.4183 48 33 48V48C28.5817 48 25 44.4183 25 40V32Z" fill="#0DCF82"/>\n\t\t\t\t</svg>\n\t\t\t\t'},wordMark:{lightUrl:'\n\t\t\t\t<svg width="257" height="65" viewBox="0 0 257 65" fill="none" xmlns="http://www.w3.org/2000/svg">\n\t\t\t\t\t<path d="M8 16C8 11.5817 11.5817 8 16 8V8C20.4183 8 24 11.5817 24 16V24H16C11.5817 24 8 20.4183 8 16V16Z" fill="#FFCD2E"/>\n\t\t\t\t\t<path d="M0 37C0 30.3726 5.37258 25 12 25H24V37C24 43.6274 18.6274 49 12 49V49C5.37258 49 0 43.6274 0 37V37Z" fill="#A259FE"/>\n\t\t\t\t\t<path d="M25 27C25 20.3726 30.3726 15 37 15V15C43.6274 15 49 20.3726 49 27V27C49 33.6274 43.6274 39 37 39H25V27Z" fill="#FF7162"/>\n\t\t\t\t\t<path d="M25 40H33C37.4183 40 41 43.5817 41 48V48C41 52.4183 37.4183 56 33 56V56C28.5817 56 25 52.4183 25 48V40Z" fill="#0DCF82"/>\n\t\t\t\t\t<path d="M73.4 46.28C71.4533 46.28 69.6933 45.9467 68.12 45.28C66.5733 44.6133 65.3467 43.6533 64.44 42.4C63.5333 41.1467 63.0667 39.6667 63.04 37.96H69.04C69.12 39.1067 69.52 40.0133 70.24 40.68C70.9867 41.3467 72 41.68 73.28 41.68C74.5867 41.68 75.6133 41.3733 76.36 40.76C77.1067 40.12 77.48 39.2933 77.48 38.28C77.48 37.4533 77.2267 36.7733 76.72 36.24C76.2133 35.7067 75.5733 35.2933 74.8 35C74.0533 34.68 73.0133 34.3333 71.68 33.96C69.8667 33.4267 68.3867 32.9067 67.24 32.4C66.12 31.8667 65.1467 31.08 64.32 30.04C63.52 28.9733 63.12 27.56 63.12 25.8C63.12 24.1467 63.5333 22.7067 64.36 21.48C65.1867 20.2533 66.3467 19.32 67.84 18.68C69.3333 18.0133 71.04 17.68 72.96 17.68C75.84 17.68 78.1733 18.3867 79.96 19.8C81.7733 21.1867 82.7733 23.1333 82.96 25.64H76.8C76.7467 24.68 76.3333 23.8933 75.56 23.28C74.8133 22.64 73.8133 22.32 72.56 22.32C71.4667 22.32 70.5867 22.6 69.92 23.16C69.28 23.72 68.96 24.5333 68.96 25.6C68.96 26.3467 69.2 26.9733 69.68 27.48C70.1867 27.96 70.8 28.36 71.52 28.68C72.2667 28.9733 73.3067 29.32 74.64 29.72C76.4533 30.2533 77.9333 30.7867 79.08 31.32C80.2267 31.8533 81.2133 32.6533 82.04 33.72C82.8667 34.7867 83.28 36.1867 83.28 37.92C83.28 39.4133 82.8933 40.8 82.12 42.08C81.3467 43.36 80.2133 44.3867 78.72 45.16C77.2267 45.9067 75.4533 46.28 73.4 46.28ZM107.855 23.84V46H102.215V43.2C101.495 44.16 100.548 44.92 99.375 45.48C98.2283 46.0133 96.975 46.28 95.615 46.28C93.8817 46.28 92.3483 45.92 91.015 45.2C89.6817 44.4533 88.6283 43.3733 87.855 41.96C87.1083 40.52 86.735 38.8133 86.735 36.84V23.84H92.335V36.04C92.335 37.8 92.775 39.16 93.655 40.12C94.535 41.0533 95.735 41.52 97.255 41.52C98.8017 41.52 100.015 41.0533 100.895 40.12C101.775 39.16 102.215 37.8 102.215 36.04V23.84H107.855ZM116.98 27.04C117.7 26.0267 118.687 25.1867 119.94 24.52C121.22 23.8267 122.674 23.48 124.3 23.48C126.194 23.48 127.9 23.9467 129.42 24.88C130.967 25.8133 132.18 27.1467 133.06 28.88C133.967 30.5867 134.42 32.5733 134.42 34.84C134.42 37.1067 133.967 39.12 133.06 40.88C132.18 42.6133 130.967 43.96 129.42 44.92C127.9 45.88 126.194 46.36 124.3 46.36C122.674 46.36 121.234 46.0267 119.98 45.36C118.754 44.6933 117.754 43.8533 116.98 42.84V56.56H111.38V23.84H116.98V27.04ZM128.7 34.84C128.7 33.5067 128.42 32.36 127.86 31.4C127.327 30.4133 126.607 29.6667 125.7 29.16C124.82 28.6533 123.86 28.4 122.82 28.4C121.807 28.4 120.847 28.6667 119.94 29.2C119.06 29.7067 118.34 30.4533 117.78 31.44C117.247 32.4267 116.98 33.5867 116.98 34.92C116.98 36.2533 117.247 37.4133 117.78 38.4C118.34 39.3867 119.06 40.1467 119.94 40.68C120.847 41.1867 121.807 41.44 122.82 41.44C123.86 41.44 124.82 41.1733 125.7 40.64C126.607 40.1067 127.327 39.3467 127.86 38.36C128.42 37.3733 128.7 36.2 128.7 34.84ZM158.29 34.44C158.29 35.24 158.236 35.96 158.13 36.6H141.93C142.063 38.2 142.623 39.4533 143.61 40.36C144.596 41.2667 145.81 41.72 147.25 41.72C149.33 41.72 150.81 40.8267 151.69 39.04H157.73C157.09 41.1733 155.863 42.9333 154.05 44.32C152.236 45.68 150.01 46.36 147.37 46.36C145.236 46.36 143.316 45.8933 141.61 44.96C139.93 44 138.61 42.6533 137.65 40.92C136.716 39.1867 136.25 37.1867 136.25 34.92C136.25 32.6267 136.716 30.6133 137.65 28.88C138.583 27.1467 139.89 25.8133 141.57 24.88C143.25 23.9467 145.183 23.48 147.37 23.48C149.476 23.48 151.356 23.9333 153.01 24.84C154.69 25.7467 155.983 27.04 156.89 28.72C157.823 30.3733 158.29 32.28 158.29 34.44ZM152.49 32.84C152.463 31.4 151.943 30.2533 150.93 29.4C149.916 28.52 148.676 28.08 147.21 28.08C145.823 28.08 144.65 28.5067 143.69 29.36C142.756 30.1867 142.183 31.3467 141.97 32.84H152.49ZM167.177 27.28C167.897 26.1067 168.831 25.1867 169.977 24.52C171.151 23.8533 172.484 23.52 173.977 23.52V29.4H172.497C170.737 29.4 169.404 29.8133 168.497 30.64C167.617 31.4667 167.177 32.9067 167.177 34.96V46H161.577V23.84H167.177V27.28ZM188.309 28.44H184.429V46H178.749V28.44H176.229V23.84H178.749V22.72C178.749 20 179.522 18 181.069 16.72C182.616 15.44 184.949 14.84 188.069 14.92V19.64C186.709 19.6133 185.762 19.84 185.229 20.32C184.696 20.8 184.429 21.6667 184.429 22.92V23.84H188.309V28.44ZM197.538 16.4V46H191.938V16.4H197.538ZM211.711 46.36C209.578 46.36 207.658 45.8933 205.951 44.96C204.244 44 202.898 42.6533 201.911 40.92C200.951 39.1867 200.471 37.1867 200.471 34.92C200.471 32.6533 200.964 30.6533 201.951 28.92C202.964 27.1867 204.338 25.8533 206.071 24.92C207.804 23.96 209.738 23.48 211.871 23.48C214.004 23.48 215.938 23.96 217.671 24.92C219.404 25.8533 220.764 27.1867 221.751 28.92C222.764 30.6533 223.271 32.6533 223.271 34.92C223.271 37.1867 222.751 39.1867 221.711 40.92C220.698 42.6533 219.311 44 217.551 44.96C215.818 45.8933 213.871 46.36 211.711 46.36ZM211.711 41.48C212.724 41.48 213.671 41.24 214.551 40.76C215.458 40.2533 216.178 39.5067 216.711 38.52C217.244 37.5333 217.511 36.3333 217.511 34.92C217.511 32.8133 216.951 31.2 215.831 30.08C214.738 28.9333 213.391 28.36 211.791 28.36C210.191 28.36 208.844 28.9333 207.751 30.08C206.684 31.2 206.151 32.8133 206.151 34.92C206.151 37.0267 206.671 38.6533 207.711 39.8C208.778 40.92 210.111 41.48 211.711 41.48ZM256.499 23.84L250.019 46H243.979L239.939 30.52L235.899 46H229.819L223.299 23.84H228.979L232.899 40.72L237.139 23.84H243.059L247.219 40.68L251.139 23.84H256.499Z" fill="#141416"/>\n\t\t\t\t</svg>\n\t\t\t\t',darkUrl:'\n\t\t\t\t<svg width="257" height="65" viewBox="0 0 257 65" fill="none" xmlns="http://www.w3.org/2000/svg">\n\t\t\t\t\t<path d="M8 16C8 11.5817 11.5817 8 16 8V8C20.4183 8 24 11.5817 24 16V24H16C11.5817 24 8 20.4183 8 16V16Z" fill="#FFCD2E"/>\n\t\t\t\t\t<path d="M0 37C0 30.3726 5.37258 25 12 25H24V37C24 43.6274 18.6274 49 12 49V49C5.37258 49 0 43.6274 0 37V37Z" fill="#A259FE"/>\n\t\t\t\t\t<path d="M25 27C25 20.3726 30.3726 15 37 15V15C43.6274 15 49 20.3726 49 27V27C49 33.6274 43.6274 39 37 39H25V27Z" fill="#FF7162"/>\n\t\t\t\t\t<path d="M25 40H33C37.4183 40 41 43.5817 41 48V48C41 52.4183 37.4183 56 33 56V56C28.5817 56 25 52.4183 25 48V40Z" fill="#0DCF82"/>\n\t\t\t\t\t<path d="M73.4 46.28C71.4533 46.28 69.6933 45.9467 68.12 45.28C66.5733 44.6133 65.3467 43.6533 64.44 42.4C63.5333 41.1467 63.0667 39.6667 63.04 37.96H69.04C69.12 39.1067 69.52 40.0133 70.24 40.68C70.9867 41.3467 72 41.68 73.28 41.68C74.5867 41.68 75.6133 41.3733 76.36 40.76C77.1067 40.12 77.48 39.2933 77.48 38.28C77.48 37.4533 77.2267 36.7733 76.72 36.24C76.2133 35.7067 75.5733 35.2933 74.8 35C74.0533 34.68 73.0133 34.3333 71.68 33.96C69.8667 33.4267 68.3867 32.9067 67.24 32.4C66.12 31.8667 65.1467 31.08 64.32 30.04C63.52 28.9733 63.12 27.56 63.12 25.8C63.12 24.1467 63.5333 22.7067 64.36 21.48C65.1867 20.2533 66.3467 19.32 67.84 18.68C69.3333 18.0133 71.04 17.68 72.96 17.68C75.84 17.68 78.1733 18.3867 79.96 19.8C81.7733 21.1867 82.7733 23.1333 82.96 25.64H76.8C76.7467 24.68 76.3333 23.8933 75.56 23.28C74.8133 22.64 73.8133 22.32 72.56 22.32C71.4667 22.32 70.5867 22.6 69.92 23.16C69.28 23.72 68.96 24.5333 68.96 25.6C68.96 26.3467 69.2 26.9733 69.68 27.48C70.1867 27.96 70.8 28.36 71.52 28.68C72.2667 28.9733 73.3067 29.32 74.64 29.72C76.4533 30.2533 77.9333 30.7867 79.08 31.32C80.2267 31.8533 81.2133 32.6533 82.04 33.72C82.8667 34.7867 83.28 36.1867 83.28 37.92C83.28 39.4133 82.8933 40.8 82.12 42.08C81.3467 43.36 80.2133 44.3867 78.72 45.16C77.2267 45.9067 75.4533 46.28 73.4 46.28ZM107.855 23.84V46H102.215V43.2C101.495 44.16 100.548 44.92 99.375 45.48C98.2283 46.0133 96.975 46.28 95.615 46.28C93.8817 46.28 92.3483 45.92 91.015 45.2C89.6817 44.4533 88.6283 43.3733 87.855 41.96C87.1083 40.52 86.735 38.8133 86.735 36.84V23.84H92.335V36.04C92.335 37.8 92.775 39.16 93.655 40.12C94.535 41.0533 95.735 41.52 97.255 41.52C98.8017 41.52 100.015 41.0533 100.895 40.12C101.775 39.16 102.215 37.8 102.215 36.04V23.84H107.855ZM116.98 27.04C117.7 26.0267 118.687 25.1867 119.94 24.52C121.22 23.8267 122.674 23.48 124.3 23.48C126.194 23.48 127.9 23.9467 129.42 24.88C130.967 25.8133 132.18 27.1467 133.06 28.88C133.967 30.5867 134.42 32.5733 134.42 34.84C134.42 37.1067 133.967 39.12 133.06 40.88C132.18 42.6133 130.967 43.96 129.42 44.92C127.9 45.88 126.194 46.36 124.3 46.36C122.674 46.36 121.234 46.0267 119.98 45.36C118.754 44.6933 117.754 43.8533 116.98 42.84V56.56H111.38V23.84H116.98V27.04ZM128.7 34.84C128.7 33.5067 128.42 32.36 127.86 31.4C127.327 30.4133 126.607 29.6667 125.7 29.16C124.82 28.6533 123.86 28.4 122.82 28.4C121.807 28.4 120.847 28.6667 119.94 29.2C119.06 29.7067 118.34 30.4533 117.78 31.44C117.247 32.4267 116.98 33.5867 116.98 34.92C116.98 36.2533 117.247 37.4133 117.78 38.4C118.34 39.3867 119.06 40.1467 119.94 40.68C120.847 41.1867 121.807 41.44 122.82 41.44C123.86 41.44 124.82 41.1733 125.7 40.64C126.607 40.1067 127.327 39.3467 127.86 38.36C128.42 37.3733 128.7 36.2 128.7 34.84ZM158.29 34.44C158.29 35.24 158.236 35.96 158.13 36.6H141.93C142.063 38.2 142.623 39.4533 143.61 40.36C144.596 41.2667 145.81 41.72 147.25 41.72C149.33 41.72 150.81 40.8267 151.69 39.04H157.73C157.09 41.1733 155.863 42.9333 154.05 44.32C152.236 45.68 150.01 46.36 147.37 46.36C145.236 46.36 143.316 45.8933 141.61 44.96C139.93 44 138.61 42.6533 137.65 40.92C136.716 39.1867 136.25 37.1867 136.25 34.92C136.25 32.6267 136.716 30.6133 137.65 28.88C138.583 27.1467 139.89 25.8133 141.57 24.88C143.25 23.9467 145.183 23.48 147.37 23.48C149.476 23.48 151.356 23.9333 153.01 24.84C154.69 25.7467 155.983 27.04 156.89 28.72C157.823 30.3733 158.29 32.28 158.29 34.44ZM152.49 32.84C152.463 31.4 151.943 30.2533 150.93 29.4C149.916 28.52 148.676 28.08 147.21 28.08C145.823 28.08 144.65 28.5067 143.69 29.36C142.756 30.1867 142.183 31.3467 141.97 32.84H152.49ZM167.177 27.28C167.897 26.1067 168.831 25.1867 169.977 24.52C171.151 23.8533 172.484 23.52 173.977 23.52V29.4H172.497C170.737 29.4 169.404 29.8133 168.497 30.64C167.617 31.4667 167.177 32.9067 167.177 34.96V46H161.577V23.84H167.177V27.28ZM188.309 28.44H184.429V46H178.749V28.44H176.229V23.84H178.749V22.72C178.749 20 179.522 18 181.069 16.72C182.616 15.44 184.949 14.84 188.069 14.92V19.64C186.709 19.6133 185.762 19.84 185.229 20.32C184.696 20.8 184.429 21.6667 184.429 22.92V23.84H188.309V28.44ZM197.538 16.4V46H191.938V16.4H197.538ZM211.711 46.36C209.578 46.36 207.658 45.8933 205.951 44.96C204.244 44 202.898 42.6533 201.911 40.92C200.951 39.1867 200.471 37.1867 200.471 34.92C200.471 32.6533 200.964 30.6533 201.951 28.92C202.964 27.1867 204.338 25.8533 206.071 24.92C207.804 23.96 209.738 23.48 211.871 23.48C214.004 23.48 215.938 23.96 217.671 24.92C219.404 25.8533 220.764 27.1867 221.751 28.92C222.764 30.6533 223.271 32.6533 223.271 34.92C223.271 37.1867 222.751 39.1867 221.711 40.92C220.698 42.6533 219.311 44 217.551 44.96C215.818 45.8933 213.871 46.36 211.711 46.36ZM211.711 41.48C212.724 41.48 213.671 41.24 214.551 40.76C215.458 40.2533 216.178 39.5067 216.711 38.52C217.244 37.5333 217.511 36.3333 217.511 34.92C217.511 32.8133 216.951 31.2 215.831 30.08C214.738 28.9333 213.391 28.36 211.791 28.36C210.191 28.36 208.844 28.9333 207.751 30.08C206.684 31.2 206.151 32.8133 206.151 34.92C206.151 37.0267 206.671 38.6533 207.711 39.8C208.778 40.92 210.111 41.48 211.711 41.48ZM256.499 23.84L250.019 46H243.979L239.939 30.52L235.899 46H229.819L223.299 23.84H228.979L232.899 40.72L237.139 23.84H243.059L247.219 40.68L251.139 23.84H256.499Z" fill="white"/>\n\t\t\t\t</svg>\n\t\t\t\t'}}}},We=[{name:"Peppa Pig",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Fpeppa_pig.svg?alt=media&token=a9fc83f7-b347-4868-8d52-0e888f0de73a&_gl=1*jzxghx*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMTQ5LjQyLjAuMA.."},{name:"Dazzling Dalmatian",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Fdazzling_dalmatian.svg?alt=media&token=5842b24c-7e58-4bb5-96c2-d09aa11f7f9e&_gl=1*11ayw3z*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQxOTY4LjExLjAuMA.."},{name:"Rosy Rabbit",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Frosy_rabbit.svg?alt=media&token=4e65a9e3-080d-4416-839d-e761b6b37181&_gl=1*156om5t*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMjUzLjYwLjAuMA.."},{name:"Leo the Lion",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Fleo_the_lion.svg?alt=media&token=58d1296e-fefd-42ce-80ea-ae2cc830f1a9&_gl=1*1cz8e9q*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMTAwLjIwLjAuMA.."},{name:"Ducky Down",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Fducky_down.svg?alt=media&token=d67ae889-78c5-46e3-aaa9-3eb511fe90b3&_gl=1*cxyj7o*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQxOTkwLjYwLjAuMA.."},{name:"Merry Monkey",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Fmerry_monkey.svg?alt=media&token=5bd2f69a-7211-42df-9718-5339c467b2d1&_gl=1*1labjed*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMTE3LjMuMC4w"},{name:"Ecstatic Elephant",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Fecstatic_elephant.svg?alt=media&token=fbd2ba76-6c3a-47a7-beac-0460a2178b7d&_gl=1*aku3ps*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMDA3LjQzLjAuMA.."},{name:"Baby Bear",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Fbaby_bear.svg?alt=media&token=71d0c5fb-60aa-4304-adc1-635a83650bde&_gl=1*1dxajmf*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQxMjQyLjUyLjAuMA.."},{name:"Freddy Froglet",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Ffreddy_froglet.svg?alt=media&token=e3b2e292-6480-4507-9da3-21a62a1346d4&_gl=1*s4yycs*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMDQzLjcuMC4w"},{name:"Powerful Panda",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Fpowerful_panda.svg?alt=media&token=07f9d60f-aa14-4a77-ad5b-c48ee76db3f5&_gl=1*7gfuit*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMTkzLjYwLjAuMA.."},{name:"Curious Cat",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Fcurious_cat.svg?alt=media&token=dccf6824-3b7c-4e4e-8559-40fbb8ff6186&_gl=1*1nwi0ti*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQxOTM3LjQyLjAuMA.."},{name:"Playful Penguin",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Fplayful_penguin.svg?alt=media&token=c6d1b11a-43a6-4001-ae56-e04fd5a3f965&_gl=1*1xdxvkx*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMTYzLjI4LjAuMA.."},{name:"Kind Koala",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Fkind_koala.svg?alt=media&token=974396d6-6ccd-4367-8563-b27634849cb5&_gl=1*1w1gbnn*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMDgwLjQwLjAuMA.."},{name:"Tommy Tiger",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Ftommy_tiger.svg?alt=media&token=40a95ac7-cc91-4b74-859a-4e2e5964b967&_gl=1*1n0cr0n*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMjczLjQwLjAuMA.."},{name:"Wally Walrus",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Fwally_walrus.svg?alt=media&token=31e02ef2-c986-4724-b987-dca97f84f81b&_gl=1*y5by2c*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMjkxLjIyLjAuMA.."},{name:"Ricky Rhino",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Fricky_rhino.svg?alt=media&token=5d9dafe5-f4de-4f8b-94c1-49e01c776611&_gl=1*zyp4n2*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMjMxLjIyLjAuMA.."},{name:"Oliver Otter",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Foliver_otter.svg?alt=media&token=5298b869-0903-40b2-a702-224a3e0bcd95&_gl=1*aicppz*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMTMxLjYwLjAuMA.."},{name:"Reggie Ratling",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Freggie_ratling.svg?alt=media&token=f37fd4a0-9dbd-403a-bb82-81fdfb63cf88&_gl=1*16lzeql*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMjA3LjQ2LjAuMA.."},{name:"Gentle Giraffe",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Fgentle_giraffe.svg?alt=media&token=f097ec12-e8ce-4d26-bf32-43e470eb7907&_gl=1*11ctuwz*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMDYwLjYwLjAuMA.."},{name:"Fabulous Fox",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Ffabulous_fox.svg?alt=media&token=fe1a4236-af45-427f-a035-1eda417b0682&_gl=1*xyyv1g*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMDIxLjI5LjAuMA.."}],Ze="bugReport",Ke="create",Ye="Sign in to report a bug.",Je="Something went wrong. Please try again.",Qe={console:100,errors:25,network:25},Xe={maxMessageChars:5e3,maxDigestBytes:2048,maxBundleBytes:262144,maxEntryChars:500,maxStackFrames:5,digestListSize:5};const ti=[{pattern:/eyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]*/g,replacement:"[REDACTED_JWT]"},{pattern:/\b(sk|pk|rk)_(live|test)_[A-Za-z0-9]{8,}/g,replacement:"[REDACTED_STRIPE_KEY]"},{pattern:/\bAIza[0-9A-Za-z_-]{35}\b/g,replacement:"[REDACTED_FIREBASE_KEY]"},{pattern:/\bghp_[A-Za-z0-9]{20,}\b/g,replacement:"[REDACTED_GITHUB_TOKEN]"},{pattern:/\bxox[abprs]-[A-Za-z0-9-]{10,}\b/gi,replacement:"[REDACTED_SLACK_TOKEN]"},{pattern:/\b(?:sk|pk|api|key)[_-][A-Za-z0-9]{12,}\b/gi,replacement:"[REDACTED_API_KEY]"},{pattern:/\b[Bb]earer\s+[A-Za-z0-9._-]{16,}/g,replacement:"Bearer [REDACTED]"},{pattern:/\bAuthorization\s*:\s*(?:Bearer|Basic|Token|Digest)?\s*\S+/gi,replacement:"Authorization: [REDACTED]"},{pattern:/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g,replacement:"[REDACTED_EMAIL]"},{pattern:/\b\d{4}[ -]\d{4}[ -]\d{4}[ -]\d{1,4}\b/g,replacement:"[REDACTED_CARD_NUMBER]"},{pattern:/\b\d{13,19}\b/g,replacement:function(t){try{return function(t){try{let e=0,i=!1;for(let n=t.length-1;n>=0;n-=1){let o=Number(t[n]);i&&(o*=2,o>9&&(o-=9)),e+=o,i=!i}return e%10==0}catch{return!0}}(t)?"[REDACTED_CARD_NUMBER]":t}catch{return"[REDACTED_CARD_NUMBER]"}}},{pattern:/\b[A-Fa-f0-9]{40,}\b/g,replacement:"[REDACTED_HEX]"},{pattern:/\b[A-Za-z0-9+/]{40,}={0,2}\b/g,replacement:"[REDACTED_BASE64]"}],ei="__SUPERFLOW_LIVE_SIGNIN__",ii="__sf_signin",ni="guest",oi=[...me,Tt,It,_t,$t,Ot,Nt,Lt,Rt,we,fe,pe,re,"snippyly_google_token",ii,"inject","r","wireframe","velt-version","velt-env"];var ri=Object.freeze({__proto__:null,AGENTS_SIDEBAR_MODE:Rt,AGENT_COMMENTS_MODE:$t,AGENT_FIELD_PREFIXES:Ue,AGENT_PIN_DIALOG_HOLD_MS:Qt,AGENT_PIN_DIALOG_MAX_RESELECTS:3,AGENT_STATUS_MODE:Lt,AGENT_STATUS_RUNNING_TOOLTIP:Pt,ANNOTATION_STATUS_TERMINAL:"terminal",ANNOTATION_TYPE_SUGGESTION:je,ATTRIBUTES:He,AUTO_COMMENT_MODE:It,BUG_REPORT_AUTH_REQUIRED_ERROR:Ye,BUG_REPORT_EVENT_TYPE:Ze,BUG_REPORT_SCHEMA_VERSION:1,BUG_REPORT_SUBMIT_FAILED_ERROR:Je,BUG_REPORT_SUB_EVENT_TYPE_CREATE:Ke,COMMENT_PRIVATE_MODE_TYPE_ORGANIZATION:Ae,DEFAULT_CUSTOMER_METADATA:Ge,DOCUMENT_TITLE_CHANGE_LISTENER_API_KEYS:bt,DRIVE_HOSTS:Fe,DRIVE_NEW_PROD_URL:"app.usesuperflow.com/drive",DRIVE_NEW_STAGING_URL:"superflow-portal-v2-staging.firebaseapp.com/drive",DRIVE_PROD_URL:"drive.usesuperflow.com",DRIVE_STAGING_URL:"superflow-file-viewer-staging.web.app",EMBED_MODE:Tt,EXCLUDED_API_KEYS_FROM_CHECK_PRIORITIES:Ct,EXCLUDED_API_KEYS_FROM_LATEST_VERSION:["I9R2VqG45F5AgpIicnht"],FEEDBACK_MODE:At,FIGMA_DEMO_MODAL:fe,GUEST_USERS:We,LIVE_DEMO_MODAL:ge,LIVE_PREVIEW_SIGN_IN_GLOBAL:ei,LIVE_PREVIEW_SIGN_IN_PARAM:ii,LIVE_PREVIEW_SIGN_OUT_VALUE:ni,LOCATION_STRIPPED_TOOLBAR_PARAMS:me,ONBOARDING_AGENT_BUTTON_LABELS:Re,ONBOARDING_AGENT_BUTTON_STATE:Le,ONBOARDING_AGENT_STATUS_MESSAGE_TYPE:Dt,ONBOARDING_DIAGNOSTICS_MESSAGE_TYPE:jt,ONBOARDING_DIAGNOSTICS_REQUEST_MESSAGE_TYPE:Vt,ONBOARDING_FAILED_AGENT_STATUSES:Bt,ONBOARDING_FETCH_ERROR:zt,ONBOARDING_FINDINGS_FETCH_INTERVAL_MS:3e3,ONBOARDING_FINDINGS_FETCH_MAX_ATTEMPTS:10,ONBOARDING_FINDINGS_FETCH_MAX_ATTEMPTS_PER_RUN:30,ONBOARDING_MAX_AGENT_STATUSES:50,ONBOARDING_MAX_DISMISSED_PROJECTS:20,ONBOARDING_MODE:Nt,ONBOARDING_READY_MESSAGE_TYPE:Ft,ONBOARDING_STATUS_FIRST_MESSAGE_TIMEOUT_MS:2e4,ONBOARDING_STATUS_STALE_MS:Ut,ONBOARDING_VIEWPORT_GUTTER_PX:8,PLACEHOLDER_ORGANIZATION_NAME:yt,PREVIEW_LEAVING_MESSAGE_TYPE:te,PREVIEW_LIVE_DOMAINS:Zt,PREVIEW_LIVE_LABEL_PATTERN:Kt,PREVIEW_LOCATION_MAX_PAGE_LENGTH:2048,PREVIEW_LOCATION_MESSAGE_TYPE:Xt,PREVIEW_LOCATION_PATH:Ot,PREVIEW_LOCATION_STRIPPED_PARAMS:oi,PREVIEW_NAVIGATE_MESSAGE_TYPE:Yt,PREVIEW_PROXY_HOSTS:Wt,PREVIEW_RENDER_PARAM:we,PREVIEW_SHOW_COMMENT_MAX_ANNOTATION_ID_LENGTH:200,PREVIEW_SHOW_COMMENT_MAX_URL_LENGTH:2048,PREVIEW_SHOW_COMMENT_MESSAGE_TYPE:Jt,PROJECT_INSTALL:ve,PROJECT_VERSION:ue,PROJECT_VERSION_DEFAULT_KEY:pe,PROJECT_VERSION_KEY:he,PROXY_DISABLED_DEFAULT_API_KEYS:kt,READ_ONLY_MODE:_t,REVIEW_DOC_ID:ie,REVIEW_MODE:Mt,SCREENSHOT_DISABLED_HOSTS:Ve,SIDEBAR_BUTTON_COUNT_TYPE_FILTER:qe,SIDEBAR_V1_DEFAULT_API_KEYS:St,SNIPPYLY_COMMENT_ID:ne,SNIPPYLY_TOKEN:re,SNIPPYLY_USER:oe,SUPERFLOW_CONTENT_WARNING_SIDEBAR_OPEN:Ne,SUPERFLOW_CUSTOMER_METADATA:Oe,SUPERFLOW_DOCUMENT_METADATA:"sfDocumentMetadata",SUPERFLOW_GUEST_MIGRATION_REFUSED:de,SUPERFLOW_GUEST_MODE:Ce,SUPERFLOW_GUEST_MODE_ALLOW_SIGN_IN:Te,SUPERFLOW_GUEST_USER_BANNER_OPENED:$e,SUPERFLOW_GUEST_USER_MODEL_OPENED:Ie,SUPERFLOW_GUEST_USER_NAME_MODEL_OPENED:"sfGuestUserNameModelOpened",SUPERFLOW_GUEST_USER_NAME_UPDATED:_e,SUPERFLOW_GUEST_USER_TOKEN:ce,SUPERFLOW_NATIVE_SCREENSHOT_PERMISSION:Pe,SUPERFLOW_ONBOARDING_AGENTS_SIDEBAR:qt,SUPERFLOW_ONBOARDING_SIDEBAR_DISMISSED:Ht,SUPERFLOW_PAGE_COMMENTS_HIDDEN:ee,SUPERFLOW_PASSWORD_IS_VALID:Se,SUPERFLOW_PASSWORD_PROTECTED:Ee,SUPERFLOW_PRIVATE_MODE:Me,SUPERFLOW_QUERY_PARAMS_COMMENTS:xe,SUPERFLOW_SAML_CONFIG:De,SUPERFLOW_SIDEBAR_V2_ENABLED:Et,SUPERFLOW_USER_ADMIN:be,SUPERFLOW_USER_CREDENTIAL:ae,SUPERFLOW_USER_CREDENTIAL_EXPIRY_MARGIN_MS:le,SUPERFLOW_USER_TOKEN:se,SUPERFLOW_USE_PAGE_TITLE_AS_LOCATION_NAME:ke,SUPERFLOW_VERSION:ft,SYSTEM_AGENT_IDS:Be,TAGS:ze,TELEMETRY_BUFFER_CAPS:Qe,TELEMETRY_REDACTION_RULES:ti,TELEMETRY_SIZE_LIMITS:Xe,TOUR_COMMENT_TOOLTIP:ye,UNKNOWN_AGENT_NAME:Gt,VELT_PROXY_FLAG:xt,VELT_SDK_DEVELOP_VERSION:mt,VELT_SDK_PROD_VERSION:wt,VELT_SDK_STAGING_VERSION:"6.0.34"});const si=!0,ai="https://superflow-portal-v2-staging.firebaseapp.com/",li="https://superflow-portal-v2-staging.firebaseapp.com/settings/billing",ci="9dbcd2509e0fa90a5c81f038ce618e3f",di="6d24f74f12f6fb84c87efa8f791cfb2e",hi="https://us-central1-snipply-sdk-staging.cloudfunctions.net/sa",ui="https://us-central1-snipply-sdk-staging.cloudfunctions.net/superflowtoolbarhandler",pi=function(t){const e=[];let i=0;for(let n=0;n<t.length;n++){let o=t.charCodeAt(n);o<128?e[i++]=o:o<2048?(e[i++]=o>>6|192,e[i++]=63&o|128):55296==(64512&o)&&n+1<t.length&&56320==(64512&t.charCodeAt(n+1))?(o=65536+((1023&o)<<10)+(1023&t.charCodeAt(++n)),e[i++]=o>>18|240,e[i++]=o>>12&63|128,e[i++]=o>>6&63|128,e[i++]=63&o|128):(e[i++]=o>>12|224,e[i++]=o>>6&63|128,e[i++]=63&o|128)}return e},vi={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray(t,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();const i=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,n=[];for(let e=0;e<t.length;e+=3){const o=t[e],r=e+1<t.length,s=r?t[e+1]:0,a=e+2<t.length,l=a?t[e+2]:0,c=o>>2,d=(3&o)<<4|s>>4;let h=(15&s)<<2|l>>6,u=63&l;a||(u=64,r||(h=64)),n.push(i[c],i[d],i[h],i[u])}return n.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(pi(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):function(t){const e=[];let i=0,n=0;for(;i<t.length;){const o=t[i++];if(o<128)e[n++]=String.fromCharCode(o);else if(o>191&&o<224){const r=t[i++];e[n++]=String.fromCharCode((31&o)<<6|63&r)}else if(o>239&&o<365){const r=((7&o)<<18|(63&t[i++])<<12|(63&t[i++])<<6|63&t[i++])-65536;e[n++]=String.fromCharCode(55296+(r>>10)),e[n++]=String.fromCharCode(56320+(1023&r))}else{const r=t[i++],s=t[i++];e[n++]=String.fromCharCode((15&o)<<12|(63&r)<<6|63&s)}}return e.join("")}(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();const i=e?this.charToByteMapWebSafe_:this.charToByteMap_,n=[];for(let e=0;e<t.length;){const o=i[t.charAt(e++)],r=e<t.length?i[t.charAt(e)]:0;++e;const s=e<t.length?i[t.charAt(e)]:64;++e;const a=e<t.length?i[t.charAt(e)]:64;if(++e,null==o||null==r||null==s||null==a)throw new gi;const l=o<<2|r>>4;if(n.push(l),64!==s){const t=r<<4&240|s>>2;if(n.push(t),64!==a){const t=s<<6&192|a;n.push(t)}}}return n},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let t=0;t<this.ENCODED_VALS.length;t++)this.byteToCharMap_[t]=this.ENCODED_VALS.charAt(t),this.charToByteMap_[this.byteToCharMap_[t]]=t,this.byteToCharMapWebSafe_[t]=this.ENCODED_VALS_WEBSAFE.charAt(t),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[t]]=t,t>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}};class gi extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const fi=function(t){return function(t){const e=pi(t);return vi.encodeByteArray(e,!0)}(t).replace(/\./g,"")},mi=function(t){try{return vi.decodeString(t,!0)}catch(t){console.error("base64Decode failed: ",t)}return null};
|
|
71
|
+
*/class pt extends ht{constructor(t){if(super(t),this.it=D,t.type!==ct)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===D||null==t)return this.ft=void 0,this.it=t;if(t===P)return t;if("string"!=typeof t)throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this.ft;this.it=t;const e=[t];return e.raw=e,this.ft={_$litType$:this.constructor.resultType,strings:e,values:[]}}}pt.directiveName="unsafeHTML",pt.resultType=1;const vt=dt(pt);class gt{}gt.Events={GUEST_MODE_SIGN_IN_DIALOG_SHOWN:"guestModeSignInDialogShown",GUEST_MODE_NAME_DIALOG_SHOWN:"guestModeNameDialogShown",GUEST_MODE_SIGN_IN_BANNER_SHOWN:"guestModeSignInBannerShown",GUEST_MODE_SIGN_IN_BUTTON_CLICKED:"guestModeSignInButtonClicked",PASSWORD_PROTECTED_MODAL_CLOSE_BUTTON_CLICKED:"passwordProtectedModalCloseButtonClicked",PASSWORD_PROTECTED_MODAL_OPEN_BUTTON_CLICKED:"passwordProtectedModalOpenButtonClicked",TOOLBAR_EXPANDED:"toolbarExpanded",TOOLBAR_COLLAPSED:"toolbarCollapsed",TOOLBAR_NOTIFICATION_CLICKED:"toolbarNotificationClicked",GUEST_MODE_SKIP_BUTTON_CLICKED:"guestModeSkipButtonClicked",GUEST_MODE_SIGN_IN_NUDGE_SHOWN:"guestModeSignInNudgeShown",GUEST_MODE_NAME_NUDGE_SHOWN:"guestModeNameNudgeShown",GUEST_MODE_SIGN_IN_CLICKED:"guestModeSignInClicked",GUEST_MODE_PRESENT:"guestModePresent",GUEST_MODE_NAME_ADDED:"guestModeNameAdded",REVIEW_PASSWORD_ADDED:"reviewPasswordAdded",REVIEW_PASSWORD_REJECTED:"reviewPasswordRejected",REVIEW_PASSWORD_ACCEPTED:"reviewPasswordAccepted",PRIVATE_MODE_ENABLED:"privateModeEnabled",PRIVATE_MODE_DISABLED:"privateModeDisabled",VISIBILITY_OPTIONS_ENABLED:"visibilityOptionsEnabled",VISIBILITY_OPTIONS_DISABLED:"visibilityOptionsDisabled",VIEW_PROJECT_CLICKED:"viewProjectClicked",REPORT_BUG_CLICKED:"reportBugClicked",REPORT_BUG_SUBMITTED:"reportBugSubmitted",OPEN_MOBILE_CLICKED:"openMobileClicked",EXIT_REVIEW_MODE_CLICKED:"exitReviewModeClicked",SIGNOUT_CLICKED:"signoutClicked",SIGNIN_CLICKED:"signinClicked",SIGN_IN_REQUIRED:"signInRequired",USER_EMAIL_NOT_WHITELISTED:"userEmailNotWhitelisted",DOMAIN_NOT_WHITELISTED:"domainNotWhitelisted",DUPLICATE_SCRIPT_INSTALLED:"duplicateScriptInstalled",TOOLBAR_DISABLED:"toolbarDisabled",INVITE_MODAL_OPENED:"inviteModalOpened",INVITE_SENT:"inviteSent",QUALITY_CHECK_RUN_TOOLBAR_CLICKED:"qualityCheckRunFromToolbarClicked",REQUEST_MODE_LOADED:"requestModeLoaded",REQUEST_ADDED:"requestAdded",REQUEST_MODE_SIGN_IN_CLICKED:"requestModeSignInClicked",REQUEST_MODE_OPENED:"requestModeOpened"};const ft="1.0.808",mt="6.0.45",wt="6.0.45",yt="Superflow Organization",bt=["v3ogId1G43AFHehEOewv","rNYzMJd13L27xtfipmSK","aU1MxKP0rca2UXwKi8bl"],Ct=["ockkGlKLaApkEOBShhbR"],Et="sfSidebarV2Enabled",xt="sfUseProxy",kt=["v3ogId1G43AFHehEOewv"],St=[],Mt="review",At="feedback",Tt="sembed",It="scommentmode",_t="sreadonly",$t="sagentcomments",Ot="spath",Nt="sonboarding",Lt="sagentstatus",Rt="sagentsidebar",Pt="Running checks",Dt="sf-onboarding-agent-status",Ft="sf-onboarding-ready",Vt="sf-onboarding-diagnostics-request",jt="sf-onboarding-diagnostics",Ut=3e5,Bt=["failed","systemError","error"],zt={SDK_NOT_READY:"sdk-not-ready",SDK_RETURNED_NULL:"sdk-returned-null",FETCH_THREW:"fetch-threw"},Ht="sfOnboardingSidebarDismissed",qt="sfOnboardingAgentsSidebar",Gt="Unknown Agent",Wt=[{hostSuffix:"cloudfunctions.net",pathPrefix:"/previewproxy"},{hostSuffix:"api.velt.dev",pathPrefix:"/previewproxy"}],Zt=["superflow-preview.com","stg.superflow-preview.com"],Kt=/^[a-z2-7]+-[a-z2-7]{16}$/,Yt="sf-preview-navigate",Jt="sf-preview-show-comment",Qt=1e4,Xt="sf-preview-location",te="sf-preview-leaving",ee="sfPageCommentsHidden",ie="sreviewId",ne="scommentId",oe="snippyly-user",re="st",se="_sfut",ae="_sfuc",le=6e4,ce="_sfgut",de="sfGuestMigrationRefused",he="projectVersionKey",ue="projectVersion",pe="sversion",ve="sprojectInstall",ge="sflivedemo",fe="sffigmademo",me=[Mt,At,ie,ne,ve,ge],we="srender",ye="sfTourCommentTooltip",be="sfUserAdmin",Ce="sfGuestMode",Ee="sfPasswordProtected",xe="sfQueryParamsComments",ke="sfUsePageTitleAsLocationName",Se="sfPasswordIsValid",Me="sfPrivateMode",Ae="organizationPrivate",Te="sfGuestModeAllowSignIn",Ie="sfGuestUserModelOpened",_e="sfGuestUserNameUpdated",$e="sfGuestUserBannerOpened",Oe="sfCustomerMetadata",Ne="sfContentWarningSidebarOpen",Le={LOADING:"loading",RUNNING:"running",FINDINGS:"findings",CLEAN:"clean",IDLE:"idle"},Re={QA_AGENTS:"QA Agents",LOADING:"Running QA Agents",RUNNING:"Running",RUNNING_SINGLE:"Running 1 QA Agent",FINDING_SINGLE:"1 Agent Finding",FINDINGS:"Agent Findings",NO_FINDINGS_FOUND:"No Findings"},Pe="sfNativeScreenshotPermission",De="sfSamlConfig",Fe=[{hostSuffix:"drive.usesuperflow.com",pathPrefix:"/"},{hostSuffix:"superflow-file-viewer-staging.web.app",pathPrefix:"/"},{hostSuffix:"app.usesuperflow.com",pathPrefix:"/drive"},{hostSuffix:"superflow-portal-v2-staging.firebaseapp.com",pathPrefix:"/drive"},{hostSuffix:"superflow-portal-v2-staging.web.app",pathPrefix:"/drive"},{hostSuffix:"superflow-portal-v2-prod.firebaseapp.com",pathPrefix:"/drive"},{hostSuffix:"superflow-portal-v2-prod.web.app",pathPrefix:"/drive"}],Ve=["app.usesuperflow.com","superflow-portal-v2-staging.firebaseapp.com"],je="suggestion",Ue={AGENT:"agent:",AGENT_TYPE_CUSTOM:"agentType:custom"},Be={SPELL_CHECK:"spell-check",BROKEN_LINKS:"broken-links",GRAMMAR_CHECK:"grammar-check"},ze={VELT_ROOT:"velt-root",VELT_PRESENCE:"velt-presence",VELT_CURSOR:"velt-cursor",VELT_COMMENT_TOOL:"velt-comment-tool",VELT_COMMENTS:"velt-comments",SNIPPYLY_TEXT_HIGHLIGHT:"snippyly-text-highlight",VELT_COMMENTS_SIDEBAR_LEGACY:"velt-comments-sidebar",VELT_COMMENTS_SIDEBAR_V2:"velt-comments-sidebar-v2",VELT_HUDDLE:"velt-huddle",VELT_RECORDER_NOTES:"velt-recorder-notes",VELT_RECORDER_CONTROL_PANEL:"velt-recorder-control-panel",VELT_ARROWS:"velt-arrows",VELT_NOTIFICATIONS_HISTORY_PANEL:"velt-notifications-history-panel"},He={ENABLE_URL_NAVIGATION:"enable-url-navigation",URL_NAVIGATION:"url-navigation",CURRENT_LOCATION_SUFFIX:"current-location-suffix",SIDEBAR_BUTTON_COUNT_TYPE:"sidebar-button-count-type",CUSTOM_ACTIONS:"custom-actions"},qe="filter",Ge={customBranding:{logo:{logoMark:{lightUrl:'\n\t\t\t\t<svg viewBox="0 0 49 48" fill="none" xmlns="http://www.w3.org/2000/svg">\n\t\t\t\t\t<path d="M8 8C8 3.58172 11.5817 0 16 0V0C20.4183 0 24 3.58172 24 8V16H16C11.5817 16 8 12.4183 8 8V8Z" fill="#FFCD2E"/>\n\t\t\t\t\t<path d="M0 29C0 22.3726 5.37258 17 12 17H24V29C24 35.6274 18.6274 41 12 41V41C5.37258 41 0 35.6274 0 29V29Z" fill="#A259FE"/>\n\t\t\t\t\t<path d="M25 19C25 12.3726 30.3726 7 37 7V7C43.6274 7 49 12.3726 49 19V19C49 25.6274 43.6274 31 37 31H25V19Z" fill="#FF7162"/>\n\t\t\t\t\t<path d="M25 32H33C37.4183 32 41 35.5817 41 40V40C41 44.4183 37.4183 48 33 48V48C28.5817 48 25 44.4183 25 40V32Z" fill="#0DCF82"/>\n\t\t\t\t</svg>\n\t\t\t\t',darkUrl:'\n\t\t\t\t<svg viewBox="0 0 49 48" fill="none" xmlns="http://www.w3.org/2000/svg">\n\t\t\t\t\t<path d="M8 8C8 3.58172 11.5817 0 16 0V0C20.4183 0 24 3.58172 24 8V16H16C11.5817 16 8 12.4183 8 8V8Z" fill="#FFCD2E"/>\n\t\t\t\t\t<path d="M0 29C0 22.3726 5.37258 17 12 17H24V29C24 35.6274 18.6274 41 12 41V41C5.37258 41 0 35.6274 0 29V29Z" fill="#A259FE"/>\n\t\t\t\t\t<path d="M25 19C25 12.3726 30.3726 7 37 7V7C43.6274 7 49 12.3726 49 19V19C49 25.6274 43.6274 31 37 31H25V19Z" fill="#FF7162"/>\n\t\t\t\t\t<path d="M25 32H33C37.4183 32 41 35.5817 41 40V40C41 44.4183 37.4183 48 33 48V48C28.5817 48 25 44.4183 25 40V32Z" fill="#0DCF82"/>\n\t\t\t\t</svg>\n\t\t\t\t'},wordMark:{lightUrl:'\n\t\t\t\t<svg width="257" height="65" viewBox="0 0 257 65" fill="none" xmlns="http://www.w3.org/2000/svg">\n\t\t\t\t\t<path d="M8 16C8 11.5817 11.5817 8 16 8V8C20.4183 8 24 11.5817 24 16V24H16C11.5817 24 8 20.4183 8 16V16Z" fill="#FFCD2E"/>\n\t\t\t\t\t<path d="M0 37C0 30.3726 5.37258 25 12 25H24V37C24 43.6274 18.6274 49 12 49V49C5.37258 49 0 43.6274 0 37V37Z" fill="#A259FE"/>\n\t\t\t\t\t<path d="M25 27C25 20.3726 30.3726 15 37 15V15C43.6274 15 49 20.3726 49 27V27C49 33.6274 43.6274 39 37 39H25V27Z" fill="#FF7162"/>\n\t\t\t\t\t<path d="M25 40H33C37.4183 40 41 43.5817 41 48V48C41 52.4183 37.4183 56 33 56V56C28.5817 56 25 52.4183 25 48V40Z" fill="#0DCF82"/>\n\t\t\t\t\t<path d="M73.4 46.28C71.4533 46.28 69.6933 45.9467 68.12 45.28C66.5733 44.6133 65.3467 43.6533 64.44 42.4C63.5333 41.1467 63.0667 39.6667 63.04 37.96H69.04C69.12 39.1067 69.52 40.0133 70.24 40.68C70.9867 41.3467 72 41.68 73.28 41.68C74.5867 41.68 75.6133 41.3733 76.36 40.76C77.1067 40.12 77.48 39.2933 77.48 38.28C77.48 37.4533 77.2267 36.7733 76.72 36.24C76.2133 35.7067 75.5733 35.2933 74.8 35C74.0533 34.68 73.0133 34.3333 71.68 33.96C69.8667 33.4267 68.3867 32.9067 67.24 32.4C66.12 31.8667 65.1467 31.08 64.32 30.04C63.52 28.9733 63.12 27.56 63.12 25.8C63.12 24.1467 63.5333 22.7067 64.36 21.48C65.1867 20.2533 66.3467 19.32 67.84 18.68C69.3333 18.0133 71.04 17.68 72.96 17.68C75.84 17.68 78.1733 18.3867 79.96 19.8C81.7733 21.1867 82.7733 23.1333 82.96 25.64H76.8C76.7467 24.68 76.3333 23.8933 75.56 23.28C74.8133 22.64 73.8133 22.32 72.56 22.32C71.4667 22.32 70.5867 22.6 69.92 23.16C69.28 23.72 68.96 24.5333 68.96 25.6C68.96 26.3467 69.2 26.9733 69.68 27.48C70.1867 27.96 70.8 28.36 71.52 28.68C72.2667 28.9733 73.3067 29.32 74.64 29.72C76.4533 30.2533 77.9333 30.7867 79.08 31.32C80.2267 31.8533 81.2133 32.6533 82.04 33.72C82.8667 34.7867 83.28 36.1867 83.28 37.92C83.28 39.4133 82.8933 40.8 82.12 42.08C81.3467 43.36 80.2133 44.3867 78.72 45.16C77.2267 45.9067 75.4533 46.28 73.4 46.28ZM107.855 23.84V46H102.215V43.2C101.495 44.16 100.548 44.92 99.375 45.48C98.2283 46.0133 96.975 46.28 95.615 46.28C93.8817 46.28 92.3483 45.92 91.015 45.2C89.6817 44.4533 88.6283 43.3733 87.855 41.96C87.1083 40.52 86.735 38.8133 86.735 36.84V23.84H92.335V36.04C92.335 37.8 92.775 39.16 93.655 40.12C94.535 41.0533 95.735 41.52 97.255 41.52C98.8017 41.52 100.015 41.0533 100.895 40.12C101.775 39.16 102.215 37.8 102.215 36.04V23.84H107.855ZM116.98 27.04C117.7 26.0267 118.687 25.1867 119.94 24.52C121.22 23.8267 122.674 23.48 124.3 23.48C126.194 23.48 127.9 23.9467 129.42 24.88C130.967 25.8133 132.18 27.1467 133.06 28.88C133.967 30.5867 134.42 32.5733 134.42 34.84C134.42 37.1067 133.967 39.12 133.06 40.88C132.18 42.6133 130.967 43.96 129.42 44.92C127.9 45.88 126.194 46.36 124.3 46.36C122.674 46.36 121.234 46.0267 119.98 45.36C118.754 44.6933 117.754 43.8533 116.98 42.84V56.56H111.38V23.84H116.98V27.04ZM128.7 34.84C128.7 33.5067 128.42 32.36 127.86 31.4C127.327 30.4133 126.607 29.6667 125.7 29.16C124.82 28.6533 123.86 28.4 122.82 28.4C121.807 28.4 120.847 28.6667 119.94 29.2C119.06 29.7067 118.34 30.4533 117.78 31.44C117.247 32.4267 116.98 33.5867 116.98 34.92C116.98 36.2533 117.247 37.4133 117.78 38.4C118.34 39.3867 119.06 40.1467 119.94 40.68C120.847 41.1867 121.807 41.44 122.82 41.44C123.86 41.44 124.82 41.1733 125.7 40.64C126.607 40.1067 127.327 39.3467 127.86 38.36C128.42 37.3733 128.7 36.2 128.7 34.84ZM158.29 34.44C158.29 35.24 158.236 35.96 158.13 36.6H141.93C142.063 38.2 142.623 39.4533 143.61 40.36C144.596 41.2667 145.81 41.72 147.25 41.72C149.33 41.72 150.81 40.8267 151.69 39.04H157.73C157.09 41.1733 155.863 42.9333 154.05 44.32C152.236 45.68 150.01 46.36 147.37 46.36C145.236 46.36 143.316 45.8933 141.61 44.96C139.93 44 138.61 42.6533 137.65 40.92C136.716 39.1867 136.25 37.1867 136.25 34.92C136.25 32.6267 136.716 30.6133 137.65 28.88C138.583 27.1467 139.89 25.8133 141.57 24.88C143.25 23.9467 145.183 23.48 147.37 23.48C149.476 23.48 151.356 23.9333 153.01 24.84C154.69 25.7467 155.983 27.04 156.89 28.72C157.823 30.3733 158.29 32.28 158.29 34.44ZM152.49 32.84C152.463 31.4 151.943 30.2533 150.93 29.4C149.916 28.52 148.676 28.08 147.21 28.08C145.823 28.08 144.65 28.5067 143.69 29.36C142.756 30.1867 142.183 31.3467 141.97 32.84H152.49ZM167.177 27.28C167.897 26.1067 168.831 25.1867 169.977 24.52C171.151 23.8533 172.484 23.52 173.977 23.52V29.4H172.497C170.737 29.4 169.404 29.8133 168.497 30.64C167.617 31.4667 167.177 32.9067 167.177 34.96V46H161.577V23.84H167.177V27.28ZM188.309 28.44H184.429V46H178.749V28.44H176.229V23.84H178.749V22.72C178.749 20 179.522 18 181.069 16.72C182.616 15.44 184.949 14.84 188.069 14.92V19.64C186.709 19.6133 185.762 19.84 185.229 20.32C184.696 20.8 184.429 21.6667 184.429 22.92V23.84H188.309V28.44ZM197.538 16.4V46H191.938V16.4H197.538ZM211.711 46.36C209.578 46.36 207.658 45.8933 205.951 44.96C204.244 44 202.898 42.6533 201.911 40.92C200.951 39.1867 200.471 37.1867 200.471 34.92C200.471 32.6533 200.964 30.6533 201.951 28.92C202.964 27.1867 204.338 25.8533 206.071 24.92C207.804 23.96 209.738 23.48 211.871 23.48C214.004 23.48 215.938 23.96 217.671 24.92C219.404 25.8533 220.764 27.1867 221.751 28.92C222.764 30.6533 223.271 32.6533 223.271 34.92C223.271 37.1867 222.751 39.1867 221.711 40.92C220.698 42.6533 219.311 44 217.551 44.96C215.818 45.8933 213.871 46.36 211.711 46.36ZM211.711 41.48C212.724 41.48 213.671 41.24 214.551 40.76C215.458 40.2533 216.178 39.5067 216.711 38.52C217.244 37.5333 217.511 36.3333 217.511 34.92C217.511 32.8133 216.951 31.2 215.831 30.08C214.738 28.9333 213.391 28.36 211.791 28.36C210.191 28.36 208.844 28.9333 207.751 30.08C206.684 31.2 206.151 32.8133 206.151 34.92C206.151 37.0267 206.671 38.6533 207.711 39.8C208.778 40.92 210.111 41.48 211.711 41.48ZM256.499 23.84L250.019 46H243.979L239.939 30.52L235.899 46H229.819L223.299 23.84H228.979L232.899 40.72L237.139 23.84H243.059L247.219 40.68L251.139 23.84H256.499Z" fill="#141416"/>\n\t\t\t\t</svg>\n\t\t\t\t',darkUrl:'\n\t\t\t\t<svg width="257" height="65" viewBox="0 0 257 65" fill="none" xmlns="http://www.w3.org/2000/svg">\n\t\t\t\t\t<path d="M8 16C8 11.5817 11.5817 8 16 8V8C20.4183 8 24 11.5817 24 16V24H16C11.5817 24 8 20.4183 8 16V16Z" fill="#FFCD2E"/>\n\t\t\t\t\t<path d="M0 37C0 30.3726 5.37258 25 12 25H24V37C24 43.6274 18.6274 49 12 49V49C5.37258 49 0 43.6274 0 37V37Z" fill="#A259FE"/>\n\t\t\t\t\t<path d="M25 27C25 20.3726 30.3726 15 37 15V15C43.6274 15 49 20.3726 49 27V27C49 33.6274 43.6274 39 37 39H25V27Z" fill="#FF7162"/>\n\t\t\t\t\t<path d="M25 40H33C37.4183 40 41 43.5817 41 48V48C41 52.4183 37.4183 56 33 56V56C28.5817 56 25 52.4183 25 48V40Z" fill="#0DCF82"/>\n\t\t\t\t\t<path d="M73.4 46.28C71.4533 46.28 69.6933 45.9467 68.12 45.28C66.5733 44.6133 65.3467 43.6533 64.44 42.4C63.5333 41.1467 63.0667 39.6667 63.04 37.96H69.04C69.12 39.1067 69.52 40.0133 70.24 40.68C70.9867 41.3467 72 41.68 73.28 41.68C74.5867 41.68 75.6133 41.3733 76.36 40.76C77.1067 40.12 77.48 39.2933 77.48 38.28C77.48 37.4533 77.2267 36.7733 76.72 36.24C76.2133 35.7067 75.5733 35.2933 74.8 35C74.0533 34.68 73.0133 34.3333 71.68 33.96C69.8667 33.4267 68.3867 32.9067 67.24 32.4C66.12 31.8667 65.1467 31.08 64.32 30.04C63.52 28.9733 63.12 27.56 63.12 25.8C63.12 24.1467 63.5333 22.7067 64.36 21.48C65.1867 20.2533 66.3467 19.32 67.84 18.68C69.3333 18.0133 71.04 17.68 72.96 17.68C75.84 17.68 78.1733 18.3867 79.96 19.8C81.7733 21.1867 82.7733 23.1333 82.96 25.64H76.8C76.7467 24.68 76.3333 23.8933 75.56 23.28C74.8133 22.64 73.8133 22.32 72.56 22.32C71.4667 22.32 70.5867 22.6 69.92 23.16C69.28 23.72 68.96 24.5333 68.96 25.6C68.96 26.3467 69.2 26.9733 69.68 27.48C70.1867 27.96 70.8 28.36 71.52 28.68C72.2667 28.9733 73.3067 29.32 74.64 29.72C76.4533 30.2533 77.9333 30.7867 79.08 31.32C80.2267 31.8533 81.2133 32.6533 82.04 33.72C82.8667 34.7867 83.28 36.1867 83.28 37.92C83.28 39.4133 82.8933 40.8 82.12 42.08C81.3467 43.36 80.2133 44.3867 78.72 45.16C77.2267 45.9067 75.4533 46.28 73.4 46.28ZM107.855 23.84V46H102.215V43.2C101.495 44.16 100.548 44.92 99.375 45.48C98.2283 46.0133 96.975 46.28 95.615 46.28C93.8817 46.28 92.3483 45.92 91.015 45.2C89.6817 44.4533 88.6283 43.3733 87.855 41.96C87.1083 40.52 86.735 38.8133 86.735 36.84V23.84H92.335V36.04C92.335 37.8 92.775 39.16 93.655 40.12C94.535 41.0533 95.735 41.52 97.255 41.52C98.8017 41.52 100.015 41.0533 100.895 40.12C101.775 39.16 102.215 37.8 102.215 36.04V23.84H107.855ZM116.98 27.04C117.7 26.0267 118.687 25.1867 119.94 24.52C121.22 23.8267 122.674 23.48 124.3 23.48C126.194 23.48 127.9 23.9467 129.42 24.88C130.967 25.8133 132.18 27.1467 133.06 28.88C133.967 30.5867 134.42 32.5733 134.42 34.84C134.42 37.1067 133.967 39.12 133.06 40.88C132.18 42.6133 130.967 43.96 129.42 44.92C127.9 45.88 126.194 46.36 124.3 46.36C122.674 46.36 121.234 46.0267 119.98 45.36C118.754 44.6933 117.754 43.8533 116.98 42.84V56.56H111.38V23.84H116.98V27.04ZM128.7 34.84C128.7 33.5067 128.42 32.36 127.86 31.4C127.327 30.4133 126.607 29.6667 125.7 29.16C124.82 28.6533 123.86 28.4 122.82 28.4C121.807 28.4 120.847 28.6667 119.94 29.2C119.06 29.7067 118.34 30.4533 117.78 31.44C117.247 32.4267 116.98 33.5867 116.98 34.92C116.98 36.2533 117.247 37.4133 117.78 38.4C118.34 39.3867 119.06 40.1467 119.94 40.68C120.847 41.1867 121.807 41.44 122.82 41.44C123.86 41.44 124.82 41.1733 125.7 40.64C126.607 40.1067 127.327 39.3467 127.86 38.36C128.42 37.3733 128.7 36.2 128.7 34.84ZM158.29 34.44C158.29 35.24 158.236 35.96 158.13 36.6H141.93C142.063 38.2 142.623 39.4533 143.61 40.36C144.596 41.2667 145.81 41.72 147.25 41.72C149.33 41.72 150.81 40.8267 151.69 39.04H157.73C157.09 41.1733 155.863 42.9333 154.05 44.32C152.236 45.68 150.01 46.36 147.37 46.36C145.236 46.36 143.316 45.8933 141.61 44.96C139.93 44 138.61 42.6533 137.65 40.92C136.716 39.1867 136.25 37.1867 136.25 34.92C136.25 32.6267 136.716 30.6133 137.65 28.88C138.583 27.1467 139.89 25.8133 141.57 24.88C143.25 23.9467 145.183 23.48 147.37 23.48C149.476 23.48 151.356 23.9333 153.01 24.84C154.69 25.7467 155.983 27.04 156.89 28.72C157.823 30.3733 158.29 32.28 158.29 34.44ZM152.49 32.84C152.463 31.4 151.943 30.2533 150.93 29.4C149.916 28.52 148.676 28.08 147.21 28.08C145.823 28.08 144.65 28.5067 143.69 29.36C142.756 30.1867 142.183 31.3467 141.97 32.84H152.49ZM167.177 27.28C167.897 26.1067 168.831 25.1867 169.977 24.52C171.151 23.8533 172.484 23.52 173.977 23.52V29.4H172.497C170.737 29.4 169.404 29.8133 168.497 30.64C167.617 31.4667 167.177 32.9067 167.177 34.96V46H161.577V23.84H167.177V27.28ZM188.309 28.44H184.429V46H178.749V28.44H176.229V23.84H178.749V22.72C178.749 20 179.522 18 181.069 16.72C182.616 15.44 184.949 14.84 188.069 14.92V19.64C186.709 19.6133 185.762 19.84 185.229 20.32C184.696 20.8 184.429 21.6667 184.429 22.92V23.84H188.309V28.44ZM197.538 16.4V46H191.938V16.4H197.538ZM211.711 46.36C209.578 46.36 207.658 45.8933 205.951 44.96C204.244 44 202.898 42.6533 201.911 40.92C200.951 39.1867 200.471 37.1867 200.471 34.92C200.471 32.6533 200.964 30.6533 201.951 28.92C202.964 27.1867 204.338 25.8533 206.071 24.92C207.804 23.96 209.738 23.48 211.871 23.48C214.004 23.48 215.938 23.96 217.671 24.92C219.404 25.8533 220.764 27.1867 221.751 28.92C222.764 30.6533 223.271 32.6533 223.271 34.92C223.271 37.1867 222.751 39.1867 221.711 40.92C220.698 42.6533 219.311 44 217.551 44.96C215.818 45.8933 213.871 46.36 211.711 46.36ZM211.711 41.48C212.724 41.48 213.671 41.24 214.551 40.76C215.458 40.2533 216.178 39.5067 216.711 38.52C217.244 37.5333 217.511 36.3333 217.511 34.92C217.511 32.8133 216.951 31.2 215.831 30.08C214.738 28.9333 213.391 28.36 211.791 28.36C210.191 28.36 208.844 28.9333 207.751 30.08C206.684 31.2 206.151 32.8133 206.151 34.92C206.151 37.0267 206.671 38.6533 207.711 39.8C208.778 40.92 210.111 41.48 211.711 41.48ZM256.499 23.84L250.019 46H243.979L239.939 30.52L235.899 46H229.819L223.299 23.84H228.979L232.899 40.72L237.139 23.84H243.059L247.219 40.68L251.139 23.84H256.499Z" fill="white"/>\n\t\t\t\t</svg>\n\t\t\t\t'}}}},We=[{name:"Peppa Pig",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Fpeppa_pig.svg?alt=media&token=a9fc83f7-b347-4868-8d52-0e888f0de73a&_gl=1*jzxghx*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMTQ5LjQyLjAuMA.."},{name:"Dazzling Dalmatian",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Fdazzling_dalmatian.svg?alt=media&token=5842b24c-7e58-4bb5-96c2-d09aa11f7f9e&_gl=1*11ayw3z*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQxOTY4LjExLjAuMA.."},{name:"Rosy Rabbit",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Frosy_rabbit.svg?alt=media&token=4e65a9e3-080d-4416-839d-e761b6b37181&_gl=1*156om5t*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMjUzLjYwLjAuMA.."},{name:"Leo the Lion",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Fleo_the_lion.svg?alt=media&token=58d1296e-fefd-42ce-80ea-ae2cc830f1a9&_gl=1*1cz8e9q*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMTAwLjIwLjAuMA.."},{name:"Ducky Down",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Fducky_down.svg?alt=media&token=d67ae889-78c5-46e3-aaa9-3eb511fe90b3&_gl=1*cxyj7o*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQxOTkwLjYwLjAuMA.."},{name:"Merry Monkey",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Fmerry_monkey.svg?alt=media&token=5bd2f69a-7211-42df-9718-5339c467b2d1&_gl=1*1labjed*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMTE3LjMuMC4w"},{name:"Ecstatic Elephant",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Fecstatic_elephant.svg?alt=media&token=fbd2ba76-6c3a-47a7-beac-0460a2178b7d&_gl=1*aku3ps*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMDA3LjQzLjAuMA.."},{name:"Baby Bear",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Fbaby_bear.svg?alt=media&token=71d0c5fb-60aa-4304-adc1-635a83650bde&_gl=1*1dxajmf*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQxMjQyLjUyLjAuMA.."},{name:"Freddy Froglet",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Ffreddy_froglet.svg?alt=media&token=e3b2e292-6480-4507-9da3-21a62a1346d4&_gl=1*s4yycs*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMDQzLjcuMC4w"},{name:"Powerful Panda",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Fpowerful_panda.svg?alt=media&token=07f9d60f-aa14-4a77-ad5b-c48ee76db3f5&_gl=1*7gfuit*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMTkzLjYwLjAuMA.."},{name:"Curious Cat",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Fcurious_cat.svg?alt=media&token=dccf6824-3b7c-4e4e-8559-40fbb8ff6186&_gl=1*1nwi0ti*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQxOTM3LjQyLjAuMA.."},{name:"Playful Penguin",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Fplayful_penguin.svg?alt=media&token=c6d1b11a-43a6-4001-ae56-e04fd5a3f965&_gl=1*1xdxvkx*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMTYzLjI4LjAuMA.."},{name:"Kind Koala",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Fkind_koala.svg?alt=media&token=974396d6-6ccd-4367-8563-b27634849cb5&_gl=1*1w1gbnn*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMDgwLjQwLjAuMA.."},{name:"Tommy Tiger",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Ftommy_tiger.svg?alt=media&token=40a95ac7-cc91-4b74-859a-4e2e5964b967&_gl=1*1n0cr0n*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMjczLjQwLjAuMA.."},{name:"Wally Walrus",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Fwally_walrus.svg?alt=media&token=31e02ef2-c986-4724-b987-dca97f84f81b&_gl=1*y5by2c*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMjkxLjIyLjAuMA.."},{name:"Ricky Rhino",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Fricky_rhino.svg?alt=media&token=5d9dafe5-f4de-4f8b-94c1-49e01c776611&_gl=1*zyp4n2*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMjMxLjIyLjAuMA.."},{name:"Oliver Otter",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Foliver_otter.svg?alt=media&token=5298b869-0903-40b2-a702-224a3e0bcd95&_gl=1*aicppz*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMTMxLjYwLjAuMA.."},{name:"Reggie Ratling",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Freggie_ratling.svg?alt=media&token=f37fd4a0-9dbd-403a-bb82-81fdfb63cf88&_gl=1*16lzeql*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMjA3LjQ2LjAuMA.."},{name:"Gentle Giraffe",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Fgentle_giraffe.svg?alt=media&token=f097ec12-e8ce-4d26-bf32-43e470eb7907&_gl=1*11ctuwz*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMDYwLjYwLjAuMA.."},{name:"Fabulous Fox",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Ffabulous_fox.svg?alt=media&token=fe1a4236-af45-427f-a035-1eda417b0682&_gl=1*xyyv1g*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMDIxLjI5LjAuMA.."}],Ze="bugReport",Ke="create",Ye="Sign in to report a bug.",Je="Something went wrong. Please try again.",Qe={console:100,errors:25,network:25},Xe={maxMessageChars:5e3,maxDigestBytes:2048,maxBundleBytes:262144,maxEntryChars:500,maxStackFrames:5,digestListSize:5};const ti=[{pattern:/eyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]*/g,replacement:"[REDACTED_JWT]"},{pattern:/\b(sk|pk|rk)_(live|test)_[A-Za-z0-9]{8,}/g,replacement:"[REDACTED_STRIPE_KEY]"},{pattern:/\bAIza[0-9A-Za-z_-]{35}\b/g,replacement:"[REDACTED_FIREBASE_KEY]"},{pattern:/\bghp_[A-Za-z0-9]{20,}\b/g,replacement:"[REDACTED_GITHUB_TOKEN]"},{pattern:/\bxox[abprs]-[A-Za-z0-9-]{10,}\b/gi,replacement:"[REDACTED_SLACK_TOKEN]"},{pattern:/\b(?:sk|pk|api|key)[_-][A-Za-z0-9]{12,}\b/gi,replacement:"[REDACTED_API_KEY]"},{pattern:/\b[Bb]earer\s+[A-Za-z0-9._-]{16,}/g,replacement:"Bearer [REDACTED]"},{pattern:/\bAuthorization\s*:\s*(?:Bearer|Basic|Token|Digest)?\s*\S+/gi,replacement:"Authorization: [REDACTED]"},{pattern:/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g,replacement:"[REDACTED_EMAIL]"},{pattern:/\b\d{4}[ -]\d{4}[ -]\d{4}[ -]\d{1,4}\b/g,replacement:"[REDACTED_CARD_NUMBER]"},{pattern:/\b\d{13,19}\b/g,replacement:function(t){try{return function(t){try{let e=0,i=!1;for(let n=t.length-1;n>=0;n-=1){let o=Number(t[n]);i&&(o*=2,o>9&&(o-=9)),e+=o,i=!i}return e%10==0}catch{return!0}}(t)?"[REDACTED_CARD_NUMBER]":t}catch{return"[REDACTED_CARD_NUMBER]"}}},{pattern:/\b[A-Fa-f0-9]{40,}\b/g,replacement:"[REDACTED_HEX]"},{pattern:/\b[A-Za-z0-9+/]{40,}={0,2}\b/g,replacement:"[REDACTED_BASE64]"}],ei="__SUPERFLOW_LIVE_SIGNIN__",ii="__sf_signin",ni="guest",oi=[...me,Tt,It,_t,$t,Ot,Nt,Lt,Rt,we,fe,pe,re,"snippyly_google_token",ii,"inject","r","wireframe","velt-version","velt-env"];var ri=Object.freeze({__proto__:null,AGENTS_SIDEBAR_MODE:Rt,AGENT_COMMENTS_MODE:$t,AGENT_FIELD_PREFIXES:Ue,AGENT_PIN_DIALOG_HOLD_MS:Qt,AGENT_PIN_DIALOG_MAX_RESELECTS:3,AGENT_STATUS_MODE:Lt,AGENT_STATUS_RUNNING_TOOLTIP:Pt,ANNOTATION_STATUS_TERMINAL:"terminal",ANNOTATION_TYPE_SUGGESTION:je,ATTRIBUTES:He,AUTO_COMMENT_MODE:It,BUG_REPORT_AUTH_REQUIRED_ERROR:Ye,BUG_REPORT_EVENT_TYPE:Ze,BUG_REPORT_SCHEMA_VERSION:1,BUG_REPORT_SUBMIT_FAILED_ERROR:Je,BUG_REPORT_SUB_EVENT_TYPE_CREATE:Ke,COMMENT_PRIVATE_MODE_TYPE_ORGANIZATION:Ae,DEFAULT_CUSTOMER_METADATA:Ge,DOCUMENT_TITLE_CHANGE_LISTENER_API_KEYS:bt,DRIVE_HOSTS:Fe,DRIVE_NEW_PROD_URL:"app.usesuperflow.com/drive",DRIVE_NEW_STAGING_URL:"superflow-portal-v2-staging.firebaseapp.com/drive",DRIVE_PROD_URL:"drive.usesuperflow.com",DRIVE_STAGING_URL:"superflow-file-viewer-staging.web.app",EMBED_MODE:Tt,EXCLUDED_API_KEYS_FROM_CHECK_PRIORITIES:Ct,EXCLUDED_API_KEYS_FROM_LATEST_VERSION:["I9R2VqG45F5AgpIicnht"],FEEDBACK_MODE:At,FIGMA_DEMO_MODAL:fe,GUEST_USERS:We,LIVE_DEMO_MODAL:ge,LIVE_PREVIEW_SIGN_IN_GLOBAL:ei,LIVE_PREVIEW_SIGN_IN_PARAM:ii,LIVE_PREVIEW_SIGN_OUT_VALUE:ni,LOCATION_STRIPPED_TOOLBAR_PARAMS:me,ONBOARDING_AGENT_BUTTON_LABELS:Re,ONBOARDING_AGENT_BUTTON_STATE:Le,ONBOARDING_AGENT_STATUS_MESSAGE_TYPE:Dt,ONBOARDING_DIAGNOSTICS_MESSAGE_TYPE:jt,ONBOARDING_DIAGNOSTICS_REQUEST_MESSAGE_TYPE:Vt,ONBOARDING_FAILED_AGENT_STATUSES:Bt,ONBOARDING_FETCH_ERROR:zt,ONBOARDING_FINDINGS_FETCH_INTERVAL_MS:3e3,ONBOARDING_FINDINGS_FETCH_MAX_ATTEMPTS:10,ONBOARDING_FINDINGS_FETCH_MAX_ATTEMPTS_PER_RUN:30,ONBOARDING_MAX_AGENT_STATUSES:50,ONBOARDING_MAX_DISMISSED_PROJECTS:20,ONBOARDING_MODE:Nt,ONBOARDING_READY_MESSAGE_TYPE:Ft,ONBOARDING_STATUS_FIRST_MESSAGE_TIMEOUT_MS:2e4,ONBOARDING_STATUS_STALE_MS:Ut,ONBOARDING_VIEWPORT_GUTTER_PX:8,PLACEHOLDER_ORGANIZATION_NAME:yt,PREVIEW_LEAVING_MESSAGE_TYPE:te,PREVIEW_LIVE_DOMAINS:Zt,PREVIEW_LIVE_LABEL_PATTERN:Kt,PREVIEW_LOCATION_MAX_PAGE_LENGTH:2048,PREVIEW_LOCATION_MESSAGE_TYPE:Xt,PREVIEW_LOCATION_PATH:Ot,PREVIEW_LOCATION_STRIPPED_PARAMS:oi,PREVIEW_NAVIGATE_MESSAGE_TYPE:Yt,PREVIEW_PROXY_HOSTS:Wt,PREVIEW_RENDER_PARAM:we,PREVIEW_SHOW_COMMENT_MAX_ANNOTATION_ID_LENGTH:200,PREVIEW_SHOW_COMMENT_MAX_URL_LENGTH:2048,PREVIEW_SHOW_COMMENT_MESSAGE_TYPE:Jt,PROJECT_INSTALL:ve,PROJECT_VERSION:ue,PROJECT_VERSION_DEFAULT_KEY:pe,PROJECT_VERSION_KEY:he,PROXY_DISABLED_DEFAULT_API_KEYS:kt,READ_ONLY_MODE:_t,REVIEW_DOC_ID:ie,REVIEW_MODE:Mt,SCREENSHOT_DISABLED_HOSTS:Ve,SIDEBAR_BUTTON_COUNT_TYPE_FILTER:qe,SIDEBAR_V1_DEFAULT_API_KEYS:St,SNIPPYLY_COMMENT_ID:ne,SNIPPYLY_TOKEN:re,SNIPPYLY_USER:oe,SUPERFLOW_CONTENT_WARNING_SIDEBAR_OPEN:Ne,SUPERFLOW_CUSTOMER_METADATA:Oe,SUPERFLOW_DOCUMENT_METADATA:"sfDocumentMetadata",SUPERFLOW_GUEST_MIGRATION_REFUSED:de,SUPERFLOW_GUEST_MODE:Ce,SUPERFLOW_GUEST_MODE_ALLOW_SIGN_IN:Te,SUPERFLOW_GUEST_USER_BANNER_OPENED:$e,SUPERFLOW_GUEST_USER_MODEL_OPENED:Ie,SUPERFLOW_GUEST_USER_NAME_MODEL_OPENED:"sfGuestUserNameModelOpened",SUPERFLOW_GUEST_USER_NAME_UPDATED:_e,SUPERFLOW_GUEST_USER_TOKEN:ce,SUPERFLOW_NATIVE_SCREENSHOT_PERMISSION:Pe,SUPERFLOW_ONBOARDING_AGENTS_SIDEBAR:qt,SUPERFLOW_ONBOARDING_SIDEBAR_DISMISSED:Ht,SUPERFLOW_PAGE_COMMENTS_HIDDEN:ee,SUPERFLOW_PASSWORD_IS_VALID:Se,SUPERFLOW_PASSWORD_PROTECTED:Ee,SUPERFLOW_PRIVATE_MODE:Me,SUPERFLOW_QUERY_PARAMS_COMMENTS:xe,SUPERFLOW_SAML_CONFIG:De,SUPERFLOW_SIDEBAR_V2_ENABLED:Et,SUPERFLOW_USER_ADMIN:be,SUPERFLOW_USER_CREDENTIAL:ae,SUPERFLOW_USER_CREDENTIAL_EXPIRY_MARGIN_MS:le,SUPERFLOW_USER_TOKEN:se,SUPERFLOW_USE_PAGE_TITLE_AS_LOCATION_NAME:ke,SUPERFLOW_VERSION:ft,SYSTEM_AGENT_IDS:Be,TAGS:ze,TELEMETRY_BUFFER_CAPS:Qe,TELEMETRY_REDACTION_RULES:ti,TELEMETRY_SIZE_LIMITS:Xe,TOUR_COMMENT_TOOLTIP:ye,UNKNOWN_AGENT_NAME:Gt,VELT_PROXY_FLAG:xt,VELT_SDK_DEVELOP_VERSION:mt,VELT_SDK_PROD_VERSION:wt,VELT_SDK_STAGING_VERSION:"6.0.34"});const si=!0,ai="https://superflow-portal-v2-staging.firebaseapp.com/",li="https://superflow-portal-v2-staging.firebaseapp.com/settings/billing",ci="9dbcd2509e0fa90a5c81f038ce618e3f",di="6d24f74f12f6fb84c87efa8f791cfb2e",hi="https://us-central1-snipply-sdk-staging.cloudfunctions.net/sa",ui="https://us-central1-snipply-sdk-staging.cloudfunctions.net/superflowtoolbarhandler",pi=function(t){const e=[];let i=0;for(let n=0;n<t.length;n++){let o=t.charCodeAt(n);o<128?e[i++]=o:o<2048?(e[i++]=o>>6|192,e[i++]=63&o|128):55296==(64512&o)&&n+1<t.length&&56320==(64512&t.charCodeAt(n+1))?(o=65536+((1023&o)<<10)+(1023&t.charCodeAt(++n)),e[i++]=o>>18|240,e[i++]=o>>12&63|128,e[i++]=o>>6&63|128,e[i++]=63&o|128):(e[i++]=o>>12|224,e[i++]=o>>6&63|128,e[i++]=63&o|128)}return e},vi={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray(t,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();const i=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,n=[];for(let e=0;e<t.length;e+=3){const o=t[e],r=e+1<t.length,s=r?t[e+1]:0,a=e+2<t.length,l=a?t[e+2]:0,c=o>>2,d=(3&o)<<4|s>>4;let h=(15&s)<<2|l>>6,u=63&l;a||(u=64,r||(h=64)),n.push(i[c],i[d],i[h],i[u])}return n.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(pi(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):function(t){const e=[];let i=0,n=0;for(;i<t.length;){const o=t[i++];if(o<128)e[n++]=String.fromCharCode(o);else if(o>191&&o<224){const r=t[i++];e[n++]=String.fromCharCode((31&o)<<6|63&r)}else if(o>239&&o<365){const r=((7&o)<<18|(63&t[i++])<<12|(63&t[i++])<<6|63&t[i++])-65536;e[n++]=String.fromCharCode(55296+(r>>10)),e[n++]=String.fromCharCode(56320+(1023&r))}else{const r=t[i++],s=t[i++];e[n++]=String.fromCharCode((15&o)<<12|(63&r)<<6|63&s)}}return e.join("")}(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();const i=e?this.charToByteMapWebSafe_:this.charToByteMap_,n=[];for(let e=0;e<t.length;){const o=i[t.charAt(e++)],r=e<t.length?i[t.charAt(e)]:0;++e;const s=e<t.length?i[t.charAt(e)]:64;++e;const a=e<t.length?i[t.charAt(e)]:64;if(++e,null==o||null==r||null==s||null==a)throw new gi;const l=o<<2|r>>4;if(n.push(l),64!==s){const t=r<<4&240|s>>2;if(n.push(t),64!==a){const t=s<<6&192|a;n.push(t)}}}return n},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let t=0;t<this.ENCODED_VALS.length;t++)this.byteToCharMap_[t]=this.ENCODED_VALS.charAt(t),this.charToByteMap_[this.byteToCharMap_[t]]=t,this.byteToCharMapWebSafe_[t]=this.ENCODED_VALS_WEBSAFE.charAt(t),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[t]]=t,t>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}};class gi extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const fi=function(t){return function(t){const e=pi(t);return vi.encodeByteArray(e,!0)}(t).replace(/\./g,"")},mi=function(t){try{return vi.decodeString(t,!0)}catch(t){console.error("base64Decode failed: ",t)}return null};
|
|
72
72
|
/**
|
|
73
73
|
* @license
|
|
74
74
|
* Copyright 2022 Google LLC
|
|
@@ -4447,15 +4447,15 @@ class Qc extends Fa{}Qc.Encryptor=class extends Qc{processBlock(t,e){const i=t,n
|
|
|
4447
4447
|
padding: var(--superflow-spacing-lg, 20px);
|
|
4448
4448
|
}
|
|
4449
4449
|
}
|
|
4450
|
-
`;var _h,$h=function(t,e,i,n){for(var o,r=arguments.length,s=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n,a=t.length-1;a>=0;a--)(o=t[a])&&(s=(r<3?o(s):r>3?o(e,i,s):o(e,i))||s);return r>3&&s&&Object.defineProperty(e,i,s),s};!function(t){t.Admin="Admin",t.Commenter="Commenter"}(_h||(_h={}));let Oh=class extends tt{constructor(){super(...arguments),this.apiKey="",this.documentId="",this.disableInvite=!1,this.hasInviteAccess=!0,this.userSeatsExhausted=!1,this.credential=null,this.portalInviteUrl=null,this.userType=_h.Admin,this.showCheckIcon=!1,this.contactListIsHovered=!1,this.invalidEmail=!1,this.isEmailValid=!1,this.inviting=!1,this.searchingUsers=!1,this.emailInput="",this.emailTags=[],this.editingTag=null,this.editingInput="",this.duplicateEmail="",this.filteredContacts=[],this.searchDebounceTimer=null,this.handleOutsideClick=t=>{try{t.target===this&&this.close()}catch(t){console.error("Error in handleOutsideClick:",t)}}}connectedCallback(){try{super.connectedCallback(),document.addEventListener("click",this.handleOutsideClick),this.userSeatsExhausted&&this.userType===_h.Admin&&(this.userType=_h.Commenter)}catch(t){console.error("Error in connectedCallback:",t)}}willUpdate(t){t.has("userSeatsExhausted")&&this.userSeatsExhausted&&this.userType===_h.Admin&&(this.userType=_h.Commenter)}disconnectedCallback(){try{super.disconnectedCallback(),document.removeEventListener("click",this.handleOutsideClick),this.searchDebounceTimer&&clearTimeout(this.searchDebounceTimer)}catch(t){console.error("Error in disconnectedCallback:",t)}}close(){try{this.dispatchEvent(new CustomEvent("superflow-invite-modal-close",{bubbles:!0,composed:!0}))}catch(t){console.error("Error in close:",t)}}validateEmail(t){try{const e=t.replace(/,/g,"").toLowerCase().trim();if(this.emailTags.some((t=>t.email===e)))return this.duplicateEmail=e,!1;if(this.duplicateEmail="",e.includes(" "))return!1;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)}catch(t){return console.error("Error in validateEmail:",t),!1}}async searchUser(t=""){try{if(this.searchDebounceTimer&&clearTimeout(this.searchDebounceTimer),!t.trim())return this.filteredContacts=[],void(this.searchingUsers=!1);this.filteredContacts=[],this.searchingUsers=!1}catch(t){console.error("Error in searchUser:",t),this.searchingUsers=!1}}handleEmailChange(t){try{const e=t.target;this.emailInput=e.value,this.isEmailValid=this.validateEmail(e.value),this.searchUser(e.value)}catch(t){console.error("Error in handleEmailChange:",t)}}handleKeyUp(t){try{if(!this.emailInput)return this.invalidEmail=!1,void(this.isEmailValid=!1);if("Backspace"===t.code)return void(this.invalidEmail=!1);if("Enter"!==t.code&&"Comma"!==t.code)return;const e=this.emailInput.replace(/,/g,"").trim();if(!e)return;this.validateEmail(e)?(this.addEmailTag(e),this.emailInput="",this.invalidEmail=!1):(this.invalidEmail=!0,setTimeout((()=>{this.invalidEmail=!1}),1500))}catch(t){console.error("Error in handleKeyUp:",t)}}handlePaste(t){var e,i;try{t.preventDefault();const n=((null===(e=t.clipboardData)||void 0===e?void 0:e.getData("text"))||"").split(/[,\n|;]/).map((t=>t.trim())).filter((t=>t.length>0));let o=!1;n.forEach((t=>{this.emailTags.some((e=>e.email===t))?(this.duplicateEmail=t,this.emailInput=t,o=!0):this.validateEmail(t)?this.addEmailTag(t):(o=!0,this.emailInput=t)})),o&&(this.invalidEmail=!0,setTimeout((()=>{this.invalidEmail=!1}),1500)),null===(i=this.mainInput)||void 0===i||i.focus()}catch(t){console.error("Error in handlePaste:",t)}}addEmailTag(t){var e;try{if(!t)return;if(!this.validateEmail(t))return void(this.invalidEmail=!this.duplicateEmail);this.emailTags=[...this.emailTags,{name:"",email:t.toLowerCase().trim(),type:this.userType}],this.invalidEmail=!1,this.duplicateEmail="",this.emailInput="",this.contactListIsHovered=!1,null===(e=this.mainInput)||void 0===e||e.focus()}catch(t){console.error("Error in addEmailTag:",t)}}removeTag(t,e){var i;try{e.stopPropagation(),this.emailTags=this.emailTags.filter((e=>e.email!==t.email)),0===this.emailTags.length&&(this.isEmailValid=!1),null===(i=this.mainInput)||void 0===i||i.focus()}catch(e){console.error("Error in removeTag:",e)}}startEditingTag(t,e){try{e.stopPropagation(),this.editingTag=t,this.editingInput=t.email,setTimeout((()=>{var t;null===(t=this.editInput)||void 0===t||t.focus()}),100)}catch(e){console.error("Error in startEditingTag:",e)}}handleEditKeyUp(t){try{if("Enter"!==t.code&&"Escape"!==t.code)return;"Enter"===t.code&&this.editingInput&&this.validateEmail(this.editingInput)?this.updateEmailTag():this.cancelEmailTagEdit()}catch(t){console.error("Error in handleEditKeyUp:",t)}}updateEmailTag(){try{if(!this.editingTag||!this.validateEmail(this.editingInput))return void this.cancelEmailTagEdit();const t=this.emailTags.findIndex((t=>{var e;return t.email===(null===(e=this.editingTag)||void 0===e?void 0:e.email)}));if(-1===t)return void this.cancelEmailTagEdit();this.emailTags=[...this.emailTags.slice(0,t),{...this.editingTag,email:this.editingInput.toLowerCase().trim(),type:this.userType},...this.emailTags.slice(t+1)],this.cancelEmailTagEdit()}catch(t){console.error("Error in updateEmailTag:",t)}}cancelEmailTagEdit(){var t;try{this.editingTag=null,this.editingInput="",null===(t=this.mainInput)||void 0===t||t.focus()}catch(t){console.error("Error in cancelEmailTagEdit:",t)}}async copyReviewLink(){try{let t=window.location.href;const e=new URL(t);e.searchParams.has("review")&&"true"===e.searchParams.get("review")||(e.searchParams.set("review","true"),t=e.toString()),await navigator.clipboard.writeText(t),this.showCheckIcon=!0,setTimeout((()=>{this.showCheckIcon=!1}),2e3)}catch(t){console.error("Error copying review link:",t)}}setUserType(t){try{this.userType=t,this.emailTags=this.emailTags.map((t=>({...t,type:this.userType})))}catch(t){console.error("Error in setUserType:",t)}}async sendInvites(){try{if(this.portalInviteUrl)return;if(this.disableInvite)return void this.dispatchEvent(new CustomEvent("superflow-invite-modal-invite-clicked",{detail:this.emailTags.map((t=>({email:t.email,type:t.type}))),bubbles:!0,composed:!0}));if(""!==this.emailInput.trim()&&this.isEmailValid&&(this.emailTags=[...this.emailTags,{name:"",email:this.emailInput.toLowerCase().trim(),type:this.userType}]),this.emailInput="",this.inviting=!0,this.userType===_h.Commenter)await this.addCommenter();else{if(this.userType!==_h.Admin)throw new Error("No User Type Selected");await this.addAdmin()}this.inviting=!1,this.close()}catch(t){console.error("Error sending invites:",t),this.inviting=!1}}async addAdmin(){try{if(0===this.emailTags.length)throw new Error("No email tags");const t=this.emailTags.map((t=>({email:t.email})));if(!await vh(this.apiKey,t,this.credential))throw new Error("Failed to add admin users");this.dispatchEvent(new CustomEvent("superflow-invite-modal-invite-success",{detail:{users:t,type:"admin"},bubbles:!0,composed:!0}))}catch(t){throw console.error("Error adding admin:",t),t}}async addCommenter(){try{if(!this.emailTags.length)throw new Error("No email tags");const t=this.emailTags.map((t=>({email:t.email})));if(!await gh(this.apiKey,this.documentId,t,this.credential))throw new Error("Failed to add commenter users");this.dispatchEvent(new CustomEvent("superflow-invite-modal-invite-success",{detail:{users:t,type:"commenter"},bubbles:!0,composed:!0}))}catch(t){throw console.error("Error adding commenter:",t),t}}renderPortalInvite(){return R`
|
|
4450
|
+
`;var _h,$h=function(t,e,i,n){for(var o,r=arguments.length,s=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n,a=t.length-1;a>=0;a--)(o=t[a])&&(s=(r<3?o(s):r>3?o(e,i,s):o(e,i))||s);return r>3&&s&&Object.defineProperty(e,i,s),s};!function(t){t.Admin="Admin",t.Commenter="Commenter"}(_h||(_h={}));let Oh=class extends tt{constructor(){super(...arguments),this.apiKey="",this.documentId="",this.disableInvite=!1,this.hasInviteAccess=!0,this.userSeatsExhausted=!1,this.credential=null,this.portalInviteUrl=null,this.portalInviteKind="project",this.userType=_h.Admin,this.showCheckIcon=!1,this.contactListIsHovered=!1,this.invalidEmail=!1,this.isEmailValid=!1,this.inviting=!1,this.searchingUsers=!1,this.emailInput="",this.emailTags=[],this.editingTag=null,this.editingInput="",this.duplicateEmail="",this.filteredContacts=[],this.searchDebounceTimer=null,this.handleOutsideClick=t=>{try{t.target===this&&this.close()}catch(t){console.error("Error in handleOutsideClick:",t)}}}connectedCallback(){try{super.connectedCallback(),document.addEventListener("click",this.handleOutsideClick),this.userSeatsExhausted&&this.userType===_h.Admin&&(this.userType=_h.Commenter)}catch(t){console.error("Error in connectedCallback:",t)}}willUpdate(t){t.has("userSeatsExhausted")&&this.userSeatsExhausted&&this.userType===_h.Admin&&(this.userType=_h.Commenter)}disconnectedCallback(){try{super.disconnectedCallback(),document.removeEventListener("click",this.handleOutsideClick),this.searchDebounceTimer&&clearTimeout(this.searchDebounceTimer)}catch(t){console.error("Error in disconnectedCallback:",t)}}close(){try{this.dispatchEvent(new CustomEvent("superflow-invite-modal-close",{bubbles:!0,composed:!0}))}catch(t){console.error("Error in close:",t)}}validateEmail(t){try{const e=t.replace(/,/g,"").toLowerCase().trim();if(this.emailTags.some((t=>t.email===e)))return this.duplicateEmail=e,!1;if(this.duplicateEmail="",e.includes(" "))return!1;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)}catch(t){return console.error("Error in validateEmail:",t),!1}}async searchUser(t=""){try{if(this.searchDebounceTimer&&clearTimeout(this.searchDebounceTimer),!t.trim())return this.filteredContacts=[],void(this.searchingUsers=!1);this.filteredContacts=[],this.searchingUsers=!1}catch(t){console.error("Error in searchUser:",t),this.searchingUsers=!1}}handleEmailChange(t){try{const e=t.target;this.emailInput=e.value,this.isEmailValid=this.validateEmail(e.value),this.searchUser(e.value)}catch(t){console.error("Error in handleEmailChange:",t)}}handleKeyUp(t){try{if(!this.emailInput)return this.invalidEmail=!1,void(this.isEmailValid=!1);if("Backspace"===t.code)return void(this.invalidEmail=!1);if("Enter"!==t.code&&"Comma"!==t.code)return;const e=this.emailInput.replace(/,/g,"").trim();if(!e)return;this.validateEmail(e)?(this.addEmailTag(e),this.emailInput="",this.invalidEmail=!1):(this.invalidEmail=!0,setTimeout((()=>{this.invalidEmail=!1}),1500))}catch(t){console.error("Error in handleKeyUp:",t)}}handlePaste(t){var e,i;try{t.preventDefault();const n=((null===(e=t.clipboardData)||void 0===e?void 0:e.getData("text"))||"").split(/[,\n|;]/).map((t=>t.trim())).filter((t=>t.length>0));let o=!1;n.forEach((t=>{this.emailTags.some((e=>e.email===t))?(this.duplicateEmail=t,this.emailInput=t,o=!0):this.validateEmail(t)?this.addEmailTag(t):(o=!0,this.emailInput=t)})),o&&(this.invalidEmail=!0,setTimeout((()=>{this.invalidEmail=!1}),1500)),null===(i=this.mainInput)||void 0===i||i.focus()}catch(t){console.error("Error in handlePaste:",t)}}addEmailTag(t){var e;try{if(!t)return;if(!this.validateEmail(t))return void(this.invalidEmail=!this.duplicateEmail);this.emailTags=[...this.emailTags,{name:"",email:t.toLowerCase().trim(),type:this.userType}],this.invalidEmail=!1,this.duplicateEmail="",this.emailInput="",this.contactListIsHovered=!1,null===(e=this.mainInput)||void 0===e||e.focus()}catch(t){console.error("Error in addEmailTag:",t)}}removeTag(t,e){var i;try{e.stopPropagation(),this.emailTags=this.emailTags.filter((e=>e.email!==t.email)),0===this.emailTags.length&&(this.isEmailValid=!1),null===(i=this.mainInput)||void 0===i||i.focus()}catch(e){console.error("Error in removeTag:",e)}}startEditingTag(t,e){try{e.stopPropagation(),this.editingTag=t,this.editingInput=t.email,setTimeout((()=>{var t;null===(t=this.editInput)||void 0===t||t.focus()}),100)}catch(e){console.error("Error in startEditingTag:",e)}}handleEditKeyUp(t){try{if("Enter"!==t.code&&"Escape"!==t.code)return;"Enter"===t.code&&this.editingInput&&this.validateEmail(this.editingInput)?this.updateEmailTag():this.cancelEmailTagEdit()}catch(t){console.error("Error in handleEditKeyUp:",t)}}updateEmailTag(){try{if(!this.editingTag||!this.validateEmail(this.editingInput))return void this.cancelEmailTagEdit();const t=this.emailTags.findIndex((t=>{var e;return t.email===(null===(e=this.editingTag)||void 0===e?void 0:e.email)}));if(-1===t)return void this.cancelEmailTagEdit();this.emailTags=[...this.emailTags.slice(0,t),{...this.editingTag,email:this.editingInput.toLowerCase().trim(),type:this.userType},...this.emailTags.slice(t+1)],this.cancelEmailTagEdit()}catch(t){console.error("Error in updateEmailTag:",t)}}cancelEmailTagEdit(){var t;try{this.editingTag=null,this.editingInput="",null===(t=this.mainInput)||void 0===t||t.focus()}catch(t){console.error("Error in cancelEmailTagEdit:",t)}}async copyReviewLink(){try{let t=window.location.href;const e=new URL(t);e.searchParams.has("review")&&"true"===e.searchParams.get("review")||(e.searchParams.set("review","true"),t=e.toString()),await navigator.clipboard.writeText(t),this.showCheckIcon=!0,setTimeout((()=>{this.showCheckIcon=!1}),2e3)}catch(t){console.error("Error copying review link:",t)}}setUserType(t){try{this.userType=t,this.emailTags=this.emailTags.map((t=>({...t,type:this.userType})))}catch(t){console.error("Error in setUserType:",t)}}async sendInvites(){try{if(this.portalInviteUrl)return;if(this.disableInvite)return void this.dispatchEvent(new CustomEvent("superflow-invite-modal-invite-clicked",{detail:this.emailTags.map((t=>({email:t.email,type:t.type}))),bubbles:!0,composed:!0}));if(""!==this.emailInput.trim()&&this.isEmailValid&&(this.emailTags=[...this.emailTags,{name:"",email:this.emailInput.toLowerCase().trim(),type:this.userType}]),this.emailInput="",this.inviting=!0,this.userType===_h.Commenter)await this.addCommenter();else{if(this.userType!==_h.Admin)throw new Error("No User Type Selected");await this.addAdmin()}this.inviting=!1,this.close()}catch(t){console.error("Error sending invites:",t),this.inviting=!1}}async addAdmin(){try{if(0===this.emailTags.length)throw new Error("No email tags");const t=this.emailTags.map((t=>({email:t.email})));if(!await vh(this.apiKey,t,this.credential))throw new Error("Failed to add admin users");this.dispatchEvent(new CustomEvent("superflow-invite-modal-invite-success",{detail:{users:t,type:"admin"},bubbles:!0,composed:!0}))}catch(t){throw console.error("Error adding admin:",t),t}}async addCommenter(){try{if(!this.emailTags.length)throw new Error("No email tags");const t=this.emailTags.map((t=>({email:t.email})));if(!await gh(this.apiKey,this.documentId,t,this.credential))throw new Error("Failed to add commenter users");this.dispatchEvent(new CustomEvent("superflow-invite-modal-invite-success",{detail:{users:t,type:"commenter"},bubbles:!0,composed:!0}))}catch(t){throw console.error("Error adding commenter:",t),t}}renderPortalInvite(){const t="prospect"===this.portalInviteKind;return R`
|
|
4451
4451
|
<div class="share-modal">
|
|
4452
4452
|
<div class="share-modal-content">
|
|
4453
4453
|
<div class="share-modal-header">
|
|
4454
4454
|
<div class="share-modal-header-content">
|
|
4455
4455
|
<div class="share-modal-header-title">
|
|
4456
|
-
<h2>${Mh("Invite Users")}</h2>
|
|
4456
|
+
<h2>${t?"Share audit":Mh("Invite Users")}</h2>
|
|
4457
4457
|
</div>
|
|
4458
|
-
<p class="share-modal-header-description"
|
|
4458
|
+
<p class="share-modal-header-description">${t?"Share this audit from the Superflow portal: open the audit and use its Share menu.":"Invite people to this project from the Superflow portal."}</p>
|
|
4459
4459
|
</div>
|
|
4460
4460
|
<button class="close-button" @click=${this.close}>
|
|
4461
4461
|
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
@@ -4470,7 +4470,7 @@ class Qc extends Fa{}Qc.Encryptor=class extends Qc{processBlock(t,e){const i=t,n
|
|
|
4470
4470
|
<p>${this.showCheckIcon?"Copied!":"Review Link"}</p>
|
|
4471
4471
|
</button>
|
|
4472
4472
|
<button class="button-primary portal-invite-button" @click=${this.openPortalToInvite}>
|
|
4473
|
-
Open portal
|
|
4473
|
+
${t?"Open audit":"Open portal"}
|
|
4474
4474
|
</button>
|
|
4475
4475
|
</div>
|
|
4476
4476
|
</div>
|
|
@@ -4646,7 +4646,7 @@ class Qc extends Fa{}Qc.Encryptor=class extends Qc{processBlock(t,e){const i=t,n
|
|
|
4646
4646
|
</div>
|
|
4647
4647
|
</div>
|
|
4648
4648
|
</div>
|
|
4649
|
-
`}};var Nh;Oh.styles=Ih,$h([ot({type:String})],Oh.prototype,"apiKey",void 0),$h([ot({type:String})],Oh.prototype,"documentId",void 0),$h([ot({type:Boolean})],Oh.prototype,"disableInvite",void 0),$h([ot({type:Boolean})],Oh.prototype,"hasInviteAccess",void 0),$h([ot({type:Boolean})],Oh.prototype,"userSeatsExhausted",void 0),$h([ot({attribute:!1})],Oh.prototype,"credential",void 0),$h([ot({attribute:!1})],Oh.prototype,"portalInviteUrl",void 0),$h([rt()],Oh.prototype,"userType",void 0),$h([rt()],Oh.prototype,"showCheckIcon",void 0),$h([rt()],Oh.prototype,"contactListIsHovered",void 0),$h([rt()],Oh.prototype,"invalidEmail",void 0),$h([rt()],Oh.prototype,"isEmailValid",void 0),$h([rt()],Oh.prototype,"inviting",void 0),$h([rt()],Oh.prototype,"searchingUsers",void 0),$h([rt()],Oh.prototype,"emailInput",void 0),$h([rt()],Oh.prototype,"emailTags",void 0),$h([rt()],Oh.prototype,"editingTag",void 0),$h([rt()],Oh.prototype,"editingInput",void 0),$h([rt()],Oh.prototype,"duplicateEmail",void 0),$h([rt()],Oh.prototype,"filteredContacts",void 0),$h([st("#mainInput")],Oh.prototype,"mainInput",void 0),$h([st("#editInput")],Oh.prototype,"editInput",void 0),Oh=$h([it("superflow-invite-modal")],Oh),function(t){t.LOG="log",t.INFO="info",t.WARN="warn",t.ERROR="error",t.DEBUG="debug"}(Nh||(Nh={}));const Lh=new class{constructor(){this.consoleBuffer=[],this.errorBuffer=[],this.networkBuffer=[],this.environmentSnapshot=null,this.installed=!1,this.capturing=!1,this.nativeConsoleMethods={},this.nativeConsoleError=()=>{},this.originalFetch=null,this.originalXhrOpen=null,this.originalXhrSend=null,this.handleWindowError=t=>{try{const e=(null==t?void 0:t.error)instanceof Error?t.error:null==t?void 0:t.message;this.captureErrorEntry(this.describeErrorMessage(e),this.extractStackFrames(null==t?void 0:t.error),"error")}catch(t){this.logInternalError("handleWindowError",t)}},this.handleUnhandledRejection=t=>{try{const e=null==t?void 0:t.reason;this.captureErrorEntry(this.describeErrorMessage(e),this.extractStackFrames(e),"unhandledrejection")}catch(t){this.logInternalError("handleUnhandledRejection",t)}}}install(){try{if(this.installed)return;this.installed=!0,this.captureEnvironmentSnapshot(),this.installConsolePatch(),this.installErrorListeners(),this.installNetworkPatch()}catch(t){this.logInternalError("install",t)}}teardown(){try{this.restoreConsolePatch(),this.removeErrorListeners(),this.restoreNetworkPatch(),this.installed=!1}catch(t){this.logInternalError("teardown",t)}}buildDigest(t){var e;try{const i={schemaVersion:1,capturedAt:Date.now(),route:t.route,env:null!==(e=this.environmentSnapshot)&&void 0!==e?e:this.buildFallbackEnvironment(),workspaceId:null,projectId:t.projectId,userId:t.userId,userEmail:t.userEmail,sentryEventId:null,counts:{console:this.consoleBuffer.length,errors:this.errorBuffer.length,networkFailures:this.networkBuffer.length,navigations:0,interactions:0},topErrors:this.buildTopErrors(),recentNetworkFailures:this.takeMostRecent(this.networkBuffer,Xe.digestListSize),recentNavigations:[],truncated:!1};return this.shrinkDigestToFit(i)}catch(t){throw this.logInternalError("buildDigest",t),t}}buildBundle(){var t;try{const e={schemaVersion:1,capturedAt:Date.now(),env:null!==(t=this.environmentSnapshot)&&void 0!==t?t:this.buildFallbackEnvironment(),console:[...this.consoleBuffer],errors:[...this.errorBuffer],network:[...this.networkBuffer],navigation:[],interactions:[],truncated:!1};return this.shrinkBundleToFit(e)}catch(t){throw this.logInternalError("buildBundle",t),t}}captureEnvironmentSnapshot(){var t,e,i,n,o;try{const r=window.navigator;this.environmentSnapshot={release:"",environmentName:"",userAgent:null!==(t=null==r?void 0:r.userAgent)&&void 0!==t?t:"",viewport:`${window.innerWidth}x${window.innerHeight}`,devicePixelRatio:window.devicePixelRatio||1,language:null!==(e=null==r?void 0:r.language)&&void 0!==e?e:"",timezone:null!==(i=Intl.DateTimeFormat().resolvedOptions().timeZone)&&void 0!==i?i:"",connection:null!==(o=null===(n=null==r?void 0:r.connection)||void 0===n?void 0:n.effectiveType)&&void 0!==o?o:null,deviceMemoryGb:"number"==typeof(null==r?void 0:r.deviceMemory)?r.deviceMemory:null}}catch(t){this.logInternalError("captureEnvironmentSnapshot",t),this.environmentSnapshot=this.buildFallbackEnvironment()}}buildFallbackEnvironment(){try{return{release:"",environmentName:"",userAgent:"",viewport:"",devicePixelRatio:1,language:"",timezone:"",connection:null,deviceMemoryGb:null}}catch(t){throw this.logInternalError("buildFallbackEnvironment",t),t}}setEnvironmentContext(t,e){try{this.environmentSnapshot||this.captureEnvironmentSnapshot(),this.environmentSnapshot&&(this.environmentSnapshot.release=null!=t?t:"",this.environmentSnapshot.environmentName=null!=e?e:"")}catch(t){this.logInternalError("setEnvironmentContext",t)}}installConsolePatch(){var t;try{const e=window.console,i=[Nh.LOG,Nh.INFO,Nh.WARN,Nh.ERROR,Nh.DEBUG];for(const t of i){const i=e[t];"function"==typeof i&&(this.nativeConsoleMethods[t]=i,e[t]=this.wrapNativeConsoleMethod(t,i))}this.nativeConsoleError=null!==(t=this.nativeConsoleMethods[Nh.ERROR])&&void 0!==t?t:()=>{}}catch(t){this.logInternalError("installConsolePatch",t)}}restoreConsolePatch(){try{const t=window.console;for(const[e,i]of Object.entries(this.nativeConsoleMethods))"function"==typeof i&&(t[e]=i);this.nativeConsoleMethods={}}catch(t){this.logInternalError("restoreConsolePatch",t)}}wrapNativeConsoleMethod(t,e){try{return(...i)=>{try{if(!this.capturing){this.capturing=!0;try{this.captureConsoleEntry(t,i)}finally{this.capturing=!1}}}catch(t){this.logInternalError("wrapNativeConsoleMethod capture",t)}finally{try{e.apply(window.console,i)}catch{}}}}catch(t){return this.logInternalError("wrapNativeConsoleMethod",t),e}}captureConsoleEntry(t,e){try{const i=this.truncate(this.redact(this.serialiseConsoleArgs(e))),n={ts:Date.now(),level:t,message:i};this.pushBounded(this.consoleBuffer,n,Qe.console)}catch(t){this.logInternalError("captureConsoleEntry",t)}}installErrorListeners(){try{window.addEventListener("error",this.handleWindowError),window.addEventListener("unhandledrejection",this.handleUnhandledRejection)}catch(t){this.logInternalError("installErrorListeners",t)}}removeErrorListeners(){try{window.removeEventListener("error",this.handleWindowError),window.removeEventListener("unhandledrejection",this.handleUnhandledRejection)}catch(t){this.logInternalError("removeErrorListeners",t)}}captureErrorEntry(t,e,i){try{const n={ts:Date.now(),message:this.truncate(this.redact(t)),source:i,stack:e};this.pushBounded(this.errorBuffer,n,Qe.errors)}catch(t){this.logInternalError("captureErrorEntry",t)}}describeErrorMessage(t){try{return t instanceof Error?t.message||t.name||"Unknown error":"string"==typeof t?t:this.safeStringify(t)}catch(t){return this.logInternalError("describeErrorMessage",t),"Unknown error"}}extractStackFrames(t){try{return t instanceof Error&&"string"==typeof t.stack?t.stack.split("\n").slice(1,1+Xe.maxStackFrames).map((t=>this.redact(t.trim()))).filter((t=>t.length>0)):[]}catch(t){return this.logInternalError("extractStackFrames",t),[]}}installNetworkPatch(){try{this.installFetchPatch(),this.installXhrPatch()}catch(t){this.logInternalError("installNetworkPatch",t)}}restoreNetworkPatch(){try{this.originalFetch&&(window.fetch=this.originalFetch,this.originalFetch=null),this.originalXhrOpen&&(XMLHttpRequest.prototype.open=this.originalXhrOpen,this.originalXhrOpen=null),this.originalXhrSend&&(XMLHttpRequest.prototype.send=this.originalXhrSend,this.originalXhrSend=null)}catch(t){this.logInternalError("restoreNetworkPatch",t)}}installFetchPatch(){try{if("function"!=typeof window.fetch)return;this.originalFetch=window.fetch;const t=this.originalFetch;window.fetch=(...e)=>this.dispatchFetch(t,e)}catch(t){this.logInternalError("installFetchPatch",t)}}dispatchFetch(t,e){const i=Date.now(),n=e[0],o=e[1];return t.apply(window,e).then((t=>{try{t.ok||this.captureNetworkEntry(this.resolveRequestMethod(n,o),this.resolveRequestUrl(n),t.status,Date.now()-i)}catch(t){this.logInternalError("dispatchFetch success handler",t)}return t})).catch((t=>{try{this.captureNetworkEntry(this.resolveRequestMethod(n,o),this.resolveRequestUrl(n),0,Date.now()-i)}catch(t){this.logInternalError("dispatchFetch failure handler",t)}throw t}))}resolveRequestUrl(t){try{const e=t instanceof Request?t.url:String(t);return this.sanitiseUrl(e)}catch(t){return this.logInternalError("resolveRequestUrl",t),""}}resolveRequestMethod(t,e){try{return(null==e?void 0:e.method)?e.method.toUpperCase():t instanceof Request&&t.method?t.method.toUpperCase():"GET"}catch(t){return this.logInternalError("resolveRequestMethod",t),"GET"}}sanitiseUrl(t){try{const e=new URL(t,window.location.origin);return`${e.origin}${e.pathname}`}catch(t){return this.logInternalError("sanitiseUrl",t),""}}installXhrPatch(){try{const t=XMLHttpRequest.prototype.open,e=XMLHttpRequest.prototype.send;this.originalXhrOpen=t,this.originalXhrSend=e;const i=(t,e)=>this.handleXhrLoadEnd(t,e);XMLHttpRequest.prototype.open=function(e,i,...n){return this.A=e,this.I=String(i),t.call(this,e,i,...n)},XMLHttpRequest.prototype.send=function(...t){const n=Date.now();return this.addEventListener("loadend",(()=>{try{i(this,n)}catch(t){console.warn("Error in BugTelemetry xhr loadend handler: ",t)}})),e.apply(this,t)}}catch(t){this.logInternalError("installXhrPatch",t)}}handleXhrLoadEnd(t,e){var i,n;try{const o=t.status;if(!(0===o||o>=400))return;this.captureNetworkEntry((null!==(i=t.A)&&void 0!==i?i:"GET").toUpperCase(),this.sanitiseUrl(null!==(n=t.I)&&void 0!==n?n:""),o,Date.now()-e)}catch(t){this.logInternalError("handleXhrLoadEnd",t)}}captureNetworkEntry(t,e,i,n){try{const o={ts:Date.now(),method:t,url:e,status:i,durationMs:n};this.pushBounded(this.networkBuffer,o,Qe.network)}catch(t){this.logInternalError("captureNetworkEntry",t)}}redact(t){try{let e=t;for(const t of ti)t.replacement,e=e.replace(t.pattern,t.replacement);return e}catch(e){return this.logInternalError("redact",e),t}}truncate(t){try{return t.length<=Xe.maxEntryChars?t:`${t.slice(0,Xe.maxEntryChars-3)}...`}catch(e){return this.logInternalError("truncate",e),t}}serialiseConsoleArgs(t){try{return t.map((t=>"string"==typeof t?t:this.safeStringify(t))).join(" ")}catch(t){return this.logInternalError("serialiseConsoleArgs",t),"[unserialisable console arguments]"}}safeStringify(t){try{if("string"==typeof t)return t;if(t instanceof Error)return`${t.name}: ${t.message}`;if("undefined"!=typeof Node&&t instanceof Node)return this.describeDomNode(t);const e=new WeakSet,i=JSON.stringify(t,((t,i)=>this.replaceForSerialisation(i,e)));return null!=i?i:this.stringifyFallback(t)}catch(e){return this.logInternalError("safeStringify",e),this.stringifyFallback(t)}}replaceForSerialisation(t,e){try{if("object"==typeof t&&null!==t){if(e.has(t))return"[Circular]";e.add(t)}return t instanceof Error?`${t.name}: ${t.message}`:"undefined"!=typeof Node&&t instanceof Node?this.describeDomNode(t):t}catch{return"[Unserialisable]"}}describeDomNode(t){try{const e=t;return`<${(null==e?void 0:e.tagName)?e.tagName.toLowerCase():t.nodeName}>`}catch(t){return this.logInternalError("describeDomNode",t),"[DOMNode]"}}stringifyFallback(t){try{return String(t)}catch(t){return this.logInternalError("stringifyFallback",t),"[Unserialisable]"}}buildTopErrors(){try{const t=new Map;for(const e of this.errorBuffer)this.mergeErrorIntoSummaries(t,e);return Array.from(t.values()).sort(((t,e)=>e.lastSeenTs-t.lastSeenTs)).slice(0,Xe.digestListSize)}catch(t){return this.logInternalError("buildTopErrors",t),[]}}mergeErrorIntoSummaries(t,e){try{const i=this.normaliseErrorMessage(e.message),n=t.get(i);if(n)return n.count+=1,n.firstSeenTs=Math.min(n.firstSeenTs,e.ts),void(n.lastSeenTs=Math.max(n.lastSeenTs,e.ts));t.set(i,{message:e.message,count:1,firstSeenTs:e.ts,lastSeenTs:e.ts})}catch(t){this.logInternalError("mergeErrorIntoSummaries",t)}}normaliseErrorMessage(t){try{return t.toLowerCase().replace(/\d/g,"0").replace(/\s+/g," ").trim()}catch(e){return this.logInternalError("normaliseErrorMessage",e),t}}shrinkDigestToFit(t){try{if(this.byteSize(t)<=Xe.maxDigestBytes)return t;let e={...t,recentNavigations:[],truncated:!0};return this.byteSize(e)<=Xe.maxDigestBytes?e:(e={...e,recentNetworkFailures:[]},this.byteSize(e)<=Xe.maxDigestBytes?e:this.shrinkTopErrors(e))}catch(t){throw this.logInternalError("shrinkDigestToFit",t),t}}shrinkTopErrors(t){try{let e=[...t.topErrors],i={...t,topErrors:e};for(;e.length>1&&this.byteSize(i)>Xe.maxDigestBytes;)e=e.slice(0,-1),i={...i,topErrors:e};return this.byteSize(i)<=Xe.maxDigestBytes?i:this.truncateTopErrorMessages(i)}catch(e){return this.logInternalError("shrinkTopErrors",e),{...t,topErrors:[],truncated:!0}}}truncateTopErrorMessages(t){try{let e=200;for(;e>=10;){const i=t.topErrors.map((t=>({...t,message:t.message.slice(0,e)}))),n={...t,topErrors:i,truncated:!0};if(this.byteSize(n)<=Xe.maxDigestBytes)return n;e=Math.floor(e/2)}return{...t,topErrors:[],truncated:!0}}catch(e){return this.logInternalError("truncateTopErrorMessages",e),{...t,topErrors:[],truncated:!0}}}shrinkBundleToFit(t){try{if(this.byteSize(t)<=Xe.maxBundleBytes)return t;const e={...t,console:[...t.console],errors:[...t.errors],network:[...t.network],navigation:[],interactions:[],truncated:!0};for(;this.byteSize(e)>Xe.maxBundleBytes;){const t=this.findOldestNonEmptySection(e);if(!t)break;e[t].shift()}return e}catch(t){throw this.logInternalError("shrinkBundleToFit",t),t}}findOldestNonEmptySection(t){try{const e=["console","errors","network"];let i=null,n=Number.POSITIVE_INFINITY;for(const o of e){const e=t[o];0!==e.length&&(e[0].ts<n&&(n=e[0].ts,i=o))}return i}catch(t){return this.logInternalError("findOldestNonEmptySection",t),null}}byteSize(t){try{return(new TextEncoder).encode(JSON.stringify(t)).length}catch(t){return this.logInternalError("byteSize",t),Number.MAX_SAFE_INTEGER}}pushBounded(t,e,i){try{for(t.push(e);t.length>i;)t.shift()}catch(t){this.logInternalError("pushBounded",t)}}takeMostRecent(t,e){try{return t.slice(-e).reverse()}catch(t){return this.logInternalError("takeMostRecent",t),[]}}logInternalError(t,e){var i;try{const n=this.nativeConsoleError||(null===(i=window.console)||void 0===i?void 0:i.error);null==n||n.apply(window.console,[`Error in BugTelemetry ${t}: `,e])}catch{}}};var Rh=function(t,e,i,n){for(var o,r=arguments.length,s=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n,a=t.length-1;a>=0;a--)(o=t[a])&&(s=(r<3?o(s):r>3?o(e,i,s):o(e,i))||s);return r>3&&s&&Object.defineProperty(e,i,s),s};const Ph=l`
|
|
4649
|
+
`}};var Nh;Oh.styles=Ih,$h([ot({type:String})],Oh.prototype,"apiKey",void 0),$h([ot({type:String})],Oh.prototype,"documentId",void 0),$h([ot({type:Boolean})],Oh.prototype,"disableInvite",void 0),$h([ot({type:Boolean})],Oh.prototype,"hasInviteAccess",void 0),$h([ot({type:Boolean})],Oh.prototype,"userSeatsExhausted",void 0),$h([ot({attribute:!1})],Oh.prototype,"credential",void 0),$h([ot({attribute:!1})],Oh.prototype,"portalInviteUrl",void 0),$h([ot({attribute:!1})],Oh.prototype,"portalInviteKind",void 0),$h([rt()],Oh.prototype,"userType",void 0),$h([rt()],Oh.prototype,"showCheckIcon",void 0),$h([rt()],Oh.prototype,"contactListIsHovered",void 0),$h([rt()],Oh.prototype,"invalidEmail",void 0),$h([rt()],Oh.prototype,"isEmailValid",void 0),$h([rt()],Oh.prototype,"inviting",void 0),$h([rt()],Oh.prototype,"searchingUsers",void 0),$h([rt()],Oh.prototype,"emailInput",void 0),$h([rt()],Oh.prototype,"emailTags",void 0),$h([rt()],Oh.prototype,"editingTag",void 0),$h([rt()],Oh.prototype,"editingInput",void 0),$h([rt()],Oh.prototype,"duplicateEmail",void 0),$h([rt()],Oh.prototype,"filteredContacts",void 0),$h([st("#mainInput")],Oh.prototype,"mainInput",void 0),$h([st("#editInput")],Oh.prototype,"editInput",void 0),Oh=$h([it("superflow-invite-modal")],Oh),function(t){t.LOG="log",t.INFO="info",t.WARN="warn",t.ERROR="error",t.DEBUG="debug"}(Nh||(Nh={}));const Lh=new class{constructor(){this.consoleBuffer=[],this.errorBuffer=[],this.networkBuffer=[],this.environmentSnapshot=null,this.installed=!1,this.capturing=!1,this.nativeConsoleMethods={},this.nativeConsoleError=()=>{},this.originalFetch=null,this.originalXhrOpen=null,this.originalXhrSend=null,this.handleWindowError=t=>{try{const e=(null==t?void 0:t.error)instanceof Error?t.error:null==t?void 0:t.message;this.captureErrorEntry(this.describeErrorMessage(e),this.extractStackFrames(null==t?void 0:t.error),"error")}catch(t){this.logInternalError("handleWindowError",t)}},this.handleUnhandledRejection=t=>{try{const e=null==t?void 0:t.reason;this.captureErrorEntry(this.describeErrorMessage(e),this.extractStackFrames(e),"unhandledrejection")}catch(t){this.logInternalError("handleUnhandledRejection",t)}}}install(){try{if(this.installed)return;this.installed=!0,this.captureEnvironmentSnapshot(),this.installConsolePatch(),this.installErrorListeners(),this.installNetworkPatch()}catch(t){this.logInternalError("install",t)}}teardown(){try{this.restoreConsolePatch(),this.removeErrorListeners(),this.restoreNetworkPatch(),this.installed=!1}catch(t){this.logInternalError("teardown",t)}}buildDigest(t){var e;try{const i={schemaVersion:1,capturedAt:Date.now(),route:t.route,env:null!==(e=this.environmentSnapshot)&&void 0!==e?e:this.buildFallbackEnvironment(),workspaceId:null,projectId:t.projectId,userId:t.userId,userEmail:t.userEmail,sentryEventId:null,counts:{console:this.consoleBuffer.length,errors:this.errorBuffer.length,networkFailures:this.networkBuffer.length,navigations:0,interactions:0},topErrors:this.buildTopErrors(),recentNetworkFailures:this.takeMostRecent(this.networkBuffer,Xe.digestListSize),recentNavigations:[],truncated:!1};return this.shrinkDigestToFit(i)}catch(t){throw this.logInternalError("buildDigest",t),t}}buildBundle(){var t;try{const e={schemaVersion:1,capturedAt:Date.now(),env:null!==(t=this.environmentSnapshot)&&void 0!==t?t:this.buildFallbackEnvironment(),console:[...this.consoleBuffer],errors:[...this.errorBuffer],network:[...this.networkBuffer],navigation:[],interactions:[],truncated:!1};return this.shrinkBundleToFit(e)}catch(t){throw this.logInternalError("buildBundle",t),t}}captureEnvironmentSnapshot(){var t,e,i,n,o;try{const r=window.navigator;this.environmentSnapshot={release:"",environmentName:"",userAgent:null!==(t=null==r?void 0:r.userAgent)&&void 0!==t?t:"",viewport:`${window.innerWidth}x${window.innerHeight}`,devicePixelRatio:window.devicePixelRatio||1,language:null!==(e=null==r?void 0:r.language)&&void 0!==e?e:"",timezone:null!==(i=Intl.DateTimeFormat().resolvedOptions().timeZone)&&void 0!==i?i:"",connection:null!==(o=null===(n=null==r?void 0:r.connection)||void 0===n?void 0:n.effectiveType)&&void 0!==o?o:null,deviceMemoryGb:"number"==typeof(null==r?void 0:r.deviceMemory)?r.deviceMemory:null}}catch(t){this.logInternalError("captureEnvironmentSnapshot",t),this.environmentSnapshot=this.buildFallbackEnvironment()}}buildFallbackEnvironment(){try{return{release:"",environmentName:"",userAgent:"",viewport:"",devicePixelRatio:1,language:"",timezone:"",connection:null,deviceMemoryGb:null}}catch(t){throw this.logInternalError("buildFallbackEnvironment",t),t}}setEnvironmentContext(t,e){try{this.environmentSnapshot||this.captureEnvironmentSnapshot(),this.environmentSnapshot&&(this.environmentSnapshot.release=null!=t?t:"",this.environmentSnapshot.environmentName=null!=e?e:"")}catch(t){this.logInternalError("setEnvironmentContext",t)}}installConsolePatch(){var t;try{const e=window.console,i=[Nh.LOG,Nh.INFO,Nh.WARN,Nh.ERROR,Nh.DEBUG];for(const t of i){const i=e[t];"function"==typeof i&&(this.nativeConsoleMethods[t]=i,e[t]=this.wrapNativeConsoleMethod(t,i))}this.nativeConsoleError=null!==(t=this.nativeConsoleMethods[Nh.ERROR])&&void 0!==t?t:()=>{}}catch(t){this.logInternalError("installConsolePatch",t)}}restoreConsolePatch(){try{const t=window.console;for(const[e,i]of Object.entries(this.nativeConsoleMethods))"function"==typeof i&&(t[e]=i);this.nativeConsoleMethods={}}catch(t){this.logInternalError("restoreConsolePatch",t)}}wrapNativeConsoleMethod(t,e){try{return(...i)=>{try{if(!this.capturing){this.capturing=!0;try{this.captureConsoleEntry(t,i)}finally{this.capturing=!1}}}catch(t){this.logInternalError("wrapNativeConsoleMethod capture",t)}finally{try{e.apply(window.console,i)}catch{}}}}catch(t){return this.logInternalError("wrapNativeConsoleMethod",t),e}}captureConsoleEntry(t,e){try{const i=this.truncate(this.redact(this.serialiseConsoleArgs(e))),n={ts:Date.now(),level:t,message:i};this.pushBounded(this.consoleBuffer,n,Qe.console)}catch(t){this.logInternalError("captureConsoleEntry",t)}}installErrorListeners(){try{window.addEventListener("error",this.handleWindowError),window.addEventListener("unhandledrejection",this.handleUnhandledRejection)}catch(t){this.logInternalError("installErrorListeners",t)}}removeErrorListeners(){try{window.removeEventListener("error",this.handleWindowError),window.removeEventListener("unhandledrejection",this.handleUnhandledRejection)}catch(t){this.logInternalError("removeErrorListeners",t)}}captureErrorEntry(t,e,i){try{const n={ts:Date.now(),message:this.truncate(this.redact(t)),source:i,stack:e};this.pushBounded(this.errorBuffer,n,Qe.errors)}catch(t){this.logInternalError("captureErrorEntry",t)}}describeErrorMessage(t){try{return t instanceof Error?t.message||t.name||"Unknown error":"string"==typeof t?t:this.safeStringify(t)}catch(t){return this.logInternalError("describeErrorMessage",t),"Unknown error"}}extractStackFrames(t){try{return t instanceof Error&&"string"==typeof t.stack?t.stack.split("\n").slice(1,1+Xe.maxStackFrames).map((t=>this.redact(t.trim()))).filter((t=>t.length>0)):[]}catch(t){return this.logInternalError("extractStackFrames",t),[]}}installNetworkPatch(){try{this.installFetchPatch(),this.installXhrPatch()}catch(t){this.logInternalError("installNetworkPatch",t)}}restoreNetworkPatch(){try{this.originalFetch&&(window.fetch=this.originalFetch,this.originalFetch=null),this.originalXhrOpen&&(XMLHttpRequest.prototype.open=this.originalXhrOpen,this.originalXhrOpen=null),this.originalXhrSend&&(XMLHttpRequest.prototype.send=this.originalXhrSend,this.originalXhrSend=null)}catch(t){this.logInternalError("restoreNetworkPatch",t)}}installFetchPatch(){try{if("function"!=typeof window.fetch)return;this.originalFetch=window.fetch;const t=this.originalFetch;window.fetch=(...e)=>this.dispatchFetch(t,e)}catch(t){this.logInternalError("installFetchPatch",t)}}dispatchFetch(t,e){const i=Date.now(),n=e[0],o=e[1];return t.apply(window,e).then((t=>{try{t.ok||this.captureNetworkEntry(this.resolveRequestMethod(n,o),this.resolveRequestUrl(n),t.status,Date.now()-i)}catch(t){this.logInternalError("dispatchFetch success handler",t)}return t})).catch((t=>{try{this.captureNetworkEntry(this.resolveRequestMethod(n,o),this.resolveRequestUrl(n),0,Date.now()-i)}catch(t){this.logInternalError("dispatchFetch failure handler",t)}throw t}))}resolveRequestUrl(t){try{const e=t instanceof Request?t.url:String(t);return this.sanitiseUrl(e)}catch(t){return this.logInternalError("resolveRequestUrl",t),""}}resolveRequestMethod(t,e){try{return(null==e?void 0:e.method)?e.method.toUpperCase():t instanceof Request&&t.method?t.method.toUpperCase():"GET"}catch(t){return this.logInternalError("resolveRequestMethod",t),"GET"}}sanitiseUrl(t){try{const e=new URL(t,window.location.origin);return`${e.origin}${e.pathname}`}catch(t){return this.logInternalError("sanitiseUrl",t),""}}installXhrPatch(){try{const t=XMLHttpRequest.prototype.open,e=XMLHttpRequest.prototype.send;this.originalXhrOpen=t,this.originalXhrSend=e;const i=(t,e)=>this.handleXhrLoadEnd(t,e);XMLHttpRequest.prototype.open=function(e,i,...n){return this.A=e,this.I=String(i),t.call(this,e,i,...n)},XMLHttpRequest.prototype.send=function(...t){const n=Date.now();return this.addEventListener("loadend",(()=>{try{i(this,n)}catch(t){console.warn("Error in BugTelemetry xhr loadend handler: ",t)}})),e.apply(this,t)}}catch(t){this.logInternalError("installXhrPatch",t)}}handleXhrLoadEnd(t,e){var i,n;try{const o=t.status;if(!(0===o||o>=400))return;this.captureNetworkEntry((null!==(i=t.A)&&void 0!==i?i:"GET").toUpperCase(),this.sanitiseUrl(null!==(n=t.I)&&void 0!==n?n:""),o,Date.now()-e)}catch(t){this.logInternalError("handleXhrLoadEnd",t)}}captureNetworkEntry(t,e,i,n){try{const o={ts:Date.now(),method:t,url:e,status:i,durationMs:n};this.pushBounded(this.networkBuffer,o,Qe.network)}catch(t){this.logInternalError("captureNetworkEntry",t)}}redact(t){try{let e=t;for(const t of ti)t.replacement,e=e.replace(t.pattern,t.replacement);return e}catch(e){return this.logInternalError("redact",e),t}}truncate(t){try{return t.length<=Xe.maxEntryChars?t:`${t.slice(0,Xe.maxEntryChars-3)}...`}catch(e){return this.logInternalError("truncate",e),t}}serialiseConsoleArgs(t){try{return t.map((t=>"string"==typeof t?t:this.safeStringify(t))).join(" ")}catch(t){return this.logInternalError("serialiseConsoleArgs",t),"[unserialisable console arguments]"}}safeStringify(t){try{if("string"==typeof t)return t;if(t instanceof Error)return`${t.name}: ${t.message}`;if("undefined"!=typeof Node&&t instanceof Node)return this.describeDomNode(t);const e=new WeakSet,i=JSON.stringify(t,((t,i)=>this.replaceForSerialisation(i,e)));return null!=i?i:this.stringifyFallback(t)}catch(e){return this.logInternalError("safeStringify",e),this.stringifyFallback(t)}}replaceForSerialisation(t,e){try{if("object"==typeof t&&null!==t){if(e.has(t))return"[Circular]";e.add(t)}return t instanceof Error?`${t.name}: ${t.message}`:"undefined"!=typeof Node&&t instanceof Node?this.describeDomNode(t):t}catch{return"[Unserialisable]"}}describeDomNode(t){try{const e=t;return`<${(null==e?void 0:e.tagName)?e.tagName.toLowerCase():t.nodeName}>`}catch(t){return this.logInternalError("describeDomNode",t),"[DOMNode]"}}stringifyFallback(t){try{return String(t)}catch(t){return this.logInternalError("stringifyFallback",t),"[Unserialisable]"}}buildTopErrors(){try{const t=new Map;for(const e of this.errorBuffer)this.mergeErrorIntoSummaries(t,e);return Array.from(t.values()).sort(((t,e)=>e.lastSeenTs-t.lastSeenTs)).slice(0,Xe.digestListSize)}catch(t){return this.logInternalError("buildTopErrors",t),[]}}mergeErrorIntoSummaries(t,e){try{const i=this.normaliseErrorMessage(e.message),n=t.get(i);if(n)return n.count+=1,n.firstSeenTs=Math.min(n.firstSeenTs,e.ts),void(n.lastSeenTs=Math.max(n.lastSeenTs,e.ts));t.set(i,{message:e.message,count:1,firstSeenTs:e.ts,lastSeenTs:e.ts})}catch(t){this.logInternalError("mergeErrorIntoSummaries",t)}}normaliseErrorMessage(t){try{return t.toLowerCase().replace(/\d/g,"0").replace(/\s+/g," ").trim()}catch(e){return this.logInternalError("normaliseErrorMessage",e),t}}shrinkDigestToFit(t){try{if(this.byteSize(t)<=Xe.maxDigestBytes)return t;let e={...t,recentNavigations:[],truncated:!0};return this.byteSize(e)<=Xe.maxDigestBytes?e:(e={...e,recentNetworkFailures:[]},this.byteSize(e)<=Xe.maxDigestBytes?e:this.shrinkTopErrors(e))}catch(t){throw this.logInternalError("shrinkDigestToFit",t),t}}shrinkTopErrors(t){try{let e=[...t.topErrors],i={...t,topErrors:e};for(;e.length>1&&this.byteSize(i)>Xe.maxDigestBytes;)e=e.slice(0,-1),i={...i,topErrors:e};return this.byteSize(i)<=Xe.maxDigestBytes?i:this.truncateTopErrorMessages(i)}catch(e){return this.logInternalError("shrinkTopErrors",e),{...t,topErrors:[],truncated:!0}}}truncateTopErrorMessages(t){try{let e=200;for(;e>=10;){const i=t.topErrors.map((t=>({...t,message:t.message.slice(0,e)}))),n={...t,topErrors:i,truncated:!0};if(this.byteSize(n)<=Xe.maxDigestBytes)return n;e=Math.floor(e/2)}return{...t,topErrors:[],truncated:!0}}catch(e){return this.logInternalError("truncateTopErrorMessages",e),{...t,topErrors:[],truncated:!0}}}shrinkBundleToFit(t){try{if(this.byteSize(t)<=Xe.maxBundleBytes)return t;const e={...t,console:[...t.console],errors:[...t.errors],network:[...t.network],navigation:[],interactions:[],truncated:!0};for(;this.byteSize(e)>Xe.maxBundleBytes;){const t=this.findOldestNonEmptySection(e);if(!t)break;e[t].shift()}return e}catch(t){throw this.logInternalError("shrinkBundleToFit",t),t}}findOldestNonEmptySection(t){try{const e=["console","errors","network"];let i=null,n=Number.POSITIVE_INFINITY;for(const o of e){const e=t[o];0!==e.length&&(e[0].ts<n&&(n=e[0].ts,i=o))}return i}catch(t){return this.logInternalError("findOldestNonEmptySection",t),null}}byteSize(t){try{return(new TextEncoder).encode(JSON.stringify(t)).length}catch(t){return this.logInternalError("byteSize",t),Number.MAX_SAFE_INTEGER}}pushBounded(t,e,i){try{for(t.push(e);t.length>i;)t.shift()}catch(t){this.logInternalError("pushBounded",t)}}takeMostRecent(t,e){try{return t.slice(-e).reverse()}catch(t){return this.logInternalError("takeMostRecent",t),[]}}logInternalError(t,e){var i;try{const n=this.nativeConsoleError||(null===(i=window.console)||void 0===i?void 0:i.error);null==n||n.apply(window.console,[`Error in BugTelemetry ${t}: `,e])}catch{}}};var Rh=function(t,e,i,n){for(var o,r=arguments.length,s=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n,a=t.length-1;a>=0;a--)(o=t[a])&&(s=(r<3?o(s):r>3?o(e,i,s):o(e,i))||s);return r>3&&s&&Object.defineProperty(e,i,s),s};const Ph=l`
|
|
4650
4650
|
.s-bug-report-container .s-modal {
|
|
4651
4651
|
width: 460px;
|
|
4652
4652
|
padding: 52px 40px 40px 40px;
|
|
@@ -6593,7 +6593,7 @@ class Qc extends Fa{}Qc.Encryptor=class extends Qc{processBlock(t,e){const i=t,n
|
|
|
6593
6593
|
<div class="error-message">Comments Disabled</div>
|
|
6594
6594
|
</div>
|
|
6595
6595
|
</div>
|
|
6596
|
-
`:null,this.isRequestMode=()=>{try{return function(t){try{if(!t||!0!==t.requestModeSwitch||Bd(t))return!1;const e=t.user;return!(!e||"object"!=typeof e||!0===e.isAnonymous||!0===e.isGuest)&&"string"==typeof t.role&&""!==t.role&&"Admin"!==t.role}catch(t){return console.warn("Error in decideRequestMode: ",t),!1}}({requestModeSwitch:this.requestModeSwitch,user:this.snippylyUser,role:this.snippylyUserRole,embedMode:this.embedMode,readOnlyMode:this.readOnlyMode,onboardingMode:this.onboardingMode,agentStatusMode:this.agentStatusMode,passwordPending:this.passwordProtected&&!this.isPasswordValid})}catch(t){return console.warn("Error in isRequestMode: ",t),!1}},this.isSignedOutRequestMode=()=>{try{return function(t){try{return!(!t||!0!==t.requestModeSwitch||t.loading||Bd(t)||t.user&&"object"==typeof t.user)}catch(t){return console.warn("Error in decideSignedOutRequestMode: ",t),!1}}({requestModeSwitch:this.requestModeSwitch,user:this.snippylyUser,loading:!!this.loading,embedMode:this.embedMode,readOnlyMode:this.readOnlyMode,onboardingMode:this.onboardingMode,agentStatusMode:this.agentStatusMode,passwordPending:this.passwordProtected&&!this.isPasswordValid})}catch(t){return console.warn("Error in isSignedOutRequestMode: ",t),!1}},this.canShowRequestTools=()=>{try{return this.isToolbarStateResolved()&&this.canShowCollaborationTools()}catch(t){return console.warn("Error in canShowRequestTools: ",t),!1}},this.onRequestSignInClick=t=>{try{try{eh(gt.Events.REQUEST_MODE_SIGN_IN_CLICKED,t?{projectId:this.projectId,source:t}:{projectId:this.projectId})}catch(t){console.warn("Error tracking requestModeSignInClicked: ",t)}this.loginWithGoogle()}catch(t){console.warn("Error in onRequestSignInClick: ",t),th("Error in onRequestSignInClick: ",t)}},this.onRequestBadgeClick=()=>{try{if(this.isSignedOutRequestMode()&&this.requestMenuItems(!1).signIn)return this.storeRequestResumeMarker(),void this.onRequestSignInClick("badge");this.openRequestToolbar()}catch(t){console.warn("Error in onRequestBadgeClick: ",t),th("Error in onRequestBadgeClick: ",t)}},this.openRequestToolbar=(t=!0)=>{try{this.requestToolbarExpanded=!0,this.isRequestStateLoading()?this.requestCommentModePending="click":(this.requestCommentModePending=null,t&&this.canEnterRequestCommentMode()&&this.enterRequestCommentMode());try{eh(gt.Events.REQUEST_MODE_OPENED,{projectId:this.projectId})}catch(t){console.warn("Error tracking requestModeOpened: ",t)}this.focusRequestControl('[data-testid="sf-request-collapse"]')}catch(t){console.warn("Error in openRequestToolbar: ",t),th("Error in openRequestToolbar: ",t)}},this.isRequestStateLoading=()=>{try{return!(!this.snippylyUser||"object"!=typeof this.snippylyUser||this.isToolbarStateResolved()&&"waiting"!==this.commentsDisabledSetting)}catch(t){return console.warn("Error in isRequestStateLoading: ",t),!1}},this.canEnterRequestCommentMode=()=>{var t;try{return this.canShowRequestTools()&&!this.readOnlyMode&&"function"==typeof(null===(t=this.commentElement)||void 0===t?void 0:t.enableCommentMode)}catch(t){return console.warn("Error in canEnterRequestCommentMode: ",t),!1}},this.enterRequestCommentMode=()=>{try{this.commentElement.enableCommentMode()}catch(t){console.warn("Error enabling comment mode from the request badge: ",t)}},this.resolvePendingRequestOpen=()=>{try{const t=this.requestCommentModePending;if(!t||!this.isToolbarStateResolved()||"waiting"===this.commentsDisabledSetting)return;if(this.requestCommentModePending=null,!this.isRequestMode())return;this.applyFirstConfigCommentsDisabled();const e="known"===this.commentsDisabledSetting;if("resume"===t)return void(this.requestToolbarExpanded||this.openRequestToolbar(e));e&&this.requestToolbarExpanded&&this.canEnterRequestCommentMode()&&this.enterRequestCommentMode()}catch(t){console.warn("Error in resolvePendingRequestOpen: ",t),th("Error in resolvePendingRequestOpen: ",t)}},this.requestMenuItems=t=>function(t){try{return!t||t.customLogin?{signIn:!1,signOut:!1}:t.signedIn?{signIn:!1,signOut:!0}:{signIn:!t.invalidApiKey,signOut:!1}}catch(t){return console.warn("Error in decideRequestMenu: ",t),{signIn:!1,signOut:!1}}}({signedIn:t,customLogin:!!this.customLoginEnabledLocally,invalidApiKey:!!this.invalidApiKey}),this.storeRequestResumeMarker=()=>{try{window.sessionStorage.setItem(jd,(t={apiKey:this.apiKey,projectId:this.projectId,now:Date.now()},JSON.stringify({v:1,apiKey:t.apiKey||"",projectId:t.projectId||"",expiresAt:t.now+6e5})))}catch(t){console.warn("Error storing the request-mode resume marker: ",t)}var t},this.consumeRequestResumeMarker=()=>{try{let t=null;try{t=window.sessionStorage.getItem(jd),null!==t&&window.sessionStorage.removeItem(jd)}catch(t){return}if(null===t||!this.requestModeSwitch)return;(function(t,e){try{if("string"!=typeof t||!t)return!1;const i=JSON.parse(t);return!!i&&1===i.v&&!!e.apiKey&&i.apiKey===e.apiKey&&!!e.projectId&&i.projectId===e.projectId&&"number"==typeof i.expiresAt&&i.expiresAt>e.now}catch(t){return!1}})(t,{apiKey:this.apiKey,projectId:this.projectId,now:Date.now()})&&(this.requestCommentModePending="resume",this.resolvePendingRequestOpen())}catch(t){console.warn("Error in consumeRequestResumeMarker: ",t)}},this.onRequestCollapseClick=()=>{try{this.closeRequestMenu(),this.requestToolbarExpanded=!1,this.requestCommentModePending=null,this.focusRequestControl('[data-testid="sf-request-badge"]')}catch(t){console.warn("Error in onRequestCollapseClick: ",t),th("Error in onRequestCollapseClick: ",t)}},this.focusRequestControl=t=>{try{this.updateComplete.then((()=>{var e,i,n,o;try{null===(o=null===(n=null===(i=null===(e=this.renderRoot)||void 0===e?void 0:e.querySelector)||void 0===i?void 0:i.call(e,t))||void 0===n?void 0:n.focus)||void 0===o||o.call(n)}catch(t){console.warn("Error focusing the request toolbar: ",t)}})).catch((t=>console.warn("Error waiting to focus the request toolbar: ",t)))}catch(t){console.warn("Error in focusRequestControl: ",t)}},this.onRequestMenuButtonClick=()=>{try{if(this.requestMenuOpen)return void this.closeRequestMenu();this.requestMenuOpen=!0,this.attachRequestMenuListeners()}catch(t){console.warn("Error in onRequestMenuButtonClick: ",t),th("Error in onRequestMenuButtonClick: ",t)}},this.closeRequestMenu=()=>{try{this.requestMenuOpen=!1,this.detachRequestMenuListeners()}catch(t){console.warn("Error in closeRequestMenu: ",t)}},this.onRequestMenuSignOutClick=()=>{try{this.closeRequestMenu(),this.signOutUser()}catch(t){console.warn("Error in onRequestMenuSignOutClick: ",t),th("Error in onRequestMenuSignOutClick: ",t)}},this.onRequestMenuSignInClick=()=>{try{this.closeRequestMenu(),this.onRequestSignInClick()}catch(t){console.warn("Error in onRequestMenuSignInClick: ",t),th("Error in onRequestMenuSignInClick: ",t)}},this.attachRequestMenuListeners=()=>{try{if(this.requestMenuListenersAttached)return;this.requestMenuListenersAttached=!0,document.addEventListener("pointerdown",this.onRequestMenuOutsidePointer,!0),document.addEventListener("keydown",this.onRequestMenuKeydown,!0)}catch(t){console.warn("Error in attachRequestMenuListeners: ",t)}},this.detachRequestMenuListeners=()=>{try{if(!this.requestMenuListenersAttached)return;this.requestMenuListenersAttached=!1,document.removeEventListener("pointerdown",this.onRequestMenuOutsidePointer,!0),document.removeEventListener("keydown",this.onRequestMenuKeydown,!0)}catch(t){console.warn("Error in detachRequestMenuListeners: ",t)}},this.onRequestMenuOutsidePointer=t=>{try{const e="function"==typeof t.composedPath?t.composedPath():[];e.some((t=>{const e=t;return!!(null==e?void 0:e.getAttribute)&&"true"===e.getAttribute("data-request-menu-area")}))||this.closeRequestMenu()}catch(t){console.warn("Error in onRequestMenuOutsidePointer: ",t)}},this.onRequestMenuKeydown=t=>{try{if("Escape"!==t.key||!this.requestMenuOpen)return;this.closeRequestMenu(),this.focusRequestControl('[data-testid="sf-request-menu-button"]')}catch(t){console.warn("Error in onRequestMenuKeydown: ",t)}},this.syncRequestMode=()=>{try{if(!this.isRequestMode())return;if(this.applyFirstConfigCommentsDisabled(),!this.commentElement)return;this.applyRequestModeToCommentElement(),this.ensureAddCommentAnnotationSubscription(),this.requestModeLoadedTracked||(this.requestModeLoadedTracked=!0,eh(gt.Events.REQUEST_MODE_LOADED,{projectId:this.projectId}))}catch(t){console.warn("Error in syncRequestMode: ",t),th("Error in syncRequestMode: ",t)}},this.applyFirstConfigCommentsDisabled=()=>{try{!0===this.firstConfigCommentsDisabled&&!this.allFeatureDisabled&&this.isRequestMode()&&(this.allFeatureDisabled=!0)}catch(t){console.warn("Error in applyFirstConfigCommentsDisabled: ",t)}},this.applyRequestModeToCommentElement=()=>{try{const t=this.commentElement;if(!t||t===this.requestContextProviderElement||"function"!=typeof t.setContextProvider)return;this.requestContextProviderElement=t,t.setContextProvider((()=>this.isRequestMode()?function(t){let e="string"==typeof t?t:"";try{const t=new URL(e);t.searchParams.delete("sf_review"),e=t.toString()}catch(t){}return{sf:{type:"request",visibility:"client",pageUrl:e}}}(window.location.href):void 0))}catch(t){console.warn("Error in applyRequestModeToCommentElement: ",t),th("Error in applyRequestModeToCommentElement: ",t)}},this.onRequestModeAnnotationSaved=t=>{try{if(!this.isRequestMode())return;const{annotationId:e,stamp:i}=function(t){try{const e=t&&"object"==typeof t?t:{},i=e.commentAnnotation&&"object"==typeof e.commentAnnotation?e.commentAnnotation:null,n="string"==typeof e.annotationId&&e.annotationId?e.annotationId:null==i?void 0:i.annotationId,o="string"==typeof n&&n?n:null,r=null==i?void 0:i.context;if(null==r)return{annotationId:o,stamp:"missing"};const s="object"==typeof r?r.sf:void 0;return{annotationId:o,stamp:"request"===(s&&"object"==typeof s?s.type:void 0)?"request":"other"}}catch(t){return console.warn("Error in readSavedAnnotation: ",t),{annotationId:null,stamp:"other"}}}(t),n=!!this.commentElement&&this.requestContextProviderElement===this.commentElement;if(!e||!("request"===i||"missing"===i&&n))return;if(!this.notifyAddedRequest(e))return;try{eh(gt.Events.REQUEST_ADDED,{projectId:this.projectId})}catch(t){console.warn("Error tracking requestAdded: ",t)}}catch(t){console.warn("Error in onRequestModeAnnotationSaved: ",t)}},this.identifySnippyly=async()=>{var t,e,i,n;let o="",r="",s=!1;try{this.invalidApiKey=!1;let n={name:"Default User",email:"default@usesuperflow.com",userId:"default",isAnonymous:!0,organizationId:this.apiKey};const a=this.isRunningUnderLivePreview(),l=a?this.readLiveSignIn():null;let c;c=a?l?{...l.user}:null:this.customLoginEnabled&&this.providedUser?this.providedUser:yd(),ha("[Superflow][identify] resolved user (pre-iam)",{source:a?l?"liveSignIn":"liveGuest":this.customLoginEnabled&&this.providedUser?"providedUser":"token",email:null==c?void 0:c.email,userId:null==c?void 0:c.userId,name:null==c?void 0:c.name,isAnonymous:null==c?void 0:c.isAnonymous});const d=await this.getSamlConfig(),h=new URL(document.location);if(h.searchParams.has(re)&&h.searchParams.delete(re),d&&(this.signInUrl=`${ai}saml/${d.slug}/login?redirect_url=${encodeURIComponent(null==h?void 0:h.toString())}&source=sf`,window.Superflow.signInUrl=this.signInUrl),((null==c?void 0:c.email)||a&&(null==c?void 0:c.userId))&&(n=c),n.isAnonymous)delete n.groupId;else{const t=Velt.getDocumentId()||this.serverDocumentId;t&&(n.groupId=t+"")}if(this.customLoginEnabledLocally||(null===(t=null==n?void 0:n.contacts)||void 0===t?void 0:t.length)&&(n.contacts=[]),o=null==n?void 0:n.email,r=null==n?void 0:n.userId,(null==n?void 0:n.isAnonymous)&&this.projectId&&(this.guestMode||a)){const t=Cd(!0,this.apiKey);t&&(n=JSON.parse(JSON.stringify(t)))}(null==n?void 0:n.isAnonymous)||(this.loading=!0);const u={};(null==n?void 0:n.groupId)&&(u.groupId=null==n?void 0:n.groupId),n.organizationId=this.apiKey;const p=await oh(this.apiKey,this.projectId||"",null==n?void 0:n.email,null==n?void 0:n.userId),v=null==p?void 0:p.isAdmin;this.snippylyUserRole=v?"Admin":"Commenter",this.suggestionRoleLookupFailed="boolean"!=typeof v,this.suggestionViewerRoleResolved=!0,s=!0,this.applySuggestionActionStyles(),ha("[Superflow][identify] iamResponse",p,{isAdminUser:v,snippylyUserRole:this.snippylyUserRole,email:null==n?void 0:n.email,userId:null==n?void 0:n.userId});const g=!(a||this.customLoginEnabled&&this.providedUser);this.identityCameFromToken=g,this.identityLiveSignIn=l;const f=((t,e)=>!(!e||(null==t?void 0:t.isAnonymous)||(null==t?void 0:t.isGuest)||!(null==t?void 0:t.userId)))(n,g),m=f&&((t,e)=>{try{if(!t||!e)return!1;const i=!!e.name&&e.name!==t.name,n=!!e.photoUrl&&e.photoUrl!==t.photoUrl;return ha("[Superflow][identity] hasProfileChanged",{nameChanged:i,photoChanged:n,localName:t.name,savedName:e.name,localPhotoUrl:t.photoUrl,savedPhotoUrl:e.photoUrl}),i||n}catch(t){return console.warn("Error in hasProfileChanged: ",t),th("Error in hasProfileChanged: ",t),!1}})(n,p);if(ha("[Superflow][identify] enrichment gate",{cameFromToken:g,willEnrichIdentity:f,profileChanged:m,forceReset:m,isAnonymous:null==n?void 0:n.isAnonymous,isGuest:null==n?void 0:n.isGuest,userId:null==n?void 0:n.userId,nameBefore:null==n?void 0:n.name}),f&&(n=((t,e)=>t&&e?{...t,name:e.name||t.name,photoUrl:e.photoUrl||t.photoUrl}:t)(n,p),ha("[Superflow][identify] enriched user",{nameAfter:null==n?void 0:n.name,photoUrl:null==n?void 0:n.photoUrl})),v&&(u.isAdmin=v,v&&this.allFeatureDisabled&&(this.allFeatureDisabled=!1)),this.restoreContentWarningSidebarState(),!this.projectDeleted&&(null==n?void 0:n.userId)&&!(null==n?void 0:n.isGuest)&&!(null==n?void 0:n.isAnonymous)&&this.documentId)try{await fh(this.apiKey,this.documentId,n.userId,n.name,n.email,this.credentialFor(n,g))}catch(t){th("checkDocumentUserAndCreateError",t)}ha("[Superflow][identify] setVeltAuthProvider options",{forceReset:m,profileChanged:m,userName:null==n?void 0:n.name,userId:null==n?void 0:n.userId});const[w]=await Promise.all([Velt.setVeltAuthProvider({user:n,options:{throwError:!0,forceReset:m},retryConfig:{retryCount:3,retryDelay:1e3},generateToken:async()=>{if(this.fallBackToGuestIfLiveSignInExpired(l))return null;const t=this.credentialFor(n,g),e=await dh(this.apiKey,null==n?void 0:n.userId,u,t);return this.applyServerAdminDecision(null==e?void 0:e.isAdmin),null==e?void 0:e.token},onError:t=>{console.log("Error signing to velt - ",t),this.fallBackToGuestIfLiveSignInExpired(l)||(this.invalidApiKey=!0)}}),this.fetchAndApplyFeatureAccess()]);if(this.hasAgentAccess&&this.insertShadowDOM(),this.invalidApiKey)throw"Invalid Api Key - Domain Not Whitelisted";f&&((t=>{try{const e={userId:null==t?void 0:t.userId,name:null==t?void 0:t.name,email:null==t?void 0:t.email,photoUrl:null==t?void 0:t.photoUrl},i=md(JSON.stringify(e),ci,di);pd(se,i,!0)}catch(t){console.warn("Error in saveUserToken: ",t),th("Error in saveUserToken: ",t)}})(n),ha("[Superflow][identify] token rewritten post-signin, re-read",{persistedName:null===(e=yd())||void 0===e?void 0:e.name})),ha("[Superflow][identify] velt auth response",{name:null==w?void 0:w.name,email:null==w?void 0:w.email,userId:null==w?void 0:w.userId,userSnippylyId:null==w?void 0:w.userSnippylyId,tokenUserProperties:u}),Qd(JSON.parse(JSON.stringify(w||{}))),(null==n?void 0:n.isAnonymous)||(this.snippylyUser=JSON.parse(JSON.stringify(n)),ha("[Superflow][identify] this.snippylyUser (rendered) name",null===(i=this.snippylyUser)||void 0===i?void 0:i.name)),this.syncRequestMode();const y=JSON.parse(JSON.stringify(w||{}));if((null==y?void 0:y.userSnippylyId)&&!(null==y?void 0:y.isGuest)&&this.checkToMigrateGuestUser(y,this.credentialFor(y,g)),Velt.getUserRole$().subscribe((t=>{var e;t&&(this.loading=!1,null===(e=this.commentElement)||void 0===e||e.enablePriority(),this.applyCheckPriorities())})),this.contactListSubscription=Velt.getContactElement().getContactList().subscribe((t=>{var e;this.loading=!1,(null===(e=null==t?void 0:t.organizationUsers)||void 0===e?void 0:e.length)>0&&(this.checkPrivateCommentModeFromStorage(),this.contactListSubscription&&(this.contactListSubscription.unsubscribe(),this.contactListSubscription=null))})),(null===Velt||void 0===Velt?void 0:Velt.isPlanExpired$)&&(null===Velt||void 0===Velt||Velt.isPlanExpired$().subscribe((t=>{this.isPlanExpired=t}),(t=>{this.isPlanExpired=!1,console.warn("Error in isPlanExpired$: ",t),th("Error in isPlanExpired$: ",t)}))),null===Velt||void 0===Velt?void 0:Velt.on){let t;null===Velt||void 0===Velt||Velt.on("initUpdate").subscribe((e=>{"setDocumentsSuccess"===e.event&&(t&&(t.unsubscribe(),t=null),t=null===Velt||void 0===Velt?void 0:Velt.getDocumentMetadata().subscribe((async t=>{await this.handleDocumentMetadataUpdate(t)}),(t=>{console.warn("Error in getDocumentMetadata: ",t),th("Error in getDocumentMetadata: ",t)})))}))}Jd({clientUserId:null==n?void 0:n.userId});try{Xd(n)}catch(t){console.warn("Error in trackIdentifyEvent: ",t)}this.getComments(),this.checkGlobalUserContact(),this.showFirstCommentNudge(),setTimeout((()=>{vd(ye)||this.autoCommentModeArmedOnce||(this.showTourCommentTooltip=!0)}),2e3)}catch(t){if(this.loading=!1,this.signInError=!0,s||this.resolveSuggestionRoleAsLookupFailed(),t&&"string"==typeof t&&(null===(n=null==t?void 0:t.toLowerCase())||void 0===n?void 0:n.includes("invalid"))){this.invalidApiKey=!0,eh(gt.Events.DOMAIN_NOT_WHITELISTED),this.projectId&&nh(this.apiKey,this.projectId);if(new URL(document.location).searchParams.has(ve))this.isSigningInUserAdmin=!0;else if(vd(be))this.isSigningInUserAdmin="true"===vd(be,!0);else{const t=await oh(this.apiKey,this.projectId||"",o,r);this.isSigningInUserAdmin=!!(null==t?void 0:t.isAdmin),pd(be,this.isSigningInUserAdmin+"",!0)}}console.warn("Error in identifySnippyly: ",t),th("Error in identifySnippyly: ",t)}},this.handleDocumentMetadataUpdate=async t=>{try{if(!t)return;const e=await rh(this.apiKey,null==t?void 0:t.clientDocumentId);kd(e,this.isDriveOrPreviewHost(),this.projectIdSupplied)&&this.lockForDeletedProject(),this.setProjectConfigVariables("ok"===e.status?e.config:null),await this.fetchAndApplyFeatureAccess()}catch(t){console.warn("Error in handleDocumentMetadataUpdate: ",t),th("Error in handleDocumentMetadataUpdate: ",t)}},this.lockForDeletedProject=()=>{this.projectDeleted=!0,this.applyVeltFeatureGates(),this.unmountVeltCollaborationElements()},this.fetchAndApplyFeatureAccess=async()=>{var t,e;try{const i=await wh(this.apiKey);if("error"===i.status||!i.featureAccess)return void console.warn("getFeatureAccess failed or returned no data; keeping the last known feature access");this.featureAccess=i.featureAccess,this.planLimitLocked=(t=>{var e;try{return!0===(null===(e=null==t?void 0:t.planStatus)||void 0===e?void 0:e.isOverPlanLimits)}catch(t){return!1}})(this.featureAccess),this.applyVeltFeatureGates(),this.applyStorageFeatureAccess();const n=null===(t=this.featureAccess)||void 0===t?void 0:t[mh.Agents];this.hasAgentAccess=!0===(null==n?void 0:n.hasAccess);const o=null===(e=this.featureAccess)||void 0===e?void 0:e[mh.WorkspacePrivateComments];this.hasPrivateCommentsAccess=!0===(null==o?void 0:o.hasAccess),this.isPrivateCommentsEnabledOnWorkspace=!0===(null==o?void 0:o.isPrivateCommentsEnabled),!this.canShowPrivateCommentToggle&&this.privateCommentModeEnabled&&(this.disablePrivateCommentModeOnCommentElement(),this.privateCommentModeEnabled=!1,pd(Me,"false")),this.maybeApplyVisibilityOptionsToCommentElement()}catch(t){console.warn("Error in fetchAndApplyFeatureAccess: ",t),th("Error in fetchAndApplyFeatureAccess: ",t)}},this.applyFocusedViewLayoutFix=()=>{try{!function(t){try{return"function"==typeof(null==t?void 0:t.injectCustomCss)&&(t.injectCustomCss({type:"styles",value:gp()}),!0)}catch(t){return console.warn("Error in injectFocusedViewLayoutCss: ",t),!1}}(window.Velt)}catch(t){console.warn("Error in applyFocusedViewLayoutFix: ",t),th("Error in applyFocusedViewLayoutFix: ",t)}},this.insertShadowDOM=()=>{try{if(document.querySelector("velt-wireframe"))return;const t=document.querySelector("velt-comments");t&&t.setAttribute("shadow-dom","true");const e=document.querySelector(`${ze.VELT_COMMENTS_SIDEBAR_LEGACY}, ${ze.VELT_COMMENTS_SIDEBAR_V2}`);e&&e.setAttribute("shadow-dom","true")}catch(t){console.warn("Error in insertShadowDOM: ",t),th("Error in insertShadowDOM: ",t)}},this.applyStorageFeatureAccess=()=>{try{if(!this.featureAccess||!this.commentElement)return;const t=this.featureAccess[mh.Storage];(null==t?void 0:t.hasUsageExhausted)&&(this.commentElement.disableAttachments(),this.commentElement.setRecordings("none"))}catch(t){th("Error in applyStorageFeatureAccess: ",t)}},this.checkToMigrateGuestUser=async(t,e)=>{try{const i=Cd(!1,this.apiKey);if(i){const n=`${de}:${i.userId}:${null==t?void 0:t.userId}`,o=vd(n,!1,"sessionStorage");if("with-credential"===o||"without-credential"===o&&!e)return;const r=await hh(this.apiKey,this.projectId||"",i,t,!0,e);if(!1===(null==r?void 0:r.success))return console.warn("[CWS Toolbar] Guest migration refused; keeping the guest user:",null==r?void 0:r.reason),void pd(n,e?"with-credential":"without-credential",!1,"sessionStorage");gd(n,"sessionStorage"),gd(ce)}}catch(t){console.warn("Error in checkToMigrationGuestUser: ",t),th("Error in checkToMigrationGuestUser: ",t)}},this.getComments=()=>{try{this.commentElement&&this.commentSubscription&&this.commentSubscription.unsubscribe()}catch(t){console.warn("Error in getComments: ",t),th("Error in getComments: ",t)}},this.handleCommentSelection=t=>{var e,i,n,o,r,s,a,l,c,d,h;try{if(!1===(null==t?void 0:t.selected))return void(null===(e=null===Velt||void 0===Velt?void 0:Velt.setUiState)||void 0===e||e.call(Velt,{showButtons:!1}));const u=null==t?void 0:t.annotation;if(!u||!this.isAgentAnnotation(u))return void(null===(i=null===Velt||void 0===Velt?void 0:Velt.setUiState)||void 0===i||i.call(Velt,{showButtons:!1}));const p=this.resolveFullAnnotation(u);if(mu(p))return void(null===(n=null===Velt||void 0===Velt?void 0:Velt.setUiState)||void 0===n||n.call(Velt,{showButtons:wu(p).length>1,warningType:"site"}));const v=null===(r=null===(o=null==u?void 0:u.agent)||void 0===o?void 0:o.result)||void 0===r?void 0:r.incorrectWord,g=(null===(s=null==u?void 0:u.pageInfo)||void 0===s?void 0:s.path)||(null===(a=null==u?void 0:u.location)||void 0===a?void 0:a.path)||(null===(l=null==u?void 0:u.agent)||void 0===l?void 0:l.path);if(!v||!g)return void(null===(c=null===Velt||void 0===Velt?void 0:Velt.setUiState)||void 0===c||c.call(Velt,{showButtons:!1}));const f=this.normalizePagePath(g),m=v,w=null===(h=null===(d=null==u?void 0:u.agent)||void 0===d?void 0:d.result)||void 0===h?void 0:h.type;let y,b="";"grammar"===w?(y=this.grammarSuggestionPagePathMap,b="grammar"):(y=this.spellingSuggestionPagePathMap,b="spelling");const C=null==y?void 0:y.get(m);((null==C?void 0:C.get(f))||0)<=1?Velt.setUiState({showButtons:!1,warningType:b}):Velt.setUiState({showButtons:!0,warningType:b})}catch(t){console.warn("Error in handleCommentSelection: ",t),th("Error in handleCommentSelection: ",t)}},this.processAgentComments=t=>{var e,i,n;try{const o=Array.isArray(t)?t:[];this.trackAgentPins(o),o.length&&!this.agentNamesFetched&&this.apiKey&&this.fetchAgentNames();const r=o.filter((t=>this.isAgentAnnotation(t)&&!pu(t)));if(this.sidebarV2Enabled&&!this.showAgentCommentsInSidebar&&0===r.length&&this.agentGroups.length>0){const t=new Set(this.agentGroups.flatMap((t=>{var e;return null!==(e=null==t?void 0:t.annotations)&&void 0!==e?e:[]})).map(ou));for(const e of o){const i=ou(e);i&&t.has(i)&&pu(e)&&this.removeAnnotationFromWarnings(i)}return}if(0===r.length)return this.hasContentWarnings=!1,this.contentWarningsCount=0,this.agentGroups=[],this.spellingSuggestionPagePathMap=new Map,void(this.grammarSuggestionPagePathMap=new Map);const s=new Map;for(const t of r){const i=this.extractAgentId((null===(e=null==t?void 0:t.agent)||void 0===e?void 0:e.agentFields)||[]);if(!i)continue;const n=s.get(i);n?n.push(t):s.set(i,[t])}const a=[],l=new Map,c=new Map;for(const[t,e]of s){const o=this.isCustomAgent((null===(n=null===(i=e[0])||void 0===i?void 0:i.agent)||void 0===n?void 0:n.agentFields)||[]),r=this.resolveAgentGroupName(t,e),{warnings:s,warningCount:d}=this.buildAgentWarnings(t,e,l,c);a.push({agentId:t,agentName:r,isCustom:o,warningCount:d,warnings:s,annotations:e})}if(a.sort(((t,e)=>e.warningCount-t.warningCount)),this.agentGroups=a,this.isAgentRunStatusFeedEnabled())for(const t of a)this.onboardingOpenedAgentIds.add(t.agentId);const d=a.reduce(((t,e)=>t+e.warningCount),0);this.contentWarningsCount=d,this.hasContentWarnings=d>0,this.spellingSuggestionPagePathMap=l,this.grammarSuggestionPagePathMap=c}catch(t){console.warn("Error in processAgentComments: ",t),th("Error in processAgentComments: ",t)}},this.extractAgentId=t=>{try{if(!Array.isArray(t)||0===t.length)return null;for(const e of t)if(null==e?void 0:e.startsWith(Ue.AGENT))return e.substring(Ue.AGENT.length);return null}catch(t){return console.warn("Error in extractAgentId: ",t),null}},this.isCustomAgent=t=>{try{return!!Array.isArray(t)&&t.includes(Ue.AGENT_TYPE_CUSTOM)}catch(t){return console.warn("Error in isCustomAgent: ",t),!1}},this.resolveAgentGroupName=(t,e)=>{var i;try{return cv(null===(i=this.agentNameMap)||void 0===i?void 0:i.get(t),e)||this.getAgentNameFromId(t)}catch(e){return console.warn("Error in resolveAgentGroupName: ",e),th("Error in resolveAgentGroupName: ",e),this.getAgentNameFromId(t)}},this.resolveAgentDisplayName=t=>{var e,i;try{return null!==(i=null===(e=this.agentNameMap)||void 0===e?void 0:e.get(t))&&void 0!==i?i:this.getAgentNameFromId(t)}catch(t){return console.warn("Error in resolveAgentDisplayName: ",t),Gt}},this.getAgentNameFromId=t=>{try{return t&&/^[a-z]+(-[a-z]+)*$/.test(t)?t.split("-").map((t=>`${t.charAt(0).toUpperCase()}${t.slice(1)}`)).join(" "):Gt}catch(t){return console.warn("Error in getAgentNameFromId: ",t),Gt}},this.fetchAgentNames=async()=>{var t,e,i;try{this.agentNamesFetched=!0;const{getAgents:n}=await Promise.resolve().then((function(){return kh})),o=await n(this.apiKey),r=new Map;for(const i of o){const n=null!==(t=null==i?void 0:i.id)&&void 0!==t?t:"",o=null!==(e=null==i?void 0:i.name)&&void 0!==e?e:"";n&&o&&r.set(n,o)}if(this.agentNameMap=r,(null===(i=this.agentGroups)||void 0===i?void 0:i.length)>0){const t=this.agentGroups.map((t=>({...t,agentName:this.resolveAgentGroupName(t.agentId,t.annotations)})));this.agentGroups=t}}catch(t){this.agentNamesFetched=!1,console.warn("Error in fetchAgentNames: ",t)}},this.sanitiseAgentRunStatusRows=t=>{try{const e=[],i=Array.isArray(t)?t.slice(0,50):[];for(const t of i){const i=null==t?void 0:t.agentId;if("string"!=typeof i||0===i.length)continue;const n=("string"==typeof(null==t?void 0:t.name)&&t.name.length>0?t.name:this.resolveAgentDisplayName(i)).slice(0,80),o="string"==typeof(null==t?void 0:t.status)&&Bt.includes(t.status),r=!0!==(null==t?void 0:t.terminal)&&!o,s=null==t?void 0:t.findings,a="number"==typeof s&&Number.isFinite(s)&&s>=0?Math.floor(s):0;e.push(o?{agentId:i,agentName:n,isRunning:r,findingsCount:a,failed:!0}:{agentId:i,agentName:n,isRunning:r,findingsCount:a})}return e}catch(t){return console.warn("Error in sanitiseAgentRunStatusRows: ",t),th("Error in sanitiseAgentRunStatusRows: ",t),[]}},this.getPortalOrigins=()=>{try{if(this.portalOrigins)return this.portalOrigins;const t=new Set;for(const e of[ai,li])try{const{origin:i,hostname:n,protocol:o}=new URL(e);t.add(i),n.endsWith(".firebaseapp.com")?t.add(`${o}//${n.replace(/\.firebaseapp\.com$/,".web.app")}`):n.endsWith(".web.app")&&t.add(`${o}//${n.replace(/\.web\.app$/,".firebaseapp.com")}`)}catch{}return this.portalOrigins=[...t],this.portalOrigins}catch(t){return console.warn("Error in getPortalOrigins: ",t),th("Error in getPortalOrigins: ",t),[]}},this.isAllowedPortalOrigin=t=>{try{if("string"!=typeof t||0===t.length||"null"===t)return!1;if(this.getPortalOrigins().includes(t))return!0;const{protocol:e,hostname:i}=new URL(t);return!("http:"!==e&&"https:"!==e||"localhost"!==i&&"127.0.0.1"!==i)}catch{return!1}},this.readAncestorOrigins=()=>{var t;try{const e=null===(t=window.location)||void 0===t?void 0:t.ancestorOrigins;return e?Array.from(e):null}catch{return null}},this.readDocumentReferrer=()=>{try{return document.referrer||""}catch{return""}},this.getParentFrameOrigin=()=>{try{if(!window.parent||window.parent===window)return null;const t=this.readAncestorOrigins();if(t)return t[0]||null;const e=this.readDocumentReferrer();return e?new URL(e).origin:null}catch{return null}},this.isFramedByPortal=()=>{try{return this.isAllowedPortalOrigin(this.getParentFrameOrigin())}catch(t){return console.warn("Error in isFramedByPortal: ",t),th("Error in isFramedByPortal: ",t),!1}},this.isAgentRunStatusFeedEnabled=()=>this.onboardingMode||this.agentStatusMode,this.canHonourStoredOnboardingFlag=()=>{try{if(!window.parent||window.parent===window)return!1;const t=this.readAncestorOrigins();return!t||this.isAllowedPortalOrigin(t[0])}catch(t){return console.warn("Error in canHonourStoredOnboardingFlag: ",t),th("Error in canHonourStoredOnboardingFlag: ",t),!1}},this.getPortalTargetOrigin=()=>{try{const t=this.getParentFrameOrigin();return t&&this.isAllowedPortalOrigin(t)?t:"*"}catch{return"*"}},this.startAgentRunStatusListener=()=>{try{if(!this.isAgentRunStatusFeedEnabled()||!this.isConnected)return void this.stopAgentRunStatusListener();if(this.agentRunStatusListening)return;if(!window.parent||window.parent===window)return void(this.agentRunStatusSettled=!0);if(window.addEventListener("message",this.onAgentRunStatusMessage),this.agentRunStatusListening=!0,this.onboardingMode&&this.startOnboardingViewportListener(),this.announceToPortal(),this.agentRunStatusSettled){if(this.agentRunStatuses.some((t=>null==t?void 0:t.isRunning))){const t=this.agentRunStatusLastMessageAt>0?Date.now()-this.agentRunStatusLastMessageAt:0;this.armAgentRunStatusWatchdog(Math.max(0,Ut-t))}}else this.armAgentRunStatusWatchdog(2e4);this.ensureOnboardingFindingsLoaded()}catch(t){console.warn("Error in startAgentRunStatusListener: ",t),th("Error in startAgentRunStatusListener: ",t)}},this.announceToPortal=()=>{try{window.parent.postMessage({type:Ft,caps:{showComment:!0}},this.getPortalTargetOrigin()),this.postPreviewLocation()}catch(t){console.warn("Error in announceToPortal: ",t),th("Error in announceToPortal: ",t)}},this.attachPageLifecycleListeners=()=>{try{if(this.pageLifecycleListenersAttached)return;window.addEventListener("pagehide",this.onPreviewPageHide),window.addEventListener("pageshow",this.onPreviewPageShow),this.pageLifecycleListenersAttached=!0}catch(t){console.warn("Error in attachPageLifecycleListeners: ",t),th("Error in attachPageLifecycleListeners: ",t)}},this.detachPageLifecycleListeners=()=>{try{window.removeEventListener("pagehide",this.onPreviewPageHide),window.removeEventListener("pageshow",this.onPreviewPageShow),this.pageLifecycleListenersAttached=!1}catch(t){console.warn("Error in detachPageLifecycleListeners: ",t),th("Error in detachPageLifecycleListeners: ",t)}},this.onPreviewPageHide=()=>{try{this.postPreviewLeaving()}catch(t){console.warn("Error in onPreviewPageHide: ",t),th("Error in onPreviewPageHide: ",t)}},this.onPreviewPageShow=t=>{try{if(!(null==t?void 0:t.persisted))return;if(this.pendingLeavingPage=null,this.lastPostedPreviewLocationPage=null,!this.canAnnounceToPortal())return;this.announceToPortal()}catch(t){console.warn("Error in onPreviewPageShow: ",t),th("Error in onPreviewPageShow: ",t)}},this.postPreviewLeaving=()=>{try{const t=this.pendingLeavingPage;if(this.pendingLeavingPage=null,!this.canAnnounceToPortal())return;const e=this.getPortalTargetOrigin();window.parent.postMessage(t&&"*"!==e?{type:te,page:t}:{type:te},e)}catch(t){console.warn("Error in postPreviewLeaving: ",t),th("Error in postPreviewLeaving: ",t)}},this.canAnnounceToPortal=()=>{try{return!(!this.isAgentRunStatusFeedEnabled()||!this.agentRunStatusListening)&&(!!window.parent&&window.parent!==window)}catch(t){return console.warn("Error in canAnnounceToPortal: ",t),th("Error in canAnnounceToPortal: ",t),!1}},this.getPreviewMessageTargetOrigin=()=>{try{if(!this.canAnnounceToPortal())return null;const t=this.getPortalTargetOrigin();return t&&"*"!==t?t:null}catch(t){return console.warn("Error in getPreviewMessageTargetOrigin: ",t),th("Error in getPreviewMessageTargetOrigin: ",t),null}},this.readPageHref=()=>{try{return window.location.href||""}catch{return""}},this.getPreviewLocationPage=()=>{try{let t;if(this.isRunningUnderPreviewProxy()&&!this.isRunningUnderLivePreview())t=this.parsePreviewSitePath(this.previewLocationPath);else{const e=this.readPageHref();if(!e)return null;t=new URL(e)}return t?this.toPreviewLocationPage(t):null}catch(t){return console.warn("Error in getPreviewLocationPage: ",t),th("Error in getPreviewLocationPage: ",t),null}},this.parsePreviewSitePath=t=>{try{const e="https://page.invalid";if("string"!=typeof t||!t.startsWith("/")||t.startsWith("//"))return null;const i=new URL(t,e);return i.origin!==e?null:i}catch(t){return console.warn("Error in parsePreviewSitePath: ",t),th("Error in parsePreviewSitePath: ",t),null}},this.toPreviewLocationPage=t=>{try{const e=new Set(oi),i=t.search.replace(/^\?/,"").split("&").filter((t=>{if(!t)return!1;const i=t.split("=",1)[0];let n=i;try{n=decodeURIComponent(i.replace(/\+/g," "))}catch{}return!e.has(n)})),n=`${t.pathname}${i.length>0?`?${i.join("&")}`:""}`;return!n.startsWith("/")||n.startsWith("//")||n.length>2048?null:n}catch(t){return console.warn("Error in toPreviewLocationPage: ",t),th("Error in toPreviewLocationPage: ",t),null}},this.postPreviewLocation=()=>{try{const t=this.getPreviewMessageTargetOrigin();if(!t)return;const e=this.getPreviewLocationPage();if(!e)return;if(e===this.lastPostedPreviewLocationPage)return;window.parent.postMessage({type:Xt,page:e},t),this.lastPostedPreviewLocationPage=e}catch(t){console.warn("Error in postPreviewLocation: ",t),th("Error in postPreviewLocation: ",t)}},this.stopAgentRunStatusListener=()=>{try{window.removeEventListener("message",this.onAgentRunStatusMessage),this.agentRunStatusListening=!1,this.clearAgentRunStatusWatchdog(),this.clearOnboardingFindingsFetch(),this.stopOnboardingViewportListener()}catch(t){console.warn("Error in stopAgentRunStatusListener: ",t),th("Error in stopAgentRunStatusListener: ",t)}},this.onAgentRunStatusMessage=t=>{try{if(!this.isAgentRunStatusFeedEnabled())return;if(!window.parent||window.parent===window||(null==t?void 0:t.source)!==window.parent)return;if(!this.isAllowedPortalOrigin(null==t?void 0:t.origin))return;const e=null==t?void 0:t.data;if((null==e?void 0:e.type)===Vt)return void this.postOnboardingDiagnostics(t.origin);if((null==e?void 0:e.type)===Jt)return void this.onPreviewShowCommentMessage(e);if((null==e?void 0:e.type)!==Dt||!Array.isArray(null==e?void 0:e.agents))return;this.agentRunStatuses=this.sanitiseAgentRunStatusRows(e.agents),this.agentRunStatusTimedOut=!1,this.agentRunStatusLastMessageAt=Date.now();const i=!0===(null==e?void 0:e.allTerminal);(this.agentRunStatuses.length>0||i)&&(this.agentRunStatusSettled=!0);this.agentRunStatuses.some((t=>null==t?void 0:t.isRunning))?this.armAgentRunStatusWatchdog(Ut):this.agentRunStatusSettled&&this.clearAgentRunStatusWatchdog(),this.ensureOnboardingFindingsLoaded()}catch(t){console.warn("Error in onAgentRunStatusMessage: ",t),th("Error in onAgentRunStatusMessage: ",t)}},this.onPreviewShowCommentMessage=t=>{let e=null;this.portalShowSeq+=1;const i=this.portalShowSeq;try{if(e=this.readPreviewShowCommentRequest(t),!e)return void this.recordPortalShowDecision(i,null,"","malformed");this.dropPendingPortalShow(),this.dropPendingCommentDeepLink("superseded"),this.releaseAgentPinDialogHold("replaced");const{pageUrl:n,annotationId:o}=e;if(o){const t=this.resolvePortalShowAnnotation(o,n),e=this.opensAgentAnnotationHere(t)?this.getPortalShowWait(o):null;if(e)return this.pendingPortalShow={seq:i,annotationId:o,pageUrl:n,pagePath:this.getCurrentPagePath()},this.recordPortalShowDecision(i,o,n,e),void this.applyPendingPortalShow();const r=this.openAgentAnnotation(t,!0,{pinSource:"show",show:{seq:i,pageUrl:n}});return void this.recordPortalShowDecision(i,o,n,this.toPortalShowOutcome(r))}if(this.isCurrentPreviewPage(n))return void this.recordPortalShowDecision(i,null,n,"page-here");const r=this.navigateToPage(n,null,!0);this.recordPortalShowDecision(i,null,n,r?"page-navigated":"navigate-failed")}catch(t){e&&this.recordPortalShowDecision(i,e.annotationId,e.pageUrl,"error"),console.warn("Error in onPreviewShowCommentMessage: ",t),th("Error in onPreviewShowCommentMessage: ",t)}},this.toPortalShowOutcome=t=>{try{return"navigated"===t||"navigate-failed"===t?t:t?t.sidebarRefused?"sidebar-refused":t.outcome:"error"}catch(t){return console.warn("Error in toPortalShowOutcome: ",t),"error"}},this.getPortalShowWait=t=>{var e;try{return this.commentElement&&this.findLoadedAgentAnnotation(t)?(null!==(e=this.onboardingUnsyncedAnnotationIds)&&void 0!==e?e:[]).includes(t)?"waiting-sync":this.isDocumentStillParsing()?"waiting-dom":null:"waiting-comment"}catch(t){return console.warn("Error in getPortalShowWait: ",t),th("Error in getPortalShowWait: ",t),"waiting-comment"}},this.resolvePortalShowAnnotation=(t,e)=>{var i,n;try{const o=this.findLoadedAgentAnnotation(t);return o?Yp(null===(i=null==o?void 0:o.pageInfo)||void 0===i?void 0:i.url)?o:{...o,pageInfo:{...null!==(n=null==o?void 0:o.pageInfo)&&void 0!==n?n:{},url:e}}:{annotationId:t,pageInfo:{url:e}}}catch(i){return console.warn("Error in resolvePortalShowAnnotation: ",i),th("Error in resolvePortalShowAnnotation: ",i),{annotationId:t,pageInfo:{url:e}}}},this.isPortalShowAnnotationReady=t=>{var e;try{return!!this.commentElement&&(!!this.findLoadedAgentAnnotation(t)&&!(null!==(e=this.onboardingUnsyncedAnnotationIds)&&void 0!==e?e:[]).includes(t))}catch(t){return console.warn("Error in isPortalShowAnnotationReady: ",t),th("Error in isPortalShowAnnotationReady: ",t),!1}},this.applyPendingPortalShow=()=>{const t=this.pendingPortalShow;try{if(!t)return;if(!Zp(t.pagePath,this.getCurrentPagePath()))return void this.dropPendingPortalShow("page-changed");const e=this.getPortalShowWait(t.annotationId);if(e)return this.recordPortalShowDecision(t.seq,t.annotationId,t.pageUrl,e),void("waiting-dom"===e&&this.waitForDocumentParsed());this.dropPendingPortalShow();const i=this.resolvePortalShowAnnotation(t.annotationId,t.pageUrl),n={seq:t.seq,pageUrl:t.pageUrl};if(!this.opensAgentAnnotationHere(i))return void this.recordPortalShowDecision(n.seq,t.annotationId,t.pageUrl,"other-page");const o=this.openAgentAnnotationHere(i,!1,"show",n);this.recordPortalShowDecision(n.seq,t.annotationId,t.pageUrl,this.toPortalShowOutcome(o))}catch(e){this.dropPendingPortalShow(),t&&this.recordPortalShowDecision(t.seq,t.annotationId,t.pageUrl,"error"),console.warn("Error in applyPendingPortalShow: ",e),th("Error in applyPendingPortalShow: ",e)}},this.dropPendingPortalShowIfPageChanged=()=>{try{this.pendingPortalShow&&!Zp(this.pendingPortalShow.pagePath,this.getCurrentPagePath())&&this.dropPendingPortalShow("page-changed")}catch(t){console.warn("Error in dropPendingPortalShowIfPageChanged: ",t),th("Error in dropPendingPortalShowIfPageChanged: ",t)}},this.dropPendingCommentDeepLinkIfPageChanged=()=>{try{this.pendingCommentDeepLink&&!Zp(this.pendingCommentDeepLink.pagePath,this.getCurrentPagePath())&&this.dropPendingCommentDeepLink("page-changed");const t=this.pendingAgentPin;t&&!Zp(t.pagePath,this.getCurrentPagePath())&&(this.pendingAgentPin=null,this.recordAgentPinRequestOutcome(t,"page-changed","page-changed"));const e=this.agentPinDialogHold;e&&!Zp(e.pagePath,this.getCurrentPagePath())&&this.releaseAgentPinDialogHold("replaced")}catch(t){console.warn("Error in dropPendingCommentDeepLinkIfPageChanged: ",t),th("Error in dropPendingCommentDeepLinkIfPageChanged: ",t)}},this.dropPendingPortalShow=t=>{try{const e=this.pendingPortalShow,i=this.pendingAgentPin;this.pendingPortalShow=null,i&&"deep-link"!==i.source&&(this.pendingAgentPin=null),t&&(e?this.recordPortalShowDecision(e.seq,e.annotationId,e.pageUrl,t):"show"===(null==i?void 0:i.source)&&this.recordAgentPinRequestOutcome(i,t,null)),this.stopWaitingForDocumentParsed()}catch(t){this.pendingPortalShow=null,this.pendingAgentPin=null,console.warn("Error in dropPendingPortalShow: ",t),th("Error in dropPendingPortalShow: ",t)}},this.dropPendingCommentDeepLink=t=>{var e;try{const i=this.pendingCommentDeepLink,n=this.pendingAgentPin;this.pendingCommentDeepLink=null,this.pendingAgentPin=null,i?this.recordCommentDeepLinkDecision(i.annotationId,t):n&&this.recordAgentPinRequestOutcome(n,null!==(e=Nv[t])&&void 0!==e?e:"superseded",t),this.stopWaitingForDocumentParsed()}catch(t){this.pendingCommentDeepLink=null,this.pendingAgentPin=null,console.warn("Error in dropPendingCommentDeepLink: ",t),th("Error in dropPendingCommentDeepLink: ",t)}},this.recordAgentPinRequestOutcome=(t,e,i)=>{var n;try{if("show"===t.source){const i=null!==(n=t.show)&&void 0!==n?n:{seq:this.portalShowSeq,pageUrl:""};this.recordPortalShowDecision(i.seq,t.annotationId,i.pageUrl,e)}else"deep-link"===t.source&&i&&this.recordCommentDeepLinkDecision(t.annotationId,i)}catch(t){console.warn("Error in recordAgentPinRequestOutcome: ",t),th("Error in recordAgentPinRequestOutcome: ",t)}},this.recordCommentDeepLinkDecision=(t,e)=>{try{const i=this.lastCommentDeepLinkDecision;if(i&&i.annotationId===t&&i.outcome===e)return;this.lastCommentDeepLinkDecision={annotationId:t,outcome:e,readyState:String(document.readyState),at:Date.now()}}catch(t){console.warn("Error in recordCommentDeepLinkDecision: ",t),th("Error in recordCommentDeepLinkDecision: ",t)}},this.recordPortalShowDecision=(t,e,i,n)=>{try{const o=this.lastPortalShowDecision;if(o&&o.seq>t)return;if(o&&o.seq===t&&o.annotationId===e&&o.pageUrl===i&&o.outcome===n)return;this.lastPortalShowDecision={seq:t,annotationId:e,pageUrl:i,outcome:n,pagePath:this.getCurrentPagePath(),readyState:String(document.readyState),at:Date.now()}}catch(t){console.warn("Error in recordPortalShowDecision: ",t),th("Error in recordPortalShowDecision: ",t)}},this.isDocumentStillParsing=()=>{try{return"loading"===document.readyState}catch(t){return console.warn("Error in isDocumentStillParsing: ",t),th("Error in isDocumentStillParsing: ",t),!1}},this.waitForDocumentParsed=()=>{try{if(this.documentParsedListenerAttached)return;document.addEventListener("DOMContentLoaded",this.onDocumentParsed,{once:!0}),this.documentParsedListenerAttached=!0}catch(t){console.warn("Error in waitForDocumentParsed: ",t),th("Error in waitForDocumentParsed: ",t)}},this.stopWaitingForDocumentParsed=(t=!1)=>{try{if(!this.documentParsedListenerAttached)return;if(!t&&(this.pendingPortalShow||this.pendingCommentDeepLink))return;document.removeEventListener("DOMContentLoaded",this.onDocumentParsed),this.documentParsedListenerAttached=!1}catch(t){console.warn("Error in stopWaitingForDocumentParsed: ",t),th("Error in stopWaitingForDocumentParsed: ",t)}},this.onDocumentParsed=()=>{try{this.documentParsedListenerAttached=!1,this.applyPendingPortalShow(),this.applyPendingCommentDeepLink()}catch(t){console.warn("Error in onDocumentParsed: ",t),th("Error in onDocumentParsed: ",t)}},this.isCurrentPreviewPage=t=>{try{const e=this.getPreviewLocationPage();if(!e)return!1;const i=new URL(t),n=Ad(i)?null:Td(t),o=null===n?i:this.parsePreviewSitePath(n);return!!o&&this.toPreviewLocationPage(o)===e}catch(t){return console.warn("Error in isCurrentPreviewPage: ",t),th("Error in isCurrentPreviewPage: ",t),!1}},this.readPreviewShowCommentRequest=t=>{try{if(!t||"object"!=typeof t)return null;const{pageUrl:e,annotationId:i}=t;if("string"!=typeof e||0===e.length||e.length>2048)return null;let n="";try{n=new URL(e).protocol}catch{return null}return"http:"!==n&&"https:"!==n?null:void 0===i?{pageUrl:e,annotationId:null}:"string"!=typeof i||0===i.trim().length||i.length>200?null:{pageUrl:e,annotationId:i}}catch(t){return console.warn("Error in readPreviewShowCommentRequest: ",t),th("Error in readPreviewShowCommentRequest: ",t),null}},this.findLoadedAgentAnnotation=t=>{var e,i,n,o;try{const r={annotationId:t},s=this.resolveFullAnnotation(r);if(s&&s!==r)return s;const a=e=>ou(e)===t;return null!==(o=null!==(i=(null!==(e=this.lastStreamAnnotations)&&void 0!==e?e:[]).find(a))&&void 0!==i?i:(null!==(n=this.agentGroups)&&void 0!==n?n:[]).flatMap((t=>{var e;return null!==(e=null==t?void 0:t.annotations)&&void 0!==e?e:[]})).find(a))&&void 0!==o?o:null}catch(t){return console.warn("Error in findLoadedAgentAnnotation: ",t),th("Error in findLoadedAgentAnnotation: ",t),null}},this.postOnboardingDiagnostics=t=>{var e,i,n,o,r,s;try{if(!this.isAgentRunStatusFeedEnabled()||!window.parent||window.parent===window||!this.isAllowedPortalOrigin(t))return;const a=(null!==(e=this.lastStreamAnnotations)&&void 0!==e?e:[]).filter((t=>this.isAgentAnnotation(t))).length;window.parent.postMessage({type:jt,at:(new Date).toISOString(),version:ft,identity:{hasUser:!!this.snippylyUser,isGuest:!!(null===(i=this.snippylyUser)||void 0===i?void 0:i.isGuest),isAnonymous:!!(null===(n=this.snippylyUser)||void 0===n?void 0:n.isAnonymous),hasRole:!!this.snippylyUserRole,loading:this.loading},sdk:{hasCommentElement:!!this.commentElement,hasDocumentId:!!this.documentId,hasLocationPath:!!this.previewLocationPath,sidebarV2:this.sidebarV2Enabled,showAgentCommentsInSidebar:this.showAgentCommentsInSidebar,agentCommentsModeRequested:this.agentCommentsModeRequested,privateCommentsEnabled:this.isPrivateCommentsEnabledOnWorkspace,hasPrivateCommentsAccess:this.hasPrivateCommentsAccess},stream:{emissions:this.streamEmissionCount,lastEmissionAt:this.lastStreamEmissionAt?new Date(this.lastStreamEmissionAt).toISOString():null,lastSize:(null!==(o=this.lastStreamAnnotations)&&void 0!==o?o:[]).length,agentAnnotations:a},fetch:{attempts:this.onboardingFindingsFetchAttempts,inFlight:this.onboardingFindingsFetchInFlight,pending:null!==this.onboardingFindingsFetchTimer,lastCount:this.onboardingLastFetchCount,lastError:this.onboardingLastFetchError,fetchedAt:this.onboardingFetchedAt?new Date(this.onboardingFetchedAt).toISOString():null,unsynced:this.onboardingUnsyncedAnnotationIds.length,waitingForSignIn:!this.isVeltUserSignedIn()},groups:(null!==(r=this.agentGroups)&&void 0!==r?r:[]).map((t=>({agentId:null==t?void 0:t.agentId,count:null==t?void 0:t.warningCount}))),statuses:(null!==(s=this.agentRunStatuses)&&void 0!==s?s:[]).map((t=>({agentId:null==t?void 0:t.agentId,isRunning:null==t?void 0:t.isRunning,findingsCount:null==t?void 0:t.findingsCount,failed:!!(null==t?void 0:t.failed),timedOut:!!(null==t?void 0:t.timedOut)}))),missing:this.getAgentIdsMissingFindings(),sidebarOpen:this.showContentWarningSidebar,settled:this.agentRunStatusSettled},t)}catch(t){console.warn("Error in postOnboardingDiagnostics: ",t),th("Error in postOnboardingDiagnostics: ",t)}},this.isOnboardingAgentResolved=t=>{try{return this.onboardingOpenedAgentIds.has(t)||this.onboardingFetchResolvedAgentIds.has(t)}catch(t){return console.warn("Error in isOnboardingAgentResolved: ",t),!1}},this.getAgentIdsMissingFindings=()=>{var t,e;try{const i=new Set((null!==(t=this.agentGroups)&&void 0!==t?t:[]).map((t=>null==t?void 0:t.agentId)));return(null!==(e=this.agentRunStatuses)&&void 0!==e?e:[]).filter((t=>{var e;return!(null==t?void 0:t.isRunning)&&(null!==(e=null==t?void 0:t.findingsCount)&&void 0!==e?e:0)>0})).map((t=>null==t?void 0:t.agentId)).filter((t=>!!t&&!i.has(t)&&!this.isOnboardingAgentResolved(t)))}catch(t){return console.warn("Error in getAgentIdsMissingFindings: ",t),th("Error in getAgentIdsMissingFindings: ",t),[]}},this.getFetchableMissingAgentIds=()=>{try{return this.onboardingFindingsFetchAttempts>=30?[]:this.getAgentIdsMissingFindings().filter((t=>{var e;return(null!==(e=this.onboardingFetchAttemptsByAgent.get(t))&&void 0!==e?e:0)<10}))}catch(t){return console.warn("Error in getFetchableMissingAgentIds: ",t),th("Error in getFetchableMissingAgentIds: ",t),[]}},this.isOnboardingFindingsLoadExhausted=t=>{var e;try{return null===this.onboardingFindingsFetchTimer&&!this.onboardingFindingsFetchInFlight&&((null!==(e=this.onboardingFetchAttemptsByAgent.get(t))&&void 0!==e?e:0)>=10||this.onboardingFindingsFetchAttempts>=30)}catch(t){return console.warn("Error in isOnboardingFindingsLoadExhausted: ",t),!1}},this.getDisplayAgentRunStatuses=()=>{var t,e;try{if(!this.isAgentRunStatusFeedEnabled())return this.agentRunStatuses;const i=new Set((null!==(t=this.agentGroups)&&void 0!==t?t:[]).map((t=>null==t?void 0:t.agentId)));return(null!==(e=this.agentRunStatuses)&&void 0!==e?e:[]).map((t=>{var e;return(null==t?void 0:t.isRunning)||0===(null!==(e=null==t?void 0:t.findingsCount)&&void 0!==e?e:0)||i.has(null==t?void 0:t.agentId)?t:this.isOnboardingAgentResolved(t.agentId)?{...t,findingsResolved:!0}:this.isOnboardingFindingsLoadExhausted(t.agentId)?{...t,findingsUnavailable:!0}:t}))}catch(t){return console.warn("Error in getDisplayAgentRunStatuses: ",t),th("Error in getDisplayAgentRunStatuses: ",t),this.agentRunStatuses}},this.ensureOnboardingFindingsLoaded=()=>{try{if(!this.isAgentRunStatusFeedEnabled()||!this.agentRunStatusListening)return;if(null!==this.onboardingFindingsFetchTimer||this.onboardingFindingsFetchInFlight)return;if(0===this.getFetchableMissingAgentIds().length)return;if(!this.isVeltUserSignedIn())return;this.onboardingFindingsFetchTimer=setTimeout((()=>this.fetchOnboardingFindings()),3e3)}catch(t){console.warn("Error in ensureOnboardingFindingsLoaded: ",t),th("Error in ensureOnboardingFindingsLoaded: ",t)}},this.isVeltUserSignedIn=()=>{try{return this.watchVeltCurrentUser(),!this.veltCurrentUserWatched||this.veltUserSignedIn}catch(t){return console.warn("Error in isVeltUserSignedIn: ",t),th("Error in isVeltUserSignedIn: ",t),!0}},this.watchVeltCurrentUser=()=>{try{if(this.veltCurrentUserWatched)return;const t=window.Velt;if("function"!=typeof(null==t?void 0:t.getCurrentUser))return;const e=t.getCurrentUser();if(!e||"function"!=typeof e.subscribe)return;this.veltCurrentUserWatched=!0,this.veltUserSignedIn=!1;let i=!0;const n=e.subscribe((t=>this.onVeltCurrentUser(t,i)));i=!1,this.veltCurrentUserSubscription=null!=n?n:null}catch(t){console.warn("Error in watchVeltCurrentUser: ",t),th("Error in watchVeltCurrentUser: ",t)}},this.onVeltCurrentUser=(t,e=!1)=>{try{const i=!!t&&"object"==typeof t,n=this.veltUserSignedIn;this.veltUserSignedIn=i,!i||n||e||this.ensureOnboardingFindingsLoaded()}catch(t){console.warn("Error in onVeltCurrentUser: ",t),th("Error in onVeltCurrentUser: ",t)}},this.unwatchVeltCurrentUser=()=>{var t,e;try{null===(e=null===(t=this.veltCurrentUserSubscription)||void 0===t?void 0:t.unsubscribe)||void 0===e||e.call(t)}catch(t){console.warn("Error in unwatchVeltCurrentUser: ",t)}finally{this.veltCurrentUserSubscription=null,this.veltCurrentUserWatched=!1,this.veltUserSignedIn=!1}},this.clearOnboardingFindingsFetch=()=>{try{null!==this.onboardingFindingsFetchTimer&&(clearTimeout(this.onboardingFindingsFetchTimer),this.onboardingFindingsFetchTimer=null)}catch(t){console.warn("Error in clearOnboardingFindingsFetch: ",t),th("Error in clearOnboardingFindingsFetch: ",t)}},this.countOnboardingFetchAttempt=t=>{var e;this.onboardingFindingsFetchAttempts+=1;for(const i of t)this.onboardingFetchAttemptsByAgent.set(i,(null!==(e=this.onboardingFetchAttemptsByAgent.get(i))&&void 0!==e?e:0)+1)},this.fetchOnboardingFindings=async()=>{var t;try{if(this.onboardingFindingsFetchTimer=null,!this.isAgentRunStatusFeedEnabled())return;const e=this.getFetchableMissingAgentIds();if(0===e.length)return;if(!this.isVeltUserSignedIn())return;if(this.countOnboardingFetchAttempt(e),"function"!=typeof(null===(t=this.commentElement)||void 0===t?void 0:t.fetchCommentAnnotations)||!this.documentId)return this.onboardingLastFetchError=zt.SDK_NOT_READY,this.ensureOnboardingFindingsLoaded(),void this.requestUpdate();this.onboardingFindingsFetchInFlight=!0;const i=await this.commentElement.fetchCommentAnnotations({documentIds:[`${this.documentId}`]});if(this.onboardingFindingsFetchInFlight=!1,!this.isAgentRunStatusFeedEnabled())return;if(null===(null==i?void 0:i.data)||void 0===(null==i?void 0:i.data))this.onboardingLastFetchCount=0,this.onboardingLastFetchError=zt.SDK_RETURNED_NULL;else{const t=this.flattenFetchedAnnotations(i);this.onboardingLastFetchCount=t.length,this.onboardingLastFetchError="",this.applyOnboardingFetchResult(t)}this.ensureOnboardingFindingsLoaded(),this.requestUpdate()}catch(t){this.onboardingFindingsFetchInFlight=!1,this.onboardingLastFetchError=zt.FETCH_THREW,console.warn("Error in fetchOnboardingFindings: ",t),th("Error in fetchOnboardingFindings: ",t),this.ensureOnboardingFindingsLoaded(),this.requestUpdate()}},this.applyOnboardingFetchResult=t=>{var e,i;try{const n=(Array.isArray(t)?t:[]).filter((t=>{const e=null==t?void 0:t.annotationId;return!!e&&!this.onboardingRemovedAnnotationIds.has(e)&&this.isAgentAnnotation(t)})),o=new Map;for(const t of n){const n=this.extractAgentId((null===(e=null==t?void 0:t.agent)||void 0===e?void 0:e.agentFields)||[]);if(!n)continue;const r=!pu(t);o.set(n,null!==(i=o.get(n))&&void 0!==i&&i||r)}for(const[t,e]of o)e?this.onboardingFetchResolvedAgentIds.delete(t):this.onboardingFetchResolvedAgentIds.add(t);this.onboardingFetchedAnnotations=n,this.onboardingFetchedAt=Date.now(),this.processAgentComments(this.mergeOnboardingFetchedAnnotations(this.lastStreamAnnotations))}catch(t){console.warn("Error in applyOnboardingFetchResult: ",t),th("Error in applyOnboardingFetchResult: ",t)}},this.flattenFetchedAnnotations=t=>{try{const e=null==t?void 0:t.data;if(Array.isArray(e))return e;if(!e||"object"!=typeof e)return[];const i=[];for(const t of Object.values(e))Array.isArray(t)&&i.push(...t);return i}catch(t){return console.warn("Error in flattenFetchedAnnotations: ",t),th("Error in flattenFetchedAnnotations: ",t),[]}},this.mergeOnboardingFetchedAnnotations=t=>{var e;try{const i=Array.isArray(t)?t:[];if(!this.isAgentRunStatusFeedEnabled())return i;if(0===this.onboardingFetchedAnnotations.length)return this.setOnboardingUnsyncedAnnotationIds([]),i;const n=new Set(i.map((t=>null==t?void 0:t.annotationId)));if(this.sidebarV2Enabled&&!this.showAgentCommentsInSidebar){const t=new Map,o=(null!==(e=this.agentGroups)&&void 0!==e?e:[]).flatMap((t=>{var e;return null!==(e=null==t?void 0:t.annotations)&&void 0!==e?e:[]}));for(const e of[...o,...this.onboardingFetchedAnnotations]){const i=null==e?void 0:e.annotationId;!i||n.has(i)||t.has(i)||this.onboardingRemovedAnnotationIds.has(i)||t.set(i,e)}return t.size>0?[...i,...t.values()]:i}return this.onboardingFetchedAnnotations=this.onboardingFetchedAnnotations.filter((t=>{const e=null==t?void 0:t.annotationId;return!!e&&!n.has(e)&&!this.onboardingRemovedAnnotationIds.has(e)})),this.setOnboardingUnsyncedAnnotationIds(this.onboardingFetchedAnnotations.map((t=>t.annotationId))),this.onboardingFetchedAnnotations.length>0?[...i,...this.onboardingFetchedAnnotations]:i}catch(e){return console.warn("Error in mergeOnboardingFetchedAnnotations: ",e),th("Error in mergeOnboardingFetchedAnnotations: ",e),Array.isArray(t)?t:[]}},this.setOnboardingUnsyncedAnnotationIds=t=>{try{const e=[...t].sort();e.join("\n")!==this.onboardingUnsyncedAnnotationIds.join("\n")&&(this.onboardingUnsyncedAnnotationIds=e)}catch(t){console.warn("Error in setOnboardingUnsyncedAnnotationIds: ",t)}},this.armAgentRunStatusWatchdog=t=>{try{this.clearAgentRunStatusWatchdog(),this.agentRunStatusWatchdogTimer=setTimeout((()=>this.applyAgentRunStatusTimeout()),t)}catch(t){console.warn("Error in armAgentRunStatusWatchdog: ",t),th("Error in armAgentRunStatusWatchdog: ",t)}},this.clearAgentRunStatusWatchdog=()=>{try{null!==this.agentRunStatusWatchdogTimer&&(clearTimeout(this.agentRunStatusWatchdogTimer),this.agentRunStatusWatchdogTimer=null)}catch(t){console.warn("Error in clearAgentRunStatusWatchdog: ",t),th("Error in clearAgentRunStatusWatchdog: ",t)}},this.applyAgentRunStatusTimeout=()=>{try{this.agentRunStatusWatchdogTimer=null,this.agentRunStatuses.some((t=>null==t?void 0:t.isRunning))&&(this.agentRunStatuses=this.agentRunStatuses.map((t=>(null==t?void 0:t.isRunning)?{...t,isRunning:!1,timedOut:!0}:t)),this.agentRunStatusTimedOut=!0),this.agentRunStatusSettled=!0}catch(t){console.warn("Error in applyAgentRunStatusTimeout: ",t),th("Error in applyAgentRunStatusTimeout: ",t)}},this.startOnboardingViewportListener=()=>{try{if(this.onboardingViewportListening)return;window.addEventListener("resize",this.scheduleOnboardingViewportClamp),this.onboardingViewportListening=!0}catch(t){console.warn("Error in startOnboardingViewportListener: ",t),th("Error in startOnboardingViewportListener: ",t)}},this.stopOnboardingViewportListener=()=>{var t;try{window.removeEventListener("resize",this.scheduleOnboardingViewportClamp),this.onboardingViewportListening=!1,null===(t=this.onboardingPanelResizeObserver)||void 0===t||t.disconnect(),this.onboardingPanelResizeObserver=null,this.onboardingObservedPanel=null,null!==this.onboardingClampFrame&&(cancelAnimationFrame(this.onboardingClampFrame),this.onboardingClampFrame=null)}catch(t){console.warn("Error in stopOnboardingViewportListener: ",t),th("Error in stopOnboardingViewportListener: ",t)}},this.observeOnboardingPanel=()=>{var t,e,i;try{if(!this.agentRunStatusListening||"undefined"==typeof ResizeObserver)return;const n=null!==(e=null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector(".onboarding-container content-warning-sidebar"))&&void 0!==e?e:null;if(n===this.onboardingObservedPanel)return;if(null===(i=this.onboardingPanelResizeObserver)||void 0===i||i.disconnect(),this.onboardingObservedPanel=n,!n)return;this.onboardingPanelResizeObserver||(this.onboardingPanelResizeObserver=new ResizeObserver((()=>this.scheduleOnboardingViewportClamp()))),this.onboardingPanelResizeObserver.observe(n)}catch(t){console.warn("Error in observeOnboardingPanel: ",t),th("Error in observeOnboardingPanel: ",t)}},this.scheduleOnboardingViewportClamp=()=>{try{if(!this.onboardingMode||null!==this.onboardingClampFrame)return;this.onboardingClampFrame=requestAnimationFrame((()=>{this.onboardingClampFrame=null,this.clampOnboardingPanelToViewport()}))}catch(t){console.warn("Error in scheduleOnboardingViewportClamp: ",t),th("Error in scheduleOnboardingViewportClamp: ",t)}},this.getOnboardingViewportClampOffset=(t,e,i)=>{let n=0,o=0;return t.right>e-8&&(n=e-8-t.right),t.left+n<8&&(n=8-t.left),t.bottom>i-8&&(o=i-8-t.bottom),t.top+o<8&&(o=8-t.top),{dx:n,dy:o}},this.readTranslate=t=>{var e;try{const i=window.getComputedStyle(t).transform;if(!i||"none"===i)return{x:0,y:0};const n=new(null!==(e=window.DOMMatrixReadOnly)&&void 0!==e?e:window.WebKitCSSMatrix)(i);return{x:Number(n.m41)||0,y:Number(n.m42)||0}}catch{return{x:0,y:0}}},this.clampOnboardingPanelToViewport=t=>{var e;try{const i=null!=t?t:null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector(".snippyly-plugin-container.onboarding-container");if(!i)return;const n=[i.getBoundingClientRect()],o=i.querySelector("content-warning-sidebar");o&&n.push(o.getBoundingClientRect());const r=n.filter((t=>t.width>0||t.height>0));if(0===r.length)return;const s={left:Math.min(...r.map((t=>t.left))),top:Math.min(...r.map((t=>t.top))),right:Math.max(...r.map((t=>t.right))),bottom:Math.max(...r.map((t=>t.bottom)))},{dx:a,dy:l}=this.getOnboardingViewportClampOffset(s,window.innerWidth,window.innerHeight);if(Math.abs(a)<.5&&Math.abs(l)<.5)return;const{x:c,y:d}=this.readTranslate(i);i.style.transform=`translate(${Math.round(c+a)}px, ${Math.round(d+l)}px)`}catch(t){console.warn("Error in clampOnboardingPanelToViewport: ",t),th("Error in clampOnboardingPanelToViewport: ",t)}},this.buildAgentWarnings=(t,e,i,n)=>{try{return t===Be.BROKEN_LINKS?this.buildBrokenLinkWarnings(e):t===Be.SPELL_CHECK||t===Be.GRAMMAR_CHECK?this.buildSpellCheckWarnings(e,i,n):this.buildGenericWarnings(e)}catch(t){return console.warn("Error in buildAgentWarnings: ",t),{warnings:[],warningCount:0}}},this.buildBrokenLinkWarnings=t=>{var e,i,n,o,r,s,a,l,c,d,h,u,p;try{const v=new Map;for(const g of t){const t=(null===(e=null==g?void 0:g.pageInfo)||void 0===e?void 0:e.url)||(null===(i=null==g?void 0:g.location)||void 0===i?void 0:i.url)||(null===(n=null==g?void 0:g.agent)||void 0===n?void 0:n.url)||"",f=(null===(o=null==g?void 0:g.agent)||void 0===o?void 0:o.reason)||{},m=f.url||(null===(r=null==g?void 0:g.targetTextRange)||void 0===r?void 0:r.text)||(null===(a=null===(s=null==g?void 0:g.agent)||void 0===s?void 0:s.result)||void 0===a?void 0:a.url)||(null===(c=null===(l=null==g?void 0:g.agent)||void 0===l?void 0:l.result)||void 0===c?void 0:c.link)||t,w=f.issue||f.description||(null===(h=null===(d=null==g?void 0:g.agent)||void 0===d?void 0:d.result)||void 0===h?void 0:h.statusCode)||(null===(p=null===(u=null==g?void 0:g.agent)||void 0===u?void 0:u.result)||void 0===p?void 0:p.status)||"",y=(null==m?void 0:m.toLowerCase())||"",b=fu(g)?yu(g):void 0;if(v.has(y)){const e=v.get(y);e.occurrences+=1,t&&!e.pageUrls.includes(t)&&e.pageUrls.push(t),e.annotations.push(g),b&&(e.severity=Lu(e.severity,b))}else v.set(y,{primaryText:m||"",secondaryText:String(w),occurrences:1,pageUrls:t?[t]:[],annotations:[g],...b?{severity:b}:{}})}const g=Array.from(v.values());return{warnings:g,warningCount:g.length}}catch(t){return console.warn("Error in buildBrokenLinkWarnings: ",t),{warnings:[],warningCount:0}}},this.buildSpellCheckWarnings=(t,e,i)=>{var n,o,r,s,a,l,c,d,h,u,p,v,g,f,m,w,y,b,C;try{const E=new Map;for(const x of t){const t=(null===(n=null==x?void 0:x.pageInfo)||void 0===n?void 0:n.url)||(null===(o=null==x?void 0:x.location)||void 0===o?void 0:o.url)||(null===(r=null==x?void 0:x.agent)||void 0===r?void 0:r.url)||"",k=(null===(s=null==x?void 0:x.pageInfo)||void 0===s?void 0:s.path)||(null===(a=null==x?void 0:x.location)||void 0===a?void 0:a.path)||(null===(l=null==x?void 0:x.agent)||void 0===l?void 0:l.path)||"",S=this.normalizePagePath(k),M=null!==(d=null!==(c=null==x?void 0:x.comments)&&void 0!==c?c:null==x?void 0:x.commentData)&&void 0!==d?d:[],A=null!==(p=null===(u=null===(h=null==M?void 0:M[0])||void 0===h?void 0:h.commentText)||void 0===u?void 0:u.trim())&&void 0!==p?p:"",T=(null===(g=null===(v=null==x?void 0:x.agent)||void 0===v?void 0:v.result)||void 0===g?void 0:g.incorrectWord)||(null===(f=null==x?void 0:x.targetElement)||void 0===f?void 0:f.targetText)||A||"",I=(null===(w=null===(m=null==x?void 0:x.agent)||void 0===m?void 0:m.result)||void 0===w?void 0:w.suggestions)||[],_=Array.isArray(I)?I[0]||"":I||"",$=null===(b=null===(y=null==x?void 0:x.agent)||void 0===y?void 0:y.result)||void 0===b?void 0:b.type,O=T||"";T||console.warn("[CWS] Spell check annotation missing incorrectWord. agent.result:",null===(C=null==x?void 0:x.agent)||void 0===C?void 0:C.result,"targetElement:",null==x?void 0:x.targetElement,"comments:",M);const N="grammar"===$?i:e;N.has(O)||N.set(O,new Map);const L=N.get(O),R=L.get(S)||0;L.set(S,R+1);const P=fu(x)?yu(x):void 0;if(E.has(O)){const e=E.get(O);e.occurrences+=1,t&&!e.pageUrls.includes(t)&&e.pageUrls.push(t),e.annotations.push(x),P&&(e.severity=Lu(e.severity,P))}else E.set(O,{primaryText:T||"",secondaryText:_||"",occurrences:1,pageUrls:t?[t]:[],annotations:[x],...P?{severity:P}:{}})}const x=Array.from(E.values());return{warnings:x,warningCount:x.length}}catch(t){return console.warn("Error in buildSpellCheckWarnings: ",t),{warnings:[],warningCount:0}}},this.splitFindingHeading=t=>{var e;try{if("string"!=typeof t||!t.trim())return null;const i=document.createElement("template");i.innerHTML=t;const n=Array.from(i.content.childNodes).filter((t=>{var e;return!(t.nodeType===Node.TEXT_NODE&&!(null===(e=t.textContent)||void 0===e?void 0:e.trim()))})),o=n[0];if(!o||!["B","STRONG"].includes(o.nodeName))return null;const r=(null===(e=o.textContent)||void 0===e?void 0:e.replace(/\s+/g," ").trim())||"";if(!r)return null;let s="";for(const t of n.slice(1))s+="BR"===t.nodeName?"\n":t.textContent||"";return{title:r,detail:s.split("\n").map((t=>t.replace(/\s+/g," ").trim())).find(Boolean)||""}}catch(t){return console.warn("Error in splitFindingHeading: ",t),null}},this.buildFindingSubItems=t=>{try{return(Array.isArray(null==t?void 0:t.missing)?t.missing:[]).map((t=>{const e="string"==typeof(null==t?void 0:t.text)?t.text.replace(/\s+/g," ").trim():"";if(!e)return null;const i="heading"===(null==t?void 0:t.kind)?"Section":"Link",n="string"==typeof(null==t?void 0:t.href)?t.href.trim().replace(/^https?:\/\//i,"").replace(/^www\./i,"").replace(/\/$/,""):"",o=n.length>40?`${n.slice(0,39)}…`:n;return{label:e,detail:o?`${i} · ${o}`:i}})).filter(Boolean)}catch(t){return console.warn("Error in buildFindingSubItems: ",t),[]}},this.buildGenericWarnings=t=>{var e,i,n,o,r,s,a,l,c,d,h,u,p,v,g,f,m,w,y,b,C,E,x,k;try{const S=new Map;for(const M of t){const t=(null===(e=null==M?void 0:M.pageInfo)||void 0===e?void 0:e.url)||(null===(i=null==M?void 0:M.location)||void 0===i?void 0:i.url)||(null===(n=null==M?void 0:M.agent)||void 0===n?void 0:n.url)||"",A=null!==(r=null!==(o=null==M?void 0:M.comments)&&void 0!==o?o:null==M?void 0:M.commentData)&&void 0!==r?r:[],T=null==A?void 0:A[0],I=null!==(p=null!==(d=null!==(a=null===(s=null==T?void 0:T.commentText)||void 0===s?void 0:s.trim())&&void 0!==a?a:null===(c=null===(l=null==M?void 0:M.agent)||void 0===l?void 0:l.result)||void 0===c?void 0:c.incorrectWord)&&void 0!==d?d:null===(u=null===(h=null==M?void 0:M.targetElement)||void 0===h?void 0:h.targetText)||void 0===u?void 0:u.trim())&&void 0!==p?p:"",_=null!==(b=null!==(m=null===(f=null===(g=null===(v=null==M?void 0:M.agent)||void 0===v?void 0:v.result)||void 0===g?void 0:g.suggestions)||void 0===f?void 0:f[0])&&void 0!==m?m:null===(y=null===(w=null==M?void 0:M.agent)||void 0===w?void 0:w.result)||void 0===y?void 0:y.suggestion)&&void 0!==b?b:"",$=null!==(k=null!==(E=null===(C=null==M?void 0:M.agent)||void 0===C?void 0:C.reason)&&void 0!==E?E:null===(x=null==T?void 0:T.agent)||void 0===x?void 0:x.reason)&&void 0!==k?k:{},O="string"==typeof(null==$?void 0:$.title)?$.title.trim():"",N="string"==typeof(null==$?void 0:$.description)?$.description.trim():"",L=O?null:this.splitFindingHeading(null==T?void 0:T.commentHtml),R=O||(null==L?void 0:L.title)||I,P=_||(O?N:null==L?void 0:L.detail)||"",D=this.resolveWarningSeverity(M,$),F=this.buildFindingSubItems($),V=I||(null==M?void 0:M.annotationId)||(null==M?void 0:M.id)||"";if(S.has(V)){const e=S.get(V);e.occurrences+=1,t&&!e.pageUrls.includes(t)&&e.pageUrls.push(t),e.annotations.push(M),e.severity=Lu(e.severity,D)}else S.set(V,{primaryText:R||"No text",secondaryText:P||"",occurrences:1,pageUrls:t?[t]:[],annotations:[M],...D?{severity:D}:{},...F.length>1?{subItems:F}:{}})}const M=Array.from(S.values());return{warnings:M,warningCount:M.length}}catch(t){return console.warn("Error in buildGenericWarnings: ",t),{warnings:[],warningCount:0}}},this.resolveWarningSeverity=(t,e)=>{try{return fu(t)?yu(t):(t=>{if("string"!=typeof t)return;const e=t.trim().toLowerCase();return Qh.includes(e)?e:void 0})(null==e?void 0:e.severity)}catch(t){return console.warn("Error in resolveWarningSeverity: ",t),void th("Error in resolveWarningSeverity: ",t)}},this.normalizePagePath=t=>{try{return t?(null==t?void 0:t.startsWith("/"))?t.substring(1):t:""}catch(e){return console.warn("Error in normalizePagePath: ",e),t||""}},this.setQueryParamsCommentsInSdk=()=>{var t,e,i,n,o;try{const r="true"===sessionStorage.getItem("debugQueryParamsComments");r&&console.log("setQueryParamsCommentsInSdk commentElement",this.commentElement),this.commentElement&&(r&&console.log("setQueryParamsCommentsInSdk queryParamsComments",this.queryParamsComments),this.queryParamsComments&&(null===(t=this.commentElement)||void 0===t?void 0:t.enableQueryParamsComments)?(r&&console.log("enableQueryParamsComments this.commentElement?.enableQueryParamsComments",null===(e=this.commentElement)||void 0===e?void 0:e.enableQueryParamsComments),null===(i=this.commentElement)||void 0===i||i.enableQueryParamsComments()):!this.queryParamsComments&&(null===(n=this.commentElement)||void 0===n?void 0:n.disableQueryParamsComments)&&(r&&console.log("disableQueryParamsComments"),null===(o=this.commentElement)||void 0===o||o.disableQueryParamsComments()))}catch(t){console.warn("Error in setQueryParamsCommentsInSdk: ",t),th("Error in setQueryParamsCommentsInSdk: ",t)}},this.checkGlobalUserContact=()=>{try{this.contactElement&&this.contactElement.isUserGlobalContact().subscribe((t=>{this.isUserGlobalContact=t}))}catch(t){console.warn("Error in checkGlobalUserContact: ",t),th("Error in checkGlobalUserContact: ",t)}},this.applyVeltFeatureGates=()=>{try{const t=(t=>{try{return(null==t?void 0:t.passwordGateActive)||(null==t?void 0:t.planLimitLocked)||(null==t?void 0:t.planExpired)||(null==t?void 0:t.projectDeleted)?[...xd]:[]}catch(t){return[]}})({passwordGateActive:this.passwordProtected&&!this.isPasswordValid,planLimitLocked:this.planLimitLocked,planExpired:!0===this.isPlanExpired,projectDeleted:this.projectDeleted});this.resolvedVeltFeatureGates=t,this.pushVeltFeatureGates(t)}catch(t){console.warn("Error in applyVeltFeatureGates: ",t),th("Error in applyVeltFeatureGates: ",t)}},this.pushVeltFeatureGates=t=>{const e=globalThis.Velt;e&&"function"==typeof e.disableFeatures&&e.disableFeatures(t)},this.replayVeltFeatureGates=()=>{try{this.pushVeltFeatureGates(this.resolvedVeltFeatureGates)}catch(t){console.warn("Error in replayVeltFeatureGates: ",t),th("Error in replayVeltFeatureGates: ",t)}},this.setProjectConfigVariables=t=>{var e,i,n,o;try{const r="Admin"===this.snippylyUserRole;this.allFeatureDisabled=!r&&(null!==(e=null==t?void 0:t.disabled)&&void 0!==e&&e),t&&"object"==typeof t?(this.firstConfigCommentsDisabled=null,this.commentsDisabledSetting="known"):("waiting"===this.commentsDisabledSetting&&(this.commentsDisabledSetting="unread"),this.applyFirstConfigCommentsDisabled()),this.allFeatureRestricted=null!==(i=null==t?void 0:t.restricted)&&void 0!==i&&i,this.guestMode=null!==(n=null==t?void 0:t.guestMode)&&void 0!==n&&n||this.isRunningUnderLivePreview(),this.allowGuestModeSignIn=!!(null===(o=null==t?void 0:t.guestModeConfig)||void 0===o?void 0:o.allowSignIn),(null==t?void 0:t.guestModeConfig)||(this.allowGuestModeSignIn=!0),this.guestMode&&eh(gt.Events.GUEST_MODE_PRESENT),this.passwordProtected=!1,this.queryParamsComments=!!(null==t?void 0:t.queryParamsComments),this.usePageTitleAsLocationName=!!(null==t?void 0:t.usePageTitleAsLocationName),function(t){try{return!!t&&"object"==typeof t&&"boolean"==typeof t.requestMode}catch(t){return console.warn("Error in hasRequestModeField: ",t),!1}}(t)&&(this.requestModeSwitch=Ud(t),this.syncRequestMode()),this.applyVeltFeatureGates(),pd(Ce,this.guestMode+"",!0),pd(Te,this.allowGuestModeSignIn+"",!0),pd(Ee,this.passwordProtected+"",!0),pd(xe,this.queryParamsComments+"",!0),pd(ke,this.usePageTitleAsLocationName+"",!0)}catch(t){console.warn("Error in setProjectConfigVariables: ",t),th("Error in setProjectConfigVariables: ",t)}},this.toggleSnippylyPluginToolbar=()=>{try{this.expanded=!this.expanded,this.expanded?eh(gt.Events.TOOLBAR_EXPANDED):eh(gt.Events.TOOLBAR_COLLAPSED)}catch(t){console.warn("Error in toggleSnippylyPluginToolbar: ",t),th("Error in toggleSnippylyPluginToolbar: ",t)}},this.enablePrivateCommentModeOnCommentElement=()=>{try{if(!this.commentElement||"function"!=typeof this.commentElement.enablePrivateMode)return;this.commentElement.enablePrivateMode({type:Ae})}catch(t){console.warn("Error in enablePrivateCommentModeOnCommentElement: ",t),th("Error in enablePrivateCommentModeOnCommentElement: ",t)}},this.disablePrivateCommentModeOnCommentElement=()=>{try{if(!this.commentElement||"function"!=typeof this.commentElement.disablePrivateMode)return;this.commentElement.disablePrivateMode()}catch(t){console.warn("Error in disablePrivateCommentModeOnCommentElement: ",t),th("Error in disablePrivateCommentModeOnCommentElement: ",t)}},this.enableVisibilityOptionsOnCommentElement=()=>{try{if(this.visibilityOptionsEnabled)return;if(!this.commentElement||"function"!=typeof this.commentElement.enableVisibilityOptions)return;this.commentElement.enableVisibilityOptions(),this.visibilityOptionsEnabled=!0,eh(gt.Events.VISIBILITY_OPTIONS_ENABLED)}catch(t){console.warn("Error in enableVisibilityOptionsOnCommentElement: ",t),th("Error in enableVisibilityOptionsOnCommentElement: ",t)}},this.disableVisibilityOptionsOnCommentElement=()=>{try{if(!this.visibilityOptionsEnabled)return;if(!this.commentElement||"function"!=typeof this.commentElement.disableVisibilityOptions)return void(this.visibilityOptionsEnabled=!1);this.commentElement.disableVisibilityOptions(),this.visibilityOptionsEnabled=!1,eh(gt.Events.VISIBILITY_OPTIONS_DISABLED)}catch(t){console.warn("Error in disableVisibilityOptionsOnCommentElement: ",t),th("Error in disableVisibilityOptionsOnCommentElement: ",t)}},this.maybeApplyVisibilityOptionsToCommentElement=()=>{"Admin"===this.snippylyUserRole&&this.canShowPrivateCommentToggle?this.enableVisibilityOptionsOnCommentElement():this.disableVisibilityOptionsOnCommentElement()},this.togglePrivateCommentMode=()=>{try{this.commentElement&&(this.privateCommentModeEnabled?(this.disablePrivateCommentModeOnCommentElement(),this.privateCommentModeEnabled=!1,eh(gt.Events.PRIVATE_MODE_DISABLED)):(this.enablePrivateCommentModeOnCommentElement(),this.privateCommentModeEnabled=!0,eh(gt.Events.PRIVATE_MODE_ENABLED)),pd(Me,this.privateCommentModeEnabled.toString()))}catch(t){console.warn("Error in togglePrivateCommentMode: ",t),th("Error in togglePrivateCommentMode: ",t)}},this.checkPrivateCommentModeFromStorage=()=>{try{!this.allFeatureDisabled&&"Admin"===this.snippylyUserRole&&this.canShowPrivateCommentToggle&&vd(Me)&&(this.privateCommentModeEnabled="true"===vd(Me),this.privateCommentModeEnabled&&this.enablePrivateCommentModeOnCommentElement())}catch(t){console.warn("Error in checkPrivateCommentModeFromStorage: ",t),th("Error in checkPrivateCommentModeFromStorage: ",t)}},this.loginWithGoogle=()=>{try{if(eh(gt.Events.SIGNIN_CLICKED),this.loading||this.customLoginEnabledLocally)return;const t=this.buildSignInUrlWithParams(this.signInUrl||""),e=this.signInWindowTarget();"_blank"===e?window.open(t,"_blank","noopener,noreferrer"):window.open(t,e)}catch(t){console.warn("Error in loginWithGoogle: ",t),th("Error in loginWithGoogle: ",t)}},this.signInWindowTarget=()=>{try{return this.isRunningUnderPreviewProxy()&&this.isInFrame()?"_blank":"_self"}catch(t){return console.warn("Error in signInWindowTarget: ",t),"_self"}},this.isInFrame=()=>{try{return window.top!==window.self}catch(t){return console.warn("Error in isInFrame: ",t),!0}},this.buildSignInUrlWithParams=t=>{try{const e=new URL(t);return this.apiKey&&e.searchParams.set("apiKey",this.apiKey),this.projectId&&e.searchParams.set("projectId",this.projectId),e.toString()}catch(e){return console.warn("Error in buildSignInUrlWithParams: ",e),th("Error in buildSignInUrlWithParams: ",e),t}},this.getQRCode=async()=>{if(!this.qrCodeLoading)try{this.qrCodeLoading=!0,this.qrCodeError=!1;const t=new URL(window.location.href);null==t||t.searchParams.set("review","true");const e=null==t?void 0:t.toString();if(!e)return void(this.qrCodeError=!0);const i=md(e,ci,di),n=await yh(i);"ok"===n.status?this.qrCode=n.qrcode:this.qrCodeError=!0}catch(t){this.qrCodeError=!0,console.warn("Error in getQRCode: ",t),th("Error in getQRCode: ",t)}finally{this.qrCodeLoading=!1}},this.retryQRCode=async()=>{try{this.qrCodeError=!1,await this.getQRCode()}catch(t){console.warn("Error in retryQRCode: ",t),th("Error in retryQRCode: ",t)}},this.toggleQRCodeVisibility=async()=>{try{if(eh(gt.Events.OPEN_MOBILE_CLICKED),this.showQrCode&&this.qrCodeLoading)return;this.showQrCode=!this.showQrCode,this.showQrCode&&!this.qrCode&&await this.getQRCode()}catch(t){console.warn("Error in toggleQRCodeVisibility: ",t),th("Error in toggleQRCodeVisibility: ",t)}},this.onUserInviteToolClick=()=>{var t;(null===(t=this.snippylyUser)||void 0===t?void 0:t.isGuest)?(this.guestModeSignInModalConfig.title="Sign in to invite others.",this.guestModeSignInModalConfig.description="Invite team members to comment on this project.",this.guestModeSignInModalConfig.showLeaveCommentButton=!1,this.guestModeSignInModalConfig.closeOnClickOutside=!0,this.openGuestModeSignInModal()):this.openInviteModal()},this.openInviteModal=()=>{this.showInviteModal=!0,eh(gt.Events.INVITE_MODAL_OPENED)},this.closeInviteModal=()=>{this.showInviteModal=!1},this.onInviteSuccess=()=>{this.closeInviteModal(),eh(gt.Events.INVITE_SENT)},this.removeSnippyly=async()=>{try{eh(gt.Events.EXIT_REVIEW_MODE_CLICKED),this.exitReviewModeCalled=!0,gd(Mt),gd(At),gd(ie),gd(he,"sessionStorage"),gd(ue,"sessionStorage");const t=new URL(document.location),e=t.searchParams;e.delete(ie),e.delete(Mt),e.delete(ne),e.delete(At),this.projectVersionKey&&e.delete(this.projectVersionKey),e.delete(pe),e.delete(ve),e.delete(ge),this.projectVersion=void 0,this.projectVersionKey=void 0,delete window.snippylyInitialLoadUrl,window.history.replaceState({},document.title,t.href),window.location.reload()}catch(t){console.warn("Error in removeSnippyly: ",t),th("Error in removeSnippyly: ",t)}},this.signOutUser=async()=>{try{eh(gt.Events.SIGNOUT_CLICKED),this.subscriptions.forEach((t=>{t&&t.unsubscribe&&(null==t||t.unsubscribe())})),this.contactListSubscription&&(this.contactListSubscription.unsubscribe(),this.contactListSubscription=null),this.teardownAgentsSidebarBusSubscriptions(),await Velt.signOutUser(),gd(oe),gd(se),$d(),gd(be),gd(Me),this.snippylyUser=void 0,window.open(this.signOutUrl,"_self")}catch(t){console.warn("Error in signOutUser: ",t),th("Error in signOutUser: ",t)}},this.toggleMenu=(t,e)=>{try{t.stopPropagation(),this.menuOpenedId===e?this.menuOpenedId=void 0:this.menuOpenedId=e}catch(t){console.warn("Error in toggleMenu: ",t),th("Error in toggleMenu: ",t)}},this.copyLink=()=>{try{navigator.clipboard.writeText(window.location.href),this.copyLinkTooltip="Link copied!",setTimeout((()=>{this.copyLinkTooltip="Copy Link"}),2e3)}catch(t){console.warn("Error in copyLink: ",t),th("Error in copyLink: ",t)}},this.adminPortalProjectUrl=()=>{try{return((t,e)=>{try{const i=t.endsWith("/")?t:`${t}/`,n="string"==typeof e?e.trim():"";if(!n)return i;const o=Md.exec(n);return o?`${i}prospects/${o[1]}`:`${i}project/${encodeURIComponent(n)}`}catch(e){return console.warn("Error in portalProjectUrl: ",e),t}})(ai,this._projectId)}catch(t){return console.warn("Error in adminPortalProjectUrl: ",t),`${ai}`}},this.portalInviteUrl=()=>{try{return this.isRunningUnderLivePreview()?this.adminPortalProjectUrl():null}catch(t){return console.warn("Error in portalInviteUrl: ",t),null}},this.goToAdminPortal=()=>{try{const t=this.adminPortalProjectUrl();eh(gt.Events.VIEW_PROJECT_CLICKED),window.open(t,"_blank")}catch(t){console.warn("Error in goToAdminPortal: ",t),th("Error in goToAdminPortal: ",t)}},this.openBugReportModal=()=>{try{this.showBugReportModal=!0,eh(gt.Events.REPORT_BUG_CLICKED)}catch(t){console.warn("Error in openBugReportModal: ",t),th("Error in openBugReportModal: ",t)}},this.closeBugReportModal=()=>{try{this.showBugReportModal=!1}catch(t){console.warn("Error in closeBugReportModal: ",t),th("Error in closeBugReportModal: ",t)}},this.goToAdminPortalDashboard=()=>{try{let t=`${ai}`;Velt&&(null===Velt||void 0===Velt?void 0:Velt.getDocumentId)&&this.serverDocumentId&&(t=`${ai}/dashboard`),window.open(t,"_blank")}catch(t){console.warn("Error in goToAdminPortalDashboard: ",t),th("Error in goToAdminPortalDashboard: ",t)}},this.joinCommunity=()=>{try{window.open("https://join.slack.com/t/superflowusers/shared_invite/zt-1q3jzsddt-NEb~uu9RXscLfxOIDGQXJw","_blank")}catch(t){console.warn("Error in joinCommunity: ",t),th("Error in joinCommunity: ",t)}},this.onboardingNextClick=()=>{try{this.showOnboardingModal=!1,pd(ve,"true");const t=new URL(document.location);t.searchParams.delete(ve),window.history.replaceState({},document.title,t.href)}catch(t){console.warn("Error in onboardingNextClick: ",t),th("Error in onboardingNextClick: ",t)}},this.onLiveDemoModalNextClick=()=>{try{this.showLiveDemoModal=!1,pd(ge,"true",!1,"sessionStorage");const t=new URL(document.location);t.searchParams.delete(ge),window.history.replaceState({},document.title,t.href)}catch(t){console.warn("Error in onLiveDemoModalNextClick: ",t),th("Error in onLiveDemoModalNextClick: ",t)}},this.onFigmaDemoModalNextClick=()=>{try{this.showFigmaDemoModal=!1;const t=new URL(document.location);t.searchParams.delete(fe),window.history.replaceState({},document.title,t.href)}catch(t){console.warn("Error in onFigmaDemoModalNextClick: ",t),th("Error in onFigmaDemoModalNextClick: ",t)}},this.onUpgradePlanClick=()=>{try{window.open(li,"_blank")}catch(t){console.warn("Error in onUpgradePlanClick: ",t),th("Error in onUpgradePlanClick: ",t)}},this.onTourCommentTooltipClick=()=>{try{this.showTourCommentTooltip=!1,pd(ye,"true"),this.firstCommentNudge&&(this.firstCommentNudge=!1,this.autoCommentModeArmedOnce=!0)}catch(t){console.warn("Error in onTourCommentTooltipClick: ",t),th("Error in onTourCommentTooltipClick: ",t)}},this.onGuestModeChipSignInButtonClick=()=>{try{eh(gt.Events.GUEST_MODE_SIGN_IN_BUTTON_CLICKED),this.loginWithGoogle()}catch(t){console.warn("Error in onGuestModeChipSignInButtonClick: ",t),th("Error in onGuestModeChipSignInButtonClick: ",t)}},this.openGuestModeSignInModal=()=>{try{this.showGuestModeSignInModal=!0,eh(gt.Events.GUEST_MODE_SIGN_IN_DIALOG_SHOWN)}catch(t){console.warn("Error in openGuestModeSignInModal: ",t),th("Error in openGuestModeSignInModal: ",t)}},this.closeGuestModeSignInModal=()=>{try{this.showGuestModeSignInModal=!1,this.guestModeSignInModalConfig=JSON.parse(JSON.stringify(this.defaultGuestModeSignInModalConfig))}catch(t){console.warn("Error in closeGuestModeSignInModal: ",t),th("Error in closeGuestModeSignInModal: ",t)}},this.onGuestModeSignInModalSignInButtonClick=()=>{try{eh(gt.Events.GUEST_MODE_SIGN_IN_BUTTON_CLICKED),this.loginWithGoogle()}catch(t){console.warn("Error in onGuestModeSignInModalSignInButtonClick: ",t),th("Error in onGuestModeSignInModalSignInButtonClick: ",t)}},this.openGuestModeNameModel=t=>{try{t&&(t.stopPropagation(),t.preventDefault()),this.skipGuestNameModal||(this.showGuestModeNameModal=!0,eh(gt.Events.GUEST_MODE_NAME_NUDGE_SHOWN))}catch(t){console.warn("Error in openGuestModeNameModel: ",t),th("Error in openGuestModeNameModel: ",t)}},this.closeGuestModeNameModel=()=>{try{this.showGuestModeNameModal=!1}catch(t){console.warn("Error in closeGuestModeNameModel: ",t),th("Error in closeGuestModeNameModel: ",t)}},this.onGuestModeNameModalSkipButtonClick=()=>{try{eh(gt.Events.GUEST_MODE_SKIP_BUTTON_CLICKED),this.showGuestModeNameModal=!1}catch(t){console.warn("Error in onGuestModeNameModalSkipButtonClick: ",t),th("Error in onGuestModeNameModalSkipButtonClick: ",t)}},this.onPasswordProtectedModalCloseButtonClick=()=>{try{eh(gt.Events.PASSWORD_PROTECTED_MODAL_CLOSE_BUTTON_CLICKED),this.showPasswordProtectedModal=!1,this.password="",this.showInvalidPassword=!1}catch(t){console.warn("Error in onPasswordProtectedModalCloseButtonClick: ",t),th("Error in onPasswordProtectedModalCloseButtonClick: ",t)}},this.onPasswordProtectedModalOpenButtonClick=()=>{try{eh(gt.Events.PASSWORD_PROTECTED_MODAL_OPEN_BUTTON_CLICKED),this.showPasswordProtectedModal=!0}catch(t){console.warn("Error in onPasswordProtectedModalOpenButtonClick: ",t),th("Error in onPasswordProtectedModalOpenButtonClick: ",t)}},this.showGuestModeSignInBanner=()=>{try{this.guestModeSignInBannerVisible=!0,eh(gt.Events.GUEST_MODE_SIGN_IN_NUDGE_SHOWN)}catch(t){console.warn("Error in showGuestModeSignInBanner: ",t),th("Error in showGuestModeSignInBanner: ",t)}},this.hideGuestModeSignInBanner=()=>{try{this.guestModeSignInBannerVisible=!1}catch(t){console.warn("Error in hideGuestModeSignInBanner: ",t),th("Error in hideGuestModeSignInBanner: ",t)}},this.onGuestModeBannerSignInButtonClick=()=>{try{eh(gt.Events.GUEST_MODE_SIGN_IN_CLICKED),this.loginWithGoogle()}catch(t){console.warn("Error in onGuestModeBannerSignInButtonClick: ",t),th("Error in onGuestModeBannerSignInButtonClick: ",t)}},this.updateGuestUserName=async()=>{var t;try{if(!(null===(t=this.guestUserNameInput)||void 0===t?void 0:t.trim()))return;if(this.guestUserNameUpdateLoading)return;const e=Cd(!0,this.apiKey);if(e){const t=JSON.parse(JSON.stringify(e));e.name=this.guestUserNameInput,e.photoUrl=null,this.guestUserNameUpdateLoading=!0,(t=>{try{const e=JSON.stringify(t),i=md(e,ci,di);pd(ce,i,!0)}catch(t){console.warn("Error in updateGuestUser: ",t),th("Error in updateGuestUser: ",t)}})(e),await Velt.identify(e),this.snippylyUser=JSON.parse(JSON.stringify(e)),await hh(this.apiKey,this.projectId||"",t,e),this.showGuestModeNameModal=!1,this.guestUserNameUpdated=!0,this.guestUserNameUpdateLoading=!1,pd(_e,"true"),eh(gt.Events.GUEST_MODE_NAME_ADDED,{oldName:null==t?void 0:t.name,newName:null==e?void 0:e.name})}this.closeGuestModeNameModel()}catch(t){console.warn("Error in updateGuestUserName: ",t),th("Error in updateGuestUserName: ",t)}},this.submitPassword=async()=>{var t;try{if(eh(gt.Events.REVIEW_PASSWORD_ADDED),!(null===(t=this.password)||void 0===t?void 0:t.trim()))return;if(this.validatingPasswordLoading)return;this.validatingPasswordLoading=!0,this.isPasswordValid=await sh(this.apiKey,this.projectId,this.password),function(t,e){try{const i="object"==typeof e?JSON.stringify(e):e;localStorage.setItem(t,i)}catch(t){console.warn("Error in setLocalStorage: ",t)}}(Se,this.isPasswordValid),this.isPasswordValid?(this.password="",this.onPasswordProtectedModalCloseButtonClick(),this.showInvalidPassword=!1,this.applyVeltFeatureGates(),eh(gt.Events.REVIEW_PASSWORD_ACCEPTED)):(this.showInvalidPassword=!0,eh(gt.Events.REVIEW_PASSWORD_REJECTED)),this.validatingPasswordLoading=!1}catch(t){console.warn("Error in submitPassword: ",t),th("Error in submitPassword: ",t)}},this.updateUserName=async()=>{var t,e;try{if(!(null===(t=this.guestUserNameInput)||void 0===t?void 0:t.trim()))return;if(this.guestUserNameUpdateLoading)return;this.guestUserNameUpdateLoading=!0;const i=JSON.parse(JSON.stringify(this.snippylyUser)),n=JSON.parse(JSON.stringify(this.snippylyUser));n.name=this.guestUserNameInput;const o=this.readLiveSignIn(),r=o&&(null===(e=o.user)||void 0===e?void 0:e.userId)===(null==i?void 0:i.userId)?o.token:null,s=this.isLiveShareGuest()?r:this.credentialFor(i,this.identityCameFromToken),a=await hh(this.apiKey,this.projectId||"",i,n,!1,s);if(!1===(null==a?void 0:a.success))return console.warn("[CWS Toolbar] Name change refused; keeping the old name:",null==a?void 0:a.reason),this.guestUserNameUpdateLoading=!1,this.guestUserNameInput="",void this.closeGuestModeNameModel();await Velt.updateUser(n),this.snippylyUser=JSON.parse(JSON.stringify(n));const l=this.identityCameFromToken?yd():null;if(l){l.name=n.name;const t=JSON.stringify(l),e=md(t,ci,di);pd(se,e,!0)}n.isGuest&&(this.guestUserNameUpdated=!0,pd(_e,"true")),this.guestUserNameUpdateLoading=!1,this.guestUserNameInput="",this.closeGuestModeNameModel()}catch(t){console.warn("Error in updateUserName: ",t),th("Error in updateUserName: ",t)}},this.isAgentAnnotation=t=>{var e;try{const i=null!==this.extractAgentId((null===(e=null==t?void 0:t.agent)||void 0===e?void 0:e.agentFields)||[]),n=(null==t?void 0:t.type)===je,o=(null==t?void 0:t.commentType)===je;return i||n||o}catch(t){return console.warn("Error in isAgentAnnotation: ",t),!1}},this.getSidebarGroupExpansionMap=()=>{var t,e,i,n,o;try{const r=document.querySelector(ze.VELT_COMMENTS_SIDEBAR_LEGACY),s=null===(o=null===(n=null===(i=null===(e=null===(t=null==r?void 0:r._ngElementStrategy)||void 0===t?void 0:t.componentRef)||void 0===e?void 0:e.instance)||void 0===i?void 0:i.componentConfigSignal)||void 0===n?void 0:n.call(i))||void 0===o?void 0:o.virtualScrollData;if(!Array.isArray(s))return;const a=new Map;return s.forEach((t=>{var e,i;if("group"!==(null==t?void 0:t.type))return;const n=null===(e=null==t?void 0:t.data)||void 0===e?void 0:e.displayName,o=null===(i=null==t?void 0:t.data)||void 0===i?void 0:i.isExpanded;"string"==typeof n&&"boolean"==typeof o&&a.set(n,o)})),a}catch(t){return void console.warn("Error in getSidebarGroupExpansionMap: ",t)}},this.filterAgentCommentsFromSidebar=(t,e)=>{try{if(this.isSettingSidebarData)return;if(!t||!this.commentElement)return;const i=t.commentAnnotations;if(!Array.isArray(i))return;if(this.processAgentComments(this.mergeOnboardingFetchedAnnotations(i)),this.ensureOnboardingFindingsLoaded(),this.sidebarV2Enabled)return;if(this.showAgentCommentsInSidebar)return;const n=Array.isArray(null==t?void 0:t.systemFilteredAnnotations)?t.systemFilteredAnnotations:[],o=new Set(n.map((t=>(null==t?void 0:t.annotationId)||(null==t?void 0:t.id))).filter((t=>Boolean(t)))),r=[];i.forEach((t=>{if(this.isAgentAnnotation(t))return;const e=(null==t?void 0:t.annotationId)||(null==t?void 0:t.id);e&&o.has(e)&&r.push(t)}));const s=new Map;r.forEach((t=>{var e,i,n,o;const r=(null===(e=null==t?void 0:t.pageInfo)||void 0===e?void 0:e.path)||(null===(i=null==t?void 0:t.pageInfo)||void 0===i?void 0:i.url)||(null===(n=null==t?void 0:t.location)||void 0===n?void 0:n.path)||"/";s.has(r)||s.set(r,[]),null===(o=s.get(r))||void 0===o||o.push(t)}));const a=[],l=new URL(window.location.href).pathname,c="/"+this.normalizePagePath(l);s.forEach(((t,i)=>{const n=null==e?void 0:e.get(i);a.push({groupId:i,groupName:i,isExpanded:"boolean"==typeof n?n:i===c,annotations:t})})),this.isSettingSidebarData=!0,this.commentElement.setCommentSidebarData(a,{grouping:!0}),this.isSettingSidebarData=!1}catch(t){this.isSettingSidebarData=!1,console.warn("Error in filterAgentCommentsFromSidebar: ",t),th("Error in filterAgentCommentsFromSidebar: ",t)}},this.mountVeltCollaborationElements=()=>{if(!document.querySelector(ze.VELT_COMMENTS)){const t=document.createElement(ze.VELT_COMMENTS);t.setAttribute("filter-comments-on-dom","true"),t.setAttribute("shadow-dom","true"),null==t||t.addEventListener("onSignIn",(()=>{this.loginWithGoogle()})),null==t||t.addEventListener("onUpgrade",(()=>{this.onUpgradePlanClick()})),t.addEventListener("onCommentAdd",(()=>{this.addCommentCount++})),t.addEventListener("onCommentUpdate",(t=>{var e,i;(null===(e=this.snippylyUser)||void 0===e?void 0:e.isGuest)&&"newlyAdded"===(null===(i=null==t?void 0:t.detail)||void 0===i?void 0:i.type)&&(this.addCommentCount>=2&&(this.showModalOnceCommentIsModeIsOff=!0),this.addCommentCount>=5&&!this.showModalOnceCommentIsModeIsOff&&(this.showModalOnceCommentIsModeIsOff=!0))})),window.document.body.appendChild(t)}if(!document.querySelector(ze.VELT_CURSOR)){const t=document.createElement(ze.VELT_CURSOR);window.document.body.appendChild(t)}if(!document.querySelector(ze.VELT_HUDDLE)){const t=document.createElement(ze.VELT_HUDDLE);window.document.body.appendChild(t)}if(!document.querySelector(ze.VELT_RECORDER_NOTES)){const t=document.createElement(ze.VELT_RECORDER_NOTES);window.document.body.appendChild(t)}if(!document.querySelector(ze.VELT_RECORDER_CONTROL_PANEL)){const t=document.createElement(ze.VELT_RECORDER_CONTROL_PANEL);window.document.body.appendChild(t)}if(!document.querySelector(ze.VELT_ARROWS)){const t=document.createElement(ze.VELT_ARROWS);window.document.body.appendChild(t)}},this.unmountVeltCollaborationElements=()=>{try{document.querySelectorAll(Lv.COLLABORATION_TAGS.join(", ")).forEach((t=>t.remove()))}catch(t){console.warn("Error in unmountVeltCollaborationElements: ",t),th("Error in unmountVeltCollaborationElements: ",t)}},this.mountCommentSidebar=()=>{if(this.latchAgentsSidebarMode(),this.agentsSidebarMode)return this.mountScopedCommentSidebars(),void this.syncSidebarFocusedView();const t=this.sidebarV2Enabled,e=t?ze.VELT_COMMENTS_SIDEBAR_V2:ze.VELT_COMMENTS_SIDEBAR_LEGACY,i=t?ze.VELT_COMMENTS_SIDEBAR_LEGACY:ze.VELT_COMMENTS_SIDEBAR_V2;if(document.querySelectorAll(i).forEach((t=>t.remove())),document.querySelector(e))this.syncSidebarFocusedView();else{const i=document.createElement(e);i.setAttribute("shadow-dom","true"),i.setAttribute(t?He.URL_NAVIGATION:He.ENABLE_URL_NAVIGATION,"true"),i.setAttribute(He.CURRENT_LOCATION_SUFFIX,"true"),e===ze.VELT_COMMENTS_SIDEBAR_LEGACY?(i.setAttribute(He.SIDEBAR_BUTTON_COUNT_TYPE,qe),i.setAttribute(He.CUSTOM_ACTIONS,"true")):this.syncSidebarFocusedView(i),window.document.body.appendChild(i)}},this.mountScopedCommentSidebars=()=>{try{const t=ze.VELT_COMMENTS_SIDEBAR_V2;document.querySelectorAll(ze.VELT_COMMENTS_SIDEBAR_LEGACY).forEach((t=>t.remove()));const e=wp;if(!document.querySelector(`${t}:not([${e}])`)){const e=document.createElement(t);e.setAttribute("shadow-dom","true"),e.setAttribute(He.URL_NAVIGATION,"true"),e.setAttribute(He.CURRENT_LOCATION_SUFFIX,"true"),e.setAttribute(yp,JSON.stringify(Sp())),window.document.body.appendChild(e)}if(!document.querySelector(`${t}[${e}="${mp}"]`)){const i=document.createElement(t);i.setAttribute(e,mp),i.setAttribute("shadow-dom","true"),i.setAttribute(He.CURRENT_LOCATION_SUFFIX,"true"),i.setAttribute(Cp,"false"),i.setAttribute(yp,JSON.stringify(Ep(kp))),i.setAttribute(bp,JSON.stringify({enable:!0,groupBy:"checkInfo.ruleKey"})),this.syncSidebarFocusedView(i),window.document.body.appendChild(i)}}catch(t){console.warn("Error in mountScopedCommentSidebars: ",t),th("Error in mountScopedCommentSidebars: ",t)}},this.agentsSidebarBusSubscriptions=[],this.defaultSidebarOpen=!1,this.defaultSidebarConfigDriftReported=!1,this.keepSelectionOnAgentsSidebarClose=!1,this.lastAgentsSidebarClick=null,this.agentsSidebarBusElement=void 0,this.syncAgentsSidebarBusSubscriptions=()=>{try{const t=this.commentElement,e=this.agentsSidebarMode&&!!t&&"function"==typeof t.on;if(e&&this.agentsSidebarBusElement===t)return;if(this.teardownAgentsSidebarBusSubscriptions(),!e)return;this.agentsSidebarBusElement=t;const i=t.on(Op);i&&"function"==typeof i.subscribe&&this.agentsSidebarBusSubscriptions.push(i.subscribe(this.onAgentsSidebarCommentClick));const n=t.on(Np);n&&"function"==typeof n.subscribe&&this.agentsSidebarBusSubscriptions.push(n.subscribe(this.onAgentsSidebarCommentClick));const o=t.on(Rp);o&&"function"==typeof o.subscribe&&this.agentsSidebarBusSubscriptions.push(o.subscribe(this.onAgentsSidebarClose));const r=t.on(Lp);r&&"function"==typeof r.subscribe&&this.agentsSidebarBusSubscriptions.push(r.subscribe(this.onSidebarBusOpen));const s="function"==typeof t.getCommentSidebarConfig?t.getCommentSidebarConfig():null;s&&"function"==typeof s.subscribe?this.agentsSidebarBusSubscriptions.push(s.subscribe(this.onDefaultSidebarConfig)):this.reportDefaultSidebarConfigDrift("no getCommentSidebarConfig")}catch(t){console.warn("Error in syncAgentsSidebarBusSubscriptions: ",t),th("Error in syncAgentsSidebarBusSubscriptions: ",t)}},this.teardownAgentsSidebarBusSubscriptions=()=>{try{this.agentsSidebarBusSubscriptions.forEach((t=>{var e;return null===(e=null==t?void 0:t.unsubscribe)||void 0===e?void 0:e.call(t)})),this.agentsSidebarBusSubscriptions=[],this.agentsSidebarBusElement=void 0,this.defaultSidebarOpen=!1}catch(t){console.warn("Error in teardownAgentsSidebarBusSubscriptions: ",t)}},this.onAgentsSidebarCommentClick=t=>{try{if(!this.agentsSidebarMode)return;const e=function(t){try{const e=null==t?void 0:t.annotation;if(!e||!e.annotationId&&!e.id)return null;const i=null==t?void 0:t.sidebarId;return i===mp||null==i&&Tp(e)?e:null}catch(t){return console.warn("Error in readAgentsSidebarClickAnnotation: ",t),null}}(t);if(!e)return;const i=String(e.annotationId||e.id),n=Date.now(),o=this.lastAgentsSidebarClick;if(o&&o.annotationId===i&&n-o.at<1e3)return;this.lastAgentsSidebarClick={annotationId:i,at:n},this.onContentWarningItemClick({detail:{annotation:e,fromAgentsSidebar:!0}})}catch(t){console.warn("Error in onAgentsSidebarCommentClick: ",t),th("Error in onAgentsSidebarCommentClick: ",t)}},this.onAgentsSidebarClose=t=>{try{if(!this.agentsSidebarMode)return;if("default"===Dp(t)&&(this.defaultSidebarOpen=!1),!function(t){try{return(null==t?void 0:t.sidebarId)===mp}catch(t){return console.warn("Error in isAgentsSidebarCloseEvent: ",t),!1}}(t))return;this.showContentWarningSidebar&&(this.showContentWarningSidebar=!1)}catch(t){console.warn("Error in onAgentsSidebarClose: ",t)}},this.onDefaultSidebarConfig=t=>{try{if(!this.agentsSidebarMode)return;const e=function(t){try{let e=t;for(const t of Pp.VISIBLE_PATH){if(null===e||"object"!=typeof e)return null;e=e[t]}return"boolean"==typeof e?e:null}catch(t){return console.warn("Error in readSidebarConfigVisible: ",t),null}}(t);if(null===e)return void(null!==t&&"object"==typeof t&&this.reportDefaultSidebarConfigDrift("no uiState.sidebarVisible"));this.noteDefaultSidebarVisibility(e)}catch(t){console.warn("Error in onDefaultSidebarConfig: ",t),th("Error in onDefaultSidebarConfig: ",t)}},this.noteDefaultSidebarVisibility=t=>{try{if(t===this.defaultSidebarOpen)return;this.defaultSidebarOpen=t,t&&this.showContentWarningSidebar&&(this.keepSelectionOnAgentsSidebarClose=!0,this.showContentWarningSidebar=!1)}catch(t){console.warn("Error in noteDefaultSidebarVisibility: ",t),th("Error in noteDefaultSidebarVisibility: ",t)}},this.reportDefaultSidebarConfigDrift=t=>{try{if(this.defaultSidebarConfigDriftReported)return;this.defaultSidebarConfigDriftReported=!0;const e=`[CWS Toolbar] The comments sidebar's open is not visible to the toolbar (${t}; expected ${Pp.VISIBLE_PATH.join(".")} in getCommentSidebarConfig()): the Agents sidebar will not close when it opens.`;console.warn(e),th("Default sidebar config drift: ",new Error(e))}catch(t){console.warn("Error in reportDefaultSidebarConfigDrift: ",t)}},this.onSidebarBusOpen=t=>{try{if(!this.agentsSidebarMode)return;const e=Dp(t);if("default"===e)return void this.noteDefaultSidebarVisibility(!0);"agents"===e&&this.defaultSidebarOpen&&queueMicrotask(this.closeDefaultSidebarUnderAgentsSidebar)}catch(t){console.warn("Error in onSidebarBusOpen: ",t),th("Error in onSidebarBusOpen: ",t)}},this.closeDefaultSidebarUnderAgentsSidebar=()=>{var t,e;try{if(!this.agentsSidebarMode||!this.defaultSidebarOpen)return;null===(e=null===(t=this.commentElement)||void 0===t?void 0:t.closeCommentSidebar)||void 0===e||e.call(t),this.restoreCommentSidebarFocus()}catch(t){console.warn("Error in closeDefaultSidebarUnderAgentsSidebar: ",t),th("Error in closeDefaultSidebarUnderAgentsSidebar: ",t)}},this.readSelectedCommentIds=()=>{var t,e;try{const i="function"==typeof(null===(t=this.commentElement)||void 0===t?void 0:t.getSelectedComments)?this.commentElement.getSelectedComments():null;if(!i||"function"!=typeof i.subscribe)return[];let n=[];const o=i.subscribe((t=>{n=(Array.isArray(t)?t:[]).map(ou).filter((t=>""!==t))}));return null===(e=null==o?void 0:o.unsubscribe)||void 0===e||e.call(o),n}catch(t){return console.warn("Error in readSelectedCommentIds: ",t),th("Error in readSelectedCommentIds: ",t),[]}},this.agentsSidebarOpenApplied=!1,this.syncAgentsSidebarOpenState=()=>{var t,e,i,n,o,r;const s=this.keepSelectionOnAgentsSidebarClose;this.keepSelectionOnAgentsSidebarClose=!1;try{if(!this.agentsSidebarMode)return;const a=this.commentElement;if(!a)return;const l=this.showContentWarningSidebar&&this.canShowContentWarningSidebar(),c=l?this.getAgentsSidebarDeepLinkFocusId():null;if(l===this.agentsSidebarOpenApplied&&!c)return;if(this.agentsSidebarOpenApplied=l,l){null===(t=a.closeCommentSidebar)||void 0===t||t.call(a),this.restoreCommentSidebarFocus(),null===(e=a.disableSidebarUrlNavigation)||void 0===e||e.call(a);const n=c;c&&(this.agentsSidebarDeepLinkId=null),null===(i=a.openCommentSidebar)||void 0===i||i.call(a,n?{sidebarId:mp,annotationId:n}:{sidebarId:mp})}else{const t=s?this.readSelectedCommentIds():[];null===(n=a.closeCommentSidebar)||void 0===n||n.call(a,{sidebarId:mp}),null===(o=a.enableSidebarUrlNavigation)||void 0===o||o.call(a),this.agentsSidebarDeepLinkId=null,t.length>0&&0===this.readSelectedCommentIds().length&&(null===(r=a.selectCommentByAnnotationId)||void 0===r||r.call(a,t[0]))}}catch(t){console.warn("Error in syncAgentsSidebarOpenState: ",t),th("Error in syncAgentsSidebarOpenState: ",t)}},this.onCommentsSidebarButtonClick=()=>{try{if(!this.agentsSidebarMode||!this.showContentWarningSidebar)return;this.showContentWarningSidebar=!1}catch(t){console.warn("Error in onCommentsSidebarButtonClick: ",t)}},this.getAgentsSidebarDeepLinkFocusId=()=>{var t,e;try{const i=this.agentsSidebarDeepLinkId;if(!i)return null;const n=[...(null!==(t=this.agentGroups)&&void 0!==t?t:[]).flatMap((t=>{var e;return null!==(e=null==t?void 0:t.annotations)&&void 0!==e?e:[]})),...null!==(e=this.lastStreamAnnotations)&&void 0!==e?e:[]];return n.some((t=>ou(t)===i&&Tp(t)))?i:null}catch(t){return console.warn("Error in getAgentsSidebarDeepLinkFocusId: ",t),null}},this.maybeOpenAgentsSidebarForDeepLink=()=>{try{if(!this.agentsSidebarMode||!this.canShowContentWarningSidebar())return;if(!this.getAgentsSidebarDeepLinkFocusId())return;if(this.showContentWarningSidebar)return void this.syncAgentsSidebarOpenState();this.showContentWarningSidebar=!0}catch(t){console.warn("Error in maybeOpenAgentsSidebarForDeepLink: ",t),th("Error in maybeOpenAgentsSidebarForDeepLink: ",t)}},this.collectCommentCopies=(t,e)=>{var i,n;try{if(!t)return[];const o=e=>((null==e?void 0:e.annotationId)||(null==e?void 0:e.id))===t,r=[e,this.resolveFullAnnotation({annotationId:t}),...null!==(i=this.lastStreamAnnotations)&&void 0!==i?i:[],...(null!==(n=this.agentGroups)&&void 0!==n?n:[]).flatMap((t=>{var e;return null!==(e=null==t?void 0:t.annotations)&&void 0!==e?e:[]}))].filter((t=>t&&"object"==typeof t&&o(t)));return Array.from(new Set(r))}catch(t){return console.warn("Error in collectCommentCopies: ",t),th("Error in collectCommentCopies: ",t),e?[e]:[]}},this.hasResolvingOnPageAnchor=(t,e)=>{try{const i=Gp(document);return this.collectCommentCopies(t,e).some((t=>Qp(t,i)))}catch(t){return console.warn("Error in hasResolvingOnPageAnchor: ",t),th("Error in hasResolvingOnPageAnchor: ",t),!1}},this.resolveAnchorlessCommentFocus=(t,e)=>{try{return tv({copies:this.collectCommentCopies(t,e),sidebarV2:this.sidebarV2Enabled,agentsSidebarMode:this.agentsSidebarMode,onboardingMode:this.onboardingMode,anchorResolver:Gp(document)})}catch(t){return console.warn("Error in resolveAnchorlessCommentFocus: ",t),th("Error in resolveAnchorlessCommentFocus: ",t),null}},this.openAgentAnnotationHere=(t,e=!1,i="other",n)=>{try{const o=(null==t?void 0:t.annotationId)||(null==t?void 0:t.id);if(!o)return null;let r=!1;if(!e){const e=this.resolveAnchorlessCommentFocus(String(o),t);if(e&&this.openCommentSidebarFocus(e))return{outcome:"opened",sidebarRefused:!1};if(r=null!==e,this.agentStatusMode){"show"===i&&this.hasResolvingOnPageAnchor(String(o),t)&&this.adoptRequestedAgentPinVisibility();return{outcome:this.openAgentPin(String(o),i,n)?"pin-opened":"waiting-pin",sidebarRefused:r}}}return this.selectAnnotationOnPage(o),{outcome:"selected",sidebarRefused:r}}catch(t){return console.warn("Error in openAgentAnnotationHere: ",t),th("Error in openAgentAnnotationHere: ",t),null}},this.openAgentPin=(t,e="other",i)=>{try{return this.pendingAgentPin=null,t?(this.openAgentPinDialog(t),Mv(t).length>0||(this.pendingAgentPin=i?{annotationId:t,pagePath:this.getCurrentPagePath(),source:e,show:i}:{annotationId:t,pagePath:this.getCurrentPagePath(),source:e},!1)):!1}catch(t){return console.warn("Error in openAgentPin: ",t),th("Error in openAgentPin: ",t),!1}},this.openPendingAgentPin=t=>{try{const e=this.pendingAgentPin;if(!e||0===t.length)return;if(!t.some((t=>Av(t)===e.annotationId)))return;if(this.pendingAgentPin=null,!Zp(e.pagePath,this.getCurrentPagePath()))return;this.openAgentPinDialog(e.annotationId),this.recordAgentPinRequestOutcome(e,"pin-opened","pin-opened")}catch(t){this.pendingAgentPin=null,console.warn("Error in openPendingAgentPin: ",t),th("Error in openPendingAgentPin: ",t)}},this.openAgentPinDialog=t=>{try{if(this.releaseAgentPinDialogHold("replaced"),!t)return;this.selectAnnotationOnPage(t),this.holdAgentPinDialog(t)}catch(t){console.warn("Error in openAgentPinDialog: ",t),th("Error in openAgentPinDialog: ",t)}},this.holdAgentPinDialog=t=>{var e,i;try{const n={annotationId:t,selected:!1,reselects:0,ended:null,at:Date.now()};this.lastAgentPinDialog=n;const o="function"==typeof(null===(e=this.commentElement)||void 0===e?void 0:e.getSelectedComments)?this.commentElement.getSelectedComments():null;if(!o||"function"!=typeof o.subscribe)return void(n.ended="unsupported");const r={annotationId:t,pagePath:this.getCurrentPagePath(),until:Date.now()+Qt,seen:!1,reselects:0,subscription:null,expiryTimer:null,reselectTimer:null,record:n};this.agentPinDialogHold=r,window.addEventListener("pointerdown",this.onAgentPinDialogViewerInput,!0),window.addEventListener("keydown",this.onAgentPinDialogViewerInput,!0),r.expiryTimer=setTimeout((()=>{this.agentPinDialogHold===r&&this.releaseAgentPinDialogHold("expired")}),Qt);const s=o.subscribe((t=>this.onAgentPinDialogSelection(r,t)));this.agentPinDialogHold===r?r.subscription=s:null===(i=null==s?void 0:s.unsubscribe)||void 0===i||i.call(s)}catch(t){this.releaseAgentPinDialogHold("error"),console.warn("Error in holdAgentPinDialog: ",t),th("Error in holdAgentPinDialog: ",t)}},this.onAgentPinDialogSelection=(t,e)=>{try{if(this.agentPinDialogHold!==t)return;const i=(Array.isArray(e)?e:[]).map(ou).filter((t=>""!==t));if(i.includes(t.annotationId))return t.seen=!0,t.record.selected=!0,void(null!==t.reselectTimer&&(clearTimeout(t.reselectTimer),t.reselectTimer=null));if(i.length>0)return void this.releaseAgentPinDialogHold("other-selected");if(!t.seen||null!==t.reselectTimer)return;if(Date.now()>=t.until)return void this.releaseAgentPinDialogHold("expired");if(t.reselects>=3)return void this.releaseAgentPinDialogHold("limit");t.reselectTimer=setTimeout((()=>{var e,i;try{if(t.reselectTimer=null,this.agentPinDialogHold!==t)return;t.reselects+=1,t.record.reselects=t.reselects,null===(i=null===(e=this.commentElement)||void 0===e?void 0:e.selectCommentByAnnotationId)||void 0===i||i.call(e,t.annotationId)}catch(t){console.warn("Error in onAgentPinDialogSelection (reselect): ",t),th("Error in onAgentPinDialogSelection (reselect): ",t)}}),0)}catch(t){console.warn("Error in onAgentPinDialogSelection: ",t),th("Error in onAgentPinDialogSelection: ",t)}},this.onAgentPinDialogViewerInput=t=>{try{if(!1===(null==t?void 0:t.isTrusted))return;this.releaseAgentPinDialogHold("viewer")}catch(t){console.warn("Error in onAgentPinDialogViewerInput: ",t)}},this.releaseAgentPinDialogHold=t=>{var e,i;const n=this.agentPinDialogHold;if(n){this.agentPinDialogHold=null;try{null!==n.expiryTimer&&clearTimeout(n.expiryTimer),null!==n.reselectTimer&&clearTimeout(n.reselectTimer),null===(i=null===(e=n.subscription)||void 0===e?void 0:e.unsubscribe)||void 0===i||i.call(e),window.removeEventListener("pointerdown",this.onAgentPinDialogViewerInput,!0),window.removeEventListener("keydown",this.onAgentPinDialogViewerInput,!0),n.record.ended=t}catch(t){console.warn("Error in releaseAgentPinDialogHold: ",t),th("Error in releaseAgentPinDialogHold: ",t)}}},this.openCommentSidebarFocus=t=>{try{return!!(null==t?void 0:t.annotationId)&&(this.releaseAgentPinDialogHold("replaced"),t.sidebarId===mp?this.focusAgentsSidebarOn(t.annotationId):this.focusDefaultCommentSidebarOn(t.annotationId))}catch(t){return console.warn("Error in openCommentSidebarFocus: ",t),th("Error in openCommentSidebarFocus: ",t),!1}},this.focusAgentsSidebarOn=t=>{var e;try{if(!this.agentsSidebarMode||!this.canShowContentWarningSidebar()||"function"!=typeof(null===(e=this.commentElement)||void 0===e?void 0:e.openCommentSidebar))return!1;const i=this.agentsSidebarDeepLinkId;return this.agentsSidebarDeepLinkId=t,this.getAgentsSidebarDeepLinkFocusId()!==t?(this.agentsSidebarDeepLinkId=i,!1):(this.showContentWarningSidebar?this.syncAgentsSidebarOpenState():this.showContentWarningSidebar=!0,!0)}catch(t){return console.warn("Error in focusAgentsSidebarOn: ",t),th("Error in focusAgentsSidebarOn: ",t),!1}},this.focusDefaultCommentSidebarOn=t=>{try{const e=this.commentElement;if(!t||"function"!=typeof(null==e?void 0:e.openCommentSidebar))return!1;if(!this.canShowContentWarningSidebar())return!1;const i=this.showContentWarningSidebar,n=i||!this.showAgentCommentsInSidebar;if(!this.recordCommentSidebarFocus(n))return!1;this.setCommentSidebarVisibility(!0);try{e.openCommentSidebar({annotationId:t})}catch(t){throw this.restoreCommentSidebarFocus(),t}return i&&(this.keepAgentCommentsShownOnPanelClose=!0,this.showContentWarningSidebar=!1),!0}catch(t){return console.warn("Error in focusDefaultCommentSidebarOn: ",t),th("Error in focusDefaultCommentSidebarOn: ",t),!1}},this.findSidebarV2Element=t=>{try{const e=ze.VELT_COMMENTS_SIDEBAR_V2,i=wp;return document.querySelector(t?`${e}[${i}="${t}"]`:`${e}:not([${i}])`)}catch(t){return console.warn("Error in findSidebarV2Element: ",t),null}},this.syncSidebarFocusedView=t=>{try{const e=(t=>{try{return!0!==(null==t?void 0:t.agentStatusMode)||!0===t.onboardingMode||!0!==t.sidebarV2?null:!0===t.agentsSidebarMode?"agents":"default"}catch(t){return console.warn("Error in resolveFocusedViewSidebar: ",t),null}})({agentStatusMode:this.agentStatusMode,onboardingMode:this.onboardingMode,agentsSidebarMode:this.agentsSidebarMode,sidebarV2:this.sidebarV2Enabled}),i="agents"===e?mp:null,n=(null==t?void 0:t.getAttribute(wp))||null,o=null===e?null:t&&n===i?t:this.findSidebarV2Element(i),r=this.focusedViewSidebarElement;r&&r!==o&&ev.forEach((t=>r.removeAttribute(t))),o&&ev.forEach((t=>{"true"!==o.getAttribute(t)&&o.setAttribute(t,"true")})),this.focusedViewSidebarElement=o}catch(t){console.warn("Error in syncSidebarFocusedView: ",t),th("Error in syncSidebarFocusedView: ",t)}},this.recordCommentSidebarFocus=(t=!1)=>{var e;try{const i=!0===(null===(e=this.commentSidebarFocus)||void 0===e?void 0:e.hideAgentCommentsOnRestore);this.restoreCommentSidebarFocus({keepAgentComments:!0});const n=this.commentElement,o="function"==typeof(null==n?void 0:n.on)?n.on(Rp):null;if(!o||"function"!=typeof o.subscribe)return!1;const r={hideAgentCommentsOnRestore:t||i,subscription:null};let s=!0;return r.subscription=o.subscribe((t=>{try{const e="string"==typeof(null==t?void 0:t.sidebarId)&&""!==t.sidebarId;if(s||e||this.commentSidebarFocus!==r)return;this.restoreCommentSidebarFocus()}catch(t){console.warn("Error in recordCommentSidebarFocus (close): ",t),th("Error in recordCommentSidebarFocus (close): ",t)}})),s=!1,this.commentSidebarFocus=r,!0}catch(t){return console.warn("Error in recordCommentSidebarFocus: ",t),th("Error in recordCommentSidebarFocus: ",t),!1}},this.restoreCommentSidebarFocus=(t={})=>{var e,i;try{const n=this.commentSidebarFocus;if(!n)return;if(this.commentSidebarFocus=null,null===(i=null===(e=n.subscription)||void 0===e?void 0:e.unsubscribe)||void 0===i||i.call(e),n.hideAgentCommentsOnRestore&&!(null==t?void 0:t.keepAgentComments)&&!this.showContentWarningSidebar){const t=this.getRestingAgentCommentsVisibility();t||(this.keepAgentCommentsShownOnPanelClose=!1),this.setCommentSidebarVisibility(t)}}catch(t){this.commentSidebarFocus=null,console.warn("Error in restoreCommentSidebarFocus: ",t),th("Error in restoreCommentSidebarFocus: ",t)}},this.armCommentDeepLink=t=>{try{if(!t||this.armedCommentDeepLinkIds.has(t))return;this.armedCommentDeepLinkIds.add(t),this.pendingCommentDeepLink={annotationId:t,pagePath:this.getCurrentPagePath()},this.recordCommentDeepLinkDecision(t,"waiting-comment")}catch(t){console.warn("Error in armCommentDeepLink: ",t),th("Error in armCommentDeepLink: ",t)}},this.applyPendingCommentDeepLink=()=>{try{const t=this.pendingCommentDeepLink;if(!t)return;const{annotationId:e}=t;if(!Zp(t.pagePath,this.getCurrentPagePath()))return void this.dropPendingCommentDeepLink("page-changed");if(null===this.agentsSidebarModeLatched)return void this.recordCommentDeepLinkDecision(e,"waiting-mode");if(!this.canShowContentWarningSidebar())return void this.recordCommentDeepLinkDecision(e,"waiting-viewer");if(!this.isPortalShowAnnotationReady(e))return void this.recordCommentDeepLinkDecision(e,"waiting-comment");if(!this.collectCommentCopies(e).some((t=>this.isAgentAnnotation(t)||"agent"===(null==t?void 0:t.sourceType))))return void this.dropPendingCommentDeepLink("not-agent");if(!this.opensAgentAnnotationHere(this.findLoadedAgentAnnotation(e)))return void this.dropPendingCommentDeepLink("other-page");if(!this.sidebarV2Enabled||this.onboardingMode)return void this.dropPendingCommentDeepLink("no-sidebar");if(this.isDocumentStillParsing())return this.recordCommentDeepLinkDecision(e,"waiting-dom"),void this.waitForDocumentParsed();const i=this.resolveAnchorlessCommentFocus(e);if(!i){if(this.dropPendingCommentDeepLink("anchored"),this.agentStatusMode){this.hasResolvingOnPageAnchor(e)&&this.adoptRequestedAgentPinVisibility();const t=this.openAgentPin(e,"deep-link");this.recordCommentDeepLinkDecision(e,t?"pin-opened":"waiting-pin")}return}if(i.sidebarId===mp&&!this.agentStatusMode)return void this.dropPendingCommentDeepLink("agents-sidebar");this.dropPendingCommentDeepLink("opened"),this.openCommentSidebarFocus(i)||this.recordCommentDeepLinkDecision(e,"open-failed")}catch(t){this.dropPendingCommentDeepLink("error"),console.warn("Error in applyPendingCommentDeepLink: ",t),th("Error in applyPendingCommentDeepLink: ",t)}},this.setCommentSidebarVisibility=t=>{var e,i,n,o,r,s,a,l;try{if(t===this.showAgentCommentsInSidebar)return;if(this.sidebarV2Enabled)return t?null===(i=null===(e=this.commentElement)||void 0===e?void 0:e.disableFilterCommentsOnDom)||void 0===i||i.call(e):null===(o=null===(n=this.commentElement)||void 0===n?void 0:n.enableFilterCommentsOnDom)||void 0===o||o.call(n),void(this.showAgentCommentsInSidebar=t);const c=document.querySelector(ze.VELT_COMMENTS_SIDEBAR_LEGACY);if(!c)return;t?(c.removeAttribute(He.SIDEBAR_BUTTON_COUNT_TYPE),c.removeAttribute(He.CUSTOM_ACTIONS),null===(s=null===(r=this.commentElement)||void 0===r?void 0:r.disableFilterCommentsOnDom)||void 0===s||s.call(r)):(c.setAttribute(He.SIDEBAR_BUTTON_COUNT_TYPE,qe),c.setAttribute(He.CUSTOM_ACTIONS,"true"),null===(l=null===(a=this.commentElement)||void 0===a?void 0:a.enableFilterCommentsOnDom)||void 0===l||l.call(a)),this.showAgentCommentsInSidebar=t}catch(t){console.warn("Error in setCommentSidebarVisibility: ",t),th("Error in setCommentSidebarVisibility: ",t)}},this.toggleCommentSidebarVisibility=()=>{try{const t=!this.showAgentCommentsInSidebar;this.agentCommentsChoice=t,this.setCommentSidebarVisibility(t),this.menuOpenedId=void 0}catch(t){console.warn("Error in toggleCommentSidebarVisibility: ",t),th("Error in toggleCommentSidebarVisibility: ",t)}},this.getRestingAgentCommentsVisibility=()=>{var t;try{return null!==(t=this.agentCommentsChoice)&&void 0!==t?t:this.agentCommentsModeRequested}catch(t){return console.warn("Error in getRestingAgentCommentsVisibility: ",t),th("Error in getRestingAgentCommentsVisibility: ",t),this.agentCommentsModeRequested}},this.adoptRequestedAgentPinVisibility=()=>{try{if(!this.canShowContentWarningSidebar())return;this.getRestingAgentCommentsVisibility()||(this.agentCommentsChoice=!0),this.setCommentSidebarVisibility(!0)}catch(t){console.warn("Error in adoptRequestedAgentPinVisibility: ",t),th("Error in adoptRequestedAgentPinVisibility: ",t)}},this.applyPageCommentsVisibility=()=>{try{const t=this.commentElement;if(!t)return;this.pageCommentsHidden?"function"==typeof t.hideCommentsOnDom&&t.hideCommentsOnDom():"function"==typeof t.showCommentsOnDom&&t.showCommentsOnDom()}catch(t){console.warn("Error in applyPageCommentsVisibility: ",t),th("Error in applyPageCommentsVisibility: ",t)}},this.togglePageCommentsVisibility=()=>{try{this.pageCommentsHidden=!this.pageCommentsHidden,this.pageCommentsHidden?pd(ee,"true",!1,"sessionStorage"):gd(ee,"sessionStorage"),this.applyPageCommentsVisibility(),this.menuOpenedId=void 0}catch(t){console.warn("Error in togglePageCommentsVisibility: ",t),th("Error in togglePageCommentsVisibility: ",t)}},this.unhidePageCommentsIfHidden=()=>{try{if(!this.pageCommentsHidden)return;this.pageCommentsHidden=!1,gd(ee,"sessionStorage"),this.applyPageCommentsVisibility()}catch(t){console.warn("Error in unhidePageCommentsIfHidden: ",t)}},this.toggleSidebarV2=()=>{try{pd(Et,this.sidebarV2Enabled?"false":"true",!1,"sessionStorage"),window.location.reload()}catch(t){console.warn("Error in toggleSidebarV2: ",t),th("Error in toggleSidebarV2: ",t)}},this.toggleVeltProxy=()=>{try{if(!this.veltProxyToggleVisible)return;t=!this.veltProxyEnabled,pd(xt,t?"true":"false"),window.location.reload()}catch(t){console.warn("Error in toggleVeltProxy: ",t),th("Error in toggleVeltProxy: ",t)}var t},this.isScreenshotDisabledHost=()=>{try{return Ve.includes(window.location.hostname)}catch{return!1}},this.getScreenshotMode=()=>{var t,e,i;return"local"===(null===(i=null===(e=null===(t=this.customerMetadata)||void 0===t?void 0:t.superflow)||void 0===e?void 0:e.advancedFeatures)||void 0===i?void 0:i.screenshotMode)?"local":"basic"},this.logCaptureTrigger=(...t)=>{Vu()&&"undefined"!=typeof console&&console.warn("[sf-capture][trigger]",...t)},this.ensureAddCommentAnnotationSubscription=()=>{var t,e,i;this.commentElement&&"function"==typeof this.commentElement.on?this.addCommentAnnotationSubscription&&this.addCommentAnnotationSubscribedEl===this.commentElement?this.logCaptureTrigger("addCommentAnnotation subscription already attached"):(this.addCommentAnnotationSubscription&&(null===(i=(e=this.addCommentAnnotationSubscription).unsubscribe)||void 0===i||i.call(e),this.addCommentAnnotationSubscription=void 0,this.logCaptureTrigger("addCommentAnnotation re-subscribing: comment element changed")),this.addCommentAnnotationSubscription=this.commentElement.on("addCommentAnnotation").subscribe((t=>(this.onRequestModeAnnotationSaved(t),this.onAddCommentAnnotation(t)))),this.addCommentAnnotationSubscribedEl=this.commentElement,this.logCaptureTrigger("addCommentAnnotation subscription attached")):this.logCaptureTrigger("addCommentAnnotation subscription NOT attached: commentElement.on unavailable",{hasCommentElement:!!this.commentElement,hasOn:"function"==typeof(null===(t=this.commentElement)||void 0===t?void 0:t.on)})},this.applyScreenshotSetting=()=>{var t,e,i,n,o,r,s,a,l,c,d,h,u;if(this.commentElement)return this.isScreenshotDisabledHost()?(null===(e=(t=this.commentElement).disableScreenshot)||void 0===e||e.call(t),void(this.nativeScreenshotEnabled&&(this.nativeScreenshotEnabled=!1,this.nativeCapture.dispose()))):void(this.nativeScreenshotEnabled?null===(n=(i=this.commentElement).disableScreenshot)||void 0===n||n.call(i):(null===(s=null===(r=null===(o=this.customerMetadata)||void 0===o?void 0:o.superflow)||void 0===r?void 0:r.advancedFeatures)||void 0===s?void 0:s.takeScreenshotOnComments)?"local"!==this.getScreenshotMode()?null===(u=(h=this.commentElement).enableScreenshot)||void 0===u||u.call(h):null===(d=(c=this.commentElement).disableScreenshot)||void 0===d||d.call(c):null===(l=(a=this.commentElement).disableScreenshot)||void 0===l||l.call(a))},this.canUseNativeScreenshot=()=>{var t,e,i;return!this.isScreenshotDisabledHost()&&(up()&&"local"===this.getScreenshotMode()&&!!(null===(i=null===(e=null===(t=this.customerMetadata)||void 0===t?void 0:t.superflow)||void 0===e?void 0:e.advancedFeatures)||void 0===i?void 0:i.takeScreenshotOnComments))},this.getNativeScreenshotPermission=()=>{const t=vd(Pe,!1,"sessionStorage");return"granted"===t||"denied"===t?t:null},this.setNativeScreenshotPermission=t=>{pd(Pe,t,!1,"sessionStorage"),this.nativeScreenshotDenied="denied"===t},this.clearNativeScreenshotPermission=()=>{gd(Pe,"sessionStorage"),this.nativeScreenshotDenied=!1},this.promptNativeScreenshotForCommentMode=()=>{this.nativeScreenshotEnabled||this.nativeScreenshotEnabling||!this.canUseNativeScreenshot()||(this.logCaptureTrigger("commentMode enter: requesting screen share"),this.enableNativeScreenshot())},this.toggleNativeScreenshot=async()=>{try{if(!this.canUseNativeScreenshot())return;this.nativeScreenshotEnabled?(this.disableNativeScreenshot(),this.setNativeScreenshotPermission("denied")):(this.clearNativeScreenshotPermission(),await this.enableNativeScreenshot()),this.menuOpenedId=void 0}catch(t){console.warn("Error in toggleNativeScreenshot: ",t),th("Error in toggleNativeScreenshot: ",t)}},this.enableNativeScreenshot=()=>(this.nativeScreenshotEnabling&&this.nativeScreenshotEnablingPromise||(this.nativeScreenshotEnabling=!0,this.nativeScreenshotEnablingPromise=this.performEnableNativeScreenshot()),this.nativeScreenshotEnablingPromise),this.performEnableNativeScreenshot=async()=>{var t,e;try{if(await this.nativeCapture.init(),!this.nativeCapture.isActive())return this.nativeScreenshotEnabled=!1,void this.nativeCapture.dispose();this.nativeScreenshotEnabled=!0,this.setNativeScreenshotPermission("granted"),null===(e=null===(t=this.commentElement)||void 0===t?void 0:t.disableScreenshot)||void 0===e||e.call(t),this.ensureAddCommentAnnotationSubscription()}catch(t){this.nativeScreenshotEnabled=!1,this.nativeCapture.dispose(),!function(t){var e;const i=t,n=null!==(e=null==i?void 0:i.message)&&void 0!==e?e:"";return!0===(null==i?void 0:i.sfNativeExpected)||"native-share-ended-during-init"===n||"native-not-supported"===n}(t)?console.warn("Native screenshot enable failed/cancelled: ",t):(this.setNativeScreenshotPermission("denied"),Vu()&&"undefined"!=typeof console&&console.info("[sf-capture][native] enable skipped (expected):",t))}finally{this.nativeScreenshotEnabling=!1,this.nativeScreenshotEnablingPromise=void 0}},this.disableNativeScreenshot=()=>{try{this.nativeScreenshotEnabled=!1,this.nativeCapture.dispose(),this.restoreSdkScreenshot()}catch(t){console.warn("Error in disableNativeScreenshot: ",t),th("Error in disableNativeScreenshot: ",t)}},this.handleNativeScreenshotStreamEnded=()=>{try{const t=this.nativeScreenshotEnabled;if(this.nativeScreenshotEnabled=!1,!t)return;this.setNativeScreenshotPermission("denied"),this.restoreSdkScreenshot(),this.requestUpdate()}catch(t){console.warn("Error in handleNativeScreenshotStreamEnded: ",t),th("Error in handleNativeScreenshotStreamEnded: ",t)}},this.restoreSdkScreenshot=()=>{var t,e,i,n,o;this.isScreenshotDisabledHost()||"basic"===this.getScreenshotMode()&&(null===(i=null===(e=null===(t=this.customerMetadata)||void 0===t?void 0:t.superflow)||void 0===e?void 0:e.advancedFeatures)||void 0===i?void 0:i.takeScreenshotOnComments)&&(null===(o=null===(n=this.commentElement)||void 0===n?void 0:n.enableScreenshot)||void 0===o||o.call(n))},this.onAddCommentAnnotation=async t=>{var e,i,n,o,r,s,a,l,c;try{if(this.logCaptureTrigger("addCommentAnnotation event",{nativeScreenshotEnabled:this.nativeScreenshotEnabled,captureActive:this.nativeCapture.isActive(),dataKeys:t?Object.keys(t):null,commentAnnotationKeys:(null==t?void 0:t.commentAnnotation)?Object.keys(t.commentAnnotation):null}),!this.nativeScreenshotEnabled&&!this.canUseNativeScreenshot())return void this.logCaptureTrigger("skip: native screenshot unavailable");if(!this.nativeScreenshotEnabled){const t=this.nativeScreenshotEnabling&&!!this.nativeScreenshotEnablingPromise;if(!t&&null!==this.getNativeScreenshotPermission())return void this.logCaptureTrigger("skip: native screenshot not enabled (share decision recorded, no prompt in flight)");if(this.logCaptureTrigger(t?"comment add: share prompt already in flight, awaiting its outcome":"comment add: share never requested this session, prompting"),await this.enableNativeScreenshot(),!this.nativeScreenshotEnabled)return void this.logCaptureTrigger("skip: screen share not granted")}const d=null!==(n=null!==(e=null==t?void 0:t.annotationId)&&void 0!==e?e:null===(i=null==t?void 0:t.commentAnnotation)||void 0===i?void 0:i.annotationId)&&void 0!==n?n:null==t?void 0:t.id,h=null!==(l=null!==(a=null!==(r=null===(o=null==t?void 0:t.commentAnnotation)||void 0===o?void 0:o.comments)&&void 0!==r?r:null===(s=null==t?void 0:t.commentAnnotation)||void 0===s?void 0:s.commentData)&&void 0!==a?a:null==t?void 0:t.comments)&&void 0!==l?l:null==t?void 0:t.commentData,u=null===(c=null==h?void 0:h[0])||void 0===c?void 0:c.commentId;if(!d||!u)return void this.logCaptureTrigger("skip: missing ids",{annotationId:d,commentId:u,data:t});this.captureAndAttachScreenshot(d,u)}catch(t){console.warn("Error in onAddCommentAnnotation: ",t),th("Error in onAddCommentAnnotation: ",t)}},this.captureAndAttachScreenshot=(t,e)=>this.nativeCapture.isActive()?(this.pendingScreenshotCount+=1,this.capturingScreenshot=!0,this.screenshotChain=this.screenshotChain.catch((()=>{})).then((()=>this.runCaptureAndAttach(t,e))).finally((()=>{this.pendingScreenshotCount=Math.max(0,this.pendingScreenshotCount-1),0===this.pendingScreenshotCount&&(this.capturingScreenshot=!1)})),this.screenshotChain):(this.logCaptureTrigger("skip: native capture not active",{annotationId:t,commentId:e}),Promise.resolve()),this.runCaptureAndAttach=async(t,e)=>{var i,n,o,r;try{this.logCaptureTrigger("capture start",{annotationId:t,commentId:e});const s=await this.nativeCapture.capture({focusAnnotationId:t}),a="image/webp"===s.blobType?"webp":"png",l=new File([s.blob],`screenshot-${t}.${a}`,{type:s.blobType}),c=await(null===(n=null===(i=this.commentElement)||void 0===i?void 0:i.addAttachment)||void 0===n?void 0:n.call(i,{annotationId:t,commentId:e,files:[l]}));if(c&&Array.isArray(c)&&c.length>0&&(null===(o=c[0])||void 0===o?void 0:o.valid)){const i=null===(r=c[0])||void 0===r?void 0:r.attachment;await this.commentElement.updateComment({annotationId:t,comment:{commentId:e,attachments:[i]},merge:!0}),this.logCaptureTrigger("capture attached",{annotationId:t,commentId:e})}else console.warn("Invalid screenshot file")}catch(t){console.warn("Native screenshot capture/attach failed: ",t),th("Native screenshot capture/attach failed: ",t)}},this.setupSidebarAgentCommentFilter=()=>{var t,e,i,n,o,r;try{if(!this.commentElement)return;if("function"==typeof this.commentElement.on&&(this.commentElement.on("commentSidebarDataInit").subscribe((t=>{this.filterAgentCommentsFromSidebar(t)})),this.commentElement.on("commentSidebarDataUpdate").subscribe((t=>{const e=this.getSidebarGroupExpansionMap();this.filterAgentCommentsFromSidebar(t,e)}))),this.setupAgentWarningsHydration(),this.syncAgentsSidebarBusSubscriptions(),this.syncAgentsSidebarOpenState(),this.agentCommentsModeRequested)return this.setCommentSidebarVisibility(!0),void(this.showAgentCommentsInSidebar||(null===(e=null===(t=this.commentElement)||void 0===t?void 0:t.disableFilterCommentsOnDom)||void 0===e||e.call(t),this.showAgentCommentsInSidebar=!0));this.sidebarV2Enabled&&(this.showAgentCommentsInSidebar?null===(n=null===(i=this.commentElement)||void 0===i?void 0:i.disableFilterCommentsOnDom)||void 0===n||n.call(i):null===(r=null===(o=this.commentElement)||void 0===o?void 0:o.enableFilterCommentsOnDom)||void 0===r||r.call(o))}catch(t){console.warn("Error in setupSidebarAgentCommentFilter: ",t),th("Error in setupSidebarAgentCommentFilter: ",t)}},this.setupAgentWarningsHydration=()=>{try{if(!this.commentElement||"function"!=typeof this.commentElement.getAllCommentAnnotations||!this.documentId)return;const t=this.commentElement.getAllCommentAnnotations(this.documentId+"");if(!t||"function"!=typeof t.subscribe)return;const e=t.subscribe((t=>{try{if(this.streamEmissionCount+=1,this.lastStreamEmissionAt=Date.now(),!this.sidebarV2Enabled&&!this.showAgentCommentsInSidebar)return;this.lastStreamAnnotations=Array.isArray(t)?t:[],this.processAgentComments(this.mergeOnboardingFetchedAnnotations(this.lastStreamAnnotations)),this.ensureOnboardingFindingsLoaded()}catch(t){console.warn("Error in agent-warnings hydration subscription: ",t),th("Error in agent-warnings hydration subscription: ",t)}}));this.subscriptions.push(e)}catch(t){console.warn("Error in setupAgentWarningsHydration: ",t),th("Error in setupAgentWarningsHydration: ",t)}},this.getContentWarningsDisplayCount=()=>{try{return this.contentWarningsCount>99?"99+":`${this.contentWarningsCount}`}catch(t){return console.warn("Error in getContentWarningsDisplayCount: ",t),"0"}},this.onContentWarningsButtonClick=()=>{try{this.dropPendingCommentDeepLink("superseded"),this.releaseAgentPinDialogHold("replaced"),this.showContentWarningSidebar=!this.showContentWarningSidebar}catch(t){console.warn("Error in onContentWarningsButtonClick: ",t),th("Error in onContentWarningsButtonClick: ",t)}},this.onContentWarningSidebarClose=()=>{try{this.showContentWarningSidebar=!1}catch(t){console.warn("Error in onContentWarningSidebarClose: ",t)}},this.getOnboardingDismissedProjectIds=()=>{try{const t=vd(Ht,!1,"sessionStorage");if(!t)return[];try{const e=JSON.parse(t);if(Array.isArray(e))return e.filter((t=>"string"==typeof t&&t.length>0))}catch{}return[t]}catch(t){return console.warn("Error in getOnboardingDismissedProjectIds: ",t),th("Error in getOnboardingDismissedProjectIds: ",t),[]}},this.setOnboardingDismissedProjectIds=t=>{try{const e=t.slice(-20);if(0===e.length)return void gd(Ht,"sessionStorage");pd(Ht,JSON.stringify(e),!1,"sessionStorage")}catch(t){console.warn("Error in setOnboardingDismissedProjectIds: ",t),th("Error in setOnboardingDismissedProjectIds: ",t)}},this.recordOnboardingSidebarDismissal=()=>{try{if(!this.projectId)return;const t=`${this.projectId}`,e=this.getOnboardingDismissedProjectIds().filter((e=>e!==t));this.setOnboardingDismissedProjectIds([...e,t])}catch(t){console.warn("Error in recordOnboardingSidebarDismissal: ",t),th("Error in recordOnboardingSidebarDismissal: ",t)}},this.clearOnboardingSidebarDismissal=()=>{try{if(!this.projectId)return;const t=`${this.projectId}`,e=this.getOnboardingDismissedProjectIds();if(!e.includes(t))return;this.setOnboardingDismissedProjectIds(e.filter((e=>e!==t)))}catch(t){console.warn("Error in clearOnboardingSidebarDismissal: ",t),th("Error in clearOnboardingSidebarDismissal: ",t)}},this.canShowTourCommentTooltip=()=>{try{return!(this.allFeatureDisabled||this.readOnlyMode||!this.showTourCommentTooltip)&&!(this.onboardingMode&&this.showContentWarningSidebar)}catch(t){return console.warn("Error in canShowTourCommentTooltip: ",t),th("Error in canShowTourCommentTooltip: ",t),!1}},this.autoOpenOnboardingSidebar=()=>{try{if(!this.onboardingMode||this.allFeatureDisabled)return;if(this.onboardingAgentsSidebarRequested&&(null===this.agentsSidebarModeLatched||this.agentsSidebarMode))return;if(!this.projectId)return;if(this.getOnboardingDismissedProjectIds().includes(`${this.projectId}`))return;this.showContentWarningSidebar=!0}catch(t){console.warn("Error in autoOpenOnboardingSidebar: ",t),th("Error in autoOpenOnboardingSidebar: ",t)}},this.restoreContentWarningSidebarState=()=>{var t,e;try{if(this.onboardingMode)return this.autoOpenOnboardingSidebar(),void(this.showContentWarningSidebar&&(this.showAgentCommentsInSidebar?null===(e=null===(t=this.commentElement)||void 0===t?void 0:t.disableFilterCommentsOnDom)||void 0===e||e.call(t):this.setCommentSidebarVisibility(!0)));const i="true"===vd(Ne,!1,"sessionStorage"),n=new URL(window.location.href).searchParams.has(ne);if(!i)return;if(!n)return;if(this.allFeatureDisabled||"Admin"!==this.snippylyUserRole)return;this.showContentWarningSidebar=!0}catch(t){console.warn("Error in restoreContentWarningSidebarState: ",t),th("Error in restoreContentWarningSidebarState: ",t)}},this.navigateTo=t=>{try{this.dropPendingPortalShow("left-page"),this.dropPendingCommentDeepLink("navigated"),this.releaseAgentPinDialogHold("replaced"),window.location.href=t}catch(t){console.warn("Error in navigateTo: ",t),th("Error in navigateTo: ",t)}},this.onContentWarningSidebarAddAll=()=>{},this.onContentWarningItemClick=t=>{var e,i;try{this.dropPendingPortalShow("superseded"),this.dropPendingCommentDeepLink("superseded"),this.releaseAgentPinDialogHold("replaced"),this.openAgentAnnotation(null===(e=null==t?void 0:t.detail)||void 0===e?void 0:e.annotation,!1,{fromAgentsSidebar:!0===(null===(i=null==t?void 0:t.detail)||void 0===i?void 0:i.fromAgentsSidebar)})}catch(t){console.warn("Error in onContentWarningItemClick: ",t),th("Error in onContentWarningItemClick: ",t)}},this.openAgentAnnotation=(t,e=!1,i={})=>{var n,o;try{if(!(null==t?void 0:t.annotationId)&&!(null==t?void 0:t.id))return null;const r=(null==t?void 0:t.annotationId)||(null==t?void 0:t.id);return this.opensAgentAnnotationHere(t)?this.openAgentAnnotationHere(t,!0===(null==i?void 0:i.fromAgentsSidebar),null!==(o=null==i?void 0:i.pinSource)&&void 0!==o?o:"other",null==i?void 0:i.show):this.navigateToPage(null===(n=null==t?void 0:t.pageInfo)||void 0===n?void 0:n.url,r,e)?"navigated":"navigate-failed"}catch(t){return console.warn("Error in openAgentAnnotation: ",t),th("Error in openAgentAnnotation: ",t),null}},this.opensAgentAnnotationHere=t=>{var e;try{if(mu(t))return!0;const i=null===(e=null==t?void 0:t.pageInfo)||void 0===e?void 0:e.url;return!i||null===this.getCommentPagePath(i)||this.isCurrentPageUrl(i)}catch(t){return console.warn("Error in opensAgentAnnotationHere: ",t),th("Error in opensAgentAnnotationHere: ",t),!0}},this.navigateToPage=(t,e,i)=>{try{if(this.dropPendingPortalShow("left-page"),this.dropPendingCommentDeepLink("navigated"),this.showContentWarningSidebar&&pd(Ne,"true",!1,"sessionStorage"),this.isRunningUnderLivePreview()){const i=Yp(t);if(!i)return!1;const n=i.absoluteUrl&&!Ad(new URL(i.absoluteUrl))?Td(i.absoluteUrl):null,o=null!=n?n:i.path,r=null===n?i.search:"",s=this.buildLivePreviewNavigationUrl(`${o}${r}`,e);return!!s&&(this.navigateLivePreviewTo(s),!0)}if(this.isRunningUnderPreviewProxy()){return!(null!==Td(t)||!window.parent||window.parent===window)&&(window.parent.postMessage(e?{type:Yt,url:t,annotationId:e}:{type:Yt,url:t},"*"),!0)}const n=Yp(t);if(!n)return!1;const o=n.absoluteUrl?new URL(n.absoluteUrl):new URL(`${n.path}${n.search}`,window.location.origin);return i&&o.origin!==window.location.origin?(console.warn("[CWS Toolbar] Refusing a navigation off this origin:",t),!1):(e?o.searchParams.set(ne,e):o.searchParams.delete(ne),this.navigateTo(o.toString()),!0)}catch(t){return console.warn("Error in navigateToPage: ",t),th("Error in navigateToPage: ",t),!1}},this.navigateLivePreviewTo=t=>{try{try{this.pendingLeavingPage=this.toPreviewLocationPage(new URL(t))}catch(t){this.pendingLeavingPage=null,console.warn("Error in navigateLivePreviewTo (record): ",t),th("Error in navigateLivePreviewTo (record): ",t)}this.navigateTo(t)}catch(t){console.warn("Error in navigateLivePreviewTo: ",t),th("Error in navigateLivePreviewTo: ",t)}},this.buildLivePreviewNavigationUrl=(t,e)=>{try{const i=new URL(t,window.location.origin);return i.origin!==window.location.origin?(console.warn("[CWS Toolbar] Refusing a live preview navigation off this origin:",t),null):(i.searchParams.delete(ii),e?i.searchParams.set(ne,e):i.searchParams.delete(ne),i.toString())}catch(t){return console.warn("Error in buildLivePreviewNavigationUrl: ",t),null}},this.selectAnnotationOnPage=t=>{var e;try{(null===(e=this.commentElement)||void 0===e?void 0:e.selectCommentByAnnotationId)&&this.commentElement.selectCommentByAnnotationId(t),setTimeout((()=>{var e;(null===(e=this.commentElement)||void 0===e?void 0:e.scrollToCommentByAnnotationId)&&this.commentElement.scrollToCommentByAnnotationId(t)}),150)}catch(t){console.warn("Error in selectAnnotationOnPage: ",t),th("Error in selectAnnotationOnPage: ",t)}},this.onContentWarningItemNext=t=>{var e;try{const i=null===(e=null==t?void 0:t.detail)||void 0===e?void 0:e.annotation;if(!i)return;this.navigateToCheckPage(this.resolveFullAnnotation(i),"next")}catch(t){console.warn("Error in onContentWarningItemNext: ",t),th("Error in onContentWarningItemNext: ",t)}},this.getCurrentCheckPageKey=()=>{var t;try{if(this.isRunningUnderPreviewProxy())return this.previewLocationPath||"/";if(this.autoLocation&&"string"==typeof(null===(t=this.location)||void 0===t?void 0:t.url)&&this.location.url)return this.location.url;const e=new URL(window.location.href);for(const t of me)e.searchParams.delete(t);return`${e.pathname}${this.queryParamsComments?e.search:""}`}catch(t){return console.warn("Error in getCurrentCheckPageKey: ",t),th("Error in getCurrentCheckPageKey: ",t),window.location.pathname}},this.navigateToCheckPage=(t,e="next")=>{try{const i=wu(t);if(i.length<2)return!1;const n=Cu(i,this.getCurrentCheckPageKey(),e);return!!n&&this.navigateToCheckPageKey(t,n)}catch(t){return console.warn("Error in navigateToCheckPage: ",t),th("Error in navigateToCheckPage: ",t),!1}},this.navigateToCheckPageKey=(t,e)=>{var i;try{const n=(null==t?void 0:t.annotationId)||(null==t?void 0:t.id);if(!n||!e)return!1;if(this.showContentWarningSidebar&&pd(Ne,"true",!1,"sessionStorage"),this.isRunningUnderLivePreview()){const t=this.buildLivePreviewNavigationUrl(e,n);return!!t&&(this.navigateLivePreviewTo(t),!0)}if(this.isRunningUnderPreviewProxy()){const o=null===(i=null==t?void 0:t.pageInfo)||void 0===i?void 0:i.url;if("string"!=typeof o||!o||null!==Td(o))return!1;if(!window.parent||window.parent===window)return!1;const r=new URL(e,new URL(o).origin);return window.parent.postMessage({type:Yt,url:r.toString(),annotationId:n},"*"),!0}const o=new URL(e,window.location.origin);return o.searchParams.set(ne,n),this.navigateTo(o.toString()),!0}catch(t){return console.warn("Error in navigateToCheckPageKey: ",t),th("Error in navigateToCheckPageKey: ",t),!1}},this.resolveFullAnnotation=t=>{var e;try{if(!t||su(t))return t;const i=(null==t?void 0:t.annotationId)||(null==t?void 0:t.id);if(!i)return t;const n=t=>((null==t?void 0:t.annotationId)||(null==t?void 0:t.id))===i,o=this.lastStreamAnnotations.find(n);if(su(o))return o;for(const t of this.agentGroups){const i=null===(e=null==t?void 0:t.annotations)||void 0===e?void 0:e.find(n);if(su(i))return i}return t}catch(e){return console.warn("Error in resolveFullAnnotation: ",e),th("Error in resolveFullAnnotation: ",e),t}},this.isCurrentPageUrl=t=>{try{const e=this.getCommentPagePath(t);return null!==e&&Zp(e,this.getCurrentPagePath())}catch{return!1}},this.getCommentPagePath=t=>{var e;try{const i=Yp(t);return i?i.absoluteUrl&&null!==(e=Td(i.absoluteUrl))&&void 0!==e?e:i.path:null}catch(t){return console.warn("Error in getCommentPagePath: ",t),null}},this.getCurrentPagePath=()=>{try{return!this.isRunningUnderLivePreview()&&this.isRunningUnderPreviewProxy()?this.previewLocationPath||"/":window.location.pathname}catch(t){return console.warn("Error in getCurrentPagePath: ",t),th("Error in getCurrentPagePath: ",t),window.location.pathname}},this.setupVeltButtonClickListener=()=>{try{if(!(null===Velt||void 0===Velt?void 0:Velt.on))return void console.warn("[CWS Toolbar] Velt.on not available for button click listener");Velt.on("veltButtonClick").subscribe((t=>{var e;try{if(!t)return;const i=null===(e=null==t?void 0:t.buttonContext)||void 0===e?void 0:e.clickedButtonId,n=null==t?void 0:t.commentAnnotation,o=(null==n?void 0:n.annotationId)||(null==n?void 0:n.id),r="accept-suggestion"===i||"reject-suggestion"===i;if(r&&o&&this.processingAnnotationIds.has(o))return;if(r&&this.isSuggestionActionsHiddenForViewer())return void console.warn("[CWS Toolbar] Only workspace members can accept or reject suggestions. Ignoring:",i);if("prev-suggestion"===i||"next-suggestion"===i){const t="next-suggestion"===i?"next":"prev",e=this.resolveFullAnnotation(n);mu(e)&&wu(e).length>1?this.navigateToCheckPage(e,t):this.navigateSuggestion(n,t)}else"accept-suggestion"===i&&this.handleAcceptSuggestion(n)}catch(t){console.warn("Error in veltButtonClick handler: ",t)}})),this.commentElement.onCommentSelectionChange().subscribe((t=>{this.handleCommentSelection(t)}))}catch(t){console.warn("Error in setupVeltButtonClickListener: ",t),th("Error in setupVeltButtonClickListener: ",t)}},this.navigateSuggestion=(t,e)=>{var i,n,o,r,s;try{if(!t)return void console.warn("[CWS Toolbar] No annotation provided for navigation");const a=null===(n=null===(i=null==t?void 0:t.agent)||void 0===i?void 0:i.result)||void 0===n?void 0:n.incorrectWord;if(!a)return void console.warn("[CWS Toolbar] No incorrectWord found on annotation");const l=this.findMatchingWarning(a);if(!l)return void console.warn("[CWS Toolbar] No matching warning found for word:",a);const c=null===(o=null==t?void 0:t.pageInfo)||void 0===o?void 0:o.path,d=this.normalizePagePath(c),h=null===(r=null==l?void 0:l.annotations)||void 0===r?void 0:r.filter((t=>{var e;const i=null===(e=null==t?void 0:t.pageInfo)||void 0===e?void 0:e.path;return this.normalizePagePath(i)===d}));if(!(null==h?void 0:h.length)||h.length<=1)return;const u=(null==t?void 0:t.annotationId)||(null==t?void 0:t.id),p=h.findIndex((t=>((null==t?void 0:t.annotationId)||(null==t?void 0:t.id))===u));if(-1===p)return void console.warn("[CWS Toolbar] Current annotation not found in warning group");let v;v="next"===e?(p+1)%h.length:(p-1+h.length)%h.length;const g=h[v],f=(null==g?void 0:g.annotationId)||(null==g?void 0:g.id);f&&((null===(s=this.commentElement)||void 0===s?void 0:s.selectCommentByAnnotationId)&&this.commentElement.selectCommentByAnnotationId(f),setTimeout((()=>{var t;(null===(t=this.commentElement)||void 0===t?void 0:t.scrollToCommentByAnnotationId)&&this.commentElement.scrollToCommentByAnnotationId(f)}),150))}catch(t){console.warn("Error in navigateSuggestion: ",t),th("Error in navigateSuggestion: ",t)}},this.findMatchingWarning=t=>{var e;try{for(const i of this.agentGroups){const n=null===(e=null==i?void 0:i.warnings)||void 0===e?void 0:e.find((e=>(null==e?void 0:e.primaryText)===t));if(n)return n}return null}catch(t){return console.warn("Error in findMatchingWarning: ",t),null}},this.removeAnnotationFromWarnings=t=>{var e,i,n;try{if(!t)return;const o=e=>{var i,n,o,r;for(const s of e){const e=null===(i=null==s?void 0:s.annotations)||void 0===i?void 0:i.find((e=>((null==e?void 0:e.annotationId)||(null==e?void 0:e.id))===t));if(e){const t="grammar"===(null===(o=null===(n=null==e?void 0:e.agent)||void 0===n?void 0:n.result)||void 0===o?void 0:o.type)?this.grammarSuggestionPagePathMap:this.spellingSuggestionPagePathMap,i=(null==s?void 0:s.primaryText)||"",a=null===(r=null==e?void 0:e.pageInfo)||void 0===r?void 0:r.path,l=this.normalizePagePath(a);if(i&&l&&t.has(i)){const e=t.get(i),n=e.get(l)||0;n>1?e.set(l,n-1):(e.delete(l),0===e.size&&t.delete(i))}return}}};for(const t of this.agentGroups)(null==t?void 0:t.agentId)!==Be.SPELL_CHECK&&(null==t?void 0:t.agentId)!==Be.GRAMMAR_CHECK||o(t.warnings);const r=null!==(n=null===(i=null===(e=this.agentGroups)||void 0===e?void 0:e.map((e=>{var i,n,o,r,s;const a=null!==(o=null===(n=null===(i=null==e?void 0:e.warnings)||void 0===i?void 0:i.map((e=>{var i;const n=null===(i=null==e?void 0:e.annotations)||void 0===i?void 0:i.filter((e=>((null==e?void 0:e.annotationId)||(null==e?void 0:e.id))!==t));return n&&0!==n.length?{...e,annotations:n,occurrences:n.length}:null})))||void 0===n?void 0:n.filter((t=>null!==t)))&&void 0!==o?o:[],l=null!==(s=null===(r=null==e?void 0:e.annotations)||void 0===r?void 0:r.filter((e=>((null==e?void 0:e.annotationId)||(null==e?void 0:e.id))!==t)))&&void 0!==s?s:[];return 0===a.length?null:{...e,warnings:a,warningCount:a.length,annotations:l}})))||void 0===i?void 0:i.filter((t=>null!==t)))&&void 0!==n?n:[];this.agentGroups=r;const s=r.reduce(((t,e)=>t+e.warningCount),0);this.contentWarningsCount=s,this.hasContentWarnings=s>0,this.onboardingFetchedAnnotations=this.onboardingFetchedAnnotations.filter((e=>((null==e?void 0:e.annotationId)||(null==e?void 0:e.id))!==t)),this.isAgentRunStatusFeedEnabled()&&(this.onboardingRemovedAnnotationIds.add(t),this.setOnboardingUnsyncedAnnotationIds(this.onboardingFetchedAnnotations.map((t=>null==t?void 0:t.annotationId))))}catch(t){console.warn("Error in removeAnnotationFromWarnings: ",t)}},this.setSuggestionButtonsLoading=(t,e,i)=>{try{const n=i||document.querySelector(".velt-comment-dialog.selected");if(!n)return;const o=n.querySelector(".sf-accept-btn"),r=n.querySelector(".sf-reject-btn");if(e){const e="accept"===t?o:r,i="accept"===t?r:o;null==e||e.classList.add("sf-btn-loading"),null==i||i.classList.add("sf-btn-disabled")}else null==o||o.classList.remove("sf-btn-loading","sf-btn-disabled"),null==r||r.classList.remove("sf-btn-loading","sf-btn-disabled")}catch(t){console.warn("Error in setSuggestionButtonsLoading: ",t)}},this.handleAcceptSuggestion=async t=>{var e,i,n;try{const o=(null==t?void 0:t.annotationId)||(null==t?void 0:t.id);if(!o)return void console.warn("[CWS Toolbar] handleAcceptSuggestion: No annotationId found",t);if(this.processingAnnotationIds.has(o))return;const r=(null===(e=this.snippylyUser)||void 0===e?void 0:e.userId)||(null===(i=this.snippylyUser)||void 0===i?void 0:i.uid),s=(null===(n=this.snippylyUser)||void 0===n?void 0:n.email)||"";if(!r)return void console.warn("[CWS Toolbar] handleAcceptSuggestion: No user available");if(!this.documentId)return void console.warn("[CWS Toolbar] handleAcceptSuggestion: No documentId available");this.processingAnnotationIds.add(o);const a=document.querySelector(".velt-comment-dialog.selected");this.setSuggestionButtonsLoading("accept",!0,a);try{await Ch(this.apiKey,this.apiKey,this.documentId+"",o,{userId:r,email:s},this.suggestionCredential()),this.removeAnnotationFromWarnings(o)}finally{this.processingAnnotationIds.delete(o),this.setSuggestionButtonsLoading("accept",!1,a)}}catch(t){console.warn("Error in handleAcceptSuggestion: ",t),th("Error in handleAcceptSuggestion: ",t)}},this.trackAgentPins=t=>{try{const e=this.agentPinTargets;if(this.agentPinTargets=new Map((t=>{const e=[],i=new Set;for(const n of Array.isArray(t)?t:[]){if("square"!==dv(n))continue;const t=ou(n);t&&!i.has(t)&&(i.add(t),e.push({id:t,icon:pv(n)}))}return e})(t).map((t=>[t.id,t]))),!this.isConnected)return;for(const t of e.keys())if(!this.agentPinTargets.has(t))for(const e of Mv(t))$v(e),this.agentPinDecoratedContainers.delete(e);this.decorateAgentPins(),this.syncAgentPinDomObserver()}catch(t){console.warn("Error in trackAgentPins: ",t),th("Error in trackAgentPins: ",t)}},this.resyncAgentPins=()=>{try{if(!this.isConnected||0===this.agentPinTargets.size)return;this.decorateAgentPins(),this.syncAgentPinDomObserver()}catch(t){console.warn("Error in resyncAgentPins: ",t),th("Error in resyncAgentPins: ",t)}},this.decorateAgentPins=()=>{try{if(!this.isConnected)return;const t=new Set,e=new Map;for(const i of this.agentPinTargets.values())for(const n of Mv(i.id))"light"===this.decorateAgentPinContainer(n,i,e)&&t.add(i.id);this.agentPinLightDomIds=t,this.writeAgentPinPageCss()}catch(t){console.warn("Error in decorateAgentPins: ",t),th("Error in decorateAgentPins: ",t)}},this.decorateAgentPinContainer=(t,e,i)=>{let n=i.get(e.icon);void 0===n&&(n=xv(e.icon),i.set(e.icon,n));const o=kv(t);for(const t of o)Sv(t,n);this.agentPinDecoratedContainers.add(t);const r=_v(t,o);return"unrecognised"===r&&this.noteUnrecognisedAgentPin(t),r},this.noteUnrecognisedAgentPin=t=>{try{if(this.agentPinMarkupReported)return;this.agentPinUnrecognisedContainers.add(t),null===this.agentPinMarkupRecheckTimer&&(this.agentPinMarkupRecheckTimer=setTimeout((()=>this.checkUnrecognisedAgentPins()),Lv.AGENT_PIN_MARKUP_RECHECK_MS))}catch(t){console.warn("Error in noteUnrecognisedAgentPin: ",t)}},this.checkUnrecognisedAgentPins=()=>{try{null!==this.agentPinMarkupRecheckTimer&&(clearTimeout(this.agentPinMarkupRecheckTimer),this.agentPinMarkupRecheckTimer=null);const t=Array.from(this.agentPinUnrecognisedContainers);if(this.agentPinUnrecognisedContainers.clear(),this.agentPinMarkupReported||!this.isConnected)return;for(const e of t){const t=Av(e);if(!e.isConnected||!this.agentPinTargets.has(t)||"unrecognised"!==_v(e))continue;this.agentPinMarkupReported=!0;const i=bv.join(" ");return console.warn(`[Superflow] Agent pin not squared: the SDK rendered pin ${t} with none of the SDK pin internals (${i}). Update SDK_PIN_INTERNALS for this SDK version.`),void th("Agent pin SDK markup not recognised","SDK pin internals changed",{annotationId:t,selectors:i})}}catch(t){console.warn("Error in checkUnrecognisedAgentPins: ",t)}},this.decoratePendingAgentPins=()=>{try{const t=Array.from(this.agentPinPendingContainers);if(this.agentPinPendingContainers.clear(),!this.isConnected)return;const e=new Map;let i=!1;for(const n of t){if(!n.isConnected||this.agentPinDecoratedContainers.has(n))continue;const t=this.agentPinTargets.get(Av(n));t&&("light"!==this.decorateAgentPinContainer(n,t,e)||this.agentPinLightDomIds.has(t.id)||(this.agentPinLightDomIds.add(t.id),i=!0))}i&&this.writeAgentPinPageCss()}catch(t){console.warn("Error in decoratePendingAgentPins: ",t),th("Error in decoratePendingAgentPins: ",t)}},this.writeAgentPinPageCss=()=>{const t=[];for(const e of this.agentPinLightDomIds){const i=this.agentPinTargets.get(e);i&&t.push(i)}const e=(t=>{var e;const i=new Map;for(const n of Array.isArray(t)?t:[]){if(!(null==n?void 0:n.id))continue;const t=null!==(e=i.get(n.icon))&&void 0!==e?e:[];t.push(`#${fv}${Ev(n.id)}`),i.set(n.icon,t)}return Array.from(i.entries()).map((([t,e])=>xv(t,e))).join("\n")})(t);e!==this.agentPinPageCss&&(this.agentPinPageCss=e,document.head&&Sv(document.head,e))},this.scheduleAgentPinDecorate=()=>{try{if(!this.isConnected||0===this.agentPinTargets.size||null!==this.agentPinFrameCancel)return;const t=()=>{this.agentPinFrameCancel=null,this.decoratePendingAgentPins()};if("function"==typeof requestAnimationFrame){const e=requestAnimationFrame(t);this.agentPinFrameCancel=()=>cancelAnimationFrame(e)}else{const e=setTimeout(t,16);this.agentPinFrameCancel=()=>clearTimeout(e)}}catch(t){console.warn("Error in scheduleAgentPinDecorate: ",t),th("Error in scheduleAgentPinDecorate: ",t)}},this.onAgentPinMutations=t=>{try{if(0===this.agentPinTargets.size)return;const{added:e,changed:i}=(t=>{const e=new Set,i=new Set;try{for(const n of Array.isArray(t)?t:[]){const t=null==n?void 0:n.addedNodes;if(!t||0===t.length)continue;let o=!1;for(let i=0;i<t.length;i+=1){const n=t[i];if(1!==n.nodeType)continue;o=!0;const r=n;Av(r)?e.add(r):wv.includes(r.localName)&&r.querySelectorAll(mv).forEach((t=>e.add(t)))}const r=n.target;if(!o||!r||1!==r.nodeType)continue;const s=r.closest(mv);s&&i.add(s)}}catch{}return{added:Array.from(e),changed:Array.from(i)}})(t);this.pendingAgentPin&&this.openPendingAgentPin(e);let n=!1;for(const t of i)this.agentPinTargets.has(Av(t))&&(this.agentPinDecoratedContainers.delete(t),this.agentPinPendingContainers.add(t),n=!0);for(const t of e)!this.agentPinDecoratedContainers.has(t)&&this.agentPinTargets.has(Av(t))&&(this.agentPinPendingContainers.add(t),n=!0);n&&this.scheduleAgentPinDecorate()}catch(t){console.warn("Error in onAgentPinMutations: ",t),th("Error in onAgentPinMutations: ",t)}},this.syncAgentPinDomObserver=()=>{var t;try{if(!this.isConnected||0===this.agentPinTargets.size)return null===(t=this.agentPinDomObserver)||void 0===t||t.disconnect(),void(this.agentPinDomObserver=null);if(this.agentPinDomObserver||"undefined"==typeof MutationObserver||!document.body)return;this.agentPinDomObserver=new MutationObserver((t=>this.onAgentPinMutations(t))),this.agentPinDomObserver.observe(document.body,{childList:!0,subtree:!0})}catch(t){console.warn("Error in syncAgentPinDomObserver: ",t),th("Error in syncAgentPinDomObserver: ",t)}},this.teardownAgentPins=()=>{var t,e;try{null===(t=this.agentPinDomObserver)||void 0===t||t.disconnect(),this.agentPinDomObserver=null,null===(e=this.agentPinFrameCancel)||void 0===e||e.call(this),this.agentPinFrameCancel=null,this.agentPinPendingContainers.clear(),null!==this.agentPinMarkupRecheckTimer&&(clearTimeout(this.agentPinMarkupRecheckTimer),this.agentPinMarkupRecheckTimer=null),this.agentPinUnrecognisedContainers.clear(),this.agentPinLightDomIds=new Set,this.agentPinPageCss="",document.head&&Sv(document.head,"");for(const t of this.agentPinTargets.values())for(const e of Mv(t.id))$v(e);this.agentPinDecoratedContainers=new WeakSet}catch(t){console.warn("Error in teardownAgentPins: ",t),th("Error in teardownAgentPins: ",t)}},this.showFirstCommentNudge=()=>{try{if(!this.autoCommentModeRequested||this.autoCommentModeArmedOnce||this.addCommentMode)return;this.firstCommentNudge=!0,this.showTourCommentTooltip=!0}catch(t){console.warn("Error in showFirstCommentNudge: ",t),th("Error in showFirstCommentNudge: ",t)}},this.disableCommentMode=()=>{var t;try{(null===(t=this.commentElement)||void 0===t?void 0:t.disableCommentMode)&&this.commentElement.disableCommentMode()}catch(t){console.warn("Error in disableAddCommentMode: ",t),th("Error in disableAddCommentMode: ",t)}},this.disableCommentModeButton=()=>{try{return this.addCommentMode?R`
|
|
6596
|
+
`:null,this.isRequestMode=()=>{try{return function(t){try{if(!t||!0!==t.requestModeSwitch||Bd(t))return!1;const e=t.user;return!(!e||"object"!=typeof e||!0===e.isAnonymous||!0===e.isGuest)&&"string"==typeof t.role&&""!==t.role&&"Admin"!==t.role}catch(t){return console.warn("Error in decideRequestMode: ",t),!1}}({requestModeSwitch:this.requestModeSwitch,user:this.snippylyUser,role:this.snippylyUserRole,embedMode:this.embedMode,readOnlyMode:this.readOnlyMode,onboardingMode:this.onboardingMode,agentStatusMode:this.agentStatusMode,passwordPending:this.passwordProtected&&!this.isPasswordValid})}catch(t){return console.warn("Error in isRequestMode: ",t),!1}},this.isSignedOutRequestMode=()=>{try{return function(t){try{return!(!t||!0!==t.requestModeSwitch||t.loading||Bd(t)||t.user&&"object"==typeof t.user)}catch(t){return console.warn("Error in decideSignedOutRequestMode: ",t),!1}}({requestModeSwitch:this.requestModeSwitch,user:this.snippylyUser,loading:!!this.loading,embedMode:this.embedMode,readOnlyMode:this.readOnlyMode,onboardingMode:this.onboardingMode,agentStatusMode:this.agentStatusMode,passwordPending:this.passwordProtected&&!this.isPasswordValid})}catch(t){return console.warn("Error in isSignedOutRequestMode: ",t),!1}},this.canShowRequestTools=()=>{try{return this.isToolbarStateResolved()&&this.canShowCollaborationTools()}catch(t){return console.warn("Error in canShowRequestTools: ",t),!1}},this.onRequestSignInClick=t=>{try{try{eh(gt.Events.REQUEST_MODE_SIGN_IN_CLICKED,t?{projectId:this.projectId,source:t}:{projectId:this.projectId})}catch(t){console.warn("Error tracking requestModeSignInClicked: ",t)}this.loginWithGoogle()}catch(t){console.warn("Error in onRequestSignInClick: ",t),th("Error in onRequestSignInClick: ",t)}},this.onRequestBadgeClick=()=>{try{if(this.isSignedOutRequestMode()&&this.requestMenuItems(!1).signIn)return this.storeRequestResumeMarker(),void this.onRequestSignInClick("badge");this.openRequestToolbar()}catch(t){console.warn("Error in onRequestBadgeClick: ",t),th("Error in onRequestBadgeClick: ",t)}},this.openRequestToolbar=(t=!0)=>{try{this.requestToolbarExpanded=!0,this.isRequestStateLoading()?this.requestCommentModePending="click":(this.requestCommentModePending=null,t&&this.canEnterRequestCommentMode()&&this.enterRequestCommentMode());try{eh(gt.Events.REQUEST_MODE_OPENED,{projectId:this.projectId})}catch(t){console.warn("Error tracking requestModeOpened: ",t)}this.focusRequestControl('[data-testid="sf-request-collapse"]')}catch(t){console.warn("Error in openRequestToolbar: ",t),th("Error in openRequestToolbar: ",t)}},this.isRequestStateLoading=()=>{try{return!(!this.snippylyUser||"object"!=typeof this.snippylyUser||this.isToolbarStateResolved()&&"waiting"!==this.commentsDisabledSetting)}catch(t){return console.warn("Error in isRequestStateLoading: ",t),!1}},this.canEnterRequestCommentMode=()=>{var t;try{return this.canShowRequestTools()&&!this.readOnlyMode&&"function"==typeof(null===(t=this.commentElement)||void 0===t?void 0:t.enableCommentMode)}catch(t){return console.warn("Error in canEnterRequestCommentMode: ",t),!1}},this.enterRequestCommentMode=()=>{try{this.commentElement.enableCommentMode()}catch(t){console.warn("Error enabling comment mode from the request badge: ",t)}},this.resolvePendingRequestOpen=()=>{try{const t=this.requestCommentModePending;if(!t||!this.isToolbarStateResolved()||"waiting"===this.commentsDisabledSetting)return;if(this.requestCommentModePending=null,!this.isRequestMode())return;this.applyFirstConfigCommentsDisabled();const e="known"===this.commentsDisabledSetting;if("resume"===t)return void(this.requestToolbarExpanded||this.openRequestToolbar(e));e&&this.requestToolbarExpanded&&this.canEnterRequestCommentMode()&&this.enterRequestCommentMode()}catch(t){console.warn("Error in resolvePendingRequestOpen: ",t),th("Error in resolvePendingRequestOpen: ",t)}},this.requestMenuItems=t=>function(t){try{return!t||t.customLogin?{signIn:!1,signOut:!1}:t.signedIn?{signIn:!1,signOut:!0}:{signIn:!t.invalidApiKey,signOut:!1}}catch(t){return console.warn("Error in decideRequestMenu: ",t),{signIn:!1,signOut:!1}}}({signedIn:t,customLogin:!!this.customLoginEnabledLocally,invalidApiKey:!!this.invalidApiKey}),this.storeRequestResumeMarker=()=>{try{window.sessionStorage.setItem(jd,(t={apiKey:this.apiKey,projectId:this.projectId,now:Date.now()},JSON.stringify({v:1,apiKey:t.apiKey||"",projectId:t.projectId||"",expiresAt:t.now+6e5})))}catch(t){console.warn("Error storing the request-mode resume marker: ",t)}var t},this.consumeRequestResumeMarker=()=>{try{let t=null;try{t=window.sessionStorage.getItem(jd),null!==t&&window.sessionStorage.removeItem(jd)}catch(t){return}if(null===t||!this.requestModeSwitch)return;(function(t,e){try{if("string"!=typeof t||!t)return!1;const i=JSON.parse(t);return!!i&&1===i.v&&!!e.apiKey&&i.apiKey===e.apiKey&&!!e.projectId&&i.projectId===e.projectId&&"number"==typeof i.expiresAt&&i.expiresAt>e.now}catch(t){return!1}})(t,{apiKey:this.apiKey,projectId:this.projectId,now:Date.now()})&&(this.requestCommentModePending="resume",this.resolvePendingRequestOpen())}catch(t){console.warn("Error in consumeRequestResumeMarker: ",t)}},this.onRequestCollapseClick=()=>{try{this.closeRequestMenu(),this.requestToolbarExpanded=!1,this.requestCommentModePending=null,this.focusRequestControl('[data-testid="sf-request-badge"]')}catch(t){console.warn("Error in onRequestCollapseClick: ",t),th("Error in onRequestCollapseClick: ",t)}},this.focusRequestControl=t=>{try{this.updateComplete.then((()=>{var e,i,n,o;try{null===(o=null===(n=null===(i=null===(e=this.renderRoot)||void 0===e?void 0:e.querySelector)||void 0===i?void 0:i.call(e,t))||void 0===n?void 0:n.focus)||void 0===o||o.call(n)}catch(t){console.warn("Error focusing the request toolbar: ",t)}})).catch((t=>console.warn("Error waiting to focus the request toolbar: ",t)))}catch(t){console.warn("Error in focusRequestControl: ",t)}},this.onRequestMenuButtonClick=()=>{try{if(this.requestMenuOpen)return void this.closeRequestMenu();this.requestMenuOpen=!0,this.attachRequestMenuListeners()}catch(t){console.warn("Error in onRequestMenuButtonClick: ",t),th("Error in onRequestMenuButtonClick: ",t)}},this.closeRequestMenu=()=>{try{this.requestMenuOpen=!1,this.detachRequestMenuListeners()}catch(t){console.warn("Error in closeRequestMenu: ",t)}},this.onRequestMenuSignOutClick=()=>{try{this.closeRequestMenu(),this.signOutUser()}catch(t){console.warn("Error in onRequestMenuSignOutClick: ",t),th("Error in onRequestMenuSignOutClick: ",t)}},this.onRequestMenuSignInClick=()=>{try{this.closeRequestMenu(),this.onRequestSignInClick()}catch(t){console.warn("Error in onRequestMenuSignInClick: ",t),th("Error in onRequestMenuSignInClick: ",t)}},this.attachRequestMenuListeners=()=>{try{if(this.requestMenuListenersAttached)return;this.requestMenuListenersAttached=!0,document.addEventListener("pointerdown",this.onRequestMenuOutsidePointer,!0),document.addEventListener("keydown",this.onRequestMenuKeydown,!0)}catch(t){console.warn("Error in attachRequestMenuListeners: ",t)}},this.detachRequestMenuListeners=()=>{try{if(!this.requestMenuListenersAttached)return;this.requestMenuListenersAttached=!1,document.removeEventListener("pointerdown",this.onRequestMenuOutsidePointer,!0),document.removeEventListener("keydown",this.onRequestMenuKeydown,!0)}catch(t){console.warn("Error in detachRequestMenuListeners: ",t)}},this.onRequestMenuOutsidePointer=t=>{try{const e="function"==typeof t.composedPath?t.composedPath():[];e.some((t=>{const e=t;return!!(null==e?void 0:e.getAttribute)&&"true"===e.getAttribute("data-request-menu-area")}))||this.closeRequestMenu()}catch(t){console.warn("Error in onRequestMenuOutsidePointer: ",t)}},this.onRequestMenuKeydown=t=>{try{if("Escape"!==t.key||!this.requestMenuOpen)return;this.closeRequestMenu(),this.focusRequestControl('[data-testid="sf-request-menu-button"]')}catch(t){console.warn("Error in onRequestMenuKeydown: ",t)}},this.syncRequestMode=()=>{try{if(!this.isRequestMode())return;if(this.applyFirstConfigCommentsDisabled(),!this.commentElement)return;this.applyRequestModeToCommentElement(),this.ensureAddCommentAnnotationSubscription(),this.requestModeLoadedTracked||(this.requestModeLoadedTracked=!0,eh(gt.Events.REQUEST_MODE_LOADED,{projectId:this.projectId}))}catch(t){console.warn("Error in syncRequestMode: ",t),th("Error in syncRequestMode: ",t)}},this.applyFirstConfigCommentsDisabled=()=>{try{!0===this.firstConfigCommentsDisabled&&!this.allFeatureDisabled&&this.isRequestMode()&&(this.allFeatureDisabled=!0)}catch(t){console.warn("Error in applyFirstConfigCommentsDisabled: ",t)}},this.applyRequestModeToCommentElement=()=>{try{const t=this.commentElement;if(!t||t===this.requestContextProviderElement||"function"!=typeof t.setContextProvider)return;this.requestContextProviderElement=t,t.setContextProvider((()=>this.isRequestMode()?function(t){let e="string"==typeof t?t:"";try{const t=new URL(e);t.searchParams.delete("sf_review"),e=t.toString()}catch(t){}return{sf:{type:"request",visibility:"client",pageUrl:e}}}(window.location.href):void 0))}catch(t){console.warn("Error in applyRequestModeToCommentElement: ",t),th("Error in applyRequestModeToCommentElement: ",t)}},this.onRequestModeAnnotationSaved=t=>{try{if(!this.isRequestMode())return;const{annotationId:e,stamp:i}=function(t){try{const e=t&&"object"==typeof t?t:{},i=e.commentAnnotation&&"object"==typeof e.commentAnnotation?e.commentAnnotation:null,n="string"==typeof e.annotationId&&e.annotationId?e.annotationId:null==i?void 0:i.annotationId,o="string"==typeof n&&n?n:null,r=null==i?void 0:i.context;if(null==r)return{annotationId:o,stamp:"missing"};const s="object"==typeof r?r.sf:void 0;return{annotationId:o,stamp:"request"===(s&&"object"==typeof s?s.type:void 0)?"request":"other"}}catch(t){return console.warn("Error in readSavedAnnotation: ",t),{annotationId:null,stamp:"other"}}}(t),n=!!this.commentElement&&this.requestContextProviderElement===this.commentElement;if(!e||!("request"===i||"missing"===i&&n))return;if(!this.notifyAddedRequest(e))return;try{eh(gt.Events.REQUEST_ADDED,{projectId:this.projectId})}catch(t){console.warn("Error tracking requestAdded: ",t)}}catch(t){console.warn("Error in onRequestModeAnnotationSaved: ",t)}},this.identifySnippyly=async()=>{var t,e,i,n;let o="",r="",s=!1;try{this.invalidApiKey=!1;let n={name:"Default User",email:"default@usesuperflow.com",userId:"default",isAnonymous:!0,organizationId:this.apiKey};const a=this.isRunningUnderLivePreview(),l=a?this.readLiveSignIn():null;let c;c=a?l?{...l.user}:null:this.customLoginEnabled&&this.providedUser?this.providedUser:yd(),ha("[Superflow][identify] resolved user (pre-iam)",{source:a?l?"liveSignIn":"liveGuest":this.customLoginEnabled&&this.providedUser?"providedUser":"token",email:null==c?void 0:c.email,userId:null==c?void 0:c.userId,name:null==c?void 0:c.name,isAnonymous:null==c?void 0:c.isAnonymous});const d=await this.getSamlConfig(),h=new URL(document.location);if(h.searchParams.has(re)&&h.searchParams.delete(re),d&&(this.signInUrl=`${ai}saml/${d.slug}/login?redirect_url=${encodeURIComponent(null==h?void 0:h.toString())}&source=sf`,window.Superflow.signInUrl=this.signInUrl),((null==c?void 0:c.email)||a&&(null==c?void 0:c.userId))&&(n=c),n.isAnonymous)delete n.groupId;else{const t=Velt.getDocumentId()||this.serverDocumentId;t&&(n.groupId=t+"")}if(this.customLoginEnabledLocally||(null===(t=null==n?void 0:n.contacts)||void 0===t?void 0:t.length)&&(n.contacts=[]),o=null==n?void 0:n.email,r=null==n?void 0:n.userId,(null==n?void 0:n.isAnonymous)&&this.projectId&&(this.guestMode||a)){const t=Cd(!0,this.apiKey);t&&(n=JSON.parse(JSON.stringify(t)))}(null==n?void 0:n.isAnonymous)||(this.loading=!0);const u={};(null==n?void 0:n.groupId)&&(u.groupId=null==n?void 0:n.groupId),n.organizationId=this.apiKey;const p=await oh(this.apiKey,this.projectId||"",null==n?void 0:n.email,null==n?void 0:n.userId),v=null==p?void 0:p.isAdmin;this.snippylyUserRole=v?"Admin":"Commenter",this.suggestionRoleLookupFailed="boolean"!=typeof v,this.suggestionViewerRoleResolved=!0,s=!0,this.applySuggestionActionStyles(),ha("[Superflow][identify] iamResponse",p,{isAdminUser:v,snippylyUserRole:this.snippylyUserRole,email:null==n?void 0:n.email,userId:null==n?void 0:n.userId});const g=!(a||this.customLoginEnabled&&this.providedUser);this.identityCameFromToken=g,this.identityLiveSignIn=l;const f=((t,e)=>!(!e||(null==t?void 0:t.isAnonymous)||(null==t?void 0:t.isGuest)||!(null==t?void 0:t.userId)))(n,g),m=f&&((t,e)=>{try{if(!t||!e)return!1;const i=!!e.name&&e.name!==t.name,n=!!e.photoUrl&&e.photoUrl!==t.photoUrl;return ha("[Superflow][identity] hasProfileChanged",{nameChanged:i,photoChanged:n,localName:t.name,savedName:e.name,localPhotoUrl:t.photoUrl,savedPhotoUrl:e.photoUrl}),i||n}catch(t){return console.warn("Error in hasProfileChanged: ",t),th("Error in hasProfileChanged: ",t),!1}})(n,p);if(ha("[Superflow][identify] enrichment gate",{cameFromToken:g,willEnrichIdentity:f,profileChanged:m,forceReset:m,isAnonymous:null==n?void 0:n.isAnonymous,isGuest:null==n?void 0:n.isGuest,userId:null==n?void 0:n.userId,nameBefore:null==n?void 0:n.name}),f&&(n=((t,e)=>t&&e?{...t,name:e.name||t.name,photoUrl:e.photoUrl||t.photoUrl}:t)(n,p),ha("[Superflow][identify] enriched user",{nameAfter:null==n?void 0:n.name,photoUrl:null==n?void 0:n.photoUrl})),v&&(u.isAdmin=v,v&&this.allFeatureDisabled&&(this.allFeatureDisabled=!1)),this.restoreContentWarningSidebarState(),!this.projectDeleted&&(null==n?void 0:n.userId)&&!(null==n?void 0:n.isGuest)&&!(null==n?void 0:n.isAnonymous)&&this.documentId)try{await fh(this.apiKey,this.documentId,n.userId,n.name,n.email,this.credentialFor(n,g))}catch(t){th("checkDocumentUserAndCreateError",t)}ha("[Superflow][identify] setVeltAuthProvider options",{forceReset:m,profileChanged:m,userName:null==n?void 0:n.name,userId:null==n?void 0:n.userId});const[w]=await Promise.all([Velt.setVeltAuthProvider({user:n,options:{throwError:!0,forceReset:m},retryConfig:{retryCount:3,retryDelay:1e3},generateToken:async()=>{if(this.fallBackToGuestIfLiveSignInExpired(l))return null;const t=this.credentialFor(n,g),e=await dh(this.apiKey,null==n?void 0:n.userId,u,t);return this.applyServerAdminDecision(null==e?void 0:e.isAdmin),null==e?void 0:e.token},onError:t=>{console.log("Error signing to velt - ",t),this.fallBackToGuestIfLiveSignInExpired(l)||(this.invalidApiKey=!0)}}),this.fetchAndApplyFeatureAccess()]);if(this.hasAgentAccess&&this.insertShadowDOM(),this.invalidApiKey)throw"Invalid Api Key - Domain Not Whitelisted";f&&((t=>{try{const e={userId:null==t?void 0:t.userId,name:null==t?void 0:t.name,email:null==t?void 0:t.email,photoUrl:null==t?void 0:t.photoUrl},i=md(JSON.stringify(e),ci,di);pd(se,i,!0)}catch(t){console.warn("Error in saveUserToken: ",t),th("Error in saveUserToken: ",t)}})(n),ha("[Superflow][identify] token rewritten post-signin, re-read",{persistedName:null===(e=yd())||void 0===e?void 0:e.name})),ha("[Superflow][identify] velt auth response",{name:null==w?void 0:w.name,email:null==w?void 0:w.email,userId:null==w?void 0:w.userId,userSnippylyId:null==w?void 0:w.userSnippylyId,tokenUserProperties:u}),Qd(JSON.parse(JSON.stringify(w||{}))),(null==n?void 0:n.isAnonymous)||(this.snippylyUser=JSON.parse(JSON.stringify(n)),ha("[Superflow][identify] this.snippylyUser (rendered) name",null===(i=this.snippylyUser)||void 0===i?void 0:i.name)),this.syncRequestMode();const y=JSON.parse(JSON.stringify(w||{}));if((null==y?void 0:y.userSnippylyId)&&!(null==y?void 0:y.isGuest)&&this.checkToMigrateGuestUser(y,this.credentialFor(y,g)),Velt.getUserRole$().subscribe((t=>{var e;t&&(this.loading=!1,null===(e=this.commentElement)||void 0===e||e.enablePriority(),this.applyCheckPriorities())})),this.contactListSubscription=Velt.getContactElement().getContactList().subscribe((t=>{var e;this.loading=!1,(null===(e=null==t?void 0:t.organizationUsers)||void 0===e?void 0:e.length)>0&&(this.checkPrivateCommentModeFromStorage(),this.contactListSubscription&&(this.contactListSubscription.unsubscribe(),this.contactListSubscription=null))})),(null===Velt||void 0===Velt?void 0:Velt.isPlanExpired$)&&(null===Velt||void 0===Velt||Velt.isPlanExpired$().subscribe((t=>{this.isPlanExpired=t}),(t=>{this.isPlanExpired=!1,console.warn("Error in isPlanExpired$: ",t),th("Error in isPlanExpired$: ",t)}))),null===Velt||void 0===Velt?void 0:Velt.on){let t;null===Velt||void 0===Velt||Velt.on("initUpdate").subscribe((e=>{"setDocumentsSuccess"===e.event&&(t&&(t.unsubscribe(),t=null),t=null===Velt||void 0===Velt?void 0:Velt.getDocumentMetadata().subscribe((async t=>{await this.handleDocumentMetadataUpdate(t)}),(t=>{console.warn("Error in getDocumentMetadata: ",t),th("Error in getDocumentMetadata: ",t)})))}))}Jd({clientUserId:null==n?void 0:n.userId});try{Xd(n)}catch(t){console.warn("Error in trackIdentifyEvent: ",t)}this.getComments(),this.checkGlobalUserContact(),this.showFirstCommentNudge(),setTimeout((()=>{vd(ye)||this.autoCommentModeArmedOnce||(this.showTourCommentTooltip=!0)}),2e3)}catch(t){if(this.loading=!1,this.signInError=!0,s||this.resolveSuggestionRoleAsLookupFailed(),t&&"string"==typeof t&&(null===(n=null==t?void 0:t.toLowerCase())||void 0===n?void 0:n.includes("invalid"))){this.invalidApiKey=!0,eh(gt.Events.DOMAIN_NOT_WHITELISTED),this.projectId&&nh(this.apiKey,this.projectId);if(new URL(document.location).searchParams.has(ve))this.isSigningInUserAdmin=!0;else if(vd(be))this.isSigningInUserAdmin="true"===vd(be,!0);else{const t=await oh(this.apiKey,this.projectId||"",o,r);this.isSigningInUserAdmin=!!(null==t?void 0:t.isAdmin),pd(be,this.isSigningInUserAdmin+"",!0)}}console.warn("Error in identifySnippyly: ",t),th("Error in identifySnippyly: ",t)}},this.handleDocumentMetadataUpdate=async t=>{try{if(!t)return;const e=await rh(this.apiKey,null==t?void 0:t.clientDocumentId);kd(e,this.isDriveOrPreviewHost(),this.projectIdSupplied)&&this.lockForDeletedProject(),this.setProjectConfigVariables("ok"===e.status?e.config:null),await this.fetchAndApplyFeatureAccess()}catch(t){console.warn("Error in handleDocumentMetadataUpdate: ",t),th("Error in handleDocumentMetadataUpdate: ",t)}},this.lockForDeletedProject=()=>{this.projectDeleted=!0,this.applyVeltFeatureGates(),this.unmountVeltCollaborationElements()},this.fetchAndApplyFeatureAccess=async()=>{var t,e;try{const i=await wh(this.apiKey);if("error"===i.status||!i.featureAccess)return void console.warn("getFeatureAccess failed or returned no data; keeping the last known feature access");this.featureAccess=i.featureAccess,this.planLimitLocked=(t=>{var e;try{return!0===(null===(e=null==t?void 0:t.planStatus)||void 0===e?void 0:e.isOverPlanLimits)}catch(t){return!1}})(this.featureAccess),this.applyVeltFeatureGates(),this.applyStorageFeatureAccess();const n=null===(t=this.featureAccess)||void 0===t?void 0:t[mh.Agents];this.hasAgentAccess=!0===(null==n?void 0:n.hasAccess);const o=null===(e=this.featureAccess)||void 0===e?void 0:e[mh.WorkspacePrivateComments];this.hasPrivateCommentsAccess=!0===(null==o?void 0:o.hasAccess),this.isPrivateCommentsEnabledOnWorkspace=!0===(null==o?void 0:o.isPrivateCommentsEnabled),!this.canShowPrivateCommentToggle&&this.privateCommentModeEnabled&&(this.disablePrivateCommentModeOnCommentElement(),this.privateCommentModeEnabled=!1,pd(Me,"false")),this.maybeApplyVisibilityOptionsToCommentElement()}catch(t){console.warn("Error in fetchAndApplyFeatureAccess: ",t),th("Error in fetchAndApplyFeatureAccess: ",t)}},this.applyFocusedViewLayoutFix=()=>{try{!function(t){try{return"function"==typeof(null==t?void 0:t.injectCustomCss)&&(t.injectCustomCss({type:"styles",value:gp()}),!0)}catch(t){return console.warn("Error in injectFocusedViewLayoutCss: ",t),!1}}(window.Velt)}catch(t){console.warn("Error in applyFocusedViewLayoutFix: ",t),th("Error in applyFocusedViewLayoutFix: ",t)}},this.insertShadowDOM=()=>{try{if(document.querySelector("velt-wireframe"))return;const t=document.querySelector("velt-comments");t&&t.setAttribute("shadow-dom","true");const e=document.querySelector(`${ze.VELT_COMMENTS_SIDEBAR_LEGACY}, ${ze.VELT_COMMENTS_SIDEBAR_V2}`);e&&e.setAttribute("shadow-dom","true")}catch(t){console.warn("Error in insertShadowDOM: ",t),th("Error in insertShadowDOM: ",t)}},this.applyStorageFeatureAccess=()=>{try{if(!this.featureAccess||!this.commentElement)return;const t=this.featureAccess[mh.Storage];(null==t?void 0:t.hasUsageExhausted)&&(this.commentElement.disableAttachments(),this.commentElement.setRecordings("none"))}catch(t){th("Error in applyStorageFeatureAccess: ",t)}},this.checkToMigrateGuestUser=async(t,e)=>{try{const i=Cd(!1,this.apiKey);if(i){const n=`${de}:${i.userId}:${null==t?void 0:t.userId}`,o=vd(n,!1,"sessionStorage");if("with-credential"===o||"without-credential"===o&&!e)return;const r=await hh(this.apiKey,this.projectId||"",i,t,!0,e);if(!1===(null==r?void 0:r.success))return console.warn("[CWS Toolbar] Guest migration refused; keeping the guest user:",null==r?void 0:r.reason),void pd(n,e?"with-credential":"without-credential",!1,"sessionStorage");gd(n,"sessionStorage"),gd(ce)}}catch(t){console.warn("Error in checkToMigrationGuestUser: ",t),th("Error in checkToMigrationGuestUser: ",t)}},this.getComments=()=>{try{this.commentElement&&this.commentSubscription&&this.commentSubscription.unsubscribe()}catch(t){console.warn("Error in getComments: ",t),th("Error in getComments: ",t)}},this.handleCommentSelection=t=>{var e,i,n,o,r,s,a,l,c,d,h;try{if(!1===(null==t?void 0:t.selected))return void(null===(e=null===Velt||void 0===Velt?void 0:Velt.setUiState)||void 0===e||e.call(Velt,{showButtons:!1}));const u=null==t?void 0:t.annotation;if(!u||!this.isAgentAnnotation(u))return void(null===(i=null===Velt||void 0===Velt?void 0:Velt.setUiState)||void 0===i||i.call(Velt,{showButtons:!1}));const p=this.resolveFullAnnotation(u);if(mu(p))return void(null===(n=null===Velt||void 0===Velt?void 0:Velt.setUiState)||void 0===n||n.call(Velt,{showButtons:wu(p).length>1,warningType:"site"}));const v=null===(r=null===(o=null==u?void 0:u.agent)||void 0===o?void 0:o.result)||void 0===r?void 0:r.incorrectWord,g=(null===(s=null==u?void 0:u.pageInfo)||void 0===s?void 0:s.path)||(null===(a=null==u?void 0:u.location)||void 0===a?void 0:a.path)||(null===(l=null==u?void 0:u.agent)||void 0===l?void 0:l.path);if(!v||!g)return void(null===(c=null===Velt||void 0===Velt?void 0:Velt.setUiState)||void 0===c||c.call(Velt,{showButtons:!1}));const f=this.normalizePagePath(g),m=v,w=null===(h=null===(d=null==u?void 0:u.agent)||void 0===d?void 0:d.result)||void 0===h?void 0:h.type;let y,b="";"grammar"===w?(y=this.grammarSuggestionPagePathMap,b="grammar"):(y=this.spellingSuggestionPagePathMap,b="spelling");const C=null==y?void 0:y.get(m);((null==C?void 0:C.get(f))||0)<=1?Velt.setUiState({showButtons:!1,warningType:b}):Velt.setUiState({showButtons:!0,warningType:b})}catch(t){console.warn("Error in handleCommentSelection: ",t),th("Error in handleCommentSelection: ",t)}},this.processAgentComments=t=>{var e,i,n;try{const o=Array.isArray(t)?t:[];this.trackAgentPins(o),o.length&&!this.agentNamesFetched&&this.apiKey&&this.fetchAgentNames();const r=o.filter((t=>this.isAgentAnnotation(t)&&!pu(t)));if(this.sidebarV2Enabled&&!this.showAgentCommentsInSidebar&&0===r.length&&this.agentGroups.length>0){const t=new Set(this.agentGroups.flatMap((t=>{var e;return null!==(e=null==t?void 0:t.annotations)&&void 0!==e?e:[]})).map(ou));for(const e of o){const i=ou(e);i&&t.has(i)&&pu(e)&&this.removeAnnotationFromWarnings(i)}return}if(0===r.length)return this.hasContentWarnings=!1,this.contentWarningsCount=0,this.agentGroups=[],this.spellingSuggestionPagePathMap=new Map,void(this.grammarSuggestionPagePathMap=new Map);const s=new Map;for(const t of r){const i=this.extractAgentId((null===(e=null==t?void 0:t.agent)||void 0===e?void 0:e.agentFields)||[]);if(!i)continue;const n=s.get(i);n?n.push(t):s.set(i,[t])}const a=[],l=new Map,c=new Map;for(const[t,e]of s){const o=this.isCustomAgent((null===(n=null===(i=e[0])||void 0===i?void 0:i.agent)||void 0===n?void 0:n.agentFields)||[]),r=this.resolveAgentGroupName(t,e),{warnings:s,warningCount:d}=this.buildAgentWarnings(t,e,l,c);a.push({agentId:t,agentName:r,isCustom:o,warningCount:d,warnings:s,annotations:e})}if(a.sort(((t,e)=>e.warningCount-t.warningCount)),this.agentGroups=a,this.isAgentRunStatusFeedEnabled())for(const t of a)this.onboardingOpenedAgentIds.add(t.agentId);const d=a.reduce(((t,e)=>t+e.warningCount),0);this.contentWarningsCount=d,this.hasContentWarnings=d>0,this.spellingSuggestionPagePathMap=l,this.grammarSuggestionPagePathMap=c}catch(t){console.warn("Error in processAgentComments: ",t),th("Error in processAgentComments: ",t)}},this.extractAgentId=t=>{try{if(!Array.isArray(t)||0===t.length)return null;for(const e of t)if(null==e?void 0:e.startsWith(Ue.AGENT))return e.substring(Ue.AGENT.length);return null}catch(t){return console.warn("Error in extractAgentId: ",t),null}},this.isCustomAgent=t=>{try{return!!Array.isArray(t)&&t.includes(Ue.AGENT_TYPE_CUSTOM)}catch(t){return console.warn("Error in isCustomAgent: ",t),!1}},this.resolveAgentGroupName=(t,e)=>{var i;try{return cv(null===(i=this.agentNameMap)||void 0===i?void 0:i.get(t),e)||this.getAgentNameFromId(t)}catch(e){return console.warn("Error in resolveAgentGroupName: ",e),th("Error in resolveAgentGroupName: ",e),this.getAgentNameFromId(t)}},this.resolveAgentDisplayName=t=>{var e,i;try{return null!==(i=null===(e=this.agentNameMap)||void 0===e?void 0:e.get(t))&&void 0!==i?i:this.getAgentNameFromId(t)}catch(t){return console.warn("Error in resolveAgentDisplayName: ",t),Gt}},this.getAgentNameFromId=t=>{try{return t&&/^[a-z]+(-[a-z]+)*$/.test(t)?t.split("-").map((t=>`${t.charAt(0).toUpperCase()}${t.slice(1)}`)).join(" "):Gt}catch(t){return console.warn("Error in getAgentNameFromId: ",t),Gt}},this.fetchAgentNames=async()=>{var t,e,i;try{this.agentNamesFetched=!0;const{getAgents:n}=await Promise.resolve().then((function(){return kh})),o=await n(this.apiKey),r=new Map;for(const i of o){const n=null!==(t=null==i?void 0:i.id)&&void 0!==t?t:"",o=null!==(e=null==i?void 0:i.name)&&void 0!==e?e:"";n&&o&&r.set(n,o)}if(this.agentNameMap=r,(null===(i=this.agentGroups)||void 0===i?void 0:i.length)>0){const t=this.agentGroups.map((t=>({...t,agentName:this.resolveAgentGroupName(t.agentId,t.annotations)})));this.agentGroups=t}}catch(t){this.agentNamesFetched=!1,console.warn("Error in fetchAgentNames: ",t)}},this.sanitiseAgentRunStatusRows=t=>{try{const e=[],i=Array.isArray(t)?t.slice(0,50):[];for(const t of i){const i=null==t?void 0:t.agentId;if("string"!=typeof i||0===i.length)continue;const n=("string"==typeof(null==t?void 0:t.name)&&t.name.length>0?t.name:this.resolveAgentDisplayName(i)).slice(0,80),o="string"==typeof(null==t?void 0:t.status)&&Bt.includes(t.status),r=!0!==(null==t?void 0:t.terminal)&&!o,s=null==t?void 0:t.findings,a="number"==typeof s&&Number.isFinite(s)&&s>=0?Math.floor(s):0;e.push(o?{agentId:i,agentName:n,isRunning:r,findingsCount:a,failed:!0}:{agentId:i,agentName:n,isRunning:r,findingsCount:a})}return e}catch(t){return console.warn("Error in sanitiseAgentRunStatusRows: ",t),th("Error in sanitiseAgentRunStatusRows: ",t),[]}},this.getPortalOrigins=()=>{try{if(this.portalOrigins)return this.portalOrigins;const t=new Set;for(const e of[ai,li])try{const{origin:i,hostname:n,protocol:o}=new URL(e);t.add(i),n.endsWith(".firebaseapp.com")?t.add(`${o}//${n.replace(/\.firebaseapp\.com$/,".web.app")}`):n.endsWith(".web.app")&&t.add(`${o}//${n.replace(/\.web\.app$/,".firebaseapp.com")}`)}catch{}return this.portalOrigins=[...t],this.portalOrigins}catch(t){return console.warn("Error in getPortalOrigins: ",t),th("Error in getPortalOrigins: ",t),[]}},this.isAllowedPortalOrigin=t=>{try{if("string"!=typeof t||0===t.length||"null"===t)return!1;if(this.getPortalOrigins().includes(t))return!0;const{protocol:e,hostname:i}=new URL(t);return!("http:"!==e&&"https:"!==e||"localhost"!==i&&"127.0.0.1"!==i)}catch{return!1}},this.readAncestorOrigins=()=>{var t;try{const e=null===(t=window.location)||void 0===t?void 0:t.ancestorOrigins;return e?Array.from(e):null}catch{return null}},this.readDocumentReferrer=()=>{try{return document.referrer||""}catch{return""}},this.getParentFrameOrigin=()=>{try{if(!window.parent||window.parent===window)return null;const t=this.readAncestorOrigins();if(t)return t[0]||null;const e=this.readDocumentReferrer();return e?new URL(e).origin:null}catch{return null}},this.isFramedByPortal=()=>{try{return this.isAllowedPortalOrigin(this.getParentFrameOrigin())}catch(t){return console.warn("Error in isFramedByPortal: ",t),th("Error in isFramedByPortal: ",t),!1}},this.isAgentRunStatusFeedEnabled=()=>this.onboardingMode||this.agentStatusMode,this.canHonourStoredOnboardingFlag=()=>{try{if(!window.parent||window.parent===window)return!1;const t=this.readAncestorOrigins();return!t||this.isAllowedPortalOrigin(t[0])}catch(t){return console.warn("Error in canHonourStoredOnboardingFlag: ",t),th("Error in canHonourStoredOnboardingFlag: ",t),!1}},this.getPortalTargetOrigin=()=>{try{const t=this.getParentFrameOrigin();return t&&this.isAllowedPortalOrigin(t)?t:"*"}catch{return"*"}},this.startAgentRunStatusListener=()=>{try{if(!this.isAgentRunStatusFeedEnabled()||!this.isConnected)return void this.stopAgentRunStatusListener();if(this.agentRunStatusListening)return;if(!window.parent||window.parent===window)return void(this.agentRunStatusSettled=!0);if(window.addEventListener("message",this.onAgentRunStatusMessage),this.agentRunStatusListening=!0,this.onboardingMode&&this.startOnboardingViewportListener(),this.announceToPortal(),this.agentRunStatusSettled){if(this.agentRunStatuses.some((t=>null==t?void 0:t.isRunning))){const t=this.agentRunStatusLastMessageAt>0?Date.now()-this.agentRunStatusLastMessageAt:0;this.armAgentRunStatusWatchdog(Math.max(0,Ut-t))}}else this.armAgentRunStatusWatchdog(2e4);this.ensureOnboardingFindingsLoaded()}catch(t){console.warn("Error in startAgentRunStatusListener: ",t),th("Error in startAgentRunStatusListener: ",t)}},this.announceToPortal=()=>{try{window.parent.postMessage({type:Ft,caps:{showComment:!0}},this.getPortalTargetOrigin()),this.postPreviewLocation()}catch(t){console.warn("Error in announceToPortal: ",t),th("Error in announceToPortal: ",t)}},this.attachPageLifecycleListeners=()=>{try{if(this.pageLifecycleListenersAttached)return;window.addEventListener("pagehide",this.onPreviewPageHide),window.addEventListener("pageshow",this.onPreviewPageShow),this.pageLifecycleListenersAttached=!0}catch(t){console.warn("Error in attachPageLifecycleListeners: ",t),th("Error in attachPageLifecycleListeners: ",t)}},this.detachPageLifecycleListeners=()=>{try{window.removeEventListener("pagehide",this.onPreviewPageHide),window.removeEventListener("pageshow",this.onPreviewPageShow),this.pageLifecycleListenersAttached=!1}catch(t){console.warn("Error in detachPageLifecycleListeners: ",t),th("Error in detachPageLifecycleListeners: ",t)}},this.onPreviewPageHide=()=>{try{this.postPreviewLeaving()}catch(t){console.warn("Error in onPreviewPageHide: ",t),th("Error in onPreviewPageHide: ",t)}},this.onPreviewPageShow=t=>{try{if(!(null==t?void 0:t.persisted))return;if(this.pendingLeavingPage=null,this.lastPostedPreviewLocationPage=null,!this.canAnnounceToPortal())return;this.announceToPortal()}catch(t){console.warn("Error in onPreviewPageShow: ",t),th("Error in onPreviewPageShow: ",t)}},this.postPreviewLeaving=()=>{try{const t=this.pendingLeavingPage;if(this.pendingLeavingPage=null,!this.canAnnounceToPortal())return;const e=this.getPortalTargetOrigin();window.parent.postMessage(t&&"*"!==e?{type:te,page:t}:{type:te},e)}catch(t){console.warn("Error in postPreviewLeaving: ",t),th("Error in postPreviewLeaving: ",t)}},this.canAnnounceToPortal=()=>{try{return!(!this.isAgentRunStatusFeedEnabled()||!this.agentRunStatusListening)&&(!!window.parent&&window.parent!==window)}catch(t){return console.warn("Error in canAnnounceToPortal: ",t),th("Error in canAnnounceToPortal: ",t),!1}},this.getPreviewMessageTargetOrigin=()=>{try{if(!this.canAnnounceToPortal())return null;const t=this.getPortalTargetOrigin();return t&&"*"!==t?t:null}catch(t){return console.warn("Error in getPreviewMessageTargetOrigin: ",t),th("Error in getPreviewMessageTargetOrigin: ",t),null}},this.readPageHref=()=>{try{return window.location.href||""}catch{return""}},this.getPreviewLocationPage=()=>{try{let t;if(this.isRunningUnderPreviewProxy()&&!this.isRunningUnderLivePreview())t=this.parsePreviewSitePath(this.previewLocationPath);else{const e=this.readPageHref();if(!e)return null;t=new URL(e)}return t?this.toPreviewLocationPage(t):null}catch(t){return console.warn("Error in getPreviewLocationPage: ",t),th("Error in getPreviewLocationPage: ",t),null}},this.parsePreviewSitePath=t=>{try{const e="https://page.invalid";if("string"!=typeof t||!t.startsWith("/")||t.startsWith("//"))return null;const i=new URL(t,e);return i.origin!==e?null:i}catch(t){return console.warn("Error in parsePreviewSitePath: ",t),th("Error in parsePreviewSitePath: ",t),null}},this.toPreviewLocationPage=t=>{try{const e=new Set(oi),i=t.search.replace(/^\?/,"").split("&").filter((t=>{if(!t)return!1;const i=t.split("=",1)[0];let n=i;try{n=decodeURIComponent(i.replace(/\+/g," "))}catch{}return!e.has(n)})),n=`${t.pathname}${i.length>0?`?${i.join("&")}`:""}`;return!n.startsWith("/")||n.startsWith("//")||n.length>2048?null:n}catch(t){return console.warn("Error in toPreviewLocationPage: ",t),th("Error in toPreviewLocationPage: ",t),null}},this.postPreviewLocation=()=>{try{const t=this.getPreviewMessageTargetOrigin();if(!t)return;const e=this.getPreviewLocationPage();if(!e)return;if(e===this.lastPostedPreviewLocationPage)return;window.parent.postMessage({type:Xt,page:e},t),this.lastPostedPreviewLocationPage=e}catch(t){console.warn("Error in postPreviewLocation: ",t),th("Error in postPreviewLocation: ",t)}},this.stopAgentRunStatusListener=()=>{try{window.removeEventListener("message",this.onAgentRunStatusMessage),this.agentRunStatusListening=!1,this.clearAgentRunStatusWatchdog(),this.clearOnboardingFindingsFetch(),this.stopOnboardingViewportListener()}catch(t){console.warn("Error in stopAgentRunStatusListener: ",t),th("Error in stopAgentRunStatusListener: ",t)}},this.onAgentRunStatusMessage=t=>{try{if(!this.isAgentRunStatusFeedEnabled())return;if(!window.parent||window.parent===window||(null==t?void 0:t.source)!==window.parent)return;if(!this.isAllowedPortalOrigin(null==t?void 0:t.origin))return;const e=null==t?void 0:t.data;if((null==e?void 0:e.type)===Vt)return void this.postOnboardingDiagnostics(t.origin);if((null==e?void 0:e.type)===Jt)return void this.onPreviewShowCommentMessage(e);if((null==e?void 0:e.type)!==Dt||!Array.isArray(null==e?void 0:e.agents))return;this.agentRunStatuses=this.sanitiseAgentRunStatusRows(e.agents),this.agentRunStatusTimedOut=!1,this.agentRunStatusLastMessageAt=Date.now();const i=!0===(null==e?void 0:e.allTerminal);(this.agentRunStatuses.length>0||i)&&(this.agentRunStatusSettled=!0);this.agentRunStatuses.some((t=>null==t?void 0:t.isRunning))?this.armAgentRunStatusWatchdog(Ut):this.agentRunStatusSettled&&this.clearAgentRunStatusWatchdog(),this.ensureOnboardingFindingsLoaded()}catch(t){console.warn("Error in onAgentRunStatusMessage: ",t),th("Error in onAgentRunStatusMessage: ",t)}},this.onPreviewShowCommentMessage=t=>{let e=null;this.portalShowSeq+=1;const i=this.portalShowSeq;try{if(e=this.readPreviewShowCommentRequest(t),!e)return void this.recordPortalShowDecision(i,null,"","malformed");this.dropPendingPortalShow(),this.dropPendingCommentDeepLink("superseded"),this.releaseAgentPinDialogHold("replaced");const{pageUrl:n,annotationId:o}=e;if(o){const t=this.resolvePortalShowAnnotation(o,n),e=this.opensAgentAnnotationHere(t)?this.getPortalShowWait(o):null;if(e)return this.pendingPortalShow={seq:i,annotationId:o,pageUrl:n,pagePath:this.getCurrentPagePath()},this.recordPortalShowDecision(i,o,n,e),void this.applyPendingPortalShow();const r=this.openAgentAnnotation(t,!0,{pinSource:"show",show:{seq:i,pageUrl:n}});return void this.recordPortalShowDecision(i,o,n,this.toPortalShowOutcome(r))}if(this.isCurrentPreviewPage(n))return void this.recordPortalShowDecision(i,null,n,"page-here");const r=this.navigateToPage(n,null,!0);this.recordPortalShowDecision(i,null,n,r?"page-navigated":"navigate-failed")}catch(t){e&&this.recordPortalShowDecision(i,e.annotationId,e.pageUrl,"error"),console.warn("Error in onPreviewShowCommentMessage: ",t),th("Error in onPreviewShowCommentMessage: ",t)}},this.toPortalShowOutcome=t=>{try{return"navigated"===t||"navigate-failed"===t?t:t?t.sidebarRefused?"sidebar-refused":t.outcome:"error"}catch(t){return console.warn("Error in toPortalShowOutcome: ",t),"error"}},this.getPortalShowWait=t=>{var e;try{return this.commentElement&&this.findLoadedAgentAnnotation(t)?(null!==(e=this.onboardingUnsyncedAnnotationIds)&&void 0!==e?e:[]).includes(t)?"waiting-sync":this.isDocumentStillParsing()?"waiting-dom":null:"waiting-comment"}catch(t){return console.warn("Error in getPortalShowWait: ",t),th("Error in getPortalShowWait: ",t),"waiting-comment"}},this.resolvePortalShowAnnotation=(t,e)=>{var i,n;try{const o=this.findLoadedAgentAnnotation(t);return o?Yp(null===(i=null==o?void 0:o.pageInfo)||void 0===i?void 0:i.url)?o:{...o,pageInfo:{...null!==(n=null==o?void 0:o.pageInfo)&&void 0!==n?n:{},url:e}}:{annotationId:t,pageInfo:{url:e}}}catch(i){return console.warn("Error in resolvePortalShowAnnotation: ",i),th("Error in resolvePortalShowAnnotation: ",i),{annotationId:t,pageInfo:{url:e}}}},this.isPortalShowAnnotationReady=t=>{var e;try{return!!this.commentElement&&(!!this.findLoadedAgentAnnotation(t)&&!(null!==(e=this.onboardingUnsyncedAnnotationIds)&&void 0!==e?e:[]).includes(t))}catch(t){return console.warn("Error in isPortalShowAnnotationReady: ",t),th("Error in isPortalShowAnnotationReady: ",t),!1}},this.applyPendingPortalShow=()=>{const t=this.pendingPortalShow;try{if(!t)return;if(!Zp(t.pagePath,this.getCurrentPagePath()))return void this.dropPendingPortalShow("page-changed");const e=this.getPortalShowWait(t.annotationId);if(e)return this.recordPortalShowDecision(t.seq,t.annotationId,t.pageUrl,e),void("waiting-dom"===e&&this.waitForDocumentParsed());this.dropPendingPortalShow();const i=this.resolvePortalShowAnnotation(t.annotationId,t.pageUrl),n={seq:t.seq,pageUrl:t.pageUrl};if(!this.opensAgentAnnotationHere(i))return void this.recordPortalShowDecision(n.seq,t.annotationId,t.pageUrl,"other-page");const o=this.openAgentAnnotationHere(i,!1,"show",n);this.recordPortalShowDecision(n.seq,t.annotationId,t.pageUrl,this.toPortalShowOutcome(o))}catch(e){this.dropPendingPortalShow(),t&&this.recordPortalShowDecision(t.seq,t.annotationId,t.pageUrl,"error"),console.warn("Error in applyPendingPortalShow: ",e),th("Error in applyPendingPortalShow: ",e)}},this.dropPendingPortalShowIfPageChanged=()=>{try{this.pendingPortalShow&&!Zp(this.pendingPortalShow.pagePath,this.getCurrentPagePath())&&this.dropPendingPortalShow("page-changed")}catch(t){console.warn("Error in dropPendingPortalShowIfPageChanged: ",t),th("Error in dropPendingPortalShowIfPageChanged: ",t)}},this.dropPendingCommentDeepLinkIfPageChanged=()=>{try{this.pendingCommentDeepLink&&!Zp(this.pendingCommentDeepLink.pagePath,this.getCurrentPagePath())&&this.dropPendingCommentDeepLink("page-changed");const t=this.pendingAgentPin;t&&!Zp(t.pagePath,this.getCurrentPagePath())&&(this.pendingAgentPin=null,this.recordAgentPinRequestOutcome(t,"page-changed","page-changed"));const e=this.agentPinDialogHold;e&&!Zp(e.pagePath,this.getCurrentPagePath())&&this.releaseAgentPinDialogHold("replaced")}catch(t){console.warn("Error in dropPendingCommentDeepLinkIfPageChanged: ",t),th("Error in dropPendingCommentDeepLinkIfPageChanged: ",t)}},this.dropPendingPortalShow=t=>{try{const e=this.pendingPortalShow,i=this.pendingAgentPin;this.pendingPortalShow=null,i&&"deep-link"!==i.source&&(this.pendingAgentPin=null),t&&(e?this.recordPortalShowDecision(e.seq,e.annotationId,e.pageUrl,t):"show"===(null==i?void 0:i.source)&&this.recordAgentPinRequestOutcome(i,t,null)),this.stopWaitingForDocumentParsed()}catch(t){this.pendingPortalShow=null,this.pendingAgentPin=null,console.warn("Error in dropPendingPortalShow: ",t),th("Error in dropPendingPortalShow: ",t)}},this.dropPendingCommentDeepLink=t=>{var e;try{const i=this.pendingCommentDeepLink,n=this.pendingAgentPin;this.pendingCommentDeepLink=null,this.pendingAgentPin=null,i?this.recordCommentDeepLinkDecision(i.annotationId,t):n&&this.recordAgentPinRequestOutcome(n,null!==(e=Nv[t])&&void 0!==e?e:"superseded",t),this.stopWaitingForDocumentParsed()}catch(t){this.pendingCommentDeepLink=null,this.pendingAgentPin=null,console.warn("Error in dropPendingCommentDeepLink: ",t),th("Error in dropPendingCommentDeepLink: ",t)}},this.recordAgentPinRequestOutcome=(t,e,i)=>{var n;try{if("show"===t.source){const i=null!==(n=t.show)&&void 0!==n?n:{seq:this.portalShowSeq,pageUrl:""};this.recordPortalShowDecision(i.seq,t.annotationId,i.pageUrl,e)}else"deep-link"===t.source&&i&&this.recordCommentDeepLinkDecision(t.annotationId,i)}catch(t){console.warn("Error in recordAgentPinRequestOutcome: ",t),th("Error in recordAgentPinRequestOutcome: ",t)}},this.recordCommentDeepLinkDecision=(t,e)=>{try{const i=this.lastCommentDeepLinkDecision;if(i&&i.annotationId===t&&i.outcome===e)return;this.lastCommentDeepLinkDecision={annotationId:t,outcome:e,readyState:String(document.readyState),at:Date.now()}}catch(t){console.warn("Error in recordCommentDeepLinkDecision: ",t),th("Error in recordCommentDeepLinkDecision: ",t)}},this.recordPortalShowDecision=(t,e,i,n)=>{try{const o=this.lastPortalShowDecision;if(o&&o.seq>t)return;if(o&&o.seq===t&&o.annotationId===e&&o.pageUrl===i&&o.outcome===n)return;this.lastPortalShowDecision={seq:t,annotationId:e,pageUrl:i,outcome:n,pagePath:this.getCurrentPagePath(),readyState:String(document.readyState),at:Date.now()}}catch(t){console.warn("Error in recordPortalShowDecision: ",t),th("Error in recordPortalShowDecision: ",t)}},this.isDocumentStillParsing=()=>{try{return"loading"===document.readyState}catch(t){return console.warn("Error in isDocumentStillParsing: ",t),th("Error in isDocumentStillParsing: ",t),!1}},this.waitForDocumentParsed=()=>{try{if(this.documentParsedListenerAttached)return;document.addEventListener("DOMContentLoaded",this.onDocumentParsed,{once:!0}),this.documentParsedListenerAttached=!0}catch(t){console.warn("Error in waitForDocumentParsed: ",t),th("Error in waitForDocumentParsed: ",t)}},this.stopWaitingForDocumentParsed=(t=!1)=>{try{if(!this.documentParsedListenerAttached)return;if(!t&&(this.pendingPortalShow||this.pendingCommentDeepLink))return;document.removeEventListener("DOMContentLoaded",this.onDocumentParsed),this.documentParsedListenerAttached=!1}catch(t){console.warn("Error in stopWaitingForDocumentParsed: ",t),th("Error in stopWaitingForDocumentParsed: ",t)}},this.onDocumentParsed=()=>{try{this.documentParsedListenerAttached=!1,this.applyPendingPortalShow(),this.applyPendingCommentDeepLink()}catch(t){console.warn("Error in onDocumentParsed: ",t),th("Error in onDocumentParsed: ",t)}},this.isCurrentPreviewPage=t=>{try{const e=this.getPreviewLocationPage();if(!e)return!1;const i=new URL(t),n=Ad(i)?null:Td(t),o=null===n?i:this.parsePreviewSitePath(n);return!!o&&this.toPreviewLocationPage(o)===e}catch(t){return console.warn("Error in isCurrentPreviewPage: ",t),th("Error in isCurrentPreviewPage: ",t),!1}},this.readPreviewShowCommentRequest=t=>{try{if(!t||"object"!=typeof t)return null;const{pageUrl:e,annotationId:i}=t;if("string"!=typeof e||0===e.length||e.length>2048)return null;let n="";try{n=new URL(e).protocol}catch{return null}return"http:"!==n&&"https:"!==n?null:void 0===i?{pageUrl:e,annotationId:null}:"string"!=typeof i||0===i.trim().length||i.length>200?null:{pageUrl:e,annotationId:i}}catch(t){return console.warn("Error in readPreviewShowCommentRequest: ",t),th("Error in readPreviewShowCommentRequest: ",t),null}},this.findLoadedAgentAnnotation=t=>{var e,i,n,o;try{const r={annotationId:t},s=this.resolveFullAnnotation(r);if(s&&s!==r)return s;const a=e=>ou(e)===t;return null!==(o=null!==(i=(null!==(e=this.lastStreamAnnotations)&&void 0!==e?e:[]).find(a))&&void 0!==i?i:(null!==(n=this.agentGroups)&&void 0!==n?n:[]).flatMap((t=>{var e;return null!==(e=null==t?void 0:t.annotations)&&void 0!==e?e:[]})).find(a))&&void 0!==o?o:null}catch(t){return console.warn("Error in findLoadedAgentAnnotation: ",t),th("Error in findLoadedAgentAnnotation: ",t),null}},this.postOnboardingDiagnostics=t=>{var e,i,n,o,r,s;try{if(!this.isAgentRunStatusFeedEnabled()||!window.parent||window.parent===window||!this.isAllowedPortalOrigin(t))return;const a=(null!==(e=this.lastStreamAnnotations)&&void 0!==e?e:[]).filter((t=>this.isAgentAnnotation(t))).length;window.parent.postMessage({type:jt,at:(new Date).toISOString(),version:ft,identity:{hasUser:!!this.snippylyUser,isGuest:!!(null===(i=this.snippylyUser)||void 0===i?void 0:i.isGuest),isAnonymous:!!(null===(n=this.snippylyUser)||void 0===n?void 0:n.isAnonymous),hasRole:!!this.snippylyUserRole,loading:this.loading},sdk:{hasCommentElement:!!this.commentElement,hasDocumentId:!!this.documentId,hasLocationPath:!!this.previewLocationPath,sidebarV2:this.sidebarV2Enabled,showAgentCommentsInSidebar:this.showAgentCommentsInSidebar,agentCommentsModeRequested:this.agentCommentsModeRequested,privateCommentsEnabled:this.isPrivateCommentsEnabledOnWorkspace,hasPrivateCommentsAccess:this.hasPrivateCommentsAccess},stream:{emissions:this.streamEmissionCount,lastEmissionAt:this.lastStreamEmissionAt?new Date(this.lastStreamEmissionAt).toISOString():null,lastSize:(null!==(o=this.lastStreamAnnotations)&&void 0!==o?o:[]).length,agentAnnotations:a},fetch:{attempts:this.onboardingFindingsFetchAttempts,inFlight:this.onboardingFindingsFetchInFlight,pending:null!==this.onboardingFindingsFetchTimer,lastCount:this.onboardingLastFetchCount,lastError:this.onboardingLastFetchError,fetchedAt:this.onboardingFetchedAt?new Date(this.onboardingFetchedAt).toISOString():null,unsynced:this.onboardingUnsyncedAnnotationIds.length,waitingForSignIn:!this.isVeltUserSignedIn()},groups:(null!==(r=this.agentGroups)&&void 0!==r?r:[]).map((t=>({agentId:null==t?void 0:t.agentId,count:null==t?void 0:t.warningCount}))),statuses:(null!==(s=this.agentRunStatuses)&&void 0!==s?s:[]).map((t=>({agentId:null==t?void 0:t.agentId,isRunning:null==t?void 0:t.isRunning,findingsCount:null==t?void 0:t.findingsCount,failed:!!(null==t?void 0:t.failed),timedOut:!!(null==t?void 0:t.timedOut)}))),missing:this.getAgentIdsMissingFindings(),sidebarOpen:this.showContentWarningSidebar,settled:this.agentRunStatusSettled},t)}catch(t){console.warn("Error in postOnboardingDiagnostics: ",t),th("Error in postOnboardingDiagnostics: ",t)}},this.isOnboardingAgentResolved=t=>{try{return this.onboardingOpenedAgentIds.has(t)||this.onboardingFetchResolvedAgentIds.has(t)}catch(t){return console.warn("Error in isOnboardingAgentResolved: ",t),!1}},this.getAgentIdsMissingFindings=()=>{var t,e;try{const i=new Set((null!==(t=this.agentGroups)&&void 0!==t?t:[]).map((t=>null==t?void 0:t.agentId)));return(null!==(e=this.agentRunStatuses)&&void 0!==e?e:[]).filter((t=>{var e;return!(null==t?void 0:t.isRunning)&&(null!==(e=null==t?void 0:t.findingsCount)&&void 0!==e?e:0)>0})).map((t=>null==t?void 0:t.agentId)).filter((t=>!!t&&!i.has(t)&&!this.isOnboardingAgentResolved(t)))}catch(t){return console.warn("Error in getAgentIdsMissingFindings: ",t),th("Error in getAgentIdsMissingFindings: ",t),[]}},this.getFetchableMissingAgentIds=()=>{try{return this.onboardingFindingsFetchAttempts>=30?[]:this.getAgentIdsMissingFindings().filter((t=>{var e;return(null!==(e=this.onboardingFetchAttemptsByAgent.get(t))&&void 0!==e?e:0)<10}))}catch(t){return console.warn("Error in getFetchableMissingAgentIds: ",t),th("Error in getFetchableMissingAgentIds: ",t),[]}},this.isOnboardingFindingsLoadExhausted=t=>{var e;try{return null===this.onboardingFindingsFetchTimer&&!this.onboardingFindingsFetchInFlight&&((null!==(e=this.onboardingFetchAttemptsByAgent.get(t))&&void 0!==e?e:0)>=10||this.onboardingFindingsFetchAttempts>=30)}catch(t){return console.warn("Error in isOnboardingFindingsLoadExhausted: ",t),!1}},this.getDisplayAgentRunStatuses=()=>{var t,e;try{if(!this.isAgentRunStatusFeedEnabled())return this.agentRunStatuses;const i=new Set((null!==(t=this.agentGroups)&&void 0!==t?t:[]).map((t=>null==t?void 0:t.agentId)));return(null!==(e=this.agentRunStatuses)&&void 0!==e?e:[]).map((t=>{var e;return(null==t?void 0:t.isRunning)||0===(null!==(e=null==t?void 0:t.findingsCount)&&void 0!==e?e:0)||i.has(null==t?void 0:t.agentId)?t:this.isOnboardingAgentResolved(t.agentId)?{...t,findingsResolved:!0}:this.isOnboardingFindingsLoadExhausted(t.agentId)?{...t,findingsUnavailable:!0}:t}))}catch(t){return console.warn("Error in getDisplayAgentRunStatuses: ",t),th("Error in getDisplayAgentRunStatuses: ",t),this.agentRunStatuses}},this.ensureOnboardingFindingsLoaded=()=>{try{if(!this.isAgentRunStatusFeedEnabled()||!this.agentRunStatusListening)return;if(null!==this.onboardingFindingsFetchTimer||this.onboardingFindingsFetchInFlight)return;if(0===this.getFetchableMissingAgentIds().length)return;if(!this.isVeltUserSignedIn())return;this.onboardingFindingsFetchTimer=setTimeout((()=>this.fetchOnboardingFindings()),3e3)}catch(t){console.warn("Error in ensureOnboardingFindingsLoaded: ",t),th("Error in ensureOnboardingFindingsLoaded: ",t)}},this.isVeltUserSignedIn=()=>{try{return this.watchVeltCurrentUser(),!this.veltCurrentUserWatched||this.veltUserSignedIn}catch(t){return console.warn("Error in isVeltUserSignedIn: ",t),th("Error in isVeltUserSignedIn: ",t),!0}},this.watchVeltCurrentUser=()=>{try{if(this.veltCurrentUserWatched)return;const t=window.Velt;if("function"!=typeof(null==t?void 0:t.getCurrentUser))return;const e=t.getCurrentUser();if(!e||"function"!=typeof e.subscribe)return;this.veltCurrentUserWatched=!0,this.veltUserSignedIn=!1;let i=!0;const n=e.subscribe((t=>this.onVeltCurrentUser(t,i)));i=!1,this.veltCurrentUserSubscription=null!=n?n:null}catch(t){console.warn("Error in watchVeltCurrentUser: ",t),th("Error in watchVeltCurrentUser: ",t)}},this.onVeltCurrentUser=(t,e=!1)=>{try{const i=!!t&&"object"==typeof t,n=this.veltUserSignedIn;this.veltUserSignedIn=i,!i||n||e||this.ensureOnboardingFindingsLoaded()}catch(t){console.warn("Error in onVeltCurrentUser: ",t),th("Error in onVeltCurrentUser: ",t)}},this.unwatchVeltCurrentUser=()=>{var t,e;try{null===(e=null===(t=this.veltCurrentUserSubscription)||void 0===t?void 0:t.unsubscribe)||void 0===e||e.call(t)}catch(t){console.warn("Error in unwatchVeltCurrentUser: ",t)}finally{this.veltCurrentUserSubscription=null,this.veltCurrentUserWatched=!1,this.veltUserSignedIn=!1}},this.clearOnboardingFindingsFetch=()=>{try{null!==this.onboardingFindingsFetchTimer&&(clearTimeout(this.onboardingFindingsFetchTimer),this.onboardingFindingsFetchTimer=null)}catch(t){console.warn("Error in clearOnboardingFindingsFetch: ",t),th("Error in clearOnboardingFindingsFetch: ",t)}},this.countOnboardingFetchAttempt=t=>{var e;this.onboardingFindingsFetchAttempts+=1;for(const i of t)this.onboardingFetchAttemptsByAgent.set(i,(null!==(e=this.onboardingFetchAttemptsByAgent.get(i))&&void 0!==e?e:0)+1)},this.fetchOnboardingFindings=async()=>{var t;try{if(this.onboardingFindingsFetchTimer=null,!this.isAgentRunStatusFeedEnabled())return;const e=this.getFetchableMissingAgentIds();if(0===e.length)return;if(!this.isVeltUserSignedIn())return;if(this.countOnboardingFetchAttempt(e),"function"!=typeof(null===(t=this.commentElement)||void 0===t?void 0:t.fetchCommentAnnotations)||!this.documentId)return this.onboardingLastFetchError=zt.SDK_NOT_READY,this.ensureOnboardingFindingsLoaded(),void this.requestUpdate();this.onboardingFindingsFetchInFlight=!0;const i=await this.commentElement.fetchCommentAnnotations({documentIds:[`${this.documentId}`]});if(this.onboardingFindingsFetchInFlight=!1,!this.isAgentRunStatusFeedEnabled())return;if(null===(null==i?void 0:i.data)||void 0===(null==i?void 0:i.data))this.onboardingLastFetchCount=0,this.onboardingLastFetchError=zt.SDK_RETURNED_NULL;else{const t=this.flattenFetchedAnnotations(i);this.onboardingLastFetchCount=t.length,this.onboardingLastFetchError="",this.applyOnboardingFetchResult(t)}this.ensureOnboardingFindingsLoaded(),this.requestUpdate()}catch(t){this.onboardingFindingsFetchInFlight=!1,this.onboardingLastFetchError=zt.FETCH_THREW,console.warn("Error in fetchOnboardingFindings: ",t),th("Error in fetchOnboardingFindings: ",t),this.ensureOnboardingFindingsLoaded(),this.requestUpdate()}},this.applyOnboardingFetchResult=t=>{var e,i;try{const n=(Array.isArray(t)?t:[]).filter((t=>{const e=null==t?void 0:t.annotationId;return!!e&&!this.onboardingRemovedAnnotationIds.has(e)&&this.isAgentAnnotation(t)})),o=new Map;for(const t of n){const n=this.extractAgentId((null===(e=null==t?void 0:t.agent)||void 0===e?void 0:e.agentFields)||[]);if(!n)continue;const r=!pu(t);o.set(n,null!==(i=o.get(n))&&void 0!==i&&i||r)}for(const[t,e]of o)e?this.onboardingFetchResolvedAgentIds.delete(t):this.onboardingFetchResolvedAgentIds.add(t);this.onboardingFetchedAnnotations=n,this.onboardingFetchedAt=Date.now(),this.processAgentComments(this.mergeOnboardingFetchedAnnotations(this.lastStreamAnnotations))}catch(t){console.warn("Error in applyOnboardingFetchResult: ",t),th("Error in applyOnboardingFetchResult: ",t)}},this.flattenFetchedAnnotations=t=>{try{const e=null==t?void 0:t.data;if(Array.isArray(e))return e;if(!e||"object"!=typeof e)return[];const i=[];for(const t of Object.values(e))Array.isArray(t)&&i.push(...t);return i}catch(t){return console.warn("Error in flattenFetchedAnnotations: ",t),th("Error in flattenFetchedAnnotations: ",t),[]}},this.mergeOnboardingFetchedAnnotations=t=>{var e;try{const i=Array.isArray(t)?t:[];if(!this.isAgentRunStatusFeedEnabled())return i;if(0===this.onboardingFetchedAnnotations.length)return this.setOnboardingUnsyncedAnnotationIds([]),i;const n=new Set(i.map((t=>null==t?void 0:t.annotationId)));if(this.sidebarV2Enabled&&!this.showAgentCommentsInSidebar){const t=new Map,o=(null!==(e=this.agentGroups)&&void 0!==e?e:[]).flatMap((t=>{var e;return null!==(e=null==t?void 0:t.annotations)&&void 0!==e?e:[]}));for(const e of[...o,...this.onboardingFetchedAnnotations]){const i=null==e?void 0:e.annotationId;!i||n.has(i)||t.has(i)||this.onboardingRemovedAnnotationIds.has(i)||t.set(i,e)}return t.size>0?[...i,...t.values()]:i}return this.onboardingFetchedAnnotations=this.onboardingFetchedAnnotations.filter((t=>{const e=null==t?void 0:t.annotationId;return!!e&&!n.has(e)&&!this.onboardingRemovedAnnotationIds.has(e)})),this.setOnboardingUnsyncedAnnotationIds(this.onboardingFetchedAnnotations.map((t=>t.annotationId))),this.onboardingFetchedAnnotations.length>0?[...i,...this.onboardingFetchedAnnotations]:i}catch(e){return console.warn("Error in mergeOnboardingFetchedAnnotations: ",e),th("Error in mergeOnboardingFetchedAnnotations: ",e),Array.isArray(t)?t:[]}},this.setOnboardingUnsyncedAnnotationIds=t=>{try{const e=[...t].sort();e.join("\n")!==this.onboardingUnsyncedAnnotationIds.join("\n")&&(this.onboardingUnsyncedAnnotationIds=e)}catch(t){console.warn("Error in setOnboardingUnsyncedAnnotationIds: ",t)}},this.armAgentRunStatusWatchdog=t=>{try{this.clearAgentRunStatusWatchdog(),this.agentRunStatusWatchdogTimer=setTimeout((()=>this.applyAgentRunStatusTimeout()),t)}catch(t){console.warn("Error in armAgentRunStatusWatchdog: ",t),th("Error in armAgentRunStatusWatchdog: ",t)}},this.clearAgentRunStatusWatchdog=()=>{try{null!==this.agentRunStatusWatchdogTimer&&(clearTimeout(this.agentRunStatusWatchdogTimer),this.agentRunStatusWatchdogTimer=null)}catch(t){console.warn("Error in clearAgentRunStatusWatchdog: ",t),th("Error in clearAgentRunStatusWatchdog: ",t)}},this.applyAgentRunStatusTimeout=()=>{try{this.agentRunStatusWatchdogTimer=null,this.agentRunStatuses.some((t=>null==t?void 0:t.isRunning))&&(this.agentRunStatuses=this.agentRunStatuses.map((t=>(null==t?void 0:t.isRunning)?{...t,isRunning:!1,timedOut:!0}:t)),this.agentRunStatusTimedOut=!0),this.agentRunStatusSettled=!0}catch(t){console.warn("Error in applyAgentRunStatusTimeout: ",t),th("Error in applyAgentRunStatusTimeout: ",t)}},this.startOnboardingViewportListener=()=>{try{if(this.onboardingViewportListening)return;window.addEventListener("resize",this.scheduleOnboardingViewportClamp),this.onboardingViewportListening=!0}catch(t){console.warn("Error in startOnboardingViewportListener: ",t),th("Error in startOnboardingViewportListener: ",t)}},this.stopOnboardingViewportListener=()=>{var t;try{window.removeEventListener("resize",this.scheduleOnboardingViewportClamp),this.onboardingViewportListening=!1,null===(t=this.onboardingPanelResizeObserver)||void 0===t||t.disconnect(),this.onboardingPanelResizeObserver=null,this.onboardingObservedPanel=null,null!==this.onboardingClampFrame&&(cancelAnimationFrame(this.onboardingClampFrame),this.onboardingClampFrame=null)}catch(t){console.warn("Error in stopOnboardingViewportListener: ",t),th("Error in stopOnboardingViewportListener: ",t)}},this.observeOnboardingPanel=()=>{var t,e,i;try{if(!this.agentRunStatusListening||"undefined"==typeof ResizeObserver)return;const n=null!==(e=null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector(".onboarding-container content-warning-sidebar"))&&void 0!==e?e:null;if(n===this.onboardingObservedPanel)return;if(null===(i=this.onboardingPanelResizeObserver)||void 0===i||i.disconnect(),this.onboardingObservedPanel=n,!n)return;this.onboardingPanelResizeObserver||(this.onboardingPanelResizeObserver=new ResizeObserver((()=>this.scheduleOnboardingViewportClamp()))),this.onboardingPanelResizeObserver.observe(n)}catch(t){console.warn("Error in observeOnboardingPanel: ",t),th("Error in observeOnboardingPanel: ",t)}},this.scheduleOnboardingViewportClamp=()=>{try{if(!this.onboardingMode||null!==this.onboardingClampFrame)return;this.onboardingClampFrame=requestAnimationFrame((()=>{this.onboardingClampFrame=null,this.clampOnboardingPanelToViewport()}))}catch(t){console.warn("Error in scheduleOnboardingViewportClamp: ",t),th("Error in scheduleOnboardingViewportClamp: ",t)}},this.getOnboardingViewportClampOffset=(t,e,i)=>{let n=0,o=0;return t.right>e-8&&(n=e-8-t.right),t.left+n<8&&(n=8-t.left),t.bottom>i-8&&(o=i-8-t.bottom),t.top+o<8&&(o=8-t.top),{dx:n,dy:o}},this.readTranslate=t=>{var e;try{const i=window.getComputedStyle(t).transform;if(!i||"none"===i)return{x:0,y:0};const n=new(null!==(e=window.DOMMatrixReadOnly)&&void 0!==e?e:window.WebKitCSSMatrix)(i);return{x:Number(n.m41)||0,y:Number(n.m42)||0}}catch{return{x:0,y:0}}},this.clampOnboardingPanelToViewport=t=>{var e;try{const i=null!=t?t:null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector(".snippyly-plugin-container.onboarding-container");if(!i)return;const n=[i.getBoundingClientRect()],o=i.querySelector("content-warning-sidebar");o&&n.push(o.getBoundingClientRect());const r=n.filter((t=>t.width>0||t.height>0));if(0===r.length)return;const s={left:Math.min(...r.map((t=>t.left))),top:Math.min(...r.map((t=>t.top))),right:Math.max(...r.map((t=>t.right))),bottom:Math.max(...r.map((t=>t.bottom)))},{dx:a,dy:l}=this.getOnboardingViewportClampOffset(s,window.innerWidth,window.innerHeight);if(Math.abs(a)<.5&&Math.abs(l)<.5)return;const{x:c,y:d}=this.readTranslate(i);i.style.transform=`translate(${Math.round(c+a)}px, ${Math.round(d+l)}px)`}catch(t){console.warn("Error in clampOnboardingPanelToViewport: ",t),th("Error in clampOnboardingPanelToViewport: ",t)}},this.buildAgentWarnings=(t,e,i,n)=>{try{return t===Be.BROKEN_LINKS?this.buildBrokenLinkWarnings(e):t===Be.SPELL_CHECK||t===Be.GRAMMAR_CHECK?this.buildSpellCheckWarnings(e,i,n):this.buildGenericWarnings(e)}catch(t){return console.warn("Error in buildAgentWarnings: ",t),{warnings:[],warningCount:0}}},this.buildBrokenLinkWarnings=t=>{var e,i,n,o,r,s,a,l,c,d,h,u,p;try{const v=new Map;for(const g of t){const t=(null===(e=null==g?void 0:g.pageInfo)||void 0===e?void 0:e.url)||(null===(i=null==g?void 0:g.location)||void 0===i?void 0:i.url)||(null===(n=null==g?void 0:g.agent)||void 0===n?void 0:n.url)||"",f=(null===(o=null==g?void 0:g.agent)||void 0===o?void 0:o.reason)||{},m=f.url||(null===(r=null==g?void 0:g.targetTextRange)||void 0===r?void 0:r.text)||(null===(a=null===(s=null==g?void 0:g.agent)||void 0===s?void 0:s.result)||void 0===a?void 0:a.url)||(null===(c=null===(l=null==g?void 0:g.agent)||void 0===l?void 0:l.result)||void 0===c?void 0:c.link)||t,w=f.issue||f.description||(null===(h=null===(d=null==g?void 0:g.agent)||void 0===d?void 0:d.result)||void 0===h?void 0:h.statusCode)||(null===(p=null===(u=null==g?void 0:g.agent)||void 0===u?void 0:u.result)||void 0===p?void 0:p.status)||"",y=(null==m?void 0:m.toLowerCase())||"",b=fu(g)?yu(g):void 0;if(v.has(y)){const e=v.get(y);e.occurrences+=1,t&&!e.pageUrls.includes(t)&&e.pageUrls.push(t),e.annotations.push(g),b&&(e.severity=Lu(e.severity,b))}else v.set(y,{primaryText:m||"",secondaryText:String(w),occurrences:1,pageUrls:t?[t]:[],annotations:[g],...b?{severity:b}:{}})}const g=Array.from(v.values());return{warnings:g,warningCount:g.length}}catch(t){return console.warn("Error in buildBrokenLinkWarnings: ",t),{warnings:[],warningCount:0}}},this.buildSpellCheckWarnings=(t,e,i)=>{var n,o,r,s,a,l,c,d,h,u,p,v,g,f,m,w,y,b,C;try{const E=new Map;for(const x of t){const t=(null===(n=null==x?void 0:x.pageInfo)||void 0===n?void 0:n.url)||(null===(o=null==x?void 0:x.location)||void 0===o?void 0:o.url)||(null===(r=null==x?void 0:x.agent)||void 0===r?void 0:r.url)||"",k=(null===(s=null==x?void 0:x.pageInfo)||void 0===s?void 0:s.path)||(null===(a=null==x?void 0:x.location)||void 0===a?void 0:a.path)||(null===(l=null==x?void 0:x.agent)||void 0===l?void 0:l.path)||"",S=this.normalizePagePath(k),M=null!==(d=null!==(c=null==x?void 0:x.comments)&&void 0!==c?c:null==x?void 0:x.commentData)&&void 0!==d?d:[],A=null!==(p=null===(u=null===(h=null==M?void 0:M[0])||void 0===h?void 0:h.commentText)||void 0===u?void 0:u.trim())&&void 0!==p?p:"",T=(null===(g=null===(v=null==x?void 0:x.agent)||void 0===v?void 0:v.result)||void 0===g?void 0:g.incorrectWord)||(null===(f=null==x?void 0:x.targetElement)||void 0===f?void 0:f.targetText)||A||"",I=(null===(w=null===(m=null==x?void 0:x.agent)||void 0===m?void 0:m.result)||void 0===w?void 0:w.suggestions)||[],_=Array.isArray(I)?I[0]||"":I||"",$=null===(b=null===(y=null==x?void 0:x.agent)||void 0===y?void 0:y.result)||void 0===b?void 0:b.type,O=T||"";T||console.warn("[CWS] Spell check annotation missing incorrectWord. agent.result:",null===(C=null==x?void 0:x.agent)||void 0===C?void 0:C.result,"targetElement:",null==x?void 0:x.targetElement,"comments:",M);const N="grammar"===$?i:e;N.has(O)||N.set(O,new Map);const L=N.get(O),R=L.get(S)||0;L.set(S,R+1);const P=fu(x)?yu(x):void 0;if(E.has(O)){const e=E.get(O);e.occurrences+=1,t&&!e.pageUrls.includes(t)&&e.pageUrls.push(t),e.annotations.push(x),P&&(e.severity=Lu(e.severity,P))}else E.set(O,{primaryText:T||"",secondaryText:_||"",occurrences:1,pageUrls:t?[t]:[],annotations:[x],...P?{severity:P}:{}})}const x=Array.from(E.values());return{warnings:x,warningCount:x.length}}catch(t){return console.warn("Error in buildSpellCheckWarnings: ",t),{warnings:[],warningCount:0}}},this.splitFindingHeading=t=>{var e;try{if("string"!=typeof t||!t.trim())return null;const i=document.createElement("template");i.innerHTML=t;const n=Array.from(i.content.childNodes).filter((t=>{var e;return!(t.nodeType===Node.TEXT_NODE&&!(null===(e=t.textContent)||void 0===e?void 0:e.trim()))})),o=n[0];if(!o||!["B","STRONG"].includes(o.nodeName))return null;const r=(null===(e=o.textContent)||void 0===e?void 0:e.replace(/\s+/g," ").trim())||"";if(!r)return null;let s="";for(const t of n.slice(1))s+="BR"===t.nodeName?"\n":t.textContent||"";return{title:r,detail:s.split("\n").map((t=>t.replace(/\s+/g," ").trim())).find(Boolean)||""}}catch(t){return console.warn("Error in splitFindingHeading: ",t),null}},this.buildFindingSubItems=t=>{try{return(Array.isArray(null==t?void 0:t.missing)?t.missing:[]).map((t=>{const e="string"==typeof(null==t?void 0:t.text)?t.text.replace(/\s+/g," ").trim():"";if(!e)return null;const i="heading"===(null==t?void 0:t.kind)?"Section":"Link",n="string"==typeof(null==t?void 0:t.href)?t.href.trim().replace(/^https?:\/\//i,"").replace(/^www\./i,"").replace(/\/$/,""):"",o=n.length>40?`${n.slice(0,39)}…`:n;return{label:e,detail:o?`${i} · ${o}`:i}})).filter(Boolean)}catch(t){return console.warn("Error in buildFindingSubItems: ",t),[]}},this.buildGenericWarnings=t=>{var e,i,n,o,r,s,a,l,c,d,h,u,p,v,g,f,m,w,y,b,C,E,x,k;try{const S=new Map;for(const M of t){const t=(null===(e=null==M?void 0:M.pageInfo)||void 0===e?void 0:e.url)||(null===(i=null==M?void 0:M.location)||void 0===i?void 0:i.url)||(null===(n=null==M?void 0:M.agent)||void 0===n?void 0:n.url)||"",A=null!==(r=null!==(o=null==M?void 0:M.comments)&&void 0!==o?o:null==M?void 0:M.commentData)&&void 0!==r?r:[],T=null==A?void 0:A[0],I=null!==(p=null!==(d=null!==(a=null===(s=null==T?void 0:T.commentText)||void 0===s?void 0:s.trim())&&void 0!==a?a:null===(c=null===(l=null==M?void 0:M.agent)||void 0===l?void 0:l.result)||void 0===c?void 0:c.incorrectWord)&&void 0!==d?d:null===(u=null===(h=null==M?void 0:M.targetElement)||void 0===h?void 0:h.targetText)||void 0===u?void 0:u.trim())&&void 0!==p?p:"",_=null!==(b=null!==(m=null===(f=null===(g=null===(v=null==M?void 0:M.agent)||void 0===v?void 0:v.result)||void 0===g?void 0:g.suggestions)||void 0===f?void 0:f[0])&&void 0!==m?m:null===(y=null===(w=null==M?void 0:M.agent)||void 0===w?void 0:w.result)||void 0===y?void 0:y.suggestion)&&void 0!==b?b:"",$=null!==(k=null!==(E=null===(C=null==M?void 0:M.agent)||void 0===C?void 0:C.reason)&&void 0!==E?E:null===(x=null==T?void 0:T.agent)||void 0===x?void 0:x.reason)&&void 0!==k?k:{},O="string"==typeof(null==$?void 0:$.title)?$.title.trim():"",N="string"==typeof(null==$?void 0:$.description)?$.description.trim():"",L=O?null:this.splitFindingHeading(null==T?void 0:T.commentHtml),R=O||(null==L?void 0:L.title)||I,P=_||(O?N:null==L?void 0:L.detail)||"",D=this.resolveWarningSeverity(M,$),F=this.buildFindingSubItems($),V=I||(null==M?void 0:M.annotationId)||(null==M?void 0:M.id)||"";if(S.has(V)){const e=S.get(V);e.occurrences+=1,t&&!e.pageUrls.includes(t)&&e.pageUrls.push(t),e.annotations.push(M),e.severity=Lu(e.severity,D)}else S.set(V,{primaryText:R||"No text",secondaryText:P||"",occurrences:1,pageUrls:t?[t]:[],annotations:[M],...D?{severity:D}:{},...F.length>1?{subItems:F}:{}})}const M=Array.from(S.values());return{warnings:M,warningCount:M.length}}catch(t){return console.warn("Error in buildGenericWarnings: ",t),{warnings:[],warningCount:0}}},this.resolveWarningSeverity=(t,e)=>{try{return fu(t)?yu(t):(t=>{if("string"!=typeof t)return;const e=t.trim().toLowerCase();return Qh.includes(e)?e:void 0})(null==e?void 0:e.severity)}catch(t){return console.warn("Error in resolveWarningSeverity: ",t),void th("Error in resolveWarningSeverity: ",t)}},this.normalizePagePath=t=>{try{return t?(null==t?void 0:t.startsWith("/"))?t.substring(1):t:""}catch(e){return console.warn("Error in normalizePagePath: ",e),t||""}},this.setQueryParamsCommentsInSdk=()=>{var t,e,i,n,o;try{const r="true"===sessionStorage.getItem("debugQueryParamsComments");r&&console.log("setQueryParamsCommentsInSdk commentElement",this.commentElement),this.commentElement&&(r&&console.log("setQueryParamsCommentsInSdk queryParamsComments",this.queryParamsComments),this.queryParamsComments&&(null===(t=this.commentElement)||void 0===t?void 0:t.enableQueryParamsComments)?(r&&console.log("enableQueryParamsComments this.commentElement?.enableQueryParamsComments",null===(e=this.commentElement)||void 0===e?void 0:e.enableQueryParamsComments),null===(i=this.commentElement)||void 0===i||i.enableQueryParamsComments()):!this.queryParamsComments&&(null===(n=this.commentElement)||void 0===n?void 0:n.disableQueryParamsComments)&&(r&&console.log("disableQueryParamsComments"),null===(o=this.commentElement)||void 0===o||o.disableQueryParamsComments()))}catch(t){console.warn("Error in setQueryParamsCommentsInSdk: ",t),th("Error in setQueryParamsCommentsInSdk: ",t)}},this.checkGlobalUserContact=()=>{try{this.contactElement&&this.contactElement.isUserGlobalContact().subscribe((t=>{this.isUserGlobalContact=t}))}catch(t){console.warn("Error in checkGlobalUserContact: ",t),th("Error in checkGlobalUserContact: ",t)}},this.applyVeltFeatureGates=()=>{try{const t=(t=>{try{return(null==t?void 0:t.passwordGateActive)||(null==t?void 0:t.planLimitLocked)||(null==t?void 0:t.planExpired)||(null==t?void 0:t.projectDeleted)?[...xd]:[]}catch(t){return[]}})({passwordGateActive:this.passwordProtected&&!this.isPasswordValid,planLimitLocked:this.planLimitLocked,planExpired:!0===this.isPlanExpired,projectDeleted:this.projectDeleted});this.resolvedVeltFeatureGates=t,this.pushVeltFeatureGates(t)}catch(t){console.warn("Error in applyVeltFeatureGates: ",t),th("Error in applyVeltFeatureGates: ",t)}},this.pushVeltFeatureGates=t=>{const e=globalThis.Velt;e&&"function"==typeof e.disableFeatures&&e.disableFeatures(t)},this.replayVeltFeatureGates=()=>{try{this.pushVeltFeatureGates(this.resolvedVeltFeatureGates)}catch(t){console.warn("Error in replayVeltFeatureGates: ",t),th("Error in replayVeltFeatureGates: ",t)}},this.setProjectConfigVariables=t=>{var e,i,n,o;try{const r="Admin"===this.snippylyUserRole;this.allFeatureDisabled=!r&&(null!==(e=null==t?void 0:t.disabled)&&void 0!==e&&e),t&&"object"==typeof t?(this.firstConfigCommentsDisabled=null,this.commentsDisabledSetting="known"):("waiting"===this.commentsDisabledSetting&&(this.commentsDisabledSetting="unread"),this.applyFirstConfigCommentsDisabled()),this.allFeatureRestricted=null!==(i=null==t?void 0:t.restricted)&&void 0!==i&&i,this.guestMode=null!==(n=null==t?void 0:t.guestMode)&&void 0!==n&&n||this.isRunningUnderLivePreview(),this.allowGuestModeSignIn=!!(null===(o=null==t?void 0:t.guestModeConfig)||void 0===o?void 0:o.allowSignIn),(null==t?void 0:t.guestModeConfig)||(this.allowGuestModeSignIn=!0),this.guestMode&&eh(gt.Events.GUEST_MODE_PRESENT),this.passwordProtected=!1,this.queryParamsComments=!!(null==t?void 0:t.queryParamsComments),this.usePageTitleAsLocationName=!!(null==t?void 0:t.usePageTitleAsLocationName),function(t){try{return!!t&&"object"==typeof t&&"boolean"==typeof t.requestMode}catch(t){return console.warn("Error in hasRequestModeField: ",t),!1}}(t)&&(this.requestModeSwitch=Ud(t),this.syncRequestMode()),this.applyVeltFeatureGates(),pd(Ce,this.guestMode+"",!0),pd(Te,this.allowGuestModeSignIn+"",!0),pd(Ee,this.passwordProtected+"",!0),pd(xe,this.queryParamsComments+"",!0),pd(ke,this.usePageTitleAsLocationName+"",!0)}catch(t){console.warn("Error in setProjectConfigVariables: ",t),th("Error in setProjectConfigVariables: ",t)}},this.toggleSnippylyPluginToolbar=()=>{try{this.expanded=!this.expanded,this.expanded?eh(gt.Events.TOOLBAR_EXPANDED):eh(gt.Events.TOOLBAR_COLLAPSED)}catch(t){console.warn("Error in toggleSnippylyPluginToolbar: ",t),th("Error in toggleSnippylyPluginToolbar: ",t)}},this.enablePrivateCommentModeOnCommentElement=()=>{try{if(!this.commentElement||"function"!=typeof this.commentElement.enablePrivateMode)return;this.commentElement.enablePrivateMode({type:Ae})}catch(t){console.warn("Error in enablePrivateCommentModeOnCommentElement: ",t),th("Error in enablePrivateCommentModeOnCommentElement: ",t)}},this.disablePrivateCommentModeOnCommentElement=()=>{try{if(!this.commentElement||"function"!=typeof this.commentElement.disablePrivateMode)return;this.commentElement.disablePrivateMode()}catch(t){console.warn("Error in disablePrivateCommentModeOnCommentElement: ",t),th("Error in disablePrivateCommentModeOnCommentElement: ",t)}},this.enableVisibilityOptionsOnCommentElement=()=>{try{if(this.visibilityOptionsEnabled)return;if(!this.commentElement||"function"!=typeof this.commentElement.enableVisibilityOptions)return;this.commentElement.enableVisibilityOptions(),this.visibilityOptionsEnabled=!0,eh(gt.Events.VISIBILITY_OPTIONS_ENABLED)}catch(t){console.warn("Error in enableVisibilityOptionsOnCommentElement: ",t),th("Error in enableVisibilityOptionsOnCommentElement: ",t)}},this.disableVisibilityOptionsOnCommentElement=()=>{try{if(!this.visibilityOptionsEnabled)return;if(!this.commentElement||"function"!=typeof this.commentElement.disableVisibilityOptions)return void(this.visibilityOptionsEnabled=!1);this.commentElement.disableVisibilityOptions(),this.visibilityOptionsEnabled=!1,eh(gt.Events.VISIBILITY_OPTIONS_DISABLED)}catch(t){console.warn("Error in disableVisibilityOptionsOnCommentElement: ",t),th("Error in disableVisibilityOptionsOnCommentElement: ",t)}},this.maybeApplyVisibilityOptionsToCommentElement=()=>{"Admin"===this.snippylyUserRole&&this.canShowPrivateCommentToggle?this.enableVisibilityOptionsOnCommentElement():this.disableVisibilityOptionsOnCommentElement()},this.togglePrivateCommentMode=()=>{try{this.commentElement&&(this.privateCommentModeEnabled?(this.disablePrivateCommentModeOnCommentElement(),this.privateCommentModeEnabled=!1,eh(gt.Events.PRIVATE_MODE_DISABLED)):(this.enablePrivateCommentModeOnCommentElement(),this.privateCommentModeEnabled=!0,eh(gt.Events.PRIVATE_MODE_ENABLED)),pd(Me,this.privateCommentModeEnabled.toString()))}catch(t){console.warn("Error in togglePrivateCommentMode: ",t),th("Error in togglePrivateCommentMode: ",t)}},this.checkPrivateCommentModeFromStorage=()=>{try{!this.allFeatureDisabled&&"Admin"===this.snippylyUserRole&&this.canShowPrivateCommentToggle&&vd(Me)&&(this.privateCommentModeEnabled="true"===vd(Me),this.privateCommentModeEnabled&&this.enablePrivateCommentModeOnCommentElement())}catch(t){console.warn("Error in checkPrivateCommentModeFromStorage: ",t),th("Error in checkPrivateCommentModeFromStorage: ",t)}},this.loginWithGoogle=()=>{try{if(eh(gt.Events.SIGNIN_CLICKED),this.loading||this.customLoginEnabledLocally)return;const t=this.buildSignInUrlWithParams(this.signInUrl||""),e=this.signInWindowTarget();"_blank"===e?window.open(t,"_blank","noopener,noreferrer"):window.open(t,e)}catch(t){console.warn("Error in loginWithGoogle: ",t),th("Error in loginWithGoogle: ",t)}},this.signInWindowTarget=()=>{try{return this.isRunningUnderPreviewProxy()&&this.isInFrame()?"_blank":"_self"}catch(t){return console.warn("Error in signInWindowTarget: ",t),"_self"}},this.isInFrame=()=>{try{return window.top!==window.self}catch(t){return console.warn("Error in isInFrame: ",t),!0}},this.buildSignInUrlWithParams=t=>{try{const e=new URL(t);return this.apiKey&&e.searchParams.set("apiKey",this.apiKey),this.projectId&&e.searchParams.set("projectId",this.projectId),e.toString()}catch(e){return console.warn("Error in buildSignInUrlWithParams: ",e),th("Error in buildSignInUrlWithParams: ",e),t}},this.getQRCode=async()=>{if(!this.qrCodeLoading)try{this.qrCodeLoading=!0,this.qrCodeError=!1;const t=new URL(window.location.href);null==t||t.searchParams.set("review","true");const e=null==t?void 0:t.toString();if(!e)return void(this.qrCodeError=!0);const i=md(e,ci,di),n=await yh(i);"ok"===n.status?this.qrCode=n.qrcode:this.qrCodeError=!0}catch(t){this.qrCodeError=!0,console.warn("Error in getQRCode: ",t),th("Error in getQRCode: ",t)}finally{this.qrCodeLoading=!1}},this.retryQRCode=async()=>{try{this.qrCodeError=!1,await this.getQRCode()}catch(t){console.warn("Error in retryQRCode: ",t),th("Error in retryQRCode: ",t)}},this.toggleQRCodeVisibility=async()=>{try{if(eh(gt.Events.OPEN_MOBILE_CLICKED),this.showQrCode&&this.qrCodeLoading)return;this.showQrCode=!this.showQrCode,this.showQrCode&&!this.qrCode&&await this.getQRCode()}catch(t){console.warn("Error in toggleQRCodeVisibility: ",t),th("Error in toggleQRCodeVisibility: ",t)}},this.onUserInviteToolClick=()=>{var t;(null===(t=this.snippylyUser)||void 0===t?void 0:t.isGuest)?(this.guestModeSignInModalConfig.title="Sign in to invite others.",this.guestModeSignInModalConfig.description="Invite team members to comment on this project.",this.guestModeSignInModalConfig.showLeaveCommentButton=!1,this.guestModeSignInModalConfig.closeOnClickOutside=!0,this.openGuestModeSignInModal()):this.openInviteModal()},this.openInviteModal=()=>{this.showInviteModal=!0,eh(gt.Events.INVITE_MODAL_OPENED)},this.closeInviteModal=()=>{this.showInviteModal=!1},this.onInviteSuccess=()=>{this.closeInviteModal(),eh(gt.Events.INVITE_SENT)},this.removeSnippyly=async()=>{try{eh(gt.Events.EXIT_REVIEW_MODE_CLICKED),this.exitReviewModeCalled=!0,gd(Mt),gd(At),gd(ie),gd(he,"sessionStorage"),gd(ue,"sessionStorage");const t=new URL(document.location),e=t.searchParams;e.delete(ie),e.delete(Mt),e.delete(ne),e.delete(At),this.projectVersionKey&&e.delete(this.projectVersionKey),e.delete(pe),e.delete(ve),e.delete(ge),this.projectVersion=void 0,this.projectVersionKey=void 0,delete window.snippylyInitialLoadUrl,window.history.replaceState({},document.title,t.href),window.location.reload()}catch(t){console.warn("Error in removeSnippyly: ",t),th("Error in removeSnippyly: ",t)}},this.signOutUser=async()=>{try{eh(gt.Events.SIGNOUT_CLICKED),this.subscriptions.forEach((t=>{t&&t.unsubscribe&&(null==t||t.unsubscribe())})),this.contactListSubscription&&(this.contactListSubscription.unsubscribe(),this.contactListSubscription=null),this.teardownAgentsSidebarBusSubscriptions(),await Velt.signOutUser(),gd(oe),gd(se),$d(),gd(be),gd(Me),this.snippylyUser=void 0,window.open(this.signOutUrl,"_self")}catch(t){console.warn("Error in signOutUser: ",t),th("Error in signOutUser: ",t)}},this.toggleMenu=(t,e)=>{try{t.stopPropagation(),this.menuOpenedId===e?this.menuOpenedId=void 0:this.menuOpenedId=e}catch(t){console.warn("Error in toggleMenu: ",t),th("Error in toggleMenu: ",t)}},this.copyLink=()=>{try{navigator.clipboard.writeText(window.location.href),this.copyLinkTooltip="Link copied!",setTimeout((()=>{this.copyLinkTooltip="Copy Link"}),2e3)}catch(t){console.warn("Error in copyLink: ",t),th("Error in copyLink: ",t)}},this.adminPortalProjectUrl=()=>{try{return((t,e)=>{try{const i=t.endsWith("/")?t:`${t}/`,n="string"==typeof e?e.trim():"";if(!n)return i;const o=Md.exec(n);return o?`${i}prospects/${o[1]}`:`${i}project/${encodeURIComponent(n)}`}catch(e){return console.warn("Error in portalProjectUrl: ",e),t}})(ai,this._projectId)}catch(t){return console.warn("Error in adminPortalProjectUrl: ",t),`${ai}`}},this.portalInviteUrl=()=>{try{return this.isRunningUnderLivePreview()?this.adminPortalProjectUrl():null}catch(t){return console.warn("Error in portalInviteUrl: ",t),null}},this.portalInviteKind=()=>{try{return(t=>{try{return"string"==typeof t&&Md.test(t.trim())}catch(t){return console.warn("Error in isProspectLiveDocumentId: ",t),!1}})(this._projectId)?"prospect":"project"}catch(t){return console.warn("Error in portalInviteKind: ",t),"project"}},this.goToAdminPortal=()=>{try{const t=this.adminPortalProjectUrl();eh(gt.Events.VIEW_PROJECT_CLICKED),window.open(t,"_blank")}catch(t){console.warn("Error in goToAdminPortal: ",t),th("Error in goToAdminPortal: ",t)}},this.openBugReportModal=()=>{try{this.showBugReportModal=!0,eh(gt.Events.REPORT_BUG_CLICKED)}catch(t){console.warn("Error in openBugReportModal: ",t),th("Error in openBugReportModal: ",t)}},this.closeBugReportModal=()=>{try{this.showBugReportModal=!1}catch(t){console.warn("Error in closeBugReportModal: ",t),th("Error in closeBugReportModal: ",t)}},this.goToAdminPortalDashboard=()=>{try{let t=`${ai}`;Velt&&(null===Velt||void 0===Velt?void 0:Velt.getDocumentId)&&this.serverDocumentId&&(t=`${ai}/dashboard`),window.open(t,"_blank")}catch(t){console.warn("Error in goToAdminPortalDashboard: ",t),th("Error in goToAdminPortalDashboard: ",t)}},this.joinCommunity=()=>{try{window.open("https://join.slack.com/t/superflowusers/shared_invite/zt-1q3jzsddt-NEb~uu9RXscLfxOIDGQXJw","_blank")}catch(t){console.warn("Error in joinCommunity: ",t),th("Error in joinCommunity: ",t)}},this.onboardingNextClick=()=>{try{this.showOnboardingModal=!1,pd(ve,"true");const t=new URL(document.location);t.searchParams.delete(ve),window.history.replaceState({},document.title,t.href)}catch(t){console.warn("Error in onboardingNextClick: ",t),th("Error in onboardingNextClick: ",t)}},this.onLiveDemoModalNextClick=()=>{try{this.showLiveDemoModal=!1,pd(ge,"true",!1,"sessionStorage");const t=new URL(document.location);t.searchParams.delete(ge),window.history.replaceState({},document.title,t.href)}catch(t){console.warn("Error in onLiveDemoModalNextClick: ",t),th("Error in onLiveDemoModalNextClick: ",t)}},this.onFigmaDemoModalNextClick=()=>{try{this.showFigmaDemoModal=!1;const t=new URL(document.location);t.searchParams.delete(fe),window.history.replaceState({},document.title,t.href)}catch(t){console.warn("Error in onFigmaDemoModalNextClick: ",t),th("Error in onFigmaDemoModalNextClick: ",t)}},this.onUpgradePlanClick=()=>{try{window.open(li,"_blank")}catch(t){console.warn("Error in onUpgradePlanClick: ",t),th("Error in onUpgradePlanClick: ",t)}},this.onTourCommentTooltipClick=()=>{try{this.showTourCommentTooltip=!1,pd(ye,"true"),this.firstCommentNudge&&(this.firstCommentNudge=!1,this.autoCommentModeArmedOnce=!0)}catch(t){console.warn("Error in onTourCommentTooltipClick: ",t),th("Error in onTourCommentTooltipClick: ",t)}},this.onGuestModeChipSignInButtonClick=()=>{try{eh(gt.Events.GUEST_MODE_SIGN_IN_BUTTON_CLICKED),this.loginWithGoogle()}catch(t){console.warn("Error in onGuestModeChipSignInButtonClick: ",t),th("Error in onGuestModeChipSignInButtonClick: ",t)}},this.openGuestModeSignInModal=()=>{try{this.showGuestModeSignInModal=!0,eh(gt.Events.GUEST_MODE_SIGN_IN_DIALOG_SHOWN)}catch(t){console.warn("Error in openGuestModeSignInModal: ",t),th("Error in openGuestModeSignInModal: ",t)}},this.closeGuestModeSignInModal=()=>{try{this.showGuestModeSignInModal=!1,this.guestModeSignInModalConfig=JSON.parse(JSON.stringify(this.defaultGuestModeSignInModalConfig))}catch(t){console.warn("Error in closeGuestModeSignInModal: ",t),th("Error in closeGuestModeSignInModal: ",t)}},this.onGuestModeSignInModalSignInButtonClick=()=>{try{eh(gt.Events.GUEST_MODE_SIGN_IN_BUTTON_CLICKED),this.loginWithGoogle()}catch(t){console.warn("Error in onGuestModeSignInModalSignInButtonClick: ",t),th("Error in onGuestModeSignInModalSignInButtonClick: ",t)}},this.openGuestModeNameModel=t=>{try{t&&(t.stopPropagation(),t.preventDefault()),this.skipGuestNameModal||(this.showGuestModeNameModal=!0,eh(gt.Events.GUEST_MODE_NAME_NUDGE_SHOWN))}catch(t){console.warn("Error in openGuestModeNameModel: ",t),th("Error in openGuestModeNameModel: ",t)}},this.closeGuestModeNameModel=()=>{try{this.showGuestModeNameModal=!1}catch(t){console.warn("Error in closeGuestModeNameModel: ",t),th("Error in closeGuestModeNameModel: ",t)}},this.onGuestModeNameModalSkipButtonClick=()=>{try{eh(gt.Events.GUEST_MODE_SKIP_BUTTON_CLICKED),this.showGuestModeNameModal=!1}catch(t){console.warn("Error in onGuestModeNameModalSkipButtonClick: ",t),th("Error in onGuestModeNameModalSkipButtonClick: ",t)}},this.onPasswordProtectedModalCloseButtonClick=()=>{try{eh(gt.Events.PASSWORD_PROTECTED_MODAL_CLOSE_BUTTON_CLICKED),this.showPasswordProtectedModal=!1,this.password="",this.showInvalidPassword=!1}catch(t){console.warn("Error in onPasswordProtectedModalCloseButtonClick: ",t),th("Error in onPasswordProtectedModalCloseButtonClick: ",t)}},this.onPasswordProtectedModalOpenButtonClick=()=>{try{eh(gt.Events.PASSWORD_PROTECTED_MODAL_OPEN_BUTTON_CLICKED),this.showPasswordProtectedModal=!0}catch(t){console.warn("Error in onPasswordProtectedModalOpenButtonClick: ",t),th("Error in onPasswordProtectedModalOpenButtonClick: ",t)}},this.showGuestModeSignInBanner=()=>{try{this.guestModeSignInBannerVisible=!0,eh(gt.Events.GUEST_MODE_SIGN_IN_NUDGE_SHOWN)}catch(t){console.warn("Error in showGuestModeSignInBanner: ",t),th("Error in showGuestModeSignInBanner: ",t)}},this.hideGuestModeSignInBanner=()=>{try{this.guestModeSignInBannerVisible=!1}catch(t){console.warn("Error in hideGuestModeSignInBanner: ",t),th("Error in hideGuestModeSignInBanner: ",t)}},this.onGuestModeBannerSignInButtonClick=()=>{try{eh(gt.Events.GUEST_MODE_SIGN_IN_CLICKED),this.loginWithGoogle()}catch(t){console.warn("Error in onGuestModeBannerSignInButtonClick: ",t),th("Error in onGuestModeBannerSignInButtonClick: ",t)}},this.updateGuestUserName=async()=>{var t;try{if(!(null===(t=this.guestUserNameInput)||void 0===t?void 0:t.trim()))return;if(this.guestUserNameUpdateLoading)return;const e=Cd(!0,this.apiKey);if(e){const t=JSON.parse(JSON.stringify(e));e.name=this.guestUserNameInput,e.photoUrl=null,this.guestUserNameUpdateLoading=!0,(t=>{try{const e=JSON.stringify(t),i=md(e,ci,di);pd(ce,i,!0)}catch(t){console.warn("Error in updateGuestUser: ",t),th("Error in updateGuestUser: ",t)}})(e),await Velt.identify(e),this.snippylyUser=JSON.parse(JSON.stringify(e)),await hh(this.apiKey,this.projectId||"",t,e),this.showGuestModeNameModal=!1,this.guestUserNameUpdated=!0,this.guestUserNameUpdateLoading=!1,pd(_e,"true"),eh(gt.Events.GUEST_MODE_NAME_ADDED,{oldName:null==t?void 0:t.name,newName:null==e?void 0:e.name})}this.closeGuestModeNameModel()}catch(t){console.warn("Error in updateGuestUserName: ",t),th("Error in updateGuestUserName: ",t)}},this.submitPassword=async()=>{var t;try{if(eh(gt.Events.REVIEW_PASSWORD_ADDED),!(null===(t=this.password)||void 0===t?void 0:t.trim()))return;if(this.validatingPasswordLoading)return;this.validatingPasswordLoading=!0,this.isPasswordValid=await sh(this.apiKey,this.projectId,this.password),function(t,e){try{const i="object"==typeof e?JSON.stringify(e):e;localStorage.setItem(t,i)}catch(t){console.warn("Error in setLocalStorage: ",t)}}(Se,this.isPasswordValid),this.isPasswordValid?(this.password="",this.onPasswordProtectedModalCloseButtonClick(),this.showInvalidPassword=!1,this.applyVeltFeatureGates(),eh(gt.Events.REVIEW_PASSWORD_ACCEPTED)):(this.showInvalidPassword=!0,eh(gt.Events.REVIEW_PASSWORD_REJECTED)),this.validatingPasswordLoading=!1}catch(t){console.warn("Error in submitPassword: ",t),th("Error in submitPassword: ",t)}},this.updateUserName=async()=>{var t,e;try{if(!(null===(t=this.guestUserNameInput)||void 0===t?void 0:t.trim()))return;if(this.guestUserNameUpdateLoading)return;this.guestUserNameUpdateLoading=!0;const i=JSON.parse(JSON.stringify(this.snippylyUser)),n=JSON.parse(JSON.stringify(this.snippylyUser));n.name=this.guestUserNameInput;const o=this.readLiveSignIn(),r=o&&(null===(e=o.user)||void 0===e?void 0:e.userId)===(null==i?void 0:i.userId)?o.token:null,s=this.isLiveShareGuest()?r:this.credentialFor(i,this.identityCameFromToken),a=await hh(this.apiKey,this.projectId||"",i,n,!1,s);if(!1===(null==a?void 0:a.success))return console.warn("[CWS Toolbar] Name change refused; keeping the old name:",null==a?void 0:a.reason),this.guestUserNameUpdateLoading=!1,this.guestUserNameInput="",void this.closeGuestModeNameModel();await Velt.updateUser(n),this.snippylyUser=JSON.parse(JSON.stringify(n));const l=this.identityCameFromToken?yd():null;if(l){l.name=n.name;const t=JSON.stringify(l),e=md(t,ci,di);pd(se,e,!0)}n.isGuest&&(this.guestUserNameUpdated=!0,pd(_e,"true")),this.guestUserNameUpdateLoading=!1,this.guestUserNameInput="",this.closeGuestModeNameModel()}catch(t){console.warn("Error in updateUserName: ",t),th("Error in updateUserName: ",t)}},this.isAgentAnnotation=t=>{var e;try{const i=null!==this.extractAgentId((null===(e=null==t?void 0:t.agent)||void 0===e?void 0:e.agentFields)||[]),n=(null==t?void 0:t.type)===je,o=(null==t?void 0:t.commentType)===je;return i||n||o}catch(t){return console.warn("Error in isAgentAnnotation: ",t),!1}},this.getSidebarGroupExpansionMap=()=>{var t,e,i,n,o;try{const r=document.querySelector(ze.VELT_COMMENTS_SIDEBAR_LEGACY),s=null===(o=null===(n=null===(i=null===(e=null===(t=null==r?void 0:r._ngElementStrategy)||void 0===t?void 0:t.componentRef)||void 0===e?void 0:e.instance)||void 0===i?void 0:i.componentConfigSignal)||void 0===n?void 0:n.call(i))||void 0===o?void 0:o.virtualScrollData;if(!Array.isArray(s))return;const a=new Map;return s.forEach((t=>{var e,i;if("group"!==(null==t?void 0:t.type))return;const n=null===(e=null==t?void 0:t.data)||void 0===e?void 0:e.displayName,o=null===(i=null==t?void 0:t.data)||void 0===i?void 0:i.isExpanded;"string"==typeof n&&"boolean"==typeof o&&a.set(n,o)})),a}catch(t){return void console.warn("Error in getSidebarGroupExpansionMap: ",t)}},this.filterAgentCommentsFromSidebar=(t,e)=>{try{if(this.isSettingSidebarData)return;if(!t||!this.commentElement)return;const i=t.commentAnnotations;if(!Array.isArray(i))return;if(this.processAgentComments(this.mergeOnboardingFetchedAnnotations(i)),this.ensureOnboardingFindingsLoaded(),this.sidebarV2Enabled)return;if(this.showAgentCommentsInSidebar)return;const n=Array.isArray(null==t?void 0:t.systemFilteredAnnotations)?t.systemFilteredAnnotations:[],o=new Set(n.map((t=>(null==t?void 0:t.annotationId)||(null==t?void 0:t.id))).filter((t=>Boolean(t)))),r=[];i.forEach((t=>{if(this.isAgentAnnotation(t))return;const e=(null==t?void 0:t.annotationId)||(null==t?void 0:t.id);e&&o.has(e)&&r.push(t)}));const s=new Map;r.forEach((t=>{var e,i,n,o;const r=(null===(e=null==t?void 0:t.pageInfo)||void 0===e?void 0:e.path)||(null===(i=null==t?void 0:t.pageInfo)||void 0===i?void 0:i.url)||(null===(n=null==t?void 0:t.location)||void 0===n?void 0:n.path)||"/";s.has(r)||s.set(r,[]),null===(o=s.get(r))||void 0===o||o.push(t)}));const a=[],l=new URL(window.location.href).pathname,c="/"+this.normalizePagePath(l);s.forEach(((t,i)=>{const n=null==e?void 0:e.get(i);a.push({groupId:i,groupName:i,isExpanded:"boolean"==typeof n?n:i===c,annotations:t})})),this.isSettingSidebarData=!0,this.commentElement.setCommentSidebarData(a,{grouping:!0}),this.isSettingSidebarData=!1}catch(t){this.isSettingSidebarData=!1,console.warn("Error in filterAgentCommentsFromSidebar: ",t),th("Error in filterAgentCommentsFromSidebar: ",t)}},this.mountVeltCollaborationElements=()=>{if(!document.querySelector(ze.VELT_COMMENTS)){const t=document.createElement(ze.VELT_COMMENTS);t.setAttribute("filter-comments-on-dom","true"),t.setAttribute("shadow-dom","true"),null==t||t.addEventListener("onSignIn",(()=>{this.loginWithGoogle()})),null==t||t.addEventListener("onUpgrade",(()=>{this.onUpgradePlanClick()})),t.addEventListener("onCommentAdd",(()=>{this.addCommentCount++})),t.addEventListener("onCommentUpdate",(t=>{var e,i;(null===(e=this.snippylyUser)||void 0===e?void 0:e.isGuest)&&"newlyAdded"===(null===(i=null==t?void 0:t.detail)||void 0===i?void 0:i.type)&&(this.addCommentCount>=2&&(this.showModalOnceCommentIsModeIsOff=!0),this.addCommentCount>=5&&!this.showModalOnceCommentIsModeIsOff&&(this.showModalOnceCommentIsModeIsOff=!0))})),window.document.body.appendChild(t)}if(!document.querySelector(ze.VELT_CURSOR)){const t=document.createElement(ze.VELT_CURSOR);window.document.body.appendChild(t)}if(!document.querySelector(ze.VELT_HUDDLE)){const t=document.createElement(ze.VELT_HUDDLE);window.document.body.appendChild(t)}if(!document.querySelector(ze.VELT_RECORDER_NOTES)){const t=document.createElement(ze.VELT_RECORDER_NOTES);window.document.body.appendChild(t)}if(!document.querySelector(ze.VELT_RECORDER_CONTROL_PANEL)){const t=document.createElement(ze.VELT_RECORDER_CONTROL_PANEL);window.document.body.appendChild(t)}if(!document.querySelector(ze.VELT_ARROWS)){const t=document.createElement(ze.VELT_ARROWS);window.document.body.appendChild(t)}},this.unmountVeltCollaborationElements=()=>{try{document.querySelectorAll(Lv.COLLABORATION_TAGS.join(", ")).forEach((t=>t.remove()))}catch(t){console.warn("Error in unmountVeltCollaborationElements: ",t),th("Error in unmountVeltCollaborationElements: ",t)}},this.mountCommentSidebar=()=>{if(this.latchAgentsSidebarMode(),this.agentsSidebarMode)return this.mountScopedCommentSidebars(),void this.syncSidebarFocusedView();const t=this.sidebarV2Enabled,e=t?ze.VELT_COMMENTS_SIDEBAR_V2:ze.VELT_COMMENTS_SIDEBAR_LEGACY,i=t?ze.VELT_COMMENTS_SIDEBAR_LEGACY:ze.VELT_COMMENTS_SIDEBAR_V2;if(document.querySelectorAll(i).forEach((t=>t.remove())),document.querySelector(e))this.syncSidebarFocusedView();else{const i=document.createElement(e);i.setAttribute("shadow-dom","true"),i.setAttribute(t?He.URL_NAVIGATION:He.ENABLE_URL_NAVIGATION,"true"),i.setAttribute(He.CURRENT_LOCATION_SUFFIX,"true"),e===ze.VELT_COMMENTS_SIDEBAR_LEGACY?(i.setAttribute(He.SIDEBAR_BUTTON_COUNT_TYPE,qe),i.setAttribute(He.CUSTOM_ACTIONS,"true")):this.syncSidebarFocusedView(i),window.document.body.appendChild(i)}},this.mountScopedCommentSidebars=()=>{try{const t=ze.VELT_COMMENTS_SIDEBAR_V2;document.querySelectorAll(ze.VELT_COMMENTS_SIDEBAR_LEGACY).forEach((t=>t.remove()));const e=wp;if(!document.querySelector(`${t}:not([${e}])`)){const e=document.createElement(t);e.setAttribute("shadow-dom","true"),e.setAttribute(He.URL_NAVIGATION,"true"),e.setAttribute(He.CURRENT_LOCATION_SUFFIX,"true"),e.setAttribute(yp,JSON.stringify(Sp())),window.document.body.appendChild(e)}if(!document.querySelector(`${t}[${e}="${mp}"]`)){const i=document.createElement(t);i.setAttribute(e,mp),i.setAttribute("shadow-dom","true"),i.setAttribute(He.CURRENT_LOCATION_SUFFIX,"true"),i.setAttribute(Cp,"false"),i.setAttribute(yp,JSON.stringify(Ep(kp))),i.setAttribute(bp,JSON.stringify({enable:!0,groupBy:"checkInfo.ruleKey"})),this.syncSidebarFocusedView(i),window.document.body.appendChild(i)}}catch(t){console.warn("Error in mountScopedCommentSidebars: ",t),th("Error in mountScopedCommentSidebars: ",t)}},this.agentsSidebarBusSubscriptions=[],this.defaultSidebarOpen=!1,this.defaultSidebarConfigDriftReported=!1,this.keepSelectionOnAgentsSidebarClose=!1,this.lastAgentsSidebarClick=null,this.agentsSidebarBusElement=void 0,this.syncAgentsSidebarBusSubscriptions=()=>{try{const t=this.commentElement,e=this.agentsSidebarMode&&!!t&&"function"==typeof t.on;if(e&&this.agentsSidebarBusElement===t)return;if(this.teardownAgentsSidebarBusSubscriptions(),!e)return;this.agentsSidebarBusElement=t;const i=t.on(Op);i&&"function"==typeof i.subscribe&&this.agentsSidebarBusSubscriptions.push(i.subscribe(this.onAgentsSidebarCommentClick));const n=t.on(Np);n&&"function"==typeof n.subscribe&&this.agentsSidebarBusSubscriptions.push(n.subscribe(this.onAgentsSidebarCommentClick));const o=t.on(Rp);o&&"function"==typeof o.subscribe&&this.agentsSidebarBusSubscriptions.push(o.subscribe(this.onAgentsSidebarClose));const r=t.on(Lp);r&&"function"==typeof r.subscribe&&this.agentsSidebarBusSubscriptions.push(r.subscribe(this.onSidebarBusOpen));const s="function"==typeof t.getCommentSidebarConfig?t.getCommentSidebarConfig():null;s&&"function"==typeof s.subscribe?this.agentsSidebarBusSubscriptions.push(s.subscribe(this.onDefaultSidebarConfig)):this.reportDefaultSidebarConfigDrift("no getCommentSidebarConfig")}catch(t){console.warn("Error in syncAgentsSidebarBusSubscriptions: ",t),th("Error in syncAgentsSidebarBusSubscriptions: ",t)}},this.teardownAgentsSidebarBusSubscriptions=()=>{try{this.agentsSidebarBusSubscriptions.forEach((t=>{var e;return null===(e=null==t?void 0:t.unsubscribe)||void 0===e?void 0:e.call(t)})),this.agentsSidebarBusSubscriptions=[],this.agentsSidebarBusElement=void 0,this.defaultSidebarOpen=!1}catch(t){console.warn("Error in teardownAgentsSidebarBusSubscriptions: ",t)}},this.onAgentsSidebarCommentClick=t=>{try{if(!this.agentsSidebarMode)return;const e=function(t){try{const e=null==t?void 0:t.annotation;if(!e||!e.annotationId&&!e.id)return null;const i=null==t?void 0:t.sidebarId;return i===mp||null==i&&Tp(e)?e:null}catch(t){return console.warn("Error in readAgentsSidebarClickAnnotation: ",t),null}}(t);if(!e)return;const i=String(e.annotationId||e.id),n=Date.now(),o=this.lastAgentsSidebarClick;if(o&&o.annotationId===i&&n-o.at<1e3)return;this.lastAgentsSidebarClick={annotationId:i,at:n},this.onContentWarningItemClick({detail:{annotation:e,fromAgentsSidebar:!0}})}catch(t){console.warn("Error in onAgentsSidebarCommentClick: ",t),th("Error in onAgentsSidebarCommentClick: ",t)}},this.onAgentsSidebarClose=t=>{try{if(!this.agentsSidebarMode)return;if("default"===Dp(t)&&(this.defaultSidebarOpen=!1),!function(t){try{return(null==t?void 0:t.sidebarId)===mp}catch(t){return console.warn("Error in isAgentsSidebarCloseEvent: ",t),!1}}(t))return;this.showContentWarningSidebar&&(this.showContentWarningSidebar=!1)}catch(t){console.warn("Error in onAgentsSidebarClose: ",t)}},this.onDefaultSidebarConfig=t=>{try{if(!this.agentsSidebarMode)return;const e=function(t){try{let e=t;for(const t of Pp.VISIBLE_PATH){if(null===e||"object"!=typeof e)return null;e=e[t]}return"boolean"==typeof e?e:null}catch(t){return console.warn("Error in readSidebarConfigVisible: ",t),null}}(t);if(null===e)return void(null!==t&&"object"==typeof t&&this.reportDefaultSidebarConfigDrift("no uiState.sidebarVisible"));this.noteDefaultSidebarVisibility(e)}catch(t){console.warn("Error in onDefaultSidebarConfig: ",t),th("Error in onDefaultSidebarConfig: ",t)}},this.noteDefaultSidebarVisibility=t=>{try{if(t===this.defaultSidebarOpen)return;this.defaultSidebarOpen=t,t&&this.showContentWarningSidebar&&(this.keepSelectionOnAgentsSidebarClose=!0,this.showContentWarningSidebar=!1)}catch(t){console.warn("Error in noteDefaultSidebarVisibility: ",t),th("Error in noteDefaultSidebarVisibility: ",t)}},this.reportDefaultSidebarConfigDrift=t=>{try{if(this.defaultSidebarConfigDriftReported)return;this.defaultSidebarConfigDriftReported=!0;const e=`[CWS Toolbar] The comments sidebar's open is not visible to the toolbar (${t}; expected ${Pp.VISIBLE_PATH.join(".")} in getCommentSidebarConfig()): the Agents sidebar will not close when it opens.`;console.warn(e),th("Default sidebar config drift: ",new Error(e))}catch(t){console.warn("Error in reportDefaultSidebarConfigDrift: ",t)}},this.onSidebarBusOpen=t=>{try{if(!this.agentsSidebarMode)return;const e=Dp(t);if("default"===e)return void this.noteDefaultSidebarVisibility(!0);"agents"===e&&this.defaultSidebarOpen&&queueMicrotask(this.closeDefaultSidebarUnderAgentsSidebar)}catch(t){console.warn("Error in onSidebarBusOpen: ",t),th("Error in onSidebarBusOpen: ",t)}},this.closeDefaultSidebarUnderAgentsSidebar=()=>{var t,e;try{if(!this.agentsSidebarMode||!this.defaultSidebarOpen)return;null===(e=null===(t=this.commentElement)||void 0===t?void 0:t.closeCommentSidebar)||void 0===e||e.call(t),this.restoreCommentSidebarFocus()}catch(t){console.warn("Error in closeDefaultSidebarUnderAgentsSidebar: ",t),th("Error in closeDefaultSidebarUnderAgentsSidebar: ",t)}},this.readSelectedCommentIds=()=>{var t,e;try{const i="function"==typeof(null===(t=this.commentElement)||void 0===t?void 0:t.getSelectedComments)?this.commentElement.getSelectedComments():null;if(!i||"function"!=typeof i.subscribe)return[];let n=[];const o=i.subscribe((t=>{n=(Array.isArray(t)?t:[]).map(ou).filter((t=>""!==t))}));return null===(e=null==o?void 0:o.unsubscribe)||void 0===e||e.call(o),n}catch(t){return console.warn("Error in readSelectedCommentIds: ",t),th("Error in readSelectedCommentIds: ",t),[]}},this.agentsSidebarOpenApplied=!1,this.syncAgentsSidebarOpenState=()=>{var t,e,i,n,o,r;const s=this.keepSelectionOnAgentsSidebarClose;this.keepSelectionOnAgentsSidebarClose=!1;try{if(!this.agentsSidebarMode)return;const a=this.commentElement;if(!a)return;const l=this.showContentWarningSidebar&&this.canShowContentWarningSidebar(),c=l?this.getAgentsSidebarDeepLinkFocusId():null;if(l===this.agentsSidebarOpenApplied&&!c)return;if(this.agentsSidebarOpenApplied=l,l){null===(t=a.closeCommentSidebar)||void 0===t||t.call(a),this.restoreCommentSidebarFocus(),null===(e=a.disableSidebarUrlNavigation)||void 0===e||e.call(a);const n=c;c&&(this.agentsSidebarDeepLinkId=null),null===(i=a.openCommentSidebar)||void 0===i||i.call(a,n?{sidebarId:mp,annotationId:n}:{sidebarId:mp})}else{const t=s?this.readSelectedCommentIds():[];null===(n=a.closeCommentSidebar)||void 0===n||n.call(a,{sidebarId:mp}),null===(o=a.enableSidebarUrlNavigation)||void 0===o||o.call(a),this.agentsSidebarDeepLinkId=null,t.length>0&&0===this.readSelectedCommentIds().length&&(null===(r=a.selectCommentByAnnotationId)||void 0===r||r.call(a,t[0]))}}catch(t){console.warn("Error in syncAgentsSidebarOpenState: ",t),th("Error in syncAgentsSidebarOpenState: ",t)}},this.onCommentsSidebarButtonClick=()=>{try{if(!this.agentsSidebarMode||!this.showContentWarningSidebar)return;this.showContentWarningSidebar=!1}catch(t){console.warn("Error in onCommentsSidebarButtonClick: ",t)}},this.getAgentsSidebarDeepLinkFocusId=()=>{var t,e;try{const i=this.agentsSidebarDeepLinkId;if(!i)return null;const n=[...(null!==(t=this.agentGroups)&&void 0!==t?t:[]).flatMap((t=>{var e;return null!==(e=null==t?void 0:t.annotations)&&void 0!==e?e:[]})),...null!==(e=this.lastStreamAnnotations)&&void 0!==e?e:[]];return n.some((t=>ou(t)===i&&Tp(t)))?i:null}catch(t){return console.warn("Error in getAgentsSidebarDeepLinkFocusId: ",t),null}},this.maybeOpenAgentsSidebarForDeepLink=()=>{try{if(!this.agentsSidebarMode||!this.canShowContentWarningSidebar())return;if(!this.getAgentsSidebarDeepLinkFocusId())return;if(this.showContentWarningSidebar)return void this.syncAgentsSidebarOpenState();this.showContentWarningSidebar=!0}catch(t){console.warn("Error in maybeOpenAgentsSidebarForDeepLink: ",t),th("Error in maybeOpenAgentsSidebarForDeepLink: ",t)}},this.collectCommentCopies=(t,e)=>{var i,n;try{if(!t)return[];const o=e=>((null==e?void 0:e.annotationId)||(null==e?void 0:e.id))===t,r=[e,this.resolveFullAnnotation({annotationId:t}),...null!==(i=this.lastStreamAnnotations)&&void 0!==i?i:[],...(null!==(n=this.agentGroups)&&void 0!==n?n:[]).flatMap((t=>{var e;return null!==(e=null==t?void 0:t.annotations)&&void 0!==e?e:[]}))].filter((t=>t&&"object"==typeof t&&o(t)));return Array.from(new Set(r))}catch(t){return console.warn("Error in collectCommentCopies: ",t),th("Error in collectCommentCopies: ",t),e?[e]:[]}},this.hasResolvingOnPageAnchor=(t,e)=>{try{const i=Gp(document);return this.collectCommentCopies(t,e).some((t=>Qp(t,i)))}catch(t){return console.warn("Error in hasResolvingOnPageAnchor: ",t),th("Error in hasResolvingOnPageAnchor: ",t),!1}},this.resolveAnchorlessCommentFocus=(t,e)=>{try{return tv({copies:this.collectCommentCopies(t,e),sidebarV2:this.sidebarV2Enabled,agentsSidebarMode:this.agentsSidebarMode,onboardingMode:this.onboardingMode,anchorResolver:Gp(document)})}catch(t){return console.warn("Error in resolveAnchorlessCommentFocus: ",t),th("Error in resolveAnchorlessCommentFocus: ",t),null}},this.openAgentAnnotationHere=(t,e=!1,i="other",n)=>{try{const o=(null==t?void 0:t.annotationId)||(null==t?void 0:t.id);if(!o)return null;let r=!1;if(!e){const e=this.resolveAnchorlessCommentFocus(String(o),t);if(e&&this.openCommentSidebarFocus(e))return{outcome:"opened",sidebarRefused:!1};if(r=null!==e,this.agentStatusMode){"show"===i&&this.hasResolvingOnPageAnchor(String(o),t)&&this.adoptRequestedAgentPinVisibility();return{outcome:this.openAgentPin(String(o),i,n)?"pin-opened":"waiting-pin",sidebarRefused:r}}}return this.selectAnnotationOnPage(o),{outcome:"selected",sidebarRefused:r}}catch(t){return console.warn("Error in openAgentAnnotationHere: ",t),th("Error in openAgentAnnotationHere: ",t),null}},this.openAgentPin=(t,e="other",i)=>{try{return this.pendingAgentPin=null,t?(this.openAgentPinDialog(t),Mv(t).length>0||(this.pendingAgentPin=i?{annotationId:t,pagePath:this.getCurrentPagePath(),source:e,show:i}:{annotationId:t,pagePath:this.getCurrentPagePath(),source:e},!1)):!1}catch(t){return console.warn("Error in openAgentPin: ",t),th("Error in openAgentPin: ",t),!1}},this.openPendingAgentPin=t=>{try{const e=this.pendingAgentPin;if(!e||0===t.length)return;if(!t.some((t=>Av(t)===e.annotationId)))return;if(this.pendingAgentPin=null,!Zp(e.pagePath,this.getCurrentPagePath()))return;this.openAgentPinDialog(e.annotationId),this.recordAgentPinRequestOutcome(e,"pin-opened","pin-opened")}catch(t){this.pendingAgentPin=null,console.warn("Error in openPendingAgentPin: ",t),th("Error in openPendingAgentPin: ",t)}},this.openAgentPinDialog=t=>{try{if(this.releaseAgentPinDialogHold("replaced"),!t)return;this.selectAnnotationOnPage(t),this.holdAgentPinDialog(t)}catch(t){console.warn("Error in openAgentPinDialog: ",t),th("Error in openAgentPinDialog: ",t)}},this.holdAgentPinDialog=t=>{var e,i;try{const n={annotationId:t,selected:!1,reselects:0,ended:null,at:Date.now()};this.lastAgentPinDialog=n;const o="function"==typeof(null===(e=this.commentElement)||void 0===e?void 0:e.getSelectedComments)?this.commentElement.getSelectedComments():null;if(!o||"function"!=typeof o.subscribe)return void(n.ended="unsupported");const r={annotationId:t,pagePath:this.getCurrentPagePath(),until:Date.now()+Qt,seen:!1,reselects:0,subscription:null,expiryTimer:null,reselectTimer:null,record:n};this.agentPinDialogHold=r,window.addEventListener("pointerdown",this.onAgentPinDialogViewerInput,!0),window.addEventListener("keydown",this.onAgentPinDialogViewerInput,!0),r.expiryTimer=setTimeout((()=>{this.agentPinDialogHold===r&&this.releaseAgentPinDialogHold("expired")}),Qt);const s=o.subscribe((t=>this.onAgentPinDialogSelection(r,t)));this.agentPinDialogHold===r?r.subscription=s:null===(i=null==s?void 0:s.unsubscribe)||void 0===i||i.call(s)}catch(t){this.releaseAgentPinDialogHold("error"),console.warn("Error in holdAgentPinDialog: ",t),th("Error in holdAgentPinDialog: ",t)}},this.onAgentPinDialogSelection=(t,e)=>{try{if(this.agentPinDialogHold!==t)return;const i=(Array.isArray(e)?e:[]).map(ou).filter((t=>""!==t));if(i.includes(t.annotationId))return t.seen=!0,t.record.selected=!0,void(null!==t.reselectTimer&&(clearTimeout(t.reselectTimer),t.reselectTimer=null));if(i.length>0)return void this.releaseAgentPinDialogHold("other-selected");if(!t.seen||null!==t.reselectTimer)return;if(Date.now()>=t.until)return void this.releaseAgentPinDialogHold("expired");if(t.reselects>=3)return void this.releaseAgentPinDialogHold("limit");t.reselectTimer=setTimeout((()=>{var e,i;try{if(t.reselectTimer=null,this.agentPinDialogHold!==t)return;t.reselects+=1,t.record.reselects=t.reselects,null===(i=null===(e=this.commentElement)||void 0===e?void 0:e.selectCommentByAnnotationId)||void 0===i||i.call(e,t.annotationId)}catch(t){console.warn("Error in onAgentPinDialogSelection (reselect): ",t),th("Error in onAgentPinDialogSelection (reselect): ",t)}}),0)}catch(t){console.warn("Error in onAgentPinDialogSelection: ",t),th("Error in onAgentPinDialogSelection: ",t)}},this.onAgentPinDialogViewerInput=t=>{try{if(!1===(null==t?void 0:t.isTrusted))return;this.releaseAgentPinDialogHold("viewer")}catch(t){console.warn("Error in onAgentPinDialogViewerInput: ",t)}},this.releaseAgentPinDialogHold=t=>{var e,i;const n=this.agentPinDialogHold;if(n){this.agentPinDialogHold=null;try{null!==n.expiryTimer&&clearTimeout(n.expiryTimer),null!==n.reselectTimer&&clearTimeout(n.reselectTimer),null===(i=null===(e=n.subscription)||void 0===e?void 0:e.unsubscribe)||void 0===i||i.call(e),window.removeEventListener("pointerdown",this.onAgentPinDialogViewerInput,!0),window.removeEventListener("keydown",this.onAgentPinDialogViewerInput,!0),n.record.ended=t}catch(t){console.warn("Error in releaseAgentPinDialogHold: ",t),th("Error in releaseAgentPinDialogHold: ",t)}}},this.openCommentSidebarFocus=t=>{try{return!!(null==t?void 0:t.annotationId)&&(this.releaseAgentPinDialogHold("replaced"),t.sidebarId===mp?this.focusAgentsSidebarOn(t.annotationId):this.focusDefaultCommentSidebarOn(t.annotationId))}catch(t){return console.warn("Error in openCommentSidebarFocus: ",t),th("Error in openCommentSidebarFocus: ",t),!1}},this.focusAgentsSidebarOn=t=>{var e;try{if(!this.agentsSidebarMode||!this.canShowContentWarningSidebar()||"function"!=typeof(null===(e=this.commentElement)||void 0===e?void 0:e.openCommentSidebar))return!1;const i=this.agentsSidebarDeepLinkId;return this.agentsSidebarDeepLinkId=t,this.getAgentsSidebarDeepLinkFocusId()!==t?(this.agentsSidebarDeepLinkId=i,!1):(this.showContentWarningSidebar?this.syncAgentsSidebarOpenState():this.showContentWarningSidebar=!0,!0)}catch(t){return console.warn("Error in focusAgentsSidebarOn: ",t),th("Error in focusAgentsSidebarOn: ",t),!1}},this.focusDefaultCommentSidebarOn=t=>{try{const e=this.commentElement;if(!t||"function"!=typeof(null==e?void 0:e.openCommentSidebar))return!1;if(!this.canShowContentWarningSidebar())return!1;const i=this.showContentWarningSidebar,n=i||!this.showAgentCommentsInSidebar;if(!this.recordCommentSidebarFocus(n))return!1;this.setCommentSidebarVisibility(!0);try{e.openCommentSidebar({annotationId:t})}catch(t){throw this.restoreCommentSidebarFocus(),t}return i&&(this.keepAgentCommentsShownOnPanelClose=!0,this.showContentWarningSidebar=!1),!0}catch(t){return console.warn("Error in focusDefaultCommentSidebarOn: ",t),th("Error in focusDefaultCommentSidebarOn: ",t),!1}},this.findSidebarV2Element=t=>{try{const e=ze.VELT_COMMENTS_SIDEBAR_V2,i=wp;return document.querySelector(t?`${e}[${i}="${t}"]`:`${e}:not([${i}])`)}catch(t){return console.warn("Error in findSidebarV2Element: ",t),null}},this.syncSidebarFocusedView=t=>{try{const e=(t=>{try{return!0!==(null==t?void 0:t.agentStatusMode)||!0===t.onboardingMode||!0!==t.sidebarV2?null:!0===t.agentsSidebarMode?"agents":"default"}catch(t){return console.warn("Error in resolveFocusedViewSidebar: ",t),null}})({agentStatusMode:this.agentStatusMode,onboardingMode:this.onboardingMode,agentsSidebarMode:this.agentsSidebarMode,sidebarV2:this.sidebarV2Enabled}),i="agents"===e?mp:null,n=(null==t?void 0:t.getAttribute(wp))||null,o=null===e?null:t&&n===i?t:this.findSidebarV2Element(i),r=this.focusedViewSidebarElement;r&&r!==o&&ev.forEach((t=>r.removeAttribute(t))),o&&ev.forEach((t=>{"true"!==o.getAttribute(t)&&o.setAttribute(t,"true")})),this.focusedViewSidebarElement=o}catch(t){console.warn("Error in syncSidebarFocusedView: ",t),th("Error in syncSidebarFocusedView: ",t)}},this.recordCommentSidebarFocus=(t=!1)=>{var e;try{const i=!0===(null===(e=this.commentSidebarFocus)||void 0===e?void 0:e.hideAgentCommentsOnRestore);this.restoreCommentSidebarFocus({keepAgentComments:!0});const n=this.commentElement,o="function"==typeof(null==n?void 0:n.on)?n.on(Rp):null;if(!o||"function"!=typeof o.subscribe)return!1;const r={hideAgentCommentsOnRestore:t||i,subscription:null};let s=!0;return r.subscription=o.subscribe((t=>{try{const e="string"==typeof(null==t?void 0:t.sidebarId)&&""!==t.sidebarId;if(s||e||this.commentSidebarFocus!==r)return;this.restoreCommentSidebarFocus()}catch(t){console.warn("Error in recordCommentSidebarFocus (close): ",t),th("Error in recordCommentSidebarFocus (close): ",t)}})),s=!1,this.commentSidebarFocus=r,!0}catch(t){return console.warn("Error in recordCommentSidebarFocus: ",t),th("Error in recordCommentSidebarFocus: ",t),!1}},this.restoreCommentSidebarFocus=(t={})=>{var e,i;try{const n=this.commentSidebarFocus;if(!n)return;if(this.commentSidebarFocus=null,null===(i=null===(e=n.subscription)||void 0===e?void 0:e.unsubscribe)||void 0===i||i.call(e),n.hideAgentCommentsOnRestore&&!(null==t?void 0:t.keepAgentComments)&&!this.showContentWarningSidebar){const t=this.getRestingAgentCommentsVisibility();t||(this.keepAgentCommentsShownOnPanelClose=!1),this.setCommentSidebarVisibility(t)}}catch(t){this.commentSidebarFocus=null,console.warn("Error in restoreCommentSidebarFocus: ",t),th("Error in restoreCommentSidebarFocus: ",t)}},this.armCommentDeepLink=t=>{try{if(!t||this.armedCommentDeepLinkIds.has(t))return;this.armedCommentDeepLinkIds.add(t),this.pendingCommentDeepLink={annotationId:t,pagePath:this.getCurrentPagePath()},this.recordCommentDeepLinkDecision(t,"waiting-comment")}catch(t){console.warn("Error in armCommentDeepLink: ",t),th("Error in armCommentDeepLink: ",t)}},this.applyPendingCommentDeepLink=()=>{try{const t=this.pendingCommentDeepLink;if(!t)return;const{annotationId:e}=t;if(!Zp(t.pagePath,this.getCurrentPagePath()))return void this.dropPendingCommentDeepLink("page-changed");if(null===this.agentsSidebarModeLatched)return void this.recordCommentDeepLinkDecision(e,"waiting-mode");if(!this.canShowContentWarningSidebar())return void this.recordCommentDeepLinkDecision(e,"waiting-viewer");if(!this.isPortalShowAnnotationReady(e))return void this.recordCommentDeepLinkDecision(e,"waiting-comment");if(!this.collectCommentCopies(e).some((t=>this.isAgentAnnotation(t)||"agent"===(null==t?void 0:t.sourceType))))return void this.dropPendingCommentDeepLink("not-agent");if(!this.opensAgentAnnotationHere(this.findLoadedAgentAnnotation(e)))return void this.dropPendingCommentDeepLink("other-page");if(!this.sidebarV2Enabled||this.onboardingMode)return void this.dropPendingCommentDeepLink("no-sidebar");if(this.isDocumentStillParsing())return this.recordCommentDeepLinkDecision(e,"waiting-dom"),void this.waitForDocumentParsed();const i=this.resolveAnchorlessCommentFocus(e);if(!i){if(this.dropPendingCommentDeepLink("anchored"),this.agentStatusMode){this.hasResolvingOnPageAnchor(e)&&this.adoptRequestedAgentPinVisibility();const t=this.openAgentPin(e,"deep-link");this.recordCommentDeepLinkDecision(e,t?"pin-opened":"waiting-pin")}return}if(i.sidebarId===mp&&!this.agentStatusMode)return void this.dropPendingCommentDeepLink("agents-sidebar");this.dropPendingCommentDeepLink("opened"),this.openCommentSidebarFocus(i)||this.recordCommentDeepLinkDecision(e,"open-failed")}catch(t){this.dropPendingCommentDeepLink("error"),console.warn("Error in applyPendingCommentDeepLink: ",t),th("Error in applyPendingCommentDeepLink: ",t)}},this.setCommentSidebarVisibility=t=>{var e,i,n,o,r,s,a,l;try{if(t===this.showAgentCommentsInSidebar)return;if(this.sidebarV2Enabled)return t?null===(i=null===(e=this.commentElement)||void 0===e?void 0:e.disableFilterCommentsOnDom)||void 0===i||i.call(e):null===(o=null===(n=this.commentElement)||void 0===n?void 0:n.enableFilterCommentsOnDom)||void 0===o||o.call(n),void(this.showAgentCommentsInSidebar=t);const c=document.querySelector(ze.VELT_COMMENTS_SIDEBAR_LEGACY);if(!c)return;t?(c.removeAttribute(He.SIDEBAR_BUTTON_COUNT_TYPE),c.removeAttribute(He.CUSTOM_ACTIONS),null===(s=null===(r=this.commentElement)||void 0===r?void 0:r.disableFilterCommentsOnDom)||void 0===s||s.call(r)):(c.setAttribute(He.SIDEBAR_BUTTON_COUNT_TYPE,qe),c.setAttribute(He.CUSTOM_ACTIONS,"true"),null===(l=null===(a=this.commentElement)||void 0===a?void 0:a.enableFilterCommentsOnDom)||void 0===l||l.call(a)),this.showAgentCommentsInSidebar=t}catch(t){console.warn("Error in setCommentSidebarVisibility: ",t),th("Error in setCommentSidebarVisibility: ",t)}},this.toggleCommentSidebarVisibility=()=>{try{const t=!this.showAgentCommentsInSidebar;this.agentCommentsChoice=t,this.setCommentSidebarVisibility(t),this.menuOpenedId=void 0}catch(t){console.warn("Error in toggleCommentSidebarVisibility: ",t),th("Error in toggleCommentSidebarVisibility: ",t)}},this.getRestingAgentCommentsVisibility=()=>{var t;try{return null!==(t=this.agentCommentsChoice)&&void 0!==t?t:this.agentCommentsModeRequested}catch(t){return console.warn("Error in getRestingAgentCommentsVisibility: ",t),th("Error in getRestingAgentCommentsVisibility: ",t),this.agentCommentsModeRequested}},this.adoptRequestedAgentPinVisibility=()=>{try{if(!this.canShowContentWarningSidebar())return;this.getRestingAgentCommentsVisibility()||(this.agentCommentsChoice=!0),this.setCommentSidebarVisibility(!0)}catch(t){console.warn("Error in adoptRequestedAgentPinVisibility: ",t),th("Error in adoptRequestedAgentPinVisibility: ",t)}},this.applyPageCommentsVisibility=()=>{try{const t=this.commentElement;if(!t)return;this.pageCommentsHidden?"function"==typeof t.hideCommentsOnDom&&t.hideCommentsOnDom():"function"==typeof t.showCommentsOnDom&&t.showCommentsOnDom()}catch(t){console.warn("Error in applyPageCommentsVisibility: ",t),th("Error in applyPageCommentsVisibility: ",t)}},this.togglePageCommentsVisibility=()=>{try{this.pageCommentsHidden=!this.pageCommentsHidden,this.pageCommentsHidden?pd(ee,"true",!1,"sessionStorage"):gd(ee,"sessionStorage"),this.applyPageCommentsVisibility(),this.menuOpenedId=void 0}catch(t){console.warn("Error in togglePageCommentsVisibility: ",t),th("Error in togglePageCommentsVisibility: ",t)}},this.unhidePageCommentsIfHidden=()=>{try{if(!this.pageCommentsHidden)return;this.pageCommentsHidden=!1,gd(ee,"sessionStorage"),this.applyPageCommentsVisibility()}catch(t){console.warn("Error in unhidePageCommentsIfHidden: ",t)}},this.toggleSidebarV2=()=>{try{pd(Et,this.sidebarV2Enabled?"false":"true",!1,"sessionStorage"),window.location.reload()}catch(t){console.warn("Error in toggleSidebarV2: ",t),th("Error in toggleSidebarV2: ",t)}},this.toggleVeltProxy=()=>{try{if(!this.veltProxyToggleVisible)return;t=!this.veltProxyEnabled,pd(xt,t?"true":"false"),window.location.reload()}catch(t){console.warn("Error in toggleVeltProxy: ",t),th("Error in toggleVeltProxy: ",t)}var t},this.isScreenshotDisabledHost=()=>{try{return Ve.includes(window.location.hostname)}catch{return!1}},this.getScreenshotMode=()=>{var t,e,i;return"local"===(null===(i=null===(e=null===(t=this.customerMetadata)||void 0===t?void 0:t.superflow)||void 0===e?void 0:e.advancedFeatures)||void 0===i?void 0:i.screenshotMode)?"local":"basic"},this.logCaptureTrigger=(...t)=>{Vu()&&"undefined"!=typeof console&&console.warn("[sf-capture][trigger]",...t)},this.ensureAddCommentAnnotationSubscription=()=>{var t,e,i;this.commentElement&&"function"==typeof this.commentElement.on?this.addCommentAnnotationSubscription&&this.addCommentAnnotationSubscribedEl===this.commentElement?this.logCaptureTrigger("addCommentAnnotation subscription already attached"):(this.addCommentAnnotationSubscription&&(null===(i=(e=this.addCommentAnnotationSubscription).unsubscribe)||void 0===i||i.call(e),this.addCommentAnnotationSubscription=void 0,this.logCaptureTrigger("addCommentAnnotation re-subscribing: comment element changed")),this.addCommentAnnotationSubscription=this.commentElement.on("addCommentAnnotation").subscribe((t=>(this.onRequestModeAnnotationSaved(t),this.onAddCommentAnnotation(t)))),this.addCommentAnnotationSubscribedEl=this.commentElement,this.logCaptureTrigger("addCommentAnnotation subscription attached")):this.logCaptureTrigger("addCommentAnnotation subscription NOT attached: commentElement.on unavailable",{hasCommentElement:!!this.commentElement,hasOn:"function"==typeof(null===(t=this.commentElement)||void 0===t?void 0:t.on)})},this.applyScreenshotSetting=()=>{var t,e,i,n,o,r,s,a,l,c,d,h,u;if(this.commentElement)return this.isScreenshotDisabledHost()?(null===(e=(t=this.commentElement).disableScreenshot)||void 0===e||e.call(t),void(this.nativeScreenshotEnabled&&(this.nativeScreenshotEnabled=!1,this.nativeCapture.dispose()))):void(this.nativeScreenshotEnabled?null===(n=(i=this.commentElement).disableScreenshot)||void 0===n||n.call(i):(null===(s=null===(r=null===(o=this.customerMetadata)||void 0===o?void 0:o.superflow)||void 0===r?void 0:r.advancedFeatures)||void 0===s?void 0:s.takeScreenshotOnComments)?"local"!==this.getScreenshotMode()?null===(u=(h=this.commentElement).enableScreenshot)||void 0===u||u.call(h):null===(d=(c=this.commentElement).disableScreenshot)||void 0===d||d.call(c):null===(l=(a=this.commentElement).disableScreenshot)||void 0===l||l.call(a))},this.canUseNativeScreenshot=()=>{var t,e,i;return!this.isScreenshotDisabledHost()&&(up()&&"local"===this.getScreenshotMode()&&!!(null===(i=null===(e=null===(t=this.customerMetadata)||void 0===t?void 0:t.superflow)||void 0===e?void 0:e.advancedFeatures)||void 0===i?void 0:i.takeScreenshotOnComments))},this.getNativeScreenshotPermission=()=>{const t=vd(Pe,!1,"sessionStorage");return"granted"===t||"denied"===t?t:null},this.setNativeScreenshotPermission=t=>{pd(Pe,t,!1,"sessionStorage"),this.nativeScreenshotDenied="denied"===t},this.clearNativeScreenshotPermission=()=>{gd(Pe,"sessionStorage"),this.nativeScreenshotDenied=!1},this.promptNativeScreenshotForCommentMode=()=>{this.nativeScreenshotEnabled||this.nativeScreenshotEnabling||!this.canUseNativeScreenshot()||(this.logCaptureTrigger("commentMode enter: requesting screen share"),this.enableNativeScreenshot())},this.toggleNativeScreenshot=async()=>{try{if(!this.canUseNativeScreenshot())return;this.nativeScreenshotEnabled?(this.disableNativeScreenshot(),this.setNativeScreenshotPermission("denied")):(this.clearNativeScreenshotPermission(),await this.enableNativeScreenshot()),this.menuOpenedId=void 0}catch(t){console.warn("Error in toggleNativeScreenshot: ",t),th("Error in toggleNativeScreenshot: ",t)}},this.enableNativeScreenshot=()=>(this.nativeScreenshotEnabling&&this.nativeScreenshotEnablingPromise||(this.nativeScreenshotEnabling=!0,this.nativeScreenshotEnablingPromise=this.performEnableNativeScreenshot()),this.nativeScreenshotEnablingPromise),this.performEnableNativeScreenshot=async()=>{var t,e;try{if(await this.nativeCapture.init(),!this.nativeCapture.isActive())return this.nativeScreenshotEnabled=!1,void this.nativeCapture.dispose();this.nativeScreenshotEnabled=!0,this.setNativeScreenshotPermission("granted"),null===(e=null===(t=this.commentElement)||void 0===t?void 0:t.disableScreenshot)||void 0===e||e.call(t),this.ensureAddCommentAnnotationSubscription()}catch(t){this.nativeScreenshotEnabled=!1,this.nativeCapture.dispose(),!function(t){var e;const i=t,n=null!==(e=null==i?void 0:i.message)&&void 0!==e?e:"";return!0===(null==i?void 0:i.sfNativeExpected)||"native-share-ended-during-init"===n||"native-not-supported"===n}(t)?console.warn("Native screenshot enable failed/cancelled: ",t):(this.setNativeScreenshotPermission("denied"),Vu()&&"undefined"!=typeof console&&console.info("[sf-capture][native] enable skipped (expected):",t))}finally{this.nativeScreenshotEnabling=!1,this.nativeScreenshotEnablingPromise=void 0}},this.disableNativeScreenshot=()=>{try{this.nativeScreenshotEnabled=!1,this.nativeCapture.dispose(),this.restoreSdkScreenshot()}catch(t){console.warn("Error in disableNativeScreenshot: ",t),th("Error in disableNativeScreenshot: ",t)}},this.handleNativeScreenshotStreamEnded=()=>{try{const t=this.nativeScreenshotEnabled;if(this.nativeScreenshotEnabled=!1,!t)return;this.setNativeScreenshotPermission("denied"),this.restoreSdkScreenshot(),this.requestUpdate()}catch(t){console.warn("Error in handleNativeScreenshotStreamEnded: ",t),th("Error in handleNativeScreenshotStreamEnded: ",t)}},this.restoreSdkScreenshot=()=>{var t,e,i,n,o;this.isScreenshotDisabledHost()||"basic"===this.getScreenshotMode()&&(null===(i=null===(e=null===(t=this.customerMetadata)||void 0===t?void 0:t.superflow)||void 0===e?void 0:e.advancedFeatures)||void 0===i?void 0:i.takeScreenshotOnComments)&&(null===(o=null===(n=this.commentElement)||void 0===n?void 0:n.enableScreenshot)||void 0===o||o.call(n))},this.onAddCommentAnnotation=async t=>{var e,i,n,o,r,s,a,l,c;try{if(this.logCaptureTrigger("addCommentAnnotation event",{nativeScreenshotEnabled:this.nativeScreenshotEnabled,captureActive:this.nativeCapture.isActive(),dataKeys:t?Object.keys(t):null,commentAnnotationKeys:(null==t?void 0:t.commentAnnotation)?Object.keys(t.commentAnnotation):null}),!this.nativeScreenshotEnabled&&!this.canUseNativeScreenshot())return void this.logCaptureTrigger("skip: native screenshot unavailable");if(!this.nativeScreenshotEnabled){const t=this.nativeScreenshotEnabling&&!!this.nativeScreenshotEnablingPromise;if(!t&&null!==this.getNativeScreenshotPermission())return void this.logCaptureTrigger("skip: native screenshot not enabled (share decision recorded, no prompt in flight)");if(this.logCaptureTrigger(t?"comment add: share prompt already in flight, awaiting its outcome":"comment add: share never requested this session, prompting"),await this.enableNativeScreenshot(),!this.nativeScreenshotEnabled)return void this.logCaptureTrigger("skip: screen share not granted")}const d=null!==(n=null!==(e=null==t?void 0:t.annotationId)&&void 0!==e?e:null===(i=null==t?void 0:t.commentAnnotation)||void 0===i?void 0:i.annotationId)&&void 0!==n?n:null==t?void 0:t.id,h=null!==(l=null!==(a=null!==(r=null===(o=null==t?void 0:t.commentAnnotation)||void 0===o?void 0:o.comments)&&void 0!==r?r:null===(s=null==t?void 0:t.commentAnnotation)||void 0===s?void 0:s.commentData)&&void 0!==a?a:null==t?void 0:t.comments)&&void 0!==l?l:null==t?void 0:t.commentData,u=null===(c=null==h?void 0:h[0])||void 0===c?void 0:c.commentId;if(!d||!u)return void this.logCaptureTrigger("skip: missing ids",{annotationId:d,commentId:u,data:t});this.captureAndAttachScreenshot(d,u)}catch(t){console.warn("Error in onAddCommentAnnotation: ",t),th("Error in onAddCommentAnnotation: ",t)}},this.captureAndAttachScreenshot=(t,e)=>this.nativeCapture.isActive()?(this.pendingScreenshotCount+=1,this.capturingScreenshot=!0,this.screenshotChain=this.screenshotChain.catch((()=>{})).then((()=>this.runCaptureAndAttach(t,e))).finally((()=>{this.pendingScreenshotCount=Math.max(0,this.pendingScreenshotCount-1),0===this.pendingScreenshotCount&&(this.capturingScreenshot=!1)})),this.screenshotChain):(this.logCaptureTrigger("skip: native capture not active",{annotationId:t,commentId:e}),Promise.resolve()),this.runCaptureAndAttach=async(t,e)=>{var i,n,o,r;try{this.logCaptureTrigger("capture start",{annotationId:t,commentId:e});const s=await this.nativeCapture.capture({focusAnnotationId:t}),a="image/webp"===s.blobType?"webp":"png",l=new File([s.blob],`screenshot-${t}.${a}`,{type:s.blobType}),c=await(null===(n=null===(i=this.commentElement)||void 0===i?void 0:i.addAttachment)||void 0===n?void 0:n.call(i,{annotationId:t,commentId:e,files:[l]}));if(c&&Array.isArray(c)&&c.length>0&&(null===(o=c[0])||void 0===o?void 0:o.valid)){const i=null===(r=c[0])||void 0===r?void 0:r.attachment;await this.commentElement.updateComment({annotationId:t,comment:{commentId:e,attachments:[i]},merge:!0}),this.logCaptureTrigger("capture attached",{annotationId:t,commentId:e})}else console.warn("Invalid screenshot file")}catch(t){console.warn("Native screenshot capture/attach failed: ",t),th("Native screenshot capture/attach failed: ",t)}},this.setupSidebarAgentCommentFilter=()=>{var t,e,i,n,o,r;try{if(!this.commentElement)return;if("function"==typeof this.commentElement.on&&(this.commentElement.on("commentSidebarDataInit").subscribe((t=>{this.filterAgentCommentsFromSidebar(t)})),this.commentElement.on("commentSidebarDataUpdate").subscribe((t=>{const e=this.getSidebarGroupExpansionMap();this.filterAgentCommentsFromSidebar(t,e)}))),this.setupAgentWarningsHydration(),this.syncAgentsSidebarBusSubscriptions(),this.syncAgentsSidebarOpenState(),this.agentCommentsModeRequested)return this.setCommentSidebarVisibility(!0),void(this.showAgentCommentsInSidebar||(null===(e=null===(t=this.commentElement)||void 0===t?void 0:t.disableFilterCommentsOnDom)||void 0===e||e.call(t),this.showAgentCommentsInSidebar=!0));this.sidebarV2Enabled&&(this.showAgentCommentsInSidebar?null===(n=null===(i=this.commentElement)||void 0===i?void 0:i.disableFilterCommentsOnDom)||void 0===n||n.call(i):null===(r=null===(o=this.commentElement)||void 0===o?void 0:o.enableFilterCommentsOnDom)||void 0===r||r.call(o))}catch(t){console.warn("Error in setupSidebarAgentCommentFilter: ",t),th("Error in setupSidebarAgentCommentFilter: ",t)}},this.setupAgentWarningsHydration=()=>{try{if(!this.commentElement||"function"!=typeof this.commentElement.getAllCommentAnnotations||!this.documentId)return;const t=this.commentElement.getAllCommentAnnotations(this.documentId+"");if(!t||"function"!=typeof t.subscribe)return;const e=t.subscribe((t=>{try{if(this.streamEmissionCount+=1,this.lastStreamEmissionAt=Date.now(),!this.sidebarV2Enabled&&!this.showAgentCommentsInSidebar)return;this.lastStreamAnnotations=Array.isArray(t)?t:[],this.processAgentComments(this.mergeOnboardingFetchedAnnotations(this.lastStreamAnnotations)),this.ensureOnboardingFindingsLoaded()}catch(t){console.warn("Error in agent-warnings hydration subscription: ",t),th("Error in agent-warnings hydration subscription: ",t)}}));this.subscriptions.push(e)}catch(t){console.warn("Error in setupAgentWarningsHydration: ",t),th("Error in setupAgentWarningsHydration: ",t)}},this.getContentWarningsDisplayCount=()=>{try{return this.contentWarningsCount>99?"99+":`${this.contentWarningsCount}`}catch(t){return console.warn("Error in getContentWarningsDisplayCount: ",t),"0"}},this.onContentWarningsButtonClick=()=>{try{this.dropPendingCommentDeepLink("superseded"),this.releaseAgentPinDialogHold("replaced"),this.showContentWarningSidebar=!this.showContentWarningSidebar}catch(t){console.warn("Error in onContentWarningsButtonClick: ",t),th("Error in onContentWarningsButtonClick: ",t)}},this.onContentWarningSidebarClose=()=>{try{this.showContentWarningSidebar=!1}catch(t){console.warn("Error in onContentWarningSidebarClose: ",t)}},this.getOnboardingDismissedProjectIds=()=>{try{const t=vd(Ht,!1,"sessionStorage");if(!t)return[];try{const e=JSON.parse(t);if(Array.isArray(e))return e.filter((t=>"string"==typeof t&&t.length>0))}catch{}return[t]}catch(t){return console.warn("Error in getOnboardingDismissedProjectIds: ",t),th("Error in getOnboardingDismissedProjectIds: ",t),[]}},this.setOnboardingDismissedProjectIds=t=>{try{const e=t.slice(-20);if(0===e.length)return void gd(Ht,"sessionStorage");pd(Ht,JSON.stringify(e),!1,"sessionStorage")}catch(t){console.warn("Error in setOnboardingDismissedProjectIds: ",t),th("Error in setOnboardingDismissedProjectIds: ",t)}},this.recordOnboardingSidebarDismissal=()=>{try{if(!this.projectId)return;const t=`${this.projectId}`,e=this.getOnboardingDismissedProjectIds().filter((e=>e!==t));this.setOnboardingDismissedProjectIds([...e,t])}catch(t){console.warn("Error in recordOnboardingSidebarDismissal: ",t),th("Error in recordOnboardingSidebarDismissal: ",t)}},this.clearOnboardingSidebarDismissal=()=>{try{if(!this.projectId)return;const t=`${this.projectId}`,e=this.getOnboardingDismissedProjectIds();if(!e.includes(t))return;this.setOnboardingDismissedProjectIds(e.filter((e=>e!==t)))}catch(t){console.warn("Error in clearOnboardingSidebarDismissal: ",t),th("Error in clearOnboardingSidebarDismissal: ",t)}},this.canShowTourCommentTooltip=()=>{try{return!(this.allFeatureDisabled||this.readOnlyMode||!this.showTourCommentTooltip)&&!(this.onboardingMode&&this.showContentWarningSidebar)}catch(t){return console.warn("Error in canShowTourCommentTooltip: ",t),th("Error in canShowTourCommentTooltip: ",t),!1}},this.autoOpenOnboardingSidebar=()=>{try{if(!this.onboardingMode||this.allFeatureDisabled)return;if(this.onboardingAgentsSidebarRequested&&(null===this.agentsSidebarModeLatched||this.agentsSidebarMode))return;if(!this.projectId)return;if(this.getOnboardingDismissedProjectIds().includes(`${this.projectId}`))return;this.showContentWarningSidebar=!0}catch(t){console.warn("Error in autoOpenOnboardingSidebar: ",t),th("Error in autoOpenOnboardingSidebar: ",t)}},this.restoreContentWarningSidebarState=()=>{var t,e;try{if(this.onboardingMode)return this.autoOpenOnboardingSidebar(),void(this.showContentWarningSidebar&&(this.showAgentCommentsInSidebar?null===(e=null===(t=this.commentElement)||void 0===t?void 0:t.disableFilterCommentsOnDom)||void 0===e||e.call(t):this.setCommentSidebarVisibility(!0)));const i="true"===vd(Ne,!1,"sessionStorage"),n=new URL(window.location.href).searchParams.has(ne);if(!i)return;if(!n)return;if(this.allFeatureDisabled||"Admin"!==this.snippylyUserRole)return;this.showContentWarningSidebar=!0}catch(t){console.warn("Error in restoreContentWarningSidebarState: ",t),th("Error in restoreContentWarningSidebarState: ",t)}},this.navigateTo=t=>{try{this.dropPendingPortalShow("left-page"),this.dropPendingCommentDeepLink("navigated"),this.releaseAgentPinDialogHold("replaced"),window.location.href=t}catch(t){console.warn("Error in navigateTo: ",t),th("Error in navigateTo: ",t)}},this.onContentWarningSidebarAddAll=()=>{},this.onContentWarningItemClick=t=>{var e,i;try{this.dropPendingPortalShow("superseded"),this.dropPendingCommentDeepLink("superseded"),this.releaseAgentPinDialogHold("replaced"),this.openAgentAnnotation(null===(e=null==t?void 0:t.detail)||void 0===e?void 0:e.annotation,!1,{fromAgentsSidebar:!0===(null===(i=null==t?void 0:t.detail)||void 0===i?void 0:i.fromAgentsSidebar)})}catch(t){console.warn("Error in onContentWarningItemClick: ",t),th("Error in onContentWarningItemClick: ",t)}},this.openAgentAnnotation=(t,e=!1,i={})=>{var n,o;try{if(!(null==t?void 0:t.annotationId)&&!(null==t?void 0:t.id))return null;const r=(null==t?void 0:t.annotationId)||(null==t?void 0:t.id);return this.opensAgentAnnotationHere(t)?this.openAgentAnnotationHere(t,!0===(null==i?void 0:i.fromAgentsSidebar),null!==(o=null==i?void 0:i.pinSource)&&void 0!==o?o:"other",null==i?void 0:i.show):this.navigateToPage(null===(n=null==t?void 0:t.pageInfo)||void 0===n?void 0:n.url,r,e)?"navigated":"navigate-failed"}catch(t){return console.warn("Error in openAgentAnnotation: ",t),th("Error in openAgentAnnotation: ",t),null}},this.opensAgentAnnotationHere=t=>{var e;try{if(mu(t))return!0;const i=null===(e=null==t?void 0:t.pageInfo)||void 0===e?void 0:e.url;return!i||null===this.getCommentPagePath(i)||this.isCurrentPageUrl(i)}catch(t){return console.warn("Error in opensAgentAnnotationHere: ",t),th("Error in opensAgentAnnotationHere: ",t),!0}},this.navigateToPage=(t,e,i)=>{try{if(this.dropPendingPortalShow("left-page"),this.dropPendingCommentDeepLink("navigated"),this.showContentWarningSidebar&&pd(Ne,"true",!1,"sessionStorage"),this.isRunningUnderLivePreview()){const i=Yp(t);if(!i)return!1;const n=i.absoluteUrl&&!Ad(new URL(i.absoluteUrl))?Td(i.absoluteUrl):null,o=null!=n?n:i.path,r=null===n?i.search:"",s=this.buildLivePreviewNavigationUrl(`${o}${r}`,e);return!!s&&(this.navigateLivePreviewTo(s),!0)}if(this.isRunningUnderPreviewProxy()){return!(null!==Td(t)||!window.parent||window.parent===window)&&(window.parent.postMessage(e?{type:Yt,url:t,annotationId:e}:{type:Yt,url:t},"*"),!0)}const n=Yp(t);if(!n)return!1;const o=n.absoluteUrl?new URL(n.absoluteUrl):new URL(`${n.path}${n.search}`,window.location.origin);return i&&o.origin!==window.location.origin?(console.warn("[CWS Toolbar] Refusing a navigation off this origin:",t),!1):(e?o.searchParams.set(ne,e):o.searchParams.delete(ne),this.navigateTo(o.toString()),!0)}catch(t){return console.warn("Error in navigateToPage: ",t),th("Error in navigateToPage: ",t),!1}},this.navigateLivePreviewTo=t=>{try{try{this.pendingLeavingPage=this.toPreviewLocationPage(new URL(t))}catch(t){this.pendingLeavingPage=null,console.warn("Error in navigateLivePreviewTo (record): ",t),th("Error in navigateLivePreviewTo (record): ",t)}this.navigateTo(t)}catch(t){console.warn("Error in navigateLivePreviewTo: ",t),th("Error in navigateLivePreviewTo: ",t)}},this.buildLivePreviewNavigationUrl=(t,e)=>{try{const i=new URL(t,window.location.origin);return i.origin!==window.location.origin?(console.warn("[CWS Toolbar] Refusing a live preview navigation off this origin:",t),null):(i.searchParams.delete(ii),e?i.searchParams.set(ne,e):i.searchParams.delete(ne),i.toString())}catch(t){return console.warn("Error in buildLivePreviewNavigationUrl: ",t),null}},this.selectAnnotationOnPage=t=>{var e;try{(null===(e=this.commentElement)||void 0===e?void 0:e.selectCommentByAnnotationId)&&this.commentElement.selectCommentByAnnotationId(t),setTimeout((()=>{var e;(null===(e=this.commentElement)||void 0===e?void 0:e.scrollToCommentByAnnotationId)&&this.commentElement.scrollToCommentByAnnotationId(t)}),150)}catch(t){console.warn("Error in selectAnnotationOnPage: ",t),th("Error in selectAnnotationOnPage: ",t)}},this.onContentWarningItemNext=t=>{var e;try{const i=null===(e=null==t?void 0:t.detail)||void 0===e?void 0:e.annotation;if(!i)return;this.navigateToCheckPage(this.resolveFullAnnotation(i),"next")}catch(t){console.warn("Error in onContentWarningItemNext: ",t),th("Error in onContentWarningItemNext: ",t)}},this.getCurrentCheckPageKey=()=>{var t;try{if(this.isRunningUnderPreviewProxy())return this.previewLocationPath||"/";if(this.autoLocation&&"string"==typeof(null===(t=this.location)||void 0===t?void 0:t.url)&&this.location.url)return this.location.url;const e=new URL(window.location.href);for(const t of me)e.searchParams.delete(t);return`${e.pathname}${this.queryParamsComments?e.search:""}`}catch(t){return console.warn("Error in getCurrentCheckPageKey: ",t),th("Error in getCurrentCheckPageKey: ",t),window.location.pathname}},this.navigateToCheckPage=(t,e="next")=>{try{const i=wu(t);if(i.length<2)return!1;const n=Cu(i,this.getCurrentCheckPageKey(),e);return!!n&&this.navigateToCheckPageKey(t,n)}catch(t){return console.warn("Error in navigateToCheckPage: ",t),th("Error in navigateToCheckPage: ",t),!1}},this.navigateToCheckPageKey=(t,e)=>{var i;try{const n=(null==t?void 0:t.annotationId)||(null==t?void 0:t.id);if(!n||!e)return!1;if(this.showContentWarningSidebar&&pd(Ne,"true",!1,"sessionStorage"),this.isRunningUnderLivePreview()){const t=this.buildLivePreviewNavigationUrl(e,n);return!!t&&(this.navigateLivePreviewTo(t),!0)}if(this.isRunningUnderPreviewProxy()){const o=null===(i=null==t?void 0:t.pageInfo)||void 0===i?void 0:i.url;if("string"!=typeof o||!o||null!==Td(o))return!1;if(!window.parent||window.parent===window)return!1;const r=new URL(e,new URL(o).origin);return window.parent.postMessage({type:Yt,url:r.toString(),annotationId:n},"*"),!0}const o=new URL(e,window.location.origin);return o.searchParams.set(ne,n),this.navigateTo(o.toString()),!0}catch(t){return console.warn("Error in navigateToCheckPageKey: ",t),th("Error in navigateToCheckPageKey: ",t),!1}},this.resolveFullAnnotation=t=>{var e;try{if(!t||su(t))return t;const i=(null==t?void 0:t.annotationId)||(null==t?void 0:t.id);if(!i)return t;const n=t=>((null==t?void 0:t.annotationId)||(null==t?void 0:t.id))===i,o=this.lastStreamAnnotations.find(n);if(su(o))return o;for(const t of this.agentGroups){const i=null===(e=null==t?void 0:t.annotations)||void 0===e?void 0:e.find(n);if(su(i))return i}return t}catch(e){return console.warn("Error in resolveFullAnnotation: ",e),th("Error in resolveFullAnnotation: ",e),t}},this.isCurrentPageUrl=t=>{try{const e=this.getCommentPagePath(t);return null!==e&&Zp(e,this.getCurrentPagePath())}catch{return!1}},this.getCommentPagePath=t=>{var e;try{const i=Yp(t);return i?i.absoluteUrl&&null!==(e=Td(i.absoluteUrl))&&void 0!==e?e:i.path:null}catch(t){return console.warn("Error in getCommentPagePath: ",t),null}},this.getCurrentPagePath=()=>{try{return!this.isRunningUnderLivePreview()&&this.isRunningUnderPreviewProxy()?this.previewLocationPath||"/":window.location.pathname}catch(t){return console.warn("Error in getCurrentPagePath: ",t),th("Error in getCurrentPagePath: ",t),window.location.pathname}},this.setupVeltButtonClickListener=()=>{try{if(!(null===Velt||void 0===Velt?void 0:Velt.on))return void console.warn("[CWS Toolbar] Velt.on not available for button click listener");Velt.on("veltButtonClick").subscribe((t=>{var e;try{if(!t)return;const i=null===(e=null==t?void 0:t.buttonContext)||void 0===e?void 0:e.clickedButtonId,n=null==t?void 0:t.commentAnnotation,o=(null==n?void 0:n.annotationId)||(null==n?void 0:n.id),r="accept-suggestion"===i||"reject-suggestion"===i;if(r&&o&&this.processingAnnotationIds.has(o))return;if(r&&this.isSuggestionActionsHiddenForViewer())return void console.warn("[CWS Toolbar] Only workspace members can accept or reject suggestions. Ignoring:",i);if("prev-suggestion"===i||"next-suggestion"===i){const t="next-suggestion"===i?"next":"prev",e=this.resolveFullAnnotation(n);mu(e)&&wu(e).length>1?this.navigateToCheckPage(e,t):this.navigateSuggestion(n,t)}else"accept-suggestion"===i&&this.handleAcceptSuggestion(n)}catch(t){console.warn("Error in veltButtonClick handler: ",t)}})),this.commentElement.onCommentSelectionChange().subscribe((t=>{this.handleCommentSelection(t)}))}catch(t){console.warn("Error in setupVeltButtonClickListener: ",t),th("Error in setupVeltButtonClickListener: ",t)}},this.navigateSuggestion=(t,e)=>{var i,n,o,r,s;try{if(!t)return void console.warn("[CWS Toolbar] No annotation provided for navigation");const a=null===(n=null===(i=null==t?void 0:t.agent)||void 0===i?void 0:i.result)||void 0===n?void 0:n.incorrectWord;if(!a)return void console.warn("[CWS Toolbar] No incorrectWord found on annotation");const l=this.findMatchingWarning(a);if(!l)return void console.warn("[CWS Toolbar] No matching warning found for word:",a);const c=null===(o=null==t?void 0:t.pageInfo)||void 0===o?void 0:o.path,d=this.normalizePagePath(c),h=null===(r=null==l?void 0:l.annotations)||void 0===r?void 0:r.filter((t=>{var e;const i=null===(e=null==t?void 0:t.pageInfo)||void 0===e?void 0:e.path;return this.normalizePagePath(i)===d}));if(!(null==h?void 0:h.length)||h.length<=1)return;const u=(null==t?void 0:t.annotationId)||(null==t?void 0:t.id),p=h.findIndex((t=>((null==t?void 0:t.annotationId)||(null==t?void 0:t.id))===u));if(-1===p)return void console.warn("[CWS Toolbar] Current annotation not found in warning group");let v;v="next"===e?(p+1)%h.length:(p-1+h.length)%h.length;const g=h[v],f=(null==g?void 0:g.annotationId)||(null==g?void 0:g.id);f&&((null===(s=this.commentElement)||void 0===s?void 0:s.selectCommentByAnnotationId)&&this.commentElement.selectCommentByAnnotationId(f),setTimeout((()=>{var t;(null===(t=this.commentElement)||void 0===t?void 0:t.scrollToCommentByAnnotationId)&&this.commentElement.scrollToCommentByAnnotationId(f)}),150))}catch(t){console.warn("Error in navigateSuggestion: ",t),th("Error in navigateSuggestion: ",t)}},this.findMatchingWarning=t=>{var e;try{for(const i of this.agentGroups){const n=null===(e=null==i?void 0:i.warnings)||void 0===e?void 0:e.find((e=>(null==e?void 0:e.primaryText)===t));if(n)return n}return null}catch(t){return console.warn("Error in findMatchingWarning: ",t),null}},this.removeAnnotationFromWarnings=t=>{var e,i,n;try{if(!t)return;const o=e=>{var i,n,o,r;for(const s of e){const e=null===(i=null==s?void 0:s.annotations)||void 0===i?void 0:i.find((e=>((null==e?void 0:e.annotationId)||(null==e?void 0:e.id))===t));if(e){const t="grammar"===(null===(o=null===(n=null==e?void 0:e.agent)||void 0===n?void 0:n.result)||void 0===o?void 0:o.type)?this.grammarSuggestionPagePathMap:this.spellingSuggestionPagePathMap,i=(null==s?void 0:s.primaryText)||"",a=null===(r=null==e?void 0:e.pageInfo)||void 0===r?void 0:r.path,l=this.normalizePagePath(a);if(i&&l&&t.has(i)){const e=t.get(i),n=e.get(l)||0;n>1?e.set(l,n-1):(e.delete(l),0===e.size&&t.delete(i))}return}}};for(const t of this.agentGroups)(null==t?void 0:t.agentId)!==Be.SPELL_CHECK&&(null==t?void 0:t.agentId)!==Be.GRAMMAR_CHECK||o(t.warnings);const r=null!==(n=null===(i=null===(e=this.agentGroups)||void 0===e?void 0:e.map((e=>{var i,n,o,r,s;const a=null!==(o=null===(n=null===(i=null==e?void 0:e.warnings)||void 0===i?void 0:i.map((e=>{var i;const n=null===(i=null==e?void 0:e.annotations)||void 0===i?void 0:i.filter((e=>((null==e?void 0:e.annotationId)||(null==e?void 0:e.id))!==t));return n&&0!==n.length?{...e,annotations:n,occurrences:n.length}:null})))||void 0===n?void 0:n.filter((t=>null!==t)))&&void 0!==o?o:[],l=null!==(s=null===(r=null==e?void 0:e.annotations)||void 0===r?void 0:r.filter((e=>((null==e?void 0:e.annotationId)||(null==e?void 0:e.id))!==t)))&&void 0!==s?s:[];return 0===a.length?null:{...e,warnings:a,warningCount:a.length,annotations:l}})))||void 0===i?void 0:i.filter((t=>null!==t)))&&void 0!==n?n:[];this.agentGroups=r;const s=r.reduce(((t,e)=>t+e.warningCount),0);this.contentWarningsCount=s,this.hasContentWarnings=s>0,this.onboardingFetchedAnnotations=this.onboardingFetchedAnnotations.filter((e=>((null==e?void 0:e.annotationId)||(null==e?void 0:e.id))!==t)),this.isAgentRunStatusFeedEnabled()&&(this.onboardingRemovedAnnotationIds.add(t),this.setOnboardingUnsyncedAnnotationIds(this.onboardingFetchedAnnotations.map((t=>null==t?void 0:t.annotationId))))}catch(t){console.warn("Error in removeAnnotationFromWarnings: ",t)}},this.setSuggestionButtonsLoading=(t,e,i)=>{try{const n=i||document.querySelector(".velt-comment-dialog.selected");if(!n)return;const o=n.querySelector(".sf-accept-btn"),r=n.querySelector(".sf-reject-btn");if(e){const e="accept"===t?o:r,i="accept"===t?r:o;null==e||e.classList.add("sf-btn-loading"),null==i||i.classList.add("sf-btn-disabled")}else null==o||o.classList.remove("sf-btn-loading","sf-btn-disabled"),null==r||r.classList.remove("sf-btn-loading","sf-btn-disabled")}catch(t){console.warn("Error in setSuggestionButtonsLoading: ",t)}},this.handleAcceptSuggestion=async t=>{var e,i,n;try{const o=(null==t?void 0:t.annotationId)||(null==t?void 0:t.id);if(!o)return void console.warn("[CWS Toolbar] handleAcceptSuggestion: No annotationId found",t);if(this.processingAnnotationIds.has(o))return;const r=(null===(e=this.snippylyUser)||void 0===e?void 0:e.userId)||(null===(i=this.snippylyUser)||void 0===i?void 0:i.uid),s=(null===(n=this.snippylyUser)||void 0===n?void 0:n.email)||"";if(!r)return void console.warn("[CWS Toolbar] handleAcceptSuggestion: No user available");if(!this.documentId)return void console.warn("[CWS Toolbar] handleAcceptSuggestion: No documentId available");this.processingAnnotationIds.add(o);const a=document.querySelector(".velt-comment-dialog.selected");this.setSuggestionButtonsLoading("accept",!0,a);try{await Ch(this.apiKey,this.apiKey,this.documentId+"",o,{userId:r,email:s},this.suggestionCredential()),this.removeAnnotationFromWarnings(o)}finally{this.processingAnnotationIds.delete(o),this.setSuggestionButtonsLoading("accept",!1,a)}}catch(t){console.warn("Error in handleAcceptSuggestion: ",t),th("Error in handleAcceptSuggestion: ",t)}},this.trackAgentPins=t=>{try{const e=this.agentPinTargets;if(this.agentPinTargets=new Map((t=>{const e=[],i=new Set;for(const n of Array.isArray(t)?t:[]){if("square"!==dv(n))continue;const t=ou(n);t&&!i.has(t)&&(i.add(t),e.push({id:t,icon:pv(n)}))}return e})(t).map((t=>[t.id,t]))),!this.isConnected)return;for(const t of e.keys())if(!this.agentPinTargets.has(t))for(const e of Mv(t))$v(e),this.agentPinDecoratedContainers.delete(e);this.decorateAgentPins(),this.syncAgentPinDomObserver()}catch(t){console.warn("Error in trackAgentPins: ",t),th("Error in trackAgentPins: ",t)}},this.resyncAgentPins=()=>{try{if(!this.isConnected||0===this.agentPinTargets.size)return;this.decorateAgentPins(),this.syncAgentPinDomObserver()}catch(t){console.warn("Error in resyncAgentPins: ",t),th("Error in resyncAgentPins: ",t)}},this.decorateAgentPins=()=>{try{if(!this.isConnected)return;const t=new Set,e=new Map;for(const i of this.agentPinTargets.values())for(const n of Mv(i.id))"light"===this.decorateAgentPinContainer(n,i,e)&&t.add(i.id);this.agentPinLightDomIds=t,this.writeAgentPinPageCss()}catch(t){console.warn("Error in decorateAgentPins: ",t),th("Error in decorateAgentPins: ",t)}},this.decorateAgentPinContainer=(t,e,i)=>{let n=i.get(e.icon);void 0===n&&(n=xv(e.icon),i.set(e.icon,n));const o=kv(t);for(const t of o)Sv(t,n);this.agentPinDecoratedContainers.add(t);const r=_v(t,o);return"unrecognised"===r&&this.noteUnrecognisedAgentPin(t),r},this.noteUnrecognisedAgentPin=t=>{try{if(this.agentPinMarkupReported)return;this.agentPinUnrecognisedContainers.add(t),null===this.agentPinMarkupRecheckTimer&&(this.agentPinMarkupRecheckTimer=setTimeout((()=>this.checkUnrecognisedAgentPins()),Lv.AGENT_PIN_MARKUP_RECHECK_MS))}catch(t){console.warn("Error in noteUnrecognisedAgentPin: ",t)}},this.checkUnrecognisedAgentPins=()=>{try{null!==this.agentPinMarkupRecheckTimer&&(clearTimeout(this.agentPinMarkupRecheckTimer),this.agentPinMarkupRecheckTimer=null);const t=Array.from(this.agentPinUnrecognisedContainers);if(this.agentPinUnrecognisedContainers.clear(),this.agentPinMarkupReported||!this.isConnected)return;for(const e of t){const t=Av(e);if(!e.isConnected||!this.agentPinTargets.has(t)||"unrecognised"!==_v(e))continue;this.agentPinMarkupReported=!0;const i=bv.join(" ");return console.warn(`[Superflow] Agent pin not squared: the SDK rendered pin ${t} with none of the SDK pin internals (${i}). Update SDK_PIN_INTERNALS for this SDK version.`),void th("Agent pin SDK markup not recognised","SDK pin internals changed",{annotationId:t,selectors:i})}}catch(t){console.warn("Error in checkUnrecognisedAgentPins: ",t)}},this.decoratePendingAgentPins=()=>{try{const t=Array.from(this.agentPinPendingContainers);if(this.agentPinPendingContainers.clear(),!this.isConnected)return;const e=new Map;let i=!1;for(const n of t){if(!n.isConnected||this.agentPinDecoratedContainers.has(n))continue;const t=this.agentPinTargets.get(Av(n));t&&("light"!==this.decorateAgentPinContainer(n,t,e)||this.agentPinLightDomIds.has(t.id)||(this.agentPinLightDomIds.add(t.id),i=!0))}i&&this.writeAgentPinPageCss()}catch(t){console.warn("Error in decoratePendingAgentPins: ",t),th("Error in decoratePendingAgentPins: ",t)}},this.writeAgentPinPageCss=()=>{const t=[];for(const e of this.agentPinLightDomIds){const i=this.agentPinTargets.get(e);i&&t.push(i)}const e=(t=>{var e;const i=new Map;for(const n of Array.isArray(t)?t:[]){if(!(null==n?void 0:n.id))continue;const t=null!==(e=i.get(n.icon))&&void 0!==e?e:[];t.push(`#${fv}${Ev(n.id)}`),i.set(n.icon,t)}return Array.from(i.entries()).map((([t,e])=>xv(t,e))).join("\n")})(t);e!==this.agentPinPageCss&&(this.agentPinPageCss=e,document.head&&Sv(document.head,e))},this.scheduleAgentPinDecorate=()=>{try{if(!this.isConnected||0===this.agentPinTargets.size||null!==this.agentPinFrameCancel)return;const t=()=>{this.agentPinFrameCancel=null,this.decoratePendingAgentPins()};if("function"==typeof requestAnimationFrame){const e=requestAnimationFrame(t);this.agentPinFrameCancel=()=>cancelAnimationFrame(e)}else{const e=setTimeout(t,16);this.agentPinFrameCancel=()=>clearTimeout(e)}}catch(t){console.warn("Error in scheduleAgentPinDecorate: ",t),th("Error in scheduleAgentPinDecorate: ",t)}},this.onAgentPinMutations=t=>{try{if(0===this.agentPinTargets.size)return;const{added:e,changed:i}=(t=>{const e=new Set,i=new Set;try{for(const n of Array.isArray(t)?t:[]){const t=null==n?void 0:n.addedNodes;if(!t||0===t.length)continue;let o=!1;for(let i=0;i<t.length;i+=1){const n=t[i];if(1!==n.nodeType)continue;o=!0;const r=n;Av(r)?e.add(r):wv.includes(r.localName)&&r.querySelectorAll(mv).forEach((t=>e.add(t)))}const r=n.target;if(!o||!r||1!==r.nodeType)continue;const s=r.closest(mv);s&&i.add(s)}}catch{}return{added:Array.from(e),changed:Array.from(i)}})(t);this.pendingAgentPin&&this.openPendingAgentPin(e);let n=!1;for(const t of i)this.agentPinTargets.has(Av(t))&&(this.agentPinDecoratedContainers.delete(t),this.agentPinPendingContainers.add(t),n=!0);for(const t of e)!this.agentPinDecoratedContainers.has(t)&&this.agentPinTargets.has(Av(t))&&(this.agentPinPendingContainers.add(t),n=!0);n&&this.scheduleAgentPinDecorate()}catch(t){console.warn("Error in onAgentPinMutations: ",t),th("Error in onAgentPinMutations: ",t)}},this.syncAgentPinDomObserver=()=>{var t;try{if(!this.isConnected||0===this.agentPinTargets.size)return null===(t=this.agentPinDomObserver)||void 0===t||t.disconnect(),void(this.agentPinDomObserver=null);if(this.agentPinDomObserver||"undefined"==typeof MutationObserver||!document.body)return;this.agentPinDomObserver=new MutationObserver((t=>this.onAgentPinMutations(t))),this.agentPinDomObserver.observe(document.body,{childList:!0,subtree:!0})}catch(t){console.warn("Error in syncAgentPinDomObserver: ",t),th("Error in syncAgentPinDomObserver: ",t)}},this.teardownAgentPins=()=>{var t,e;try{null===(t=this.agentPinDomObserver)||void 0===t||t.disconnect(),this.agentPinDomObserver=null,null===(e=this.agentPinFrameCancel)||void 0===e||e.call(this),this.agentPinFrameCancel=null,this.agentPinPendingContainers.clear(),null!==this.agentPinMarkupRecheckTimer&&(clearTimeout(this.agentPinMarkupRecheckTimer),this.agentPinMarkupRecheckTimer=null),this.agentPinUnrecognisedContainers.clear(),this.agentPinLightDomIds=new Set,this.agentPinPageCss="",document.head&&Sv(document.head,"");for(const t of this.agentPinTargets.values())for(const e of Mv(t.id))$v(e);this.agentPinDecoratedContainers=new WeakSet}catch(t){console.warn("Error in teardownAgentPins: ",t),th("Error in teardownAgentPins: ",t)}},this.showFirstCommentNudge=()=>{try{if(!this.autoCommentModeRequested||this.autoCommentModeArmedOnce||this.addCommentMode)return;this.firstCommentNudge=!0,this.showTourCommentTooltip=!0}catch(t){console.warn("Error in showFirstCommentNudge: ",t),th("Error in showFirstCommentNudge: ",t)}},this.disableCommentMode=()=>{var t;try{(null===(t=this.commentElement)||void 0===t?void 0:t.disableCommentMode)&&this.commentElement.disableCommentMode()}catch(t){console.warn("Error in disableAddCommentMode: ",t),th("Error in disableAddCommentMode: ",t)}},this.disableCommentModeButton=()=>{try{return this.addCommentMode?R`
|
|
6597
6597
|
<div class="disable-add-comment-button" @click=${()=>this.disableCommentMode()}>
|
|
6598
6598
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
6599
6599
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M3.52861 3.52858C3.78896 3.26823 4.21107 3.26823 4.47141 3.52858L8.00001 7.05717L11.5286 3.52858C11.789 3.26823 12.2111 3.26823 12.4714 3.52858C12.7318 3.78892 12.7318 4.21103 12.4714 4.47138L8.94282 7.99998L12.4714 11.5286C12.7318 11.7889 12.7318 12.211 12.4714 12.4714C12.2111 12.7317 11.789 12.7317 11.5286 12.4714L8.00001 8.94279L4.47141 12.4714C4.21107 12.7317 3.78896 12.7317 3.52861 12.4714C3.26826 12.211 3.26826 11.7889 3.52861 11.5286L7.0572 7.99998L3.52861 4.47138C3.26826 4.21103 3.26826 3.78892 3.52861 3.52858Z" fill="#FAFBFF"/>
|
|
@@ -7393,6 +7393,7 @@ class Qc extends Fa{}Qc.Encryptor=class extends Qc{processBlock(t,e){const i=t,n
|
|
|
7393
7393
|
.userSeatsExhausted=${!!(null===(x=null===(E=this.featureAccess)||void 0===E?void 0:E[mh.WorkspaceUserSeats])||void 0===x?void 0:x.hasUsageExhausted)}
|
|
7394
7394
|
.credential=${this.suggestionCredential()}
|
|
7395
7395
|
.portalInviteUrl=${this.portalInviteUrl()}
|
|
7396
|
+
.portalInviteKind=${this.portalInviteKind()}
|
|
7396
7397
|
@superflow-invite-modal-close=${this.closeInviteModal}
|
|
7397
7398
|
@superflow-invite-modal-invite-success=${this.onInviteSuccess}
|
|
7398
7399
|
></superflow-invite-modal>
|