1var __defProp = Object.defineProperty; 2var __defProps = Object.defineProperties; 3var __getOwnPropDescs = Object.getOwnPropertyDescriptors; 4var __getOwnPropSymbols = Object.getOwnPropertySymbols; 5var __hasOwnProp = Object.prototype.hasOwnProperty; 6var __propIsEnum = Object.prototype.propertyIsEnumerable; 7var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; 8var __spreadValues = (a, b) => { 9 for (var prop in b || (b = {})) 10 if (__hasOwnProp.call(b, prop)) 11 __defNormalProp(a, prop, b[prop]); 12 if (__getOwnPropSymbols) 13 for (var prop of __getOwnPropSymbols(b)) { 14 if (__propIsEnum.call(b, prop)) 15 __defNormalProp(a, prop, b[prop]); 16 } 17 return a; 18}; 19var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)); 20var __async = (__this, __arguments, generator) => { 21 return new Promise((resolve, reject) => { 22 var fulfilled = (value) => { 23 try { 24 step(generator.next(value)); 25 } catch (e) { 26 reject(e); 27 } 28 }; 29 var rejected = (value) => { 30 try { 31 step(generator.throw(value)); 32 } catch (e) { 33 reject(e); 34 } 35 }; 36 var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); 37 step((generator = generator.apply(__this, __arguments)).next()); 38 }); 39}; 40var _a; 41import { w as watch, n as nextTick, g as ref, t as toRaw, h as useTemplateRef, i as onMounted, r as resolveComponent, f as unref, o as openBlock, e as createBlock, j as withCtx, k as normalizeClass, l as createCommentVNode, m as createElementBlock, p as resolveDynamicComponent, q as toDisplayString, v as createBaseVNode, F as Fragment, x as createVNode, y as createTextVNode, a as axios, z as defineAsyncComponent, c as createApp, A as createSlots } from "./chunk-vendor.B1BY-hcD.js"; 42import { b as _export_sfc, _ as __vitePreload } from "./common-helpers.DkPT0x6i.js"; 43import { g as getSessionStorage, l as locale, s as setSessionStorage, p as post, a as get, i as i18n, b as getLocalstorage, c as setLocalstorage, d as prefix, N as NAME_SPACE, e as setupAppErrorHandling } from "./app-shared.DMIWbACC.js"; 44import { b as ZmInlineChevronIcon, a as ZmContext, c as ZmScrollbar, d as ZmSideMenu, e as ZmIcon, f as ZmButton, g as ZmTooltip, h as ZmBadge, i as ZmVisuallyHidden, j as ZmPopover } from "./zoom-ui-vue3.9uHRANFW.js"; 45import { P as PopWindowPopOutV2 } from "./zoom-icons-vue.C38wAiOG.js"; 46const { sideMenuConfig } = window.microsDatas || {}; 47const { pbxDomain, zccDomain, phoneNumberDomain, aiStudioDomain, zvaDomain } = sideMenuConfig || {}; 48const PBX = { 49 tokenUrl: "/pbx/web/getToken", 50 menuAPI: `${pbxDomain}/api/v2/pbx/web/menu`, 51 key: "pbx_column_container", 52 menuPrefix: "pbx" 53}; 54const ZCC = { 55 tokenUrl: "/cci/web/getToken/web", 56 menuAPI: `${zccDomain}/v1/zoom/web/menu`, 57 key: "contact_center_column_container", 58 menuPrefix: "zcc" 59}; 60const ZCP = { 61 tokenUrl: "/cp/web/getToken", 62 menuAPI: `${phoneNumberDomain}/cp/webapi/menu`, 63 key: "phone_number_management_column_container", 64 menuPrefix: "zcp" 65}; 66const AIStudioNew = { 67 tokenUrl: "/ai-studio/web/getToken", 68 menuAPI: `${zvaDomain}/v1/zoom/ai/studio/menu`, 69 key: "new_ai_studio_column_container" 70}; 71const AIStudio = { 72 tokenUrl: "/nws/common/2.0/nak?pms=AIStudioNws&pms=AIStudioManagement", 73 menuAPI: `${aiStudioDomain}/api/v3/caic/zoom/web/menu`, 74 key: "new_ai_studio_column_container" 75}; 76const ZVA = { 77 tokenUrl: "/zva/web/getToken", 78 menuAPI: `${zvaDomain}/v1/zoom/web/menu`, 79 key: "zva_column_container", 80 menuPrefix: "zva" 81}; 82const MailCalender = { 83 key: "sidemenu-mail-calendar-management", 84 menuPrefix: "mail-calender" 85}; 86const CX_MANAGEMENT_ID = "cx_management_column_container"; 87const KEEP_KEYS = [ 88 "pbx_column_container", 89 "phone_number_management_column_container", 90 "contact_center_column_container", 91 "new_ai_studio_column_container", 92 "ai_studio_column_container" 93]; 94function findPreviousSiblingByClass(elementId, className) { 95 var _a2; 96 const targetElement = document.getElementById(elementId); 97 if (!targetElement) return null; 98 let current = targetElement.previousElementSibling; 99 while (current) { 100 if ((_a2 = current.classList) == null ? void 0 : _a2.contains(className)) { 101 return current; 102 } 103 current = current.previousElementSibling; 104 } 105 return null; 106} 107function getUrlParam(paramName, url = window.location.href) { 108 try { 109 const urlObj = new URL(url);
110 const urlParams = new URLSearchParams(urlObj.search); 111 return urlParams.get(paramName); 112 } catch (error) { 113 console.error("Invalid URL:", url, error); 114 return null; 115 } 116} 117function getMenuItemByProps(array, targetValue, propName, parent = null) { 118 if (targetValue === void 0 || propName === void 0 || propName === "") { 119 return null; 120 } 121 if (!Array.isArray(array)) { 122 return null; 123 } 124 for (const item of array) { 125 const isMatch = propName === "url" && item[propName] ? item[propName].includes(targetValue) : item[propName] === targetValue; 126 if (isMatch) { 127 return { item, parent }; 128 } 129 if (Array.isArray(item.items)) { 130 const found = getMenuItemByProps(item.items, targetValue, propName, item); 131 if (found) return found; 132 } 133 } 134 return null; 135} 136function normalizePath(url) { 137 if (!url || typeof url !== "string") return ""; 138 if (url.startsWith("http")) { 139 const urlObj = new URL(url); 140 let fullPath = urlObj.pathname; 141 if (urlObj.hash) { 142 fullPath += urlObj.hash; 143 } 144 return fullPath.replace(/\/$/g, "").replace(/\?.*$/g, ""); 145 } 146 return url.replace(/\?.*$/g, "").replace(/\/$/g, ""); 147} 148function isPathMatch(menuUrl, currentUrl) { 149 if (!menuUrl || !currentUrl) return false; 150 const normalizedMenuUrl = normalizePath(menuUrl); 151 const normalizedCurrentUrl = normalizePath(currentUrl); 152 if (normalizedMenuUrl === "/account/report") { 153 if (location.search && getUrlParam("isPersonal")) { 154 if (getUrlParam("isPersonal") === "true") { 155 return getUrlParam("isPersonal", menuUrl) === "true"; 156 } 157 return getUrlParam("isPersonal", menuUrl) === getUrlParam("isPersonal"); 158 } else { 159 const urlObj = new URL(menuUrl); 160 const originPath = urlObj.pathname + urlObj.search; 161 return originPath === location.pathname + location.search; 162 } 163 } 164 if (normalizedMenuUrl === normalizedCurrentUrl) { 165 return true; 166 } 167 if (normalizedCurrentUrl.startsWith(normalizedMenuUrl) && normalizedMenuUrl.split("/").filter(Boolean).length > 2) { 168 return true; 169 } 170 if (menuUrl.includes("#") && currentUrl.includes("#")) { 171 const menuParts = normalizedMenuUrl.split("#"); 172 const currentParts = normalizedCurrentUrl.split("#"); 173 const menuBasePath = menuParts[0]; 174 const menuHashPath = menuParts[1] || ""; 175 const currentBasePath = currentParts[0]; 176 const currentHashPath = currentParts[1] || ""; 177 if (menuBasePath === currentBasePath) { 178 if (menuHashPath === currentHashPath) { 179 return true; 180 } 181 if (currentHashPath.startsWith(menuHashPath + "/") || menuHashPath.startsWith(currentHashPath + "/")) { 182 return true; 183 } 184 } 185 } 186 return false; 187} 188function calculateMatchScore(menuUrl, currentUrl) { 189 const normalizedMenuUrl = normalizePath(menuUrl); 190 const normalizedCurrentUrl = normalizePath(currentUrl); 191 let score = 0; 192 if (normalizedMenuUrl === normalizedCurrentUrl) { 193 return 100; 194 } 195 if (menuUrl.includes("#") && currentUrl.includes("#")) { 196 const menuParts = normalizedMenuUrl.split("#"); 197 const currentParts = normalizedCurrentUrl.split("#"); 198 const menuBasePath = menuParts[0]; 199 const menuHashPath = menuParts[1] || ""; 200 const currentBasePath = currentParts[0]; 201 const currentHashPath = currentParts[1] || ""; 202 if (menuBasePath === currentBasePath) { 203 score += 50; 204 if (menuHashPath === currentHashPath) { 205 score += 40; 206 } else if (currentHashPath.startsWith(menuHashPath)) { 207 score += 30; 208 } else if (menuHashPath.startsWith(currentHashPath)) { 209 score += 25; 210 } 211 } 212 } else { 213 const menuBase = menuUrl.split("?")[0].split("#")[0]; 214 const currentBase = currentUrl.split("?")[0].split("#")[0]; 215 if (menuBase === currentBase) { 216 score += 60; 217 } 218 } 219 return score; 220} 221const matchHandler = { 222 [MailCalender.key]: (item) => { 223 return item.items.find((menuItem) => { 224 return location.pathname.startsWith(menuItem.url); 225 }); 226 }, 227 [AIStudioNew.key]: (item) => { 228 return item.items.find((menuItem) => { 229 return location.pathname.startsWith(menuItem.url); 230 }); 231 }, 232 [ZCP.key]: (item) => { 233 const result = item.items.find((menuItem) => { 234 let menuUrl = menuItem.url; 235 if (menuUrl.startsWith("http")) { 236 try { 237 const urlObj = new URL(menuUrl); 238 menuUrl = urlObj.pathname + urlObj.hash; 239 } catch (e) { 240 } 241 } 242 const currentPath = location.pathname + location.hash; 243 const isMatch = currentPath.startsWith(menuUrl) || menuUrl.startsWith(currentPath); 244 return isMatch; 245 }); 246 return result; 247 } 248}; 249function getMenuItemByURL(menuList, targetPath = location.pathname + location.hash) { 250 const allMatches = []; 251 if (targetPath === "/") { 252 return; 253 } 254 function searchInItems(items, parent = null) { 255 if (!Array.isArray(items)) return; 256 for (const item of items) { 257 if (matchHandler[item.key]) { 258 const result = matchHandler[item.key](item); 259 if (result) { 260 const matchItem = __spreadProps(__spreadValues({}, result), { parent: item }); 261 allMatches.push(__spreadProps(__spreadValues({}, matchItem), { 262 matchScore: 50 263 })); 264 break; 265 } 266 } else { 267 if (item.url && item.target !== "_blank" && isPathMatch(item.url, targetPath)) { 268 const matchItem = parent ? __spreadProps(__spreadValues({}, item), { parent }) : item; 269 const score = calculateMatchScore(item.url, targetPath); 270 allMatches.push(__spreadProps(__spreadValues({}, matchItem), { 271 matchScore: score 272 })); 273 } 274 } 275 if (Array.isArray(item.items)) { 276 searchInItems(item.items, item); 277 } 278 } 279 } 280 searchInItems(menuList); 281 if (allMatches.length === 0) { 282 return null; 283 } 284 if (allMatches.length === 1) { 285 return allMatches[0]; 286 } 287 allMatches.sort((a, b) => b.matchScore - a.matchScore); 288 return allMatches[0]; 289} 290function initializeSideMenuData(rawMenus, suffixCommand) { 291 const processMenuItem = (item, suffixCommand2) => { 292 if (!item) return item; 293 const processedItem = __spreadProps(__spreadValues({}, item), { 294 key: item.key || item.id 295 }); 296 if (suffixCommand2) { 297 processedItem.command = suffixCommand2; 298 } 299 if (Array.isArray(item.items) && item.items.length > 0) { 300 processedItem.items = item.items.filter((childItem) => childItem).map(processMenuItem); 301 } else if (item.dynamicSubMenu || item.key === ZCP.key || item.id === ZCP.key) { 302 processedItem.items = []; 303 } 304 return processedItem; 305 }; 306 if (!Array.isArray(rawMenus)) { 307 console.warn("initializeSideMenuData: Expected array but received:", typeof rawMenus); 308 return []; 309 } 310 return rawMenus.filter((menu) => menu).map((menu) => processMenuItem(menu, suffixCommand)); 311}
312const findDuplicates = (arr) => { 313 const seen = /* @__PURE__ */ new Set(); 314 const duplicates = /* @__PURE__ */ new Set(); 315 for (let item of arr) { 316 if (seen.has(item)) { 317 duplicates.add(item); 318 } else { 319 seen.add(item); 320 } 321 } 322 return Array.from(duplicates); 323}; 324const determinePersonalOnlyMode = () => { 325 var _a2; 326 const { adminSideMenus = [] } = window.microsDatas; 327 if (!adminSideMenus.length) { 328 return true; 329 } 330 const validMenus = adminSideMenus.filter( 331 (menu) => !menu.items || menu.items.length > 0 || KEEP_KEYS.includes(menu.id) 332 ); 333 if (validMenus.length === 1) { 334 const [menu] = validMenus; 335 const hasAccountProfile = menu.id === "menu-account-management" && ((_a2 = menu.items) == null ? void 0 : _a2.length) === 1 && menu.items[0].id === "account-menu-item-profile"; 336 return hasAccountProfile; 337 } 338 return false; 339}; 340function fetchToken(tokenUrl) { 341 return __async(this, null, function* () { 342 const tokenURL = `${tokenUrl}`; 343 return yield post(tokenURL, true)(); 344 }); 345} 346const ZCC_FILTER_REG = /^x([-])zm\1.+/i; 347const DEFAULT_FILTER_REG = /^x([-_])zm\1.+/i; 348function fetchMenu(token, menuAPI, config) { 349 return __async(this, null, function* () { 350 const { access_token } = token; 351 const options = { 352 Authorization: "Bearer " + access_token, 353 lang: locale.replace("-", "_") 354 }; 355 Object.keys(token).forEach((key) => { 356 if (config.key === ZCC.key ? ZCC_FILTER_REG.test(key) : DEFAULT_FILTER_REG.test(key)) { 357 options[key] = token[key]; 358 } 359 }); 360 const menus = yield get(menuAPI, options, true)(); 361 const fixedMenus = Array.isArray(menus) ? menus : Array.isArray(menus.result) ? menus.result : []; 362 return fixedMenus.map((menuItem) => { 363 const { text, key, jsonText, beta, badge, isNew } = menuItem; 364 const { href } = JSON.parse(jsonText); 365 const menuData = { 366 label: text, 367 url: href, 368 key 369 }; 370 if (beta) { 371 menuData.badge = { 372 type: "custom", 373 text: "BETA", 374 color: "purple" 375 }; 376 } 377 if (isNew) { 378 menuData.badge = { 379 type: "custom", 380 text: "New", 381 color: "blue" 382 }; 383 } 384 if (badge) { 385 menuData.badge = badge; 386 } 387 return menuData; 388 }); 389 }); 390} 391function useLoadMenu() { 392 return __async(this, arguments, function* (config = {}, forceLoad) { 393 var _a2; 394 const userid = ((_a2 = window.microsDatas) == null ? void 0 : _a2.userId) || "$sideMenu"; 395 const prefix2 = userid.substring(0, 6); 396 const { key, tokenUrl, menuAPI } = config; 397 if (!forceLoad) { 398 const menuFromSession = getSessionStorage(`${prefix2}-${key}`); 399 if (menuFromSession) { 400 const { locale: _locale, menus } = JSON.parse(menuFromSession); 401 if (_locale === locale) { 402 return menus; 403 } 404 } 405 } 406 try { 407 config.loaded = true; 408 const token = yield fetchToken(tokenUrl); 409 const menus = yield fetchMenu(token, menuAPI, config); 410 if (menus.length) { 411 setSessionStorage(`${prefix2}-${key}`, JSON.stringify({ locale, menus })); 412 } 413 return menus; 414 } catch (error) { 415 console.error(error); 416 } 417 }); 418} 419const { t: t$1 } = i18n.global; 420const getMenuByKeyOrId$1 = (menuData, key) => { 421 if (!key) { 422 return; 423 } 424 return menuData.find((item) => item.key === key || item.id === key); 425}; 426const getAncestorKeysByIdOrKey$1 = (menus, idOrKey) => { 427 const dfs = (items, ancestors = []) => { 428 if (!Array.isArray(items)) return null; 429 for (const item of items) { 430 const matched = (item == null ? void 0 : item.key) === idOrKey || (item == null ? void 0 : item.id) === idOrKey; 431 if (matched) return ancestors; 432 if (Array.isArray(item == null ? void 0 : item.items) && item.items.length) { 433 const nextAncestors = (item == null ? void 0 : item.key) ? [...ancestors, item.key] : ancestors; 434 const found = dfs(item.items, nextAncestors); 435 if (found) return found; 436 } 437 } 438 return null; 439 };
440 return dfs(menus) || []; 441}; 442const hasZCPCache = () => { 443 var _a2; 444 const userid = ((_a2 = window.microsDatas) == null ? void 0 : _a2.userId) || "$sideMenu"; 445 const prefix2 = userid.substring(0, 6); 446 const cacheKey = `${prefix2}-${ZCP.key}`; 447 const cached = getSessionStorage(cacheKey); 448 if (!cached) return false; 449 try { 450 const { locale: cachedLocale, menus } = JSON.parse(cached); 451 return cachedLocale === locale && Array.isArray(menus) && menus.length > 0; 452 } catch (e) { 453 return false; 454 } 455}; 456function usePersonal({ props, emit }) { 457 var _a2; 458 const { sideMenuActiveKey, personalSideMenus, adminSideMenus } = window.microsDatas; 459 const sideMenusData = ref([]); 460 const expandRowKeys = ref([]); 461 const activeKey = ref(""); 462 const loadedDynamicMenus = ref(/* @__PURE__ */ new Set()); 463 const loadingDynamicMenus = ref(/* @__PURE__ */ new Set()); 464 const findActiveMenu = () => { 465 const pathMatch = getMenuItemByURL(sideMenusData.value); 466 if (pathMatch) { 467 return { type: "path", target: pathMatch }; 468 } 469 const keyMatch = getMenuItemByProps(toRaw(sideMenusData.value), sideMenuActiveKey, "key"); 470 if (keyMatch == null ? void 0 : keyMatch.item) { 471 return { type: "key", target: keyMatch }; 472 } 473 const reserveKeyMatch = getMenuItemByProps( 474 toRaw(sideMenusData.value), 475 sideMenuActiveKey, 476 "reserveKey" 477 ); 478 if (reserveKeyMatch == null ? void 0 : reserveKeyMatch.item) { 479 return { type: "reserveKey", target: reserveKeyMatch }; 480 } 481 }; 482 const setActiveMenu = (idOrKey) => { 483 var _a3; 484 if (!idOrKey) { 485 return; 486 } 487 const targetMenu = (_a3 = getMenuItemByProps(sideMenusData.value, idOrKey, "id")) != null ? _a3 : getMenuItemByProps(sideMenusData.value, idOrKey, "key"); 488 if (!targetMenu) { 489 return; 490 } 491 const { item, parent } = targetMenu; 492 activeKey.value = item.key; 493 const ancestorKeys = getAncestorKeysByIdOrKey$1(sideMenusData.value, item.key || item.id); 494 if (ancestorKeys.length) { 495 expandRowKeys.value = ancestorKeys; 496 return; 497 } 498 expandRowKeys.value = (parent == null ? void 0 : parent.key) ? [parent.key] : []; 499 }; 500 const handlerZRAMenu = (zraMenus) => { 501 const pathChecker = (menu) => { 502 var _a3; 503 const pathname = window.location.pathname; 504 const baseUrl = `/${((_a3 = window.__kiwi__) == null ? void 0 : _a3.zoomIqBaseUrl) || "kiwi"}`; 505 const isUsingOtherApp = !pathname.startsWith(baseUrl); 506 const isFromSharedPage = pathname.startsWith(`${baseUrl}/share`) || pathname.startsWith(`${baseUrl}/client/share`); 507 const isFromTeamsPage = pathname.startsWith(`${baseUrl}/teams`); 508 return isUsingOtherApp || isFromSharedPage || isFromTeamsPage || menu.routerPath === "/teams"; 509 }; 510 const navigateToRoute = (routerPath) => { 511 var _a3; 512 try { 513 const router = (_a3 = window.__kiwi__) == null ? void 0 : _a3.router; 514 if (router == null ? void 0 : router.push) { 515 router.push(routerPath); 516 } else { 517 console.warn("Router not available"); 518 } 519 } catch (error) { 520 console.error("Navigation error:", error); 521 } 522 }; 523 zraMenus.forEach((menu) => { 524 menu.command = ({ originalEvent }) => { 525 if (pathChecker(menu)) return; 526 originalEvent.preventDefault(); 527 navigateToRoute(menu.routerPath); 528 setActiveMenu(menu.key); 529 }; 530 }); 531 }; 532 const handlerQmMenu = (qmMenus) => { 533 const pathChecker = (menu) => { 534 var _a3; 535 const pathname = window.location.pathname; 536 const baseUrl = `/${((_a3 = window.__qm__) == null ? void 0 : _a3.zoomIqBaseUrl) || "kiwi"}`; 537 const isUsingOtherApp = !pathname.startsWith(`${baseUrl}/qm`); 538 const isFromTeamsPage = pathname.startsWith(`${baseUrl}/qm/teams`); 539 return isUsingOtherApp || isFromTeamsPage || menu.routerPath === "/qm/teams"; 540 }; 541 const navigateToRoute = (routerPath) => { 542 var _a3; 543 try { 544 const router = (_a3 = window.__qm__) == null ? void 0 : _a3.router; 545 if (router == null ? void 0 : router.push) { 546 router.push(routerPath); 547 } else { 548 console.warn("Router not available"); 549 } 550 } catch (error) { 551 console.error("Navigation error:", error); 552 } 553 };
554 qmMenus.forEach((menu) => { 555 menu.command = ({ originalEvent }) => { 556 if (pathChecker(menu)) return; 557 originalEvent.preventDefault(); 558 navigateToRoute(menu.routerPath); 559 setActiveMenu(menu.key); 560 }; 561 }); 562 }; 563 const toggleExpand = (menuId) => { 564 if (!menuId) { 565 return; 566 } 567 const target = getMenuByKeyOrId$1(sideMenusData.value, menuId); 568 if (!target) { 569 return; 570 } 571 if (expandRowKeys.value.includes(target.key)) { 572 expandRowKeys.value = expandRowKeys.value.filter((key) => key !== target.key); 573 } else { 574 expandRowKeys.value.push(target.key); 575 } 576 }; 577 const findMenuByKey = (menus, key) => { 578 for (const menu of menus) { 579 if (menu.key === key || menu.id === key) { 580 return menu; 581 } 582 if (menu.items) { 583 const found = findMenuByKey(menu.items, key); 584 if (found) return found; 585 } 586 } 587 return null; 588 }; 589 const loadDynamicSubMenu = (menuKey, forceLoad = false) => __async(this, null, function* () { 590 if (!forceLoad && (loadedDynamicMenus.value.has(menuKey) || loadingDynamicMenus.value.has(menuKey))) { 591 return; 592 } 593 if (menuKey !== ZCP.key) { 594 return; 595 } 596 const targetMenu = findMenuByKey(sideMenusData.value, menuKey); 597 if (!targetMenu) { 598 return; 599 } 600 try { 601 loadingDynamicMenus.value.add(menuKey); 602 const subMenus = yield useLoadMenu(ZCP, forceLoad); 603 if (subMenus && subMenus.length > 0) { 604 targetMenu.items = subMenus; 605 loadedDynamicMenus.value.add(menuKey); 606 } 607 } catch (error) { 608 console.error("[Personal Menu] Failed to load ZCP sub menu:", error); 609 } finally { 610 loadingDynamicMenus.value.delete(menuKey); 611 } 612 }); 613 watch( 614 expandRowKeys, 615 (_0, ..._1) => __async(this, [_0, ..._1], function* (newKeys, oldKeys = []) { 616 const expandedKeys = newKeys.filter((key) => !oldKeys.includes(key)); 617 for (const key of expandedKeys) { 618 const menu = findMenuByKey(sideMenusData.value, key); 619 if (menu && (!menu.items || menu.items.length === 0)) { 620 yield loadDynamicSubMenu(key); 621 yield nextTick(); 622 } 623 } 624 }), 625 { deep: true } 626 ); 627 const initializeMenuSystemRecommended = () => { 628 const menuList2 = initializeSideMenuData(personalSideMenus); 629 const zraContainer = menuList2.find((menu) => menu.id === "kiwi_column_container"); 630 if (zraContainer == null ? void 0 : zraContainer.items) { 631 handlerZRAMenu(zraContainer.items); 632 } 633 const qmContainer = menuList2.find((menu) => menu.id === "kiwi_qm_column_container"); 634 if (qmContainer == null ? void 0 : qmContainer.items) { 635 handlerQmMenu(qmContainer.items); 636 } 637 return menuList2; 638 }; 639 const menuList = initializeMenuSystemRecommended(); 640 sideMenusData.value = menuList; 641 if (!props.showPersonalOnly && sideMenusData.value.length) { 642 sideMenusData.value.unshift({ 643 title: t$1("sideMenu.personal"), 644 id: "personal-menu" 645 }); 646 } else if (props.showPersonalOnly && Array.isArray(adminSideMenus)) { 647 const accountMenu = adminSideMenus.find((menu) => menu.id === "menu-account-management"); 648 const accountProfile = (_a2 = accountMenu == null ? void 0 : accountMenu.items) == null ? void 0 : _a2.find( 649 (menu) => menu.id === "account-menu-item-profile" 650 ); 651 if (accountProfile) { 652 sideMenusData.value.push(accountProfile); 653 } 654 } 655 const rematchAfterLoad = () => { 656 var _a3; 657 const pathMatch = getMenuItemByURL(sideMenusData.value); 658 if (pathMatch) { 659 const matchedKey = pathMatch.key || pathMatch.id; 660 if (matchedKey) { 661 activeKey.value = matchedKey; 662 const ancestorKeys = getAncestorKeysByIdOrKey$1(sideMenusData.value, matchedKey); 663 if (ancestorKeys.length > 0) { 664 expandRowKeys.value = ancestorKeys; 665 } else if ((_a3 = pathMatch.parent) == null ? void 0 : _a3.key) { 666 expandRowKeys.value = [pathMatch.parent.key]; 667 } 668 if (emit) { 669 emit("zcp-loaded", { activeMenu: pathMatch }); 670 } 671 } 672 } else { 673 console.log("[ZCP] No URL match found after load"); 674 } 675 }; 676 nextTick(() => __async(this, null, function* () { 677 const zcpMenu = findMenuByKey(sideMenusData.value, ZCP.key); 678 if (!zcpMenu) { 679 return; 680 } 681 const hasCacheData = hasZCPCache(); 682 try { 683 yield loadDynamicSubMenu(ZCP.key, !hasCacheData); 684 yield nextTick(); 685 rematchAfterLoad(); 686 } catch (err) { 687 console.error("[ZCP] Failed to load from cache:", err); 688 } 689 })); 690 return { 691 sideMenusData, 692 expandRowKeys, 693 activeKey, 694 setActiveMenu, 695 findActiveMenu, 696 toggleExpand 697 }; 698} 699const _hoisted_1$3 = { 700 key: 1, 701 "aria-hidden": "true", 702 class: "fe-popups-side-menu__item-placeholder" 703}; 704const _hoisted_2$3 = { 705 key: 3, 706 class: "fe-popups-side-menu__item-title" 707}; 708const _hoisted_3$2 = { 709 key: 4, 710 class: "fe-popups-side-menu__item-label" 711}; 712const _hoisted_4$2 = { class: "fe-popups-side-menu__item-label-inner" }; 713const _sfc_main$4 = /* @__PURE__ */ Object.assign({ name: "personal-side-menu" }, { 714 __name: "personal-menu", 715 props: { 716 showPersonalOnly: Boolean 717 }, 718 emits: ["loaded", "zcp-loaded"], 719 setup(__props, { expose: __expose, emit: __emit }) { 720 const props = __props; 721 const emit = __emit; 722 const personalSideMenuRef = useTemplateRef("personalSideMenuRef"); 723 const { sideMenusData, expandRowKeys, activeKey, setActiveMenu, toggleExpand, findActiveMenu }
723 = usePersonal({ 724 props, 725 emit 726 // 传递 emit 给 composable 727 }); 728 const getIconClass = (expanded) => { 729 return [ 730 "fe-popups-side-menu__submenu-icon", 731 expanded && "fe-popups-side-menu__submenu-icon--expanded" 732 ]; 733 }; 734 const handleExpandChange = (newExpandKeys) => { 735 expandRowKeys.value = newExpandKeys; 736 }; 737 onMounted(() => { 738 emit("loaded"); 739 }); 740 __expose({ 741 personalSideMenuRef, 742 menusData: sideMenusData, 743 setActiveMenu, 744 toggleExpand, 745 findActiveMenu 746 }); 747 return (_ctx, _cache) => { 748 const _component_zm_icon = resolveComponent("zm-icon"); 749 const _component_zm_badge = resolveComponent("zm-badge"); 750 const _component_zm_visually_hidden = resolveComponent("zm-visually-hidden"); 751 const _component_zm_side_menu = resolveComponent("zm-side-menu"); 752 return unref(sideMenusData).length ? (openBlock(), createBlock(_component_zm_side_menu, { 753 key: 0, 754 ref_key: "personalSideMenuRef", 755 ref: personalSideMenuRef, 756 data: unref(sideMenusData), 757 "active-key": unref(activeKey), 758 "expand-row-keys": unref(expandRowKeys), 759 "auto-active": false, 760 "aria-label": "Personal menu", 761 height: "auto", 762 class: "frame-side-menu", 763 "onUpdate:expandRowKeys": handleExpandChange 764 }, { 765 item: withCtx(({ id, item, label, title, submenu, expanded, placeholder }) => [ 766 submenu ? (openBlock(), createBlock(unref(ZmInlineChevronIcon), { 767 key: 0, 768 size: "16px", 769 class: normalizeClass(getIconClass(expanded)) 770 }, null, 8, ["class"])) : createCommentVNode("", true), 771 !submenu && !placeholder || placeholder ? (openBlock(), createElementBlock("span", _hoisted_1$3)) : createCommentVNode("", true), 772 item.icon ? (openBlock(), createBlock(_component_zm_icon, { 773 key: 2, 774 class: "fe-popups-side-menu__item-icon" 775 }, { 776 default: withCtx(() => [ 777 (openBlock(), createBlock(resolveDynamicComponent(item.icon))) 778 ]), 779 _: 2 780 }, 1024)) : createCommentVNode("", true), 781 title ? (openBlock(), createElementBlock("span", _hoisted_2$3, toDisplayString(title), 1)) : (openBlock(), createElementBlock("span", _hoisted_3$2, [ 782 createBaseVNode("span", _hoisted_4$2, toDisplayString(label), 1) 783 ])), 784 item.badge ? (openBlock(), createElementBlock(Fragment, { key: 5 }, [ 785 item.badge.type === "custom" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [ 786 createVNode(_component_zm_badge, { 787 class: "fe-popups-side-menu__item-badge", 788 type: item.badge.type, 789 text: item.badge.text, 790 color: item.badge.color 791 }, null, 8, ["type", "text", "color"]), 792 createVNode(_component_zm_visually_hidden, { id }, { 793 default: withCtx(() => [ 794 createTextVNode(toDisplayString(item.badge.text), 1) 795 ]), 796 _: 2 797 }, 1032, ["id"]) 798 ], 64)) : createCommentVNode("", true) 799 ], 64)) : createCommentVNode("", true), 800 item.target && item.target === "_blank" ? (openBlock(), createBlock(_component_zm_icon, { 801 key: 6, 802 class: "fe-popups-side-menu__item-icon-pop" 803 }, { 804 default: withCtx(() => [ 805 createVNode(unref(PopWindowPopOutV2)) 806 ]), 807 _: 1 808 })) : createCommentVNode("", true) 809 ]), 810 _: 1 811 }, 8, ["data", "active-key", "expand-row-keys"])) : createCommentVNode("", true); 812 }; 813 } 814}); 815function fetchConfigData(accessToken) { 816 return __async(this, null, function* () { 817 var _a2; 818 const defaultResponse = { 819 configs: { 820 asyncWebportal: { 821 menus: [ 822 { 823 id: "domain", 824 path: "/domain", 825 enabled: true, 826 visiblePermissions: ["mailAndCalendarManagement"], 827 translationKey: "sidemenu.manage.domain_management", 828 fallbackTranslation: "Domain Management" 829 }, 830 { 831 id: "mailbox", 832 path: "/mailbox", 833 enabled: true, 834 visiblePermissions: ["mailAndCalendarManagement"], 835 translationKey: "sidemenu.manage.mailbox_management", 836 fallbackTranslation: "Mailbox Management" 837 }, 838 { 839 id: "mailinglist", 840 path: "/mailinglist", 841 enabled: true, 842 visiblePermissions: ["mailAndCalendarManagement"], 843 translationKey: "sidemenu.manage.mailinglist_management", 844 fallbackTranslation: "Mailing List Management" 845 }, 846 { 847 id: "security", 848 path: "/security", 849 enabled: true, 850 visiblePermissions: ["mailAndCalendarManagement"], 851 translationKey: "sidemenu.manage.security_management", 852 fallbackTranslation: "Security Management" 853 }, 854 { 855 id: "legal", 856 path: "/legal", 857 enabled: true, 858 visiblePermissions: ["allLegalCases", "myLegalCases"], 859 translationKey: "sidemenu.manage.legal_management", 860 fallbackTranslation: "Legal Management" 861 } 862 ] 863 } 864 }, 865 permissions: { 866 allLegalCases: true, 867 escrow: false, 868 mailAndCalendarManagement: true, 869 myLegalCases: true 870 } 871 }; 872 try { 873 const response = yield get( 874 `https://${window.MailcalEmailDomain}/zgroup/v1/configs?configName=asyncWebportal`, 875 { 876 Authorization: "Bearer " + accessToken 877 }, 878 true 879 )(); 880 return ((_a2 = response == null ? void 0 : response.configs) == null ? void 0 : _a2.asyncWebportal) ? response : defaultResponse; 881 } catch (e) { 882 return defaultResponse; 883 } 884 }); 885} 886function processMenus(response) { 887 const pathPrefix = "/account/mailcal"; 888 const translations = window.MailcalTranslations || {}; 889 const processedMenus = []; 890 const stack = [...response.configs.asyncWebportal.menus].reverse(); 891 while (stack.length) { 892 const item = stack.pop(); 893 if (!item.enabled) { 894 continue; 895 } 896 if (item.children && item.children.length) { 897 stack.push(...item.children.reverse()); 898 continue; 899 } 900 if (!hasPermission(item.visiblePermissions, response.permissions)) { 901 continue; 902 } 903 const menuItem = { 904 id: item.id, 905 url: pathPrefix + item.path.replace(/\/+$/, ""), 906 key: `menu-mail-calendar-${item.id}`, 907 label: translations[item.translationKey] || item.fallbackTranslation, 908 originalItem: item 909 }; 910 processedMenus.push(menuItem); 911 } 912 return processedMenus; 913} 914function hasPermission(visiblePermissions, userPermissions = {}) { 915 if (!visiblePermissions) return true; 916 if (visiblePermissions.includes("*")) return true; 917 return visiblePermissions.some((permission) => userPermissions[permission]); 918}
919function useMailCalendar() { 920 function getMenuData() { 921 return __async(this, arguments, function* (config = {}, forceLoad) { 922 var _a2; 923 const userid = ((_a2 = window.microsDatas) == null ? void 0 : _a2.userId) || "$sideMenu"; 924 const prefix2 = userid.substring(0, 6); 925 if (!forceLoad) { 926 const menuFromSession = getSessionStorage(`${prefix2}-mail-calendar`); 927 if (menuFromSession) { 928 return JSON.parse(menuFromSession); 929 } 930 } 931 config.loaded = true; 932 const response = yield window.mailAndCalendarManagement.initPromise; 933 const configData = yield fetchConfigData(response.accessToken); 934 const processedMenus = processMenus(configData); 935 setSessionStorage(`${prefix2}-mail-calendar`, JSON.stringify(processedMenus)); 936 return processedMenus; 937 }); 938 } 939 return { 940 getMenuData 941 }; 942} 943const { t } = i18n.global; 944const getMenuByKeyOrId = (menuData, key) => { 945 if (!key) { 946 return; 947 } 948 return menuData.find((item) => item.key === key || item.id === key); 949}; 950const getAncestorKeysByIdOrKey = (menus, idOrKey) => { 951 const dfs = (items, ancestors = []) => { 952 if (!Array.isArray(items)) return null; 953 for (const item of items) { 954 const matched = (item == null ? void 0 : item.key) === idOrKey || (item == null ? void 0 : item.id) === idOrKey; 955 if (matched) return ancestors; 956 if (Array.isArray(item == null ? void 0 : item.items) && item.items.length) { 957 const nextAncestors = (item == null ? void 0 : item.key) ? [...ancestors, item.key] : ancestors; 958 const found = dfs(item.items, nextAncestors); 959 if (found) return found; 960 } 961 } 962 return null; 963 };
964 return dfs(menus) || []; 965}; 966const resolveMenuTarget = (menuList, key) => { 967 var _a2; 968 const cxMenu = getMenuByKeyOrId(menuList, CX_MANAGEMENT_ID); 969 return (_a2 = getMenuByKeyOrId((cxMenu == null ? void 0 : cxMenu.items) || [], key)) != null ? _a2 : getMenuByKeyOrId(menuList, key); 970}; 971const hasOnlyAccountProfile = (menus) => { 972 var _a2, _b; 973 const menu = menus[0]; 974 return menus.length === 1 && (menu == null ? void 0 : menu.id) === "menu-account-management" && ((_a2 = menu.items) == null ? void 0 : _a2.length) === 1 && ((_b = menu.items[0]) == null ? void 0 : _b.id) === "account-menu-item-profile"; 975}; 976const { isAccountSetupPBX, pbxVersionSwitch } = ((_a = window.microsDatas) == null ? void 0 : _a.sideMenuConfig) || {}; 977const shouldLoadPBXVersions = isAccountSetupPBX && (pbxVersionSwitch == null ? void 0 : pbxVersionSwitch.pbx_1_6_0); 978const menuConfigMap = { 979 pbx: { key: "pbx_column_container", config: PBX, condition: shouldLoadPBXVersions }, 980 zcc: { 981 key: "contact_center_column_container", 982 config: ZCC, 983 condition: pbxVersionSwitch == null ? void 0 : pbxVersionSwitch.pbx_1_6_0 984 }, 985 zcp: { key: "phone_number_management_column_container", config: ZCP, condition: true }, 986 aiStudioNew: { key: "new_ai_studio_column_container", config: AIStudioNew, condition: true }, 987 aiStudio: { key: "ai_studio_column_container", config: AIStudio, condition: true }, 988 zva: { key: "zva_column_container", config: ZVA, condition: true }, 989 mailCalendar: { 990 key: "sidemenu-mail-calendar-management", 991 config: MailCalender, 992 condition: window.__user_enabled_mail_and_calendar 993 } 994}; 995function useAdmin({ emit, handlerAfterLoaded }) { 996 const { sideMenuActiveKey, personalSideMenus, adminSideMenus } = window.microsDatas; 997 const showAdminMenu = ref(false); 998 const getPrerenderMenu = () => { 999 const tempMenus = initializeSideMenuData(adminSideMenus).filter( 1000 (menu) => !menu.items || menu.items.length || KEEP_KEYS.includes(menu.key) 1001 ); 1002 const isAccountProfileOnly = hasOnlyAccountProfile(tempMenus); 1003 if (tempMenus.length && !isAccountProfileOnly) { 1004 tempMenus.unshift({ 1005 title: t("sideMenu.admin"), 1006 id: "admin-menu" 1007 }); 1008 showAdminMenu.value = true; 1009 } 1010 return tempMenus; 1011 }; 1012 const sideMenusData = ref(getPrerenderMenu()); 1013 const expandRowKeys = ref([]); 1014 const activeKey = ref(""); 1015 const initializeMenus = initializeSideMenuData(adminSideMenus); 1016 const refreshActivateMenu = (parentMenu = null) => { 1017 var _a2; 1018 if (parentMenu) { 1019 for (const key in menuConfigMap) { 1020 const { item } = getMenuItemByProps(initializeMenus, parentMenu.key, "key") || {}; 1021 if (menuConfigMap[key].key === parentMenu.key && !menuConfigMap[key].config.loaded && !((_a2 = item == null ? void 0 : item.items) == null ? void 0 : _a2.length)) { 1022 refresh(key); 1023 break; 1024 } 1025 } 1026 } 1027 }; 1028 const findActiveMenu = () => { 1029 const pathMatch = getMenuItemByURL(toRaw(sideMenusData.value)); 1030 if (pathMatch) { 1031 refreshActivateMenu(pathMatch.parent); 1032 return { type: "path", target: pathMatch }; 1033 } 1034 const keyMatch = getMenuItemByProps(toRaw(sideMenusData.value), sideMenuActiveKey, "key"); 1035 if (keyMatch == null ? void 0 : keyMatch.item) { 1036 refreshActivateMenu(keyMatch.parent); 1037 return { type: "key", target: keyMatch }; 1038 } 1039 const reserveKeyMatch = getMenuItemByProps( 1040 toRaw(sideMenusData.value), 1041 sideMenuActiveKey, 1042 "reserveKey" 1043 ); 1044 if (reserveKeyMatch == null ? void 0 : reserveKeyMatch.item) { 1045 refreshActivateMenu(reserveKeyMatch.parent); 1046 return { type: "reserveKey", target: reserveKeyMatch }; 1047 } 1048 }; 1049 const getMenuConfigs = () => { 1050 return Object.keys(menuConfigMap).filter((aliasKey) => { 1051 const { key, condition } = menuConfigMap[aliasKey]; 1052 const targetMenu = resolveMenuTarget(initializeMenus, key); 1053 if ((targetMenu == null ? void 0 : targetMenu.items.length) && Array.isArray(targetMenu.items)) { 1054 if (menuConfigMap[aliasKey].config) { 1055 menuConfigMap[aliasKey].config.loaded = true; 1056 } 1057 } 1058 return targetMenu && !targetMenu.items.length && condition; 1059 }).map((aliasKey) => { 1060 const { config } = menuConfigMap[aliasKey]; 1061 return config; 1062 }); 1063 }; 1064 const processMenuItems = (menuItems = [], config) => { 1065 return menuItems.map((menuItem) => { 1066 var _a2, _b, _c, _d; 1067 if (config.key === PBX.key) { 1068 const pathname = (_a2 = menuItem.url) == null ? void 0 : _a2.split("?p")[0]; 1069 const moduleName = pathname.split("/pbx/page/telephone/")[1]; 1070 menuItem.key = moduleName; 1071 } 1072 if (config.key === ZCP.key && ((_b = menuItem.key) == null ? void 0 : _b.includes(" "))) { 1073 menuItem.key = (_c = menuItem.url) == null ? void 0 : _c.split("#/")[1]; 1074 } 1075 if ((config.key === AIStudio.key || config.key === AIStudioNew.key) && !menuItem.key) { 1076 const pathSegments = ((_d = menuItem.url) == null ? void 0 : _d.split("/").filter(
1076Boolean)) || []; 1077 menuItem.key = pathSegments.join("-"); 1078 } 1079 if (!menuItem.id && menuItem.key) { 1080 menuItem.id = config.menuPrefix ? `${config.menuPrefix}-${menuItem.key}` : menuItem.key; 1081 } 1082 if (config.key === MailCalender.key) { 1083 menuItem.command = ({ originalEvent, item }) => { 1084 if (window.location.pathname.startsWith("/account/mailcal/")) { 1085 originalEvent.preventDefault(); 1086 activeKey.value = item.key; 1087 window.history.pushState(null, "", item.url); 1088 } 1089 }; 1090 } else { 1091 menuItem.command = ({ item }) => { 1092 if (menuItem.target !== "_blank") { 1093 activeKey.value = item.key; 1094 } 1095 }; 1096 } 1097 return menuItem; 1098 }); 1099 }; 1100 const { getMenuData } = useMailCalendar(); 1101 function loadAllMenus() { 1102 return __async(this, null, function* () { 1103 const configs = getMenuConfigs(); 1104 const promises = configs.map((config) => { 1105 if (config.key === MailCalender.key) { 1106 return getMenuData(config); 1107 } else { 1108 return useLoadMenu(config); 1109 } 1110 }); 1111 try { 1112 const results = yield Promise.allSettled(promises); 1113 results.forEach((result, index) => { 1114 const config = configs[index]; 1115 if (result.status === "fulfilled") { 1116 const menuItems = result.value; 1117 if (!Array.isArray(menuItems)) return; 1118 const processedItems = processMenuItems(menuItems, config); 1119 const targetMenu = resolveMenuTarget(initializeMenus, config.key); 1120 if (targetMenu) { 1121 targetMenu.command = () => { 1122 for (const key in menuConfigMap) { 1123 if (menuConfigMap[key].config === config && !menuConfigMap[key].config.loaded) { 1124 refresh(key); 1125 break; 1126 } 1127 } 1128 }; 1129 targetMenu.items = processedItems; 1130 } 1131 } else { 1132 console.error(`Failed to load menu for config "${config.key}":`, result.reason); 1133 } 1134 }); 1135 } catch (error) { 1136 console.error("Error loading menus:", error); 1137 } 1138 }); 1139 } 1140 const refresh = (_0, ..._1) => __async(this, [_0, ..._1], function* (aliasKey, config = {}) { 1141 var _a2, _b; 1142 if (!menuConfigMap[aliasKey] || ((_b = (_a2 = menuConfigMap[aliasKey]) == null ? void 0 : _a2.config) == null ? void 0 : _b.loaded)) { 1143 return; 1144 } 1145 try { 1146 menuConfigMap[aliasKey].config.loaded = true; 1147 const { config: _config } = menuConfigMap[aliasKey]; 1148 const mergedConfig = __spreadValues(__spreadValues({}, _config), config); 1149 const loadMethod = aliasKey === "mailCalendar" ? getMenuData : useLoadMenu; 1150 const menuItems = yield loadMethod(mergedConfig, true); 1151 const processedItems = processMenuItems(menuItems, mergedConfig); 1152 const targetMenu = getMenuByKeyOrId(sideMenusData.value, mergedConfig.key); 1153 if (targetMenu) { 1154 targetMenu.items = processedItems; 1155 } 1156 } catch (error) { 1157 console.error(error); 1158 } 1159 }); 1160 const toggleExpand = (menuId) => { 1161 if (!menuId) { 1162 return; 1163 } 1164 const target = getMenuByKeyOrId(sideMenusData.value, menuId); 1165 if (!target) { 1166 return; 1167 } 1168 if (expandRowKeys.value.includes(target.key)) { 1169 expandRowKeys.value = expandRowKeys.value.filter((key) => key !== target.key); 1170 } else { 1171 expandRowKeys.value.push(target.key); 1172 } 1173 }; 1174 const setActiveMenu = (idOrKey) => { 1175 var _a2; 1176 if (!idOrKey) { 1177 return; 1178 } 1179 const targetMenu = (_a2 = getMenuItemByProps(sideMenusData.value, idOrKey, "key")) != null ? _a2 : getMenuItemByProps(sideMenusData.value, idOrKey, "id"); 1180 if (!targetMenu) { 1181 return; 1182 } 1183 const { item, parent } = targetMenu; 1184 activeKey.value = item.key; 1185 const ancestorKeys = getAncestorKeysByIdOrKey(sideMenusData.value, item.key || item.id); 1186 if (ancestorKeys.length) { 1187 expandRowKeys.value = ancestorKeys; 1188 return; 1189 } 1190 expandRowKeys.value = (parent == null ? void 0 : parent.key) ? [parent.key] : []; 1191 }; 1192 const handlerDeviceMenu = (deviceMenu) => { 1193 const allowedRoutes = ["/device/order"]; 1194 let isAllowedRoute = false;
1195 for (var i = 0; i < allowedRoutes.length; i++) { 1196 if (location.pathname.indexOf(allowedRoutes[i]) === 0) { 1197 isAllowedRoute = true; 1198 break; 1199 } 1200 } 1201 if (!isAllowedRoute) return; 1202 deviceMenu.items.forEach((menu) => { 1203 menu.command = ({ originalEvent, item }) => { 1204 var _a2; 1205 if (window.Vue && ((_a2 = Vue == null ? void 0 : Vue.__config__) == null ? void 0 : _a2.router) && window.location.pathname.startsWith("/device")) { 1206 originalEvent.preventDefault(); 1207 Vue.__config__.router.push({ 1208 path: menu.routerPath 1209 }); 1210 activeKey.value = item.key; 1211 } 1212 }; 1213 }); 1214 }; 1215 const handlerNodeMenu = (deviceMenu) => { 1216 deviceMenu.items.forEach((menu) => { 1217 menu.command = ({ originalEvent, item }) => { 1218 var _a2; 1219 if (window.Vue && ((_a2 = Vue == null ? void 0 : Vue.__config__) == null ? void 0 : _a2.router) && window.location.pathname.startsWith("/node")) { 1220 originalEvent.preventDefault(); 1221 Vue.__config__.router.push({ 1222 path: menu.routerPath 1223 }); 1224 activeKey.value = item.key; 1225 } 1226 }; 1227 }); 1228 }; 1229 const pipelineMenus = (menus) => __async(this, null, function* () { 1230 return Promise.resolve(menus).then((menus2) => { 1231 const deviceMenu = menus2.find((menu) => menu.id === "device-management-menus"); 1232 if (deviceMenu) { 1233 handlerDeviceMenu(deviceMenu); 1234 } 1235 return menus2; 1236 }).then((menus2) => { 1237 const nodeMenu = menus2.find((menu) => menu.id === "node-management-menus"); 1238 if (nodeMenu) { 1239 handlerNodeMenu(nodeMenu); 1240 } 1241 return menus2; 1242 }).then((menus2) => { 1243 const flatMenus = menus2.flatMap((menu) => { 1244 if (menu) { 1245 return menu.items; 1246 } else return menu; 1247 }).filter(Boolean); 1248 const keys = flatMenus.map((menu) => menu.key); 1249 const duplicatedKey = findDuplicates(keys); 1250 if (duplicatedKey.length) { 1251 duplicatedKey.forEach((key) => { 1252 console.error( 1253 `Menu key - ${key} must be unique:`, 1254 flatMenus.filter((menu) => menu.key === key) 1255 ); 1256 }); 1257 } 1258 return menus2; 1259 }); 1260 }); 1261 function init() { 1262 return __async(this, null, function* () { 1263 try { 1264 yield loadAllMenus(); 1265 const fixedMenus = yield pipelineMenus(initializeMenus); 1266 const menus = fixedMenus.filter( 1267 (menu) => !menu.items || menu.items.length || KEEP_KEYS.includes(menu.key) 1268 ); 1269 const isAccountProfileOnly = hasOnlyAccountProfile(menus); 1270 if (menus.length && !isAccountProfileOnly) { 1271 if (personalSideMenus.length) { 1272 menus.unshift({ 1273 title: t("sideMenu.admin"), 1274 id: "admin-menu" 1275 }); 1276 } 1277 sideMenusData.value = menus; 1278 showAdminMenu.value = true; 1279 } 1280 if (handlerAfterLoaded) { 1281 handlerAfterLoaded(); 1282 } 1283 emit("loaded"); 1284 } catch (error) { 1285 console.error("Error initializing menus:", error); 1286 emit("loaded"); 1287 } 1288 }); 1289 } 1290 init(); 1291 return { 1292 showAdminMenu, 1293 sideMenusData, 1294 expandRowKeys, 1295 activeKey, 1296 refresh, 1297 findActiveMenu, 1298 toggleExpand, 1299 setActiveMenu 1300 }; 1301} 1302const _hoisted_1$2 = { 1303 key: 1, 1304 "aria-hidden": "true", 1305 class: "fe-popups-side-menu__item-placeholder" 1306}; 1307const _hoisted_2$2 = { 1308 key: 3, 1309 class: "fe-popups-side-menu__item-title" 1310}; 1311const _hoisted_3$1 = { 1312 key: 4, 1313 class: "fe-popups-side-menu__item-label" 1314}; 1315const _hoisted_4$1 = { class: "fe-popups-side-menu__item-label-inner" }; 1316const _sfc_main$3 = /* @__PURE__ */ Object.assign({ name: "admin-side-menu" }, { 1317 __name: "admin-menu", 1318 emits: ["loaded"], 1319 setup(__props, { expose: __expose, emit: __emit }) { 1320 const emit = __emit; 1321 const adminSideMenuRef = useTemplateRef("adminSideMenuRef"); 1322 const handlerAfterLoaded = () => { 1323 }; 1324 const { 1325 showAdminMenu, 1326 sideMenusData, 1327 activeKey, 1328 expandRowKeys, 1329 refresh, 1330 toggleExpand, 1331 findActiveMenu,
1332 setActiveMenu 1333 } = useAdmin({ 1334 emit, 1335 handlerAfterLoaded 1336 }); 1337 const getIconClass = (expanded) => { 1338 return [ 1339 "fe-popups-side-menu__submenu-icon", 1340 expanded && "fe-popups-side-menu__submenu-icon--expanded" 1341 ]; 1342 }; 1343 __expose({ 1344 adminSideMenuRef, 1345 menusData: sideMenusData, 1346 refresh, 1347 toggleExpand, 1348 findActiveMenu, 1349 setActiveMenu 1350 }); 1351 return (_ctx, _cache) => { 1352 const _component_zm_icon = resolveComponent("zm-icon"); 1353 const _component_zm_badge = resolveComponent("zm-badge"); 1354 const _component_zm_visually_hidden = resolveComponent("zm-visually-hidden"); 1355 const _component_zm_side_menu = resolveComponent("zm-side-menu"); 1356 return unref(showAdminMenu) ? (openBlock(), createBlock(_component_zm_side_menu, { 1357 key: 0, 1358 ref_key: "adminSideMenuRef", 1359 ref: adminSideMenuRef, 1360 data: unref(sideMenusData), 1361 "active-key": unref(activeKey), 1362 "expand-row-keys": unref(expandRowKeys), 1363 "auto-active": false, 1364 "aria-label": "Admin menu", 1365 height: "auto", 1366 class: "frame-side-menu" 1367 }, { 1368 item: withCtx(({ id, item, label, title, submenu, expanded, placeholder }) => [ 1369 submenu ? (openBlock(), createBlock(unref(ZmInlineChevronIcon), { 1370 key: 0, 1371 size: "16px", 1372 class: normalizeClass(getIconClass(expanded)) 1373 }, null, 8, ["class"])) : createCommentVNode("", true), 1374 placeholder ? (openBlock(), createElementBlock("span", _hoisted_1$2)) : createCommentVNode("", true), 1375 item.icon ? (openBlock(), createBlock(_component_zm_icon, { 1376 key: 2, 1377 class: "fe-popups-side-menu__item-icon" 1378 }, { 1379 default: withCtx(() => [ 1380 (openBlock(), createBlock(resolveDynamicComponent(item.icon))) 1381 ]), 1382 _: 2 1383 }, 1024)) : createCommentVNode("", true), 1384 title ? (openBlock(), createElementBlock("span", _hoisted_2$2, toDisplayString(title), 1)) : (openBlock(), createElementBlock("span", _hoisted_3$1, [ 1385 createBaseVNode("span", _hoisted_4$1, toDisplayString(label), 1) 1386 ])), 1387 item.badge ? (openBlock(), createElementBlock(Fragment, { key: 5 }, [ 1388 item.badge.type === "custom" ? (openBlock(), createBlock(_component_zm_badge, { 1389 key: 0, 1390 class: "fe-popups-side-menu__item-badge", 1391 type: item.badge.type, 1392 text: item.badge.text, 1393 color: item.badge.color 1394 }, null, 8, ["type", "text", "color"])) : createCommentVNode("", true) 1395 ], 64)) : createCommentVNode("", true), 1396 item.target && item.target === "_blank" ? (openBlock(), createBlock(_component_zm_icon, { key: 6 }, { 1397 default: withCtx(() => [ 1398 createVNode(unref(PopWindowPopOutV2)) 1399 ]), 1400 _: 1 1401 })) : createCommentVNode("", true), 1402 createVNode(_component_zm_visually_hidden, { id }, { 1403 default: withCtx(() => { 1404 var _a2; 1405 return [ 1406 ((_a2 = item == null ? void 0 : item.badge) == null ? void 0 : _a2.type) === "custom" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [ 1407 createTextVNode(toDisplayString(item.badge.text), 1) 1408 ], 64)) : createCommentVNode("", true) 1409 ]; 1410 }), 1411 _: 2 1412 }, 1032, ["id"]) 1413 ]), 1414 _: 1 1415 }, 8, ["data", "active-key", "expand-row-keys"])) : createCommentVNode("", true); 1416 }; 1417 } 1418}); 1419const _hoisted_1$1 = { class: "sidenav-banner mgb-lg pdb-md" }; 1420const _hoisted_2$1 = { 1421 key: 0, 1422 class: "mgb-md" 1423}; 1424const _hoisted_3 = ["href"]; 1425const _hoisted_4 = { 1426 key: 1, 1427 class: "mgb-md" 1428}; 1429const _hoisted_5 = ["href"]; 1430const _hoisted_6 = { 1431 key: 2, 1432 class: "mgb-md" 1433}; 1434const _hoisted_7 = ["href"]; 1435const _sfc_main$2 = { 1436 __name: "support", 1437 setup(__props) { 1438 const { learningCenter, tutorials, knowledge } = window.microsDatas.sideMenuConfig; 1439 return (_ctx, _cache) => { 1440 return openBlock(), createElementBlock("div", _hoisted_1$1, [ 1441 unref(learningCenter) ? (openBlock(), createElementBlock("p", _hoisted_2$1, [ 1442 createBaseVNode("a", { 1443 href: unref(learningCenter).url, 1444 target: "_blank" 1445 }, toDisplayString(unref(learningCenter).label), 9, _hoisted_3) 1446 ])) : createCommentVNode("", true), 1447 unref(tutorials) ? (openBlock(), createElementBlock("p", _hoisted_4, [ 1448 createBaseVNode("a", { 1449 href: unref(tutorials).url, 1450 target: "_blank" 1451 }, toDisplayString(unref(tutorials).label), 9, _hoisted_5) 1452 ])) : createCommentVNode("", true), 1453 unref(knowledge) ? (openBlock(), createElementBlock("p", _hoisted_6, [ 1454 createBaseVNode("a", { 1455 href: unref(knowledge).url, 1456 target: "_blank" 1457 }, toDisplayString(unref(knowledge).label), 9, _hoisted_7) 1458 ])) : createCommentVNode("", true) 1459 ]); 1460 }; 1461 } 1462}; 1463const support = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-7d34319c"]]); 1464function useCompanySetup() { 1465 const getReminder = () => __async(this, null, function* () { 1466 const response = yield get("/companysetup/reminder")(); 1467 const result = response || {}; 1468 if (!result || !result.showProductReminder || !result.reminderType || !result.productTypes) { 1469 return {}; 1470 } 1471 const { reminderType, productTypes, billingRebrandingType } = result; 1472 const multipleProducts = productTypes.length > 1; 1473 const isReminderType1 = reminderType == "1"; 1474 let title;
1475 let content; 1476 if (multipleProducts) { 1477 title = isReminderType1 ? $.i18n.get("billing.cstp.multiple_products.reminder1.title") : $.i18n.get("billing.cstp.multiple_products.reminder2.title"); 1478 content = isReminderType1 ? $.i18n.get("billing.cstp.multiple_products.reminder1.content") : $.i18n.get("billing.cstp.multiple_products.reminder2.content"); 1479 } else { 1480 const productType = productTypes[0]; 1481 if (productType == "phone") { 1482 title = isReminderType1 ? $.i18n.get("billing.cstp.phone.reminder1.title") : $.i18n.get("billing.cstp.phone.reminder2.title"); 1483 content = isReminderType1 ? $.i18n.get("billing.cstp.phone.reminder1.content") : $.i18n.get("billing.cstp.single_product.reminder2.content"); 1484 } else if (productType == "zoom_one_pro") { 1485 title = isReminderType1 ? $.i18n.get("billing.cstp.zop.reminder1.title") : $.i18n.get("billing.cstp.zop.reminder2.title"); 1486 content = isReminderType1 ? $.i18n.get("billing.cstp.zop.reminder1.content") : $.i18n.get("billing.cstp.single_product.reminder2.content"); 1487 } else if (productType == "zoom_one_business") { 1488 title = isReminderType1 ? $.i18n.get("billing.cstp.zob.reminder1.title") : $.i18n.get("billing.cstp.zob.reminder2.title"); 1489 content = isReminderType1 ? $.i18n.get("billing.cstp.zop.reminder1.content") : $.i18n.get("billing.cstp.single_product.reminder2.content"); 1490 } else if (productType == "zoom_one_business_plus") { 1491 title = isReminderType1 ? $.i18n.get("billing.cstp.zobp.reminder1.title") : $.i18n.get("billing.cstp.zobp.reminder2.title"); 1492 content = isReminderType1 ? $.i18n.get("billing.cstp.zobp.reminder1.content") : $.i18n.get("billing.cstp.single_product.reminder2.content"); 1493 } else if (productType == "zoom_one_pro_plus") { 1494 title = isReminderType1 ? $.i18n.get("billing.cstp.zopp.reminder1.title") : $.i18n.get("billing.cstp.zopp.reminder2.title"); 1495 content = isReminderType1 ? $.i18n.get("billing.cstp.zopp.reminder1.content") : $.i18n.get("billing.cstp.single_product.reminder2.content"); 1496 } 1497 } 1498 if (billingRebrandingType === "Workplace") { 1499 if (title.indexOf("Zoom One") != -1) { 1500 title = title.replaceAll("Zoom One", "Zoom Workplace"); 1501 } 1502 if (content.indexOf("Zoom One") != -1) { 1503 content = content.replaceAll("Zoom One", "Zoom Workplace"); 1504 } 1505 } 1506 if (title && content) { 1507 if (window.location.pathname === "/profile") { 1508 const adminSelection = isReminderType1 ? "first not started reminder - impression" : "second not completed reminder - impression"; 1509 const product = productTypes.length > 1 ? "multiple products" : (productTypes[0] || "").replaceAll("_", " "); 1510 if (window.SB && window.SB.addEventTracking) { 1511 window.SB.addEventTracking({ 1512 event: "adminInteraction", 1513 adminInteraction: "zoom admin onboarding - " + product, 1514 adminSelection 1515 }); 1516 } 1517 } 1518 } 1519 return { 1520 title, 1521 content, 1522 reminderType, 1523 productTypes 1524 }; 1525 }); 1526 const closeReminder = (productTypes, reminderType) => __async(this, null, function* () { 1527 if (window.location.pathname === "/profile" && !setupGuideMenuClick) { 1528 const adminSelection = reminderType === "1" ? "first not started reminder - close" : "second not completed reminder - close"; 1529 const product = productTypes.length > 1 ? "multiple products" : (productTypes[0] || "").replaceAll("_", " "); 1530 SB.addEventTracking({ 1531 event: "adminInteraction", 1532 adminInteraction: "zoom admin onboarding - " + product, 1533 adminSelection 1534 }); 1535 } 1536 const response = yield axios({ 1537 method: "post", 1538 url: "/companysetup/notice/close", 1539 data: {}, 1540 // {"productTypes":["phone"]} 1541 transformRequest: [ 1542 function() { 1543 return JSON.stringify({ productTypes }); 1544 } 1545 ], 1546 headers: { 1547 "Content-Type": "application/json" 1548 } 1549 }); 1550 return response; 1551 }); 1552 return { 1553 getReminder, 1554 closeReminder 1555 }; 1556} 1557function useBillingBAP() { 1558 const getPopupTitle = () => { 1559 if (window.enableBAPMenuPopUpsForFreeUser) { 1560 return $.i18n.get("billing.new_menu_tips_free.title"); 1561 } else if (window.isBAPSingleMenuPopUpsEnabled || window.isBAPChannelChange2OnlinePopUpEnabled) { 1562 return $.i18n.get("billing.new_menu_tips.title"); 1563 } else { 1564 return ""; 1565 } 1566 }; 1567 const getPopupContent = () => { 1568 if (window.enableBAPMenuPopUpsForFreeUser) { 1569 return $.i18n.get("billing.new_menu_tips_free.content"); 1570 } else if (window.isBAPSingleMenuPopUpsEnabled || window.isBAPChannelChange2OnlinePopUpEnabled) { 1571 let content = $.i18n.get("billing.new_menu_tips.content"); 1572 if (window.isBAPChannelChange2OnlinePopUpEnabled) { 1573 content = content.replace( 1574 "https://support.zoom.us/hc/articles/16542703332621", 1575 "https://support.zoom.com/hc/en/article?id=zm_kb&sysparm_article=KB0060580" 1576 ); 1577 } 1578 return content; 1579 } else { 1580 return ""; 1581 } 1582 }; 1583 const getNotice = () => __async(this, null, function* () { 1584 if (!window.enableBAPMenuPopUpsForFreeUser && !window.isBAPSingleMenuPopUpsEnabled && !window.isBAPChannelChange2OnlinePopUpEnabled) { 1585 return {}; 1586 } 1587 const title = getPopupTitle(); 1588 const content = getPopupContent(); 1589 return { 1590 title, 1591 content 1592 }; 1593 }); 1594 const closeNotice = () => __async(this, null, function* () { 1595 const response = yield axios({ 1596 method: "post", 1597 url: "/billing/notice/close", 1598 data: { 1599 from: "billingSingleMenuBanner" 1600 } 1601 }); 1602 return response; 1603 }); 1604 return { 1605 getNotice, 1606 closeNotice 1607 }; 1608} 1609function useAdminCenterGuide() { 1610 const store = getLocalstorage(`${prefix}-admin-center-guide`); 1611 const getNotice = () => __async(this, null, function* () { 1612 if (store) { 1613 return {}; 1614 } 1615 const title = "Welcome to use new admin center"; 1616 const content = `<p class="mgb-xs">A streamlined hub to stay informed and in control. </p> 1617<p>Admin Center brings key updates, tasks, and tools together so you can configure products, track requests, and act on what matters most.</p>`; 1618 return { 1619 title, 1620 content 1621 }; 1622 }); 1623 const closeNotice = () => __async(this, null, function* () {
1624 setLocalstorage(`${prefix}-admin-center-guide`, true); 1625 }); 1626 return { 1627 getNotice, 1628 closeNotice 1629 }; 1630} 1631const SCROLL_TIMEOUT = 300; 1632const TOOLTIP_CHECK_DELAY = 210; 1633const SCROLL_OFFSET = 104; 1634const MOBILE_BREAKPOINT = 1024; 1635const _sfc_main$1 = /* @__PURE__ */ Object.assign({ name: "frame-side-menu" }, { 1636 __name: "main", 1637 setup(__props, { expose: __expose }) { 1638 const menuTooltips = defineAsyncComponent(() => __vitePreload(() => Promise.resolve().then(() => tooltips$1), true ? void 0 : void 0, import.meta.url)); 1639 const personal = useTemplateRef("personal"); 1640 const admin = useTemplateRef("admin"); 1641 const tooltips2 = useTemplateRef("menuTooltipsRef"); 1642 const scrollbar = useTemplateRef("scrollbarRef"); 1643 const { 1644 // isAdminCenter, 1645 adminSideMenus = [], 1646 sideMenuActiveKey 1647 // enableAdminCenter 1648 } = window.microsDatas; 1649 const { promise: personalPromise, resolve: personalResolve } = createDeferredPromise(); 1650 const { promise: adminPromise, resolve: adminResolve } = createDeferredPromise(); 1651 const activeMenu = ref({}); 1652 const isMobile = window.innerWidth < MOBILE_BREAKPOINT; 1653 const showPersonalOnly = determinePersonalOnlyMode(); 1654 if (showPersonalOnly) { 1655 adminResolve(null); 1656 } 1657 function createDeferredPromise() { 1658 let resolve; 1659 const promise = new Promise((res) => { 1660 resolve = res; 1661 }); 1662 return { promise, resolve }; 1663 } 1664 function updateMobileSidebarTitle(activeMenuItem) { 1665 if (!isMobile || !activeMenuItem) return; 1666 const sidebarElement = findPreviousSiblingByClass("sidemenu", "sidebar-menu"); 1667 const titleElement = sidebarElement == null ? void 0 : sidebarElement.querySelector("a > span"); 1668 if (titleElement) { 1669 titleElement.textContent = activeMenuItem.label; 1670 } 1671 } 1672 function scrollToElement(targetMenuOrId) { 1673 setTimeout(() => { 1674 const targetEl = typeof targetMenuOrId === "string" ? document.getElementById(targetMenuOrId) : document.getElementById(targetMenuOrId.id); 1675 if (targetEl) { 1676 scrollbar.value.scrollYIntoView(targetEl, SCROLL_TIMEOUT, SCROLL_OFFSET); 1677 } 1678 }, SCROLL_TIMEOUT); 1679 } 1680 const onUpdateActive = (activeMenuItem) => { 1681 var _a2; 1682 const targetMenu = (_a2 = activeMenuItem.item) != null ? _a2 : activeMenuItem; 1683 if (!targetMenu) return; 1684 activeMenu.value = targetMenu; 1685 scrollToElement(targetMenu); 1686 updateMobileSidebarTitle(targetMenu); 1687 }; 1688 const onPersonalLoaded = () => { 1689 var _a2, _b; 1690 personalResolve((_b = (_a2 = personal.value) == null ? void 0 : _a2.findActiveMenu()) != null ? _b : null); 1691 }; 1692 const onZcpLoaded = ({ activeMenu: zcpActiveMenu }) => { 1693 if (zcpActiveMenu) { 1694 onUpdateActive(zcpActiveMenu); 1695 } 1696 }; 1697 const onAdminLoaded = () => { 1698 var _a2, _b; 1699 adminResolve((_b = (_a2 = admin.value) == null ? void 0 : _a2.findActiveMenu()) != null ? _b : null); 1700 }; 1701 const tooltipHandlers = { 1702 "company-setup": () => __async(this, null, function* () { 1703 var _a2; 1704 const { getReminder, closeReminder } = useCompanySetup(); 1705 const { title, content, productTypes, reminderType } = yield getReminder(); 1706 if (title && content) { 1707 const targetId = "admin-menu-item-companysetup"; 1708 scrollToElement(targetId); 1709 yield (_a2 = tooltips2.value) == null ? void 0 : _a2.show({ title, content, id: targetId }); 1710 closeReminder(productTypes, reminderType); 1711 scrollToElement(activeMenu.value); 1712 } 1713 }), 1714 "single-billing-menu": () => __async(this, null, function* () { 1715 var _a2; 1716 const { getNotice, closeNotice } = useBillingBAP(); 1717 const { title, content } = yield getNotice(); 1718 if (title && content) { 1719 const targetId = "single-billing-menu"; 1720 scrollToElement(targetId); 1721 yield (_a2 = tooltips2.value) == null ? void 0 : _a2.show({ title, content, id: targetId }); 1722 closeNotice(); 1723 scrollToElement(activeMenu.value); 1724 } 1725 }), 1726 "admin-center": () => __async(this, null, function* () { 1727 var _a2; 1728 const { getNotice, closeNotice } = useAdminCenterGuide(); 1729 const { title, content } = yield getNotice(); 1730 if (title && content) { 1731 const targetId = "admin-menu-item-admin-center"; 1732 scrollToElement(targetId); 1733 (_a2 = tooltips2.value) == null ? void 0 : _a2.show({ 1734 title, 1735 content, 1736 id: targetId, 1737 width: "400px", 1738 confirmButtonText: "Got it" 1739 }).then(() => { 1740 closeNotice(); 1741 scrollToElement(activeMenu.value); 1742 }); 1743 } 1744 }) 1745 }; 1746 const checkTooltips = () => __async(this, null, function* () { 1747 var _a2; 1748 if (isMobile) return; 1749 if (getMenuItemByProps(adminSideMenus, "company-setup", "key")) { 1750 yield tooltipHandlers["company-setup"](); 1751 } else if (getMenuItemByProps(adminSideMenus, "single-billing-menu", "id")) { 1752 yield tooltipHandlers["single-billing-menu"](); 1753 } else if (personal.value && getMenuItemByProps((_a2 = personal.value) == null ? void 0 : _a2.menusData, "admin-menu-item-admin-center", "id")) { 1754 yield tooltipHandlers["admin-center"](); 1755 } 1756 }); 1757 const getMenuKey = (menuResult) => { 1758 var _a2, _b; 1759 const { target } = menuResult; 1760 return (_b = (_a2 = target == null ? void 0 : target.item) == null ? void 0 : _a2.key) != null ? _b : target == null ? void 0 : target.key; 1761 }; 1762 const setActiveMenu = (menuComponent, targetKey) => { 1763 if ((menuComponent == null ? void 0 : menuComponent.value) && targetKey) { 1764 menuComponent.value.setActiveMenu(targetKey); 1765 } 1766 }; 1767 const handleMenuActivation = (personalActiveMenu, adminActiveMenu) => { 1768 const activateMenu = (menuType, activeMenu2) => { 1769 const targetKey = getMenuKey(activeMenu2);
1770 setActiveMenu(menuType, targetKey); 1771 onUpdateActive(activeMenu2.target); 1772 }; 1773 if (personalActiveMenu && !adminActiveMenu) { 1774 activateMenu(personal, personalActiveMenu); 1775 return; 1776 } 1777 if (!personalActiveMenu && adminActiveMenu) { 1778 activateMenu(admin, adminActiveMenu); 1779 return; 1780 } 1781 if (personalActiveMenu && adminActiveMenu) { 1782 if (personalActiveMenu.type === "path" && adminActiveMenu.type === "path") { 1783 if (personalActiveMenu.target.key !== adminActiveMenu.target.key) { 1784 if (personalActiveMenu.target.key === sideMenuActiveKey) { 1785 activateMenu(personal, personalActiveMenu); 1786 } else if (adminActiveMenu.target.key === sideMenuActiveKey) { 1787 activateMenu(admin, adminActiveMenu); 1788 } 1789 } 1790 return; 1791 } 1792 const menuToActivate = personalActiveMenu.type === "path" ? { type: personal, menu: personalActiveMenu } : { type: admin, menu: adminActiveMenu }; 1793 activateMenu(menuToActivate.type, menuToActivate.menu); 1794 } 1795 }; 1796 Promise.all([personalPromise, adminPromise]).then(([personalActiveMenu, adminActiveMenu]) => { 1797 handleMenuActivation(personalActiveMenu, adminActiveMenu); 1798 setTimeout(checkTooltips, TOOLTIP_CHECK_DELAY); 1799 }).catch((error) => { 1800 console.error("Menu initialization error:", error); 1801 }); 1802 const scrollTo = (id) => { 1803 const target = id || activeMenu.value; 1804 scrollToElement(target); 1805 }; 1806 __expose({ 1807 personal, 1808 admin, 1809 scrollbar, 1810 scrollTo 1811 }); 1812 return (_ctx, _cache) => { 1813 const _component_zm_scrollbar = resolveComponent("zm-scrollbar"); 1814 const _component_zm_context = resolveComponent("zm-context"); 1815 return openBlock(), createBlock(_component_zm_context, { 1816 "system-fonts": false, 1817 namespace: unref(NAME_SPACE) 1818 }, { 1819 default: withCtx(() => [ 1820 createVNode(_component_zm_scrollbar, { 1821 ref: "scrollbarRef", 1822 class: "vertical-scrollbar" 1823 }, { 1824 default: withCtx(() => [ 1825 createVNode(_sfc_main$4, { 1826 ref_key: "personal", 1827 ref: personal, 1828 "show-personal-only": unref(showPersonalOnly), 1829 onLoaded: onPersonalLoaded, 1830 onZcpLoaded 1831 }, null, 8, ["show-personal-only"]), 1832 createVNode(_sfc_main$3, { 1833 ref_key: "admin", 1834 ref: admin, 1835 onLoaded: onAdminLoaded 1836 }, null, 512), 1837 createVNode(support) 1838 ]), 1839 _: 1 1840 }, 512), 1841 createVNode(unref(menuTooltips), { ref: "menuTooltipsRef" }, null, 512) 1842 ]), 1843 _: 1 1844 }, 8, ["namespace"]); 1845 }; 1846 } 1847}); 1848const throttle = (delay, noTrailing, callback, debounceMode) => { 1849 let timeoutID; 1850 let lastExec = 0; 1851 if (typeof noTrailing !== "boolean") { 1852 debounceMode = callback; 1853 callback = noTrailing; 1854 noTrailing = void 0; 1855 } 1856 return function wrapper() { 1857 const self = this; 1858 const elapsed = Date.now() - lastExec; 1859 const args = arguments; 1860 const exec = () => { 1861 lastExec = Date.now(); 1862 callback.apply(self, args); 1863 }; 1864 const clear = () => { 1865 timeoutID = void 0; 1866 }; 1867 if (debounceMode && !timeoutID) { 1868 exec(); 1869 } 1870 if (timeoutID) { 1871 clearTimeout(timeoutID); 1872 } 1873 if (debounceMode === void 0 && elapsed > delay) { 1874 exec(); 1875 } else if (noTrailing !== true) { 1876 timeoutID = setTimeout( 1877 debounceMode ? clear : exec, 1878 debounceMode === void 0 ? delay - elapsed : delay 1879 ); 1880 } 1881 }; 1882}; 1883class Sticky { 1884 constructor(targetEl, headerEl) { 1885 this.targetEl = targetEl; 1886 this.headerHeight = (headerEl == null ? void 0 : headerEl.offsetHeight) || 0; 1887 this.toBeObservedDOMIds = ["imgroup-guide-notice-slot", "notice-slot", "pastdue_msg"]; 1888 this.cacheKey = "__zm_left_nav_scroll__"; 1889 } 1890 setup() { 1891 this.improveScrollbar(); 1892 this.observe(); 1893 this.makeStickyPosition(); 1894 this.bindEvents(); 1895 this.updateScrollbarPosition(); 1896 } 1897 bindEvents() { 1898 this.targetEl.addEventListener("scroll", throttle(200, this.onNavScroll.bind(this))); 1899 window.addEventListener("scroll", this.onPageScroll.bind(this), { passive: true }); 1900 } 1901 observe() { 1902 const observer = new MutationObserver(() => { 1903 this.computeMaxHeight(); 1904 }); 1905 this.toBeObservedDOMIds.forEach((id) => { 1906 const dom = document.getElementById(id); 1907 if (dom) { 1908 observer.observe(dom, { 1909 childList: true, 1910 subtree: true, 1911 attributes: true 1912 }); 1913 } 1914 }); 1915 } 1916 onNavScroll() { 1917 try { 1918 window.sessionStorage.setItem(this.cacheKey, this.targetEl.scrollTop || 0); 1919 } catch (error) { 1920 console.error(error); 1921 } 1922 } 1923 onPageScroll() { 1924 this.computeMaxHeight(); 1925 } 1926 improveScrollbar() { 1927 this.targetEl.classList.add("nav-menu-sticky-layout"); 1928 } 1929 makeStickyPosition() { 1930 const { style } = this.targetEl; 1931 style.setProperty("position", "sticky", "important"); 1932 style.setProperty("top", `${this.headerHeight}px`, "important"); 1933 this.computeMaxHeight(); 1934 } 1935 computeMaxHeight() { 1936 const offsetTop = Math.max(this.targetEl.getBoundingClientRect().top, 0); 1937 const maxHeightValue = `calc(100vh - ${offsetTop}px)`; 1938 this.targetEl.style.setProperty("max-height", maxHeightValue, "important"); 1939 } 1940 updateScrollbarPosition() { 1941 try { 1942 const cachedPosition = Number(window.sessionStorage.getItem(this.cacheKey)); 1943 if (cachedPosition > 0) { 1944 this.targetEl.scrollTo(0, cachedPosition); 1945 } 1946 } catch (error) { 1947 console.error(error); 1948 } 1949 } 1950} 1951const supportCSSSticky = (property, value) => { 1952 const prop = `${property}:`; 1953 const el = document.createElement("div"); 1954 const mStyle = el.style; 1955 mStyle.cssText = prop + ["-webkit-", "-moz-", "-ms-", "-o-", ""].join(`${value};${prop}`) + `${value};`; 1956 return mStyle[property].indexOf(value) !== -1; 1957}; 1958const supportMutationObserver = () => typeof MutationObserver === "function"; 1959function stickyMenu() { 1960 if (supportCSSSticky("position", "sticky") && supportMutationObserver() && window.innerWidth >= 1024) { 1961 const navMenu = document.querySelector(".nav-menu"); 1962 if (!navMenu) return;
1963 window.__webLeftNavSticky = new Sticky( 1964 navMenu, 1965 document.getElementById("header_container") 1966 ).setup(); 1967 } 1968} 1969const elWrap = document.getElementById("skiptocontent"); 1970if (elWrap) { 1971 elWrap.querySelector("a").addEventListener("click", (event) => { 1972 event.preventDefault(); 1973 const mainContent = document.getElementById("the-main-content"); 1974 if (mainContent) { 1975 mainContent.focus(); 1976 mainContent.scrollIntoView(); 1977 } 1978 }); 1979} 1980const install = (app) => { 1981 app.use(ZmContext); 1982 app.use(ZmScrollbar); 1983 app.use(ZmSideMenu); 1984 app.use(ZmIcon); 1985 app.use(ZmButton); 1986 app.use(ZmTooltip); 1987 app.use(ZmBadge); 1988 app.use(ZmVisuallyHidden); 1989}; 1990function sideMenu() { 1991 return __async(this, null, function* () { 1992 var _a2; 1993 if (!((_a2 = window.microsDatas) == null ? void 0 : _a2.useSimplifiedPortal)) { 1994 stickyMenu(); 1995 } 1996 const sideMenuEl = document.getElementById("sidemenu"); 1997 const app = createApp(_sfc_main$1); 1998 app.use(i18n); 1999 install(app); 2000 setupAppErrorHandling(app, "side-menu"); 2001 window.sideMenu = app.mount(sideMenuEl); 2002 }); 2003} 2004const sideMenu$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ 2005 __proto__: null, 2006 default: sideMenu 2007}, Symbol.toStringTag, { value: "Module" })); 2008const _hoisted_1 = { 2009 class: "tooltips-title", 2010 "aria-hidden": "true" 2011}; 2012const _hoisted_2 = ["innerHTML"]; 2013const _sfc_main = /* @__PURE__ */ Object.assign({ 2014 name: "side-menu-tooltips" 2015}, { 2016 __name: "tooltips", 2017 setup(__props, { expose: __expose }) { 2018 const popoverRef = ref(); 2019 const tooltipsTitle = ref(""); 2020 const tooltipsContent = ref(""); 2021 const closable = ref(false); 2022 const cancelText = ref(""); 2023 const confirmText = ref(""); 2024 const floatingOptions = { 2025 "offset-options": { 2026 mainAxis: 24, 2027 crossAxis: -12 2028 }, 2029 offset: 12 2030 }; 2031 let promiseResolver = null;
2032 let promiseRejecter = null; 2033 const onCancel = () => { 2034 popoverRef.value.close(); 2035 if (promiseRejecter) { 2036 promiseRejecter("cancel"); 2037 } 2038 }; 2039 const onContinue = () => { 2040 popoverRef.value.close(); 2041 if (promiseResolver) { 2042 promiseResolver("continue"); 2043 } 2044 }; 2045 const onHide = () => { 2046 if (!confirmText.value && !cancelText.value) { 2047 if (promiseResolver) { 2048 promiseResolver("hide"); 2049 } 2050 } 2051 promiseResolver = null; 2052 promiseRejecter = null; 2053 }; 2054 const badgeText = ref(""); 2055 const dialogWidth = ref(320); 2056 const show = ({ 2057 title, 2058 content, 2059 id, 2060 showClose, 2061 cancelButtonText, 2062 confirmButtonText, 2063 badge, 2064 width 2065 }) => { 2066 var _a2; 2067 tooltipsTitle.value = title; 2068 tooltipsContent.value = content; 2069 closable.value = showClose || false; 2070 cancelText.value = cancelButtonText || ""; 2071 confirmText.value = confirmButtonText || ""; 2072 badgeText.value = badge; 2073 dialogWidth.value = width || 320; 2074 if (!cancelButtonText && !confirmButtonText) { 2075 closable.value = true; 2076 } 2077 const el = (_a2 = document.getElementById(id)) == null ? void 0 : _a2.querySelector(".fe-popups-side-menu__item-label-inner"); 2078 if (el && popoverRef.value) { 2079 popoverRef.value.updateTriggerRef(el); 2080 popoverRef.value.open(); 2081 } 2082 return new Promise((resolve, reject) => { 2083 promiseResolver = resolve; 2084 promiseRejecter = reject; 2085 }); 2086 }; 2087 __expose({ show }); 2088 return (_ctx, _cache) => { 2089 const _component_zm_badge = resolveComponent("zm-badge"); 2090 return openBlock(), createBlock(unref(ZmPopover), { 2091 ref_key: "popoverRef", 2092 ref: popoverRef, 2093 placement: "right-start", 2094 "disable-click-outside": "", 2095 "show-close": closable.value, 2096 "read-description": "", 2097 "allow-focus-out": true, 2098 "aria-label": tooltipsTitle.value, 2099 "dialog-style": { "min-width": dialogWidth.value }, 2100 "floating-options": floatingOptions, 2101 onHide 2102 }, createSlots({ 2103 content: withCtx(() => [ 2104 createBaseVNode("h4", _hoisted_1, [ 2105 badgeText.value ? (openBlock(), createBlock(_component_zm_badge, { 2106 key: 0, 2107 class: "fe-popups-side-menu__item-badge", 2108 type: "custom", 2109 text: badgeText.value, 2110 color: "blue", 2111 style: { "margin-left": "0", "margin-right": "8px" } 2112 }, null, 8, ["text"])) : createCommentVNode("", true), 2113 createTextVNode(" " + toDisplayString(tooltipsTitle.value), 1) 2114 ]), 2115 createBaseVNode("div", { 2116 class: "tooltips-content", 2117 innerHTML: tooltipsContent.value 2118 }, null, 8, _hoisted_2) 2119 ]), 2120 default: withCtx(() => [ 2121 _cache[0] || (_cache[0] = createBaseVNode("div", null, null, -1)) 2122 ]), 2123 _: 2 2124 }, [ 2125 cancelText.value || confirmText.value ? { 2126 name: "action", 2127 fn: withCtx(() => [ 2128 cancelText.value ? (openBlock(), createBlock(unref(ZmButton), { 2129 key: 0, 2130 onClick: onCancel 2131 }, { 2132 default: withCtx(() => [ 2133 createTextVNode(toDisplayString(cancelText.value), 1) 2134 ]), 2135 _: 1 2136 })) : createCommentVNode("", true), 2137 confirmText.value ? (openBlock(), createBlock(unref(ZmButton), { 2138 key: 1, 2139 type: "primary", 2140 onClick: onContinue 2141 }, { 2142 default: withCtx(() => [ 2143 createTextVNode(toDisplayString(confirmText.value), 1) 2144 ]), 2145 _: 1 2146 })) : createCommentVNode("", true) 2147 ]), 2148 key: "0" 2149 } : void 0 2150 ]), 1032, ["show-close", "aria-label", "dialog-style"]); 2151 }; 2152 } 2153}); 2154const tooltips = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-401feca1"]]); 2155const tooltips$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ 2156 __proto__: null, 2157 default: tooltips 2158}, Symbol.toStringTag, { value: "Module" })); 2159export { 2160 getUrlParam as g, 2161 sideMenu$1 as s 2162};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.