vue-layout-gitcode 1.12.42 → 1.12.44

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.
@@ -10424,52 +10424,6 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
10424
10424
  };
10425
10425
  }
10426
10426
  });
10427
- const FIRST_NAMESPACE_KEY = "parent_org_path";
10428
- const useBreadcrumb = () => {
10429
- const router2 = useRouter();
10430
- if (!router2) {
10431
- return computed(() => []);
10432
- }
10433
- const repoInfo = inject(
10434
- "repoInfo",
10435
- computed(() => ({}))
10436
- );
10437
- const breadcrumb = computed(() => {
10438
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
10439
- const isSubOrg = !!((_b = (_a = router2 == null ? void 0 : router2.currentRoute) == null ? void 0 : _a.value) == null ? void 0 : _b.params[FIRST_NAMESPACE_KEY]);
10440
- const full_name = ((_d = (_c = repoInfo.value) == null ? void 0 : _c.namespace) == null ? void 0 : _d.full_name) || "";
10441
- const name = ((_f = (_e = repoInfo.value) == null ? void 0 : _e.namespace) == null ? void 0 : _f.name) || "";
10442
- const orgName = isSubOrg ? full_name : name;
10443
- const repoName = ((_g = repoInfo.value) == null ? void 0 : _g.name) || "";
10444
- const breadcrumbList = [
10445
- {
10446
- label: orgName,
10447
- path: ""
10448
- },
10449
- {
10450
- label: repoName,
10451
- path: ""
10452
- }
10453
- ];
10454
- const params = cloneDeep((_i = (_h = router2.currentRoute) == null ? void 0 : _h.value) == null ? void 0 : _i.params);
10455
- if (isSubOrg) {
10456
- params.namespace = params[FIRST_NAMESPACE_KEY];
10457
- delete params[FIRST_NAMESPACE_KEY];
10458
- }
10459
- breadcrumbList[0].path = router2.resolve({
10460
- name: "homepage",
10461
- params
10462
- }).path;
10463
- breadcrumbList[breadcrumbList.length - 1].path = router2.resolve({
10464
- name: "repoDashboard",
10465
- params: {
10466
- ...(_k = (_j = router2.currentRoute) == null ? void 0 : _j.value) == null ? void 0 : _k.params
10467
- }
10468
- }).path;
10469
- return breadcrumbList;
10470
- });
10471
- return breadcrumb;
10472
- };
10473
10427
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
10474
10428
  function getDefaultExportFromCjs(x) {
10475
10429
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
@@ -10498,1133 +10452,66 @@ function getAugmentedNamespace(n) {
10498
10452
  });
10499
10453
  return a;
10500
10454
  }
