@netlify/spark-ui 0.0.46 → 0.0.47-alpha

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 (31) hide show
  1. package/dist/assets/ChatApp.css +1 -0
  2. package/dist/chunks/compat.module.BjTzMHXJ.js +296 -0
  3. package/dist/chunks/hooks.module.DeYLzLnU.js +177 -0
  4. package/dist/chunks/{useTimeout.DOkYFG64.js → useTimeout.DYuvQwFN.js} +1 -1
  5. package/dist/components/index.d.ts +1 -0
  6. package/dist/components/preact/ChatApp/ChatApp.d.ts +2 -0
  7. package/dist/components/preact/ChatApp/ChatApp.js +5346 -0
  8. package/dist/components/preact/Modal/Modal.js +1 -1
  9. package/dist/components/preact/SearchModal/components/SearchInput.js +2 -2
  10. package/dist/components/preact/SearchModal/components/SearchLink/SearchLink.js +1 -1
  11. package/dist/components/preact/SearchModal/components/SearchModal/SearchModal.js +1 -1
  12. package/dist/components/preact/SearchModal/components/SearchToggle/SearchToggle.js +1 -1
  13. package/dist/components/preact/SearchModal/components/SearchWindow.js +1 -1
  14. package/dist/components/preact/SearchModal/hooks/useKeyboardNav.js +1 -1
  15. package/dist/components/preact/SearchModal/hooks/useSearch.js +2 -2
  16. package/dist/components/preact/SearchModal/hooks/useSearchHotkeys.js +1 -1
  17. package/dist/components/preact/SearchModal/hooks/useSearchLogger.js +1 -1
  18. package/dist/components/preact/SearchModal/hooks/useSearchParams.js +1 -1
  19. package/dist/components/preact/SearchModal/hooks/useSearchToggles.js +1 -1
  20. package/dist/components/preact/index.d.ts +1 -0
  21. package/dist/components/preact/index.js +7 -5
  22. package/package.json +4 -1
  23. package/packages/components/CodeBlock.astro +208 -0
  24. package/packages/components/index.ts +1 -0
  25. package/packages/components/preact/ChatApp/ChatApp.css +142 -0
  26. package/packages/components/preact/ChatApp/ChatApp.tsx +237 -0
  27. package/packages/components/preact/index.ts +1 -0
  28. package/packages/global.d.ts +5 -0
  29. package/packages/styles/code-block.css +249 -0
  30. package/dist/chunks/compat.module.DT16W4Wr.js +0 -175
  31. package/dist/chunks/hooks.module.CNV9mxng.js +0 -138
