@epam/ai-dial-chat-hooks 1.4.0-dev.12 → 1.4.0-dev.122

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 (189) hide show
  1. package/api-error/map-api-error.d.ts +10 -0
  2. package/api-error/map-api-error.d.ts.map +1 -0
  3. package/api-error/map-api-error.js +11 -0
  4. package/attachment/useAttachmentAction/useAttachmentAction.d.ts +1 -1
  5. package/attachment/useAttachmentAction/useAttachmentAction.d.ts.map +1 -1
  6. package/attachment/useAttachmentAction/useAttachmentAction.js +35 -44
  7. package/catalog/create-publish-api.d.ts +22 -1
  8. package/catalog/create-publish-api.d.ts.map +1 -1
  9. package/catalog/create-publish-api.js +20 -1
  10. package/catalog/entity-details.d.ts +5 -2
  11. package/catalog/entity-details.d.ts.map +1 -1
  12. package/catalog/map-entity-details-to-catalog.d.ts +4 -0
  13. package/catalog/map-entity-details-to-catalog.d.ts.map +1 -1
  14. package/catalog/map-entity-details-to-catalog.js +15 -13
  15. package/catalog/publish-dependency-icons.d.ts +22 -0
  16. package/catalog/publish-dependency-icons.d.ts.map +1 -0
  17. package/catalog/publish-dependency-icons.js +11 -0
  18. package/catalog/publish-target-taken.d.ts +31 -0
  19. package/catalog/publish-target-taken.d.ts.map +1 -0
  20. package/catalog/publish-target-taken.js +14 -0
  21. package/catalog/publish.d.ts +15 -2
  22. package/catalog/publish.d.ts.map +1 -1
  23. package/catalog/publish.js +15 -4
  24. package/catalog/resource-name-conflict.d.ts.map +1 -1
  25. package/catalog/resource-name-conflict.js +19 -22
  26. package/catalog/resource-save-adapter.d.ts +7 -2
  27. package/catalog/resource-save-adapter.d.ts.map +1 -1
  28. package/catalog/resource-save-adapters.d.ts +32 -7
  29. package/catalog/resource-save-adapters.d.ts.map +1 -1
  30. package/catalog/resource-save-adapters.js +47 -41
  31. package/catalog/resource-save.d.ts +17 -9
  32. package/catalog/resource-save.d.ts.map +1 -1
  33. package/catalog/resource-save.js +34 -25
  34. package/catalog/save-destination-root.d.ts +12 -0
  35. package/catalog/save-destination-root.d.ts.map +1 -0
  36. package/catalog/save-destination-root.js +6 -0
  37. package/catalog/use-publish-dependencies.d.ts +19 -0
  38. package/catalog/use-publish-dependencies.d.ts.map +1 -0
  39. package/catalog/use-publish-dependencies.js +25 -0
  40. package/catalog/use-publish-target-guard.d.ts +45 -0
  41. package/catalog/use-publish-target-guard.d.ts.map +1 -0
  42. package/catalog/use-publish-target-guard.js +18 -0
  43. package/catalog/usePublishFolders/usePublishFolders.d.ts +8 -2
  44. package/catalog/usePublishFolders/usePublishFolders.d.ts.map +1 -1
  45. package/catalog/usePublishFolders/usePublishFolders.js +29 -29
  46. package/catalog/useResourceSavePanel/useResourceSavePanel.d.ts +7 -3
  47. package/catalog/useResourceSavePanel/useResourceSavePanel.d.ts.map +1 -1
  48. package/catalog/useResourceSavePanel/useResourceSavePanel.js +107 -97
  49. package/catalog/useVersionHistory/useVersionHistory.d.ts +38 -0
  50. package/catalog/useVersionHistory/useVersionHistory.d.ts.map +1 -0
  51. package/catalog/useVersionHistory/useVersionHistory.js +49 -0
  52. package/catalog/useVersionHistory/useVersionHistorySection.d.ts +30 -0
  53. package/catalog/useVersionHistory/useVersionHistorySection.d.ts.map +1 -0
  54. package/catalog/useVersionHistory/useVersionHistorySection.js +31 -0
  55. package/catalog/version-history.d.ts +42 -0
  56. package/catalog/version-history.d.ts.map +1 -0
  57. package/catalog/version-history.js +27 -0
  58. package/catalog.js +39 -31
  59. package/conversation/announcement-message.d.ts +12 -0
  60. package/conversation/announcement-message.d.ts.map +1 -1
  61. package/conversation/announcement-message.js +16 -10
  62. package/conversation/conversation-list.d.ts +7 -1
  63. package/conversation/conversation-list.d.ts.map +1 -1
  64. package/conversation/conversation-list.js +11 -2
  65. package/conversation/conversation-transfer/zip-export.d.ts +1 -1
  66. package/conversation/conversation-transfer/zip-export.d.ts.map +1 -1
  67. package/conversation/conversation-transfer/zip-export.js +7 -8
  68. package/conversation/conversation-transfer/zip-import.d.ts.map +1 -1
  69. package/conversation/conversation-transfer/zip-import.js +8 -9
  70. package/conversation/useConversationExport/useConversationExport.d.ts.map +1 -1
  71. package/conversation/useConversationExport/useConversationExport.js +3 -1
  72. package/conversation/useConversationStream/generation-resume.d.ts.map +1 -1
  73. package/conversation/useConversationStream/generation-resume.js +119 -96
  74. package/conversation.js +44 -44
  75. package/entry-points/catalog.d.ts +7 -0
  76. package/entry-points/catalog.d.ts.map +1 -1
  77. package/entry-points/file-manager.d.ts +1 -0
  78. package/entry-points/file-manager.d.ts.map +1 -1
  79. package/entry-points/project.d.ts +5 -0
  80. package/entry-points/project.d.ts.map +1 -1
  81. package/entry-points/scheduled-tasks.d.ts +2 -0
  82. package/entry-points/scheduled-tasks.d.ts.map +1 -1
  83. package/entry-points/usage-limits.d.ts +1 -0
  84. package/entry-points/usage-limits.d.ts.map +1 -1
  85. package/entry-points/utils.d.ts +7 -0
  86. package/entry-points/utils.d.ts.map +1 -1
  87. package/file-manager.js +33 -32
  88. package/files/annotation.d.ts +3 -3
  89. package/files/annotation.d.ts.map +1 -1
  90. package/files/annotation.js +12 -11
  91. package/files/attachment-canvas.d.ts +1 -1
  92. package/files/attachment-canvas.d.ts.map +1 -1
  93. package/files/attachment-canvas.js +135 -135
  94. package/files/attachment-type-labels.d.ts +3 -0
  95. package/files/attachment-type-labels.d.ts.map +1 -0
  96. package/files/attachment-type-labels.js +12 -0
  97. package/files/attachment-types.d.ts +0 -2
  98. package/files/attachment-types.d.ts.map +1 -1
  99. package/files/attachment-types.js +7 -14
  100. package/files/dial-file.d.ts +18 -0
  101. package/files/dial-file.d.ts.map +1 -1
  102. package/files/dial-file.js +30 -5
  103. package/index.d.ts +23 -0
  104. package/index.d.ts.map +1 -1
  105. package/index.js +266 -244
  106. package/org-units/models.d.ts +11 -0
  107. package/org-units/models.d.ts.map +1 -0
  108. package/org-units/org-unit-guards.d.ts +64 -0
  109. package/org-units/org-unit-guards.d.ts.map +1 -0
  110. package/org-units/org-unit-guards.js +28 -0
  111. package/org-units/types.d.ts +14 -0
  112. package/org-units/types.d.ts.map +1 -0
  113. package/org-units/types.js +6 -0
  114. package/org-units/useFolderGuards/useFolderGuards.d.ts +31 -0
  115. package/org-units/useFolderGuards/useFolderGuards.d.ts.map +1 -0
  116. package/org-units/useFolderGuards/useFolderGuards.js +50 -0
  117. package/org-units/useOrgUnits/useOrgUnits.d.ts +34 -0
  118. package/org-units/useOrgUnits/useOrgUnits.d.ts.map +1 -0
  119. package/org-units/useOrgUnits/useOrgUnits.js +54 -0
  120. package/package.json +19 -19
  121. package/project/project-sharing-client.d.ts +8 -0
  122. package/project/project-sharing-client.d.ts.map +1 -0
  123. package/project/project-sharing-client.js +11 -0
  124. package/project/project-sharing.d.ts +28 -0
  125. package/project/project-sharing.d.ts.map +1 -0
  126. package/project/project-sharing.js +22 -0
  127. package/project/use-pinned-project-chats.d.ts +4 -2
  128. package/project/use-pinned-project-chats.d.ts.map +1 -1
  129. package/project/use-pinned-project-chats.js +152 -96
  130. package/project/use-project-conversations.d.ts.map +1 -1
  131. package/project/use-project-conversations.js +2 -2
  132. package/project/use-project-remove-from-list.d.ts +30 -0
  133. package/project/use-project-remove-from-list.d.ts.map +1 -0
  134. package/project/use-project-remove-from-list.js +39 -0
  135. package/project/use-project-revoke-access.d.ts +15 -0
  136. package/project/use-project-revoke-access.d.ts.map +1 -0
  137. package/project/use-project-revoke-access.js +32 -0
  138. package/project/use-project-share-recipients.d.ts +7 -0
  139. package/project/use-project-share-recipients.d.ts.map +1 -0
  140. package/project/use-project-share-recipients.js +36 -0
  141. package/project/use-projects.d.ts +1 -0
  142. package/project/use-projects.d.ts.map +1 -1
  143. package/project/use-projects.js +2 -1
  144. package/project.js +7 -2
  145. package/scheduled-task/scheduled-task-description.d.ts +19 -13
  146. package/scheduled-task/scheduled-task-description.d.ts.map +1 -1
  147. package/scheduled-task/scheduled-task-description.js +39 -55
  148. package/scheduled-task/scheduled-task-display.d.ts +20 -6
  149. package/scheduled-task/scheduled-task-display.d.ts.map +1 -1
  150. package/scheduled-task/scheduled-task-display.js +39 -43
  151. package/scheduled-task/scheduled-task-next-occurrence.d.ts +9 -5
  152. package/scheduled-task/scheduled-task-next-occurrence.d.ts.map +1 -1
  153. package/scheduled-task/scheduled-task-next-occurrence.js +16 -16
  154. package/scheduled-task/scheduled-task-time-format.d.ts +34 -0
  155. package/scheduled-task/scheduled-task-time-format.d.ts.map +1 -0
  156. package/scheduled-task/scheduled-task-time-format.js +33 -0
  157. package/scheduled-task/scheduled-task-trigger.d.ts +6 -4
  158. package/scheduled-task/scheduled-task-trigger.d.ts.map +1 -1
  159. package/scheduled-task/scheduled-task-trigger.js +92 -115
  160. package/scheduled-tasks.js +15 -13
  161. package/shared/timezones.d.ts +30 -0
  162. package/shared/timezones.d.ts.map +1 -0
  163. package/shared/timezones.js +102 -0
  164. package/skill/skill-archive.d.ts.map +1 -1
  165. package/skill/skill-archive.js +6 -7
  166. package/skill/skill.d.ts +2 -2
  167. package/skill/skill.d.ts.map +1 -1
  168. package/skill/skill.js +33 -34
  169. package/skill/useSkillEditorLoad.js +1 -1
  170. package/skill/useSkillEditorSubmit.d.ts +4 -1
  171. package/skill/useSkillEditorSubmit.d.ts.map +1 -1
  172. package/skill/useSkillEditorSubmit.js +125 -121
  173. package/usage/map-usage-data-to-dashboard.d.ts +22 -1
  174. package/usage/map-usage-data-to-dashboard.d.ts.map +1 -1
  175. package/usage/map-usage-data-to-dashboard.js +33 -2
  176. package/usage/spending-limits-mode.d.ts +37 -0
  177. package/usage/spending-limits-mode.d.ts.map +1 -0
  178. package/usage/spending-limits-mode.js +15 -0
  179. package/usage/useDeploymentUsageLimits/useDeploymentUsageLimits.d.ts +6 -2
  180. package/usage/useDeploymentUsageLimits/useDeploymentUsageLimits.d.ts.map +1 -1
  181. package/usage/useUsageLimitBanner/useUsageLimitBanner.d.ts +4 -1
  182. package/usage/useUsageLimitBanner/useUsageLimitBanner.d.ts.map +1 -1
  183. package/usage/useUsageLimitBanner/useUsageLimitBanner.js +55 -47
  184. package/usage-limits.js +6 -5
  185. package/usage.js +3 -3
  186. package/utils.js +27 -21
  187. package/shared/cron-day-of-month.d.ts +0 -21
  188. package/shared/cron-day-of-month.d.ts.map +0 -1
  189. package/shared/cron-day-of-month.js +0 -13
