vue-layout-gitcode 1.12.66 → 1.12.68

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.
@@ -252,19 +252,25 @@ const getBrowserStorage = () => {
252
252
  let localStorage$1;
253
253
  {
254
254
  const data = {};
255
+ const fallbackKeys = /* @__PURE__ */ new Set();
255
256
  localStorage$1 = {
256
257
  setItem(id, val) {
257
- var _a;
258
- data[id] = String(val);
258
+ const value = String(val);
259
+ data[id] = value;
260
+ fallbackKeys.add(id);
259
261
  try {
260
- (_a = getBrowserStorage()) == null ? void 0 : _a.setItem(id, String(val));
262
+ const storage = getBrowserStorage();
263
+ if (storage) {
264
+ storage.setItem(id, value);
265
+ fallbackKeys.delete(id);
266
+ }
261
267
  } catch {
262
268
  }
263
269
  },
264
270
  getItem(id) {
265
271
  try {
266
272
  const storage = getBrowserStorage();
267
- if (storage) {
273
+ if (storage && !fallbackKeys.has(id)) {
268
274
  return storage.getItem(id);
269
275
  }
270
276
  } catch {
@@ -274,6 +280,7 @@ let localStorage$1;
274
280
  removeItem(id) {
275
281
  var _a;
276
282
  delete data[id];
283
+ fallbackKeys.delete(id);
277
284
  try {
278
285
  (_a = getBrowserStorage()) == null ? void 0 : _a.removeItem(id);
279
286
  } catch {
@@ -286,6 +293,7 @@ let localStorage$1;
286
293
  } catch {
287
294
  }
288
295
  Object.keys(data).forEach((key) => delete data[key]);
296
+ fallbackKeys.clear();
289
297
  },
290
298
  get length() {
291
299
  try {
@@ -10206,10 +10214,10 @@ const _hoisted_5$l = { class: "float-tooltip" };
10206
10214
  const _hoisted_6$k = { class: "float-tooltip-content" };
10207
10215
  const _hoisted_7$h = { class: "float-tooltip" };
10208
10216
  const _hoisted_8$f = { class: "float-tooltip-content" };
10209
- const _hoisted_9$e = { class: "float-tooltip" };
10210
- const _hoisted_10$a = { class: "float-tooltip-content" };
10211
- const _hoisted_11$8 = { class: "float-tooltip" };
10212
- const _hoisted_12$8 = { class: "float-tooltip-content" };
10217
+ const _hoisted_9$d = { class: "float-tooltip" };
10218
+ const _hoisted_10$b = { class: "float-tooltip-content" };
10219
+ const _hoisted_11$9 = { class: "float-tooltip" };
10220
+ const _hoisted_12$9 = { class: "float-tooltip-content" };
10213
10221
  const _hoisted_13$6 = { class: "float-tooltip" };
10214
10222
  const _hoisted_14$3 = { class: "float-tooltip-content" };
10215
10223
  const _hoisted_15$3 = ["src", "alt"];
@@ -10491,8 +10499,8 @@ const _sfc_main$U = /* @__PURE__ */ defineComponent({
10491
10499
  createElementVNode("path", { d: "M14.6182 12.3893H12.2961C12.0184 12.3893 11.7934 12.1643 11.7934 11.8865L11.7881 5.96621C11.7564 3.89551 10.0742 2.31523 8 2.30469C5.92578 2.31523 4.24355 3.89551 4.21016 5.96621L4.20664 11.1025C4.20664 11.1025 4.85527 13.342 6.40039 13.0818C6.51816 12.6898 6.93301 12.5422 7.2002 12.5422H8.82793C9.3834 12.5422 9.8334 12.9922 9.8334 13.5477V13.8623C9.8334 14.4178 9.3834 14.8678 8.82793 14.8678H7.33027C6.90488 14.8678 6.54277 14.6006 6.39512 14.2262C6.37051 14.2121 6.17012 14.2297 5.97324 14.1875C4.44922 13.6426 3.78125 12.3822 3.78125 12.3822C3.75488 12.3875 3.72852 12.391 3.70215 12.391H1.38184C1.1041 12.391 0.879102 12.166 0.879102 11.8883V6.73437C0.879102 6.45664 1.1041 6.23164 1.38184 6.23164H3.04121C3.04121 5.80625 3.03945 5.96445 3.03945 5.96445C3.09922 1.1498 7.91738 1.13398 7.91738 1.13398C7.95605 1.13223 8.0457 1.13223 8.08262 1.13398C8.08262 1.13398 12.9008 1.15156 12.9605 5.96445C12.9605 5.96445 12.9605 5.80449 12.9588 6.23164H14.6182C14.8959 6.23164 15.1209 6.45664 15.1209 6.73437V11.8865C15.1209 12.1643 14.8959 12.3893 14.6182 12.3893ZM3.14492 7.70469C3.14492 7.53418 3.05352 7.39531 2.94102 7.39531H2.0832C1.9707 7.39531 1.8793 7.53418 1.8793 7.70469V10.8775C1.8793 11.0498 1.9707 11.1869 2.0832 11.1869H2.94102C3.05352 11.1869 3.14492 11.048 3.14492 10.8775V7.70469ZM14.1207 7.70469C14.1207 7.53418 14.0293 7.39531 13.9168 7.39531H13.0607C12.9482 7.39531 12.8551 7.53418 12.8551 7.70469V10.8775C12.8551 11.0498 12.9482 11.1869 13.0607 11.1869H13.9168C14.0293 11.1869 14.1207 11.048 14.1207 10.8775V7.70469Z" })
10492
10500
  ])
10493
10501
  ], -1)),
10494
- createElementVNode("div", _hoisted_9$e, [
10495
- createElementVNode("span", _hoisted_10$a, toDisplayString$1(unref(t2)("gitCodeLayout.home.userFeedback01")), 1),
10502
+ createElementVNode("div", _hoisted_9$d, [
10503
+ createElementVNode("span", _hoisted_10$b, toDisplayString$1(unref(t2)("gitCodeLayout.home.userFeedback01")), 1),
10496
10504
  _cache[9] || (_cache[9] = createElementVNode("span", { class: "float-tooltip-arrow" }, null, -1))
10497
10505
  ])
10498
10506
  ])) : createCommentVNode("", true),
@@ -10516,8 +10524,8 @@ const _sfc_main$U = /* @__PURE__ */ defineComponent({
10516
10524
  })
10517
10525
  ])
10518
10526
  ], -1)),
10519
- createElementVNode("div", _hoisted_11$8, [
10520
- createElementVNode("span", _hoisted_12$8, toDisplayString$1(unref(t2)("gitCodeLayout.toolsFloat.collapse")), 1),
10527
+ createElementVNode("div", _hoisted_11$9, [
10528
+ createElementVNode("span", _hoisted_12$9, toDisplayString$1(unref(t2)("gitCodeLayout.toolsFloat.collapse")), 1),
10521
10529
  _cache[11] || (_cache[11] = createElementVNode("span", { class: "float-tooltip-arrow" }, null, -1))
10522
10530
  ])
10523
10531
  ])
@@ -14338,13 +14346,13 @@ const _hoisted_8$e = {
14338
14346
  alt: "mirrors-avatar",
14339
14347
  class: "header-custom-mirrors-img-tall"
14340
14348
  };
14341
- const _hoisted_9$d = { class: "g-repo-breadcrumb-container" };
14342
- const _hoisted_10$9 = {
14349
+ const _hoisted_9$c = { class: "g-repo-breadcrumb-container" };
14350
+ const _hoisted_10$a = {
14343
14351
  key: 0,
14344
14352
  class: "header-custom-breadcrumb-row"
14345
14353
  };
14346
- const _hoisted_11$7 = ["title"];
14347
- const _hoisted_12$7 = ["title"];
14354
+ const _hoisted_11$8 = ["title"];
14355
+ const _hoisted_12$8 = ["title"];
14348
14356
  const _hoisted_13$5 = {
14349
14357
  key: 0,
14350
14358
  class: "header-custom-tag-mb"
@@ -14646,7 +14654,7 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
14646
14654
  }),
14647
14655
  _: 1
14648
14656
  }, 8, ["href"]),
14649
- createElementVNode("div", _hoisted_9$d, [
14657
+ createElementVNode("div", _hoisted_9$c, [
14650
14658
  !((_b2 = __props.repoProps) == null ? void 0 : _b2.isGhMirrors) ? (openBlock(), createElementBlock("div", {
14651
14659
  key: 0,
14652
14660
  ref_key: "breadcrumbRef",
@@ -14657,7 +14665,7 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
14657
14665
  return openBlock(), createElementBlock(Fragment, {
14658
14666
  key: item.path
14659
14667
  }, [
14660
- index2 !== unref(breadcrumb).length - 1 ? (openBlock(), createElementBlock("span", _hoisted_10$9, [
14668
+ index2 !== unref(breadcrumb).length - 1 ? (openBlock(), createElementBlock("span", _hoisted_10$a, [
14661
14669
  createVNode(GLink, {
14662
14670
  class: "linkTx",
14663
14671
  href: item.path
@@ -14669,7 +14677,7 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
14669
14677
  ref: breadcrumbTextRef,
14670
14678
  title: item.label,
14671
14679
  class: normalizeClass(["linkTx", index2 === unref(breadcrumb).length - 1 ? "header-custom-bold" : ""])
14672
- }, toDisplayString$1(item.label), 11, _hoisted_11$7)
14680
+ }, toDisplayString$1(item.label), 11, _hoisted_11$8)
14673
14681
  ]),
14674
14682
  _: 2
14675
14683
  }, 1032, ["href"]),
@@ -14694,7 +14702,7 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
14694
14702
  ref: breadcrumbNextTextRef,
14695
14703
  title: unref(breadcrumb)[unref(breadcrumb).length - 1].label,
14696
14704
  class: "linkTx header-custom-bold"
14697
- }, toDisplayString$1(unref(breadcrumb)[unref(breadcrumb).length - 1].label), 9, _hoisted_12$7)
14705
+ }, toDisplayString$1(unref(breadcrumb)[unref(breadcrumb).length - 1].label), 9, _hoisted_12$8)
14698
14706
  ]),
14699
14707
  _: 1
14700
14708
  }, 8, ["href"]),
@@ -14948,7 +14956,7 @@ const _hoisted_5$j = {
14948
14956
  const _hoisted_6$i = ["href", "onClick", "onKeydown"];
14949
14957
  const _hoisted_7$f = { class: "dashboard-create-menu__title-row" };
14950
14958
  const _hoisted_8$d = { class: "dashboard-create-menu__title" };
14951
- const _hoisted_9$c = {
14959
+ const _hoisted_9$b = {
14952
14960
  key: 0,
14953
14961
  class: "dashboard-create-menu__desc"
14954
14962
  };
@@ -15196,7 +15204,7 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
15196
15204
  }, null, 8, ["name"]),
15197
15205
  createElementVNode("span", _hoisted_8$d, toDisplayString$1(item.label), 1)
15198
15206
  ]),
15199
- item.desc ? (openBlock(), createElementBlock("div", _hoisted_9$c, toDisplayString$1(item.desc), 1)) : createCommentVNode("", true)
15207
+ item.desc ? (openBlock(), createElementBlock("div", _hoisted_9$b, toDisplayString$1(item.desc), 1)) : createCommentVNode("", true)
15200
15208
  ], 42, _hoisted_6$i)
15201
15209
  ], 64);
15202
15210
  }), 128))
@@ -15355,8 +15363,8 @@ const _hoisted_5$i = { class: "message-item-info-content" };
15355
15363
  const _hoisted_6$h = { class: "message-item-body" };
15356
15364
  const _hoisted_7$e = ["title", "innerHTML"];
15357
15365
  const _hoisted_8$c = ["title"];
15358
- const _hoisted_9$b = { class: "message-item-info" };
15359
- const _hoisted_10$8 = { class: "message-item-rightTx message-item-date" };
15366
+ const _hoisted_9$a = { class: "message-item-info" };
15367
+ const _hoisted_10$9 = { class: "message-item-rightTx message-item-date" };
15360
15368
  const _sfc_main$J = /* @__PURE__ */ defineComponent({
15361
15369
  __name: "index",
15362
15370
  props: {
@@ -15415,7 +15423,7 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
15415
15423
  ]),
15416
15424
  _: 1
15417
15425
  }, 8, ["href", "class"]),
15418
- createElementVNode("div", _hoisted_9$b, [
15426
+ createElementVNode("div", _hoisted_9$a, [
15419
15427
  createVNode(GText, null, {
15420
15428
  default: withCtx(() => [
15421
15429
  createTextVNode(toDisplayString$1(__props.data.repo), 1)
@@ -15432,7 +15440,7 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
15432
15440
  ])
15433
15441
  ])
15434
15442
  ]),
15435
- createElementVNode("div", _hoisted_10$8, toDisplayString$1(unref(formatTimeFromNow)(__props.data.time)), 1)
15443
+ createElementVNode("div", _hoisted_10$9, toDisplayString$1(unref(formatTimeFromNow)(__props.data.time)), 1)
15436
15444
  ]);
15437
15445
  };
15438
15446
  }
@@ -15464,19 +15472,19 @@ const _hoisted_8$b = {
15464
15472
  key: 0,
15465
15473
  class: "g-number"
15466
15474
  };
15467
- const _hoisted_9$a = {
15475
+ const _hoisted_9$9 = {
15468
15476
  key: 0,
15469
15477
  class: "g-number"
15470
15478
  };
15471
- const _hoisted_10$7 = {
15479
+ const _hoisted_10$8 = {
15472
15480
  key: 2,
15473
15481
  class: "message-content-empty"
15474
15482
  };
15475
- const _hoisted_11$6 = {
15483
+ const _hoisted_11$7 = {
15476
15484
  key: 3,
15477
15485
  class: "loading-more"
15478
15486
  };
15479
- const _hoisted_12$6 = {
15487
+ const _hoisted_12$7 = {
15480
15488
  key: 4,
15481
15489
  class: "no-more"
15482
15490
  };
@@ -15833,7 +15841,7 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
15833
15841
  onClick: _cache[4] || (_cache[4] = ($event) => switchMentionSubTab("discussion"))
15834
15842
  }, [
15835
15843
  _cache[9] || (_cache[9] = createTextVNode(" 在线讨论 ", -1)),
15836
- mentionSubTabCount.value.discussion > 0 ? (openBlock(), createElementBlock("span", _hoisted_9$a, toDisplayString$1(mentionSubTabCount.value.discussion), 1)) : createCommentVNode("", true)
15844
+ mentionSubTabCount.value.discussion > 0 ? (openBlock(), createElementBlock("span", _hoisted_9$9, toDisplayString$1(mentionSubTabCount.value.discussion), 1)) : createCommentVNode("", true)
15837
15845
  ], 2)
15838
15846
  ])) : createCommentVNode("", true),
15839
15847
  listData.value.length > 0 ? (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(listData.value, (item) => {
@@ -15843,11 +15851,11 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
15843
15851
  data: item,
15844
15852
  onTrigger: ($event) => handleMessageRead(item)
15845
15853
  }, null, 8, ["type", "data", "onTrigger"]);
15846
- }), 128)) : (openBlock(), createElementBlock("div", _hoisted_10$7, [
15854
+ }), 128)) : (openBlock(), createElementBlock("div", _hoisted_10$8, [
15847
15855
  createElementVNode("div", null, toDisplayString$1(unref(t2)("gitCodeLayout.notice.msg.noMessage")), 1)
15848
15856
  ])),
15849
- loadingMore.value ? (openBlock(), createElementBlock("div", _hoisted_11$6, toDisplayString$1(unref(t2)("gitCodeLayout.notice.msg.loading")) + "... ", 1)) : createCommentVNode("", true),
15850
- !hasMore.value && listData.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_12$6, toDisplayString$1(unref(t2)("gitCodeLayout.notice.msg.noMore")), 1)) : createCommentVNode("", true)
15857
+ loadingMore.value ? (openBlock(), createElementBlock("div", _hoisted_11$7, toDisplayString$1(unref(t2)("gitCodeLayout.notice.msg.loading")) + "... ", 1)) : createCommentVNode("", true),
15858
+ !hasMore.value && listData.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_12$7, toDisplayString$1(unref(t2)("gitCodeLayout.notice.msg.noMore")), 1)) : createCommentVNode("", true)
15851
15859
  ])), [
15852
15860
  [_directive_loading, loading.value]
15853
15861
  ])
@@ -16182,9 +16190,8 @@ const _hoisted_5$f = {
16182
16190
  class: "g-account-switch-status"
16183
16191
  };
16184
16192
  const _hoisted_6$e = ["disabled", "aria-label", "title", "onClick"];
16185
- const _hoisted_7$b = { class: "g-account-switch-actions" };
16193
+ const _hoisted_7$b = ["disabled"];
16186
16194
  const _hoisted_8$9 = ["disabled"];
16187
- const _hoisted_9$9 = ["disabled"];
16188
16195
  const _sfc_main$D = /* @__PURE__ */ defineComponent({
16189
16196
  __name: "AccountSessionList",
16190
16197
  props: {
@@ -16236,7 +16243,9 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
16236
16243
  }, "×", 8, _hoisted_6$e)
16237
16244
  ]);
16238
16245
  }), 128)),
16239
- createElementVNode("div", _hoisted_7$b, [
16246
+ createElementVNode("div", {
16247
+ class: normalizeClass(["g-account-switch-actions", { "g-account-switch-actions--divided": otherAccounts.value.length }])
16248
+ }, [
16240
16249
  canAdd.value ? (openBlock(), createElementBlock("button", {
16241
16250
  key: 0,
16242
16251
  type: "button",
@@ -16244,23 +16253,12 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
16244
16253
  disabled: __props.busy,
16245
16254
  onClick: _cache[0] || (_cache[0] = ($event) => emit("add"))
16246
16255
  }, [
16247
- _cache[2] || (_cache[2] = createElementVNode("svg", {
16248
- width: "18",
16249
- height: "18",
16250
- viewBox: "0 0 24 24",
16251
- fill: "none",
16252
- "aria-hidden": "true"
16253
- }, [
16254
- createElementVNode("path", {
16255
- d: "M15 20v-2a5 5 0 0 0-10 0v2M10 11a4 4 0 1 0 0-8 4 4 0 0 0 0 8m9-6v6m-3-3h6",
16256
- stroke: "currentColor",
16257
- "stroke-width": "1.7",
16258
- "stroke-linecap": "round",
16259
- "stroke-linejoin": "round"
16260
- })
16261
- ], -1)),
16256
+ createVNode(GIcon, {
16257
+ name: "gt-plane-users",
16258
+ size: "16px"
16259
+ }),
16262
16260
  createTextVNode(toDisplayString$1(unref(t2)("gitCodeLayout.header.accountAdd")), 1)
16263
- ], 8, _hoisted_8$9)) : createCommentVNode("", true),
16261
+ ], 8, _hoisted_7$b)) : createCommentVNode("", true),
16264
16262
  otherAccounts.value.length ? (openBlock(), createElementBlock("button", {
16265
16263
  key: 1,
16266
16264
  type: "button",
@@ -16268,1180 +16266,1170 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
16268
16266
  disabled: __props.busy,
16269
16267
  onClick: _cache[1] || (_cache[1] = ($event) => emit("logout"))
16270
16268
  }, [
16271
- _cache[3] || (_cache[3] = createElementVNode("svg", {
16272
- width: "18",
16273
- height: "18",
16274
- viewBox: "0 0 24 24",
16275
- fill: "none",
16276
- "aria-hidden": "true"
16277
- }, [
16278
- createElementVNode("path", {
16279
- d: "M9 4H4v16h5M13 8l4 4-4 4m-5-4h12",
16280
- stroke: "currentColor",
16281
- "stroke-width": "1.7",
16282
- "stroke-linecap": "round",
16283
- "stroke-linejoin": "round"
16284
- })
16285
- ], -1)),
16269
+ createVNode(GIcon, {
16270
+ name: "gt-default",
16271
+ size: "16px"
16272
+ }),
16286
16273
  createTextVNode(" " + toDisplayString$1(unref(t2)("gitCodeLayout.header.logout")), 1)
16287
- ], 8, _hoisted_9$9)) : createCommentVNode("", true)
16288
- ])
16274
+ ], 8, _hoisted_8$9)) : createCommentVNode("", true)
16275
+ ], 2)
16289
16276
  ]);
16290
16277
  };
16291
16278
  }
16292
16279
  });
16293
16280
  const AccountSessionList = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["__scopeId", "data-v-vue-layout-gitcode"]]);
