@apple-pie/slice 0.1.20 → 0.1.22

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 (124) hide show
  1. package/README.md +25 -1
  2. package/dist/cjs/chunks/{Button-DXvjvGtY.js → Button-KGA0e9-0.js} +1 -1
  3. package/dist/cjs/chunks/{ButtonBar-BZ6sme27.js → ButtonBar-RSBwFaU-.js} +1 -1
  4. package/dist/cjs/chunks/{Camera-rVC4KI4v.js → Camera-CLm3aQR8.js} +6 -2
  5. package/dist/cjs/chunks/{CheckBox-DQRLqTAK.js → CheckBox-DDINn56u.js} +1 -1
  6. package/dist/cjs/chunks/{Chip-Pv9-KTnh.js → Chip-DRSg6kLh.js} +1 -1
  7. package/dist/cjs/chunks/{DrggablePanel-CkhCXqKv.js → DrggablePanel-CERavfv3.js} +6 -2
  8. package/dist/cjs/chunks/{DropDown-C3AZ5b_b.js → DropDown-CJH-Y6Z5.js} +1 -1
  9. package/dist/cjs/chunks/{ErrorSummary-BTgAd3sK.js → ErrorSummary-BfVHS893.js} +6 -2
  10. package/dist/cjs/chunks/{FileIcon-CZLe2S2l.js → FileIcon-xoD-xIme.js} +2 -2
  11. package/dist/cjs/chunks/{FileList-BHwBIics.js → FileList-CIRALfrW.js} +1 -1
  12. package/dist/cjs/chunks/{Grouper-D4yyHHkM.js → Grouper-RYRxazG9.js} +1 -1
  13. package/dist/cjs/chunks/{Icon-D1EB8S5r.js → Icon-BB-t50Yt.js} +6 -2
  14. package/dist/cjs/chunks/{IconButton-B07Ttxbr.js → IconButton-BUw3YUsI.js} +1 -1
  15. package/dist/cjs/chunks/{Label-CTzvGcds.js → Label-NzMpkZo2.js} +1 -1
  16. package/dist/cjs/chunks/MdStreamBuffer-DObxjnAm.js +381 -0
  17. package/dist/cjs/chunks/{ProgressIndicator-BGqIwycX.js → ProgressIndicator-DETWiASA.js} +6 -2
  18. package/dist/cjs/chunks/{PromptInput-z6TuhHsG.js → PromptInput-DUxwal3V.js} +2 -2
  19. package/dist/cjs/chunks/{RadioButton-DuIsM4lu.js → RadioButton-Cvqum7dU.js} +1 -1
  20. package/dist/cjs/chunks/{RadioButtonList-bu11ILyw.js → RadioButtonList-CPHTioGa.js} +1 -1
  21. package/dist/cjs/chunks/{TabBar-Bcq_n4Mk.js → TabBar-CnD3E-qa.js} +1 -1
  22. package/dist/cjs/chunks/{TextArea-BSKbDOEt.js → TextArea-mSespe9z.js} +6 -6
  23. package/dist/cjs/chunks/{TextField-BNacOZVx.js → TextField-Cz2lh-fP.js} +20 -22
  24. package/dist/cjs/chunks/{Toast-CZzAWG0S.js → Toast-D2fpwdjF.js} +6 -2
  25. package/dist/cjs/chunks/{UploadArea-CKuE4rtg.js → UploadArea-CtvvqLU7.js} +1 -1
  26. package/dist/cjs/chunks/{_types-BSLc-fNi.js → _types-Sa2RAJ2U.js} +3 -3
  27. package/dist/cjs/components/Button/index.js +4 -4
  28. package/dist/cjs/components/ButtonBar/index.js +2 -2
  29. package/dist/cjs/components/Camera/index.js +4 -4
  30. package/dist/cjs/components/CheckBox/index.js +2 -2
  31. package/dist/cjs/components/Chip/index.js +2 -2
  32. package/dist/cjs/components/DraggablePanel/index.js +3 -3
  33. package/dist/cjs/components/DropDown/index.js +2 -2
  34. package/dist/cjs/components/ErrorSummary/index.js +2 -2
  35. package/dist/cjs/components/FileIcon/index.js +3 -4
  36. package/dist/cjs/components/FileList/index.js +4 -4
  37. package/dist/cjs/components/FlexDiv/index.js +1 -1
  38. package/dist/cjs/components/Grouper/index.js +2 -2
  39. package/dist/cjs/components/Icon/index.js +3 -3
  40. package/dist/cjs/components/IconButton/index.js +4 -4
  41. package/dist/cjs/components/Label/index.js +1 -1
  42. package/dist/cjs/components/Progress/index.js +5 -5
  43. package/dist/cjs/components/PromptInput/index.js +7 -7
  44. package/dist/cjs/components/RadioButton/index.js +2 -2
  45. package/dist/cjs/components/RadioButtonList/index.js +3 -3
  46. package/dist/cjs/components/TabBar/index.js +3 -3
  47. package/dist/cjs/components/TextArea/index.js +4 -4
  48. package/dist/cjs/components/Textfield/index.js +5 -5
  49. package/dist/cjs/components/Toast/index.js +2 -2
  50. package/dist/cjs/components/UploadArea/index.js +5 -5
  51. package/dist/cjs/hooks/useMdStreamBuffer.js +41 -0
  52. package/dist/cjs/hooks.js +3 -2
  53. package/dist/cjs/index.js +12 -11
  54. package/dist/cjs/providers/ThemeProvider.js +9 -7
  55. package/dist/cjs/utils/index.js +3 -2
  56. package/dist/cjs/utils/objects/index.js +3 -2
  57. package/dist/esm/chunks/{Button-daLv0i7S.mjs → Button-Bp51g5jC.mjs} +2 -2
  58. package/dist/esm/chunks/{ButtonBar-DXK8meQq.mjs → ButtonBar-BK-uB7oe.mjs} +1 -1
  59. package/dist/esm/chunks/{Camera-BqmVsVKy.mjs → Camera-BYi_Aqbl.mjs} +3 -3
  60. package/dist/esm/chunks/{CheckBox-BsaYFNC6.mjs → CheckBox-BB5olQbT.mjs} +1 -1
  61. package/dist/esm/chunks/{Chip-BRZeD1OX.mjs → Chip-CxqFCtT6.mjs} +1 -1
  62. package/dist/esm/chunks/{DropDown-DOJvg96J.mjs → DropDown-CK-sPjsQ.mjs} +1 -1
  63. package/dist/esm/chunks/{FileList-5LElsgoE.mjs → FileList-CyUhkk-m.mjs} +3 -3
  64. package/dist/esm/chunks/{Grouper-DR14qDXP.mjs → Grouper-Daz1o_Ai.mjs} +1 -1
  65. package/dist/esm/chunks/{IconButton-DG69Vlhj.mjs → IconButton-BKZD9jsp.mjs} +1 -1
  66. package/dist/esm/chunks/{Label-CRsE7o3D.mjs → Label-QTsUvGme.mjs} +1 -1
  67. package/dist/esm/chunks/MdStreamBuffer-DNXE4XbN.mjs +381 -0
  68. package/dist/esm/chunks/{ProgressIndicator-D7paCpgY.mjs → ProgressIndicator-Cg7CCrAE.mjs} +3 -3
  69. package/dist/esm/chunks/{PromptInput-CpxUcInZ.mjs → PromptInput-DJInpjRX.mjs} +4 -2
  70. package/dist/esm/chunks/{RadioButton-B5ZF5oJ_.mjs → RadioButton-CYp8RkDK.mjs} +1 -1
  71. package/dist/esm/chunks/{RadioButtonList-D9ZAZgkK.mjs → RadioButtonList-BSzV9Zz-.mjs} +1 -1
  72. package/dist/esm/chunks/{TabBar-BK7OcjPl.mjs → TabBar-Dd5-VZcG.mjs} +2 -2
  73. package/dist/esm/chunks/{TextArea-BmsEj6IA.mjs → TextArea-C_2D7sZV.mjs} +6 -6
  74. package/dist/esm/chunks/{TextField-DWPpevsj.mjs → TextField-RG1AsLTh.mjs} +19 -25
  75. package/dist/esm/chunks/{Toast-DPHLwDES.mjs → Toast-BfuKRAns.mjs} +3 -3
  76. package/dist/esm/chunks/{UploadArea-DPiOaNpc.mjs → UploadArea-ByvnUxhr.mjs} +3 -3
  77. package/dist/esm/chunks/{_types-B2h3MtOM.mjs → _types-CPrEyJX9.mjs} +3 -3
  78. package/dist/esm/components/Button/index.mjs +5 -5
  79. package/dist/esm/components/ButtonBar/index.mjs +2 -2
  80. package/dist/esm/components/Camera/index.mjs +4 -4
  81. package/dist/esm/components/CheckBox/index.mjs +2 -2
  82. package/dist/esm/components/Chip/index.mjs +2 -2
  83. package/dist/esm/components/DraggablePanel/index.mjs +3 -3
  84. package/dist/esm/components/DropDown/index.mjs +2 -2
  85. package/dist/esm/components/ErrorSummary/index.mjs +3 -3
  86. package/dist/esm/components/FileIcon/index.mjs +3 -3
  87. package/dist/esm/components/FileList/index.mjs +4 -4
  88. package/dist/esm/components/FlexDiv/index.mjs +1 -1
  89. package/dist/esm/components/Grouper/index.mjs +2 -2
  90. package/dist/esm/components/Icon/index.mjs +3 -3
  91. package/dist/esm/components/IconButton/index.mjs +4 -4
  92. package/dist/esm/components/Label/index.mjs +1 -1
  93. package/dist/esm/components/Progress/index.mjs +4 -4
  94. package/dist/esm/components/PromptInput/index.mjs +8 -8
  95. package/dist/esm/components/RadioButton/index.mjs +2 -2
  96. package/dist/esm/components/RadioButtonList/index.mjs +3 -3
  97. package/dist/esm/components/TabBar/index.mjs +3 -3
  98. package/dist/esm/components/TextArea/index.mjs +6 -6
  99. package/dist/esm/components/Textfield/index.mjs +7 -7
  100. package/dist/esm/components/Toast/index.mjs +4 -4
  101. package/dist/esm/components/UploadArea/index.mjs +5 -5
  102. package/dist/esm/hooks/useMdStreamBuffer.mjs +42 -0
  103. package/dist/esm/hooks.mjs +6 -0
  104. package/dist/esm/index.mjs +28 -24
  105. package/dist/esm/providers/ThemeProvider.mjs +9 -7
  106. package/dist/esm/utils/index.mjs +2 -0
  107. package/dist/esm/utils/objects/index.mjs +2 -0
  108. package/dist/types/components/FlexDiv/FlexDiv.d.ts +2 -2
  109. package/dist/types/components/FlexDiv/_types.d.ts +1 -1
  110. package/dist/types/components/Textfield/_types.d.ts +1 -3
  111. package/dist/types/hooks/index.d.ts +1 -0
  112. package/dist/types/hooks/useMdStreamBuffer/useMdStreamBuffer.d.ts +10 -0
  113. package/dist/types/index.d.ts +1 -1
  114. package/dist/types/providers/ThemeProvider.d.ts +1 -0
  115. package/dist/types/utils/index.d.ts +2 -2
  116. package/dist/types/utils/objects/MDStreamBuffer/MdStreamBuffer.d.ts +63 -0
  117. package/dist/types/utils/objects/MDStreamBuffer/_defaults.d.ts +3 -0
  118. package/dist/types/utils/objects/MDStreamBuffer/_types.d.ts +25 -0
  119. package/dist/types/utils/objects/index.d.ts +2 -0
  120. package/package.json +5 -3
  121. package/dist/esm/chunks/{DrggablePanel-Ddi0vPRp.mjs → DrggablePanel-BfBCRXa8.mjs} +2 -2
  122. package/dist/esm/chunks/{ErrorSummary-CHLkvdHk.mjs → ErrorSummary-BNdjCQbn.mjs} +2 -2
  123. package/dist/esm/chunks/{FileIcon-ePouoJpT.mjs → FileIcon-BXKnFJBn.mjs} +2 -2
  124. package/dist/esm/chunks/{Icon-CUSQtytG.mjs → Icon-CbwaBi0l.mjs} +2 -2