10501
- var relativeTime$1 = { exports: {} };
10502
- (function(module, exports) {
10503
- !function(r, e) {
10504
- module.exports = e();
10505
- }(commonjsGlobal, function() {
10506
- return function(r, e, t2) {
10507
- r = r || {};
10508
- var n = e.prototype, o = { future: "in %s", past: "%s ago", s: "a few seconds", m: "a minute", mm: "%d minutes", h: "an hour", hh: "%d hours", d: "a day", dd: "%d days", M: "a month", MM: "%d months", y: "a year", yy: "%d years" };
10509
- function i(r2, e2, t3, o2) {
10510
- return n.fromToBase(r2, e2, t3, o2);
10455
+ var aes = { exports: {} };
10456
+ function commonjsRequire(path) {
10457
+ throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
10458
+ }
10459
+ var core = { exports: {} };
10460
+ const __viteBrowserExternal = {};
10461
+ const __viteBrowserExternal$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
10462
+ __proto__: null,
10463
+ default: __viteBrowserExternal
10464
+ }, Symbol.toStringTag, { value: "Module" }));
10465
+ const require$$0 = /* @__PURE__ */ getAugmentedNamespace(__viteBrowserExternal$1);
10466
+ var hasRequiredCore;
10467
+ function requireCore() {
10468
+ if (hasRequiredCore) return core.exports;
10469
+ hasRequiredCore = 1;
10470
+ (function(module, exports) {
10471
+ (function(root, factory) {
10472
+ {
10473
+ module.exports = factory();
10511
10474
  }
10512
- t2.en.relativeTime = o, n.fromToBase = function(e2, n2, i2, d2, u) {
10513
- for (var f, a, s, l = i2.$locale().relativeTime || o, h2 = r.thresholds || [{ l: "s", r: 44, d: "second" }, { l: "m", r: 89 }, { l: "mm", r: 44, d: "minute" }, { l: "h", r: 89 }, { l: "hh", r: 21, d: "hour" }, { l: "d", r: 35 }, { l: "dd", r: 25, d: "day" }, { l: "M", r: 45 }, { l: "MM", r: 10, d: "month" }, { l: "y", r: 17 }, { l: "yy", d: "year" }], m = h2.length, c = 0; c < m; c += 1) {
10514
- var y = h2[c];
10515
- y.d && (f = d2 ? t2(e2).diff(i2, y.d, true) : i2.diff(e2, y.d, true));
10516
- var p = (r.rounding || Math.round)(Math.abs(f));
10517
- if (s = f > 0, p <= y.r || !y.r) {
10518
- p <= 1 && c > 0 && (y = h2[c - 1]);
10519
- var v = l[y.l];
10520
- u && (p = u("" + p)), a = "string" == typeof v ? v.replace("%d", p) : v(p, n2, y.l, s);
10521
- break;
10522
- }
10475
+ })(commonjsGlobal, function() {
10476
+ var CryptoJS = CryptoJS || function(Math2, undefined$1) {
10477
+ var crypto;
10478
+ if (typeof window !== "undefined" && window.crypto) {
10479
+ crypto = window.crypto;
10523
10480
  }
10524
- if (n2) return a;
10525
- var M = s ? l.future : l.past;
10526
- return "function" == typeof M ? M(a) : M.replace("%s", a);
10527
- }, n.to = function(r2, e2) {
10528
- return i(r2, e2, this, true);
10529
- }, n.from = function(r2, e2) {
10530
- return i(r2, e2, this);
10531
- };
10532
- var d = function(r2) {
10533
- return r2.$u ? t2.utc() : t2();
10534
- };
10535
- n.toNow = function(r2) {
10536
- return this.to(d(this), r2);
10537
- }, n.fromNow = function(r2) {
10538
- return this.from(d(this), r2);
10539
- };
10540
- };
10541
- });
10542
- })(relativeTime$1);
10543
- var relativeTimeExports = relativeTime$1.exports;
10544
- const relativeTime = /* @__PURE__ */ getDefaultExportFromCjs(relativeTimeExports);
10545
- var zhCn = { exports: {} };
10546
- (function(module, exports) {
10547
- !function(e, _) {
10548
- module.exports = _(dayjs);
10549
- }(commonjsGlobal, function(e) {
10550
- function _(e2) {
10551
- return e2 && "object" == typeof e2 && "default" in e2 ? e2 : { default: e2 };
10552
- }
10553
- var t2 = _(e), d = { name: "zh-cn", weekdays: "星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"), weekdaysShort: "周日_周一_周二_周三_周四_周五_周六".split("_"), weekdaysMin: "日_一_二_三_四_五_六".split("_"), months: "一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"), monthsShort: "1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"), ordinal: function(e2, _2) {
10554
- return "W" === _2 ? e2 + "周" : e2 + "日";
10555
- }, weekStart: 1, yearStart: 4, formats: { LT: "HH:mm", LTS: "HH:mm:ss", L: "YYYY/MM/DD", LL: "YYYY年M月D日", LLL: "YYYY年M月D日Ah点mm分", LLLL: "YYYY年M月D日ddddAh点mm分", l: "YYYY/M/D", ll: "YYYY年M月D日", lll: "YYYY年M月D日 HH:mm", llll: "YYYY年M月D日dddd HH:mm" }, relativeTime: { future: "%s内", past: "%s前", s: "几秒", m: "1 分钟", mm: "%d 分钟", h: "1 小时", hh: "%d 小时", d: "1 天", dd: "%d 天", M: "1 个月", MM: "%d 个月", y: "1 年", yy: "%d 年" }, meridiem: function(e2, _2) {
10556
- var t3 = 100 * e2 + _2;
10557
- return t3 < 600 ? "凌晨" : t3 < 900 ? "早上" : t3 < 1100 ? "上午" : t3 < 1300 ? "中午" : t3 < 1800 ? "下午" : "晚上";
10558
- } };
10559
- return t2.default.locale(d, null, true), d;
10560
- });
10561
- })(zhCn);
10562
- var zhCnExports = zhCn.exports;
10563
- const locale = /* @__PURE__ */ getDefaultExportFromCjs(zhCnExports);
10564
- var timezone = { exports: {} };
10565
- (function(module, exports) {
10566
- !function(t2, e) {
10567
- module.exports = e();
10568
- }(commonjsGlobal, function() {
10569
- var t2 = { year: 0, month: 1, day: 2, hour: 3, minute: 4, second: 5 }, e = {};
10570
- return function(n, i, o) {
10571
- var r, a = function(t3, n2, i2) {
10572
- void 0 === i2 && (i2 = {});
10573
- var o2 = new Date(t3), r2 = function(t4, n3) {
10574
- void 0 === n3 && (n3 = {});
10575
- var i3 = n3.timeZoneName || "short", o3 = t4 + "|" + i3, r3 = e[o3];
10576
- return r3 || (r3 = new Intl.DateTimeFormat("en-US", { hour12: false, timeZone: t4, year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit", timeZoneName: i3 }), e[o3] = r3), r3;
10577
- }(n2, i2);
10578
- return r2.formatToParts(o2);
10579
- }, u = function(e2, n2) {
10580
- for (var i2 = a(e2, n2), r2 = [], u2 = 0; u2 < i2.length; u2 += 1) {
10581
- var f2 = i2[u2], s2 = f2.type, m = f2.value, c = t2[s2];
10582
- c >= 0 && (r2[c] = parseInt(m, 10));
10481
+ if (typeof self !== "undefined" && self.crypto) {
10482
+ crypto = self.crypto;
10583
10483
  }
10584
- var d = r2[3], l = 24 === d ? 0 : d, h2 = r2[0] + "-" + r2[1] + "-" + r2[2] + " " + l + ":" + r2[4] + ":" + r2[5] + ":000", v = +e2;
10585
- return (o.utc(h2).valueOf() - (v -= v % 1e3)) / 6e4;
10586
- }, f = i.prototype;
10587
- f.tz = function(t3, e2) {
10588
- void 0 === t3 && (t3 = r);
10589
- var n2, i2 = this.utcOffset(), a2 = this.toDate(), u2 = a2.toLocaleString("en-US", { timeZone: t3 }), f2 = Math.round((a2 - new Date(u2)) / 1e3 / 60), s2 = 15 * -Math.round(a2.getTimezoneOffset() / 15) - f2;
10590
- if (!Number(s2)) n2 = this.utcOffset(0, e2);
10591
- else if (n2 = o(u2, { locale: this.$L }).$set("millisecond", this.$ms).utcOffset(s2, true), e2) {
10592
- var m = n2.utcOffset();
10593
- n2 = n2.add(i2 - m, "minute");
10484
+ if (typeof globalThis !== "undefined" && globalThis.crypto) {
10485
+ crypto = globalThis.crypto;
10594
10486
  }
10595
- return n2.$x.$timezone = t3, n2;
10596
- }, f.offsetName = function(t3) {
10597
- var e2 = this.$x.$timezone || o.tz.guess(), n2 = a(this.valueOf(), e2, { timeZoneName: t3 }).find(function(t4) {
10598
- return "timezonename" === t4.type.toLowerCase();
10599
- });
10600
- return n2 && n2.value;
10601
- };
10602
- var s = f.startOf;
10603
- f.startOf = function(t3, e2) {
10604
- if (!this.$x || !this.$x.$timezone) return s.call(this, t3, e2);
10605
- var n2 = o(this.format("YYYY-MM-DD HH:mm:ss:SSS"), { locale: this.$L });
10606
- return s.call(n2, t3, e2).tz(this.$x.$timezone, true);
10607
- }, o.tz = function(t3, e2, n2) {
10608
- var i2 = n2 && e2, a2 = n2 || e2 || r, f2 = u(+o(), a2);
10609
- if ("string" != typeof t3) return o(t3).tz(a2);
10610
- var s2 = function(t4, e3, n3) {
10611
- var i3 = t4 - 60 * e3 * 1e3, o2 = u(i3, n3);
10612
- if (e3 === o2) return [i3, e3];
10613
- var r2 = u(i3 -= 60 * (o2 - e3) * 1e3, n3);
10614
- return o2 === r2 ? [i3, o2] : [t4 - 60 * Math.min(o2, r2) * 1e3, Math.max(o2, r2)];
10615
- }(o.utc(t3, i2).valueOf(), f2, a2), m = s2[0], c = s2[1], d = o(m).utcOffset(c);
10616
- return d.$x.$timezone = a2, d;
10617
- }, o.tz.guess = function() {
10618
- return Intl.DateTimeFormat().resolvedOptions().timeZone;
10619
- }, o.tz.setDefault = function(t3) {
10620
- r = t3;
10621
- };
10622
- };
10623
- });
10624
- })(timezone);
10625
- var timezoneExports = timezone.exports;
10626
- const tz = /* @__PURE__ */ getDefaultExportFromCjs(timezoneExports);
10627
- var utc$1 = { exports: {} };
10628
- (function(module, exports) {
10629
- !function(t2, i) {
10630
- module.exports = i();
10631
- }(commonjsGlobal, function() {
10632
- var t2 = "minute", i = /[+-]\d\d(?::?\d\d)?/g, e = /([+-]|\d\d)/g;
10633
- return function(s, f, n) {
10634
- var u = f.prototype;
10635
- n.utc = function(t3) {
10636
- var i2 = { date: t3, utc: true, args: arguments };
10637
- return new f(i2);
10638
- }, u.utc = function(i2) {
10639
- var e2 = n(this.toDate(), { locale: this.$L, utc: true });
10640
- return i2 ? e2.add(this.utcOffset(), t2) : e2;
10641
- }, u.local = function() {
10642
- return n(this.toDate(), { locale: this.$L, utc: false });
10643
- };
10644
- var o = u.parse;
10645
- u.parse = function(t3) {
10646
- t3.utc && (this.$u = true), this.$utils().u(t3.$offset) || (this.$offset = t3.$offset), o.call(this, t3);
10647
- };
10648
- var r = u.init;
10649
- u.init = function() {
10650
- if (this.$u) {
10651
- var t3 = this.$d;
10652
- this.$y = t3.getUTCFullYear(), this.$M = t3.getUTCMonth(), this.$D = t3.getUTCDate(), this.$W = t3.getUTCDay(), this.$H = t3.getUTCHours(), this.$m = t3.getUTCMinutes(), this.$s = t3.getUTCSeconds(), this.$ms = t3.getUTCMilliseconds();
10653
- } else r.call(this);
10654
- };
10655
- var a = u.utcOffset;
10656
- u.utcOffset = function(s2, f2) {
10657
- var n2 = this.$utils().u;
10658
- if (n2(s2)) return this.$u ? 0 : n2(this.$offset) ? a.call(this) : this.$offset;
10659
- if ("string" == typeof s2 && (s2 = function(t3) {
10660
- void 0 === t3 && (t3 = "");
10661
- var s3 = t3.match(i);
10662
- if (!s3) return null;
10663
- var f3 = ("" + s3[0]).match(e) || ["-", 0, 0], n3 = f3[0], u3 = 60 * +f3[1] + +f3[2];
10664
- return 0 === u3 ? 0 : "+" === n3 ? u3 : -u3;
10665
- }(s2), null === s2)) return this;
10666
- var u2 = Math.abs(s2) <= 16 ? 60 * s2 : s2, o2 = this;
10667
- if (f2) return o2.$offset = u2, o2.$u = 0 === s2, o2;
10668
- if (0 !== s2) {
10669
- var r2 = this.$u ? this.toDate().getTimezoneOffset() : -1 * this.utcOffset();
10670
- (o2 = this.local().add(u2 + r2, t2)).$offset = u2, o2.$x.$localOffset = r2;
10671
- } else o2 = this.utc();
10672
- return o2;
10673
- };
10674
- var h2 = u.format;
10675
- u.format = function(t3) {
10676
- var i2 = t3 || (this.$u ? "YYYY-MM-DDTHH:mm:ss[Z]" : "");
10677
- return h2.call(this, i2);
10678
- }, u.valueOf = function() {
10679
- var t3 = this.$utils().u(this.$offset) ? 0 : this.$offset + (this.$x.$localOffset || this.$d.getTimezoneOffset());
10680
- return this.$d.valueOf() - 6e4 * t3;
10681
- }, u.isUTC = function() {
10682
- return !!this.$u;
10683
- }, u.toISOString = function() {
10684
- return this.toDate().toISOString();
10685
- }, u.toString = function() {
10686
- return this.toDate().toUTCString();
10687
- };
10688
- var l = u.toDate;
10689
- u.toDate = function(t3) {
10690
- return "s" === t3 && this.$offset ? n(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate() : l.call(this);
10691
- };
10692
- var c = u.diff;
10693
- u.diff = function(t3, i2, e2) {
10694
- if (t3 && this.$u === t3.$u) return c.call(this, t3, i2, e2);
10695
- var s2 = this.local(), f2 = n(t3).local();
10696
- return c.call(s2, f2, i2, e2);
10697
- };
10698
- };
10699
- });
10700
- })(utc$1);
10701
- var utcExports = utc$1.exports;
10702
- const utc = /* @__PURE__ */ getDefaultExportFromCjs(utcExports);
10703
- dayjs.locale(locale);
10704
- dayjs.extend(relativeTime);
10705
- dayjs.extend(tz);
10706
- dayjs.extend(utc);
10707
- dayjs.tz.setDefault("Asia/Shanghai");
10708
- const useTimeFormat = () => {
10709
- const formatTimeFromNow = (time) => {
10710
- if (!time) return "-";
10711
- const targetDate = isDate$1(time) ? time : new Date(time);
10712
- return formatTimeDifference(targetDate);
10713
- };
10714
- const formatTime = (time, format2) => {
10715
- if (!time) return "-";
10716
- return dayjs(time).format(format2);
10717
- };
10718
- return {
10719
- formatTimeFromNow,
10720
- formatTime
10721
- };
10722
- };
10723
- const _hoisted_1$F = {
10724
- key: 0,
10725
- class: "org-layout-toolbar"
10726
- };
10727
- const _hoisted_2$v = { class: "org-layout-toolbar-title ellipsis-two-line" };
10728
- const _hoisted_3$u = { class: "header-custom-btn-label" };
10729
- const _hoisted_4$n = { class: "g-repo-breadcrumb-custom" };
10730
- const _hoisted_5$i = {
10731
- key: 1,
10732
- class: "header-custom-mirrors-avatar"
10733
- };
10734
- const _hoisted_6$g = {
10735
- key: 0,
10736
- src: _imports_0,
10737
- alt: "mirrors-avatar-phone",
10738
- class: "header-custom-mirrors-img"
10739
- };
10740
- const _hoisted_7$d = {
10741
- key: 1,
10742
- src: "https://cdn-static.gitcode.com/static/images/mirrors-avata_20250411.gif",
10743
- alt: "mirrors-avatar",
10744
- class: "header-custom-mirrors-img-tall"
10745
- };
10746
- const _hoisted_8$b = { class: "g-repo-breadcrumb-container" };
10747
- const _hoisted_9$a = {
10748
- key: 0,
10749
- class: "header-custom-breadcrumb-row"
10750
- };
10751
- const _hoisted_10$9 = ["title"];
10752
- const _hoisted_11$7 = ["title"];
10753
- const _hoisted_12$7 = {
10754
- key: 0,
10755
- class: "header-custom-tag-mb"
10756
- };
10757
- const _hoisted_13$4 = {
10758
- key: 1,
10759
- class: "header-custom-tag-mb"
10760
- };
10761
- const _hoisted_14$2 = {
10762
- key: 2,
10763
- class: "header-custom-tag-mb"
10764
- };
10765
- const _hoisted_15$2 = {
10766
- key: 3,
10767
- class: "header-custom-tag-mb"
10768
- };
10769
- const _hoisted_16$2 = { class: "header-custom-topic-label" };
10770
- const _hoisted_17$2 = {
10771
- key: 5,
10772
- class: "topic-tag font-color-t2 gh_mirros_tag"
10773
- };
10774
- const _hoisted_18$2 = { class: "header-custom-topic-label" };
10775
- const _hoisted_19$2 = { class: "header-custom-skeleton" };
10776
- const _hoisted_20$2 = {
10777
- key: 2,
10778
- class: "user-layout-toolbar"
10779
- };
10780
- const _hoisted_21$2 = { class: "user-layout-toolbar-title ellipsis-two-line" };
10781
- const _hoisted_22$2 = { class: "header-custom-btn-label" };
10782
- const _sfc_main$L = /* @__PURE__ */ defineComponent({
10783
- __name: "HeaderCustom",
10784
- props: {
10785
- scene: { default: SceneValue.home },
10786
- isLogin: { type: Boolean, default: false },
10787
- errorCode: { default: 0 },
10788
- orgProps: { default: () => ({}) },
10789
- repoProps: { default: () => ({}) },
10790
- userProps: { default: () => ({}) }
10791
- },
10792
- emits: ["followDevCommunity", "followUser"],
10793
- setup(__props, { emit: __emit }) {
10794
- const { t: t2 } = i18n.global;
10795
- const layoutConfig2 = useLayoutConfig();
10796
- const breadcrumb = useBreadcrumb();
10797
- console.log("breadcrumb", breadcrumb);
10798
- const breadcrumbRef = ref(null);
10799
- const breadcrumbTextRef = ref(null);
10800
- const breadcrumbNextRef = ref(null);
10801
- const breadcrumbNextTextRef = ref(null);
10802
- const { formatTimeFromNow } = useTimeFormat();
10803
- const props = __props;
10804
- const repoInfo = inject("repoInfo", computed(() => void 0));
10805
- console.log("repoInfo", repoInfo);
10806
- const orgInfo = inject("orgInfo", computed(() => void 0));
10807
- const otherUserInfo = inject("otherUserInfo", computed(() => void 0));
10808
- const emits = __emit;
10809
- const handleOrgFollow = (val) => {
10810
- if (props.scene !== SceneValue.org) return;
10811
- if (!props.isLogin) {
10812
- emitEvent("login", { triggerType: "关注组织", loginTriggerSource: "toolbar_org_follow" });
10813
- return;
10814
- }
10815
- emits("followDevCommunity", !val);
10816
- };
10817
- const topicTag = computed(() => {
10818
- var _a, _b;
10819
- if (props.scene !== SceneValue.repo) return false;
10820
- let repoType = 1;
10821
- repoType = Number((_a = repoInfo.value) == null ? void 0 : _a.repo_type) - 1;
10822
- if ((_b = props.repoProps) == null ? void 0 : _b.isSpaces) {
10823
- repoType = 2;
10824
- }
10825
- if (repoType < 0) {
10826
- return false;
10827
- }
10828
- const name = ["模型", "数据集", "Space"];
10829
- const icon = ["gt-line-Models", "gt-line-Datasets", "gt-line-space"];
10830
- const linkName = ["models", "datasets", "spaces"];
10831
- const linkUrl = ["/models", "/datasets", "/space"];
10832
- const suffix = ["Model", "Datasets", "Space"];
10833
- const obj = {
10834
- name: name[repoType],
10835
- icon: icon[repoType],
10836
- linkName: linkName[repoType],
10837
- linkUrl: linkUrl[repoType],
10838
- suffix: suffix[repoType]
10839
- };
10840
- return obj;
10841
- });
10842
- const isOrg = computed(() => {
10843
- var _a, _b;
10844
- if (props.scene === SceneValue.repo) {
10845
- return ((_b = (_a = repoInfo.value) == null ? void 0 : _a.namespace) == null ? void 0 : _b.kind) === "group";
10846
- }
10847
- return false;
10848
- });
10849
- const toAiHub = () => {
10850
- if (props.scene !== SceneValue.repo) return;
10851
- if (!topicTag.value) return;
10852
- const aiUrl = `${layoutConfig2.VITE_AI_HOST}${topicTag.value.linkUrl}`;
10853
- if (typeof window !== "undefined" && window.location) {
10854
- window.location.href = aiUrl;
10855
- }
10856
- };
10857
- const showTimeTopic = computed(() => {
10858
- var _a, _b;
10859
- if (props.scene !== SceneValue.repo) return false;
10860
- if (!((_a = repoInfo.value) == null ? void 0 : _a.last_repository_updated_at)) {
10861
- return false;
10862
- }
10863
- try {
10864
- return (/* @__PURE__ */ new Date()).getTime() - new Date((_b = repoInfo.value) == null ? void 0 : _b.last_repository_updated_at).getTime() < 7 * 24 * 60 * 60 * 1e3;
10865
- } catch (error) {
10866
- return false;
10867
- }
10868
- });
10869
- const formatTime = computed(() => {
10870
- var _a;
10871
- return formatTimeFromNow(((_a = repoInfo.value) == null ? void 0 : _a.last_repository_updated_at) || "");
10872
- });
10873
- const handleFollowUser = () => {
10874
- if (props.scene !== SceneValue.user) return;
10875
- emits("followUser");
10876
- };
10877
- const handleBreadcrumbCopy = (e) => {
10878
- const container = document.querySelector(".g-repo-breadcrumb-custom");
10879
- if (!container) return;
10880
- const selection = window.getSelection();
10881
- if (!selection || !selection.rangeCount) return;
10882
- const range = selection.getRangeAt(0);
10883
- const selectedText = selection.toString().trim();
10884
- const isSelectionInContainer = container.contains(range.startContainer) && container.contains(range.endContainer);
10885
- if (isSelectionInContainer && selectedText) {
10886
- e.preventDefault();
10887
- if (e.clipboardData) {
10888
- e.clipboardData.setData("text/plain", selectedText.replace(/\s+/g, ""));
10487
+ if (!crypto && typeof window !== "undefined" && window.msCrypto) {
10488
+ crypto = window.msCrypto;
10889
10489
  }
10890
- }
10891
- };
10892
- onMounted(() => {
10893
- document.addEventListener("copy", handleBreadcrumbCopy);
10894
- });
10895
- onUnmounted(() => {
10896
- document.removeEventListener("copy", handleBreadcrumbCopy);
10897
- });
10898
- return (_ctx, _cache) => {
10899
- var _a, _b, _c;
10900
- return _ctx.scene === unref(SceneValue).org && !_ctx.errorCode ? (openBlock(), createElementBlock("div", _hoisted_1$F, [
10901
- createVNode(GLink, {
10902
- href: ((_a = _ctx.orgProps) == null ? void 0 : _a.orgHomepageUrl) || "",
10903
- class: "header-custom-link"
10904
- }, {
10905
- default: withCtx(() => {
10906
- var _a2, _b2, _c2;
10907
- return [
10908
- createVNode(_sfc_main$N, {
10909
- class: "g-border",
10910
- src: ((_a2 = unref(orgInfo)) == null ? void 0 : _a2.avatar) || "",
10911
- name: ((_b2 = unref(orgInfo)) == null ? void 0 : _b2.name) || "",
10912
- width: 28,
10913
- height: 28,
10914
- is_round: false
10915
- }, null, 8, ["src", "name"]),
10916
- createElementVNode("div", _hoisted_2$v, toDisplayString$1((_c2 = unref(orgInfo)) == null ? void 0 : _c2.name), 1)
10917
- ];
10918
- }),
10919
- _: 1
10920
- }, 8, ["href"]),
10921
- createVNode(unref(Button), {
10922
- onClick: _cache[0] || (_cache[0] = ($event) => {
10923
- var _a2;
10924
- return handleOrgFollow((_a2 = _ctx.orgProps) == null ? void 0 : _a2.isOrgFollow);
10925
- }),
10926
- class: "org-layout-toolbar-follow"
10927
- }, {
10928
- default: withCtx(() => {
10929
- var _a2;
10930
- return [
10931
- createElementVNode("span", _hoisted_3$u, toDisplayString$1(((_a2 = _ctx.orgProps) == null ? void 0 : _a2.isOrgFollow) ? unref(t2)("gitCodeLayout.home.alreadyFollowed") : unref(t2)("gitCodeLayout.home.focusOn")), 1)
10932
- ];
10933
- }),
10934
- _: 1
10935
- })
10936
- ])) : _ctx.scene === unref(SceneValue).repo && !_ctx.errorCode ? (openBlock(), createBlock(unref(Skeleton), {
10937
- key: 1,
10938
- loading: (_b = _ctx.repoProps) == null ? void 0 : _b.repoNameLoading,
10939
- rows: 1
10940
- }, {
10941
- placeholder: withCtx(() => [
10942
- createElementVNode("div", _hoisted_19$2, [
10943
- createVNode(unref(SkeletonItem), {
10944
- round: "",
10945
- style: { "width": "30px", "height": "30px" }
10946
- }),
10947
- createVNode(unref(SkeletonItem), { style: { "margin-left": "12px", "width": "80px", "height": "24px" } })
10948
- ])
10949
- ]),
10950
- default: withCtx(() => {
10951
- var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k;
10952
- return [
10953
- createElementVNode("h2", _hoisted_4$n, [
10954
- createVNode(GLink, {
10955
- href: (_a2 = unref(breadcrumb)[0]) == null ? void 0 : _a2.path,
10956
- class: "header-custom-avatar-link"
10957
- }, {
10958
- default: withCtx(() => {
10959
- var _a3, _b3, _c3, _d2;
10960
- return [
10961
- !((_a3 = _ctx.repoProps) == null ? void 0 : _a3.isGhMirrors) ? (openBlock(), createBlock(_sfc_main$N, {
10962
- key: 0,
10963
- class: normalizeClass({ "g-border": isOrg.value }),
10964
- src: ((_c3 = (_b3 = unref(repoInfo)) == null ? void 0 : _b3.namespace) == null ? void 0 : _c3.avatar_url) || "",
10965
- name: ((_d2 = unref(repoInfo)) == null ? void 0 : _d2.name) || "",
10966
- width: 28,
10967
- height: 28,
10968
- is_round: !isOrg.value
10969
- }, null, 8, ["class", "src", "name", "is_round"])) : (openBlock(), createElementBlock("div", _hoisted_5$i, [
10970
- unref(isPhone)() ? (openBlock(), createElementBlock("img", _hoisted_6$g)) : (openBlock(), createElementBlock("img", _hoisted_7$d))
10971
- ]))
10972
- ];
10973
- }),
10974
- _: 1
10975
- }, 8, ["href"]),
10976
- createElementVNode("div", _hoisted_8$b, [
10977
- !((_b2 = _ctx.repoProps) == null ? void 0 : _b2.isGhMirrors) ? (openBlock(), createElementBlock("div", {
10978
- key: 0,
10979
- ref_key: "breadcrumbRef",
10980
- ref: breadcrumbRef,
10981
- class: "g-repo-layout-breadcrumb"
10982
- }, [
10983
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(breadcrumb), (item, index2) => {
10984
- return openBlock(), createElementBlock(Fragment, {
10985
- key: item.path
10986
- }, [
10987
- index2 !== unref(breadcrumb).length - 1 ? (openBlock(), createElementBlock("span", _hoisted_9$a, [
10988
- createVNode(GLink, {
10989
- class: "linkTx",
10990
- href: item.path
10991
- }, {
10992
- default: withCtx(() => [
10993
- createElementVNode("span", {
10994
- ref_for: true,
10995
- ref_key: "breadcrumbTextRef",
10996
- ref: breadcrumbTextRef,
10997
- title: item.label,
10998
- class: normalizeClass(["linkTx", index2 === unref(breadcrumb).length - 1 ? "header-custom-bold" : ""])
10999
- }, toDisplayString$1(item.label), 11, _hoisted_10$9)
11000
- ]),
11001
- _: 2
11002
- }, 1032, ["href"]),
11003
- _cache[1] || (_cache[1] = createElementVNode("span", { class: "breadcrumb-splitter font-color-t1" }, " / ", -1))
11004
- ])) : createCommentVNode("", true)
11005
- ], 64);
11006
- }), 128))
11007
- ], 512)) : createCommentVNode("", true),
11008
- unref(breadcrumb)[unref(breadcrumb).length - 1] ? (openBlock(), createElementBlock("div", {
11009
- key: 1,
11010
- ref_key: "breadcrumbNextRef",
11011
- ref: breadcrumbNextRef,
11012
- class: normalizeClass(["g-repo-layout-breadcrumb-next", [((_c2 = _ctx.repoProps) == null ? void 0 : _c2.isGhMirrors) ? "g-repo-layout-breadcrumb-next--full" : "g-repo-layout-breadcrumb-next--limit"]])
11013
- }, [
11014
- createVNode(GLink, {
11015
- class: "linkTx",
11016
- href: (_d = unref(breadcrumb)[unref(breadcrumb).length - 1]) == null ? void 0 : _d.path
11017
- }, {
11018
- default: withCtx(() => [
11019
- createElementVNode("span", {
11020
- ref_key: "breadcrumbNextTextRef",
11021
- ref: breadcrumbNextTextRef,
11022
- title: unref(breadcrumb)[unref(breadcrumb).length - 1].label,
11023
- class: "linkTx header-custom-bold"
11024
- }, toDisplayString$1(unref(breadcrumb)[unref(breadcrumb).length - 1].label), 9, _hoisted_11$7)
11025
- ]),
11026
- _: 1
11027
- }, 8, ["href"]),
11028
- unref(isGstarRepo)((_e = unref(repoInfo)) == null ? void 0 : _e.topic_names) ? (openBlock(), createElementBlock("div", _hoisted_12$7, [
11029
- createVNode(_sfc_main$M, {
11030
- origin: "repo",
11031
- icon: "",
11032
- type: "gstar",
11033
- message: `G-Star ${unref(t2)("gitCodeLayout.GStar.project.graduation")}`
11034
- }, {
11035
- default: withCtx(() => _cache[2] || (_cache[2] = [
11036
- createTextVNode("G-Star ")
11037
- ])),
11038
- _: 1
11039
- }, 8, ["message"])
11040
- ])) : unref(isIncubationRepo)((_f = unref(repoInfo)) == null ? void 0 : _f.topic_names) ? (openBlock(), createElementBlock("div", _hoisted_13$4, [
11041
- createVNode(_sfc_main$M, {
11042
- origin: "repo",
11043
- icon: "",
11044
- type: "incubation",
11045
- message: `G-Star ${unref(t2)("gitCodeLayout.GStar.project.incubation")}`
11046
- }, {
11047
- default: withCtx(() => _cache[3] || (_cache[3] = [
11048
- createTextVNode(" G-Star ")
11049
- ])),
11050
- _: 1
11051
- }, 8, ["message"])
11052
- ])) : createCommentVNode("", true),
11053
- unref(isTrustedRepo)((_g = unref(repoInfo)) == null ? void 0 : _g.topic_names) ? (openBlock(), createElementBlock("div", _hoisted_14$2, [
11054
- createVNode(_sfc_main$M, {
11055
- trusted: "",
11056
- message: unref(t2)("gitCodeLayout.trusted.title"),
11057
- icon: "",
11058
- type: "trusted",
11059
- href: "/trusted"
11060
- }, null, 8, ["message"])
11061
- ])) : createCommentVNode("", true),
11062
- ((_h = _ctx.repoProps) == null ? void 0 : _h.isPrivate) ? (openBlock(), createElementBlock("div", _hoisted_15$2, [
11063
- createVNode(GIcon, {
11064
- size: "16px",
11065
- class: "header-custom-lock-icon",
11066
- name: "gt-line-lock"
11067
- })
11068
- ])) : createCommentVNode("", true),
11069
- topicTag.value ? (openBlock(), createElementBlock("div", {
11070
- key: 4,
11071
- class: "topic-tag font-color-t2",
11072
- onClick: toAiHub
11073
- }, [
11074
- createVNode(GIcon, {
11075
- name: (_i = topicTag.value) == null ? void 0 : _i.icon,
11076
- color: "var(--devui-shape-icon-fill)",
11077
- class: "header-custom-topic-icon"
11078
- }, null, 8, ["name"]),
11079
- createElementVNode("span", _hoisted_16$2, toDisplayString$1((_j = topicTag.value) == null ? void 0 : _j.suffix), 1)
11080
- ])) : createCommentVNode("", true),
11081
- ((_k = _ctx.repoProps) == null ? void 0 : _k.isGhMirrors) && showTimeTopic.value && !unref(isPhone)() ? (openBlock(), createElementBlock("div", _hoisted_17$2, [
11082
- createVNode(GIcon, {
11083
- name: "gt-line-time",
11084
- color: "var(--devui-shape-icon-fill)",
11085
- class: "header-custom-topic-icon"
11086
- }),
11087
- createElementVNode("span", _hoisted_18$2, toDisplayString$1(formatTime.value) + toDisplayString$1(unref(t2)("gitCodeLayout.repo.code.syncText")), 1)
11088
- ])) : createCommentVNode("", true)
11089
- ], 2)) : createCommentVNode("", true)
11090
- ])
11091
- ])
11092
- ];
11093
- }),
11094
- _: 1
11095
- }, 8, ["loading"])) : _ctx.scene === unref(SceneValue).user && ((_c = _ctx.userProps) == null ? void 0 : _c.isOtherUser) ? (openBlock(), createElementBlock("div", _hoisted_20$2, [
11096
- createVNode(GLink, {
11097
- to: { name: "homepage" },
11098
- class: "header-custom-link"
11099
- }, {
11100
- default: withCtx(() => {
11101
- var _a2, _b2, _c2, _d, _e;
11102
- return [
11103
- createVNode(_sfc_main$N, {
11104
- src: (_a2 = unref(otherUserInfo)) == null ? void 0 : _a2.avatarUrl,
11105
- name: ((_b2 = unref(otherUserInfo)) == null ? void 0 : _b2.name) || ((_c2 = unref(otherUserInfo)) == null ? void 0 : _c2.nickname),
11106
- width: 28,
11107
- height: 28
11108
- }, null, 8, ["src", "name"]),
11109
- createElementVNode("div", _hoisted_21$2, toDisplayString$1(((_d = unref(otherUserInfo)) == null ? void 0 : _d.name) || ((_e = unref(otherUserInfo)) == null ? void 0 : _e.nickname)), 1)
11110
- ];
11111
- }),
11112
- _: 1
11113
- }),
11114
- createVNode(unref(Button), {
11115
- onClick: handleFollowUser,
11116
- class: "user-layout-toolbar-follow"
11117
- }, {
11118
- default: withCtx(() => {
11119
- var _a2;
11120
- return [
11121
- createElementVNode("span", _hoisted_22$2, toDisplayString$1(((_a2 = unref(otherUserInfo)) == null ? void 0 : _a2.isFollow) ? unref(t2)("gitCodeLayout.org.following") : unref(t2)("gitCodeLayout.common.topic.attention")), 1)
11122
- ];
11123
- }),
11124
- _: 1
11125
- })
11126
- ])) : createCommentVNode("", true);
11127
- };
11128
- }
11129
- });
11130
- const HeaderCustom = /* @__PURE__ */ _export_sfc(_sfc_main$L, [["__scopeId", "data-v-vue-layout-gitcode"]]);
11131
- const _hoisted_1$E = ["src"];
11132
- const _sfc_main$K = /* @__PURE__ */ defineComponent({
11133
- ...{ name: "OperationEntry" },
11134
- __name: "OperationEntry",
11135
- setup(__props) {
11136
- const request = inject("request");
11137
- const API = asideRequest(request);
11138
- const headerEntryConfig = ref({
11139
- img_light: "",
11140
- img_dark: "",
11141
- url: ""
11142
- });
11143
- const handleClick = () => {
11144
- var _a;
11145
- window.open(`${transformUrl((_a = headerEntryConfig.value) == null ? void 0 : _a.url)}`, "_blank");
11146
- };
11147
- const img = computed(() => {
11148
- const { img_light, img_dark } = headerEntryConfig.value;
11149
- return (currentTheme.value === ThemeType.BLACK ? img_dark : img_light) || img_light;
11150
- });
11151
- const getHeaderEntryConfig = async () => {
11152
- var _a;
11153
- try {
11154
- const res = await API.getHeaderEntryConfig();
11155
- const data = ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.data) || {};
11156
- headerEntryConfig.value = {
11157
- img_light: data.img_light,
11158
- img_dark: data.img_dark,
11159
- url: data.url
11160
- };
11161
- } catch (error) {
11162
- console.error(error);
11163
- }
11164
- };
11165
- getHeaderEntryConfig();
11166
- return (_ctx, _cache) => {
11167
- return img.value && headerEntryConfig.value.url ? (openBlock(), createElementBlock("div", {
11168
- key: 0,
11169
- class: "operation-entry",
11170
- onClick: handleClick
11171
- }, [
11172
- createElementVNode("img", {
11173
- class: "operation-entry__img",
11174
- src: img.value,
11175
- alt: "operation-entry"
11176
- }, null, 8, _hoisted_1$E)
11177
- ])) : createCommentVNode("", true);
11178
- };
11179
- }
11180
- });
11181
- const OperationEntry = /* @__PURE__ */ _export_sfc(_sfc_main$K, [["__scopeId", "data-v-vue-layout-gitcode"]]);
11182
- const _hoisted_1$D = ["src"];
11183
- const _sfc_main$J = /* @__PURE__ */ defineComponent({
11184
- __name: "ClaimPower",
11185
- props: {
11186
- config: {}
11187
- },
11188
- setup(__props) {
11189
- const props = __props;
11190
- const visible = computed(() => {
11191
- return props.config.visible;
11192
- });
11193
- const handleClick = () => {
11194
- console.log("handleClick");
11195
- window.open(props.config.jump_url, "_blank");
11196
- };
11197
- return (_ctx, _cache) => {
11198
- return visible.value ? (openBlock(), createElementBlock("div", {
11199
- key: 0,
11200
- class: "computing-power",
11201
- onClick: handleClick
11202
- }, [
11203
- createElementVNode("img", {
11204
- src: _ctx.config.logo_url,
11205
- alt: "claim power"
11206
- }, null, 8, _hoisted_1$D)
11207
- ])) : createCommentVNode("", true);
11208
- };
11209
- }
11210
- });
11211
- const ClaimPower = /* @__PURE__ */ _export_sfc(_sfc_main$J, [["__scopeId", "data-v-vue-layout-gitcode"]]);
11212
- const DEFAULT_APPLICATION_HOST = "https://gitcode.com";
11213
- function normalizeApplicationHost(host) {
11214
- return (host || DEFAULT_APPLICATION_HOST).replace(/\/+$/, "");
11215
- }
11216
- function getRoutePart(href, baseUrl) {
11217
- try {
11218
- const url = new URL(href || "/", `${baseUrl}/`);
11219
- return `${url.pathname || "/"}${url.search}${url.hash}`;
11220
- } catch {
11221
- const value = href.trim();
11222
- return value.startsWith("/") ? value : `/${value}`;
11223
- }
11224
- }
11225
- function toApplicationUrl(applicationHost, href) {
11226
- const host = normalizeApplicationHost(applicationHost);
11227
- return `${host}${getRoutePart(href, host)}`;
11228
- }
11229
- function toApplicationRoute(applicationHost, href) {
11230
- try {
11231
- const url = new URL(toApplicationUrl(applicationHost, href));
11232
- return `${url.pathname || "/"}${url.search}${url.hash}`;
11233
- } catch {
11234
- return null;
11235
- }
11236
- }
11237
- const HEADER_CREATE_MENU_PATHS = [
11238
- "/create?position=nav_top",
11239
- "/create/migrate?type=3",
11240
- "/models/create",
11241
- "/datasets/create",
11242
- "/space/create",
11243
- "/collections/create",
11244
- "/org/create"
11245
- ];
11246
- const HEADER_CREATE_ENTERPRISE_PATH = "/enterprises/new";
11247
- const _hoisted_1$C = { class: "g-header-create dashboard-create-menu" };
11248
- const _hoisted_2$u = ["title", "aria-label", "aria-expanded"];
11249
- const _hoisted_3$t = { class: "dashboard-create-menu__trigger-text" };
11250
- const _hoisted_4$m = ["aria-label"];
11251
- const _hoisted_5$h = {
11252
- key: 0,
11253
- class: "dashboard-create-menu__divider",
11254
- role: "separator"
11255
- };
11256
- const _hoisted_6$f = ["href", "onClick", "onKeydown"];
11257
- const _hoisted_7$c = { class: "dashboard-create-menu__title-row" };
11258
- const _hoisted_8$a = { class: "dashboard-create-menu__title" };
11259
- const _hoisted_9$9 = {
11260
- key: 0,
11261
- class: "dashboard-create-menu__desc"
11262
- };
11263
- const menuId = "gitcode-header-create-menu";
11264
- const _sfc_main$I = /* @__PURE__ */ defineComponent({
11265
- ...{
11266
- name: "HeaderCreateMenu"
11267
- },
11268
- __name: "index",
11269
- props: {
11270
- dropdownVisible: { type: Boolean, default: false },
11271
- isCreateOrg: { type: Boolean, default: true },
11272
- items: { default: void 0 },
11273
- onNavigate: { type: Function, default: void 0 }
11274
- },
11275
- emits: ["update:dropdownVisible", "navigate"],
11276
- setup(__props, { emit: __emit }) {
11277
- const props = __props;
11278
- const emit = __emit;
11279
- const { t: t2 } = i18n.global;
11280
- const layoutConfig2 = useLayoutConfig();
11281
- const route = useRoute();
11282
- const router2 = useRouter();
11283
- const triggerRef = ref(null);
11284
- const menuRef = ref(null);
11285
- const menuOpen = ref(false);
11286
- const defaultMenuItems = computed(() => {
11287
- const [repoPath, importPath, modelPath, datasetPath, spacePath, collectionPath, orgPath] = HEADER_CREATE_MENU_PATHS;
11288
- return [
11289
- {
11290
- key: "repo",
11291
- icon: "gt-a-Property1default",
11292
- label: t2("gitCodeLayout.header.createMenuRepository"),
11293
- href: toApplicationUrl(layoutConfig2.VITE_HOST, repoPath)
11294
- },
11295
- {
11296
- key: "import-repository",
11297
- icon: "gt-a-plane-fileinport",
11298
- label: t2("gitCodeLayout.header.createMenuImportRepository"),
11299
- href: toApplicationUrl(layoutConfig2.VITE_HOST, importPath)
11300
- },
11301
- {
11302
- key: "model",
11303
- icon: "gt-plane-Models",
11304
- label: t2("gitCodeLayout.header.createMenuModel"),
11305
- href: toApplicationUrl(layoutConfig2.VITE_HOST, modelPath)
11306
- },
11307
- {
11308
- key: "dataset",
11309
- icon: "gt-plane-Datasets",
11310
- label: t2("gitCodeLayout.header.createMenuDataset"),
11311
- href: toApplicationUrl(layoutConfig2.VITE_HOST, datasetPath)
11312
- },
11313
- {
11314
- key: "space",
11315
- icon: "gt-plane-Space",
11316
- label: t2("gitCodeLayout.header.createMenuSpace"),
11317
- href: toApplicationUrl(layoutConfig2.VITE_HOST, spacePath)
11318
- },
11319
- {
11320
- key: "collection",
11321
- icon: "gt-a-dashujuyufenxishuxing1guan",
11322
- label: t2("gitCodeLayout.header.createMenuCollection"),
11323
- href: toApplicationUrl(layoutConfig2.VITE_HOST, collectionPath)
11324
- },
11325
- {
11326
- key: "organization",
11327
- icon: "gt-plane-organization",
11328
- label: t2("gitCodeLayout.header.createMenuOrganization"),
11329
- href: toApplicationUrl(layoutConfig2.VITE_HOST, orgPath),
11330
- dividerBefore: true
11331
- }
11332
- ];
11333
- });
11334
- const enterpriseMenuItem = {
11335
- key: "enterprise",
11336
- icon: "gt-a-plane-enterprise",
11337
- label: t2("gitCodeLayout.header.createMenuEnterprise"),
11338
- href: toApplicationUrl(layoutConfig2.VITE_HOST, HEADER_CREATE_ENTERPRISE_PATH),
11339
- useHref: true
11340
- };
11341
- const menuItems = computed(() => {
11342
- const baseItems = props.items || defaultMenuItems.value;
11343
- const items = props.isCreateOrg ? baseItems : baseItems.filter((item) => item.key !== "organization");
11344
- return [...items, enterpriseMenuItem];
11345
- });
11346
- function getMenuItems() {
11347
- var _a;
11348
- return Array.from(((_a = menuRef.value) == null ? void 0 : _a.querySelectorAll('[role="menuitem"]')) || []);
11349
- }
11350
- function focusMenuItem(index2) {
11351
- void nextTick(() => {
11352
- var _a;
11353
- const items = getMenuItems();
11354
- if (!items.length) return;
11355
- const safeIndex = Math.min(Math.max(index2, 0), items.length - 1);
11356
- (_a = items[safeIndex]) == null ? void 0 : _a.focus();
11357
- });
11358
- }
11359
- function closeMenu(restoreFocus = false) {
11360
- if (!menuOpen.value) return;
11361
- menuOpen.value = false;
11362
- emit("update:dropdownVisible", false);
11363
- if (restoreFocus) {
11364
- void nextTick(() => {
11365
- var _a;
11366
- return (_a = triggerRef.value) == null ? void 0 : _a.focus();
11367
- });
11368
- }
11369
- }
11370
- const handleToggle = (value) => {
11371
- if (menuOpen.value === value) return;
11372
- menuOpen.value = value;
11373
- emit("update:dropdownVisible", value);
11374
- };
11375
- function onTriggerKeydown(event) {
11376
- if (event.key === "ArrowDown") {
11377
- event.preventDefault();
11378
- menuOpen.value = true;
11379
- emit("update:dropdownVisible", true);
11380
- focusMenuItem(0);
11381
- } else if (event.key === "ArrowUp") {
11382
- event.preventDefault();
11383
- menuOpen.value = true;
11384
- emit("update:dropdownVisible", true);
11385
- focusMenuItem(menuItems.value.length - 1);
11386
- } else if (event.key === "Escape") {
11387
- event.preventDefault();
11388
- closeMenu(true);
11389
- }
11390
- }
11391
- function onMenuItemKeydown(event, index2) {
11392
- if (event.key === "ArrowDown") {
11393
- event.preventDefault();
11394
- focusMenuItem((index2 + 1) % menuItems.value.length);
11395
- } else if (event.key === "ArrowUp") {
11396
- event.preventDefault();
11397
- focusMenuItem((index2 - 1 + menuItems.value.length) % menuItems.value.length);
11398
- } else if (event.key === "Home") {
11399
- event.preventDefault();
11400
- focusMenuItem(0);
11401
- } else if (event.key === "End") {
11402
- event.preventDefault();
11403
- focusMenuItem(menuItems.value.length - 1);
11404
- } else if (event.key === "Escape") {
11405
- event.preventDefault();
11406
- closeMenu(true);
11407
- } else if (event.key === " ") {
11408
- event.preventDefault();
11409
- if (event.currentTarget instanceof HTMLElement) event.currentTarget.click();
11410
- }
11411
- }
11412
- function stripRouterBase(route2) {
11413
- const base = router2.options.history.base;
11414
- if (!base || base === "/") return route2;
11415
- if (route2 === base) return "/";
11416
- return route2.startsWith(`${base}/`) ? route2.slice(base.length) : route2;
11417
- }
11418
- function navigateTo(href) {
11419
- const applicationHref = toApplicationUrl(layoutConfig2.VITE_HOST, href);
11420
- const applicationRoute = toApplicationRoute(layoutConfig2.VITE_HOST, href);
11421
- if (!applicationRoute) return;
11422
- if (typeof window !== "undefined") {
11423
- const applicationUrl = new URL(applicationHref);
11424
- if (applicationUrl.origin !== window.location.origin) {
11425
- window.location.href = applicationHref;
11426
- return;
11427
- }
11428
- } else {
11429
- void router2.push(stripRouterBase(applicationRoute));
11430
- return;
11431
- }
11432
- void router2.push(stripRouterBase(applicationRoute));
11433
- }
11434
- async function selectCreateItem(item) {
11435
- closeMenu();
11436
- emit("navigate", item);
11437
- if (item.useHref) {
11438
- if (typeof window !== "undefined") {
11439
- window.location.href = toApplicationUrl(layoutConfig2.VITE_HOST, item.href);
11440
- }
11441
- return;
11442
- }
11443
- if (props.onNavigate) {
11444
- await props.onNavigate(item);
11445
- return;
11446
- }
11447
- navigateTo(item.href);
11448
- }
11449
- watch(
11450
- () => props.dropdownVisible,
11451
- (visible) => {
11452
- menuOpen.value = visible;
11453
- },
11454
- { immediate: true }
11455
- );
11456
- watch(
11457
- () => route == null ? void 0 : route.fullPath,
11458
- () => closeMenu()
11459
- );
11460
- return (_ctx, _cache) => {
11461
- return openBlock(), createElementBlock("div", _hoisted_1$C, [
11462
- createVNode(unref(Dropdown), {
11463
- position: ["bottom-end", "bottom-start"],
11464
- "destroy-on-hide": false,
11465
- trigger: "hover",
11466
- offset: { mainAxis: 4, crossAxis: 0 },
11467
- onClick: _cache[0] || (_cache[0] = withModifiers(() => {
11468
- }, ["stop"])),
11469
- "overlay-class": "dashboard-create-dropdown",
11470
- visible: menuOpen.value,
11471
- onToggle: handleToggle
11472
- }, {
11473
- menu: withCtx(() => [
11474
- createElementVNode("div", {
11475
- id: menuId,
11476
- ref_key: "menuRef",
11477
- ref: menuRef,
11478
- class: "dashboard-create-menu__panel",
11479
- role: "menu",
11480
- "aria-label": unref(t2)("gitCodeLayout.header.create")
11481
- }, [
11482
- (openBlock(true), createElementBlock(Fragment, null, renderList(menuItems.value, (item, index2) => {
11483
- return openBlock(), createElementBlock(Fragment, {
11484
- key: item.key
11485
- }, [
11486
- item.dividerBefore ? (openBlock(), createElementBlock("div", _hoisted_5$h)) : createCommentVNode("", true),
11487
- createElementVNode("a", {
11488
- href: unref(toApplicationUrl)(unref(layoutConfig2).VITE_HOST, item.href),
11489
- class: normalizeClass(["dashboard-create-menu__item", { "dashboard-create-menu__item--with-desc": Boolean(item.desc) }]),
11490
- role: "menuitem",
11491
- tabindex: "-1",
11492
- onClick: withModifiers(($event) => selectCreateItem(item), ["prevent"]),
11493
- onKeydown: ($event) => onMenuItemKeydown($event, index2)
11494
- }, [
11495
- createElementVNode("div", _hoisted_7$c, [
11496
- createVNode(GIcon, {
11497
- name: item.icon,
11498
- size: "16px",
11499
- color: "currentColor",
11500
- class: "dashboard-create-menu__icon",
11501
- "aria-hidden": "true"
11502
- }, null, 8, ["name"]),
11503
- createElementVNode("span", _hoisted_8$a, toDisplayString$1(item.label), 1)
11504
- ]),
11505
- item.desc ? (openBlock(), createElementBlock("div", _hoisted_9$9, toDisplayString$1(item.desc), 1)) : createCommentVNode("", true)
11506
- ], 42, _hoisted_6$f)
11507
- ], 64);
11508
- }), 128))
11509
- ], 8, _hoisted_4$m)
11510
- ]),
11511
- default: withCtx(() => [
11512
- createElementVNode("button", {
11513
- id: "guide-step3",
11514
- ref_key: "triggerRef",
11515
- ref: triggerRef,
11516
- type: "button",
11517
- class: "dashboard-create-menu__trigger dashboard-create-menu__trigger--header",
11518
- title: unref(t2)("gitCodeLayout.header.create"),
11519
- "aria-label": unref(t2)("gitCodeLayout.header.create"),
11520
- "aria-expanded": menuOpen.value,
11521
- "aria-controls": menuId,
11522
- "aria-haspopup": "menu",
11523
- onKeydown: onTriggerKeydown
11524
- }, [
11525
- createVNode(GIcon, {
11526
- name: "gt-add",
11527
- size: "16px",
11528
- color: "var(--theme-light-text)",
11529
- class: "dashboard-create-menu__trigger-icon",
11530
- "aria-hidden": "true"
11531
- }),
11532
- createElementVNode("span", _hoisted_3$t, toDisplayString$1(unref(t2)("gitCodeLayout.header.create")), 1)
11533
- ], 40, _hoisted_2$u)
11534
- ]),
11535
- _: 1
11536
- }, 8, ["visible"])
11537
- ]);
11538
- };
11539
- }
11540
- });
11541
- const HeaderCreateMenu = /* @__PURE__ */ _export_sfc(_sfc_main$I, [["__scopeId", "data-v-vue-layout-gitcode"]]);
11542
- const _sfc_main$H = /* @__PURE__ */ defineComponent({
11543
- ...{
11544
- name: "DocumentCenter"
11545
- },
11546
- __name: "DocumentCenter",
11547
- props: {
11548
- whiteColor: { type: Boolean, default: false }
11549
- },
11550
- setup(__props) {
11551
- const { t: t2 } = i18n.global;
11552
- return (_ctx, _cache) => {
11553
- return openBlock(), createBlock(GLink, {
11554
- variant: "text",
11555
- class: normalizeClass(["g-toolbar-docs", _ctx.whiteColor ? "white" : "black"]),
11556
- href: unref(currentHelpDocsAiCommunityUrl)(),
11557
- target: "_blank"
11558
- }, {
11559
- default: withCtx(() => [
11560
- createTextVNode(toDisplayString$1(unref(t2)("gitCodeLayout.header.aihub.documentCenter")), 1)
11561
- ]),
11562
- _: 1
11563
- }, 8, ["class", "href"]);
11564
- };
11565
- }
11566
- });
11567
- const DocumentCenter = /* @__PURE__ */ _export_sfc(_sfc_main$H, [["__scopeId", "data-v-vue-layout-gitcode"]]);
11568
- var aes = { exports: {} };
11569
- function commonjsRequire(path) {
11570
- throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
11571
- }
11572
- var core = { exports: {} };
11573
- const __viteBrowserExternal = {};
11574
- const __viteBrowserExternal$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
11575
- __proto__: null,
11576
- default: __viteBrowserExternal
11577
- }, Symbol.toStringTag, { value: "Module" }));
11578
- const require$$0 = /* @__PURE__ */ getAugmentedNamespace(__viteBrowserExternal$1);
11579
- var hasRequiredCore;
11580
- function requireCore() {
11581
- if (hasRequiredCore) return core.exports;
11582
- hasRequiredCore = 1;
11583
- (function(module, exports) {
11584
- (function(root, factory) {
11585
- {
11586
- module.exports = factory();
11587
- }
11588
- })(commonjsGlobal, function() {
11589
- var CryptoJS = CryptoJS || function(Math2, undefined$1) {
11590
- var crypto;
11591
- if (typeof window !== "undefined" && window.crypto) {
11592
- crypto = window.crypto;
11593
- }
11594
- if (typeof self !== "undefined" && self.crypto) {
11595
- crypto = self.crypto;
11596
- }
11597
- if (typeof globalThis !== "undefined" && globalThis.crypto) {
11598
- crypto = globalThis.crypto;
11599
- }
11600
- if (!crypto && typeof window !== "undefined" && window.msCrypto) {
11601
- crypto = window.msCrypto;
11602
- }
11603
- if (!crypto && typeof commonjsGlobal !== "undefined" && commonjsGlobal.crypto) {
11604
- crypto = commonjsGlobal.crypto;
11605
- }
11606
- if (!crypto && typeof commonjsRequire === "function") {
11607
- try {
11608
- crypto = require$$0;
11609
- } catch (err) {
11610
- }
11611
- }
11612
- var cryptoSecureRandomInt = function() {
11613
- if (crypto) {
11614
- if (typeof crypto.getRandomValues === "function") {
11615
- try {
11616
- return crypto.getRandomValues(new Uint32Array(1))[0];
11617
- } catch (err) {
11618
- }
11619
- }
11620
- if (typeof crypto.randomBytes === "function") {
11621
- try {
11622
- return crypto.randomBytes(4).readInt32LE();
11623
- } catch (err) {
11624
- }
11625
- }
11626
- }
11627
- throw new Error("Native crypto module could not be used to get secure random number.");
10490
+ if (!crypto && typeof commonjsGlobal !== "undefined" && commonjsGlobal.crypto) {
10491
+ crypto = commonjsGlobal.crypto;
10492
+ }
10493
+ if (!crypto && typeof commonjsRequire === "function") {
10494
+ try {
10495
+ crypto = require$$0;
10496
+ } catch (err) {
10497
+ }
10498
+ }
10499
+ var cryptoSecureRandomInt = function() {
10500
+ if (crypto) {
10501
+ if (typeof crypto.getRandomValues === "function") {
10502
+ try {
10503
+ return crypto.getRandomValues(new Uint32Array(1))[0];
10504
+ } catch (err) {
10505
+ }
10506
+ }
10507
+ if (typeof crypto.randomBytes === "function") {
10508
+ try {
10509
+ return crypto.randomBytes(4).readInt32LE();
10510
+ } catch (err) {
10511
+ }
10512
+ }
10513
+ }
10514
+ throw new Error("Native crypto module could not be used to get secure random number.");
11628
10515
  };
11629
10516
  var create2 = Object.create || /* @__PURE__ */ function() {
11630
10517
  function F() {
@@ -13998,32 +12885,1225 @@ function headRequest(request) {
13998
12885
  "X-Source": getLoginTriggerSource()
13999
12886
  }
14000
12887
  })
14001
- );
14002
- },
14003
- getProjectIssuePrInfo() {
14004
- return reqCatchV2(
14005
- () => request({
14006
- url: "/api/v2/projects/profile/project_issue_pr_info",
14007
- method: "get"
12888
+ );
12889
+ },
12890
+ getProjectIssuePrInfo() {
12891
+ return reqCatchV2(
12892
+ () => request({
12893
+ url: "/api/v2/projects/profile/project_issue_pr_info",
12894
+ method: "get"
12895
+ })
12896
+ );
12897
+ },
12898
+ // 获取主题菜单
12899
+ getThemeConfigList() {
12900
+ return reqCatch(() => request({
12901
+ url: `/aihub/api/v1/theme/label/config/list`,
12902
+ method: "get"
12903
+ }));
12904
+ },
12905
+ // 获取今日技术历史
12906
+ getTodayTechHistory() {
12907
+ return reqCatch(() => request({
12908
+ url: `/uc/api/v1/operation/tech-history`,
12909
+ method: "get"
12910
+ }));
12911
+ },
12912
+ // 查询是否是组织归属企业的企业成员
12913
+ getMemberByEnterprise(params) {
12914
+ return reqCatch(() => request({
12915
+ url: `/api/v2/ac/auth/enterprises/${params.enterpriseId}`,
12916
+ method: "get"
12917
+ }, {
12918
+ customError: true
12919
+ }));
12920
+ }
12921
+ };
12922
+ }
12923
+ const FIRST_NAMESPACE_KEY = "parent_org_path";
12924
+ const useBreadcrumb = () => {
12925
+ const router2 = useRouter();
12926
+ if (!router2) {
12927
+ return computed(() => []);
12928
+ }
12929
+ const repoInfo = inject(
12930
+ "repoInfo",
12931
+ computed(() => ({}))
12932
+ );
12933
+ const breadcrumb = computed(() => {
12934
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
12935
+ const isSubOrg = !!((_b = (_a = router2 == null ? void 0 : router2.currentRoute) == null ? void 0 : _a.value) == null ? void 0 : _b.params[FIRST_NAMESPACE_KEY]);
12936
+ const full_name = ((_d = (_c = repoInfo.value) == null ? void 0 : _c.namespace) == null ? void 0 : _d.full_name) || "";
12937
+ const name = ((_f = (_e = repoInfo.value) == null ? void 0 : _e.namespace) == null ? void 0 : _f.name) || "";
12938
+ const orgName = isSubOrg ? full_name : name;
12939
+ const repoName = ((_g = repoInfo.value) == null ? void 0 : _g.name) || "";
12940
+ const breadcrumbList = [
12941
+ {
12942
+ label: orgName,
12943
+ path: ""
12944
+ },
12945
+ {
12946
+ label: repoName,
12947
+ path: ""
12948
+ }
12949
+ ];
12950
+ const params = cloneDeep((_i = (_h = router2.currentRoute) == null ? void 0 : _h.value) == null ? void 0 : _i.params);
12951
+ if (isSubOrg) {
12952
+ params.namespace = params[FIRST_NAMESPACE_KEY];
12953
+ delete params[FIRST_NAMESPACE_KEY];
12954
+ }
12955
+ breadcrumbList[0].path = router2.resolve({
12956
+ name: "homepage",
12957
+ params
12958
+ }).path;
12959
+ breadcrumbList[breadcrumbList.length - 1].path = router2.resolve({
12960
+ name: "repoDashboard",
12961
+ params: {
12962
+ ...(_k = (_j = router2.currentRoute) == null ? void 0 : _j.value) == null ? void 0 : _k.params
12963
+ }
12964
+ }).path;
12965
+ return breadcrumbList;
12966
+ });
12967
+ return breadcrumb;
12968
+ };
12969
+ var relativeTime$1 = { exports: {} };
12970
+ (function(module, exports) {
12971
+ !function(r, e) {
12972
+ module.exports = e();
12973
+ }(commonjsGlobal, function() {
12974
+ return function(r, e, t2) {
12975
+ r = r || {};
12976
+ var n = e.prototype, o = { future: "in %s", past: "%s ago", s: "a few seconds", m: "a minute", mm: "%d minutes", h: "an hour", hh: "%d hours", d: "a day", dd: "%d days", M: "a month", MM: "%d months", y: "a year", yy: "%d years" };
12977
+ function i(r2, e2, t3, o2) {
12978
+ return n.fromToBase(r2, e2, t3, o2);
12979
+ }
12980
+ t2.en.relativeTime = o, n.fromToBase = function(e2, n2, i2, d2, u) {
12981
+ for (var f, a, s, l = i2.$locale().relativeTime || o, h2 = r.thresholds || [{ l: "s", r: 44, d: "second" }, { l: "m", r: 89 }, { l: "mm", r: 44, d: "minute" }, { l: "h", r: 89 }, { l: "hh", r: 21, d: "hour" }, { l: "d", r: 35 }, { l: "dd", r: 25, d: "day" }, { l: "M", r: 45 }, { l: "MM", r: 10, d: "month" }, { l: "y", r: 17 }, { l: "yy", d: "year" }], m = h2.length, c = 0; c < m; c += 1) {
12982
+ var y = h2[c];
12983
+ y.d && (f = d2 ? t2(e2).diff(i2, y.d, true) : i2.diff(e2, y.d, true));
12984
+ var p = (r.rounding || Math.round)(Math.abs(f));
12985
+ if (s = f > 0, p <= y.r || !y.r) {
12986
+ p <= 1 && c > 0 && (y = h2[c - 1]);
12987
+ var v = l[y.l];
12988
+ u && (p = u("" + p)), a = "string" == typeof v ? v.replace("%d", p) : v(p, n2, y.l, s);
12989
+ break;
12990
+ }
12991
+ }
12992
+ if (n2) return a;
12993
+ var M = s ? l.future : l.past;
12994
+ return "function" == typeof M ? M(a) : M.replace("%s", a);
12995
+ }, n.to = function(r2, e2) {
12996
+ return i(r2, e2, this, true);
12997
+ }, n.from = function(r2, e2) {
12998
+ return i(r2, e2, this);
12999
+ };
13000
+ var d = function(r2) {
13001
+ return r2.$u ? t2.utc() : t2();
13002
+ };
13003
+ n.toNow = function(r2) {
13004
+ return this.to(d(this), r2);
13005
+ }, n.fromNow = function(r2) {
13006
+ return this.from(d(this), r2);
13007
+ };
13008
+ };
13009
+ });
13010
+ })(relativeTime$1);
13011
+ var relativeTimeExports = relativeTime$1.exports;
13012
+ const relativeTime = /* @__PURE__ */ getDefaultExportFromCjs(relativeTimeExports);
13013
+ var zhCn = { exports: {} };
13014
+ (function(module, exports) {
13015
+ !function(e, _) {
13016
+ module.exports = _(dayjs);
13017
+ }(commonjsGlobal, function(e) {
13018
+ function _(e2) {
13019
+ return e2 && "object" == typeof e2 && "default" in e2 ? e2 : { default: e2 };
13020
+ }
13021
+ var t2 = _(e), d = { name: "zh-cn", weekdays: "星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"), weekdaysShort: "周日_周一_周二_周三_周四_周五_周六".split("_"), weekdaysMin: "日_一_二_三_四_五_六".split("_"), months: "一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"), monthsShort: "1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"), ordinal: function(e2, _2) {
13022
+ return "W" === _2 ? e2 + "周" : e2 + "日";
13023
+ }, weekStart: 1, yearStart: 4, formats: { LT: "HH:mm", LTS: "HH:mm:ss", L: "YYYY/MM/DD", LL: "YYYY年M月D日", LLL: "YYYY年M月D日Ah点mm分", LLLL: "YYYY年M月D日ddddAh点mm分", l: "YYYY/M/D", ll: "YYYY年M月D日", lll: "YYYY年M月D日 HH:mm", llll: "YYYY年M月D日dddd HH:mm" }, relativeTime: { future: "%s内", past: "%s前", s: "几秒", m: "1 分钟", mm: "%d 分钟", h: "1 小时", hh: "%d 小时", d: "1 天", dd: "%d 天", M: "1 个月", MM: "%d 个月", y: "1 年", yy: "%d 年" }, meridiem: function(e2, _2) {
13024
+ var t3 = 100 * e2 + _2;
13025
+ return t3 < 600 ? "凌晨" : t3 < 900 ? "早上" : t3 < 1100 ? "上午" : t3 < 1300 ? "中午" : t3 < 1800 ? "下午" : "晚上";
13026
+ } };
13027
+ return t2.default.locale(d, null, true), d;
13028
+ });
13029
+ })(zhCn);
13030
+ var zhCnExports = zhCn.exports;
13031
+ const locale = /* @__PURE__ */ getDefaultExportFromCjs(zhCnExports);
13032
+ var timezone = { exports: {} };
13033
+ (function(module, exports) {
13034
+ !function(t2, e) {
13035
+ module.exports = e();
13036
+ }(commonjsGlobal, function() {
13037
+ var t2 = { year: 0, month: 1, day: 2, hour: 3, minute: 4, second: 5 }, e = {};
13038
+ return function(n, i, o) {
13039
+ var r, a = function(t3, n2, i2) {
13040
+ void 0 === i2 && (i2 = {});
13041
+ var o2 = new Date(t3), r2 = function(t4, n3) {
13042
+ void 0 === n3 && (n3 = {});
13043
+ var i3 = n3.timeZoneName || "short", o3 = t4 + "|" + i3, r3 = e[o3];
13044
+ return r3 || (r3 = new Intl.DateTimeFormat("en-US", { hour12: false, timeZone: t4, year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit", timeZoneName: i3 }), e[o3] = r3), r3;
13045
+ }(n2, i2);
13046
+ return r2.formatToParts(o2);
13047
+ }, u = function(e2, n2) {
13048
+ for (var i2 = a(e2, n2), r2 = [], u2 = 0; u2 < i2.length; u2 += 1) {
13049
+ var f2 = i2[u2], s2 = f2.type, m = f2.value, c = t2[s2];
13050
+ c >= 0 && (r2[c] = parseInt(m, 10));
13051
+ }
13052
+ var d = r2[3], l = 24 === d ? 0 : d, h2 = r2[0] + "-" + r2[1] + "-" + r2[2] + " " + l + ":" + r2[4] + ":" + r2[5] + ":000", v = +e2;
13053
+ return (o.utc(h2).valueOf() - (v -= v % 1e3)) / 6e4;
13054
+ }, f = i.prototype;
13055
+ f.tz = function(t3, e2) {
13056
+ void 0 === t3 && (t3 = r);
13057
+ var n2, i2 = this.utcOffset(), a2 = this.toDate(), u2 = a2.toLocaleString("en-US", { timeZone: t3 }), f2 = Math.round((a2 - new Date(u2)) / 1e3 / 60), s2 = 15 * -Math.round(a2.getTimezoneOffset() / 15) - f2;
13058
+ if (!Number(s2)) n2 = this.utcOffset(0, e2);
13059
+ else if (n2 = o(u2, { locale: this.$L }).$set("millisecond", this.$ms).utcOffset(s2, true), e2) {
13060
+ var m = n2.utcOffset();
13061
+ n2 = n2.add(i2 - m, "minute");
13062
+ }
13063
+ return n2.$x.$timezone = t3, n2;
13064
+ }, f.offsetName = function(t3) {
13065
+ var e2 = this.$x.$timezone || o.tz.guess(), n2 = a(this.valueOf(), e2, { timeZoneName: t3 }).find(function(t4) {
13066
+ return "timezonename" === t4.type.toLowerCase();
13067
+ });
13068
+ return n2 && n2.value;
13069
+ };
13070
+ var s = f.startOf;
13071
+ f.startOf = function(t3, e2) {
13072
+ if (!this.$x || !this.$x.$timezone) return s.call(this, t3, e2);
13073
+ var n2 = o(this.format("YYYY-MM-DD HH:mm:ss:SSS"), { locale: this.$L });
13074
+ return s.call(n2, t3, e2).tz(this.$x.$timezone, true);
13075
+ }, o.tz = function(t3, e2, n2) {
13076
+ var i2 = n2 && e2, a2 = n2 || e2 || r, f2 = u(+o(), a2);
13077
+ if ("string" != typeof t3) return o(t3).tz(a2);
13078
+ var s2 = function(t4, e3, n3) {
13079
+ var i3 = t4 - 60 * e3 * 1e3, o2 = u(i3, n3);
13080
+ if (e3 === o2) return [i3, e3];
13081
+ var r2 = u(i3 -= 60 * (o2 - e3) * 1e3, n3);
13082
+ return o2 === r2 ? [i3, o2] : [t4 - 60 * Math.min(o2, r2) * 1e3, Math.max(o2, r2)];
13083
+ }(o.utc(t3, i2).valueOf(), f2, a2), m = s2[0], c = s2[1], d = o(m).utcOffset(c);
13084
+ return d.$x.$timezone = a2, d;
13085
+ }, o.tz.guess = function() {
13086
+ return Intl.DateTimeFormat().resolvedOptions().timeZone;
13087
+ }, o.tz.setDefault = function(t3) {
13088
+ r = t3;
13089
+ };
13090
+ };
13091
+ });
13092
+ })(timezone);
13093
+ var timezoneExports = timezone.exports;
13094
+ const tz = /* @__PURE__ */ getDefaultExportFromCjs(timezoneExports);
13095
+ var utc$1 = { exports: {} };
13096
+ (function(module, exports) {
13097
+ !function(t2, i) {
13098
+ module.exports = i();
13099
+ }(commonjsGlobal, function() {
13100
+ var t2 = "minute", i = /[+-]\d\d(?::?\d\d)?/g, e = /([+-]|\d\d)/g;
13101
+ return function(s, f, n) {
13102
+ var u = f.prototype;
13103
+ n.utc = function(t3) {
13104
+ var i2 = { date: t3, utc: true, args: arguments };
13105
+ return new f(i2);
13106
+ }, u.utc = function(i2) {
13107
+ var e2 = n(this.toDate(), { locale: this.$L, utc: true });
13108
+ return i2 ? e2.add(this.utcOffset(), t2) : e2;
13109
+ }, u.local = function() {
13110
+ return n(this.toDate(), { locale: this.$L, utc: false });
13111
+ };
13112
+ var o = u.parse;
13113
+ u.parse = function(t3) {
13114
+ t3.utc && (this.$u = true), this.$utils().u(t3.$offset) || (this.$offset = t3.$offset), o.call(this, t3);
13115
+ };
13116
+ var r = u.init;
13117
+ u.init = function() {
13118
+ if (this.$u) {
13119
+ var t3 = this.$d;
13120
+ this.$y = t3.getUTCFullYear(), this.$M = t3.getUTCMonth(), this.$D = t3.getUTCDate(), this.$W = t3.getUTCDay(), this.$H = t3.getUTCHours(), this.$m = t3.getUTCMinutes(), this.$s = t3.getUTCSeconds(), this.$ms = t3.getUTCMilliseconds();
13121
+ } else r.call(this);
13122
+ };
13123
+ var a = u.utcOffset;
13124
+ u.utcOffset = function(s2, f2) {
13125
+ var n2 = this.$utils().u;
13126
+ if (n2(s2)) return this.$u ? 0 : n2(this.$offset) ? a.call(this) : this.$offset;
13127
+ if ("string" == typeof s2 && (s2 = function(t3) {
13128
+ void 0 === t3 && (t3 = "");
13129
+ var s3 = t3.match(i);
13130
+ if (!s3) return null;
13131
+ var f3 = ("" + s3[0]).match(e) || ["-", 0, 0], n3 = f3[0], u3 = 60 * +f3[1] + +f3[2];
13132
+ return 0 === u3 ? 0 : "+" === n3 ? u3 : -u3;
13133
+ }(s2), null === s2)) return this;
13134
+ var u2 = Math.abs(s2) <= 16 ? 60 * s2 : s2, o2 = this;
13135
+ if (f2) return o2.$offset = u2, o2.$u = 0 === s2, o2;
13136
+ if (0 !== s2) {
13137
+ var r2 = this.$u ? this.toDate().getTimezoneOffset() : -1 * this.utcOffset();
13138
+ (o2 = this.local().add(u2 + r2, t2)).$offset = u2, o2.$x.$localOffset = r2;
13139
+ } else o2 = this.utc();
13140
+ return o2;
13141
+ };
13142
+ var h2 = u.format;
13143
+ u.format = function(t3) {
13144
+ var i2 = t3 || (this.$u ? "YYYY-MM-DDTHH:mm:ss[Z]" : "");
13145
+ return h2.call(this, i2);
13146
+ }, u.valueOf = function() {
13147
+ var t3 = this.$utils().u(this.$offset) ? 0 : this.$offset + (this.$x.$localOffset || this.$d.getTimezoneOffset());
13148
+ return this.$d.valueOf() - 6e4 * t3;
13149
+ }, u.isUTC = function() {
13150
+ return !!this.$u;
13151
+ }, u.toISOString = function() {
13152
+ return this.toDate().toISOString();
13153
+ }, u.toString = function() {
13154
+ return this.toDate().toUTCString();
13155
+ };
13156
+ var l = u.toDate;
13157
+ u.toDate = function(t3) {
13158
+ return "s" === t3 && this.$offset ? n(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate() : l.call(this);
13159
+ };
13160
+ var c = u.diff;
13161
+ u.diff = function(t3, i2, e2) {
13162
+ if (t3 && this.$u === t3.$u) return c.call(this, t3, i2, e2);
13163
+ var s2 = this.local(), f2 = n(t3).local();
13164
+ return c.call(s2, f2, i2, e2);
13165
+ };
13166
+ };
13167
+ });
13168
+ })(utc$1);
13169
+ var utcExports = utc$1.exports;
13170
+ const utc = /* @__PURE__ */ getDefaultExportFromCjs(utcExports);
13171
+ dayjs.locale(locale);
13172
+ dayjs.extend(relativeTime);
13173
+ dayjs.extend(tz);
13174
+ dayjs.extend(utc);
13175
+ dayjs.tz.setDefault("Asia/Shanghai");
13176
+ const useTimeFormat = () => {
13177
+ const formatTimeFromNow = (time) => {
13178
+ if (!time) return "-";
13179
+ const targetDate = isDate$1(time) ? time : new Date(time);
13180
+ return formatTimeDifference(targetDate);
13181
+ };
13182
+ const formatTime = (time, format2) => {
13183
+ if (!time) return "-";
13184
+ return dayjs(time).format(format2);
13185
+ };
13186
+ return {
13187
+ formatTimeFromNow,
13188
+ formatTime
13189
+ };
13190
+ };
13191
+ const _hoisted_1$F = {
13192
+ key: 0,
13193
+ class: "org-layout-toolbar"
13194
+ };
13195
+ const _hoisted_2$v = { class: "org-layout-toolbar-title ellipsis-two-line" };
13196
+ const _hoisted_3$u = { class: "header-custom-btn-label" };
13197
+ const _hoisted_4$n = { class: "g-repo-breadcrumb-custom" };
13198
+ const _hoisted_5$i = {
13199
+ key: 1,
13200
+ class: "header-custom-mirrors-avatar"
13201
+ };
13202
+ const _hoisted_6$g = {
13203
+ key: 0,
13204
+ src: _imports_0,
13205
+ alt: "mirrors-avatar-phone",
13206
+ class: "header-custom-mirrors-img"
13207
+ };
13208
+ const _hoisted_7$d = {
13209
+ key: 1,
13210
+ src: "https://cdn-static.gitcode.com/static/images/mirrors-avata_20250411.gif",
13211
+ alt: "mirrors-avatar",
13212
+ class: "header-custom-mirrors-img-tall"
13213
+ };
13214
+ const _hoisted_8$b = { class: "g-repo-breadcrumb-container" };
13215
+ const _hoisted_9$a = {
13216
+ key: 0,
13217
+ class: "header-custom-breadcrumb-row"
13218
+ };
13219
+ const _hoisted_10$9 = ["title"];
13220
+ const _hoisted_11$7 = ["title"];
13221
+ const _hoisted_12$7 = {
13222
+ key: 0,
13223
+ class: "header-custom-tag-mb"
13224
+ };
13225
+ const _hoisted_13$4 = {
13226
+ key: 1,
13227
+ class: "header-custom-tag-mb"
13228
+ };
13229
+ const _hoisted_14$2 = {
13230
+ key: 2,
13231
+ class: "header-custom-tag-mb"
13232
+ };
13233
+ const _hoisted_15$2 = {
13234
+ key: 3,
13235
+ class: "header-custom-tag-mb"
13236
+ };
13237
+ const _hoisted_16$2 = {
13238
+ key: 4,
13239
+ class: "header-custom-tag-mb"
13240
+ };
13241
+ const _hoisted_17$2 = { class: "header-custom-topic-label" };
13242
+ const _hoisted_18$2 = {
13243
+ key: 6,
13244
+ class: "topic-tag font-color-t2 gh_mirros_tag"
13245
+ };
13246
+ const _hoisted_19$2 = { class: "header-custom-topic-label" };
13247
+ const _hoisted_20$2 = { class: "header-custom-skeleton" };
13248
+ const _hoisted_21$2 = {
13249
+ key: 2,
13250
+ class: "user-layout-toolbar"
13251
+ };
13252
+ const _hoisted_22$2 = { class: "user-layout-toolbar-title ellipsis-two-line" };
13253
+ const _hoisted_23$2 = { class: "header-custom-btn-label" };
13254
+ const _sfc_main$L = /* @__PURE__ */ defineComponent({
13255
+ __name: "HeaderCustom",
13256
+ props: {
13257
+ scene: { default: SceneValue.home },
13258
+ isLogin: { type: Boolean, default: false },
13259
+ errorCode: { default: 0 },
13260
+ orgProps: { default: () => ({}) },
13261
+ repoProps: { default: () => ({}) },
13262
+ userProps: { default: () => ({}) }
13263
+ },
13264
+ emits: ["followDevCommunity", "followUser"],
13265
+ setup(__props, { emit: __emit }) {
13266
+ const { t: t2 } = i18n.global;
13267
+ const layoutConfig2 = useLayoutConfig();
13268
+ const breadcrumb = useBreadcrumb();
13269
+ console.log("breadcrumb", breadcrumb);
13270
+ const breadcrumbRef = ref(null);
13271
+ const breadcrumbTextRef = ref(null);
13272
+ const breadcrumbNextRef = ref(null);
13273
+ const breadcrumbNextTextRef = ref(null);
13274
+ const { formatTimeFromNow } = useTimeFormat();
13275
+ const props = __props;
13276
+ const repoInfo = inject("repoInfo", computed(() => void 0));
13277
+ console.log("repoInfo", repoInfo);
13278
+ const orgInfo = inject("orgInfo", computed(() => void 0));
13279
+ const otherUserInfo = inject("otherUserInfo", computed(() => void 0));
13280
+ const API = headRequest(inject("request", proxyService));
13281
+ const emits = __emit;
13282
+ const handleOrgFollow = (val) => {
13283
+ if (props.scene !== SceneValue.org) return;
13284
+ if (!props.isLogin) {
13285
+ emitEvent("login", { triggerType: "关注组织", loginTriggerSource: "toolbar_org_follow" });
13286
+ return;
13287
+ }
13288
+ emits("followDevCommunity", !val);
13289
+ };
13290
+ const topicTag = computed(() => {
13291
+ var _a, _b;
13292
+ if (props.scene !== SceneValue.repo) return false;
13293
+ let repoType = 1;
13294
+ repoType = Number((_a = repoInfo.value) == null ? void 0 : _a.repo_type) - 1;
13295
+ if ((_b = props.repoProps) == null ? void 0 : _b.isSpaces) {
13296
+ repoType = 2;
13297
+ }
13298
+ if (repoType < 0) {
13299
+ return false;
13300
+ }
13301
+ const name = ["模型", "数据集", "Space"];
13302
+ const icon = ["gt-line-Models", "gt-line-Datasets", "gt-line-space"];
13303
+ const linkName = ["models", "datasets", "spaces"];
13304
+ const linkUrl = ["/models", "/datasets", "/space"];
13305
+ const suffix = ["Model", "Datasets", "Space"];
13306
+ const obj = {
13307
+ name: name[repoType],
13308
+ icon: icon[repoType],
13309
+ linkName: linkName[repoType],
13310
+ linkUrl: linkUrl[repoType],
13311
+ suffix: suffix[repoType]
13312
+ };
13313
+ return obj;
13314
+ });
13315
+ const isOrg = computed(() => {
13316
+ var _a, _b;
13317
+ if (props.scene === SceneValue.repo) {
13318
+ return ((_b = (_a = repoInfo.value) == null ? void 0 : _a.namespace) == null ? void 0 : _b.kind) === "group";
13319
+ }
13320
+ return false;
13321
+ });
13322
+ const orgEnterpriseId = computed(() => {
13323
+ var _a, _b;
13324
+ return (_b = (_a = orgInfo.value) == null ? void 0 : _a.enterprise) == null ? void 0 : _b.id;
13325
+ });
13326
+ const repoEnterpriseId = computed(() => {
13327
+ var _a, _b;
13328
+ return (_b = (_a = repoInfo.value) == null ? void 0 : _a.enterprise) == null ? void 0 : _b.id;
13329
+ });
13330
+ const orgEnterpriseName = computed(() => {
13331
+ var _a, _b;
13332
+ return ((_b = (_a = orgInfo.value) == null ? void 0 : _a.enterprise) == null ? void 0 : _b.name) || "";
13333
+ });
13334
+ const repoEnterpriseName = computed(() => {
13335
+ var _a, _b;
13336
+ return ((_b = (_a = repoInfo.value) == null ? void 0 : _a.enterprise) == null ? void 0 : _b.name) || "";
13337
+ });
13338
+ const enterpriseMemberCache = /* @__PURE__ */ new Map();
13339
+ const pendingEnterpriseMemberReqs = /* @__PURE__ */ new Map();
13340
+ const fetchIsEnterpriseMember = (enterpriseId) => {
13341
+ const cached = enterpriseMemberCache.get(enterpriseId);
13342
+ if (cached !== void 0) {
13343
+ return Promise.resolve(cached);
13344
+ }
13345
+ const pending = pendingEnterpriseMemberReqs.get(enterpriseId);
13346
+ if (pending) {
13347
+ return pending;
13348
+ }
13349
+ const req = (async () => {
13350
+ var _a, _b;
13351
+ const res = await API.getMemberByEnterprise({ enterpriseId });
13352
+ const data = (_a = res == null ? void 0 : res.data) == null ? void 0 : _a.data;
13353
+ const level = ((_b = data == null ? void 0 : data.role_info) == null ? void 0 : _b.access_level) || 0;
13354
+ const isMember = level > 10;
13355
+ enterpriseMemberCache.set(enterpriseId, isMember);
13356
+ pendingEnterpriseMemberReqs.delete(enterpriseId);
13357
+ return isMember;
13358
+ })();
13359
+ pendingEnterpriseMemberReqs.set(enterpriseId, req);
13360
+ return req;
13361
+ };
13362
+ const handleEnterpriseClick = async (enterpriseId, enterpriseName) => {
13363
+ if (!enterpriseId) return;
13364
+ const isMember = await fetchIsEnterpriseMember(String(enterpriseId));
13365
+ if (!isMember || !enterpriseName) return;
13366
+ if (typeof window !== "undefined" && window.location) {
13367
+ window.location.href = `${window.location.origin}/enterprises/${enterpriseName}`;
13368
+ }
13369
+ };
13370
+ const toAiHub = () => {
13371
+ if (props.scene !== SceneValue.repo) return;
13372
+ if (!topicTag.value) return;
13373
+ const aiUrl = `${layoutConfig2.VITE_AI_HOST}${topicTag.value.linkUrl}`;
13374
+ if (typeof window !== "undefined" && window.location) {
13375
+ window.location.href = aiUrl;
13376
+ }
13377
+ };
13378
+ const showTimeTopic = computed(() => {
13379
+ var _a, _b;
13380
+ if (props.scene !== SceneValue.repo) return false;
13381
+ if (!((_a = repoInfo.value) == null ? void 0 : _a.last_repository_updated_at)) {
13382
+ return false;
13383
+ }
13384
+ try {
13385
+ return (/* @__PURE__ */ new Date()).getTime() - new Date((_b = repoInfo.value) == null ? void 0 : _b.last_repository_updated_at).getTime() < 7 * 24 * 60 * 60 * 1e3;
13386
+ } catch (error) {
13387
+ return false;
13388
+ }
13389
+ });
13390
+ const formatTime = computed(() => {
13391
+ var _a;
13392
+ return formatTimeFromNow(((_a = repoInfo.value) == null ? void 0 : _a.last_repository_updated_at) || "");
13393
+ });
13394
+ const handleFollowUser = () => {
13395
+ if (props.scene !== SceneValue.user) return;
13396
+ emits("followUser");
13397
+ };
13398
+ const handleBreadcrumbCopy = (e) => {
13399
+ const container = document.querySelector(".g-repo-breadcrumb-custom");
13400
+ if (!container) return;
13401
+ const selection = window.getSelection();
13402
+ if (!selection || !selection.rangeCount) return;
13403
+ const range = selection.getRangeAt(0);
13404
+ const selectedText = selection.toString().trim();
13405
+ const isSelectionInContainer = container.contains(range.startContainer) && container.contains(range.endContainer);
13406
+ if (isSelectionInContainer && selectedText) {
13407
+ e.preventDefault();
13408
+ if (e.clipboardData) {
13409
+ e.clipboardData.setData("text/plain", selectedText.replace(/\s+/g, ""));
13410
+ }
13411
+ }
13412
+ };
13413
+ onMounted(() => {
13414
+ document.addEventListener("copy", handleBreadcrumbCopy);
13415
+ });
13416
+ onUnmounted(() => {
13417
+ document.removeEventListener("copy", handleBreadcrumbCopy);
13418
+ });
13419
+ return (_ctx, _cache) => {
13420
+ var _a, _b, _c;
13421
+ return _ctx.scene === unref(SceneValue).org && !_ctx.errorCode ? (openBlock(), createElementBlock("div", _hoisted_1$F, [
13422
+ createVNode(GLink, {
13423
+ href: ((_a = _ctx.orgProps) == null ? void 0 : _a.orgHomepageUrl) || "",
13424
+ class: "header-custom-link"
13425
+ }, {
13426
+ default: withCtx(() => {
13427
+ var _a2, _b2, _c2;
13428
+ return [
13429
+ createVNode(_sfc_main$N, {
13430
+ class: "g-border",
13431
+ src: ((_a2 = unref(orgInfo)) == null ? void 0 : _a2.avatar) || "",
13432
+ name: ((_b2 = unref(orgInfo)) == null ? void 0 : _b2.name) || "",
13433
+ width: 28,
13434
+ height: 28,
13435
+ is_round: false
13436
+ }, null, 8, ["src", "name"]),
13437
+ createElementVNode("div", _hoisted_2$v, [
13438
+ createElementVNode("span", null, toDisplayString$1((_c2 = unref(orgInfo)) == null ? void 0 : _c2.name), 1),
13439
+ orgEnterpriseId.value ? (openBlock(), createBlock(GIcon, {
13440
+ key: 0,
13441
+ name: "gt-enterprise",
13442
+ size: "16px",
13443
+ class: "header-custom-enterprise-icon",
13444
+ onClick: _cache[0] || (_cache[0] = withModifiers(($event) => handleEnterpriseClick(orgEnterpriseId.value, orgEnterpriseName.value), ["stop", "prevent"]))
13445
+ })) : createCommentVNode("", true)
13446
+ ])
13447
+ ];
13448
+ }),
13449
+ _: 1
13450
+ }, 8, ["href"]),
13451
+ createVNode(unref(Button), {
13452
+ onClick: _cache[1] || (_cache[1] = ($event) => {
13453
+ var _a2;
13454
+ return handleOrgFollow((_a2 = _ctx.orgProps) == null ? void 0 : _a2.isOrgFollow);
13455
+ }),
13456
+ class: "org-layout-toolbar-follow"
13457
+ }, {
13458
+ default: withCtx(() => {
13459
+ var _a2;
13460
+ return [
13461
+ createElementVNode("span", _hoisted_3$u, toDisplayString$1(((_a2 = _ctx.orgProps) == null ? void 0 : _a2.isOrgFollow) ? unref(t2)("gitCodeLayout.home.alreadyFollowed") : unref(t2)("gitCodeLayout.home.focusOn")), 1)
13462
+ ];
13463
+ }),
13464
+ _: 1
13465
+ })
13466
+ ])) : _ctx.scene === unref(SceneValue).repo && !_ctx.errorCode ? (openBlock(), createBlock(unref(Skeleton), {
13467
+ key: 1,
13468
+ loading: (_b = _ctx.repoProps) == null ? void 0 : _b.repoNameLoading,
13469
+ rows: 1
13470
+ }, {
13471
+ placeholder: withCtx(() => [
13472
+ createElementVNode("div", _hoisted_20$2, [
13473
+ createVNode(unref(SkeletonItem), {
13474
+ round: "",
13475
+ style: { "width": "30px", "height": "30px" }
13476
+ }),
13477
+ createVNode(unref(SkeletonItem), { style: { "margin-left": "12px", "width": "80px", "height": "24px" } })
13478
+ ])
13479
+ ]),
13480
+ default: withCtx(() => {
13481
+ var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k;
13482
+ return [
13483
+ createElementVNode("h2", _hoisted_4$n, [
13484
+ createVNode(GLink, {
13485
+ href: (_a2 = unref(breadcrumb)[0]) == null ? void 0 : _a2.path,
13486
+ class: "header-custom-avatar-link"
13487
+ }, {
13488
+ default: withCtx(() => {
13489
+ var _a3, _b3, _c3, _d2;
13490
+ return [
13491
+ !((_a3 = _ctx.repoProps) == null ? void 0 : _a3.isGhMirrors) ? (openBlock(), createBlock(_sfc_main$N, {
13492
+ key: 0,
13493
+ class: normalizeClass({ "g-border": isOrg.value }),
13494
+ src: ((_c3 = (_b3 = unref(repoInfo)) == null ? void 0 : _b3.namespace) == null ? void 0 : _c3.avatar_url) || "",
13495
+ name: ((_d2 = unref(repoInfo)) == null ? void 0 : _d2.name) || "",
13496
+ width: 28,
13497
+ height: 28,
13498
+ is_round: !isOrg.value
13499
+ }, null, 8, ["class", "src", "name", "is_round"])) : (openBlock(), createElementBlock("div", _hoisted_5$i, [
13500
+ unref(isPhone)() ? (openBlock(), createElementBlock("img", _hoisted_6$g)) : (openBlock(), createElementBlock("img", _hoisted_7$d))
13501
+ ]))
13502
+ ];
13503
+ }),
13504
+ _: 1
13505
+ }, 8, ["href"]),
13506
+ createElementVNode("div", _hoisted_8$b, [
13507
+ !((_b2 = _ctx.repoProps) == null ? void 0 : _b2.isGhMirrors) ? (openBlock(), createElementBlock("div", {
13508
+ key: 0,
13509
+ ref_key: "breadcrumbRef",
13510
+ ref: breadcrumbRef,
13511
+ class: "g-repo-layout-breadcrumb"
13512
+ }, [
13513
+ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(breadcrumb), (item, index2) => {
13514
+ return openBlock(), createElementBlock(Fragment, {
13515
+ key: item.path
13516
+ }, [
13517
+ index2 !== unref(breadcrumb).length - 1 ? (openBlock(), createElementBlock("span", _hoisted_9$a, [
13518
+ createVNode(GLink, {
13519
+ class: "linkTx",
13520
+ href: item.path
13521
+ }, {
13522
+ default: withCtx(() => [
13523
+ createElementVNode("span", {
13524
+ ref_for: true,
13525
+ ref_key: "breadcrumbTextRef",
13526
+ ref: breadcrumbTextRef,
13527
+ title: item.label,
13528
+ class: normalizeClass(["linkTx", index2 === unref(breadcrumb).length - 1 ? "header-custom-bold" : ""])
13529
+ }, toDisplayString$1(item.label), 11, _hoisted_10$9)
13530
+ ]),
13531
+ _: 2
13532
+ }, 1032, ["href"]),
13533
+ _cache[3] || (_cache[3] = createElementVNode("span", { class: "breadcrumb-splitter font-color-t1" }, " / ", -1))
13534
+ ])) : createCommentVNode("", true)
13535
+ ], 64);
13536
+ }), 128))
13537
+ ], 512)) : createCommentVNode("", true),
13538
+ unref(breadcrumb)[unref(breadcrumb).length - 1] ? (openBlock(), createElementBlock("div", {
13539
+ key: 1,
13540
+ ref_key: "breadcrumbNextRef",
13541
+ ref: breadcrumbNextRef,
13542
+ class: normalizeClass(["g-repo-layout-breadcrumb-next", [((_c2 = _ctx.repoProps) == null ? void 0 : _c2.isGhMirrors) ? "g-repo-layout-breadcrumb-next--full" : "g-repo-layout-breadcrumb-next--limit"]])
13543
+ }, [
13544
+ createVNode(GLink, {
13545
+ class: "linkTx",
13546
+ href: (_d = unref(breadcrumb)[unref(breadcrumb).length - 1]) == null ? void 0 : _d.path
13547
+ }, {
13548
+ default: withCtx(() => [
13549
+ createElementVNode("span", {
13550
+ ref_key: "breadcrumbNextTextRef",
13551
+ ref: breadcrumbNextTextRef,
13552
+ title: unref(breadcrumb)[unref(breadcrumb).length - 1].label,
13553
+ class: "linkTx header-custom-bold"
13554
+ }, toDisplayString$1(unref(breadcrumb)[unref(breadcrumb).length - 1].label), 9, _hoisted_11$7)
13555
+ ]),
13556
+ _: 1
13557
+ }, 8, ["href"]),
13558
+ unref(isGstarRepo)((_e = unref(repoInfo)) == null ? void 0 : _e.topic_names) ? (openBlock(), createElementBlock("div", _hoisted_12$7, [
13559
+ createVNode(_sfc_main$M, {
13560
+ origin: "repo",
13561
+ icon: "",
13562
+ type: "gstar",
13563
+ message: `G-Star ${unref(t2)("gitCodeLayout.GStar.project.graduation")}`
13564
+ }, {
13565
+ default: withCtx(() => _cache[4] || (_cache[4] = [
13566
+ createTextVNode("G-Star ")
13567
+ ])),
13568
+ _: 1
13569
+ }, 8, ["message"])
13570
+ ])) : unref(isIncubationRepo)((_f = unref(repoInfo)) == null ? void 0 : _f.topic_names) ? (openBlock(), createElementBlock("div", _hoisted_13$4, [
13571
+ createVNode(_sfc_main$M, {
13572
+ origin: "repo",
13573
+ icon: "",
13574
+ type: "incubation",
13575
+ message: `G-Star ${unref(t2)("gitCodeLayout.GStar.project.incubation")}`
13576
+ }, {
13577
+ default: withCtx(() => _cache[5] || (_cache[5] = [
13578
+ createTextVNode(" G-Star ")
13579
+ ])),
13580
+ _: 1
13581
+ }, 8, ["message"])
13582
+ ])) : createCommentVNode("", true),
13583
+ repoEnterpriseId.value ? (openBlock(), createElementBlock("div", _hoisted_14$2, [
13584
+ createVNode(GIcon, {
13585
+ name: "gt-enterprise",
13586
+ size: "16px",
13587
+ class: "header-custom-enterprise-icon",
13588
+ onClick: _cache[2] || (_cache[2] = ($event) => handleEnterpriseClick(repoEnterpriseId.value, repoEnterpriseName.value))
13589
+ })
13590
+ ])) : createCommentVNode("", true),
13591
+ unref(isTrustedRepo)((_g = unref(repoInfo)) == null ? void 0 : _g.topic_names) ? (openBlock(), createElementBlock("div", _hoisted_15$2, [
13592
+ createVNode(_sfc_main$M, {
13593
+ trusted: "",
13594
+ message: unref(t2)("gitCodeLayout.trusted.title"),
13595
+ icon: "",
13596
+ type: "trusted",
13597
+ href: "/trusted"
13598
+ }, null, 8, ["message"])
13599
+ ])) : createCommentVNode("", true),
13600
+ ((_h = _ctx.repoProps) == null ? void 0 : _h.isPrivate) ? (openBlock(), createElementBlock("div", _hoisted_16$2, [
13601
+ createVNode(GIcon, {
13602
+ size: "16px",
13603
+ class: "header-custom-lock-icon",
13604
+ name: "gt-line-lock"
13605
+ })
13606
+ ])) : createCommentVNode("", true),
13607
+ topicTag.value ? (openBlock(), createElementBlock("div", {
13608
+ key: 5,
13609
+ class: "topic-tag font-color-t2",
13610
+ onClick: toAiHub
13611
+ }, [
13612
+ createVNode(GIcon, {
13613
+ name: (_i = topicTag.value) == null ? void 0 : _i.icon,
13614
+ color: "var(--devui-shape-icon-fill)",
13615
+ class: "header-custom-topic-icon"
13616
+ }, null, 8, ["name"]),
13617
+ createElementVNode("span", _hoisted_17$2, toDisplayString$1((_j = topicTag.value) == null ? void 0 : _j.suffix), 1)
13618
+ ])) : createCommentVNode("", true),
13619
+ ((_k = _ctx.repoProps) == null ? void 0 : _k.isGhMirrors) && showTimeTopic.value && !unref(isPhone)() ? (openBlock(), createElementBlock("div", _hoisted_18$2, [
13620
+ createVNode(GIcon, {
13621
+ name: "gt-line-time",
13622
+ color: "var(--devui-shape-icon-fill)",
13623
+ class: "header-custom-topic-icon"
13624
+ }),
13625
+ createElementVNode("span", _hoisted_19$2, toDisplayString$1(formatTime.value) + toDisplayString$1(unref(t2)("gitCodeLayout.repo.code.syncText")), 1)
13626
+ ])) : createCommentVNode("", true)
13627
+ ], 2)) : createCommentVNode("", true)
13628
+ ])
13629
+ ])
13630
+ ];
13631
+ }),
13632
+ _: 1
13633
+ }, 8, ["loading"])) : _ctx.scene === unref(SceneValue).user && ((_c = _ctx.userProps) == null ? void 0 : _c.isOtherUser) ? (openBlock(), createElementBlock("div", _hoisted_21$2, [
13634
+ createVNode(GLink, {
13635
+ to: { name: "homepage" },
13636
+ class: "header-custom-link"
13637
+ }, {
13638
+ default: withCtx(() => {
13639
+ var _a2, _b2, _c2, _d, _e;
13640
+ return [
13641
+ createVNode(_sfc_main$N, {
13642
+ src: (_a2 = unref(otherUserInfo)) == null ? void 0 : _a2.avatarUrl,
13643
+ name: ((_b2 = unref(otherUserInfo)) == null ? void 0 : _b2.name) || ((_c2 = unref(otherUserInfo)) == null ? void 0 : _c2.nickname),
13644
+ width: 28,
13645
+ height: 28
13646
+ }, null, 8, ["src", "name"]),
13647
+ createElementVNode("div", _hoisted_22$2, toDisplayString$1(((_d = unref(otherUserInfo)) == null ? void 0 : _d.name) || ((_e = unref(otherUserInfo)) == null ? void 0 : _e.nickname)), 1)
13648
+ ];
13649
+ }),
13650
+ _: 1
13651
+ }),
13652
+ createVNode(unref(Button), {
13653
+ onClick: handleFollowUser,
13654
+ class: "user-layout-toolbar-follow"
13655
+ }, {
13656
+ default: withCtx(() => {
13657
+ var _a2;
13658
+ return [
13659
+ createElementVNode("span", _hoisted_23$2, toDisplayString$1(((_a2 = unref(otherUserInfo)) == null ? void 0 : _a2.isFollow) ? unref(t2)("gitCodeLayout.org.following") : unref(t2)("gitCodeLayout.common.topic.attention")), 1)
13660
+ ];
13661
+ }),
13662
+ _: 1
14008
13663
  })
14009
- );
14010
- },
14011
- // 获取主题菜单
14012
- getThemeConfigList() {
14013
- return reqCatch(() => request({
14014
- url: `/aihub/api/v1/theme/label/config/list`,
14015
- method: "get"
14016
- }));
14017
- },
14018
- // 获取今日技术历史
14019
- getTodayTechHistory() {
14020
- return reqCatch(() => request({
14021
- url: `/uc/api/v1/operation/tech-history`,
14022
- method: "get"
14023
- }));
13664
+ ])) : createCommentVNode("", true);
13665
+ };
13666
+ }
13667
+ });
13668
+ const HeaderCustom = /* @__PURE__ */ _export_sfc(_sfc_main$L, [["__scopeId", "data-v-vue-layout-gitcode"]]);
13669
+ const _hoisted_1$E = ["src"];
13670
+ const _sfc_main$K = /* @__PURE__ */ defineComponent({
13671
+ ...{ name: "OperationEntry" },
13672
+ __name: "OperationEntry",
13673
+ setup(__props) {
13674
+ const request = inject("request");
13675
+ const API = asideRequest(request);
13676
+ const headerEntryConfig = ref({
13677
+ img_light: "",
13678
+ img_dark: "",
13679
+ url: ""
13680
+ });
13681
+ const handleClick = () => {
13682
+ var _a;
13683
+ window.open(`${transformUrl((_a = headerEntryConfig.value) == null ? void 0 : _a.url)}`, "_blank");
13684
+ };
13685
+ const img = computed(() => {
13686
+ const { img_light, img_dark } = headerEntryConfig.value;
13687
+ return (currentTheme.value === ThemeType.BLACK ? img_dark : img_light) || img_light;
13688
+ });
13689
+ const getHeaderEntryConfig = async () => {
13690
+ var _a;
13691
+ try {
13692
+ const res = await API.getHeaderEntryConfig();
13693
+ const data = ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.data) || {};
13694
+ headerEntryConfig.value = {
13695
+ img_light: data.img_light,
13696
+ img_dark: data.img_dark,
13697
+ url: data.url
13698
+ };
13699
+ } catch (error) {
13700
+ console.error(error);
13701
+ }
13702
+ };
13703
+ getHeaderEntryConfig();
13704
+ return (_ctx, _cache) => {
13705
+ return img.value && headerEntryConfig.value.url ? (openBlock(), createElementBlock("div", {
13706
+ key: 0,
13707
+ class: "operation-entry",
13708
+ onClick: handleClick
13709
+ }, [
13710
+ createElementVNode("img", {
13711
+ class: "operation-entry__img",
13712
+ src: img.value,
13713
+ alt: "operation-entry"
13714
+ }, null, 8, _hoisted_1$E)
13715
+ ])) : createCommentVNode("", true);
13716
+ };
13717
+ }
13718
+ });
13719
+ const OperationEntry = /* @__PURE__ */ _export_sfc(_sfc_main$K, [["__scopeId", "data-v-vue-layout-gitcode"]]);
13720
+ const _hoisted_1$D = ["src"];
13721
+ const _sfc_main$J = /* @__PURE__ */ defineComponent({
13722
+ __name: "ClaimPower",
13723
+ props: {
13724
+ config: {}
13725
+ },
13726
+ setup(__props) {
13727
+ const props = __props;
13728
+ const visible = computed(() => {
13729
+ return props.config.visible;
13730
+ });
13731
+ const handleClick = () => {
13732
+ console.log("handleClick");
13733
+ window.open(props.config.jump_url, "_blank");
13734
+ };
13735
+ return (_ctx, _cache) => {
13736
+ return visible.value ? (openBlock(), createElementBlock("div", {
13737
+ key: 0,
13738
+ class: "computing-power",
13739
+ onClick: handleClick
13740
+ }, [
13741
+ createElementVNode("img", {
13742
+ src: _ctx.config.logo_url,
13743
+ alt: "claim power"
13744
+ }, null, 8, _hoisted_1$D)
13745
+ ])) : createCommentVNode("", true);
13746
+ };
13747
+ }
13748
+ });
13749
+ const ClaimPower = /* @__PURE__ */ _export_sfc(_sfc_main$J, [["__scopeId", "data-v-vue-layout-gitcode"]]);
13750
+ const DEFAULT_APPLICATION_HOST = "https://gitcode.com";
13751
+ function normalizeApplicationHost(host) {
13752
+ return (host || DEFAULT_APPLICATION_HOST).replace(/\/+$/, "");
13753
+ }
13754
+ function getRoutePart(href, baseUrl) {
13755
+ try {
13756
+ const url = new URL(href || "/", `${baseUrl}/`);
13757
+ return `${url.pathname || "/"}${url.search}${url.hash}`;
13758
+ } catch {
13759
+ const value = href.trim();
13760
+ return value.startsWith("/") ? value : `/${value}`;
13761
+ }
13762
+ }
13763
+ function toApplicationUrl(applicationHost, href) {
13764
+ const host = normalizeApplicationHost(applicationHost);
13765
+ return `${host}${getRoutePart(href, host)}`;
13766
+ }
13767
+ function toApplicationRoute(applicationHost, href) {
13768
+ try {
13769
+ const url = new URL(toApplicationUrl(applicationHost, href));
13770
+ return `${url.pathname || "/"}${url.search}${url.hash}`;
13771
+ } catch {
13772
+ return null;
13773
+ }
13774
+ }
13775
+ const HEADER_CREATE_MENU_PATHS = [
13776
+ "/create?position=nav_top",
13777
+ "/create/migrate?type=3",
13778
+ "/models/create",
13779
+ "/datasets/create",
13780
+ "/space/create",
13781
+ "/collections/create",
13782
+ "/org/create"
13783
+ ];
13784
+ const HEADER_CREATE_ENTERPRISE_PATH = "/enterprises/new";
13785
+ const _hoisted_1$C = { class: "g-header-create dashboard-create-menu" };
13786
+ const _hoisted_2$u = ["title", "aria-label", "aria-expanded"];
13787
+ const _hoisted_3$t = { class: "dashboard-create-menu__trigger-text" };
13788
+ const _hoisted_4$m = ["aria-label"];
13789
+ const _hoisted_5$h = {
13790
+ key: 0,
13791
+ class: "dashboard-create-menu__divider",
13792
+ role: "separator"
13793
+ };
13794
+ const _hoisted_6$f = ["href", "onClick", "onKeydown"];
13795
+ const _hoisted_7$c = { class: "dashboard-create-menu__title-row" };
13796
+ const _hoisted_8$a = { class: "dashboard-create-menu__title" };
13797
+ const _hoisted_9$9 = {
13798
+ key: 0,
13799
+ class: "dashboard-create-menu__desc"
13800
+ };
13801
+ const menuId = "gitcode-header-create-menu";
13802
+ const _sfc_main$I = /* @__PURE__ */ defineComponent({
13803
+ ...{
13804
+ name: "HeaderCreateMenu"
13805
+ },
13806
+ __name: "index",
13807
+ props: {
13808
+ dropdownVisible: { type: Boolean, default: false },
13809
+ isCreateOrg: { type: Boolean, default: true },
13810
+ isCreateEnterprise: { type: Boolean, default: true },
13811
+ items: { default: void 0 },
13812
+ onNavigate: { type: Function, default: void 0 }
13813
+ },
13814
+ emits: ["update:dropdownVisible", "navigate"],
13815
+ setup(__props, { emit: __emit }) {
13816
+ const props = __props;
13817
+ const emit = __emit;
13818
+ const { t: t2 } = i18n.global;
13819
+ const layoutConfig2 = useLayoutConfig();
13820
+ const route = useRoute();
13821
+ const router2 = useRouter();
13822
+ const triggerRef = ref(null);
13823
+ const menuRef = ref(null);
13824
+ const menuOpen = ref(false);
13825
+ const defaultMenuItems = computed(() => {
13826
+ const [repoPath, importPath, modelPath, datasetPath, spacePath, collectionPath, orgPath] = HEADER_CREATE_MENU_PATHS;
13827
+ return [
13828
+ {
13829
+ key: "repo",
13830
+ icon: "gt-a-Property1default",
13831
+ label: t2("gitCodeLayout.header.createMenuRepository"),
13832
+ href: toApplicationUrl(layoutConfig2.VITE_HOST, repoPath)
13833
+ },
13834
+ {
13835
+ key: "import-repository",
13836
+ icon: "gt-a-plane-fileinport",
13837
+ label: t2("gitCodeLayout.header.createMenuImportRepository"),
13838
+ href: toApplicationUrl(layoutConfig2.VITE_HOST, importPath)
13839
+ },
13840
+ {
13841
+ key: "model",
13842
+ icon: "gt-plane-Models",
13843
+ label: t2("gitCodeLayout.header.createMenuModel"),
13844
+ href: toApplicationUrl(layoutConfig2.VITE_HOST, modelPath)
13845
+ },
13846
+ {
13847
+ key: "dataset",
13848
+ icon: "gt-plane-Datasets",
13849
+ label: t2("gitCodeLayout.header.createMenuDataset"),
13850
+ href: toApplicationUrl(layoutConfig2.VITE_HOST, datasetPath)
13851
+ },
13852
+ {
13853
+ key: "space",
13854
+ icon: "gt-plane-Space",
13855
+ label: t2("gitCodeLayout.header.createMenuSpace"),
13856
+ href: toApplicationUrl(layoutConfig2.VITE_HOST, spacePath)
13857
+ },
13858
+ {
13859
+ key: "collection",
13860
+ icon: "gt-a-dashujuyufenxishuxing1guan",
13861
+ label: t2("gitCodeLayout.header.createMenuCollection"),
13862
+ href: toApplicationUrl(layoutConfig2.VITE_HOST, collectionPath)
13863
+ },
13864
+ {
13865
+ key: "organization",
13866
+ icon: "gt-plane-organization",
13867
+ label: t2("gitCodeLayout.header.createMenuOrganization"),
13868
+ href: toApplicationUrl(layoutConfig2.VITE_HOST, orgPath),
13869
+ dividerBefore: true
13870
+ }
13871
+ ];
13872
+ });
13873
+ const enterpriseMenuItem = {
13874
+ key: "enterprise",
13875
+ icon: "gt-a-plane-enterprise",
13876
+ label: t2("gitCodeLayout.header.createMenuEnterprise"),
13877
+ href: toApplicationUrl(layoutConfig2.VITE_HOST, HEADER_CREATE_ENTERPRISE_PATH),
13878
+ useHref: true
13879
+ };
13880
+ const menuItems = computed(() => {
13881
+ const baseItems = props.items || defaultMenuItems.value;
13882
+ const items = props.isCreateOrg ? baseItems : baseItems.filter((item) => item.key !== "organization");
13883
+ return props.isCreateEnterprise ? [...items, enterpriseMenuItem] : items;
13884
+ });
13885
+ function getMenuItems() {
13886
+ var _a;
13887
+ return Array.from(((_a = menuRef.value) == null ? void 0 : _a.querySelectorAll('[role="menuitem"]')) || []);
14024
13888
  }
14025
- };
14026
- }
13889
+ function focusMenuItem(index2) {
13890
+ void nextTick(() => {
13891
+ var _a;
13892
+ const items = getMenuItems();
13893
+ if (!items.length) return;
13894
+ const safeIndex = Math.min(Math.max(index2, 0), items.length - 1);
13895
+ (_a = items[safeIndex]) == null ? void 0 : _a.focus();
13896
+ });
13897
+ }
13898
+ function closeMenu(restoreFocus = false) {
13899
+ if (!menuOpen.value) return;
13900
+ menuOpen.value = false;
13901
+ emit("update:dropdownVisible", false);
13902
+ if (restoreFocus) {
13903
+ void nextTick(() => {
13904
+ var _a;
13905
+ return (_a = triggerRef.value) == null ? void 0 : _a.focus();
13906
+ });
13907
+ }
13908
+ }
13909
+ const handleToggle = (value) => {
13910
+ if (menuOpen.value === value) return;
13911
+ menuOpen.value = value;
13912
+ emit("update:dropdownVisible", value);
13913
+ };
13914
+ function onTriggerKeydown(event) {
13915
+ if (event.key === "ArrowDown") {
13916
+ event.preventDefault();
13917
+ menuOpen.value = true;
13918
+ emit("update:dropdownVisible", true);
13919
+ focusMenuItem(0);
13920
+ } else if (event.key === "ArrowUp") {
13921
+ event.preventDefault();
13922
+ menuOpen.value = true;
13923
+ emit("update:dropdownVisible", true);
13924
+ focusMenuItem(menuItems.value.length - 1);
13925
+ } else if (event.key === "Escape") {
13926
+ event.preventDefault();
13927
+ closeMenu(true);
13928
+ }
13929
+ }
13930
+ function onMenuItemKeydown(event, index2) {
13931
+ if (event.key === "ArrowDown") {
13932
+ event.preventDefault();
13933
+ focusMenuItem((index2 + 1) % menuItems.value.length);
13934
+ } else if (event.key === "ArrowUp") {
13935
+ event.preventDefault();
13936
+ focusMenuItem((index2 - 1 + menuItems.value.length) % menuItems.value.length);
13937
+ } else if (event.key === "Home") {
13938
+ event.preventDefault();
13939
+ focusMenuItem(0);
13940
+ } else if (event.key === "End") {
13941
+ event.preventDefault();
13942
+ focusMenuItem(menuItems.value.length - 1);
13943
+ } else if (event.key === "Escape") {
13944
+ event.preventDefault();
13945
+ closeMenu(true);
13946
+ } else if (event.key === " ") {
13947
+ event.preventDefault();
13948
+ if (event.currentTarget instanceof HTMLElement) event.currentTarget.click();
13949
+ }
13950
+ }
13951
+ function stripRouterBase(route2) {
13952
+ const base = router2.options.history.base;
13953
+ if (!base || base === "/") return route2;
13954
+ if (route2 === base) return "/";
13955
+ return route2.startsWith(`${base}/`) ? route2.slice(base.length) : route2;
13956
+ }
13957
+ function navigateTo(href) {
13958
+ const applicationHref = toApplicationUrl(layoutConfig2.VITE_HOST, href);
13959
+ const applicationRoute = toApplicationRoute(layoutConfig2.VITE_HOST, href);
13960
+ if (!applicationRoute) return;
13961
+ if (typeof window !== "undefined") {
13962
+ const applicationUrl = new URL(applicationHref);
13963
+ if (applicationUrl.origin !== window.location.origin) {
13964
+ window.location.href = applicationHref;
13965
+ return;
13966
+ }
13967
+ } else {
13968
+ void router2.push(stripRouterBase(applicationRoute));
13969
+ return;
13970
+ }
13971
+ void router2.push(stripRouterBase(applicationRoute));
13972
+ }
13973
+ async function selectCreateItem(item) {
13974
+ closeMenu();
13975
+ emit("navigate", item);
13976
+ if (item.useHref) {
13977
+ if (typeof window !== "undefined") {
13978
+ window.location.href = toApplicationUrl(layoutConfig2.VITE_HOST, item.href);
13979
+ }
13980
+ return;
13981
+ }
13982
+ if (props.onNavigate) {
13983
+ await props.onNavigate(item);
13984
+ return;
13985
+ }
13986
+ navigateTo(item.href);
13987
+ }
13988
+ watch(
13989
+ () => props.dropdownVisible,
13990
+ (visible) => {
13991
+ menuOpen.value = visible;
13992
+ },
13993
+ { immediate: true }
13994
+ );
13995
+ watch(
13996
+ () => route == null ? void 0 : route.fullPath,
13997
+ () => closeMenu()
13998
+ );
13999
+ return (_ctx, _cache) => {
14000
+ return openBlock(), createElementBlock("div", _hoisted_1$C, [
14001
+ createVNode(unref(Dropdown), {
14002
+ position: ["bottom-end", "bottom-start"],
14003
+ "destroy-on-hide": false,
14004
+ trigger: "hover",
14005
+ offset: { mainAxis: 4, crossAxis: 0 },
14006
+ onClick: _cache[0] || (_cache[0] = withModifiers(() => {
14007
+ }, ["stop"])),
14008
+ "overlay-class": "dashboard-create-dropdown",
14009
+ visible: menuOpen.value,
14010
+ onToggle: handleToggle
14011
+ }, {
14012
+ menu: withCtx(() => [
14013
+ createElementVNode("div", {
14014
+ id: menuId,
14015
+ ref_key: "menuRef",
14016
+ ref: menuRef,
14017
+ class: "dashboard-create-menu__panel",
14018
+ role: "menu",
14019
+ "aria-label": unref(t2)("gitCodeLayout.header.create")
14020
+ }, [
14021
+ (openBlock(true), createElementBlock(Fragment, null, renderList(menuItems.value, (item, index2) => {
14022
+ return openBlock(), createElementBlock(Fragment, {
14023
+ key: item.key
14024
+ }, [
14025
+ item.dividerBefore ? (openBlock(), createElementBlock("div", _hoisted_5$h)) : createCommentVNode("", true),
14026
+ createElementVNode("a", {
14027
+ href: unref(toApplicationUrl)(unref(layoutConfig2).VITE_HOST, item.href),
14028
+ class: normalizeClass(["dashboard-create-menu__item", { "dashboard-create-menu__item--with-desc": Boolean(item.desc) }]),
14029
+ role: "menuitem",
14030
+ tabindex: "-1",
14031
+ onClick: withModifiers(($event) => selectCreateItem(item), ["prevent"]),
14032
+ onKeydown: ($event) => onMenuItemKeydown($event, index2)
14033
+ }, [
14034
+ createElementVNode("div", _hoisted_7$c, [
14035
+ createVNode(GIcon, {
14036
+ name: item.icon,
14037
+ size: "16px",
14038
+ color: "currentColor",
14039
+ class: "dashboard-create-menu__icon",
14040
+ "aria-hidden": "true"
14041
+ }, null, 8, ["name"]),
14042
+ createElementVNode("span", _hoisted_8$a, toDisplayString$1(item.label), 1)
14043
+ ]),
14044
+ item.desc ? (openBlock(), createElementBlock("div", _hoisted_9$9, toDisplayString$1(item.desc), 1)) : createCommentVNode("", true)
14045
+ ], 42, _hoisted_6$f)
14046
+ ], 64);
14047
+ }), 128))
14048
+ ], 8, _hoisted_4$m)
14049
+ ]),
14050
+ default: withCtx(() => [
14051
+ createElementVNode("button", {
14052
+ id: "guide-step3",
14053
+ ref_key: "triggerRef",
14054
+ ref: triggerRef,
14055
+ type: "button",
14056
+ class: "dashboard-create-menu__trigger dashboard-create-menu__trigger--header",
14057
+ title: unref(t2)("gitCodeLayout.header.create"),
14058
+ "aria-label": unref(t2)("gitCodeLayout.header.create"),
14059
+ "aria-expanded": menuOpen.value,
14060
+ "aria-controls": menuId,
14061
+ "aria-haspopup": "menu",
14062
+ onKeydown: onTriggerKeydown
14063
+ }, [
14064
+ createVNode(GIcon, {
14065
+ name: "gt-add",
14066
+ size: "16px",
14067
+ color: "var(--theme-light-text)",
14068
+ class: "dashboard-create-menu__trigger-icon",
14069
+ "aria-hidden": "true"
14070
+ }),
14071
+ createElementVNode("span", _hoisted_3$t, toDisplayString$1(unref(t2)("gitCodeLayout.header.create")), 1)
14072
+ ], 40, _hoisted_2$u)
14073
+ ]),
14074
+ _: 1
14075
+ }, 8, ["visible"])
14076
+ ]);
14077
+ };
14078
+ }
14079
+ });
14080
+ const HeaderCreateMenu = /* @__PURE__ */ _export_sfc(_sfc_main$I, [["__scopeId", "data-v-vue-layout-gitcode"]]);
14081
+ const _sfc_main$H = /* @__PURE__ */ defineComponent({
14082
+ ...{
14083
+ name: "DocumentCenter"
14084
+ },
14085
+ __name: "DocumentCenter",
14086
+ props: {
14087
+ whiteColor: { type: Boolean, default: false }
14088
+ },
14089
+ setup(__props) {
14090
+ const { t: t2 } = i18n.global;
14091
+ return (_ctx, _cache) => {
14092
+ return openBlock(), createBlock(GLink, {
14093
+ variant: "text",
14094
+ class: normalizeClass(["g-toolbar-docs", _ctx.whiteColor ? "white" : "black"]),
14095
+ href: unref(currentHelpDocsAiCommunityUrl)(),
14096
+ target: "_blank"
14097
+ }, {
14098
+ default: withCtx(() => [
14099
+ createTextVNode(toDisplayString$1(unref(t2)("gitCodeLayout.header.aihub.documentCenter")), 1)
14100
+ ]),
14101
+ _: 1
14102
+ }, 8, ["class", "href"]);
14103
+ };
14104
+ }
14105
+ });
14106
+ const DocumentCenter = /* @__PURE__ */ _export_sfc(_sfc_main$H, [["__scopeId", "data-v-vue-layout-gitcode"]]);
14027
14107
  const _hoisted_1$B = {
14028
14108
  key: 1,
14029
14109
  class: "g-text-all"
@@ -15964,12 +16044,12 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
15964
16044
  setup(__props) {
15965
16045
  const layoutConfig2 = useLayoutConfig();
15966
16046
  const { t: $t } = i18n.global;
15967
- const ProjectSearch = defineAsyncComponent(() => import("./ProjectSearch-C6Fj67wo.js"));
15968
- const UserSearch = defineAsyncComponent(() => import("./UserSearch-BkbD5mTj.js"));
15969
- const GloabarSearch = defineAsyncComponent(() => import("./GloabarSearch-CLjwkajD.js"));
15970
- const SearchHistoryList = defineAsyncComponent(() => import("./SearchHistoryList-D54eKxmc.js"));
15971
- const SearchScopeList = defineAsyncComponent(() => import("./SearchScopeList-1mlm7X_W.js"));
15972
- const SearchRecommed = defineAsyncComponent(() => import("./SearchRecommed-BQbn_3a2.js"));
16047
+ const ProjectSearch = defineAsyncComponent(() => import("./ProjectSearch-DMZcmmYk.js"));
16048
+ const UserSearch = defineAsyncComponent(() => import("./UserSearch-DouG0l2B.js"));
16049
+ const GloabarSearch = defineAsyncComponent(() => import("./GloabarSearch-Dd2ti805.js"));
16050
+ const SearchHistoryList = defineAsyncComponent(() => import("./SearchHistoryList-vky6RgfX.js"));
16051
+ const SearchScopeList = defineAsyncComponent(() => import("./SearchScopeList-BM3CPIqG.js"));
16052
+ const SearchRecommed = defineAsyncComponent(() => import("./SearchRecommed-DNwcvqeX.js"));
15973
16053
  const props = __props;
15974
16054
  const repoInfo = inject("repoInfo", computed(() => void 0));
15975
16055
  const orgInfo = inject("orgInfo", computed(() => void 0));
@@ -17360,7 +17440,7 @@ const vElementExposure = {
17360
17440
  beforeUnmount() {
17361
17441
  }
17362
17442
  };
17363
- const NoticeModal = defineAsyncComponent(() => import("./notice-CX-y_BTW.js"));
17443
+ const NoticeModal = defineAsyncComponent(() => import("./notice-B600yGOS.js"));
17364
17444
  function clearNotice() {
17365
17445
  if (localStorage$2.getItem("validator_email")) {
17366
17446
  localStorage$2.removeItem("validator_email");
@@ -17743,6 +17823,10 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
17743
17823
  var _a2;
17744
17824
  return Boolean(((_a2 = claimPowerConfig.value) == null ? void 0 : _a2.visible) || isModuleVisible(HeaderDisplayItem.OPERATION_ENTRY));
17745
17825
  });
17826
+ const isCreateEnterpriseVisible = computed(() => {
17827
+ var _a2;
17828
+ return Boolean((_a2 = claimPowerConfig.value) == null ? void 0 : _a2.enterprise_enable);
17829
+ });
17746
17830
  onMounted(() => {
17747
17831
  getClaimPowerConfig();
17748
17832
  toNotice();
@@ -18002,8 +18086,9 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
18002
18086
  dropdownVisible: props.openCreateDropdown,
18003
18087
  items: props.createMenuItems,
18004
18088
  onNavigate: props.createMenuNavigate,
18089
+ isCreateEnterprise: isCreateEnterpriseVisible.value,
18005
18090
  "onUpdate:dropdownVisible": _cache[6] || (_cache[6] = ($event) => emit("update:openCreateDropdown", $event))
18006
- }, null, 8, ["dropdownVisible", "items", "onNavigate"])) : createCommentVNode("", true),
18091
+ }, null, 8, ["dropdownVisible", "items", "onNavigate", "isCreateEnterprise"])) : createCommentVNode("", true),
18007
18092
  isModuleVisible(unref(HeaderDisplayItem).DOCUMENT_CENTER) ? (openBlock(), createBlock(DocumentCenter, { key: 2 })) : createCommentVNode("", true),
