llms-py 3.0.0__py3-none-any.whl → 3.0.0b2__py3-none-any.whl

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 (195) hide show
  1. llms/__pycache__/main.cpython-314.pyc +0 -0
  2. llms/index.html +37 -26
  3. llms/llms.json +21 -70
  4. llms/main.py +731 -1426
  5. llms/providers.json +1 -1
  6. llms/{extensions/analytics/ui/index.mjs → ui/Analytics.mjs} +238 -154
  7. llms/ui/App.mjs +63 -133
  8. llms/ui/Avatar.mjs +86 -0
  9. llms/ui/Brand.mjs +52 -0
  10. llms/ui/ChatPrompt.mjs +597 -0
  11. llms/ui/Main.mjs +862 -0
  12. llms/ui/OAuthSignIn.mjs +61 -0
  13. llms/ui/ProviderIcon.mjs +36 -0
  14. llms/ui/ProviderStatus.mjs +104 -0
  15. llms/{extensions/app/ui → ui}/Recents.mjs +57 -82
  16. llms/ui/{modules/chat/SettingsDialog.mjs → SettingsDialog.mjs} +9 -9
  17. llms/{extensions/app/ui/index.mjs → ui/Sidebar.mjs} +57 -122
  18. llms/ui/SignIn.mjs +65 -0
  19. llms/ui/Welcome.mjs +8 -0
  20. llms/ui/ai.mjs +13 -117
  21. llms/ui/app.css +49 -1776
  22. llms/ui/index.mjs +171 -87
  23. llms/ui/lib/charts.mjs +13 -9
  24. llms/ui/lib/servicestack-vue.mjs +3 -3
  25. llms/ui/lib/vue.min.mjs +9 -10
  26. llms/ui/lib/vue.mjs +1602 -1763
  27. llms/ui/markdown.mjs +2 -10
  28. llms/ui/model-selector.mjs +686 -0
  29. llms/ui/tailwind.input.css +1 -55
  30. llms/ui/threadStore.mjs +583 -0
  31. llms/ui/utils.mjs +118 -113
  32. llms/ui.json +1069 -0
  33. {llms_py-3.0.0.dist-info → llms_py-3.0.0b2.dist-info}/METADATA +1 -1
  34. llms_py-3.0.0b2.dist-info/RECORD +58 -0
  35. llms/extensions/app/README.md +0 -20
  36. llms/extensions/app/__init__.py +0 -530
  37. llms/extensions/app/__pycache__/__init__.cpython-314.pyc +0 -0
  38. llms/extensions/app/__pycache__/db.cpython-314.pyc +0 -0
  39. llms/extensions/app/__pycache__/db_manager.cpython-314.pyc +0 -0
  40. llms/extensions/app/db.py +0 -644
  41. llms/extensions/app/db_manager.py +0 -195
  42. llms/extensions/app/requests.json +0 -9073
  43. llms/extensions/app/threads.json +0 -15290
  44. llms/extensions/app/ui/threadStore.mjs +0 -411
  45. llms/extensions/core_tools/CALCULATOR.md +0 -32
  46. llms/extensions/core_tools/__init__.py +0 -598
  47. llms/extensions/core_tools/__pycache__/__init__.cpython-314.pyc +0 -0
  48. llms/extensions/core_tools/ui/codemirror/addon/edit/closebrackets.js +0 -201
  49. llms/extensions/core_tools/ui/codemirror/addon/edit/closetag.js +0 -185
  50. llms/extensions/core_tools/ui/codemirror/addon/edit/continuelist.js +0 -101
  51. llms/extensions/core_tools/ui/codemirror/addon/edit/matchbrackets.js +0 -160
  52. llms/extensions/core_tools/ui/codemirror/addon/edit/matchtags.js +0 -66
  53. llms/extensions/core_tools/ui/codemirror/addon/edit/trailingspace.js +0 -27
  54. llms/extensions/core_tools/ui/codemirror/addon/selection/active-line.js +0 -72
  55. llms/extensions/core_tools/ui/codemirror/addon/selection/mark-selection.js +0 -119
  56. llms/extensions/core_tools/ui/codemirror/addon/selection/selection-pointer.js +0 -98
  57. llms/extensions/core_tools/ui/codemirror/doc/docs.css +0 -225
  58. llms/extensions/core_tools/ui/codemirror/doc/source_sans.woff +0 -0
  59. llms/extensions/core_tools/ui/codemirror/lib/codemirror.css +0 -344
  60. llms/extensions/core_tools/ui/codemirror/lib/codemirror.js +0 -9884
  61. llms/extensions/core_tools/ui/codemirror/mode/clike/clike.js +0 -942
  62. llms/extensions/core_tools/ui/codemirror/mode/javascript/index.html +0 -118
  63. llms/extensions/core_tools/ui/codemirror/mode/javascript/javascript.js +0 -962
  64. llms/extensions/core_tools/ui/codemirror/mode/javascript/typescript.html +0 -62
  65. llms/extensions/core_tools/ui/codemirror/mode/python/python.js +0 -402
  66. llms/extensions/core_tools/ui/codemirror/theme/dracula.css +0 -40
  67. llms/extensions/core_tools/ui/codemirror/theme/mocha.css +0 -135
  68. llms/extensions/core_tools/ui/index.mjs +0 -650
  69. llms/extensions/gallery/README.md +0 -61
  70. llms/extensions/gallery/__init__.py +0 -61
  71. llms/extensions/gallery/__pycache__/__init__.cpython-314.pyc +0 -0
  72. llms/extensions/gallery/__pycache__/db.cpython-314.pyc +0 -0
  73. llms/extensions/gallery/db.py +0 -298
  74. llms/extensions/gallery/ui/index.mjs +0 -482
  75. llms/extensions/katex/README.md +0 -39
  76. llms/extensions/katex/__init__.py +0 -6
  77. llms/extensions/katex/__pycache__/__init__.cpython-314.pyc +0 -0
  78. llms/extensions/katex/ui/README.md +0 -125
  79. llms/extensions/katex/ui/contrib/auto-render.js +0 -338
  80. llms/extensions/katex/ui/contrib/auto-render.min.js +0 -1
  81. llms/extensions/katex/ui/contrib/auto-render.mjs +0 -244
  82. llms/extensions/katex/ui/contrib/copy-tex.js +0 -127
  83. llms/extensions/katex/ui/contrib/copy-tex.min.js +0 -1
  84. llms/extensions/katex/ui/contrib/copy-tex.mjs +0 -105
  85. llms/extensions/katex/ui/contrib/mathtex-script-type.js +0 -109
  86. llms/extensions/katex/ui/contrib/mathtex-script-type.min.js +0 -1
  87. llms/extensions/katex/ui/contrib/mathtex-script-type.mjs +0 -24
  88. llms/extensions/katex/ui/contrib/mhchem.js +0 -3213
  89. llms/extensions/katex/ui/contrib/mhchem.min.js +0 -1
  90. llms/extensions/katex/ui/contrib/mhchem.mjs +0 -3109
  91. llms/extensions/katex/ui/contrib/render-a11y-string.js +0 -887
  92. llms/extensions/katex/ui/contrib/render-a11y-string.min.js +0 -1
  93. llms/extensions/katex/ui/contrib/render-a11y-string.mjs +0 -800
  94. llms/extensions/katex/ui/fonts/KaTeX_AMS-Regular.ttf +0 -0
  95. llms/extensions/katex/ui/fonts/KaTeX_AMS-Regular.woff +0 -0
  96. llms/extensions/katex/ui/fonts/KaTeX_AMS-Regular.woff2 +0 -0
  97. llms/extensions/katex/ui/fonts/KaTeX_Caligraphic-Bold.ttf +0 -0
  98. llms/extensions/katex/ui/fonts/KaTeX_Caligraphic-Bold.woff +0 -0
  99. llms/extensions/katex/ui/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
  100. llms/extensions/katex/ui/fonts/KaTeX_Caligraphic-Regular.ttf +0 -0
  101. llms/extensions/katex/ui/fonts/KaTeX_Caligraphic-Regular.woff +0 -0
  102. llms/extensions/katex/ui/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
  103. llms/extensions/katex/ui/fonts/KaTeX_Fraktur-Bold.ttf +0 -0
  104. llms/extensions/katex/ui/fonts/KaTeX_Fraktur-Bold.woff +0 -0
  105. llms/extensions/katex/ui/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
  106. llms/extensions/katex/ui/fonts/KaTeX_Fraktur-Regular.ttf +0 -0
  107. llms/extensions/katex/ui/fonts/KaTeX_Fraktur-Regular.woff +0 -0
  108. llms/extensions/katex/ui/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
  109. llms/extensions/katex/ui/fonts/KaTeX_Main-Bold.ttf +0 -0
  110. llms/extensions/katex/ui/fonts/KaTeX_Main-Bold.woff +0 -0
  111. llms/extensions/katex/ui/fonts/KaTeX_Main-Bold.woff2 +0 -0
  112. llms/extensions/katex/ui/fonts/KaTeX_Main-BoldItalic.ttf +0 -0
  113. llms/extensions/katex/ui/fonts/KaTeX_Main-BoldItalic.woff +0 -0
  114. llms/extensions/katex/ui/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
  115. llms/extensions/katex/ui/fonts/KaTeX_Main-Italic.ttf +0 -0
  116. llms/extensions/katex/ui/fonts/KaTeX_Main-Italic.woff +0 -0
  117. llms/extensions/katex/ui/fonts/KaTeX_Main-Italic.woff2 +0 -0
  118. llms/extensions/katex/ui/fonts/KaTeX_Main-Regular.ttf +0 -0
  119. llms/extensions/katex/ui/fonts/KaTeX_Main-Regular.woff +0 -0
  120. llms/extensions/katex/ui/fonts/KaTeX_Main-Regular.woff2 +0 -0
  121. llms/extensions/katex/ui/fonts/KaTeX_Math-BoldItalic.ttf +0 -0
  122. llms/extensions/katex/ui/fonts/KaTeX_Math-BoldItalic.woff +0 -0
  123. llms/extensions/katex/ui/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
  124. llms/extensions/katex/ui/fonts/KaTeX_Math-Italic.ttf +0 -0
  125. llms/extensions/katex/ui/fonts/KaTeX_Math-Italic.woff +0 -0
  126. llms/extensions/katex/ui/fonts/KaTeX_Math-Italic.woff2 +0 -0
  127. llms/extensions/katex/ui/fonts/KaTeX_SansSerif-Bold.ttf +0 -0
  128. llms/extensions/katex/ui/fonts/KaTeX_SansSerif-Bold.woff +0 -0
  129. llms/extensions/katex/ui/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
  130. llms/extensions/katex/ui/fonts/KaTeX_SansSerif-Italic.ttf +0 -0
  131. llms/extensions/katex/ui/fonts/KaTeX_SansSerif-Italic.woff +0 -0
  132. llms/extensions/katex/ui/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
  133. llms/extensions/katex/ui/fonts/KaTeX_SansSerif-Regular.ttf +0 -0
  134. llms/extensions/katex/ui/fonts/KaTeX_SansSerif-Regular.woff +0 -0
  135. llms/extensions/katex/ui/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
  136. llms/extensions/katex/ui/fonts/KaTeX_Script-Regular.ttf +0 -0
  137. llms/extensions/katex/ui/fonts/KaTeX_Script-Regular.woff +0 -0
  138. llms/extensions/katex/ui/fonts/KaTeX_Script-Regular.woff2 +0 -0
  139. llms/extensions/katex/ui/fonts/KaTeX_Size1-Regular.ttf +0 -0
  140. llms/extensions/katex/ui/fonts/KaTeX_Size1-Regular.woff +0 -0
  141. llms/extensions/katex/ui/fonts/KaTeX_Size1-Regular.woff2 +0 -0
  142. llms/extensions/katex/ui/fonts/KaTeX_Size2-Regular.ttf +0 -0
  143. llms/extensions/katex/ui/fonts/KaTeX_Size2-Regular.woff +0 -0
  144. llms/extensions/katex/ui/fonts/KaTeX_Size2-Regular.woff2 +0 -0
  145. llms/extensions/katex/ui/fonts/KaTeX_Size3-Regular.ttf +0 -0
  146. llms/extensions/katex/ui/fonts/KaTeX_Size3-Regular.woff +0 -0
  147. llms/extensions/katex/ui/fonts/KaTeX_Size3-Regular.woff2 +0 -0
  148. llms/extensions/katex/ui/fonts/KaTeX_Size4-Regular.ttf +0 -0
  149. llms/extensions/katex/ui/fonts/KaTeX_Size4-Regular.woff +0 -0
  150. llms/extensions/katex/ui/fonts/KaTeX_Size4-Regular.woff2 +0 -0
  151. llms/extensions/katex/ui/fonts/KaTeX_Typewriter-Regular.ttf +0 -0
  152. llms/extensions/katex/ui/fonts/KaTeX_Typewriter-Regular.woff +0 -0
  153. llms/extensions/katex/ui/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
  154. llms/extensions/katex/ui/index.mjs +0 -92
  155. llms/extensions/katex/ui/katex-swap.css +0 -1230
  156. llms/extensions/katex/ui/katex-swap.min.css +0 -1
  157. llms/extensions/katex/ui/katex.css +0 -1230
  158. llms/extensions/katex/ui/katex.js +0 -19080
  159. llms/extensions/katex/ui/katex.min.css +0 -1
  160. llms/extensions/katex/ui/katex.min.js +0 -1
  161. llms/extensions/katex/ui/katex.min.mjs +0 -1
  162. llms/extensions/katex/ui/katex.mjs +0 -18547
  163. llms/extensions/providers/__init__.py +0 -18
  164. llms/extensions/providers/__pycache__/__init__.cpython-314.pyc +0 -0
  165. llms/extensions/providers/__pycache__/anthropic.cpython-314.pyc +0 -0
  166. llms/extensions/providers/__pycache__/chutes.cpython-314.pyc +0 -0
  167. llms/extensions/providers/__pycache__/google.cpython-314.pyc +0 -0
  168. llms/extensions/providers/__pycache__/nvidia.cpython-314.pyc +0 -0
  169. llms/extensions/providers/__pycache__/openai.cpython-314.pyc +0 -0
  170. llms/extensions/providers/__pycache__/openrouter.cpython-314.pyc +0 -0
  171. llms/extensions/providers/anthropic.py +0 -229
  172. llms/extensions/providers/chutes.py +0 -155
  173. llms/extensions/providers/google.py +0 -378
  174. llms/extensions/providers/nvidia.py +0 -105
  175. llms/extensions/providers/openai.py +0 -156
  176. llms/extensions/providers/openrouter.py +0 -72
  177. llms/extensions/system_prompts/README.md +0 -22
  178. llms/extensions/system_prompts/__init__.py +0 -45
  179. llms/extensions/system_prompts/__pycache__/__init__.cpython-314.pyc +0 -0
  180. llms/extensions/system_prompts/ui/index.mjs +0 -280
  181. llms/extensions/system_prompts/ui/prompts.json +0 -1067
  182. llms/extensions/tools/__init__.py +0 -5
  183. llms/extensions/tools/__pycache__/__init__.cpython-314.pyc +0 -0
  184. llms/extensions/tools/ui/index.mjs +0 -204
  185. llms/providers-extra.json +0 -356
  186. llms/ui/ctx.mjs +0 -365
  187. llms/ui/modules/chat/ChatBody.mjs +0 -691
  188. llms/ui/modules/chat/index.mjs +0 -828
  189. llms/ui/modules/layout.mjs +0 -243
  190. llms/ui/modules/model-selector.mjs +0 -851
  191. llms_py-3.0.0.dist-info/RECORD +0 -202
  192. {llms_py-3.0.0.dist-info → llms_py-3.0.0b2.dist-info}/WHEEL +0 -0
  193. {llms_py-3.0.0.dist-info → llms_py-3.0.0b2.dist-info}/entry_points.txt +0 -0
  194. {llms_py-3.0.0.dist-info → llms_py-3.0.0b2.dist-info}/licenses/LICENSE +0 -0
  195. {llms_py-3.0.0.dist-info → llms_py-3.0.0b2.dist-info}/top_level.txt +0 -0