@@ -0,0 +1,381 @@
1
+ "use strict";
2
+
3
+ const DEFAULT_WATCHED_MARKERS = [ {
4
+ name: "fenced code block",
5
+ open: "```",
6
+ close: "```"
7
+ }, {
8
+ name: "bold",
9
+ open: "**",
10
+ close: "**"
11
+ }, {
12
+ name: "double underscore emphasis",
13
+ open: "__",
14
+ close: "__"
15
+ }, {
16
+ name: "strikethrough",
17
+ open: "~~",
18
+ close: "~~"
19
+ }, {
20
+ name: "inline code",
21
+ open: "`",
22
+ close: "`"
23
+ }, {
24
+ name: "italic",
25
+ open: "*",
26
+ close: "*"
27
+ }, {
28
+ name: "underscore emphasis",
29
+ open: "_",
30
+ close: "_"
31
+ }, {
32
+ name: "heading - ie #, ##, etc.",
33
+ open: "",
34
+ close: "\n",
35
+ mode: "line",
36
+ linePattern: /^#{1,6}\s+\S.*/,
37
+ partialLinePattern: /^#{1,6}\s*$/
38
+ }, {
39
+ name: "blockquote",
40
+ open: "",
41
+ close: "\n",
42
+ mode: "line",
43
+ linePattern: /^>\s+\S.*/,
44
+ partialLinePattern: /^>\s*$/
45
+ }, {
46
+ name: 'horizontal rule with "-"',
47
+ open: "",
48
+ close: "\n",
49
+ mode: "line",
50
+ linePattern: /^-{3,}\s*$/,
51
+ partialLinePattern: /^-{1,2}\s*$/
52
+ }, {
53
+ name: "task list",
54
+ open: "",
55
+ close: "\n",
56
+ mode: "line",
57
+ linePattern: /^[-*+]\s+\[(?: |x|X)\]\s+\S.*/,
58
+ partialLinePattern: /^[-*+]\s+\[(?:\s|x|X)?\]?\s*$/
59
+ }, {
60
+ name: 'unordered list "-"',
61
+ open: "",
62
+ close: "\n",
63
+ mode: "line",
64
+ linePattern: /^-\s+\S.*/,
65
+ partialLinePattern: /^-\s*$/
66
+ }, {
67
+ name: 'unordered list with "*"',
68
+ open: "",
69
+ close: "\n",
70
+ mode: "line",
71
+ linePattern: /^\*\s+\S.*/,
72
+ partialLinePattern: /^\*\s*$/
73
+ }, {
74
+ name: 'unordered list with "+"',
75
+ open: "",
76
+ close: "\n",
77
+ mode: "line",
78
+ linePattern: /^\+\s+\S.*/,
79
+ partialLinePattern: /^\+\s*$/
80
+ }, {
81
+ name: "ordered list",
82
+ open: "",
83
+ close: "\n",
84
+ mode: "line",
85
+ linePattern: /^\d+\.\s+\S.*/,
86
+ partialLinePattern: /^\d+\.\s*$/
87
+ } ];
88
+
89
+ /**
90
+ * Buffer streamed Markdown and emit parser-safe snapshots on animation frames.
91
+ */ function isEscaped(value, index) {
92
+ let slashCount = 0;
93
+ for (let cursor = index - 1; cursor >= 0 && "\\" === value[cursor]; cursor -= 1) slashCount += 1;
94
+ return slashCount % 2 != 0;
95
+ }
96
+
97
+ function isStarListMarker(value, index) {
98
+ return (0 === index || "\n" === value[index - 1]) && " " === value[index + 1];
99
+ }
100
+
101
+ function getRepeatedTokenCharacter(token) {
102
+ return 0 === token.length ? null : token.split("").every(character => character === token[0]) ? token[0] : null;
103
+ }
104
+
105
+ function countTrailingRepeatedCharacter(value, character) {
106
+ let count = 0;
107
+ for (let index = value.length - 1; index >= 0 && value[index] === character; index -= 1) count += 1;
108
+ return count;
109
+ }
110
+
111
+ function shouldIgnoreSymmetricToken(value, token, index) {
112
+ var _a, _b;
113
+ if (!token.includes("_")) return !1;
114
+ const previousCharacter = null !== (_a = value[index - 1]) && void 0 !== _a ? _a : "", nextCharacter = null !== (_b = value[index + token.length]) && void 0 !== _b ? _b : "";
115
+ return isWordCharacter(previousCharacter) || isWordCharacter(nextCharacter);
116
+ }
117
+
118
+ function isWordCharacter(value) {
119
+ return /[A-Za-z0-9]/.test(value);
120
+ }
121
+
122
+ function findLastUnmatchedSymmetricOpen(value, token) {
123
+ let occurrenceCount = 0, lastIndex = -1;
124
+ for (let index = 0; index <= value.length - token.length; index += 1) isEscaped(value, index) || value.slice(index, index + token.length) === token && (shouldIgnoreSymmetricToken(value, token, index) || (occurrenceCount += 1,
125
+ lastIndex = index, index += token.length - 1));
126
+ return occurrenceCount % 2 == 0 ? -1 : lastIndex;
127
+ }
128
+
129
+ function hasMeaningfulInlineContent(value, repeatedCharacter) {
130
+ if (0 === value.trim().length) return !1;
131
+ if (!repeatedCharacter) return !0;
132
+ return value.replaceAll(repeatedCharacter, "").trim().length > 0;
133
+ }
134
+
135
+ exports.MdBuffer = class {
136
+ constructor(options) {
137
+ var _a, _b, _c, _d, _e, rules;
138
+ this.committedRaw = "", this.activeRaw = "", this.frameHandle = null, this.completeSignal = !1,
139
+ this.endOfStreamToken = null == options ? void 0 : options.endOfStreamToken, this.htmlHandling = null !== (_a = null == options ? void 0 : options.htmlHandling) && void 0 !== _a ? _a : "ignore",
140
+ this.includeLinksAndImages = null !== (_b = null == options ? void 0 : options.includeLinksAndImages) && void 0 !== _b && _b,
141
+ this.onFlush = null == options ? void 0 : options.onFlush, this.requestFrame = null !== (_c = null == options ? void 0 : options.requestFrame) && void 0 !== _c ? _c : function() {
142
+ if ("undefined" != typeof globalThis && "function" == typeof globalThis.requestAnimationFrame) return globalThis.requestAnimationFrame.bind(globalThis);
143
+ return callback => globalThis.setTimeout(() => callback(Date.now()), 16);
144
+ }(), this.cancelFrame = null !== (_d = null == options ? void 0 : options.cancelFrame) && void 0 !== _d ? _d : function() {
145
+ if ("undefined" != typeof globalThis && "function" == typeof globalThis.cancelAnimationFrame) return globalThis.cancelAnimationFrame.bind(globalThis);
146
+ return handle => globalThis.clearTimeout(handle);
147
+ }(), this.watchedMarkers = (rules = null !== (_e = null == options ? void 0 : options.watchedMarkers) && void 0 !== _e ? _e : DEFAULT_WATCHED_MARKERS,
148
+ [ ...rules ].sort((left, right) => right.open.length - left.open.length));
149
+ }
150
+ /**
151
+ * The raw Markdown accumulated so far.
152
+ */ get raw() {
153
+ return `${this.committedRaw}${this.activeRaw}`;
154
+ }
155
+ /**
156
+ * The current parser-safe preview derived from the raw buffer.
157
+ */ get healthy() {
158
+ return this.buildHealthyOutput();
159
+ }
160
+ /**
161
+ * Append a streamed Markdown token and schedule a frame flush.
162
+ */ append(chunk) {
163
+ const eosSnapshot = this.handleEndOfStreamToken(chunk);
164
+ if (eosSnapshot) return eosSnapshot;
165
+ chunk && (this.activeRaw += chunk, this.commitStableLines(), this.scheduleFlush());
166
+ }
167
+ /**
168
+ * Emit the current snapshot immediately.
169
+ */ flush(reason = "manual") {
170
+ var _a;
171
+ const snapshot = {
172
+ raw: this.committedRaw + this.activeRaw,
173
+ healthy: this.buildHealthyOutput(),
174
+ reason: reason,
175
+ isComplete: this.completeSignal
176
+ };
177
+ return null === (_a = this.onFlush) || void 0 === _a || _a.call(this, snapshot),
178
+ snapshot;
179
+ }
180
+ /**
181
+ * Mark the stream as complete and flush one final snapshot.
182
+ */ complete() {
183
+ return null !== this.frameHandle && (this.cancelFrame(this.frameHandle), this.frameHandle = null),
184
+ this.completeSignal = !0, this.flush("complete");
185
+ }
186
+ /**
187
+ * Clear the buffered state and cancel any pending frame.
188
+ */ reset() {
189
+ null !== this.frameHandle && (this.cancelFrame(this.frameHandle), this.frameHandle = null),
190
+ this.committedRaw = "", this.activeRaw = "", this.completeSignal = !1;
191
+ }
192
+ /**
193
+ * Cancel future work and release the retained state.
194
+ */ dispose() {
195
+ this.reset();
196
+ }
197
+ handleEndOfStreamToken(chunk) {
198
+ if (!this.endOfStreamToken) return null;
199
+ if (!chunk.includes(this.endOfStreamToken)) return null;
200
+ const [beforeToken] = chunk.split(this.endOfStreamToken);
201
+ beforeToken && (this.activeRaw += beforeToken, this.commitStableLines());
202
+ const snapshot = this.complete();
203
+ return this.dispose(), snapshot;
204
+ }
205
+ scheduleFlush() {
206
+ null === this.frameHandle && (this.frameHandle = this.requestFrame(() => {
207
+ this.frameHandle = null, this.flush("raf");
208
+ }));
209
+ }
210
+ commitStableLines() {
211
+ if (this.buildHealthyTail(this.activeRaw) !== this.activeRaw) return;
212
+ const lastNewlineIndex = this.activeRaw.lastIndexOf("\n");
213
+ if (-1 === lastNewlineIndex) return;
214
+ const stablePrefix = this.activeRaw.slice(0, lastNewlineIndex + 1);
215
+ this.committedRaw += stablePrefix, this.activeRaw = this.activeRaw.slice(lastNewlineIndex + 1);
216
+ }
217
+ buildHealthyOutput() {
218
+ return `${this.committedRaw}${this.buildHealthyTail(this.activeRaw)}`;
219
+ }
220
+ buildHealthyTail(value) {
221
+ const withHtmlHandling = "strip" === this.htmlHandling ? function(value) {
222
+ let stripped = value.replaceAll(/<\/?[a-zA-Z][^>]*>/g, "");
223
+ const lastOpenTag = stripped.lastIndexOf("<"), lastCloseBracket = stripped.lastIndexOf(">");
224
+ if (lastOpenTag > lastCloseBracket) {
225
+ const trailingSegment = stripped.slice(lastOpenTag);
226
+ /^<\/?[a-zA-Z][^>]*$/.test(trailingSegment) && (stripped = stripped.slice(0, lastOpenTag));
227
+ }
228
+ return stripped;
229
+ }(value) : value, withLinksAndImages = this.includeLinksAndImages ? this.closeLinksAndImages(withHtmlHandling) : withHtmlHandling;
230
+ return this.closeInlineMarkdown(withLinksAndImages);
231
+ }
232
+ closeInlineMarkdown(value) {
233
+ const counts = function(value, rules) {
234
+ var _a;
235
+ const counts = {}, tokens = new Set;
236
+ for (const rule of rules) tokens.add(rule.open), tokens.add(rule.close);
237
+ const sortedTokens = [ ...tokens ].sort((left, right) => right.length - left.length);
238
+ for (let index = 0; index < value.length; index += 1) {
239
+ if (isEscaped(value, index)) continue;
240
+ const matchedToken = sortedTokens.find(token => token.length > 0 && value.slice(index, index + token.length) === token);
241
+ matchedToken && (shouldIgnoreSymmetricToken(value, matchedToken, index) || "*" === matchedToken && isStarListMarker(value, index) || (counts[matchedToken] = (null !== (_a = counts[matchedToken]) && void 0 !== _a ? _a : 0) + 1,
242
+ index += matchedToken.length - 1));
243
+ }
244
+ return counts;
245
+ }(value, this.getPairedRules()), withSymmetricClosers = this.closeSymmetricPairedMarkers(value), withAsymmetricClosers = this.closeAsymmetricPairedMarkers(withSymmetricClosers, counts);
246
+ return this.closeLineMarkers(withAsymmetricClosers);
247
+ }
248
+ closeLinksAndImages(value) {
249
+ const withImageSignalHandled = this.closeTrailingImageSignal(value);
250
+ if (withImageSignalHandled !== value) return withImageSignalHandled;
251
+ const trailingImage = this.findTrailingImage(value);
252
+ if (trailingImage) return this.closeTrailingImage(value, trailingImage);
253
+ const trailingLink = this.findTrailingLink(value);
254
+ return trailingLink ? this.closeTrailingLink(value, trailingLink) : value;
255
+ }
256
+ getPairedRules() {
257
+ return this.watchedMarkers.filter(rule => {
258
+ var _a;
259
+ return "paired" === (null !== (_a = rule.mode) && void 0 !== _a ? _a : "paired");
260
+ });
261
+ }
262
+ closeSymmetricPairedMarkers(value) {
263
+ let nextValue = value;
264
+ const suppressedCharacters = new Set, symmetricRules = this.getPairedRules().filter(rule => rule.open === rule.close);
265
+ for (const rule of symmetricRules) {
266
+ const repeatedCharacter = getRepeatedTokenCharacter(rule.open);
267
+ if (repeatedCharacter && suppressedCharacters.has(repeatedCharacter)) continue;
268
+ const unmatchedOpenIndex = findLastUnmatchedSymmetricOpen(nextValue, rule.open);
269
+ if (-1 !== unmatchedOpenIndex) if (hasMeaningfulInlineContent(nextValue.slice(unmatchedOpenIndex + rule.open.length), repeatedCharacter)) {
270
+ if (repeatedCharacter) {
271
+ const trailingRunLength = countTrailingRepeatedCharacter(nextValue, repeatedCharacter), remainingCharacters = Math.max(rule.close.length - trailingRunLength, 0);
272
+ nextValue += repeatedCharacter.repeat(remainingCharacters);
273
+ } else nextValue += rule.close;
274
+ repeatedCharacter && suppressedCharacters.add(repeatedCharacter);
275
+ } else nextValue = nextValue.slice(0, unmatchedOpenIndex), repeatedCharacter && suppressedCharacters.add(repeatedCharacter);
276
+ }
277
+ return nextValue;
278
+ }
279
+ closeAsymmetricPairedMarkers(value, counts) {
280
+ var _a, _b;
281
+ let nextValue = value;
282
+ const asymmetricRules = this.getPairedRules().filter(rule => rule.open !== rule.close);
283
+ for (const rule of asymmetricRules) {
284
+ const openCount = null !== (_a = counts[rule.open]) && void 0 !== _a ? _a : 0, closeCount = null !== (_b = counts[rule.close]) && void 0 !== _b ? _b : 0;
285
+ openCount > closeCount && (nextValue += rule.close.repeat(openCount - closeCount));
286
+ }
287
+ return nextValue;
288
+ }
289
+ closeLineMarkers(value) {
290
+ var _a, _b, _c, _d;
291
+ let nextValue = value;
292
+ const trailingLine = null !== (_a = nextValue.split("\n").at(-1)) && void 0 !== _a ? _a : "";
293
+ if (0 === trailingLine.trim().length) return nextValue;
294
+ const trailingLineStart = nextValue.length - trailingLine.length, lineRules = this.watchedMarkers.filter(rule => {
295
+ var _a;
296
+ return "line" === (null !== (_a = rule.mode) && void 0 !== _a ? _a : "paired");
297
+ });
298
+ for (const rule of lineRules) {
299
+ if (rule.linePattern) {
300
+ if (!rule.linePattern.test(trailingLine)) continue;
301
+ nextValue += rule.close;
302
+ break;
303
+ }
304
+ if (rule.requiresLineStart && !trailingLine.startsWith(rule.open)) continue;
305
+ const remaining = trailingLine.slice(rule.open.length).trim();
306
+ if (!(null === (_b = rule.requiresContent) || void 0 === _b || _b) || 0 !== remaining.length) {
307
+ nextValue += rule.close;
308
+ break;
309
+ }
310
+ }
311
+ for (const rule of lineRules) {
312
+ if (null === (_c = rule.partialLinePattern) || void 0 === _c ? void 0 : _c.test(trailingLine)) return nextValue.slice(0, trailingLineStart);
313
+ if (!rule.requiresLineStart || !trailingLine.startsWith(rule.open)) continue;
314
+ if (null !== (_d = rule.requiresContent) && void 0 !== _d && !_d) continue;
315
+ if (0 === trailingLine.slice(rule.open.length).trim().length) return nextValue.slice(0, trailingLineStart);
316
+ }
317
+ return nextValue;
318
+ }
319
+ closeTrailingLink(value, construct) {
320
+ if (!construct.labelClosed) return value.slice(0, construct.start);
321
+ if (construct.parenOpened) {
322
+ const linkPreview = `${value.slice(construct.start, construct.labelEnd + 1)}()`;
323
+ return `${value.slice(0, construct.start)}${linkPreview}`;
324
+ }
325
+ return construct.labelEnd === value.length - 1 ? value.slice(0, construct.start) : value;
326
+ }
327
+ closeTrailingImage(value, construct) {
328
+ return construct.labelClosed ? construct.parenOpened || construct.labelEnd === value.length - 1 ? value.slice(0, construct.start) : `${value.slice(0, construct.start)}${value.slice(construct.labelEnd + 1)}` : value.slice(0, construct.start);
329
+ }
330
+ closeTrailingImageSignal(value) {
331
+ const lastBangIndex = value.lastIndexOf("!");
332
+ return -1 === lastBangIndex || lastBangIndex !== value.length - 1 || isEscaped(value, lastBangIndex) ? value : value.slice(0, lastBangIndex);
333
+ }
334
+ findTrailingLink(value) {
335
+ const construct = this.findTrailingInlineConstruct(value, !1);
336
+ return construct ? construct.labelClosed ? construct.parenOpened || construct.labelEnd === value.length - 1 ? construct : null : construct : null;
337
+ }
338
+ findTrailingImage(value) {
339
+ return this.findTrailingInlineConstruct(value, !0);
340
+ }
341
+ findTrailingInlineConstruct(value, isImage) {
342
+ var _a;
343
+ const stack = [];
344
+ for (let index = 0; index < value.length; index += 1) {
345
+ if (isEscaped(value, index)) continue;
346
+ const character = value[index];
347
+ if ("[" === character) {
348
+ const isImage = index > 0 && "!" === value[index - 1] && !isEscaped(value, index - 1);
349
+ stack.push({
350
+ start: isImage ? index - 1 : index,
351
+ isImage: isImage,
352
+ labelClosed: !1,
353
+ labelEnd: -1,
354
+ parenOpened: !1
355
+ });
356
+ continue;
357
+ }
358
+ if ("]" === character) {
359
+ const target = [ ...stack ].reverse().find(item => !item.labelClosed);
360
+ if (!target) continue;
361
+ target.labelClosed = !0, target.labelEnd = index;
362
+ continue;
363
+ }
364
+ if ("(" === character) {
365
+ const target = [ ...stack ].reverse().find(item => item.labelClosed && !item.parenOpened && item.labelEnd === index - 1);
366
+ if (!target) continue;
367
+ target.parenOpened = !0;
368
+ continue;
369
+ }
370
+ if (")" === character) {
371
+ const targetIndex = null === (_a = [ ...stack ].map((item, stackIndex) => ({
372
+ item: item,
373
+ stackIndex: stackIndex
374
+ })).reverse().find(({item: item}) => item.parenOpened)) || void 0 === _a ? void 0 : _a.stackIndex;
375
+ "number" == typeof targetIndex && stack.splice(targetIndex, 1);
376
+ }
377
+ }
378
+ const trailingConstruct = stack.findLast(item => item.isImage === isImage);
379
+ return null != trailingConstruct ? trailingConstruct : null;
380
+ }
381
+ };
@@ -2,9 +2,13 @@
2
2
 
