@glodon-aiot/agent-cli-ui 2.4.7 → 3.0.4

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 (150) hide show
  1. package/dist/es/AgentClientUI.mjs +97 -110
  2. package/dist/es/Dialog/AgentChat/index.mjs +516 -467
  3. package/dist/es/Dialog/ConnectToNetwork/index.mjs +25 -24
  4. package/dist/es/Dialog/FileCard/index.mjs +48 -55
  5. package/dist/es/Dialog/FilePreview/index.mjs +35 -42
  6. package/dist/es/Dialog/HistoryItem/index.mjs +48 -53
  7. package/dist/es/Dialog/KnowledgeList/index.mjs +55 -48
  8. package/dist/es/Dialog/PromptManager/index.mjs +29 -36
  9. package/dist/es/Dialog/PromptSetting/index.mjs +53 -66
  10. package/dist/es/Dialog/SessionAction/index.mjs +92 -91
  11. package/dist/es/Dialog/SessionList/index.mjs +135 -121
  12. package/dist/es/Dialog/SessionListDrawer/index.mjs +8 -7
  13. package/dist/es/Dialog/SessionRefer/ReferItem/index.mjs +29 -36
  14. package/dist/es/Dialog/SessionRefer/index.mjs +29 -36
  15. package/dist/es/Dialog/SessionRelated/index.mjs +17 -14
  16. package/dist/es/Dialog/UploadKnowledgeFiles/index.mjs +125 -132
  17. package/dist/es/Dialog/index.mjs +125 -93
  18. package/dist/es/QuillEditor/index.mjs +91 -86
  19. package/dist/es/_virtual/index.mjs +2 -2
  20. package/dist/es/components/Markdown/Image/index.mjs +20 -20
  21. package/dist/es/components/Markdown/index.mjs +27 -22
  22. package/dist/es/constant.mjs +8 -5
  23. package/dist/es/index.mjs +178 -152
  24. package/dist/es/node_modules/classnames/index.mjs +1 -1
  25. package/dist/es/node_modules/comma-separated-tokens/index.mjs +13 -0
  26. package/dist/es/node_modules/devlop/lib/default.mjs +5 -0
  27. package/dist/es/node_modules/hast-util-from-dom/lib/index.mjs +93 -0
  28. package/dist/es/node_modules/hast-util-from-dom/node_modules/hastscript/lib/create-h.mjs +126 -0
  29. package/dist/es/node_modules/hast-util-from-dom/node_modules/hastscript/lib/index.mjs +8 -0
  30. package/dist/es/node_modules/hast-util-from-dom/node_modules/hastscript/lib/svg-case-sensitive-tag-names.mjs +4 -0
  31. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/index.mjs +12 -0
  32. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/aria.mjs +61 -0
  33. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/find.mjs +33 -0
  34. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/html.mjs +368 -0
  35. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/normalize.mjs +6 -0
  36. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/svg.mjs +566 -0
  37. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/util/case-insensitive-transform.mjs +7 -0
  38. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/util/case-sensitive-transform.mjs +6 -0
  39. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/util/create.mjs +14 -0
  40. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/util/defined-info.mjs +36 -0
  41. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/util/info.mjs +28 -0
  42. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/util/merge.mjs +10 -0
  43. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/util/schema.mjs +21 -0
  44. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/util/types.mjs +15 -0
  45. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/xlink.mjs +19 -0
  46. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/xml.mjs +15 -0
  47. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/xmlns.mjs +16 -0
  48. package/dist/es/node_modules/hast-util-from-html-isomorphic/lib/browser.mjs +16 -0
  49. package/dist/es/node_modules/hast-util-is-element/lib/index.mjs +61 -0
  50. package/dist/es/node_modules/hast-util-parse-selector/lib/index.mjs +20 -0
  51. package/dist/es/node_modules/hast-util-to-text/lib/index.mjs +223 -0
  52. package/dist/es/node_modules/katex/dist/katex.min.css.mjs +4 -0
  53. package/dist/es/node_modules/katex/dist/katex.mjs +11700 -0
  54. package/dist/es/node_modules/longest-streak/index.mjs +12 -0
  55. package/dist/es/node_modules/mdast-util-math/lib/index.mjs +170 -0
  56. package/dist/es/node_modules/micromark-extension-math/lib/math-flow.mjs +76 -0
  57. package/dist/es/node_modules/micromark-extension-math/lib/math-text.mjs +48 -0
  58. package/dist/es/node_modules/micromark-extension-math/lib/syntax.mjs +15 -0
  59. package/dist/es/node_modules/micromark-factory-space/index.mjs +15 -0
  60. package/dist/es/node_modules/micromark-util-character/index.mjs +10 -0
  61. package/dist/es/node_modules/rehype-katex/lib/index.mjs +83 -0
  62. package/dist/es/node_modules/remark-math/lib/index.mjs +13 -0
  63. package/dist/es/node_modules/space-separated-tokens/index.mjs +7 -0
  64. package/dist/es/node_modules/unist-util-find-after/lib/index.mjs +32 -0
  65. package/dist/es/node_modules/unist-util-is/lib/index.mjs +81 -0
  66. package/dist/es/node_modules/unist-util-visit-parents/lib/color.mjs +6 -0
  67. package/dist/es/node_modules/unist-util-visit-parents/lib/index.mjs +56 -0
  68. package/dist/es/node_modules/web-namespaces/index.mjs +11 -0
  69. package/dist/es/utils/index.mjs +44 -27
  70. package/dist/lib/index.js +278 -138
  71. package/dist/src/Dialog/AgentChat/index.d.ts +4 -2
  72. package/dist/src/Dialog/ConnectToNetwork/index.d.ts +1 -0
  73. package/dist/src/Dialog/KnowledgeList/KnowledgeSelect/index.d.ts +1 -1
  74. package/dist/src/Dialog/KnowledgeList/index.d.ts +2 -3
  75. package/dist/src/Dialog/PromptSetting/index.d.ts +1 -0
  76. package/dist/src/Dialog/SessionAction/index.d.ts +2 -0
  77. package/dist/src/Dialog/SessionList/index.d.ts +5 -4
  78. package/dist/src/QuillEditor/index.d.ts +1 -0
  79. package/dist/src/components/Markdown/Text/index.d.ts +8 -0
  80. package/dist/src/components/MathJaxLoader/index.d.ts +7 -0
  81. package/dist/src/components/MathJaxRender/index.d.ts +6 -0
  82. package/dist/src/constant.d.ts +1 -1
  83. package/dist/src/contexts/MathJaxContext.d.ts +12 -0
  84. package/dist/src/index.d.ts +4 -1
  85. package/dist/src/types.d.ts +26 -6
  86. package/dist/src/utils/index.d.ts +15 -0
  87. package/package.json +18 -17
  88. package/dist/es/_virtual/index2.mjs +0 -4
  89. package/dist/es/_virtual/index3.mjs +0 -4
  90. package/dist/es/_virtual/index4.mjs +0 -4
  91. package/dist/es/_virtual/minio-zj.mjs +0 -4
  92. package/dist/es/node_modules/@glodon-aiot/minio/dist/minio-zj.mjs +0 -26485
  93. package/dist/es/node_modules/@socket.io/component-emitter/lib/esm/index.mjs +0 -54
  94. package/dist/es/node_modules/base64-js/index.mjs +0 -47
  95. package/dist/es/node_modules/buffer/index.mjs +0 -927
  96. package/dist/es/node_modules/engine.io-client/build/esm/contrib/has-cors.mjs +0 -9
  97. package/dist/es/node_modules/engine.io-client/build/esm/contrib/parseqs.mjs +0 -18
  98. package/dist/es/node_modules/engine.io-client/build/esm/contrib/parseuri.mjs +0 -24
  99. package/dist/es/node_modules/engine.io-client/build/esm/contrib/yeast.mjs +0 -19
  100. package/dist/es/node_modules/engine.io-client/build/esm/globalThis.browser.mjs +0 -4
  101. package/dist/es/node_modules/engine.io-client/build/esm/socket.mjs +0 -317
  102. package/dist/es/node_modules/engine.io-client/build/esm/transport.mjs +0 -113
  103. package/dist/es/node_modules/engine.io-client/build/esm/transports/index.mjs +0 -11
  104. package/dist/es/node_modules/engine.io-client/build/esm/transports/polling.mjs +0 -273
  105. package/dist/es/node_modules/engine.io-client/build/esm/transports/websocket-constructor.browser.mjs +0 -8
  106. package/dist/es/node_modules/engine.io-client/build/esm/transports/websocket.mjs +0 -87
  107. package/dist/es/node_modules/engine.io-client/build/esm/transports/webtransport.mjs +0 -52
  108. package/dist/es/node_modules/engine.io-client/build/esm/transports/xmlhttprequest.browser.mjs +0 -21
  109. package/dist/es/node_modules/engine.io-client/build/esm/util.mjs +0 -23
  110. package/dist/es/node_modules/engine.io-parser/build/esm/commons.mjs +0 -21
  111. package/dist/es/node_modules/engine.io-parser/build/esm/contrib/base64-arraybuffer.mjs +0 -14
  112. package/dist/es/node_modules/engine.io-parser/build/esm/decodePacket.browser.mjs +0 -39
  113. package/dist/es/node_modules/engine.io-parser/build/esm/encodePacket.browser.mjs +0 -28
  114. package/dist/es/node_modules/engine.io-parser/build/esm/index.mjs +0 -105
  115. package/dist/es/node_modules/ieee754/index.mjs +0 -28
  116. package/dist/es/node_modules/js-base64/base64.mjs +0 -31
  117. package/dist/es/node_modules/socket.io-client/build/esm/contrib/backo2.mjs +0 -26
  118. package/dist/es/node_modules/socket.io-client/build/esm/index.mjs +0 -25
  119. package/dist/es/node_modules/socket.io-client/build/esm/manager.mjs +0 -242
  120. package/dist/es/node_modules/socket.io-client/build/esm/on.mjs +0 -8
  121. package/dist/es/node_modules/socket.io-client/build/esm/socket.mjs +0 -608
  122. package/dist/es/node_modules/socket.io-client/build/esm/url.mjs +0 -19
  123. package/dist/es/node_modules/socket.io-parser/build/esm/binary.mjs +0 -52
  124. package/dist/es/node_modules/socket.io-parser/build/esm/index.mjs +0 -203
  125. package/dist/es/node_modules/socket.io-parser/build/esm/is-binary.mjs +0 -26
  126. package/dist/es/packages/agent-cli-sdk/src/AgentSession.mjs +0 -243
  127. package/dist/es/packages/agent-cli-sdk/src/BotClient.mjs +0 -242
  128. package/dist/es/packages/agent-cli-sdk/src/Config.mjs +0 -34
  129. package/dist/es/packages/agent-cli-sdk/src/DialogSession.mjs +0 -281
  130. package/dist/es/packages/agent-cli-sdk/src/EventBus.mjs +0 -64
  131. package/dist/es/packages/agent-cli-sdk/src/Logger.mjs +0 -31
  132. package/dist/es/packages/agent-cli-sdk/src/PayloadTypes.mjs +0 -4
  133. package/dist/es/packages/agent-cli-sdk/src/Session.mjs +0 -527
  134. package/dist/es/packages/agent-cli-sdk/src/api/fetchEventSource/fetch.mjs +0 -112
  135. package/dist/es/packages/agent-cli-sdk/src/api/fetchEventSource/parse.mjs +0 -97
  136. package/dist/es/packages/agent-cli-sdk/src/api/index.mjs +0 -48
  137. package/dist/es/packages/agent-cli-sdk/src/utils.mjs +0 -11
  138. package/dist/es/packages/apis/dist/es/aecpilot/cosntant.mjs +0 -5
  139. package/dist/es/packages/apis/dist/es/aecpilot/model.mjs +0 -9
  140. package/dist/es/packages/apis/dist/es/aecpilotui/index.mjs +0 -8
  141. package/dist/es/packages/apis/dist/es/agentcliui/index.mjs +0 -414
  142. package/dist/es/packages/apis/dist/es/base/index.mjs +0 -154
  143. package/dist/es/packages/apis/dist/es/cvforce/index.mjs +0 -431
  144. package/dist/es/packages/apis/dist/es/cvforce/model.mjs +0 -6
  145. package/dist/es/packages/apis/dist/es/node_modules/uuid/dist/esm-browser/native.mjs +0 -6
  146. package/dist/es/packages/apis/dist/es/node_modules/uuid/dist/esm-browser/rng.mjs +0 -10
  147. package/dist/es/packages/apis/dist/es/node_modules/uuid/dist/esm-browser/stringify.mjs +0 -9
  148. package/dist/es/packages/apis/dist/es/node_modules/uuid/dist/esm-browser/v4.mjs +0 -19
  149. package/dist/es/packages/apis/dist/es/utils/fetchEventSource/fetch.mjs +0 -106
  150. package/dist/es/packages/apis/dist/es/utils/fetchEventSource/parse.mjs +0 -97