@@ -0,0 +1,11 @@
1
+ import { OrgUnit } from '@epam/ai-dial-chat-shared';
2
+ /** What the host's org-units read resolves to. */
3
+ export interface OrgUnitsListResult {
4
+ /** `false` when DIAL Core has org units turned off. */
5
+ enabled: boolean;
6
+ /** `true` when the current user is a DIAL admin. */
7
+ hasAdminAccess: boolean;
8
+ /** The units the current user may see, each with their permissions. */
9
+ units: OrgUnit[];
10
+ }
11
+ //# sourceMappingURL=models.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../src/org-units/models.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAEzD,kDAAkD;AAClD,MAAM,WAAW,kBAAkB;IACjC,uDAAuD;IACvD,OAAO,EAAE,OAAO,CAAC;IACjB,oDAAoD;IACpD,cAAc,EAAE,OAAO,CAAC;IACxB,uEAAuE;IACvE,KAAK,EAAE,OAAO,EAAE,CAAC;CAClB"}
@@ -0,0 +1,64 @@
1
+ import { OrgUnitNamespace } from '@epam/ai-dial-chat-shared';
2
+ import { CatalogPublishEntityType } from '../catalog/publish';
3
+ import { SaveDestinationRoot } from '../catalog/save-destination-root';
4
+ import { OrgUnitsStatus } from './types';
5
+ import { OrgUnitRightCheck } from './useOrgUnits/useOrgUnits';
6
+ /**
7
+ * The Core namespace an org unit grants rights on for a publishable resource
8
+ * type. Quick App, schema-form and custom applications are all `application`.
9
+ * A model is never saved or published by a user, so it has no namespace. A
10
+ * conversation has no catalog entity type; its containers pass
11
+ * `OrgUnitNamespace.Conversations` directly.
12
+ * @param entityType - the publish API's entity type
13
+ */
14
+ export declare const getOrgUnitNamespace: (entityType: CatalogPublishEntityType) => OrgUnitNamespace | undefined;
15
+ /** Which panel the guards are built for; picks the right they check. */
16
+ export declare enum OrgUnitFolderGuardPurpose {
17
+ /** A save destination is usable outside every unit, and inside one only with `write` on its owner. */
18
+ Save = "save",
19
+ /** A publication request needs `read` on the owning unit. */
20
+ Publish = "publish"
21
+ }
22
+ /** Inputs of {@link buildFolderGuards}. */
23
+ export interface BuildFolderGuardsParams {
24
+ purpose: OrgUnitFolderGuardPurpose;
25
+ /** Whether the `orgUnitsEnabled` feature flag is on. */
26
+ isEnabled: boolean;
27
+ /** Load status from `useOrgUnits`. */
28
+ status: OrgUnitsStatus;
29
+ /** Namespace of the resource type, from {@link getOrgUnitNamespace}; `undefined` turns the guards off. */
30
+ namespace: OrgUnitNamespace | undefined;
31
+ canSaveAt: OrgUnitRightCheck;
32
+ canPublishAt: OrgUnitRightCheck;
33
+ /** Strict check from `useOrgUnits`; omit it when the panel has no direct save. */
34
+ canSaveDirectlyAt?: OrgUnitRightCheck;
35
+ /** The host's translated reason shown for a disabled folder; without it `getDisabledReason` is `undefined`. */
36
+ getReason?: (folderPath: string[]) => string;
37
+ }
38
+ /** Guards a panel passes to its folder tree; both are `undefined` while the rule does not apply. */
39
+ export interface FolderGuards {
40
+ /** Whether a destination is usable for the panel's purpose (Save: `canSaveAt`, Publish: `canPublishAt`); a host passes it to `usePublishFolders` as `canPublishTo`, where it replaces the `Production` placeholder. Only the Organization root is matched against units: any other `root` is always usable, and an omitted `root` means Organization (the publish panels' only tree). */
41
+ isDestinationUsable: ((folderPath: string[], root?: SaveDestinationRoot) => boolean) | undefined;
42
+ /** The reason a destination is disabled, or `undefined` when it is usable; `root` follows the same rule as in `isDestinationUsable`. */
43
+ getDisabledReason: ((folderPath: string[], root?: SaveDestinationRoot) => string | undefined) | undefined;
44
+ /** Whether a save may write straight into the destination (inside an org unit that grants `write`); like `isDestinationUsable`, only the Organization root (or an omitted root) can be a unit, so a Personal folder never direct-writes. `undefined` while the rule does not apply or no check was given. */
45
+ canSaveDirectlyTo: ((folderPath: string[], root?: SaveDestinationRoot) => boolean) | undefined;
46
+ }
47
+ /**
48
+ * Builds the folder guards from the org-unit answers. They exist only with the
49
+ * feature flag on, status `Ready` and a namespace; otherwise both are
50
+ * `undefined`, so a panel keeps today's behaviour (the `Production`
51
+ * placeholder, no disabled rows).
52
+ * @param params - flag, status, namespace, the hook's right checks and the reason text callback
53
+ */
54
+ export declare const buildFolderGuards: ({ purpose, isEnabled, status, namespace, canSaveAt, canPublishAt, canSaveDirectlyAt, getReason, }: BuildFolderGuardsParams) => FolderGuards;
55
+ /**
56
+ * Adapts a guard's `getDisabledReason(folderPath)` to the publish panels'
57
+ * `getDisabledReason(destination)`: a publish tree has one root, so only the
58
+ * path is judged.
59
+ * @param getDisabledReason - the guard's callback, or `undefined` while the rule does not apply
60
+ */
61
+ export declare const toPublishDisabledReason: (getDisabledReason: ((folderPath: string[]) => string | undefined) | undefined) => ((destination: {
62
+ path: string[];
63
+ }) => string | undefined) | undefined;
64
+ //# sourceMappingURL=org-unit-guards.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"org-unit-guards.d.ts","sourceRoot":"","sources":["../../src/org-units/org-unit-guards.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAcnE;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,GAC9B,YAAY,wBAAwB,KACnC,gBAAgB,GAAG,SAAiD,CAAC;AAExE,wEAAwE;AACxE,oBAAY,yBAAyB;IACnC,sGAAsG;IACtG,IAAI,SAAS;IACb,6DAA6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AAE,KAAK,MAAM,GAAG,SAAS,CAAC,GAAG,SACc,CAAC"}
@@ -0,0 +1,28 @@
1
+ import { SaveDestinationRoot as e } from "../catalog/save-destination-root.js";
2
+ import { OrgUnitsStatus as t } from "./types.js";
3
+ import { OrgUnitNamespace as n } from "@epam/ai-dial-chat-shared";
4
+ //#region src/org-units/org-unit-guards.ts
5
+ var r = {
6
+ model: void 0,
7
+ toolset: n.Toolsets,
8
+ application: n.Applications,
9
+ prompt: n.Prompts,
10
+ skill: n.Skills,
11
+ project: n.Projects
12
+ }, i = (e) => r[e], a = /* @__PURE__ */ function(e) {
13
+ return e.Save = "save", e.Publish = "publish", e;
14
+ }({}), o = ({ purpose: n, isEnabled: r, status: i, namespace: a, canSaveAt: o, canPublishAt: s, canSaveDirectlyAt: c, getReason: l }) => {
15
+ if (!r || i !== t.Ready || a == null) return {
16
+ isDestinationUsable: void 0,
17
+ getDisabledReason: void 0,
18
+ canSaveDirectlyTo: void 0
19
+ };
20
+ let u = n === "save" ? o : s, d = (t, n = e.Organization) => n !== e.Organization || u(t.join("/"), a);
21
+ return {
22
+ isDestinationUsable: d,
23
+ canSaveDirectlyTo: c && ((t, n = e.Organization) => n === e.Organization && c(t.join("/"), a)),
24
+ getDisabledReason: l && ((e, t) => d(e, t) ? void 0 : l(e))
25
+ };
26
+ }, s = (e) => e && ((t) => e(t.path));
27
+ //#endregion
28
+ export { a as OrgUnitFolderGuardPurpose, o as buildFolderGuards, i as getOrgUnitNamespace, s as toPublishDisabledReason };
@@ -0,0 +1,14 @@
1
+ /** Load state of the org units read by `useOrgUnits`. */
2
+ export declare enum OrgUnitsStatus {
3
+ /** Nothing has asked for the units yet. */
4
+ Idle = "idle",
5
+ /** The read is in flight. */
6
+ Loading = "loading",
7
+ /** The units are loaded. */
8
+ Ready = "ready",
9
+ /** DIAL Core has org units turned off. */
10
+ Disabled = "disabled",
11
+ /** The read failed; no units are known. */
12
+ Error = "error"
13
+ }
14
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/org-units/types.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,oBAAY,cAAc;IACxB,2CAA2C;IAC3C,IAAI,SAAS;IACb,6BAA6B;IAC7B,OAAO,YAAY;IACnB,4BAA4B;IAC5B,KAAK,UAAU;IACf,0CAA0C;IAC1C,QAAQ,aAAa;IACrB,2CAA2C;IAC3C,KAAK,UAAU;CAChB"}
@@ -0,0 +1,6 @@
1
+ //#region src/org-units/types.ts
2
+ var e = /* @__PURE__ */ function(e) {
3
+ return e.Idle = "idle", e.Loading = "loading", e.Ready = "ready", e.Disabled = "disabled", e.Error = "error", e;
4
+ }({});
5
+ //#endregion
6
+ export { e as OrgUnitsStatus };
@@ -0,0 +1,31 @@
1
+ import { OrgUnitNamespace } from '@epam/ai-dial-chat-shared';
2
+ import { OrgUnitFolderGuardPurpose, FolderGuards } from '../org-unit-guards';
3
+ import { UseOrgUnitsResult } from '../useOrgUnits/useOrgUnits';
4
+ /** What {@link useFolderGuards} reads from `useOrgUnits`. */
5
+ export type FolderGuardsOrgUnits = Pick<UseOrgUnitsResult, 'status' | 'ensureUnits' | 'refreshUnits' | 'canSaveAt' | 'canPublishAt' | 'canSaveDirectlyAt'>;
6
+ /** Parameters of {@link useFolderGuards}. */
7
+ export interface UseFolderGuardsParams {
8
+ /** Save uses `canSaveAt` (and the strict direct-save check), Publish uses `canPublishAt`. */
9
+ purpose: OrgUnitFolderGuardPurpose;
10
+ /** Core namespace of the resource; `undefined` turns the guards off. */
11
+ namespace: OrgUnitNamespace | undefined;
12
+ /** Whether the panel is open; the org-unit read starts only while it is true. */
13
+ isActive: boolean;
14
+ /** Whether the host's `orgUnitsEnabled` feature flag is on. */
15
+ isEnabled: boolean;
16
+ /** The result of `useOrgUnits` (the host usually shares one through a context). */
17
+ orgUnits: FolderGuardsOrgUnits;
18
+ /** Re-read already loaded rights each time the panel opens, so a right that changed since is honoured. Defaults to `false`. */
19
+ shouldRefreshOnOpen?: boolean;
20
+ /** The host's translated reason shown for a disabled folder; without it `getDisabledReason` is `undefined`. Keep its identity stable (memoise it): a new function each render rebuilds the guards and so re-renders the folder tree. */
21
+ getReason?: (folderPath: string[]) => string;
22
+ }
23
+ /**
24
+ * The org-unit folder guards of a Save or Publish panel: starts the org-unit
25
+ * read while the panel is active, optionally re-reads loaded rights on open,
26
+ * and builds the guards, which exist only with the flag on and the rights
27
+ * `Ready`.
28
+ * @param params - purpose, namespace, flag, the org-unit result and the reason callback
29
+ */
30
+ export declare const useFolderGuards: ({ purpose, namespace, isActive, isEnabled, orgUnits, shouldRefreshOnOpen, getReason, }: UseFolderGuardsParams) => FolderGuards;
31
+ //# sourceMappingURL=useFolderGuards.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFolderGuards.d.ts","sourceRoot":"","sources":["../../../src/org-units/useFolderGuards/useFolderGuards.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAElE,OAAO,EAEL,yBAAyB,EACzB,KAAK,YAAY,EAClB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAEpE,6DAA6D;AAC7D,MAAM,MAAM,oBAAoB,GAAG,IAAI,CACrC,iBAAiB,EACf,QAAQ,GACR,aAAa,GACb,cAAc,GACd,WAAW,GACX,cAAc,GACd,mBAAmB,CACtB,CAAC;AAEF,6CAA6C;AAC7C,MAAM,WAAW,qBAAqB;IACpC,6FAA6F;IAC7F,OAAO,EAAE,yBAAyB,CAAC;IACnC,wEAAwE;IACxE,SAAS,EAAE,gBAAgB,GAAG,SAAS,CAAC;IACxC,iFAAiF;IACjF,QAAQ,EAAE,OAAO,CAAC;IAClB,+DAA+D;IAC/D,SAAS,EAAE,OAAO,CAAC;IACnB,mFAAmF;IACnF,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,+HAA+H;IAC/H,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,wOAAwO;IACxO,SAAS,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,MAAM,CAAC;CAC9C;AAED;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,GAAI,wFAQ7B,qBAAqB,KAAG,YAkD1B,CAAC"}
@@ -0,0 +1,50 @@
1
+ import { OrgUnitsStatus as e } from "../types.js";
2
+ import { OrgUnitFolderGuardPurpose as t, buildFolderGuards as n } from "../org-unit-guards.js";
3
+ import { useEffect as r, useMemo as i, useRef as a } from "react";
4
+ //#region src/org-units/useFolderGuards/useFolderGuards.ts
5
+ var o = ({ purpose: o, namespace: s, isActive: c, isEnabled: l, orgUnits: u, shouldRefreshOnOpen: d = !1, getReason: f }) => {
6
+ let { status: p, ensureUnits: m, refreshUnits: h, canSaveAt: g, canPublishAt: _, canSaveDirectlyAt: v } = u, y = a({
7
+ status: p,
8
+ refreshUnits: h
9
+ });
10
+ return r(() => {
11
+ y.current = {
12
+ status: p,
13
+ refreshUnits: h
14
+ };
15
+ }, [p, h]), r(() => {
16
+ c && l && m();
17
+ }, [
18
+ c,
19
+ l,
20
+ m
21
+ ]), r(() => {
22
+ if (!c || !l || !d) return;
23
+ let { status: t, refreshUnits: n } = y.current;
24
+ t === e.Ready && n();
25
+ }, [
26
+ c,
27
+ l,
28
+ d
29
+ ]), i(() => n({
30
+ purpose: o,
31
+ isEnabled: l,
32
+ status: p,
33
+ namespace: s,
34
+ canSaveAt: g,
35
+ canPublishAt: _,
36
+ canSaveDirectlyAt: o === t.Save ? v : void 0,
37
+ getReason: f
38
+ }), [
39
+ o,
40
+ s,
41
+ l,
42
+ p,
43
+ g,
44
+ _,
45
+ v,
46
+ f
47
+ ]);
48
+ };
49
+ //#endregion
50
+ export { o as useFolderGuards };
@@ -0,0 +1,34 @@
1
+ import { OrgUnitNamespace } from '@epam/ai-dial-chat-shared';
2
+ import { OrgUnitsListResult } from '../models';
3
+ import { OrgUnitsStatus } from '../types';
4
+ /** Options for {@link useOrgUnits}. */
5
+ export interface UseOrgUnitsOptions {
6
+ /** Reads the org units visible to the current user; supplied by the host. */
7
+ listOrgUnits: () => Promise<OrgUnitsListResult>;
8
+ }
9
+ /** Answers whether an action is allowed at a decoded public-relative path for a Core namespace. */
10
+ export type OrgUnitRightCheck = (publicPath: string, namespace: OrgUnitNamespace) => boolean;
11
+ /** State returned by {@link useOrgUnits}. */
12
+ export interface UseOrgUnitsResult {
13
+ /** Load state of the units. */
14
+ status: OrgUnitsStatus;
15
+ /** Starts the read on its first call, and again after a failed read; otherwise does nothing. */
16
+ ensureUnits: () => void;
17
+ /** Reads the units again while the previous answer stays in use; does nothing once Core reported org units off. */
18
+ refreshUnits: () => void;
19
+ /** Whether the path is a usable save destination: `true` outside every unit, otherwise needs `write`; `true` until the status is `Ready`. */
20
+ canSaveAt: OrgUnitRightCheck;
21
+ /** Whether the user may write straight into the path: it lies inside an org unit that grants `write`. `false` until the status is `Ready` and outside every unit, even for a DIAL admin. */
22
+ canSaveDirectlyAt: OrgUnitRightCheck;
23
+ /** Whether a publication request into the path can be sent; `true` until the status is `Ready`. */
24
+ canPublishAt: OrgUnitRightCheck;
25
+ }
26
+ /**
27
+ * Loads the current user's org units once, on demand, and answers save, direct-save
28
+ * and publication-request rights per path. Until the status is `Ready` (and in
29
+ * `Disabled` and `Error`) every answer is `true` except `canSaveDirectlyAt`, so missing
30
+ * data never disables a folder.
31
+ * @param options - the host-supplied `listOrgUnits` read
32
+ */
33
+ export declare const useOrgUnits: ({ listOrgUnits, }: UseOrgUnitsOptions) => UseOrgUnitsResult;
34
+ //# sourceMappingURL=useOrgUnits.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useOrgUnits.d.ts","sourceRoot":"","sources":["../../../src/org-units/useOrgUnits/useOrgUnits.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,gBAAgB,EACtB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C,uCAAuC;AACvC,MAAM,WAAW,kBAAkB;IACjC,6EAA6E;IAC7E,YAAY,EAAE,MAAM,OAAO,CAAC,kBAAkB,CAAC,CAAC;CACjD;AAED,mGAAmG;AACnG,MAAM,MAAM,iBAAiB,GAAG,CAC9B,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,gBAAgB,KACxB,OAAO,CAAC;AAEb,6CAA6C;AAC7C,MAAM,WAAW,iBAAiB;IAChC,+BAA+B;IAC/B,MAAM,EAAE,cAAc,CAAC;IACvB,gGAAgG;IAChG,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,mHAAmH;IACnH,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,6IAA6I;IAC7I,SAAS,EAAE,iBAAiB,CAAC;IAC7B,4LAA4L;IAC5L,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,mGAAmG;IACnG,YAAY,EAAE,iBAAiB,CAAC;CACjC;AAID;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,GAAI,mBAEzB,kBAAkB,KAAG,iBAiGvB,CAAC"}
@@ -0,0 +1,54 @@
1
+ import { OrgUnitsStatus as e } from "../types.js";
2
+ import { canRequestPublicationAt as t, canSaveToFolderAt as n, canWriteIntoOrgUnitAt as r } from "@epam/ai-dial-chat-shared";
3
+ import { useCallback as i, useEffect as a, useMemo as o, useRef as s, useState as c } from "react";
4
+ //#region src/org-units/useOrgUnits/useOrgUnits.ts
5
+ var l = {
6
+ hasAdminAccess: !1,
7
+ units: []
8
+ }, u = ({ listOrgUnits: u }) => {
9
+ let [d, f] = c(l), [p, m] = c(e.Idle), h = s(!1), g = s(p);
10
+ g.current = p;
11
+ let _ = s(!0), v = s(u);
12
+ v.current = u, a(() => (_.current = !0, () => {
13
+ _.current = !1;
14
+ }), []);
15
+ let y = i(async (t) => {
16
+ t || m(e.Loading);
17
+ try {
18
+ let t = await v.current();
19
+ if (!_.current) return;
20
+ if (!t.enabled) {
21
+ f(l), m(e.Disabled);
22
+ return;
23
+ }
24
+ f({
25
+ hasAdminAccess: t.hasAdminAccess,
26
+ units: t.units
27
+ }), m(e.Ready);
28
+ } catch {
29
+ if (t || (h.current = !1, !_.current)) return;
30
+ f(l), m(e.Error);
31
+ }
32
+ }, []), b = i(() => {
33
+ h.current || (h.current = !0, y(!1));
34
+ }, [y]), x = i(() => {
35
+ g.current !== e.Disabled && (g.current === e.Ready ? y(!0) : b());
36
+ }, [b, y]), S = p === e.Ready, C = i((e, t) => !S || n(d, e, t), [S, d]), w = i((e, t) => S && r(d, e, t), [S, d]), T = i((e, n) => !S || t(d, e, n), [S, d]);
37
+ return o(() => ({
38
+ status: p,
39
+ ensureUnits: b,
40
+ refreshUnits: x,
41
+ canSaveAt: C,
42
+ canSaveDirectlyAt: w,
43
+ canPublishAt: T
44
+ }), [
45
+ p,
46
+ b,
47
+ x,
48
+ C,
49
+ w,
50
+ T
51
+ ]);
52
+ };
53
+ //#endregion
54
+ export { u as useOrgUnits };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@epam/ai-dial-chat-hooks",
3
3
  "description": "Framework-level React hooks extracted from AI DIAL Chat for building custom chat interfaces",
