@alquimia-ai/ui 1.9.2 → 2.0.0
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.
- package/dist/components/atoms/index.d.mts +1 -1
- package/dist/components/atoms/index.d.ts +1 -1
- package/dist/components/atoms/index.js +1848 -1428
- package/dist/components/atoms/index.js.map +1 -1
- package/dist/components/atoms/index.mjs +1453 -1409
- package/dist/components/atoms/index.mjs.map +1 -1
- package/dist/components/hooks/index.d.mts +1 -0
- package/dist/components/hooks/index.d.ts +1 -0
- package/dist/components/hooks/index.js +572 -211
- package/dist/components/hooks/index.js.map +1 -1
- package/dist/components/hooks/index.mjs +505 -193
- package/dist/components/hooks/index.mjs.map +1 -1
- package/dist/components/molecules/documents/index.d.mts +1 -0
- package/dist/components/molecules/documents/index.d.ts +1 -0
- package/dist/components/molecules/documents/index.js +2366 -1884
- package/dist/components/molecules/documents/index.js.map +1 -1
- package/dist/components/molecules/documents/index.mjs +2207 -1764
- package/dist/components/molecules/documents/index.mjs.map +1 -1
- package/dist/components/molecules/index.js +2261 -2095
- package/dist/components/molecules/index.js.map +1 -1
- package/dist/components/molecules/index.mjs +2084 -2075
- package/dist/components/molecules/index.mjs.map +1 -1
- package/dist/components/molecules/viewers/index.js +1303 -1185
- package/dist/components/molecules/viewers/index.js.map +1 -1
- package/dist/components/molecules/viewers/index.mjs +1254 -1167
- package/dist/components/molecules/viewers/index.mjs.map +1 -1
- package/dist/components/organisms/index.d.mts +1 -0
- package/dist/components/organisms/index.d.ts +1 -0
- package/dist/components/organisms/index.js +3074 -2609
- package/dist/components/organisms/index.js.map +1 -1
- package/dist/components/organisms/index.mjs +2999 -2586
- package/dist/components/organisms/index.mjs.map +1 -1
- package/dist/components/templates/index.d.mts +25 -3
- package/dist/components/templates/index.d.ts +25 -3
- package/dist/components/templates/index.js +1490 -1300
- package/dist/components/templates/index.js.map +1 -1
- package/dist/components/templates/index.mjs +1413 -1281
- package/dist/components/templates/index.mjs.map +1 -1
- package/dist/index.d.mts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +3951 -2977
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3368 -2950
- package/dist/index.mjs.map +1 -1
- package/dist/lib/index.js +106 -54
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +42 -43
- package/dist/lib/index.mjs.map +1 -1
- package/dist/providers/index.d.mts +17 -0
- package/dist/providers/index.d.ts +17 -0
- package/dist/providers/index.js +177 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/providers/index.mjs +101 -0
- package/dist/providers/index.mjs.map +1 -0
- package/dist/styles.css +68 -0
- package/dist/styles.css.map +1 -0
- package/dist/styles.d.mts +2 -0
- package/dist/styles.d.ts +2 -0
- package/dist/tailwind.config.js +4 -10
- package/dist/types/index.d.mts +5 -5
- package/dist/types/index.d.ts +5 -5
- package/dist/types/index.js +52 -19
- package/dist/types/index.js.map +1 -1
- package/dist/types/index.mjs +6 -8
- package/dist/types/index.mjs.map +1 -1
- package/package.json +8 -7
- package/dist/components/index.d.mts +0 -23
- package/dist/components/index.d.ts +0 -23
- package/dist/components/index.js +0 -1734
- package/dist/components/index.js.map +0 -1
- package/dist/components/index.mjs +0 -1702
- package/dist/components/index.mjs.map +0 -1
- package/dist/components/templates/cards/index.d.mts +0 -26
- package/dist/components/templates/cards/index.d.ts +0 -26
- package/dist/components/templates/cards/index.js +0 -1536
- package/dist/components/templates/cards/index.js.map +0 -1
- package/dist/components/templates/cards/index.mjs +0 -1504
- package/dist/components/templates/cards/index.mjs.map +0 -1
|
@@ -1,252 +1,613 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
function _array_like_to_array(arr, len) {
|
|
3
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
4
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
5
|
+
return arr2;
|
|
6
|
+
}
|
|
7
|
+
function _array_with_holes(arr) {
|
|
8
|
+
if (Array.isArray(arr)) return arr;
|
|
9
|
+
}
|
|
10
|
+
function _array_without_holes(arr) {
|
|
11
|
+
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
12
|
+
}
|
|
13
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
14
|
+
try {
|
|
15
|
+
var info = gen[key](arg);
|
|
16
|
+
var value = info.value;
|
|
17
|
+
} catch (error) {
|
|
18
|
+
reject(error);
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
if (info.done) {
|
|
22
|
+
resolve(value);
|
|
23
|
+
} else {
|
|
24
|
+
Promise.resolve(value).then(_next, _throw);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function _async_to_generator(fn) {
|
|
28
|
+
return function() {
|
|
29
|
+
var self = this, args = arguments;
|
|
30
|
+
return new Promise(function(resolve, reject) {
|
|
31
|
+
var gen = fn.apply(self, args);
|
|
32
|
+
function _next(value) {
|
|
33
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
34
|
+
}
|
|
35
|
+
function _throw(err) {
|
|
36
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
37
|
+
}
|
|
38
|
+
_next(undefined);
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function _define_property(obj, key, value) {
|
|
43
|
+
if (key in obj) {
|
|
44
|
+
Object.defineProperty(obj, key, {
|
|
45
|
+
value: value,
|
|
46
|
+
enumerable: true,
|
|
47
|
+
configurable: true,
|
|
48
|
+
writable: true
|
|
49
|
+
});
|
|
50
|
+
} else {
|
|
51
|
+
obj[key] = value;
|
|
52
|
+
}
|
|
53
|
+
return obj;
|
|
54
|
+
}
|
|
55
|
+
function _extends() {
|
|
56
|
+
_extends = Object.assign || function(target) {
|
|
57
|
+
for(var i = 1; i < arguments.length; i++){
|
|
58
|
+
var source = arguments[i];
|
|
59
|
+
for(var key in source){
|
|
60
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
61
|
+
target[key] = source[key];
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return target;
|
|
66
|
+
};
|
|
67
|
+
return _extends.apply(this, arguments);
|
|
68
|
+
}
|
|
69
|
+
function _iterable_to_array(iter) {
|
|
70
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
71
|
+
}
|
|
72
|
+
function _iterable_to_array_limit(arr, i) {
|
|
73
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
74
|
+
if (_i == null) return;
|
|
75
|
+
var _arr = [];
|
|
76
|
+
var _n = true;
|
|
77
|
+
var _d = false;
|
|
78
|
+
var _s, _e;
|
|
79
|
+
try {
|
|
80
|
+
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
81
|
+
_arr.push(_s.value);
|
|
82
|
+
if (i && _arr.length === i) break;
|
|
83
|
+
}
|
|
84
|
+
} catch (err) {
|
|
85
|
+
_d = true;
|
|
86
|
+
_e = err;
|
|
87
|
+
} finally{
|
|
88
|
+
try {
|
|
89
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
90
|
+
} finally{
|
|
91
|
+
if (_d) throw _e;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return _arr;
|
|
95
|
+
}
|
|
96
|
+
function _non_iterable_rest() {
|
|
97
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
98
|
+
}
|
|
99
|
+
function _non_iterable_spread() {
|
|
100
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
101
|
+
}
|
|
102
|
+
function _object_destructuring_empty(o) {
|
|
103
|
+
if (o === null || o === void 0) throw new TypeError("Cannot destructure " + o);
|
|
104
|
+
return o;
|
|
105
|
+
}
|
|
106
|
+
function _object_spread(target) {
|
|
107
|
+
for(var i = 1; i < arguments.length; i++){
|
|
108
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
109
|
+
var ownKeys = Object.keys(source);
|
|
110
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
111
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
112
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
113
|
+
}));
|
|
114
|
+
}
|
|
115
|
+
ownKeys.forEach(function(key) {
|
|
116
|
+
_define_property(target, key, source[key]);
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
return target;
|
|
120
|
+
}
|
|
121
|
+
function ownKeys(object, enumerableOnly) {
|
|
122
|
+
var keys = Object.keys(object);
|
|
123
|
+
if (Object.getOwnPropertySymbols) {
|
|
124
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
125
|
+
if (enumerableOnly) {
|
|
126
|
+
symbols = symbols.filter(function(sym) {
|
|
127
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
keys.push.apply(keys, symbols);
|
|
131
|
+
}
|
|
132
|
+
return keys;
|
|
133
|
+
}
|
|
134
|
+
function _object_spread_props(target, source) {
|
|
135
|
+
source = source != null ? source : {};
|
|
136
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
137
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
138
|
+
} else {
|
|
139
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
140
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
return target;
|
|
144
|
+
}
|
|
145
|
+
function _sliced_to_array(arr, i) {
|
|
146
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
147
|
+
}
|
|
148
|
+
function _to_consumable_array(arr) {
|
|
149
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
150
|
+
}
|
|
151
|
+
function _type_of(obj) {
|
|
152
|
+
"@swc/helpers - typeof";
|
|
153
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
154
|
+
}
|
|
155
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
156
|
+
if (!o) return;
|
|
157
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
158
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
159
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
160
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
161
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
162
|
+
}
|
|
163
|
+
function _ts_generator(thisArg, body) {
|
|
164
|
+
var f, y, t, g, _ = {
|
|
165
|
+
label: 0,
|
|
166
|
+
sent: function() {
|
|
167
|
+
if (t[0] & 1) throw t[1];
|
|
168
|
+
return t[1];
|
|
169
|
+
},
|
|
170
|
+
trys: [],
|
|
171
|
+
ops: []
|
|
172
|
+
};
|
|
173
|
+
return g = {
|
|
174
|
+
next: verb(0),
|
|
175
|
+
"throw": verb(1),
|
|
176
|
+
"return": verb(2)
|
|
177
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
178
|
+
return this;
|
|
179
|
+
}), g;
|
|
180
|
+
function verb(n) {
|
|
181
|
+
return function(v) {
|
|
182
|
+
return step([
|
|
183
|
+
n,
|
|
184
|
+
v
|
|
185
|
+
]);
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
function step(op) {
|
|
189
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
190
|
+
while(_)try {
|
|
191
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
192
|
+
if (y = 0, t) op = [
|
|
193
|
+
op[0] & 2,
|
|
194
|
+
t.value
|
|
195
|
+
];
|
|
196
|
+
switch(op[0]){
|
|
197
|
+
case 0:
|
|
198
|
+
case 1:
|
|
199
|
+
t = op;
|
|
200
|
+
break;
|
|
201
|
+
case 4:
|
|
202
|
+
_.label++;
|
|
203
|
+
return {
|
|
204
|
+
value: op[1],
|
|
205
|
+
done: false
|
|
206
|
+
};
|
|
207
|
+
case 5:
|
|
208
|
+
_.label++;
|
|
209
|
+
y = op[1];
|
|
210
|
+
op = [
|
|
211
|
+
0
|
|
212
|
+
];
|
|
213
|
+
continue;
|
|
214
|
+
case 7:
|
|
215
|
+
op = _.ops.pop();
|
|
216
|
+
_.trys.pop();
|
|
217
|
+
continue;
|
|
218
|
+
default:
|
|
219
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
220
|
+
_ = 0;
|
|
221
|
+
continue;
|
|
222
|
+
}
|
|
223
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
224
|
+
_.label = op[1];
|
|
225
|
+
break;
|
|
226
|
+
}
|
|
227
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
228
|
+
_.label = t[1];
|
|
229
|
+
t = op;
|
|
230
|
+
break;
|
|
231
|
+
}
|
|
232
|
+
if (t && _.label < t[2]) {
|
|
233
|
+
_.label = t[2];
|
|
234
|
+
_.ops.push(op);
|
|
235
|
+
break;
|
|
236
|
+
}
|
|
237
|
+
if (t[2]) _.ops.pop();
|
|
238
|
+
_.trys.pop();
|
|
239
|
+
continue;
|
|
240
|
+
}
|
|
241
|
+
op = body.call(thisArg, _);
|
|
242
|
+
} catch (e) {
|
|
243
|
+
op = [
|
|
244
|
+
6,
|
|
245
|
+
e
|
|
246
|
+
];
|
|
247
|
+
y = 0;
|
|
248
|
+
} finally{
|
|
249
|
+
f = t = 0;
|
|
250
|
+
}
|
|
251
|
+
if (op[0] & 5) throw op[1];
|
|
252
|
+
return {
|
|
253
|
+
value: op[0] ? op[1] : void 0,
|
|
254
|
+
done: true
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
}
|
|
2
258
|
var __create = Object.create;
|
|
3
259
|
var __defProp = Object.defineProperty;
|
|
4
260
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
261
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
262
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
263
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all)
|
|
9
|
-
|
|
10
|
-
|
|
264
|
+
var __export = function(target, all) {
|
|
265
|
+
for(var name in all)__defProp(target, name, {
|
|
266
|
+
get: all[name],
|
|
267
|
+
enumerable: true
|
|
268
|
+
});
|
|
269
|
+
};
|
|
270
|
+
var __copyProps = function(to, from, except, desc) {
|
|
271
|
+
if (from && (typeof from === "undefined" ? "undefined" : _type_of(from)) === "object" || typeof from === "function") {
|
|
272
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
273
|
+
try {
|
|
274
|
+
var _loop = function() {
|
|
275
|
+
var key = _step.value;
|
|
276
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
277
|
+
get: function() {
|
|
278
|
+
return from[key];
|
|
279
|
+
},
|
|
280
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
281
|
+
});
|
|
282
|
+
};
|
|
283
|
+
for(var _iterator = __getOwnPropNames(from)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true)_loop();
|
|
284
|
+
} catch (err) {
|
|
285
|
+
_didIteratorError = true;
|
|
286
|
+
_iteratorError = err;
|
|
287
|
+
} finally{
|
|
288
|
+
try {
|
|
289
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
290
|
+
_iterator.return();
|
|
291
|
+
}
|
|
292
|
+
} finally{
|
|
293
|
+
if (_didIteratorError) {
|
|
294
|
+
throw _iteratorError;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
return to;
|
|
300
|
+
};
|
|
301
|
+
var __toESM = function(mod, isNodeMode, target) {
|
|
302
|
+
return target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(// If the importer is in node compatibility mode or this is not an ESM
|
|
303
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
304
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
305
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
306
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
307
|
+
value: mod,
|
|
308
|
+
enumerable: true
|
|
309
|
+
}) : target, mod);
|
|
11
310
|
};
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
311
|
+
var __toCommonJS = function(mod) {
|
|
312
|
+
return __copyProps(__defProp({}, "__esModule", {
|
|
313
|
+
value: true
|
|
314
|
+
}), mod);
|
|
19
315
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
30
316
|
// src/components/hooks/index.ts
|
|
31
317
|
var hooks_exports = {};
|
|
32
318
|
__export(hooks_exports, {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
319
|
+
reducer: function() {
|
|
320
|
+
return reducer;
|
|
321
|
+
},
|
|
322
|
+
toast: function() {
|
|
323
|
+
return toast;
|
|
324
|
+
},
|
|
325
|
+
useDocumentReader: function() {
|
|
326
|
+
return useDocumentReader;
|
|
327
|
+
},
|
|
328
|
+
useTextStreaming: function() {
|
|
329
|
+
return useTextStreaming;
|
|
330
|
+
},
|
|
331
|
+
useToast: function() {
|
|
332
|
+
return useToast;
|
|
333
|
+
}
|
|
38
334
|
});
|
|
39
335
|
module.exports = __toCommonJS(hooks_exports);
|
|
40
|
-
|
|
41
336
|
// src/components/hooks/use-toast.ts
|
|
42
337
|
var React = __toESM(require("react"));
|
|
43
338
|
var TOAST_LIMIT = 1;
|
|
44
339
|
var TOAST_REMOVE_DELAY = 1e6;
|
|
45
340
|
var count = 0;
|
|
46
341
|
function genId() {
|
|
47
|
-
|
|
48
|
-
|
|
342
|
+
count = (count + 1) % Number.MAX_SAFE_INTEGER;
|
|
343
|
+
return count.toString();
|
|
49
344
|
}
|
|
50
345
|
var toastTimeouts = /* @__PURE__ */ new Map();
|
|
51
|
-
var addToRemoveQueue = (toastId)
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
});
|
|
61
|
-
}, TOAST_REMOVE_DELAY);
|
|
62
|
-
toastTimeouts.set(toastId, timeout);
|
|
63
|
-
};
|
|
64
|
-
var reducer = (state, action) => {
|
|
65
|
-
switch (action.type) {
|
|
66
|
-
case "ADD_TOAST":
|
|
67
|
-
return {
|
|
68
|
-
...state,
|
|
69
|
-
toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT)
|
|
70
|
-
};
|
|
71
|
-
case "UPDATE_TOAST":
|
|
72
|
-
return {
|
|
73
|
-
...state,
|
|
74
|
-
toasts: state.toasts.map(
|
|
75
|
-
(t) => t.id === action.toast.id ? { ...t, ...action.toast } : t
|
|
76
|
-
)
|
|
77
|
-
};
|
|
78
|
-
case "DISMISS_TOAST": {
|
|
79
|
-
const { toastId } = action;
|
|
80
|
-
if (toastId) {
|
|
81
|
-
addToRemoveQueue(toastId);
|
|
82
|
-
} else {
|
|
83
|
-
state.toasts.forEach((toast2) => {
|
|
84
|
-
addToRemoveQueue(toast2.id);
|
|
346
|
+
var addToRemoveQueue = function(toastId) {
|
|
347
|
+
if (toastTimeouts.has(toastId)) {
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
var timeout = setTimeout(function() {
|
|
351
|
+
toastTimeouts.delete(toastId);
|
|
352
|
+
dispatch({
|
|
353
|
+
type: "REMOVE_TOAST",
|
|
354
|
+
toastId: toastId
|
|
85
355
|
});
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
356
|
+
}, TOAST_REMOVE_DELAY);
|
|
357
|
+
toastTimeouts.set(toastId, timeout);
|
|
358
|
+
};
|
|
359
|
+
var reducer = function(state, action) {
|
|
360
|
+
switch(action.type){
|
|
361
|
+
case "ADD_TOAST":
|
|
362
|
+
return _object_spread_props(_object_spread({}, state), {
|
|
363
|
+
toasts: [
|
|
364
|
+
action.toast
|
|
365
|
+
].concat(_to_consumable_array(state.toasts)).slice(0, TOAST_LIMIT)
|
|
366
|
+
});
|
|
367
|
+
case "UPDATE_TOAST":
|
|
368
|
+
return _object_spread_props(_object_spread({}, state), {
|
|
369
|
+
toasts: state.toasts.map(function(t) {
|
|
370
|
+
return t.id === action.toast.id ? _object_spread({}, t, action.toast) : t;
|
|
371
|
+
})
|
|
372
|
+
});
|
|
373
|
+
case "DISMISS_TOAST":
|
|
374
|
+
{
|
|
375
|
+
var toastId = action.toastId;
|
|
376
|
+
if (toastId) {
|
|
377
|
+
addToRemoveQueue(toastId);
|
|
378
|
+
} else {
|
|
379
|
+
state.toasts.forEach(function(toast2) {
|
|
380
|
+
addToRemoveQueue(toast2.id);
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
return _object_spread_props(_object_spread({}, state), {
|
|
384
|
+
toasts: state.toasts.map(function(t) {
|
|
385
|
+
return t.id === toastId || toastId === void 0 ? _object_spread_props(_object_spread({}, t), {
|
|
386
|
+
open: false
|
|
387
|
+
}) : t;
|
|
388
|
+
})
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
case "REMOVE_TOAST":
|
|
392
|
+
if (action.toastId === void 0) {
|
|
393
|
+
return _object_spread_props(_object_spread({}, state), {
|
|
394
|
+
toasts: []
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
return _object_spread_props(_object_spread({}, state), {
|
|
398
|
+
toasts: state.toasts.filter(function(t) {
|
|
399
|
+
return t.id !== action.toastId;
|
|
400
|
+
})
|
|
401
|
+
});
|
|
96
402
|
}
|
|
97
|
-
case "REMOVE_TOAST":
|
|
98
|
-
if (action.toastId === void 0) {
|
|
99
|
-
return {
|
|
100
|
-
...state,
|
|
101
|
-
toasts: []
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
return {
|
|
105
|
-
...state,
|
|
106
|
-
toasts: state.toasts.filter((t) => t.id !== action.toastId)
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
403
|
};
|
|
110
404
|
var listeners = [];
|
|
111
|
-
var memoryState = {
|
|
405
|
+
var memoryState = {
|
|
406
|
+
toasts: []
|
|
407
|
+
};
|
|
112
408
|
function dispatch(action) {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}
|
|
118
|
-
function toast({ ...props }) {
|
|
119
|
-
const id = genId();
|
|
120
|
-
const update = (props2) => dispatch({
|
|
121
|
-
type: "UPDATE_TOAST",
|
|
122
|
-
toast: { ...props2, id }
|
|
123
|
-
});
|
|
124
|
-
const dismiss = () => dispatch({ type: "DISMISS_TOAST", toastId: id });
|
|
125
|
-
dispatch({
|
|
126
|
-
type: "ADD_TOAST",
|
|
127
|
-
toast: {
|
|
128
|
-
...props,
|
|
129
|
-
id,
|
|
130
|
-
open: true,
|
|
131
|
-
onOpenChange: (open) => {
|
|
132
|
-
if (!open) dismiss();
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
|
-
return {
|
|
137
|
-
id,
|
|
138
|
-
dismiss,
|
|
139
|
-
update
|
|
140
|
-
};
|
|
409
|
+
memoryState = reducer(memoryState, action);
|
|
410
|
+
listeners.forEach(function(listener) {
|
|
411
|
+
listener(memoryState);
|
|
412
|
+
});
|
|
141
413
|
}
|
|
142
|
-
function
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
414
|
+
function toast(_param) {
|
|
415
|
+
var props = _extends({}, _object_destructuring_empty(_param));
|
|
416
|
+
var id = genId();
|
|
417
|
+
var update = function(props2) {
|
|
418
|
+
return dispatch({
|
|
419
|
+
type: "UPDATE_TOAST",
|
|
420
|
+
toast: _object_spread_props(_object_spread({}, props2), {
|
|
421
|
+
id: id
|
|
422
|
+
})
|
|
423
|
+
});
|
|
424
|
+
};
|
|
425
|
+
var dismiss = function() {
|
|
426
|
+
return dispatch({
|
|
427
|
+
type: "DISMISS_TOAST",
|
|
428
|
+
toastId: id
|
|
429
|
+
});
|
|
430
|
+
};
|
|
431
|
+
dispatch({
|
|
432
|
+
type: "ADD_TOAST",
|
|
433
|
+
toast: _object_spread_props(_object_spread({}, props), {
|
|
434
|
+
id: id,
|
|
435
|
+
open: true,
|
|
436
|
+
onOpenChange: function(open) {
|
|
437
|
+
if (!open) dismiss();
|
|
438
|
+
}
|
|
439
|
+
})
|
|
440
|
+
});
|
|
441
|
+
return {
|
|
442
|
+
id: id,
|
|
443
|
+
dismiss: dismiss,
|
|
444
|
+
update: update
|
|
151
445
|
};
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
446
|
+
}
|
|
447
|
+
function useToast() {
|
|
448
|
+
var _React_useState = _sliced_to_array(React.useState(memoryState), 2), state = _React_useState[0], setState = _React_useState[1];
|
|
449
|
+
React.useEffect(function() {
|
|
450
|
+
listeners.push(setState);
|
|
451
|
+
return function() {
|
|
452
|
+
var index = listeners.indexOf(setState);
|
|
453
|
+
if (index > -1) {
|
|
454
|
+
listeners.splice(index, 1);
|
|
455
|
+
}
|
|
456
|
+
};
|
|
457
|
+
}, [
|
|
458
|
+
state
|
|
459
|
+
]);
|
|
460
|
+
return _object_spread_props(_object_spread({}, state), {
|
|
461
|
+
toast: toast,
|
|
462
|
+
dismiss: function(toastId) {
|
|
463
|
+
return dispatch({
|
|
464
|
+
type: "DISMISS_TOAST",
|
|
465
|
+
toastId: toastId
|
|
466
|
+
});
|
|
467
|
+
}
|
|
468
|
+
});
|
|
469
|
+
}
|
|
160
470
|
// src/components/hooks/use-document.tsx
|
|
161
471
|
var import_react = require("react");
|
|
162
|
-
var useDocumentReader = (url, getDocument)
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
472
|
+
var useDocumentReader = function(url, getDocument) {
|
|
473
|
+
var _ref = _sliced_to_array((0, import_react.useState)(true), 2), loading = _ref[0], setLoading = _ref[1];
|
|
474
|
+
var _ref1 = _sliced_to_array((0, import_react.useState)(null), 2), error = _ref1[0], setError = _ref1[1];
|
|
475
|
+
var _ref2 = _sliced_to_array((0, import_react.useState)(null), 2), document = _ref2[0], setDocument = _ref2[1];
|
|
476
|
+
var handleDocumentError = function(error2) {
|
|
477
|
+
var errorMessage = "Hubo un error al obtener el documento. Por favor ponganse en contacto con el administrador.";
|
|
478
|
+
setError(errorMessage);
|
|
479
|
+
throw new Error((error2 === null || error2 === void 0 ? void 0 : error2.message) || "Unknown error");
|
|
480
|
+
};
|
|
481
|
+
var resetDocument = function() {
|
|
482
|
+
setDocument(null);
|
|
483
|
+
};
|
|
484
|
+
var fetchDocument = /*#__PURE__*/ function() {
|
|
485
|
+
var _ref = _async_to_generator(function() {
|
|
486
|
+
var res, error2;
|
|
487
|
+
return _ts_generator(this, function(_state) {
|
|
488
|
+
switch(_state.label){
|
|
489
|
+
case 0:
|
|
490
|
+
setLoading(true);
|
|
491
|
+
setError(null);
|
|
492
|
+
_state.label = 1;
|
|
493
|
+
case 1:
|
|
494
|
+
_state.trys.push([
|
|
495
|
+
1,
|
|
496
|
+
3,
|
|
497
|
+
4,
|
|
498
|
+
5
|
|
499
|
+
]);
|
|
500
|
+
return [
|
|
501
|
+
4,
|
|
502
|
+
getDocument(url)
|
|
503
|
+
];
|
|
504
|
+
case 2:
|
|
505
|
+
res = _state.sent();
|
|
506
|
+
if (!res.success) {
|
|
507
|
+
handleDocumentError(res.error || new Error("Unknown error"));
|
|
508
|
+
setLoading(false);
|
|
509
|
+
return [
|
|
510
|
+
2
|
|
511
|
+
];
|
|
512
|
+
}
|
|
513
|
+
res.data && setDocument(res.data);
|
|
514
|
+
return [
|
|
515
|
+
3,
|
|
516
|
+
5
|
|
517
|
+
];
|
|
518
|
+
case 3:
|
|
519
|
+
error2 = _state.sent();
|
|
520
|
+
handleDocumentError(error2);
|
|
521
|
+
return [
|
|
522
|
+
3,
|
|
523
|
+
5
|
|
524
|
+
];
|
|
525
|
+
case 4:
|
|
526
|
+
setLoading(false);
|
|
527
|
+
return [
|
|
528
|
+
7
|
|
529
|
+
];
|
|
530
|
+
case 5:
|
|
531
|
+
return [
|
|
532
|
+
2
|
|
533
|
+
];
|
|
534
|
+
}
|
|
535
|
+
});
|
|
536
|
+
});
|
|
537
|
+
return function fetchDocument() {
|
|
538
|
+
return _ref.apply(this, arguments);
|
|
539
|
+
};
|
|
540
|
+
}();
|
|
541
|
+
return {
|
|
542
|
+
document: document,
|
|
543
|
+
loading: loading,
|
|
544
|
+
fetchDocument: fetchDocument,
|
|
545
|
+
resetDocument: resetDocument,
|
|
546
|
+
error: error
|
|
547
|
+
};
|
|
192
548
|
};
|
|
193
|
-
|
|
194
549
|
// src/components/hooks/use-resize-observer.ts
|
|
195
550
|
var import_react2 = require("react");
|
|
196
|
-
|
|
197
551
|
// src/components/hooks/use-text-streaming.ts
|
|
198
552
|
var import_react3 = require("react");
|
|
199
553
|
var CHAR_DELAY = 15;
|
|
200
554
|
var PUNCTUATION_DELAY = 300;
|
|
201
555
|
function useTextStreaming(content, shouldStream, handleIsTextStreaming) {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
556
|
+
var _ref = _sliced_to_array((0, import_react3.useState)(""), 2), displayedText = _ref[0], setDisplayedText = _ref[1];
|
|
557
|
+
var contentRef = (0, import_react3.useRef)(content);
|
|
558
|
+
var indexRef = (0, import_react3.useRef)(0);
|
|
559
|
+
var timerRef = (0, import_react3.useRef)(null);
|
|
560
|
+
var hasStartedStreaming = (0, import_react3.useRef)(false);
|
|
561
|
+
(0, import_react3.useEffect)(function() {
|
|
562
|
+
contentRef.current = content;
|
|
563
|
+
if (hasStartedStreaming.current && !timerRef.current && indexRef.current < contentRef.current.length) {
|
|
564
|
+
typeNext();
|
|
565
|
+
}
|
|
566
|
+
}, [
|
|
567
|
+
content
|
|
568
|
+
]);
|
|
569
|
+
var typeNext = (0, import_react3.useCallback)(function() {
|
|
570
|
+
if (indexRef.current < contentRef.current.length) {
|
|
571
|
+
var nextChar = contentRef.current.charAt(indexRef.current);
|
|
572
|
+
setDisplayedText(function(prev) {
|
|
573
|
+
return prev + nextChar;
|
|
574
|
+
});
|
|
575
|
+
indexRef.current++;
|
|
576
|
+
var delay = /[.!?;:]/.test(nextChar) ? PUNCTUATION_DELAY : CHAR_DELAY;
|
|
577
|
+
timerRef.current = setTimeout(function() {
|
|
578
|
+
timerRef.current = null;
|
|
579
|
+
typeNext();
|
|
580
|
+
}, delay);
|
|
581
|
+
} else {
|
|
582
|
+
handleIsTextStreaming === null || handleIsTextStreaming === void 0 ? void 0 : handleIsTextStreaming(false);
|
|
583
|
+
}
|
|
584
|
+
}, []);
|
|
585
|
+
(0, import_react3.useEffect)(function() {
|
|
586
|
+
if (!shouldStream && !hasStartedStreaming.current) {
|
|
587
|
+
setDisplayedText(contentRef.current);
|
|
588
|
+
indexRef.current = contentRef.current.length;
|
|
589
|
+
if (timerRef.current) {
|
|
590
|
+
clearTimeout(timerRef.current);
|
|
591
|
+
timerRef.current = null;
|
|
592
|
+
}
|
|
593
|
+
handleIsTextStreaming === null || handleIsTextStreaming === void 0 ? void 0 : handleIsTextStreaming(false);
|
|
594
|
+
} else {
|
|
595
|
+
if (indexRef.current < contentRef.current.length && !timerRef.current) {
|
|
596
|
+
handleIsTextStreaming === null || handleIsTextStreaming === void 0 ? void 0 : handleIsTextStreaming(true);
|
|
597
|
+
hasStartedStreaming.current = true;
|
|
598
|
+
typeNext();
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
return function() {
|
|
602
|
+
if (timerRef.current) {
|
|
603
|
+
clearTimeout(timerRef.current);
|
|
604
|
+
timerRef.current = null;
|
|
605
|
+
}
|
|
606
|
+
};
|
|
607
|
+
}, [
|
|
608
|
+
shouldStream,
|
|
609
|
+
typeNext
|
|
610
|
+
]);
|
|
611
|
+
return displayedText;
|
|
251
612
|
}
|
|
252
613
|
//# sourceMappingURL=index.js.map
|