16294
- const _hoisted_1$x = { class: "g-user-drawer-account-heading" };
16295
- const _hoisted_2$q = { class: "g-user-drawer-info-list" };
16296
- const _hoisted_3$p = { class: "g-user-drawer-info-list__name-wrap" };
16297
- const _hoisted_4$j = ["title"];
16298
- const _hoisted_5$e = ["title"];
16299
- const _hoisted_6$d = ["onKeydown"];
16300
- const _hoisted_7$a = ["aria-label", "aria-expanded", "disabled"];
16301
- const _hoisted_8$8 = ["aria-label"];
16302
- const _hoisted_9$8 = {
16303
- key: 0,
16304
- class: "g-user-drawer-lang-row"
16305
- };
16306
- const _sfc_main$C = /* @__PURE__ */ defineComponent({
16307
- __name: "UserAvatarMenu",
16308
- props: {
16309
- isChatBot: { type: Boolean },
16310
- accountInfo: {},
16311
- loginOutFinish: { type: Function },
16312
- inAIHub: { type: Boolean },
16313
- independence: { type: Boolean },
16314
- userMenus: {},
16315
- inEnterpriseHeader: { type: Boolean },
16316
- accountSessionSupported: { type: Boolean },
16317
- menuVisible: { type: Boolean },
16318
- accountSessionLogout: { type: Function },
16319
- accountSessions: {},
16320
- accountSessionActiveRef: {},
16321
- accountSessionMax: {},
16322
- accountSessionBusy: { type: Boolean }
16323
- },
16324
- emits: ["link-click", "account-switch", "account-add", "account-reauthorize", "account-remove"],
16325
- setup(__props, { emit: __emit }) {
16326
- var _a;
16327
- const layoutConfig2 = useLayoutConfig();
16328
- const API = headRequest(inject("request"));
16329
- const repoInfo = inject("repoInfo");
16330
- const orgInfo = inject("orgInfo");
16331
- const userInfo = inject("userInfo");
16332
- const { t: t2 } = i18n.global;
16333
- const props = __props;
16334
- const emit = __emit;
16335
- const router2 = useRouter();
16336
- const route = useRoute();
16337
- const haveVisited = ref(false);
16338
- const menuContainerRef = ref(null);
16339
- const clearSurveyDelayStatus = () => {
16340
- const surveyDelay = localStorage$2.getItem(HARMONY_VISITED_DATE);
16341
- if (surveyDelay === "true") {
16342
- localStorage$2.removeItem(HARMONY_VISITED_DATE);
16343
- }
16344
- localStorage$2.removeItem(HARMONY_SURVEY_DELAY);
16281
+ const SHORTCUT_STORAGE_KEY = "atomgit.character-shortcuts";
16282
+ const SHORTCUT_SEQUENCE_TIMEOUT = 1500;
16283
+ const SHORTCUT_GROUPS = ["site", "repo", "code", "editor", "list", "detail"];
16284
+ const BUILTIN_SHORTCUTS = [
16285
+ { id: "site.search", keys: "/", group: "site", labelKey: "shortcut.site.search" },
16286
+ { id: "site.searchLetter", keys: "s", group: "site", labelKey: "shortcut.site.search" },
16287
+ { id: "site.help", keys: "?", group: "site", labelKey: "shortcut.site.help" },
16288
+ { id: "site.notifications", keys: "g n", group: "site", labelKey: "shortcut.site.notifications" },
16289
+ { id: "site.commands", keys: "mod+k", group: "site", labelKey: "shortcut.site.commands" },
16290
+ { id: "site.escape", keys: "escape", group: "site", labelKey: "shortcut.dialog.close" }
16291
+ ];
16292
+ const isMacPlatform = () => typeof navigator !== "undefined" && /Mac|iPhone|iPad/.test(navigator.platform);
16293
+ const parseShortcut = (keys, isMac = isMacPlatform()) => {
16294
+ if (!keys.trim()) {
16295
+ throw new Error("Shortcut keys must not be empty");
16296
+ }
16297
+ return keys.trim().split(/\s+/).map((token) => {
16298
+ const parts = token.toLowerCase().split("+");
16299
+ let key = parts.pop();
16300
+ if (key === "esc") {
16301
+ key = "escape";
16302
+ }
16303
+ if (key === "space") {
16304
+ key = " ";
16305
+ }
16306
+ const modifiers = new Set(parts);
16307
+ if (!key || parts.some((part) => !["ctrl", "meta", "alt", "shift", "mod"].includes(part)) || modifiers.size !== parts.length) {
16308
+ throw new Error(`Invalid shortcut: ${keys}`);
16309
+ }
16310
+ if (key.length !== 1 && !["escape", "enter", "tab", "backspace", "delete", "arrowup", "arrowdown", "arrowleft", "arrowright", "home", "end", "pageup", "pagedown"].includes(key)) {
16311
+ throw new Error(`Unsupported shortcut key: ${key}`);
16312
+ }
16313
+ return {
16314
+ key,
16315
+ ctrl: modifiers.has("ctrl") || modifiers.has("mod") && !isMac,
16316
+ meta: modifiers.has("meta") || modifiers.has("mod") && isMac,
16317
+ alt: modifiers.has("alt"),
16318
+ shift: modifiers.has("shift")
16345
16319
  };
16346
- const handleLogout = async () => {
16347
- var _a2, _b, _c;
16348
- if (props.accountSessionSupported) {
16349
- if (!props.accountSessionBusy) await ((_a2 = props.accountSessionLogout) == null ? void 0 : _a2.call(props));
16350
- return;
16351
- }
16352
- const res = await API.toLogout();
16353
- clearSurveyDelayStatus();
16354
- if (!res.error) {
16355
- props.loginOutFinish && props.loginOutFinish();
16356
- if (((_b = route.meta) == null ? void 0 : _b.needLogin) || ((_c = route.meta) == null ? void 0 : _c.type) === "repo" && (repoInfo == null ? void 0 : repoInfo.value.visibility) === "private" || (orgInfo == null ? void 0 : orgInfo.value.visibility) === "private") {
16357
- router2.push("/");
16358
- } else {
16359
- const $route = Object.assign({}, route);
16360
- delete $route.query.isLogin;
16361
- if (typeof window !== "undefined" && window.location) {
16362
- window.location.href = router2.resolve($route).href;
16320
+ });
16321
+ };
16322
+ const matchesStroke = (event, stroke) => {
16323
+ const key = event.key.length === 1 && !stroke.shift ? event.key : event.key.toLowerCase();
16324
+ return key === stroke.key && event.ctrlKey === stroke.ctrl && event.metaKey === stroke.meta && event.altKey === stroke.alt && (stroke.key === "?" || event.shiftKey === stroke.shift);
16325
+ };
16326
+ const isCharacterShortcut = (strokes) => strokes.every((stroke) => stroke.key.length === 1 && !stroke.ctrl && !stroke.meta && !stroke.alt);
16327
+ const normalizeShortcut = (keys, isMac) => parseShortcut(keys, isMac).map((stroke) => JSON.stringify({ ...stroke, shift: stroke.key === "?" ? false : stroke.shift }));
16328
+ const config = shallowRef({ actions: [] });
16329
+ const shortcutConfig = readonly(config);
16330
+ const shortcutRevision = shallowRef(0);
16331
+ function setShortcutConfig(next) {
16332
+ if (typeof window === "undefined") {
16333
+ return;
16334
+ }
16335
+ const actions = [...BUILTIN_SHORTCUTS, ...next.actions];
16336
+ try {
16337
+ for (const isMac of [false, true]) {
16338
+ const normalized = actions.map((action) => normalizeShortcut(action.keys, isMac));
16339
+ for (let i = 0; i < actions.length; i++) {
16340
+ for (let j = i + 1; j < actions.length; j++) {
16341
+ const a = normalized[i];
16342
+ const b = normalized[j];
16343
+ const prefix = a.slice(0, Math.min(a.length, b.length)).every((key, index2) => key === b[index2]);
16344
+ if (actions[i].id === actions[j].id || prefix) {
16345
+ throw new Error(`Shortcut conflict: ${actions[i].id} (${actions[i].keys}) / ${actions[j].id} (${actions[j].keys})`);
16363
16346
  }
16364
16347
  }
16365
- } else {
16366
- props.loginOutFinish && props.loginOutFinish();
16367
16348
  }
16368
- };
16369
- const DEFAULT_ROUTER_PARAMS = Object.freeze({
16370
- name: "",
16371
- params: {
16372
- namespace: props.accountInfo.username
16373
- },
16374
- query: {}
16349
+ }
16350
+ } catch (error) {
16351
+ console.error(error);
16352
+ return;
16353
+ }
16354
+ config.value = { actions: next.actions.map((action) => ({ ...action })), isBlocked: next.isBlocked };
16355
+ shortcutRevision.value++;
16356
+ }
16357
+ function useShortcutConfig() {
16358
+ return readonly({
16359
+ get actions() {
16360
+ return config.value.actions;
16361
+ },
16362
+ get isBlocked() {
16363
+ return config.value.isBlocked;
16364
+ }
16365
+ });
16366
+ }
16367
+ const isEditableTarget = (target) => {
16368
+ if (!target || typeof Element === "undefined" || !(target instanceof Element)) {
16369
+ return false;
16370
+ }
16371
+ return Boolean(target.closest("input, textarea, select, .CodeMirror-focused, .cm-editor.cm-focused")) || target.isContentEditable === true || Boolean(target.closest('[contenteditable=""], [contenteditable="true"], [contenteditable="plaintext-only"]'));
16372
+ };
16373
+ const isComposingEvent = (event) => event.isComposing || event.keyCode === 229;
16374
+ const shouldIgnoreShortcut = (event) => event.defaultPrevented || event.repeat || isComposingEvent(event) || event.composedPath().some(isEditableTarget) || isEditableTarget(event.target) || typeof document !== "undefined" && isEditableTarget(document.activeElement);
16375
+ let current = null;
16376
+ const enabled = ref(true);
16377
+ const characterShortcutsEnabled = readonly(enabled);
16378
+ const parsePreference = (raw) => {
16379
+ try {
16380
+ const record = JSON.parse(raw || "null");
16381
+ if (record && (record.value === "on" || record.value === "off") && Number.isSafeInteger(record.updatedAt) && record.updatedAt >= 0) {
16382
+ return { value: record.value, updatedAt: record.updatedAt };
16383
+ }
16384
+ } catch {
16385
+ }
16386
+ return null;
16387
+ };
16388
+ const newestPreference = (records) => records.reduce((latest, record) => {
16389
+ if (!record) {
16390
+ return latest;
16391
+ }
16392
+ if (!latest || record.updatedAt > latest.updatedAt || record.updatedAt === latest.updatedAt && record.value === "off") {
16393
+ return record;
16394
+ }
16395
+ return latest;
16396
+ }, null);
16397
+ function refreshShortcutPreference() {
16398
+ if (typeof window === "undefined") {
16399
+ return;
16400
+ }
16401
+ let cookie = null;
16402
+ try {
16403
+ cookie = parsePreference(api.get(SHORTCUT_STORAGE_KEY));
16404
+ } catch {
16405
+ }
16406
+ current = newestPreference([current, cookie, parsePreference(localStorage$2.getItem(SHORTCUT_STORAGE_KEY))]);
16407
+ enabled.value = (current == null ? void 0 : current.value) !== "off";
16408
+ }
16409
+ function setCharacterShortcutsEnabled(value) {
16410
+ if (typeof window === "undefined") {
16411
+ return;
16412
+ }
16413
+ refreshShortcutPreference();
16414
+ current = { value: value ? "on" : "off", updatedAt: Math.max(Date.now(), ((current == null ? void 0 : current.updatedAt) ?? -1) + 1) };
16415
+ enabled.value = value;
16416
+ const serialized = JSON.stringify(current);
16417
+ localStorage$2.setItem(SHORTCUT_STORAGE_KEY, serialized);
16418
+ try {
16419
+ const domain = COOKIE_DOMAIN().replace(/^\./, "");
16420
+ const hostname = window.location.hostname;
16421
+ const shared = hostname === domain || hostname.endsWith(`.${domain}`);
16422
+ api.set(SHORTCUT_STORAGE_KEY, serialized, {
16423
+ expires: 365,
16424
+ path: "/",
16425
+ sameSite: "Lax",
16426
+ secure: window.location.protocol === "https:",
16427
+ ...shared ? { domain: `.${domain}` } : {}
16375
16428
  });
16376
- const getRouterLink = (params) => {
16377
- if (typeof params === "string") {
16378
- return {
16379
- ...DEFAULT_ROUTER_PARAMS,
16380
- name: params
16381
- };
16382
- }
16383
- return {
16384
- ...DEFAULT_ROUTER_PARAMS,
16385
- ...params
16386
- };
16387
- };
16388
- const menuDataFormat = (data) => {
16389
- data.forEach((item) => {
16390
- if (Array.isArray(item)) {
16391
- item.forEach((item2) => {
16392
- if (item2.to) {
16393
- item2.to = getRouterLink(item2.to);
16394
- }
16395
- });
16396
- }
16397
- });
16398
- return data;
16399
- };
16400
- const userCustomMenus = computed(() => {
16401
- if (props.userMenus) {
16402
- return menuDataFormat(props.userMenus);
16403
- }
16404
- return [];
16405
- });
16406
- const baseRouterMenus = [
16407
- [
16408
- { id: "dashboard", label: t2("gitCodeLayout.header.workbench"), icon: "gt-plane-user", to: getRouterLink("dashboard") },
16409
- { id: "myEnterprise", label: t2("gitCodeLayout.header.myEnterprise"), icon: "gt-a-plane-enterprise", to: getRouterLink({ path: "/setting/enterprise" }) },
16410
- { id: "myOrg", label: t2("gitCodeLayout.header.myOrg"), icon: "gt-plane-organization", to: getRouterLink({ name: "settingOrganization" }) },
16411
- { id: "myRepo", label: t2("gitCodeLayout.header.myRepo"), icon: "gt-plane-projectHome1", to: getRouterLink("settingRepo") },
16412
- { id: "myNotebook", label: t2("gitCodeLayout.header.myNotebook"), icon: "gt-plane-Notebook", to: getRouterLink("myNotebook") },
16413
- // { id: 'myCloudSpace', label: t('gitCodeLayout.header.myCloudSpace'), icon: 'gt-plane-cloud', target: '_blank', href: 'https://devstation.connect.huaweicloud.com/devdesktop/webide' },
16414
- { id: "mySpaces", label: t2("gitCodeLayout.header.mySpace"), icon: "gt-plane-Space", to: getRouterLink("userSpaces") },
16415
- { id: "myStar", label: t2("gitCodeLayout.header.myStar"), icon: "gt-plane-star", to: getRouterLink("userStars") }
16416
- ],
16417
- [
16418
- { id: "personalSetting", label: t2("gitCodeLayout.header.personSetting"), icon: "gt-plane-setting", to: getRouterLink("setting") },
16419
- { id: "news", label: t2("gitCodeLayout.home.informationCenter"), icon: "gt-plane-consulting", target: "_blank", href: `${transformNewsUrl(INFORMATION_CENTER_URL)}?lang=${getLocale(i18n) || "zh"}` },
16420
- { id: "help", label: t2("gitCodeLayout.header.helpDocument"), icon: "gt-plane-project-opened", href: currentHelpDocsUrl() }
16421
- ]
16422
- ];
16423
- const routerMenuList = computed(() => {
16424
- var _a2;
16425
- return [
16426
- ...((_a2 = userCustomMenus.value) == null ? void 0 : _a2.length) ? userCustomMenus.value : baseRouterMenus,
16427
- [
16428
- { id: "logout", label: t2("gitCodeLayout.header.logout"), icon: "gt-default", action: handleLogout }
16429
- ]
16430
- ];
16431
- });
16432
- const baseHrefMenus = [
16433
- [
16434
- { id: "dashboard", label: t2("gitCodeLayout.header.workbench"), icon: "gt-plane-user", link: "/dashboard" },
16435
- { id: "myEnterprise", label: t2("gitCodeLayout.header.myEnterprise"), icon: "gt-a-plane-enterprise", link: "/setting/enterprise" },
16436
- { id: "myOrg", label: t2("gitCodeLayout.header.myOrg"), icon: "gt-plane-organization", link: "/setting/organization" },
16437
- { id: "myRepo", label: t2("gitCodeLayout.header.myRepo"), icon: "gt-plane-projectHome1", link: "/setting/repo" },
16438
- { id: "myNotebook", label: t2("gitCodeLayout.header.myNotebook"), icon: "gt-plane-Notebook", show: props.inAIHub, link: `/user/${userInfo.value.username}/notebook` },
16439
- // { id: 'myCloudSpace', label: t('gitCodeLayout.header.myCloudSpace'), icon: 'gt-plane-cloud', link: 'https://devstation.connect.huaweicloud.com/devdesktop/webide' },
16440
- { id: "mySpaces", label: t2("gitCodeLayout.header.mySpace"), icon: "gt-plane-Space", show: props.inAIHub, link: `/user/${userInfo.value.username}/spaces` },
16441
- { id: "myStar", label: t2("gitCodeLayout.header.myStar"), icon: "gt-plane-star", link: `/user/${userInfo.value.username}/stars` }
16442
- ],
16443
- [
16444
- { id: "personalSetting", label: t2("gitCodeLayout.header.personSetting"), icon: "gt-plane-setting", link: "/setting" },
16445
- { id: "news", label: t2("gitCodeLayout.home.informationCenter"), icon: "gt-plane-consulting", target: "_blank", href: `${transformNewsUrl(INFORMATION_CENTER_URL)}?lang=${getLocale(i18n) || "zh"}` },
16446
- { id: "help", label: t2("gitCodeLayout.header.helpDocument"), icon: "gt-plane-project-opened", target: "_blank", href: currentHelpDocsUrl() }
16447
- ]
16448
- ];
16449
- const hrefList = computed(() => {
16450
- var _a2;
16451
- return [
16452
- ...((_a2 = userCustomMenus.value) == null ? void 0 : _a2.length) ? userCustomMenus.value : baseHrefMenus,
16453
- [
16454
- { id: "logout", label: t2("gitCodeLayout.header.logout"), icon: "gt-default", action: handleLogout }
16455
- ]
16456
- ];
16457
- });
16458
- const avatarLangBlock = {
16459
- id: "avatar-lang",
16460
- component: markRaw(_sfc_main$F),
16461
- avatarLangRow: true
16462
- };
16463
- const shouldShowEnterpriseLang = computed(
16464
- () => {
16465
- var _a2;
16466
- return Boolean(props.inEnterpriseHeader && !((_a2 = props.userMenus) == null ? void 0 : _a2.length));
16467
- }
16468
- );
16469
- const accountMenuId = `toolbar-account-switcher-${(_a = getCurrentInstance()) == null ? void 0 : _a.uid}`;
16470
- const accountMenuOpen = ref(false);
16471
- const accountSwitcherRef = ref(null);
16472
- const accountSwitchButton = ref(null);
16473
- const accountMenuPanel = ref(null);
16474
- const closeAccountMenu = () => {
16475
- var _a2;
16476
- accountMenuOpen.value = false;
16477
- (_a2 = accountSwitchButton.value) == null ? void 0 : _a2.focus();
16478
- };
16479
- const toggleAccountMenu = async () => {
16480
- var _a2, _b;
16481
- accountMenuOpen.value = !accountMenuOpen.value;
16482
- if (accountMenuOpen.value) {
16483
- await nextTick();
16484
- (_b = (_a2 = accountMenuPanel.value) == null ? void 0 : _a2.querySelector("button:not(:disabled)")) == null ? void 0 : _b.focus();
16485
- }
16486
- };
16487
- const accountAction = (action, ref2) => {
16488
- closeAccountMenu();
16489
- if (action === "account-add") emit("account-add");
16490
- else if (action === "account-switch" && ref2) emit("account-switch", ref2);
16491
- else if (action === "account-reauthorize" && ref2) emit("account-reauthorize", ref2);
16492
- };
16493
- watch(() => props.menuVisible, (visible) => {
16494
- if (visible === false) accountMenuOpen.value = false;
16495
- });
16496
- const dismissAccountMenu = (event) => {
16497
- var _a2;
16498
- if (accountMenuOpen.value && event.target instanceof Node && !((_a2 = accountSwitcherRef.value) == null ? void 0 : _a2.contains(event.target))) {
16499
- accountMenuOpen.value = false;
16500
- }
16501
- };
16502
- const userMenuList = computed(() => {
16503
- const base = props.independence ? hrefList.value : routerMenuList.value;
16504
- const inserts = [];
16505
- if (shouldShowEnterpriseLang.value) {
16506
- inserts.push(avatarLangBlock);
16507
- }
16508
- if (!inserts.length) {
16509
- return base;
16510
- }
16511
- const next = [...base];
16512
- next.splice(next.length - 1, 0, ...inserts);
16513
- return next;
16514
- });
16515
- const getMenuHref = (item) => {
16516
- if (item.href) {
16517
- return item.href;
16518
- }
16519
- if (item.link) {
16520
- return toApplicationUrl(layoutConfig2.VITE_HOST, item.link);
16521
- }
16522
- return void 0;
16523
- };
16524
- function handleClick(item) {
16525
- if (item == null ? void 0 : item.action) {
16526
- item.action();
16527
- }
16429
+ if (api.get(SHORTCUT_STORAGE_KEY) !== serialized) {
16430
+ return;
16528
16431
  }
16529
- const handleLinkClick = (e) => {
16530
- const target = e.target;
16531
- const linkElement = target.closest("a.g-link, .g-link");
16532
- if (!linkElement) return;
16533
- const isDisabled = linkElement.hasAttribute("disabled") || linkElement.getAttribute("disabled") === "true" || linkElement.classList.contains("noPointer");
16534
- if (isDisabled) return;
16535
- const href = linkElement.getAttribute("href");
16536
- const to = linkElement.getAttribute("to");
16537
- const isValidHref = href && href !== "javascript:void(0)" && href !== "#" && href !== "";
16538
- const isValidTo = to && to !== "";
16539
- if (isValidHref || isValidTo) {
16540
- emit("link-click");
16541
- }
16542
- };
16543
- onMounted(() => {
16544
- document.addEventListener("pointerdown", dismissAccountMenu);
16545
- if (menuContainerRef.value) {
16546
- menuContainerRef.value.addEventListener("click", handleLinkClick, true);
16547
- }
16548
- });
16549
- onBeforeUnmount(() => {
16550
- document.removeEventListener("pointerdown", dismissAccountMenu);
16551
- if (menuContainerRef.value) {
16552
- menuContainerRef.value.removeEventListener("click", handleLinkClick, true);
16553
- }
16432
+ } catch {
16433
+ }
16434
+ }
16435
+ const providers = shallowRef([]);
16436
+ const searches = shallowRef([]);
16437
+ const notices = shallowRef([]);
16438
+ const blockers = shallowRef([]);
16439
+ const isBlocked = () => {
16440
+ var _a, _b;
16441
+ return Boolean(((_b = (_a = shortcutConfig.value).isBlocked) == null ? void 0 : _b.call(_a)) || blockers.value.some((blocked) => blocked()));
16442
+ };
16443
+ const dialog = ref(null);
16444
+ const shortcutDialog = readonly(dialog);
16445
+ const hasShortcutProvider = computed(() => providers.value.length > 0);
16446
+ let returnFocus = null;
16447
+ let pending = [];
16448
+ let timer;
16449
+ let detach;
16450
+ function resetShortcutSequence() {
16451
+ pending = [];
16452
+ clearTimeout(timer);
16453
+ timer = void 0;
16454
+ }
16455
+ function openShortcutHelp() {
16456
+ openDialog("help");
16457
+ }
16458
+ function openShortcutCommands() {
16459
+ openDialog("commands");
16460
+ }
16461
+ function openDialog(mode) {
16462
+ if (!hasShortcutProvider.value || typeof document === "undefined" || isBlocked()) {
16463
+ return;
16464
+ }
16465
+ if (!dialog.value) {
16466
+ returnFocus = document.activeElement;
16467
+ }
16468
+ resetShortcutSequence();
16469
+ dialog.value = mode;
16470
+ }
16471
+ function closeShortcutDialog(restoreFocus = true) {
16472
+ dialog.value = null;
16473
+ const previous = returnFocus;
16474
+ returnFocus = null;
16475
+ if (restoreFocus && typeof document !== "undefined") {
16476
+ void nextTick(() => {
16477
+ const target = (previous == null ? void 0 : previous.isConnected) ? previous : document.querySelector("[data-shortcut-help]");
16478
+ target == null ? void 0 : target.focus();
16554
16479
  });
16555
- const getVisit = async (value) => {
16556
- const visitedDate = localStorage$2.getItem(AVATAR_VISITED_DATE);
16557
- const nowDate = (/* @__PURE__ */ new Date()).toLocaleDateString("zh-CN");
16558
- const nowUserName = localStorage$2.getItem(AVATAR_VISITED_USERNAME);
16559
- if (visitedDate === nowDate && nowUserName === props.accountInfo.username) {
16560
- haveVisited.value = true;
16561
- }
16562
- };
16563
- getVisit();
16564
- return (_ctx, _cache) => {
16565
- return openBlock(), createElementBlock("div", {
16566
- ref_key: "menuContainerRef",
16567
- ref: menuContainerRef
16568
- }, [
16569
- createElementVNode("div", _hoisted_1$x, [
16570
- createVNode(GLink, {
16571
- class: "g-user-drawer-info",
16572
- href: `${unref(layoutConfig2).VITE_HOST}/${__props.accountInfo.username}`,
16573
- key: "myPage",
16574
- target: __props.isChatBot ? "_blank" : ""
16575
- }, {
16576
- default: withCtx(() => [
16577
- createVNode(_sfc_main$R, {
16578
- name: __props.accountInfo.nickname || "",
16579
- src: __props.accountInfo.avatar || "",
16580
- width: 52,
16581
- height: 52
16582
- }, null, 8, ["name", "src"]),
16583
- createElementVNode("div", _hoisted_2$q, [
16584
- createElementVNode("div", _hoisted_3$p, [
16585
- createElementVNode("p", {
16586
- class: "g-user-drawer-info-list-name ellipsis",
16587
- title: __props.accountInfo.nickname
16588
- }, toDisplayString$1(__props.accountInfo.nickname), 9, _hoisted_4$j),
16589
- createElementVNode("p", {
16590
- class: "g-user-drawer-info-list-id ellipsis",
16591
- title: __props.accountInfo.username
16592
- }, "@" + toDisplayString$1(__props.accountInfo.username), 9, _hoisted_5$e)
16593
- ]),
16594
- !__props.accountSessionSupported ? (openBlock(), createBlock(GIcon, {
16595
- key: 0,
16596
- name: "gt-line-right",
16597
- size: "16"
16598
- })) : createCommentVNode("", true)
16599
- ])
16600
- ]),
16601
- _: 1
16602
- }, 8, ["href", "target"]),
16603
- __props.accountSessionSupported ? (openBlock(), createElementBlock("div", {
16604
- key: 0,
16605
- ref_key: "accountSwitcherRef",
16606
- ref: accountSwitcherRef,
16607
- class: "g-user-account-switcher",
16608
- onKeydown: withKeys(withModifiers(closeAccountMenu, ["stop", "prevent"]), ["esc"])
16609
- }, [
16610
- createElementVNode("button", {
16611
- ref_key: "accountSwitchButton",
16612
- ref: accountSwitchButton,
16613
- class: "g-user-account-switcher-trigger",
16614
- type: "button",
16615
- "aria-label": unref(t2)("gitCodeLayout.header.accountSwitchTitle"),
16616
- "aria-haspopup": "dialog",
16617
- "aria-expanded": accountMenuOpen.value,
16618
- "aria-controls": accountMenuId,
16619
- disabled: __props.accountSessionBusy,
16620
- onClick: withModifiers(toggleAccountMenu, ["stop"])
16621
- }, [..._cache[5] || (_cache[5] = [
16622
- createElementVNode("svg", {
16623
- width: "20",
16624
- height: "20",
16625
- viewBox: "0 0 24 24",
16626
- fill: "none",
16627
- "aria-hidden": "true"
16628
- }, [
16629
- createElementVNode("path", {
16630
- d: "M4 8h15m-4-4 4 4-4 4M20 16H5m4-4-4 4 4 4",
16631
- stroke: "currentColor",
16632
- "stroke-width": "1.7",
16633
- "stroke-linecap": "round",
16634
- "stroke-linejoin": "round"
16635
- })
16636
- ], -1)
16637
- ])], 8, _hoisted_7$a),
16638
- accountMenuOpen.value ? (openBlock(), createElementBlock("div", {
16639
- key: 0,
16640
- id: accountMenuId,
16641
- ref_key: "accountMenuPanel",
16642
- ref: accountMenuPanel,
16643
- class: "g-user-account-switcher-panel",
16644
- role: "dialog",
16645
- "aria-label": unref(t2)("gitCodeLayout.header.accountSwitchTitle"),
16646
- tabindex: "-1"
16647
- }, [
16648
- createVNode(AccountSessionList, {
16649
- items: __props.accountSessions,
16650
- "active-ref": __props.accountSessionActiveRef,
16651
- max: __props.accountSessionMax,
16652
- busy: __props.accountSessionBusy,
16653
- onSwitch: _cache[0] || (_cache[0] = (ref2) => accountAction("account-switch", ref2)),
16654
- onAdd: _cache[1] || (_cache[1] = ($event) => accountAction("account-add")),
16655
- onReauthorize: _cache[2] || (_cache[2] = (ref2) => accountAction("account-reauthorize", ref2)),
16656
- onRemove: _cache[3] || (_cache[3] = (ref2) => emit("account-remove", ref2)),
16657
- onLogout: _cache[4] || (_cache[4] = ($event) => {
16658
- closeAccountMenu();
16659
- handleLogout();
16660
- })
16661
- }, null, 8, ["items", "active-ref", "max", "busy"])
16662
- ], 8, _hoisted_8$8)) : createCommentVNode("", true)
16663
- ], 40, _hoisted_6$d)) : createCommentVNode("", true)
16664
- ]),
16665
- !__props.inAIHub ? (openBlock(), createBlock(UserLevel, {
16666
- key: 0,
16667
- accountInfo: __props.accountInfo
16668
- }, null, 8, ["accountInfo"])) : createCommentVNode("", true),
16669
- (openBlock(true), createElementBlock(Fragment, null, renderList(userMenuList.value, (block, index2) => {
16670
- return openBlock(), createElementBlock("div", {
16671
- class: normalizeClass(["g-user-drawer-block", { "g-user-drawer-block--no-pt": index2 === 0 && __props.inAIHub }]),
16672
- key: index2
16673
- }, [
16674
- block.component ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
16675
- block.avatarLangRow ? (openBlock(), createElementBlock("div", _hoisted_9$8, [
16676
- (openBlock(), createBlock(resolveDynamicComponent(block.component), {
16677
- key: block.id
16678
- }))
16679
- ])) : (openBlock(), createBlock(resolveDynamicComponent(block.component), mergeProps({
16680
- key: block.id
16681
- }, { ref_for: true }, block.componentProps || {}), null, 16))
16682
- ], 64)) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(block, (item) => {
16683
- return openBlock(), createBlock(OptionLink, mergeProps({
16684
- key: item.id
16685
- }, { ref_for: true }, item, {
16686
- href: getMenuHref(item),
16687
- onClick: ($event) => handleClick(item),
16688
- target: __props.isChatBot && !item.action ? "_blank" : item.target || ""
16689
- }), {
16690
- default: withCtx(() => [
16691
- item.icon ? (openBlock(), createBlock(GIcon, {
16692
- key: 0,
16693
- name: item.icon,
16694
- size: "16px"
16695
- }, null, 8, ["name"])) : createCommentVNode("", true),
16696
- createTextVNode(toDisplayString$1(item.label), 1)
16697
- ]),
16698
- _: 2
16699
- }, 1040, ["href", "onClick", "target"]);
16700
- }), 128))
16701
- ], 2);
16702
- }), 128))
16703
- ], 512);
16704
- };
16705
16480
  }
16706
- });
16707
- const UserAvatarMenu = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["__scopeId", "data-v-vue-layout-gitcode"]]);
16708
- const _hoisted_1$w = { class: "g-user-avatar flex-center" };
16709
- const _hoisted_2$p = {
16710
- key: 0,
16711
- class: "g-user-avatar__badge"
16712
- };
16713
- const _hoisted_3$o = { class: "g-user-avatar flex-center" };
16714
- const _hoisted_4$i = {
16481
+ }
16482
+ const activeTarget = (targets) => [...targets].reverse().find((target) => target.when());
16483
+ const builtinActions = computed(() => BUILTIN_SHORTCUTS.filter((item) => item.id !== "site.escape").map((item) => {
16484
+ if (item.id === "site.search" || item.id === "site.searchLetter") {
16485
+ return { ...item, when: () => Boolean(activeTarget(searches.value)), run: () => {
16486
+ var _a;
16487
+ return (_a = activeTarget(searches.value)) == null ? void 0 : _a.run();
16488
+ } };
16489
+ }
16490
+ if (item.id === "site.notifications") {
16491
+ return { ...item, when: () => Boolean(activeTarget(notices.value)), run: () => {
16492
+ var _a;
16493
+ return (_a = activeTarget(notices.value)) == null ? void 0 : _a.run();
16494
+ } };
16495
+ }
16496
+ return { ...item, run: item.id === "site.help" ? openShortcutHelp : openShortcutCommands };
16497
+ }));
16498
+ const getAvailableShortcutActions = () => {
16499
+ if (!hasShortcutProvider.value) {
16500
+ return builtinActions.value.filter((action) => action.id === "site.search" && (!action.when || action.when()));
16501
+ }
16502
+ return [...builtinActions.value, ...shortcutConfig.value.actions].filter((action) => !action.when || action.when());
16503
+ };
16504
+ const selectionRevision = ref(0);
16505
+ const onSelectionChange = () => {
16506
+ selectionRevision.value += 1;
16507
+ };
16508
+ const availableShortcutActions = computed(() => {
16509
+ void selectionRevision.value;
16510
+ return getAvailableShortcutActions();
16511
+ });
16512
+ function executeShortcutAction(action) {
16513
+ if (isBlocked() || !getAvailableShortcutActions().some((item) => item.id === action.id) || action.when && !action.when()) {
16514
+ return;
16515
+ }
16516
+ closeShortcutDialog(false);
16517
+ void nextTick(() => {
16518
+ const current2 = getAvailableShortcutActions().find((item) => item.id === action.id);
16519
+ if (!isBlocked() && current2) {
16520
+ current2.run();
16521
+ }
16522
+ });
16523
+ }
16524
+ function onKeydown(event) {
16525
+ if (shouldIgnoreShortcut(event)) {
16526
+ resetShortcutSequence();
16527
+ return;
16528
+ }
16529
+ if (dialog.value || isBlocked()) {
16530
+ resetShortcutSequence();
16531
+ return;
16532
+ }
16533
+ if (event.key === "Escape") {
16534
+ if (pending.length) {
16535
+ event.preventDefault();
16536
+ resetShortcutSequence();
16537
+ }
16538
+ return;
16539
+ }
16540
+ const candidates = getAvailableShortcutActions().map((action) => ({ action, strokes: parseShortcut(action.keys) })).filter(({ strokes }) => characterShortcutsEnabled.value || !isCharacterShortcut(strokes));
16541
+ const matches = candidates.filter(({ strokes }) => strokes.length > pending.length && pending.every((key, index2) => key === JSON.stringify(strokes[index2])) && matchesStroke(event, strokes[pending.length]));
16542
+ const complete = matches.find(({ strokes }) => strokes.length === pending.length + 1);
16543
+ if (complete) {
16544
+ resetShortcutSequence();
16545
+ if (!complete.action.when || complete.action.when()) {
16546
+ event.preventDefault();
16547
+ complete.action.run();
16548
+ }
16549
+ } else if (matches.length) {
16550
+ pending.push(JSON.stringify(matches[0].strokes[pending.length]));
16551
+ clearTimeout(timer);
16552
+ timer = setTimeout(resetShortcutSequence, SHORTCUT_SEQUENCE_TIMEOUT);
16553
+ } else {
16554
+ resetShortcutSequence();
16555
+ }
16556
+ }
16557
+ function syncListener() {
16558
+ if (typeof document === "undefined") {
16559
+ return;
16560
+ }
16561
+ const needed = providers.value.length + searches.value.length > 0;
16562
+ if (!needed) {
16563
+ detach == null ? void 0 : detach();
16564
+ detach = void 0;
16565
+ resetShortcutSequence();
16566
+ return;
16567
+ }
16568
+ if (detach) {
16569
+ return;
16570
+ }
16571
+ refreshShortcutPreference();
16572
+ const onFocus = (event) => {
16573
+ if (isEditableTarget(event.target)) {
16574
+ resetShortcutSequence();
16575
+ }
16576
+ };
16577
+ document.addEventListener("keydown", onKeydown);
16578
+ document.addEventListener("focusin", onFocus);
16579
+ document.addEventListener("compositionstart", resetShortcutSequence);
16580
+ document.addEventListener("selectionchange", onSelectionChange);
16581
+ window.addEventListener("blur", resetShortcutSequence);
16582
+ window.addEventListener("focus", refreshShortcutPreference);
16583
+ const scope = effectScope(true);
16584
+ scope.run(() => {
16585
+ watch(shortcutRevision, resetShortcutSequence, { flush: "sync" });
16586
+ watch(characterShortcutsEnabled, resetShortcutSequence, { flush: "sync" });
16587
+ watch(isBlocked, resetShortcutSequence, { flush: "sync" });
16588
+ });
16589
+ detach = () => {
16590
+ document.removeEventListener("keydown", onKeydown);
16591
+ document.removeEventListener("focusin", onFocus);
16592
+ document.removeEventListener("compositionstart", resetShortcutSequence);
16593
+ document.removeEventListener("selectionchange", onSelectionChange);
16594
+ window.removeEventListener("blur", resetShortcutSequence);
16595
+ window.removeEventListener("focus", refreshShortcutPreference);
16596
+ scope.stop();
16597
+ };
16598
+ }
16599
+ function registerShortcutProvider() {
16600
+ const id = Symbol("shortcut-provider");
16601
+ providers.value = [...providers.value, id];
16602
+ syncListener();
16603
+ return {
16604
+ isOwner: computed(() => providers.value[0] === id),
16605
+ dispose: () => {
16606
+ providers.value = providers.value.filter((item) => item !== id);
16607
+ if (!providers.value.length) {
16608
+ closeShortcutDialog();
16609
+ resetShortcutSequence();
16610
+ }
16611
+ syncListener();
16612
+ }
16613
+ };
16614
+ }
16615
+ function registerTarget(target, collection) {
16616
+ collection.value = [...collection.value, target];
16617
+ syncListener();
16618
+ return () => {
16619
+ collection.value = collection.value.filter((item) => item !== target);
16620
+ syncListener();
16621
+ };
16622
+ }
16623
+ const registerShortcutSearch = (target) => registerTarget(target, searches);
16624
+ const registerShortcutNotice = (target) => registerTarget(target, notices);
16625
+ function useShortcutSearch(target) {
16626
+ let dispose;
16627
+ onMounted(() => {
16628
+ dispose = registerShortcutSearch(target);
16629
+ });
16630
+ onUnmounted(() => dispose == null ? void 0 : dispose());
16631
+ }
16632
+ function useShortcutNotice(target) {
16633
+ let dispose;
16634
+ onMounted(() => {
16635
+ dispose = registerShortcutNotice(target);
16636
+ });
16637
+ onUnmounted(() => dispose == null ? void 0 : dispose());
16638
+ }
16639
+ function useShortcutBlocker(blocked) {
16640
+ onMounted(() => {
16641
+ blockers.value = [...blockers.value, blocked];
16642
+ });
16643
+ onUnmounted(() => {
16644
+ blockers.value = blockers.value.filter((item) => item !== blocked);
16645
+ });
16646
+ }
16647
+ const _hoisted_1$x = { class: "g-user-drawer-account-heading" };
16648
+ const _hoisted_2$q = { class: "g-user-drawer-info-list" };
16649
+ const _hoisted_3$p = { class: "g-user-drawer-info-list__name-wrap" };
16650
+ const _hoisted_4$j = ["title"];
16651
+ const _hoisted_5$e = ["title"];
16652
+ const _hoisted_6$d = ["onKeydown"];
16653
+ const _hoisted_7$a = ["aria-label", "aria-expanded", "disabled"];
16654
+ const _hoisted_8$8 = ["aria-label"];
16655
+ const _hoisted_9$8 = {
16715
16656
  key: 0,
16716
- class: "g-user-avatar__badge"
16657
+ class: "g-user-drawer-lang-row"
16717
16658
  };
16718
- const _hoisted_5$d = { class: "g-user-drawer" };
16719
- const _hoisted_6$c = { class: "user-avatar__drawer-header" };
16720
- const _sfc_main$B = /* @__PURE__ */ defineComponent({
16721
- ...{
16722
- name: "UserAvatar"
16723
- },
16724
- __name: "UserAvatar",
16659
+ const _sfc_main$C = /* @__PURE__ */ defineComponent({
16660
+ __name: "UserAvatarMenu",
16725
16661
  props: {
16726
- isChatBot: { type: Boolean, default: false },
16727
- loginOutFinish: { type: Function, default: void 0 },
16728
- inAIHub: { type: Boolean, default: false },
16729
- independence: { type: Boolean, default: false },
16730
- userMenus: { default: () => [] },
16731
- inEnterpriseHeader: { type: Boolean, default: false },
16732
- accountSessionSupported: { type: Boolean, default: false },
16733
- accountSessionLogout: {},
16734
- accountSessions: { default: () => [] },
16735
- accountSessionActiveRef: { default: null },
16736
- accountSessionMax: { default: 5 },
16737
- accountSessionBusy: { type: Boolean, default: false }
16662
+ isChatBot: { type: Boolean },
16663
+ accountInfo: {},
16664
+ loginOutFinish: { type: Function },
16665
+ inAIHub: { type: Boolean },
16666
+ independence: { type: Boolean },
16667
+ userMenus: {},
16668
+ inEnterpriseHeader: { type: Boolean },
16669
+ accountSessionSupported: { type: Boolean },
16670
+ menuVisible: { type: Boolean },
16671
+ accountSessionLogout: { type: Function },
16672
+ accountSessions: {},
16673
+ accountSessionActiveRef: {},
16674
+ accountSessionMax: {},
16675
+ accountSessionBusy: { type: Boolean }
16738
16676
  },
16739
- emits: ["account-switch", "account-add", "account-reauthorize", "account-remove"],
16677
+ emits: ["link-click", "account-switch", "account-add", "account-reauthorize", "account-remove"],
16740
16678
  setup(__props, { emit: __emit }) {
16679
+ var _a;
16680
+ const layoutConfig2 = useLayoutConfig();
16681
+ const API = headRequest(inject("request"));
16682
+ const repoInfo = inject("repoInfo");
16683
+ const orgInfo = inject("orgInfo");
16684
+ const userInfo = inject("userInfo");
16685
+ const { t: t2 } = i18n.global;
16741
16686
  const props = __props;
16742
16687
  const emit = __emit;
16743
- const accountSessionBindings = computed(() => ({
16744
- accountSessionSupported: props.accountSessionSupported,
16745
- accountSessionLogout: props.accountSessionLogout,
16746
- accountSessions: props.accountSessions,
16747
- accountSessionActiveRef: props.accountSessionActiveRef,
16748
- accountSessionMax: props.accountSessionMax,
16749
- accountSessionBusy: props.accountSessionBusy,
16750
- onAccountSwitch: (ref2) => emit("account-switch", ref2),
16751
- onAccountAdd: () => emit("account-add"),
16752
- onAccountReauthorize: (ref2) => emit("account-reauthorize", ref2),
16753
- onAccountRemove: (ref2) => emit("account-remove", ref2)
16754
- }));
16755
- const { isMobile } = usePageResize();
16756
- const drawerVisible = ref(false);
16757
- const avatarMenuVisible = ref(false);
16758
- const userInfo = inject("userInfo");
16759
- const getLocalStorageUserInfo = () => {
16760
- try {
16761
- return JSON.parse(localStorage$2.getItem("userInfo") || "{}");
16762
- } catch {
16763
- return {};
16688
+ const router2 = useRouter();
16689
+ const route = useRoute();
16690
+ const haveVisited = ref(false);
16691
+ const menuContainerRef = ref(null);
16692
+ const clearSurveyDelayStatus = () => {
16693
+ const surveyDelay = localStorage$2.getItem(HARMONY_VISITED_DATE);
16694
+ if (surveyDelay === "true") {
16695
+ localStorage$2.removeItem(HARMONY_VISITED_DATE);
16764
16696
  }
16697
+ localStorage$2.removeItem(HARMONY_SURVEY_DELAY);
16765
16698
  };
16766
- const accountInfo = ref((userInfo == null ? void 0 : userInfo.value) || getLocalStorageUserInfo());
16767
- const haveVisited = ref(false);
16768
- const useReport2 = inject("useReport");
16769
- watch(
16770
- () => userInfo == null ? void 0 : userInfo.value,
16771
- (newValue) => {
16772
- if (newValue == null ? void 0 : newValue.id) {
16773
- accountInfo.value = newValue;
16699
+ const handleLogout = async () => {
16700
+ var _a2, _b, _c;
16701
+ if (props.accountSessionSupported) {
16702
+ if (!props.accountSessionBusy) await ((_a2 = props.accountSessionLogout) == null ? void 0 : _a2.call(props));
16703
+ return;
16704
+ }
16705
+ const res = await API.toLogout();
16706
+ clearSurveyDelayStatus();
16707
+ if (!res.error) {
16708
+ props.loginOutFinish && props.loginOutFinish();
16709
+ if (((_b = route.meta) == null ? void 0 : _b.needLogin) || ((_c = route.meta) == null ? void 0 : _c.type) === "repo" && (repoInfo == null ? void 0 : repoInfo.value.visibility) === "private" || (orgInfo == null ? void 0 : orgInfo.value.visibility) === "private") {
16710
+ router2.push("/");
16774
16711
  } else {
16775
- accountInfo.value = getLocalStorageUserInfo();
16712
+ const $route = Object.assign({}, route);
16713
+ delete $route.query.isLogin;
16714
+ if (typeof window !== "undefined" && window.location) {
16715
+ window.location.href = router2.resolve($route).href;
16716
+ }
16776
16717
  }
16718
+ } else {
16719
+ props.loginOutFinish && props.loginOutFinish();
16720
+ }
16721
+ };
16722
+ const DEFAULT_ROUTER_PARAMS = Object.freeze({
16723
+ name: "",
16724
+ params: {
16725
+ namespace: props.accountInfo.username
16777
16726
  },
16778
- { immediate: true }
16779
- );
16780
- const handleToggle = (status) => {
16781
- avatarMenuVisible.value = Boolean(status);
16782
- visitedClick();
16783
- const params = { need_tips: accountInfo.value.need_tips, prompt_style: accountInfo.value.style_tips };
16784
- useReport2("score_personal_center_avatar_click", params);
16785
- if (status) {
16786
- useReport2("score_personal_center_dropdown", params);
16727
+ query: {}
16728
+ });
16729
+ const getRouterLink = (params) => {
16730
+ if (typeof params === "string") {
16731
+ return {
16732
+ ...DEFAULT_ROUTER_PARAMS,
16733
+ name: params
16734
+ };
16787
16735
  }
16788
- nextTick(() => {
16789
- if (judgeDrawerScroll()) {
16790
- handleDropdownScroll(status);
16736
+ return {
16737
+ ...DEFAULT_ROUTER_PARAMS,
16738
+ ...params
16739
+ };
16740
+ };
16741
+ const menuDataFormat = (data) => {
16742
+ data.forEach((item) => {
16743
+ if (Array.isArray(item)) {
16744
+ item.forEach((item2) => {
16745
+ if (item2.to) {
16746
+ item2.to = getRouterLink(item2.to);
16747
+ }
16748
+ });
16791
16749
  }
16792
16750
  });
16751
+ return data;
16793
16752
  };
16794
- const visitedClick = () => {
16795
- if (haveVisited.value) {
16796
- return;
16753
+ const userCustomMenus = computed(() => {
16754
+ if (props.userMenus) {
16755
+ return menuDataFormat(props.userMenus);
16797
16756
  }
16798
- haveVisited.value = true;
16799
- handleAvatarRedPoint(CLICK_TIME_MODULE.GROWTH_CENTER, accountInfo.value.username);
16757
+ return [];
16758
+ });
16759
+ const baseRouterMenus = [
16760
+ [
16761
+ { id: "dashboard", label: t2("gitCodeLayout.header.workbench"), icon: "gt-plane-user", to: getRouterLink("dashboard") },
16762
+ { id: "myEnterprise", label: t2("gitCodeLayout.header.myEnterprise"), icon: "gt-a-plane-enterprise", to: getRouterLink({ path: "/setting/enterprise" }) },
16763
+ { id: "myOrg", label: t2("gitCodeLayout.header.myOrg"), icon: "gt-plane-organization", to: getRouterLink({ name: "settingOrganization" }) },
16764
+ { id: "myRepo", label: t2("gitCodeLayout.header.myRepo"), icon: "gt-plane-projectHome1", to: getRouterLink("settingRepo") },
16765
+ { id: "myNotebook", label: t2("gitCodeLayout.header.myNotebook"), icon: "gt-plane-Notebook", to: getRouterLink("myNotebook") },
16766
+ // { id: 'myCloudSpace', label: t('gitCodeLayout.header.myCloudSpace'), icon: 'gt-plane-cloud', target: '_blank', href: 'https://devstation.connect.huaweicloud.com/devdesktop/webide' },
16767
+ { id: "mySpaces", label: t2("gitCodeLayout.header.mySpace"), icon: "gt-plane-Space", to: getRouterLink("userSpaces") },
16768
+ { id: "myStar", label: t2("gitCodeLayout.header.myStar"), icon: "gt-plane-star", to: getRouterLink("userStars") }
16769
+ ],
16770
+ [
16771
+ { id: "personalSetting", label: t2("gitCodeLayout.header.personSetting"), icon: "gt-plane-setting", to: getRouterLink("setting") },
16772
+ { id: "news", label: t2("gitCodeLayout.home.informationCenter"), icon: "gt-plane-consulting", target: "_blank", href: `${transformNewsUrl(INFORMATION_CENTER_URL)}?lang=${getLocale(i18n) || "zh"}` },
16773
+ { id: "help", label: t2("gitCodeLayout.header.helpDocument"), icon: "gt-plane-project-opened", href: currentHelpDocsUrl() }
16774
+ ]
16775
+ ];
16776
+ const routerMenuList = computed(() => {
16777
+ var _a2;
16778
+ return [
16779
+ ...((_a2 = userCustomMenus.value) == null ? void 0 : _a2.length) ? userCustomMenus.value : baseRouterMenus,
16780
+ [
16781
+ { id: "logout", label: t2("gitCodeLayout.header.logout"), icon: "gt-default", action: handleLogout }
16782
+ ]
16783
+ ];
16784
+ });
16785
+ const baseHrefMenus = [
16786
+ [
16787
+ { id: "dashboard", label: t2("gitCodeLayout.header.workbench"), icon: "gt-plane-user", link: "/dashboard" },
16788
+ { id: "myEnterprise", label: t2("gitCodeLayout.header.myEnterprise"), icon: "gt-a-plane-enterprise", link: "/setting/enterprise" },
16789
+ { id: "myOrg", label: t2("gitCodeLayout.header.myOrg"), icon: "gt-plane-organization", link: "/setting/organization" },
16790
+ { id: "myRepo", label: t2("gitCodeLayout.header.myRepo"), icon: "gt-plane-projectHome1", link: "/setting/repo" },
16791
+ { id: "myNotebook", label: t2("gitCodeLayout.header.myNotebook"), icon: "gt-plane-Notebook", show: props.inAIHub, link: `/user/${userInfo.value.username}/notebook` },
16792
+ // { id: 'myCloudSpace', label: t('gitCodeLayout.header.myCloudSpace'), icon: 'gt-plane-cloud', link: 'https://devstation.connect.huaweicloud.com/devdesktop/webide' },
16793
+ { id: "mySpaces", label: t2("gitCodeLayout.header.mySpace"), icon: "gt-plane-Space", show: props.inAIHub, link: `/user/${userInfo.value.username}/spaces` },
16794
+ { id: "myStar", label: t2("gitCodeLayout.header.myStar"), icon: "gt-plane-star", link: `/user/${userInfo.value.username}/stars` }
16795
+ ],
16796
+ [
16797
+ { id: "personalSetting", label: t2("gitCodeLayout.header.personSetting"), icon: "gt-plane-setting", link: "/setting" },
16798
+ { id: "news", label: t2("gitCodeLayout.home.informationCenter"), icon: "gt-plane-consulting", target: "_blank", href: `${transformNewsUrl(INFORMATION_CENTER_URL)}?lang=${getLocale(i18n) || "zh"}` },
16799
+ { id: "help", label: t2("gitCodeLayout.header.helpDocument"), icon: "gt-plane-project-opened", target: "_blank", href: currentHelpDocsUrl() }
16800
+ ]
16801
+ ];
16802
+ const hrefList = computed(() => {
16803
+ var _a2;
16804
+ return [
16805
+ ...((_a2 = userCustomMenus.value) == null ? void 0 : _a2.length) ? userCustomMenus.value : baseHrefMenus,
16806
+ [
16807
+ { id: "logout", label: t2("gitCodeLayout.header.logout"), icon: "gt-default", action: handleLogout }
16808
+ ]
16809
+ ];
16810
+ });
16811
+ const avatarLangBlock = {
16812
+ id: "avatar-lang",
16813
+ component: markRaw(_sfc_main$F),
16814
+ avatarLangRow: true
16800
16815
  };
16801
- const getVisit = async (value) => {
16802
- const visitedDate = localStorage$2.getItem(AVATAR_VISITED_DATE);
16803
- const nowDate = (/* @__PURE__ */ new Date()).toLocaleDateString("zh-CN");
16804
- const nowUserName = localStorage$2.getItem(AVATAR_VISITED_USERNAME);
16805
- if (visitedDate === nowDate && nowUserName === accountInfo.value.username) {
16806
- haveVisited.value = true;
16816
+ const shouldShowEnterpriseLang = computed(
16817
+ () => {
16818
+ var _a2;
16819
+ return Boolean(props.inEnterpriseHeader && !((_a2 = props.userMenus) == null ? void 0 : _a2.length));
16807
16820
  }
16821
+ );
16822
+ const accountMenuId = `toolbar-account-switcher-${(_a = getCurrentInstance()) == null ? void 0 : _a.uid}`;
16823
+ const accountMenuOpen = ref(false);
16824
+ useShortcutBlocker(() => accountMenuOpen.value);
16825
+ const accountSwitcherRef = ref(null);
16826
+ const accountSwitchButton = ref(null);
16827
+ const accountMenuPanel = ref(null);
16828
+ const closeAccountMenu = () => {
16829
+ var _a2;
16830
+ accountMenuOpen.value = false;
16831
+ (_a2 = accountSwitchButton.value) == null ? void 0 : _a2.focus();
16808
16832
  };
16809
- getVisit();
16810
- const judgeDrawerScroll = () => {
16811
- var _a;
16812
- if (typeof document !== "undefined" && document.querySelector) {
16813
- const userDrawerWarpDom = (_a = document.querySelector(".g-user-dropdown")) == null ? void 0 : _a.querySelector(".devui-dropdown__menu-wrap");
16814
- if (!userDrawerWarpDom) {
16815
- return false;
16816
- }
16817
- return userDrawerWarpDom.scrollHeight > userDrawerWarpDom.clientHeight;
16833
+ const toggleAccountMenu = async () => {
16834
+ var _a2, _b;
16835
+ accountMenuOpen.value = !accountMenuOpen.value;
16836
+ if (accountMenuOpen.value) {
16837
+ await nextTick();
16838
+ (_b = (_a2 = accountMenuPanel.value) == null ? void 0 : _a2.querySelector("button:not(:disabled)")) == null ? void 0 : _b.focus();
16818
16839
  }
16819
- return false;
16820
16840
  };
16821
- const handleDropdownScroll = (status) => {
16822
- if (typeof document === "undefined" || !document.querySelector) return;
16823
- const dropdownMenu = document.querySelector(".g-user-dropdown .devui-dropdown__menu-wrap");
16824
- if (!dropdownMenu) return;
16825
- if (status) {
16826
- dropdownMenu.removeEventListener("wheel", preventScrollPropagation);
16827
- dropdownMenu.addEventListener("wheel", preventScrollPropagation, { passive: false });
16828
- } else {
16829
- dropdownMenu.removeEventListener("wheel", preventScrollPropagation);
16841
+ const accountAction = (action, ref2) => {
16842
+ closeAccountMenu();
16843
+ if (action === "account-add") emit("account-add");
16844
+ else if (action === "account-switch" && ref2) emit("account-switch", ref2);
16845
+ else if (action === "account-reauthorize" && ref2) emit("account-reauthorize", ref2);
16846
+ };
16847
+ watch(() => props.menuVisible, (visible) => {
16848
+ if (visible === false) accountMenuOpen.value = false;
16849
+ });
16850
+ const dismissAccountMenu = (event) => {
16851
+ var _a2;
16852
+ if (accountMenuOpen.value && event.target instanceof Node && !((_a2 = accountSwitcherRef.value) == null ? void 0 : _a2.contains(event.target))) {
16853
+ accountMenuOpen.value = false;
16830
16854
  }
16831
16855
  };
16832
- const preventScrollPropagation = (e) => {
16833
- const target = e.currentTarget;
16834
- if (!target) return;
16835
- const { scrollTop, scrollHeight, clientHeight } = target;
16836
- const isScrollingDown = e.deltaY > 0;
16837
- const isScrollingUp = e.deltaY < 0;
16838
- const threshold = 4;
16839
- if (isScrollingDown && scrollTop + clientHeight >= scrollHeight - threshold) {
16840
- e.preventDefault();
16841
- e.stopPropagation();
16842
- return;
16856
+ const userMenuList = computed(() => {
16857
+ const base = props.independence ? hrefList.value : routerMenuList.value;
16858
+ const inserts = [];
16859
+ if (shouldShowEnterpriseLang.value) {
16860
+ inserts.push(avatarLangBlock);
16843
16861
  }
16844
- if (isScrollingUp && scrollTop <= threshold) {
16845
- e.preventDefault();
16846
- e.stopPropagation();
16847
- return;
16862
+ if (!inserts.length) {
16863
+ return base;
16848
16864
  }
16849
- e.stopPropagation();
16850
- };
16851
- const resetOverflow = () => {
16852
- if (typeof document === "undefined" || !document.querySelector) return;
16853
- const dropdownMenu = document.querySelector(".g-user-dropdown .devui-dropdown__menu-wrap");
16854
- if (dropdownMenu) {
16855
- dropdownMenu.removeEventListener("wheel", preventScrollPropagation);
16865
+ const next = [...base];
16866
+ next.splice(next.length - 1, 0, ...inserts);
16867
+ return next;
16868
+ });
16869
+ const getMenuHref = (item) => {
16870
+ if (item.href) {
16871
+ return item.href;
16872
+ }
16873
+ if (item.link) {
16874
+ return toApplicationUrl(layoutConfig2.VITE_HOST, item.link);
16856
16875
  }
16876
+ return void 0;
16857
16877
  };
16858
- const handleStorageChange = (e) => {
16859
- if (e.key === "userInfo") {
16860
- if (!(userInfo == null ? void 0 : userInfo.value)) {
16861
- try {
16862
- accountInfo.value = JSON.parse(e.newValue || "{}");
16863
- } catch {
16864
- accountInfo.value = {};
16865
- }
16866
- }
16878
+ function handleClick(item) {
16879
+ if (item == null ? void 0 : item.action) {
16880
+ item.action();
16881
+ }
16882
+ }
16883
+ const handleLinkClick = (e) => {
16884
+ const target = e.target;
16885
+ const linkElement = target.closest("a.g-link, .g-link");
16886
+ if (!linkElement) return;
16887
+ const isDisabled = linkElement.hasAttribute("disabled") || linkElement.getAttribute("disabled") === "true" || linkElement.classList.contains("noPointer");
16888
+ if (isDisabled) return;
16889
+ const href = linkElement.getAttribute("href");
16890
+ const to = linkElement.getAttribute("to");
16891
+ const isValidHref = href && href !== "javascript:void(0)" && href !== "#" && href !== "";
16892
+ const isValidTo = to && to !== "";
16893
+ if (isValidHref || isValidTo) {
16894
+ emit("link-click");
16867
16895
  }
16868
16896
  };
16869
16897
  onMounted(() => {
16870
- window.addEventListener("storage", handleStorageChange);
16898
+ document.addEventListener("pointerdown", dismissAccountMenu);
16899
+ if (menuContainerRef.value) {
16900
+ menuContainerRef.value.addEventListener("click", handleLinkClick, true);
16901
+ }
16871
16902
  });
16872
16903
  onBeforeUnmount(() => {
16873
- window.removeEventListener("storage", handleStorageChange);
16874
- resetOverflow();
16904
+ document.removeEventListener("pointerdown", dismissAccountMenu);
16905
+ if (menuContainerRef.value) {
16906
+ menuContainerRef.value.removeEventListener("click", handleLinkClick, true);
16907
+ }
16875
16908
  });
16909
+ const getVisit = async (value) => {
16910
+ const visitedDate = localStorage$2.getItem(AVATAR_VISITED_DATE);
16911
+ const nowDate = (/* @__PURE__ */ new Date()).toLocaleDateString("zh-CN");
16912
+ const nowUserName = localStorage$2.getItem(AVATAR_VISITED_USERNAME);
16913
+ if (visitedDate === nowDate && nowUserName === props.accountInfo.username) {
16914
+ haveVisited.value = true;
16915
+ }
16916
+ };
16917
+ getVisit();
16876
16918
  return (_ctx, _cache) => {
16877
- return openBlock(), createElementBlock(Fragment, null, [
16878
- unref(isMobile) ? (openBlock(), createElementBlock("div", {
16879
- key: 0,
16880
- onClick: _cache[0] || (_cache[0] = ($event) => drawerVisible.value = true)
16881
- }, [
16882
- createElementVNode("div", _hoisted_1$w, [
16883
- createVNode(_sfc_main$R, {
16884
- name: accountInfo.value.nickname,
16885
- src: unref(transformUrl)(accountInfo.value.avatar)
16886
- }, null, 8, ["name", "src"]),
16887
- accountInfo.value.need_tips && !haveVisited.value ? (openBlock(), createElementBlock("div", _hoisted_2$p, [..._cache[4] || (_cache[4] = [
16888
- createElementVNode("div", null, null, -1)
16889
- ])])) : createCommentVNode("", true)
16890
- ])
16891
- ])) : (openBlock(), createBlock(unref(Dropdown), {
16892
- key: 1,
16893
- position: ["bottom-start"],
16894
- "destroy-on-hide": false,
16895
- trigger: "hover",
16896
- "overlay-class": "g-user-dropdown",
16897
- onToggle: handleToggle
16898
- }, {
16899
- menu: withCtx(() => [
16900
- createElementVNode("div", _hoisted_5$d, [
16901
- createVNode(UserAvatarMenu, mergeProps({
16902
- "menu-visible": avatarMenuVisible.value,
16903
- independence: __props.independence,
16904
- loginOutFinish: __props.loginOutFinish,
16905
- accountInfo: accountInfo.value,
16906
- isChatBot: __props.isChatBot,
16907
- inAIHub: __props.inAIHub,
16908
- userMenus: __props.userMenus,
16909
- inEnterpriseHeader: __props.inEnterpriseHeader
16910
- }, accountSessionBindings.value, { onLinkClick: resetOverflow }), null, 16, ["menu-visible", "independence", "loginOutFinish", "accountInfo", "isChatBot", "inAIHub", "userMenus", "inEnterpriseHeader"])
16911
- ])
16912
- ]),
16913
- default: withCtx(() => [
16914
- createElementVNode("div", _hoisted_3$o, [
16919
+ return openBlock(), createElementBlock("div", {
16920
+ ref_key: "menuContainerRef",
16921
+ ref: menuContainerRef
16922
+ }, [
16923
+ createElementVNode("div", _hoisted_1$x, [
16924
+ createVNode(GLink, {
16925
+ class: "g-user-drawer-info",
16926
+ href: `${unref(layoutConfig2).VITE_HOST}/${__props.accountInfo.username}`,
16927
+ key: "myPage",
16928
+ target: __props.isChatBot ? "_blank" : ""
16929
+ }, {
16930
+ default: withCtx(() => [
16915
16931
  createVNode(_sfc_main$R, {
16916
- name: accountInfo.value.nickname,
16917
- src: unref(transformUrl)(accountInfo.value.avatar)
16932
+ name: __props.accountInfo.nickname || "",
16933
+ src: __props.accountInfo.avatar || "",
16934
+ width: 52,
16935
+ height: 52
16918
16936
  }, null, 8, ["name", "src"]),
16919
- accountInfo.value.need_tips && !haveVisited.value ? (openBlock(), createElementBlock("div", _hoisted_4$i, [..._cache[5] || (_cache[5] = [
16920
- createElementVNode("div", null, null, -1)
16921
- ])])) : createCommentVNode("", true)
16922
- ])
16923
- ]),
16924
- _: 1
16925
- })),
16926
- createVNode(unref(Drawer), {
16927
- modelValue: drawerVisible.value,
16928
- "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => drawerVisible.value = $event),
16929
- position: "right",
16930
- "lock-scroll": "",
16931
- style: normalizeStyle([{ "top": "0", "max-height": "100%" }, { width: "240px", overflowY: "scroll" }])
16932
- }, {
16933
- default: withCtx(() => [
16934
- createElementVNode("div", null, [
16935
- createElementVNode("div", _hoisted_6$c, [
16936
- createVNode(unref(Button), {
16937
- class: "draw-side-bar-close",
16938
- icon: "close",
16939
- onClick: _cache[1] || (_cache[1] = ($event) => drawerVisible.value = false),
16940
- variant: "text"
16937
+ createElementVNode("div", _hoisted_2$q, [
16938
+ createElementVNode("div", _hoisted_3$p, [
16939
+ createElementVNode("p", {
16940
+ class: "g-user-drawer-info-list-name ellipsis",
16941
+ title: __props.accountInfo.nickname
16942
+ }, toDisplayString$1(__props.accountInfo.nickname), 9, _hoisted_4$j),
16943
+ createElementVNode("p", {
16944
+ class: "g-user-drawer-info-list-id ellipsis",
16945
+ title: __props.accountInfo.username
16946
+ }, "@" + toDisplayString$1(__props.accountInfo.username), 9, _hoisted_5$e)
16947
+ ]),
16948
+ !__props.accountSessionSupported ? (openBlock(), createBlock(GIcon, {
16949
+ key: 0,
16950
+ name: "gt-line-right",
16951
+ size: "16"
16952
+ })) : createCommentVNode("", true)
16953
+ ])
16954
+ ]),
16955
+ _: 1
16956
+ }, 8, ["href", "target"]),
16957
+ __props.accountSessionSupported ? (openBlock(), createElementBlock("div", {
16958
+ key: 0,
16959
+ ref_key: "accountSwitcherRef",
16960
+ ref: accountSwitcherRef,
16961
+ class: "g-user-account-switcher",
16962
+ onKeydown: withKeys(withModifiers(closeAccountMenu, ["stop", "prevent"]), ["esc"])
16963
+ }, [
16964
+ createElementVNode("button", {
16965
+ ref_key: "accountSwitchButton",
16966
+ ref: accountSwitchButton,
16967
+ class: "g-user-account-switcher-trigger",
16968
+ type: "button",
16969
+ "aria-label": unref(t2)("gitCodeLayout.header.accountSwitchTitle"),
16970
+ "aria-haspopup": "dialog",
16971
+ "aria-expanded": accountMenuOpen.value,
16972
+ "aria-controls": accountMenuId,
16973
+ disabled: __props.accountSessionBusy,
16974
+ onClick: withModifiers(toggleAccountMenu, ["stop"])
16975
+ }, [..._cache[5] || (_cache[5] = [
16976
+ createElementVNode("svg", {
16977
+ width: "20",
16978
+ height: "20",
16979
+ viewBox: "0 0 24 24",
16980
+ fill: "none",
16981
+ "aria-hidden": "true"
16982
+ }, [
16983
+ createElementVNode("path", {
16984
+ d: "M4 8h15m-4-4 4 4-4 4M20 16H5m4-4-4 4 4 4",
16985
+ stroke: "currentColor",
16986
+ "stroke-width": "1.7",
16987
+ "stroke-linecap": "round",
16988
+ "stroke-linejoin": "round"
16941
16989
  })
16942
- ]),
16943
- createVNode(UserAvatarMenu, mergeProps({
16944
- "menu-visible": drawerVisible.value,
16945
- independence: __props.independence,
16946
- loginOutFinish: __props.loginOutFinish,
16947
- accountInfo: accountInfo.value,
16948
- isChatBot: __props.isChatBot,
16949
- inAIHub: __props.inAIHub,
16950
- userMenus: __props.userMenus,
16951
- inEnterpriseHeader: __props.inEnterpriseHeader
16952
- }, accountSessionBindings.value, {
16953
- onClick: _cache[2] || (_cache[2] = ($event) => drawerVisible.value = false),
16954
- onLinkClick: resetOverflow
16955
- }), null, 16, ["menu-visible", "independence", "loginOutFinish", "accountInfo", "isChatBot", "inAIHub", "userMenus", "inEnterpriseHeader"])
16956
- ])
16957
- ]),
16958
- _: 1
16959
- }, 8, ["modelValue"])
16960
- ], 64);
16961
- };
16962
- }
16963
- });
16964
- const UserAvatar = /* @__PURE__ */ _export_sfc(_sfc_main$B, [["__scopeId", "data-v-vue-layout-gitcode"]]);
16965
- var EVENT_NAME = /* @__PURE__ */ ((EVENT_NAME2) => {
16966
- EVENT_NAME2["START_SEARCH"] = "开始搜索";
16967
- EVENT_NAME2["SEARCH"] = "搜索";
16968
- EVENT_NAME2["END_SEARCH"] = "结束搜索";
16969
- EVENT_NAME2["CLICK_SEARCH_RESULT"] = "点击搜索结果";
16970
- EVENT_NAME2["CLICK_RELATIVE_SEARCH"] = "点击相关搜索结果";
16971
- EVENT_NAME2["HEADER_START_SEARCH"] = "头部搜索";
16972
- EVENT_NAME2["OPEN_FORK_PROJECT"] = "打开创建Fork项目";
16973
- EVENT_NAME2["FORK_PROJECT"] = "提交创建Fork项目";
16974
- EVENT_NAME2["FORK_PROJECT_SUCCESS"] = "成功Fork项目";
16975
- EVENT_NAME2["OPEN_CREATE_PR"] = "打开创建PR";
16976
- EVENT_NAME2["CREATE_PR_CHOSE_BRANCH"] = "创建PR选择分支-下一步";
16977
- EVENT_NAME2["CREATE_PR"] = "提交创建PR";
16978
- EVENT_NAME2["CREATE_PR_SUCESS"] = "成功创建PR";
16979
- EVENT_NAME2["MERGE_PR"] = "合入PR";
16980
- EVENT_NAME2["OPEN_FILE_EDIT_SUBMIT"] = "打开文件修改";
16981
- EVENT_NAME2["FILE_EDIT_SUBMIT"] = "提交文件修改";
16982
- EVENT_NAME2["FILE_EDIT_MODAL_SUBMIT"] = "文件修改弹框提交修改";
16983
- EVENT_NAME2["FILE_EDIT_SUCCESS"] = "成功修改文件";
16984
- EVENT_NAME2["REVIEW_CODE_CHANGE"] = "代码变更检视";
16985
- EVENT_NAME2["OPEN_REGISTER"] = "打开注册页面";
16986
- EVENT_NAME2["CLICK_REGISTER"] = "点击注册新账号";
16987
- EVENT_NAME2["REGISTER"] = "新用户注册";
16988
- EVENT_NAME2["REGISTER_SUCCESS"] = "新用户成功注册";
16989
- EVENT_NAME2["STAR"] = "star项目";
16990
- EVENT_NAME2["UNSTAR"] = "unstar项目";
16991
- EVENT_NAME2["DOWNLOAD_ZIP"] = "下载zip";
16992
- EVENT_NAME2["CLONE"] = "克隆项目";
16993
- EVENT_NAME2["OPEN_CREATE_PROJECT"] = "打开新建项目";
16994
- EVENT_NAME2["CREATE_PROJECT"] = "提交新建项目";
16995
- EVENT_NAME2["CREATE_PROJECT_SUCCESS"] = "成功新建项目";
16996
- EVENT_NAME2["OPEN_IMPORT_PROJECT"] = "打开导入项目";
16997
- EVENT_NAME2["IMPORT_PROJECT"] = "提交导入项目";
16998
- EVENT_NAME2["IMPORT_PROJECT_SUCCESS"] = "成功导入项目";
16999
- EVENT_NAME2["OPEN_CREATE_ORG"] = "打开创建组织";
17000
- EVENT_NAME2["CREATE_ORG"] = "提交创建组织";
17001
- EVENT_NAME2["CREATE_ORG_SUCCESS"] = "成功创建组织";
17002
- EVENT_NAME2["OPEN_CREATE_ISSUE"] = "打开创建issue";
17003
- EVENT_NAME2["OPEN_CREATE_SECURITY_ISSUE"] = "打开报告安全漏洞";
17004
- EVENT_NAME2["OPEN_CREATE_NORMAL_ISSUE"] = "打开创建普通issue";
17005
- EVENT_NAME2["CREATE_SECURITY_ISSUE"] = "提交报告安全漏洞";
17006
- EVENT_NAME2["CREATE_SECURITY_ISSUE_SUCCESS"] = "成功报告安全漏洞";
17007
- EVENT_NAME2["CREATE_ISSUE"] = "提交创建issue";
17008
- EVENT_NAME2["CREATE_ISSUE_SUCCESS"] = "成功创建issue";
17009
- EVENT_NAME2["OPEN_UPLOAD_FILE"] = "打开上传文件弹框";
17010
- EVENT_NAME2["UPLOAD_FILE"] = "提交上传文件";
17011
- EVENT_NAME2["UPLOAD_FILE_SUCCESS"] = "成功上传文件";
17012
- EVENT_NAME2["FOURZEROFOUR"] = "404页面精选项目进入";
17013
- EVENT_NAME2["OPEN_LOGIN"] = "打开登录页面";
17014
- return EVENT_NAME2;
17015
- })(EVENT_NAME || {});
17016
- function _frEventTrack(eventName, type = "custom") {
17017
- var _a;
17018
- try {
17019
- (_a = window.FURION) == null ? void 0 : _a.log(type, eventName);
17020
- } catch (err) {
17021
- }
17022
- }
17023
- const isSearchHistoryEntry = (value) => {
17024
- return typeof value === "object" && value !== null && !Array.isArray(value);
17025
- };
17026
- const normalizeSearchHistoryEntry = (value) => {
17027
- if (typeof value === "string") {
17028
- return { q: value, type: "repo" };
17029
- }
17030
- if (!isSearchHistoryEntry(value)) {
17031
- return { q: "", type: "repo" };
17032
- }
17033
- return { ...value, type: value.type || "repo" };
17034
- };
17035
- const sameSearchHistory = (left, right) => {
17036
- const leftEntry = normalizeSearchHistoryEntry(left);
17037
- return leftEntry.q === right.q && leftEntry.type === right.type && leftEntry.scope === right.scope && leftEntry.repo === right.repo && leftEntry.org === right.org && leftEntry.user === right.user && leftEntry.namespace === right.namespace;
17038
- };
17039
- const upsertSearchHistory = (current2, data, limit = 10) => {
17040
- const next = current2.filter((item) => Boolean(normalizeSearchHistoryEntry(item).q));
17041
- const normalizedData = { ...data, type: data.type || "repo" };
17042
- const existingIndex = next.findIndex((item) => sameSearchHistory(item, normalizedData));
17043
- if (existingIndex === -1) {
17044
- next.unshift({ ...normalizedData, count: normalizedData.count || 1 });
17045
- } else {
17046
- const existing = normalizeSearchHistoryEntry(next[existingIndex]);
17047
- existing.count = (existing.count || 1) + 1;
17048
- next.splice(existingIndex, 1);
17049
- next.unshift(existing);
16990
+ ], -1)
16991
+ ])], 8, _hoisted_7$a),
16992
+ accountMenuOpen.value ? (openBlock(), createElementBlock("div", {
16993
+ key: 0,
16994
+ id: accountMenuId,
16995
+ ref_key: "accountMenuPanel",
16996
+ ref: accountMenuPanel,
16997
+ class: "g-user-account-switcher-panel",
16998
+ role: "dialog",
16999
+ "aria-label": unref(t2)("gitCodeLayout.header.accountSwitchTitle"),
17000
+ tabindex: "-1"
17001
+ }, [
17002
+ createVNode(AccountSessionList, {
17003
+ items: __props.accountSessions,
17004
+ "active-ref": __props.accountSessionActiveRef,
17005
+ max: __props.accountSessionMax,
17006
+ busy: __props.accountSessionBusy,
17007
+ onSwitch: _cache[0] || (_cache[0] = (ref2) => accountAction("account-switch", ref2)),
17008
+ onAdd: _cache[1] || (_cache[1] = ($event) => accountAction("account-add")),
17009
+ onReauthorize: _cache[2] || (_cache[2] = (ref2) => accountAction("account-reauthorize", ref2)),
17010
+ onRemove: _cache[3] || (_cache[3] = (ref2) => emit("account-remove", ref2)),
17011
+ onLogout: _cache[4] || (_cache[4] = ($event) => {
17012
+ closeAccountMenu();
17013
+ handleLogout();
17014
+ })
17015
+ }, null, 8, ["items", "active-ref", "max", "busy"])
17016
+ ], 8, _hoisted_8$8)) : createCommentVNode("", true)
17017
+ ], 40, _hoisted_6$d)) : createCommentVNode("", true)
17018
+ ]),
17019
+ !__props.inAIHub ? (openBlock(), createBlock(UserLevel, {
17020
+ key: 0,
17021
+ accountInfo: __props.accountInfo
17022
+ }, null, 8, ["accountInfo"])) : createCommentVNode("", true),
17023
+ (openBlock(true), createElementBlock(Fragment, null, renderList(userMenuList.value, (block, index2) => {
17024
+ return openBlock(), createElementBlock("div", {
17025
+ class: normalizeClass(["g-user-drawer-block", { "g-user-drawer-block--no-pt": index2 === 0 && __props.inAIHub }]),
17026
+ key: index2
17027
+ }, [
17028
+ block.component ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
17029
+ block.avatarLangRow ? (openBlock(), createElementBlock("div", _hoisted_9$8, [
17030
+ (openBlock(), createBlock(resolveDynamicComponent(block.component), {
17031
+ key: block.id
17032
+ }))
17033
+ ])) : (openBlock(), createBlock(resolveDynamicComponent(block.component), mergeProps({
17034
+ key: block.id
17035
+ }, { ref_for: true }, block.componentProps || {}), null, 16))
17036
+ ], 64)) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(block, (item) => {
17037
+ return openBlock(), createBlock(OptionLink, mergeProps({
17038
+ key: item.id
17039
+ }, { ref_for: true }, item, {
17040
+ href: getMenuHref(item),
17041
+ onClick: ($event) => handleClick(item),
17042
+ target: __props.isChatBot && !item.action ? "_blank" : item.target || ""
17043
+ }), {
17044
+ default: withCtx(() => [
17045
+ item.icon ? (openBlock(), createBlock(GIcon, {
17046
+ key: 0,
17047
+ name: item.icon,
17048
+ size: "16px"
17049
+ }, null, 8, ["name"])) : createCommentVNode("", true),
17050
+ createTextVNode(toDisplayString$1(item.label), 1)
17051
+ ]),
17052
+ _: 2
17053
+ }, 1040, ["href", "onClick", "target"]);
17054
+ }), 128))
17055
+ ], 2);
17056
+ }), 128))
17057
+ ], 512);
17058
+ };
17050
17059
  }
17051
- return next.slice(0, limit);
17060
+ });
17061
+ const UserAvatarMenu = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["__scopeId", "data-v-vue-layout-gitcode"]]);
17062
+ const _hoisted_1$w = { class: "g-user-avatar flex-center" };
17063
+ const _hoisted_2$p = {
17064
+ key: 0,
17065
+ class: "g-user-avatar__badge"
17052
17066
  };
17053
- const setlocalVistHistory = (data, localType) => {
17054
- const storeName = localType;
17055
- const localData = localStorage$2.getItem(storeName);
17056
- let cur = [];
17057
- if (localData) {
17058
- try {
17059
- const parsed = JSON.parse(localData);
17060
- cur = Array.isArray(parsed) ? parsed : [];
17061
- if (localType) {
17062
- if (data.q) {
17063
- cur = upsertSearchHistory(cur, data);
17064
- } else {
17065
- cur = cur.filter((ele) => Boolean(normalizeSearchHistoryEntry(ele).q));
17066
- }
17067
- }
17068
- } catch (e) {
17069
- console.error(e);
17070
- }
17071
- } else {
17072
- cur = data.q ? [{ ...data, type: data.type || "repo", count: 1 }] : [];
17073
- }
17074
- const storageCount = 10;
17075
- cur.splice(storageCount);
17076
- localStorage$2.setItem(storeName, JSON.stringify(cur));
17077
- return cur;
17067
+ const _hoisted_3$o = { class: "g-user-avatar flex-center" };
17068
+ const _hoisted_4$i = {
17069
+ key: 0,
17070
+ class: "g-user-avatar__badge"
17078
17071
  };
17079
- const SHORTCUT_STORAGE_KEY = "atomgit.character-shortcuts";
17080
- const SHORTCUT_SEQUENCE_TIMEOUT = 1500;
17081
- const SHORTCUT_GROUPS = ["site", "repo", "code", "editor", "list", "detail"];
17082
- const BUILTIN_SHORTCUTS = [
17083
- { id: "site.search", keys: "/", group: "site", labelKey: "shortcut.site.search" },
17084
- { id: "site.searchLetter", keys: "s", group: "site", labelKey: "shortcut.site.search" },
17085
- { id: "site.help", keys: "?", group: "site", labelKey: "shortcut.site.help" },
17086
- { id: "site.notifications", keys: "g n", group: "site", labelKey: "shortcut.site.notifications" },
17087
- { id: "site.commands", keys: "mod+k", group: "site", labelKey: "shortcut.site.commands" },
17088
- { id: "site.escape", keys: "escape", group: "site", labelKey: "shortcut.dialog.close" }
17089
- ];
17090
- const isMacPlatform = () => typeof navigator !== "undefined" && /Mac|iPhone|iPad/.test(navigator.platform);
17091
- const parseShortcut = (keys, isMac = isMacPlatform()) => {
17092
- if (!keys.trim()) {
17093
- throw new Error("Shortcut keys must not be empty");
17094
- }
17095
- return keys.trim().split(/\s+/).map((token) => {
17096
- const parts = token.toLowerCase().split("+");
17097
- let key = parts.pop();
17098
- if (key === "esc") {
17099
- key = "escape";
17100
- }
17101
- if (key === "space") {
17102
- key = " ";
17103
- }
17104
- const modifiers = new Set(parts);
17105
- if (!key || parts.some((part) => !["ctrl", "meta", "alt", "shift", "mod"].includes(part)) || modifiers.size !== parts.length) {
17106
- throw new Error(`Invalid shortcut: ${keys}`);
17107
- }
17108
- if (key.length !== 1 && !["escape", "enter", "tab", "backspace", "delete", "arrowup", "arrowdown", "arrowleft", "arrowright", "home", "end", "pageup", "pagedown"].includes(key)) {
17109
- throw new Error(`Unsupported shortcut key: ${key}`);
17110
- }
17111
- return {
17112
- key,
17113
- ctrl: modifiers.has("ctrl") || modifiers.has("mod") && !isMac,
17114
- meta: modifiers.has("meta") || modifiers.has("mod") && isMac,
17115
- alt: modifiers.has("alt"),
17116
- shift: modifiers.has("shift")
17072
+ const _hoisted_5$d = { class: "g-user-drawer" };
17073
+ const _hoisted_6$c = { class: "user-avatar__drawer-header" };
17074
+ const _sfc_main$B = /* @__PURE__ */ defineComponent({
17075
+ ...{
17076
+ name: "UserAvatar"
17077
+ },
17078
+ __name: "UserAvatar",
17079
+ props: {
17080
+ isChatBot: { type: Boolean, default: false },
17081
+ loginOutFinish: { type: Function, default: void 0 },
17082
+ inAIHub: { type: Boolean, default: false },
17083
+ independence: { type: Boolean, default: false },
17084
+ userMenus: { default: () => [] },
17085
+ inEnterpriseHeader: { type: Boolean, default: false },
17086
+ accountSessionSupported: { type: Boolean, default: false },
17087
+ accountSessionLogout: {},
17088
+ accountSessions: { default: () => [] },
17089
+ accountSessionActiveRef: { default: null },
17090
+ accountSessionMax: { default: 5 },
17091
+ accountSessionBusy: { type: Boolean, default: false }
17092
+ },
17093
+ emits: ["account-switch", "account-add", "account-reauthorize", "account-remove"],
17094
+ setup(__props, { emit: __emit }) {
17095
+ const props = __props;
17096
+ const emit = __emit;
17097
+ const accountSessionBindings = computed(() => ({
17098
+ accountSessionSupported: props.accountSessionSupported,
17099
+ accountSessionLogout: props.accountSessionLogout,
17100
+ accountSessions: props.accountSessions,
17101
+ accountSessionActiveRef: props.accountSessionActiveRef,
17102
+ accountSessionMax: props.accountSessionMax,
17103
+ accountSessionBusy: props.accountSessionBusy,
17104
+ onAccountSwitch: (ref2) => emit("account-switch", ref2),
17105
+ onAccountAdd: () => emit("account-add"),
17106
+ onAccountReauthorize: (ref2) => emit("account-reauthorize", ref2),
17107
+ onAccountRemove: (ref2) => emit("account-remove", ref2)
17108
+ }));
17109
+ const { isMobile } = usePageResize();
17110
+ const drawerVisible = ref(false);
17111
+ const avatarMenuVisible = ref(false);
17112
+ const userInfo = inject("userInfo");
17113
+ const getLocalStorageUserInfo = () => {
17114
+ try {
17115
+ return JSON.parse(localStorage$2.getItem("userInfo") || "{}");
17116
+ } catch {
17117
+ return {};
17118
+ }
17117
17119
  };
17118
- });
17119
- };
17120
- const matchesStroke = (event, stroke) => {
17121
- const key = event.key.length === 1 && !stroke.shift ? event.key : event.key.toLowerCase();
17122
- return key === stroke.key && event.ctrlKey === stroke.ctrl && event.metaKey === stroke.meta && event.altKey === stroke.alt && (stroke.key === "?" || event.shiftKey === stroke.shift);
17123
- };
17124
- const isCharacterShortcut = (strokes) => strokes.every((stroke) => stroke.key.length === 1 && !stroke.ctrl && !stroke.meta && !stroke.alt);
17125
- const normalizeShortcut = (keys, isMac) => parseShortcut(keys, isMac).map((stroke) => JSON.stringify({ ...stroke, shift: stroke.key === "?" ? false : stroke.shift }));
17126
- const config = shallowRef({ actions: [] });
17127
- const shortcutConfig = readonly(config);
17128
- const shortcutRevision = shallowRef(0);
17129
- function setShortcutConfig(next) {
17130
- if (typeof window === "undefined") {
17131
- return;
17132
- }
17133
- const actions = [...BUILTIN_SHORTCUTS, ...next.actions];
17134
- try {
17135
- for (const isMac of [false, true]) {
17136
- const normalized = actions.map((action) => normalizeShortcut(action.keys, isMac));
17137
- for (let i = 0; i < actions.length; i++) {
17138
- for (let j = i + 1; j < actions.length; j++) {
17139
- const a = normalized[i];
17140
- const b = normalized[j];
17141
- const prefix = a.slice(0, Math.min(a.length, b.length)).every((key, index2) => key === b[index2]);
17142
- if (actions[i].id === actions[j].id || prefix) {
17143
- throw new Error(`Shortcut conflict: ${actions[i].id} (${actions[i].keys}) / ${actions[j].id} (${actions[j].keys})`);
17144
- }
17120
+ const accountInfo = ref((userInfo == null ? void 0 : userInfo.value) || getLocalStorageUserInfo());
17121
+ const haveVisited = ref(false);
17122
+ const useReport2 = inject("useReport");
17123
+ watch(
17124
+ () => userInfo == null ? void 0 : userInfo.value,
17125
+ (newValue) => {
17126
+ if (newValue == null ? void 0 : newValue.id) {
17127
+ accountInfo.value = newValue;
17128
+ } else {
17129
+ accountInfo.value = getLocalStorageUserInfo();
17145
17130
  }
17131
+ },
17132
+ { immediate: true }
17133
+ );
17134
+ const handleToggle = (status) => {
17135
+ avatarMenuVisible.value = Boolean(status);
17136
+ visitedClick();
17137
+ const params = { need_tips: accountInfo.value.need_tips, prompt_style: accountInfo.value.style_tips };
17138
+ useReport2("score_personal_center_avatar_click", params);
17139
+ if (status) {
17140
+ useReport2("score_personal_center_dropdown", params);
17146
17141
  }
17147
- }
17148
- } catch (error) {
17149
- console.error(error);
17150
- return;
17151
- }
17152
- config.value = { actions: next.actions.map((action) => ({ ...action })), isBlocked: next.isBlocked };
17153
- shortcutRevision.value++;
17154
- }
17155
- function useShortcutConfig() {
17156
- return readonly({
17157
- get actions() {
17158
- return config.value.actions;
17159
- },
17160
- get isBlocked() {
17161
- return config.value.isBlocked;
17162
- }
17163
- });
17164
- }
17165
- const isEditableTarget = (target) => {
17166
- if (!target || typeof Element === "undefined" || !(target instanceof Element)) {
17167
- return false;
17168
- }
17169
- return Boolean(target.closest("input, textarea, select, .CodeMirror-focused, .cm-editor.cm-focused")) || target.isContentEditable === true || Boolean(target.closest('[contenteditable=""], [contenteditable="true"], [contenteditable="plaintext-only"]'));
17170
- };
17171
- const isComposingEvent = (event) => event.isComposing || event.keyCode === 229;
17172
- const shouldIgnoreShortcut = (event) => event.defaultPrevented || event.repeat || isComposingEvent(event) || event.composedPath().some(isEditableTarget) || isEditableTarget(event.target) || typeof document !== "undefined" && isEditableTarget(document.activeElement);
17173
- let current = null;
17174
- const enabled = ref(true);
17175
- const characterShortcutsEnabled = readonly(enabled);
17176
- const parsePreference = (raw) => {
17177
- try {
17178
- const record = JSON.parse(raw || "null");
17179
- if (record && (record.value === "on" || record.value === "off") && Number.isSafeInteger(record.updatedAt) && record.updatedAt >= 0) {
17180
- return { value: record.value, updatedAt: record.updatedAt };
17181
- }
17182
- } catch {
17183
- }
17184
- return null;
17185
- };
17186
- const newestPreference = (records) => records.reduce((latest, record) => {
17187
- if (!record) {
17188
- return latest;
17189
- }
17190
- if (!latest || record.updatedAt > latest.updatedAt || record.updatedAt === latest.updatedAt && record.value === "off") {
17191
- return record;
17192
- }
17193
- return latest;
17194
- }, null);
17195
- function refreshShortcutPreference() {
17196
- if (typeof window === "undefined") {
17197
- return;
17198
- }
17199
- let cookie = null;
17200
- try {
17201
- cookie = parsePreference(api.get(SHORTCUT_STORAGE_KEY));
17202
- } catch {
17203
- }
17204
- current = newestPreference([current, cookie, parsePreference(localStorage$2.getItem(SHORTCUT_STORAGE_KEY))]);
17205
- enabled.value = (current == null ? void 0 : current.value) !== "off";
17206
- }
17207
- function setCharacterShortcutsEnabled(value) {
17208
- if (typeof window === "undefined") {
17209
- return;
17210
- }
17211
- refreshShortcutPreference();
17212
- current = { value: value ? "on" : "off", updatedAt: Math.max(Date.now(), ((current == null ? void 0 : current.updatedAt) ?? -1) + 1) };
17213
- enabled.value = value;
17214
- const serialized = JSON.stringify(current);
17215
- localStorage$2.setItem(SHORTCUT_STORAGE_KEY, serialized);
17216
- try {
17217
- const domain = COOKIE_DOMAIN().replace(/^\./, "");
17218
- const hostname = window.location.hostname;
17219
- const shared = hostname === domain || hostname.endsWith(`.${domain}`);
17220
- api.set(SHORTCUT_STORAGE_KEY, serialized, {
17221
- expires: 365,
17222
- path: "/",
17223
- sameSite: "Lax",
17224
- secure: window.location.protocol === "https:",
17225
- ...shared ? { domain: `.${domain}` } : {}
17142
+ nextTick(() => {
17143
+ if (judgeDrawerScroll()) {
17144
+ handleDropdownScroll(status);
17145
+ }
17146
+ });
17147
+ };
17148
+ const visitedClick = () => {
17149
+ if (haveVisited.value) {
17150
+ return;
17151
+ }
17152
+ haveVisited.value = true;
17153
+ handleAvatarRedPoint(CLICK_TIME_MODULE.GROWTH_CENTER, accountInfo.value.username);
17154
+ };
17155
+ const getVisit = async (value) => {
17156
+ const visitedDate = localStorage$2.getItem(AVATAR_VISITED_DATE);
17157
+ const nowDate = (/* @__PURE__ */ new Date()).toLocaleDateString("zh-CN");
17158
+ const nowUserName = localStorage$2.getItem(AVATAR_VISITED_USERNAME);
17159
+ if (visitedDate === nowDate && nowUserName === accountInfo.value.username) {
17160
+ haveVisited.value = true;
17161
+ }
17162
+ };
17163
+ getVisit();
17164
+ const judgeDrawerScroll = () => {
17165
+ var _a;
17166
+ if (typeof document !== "undefined" && document.querySelector) {
17167
+ const userDrawerWarpDom = (_a = document.querySelector(".g-user-dropdown")) == null ? void 0 : _a.querySelector(".devui-dropdown__menu-wrap");
17168
+ if (!userDrawerWarpDom) {
17169
+ return false;
17170
+ }
17171
+ return userDrawerWarpDom.scrollHeight > userDrawerWarpDom.clientHeight;
17172
+ }
17173
+ return false;
17174
+ };
17175
+ const handleDropdownScroll = (status) => {
17176
+ if (typeof document === "undefined" || !document.querySelector) return;
17177
+ const dropdownMenu = document.querySelector(".g-user-dropdown .devui-dropdown__menu-wrap");
17178
+ if (!dropdownMenu) return;
17179
+ if (status) {
17180
+ dropdownMenu.removeEventListener("wheel", preventScrollPropagation);
17181
+ dropdownMenu.addEventListener("wheel", preventScrollPropagation, { passive: false });
17182
+ } else {
17183
+ dropdownMenu.removeEventListener("wheel", preventScrollPropagation);
17184
+ }
17185
+ };
17186
+ const preventScrollPropagation = (e) => {
17187
+ const target = e.currentTarget;
17188
+ if (!target) return;
17189
+ const { scrollTop, scrollHeight, clientHeight } = target;
17190
+ const isScrollingDown = e.deltaY > 0;
17191
+ const isScrollingUp = e.deltaY < 0;
17192
+ const threshold = 4;
17193
+ if (isScrollingDown && scrollTop + clientHeight >= scrollHeight - threshold) {
17194
+ e.preventDefault();
17195
+ e.stopPropagation();
17196
+ return;
17197
+ }
17198
+ if (isScrollingUp && scrollTop <= threshold) {
17199
+ e.preventDefault();
17200
+ e.stopPropagation();
17201
+ return;
17202
+ }
17203
+ e.stopPropagation();
17204
+ };
17205
+ const resetOverflow = () => {
17206
+ if (typeof document === "undefined" || !document.querySelector) return;
17207
+ const dropdownMenu = document.querySelector(".g-user-dropdown .devui-dropdown__menu-wrap");
17208
+ if (dropdownMenu) {
17209
+ dropdownMenu.removeEventListener("wheel", preventScrollPropagation);
17210
+ }
17211
+ };
17212
+ const handleStorageChange = (e) => {
17213
+ if (e.key === "userInfo") {
17214
+ if (!(userInfo == null ? void 0 : userInfo.value)) {
17215
+ try {
17216
+ accountInfo.value = JSON.parse(e.newValue || "{}");
17217
+ } catch {
17218
+ accountInfo.value = {};
17219
+ }
17220
+ }
17221
+ }
17222
+ };
17223
+ onMounted(() => {
17224
+ window.addEventListener("storage", handleStorageChange);
17226
17225
  });
17227
- if (api.get(SHORTCUT_STORAGE_KEY) !== serialized) {
17228
- return;
17229
- }
17230
- } catch {
17231
- }
17232
- }
17233
- const providers = shallowRef([]);
17234
- const searches = shallowRef([]);
17235
- const notices = shallowRef([]);
17236
- const blockers = shallowRef([]);
17237
- const isBlocked = () => {
17238
- var _a, _b;
17239
- return Boolean(((_b = (_a = shortcutConfig.value).isBlocked) == null ? void 0 : _b.call(_a)) || blockers.value.some((blocked) => blocked()));
17240
- };
17241
- const dialog = ref(null);
17242
- const shortcutDialog = readonly(dialog);
17243
- const hasShortcutProvider = computed(() => providers.value.length > 0);
17244
- let returnFocus = null;
17245
- let pending = [];
17246
- let timer;
17247
- let detach;
17248
- function resetShortcutSequence() {
17249
- pending = [];
17250
- clearTimeout(timer);
17251
- timer = void 0;
17252
- }
17253
- function openShortcutHelp() {
17254
- openDialog("help");
17255
- }
17256
- function openShortcutCommands() {
17257
- openDialog("commands");
17258
- }
17259
- function openDialog(mode) {
17260
- if (!hasShortcutProvider.value || typeof document === "undefined" || isBlocked()) {
17261
- return;
17262
- }
17263
- if (!dialog.value) {
17264
- returnFocus = document.activeElement;
17265
- }
17266
- resetShortcutSequence();
17267
- dialog.value = mode;
17268
- }
17269
- function closeShortcutDialog(restoreFocus = true) {
17270
- dialog.value = null;
17271
- const previous = returnFocus;
17272
- returnFocus = null;
17273
- if (restoreFocus && typeof document !== "undefined") {
17274
- void nextTick(() => {
17275
- const target = (previous == null ? void 0 : previous.isConnected) ? previous : document.querySelector("[data-shortcut-help]");
17276
- target == null ? void 0 : target.focus();
17226
+ onBeforeUnmount(() => {
17227
+ window.removeEventListener("storage", handleStorageChange);
17228
+ resetOverflow();
17277
17229
  });
17230
+ return (_ctx, _cache) => {
17231
+ return openBlock(), createElementBlock(Fragment, null, [
17232
+ unref(isMobile) ? (openBlock(), createElementBlock("div", {
17233
+ key: 0,
17234
+ onClick: _cache[0] || (_cache[0] = ($event) => drawerVisible.value = true)
17235
+ }, [
17236
+ createElementVNode("div", _hoisted_1$w, [
17237
+ createVNode(_sfc_main$R, {
17238
+ name: accountInfo.value.nickname,
17239
+ src: unref(transformUrl)(accountInfo.value.avatar)
17240
+ }, null, 8, ["name", "src"]),
17241
+ accountInfo.value.need_tips && !haveVisited.value ? (openBlock(), createElementBlock("div", _hoisted_2$p, [..._cache[4] || (_cache[4] = [
17242
+ createElementVNode("div", null, null, -1)
17243
+ ])])) : createCommentVNode("", true)
17244
+ ])
17245
+ ])) : (openBlock(), createBlock(unref(Dropdown), {
17246
+ key: 1,
17247
+ position: ["bottom-start"],
17248
+ "destroy-on-hide": false,
17249
+ trigger: "hover",
17250
+ "overlay-class": "g-user-dropdown",
17251
+ onToggle: handleToggle
17252
+ }, {
17253
+ menu: withCtx(() => [
17254
+ createElementVNode("div", _hoisted_5$d, [
17255
+ createVNode(UserAvatarMenu, mergeProps({
17256
+ "menu-visible": avatarMenuVisible.value,
17257
+ independence: __props.independence,
17258
+ loginOutFinish: __props.loginOutFinish,
17259
+ accountInfo: accountInfo.value,
17260
+ isChatBot: __props.isChatBot,
17261
+ inAIHub: __props.inAIHub,
17262
+ userMenus: __props.userMenus,
17263
+ inEnterpriseHeader: __props.inEnterpriseHeader
17264
+ }, accountSessionBindings.value, { onLinkClick: resetOverflow }), null, 16, ["menu-visible", "independence", "loginOutFinish", "accountInfo", "isChatBot", "inAIHub", "userMenus", "inEnterpriseHeader"])
17265
+ ])
17266
+ ]),
17267
+ default: withCtx(() => [
17268
+ createElementVNode("div", _hoisted_3$o, [
17269
+ createVNode(_sfc_main$R, {
17270
+ name: accountInfo.value.nickname,
17271
+ src: unref(transformUrl)(accountInfo.value.avatar)
17272
+ }, null, 8, ["name", "src"]),
17273
+ accountInfo.value.need_tips && !haveVisited.value ? (openBlock(), createElementBlock("div", _hoisted_4$i, [..._cache[5] || (_cache[5] = [
17274
+ createElementVNode("div", null, null, -1)
17275
+ ])])) : createCommentVNode("", true)
17276
+ ])
17277
+ ]),
17278
+ _: 1
17279
+ })),
17280
+ createVNode(unref(Drawer), {
17281
+ modelValue: drawerVisible.value,
17282
+ "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => drawerVisible.value = $event),
17283
+ position: "right",
17284
+ "lock-scroll": "",
17285
+ style: normalizeStyle([{ "top": "0", "max-height": "100%" }, { width: "240px", overflowY: "scroll" }])
17286
+ }, {
17287
+ default: withCtx(() => [
17288
+ createElementVNode("div", null, [
17289
+ createElementVNode("div", _hoisted_6$c, [
17290
+ createVNode(unref(Button), {
17291
+ class: "draw-side-bar-close",
17292
+ icon: "close",
17293
+ onClick: _cache[1] || (_cache[1] = ($event) => drawerVisible.value = false),
17294
+ variant: "text"
17295
+ })
17296
+ ]),
17297
+ createVNode(UserAvatarMenu, mergeProps({
17298
+ "menu-visible": drawerVisible.value,
17299
+ independence: __props.independence,
17300
+ loginOutFinish: __props.loginOutFinish,
17301
+ accountInfo: accountInfo.value,
17302
+ isChatBot: __props.isChatBot,
17303
+ inAIHub: __props.inAIHub,
17304
+ userMenus: __props.userMenus,
17305
+ inEnterpriseHeader: __props.inEnterpriseHeader
17306
+ }, accountSessionBindings.value, {
17307
+ onClick: _cache[2] || (_cache[2] = ($event) => drawerVisible.value = false),
17308
+ onLinkClick: resetOverflow
17309
+ }), null, 16, ["menu-visible", "independence", "loginOutFinish", "accountInfo", "isChatBot", "inAIHub", "userMenus", "inEnterpriseHeader"])
17310
+ ])
17311
+ ]),
17312
+ _: 1
17313
+ }, 8, ["modelValue"])
17314
+ ], 64);
17315
+ };
17316
+ }
17317
+ });
17318
+ const UserAvatar = /* @__PURE__ */ _export_sfc(_sfc_main$B, [["__scopeId", "data-v-vue-layout-gitcode"]]);
17319
+ var EVENT_NAME = /* @__PURE__ */ ((EVENT_NAME2) => {
17320
+ EVENT_NAME2["START_SEARCH"] = "开始搜索";
17321
+ EVENT_NAME2["SEARCH"] = "搜索";
17322
+ EVENT_NAME2["END_SEARCH"] = "结束搜索";
17323
+ EVENT_NAME2["CLICK_SEARCH_RESULT"] = "点击搜索结果";
17324
+ EVENT_NAME2["CLICK_RELATIVE_SEARCH"] = "点击相关搜索结果";
17325
+ EVENT_NAME2["HEADER_START_SEARCH"] = "头部搜索";
17326
+ EVENT_NAME2["OPEN_FORK_PROJECT"] = "打开创建Fork项目";
17327
+ EVENT_NAME2["FORK_PROJECT"] = "提交创建Fork项目";
17328
+ EVENT_NAME2["FORK_PROJECT_SUCCESS"] = "成功Fork项目";
17329
+ EVENT_NAME2["OPEN_CREATE_PR"] = "打开创建PR";
17330
+ EVENT_NAME2["CREATE_PR_CHOSE_BRANCH"] = "创建PR选择分支-下一步";
17331
+ EVENT_NAME2["CREATE_PR"] = "提交创建PR";
17332
+ EVENT_NAME2["CREATE_PR_SUCESS"] = "成功创建PR";
17333
+ EVENT_NAME2["MERGE_PR"] = "合入PR";
17334
+ EVENT_NAME2["OPEN_FILE_EDIT_SUBMIT"] = "打开文件修改";
17335
+ EVENT_NAME2["FILE_EDIT_SUBMIT"] = "提交文件修改";
17336
+ EVENT_NAME2["FILE_EDIT_MODAL_SUBMIT"] = "文件修改弹框提交修改";
17337
+ EVENT_NAME2["FILE_EDIT_SUCCESS"] = "成功修改文件";
17338
+ EVENT_NAME2["REVIEW_CODE_CHANGE"] = "代码变更检视";
17339
+ EVENT_NAME2["OPEN_REGISTER"] = "打开注册页面";
17340
+ EVENT_NAME2["CLICK_REGISTER"] = "点击注册新账号";
17341
+ EVENT_NAME2["REGISTER"] = "新用户注册";
17342
+ EVENT_NAME2["REGISTER_SUCCESS"] = "新用户成功注册";
17343
+ EVENT_NAME2["STAR"] = "star项目";
17344
+ EVENT_NAME2["UNSTAR"] = "unstar项目";
17345
+ EVENT_NAME2["DOWNLOAD_ZIP"] = "下载zip";
17346
+ EVENT_NAME2["CLONE"] = "克隆项目";
17347
+ EVENT_NAME2["OPEN_CREATE_PROJECT"] = "打开新建项目";
17348
+ EVENT_NAME2["CREATE_PROJECT"] = "提交新建项目";
17349
+ EVENT_NAME2["CREATE_PROJECT_SUCCESS"] = "成功新建项目";
17350
+ EVENT_NAME2["OPEN_IMPORT_PROJECT"] = "打开导入项目";
17351
+ EVENT_NAME2["IMPORT_PROJECT"] = "提交导入项目";
17352
+ EVENT_NAME2["IMPORT_PROJECT_SUCCESS"] = "成功导入项目";
17353
+ EVENT_NAME2["OPEN_CREATE_ORG"] = "打开创建组织";
17354
+ EVENT_NAME2["CREATE_ORG"] = "提交创建组织";
17355
+ EVENT_NAME2["CREATE_ORG_SUCCESS"] = "成功创建组织";
17356
+ EVENT_NAME2["OPEN_CREATE_ISSUE"] = "打开创建issue";
17357
+ EVENT_NAME2["OPEN_CREATE_SECURITY_ISSUE"] = "打开报告安全漏洞";
17358
+ EVENT_NAME2["OPEN_CREATE_NORMAL_ISSUE"] = "打开创建普通issue";
17359
+ EVENT_NAME2["CREATE_SECURITY_ISSUE"] = "提交报告安全漏洞";
17360
+ EVENT_NAME2["CREATE_SECURITY_ISSUE_SUCCESS"] = "成功报告安全漏洞";
17361
+ EVENT_NAME2["CREATE_ISSUE"] = "提交创建issue";
17362
+ EVENT_NAME2["CREATE_ISSUE_SUCCESS"] = "成功创建issue";
17363
+ EVENT_NAME2["OPEN_UPLOAD_FILE"] = "打开上传文件弹框";
17364
+ EVENT_NAME2["UPLOAD_FILE"] = "提交上传文件";
17365
+ EVENT_NAME2["UPLOAD_FILE_SUCCESS"] = "成功上传文件";
17366
+ EVENT_NAME2["FOURZEROFOUR"] = "404页面精选项目进入";
17367
+ EVENT_NAME2["OPEN_LOGIN"] = "打开登录页面";
17368
+ return EVENT_NAME2;
17369
+ })(EVENT_NAME || {});
17370
+ function _frEventTrack(eventName, type = "custom") {
17371
+ var _a;
17372
+ try {
17373
+ (_a = window.FURION) == null ? void 0 : _a.log(type, eventName);
17374
+ } catch (err) {
17278
17375
  }
17279
17376
  }
17280
- const activeTarget = (targets) => [...targets].reverse().find((target) => target.when());
17281
- const builtinActions = computed(() => BUILTIN_SHORTCUTS.filter((item) => item.id !== "site.escape").map((item) => {
17282
- if (item.id === "site.search" || item.id === "site.searchLetter") {
17283
- return { ...item, when: () => Boolean(activeTarget(searches.value)), run: () => {
17284
- var _a;
17285
- return (_a = activeTarget(searches.value)) == null ? void 0 : _a.run();
17286
- } };
17287
- }
17288
- if (item.id === "site.notifications") {
17289
- return { ...item, when: () => Boolean(activeTarget(notices.value)), run: () => {
17290
- var _a;
17291
- return (_a = activeTarget(notices.value)) == null ? void 0 : _a.run();
17292
- } };
17377
+ const isSearchHistoryEntry = (value) => {
17378
+ return typeof value === "object" && value !== null && !Array.isArray(value);
17379
+ };
17380
+ const normalizeSearchHistoryEntry = (value) => {
17381
+ if (typeof value === "string") {
17382
+ return { q: value, type: "repo" };
17293
17383
  }
17294
- return { ...item, run: item.id === "site.help" ? openShortcutHelp : openShortcutCommands };
17295
- }));
17296
- const getAvailableShortcutActions = () => {
17297
- if (!hasShortcutProvider.value) {
17298
- return builtinActions.value.filter((action) => action.id === "site.search" && (!action.when || action.when()));
17384
+ if (!isSearchHistoryEntry(value)) {
17385
+ return { q: "", type: "repo" };
17299
17386
  }
17300
- return [...builtinActions.value, ...shortcutConfig.value.actions].filter((action) => !action.when || action.when());
17387
+ return { ...value, type: value.type || "repo" };
17301
17388
  };
17302
- const selectionRevision = ref(0);
17303
- const onSelectionChange = () => {
17304
- selectionRevision.value += 1;
17389
+ const sameSearchHistory = (left, right) => {
17390
+ const leftEntry = normalizeSearchHistoryEntry(left);
17391
+ return leftEntry.q === right.q && leftEntry.type === right.type && leftEntry.scope === right.scope && leftEntry.repo === right.repo && leftEntry.org === right.org && leftEntry.user === right.user && leftEntry.namespace === right.namespace;
17305
17392
  };
17306
- const availableShortcutActions = computed(() => {
17307
- void selectionRevision.value;
17308
- return getAvailableShortcutActions();
17309
- });
17310
- function executeShortcutAction(action) {
17311
- if (isBlocked() || !getAvailableShortcutActions().some((item) => item.id === action.id) || action.when && !action.when()) {
17312
- return;
17313
- }
17314
- closeShortcutDialog(false);
17315
- void nextTick(() => {
17316
- const current2 = getAvailableShortcutActions().find((item) => item.id === action.id);
17317
- if (!isBlocked() && current2) {
17318
- current2.run();
17319
- }
17320
- });
17321
- }
17322
- function onKeydown(event) {
17323
- if (shouldIgnoreShortcut(event)) {
17324
- resetShortcutSequence();
17325
- return;
17326
- }
17327
- if (dialog.value || isBlocked()) {
17328
- resetShortcutSequence();
17329
- return;
17330
- }
17331
- if (event.key === "Escape") {
17332
- if (pending.length) {
17333
- event.preventDefault();
17334
- resetShortcutSequence();
17335
- }
17336
- return;
17337
- }
17338
- const candidates = getAvailableShortcutActions().map((action) => ({ action, strokes: parseShortcut(action.keys) })).filter(({ strokes }) => characterShortcutsEnabled.value || !isCharacterShortcut(strokes));
17339
- const matches = candidates.filter(({ strokes }) => strokes.length > pending.length && pending.every((key, index2) => key === JSON.stringify(strokes[index2])) && matchesStroke(event, strokes[pending.length]));
17340
- const complete = matches.find(({ strokes }) => strokes.length === pending.length + 1);
17341
- if (complete) {
17342
- resetShortcutSequence();
17343
- if (!complete.action.when || complete.action.when()) {
17344
- event.preventDefault();
17345
- complete.action.run();
17346
- }
17347
- } else if (matches.length) {
17348
- pending.push(JSON.stringify(matches[0].strokes[pending.length]));
17349
- clearTimeout(timer);
17350
- timer = setTimeout(resetShortcutSequence, SHORTCUT_SEQUENCE_TIMEOUT);
17393
+ const upsertSearchHistory = (current2, data, limit = 10) => {
17394
+ const next = current2.filter((item) => Boolean(normalizeSearchHistoryEntry(item).q));
17395
+ const normalizedData = { ...data, type: data.type || "repo" };
17396
+ const existingIndex = next.findIndex((item) => sameSearchHistory(item, normalizedData));
17397
+ if (existingIndex === -1) {
17398
+ next.unshift({ ...normalizedData, count: normalizedData.count || 1 });
17351
17399
  } else {
17352
- resetShortcutSequence();
17353
- }
17354
- }
17355
- function syncListener() {
17356
- if (typeof document === "undefined") {
17357
- return;
17358
- }
17359
- const needed = providers.value.length + searches.value.length > 0;
17360
- if (!needed) {
17361
- detach == null ? void 0 : detach();
17362
- detach = void 0;
17363
- resetShortcutSequence();
17364
- return;
17365
- }
17366
- if (detach) {
17367
- return;
17400
+ const existing = normalizeSearchHistoryEntry(next[existingIndex]);
17401
+ existing.count = (existing.count || 1) + 1;
17402
+ next.splice(existingIndex, 1);
17403
+ next.unshift(existing);
17368
17404
  }
17369
- refreshShortcutPreference();
17370
- const onFocus = (event) => {
17371
- if (isEditableTarget(event.target)) {
17372
- resetShortcutSequence();
17373
- }
17374
- };
17375
- document.addEventListener("keydown", onKeydown);
17376
- document.addEventListener("focusin", onFocus);
17377
- document.addEventListener("compositionstart", resetShortcutSequence);
17378
- document.addEventListener("selectionchange", onSelectionChange);
17379
- window.addEventListener("blur", resetShortcutSequence);
17380
- window.addEventListener("focus", refreshShortcutPreference);
17381
- const scope = effectScope(true);
17382
- scope.run(() => {
17383
- watch(shortcutRevision, resetShortcutSequence, { flush: "sync" });
17384
- watch(characterShortcutsEnabled, resetShortcutSequence, { flush: "sync" });
17385
- watch(isBlocked, resetShortcutSequence, { flush: "sync" });
17386
- });
17387
- detach = () => {
17388
- document.removeEventListener("keydown", onKeydown);
17389
- document.removeEventListener("focusin", onFocus);
17390
- document.removeEventListener("compositionstart", resetShortcutSequence);
17391
- document.removeEventListener("selectionchange", onSelectionChange);
17392
- window.removeEventListener("blur", resetShortcutSequence);
17393
- window.removeEventListener("focus", refreshShortcutPreference);
17394
- scope.stop();
17395
- };
17396
- }
17397
- function registerShortcutProvider() {
17398
- const id = Symbol("shortcut-provider");
17399
- providers.value = [...providers.value, id];
17400
- syncListener();
17401
- return {
17402
- isOwner: computed(() => providers.value[0] === id),
17403
- dispose: () => {
17404
- providers.value = providers.value.filter((item) => item !== id);
17405
- if (!providers.value.length) {
17406
- closeShortcutDialog();
17407
- resetShortcutSequence();
17405
+ return next.slice(0, limit);
17406
+ };
17407
+ const setlocalVistHistory = (data, localType) => {
17408
+ const storeName = localType;
17409
+ const localData = localStorage$2.getItem(storeName);
17410
+ let cur = [];
17411
+ if (localData) {
17412
+ try {
17413
+ const parsed = JSON.parse(localData);
17414
+ cur = Array.isArray(parsed) ? parsed : [];
17415
+ if (localType) {
17416
+ if (data.q) {
17417
+ cur = upsertSearchHistory(cur, data);
17418
+ } else {
17419
+ cur = cur.filter((ele) => Boolean(normalizeSearchHistoryEntry(ele).q));
17420
+ }
17408
17421
  }
17409
- syncListener();
17422
+ } catch (e) {
17423
+ console.error(e);
17410
17424
  }
17411
- };
17412
- }
17413
- function registerTarget(target, collection) {
17414
- collection.value = [...collection.value, target];
17415
- syncListener();
17416
- return () => {
17417
- collection.value = collection.value.filter((item) => item !== target);
17418
- syncListener();
17419
- };
17420
- }
17421
- const registerShortcutSearch = (target) => registerTarget(target, searches);
17422
- const registerShortcutNotice = (target) => registerTarget(target, notices);
17423
- function useShortcutSearch(target) {
17424
- let dispose;
17425
- onMounted(() => {
17426
- dispose = registerShortcutSearch(target);
17427
- });
17428
- onUnmounted(() => dispose == null ? void 0 : dispose());
17429
- }
17430
- function useShortcutNotice(target) {
17431
- let dispose;
17432
- onMounted(() => {
17433
- dispose = registerShortcutNotice(target);
17434
- });
17435
- onUnmounted(() => dispose == null ? void 0 : dispose());
17436
- }
17437
- function useShortcutBlocker(blocked) {
17438
- onMounted(() => {
17439
- blockers.value = [...blockers.value, blocked];
17440
- });
17441
- onUnmounted(() => {
17442
- blockers.value = blockers.value.filter((item) => item !== blocked);
17443
- });
17444
- }
17425
+ } else {
17426
+ cur = data.q ? [{ ...data, type: data.type || "repo", count: 1 }] : [];
17427
+ }
17428
+ const storageCount = 10;
17429
+ cur.splice(storageCount);
17430
+ localStorage$2.setItem(storeName, JSON.stringify(cur));
17431
+ return cur;
17432
+ };
17445
17433
  const KEY_ALIAS = {
17446
17434
  repo: "repo",
17447
17435
  user: "user",
@@ -17881,12 +17869,12 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
17881
17869
  setup(__props) {
17882
17870
  const layoutConfig2 = useLayoutConfig();
17883
17871
  const { t: $t } = i18n.global;
17884
- const ProjectSearch = defineAsyncComponent(() => import("./ProjectSearch-B4IZWWec.js"));
17885
- const UserSearch = defineAsyncComponent(() => import("./UserSearch-Jno2-hDh.js"));
17886
- const GloabarSearch = defineAsyncComponent(() => import("./GloabarSearch-CefMwW5N.js"));
17887
- const SearchHistoryList = defineAsyncComponent(() => import("./SearchHistoryList-BWFi4Y0g.js"));
17888
- const SearchScopeList = defineAsyncComponent(() => import("./SearchScopeList-BI_Gt1qi.js"));
17889
- const SearchRecommed = defineAsyncComponent(() => import("./SearchRecommed-eDW-NOQQ.js"));
17872
+ const ProjectSearch = defineAsyncComponent(() => import("./ProjectSearch-D4RbOLXG.js"));
17873
+ const UserSearch = defineAsyncComponent(() => import("./UserSearch-CWat7_4C.js"));
17874
+ const GloabarSearch = defineAsyncComponent(() => import("./GloabarSearch-Cng9q4kT.js"));
17875
+ const SearchHistoryList = defineAsyncComponent(() => import("./SearchHistoryList-DhO5xZhZ.js"));
17876
+ const SearchScopeList = defineAsyncComponent(() => import("./SearchScopeList-_c_QObw9.js"));
17877
+ const SearchRecommed = defineAsyncComponent(() => import("./SearchRecommed-BuS3kfJi.js"));
17890
17878
  const props = __props;
17891
17879
  const repoInfo = inject("repoInfo", computed(() => void 0));
17892
17880
  const orgInfo = inject("orgInfo", computed(() => void 0));
@@ -19034,9 +19022,9 @@ const _hoisted_6$8 = {
19034
19022
  const _hoisted_7$7 = ["href"];
19035
19023
  const _hoisted_8$7 = { class: "atomcode-launch-item__title-row" };
19036
19024
  const _hoisted_9$7 = { class: "atomcode-launch-item__title" };
19037
- const _hoisted_10$6 = ["href"];
19038
- const _hoisted_11$5 = { class: "atomcode-launch-item__title-row" };
19039
- const _hoisted_12$5 = {
19025
+ const _hoisted_10$7 = ["href"];
19026
+ const _hoisted_11$6 = { class: "atomcode-launch-item__title-row" };
19027
+ const _hoisted_12$6 = {
19040
19028
  class: "atomcode-item-icon",
19041
19029
  width: "16",
19042
19030
  height: "16",
@@ -19176,8 +19164,8 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
19176
19164
  role: "menuitem",
19177
19165
  "data-atomcode-cli": ""
19178
19166
  }, [
19179
- createElementVNode("div", _hoisted_11$5, [
19180
- (openBlock(), createElementBlock("svg", _hoisted_12$5, [..._cache[0] || (_cache[0] = [
19167
+ createElementVNode("div", _hoisted_11$6, [
19168
+ (openBlock(), createElementBlock("svg", _hoisted_12$6, [..._cache[0] || (_cache[0] = [
19181
19169
  createElementVNode("rect", {
19182
19170
  opacity: "0.5",
19183
19171
  x: "2",
@@ -19192,7 +19180,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
19192
19180
  ])])),
19193
19181
  createElementVNode("span", _hoisted_13$3, toDisplayString$1(unref(t2)("gitCodeLayout.atomCode.downloadCli")), 1)
19194
19182
  ])
19195
- ], 8, _hoisted_10$6)
19183
+ ], 8, _hoisted_10$7)
19196
19184
  ])
19197
19185
  ]),
19198
19186
  default: withCtx(() => [
@@ -19248,7 +19236,7 @@ const vElementExposure = {
19248
19236
  beforeUnmount() {
19249
19237
  }
19250
19238
  };
19251
- const NoticeModal = defineAsyncComponent(() => import("./notice-nJYs9BEu.js"));
19239
+ const NoticeModal = defineAsyncComponent(() => import("./notice-bcah4Y8T.js"));
19252
19240
  function clearNotice() {
19253
19241
  if (localStorage$2.getItem("validator_email")) {
19254
19242
  localStorage$2.removeItem("validator_email");
@@ -19299,7 +19287,7 @@ const _hoisted_7$6 = {
19299
19287
  };
19300
19288
  const _hoisted_8$6 = { class: "g-header-body-left" };
19301
19289
  const _hoisted_9$6 = { class: "g-header-body-right" };
19302
- const _hoisted_10$5 = { key: 2 };
19290
+ const _hoisted_10$6 = { key: 2 };
19303
19291
  const _sfc_main$v = /* @__PURE__ */ defineComponent({
19304
19292
  ...{
19305
19293
  name: "GitCodeHeader"
@@ -19945,7 +19933,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
19945
19933
  ])
19946
19934
  ], true)
19947
19935
  ])) : createCommentVNode("", true),
19948
- _ctx.$slots.headerBottom ? (openBlock(), createElementBlock("div", _hoisted_10$5, [
19936
+ _ctx.$slots.headerBottom ? (openBlock(), createElementBlock("div", _hoisted_10$6, [
19949
19937
  renderSlot(_ctx.$slots, "headerBottom", {}, void 0, true)
19950
19938
  ])) : createCommentVNode("", true)
19951
19939
  ], 6)
@@ -20398,9 +20386,9 @@ const _hoisted_7$5 = {
20398
20386
  };
20399
20387
  const _hoisted_8$5 = ["aria-current", "title", "onClick"];
20400
20388
  const _hoisted_9$5 = ["src", "alt", "onClick"];
20401
- const _hoisted_10$4 = { class: "home-channel-side-nav__info" };
20402
- const _hoisted_11$4 = { class: "home-channel-side-nav__label-row" };
20403
- const _hoisted_12$4 = { class: "home-channel-side-nav__label" };
20389
+ const _hoisted_10$5 = { class: "home-channel-side-nav__info" };
20390
+ const _hoisted_11$5 = { class: "home-channel-side-nav__label-row" };
20391
+ const _hoisted_12$5 = { class: "home-channel-side-nav__label" };
20404
20392
  const _hoisted_13$2 = {
20405
20393
  key: 0,
20406
20394
  class: "home-channel-side-nav__tag",
@@ -20784,9 +20772,9 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
20784
20772
  class: "home-channel-side-nav__logo",
20785
20773
  onClick: ($event) => onPrefixLogoClick($event, item)
20786
20774
  }, null, 8, ["name", "onClick"])) : createCommentVNode("", true),
20787
- createElementVNode("div", _hoisted_10$4, [
20788
- createElementVNode("span", _hoisted_11$4, [
20789
- createElementVNode("span", _hoisted_12$4, toDisplayString$1(getItemName(item)), 1),
20775
+ createElementVNode("div", _hoisted_10$5, [
20776
+ createElementVNode("span", _hoisted_11$5, [
20777
+ createElementVNode("span", _hoisted_12$5, toDisplayString$1(getItemName(item)), 1),
20790
20778
  unref(getChannelTagType)(item) === "hot" ? (openBlock(), createElementBlock("span", _hoisted_13$2, "HOT")) : unref(getChannelTagType)(item) === "new" ? (openBlock(), createElementBlock("span", _hoisted_14$1, "NEW")) : createCommentVNode("", true)
20791
20779
  ]),
20792
20780
  getItemDesc(item) ? (openBlock(), createElementBlock("span", {
@@ -21090,12 +21078,12 @@ const _hoisted_9$4 = {
21090
21078
  key: 0,
21091
21079
  class: "g-toolbar-right-divider"
21092
21080
  };
21093
- const _hoisted_10$3 = {
21081
+ const _hoisted_10$4 = {
21094
21082
  key: 0,
21095
21083
  class: "g-header-body"
21096
21084
  };
21097
- const _hoisted_11$3 = { class: "g-header-body-left" };
21098
- const _hoisted_12$3 = { class: "g-header-body-right" };
21085
+ const _hoisted_11$4 = { class: "g-header-body-left" };
21086
+ const _hoisted_12$4 = { class: "g-header-body-right" };
21099
21087
  const _hoisted_13$1 = { key: 1 };
21100
21088
  const _sfc_main$p = /* @__PURE__ */ defineComponent({
21101
21089
  ...{
@@ -21478,12 +21466,12 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
21478
21466
  ])), [
21479
21467
  [unref(vElementExposure), { trigger: (type) => handleToolbarExpo() }]
21480
21468
  ]),
21481
- _ctx.$slots.info || _ctx.$slots.menu || _ctx.$slots.bodyHeader ? (openBlock(), createElementBlock("div", _hoisted_10$3, [
21469
+ _ctx.$slots.info || _ctx.$slots.menu || _ctx.$slots.bodyHeader ? (openBlock(), createElementBlock("div", _hoisted_10$4, [
21482
21470
  renderSlot(_ctx.$slots, "bodyHeader", {}, () => [
21483
- createElementVNode("div", _hoisted_11$3, [
21471
+ createElementVNode("div", _hoisted_11$4, [
21484
21472
  renderSlot(_ctx.$slots, "info", {}, void 0, true)
21485
21473
  ]),
21486
- createElementVNode("div", _hoisted_12$3, [
21474
+ createElementVNode("div", _hoisted_12$4, [
21487
21475
  renderSlot(_ctx.$slots, "menu", {}, void 0, true)
21488
21476
  ])
21489
21477
  ], true)
@@ -21728,9 +21716,9 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
21728
21716
  const layoutConfig2 = useLayoutConfig();
21729
21717
  const { t: t2 } = i18n.global;
21730
21718
  const route = useRoute();
21731
- const MenuItem = defineAsyncComponent(() => import("./MenuItem-zJXVH_ZY.js"));
21732
- const ProjectMenuListV2 = defineAsyncComponent(() => import("./ProjectMenuListV2-H2VmzVSh.js"));
21733
- const ProjectMenuList = defineAsyncComponent(() => import("./ProjectMenuList-CDYlv4eo.js"));
21719
+ const MenuItem = defineAsyncComponent(() => import("./MenuItem-B-UAWoEo.js"));
21720
+ const ProjectMenuListV2 = defineAsyncComponent(() => import("./ProjectMenuListV2-D9l7n3Gb.js"));
21721
+ const ProjectMenuList = defineAsyncComponent(() => import("./ProjectMenuList-Bvu5TTWx.js"));
21734
21722
  const props = __props;
21735
21723
  const useReport2 = inject("useReport");
21736
21724
  const userInfo = inject("userInfo");
@@ -22158,9 +22146,9 @@ const _hoisted_8$3 = {
22158
22146
  rel: "noopener noreferrer"
22159
22147
  };
22160
22148
  const _hoisted_9$3 = { class: "contact-info__about-row" };
22161
- const _hoisted_10$2 = { class: "footer-work-info" };
22162
- const _hoisted_11$2 = { class: "footer-work-info__item footer-work-info__item--mt" };
22163
- const _hoisted_12$2 = { class: "" };
22149
+ const _hoisted_10$3 = { class: "footer-work-info" };
22150
+ const _hoisted_11$3 = { class: "footer-work-info__item footer-work-info__item--mt" };
22151
+ const _hoisted_12$3 = { class: "" };
22164
22152
  const _sfc_main$l = /* @__PURE__ */ defineComponent({
22165
22153
  __name: "ContactInfo",
22166
22154
  setup(__props) {
@@ -22221,12 +22209,12 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
22221
22209
  _: 1
22222
22210
  }, 8, ["href"])
22223
22211
  ]),
22224
- createElementVNode("ul", _hoisted_10$2, [
22212
+ createElementVNode("ul", _hoisted_10$3, [
22225
22213
  _cache[4] || (_cache[4] = createElementVNode("li", { class: "footer-work-info__item" }, [
22226
22214
  createElementVNode("span", { class: "" }, "400-6868-951")
22227
22215
  ], -1)),
22228
- createElementVNode("li", _hoisted_11$2, [
22229
- createElementVNode("span", _hoisted_12$2, "9:00-18:00 (" + toDisplayString$1(unref(t2)("gitCodeLayout.home.onWeekdays")) + ")", 1)
22216
+ createElementVNode("li", _hoisted_11$3, [
22217
+ createElementVNode("span", _hoisted_12$3, "9:00-18:00 (" + toDisplayString$1(unref(t2)("gitCodeLayout.home.onWeekdays")) + ")", 1)
22230
22218
  ])
22231
22219
  ])
22232
22220
  ]);
@@ -27847,9 +27835,9 @@ const _hoisted_9$2 = {
27847
27835
  key: 4,
27848
27836
  class: "mfa__hint"
27849
27837
  };
27850
- const _hoisted_10$1 = { class: "mfa__action" };
27851
- const _hoisted_11$1 = { class: "mfa__footer" };
27852
- const _hoisted_12$1 = { class: "mfa__back" };
27838
+ const _hoisted_10$2 = { class: "mfa__action" };
27839
+ const _hoisted_11$2 = { class: "mfa__footer" };
27840
+ const _hoisted_12$2 = { class: "mfa__back" };
27853
27841
  const _sfc_main$8 = /* @__PURE__ */ defineComponent({
27854
27842
  __name: "MFA",
27855
27843
  props: {
@@ -28036,7 +28024,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
28036
28024
  errorMsg.value ? (openBlock(), createElementBlock("p", _hoisted_7$2, toDisplayString$1(errorMsg.value), 1)) : createCommentVNode("", true),
28037
28025
  mode.value === "code" ? (openBlock(), createElementBlock("p", _hoisted_8$2, toDisplayString$1(unref(t2)("gitCodeLayout.LoginModal.mfatip1")), 1)) : createCommentVNode("", true),
28038
28026
  mode.value === "recover" ? (openBlock(), createElementBlock("p", _hoisted_9$2, toDisplayString$1(unref(t2)("gitCodeLayout.LoginModal.mfatip2")), 1)) : createCommentVNode("", true),
28039
- createElementVNode("div", _hoisted_10$1, [
28027
+ createElementVNode("div", _hoisted_10$2, [
28040
28028
  createVNode(unref(Button), {
28041
28029
  class: "mfa__submit",
28042
28030
  color: "primary",
@@ -28051,8 +28039,8 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
28051
28039
  _: 1
28052
28040
  }, 8, ["loading", "disabled"])
28053
28041
  ]),
28054
- createElementVNode("div", _hoisted_11$1, [
28055
- createElementVNode("div", _hoisted_12$1, [
28042
+ createElementVNode("div", _hoisted_11$2, [
28043
+ createElementVNode("div", _hoisted_12$2, [
28056
28044
  !__props.hideBack ? (openBlock(), createElementBlock("div", {
28057
28045
  key: 0,
28058
28046
  onClick: _cache[1] || (_cache[1] = ($event) => emits("back"))
@@ -28268,7 +28256,7 @@ const _SlidCaptchaManager = class _SlidCaptchaManager {
28268
28256
  __publicField(_SlidCaptchaManager, "instance");
28269
28257
  let SlidCaptchaManager = _SlidCaptchaManager;
28270
28258
  const slidCaptchaManager = SlidCaptchaManager.getInstance();
28271
- const SlidCaptcha = defineAsyncComponent(() => import("./index-Bhjr8DTm.js"));
28259
+ const SlidCaptcha = defineAsyncComponent(() => import("./index-F3eMI-sw.js"));
28272
28260
  const useSlidCaptcha = () => {
28273
28261
  const { mount, unMount, isMounted } = usePopup("slid-captcha-popup");
28274
28262
  const open = (config2) => {
@@ -28298,7 +28286,7 @@ const useSlidCaptcha = () => {
28298
28286
  close
28299
28287
  };
28300
28288
  };
28301
- const YunpianCaptcha = defineAsyncComponent(() => import("./index-D0ueLDg1.js"));
28289
+ const YunpianCaptcha = defineAsyncComponent(() => import("./index-DNfhml9y.js"));
28302
28290
  const useYunpianCaptcha = () => {
28303
28291
  const { mount, unMount } = usePopup("yunpian-captcha-popup");
28304
28292
  const open = (config2) => {
@@ -28808,12 +28796,12 @@ const _hoisted_6$1 = { class: "login-modal-logo-desc" };
28808
28796
  const _hoisted_7$1 = { class: "login-modal-history" };
28809
28797
  const _hoisted_8$1 = { class: "login-modal-history__title" };
28810
28798
  const _hoisted_9$1 = { class: "login-modal-history__content" };
28811
- const _hoisted_10 = {
28799
+ const _hoisted_10$1 = {
28812
28800
  key: 0,
28813
28801
  class: "login-modal-tabs-row"
28814
28802
  };
28815
- const _hoisted_11 = { class: "login-modal-tabs" };
28816
- const _hoisted_12 = { class: "last-login-img" };
28803
+ const _hoisted_11$1 = { class: "login-modal-tabs" };
28804
+ const _hoisted_12$1 = { class: "last-login-img" };
28817
28805
  const _hoisted_13 = ["src"];
28818
28806
  const _hoisted_14 = { class: "last-login-img" };
28819
28807
  const _hoisted_15 = ["src"];
@@ -30608,8 +30596,8 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
30608
30596
  createElementVNode("div", {
30609
30597
  class: normalizeClass(["login-modal-form", formType.value === "forget" ? "login-modal-form--forget" : "login-modal-form--default"])
30610
30598
  }, [
30611
- formType.value === "login" ? (openBlock(), createElementBlock("div", _hoisted_10, [
30612
- createElementVNode("div", _hoisted_11, [
30599
+ formType.value === "login" ? (openBlock(), createElementBlock("div", _hoisted_10$1, [
30600
+ createElementVNode("div", _hoisted_11$1, [
30613
30601
  createElementVNode("div", {
30614
30602
  class: normalizeClass([
30615
30603
  "login-modal-tab",
@@ -30618,7 +30606,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
30618
30606
  onClick: _cache[0] || (_cache[0] = withModifiers(($event) => handleTabPanelChange("miniProgram"), ["stop"]))
30619
30607
  }, [
30620
30608
  createTextVNode(toDisplayString$1(unref($t)("gitCodeLayout.LoginModal.miniProgram.title")) + " ", 1),
30621
- createElementVNode("div", _hoisted_12, [
30609
+ createElementVNode("div", _hoisted_12$1, [
30622
30610
  recentLoginType.value === unref(LoginMethodEnum).MINI_PROGRAM ? (openBlock(), createElementBlock("img", {
30623
30611
  key: 0,
30624
30612
  src: unref(recentLoginImg),
@@ -31297,15 +31285,18 @@ const HeaderSkeleton = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "
31297
31285
  const _hoisted_1$1 = ["aria-label"];
31298
31286
  const _hoisted_2 = { class: "shortcut-heading" };
31299
31287
  const _hoisted_3 = ["aria-label"];
31300
- const _hoisted_4 = ["aria-label", "placeholder"];
31301
- const _hoisted_5 = { class: "shortcut-command-list" };
31302
- const _hoisted_6 = ["onClick"];
31303
- const _hoisted_7 = {
31288
+ const _hoisted_4 = { class: "shortcut-body" };
31289
+ const _hoisted_5 = ["aria-label", "placeholder"];
31290
+ const _hoisted_6 = { class: "shortcut-command-list" };
31291
+ const _hoisted_7 = ["onClick"];
31292
+ const _hoisted_8 = { class: "shortcut-keys" };
31293
+ const _hoisted_9 = {
31304
31294
  key: 0,
31305
31295
  role: "status"
31306
31296
  };
31307
- const _hoisted_8 = { class: "shortcut-preference" };
31308
- const _hoisted_9 = ["checked"];
31297
+ const _hoisted_10 = { class: "shortcut-preference" };
31298
+ const _hoisted_11 = ["checked"];
31299
+ const _hoisted_12 = { class: "shortcut-keys" };
31309
31300
  const _sfc_main$2 = /* @__PURE__ */ defineComponent({
31310
31301
  ...{ name: "ShortcutHelpDialog" },
31311
31302
  __name: "index",
@@ -31326,7 +31317,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
31326
31317
  };
31327
31318
  const focusInitial = () => {
31328
31319
  var _a;
31329
- (_a = filterInput.value ?? focusable()[0] ?? panel.value) == null ? void 0 : _a.focus();
31320
+ (_a = filterInput.value ?? panel.value) == null ? void 0 : _a.focus();
31330
31321
  };
31331
31322
  const onPreferenceChange = (event) => setCharacterShortcutsEnabled(event.target.checked);
31332
31323
  const onKeydown2 = (event) => {
@@ -31397,65 +31388,75 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
31397
31388
  onClick: _cache[0] || (_cache[0] = ($event) => unref(closeShortcutDialog)())
31398
31389
  }, "×", 8, _hoisted_3)
31399
31390
  ]),
31400
- unref(shortcutDialog) === "commands" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
31401
- withDirectives(createElementVNode("input", {
31402
- ref_key: "filterInput",
31403
- ref: filterInput,
31404
- "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => query.value = $event),
31405
- class: "shortcut-filter",
31406
- "aria-label": unref(t2)("shortcut.commands.search"),
31407
- placeholder: unref(t2)("shortcut.commands.search")
31408
- }, null, 8, _hoisted_4), [
31409
- [vModelText, query.value]
31410
- ]),
31411
- createElementVNode("ul", _hoisted_5, [
31412
- (openBlock(true), createElementBlock(Fragment, null, renderList(commands.value, (action) => {
31413
- return openBlock(), createElementBlock("li", {
31414
- key: action.id
31415
- }, [
31416
- createElementVNode("button", {
31417
- type: "button",
31418
- class: "shortcut-command",
31419
- onClick: ($event) => unref(executeShortcutAction)(action)
31391
+ createElementVNode("div", _hoisted_4, [
31392
+ unref(shortcutDialog) === "commands" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
31393
+ withDirectives(createElementVNode("input", {
31394
+ ref_key: "filterInput",
31395
+ ref: filterInput,
31396
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => query.value = $event),
31397
+ class: "shortcut-filter",
31398
+ "aria-label": unref(t2)("shortcut.commands.search"),
31399
+ placeholder: unref(t2)("shortcut.commands.search")
31400
+ }, null, 8, _hoisted_5), [
31401
+ [vModelText, query.value]
31402
+ ]),
31403
+ createElementVNode("ul", _hoisted_6, [
31404
+ (openBlock(true), createElementBlock(Fragment, null, renderList(commands.value, (action) => {
31405
+ return openBlock(), createElementBlock("li", {
31406
+ key: action.id
31420
31407
  }, [
31421
- createElementVNode("span", null, toDisplayString$1(unref(t2)(action.labelKey)), 1),
31422
- createElementVNode("kbd", null, toDisplayString$1(displayKeys(action.keys)), 1)
31423
- ], 8, _hoisted_6)
31424
- ]);
31425
- }), 128))
31426
- ]),
31427
- !commands.value.length ? (openBlock(), createElementBlock("p", _hoisted_7, toDisplayString$1(unref(t2)("shortcut.commands.empty")), 1)) : createCommentVNode("", true)
31428
- ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
31429
- createElementVNode("label", _hoisted_8, [
31430
- createElementVNode("input", {
31431
- type: "checkbox",
31432
- checked: unref(characterShortcutsEnabled),
31433
- onChange: onPreferenceChange
31434
- }, null, 40, _hoisted_9),
31435
- createTextVNode(" " + toDisplayString$1(unref(t2)("shortcut.a11y.characterKeys")), 1)
31436
- ]),
31437
- (openBlock(true), createElementBlock(Fragment, null, renderList(groups.value, (group) => {
31438
- return openBlock(), createElementBlock("section", {
31439
- key: group.id,
31440
- class: "shortcut-group"
31441
- }, [
31442
- createElementVNode("h3", null, toDisplayString$1(unref(t2)(`shortcut.group.${group.id}`)), 1),
31443
- createElementVNode("dl", null, [
31444
- (openBlock(true), createElementBlock(Fragment, null, renderList(group.actions, (action) => {
31445
- return openBlock(), createElementBlock("div", {
31446
- key: action.id,
31447
- class: "shortcut-row"
31408
+ createElementVNode("button", {
31409
+ type: "button",
31410
+ class: "shortcut-command",
31411
+ onClick: ($event) => unref(executeShortcutAction)(action)
31448
31412
  }, [
31449
- createElementVNode("dt", null, toDisplayString$1(unref(t2)(action.labelKey)), 1),
31450
- createElementVNode("dd", null, [
31451
- createElementVNode("kbd", null, toDisplayString$1(displayKeys(action.keys)), 1)
31413
+ createElementVNode("span", null, toDisplayString$1(unref(t2)(action.labelKey)), 1),
31414
+ createElementVNode("span", _hoisted_8, [
31415
+ (openBlock(true), createElementBlock(Fragment, null, renderList(displayKeys(action.keys).split(" "), (key, index2) => {
31416
+ return openBlock(), createElementBlock("kbd", { key: index2 }, toDisplayString$1(key), 1);
31417
+ }), 128))
31452
31418
  ])
31453
- ]);
31454
- }), 128))
31455
- ])
31456
- ]);
31457
- }), 128))
31458
- ], 64))
31419
+ ], 8, _hoisted_7)
31420
+ ]);
31421
+ }), 128))
31422
+ ]),
31423
+ !commands.value.length ? (openBlock(), createElementBlock("p", _hoisted_9, toDisplayString$1(unref(t2)("shortcut.commands.empty")), 1)) : createCommentVNode("", true)
31424
+ ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
31425
+ createElementVNode("label", _hoisted_10, [
31426
+ createElementVNode("input", {
31427
+ type: "checkbox",
31428
+ checked: unref(characterShortcutsEnabled),
31429
+ onChange: onPreferenceChange
31430
+ }, null, 40, _hoisted_11),
31431
+ createTextVNode(" " + toDisplayString$1(unref(t2)("shortcut.a11y.characterKeys")), 1)
31432
+ ]),
31433
+ (openBlock(true), createElementBlock(Fragment, null, renderList(groups.value, (group) => {
31434
+ return openBlock(), createElementBlock("section", {
31435
+ key: group.id,
31436
+ class: "shortcut-group"
31437
+ }, [
31438
+ createElementVNode("h3", null, toDisplayString$1(unref(t2)(`shortcut.group.${group.id}`)), 1),
31439
+ createElementVNode("dl", null, [
31440
+ (openBlock(true), createElementBlock(Fragment, null, renderList(group.actions, (action) => {
31441
+ return openBlock(), createElementBlock("div", {
31442
+ key: action.id,
31443
+ class: "shortcut-row"
31444
+ }, [
31445
+ createElementVNode("dt", null, toDisplayString$1(unref(t2)(action.labelKey)), 1),
31446
+ createElementVNode("dd", null, [
31447
+ createElementVNode("span", _hoisted_12, [
31448
+ (openBlock(true), createElementBlock(Fragment, null, renderList(displayKeys(action.keys).split(" "), (key, index2) => {
31449
+ return openBlock(), createElementBlock("kbd", { key: index2 }, toDisplayString$1(key), 1);
31450
+ }), 128))
31451
+ ])
31452
+ ])
31453
+ ]);
31454
+ }), 128))
31455
+ ])
31456
+ ]);
31457
+ }), 128))
31458
+ ], 64))
31459
+ ])
31459
31460
  ], 40, _hoisted_1$1)
31460
31461
  ])
31461
31462
  ]);