18008
18093
  isModuleVisible(unref(HeaderDisplayItem).MESSAGE_CENTER) ? (openBlock(), createBlock(Notice, { key: 3 })) : createCommentVNode("", true),
18009
18094
  isModuleVisible(unref(HeaderDisplayItem).LOGIN_AND_AVATAR) ? (openBlock(), createBlock(UserAvatar, {
@@ -19336,6 +19421,18 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
19336
19421
  useReport2(REPO_EVENT.CLICK, { module_name: ASIDE_MENU_REPO.ASIDEBTNCLICK });
19337
19422
  };
19338
19423
  const layoutConfig2 = useLayoutConfig();
19424
+ const claimPowerConfig = ref({});
19425
+ const getClaimPowerConfig = async () => {
19426
+ const res = await props.request({
19427
+ url: "/api/v1/search/common/config/claim_computing_power",
19428
+ method: "get"
19429
+ });
19430
+ claimPowerConfig.value = (res == null ? void 0 : res.data) || {};
19431
+ };
19432
+ const isCreateEnterpriseVisible = computed(() => {
19433
+ var _a2;
19434
+ return Boolean((_a2 = claimPowerConfig.value) == null ? void 0 : _a2.enterprise_enable);
19435
+ });
19339
19436
  const loginDataFormat = (options) => {
19340
19437
  return {
19341
19438
  ...options || {},
@@ -19343,6 +19440,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
19343
19440
  };
19344
19441
  };
19345
19442
  onMounted(() => {
19443
+ getClaimPowerConfig();
19346
19444
  toNotice();
19347
19445
  addEventListener("logout", (options) => {
19348
19446
  const token = localStorage$2.getItem("access_token");
@@ -19524,8 +19622,9 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
19524
19622
  dropdownVisible: _ctx.openCreateDropdown,
19525
19623
  items: _ctx.createMenuItems,
19526
19624
  onNavigate: _ctx.createMenuNavigate,
19625
+ isCreateEnterprise: isCreateEnterpriseVisible.value,
19527
19626
  "onUpdate:dropdownVisible": _cache[3] || (_cache[3] = ($event) => emit("update:openCreateDropdown", $event))
19528
- }, null, 8, ["dropdownVisible", "items", "onNavigate"])) : createCommentVNode("", true),
19627
+ }, null, 8, ["dropdownVisible", "items", "onNavigate", "isCreateEnterprise"])) : createCommentVNode("", true),
19529
19628
  isModuleVisible(unref(HeaderDisplayItem).MESSAGE_CENTER) ? (openBlock(), createBlock(Notice, { key: 2 })) : createCommentVNode("", true),
