@aintela/chat 0.2.15

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 (218) hide show
  1. package/README.md +161 -0
  2. package/dist/ClientMessage-EKgfuTp8.js +40 -0
  3. package/dist/ClientMessage-EKgfuTp8.js.map +1 -0
  4. package/dist/Memory-DjLZqgbF.js +84 -0
  5. package/dist/Memory-DjLZqgbF.js.map +1 -0
  6. package/dist/Prompt-DZb7OaPp.js +37 -0
  7. package/dist/Prompt-DZb7OaPp.js.map +1 -0
  8. package/dist/artifactHtmlHandler-CMQJf1cX.js +41 -0
  9. package/dist/artifactHtmlHandler-CMQJf1cX.js.map +1 -0
  10. package/dist/auth-CcTgInbY.js +524 -0
  11. package/dist/auth-CcTgInbY.js.map +1 -0
  12. package/dist/components.d.ts +2 -0
  13. package/dist/components.js +14159 -0
  14. package/dist/components.js.map +1 -0
  15. package/dist/environmentUtils-BaKw5_VD.js +462 -0
  16. package/dist/environmentUtils-BaKw5_VD.js.map +1 -0
  17. package/dist/hooks.d.ts +2 -0
  18. package/dist/hooks.js +9 -0
  19. package/dist/hooks.js.map +1 -0
  20. package/dist/httpArtifactService-BAR60Gu1.js +1802 -0
  21. package/dist/httpArtifactService-BAR60Gu1.js.map +1 -0
  22. package/dist/httpSessionService-5Kr__oQL.js +279 -0
  23. package/dist/httpSessionService-5Kr__oQL.js.map +1 -0
  24. package/dist/index.d.ts +2 -0
  25. package/dist/index.js +226 -0
  26. package/dist/index.js.map +1 -0
  27. package/dist/interfaces.d.ts +2 -0
  28. package/dist/interfaces.js +11 -0
  29. package/dist/interfaces.js.map +1 -0
  30. package/dist/models.d.ts +2 -0
  31. package/dist/models.js +54 -0
  32. package/dist/models.js.map +1 -0
  33. package/dist/serializer-DyHZxlAG.js +1276 -0
  34. package/dist/serializer-DyHZxlAG.js.map +1 -0
  35. package/dist/services.d.ts +2 -0
  36. package/dist/services.js +16 -0
  37. package/dist/services.js.map +1 -0
  38. package/dist/sortable-table-DgQHxWIh.js +819 -0
  39. package/dist/sortable-table-DgQHxWIh.js.map +1 -0
  40. package/dist/src/ErrorBondary.d.ts +10 -0
  41. package/dist/src/components/AiChat/AiChat.d.ts +3 -0
  42. package/dist/src/components/AiChat/AiChatContext.d.ts +76 -0
  43. package/dist/src/components/AiChat/AiChatDrawer.d.ts +3 -0
  44. package/dist/src/components/AiChat/AiChatFloating.d.ts +3 -0
  45. package/dist/src/components/AiChat/AiChatProvider.d.ts +7 -0
  46. package/dist/src/components/AiChat/AiChatSessionStore.d.ts +1 -0
  47. package/dist/src/components/AiChat/AiChatTypes.d.ts +227 -0
  48. package/dist/src/components/AiChat/ChatPane/AlertDialog.d.ts +12 -0
  49. package/dist/src/components/AiChat/ChatPane/AskUserSheet.d.ts +25 -0
  50. package/dist/src/components/AiChat/ChatPane/ChatPane.d.ts +7 -0
  51. package/dist/src/components/AiChat/ChatPane/ConnectionState.d.ts +2 -0
  52. package/dist/src/components/AiChat/ChatPane/CurrentMessage.d.ts +12 -0
  53. package/dist/src/components/AiChat/ChatPane/Event.d.ts +6 -0
  54. package/dist/src/components/AiChat/ChatPane/FloatingConnectionStatus.d.ts +8 -0
  55. package/dist/src/components/AiChat/ChatPane/FriendlyPartDisplay.d.ts +13 -0
  56. package/dist/src/components/AiChat/ChatPane/LastPrompts.d.ts +9 -0
  57. package/dist/src/components/AiChat/ChatPane/Message.d.ts +11 -0
  58. package/dist/src/components/AiChat/ChatPane/MessageAgent.d.ts +16 -0
  59. package/dist/src/components/AiChat/ChatPane/MessageNonTextDisplay.d.ts +16 -0
  60. package/dist/src/components/AiChat/ChatPane/MessagePart.d.ts +15 -0
  61. package/dist/src/components/AiChat/ChatPane/MessagePersona.d.ts +13 -0
  62. package/dist/src/components/AiChat/ChatPane/MessageUser.d.ts +8 -0
  63. package/dist/src/components/AiChat/ChatPane/ModelSelector.d.ts +11 -0
  64. package/dist/src/components/AiChat/ChatPane/Prompt.d.ts +9 -0
  65. package/dist/src/components/AiChat/ChatPane/SessionDataDialog.d.ts +7 -0
  66. package/dist/src/components/AiChat/ChatPane/StickyQuestionHeader.d.ts +7 -0
  67. package/dist/src/components/AiChat/ChatPane/StreamStatistics.d.ts +32 -0
  68. package/dist/src/components/AiChat/ChatPane/SubAgentBox.d.ts +9 -0
  69. package/dist/src/components/AiChat/ChatPane/TaskList.d.ts +6 -0
  70. package/dist/src/components/AiChat/ChatPane/friendlyToolConfig.d.ts +11 -0
  71. package/dist/src/components/AiChat/ChatPane/parts/AskUserPart.d.ts +8 -0
  72. package/dist/src/components/AiChat/ChatPane/parts/BoxedPart.d.ts +4 -0
  73. package/dist/src/components/AiChat/ChatPane/parts/FunctionPart.d.ts +4 -0
  74. package/dist/src/components/AiChat/ChatPane/parts/SuspendedPart.d.ts +4 -0
  75. package/dist/src/components/AiChat/ChatPane/parts/TextPart.d.ts +4 -0
  76. package/dist/src/components/AiChat/ChatPane/parts/ThoughtPart.d.ts +4 -0
  77. package/dist/src/components/AiChat/ChatPane/parts/UiToolDispatcher.d.ts +16 -0
  78. package/dist/src/components/AiChat/ChatPane/parts/WaitingPart.d.ts +4 -0
  79. package/dist/src/components/AiChat/ChatPane/parts/index.d.ts +20 -0
  80. package/dist/src/components/AiChat/ChatPane/parts/index.test.d.ts +1 -0
  81. package/dist/src/components/AiChat/ChatPane/parts/types.d.ts +22 -0
  82. package/dist/src/components/AiChat/ChatPane/parts/uiToolRegistry.d.ts +121 -0
  83. package/dist/src/components/AiChat/index.d.ts +13 -0
  84. package/dist/src/components/AiChat/sessionStateManagerService.d.ts +47 -0
  85. package/dist/src/components/AiChat/stateConfiguration.d.ts +80 -0
  86. package/dist/src/components/Library/ArtifactRender.d.ts +18 -0
  87. package/dist/src/components/Library/DelayTextComponent.d.ts +9 -0
  88. package/dist/src/components/Library/LinearBackgroundProgress.d.ts +8 -0
  89. package/dist/src/components/Library/LinearProgressBarWithMarkers.d.ts +14 -0
  90. package/dist/src/components/Library/LoadingDots.d.ts +8 -0
  91. package/dist/src/components/Library/MarkdowmExtended.d.ts +32 -0
  92. package/dist/src/components/Library/VizLibrary/Skeletons/ChartSkeleton.d.ts +3 -0
  93. package/dist/src/components/Library/VizLibrary/Skeletons/IFrameSkeleton.d.ts +3 -0
  94. package/dist/src/components/Library/VizLibrary/Skeletons/MetricGroupSkeleton.d.ts +8 -0
  95. package/dist/src/components/Library/VizLibrary/Skeletons/MetricSkeleton.d.ts +7 -0
  96. package/dist/src/components/Library/VizLibrary/Skeletons/TableSkeleton.d.ts +7 -0
  97. package/dist/src/components/Library/VizLibrary/index.d.ts +5 -0
  98. package/dist/src/components/LlmResponseRender/EnvironmentContext.d.ts +33 -0
  99. package/dist/src/components/LlmResponseRender/GeneratingVisualization.d.ts +13 -0
  100. package/dist/src/components/LlmResponseRender/LiveJsxBlock.d.ts +55 -0
  101. package/dist/src/components/LlmResponseRender/LlmResponseRender.d.ts +29 -0
  102. package/dist/src/components/LlmResponseRender/index.d.ts +6 -0
  103. package/dist/src/components/LlmResponseRender/jsxScope.d.ts +41 -0
  104. package/dist/src/components/LlmResponseRender/liveTsxConfig.d.ts +18 -0
  105. package/dist/src/components/LlmResponseRender/parseBlocks.d.ts +39 -0
  106. package/dist/src/components/Stopwatch.d.ts +12 -0
  107. package/dist/src/components/index.d.ts +30 -0
  108. package/dist/src/components/v2/AgentActivityV2.d.ts +32 -0
  109. package/dist/src/components/v2/AiChatFloatingV2.d.ts +3 -0
  110. package/dist/src/components/v2/AiChatV2Pane.d.ts +20 -0
  111. package/dist/src/components/v2/AppBarV2.d.ts +38 -0
  112. package/dist/src/components/v2/AppRailV2.d.ts +21 -0
  113. package/dist/src/components/v2/AppShellV2.d.ts +13 -0
  114. package/dist/src/components/v2/ChatsHistoryV2.d.ts +47 -0
  115. package/dist/src/components/v2/LastPromptsV2.d.ts +6 -0
  116. package/dist/src/components/v2/MobileDrawerV2.d.ts +43 -0
  117. package/dist/src/components/v2/PromptV2.d.ts +164 -0
  118. package/dist/src/components/v2/RunProgressPanelV2.d.ts +28 -0
  119. package/dist/src/components/v2/RunProgressStripV2.d.ts +2 -0
  120. package/dist/src/components/v2/Sparkline.d.ts +10 -0
  121. package/dist/src/components/v2/SubAgentBoxV2.d.ts +15 -0
  122. package/dist/src/components/v2/TaskListV2.d.ts +8 -0
  123. package/dist/src/components/v2/icons.d.ts +42 -0
  124. package/dist/src/components/v2/index.d.ts +34 -0
  125. package/dist/src/components/v2/styles.d.ts +6 -0
  126. package/dist/src/components/v2/toolCategories.d.ts +18 -0
  127. package/dist/src/components/v2/useResponsiveLayout.d.ts +9 -0
  128. package/dist/src/hooks/index.d.ts +4 -0
  129. package/dist/src/hooks/useChatSessions.d.ts +68 -0
  130. package/dist/src/hooks/useContainerWidth.d.ts +2 -0
  131. package/dist/src/hooks/useIntervalHook.d.ts +2 -0
  132. package/dist/src/index.d.ts +7 -0
  133. package/dist/src/interfaces/IHeartbeatPort.d.ts +4 -0
  134. package/dist/src/interfaces/INotificationPort.d.ts +4 -0
  135. package/dist/src/interfaces/index.d.ts +4 -0
  136. package/dist/src/interfaces/memoryService.d.ts +37 -0
  137. package/dist/src/interfaces/schedulingService.d.ts +64 -0
  138. package/dist/src/models/Agent.d.ts +32 -0
  139. package/dist/src/models/Artifact.d.ts +21 -0
  140. package/dist/src/models/ArtifactData.d.ts +30 -0
  141. package/dist/src/models/ChatSession.d.ts +57 -0
  142. package/dist/src/models/ClientMessage.d.ts +38 -0
  143. package/dist/src/models/Customer.d.ts +7 -0
  144. package/dist/src/models/EndMessageData.d.ts +6 -0
  145. package/dist/src/models/IAbiContext.d.ts +8 -0
  146. package/dist/src/models/IDBStorable.d.ts +14 -0
  147. package/dist/src/models/Interaction.d.ts +36 -0
  148. package/dist/src/models/InteractionPart.d.ts +69 -0
  149. package/dist/src/models/LlmSession.d.ts +10 -0
  150. package/dist/src/models/Memory.d.ts +48 -0
  151. package/dist/src/models/Notification.d.ts +11 -0
  152. package/dist/src/models/Prompt.d.ts +20 -0
  153. package/dist/src/models/SendMessageResponse.d.ts +21 -0
  154. package/dist/src/models/ServerEvent.d.ts +130 -0
  155. package/dist/src/models/connectionState.d.ts +9 -0
  156. package/dist/src/models/contexts.d.ts +33 -0
  157. package/dist/src/models/enums.d.ts +333 -0
  158. package/dist/src/models/index.d.ts +36 -0
  159. package/dist/src/models/semanticKernelModel/index.d.ts +2 -0
  160. package/dist/src/models/semanticKernelModel/init.d.ts +1 -0
  161. package/dist/src/models/semanticKernelModel/models.d.ts +208 -0
  162. package/dist/src/models/semanticKernelModel/serializer.d.ts +40 -0
  163. package/dist/src/models/serverReponse.d.ts +5 -0
  164. package/dist/src/models/subAgentModel.d.ts +48 -0
  165. package/dist/src/models/todoListModel.d.ts +18 -0
  166. package/dist/src/services/WebSocketConnection/WebSocketConnectionV2.d.ts +163 -0
  167. package/dist/src/services/WebSocketConnection/webSocketConnection.d.ts +75 -0
  168. package/dist/src/services/artifactHtmlHandler.d.ts +6 -0
  169. package/dist/src/services/eventBusService.d.ts +119 -0
  170. package/dist/src/services/httpArtifactService.d.ts +25 -0
  171. package/dist/src/services/httpSessionService.d.ts +31 -0
  172. package/dist/src/services/index.d.ts +16 -0
  173. package/dist/src/services/interactionService.d.ts +28 -0
  174. package/dist/src/services/interactionService.test.d.ts +1 -0
  175. package/dist/src/services/interfaces/artifactService.d.ts +13 -0
  176. package/dist/src/services/servers/AgentGatewayService.d.ts +167 -0
  177. package/dist/src/services/servers/AgentGatewayWSAsync.d.ts +44 -0
  178. package/dist/src/services/servers/agentGatewayWSAsync.test.d.ts +1 -0
  179. package/dist/src/services/servers/sessionService/ISessionService.d.ts +20 -0
  180. package/dist/src/services/sessionEventDecoder.d.ts +22 -0
  181. package/dist/src/services/sessionEventDecoder.test.d.ts +1 -0
  182. package/dist/src/services/storageService.d.ts +73 -0
  183. package/dist/src/themes/index.d.ts +3 -0
  184. package/dist/src/themes/v2-chart-palette.d.ts +1 -0
  185. package/dist/src/themes/v2.d.ts +71 -0
  186. package/dist/src/utils/auth.d.ts +9 -0
  187. package/dist/src/utils/envOverrides.d.ts +23 -0
  188. package/dist/src/utils/envUtils.d.ts +13 -0
  189. package/dist/src/utils/environmentUtils.d.ts +43 -0
  190. package/dist/src/utils/fileUtils.d.ts +6 -0
  191. package/dist/src/utils/getAgentArtifactsBaseUrl.d.ts +1 -0
  192. package/dist/src/utils/getAgentBaseUrl.d.ts +1 -0
  193. package/dist/src/utils/getDotNetBaseUrl.d.ts +5 -0
  194. package/dist/src/utils/index.d.ts +17 -0
  195. package/dist/src/utils/interactionIdChecker.d.ts +27 -0
  196. package/dist/src/utils/jsonDetector.d.ts +50 -0
  197. package/dist/src/utils/jsonUtils.d.ts +1 -0
  198. package/dist/src/utils/materialIconsList.d.ts +42 -0
  199. package/dist/src/utils/materialIconsSvg.d.ts +51 -0
  200. package/dist/src/utils/objectUtils.d.ts +31 -0
  201. package/dist/src/utils/parseArtifact.d.ts +3 -0
  202. package/dist/src/utils/sessionWindowParameters.d.ts +3 -0
  203. package/dist/src/utils/sortable-table.d.ts +31 -0
  204. package/dist/src/utils/stringUtils.d.ts +8 -0
  205. package/dist/src/utils/uriUtils.d.ts +39 -0
  206. package/dist/src/utils/urlParser.d.ts +8 -0
  207. package/dist/style.css +94 -0
  208. package/dist/tests/fakes/fakeWebSocket.d.ts +32 -0
  209. package/dist/tests/fakes/makeGateway.d.ts +24 -0
  210. package/dist/tests/fixtures.d.ts +73 -0
  211. package/dist/useChatSessions-DttlifVk.js +107 -0
  212. package/dist/useChatSessions-DttlifVk.js.map +1 -0
  213. package/dist/useContainerWidth-Df2PmSoC.js +52 -0
  214. package/dist/useContainerWidth-Df2PmSoC.js.map +1 -0
  215. package/dist/utils.d.ts +2 -0
  216. package/dist/utils.js +49 -0
  217. package/dist/utils.js.map +1 -0
  218. package/package.json +127 -0