3
3
  var jsxRuntime = require("react/jsx-runtime"), React = require("react"), hooks_useTheme = require("../hooks/useTheme.js");
4
4
 
5
- require("../theme/colors.js"), require("../hooks/useWindow.js");
5
+ require("../theme/colors.js");
6
6
 
7
- var tslib_es6 = require("./tslib.es6-C8dZW5nY.js"), Icon = require("./Icon-D1EB8S5r.js"), styleInject_es = require("./style-inject.es-CMuL-BfJ.js"), react = require("motion/react"), css$1_wrapper = "DoneCheck-module_wrapper__AlISD flexBox-module_row__z24tF", css$1_icon = "DoneCheck-module_icon__bKaFp flexBox-module_row__z24tF";
7
+ var tslib_es6 = require("./tslib.es6-C8dZW5nY.js");
8
+
9
+ require("../hooks/useWindow.js");
10
+
11
+ var Icon = require("./Icon-BB-t50Yt.js"), styleInject_es = require("./style-inject.es-CMuL-BfJ.js"), react = require("motion/react"), css$1_wrapper = "DoneCheck-module_wrapper__AlISD flexBox-module_row__z24tF", css$1_icon = "DoneCheck-module_icon__bKaFp flexBox-module_row__z24tF";
8
12
 
