code7-leia 0.2.10 → 0.2.11

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 (57) hide show
  1. package/dist/Leia.d.ts +3 -0
  2. package/dist/code7-leia.cjs.development.js +2333 -0
  3. package/dist/code7-leia.cjs.development.js.map +1 -0
  4. package/dist/code7-leia.cjs.production.min.js +2 -0
  5. package/dist/code7-leia.cjs.production.min.js.map +1 -0
  6. package/dist/code7-leia.esm.js +2325 -0
  7. package/dist/code7-leia.esm.js.map +1 -0
  8. package/dist/components/CustomToast/index.d.ts +13 -0
  9. package/dist/components/CustomToast/styles.d.ts +6 -0
  10. package/dist/components/EmptyState/index.d.ts +16 -0
  11. package/dist/components/EmptyState/styles.d.ts +8 -0
  12. package/dist/components/FileArea/components/AreaUpload/index.d.ts +24 -0
  13. package/dist/components/FileArea/components/AreaUpload/styles.d.ts +9 -0
  14. package/dist/components/FileArea/components/Modal/ModalButtonClose.d.ts +6 -0
  15. package/dist/components/FileArea/components/Modal/ModalContent.d.ts +8 -0
  16. package/dist/components/FileArea/components/Modal/ModalFooter.d.ts +6 -0
  17. package/dist/components/FileArea/components/Modal/ModalHeader.d.ts +6 -0
  18. package/dist/components/FileArea/components/Modal/ModalTitle.d.ts +6 -0
  19. package/dist/components/FileArea/components/Modal/index.d.ts +22 -0
  20. package/dist/components/FileArea/components/Modal/styles.d.ts +26 -0
  21. package/dist/components/FileArea/components/Search/index.d.ts +9 -0
  22. package/dist/components/FileArea/components/Search/styles.d.ts +4 -0
  23. package/dist/components/FileArea/components/Spinner/index.d.ts +4 -0
  24. package/dist/components/FileArea/components/Spinner/styles.d.ts +2 -0
  25. package/dist/components/FileArea/components/Table/index.d.ts +4 -0
  26. package/dist/components/FileArea/components/Table/styles.d.ts +4 -0
  27. package/dist/components/FileArea/index.d.ts +2 -0
  28. package/dist/components/FileArea/styles.d.ts +7 -0
  29. package/dist/components/MultiSelect/index.d.ts +17 -0
  30. package/dist/components/MultiSelect/styles.d.ts +8 -0
  31. package/dist/components/Select/index.d.ts +12 -0
  32. package/dist/components/Select/styles.d.ts +2 -0
  33. package/dist/components/Tabs/index.d.ts +35 -0
  34. package/dist/components/Tabs/styles.d.ts +13 -0
  35. package/dist/components/TestArea/components/InputTest/index.d.ts +7 -0
  36. package/dist/components/TestArea/components/InputTest/styles.d.ts +4 -0
  37. package/dist/components/TestArea/index.d.ts +2 -0
  38. package/dist/components/TestArea/styles.d.ts +9 -0
  39. package/dist/contexts/SharedPropsProvider.d.ts +17 -0
  40. package/dist/index.d.ts +10 -0
  41. package/dist/index.js +8 -0
  42. package/dist/interface/FileData.d.ts +10 -0
  43. package/dist/interface/Language.d.ts +89 -0
  44. package/dist/interface/Table.d.ts +12 -0
  45. package/dist/service/Api.d.ts +3 -0
  46. package/dist/store/index.d.ts +10 -0
  47. package/dist/store/modules/actions.d.ts +87 -0
  48. package/dist/store/modules/reducer.d.ts +13 -0
  49. package/dist/store/modules/sagas.d.ts +26 -0
  50. package/dist/store/modules/types.d.ts +18 -0
  51. package/dist/utils/formatAxios.d.ts +3 -0
  52. package/dist/utils/getLanguage.d.ts +2 -0
  53. package/dist/utils/languages/en.d.ts +2 -0
  54. package/dist/utils/languages/es.d.ts +2 -0
  55. package/dist/utils/languages/pt-br.d.ts +2 -0
  56. package/package.json +1 -1
  57. package/src/components/FileArea/index.tsx +4 -1