4
- "version": "1.4.0-dev.12",
4
+ "version": "1.4.0-dev.122",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "main": "./index.js",
@@ -131,7 +131,7 @@
131
131
  }
132
132
  },
133
133
  "dependencies": {
134
- "@epam/ai-dial-chat-api-client": "1.4.0-dev.12",
134
+ "@epam/ai-dial-chat-api-client": "1.4.0-dev.122",
135
135
  "dompurify": "3.4.17",
136
136
  "fflate": "^0.8.3",
137
137
  "lru-cache": "^10.4.3",
@@ -140,25 +140,25 @@
140
140
  },
141
141
  "peerDependencies": {
142
142
  "react": "^19.2.8",
143
- "@epam/ai-dial-attachment-canvas": "1.4.0-dev.12",
144
- "@epam/ai-dial-attachment-input": "1.4.0-dev.12",
145
- "@epam/ai-dial-catalog": "1.4.0-dev.12",
146
- "@epam/ai-dial-chat-overlay": "1.4.0-dev.12",
147
- "@epam/ai-dial-chat-shared": "1.4.0-dev.12",
148
- "@epam/ai-dial-conversation-input": "1.4.0-dev.12",
149
- "@epam/ai-dial-mcp-apps": "1.4.0-dev.12",
150
- "@epam/ai-dial-projects": "1.4.0-dev.12",
151
- "@epam/ai-dial-publish-panel": "1.4.0-dev.12",
152
- "@epam/ai-dial-quotations": "1.4.0-dev.12",
153
- "@epam/ai-dial-react-file-manager": "^0.4.1",
154
- "@epam/ai-dial-scheduled-tasks": "1.4.0-dev.12",
155
- "@epam/ai-dial-share": "1.4.0-dev.12",
156
- "@epam/ai-dial-skill-editor": "1.4.0-dev.12",
157
- "@epam/ai-dial-source-panel": "1.4.0-dev.12",
143
+ "@epam/ai-dial-attachment-canvas": "1.4.0-dev.122",
144
+ "@epam/ai-dial-attachment-input": "1.4.0-dev.122",
145
+ "@epam/ai-dial-catalog": "1.4.0-dev.122",
146
+ "@epam/ai-dial-chat-overlay": "1.4.0-dev.122",
147
+ "@epam/ai-dial-chat-shared": "1.4.0-dev.122",
148
+ "@epam/ai-dial-conversation-input": "1.4.0-dev.122",
149
+ "@epam/ai-dial-mcp-apps": "1.4.0-dev.122",
150
+ "@epam/ai-dial-projects": "1.4.0-dev.122",
151
+ "@epam/ai-dial-publish-panel": "1.4.0-dev.122",
152
+ "@epam/ai-dial-quotations": "1.4.0-dev.122",
153
+ "@epam/ai-dial-react-file-manager": "^0.4.3",
154
+ "@epam/ai-dial-scheduled-tasks": "1.4.0-dev.122",
155
+ "@epam/ai-dial-share": "1.4.0-dev.122",
156
+ "@epam/ai-dial-skill-editor": "1.4.0-dev.122",
157
+ "@epam/ai-dial-source-panel": "1.4.0-dev.122",
158
158
  "@epam/ai-dial-ui-kit": "^0.16.0",
159
- "@epam/ai-dial-usage-dashboard": "1.4.0-dev.12",
159
+ "@epam/ai-dial-usage-dashboard": "1.4.0-dev.122",
160
160
  "@modelcontextprotocol/sdk": "^1.32.2",
161
- "@epam/pdf-highlighter-kit": "^0.0.21"
161
+ "@epam/pdf-highlighter-kit": "^0.0.23"
162
162
  },