@@ -0,0 +1,12 @@
1
+ function f(l, t) {
2
+ const i = String(l);
3
+ let e = i.indexOf(t), n = e, o = 0, r = 0;
4
+ if (typeof t != "string")
5
+ throw new TypeError("Expected substring");
6
+ for (; e !== -1; )
7
+ e === n ? ++o > r && (r = o) : o = 1, n = e + t.length, e = i.indexOf(t, n);
8
+ return r;
9
+ }
10
+ export {
11
+ f as longestStreak
12
+ };
@@ -0,0 +1,170 @@
1
+ var $ = Object.defineProperty;
2
+ var w = Object.getOwnPropertySymbols;
3
+ var g = Object.prototype.hasOwnProperty, k = Object.prototype.propertyIsEnumerable;
4
+ var F = (r, a, i) => a in r ? $(r, a, { enumerable: !0, configurable: !0, writable: !0, value: i }) : r[a] = i, M = (r, a) => {
5
+ for (var i in a || (a = {}))
6
+ g.call(a, i) && F(r, i, a[i]);
7
+ if (w)
8
+ for (var i of w(a))
9
+ k.call(a, i) && F(r, i, a[i]);
10
+ return r;
11
+ };
12
+ import { ok as u } from "../../devlop/lib/default.mjs";
13
+ import { longestStreak as v } from "../../longest-streak/index.mjs";
14
+ function N() {
15
+ return {
16
+ enter: {
17
+ mathFlow: r,
18
+ mathFlowFenceMeta: a,
19
+ mathText: s
20
+ },
21
+ exit: {
22
+ mathFlow: p,
23
+ mathFlowFence: m,
24
+ mathFlowFenceMeta: i,
25
+ mathFlowValue: h,
26
+ mathText: x,
27
+ mathTextData: h
28
+ }
29
+ };
30
+ function r(t) {
31
+ const e = {
32
+ type: "element",
33
+ tagName: "code",
34
+ properties: {
35
+ className: ["language-math", "math-display"]
36
+ },
37
+ children: []
38
+ };
39
+ this.enter({
40
+ type: "math",
41
+ meta: null,
42
+ value: "",
43
+ data: {
44
+ hName: "pre",
45
+ hChildren: [e]
46
+ }
47
+ }, t);
48
+ }
49
+ function a() {
50
+ this.buffer();
51
+ }
52
+ function i() {
53
+ const t = this.resume(), e = this.stack[this.stack.length - 1];
54
+ u(e.type === "math"), e.meta = t;
55
+ }
56
+ function m() {
57
+ this.data.mathFlowInside || (this.buffer(), this.data.mathFlowInside = !0);
58
+ }
59
+ function p(t) {
60
+ const e = this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g, ""), n = this.stack[this.stack.length - 1];
61
+ u(n.type === "math"), this.exit(t), n.value = e;
62
+ const o = (
63
+ /** @type {HastElement} */
64
+ n.data.hChildren[0]
65
+ );
66
+ u(o.type === "element"), u(o.tagName === "code"), o.children.push({
67
+ type: "text",
68
+ value: e
69
+ }), this.data.mathFlowInside = void 0;
70
+ }
71
+ function s(t) {
72
+ this.enter({
73
+ type: "inlineMath",
74
+ value: "",
75
+ data: {
76
+ hName: "code",
77
+ hProperties: {
78
+ className: ["language-math", "math-inline"]
79
+ },
80
+ hChildren: []
81
+ }
82
+ }, t), this.buffer();
83
+ }
84
+ function x(t) {
85
+ const e = this.resume(), n = this.stack[this.stack.length - 1];
86
+ u(n.type === "inlineMath"), this.exit(t), n.value = e, /** @type {Array<HastElementContent>} */
87
+ // @ts-expect-error: we defined it in `enterMathFlow`.
88
+ n.data.hChildren.push({
89
+ type: "text",
90
+ value: e
91
+ });
92
+ }
93
+ function h(t) {
94
+ this.config.enter.data.call(this, t), this.config.exit.data.call(this, t);
95
+ }
96
+ }
97
+ function b(r) {
98
+ let a = (r || {}).singleDollarTextMath;
99
+ return a == null && (a = !0), m.peek = p, {
100
+ unsafe: [{
101
+ character: "\r",
102
+ inConstruct: "mathFlowMeta"
103
+ }, {
104
+ character: `
105
+ `,
106
+ inConstruct: "mathFlowMeta"
107
+ }, {
108
+ character: "$",
109
+ after: a ? void 0 : "\\$",
110
+ inConstruct: "phrasing"
111
+ }, {
112
+ character: "$",
113
+ inConstruct: "mathFlowMeta"
114
+ }, {
115
+ atBreak: !0,
116
+ character: "$",
117
+ after: "\\$"
118
+ }],
119
+ handlers: {
120
+ math: i,
121
+ inlineMath: m
122
+ }
123
+ };
124
+ function i(s, x, h, t) {
125
+ const e = s.value || "", n = h.createTracker(t), o = "$".repeat(Math.max(v(e, "$") + 1, 2)), d = h.enter("mathFlow");
126
+ let c = n.move(o);
127
+ if (s.meta) {
128
+ const l = h.enter("mathFlowMeta");
129
+ c += n.move(h.safe(s.meta, M({
130
+ after: `
131
+ `,
132
+ before: c,
133
+ encode: ["$"]
134
+ }, n.current()))), l();
135
+ }
136
+ return c += n.move(`
137
+ `), e && (c += n.move(e + `
138
+ `)), c += n.move(o), d(), c;
139
+ }
140
+ function m(s, x, h) {
141
+ let t = s.value || "", e = 1;
142
+ for (a || e++; new RegExp("(^|[^$])" + "\\$".repeat(e) + "([^$]|$)").test(t); )
143
+ e++;
144
+ const n = "$".repeat(e);
145
+ // Contains non-space.
146
+ /[^ \r\n]/.test(t) && // Starts with space and ends with space.
147
+ (/^[ \r\n]/.test(t) && /[ \r\n]$/.test(t) || // Starts or ends with dollar.
148
+ /^\$|\$$/.test(t)) && (t = " " + t + " ");
149
+ let o = -1;
150
+ for (; ++o < h.unsafe.length; ) {
151
+ const d = h.unsafe[o];
152
+ if (!d.atBreak)
153
+ continue;
154
+ const c = h.compilePattern(d);
155
+ let l;
156
+ for (; l = c.exec(t); ) {
157
+ let f = l.index;
158
+ t.codePointAt(f) === 10 && t.codePointAt(f - 1) === 13 && f--, t = t.slice(0, f) + " " + t.slice(l.index + 1);
159
+ }
160
+ }
161
+ return n + t + n;
162
+ }
163
+ function p() {
164
+ return "$";
165
+ }
166
+ }
167
+ export {
168
+ N as mathFromMarkdown,
169
+ b as mathToMarkdown
170
+ };
@@ -0,0 +1,76 @@
1
+ import { factorySpace as h } from "../../micromark-factory-space/index.mjs";
2
+ import { markdownLineEnding as a } from "../../micromark-util-character/index.mjs";
3
+ const A = {
4
+ tokenize: v,
5
+ concrete: !0,
6
+ name: "mathFlow"
7
+ }, q = {
8
+ tokenize: N,
9
+ partial: !0
10
+ };
11
+ function v(t, l, o) {
12
+ const i = this, u = i.events[i.events.length - 1], m = u && u[1].type === "linePrefix" ? u[2].sliceSerialize(u[1], !0).length : 0;
13
+ let r = 0;
14
+ return k;
15
+ function k(n) {
16
+ return t.enter("mathFlow"), t.enter("mathFlowFence"), t.enter("mathFlowFenceSequence"), p(n);
17
+ }
18
+ function p(n) {
19
+ return n === 36 ? (t.consume(n), r++, p) : r < 2 ? o(n) : (t.exit("mathFlowFenceSequence"), h(t, y, "whitespace")(n));
20
+ }
21
+ function y(n) {
22
+ return n === null || a(n) ? x(n) : (t.enter("mathFlowFenceMeta"), t.enter("chunkString", {
23
+ contentType: "string"
24
+ }), z(n));
25
+ }
26
+ function z(n) {
27
+ return n === null || a(n) ? (t.exit("chunkString"), t.exit("mathFlowFenceMeta"), x(n)) : n === 36 ? o(n) : (t.consume(n), z);
28
+ }
29
+ function x(n) {
30
+ return t.exit("mathFlowFence"), i.interrupt ? l(n) : t.attempt(q, S, F)(n);
31
+ }
32
+ function S(n) {
33
+ return t.attempt({
34
+ tokenize: L,
35
+ partial: !0
36
+ }, F, b)(n);
37
+ }
38
+ function b(n) {
39
+ return (m ? h(t, w, "linePrefix", m + 1) : w)(n);
40
+ }
41
+ function w(n) {
42
+ return n === null ? F(n) : a(n) ? t.attempt(q, S, F)(n) : (t.enter("mathFlowValue"), c(n));
43
+ }
44
+ function c(n) {
45
+ return n === null || a(n) ? (t.exit("mathFlowValue"), w(n)) : (t.consume(n), c);
46
+ }
47
+ function F(n) {
48
+ return t.exit("mathFlow"), l(n);
49
+ }
50
+ function L(n, E, s) {
51
+ let C = 0;
52
+ return h(n, M, "linePrefix", i.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4);
53
+ function M(e) {
54
+ return n.enter("mathFlowFence"), n.enter("mathFlowFenceSequence"), g(e);
55
+ }
56
+ function g(e) {
57
+ return e === 36 ? (C++, n.consume(e), g) : C < r ? s(e) : (n.exit("mathFlowFenceSequence"), h(n, P, "whitespace")(e));
58
+ }
59
+ function P(e) {
60
+ return e === null || a(e) ? (n.exit("mathFlowFence"), E(e)) : s(e);
61
+ }
62
+ }
63
+ }
64
+ function N(t, l, o) {
65
+ const i = this;
66
+ return u;
67
+ function u(r) {
68
+ return r === null ? l(r) : (t.enter("lineEnding"), t.consume(r), t.exit("lineEnding"), m);
69
+ }
70
+ function m(r) {
71
+ return i.parser.lazy[i.now().line] ? o(r) : l(r);
72
+ }
73
+ }
74
+ export {
75
+ A as mathFlow
76
+ };
@@ -0,0 +1,48 @@
1
+ import { markdownLineEnding as y } from "../../micromark-util-character/index.mjs";
2
+ function k(e) {
3
+ let a = (e || {}).singleDollarTextMath;
4
+ return a == null && (a = !0), {
5
+ tokenize: i,
6
+ resolve: d,
7
+ previous: q,
8
+ name: "mathText"
9
+ };
10
+ function i(n, o, p) {
11
+ let l = 0, x, m;
12
+ return E;
13
+ function E(t) {
14
+ return n.enter("mathText"), n.enter("mathTextSequence"), T(t);
15
+ }
16
+ function T(t) {
17
+ return t === 36 ? (n.consume(t), l++, T) : l < 2 && !a ? p(t) : (n.exit("mathTextSequence"), u(t));
18
+ }
19
+ function u(t) {
20
+ return t === null ? p(t) : t === 36 ? (m = n.enter("mathTextSequence"), x = 0, g(t)) : t === 32 ? (n.enter("space"), n.consume(t), n.exit("space"), u) : y(t) ? (n.enter("lineEnding"), n.consume(t), n.exit("lineEnding"), u) : (n.enter("mathTextData"), h(t));
21
+ }
22
+ function h(t) {
23
+ return t === null || t === 32 || t === 36 || y(t) ? (n.exit("mathTextData"), u(t)) : (n.consume(t), h);
24
+ }
25
+ function g(t) {
26
+ return t === 36 ? (n.consume(t), x++, g) : x === l ? (n.exit("mathTextSequence"), n.exit("mathText"), o(t)) : (m.type = "mathTextData", h(t));
27
+ }
28
+ }
29
+ }
30
+ function d(e) {
31
+ let r = e.length - 4, a = 3, i, n;
32
+ if ((e[a][1].type === "lineEnding" || e[a][1].type === "space") && (e[r][1].type === "lineEnding" || e[r][1].type === "space")) {
33
+ for (i = a; ++i < r; )
34
+ if (e[i][1].type === "mathTextData") {
35
+ e[r][1].type = "mathTextPadding", e[a][1].type = "mathTextPadding", a += 2, r -= 2;
36
+ break;
37
+ }
38
+ }
39
+ for (i = a - 1, r++; ++i <= r; )
40
+ n === void 0 ? i !== r && e[i][1].type !== "lineEnding" && (n = i) : (i === r || e[i][1].type === "lineEnding") && (e[n][1].type = "mathTextData", i !== n + 2 && (e[n][1].end = e[i - 1][1].end, e.splice(n + 2, i - n - 2), r -= i - n - 2, i = n + 2), n = void 0);
41
+ return e;
42
+ }
43
+ function q(e) {
44
+ return e !== 36 || this.events[this.events.length - 1][1].type === "characterEscape";
45
+ }
46
+ export {
47
+ k as mathText
48
+ };
@@ -0,0 +1,15 @@
1
+ import { mathFlow as o } from "./math-flow.mjs";
2
+ import { mathText as m } from "./math-text.mjs";
3
+ function f(t) {
4
+ return {
5
+ flow: {
6
+ 36: o
7
+ },
8
+ text: {
9
+ 36: m(t)
10
+ }
11
+ };
12
+ }
13
+ export {
14
+ f as math
15
+ };
@@ -0,0 +1,15 @@
1
+ import { markdownSpace as m } from "../micromark-util-character/index.mjs";
2
+ function p(n, t, i, u) {
3
+ const o = u ? u - 1 : Number.POSITIVE_INFINITY;
4
+ let I = 0;
5
+ return a;
6
+ function a(r) {
7
+ return m(r) ? (n.enter(i), e(r)) : t(r);
8
+ }
9
+ function e(r) {
10
+ return m(r) && I++ < o ? (n.consume(r), e) : (n.exit(i), t(r));
11
+ }
12
+ }
13
+ export {
14
+ p as factorySpace
15
+ };
@@ -0,0 +1,10 @@
1
+ function r(n) {
2
+ return n !== null && n < -2;
3
+ }
4
+ function t(n) {
5
+ return n === -2 || n === -1 || n === 32;
6
+ }
7
+ export {
8
+ r as markdownLineEnding,
9
+ t as markdownSpace
10
+ };
@@ -0,0 +1,83 @@
1
+ var S = Object.defineProperty, T = Object.defineProperties;
2
+ var k = Object.getOwnPropertyDescriptors;
3
+ var y = Object.getOwnPropertySymbols;
4
+ var K = Object.prototype.hasOwnProperty, v = Object.prototype.propertyIsEnumerable;
5
+ var x = (r, t, e) => t in r ? S(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e, h = (r, t) => {
6
+ for (var e in t || (t = {}))
7
+ K.call(t, e) && x(r, e, t[e]);
8
+ if (y)
9
+ for (var e of y(t))
10
+ v.call(t, e) && x(r, e, t[e]);
11
+ return r;
12
+ }, u = (r, t) => T(r, k(t));
13
+ import { fromHtmlIsomorphic as A } from "../../hast-util-from-html-isomorphic/lib/browser.mjs";
14
+ import N from "../../katex/dist/katex.mjs";
15
+ import { visitParents as E, SKIP as M } from "../../unist-util-visit-parents/lib/index.mjs";
16
+ import { toText as P } from "../../hast-util-to-text/lib/index.mjs";
17
+ const D = {}, H = [];
18
+ function B(r) {
19
+ const t = r || D;
20
+ return function(e, w) {
21
+ E(e, "element", function(n, a) {
22
+ const i = Array.isArray(n.properties.className) ? n.properties.className : H, d = i.includes("language-math"), f = i.includes("math-display"), C = i.includes("math-inline");
23
+ let c = f;
24
+ if (!d && !f && !C)
25
+ return;
26
+ let o = a[a.length - 1], l = n;
27
+ if (n.tagName === "code" && d && o && o.type === "element" && o.tagName === "pre" && (l = o, o = a[a.length - 2], c = !0), !o)
28
+ return;
29
+ const p = P(l, {
30
+ whitespace: "pre"
31
+ });
32
+ let s;
33
+ try {
34
+ s = N.renderToString(p, u(h({}, t), {
35
+ displayMode: c,
36
+ throwOnError: !0
37
+ }));
38
+ } catch (m) {
39
+ const g = (
40
+ /** @type {Error} */
41
+ m
42
+ ), O = g.name.toLowerCase();
43
+ w.message("Could not render math with KaTeX", {
44
+ ancestors: [...a, n],
45
+ cause: g,
46
+ place: n.position,
47
+ ruleId: O,
48
+ source: "rehype-katex"
49
+ });
50
+ try {
51
+ s = N.renderToString(p, u(h({}, t), {
52
+ displayMode: c,
53
+ strict: "ignore",
54
+ throwOnError: !1
55
+ }));
56
+ } catch (L) {
57
+ s = [{
58
+ type: "element",
59
+ tagName: "span",
60
+ properties: {
61
+ className: ["katex-error"],
62
+ style: "color:" + (t.errorColor || "#cc0000"),
63
+ title: String(m)
64
+ },
65
+ children: [{
66
+ type: "text",
67
+ value: p
68
+ }]
69
+ }];
70
+ }
71
+ }
72
+ typeof s == "string" && (s = /** @type {Array<ElementContent>} */
73
+ A(s, {
74
+ fragment: !0
75
+ }).children);
76
+ const I = o.children.indexOf(l);
77
+ return o.children.splice(I, 1, ...s), M;
78
+ });
79
+ };
80
+ }
81
+ export {
82
+ B as default
83
+ };
@@ -0,0 +1,13 @@
1
+ import { math as i } from "../../micromark-extension-math/lib/syntax.mjs";
2
+ import { mathFromMarkdown as e, mathToMarkdown as k } from "../../mdast-util-math/lib/index.mjs";
3
+ const c = {};
4
+ function E(t) {
5
+ const s = (
6
+ /** @type {Processor} */
7
+ this
8
+ ), n = t || c, o = s.data(), r = o.micromarkExtensions || (o.micromarkExtensions = []), a = o.fromMarkdownExtensions || (o.fromMarkdownExtensions = []), m = o.toMarkdownExtensions || (o.toMarkdownExtensions = []);
9
+ r.push(i(n)), a.push(e()), m.push(k(n));
10
+ }
11
+ export {
12
+ E as default
13
+ };
@@ -0,0 +1,7 @@
1
+ function r(n) {
2
+ const t = String(n || "").trim();
3
+ return t ? t.split(/[ \t\n\r\f]+/g) : [];
4
+ }
5
+ export {
6
+ r as parse
7
+ };
@@ -0,0 +1,32 @@
1
+ import { convert as t } from "../../unist-util-is/lib/index.mjs";
2
+ const f = (
3
+ // Note: overloads like this are needed to support optional generics.
4
+ /**
5
+ * @type {(
6
+ * (<Kind extends UnistParent, Check extends Test>(parent: Kind, index: Child<Kind> | number, test: Check) => Matches<Child<Kind>, Check> | undefined) &
7
+ * (<Kind extends UnistParent>(parent: Kind, index: Child<Kind> | number, test?: null | undefined) => Child<Kind> | undefined)
8
+ * )}
9
+ */
10
+ /**
11
+ * @param {UnistParent} parent
12
+ * @param {UnistNode | number} index
13
+ * @param {Test} [test]
14
+ * @returns {UnistNode | undefined}
15
+ */
16
+ function(e, r, o) {
17
+ const i = t(o);
18
+ if (!e || !e.type || !e.children)
19
+ throw new Error("Expected parent node");
20
+ if (typeof r == "number") {
21
+ if (r < 0 || r === Number.POSITIVE_INFINITY)
22
+ throw new Error("Expected positive finite number as index");
23
+ } else if (r = e.children.indexOf(r), r < 0)
24
+ throw new Error("Expected child node or index");
25
+ for (; ++r < e.children.length; )
26
+ if (i(e.children[r], r, e))
27
+ return e.children[r];
28
+ }
29
+ );
30
+ export {
31
+ f as findAfter
32
+ };
@@ -0,0 +1,81 @@
1
+ const i = (
2
+ // Note: overloads in JSDoc can’t yet use different `@template`s.
3
+ /**
4
+ * @type {(
5
+ * (<Condition extends string>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition}) &
6
+ * (<Condition extends Props>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Condition) &
7
+ * (<Condition extends TestFunction>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Predicate<Condition, Node>) &
8
+ * ((test?: null | undefined) => (node?: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node) &
9
+ * ((test?: Test) => Check)
10
+ * )}
11
+ */
12
+ /**
13
+ * @param {Test} [test]
14
+ * @returns {Check}
15
+ */
16
+ function(n) {
17
+ if (n == null)
18
+ return p;
19
+ if (typeof n == "function")
20
+ return c(n);
21
+ if (typeof n == "object")
22
+ return Array.isArray(n) ? f(n) : y(n);
23
+ if (typeof n == "string")
24
+ return l(n);
25
+ throw new Error("Expected function, string, or object as test");
26
+ }
27
+ );
28
+ function f(n) {
29
+ const e = [];
30
+ let r = -1;
31
+ for (; ++r < n.length; )
32
+ e[r] = i(n[r]);
33
+ return c(t);
34
+ function t(...u) {
35
+ let o = -1;
36
+ for (; ++o < e.length; )
37
+ if (e[o].apply(this, u))
38
+ return !0;
39
+ return !1;
40
+ }
41
+ }
42
+ function y(n) {
43
+ const e = (
44
+ /** @type {Record<string, unknown>} */
45
+ n
46
+ );
47
+ return c(r);
48
+ function r(t) {
49
+ const u = (
50
+ /** @type {Record<string, unknown>} */
51
+ /** @type {unknown} */
52
+ t
53
+ );
54
+ let o;
55
+ for (o in n)
56
+ if (u[o] !== e[o])
57
+ return !1;
58
+ return !0;
59
+ }
60
+ }
61
+ function l(n) {
62
+ return c(e);
63
+ function e(r) {
64
+ return r && r.type === n;
65
+ }
66
+ }
67
+ function c(n) {
68
+ return e;
69
+ function e(r, t, u) {
70
+ return !!(a(r) && n.call(this, r, typeof t == "number" ? t : void 0, u || void 0));
71
+ }
72
+ }
73
+ function p() {
74
+ return !0;
75
+ }
76
+ function a(n) {
77
+ return n !== null && typeof n == "object" && "type" in n;
78
+ }
79
+ export {
80
+ i as convert
81
+ };
@@ -0,0 +1,6 @@
1
+ function r(o) {
2
+ return o;
3
+ }
4
+ export {
5
+ r as color
6
+ };
@@ -0,0 +1,56 @@
1
+ import { color as A } from "./color.mjs";
2
+ import { convert as I } from "../../unist-util-is/lib/index.mjs";
3
+ const g = [], j = !0, a = !1, k = "skip";
4
+ function w(t, o, u, s) {
5
+ let p;
6
+ typeof o == "function" && typeof u != "function" ? (s = u, u = o) : p = o;
7
+ const b = I(p), y = s ? -1 : 1;
8
+ m(t, void 0, [])();
9
+ function m(n, N, l) {
10
+ const i = (
11
+ /** @type {Record<string, unknown>} */
12
+ n && typeof n == "object" ? n : {}
13
+ );
14
+ if (typeof i.type == "string") {
15
+ const e = (
16
+ // `hast`
17
+ typeof i.tagName == "string" ? i.tagName : (
18
+ // `xast`
19
+ typeof i.name == "string" ? i.name : void 0
20
+ )
21
+ );
22
+ Object.defineProperty(h, "name", {
23
+ value: "node (" + A(n.type + (e ? "<" + e + ">" : "")) + ")"
24
+ });
25
+ }
26
+ return h;
27
+ function h() {
28
+ let e = g, f, r, d;
29
+ if ((!o || b(n, N, l[l.length - 1] || void 0)) && (e = E(u(n, l)), e[0] === a))
30
+ return e;
31
+ if ("children" in n && n.children) {
32
+ const c = (
33
+ /** @type {UnistParent} */
34
+ n
35
+ );
36
+ if (c.children && e[0] !== k)
37
+ for (r = (s ? c.children.length : -1) + y, d = l.concat(c); r > -1 && r < c.children.length; ) {
38
+ const P = c.children[r];
39
+ if (f = m(P, r, d)(), f[0] === a)
40
+ return f;
41
+ r = typeof f[1] == "number" ? f[1] : r + y;
42
+ }
43
+ }
44
+ return e;
45
+ }
46
+ }
47
+ }
48
+ function E(t) {
49
+ return Array.isArray(t) ? t : typeof t == "number" ? [j, t] : t == null ? g : [t];
50
+ }
51
+ export {
52
+ j as CONTINUE,
53
+ a as EXIT,
54
+ k as SKIP,
55
+ w as visitParents
56
+ };
@@ -0,0 +1,11 @@
1
+ const w = {
2
+ html: "http://www.w3.org/1999/xhtml",
3
+ mathml: "http://www.w3.org/1998/Math/MathML",
4
+ svg: "http://www.w3.org/2000/svg",
5
+ xlink: "http://www.w3.org/1999/xlink",
6
+ xml: "http://www.w3.org/XML/1998/namespace",
7
+ xmlns: "http://www.w3.org/2000/xmlns/"
8
+ };
9
+ export {
10
+ w as webNamespaces
11
+ };