@genispace/geniapp 0.1.0

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.
Files changed (258) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +153 -0
  3. package/dist/CrossAppRecordPicker-BXchXcK5.js +624 -0
  4. package/dist/CrossAppRecordPicker-BXchXcK5.js.map +1 -0
  5. package/dist/Page-wHZrMN17.js +24 -0
  6. package/dist/Page-wHZrMN17.js.map +1 -0
  7. package/dist/ai/adopt/AiSuggestionPanel.d.ts +30 -0
  8. package/dist/ai/adopt/BusinessGuidancePanel.d.ts +31 -0
  9. package/dist/ai/adopt/DetailPageAiLayout.d.ts +7 -0
  10. package/dist/ai/adopt/adoptPresets.d.ts +11 -0
  11. package/dist/ai/adopt/guidanceContent.d.ts +27 -0
  12. package/dist/ai/adopt/parseAiSummary.d.ts +7 -0
  13. package/dist/ai/components/AgentJobProgress.d.ts +124 -0
  14. package/dist/ai/components/AsyncCombobox.d.ts +44 -0
  15. package/dist/ai/components/BulkActionBar.d.ts +44 -0
  16. package/dist/ai/components/EntityRef.d.ts +39 -0
  17. package/dist/ai/components/JobProgress.d.ts +64 -0
  18. package/dist/ai/components/ServerDataTable.d.ts +89 -0
  19. package/dist/ai/components/Timeline.d.ts +35 -0
  20. package/dist/ai/components/useInfiniteRows.d.ts +25 -0
  21. package/dist/ai/errors/userFacingError.d.ts +14 -0
  22. package/dist/ai/errors/userFacingError.js +48 -0
  23. package/dist/ai/errors/userFacingError.js.map +1 -0
  24. package/dist/ai/index.d.ts +34 -0
  25. package/dist/ai/integrations/partner/createPartnerRecordPickerHook.d.ts +15 -0
  26. package/dist/ai/integrations/partner/partnerRecordPicker.d.ts +20 -0
  27. package/dist/ai/layout/ModalWithAiLayout.d.ts +11 -0
  28. package/dist/ai/layout/aiUi.d.ts +16 -0
  29. package/dist/ai/layout/layoutConstants.d.ts +19 -0
  30. package/dist/ai/layout/modalSizeForAi.d.ts +5 -0
  31. package/dist/ai/locales/sharedAiCopy.d.ts +6 -0
  32. package/dist/ai/managed-data/DatasourceReadonlyTable.d.ts +11 -0
  33. package/dist/ai/managed-data/createTableClient.d.ts +7 -0
  34. package/dist/ai/managed-data/emitManagedEvent.d.ts +18 -0
  35. package/dist/ai/managed-data/executeManagedDatasource.d.ts +21 -0
  36. package/dist/ai/managed-data/queryManagedDatasource.d.ts +28 -0
  37. package/dist/ai/providers/AppUiProviders.d.ts +6 -0
  38. package/dist/ai/types/app-ai.types.d.ts +29 -0
  39. package/dist/ai/types/index.d.ts +1 -0
  40. package/dist/ai.d.ts +1 -0
  41. package/dist/ai.js +1817 -0
  42. package/dist/ai.js.map +1 -0
  43. package/dist/case-workspace/domain.d.ts +41 -0
  44. package/dist/case-workspace/domain.js +24 -0
  45. package/dist/case-workspace/domain.js.map +1 -0
  46. package/dist/case-workspace/index.d.ts +91 -0
  47. package/dist/case-workspace.d.ts +1 -0
  48. package/dist/case-workspace.js +392 -0
  49. package/dist/case-workspace.js.map +1 -0
  50. package/dist/cn-B6yFEsav.js +9 -0
  51. package/dist/cn-B6yFEsav.js.map +1 -0
  52. package/dist/components/ui/calendar.css +7 -0
  53. package/dist/cookieSettings-D_v3KS02.js +97 -0
  54. package/dist/cookieSettings-D_v3KS02.js.map +1 -0
  55. package/dist/dashboard/index.d.ts +16 -0
  56. package/dist/dashboard/src/ChartFrame.d.ts +18 -0
  57. package/dist/dashboard/src/ChartTooltip.d.ts +38 -0
  58. package/dist/dashboard/src/FilterBar.d.ts +23 -0
  59. package/dist/dashboard/src/KpiStatCard.d.ts +29 -0
  60. package/dist/dashboard/src/StatGrid.d.ts +15 -0
  61. package/dist/dashboard/src/TimeRangePicker.d.ts +14 -0
  62. package/dist/dashboard/src/chart.d.ts +10 -0
  63. package/dist/dashboard/src/format.d.ts +16 -0
  64. package/dist/dashboard/src/links.d.ts +2 -0
  65. package/dist/dashboard/src/useDashboardRange.d.ts +27 -0
  66. package/dist/dashboard.d.ts +1 -0
  67. package/dist/dashboard.js +361 -0
  68. package/dist/dashboard.js.map +1 -0
  69. package/dist/fonts.css +15 -0
  70. package/dist/hooks/access/AppAccessGate.d.ts +20 -0
  71. package/dist/hooks/access/AppAccessNotice.d.ts +8 -0
  72. package/dist/hooks/access/useAppAccess.d.ts +26 -0
  73. package/dist/hooks/config/businessLocale.d.ts +12 -0
  74. package/dist/hooks/config/currencies.d.ts +9 -0
  75. package/dist/hooks/index.d.ts +17 -0
  76. package/dist/hooks/picker/CrossAppRecordPicker.d.ts +37 -0
  77. package/dist/hooks/picker/managedAppPicker.d.ts +21 -0
  78. package/dist/hooks/picker/partnerPayload.d.ts +6 -0
  79. package/dist/hooks/routing/draftEntityId.d.ts +5 -0
  80. package/dist/hooks/routing/useRefetchOnRouteMatch.d.ts +6 -0
  81. package/dist/hooks/shell/resolveApiRoot.d.ts +13 -0
  82. package/dist/hooks/shell/shell.d.ts +4 -0
  83. package/dist/hooks/shell/useGenispacePlatformClient.d.ts +7 -0
  84. package/dist/hooks.d.ts +1 -0
  85. package/dist/hooks.js +42 -0
  86. package/dist/hooks.js.map +1 -0
  87. package/dist/index.d.ts +3 -0
  88. package/dist/index.js +77 -0
  89. package/dist/index.js.map +1 -0
  90. package/dist/kit.d.ts +50 -0
  91. package/dist/kit.js +2067 -0
  92. package/dist/kit.js.map +1 -0
  93. package/dist/page.d.ts +1 -0
  94. package/dist/page.js +5 -0
  95. package/dist/page.js.map +1 -0
  96. package/dist/shell-DIHnXIUb.js +6 -0
  97. package/dist/shell-DIHnXIUb.js.map +1 -0
  98. package/dist/shell.d.ts +30 -0
  99. package/dist/shell.js +104 -0
  100. package/dist/shell.js.map +1 -0
  101. package/dist/storage/assetPreview.d.ts +12 -0
  102. package/dist/storage/components/AssetThumbnail.d.ts +15 -0
  103. package/dist/storage/components/CopyStorageLinkButton.d.ts +13 -0
  104. package/dist/storage/components/StorageImage.d.ts +9 -0
  105. package/dist/storage/components/StoragePreviewContent.d.ts +22 -0
  106. package/dist/storage/components/StorageVideo.d.ts +9 -0
  107. package/dist/storage/copyTextToClipboard.d.ts +5 -0
  108. package/dist/storage/hooks/useAuthenticatedStorageBlobs.d.ts +3 -0
  109. package/dist/storage/hooks/useImageThumbnailBlobs.d.ts +4 -0
  110. package/dist/storage/hooks/useShareableStorageLink.d.ts +7 -0
  111. package/dist/storage/index.d.ts +12 -0
  112. package/dist/storage/openUrlInNewTab.d.ts +6 -0
  113. package/dist/storage/platformStorage.d.ts +43 -0
  114. package/dist/storage.d.ts +1 -0
  115. package/dist/storage.js +605 -0
  116. package/dist/storage.js.map +1 -0
  117. package/dist/style.css +1 -0
  118. package/dist/styles/base.css +616 -0
  119. package/dist/styles/reduced-motion.css +14 -0
  120. package/dist/styles/tailwind-preset.js +269 -0
  121. package/dist/task-workspace/domain.d.ts +35 -0
  122. package/dist/task-workspace/domain.js +45 -0
  123. package/dist/task-workspace/domain.js.map +1 -0
  124. package/dist/task-workspace/experience.d.ts +50 -0
  125. package/dist/task-workspace/index.d.ts +172 -0
  126. package/dist/task-workspace.d.ts +1 -0
  127. package/dist/task-workspace.js +626 -0
  128. package/dist/task-workspace.js.map +1 -0
  129. package/dist/ui/components/features/app/AppCheckboxInput.d.ts +9 -0
  130. package/dist/ui/components/features/app/AppConfirmDialog.d.ts +12 -0
  131. package/dist/ui/components/features/app/AppDashboardSkeleton.d.ts +9 -0
  132. package/dist/ui/components/features/app/AppDatePicker.d.ts +69 -0
  133. package/dist/ui/components/features/app/AppModal.d.ts +27 -0
  134. package/dist/ui/components/features/app/AppPageStates.d.ts +17 -0
  135. package/dist/ui/components/features/app/AppSelectInput.d.ts +10 -0
  136. package/dist/ui/components/features/app/AppTemporalInput.d.ts +19 -0
  137. package/dist/ui/components/features/app/Page.d.ts +14 -0
  138. package/dist/ui/components/features/app/QueryErrorAlert.d.ts +7 -0
  139. package/dist/ui/components/features/app/Sidebar.d.ts +47 -0
  140. package/dist/ui/components/features/app/index.d.ts +17 -0
  141. package/dist/ui/components/features/user/UserAvatar.d.ts +17 -0
  142. package/dist/ui/components/features/user/UserDisplay.d.ts +10 -0
  143. package/dist/ui/components/features/user/UserSelect.d.ts +14 -0
  144. package/dist/ui/components/features/user/useUserDirectory.d.ts +13 -0
  145. package/dist/ui/components/features/user/userDirectoryTypes.d.ts +18 -0
  146. package/dist/ui/components/patterns/form-section.d.ts +11 -0
  147. package/dist/ui/components/primitives/feedback/index.d.ts +2 -0
  148. package/dist/ui/components/primitives/feedback/toaster.d.ts +1 -0
  149. package/dist/ui/components/primitives/feedback/use-toast.d.ts +46 -0
  150. package/dist/ui/components/primitives/page-skeleton/ChartAreaSkeleton.d.ts +13 -0
  151. package/dist/ui/components/primitives/page-skeleton/ChartEmptyState.d.ts +14 -0
  152. package/dist/ui/components/primitives/page-skeleton/ComponentSkeletonShell.d.ts +16 -0
  153. package/dist/ui/components/primitives/page-skeleton/ConfigEditorSkeleton.d.ts +5 -0
  154. package/dist/ui/components/primitives/page-skeleton/DetailTabsSkeleton.d.ts +6 -0
  155. package/dist/ui/components/primitives/page-skeleton/EmptyStateBadge.d.ts +13 -0
  156. package/dist/ui/components/primitives/page-skeleton/FormCardSkeleton.d.ts +7 -0
  157. package/dist/ui/components/primitives/page-skeleton/FormFieldSkeleton.d.ts +6 -0
  158. package/dist/ui/components/primitives/page-skeleton/FormPageSkeleton.d.ts +6 -0
  159. package/dist/ui/components/primitives/page-skeleton/GridCardsSkeleton.d.ts +6 -0
  160. package/dist/ui/components/primitives/page-skeleton/ListSkeleton.d.ts +26 -0
  161. package/dist/ui/components/primitives/page-skeleton/PageHeaderSkeleton.d.ts +6 -0
  162. package/dist/ui/components/primitives/page-skeleton/SplitPaneSkeleton.d.ts +4 -0
  163. package/dist/ui/components/primitives/page-skeleton/StatsRowSkeleton.d.ts +5 -0
  164. package/dist/ui/components/primitives/page-skeleton/TableEmptyState.d.ts +27 -0
  165. package/dist/ui/components/primitives/page-skeleton/TablePageSkeleton.d.ts +8 -0
  166. package/dist/ui/components/primitives/page-skeleton/TabsBarSkeleton.d.ts +6 -0
  167. package/dist/ui/components/primitives/page-skeleton/index.d.ts +24 -0
  168. package/dist/ui/components/primitives/page-skeleton/skeletonMetrics.d.ts +9 -0
  169. package/dist/ui/components/primitives/page-skeleton/useVisibleCenter.d.ts +34 -0
  170. package/dist/ui/components/ui/accordion.d.ts +7 -0
  171. package/dist/ui/components/ui/ai-draft-banner.d.ts +21 -0
  172. package/dist/ui/components/ui/alert-dialog.d.ts +48 -0
  173. package/dist/ui/components/ui/alert.d.ts +8 -0
  174. package/dist/ui/components/ui/avatar.d.ts +6 -0
  175. package/dist/ui/components/ui/badge.d.ts +9 -0
  176. package/dist/ui/components/ui/breadcrumb.d.ts +19 -0
  177. package/dist/ui/components/ui/button.d.ts +11 -0
  178. package/dist/ui/components/ui/calendar.d.ts +8 -0
  179. package/dist/ui/components/ui/card.d.ts +8 -0
  180. package/dist/ui/components/ui/chart.d.ts +16 -0
  181. package/dist/ui/components/ui/checkbox.d.ts +4 -0
  182. package/dist/ui/components/ui/collapsible.d.ts +5 -0
  183. package/dist/ui/components/ui/column-config.d.ts +42 -0
  184. package/dist/ui/components/ui/date-picker.d.ts +9 -0
  185. package/dist/ui/components/ui/date-range-filter.d.ts +32 -0
  186. package/dist/ui/components/ui/date-range-picker.d.ts +11 -0
  187. package/dist/ui/components/ui/dialog-input.d.ts +17 -0
  188. package/dist/ui/components/ui/dialog-safe-select.d.ts +13 -0
  189. package/dist/ui/components/ui/dialog.d.ts +25 -0
  190. package/dist/ui/components/ui/dropdown-menu.d.ts +27 -0
  191. package/dist/ui/components/ui/feature-guide.d.ts +43 -0
  192. package/dist/ui/components/ui/form.d.ts +25 -0
  193. package/dist/ui/components/ui/help-tip.d.ts +29 -0
  194. package/dist/ui/components/ui/hint-notice.d.ts +22 -0
  195. package/dist/ui/components/ui/index.d.ts +6 -0
  196. package/dist/ui/components/ui/input.d.ts +3 -0
  197. package/dist/ui/components/ui/label.d.ts +5 -0
  198. package/dist/ui/components/ui/modal-container.d.ts +56 -0
  199. package/dist/ui/components/ui/modal-templates.d.ts +46 -0
  200. package/dist/ui/components/ui/multi-select.d.ts +20 -0
  201. package/dist/ui/components/ui/pagination.d.ts +28 -0
  202. package/dist/ui/components/ui/popover.d.ts +7 -0
  203. package/dist/ui/components/ui/progress.d.ts +7 -0
  204. package/dist/ui/components/ui/radio-button-group.d.ts +18 -0
  205. package/dist/ui/components/ui/radio-group.d.ts +5 -0
  206. package/dist/ui/components/ui/scroll-area.d.ts +5 -0
  207. package/dist/ui/components/ui/select.d.ts +16 -0
  208. package/dist/ui/components/ui/separator.d.ts +7 -0
  209. package/dist/ui/components/ui/sheet.d.ts +25 -0
  210. package/dist/ui/components/ui/sidebar-rail.d.ts +9 -0
  211. package/dist/ui/components/ui/skeleton.d.ts +2 -0
  212. package/dist/ui/components/ui/slider.d.ts +13 -0
  213. package/dist/ui/components/ui/switch.d.ts +4 -0
  214. package/dist/ui/components/ui/table.d.ts +10 -0
  215. package/dist/ui/components/ui/tabs.d.ts +10 -0
  216. package/dist/ui/components/ui/textarea.d.ts +3 -0
  217. package/dist/ui/components/ui/toast.d.ts +21 -0
  218. package/dist/ui/components/ui/toggle-group.d.ts +12 -0
  219. package/dist/ui/components/ui/toggle.d.ts +12 -0
  220. package/dist/ui/components/ui/tooltip.d.ts +7 -0
  221. package/dist/ui/components/ui/typography.d.ts +15 -0
  222. package/dist/ui/components/ui/underline-tabs.d.ts +13 -0
  223. package/dist/ui/components/ui/view-mode-toggle.d.ts +9 -0
  224. package/dist/ui/hooks/useIsMobile.d.ts +16 -0
  225. package/dist/ui/styles/design-tokens.d.ts +189 -0
  226. package/dist/ui/styles/z-index-layers.d.ts +46 -0
  227. package/dist/ui.d.ts +2 -0
  228. package/dist/ui.js +35 -0
  229. package/dist/ui.js.map +1 -0
  230. package/dist/useUserDirectory-CqkyCQoR.js +2377 -0
  231. package/dist/useUserDirectory-CqkyCQoR.js.map +1 -0
  232. package/dist/utils/cookieSettings.d.ts +12 -0
  233. package/dist/utils/data/countryCodes.d.ts +26 -0
  234. package/dist/utils/index.d.ts +18 -0
  235. package/dist/utils/utils/appPath.d.ts +5 -0
  236. package/dist/utils/utils/chunkLoadRecovery.d.ts +7 -0
  237. package/dist/utils/utils/cn.d.ts +3 -0
  238. package/dist/utils/utils/crossApp.d.ts +71 -0
  239. package/dist/utils/utils/debounce.d.ts +1 -0
  240. package/dist/utils/utils/formatUserLabel.d.ts +8 -0
  241. package/dist/utils/utils/formatting.d.ts +18 -0
  242. package/dist/utils/utils/logoutNotification.d.ts +28 -0
  243. package/dist/utils/utils/operatorLocale.d.ts +32 -0
  244. package/dist/utils/utils/routeLocalePrefetch.d.ts +5 -0
  245. package/dist/utils/utils/shellIframeUrl.d.ts +20 -0
  246. package/dist/utils/utils/spaceSettings.d.ts +20 -0
  247. package/dist/utils/utils/sso.d.ts +42 -0
  248. package/dist/utils/utils/throttle.d.ts +1 -0
  249. package/dist/utils/utils/timezones.d.ts +14 -0
  250. package/dist/utils/utils/toDateInputValue.d.ts +5 -0
  251. package/dist/utils/utils/watermark.d.ts +1 -0
  252. package/dist/utils.d.ts +1 -0
  253. package/dist/utils.js +1334 -0
  254. package/dist/utils.js.map +1 -0
  255. package/dist/vite.d.ts +22 -0
  256. package/dist/vite.js +74 -0
  257. package/dist/vite.js.map +1 -0
  258. package/package.json +191 -0
