@feathery/react 2.47.1 → 2.48.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/Form/ThumbnailRenderer.d.ts +20 -0
- package/cjs/Form/ThumbnailRenderer.d.ts.map +1 -0
- package/cjs/Form/grid/index.d.ts +1 -1
- package/cjs/Form/grid/index.d.ts.map +1 -1
- package/cjs/assistant/ToolStatus.d.ts.map +1 -1
- package/cjs/{fthry_AssistantChat.Dln3sZaO.js → fthry_AssistantChat.D16Y4E74.js} +16 -4
- package/cjs/{fthry_FormControl.uHE9YK1E.js → fthry_FormControl.D2f1BXqB.js} +1 -1
- package/cjs/{fthry_InlineTooltip.WDUHsUpe.js → fthry_InlineTooltip.DEdTUSm4.js} +2 -2
- package/cjs/{fthry_Overlay.DFZNkWx6.js → fthry_Overlay.D62XeoXL.js} +1 -1
- package/cjs/{fthry_PaymentMethodField.DNKVy7YX.js → fthry_PaymentMethodField.BjRyBUqb.js} +4 -5
- package/cjs/{fthry_Placeholder.CmetQCQE.js → fthry_Placeholder.DgZkAMLA.js} +1 -1
- package/cjs/{fthry_ShowEyeIcon.SF-0EcQK.js → fthry_ShowEyeIcon.DN_uKizZ.js} +1 -1
- package/cjs/{fthry_TabsElement.B86k8Otw.js → fthry_TabsElement.DvCwi960.js} +1 -2
- package/cjs/{fthry_auto-track.B8u_S9bg.js → fthry_auto-track.6jWwlIt0.js} +2 -3
- package/cjs/{fthry_highlighted-body-TPN3WLV5.BOwN5M9q.js → fthry_highlighted-body-TPN3WLV5.BWETzenp.js} +3 -4
- package/cjs/{fthry_index.C5KKdRP7.js → fthry_index.5BeecFlc.js} +2 -3
- package/cjs/{fthry_index.CcMmad74.js → fthry_index.B31MkOC0.js} +6 -7
- package/cjs/{fthry_index.DAmqQesG.js → fthry_index.B66Sa4U0.js} +1 -2
- package/cjs/{fthry_index.B4AWuG0t.js → fthry_index.BS3CuTH8.js} +2 -3
- package/cjs/{fthry_index.7SaIy83W.js → fthry_index.BeoPEbf4.js} +2 -3
- package/cjs/{fthry_index.DBXIqF8K.js → fthry_index.BkhZkLh-.js} +5 -6
- package/cjs/{fthry_index.B2OL7yZ5.js → fthry_index.BpSfRdvi.js} +5 -6
- package/cjs/{fthry_index.DPUGS9Bb.js → fthry_index.Brfzpzrh.js} +6 -7
- package/cjs/{fthry_index.BbiJ8b80.js → fthry_index.C-RRAbJm.js} +1 -1
- package/cjs/{fthry_index.BaVk4tgy.js → fthry_index.C0ZwSbPD.js} +5 -6
- package/cjs/{fthry_index.DJ-urDuh.js → fthry_index.C1_NpVP-.js} +2 -3
- package/cjs/{fthry_index.D1kfpnZK.js → fthry_index.C851WNlT.js} +1 -2
- package/cjs/{fthry_index.BMoX9PfE.js → fthry_index.CJVXqn1l.js} +1 -2
- package/cjs/{fthry_index.CkCNeXPC.js → fthry_index.CYkjnpqJ.js} +1 -2
- package/cjs/{fthry_index.daHEECTd.js → fthry_index.CdGxoWiK.js} +38 -301
- package/cjs/{fthry_index.BX9qw-9b.js → fthry_index.Ck7YQKQF.js} +4 -5
- package/cjs/{fthry_index.ClgzWTFY.js → fthry_index.Cz0q4X3R.js} +2 -3
- package/cjs/{fthry_index.Bgg1tAqO.js → fthry_index.D5ysX_Ku.js} +6 -7
- package/cjs/{fthry_index.BqhqvxIr.js → fthry_index.DDfgMZKh.js} +1 -2
- package/cjs/{fthry_index.DMuFvVjE.js → fthry_index.DG6J-zY-.js} +3 -4
- package/cjs/{fthry_index.Qhei31XB.js → fthry_index.DPm7UcNK.js} +1 -2
- package/cjs/{fthry_index.CKcWYWE3.js → fthry_index.DTQrAA3Y.js} +8 -9
- package/cjs/{fthry_index.FRl5eejL.js → fthry_index.DTxHjfFB.js} +3 -4
- package/cjs/{fthry_index.DOAZq3jf.js → fthry_index.DhoBBzQ7.js} +10 -10
- package/cjs/{fthry_index.CxSzzRrN.js → fthry_index.Dyh7d2u3.js} +6 -7
- package/cjs/{fthry_index.D_PrDgA_.js → fthry_index.Ptr3UN8d.js} +2 -3
- package/cjs/{fthry_index.CFidkPLb.js → fthry_index.VYffek6q.js} +1 -2
- package/cjs/{fthry_index.DjmiOyRF.js → fthry_index.XFPGCehV.js} +1 -1
- package/cjs/{fthry_index.DqBPUCFx.js → fthry_index.bje_1x-I.js} +5 -6
- package/cjs/{fthry_index.JBMhMwS2.js → fthry_index.oTQT38C_.js} +4 -5
- package/cjs/{fthry_index.umd.ZElFDCsB.js → fthry_index.umd.wy3zwWSj.js} +1 -1
- package/cjs/{fthry_index.Cs-el-3L.js → fthry_index.xkoAL9cS.js} +1 -2
- package/cjs/{fthry_input.dHDe7wx2.js → fthry_input.7C_cW8iE.js} +1 -1
- package/cjs/{fthry_mermaid-O7DHMXV3.BtqFYP4B.js → fthry_mermaid-O7DHMXV3.BNo6HbRp.js} +3 -4
- package/cjs/{fthry_script.CeLoALnM.js → fthry_script.CPZyEEIq.js} +1 -1
- package/cjs/{fthry_styles.DoMopnrI.js → fthry_styles.Dl7lVFJC.js} +1 -1
- package/cjs/{fthry_useElementSize.Bke0oCAL.js → fthry_useElementSize.Dh0Bml3S.js} +1 -1
- package/cjs/{fthry_useSalesforceSync.D43AFN7K.js → fthry_useSalesforceSync.ZmjF5jeJ.js} +1 -1
- package/cjs/{fthry_webfontloader.C_rnGebJ.js → fthry_webfontloader.DOEIvOUg.js} +1 -1
- package/cjs/index.js +272 -6
- package/cjs/thumbnail-renderer.js +63 -0
- package/dist/Form/ThumbnailRenderer.d.ts +20 -0
- package/dist/Form/ThumbnailRenderer.d.ts.map +1 -0
- package/dist/Form/ThumbnailRenderer.integration.spec.d.ts +2 -0
- package/dist/Form/ThumbnailRenderer.integration.spec.d.ts.map +1 -0
- package/dist/Form/ThumbnailRenderer.spec.d.ts +2 -0
- package/dist/Form/ThumbnailRenderer.spec.d.ts.map +1 -0
- package/dist/Form/grid/index.d.ts +1 -1
- package/dist/Form/grid/index.d.ts.map +1 -1
- package/dist/assistant/ToolStatus.d.ts.map +1 -1
- package/dist/{fthry_AssistantChat.DFDdD7HC.js → fthry_AssistantChat.BWukgD5o.js} +16 -4
- package/dist/{fthry_FormControl.Cf0g4Yuy.js → fthry_FormControl.CVdJuRnk.js} +1 -1
- package/dist/{fthry_InlineTooltip.ihbwfFj5.js → fthry_InlineTooltip.CWap-WTM.js} +2 -2
- package/dist/{fthry_Overlay.ioiTUFxQ.js → fthry_Overlay.MAk8YndV.js} +1 -1
- package/dist/{fthry_PaymentMethodField.iNvu0x8P.js → fthry_PaymentMethodField.DST9Yjtv.js} +4 -5
- package/dist/{fthry_Placeholder.C_pZrH49.js → fthry_Placeholder.CtIwoA5S.js} +1 -1
- package/dist/{fthry_ShowEyeIcon.CttzKP8O.js → fthry_ShowEyeIcon.BGA6FQh0.js} +1 -1
- package/dist/{fthry_TabsElement.CWHCfLq7.js → fthry_TabsElement.BuntEz0s.js} +1 -2
- package/dist/{fthry_auto-track.TB7HSzBP.js → fthry_auto-track.BKMbIWyQ.js} +2 -3
- package/dist/{fthry_highlighted-body-TPN3WLV5.ALdNpxk8.js → fthry_highlighted-body-TPN3WLV5.G06YuQ2e.js} +3 -4
- package/dist/{fthry_index.DDITnGK6.js → fthry_index.3xvzHOZZ.js} +2 -3
- package/dist/{fthry_index.C64c135y.js → fthry_index.AugcPyKH.js} +30 -299
- package/dist/{fthry_index.B-GzRywW.js → fthry_index.BFJaHnz3.js} +1 -2
- package/dist/{fthry_index.BTIaieTN.js → fthry_index.BV5orIbT.js} +5 -6
- package/dist/{fthry_index.CdiNFndQ.js → fthry_index.BjYD1xpd.js} +1 -1
- package/dist/{fthry_index.BAy-nO-r.js → fthry_index.Bjgs69zf.js} +2 -3
- package/dist/{fthry_index.DMFzi3Wa.js → fthry_index.C8dO4ksp.js} +2 -3
- package/dist/{fthry_index.CKQ5eeYE.js → fthry_index.C8hE_h0-.js} +4 -5
- package/dist/{fthry_index.DFuron9d.js → fthry_index.CAJeovQO.js} +3 -4
- package/dist/{fthry_index.D-XsMPmv.js → fthry_index.CEOePdHL.js} +1 -2
- package/dist/{fthry_index.CSRDeZ2F.js → fthry_index.CYZeDMG0.js} +1 -2
- package/dist/{fthry_index.DhFIBL2H.js → fthry_index.Cancfzx7.js} +10 -10
- package/dist/{fthry_index.DUAotEAB.js → fthry_index.Cp9ByOuM.js} +1 -2
- package/dist/{fthry_index.CKDBFYpw.js → fthry_index.CtAHxgAq.js} +1 -2
- package/dist/{fthry_index.lfZeXIue.js → fthry_index.CvN4Rhcn.js} +1 -2
- package/dist/{fthry_index.BaWv1OCZ.js → fthry_index.CwAjn-OA.js} +8 -9
- package/dist/{fthry_index.zxvFHqTv.js → fthry_index.D4fPFebv.js} +6 -7
- package/dist/{fthry_index.C3FNTdYq.js → fthry_index.D8fPxN-r.js} +5 -6
- package/dist/{fthry_index.Boi26UPs.js → fthry_index.DGGn9OIp.js} +2 -3
- package/dist/{fthry_index.BX7wsRXd.js → fthry_index.DKux24gh.js} +3 -4
- package/dist/{fthry_index.Cr0_Lviv.js → fthry_index.DPQPFDFJ.js} +6 -7
- package/dist/{fthry_index.C1ZXJfal.js → fthry_index.DS4zbyNr.js} +5 -6
- package/dist/{fthry_index.Qj3KEaC9.js → fthry_index.Ddv2Wl8U.js} +5 -6
- package/dist/{fthry_index.BkYj8-gr.js → fthry_index.DnhhW4As.js} +2 -3
- package/dist/{fthry_index.D283rxnO.js → fthry_index.Dpd5r8Nr.js} +1 -2
- package/dist/{fthry_index.Cpcx1Ibk.js → fthry_index.LTbpRhuO.js} +4 -5
- package/dist/{fthry_index.DYneV-Jm.js → fthry_index.SBGfC-AB.js} +6 -7
- package/dist/{fthry_index.D-aXaZYJ.js → fthry_index._mp6MQTh.js} +2 -3
- package/dist/{fthry_index.D7BfGXcC.js → fthry_index.d-sboT23.js} +1 -2
- package/dist/{fthry_index.DpeXNy1J.js → fthry_index.iIuAf_k5.js} +5 -6
- package/dist/{fthry_index.XmFRz7k0.js → fthry_index.jGH4DDdr.js} +1 -1
- package/dist/{fthry_index.umd.CsHjvjeq.js → fthry_index.umd.8fDW5-do.js} +1 -1
- package/dist/{fthry_input.BrxKUPgu.js → fthry_input.Ciomtn44.js} +1 -1
- package/dist/fthry_mermaid-O7DHMXV3.CjYot5Ez.js +8 -0
- package/dist/{fthry_script.D4FZKxbJ.js → fthry_script.D5JCT1ya.js} +1 -1
- package/dist/{fthry_styles.BSgxYrQN.js → fthry_styles.B6dfe-Eo.js} +1 -1
- package/dist/{fthry_useElementSize.o4eh-fH6.js → fthry_useElementSize.D-kQCo-4.js} +1 -1
- package/dist/{fthry_useSalesforceSync.2wdSr9qo.js → fthry_useSalesforceSync.DpnT6_XK.js} +1 -1
- package/dist/{fthry_webfontloader.uLtMUJ6J.js → fthry_webfontloader.BOeyjl7h.js} +1 -1
- package/dist/index.js +274 -3
- package/dist/thumbnail-renderer.js +59 -0
- package/package.json +7 -1
- package/umd/AssistantChat.f140cc1dcdc7d2e7b6ec.js +1 -0
- package/umd/index.js +1 -1
- package/dist/fthry_mermaid-O7DHMXV3.CwrfkQpk.js +0 -9
- package/umd/AssistantChat.685c311fcfd51a09112e.js +0 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,277 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { a3 as AuthContext, a4 as getFieldValues, a5 as setFieldValues, a6 as updateTheme, a7 as updateUserId, a8 as init, a9 as Elements, aa as ReactForm, z as featheryDoc, ab as v4, _ as __assign, j as jsx, ac as LoginForm, ad as JSForm, ae as getFormContext } from './fthry_index.AugcPyKH.js';
|
|
2
|
+
export { ag as AssistantChat, ah as StyledContainer, af as resolveLabelStyle } from './fthry_index.AugcPyKH.js';
|
|
3
|
+
import { createRoot } from 'react-dom/client';
|
|
4
|
+
import { useContext } from 'react';
|
|
3
5
|
import 'react/jsx-runtime';
|
|
4
|
-
import 'react';
|
|
5
6
|
import 'jszip';
|
|
6
7
|
import 'react-dom';
|
|
8
|
+
|
|
9
|
+
var useAuthClient = function () { return useContext(AuthContext); };
|
|
10
|
+
|
|
11
|
+
var cjs = {};
|
|
12
|
+
|
|
13
|
+
var flatten = {};
|
|
14
|
+
|
|
15
|
+
var arraySpeciesCreate = {};
|
|
16
|
+
|
|
17
|
+
var hasRequiredArraySpeciesCreate;
|
|
18
|
+
|
|
19
|
+
function requireArraySpeciesCreate () {
|
|
20
|
+
if (hasRequiredArraySpeciesCreate) return arraySpeciesCreate;
|
|
21
|
+
hasRequiredArraySpeciesCreate = 1;
|
|
22
|
+
|
|
23
|
+
Object.defineProperty(arraySpeciesCreate, "__esModule", {
|
|
24
|
+
value: true
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
|
28
|
+
|
|
29
|
+
arraySpeciesCreate.default = arraySpeciesCreate$1;
|
|
30
|
+
/**
|
|
31
|
+
* @template T
|
|
32
|
+
* @param {T[]} originalArray
|
|
33
|
+
* @param {number} length
|
|
34
|
+
* @returns {T[]}
|
|
35
|
+
*/
|
|
36
|
+
function arraySpeciesCreate$1(originalArray, length) {
|
|
37
|
+
var isArray = Array.isArray(originalArray);
|
|
38
|
+
if (!isArray) {
|
|
39
|
+
return Array(length);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* @type {ArrayConstructor|undefined|null} C
|
|
43
|
+
*/
|
|
44
|
+
var C = Object.getPrototypeOf(originalArray).constructor;
|
|
45
|
+
if (C) {
|
|
46
|
+
// If IsConstructor(C) is true... not sure how this can be reliably checked without invoking it. Likely not insignificant.
|
|
47
|
+
if ((typeof C === 'undefined' ? 'undefined' : _typeof(C)) === 'object' || typeof C === 'function') {
|
|
48
|
+
C = C[Symbol.species.toString()];
|
|
49
|
+
C = C !== null ? C : undefined;
|
|
50
|
+
}
|
|
51
|
+
if (C === undefined) {
|
|
52
|
+
return Array(length);
|
|
53
|
+
}
|
|
54
|
+
if (typeof C !== 'function') {
|
|
55
|
+
throw TypeError('invalid constructor');
|
|
56
|
+
}
|
|
57
|
+
/** @type {Array} */
|
|
58
|
+
var result = new C(length);
|
|
59
|
+
return result;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return arraySpeciesCreate;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
var flattenIntoArray = {};
|
|
67
|
+
|
|
68
|
+
var hasRequiredFlattenIntoArray;
|
|
69
|
+
|
|
70
|
+
function requireFlattenIntoArray () {
|
|
71
|
+
if (hasRequiredFlattenIntoArray) return flattenIntoArray;
|
|
72
|
+
hasRequiredFlattenIntoArray = 1;
|
|
73
|
+
|
|
74
|
+
Object.defineProperty(flattenIntoArray, "__esModule", {
|
|
75
|
+
value: true
|
|
76
|
+
});
|
|
77
|
+
flattenIntoArray.default = flattenIntoArray$1;
|
|
78
|
+
/**
|
|
79
|
+
* @template T, U
|
|
80
|
+
* @param {Array<U>} target
|
|
81
|
+
* @param {Array<T>} source
|
|
82
|
+
* @param {number} start
|
|
83
|
+
* @param {number} depth
|
|
84
|
+
* @param {function(T): U[]} mapperFunction
|
|
85
|
+
* @param {Array<T>} thisArg
|
|
86
|
+
* @returns {number}
|
|
87
|
+
*/
|
|
88
|
+
function flattenIntoArray$1(target, source, start, depth, mapperFunction, thisArg) {
|
|
89
|
+
|
|
90
|
+
var mapperFunctionProvied = mapperFunction !== undefined;
|
|
91
|
+
var targetIndex = start;
|
|
92
|
+
var sourceIndex = 0;
|
|
93
|
+
var sourceLen = source.length;
|
|
94
|
+
while (sourceIndex < sourceLen) {
|
|
95
|
+
var p = sourceIndex;
|
|
96
|
+
var exists = !!source[p];
|
|
97
|
+
if (exists === true) {
|
|
98
|
+
var element = source[p];
|
|
99
|
+
if (element) {
|
|
100
|
+
if (mapperFunctionProvied) {
|
|
101
|
+
element = mapperFunction.call(thisArg, element, sourceIndex, target);
|
|
102
|
+
}
|
|
103
|
+
var spreadable = Object.getOwnPropertySymbols(element).includes(Symbol.isConcatSpreadable) || Array.isArray(element);
|
|
104
|
+
if (spreadable === true && depth > 0) {
|
|
105
|
+
var nextIndex = flattenIntoArray$1(target, element, targetIndex, depth - 1);
|
|
106
|
+
targetIndex = nextIndex;
|
|
107
|
+
} else {
|
|
108
|
+
if (!Number.isSafeInteger(targetIndex)) {
|
|
109
|
+
throw TypeError();
|
|
110
|
+
}
|
|
111
|
+
target[targetIndex] = element;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
targetIndex += 1;
|
|
116
|
+
sourceIndex += 1;
|
|
117
|
+
}
|
|
118
|
+
return targetIndex;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return flattenIntoArray;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
var hasRequiredFlatten;
|
|
125
|
+
|
|
126
|
+
function requireFlatten () {
|
|
127
|
+
if (hasRequiredFlatten) return flatten;
|
|
128
|
+
hasRequiredFlatten = 1;
|
|
129
|
+
|
|
130
|
+
var _arraySpeciesCreate = requireArraySpeciesCreate();
|
|
131
|
+
|
|
132
|
+
var _arraySpeciesCreate2 = _interopRequireDefault(_arraySpeciesCreate);
|
|
133
|
+
|
|
134
|
+
var _flattenIntoArray = requireFlattenIntoArray();
|
|
135
|
+
|
|
136
|
+
var _flattenIntoArray2 = _interopRequireDefault(_flattenIntoArray);
|
|
137
|
+
|
|
138
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
139
|
+
|
|
140
|
+
if (!Object.prototype.hasOwnProperty.call(Array.prototype, 'flatten')) {
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* @param {number=Infinity} depth
|
|
144
|
+
*/
|
|
145
|
+
Array.prototype.flatten = function flatten(depth) {
|
|
146
|
+
var o = Object(this);
|
|
147
|
+
var a = (0, _arraySpeciesCreate2.default)(o, this.length);
|
|
148
|
+
var depthNum = depth !== undefined ? Number(depth) : Infinity;
|
|
149
|
+
(0, _flattenIntoArray2.default)(a, o, 0, depthNum);
|
|
150
|
+
return a.filter(function (e) {
|
|
151
|
+
return e !== undefined;
|
|
152
|
+
});
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
return flatten;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
var flatMap = {};
|
|
160
|
+
|
|
161
|
+
var hasRequiredFlatMap;
|
|
162
|
+
|
|
163
|
+
function requireFlatMap () {
|
|
164
|
+
if (hasRequiredFlatMap) return flatMap;
|
|
165
|
+
hasRequiredFlatMap = 1;
|
|
166
|
+
|
|
167
|
+
var _flattenIntoArray = requireFlattenIntoArray();
|
|
168
|
+
|
|
169
|
+
var _flattenIntoArray2 = _interopRequireDefault(_flattenIntoArray);
|
|
170
|
+
|
|
171
|
+
var _arraySpeciesCreate = requireArraySpeciesCreate();
|
|
172
|
+
|
|
173
|
+
var _arraySpeciesCreate2 = _interopRequireDefault(_arraySpeciesCreate);
|
|
174
|
+
|
|
175
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
176
|
+
|
|
177
|
+
if (!Object.prototype.hasOwnProperty.call(Array.prototype, 'flatMap')) {
|
|
178
|
+
|
|
179
|
+
Array.prototype.flatMap = function flatMap(callbackFn, thisArg) {
|
|
180
|
+
var o = Object(this);
|
|
181
|
+
if (!callbackFn || typeof callbackFn.call !== 'function') {
|
|
182
|
+
throw TypeError('callbackFn must be callable.');
|
|
183
|
+
}
|
|
184
|
+
var t = thisArg !== undefined ? thisArg : undefined;
|
|
185
|
+
|
|
186
|
+
var a = (0, _arraySpeciesCreate2.default)(o, o.length);
|
|
187
|
+
(0, _flattenIntoArray2.default)(a, o,
|
|
188
|
+
/*start*/0,
|
|
189
|
+
/*depth*/1, callbackFn, t);
|
|
190
|
+
return a.filter(function (x) {
|
|
191
|
+
return x !== undefined;
|
|
192
|
+
}, a);
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
return flatMap;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
var hasRequiredCjs;
|
|
200
|
+
|
|
201
|
+
function requireCjs () {
|
|
202
|
+
if (hasRequiredCjs) return cjs;
|
|
203
|
+
hasRequiredCjs = 1;
|
|
204
|
+
|
|
205
|
+
requireFlatten();
|
|
206
|
+
|
|
207
|
+
requireFlatMap();
|
|
208
|
+
|
|
209
|
+
return cjs;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
requireCjs();
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Used to match `RegExp`
|
|
216
|
+
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
|
|
217
|
+
*/
|
|
218
|
+
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
|
219
|
+
var reHasRegExpChar = RegExp(reRegExpChar.source);
|
|
220
|
+
function escapeRegExp(str) {
|
|
221
|
+
return str && reHasRegExpChar.test(str)
|
|
222
|
+
? str.replace(reRegExpChar, '\\$&')
|
|
223
|
+
: str;
|
|
224
|
+
}
|
|
225
|
+
if (!String.prototype.replaceAll) {
|
|
226
|
+
// eslint-disable-next-line no-extend-native
|
|
227
|
+
String.prototype.replaceAll = function (str, newStr) {
|
|
228
|
+
// If a regex pattern
|
|
229
|
+
if (Object.prototype.toString.call(str).toLowerCase() === '[object regexp]') {
|
|
230
|
+
return this.replace(str, newStr);
|
|
231
|
+
}
|
|
232
|
+
else {
|
|
233
|
+
// If a string
|
|
234
|
+
return this.replace(new RegExp(escapeRegExp(str), 'g'), newStr);
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
var mountedForms = {};
|
|
240
|
+
/**
|
|
241
|
+
* Utility function which renders a form with the provided props in the DOM element with the provided ID.
|
|
242
|
+
* @param {string} elementId The ID of the DOM element to hold the form
|
|
243
|
+
* @param {Object} props The props defined on the *Form* component
|
|
244
|
+
*/
|
|
245
|
+
function renderAt(elementId, props, loginEnabled) {
|
|
246
|
+
if (loginEnabled === void 0) { loginEnabled = false; }
|
|
247
|
+
var container = featheryDoc().getElementById(elementId);
|
|
248
|
+
if (mountedForms[elementId]) {
|
|
249
|
+
mountedForms[elementId].unmount();
|
|
250
|
+
}
|
|
251
|
+
var root = createRoot(container);
|
|
252
|
+
var destroy = function () {
|
|
253
|
+
if (mountedForms[elementId]) {
|
|
254
|
+
mountedForms[elementId].unmount();
|
|
255
|
+
delete mountedForms[elementId];
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
mountedForms[elementId] = root;
|
|
259
|
+
var uuid = v4();
|
|
260
|
+
var formProps = __assign(__assign({}, props), { _internalId: uuid });
|
|
261
|
+
var component = loginEnabled ? (jsx(LoginForm, { formProps: formProps })) : (jsx(JSForm, __assign({}, formProps)));
|
|
262
|
+
root.render(component);
|
|
263
|
+
return __assign(__assign({}, getFormContext(uuid)), { destroy: destroy });
|
|
264
|
+
}
|
|
265
|
+
// Entrypoint for globally namespaced JS library
|
|
266
|
+
var Feathery = {
|
|
267
|
+
Form: ReactForm,
|
|
268
|
+
Elements: Elements,
|
|
269
|
+
init: init,
|
|
270
|
+
updateUserId: updateUserId,
|
|
271
|
+
updateTheme: updateTheme,
|
|
272
|
+
setFieldValues: setFieldValues,
|
|
273
|
+
getFieldValues: getFieldValues,
|
|
274
|
+
renderAt: renderAt
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
export { Elements, Feathery, ReactForm as Form, LoginForm, getFieldValues, init, renderAt, setFieldValues, updateTheme, updateUserId, useAuthClient };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { _ as __assign, D as DEFAULT_MOBILE_BREAKPOINT, g as getVisiblePositions, c as calculateStepCSS, a as calculateGlobalCSS, j as jsx, G as Grid, F as FeatheryCacheProvider, f as fieldValues } from './fthry_index.AugcPyKH.js';
|
|
2
|
+
import { useRef, useMemo } from 'react';
|
|
3
|
+
import 'react/jsx-runtime';
|
|
4
|
+
import 'jszip';
|
|
5
|
+
import 'react-dom';
|
|
6
|
+
|
|
7
|
+
var noop = function () { return undefined; };
|
|
8
|
+
var setThumbnailFieldValues = function (values) {
|
|
9
|
+
Object.keys(fieldValues).forEach(function (key) {
|
|
10
|
+
delete fieldValues[key];
|
|
11
|
+
});
|
|
12
|
+
Object.assign(fieldValues, values);
|
|
13
|
+
};
|
|
14
|
+
var ThumbnailRenderer = function (_a) {
|
|
15
|
+
var step = _a.step, _b = _a.formId, formId = _b === void 0 ? '' : _b, _c = _a.formSettings, formSettings = _c === void 0 ? {} : _c, _d = _a.values, values = _d === void 0 ? {} : _d, _e = _a.viewport, viewport = _e === void 0 ? 'desktop' : _e, className = _a.className, _f = _a.style, style = _f === void 0 ? {} : _f;
|
|
16
|
+
var internalIdRef = useRef("thumbnail-".concat(formId || (step === null || step === void 0 ? void 0 : step.id) || 'form'));
|
|
17
|
+
var formRef = useRef(null);
|
|
18
|
+
var focusRef = useRef('');
|
|
19
|
+
var settings = useMemo(function () { return (__assign(__assign({ autocomplete: 'off', globalStyles: {}, mobileBreakpoint: DEFAULT_MOBILE_BREAKPOINT }, formSettings), { readOnly: true })); }, [formSettings]);
|
|
20
|
+
var visiblePositions = useMemo(function () { return (step ? getVisiblePositions(step, internalIdRef.current) : {}); }, [step]);
|
|
21
|
+
var stepCSS = useMemo(function () { return calculateStepCSS(step); }, [step]);
|
|
22
|
+
var globalCSS = useMemo(function () { return calculateGlobalCSS(settings.globalStyles); }, [settings.globalStyles]);
|
|
23
|
+
setThumbnailFieldValues(values);
|
|
24
|
+
var form = {
|
|
25
|
+
userProgress: 0,
|
|
26
|
+
curDepth: 0,
|
|
27
|
+
maxDepth: 0,
|
|
28
|
+
elementProps: {},
|
|
29
|
+
customComponents: {},
|
|
30
|
+
activeStep: step,
|
|
31
|
+
steps: step ? [step] : [],
|
|
32
|
+
customClickSelectionState: function () { return false; },
|
|
33
|
+
runElementActions: noop,
|
|
34
|
+
buttonOnClick: noop,
|
|
35
|
+
tableOnClick: noop,
|
|
36
|
+
fieldOnChange: function () { return noop; },
|
|
37
|
+
buttonLoaders: {},
|
|
38
|
+
inlineErrors: {},
|
|
39
|
+
setInlineErrors: noop,
|
|
40
|
+
changeValue: noop,
|
|
41
|
+
changeStep: noop,
|
|
42
|
+
client: null,
|
|
43
|
+
updateFieldValues: noop,
|
|
44
|
+
submitCustom: noop,
|
|
45
|
+
elementOnView: undefined,
|
|
46
|
+
onViewElements: [],
|
|
47
|
+
formSettings: settings,
|
|
48
|
+
focusRef: focusRef,
|
|
49
|
+
formRef: formRef,
|
|
50
|
+
setCardElement: noop,
|
|
51
|
+
visiblePositions: visiblePositions,
|
|
52
|
+
calendly: undefined,
|
|
53
|
+
featheryContext: { formId: formId },
|
|
54
|
+
assistantClient: undefined
|
|
55
|
+
};
|
|
56
|
+
return (jsx(FeatheryCacheProvider, { children: jsx("form", __assign({ autoComplete: settings.autocomplete, className: "feathery ".concat(className || ''), ref: formRef, css: __assign(__assign(__assign(__assign({}, globalCSS.getTarget('form')), stepCSS), style), { position: 'relative', display: 'flex' }), dir: settings.rightToLeft ? 'rtl' : 'ltr' }, { children: jsx(Grid, { step: step, form: form, viewport: viewport }) })) }));
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export { ThumbnailRenderer as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@feathery/react",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.48.0",
|
|
4
4
|
"description": "React library for Feathery",
|
|
5
5
|
"author": "Boyang Dun",
|
|
6
6
|
"license": "MIT",
|
|
@@ -15,6 +15,12 @@
|
|
|
15
15
|
"import": "./dist/index.js",
|
|
16
16
|
"require": "./cjs/index.js",
|
|
17
17
|
"default": "./cjs/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./thumbnail-renderer": {
|
|
20
|
+
"types": "./dist/Form/ThumbnailRenderer.d.ts",
|
|
21
|
+
"import": "./dist/thumbnail-renderer.js",
|
|
22
|
+
"require": "./cjs/thumbnail-renderer.js",
|
|
23
|
+
"default": "./cjs/thumbnail-renderer.js"
|
|
18
24
|
}
|
|
19
25
|
},
|
|
20
26
|
"engines": {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(this.webpackChunkFeathery=this.webpackChunkFeathery||[]).push([[917],{63450:(e,t,n)=>{n.r(t),n.d(t,{default:()=>yt});var r=n(35944),o=n(67294),i=n(91247),a=n(74790),l=n(74438),u=function(){return u=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},u.apply(this,arguments)},d=function(e){return(0,r.tZ)("svg",u({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none"},e,{children:(0,r.tZ)("path",{d:"M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})}))},s=function(e){return(0,r.tZ)("svg",u({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none"},e,{children:(0,r.tZ)("path",{d:"m6 9 6 6 6-6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}))},c=function(e){return(0,r.BX)("svg",u({width:"20",height:"20",viewBox:"0 0 24 24",fill:"none"},e,{children:[(0,r.tZ)("path",{d:"m22 2-7 20-4-9-9-4 20-7z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.tZ)("path",{d:"m22 2-11 11",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}))},f=function(e){return(0,r.BX)("svg",u({width:"16",height:"16",style:{borderRadius:"50%"},viewBox:"0 0 50 50"},e,{children:[(0,r.tZ)("circle",{cx:25,cy:25,r:22.5,style:{fill:"none",stroke:"#f5cbcb",strokeWidth:3,opacity:1}}),(0,r.tZ)("circle",{cx:25,cy:25,r:22.5,style:{fill:"none",stroke:"#e2626e",strokeWidth:3,opacity:1,strokeLinecap:"round",transformOrigin:"50% 50%",transform:"rotate3d(0,0,1,0deg)",animation:"2156ms ease-in-out 0s infinite normal none running feathery-spinner-arc,1829ms linear 0s infinite normal none running feathery-spinner-rotate"}})]}))},p=function(e){return(0,r.BX)("svg",u({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none"},e,{children:[(0,r.tZ)("path",{d:"M18 6 6 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.tZ)("path",{d:"m6 6 12 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}))},h=function(e){return(0,r.tZ)("svg",u({width:"14",height:"14",viewBox:"0 0 24 24",fill:"none"},e,{children:(0,r.tZ)("polyline",{points:"20 6 9 17 4 12",stroke:"#10b981",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}))},v=function(e){return(0,r.tZ)("svg",u({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none"},e,{children:(0,r.tZ)("path",{d:"m6 9 6 6 6-6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}))},y=function(e){return(0,r.BX)("svg",u({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none"},e,{children:[(0,r.tZ)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:"currentColor",strokeWidth:"2"}),(0,r.tZ)("rect",{x:"12",y:"12",width:"7",height:"7",rx:"1",stroke:"currentColor",strokeWidth:"2"})]}))},g=function(e){return(0,r.BX)("svg",u({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none"},e,{children:[(0,r.tZ)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:"currentColor",strokeWidth:"2"}),(0,r.tZ)("path",{d:"M9 3v18",stroke:"currentColor",strokeWidth:"2"})]}))},m=function(e){return(0,r.BX)("svg",u({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none"},e,{children:[(0,r.tZ)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:"currentColor",strokeWidth:"2"}),(0,r.tZ)("path",{d:"M15 3v18",stroke:"currentColor",strokeWidth:"2"})]}))},b=function(e){return(0,r.BX)("svg",u({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none"},e,{children:[(0,r.tZ)("path",{d:"M4 9V5a1 1 0 0 1 1-1h4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.tZ)("path",{d:"M20 9V5a1 1 0 0 0-1-1h-4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.tZ)("path",{d:"M4 15v4a1 1 0 0 0 1 1h4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.tZ)("path",{d:"M20 15v4a1 1 0 0 1-1 1h-4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}))},x=function(e){return(0,r.tZ)("svg",u({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none"},e,{children:(0,r.tZ)("path",{d:"M5 12h14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})}))},w=function(e){return(0,r.BX)("svg",u({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none"},e,{children:[(0,r.tZ)("path",{d:"m11 17-5-5 5-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.tZ)("path",{d:"m18 17-5-5 5-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}))},k=function(e){return(0,r.BX)("svg",u({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none"},e,{children:[(0,r.tZ)("path",{d:"m6 17 5-5-5-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.tZ)("path",{d:"m13 17 5-5-5-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}))},S=function(e){return(0,r.BX)("svg",u({width:"12",height:"12",viewBox:"0 0 24 24",fill:"none"},e,{children:[(0,r.tZ)("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.tZ)("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}))},A="#6b7280",_="#f9fafb",C="#e5e7eb",I="#9ca3af",T="#6b7280",Z="#1f2937",R="#ef4444",L=function(e,t){var n=parseInt(e.replace("#",""),16),r=Math.min(255,Math.max(0,(n>>16)+Math.round(2.55*t))),o=Math.min(255,Math.max(0,(n>>8&255)+Math.round(2.55*t))),i=Math.min(255,Math.max(0,(255&n)+Math.round(2.55*t)));return"#".concat((r<<16|o<<8|i).toString(16).padStart(6,"0"))},j=function(){return j=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},j.apply(this,arguments)},B=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},O=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))},E={searchWeb:{running:"Searching the web...",done:"Searched the web"},scrapeUrl:{running:"Reading web page...",done:"Read the web page"},searchDocuments:{running:"Searching documents...",done:"Searched the documents"},setFieldValue:{running:"Updating form fields...",done:"Updated form fields"},clickElement:{running:"Running form action...",done:"Ran the form action"},addTableRow:{running:"Adding a row...",done:"Added a row"},deleteTableRow:{running:"Deleting a row...",done:"Deleted a row"},setTableCellValue:{running:"Updating table cells...",done:"Updated table cells"},triggerTableAction:{running:"Running table action...",done:"Ran the table action"},getPanelSnapshot:{running:"Reading the form...",done:"Reviewed the form"},getFuserSnapshot:{running:"Looking up your submission...",done:"Reviewed the submission"},getExtractionSnapshot:{running:"Reading extraction setup...",done:"Reviewed the extraction setup"},getExtractionResults:{running:"Reading extraction results...",done:"Reviewed the extraction results"},listFormExtractions:{running:"Looking up extractions...",done:"Reviewed available extractions"},getLogicRules:{running:"Reading form logic...",done:"Reviewed form logic"},listFormHubs:{running:"Looking up records on file...",done:"Reviewed available records"},getHubSchema:{running:"Reading record setup...",done:"Reviewed the record setup"},queryHub:{running:"Searching records on file...",done:"Searched the records on file"}},z=function(e){try{var t=new URL(e);return t.hostname+("/"!==t.pathname?t.pathname:"")}catch(t){return e}},W=function(e){if(!e||"object"!=typeof e)return[];var t=e,n=[],r=function(e){return e.map((function(e){return"object"==typeof e&&null!==e&&e.url||""})).filter(Boolean)};return Array.isArray(t.web)&&n.push.apply(n,O([],B(r(t.web)),!1)),Array.isArray(t.news)&&n.push.apply(n,O([],B(r(t.news)),!1)),Array.isArray(t.images)&&n.push.apply(n,O([],B(r(t.images)),!1)),"string"==typeof t.url&&t.url&&n.push(t.url),n.length>0?Array.from(new Set(n)):Array.isArray(e)?Array.from(new Set(r(e))):[]},K=function(e){return"input-streaming"===e||"input-available"===e},M=function(e){return"output-error"===e.state||"object"==typeof e.output&&null!==e.output&&!1===e.output.ok},F=function(e){var t,n=e.row,o=e.linkColor,i=e.indent,a=void 0===i?24:i,l=null===(t=n.input)||void 0===t?void 0:t.query,u=W(n.output);return l||u.length>0?(0,r.BX)("div",j({css:{display:"flex",flexDirection:"column",gap:"4px",paddingLeft:"".concat(a,"px"),marginTop:"2px",marginBottom:"4px"}},{children:[l&&(0,r.BX)("div",j({css:{color:I,fontSize:"12px",fontStyle:"italic"}},{children:['"',l.length>80?l.substring(0,80)+"...":l,'"']})),u.map((function(e,t){return(0,r.BX)("a",j({href:e,target:"_blank",rel:"noopener noreferrer",css:{fontSize:"12px",color:o,textDecoration:"none",display:"flex",alignItems:"center",gap:"4px",minWidth:0,":hover":{textDecoration:"underline"}}},{children:[(0,r.tZ)(S,{css:{flexShrink:0}}),(0,r.tZ)("span",j({css:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},{children:z(e)}))]}),t)}))]})):null},N=function(e){var t;return!!(null===(t=e.input)||void 0===t?void 0:t.query)||W(e.output).length>0},X=function(e){var t,n,r=E[e.toolName]||{running:"Working...",done:"Done"};return K(e.state)?r.running:M(e)?null!==(t=r.done)&&void 0!==t?t:"Failed":null!==(n=r.done)&&void 0!==n?n:r.running},D={backgroundImage:"linear-gradient(90deg, ".concat(T," 25%, #d1d5db 50%, ").concat(T," 75%)"),backgroundSize:"220% 100%",backgroundClip:"text",WebkitBackgroundClip:"text",color:"transparent",animation:"feathery-tool-shimmer 1.6s linear infinite","@keyframes feathery-tool-shimmer":{from:{backgroundPosition:"160% 0"},to:{backgroundPosition:"-60% 0"}}},P=function(e){var t=e.rows,n=e.followedByText,i=e.turnFinished,a=e.linkColor,l=void 0===a?A:a,u=e.isFirstChunk,d=void 0!==u&&u,c=t.some((function(e){return K(e.state)})),f=!c&&(n||i),h=!(!c&&n),v=B((0,o.useState)(null),2),y=v[0],g=v[1],m=null!=y?y:h,b=function(){return g(!m)},x=j({display:"flex",flexDirection:"column",gap:"2px",fontSize:"13px",minWidth:0,paddingLeft:"".concat(14,"px")},d?{}:{animation:"feathery-chunk-fade-in 220ms ease-out both","@keyframes feathery-chunk-fade-in":{from:{opacity:0,transform:"translateY(4px)"},to:{opacity:1,transform:"translateY(0)"}}});if(f&&1===t.length){var w=t[0],k=M(w),S=N(w);return(0,r.BX)("div",j({css:x},{children:[(0,r.BX)("button",j({type:"button",onClick:S?b:void 0,css:{display:"inline-flex",alignItems:"center",gap:"6px",background:"none",border:"none",padding:"4px 0",cursor:S?"pointer":"default",color:T,textAlign:"left",font:"inherit",fontSize:"13px",alignSelf:"flex-start"}},{children:[k&&(0,r.tZ)(p,{css:{width:"12px",height:"12px",color:R}}),(0,r.tZ)("span",{children:X(w)}),S&&(0,r.tZ)(s,{css:{width:"12px",height:"12px",color:I,transform:m?"rotate(0deg)":"rotate(-90deg)",transition:"transform 0.2s ease",flexShrink:0}})]})),S&&m&&(0,r.tZ)(F,{row:w,linkColor:l,indent:6})]}))}var _=f?"Finished working":"Working on it...";return(0,r.BX)("div",j({css:x},{children:[(0,r.BX)("button",j({type:"button",onClick:b,css:{display:"inline-flex",alignItems:"center",gap:"6px",background:"none",border:"none",padding:"4px 0",cursor:"pointer",color:T,textAlign:"left",font:"inherit",fontSize:"13px",alignSelf:"flex-start"}},{children:[(0,r.tZ)("span",j({css:f?void 0:D},{children:_})),(0,r.tZ)(s,{css:{width:"12px",height:"12px",color:I,transform:m?"rotate(0deg)":"rotate(-90deg)",transition:"transform 0.2s ease",flexShrink:0}})]})),m&&(0,r.tZ)("div",j({css:{display:"flex",flexDirection:"column",gap:"2px",marginLeft:"5px",paddingLeft:"13px",borderLeft:"2px solid ".concat(C)}},{children:t.map((function(e){return(0,r.tZ)(V,{row:e,linkColor:l},e.key)}))}))]}))},V=function(e){var t=e.row,n=e.linkColor,i=N(t),a=K(t.state),l=M(t),u=B((0,o.useState)(null),2),d=u[0],c=u[1],v=null!=d?d:a,y=i?"button":"div";return(0,r.BX)("div",j({css:{display:"flex",flexDirection:"column",gap:"2px"}},{children:[(0,r.BX)(y,j({type:i?"button":void 0,onClick:i?function(){return c(!v)}:void 0,css:{display:"inline-flex",alignItems:"center",gap:"6px",color:l?R:T,background:"none",border:"none",padding:"2px 0",textAlign:"left",cursor:i?"pointer":"default",font:"inherit",fontSize:"13px",alignSelf:"flex-start"}},{children:[a?(0,r.tZ)(f,{css:{width:"12px",height:"12px"}}):l?(0,r.tZ)(p,{css:{width:"12px",height:"12px"}}):(0,r.tZ)(h,{css:{width:"12px",height:"12px"}}),(0,r.tZ)("span",j({css:a?D:void 0},{children:X(t)})),i&&(0,r.tZ)(s,{css:{width:"10px",height:"10px",color:I,transform:v?"rotate(0deg)":"rotate(-90deg)",transition:"transform 0.2s ease",flexShrink:0}})]})),i&&v&&(0,r.tZ)(F,{row:t,linkColor:n})]}))},q=function(){return(0,r.tZ)("div",j({css:{display:"flex",flexDirection:"column",gap:"2px",fontSize:"13px",minWidth:0,paddingLeft:"14px",animation:"feathery-chunk-fade-in 220ms ease-out both","@keyframes feathery-chunk-fade-in":{from:{opacity:0,transform:"translateY(4px)"},to:{opacity:1,transform:"translateY(0)"}}}},{children:(0,r.tZ)("div",j({css:{padding:"4px 0",color:T,fontSize:"13px",alignSelf:"flex-start"}},{children:(0,r.tZ)("span",j({css:D},{children:"Working on it..."}))}))}))},H=n(70917),Y=n(14123),U=function(){return U=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},U.apply(this,arguments)},J=(0,H.iv)({color:"#2563eb",fontWeight:400,textDecoration:"underline",textUnderlineOffset:"0.12em",textDecorationSkipInk:"auto",overflowWrap:"break-word","&:visited":{color:"#6d28d9"},"&:hover":{color:"#1d4ed8"}}),$=(0,H.iv)('\n & p,\n & [data-streamdown="ordered-list"],\n & [data-streamdown="unordered-list"],\n & [data-streamdown="blockquote"],\n & [data-streamdown="code-block"],\n & [data-streamdown^="heading-"],\n & [data-streamdown="horizontal-rule"] {\n margin-top: 0 !important;\n margin-bottom: 0.6em !important;\n }\n & > *:last-child,\n & p:last-child,\n & [data-streamdown="ordered-list"]:last-child,\n & [data-streamdown="unordered-list"]:last-child,\n & [data-streamdown="blockquote"]:last-child,\n & [data-streamdown="code-block"]:last-child,\n & [data-streamdown^="heading-"]:last-child {\n margin-bottom: 0 !important;\n }\n\n & [data-streamdown="strong"],\n & strong,\n & b {\n font-weight: 600 !important;\n }\n & em,\n & i {\n font-style: italic !important;\n }\n\n & [data-streamdown="heading-1"] {\n font-size: 1.25em !important;\n font-weight: 600 !important;\n }\n & [data-streamdown="heading-2"] {\n font-size: 1.15em !important;\n font-weight: 600 !important;\n }\n & [data-streamdown="heading-3"] {\n font-size: 1.05em !important;\n font-weight: 600 !important;\n }\n & [data-streamdown="heading-4"],\n & [data-streamdown="heading-5"],\n & [data-streamdown="heading-6"] {\n font-size: 1em !important;\n font-weight: 600 !important;\n }\n\n & [data-streamdown="ordered-list"],\n & [data-streamdown="unordered-list"] {\n padding-left: 1.25em !important;\n }\n & [data-streamdown="ordered-list"] {\n list-style: decimal !important;\n }\n & [data-streamdown="unordered-list"] {\n list-style: disc !important;\n }\n & [data-streamdown="list-item"] {\n margin-bottom: 0.2em !important;\n }\n & [data-streamdown="list-item"]:last-child {\n margin-bottom: 0 !important;\n }\n\n & [data-streamdown="inline-code"] {\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;\n font-size: 0.9em !important;\n padding: 0.1em 0.3em !important;\n border-radius: 4px !important;\n background-color: rgba(0, 0, 0, 0.06) !important;\n }\n & [data-streamdown="code-block"] {\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;\n font-size: 0.9em !important;\n padding: 0.5em 0.75em !important;\n border-radius: 6px !important;\n background-color: rgba(0, 0, 0, 0.06) !important;\n overflow-x: auto !important;\n }\n\n & [data-streamdown="blockquote"] {\n padding-left: 0.75em !important;\n border-left: 3px solid rgba(0, 0, 0, 0.15) !important;\n color: rgba(0, 0, 0, 0.75) !important;\n }\n\n & [data-streamdown="horizontal-rule"] {\n border: 0 !important;\n border-top: 1px solid rgba(0, 0, 0, 0.12) !important;\n margin: 0.6em 0 !important;\n }\n'),G={a:function(e){var t=e.href,n=e.children;return(0,r.tZ)("a",U({href:t,target:"_blank",rel:"noopener noreferrer",css:J},{children:n}))}},Q=(0,o.memo)((function(e){var t=e.text,n=e.isStreaming,o=void 0!==n&&n;return(0,r.tZ)("div",U({css:$},{children:(0,r.tZ)(Y.qI,U({components:G,isAnimating:o,parseIncompleteMarkdown:o},{children:t}))}))}));Q.displayName="MarkdownText";const ee=Q;var te=function(){return te=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},te.apply(this,arguments)},ne=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function l(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,l)}u((r=r.apply(e,t||[])).next())}))},re=function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}},oe=function(e,t){return ne(void 0,void 0,void 0,(function(){var n;return re(this,(function(r){switch(r.label){case 0:return[4,fetch("".concat(e,"threads/"),{headers:t()})];case 1:return(n=r.sent()).ok?[2,n.json()]:[2,null]}}))}))},ie=function(e,t,n){return ne(void 0,void 0,void 0,(function(){var r;return re(this,(function(o){switch(o.label){case 0:return[4,fetch("".concat(e,"threads/").concat(n,"/"),{headers:t()})];case 1:return(r=o.sent()).ok?[2,r.json()]:[2,null]}}))}))},ae=function(e,t,n){return ne(void 0,void 0,void 0,(function(){return re(this,(function(r){switch(r.label){case 0:return[4,fetch("".concat(e,"threads/").concat(n,"/"),{method:"DELETE",headers:t()})];case 1:return r.sent(),[2]}}))}))},le=n(95710),ue=n(39479),de=n(14428),se=n(54665),ce=n(93861),fe=n(18837),pe=n(7193),he=n(67948),ve=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},ye=function(e){var t,n,r,o,i={},a=null!==(r=null==e?void 0:e.inlineErrors)&&void 0!==r?r:{};try{for(var l=ve(Object.keys(a)),u=l.next();!u.done;u=l.next()){var d=u.value,s=null===(o=a[d])||void 0===o?void 0:o.message;"string"==typeof s&&s.length>0&&(i[d]=s)}}catch(e){t={error:e}}finally{try{u&&!u.done&&(n=l.return)&&n.call(l)}finally{if(t)throw t.error}}return i},ge=function(e,t){var n,r;if(!Array.isArray(e)||!Array.isArray(t)||0===t.length)return[];var o=[];try{for(var i=ve(e),a=i.next();!a.done;a=i.next()){var l=a.value,u=Array.isArray(null==l?void 0:l.position)?l.position:[];if(!(u.length>=t.length)){for(var d=!0,s=0;s<u.length;s++)if(u[s]!==t[s]){d=!1;break}d&&o.push(l)}}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return o.sort((function(e,t){return t.position.length-e.position.length})),o};function me(e,t,n,r){if(!t)return"number"==typeof e?{errorType:"repeated_index_unexpected",error:"'".concat(r,"' is not in a repeated container; do not pass repeatIndex.")}:null;if("number"!=typeof e){var o=0===n?"(none yet - add a row first)":"0..".concat(n-1);return{errorType:"repeated_index_missing",error:"'".concat(r,"' is in a repeated container; pass repeatIndex ").concat(o,".")}}return e<0||e>=n?{errorType:"repeated_index_out_of_range",error:"repeatIndex ".concat(e," is out of range for '").concat(r,"' (rowCount ").concat(n,").")}:null}var be=function(e,t){var n,r,o,i,a;if(!e)return{ok:!1,errorType:"no_form_state",error:"Form has not loaded yet."};var l=de.Z[e];if(!l||!l.currentStep||!l.assistantClient)return{ok:!1,errorType:"no_form_state",error:"Form has not loaded yet."};if("string"!=typeof t||0===t.length)return{ok:!1,errorType:"shape_mismatch",error:"tableId is required."};var u=(null!==(n=l.currentStep.tables)&&void 0!==n?n:[]).find((function(e){return(null==e?void 0:e.id)===t}));if(!u)return{ok:!1,errorType:"not_on_step",error:"Table '".concat(t,"' is not on the current step.")};var d=null===(r=l.visiblePositions)||void 0===r?void 0:r[null!==(o=(0,fe.gh)(u))&&void 0!==o?o:"root"];if(Array.isArray(d)&&!d.some(Boolean))return{ok:!1,errorType:"hidden",error:"Table '".concat(t,"' is on the current step but is hidden right now.")};var s=Array.isArray(null===(i=null==u?void 0:u.properties)||void 0===i?void 0:i.columns)?u.properties.columns:[],c=null!==(a=l.fields)&&void 0!==a?a:{},f=s.reduce((function(e,t){var n,r=(null==t?void 0:t.field_key)?null===(n=c[t.field_key])||void 0===n?void 0:n.value:void 0;return Array.isArray(r)?Math.max(e,r.length):e}),0);return{ok:!0,found:{state:l,table:u,columns:s,rowCount:f}}},xe=function(e,t){var n,r=null!==(n=null==e?void 0:e.properties)&&void 0!==n?n:{},o=!(!r.enable_editing||r.transpose&&t>0),i=o&&!!r.add_delete_rows;return{canEditCells:o,canAddRows:i,canDeleteRows:i}},we=function(){return we=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},we.apply(this,arguments)},ke=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},Se=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))},Ae=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},_e=function(e){var t=e.text;if("string"==typeof t&&t.trim())return t;var n=e.text_formatted,r=Array.isArray(n)?n:null==n?void 0:n.ops;return Array.isArray(r)?r.map((function(e){return"string"==typeof(null==e?void 0:e.insert)?e.insert:""})).join("").trim():""},Ce=function(e,t){if(!e)return"";try{return(0,se.xf)(e,t)}catch(t){return e}},Ie=new Set(["submit","load"]),Te=function(e,t,n,r){return(null!=e?e:[]).some((function(e){if((null==e?void 0:e.trigger_event)!==t)return!1;if(!1===e.enabled||!1===e.valid)return!1;var o=e.steps,i=e.elements;return!(Array.isArray(o)&&o.length>0&&!o.includes(n))&&(!!Ie.has(t)||Array.isArray(i)&&i.includes(r))}))},Ze=n(99234),Re=n(81075),Le=function(){return Le=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Le.apply(this,arguments)},je=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function l(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,l)}u((r=r.apply(e,t||[])).next())}))},Be=function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}},Oe=new Set(["file_upload","signature"]),Ee=new Set(["text_field","text_area","email","phone_number","url","password","ssn","ein","gmap_line_1","gmap_line_2","gmap_city","gmap_state","gmap_country","gmap_zip"]),ze=new Set(["integer_field","slider","rating"]),We=new Set(["dropdown","radio"]),Ke=new Set(["dropdown_multi","multiselect","checkbox_group","button_group"]);function Me(e,t){var n,r=null!==(n=e.metadata)&&void 0!==n?n:{},o=Array.isArray(r.repeat_options)?r.repeat_options:null;if("number"==typeof t&&o&&Array.isArray(o[t]))return o[t].map((function(e){var t,n,r,o,i;return{value:String(null!==(n=null!==(t=null==e?void 0:e.value)&&void 0!==t?t:e)&&void 0!==n?n:""),label:String(null!==(i=null!==(o=null!==(r=null==e?void 0:e.label)&&void 0!==r?r:null==e?void 0:e.value)&&void 0!==o?o:e)&&void 0!==i?i:"")}}));var i=Array.isArray(r.options)?r.options:null;if(!i)return[];var a=Array.isArray(r.labels)?r.labels:[];return i.map((function(e,t){var n,r;return{value:String(null!=e?e:""),label:String(null!==(r=null!==(n=a[t])&&void 0!==n?n:e)&&void 0!==r?r:"")}}))}function Fe(e,t,n,r){return je(this,void 0,void 0,(function(){var o,i,a;return Be(this,(function(l){switch(l.label){case 0:return(o="number"==typeof e?String(Math.trunc(e)):"string"==typeof e?e:"").replace(/\D/g,"")?(Ze.BZ||(0,Ze.bq)(),[4,Ze.hV]):[2,e];case 1:return l.sent(),Ze.BZ?(i=function(e,t,n){var r,o,i,a=null===(o=null===(r=e.fields)||void 0===r?void 0:r[t])||void 0===o?void 0:o.value;if(a&&"string"==typeof a&&Ze.BZ)try{var l=Ze.BZ.parsePhoneNumber("+".concat(a));if(null==l?void 0:l.country)return l.country}catch(e){}var u=null===(i=n.metadata)||void 0===i?void 0:i.default_country;return u&&"auto"!==u?u:"US"}(n,r,t),(null==(a=function(){try{return Ze.BZ.parsePhoneNumber(o,i)}catch(e){return}}())?void 0:a.isValid())?[2,a.number.replace(/^\+/,"")]:[2,e]):[2,e]}}))}))}function Ne(e,t){var n,r;return je(this,void 0,void 0,(function(){var o,i,a,l,u,d,s=this;return Be(this,(function(c){switch(c.label){case 0:return o=e?de.Z[e]:void 0,i=null==o?void 0:o.assistantClient,o&&i?(a=new Set(t.map((function(e){return"string"==typeof(null==e?void 0:e.fieldKey)?e.fieldKey:""})).filter(Boolean)),l=new Map((null!==(r=null===(n=o.currentStep)||void 0===n?void 0:n.servar_fields)&&void 0!==r?r:[]).filter((function(e){var t;return a.has(null===(t=null==e?void 0:e.servar)||void 0===t?void 0:t.key)})).map((function(e){var t,n,r=e.servar.key,i=null===(n=null===(t=o.fields)||void 0===t?void 0:t[r])||void 0===n?void 0:n.value;return[r,null==i?null:JSON.parse(JSON.stringify(i))]}))),[4,Promise.all(t.map((function(e){return je(s,void 0,void 0,(function(){var t,n,r,i,a,l;return Be(this,(function(u){switch(u.label){case 0:return t="string"==typeof(null==e?void 0:e.fieldKey)?e.fieldKey:"",n=Number.isInteger(null==e?void 0:e.repeatIndex)?e.repeatIndex:void 0,t?(r=function(e,t,n,r){var o,i,a,l,u,d,s,c,f=null==e?void 0:e.currentStep,p=null!==(o=null==f?void 0:f.servar_fields)&&void 0!==o?o:[],h=p.find((function(e){var n;return(null===(n=null==e?void 0:e.servar)||void 0===n?void 0:n.key)===t}));if(!h){var v=p.map((function(e){var t;return null===(t=null==e?void 0:e.servar)||void 0===t?void 0:t.key})).filter(Boolean).join(", ")||"(none)";return{ok:!1,errorType:"not_on_step",error:"Field '".concat(t,"' is not on the current step. Available field keys here: ").concat(v,".")}}var y=null!==(i=h.servar)&&void 0!==i?i:{},g=y.type,m=null!==(a=e.visiblePositions)&&void 0!==a?a:{},b=m[null!==(l=(0,fe.gh)(h))&&void 0!==l?l:"root"];if(Array.isArray(b)&&!b.some(Boolean))return{ok:!1,errorType:"hidden",error:"Field '".concat(t,"' is on the current step but is hidden right now.")};var x=!(!(null===(u=e.formSettings)||void 0===u?void 0:u.readOnly)&&"readOnly"!==le.Hi.collaboratorReview);if((null===(d=h.properties)||void 0===d?void 0:d.disabled)||x)return{ok:!1,errorType:"disabled",error:"Field '".concat(t,"' is disabled and cannot be written.")};if(Oe.has(g))return{ok:!1,errorType:"unwriteable_type",error:"Field '".concat(t,"' (").concat(g,") cannot be filled by the assistant; the user has to provide this themselves.")};var w=y.repeated?(0,ce.o$)(f,h):void 0,k=me(r,!!w,w?(null!==(c=m[null!==(s=(0,fe.gh)(w))&&void 0!==s?s:"root"])&&void 0!==c?c:[]).length:0,t);if(k)return Le({ok:!1},k);if("number"==typeof r&&Array.isArray(b)&&!b[r])return{ok:!1,errorType:"hidden",error:"Row ".concat(r," of field '").concat(t,"' is hidden right now.")};var S=n;"phone_number"===g&&"number"==typeof S&&Number.isFinite(S)&&(S=String(Math.trunc(S)));var A=function(e,t,n){var r,o=e.type,i=e.key,a=null!==(r=e.metadata)&&void 0!==r?r:{},l="number"==typeof e.min_length?e.min_length:void 0,u="number"==typeof e.max_length?e.max_length:void 0;if("checkbox"===o)return"boolean"==typeof t?null:"Field '".concat(i,"' (checkbox) expects a boolean.");if(ze.has(o))return"number"==typeof t&&Number.isFinite(t)?"number"==typeof l&&t<l?"Value below minimum (".concat(l,")."):"number"==typeof u&&t>u?"Value above maximum (".concat(u,")."):null:"Field '".concat(i,"' (").concat(o,") expects a number.");if("date_selector"===o)return"string"!=typeof t?"Field '".concat(i,"' (date_selector) expects a string."):/^\d{4}-\d{2}-\d{2}$/.test(t)?null:"Field '".concat(i,"' expects ISO date 'YYYY-MM-DD'.");if(We.has(o)){if("string"!=typeof t)return"Field '".concat(i,"' (").concat(o,") expects a single option value (string).");var d=Me(e,n).map((function(e){return e.value}));return d.length>0&&!d.includes(t)?"Value not in allowed options. Allowed: ".concat(d.join(", "),"."):null}if(Ke.has(o)){if(!Array.isArray(t)||!t.every((function(e){return"string"==typeof e})))return"Field '".concat(i,"' (").concat(o,") expects an array of option-value strings.");if("button_group"===o&&!a.multiple&&t.length>1)return"Field '".concat(i,"' (button_group) is single-select; pass at most one option.");var s=new Set(Me(e,n).map((function(e){return e.value})));if(s.size>0){var c=t.filter((function(e){return!s.has(e)}));if(c.length>0)return"Values not in allowed options: ".concat(c.join(", "),".")}return null}return Ee.has(o)?"string"!=typeof t?"Field '".concat(i,"' (").concat(o,") expects a string."):"number"==typeof l&&t.length<l?"Value shorter than minimum length (".concat(l,")."):"number"==typeof u&&t.length>u?"Value exceeds maximum length (".concat(u,")."):null:null}(y,S,r);return A?{ok:!1,errorType:"shape_mismatch",error:A}:{ok:!0,field:h,servar:y,value:S}}(o,t,e.value,n)).ok?(i=r.field,a=r.servar,l=r.value,"gmap_state"!==a.type?[3,1]:(l=function(e,t){var n,r;if("string"!=typeof e||!e)return e;var o=!!(null===(n=t.metadata)||void 0===n?void 0:n.store_abbreviation),i=null===(r=t.metadata)||void 0===r?void 0:r.default_country,a=(i&&"auto"!==i?i:"us").toLowerCase(),l=Re.P3[a];if(!l||0===l.length)return e;var u=e.toLowerCase(),d=l.find((function(e){return e.code.toLowerCase()===u||e.name.toLowerCase()===u}));return d?o?d.code:d.name:e}(l,a),[3,3])):[2,{fieldKey:t,repeatIndex:n,ok:!1,errorType:r.errorType,error:r.error}]:[2,{fieldKey:t,repeatIndex:n,ok:!1,errorType:"shape_mismatch",error:"fieldKey is required."}];case 1:return"phone_number"!==a.type?[3,3]:[4,Fe(l,a,o,t)];case 2:l=u.sent(),u.label=3;case 3:return[2,{fieldKey:t,repeatIndex:n,field:i,normalized:l}]}}))}))})))]):[2,{results:t.map((function(e){var t="string"==typeof(null==e?void 0:e.fieldKey)?e.fieldKey:"",n=Number.isInteger(null==e?void 0:e.repeatIndex)?e.repeatIndex:void 0;return t?{fieldKey:t,repeatIndex:n,ok:!1,errorType:"no_form_state",error:"Form has not loaded yet."}:{fieldKey:t,repeatIndex:n,ok:!1,errorType:"shape_mismatch",error:"fieldKey is required."}}))}];case 1:return u=c.sent(),d=u.map((function(e){var t,n;if("ok"in e)return e;var r="number"==typeof e.repeatIndex?Le(Le({},e.field),{repeat:e.repeatIndex}):e.field;try{i.changeValue(e.normalized,r,null!==(t=e.repeatIndex)&&void 0!==t?t:null)}catch(t){return{fieldKey:e.fieldKey,repeatIndex:e.repeatIndex,ok:!1,errorType:"dispatch_failed",error:t instanceof Error?t.message:String(t)}}var o=l.get(e.fieldKey),a=void 0!==e.repeatIndex?Array.isArray(o)&&null!==(n=o[e.repeatIndex])&&void 0!==n?n:null:null!=o?o:null;return{fieldKey:e.fieldKey,repeatIndex:e.repeatIndex,ok:!0,value:e.normalized,priorValue:a}})),[2,{results:d}]}}))}))}var Xe=function(){return Xe=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Xe.apply(this,arguments)},De=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Pe=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};function Ve(e,t,n){var r,o,i,a,l,u,d,s,c,f,p,h;return c=this,f=void 0,h=function(){var c,f,p,h,v,y,g,m,b,x,w,k,S,A,_,C,I,T,Z,R,L,j,B,O,E,z,W,K,M,F,N,X;return function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}(this,(function(D){switch(D.label){case 0:if(c=Number.isInteger(n)?n:null,!e)return[2,{ok:!1,errorType:"no_form_state",error:"Form has not loaded yet."}];if(!(f=de.Z[e])||!f.currentStep||!f.assistantClient)return[2,{ok:!1,errorType:"no_form_state",error:"Form has not loaded yet."}];if("string"!=typeof t||0===t.length)return[2,{ok:!1,errorType:"shape_mismatch",error:"elementId is required."}];if(p=function(e,t){var n,r,o,i=null==e?void 0:e.currentStep;if(!i)return null;var a=[[i.buttons,"button"],[i.texts,"text"],[i.subgrids,"container"]];try{for(var l=De(a),u=l.next();!u.done;u=l.next()){var d=Pe(u.value,2),s=d[0],c=d[1],f=(null!=s?s:[]).find((function(e){return(null==e?void 0:e.id)===t}));if(f){var p=null===(o=null==f?void 0:f.properties)||void 0===o?void 0:o.actions;return{element:f,elementType:c,actions:Array.isArray(p)?p:[],position:Array.isArray(f.position)?f.position:[]}}}}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.error}}return null}(f,t),!p)return[2,{ok:!1,errorType:"not_on_step",error:"Element '".concat(t,"' is not on the current step.")}];if(h=null!==(r=f.visiblePositions)&&void 0!==r?r:{},v=h[null!==(o=(0,fe.gh)(p.element))&&void 0!==o?o:"root"],Array.isArray(v)&&!v.some(Boolean))return[2,{ok:!1,errorType:"hidden",error:"Element '".concat(t,"' is on the current step but is hidden right now.")}];if("button"===p.elementType&&(y=!(!(null===(i=f.formSettings)||void 0===i?void 0:i.readOnly)&&"readOnly"!==le.Hi.collaboratorReview),(0,he.A)(p.element,f.currentStep,h,y)))return[2,{ok:!1,errorType:"disabled",error:"Button '".concat(t,"' is disabled and cannot be clicked.")}];if(g=p.element.repeated?p.element:(0,ce.o$)(f.currentStep,p.element),m=g?(null!==(l=h[null!==(a=(0,fe.gh)(g))&&void 0!==a?a:"root"])&&void 0!==l?l:[]).length:0,b=me(c,!!g,m,t))return[2,Xe({ok:!1},b)];if("number"==typeof c&&Array.isArray(v)&&!v[c])return[2,{ok:!1,errorType:"hidden",error:"Row ".concat(c," of element '").concat(t,"' is hidden right now.")}];x=f.assistantClient,w=f.currentStep.key,k=ye(f),S="number"==typeof c?Xe(Xe({},p.element),{repeat:c}):p.element,D.label=1;case 1:return D.trys.push([1,13,,14]),"button"!==p.elementType?[3,3]:[4,x.click(S)];case 2:return D.sent(),[3,12];case 3:return A=ge(f.currentStep.subgrids,p.position),[4,x.runActions({actions:p.actions,element:S,elementType:p.elementType})];case 4:D.sent(),D.label=5;case 5:D.trys.push([5,10,11,12]),_=De(A),C=_.next(),D.label=6;case 6:return C.done?[3,9]:(I=C.value,T=null===(u=null==I?void 0:I.properties)||void 0===u?void 0:u.actions,Z="number"==typeof c&&!!g&&I.position.length>=g.position.length,[4,x.runActions({actions:Array.isArray(T)?T:[],element:Z?Xe(Xe({},I),{repeat:c}):I,elementType:"container"})]);case 7:D.sent(),D.label=8;case 8:return C=_.next(),[3,6];case 9:return[3,12];case 10:return R=D.sent(),M={error:R},[3,12];case 11:try{C&&!C.done&&(F=_.return)&&F.call(_)}finally{if(M)throw M.error}return[7];case 12:return[3,14];case 13:return[2,{ok:!1,errorType:"dispatch_failed",error:(L=D.sent())instanceof Error?L.message:String(L)}];case 14:j=null!==(s=null===(d=f.currentStep)||void 0===d?void 0:d.key)&&void 0!==s?s:w,B=ye(f),O={};try{for(E=De(Object.keys(B)),z=E.next();!z.done;z=E.next())W=z.value,B[W]!==k[W]&&(O[W]=B[W])}catch(e){N={error:e}}finally{try{z&&!z.done&&(X=E.return)&&X.call(E)}finally{if(N)throw N.error}}return K="button"===p.elementType?O[t]:void 0,delete O[t],[2,Xe(Xe({ok:!0,navigated:j!==w?{fromStepKey:w,toStepKey:j}:null},K?{buttonError:K}:{}),Object.keys(O).length>0?{fieldErrors:O}:{})]}}))},new((p=void 0)||(p=Promise))((function(e,t){function n(e){try{o(h.next(e))}catch(e){t(e)}}function r(e){try{o(h.throw(e))}catch(e){t(e)}}function o(t){var o;t.done?e(t.value):(o=t.value,o instanceof p?o:new p((function(e){e(o)}))).then(n,r)}o((h=h.apply(c,f||[])).next())}))}var qe=function(){return qe=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},qe.apply(this,arguments)};function He(e,t,n,r){var o,i,a,l,u,d,s;return l=this,u=void 0,s=function(){var l,u,d,s,c,f,p,h,v,y,g,m,b,x,w,k,S,A;return function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}(this,(function(_){switch(_.label){case 0:if(!(l=be(e,t)).ok)return[2,l];if(u=l.found,d=u.state,s=u.table,c=u.rowCount,f="string"==typeof r&&r.length>0,void 0!==r&&!f)return[2,{ok:!1,errorType:"shape_mismatch",error:"actionLabel must be a non-empty string when provided."}];if(!Number.isInteger(n)||n<0)return[2,{ok:!1,errorType:"shape_mismatch",error:"rowIndex must be a non-negative integer."}];if(f){if(!(Array.isArray(null===(o=null==s?void 0:s.properties)||void 0===o?void 0:o.actions)?s.properties.actions:[]).some((function(e){return(null==e?void 0:e.label)===r})))return[2,{ok:!1,errorType:"unknown_action",error:"Table '".concat(t,"' has no action labeled '").concat(r,"'.")}]}else if(xe(s,c).canEditCells)return[2,{ok:!1,errorType:"not_allowed",error:"Table '".concat(t,"' is editable, so bare row clicks are not wired; use a named action.")}];if(n>=c)return[2,{ok:!1,errorType:"row_out_of_range",error:"Row ".concat(n," is out of range (table has ").concat(c," row").concat(1===c?"":"s",").")}];p=function(e,t){var n,r,o,i,a={};try{for(var l=ve(e.columns),u=l.next();!u.done;u=l.next()){var d=u.value;if(null==d?void 0:d.field_key){var s=null===(i=null===(o=e.state.fields)||void 0===o?void 0:o[d.field_key])||void 0===i?void 0:i.value,c=Array.isArray(s)?s[t]:s;a[d.name]=c}}}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.error}}return a}(l.found,n),h=d.currentStep.key,v=ye(d),_.label=1;case 1:return _.trys.push([1,3,,4]),[4,d.assistantClient.runTableAction({table:s,payload:f?{action:r,rowIndex:n,rowData:p}:{rowIndex:n,rowData:p}})];case 2:return _.sent(),[3,4];case 3:return[2,{ok:!1,errorType:"dispatch_failed",error:(y=_.sent())instanceof Error?y.message:String(y)}];case 4:g=null!==(a=null===(i=d.currentStep)||void 0===i?void 0:i.key)&&void 0!==a?a:h,m=ye(d),b={};try{for(x=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(Object.keys(m)),w=x.next();!w.done;w=x.next())k=w.value,m[k]!==v[k]&&(b[k]=m[k])}catch(e){S={error:e}}finally{try{w&&!w.done&&(A=x.return)&&A.call(x)}finally{if(S)throw S.error}}return[2,qe({ok:!0,navigated:g!==h?{fromStepKey:h,toStepKey:g}:null},Object.keys(b).length>0?{fieldErrors:b}:{})]}}))},new((d=void 0)||(d=Promise))((function(e,t){function n(e){try{o(s.next(e))}catch(e){t(e)}}function r(e){try{o(s.throw(e))}catch(e){t(e)}}function o(t){var o;t.done?e(t.value):(o=t.value,o instanceof d?o:new d((function(e){e(o)}))).then(n,r)}o((s=s.apply(l,u||[])).next())}))}var Ye=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function l(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,l)}u((r=r.apply(e,t||[])).next())}))},Ue=function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}},Je=function(e,t){return!Number.isInteger(e)||e<0?{ok:!1,errorType:"shape_mismatch",error:"rowIndex must be a non-negative integer."}:e>=t?{ok:!1,errorType:"row_out_of_range",error:"Row ".concat(e," is out of range (table has ").concat(t," row").concat(1===t?"":"s",").")}:null},$e={add:"adding rows",del:"deleting rows",edit:"cell editing"},Ge=function(e,t,n,r){var o=xe(e,r);return"add"===n&&o.canAddRows||"del"===n&&o.canDeleteRows||"edit"===n&&o.canEditCells?null:{ok:!1,errorType:"not_allowed",error:"Table '".concat(t,"' does not allow ").concat($e[n],".")}};function Qe(e,t){return Ye(this,void 0,void 0,(function(){var n,r,o,i,a,l;return Ue(this,(function(u){if(!(n=be(e,t)).ok)return[2,n];if(r=n.found,o=r.state,i=r.table,a=r.rowCount,l=Ge(i,t,"add",a))return[2,l];try{if(!o.assistantClient.addTableRow(t))return[2,{ok:!1,errorType:"not_mounted",error:"Table '".concat(t,"' is not mounted yet.")}]}catch(e){return[2,{ok:!1,errorType:"dispatch_failed",error:e instanceof Error?e.message:String(e)}]}return[2,{ok:!0}]}))}))}function et(e,t,n){return Ye(this,void 0,void 0,(function(){var r,o,i,a,l,u,d;return Ue(this,(function(s){if(!(r=be(e,t)).ok)return[2,r];if(o=r.found,i=o.state,a=o.table,l=o.rowCount,u=Ge(a,t,"del",l))return[2,u];if(d=Je(n,l))return[2,d];try{if(!i.assistantClient.deleteTableRow(t,n))return[2,{ok:!1,errorType:"not_mounted",error:"Table '".concat(t,"' is not mounted yet.")}]}catch(e){return[2,{ok:!1,errorType:"dispatch_failed",error:e instanceof Error?e.message:String(e)}]}return[2,{ok:!0}]}))}))}function tt(e,t,n){var r;return Ye(this,void 0,void 0,(function(){var o,i,a,l,u,d,s,c,f,p,h,v,y,g,m,b,x;return Ue(this,(function(w){if(o=(Array.isArray(n)?n:[]).map((function(e){return{rowIndex:"number"==typeof(null==e?void 0:e.rowIndex)?e.rowIndex:NaN,fieldKey:"string"==typeof(null==e?void 0:e.fieldKey)?e.fieldKey:"",value:null==e?void 0:e.value}})),i=function(e,t){return{results:o.map((function(n){return{rowIndex:n.rowIndex,fieldKey:n.fieldKey,ok:!1,errorType:e,error:t}}))}},!(a=be(e,t)).ok)return[2,i(a.errorType,a.error)];if(l=a.found,u=l.state,d=l.table,s=l.columns,c=l.rowCount,f=Ge(d,t,"edit",c))return[2,i(f.errorType,f.error)];p=new Map(o.filter((function(e){return e.fieldKey})).map((function(e){var t,n,r=null===(n=null===(t=u.fields)||void 0===t?void 0:t[e.fieldKey])||void 0===n?void 0:n.value,o=Array.isArray(r)?r[e.rowIndex]:void 0;return["".concat(e.fieldKey,":").concat(e.rowIndex),null==o?null:JSON.parse(JSON.stringify(o))]}))),h=[],v=function(e){var n=e.rowIndex,o=e.fieldKey,i=e.value;if(!o)return h.push({rowIndex:n,fieldKey:o,ok:!1,errorType:"shape_mismatch",error:"fieldKey is required."}),"continue";if(!s.some((function(e){return(null==e?void 0:e.field_key)===o})))return h.push({rowIndex:n,fieldKey:o,ok:!1,errorType:"unknown_field",error:"Table '".concat(t,"' has no column with fieldKey '").concat(o,"'.")}),"continue";var a=Je(n,c);if(a)return h.push({rowIndex:n,fieldKey:o,ok:!1,errorType:a.errorType,error:a.error}),"continue";var l=null==i?"":String(i);try{if(!u.assistantClient.editTableCell(t,n,o,l))return h.push({rowIndex:n,fieldKey:o,ok:!1,errorType:"not_mounted",error:"Table '".concat(t,"' is not mounted yet.")}),"continue"}catch(e){return h.push({rowIndex:n,fieldKey:o,ok:!1,errorType:"dispatch_failed",error:e instanceof Error?e.message:String(e)}),"continue"}h.push({rowIndex:n,fieldKey:o,ok:!0,value:l,priorValue:null!==(r=p.get("".concat(o,":").concat(n)))&&void 0!==r?r:null})};try{for(y=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(o),g=y.next();!g.done;g=y.next())m=g.value,v(m)}catch(e){b={error:e}}finally{try{g&&!g.done&&(x=y.return)&&x.call(y)}finally{if(b)throw b.error}}return[2,{results:h}]}))}))}var nt=function(){return nt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},nt.apply(this,arguments)},rt=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function l(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,l)}u((r=r.apply(e,t||[])).next())}))},ot=function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}},it=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},at=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))},lt="feathery.assistant.mode",ut="current",dt=function(){try{var e=(0,ue.Kv)().localStorage.getItem(lt);return"current"===(t=e)||"sidebar-left"===t||"sidebar-right"===t||"fullscreen"===t?e:ut}catch(e){return ut}var t},st="feathery.assistant.sidebarWidth",ct=400,ft=function(e){var t=Math.max(280,function(){try{return Math.min(800,Math.floor(.6*(0,ue.Kv)().innerWidth))}catch(e){return 800}}());return e<280?280:e>t?t:e},pt=function(){try{var e=(0,ue.Kv)().localStorage.getItem(st),t=e?parseInt(e,10):NaN;return Number.isFinite(t)&&t>0?ft(t):ct}catch(e){return ct}},ht=function(e){try{(0,ue.Kv)().localStorage.setItem(st,String(e))}catch(e){}},vt=["current","sidebar-left","sidebar-right","fullscreen"];const yt=function(e){var t,n,u,s=e.instanceId,f=e.getTargets,h=e.getJwt,S=e.baseUrl,T=e.bottom,R=void 0===T?20:T,j=e.color,B=e.workflowActions,O=void 0===B?[]:B,E=e.allowedModes,z=void 0===E?vt:E,W=e.onLayoutChange,K=(0,o.useMemo)((function(){if(h)return function(){return{Authorization:"Bearer ".concat(h())}};var e=(0,le.JQ)().sdkKey;return function(){var t={Authorization:"Token ".concat(e)},n=(0,ue.ej)("feathery_session_token");return n&&(t["X-Feathery-Session"]=n),t}}),[h]),M=it((0,o.useState)(!1),2),F=M[0],N=M[1],X=it((0,o.useState)(dt),2),D=X[0],V=X[1],H=(0,o.useCallback)((function(e){V(e),function(e){try{(0,ue.Kv)().localStorage.setItem(lt,e)}catch(e){}}(e)}),[]),Y=it((0,o.useState)(pt),2),U=Y[0],J=Y[1],$=it((0,o.useState)(!1),2),G=$[0],Q=$[1];(0,o.useEffect)((function(){var e=function(){J((function(e){var t=ft(e);return t!==e&&ht(t),t}))};return(0,ue.Kv)().addEventListener("resize",e),function(){return(0,ue.Kv)().removeEventListener("resize",e)}}),[]);var se=(0,o.useCallback)((function(e){return function(t){if(0===t.button){t.preventDefault(),Q(!0);var n=(0,ue.me)().body;n.style.cursor="col-resize",n.style.userSelect="none";var r=U,o=function(t){var n="right"===e?(0,ue.Kv)().innerWidth-t.clientX:t.clientX;r=ft(n),J(r)},i=function(){(0,ue.Kv)().removeEventListener("pointermove",o),(0,ue.Kv)().removeEventListener("pointerup",i),(0,ue.Kv)().removeEventListener("pointercancel",i),Q(!1),n.style.cursor="",n.style.userSelect="",ht(r)};(0,ue.Kv)().addEventListener("pointermove",o),(0,ue.Kv)().addEventListener("pointerup",i),(0,ue.Kv)().addEventListener("pointercancel",i)}}}),[U]),ve=(0,o.useCallback)((function(){J(ct),ht(ct)}),[]),ye=it((0,o.useState)(""),2),me=ye[0],be=ye[1],Ie=it((0,o.useState)([]),2),Ze=Ie[0],Re=Ie[1],Le=it((0,o.useState)(null),2),je=Le[0],Be=Le[1],Oe=it((0,o.useState)(!1),2),Ee=Oe[0],ze=Oe[1],We=it((0,o.useState)(!1),2),Ke=We[0],Me=We[1],Fe=it((0,o.useState)(null),2),Xe=Fe[0],De=Fe[1],Pe=(0,o.useRef)(null),qe=(0,o.useRef)(null),Ye=(0,o.useRef)(!0),Ue=(0,o.useCallback)((function(){var e=qe.current;if(e){var t=e.scrollHeight-e.scrollTop-e.clientHeight;Ye.current=t<60}}),[]),Je=(0,o.useMemo)((function(){return{primary:e=j||A,hover:L(e,-15),disabled:L(e,30),light:(t=e,90,n=parseInt(t.replace("#",""),16),r=n>>16&255,o=n>>8&255,i=255&n,.9,a=Math.round(r+.9*(255-r)),l=Math.round(o+.9*(255-o)),u=Math.round(i+.9*(255-i)),"#".concat((a<<16|l<<8|u).toString(16).padStart(6,"0")))};var e,t,n,r,o,i,a,l,u}),[j]),$e=function(e,t,n){void 0===t&&(t=[]);var r=e,o=!!n,i=new l.PD({api:S,headers:K,body:function(){return nt(nt({},function(){var e={},t=f();if(t.length>0&&(e.targets=t),s){var n=function(e){var t,n,r,o,i,a,l,u,d,s,c,f,p,h,v,y,g,m,b,x,w=de.Z[e];if(!w||!w.currentStep)return null;var k=w.currentStep,S=null!==(i=w.visiblePositions)&&void 0!==i?i:{},A=null!==(a=w.fields)&&void 0!==a?a:{},_=null!==(l=w.inlineErrors)&&void 0!==l?l:{},C=w.logicRules,I=!(!(null===(u=w.formSettings)||void 0===u?void 0:u.readOnly)&&"readOnly"!==le.Hi.collaboratorReview),T=(null!==(d=k.subgrids)&&void 0!==d?d:[]).filter((function(e){var t,n,r=null===(t=null==e?void 0:e.properties)||void 0===t?void 0:t.actions;return!!(Array.isArray(r)&&r.length>0)||Te(C,"action",k.id,null!==(n=e.id)&&void 0!==n?n:"")})),Z=function(e){return ge(T,Array.isArray(null==e?void 0:e.position)?e.position:[]).map((function(e){var t;return null!==(t=e.id)&&void 0!==t?t:""}))},R={};(0,ce.bW)(k).forEach((function(e){var t=null==e?void 0:e.id;if(t){var n=S[(0,fe.gh)(e)];Array.isArray(n)&&(R[t]=n.length)}}));var L=(null!==(s=k.servar_fields)&&void 0!==s?s:[]).map((function(e){var t,n,r,o,i,a,l,u,d,s,c,f=(null===(t=e.position)||void 0===t?void 0:t.join(","))||"root",p=S[f],h=!Array.isArray(p)||p.some(Boolean),v=A[e.servar.key],y=null!==(n=e.properties)&&void 0!==n?n:{},g="string"==typeof y.placeholder&&y.placeholder.trim()?Ce(y.placeholder):void 0,m="string"==typeof y.tooltipText&&y.tooltipText.trim()?Ce(y.tooltipText):void 0,b=null===(r=_[e.servar.key])||void 0===r?void 0:r.message,x=null!==(o=e.servar)&&void 0!==o?o:{},w=null!==(i=x.metadata)&&void 0!==i?i:{},T=!!x.repeated,L=T?(0,ce.o$)(k,e):void 0,j=null!==(a=null==L?void 0:L.id)&&void 0!==a?a:"",B=Array.isArray(w.options)?w.options:null,O=Array.isArray(w.labels)?w.labels:[],E=B?B.map((function(e,t){var n,r;return{value:String(null!=e?e:""),label:String(null!==(r=null!==(n=O[t])&&void 0!==n?n:e)&&void 0!==r?r:"")}})):void 0,z=Array.isArray(w.repeat_options)?w.repeat_options.map((function(e){return Array.isArray(e)?e.map((function(e){var t,n,r,o,i;return{value:String(null!==(n=null!==(t=null==e?void 0:e.value)&&void 0!==t?t:e)&&void 0!==n?n:""),label:String(null!==(i=null!==(o=null!==(r=null==e?void 0:e.label)&&void 0!==r?r:null==e?void 0:e.value)&&void 0!==o?o:e)&&void 0!==i?i:"")}})):null})):void 0,W=null!==(u=null!==(l=R[j])&&void 0!==l?l:null==z?void 0:z.length)&&void 0!==u?u:0,K=z?Array.from({length:W},(function(e,t){return Array.isArray(z[t])?z[t]:null})):void 0,M=Array.isArray(w.questions)?w.questions:null,F=M?M.map((function(e){var t,n;return{id:String(null!==(t=null==e?void 0:e.id)&&void 0!==t?t:""),label:String(null!==(n=null==e?void 0:e.label)&&void 0!==n?n:"")}})).filter((function(e){return e.id||e.label})):void 0,N=Se(Se([],ke(Array.isArray(w.file_types)?w.file_types:[]),!1),ke(Array.isArray(w.custom_file_types)?w.custom_file_types.map((function(e){return".".concat(e)})):[]),!1),X=w.min_val_label||w.max_val_label?we(we({},w.min_val_label?{min:String(w.min_val_label)}:{}),w.max_val_label?{max:String(w.max_val_label)}:{}):void 0,D=!(!y.disabled&&!I),P=Te(C,"change",k.id,null!==(d=x.id)&&void 0!==d?d:""),V=Z(e),q=null!==(s=null==v?void 0:v.value)&&void 0!==s?s:null,H=T?null!==(c=R[j])&&void 0!==c?c:Array.isArray(q)?q.length:0:void 0;if("number"==typeof H&&H>0){var Y=Array.isArray(q)?q:[];Y.length<H&&(q=Se(Se([],ke(Y),!1),ke(Array(H-Y.length).fill((0,pe.oe)(e))),!1))}return we(we(we(we(we(we(we(we(we(we(we(we(we(we(we(we(we(we({key:x.key,type:x.type,value:q,visible:h,disabled:D,required:!!x.required},"number"==typeof H?{rowCount:H}:{}),(null==L?void 0:L.id)?{repeatContainerId:L.id}:{}),P?{hasLogicRules:!0}:{}),V.length>0?{clickableAncestorIds:V}:{}),g?{placeholder:g}:{}),m?{tooltip:m}:{}),b?{error:b}:{}),E?{options:E}:{}),K?{rowOptions:K}:{}),F?{questions:F}:{}),"number"==typeof x.min_length?{minLength:x.min_length}:{}),"number"==typeof x.max_length?{maxLength:x.max_length}:{}),x.format?{format:String(x.format)}:{}),N.length>0?{fileTypes:N}:{}),w.multiple?{multipleFiles:!0}:{}),"button_group"===x.type?{multiple:!!w.multiple}:{}),X?{sliderLabels:X}:{}),"number"==typeof w.step_size?{stepSize:w.step_size}:{})})),j=new Set;try{for(var B=Ae(Object.keys(null!==(c=w.steps)&&void 0!==c?c:{})),O=B.next();!O.done;O=B.next()){var E=O.value,z=w.steps[E];(null!==(f=null==z?void 0:z.servar_fields)&&void 0!==f?f:[]).forEach((function(e){var t;(null===(t=null==e?void 0:e.servar)||void 0===t?void 0:t.key)&&j.add(e.servar.key)}))}}catch(e){t={error:e}}finally{try{O&&!O.done&&(n=B.return)&&n.call(B)}finally{if(t)throw t.error}}var W=function(e){return!(null==e||"string"==typeof e&&""===e||Array.isArray(e)&&0===e.length)},K={},M={};try{for(var F=Ae(Object.keys(A)),N=F.next();!N.done;N=F.next()){var X=N.value,D=null!==(h=null===(p=A[X])||void 0===p?void 0:p.value)&&void 0!==h?h:null;j.has(X)?K[X]=D:W(D)&&(M[X]=D)}}catch(e){r={error:e}}finally{try{N&&!N.done&&(o=F.return)&&o.call(F)}finally{if(r)throw r.error}}var P=[],V=function(e){var t,n=(null===(t=e.position)||void 0===t?void 0:t.join(","))||"root",r=S[n];return!Array.isArray(r)||r.some(Boolean)};T.forEach((function(e){var t,n,r,o=e.properties.actions,i=Te(C,"action",k.id,null!==(t=e.id)&&void 0!==t?t:""),a=Z(e),l=e.repeated?e.id:null===(n=(0,ce.o$)(k,e))||void 0===n?void 0:n.id;P.push(we(we(we({type:"container",id:null!==(r=e.id)&&void 0!==r?r:"",visible:V(e),actions:o},i?{hasLogicRules:!0}:{}),a.length>0?{clickableAncestorIds:a}:{}),l?{repeatContainerId:l}:{}))})),(null!==(v=k.texts)&&void 0!==v?v:[]).forEach((function(e){var t,n,r,o,i=_e(null!==(t=null==e?void 0:e.properties)&&void 0!==t?t:{});if(i){var a=Ce(i),l=null!==(n=null==e?void 0:e.properties)&&void 0!==n?n:{},u=Array.isArray(l.actions)?l.actions:[],d=Te(C,"action",k.id,null!==(r=e.id)&&void 0!==r?r:""),s=Z(e),c=null===(o=(0,ce.o$)(k,e))||void 0===o?void 0:o.id;P.push(we(we(we(we(we(we({type:"text",text:a,visible:V(e)},e.id?{id:e.id}:{}),i!==a?{templateText:i}:{}),u.length>0?{actions:u}:{}),d?{hasLogicRules:!0}:{}),s.length>0?{clickableAncestorIds:s}:{}),c?{repeatContainerId:c}:{}))}})),(null!==(y=k.buttons)&&void 0!==y?y:[]).forEach((function(e){var t,n,r,o,i,a=_e(null!==(t=null==e?void 0:e.properties)&&void 0!==t?t:{}),l=null!==(n=null==e?void 0:e.properties)&&void 0!==n?n:{},u=Array.isArray(l.actions)?l.actions:[],d=Te(C,"action",k.id,null!==(r=e.id)&&void 0!==r?r:"")||!!l.submit&&(Te(C,"submit",k.id,"")||Te(C,"form_complete",k.id,""));if(a||0!==u.length||l.submit||d){var s=null===(o=(0,ce.o$)(k,e))||void 0===o?void 0:o.id;P.push(we(we({type:"button",id:null!==(i=e.id)&&void 0!==i?i:"",text:Ce(a),visible:V(e),disabled:(0,he.A)(e,k,S,I),submit:!!l.submit,actions:u},d?{hasLogicRules:!0}:{}),s?{repeatContainerId:s}:{}))}})),(null!==(g=k.images)&&void 0!==g?g:[]).forEach((function(e){var t,n=null!==(t=null==e?void 0:e.properties)&&void 0!==t?t:{},r="string"==typeof n.alt_text&&n.alt_text||"string"==typeof n.caption&&n.caption||"";if(r){var o=Z(e);P.push(we({type:"image",text:Ce(r),visible:V(e)},o.length>0?{clickableAncestorIds:o}:{}))}})),(null!==(m=k.progress_bars)&&void 0!==m?m:[]).forEach((function(e){var t,n=null===(t=null==e?void 0:e.properties)||void 0===t?void 0:t.num_segments;P.push(we(we({type:"progress"},"number"==typeof n?{segments:n}:{}),{visible:V(e)}))}));var q=[];return(null!==(b=k.tables)&&void 0!==b?b:[]).forEach((function(e){var t,n,r,o,i,a=null!==(n=null===(t=null==e?void 0:e.properties)||void 0===t?void 0:t.columns)&&void 0!==n?n:[];if(0!==a.length){var l=a.reduce((function(e,t){var n,r=t.field_key?null===(n=A[t.field_key])||void 0===n?void 0:n.value:void 0;return Array.isArray(r)?Math.max(e,r.length):e}),0),u=Array.from({length:l},(function(e,t){return a.map((function(e){var n,r,o=e.field_key?null===(n=A[e.field_key])||void 0===n?void 0:n.value:null;return Array.isArray(o)?null!==(r=o[t])&&void 0!==r?r:null:null!=o?o:null}))})),d=(Array.isArray(null===(r=null==e?void 0:e.properties)||void 0===r?void 0:r.actions)?e.properties.actions:[]).map((function(e){return{label:"string"==typeof(null==e?void 0:e.label)?e.label:""}})).filter((function(e){return e.label.trim().length>0})),s=xe(e,l),c=s.canEditCells,f=s.canAddRows,p=s.canDeleteRows,h=Te(C,"action",k.id,null!==(o=e.id)&&void 0!==o?o:"");q.push(we(we(we(we(we(we({id:null!==(i=e.id)&&void 0!==i?i:"",columns:a.map((function(e){var t,n,r;return{name:null!==(n=null!==(t=e.name)&&void 0!==t?t:e.field_key)&&void 0!==n?n:"",fieldKey:null!==(r=e.field_key)&&void 0!==r?r:""}})),rows:u},d.length>0?{actions:d}:{}),f?{canAddRows:!0}:{}),p?{canDeleteRows:!0}:{}),c?{canEditCells:!0}:{}),h?{hasLogicRules:!0}:{}),{visible:V(e)}))}})),{currentStep:{id:k.id,key:k.key},previousStepName:w.previousStepName||void 0,totalSteps:Object.keys(null!==(x=w.steps)&&void 0!==x?x:{}).length,currentStepFields:L,currentStepElements:P,currentStepTables:q,values:K,hiddenFieldValues:M}}(s);n&&(e.panel_runtime=n)}return e}()),{thread_id:r||null})},fetch:function(e,t){return rt(void 0,void 0,void 0,(function(){var n,i,a,l,d,c,p,h,v,y;return ot(this,(function(g){switch(g.label){case 0:return[4,fetch(e,t)];case 1:return n=g.sent(),(i=n.headers.get("X-Thread-Id"))&&!r&&(r=i,Re((function(e){return e.map((function(e){return e.chat===u?nt(nt({},e),{id:i,isTemporary:!1}):e}))})),Be(i),ie(S,K,i).then((function(e){e&&Re((function(t){return t.map((function(t){return t.id===i?nt(nt({},e),{chat:u,title:t.title||e.title}):t}))}))}))),o||(a=null===(y=null===(v=null===(h=u.messages.find((function(e){return"user"===e.role})))||void 0===h?void 0:h.parts)||void 0===v?void 0:v[0])||void 0===y?void 0:y.text)&&(o=!0,l=r||i||null,d={},(c=f()).length>0&&(d.targets=c),s&&(p=function(e){var t,n;return null===(n=null===(t=de.Z[e])||void 0===t?void 0:t.currentStep)||void 0===n?void 0:n.key}(s),p&&(d.current_step=p)),function(e,t,n,r,o){return ne(void 0,void 0,void 0,(function(){var i,a,l;return re(this,(function(u){switch(u.label){case 0:return[4,fetch("".concat(e,"threads/title/"),{method:"POST",headers:te(te({},t()),{"Content-Type":"application/json"}),body:JSON.stringify(te({message:r,thread_id:null!=n?n:void 0},null!=o?o:{}))})];case 1:return(i=u.sent()).ok?[4,i.json()]:[2,null];case 2:return a=u.sent(),[2,null!==(l=a.title)&&void 0!==l?l:null]}}))}))}(S,K,l,a,d).then((function(e){e&&Re(l?function(t){return t.map((function(t){return t.id===l?nt(nt({},t),{title:e}):t}))}:function(t){return t.map((function(t){return t.chat===u?nt(nt({},t),{title:e}):t}))})}))),[2,n]}}))}))}}),u=new a.en({transport:i,messages:t,sendAutomaticallyWhen:l.Qk,onToolCall:function(e){var t=e.toolCall;return rt(void 0,void 0,void 0,(function(){var e,n,r,o,i,a,l,d,c,f,p,h,v,y,g,m,b,x,w;return ot(this,(function(k){switch(k.label){case 0:return t.dynamic?[2]:"setFieldValue"!==t.toolName?[3,2]:(e=null!==(y=t.input)&&void 0!==y?y:{},n=Array.isArray(e.fields)?e.fields:[],[4,Ne(s,n)]);case 1:return v=k.sent(),u.addToolOutput({tool:"setFieldValue",toolCallId:t.toolCallId,output:v}),[3,12];case 2:return"clickElement"!==t.toolName?[3,4]:(r=null!==(g=t.input)&&void 0!==g?g:{},o="string"==typeof r.elementId?r.elementId:"",[4,Ve(s,o,r.repeatIndex)]);case 3:return v=k.sent(),u.addToolOutput({tool:"clickElement",toolCallId:t.toolCallId,output:v}),[3,12];case 4:return"triggerTableAction"!==t.toolName?[3,6]:(i=null!==(m=t.input)&&void 0!==m?m:{},p="string"==typeof i.tableId?i.tableId:"",c="number"==typeof i.rowIndex?i.rowIndex:NaN,a="string"==typeof i.actionLabel?i.actionLabel:void 0,[4,He(s,p,c,a)]);case 5:return v=k.sent(),u.addToolOutput({tool:"triggerTableAction",toolCallId:t.toolCallId,output:v}),[3,12];case 6:return"addTableRow"!==t.toolName?[3,8]:(l=null!==(b=t.input)&&void 0!==b?b:{},p="string"==typeof l.tableId?l.tableId:"",[4,Qe(s,p)]);case 7:return v=k.sent(),u.addToolOutput({tool:"addTableRow",toolCallId:t.toolCallId,output:v}),[3,12];case 8:return"deleteTableRow"!==t.toolName?[3,10]:(d=null!==(x=t.input)&&void 0!==x?x:{},p="string"==typeof d.tableId?d.tableId:"",c="number"==typeof d.rowIndex?d.rowIndex:NaN,[4,et(s,p,c)]);case 9:return v=k.sent(),u.addToolOutput({tool:"deleteTableRow",toolCallId:t.toolCallId,output:v}),[3,12];case 10:return"setTableCellValue"!==t.toolName?[3,12]:(f=null!==(w=t.input)&&void 0!==w?w:{},p="string"==typeof f.tableId?f.tableId:"",h=Array.isArray(f.cells)?f.cells:[],[4,tt(s,p,h)]);case 11:v=k.sent(),u.addToolOutput({tool:"setTableCellValue",toolCallId:t.toolCallId,output:v}),k.label=12;case 12:return[2]}}))}))},onFinish:function(e){var t=e.isAbort,n=e.isError;t||n||!r||Re((function(e){var t=e.find((function(e){return e.id===r}));return t?at([nt(nt({},t),{updated_at:(new Date).toISOString()})],it(e.filter((function(e){return e.id!==r}))),!1):e}))}});return u},Ge=(0,o.useMemo)((function(){return $e(null)}),[K,f,h]),ut=Ze.find((function(e){return e.id===je})),st=null!==(u=null==ut?void 0:ut.chat)&&void 0!==u?u:Ge,yt=(0,a.RJ)({chat:st}),gt=yt.messages,mt=yt.sendMessage,bt=yt.status,xt=yt.error,wt=(0,o.useMemo)((function(){var e,t,n,r,o=[];try{for(var i=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(gt),a=i.next();!a.done;a=i.next()){var l=a.value,u=o[o.length-1];u&&"assistant"===u.role&&"assistant"===l.role?o[o.length-1]=nt(nt({},u),{parts:at(at([],it(null!==(n=u.parts)&&void 0!==n?n:[]),!1),it(null!==(r=l.parts)&&void 0!==r?r:[]),!1)}):o.push(l)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}return o}),[gt]);(0,o.useEffect)((function(){var e;Ye.current&&(null===(e=Pe.current)||void 0===e||e.scrollIntoView({behavior:"smooth"}))}),[wt]),(0,o.useEffect)((function(){if("ready"===bt&&Ye.current){var e=(0,ue.Kv)().requestAnimationFrame((function(){var e;null===(e=Pe.current)||void 0===e||e.scrollIntoView({behavior:"smooth",block:"end"})}));return function(){return(0,ue.Kv)().cancelAnimationFrame(e)}}}),[bt]);var kt=(0,o.useCallback)((function(){return rt(void 0,void 0,void 0,(function(){var e;return ot(this,(function(t){switch(t.label){case 0:return[4,oe(S,K)];case 1:return(e=t.sent())?(Re((function(t){return at(at([],it(e.map((function(e){var n;return nt(nt({},e),{chat:null===(n=t.find((function(t){return t.id===e.id})))||void 0===n?void 0:n.chat})}))),!1),it(t.filter((function(t){return!e.find((function(e){return e.id===t.id}))}))),!1)})),[2]):[2]}}))}))}),[K,S]);(0,o.useEffect)((function(){F&&kt()}),[F,kt]);var St=function(){Ye.current=!0;var e=(0,i.Z)(),t=(new Date).toISOString(),n=$e(null);Re((function(r){return at([{id:e,title:"",created_at:t,updated_at:t,isTemporary:!0,chat:n}],it(r.filter((function(e){return!e.isTemporary||e.title}))),!1)})),Be(e)},At=function(){if(me.trim()&&"ready"===bt){Ye.current=!0;var e=(new Date).toISOString();if(je)ut&&!ut.title&&Re((function(t){return at([nt(nt({},ut),{title:"New Chat",updated_at:e})],it(t.filter((function(e){return e.id!==je}))),!1)}));else{var t=(0,i.Z)();Re((function(n){return at([{id:t,title:"New Chat",created_at:e,updated_at:e,isTemporary:!0,chat:st}],it(n),!1)})),Be(t)}mt({text:me}),be("")}},_t=Ze.filter((function(e){return e.title})),Ct="submitted"===bt||"streaming"===bt,It="sidebar-left"===D?"left":"sidebar-right"===D?"right":null,Tt=F&&It?U:0,Zt=(0,o.useRef)(W);Zt.current=W,(0,o.useEffect)((function(){var e;null===(e=Zt.current)||void 0===e||e.call(Zt,{mode:D,isOpen:F,side:It,width:Tt,isResizing:G})}),[D,F,It,Tt,G]);var Rt="sidebar-left"===D?w:"sidebar-right"===D?k:"fullscreen"===D?p:x,Lt="sidebar-left"===D?g:"sidebar-right"===D?m:"fullscreen"===D?b:y,jt="sidebar-left"===D,Bt=jt?{left:"20px"}:{right:"20px"},Ot=jt?20:R;if(!F)return(0,r.tZ)("button",nt({type:"button",onClick:function(){return N(!0)},css:nt(nt({position:"fixed",bottom:"".concat(Ot,"px")},Bt),{width:"".concat(56,"px"),height:"".concat(56,"px"),borderRadius:"50%",backgroundColor:Je.primary,color:"white",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",transition:"transform 0.2s, box-shadow 0.2s, background-color 0.2s",zIndex:1e3,":hover":{backgroundColor:Je.hover,transform:"scale(1.05)",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)"}})},{children:(0,r.tZ)(d,{})}));var Et="sidebar-left"===D?{top:0,left:0,width:"".concat(U,"px"),height:"100vh",borderRadius:0,boxShadow:"4px 0 24px rgba(0, 0, 0, 0.12)"}:"sidebar-right"===D?{top:0,right:0,width:"".concat(U,"px"),height:"100vh",borderRadius:0,boxShadow:"-4px 0 24px rgba(0, 0, 0, 0.12)"}:"fullscreen"===D?{inset:0,borderRadius:0,boxShadow:"none",border:"none"}:{bottom:"".concat(R,"px"),right:"20px",width:"".concat(380,"px"),height:"".concat(500,"px"),borderRadius:"12px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.12)",border:"1px solid ".concat(C)};return(0,r.BX)("div",nt({css:nt({position:"fixed",backgroundColor:"white",display:"flex",flexDirection:"column",overflow:"hidden",zIndex:1e3},Et)},{children:[It&&(0,r.tZ)("div",{role:"separator","aria-orientation":"vertical","aria-label":"Resize assistant panel",title:"Drag to resize, double-click to reset",onPointerDown:se(It),onDoubleClick:ve,css:(t={position:"absolute",top:0},t["right"===It?"left":"right"]=0,t.width="6px",t.height="100%",t.cursor="col-resize",t.zIndex=2,t.touchAction="none",t.userSelect="none",t["::after"]=(n={content:'""',position:"absolute",top:0},n["right"===It?"left":"right"]="2px",n.width="2px",n.height="100%",n.backgroundColor="transparent",n.transition="background-color 120ms ease",n),t[":hover::after"]={backgroundColor:"rgba(0, 0, 0, 0.15)"},t)}),(0,r.BX)("div",nt({css:nt({display:"flex",alignItems:"center",justifyContent:"space-between",gap:"2px",padding:"12px 16px",backgroundColor:Je.primary,color:"white",position:"relative"},It?{minHeight:"var(--main-nav-height, 55px)",boxSizing:"border-box"}:{})},{children:[(0,r.BX)("div",nt({css:{display:"flex",alignItems:"center",gap:"8px",minWidth:0,flex:1,overflow:"hidden"}},{children:[(0,r.tZ)(d,{}),(0,r.BX)("button",nt({type:"button",onClick:function(){return ze((function(e){return!e}))},css:{background:"none",border:"none",color:"white",cursor:"pointer",fontWeight:600,fontSize:"14px",padding:"4px",borderRadius:"4px",display:"flex",alignItems:"center",gap:"4px",minWidth:0,maxWidth:"100%",":hover":{backgroundColor:"rgba(255, 255, 255, 0.1)"}}},{children:[(0,r.tZ)("span",nt({css:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0}},{children:(null==ut?void 0:ut.title)||"AI Assistant"})),(0,r.tZ)("span",nt({css:{display:"flex",opacity:.8,flexShrink:0}},{children:(0,r.tZ)(v,{})}))]}))]})),(0,r.BX)("div",nt({css:{display:"flex",alignItems:"center",gap:"2px",position:"relative",flexShrink:0}},{children:[(0,r.tZ)("button",nt({type:"button",onClick:function(){return Me((function(e){return!e}))},css:{background:"none",border:"none",color:"white",cursor:"pointer",padding:"4px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"4px",":hover":{backgroundColor:"rgba(255, 255, 255, 0.1)"}}},{children:(0,r.tZ)(Lt,{})})),(0,r.tZ)("button",nt({type:"button",onClick:function(){return N(!1)},css:{background:"none",border:"none",color:"white",cursor:"pointer",padding:"4px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"4px",":hover":{backgroundColor:"rgba(255, 255, 255, 0.1)"}}},{children:(0,r.tZ)(Rt,{})})),Ke&&(0,r.BX)(r.HY,{children:[(0,r.tZ)("div",{css:{position:"fixed",inset:0,zIndex:1e3},onClick:function(){return Me(!1)}}),(0,r.tZ)("div",nt({css:{position:"absolute",top:"100%",right:0,marginTop:"4px",minWidth:"180px",backgroundColor:"white",border:"1px solid ".concat(C),borderRadius:"8px",boxShadow:"0 8px 16px rgba(0,0,0,0.12)",zIndex:1001,overflow:"hidden"}},{children:[{value:"current",label:"Floating",Icon:y},{value:"sidebar-left",label:"Sidebar left",Icon:g},{value:"sidebar-right",label:"Sidebar right",Icon:m},{value:"fullscreen",label:"Fullscreen",Icon:b}].filter((function(e){var t=e.value;return z.includes(t)})).map((function(e){var t=e.value,n=e.label,o=e.Icon;return(0,r.BX)("button",nt({type:"button",onClick:function(){H(t),Me(!1)},css:{width:"100%",padding:"10px 14px",background:t===D?Je.light:"white",border:"none",cursor:"pointer",fontSize:"13px",color:Z,textAlign:"left",display:"flex",alignItems:"center",gap:"10px",":hover":{backgroundColor:_}}},{children:[(0,r.tZ)("span",nt({css:{display:"flex",color:I,flexShrink:0}},{children:(0,r.tZ)(o,{})})),(0,r.tZ)("span",{children:n})]}),t)}))}))]})]})),Ee&&(0,r.BX)(r.HY,{children:[(0,r.tZ)("div",{css:{position:"fixed",inset:0,zIndex:1e3},onClick:function(){return ze(!1)}}),(0,r.BX)("div",nt({css:{position:"absolute",top:"100%",left:0,width:"100%",backgroundColor:"white",border:"1px solid ".concat(C),borderTop:"none",borderRadius:"0 0 8px 8px",boxShadow:"0 8px 16px rgba(0,0,0,0.12)",zIndex:1001,maxHeight:"240px",overflowY:"scroll"}},{children:[(0,r.tZ)("button",nt({type:"button",onClick:function(){St(),ze(!1)},css:{width:"100%",padding:"10px 14px",background:"none",border:"none",borderBottom:"1px solid ".concat("#f3f4f6"),cursor:"pointer",fontSize:"13px",fontWeight:600,color:Je.primary,textAlign:"left",":hover":{backgroundColor:_}}},{children:"+ New Chat"})),0===_t.length&&(0,r.tZ)("div",nt({css:{padding:"12px 14px",fontSize:"13px",color:I}},{children:"No chats yet"})),_t.map((function(e){return(0,r.BX)("div",nt({onClick:function(){return t=e.id,rt(void 0,void 0,void 0,(function(){var e,n,r,o;return ot(this,(function(i){switch(i.label){case 0:return Ye.current=!0,(null===(r=Ze.find((function(e){return e.id===t})))||void 0===r?void 0:r.chat)?(Be(t),ze(!1),[2]):[4,ie(S,K,t)];case 1:return(e=i.sent())?(n=$e(t,null!==(o=e.messages)&&void 0!==o?o:[],e.title),Re((function(r){return r.map((function(r){return r.id===t?nt(nt({},e),{chat:n}):r}))})),Be(t),ze(!1),[2]):[2]}}))}));var t},css:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 14px",cursor:"pointer",backgroundColor:e.id===je?Je.light:"white",":hover":{backgroundColor:_}}},{children:[(0,r.BX)("div",nt({css:{flex:1,minWidth:0}},{children:[(0,r.tZ)("div",nt({css:{fontSize:"13px",fontWeight:500,color:Z,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},{children:e.title||"Untitled conversation"})),(0,r.tZ)("div",nt({css:{fontSize:"11px",color:I,marginTop:"2px"}},{children:new Date(e.updated_at).toLocaleDateString()}))]})),(0,r.tZ)("button",nt({type:"button",onClick:function(t){return function(e,t){return rt(void 0,void 0,void 0,(function(){var n;return ot(this,(function(r){switch(r.label){case 0:return t.stopPropagation(),(null==(n=Ze.find((function(t){return t.id===e})))?void 0:n.isTemporary)?[3,2]:[4,ae(S,K,e)];case 1:r.sent(),r.label=2;case 2:return Re((function(t){return t.filter((function(t){return t.id!==e}))})),je===e&&St(),[2]}}))}))}(e.id,t)},css:{background:"none",border:"none",cursor:"pointer",color:I,fontSize:"16px",padding:"2px 6px",marginLeft:"8px",borderRadius:"4px",lineHeight:1,":hover":{color:"#dc2626",backgroundColor:"#fef2f2"}}},{children:"×"}))]}),e.id)}))]}))]})]})),(0,r.BX)("div",nt({ref:qe,onScroll:Ue,css:{flex:1,overflowY:"auto",padding:"16px",display:"flex",flexDirection:"column",gap:"12px"}},{children:[0===wt.length&&(0,r.tZ)("div",nt({css:{textAlign:"center",color:I,fontSize:"14px",marginTop:"40px"}},{children:"How can I help?"})),wt.map((function(e,t){return"user"===e.role?(0,r.tZ)("div",nt({css:{display:"flex",justifyContent:"flex-end"}},{children:(0,r.tZ)("div",nt({css:{maxWidth:"80%",padding:"10px 14px",borderRadius:"12px",fontSize:"14px",lineHeight:"1.5",backgroundColor:Je.primary,color:"white",overflowWrap:"anywhere",wordBreak:"break-word"}},{children:e.parts.filter((function(e){return!e.hidden})).map((function(e,t){return"text"===e.type?(0,r.tZ)("span",{children:e.text},t):null}))}))}),e.id):(0,r.tZ)(o.Fragment,{children:(n=t===wt.length-1,i=function(e){var t=[];return e.forEach((function(e,n){if("text"===e.type&&e.text.trim()){var r=t[t.length-1];r&&"text"===r.kind?r.text="".concat(r.text,"\n\n").concat(e.text):t.push({kind:"text",key:"text-".concat(n),text:e.text})}else{var o=function(e){if("text"===(null==e?void 0:e.type))return{kind:"text"};var t="string"==typeof(null==e?void 0:e.type)&&e.type.startsWith("tool-"),n="dynamic-tool"===(null==e?void 0:e.type);return t||n?{kind:"tool",toolName:t?e.type.replace("tool-",""):e.toolName||"unknown"}:null}(e);if(o&&"tool"===o.kind&&o.toolName){var i={key:"tool-".concat(n),toolName:o.toolName,state:e.state,input:e.input,output:e.output},a=t[t.length-1];a&&"tools"===a.kind?a.rows.push(i):t.push({kind:"tools",key:"tools-".concat(n),rows:[i]})}}})),t}(e.parts),a=e.parts[e.parts.length-1],l=!n||"ready"===bt&&"text"===(null==a?void 0:a.type),i.map((function(e,t){if("text"===e.kind)return(0,r.tZ)("div",nt({css:{display:"flex",justifyContent:"flex-start"}},{children:(0,r.tZ)("div",nt({css:{maxWidth:"80%",padding:"10px 14px",borderRadius:"12px",fontSize:"14px",lineHeight:"1.5",backgroundColor:Je.light,color:Z,overflowWrap:"anywhere",wordBreak:"break-word"}},{children:(0,r.tZ)(ee,{text:e.text,isStreaming:Ct&&n&&t===i.length-1})}))}),e.key);var o=i.slice(t+1).some((function(e){return"text"===e.kind}));return(0,r.tZ)("div",nt({css:{display:"flex",justifyContent:"flex-start",maxWidth:"80%",minWidth:0}},{children:(0,r.tZ)(P,{rows:e.rows,turnFinished:l,followedByText:o,linkColor:Je.primary,isFirstChunk:0===t})}),e.key)})))},e.id);var n,i,a,l})),function(){if(!Ct)return null;var e=wt[wt.length-1];if(!e)return null;if("user"!==e.role){var t=(e.parts||[]).some((function(e){var t;if("text"===(null==e?void 0:e.type))return(null!==(t=e.text)&&void 0!==t?t:"").trim().length>0;var n="string"==typeof(null==e?void 0:e.type)?e.type:"";return n.startsWith("tool-")||"dynamic-tool"===n}));if(t)return null}return(0,r.tZ)(q,{})}(),xt&&(0,r.tZ)("div",nt({css:{padding:"10px 14px",borderRadius:"8px",backgroundColor:"#fef2f2",color:"#dc2626",fontSize:"14px"}},{children:"Something went wrong. Please try again."})),(0,r.tZ)("div",{ref:Pe})]})),O.length>0&&(0,r.BX)("div",nt({css:{position:"relative",zIndex:1,borderTop:"1px solid ".concat(C),backgroundColor:_,padding:"8px 16px",display:"flex",gap:"6px",overflowX:"auto"}},{children:[O.map((function(e,t){return(0,r.tZ)("button",nt({type:"button",disabled:Ct,onClick:function(){return function(e){if("ready"===bt){var t=(new Date).toISOString();if(je)ut&&!ut.title&&Re((function(e){return at([nt(nt({},ut),{title:"New Chat",updated_at:t})],it(e.filter((function(e){return e.id!==je}))),!1)}));else{var n=(0,i.Z)();Re((function(e){return at([{id:n,title:"New Chat",created_at:t,updated_at:t,isTemporary:!0,chat:st}],it(e),!1)})),Be(n)}mt({parts:[{type:"text",text:e.name},{type:"text",text:e.instructions,hidden:!0,interpolate:!0}]})}}(e)},onMouseEnter:function(t){if(e.description){var n=t.currentTarget.getBoundingClientRect();De({text:e.description,x:n.left+n.width/2,y:n.top})}},onMouseLeave:function(){return De(null)},css:{flexShrink:0,padding:"4px 10px",fontSize:"12px",border:"1px solid ".concat(Je.primary),borderRadius:"12px",backgroundColor:"white",color:Je.primary,cursor:"pointer",whiteSpace:"nowrap",":disabled":{opacity:.5,cursor:"not-allowed"},":hover:not(:disabled)":{backgroundColor:Je.light},transition:"background-color 0.15s, color 0.15s"}},{children:e.name}),t)})),Xe&&(0,r.tZ)("div",nt({css:{position:"fixed",top:Xe.y-34,left:Xe.x,transform:"translateX(-50%)",backgroundColor:"rgba(0,0,0,0.9)",color:"white",fontSize:"12px",padding:"4px 8px",borderRadius:"4px",whiteSpace:"nowrap",pointerEvents:"none",zIndex:1e4}},{children:Xe.text}))]})),(0,r.BX)("div",nt({css:{display:"flex",alignItems:"center",gap:"8px",padding:"12px 16px",borderTop:"1px solid ".concat(C),backgroundColor:_}},{children:[(0,r.tZ)("input",{type:"text",value:me,onChange:function(e){return be(e.target.value)},onKeyDown:function(e){"Enter"!==e.key||e.shiftKey||(e.preventDefault(),e.stopPropagation(),At())},placeholder:"Type a message...",css:{flex:1,padding:"10px 14px",border:"1px solid ".concat(C),borderRadius:"8px",fontSize:"14px",outline:"none",transition:"border-color 0.2s",":focus":{borderColor:Je.primary}}}),(0,r.tZ)("button",nt({type:"button",onClick:At,disabled:Ct||!me.trim(),css:{padding:"10px",backgroundColor:Je.primary,color:"white",border:"none",borderRadius:"8px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"background-color 0.2s",":hover:not(:disabled)":{backgroundColor:Je.hover},":disabled":{backgroundColor:Je.disabled,cursor:"not-allowed"}}},{children:(0,r.tZ)(c,{})}))]}))]}))}}}]);
|