@@ -0,0 +1,237 @@
1
+ import { useState, useRef, useEffect } from 'preact/hooks';
2
+ import * as marked from 'marked';
3
+ import { KapaProvider, useChat } from '@kapaai/react-sdk';
4
+
5
+ import './ChatApp.css';
6
+
7
+ function ChatApp() {
8
+ return (
9
+ <KapaProvider
10
+ integrationId="3c0789a6-c6a8-4fbc-b0cc-235f9e4a6351"
11
+ callbacks={{
12
+ askAI: {
13
+ onQuerySubmit: (data) => console.log('Question asked:', data.question),
14
+ },
15
+ }}
16
+ >
17
+ <ChatInterface />
18
+ </KapaProvider>
19
+ );
20
+ }
21
+
22
+ // Main App Component
23
+ const ChatInterface = () => {
24
+ const [inputMessage, setInputMessage] = useState('');
25
+ const [feedbackStates, setFeedbackStates] = useState({});
26
+ const [showCommentId, setShowCommentId] = useState(null);
27
+ const chatRef = useRef(null);
28
+ const {
29
+ conversation,
30
+ submitQuery,
31
+ isGeneratingAnswer,
32
+ isPreparingAnswer,
33
+ resetConversation,
34
+ stopGeneration,
35
+ addFeedback,
36
+ error,
37
+ } = useChat();
38
+
39
+ // Configure marked options for better code highlighting
40
+ useEffect(() => {
41
+ marked.setOptions({
42
+ breaks: true,
43
+ gfm: true,
44
+ headerIds: false,
45
+ });
46
+ }, []);
47
+
48
+ const handleSubmit = (e) => {
49
+ if (e) e.preventDefault();
50
+ if (inputMessage.trim() && !isGeneratingAnswer && !isPreparingAnswer) {
51
+ submitQuery(inputMessage);
52
+ setInputMessage('');
53
+ }
54
+ };
55
+
56
+ const handleClearThread = () => {
57
+ resetConversation();
58
+ setFeedbackStates({});
59
+ setShowCommentId(null);
60
+ };
61
+
62
+ const handleCopyText = (text) => {
63
+ navigator.clipboard.writeText(text);
64
+
65
+ // Show a temporary copied message
66
+ const target = event.currentTarget;
67
+ const buttons = document.querySelectorAll('.copy-active');
68
+ buttons.forEach((button) => {
69
+ button.classList.remove('copy-active');
70
+ const textEl = button.querySelector('.copy-text');
71
+ if (textEl) textEl.textContent = '';
72
+ });
73
+
74
+ // Now set the current button to show "Copied!"
75
+ target.classList.add('copy-active');
76
+ const textEl = target.querySelector('.copy-text');
77
+ if (textEl) textEl.textContent = 'Copied!';
78
+
79
+ setTimeout(() => {
80
+ target.classList.remove('copy-active');
81
+ if (textEl) textEl.textContent = '';
82
+ }, 2000);
83
+ };
84
+
85
+ const handleFeedback = (qaId, reaction) => {
86
+ addFeedback(qaId, reaction);
87
+
88
+ // Update local feedback state
89
+ setFeedbackStates((prev) => ({
90
+ ...prev,
91
+ [qaId]: reaction,
92
+ }));
93
+
94
+ // Close comment form if it's open
95
+ if (showCommentId === qaId) {
96
+ setShowCommentId(null);
97
+ }
98
+ };
99
+
100
+ const toggleComment = (qaId) => {
101
+ setShowCommentId(showCommentId === qaId ? null : qaId);
102
+ };
103
+
104
+ // Scroll to bottom when new messages arrive
105
+ useEffect(() => {
106
+ const el = chatRef.current;
107
+ if (el) el.scrollTop = el.scrollHeight;
108
+ }, [conversation]);
109
+
110
+ return (
111
+ <div className="chatbot-container">
112
+ <div className="chatbot-wrapper">
113
+ {/* Header */}
114
+ <header className="header">
115
+ <div className="header-left">
116
+ <h1 className="header-title">AI Chatbot</h1>
117
+ </div>
118
+ <button className="new-chat-button" aria-label="New chat" onClick={handleClearThread}>
119
+ New Chat
120
+ </button>
121
+ </header>
122
+
123
+ {/* Chat Container */}
124
+ <div ref={chatRef} className="chat-container">
125
+ {error && (
126
+ <div className="error-message">
127
+ <p className="error-title">Error</p>
128
+ <p>{error}</p>
129
+ </div>
130
+ )}
131
+
132
+ {conversation.length > 0 && (
133
+ <div className="clear-thread-button-container">
134
+ <button className="clear-thread-button" aria-label="Clear thread" onClick={handleClearThread}>
135
+ Clear thread
136
+ </button>
137
+ </div>
138
+ )}
139
+
140
+ {/* Messages */}
141
+ <div className="messages-container">
142
+ {conversation.length === 0 ? (
143
+ <div className="no-conversation-message">
144
+ <p>Ask a question to start a conversation!</p>
145
+ </div>
146
+ ) : (
147
+ conversation.map((qa, index) => (
148
+ <div key={qa.id || `qa-${index}`} className="message">
149
+ <div className="message-right">
150
+ <div className="message-bubble user-message">
151
+ <p>{qa.question}</p>
152
+ </div>
153
+ </div>
154
+
155
+ <div className="message-left">
156
+ <div className="message-bubble bot-message">
157
+ <div
158
+ className="message-answer"
159
+ dangerouslySetInnerHTML={{
160
+ __html: qa.answer
161
+ ? marked.parse(qa.answer)
162
+ : '<p class="text-gray-500">Generating answer...</p>',
163
+ }}
164
+ />
165
+
166
+ {/* Only show feedback controls when answer is completed (not during generation) */}
167
+ {qa.isFeedbackSubmissionEnabled && (
168
+ <div className="feedback-controls">
169
+ <div className="feedback-buttons">
170
+ <button
171
+ className={`feedback-button upvote ${
172
+ feedbackStates[qa.id] === 'upvote' ? 'upvoted' : ''
173
+ }`}
174
+ aria-label="Upvote"
175
+ onClick={() => qa.id && handleFeedback(qa.id, 'upvote')}
176
+ ></button>
177
+ <button
178
+ className={`feedback-button downvote ${
179
+ feedbackStates[qa.id] === 'downvote' ? 'downvoted' : ''
180
+ }`}
181
+ aria-label="Downvote"
182
+ onClick={() => qa.id && handleFeedback(qa.id, 'downvote')}
183
+ ></button>
184
+ <button
185
+ className="feedback-button copy"
186
+ onClick={(event) => handleCopyText(qa.answer)}
187
+ aria-label="Copy message"
188
+ >
189
+ <span className="copy-text"></span>
190
+ </button>
191
+ </div>
192
+ </div>
193
+ )}
194
+ </div>
195
+ </div>
196
+ </div>
197
+ ))
198
+ )}
199
+ {/* <div ref={chatRef} /> */}
200
+ </div>
201
+ </div>
202
+
203
+ {/* Input Area */}
204
+ <div className="input-area">
205
+ <form onSubmit={handleSubmit} className="input-form">
206
+ <div className="input-field">
207
+ <input
208
+ type="text"
209
+ placeholder="Type your message..."
210
+ className="input"
211
+ value={inputMessage}
212
+ onChange={(e) => setInputMessage(e.target.value)}
213
+ disabled={isGeneratingAnswer || isPreparingAnswer}
214
+ />
215
+ </div>
216
+ {isGeneratingAnswer ? (
217
+ <button type="button" className="stop-button" onClick={stopGeneration} aria-label="Stop generation">
218
+ <svg xmlns="http://www.w3.org/2000/svg" className="stop-icon" viewBox="0 0 20 20" fill="currentColor">
219
+ <rect x="6" y="6" width="8" height="8" />
220
+ </svg>
221
+ </button>
222
+ ) : (
223
+ <button
224
+ type="submit"
225
+ className="send-button"
226
+ disabled={!inputMessage.trim() || isPreparingAnswer}
227
+ aria-label="Send message"
228
+ ></button>
229
+ )}
230
+ </form>
231
+ </div>
232
+ </div>
233
+ </div>
234
+ );
235
+ };
236
+
237
+ export default ChatApp;
@@ -4,6 +4,7 @@ export { default as Icon } from './Icon';
4
4
  export { default as SearchLink } from './SearchModal/components/SearchLink/SearchLink';
