@wssto2/vue-core 0.4.27 → 0.5.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 (144) hide show
  1. package/CHANGELOG.md +79 -0
  2. package/dist/{AccessGate.vue_vue_type_script_setup_true_lang-J5HoyGNJ.js → AccessGate.vue_vue_type_script_setup_true_lang-Nw1IsB8N.js} +1 -1
  3. package/dist/{ActionRow.vue_vue_type_script_setup_true_lang-QPvYudWc.js → ActionRow.vue_vue_type_script_setup_true_lang-BCgKzUvG.js} +1 -1
  4. package/dist/{Activity-xtkZq4vG.js → Activity-CoGI2_GL.js} +7 -7
  5. package/dist/{Changes-BPB8h56i.js → Changes-Cwfe6wbX.js} +6 -6
  6. package/dist/{CollectionPage.vue_vue_type_script_setup_true_lang-CVEYkb26.js → CollectionPage.vue_vue_type_script_setup_true_lang-CtvHtFLy.js} +5 -5
  7. package/dist/{DataTable.vue_vue_type_script_setup_true_lang-DcQQ-uQS.js → DataTable.vue_vue_type_script_setup_true_lang-BEvz5zqo.js} +1 -1
  8. package/dist/{DateField.vue_vue_type_script_setup_true_lang-CpuH0WTl.js → DateField.vue_vue_type_script_setup_true_lang-DRuWzSaX.js} +1 -1
  9. package/dist/{DeadLetters-DeYxkTMh.js → DeadLetters-DyA5Dqn0.js} +7 -7
  10. package/dist/{FormErrors.vue_vue_type_script_setup_true_lang-DGOSc-PS.js → FormErrors.vue_vue_type_script_setup_true_lang-D7edzNTL.js} +2 -2
  11. package/dist/{FormGroup.vue_vue_type_script_setup_true_lang-DSwSRsA5.js → FormGroup.vue_vue_type_script_setup_true_lang-BPchlRCl.js} +2 -2
  12. package/dist/{FormView.vue_vue_type_script_setup_true_lang-BUrYkjmF.js → FormView.vue_vue_type_script_setup_true_lang-CPSYV7iQ.js} +2 -2
  13. package/dist/{General-BLbn4BCc.js → General-DTEfxWls.js} +10 -10
  14. package/dist/MenuButton.vue_vue_type_script_setup_true_lang-AGbN9r5q.js +28 -0
  15. package/dist/{NewRolePage-B7DwFWPk.js → NewRolePage-CRZoUajV.js} +3 -3
  16. package/dist/{NumberField.vue_vue_type_script_setup_true_lang-DaE5BLm4.js → NumberField.vue_vue_type_script_setup_true_lang-ButMV_sf.js} +1 -1
  17. package/dist/ProfilePage-DLY81mvN.js +764 -0
  18. package/dist/RoleEditor.vue_vue_type_script_setup_true_lang-gXbxXG2R.js +325 -0
  19. package/dist/RolePage-B9t586Q8.js +314 -0
  20. package/dist/{RolesPage-B5RwSZ89.js → RolesPage-BRdG-OSL.js} +6 -6
  21. package/dist/{SectionNavigator.vue_vue_type_script_setup_true_lang-Dmv6TpCi.js → SectionNavigator.vue_vue_type_script_setup_true_lang-Cy9Oi0ts.js} +1 -1
  22. package/dist/{SegmentedField.vue_vue_type_script_setup_true_lang-Dg-_ZjgR.js → SegmentedField.vue_vue_type_script_setup_true_lang-BwyMvkis.js} +1 -1
  23. package/dist/{SelectField.vue_vue_type_script_setup_true_lang-C3FbRQW7.js → SelectField.vue_vue_type_script_setup_true_lang-BzQC1qDQ.js} +11 -12
  24. package/dist/SessionList.vue_vue_type_script_setup_true_lang-DhoTd5D7.js +133 -0
  25. package/dist/{Sessions-wEdUsK-U.js → Sessions-vGyUOnPG.js} +5 -5
  26. package/dist/SettingsPage-V8WeADZZ.js +632 -0
  27. package/dist/{SignIn-CK9rq8LQ.js → SignIn-C-3i8RG6.js} +7 -7
  28. package/dist/{SignInPage-BORsM1g4.js → SignInPage-D2NA3VKU.js} +4 -4
  29. package/dist/SignIns-eoYPB6kB.js +121 -0
  30. package/dist/{SwitchField.vue_vue_type_script_setup_true_lang-ALvJisiP.js → SwitchField.vue_vue_type_script_setup_true_lang-D_-HACqT.js} +1 -1
  31. package/dist/{TextField.vue_vue_type_script_setup_true_lang-CP2WeU36.js → TextField.vue_vue_type_script_setup_true_lang-DTAQPbW0.js} +2 -2
  32. package/dist/{TextareaField.vue_vue_type_script_setup_true_lang-BJ4__cvJ.js → TextareaField.vue_vue_type_script_setup_true_lang-DsjK2C9T.js} +1 -1
  33. package/dist/{TimeField.vue_vue_type_script_setup_true_lang-DBxKAWRo.js → TimeField.vue_vue_type_script_setup_true_lang-Cz7KhUqt.js} +1 -1
  34. package/dist/Timestamp.vue_vue_type_script_setup_true_lang-CutyQkJb.js +52 -0
  35. package/dist/{UserRecord-C1SzdpKu.js → UserRecord-BaQl2zzQ.js} +13 -13
  36. package/dist/{UsersList-B3hc683r.js → UsersList-BfXWgH5K.js} +9 -9
  37. package/dist/access/RoleCompareDialog.vue.d.ts +1 -1
  38. package/dist/access/RoleEditor.vue.d.ts +2 -0
  39. package/dist/access/constraints.d.ts +28 -0
  40. package/dist/access/context.d.ts +5 -0
  41. package/dist/access/feature.d.ts +17 -0
  42. package/dist/access/index.d.ts +3 -1
  43. package/dist/access/index.js +11 -9
  44. package/dist/access/refusals.d.ts +20 -2
  45. package/dist/app/index.js +6 -6
  46. package/dist/client/index.js +19 -11
  47. package/dist/{client-k9euDWF4.js → client-BHPFfBj3.js} +20 -20
  48. package/dist/collection/index.js +5 -5
  49. package/dist/content/Timestamp.vue.d.ts +3 -2
  50. package/dist/content/index.js +66 -37
  51. package/dist/{contributions-BVBZP5Jb.js → contributions-DVQPcjJz.js} +1 -1
  52. package/dist/{describeError-B-NMa--w.js → describeError-BqGAUZgX.js} +1 -1
  53. package/dist/{error-CD7x0Jrz.js → error-Bb_dr_Ay.js} +2 -2
  54. package/dist/{fieldMessages-6HVzSDqG.js → fieldMessages-DTXpWnBd.js} +7 -7
  55. package/dist/form/index.js +1235 -1412
  56. package/dist/{guards-BJZjc3FZ.js → guards-DRh4zmxO.js} +1 -1
  57. package/dist/{http-BFfkA7gN.js → http-D_pBg22D.js} +1 -1
  58. package/dist/i18n/index.d.ts +2 -2
  59. package/dist/i18n/index.js +30 -30
  60. package/dist/identity/index.d.ts +2 -0
  61. package/dist/identity/index.js +8 -6
  62. package/dist/identity/profile/DetailsFields.vue.d.ts +8 -0
  63. package/dist/identity/profile/{DetailsPanel.vue.d.ts → DetailsGroup.vue.d.ts} +4 -1
  64. package/dist/identity/profile/{EmailPanel.vue.d.ts → EmailGroup.vue.d.ts} +1 -1
  65. package/dist/identity/profile/SignInsGroup.vue.d.ts +2 -0
  66. package/dist/identity/profile/profileSections.d.ts +37 -0
  67. package/dist/identity/shared/SignInList.vue.d.ts +22 -0
  68. package/dist/identity/shared/deviceLabel.d.ts +7 -0
  69. package/dist/identity/useReturnToOwnAccount.d.ts +10 -0
  70. package/dist/identity/users/context.d.ts +3 -0
  71. package/dist/identity/users/feature.d.ts +3 -0
  72. package/dist/index-WkbzC_ee.js +745 -0
  73. package/dist/index-g-qbUeTk.js +630 -0
  74. package/dist/index-kqk7Mclb.js +480 -0
  75. package/dist/index.d.ts +1 -1
  76. package/dist/index.js +1 -1
  77. package/dist/modules/notification/entities.d.ts +19 -0
  78. package/dist/modules/notification/routes.d.ts +25 -1
  79. package/dist/modules/notification/schemas.d.ts +24 -0
  80. package/dist/{navigation-DpcDF0rX.js → navigation-DuQwti76.js} +1 -1
  81. package/dist/{neighbors-RVQ4O3Qv.js → neighbors-IMRQ4rkm.js} +22 -22
  82. package/dist/notifications/context.d.ts +24 -1
  83. package/dist/notifications/feature.d.ts +10 -1
  84. package/dist/notifications/index.d.ts +1 -1
  85. package/dist/notifications/index.js +1 -1
  86. package/dist/notifications/push/DevicesSection.vue.d.ts +12 -0
  87. package/dist/notifications/push/ThisDeviceSection.vue.d.ts +15 -0
  88. package/dist/notifications/push/browser.d.ts +40 -0
  89. package/dist/notifications/push/devices.d.ts +15 -0
  90. package/dist/notifications/push/thisDevice.d.ts +28 -0
  91. package/dist/notifications/settings/ChannelsSection.vue.d.ts +16 -0
  92. package/dist/notifications/settings/{QuietHoursPanel.vue.d.ts → QuietHoursSection.vue.d.ts} +3 -1
  93. package/dist/notifications/settings/SettingsBody.vue.d.ts +17 -0
  94. package/dist/notifications/settings/settings.d.ts +4 -3
  95. package/dist/notifications/settings/state.d.ts +4 -2
  96. package/dist/options-g8RwEhBk.js +366 -0
  97. package/dist/overlay/MenuButton.vue.d.ts +3 -2
  98. package/dist/overlay/index.js +37 -59
  99. package/dist/page/index.js +1 -1
  100. package/dist/phone/index.js +10 -11
  101. package/dist/platform/index.js +3 -3
  102. package/dist/{platform-PZpUkkMS.js → platform-Dl1fbScN.js} +2 -2
  103. package/dist/push-worker/index.d.ts +91 -0
  104. package/dist/push-worker/index.js +54 -0
  105. package/dist/resource/index.js +1 -1
  106. package/dist/{routeResource-DlTsGTg_.js → routeResource-CcYA75T2.js} +2 -2
  107. package/dist/router/index.js +3 -3
  108. package/dist/{rowLayout-Dh749umr.js → rowLayout-BBFyLbOl.js} +1 -1
  109. package/dist/{sections-CeZl-Jxg.js → sections-D5rgQ4YB.js} +1 -1
  110. package/dist/shell/index.js +3 -3
  111. package/dist/signInEvents-DWShrJox.js +30 -0
  112. package/dist/state/index.js +1 -1
  113. package/dist/{status-D9iQJJiz.js → status-C2gHqkj6.js} +2 -2
  114. package/dist/styles.css +1 -1
  115. package/dist/{suggestions-DHJFKB26.js → suggestions-CfFTHi8y.js} +2 -2
  116. package/dist/testing/index.js +1 -1
  117. package/dist/{useCommand-Cj-APj-P.js → useCommand-CtqheKUv.js} +2 -2
  118. package/dist/useGroupSheet-ATvc0IiM.js +278 -0
  119. package/dist/{useLoad-M7V-AVwR.js → useLoad-W4tfxmm5.js} +1 -1
  120. package/dist/{useResourceForm-tGYTfKhH.js → useResourceForm-CJfl8rj_.js} +1 -1
  121. package/package.json +6 -2
  122. package/dist/KeyValue.vue_vue_type_script_setup_true_lang-wcZcvnow.js +0 -35
  123. package/dist/OtpInput.vue_vue_type_script_setup_true_lang-gp4FfWAH.js +0 -95
  124. package/dist/PanelActions.vue_vue_type_script_setup_true_lang-E9VdIGkf.js +0 -46
  125. package/dist/ProfilePage-CQYHj9Ns.js +0 -654
  126. package/dist/RoleEditor.vue_vue_type_script_setup_true_lang-DRHmjA9w.js +0 -300
  127. package/dist/RolePage-ODFu68Ce.js +0 -315
  128. package/dist/SessionList.vue_vue_type_script_setup_true_lang-D5qm77Zo.js +0 -111
  129. package/dist/SettingsPage-BVrMihx0.js +0 -255
  130. package/dist/SignInTable.vue_vue_type_script_setup_true_lang-AakWNvaM.js +0 -79
  131. package/dist/SignIns-C-8kVf7I.js +0 -66
  132. package/dist/Timestamp.vue_vue_type_script_setup_true_lang-DRmzPDOP.js +0 -51
  133. package/dist/control-B4SdblL6.js +0 -350
  134. package/dist/identity/profile/PanelActions.vue.d.ts +0 -17
  135. package/dist/index-C3E6DcO0.js +0 -706
  136. package/dist/index-LP6NNnow.js +0 -459
  137. package/dist/index-qUaGJ9j2.js +0 -504
  138. package/dist/notifications/settings/EmailPanel.vue.d.ts +0 -14
  139. package/dist/options-Ba_0uLWN.js +0 -18
  140. package/dist/route-goWMxDUN.js +0 -13
  141. package/dist/transport-BnP7WC0Y.js +0 -4
  142. /package/dist/identity/{profile/PasswordPanel.vue.d.ts → ReturnMenuItem.vue.d.ts} +0 -0
  143. /package/dist/identity/profile/{SessionsPanel.vue.d.ts → PasswordGroup.vue.d.ts} +0 -0
  144. /package/dist/identity/profile/{SignInsPanel.vue.d.ts → SessionsGroup.vue.d.ts} +0 -0