19530
19629
  isModuleVisible(unref(HeaderDisplayItem).LOGIN_AND_AVATAR) ? (openBlock(), createBlock(UserAvatar, {
19531
19630
  key: 3,
@@ -19791,9 +19890,9 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
19791
19890
  const layoutConfig2 = useLayoutConfig();
19792
19891
  const { t: t2 } = i18n.global;
19793
19892
  const route = useRoute();
19794
- const MenuItem = defineAsyncComponent(() => import("./MenuItem-By6uwjQI.js"));
19795
- const ProjectMenuListV2 = defineAsyncComponent(() => import("./ProjectMenuListV2-CJMuAj_B.js"));
19796
- const ProjectMenuList = defineAsyncComponent(() => import("./ProjectMenuList-Dh01UB9h.js"));
19893
+ const MenuItem = defineAsyncComponent(() => import("./MenuItem-Dz2dt34d.js"));
19894
+ const ProjectMenuListV2 = defineAsyncComponent(() => import("./ProjectMenuListV2-r4pTLRhY.js"));
19895
+ const ProjectMenuList = defineAsyncComponent(() => import("./ProjectMenuList-CEfWAHj0.js"));
19797
19896
  const props = __props;
19798
19897
  const useReport2 = inject("useReport");
19799
19898
  const userInfo = inject("userInfo");
@@ -20879,7 +20978,14 @@ const repoInfoData = {
20879
20978
  "fork_network_projects": null,
20880
20979
  "secure_issue_assignees": null,
20881
20980
  "forked_by_secure_issue": null,
20882
- "enterprise": null,
20981
+ "enterprise": {
20982
+ "name": "hello-worldsss",
20983
+ "avatar": null,
20984
+ "id": 1,
20985
+ "creator_id": 303745,
20986
+ "created_at": null,
20987
+ "updated_at": null
20988
+ },
20883
20989
  "template": false,
20884
20990
  "module_setting": {
20885
20991
  "repo_id": 686859,
@@ -20985,7 +21091,18 @@ const repoInfoData = {
20985
21091
  ],
20986
21092
  "gc_allow": null
20987
21093
  },
20988
- "topic_names": null,
21094
+ // namespace 区域标签的展示条件(判定见 src/utils/index.ts),topic_id 需命中对应配置:
21095
+ // - G-Star(毕业): VITE_GSTAR_TOPIC,本地 dev 为 6653f80e91a72b11f2478e99
21096
+ // - G-Star(孵化): type 为 0 且 name 含「孵化项目」或命中 VITE_INCUBATION_TOPIC,本地 dev 为 6653f7a191a72b11f2478e93
21097
+ // - 可信开源: VITE_TRUSTED_TOPIC,本地 dev 为 6715c49554670a12f26fb08d
21098
+ "topic_names": [
21099
+ {
21100
+ "topic_id": "6653f80e91a72b11f2478e99",
21101
+ "id": "6653f80e91a72b11f2478e99",
21102
+ "name": "G-Star",
21103
+ "type": 0
21104
+ }
21105
+ ],
20989
21106
  "is_recommend": null,
20990
21107
  "deploy_info": "",
20991
21108
  "deploy_allow": false,
@@ -21428,8 +21545,8 @@ const headerCustomPropsData = {
21428
21545
  },
21429
21546
  repoProps: {
21430
21547
  repoNameLoading: false,
21431
- isGhMirrors: true,
21432
- isPrivate: false,
21548
+ isGhMirrors: false,
21549
+ isPrivate: true,
21433
21550
  isSpaces: false
21434
21551
  },
21435
21552
  userProps: {
@@ -26246,7 +26363,7 @@ const _SlidCaptchaManager = class _SlidCaptchaManager {
26246
26363
  __publicField(_SlidCaptchaManager, "instance");
26247
26364
  let SlidCaptchaManager = _SlidCaptchaManager;
26248
26365
  const slidCaptchaManager = SlidCaptchaManager.getInstance();
26249
- const SlidCaptcha = defineAsyncComponent(() => import("./index-C2f5-zvH.js"));
26366
+ const SlidCaptcha = defineAsyncComponent(() => import("./index-BWpBnpsB.js"));
26250
26367
  const useSlidCaptcha = () => {
26251
26368
  const { mount, unMount, isMounted } = usePopup("slid-captcha-popup");
26252
26369
  const open = (config) => {
@@ -26276,7 +26393,7 @@ const useSlidCaptcha = () => {
26276
26393
  close
26277
26394
  };
26278
26395
  };
26279
- const YunpianCaptcha = defineAsyncComponent(() => import("./index-CQvft6bK.js"));
26396
+ const YunpianCaptcha = defineAsyncComponent(() => import("./index-BXLreYUt.js"));
26280
26397
  const useYunpianCaptcha = () => {
26281
26398
  const { mount, unMount } = usePopup("yunpian-captcha-popup");
26282
26399
  const open = (config) => {
@@ -29375,28 +29492,28 @@ export {
29375
29492
  HEADER_CREATE_MENU_PATHS as a8,
29376
29493
  index as a9,
29377
29494
  REPO_EVENT as b,
29378
- REPO_TYPE as c,
29495
+ useLayoutConfig as c,
29379
29496
  transferNumber as d,
29380
- extractRepoInfoWithURL as e,
29381
- useRequestReport as f,
29382
- useTimeFormat as g,
29497
+ useRequestReport as e,
29498
+ useTimeFormat as f,
29499
+ useCookie as g,
29383
29500
  headRequest as h,
29384
29501
  isPhone as i,
29385
- useCookie as j,
29386
- usePageResize as k,
29502
+ usePageResize as j,
29503
+ isGstarRepo as k,
29387
29504
  localStorage$2 as l,
29388
- isGstarRepo as m,
29505
+ _sfc_main$M as m,
29389
29506
  normalizeSearchHistoryEntry as n,
29390
- _sfc_main$M as o,
29391
- isIncubationRepo as p,
29392
- highlightWords as q,
29507
+ isIncubationRepo as o,
29508
+ highlightWords as p,
29509
+ _frEventTrack as q,
29393
29510
  reqCatch as r,
29394
29511
  setLoginTriggerSource as s,
29395
29512
  transformUrl as t,
29396
29513
  useModel as u,
29397
29514
  vElementExposure as v,
29398
- _frEventTrack as w,
29399
- LANG_KEY as x,
29400
- slidCaptchaManager as y,
29401
- useLayoutConfig as z
29515
+ REPO_TYPE as w,
29516
+ extractRepoInfoWithURL as x,
29517
+ LANG_KEY as y,
29518
+ slidCaptchaManager as z
29402
29519
  };