5
5
  export { default as SearchHeading } from './SearchModal/components/SearchHeading/SearchHeading';
6
6
  export { default as SearchToggle } from './SearchModal/components/SearchToggle/SearchToggle';
7
+ export { default as ChatApp } from "./ChatApp/ChatApp"
7
8
  export { SearchModal } from './SearchModal';
8
9
 
9
10
  export { type IconName } from './Icon';
@@ -0,0 +1,5 @@
1
+ // Define Astro components module to avoid TypeScript errors
2
+ declare module 'astro:components' {
3
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
4
+ export const Code: any;
5
+ }
@@ -0,0 +1,249 @@
1
+ .code-block {
2
+ position: relative;
3
+ overflow: hidden;
4
+ width: 100%;
5
+ border: 1px solid var(--neutral-700);
6
+ border-radius: 6px;
7
+ font-size: 0.9em;
8
+ line-height: 1.5;
9
+ background-color: var(--neutral-800);
10
+ }
11
+
12
+ /* Title */
13
+ .code-block-title {
14
+ display: flex;
15
+ align-items: center;
16
+ gap: var(--space-s);
17
+ padding-block: var(--space-2xs);
18
+ padding-inline: var(--space-s);
19
+ border-bottom: 1px solid var(--neutral-700);
20
+ font-size: 0.9em;
21
+ color: var(--neutral-200);
22
+ }
23
+
24
+ .code-block-title .code-language {
25
+ padding: 0.1em 0.5em;
26
+ border-radius: 2px;
27
+ background-color: var(--neutral-700);
28
+ letter-spacing: 0.05em;
29
+ font-weight: 600;
30
+ text-transform: uppercase;
31
+ }
32
+
33
+ .code-block-title .code-title {
34
+ flex-grow: 1;
35
+ overflow: hidden;
36
+ text-overflow: ellipsis;
37
+ white-space: nowrap;
38
+ font-weight: 500;
39
+ }
40
+
41
+ /* Code */
42
+ .code-block .code-block-content {
43
+ position: relative;
44
+ overflow: auto;
45
+ margin: 0
46
+ }
47
+
48
+ .code-block pre {
49
+ border: 0;
50
+ border-radius: 6px;
51
+ padding-block: var(--space-m);
52
+ padding-inline: var(--space-s);
53
+ margin: 0
54
+ }
55
+
56
+ .code-block .code-block-content:not(:only-child) pre {
57
+ border-radius: 0 0 6px 6px;
58
+ }
59
+
60
+ .code-block pre:focus-visible {
61
+ outline-offset: -2px;
62
+ }
63
+
64
+ .code-block :where(pre, code) {
65
+ font-family: var(--font-monospace, monospace);
66
+ }
67
+
68
+ /* Copy button */
69
+ .code-block .copy-button {
70
+ position: absolute;
71
+ top: 0.5rem;
72
+ right: 0.5rem;
73
+ display: flex;
74
+ align-items: center;
75
+ justify-content: center;
76
+ width: 2rem;
77
+ height: 2rem;
78
+ margin: 0;
79
+ border: 1px solid var(--neutral-700);
80
+ border-radius: 4px;
81
+ background-color: var(--neutral-800);
82
+ color: var(--neutral-400);
83
+ cursor: pointer;
84
+ transition: all 0.2s ease;
85
+ }
86
+
87
+ .code-block .copy-button:hover,
88
+ .code-block .copy-button:focus {
89
+ background-color: var(--neutral-900);
90
+ color: var(--neutral-200);
91
+ outline: none;
92
+ }
93
+
94
+ .code-block .copy-button svg {
95
+ flex-shrink: 0;
96
+ width: 1rem;
97
+ height: 1rem;
98
+ margin: 0;
99
+ color: inherit;
100
+ fill: currentColor;
101
+ }
102
+
103
+ .code-block .copy-button .copy-icon {
104
+ display: block;
105
+ }
106
+
107
+ .code-block .copy-button .check-icon {
108
+ display: none;
109
+ }
110
+
111
+ /* Copy button tooltip */
112
+ .code-block .copy-button::before,
113
+ .code-block .copy-button::after {
114
+ position: absolute;
115
+ top: 50%;
116
+ transform: translateY(-50%);
117
+ opacity: 0;
118
+ visibility: hidden;
119
+ pointer-events: none;
120
+ transition: opacity 0.2s ease, visibility 0s 0.2s ease;
121
+ }
122
+
123
+ .code-block .copy-button::before {
124
+ content: attr(data-tooltip);
125
+ right: calc(100% + 10px);
126
+ padding: 0.15em 0.5em;
127
+ border-radius: 2px;
128
+ background-color: var(--color-brand-alt);
129
+ color: var(--neutral-800);
130
+ font-size: 0.9em;
131
+ white-space: nowrap;
132
+ }
133
+
134
+ .code-block .copy-button::after {
135
+ content: '';
136
+ right: calc(100%);
137
+ border: 5px solid transparent;
138
+ border-left-color: var(--color-brand-alt);
139
+ }
140
+
141
+ .code-block .copy-button:hover::before,
142
+ .code-block .copy-button:hover::after,
143
+ .code-block .copy-button:focus::before,
144
+ .code-block .copy-button:focus::after,
145
+ .code-block .copy-button.copied::before,
146
+ .code-block .copy-button.copied::after,
147
+ .code-block .copy-button.error::before,
148
+ .code-block .copy-button.error::after {
149
+ opacity: 1;
150
+ visibility: visible;
151
+ transition: opacity 0.2s ease;
152
+ }
153
+
154
+ .code-block .copy-button.copied .copy-icon {
155
+ display: none;
156
+ }
157
+
158
+ .code-block .copy-button.copied .check-icon {
159
+ display: block;
160
+ }
161
+
162
+ .code-block .copy-button.error::before {
163
+ background-color: var(--red-500);
164
+ }
165
+
166
+ .code-block .copy-button.error::after {
167
+ border-left-color: var(--red-500);
168
+ }
169
+
170
+ /* Frame styling */
171
+ .code-block.terminal-frame {
172
+ background-color: #1e1e1e;
173
+ }
174
+
175
+ .code-block.terminal-frame::before {
176
+ position: relative;
177
+ display: block;
178
+ content: '';
179
+ height: 1.6rem;
180
+ background-color: var(--neutral-800);
181
+ border-bottom: 1px solid var(--neutral-700);
182
+ }
183
+
184
+ .code-block.terminal-frame::after {
185
+ position: absolute;
186
+ top: 0.5rem;
187
+ left: 1rem;
188
+ width: 0.6rem;
189
+ height: 0.6rem;
190
+ content: '';
191
+ border-radius: 50%;
192
+ background-color: var(--neutral-600);
193
+ box-shadow: 1.25rem 0 0 var(--neutral-600), 2.5rem 0 0 var(--neutral-600);
194
+ }
195
+
196
+ /* Line highlighting styles */
197
+ .code-block [data-highlighted-line],
198
+ .code-block .line.focused,
199
+ .code-block .line:has(.focus),
200
+ .code-block .line:has(.highlighted),
201
+ .code-block pre.has-focused .line.focused {
202
+ background-color: color-mix(in srgb, var(--neutral-000) 10%, transparent);
203
+ display: inline-block;
204
+ width: 100%;
205
+ }
206
+
207
+ .code-block [data-deleted-line],
208
+ .code-block .line.diff.remove,
209
+ .code-block .line:has(.diff.remove),
210
+ .code-block .line:has(.deleted),
211
+ .code-block .line:has(.diff-remove) {
212
+ background-color: color-mix(in srgb, var(--red-500) 30%, transparent);
213
+ text-decoration: line-through;
214
+ text-decoration-color: var(--neutral-400);
215
+ opacity: 0.7;
216
+ }
217
+
218
+ .code-block [data-inserted-line],
219
+ .code-block .line.diff.add,
220
+ .code-block .line:has(.diff.add),
221
+ .code-block .line:has(.inserted),
222
+ .code-block .line:has(.diff-add) {
223
+ background-color: color-mix(in srgb, var(--green-500) 30%, transparent);
224
+ }
225
+
226
+ /* Line numbers styling */
227
+ .code-block.with-line-numbers pre {
228
+ padding-left: var(--space-xl);
229
+ counter-reset: line;
230
+ }
231
+
232
+ .code-block.with-line-numbers code>span {
233
+ position: relative;
234
+ }
235
+
236
+ .code-block.with-line-numbers code>span::before {
237
+ position: absolute;
238
+ left: -2.5rem;
239
+ width: 2rem;
240
+ padding-right: var(--space-2xs);
241
+ border-right: 1px solid var(--neutral-700);
242
+ counter-increment: line;
243
+ content: counter(line);
244
+ user-select: none;
245
+ color: var(--neutral-500);
246
+ font-size: 0.9em;
247
+ line-height: 1.75;
248
+ text-align: right;
249
+ }
@@ -1,175 +0,0 @@
1
- import { Component as f, options as a, createElement as d, Fragment as h, toChildArray as v } from "preact";
2
- import "./hooks.module.CNV9mxng.js";
3
- function C(e, t) {
4
- for (var r in t) e[r] = t[r];
5
- return e;
6
- }
7
- function m(e, t) {
8
- for (var r in e) if (r !== "__source" && !(r in t)) return !0;
9
- for (var o in t) if (o !== "__source" && e[o] !== t[o]) return !0;
10
- return !1;
11
- }
12
- function y(e, t) {
13
- this.props = e, this.context = t;
14
- }
15
- (y.prototype = new f()).isPureReactComponent = !0, y.prototype.shouldComponentUpdate = function(e, t) {
16
- return m(this.props, e) || m(this.state, t);
17
- };
18
- var b = a.__b;
19
- a.__b = function(e) {
20
- e.type && e.type.__f && e.ref && (e.props.ref = e.ref, e.ref = null), b && b(e);
21
- };
22
- var x = typeof Symbol < "u" && Symbol.for && Symbol.for("react.forward_ref") || 3911;
23
- function z(e) {
24
- function t(r) {
25
- var o = C({}, r);
26
- return delete o.ref, e(o, r.ref || null);
27
- }
28
- return t.$$typeof = x, t.render = t, t.prototype.isReactComponent = t.__f = !0, t.displayName = "ForwardRef(" + (e.displayName || e.name) + ")", t;
29
- }
30
- var U = a.__e;
31
- a.__e = function(e, t, r, o) {
32
- if (e.then) {
33
- for (var n, l = t; l = l.__; ) if ((n = l.__c) && n.__c) return t.__e == null && (t.__e = r.__e, t.__k = r.__k), n.__c(e, t);
34
- }
35
- U(e, t, r, o);
36
- };
37
- var g = a.unmount;
38
- function N(e, t, r) {
39
- return e && (e.__c && e.__c.__H && (e.__c.__H.__.forEach(function(o) {
40
- typeof o.__c == "function" && o.__c();
41
- }), e.__c.__H = null), (e = C({}, e)).__c != null && (e.__c.__P === r && (e.__c.__P = t), e.__c.__e = !0, e.__c = null), e.__k = e.__k && e.__k.map(function(o) {
42
- return N(o, t, r);
43
- })), e;
44
- }
45
- function E(e, t, r) {
46
- return e && r && (e.__v = null, e.__k = e.__k && e.__k.map(function(o) {
47
- return E(o, t, r);
48
- }), e.__c && e.__c.__P === t && (e.__e && r.appendChild(e.__e), e.__c.__e = !0, e.__c.__P = r)), e;
49
- }
50
- function p() {
51
- this.__u = 0, this.o = null, this.__b = null;
52
- }
53
- function R(e) {
54
- var t = e.__.__c;
55
- return t && t.__a && t.__a(e);
56
- }
57
- function s() {
58
- this.i = null, this.l = null;
59
- }
60
- a.unmount = function(e) {
61
- var t = e.__c;
62
- t && t.__R && t.__R(), t && 32 & e.__u && (e.type = null), g && g(e);
63
- }, (p.prototype = new f()).__c = function(e, t) {
64
- var r = t.__c, o = this;
65
- o.o == null && (o.o = []), o.o.push(r);
66
- var n = R(o.__v), l = !1, _ = function() {
67
- l || (l = !0, r.__R = null, n ? n(i) : i());
68
- };
69
- r.__R = _;
70
- var i = function() {
71
- if (!--o.__u) {
72
- if (o.state.__a) {
73
- var u = o.state.__a;
74
- o.__v.__k[0] = E(u, u.__c.__P, u.__c.__O);
75
- }
76
- var c;
77
- for (o.setState({ __a: o.__b = null }); c = o.o.pop(); ) c.forceUpdate();
78
- }
79
- };
80
- o.__u++ || 32 & t.__u || o.setState({ __a: o.__b = o.__v.__k[0] }), e.then(_, _);
81
- }, p.prototype.componentWillUnmount = function() {
82
- this.o = [];
83
- }, p.prototype.render = function(e, t) {
84
- if (this.__b) {
85
- if (this.__v.__k) {
86
- var r = document.createElement("div"), o = this.__v.__k[0].__c;
87
- this.__v.__k[0] = N(this.__b, r, o.__O = o.__P);
88
- }
89
- this.__b = null;
90
- }
91
- var n = t.__a && d(h, null, e.fallback);
92
- return n && (n.__u &= -33), [d(h, null, t.__a ? null : e.children), n];
93
- };
94
- var k = function(e, t, r) {
95
- if (++r[1] === r[0] && e.l.delete(t), e.props.revealOrder && (e.props.revealOrder[0] !== "t" || !e.l.size)) for (r = e.i; r; ) {
96
- for (; r.length > 3; ) r.pop()();
97
- if (r[1] < r[0]) break;
98
- e.i = r = r[2];
99
- }
100
- };
101
- (s.prototype = new f()).__a = function(e) {
102
- var t = this, r = R(t.__v), o = t.l.get(e);
103
- return o[0]++, function(n) {
104
- var l = function() {
105
- t.props.revealOrder ? (o.push(n), k(t, e, o)) : n();
106
- };
107
- r ? r(l) : l();
108
- };
109
- }, s.prototype.render = function(e) {
110
- this.i = null, this.l = /* @__PURE__ */ new Map();
111
- var t = v(e.children);
112
- e.revealOrder && e.revealOrder[0] === "b" && t.reverse();
113
- for (var r = t.length; r--; ) this.l.set(t[r], this.i = [1, 0, this.i]);
114
- return e.children;
115
- }, s.prototype.componentDidUpdate = s.prototype.componentDidMount = function() {
116
- var e = this;
117
- this.l.forEach(function(t, r) {
118
- k(e, r, t);
119
- });
120
- };
121
- var A = typeof Symbol < "u" && Symbol.for && Symbol.for("react.element") || 60103, V = /^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/, W = /^on(Ani|Tra|Tou|BeforeInp|Compo)/, H = /[A-Z0-9]/g, $ = typeof document < "u", j = function(e) {
122
- return (typeof Symbol < "u" && typeof Symbol() == "symbol" ? /fil|che|rad/ : /fil|che|ra/).test(e);
123
- };
124
- f.prototype.isReactComponent = {}, ["componentWillMount", "componentWillReceiveProps", "componentWillUpdate"].forEach(function(e) {
125
- Object.defineProperty(f.prototype, e, { configurable: !0, get: function() {
126
- return this["UNSAFE_" + e];
127
- }, set: function(t) {
128
- Object.defineProperty(this, e, { configurable: !0, writable: !0, value: t });
129
- } });
130
- });
131
- var P = a.event;
132
- function D() {
133
- }
134
- function F() {
135
- return this.cancelBubble;
136
- }
137
- function B() {
138
- return this.defaultPrevented;
139
- }
140
- a.event = function(e) {
141
- return P && (e = P(e)), e.persist = D, e.isPropagationStopped = F, e.isDefaultPrevented = B, e.nativeEvent = e;
142
- };
143
- var L = { enumerable: !1, configurable: !0, get: function() {
144
- return this.class;
145
- } }, O = a.vnode;
146
- a.vnode = function(e) {
147
- typeof e.type == "string" && function(t) {
148
- var r = t.props, o = t.type, n = {}, l = o.indexOf("-") === -1;
149
- for (var _ in r) {
150
- var i = r[_];
151
- if (!(_ === "value" && "defaultValue" in r && i == null || $ && _ === "children" && o === "noscript" || _ === "class" || _ === "className")) {
152
- var u = _.toLowerCase();
153
- _ === "defaultValue" && "value" in r && r.value == null ? _ = "value" : _ === "download" && i === !0 ? i = "" : u === "translate" && i === "no" ? i = !1 : u[0] === "o" && u[1] === "n" ? u === "ondoubleclick" ? _ = "ondblclick" : u !== "onchange" || o !== "input" && o !== "textarea" || j(r.type) ? u === "onfocus" ? _ = "onfocusin" : u === "onblur" ? _ = "onfocusout" : W.test(_) && (_ = u) : u = _ = "oninput" : l && V.test(_) ? _ = _.replace(H, "-$&").toLowerCase() : i === null && (i = void 0), u === "oninput" && n[_ = u] && (_ = "oninputCapture"), n[_] = i;
154
- }
155
- }
156
- o == "select" && n.multiple && Array.isArray(n.value) && (n.value = v(r.children).forEach(function(c) {
157
- c.props.selected = n.value.indexOf(c.props.value) != -1;
158
- })), o == "select" && n.defaultValue != null && (n.value = v(r.children).forEach(function(c) {
159
- c.props.selected = n.multiple ? n.defaultValue.indexOf(c.props.value) != -1 : n.defaultValue == c.props.value;
160
- })), r.class && !r.className ? (n.class = r.class, Object.defineProperty(n, "className", L)) : (r.className && !r.class || r.class && r.className) && (n.class = n.className = r.className), t.props = n;
161
- }(e), e.$$typeof = A, O && O(e);
162
- };
163
- var S = a.__r;
164
- a.__r = function(e) {
165
- S && S(e), e.__c;
166
- };
167
- var w = a.diffed;
168
- a.diffed = function(e) {
169
- w && w(e);
170
- var t = e.props, r = e.__e;
171
- r != null && e.type === "textarea" && "value" in t && t.value !== r.value && (r.value = t.value == null ? "" : t.value);
172
- };
173
- export {
174
- z as D
175
- };