@@ -0,0 +1,630 @@
1
+ import { route as m } from "./client/index.js";
2
+ import { d as pe, p as me } from "./feature-DdUAfyi4.js";
3
+ import { ref as M, readonly as R, defineComponent as O, openBlock as y, createBlock as q, unref as s, shallowRef as W, withCtx as $, createTextVNode as X, toDisplayString as P, mergeProps as Z, computed as D, createElementBlock as S, createElementVNode as C, createCommentVNode as L, createVNode as T, Fragment as z, renderList as ve, normalizeClass as H, useTemplateRef as be, createSlots as he } from "vue";
4
+ import { d as ge } from "./context-Ch1r4fdN.js";
5
+ import { u as ye } from "./platform-Dl1fbScN.js";
6
+ import { d as ee } from "./defineRoutes-BGAdiIrt.js";
7
+ import { useI18n as U } from "vue-i18n";
8
+ import { _ as _e } from "./AccountMenuItem.vue_vue_type_script_setup_true_lang-CPeNxh5K.js";
9
+ import { f as xe } from "./client-BHPFfBj3.js";
10
+ import { u as we } from "./mediaQuery-CygcXmFW.js";
11
+ import { _ as ke } from "./Sheet.vue_vue_type_script_setup_true_lang-DgOFV4fa.js";
12
+ import { _ as Se } from "./Popover.vue_vue_type_script_setup_true_lang-C70GrCP7.js";
13
+ import { _ as J } from "./HeaderAction.vue_vue_type_script_setup_true_lang-Cgji-Jrr.js";
14
+ import { useRouter as Te } from "vue-router";
15
+ import { _ as G } from "./Button.vue_vue_type_script_setup_true_lang-CL9Qh5yq.js";
16
+ import { u as Ee } from "./format-D8X4zsx6.js";
17
+ import { _ as Ce } from "./Icon.vue_vue_type_script_lang-D7oC-d-S.js";
18
+ import { _ as Pe } from "./AsyncSection.vue_vue_type_script_setup_true_lang-B0NfvG3B.js";
19
+ const E = {
20
+ list: m("GET", "/v1/notifications"),
21
+ unread: m("GET", "/v1/notifications/unread"),
22
+ read: m("POST", "/v1/notifications/:id/read"),
23
+ readAll: m("POST", "/v1/notifications/read"),
24
+ stream: m.raw("GET", "/v1/notifications/stream"),
25
+ test: m("POST", "/v1/notifications/test"),
26
+ preferences: m("GET", "/v1/notifications/preferences"),
27
+ preferencesSetEmail: m("PUT", "/v1/notifications/preferences/:category"),
28
+ quietHours: m("PUT", "/v1/notifications/quiet-hours"),
29
+ preferencesSetPush: m("PUT", "/v1/notifications/preferences/:category/push"),
30
+ push: m("GET", "/v1/notifications/push"),
31
+ devices: m("GET", "/v1/notifications/devices"),
32
+ deviceSubscribe: m("POST", "/v1/notifications/devices"),
33
+ deviceUnsubscribe: m("POST", "/v1/notifications/devices/unsubscribe"),
34
+ deviceRename: m("PATCH", "/v1/notifications/devices/:id"),
35
+ deviceRemove: m("DELETE", "/v1/notifications/devices/:id"),
36
+ deviceTest: m("POST", "/v1/notifications/devices/:id/test")
37
+ }, Lt = {
38
+ deadLettersList: m("GET", "/v1/events/dead-letters", { permission: "events.deadletter:view" }),
39
+ deadLettersRetry: m("POST", "/v1/events/dead-letters/:event/:consumer/retry", { permission: "events.deadletter:retry" }),
40
+ deadLettersRetryAll: m("POST", "/v1/events/dead-letters/retry", { permission: "events.deadletter:retry" }),
41
+ consumers: m("GET", "/v1/events/consumers", { permission: "events.deadletter:view" })
42
+ }, [Le, te] = ge("vue-core.notifications");
43
+ function ne(n) {
44
+ const t = (n + "=".repeat((4 - n.length % 4) % 4)).replace(/-/g, "+").replace(/_/g, "/"), e = atob(t), i = new Uint8Array(new ArrayBuffer(e.length));
45
+ for (let o = 0; o < e.length; o++) i[o] = e.charCodeAt(o);
46
+ return i;
47
+ }
48
+ function ie(n, t) {
49
+ const e = n.options?.applicationServerKey;
50
+ if (!e) return !0;
51
+ const i = ne(t), o = new Uint8Array(e);
52
+ return o.length === i.length && o.every((c, l) => c === i[l]);
53
+ }
54
+ function Re(n) {
55
+ const t = n.toJSON();
56
+ return !t.endpoint || !t.keys?.p256dh || !t.keys?.auth ? null : { endpoint: t.endpoint, p256dh: t.keys.p256dh, auth: t.keys.auth };
57
+ }
58
+ async function oe(n) {
59
+ const t = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(n));
60
+ return [...new Uint8Array(t)].map((e) => e.toString(16).padStart(2, "0")).join("");
61
+ }
62
+ function $e(n) {
63
+ return (/iPhone|iPad|iPod/.test(n.userAgent) || /Macintosh/.test(n.userAgent) && n.maxTouchPoints > 1) && !n.standalone ? "ios-browser" : n.hasPushManager && n.hasNotification && n.hasServiceWorker ? "supported" : "unsupported";
64
+ }
65
+ function K() {
66
+ const n = async () => "serviceWorker" in navigator && await navigator.serviceWorker.getRegistration() ? navigator.serviceWorker.ready : null;
67
+ return {
68
+ support: () => $e({
69
+ userAgent: navigator.userAgent,
70
+ maxTouchPoints: navigator.maxTouchPoints ?? 0,
71
+ standalone: window.matchMedia?.("(display-mode: standalone)").matches === !0 || navigator.standalone === !0,
72
+ hasPushManager: "PushManager" in window,
73
+ hasNotification: "Notification" in window,
74
+ hasServiceWorker: "serviceWorker" in navigator
75
+ }),
76
+ permission: () => "Notification" in window ? Notification.permission : "unknown",
77
+ requestPermission: () => Notification.requestPermission(),
78
+ subscription: async () => (await n())?.pushManager.getSubscription() ?? null,
79
+ subscribe: async (t) => (await n())?.pushManager.subscribe({ userVisibleOnly: !0, applicationServerKey: ne(t) }) ?? null
80
+ };
81
+ }
82
+ async function ae(n, t, e) {
83
+ const i = Re(t);
84
+ return i ? (await n.request(E.deviceSubscribe, i, e ? { signal: e } : void 0), oe(i.endpoint)) : null;
85
+ }
86
+ async function se(n, t = K(), e) {
87
+ const i = await t.subscription();
88
+ i && (await n.request(E.deviceUnsubscribe, { endpoint: i.endpoint }, e ? { signal: e } : void 0).catch(() => {
89
+ }), await i.unsubscribe().catch(() => !1));
90
+ }
91
+ async function Ae(n, t, e) {
92
+ if (t.support() !== "supported") return;
93
+ let i = await t.subscription();
94
+ if (!i) return;
95
+ if (t.permission() !== "granted") {
96
+ await i.unsubscribe().catch(() => !1);
97
+ return;
98
+ }
99
+ const { data: o } = await n.request(E.push, void 0, e ? { signal: e } : void 0);
100
+ o.enabled && (ie(i, o.public_key) || (await i.unsubscribe(), i = await t.subscribe(o.public_key)), i && await ae(n, i, e));
101
+ }
102
+ function Rt(n = ye().http, t = K()) {
103
+ const e = M("loading"), i = M(null), o = M(!1);
104
+ async function c() {
105
+ const a = t.support();
106
+ if (a !== "supported") {
107
+ e.value = a;
108
+ return;
109
+ }
110
+ const r = await t.subscription().catch(() => null);
111
+ i.value = r ? await oe(r.endpoint) : null, e.value = t.permission() === "denied" ? "denied" : r && t.permission() === "granted" ? "on" : "off";
112
+ }
113
+ async function l() {
114
+ if (t.support() !== "supported") return e.value;
115
+ o.value = !0;
116
+ try {
117
+ const { data: a } = await n.request(E.push, void 0);
118
+ if (!a.enabled) return e.value;
119
+ if (await t.requestPermission() !== "granted")
120
+ return e.value = t.permission() === "denied" ? "denied" : "off", e.value;
121
+ let r = await t.subscription();
122
+ return r && !ie(r, a.public_key) && (await r.unsubscribe(), r = null), r ?? (r = await t.subscribe(a.public_key)), r && (i.value = await ae(n, r), e.value = "on"), e.value;
123
+ } finally {
124
+ o.value = !1;
125
+ }
126
+ }
127
+ async function _() {
128
+ o.value = !0;
129
+ try {
130
+ await se(n, t), i.value = null, e.value = "off";
131
+ } finally {
132
+ o.value = !1;
133
+ }
134
+ }
135
+ return { state: R(e), hash: R(i), busy: R(o), inspect: c, enable: l, disable: _ };
136
+ }
137
+ const Me = "events.deadletter:view", $t = "events.deadletter:retry", Y = ee({
138
+ index: { name: "events.deadletters", path: "/events/dead-letters", component: () => import("./DeadLetters-DyA5Dqn0.js"), meta: { access: Me, titleKey: "core.notifications.dead_letters.title" } }
139
+ }), j = ee({
140
+ index: { name: "notifications.settings", path: "/profile/notifications", component: () => import("./SettingsPage-V8WeADZZ.js"), meta: { titleKey: "core.notifications.settings.title" } }
141
+ }), Ne = /* @__PURE__ */ O({
142
+ __name: "SettingsMenuItem",
143
+ setup(n) {
144
+ const { t } = U();
145
+ return (e, i) => (y(), q(_e, {
146
+ label: s(t)("core.notifications.settings.title"),
147
+ icon: "notification3Line",
148
+ to: s(j).index,
149
+ "data-notification-settings-menu-item": ""
150
+ }, null, 8, ["label", "to"]));
151
+ }
152
+ });
153
+ function re(n) {
154
+ return n.reduce((t, e) => Math.max(t, e.id), 0);
155
+ }
156
+ function Oe(n, t, e) {
157
+ return n.map((i) => i.id === t && i.read_at === null ? { ...i, read_at: e } : i);
158
+ }
159
+ function qe(n, t, e) {
160
+ return n.map((i) => i.read_at === null && i.id <= t ? { ...i, read_at: e } : i);
161
+ }
162
+ function Ue(n, t) {
163
+ const e = re(n);
164
+ return [...t.filter((i) => i.id > e), ...n];
165
+ }
166
+ function Ie(n, t) {
167
+ const e = new Set(n.map((i) => i.id));
168
+ return [...n, ...t.filter((i) => !e.has(i.id))];
169
+ }
170
+ function Be(n, t, e) {
171
+ let i = n.items;
172
+ if (t.type === "created" && t.notification && !i.some((o) => o.id === t.notification?.id) && (i = [t.notification, ...i]), t.type === "read") {
173
+ const o = new Set(t.read_ids ?? []), c = t.read_up_to_id ?? 0;
174
+ i = i.map((l) => l.read_at === null && (t.all_read ? l.id <= c : o.has(l.id)) ? { ...l, read_at: e } : l);
175
+ }
176
+ return { items: i, unreadCount: Math.max(0, t.unread_count) };
177
+ }
178
+ function De(n) {
179
+ return n > 99 ? "99+" : String(n);
180
+ }
181
+ const We = ["created", "read", "unread"];
182
+ function ze(n) {
183
+ const t = n.split(`
184
+ `).filter((e) => e.startsWith("data:")).map((e) => e.slice(5).replace(/^ /, "")).join(`
185
+ `);
186
+ if (t === "") return null;
187
+ try {
188
+ const e = JSON.parse(t);
189
+ if (typeof e != "object" || e === null) return null;
190
+ const { type: i, unread_count: o } = e;
191
+ return typeof i == "string" && We.includes(i) && typeof o == "number" ? e : null;
192
+ } catch {
193
+ return null;
194
+ }
195
+ }
196
+ async function Ge({ url: n, transport: t, signal: e, onEvent: i, idleTimeout: o }) {
197
+ if (e.aborted) return "aborted";
198
+ const c = new AbortController();
199
+ let l = null, _ = !1, a;
200
+ const r = () => {
201
+ c.abort(), l?.cancel().catch(() => {
202
+ });
203
+ }, h = () => {
204
+ clearTimeout(a), a = setTimeout(() => {
205
+ _ = !0, r();
206
+ }, o);
207
+ };
208
+ e.addEventListener("abort", r, { once: !0 }), h();
209
+ try {
210
+ const d = await t(n, { method: "GET", headers: { Accept: "text/event-stream" }, credentials: "include", signal: c.signal });
211
+ if (d.status === 401) return "unauthorized";
212
+ if (!d.ok || !d.body) return "failed";
213
+ l = d.body.getReader();
214
+ const x = new TextDecoder();
215
+ let w = "";
216
+ for (; ; ) {
217
+ const { done: b, value: u } = await l.read();
218
+ if (e.aborted) return "aborted";
219
+ if (_) return "stalled";
220
+ if (b) return "closed";
221
+ h(), w += x.decode(u, { stream: !0 }).replace(/\r\n/g, `
222
+ `);
223
+ const k = w.split(`
224
+
225
+ `);
226
+ w = k.pop() ?? "";
227
+ for (const g of k) {
228
+ const N = ze(g);
229
+ N && i(N);
230
+ }
231
+ }
232
+ } catch (d) {
233
+ return e.aborted ? "aborted" : _ ? "stalled" : d instanceof Error && d.name === "AbortError" ? "aborted" : "failed";
234
+ } finally {
235
+ clearTimeout(a), e.removeEventListener("abort", r);
236
+ }
237
+ }
238
+ function Ke(n) {
239
+ const { http: t, signal: e, pageSize: i = 20, backoff: o = { min: 1e3, max: 3e4 }, idleTimeout: c = 5e4, transport: l = xe, now: _ = () => /* @__PURE__ */ new Date() } = n, a = W([]), r = M(0), h = M(!1), d = W({ status: "idle" }), x = M("idle");
240
+ let w = 0;
241
+ const b = () => _().toISOString();
242
+ async function u() {
243
+ try {
244
+ const { data: f } = await t.request(E.unread, void 0, { signal: e });
245
+ e.aborted || (r.value = f.unread_count);
246
+ } catch {
247
+ }
248
+ }
249
+ async function k() {
250
+ const f = ++w;
251
+ x.value = "idle", d.value = { status: "loading" };
252
+ try {
253
+ const { data: p } = await t.request(E.list, { limit: i }, { signal: e });
254
+ if (e.aborted || f !== w) return;
255
+ a.value = Ue(p.items, a.value), h.value = p.has_more, d.value = { status: "loaded" };
256
+ } catch (p) {
257
+ if (e.aborted || f !== w) return;
258
+ d.value = { status: "failed", error: p };
259
+ }
260
+ }
261
+ async function g() {
262
+ const f = a.value[a.value.length - 1]?.id;
263
+ if (!h.value || x.value === "loading" || f === void 0) return;
264
+ const p = w;
265
+ x.value = "loading";
266
+ try {
267
+ const { data: v } = await t.request(E.list, { before_id: f, limit: i }, { signal: e });
268
+ if (e.aborted || p !== w) return;
269
+ a.value = Ie(a.value, v.items), h.value = v.has_more, x.value = "idle";
270
+ } catch {
271
+ !e.aborted && p === w && (x.value = "failed");
272
+ }
273
+ }
274
+ async function N(f) {
275
+ if (!(f.read_at !== null || a.value.find((p) => p.id === f.id)?.read_at)) {
276
+ a.value = Oe(a.value, f.id, b()), r.value = Math.max(0, r.value - 1);
277
+ try {
278
+ const { data: p } = await t.request(E.read, { id: f.id }, { signal: e });
279
+ e.aborted || (r.value = p.unread_count);
280
+ } catch {
281
+ if (e.aborted) return;
282
+ a.value = a.value.map((p) => p.id === f.id ? { ...p, read_at: null } : p), await u();
283
+ }
284
+ }
285
+ }
286
+ async function le() {
287
+ const f = re(a.value);
288
+ if (f === 0) return;
289
+ const p = new Set(a.value.filter((v) => v.read_at === null && v.id <= f).map((v) => v.id));
290
+ a.value = qe(a.value, f, b()), r.value = Math.max(0, r.value - p.size);
291
+ try {
292
+ const { data: v } = await t.request(E.readAll, { up_to_id: f }, { signal: e });
293
+ e.aborted || (r.value = v.unread_count);
294
+ } catch {
295
+ if (e.aborted) return;
296
+ a.value = a.value.map((v) => p.has(v.id) ? { ...v, read_at: null } : v), await u();
297
+ }
298
+ }
299
+ let A = o.min, I = null;
300
+ const de = (f) => new Promise((p) => {
301
+ const v = () => {
302
+ clearTimeout(B), e.removeEventListener("abort", v), I = null, p();
303
+ }, B = setTimeout(v, f);
304
+ e.addEventListener("abort", v, { once: !0 }), I = v;
305
+ });
306
+ async function fe() {
307
+ for (let f = !1; !e.aborted; f = !0) {
308
+ if (f && await u(), e.aborted) return;
309
+ let p = !1;
310
+ if (await Ge({
311
+ url: n.streamUrl,
312
+ transport: l,
313
+ signal: e,
314
+ idleTimeout: c,
315
+ onEvent(v) {
316
+ p = !0;
317
+ const B = Be({ items: a.value, unreadCount: r.value }, v, b());
318
+ a.value = B.items, r.value = B.unreadCount;
319
+ }
320
+ }), e.aborted) return;
321
+ p && (A = o.min), await de(A), A = Math.min(A * 2, o.max);
322
+ }
323
+ }
324
+ const F = () => {
325
+ document.visibilityState === "visible" && (u(), A = o.min, I?.());
326
+ }, V = () => {
327
+ u(), A = o.min, I?.();
328
+ };
329
+ return document.addEventListener("visibilitychange", F), window.addEventListener("online", V), e.addEventListener(
330
+ "abort",
331
+ () => {
332
+ document.removeEventListener("visibilitychange", F), window.removeEventListener("online", V);
333
+ },
334
+ { once: !0 }
335
+ ), e.aborted || fe(), { items: R(a), unreadCount: R(r), hasMore: R(h), list: R(d), more: R(x), load: k, loadMore: g, markRead: N, markAllRead: le };
336
+ }
337
+ const ce = /* @__PURE__ */ O({
338
+ __name: "MarkAllRead",
339
+ props: {
340
+ inbox: {}
341
+ },
342
+ setup(n) {
343
+ const { t } = U();
344
+ return (e, i) => (y(), q(s(G), {
345
+ prominence: "plain",
346
+ size: "sm",
347
+ icon: "checkDoubleLine",
348
+ "data-notification-mark-all": "",
349
+ disabled: n.inbox.unreadCount.value === 0,
350
+ onClick: i[0] || (i[0] = (o) => n.inbox.markAllRead())
351
+ }, {
352
+ default: $(() => [
353
+ X(P(s(t)("core.notifications.mark_all_read")), 1)
354
+ ]),
355
+ _: 1
356
+ }, 8, ["disabled"]));
357
+ }
358
+ }), ue = /* @__PURE__ */ O({
359
+ __name: "SettingsLink",
360
+ emits: ["click"],
361
+ setup(n, { emit: t }) {
362
+ const e = t, { t: i } = U();
363
+ return (o, c) => (y(), q(s(G), Z({
364
+ prominence: "plain",
365
+ size: "sm",
366
+ icon: "settings3Line",
367
+ to: s(j).index
368
+ }, { "aria-label": s(i)("core.notifications.settings.open"), title: s(i)("core.notifications.settings.open") }, {
369
+ "data-notification-settings": "",
370
+ onClick: c[0] || (c[0] = (l) => e("click"))
371
+ }), null, 16, ["to"]));
372
+ }
373
+ }), je = {
374
+ "data-notification-inbox": "",
375
+ class: "w-full min-w-0 sm:w-96"
376
+ }, Fe = {
377
+ key: 0,
378
+ class: "mb-1 flex items-center justify-between gap-2"
379
+ }, Ve = { class: "px-1 text-headline font-semibold" }, He = { class: "flex items-center gap-1" }, Je = { class: "-mx-1 max-h-[min(28rem,60dvh)] overflow-y-auto overscroll-contain" }, Ye = ["data-unread", "onClick"], Qe = { class: "min-w-0 flex-1" }, Xe = {
380
+ key: 0,
381
+ class: "mt-0.5 line-clamp-2 block text-footnote text-content-muted"
382
+ }, Ze = ["datetime"], et = {
383
+ key: 0,
384
+ class: "mt-2 size-2 shrink-0 rounded-full bg-content-link",
385
+ "aria-hidden": "true"
386
+ }, tt = {
387
+ key: 1,
388
+ class: "sr-only"
389
+ }, nt = {
390
+ key: 0,
391
+ class: "mt-2 flex flex-col items-center gap-1",
392
+ "data-notification-more": ""
393
+ }, it = {
394
+ key: 0,
395
+ class: "text-footnote text-status-danger-content",
396
+ role: "alert"
397
+ }, ot = "bg-fill text-content-muted", Q = /* @__PURE__ */ O({
398
+ __name: "InboxPanel",
399
+ props: {
400
+ inbox: {},
401
+ appearance: {}
402
+ },
403
+ emits: ["close"],
404
+ setup(n, { emit: t }) {
405
+ const e = n, i = t, { t: o } = U(), c = Te(), l = Ee(), { categories: _, settings: a } = te(), r = {
406
+ amber: "bg-category-amber-surface text-category-amber-content",
407
+ lime: "bg-category-lime-surface text-category-lime-content",
408
+ teal: "bg-category-teal-surface text-category-teal-content",
409
+ cyan: "bg-category-cyan-surface text-category-cyan-content",
410
+ blue: "bg-category-blue-surface text-category-blue-content",
411
+ indigo: "bg-category-indigo-surface text-category-indigo-content",
412
+ violet: "bg-category-violet-surface text-category-violet-content",
413
+ fuchsia: "bg-category-fuchsia-surface text-category-fuchsia-content",
414
+ pink: "bg-category-pink-surface text-category-pink-content"
415
+ }, h = D(() => {
416
+ const { list: b, items: u } = e.inbox;
417
+ if (b.value.status === "failed") {
418
+ const k = o("core.notifications.load_error");
419
+ return u.value.length > 0 ? { status: "stale", value: u.value, error: k } : { status: "failed", error: k };
420
+ }
421
+ return b.value.status === "loaded" ? { status: "loaded", value: u.value } : u.value.length > 0 ? { status: "refreshing", value: u.value } : { status: "loading" };
422
+ }), d = (b) => {
423
+ const u = _[b.category];
424
+ return { icon: u?.icon ?? "notification3Line", classes: u?.hue ? r[u.hue] : ot };
425
+ }, x = (b) => b.startsWith("/") && !b.startsWith("//");
426
+ function w(b) {
427
+ e.inbox.markRead(b), !(b.link === "" || !x(b.link)) && (i("close"), c.push(b.link));
428
+ }
429
+ return (b, u) => (y(), S("div", je, [
430
+ n.appearance === "popover" ? (y(), S("div", Fe, [
431
+ C("h2", Ve, P(s(o)("core.notifications.title")), 1),
432
+ C("div", He, [
433
+ s(a) ? (y(), q(ue, {
434
+ key: 0,
435
+ onClick: u[0] || (u[0] = (k) => i("close"))
436
+ })) : L("", !0),
437
+ T(ce, { inbox: n.inbox }, null, 8, ["inbox"])
438
+ ])
439
+ ])) : L("", !0),
440
+ T(s(Pe), {
441
+ state: h.value,
442
+ "empty-title": s(o)("core.notifications.empty_title"),
443
+ "empty-description": s(o)("core.notifications.empty_description"),
444
+ "empty-icon": "notification3Line",
445
+ onRetry: u[2] || (u[2] = (k) => n.inbox.load())
446
+ }, {
447
+ default: $(({ value: k }) => [
448
+ C("ul", Je, [
449
+ (y(!0), S(z, null, ve(k, (g) => (y(), S("li", {
450
+ key: g.id
451
+ }, [
452
+ C("button", {
453
+ type: "button",
454
+ "data-notification-item": "",
455
+ "data-unread": g.read_at === null ? "true" : void 0,
456
+ class: "flex w-full cursor-pointer items-start gap-3 rounded-control px-2 py-2.5 text-left transition-colors duration-motion-fast hover:bg-fill focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-border-focus",
457
+ onClick: (N) => w(g)
458
+ }, [
459
+ C("span", {
460
+ class: H(["flex size-9 shrink-0 items-center justify-center rounded-full", d(g).classes]),
461
+ "aria-hidden": "true"
462
+ }, [
463
+ T(s(Ce), {
464
+ name: d(g).icon,
465
+ size: 18
466
+ }, null, 8, ["name"])
467
+ ], 2),
468
+ C("span", Qe, [
469
+ C("span", {
470
+ class: H(["block text-subheadline", g.read_at === null ? "font-semibold text-content-strong" : "font-medium text-content"])
471
+ }, P(g.title), 3),
472
+ g.body ? (y(), S("span", Xe, P(g.body), 1)) : L("", !0),
473
+ C("time", {
474
+ datetime: g.created_at,
475
+ class: "mt-0.5 block text-footnote text-content-muted"
476
+ }, P(s(l).relative(g.created_at)), 9, Ze)
477
+ ]),
478
+ g.read_at === null ? (y(), S("span", et)) : L("", !0),
479
+ g.read_at === null ? (y(), S("span", tt, P(s(o)("core.notifications.unread")), 1)) : L("", !0)
480
+ ], 8, Ye)
481
+ ]))), 128))
482
+ ]),
483
+ n.inbox.hasMore.value ? (y(), S("div", nt, [
484
+ n.inbox.more.value === "failed" ? (y(), S("p", it, P(s(o)("core.notifications.load_more_error")), 1)) : L("", !0),
485
+ T(s(G), {
486
+ prominence: "plain",
487
+ size: "sm",
488
+ processing: n.inbox.more.value === "loading",
489
+ onClick: u[1] || (u[1] = (g) => n.inbox.loadMore())
490
+ }, {
491
+ default: $(() => [
492
+ X(P(s(o)("core.notifications.load_more")), 1)
493
+ ]),
494
+ _: 1
495
+ }, 8, ["processing"])
496
+ ])) : L("", !0)
497
+ ]),
498
+ _: 1
499
+ }, 8, ["state", "empty-title", "empty-description"])
500
+ ]));
501
+ }
502
+ }), at = { class: "flex items-center justify-center" }, st = /* @__PURE__ */ O({
503
+ __name: "NotificationBell",
504
+ setup(n) {
505
+ const { t } = U(), { inbox: e, settings: i } = te(), o = we(), c = be("sheet"), l = D(() => e.value?.unreadCount.value ?? 0), _ = D(() => l.value > 0 ? t("core.notifications.open_unread", { count: l.value }) : t("core.notifications.open")), a = D(() => l.value > 0 ? De(l.value) : void 0);
506
+ return (r, h) => s(e) ? (y(), S(z, { key: 0 }, [
507
+ s(o) ? (y(), S(z, { key: 1 }, [
508
+ T(J, {
509
+ icon: "notification3Line",
510
+ label: _.value,
511
+ badge: a.value,
512
+ "data-notification-bell": "",
513
+ onClick: h[1] || (h[1] = (d) => {
514
+ c.value?.present(), s(e).load();
515
+ })
516
+ }, null, 8, ["label", "badge"]),
517
+ T(s(ke), {
518
+ ref_key: "sheet",
519
+ ref: c,
520
+ title: s(t)("core.notifications.title")
521
+ }, he({
522
+ footer: $(() => [
523
+ C("div", at, [
524
+ T(ce, { inbox: s(e) }, null, 8, ["inbox"])
525
+ ])
526
+ ]),
527
+ default: $(() => [
528
+ T(Q, {
529
+ inbox: s(e),
530
+ appearance: "sheet",
531
+ onClose: h[3] || (h[3] = (d) => c.value?.dismiss())
532
+ }, null, 8, ["inbox"])
533
+ ]),
534
+ _: 2
535
+ }, [
536
+ s(i) ? {
537
+ name: "actions",
538
+ fn: $(() => [
539
+ T(ue, {
540
+ onClick: h[2] || (h[2] = (d) => c.value?.dismiss())
541
+ })
542
+ ]),
543
+ key: "0"
544
+ } : void 0
545
+ ]), 1032, ["title"])
546
+ ], 64)) : (y(), q(s(Se), {
547
+ key: 0,
548
+ placement: "bottom-start",
549
+ width: "auto",
550
+ arrow: !1,
551
+ label: s(t)("core.notifications.title"),
552
+ onPresented: h[0] || (h[0] = (d) => s(e).load())
553
+ }, {
554
+ trigger: $(({ toggle: d, attrs: x }) => [
555
+ T(J, Z(x, {
556
+ icon: "notification3Line",
557
+ label: _.value,
558
+ badge: a.value,
559
+ "data-notification-bell": "",
560
+ onClick: d
561
+ }), null, 16, ["label", "badge", "onClick"])
562
+ ]),
563
+ default: $(({ dismiss: d }) => [
564
+ T(Q, {
565
+ inbox: s(e),
566
+ appearance: "popover",
567
+ onClose: d
568
+ }, null, 8, ["inbox", "onClose"])
569
+ ]),
570
+ _: 1
571
+ }, 8, ["label"]))
572
+ ], 64)) : L("", !0);
573
+ }
574
+ }), rt = ["channels", "quiet", "device", "devices"];
575
+ function ct(n) {
576
+ const t = new Set(rt);
577
+ for (const e of n) {
578
+ if (t.has(e.id)) throw new Error(`notificationsFeature: the settings section "${e.id}" is a built-in id or is given twice.`);
579
+ t.add(e.id);
580
+ }
581
+ return n;
582
+ }
583
+ function ut() {
584
+ return {
585
+ id: "notifications.push",
586
+ scope: "session",
587
+ start({ signal: n, platform: t, report: e }) {
588
+ const i = K();
589
+ return Ae(t.http, i, n).catch((o) => {
590
+ n.aborted || e(o);
591
+ }), t.session.onBeforeSignOut((o, c) => se(t.http, i, c));
592
+ }
593
+ };
594
+ }
595
+ function lt(n) {
596
+ return {
597
+ id: "notifications.inbox",
598
+ scope: "session",
599
+ start({ signal: t, platform: e }) {
600
+ const i = e.config.apiBase.replace(/\/+$/, "");
601
+ return n.value = Ke({ http: e.http, streamUrl: `${i}/${E.stream.path.replace(/^\/+/, "")}`, signal: t }), () => {
602
+ n.value = null;
603
+ };
604
+ }
605
+ };
606
+ }
607
+ function At(n = {}) {
608
+ const t = W(null), e = n.deadLetters ?? {}, i = n.settings ?? !0, o = n.push ?? !0, c = ct(n.settingsSections ?? []);
609
+ return pe({
610
+ id: "notifications",
611
+ routes: [...e === !1 ? [] : Y.records, ...i ? j.records : []],
612
+ navigation: e !== !1 && e.destination ? [{ destination: e.destination, to: Y.index }] : [],
613
+ context: me(Le, { inbox: t, categories: n.categories ?? {}, settings: i, push: o, sections: c }),
614
+ contributions: [
615
+ { id: "notifications.bell", slot: "headerActions", component: st, scope: "authenticated" },
616
+ ...i ? [{ id: "notifications.settings", slot: "accountMenu", component: Ne, scope: "authenticated", optional: !0, order: -9 }] : []
617
+ ],
618
+ effects: [lt(t), ...o ? [ut()] : []]
619
+ });
620
+ }
621
+ export {
622
+ $t as R,
623
+ Rt as a,
624
+ j as b,
625
+ At as c,
626
+ Y as d,
627
+ Lt as e,
628
+ E as n,
629
+ te as u
630
+ };