@@ -1,244 +0,0 @@
1
- import katex from '../katex.mjs';
2
-
3
- /* eslint no-constant-condition:0 */
4
- var findEndOfMath = function findEndOfMath(delimiter, text, startIndex) {
5
- // Adapted from
6
- // https://github.com/Khan/perseus/blob/master/src/perseus-markdown.jsx
7
- var index = startIndex;
8
- var braceLevel = 0;
9
- var delimLength = delimiter.length;
10
-
11
- while (index < text.length) {
12
- var character = text[index];
13
-
14
- if (braceLevel <= 0 && text.slice(index, index + delimLength) === delimiter) {
15
- return index;
16
- } else if (character === "\\") {
17
- index++;
18
- } else if (character === "{") {
19
- braceLevel++;
20
- } else if (character === "}") {
21
- braceLevel--;
22
- }
23
-
24
- index++;
25
- }
26
-
27
- return -1;
28
- };
29
-
30
- var escapeRegex = function escapeRegex(string) {
31
- return string.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
32
- };
33
-
34
- var amsRegex = /^\\begin{/;
35
-
36
- var splitAtDelimiters = function splitAtDelimiters(text, delimiters) {
37
- var index;
38
- var data = [];
39
- var regexLeft = new RegExp("(" + delimiters.map(x => escapeRegex(x.left)).join("|") + ")");
40
-
41
- while (true) {
42
- index = text.search(regexLeft);
43
-
44
- if (index === -1) {
45
- break;
46
- }
47
-
48
- if (index > 0) {
49
- data.push({
50
- type: "text",
51
- data: text.slice(0, index)
52
- });
53
- text = text.slice(index); // now text starts with delimiter
54
- } // ... so this always succeeds:
55
-
56
-
57
- var i = delimiters.findIndex(delim => text.startsWith(delim.left));
58
- index = findEndOfMath(delimiters[i].right, text, delimiters[i].left.length);
59
-
60
- if (index === -1) {
61
- break;
62
- }
63
-
64
- var rawData = text.slice(0, index + delimiters[i].right.length);
65
- var math = amsRegex.test(rawData) ? rawData : text.slice(delimiters[i].left.length, index);
66
- data.push({
67
- type: "math",
68
- data: math,
69
- rawData,
70
- display: delimiters[i].display
71
- });
72
- text = text.slice(index + delimiters[i].right.length);
73
- }
74
-
75
- if (text !== "") {
76
- data.push({
77
- type: "text",
78
- data: text
79
- });
80
- }
81
-
82
- return data;
83
- };
84
-
85
- /* eslint no-console:0 */
86
- /* Note: optionsCopy is mutated by this method. If it is ever exposed in the
87
- * API, we should copy it before mutating.
88
- */
89
-
90
- var renderMathInText = function renderMathInText(text, optionsCopy) {
91
- var data = splitAtDelimiters(text, optionsCopy.delimiters);
92
-
93
- if (data.length === 1 && data[0].type === 'text') {
94
- // There is no formula in the text.
95
- // Let's return null which means there is no need to replace
96
- // the current text node with a new one.
97
- return null;
98
- }
99
-
100
- var fragment = document.createDocumentFragment();
101
-
102
- for (var i = 0; i < data.length; i++) {
103
- if (data[i].type === "text") {
104
- fragment.appendChild(document.createTextNode(data[i].data));
105
- } else {
106
- var span = document.createElement("span");
107
- var math = data[i].data; // Override any display mode defined in the settings with that
108
- // defined by the text itself
109
-
110
- optionsCopy.displayMode = data[i].display;
111
-
112
- try {
113
- if (optionsCopy.preProcess) {
114
- math = optionsCopy.preProcess(math);
115
- }
116
-
117
- katex.render(math, span, optionsCopy);
118
- } catch (e) {
119
- if (!(e instanceof katex.ParseError)) {
120
- throw e;
121
- }
122
-
123
- optionsCopy.errorCallback("KaTeX auto-render: Failed to parse `" + data[i].data + "` with ", e);
124
- fragment.appendChild(document.createTextNode(data[i].rawData));
125
- continue;
126
- }
127
-
128
- fragment.appendChild(span);
129
- }
130
- }
131
-
132
- return fragment;
133
- };
134
-
135
- var renderElem = function renderElem(elem, optionsCopy) {
136
- for (var i = 0; i < elem.childNodes.length; i++) {
137
- var childNode = elem.childNodes[i];
138
-
139
- if (childNode.nodeType === 3) {
140
- // Text node
141
- // Concatenate all sibling text nodes.
142
- // Webkit browsers split very large text nodes into smaller ones,
143
- // so the delimiters may be split across different nodes.
144
- var textContentConcat = childNode.textContent;
145
- var sibling = childNode.nextSibling;
146
- var nSiblings = 0;
147
-
148
- while (sibling && sibling.nodeType === Node.TEXT_NODE) {
149
- textContentConcat += sibling.textContent;
150
- sibling = sibling.nextSibling;
151
- nSiblings++;
152
- }
153
-
154
- var frag = renderMathInText(textContentConcat, optionsCopy);
155
-
156
- if (frag) {
157
- // Remove extra text nodes
158
- for (var j = 0; j < nSiblings; j++) {
159
- childNode.nextSibling.remove();
160
- }
161
-
162
- i += frag.childNodes.length - 1;
163
- elem.replaceChild(frag, childNode);
164
- } else {
165
- // If the concatenated text does not contain math
166
- // the siblings will not either
167
- i += nSiblings;
168
- }
169
- } else if (childNode.nodeType === 1) {
170
- (function () {
171
- // Element node
172
- var className = ' ' + childNode.className + ' ';
173
- var shouldRender = optionsCopy.ignoredTags.indexOf(childNode.nodeName.toLowerCase()) === -1 && optionsCopy.ignoredClasses.every(x => className.indexOf(' ' + x + ' ') === -1);
174
-
175
- if (shouldRender) {
176
- renderElem(childNode, optionsCopy);
177
- }
178
- })();
179
- } // Otherwise, it's something else, and ignore it.
180
-
181
- }
182
- };
183
-
184
- var renderMathInElement = function renderMathInElement(elem, options) {
185
- if (!elem) {
186
- throw new Error("No element provided to render");
187
- }
188
-
189
- var optionsCopy = {}; // Object.assign(optionsCopy, option)
190
-
191
- for (var option in options) {
192
- if (options.hasOwnProperty(option)) {
193
- optionsCopy[option] = options[option];
194
- }
195
- } // default options
196
-
197
-
198
- optionsCopy.delimiters = optionsCopy.delimiters || [{
199
- left: "$$",
200
- right: "$$",
201
- display: true
202
- }, {
203
- left: "\\(",
204
- right: "\\)",
205
- display: false
206
- }, // LaTeX uses $…$, but it ruins the display of normal `$` in text:
207
- // {left: "$", right: "$", display: false},
208
- // $ must come after $$
209
- // Render AMS environments even if outside $$…$$ delimiters.
210
- {
211
- left: "\\begin{equation}",
212
- right: "\\end{equation}",
213
- display: true
214
- }, {
215
- left: "\\begin{align}",
216
- right: "\\end{align}",
217
- display: true
218
- }, {
219
- left: "\\begin{alignat}",
220
- right: "\\end{alignat}",
221
- display: true
222
- }, {
223
- left: "\\begin{gather}",
224
- right: "\\end{gather}",
225
- display: true
226
- }, {
227
- left: "\\begin{CD}",
228
- right: "\\end{CD}",
229
- display: true
230
- }, {
231
- left: "\\[",
232
- right: "\\]",
233
- display: true
234
- }];
235
- optionsCopy.ignoredTags = optionsCopy.ignoredTags || ["script", "noscript", "style", "textarea", "pre", "code", "option"];
236
- optionsCopy.ignoredClasses = optionsCopy.ignoredClasses || [];
237
- optionsCopy.errorCallback = optionsCopy.errorCallback || console.error; // Enable sharing of global macros defined via `\gdef` between different
238
- // math elements within a single call to `renderMathInElement`.
239
-
240
- optionsCopy.macros = optionsCopy.macros || {};
241
- renderElem(elem, optionsCopy);
242
- };
243
-
244
- export { renderMathInElement as default };
@@ -1,127 +0,0 @@
1
- (function webpackUniversalModuleDefinition(root, factory) {
2
- if(typeof exports === 'object' && typeof module === 'object')
3
- module.exports = factory();
4
- else if(typeof define === 'function' && define.amd)
5
- define([], factory);
6
- else {
7
- var a = factory();
8
- for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
9
- }
10
- })((typeof self !== 'undefined' ? self : this), function() {
11
- return /******/ (function() { // webpackBootstrap
12
- /******/ "use strict";
13
- var __webpack_exports__ = {};
14
-
15
- ;// CONCATENATED MODULE: ./contrib/copy-tex/katex2tex.js
16
- // Set these to how you want inline and display math to be delimited.
17
- const defaultCopyDelimiters = {
18
- inline: ['$', '$'],
19
- // alternative: ['\(', '\)']
20
- display: ['$$', '$$'] // alternative: ['\[', '\]']
21
-
22
- }; // Replace .katex elements with their TeX source (<annotation> element).
23
- // Modifies fragment in-place. Useful for writing your own 'copy' handler,
24
- // as in copy-tex.js.
25
-
26
- function katexReplaceWithTex(fragment, copyDelimiters) {
27
- if (copyDelimiters === void 0) {
28
- copyDelimiters = defaultCopyDelimiters;
29
- }
30
-
31
- // Remove .katex-html blocks that are preceded by .katex-mathml blocks
32
- // (which will get replaced below).
33
- const katexHtml = fragment.querySelectorAll('.katex-mathml + .katex-html');
34
-
35
- for (let i = 0; i < katexHtml.length; i++) {
36
- const element = katexHtml[i];
37
-
38
- if (element.remove) {
39
- element.remove();
40
- } else if (element.parentNode) {
41
- element.parentNode.removeChild(element);
42
- }
43
- } // Replace .katex-mathml elements with their annotation (TeX source)
44
- // descendant, with inline delimiters.
45
-
46
-
47
- const katexMathml = fragment.querySelectorAll('.katex-mathml');
48
-
49
- for (let i = 0; i < katexMathml.length; i++) {
50
- const element = katexMathml[i];
51
- const texSource = element.querySelector('annotation');
52
-
53
- if (texSource) {
54
- if (element.replaceWith) {
55
- element.replaceWith(texSource);
56
- } else if (element.parentNode) {
57
- element.parentNode.replaceChild(texSource, element);
58
- }
59
-
60
- texSource.innerHTML = copyDelimiters.inline[0] + texSource.innerHTML + copyDelimiters.inline[1];
61
- }
62
- } // Switch display math to display delimiters.
63
-
64
-
65
- const displays = fragment.querySelectorAll('.katex-display annotation');
66
-
67
- for (let i = 0; i < displays.length; i++) {
68
- const element = displays[i];
69
- element.innerHTML = copyDelimiters.display[0] + element.innerHTML.substr(copyDelimiters.inline[0].length, element.innerHTML.length - copyDelimiters.inline[0].length - copyDelimiters.inline[1].length) + copyDelimiters.display[1];
70
- }
71
-
72
- return fragment;
73
- }
74
- /* harmony default export */ var katex2tex = (katexReplaceWithTex);
75
- ;// CONCATENATED MODULE: ./contrib/copy-tex/copy-tex.js
76
- // Return <div class="katex"> element containing node, or null if not found.
77
-
78
- function closestKatex(node) {
79
- // If node is a Text Node, for example, go up to containing Element,
80
- // where we can apply the `closest` method.
81
- const element = node instanceof Element ? node : node.parentElement;
82
- return element && element.closest('.katex');
83
- } // Global copy handler to modify behavior on/within .katex elements.
84
-
85
-
86
- document.addEventListener('copy', function (event) {
87
- const selection = window.getSelection();
88
-
89
- if (selection.isCollapsed || !event.clipboardData) {
90
- return; // default action OK if selection is empty or unchangeable
91
- }
92
-
93
- const clipboardData = event.clipboardData;
94
- const range = selection.getRangeAt(0); // When start point is within a formula, expand to entire formula.
95
-
96
- const startKatex = closestKatex(range.startContainer);
97
-
98
- if (startKatex) {
99
- range.setStartBefore(startKatex);
100
- } // Similarly, when end point is within a formula, expand to entire formula.
101
-
102
-
103
- const endKatex = closestKatex(range.endContainer);
104
-
105
- if (endKatex) {
106
- range.setEndAfter(endKatex);
107
- }
108
-
109
- const fragment = range.cloneContents();
110
-
111
- if (!fragment.querySelector('.katex-mathml')) {
112
- return; // default action OK if no .katex-mathml elements
113
- }
114
-
115
- const htmlContents = Array.prototype.map.call(fragment.childNodes, el => el instanceof Text ? el.textContent : el.outerHTML).join(''); // Preserve usual HTML copy/paste behavior.
116
-
117
- clipboardData.setData('text/html', htmlContents); // Rewrite plain-text version.
118
-
119
- clipboardData.setData('text/plain', katex2tex(fragment).textContent); // Prevent normal copy handling.
120
-
121
- event.preventDefault();
122
- });
123
- __webpack_exports__ = __webpack_exports__["default"];
124
- /******/ return __webpack_exports__;
125
- /******/ })()
126
- ;
127
- });
@@ -1 +0,0 @@
1
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var o in n)("object"==typeof exports?exports:e)[o]=n[o]}}("undefined"!=typeof self?self:this,(function(){return function(){"use strict";var e={};const t={inline:["$","$"],display:["$$","$$"]};var n=function(e,n){void 0===n&&(n=t);const o=e.querySelectorAll(".katex-mathml + .katex-html");for(let e=0;e<o.length;e++){const t=o[e];t.remove?t.remove():t.parentNode&&t.parentNode.removeChild(t)}const r=e.querySelectorAll(".katex-mathml");for(let e=0;e<r.length;e++){const t=r[e],o=t.querySelector("annotation");o&&(t.replaceWith?t.replaceWith(o):t.parentNode&&t.parentNode.replaceChild(o,t),o.innerHTML=n.inline[0]+o.innerHTML+n.inline[1])}const l=e.querySelectorAll(".katex-display annotation");for(let e=0;e<l.length;e++){const t=l[e];t.innerHTML=n.display[0]+t.innerHTML.substr(n.inline[0].length,t.innerHTML.length-n.inline[0].length-n.inline[1].length)+n.display[1]}return e};function o(e){const t=e instanceof Element?e:e.parentElement;return t&&t.closest(".katex")}return document.addEventListener("copy",(function(e){const t=window.getSelection();if(t.isCollapsed||!e.clipboardData)return;const r=e.clipboardData,l=t.getRangeAt(0),i=o(l.startContainer);i&&l.setStartBefore(i);const a=o(l.endContainer);a&&l.setEndAfter(a);const s=l.cloneContents();if(!s.querySelector(".katex-mathml"))return;const c=Array.prototype.map.call(s.childNodes,(e=>e instanceof Text?e.textContent:e.outerHTML)).join("");r.setData("text/html",c),r.setData("text/plain",n(s).textContent),e.preventDefault()})),e=e.default}()}));
@@ -1,105 +0,0 @@
1
- // Set these to how you want inline and display math to be delimited.
2
- var defaultCopyDelimiters = {
3
- inline: ['$', '$'],
4
- // alternative: ['\(', '\)']
5
- display: ['$$', '$$'] // alternative: ['\[', '\]']
6
-
7
- }; // Replace .katex elements with their TeX source (<annotation> element).
8
- // Modifies fragment in-place. Useful for writing your own 'copy' handler,
9
- // as in copy-tex.js.
10
-
11
- function katexReplaceWithTex(fragment, copyDelimiters) {
12
- if (copyDelimiters === void 0) {
13
- copyDelimiters = defaultCopyDelimiters;
14
- }
15
-
16
- // Remove .katex-html blocks that are preceded by .katex-mathml blocks
17
- // (which will get replaced below).
18
- var katexHtml = fragment.querySelectorAll('.katex-mathml + .katex-html');
19
-
20
- for (var i = 0; i < katexHtml.length; i++) {
21
- var element = katexHtml[i];
22
-
23
- if (element.remove) {
24
- element.remove();
25
- } else if (element.parentNode) {
26
- element.parentNode.removeChild(element);
27
- }
28
- } // Replace .katex-mathml elements with their annotation (TeX source)
29
- // descendant, with inline delimiters.
30
-
31
-
32
- var katexMathml = fragment.querySelectorAll('.katex-mathml');
33
-
34
- for (var _i = 0; _i < katexMathml.length; _i++) {
35
- var _element = katexMathml[_i];
36
-
37
- var texSource = _element.querySelector('annotation');
38
-
39
- if (texSource) {
40
- if (_element.replaceWith) {
41
- _element.replaceWith(texSource);
42
- } else if (_element.parentNode) {
43
- _element.parentNode.replaceChild(texSource, _element);
44
- }
45
-
46
- texSource.innerHTML = copyDelimiters.inline[0] + texSource.innerHTML + copyDelimiters.inline[1];
47
- }
48
- } // Switch display math to display delimiters.
49
-
50
-
51
- var displays = fragment.querySelectorAll('.katex-display annotation');
52
-
53
- for (var _i2 = 0; _i2 < displays.length; _i2++) {
54
- var _element2 = displays[_i2];
55
- _element2.innerHTML = copyDelimiters.display[0] + _element2.innerHTML.substr(copyDelimiters.inline[0].length, _element2.innerHTML.length - copyDelimiters.inline[0].length - copyDelimiters.inline[1].length) + copyDelimiters.display[1];
56
- }
57
-
58
- return fragment;
59
- }
60
-
61
- function closestKatex(node) {
62
- // If node is a Text Node, for example, go up to containing Element,
63
- // where we can apply the `closest` method.
64
- var element = node instanceof Element ? node : node.parentElement;
65
- return element && element.closest('.katex');
66
- } // Global copy handler to modify behavior on/within .katex elements.
67
-
68
-
69
- document.addEventListener('copy', function (event) {
70
- var selection = window.getSelection();
71
-
72
- if (selection.isCollapsed || !event.clipboardData) {
73
- return; // default action OK if selection is empty or unchangeable
74
- }
75
-
76
- var clipboardData = event.clipboardData;
77
- var range = selection.getRangeAt(0); // When start point is within a formula, expand to entire formula.
78
-
79
- var startKatex = closestKatex(range.startContainer);
80
-
81
- if (startKatex) {
82
- range.setStartBefore(startKatex);
83
- } // Similarly, when end point is within a formula, expand to entire formula.
84
-
85
-
86
- var endKatex = closestKatex(range.endContainer);
87
-
88
- if (endKatex) {
89
- range.setEndAfter(endKatex);
90
- }
91
-
92
- var fragment = range.cloneContents();
93
-
94
- if (!fragment.querySelector('.katex-mathml')) {
95
- return; // default action OK if no .katex-mathml elements
96
- }
97
-
98
- var htmlContents = Array.prototype.map.call(fragment.childNodes, el => el instanceof Text ? el.textContent : el.outerHTML).join(''); // Preserve usual HTML copy/paste behavior.
99
-
100
- clipboardData.setData('text/html', htmlContents); // Rewrite plain-text version.
101
-
102
- clipboardData.setData('text/plain', katexReplaceWithTex(fragment).textContent); // Prevent normal copy handling.
103
-
104
- event.preventDefault();
105
- });
@@ -1,109 +0,0 @@
1
- (function webpackUniversalModuleDefinition(root, factory) {
2
- if(typeof exports === 'object' && typeof module === 'object')
3
- module.exports = factory(require("katex"));
4
- else if(typeof define === 'function' && define.amd)
5
- define(["katex"], factory);
6
- else {
7
- var a = typeof exports === 'object' ? factory(require("katex")) : factory(root["katex"]);
8
- for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
9
- }
10
- })((typeof self !== 'undefined' ? self : this), function(__WEBPACK_EXTERNAL_MODULE__757__) {
11
- return /******/ (function() { // webpackBootstrap
12
- /******/ "use strict";
13
- /******/ var __webpack_modules__ = ({
14
-
15
- /***/ 757:
16
- /***/ (function(module) {
17
-
18
- module.exports = __WEBPACK_EXTERNAL_MODULE__757__;
19
-
20
- /***/ })
21
-
22
- /******/ });
23
- /************************************************************************/
24
- /******/ // The module cache
25
- /******/ var __webpack_module_cache__ = {};
26
- /******/
27
- /******/ // The require function
28
- /******/ function __webpack_require__(moduleId) {
29
- /******/ // Check if module is in cache
30
- /******/ var cachedModule = __webpack_module_cache__[moduleId];
31
- /******/ if (cachedModule !== undefined) {
32
- /******/ return cachedModule.exports;
33
- /******/ }
34
- /******/ // Create a new module (and put it into the cache)
35
- /******/ var module = __webpack_module_cache__[moduleId] = {
36
- /******/ // no module.id needed
37
- /******/ // no module.loaded needed
38
- /******/ exports: {}
39
- /******/ };
40
- /******/
41
- /******/ // Execute the module function
42
- /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
43
- /******/
44
- /******/ // Return the exports of the module
45
- /******/ return module.exports;
46
- /******/ }
47
- /******/
48
- /************************************************************************/
49
- /******/ /* webpack/runtime/compat get default export */
50
- /******/ !function() {
51
- /******/ // getDefaultExport function for compatibility with non-harmony modules
52
- /******/ __webpack_require__.n = function(module) {
53
- /******/ var getter = module && module.__esModule ?
54
- /******/ function() { return module['default']; } :
55
- /******/ function() { return module; };
56
- /******/ __webpack_require__.d(getter, { a: getter });
57
- /******/ return getter;
58
- /******/ };
59
- /******/ }();
60
- /******/
61
- /******/ /* webpack/runtime/define property getters */
62
- /******/ !function() {
63
- /******/ // define getter functions for harmony exports
64
- /******/ __webpack_require__.d = function(exports, definition) {
65
- /******/ for(var key in definition) {
66
- /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
67
- /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
68
- /******/ }
69
- /******/ }
70
- /******/ };
71
- /******/ }();
72
- /******/
73
- /******/ /* webpack/runtime/hasOwnProperty shorthand */
74
- /******/ !function() {
75
- /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
76
- /******/ }();
77
- /******/
78
- /************************************************************************/
79
- var __webpack_exports__ = {};
80
- /* harmony import */ var katex__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(757);
81
- /* harmony import */ var katex__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(katex__WEBPACK_IMPORTED_MODULE_0__);
82
-
83
- let scripts = document.body.getElementsByTagName("script");
84
- scripts = Array.prototype.slice.call(scripts);
85
- scripts.forEach(function (script) {
86
- if (!script.type || !script.type.match(/math\/tex/i)) {
87
- return -1;
88
- }
89
-
90
- const display = script.type.match(/mode\s*=\s*display(;|\s|\n|$)/) != null;
91
- const katexElement = document.createElement(display ? "div" : "span");
92
- katexElement.setAttribute("class", display ? "equation" : "inline-equation");
93
-
94
- try {
95
- katex__WEBPACK_IMPORTED_MODULE_0___default().render(script.text, katexElement, {
96
- displayMode: display
97
- });
98
- } catch (err) {
99
- //console.error(err); linter doesn't like this
100
- katexElement.textContent = script.text;
101
- }
102
-
103
- script.parentNode.replaceChild(katexElement, script);
104
- });
105
- __webpack_exports__ = __webpack_exports__["default"];
106
- /******/ return __webpack_exports__;
107
- /******/ })()
108
- ;
109
- });
@@ -1 +0,0 @@
1
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("katex"));else if("function"==typeof define&&define.amd)define(["katex"],t);else{var n="object"==typeof exports?t(require("katex")):t(e.katex);for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}("undefined"!=typeof self?self:this,(function(e){return function(){"use strict";var t={757:function(t){t.exports=e}},n={};function r(e){var o=n[e];if(void 0!==o)return o.exports;var i=n[e]={exports:{}};return t[e](i,i.exports,r),i.exports}r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,{a:t}),t},r.d=function(e,t){for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};var o={},i=r(757),a=r.n(i);let u=document.body.getElementsByTagName("script");return u=Array.prototype.slice.call(u),u.forEach((function(e){if(!e.type||!e.type.match(/math\/tex/i))return-1;const t=null!=e.type.match(/mode\s*=\s*display(;|\s|\n|$)/),n=document.createElement(t?"div":"span");n.setAttribute("class",t?"equation":"inline-equation");try{a().render(e.text,n,{displayMode:t})}catch(t){n.textContent=e.text}e.parentNode.replaceChild(n,e)})),o=o.default}()}));
@@ -1,24 +0,0 @@
1
- import katex from '../katex.mjs';
2
-
3
- var scripts = document.body.getElementsByTagName("script");
4
- scripts = Array.prototype.slice.call(scripts);
5
- scripts.forEach(function (script) {
6
- if (!script.type || !script.type.match(/math\/tex/i)) {
7
- return -1;
8
- }
9
-
10
- var display = script.type.match(/mode\s*=\s*display(;|\s|\n|$)/) != null;
11
- var katexElement = document.createElement(display ? "div" : "span");
12
- katexElement.setAttribute("class", display ? "equation" : "inline-equation");
13
-
14
- try {
15
- katex.render(script.text, katexElement, {
16
- displayMode: display
17
- });
18
- } catch (err) {
19
- //console.error(err); linter doesn't like this
20
- katexElement.textContent = script.text;
21
- }
22
-
23
- script.parentNode.replaceChild(katexElement, script);
24
- });