9
13
  styleInject_es.styleInject(".flexBox-module_row__z24tF {\n\tdisplay: flex;\n\tjustify-content: center;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowBetween__5FEvi {\n\tdisplay: flex;\n\tjustify-content: space-between;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowStart__4tcxS {\n\tdisplay: flex;\n\tjustify-content: flex-start;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowEnd__rVdVm {\n\tdisplay: flex;\n\tjustify-content: flex-end;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_column__ezvMq {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: center;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnStart__C7P44 {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-start;\n\talign-items: flex-start;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnStartCenter__PKcrG {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-start;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnBetween__ERfp7 {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: space-between;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnEnd__lLJuc {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-end;\n\talign-items: flex-end;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}\n\n.DoneCheck-module_wrapper__AlISD {\n\theight: var(--icon-height);\n\tmax-height: var(--icon-height);\n\twidth: var(--icon-width);\n\tmax-width: var(--icon-width);\n\toverflow: visible;\n}\n\n.DoneCheck-module_icon__bKaFp {\n\theight: var(--icon-height);\n\tmax-height: var(--icon-height);\n\twidth: var(--icon-width);\n\tmax-width: var(--icon-width);\n\tscale: var(--icon-scale);\n\ttransition: var(--icon-transition);\n}\n");
10
14
 
@@ -2,9 +2,9 @@
2
2
 
3
3
  var jsxRuntime = require("react/jsx-runtime"), React = require("react"), hooks_useTheme = require("../hooks/useTheme.js");
4
4
 
5
- require("../theme/colors.js"), require("../hooks/useWindow.js");
5
+ require("../theme/colors.js"), require("./tslib.es6-C8dZW5nY.js"), require("../hooks/useWindow.js");
6
6
 
