@24city/web-console 0.3.7 → 0.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/styles.css CHANGED
@@ -5077,6 +5077,173 @@
5077
5077
  padding: 24px 20px;
5078
5078
  }
5079
5079
  }
5080
+ /*
5081
+ * 功能引导弹窗(GuideModal):上半是浅主色渐变里的画框,放这一步的图片或视频(16:9);下面是步骤点、标题和说明(居中);
5082
+ * 脚部居中两个大按钮。颜色只用品牌色板和 Semi 变量,暗色下渐变、画框跟着变深。
5083
+ */
5084
+
5085
+ /* Semi Modal 的内容层(modalContentClass):不留内边距,渐变铺到顶边、按弹窗圆角裁掉。 */
5086
+ ._content_3mwwt_7 {
5087
+ overflow: hidden;
5088
+ padding: 0;
5089
+ }
5090
+
5091
+ ._stage_3mwwt_12 {
5092
+ display: flex;
5093
+ justify-content: center;
5094
+ padding: 32px 48px;
5095
+ background:
5096
+ radial-gradient(80% 70% at 50% 0%, rgb(var(--app-brand-1)) 0%, rgba(var(--app-brand-1), 0) 100%),
5097
+ linear-gradient(135deg, rgb(var(--app-brand-2)) 0%, rgb(var(--app-brand-1)) 48%, rgb(var(--app-brand-3)) 100%);
5098
+ }
5099
+
5100
+ /* 半透明的画框;矮屏上按高度收窄(保持 16:9),弹窗整体不超出一屏。 */
5101
+ ._frame_3mwwt_22 {
5102
+ width: 100%;
5103
+ max-width: max(240px, calc((100vh - 360px) * 16 / 9));
5104
+ min-width: 0;
5105
+ padding: 6px;
5106
+ border-radius: 16px;
5107
+ background: rgba(var(--semi-grey-0), 0.6);
5108
+ box-shadow: var(--app-shadow-card);
5109
+ }
5110
+
5111
+ ._media_3mwwt_32 {
5112
+ display: block;
5113
+ width: 100%;
5114
+ aspect-ratio: 16 / 9;
5115
+ border-radius: 10px;
5116
+ background: var(--semi-color-bg-0);
5117
+ object-fit: contain;
5118
+ user-select: none;
5119
+ }
5120
+
5121
+ ._dots_3mwwt_42 {
5122
+ display: flex;
5123
+ justify-content: center;
5124
+ gap: 6px;
5125
+ padding-top: 20px;
5126
+ }
5127
+
5128
+ ._dot_3mwwt_42 {
5129
+ width: 6px;
5130
+ height: 6px;
5131
+ border-radius: 3px;
5132
+ background: rgb(var(--app-brand-2));
5133
+ }
5134
+
5135
+ ._dot_3mwwt_42._active_3mwwt_56 {
5136
+ width: 16px;
5137
+ background: rgb(var(--app-brand-6));
5138
+ }
5139
+
5140
+ ._copy_3mwwt_61 {
5141
+ padding: 20px 48px 0;
5142
+ text-align: center;
5143
+ }
5144
+
5145
+ /* 标题和说明至少占两行说明的高度:只有一行字的步骤上下居中,换步时弹窗高度不跳。 */
5146
+ ._copyInner_3mwwt_67 {
5147
+ display: flex;
5148
+ min-height: 48px;
5149
+ flex-direction: column;
5150
+ justify-content: center;
5151
+ }
5152
+
5153
+ ._progress_3mwwt_74 {
5154
+ position: absolute;
5155
+ width: 1px;
5156
+ height: 1px;
5157
+ overflow: hidden;
5158
+ border: 0;
5159
+ clip-path: inset(50%);
5160
+ white-space: nowrap;
5161
+ }
5162
+
5163
+ ._title_3mwwt_84 {
5164
+ margin: 0 0 8px;
5165
+ }
5166
+
5167
+ ._title_3mwwt_84:last-child {
5168
+ margin-bottom: 0;
5169
+ }
5170
+
5171
+ ._description_3mwwt_92 {
5172
+ margin: 0;
5173
+ color: var(--semi-color-text-1);
5174
+ font-size: var(--app-font-size-lead);
5175
+ line-height: 24px;
5176
+ }
5177
+
5178
+ ._footer_3mwwt_99 {
5179
+ display: flex;
5180
+ justify-content: center;
5181
+ gap: 12px;
5182
+ padding: 24px 48px 32px;
5183
+ }
5184
+
5185
+ ._button_3mwwt_106 {
5186
+ min-width: 120px;
5187
+ }
5188
+
5189
+ @media (prefers-reduced-motion: no-preference) {
5190
+ ._enter_3mwwt_111 {
5191
+ animation: _guide-enter_3mwwt_1 var(--app-duration) var(--app-ease);
5192
+ }
5193
+
5194
+ ._dot_3mwwt_42 {
5195
+ transition:
5196
+ width var(--app-duration) var(--app-ease),
5197
+ background-color var(--app-duration) var(--app-ease);
5198
+ }
5199
+ }
5200
+
5201
+ @keyframes _guide-enter_3mwwt_1 {
5202
+ from {
5203
+ opacity: 0;
5204
+ }
5205
+
5206
+ to {
5207
+ opacity: 1;
5208
+ }
5209
+ }
5210
+
5211
+ @media (max-width: 576px) {
5212
+ ._stage_3mwwt_12 {
5213
+ padding: 16px;
5214
+ }
5215
+
5216
+ ._frame_3mwwt_22 {
5217
+ padding: 4px;
5218
+ border-radius: 12px;
5219
+ }
5220
+
5221
+ ._media_3mwwt_32 {
5222
+ border-radius: 8px;
5223
+ }
5224
+
5225
+ ._copy_3mwwt_61 {
5226
+ padding: 16px 20px 0;
5227
+ }
5228
+
5229
+ ._copyInner_3mwwt_67 {
5230
+ min-height: 44px;
5231
+ }
5232
+
5233
+ ._description_3mwwt_92 {
5234
+ font-size: var(--app-font-size-body);
5235
+ line-height: 22px;
5236
+ }
5237
+
5238
+ ._footer_3mwwt_99 {
5239
+ padding: 20px 20px 24px;
5240
+ }
5241
+
5242
+ ._button_3mwwt_106 {
5243
+ min-width: 0;
5244
+ flex: 1 1 0;
5245
+ }
5246
+ }
5080
5247
  /* 只给读屏的文字:不占位、不可见。 */