@@ -0,0 +1,819 @@
1
+ var A = Object.defineProperty;
2
+ var h = (a, t) => A(a, "name", { value: t, configurable: !0 });
3
+ const $ = /* @__PURE__ */ h((a) => {
4
+ if (a[0] == "#")
5
+ return null;
6
+ const t = a.split("/");
7
+ let e = t[t.length - 1];
8
+ if (e == "" && t.length > 1 && (e = t[t.length - 2]), e == "")
9
+ return null;
10
+ const s = e.split("?")[0];
11
+ return s.startsWith("#") ? s : s.split("#")[0];
12
+ }, "parseAndValidateArtifactUrl"), W = /* @__PURE__ */ h((a, t, e) => {
13
+ let s = "URL", o = null, i = null, r = null;
14
+ if (a[0] == "#") {
15
+ const n = a.indexOf("-"), l = a.slice(1, n);
16
+ switch (r = a.slice(n + 1), l.toLowerCase()) {
17
+ case "opendashboard":
18
+ s = "OpenDashboard";
19
+ break;
20
+ case "ask":
21
+ s = "Question", o = e;
22
+ break;
23
+ }
24
+ } else
25
+ a.indexOf("http") > -1 ? (s = "URL", i = a) : (a = a.replaceAll("exported/", `exported/${t}/`), s = "Export");
26
+ return { action: s, url: i, question: o, parameter: r };
27
+ }, "extractLinkAction"), E = /* @__PURE__ */ h((a, t) => Array.from(
28
+ { length: Math.ceil(a.length / t) },
29
+ (e, s) => a.slice(s * t, s * t + t)
30
+ ), "chunkArray"), q = /* @__PURE__ */ h((a) => {
31
+ a = a.replaceAll("\\n", `
32
+ `);
33
+ const t = 90, e = a.split(" "), s = [];
34
+ let o = !1;
35
+ for (const i of e)
36
+ if (i.length > t) {
37
+ o = !0;
38
+ const r = [...i], l = E(r, t).map((c) => c.join("")).join(`
39
+ `);
40
+ s.push(l);
41
+ } else
42
+ s.push(i);
43
+ return o ? s.join(" ") : a;
44
+ }, "splitBigLinesWithSpaces");
45
+ function L(a) {
46
+ let t = parseFloat(a);
47
+ if (!isNaN(t))
48
+ return a = a.replaceAll(/[,\.]/g, ""), parseInt(a);
49
+ var e = "";
50
+ for (const o of a)
51
+ o.match(/[0-9]/) && (e += o);
52
+ const s = e.length / a.length;
53
+ return t = parseInt(e), !isNaN(t) && s > 0.5 ? t : NaN;
54
+ }
55
+ h(L, "parseRawNumber");
56
+ function D(a) {
57
+ if (!a) return { prefix: void 0, suffix: void 0, number: void 0 };
58
+ const t = /[$%(\w?\$)]/gi, e = /[a-z]?\$/gi;
59
+ let s = "", o = "";
60
+ if (a.match(t)) {
61
+ a.indexOf("%") > -1 && (o = " %");
62
+ const n = a.match(e);
63
+ n && (s = n[0] + " ");
64
+ }
65
+ let i = parseFloat(a);
66
+ if (!isNaN(i))
67
+ return a = a.replaceAll(".", "").replaceAll(",", "."), { prefix: s, suffix: o, number: parseFloat(a) };
68
+ var r = "";
69
+ for (const n of a)
70
+ if (n.match(/[0-9.,]/)) {
71
+ let l = n;
72
+ l == "." ? l = "" : l == "," && (l = "."), r += l;
73
+ }
74
+ return i = parseFloat(r), isNaN(i) ? { prefix: void 0, suffix: void 0, number: void 0 } : { prefix: s, suffix: o, number: i };
75
+ }
76
+ h(D, "parseKnownNumbers");
77
+ const S = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i, x = /^[0-9a-f]{32}/i;
78
+ function M(a) {
79
+ if (!a || typeof a != "string")
80
+ return !1;
81
+ const t = T(a);
82
+ return t === null ? !1 : a.startsWith(t);
83
+ }
84
+ h(M, "startsWithInteractionId");
85
+ function T(a) {
86
+ if (!a || typeof a != "string")
87
+ return null;
88
+ const t = a.match(S);
89
+ if (t)
90
+ return t[0];
91
+ const e = a.match(x);
92
+ return e ? e[0] : null;
93
+ }
94
+ h(T, "extractInteractionId");
95
+ function O(a) {
96
+ const s = a.replaceAll("_", " ").replaceAll("-", " ").replaceAll("user:", "").replace(/\.[^/.]+$/, ""), o = k(s).trim();
97
+ return o.length > 1 ? o[0].toUpperCase() + o.slice(1) : o;
98
+ }
99
+ h(O, "prettiffyFileName");
100
+ function F(a) {
101
+ if (a.length == 0)
102
+ return a;
103
+ const t = a.replaceAll("_", " ").replaceAll("-", " ");
104
+ return t[0].toUpperCase() + t.slice(1);
105
+ }
106
+ h(F, "prettiffyPythonFunctionName");
107
+ function k(a) {
108
+ const t = a.match(S);
109
+ if (t)
110
+ return a.replace(t[0], "");
111
+ const e = a.match(x);
112
+ return e ? a.replace(e[0], "") : a;
113
+ }
114
+ h(k, "extractNameFromStringWithInteractionId");
115
+ function z(a) {
116
+ return !a || typeof a != "string" ? !1 : !!(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(a) || /^[0-9a-f]{32}$/i.test(a));
117
+ }
118
+ h(z, "isValidInteractionId");
119
+ const C = /* @__PURE__ */ new Set(), w = class w {
120
+ constructor(t = {}) {
121
+ this.options = {
122
+ // CSS class for sortable headers
123
+ sortableClass: "sortable-header",
124
+ // CSS class for active sort
125
+ activeSortClass: "active-sort",
126
+ // CSS class for ascending sort
127
+ ascendingClass: "sort-asc",
128
+ // CSS class for descending sort
129
+ descendingClass: "sort-desc",
130
+ // Icon for unsorted state
131
+ unsortedIcon: "unfold_more",
132
+ // Icon for ascending sort
133
+ ascendingIcon: "keyboard_arrow_up",
134
+ // Icon for descending sort
135
+ descendingIcon: "keyboard_arrow_down",
136
+ // Whether to sort on first click (true) or cycle through states (false)
137
+ sortOnFirstClick: !0,
138
+ // Custom sort functions for specific columns
139
+ customSorters: {},
140
+ // Columns to exclude from sorting (0-based index)
141
+ excludeColumns: [],
142
+ // Whether to preserve existing icons in headers
143
+ preserveExistingIcons: !1,
144
+ // Enable column resizing
145
+ enableResizing: !0,
146
+ // Enable column reordering
147
+ enableReordering: !0,
148
+ // CSS class for resizable columns
149
+ resizableClass: "resizable-column",
150
+ // CSS class for draggable columns
151
+ draggableClass: "draggable-column",
152
+ // CSS class for drag placeholder
153
+ dragPlaceholderClass: "drag-placeholder",
154
+ // CSS class for drag over state
155
+ dragOverClass: "drag-over",
156
+ theme: {
157
+ palette: {
158
+ primary: {
159
+ main: "#999"
160
+ },
161
+ background: {
162
+ default: "#fff",
163
+ paper: "#555"
164
+ },
165
+ text: {
166
+ primary: "#000",
167
+ secondary: "#999",
168
+ disabled: "#BBB"
169
+ },
170
+ surface: {
171
+ panel: "#999",
172
+ raised: "#999",
173
+ hover: "#444"
174
+ },
175
+ divider: "#999",
176
+ border: {
177
+ default: "#999",
178
+ soft: "#BBB"
179
+ }
180
+ },
181
+ shape: {
182
+ borderRadius: 7,
183
+ radiusSm: 1,
184
+ radiusLg: 10
185
+ }
186
+ },
187
+ ...t
188
+ }, this.tables = [], this.sortStates = /* @__PURE__ */ new Map(), this.originalColumnOrder = /* @__PURE__ */ new Map(), this.isDragging = !1, this.dragSource = null, this.dragTarget = null, this.charWidth = 0;
189
+ }
190
+ /**
191
+ * Initialize the library - scan document for tables and make them sortable
192
+ * @param {HTMLElement} container - Optional container element to limit search scope
193
+ */
194
+ init(t = null) {
195
+ this.charWidth == 0 && (this.charWidth = this.getCharWidth(this.options.theme.typography.fontFamily, this.options.theme.typography.fontMono)), this.scanTables(t), this.makeTablesSortable(), this.addStyles();
196
+ }
197
+ /**
198
+ * Scan for tables in the document or within a specific container
199
+ * @param {HTMLElement} container - Optional container element to limit search scope
200
+ */
201
+ scanTables(t = null) {
202
+ const s = (t || document).querySelectorAll("table");
203
+ this.tables = Array.from(s);
204
+ }
205
+ /**
206
+ * Make all found tables sortable
207
+ */
208
+ makeTablesSortable() {
209
+ this.tables.forEach((t, e) => {
210
+ this.makeTableSortable(t, e);
211
+ });
212
+ }
213
+ /**
214
+ * Make a specific table sortable
215
+ */
216
+ makeTableSortable(t, e) {
217
+ let s = t.querySelector("thead"), o = null, i = [];
218
+ if (s && (o = s.querySelector("tr"), o && (i = o.querySelectorAll("th"))), i.length === 0) {
219
+ console.warn("Table has no sortable columns, skipping");
220
+ return;
221
+ }
222
+ const r = !t.hasAttribute("data-sortable-arrived");
223
+ t.classList.add("sortable-table"), r && (t.setAttribute("data-sortable-arrived", "true"), t.classList.add("sortable-table-arriving"), setTimeout(() => {
224
+ t.classList.remove("sortable-table-arriving");
225
+ }, 400)), this.sortStates.set(e, {
226
+ currentColumn: -1,
227
+ direction: "none"
228
+ }), t.hasAttribute("data-original-width") || t.setAttribute("data-original-width", t.getBoundingClientRect().width), this.applyTableStyles(t), this.originalColumnOrder.set(e, Array.from(i).map((n, l) => l)), i.forEach((n, l) => {
229
+ this.options.excludeColumns.includes(l) || this.makeHeaderSortable(n, t, e, l);
230
+ }), this.replaceExponentialValues(t), C.add(t);
231
+ }
232
+ /**
233
+ * Replace exponential values in table cells with full numbers
234
+ * @param {HTMLElement} table - The table to process
235
+ */
236
+ replaceExponentialValues(t) {
237
+ const e = t.querySelector("tbody");
238
+ if (!e) return;
239
+ e.querySelectorAll("tr").forEach((o) => {
240
+ o.querySelectorAll("td, th").forEach((r) => {
241
+ const l = r.textContent.trim().match(/^([\d,]+\.?\d*)[eE][+-]?(\d+)$/);
242
+ if (l) {
243
+ const c = parseFloat(l[1].replace(/,/g, "")), u = parseInt(l[2]), p = c * Math.pow(10, u), d = this.formatNumber(p);
244
+ r.textContent = d;
245
+ }
246
+ });
247
+ });
248
+ }
249
+ /**
250
+ * Format a number with commas for readability
251
+ * @param {number} num - The number to format
252
+ * @returns {string} The formatted number
253
+ */
254
+ formatNumber(t) {
255
+ return t === 0 ? "0" : Math.abs(t) >= 1e12 ? (t / 1e12).toFixed(2) + "T" : Math.abs(t) >= 1e9 ? (t / 1e9).toFixed(2) + "B" : Math.abs(t) >= 1e6 ? (t / 1e6).toFixed(2) + "M" : Math.abs(t) >= 1e3 ? (t / 1e3).toFixed(2) + "K" : Math.abs(t) < 0.01 && t !== 0 ? t.toExponential(2) : t.toLocaleString();
256
+ }
257
+ /**
258
+ * Convert the first row to a header row
259
+ * @param {HTMLElement} firstRow - The first row to convert
260
+ * @param {HTMLElement} thead - The thead element to append to
261
+ * @param {HTMLElement} tbody - The tbody element to remove from
262
+ * @returns {HTMLElement} The converted header row
263
+ */
264
+ convertRowToHeader(t, e, s) {
265
+ try {
266
+ const o = t.cloneNode(!0);
267
+ return o.querySelectorAll("td").forEach((r) => {
268
+ const n = document.createElement("th");
269
+ Array.from(r.attributes).forEach((l) => {
270
+ n.setAttribute(l.name, l.value);
271
+ }), n.innerHTML = r.innerHTML, n.style.cssText = r.style.cssText, r.parentNode.replaceChild(n, r);
272
+ }), s && s.contains(t) ? s.removeChild(t) : t.parentNode && t.parentNode.removeChild(t), e.appendChild(o), o;
273
+ } catch (o) {
274
+ return console.error("Error converting row to header:", o), null;
275
+ }
276
+ }
277
+ /**
278
+ * Make a specific header sortable
279
+ */
280
+ makeHeaderSortable(t, e, s, o) {
281
+ t.classList.add(this.options.sortableClass), t.style.cursor = "pointer", (!this.options.preserveExistingIcons || !t.querySelector(".material-icons")) && this.addSortIcon(t), this.options.enableResizing && this.addResizing(t, e, s, o), this.options.enableReordering && this.addDragAndDrop(t, e, s, o);
282
+ const i = /* @__PURE__ */ h((l) => {
283
+ l.preventDefault(), this.sortTable(e, s, o);
284
+ }, "clickListener"), r = /* @__PURE__ */ h((l) => {
285
+ t.classList.contains(this.options.activeSortClass) || (t.style.background = this.options.theme.palette.surface.hover);
286
+ }, "mouseEnterListener"), n = /* @__PURE__ */ h((l) => {
287
+ t.classList.contains(this.options.activeSortClass) || (t.style.background = "");
288
+ }, "mouseLeaveListener");
289
+ t.removeEventListener("click", i), t.addEventListener("click", i), t.removeEventListener("mouseenter", r), t.addEventListener("mouseenter", r), t.removeEventListener("mouseleave", n), t.addEventListener("mouseleave", n);
290
+ }
291
+ /**
292
+ * Add sort icon to header
293
+ */
294
+ addSortIcon(t) {
295
+ if (t.querySelector(".sortable-table-icon"))
296
+ return;
297
+ const e = document.createElement("i");
298
+ e.id = "sortable-table-icon", e.className = "material-icons", e.textContent = this.options.unsortedIcon, e.style.marginRight = "2px", e.style.fontSize = "12px", e.style.verticalAlign = "middle", e.style.opacity = "0", t.querySelector(".material-icons") || (t.insertBefore(e, t.firstChild), requestAnimationFrame(() => {
299
+ requestAnimationFrame(() => {
300
+ e.style.opacity = "0.6";
301
+ });
302
+ }));
303
+ }
304
+ /**
305
+ * Sort table by column
306
+ */
307
+ sortTable(t, e, s) {
308
+ const o = t.querySelector("tbody");
309
+ if (!o) {
310
+ console.warn("Table has no tbody element");
311
+ return;
312
+ }
313
+ const i = Array.from(o.querySelectorAll("tr"));
314
+ if (i.length === 0) {
315
+ console.warn("Table has no data rows");
316
+ return;
317
+ }
318
+ const r = this.sortStates.get(e);
319
+ t.querySelector(`thead tr th:nth-child(${s + 1})`);
320
+ let n;
321
+ if (this.options.sortOnFirstClick ? n = r.currentColumn === s && r.direction === "asc" ? "desc" : "asc" : r.currentColumn !== s ? n = "asc" : n = r.direction === "none" ? "asc" : r.direction === "asc" ? "desc" : "none", r.currentColumn = s, r.direction = n, this.sortStates.set(e, r), this.updateSortIndicators(t, e, s, n), n === "none") {
322
+ this.restoreOriginalOrder(t, i);
323
+ return;
324
+ }
325
+ this.sortRows(i, s, n).forEach((c) => o.appendChild(c));
326
+ }
327
+ /**
328
+ * Sort rows based on column data
329
+ */
330
+ sortRows(t, e, s) {
331
+ return t.sort((o, i) => {
332
+ const r = o.cells[e], n = i.cells[e];
333
+ if (!r || !n) return 0;
334
+ const l = this.extractValue(r), c = this.extractValue(n);
335
+ if (this.options.customSorters[e])
336
+ return this.options.customSorters[e](l, c, s);
337
+ const u = this.compareValues(l, c);
338
+ return s === "asc" ? u : -u;
339
+ });
340
+ }
341
+ /**
342
+ * Extract sortable value from cell
343
+ */
344
+ extractValue(t) {
345
+ let e = t.textContent.trim(), s = L(e);
346
+ if (!isNaN(s))
347
+ return console.log(s), s;
348
+ if (e = e.replace(/arrow_upward|arrow_downward|remove|keyboard_arrow_up|keyboard_arrow_down|unfold_more|expand_more|expand_less|trending_up|trending_down|↗|↘|↑|↓|→|←/g, "").trim(), /^(N\/A|N\/D|ND|N\/A|n\/a|n\/d|nd|N\/A|N\/D|ND|\s*)$/i.test(e))
349
+ return -1;
350
+ const i = e.match(/^([\d,]+\.?\d*)\s*%$/);
351
+ if (i)
352
+ return parseFloat(i[1].replace(/,/g, ""));
353
+ const r = e.match(/^([\d,]+\.?\d*)[eE][+-]?(\d+)$/);
354
+ if (r) {
355
+ const u = parseFloat(r[1].replace(/,/g, "")), p = parseInt(r[2]);
356
+ return u * Math.pow(10, p);
357
+ }
358
+ if (e.match(/^[\d,]+\.?\d*[KMB]?$/))
359
+ return this.parseNumber(e);
360
+ const l = e.match(/^R\$\s*([\d,]+\.?\d*)$/);
361
+ if (l)
362
+ return this.parseNumber(l[1]);
363
+ const c = new Date(e);
364
+ return isNaN(c.getTime()) ? e.toLowerCase() : c.getTime();
365
+ }
366
+ /**
367
+ * Compare two values for sorting
368
+ */
369
+ compareValues(t, e) {
370
+ return t == null && e == null ? 0 : t == null ? -1 : e == null ? 1 : typeof t != typeof e ? String(t).localeCompare(String(e)) : typeof t == "number" ? t - e : t instanceof Date ? t.getTime() - e.getTime() : t.localeCompare(e);
371
+ }
372
+ /**
373
+ * Update visual indicators for sort state
374
+ */
375
+ updateSortIndicators(t, e, s, o) {
376
+ const i = t.querySelectorAll("thead tr th");
377
+ if (i.forEach((r, n) => {
378
+ r.classList.remove(this.options.activeSortClass, this.options.ascendingClass, this.options.descendingClass);
379
+ const l = r.querySelector(".material-icons");
380
+ l && (l.textContent = this.options.unsortedIcon, l.style.opacity = "0.6");
381
+ }), o !== "none") {
382
+ const r = i[s];
383
+ r.classList.add(this.options.activeSortClass);
384
+ const n = r.querySelector(".material-icons");
385
+ n && (o === "asc" ? (r.classList.add(this.options.ascendingClass), n.textContent = this.options.ascendingIcon) : (r.classList.add(this.options.descendingClass), n.textContent = this.options.descendingIcon), n.style.opacity = "1");
386
+ }
387
+ }
388
+ /**
389
+ * Restore original order (when sort direction is 'none')
390
+ */
391
+ restoreOriginalOrder(t, e) {
392
+ const s = t.querySelector("tbody");
393
+ e.forEach((o) => s.appendChild(o));
394
+ }
395
+ /**
396
+ * Add resizing functionality to a header
397
+ */
398
+ addResizing(t, e, s, o) {
399
+ if (t.classList.add(this.options.resizableClass), t.style.position = "relative", t.querySelector(".resize-handle"))
400
+ return;
401
+ const i = document.createElement("div");
402
+ i.className = "resize-handle", i.style.cssText = `
403
+ position: absolute;
404
+ top: 0;
405
+ right: 0;
406
+ width: 4px;
407
+ height: 100%;
408
+ background: transparent;
409
+ cursor: col-resize;
410
+ z-index: 10;
411
+ `, t.appendChild(i);
412
+ let r = !1, n = 0, l = 0;
413
+ i.addEventListener("mousedown", (p) => {
414
+ p.preventDefault(), p.stopPropagation(), p.stopImmediatePropagation(), r = !0, n = p.clientX, l = t.offsetWidth, t.style.borderRight = "2px solid var(--primary-main, #2196F3)", t.style.background = "var(--background-active, rgba(255, 255, 255, 0.1))", document.addEventListener("mousemove", c), document.addEventListener("mouseup", u), document.body.style.cursor = "col-resize", document.body.style.userSelect = "none";
415
+ });
416
+ const c = /* @__PURE__ */ h((p) => {
417
+ if (!r) return;
418
+ const d = l + (p.clientX - n);
419
+ if (d > 30) {
420
+ t.style.width = d + "px";
421
+ const m = Array.from(t.parentNode.children).indexOf(t), f = e.querySelector("tbody");
422
+ f && f.querySelectorAll("tr").forEach((y) => {
423
+ const b = y.children[m];
424
+ b && (b.style.width = d + "px");
425
+ }), this.updateTableWidth(e);
426
+ }
427
+ }, "handleResize"), u = /* @__PURE__ */ h(() => {
428
+ r = !1, t.style.borderRight = "", t.style.background = "", document.removeEventListener("mousemove", c), document.removeEventListener("mouseup", u), document.body.style.cursor = "", document.body.style.userSelect = "";
429
+ }, "stopResize");
430
+ }
431
+ /**
432
+ * Add drag and drop functionality to a header
433
+ */
434
+ addDragAndDrop(t, e, s, o) {
435
+ if (t.querySelector(".drag-handle"))
436
+ return;
437
+ t.classList.add(this.options.draggableClass), t.draggable = !0;
438
+ const i = e.querySelector("thead tr");
439
+ t.addEventListener("dragstart", (r) => {
440
+ this.isDragging = !0;
441
+ const n = Array.from(i.children).indexOf(t);
442
+ this.dragSource = { table: e, tableIndex: s, columnIndex: n }, r.dataTransfer.effectAllowed = "move", r.dataTransfer.setData("text/html", t.outerHTML);
443
+ const l = t.outerHTML;
444
+ t.style.opacity = "0.5", this.createCustomDragImage(r, t, l);
445
+ }), t.addEventListener("dragend", (r) => {
446
+ this.isDragging = !1, this.dragSource = null, t.style.opacity = "", this.clearAllColumnHighlights(e);
447
+ }), t.addEventListener("dragover", (r) => {
448
+ r.preventDefault(), r.dataTransfer.dropEffect = "move";
449
+ }), t.addEventListener("dragenter", (r) => {
450
+ if (r.preventDefault(), this.dragSource && this.dragSource.tableIndex === s) {
451
+ const n = Array.from(i.children).indexOf(t);
452
+ this.dragSource.columnIndex !== n && this.highlightColumn(e, n, !0);
453
+ }
454
+ }), t.addEventListener("dragleave", (r) => {
455
+ if (!t.contains(r.relatedTarget)) {
456
+ const n = Array.from(i.children).indexOf(t);
457
+ this.highlightColumn(e, n, !1);
458
+ }
459
+ }), t.addEventListener("drop", (r) => {
460
+ if (r.preventDefault(), this.dragSource && this.dragSource.tableIndex === s) {
461
+ const n = Array.from(i.children).indexOf(t);
462
+ this.dragSource.columnIndex !== n && this.reorderColumns(e, s, this.dragSource.columnIndex, n);
463
+ }
464
+ this.clearAllColumnHighlights(e);
465
+ });
466
+ }
467
+ /**
468
+ * Create a custom drag image for better UX
469
+ */
470
+ createCustomDragImage(t, e, s) {
471
+ const o = document.createElement("div");
472
+ o.style.cssText = `
473
+ position: absolute;
474
+ top: -1000px;
475
+ left: -1000px;
476
+ background: var(--background-elevated, #333);
477
+ border: 2px solid var(--primary-main, #2196F3);
478
+ border-radius: 4px;
479
+ padding: 8px 12px;
480
+ font-size: 12px;
481
+ font-weight: bold;
482
+ color: var(--text-primary, #fff);
483
+ white-space: nowrap;
484
+ max-width: 150px;
485
+ min-width: 60px;
486
+ overflow: hidden;
487
+ text-overflow: ellipsis;
488
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
489
+ z-index: 10000;
490
+ pointer-events: none;
491
+ min-height: 50px;
492
+ display: flex;
493
+ align-items: center;
494
+ `;
495
+ const i = s;
496
+ o.innerHTML = `
497
+ <div style="display: flex; align-items: center; gap: 5px; align-content: center;color:white;">
498
+ <span style="overflow: hidden; text-overflow: ellipsis">${i}</span>
499
+ <svg style="fill: grey; font-size: 10px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="20" height="20" viewBox="0 0 20 20" ><defs><path id="a" d="M0 0h24v24H0V0z"/></defs><clipPath id="b"><use xlink:href="#a" overflow="visible"/></clipPath><path clip-path="url(#b)" d="M9.01 14H2v2h7.01v3L13 15l-3.99-4v3zm5.98-1v-3H22V8h-7.01V5L11 9l3.99 4z"/></svg>
500
+ </div>
501
+ `, document.body.appendChild(o), t.dataTransfer.setDragImage(o, 50, 12), setTimeout(() => {
502
+ document.body.contains(o) && document.body.removeChild(o);
503
+ }, 100);
504
+ }
505
+ /**
506
+ * Highlight an entire column during drag operations
507
+ */
508
+ highlightColumn(t, e, s) {
509
+ const o = t.querySelector("thead tr"), i = t.querySelector("tbody");
510
+ if (!o || !i) return;
511
+ const r = o.children[e];
512
+ if (r)
513
+ if (s) {
514
+ r.classList.add(this.options.dragOverClass);
515
+ const n = i.children;
516
+ for (let l = 0; l < n.length; l++) {
517
+ const c = n[l].children[e];
518
+ c && c.classList.add(this.options.dragOverClass);
519
+ }
520
+ } else {
521
+ r.classList.remove(this.options.dragOverClass);
522
+ const n = i.children;
523
+ for (let l = 0; l < n.length; l++) {
524
+ const c = n[l].children[e];
525
+ c && c.classList.remove(this.options.dragOverClass);
526
+ }
527
+ }
528
+ }
529
+ /**
530
+ * Clear all column highlights
531
+ */
532
+ clearAllColumnHighlights(t) {
533
+ const e = t.querySelector("thead tr"), s = t.querySelector("tbody");
534
+ if (!e || !s) return;
535
+ const o = e.children;
536
+ for (let r = 0; r < o.length; r++)
537
+ o[r].classList.remove(this.options.dragOverClass);
538
+ const i = s.children;
539
+ for (let r = 0; r < i.length; r++) {
540
+ const n = i[r].children;
541
+ for (let l = 0; l < n.length; l++)
542
+ n[l].classList.remove(this.options.dragOverClass);
543
+ }
544
+ }
545
+ /**
546
+ * Reorder columns in a table
547
+ */
548
+ reorderColumns(t, e, s, o) {
549
+ const i = t.querySelector("thead tr"), r = t.querySelector("tbody");
550
+ if (!i || !r) return;
551
+ const n = Array.from(i.children), l = Array.from(r.children);
552
+ if (s < 0 || s >= n.length || o < 0 || o >= n.length) {
553
+ console.warn("Invalid column indices for reordering");
554
+ return;
555
+ }
556
+ if (s === o)
557
+ return;
558
+ const c = n[s], u = n[o];
559
+ s < o ? i.insertBefore(c, u.nextSibling) : i.insertBefore(c, u), l.forEach((d, m) => {
560
+ const f = Array.from(d.children), g = f[s], y = f[o];
561
+ s < o ? d.insertBefore(g, y.nextSibling) : d.insertBefore(g, y);
562
+ });
563
+ const p = this.originalColumnOrder.get(e);
564
+ if (p) {
565
+ const d = [...p], m = d[s];
566
+ d.splice(s, 1), d.splice(o, 0, m), this.originalColumnOrder.set(e, d);
567
+ }
568
+ this.applyTableStyles(t), this.refreshDragAndDropListeners(t, e);
569
+ }
570
+ /**
571
+ * Refresh drag and drop listeners after column reordering
572
+ */
573
+ refreshDragAndDropListeners(t, e) {
574
+ const s = t.querySelector("thead tr");
575
+ if (!s) return;
576
+ Array.from(s.children).forEach((i, r) => {
577
+ if (i.classList.contains(this.options.draggableClass)) {
578
+ i.style.opacity = "", i.style.background = "", i.style.borderRight = "";
579
+ const n = i.cloneNode(!0);
580
+ i.parentNode.replaceChild(n, i), this.makeHeaderSortable(n, t, e, r);
581
+ }
582
+ });
583
+ }
584
+ /**
585
+ * Update table width based on current column widths
586
+ */
587
+ updateTableWidth(t) {
588
+ const e = t.querySelectorAll("th");
589
+ let s = 0;
590
+ e.forEach((o) => {
591
+ const i = o.style.width;
592
+ if (i) {
593
+ const r = parseInt(i.replace("px", ""));
594
+ s += r;
595
+ } else {
596
+ const r = o.textContent.replace(/[📊🔍]/g, "").trim();
597
+ s += r.length;
598
+ }
599
+ }), t.style.width = `${s}px`;
600
+ }
601
+ /**
602
+ * Calculate intelligent table width based on header text length
603
+ */
604
+ calculateTableWidth(t) {
605
+ var p;
606
+ const e = t.getAttribute("data-original-width"), s = e ? parseFloat(e) : 0, o = t.querySelectorAll("th");
607
+ let i = 0;
608
+ t.parentElement.clientWidth;
609
+ const r = [];
610
+ o.forEach((d) => {
611
+ let f = d.textContent.replace(/[📊🔍]/g, "").trim().length * this.charWidth + 15;
612
+ r.push(f), i += f;
613
+ });
614
+ const n = t.querySelectorAll("tr"), l = ((p = t.parentElement) == null ? void 0 : p.getBoundingClientRect().width) ?? i;
615
+ var c = 0;
616
+ for (const d of n)
617
+ d.querySelectorAll("td").forEach((f, g) => {
618
+ const b = f.textContent.length * this.charWidth + 15;
619
+ b > r[g] && g < r.length && (r[g] = b);
620
+ });
621
+ c = r.reduce((d, m) => d += m, 0), o.forEach((d, m) => {
622
+ if (c > l) {
623
+ const f = r[m] / c;
624
+ d.style.width = `${l * f}px`;
625
+ } else
626
+ d.style.width = `${r[m]}px`;
627
+ });
628
+ let u = 0;
629
+ return c > l ? u = "100%" : u = `${Math.max(c, s)}px`, u;
630
+ }
631
+ /**
632
+ * Apply inline styles to ensure text clipping and horizontal scroll work
633
+ */
634
+ applyTableStyles(t) {
635
+ const e = this.calculateTableWidth(t);
636
+ t.style.width = e, t.style.maxWidth = "100%";
637
+ }
638
+ getCharWidth(t, e, s) {
639
+ const i = document.createElement("canvas").getContext("2d");
640
+ return i.fontFamily = e, i.fontMono = s, i.measureText("A ").width;
641
+ }
642
+ /**
643
+ * Add CSS styles for sortable tables
644
+ */
645
+ addStyles() {
646
+ if (document.getElementById("sortable-table-styles"))
647
+ return;
648
+ const t = document.createElement("style");
649
+ t.id = "sortable-table-styles", t.textContent = `
650
+ .${this.options.sortableClass} {
651
+ position: relative;
652
+ user-select: none;
653
+ transition: background-color 0.2s ease;
654
+ }
655
+
656
+ .${this.options.sortableClass}:hover {
657
+ background-color: ${this.options.theme.palette.surface.hover} !important;
658
+ }
659
+
660
+ .${this.options.activeSortClass} {
661
+ background-color: ${this.options.theme.palette.surface.raised} !important;
662
+ font-weight: bold;
663
+ }
664
+
665
+ .${this.options.ascendingClass} {
666
+ border-bottom: 2px solid var(${this.options.theme.palette.primary.main}, #3a3a3a);
667
+ }
668
+
669
+ .${this.options.descendingClass} {
670
+ border-bottom: 2px solid var(${this.options.theme.palette.primary.main}, #3a3a3a);
671
+ }
672
+
673
+ .${this.options.sortableClass} .material-icons {
674
+ transition: opacity 0.2s ease, transform 0.2s ease;
675
+ }
676
+
677
+ .${this.options.activeSortClass} .material-icons {
678
+ color: var(${this.options.theme.palette.primary.main}, #3a3a3a);
679
+ }
680
+
681
+ .${this.options.resizableClass} .resize-handle:hover {
682
+ background-color: var(${this.options.theme.palette.primary.light}, #64B5F6);
683
+ }
684
+
685
+ .${this.options.draggableClass} {
686
+ cursor: move;
687
+ position: relative;
688
+ }
689
+
690
+ .${this.options.draggableClass}::before {
691
+ content: '';
692
+ position: absolute;
693
+ top: 0;
694
+ left: -5px;
695
+ right: -5px;
696
+ bottom: 0;
697
+ z-index: 1;
698
+ pointer-events: none;
699
+ }
700
+
701
+ .${this.options.dragOverClass} {
702
+ background-color: rgba(128, 128, 128, 0.2) !important;
703
+ border: 2px dashed rgba(128, 128, 128, 0.8);
704
+ }
705
+
706
+ .${this.options.draggableClass}:hover {
707
+ background-color: var(${this.options.theme.palette.surface.raised}, rgba(100, 181, 246, 0.1)) !important;
708
+ }
709
+
710
+ .sortable-table tbody td {
711
+ width: auto
712
+ }
713
+
714
+ .sortable-table {
715
+ background-color: 'inherit';
716
+ /* Cross-fade bg/row stripes when the .sortable-table
717
+ * class flip lands on a freshly-streamed markdown
718
+ * table. Width is NOT animated: column widths set
719
+ * by calculateTableWidth can be narrower than the
720
+ * content currently fills, so animating them down
721
+ * causes mid-transition cell wrap. Snap widths,
722
+ * animate only colours. */
723
+ transition: background-color 280ms ease-out;
724
+ }
725
+
726
+ .sortable-table th {
727
+ transition: background-color 280ms ease-out;
728
+ }
729
+
730
+ /* Zebra striping for table rows */
731
+ .sortable-table tbody tr:nth-child(odd) {
732
+ background-color: ${this.options.theme.palette.background.defalt};
733
+ color: ${this.options.theme.palette.text.primary};
734
+ }
735
+
736
+ .sortable-table tbody tr:nth-child(even) {
737
+ background-color: ${this.options.theme.palette.background.defalt};
738
+ color: ${this.options.theme.palette.text.primary};
739
+ }
740
+
741
+ /* One-shot arrival animation. Applied via a transient
742
+ * class (added by makeTableSortable on first mount only)
743
+ * so it does NOT re-fire on every destroy/init cycle.
744
+ * scaleX with origin top-left gives the "right edge
745
+ * grows outward" feel the user asked for; the 0.96
746
+ * start is subtle enough that text compression isn't
747
+ * obvious. */
748
+ @keyframes sortable-table-arrive {
749
+ from {
750
+ opacity: 0.35;
751
+ transform: scaleX(0.96);
752
+ transform-origin: top left;
753
+ }
754
+ to {
755
+ opacity: 1;
756
+ transform: scaleX(1);
757
+ }
758
+ }
759
+
760
+ .sortable-table-arriving {
761
+ animation: sortable-table-arrive 320ms cubic-bezier(0.16, 1, 0.3, 1) both;
762
+ }
763
+
764
+ /* Ensure hover effects work with zebra striping */
765
+ .sortable-table tbody tr:hover {
766
+ background-color: ${this.options.theme.palette.surface.hover} !important;
767
+ }
768
+
769
+ /* Fix table-container overflow issue */
770
+ .table-container {
771
+ overflow: auto !important;
772
+ overflow-x: auto !important;
773
+ overflow-y: auto !important;
774
+ }
775
+ `, document.getElementById("sortable-table-styles") || document.head.appendChild(t);
776
+ }
777
+ /**
778
+ * Destroy the sortable functionality
779
+ */
780
+ destroy() {
781
+ this.tables.forEach((e) => {
782
+ e.querySelectorAll(`.${this.options.sortableClass}`).forEach((o) => {
783
+ o.classList.remove(
784
+ this.options.sortableClass,
785
+ this.options.activeSortClass,
786
+ this.options.ascendingClass,
787
+ this.options.descendingClass
788
+ ), o.style.cursor = "", o.style.background = "";
789
+ const i = o.cloneNode(!0);
790
+ o.parentNode.replaceChild(i, o);
791
+ });
792
+ });
793
+ const t = document.getElementById("sortable-table-styles");
794
+ t && t.remove(), this.tables = [], this.sortStates.clear(), C.clear();
795
+ }
796
+ /**
797
+ * Refresh the library (useful after DOM changes)
798
+ */
799
+ refresh() {
800
+ this.destroy(), this.init();
801
+ }
802
+ };
803
+ h(w, "SortableTable");
804
+ let v = w;
805
+ typeof window < "u" && (window.SortableTable = v);
806
+ export {
807
+ v as S,
808
+ W as a,
809
+ D as b,
810
+ E as c,
811
+ O as d,
812
+ T as e,
813
+ F as f,
814
+ M as g,
815
+ z as i,
816
+ $ as p,
817
+ q as s
818
+ };
819
+ //# sourceMappingURL=sortable-table-DgQHxWIh.js.map