package/dist/utils.js ADDED
@@ -0,0 +1,1334 @@
1
+ import { c as Sn } from "./cn-B6yFEsav.js";
2
+ import { g as J } from "./cookieSettings-D_v3KS02.js";
3
+ import { b as An, c as wn, d as Ln, e as Tn, i as bn, r as In, f as kn, s as Mn, h as On, a as Pn, j as Nn } from "./cookieSettings-D_v3KS02.js";
4
+ function Q() {
5
+ return typeof window > "u" ? {} : window.__APP_CONFIG__ || {};
6
+ }
7
+ function U(e) {
8
+ return typeof e == "string" && e.trim() !== "" ? e.trim().replace(/\/$/, "") : "";
9
+ }
10
+ function v(e) {
11
+ const n = Q();
12
+ switch (e) {
13
+ case "hub":
14
+ return U(n.APP_URL);
15
+ case "console":
16
+ return U(n.CONSOLE_URL);
17
+ case "shell":
18
+ return U(n.SHELL_URL);
19
+ case "workbench":
20
+ return U(n.WORKBENCH_URL);
21
+ case "chat":
22
+ return U(n.CHAT_URL);
23
+ default:
24
+ return "";
25
+ }
26
+ }
27
+ function X(e, n = "") {
28
+ const a = v(e), o = n ? n.startsWith("/") ? n : `/${n}` : "";
29
+ return a ? `${a}${o}` : o || "/";
30
+ }
31
+ function Pe(e, n = "", a) {
32
+ const o = v(e), t = X(e, n);
33
+ if (!o && a) {
34
+ a(t);
35
+ return;
36
+ }
37
+ typeof window < "u" && window.location.assign(t);
38
+ }
39
+ function ee(e) {
40
+ if ((e.kind || "").toUpperCase() === "WORKBENCH") return !!e.workbenchId;
41
+ const a = (e.type || "").toUpperCase();
42
+ return (a === "WORKBENCH" || a === "LOWCODE") && !!e.workbenchId;
43
+ }
44
+ function ne(e) {
45
+ const n = (e.kind || "").toUpperCase();
46
+ if (n === "BUILT_IN" || n === "BUILTIN" || n === "SHELL") return !0;
47
+ const a = (e.type || "").toUpperCase();
48
+ return a === "GENIAPP" || a === "PLATFORM_BUILTIN";
49
+ }
50
+ function Ne(e) {
51
+ if (ee(e)) {
52
+ const n = v("workbench");
53
+ return n ? `${n}/workbench/${e.workbenchId}` : null;
54
+ }
55
+ if (ne(e)) {
56
+ const n = v("shell");
57
+ return n ? `${n}/${e.identifier}` : null;
58
+ }
59
+ return e.ingressHost ? `https://${e.ingressHost}` : null;
60
+ }
61
+ function Ee(e) {
62
+ const n = Array.isArray(e.accessibleApps) ? e.accessibleApps : [];
63
+ if (e.canAccessConsole && e.lastSurface === "console")
64
+ return { kind: "console", path: "/dashboard" };
65
+ if (e.lastAppId) {
66
+ const a = n.find((o) => o.id === e.lastAppId);
67
+ if (a) return { kind: "app", app: a };
68
+ }
69
+ return n.length === 1 && !e.canAccessConsole ? { kind: "app", app: n[0] } : n.length > 0 ? { kind: "launcher" } : e.canAccessConsole ? { kind: "console", path: "/dashboard" } : { kind: "home" };
70
+ }
71
+ function H(e) {
72
+ const n = e.getFullYear(), a = String(e.getMonth() + 1).padStart(2, "0"), o = String(e.getDate()).padStart(2, "0");
73
+ return `${n}-${a}-${o}`;
74
+ }
75
+ function ae(e) {
76
+ if (e == null || e === "") return "";
77
+ if (e instanceof Date)
78
+ return Number.isNaN(e.getTime()) ? "" : H(e);
79
+ const n = String(e).trim();
80
+ if (/^\d{4}-\d{2}-\d{2}$/.test(n)) return n;
81
+ const a = new Date(n);
82
+ return Number.isNaN(a.getTime()) ? "" : H(a);
83
+ }
84
+ function P(e) {
85
+ return e || (typeof navigator < "u" && navigator.language ? navigator.language : "en-US");
86
+ }
87
+ function Ue(e, n) {
88
+ if (!e) return "-";
89
+ const a = new Date(e), o = P(n);
90
+ return a.toLocaleString(o, {
91
+ year: "numeric",
92
+ month: "2-digit",
93
+ day: "2-digit",
94
+ hour: "2-digit",
95
+ minute: "2-digit",
96
+ second: "2-digit"
97
+ });
98
+ }
99
+ function oe(e, n) {
100
+ if (!e) return "0";
101
+ const a = P(n);
102
+ return e.toLocaleString(a);
103
+ }
104
+ function Re(e, n = 2, a) {
105
+ if (e === 0)
106
+ return `0 ${a ? a("common.formatting.bytes", "Bytes") : "Bytes"}`;
107
+ const o = 1024, t = n < 0 ? 0 : n, i = ["Bytes", "KB", "MB", "GB", "TB", "PB"], r = Math.max(0, Math.floor(Math.log(e) / Math.log(o))), d = parseFloat((e / Math.pow(o, r)).toFixed(t)), m = a ? a(`common.formatting.${i[r].toLowerCase()}`, i[r]) : i[r];
108
+ return `${d} ${m}`;
109
+ }
110
+ function _e(e, n = 1, a) {
111
+ if (!e || e === 0) return "0";
112
+ const o = Math.abs(e), t = e < 0 ? "-" : "", i = P(a);
113
+ if (o < 1e3)
114
+ return t + o.toLocaleString(i);
115
+ const r = [
116
+ { value: 1e12, symbol: "T" },
117
+ { value: 1e9, symbol: "B" },
118
+ { value: 1e6, symbol: "M" },
119
+ { value: 1e3, symbol: "K" }
120
+ ];
121
+ for (const d of r)
122
+ if (o >= d.value) {
123
+ const l = (o / d.value).toFixed(n).replace(/\.?0+$/, "");
124
+ return t + l + d.symbol;
125
+ }
126
+ return t + o.toLocaleString(i);
127
+ }
128
+ function Be(e, n = !0, a) {
129
+ return !e && e !== 0 ? "0" : oe(e, a);
130
+ }
131
+ const te = (e, n) => {
132
+ const a = Math.floor(e / 60), o = (e % 60).toFixed(2), t = n ? n("common.formatting.minute_short", "m") : "m", i = n ? n("common.formatting.second_short", "s") : "s";
133
+ return `${a}${t} ${o}${i}`;
134
+ }, $e = (e, n) => {
135
+ const a = Math.floor(e / 1e3);
136
+ return te(a, n);
137
+ }, ve = (e, n) => {
138
+ if (!e) return "-";
139
+ const a = new Date(e), o = P(n);
140
+ return a.toLocaleString(o);
141
+ };
142
+ function De(e, n) {
143
+ const a = ae(e);
144
+ if (!a) return "—";
145
+ try {
146
+ const o = J(), t = P(n);
147
+ return new Intl.DateTimeFormat(t, {
148
+ timeZone: o,
149
+ year: "numeric",
150
+ month: "2-digit",
151
+ day: "2-digit"
152
+ }).format(/* @__PURE__ */ new Date(`${a}T12:00:00Z`));
153
+ } catch {
154
+ return a;
155
+ }
156
+ }
157
+ function Ge(e, n) {
158
+ if (!e) return "—";
159
+ try {
160
+ const a = J(), o = P(n);
161
+ return new Intl.DateTimeFormat(o, {
162
+ timeZone: a,
163
+ year: "numeric",
164
+ month: "2-digit",
165
+ day: "2-digit",
166
+ hour: "2-digit",
167
+ minute: "2-digit"
168
+ }).format(new Date(e));
169
+ } catch {
170
+ return e.slice(0, 10);
171
+ }
172
+ }
173
+ const Fe = (e, n) => {
174
+ try {
175
+ const a = new Date(e), t = Math.floor(((/* @__PURE__ */ new Date()).getTime() - a.getTime()) / 1e3);
176
+ if (t < 60)
177
+ return n ? n("common.time.just_now", "Just now") : "Just now";
178
+ if (t < 3600) {
179
+ const i = Math.floor(t / 60);
180
+ return n ? n("common.time.minutes_ago", "{{minutes}} minutes ago", { minutes: i }) : `${i} minutes ago`;
181
+ } else if (t < 86400) {
182
+ const i = Math.floor(t / 3600);
183
+ return n ? n("common.time.hours_ago", "{{hours}} hours ago", { hours: i }) : `${i} hours ago`;
184
+ } else if (t < 2592e3) {
185
+ const i = Math.floor(t / 86400);
186
+ return n ? n("common.time.days_ago", "{{days}} days ago", { days: i }) : `${i} days ago`;
187
+ } else if (t < 31536e3) {
188
+ const i = Math.floor(t / 2592e3);
189
+ return n ? n("common.time.months_ago", "{{months}} months ago", { months: i }) : `${i} months ago`;
190
+ } else {
191
+ const i = Math.floor(t / 31536e3);
192
+ return n ? n("common.time.years_ago", "{{years}} years ago", { years: i }) : `${i} years ago`;
193
+ }
194
+ } catch (a) {
195
+ return console.warn("Time formatting failed:", a), n ? n("common.time.unknown", "Unknown time") : "Unknown time";
196
+ }
197
+ };
198
+ function Ke(e, n, a = "—") {
199
+ const o = e?.name?.trim();
200
+ if (o) return o;
201
+ const t = e?.email?.trim();
202
+ if (t) return t;
203
+ const i = n?.trim();
204
+ return i ? i.length <= 12 ? i : `${i.slice(0, 8)}…` : a;
205
+ }
206
+ function He(e, n) {
207
+ let a;
208
+ return function(...o) {
209
+ clearTimeout(a), a = setTimeout(() => e.apply(this, o), n);
210
+ };
211
+ }
212
+ function ze(e, n) {
213
+ let a = 0, o = null;
214
+ return function(...t) {
215
+ const i = Date.now(), r = i - a;
216
+ r >= n ? (a = i, e.apply(this, t)) : (o && clearTimeout(o), o = setTimeout(() => {
217
+ a = Date.now(), e.apply(this, t), o = null;
218
+ }, n - r));
219
+ };
220
+ }
221
+ const ie = "genispace:chunk_reload_once";
222
+ function V(e) {
223
+ return e?.storageKey ?? ie;
224
+ }
225
+ function x(e) {
226
+ if (!e || typeof e != "object") return !1;
227
+ const n = e;
228
+ if (n.name === "ChunkLoadError") return !0;
229
+ const a = String(n.message ?? "");
230
+ return a.includes("Failed to fetch dynamically imported module") || a.includes("Importing a module script failed") || a.includes("error loading dynamically imported module") || a.includes("Loading chunk") || a.includes("dynamically imported module");
231
+ }
232
+ function re(e) {
233
+ if (!e) return !1;
234
+ try {
235
+ return new URL(e, typeof window < "u" ? window.location.origin : "http://localhost").pathname.includes("/static/");
236
+ } catch {
237
+ return e.includes("/static/");
238
+ }
239
+ }
240
+ function D(e) {
241
+ return typeof window > "u" || typeof sessionStorage > "u" || sessionStorage.getItem(e) ? !1 : (sessionStorage.setItem(e, "1"), window.location.reload(), !0);
242
+ }
243
+ function We(e, n) {
244
+ return x(e) ? D(V(n)) : !1;
245
+ }
246
+ let z = !1;
247
+ function Je(e) {
248
+ if (typeof window > "u" || z)
249
+ return;
250
+ z = !0;
251
+ const n = V(e);
252
+ window.addEventListener("unhandledrejection", (a) => {
253
+ x(a.reason) && (a.preventDefault(), D(n));
254
+ }), window.addEventListener(
255
+ "error",
256
+ (a) => {
257
+ const o = a.target;
258
+ !(o instanceof HTMLScriptElement) || !o.src || re(o.src) && D(n);
259
+ },
260
+ !0
261
+ );
262
+ }
263
+ function de(e) {
264
+ return !e || e === "" ? "/" : e.startsWith("/") ? e : `/${e}`;
265
+ }
266
+ function le(e, n) {
267
+ const a = de(e);
268
+ if (n === "/")
269
+ return a === "/" || a === "";
270
+ const o = n.endsWith("/") ? n.slice(0, -1) : n;
271
+ return o.startsWith("/") ? a === o || a.startsWith(`${o}/`) : !1;
272
+ }
273
+ function Ve(e, n) {
274
+ const a = [...n].sort((o, t) => t.prefix.length - o.prefix.length);
275
+ for (const o of a)
276
+ if (le(e, o.prefix))
277
+ return [...o.namespaces];
278
+ return [];
279
+ }
280
+ const $ = "genispace_sso_oauth_redirect_uri";
281
+ function xe(e) {
282
+ const {
283
+ getConfig: n,
284
+ appType: a,
285
+ defaultReturnPath: o = "/",
286
+ identifyApp: t = () => {
287
+ const g = window.location.hostname;
288
+ return g.includes("ebook") ? "ebook" : g.includes("workbench") ? "workbench" : "app";
289
+ },
290
+ getOAuthRedirectUri: i,
291
+ openLoginUrl: r
292
+ } = e;
293
+ let d = `${window.location.origin}/sso/callback`;
294
+ try {
295
+ const g = sessionStorage.getItem($);
296
+ g && (d = g);
297
+ } catch {
298
+ }
299
+ const m = "openid profile email";
300
+ let l = null, c = null;
301
+ async function C() {
302
+ if (l)
303
+ return l;
304
+ if (c)
305
+ return c;
306
+ const g = window.location.origin, p = n().API_BASE_URL;
307
+ return c = (async () => {
308
+ try {
309
+ const S = await fetch(
310
+ `${p}/sso/applications/by-domain?domain=${encodeURIComponent(g)}`
311
+ );
312
+ if (!S.ok) {
313
+ if (S.status === 429)
314
+ return console.warn("[SSO] Too many requests; waiting before retry..."), await new Promise((_) => setTimeout(_, 1e3)), c = null, C();
315
+ throw new Error(`Failed to get application config: ${S.status}`);
316
+ }
317
+ const y = await S.json();
318
+ if (!y.success || !y.data)
319
+ throw new Error("Invalid response from application config endpoint");
320
+ const N = y.data;
321
+ return l = N, N;
322
+ } catch (S) {
323
+ throw console.error("Failed to get application config:", S), new Error("Failed to get application config. Please check your network connection.");
324
+ } finally {
325
+ c = null;
326
+ }
327
+ })(), c;
328
+ }
329
+ async function u(g) {
330
+ try {
331
+ const p = I(g), S = await C(), y = S.client_id, _ = typeof window < "u" && window.__APP_CONFIG__?.APP_URL || "" || n().APP_URL || "http://localhost:5018";
332
+ let w = `${window.location.origin}/sso/callback`;
333
+ try {
334
+ const B = await i?.();
335
+ B && (w = B);
336
+ } catch (B) {
337
+ console.warn("[SSO] getOAuthRedirectUri failed; using default redirect_uri", B);
338
+ }
339
+ d = w;
340
+ try {
341
+ sessionStorage.setItem($, w);
342
+ } catch {
343
+ }
344
+ const h = new URL(`${_}/sso/login`);
345
+ h.searchParams.set("client_id", y), h.searchParams.set("redirect_uri", w), h.searchParams.set("response_type", "code"), h.searchParams.set("scope", m), h.searchParams.set("state", p), h.searchParams.set("prompt", S.is_platform_core ? "none" : "consent");
346
+ const E = t();
347
+ h.searchParams.set("from", E);
348
+ const k = h.toString();
349
+ r ? await Promise.resolve(r(k)) : window.location.href = k;
350
+ } catch (p) {
351
+ throw console.error("Failed to start SSO login:", p), p;
352
+ }
353
+ }
354
+ async function f() {
355
+ const g = new URLSearchParams(window.location.search), p = g.get("code"), S = g.get("error");
356
+ if (S)
357
+ throw console.error("[SSO] handleCallback: OAuth error", S), new Error(`OAuth error: ${S}`);
358
+ if (!p)
359
+ throw console.error("[SSO] handleCallback: authorization code not found"), new Error("Authorization code not found");
360
+ try {
361
+ const N = (await C()).app_type || a, K = `${n().API_BASE_URL}/sso/platform/${N}/callback`, w = await fetch(K, {
362
+ method: "POST",
363
+ headers: {
364
+ "Content-Type": "application/json"
365
+ },
366
+ body: JSON.stringify({
367
+ code: p,
368
+ redirectUri: d
369
+ })
370
+ });
371
+ if (!w.ok) {
372
+ const E = await w.text();
373
+ console.error("[SSO] handleCallback: callback proxy failed", {
374
+ status: w.status,
375
+ statusText: w.statusText,
376
+ errorText: E
377
+ });
378
+ let k;
379
+ try {
380
+ k = JSON.parse(E);
381
+ } catch {
382
+ k = { message: E || "Unknown error" };
383
+ }
384
+ throw new Error(k.message || `Token exchange failed: ${w.status}`);
385
+ }
386
+ const h = await w.json();
387
+ if (!h.success || !h.data)
388
+ throw console.error("[SSO] handleCallback: invalid response data", h), new Error(h.message || "Invalid response from callback endpoint");
389
+ try {
390
+ sessionStorage.removeItem($);
391
+ } catch {
392
+ }
393
+ return {
394
+ token: h.data.token,
395
+ refreshToken: h.data.refreshToken,
396
+ expiresIn: h.data.expiresIn,
397
+ user: h.data.user
398
+ };
399
+ } catch (y) {
400
+ throw console.error("[SSO] handleCallback: error while handling callback", {
401
+ error: y instanceof Error ? y.message : String(y),
402
+ stack: y instanceof Error ? y.stack : void 0
403
+ }), y;
404
+ }
405
+ }
406
+ function I(g) {
407
+ const p = {
408
+ nonce: Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15),
409
+ returnPath: g || o || window.location.pathname + window.location.search,
410
+ timestamp: Date.now()
411
+ };
412
+ return sessionStorage.setItem("oauth_state", JSON.stringify(p)), btoa(JSON.stringify(p));
413
+ }
414
+ function b(g) {
415
+ try {
416
+ const p = JSON.parse(atob(g)), S = sessionStorage.getItem("oauth_state");
417
+ return S && JSON.parse(S).nonce === p.nonce && sessionStorage.removeItem("oauth_state"), p;
418
+ } catch (p) {
419
+ return console.error("Failed to parse state:", p), null;
420
+ }
421
+ }
422
+ function R() {
423
+ l = null;
424
+ try {
425
+ sessionStorage.removeItem($);
426
+ } catch {
427
+ }
428
+ }
429
+ return {
430
+ startLogin: u,
431
+ handleCallback: f,
432
+ parseState: b,
433
+ clearCache: R
434
+ };
435
+ }
436
+ const se = "/logout-notification", ce = "logout-completed";
437
+ function me() {
438
+ return typeof window > "u" ? {} : window.__APP_CONFIG__ || {};
439
+ }
440
+ function fe() {
441
+ if (typeof window > "u") return [];
442
+ const e = me(), n = [
443
+ e.APP_URL,
444
+ e.CONSOLE_URL,
445
+ e.WORKBENCH_URL,
446
+ e.CHAT_URL,
447
+ e.EBOOK_URL,
448
+ e.PARTNER_URL,
449
+ e.SHELL_URL
450
+ ], a = /* @__PURE__ */ new Set([window.location.origin]), o = [];
451
+ for (const t of n) {
452
+ const i = typeof t == "string" ? t.trim().replace(/\/+$/, "") : "";
453
+ if (!i) continue;
454
+ let r = "";
455
+ try {
456
+ r = new URL(i, window.location.origin).origin;
457
+ } catch {
458
+ continue;
459
+ }
460
+ a.has(r) || (a.add(r), o.push(`${i}${se}`));
461
+ }
462
+ return o;
463
+ }
464
+ let G = !1;
465
+ function Ze() {
466
+ return G;
467
+ }
468
+ function je(e = fe(), n = 2500) {
469
+ return typeof window > "u" || typeof document > "u" || e.length === 0 ? Promise.resolve() : (G = !0, new Promise((a) => {
470
+ const o = [], t = new Set(
471
+ e.map((l) => {
472
+ try {
473
+ return new URL(l, window.location.origin).origin;
474
+ } catch {
475
+ return "";
476
+ }
477
+ }).filter(Boolean)
478
+ );
479
+ let i = 0, r = !1;
480
+ const d = () => {
481
+ if (!r) {
482
+ r = !0, G = !1, window.removeEventListener("message", m), window.clearTimeout(i);
483
+ for (const l of o) l.parentNode?.removeChild(l);
484
+ a();
485
+ }
486
+ }, m = (l) => {
487
+ l.data === ce && (t.delete(l.origin), t.size === 0 && d());
488
+ };
489
+ window.addEventListener("message", m), i = window.setTimeout(d, n);
490
+ for (const l of e) {
491
+ const c = document.createElement("iframe");
492
+ c.style.display = "none", c.setAttribute("aria-hidden", "true"), c.src = l, document.body.appendChild(c), o.push(c);
493
+ }
494
+ }));
495
+ }
496
+ const ue = [
497
+ "UTC",
498
+ "Etc/UTC",
499
+ // Asia / Oceania
500
+ "Asia/Bangkok",
501
+ "Asia/Dubai",
502
+ "Asia/Ho_Chi_Minh",
503
+ "Asia/Hong_Kong",
504
+ "Asia/Jakarta",
505
+ "Asia/Jerusalem",
506
+ "Asia/Kolkata",
507
+ "Asia/Kuala_Lumpur",
508
+ "Asia/Manila",
509
+ "Asia/Riyadh",
510
+ "Asia/Seoul",
511
+ "Asia/Shanghai",
512
+ "Asia/Singapore",
513
+ "Asia/Taipei",
514
+ "Asia/Tokyo",
515
+ "Australia/Melbourne",
516
+ "Australia/Sydney",
517
+ "Pacific/Auckland",
518
+ "Pacific/Honolulu",
519
+ // Europe
520
+ "Europe/Amsterdam",
521
+ "Europe/Berlin",
522
+ "Europe/Dublin",
523
+ "Europe/Istanbul",
524
+ "Europe/London",
525
+ "Europe/Madrid",
526
+ "Europe/Moscow",
527
+ "Europe/Paris",
528
+ "Europe/Rome",
529
+ "Europe/Warsaw",
530
+ "Europe/Zurich",
531
+ // Africa
532
+ "Africa/Cairo",
533
+ "Africa/Johannesburg",
534
+ "Africa/Lagos",
535
+ "Africa/Nairobi",
536
+ // Americas
537
+ "America/Anchorage",
538
+ "America/Argentina/Buenos_Aires",
539
+ "America/Chicago",
540
+ "America/Denver",
541
+ "America/Lima",
542
+ "America/Los_Angeles",
543
+ "America/Mexico_City",
544
+ "America/New_York",
545
+ "America/Phoenix",
546
+ "America/Santiago",
547
+ "America/Sao_Paulo",
548
+ "America/Toronto",
549
+ "America/Vancouver"
550
+ ];
551
+ function Ce() {
552
+ try {
553
+ const e = Intl;
554
+ if (typeof e.supportedValuesOf == "function")
555
+ return e.supportedValuesOf("timeZone");
556
+ } catch {
557
+ }
558
+ return null;
559
+ }
560
+ function ge() {
561
+ const e = Ce();
562
+ return e?.length ? [...e].sort((n, a) => n.localeCompare(a)) : [...ue].sort((n, a) => n.localeCompare(a));
563
+ }
564
+ function pe(e, n) {
565
+ try {
566
+ return new Intl.DateTimeFormat("en-US", {
567
+ timeZone: e,
568
+ timeZoneName: "shortOffset"
569
+ }).formatToParts(n).find((o) => o.type === "timeZoneName")?.value ?? "";
570
+ } catch {
571
+ return "";
572
+ }
573
+ }
574
+ function he(e, n) {
575
+ try {
576
+ const o = new Intl.DisplayNames([n], {
577
+ type: "timeZone"
578
+ }).of(e);
579
+ if (o) return o;
580
+ } catch {
581
+ }
582
+ return e;
583
+ }
584
+ function Ye(e, n = /* @__PURE__ */ new Date()) {
585
+ const o = ge().map((t) => {
586
+ const i = he(t, e), r = pe(t, n), d = r ? `${i} (${r})` : i;
587
+ return { value: t, label: d };
588
+ });
589
+ return o.sort((t, i) => t.label.localeCompare(i.label, e, { sensitivity: "base" })), o;
590
+ }
591
+ function Z(e) {
592
+ return (e || "en").split("-")[0].toLowerCase().startsWith("zh") ? "zh" : "en";
593
+ }
594
+ function s(e) {
595
+ return e !== null && typeof e == "object" && !Array.isArray(e);
596
+ }
597
+ function L(e, n) {
598
+ if (!s(e) || !s(n))
599
+ return e;
600
+ const a = { ...e };
601
+ if (n.description !== void 0 && (a.description = n.description), n.title !== void 0 && (a.title = n.title), n.properties && s(e.properties)) {
602
+ a.properties = { ...e.properties };
603
+ const o = a.properties, t = n.properties;
604
+ if (s(t))
605
+ for (const [i, r] of Object.entries(t))
606
+ o[i] && s(r) && (o[i] = L(o[i], r));
607
+ }
608
+ n.items && e.items !== void 0 && (Array.isArray(e.items) && Array.isArray(n.items) ? a.items = e.items.map((o, t) => {
609
+ const i = n.items[t];
610
+ return i && s(i) ? L(o, i) : o;
611
+ }) : a.items = L(e.items, n.items));
612
+ for (const o of ["oneOf", "anyOf", "allOf"]) {
613
+ const t = e[o], i = n[o];
614
+ Array.isArray(t) && Array.isArray(i) && i.length && (a[o] = t.map((r, d) => {
615
+ const m = i[d];
616
+ return m && s(m) ? L(r, m) : r;
617
+ }));
618
+ }
619
+ return s(e.not) && s(n.not) && (a.not = L(e.not, n.not)), s(e.additionalProperties) && s(n.additionalProperties) && (a.additionalProperties = L(
620
+ e.additionalProperties,
621
+ n.additionalProperties
622
+ )), a;
623
+ }
624
+ function A(e) {
625
+ if (!s(e)) return !1;
626
+ if (e.title !== void 0 || e.description !== void 0) return !0;
627
+ if (s(e.properties)) {
628
+ for (const n of Object.keys(e.properties))
629
+ if (A(e.properties[n])) return !0;
630
+ }
631
+ if (Array.isArray(e.items)) {
632
+ for (const n of e.items)
633
+ if (n != null && A(n)) return !0;
634
+ }
635
+ for (const n of ["oneOf", "anyOf", "allOf"]) {
636
+ const a = e[n];
637
+ if (Array.isArray(a)) {
638
+ for (const o of a)
639
+ if (o != null && A(o)) return !0;
640
+ }
641
+ }
642
+ return !!(s(e.not) && A(e.not) || s(e.additionalProperties) && A(e.additionalProperties));
643
+ }
644
+ function Se(e, n) {
645
+ const a = typeof e.title == "string" ? e.title : void 0, o = n.title !== void 0 && typeof n.title == "string" ? n.title : void 0;
646
+ if (o !== void 0 && o.length > 0) return o;
647
+ if (a !== void 0 && a.length > 0) return a;
648
+ }
649
+ function ye(e, n) {
650
+ const a = e.description, o = n.description;
651
+ if (o != null && String(o).length > 0) return o;
652
+ if (a != null && String(a).length > 0) return a;
653
+ }
654
+ function T(e, n) {
655
+ if (!s(e)) return;
656
+ const a = s(n) ? n : {}, o = {}, t = Se(e, a);
657
+ t !== void 0 && (o.title = t);
658
+ const i = ye(e, a);
659
+ if (i !== void 0 && (o.description = i), s(e.properties)) {
660
+ const r = s(a.properties) ? a.properties : {}, d = {};
661
+ for (const m of Object.keys(e.properties)) {
662
+ const l = T(e.properties[m], r[m]);
663
+ l !== void 0 && A(l) && (d[m] = l);
664
+ }
665
+ Object.keys(d).length > 0 && (o.properties = d);
666
+ }
667
+ if (e.items !== void 0) {
668
+ const r = a.items;
669
+ if (Array.isArray(e.items)) {
670
+ const d = Array.isArray(r) ? r : [], m = e.items.map((l, c) => {
671
+ const C = T(l, d[c]);
672
+ return C !== void 0 && A(C) ? C : null;
673
+ });
674
+ m.some((l) => l !== null) && (o.items = m);
675
+ } else {
676
+ const d = T(e.items, r);
677
+ d !== void 0 && A(d) && (o.items = d);
678
+ }
679
+ }
680
+ for (const r of ["oneOf", "anyOf", "allOf"]) {
681
+ const d = e[r], m = a[r];
682
+ if (Array.isArray(d) && d.length > 0) {
683
+ const l = Array.isArray(m) ? m : [], c = d.map((C, u) => {
684
+ const f = T(C, l[u]);
685
+ return f !== void 0 && A(f) ? f : null;
686
+ });
687
+ c.some((C) => C !== null) && (o[r] = c);
688
+ }
689
+ }
690
+ if (s(e.not)) {
691
+ const r = T(e.not, a.not);
692
+ r !== void 0 && A(r) && (o.not = r);
693
+ }
694
+ if (s(e.additionalProperties)) {
695
+ const r = T(
696
+ e.additionalProperties,
697
+ a.additionalProperties
698
+ );
699
+ r !== void 0 && A(r) && (o.additionalProperties = r);
700
+ }
701
+ if (A(o))
702
+ return o;
703
+ }
704
+ function qe(e) {
705
+ const n = s(e.metadata) ? { ...e.metadata } : {}, a = n.locales;
706
+ if (!s(a))
707
+ return n;
708
+ const o = { ...a }, t = new Set(e.methods.map((r) => r.identifier)), i = new Map(e.methods.map((r) => [r.identifier, r]));
709
+ for (const r of Object.keys(o)) {
710
+ const d = o[r];
711
+ if (!s(d)) continue;
712
+ const m = { ...d };
713
+ if (e.operatorInputSchema !== void 0) {
714
+ const l = T(
715
+ e.operatorInputSchema,
716
+ m.inputSchema
717
+ );
718
+ l ? m.inputSchema = l : delete m.inputSchema;
719
+ }
720
+ if (e.operatorOutputSchema !== void 0) {
721
+ const l = T(
722
+ e.operatorOutputSchema,
723
+ m.outputSchema
724
+ );
725
+ l ? m.outputSchema = l : delete m.outputSchema;
726
+ }
727
+ if (Array.isArray(d.methods)) {
728
+ const l = [];
729
+ for (const c of d.methods) {
730
+ if (!s(c) || typeof c.identifier != "string" || !t.has(c.identifier)) continue;
731
+ const C = i.get(c.identifier);
732
+ if (!C) continue;
733
+ const u = { ...c }, f = T(C.inputSchema, c.inputSchema);
734
+ f ? u.inputSchema = f : delete u.inputSchema;
735
+ const I = T(C.outputSchema, c.outputSchema);
736
+ I ? u.outputSchema = I : delete u.outputSchema, l.push(u);
737
+ }
738
+ m.methods = l;
739
+ }
740
+ o[r] = m;
741
+ }
742
+ return n.locales = o, n;
743
+ }
744
+ function j(e) {
745
+ delete e.systemConfiguration, Array.isArray(e.methods) && (e.methods = e.methods.map((a) => {
746
+ if (!s(a)) return a;
747
+ const o = a, { systemConfiguration: t, ...i } = o;
748
+ return i;
749
+ }));
750
+ const n = e.userOperator;
751
+ s(n) && j(n);
752
+ }
753
+ function Ae(e) {
754
+ return e ? !!(e.name || e.description !== void 0 && e.description !== null || e.inputSchema || e.outputSchema || Array.isArray(e.methods) && e.methods.length > 0) : !1;
755
+ }
756
+ function W(e) {
757
+ const n = e.linkedSystemMetadata;
758
+ if (!s(n)) {
759
+ delete e.linkedSystemMetadata;
760
+ return;
761
+ }
762
+ const a = n.metadata;
763
+ if (!s(a) || !s(a.locales)) {
764
+ delete e.linkedSystemMetadata;
765
+ return;
766
+ }
767
+ const o = a.locales, t = s(o.zh) ? o.zh : null;
768
+ if (!t) {
769
+ delete e.linkedSystemMetadata;
770
+ return;
771
+ }
772
+ const i = s(e.metadata) ? { ...e.metadata } : {}, r = s(i.locales) ? { ...i.locales } : {}, d = s(r.zh) ? r.zh : null;
773
+ Ae(d) || (r.zh = { ...t }, i.locales = r, e.metadata = i), delete e.linkedSystemMetadata;
774
+ }
775
+ function F(e, n) {
776
+ if (Z(n) !== "zh")
777
+ return;
778
+ const a = e.metadata;
779
+ if (!s(a))
780
+ return;
781
+ const o = a.locales;
782
+ if (!s(o))
783
+ return;
784
+ const t = o.zh;
785
+ if (!s(t))
786
+ return;
787
+ typeof t.name == "string" && t.name && (e.name = t.name), t.description !== void 0 && t.description !== null && (e.description = t.description);
788
+ const i = t.methods;
789
+ if (Array.isArray(e.methods) && Array.isArray(i)) {
790
+ const r = new Map(
791
+ i.filter((d) => s(d) && typeof d.identifier == "string").map((d) => [d.identifier, d])
792
+ );
793
+ e.methods = e.methods.map((d) => {
794
+ const m = d.identifier, l = typeof m == "string" ? r.get(m) : void 0;
795
+ if (!l)
796
+ return { ...d };
797
+ const c = { ...d };
798
+ return typeof l.name == "string" && l.name && (c.name = l.name), l.description !== void 0 && l.description !== null && (c.description = l.description), l.inputSchema && c.inputSchema && (c.inputSchema = L(c.inputSchema, l.inputSchema)), l.outputSchema && c.outputSchema && (c.outputSchema = L(c.outputSchema, l.outputSchema)), c;
799
+ });
800
+ }
801
+ t.inputSchema && e.inputSchema && (e.inputSchema = L(e.inputSchema, t.inputSchema)), t.outputSchema && e.outputSchema && (e.outputSchema = L(e.outputSchema, t.outputSchema));
802
+ }
803
+ function Qe(e, n) {
804
+ if (!s(e))
805
+ return e;
806
+ let a;
807
+ try {
808
+ a = structuredClone(e);
809
+ } catch {
810
+ a = JSON.parse(JSON.stringify(e));
811
+ }
812
+ j(a);
813
+ const o = a.userOperator;
814
+ return s(o) && (W(o), F(o, n)), W(a), F(a, n), a;
815
+ }
816
+ function Xe(e, n) {
817
+ let a;
818
+ try {
819
+ a = structuredClone(e);
820
+ } catch {
821
+ a = JSON.parse(JSON.stringify(e));
822
+ }
823
+ return F(a.operator, n), a;
824
+ }
825
+ function en(e, n) {
826
+ const a = e.operator, o = Z(n), t = Array.isArray(a.methods) ? a.methods : [], i = (C) => C.map((u) => ({
827
+ identifier: typeof u.identifier == "string" ? u.identifier : String(u.identifier ?? ""),
828
+ name: typeof u.name == "string" ? u.name : String(u.name ?? ""),
829
+ description: u.description != null ? String(u.description) : ""
830
+ }));
831
+ if (o !== "zh")
832
+ return {
833
+ name: typeof a.name == "string" ? a.name : String(a.name ?? ""),
834
+ description: a.description != null ? String(a.description) : "",
835
+ methods: i(t)
836
+ };
837
+ const r = a.metadata, d = s(r) && s(r.locales) && s(r.locales.zh) ? r.locales.zh : null;
838
+ let m = typeof a.name == "string" ? a.name : String(a.name ?? ""), l = a.description != null ? String(a.description) : "";
839
+ d && (typeof d.name == "string" && d.name && (m = d.name), d.description !== void 0 && d.description !== null && (l = String(d.description)));
840
+ const c = d && Array.isArray(d.methods) ? d.methods : [];
841
+ if (c.length > 0) {
842
+ const C = new Map(
843
+ c.filter((f) => s(f) && typeof f.identifier == "string").map((f) => [f.identifier, f])
844
+ ), u = t.map((f) => {
845
+ const I = typeof f.identifier == "string" ? f.identifier : String(f.identifier ?? ""), b = C.get(I);
846
+ let R = typeof f.name == "string" ? f.name : String(f.name ?? ""), g = f.description != null ? String(f.description) : "";
847
+ return b && (typeof b.name == "string" && b.name && (R = b.name), b.description !== void 0 && b.description !== null && (g = String(b.description))), { identifier: I, name: R, description: g };
848
+ });
849
+ return { name: m, description: l, methods: u };
850
+ }
851
+ return {
852
+ name: m,
853
+ description: l,
854
+ methods: i(t)
855
+ };
856
+ }
857
+ const O = [
858
+ { code: "CN", name: "China", nameCn: "中国", dialCode: "86", flag: "🇨🇳" },
859
+ { code: "US", name: "United States", nameCn: "美国", dialCode: "1", flag: "🇺🇸" },
860
+ { code: "GB", name: "United Kingdom", nameCn: "英国", dialCode: "44", flag: "🇬🇧" },
861
+ { code: "JP", name: "Japan", nameCn: "日本", dialCode: "81", flag: "🇯🇵" },
862
+ { code: "KR", name: "South Korea", nameCn: "韩国", dialCode: "82", flag: "🇰🇷" },
863
+ { code: "SG", name: "Singapore", nameCn: "新加坡", dialCode: "65", flag: "🇸🇬" },
864
+ { code: "HK", name: "Hong Kong", nameCn: "中国香港", dialCode: "852", flag: "🇭🇰" },
865
+ { code: "TW", name: "Taiwan", nameCn: "中国台湾", dialCode: "886", flag: "🇨🇳" },
866
+ { code: "MO", name: "Macau", nameCn: "中国澳门", dialCode: "853", flag: "🇲🇴" },
867
+ { code: "AU", name: "Australia", nameCn: "澳大利亚", dialCode: "61", flag: "🇦🇺" },
868
+ { code: "CA", name: "Canada", nameCn: "加拿大", dialCode: "1", flag: "🇨🇦" },
869
+ { code: "DE", name: "Germany", nameCn: "德国", dialCode: "49", flag: "🇩🇪" },
870
+ { code: "FR", name: "France", nameCn: "法国", dialCode: "33", flag: "🇫🇷" },
871
+ // A
872
+ { code: "AF", name: "Afghanistan", nameCn: "阿富汗", dialCode: "93", flag: "🇦🇫" },
873
+ { code: "AL", name: "Albania", nameCn: "阿尔巴尼亚", dialCode: "355", flag: "🇦🇱" },
874
+ { code: "DZ", name: "Algeria", nameCn: "阿尔及利亚", dialCode: "213", flag: "🇩🇿" },
875
+ { code: "AS", name: "American Samoa", nameCn: "美属萨摩亚", dialCode: "1684", flag: "🇦🇸" },
876
+ { code: "AD", name: "Andorra", nameCn: "安道尔", dialCode: "376", flag: "🇦🇩" },
877
+ { code: "AO", name: "Angola", nameCn: "安哥拉", dialCode: "244", flag: "🇦🇴" },
878
+ { code: "AI", name: "Anguilla", nameCn: "安圭拉", dialCode: "1264", flag: "🇦🇮" },
879
+ { code: "AG", name: "Antigua and Barbuda", nameCn: "安提瓜和巴布达", dialCode: "1268", flag: "🇦🇬" },
880
+ { code: "AR", name: "Argentina", nameCn: "阿根廷", dialCode: "54", flag: "🇦🇷" },
881
+ { code: "AM", name: "Armenia", nameCn: "亚美尼亚", dialCode: "374", flag: "🇦🇲" },
882
+ { code: "AW", name: "Aruba", nameCn: "阿鲁巴", dialCode: "297", flag: "🇦🇼" },
883
+ { code: "AT", name: "Austria", nameCn: "奥地利", dialCode: "43", flag: "🇦🇹" },
884
+ { code: "AZ", name: "Azerbaijan", nameCn: "阿塞拜疆", dialCode: "994", flag: "🇦🇿" },
885
+ // B
886
+ { code: "BS", name: "Bahamas", nameCn: "巴哈马", dialCode: "1242", flag: "🇧🇸" },
887
+ { code: "BH", name: "Bahrain", nameCn: "巴林", dialCode: "973", flag: "🇧🇭" },
888
+ { code: "BD", name: "Bangladesh", nameCn: "孟加拉国", dialCode: "880", flag: "🇧🇩" },
889
+ { code: "BB", name: "Barbados", nameCn: "巴巴多斯", dialCode: "1246", flag: "🇧🇧" },
890
+ { code: "BY", name: "Belarus", nameCn: "白俄罗斯", dialCode: "375", flag: "🇧🇾" },
891
+ { code: "BE", name: "Belgium", nameCn: "比利时", dialCode: "32", flag: "🇧🇪" },
892
+ { code: "BZ", name: "Belize", nameCn: "伯利兹", dialCode: "501", flag: "🇧🇿" },
893
+ { code: "BJ", name: "Benin", nameCn: "贝宁", dialCode: "229", flag: "🇧🇯" },
894
+ { code: "BM", name: "Bermuda", nameCn: "百慕大", dialCode: "1441", flag: "🇧🇲" },
895
+ { code: "BT", name: "Bhutan", nameCn: "不丹", dialCode: "975", flag: "🇧🇹" },
896
+ { code: "BO", name: "Bolivia", nameCn: "玻利维亚", dialCode: "591", flag: "🇧🇴" },
897
+ { code: "BA", name: "Bosnia and Herzegovina", nameCn: "波斯尼亚和黑塞哥维那", dialCode: "387", flag: "🇧🇦" },
898
+ { code: "BW", name: "Botswana", nameCn: "博茨瓦纳", dialCode: "267", flag: "🇧🇼" },
899
+ { code: "BR", name: "Brazil", nameCn: "巴西", dialCode: "55", flag: "🇧🇷" },
900
+ { code: "BN", name: "Brunei", nameCn: "文莱", dialCode: "673", flag: "🇧🇳" },
901
+ { code: "BG", name: "Bulgaria", nameCn: "保加利亚", dialCode: "359", flag: "🇧🇬" },
902
+ { code: "BF", name: "Burkina Faso", nameCn: "布基纳法索", dialCode: "226", flag: "🇧🇫" },
903
+ { code: "BI", name: "Burundi", nameCn: "布隆迪", dialCode: "257", flag: "🇧🇮" },
904
+ // C
905
+ { code: "KH", name: "Cambodia", nameCn: "柬埔寨", dialCode: "855", flag: "🇰🇭" },
906
+ { code: "CM", name: "Cameroon", nameCn: "喀麦隆", dialCode: "237", flag: "🇨🇲" },
907
+ { code: "CV", name: "Cape Verde", nameCn: "佛得角", dialCode: "238", flag: "🇨🇻" },
908
+ { code: "KY", name: "Cayman Islands", nameCn: "开曼群岛", dialCode: "1345", flag: "🇰🇾" },
909
+ { code: "CF", name: "Central African Republic", nameCn: "中非共和国", dialCode: "236", flag: "🇨🇫" },
910
+ { code: "TD", name: "Chad", nameCn: "乍得", dialCode: "235", flag: "🇹🇩" },
911
+ { code: "CL", name: "Chile", nameCn: "智利", dialCode: "56", flag: "🇨🇱" },
912
+ { code: "CO", name: "Colombia", nameCn: "哥伦比亚", dialCode: "57", flag: "🇨🇴" },
913
+ { code: "KM", name: "Comoros", nameCn: "科摩罗", dialCode: "269", flag: "🇰🇲" },
914
+ { code: "CG", name: "Congo", nameCn: "刚果(布)", dialCode: "242", flag: "🇨🇬" },
915
+ { code: "CD", name: "Congo (DRC)", nameCn: "刚果(金)", dialCode: "243", flag: "🇨🇩" },
916
+ { code: "CK", name: "Cook Islands", nameCn: "库克群岛", dialCode: "682", flag: "🇨🇰" },
917
+ { code: "CR", name: "Costa Rica", nameCn: "哥斯达黎加", dialCode: "506", flag: "🇨🇷" },
918
+ { code: "CI", name: "Côte d'Ivoire", nameCn: "科特迪瓦", dialCode: "225", flag: "🇨🇮" },
919
+ { code: "HR", name: "Croatia", nameCn: "克罗地亚", dialCode: "385", flag: "🇭🇷" },
920
+ { code: "CU", name: "Cuba", nameCn: "古巴", dialCode: "53", flag: "🇨🇺" },
921
+ { code: "CW", name: "Curaçao", nameCn: "库拉索", dialCode: "599", flag: "🇨🇼" },
922
+ { code: "CY", name: "Cyprus", nameCn: "塞浦路斯", dialCode: "357", flag: "🇨🇾" },
923
+ { code: "CZ", name: "Czech Republic", nameCn: "捷克", dialCode: "420", flag: "🇨🇿" },
924
+ // D
925
+ { code: "DK", name: "Denmark", nameCn: "丹麦", dialCode: "45", flag: "🇩🇰" },
926
+ { code: "DJ", name: "Djibouti", nameCn: "吉布提", dialCode: "253", flag: "🇩🇯" },
927
+ { code: "DM", name: "Dominica", nameCn: "多米尼克", dialCode: "1767", flag: "🇩🇲" },
928
+ { code: "DO", name: "Dominican Republic", nameCn: "多米尼加", dialCode: "1809", flag: "🇩🇴" },
929
+ // E
930
+ { code: "EC", name: "Ecuador", nameCn: "厄瓜多尔", dialCode: "593", flag: "🇪🇨" },
931
+ { code: "EG", name: "Egypt", nameCn: "埃及", dialCode: "20", flag: "🇪🇬" },
932
+ { code: "SV", name: "El Salvador", nameCn: "萨尔瓦多", dialCode: "503", flag: "🇸🇻" },
933
+ { code: "GQ", name: "Equatorial Guinea", nameCn: "赤道几内亚", dialCode: "240", flag: "🇬🇶" },
934
+ { code: "ER", name: "Eritrea", nameCn: "厄立特里亚", dialCode: "291", flag: "🇪🇷" },
935
+ { code: "EE", name: "Estonia", nameCn: "爱沙尼亚", dialCode: "372", flag: "🇪🇪" },
936
+ { code: "SZ", name: "Eswatini", nameCn: "斯威士兰", dialCode: "268", flag: "🇸🇿" },
937
+ { code: "ET", name: "Ethiopia", nameCn: "埃塞俄比亚", dialCode: "251", flag: "🇪🇹" },
938
+ // F
939
+ { code: "FK", name: "Falkland Islands", nameCn: "福克兰群岛", dialCode: "500", flag: "🇫🇰" },
940
+ { code: "FO", name: "Faroe Islands", nameCn: "法罗群岛", dialCode: "298", flag: "🇫🇴" },
941
+ { code: "FJ", name: "Fiji", nameCn: "斐济", dialCode: "679", flag: "🇫🇯" },
942
+ { code: "FI", name: "Finland", nameCn: "芬兰", dialCode: "358", flag: "🇫🇮" },
943
+ { code: "GF", name: "French Guiana", nameCn: "法属圭亚那", dialCode: "594", flag: "🇬🇫" },
944
+ { code: "PF", name: "French Polynesia", nameCn: "法属波利尼西亚", dialCode: "689", flag: "🇵🇫" },
945
+ // G
946
+ { code: "GA", name: "Gabon", nameCn: "加蓬", dialCode: "241", flag: "🇬🇦" },
947
+ { code: "GM", name: "Gambia", nameCn: "冈比亚", dialCode: "220", flag: "🇬🇲" },
948
+ { code: "GE", name: "Georgia", nameCn: "格鲁吉亚", dialCode: "995", flag: "🇬🇪" },
949
+ { code: "GH", name: "Ghana", nameCn: "加纳", dialCode: "233", flag: "🇬🇭" },
950
+ { code: "GI", name: "Gibraltar", nameCn: "直布罗陀", dialCode: "350", flag: "🇬🇮" },
951
+ { code: "GR", name: "Greece", nameCn: "希腊", dialCode: "30", flag: "🇬🇷" },
952
+ { code: "GL", name: "Greenland", nameCn: "格陵兰", dialCode: "299", flag: "🇬🇱" },
953
+ { code: "GD", name: "Grenada", nameCn: "格林纳达", dialCode: "1473", flag: "🇬🇩" },
954
+ { code: "GP", name: "Guadeloupe", nameCn: "瓜德罗普", dialCode: "590", flag: "🇬🇵" },
955
+ { code: "GU", name: "Guam", nameCn: "关岛", dialCode: "1671", flag: "🇬🇺" },
956
+ { code: "GT", name: "Guatemala", nameCn: "危地马拉", dialCode: "502", flag: "🇬🇹" },
957
+ { code: "GG", name: "Guernsey", nameCn: "根西岛", dialCode: "44", flag: "🇬🇬" },
958
+ { code: "GN", name: "Guinea", nameCn: "几内亚", dialCode: "224", flag: "🇬🇳" },
959
+ { code: "GW", name: "Guinea-Bissau", nameCn: "几内亚比绍", dialCode: "245", flag: "🇬🇼" },
960
+ { code: "GY", name: "Guyana", nameCn: "圭亚那", dialCode: "592", flag: "🇬🇾" },
961
+ // H
962
+ { code: "HT", name: "Haiti", nameCn: "海地", dialCode: "509", flag: "🇭🇹" },
963
+ { code: "HN", name: "Honduras", nameCn: "洪都拉斯", dialCode: "504", flag: "🇭🇳" },
964
+ { code: "HU", name: "Hungary", nameCn: "匈牙利", dialCode: "36", flag: "🇭🇺" },
965
+ // I
966
+ { code: "IS", name: "Iceland", nameCn: "冰岛", dialCode: "354", flag: "🇮🇸" },
967
+ { code: "IN", name: "India", nameCn: "印度", dialCode: "91", flag: "🇮🇳" },
968
+ { code: "ID", name: "Indonesia", nameCn: "印度尼西亚", dialCode: "62", flag: "🇮🇩" },
969
+ { code: "IR", name: "Iran", nameCn: "伊朗", dialCode: "98", flag: "🇮🇷" },
970
+ { code: "IQ", name: "Iraq", nameCn: "伊拉克", dialCode: "964", flag: "🇮🇶" },
971
+ { code: "IE", name: "Ireland", nameCn: "爱尔兰", dialCode: "353", flag: "🇮🇪" },
972
+ { code: "IM", name: "Isle of Man", nameCn: "马恩岛", dialCode: "44", flag: "🇮🇲" },
973
+ { code: "IL", name: "Israel", nameCn: "以色列", dialCode: "972", flag: "🇮🇱" },
974
+ { code: "IT", name: "Italy", nameCn: "意大利", dialCode: "39", flag: "🇮🇹" },
975
+ // J
976
+ { code: "JM", name: "Jamaica", nameCn: "牙买加", dialCode: "1876", flag: "🇯🇲" },
977
+ { code: "JE", name: "Jersey", nameCn: "泽西岛", dialCode: "44", flag: "🇯🇪" },
978
+ { code: "JO", name: "Jordan", nameCn: "约旦", dialCode: "962", flag: "🇯🇴" },
979
+ // K
980
+ { code: "KZ", name: "Kazakhstan", nameCn: "哈萨克斯坦", dialCode: "7", flag: "🇰🇿" },
981
+ { code: "KE", name: "Kenya", nameCn: "肯尼亚", dialCode: "254", flag: "🇰🇪" },
982
+ { code: "KI", name: "Kiribati", nameCn: "基里巴斯", dialCode: "686", flag: "🇰🇮" },
983
+ { code: "KP", name: "North Korea", nameCn: "朝鲜", dialCode: "850", flag: "🇰🇵" },
984
+ { code: "KW", name: "Kuwait", nameCn: "科威特", dialCode: "965", flag: "🇰🇼" },
985
+ { code: "KG", name: "Kyrgyzstan", nameCn: "吉尔吉斯斯坦", dialCode: "996", flag: "🇰🇬" },
986
+ // L
987
+ { code: "LA", name: "Laos", nameCn: "老挝", dialCode: "856", flag: "🇱🇦" },
988
+ { code: "LV", name: "Latvia", nameCn: "拉脱维亚", dialCode: "371", flag: "🇱🇻" },
989
+ { code: "LB", name: "Lebanon", nameCn: "黎巴嫩", dialCode: "961", flag: "🇱🇧" },
990
+ { code: "LS", name: "Lesotho", nameCn: "莱索托", dialCode: "266", flag: "🇱🇸" },
991
+ { code: "LR", name: "Liberia", nameCn: "利比里亚", dialCode: "231", flag: "🇱🇷" },
992
+ { code: "LY", name: "Libya", nameCn: "利比亚", dialCode: "218", flag: "🇱🇾" },
993
+ { code: "LI", name: "Liechtenstein", nameCn: "列支敦士登", dialCode: "423", flag: "🇱🇮" },
994
+ { code: "LT", name: "Lithuania", nameCn: "立陶宛", dialCode: "370", flag: "🇱🇹" },
995
+ { code: "LU", name: "Luxembourg", nameCn: "卢森堡", dialCode: "352", flag: "🇱🇺" },
996
+ // M
997
+ { code: "MK", name: "North Macedonia", nameCn: "北马其顿", dialCode: "389", flag: "🇲🇰" },
998
+ { code: "MG", name: "Madagascar", nameCn: "马达加斯加", dialCode: "261", flag: "🇲🇬" },
999
+ { code: "MW", name: "Malawi", nameCn: "马拉维", dialCode: "265", flag: "🇲🇼" },
1000
+ { code: "MY", name: "Malaysia", nameCn: "马来西亚", dialCode: "60", flag: "🇲🇾" },
1001
+ { code: "MV", name: "Maldives", nameCn: "马尔代夫", dialCode: "960", flag: "🇲🇻" },
1002
+ { code: "ML", name: "Mali", nameCn: "马里", dialCode: "223", flag: "🇲🇱" },
1003
+ { code: "MT", name: "Malta", nameCn: "马耳他", dialCode: "356", flag: "🇲🇹" },
1004
+ { code: "MH", name: "Marshall Islands", nameCn: "马绍尔群岛", dialCode: "692", flag: "🇲🇭" },
1005
+ { code: "MQ", name: "Martinique", nameCn: "马提尼克", dialCode: "596", flag: "🇲🇶" },
1006
+ { code: "MR", name: "Mauritania", nameCn: "毛里塔尼亚", dialCode: "222", flag: "🇲🇷" },
1007
+ { code: "MU", name: "Mauritius", nameCn: "毛里求斯", dialCode: "230", flag: "🇲🇺" },
1008
+ { code: "YT", name: "Mayotte", nameCn: "马约特", dialCode: "262", flag: "🇾🇹" },
1009
+ { code: "MX", name: "Mexico", nameCn: "墨西哥", dialCode: "52", flag: "🇲🇽" },
1010
+ { code: "FM", name: "Micronesia", nameCn: "密克罗尼西亚", dialCode: "691", flag: "🇫🇲" },
1011
+ { code: "MD", name: "Moldova", nameCn: "摩尔多瓦", dialCode: "373", flag: "🇲🇩" },
1012
+ { code: "MC", name: "Monaco", nameCn: "摩纳哥", dialCode: "377", flag: "🇲🇨" },
1013
+ { code: "MN", name: "Mongolia", nameCn: "蒙古", dialCode: "976", flag: "🇲🇳" },
1014
+ { code: "ME", name: "Montenegro", nameCn: "黑山", dialCode: "382", flag: "🇲🇪" },
1015
+ { code: "MS", name: "Montserrat", nameCn: "蒙特塞拉特", dialCode: "1664", flag: "🇲🇸" },
1016
+ { code: "MA", name: "Morocco", nameCn: "摩洛哥", dialCode: "212", flag: "🇲🇦" },
1017
+ { code: "MZ", name: "Mozambique", nameCn: "莫桑比克", dialCode: "258", flag: "🇲🇿" },
1018
+ { code: "MM", name: "Myanmar", nameCn: "缅甸", dialCode: "95", flag: "🇲🇲" },
1019
+ // N
1020
+ { code: "NA", name: "Namibia", nameCn: "纳米比亚", dialCode: "264", flag: "🇳🇦" },
1021
+ { code: "NR", name: "Nauru", nameCn: "瑙鲁", dialCode: "674", flag: "🇳🇷" },
1022
+ { code: "NP", name: "Nepal", nameCn: "尼泊尔", dialCode: "977", flag: "🇳🇵" },
1023
+ { code: "NL", name: "Netherlands", nameCn: "荷兰", dialCode: "31", flag: "🇳🇱" },
1024
+ { code: "NC", name: "New Caledonia", nameCn: "新喀里多尼亚", dialCode: "687", flag: "🇳🇨" },
1025
+ { code: "NZ", name: "New Zealand", nameCn: "新西兰", dialCode: "64", flag: "🇳🇿" },
1026
+ { code: "NI", name: "Nicaragua", nameCn: "尼加拉瓜", dialCode: "505", flag: "🇳🇮" },
1027
+ { code: "NE", name: "Niger", nameCn: "尼日尔", dialCode: "227", flag: "🇳🇪" },
1028
+ { code: "NG", name: "Nigeria", nameCn: "尼日利亚", dialCode: "234", flag: "🇳🇬" },
1029
+ { code: "NU", name: "Niue", nameCn: "纽埃", dialCode: "683", flag: "🇳🇺" },
1030
+ { code: "NF", name: "Norfolk Island", nameCn: "诺福克岛", dialCode: "672", flag: "🇳🇫" },
1031
+ { code: "MP", name: "Northern Mariana Islands", nameCn: "北马里亚纳群岛", dialCode: "1670", flag: "🇲🇵" },
1032
+ { code: "NO", name: "Norway", nameCn: "挪威", dialCode: "47", flag: "🇳🇴" },
1033
+ // O
1034
+ { code: "OM", name: "Oman", nameCn: "阿曼", dialCode: "968", flag: "🇴🇲" },
1035
+ // P
1036
+ { code: "PK", name: "Pakistan", nameCn: "巴基斯坦", dialCode: "92", flag: "🇵🇰" },
1037
+ { code: "PW", name: "Palau", nameCn: "帕劳", dialCode: "680", flag: "🇵🇼" },
1038
+ { code: "PS", name: "Palestine", nameCn: "巴勒斯坦", dialCode: "970", flag: "🇵🇸" },
1039
+ { code: "PA", name: "Panama", nameCn: "巴拿马", dialCode: "507", flag: "🇵🇦" },
1040
+ { code: "PG", name: "Papua New Guinea", nameCn: "巴布亚新几内亚", dialCode: "675", flag: "🇵🇬" },
1041
+ { code: "PY", name: "Paraguay", nameCn: "巴拉圭", dialCode: "595", flag: "🇵🇾" },
1042
+ { code: "PE", name: "Peru", nameCn: "秘鲁", dialCode: "51", flag: "🇵🇪" },
1043
+ { code: "PH", name: "Philippines", nameCn: "菲律宾", dialCode: "63", flag: "🇵🇭" },
1044
+ { code: "PL", name: "Poland", nameCn: "波兰", dialCode: "48", flag: "🇵🇱" },
1045
+ { code: "PT", name: "Portugal", nameCn: "葡萄牙", dialCode: "351", flag: "🇵🇹" },
1046
+ { code: "PR", name: "Puerto Rico", nameCn: "波多黎各", dialCode: "1787", flag: "🇵🇷" },
1047
+ // Q
1048
+ { code: "QA", name: "Qatar", nameCn: "卡塔尔", dialCode: "974", flag: "🇶🇦" },
1049
+ // R
1050
+ { code: "RE", name: "Réunion", nameCn: "留尼汪", dialCode: "262", flag: "🇷🇪" },
1051
+ { code: "RO", name: "Romania", nameCn: "罗马尼亚", dialCode: "40", flag: "🇷🇴" },
1052
+ { code: "RU", name: "Russia", nameCn: "俄罗斯", dialCode: "7", flag: "🇷🇺" },
1053
+ { code: "RW", name: "Rwanda", nameCn: "卢旺达", dialCode: "250", flag: "🇷🇼" },
1054
+ // S
1055
+ { code: "BL", name: "Saint Barthélemy", nameCn: "圣巴泰勒米", dialCode: "590", flag: "🇧🇱" },
1056
+ { code: "SH", name: "Saint Helena", nameCn: "圣赫勒拿", dialCode: "290", flag: "🇸🇭" },
1057
+ { code: "KN", name: "Saint Kitts and Nevis", nameCn: "圣基茨和尼维斯", dialCode: "1869", flag: "🇰🇳" },
1058
+ { code: "LC", name: "Saint Lucia", nameCn: "圣卢西亚", dialCode: "1758", flag: "🇱🇨" },
1059
+ { code: "MF", name: "Saint Martin", nameCn: "圣马丁(法属)", dialCode: "590", flag: "🇲🇫" },
1060
+ { code: "PM", name: "Saint Pierre and Miquelon", nameCn: "圣皮埃尔和密克隆", dialCode: "508", flag: "🇵🇲" },
1061
+ { code: "VC", name: "Saint Vincent and the Grenadines", nameCn: "圣文森特和格林纳丁斯", dialCode: "1784", flag: "🇻🇨" },
1062
+ { code: "WS", name: "Samoa", nameCn: "萨摩亚", dialCode: "685", flag: "🇼🇸" },
1063
+ { code: "SM", name: "San Marino", nameCn: "圣马力诺", dialCode: "378", flag: "🇸🇲" },
1064
+ { code: "ST", name: "São Tomé and Príncipe", nameCn: "圣多美和普林西比", dialCode: "239", flag: "🇸🇹" },
1065
+ { code: "SA", name: "Saudi Arabia", nameCn: "沙特阿拉伯", dialCode: "966", flag: "🇸🇦" },
1066
+ { code: "SN", name: "Senegal", nameCn: "塞内加尔", dialCode: "221", flag: "🇸🇳" },
1067
+ { code: "RS", name: "Serbia", nameCn: "塞尔维亚", dialCode: "381", flag: "🇷🇸" },
1068
+ { code: "SC", name: "Seychelles", nameCn: "塞舌尔", dialCode: "248", flag: "🇸🇨" },
1069
+ { code: "SL", name: "Sierra Leone", nameCn: "塞拉利昂", dialCode: "232", flag: "🇸🇱" },
1070
+ { code: "SX", name: "Sint Maarten", nameCn: "圣马丁(荷属)", dialCode: "1721", flag: "🇸🇽" },
1071
+ { code: "SK", name: "Slovakia", nameCn: "斯洛伐克", dialCode: "421", flag: "🇸🇰" },
1072
+ { code: "SI", name: "Slovenia", nameCn: "斯洛文尼亚", dialCode: "386", flag: "🇸🇮" },
1073
+ { code: "SB", name: "Solomon Islands", nameCn: "所罗门群岛", dialCode: "677", flag: "🇸🇧" },
1074
+ { code: "SO", name: "Somalia", nameCn: "索马里", dialCode: "252", flag: "🇸🇴" },
1075
+ { code: "ZA", name: "South Africa", nameCn: "南非", dialCode: "27", flag: "🇿🇦" },
1076
+ { code: "SS", name: "South Sudan", nameCn: "南苏丹", dialCode: "211", flag: "🇸🇸" },
1077
+ { code: "ES", name: "Spain", nameCn: "西班牙", dialCode: "34", flag: "🇪🇸" },
1078
+ { code: "LK", name: "Sri Lanka", nameCn: "斯里兰卡", dialCode: "94", flag: "🇱🇰" },
1079
+ { code: "SD", name: "Sudan", nameCn: "苏丹", dialCode: "249", flag: "🇸🇩" },
1080
+ { code: "SR", name: "Suriname", nameCn: "苏里南", dialCode: "597", flag: "🇸🇷" },
1081
+ { code: "SE", name: "Sweden", nameCn: "瑞典", dialCode: "46", flag: "🇸🇪" },
1082
+ { code: "CH", name: "Switzerland", nameCn: "瑞士", dialCode: "41", flag: "🇨🇭" },
1083
+ { code: "SY", name: "Syria", nameCn: "叙利亚", dialCode: "963", flag: "🇸🇾" },
1084
+ // T
1085
+ { code: "TJ", name: "Tajikistan", nameCn: "塔吉克斯坦", dialCode: "992", flag: "🇹🇯" },
1086
+ { code: "TZ", name: "Tanzania", nameCn: "坦桑尼亚", dialCode: "255", flag: "🇹🇿" },
1087
+ { code: "TH", name: "Thailand", nameCn: "泰国", dialCode: "66", flag: "🇹🇭" },
1088
+ { code: "TL", name: "Timor-Leste", nameCn: "东帝汶", dialCode: "670", flag: "🇹🇱" },
1089
+ { code: "TG", name: "Togo", nameCn: "多哥", dialCode: "228", flag: "🇹🇬" },
1090
+ { code: "TK", name: "Tokelau", nameCn: "托克劳", dialCode: "690", flag: "🇹🇰" },
1091
+ { code: "TO", name: "Tonga", nameCn: "汤加", dialCode: "676", flag: "🇹🇴" },
1092
+ { code: "TT", name: "Trinidad and Tobago", nameCn: "特立尼达和多巴哥", dialCode: "1868", flag: "🇹🇹" },
1093
+ { code: "TN", name: "Tunisia", nameCn: "突尼斯", dialCode: "216", flag: "🇹🇳" },
1094
+ { code: "TR", name: "Turkey", nameCn: "土耳其", dialCode: "90", flag: "🇹🇷" },
1095
+ { code: "TM", name: "Turkmenistan", nameCn: "土库曼斯坦", dialCode: "993", flag: "🇹🇲" },
1096
+ { code: "TC", name: "Turks and Caicos Islands", nameCn: "特克斯和凯科斯群岛", dialCode: "1649", flag: "🇹🇨" },
1097
+ { code: "TV", name: "Tuvalu", nameCn: "图瓦卢", dialCode: "688", flag: "🇹🇻" },
1098
+ // U
1099
+ { code: "UG", name: "Uganda", nameCn: "乌干达", dialCode: "256", flag: "🇺🇬" },
1100
+ { code: "UA", name: "Ukraine", nameCn: "乌克兰", dialCode: "380", flag: "🇺🇦" },
1101
+ { code: "AE", name: "United Arab Emirates", nameCn: "阿联酋", dialCode: "971", flag: "🇦🇪" },
1102
+ { code: "UY", name: "Uruguay", nameCn: "乌拉圭", dialCode: "598", flag: "🇺🇾" },
1103
+ { code: "UZ", name: "Uzbekistan", nameCn: "乌兹别克斯坦", dialCode: "998", flag: "🇺🇿" },
1104
+ // V
1105
+ { code: "VU", name: "Vanuatu", nameCn: "瓦努阿图", dialCode: "678", flag: "🇻🇺" },
1106
+ { code: "VA", name: "Vatican City", nameCn: "梵蒂冈", dialCode: "379", flag: "🇻🇦" },
1107
+ { code: "VE", name: "Venezuela", nameCn: "委内瑞拉", dialCode: "58", flag: "🇻🇪" },
1108
+ { code: "VN", name: "Vietnam", nameCn: "越南", dialCode: "84", flag: "🇻🇳" },
1109
+ { code: "VG", name: "British Virgin Islands", nameCn: "英属维尔京群岛", dialCode: "1284", flag: "🇻🇬" },
1110
+ { code: "VI", name: "U.S. Virgin Islands", nameCn: "美属维尔京群岛", dialCode: "1340", flag: "🇻🇮" },
1111
+ // W
1112
+ { code: "WF", name: "Wallis and Futuna", nameCn: "瓦利斯和富图纳", dialCode: "681", flag: "🇼🇫" },
1113
+ // Y
1114
+ { code: "YE", name: "Yemen", nameCn: "也门", dialCode: "967", flag: "🇾🇪" },
1115
+ // Z
1116
+ { code: "ZM", name: "Zambia", nameCn: "赞比亚", dialCode: "260", flag: "🇿🇲" },
1117
+ { code: "ZW", name: "Zimbabwe", nameCn: "津巴布韦", dialCode: "263", flag: "🇿🇼" }
1118
+ ];
1119
+ function we(e) {
1120
+ return O.find((n) => n.code === e.toUpperCase());
1121
+ }
1122
+ function nn(e) {
1123
+ return O.filter((n) => n.dialCode === e);
1124
+ }
1125
+ function an() {
1126
+ return O;
1127
+ }
1128
+ function on(e, n = "en") {
1129
+ const a = e.toLowerCase().trim();
1130
+ return a ? O.filter((o) => o.dialCode.includes(a) || `+${o.dialCode}`.includes(a) || o.code.toLowerCase().includes(a) ? !0 : n === "zh" ? o.nameCn.includes(a) || o.name.toLowerCase().includes(a) : o.name.toLowerCase().includes(a) || o.nameCn.includes(a)) : O;
1131
+ }
1132
+ const Le = ["CN", "HK", "MO", "TW"];
1133
+ function tn() {
1134
+ return Le.map((e) => we(e)).filter((e) => !!e);
1135
+ }
1136
+ function rn(e, n) {
1137
+ const a = n.replace(/\D/g, "");
1138
+ return a ? e === "86" ? /^1[3-9]\d{9}$/.test(a) : e === "852" || e === "853" ? /^\d{8}$/.test(a) : e === "886" ? /^\d{8,10}$/.test(a) : /^\d{6,14}$/.test(a) : !1;
1139
+ }
1140
+ function dn(e, n) {
1141
+ const a = n.replace(/\D/g, "");
1142
+ return `+${e}-${a}`;
1143
+ }
1144
+ function ln(e) {
1145
+ const n = e.match(/^\+(\d{1,4})-(\d+)$/);
1146
+ return n ? { dialCode: n[1], number: n[2] } : null;
1147
+ }
1148
+ function sn() {
1149
+ return O[0];
1150
+ }
1151
+ function Te(e) {
1152
+ const n = e.trim();
1153
+ return n && (n.endsWith("/") ? n : `${n}/`);
1154
+ }
1155
+ function be(e, n) {
1156
+ try {
1157
+ const a = new URL(e).pathname.split("/").filter(Boolean), o = a.lastIndexOf(n);
1158
+ return o >= 0 && o === a.length - 2 && /^\d+\.\d+\.\d+$/u.test(a[o + 1] ?? "");
1159
+ } catch {
1160
+ return !1;
1161
+ }
1162
+ }
1163
+ function cn(e, n, a) {
1164
+ const o = Te(e), i = be(o, n) ? "" : a ? `${n}/${a}` : `${n}`, r = new URL(i, o);
1165
+ return !a && !r.pathname.endsWith("/") && (r.pathname += "/"), r.href;
1166
+ }
1167
+ function mn(e, n) {
1168
+ const a = e.split("/").filter(Boolean);
1169
+ return a[0] !== n ? "" : a.slice(1).join("/");
1170
+ }
1171
+ function fn(e, n) {
1172
+ const a = e.replace(/\/+/gu, "/"), o = n.trim();
1173
+ if (!o || o === "/")
1174
+ return a.replace(/^\/+|\/+$/gu, "");
1175
+ let t = o.replace(/\/+/gu, "/");
1176
+ if (t.startsWith("/") || (t = `/${t}`), t = t.replace(/\/+$/u, "") || "/", t === "/")
1177
+ return a.replace(/^\/+|\/+$/gu, "");
1178
+ const i = a.replace(/\/+$/u, "") || "/", r = `${t}/`;
1179
+ return i === t ? "" : i.startsWith(r) ? i.slice(r.length).replace(/\/+$/u, "") : a.replace(/^\/+|\/+$/gu, "");
1180
+ }
1181
+ const Ie = [
1182
+ "workbench",
1183
+ "console",
1184
+ "hub",
1185
+ "chat",
1186
+ "shell",
1187
+ "admin",
1188
+ "ebook",
1189
+ "partner"
1190
+ ], Y = {
1191
+ workbench: !1,
1192
+ console: !1,
1193
+ hub: !1,
1194
+ chat: !1,
1195
+ shell: !1,
1196
+ admin: !1,
1197
+ ebook: !1,
1198
+ partner: !1
1199
+ }, ke = {
1200
+ watermark: {
1201
+ apps: { ...Y }
1202
+ }
1203
+ };
1204
+ function M(e) {
1205
+ return e !== null && typeof e == "object" && !Array.isArray(e);
1206
+ }
1207
+ function q(e, n) {
1208
+ const a = { ...e };
1209
+ for (const o of Object.keys(n)) {
1210
+ const t = n[o], i = e[o];
1211
+ M(t) && M(i) ? a[o] = q(i, t) : a[o] = t;
1212
+ }
1213
+ return a;
1214
+ }
1215
+ function Me(e) {
1216
+ const n = q(
1217
+ structuredClone(ke),
1218
+ M(e) ? e : {}
1219
+ ), a = { ...Y }, o = n.watermark;
1220
+ if (M(o) && M(o.apps))
1221
+ for (const t of Ie)
1222
+ typeof o.apps[t] == "boolean" && (a[t] = o.apps[t]);
1223
+ return {
1224
+ ...n,
1225
+ watermark: {
1226
+ ...M(o) ? o : {},
1227
+ apps: a
1228
+ }
1229
+ };
1230
+ }
1231
+ function un(e, n) {
1232
+ return Me(n).watermark.apps[e] === !0;
1233
+ }
1234
+ function Cn() {
1235
+ try {
1236
+ const e = localStorage.getItem("user");
1237
+ if (!e) return null;
1238
+ const n = JSON.parse(e), a = n.phone ?? n.phoneNumber;
1239
+ return typeof a == "string" && a.trim() ? a.trim() : null;
1240
+ } catch {
1241
+ return null;
1242
+ }
1243
+ }
1244
+ function gn(e) {
1245
+ const n = e.spaceName?.trim();
1246
+ if (!n) return null;
1247
+ const a = e.name?.trim();
1248
+ if (a) return `${a}@${n}`;
1249
+ const o = e.phone?.trim();
1250
+ if (o) return `${o}@${n}`;
1251
+ const t = e.email?.trim();
1252
+ if (t) {
1253
+ const i = t.includes("@") ? t.split("@")[0] : t;
1254
+ if (i) return `${i}@${n}`;
1255
+ }
1256
+ return null;
1257
+ }
1258
+ export {
1259
+ O as COUNTRY_CODES,
1260
+ ke as DEFAULT_SPACE_SETTINGS,
1261
+ Ie as GENISPACE_APP_IDS,
1262
+ Le as GREATER_CHINA_COUNTRY_CODES,
1263
+ ce as LOGOUT_COMPLETED_MESSAGE,
1264
+ se as LOGOUT_NOTIFICATION_PATH,
1265
+ je as broadcastLogoutNotifications,
1266
+ cn as buildAppIframeSrc,
1267
+ X as buildCrossAppUrl,
1268
+ Ye as buildTimeZoneSelectOptions,
1269
+ gn as buildWatermarkLabel,
1270
+ Sn as cn,
1271
+ fe as collectLogoutNotificationUrls,
1272
+ xe as createSSOClient,
1273
+ Pe as crossAppNav,
1274
+ He as debounce,
1275
+ Re as formatBytes,
1276
+ Ue as formatDate,
1277
+ ve as formatDateTime,
1278
+ te as formatDuration,
1279
+ $e as formatDurationFromMs,
1280
+ _e as formatLargeNumber,
1281
+ De as formatLocalDate,
1282
+ Ge as formatLocalDateTime,
1283
+ oe as formatNumber,
1284
+ dn as formatPhoneNumber,
1285
+ Fe as formatRelativeTime,
1286
+ Be as formatTokens,
1287
+ Ke as formatUserLabel,
1288
+ an as getAllCountries,
1289
+ ge as getAllIanaTimeZoneIds,
1290
+ Ne as getAppLaunchUrl,
1291
+ sn as getChinaCountry,
1292
+ An as getCookie,
1293
+ nn as getCountriesByDialCode,
1294
+ we as getCountryByCode,
1295
+ tn as getGreaterChinaCountries,
1296
+ wn as getLanguage,
1297
+ en as getOperatorDefinitionDisplay,
1298
+ v as getPlaneBaseUrl,
1299
+ Ln as getSpaceId,
1300
+ Tn as getTheme,
1301
+ J as getTimeZone,
1302
+ bn as initializeSettings,
1303
+ x as isChunkLoadError,
1304
+ Ze as isLogoutBroadcastInProgress,
1305
+ un as isSpaceWatermarkEnabled,
1306
+ Xe as mergeImportedOperatorDefinitionLocale,
1307
+ L as mergeSchemaLocale,
1308
+ Ve as namespacesForPath,
1309
+ Te as normalizeIframeBaseUrl,
1310
+ Z as normalizeOperatorLang,
1311
+ Me as normalizeSpaceSettings,
1312
+ ln as parsePhoneNumber,
1313
+ fn as pathnameWithinBase,
1314
+ Qe as prepareTenantOperatorApiResponseForConsole,
1315
+ Cn as readStoredUserPhone,
1316
+ We as reloadOnceIfChunkError,
1317
+ In as removeCookie,
1318
+ Ee as resolveLanding,
1319
+ on as searchCountries,
1320
+ kn as setCookie,
1321
+ Mn as setLanguage,
1322
+ On as setSpaceId,
1323
+ Pn as setTheme,
1324
+ Nn as setTimeZone,
1325
+ Je as setupChunkLoadRecovery,
1326
+ mn as shellPathnameToInnerPath,
1327
+ j as stripTenantOperatorSystemConfigurationDeep,
1328
+ qe as syncOperatorMetadataLocalesWithCanonicalSchemas,
1329
+ T as syncSchemaLocalePatchWithCanonical,
1330
+ ze as throttle,
1331
+ ae as toDateInputValue,
1332
+ rn as validateNationalNumber
1333
+ };
1334
+ //# sourceMappingURL=utils.js.map