5081
5248
  ._srOnly_1mfs8_2 {
5082
5249
  position: absolute;
@@ -1,11 +1,11 @@
1
- import { c as a } from "../chunks/http-B3mTs9KZ.js";
2
- const n = (e = {}) => ({
1
+ import { c as i } from "../chunks/http-B3mTs9KZ.js";
2
+ const r = (e = {}) => ({
3
3
  brand: { name: "示例产品", shortName: "示例", mark: "示", description: "@24city/web-console 示例", primaryColor: "#E04E06" },
4
4
  routes: { publicHome: "/", login: "/login", app: "/app" },
5
5
  api: { baseUrl: "/api" },
6
6
  enabledModules: [],
7
7
  ...e
8
- }), o = (e = {}) => ({
8
+ }), c = (e = {}) => ({
9
9
  globalUserId: "user-fixture",
10
10
  localUserId: 1,
11
11
  activeSpaceId: "space-personal",
@@ -19,7 +19,7 @@ const n = (e = {}) => ({
19
19
  lastCentralVerifiedAt: "2026-01-01T00:00:00Z",
20
20
  accountCenterUrl: "https://account.example.invalid",
21
21
  ...e
22
- }), i = () => [
22
+ }), l = () => [
23
23
  {
24
24
  id: "space-personal",
25
25
  name: "示例用户的空间",
@@ -42,7 +42,7 @@ const n = (e = {}) => ({
42
42
  entitlementSummary: { activeCount: 1, codes: ["team-standard"] },
43
43
  entitlements: []
44
44
  }
45
- ], r = () => ({ nickName: "示例用户" }), c = (e = {}) => ({
45
+ ], p = () => ({ nickName: "示例用户" }), u = (e = {}) => ({
46
46
  spaceId: "space-personal",
47
47
  globalUserId: "user-fixture",
48
48
  productCode: "demo",
@@ -56,7 +56,7 @@ const n = (e = {}) => ({
56
56
  walletReservedPoints: 0,
57
57
  walletVersion: 1,
58
58
  ...e
59
- }), l = () => ({
59
+ }), d = () => ({
60
60
  subscriptionId: null,
61
61
  planCode: "platform-free",
62
62
  planName: "免费版",
@@ -64,7 +64,7 @@ const n = (e = {}) => ({
64
64
  isDefault: !0,
65
65
  spaceType: "personal",
66
66
  currentPeriodEnd: null
67
- }), p = () => [
67
+ }), m = () => [
68
68
  { code: "platform-free", name: "免费版", spaceType: "personal", tier: 0, isDefault: !0, includedSeats: 1, monthlyPoints: 500, prices: [], benefits: [], otherProducts: [] },
69
69
  {
70
70
  code: "platform-premium",
@@ -108,35 +108,41 @@ const n = (e = {}) => ({
108
108
  benefits: [],
109
109
  otherProducts: []
110
110
  }
111
- ], u = (e = {}) => {
112
- let t = o();
111
+ ], y = (e = {}) => {
112
+ let t = c();
113
+ const a = /* @__PURE__ */ new Set();
113
114
  return {
114
115
  startLogin: () => "#",
115
116
  getSession: async () => t,
116
- getSpaces: async () => ({ activeSpaceId: t.activeSpaceId, spaces: i() }),
117
+ getSpaces: async () => ({ activeSpaceId: t.activeSpaceId, spaces: l() }),
117
118
  switchSpace: async (s) => (t = { ...t, activeSpaceId: s }, t),
118
- getProfile: async () => r(),
119
- getWallet: async () => c({ spaceId: t.activeSpaceId }),
119
+ getProfile: async () => p(),
120
+ getWallet: async () => u({ spaceId: t.activeSpaceId }),
120
121
  getEntitlements: async () => [],
121
- getSubscription: async () => l(),
122
- getPlans: async () => p(),
122
+ getSubscription: async () => d(),
123
+ getPlans: async () => m(),
123
124
  logout: async () => ({ endSessionUrl: null }),
125
+ getShownPrompts: async (s) => s.filter((n) => a.has(n)),
126
+ claimShownPrompts: async (s) => {
127
+ const n = [...new Set(s)].filter((o) => !a.has(o));
128
+ return n.forEach((o) => a.add(o)), n;
129
+ },
124
130
  ...e
125
131
  };
126
- }, m = (e = {}) => ({
127
- config: n(),
128
- http: a(),
129
- accountApi: u(),
132
+ }, P = (e = {}) => ({
133
+ config: r(),
134
+ http: i(),
135
+ accountApi: y(),
130
136
  ...e
131
137
  });
132
138
  export {
133
- u as createFixtureAccountApi,
134
- m as createFixtureRuntime,
135
- p as fixturePlans,
136
- r as fixtureProfile,
137
- n as fixtureRuntimeConfig,
138
- o as fixtureSession,
139
- i as fixtureSpaces,
140
- l as fixtureSubscription,
141
- c as fixtureWallet
139
+ y as createFixtureAccountApi,
140
+ P as createFixtureRuntime,
141
+ m as fixturePlans,
142
+ p as fixtureProfile,
143
+ r as fixtureRuntimeConfig,
144
+ c as fixtureSession,
145
+ l as fixtureSpaces,
146
+ d as fixtureSubscription,
147
+ u as fixtureWallet
142
148
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@24city/web-console",
3
- "version": "0.3.7",
3
+ "version": "0.3.8",
4
4
  "description": "24.city 产品用户端的界面底座:Semi Design 主题与设计变量、控制台外壳、账号与会员界面、列表与数据组件、界面规范与守卫",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,365 +0,0 @@
1
- import { sanitizeInternalReturnPath as I } from "@24city/web-runtime/core/internal-path";
2
- import { createContext as O, useSyncExternalStore as R, useContext as x } from "react";
3
- import { summarizeCustomerError as _ } from "@24city/web-runtime/error-summary";
4
- const A = (t) => t.includes("\\") || [...t].some((e) => {
5
- const r = e.charCodeAt(0);
6
- return r <= 31 || r === 127;
7
- }), ot = (t) => !A(t) && t.startsWith("/") && !t.startsWith("//") && (() => {
8
- try {
9
- const e = new URL(t, "https://product.invalid");
10
- return e.origin === "https://product.invalid" && I(t, e.pathname) === t;
11
- } catch {
12
- return !1;
13
- }
14
- })(), st = (t, e) => !A(t) && I(t, e) === t, F = (t, e) => !t || A(t) ? e : I(t, e), D = (t) => typeof t == "object" && t !== null && !Array.isArray(t), p = (t, e) => {
15
- const r = e.data;
16
- if (!D(r) || r.code !== 0 || !("data" in r))
17
- throw new Error(`接口 ${t} 返回了无效响应`);
18
- return r.data;
19
- }, u = (t, e, r) => {
20
- if (!D(t)) throw new Error(`接口 ${e} 字段 ${r} 无效`);
21
- return t;
22
- }, o = (t, e, r) => {
23
- const n = t[e];
24
- if (typeof n != "string" || !n.trim())
25
- throw new Error(`接口 ${r} 字段 ${e} 无效`);
26
- return n;
27
- }, f = (t, e, r) => {
28
- const n = t[e];
29
- if (typeof n != "number" || !Number.isSafeInteger(n) || n < 0)
30
- throw new Error(`接口 ${r} 字段 ${e} 无效`);
31
- return n;
32
- }, w = "/account", c = `${w}/session`, P = `${w}/logout`, i = `${w}/spaces`, v = `${i}/switch`, $ = `${w}/profile`, h = `${w}/wallet`, b = `${w}/entitlements`, m = `${w}/subscription`, s = `${w}/plans`, N = (t, e, r) => {
33
- const n = t[e];
34
- if (n !== null && typeof n != "string")
35
- throw new Error(`接口 ${r} 字段 ${e} 无效`);
36
- return n;
37
- }, S = (t, e, r) => {
38
- const n = t[e];
39
- if (n != null) {
40
- if (typeof n != "string")
41
- throw new Error(`接口 ${r} 字段 ${e} 无效`);
42
- return n;
43
- }
44
- }, z = (t, e, r) => {
45
- const n = t[e];
46
- return n === null ? {} : u(n, r, e);
47
- }, M = (t) => {
48
- const e = u(t, P, "data"), r = S(e, "endSessionUrl", P);
49
- if (!r) return null;
50
- try {
51
- return new URL(r).protocol === "https:" ? r : null;
52
- } catch {
53
- return null;
54
- }
55
- }, T = (t) => {
56
- const e = u(t, c, "data");
57
- if (e.purpose !== "user") throw new Error("产品用户 Web 只接受 user Purpose 会话");
58
- return {
59
- globalUserId: o(e, "globalUserId", c),
60
- localUserId: f(e, "localUserId", c),
61
- activeSpaceId: o(e, "activeSpaceId", c),
62
- authorityId: f(e, "authorityId", c),
63
- orgId: f(e, "orgId", c),
64
- purpose: "user",
65
- csrfToken: o(e, "csrfToken", c),
66
- issuedAt: o(e, "issuedAt", c),
67
- lastSeenAt: o(e, "lastSeenAt", c),
68
- absoluteExpiresAt: o(e, "absoluteExpiresAt", c),
69
- lastCentralVerifiedAt: o(e, "lastCentralVerifiedAt", c),
70
- accountCenterUrl: o(e, "accountCenterUrl", c)
71
- };
72
- }, L = (t, e, r) => {
73
- const n = u(t, e, r);
74
- return {
75
- id: o(n, "id", e),
76
- entitlementCode: o(n, "entitlementCode", e),
77
- status: S(n, "status", e),
78
- startsAt: o(n, "startsAt", e),
79
- expiresAt: N(n, "expiresAt", e),
80
- metadata: z(n, "metadata", e)
81
- };
82
- }, W = (t, e) => {
83
- const r = u(t, i, `spaces[${e}]`), n = u(r.entitlementSummary, i, "entitlementSummary"), a = n.codes, l = r.entitlements;
84
- if (!Array.isArray(a) || a.some((y) => typeof y != "string"))
85
- throw new Error(`接口 ${i} 字段 entitlementSummary.codes 无效`);
86
- if (!Array.isArray(l))
87
- throw new Error(`接口 ${i} 字段 entitlements 无效`);
88
- return {
89
- id: o(r, "id", i),
90
- name: o(r, "name", i),
91
- slug: o(r, "slug", i),
92
- type: o(r, "type", i),
93
- role: o(r, "role", i),
94
- status: o(r, "status", i),
95
- membershipStatus: o(r, "membershipStatus", i),
96
- entitlementSummary: {
97
- activeCount: f(n, "activeCount", i),
98
- codes: [...a]
99
- },
100
- entitlements: l.map(
101
- (y, d) => L(y, i, `entitlements[${d}]`)
102
- )
103
- };
104
- }, q = (t) => {
105
- const e = u(t, i, "data"), r = o(e, "activeSpaceId", i);
106
- if (!Array.isArray(e.spaces)) throw new Error(`接口 ${i} 字段 spaces 无效`);
107
- const n = e.spaces.map(W);
108
- if (!n.some((a) => a.id === r))
109
- throw new Error(`接口 ${i} 的当前空间不在可用空间列表中`);
110
- return { activeSpaceId: r, spaces: n };
111
- }, B = (t) => {
112
- const e = u(t, $, "data");
113
- return { nickName: (S(e, "nickName", $) ?? "").trim() };
114
- }, V = (t) => {
115
- const e = u(t, h, "data"), r = (n) => {
116
- const a = e[n];
117
- if (typeof a != "number" || !Number.isSafeInteger(a))
118
- throw new Error(`接口 ${h} 字段 ${n} 无效`);
119
- return a;
120
- };
121
- return {
122
- spaceId: o(e, "spaceId", h),
123
- globalUserId: o(e, "globalUserId", h),
124
- productCode: o(e, "productCode", h),
125
- availablePoints: r("availablePoints"),
126
- reservedPoints: r("reservedPoints"),
127
- globalAvailablePoints: r("globalAvailablePoints"),
128
- globalReservedPoints: r("globalReservedPoints"),
129
- productAvailablePoints: r("productAvailablePoints"),
130
- productReservedPoints: r("productReservedPoints"),
131
- walletAvailablePoints: r("walletAvailablePoints"),
132
- walletReservedPoints: r("walletReservedPoints"),
133
- walletVersion: f(e, "walletVersion", h)
134
- };
135
- }, k = (t) => {
136
- if (t === null) return null;
137
- const e = u(t, m, "data"), r = e.tier;
138
- if (typeof r != "number" || !Number.isSafeInteger(r))
139
- throw new Error(`接口 ${m} 字段 tier 无效`);
140
- if (typeof e.isDefault != "boolean")
141
- throw new Error(`接口 ${m} 字段 isDefault 无效`);
142
- return {
143
- subscriptionId: N(e, "subscriptionId", m),
144
- planCode: o(e, "planCode", m),
145
- planName: (S(e, "planName", m) ?? "").trim(),
146
- tier: r,
147
- isDefault: e.isDefault,
148
- spaceType: S(e, "spaceType", m) ?? "",
149
- currentPeriodEnd: N(e, "currentPeriodEnd", m)
150
- };
151
- }, G = /* @__PURE__ */ new Set(["month", "year", "one_time"]), H = (t, e) => {
152
- const r = u(t, s, e), n = o(r, "billingPeriod", s);
153
- if (!G.has(n)) throw new Error(`接口 ${s} 字段 ${e}.billingPeriod 无效`);
154
- return {
155
- code: o(r, "code", s),
156
- amountCents: f(r, "amountCents", s),
157
- currency: o(r, "currency", s),
158
- billingPeriod: n,
159
- durationDays: f(r, "durationDays", s),
160
- pointCycles: f(r, "pointCycles", s)
161
- };
162
- }, j = (t, e) => {
163
- const r = u(t, s, e), n = r.limit;
164
- if (n != null && (typeof n != "number" || !Number.isSafeInteger(n) || n < 0))
165
- throw new Error(`接口 ${s} 字段 ${e}.limit 无效`);
166
- const a = Array.isArray(r.discounts) ? r.discounts.filter((l) => typeof l == "string") : [];
167
- return {
168
- key: S(r, "key", s) ?? "",
169
- name: o(r, "name", s),
170
- description: S(r, "description", s) ?? "",
171
- limit: typeof n == "number" ? n : null,
172
- discounts: a
173
- };
174
- }, K = (t, e) => {
175
- const r = `data[${e}]`, n = u(t, s, r), a = o(n, "spaceType", s);
176
- if (a !== "personal" && a !== "team") throw new Error(`接口 ${s} 字段 ${r}.spaceType 无效`);
177
- if (typeof n.tier != "number" || !Number.isSafeInteger(n.tier)) throw new Error(`接口 ${s} 字段 ${r}.tier 无效`);
178
- if (typeof n.isDefault != "boolean") throw new Error(`接口 ${s} 字段 ${r}.isDefault 无效`);
179
- if (!Array.isArray(n.prices)) throw new Error(`接口 ${s} 字段 ${r}.prices 无效`);
180
- const l = Array.isArray(n.benefits) ? n.benefits : [], y = Array.isArray(n.otherProducts) ? n.otherProducts.filter((d) => typeof d == "string" && d.trim() !== "").map((d) => d.trim()) : [];
181
- return {
182
- code: o(n, "code", s),
183
- name: o(n, "name", s).trim(),
184
- spaceType: a,
185
- tier: n.tier,
186
- isDefault: n.isDefault,
187
- includedSeats: f(n, "includedSeats", s),
188
- monthlyPoints: f(n, "monthlyPoints", s),
189
- prices: n.prices.map((d, E) => H(d, `${r}.prices[${E}]`)),
190
- benefits: l.map((d, E) => j(d, `${r}.benefits[${E}]`)),
191
- otherProducts: y
192
- };
193
- }, X = (t) => {
194
- if (!Array.isArray(t)) throw new Error(`接口 ${s} 字段 data 无效`);
195
- return t.map(K);
196
- }, at = (t, e) => {
197
- const r = e === "/" ? "" : e;
198
- return {
199
- startLogin(n, a) {
200
- const l = F(n, a);
201
- return `${r}${w}/startLogin?returnPath=${encodeURIComponent(l)}`;
202
- },
203
- async getSession() {
204
- return T(p(c, await t.get(c)));
205
- },
206
- async getSpaces() {
207
- return q(p(i, await t.get(i)));
208
- },
209
- async switchSpace(n) {
210
- const a = p(v, await t.post(v, { globalSpaceId: n }));
211
- return T(a);
212
- },
213
- async getProfile() {
214
- return B(p($, await t.get($)));
215
- },
216
- async getWallet() {
217
- return V(p(h, await t.get(h)));
218
- },
219
- async getEntitlements() {
220
- const n = p(b, await t.get(b));
221
- if (!Array.isArray(n)) throw new Error(`接口 ${b} 字段 data 无效`);
222
- return n.map((a, l) => L(a, b, `entitlements[${l}]`));
223
- },
224
- async getSubscription() {
225
- return k(p(m, await t.get(m)));
226
- },
227
- async getPlans() {
228
- return X(p(s, await t.get(s)));
229
- },
230
- async logout() {
231
- const n = p(P, await t.post(P));
232
- return { endSessionUrl: M(n) };
233
- }
234
- };
235
- }, it = async (t) => {
236
- let e = await t.getSession();
237
- const r = await t.getSpaces();
238
- if (r.activeSpaceId !== e.activeSpaceId && (e = await t.getSession()), r.activeSpaceId !== e.activeSpaceId)
239
- throw new Error("产品会话与统一空间上下文不一致");
240
- return { session: e, spaces: r.spaces };
241
- }, ct = (t) => t == null || !Number.isFinite(t) ? "暂无" : t >= 1e8 ? `${(Math.floor(t / 1e7) / 10).toFixed(1)}亿` : t >= 1e4 ? `${(Math.floor(t / 1e3) / 10).toFixed(1)}万` : t.toLocaleString("zh-CN"), ut = (t) => t.toLocaleString("zh-CN", { maximumFractionDigits: 0 }), lt = (t) => t > 0 && t < 0.01 ? "<0.01" : t.toLocaleString("zh-CN", { maximumFractionDigits: 2 }), dt = (t) => t ? `¥${(t / 100).toLocaleString("zh-CN", { minimumFractionDigits: 2, maximumFractionDigits: 2 })}` : "暂无", mt = (t) => {
242
- if (t === void 0 || t <= 0) return "";
243
- const e = Math.floor(t / 60), r = Math.floor(t % 60);
244
- return `${e}:${String(r).padStart(2, "0")}`;
245
- }, ft = (t) => {
246
- if (t === void 0 || t <= 0) return "暂无";
247
- const e = Math.floor(t / 3600), r = Math.floor(t % 3600 / 60), n = t % 60;
248
- return e > 0 ? `${e}小时${r}分` : r > 0 ? `${r}分${n}秒` : `${n}秒`;
249
- }, pt = (t) => {
250
- const e = new Date(t);
251
- return Number.isNaN(e.getTime()) ? "暂无" : new Intl.DateTimeFormat("zh-CN", { dateStyle: "short", timeStyle: "short" }).format(e);
252
- }, gt = (t) => {
253
- if (!t) return "长期有效";
254
- const e = new Date(t);
255
- return Number.isNaN(e.getTime()) ? "暂无" : new Intl.DateTimeFormat("zh-CN", { dateStyle: "medium" }).format(e);
256
- }, Y = () => ({
257
- session: null,
258
- spaces: [],
259
- bootstrapped: !1,
260
- serviceUnavailable: !1
261
- }), wt = () => {
262
- let t = Y();
263
- const e = /* @__PURE__ */ new Set(), r = (n) => {
264
- t = n, e.forEach((a) => a());
265
- };
266
- return {
267
- subscribe(n) {
268
- return e.add(n), () => e.delete(n);
269
- },
270
- getState: () => t,
271
- getCsrfToken: () => {
272
- var n;
273
- return ((n = t.session) == null ? void 0 : n.csrfToken) ?? null;
274
- },
275
- setContext(n) {
276
- r({ session: n.session, spaces: [...n.spaces], bootstrapped: !0, serviceUnavailable: !1 });
277
- },
278
- setBootstrapping() {
279
- r({ ...t, bootstrapped: !1, serviceUnavailable: !1 });
280
- },
281
- clear(n = {}) {
282
- r({ session: null, spaces: [], bootstrapped: !0, serviceUnavailable: n.unavailable ?? !1 });
283
- }
284
- };
285
- }, U = O(null), ht = U.Provider, J = () => {
286
- const t = x(U);
287
- if (!t) throw new Error("AuthStoreProvider 尚未初始化");
288
- return t;
289
- }, St = () => {
290
- const t = J();
291
- return R(t.subscribe, t.getState, t.getState);
292
- }, yt = (t) => t instanceof Error && t.message.trim() ? t.message : "请稍后重试;如问题持续,请联系管理员。", bt = (t, e) => _(t).status === e, C = "24city.console.logout-at", Q = 15e3;
293
- let g = null;
294
- const Z = () => {
295
- try {
296
- return Number(window.localStorage.getItem(C) ?? Number.NaN);
297
- } catch {
298
- return Number.NaN;
299
- }
300
- };
301
- function Pt(t = Date.now()) {
302
- try {
303
- window.localStorage.setItem(C, String(t));
304
- } catch {
305
- }
306
- }
307
- function tt() {
308
- try {
309
- window.localStorage.removeItem(C);
310
- } catch {
311
- }
312
- }
313
- function $t() {
314
- g = "leaving";
315
- }
316
- function Et() {
317
- return g === "leaving";
318
- }
319
- function Nt(t = Date.now()) {
320
- if (g === "leaving") return !1;
321
- const e = t - Z();
322
- return e >= 0 && e < Q && (g = "logged-out"), g === "logged-out";
323
- }
324
- function It() {
325
- return g === "logged-out";
326
- }
327
- function At() {
328
- g === "logged-out" && (g = null);
329
- }
330
- function Ct() {
331
- g = null, tt();
332
- }
333
- export {
334
- ht as A,
335
- o as B,
336
- F as C,
337
- yt as D,
338
- p as E,
339
- Pt as a,
340
- wt as b,
341
- at as c,
342
- It as d,
343
- Ct as e,
344
- it as f,
345
- J as g,
346
- lt as h,
347
- Et as i,
348
- mt as j,
349
- gt as k,
350
- $t as l,
351
- pt as m,
352
- Nt as n,
353
- ft as o,
354
- ct as p,
355
- ut as q,
356
- At as r,
357
- dt as s,
358
- bt as t,
359
- St as u,
360
- st as v,
361
- tt as w,
362
- ot as x,
363
- f as y,
364
- u as z
365
- };