7
- var Button = require("./Button-DXvjvGtY.js"), FileList = require("./FileList-BHwBIics.js"), styleInject_es = require("./style-inject.es-CMuL-BfJ.js"), css = {
7
+ var Button = require("./Button-KGA0e9-0.js"), FileList = require("./FileList-CIRALfrW.js"), styleInject_es = require("./style-inject.es-CMuL-BfJ.js"), css = {
8
8
  wrapperBg: "PromptInput-module_wrapperBg__zabZq flexBox-module_columnStart__C7P44",
9
9
  bgRotate: "PromptInput-module_bgRotate__Um720",
10
10
  textareaWrapper: "PromptInput-module_textareaWrapper__KusiV flexBox-module_columnStart__C7P44",
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- var tslib_es6 = require("./tslib.es6-C8dZW5nY.js"), jsxRuntime = require("react/jsx-runtime"), React = require("react"), misc = require("./misc-BTF7BCZW.js"), Icon = require("./Icon-D1EB8S5r.js"), styleInject_es = require("./style-inject.es-CMuL-BfJ.js"), css_wrapper = "RadioButton-module_wrapper__-pWRe flexBox-module_row__z24tF", css_radioIcon = "RadioButton-module_radioIcon__I27Xv flexBox-module_column__ezvMq", css_radioTitle = "RadioButton-module_radioTitle__zCQII flexBox-module_rowStart__4tcxS type-module_body-m-regular__LuQBA", css_radioContent = "RadioButton-module_radioContent__38xVx flexBox-module_columnStart__C7P44";
3
+ var tslib_es6 = require("./tslib.es6-C8dZW5nY.js"), jsxRuntime = require("react/jsx-runtime"), React = require("react"), misc = require("./misc-BTF7BCZW.js"), Icon = require("./Icon-BB-t50Yt.js"), styleInject_es = require("./style-inject.es-CMuL-BfJ.js"), css_wrapper = "RadioButton-module_wrapper__-pWRe flexBox-module_row__z24tF", css_radioIcon = "RadioButton-module_radioIcon__I27Xv flexBox-module_column__ezvMq", css_radioTitle = "RadioButton-module_radioTitle__zCQII flexBox-module_rowStart__4tcxS type-module_body-m-regular__LuQBA", css_radioContent = "RadioButton-module_radioContent__38xVx flexBox-module_columnStart__C7P44";
4
4
 
5
5
  function RadioButtonComponent(props) {
6
6
  const {label: label, children: children, fieldName: fieldName, value: value, selected: selected = !1, controlType: controlType = "radio", deselect: deselect = !0, tabIndex: tabIndex = 0, wrap: wrap = !1, list: list = !1, hideRadio: hideRadio = !1, noFrame: noFrame = !0, icon: icon = "circle", checkedIcon: checkedIcon = "check circle", iconColor: iconColor, gap: gap = 6, onChange: onChange = () => null} = props, divAttributes = tslib_es6.__rest(props, [ "label", "children", "fieldName", "value", "selected", "controlType", "deselect", "tabIndex", "wrap", "list", "hideRadio", "noFrame", "icon", "checkedIcon", "iconColor", "gap", "onChange" ]), {id: divId, className: className, style: style} = divAttributes, rest = tslib_es6.__rest(divAttributes, [ "id", "className", "style" ]), divStyle = null != style ? style : {}, divClass = className ? ` ${className}` : "", [isSelected, setIsSelected] = React.useState(selected);
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- var tslib_es6 = require("./tslib.es6-C8dZW5nY.js"), jsxRuntime = require("react/jsx-runtime"), React = require("react"), misc = require("./misc-BTF7BCZW.js"), RadioButton = require("./RadioButton-DuIsM4lu.js"), styleInject_es = require("./style-inject.es-CMuL-BfJ.js"), css_wrapper = "RadioButtonList-module_wrapper__wnq1-", css_column = "RadioButtonList-module_column__Bq16e flexBox-module_columnStart__C7P44", css_row = "RadioButtonList-module_row__D3szq flexBox-module_rowStart__4tcxS";
3
+ var tslib_es6 = require("./tslib.es6-C8dZW5nY.js"), jsxRuntime = require("react/jsx-runtime"), React = require("react"), misc = require("./misc-BTF7BCZW.js"), RadioButton = require("./RadioButton-Cvqum7dU.js"), styleInject_es = require("./style-inject.es-CMuL-BfJ.js"), css_wrapper = "RadioButtonList-module_wrapper__wnq1-", css_column = "RadioButtonList-module_column__Bq16e flexBox-module_columnStart__C7P44", css_row = "RadioButtonList-module_row__D3szq flexBox-module_rowStart__4tcxS";
4
4
 
5
5
  function RadioButtonListComponent(props) {
6
6
  const {width: width = "min-content", options: options = [], selectedIndexes: selectedIndexes = null, selectedOptions: selectedOptions = null, label: label = null, deselect: deselect = !1, multiSelect: multiSelect = !1, wrap: wrap = !1, tabIndexSeed: tabIndexSeed = 0, spacer: spacer = "none", custom: custom = 0, gap: gap = 16, hideRadio: hideRadio = !1, noFrame: noFrame = !0, toggleIcon: toggleIcon = !0, iconColor: iconColor, icon: icon = "circle", checkedIcon: checkedIcon = "check circle", iconSelectedColor: iconSelectedColor, onChange: onChange = () => null} = props, divAttributes = tslib_es6.__rest(props, [ "width", "options", "selectedIndexes", "selectedOptions", "label", "deselect", "multiSelect", "wrap", "tabIndexSeed", "spacer", "custom", "gap", "hideRadio", "noFrame", "toggleIcon", "iconColor", "icon", "checkedIcon", "iconSelectedColor", "onChange" ]), {id: divId, className: className, style: style} = divAttributes, rest = tslib_es6.__rest(divAttributes, [ "id", "className", "style" ]), divStyle = null != style ? style : {}, divClass = className ? ` ${className}` : "", labelId = React.useId(), [selected, setSelected] = React.useState(selectedIndexes);
@@ -4,7 +4,7 @@ var tslib_es6 = require("./tslib.es6-C8dZW5nY.js"), jsxRuntime = require("react/
4
4
 
5
5
  require("../theme/colors.js"), require("../hooks/useWindow.js");
6
6
 
7
- var Badge = require("./Badge-CY_DG6cD.js"), Icon = require("./Icon-D1EB8S5r.js"), IconButton = require("./IconButton-B07Ttxbr.js"), sharedTypes = require("./sharedTypes-gCECyn2N.js"), styleInject_es = require("./style-inject.es-CMuL-BfJ.js"), css_wrapper = "TabBar-module_wrapper__cyOR1 flexBox-module_rowStart__4tcxS", css_option = "TabBar-module_option__gYjDf flexBox-module_row__z24tF type-module_body-m-regular__LuQBA", css_icon = "TabBar-module_icon__JDgG3 flexBox-module_row__z24tF", css_close = "TabBar-module_close__bvSBh flexBox-module_row__z24tF";
7
+ var Badge = require("./Badge-CY_DG6cD.js"), Icon = require("./Icon-BB-t50Yt.js"), IconButton = require("./IconButton-BUw3YUsI.js"), sharedTypes = require("./sharedTypes-gCECyn2N.js"), styleInject_es = require("./style-inject.es-CMuL-BfJ.js"), css_wrapper = "TabBar-module_wrapper__cyOR1 flexBox-module_rowStart__4tcxS", css_option = "TabBar-module_option__gYjDf flexBox-module_row__z24tF type-module_body-m-regular__LuQBA", css_icon = "TabBar-module_icon__JDgG3 flexBox-module_row__z24tF", css_close = "TabBar-module_close__bvSBh flexBox-module_row__z24tF";
8
8
 
9
9
  styleInject_es.styleInject(".flexBox-module_row__z24tF {\n\tdisplay: flex;\n\tjustify-content: center;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowBetween__5FEvi {\n\tdisplay: flex;\n\tjustify-content: space-between;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowStart__4tcxS {\n\tdisplay: flex;\n\tjustify-content: flex-start;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowEnd__rVdVm {\n\tdisplay: flex;\n\tjustify-content: flex-end;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_column__ezvMq {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: center;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnStart__C7P44 {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-start;\n\talign-items: flex-start;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnStartCenter__PKcrG {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-start;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnBetween__ERfp7 {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: space-between;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnEnd__lLJuc {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-end;\n\talign-items: flex-end;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.type-module_body-xs-regular__ZAFft {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-regular);\n\tfont-size: var(--font-size-xs);\n\tline-height: 133.33%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_body-xs-medium__s3KvF {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-medium);\n\tfont-size: var(--font-size-xs);\n\tline-height: 133.33%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_body-xs-bold__Lhqqq {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-bold);\n\tfont-size: var(--font-size-xs);\n\tline-height: 133.33%;\n\ttext-decoration: none;\n\tletter-spacing: 0.25px;\n}.type-module_body-s-regular__vRHSP {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-regular);\n\tfont-size: var(--font-size-s);\n\tline-height: 142.86%;\n\ttext-decoration: none;\n\tletter-spacing: 0.15px;\n}.type-module_body-s-medium__tjdFc {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-medium);\n\tfont-size: var(--font-size-s);\n\tline-height: 142.86%;\n\ttext-decoration: none;\n\tletter-spacing: 0.15px;\n}.type-module_body-s-bold__Iy-VX {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-bold);\n\tfont-size: var(--font-size-s);\n\tline-height: 142.86%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_body-m-regular__LuQBA {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-regular);\n\tfont-size: var(--font-size-m);\n\tline-height: 140%;\n\ttext-decoration: none;\n\tletter-spacing: 0.15px;\n}.type-module_body-m-medium__uW1on {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-medium);\n\tfont-size: var(--font-size-m);\n\tline-height: 140%;\n\ttext-decoration: none;\n\tletter-spacing: 0.15px;\n}.type-module_body-m-bold__UBcvQ {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-bold);\n\tfont-size: var(--font-size-m);\n\tline-height: 140%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_body-l-regular__lOYbg {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-regular);\n\tfont-size: var(--font-size-l);\n\tline-height: 162.5%;\n\ttext-decoration: none;\n\tletter-spacing: 0.1px;\n}.type-module_body-l-medium__BqRC7 {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-medium);\n\tfont-size: var(--font-size-l);\n\tline-height: 162.5%;\n\ttext-decoration: none;\n\tletter-spacing: 0.1px;\n}.type-module_body-l-bold__Fh2dt {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-bold);\n\tfont-size: var(--font-size-l);\n\tline-height: 162.5%;\n\ttext-decoration: none;\n\tletter-spacing: 0.15px;\n}.type-module_body-xl-regular__pF2kC {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-regular);\n\tfont-size: var(--font-size-xl);\n\tline-height: 162.5%;\n\ttext-decoration: none;\n\tletter-spacing: 0.1px;\n}.type-module_body-xl-medium__BeyrH {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-medium);\n\tfont-size: var(--font-size-xl);\n\tline-height: 162.5%;\n\ttext-decoration: none;\n\tletter-spacing: 0.1px;\n}.type-module_body-xl-bold__Ruknj {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-bold);\n\tfont-size: var(--font-size-xl);\n\tline-height: 162.5%;\n\ttext-decoration: none;\n\tletter-spacing: 0.15px;\n}.type-module_heading-s-medium__z8L3G {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 500;\n\tfont-size: 20px;\n\tline-height: 140%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-s-bold__0O3g6 {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 600;\n\tfont-size: 20px;\n\tline-height: 140%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-m-bold__KXxEB {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 500;\n\tfont-size: 24px;\n\tline-height: 116.67%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-m-medium__cJeEA {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 600;\n\tfont-size: 24px;\n\tline-height: 116.67%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-l-medium__eRe05 {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 500;\n\tfont-size: 30px;\n\tline-height: 128.57%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-l-bold__Xmwtf {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 600;\n\tfont-size: 30px;\n\tline-height: 128.57%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-xl-medium__5q1m3 {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 500;\n\tfont-size: 36px;\n\tline-height: 128.57%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-xl-bold__k9VFV {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 600;\n\tfont-size: 36px;\n\tline-height: 128.57%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}\n\n.TabBar-module_wrapper__cyOR1 {\n\tgap: var(--tab-bar-gap);\n\tborder-bottom: var(--tab-bar-border-bottom) solid var(--core-outline-primary);\n\theight: var(--tab-bar-height);\n\twidth: var(--tab-bar-width);\n\tcursor: pointer;\n}\n\n.TabBar-module_option__gYjDf {\n\tgap: var(--tab-bar-option-gap);\n\tcolor: var(--tab-bar-option-color);\n\tpadding: var(--tab-bar-option-padding) !important;\n\theight: 100%;\n\twidth: var(--tab-bar-option-width);\n\tflex: var(--tab-bar-option-flex);\n\twhite-space: nowrap;\n\tbox-shadow: 0 var(--tab-bar-option-border) 0 0 var(--core-text-special);\n\tcursor: var(--tab-bar-option-cursor);\n\t-webkit-user-select: none;\n\tuser-select: none;\n\tappearance: none;\n\t-webkit-appearance: none;\n\tbackground-image: none;\n\tbackground-color: transparent;\n\tborder: 0;\n\toutline: none;\n\ttext-align: left;\n}\n\n.TabBar-module_icon__JDgG3 {\n\tmax-height: var(--tab-bar-icon-size);\n\tmin-height: var(--tab-bar-icon-size);\n\tmax-width: var(--tab-bar-icon-size);\n\tmin-width: var(--tab-bar-icon-size);\n}\n\n.TabBar-module_close__bvSBh {\n\theight: 100%;\n\tpadding: var(--tab-bar-close-padding) !important;\n\tborder-left: 1px solid var(--core-outline-primary);\n\twidth: min-content;\n}\n");
10
10
 
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- var tslib_es6 = require("./tslib.es6-C8dZW5nY.js"), jsxRuntime = require("react/jsx-runtime"), React = require("react"), Button = require("./Button-DXvjvGtY.js"), styleInject_es = require("./style-inject.es-CMuL-BfJ.js"), css_wrapper = "TextArea-module_wrapper__O0sWP flexBox-module_columnStart__C7P44", css_textarea = "TextArea-module_textarea__-R2n0", css_send = "TextArea-module_send__Cub13", css_xs = "TextArea-module_xs__5e748 type-module_body-xs-regular__ZAFft", css_s = "TextArea-module_s__Ac-fq type-module_body-s-regular__vRHSP", css_m = "TextArea-module_m__dod4R type-module_body-m-regular__LuQBA", css_l = "TextArea-module_l__-uLCG type-module_body-l-regular__lOYbg";
3
+ var tslib_es6 = require("./tslib.es6-C8dZW5nY.js"), jsxRuntime = require("react/jsx-runtime"), React = require("react"), Button = require("./Button-KGA0e9-0.js"), styleInject_es = require("./style-inject.es-CMuL-BfJ.js"), css_wrapper = "TextArea-module_wrapper__O0sWP flexBox-module_columnStart__C7P44", css_textarea = "TextArea-module_textarea__-R2n0", css_send = "TextArea-module_send__Cub13", css_xs = "TextArea-module_xs__5e748 type-module_body-xs-regular__ZAFft", css_s = "TextArea-module_s__Ac-fq type-module_body-s-regular__vRHSP", css_m = "TextArea-module_m__dod4R type-module_body-m-regular__LuQBA", css_l = "TextArea-module_l__-uLCG type-module_body-l-regular__lOYbg";
4
4
 
5
5
  styleInject_es.styleInject(".flexBox-module_row__z24tF {\n\tdisplay: flex;\n\tjustify-content: center;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowBetween__5FEvi {\n\tdisplay: flex;\n\tjustify-content: space-between;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowStart__4tcxS {\n\tdisplay: flex;\n\tjustify-content: flex-start;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowEnd__rVdVm {\n\tdisplay: flex;\n\tjustify-content: flex-end;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_column__ezvMq {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: center;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnStart__C7P44 {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-start;\n\talign-items: flex-start;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnStartCenter__PKcrG {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-start;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnBetween__ERfp7 {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: space-between;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnEnd__lLJuc {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-end;\n\talign-items: flex-end;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.type-module_body-xs-regular__ZAFft {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-regular);\n\tfont-size: var(--font-size-xs);\n\tline-height: 133.33%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_body-xs-medium__s3KvF {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-medium);\n\tfont-size: var(--font-size-xs);\n\tline-height: 133.33%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_body-xs-bold__Lhqqq {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-bold);\n\tfont-size: var(--font-size-xs);\n\tline-height: 133.33%;\n\ttext-decoration: none;\n\tletter-spacing: 0.25px;\n}.type-module_body-s-regular__vRHSP {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-regular);\n\tfont-size: var(--font-size-s);\n\tline-height: 142.86%;\n\ttext-decoration: none;\n\tletter-spacing: 0.15px;\n}.type-module_body-s-medium__tjdFc {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-medium);\n\tfont-size: var(--font-size-s);\n\tline-height: 142.86%;\n\ttext-decoration: none;\n\tletter-spacing: 0.15px;\n}.type-module_body-s-bold__Iy-VX {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-bold);\n\tfont-size: var(--font-size-s);\n\tline-height: 142.86%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_body-m-regular__LuQBA {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-regular);\n\tfont-size: var(--font-size-m);\n\tline-height: 140%;\n\ttext-decoration: none;\n\tletter-spacing: 0.15px;\n}.type-module_body-m-medium__uW1on {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-medium);\n\tfont-size: var(--font-size-m);\n\tline-height: 140%;\n\ttext-decoration: none;\n\tletter-spacing: 0.15px;\n}.type-module_body-m-bold__UBcvQ {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-bold);\n\tfont-size: var(--font-size-m);\n\tline-height: 140%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_body-l-regular__lOYbg {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-regular);\n\tfont-size: var(--font-size-l);\n\tline-height: 162.5%;\n\ttext-decoration: none;\n\tletter-spacing: 0.1px;\n}.type-module_body-l-medium__BqRC7 {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-medium);\n\tfont-size: var(--font-size-l);\n\tline-height: 162.5%;\n\ttext-decoration: none;\n\tletter-spacing: 0.1px;\n}.type-module_body-l-bold__Fh2dt {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-bold);\n\tfont-size: var(--font-size-l);\n\tline-height: 162.5%;\n\ttext-decoration: none;\n\tletter-spacing: 0.15px;\n}.type-module_body-xl-regular__pF2kC {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-regular);\n\tfont-size: var(--font-size-xl);\n\tline-height: 162.5%;\n\ttext-decoration: none;\n\tletter-spacing: 0.1px;\n}.type-module_body-xl-medium__BeyrH {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-medium);\n\tfont-size: var(--font-size-xl);\n\tline-height: 162.5%;\n\ttext-decoration: none;\n\tletter-spacing: 0.1px;\n}.type-module_body-xl-bold__Ruknj {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-bold);\n\tfont-size: var(--font-size-xl);\n\tline-height: 162.5%;\n\ttext-decoration: none;\n\tletter-spacing: 0.15px;\n}.type-module_heading-s-medium__z8L3G {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 500;\n\tfont-size: 20px;\n\tline-height: 140%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-s-bold__0O3g6 {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 600;\n\tfont-size: 20px;\n\tline-height: 140%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-m-bold__KXxEB {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 500;\n\tfont-size: 24px;\n\tline-height: 116.67%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-m-medium__cJeEA {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 600;\n\tfont-size: 24px;\n\tline-height: 116.67%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-l-medium__eRe05 {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 500;\n\tfont-size: 30px;\n\tline-height: 128.57%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-l-bold__Xmwtf {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 600;\n\tfont-size: 30px;\n\tline-height: 128.57%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-xl-medium__5q1m3 {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 500;\n\tfont-size: 36px;\n\tline-height: 128.57%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-xl-bold__k9VFV {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 600;\n\tfont-size: 36px;\n\tline-height: 128.57%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}\n\n.TextArea-module_wrapper__O0sWP {\n\tposition: relative;\n\tpadding: var(--ta-padding) !important;\n\twidth: var(--ta-width);\n\theight: auto;\n\tborder-radius: var(--ta-border-radius);\n\tbackground-color: var(--ta-bg-color);\n\tbox-shadow: 0 0 0 1px var(--ta-border-color);\n\ttransition: all var(--motion-water-duration) var(--motion-water) 0s;\n}\n\n.TextArea-module_textarea__-R2n0 {\n\tborder: 0;\n\toutline: 0;\n\tpadding: 0 16px 0 0;\n\twidth: 100%;\n\theight: 100%;\n\tcolor: var(--core-text-primary);\n\tbackground-color: transparent;\n\tbox-sizing: border-box;\n\tresize: var(--ta-resize);\n\n\t&:disabled {\n\t\tcolor: var(--core-text-disabled);\n\t}\n\n\t&::placeholder {\n\t\tcolor: var(--core-text-disabled);\n\t}\n\n\toverflow-y: auto;\n\n\t&::-webkit-scrollbar {\n\t\tbackground-color: transparent;\n\t\twidth: 14px;\n\t}\n\n\t&::-webkit-scrollbar-track {\n\t\tbackground-color: transparent;\n\t}\n\n\t&::-webkit-scrollbar-thumb {\n\t\tbackground-color: var(--scroll-bar);\n\t\tborder-radius: 20px;\n\t\tborder: 4px solid var(--core-surface-primary);\n\t}\n\n\t&::-webkit-scrollbar-thumb:hover {\n\t\tbackground-color: var(--scroll-bar);\n\t\tborder-radius: 20px;\n\t\tborder: 4px solid var(--core-surface-primary);\n\t\tcursor: default;\n\t}\n}\n\n.TextArea-module_actions__yunQx {\n\twidth: 100%;\n\tmin-height: 30px;\n\tcolor: var(--core-text-disabled);\n\tgap: 16px;\n}\n\n.TextArea-module_option__2SFx5 {\n\tgap: 4px;\n\twhite-space: nowrap;\n\tuser-select: none;\n\t-webkit-user-select: none;\n\tcursor: default;\n}\n\n.TextArea-module_send__Cub13 {\n\tposition: absolute;\n\tbottom: var(--ta-send-icon-offset-bottom);\n\tright: var(--ta-send-icon-offset-right);\n}\n\n.TextArea-module_xs__5e748 {\n}\n\n.TextArea-module_s__Ac-fq {\n}\n\n.TextArea-module_m__dod4R {\n}\n\n.TextArea-module_l__-uLCG {\n}\n");
6
6
 
@@ -20,16 +20,16 @@ const TextArea = React.memo(props => {
20
20
  }, [ onChange ]), handleFocus = React.useCallback(() => {
21
21
  var _a, _b;
22
22
  (null == ref ? void 0 : ref.current) && ref.current.focus(), setIsFocused(!0), onFocus(null !== (_b = null === (_a = ref.current) || void 0 === _a ? void 0 : _a.value) && void 0 !== _b ? _b : "");
23
- }, [ onFocus ]), handleBlur = React.useCallback(content => {
23
+ }, [ onFocus ]), handleBlur = React.useCallback(() => {
24
24
  var _a, _b;
25
- handleChange(content), setIsFocused(!1), onBlur(null !== (_b = null === (_a = ref.current) || void 0 === _a ? void 0 : _a.value) && void 0 !== _b ? _b : "");
26
- }, [ handleChange, onBlur ]), handleSubmit = React.useCallback(e => {
25
+ setIsFocused(!1), onBlur(null !== (_b = null === (_a = ref.current) || void 0 === _a ? void 0 : _a.value) && void 0 !== _b ? _b : "");
26
+ }, [ onBlur ]), handleSubmit = React.useCallback(e => {
27
27
  null == e || e.preventDefault(), handleFocus(), onSubmit(text), submitClears && setText(""),
28
28
  (null == ref ? void 0 : ref.current) && (ref.current.value = ""), handleResize();
29
29
  }, [ handleFocus, onSubmit, text, submitClears, handleResize ]), handleKeyDownWrapper = React.useCallback(e => {
30
30
  returnSubmits && "Enter" === e.key && (e.preventDefault(), e.stopPropagation(),
31
31
  handleSubmit(void 0)), onKeyDown(e);
32
- }, [ returnSubmits, handleSubmit, onKeyDown ]), setStyleValue = React.useCallback(value => "string" == typeof value ? value : `${value}px`, []), setBorderColor = React.useMemo(() => isFocused ? "var(--core-link-primary)" : error ? "var(--feedback-warning)" : border ? "var(--core-outline-primary)" : "transparent", [ isFocused, error, border ]), textClassName = React.useMemo(() => "xs" === textSize ? css_xs : "l" === textSize ? css_l : "m" === textSize ? css_m : css_s, [ textSize ]), cssVars = React.useMemo(() => ({
32
+ }, [ returnSubmits, handleSubmit, onKeyDown ]), setStyleValue = React.useCallback(value => "string" == typeof value ? value : `${value}px`, []), setBorderColor = React.useMemo(() => border && isFocused ? "var(--core-link-primary)" : border && error ? "var(--feedback-warning)" : border ? "var(--core-outline-primary)" : "transparent", [ isFocused, error, border ]), textClassName = React.useMemo(() => "xs" === textSize ? css_xs : "l" === textSize ? css_l : "m" === textSize ? css_m : css_s, [ textSize ]), cssVars = React.useMemo(() => ({
33
33
  "--ta-border-radius": `${borderRadius}px`,
34
34
  "--ta-width": `${setStyleValue(width)}`,
35
35
  "--ta-min-width": minWidth ? `${minWidth}px` : "unset",
@@ -45,7 +45,7 @@ const TextArea = React.memo(props => {
45
45
  id: divId,
46
46
  className: `${css_wrapper}${divClass}`,
47
47
  style: Object.assign(Object.assign({}, divStyle), cssVars),
48
- onBlur: () => handleBlur(text),
48
+ onBlur: () => handleBlur(),
49
49
  onFocus: () => handleFocus()
50
50
  }, rest, {
51
51
  children: [ hasSend && jsxRuntime.jsx("div", {
@@ -2,9 +2,13 @@
2
2
 
3
3
  var tslib_es6 = require("./tslib.es6-C8dZW5nY.js"), jsxRuntime = require("react/jsx-runtime"), react = require("motion/react"), React = require("react"), hooks_useTheme = require("../hooks/useTheme.js");
4
4
 
5
- require("../theme/colors.js"), require("../hooks/useWindow.js");
5
+ require("../theme/colors.js");
6
6
 
7
- var misc = require("./misc-BTF7BCZW.js"), Button = require("./Button-DXvjvGtY.js"), Icon = require("./Icon-D1EB8S5r.js"), IconButton = require("./IconButton-B07Ttxbr.js"), styleInject_es = require("./style-inject.es-CMuL-BfJ.js"), css = {
7
+ var misc = require("./misc-BTF7BCZW.js");
8
+
9
+ require("../hooks/useWindow.js");
10
+
11
+ var Button = require("./Button-KGA0e9-0.js"), Icon = require("./Icon-BB-t50Yt.js"), IconButton = require("./IconButton-BUw3YUsI.js"), styleInject_es = require("./style-inject.es-CMuL-BfJ.js"), css = {
8
12
  wrapper: "TextField-module_wrapper__qZ-p- flexBox-module_rowStart__4tcxS",
9
13
  container: "TextField-module_container__5U9yK flexBox-module_rowStart__4tcxS",
10
14
  label: "TextField-module_label__jD8MR flexBox-module_rowStart__4tcxS",
@@ -36,32 +40,26 @@ const MOTION_CONFIG = {
36
40
  duration: .25
37
41
  }
38
42
  }, TextField = React.memo(props => {
39
- const theme = hooks_useTheme.useTheme(), {name: name = "input_name", value: value = "", label: label = "", labelSize: labelSize = "m", textSize: textSize = "m", placeholder: placeholder = "placeholder", focused: focused = !1, onSubmit: onSubmit = () => null, onChange: onChange = () => null, onBlur: onBlur = () => null, onFocus: onFocus = () => null, onKeydown: onKeydown = () => null, onAction: onAction = () => null, onPaste: onPaste = () => null, onClear: onClear = () => null, onValidate: onValidate = () => null, actionButton: actionButton = !1, maxLength: maxLength, size: size = {
43
+ const theme = hooks_useTheme.useTheme(), {name: name = "input_name", value: value = "", label: label = "", labelSize: labelSize = "m", textSize: textSize = "m", placeholder: placeholder = "placeholder", focused: focused = !1, onSubmit: onSubmit = () => null, onChange: onChange = () => null, onBlur: onBlur = () => null, onFocus: onFocus = () => null, onKeydown: onKeydown = () => null, onAction: onAction = () => null, onPaste: onPaste = () => null, onClear: onClear = () => null, actionButton: actionButton = !1, maxLength: maxLength, size: size = {
40
44
  width: "100%",
41
45
  height: "auto"
42
- }, padding: padding, borderRadius: borderRadius = 8, editable: editable = !0, textAlign: textAlign = "left", isValid: isValid = !0, inline: inline = !1, noShow: noShow = !1, borderType: borderType = "box", validate: validate = !0, borderColorFocused: borderColorFocused = "var(--core-link-primary)", borderColorBlurred: borderColorBlurred = "var(--core-outline-primary)", borderColorError: borderColorError = "var(--feedback-warning)", backgroundColorFocused: backgroundColorFocused = "var(--core-surface-secondary)", backgroundColorBlurred: backgroundColorBlurred = "var(--core-surface-secondary)", textColorFocused: textColorFocused = "var(--core-text-primary)", textColorBlurred: textColorBlurred = "var(--core-text-primary)", textColorError: textColorError = "var(--feedback-warning)", textColorPlaceholder: textColorPlaceholder = "var(--core-text-disabled)", textColorDisabled: textColorDisabled = "var(--core-text-disabled)", labelColor: labelColor = "var(--core-text-primary)", iconLeft: iconLeft = null, clearButton: clearButton = {
46
+ }, padding: padding, borderRadius: borderRadius = 8, editable: editable = !0, textAlign: textAlign = "left", inline: inline = !1, noShow: noShow = !1, borderType: borderType = "box", error: error = !1, borderColorFocused: borderColorFocused = "var(--core-link-primary)", borderColorBlurred: borderColorBlurred = "var(--core-outline-primary)", borderColorError: borderColorError = "var(--feedback-warning)", backgroundColorFocused: backgroundColorFocused = "var(--core-surface-secondary)", backgroundColorBlurred: backgroundColorBlurred = "var(--core-surface-secondary)", textColorFocused: textColorFocused = "var(--core-text-primary)", textColorBlurred: textColorBlurred = "var(--core-text-primary)", textColorError: textColorError = "var(--feedback-warning)", textColorPlaceholder: textColorPlaceholder = "var(--core-text-disabled)", textColorDisabled: textColorDisabled = "var(--core-text-disabled)", labelColor: labelColor = "var(--core-text-primary)", iconLeft: iconLeft = null, clearButton: clearButton = {
43
47
  size: 20
44
- }, clearBlurs: clearBlurs = !1, disabled: disabled = !1, inputType: inputType = "text"} = props, divAttributes = tslib_es6.__rest(props, [ "name", "value", "label", "labelSize", "textSize", "placeholder", "focused", "onSubmit", "onChange", "onBlur", "onFocus", "onKeydown", "onAction", "onPaste", "onClear", "onValidate", "actionButton", "maxLength", "size", "padding", "borderRadius", "editable", "textAlign", "isValid", "inline", "noShow", "borderType", "validate", "borderColorFocused", "borderColorBlurred", "borderColorError", "backgroundColorFocused", "backgroundColorBlurred", "textColorFocused", "textColorBlurred", "textColorError", "textColorPlaceholder", "textColorDisabled", "labelColor", "iconLeft", "clearButton", "clearBlurs", "disabled", "inputType" ]), {id: divId, className: className, style: style} = divAttributes, rest = tslib_es6.__rest(divAttributes, [ "id", "className", "style" ]), divStyle = null != style ? style : {}, divClass = className ? ` ${className}` : "", input = React.useRef(null), [text, setText] = React.useState(value), [isFocused, setIsFocused] = React.useState(focused), [valid, setValid] = React.useState(isValid), [show, setShow] = React.useState(!1);
48
+ }, clearBlurs: clearBlurs = !1, disabled: disabled = !1, inputType: inputType = "text"} = props, divAttributes = tslib_es6.__rest(props, [ "name", "value", "label", "labelSize", "textSize", "placeholder", "focused", "onSubmit", "onChange", "onBlur", "onFocus", "onKeydown", "onAction", "onPaste", "onClear", "actionButton", "maxLength", "size", "padding", "borderRadius", "editable", "textAlign", "inline", "noShow", "borderType", "error", "borderColorFocused", "borderColorBlurred", "borderColorError", "backgroundColorFocused", "backgroundColorBlurred", "textColorFocused", "textColorBlurred", "textColorError", "textColorPlaceholder", "textColorDisabled", "labelColor", "iconLeft", "clearButton", "clearBlurs", "disabled", "inputType" ]), {id: divId, className: className, style: style} = divAttributes, rest = tslib_es6.__rest(divAttributes, [ "id", "className", "style" ]), divStyle = null != style ? style : {}, divClass = className ? ` ${className}` : "", input = React.useRef(null), [text, setText] = React.useState(value), [isFocused, setIsFocused] = React.useState(focused), [show, setShow] = React.useState(!1);
45
49
  React.useEffect(() => {
46
50
  input.current && (focused ? input.current.focus() : input.current.blur(), setIsFocused(focused));
47
51
  }, [ focused ]), React.useEffect(() => {
48
52
  setText(value);
49
- }, [ value ]), React.useEffect(() => {
50
- setValid(isValid);
51
- }, [ isValid ]);
52
- const textIsValid = React.useCallback(entry => {
53
- if (!validate) return;
54
- const ok = entry.length > 1 || "" === entry;
55
- setValid(ok), valid !== ok && onValidate(ok);
56
- }, [ onValidate, valid, validate ]), handleClearTextField = React.useCallback(() => {
53
+ }, [ value ]);
54
+ const handleClearTextField = React.useCallback(() => {
57
55
  var _a;
58
56
  disabled || "" === (null === (_a = input.current) || void 0 === _a ? void 0 : _a.value) || ((null == input ? void 0 : input.current) && (clearBlurs || input.current.focus(),
59
- setText(""), textIsValid("")), onChange(""), onClear());
60
- }, [ disabled, clearBlurs, onChange, onClear, textIsValid ]), handleValueChange = React.useCallback(newValue => {
61
- disabled || (setText(newValue), onChange(newValue), valid || textIsValid(text));
62
- }, [ onChange, textIsValid, text, valid, disabled ]), handleBlur = React.useCallback(() => {
63
- disabled || (textIsValid(text), setIsFocused(!1), onBlur(text));
64
- }, [ text, onBlur, textIsValid, disabled ]), handleKeyDown = React.useCallback(e => {
57
+ setText("")), onChange(""), onClear());
58
+ }, [ disabled, clearBlurs, onChange, onClear ]), handleValueChange = React.useCallback(newValue => {
59
+ disabled || (setText(newValue), onChange(newValue));
60
+ }, [ onChange, disabled ]), handleBlur = React.useCallback(() => {
61
+ disabled || (setIsFocused(!1), onBlur(text));
62
+ }, [ text, onBlur, disabled ]), handleKeyDown = React.useCallback(e => {
65
63
  var _a;
66
64
  if (!disabled) {
67
65
  if ("Enter" === e.key && (handleBlur(), onSubmit(text), null === (_a = input.current) || void 0 === _a || _a.blur()),
@@ -80,8 +78,8 @@ const MOTION_CONFIG = {
80
78
  minHeight: clearButton.size
81
79
  } : void 0, [ clearButton ]), setBackgroundColor = React.useMemo(() => inline ? "unset" : isFocused ? null != backgroundColorFocused ? backgroundColorFocused : "transparent" : null != backgroundColorBlurred ? backgroundColorBlurred : "transparent", [ inline, isFocused, backgroundColorFocused, backgroundColorBlurred ]), setBorderColor = React.useMemo(() => {
82
80
  var _a, _b;
83
- return "none" === borderType ? "transparent" : validate && !valid ? null !== (_a = null != borderColorError ? borderColorError : borderColorBlurred) && void 0 !== _a ? _a : "transparent" : isFocused ? null !== (_b = null != borderColorFocused ? borderColorFocused : borderColorBlurred) && void 0 !== _b ? _b : "transparent" : null != borderColorBlurred ? borderColorBlurred : "transparent";
84
- }, [ borderType, valid, isFocused, borderColorError, borderColorFocused, borderColorBlurred, validate ]), setBoxShadow = React.useMemo(() => "none" === borderType ? "unset" : "underline" === borderType ? `0 1px 0 0 ${setBorderColor}` : `0 0 0 1px ${setBorderColor}`, [ borderType, setBorderColor ]), textColor = React.useMemo(() => validate && !valid ? null != textColorError ? textColorError : "var(--core-text-primary)" : isFocused ? null != textColorFocused ? textColorFocused : "var(--core-text-primary)" : null != textColorBlurred ? textColorBlurred : "var(--core-text-primary)", [ isFocused, valid, textColorError, textColorFocused, textColorBlurred, validate ]), setTextAlign = React.useMemo(() => null != textAlign ? textAlign : "left", [ textAlign ]), setShowOpacity = React.useMemo(() => "password" !== inputType ? "0" : isFocused ? "1" : "0.5", [ inputType, isFocused ]), setPaddingRight = React.useMemo(() => {
81
+ return "none" === borderType ? "transparent" : error ? null !== (_a = null != borderColorError ? borderColorError : borderColorBlurred) && void 0 !== _a ? _a : "transparent" : isFocused ? null !== (_b = null != borderColorFocused ? borderColorFocused : borderColorBlurred) && void 0 !== _b ? _b : "transparent" : null != borderColorBlurred ? borderColorBlurred : "transparent";
82
+ }, [ borderType, error, isFocused, borderColorError, borderColorFocused, borderColorBlurred ]), setBoxShadow = React.useMemo(() => "none" === borderType ? "unset" : "underline" === borderType ? `0 1px 0 0 ${setBorderColor}` : `0 0 0 1px ${setBorderColor}`, [ borderType, setBorderColor ]), textColor = React.useMemo(() => error ? null != textColorError ? textColorError : "var(--core-text-primary)" : isFocused ? null != textColorFocused ? textColorFocused : "var(--core-text-primary)" : null != textColorBlurred ? textColorBlurred : "var(--core-text-primary)", [ isFocused, error, textColorError, textColorFocused, textColorBlurred ]), setTextAlign = React.useMemo(() => null != textAlign ? textAlign : "left", [ textAlign ]), setShowOpacity = React.useMemo(() => "password" !== inputType ? "0" : isFocused ? "1" : "0.5", [ inputType, isFocused ]), setPaddingRight = React.useMemo(() => {
85
83
  const defaultPadding = clearButton ? 8 : 16;
86
84
  if (!padding) return defaultPadding;
87
85
  if ("string" == typeof padding) {
@@ -186,6 +184,6 @@ const MOTION_CONFIG = {
186
184
  }) ]
187
185
  }) ]
188
186
  }));
189
- }, (prevProps, nextProps) => prevProps.value === nextProps.value && prevProps.borderType === nextProps.borderType && prevProps.borderRadius === nextProps.borderRadius && prevProps.borderColorFocused === nextProps.borderColorFocused && prevProps.borderColorBlurred === nextProps.borderColorBlurred && prevProps.borderColorError === nextProps.borderColorError && prevProps.backgroundColorFocused === nextProps.backgroundColorFocused && prevProps.backgroundColorBlurred === nextProps.backgroundColorBlurred && prevProps.textColorFocused === nextProps.textColorFocused && prevProps.textColorBlurred === nextProps.textColorBlurred && prevProps.textColorError === nextProps.textColorError && prevProps.textColorPlaceholder === nextProps.textColorPlaceholder && prevProps.textColorDisabled === nextProps.textColorDisabled && prevProps.labelColor === nextProps.labelColor && prevProps.labelSize === nextProps.labelSize && prevProps.focused === nextProps.focused && prevProps.isValid === nextProps.isValid && prevProps.validate === nextProps.validate && prevProps.disabled === nextProps.disabled && prevProps.label === nextProps.label && prevProps.inputType === nextProps.inputType && prevProps.textSize === nextProps.textSize && prevProps.padding === nextProps.padding && prevProps.textAlign === nextProps.textAlign && prevProps.placeholder === nextProps.placeholder);
187
+ }, (prevProps, nextProps) => prevProps.value === nextProps.value && prevProps.borderType === nextProps.borderType && prevProps.borderRadius === nextProps.borderRadius && prevProps.borderColorFocused === nextProps.borderColorFocused && prevProps.borderColorBlurred === nextProps.borderColorBlurred && prevProps.borderColorError === nextProps.borderColorError && prevProps.backgroundColorFocused === nextProps.backgroundColorFocused && prevProps.backgroundColorBlurred === nextProps.backgroundColorBlurred && prevProps.textColorFocused === nextProps.textColorFocused && prevProps.textColorBlurred === nextProps.textColorBlurred && prevProps.textColorError === nextProps.textColorError && prevProps.textColorPlaceholder === nextProps.textColorPlaceholder && prevProps.textColorDisabled === nextProps.textColorDisabled && prevProps.labelColor === nextProps.labelColor && prevProps.labelSize === nextProps.labelSize && prevProps.focused === nextProps.focused && prevProps.error === nextProps.error && prevProps.disabled === nextProps.disabled && prevProps.label === nextProps.label && prevProps.inputType === nextProps.inputType && prevProps.textSize === nextProps.textSize && prevProps.padding === nextProps.padding && prevProps.textAlign === nextProps.textAlign && prevProps.placeholder === nextProps.placeholder);
190
188
 
191
189
  TextField.displayName = "TextField", exports.TextField = TextField;