@@ -0,0 +1,2325 @@
1
+ import { useDispatch, useSelector, Provider } from 'react-redux';
2
+ import React, { forwardRef, useRef, useCallback, useEffect, useState, createContext, useContext, useMemo, Suspense } from 'react';
3
+ import { useRouteMatch, useLocation, useHistory, Switch, Route } from 'react-router-dom';
4
+ import PropTypes from 'prop-types';
5
+ import cc from 'classcat';
6
+ import styled, { css } from 'styled-components';
7
+ import { renderToString } from 'react-dom/server';
8
+ import { FaSearch, FaUpload, FaList, FaCheck, FaFile } from 'react-icons/fa';
9
+ import { GiWeightLiftingUp } from 'react-icons/gi';
10
+ import { TiDelete } from 'react-icons/ti';
11
+ import unorm from 'unorm';
12
+ import { MdClose, MdPerson2 } from 'react-icons/md';
13
+ import { useDropzone } from 'react-dropzone';
14
+ import axios from 'axios';
15
+ import { PiWaveformBold } from 'react-icons/pi';
16
+ import { createStore, applyMiddleware } from 'redux';
17
+ import createSagaMiddleware from 'redux-saga';
18
+ import { produce } from 'immer';
19
+ import { all, takeLatest, put, call } from 'redux-saga/effects';
20
+ import { toast as toast$1 } from 'react-toastify';
21
+ import 'react-toastify/dist/ReactToastify.css';
22
+
23
+ function _regeneratorRuntime() {
24
+ _regeneratorRuntime = function () {
25
+ return e;
26
+ };
27
+ var t,
28
+ e = {},
29
+ r = Object.prototype,
30
+ n = r.hasOwnProperty,
31
+ o = Object.defineProperty || function (t, e, r) {
32
+ t[e] = r.value;
33
+ },
34
+ i = "function" == typeof Symbol ? Symbol : {},
35
+ a = i.iterator || "@@iterator",
36
+ c = i.asyncIterator || "@@asyncIterator",
37
+ u = i.toStringTag || "@@toStringTag";
38
+ function define(t, e, r) {
39
+ return Object.defineProperty(t, e, {
40
+ value: r,
41
+ enumerable: !0,
42
+ configurable: !0,
43
+ writable: !0
44
+ }), t[e];
45
+ }
46
+ try {
47
+ define({}, "");
48
+ } catch (t) {
49
+ define = function (t, e, r) {
50
+ return t[e] = r;
51
+ };
52
+ }
53
+ function wrap(t, e, r, n) {
54
+ var i = e && e.prototype instanceof Generator ? e : Generator,
55
+ a = Object.create(i.prototype),
56
+ c = new Context(n || []);
57
+ return o(a, "_invoke", {
58
+ value: makeInvokeMethod(t, r, c)
59
+ }), a;
60
+ }
61
+ function tryCatch(t, e, r) {
62
+ try {
63
+ return {
64
+ type: "normal",
65
+ arg: t.call(e, r)
66
+ };
67
+ } catch (t) {
68
+ return {
69
+ type: "throw",
70
+ arg: t
71
+ };
72
+ }
73
+ }
74
+ e.wrap = wrap;
75
+ var h = "suspendedStart",
76
+ l = "suspendedYield",
77
+ f = "executing",
78
+ s = "completed",
79
+ y = {};
80
+ function Generator() {}
81
+ function GeneratorFunction() {}
82
+ function GeneratorFunctionPrototype() {}
83
+ var p = {};
84
+ define(p, a, function () {
85
+ return this;
86
+ });
87
+ var d = Object.getPrototypeOf,
88
+ v = d && d(d(values([])));
89
+ v && v !== r && n.call(v, a) && (p = v);
90
+ var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
91
+ function defineIteratorMethods(t) {
92
+ ["next", "throw", "return"].forEach(function (e) {
93
+ define(t, e, function (t) {
94
+ return this._invoke(e, t);
95
+ });
96
+ });
97
+ }
98
+ function AsyncIterator(t, e) {
99
+ function invoke(r, o, i, a) {
100
+ var c = tryCatch(t[r], t, o);
101
+ if ("throw" !== c.type) {
102
+ var u = c.arg,
103
+ h = u.value;
104
+ return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
105
+ invoke("next", t, i, a);
106
+ }, function (t) {
107
+ invoke("throw", t, i, a);
108
+ }) : e.resolve(h).then(function (t) {
109
+ u.value = t, i(u);
110
+ }, function (t) {
111
+ return invoke("throw", t, i, a);
112
+ });
113
+ }
114
+ a(c.arg);
115
+ }
116
+ var r;
117
+ o(this, "_invoke", {
118
+ value: function (t, n) {
119
+ function callInvokeWithMethodAndArg() {
120
+ return new e(function (e, r) {
121
+ invoke(t, n, e, r);
122
+ });
123
+ }
124
+ return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
125
+ }
126
+ });
127
+ }
128
+ function makeInvokeMethod(e, r, n) {
129
+ var o = h;
130
+ return function (i, a) {
131
+ if (o === f) throw new Error("Generator is already running");
132
+ if (o === s) {
133
+ if ("throw" === i) throw a;
134
+ return {
135
+ value: t,
136
+ done: !0
137
+ };
138
+ }
139
+ for (n.method = i, n.arg = a;;) {
140
+ var c = n.delegate;
141
+ if (c) {
142
+ var u = maybeInvokeDelegate(c, n);
143
+ if (u) {
144
+ if (u === y) continue;
145
+ return u;
146
+ }
147
+ }
148
+ if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
149
+ if (o === h) throw o = s, n.arg;
150
+ n.dispatchException(n.arg);
151
+ } else "return" === n.method && n.abrupt("return", n.arg);
152
+ o = f;
153
+ var p = tryCatch(e, r, n);
154
+ if ("normal" === p.type) {
155
+ if (o = n.done ? s : l, p.arg === y) continue;
156
+ return {
157
+ value: p.arg,
158
+ done: n.done
159
+ };
160
+ }
161
+ "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
162
+ }
163
+ };
164
+ }
165
+ function maybeInvokeDelegate(e, r) {
166
+ var n = r.method,
167
+ o = e.iterator[n];
168
+ if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
169
+ var i = tryCatch(o, e.iterator, r.arg);
170
+ if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
171
+ var a = i.arg;
172
+ return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
173
+ }
174
+ function pushTryEntry(t) {
175
+ var e = {
176
+ tryLoc: t[0]
177
+ };
178
+ 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
179
+ }
180
+ function resetTryEntry(t) {
181
+ var e = t.completion || {};
182
+ e.type = "normal", delete e.arg, t.completion = e;
183
+ }
184
+ function Context(t) {
185
+ this.tryEntries = [{
186
+ tryLoc: "root"
187
+ }], t.forEach(pushTryEntry, this), this.reset(!0);
188
+ }
189
+ function values(e) {
190
+ if (e || "" === e) {
191
+ var r = e[a];
192
+ if (r) return r.call(e);
193
+ if ("function" == typeof e.next) return e;
194
+ if (!isNaN(e.length)) {
195
+ var o = -1,
196
+ i = function next() {
197
+ for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
198
+ return next.value = t, next.done = !0, next;
199
+ };
200
+ return i.next = i;
201
+ }
202
+ }
203
+ throw new TypeError(typeof e + " is not iterable");
204
+ }
205
+ return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
206
+ value: GeneratorFunctionPrototype,
207
+ configurable: !0
208
+ }), o(GeneratorFunctionPrototype, "constructor", {
209
+ value: GeneratorFunction,
210
+ configurable: !0
211
+ }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
212
+ var e = "function" == typeof t && t.constructor;
213
+ return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
214
+ }, e.mark = function (t) {
215
+ return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
216
+ }, e.awrap = function (t) {
217
+ return {
218
+ __await: t
219
+ };
220
+ }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
221
+ return this;
222
+ }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
223
+ void 0 === i && (i = Promise);
224
+ var a = new AsyncIterator(wrap(t, r, n, o), i);
225
+ return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
226
+ return t.done ? t.value : a.next();
227
+ });
228
+ }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
229
+ return this;
230
+ }), define(g, "toString", function () {
231
+ return "[object Generator]";
232
+ }), e.keys = function (t) {
233
+ var e = Object(t),
234
+ r = [];
235
+ for (var n in e) r.push(n);
236
+ return r.reverse(), function next() {
237
+ for (; r.length;) {
238
+ var t = r.pop();
239
+ if (t in e) return next.value = t, next.done = !1, next;
240
+ }
241
+ return next.done = !0, next;
242
+ };
243
+ }, e.values = values, Context.prototype = {
244
+ constructor: Context,
245
+ reset: function (e) {
246
+ if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
247
+ },
248
+ stop: function () {
249
+ this.done = !0;
250
+ var t = this.tryEntries[0].completion;
251
+ if ("throw" === t.type) throw t.arg;
252
+ return this.rval;
253
+ },
254
+ dispatchException: function (e) {
255
+ if (this.done) throw e;
256
+ var r = this;
257
+ function handle(n, o) {
258
+ return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
259
+ }
260
+ for (var o = this.tryEntries.length - 1; o >= 0; --o) {
261
+ var i = this.tryEntries[o],
262
+ a = i.completion;
263
+ if ("root" === i.tryLoc) return handle("end");
264
+ if (i.tryLoc <= this.prev) {
265
+ var c = n.call(i, "catchLoc"),
266
+ u = n.call(i, "finallyLoc");
267
+ if (c && u) {
268
+ if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
269
+ if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
270
+ } else if (c) {
271
+ if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
272
+ } else {
273
+ if (!u) throw new Error("try statement without catch or finally");
274
+ if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
275
+ }
276
+ }
277
+ }
278
+ },
279
+ abrupt: function (t, e) {
280
+ for (var r = this.tryEntries.length - 1; r >= 0; --r) {
281
+ var o = this.tryEntries[r];
282
+ if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
283
+ var i = o;
284
+ break;
285
+ }
286
+ }
287
+ i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
288
+ var a = i ? i.completion : {};
289
+ return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
290
+ },
291
+ complete: function (t, e) {
292
+ if ("throw" === t.type) throw t.arg;
293
+ return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
294
+ },
295
+ finish: function (t) {
296
+ for (var e = this.tryEntries.length - 1; e >= 0; --e) {
297
+ var r = this.tryEntries[e];
298
+ if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
299
+ }
300
+ },
301
+ catch: function (t) {
302
+ for (var e = this.tryEntries.length - 1; e >= 0; --e) {
303
+ var r = this.tryEntries[e];
304
+ if (r.tryLoc === t) {
305
+ var n = r.completion;
306
+ if ("throw" === n.type) {
307
+ var o = n.arg;
308
+ resetTryEntry(r);
309
+ }
310
+ return o;
311
+ }
312
+ }
313
+ throw new Error("illegal catch attempt");
314
+ },
315
+ delegateYield: function (e, r, n) {
316
+ return this.delegate = {
317
+ iterator: values(e),
318
+ resultName: r,
319
+ nextLoc: n
320
+ }, "next" === this.method && (this.arg = t), y;
321
+ }
322
+ }, e;
323
+ }
324
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
325
+ try {
326
+ var info = gen[key](arg);
327
+ var value = info.value;
328
+ } catch (error) {
329
+ reject(error);
330
+ return;
331
+ }
332
+ if (info.done) {
333
+ resolve(value);
334
+ } else {
335
+ Promise.resolve(value).then(_next, _throw);
336
+ }
337
+ }
338
+ function _asyncToGenerator(fn) {
339
+ return function () {
340
+ var self = this,
341
+ args = arguments;
342
+ return new Promise(function (resolve, reject) {
343
+ var gen = fn.apply(self, args);
344
+ function _next(value) {
345
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
346
+ }
347
+ function _throw(err) {
348
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
349
+ }
350
+ _next(undefined);
351
+ });
352
+ };
353
+ }
354
+ function _extends() {
355
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
356
+ for (var i = 1; i < arguments.length; i++) {
357
+ var source = arguments[i];
358
+ for (var key in source) {
359
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
360
+ target[key] = source[key];
361
+ }
362
+ }
363
+ }
364
+ return target;
365
+ };
366
+ return _extends.apply(this, arguments);
367
+ }
368
+ function _objectWithoutPropertiesLoose(source, excluded) {
369
+ if (source == null) return {};
370
+ var target = {};
371
+ var sourceKeys = Object.keys(source);
372
+ var key, i;
373
+ for (i = 0; i < sourceKeys.length; i++) {
374
+ key = sourceKeys[i];
375
+ if (excluded.indexOf(key) >= 0) continue;
376
+ target[key] = source[key];
377
+ }
378
+ return target;
379
+ }
380
+ function _taggedTemplateLiteralLoose(strings, raw) {
381
+ if (!raw) {
382
+ raw = strings.slice(0);
383
+ }
384
+ strings.raw = raw;
385
+ return strings;
386
+ }
387
+
388
+ var _templateObject, _templateObject2;
389
+ var TabsPane = /*#__PURE__*/styled.ul(_templateObject || (_templateObject = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n width: max-content;\n display: flex;\n align-items: center;\n border-bottom: 1px solid var(--neutral-1);\n"])));
390
+ var Tab = /*#__PURE__*/styled.li(_templateObject2 || (_templateObject2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n padding: 12px;\n color: var(--neutral-3);\n font-size: 0.875rem;\n font-weight: normal;\n position: relative;\n cursor: pointer;\n\n svg {\n fill: var(--neutral-3) !important;\n margin-left: 8px;\n }\n\n &.active {\n color: var(--primary-700-light);\n\n svg {\n fill: var(--primary-700-light) !important;\n }\n\n ::after {\n content: '';\n position: absolute;\n bottom: 0;\n left: 0;\n width: 100%;\n height: 2px;\n background-color: var(--primary-700-light);\n }\n }\n\n &:not(:last-child) {\n margin-right: 8px;\n }\n"])));
391
+
392
+ var _excluded = ["active", "children"],
393
+ _excluded2 = ["children", "value", "onChange"];
394
+ var Tab$1 = function Tab$1(_ref) {
395
+ var active = _ref.active,
396
+ children = _ref.children,
397
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded);
398
+ return React.createElement(Tab, Object.assign({
399
+ className: cc({
400
+ active: active
401
+ })
402
+ }, rest), children);
403
+ };
404
+ Tab$1.propTypes = {
405
+ children: /*#__PURE__*/PropTypes.oneOfType([PropTypes.string, PropTypes.element, PropTypes.node]).isRequired,
406
+ onChange: PropTypes.func,
407
+ value: PropTypes.string,
408
+ active: PropTypes.bool
409
+ };
410
+ Tab$1.defaultProps = {
411
+ onChange: function onChange() {},
412
+ value: '',
413
+ active: false
414
+ };
415
+ var Tabs = function Tabs(_ref2) {
416
+ var childrenProp = _ref2.children,
417
+ value = _ref2.value,
418
+ onChange = _ref2.onChange,
419
+ rest = _objectWithoutPropertiesLoose(_ref2, _excluded2);
420
+ var children = React.Children.map(childrenProp, function (child) {
421
+ var _child$props, _child$props3;
422
+ if (!React.isValidElement(child)) {
423
+ return null;
424
+ }
425
+ if (Array.isArray((_child$props = child.props) == null ? void 0 : _child$props.children)) {
426
+ var _child$props2;
427
+ return React.cloneElement(child, {
428
+ active: ((_child$props2 = child.props) == null ? void 0 : _child$props2.value) === value,
429
+ value: value,
430
+ onChange: onChange
431
+ });
432
+ }
433
+ return React.cloneElement(child, {
434
+ active: ((_child$props3 = child.props) == null ? void 0 : _child$props3.value) === value,
435
+ onClick: function onClick() {
436
+ var _child$props4;
437
+ return onChange((_child$props4 = child.props) == null ? void 0 : _child$props4.value);
438
+ }
439
+ });
440
+ });
441
+ return React.createElement(TabsPane, Object.assign({}, rest), children);
442
+ };
443
+ Tabs.propTypes = {
444
+ children: PropTypes.node.isRequired,
445
+ value: /*#__PURE__*/PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
446
+ onChange: PropTypes.func.isRequired
447
+ };
448
+
449
+ var enTranslation = {
450
+ files: 'Files',
451
+ test: 'Test',
452
+ fileArea: {
453
+ description: 'Manage your files with ease! Add new ones and delete old ones as desired.',
454
+ fileName: 'File name',
455
+ status: 'Status',
456
+ presset: 'Presset',
457
+ actions: 'Actions',
458
+ search: 'Search',
459
+ fileUpload: 'File upload',
460
+ training: 'Train preset',
461
+ emptyState: {
462
+ title: 'No data',
463
+ description: 'No files uploaded yet. Start by adding your documents now!'
464
+ },
465
+ modal: {
466
+ descriptionUpload: 'Drag and drop files here or',
467
+ chooseFile: 'Choose a file',
468
+ uploadFile: 'Upload a file',
469
+ deleteFileTitle: 'Delete a file',
470
+ deleteFile: 'Important! By deleting this file, you will lose all its information and will not be able to recover it.',
471
+ trainingTitle: 'Presset Training',
472
+ trainingDescription: 'Select one or more pressets to be trained. Note: If none are selected, Le-IA will train all pressets.'
473
+ }
474
+ },
475
+ buttons: {
476
+ cancel: 'Cancel',
477
+ send: 'Send',
478
+ "delete": 'Delete',
479
+ test: 'Test',
480
+ addNewPresset: 'Add new presset',
481
+ addPresset: 'Add presset',
482
+ training: 'Training'
483
+ },
484
+ testArea: {
485
+ description: 'Type a sentence to test artificial intelligence',
486
+ typeSentence: 'Type a sentence',
487
+ selectPersona: 'Select a Persona',
488
+ selectPresset: 'Select a presset',
489
+ emptyState: {
490
+ title: 'No data for analysis',
491
+ description: 'Do a search, click the "Test" button.'
492
+ }
493
+ },
494
+ toast: {
495
+ deleteFile: {
496
+ success: {
497
+ title: 'Success',
498
+ description: 'File deleted successfully!'
499
+ },
500
+ fail: {
501
+ title: 'Failure',
502
+ description: 'Error deleting the file!'
503
+ }
504
+ },
505
+ uploadFile: {
506
+ success: {
507
+ title: 'Success',
508
+ description: 'File uploaded successfully!'
509
+ },
510
+ fail: {
511
+ title: 'Failure',
512
+ description: 'Error uploading the file!'
513
+ }
514
+ },
515
+ Test: {
516
+ fail: {
517
+ title: 'Failure',
518
+ description: 'Error testing Le-IA'
519
+ }
520
+ },
521
+ Train: {
522
+ fail: {
523
+ title: 'Failure',
524
+ description: 'Error training Le-IA'
525
+ },
526
+ success: {
527
+ title: 'Success',
528
+ description: 'Le-IA is in the training process!'
529
+ }
530
+ }
531
+ }
532
+ };
533
+
534
+ var ptTranslation = {
535
+ files: 'Arquivos',
536
+ test: 'Teste',
537
+ fileArea: {
538
+ description: 'Gerencie seus arquivos com facilidade! Adicione novos e exclua os antigos conforme desejar.',
539
+ fileName: 'Nome do arquivo',
540
+ status: 'Status',
541
+ presset: 'Predefinição',
542
+ actions: 'Ações',
543
+ search: 'Pesquisar',
544
+ fileUpload: 'Enviar arquivo',
545
+ training: 'Treinar predefinição',
546
+ emptyState: {
547
+ title: 'Sem dados',
548
+ description: 'Nenhum arquivo enviado ainda. Comece adicionando seus documentos agora!'
549
+ },
550
+ modal: {
551
+ descriptionUpload: 'Arraste e solte os arquivos aqui ou',
552
+ chooseFile: 'Escolha um arquivo',
553
+ uploadFile: 'Enviar um arquivo',
554
+ deleteFileTitle: 'Excluir um arquivo',
555
+ deleteFile: 'Importante! Ao excluir este arquivo, você perderá todas as suas informações e não poderá recuperá-las.',
556
+ trainingTitle: 'Treinamento de predefinição',
557
+ trainingDescription: 'Selecione um ou mais predefinições para serem treinadas. Obs: Caso não selecionada nenhuma a Le-IA irá treinar todas as predefinições'
558
+ }
559
+ },
560
+ buttons: {
561
+ cancel: 'Cancelar',
562
+ send: 'Enviar',
563
+ "delete": 'Excluir',
564
+ test: 'Teste',
565
+ addNewPresset: 'Adicionar nova predefinição',
566
+ addPresset: 'Adicionar predefinição',
567
+ training: 'Treinamento'
568
+ },
569
+ testArea: {
570
+ description: 'Digite uma frase para testar a inteligência artificial.',
571
+ typeSentence: 'Digite uma frase',
572
+ selectPersona: 'Selecione uma Persona',
573
+ selectPresset: 'Selecione uma predefinição',
574
+ emptyState: {
575
+ title: 'Sem dados para análise',
576
+ description: 'Faça uma pesquisa, clique no botão "Teste".'
577
+ }
578
+ },
579
+ toast: {
580
+ deleteFile: {
581
+ success: {
582
+ title: 'Sucesso',
583
+ description: 'Arquivo excluído com sucesso!'
584
+ },
585
+ fail: {
586
+ title: 'Falha',
587
+ description: 'Erro ao excluir o arquivo!'
588
+ }
589
+ },
590
+ uploadFile: {
591
+ success: {
592
+ title: 'Sucesso',
593
+ description: 'Arquivo enviado com sucesso!'
594
+ },
595
+ fail: {
596
+ title: 'Falha',
597
+ description: 'Erro ao enviar o arquivo!'
598
+ }
599
+ },
600
+ Test: {
601
+ fail: {
602
+ title: 'Falha',
603
+ description: 'Erro ao testar Le-IA'
604
+ }
605
+ },
606
+ Train: {
607
+ fail: {
608
+ title: 'Falha',
609
+ description: 'Erro ao treinar a Le-IA'
610
+ },
611
+ success: {
612
+ title: 'Sucesso',
613
+ description: 'A Le-IA está em processo de treinamento!'
614
+ }
615
+ }
616
+ }
617
+ };
618
+
619
+ var esTranslation = {
620
+ files: 'Archivos',
621
+ test: 'Prueba',
622
+ fileArea: {
623
+ description: '¡Administre sus archivos fácilmente! Agregue nuevos y elimine los antiguos según desee.',
624
+ fileName: 'Nombre del archivo',
625
+ status: 'Status',
626
+ presset: 'Preconfiguración',
627
+ actions: 'Acciones',
628
+ search: 'Buscar',
629
+ fileUpload: 'Subir archivo',
630
+ training: 'Entrenar preconfiguración',
631
+ emptyState: {
632
+ title: 'Sin datos',
633
+ description: 'Aún no se han subido archivos. ¡Comience agregando sus documentos ahora!'
634
+ },
635
+ modal: {
636
+ descriptionUpload: 'Arrastre y suelte los archivos aquí o',
637
+ chooseFile: 'Elegir un archivo',
638
+ uploadFile: 'Subir un archivo',
639
+ deleteFileTitle: 'Eliminar un archivo',
640
+ deleteFile: '¡Importante! Al eliminar este archivo, perderá toda su información y no podrá recuperarla.',
641
+ trainingTitle: 'Entrenamiento de preconfiguración',
642
+ trainingDescription: 'Seleccione una o más preconfiguracións para ser entrenadas. Nota: Si no se selecciona ninguna, Le-IA entrenará todas las preconfiguracións.'
643
+ }
644
+ },
645
+ buttons: {
646
+ cancel: 'Cancelar',
647
+ send: 'Enviar',
648
+ "delete": 'Eliminar',
649
+ test: 'Prueba',
650
+ addNewPresset: 'Agregar nueva preconfiguración',
651
+ addPresset: 'Agregar preconfiguración',
652
+ training: 'Capacitación'
653
+ },
654
+ testArea: {
655
+ description: 'Escribe una frase para probar la inteligencia artificial.',
656
+ typeSentence: 'Escribe una oración',
657
+ selectPersona: 'Seleccionar una Persona',
658
+ selectPresset: 'Seleccionar una preconfiguración',
659
+ emptyState: {
660
+ title: 'Sin datos para el análisis',
661
+ description: 'Realice una búsqueda, haga clic en el botón "Prueba".'
662
+ }
663
+ },
664
+ toast: {
665
+ deleteFile: {
666
+ success: {
667
+ title: 'Éxito',
668
+ description: '¡Archivo eliminado correctamente!'
669
+ },
670
+ fail: {
671
+ title: 'Error',
672
+ description: 'Error al eliminar el archivo!'
673
+ }
674
+ },
675
+ uploadFile: {
676
+ success: {
677
+ title: 'Éxito',
678
+ description: '¡Archivo subido correctamente!'
679
+ },
680
+ fail: {
681
+ title: 'Error',
682
+ description: 'Error al subir el archivo!'
683
+ }
684
+ },
685
+ Test: {
686
+ fail: {
687
+ title: 'Error',
688
+ description: 'Error al probar Le-IA'
689
+ }
690
+ },
691
+ Train: {
692
+ fail: {
693
+ title: 'Error',
694
+ description: 'Error al entrenar Le-IA'
695
+ },
696
+ success: {
697
+ title: 'Éxito',
698
+ description: '¡Le-IA está en proceso de entrenamiento!'
699
+ }
700
+ }
701
+ }
702
+ };
703
+
704
+ var getLanguage = function getLanguage(language) {
705
+ switch (language) {
706
+ case 'en':
707
+ return enTranslation;
708
+ case 'pt-br':
709
+ return ptTranslation;
710
+ case 'es':
711
+ return esTranslation;
712
+ default:
713
+ return enTranslation;
714
+ }
715
+ };
716
+
717
+ var _templateObject$1, _templateObject2$1, _templateObject3;
718
+ var Container = /*#__PURE__*/styled.div(_templateObject$1 || (_templateObject$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n\n\n .tag {\n padding: 4px 8px 4px 8px;\n background: #C7F9ED;\n border-radius: 4px;\n display: flex;\n justify-content: center;\n align-items: center;\n }\n\n .tags {\n display: flex;\n justify-content: left;\n gap: 4px;\n }\n\n .divDelete {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n gap: 4px;\n }\n\n .buttonDelete {\n color: #5b0a1f;\n background: #fae0d2;\n padding: 12px 20px;\n border-radius: 4px;\n }\n\n .buttonDelete:hover {\n background: #f5bba7;\n }\n\n .buttonTraining {\n color: #023906;\n background: #e3f8cc;\n padding: 12px 20px;\n border-radius: 4px;\n margin-right: 10px;\n }\n\n .buttonTraining:hover {\n background: #90d665;\n }\n\n .button {\n padding: 8px 16px 8px 16px;\n border-radius: 4px;\n gap: 10px;\n }\n\n .cancel {\n background: #F3F5F9;\n color: #5A5D68;\n }\n\n .send {\n background: #102693;\n color: white;\n }\n\n .delete {\n background: #871821;\n color: white;\n }\n\n .presset {\n padding-top: 10px;\n display: flex;\n flex-direction: column;\n\n p {\n font-size: 14px;\n font-weight: 600;\n padding: 4px 0;\n }\n }\n\n #warning {\n padding: 10px;\n background: #FAE0D2;\n color: #871821;\n }\n\n #info {\n padding: 10px;\n background: #c7f9ed;\n color: #00344e;\n }\n\n"])), function (props) {
719
+ return props.isloading && css(_templateObject2$1 || (_templateObject2$1 = _taggedTemplateLiteralLoose(["\n #loading {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: rgb(151,154,165, 0.7);\n display: flex;\n justify-content: center;\n align-items: center;\n z-index: 9999;\n }\n\n #loading::after {\n content: \"\";\n border: 4px solid #f3f3f3; /* Cor do s\xEDmbolo de carregamento */\n border-top: 4px solid #5a5d68; /* Cor do s\xEDmbolo de carregamento */\n border-radius: 50%;\n width: 13px;\n height: 13px;\n animation: spin 1s linear infinite;\n }\n\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n "])));
720
+ });
721
+ var Header = /*#__PURE__*/styled.div(_templateObject3 || (_templateObject3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n\n #button-upload {\n margin-right: 10px;\n }\n\n .infos {\n display: flex;\n flex-direction: column;\n padding: 14px 0;\n\n h2 {\n font-size: 20px\n }\n\n p {\n font-size: 14px\n }\n }\n\n .actions {\n display: flex;\n justify-content: space-between;\n padding-bottom: 14px;\n\n button {\n background: #102693;\n padding: 10px 20px;\n color: white;\n border-radius: 4px;\n }\n }\n\n"])));
722
+
723
+ var _templateObject$2, _templateObject2$2, _templateObject3$1;
724
+ var TableWrapper = /*#__PURE__*/styled.div(_templateObject$2 || (_templateObject$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n width: 100%;\n height: max-content;\n min-height: 50px;\n position: relative;\n"])));
725
+ var Table = /*#__PURE__*/styled.table(_templateObject2$2 || (_templateObject2$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-size: 14px;\n line-height: 143%;\n color: black;\n width: 100%;\n border-collapse: collapse;\n border-radius: 4px;\n\n th {\n font-weight: 600;\n font-size: 14px;\n line-height: 143%;\n letter-spacing: 0.018em;\n color: #5A5D68;\n text-align: left;\n padding: 8px;\n border-radius: 4px;\n }\n\n thead tr {\n background: #dadce3;\n }\n\n tbody tr {\n border: 1px solid #dadce3;\n }\n\n &.small td {\n padding: 4px;\n }\n\n &.medium td {\n padding: 8px;\n }\n\n &.large td {\n padding: 16px;\n }\n"])));
726
+ var TableLoadingWrapper = /*#__PURE__*/styled.div(_templateObject3$1 || (_templateObject3$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: absolute;\n top: 0;\n left: 0;\n bottom: 0;\n right: 0;\n display: flex;\n justify-content: center;\n align-items: center;\n background-color: #f3f5f961;\n"])));
727
+
728
+ var _templateObject$3;
729
+ var SpinnerWrapper = /*#__PURE__*/styled.span(_templateObject$3 || (_templateObject$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: inline-block;\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n\n &.spinner--sm {\n width: 24px;\n height: 24px;\n }\n\n &.spinner--md {\n width: 32px;\n height: 32px;\n }\n\n &.spinner--lg {\n width: 60px;\n height: 60px;\n }\n\n span {\n box-sizing: border-box;\n display: block;\n position: absolute;\n width: 100%;\n height: 100%;\n margin: 8px;\n border: 4px solid #fff;\n border-radius: 50%;\n animation: rotateSpinner 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;\n border-color: ", " transparent transparent\n transparent;\n }\n\n & span:nth-child(1) {\n animation-delay: -0.45s;\n }\n\n & span:nth-child(2) {\n animation-delay: -0.3s;\n }\n\n & span:nth-child(3) {\n animation-delay: -0.15s;\n }\n\n @keyframes rotateSpinner {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n }\n"])), function (props) {
730
+ return "var(--" + props.color + ")";
731
+ });
732
+
733
+ var Spinner = function Spinner(_ref) {
734
+ var _ref$color = _ref.color,
735
+ color = _ref$color === void 0 ? 'neutral-3' : _ref$color,
736
+ _ref$size = _ref.size,
737
+ size = _ref$size === void 0 ? 'md' : _ref$size,
738
+ className = _ref.className;
739
+ return React.createElement(SpinnerWrapper, {
740
+ color: color,
741
+ className: cc(["spinner--" + size, className])
742
+ }, React.createElement("span", null), React.createElement("span", null), React.createElement("span", null), React.createElement("span", null));
743
+ };
744
+
745
+ var _excluded$1 = ["size", "children", "isloading", "className"];
746
+ var Table$1 = /*#__PURE__*/forwardRef(function (_ref, ref) {
747
+ var _ref$size = _ref.size,
748
+ size = _ref$size === void 0 ? 'medium' : _ref$size,
749
+ children = _ref.children,
750
+ _ref$isloading = _ref.isloading,
751
+ isloading = _ref$isloading === void 0 ? false : _ref$isloading,
752
+ _ref$className = _ref.className,
753
+ className = _ref$className === void 0 ? '' : _ref$className,
754
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
755
+ return React.createElement(TableWrapper, {
756
+ className: className
757
+ }, isloading ? React.createElement(TableLoadingWrapper, null, React.createElement(Spinner, null)) : null, React.createElement(Table, Object.assign({
758
+ className: cc([size]),
759
+ ref: ref
760
+ }, props), children));
761
+ });
762
+ Table$1.propTypes = {
763
+ children: PropTypes.node.isRequired,
764
+ className: PropTypes.string,
765
+ size: /*#__PURE__*/PropTypes.oneOf(['small', 'medium', 'large']),
766
+ isloading: PropTypes.bool
767
+ };
768
+
769
+ var _templateObject$4, _templateObject2$3, _templateObject3$2;
770
+ var InputContainer = /*#__PURE__*/styled.div(_templateObject$4 || (_templateObject$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: relative;\n width: 300px;\n"])));
771
+ var Input = /*#__PURE__*/styled.input(_templateObject2$3 || (_templateObject2$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n padding-left: 40px;\n border-radius: 5px;\n border: 1px solid #ccc;\n height: 45px;\n width: 100%;\n\n &:focus {\n outline: none;\n box-shadow: 0 0 0 3px #6690ff;\n }\n"])));
772
+ var IconContainer = /*#__PURE__*/styled.div(_templateObject3$2 || (_templateObject3$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: absolute;\n top: 14px;\n left: 10px;\n pointer-events: none;\n"])));
773
+
774
+ var SearchInput = function SearchInput(_ref) {
775
+ var placeholder = _ref.placeholder,
776
+ setFiles = _ref.setFiles,
777
+ initialFiles = _ref.initialFiles;
778
+ var searchName = function searchName(e) {
779
+ var searchTerm = e.target.value.trim();
780
+ var normalizedSearchTerm = unorm.nfkd(searchTerm).toLowerCase();
781
+ var newFiles = initialFiles.filter(function (file) {
782
+ var normalizedFileName = unorm.nfkd(file.name).toLowerCase();
783
+ return normalizedFileName.includes(normalizedSearchTerm);
784
+ });
785
+ setFiles(searchTerm !== '' ? newFiles : initialFiles);
786
+ };
787
+ return React.createElement(InputContainer, null, React.createElement(Input, {
788
+ type: "text",
789
+ onChange: function onChange(e) {
790
+ return searchName(e);
791
+ },
792
+ placeholder: placeholder
793
+ }), React.createElement(IconContainer, null, React.createElement(FaSearch, null)));
794
+ };
795
+
796
+ var _templateObject$5, _templateObject2$4, _templateObject3$3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8;
797
+ var FullScreen = /*#__PURE__*/styled.div(_templateObject$5 || (_templateObject$5 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: ", ";\n cursor: ", ";\n\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n justify-content: center;\n align-items: center;\n z-index: ", ";\n animation: fadeIn 380ms ease-in-out 1;\n background-color: #2f3845b8;\n backdrop-filter: blur(2px);\n\n @keyframes fadeIn {\n from {\n background-color: #2f384521;\n }\n to {\n background-color: #2f3845b8;\n }\n }\n"])), function (_ref) {
798
+ var isopen = _ref.isopen;
799
+ return isopen === 1 ? 'flex' : 'none';
800
+ }, function (_ref2) {
801
+ var isfixed = _ref2.isfixed;
802
+ return isfixed === 0 ? 'pointer' : 'default';
803
+ }, function (_ref3) {
804
+ var zindex = _ref3.zindex;
805
+ return zindex;
806
+ });
807
+ var Modal = /*#__PURE__*/styled.div(_templateObject2$4 || (_templateObject2$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n background-color: #fff;\n border-radius: 3px;\n position: relative;\n cursor: default;\n width: 100%;\n max-width: ", ";\n animation: slideIn 350ms cubic-bezier(0.42, 0, 0.21, 1) 1;\n\n @keyframes slideIn {\n from {\n transform: translateY(-120px);\n opacity: 0;\n }\n\n 20% {\n opacity: 0;\n }\n\n to {\n transform: translateY(0);\n opacity: 1;\n }\n }\n"])), function (_ref4) {
808
+ var maxwidth = _ref4.maxwidth;
809
+ return maxwidth;
810
+ });
811
+ var ModalContainer = /*#__PURE__*/styled.div(_templateObject3$3 || (_templateObject3$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n width: 100%;\n overflow-y: auto;\n max-height: ", ";\n"])), function (_ref5) {
812
+ var maxheight = _ref5.maxheight;
813
+ return maxheight;
814
+ });
815
+ var ModalHeader = /*#__PURE__*/styled.header(_templateObject4 || (_templateObject4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n justify-content: space-between;\n align-items: center;\n border-bottom: 1px solid #dadce3;\n padding: var(--spacement-medium);\n"])));
816
+ var ModalTitle = /*#__PURE__*/styled.div(_templateObject5 || (_templateObject5 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-style: normal;\n font-weight: normal;\n font-size: 20px;\n line-height: 150%;\n letter-spacing: 0.0075em;\n color: var(--neutral-4);\n"])));
817
+ var ModalButtonClose = /*#__PURE__*/styled.button(_templateObject6 || (_templateObject6 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n outline: none;\n cursor: pointer;\n\n :hover {\n opacity: 0.7;\n }\n"])));
818
+ var ModalContentWrapper = /*#__PURE__*/styled.div(_templateObject7 || (_templateObject7 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n width: 100%;\n overflow-y: ", ";\n max-height: ", ";\n padding: var(--spacement-medium);\n"])), function (_ref6) {
819
+ var overflowy = _ref6.overflowy;
820
+ return overflowy;
821
+ }, function (_ref7) {
822
+ var maxheight = _ref7.maxheight;
823
+ return maxheight;
824
+ });
825
+ var ModalFooterWrapper = /*#__PURE__*/styled.div(_templateObject8 || (_templateObject8 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n padding: var(--spacement-medium);\n background: var(--neutral-0);\n display: flex;\n align-items: center;\n justify-content: flex-end;\n gap: var(--spacement-medium);\n"])));
826
+
827
+ var _excluded$2 = ["children"];
828
+ var ModalFooter = function ModalFooter(_ref) {
829
+ var children = _ref.children,
830
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
831
+ return React.createElement(ModalFooterWrapper, Object.assign({}, rest), children);
832
+ };
833
+ ModalFooter.propTypes = {
834
+ children: PropTypes.node.isRequired
835
+ };
836
+
837
+ var _excluded$3 = ["children", "maxheight", "overflowy"];
838
+ var ModalContent = function ModalContent(_ref) {
839
+ var children = _ref.children,
840
+ _ref$maxheight = _ref.maxheight,
841
+ maxheight = _ref$maxheight === void 0 ? 'max-content' : _ref$maxheight,
842
+ _ref$overflowy = _ref.overflowy,
843
+ overflowy = _ref$overflowy === void 0 ? 'initial' : _ref$overflowy,
844
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
845
+ return React.createElement(ModalContentWrapper, Object.assign({
846
+ maxheight: maxheight,
847
+ overflowy: overflowy
848
+ }, rest), children);
849
+ };
850
+ ModalContent.propTypes = {
851
+ children: PropTypes.node.isRequired,
852
+ maxheight: PropTypes.string,
853
+ overflowy: PropTypes.string
854
+ };
855
+
856
+ var Modal$1 = function Modal$1(_ref) {
857
+ var isopen = _ref.isopen,
858
+ style = _ref.style,
859
+ maxwidth = _ref.maxwidth,
860
+ maxheight = _ref.maxheight,
861
+ className = _ref.className,
862
+ title = _ref.title,
863
+ children = _ref.children,
864
+ onClose = _ref.onClose,
865
+ contentStyle = _ref.contentStyle,
866
+ isfixed = _ref.isfixed,
867
+ zindex = _ref.zindex;
868
+ var modalRef = useRef(null);
869
+ var handleKeyUp = useCallback(function (e) {
870
+ var keys = {
871
+ // ESC Key
872
+ 27: function _() {
873
+ e.preventDefault();
874
+ if (!isfixed && onClose) {
875
+ onClose();
876
+ }
877
+ window.removeEventListener('keyup', handleKeyUp, false);
878
+ }
879
+ };
880
+ if (keys[e.keyCode] && isopen) {
881
+ keys[e.keyCode]();
882
+ }
883
+ }, [onClose, isopen, isfixed]);
884
+ var handleOutsideClick = useCallback(function (e) {
885
+ if (modalRef.current && modalRef.current.parentNode === e.target) {
886
+ if (!isfixed && onClose) {
887
+ onClose();
888
+ }
889
+ document.removeEventListener('click', handleOutsideClick, false);
890
+ }
891
+ }, [onClose, isfixed]);
892
+ useEffect(function () {
893
+ window.addEventListener('keyup', handleKeyUp, false);
894
+ document.addEventListener('click', handleOutsideClick, false);
895
+ return function () {
896
+ window.removeEventListener('keyup', handleKeyUp, false);
897
+ document.removeEventListener('click', handleOutsideClick, false);
898
+ };
899
+ }, [handleKeyUp, handleOutsideClick]);
900
+ return React.createElement(FullScreen, {
901
+ isfixed: isfixed ? 1 : 0,
902
+ isopen: isopen ? 1 : 0,
903
+ zindex: zindex != null ? zindex : 0
904
+ }, React.createElement(Modal, {
905
+ ref: modalRef,
906
+ style: style,
907
+ maxwidth: maxwidth,
908
+ className: className
909
+ }, React.createElement(ModalContainer, {
910
+ className: "styleOverlay",
911
+ maxheight: maxheight,
912
+ style: contentStyle
913
+ }, React.createElement(ModalHeader, null, React.createElement(ModalTitle, null, String(title)), React.createElement(ModalButtonClose, {
914
+ type: "button",
915
+ onClick: onClose
916
+ }, React.createElement(MdClose, {
917
+ color: "#5A5D68",
918
+ size: 16
919
+ }))), children)));
920
+ };
921
+ Modal$1.propTypes = {
922
+ isopen: PropTypes.bool.isRequired,
923
+ title: /*#__PURE__*/PropTypes.oneOfType([PropTypes.element, PropTypes.string, PropTypes.func]),
924
+ children: PropTypes.node.isRequired,
925
+ onClose: PropTypes.func,
926
+ style: /*#__PURE__*/PropTypes.objectOf(PropTypes.any),
927
+ contentStyle: /*#__PURE__*/PropTypes.objectOf(PropTypes.any),
928
+ className: PropTypes.string,
929
+ maxwidth: PropTypes.string,
930
+ maxheight: PropTypes.string,
931
+ isfixed: PropTypes.bool,
932
+ zindex: PropTypes.number
933
+ };
934
+ Modal$1.defaultProps = {
935
+ title: '',
936
+ style: {},
937
+ contentStyle: {},
938
+ className: '',
939
+ maxwidth: '360px',
940
+ maxheight: 'max-content',
941
+ isfixed: false,
942
+ onClose: function onClose() {},
943
+ zindex: 9999
944
+ };
945
+
946
+ var _templateObject$6;
947
+ var Container$1 = /*#__PURE__*/styled.div(_templateObject$6 || (_templateObject$6 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n width: 100%;\n display: flex;\n justify-content: center;\n padding: 24px 0;\n height: 193px;\n \n p {\n margin: 10px 0;\n }\n\n background: ", ";\n background-position: top, right, bottom, left;\n background-repeat: repeat-x, repeat-y;\n background-size: 40px 1px, 1px 40px;\n background-color: ", ";\n\n button {\n background: #102693;\n color: white;\n width: fit-content;\n padding: 10px 20px;\n border-radius: 4px;\n }\n\n & .content {\n display: flex;\n justify-content: space-between;\n align-items: center;\n\n & > .icon {\n background-color: ", ";\n border-radius: 16px;\n width: 145px;\n height: 145px;\n\n display: flex;\n justify-content: center;\n\n & svg {\n width: 100%;\n height: 70%;\n margin: 20px;\n }\n }\n\n & .description {\n max-width: 600px;\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n padding: 8px 0 8px 24px;\n\n .button-add {\n cursor: pointer;\n }\n\n .start-icon {\n display: flex;\n align-items: center;\n }\n }\n }\n"])), function (_ref) {
948
+ var hasborder = _ref.hasborder;
949
+ return hasborder && "linear-gradient(\n to right,\n #dadce3 50%,\n rgba(255, 255, 255, 0) 0%\n ),\n linear-gradient(#dadce3 50%, rgba(255, 255, 255, 0) 0%),\n linear-gradient(to right, #dadce3 50%, rgba(255, 255, 255, 0) 0%),\n linear-gradient(#dadce3 50%, rgba(255, 255, 255, 0) 0%)";
950
+ }, function (_ref2) {
951
+ var backgroundcolor = _ref2.backgroundcolor;
952
+ return backgroundcolor;
953
+ }, function (_ref3) {
954
+ var backgroundicon = _ref3.backgroundicon;
955
+ return backgroundicon;
956
+ });
957
+
958
+ var _excluded$4 = ["icon", "title", "description", "activeButton", "iconButton", "descriptionButton", "widthButton", "button", "backgroundIcon", "backgroundColor", "hasborder"];
959
+ var EmptyState = function EmptyState(_ref) {
960
+ var icon = _ref.icon,
961
+ title = _ref.title,
962
+ description = _ref.description,
963
+ activeButton = _ref.activeButton,
964
+ iconButton = _ref.iconButton,
965
+ descriptionButton = _ref.descriptionButton,
966
+ button = _ref.button,
967
+ backgroundIcon = _ref.backgroundIcon,
968
+ backgroundColor = _ref.backgroundColor,
969
+ hasborder = _ref.hasborder,
970
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$4);
971
+ return React.createElement(Container$1, Object.assign({
972
+ backgroundicon: backgroundIcon,
973
+ backgroundcolor: backgroundColor,
974
+ hasborder: hasborder
975
+ }, rest), React.createElement("div", {
976
+ className: "content"
977
+ }, React.createElement("div", {
978
+ className: "icon"
979
+ }, icon), React.createElement("div", {
980
+ className: "description"
981
+ }, React.createElement("h5", null, " ", title), React.createElement("p", null, description), activeButton ? React.createElement("button", null, iconButton, " ", descriptionButton) : null, button)));
982
+ };
983
+ EmptyState.propTypes = {
984
+ icon: /*#__PURE__*/PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
985
+ title: PropTypes.string,
986
+ description: PropTypes.string,
987
+ activeButton: PropTypes.bool,
988
+ iconButton: PropTypes.element,
989
+ descriptionButton: PropTypes.string,
990
+ widthButton: PropTypes.string,
991
+ button: PropTypes.element,
992
+ backgroundIcon: PropTypes.string,
993
+ backgroundColor: PropTypes.string,
994
+ hasborder: PropTypes.bool
995
+ };
996
+ EmptyState.defaultProps = {
997
+ icon: '',
998
+ title: '',
999
+ description: '',
1000
+ activeButton: false,
1001
+ descriptionButton: '',
1002
+ widthButton: '140px',
1003
+ backgroundIcon: 'var(--neutral-0)',
1004
+ backgroundColor: 'var(--absolute-white)',
1005
+ hasborder: true
1006
+ };
1007
+
1008
+ var _templateObject$7, _templateObject2$5, _templateObject3$4, _templateObject4$1, _templateObject5$1, _templateObject6$1, _templateObject7$1;
1009
+ var MultiSelectWrapper = /*#__PURE__*/styled.div(_templateObject$7 || (_templateObject$7 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n width: 100%;\n height: 45px;\n"])));
1010
+ var SelectBox = /*#__PURE__*/styled.div(_templateObject2$5 || (_templateObject2$5 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: relative;\n\n select {\n width: 100%;\n font-weight: bold;\n height: 45px;\n border-radius: 4px;\n }\n"])));
1011
+ var OverSelect = /*#__PURE__*/styled.div(_templateObject3$4 || (_templateObject3$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n display: flex;\n\n input {\n height: 43px;\n width: calc(100% - 30px);\n border: none;\n margin: 1px;\n\n &:focus {\n outline: none;\n box-shadow: 0 0 0 3px #6690ff;\n }\n }\n"])));
1012
+ var Checkboxes = /*#__PURE__*/styled.div(_templateObject4$1 || (_templateObject4$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: none;\n background: white;\n position: absolute;\n width: 95%;\n z-index: 10;\n\n label {\n padding: 10px 5px;\n }\n"])));
1013
+ var CheckboxLabel = /*#__PURE__*/styled.label(_templateObject5$1 || (_templateObject5$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: block;\n\n &:hover {\n background-color: #6690ff;\n }\n"])));
1014
+ var SelectedValues = /*#__PURE__*/styled.div(_templateObject6$1 || (_templateObject6$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: absolute;\n top: 9px;\n display: flex;\n flex-wrap: wrap;\n margin-left: 5px;\n right: 30px;\n"])));
1015
+ var SelectedValue = /*#__PURE__*/styled.div(_templateObject7$1 || (_templateObject7$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n background-color: #254EDB;\n color: white;\n border-radius: 15px;\n padding: 5px 10px;\n margin-right: 5px;\n margin-bottom: 5px;\n white-space: nowrap;\n"])));
1016
+
1017
+ var MultiSelect = function MultiSelect(_ref) {
1018
+ var options = _ref.options,
1019
+ presset = _ref.presset,
1020
+ setPresset = _ref.setPresset,
1021
+ setOptions = _ref.setOptions,
1022
+ modal = _ref.modal,
1023
+ language = _ref.language,
1024
+ hasAddNewOptions = _ref.hasAddNewOptions;
1025
+ var _useState = useState(false),
1026
+ expanded = _useState[0],
1027
+ setExpanded = _useState[1];
1028
+ var _useState2 = useState(''),
1029
+ newOption = _useState2[0],
1030
+ setNewOption = _useState2[1];
1031
+ var t = getLanguage(language);
1032
+ useEffect(function () {
1033
+ setExpanded(false);
1034
+ }, [modal]);
1035
+ var handleCheckboxChange = function handleCheckboxChange(value) {
1036
+ setPresset(function (prevPresset) {
1037
+ if (prevPresset.includes(value)) {
1038
+ return prevPresset.filter(function (val) {
1039
+ return val !== value;
1040
+ });
1041
+ } else {
1042
+ return [].concat(prevPresset, [value]);
1043
+ }
1044
+ });
1045
+ };
1046
+ var showCheckboxes = function showCheckboxes() {
1047
+ setExpanded(!expanded);
1048
+ };
1049
+ var handleInputChange = function handleInputChange(event) {
1050
+ setNewOption(event.target.value);
1051
+ };
1052
+ var handleInputKeyPress = function handleInputKeyPress(event) {
1053
+ if (event.key === 'Enter' && hasAddNewOptions) {
1054
+ event.preventDefault();
1055
+ var trimmedOption = newOption.trim();
1056
+ if (trimmedOption !== '' && !options.some(function (option) {
1057
+ return option.value === trimmedOption;
1058
+ })) {
1059
+ setOptions(function (prevOptions) {
1060
+ return [].concat(prevOptions, [{
1061
+ label: trimmedOption,
1062
+ value: trimmedOption
1063
+ }]);
1064
+ });
1065
+ setPresset(function (prevPresset) {
1066
+ return [].concat(prevPresset, [trimmedOption]);
1067
+ });
1068
+ }
1069
+ setNewOption('');
1070
+ }
1071
+ };
1072
+ return React.createElement("form", null, React.createElement(MultiSelectWrapper, null, React.createElement(SelectBox, {
1073
+ onClick: showCheckboxes
1074
+ }, React.createElement("select", null, options.map(function (option, index) {
1075
+ return React.createElement("option", {
1076
+ key: index,
1077
+ value: option.value
1078
+ }, option.label);
1079
+ })), React.createElement(OverSelect, null, React.createElement(SelectedValues, null, presset.map(function (value, index) {
1080
+ return React.createElement(SelectedValue, {
1081
+ key: index
1082
+ }, value);
1083
+ })), React.createElement("input", {
1084
+ type: "text",
1085
+ placeholder: hasAddNewOptions ? t.buttons.addNewPresset : t.buttons.addPresset,
1086
+ value: newOption,
1087
+ onChange: handleInputChange,
1088
+ onKeyPress: handleInputKeyPress
1089
+ }))), React.createElement(Checkboxes, {
1090
+ style: {
1091
+ display: expanded ? 'block' : 'none'
1092
+ }
1093
+ }, options.map(function (option, index) {
1094
+ return React.createElement(CheckboxLabel, {
1095
+ key: index,
1096
+ htmlFor: option.value
1097
+ }, React.createElement("input", {
1098
+ type: "checkbox",
1099
+ id: option.value,
1100
+ checked: presset.includes(option.value),
1101
+ onChange: function onChange() {
1102
+ return handleCheckboxChange(option.value);
1103
+ }
1104
+ }), option.label);
1105
+ }))));
1106
+ };
1107
+
1108
+ var _templateObject$8;
1109
+ var getColor = function getColor(props) {
1110
+ if (props.isDragAccept) {
1111
+ return '#6690ff';
1112
+ }
1113
+ if (props.isDragReject) {
1114
+ return '#e18976';
1115
+ }
1116
+ if (props.isDragActive) {
1117
+ return '#6690ff';
1118
+ }
1119
+ return '#979aa5';
1120
+ };
1121
+ var Container$2 = /*#__PURE__*/styled.div(_templateObject$8 || (_templateObject$8 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n background-color: #f3f5f9;\n flex: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n flex-direction: column;\n padding: 20px;\n border-width: 2px;\n border-radius: 4px;\n border-color: var(", ");\n border-style: dashed;\n color: #5a5d68;\n outline: none;\n transition: border 0.24s ease-in-out;\n\n & > span {\n margin: 8px 10px 0 0;\n display: flex;\n }\n\n button {\n padding: 8px 16px 8px 16px;\n border-radius: 4px;\n border: 2px #102693 solid;\n margin-top: 10px;\n }\n"])), function (props) {
1122
+ return getColor(props);
1123
+ });
1124
+
1125
+ var AreaUpload = function AreaUpload(_ref) {
1126
+ var _ref$formatFile = _ref.formatFile,
1127
+ formatFile = _ref$formatFile === void 0 ? 'application/pdf' : _ref$formatFile,
1128
+ _ref$multipleFile = _ref.multipleFile,
1129
+ multipleFile = _ref$multipleFile === void 0 ? false : _ref$multipleFile,
1130
+ _ref$initialFiles = _ref.initialFiles,
1131
+ initialFiles = _ref$initialFiles === void 0 ? [] : _ref$initialFiles,
1132
+ _ref$setFile = _ref.setFile,
1133
+ setFile = _ref$setFile === void 0 ? function () {} : _ref$setFile,
1134
+ _ref$file = _ref.file,
1135
+ file = _ref$file === void 0 ? '' : _ref$file,
1136
+ _ref$onChange = _ref.onChange,
1137
+ onChange = _ref$onChange === void 0 ? function () {} : _ref$onChange;
1138
+ var _useState = useState([]),
1139
+ myFiles = _useState[0],
1140
+ setMyFiles = _useState[1];
1141
+ var t = getLanguage('pt-br');
1142
+ useEffect(function () {
1143
+ setMyFiles([].concat(initialFiles, myFiles));
1144
+ }, []);
1145
+ var onDrop = useCallback(function (acceptedFiles, fileRejections) {
1146
+ if (fileRejections && fileRejections.length > 0) {
1147
+ console.error('Arquivos rejeitados:', fileRejections);
1148
+ }
1149
+ onChange(acceptedFiles);
1150
+ var files = [].concat(myFiles, acceptedFiles);
1151
+ var filesWithId = files.map(function (item, index) {
1152
+ return {
1153
+ id: index + 1,
1154
+ lastModified: item.lastModified,
1155
+ name: item.name,
1156
+ size: item.size,
1157
+ type: item.type
1158
+ };
1159
+ });
1160
+ setMyFiles(filesWithId);
1161
+ acceptedFiles.forEach(function (file) {
1162
+ var reader = new FileReader();
1163
+ reader.onload = function () {
1164
+ var binaryStr = reader.result;
1165
+ setFile({
1166
+ content: binaryStr,
1167
+ properties: file
1168
+ });
1169
+ };
1170
+ reader.readAsArrayBuffer(file);
1171
+ });
1172
+ }, [myFiles]);
1173
+ var _useDropzone = useDropzone({
1174
+ accept: formatFile,
1175
+ noClick: true,
1176
+ noKeyboard: true,
1177
+ multiple: multipleFile,
1178
+ onDrop: onDrop
1179
+ }),
1180
+ getRootProps = _useDropzone.getRootProps,
1181
+ getInputProps = _useDropzone.getInputProps,
1182
+ open = _useDropzone.open,
1183
+ isDragActive = _useDropzone.isDragActive,
1184
+ isDragAccept = _useDropzone.isDragAccept,
1185
+ isDragReject = _useDropzone.isDragReject;
1186
+ return React.createElement(React.Fragment, null, multipleFile || (myFiles == null ? void 0 : myFiles.length) === 0 || !file ? React.createElement(Container$2, Object.assign({}, getRootProps({
1187
+ isDragActive: isDragActive,
1188
+ isDragAccept: isDragAccept,
1189
+ isDragReject: isDragReject
1190
+ })), React.createElement("input", Object.assign({}, getInputProps())), React.createElement("span", null, React.createElement("p", null, t.fileArea.modal.descriptionUpload)), React.createElement("button", {
1191
+ type: "button",
1192
+ onClick: open
1193
+ }, t.fileArea.modal.chooseFile)) : React.createElement(Container$2, Object.assign({}, getRootProps({
1194
+ isDragActive: isDragActive,
1195
+ isDragAccept: isDragAccept,
1196
+ isDragReject: isDragReject
1197
+ })), React.createElement("p", null, file)));
1198
+ };
1199
+ AreaUpload.propTypes = {
1200
+ formatFile: PropTypes.string,
1201
+ multipleFile: PropTypes.bool,
1202
+ initialFiles: /*#__PURE__*/PropTypes.arrayOf(PropTypes.object),
1203
+ removeItem: PropTypes.func,
1204
+ setFile: PropTypes.func,
1205
+ onChange: PropTypes.func,
1206
+ hasListFiles: PropTypes.bool
1207
+ };
1208
+ AreaUpload.defaultProps = {
1209
+ formatFile: 'application/json',
1210
+ multipleFile: false,
1211
+ initialFiles: [],
1212
+ removeItem: function removeItem() {},
1213
+ setFile: function setFile() {},
1214
+ onChange: function onChange() {},
1215
+ hasListFiles: true
1216
+ };
1217
+
1218
+ var url = 'https://api.leia.digitalcontact.cloud';
1219
+ axios.defaults.baseURL = "" + url;
1220
+ var api = /*#__PURE__*/axios.create();
1221
+
1222
+ var _excluded$5 = ["children"];
1223
+ var SharedPropsContext = /*#__PURE__*/createContext(undefined);
1224
+ var useSharedProps = function useSharedProps() {
1225
+ var context = useContext(SharedPropsContext);
1226
+ if (!context) {
1227
+ throw new Error('useSharedProps deve ser usado dentro de um SharedPropsProvider');
1228
+ }
1229
+ return context.props;
1230
+ };
1231
+ var SharedPropsProvider = function SharedPropsProvider(_ref) {
1232
+ var children = _ref.children,
1233
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$5);
1234
+ var id = props.id,
1235
+ language = props.language;
1236
+ var _useState = useState(null),
1237
+ tags = _useState[0],
1238
+ setTags = _useState[1];
1239
+ var _useState2 = useState(null),
1240
+ personas = _useState2[0],
1241
+ setPersonas = _useState2[1];
1242
+ useEffect(function () {
1243
+ var fetchData = /*#__PURE__*/function () {
1244
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
1245
+ var _yield$api$get, data;
1246
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
1247
+ while (1) switch (_context.prev = _context.next) {
1248
+ case 0:
1249
+ _context.prev = 0;
1250
+ _context.next = 3;
1251
+ return api.get("/tags/" + id);
1252
+ case 3:
1253
+ _yield$api$get = _context.sent;
1254
+ data = _yield$api$get.data;
1255
+ if (data) {
1256
+ setTags(data);
1257
+ } else {
1258
+ console.error('Erro ao fazer a solicitação');
1259
+ }
1260
+ _context.next = 11;
1261
+ break;
1262
+ case 8:
1263
+ _context.prev = 8;
1264
+ _context.t0 = _context["catch"](0);
1265
+ console.error('Erro ao fazer a solicitação:', _context.t0);
1266
+ case 11:
1267
+ case "end":
1268
+ return _context.stop();
1269
+ }
1270
+ }, _callee, null, [[0, 8]]);
1271
+ }));
1272
+ return function fetchData() {
1273
+ return _ref2.apply(this, arguments);
1274
+ };
1275
+ }();
1276
+ var personas = /*#__PURE__*/function () {
1277
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
1278
+ var _yield$api$get2, data;
1279
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
1280
+ while (1) switch (_context2.prev = _context2.next) {
1281
+ case 0:
1282
+ _context2.prev = 0;
1283
+ _context2.next = 3;
1284
+ return api.get("/personas?language=" + language);
1285
+ case 3:
1286
+ _yield$api$get2 = _context2.sent;
1287
+ data = _yield$api$get2.data;
1288
+ if (data) {
1289
+ setPersonas(data);
1290
+ } else {
1291
+ console.error('Erro ao fazer a solicitação');
1292
+ }
1293
+ _context2.next = 11;
1294
+ break;
1295
+ case 8:
1296
+ _context2.prev = 8;
1297
+ _context2.t0 = _context2["catch"](0);
1298
+ console.error('Erro ao fazer a solicitação:', _context2.t0);
1299
+ case 11:
1300
+ case "end":
1301
+ return _context2.stop();
1302
+ }
1303
+ }, _callee2, null, [[0, 8]]);
1304
+ }));
1305
+ return function personas() {
1306
+ return _ref3.apply(this, arguments);
1307
+ };
1308
+ }();
1309
+ fetchData();
1310
+ personas();
1311
+ }, [id]);
1312
+ var sharedProps = _extends({}, props, {
1313
+ propTags: tags,
1314
+ personas: personas
1315
+ });
1316
+ return React.createElement(SharedPropsContext.Provider, {
1317
+ value: {
1318
+ props: sharedProps
1319
+ }
1320
+ }, children);
1321
+ };
1322
+
1323
+ var Types = {
1324
+ GET_FILES_REQUEST: 'GET_FILES_REQUEST',
1325
+ GET_FILES_SUCCESS: 'GET_FILES_SUCCESS',
1326
+ DELETE_FILES_REQUEST: 'DELETE_FILES_REQUEST',
1327
+ DELETE_FILES_SUCCESS: 'DELETE_FILES_SUCCESS',
1328
+ UPLOAD_FILES_REQUEST: 'UPLOAD_FILES_REQUEST',
1329
+ UPLOAD_FILES_SUCCESS: 'UPLOAD_FILES_SUCCESS',
1330
+ TRAINING_REQUEST: 'TRAINING_REQUEST',
1331
+ TEST_REQUEST: 'TEST_REQUEST',
1332
+ TEST_SUCCESS: 'TEST_SUCCESS',
1333
+ LOADING_START: 'LOADING_START',
1334
+ LOADING_FINISH: 'LOADING_FINISH',
1335
+ CHANGING_START: 'CHANGING_START',
1336
+ CHANGING_FINISH: 'CHANGING_FINISH',
1337
+ NETWORK_ONLINE: 'NETWORK_ONLINE',
1338
+ NETWORK_OFFLINE: 'NETWORK_OFFLINE'
1339
+ };
1340
+
1341
+ var getFilesAction = function getFilesAction(id, token) {
1342
+ return {
1343
+ type: Types.GET_FILES_REQUEST,
1344
+ payload: {
1345
+ id: id,
1346
+ token: token
1347
+ }
1348
+ };
1349
+ };
1350
+ var getFilesActionSuccess = function getFilesActionSuccess(_ref) {
1351
+ var files = _ref.files;
1352
+ return {
1353
+ type: Types.GET_FILES_SUCCESS,
1354
+ payload: {
1355
+ files: files
1356
+ }
1357
+ };
1358
+ };
1359
+ var deleteFilesAction = function deleteFilesAction(name, id, language, token) {
1360
+ return {
1361
+ type: Types.DELETE_FILES_REQUEST,
1362
+ payload: {
1363
+ name: name,
1364
+ id: id,
1365
+ language: language,
1366
+ token: token
1367
+ }
1368
+ };
1369
+ };
1370
+ var deleteFilesActionSuccess = function deleteFilesActionSuccess(_ref2) {
1371
+ var files = _ref2.files;
1372
+ return {
1373
+ type: Types.DELETE_FILES_SUCCESS,
1374
+ payload: {
1375
+ files: files
1376
+ }
1377
+ };
1378
+ };
1379
+ var uploadFilesAction = function uploadFilesAction(file, id, pressets, language, token) {
1380
+ return {
1381
+ type: Types.UPLOAD_FILES_REQUEST,
1382
+ payload: {
1383
+ file: file,
1384
+ id: id,
1385
+ pressets: pressets,
1386
+ language: language,
1387
+ token: token
1388
+ }
1389
+ };
1390
+ };
1391
+ var uploadFilesActionSuccess = function uploadFilesActionSuccess(_ref3) {
1392
+ var files = _ref3.files;
1393
+ return {
1394
+ type: Types.UPLOAD_FILES_SUCCESS,
1395
+ payload: {
1396
+ files: files
1397
+ }
1398
+ };
1399
+ };
1400
+ var trainingAction = function trainingAction(id, pressets, language, token) {
1401
+ return {
1402
+ type: Types.TRAINING_REQUEST,
1403
+ payload: {
1404
+ id: id,
1405
+ pressets: pressets,
1406
+ language: language,
1407
+ token: token
1408
+ }
1409
+ };
1410
+ };
1411
+ var testAction = function testAction(question, profile, presset, files_directory, token) {
1412
+ return {
1413
+ type: Types.TEST_REQUEST,
1414
+ payload: {
1415
+ question: question,
1416
+ profile: profile,
1417
+ presset: presset,
1418
+ files_directory: files_directory,
1419
+ token: token
1420
+ }
1421
+ };
1422
+ };
1423
+ var testActionSuccess = function testActionSuccess(_ref4) {
1424
+ var message = _ref4.message;
1425
+ return {
1426
+ type: Types.TEST_SUCCESS,
1427
+ payload: {
1428
+ message: message
1429
+ }
1430
+ };
1431
+ };
1432
+ var commonLoadingStart = function commonLoadingStart() {
1433
+ return {
1434
+ type: Types.LOADING_START
1435
+ };
1436
+ };
1437
+ var commonLoadingFinish = function commonLoadingFinish() {
1438
+ return {
1439
+ type: Types.LOADING_FINISH
1440
+ };
1441
+ };
1442
+
1443
+ var FileArea = function FileArea() {
1444
+ var _useSharedProps = useSharedProps(),
1445
+ id = _useSharedProps.id,
1446
+ language = _useSharedProps.language,
1447
+ propTags = _useSharedProps.propTags,
1448
+ token = _useSharedProps.token;
1449
+ var _useState = useState([]),
1450
+ files = _useState[0],
1451
+ setFiles = _useState[1];
1452
+ var _useState2 = useState([]),
1453
+ initialFiles = _useState2[0],
1454
+ setInitialFiles = _useState2[1];
1455
+ var _useState3 = useState(),
1456
+ uploadFile = _useState3[0],
1457
+ setUploadFile = _useState3[1];
1458
+ var _useState4 = useState(false),
1459
+ modal = _useState4[0],
1460
+ setModal = _useState4[1];
1461
+ var _useState5 = useState(false),
1462
+ modalDelete = _useState5[0],
1463
+ setModalDelete = _useState5[1];
1464
+ var _useState6 = useState(false),
1465
+ modalTraining = _useState6[0],
1466
+ setModalTraining = _useState6[1];
1467
+ var _useState7 = useState(''),
1468
+ fileDelete = _useState7[0],
1469
+ setFileDelete = _useState7[1];
1470
+ var _useState8 = useState([]),
1471
+ optionsPresset = _useState8[0],
1472
+ setOptionsPresset = _useState8[1];
1473
+ var _useState9 = useState([]),
1474
+ presset = _useState9[0],
1475
+ setPresset = _useState9[1];
1476
+ var t = getLanguage(language);
1477
+ var dispatch = useDispatch();
1478
+ var initFiles = useSelector(function (state) {
1479
+ return state.files;
1480
+ });
1481
+ var isloading = useSelector(function (state) {
1482
+ return state.isloading;
1483
+ });
1484
+ var tags = propTags ? propTags.tags : [];
1485
+ useEffect(function () {
1486
+ dispatch(getFilesAction(id, token));
1487
+ }, [id]);
1488
+ useEffect(function () {
1489
+ if (tags.length > 0) {
1490
+ var options = tags.map(function (tag) {
1491
+ return {
1492
+ label: tag,
1493
+ value: tag
1494
+ };
1495
+ });
1496
+ setOptionsPresset(options);
1497
+ } else if (optionsPresset.length > 0) {
1498
+ setOptionsPresset([]);
1499
+ }
1500
+ }, [tags]);
1501
+ useEffect(function () {
1502
+ if (!modal) {
1503
+ var options = tags.map(function (tag) {
1504
+ return {
1505
+ label: tag,
1506
+ value: tag
1507
+ };
1508
+ });
1509
+ setOptionsPresset(options);
1510
+ }
1511
+ }, [modal]);
1512
+ useEffect(function () {
1513
+ if (!!initFiles) {
1514
+ setFiles(initFiles);
1515
+ setInitialFiles(initFiles);
1516
+ }
1517
+ }, [initFiles]);
1518
+ var pressetTag = function pressetTag(tags) {
1519
+ var html = '';
1520
+ html += tags.map(function (tag) {
1521
+ var checkIcon = tag.trained ? '' : renderToString(React.createElement(TiDelete, {
1522
+ size: 14
1523
+ }));
1524
+ var tagClass = tag.trained ? 'trained' : '';
1525
+ return "<p class='tag " + tagClass + "'>" + tag.name + " " + checkIcon + "</p>";
1526
+ }).join('');
1527
+ return html;
1528
+ };
1529
+ var handleOpenModal = function handleOpenModal() {
1530
+ if (modal) {
1531
+ setUploadFile(undefined);
1532
+ setPresset([]);
1533
+ }
1534
+ setModal(!modal);
1535
+ };
1536
+ var handleOpenModalDelete = function handleOpenModalDelete(name) {
1537
+ console.log('--- handleOpenModalDelete: ', name);
1538
+ setFileDelete(name);
1539
+ setModalDelete(!modalDelete);
1540
+ };
1541
+ var handleOpenModalTraining = function handleOpenModalTraining(tags) {
1542
+ var pressets = [];
1543
+ tags == null || tags.map(function (tag) {
1544
+ if (!tag.trained) {
1545
+ pressets.push(tag.name);
1546
+ }
1547
+ });
1548
+ setPresset(pressets);
1549
+ setModalTraining(!modalTraining);
1550
+ };
1551
+ var deleteFile = function deleteFile() {
1552
+ console.log('--- vai deletar: ', fileDelete);
1553
+ dispatch(deleteFilesAction(fileDelete, id, language, token));
1554
+ setModalDelete(false);
1555
+ };
1556
+ var handleUploadFile = function handleUploadFile() {
1557
+ dispatch(uploadFilesAction(uploadFile, id, presset, language, token));
1558
+ setModal(false);
1559
+ setUploadFile(undefined);
1560
+ setPresset([]);
1561
+ };
1562
+ var handleTrain = function handleTrain() {
1563
+ dispatch(trainingAction(id, presset, language, token));
1564
+ setModalTraining(false);
1565
+ setPresset([]);
1566
+ };
1567
+ var viewFile = function viewFile(link, name) {
1568
+ if (link) {
1569
+ var checkIcon = renderToString(React.createElement(FaFile, {
1570
+ size: 14
1571
+ }));
1572
+ return "<a href='" + link + "' target='_blank'>" + checkIcon + "</a> " + name;
1573
+ }
1574
+ return name;
1575
+ };
1576
+ var renderFiles = function renderFiles() {
1577
+ return React.createElement(Container, {
1578
+ isloading: isloading
1579
+ }, React.createElement("div", {
1580
+ id: 'loading'
1581
+ }), React.createElement(Header, null, React.createElement("div", {
1582
+ className: 'infos'
1583
+ }, React.createElement("h2", null, t.files), React.createElement("p", null, t.fileArea.description)), React.createElement("div", {
1584
+ className: 'actions'
1585
+ }, React.createElement(SearchInput, {
1586
+ placeholder: t.fileArea.search,
1587
+ setFiles: setFiles,
1588
+ initialFiles: initialFiles
1589
+ }), React.createElement("div", null, React.createElement("button", {
1590
+ id: 'button-upload',
1591
+ onClick: handleOpenModal
1592
+ }, React.createElement(FaUpload, {
1593
+ size: 14
1594
+ }), " ", t.fileArea.fileUpload), React.createElement("button", {
1595
+ onClick: function onClick() {
1596
+ return handleOpenModalTraining(undefined);
1597
+ }
1598
+ }, React.createElement(GiWeightLiftingUp, {
1599
+ size: 14
1600
+ }), " ", t.fileArea.training)))), files.length === 0 ? React.createElement(EmptyState, {
1601
+ icon: React.createElement(FaList, null),
1602
+ title: t.fileArea.emptyState.title,
1603
+ description: t.fileArea.emptyState.description,
1604
+ iconButton: React.createElement("button", {
1605
+ id: 'button-upload',
1606
+ onClick: handleOpenModal
1607
+ }, React.createElement(FaUpload, {
1608
+ size: 14
1609
+ }), " ", t.fileArea.fileUpload),
1610
+ descriptionButton: t.fileArea.fileUpload,
1611
+ widthButton: "230px"
1612
+ }) : React.createElement(Table$1, null, React.createElement("thead", null, React.createElement("tr", null, React.createElement("th", {
1613
+ key: "th_file_name",
1614
+ className: "th_file_name"
1615
+ }, t.fileArea.fileName), React.createElement("th", {
1616
+ key: "th_file_name",
1617
+ className: "th_status"
1618
+ }, t.fileArea.status), React.createElement("th", {
1619
+ key: "th_pressets",
1620
+ className: "th_pressets"
1621
+ }, t.fileArea.presset), React.createElement("th", {
1622
+ key: "th_actions",
1623
+ className: "th_actions"
1624
+ }, t.fileArea.actions))), React.createElement("tbody", null, files.map(function (object) {
1625
+ return React.createElement("tr", null, React.createElement("td", {
1626
+ dangerouslySetInnerHTML: {
1627
+ __html: viewFile(object.link, object.name)
1628
+ }
1629
+ }), React.createElement("td", null, object.trained ? React.createElement(FaCheck, {
1630
+ size: 14,
1631
+ style: {
1632
+ color: 'green'
1633
+ }
1634
+ }) : React.createElement(TiDelete, {
1635
+ size: 14,
1636
+ style: {
1637
+ color: 'red'
1638
+ }
1639
+ })), React.createElement("td", {
1640
+ className: 'tags',
1641
+ dangerouslySetInnerHTML: {
1642
+ __html: pressetTag(object.tags)
1643
+ }
1644
+ }), React.createElement("td", null, React.createElement("div", {
1645
+ className: 'divDelete'
1646
+ }, React.createElement("button", {
1647
+ className: 'buttonTraining',
1648
+ onClick: function onClick() {
1649
+ return handleOpenModalTraining(object.tags);
1650
+ }
1651
+ }, t.buttons.training), React.createElement("button", {
1652
+ className: 'buttonDelete',
1653
+ onClick: function onClick() {
1654
+ return handleOpenModalDelete(object.name);
1655
+ }
1656
+ }, t.buttons["delete"]))));
1657
+ }))), React.createElement(Modal$1, {
1658
+ isopen: modal,
1659
+ maxwidth: "600px",
1660
+ maxheight: "max-content",
1661
+ onClose: handleOpenModal,
1662
+ title: t.fileArea.modal.uploadFile
1663
+ }, React.createElement(ModalContent, null, React.createElement("div", {
1664
+ className: 'choose-file'
1665
+ }, React.createElement(AreaUpload, {
1666
+ setFile: setUploadFile,
1667
+ file: uploadFile == null ? void 0 : uploadFile.properties.name
1668
+ })), React.createElement("div", {
1669
+ className: 'presset'
1670
+ }, React.createElement("p", null, t.fileArea.presset), React.createElement(MultiSelect, {
1671
+ setOptions: setOptionsPresset,
1672
+ options: optionsPresset,
1673
+ presset: presset,
1674
+ setPresset: setPresset,
1675
+ modal: modal,
1676
+ language: language,
1677
+ hasAddNewOptions: true
1678
+ }))), React.createElement(ModalFooter, null, React.createElement("button", {
1679
+ className: 'button cancel',
1680
+ onClick: handleOpenModal
1681
+ }, t.buttons.cancel), React.createElement("button", {
1682
+ onClick: function onClick() {
1683
+ return handleUploadFile();
1684
+ },
1685
+ className: 'button send',
1686
+ type: "submit",
1687
+ form: "form-tts"
1688
+ }, t.buttons.send))), React.createElement(Modal$1, {
1689
+ isopen: modalDelete,
1690
+ maxwidth: "600px",
1691
+ maxheight: "max-content",
1692
+ onClose: function onClose() {
1693
+ return handleOpenModalDelete('');
1694
+ },
1695
+ title: t.fileArea.modal.deleteFileTitle
1696
+ }, React.createElement(ModalContent, null, React.createElement("p", {
1697
+ id: 'warning'
1698
+ }, t.fileArea.modal.deleteFile)), React.createElement(ModalFooter, null, React.createElement("button", {
1699
+ className: 'button cancel',
1700
+ onClick: function onClick() {
1701
+ return handleOpenModalDelete('');
1702
+ }
1703
+ }, t.buttons.cancel), React.createElement("button", {
1704
+ className: 'button delete',
1705
+ type: "submit",
1706
+ form: "form-tts",
1707
+ onClick: deleteFile
1708
+ }, t.buttons["delete"]))), React.createElement(Modal$1, {
1709
+ isopen: modalTraining,
1710
+ maxwidth: "600px",
1711
+ maxheight: "max-content",
1712
+ onClose: function onClose() {
1713
+ return handleOpenModalTraining(undefined);
1714
+ },
1715
+ title: t.fileArea.modal.trainingTitle
1716
+ }, React.createElement(ModalContent, null, React.createElement("p", {
1717
+ id: 'info'
1718
+ }, t.fileArea.modal.trainingDescription), React.createElement("div", {
1719
+ className: 'presset'
1720
+ }, React.createElement("p", null, t.fileArea.presset), React.createElement(MultiSelect, {
1721
+ setOptions: setOptionsPresset,
1722
+ options: optionsPresset,
1723
+ presset: presset,
1724
+ setPresset: setPresset,
1725
+ modal: modal,
1726
+ language: language,
1727
+ hasAddNewOptions: false
1728
+ }))), React.createElement(ModalFooter, null, React.createElement("button", {
1729
+ className: 'button cancel',
1730
+ onClick: function onClick() {
1731
+ return handleOpenModalTraining(undefined);
1732
+ }
1733
+ }, t.buttons.cancel), React.createElement("button", {
1734
+ onClick: function onClick() {
1735
+ return handleTrain();
1736
+ },
1737
+ className: 'button send',
1738
+ type: "submit",
1739
+ form: "form-tts"
1740
+ }, t.buttons.send))));
1741
+ };
1742
+ return React.createElement(SharedPropsProvider, {
1743
+ id: id,
1744
+ language: language,
1745
+ token: token,
1746
+ propTags: {
1747
+ tags: []
1748
+ },
1749
+ personas: [{
1750
+ name: '',
1751
+ description: ''
1752
+ }]
1753
+ }, React.createElement(Container, null, renderFiles()));
1754
+ };
1755
+
1756
+ var _templateObject$9, _templateObject2$6, _templateObject3$5, _templateObject4$2, _templateObject5$2;
1757
+ var Container$3 = /*#__PURE__*/styled.div(_templateObject$9 || (_templateObject$9 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n\n"])), function (props) {
1758
+ return props.isloading && css(_templateObject2$6 || (_templateObject2$6 = _taggedTemplateLiteralLoose(["\n #loading {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: rgb(151,154,165, 0.7);\n display: flex;\n justify-content: center;\n align-items: center;\n z-index: 9999;\n }\n\n #loading::after {\n content: \"\";\n border: 4px solid #f3f3f3; /* Cor do s\xEDmbolo de carregamento */\n border-top: 4px solid #5a5d68; /* Cor do s\xEDmbolo de carregamento */\n border-radius: 50%;\n width: 13px;\n height: 13px;\n animation: spin 1s linear infinite;\n }\n\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n "])));
1759
+ });
1760
+ var Header$1 = /*#__PURE__*/styled.div(_templateObject3$5 || (_templateObject3$5 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n .infos {\n display: flex;\n flex-direction: column;\n padding: 14px 0;\n\n h2 {\n font-size: 20px\n }\n\n p {\n font-size: 14px\n }\n }\n"])));
1761
+ var Inputs = /*#__PURE__*/styled.div(_templateObject4$2 || (_templateObject4$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n justify-content: space-between;\n margin-bottom: 10px;\n\n button {\n background: #102693;\n padding: 10px 20px;\n color: white;\n border-radius: 4px;\n width: 190px;\n height: 45px;\n display: flex;\n justify-content: space-between;\n align-items: center;\n\n svg {\n width: 23px;\n height: 23px;\n }\n }\n"])));
1762
+ var Result = /*#__PURE__*/styled.div(_templateObject5$2 || (_templateObject5$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n justify-content: left;\n background: #F3F5F9;\n padding: 15px;\n border-radius: 5px;\n margin-top: 15px;\n\n .text{\n margin-left: 5px;\n font-size: 14px;\n line-height: 1.5;\n }\n\n .icon {\n display: flex;\n justify-content: center;\n align-items: center;\n margin-right: 5px;\n\n svg {\n width: 35px;\n height: 35px;\n }\n }\n\n"])));
1763
+
1764
+ var _templateObject$a;
1765
+ var Container$4 = /*#__PURE__*/styled.div(_templateObject$a || (_templateObject$a = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: relative;\n width: 50%;\n margin-right: 5px;\n\n .custom-select {\n position: relative;\n width: 100%;\n cursor: pointer;\n\n .selected-option {\n padding: 12px;\n border-radius: 4px;\n border: 1px solid #979AA5;\n height: 45px;\n display: flex;\n align-items: center;\n justify-content: space-between;\n font-size: 14px;\n }\n\n .options {\n position: absolute;\n top: 100%;\n left: 0;\n width: 100%;\n border: 1px solid #979AA5;\n border-top: none;\n border-radius: 0 0 4px 4px;\n background-color: #fff;\n\n .option {\n padding: 12px;\n cursor: pointer;\n transition: background-color 0.1s;\n letter-spacing: 0.5px;\n font-size: 14px;\n\n &:hover {\n background-color: #6690ff;\n color: white;\n }\n }\n }\n }\n"])));
1766
+
1767
+ var CustomSelect = function CustomSelect(_ref) {
1768
+ var options = _ref.options,
1769
+ onSelect = _ref.onSelect,
1770
+ placeholder = _ref.placeholder;
1771
+ var _useState = useState(false),
1772
+ isOpen = _useState[0],
1773
+ setIsOpen = _useState[1];
1774
+ var _useState2 = useState(''),
1775
+ selectedValue = _useState2[0],
1776
+ setSelectedValue = _useState2[1];
1777
+ var handleSelectOption = function handleSelectOption(value) {
1778
+ var selected = String(value);
1779
+ setSelectedValue(selected);
1780
+ onSelect(selected);
1781
+ setIsOpen(false);
1782
+ };
1783
+ return React.createElement(Container$4, null, React.createElement("div", {
1784
+ className: "custom-select",
1785
+ onClick: function onClick() {
1786
+ return setIsOpen(!isOpen);
1787
+ }
1788
+ }, React.createElement("div", {
1789
+ className: "selected-option"
1790
+ }, selectedValue || placeholder, React.createElement("span", {
1791
+ className: "arrow"
1792
+ }, "\u25BC")), isOpen && React.createElement("div", {
1793
+ className: "options"
1794
+ }, options.map(function (option) {
1795
+ return React.createElement("div", {
1796
+ key: option.value,
1797
+ style: {
1798
+ background: option.value === selectedValue ? '#a0b7f5' : undefined,
1799
+ color: option.value === selectedValue ? 'white' : undefined
1800
+ },
1801
+ className: "option",
1802
+ onClick: function onClick() {
1803
+ return handleSelectOption(option.value);
1804
+ }
1805
+ }, option.label);
1806
+ }))));
1807
+ };
1808
+
1809
+ var _templateObject$b, _templateObject2$7;
1810
+ var Container$5 = /*#__PURE__*/styled.div(_templateObject$b || (_templateObject$b = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: relative;\n width: 100%;\n margin-right: 5px;\n"])));
1811
+ var StyledInput = /*#__PURE__*/styled.input(_templateObject2$7 || (_templateObject2$7 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n padding-left: 10px;\n padding-right: 40px;\n border-radius: 5px;\n border: 1px solid #ccc;\n height: 45px;\n width: 100%;\n\n &:focus {\n outline: none;\n box-shadow: 0 0 0 3px #6690ff;\n }\n"])));
1812
+
1813
+ var InputTest = function InputTest(_ref) {
1814
+ var placeholder = _ref.placeholder,
1815
+ _onChange = _ref.onChange;
1816
+ return React.createElement(Container$5, null, React.createElement(StyledInput, {
1817
+ type: "text",
1818
+ onChange: function onChange(e) {
1819
+ return _onChange(e.target.value);
1820
+ },
1821
+ placeholder: placeholder
1822
+ }));
1823
+ };
1824
+
1825
+ var TestArea = function TestArea() {
1826
+ var _useSharedProps = useSharedProps(),
1827
+ id = _useSharedProps.id,
1828
+ language = _useSharedProps.language,
1829
+ personas = _useSharedProps.personas,
1830
+ propTags = _useSharedProps.propTags,
1831
+ token = _useSharedProps.token;
1832
+ var t = getLanguage(language);
1833
+ var results = useSelector(function (state) {
1834
+ return state.message;
1835
+ });
1836
+ var isloading = useSelector(function (state) {
1837
+ return state.isloading;
1838
+ });
1839
+ var _useState = useState(''),
1840
+ search = _useState[0],
1841
+ setSearch = _useState[1];
1842
+ var _useState2 = useState(''),
1843
+ profile = _useState2[0],
1844
+ setProfile = _useState2[1];
1845
+ var _useState3 = useState(''),
1846
+ presset = _useState3[0],
1847
+ setPresset = _useState3[1];
1848
+ var dispatch = useDispatch();
1849
+ var tags = propTags ? propTags.tags : [];
1850
+ var optionsPersona = personas && personas.map(function (persona) {
1851
+ return {
1852
+ label: persona.name,
1853
+ value: persona.name
1854
+ };
1855
+ });
1856
+ var optionsPresset = tags.map(function (tag) {
1857
+ return {
1858
+ label: tag,
1859
+ value: tag
1860
+ };
1861
+ });
1862
+ var handleSelectPersona = function handleSelectPersona(value) {
1863
+ setProfile(value);
1864
+ };
1865
+ var handleSelectPresset = function handleSelectPresset(value) {
1866
+ setPresset(value);
1867
+ };
1868
+ var handleSearch = function handleSearch(value) {
1869
+ setSearch(value);
1870
+ };
1871
+ var handleTest = function handleTest() {
1872
+ dispatch(testAction(search, profile, presset, id, token));
1873
+ };
1874
+ var returnTest = function returnTest() {
1875
+ return React.createElement(Container$3, {
1876
+ isloading: isloading
1877
+ }, React.createElement("div", {
1878
+ id: 'loading'
1879
+ }), React.createElement(Header$1, null, React.createElement("div", {
1880
+ className: 'infos'
1881
+ }, React.createElement("h2", null, t.test), React.createElement("p", null, t.testArea.description))), React.createElement(Inputs, null, React.createElement(InputTest, {
1882
+ placeholder: t.testArea.typeSentence,
1883
+ onChange: handleSearch
1884
+ }), React.createElement(CustomSelect, {
1885
+ placeholder: t.testArea.selectPersona,
1886
+ options: optionsPersona,
1887
+ onSelect: handleSelectPersona
1888
+ }), React.createElement(CustomSelect, {
1889
+ placeholder: t.testArea.selectPresset,
1890
+ options: optionsPresset,
1891
+ onSelect: handleSelectPresset
1892
+ }), React.createElement("button", {
1893
+ onClick: handleTest
1894
+ }, React.createElement(PiWaveformBold, null), " ", t.buttons.test)), !results ? React.createElement(EmptyState, {
1895
+ icon: React.createElement(FaList, null),
1896
+ title: t.testArea.emptyState.title,
1897
+ description: t.testArea.emptyState.description,
1898
+ activeButton: false
1899
+ }) : React.createElement(Result, null, React.createElement("div", {
1900
+ className: 'icon'
1901
+ }, React.createElement(MdPerson2, null)), React.createElement("div", {
1902
+ className: 'text'
1903
+ }, results)));
1904
+ };
1905
+ return React.createElement(SharedPropsProvider, {
1906
+ id: id,
1907
+ token: token,
1908
+ language: language,
1909
+ propTags: {
1910
+ tags: []
1911
+ },
1912
+ personas: [{
1913
+ name: '',
1914
+ description: ''
1915
+ }]
1916
+ }, React.createElement(Container$3, null, returnTest()));
1917
+ };
1918
+
1919
+ var Leia = function Leia(props) {
1920
+ var match = useRouteMatch();
1921
+ var _useLocation = useLocation(),
1922
+ pathname = _useLocation.pathname;
1923
+ var history = useHistory();
1924
+ var t = getLanguage(props.language);
1925
+ var activeTab = useMemo(function () {
1926
+ return pathname.split('/')[5] || 'files';
1927
+ }, [pathname]);
1928
+ return React.createElement(SharedPropsProvider, Object.assign({
1929
+ propTags: {
1930
+ tags: []
1931
+ },
1932
+ personas: [{
1933
+ name: '',
1934
+ description: ''
1935
+ }]
1936
+ }, props), React.createElement(React.Fragment, null, React.createElement(Tabs, {
1937
+ value: activeTab,
1938
+ onChange: function onChange(value) {
1939
+ return history.push(match.url + "/" + value);
1940
+ }
1941
+ }, React.createElement(Tab$1, {
1942
+ value: "files"
1943
+ }, t.files), React.createElement(Tab$1, {
1944
+ value: "test"
1945
+ }, t.test)), React.createElement(Suspense, {
1946
+ fallback: props.loading
1947
+ }, React.createElement(Switch, null, React.createElement(Route, {
1948
+ path: "" + match.path,
1949
+ exact: true,
1950
+ component: FileArea
1951
+ }), React.createElement(Route, {
1952
+ path: match.path + "/files",
1953
+ component: FileArea
1954
+ }), React.createElement(Route, {
1955
+ path: match.path + "/test",
1956
+ component: TestArea
1957
+ })))));
1958
+ };
1959
+
1960
+ var INITIAL_STATE = {
1961
+ files: [],
1962
+ message: '',
1963
+ isloading: false,
1964
+ isChanging: false,
1965
+ isOffline: true
1966
+ };
1967
+ function filesReducer(state, action) {
1968
+ if (state === void 0) {
1969
+ state = INITIAL_STATE;
1970
+ }
1971
+ return produce(state, function (draft) {
1972
+ switch (action.type) {
1973
+ case Types.GET_FILES_SUCCESS:
1974
+ draft.files = action.payload.files;
1975
+ break;
1976
+ case Types.DELETE_FILES_SUCCESS:
1977
+ draft.files = action.payload.files;
1978
+ break;
1979
+ case Types.TEST_SUCCESS:
1980
+ draft.message = action.payload.message;
1981
+ break;
1982
+ case Types.LOADING_START:
1983
+ draft.isloading = true;
1984
+ break;
1985
+ case Types.LOADING_FINISH:
1986
+ draft.isloading = false;
1987
+ break;
1988
+ case Types.CHANGING_START:
1989
+ draft.isChanging = true;
1990
+ break;
1991
+ case Types.CHANGING_FINISH:
1992
+ draft.isChanging = false;
1993
+ break;
1994
+ case Types.NETWORK_ONLINE:
1995
+ draft.isOffline = false;
1996
+ break;
1997
+ case Types.NETWORK_OFFLINE:
1998
+ draft.isOffline = true;
1999
+ break;
2000
+ default:
2001
+ return action.payload;
2002
+ }
2003
+ });
2004
+ }
2005
+
2006
+ var CustomToastContent = function CustomToastContent(_ref) {
2007
+ var title = _ref.title,
2008
+ description = _ref.description;
2009
+ return React.createElement(React.Fragment, null, React.createElement("div", {
2010
+ className: "custom-toastify-content"
2011
+ }, React.createElement("strong", {
2012
+ className: "custom-toastify-title"
2013
+ }, title), description && React.createElement("p", {
2014
+ className: "custom-toastify-description"
2015
+ }, description)));
2016
+ };
2017
+ var toast = {
2018
+ "default": function _default(_ref2) {
2019
+ var title = _ref2.title,
2020
+ description = _ref2.description;
2021
+ return toast$1(React.createElement(CustomToastContent, {
2022
+ title: title,
2023
+ description: description
2024
+ }));
2025
+ },
2026
+ success: function success(_ref3) {
2027
+ var title = _ref3.title,
2028
+ description = _ref3.description;
2029
+ return toast$1.success(React.createElement(CustomToastContent, {
2030
+ title: title,
2031
+ description: description
2032
+ }));
2033
+ },
2034
+ error: function error(_ref4) {
2035
+ var title = _ref4.title,
2036
+ description = _ref4.description;
2037
+ return toast$1.error(React.createElement(CustomToastContent, {
2038
+ title: title,
2039
+ description: description
2040
+ }));
2041
+ },
2042
+ warn: function warn(_ref5) {
2043
+ var title = _ref5.title,
2044
+ description = _ref5.description;
2045
+ return toast$1.warn(React.createElement(CustomToastContent, {
2046
+ title: title,
2047
+ description: description
2048
+ }));
2049
+ }
2050
+ };
2051
+
2052
+ var _marked = /*#__PURE__*/_regeneratorRuntime().mark(getFilesSaga),
2053
+ _marked2 = /*#__PURE__*/_regeneratorRuntime().mark(deleteFilesSaga),
2054
+ _marked3 = /*#__PURE__*/_regeneratorRuntime().mark(testSaga),
2055
+ _marked4 = /*#__PURE__*/_regeneratorRuntime().mark(uploadFilesSaga),
2056
+ _marked5 = /*#__PURE__*/_regeneratorRuntime().mark(TrainingSaga),
2057
+ _marked6 = /*#__PURE__*/_regeneratorRuntime().mark(filesSagas);
2058
+ function getFilesSaga(action) {
2059
+ var _action$payload, id, token, _yield$call, data;
2060
+ return _regeneratorRuntime().wrap(function getFilesSaga$(_context) {
2061
+ while (1) switch (_context.prev = _context.next) {
2062
+ case 0:
2063
+ _context.prev = 0;
2064
+ _context.next = 3;
2065
+ return put(commonLoadingStart());
2066
+ case 3:
2067
+ _action$payload = action.payload, id = _action$payload.id, token = _action$payload.token;
2068
+ _context.next = 6;
2069
+ return call(api.get, "/training/" + id + "?token=" + token);
2070
+ case 6:
2071
+ _yield$call = _context.sent;
2072
+ data = _yield$call.data;
2073
+ _context.next = 10;
2074
+ return put(getFilesActionSuccess({
2075
+ files: data.files
2076
+ }));
2077
+ case 10:
2078
+ _context.next = 15;
2079
+ break;
2080
+ case 12:
2081
+ _context.prev = 12;
2082
+ _context.t0 = _context["catch"](0);
2083
+ console.log('-----------getFiles.error------------------->', _context.t0);
2084
+ case 15:
2085
+ _context.prev = 15;
2086
+ _context.next = 18;
2087
+ return put(commonLoadingFinish());
2088
+ case 18:
2089
+ return _context.finish(15);
2090
+ case 19:
2091
+ case "end":
2092
+ return _context.stop();
2093
+ }
2094
+ }, _marked, null, [[0, 12, 15, 19]]);
2095
+ }
2096
+ function deleteFilesSaga(action) {
2097
+ var t, _action$payload2, id, name, token, _yield$call2, data;
2098
+ return _regeneratorRuntime().wrap(function deleteFilesSaga$(_context2) {
2099
+ while (1) switch (_context2.prev = _context2.next) {
2100
+ case 0:
2101
+ t = getLanguage(action.payload.language);
2102
+ _context2.prev = 1;
2103
+ _context2.next = 4;
2104
+ return put(commonLoadingStart());
2105
+ case 4:
2106
+ _action$payload2 = action.payload, id = _action$payload2.id, name = _action$payload2.name, token = _action$payload2.token;
2107
+ _context2.next = 7;
2108
+ return call(api["delete"], "/delete/" + id + "/" + name + "?token=" + token);
2109
+ case 7:
2110
+ _context2.next = 9;
2111
+ return call(api.get, "/training/" + id + "?token=" + token);
2112
+ case 9:
2113
+ _yield$call2 = _context2.sent;
2114
+ data = _yield$call2.data;
2115
+ _context2.next = 13;
2116
+ return put(deleteFilesActionSuccess({
2117
+ files: data.files,
2118
+ success: true
2119
+ }));
2120
+ case 13:
2121
+ _context2.next = 19;
2122
+ break;
2123
+ case 15:
2124
+ _context2.prev = 15;
2125
+ _context2.t0 = _context2["catch"](1);
2126
+ toast.error({
2127
+ title: t.toast.deleteFile.fail.title,
2128
+ description: t.toast.deleteFile.fail.description
2129
+ });
2130
+ console.log('-----------deleteFilesSaga.error------------------->', _context2.t0);
2131
+ case 19:
2132
+ _context2.prev = 19;
2133
+ _context2.next = 22;
2134
+ return put(commonLoadingFinish());
2135
+ case 22:
2136
+ return _context2.finish(19);
2137
+ case 23:
2138
+ case "end":
2139
+ return _context2.stop();
2140
+ }
2141
+ }, _marked2, null, [[1, 15, 19, 23]]);
2142
+ }
2143
+ function testSaga(action) {
2144
+ var _action$payload3, question, profile, presset, files_directory, token, _yield$call3, data;
2145
+ return _regeneratorRuntime().wrap(function testSaga$(_context3) {
2146
+ while (1) switch (_context3.prev = _context3.next) {
2147
+ case 0:
2148
+ _context3.prev = 0;
2149
+ _context3.next = 3;
2150
+ return put(commonLoadingStart());
2151
+ case 3:
2152
+ _action$payload3 = action.payload, question = _action$payload3.question, profile = _action$payload3.profile, presset = _action$payload3.presset, files_directory = _action$payload3.files_directory, token = _action$payload3.token;
2153
+ _context3.next = 6;
2154
+ return call(api.post, "/ask", {
2155
+ question: question,
2156
+ profile: profile,
2157
+ tag: presset,
2158
+ files_directory: files_directory,
2159
+ token: token
2160
+ });
2161
+ case 6:
2162
+ _yield$call3 = _context3.sent;
2163
+ data = _yield$call3.data;
2164
+ _context3.next = 10;
2165
+ return put(testActionSuccess({
2166
+ message: data.message
2167
+ }));
2168
+ case 10:
2169
+ _context3.next = 15;
2170
+ break;
2171
+ case 12:
2172
+ _context3.prev = 12;
2173
+ _context3.t0 = _context3["catch"](0);
2174
+ console.log('-----------testSaga.error------------------->', _context3.t0);
2175
+ case 15:
2176
+ _context3.prev = 15;
2177
+ _context3.next = 18;
2178
+ return put(commonLoadingFinish());
2179
+ case 18:
2180
+ return _context3.finish(15);
2181
+ case 19:
2182
+ case "end":
2183
+ return _context3.stop();
2184
+ }
2185
+ }, _marked3, null, [[0, 12, 15, 19]]);
2186
+ }
2187
+ function uploadFilesSaga(action) {
2188
+ var t, _action$payload4, id, file, pressets, token, blob, formData, queryParams, url, _yield$call4, data;
2189
+ return _regeneratorRuntime().wrap(function uploadFilesSaga$(_context4) {
2190
+ while (1) switch (_context4.prev = _context4.next) {
2191
+ case 0:
2192
+ t = getLanguage(action.payload.language);
2193
+ _context4.prev = 1;
2194
+ _context4.next = 4;
2195
+ return put(commonLoadingStart());
2196
+ case 4:
2197
+ _action$payload4 = action.payload, id = _action$payload4.id, file = _action$payload4.file, pressets = _action$payload4.pressets, token = _action$payload4.token;
2198
+ blob = new Blob([file.content]);
2199
+ formData = new FormData();
2200
+ formData.append('file', blob, file.properties.path);
2201
+ queryParams = pressets.length ? new URLSearchParams({
2202
+ tags: pressets.join(',')
2203
+ }).toString() : '';
2204
+ url = queryParams ? "/upload/" + id + "?token=" + token + "&" + queryParams : "/upload/" + id + "?token=" + token;
2205
+ _context4.next = 12;
2206
+ return call(api.post, url, formData, {
2207
+ headers: {
2208
+ 'Content-Type': 'multipart/form-data'
2209
+ }
2210
+ });
2211
+ case 12:
2212
+ _context4.next = 14;
2213
+ return call(api.get, "/training/" + id + "?token=" + token);
2214
+ case 14:
2215
+ _yield$call4 = _context4.sent;
2216
+ data = _yield$call4.data;
2217
+ _context4.next = 18;
2218
+ return put(uploadFilesActionSuccess({
2219
+ files: data.files
2220
+ }));
2221
+ case 18:
2222
+ _context4.next = 24;
2223
+ break;
2224
+ case 20:
2225
+ _context4.prev = 20;
2226
+ _context4.t0 = _context4["catch"](1);
2227
+ toast.error({
2228
+ title: t.toast.uploadFile.fail.title,
2229
+ description: t.toast.uploadFile.fail.description
2230
+ });
2231
+ console.log('-----------uploadFilesSaga.error------------------->', _context4.t0);
2232
+ case 24:
2233
+ _context4.prev = 24;
2234
+ _context4.next = 27;
2235
+ return put(commonLoadingFinish());
2236
+ case 27:
2237
+ return _context4.finish(24);
2238
+ case 28:
2239
+ case "end":
2240
+ return _context4.stop();
2241
+ }
2242
+ }, _marked4, null, [[1, 20, 24, 28]]);
2243
+ }
2244
+ function TrainingSaga(action) {
2245
+ var t, _action$payload5, id, pressets, token, tag, queryParams, _yield$call5, data;
2246
+ return _regeneratorRuntime().wrap(function TrainingSaga$(_context5) {
2247
+ while (1) switch (_context5.prev = _context5.next) {
2248
+ case 0:
2249
+ t = getLanguage(action.payload.language);
2250
+ _context5.prev = 1;
2251
+ _context5.next = 4;
2252
+ return put(commonLoadingStart());
2253
+ case 4:
2254
+ _action$payload5 = action.payload, id = _action$payload5.id, pressets = _action$payload5.pressets, token = _action$payload5.token;
2255
+ tag = pressets.join(',');
2256
+ queryParams = new URLSearchParams({
2257
+ tag: tag
2258
+ }).toString();
2259
+ _context5.next = 9;
2260
+ return call(api.post, pressets.length > 0 ? "/training?" + queryParams : "/training", {
2261
+ files_directory: id,
2262
+ token: token
2263
+ });
2264
+ case 9:
2265
+ _context5.next = 11;
2266
+ return call(api.get, "/training/" + id + "?token=" + token);
2267
+ case 11:
2268
+ _yield$call5 = _context5.sent;
2269
+ data = _yield$call5.data;
2270
+ _context5.next = 15;
2271
+ return put(uploadFilesActionSuccess({
2272
+ files: data.files
2273
+ }));
2274
+ case 15:
2275
+ toast.success({
2276
+ title: t.toast.Train.success.title,
2277
+ description: t.toast.Train.success.description
2278
+ });
2279
+ _context5.next = 22;
2280
+ break;
2281
+ case 18:
2282
+ _context5.prev = 18;
2283
+ _context5.t0 = _context5["catch"](1);
2284
+ toast.error({
2285
+ title: t.toast.Train.fail.title,
2286
+ description: t.toast.Train.fail.description
2287
+ });
2288
+ console.log('-----------TrainingSaga.error------------------->', _context5.t0);
2289
+ case 22:
2290
+ _context5.prev = 22;
2291
+ _context5.next = 25;
2292
+ return put(commonLoadingFinish());
2293
+ case 25:
2294
+ return _context5.finish(22);
2295
+ case 26:
2296
+ case "end":
2297
+ return _context5.stop();
2298
+ }
2299
+ }, _marked5, null, [[1, 18, 22, 26]]);
2300
+ }
2301
+ function filesSagas() {
2302
+ return _regeneratorRuntime().wrap(function filesSagas$(_context6) {
2303
+ while (1) switch (_context6.prev = _context6.next) {
2304
+ case 0:
2305
+ _context6.next = 2;
2306
+ return all([takeLatest(Types.GET_FILES_REQUEST, getFilesSaga), takeLatest(Types.DELETE_FILES_REQUEST, deleteFilesSaga), takeLatest(Types.UPLOAD_FILES_REQUEST, uploadFilesSaga), takeLatest(Types.TEST_REQUEST, testSaga), takeLatest(Types.TRAINING_REQUEST, TrainingSaga)]);
2307
+ case 2:
2308
+ case "end":
2309
+ return _context6.stop();
2310
+ }
2311
+ }, _marked6);
2312
+ }
2313
+
2314
+ var sagaMiddleware = /*#__PURE__*/createSagaMiddleware();
2315
+ var store = /*#__PURE__*/createStore(filesReducer, /*#__PURE__*/applyMiddleware(sagaMiddleware));
2316
+ sagaMiddleware.run(filesSagas);
2317
+
2318
+ function Code7(props) {
2319
+ return React.createElement(Provider, {
2320
+ store: store
2321
+ }, React.createElement(Leia, Object.assign({}, props)));
2322
+ }
2323
+
2324
+ export { Code7 };
2325
+ //# sourceMappingURL=code7-leia.esm.js.map