163
163
  "peerDependenciesMeta": {
164
164
  "@epam/ai-dial-attachment-canvas": {
@@ -0,0 +1,8 @@
1
+ import { ShareApi } from '@epam/ai-dial-chat-api-client';
2
+ /** Already-configured sharing operations required by project sharing hooks. Keep the instance stable. */
3
+ export type ProjectSharingClient = Pick<ShareApi, 'getShareRecipientsCount' | 'revokeSharedAccess'>;
4
+ /** Subscribes a menu to successful revokes made through the same configured client. */
5
+ export declare const subscribeProjectAccessRevoked: (client: ProjectSharingClient, listener: (projectId: string) => void) => () => void;
6
+ /** Invalidates recipient counts for one project and one configured client. */
7
+ export declare const notifyProjectAccessRevoked: (client: ProjectSharingClient, projectId: string) => void;
8
+ //# sourceMappingURL=project-sharing-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-sharing-client.d.ts","sourceRoot":"","sources":["../../src/project/project-sharing-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAE9D,yGAAyG;AACzG,MAAM,MAAM,oBAAoB,GAAG,IAAI,CACrC,QAAQ,EACR,yBAAyB,GAAG,oBAAoB,CACjD,CAAC;AAOF,uFAAuF;AACvF,eAAO,MAAM,6BAA6B,GACxC,QAAQ,oBAAoB,EAC5B,UAAU,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,eAWtC,CAAC;AAEF,8EAA8E;AAC9E,eAAO,MAAM,0BAA0B,GACrC,QAAQ,oBAAoB,EAC5B,WAAW,MAAM,SAGlB,CAAC"}
@@ -0,0 +1,11 @@
1
+ //#region src/project/project-sharing-client.ts
2
+ var e = /* @__PURE__ */ new WeakMap(), t = (t, n) => {
3
+ let r = e.get(t);
4
+ return r || (r = /* @__PURE__ */ new Set(), e.set(t, r)), r.add(n), () => {
5
+ r.delete(n);
6
+ };
7
+ }, n = (t, n) => {
8
+ for (let r of e.get(t) ?? []) r(n);
9
+ };
10
+ //#endregion
11
+ export { n as notifyProjectAccessRevoked, t as subscribeProjectAccessRevoked };
@@ -0,0 +1,28 @@
1
+ import { ProjectDetailsDto } from '@epam/ai-dial-chat-api-client';
2
+ /** Whether a project was shared with the caller, so they may drop it from their list but not delete it. */
3
+ export declare const isProjectSharedWithMe: (project: Pick<ProjectDetailsDto, "source" | "canManage"> | null | undefined) => boolean;
4
+ /** An action of a pinned project's sidebar menu; the values are the menu item keys. */
5
+ export declare enum PinnedProjectMenuAction {
6
+ /** Removes the project from the pins. */
7
+ Unpin = "unpin",
8
+ /** Opens the edit page. */
9
+ Edit = "edit",
10
+ /** Opens the publish panel. */
11
+ Publish = "publish",
12
+ /** Opens the share popover. */
13
+ Share = "share",
14
+ /** Opens the owner's revoke-access confirmation. */
15
+ RevokeAccess = "revokeAccess",
16
+ /** Opens the delete confirmation. */
17
+ Delete = "delete",
18
+ /** Opens the confirmation that drops a shared project from the caller's list. */
19
+ RemoveFromMyList = "removeFromMyList"
20
+ }
21
+ /**
22
+ * Returns the actions a pinned project's menu offers the caller, in display order.
23
+ * The host maps each to its label, icon and handler.
24
+ * @param project - The loaded project, or nullish while loading.
25
+ * @param canRevokeAccess - Whether recipients are confirmed; defaults to false. Ownership is still required.
26
+ */
27
+ export declare const getPinnedProjectMenuActions: (project: Pick<ProjectDetailsDto, "source" | "canEdit" | "canManage"> | null | undefined, canRevokeAccess?: boolean) => PinnedProjectMenuAction[];
28
+ //# sourceMappingURL=project-sharing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-sharing.d.ts","sourceRoot":"","sources":["../../src/project/project-sharing.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,iBAAiB,EAEvB,MAAM,+BAA+B,CAAC;AAEvC,2GAA2G;AAC3G,eAAO,MAAM,qBAAqB,GAChC,SAAS,IAAI,CAAC,iBAAiB,EAAE,QAAQ,GAAG,WAAW,CAAC,GAAG,IAAI,GAAG,SAAS,KAC1E,OAGiB,CAAC;AAErB,uFAAuF;AACvF,oBAAY,uBAAuB;IACjC,yCAAyC;IACzC,KAAK,UAAU;IACf,2BAA2B;IAC3B,IAAI,SAAS;IACb,+BAA+B;IAC/B,OAAO,YAAY;IACnB,+BAA+B;IAC/B,KAAK,UAAU;IACf,oDAAoD;IACpD,YAAY,iBAAiB;IAC7B,qCAAqC;IACrC,MAAM,WAAW;IACjB,iFAAiF;IACjF,gBAAgB,qBAAqB;CACtC;AAED;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,GACtC,SACI,IAAI,CAAC,iBAAiB,EAAE,QAAQ,GAAG,SAAS,GAAG,WAAW,CAAC,GAC3D,IAAI,GACJ,SAAS,EACb,yBAAuB,KACtB,uBAAuB,EAyBzB,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { ProjectSource as e } from "@epam/ai-dial-chat-api-client";
2
+ //#region src/project/project-sharing.ts
3
+ var t = (t) => t != null && t.source === e.Shared && !t.canManage, n = /* @__PURE__ */ function(e) {
4
+ return e.Unpin = "unpin", e.Edit = "edit", e.Publish = "publish", e.Share = "share", e.RevokeAccess = "revokeAccess", e.Delete = "delete", e.RemoveFromMyList = "removeFromMyList", e;
5
+ }({}), r = (e, n = !1) => {
6
+ if (e == null) return ["unpin"];
7
+ let r = t(e) ? ["removeFromMyList"] : [];
8
+ return e.canEdit ? e.canManage ? [
9
+ "unpin",
10
+ "edit",
11
+ "publish",
12
+ "share",
13
+ ...n ? ["revokeAccess"] : [],
14
+ "delete"
15
+ ] : [
16
+ "unpin",
17
+ "edit",
18
+ ...r
19
+ ] : ["unpin", ...r];
20
+ };
21
+ //#endregion
22
+ export { n as PinnedProjectMenuAction, r as getPinnedProjectMenuActions, t as isProjectSharedWithMe };
@@ -8,6 +8,8 @@ export interface PinnedProjectChatsOptions {
8
8
  enabled: boolean;
9
9
  /** The project no longer exists (a watch `DELETE`, or `404` on a read). Called at most once per id. */
10
10
  onProjectDeleted: (projectId: string) => void;
11
+ /** Id of the chat the host has open. When it is not among the newest chats of its project, it takes the last slot of that project's list, so the list never exceeds `PINNED_PROJECT_CHATS_LIMIT`. */
12
+ activeConversationId?: string;
11
13
  }
12
14
  /** A chat listed under a pinned project. */
13
15
  export interface PinnedProjectChat {
@@ -22,7 +24,7 @@ export interface PinnedProjectChat {
22
24
  export interface PinnedProjectChats {
23
25
  /** The project's details as last read; `canEdit`, `canManage`, `contentVersion` and `conversationCount` feed the host's actions. */
24
26
  project: ProjectDetailsDto;
25
- /** At most `PINNED_PROJECT_CHATS_LIMIT` chats, newest first. */
27
+ /** At most `PINNED_PROJECT_CHATS_LIMIT` chats, newest first; an open chat past the newest ones replaces the last of them and comes last. */
26
28
  chats: PinnedProjectChat[];
27
29
  /** The project has more chats than `chats` holds. */
28
30
  hasMore: boolean;
@@ -54,5 +56,5 @@ export interface PinnedProjectChatsResult {
54
56
  * @param projectIds - The pinned project ids, in display order.
55
57
  * @param options - Whether the tree is enabled and the delete callback; the callback is read at event time, so a new identity never resubscribes.
56
58
  */
57
- export declare const usePinnedProjectChats: (client: Pick<ProjectsApiClient, "getProject" | "listProjectConversations" | "getProjectConversationTitles" | "watchProjects">, projectIds: string[], { enabled, onProjectDeleted }: PinnedProjectChatsOptions) => PinnedProjectChatsResult;
59
+ export declare const usePinnedProjectChats: (client: Pick<ProjectsApiClient, "getProject" | "listProjectConversations" | "getProjectConversationTitles" | "watchProjects">, projectIds: string[], { enabled, onProjectDeleted, activeConversationId, }: PinnedProjectChatsOptions) => PinnedProjectChatsResult;
58
60
  //# sourceMappingURL=use-pinned-project-chats.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-pinned-project-chats.d.ts","sourceRoot":"","sources":["../../src/project/use-pinned-project-chats.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,iBAAiB,EACvB,MAAM,+BAA+B,CAAC;AA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