@kelet-ai/feedback-ui 1.1.1 → 1.1.4
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/README.md +70 -70
- package/dist/components/vote-feedback.d.ts +1 -1
- package/dist/feedback-ui.es.js +275 -264
- package/dist/feedback-ui.es.js.map +1 -1
- package/dist/feedback-ui.es.min.js +808 -795
- package/dist/feedback-ui.es.min.js.map +1 -1
- package/dist/feedback-ui.umd.js +275 -264
- package/dist/feedback-ui.umd.js.map +1 -1
- package/dist/feedback-ui.umd.min.js +11 -11
- package/dist/feedback-ui.umd.min.js.map +1 -1
- package/dist/hooks/feedback-state/diff-utils.d.ts +1 -1
- package/dist/hooks/feedback-state/types.d.ts +5 -5
- package/dist/types/index.d.ts +16 -9
- package/package.json +2 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Ne, { createContext as
|
|
1
|
+
import Ne, { createContext as Pe, useEffect as ce, useContext as le, useCallback as q, isValidElement as Q, cloneElement as ee, useState as X, useRef as Y, useId as de } from "react";
|
|
2
2
|
function je(t) {
|
|
3
3
|
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
4
4
|
}
|
|
@@ -41,24 +41,24 @@ function Ie() {
|
|
|
41
41
|
if (pe) return V;
|
|
42
42
|
pe = 1;
|
|
43
43
|
var t = Symbol.for("react.transitional.element"), e = Symbol.for("react.fragment");
|
|
44
|
-
function n(r, o,
|
|
45
|
-
var
|
|
46
|
-
if (
|
|
47
|
-
|
|
48
|
-
for (var
|
|
49
|
-
|
|
50
|
-
} else
|
|
51
|
-
return o =
|
|
44
|
+
function n(r, o, d) {
|
|
45
|
+
var f = null;
|
|
46
|
+
if (d !== void 0 && (f = "" + d), o.key !== void 0 && (f = "" + o.key), "key" in o) {
|
|
47
|
+
d = {};
|
|
48
|
+
for (var l in o)
|
|
49
|
+
l !== "key" && (d[l] = o[l]);
|
|
50
|
+
} else d = o;
|
|
51
|
+
return o = d.ref, {
|
|
52
52
|
$$typeof: t,
|
|
53
53
|
type: r,
|
|
54
|
-
key:
|
|
54
|
+
key: f,
|
|
55
55
|
ref: o !== void 0 ? o : null,
|
|
56
|
-
props:
|
|
56
|
+
props: d
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
59
|
return V.Fragment = e, V.jsx = n, V.jsxs = n, V;
|
|
60
60
|
}
|
|
61
|
-
var
|
|
61
|
+
var G = {};
|
|
62
62
|
/**
|
|
63
63
|
* @license React
|
|
64
64
|
* react-jsx-runtime.development.js
|
|
@@ -77,38 +77,38 @@ function Le() {
|
|
|
77
77
|
return a.$$typeof === s ? null : a.displayName || a.name || null;
|
|
78
78
|
if (typeof a == "string") return a;
|
|
79
79
|
switch (a) {
|
|
80
|
-
case
|
|
80
|
+
case k:
|
|
81
81
|
return "Fragment";
|
|
82
82
|
case A:
|
|
83
83
|
return "Profiler";
|
|
84
|
-
case
|
|
84
|
+
case O:
|
|
85
85
|
return "StrictMode";
|
|
86
|
-
case
|
|
86
|
+
case _:
|
|
87
87
|
return "Suspense";
|
|
88
|
-
case
|
|
88
|
+
case N:
|
|
89
89
|
return "SuspenseList";
|
|
90
|
-
case
|
|
90
|
+
case u:
|
|
91
91
|
return "Activity";
|
|
92
92
|
}
|
|
93
93
|
if (typeof a == "object")
|
|
94
94
|
switch (typeof a.tag == "number" && console.error(
|
|
95
95
|
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
96
96
|
), a.$$typeof) {
|
|
97
|
-
case
|
|
97
|
+
case p:
|
|
98
98
|
return "Portal";
|
|
99
|
-
case
|
|
99
|
+
case T:
|
|
100
100
|
return (a.displayName || "Context") + ".Provider";
|
|
101
|
-
case
|
|
101
|
+
case m:
|
|
102
102
|
return (a._context.displayName || "Context") + ".Consumer";
|
|
103
|
-
case
|
|
104
|
-
var
|
|
105
|
-
return a = a.displayName, a || (a =
|
|
106
|
-
case
|
|
107
|
-
return
|
|
103
|
+
case R:
|
|
104
|
+
var C = a.render;
|
|
105
|
+
return a = a.displayName, a || (a = C.displayName || C.name || "", a = a !== "" ? "ForwardRef(" + a + ")" : "ForwardRef"), a;
|
|
106
|
+
case I:
|
|
107
|
+
return C = a.displayName || null, C !== null ? C : t(a.type) || "Memo";
|
|
108
108
|
case i:
|
|
109
|
-
|
|
109
|
+
C = a._payload, a = a._init;
|
|
110
110
|
try {
|
|
111
|
-
return t(a(
|
|
111
|
+
return t(a(C));
|
|
112
112
|
} catch {
|
|
113
113
|
}
|
|
114
114
|
}
|
|
@@ -120,73 +120,73 @@ function Le() {
|
|
|
120
120
|
function n(a) {
|
|
121
121
|
try {
|
|
122
122
|
e(a);
|
|
123
|
-
var
|
|
123
|
+
var C = !1;
|
|
124
124
|
} catch {
|
|
125
|
-
|
|
125
|
+
C = !0;
|
|
126
126
|
}
|
|
127
|
-
if (
|
|
128
|
-
|
|
129
|
-
var
|
|
130
|
-
return
|
|
131
|
-
|
|
127
|
+
if (C) {
|
|
128
|
+
C = console;
|
|
129
|
+
var D = C.error, S = typeof Symbol == "function" && Symbol.toStringTag && a[Symbol.toStringTag] || a.constructor.name || "Object";
|
|
130
|
+
return D.call(
|
|
131
|
+
C,
|
|
132
132
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
133
|
-
|
|
133
|
+
S
|
|
134
134
|
), e(a);
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
function r(a) {
|
|
138
|
-
if (a ===
|
|
138
|
+
if (a === k) return "<>";
|
|
139
139
|
if (typeof a == "object" && a !== null && a.$$typeof === i)
|
|
140
140
|
return "<...>";
|
|
141
141
|
try {
|
|
142
|
-
var
|
|
143
|
-
return
|
|
142
|
+
var C = t(a);
|
|
143
|
+
return C ? "<" + C + ">" : "<...>";
|
|
144
144
|
} catch {
|
|
145
145
|
return "<...>";
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
function o() {
|
|
149
|
-
var a =
|
|
149
|
+
var a = v.A;
|
|
150
150
|
return a === null ? null : a.getOwner();
|
|
151
151
|
}
|
|
152
|
-
function
|
|
152
|
+
function d() {
|
|
153
153
|
return Error("react-stack-top-frame");
|
|
154
154
|
}
|
|
155
|
-
function
|
|
156
|
-
if (
|
|
157
|
-
var
|
|
158
|
-
if (
|
|
155
|
+
function f(a) {
|
|
156
|
+
if (y.call(a, "key")) {
|
|
157
|
+
var C = Object.getOwnPropertyDescriptor(a, "key").get;
|
|
158
|
+
if (C && C.isReactWarning) return !1;
|
|
159
159
|
}
|
|
160
160
|
return a.key !== void 0;
|
|
161
161
|
}
|
|
162
|
-
function
|
|
163
|
-
function
|
|
162
|
+
function l(a, C) {
|
|
163
|
+
function D() {
|
|
164
164
|
M || (M = !0, console.error(
|
|
165
165
|
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
166
|
-
|
|
166
|
+
C
|
|
167
167
|
));
|
|
168
168
|
}
|
|
169
|
-
|
|
170
|
-
get:
|
|
169
|
+
D.isReactWarning = !0, Object.defineProperty(a, "key", {
|
|
170
|
+
get: D,
|
|
171
171
|
configurable: !0
|
|
172
172
|
});
|
|
173
173
|
}
|
|
174
|
-
function
|
|
174
|
+
function c() {
|
|
175
175
|
var a = t(this.type);
|
|
176
|
-
return
|
|
176
|
+
return j[a] || (j[a] = !0, console.error(
|
|
177
177
|
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
178
178
|
)), a = this.props.ref, a !== void 0 ? a : null;
|
|
179
179
|
}
|
|
180
|
-
function
|
|
181
|
-
return
|
|
182
|
-
$$typeof:
|
|
180
|
+
function h(a, C, D, S, W, $, B, U) {
|
|
181
|
+
return D = $.ref, a = {
|
|
182
|
+
$$typeof: x,
|
|
183
183
|
type: a,
|
|
184
|
-
key:
|
|
184
|
+
key: C,
|
|
185
185
|
props: $,
|
|
186
186
|
_owner: W
|
|
187
|
-
}, (
|
|
187
|
+
}, (D !== void 0 ? D : null) !== null ? Object.defineProperty(a, "ref", {
|
|
188
188
|
enumerable: !1,
|
|
189
|
-
get:
|
|
189
|
+
get: c
|
|
190
190
|
}) : Object.defineProperty(a, "ref", { enumerable: !1, value: null }), a._store = {}, Object.defineProperty(a._store, "validated", {
|
|
191
191
|
configurable: !1,
|
|
192
192
|
enumerable: !1,
|
|
@@ -206,100 +206,100 @@ function Le() {
|
|
|
206
206
|
configurable: !1,
|
|
207
207
|
enumerable: !1,
|
|
208
208
|
writable: !0,
|
|
209
|
-
value:
|
|
209
|
+
value: U
|
|
210
210
|
}), Object.freeze && (Object.freeze(a.props), Object.freeze(a)), a;
|
|
211
211
|
}
|
|
212
|
-
function
|
|
213
|
-
var
|
|
214
|
-
if (
|
|
215
|
-
if (
|
|
216
|
-
if (
|
|
217
|
-
for (
|
|
218
|
-
|
|
219
|
-
Object.freeze && Object.freeze(
|
|
212
|
+
function b(a, C, D, S, W, $, B, U) {
|
|
213
|
+
var L = C.children;
|
|
214
|
+
if (L !== void 0)
|
|
215
|
+
if (S)
|
|
216
|
+
if (g(L)) {
|
|
217
|
+
for (S = 0; S < L.length; S++)
|
|
218
|
+
P(L[S]);
|
|
219
|
+
Object.freeze && Object.freeze(L);
|
|
220
220
|
} else
|
|
221
221
|
console.error(
|
|
222
222
|
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
223
223
|
);
|
|
224
|
-
else
|
|
225
|
-
if (
|
|
226
|
-
|
|
227
|
-
var z = Object.keys(
|
|
228
|
-
return
|
|
224
|
+
else P(L);
|
|
225
|
+
if (y.call(C, "key")) {
|
|
226
|
+
L = t(a);
|
|
227
|
+
var z = Object.keys(C).filter(function(De) {
|
|
228
|
+
return De !== "key";
|
|
229
229
|
});
|
|
230
|
-
|
|
230
|
+
S = 0 < z.length ? "{key: someKey, " + z.join(": ..., ") + ": ...}" : "{key: someKey}", re[L + S] || (z = 0 < z.length ? "{" + z.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
231
231
|
`A props object containing a "key" prop is being spread into JSX:
|
|
232
232
|
let props = %s;
|
|
233
233
|
<%s {...props} />
|
|
234
234
|
React keys must be passed directly to JSX without using spread:
|
|
235
235
|
let props = %s;
|
|
236
236
|
<%s key={someKey} {...props} />`,
|
|
237
|
-
|
|
238
|
-
|
|
237
|
+
S,
|
|
238
|
+
L,
|
|
239
239
|
z,
|
|
240
|
-
|
|
241
|
-
), re[
|
|
240
|
+
L
|
|
241
|
+
), re[L + S] = !0);
|
|
242
242
|
}
|
|
243
|
-
if (
|
|
244
|
-
|
|
245
|
-
for (var ue in
|
|
246
|
-
ue !== "key" && (
|
|
247
|
-
} else
|
|
248
|
-
return
|
|
249
|
-
|
|
243
|
+
if (L = null, D !== void 0 && (n(D), L = "" + D), f(C) && (n(C.key), L = "" + C.key), "key" in C) {
|
|
244
|
+
D = {};
|
|
245
|
+
for (var ue in C)
|
|
246
|
+
ue !== "key" && (D[ue] = C[ue]);
|
|
247
|
+
} else D = C;
|
|
248
|
+
return L && l(
|
|
249
|
+
D,
|
|
250
250
|
typeof a == "function" ? a.displayName || a.name || "Unknown" : a
|
|
251
|
-
),
|
|
251
|
+
), h(
|
|
252
252
|
a,
|
|
253
|
-
|
|
253
|
+
L,
|
|
254
254
|
$,
|
|
255
255
|
W,
|
|
256
256
|
o(),
|
|
257
|
-
|
|
257
|
+
D,
|
|
258
258
|
B,
|
|
259
|
-
|
|
259
|
+
U
|
|
260
260
|
);
|
|
261
261
|
}
|
|
262
|
-
function
|
|
263
|
-
typeof a == "object" && a !== null && a.$$typeof ===
|
|
262
|
+
function P(a) {
|
|
263
|
+
typeof a == "object" && a !== null && a.$$typeof === x && a._store && (a._store.validated = 1);
|
|
264
264
|
}
|
|
265
|
-
var
|
|
265
|
+
var E = Ne, x = Symbol.for("react.transitional.element"), p = Symbol.for("react.portal"), k = Symbol.for("react.fragment"), O = Symbol.for("react.strict_mode"), A = Symbol.for("react.profiler"), m = Symbol.for("react.consumer"), T = Symbol.for("react.context"), R = Symbol.for("react.forward_ref"), _ = Symbol.for("react.suspense"), N = Symbol.for("react.suspense_list"), I = Symbol.for("react.memo"), i = Symbol.for("react.lazy"), u = Symbol.for("react.activity"), s = Symbol.for("react.client.reference"), v = E.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, y = Object.prototype.hasOwnProperty, g = Array.isArray, w = console.createTask ? console.createTask : function() {
|
|
266
266
|
return null;
|
|
267
267
|
};
|
|
268
|
-
|
|
268
|
+
E = {
|
|
269
269
|
react_stack_bottom_frame: function(a) {
|
|
270
270
|
return a();
|
|
271
271
|
}
|
|
272
272
|
};
|
|
273
|
-
var M,
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
)(), J =
|
|
277
|
-
|
|
278
|
-
var $ = 1e4 >
|
|
279
|
-
return
|
|
273
|
+
var M, j = {}, H = E.react_stack_bottom_frame.bind(
|
|
274
|
+
E,
|
|
275
|
+
d
|
|
276
|
+
)(), J = w(r(d)), re = {};
|
|
277
|
+
G.Fragment = k, G.jsx = function(a, C, D, S, W) {
|
|
278
|
+
var $ = 1e4 > v.recentlyCreatedOwnerStacks++;
|
|
279
|
+
return b(
|
|
280
280
|
a,
|
|
281
|
-
|
|
282
|
-
|
|
281
|
+
C,
|
|
282
|
+
D,
|
|
283
283
|
!1,
|
|
284
|
-
|
|
284
|
+
S,
|
|
285
285
|
W,
|
|
286
|
-
$ ? Error("react-stack-top-frame") :
|
|
287
|
-
$ ?
|
|
286
|
+
$ ? Error("react-stack-top-frame") : H,
|
|
287
|
+
$ ? w(r(a)) : J
|
|
288
288
|
);
|
|
289
|
-
},
|
|
290
|
-
var $ = 1e4 >
|
|
291
|
-
return
|
|
289
|
+
}, G.jsxs = function(a, C, D, S, W) {
|
|
290
|
+
var $ = 1e4 > v.recentlyCreatedOwnerStacks++;
|
|
291
|
+
return b(
|
|
292
292
|
a,
|
|
293
|
-
|
|
294
|
-
|
|
293
|
+
C,
|
|
294
|
+
D,
|
|
295
295
|
!0,
|
|
296
|
-
|
|
296
|
+
S,
|
|
297
297
|
W,
|
|
298
|
-
$ ? Error("react-stack-top-frame") :
|
|
299
|
-
$ ?
|
|
298
|
+
$ ? Error("react-stack-top-frame") : H,
|
|
299
|
+
$ ? w(r(a)) : J
|
|
300
300
|
);
|
|
301
301
|
};
|
|
302
|
-
}()),
|
|
302
|
+
}()), G;
|
|
303
303
|
}
|
|
304
304
|
var me;
|
|
305
305
|
function Fe() {
|
|
@@ -314,20 +314,20 @@ function Me(t) {
|
|
|
314
314
|
const n = e.getAttribute("data-feedback-id");
|
|
315
315
|
if (n) return `[data-feedback-id="${n}"]`;
|
|
316
316
|
const r = [];
|
|
317
|
-
let o = e,
|
|
318
|
-
const
|
|
319
|
-
for (; o && o !== document.body &&
|
|
320
|
-
let
|
|
317
|
+
let o = e, d = 0;
|
|
318
|
+
const f = 5;
|
|
319
|
+
for (; o && o !== document.body && d < f; ) {
|
|
320
|
+
let l = o.tagName.toLowerCase();
|
|
321
321
|
if (o.classList.length > 0) {
|
|
322
|
-
const
|
|
323
|
-
|
|
322
|
+
const h = Array.from(o.classList)[0];
|
|
323
|
+
l += `.${h}`;
|
|
324
324
|
}
|
|
325
|
-
const
|
|
326
|
-
if (
|
|
327
|
-
const
|
|
328
|
-
|
|
325
|
+
const c = o.parentElement;
|
|
326
|
+
if (c) {
|
|
327
|
+
const h = Array.from(c.children), b = h.indexOf(o) + 1;
|
|
328
|
+
h.length > 1 && (l += `:nth-child(${b})`);
|
|
329
329
|
}
|
|
330
|
-
r.unshift(
|
|
330
|
+
r.unshift(l), o = c, d++;
|
|
331
331
|
}
|
|
332
332
|
return r.join(" > ");
|
|
333
333
|
}
|
|
@@ -365,7 +365,7 @@ function qe() {
|
|
|
365
365
|
function ze() {
|
|
366
366
|
return Z ? Date.now() - Z.timestamp > 1e4 ? (Z = null, null) : { ...Z } : null;
|
|
367
367
|
}
|
|
368
|
-
const ae =
|
|
368
|
+
const ae = Pe(null), Ye = "https://api.kelet.ai", gt = () => {
|
|
369
369
|
const t = le(ae);
|
|
370
370
|
if (!t)
|
|
371
371
|
throw new Error("useKelet must be used within a KeletProvider");
|
|
@@ -380,53 +380,55 @@ const ae = xe(null), Ye = "https://api.kelet.ai/api", gt = () => {
|
|
|
380
380
|
ce(() => {
|
|
381
381
|
qe();
|
|
382
382
|
}, []);
|
|
383
|
-
const o = le(ae),
|
|
384
|
-
if (!
|
|
383
|
+
const o = le(ae), d = t || o?.api_key;
|
|
384
|
+
if (!d)
|
|
385
385
|
throw new Error(
|
|
386
386
|
"apiKey is required either directly or from a parent KeletProvider"
|
|
387
387
|
);
|
|
388
|
+
let f = n || Ye;
|
|
389
|
+
f.endsWith("/api") && (f = f.slice(0, -4)), f.endsWith("/") && (f = f.slice(0, -1));
|
|
388
390
|
const c = {
|
|
389
|
-
api_key:
|
|
391
|
+
api_key: d,
|
|
390
392
|
project: e,
|
|
391
|
-
feedback: async (
|
|
392
|
-
const
|
|
393
|
-
...
|
|
394
|
-
...
|
|
395
|
-
},
|
|
396
|
-
session_id:
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
metadata: Object.keys(
|
|
404
|
-
|
|
393
|
+
feedback: async (h) => {
|
|
394
|
+
const b = `${f}/api/projects/${e}/signal`, P = ze(), E = {
|
|
395
|
+
...h.metadata ?? {},
|
|
396
|
+
...P && { $dom_event: P }
|
|
397
|
+
}, x = {
|
|
398
|
+
session_id: h.session_id,
|
|
399
|
+
kind: h.kind,
|
|
400
|
+
source: h.source,
|
|
401
|
+
trigger_name: h.trigger_name,
|
|
402
|
+
score: h.score,
|
|
403
|
+
value: h.value,
|
|
404
|
+
confidence: h.confidence,
|
|
405
|
+
metadata: Object.keys(E).length > 0 ? E : void 0,
|
|
406
|
+
timestamp: h.timestamp || (/* @__PURE__ */ new Date()).toISOString(),
|
|
407
|
+
trace_id: h.trace_id
|
|
408
|
+
}, p = await fetch(b, {
|
|
405
409
|
method: "POST",
|
|
406
410
|
headers: {
|
|
407
411
|
"Content-Type": "application/json",
|
|
408
|
-
Authorization: `Bearer ${
|
|
412
|
+
Authorization: `Bearer ${d}`
|
|
409
413
|
},
|
|
410
|
-
body: JSON.stringify(
|
|
414
|
+
body: JSON.stringify(x)
|
|
411
415
|
});
|
|
412
|
-
if (!
|
|
413
|
-
throw new Error(`Failed to submit feedback: ${
|
|
416
|
+
if (!p.ok)
|
|
417
|
+
throw new Error(`Failed to submit feedback: ${p.statusText}`);
|
|
414
418
|
}
|
|
415
419
|
};
|
|
416
420
|
return /* @__PURE__ */ F.jsx(ae.Provider, { value: c, children: r });
|
|
417
421
|
}, te = (t, e) => {
|
|
418
422
|
const n = { ...e };
|
|
419
423
|
for (const r in e) {
|
|
420
|
-
const o = t[r],
|
|
421
|
-
/^on[A-Z]/.test(r) ? o &&
|
|
422
|
-
|
|
423
|
-
} : o && (n[r] = o) : r === "style" ? n[r] = { ...o, ...
|
|
424
|
+
const o = t[r], d = e[r];
|
|
425
|
+
/^on[A-Z]/.test(r) ? o && d ? n[r] = (...l) => {
|
|
426
|
+
d(...l), o(...l);
|
|
427
|
+
} : o && (n[r] = o) : r === "style" ? n[r] = { ...o, ...d } : r === "className" ? n[r] = [o, d].filter(Boolean).join(" ") : n[r] = d !== void 0 ? d : o;
|
|
424
428
|
}
|
|
425
429
|
return { ...t, ...n };
|
|
426
|
-
},
|
|
427
|
-
|
|
428
|
-
), ne = () => {
|
|
429
|
-
const t = le(Ce);
|
|
430
|
+
}, _e = Pe(null), ne = () => {
|
|
431
|
+
const t = le(_e);
|
|
430
432
|
if (!t)
|
|
431
433
|
throw new Error(
|
|
432
434
|
"VoteFeedback components must be used within VoteFeedback.Root"
|
|
@@ -437,145 +439,157 @@ const ae = xe(null), Ye = "https://api.kelet.ai/api", gt = () => {
|
|
|
437
439
|
onFeedback: e,
|
|
438
440
|
defaultText: n = "",
|
|
439
441
|
session_id: r,
|
|
440
|
-
|
|
441
|
-
trigger_name:
|
|
442
|
+
metadata: o,
|
|
443
|
+
trigger_name: d,
|
|
444
|
+
trace_id: f
|
|
442
445
|
}) => {
|
|
443
|
-
const
|
|
446
|
+
const l = typeof r == "function" ? r() : r, c = d || void 0, [h, b] = X(!1), [P, E] = X(n), [x, p] = X(!1), [k, O] = X(null), A = Y(null), m = Y(null), T = de(), R = de(), _ = Te(), N = e || _;
|
|
444
447
|
ce(() => {
|
|
445
|
-
|
|
446
|
-
}, [
|
|
447
|
-
const
|
|
448
|
-
|
|
449
|
-
const
|
|
450
|
-
session_id:
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
448
|
+
b(!1), E(n), p(!1), O(null), setTimeout(() => m.current?.focus(), 0);
|
|
449
|
+
}, [l, n]);
|
|
450
|
+
const I = q(async () => {
|
|
451
|
+
O("upvote");
|
|
452
|
+
const g = {
|
|
453
|
+
session_id: l,
|
|
454
|
+
kind: "feedback",
|
|
455
|
+
source: "human",
|
|
456
|
+
trigger_name: c,
|
|
457
|
+
score: 1,
|
|
458
|
+
...o && { metadata: o },
|
|
459
|
+
...f && { trace_id: f }
|
|
454
460
|
};
|
|
455
461
|
try {
|
|
456
|
-
|
|
462
|
+
p(!0), await N(g);
|
|
457
463
|
} finally {
|
|
458
|
-
|
|
464
|
+
p(!1);
|
|
459
465
|
}
|
|
460
|
-
}, [
|
|
461
|
-
if (
|
|
462
|
-
const
|
|
463
|
-
session_id:
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
466
|
+
}, [N, l, o, c, f]), i = q(async () => {
|
|
467
|
+
if (O("downvote"), N) {
|
|
468
|
+
const g = {
|
|
469
|
+
session_id: l,
|
|
470
|
+
kind: "feedback",
|
|
471
|
+
source: "human",
|
|
472
|
+
trigger_name: c,
|
|
473
|
+
score: 0,
|
|
474
|
+
...o && { metadata: o },
|
|
475
|
+
...f && { trace_id: f }
|
|
467
476
|
};
|
|
468
477
|
try {
|
|
469
|
-
|
|
478
|
+
p(!0), await N(g);
|
|
470
479
|
} finally {
|
|
471
|
-
|
|
480
|
+
p(!1);
|
|
472
481
|
}
|
|
473
482
|
}
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
const
|
|
477
|
-
|
|
483
|
+
b(!0), setTimeout(() => {
|
|
484
|
+
A.current?.focus();
|
|
485
|
+
const g = document.createElement("div");
|
|
486
|
+
g.setAttribute("aria-live", "polite"), g.setAttribute("aria-atomic", "true"), g.className = "sr-only", g.textContent = "Feedback dialog opened. You can provide additional details about your downvote.", document.body.appendChild(g), setTimeout(() => document.body.removeChild(g), 1e3);
|
|
478
487
|
}, 0);
|
|
479
|
-
}, [
|
|
480
|
-
(
|
|
481
|
-
|
|
488
|
+
}, [N, l, o, c, f]), u = q(
|
|
489
|
+
(g) => {
|
|
490
|
+
E(g.target.value);
|
|
482
491
|
},
|
|
483
492
|
[]
|
|
484
|
-
),
|
|
485
|
-
const
|
|
486
|
-
if (
|
|
487
|
-
const
|
|
488
|
-
session_id:
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
+
), s = q(async () => {
|
|
494
|
+
const g = P.trim().length > 0;
|
|
495
|
+
if (g) {
|
|
496
|
+
const w = {
|
|
497
|
+
session_id: l,
|
|
498
|
+
kind: "feedback",
|
|
499
|
+
source: "human",
|
|
500
|
+
trigger_name: c,
|
|
501
|
+
score: 0,
|
|
502
|
+
value: P,
|
|
503
|
+
...o && { metadata: o },
|
|
504
|
+
...f && { trace_id: f }
|
|
493
505
|
};
|
|
494
506
|
try {
|
|
495
|
-
|
|
507
|
+
p(!0), await N(w);
|
|
496
508
|
} finally {
|
|
497
|
-
|
|
509
|
+
p(!1);
|
|
498
510
|
}
|
|
499
511
|
}
|
|
500
|
-
if (
|
|
501
|
-
const
|
|
502
|
-
|
|
512
|
+
if (b(!1), E(n), m.current?.focus(), g) {
|
|
513
|
+
const w = document.createElement("div");
|
|
514
|
+
w.setAttribute("aria-live", "polite"), w.className = "sr-only", w.textContent = "Feedback submitted successfully.", document.body.appendChild(w), setTimeout(() => document.body.removeChild(w), 1e3);
|
|
503
515
|
}
|
|
504
516
|
}, [
|
|
505
|
-
|
|
506
|
-
|
|
517
|
+
N,
|
|
518
|
+
P,
|
|
507
519
|
n,
|
|
508
|
-
|
|
520
|
+
l,
|
|
509
521
|
o,
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
522
|
+
c,
|
|
523
|
+
f
|
|
524
|
+
]), v = q(
|
|
525
|
+
(g) => {
|
|
526
|
+
if (g.key === "Escape")
|
|
527
|
+
b(!1), E(n), m.current?.focus();
|
|
528
|
+
else if ((g.metaKey || g.ctrlKey) && g.key === "Enter")
|
|
529
|
+
g.preventDefault(), s().then((w) => {
|
|
517
530
|
});
|
|
518
|
-
else if (
|
|
519
|
-
const
|
|
520
|
-
if (
|
|
521
|
-
const
|
|
531
|
+
else if (g.key === "Tab" && h) {
|
|
532
|
+
const w = document.getElementById(T);
|
|
533
|
+
if (w) {
|
|
534
|
+
const M = w.querySelectorAll(
|
|
522
535
|
'button, textarea, input, select, a[href], [tabindex]:not([tabindex="-1"])'
|
|
523
|
-
),
|
|
524
|
-
|
|
536
|
+
), j = M[0], H = M[M.length - 1];
|
|
537
|
+
g.shiftKey && document.activeElement === j ? (g.preventDefault(), H?.focus()) : !g.shiftKey && document.activeElement === H && (g.preventDefault(), j?.focus());
|
|
525
538
|
}
|
|
526
539
|
}
|
|
527
540
|
},
|
|
528
|
-
[
|
|
529
|
-
),
|
|
530
|
-
onFeedback:
|
|
531
|
-
showPopover:
|
|
532
|
-
setShowPopover:
|
|
533
|
-
feedbackText:
|
|
534
|
-
setFeedbackText:
|
|
535
|
-
isSubmitting:
|
|
536
|
-
setIsSubmitting:
|
|
541
|
+
[s, h, T, n]
|
|
542
|
+
), y = {
|
|
543
|
+
onFeedback: N,
|
|
544
|
+
showPopover: h,
|
|
545
|
+
setShowPopover: b,
|
|
546
|
+
feedbackText: P,
|
|
547
|
+
setFeedbackText: E,
|
|
548
|
+
isSubmitting: x,
|
|
549
|
+
setIsSubmitting: p,
|
|
537
550
|
vote: k,
|
|
538
|
-
handleUpvote:
|
|
539
|
-
handleDownvote:
|
|
540
|
-
handleTextareaChange:
|
|
541
|
-
handleSubmit:
|
|
542
|
-
handleKeyDown:
|
|
543
|
-
textareaRef:
|
|
544
|
-
triggerRef:
|
|
545
|
-
popoverId:
|
|
546
|
-
triggerId:
|
|
547
|
-
session_id:
|
|
548
|
-
|
|
549
|
-
trigger_name:
|
|
551
|
+
handleUpvote: I,
|
|
552
|
+
handleDownvote: i,
|
|
553
|
+
handleTextareaChange: u,
|
|
554
|
+
handleSubmit: s,
|
|
555
|
+
handleKeyDown: v,
|
|
556
|
+
textareaRef: A,
|
|
557
|
+
triggerRef: m,
|
|
558
|
+
popoverId: T,
|
|
559
|
+
triggerId: R,
|
|
560
|
+
session_id: l,
|
|
561
|
+
metadata: o,
|
|
562
|
+
trigger_name: c,
|
|
563
|
+
trace_id: f
|
|
550
564
|
};
|
|
551
|
-
return /* @__PURE__ */ F.jsx(
|
|
565
|
+
return /* @__PURE__ */ F.jsx(_e.Provider, { value: y, children: t });
|
|
552
566
|
}, Ke = ({
|
|
553
567
|
asChild: t,
|
|
554
568
|
children: e,
|
|
555
569
|
onClick: n,
|
|
556
570
|
...r
|
|
557
571
|
}) => {
|
|
558
|
-
const { handleUpvote: o, isSubmitting:
|
|
559
|
-
(
|
|
560
|
-
o(), n?.(
|
|
572
|
+
const { handleUpvote: o, isSubmitting: d, vote: f } = ne(), l = q(
|
|
573
|
+
(b) => {
|
|
574
|
+
o(), n?.(b);
|
|
561
575
|
},
|
|
562
576
|
[o, n]
|
|
563
|
-
),
|
|
577
|
+
), c = {
|
|
564
578
|
...r,
|
|
565
|
-
onClick:
|
|
566
|
-
disabled:
|
|
579
|
+
onClick: l,
|
|
580
|
+
disabled: d || r.disabled,
|
|
567
581
|
"aria-label": r["aria-label"] || "Upvote feedback",
|
|
568
582
|
type: "button"
|
|
569
|
-
},
|
|
583
|
+
}, h = f === "upvote";
|
|
570
584
|
if (t) {
|
|
571
|
-
const
|
|
572
|
-
if (Q(
|
|
585
|
+
const b = typeof e == "function" ? e({ isSelected: h }) : e;
|
|
586
|
+
if (Q(b))
|
|
573
587
|
return ee(
|
|
574
|
-
|
|
575
|
-
te(
|
|
588
|
+
b,
|
|
589
|
+
te(c, b.props)
|
|
576
590
|
);
|
|
577
591
|
}
|
|
578
|
-
return /* @__PURE__ */ F.jsx("button", { ...
|
|
592
|
+
return /* @__PURE__ */ F.jsx("button", { ...c, children: typeof e == "function" ? e({ isSelected: h }) : e });
|
|
579
593
|
}, Ue = ({
|
|
580
594
|
asChild: t,
|
|
581
595
|
children: e,
|
|
@@ -584,112 +598,112 @@ const ae = xe(null), Ye = "https://api.kelet.ai/api", gt = () => {
|
|
|
584
598
|
}) => {
|
|
585
599
|
const {
|
|
586
600
|
handleDownvote: o,
|
|
587
|
-
showPopover:
|
|
588
|
-
isSubmitting:
|
|
589
|
-
popoverId:
|
|
590
|
-
triggerId:
|
|
591
|
-
triggerRef:
|
|
592
|
-
vote:
|
|
593
|
-
} = ne(),
|
|
594
|
-
(
|
|
595
|
-
o(), n?.(
|
|
601
|
+
showPopover: d,
|
|
602
|
+
isSubmitting: f,
|
|
603
|
+
popoverId: l,
|
|
604
|
+
triggerId: c,
|
|
605
|
+
triggerRef: h,
|
|
606
|
+
vote: b
|
|
607
|
+
} = ne(), P = q(
|
|
608
|
+
(p) => {
|
|
609
|
+
o(), n?.(p);
|
|
596
610
|
},
|
|
597
611
|
[o, n]
|
|
598
|
-
),
|
|
612
|
+
), E = {
|
|
599
613
|
...r,
|
|
600
|
-
ref:
|
|
601
|
-
onClick:
|
|
602
|
-
disabled:
|
|
614
|
+
ref: h,
|
|
615
|
+
onClick: P,
|
|
616
|
+
disabled: f || r.disabled,
|
|
603
617
|
"aria-label": r["aria-label"] || "Downvote feedback",
|
|
604
|
-
"aria-expanded":
|
|
605
|
-
"aria-controls":
|
|
606
|
-
id:
|
|
618
|
+
"aria-expanded": d,
|
|
619
|
+
"aria-controls": l,
|
|
620
|
+
id: c,
|
|
607
621
|
type: "button"
|
|
608
|
-
},
|
|
622
|
+
}, x = b === "downvote";
|
|
609
623
|
if (t) {
|
|
610
|
-
const
|
|
611
|
-
if (Q(
|
|
612
|
-
return ee(
|
|
613
|
-
if (
|
|
614
|
-
return
|
|
624
|
+
const p = typeof e == "function" ? e({ isSelected: x }) : e;
|
|
625
|
+
if (Q(p))
|
|
626
|
+
return ee(p, te(E, p.props));
|
|
627
|
+
if (p)
|
|
628
|
+
return p;
|
|
615
629
|
}
|
|
616
|
-
return /* @__PURE__ */ F.jsx("button", { ...
|
|
630
|
+
return /* @__PURE__ */ F.jsx("button", { ...E, children: typeof e == "function" ? e({ isSelected: x }) : e });
|
|
617
631
|
}, Je = ({ asChild: t, children: e, ...n }) => {
|
|
618
|
-
const { showPopover: r, handleKeyDown: o, popoverId:
|
|
632
|
+
const { showPopover: r, handleKeyDown: o, popoverId: d, triggerId: f } = ne();
|
|
619
633
|
if (!r)
|
|
620
634
|
return null;
|
|
621
|
-
const
|
|
635
|
+
const l = {
|
|
622
636
|
...n,
|
|
623
637
|
role: "dialog",
|
|
624
|
-
"aria-labelledby":
|
|
638
|
+
"aria-labelledby": f,
|
|
625
639
|
"aria-modal": !0,
|
|
626
|
-
"aria-describedby": `${
|
|
627
|
-
id:
|
|
640
|
+
"aria-describedby": `${d}-description`,
|
|
641
|
+
id: d,
|
|
628
642
|
onKeyDown: o,
|
|
629
643
|
tabIndex: -1
|
|
630
644
|
};
|
|
631
645
|
return t && Q(e) ? /* @__PURE__ */ F.jsxs(F.Fragment, { children: [
|
|
632
646
|
ee(
|
|
633
647
|
e,
|
|
634
|
-
te(
|
|
648
|
+
te(l, e.props)
|
|
635
649
|
),
|
|
636
|
-
/* @__PURE__ */ F.jsx("div", { id: `${
|
|
637
|
-
] }) : /* @__PURE__ */ F.jsxs("div", { ...
|
|
638
|
-
/* @__PURE__ */ F.jsx("div", { id: `${
|
|
650
|
+
/* @__PURE__ */ F.jsx("div", { id: `${d}-description`, className: "sr-only", children: "Provide additional feedback for your downvote" })
|
|
651
|
+
] }) : /* @__PURE__ */ F.jsxs("div", { ...l, children: [
|
|
652
|
+
/* @__PURE__ */ F.jsx("div", { id: `${d}-description`, className: "sr-only", children: "Provide additional feedback for your downvote" }),
|
|
639
653
|
e
|
|
640
654
|
] });
|
|
641
655
|
}, Be = ({ asChild: t, value: e, onChange: n, ...r }) => {
|
|
642
656
|
const {
|
|
643
657
|
feedbackText: o,
|
|
644
|
-
handleTextareaChange:
|
|
645
|
-
textareaRef:
|
|
646
|
-
handleKeyDown:
|
|
647
|
-
popoverId:
|
|
648
|
-
} = ne(),
|
|
658
|
+
handleTextareaChange: d,
|
|
659
|
+
textareaRef: f,
|
|
660
|
+
handleKeyDown: l,
|
|
661
|
+
popoverId: c
|
|
662
|
+
} = ne(), h = {
|
|
649
663
|
...r,
|
|
650
|
-
ref:
|
|
664
|
+
ref: f,
|
|
651
665
|
value: e !== void 0 ? e : o,
|
|
652
|
-
onChange: n ||
|
|
653
|
-
onKeyDown:
|
|
666
|
+
onChange: n || d,
|
|
667
|
+
onKeyDown: l,
|
|
654
668
|
placeholder: r.placeholder || "What did we miss?",
|
|
655
669
|
"aria-label": r["aria-label"] || "Additional feedback",
|
|
656
|
-
"aria-describedby": `${
|
|
670
|
+
"aria-describedby": `${c}-help`,
|
|
657
671
|
rows: r.rows || 3
|
|
658
672
|
};
|
|
659
673
|
return t && Q(r.children) ? ee(
|
|
660
674
|
r.children,
|
|
661
|
-
te(
|
|
662
|
-
) : /* @__PURE__ */ F.jsx("textarea", { ...
|
|
675
|
+
te(h, r.children.props)
|
|
676
|
+
) : /* @__PURE__ */ F.jsx("textarea", { ...h });
|
|
663
677
|
}, Ve = ({
|
|
664
678
|
asChild: t,
|
|
665
679
|
children: e,
|
|
666
680
|
onClick: n,
|
|
667
681
|
...r
|
|
668
682
|
}) => {
|
|
669
|
-
const { handleSubmit: o, isSubmitting:
|
|
670
|
-
(
|
|
671
|
-
o(), n?.(
|
|
683
|
+
const { handleSubmit: o, isSubmitting: d, feedbackText: f } = ne(), l = q(
|
|
684
|
+
(P) => {
|
|
685
|
+
o(), n?.(P);
|
|
672
686
|
},
|
|
673
687
|
[o, n]
|
|
674
|
-
),
|
|
688
|
+
), c = f.trim().length > 0, h = c ? "Submit feedback" : "Close without feedback", b = {
|
|
675
689
|
...r,
|
|
676
|
-
onClick:
|
|
677
|
-
disabled:
|
|
690
|
+
onClick: l,
|
|
691
|
+
disabled: d || r.disabled,
|
|
678
692
|
type: "button",
|
|
679
|
-
"aria-label": r["aria-label"] ||
|
|
680
|
-
"aria-describedby":
|
|
693
|
+
"aria-label": r["aria-label"] || h,
|
|
694
|
+
"aria-describedby": c ? void 0 : "submit-help"
|
|
681
695
|
};
|
|
682
696
|
return t && Q(e) ? /* @__PURE__ */ F.jsxs(F.Fragment, { children: [
|
|
683
697
|
ee(
|
|
684
698
|
e,
|
|
685
|
-
te(
|
|
699
|
+
te(b, e.props)
|
|
686
700
|
),
|
|
687
|
-
!
|
|
688
|
-
] }) : /* @__PURE__ */ F.jsxs("button", { ...
|
|
701
|
+
!c && /* @__PURE__ */ F.jsx("span", { id: "submit-help", className: "sr-only", children: "This will close the dialog without submitting feedback" })
|
|
702
|
+
] }) : /* @__PURE__ */ F.jsxs("button", { ...b, children: [
|
|
689
703
|
e,
|
|
690
|
-
!
|
|
704
|
+
!c && /* @__PURE__ */ F.jsx("span", { id: "submit-help", className: "sr-only", children: "This will close the dialog without submitting feedback" })
|
|
691
705
|
] });
|
|
692
|
-
},
|
|
706
|
+
}, kt = {
|
|
693
707
|
Root: He,
|
|
694
708
|
UpvoteButton: Ke,
|
|
695
709
|
DownvoteButton: Ue,
|
|
@@ -697,16 +711,16 @@ const ae = xe(null), Ye = "https://api.kelet.ai/api", gt = () => {
|
|
|
697
711
|
Textarea: Be,
|
|
698
712
|
SubmitButton: Ve
|
|
699
713
|
};
|
|
700
|
-
var se = { exports: {} },
|
|
701
|
-
function
|
|
714
|
+
var se = { exports: {} }, Ge = se.exports, ve;
|
|
715
|
+
function Xe() {
|
|
702
716
|
return ve || (ve = 1, function(t, e) {
|
|
703
717
|
(function(n, r) {
|
|
704
718
|
var o = r(n);
|
|
705
719
|
t.exports = o;
|
|
706
|
-
})(
|
|
720
|
+
})(Ge, function(n) {
|
|
707
721
|
var r = ["N", "E", "A", "D"];
|
|
708
|
-
function o(i,
|
|
709
|
-
i.super_ =
|
|
722
|
+
function o(i, u) {
|
|
723
|
+
i.super_ = u, i.prototype = Object.create(u.prototype, {
|
|
710
724
|
constructor: {
|
|
711
725
|
value: i,
|
|
712
726
|
enumerable: !1,
|
|
@@ -715,281 +729,281 @@ function Ge() {
|
|
|
715
729
|
}
|
|
716
730
|
});
|
|
717
731
|
}
|
|
718
|
-
function
|
|
732
|
+
function d(i, u) {
|
|
719
733
|
Object.defineProperty(this, "kind", {
|
|
720
734
|
value: i,
|
|
721
735
|
enumerable: !0
|
|
722
|
-
}),
|
|
723
|
-
value:
|
|
736
|
+
}), u && u.length && Object.defineProperty(this, "path", {
|
|
737
|
+
value: u,
|
|
724
738
|
enumerable: !0
|
|
725
739
|
});
|
|
726
740
|
}
|
|
727
|
-
function
|
|
728
|
-
|
|
729
|
-
value:
|
|
741
|
+
function f(i, u, s) {
|
|
742
|
+
f.super_.call(this, "E", i), Object.defineProperty(this, "lhs", {
|
|
743
|
+
value: u,
|
|
730
744
|
enumerable: !0
|
|
731
745
|
}), Object.defineProperty(this, "rhs", {
|
|
732
746
|
value: s,
|
|
733
747
|
enumerable: !0
|
|
734
748
|
});
|
|
735
749
|
}
|
|
736
|
-
o(
|
|
737
|
-
function
|
|
738
|
-
|
|
739
|
-
value:
|
|
750
|
+
o(f, d);
|
|
751
|
+
function l(i, u) {
|
|
752
|
+
l.super_.call(this, "N", i), Object.defineProperty(this, "rhs", {
|
|
753
|
+
value: u,
|
|
740
754
|
enumerable: !0
|
|
741
755
|
});
|
|
742
756
|
}
|
|
743
|
-
o(
|
|
744
|
-
function
|
|
745
|
-
|
|
746
|
-
value:
|
|
757
|
+
o(l, d);
|
|
758
|
+
function c(i, u) {
|
|
759
|
+
c.super_.call(this, "D", i), Object.defineProperty(this, "lhs", {
|
|
760
|
+
value: u,
|
|
747
761
|
enumerable: !0
|
|
748
762
|
});
|
|
749
763
|
}
|
|
750
|
-
o(
|
|
751
|
-
function
|
|
752
|
-
|
|
753
|
-
value:
|
|
764
|
+
o(c, d);
|
|
765
|
+
function h(i, u, s) {
|
|
766
|
+
h.super_.call(this, "A", i), Object.defineProperty(this, "index", {
|
|
767
|
+
value: u,
|
|
754
768
|
enumerable: !0
|
|
755
769
|
}), Object.defineProperty(this, "item", {
|
|
756
770
|
value: s,
|
|
757
771
|
enumerable: !0
|
|
758
772
|
});
|
|
759
773
|
}
|
|
760
|
-
o(
|
|
761
|
-
function
|
|
762
|
-
var
|
|
763
|
-
return i.length =
|
|
774
|
+
o(h, d);
|
|
775
|
+
function b(i, u, s) {
|
|
776
|
+
var v = i.slice(u + 1 || i.length);
|
|
777
|
+
return i.length = u < 0 ? i.length + u : u, i.push.apply(i, v), i;
|
|
764
778
|
}
|
|
765
|
-
function
|
|
766
|
-
var
|
|
767
|
-
return
|
|
779
|
+
function P(i) {
|
|
780
|
+
var u = typeof i;
|
|
781
|
+
return u !== "object" ? u : i === Math ? "math" : i === null ? "null" : Array.isArray(i) ? "array" : Object.prototype.toString.call(i) === "[object Date]" ? "date" : typeof i.toString == "function" && /^\/.*\//.test(i.toString()) ? "regexp" : "object";
|
|
768
782
|
}
|
|
769
|
-
function
|
|
770
|
-
var
|
|
783
|
+
function E(i) {
|
|
784
|
+
var u = 0;
|
|
771
785
|
if (i.length === 0)
|
|
772
|
-
return
|
|
786
|
+
return u;
|
|
773
787
|
for (var s = 0; s < i.length; s++) {
|
|
774
|
-
var
|
|
775
|
-
|
|
788
|
+
var v = i.charCodeAt(s);
|
|
789
|
+
u = (u << 5) - u + v, u = u & u;
|
|
776
790
|
}
|
|
777
|
-
return
|
|
791
|
+
return u;
|
|
778
792
|
}
|
|
779
|
-
function
|
|
780
|
-
var
|
|
793
|
+
function x(i) {
|
|
794
|
+
var u = 0, s = P(i);
|
|
781
795
|
if (s === "array") {
|
|
782
796
|
i.forEach(function(M) {
|
|
783
|
-
|
|
797
|
+
u += x(M);
|
|
784
798
|
});
|
|
785
|
-
var
|
|
786
|
-
return
|
|
799
|
+
var v = "[type: array, hash: " + u + "]";
|
|
800
|
+
return u + E(v);
|
|
787
801
|
}
|
|
788
802
|
if (s === "object") {
|
|
789
|
-
for (var
|
|
790
|
-
if (i.hasOwnProperty(
|
|
791
|
-
var
|
|
792
|
-
|
|
803
|
+
for (var y in i)
|
|
804
|
+
if (i.hasOwnProperty(y)) {
|
|
805
|
+
var g = "[ type: object, key: " + y + ", value hash: " + x(i[y]) + "]";
|
|
806
|
+
u += E(g);
|
|
793
807
|
}
|
|
794
|
-
return
|
|
808
|
+
return u;
|
|
795
809
|
}
|
|
796
|
-
var
|
|
797
|
-
return
|
|
810
|
+
var w = "[ type: " + s + " ; value: " + i + "]";
|
|
811
|
+
return u + E(w);
|
|
798
812
|
}
|
|
799
|
-
function
|
|
800
|
-
s = s || [],
|
|
801
|
-
var
|
|
802
|
-
if (typeof
|
|
803
|
-
if (
|
|
804
|
-
if (typeof
|
|
813
|
+
function p(i, u, s, v, y, g, w, M) {
|
|
814
|
+
s = s || [], y = y || [], w = w || [];
|
|
815
|
+
var j = y.slice(0);
|
|
816
|
+
if (typeof g < "u" && g !== null) {
|
|
817
|
+
if (v) {
|
|
818
|
+
if (typeof v == "function" && v(j, g))
|
|
805
819
|
return;
|
|
806
|
-
if (typeof
|
|
807
|
-
if (
|
|
820
|
+
if (typeof v == "object") {
|
|
821
|
+
if (v.prefilter && v.prefilter(j, g))
|
|
808
822
|
return;
|
|
809
|
-
if (
|
|
810
|
-
var
|
|
811
|
-
|
|
823
|
+
if (v.normalize) {
|
|
824
|
+
var H = v.normalize(j, g, i, u);
|
|
825
|
+
H && (i = H[0], u = H[1]);
|
|
812
826
|
}
|
|
813
827
|
}
|
|
814
828
|
}
|
|
815
|
-
|
|
829
|
+
j.push(g);
|
|
816
830
|
}
|
|
817
|
-
|
|
818
|
-
var J = typeof i, re = typeof
|
|
831
|
+
P(i) === "regexp" && P(u) === "regexp" && (i = i.toString(), u = u.toString());
|
|
832
|
+
var J = typeof i, re = typeof u, a, C, D, S, W = J !== "undefined" || w && w.length > 0 && w[w.length - 1].lhs && Object.getOwnPropertyDescriptor(w[w.length - 1].lhs, g), $ = re !== "undefined" || w && w.length > 0 && w[w.length - 1].rhs && Object.getOwnPropertyDescriptor(w[w.length - 1].rhs, g);
|
|
819
833
|
if (!W && $)
|
|
820
|
-
s.push(new
|
|
834
|
+
s.push(new l(j, u));
|
|
821
835
|
else if (!$ && W)
|
|
822
|
-
s.push(new
|
|
823
|
-
else if (
|
|
824
|
-
s.push(new
|
|
825
|
-
else if (
|
|
826
|
-
s.push(new
|
|
827
|
-
else if (J === "object" && i !== null &&
|
|
828
|
-
for (a =
|
|
829
|
-
if (
|
|
830
|
-
|
|
836
|
+
s.push(new c(j, i));
|
|
837
|
+
else if (P(i) !== P(u))
|
|
838
|
+
s.push(new f(j, i, u));
|
|
839
|
+
else if (P(i) === "date" && i - u !== 0)
|
|
840
|
+
s.push(new f(j, i, u));
|
|
841
|
+
else if (J === "object" && i !== null && u !== null) {
|
|
842
|
+
for (a = w.length - 1; a > -1; --a)
|
|
843
|
+
if (w[a].lhs === i) {
|
|
844
|
+
S = !0;
|
|
831
845
|
break;
|
|
832
846
|
}
|
|
833
|
-
if (
|
|
834
|
-
i !==
|
|
847
|
+
if (S)
|
|
848
|
+
i !== u && s.push(new f(j, i, u));
|
|
835
849
|
else {
|
|
836
|
-
if (
|
|
837
|
-
for (M && (i.sort(function(
|
|
838
|
-
return
|
|
839
|
-
}),
|
|
840
|
-
return
|
|
841
|
-
})), a =
|
|
842
|
-
s.push(new
|
|
843
|
-
for (;
|
|
844
|
-
s.push(new
|
|
850
|
+
if (w.push({ lhs: i, rhs: u }), Array.isArray(i)) {
|
|
851
|
+
for (M && (i.sort(function(L, z) {
|
|
852
|
+
return x(L) - x(z);
|
|
853
|
+
}), u.sort(function(L, z) {
|
|
854
|
+
return x(L) - x(z);
|
|
855
|
+
})), a = u.length - 1, C = i.length - 1; a > C; )
|
|
856
|
+
s.push(new h(j, a, new l(void 0, u[a--])));
|
|
857
|
+
for (; C > a; )
|
|
858
|
+
s.push(new h(j, C, new c(void 0, i[C--])));
|
|
845
859
|
for (; a >= 0; --a)
|
|
846
|
-
|
|
860
|
+
p(i[a], u[a], s, v, j, a, w, M);
|
|
847
861
|
} else {
|
|
848
|
-
var B = Object.keys(i),
|
|
862
|
+
var B = Object.keys(i), U = Object.keys(u);
|
|
849
863
|
for (a = 0; a < B.length; ++a)
|
|
850
|
-
|
|
851
|
-
for (a = 0; a <
|
|
852
|
-
|
|
864
|
+
D = B[a], S = U.indexOf(D), S >= 0 ? (p(i[D], u[D], s, v, j, D, w, M), U[S] = null) : p(i[D], void 0, s, v, j, D, w, M);
|
|
865
|
+
for (a = 0; a < U.length; ++a)
|
|
866
|
+
D = U[a], D && p(void 0, u[D], s, v, j, D, w, M);
|
|
853
867
|
}
|
|
854
|
-
|
|
868
|
+
w.length = w.length - 1;
|
|
855
869
|
}
|
|
856
|
-
} else i !==
|
|
870
|
+
} else i !== u && (J === "number" && isNaN(i) && isNaN(u) || s.push(new f(j, i, u)));
|
|
857
871
|
}
|
|
858
|
-
function
|
|
859
|
-
var
|
|
860
|
-
if (
|
|
861
|
-
for (var
|
|
862
|
-
s(
|
|
863
|
-
return
|
|
872
|
+
function k(i, u, s, v, y) {
|
|
873
|
+
var g = [];
|
|
874
|
+
if (p(i, u, g, v, null, null, null, y), s)
|
|
875
|
+
for (var w = 0; w < g.length; ++w)
|
|
876
|
+
s(g[w]);
|
|
877
|
+
return g;
|
|
864
878
|
}
|
|
865
|
-
function
|
|
866
|
-
return
|
|
879
|
+
function O(i, u, s, v, y, g, w) {
|
|
880
|
+
return p(i, u, s, v, y, g, w, !0);
|
|
867
881
|
}
|
|
868
|
-
function A(i,
|
|
869
|
-
var
|
|
870
|
-
|
|
871
|
-
} : void 0,
|
|
872
|
-
return
|
|
882
|
+
function A(i, u, s, v) {
|
|
883
|
+
var y = v ? function(w) {
|
|
884
|
+
w && v.push(w);
|
|
885
|
+
} : void 0, g = k(i, u, y, s);
|
|
886
|
+
return v || (g.length ? g : void 0);
|
|
873
887
|
}
|
|
874
|
-
function
|
|
875
|
-
var
|
|
876
|
-
|
|
877
|
-
} : void 0,
|
|
878
|
-
return
|
|
888
|
+
function m(i, u, s, v) {
|
|
889
|
+
var y = v ? function(w) {
|
|
890
|
+
w && v.push(w);
|
|
891
|
+
} : void 0, g = k(i, u, y, s, !0);
|
|
892
|
+
return v || (g.length ? g : void 0);
|
|
879
893
|
}
|
|
880
|
-
function
|
|
894
|
+
function T(i, u, s) {
|
|
881
895
|
if (s.path && s.path.length) {
|
|
882
|
-
var
|
|
883
|
-
for (
|
|
884
|
-
|
|
896
|
+
var v = i[u], y, g = s.path.length - 1;
|
|
897
|
+
for (y = 0; y < g; y++)
|
|
898
|
+
v = v[s.path[y]];
|
|
885
899
|
switch (s.kind) {
|
|
886
900
|
case "A":
|
|
887
|
-
|
|
901
|
+
T(v[s.path[y]], s.index, s.item);
|
|
888
902
|
break;
|
|
889
903
|
case "D":
|
|
890
|
-
delete
|
|
904
|
+
delete v[s.path[y]];
|
|
891
905
|
break;
|
|
892
906
|
case "E":
|
|
893
907
|
case "N":
|
|
894
|
-
|
|
908
|
+
v[s.path[y]] = s.rhs;
|
|
895
909
|
break;
|
|
896
910
|
}
|
|
897
911
|
} else
|
|
898
912
|
switch (s.kind) {
|
|
899
913
|
case "A":
|
|
900
|
-
|
|
914
|
+
T(i[u], s.index, s.item);
|
|
901
915
|
break;
|
|
902
916
|
case "D":
|
|
903
|
-
i =
|
|
917
|
+
i = b(i, u);
|
|
904
918
|
break;
|
|
905
919
|
case "E":
|
|
906
920
|
case "N":
|
|
907
|
-
i[
|
|
921
|
+
i[u] = s.rhs;
|
|
908
922
|
break;
|
|
909
923
|
}
|
|
910
924
|
return i;
|
|
911
925
|
}
|
|
912
|
-
function
|
|
913
|
-
if (typeof s > "u" &&
|
|
914
|
-
for (var
|
|
915
|
-
typeof
|
|
926
|
+
function R(i, u, s) {
|
|
927
|
+
if (typeof s > "u" && u && ~r.indexOf(u.kind) && (s = u), i && s && s.kind) {
|
|
928
|
+
for (var v = i, y = -1, g = s.path ? s.path.length - 1 : 0; ++y < g; )
|
|
929
|
+
typeof v[s.path[y]] > "u" && (v[s.path[y]] = typeof s.path[y + 1] < "u" && typeof s.path[y + 1] == "number" ? [] : {}), v = v[s.path[y]];
|
|
916
930
|
switch (s.kind) {
|
|
917
931
|
case "A":
|
|
918
|
-
s.path && typeof
|
|
932
|
+
s.path && typeof v[s.path[y]] > "u" && (v[s.path[y]] = []), T(s.path ? v[s.path[y]] : v, s.index, s.item);
|
|
919
933
|
break;
|
|
920
934
|
case "D":
|
|
921
|
-
delete
|
|
935
|
+
delete v[s.path[y]];
|
|
922
936
|
break;
|
|
923
937
|
case "E":
|
|
924
938
|
case "N":
|
|
925
|
-
|
|
939
|
+
v[s.path[y]] = s.rhs;
|
|
926
940
|
break;
|
|
927
941
|
}
|
|
928
942
|
}
|
|
929
943
|
}
|
|
930
|
-
function
|
|
944
|
+
function _(i, u, s) {
|
|
931
945
|
if (s.path && s.path.length) {
|
|
932
|
-
var
|
|
933
|
-
for (
|
|
934
|
-
|
|
946
|
+
var v = i[u], y, g = s.path.length - 1;
|
|
947
|
+
for (y = 0; y < g; y++)
|
|
948
|
+
v = v[s.path[y]];
|
|
935
949
|
switch (s.kind) {
|
|
936
950
|
case "A":
|
|
937
|
-
|
|
951
|
+
_(v[s.path[y]], s.index, s.item);
|
|
938
952
|
break;
|
|
939
953
|
case "D":
|
|
940
|
-
|
|
954
|
+
v[s.path[y]] = s.lhs;
|
|
941
955
|
break;
|
|
942
956
|
case "E":
|
|
943
|
-
|
|
957
|
+
v[s.path[y]] = s.lhs;
|
|
944
958
|
break;
|
|
945
959
|
case "N":
|
|
946
|
-
delete
|
|
960
|
+
delete v[s.path[y]];
|
|
947
961
|
break;
|
|
948
962
|
}
|
|
949
963
|
} else
|
|
950
964
|
switch (s.kind) {
|
|
951
965
|
case "A":
|
|
952
|
-
|
|
966
|
+
_(i[u], s.index, s.item);
|
|
953
967
|
break;
|
|
954
968
|
case "D":
|
|
955
|
-
i[
|
|
969
|
+
i[u] = s.lhs;
|
|
956
970
|
break;
|
|
957
971
|
case "E":
|
|
958
|
-
i[
|
|
972
|
+
i[u] = s.lhs;
|
|
959
973
|
break;
|
|
960
974
|
case "N":
|
|
961
|
-
i =
|
|
975
|
+
i = b(i, u);
|
|
962
976
|
break;
|
|
963
977
|
}
|
|
964
978
|
return i;
|
|
965
979
|
}
|
|
966
|
-
function
|
|
967
|
-
if (i &&
|
|
968
|
-
var
|
|
969
|
-
for (
|
|
970
|
-
typeof
|
|
980
|
+
function N(i, u, s) {
|
|
981
|
+
if (i && u && s && s.kind) {
|
|
982
|
+
var v = i, y, g;
|
|
983
|
+
for (g = s.path.length - 1, y = 0; y < g; y++)
|
|
984
|
+
typeof v[s.path[y]] > "u" && (v[s.path[y]] = {}), v = v[s.path[y]];
|
|
971
985
|
switch (s.kind) {
|
|
972
986
|
case "A":
|
|
973
|
-
|
|
987
|
+
_(v[s.path[y]], s.index, s.item);
|
|
974
988
|
break;
|
|
975
989
|
case "D":
|
|
976
|
-
|
|
990
|
+
v[s.path[y]] = s.lhs;
|
|
977
991
|
break;
|
|
978
992
|
case "E":
|
|
979
|
-
|
|
993
|
+
v[s.path[y]] = s.lhs;
|
|
980
994
|
break;
|
|
981
995
|
case "N":
|
|
982
|
-
delete
|
|
996
|
+
delete v[s.path[y]];
|
|
983
997
|
break;
|
|
984
998
|
}
|
|
985
999
|
}
|
|
986
1000
|
}
|
|
987
|
-
function
|
|
988
|
-
if (i &&
|
|
989
|
-
var
|
|
990
|
-
(!s || s(i,
|
|
1001
|
+
function I(i, u, s) {
|
|
1002
|
+
if (i && u) {
|
|
1003
|
+
var v = function(y) {
|
|
1004
|
+
(!s || s(i, u, y)) && R(i, u, y);
|
|
991
1005
|
};
|
|
992
|
-
|
|
1006
|
+
k(i, u, v);
|
|
993
1007
|
}
|
|
994
1008
|
}
|
|
995
1009
|
return Object.defineProperties(A, {
|
|
@@ -998,31 +1012,31 @@ function Ge() {
|
|
|
998
1012
|
enumerable: !0
|
|
999
1013
|
},
|
|
1000
1014
|
orderIndependentDiff: {
|
|
1001
|
-
value:
|
|
1015
|
+
value: m,
|
|
1002
1016
|
enumerable: !0
|
|
1003
1017
|
},
|
|
1004
1018
|
observableDiff: {
|
|
1005
|
-
value:
|
|
1019
|
+
value: k,
|
|
1006
1020
|
enumerable: !0
|
|
1007
1021
|
},
|
|
1008
1022
|
orderIndependentObservableDiff: {
|
|
1009
|
-
value:
|
|
1023
|
+
value: O,
|
|
1010
1024
|
enumerable: !0
|
|
1011
1025
|
},
|
|
1012
1026
|
orderIndepHash: {
|
|
1013
|
-
value:
|
|
1027
|
+
value: x,
|
|
1014
1028
|
enumerable: !0
|
|
1015
1029
|
},
|
|
1016
1030
|
applyDiff: {
|
|
1017
|
-
value:
|
|
1031
|
+
value: I,
|
|
1018
1032
|
enumerable: !0
|
|
1019
1033
|
},
|
|
1020
1034
|
applyChange: {
|
|
1021
|
-
value:
|
|
1035
|
+
value: R,
|
|
1022
1036
|
enumerable: !0
|
|
1023
1037
|
},
|
|
1024
1038
|
revertChange: {
|
|
1025
|
-
value:
|
|
1039
|
+
value: N,
|
|
1026
1040
|
enumerable: !0
|
|
1027
1041
|
},
|
|
1028
1042
|
isConflict: {
|
|
@@ -1035,193 +1049,84 @@ function Ge() {
|
|
|
1035
1049
|
});
|
|
1036
1050
|
}(se)), se.exports;
|
|
1037
1051
|
}
|
|
1038
|
-
var
|
|
1039
|
-
|
|
1040
|
-
const n = t.length, r = e.length, o = 1 << n - 1;
|
|
1041
|
-
let u = -1, p = 0, c = n, f = n;
|
|
1042
|
-
for (; f--; )
|
|
1043
|
-
H[t.charCodeAt(f)] |= 1 << f;
|
|
1044
|
-
for (f = 0; f < r; f++) {
|
|
1045
|
-
let y = H[e.charCodeAt(f)];
|
|
1046
|
-
const m = y | p;
|
|
1047
|
-
y |= (y & u) + u ^ u, p |= ~(y | u), u &= y, p & o && c++, u & o && c--, p = p << 1 | 1, u = u << 1 | ~(m | p), p &= m;
|
|
1048
|
-
}
|
|
1049
|
-
for (f = n; f--; )
|
|
1050
|
-
H[t.charCodeAt(f)] = 0;
|
|
1051
|
-
return c;
|
|
1052
|
-
}, Qe = (t, e) => {
|
|
1053
|
-
const n = e.length, r = t.length, o = [], u = [], p = Math.ceil(n / 32), c = Math.ceil(r / 32);
|
|
1054
|
-
for (let h = 0; h < p; h++)
|
|
1055
|
-
u[h] = -1, o[h] = 0;
|
|
1056
|
-
let f = 0;
|
|
1057
|
-
for (; f < c - 1; f++) {
|
|
1058
|
-
let h = 0, g = -1;
|
|
1059
|
-
const C = f * 32, A = Math.min(32, r) + C;
|
|
1060
|
-
for (let b = C; b < A; b++)
|
|
1061
|
-
H[t.charCodeAt(b)] |= 1 << b;
|
|
1062
|
-
for (let b = 0; b < n; b++) {
|
|
1063
|
-
const R = H[e.charCodeAt(b)], E = u[b / 32 | 0] >>> b & 1, P = o[b / 32 | 0] >>> b & 1, j = R | h, S = ((R | P) & g) + g ^ g | R | P;
|
|
1064
|
-
let i = h | ~(S | g), l = g & S;
|
|
1065
|
-
i >>> 31 ^ E && (u[b / 32 | 0] ^= 1 << b), l >>> 31 ^ P && (o[b / 32 | 0] ^= 1 << b), i = i << 1 | E, l = l << 1 | P, g = l | ~(j | i), h = i & j;
|
|
1066
|
-
}
|
|
1067
|
-
for (let b = C; b < A; b++)
|
|
1068
|
-
H[t.charCodeAt(b)] = 0;
|
|
1069
|
-
}
|
|
1070
|
-
let y = 0, m = -1;
|
|
1071
|
-
const O = f * 32, w = Math.min(32, r - O) + O;
|
|
1072
|
-
for (let h = O; h < w; h++)
|
|
1073
|
-
H[t.charCodeAt(h)] |= 1 << h;
|
|
1074
|
-
let k = r;
|
|
1075
|
-
for (let h = 0; h < n; h++) {
|
|
1076
|
-
const g = H[e.charCodeAt(h)], C = u[h / 32 | 0] >>> h & 1, A = o[h / 32 | 0] >>> h & 1, b = g | y, R = ((g | A) & m) + m ^ m | g | A;
|
|
1077
|
-
let E = y | ~(R | m), P = m & R;
|
|
1078
|
-
k += E >>> r - 1 & 1, k -= P >>> r - 1 & 1, E >>> 31 ^ C && (u[h / 32 | 0] ^= 1 << h), P >>> 31 ^ A && (o[h / 32 | 0] ^= 1 << h), E = E << 1 | C, P = P << 1 | A, m = P | ~(b | E), y = E & b;
|
|
1079
|
-
}
|
|
1080
|
-
for (let h = O; h < w; h++)
|
|
1081
|
-
H[t.charCodeAt(h)] = 0;
|
|
1082
|
-
return k;
|
|
1083
|
-
}, Re = (t, e) => {
|
|
1084
|
-
if (t.length < e.length) {
|
|
1085
|
-
const n = e;
|
|
1086
|
-
e = t, t = n;
|
|
1087
|
-
}
|
|
1088
|
-
return e.length === 0 ? t.length : t.length <= 32 ? Ze(t, e) : Qe(t, e);
|
|
1089
|
-
}, et = (t, e) => {
|
|
1090
|
-
let n = 1 / 0, r = 0;
|
|
1091
|
-
for (let o = 0; o < e.length; o++) {
|
|
1092
|
-
const u = Re(t, e[o]);
|
|
1093
|
-
u < n && (n = u, r = o);
|
|
1094
|
-
}
|
|
1095
|
-
return e[r];
|
|
1096
|
-
}, tt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1097
|
-
__proto__: null,
|
|
1098
|
-
closest: et,
|
|
1099
|
-
distance: Re
|
|
1100
|
-
}, Symbol.toStringTag, { value: "Module" })), nt = /* @__PURE__ */ Se(tt);
|
|
1101
|
-
var ye;
|
|
1102
|
-
function rt() {
|
|
1103
|
-
return ye || (ye = 1, function(t, e) {
|
|
1104
|
-
(function() {
|
|
1105
|
-
var n;
|
|
1106
|
-
try {
|
|
1107
|
-
n = typeof Intl < "u" && typeof Intl.Collator < "u" ? Intl.Collator("generic", { sensitivity: "base" }) : null;
|
|
1108
|
-
} catch {
|
|
1109
|
-
console.log("Collator could not be initialized and wouldn't be used");
|
|
1110
|
-
}
|
|
1111
|
-
var r = nt, o = [], u = [], p = {
|
|
1112
|
-
/**
|
|
1113
|
-
* Calculate levenshtein distance of the two strings.
|
|
1114
|
-
*
|
|
1115
|
-
* @param str1 String the first string.
|
|
1116
|
-
* @param str2 String the second string.
|
|
1117
|
-
* @param [options] Additional options.
|
|
1118
|
-
* @param [options.useCollator] Use `Intl.Collator` for locale-sensitive string comparison.
|
|
1119
|
-
* @return Integer the levenshtein distance (0 and above).
|
|
1120
|
-
*/
|
|
1121
|
-
get: function(c, f, y) {
|
|
1122
|
-
var m = y && n && y.useCollator;
|
|
1123
|
-
if (m) {
|
|
1124
|
-
var O = c.length, w = f.length;
|
|
1125
|
-
if (O === 0) return w;
|
|
1126
|
-
if (w === 0) return O;
|
|
1127
|
-
var k, h, g, C, A;
|
|
1128
|
-
for (g = 0; g < w; ++g)
|
|
1129
|
-
o[g] = g, u[g] = f.charCodeAt(g);
|
|
1130
|
-
o[w] = w;
|
|
1131
|
-
var b;
|
|
1132
|
-
for (g = 0; g < O; ++g) {
|
|
1133
|
-
for (h = g + 1, C = 0; C < w; ++C)
|
|
1134
|
-
k = h, b = n.compare(c.charAt(g), String.fromCharCode(u[C])) === 0, h = o[C] + (b ? 0 : 1), A = k + 1, h > A && (h = A), A = o[C + 1] + 1, h > A && (h = A), o[C] = k;
|
|
1135
|
-
o[C] = h;
|
|
1136
|
-
}
|
|
1137
|
-
return h;
|
|
1138
|
-
}
|
|
1139
|
-
return r.distance(c, f);
|
|
1140
|
-
}
|
|
1141
|
-
};
|
|
1142
|
-
t !== null && t.exports === e ? t.exports = p : typeof self < "u" && typeof self.postMessage == "function" && typeof self.importScripts == "function" ? self.Levenshtein = p : typeof window < "u" && window !== null && (window.Levenshtein = p);
|
|
1143
|
-
})();
|
|
1144
|
-
}(ie, ie.exports)), ie.exports;
|
|
1145
|
-
}
|
|
1146
|
-
var ot = rt();
|
|
1147
|
-
const it = /* @__PURE__ */ je(ot);
|
|
1148
|
-
class st {
|
|
1052
|
+
var Ce = Xe();
|
|
1053
|
+
class Ze {
|
|
1149
1054
|
diff(e, n, r = {}) {
|
|
1150
1055
|
let o;
|
|
1151
1056
|
typeof r == "function" ? (o = r, r = {}) : "callback" in r && (o = r.callback);
|
|
1152
|
-
const
|
|
1153
|
-
return this.diffWithOptionsObj(
|
|
1057
|
+
const d = this.castInput(e, r), f = this.castInput(n, r), l = this.removeEmpty(this.tokenize(d, r)), c = this.removeEmpty(this.tokenize(f, r));
|
|
1058
|
+
return this.diffWithOptionsObj(l, c, r, o);
|
|
1154
1059
|
}
|
|
1155
1060
|
diffWithOptionsObj(e, n, r, o) {
|
|
1156
|
-
var
|
|
1157
|
-
const
|
|
1158
|
-
if (
|
|
1061
|
+
var d;
|
|
1062
|
+
const f = (m) => {
|
|
1063
|
+
if (m = this.postProcess(m, r), o) {
|
|
1159
1064
|
setTimeout(function() {
|
|
1160
|
-
o(
|
|
1065
|
+
o(m);
|
|
1161
1066
|
}, 0);
|
|
1162
1067
|
return;
|
|
1163
1068
|
} else
|
|
1164
|
-
return
|
|
1165
|
-
},
|
|
1166
|
-
let
|
|
1167
|
-
r.maxEditLength != null && (
|
|
1168
|
-
const
|
|
1169
|
-
let
|
|
1170
|
-
if (
|
|
1171
|
-
return
|
|
1172
|
-
let
|
|
1069
|
+
return m;
|
|
1070
|
+
}, l = n.length, c = e.length;
|
|
1071
|
+
let h = 1, b = l + c;
|
|
1072
|
+
r.maxEditLength != null && (b = Math.min(b, r.maxEditLength));
|
|
1073
|
+
const P = (d = r.timeout) !== null && d !== void 0 ? d : 1 / 0, E = Date.now() + P, x = [{ oldPos: -1, lastComponent: void 0 }];
|
|
1074
|
+
let p = this.extractCommon(x[0], n, e, 0, r);
|
|
1075
|
+
if (x[0].oldPos + 1 >= c && p + 1 >= l)
|
|
1076
|
+
return f(this.buildValues(x[0].lastComponent, n, e));
|
|
1077
|
+
let k = -1 / 0, O = 1 / 0;
|
|
1173
1078
|
const A = () => {
|
|
1174
|
-
for (let
|
|
1175
|
-
let
|
|
1176
|
-
const
|
|
1177
|
-
|
|
1178
|
-
let
|
|
1179
|
-
if (
|
|
1180
|
-
const i =
|
|
1181
|
-
|
|
1079
|
+
for (let m = Math.max(k, -h); m <= Math.min(O, h); m += 2) {
|
|
1080
|
+
let T;
|
|
1081
|
+
const R = x[m - 1], _ = x[m + 1];
|
|
1082
|
+
R && (x[m - 1] = void 0);
|
|
1083
|
+
let N = !1;
|
|
1084
|
+
if (_) {
|
|
1085
|
+
const i = _.oldPos - m;
|
|
1086
|
+
N = _ && 0 <= i && i < l;
|
|
1182
1087
|
}
|
|
1183
|
-
const
|
|
1184
|
-
if (!
|
|
1185
|
-
|
|
1088
|
+
const I = R && R.oldPos + 1 < c;
|
|
1089
|
+
if (!N && !I) {
|
|
1090
|
+
x[m] = void 0;
|
|
1186
1091
|
continue;
|
|
1187
1092
|
}
|
|
1188
|
-
if (!
|
|
1189
|
-
return
|
|
1190
|
-
|
|
1093
|
+
if (!I || N && R.oldPos < _.oldPos ? T = this.addToPath(_, !0, !1, 0, r) : T = this.addToPath(R, !1, !0, 1, r), p = this.extractCommon(T, n, e, m, r), T.oldPos + 1 >= c && p + 1 >= l)
|
|
1094
|
+
return f(this.buildValues(T.lastComponent, n, e)) || !0;
|
|
1095
|
+
x[m] = T, T.oldPos + 1 >= c && (O = Math.min(O, m - 1)), p + 1 >= l && (k = Math.max(k, m + 1));
|
|
1191
1096
|
}
|
|
1192
|
-
|
|
1097
|
+
h++;
|
|
1193
1098
|
};
|
|
1194
1099
|
if (o)
|
|
1195
|
-
(function
|
|
1100
|
+
(function m() {
|
|
1196
1101
|
setTimeout(function() {
|
|
1197
|
-
if (
|
|
1102
|
+
if (h > b || Date.now() > E)
|
|
1198
1103
|
return o(void 0);
|
|
1199
|
-
A() ||
|
|
1104
|
+
A() || m();
|
|
1200
1105
|
}, 0);
|
|
1201
1106
|
})();
|
|
1202
1107
|
else
|
|
1203
|
-
for (;
|
|
1204
|
-
const
|
|
1205
|
-
if (
|
|
1206
|
-
return
|
|
1108
|
+
for (; h <= b && Date.now() <= E; ) {
|
|
1109
|
+
const m = A();
|
|
1110
|
+
if (m)
|
|
1111
|
+
return m;
|
|
1207
1112
|
}
|
|
1208
1113
|
}
|
|
1209
|
-
addToPath(e, n, r, o,
|
|
1210
|
-
const
|
|
1211
|
-
return
|
|
1114
|
+
addToPath(e, n, r, o, d) {
|
|
1115
|
+
const f = e.lastComponent;
|
|
1116
|
+
return f && !d.oneChangePerToken && f.added === n && f.removed === r ? {
|
|
1212
1117
|
oldPos: e.oldPos + o,
|
|
1213
|
-
lastComponent: { count:
|
|
1118
|
+
lastComponent: { count: f.count + 1, added: n, removed: r, previousComponent: f.previousComponent }
|
|
1214
1119
|
} : {
|
|
1215
1120
|
oldPos: e.oldPos + o,
|
|
1216
|
-
lastComponent: { count: 1, added: n, removed: r, previousComponent:
|
|
1121
|
+
lastComponent: { count: 1, added: n, removed: r, previousComponent: f }
|
|
1217
1122
|
};
|
|
1218
1123
|
}
|
|
1219
|
-
extractCommon(e, n, r, o,
|
|
1220
|
-
const
|
|
1221
|
-
let
|
|
1222
|
-
for (;
|
|
1223
|
-
|
|
1224
|
-
return
|
|
1124
|
+
extractCommon(e, n, r, o, d) {
|
|
1125
|
+
const f = n.length, l = r.length;
|
|
1126
|
+
let c = e.oldPos, h = c - o, b = 0;
|
|
1127
|
+
for (; h + 1 < f && c + 1 < l && this.equals(r[c + 1], n[h + 1], d); )
|
|
1128
|
+
h++, c++, b++, d.oneChangePerToken && (e.lastComponent = { count: 1, previousComponent: e.lastComponent, added: !1, removed: !1 });
|
|
1129
|
+
return b && !d.oneChangePerToken && (e.lastComponent = { count: b, previousComponent: e.lastComponent, added: !1, removed: !1 }), e.oldPos = c, h;
|
|
1225
1130
|
}
|
|
1226
1131
|
equals(e, n, r) {
|
|
1227
1132
|
return r.comparator ? r.comparator(e, n) : e === n || !!r.ignoreCase && e.toLowerCase() === n.toLowerCase();
|
|
@@ -1251,34 +1156,34 @@ class st {
|
|
|
1251
1156
|
}
|
|
1252
1157
|
buildValues(e, n, r) {
|
|
1253
1158
|
const o = [];
|
|
1254
|
-
let
|
|
1159
|
+
let d;
|
|
1255
1160
|
for (; e; )
|
|
1256
|
-
o.push(e),
|
|
1161
|
+
o.push(e), d = e.previousComponent, delete e.previousComponent, e = d;
|
|
1257
1162
|
o.reverse();
|
|
1258
|
-
const
|
|
1259
|
-
let
|
|
1260
|
-
for (;
|
|
1261
|
-
const
|
|
1262
|
-
if (
|
|
1263
|
-
|
|
1163
|
+
const f = o.length;
|
|
1164
|
+
let l = 0, c = 0, h = 0;
|
|
1165
|
+
for (; l < f; l++) {
|
|
1166
|
+
const b = o[l];
|
|
1167
|
+
if (b.removed)
|
|
1168
|
+
b.value = this.join(r.slice(h, h + b.count)), h += b.count;
|
|
1264
1169
|
else {
|
|
1265
|
-
if (!
|
|
1266
|
-
let
|
|
1267
|
-
|
|
1268
|
-
const
|
|
1269
|
-
return
|
|
1270
|
-
}),
|
|
1170
|
+
if (!b.added && this.useLongestToken) {
|
|
1171
|
+
let P = n.slice(c, c + b.count);
|
|
1172
|
+
P = P.map(function(E, x) {
|
|
1173
|
+
const p = r[h + x];
|
|
1174
|
+
return p.length > E.length ? p : E;
|
|
1175
|
+
}), b.value = this.join(P);
|
|
1271
1176
|
} else
|
|
1272
|
-
|
|
1273
|
-
|
|
1177
|
+
b.value = this.join(n.slice(c, c + b.count));
|
|
1178
|
+
c += b.count, b.added || (h += b.count);
|
|
1274
1179
|
}
|
|
1275
1180
|
}
|
|
1276
1181
|
return o;
|
|
1277
1182
|
}
|
|
1278
1183
|
}
|
|
1279
|
-
class
|
|
1184
|
+
class Qe extends Ze {
|
|
1280
1185
|
constructor() {
|
|
1281
|
-
super(...arguments), this.tokenize =
|
|
1186
|
+
super(...arguments), this.tokenize = tt;
|
|
1282
1187
|
}
|
|
1283
1188
|
equals(e, n, r) {
|
|
1284
1189
|
return r.ignoreWhitespace ? ((!r.newlineIsToken || !e.includes(`
|
|
@@ -1288,87 +1193,87 @@ class at extends st {
|
|
|
1288
1193
|
`) && (n = n.slice(0, -1))), super.equals(e, n, r);
|
|
1289
1194
|
}
|
|
1290
1195
|
}
|
|
1291
|
-
const
|
|
1292
|
-
function
|
|
1293
|
-
return
|
|
1196
|
+
const et = new Qe();
|
|
1197
|
+
function ye(t, e, n) {
|
|
1198
|
+
return et.diff(t, e, n);
|
|
1294
1199
|
}
|
|
1295
|
-
function
|
|
1200
|
+
function tt(t, e) {
|
|
1296
1201
|
e.stripTrailingCr && (t = t.replace(/\r\n/g, `
|
|
1297
1202
|
`));
|
|
1298
1203
|
const n = [], r = t.split(/(\n|\r\n)/);
|
|
1299
1204
|
r[r.length - 1] || r.pop();
|
|
1300
1205
|
for (let o = 0; o < r.length; o++) {
|
|
1301
|
-
const
|
|
1302
|
-
o % 2 && !e.newlineIsToken ? n[n.length - 1] +=
|
|
1206
|
+
const d = r[o];
|
|
1207
|
+
o % 2 && !e.newlineIsToken ? n[n.length - 1] += d : n.push(d);
|
|
1303
1208
|
}
|
|
1304
1209
|
return n;
|
|
1305
1210
|
}
|
|
1306
|
-
function
|
|
1307
|
-
let
|
|
1308
|
-
|
|
1309
|
-
const
|
|
1310
|
-
if (
|
|
1211
|
+
function ge(t, e, n, r, o, d, f) {
|
|
1212
|
+
let l;
|
|
1213
|
+
f ? typeof f == "function" ? l = { callback: f } : l = f : l = {}, typeof l.context > "u" && (l.context = 4);
|
|
1214
|
+
const c = l.context;
|
|
1215
|
+
if (l.newlineIsToken)
|
|
1311
1216
|
throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");
|
|
1312
|
-
if (
|
|
1313
|
-
const { callback:
|
|
1314
|
-
|
|
1315
|
-
const
|
|
1316
|
-
|
|
1217
|
+
if (l.callback) {
|
|
1218
|
+
const { callback: b } = l;
|
|
1219
|
+
ye(n, r, Object.assign(Object.assign({}, l), { callback: (P) => {
|
|
1220
|
+
const E = h(P);
|
|
1221
|
+
b(E);
|
|
1317
1222
|
} }));
|
|
1318
1223
|
} else
|
|
1319
|
-
return
|
|
1320
|
-
function
|
|
1321
|
-
if (!
|
|
1224
|
+
return h(ye(n, r, l));
|
|
1225
|
+
function h(b) {
|
|
1226
|
+
if (!b)
|
|
1322
1227
|
return;
|
|
1323
|
-
|
|
1324
|
-
function
|
|
1325
|
-
return
|
|
1326
|
-
return " " +
|
|
1228
|
+
b.push({ value: "", lines: [] });
|
|
1229
|
+
function P(m) {
|
|
1230
|
+
return m.map(function(T) {
|
|
1231
|
+
return " " + T;
|
|
1327
1232
|
});
|
|
1328
1233
|
}
|
|
1329
|
-
const
|
|
1330
|
-
let
|
|
1331
|
-
for (let
|
|
1332
|
-
const
|
|
1333
|
-
if (
|
|
1334
|
-
if (!
|
|
1335
|
-
const
|
|
1336
|
-
|
|
1234
|
+
const E = [];
|
|
1235
|
+
let x = 0, p = 0, k = [], O = 1, A = 1;
|
|
1236
|
+
for (let m = 0; m < b.length; m++) {
|
|
1237
|
+
const T = b[m], R = T.lines || rt(T.value);
|
|
1238
|
+
if (T.lines = R, T.added || T.removed) {
|
|
1239
|
+
if (!x) {
|
|
1240
|
+
const _ = b[m - 1];
|
|
1241
|
+
x = O, p = A, _ && (k = c > 0 ? P(_.lines.slice(-c)) : [], x -= k.length, p -= k.length);
|
|
1337
1242
|
}
|
|
1338
|
-
for (const
|
|
1339
|
-
|
|
1340
|
-
|
|
1243
|
+
for (const _ of R)
|
|
1244
|
+
k.push((T.added ? "+" : "-") + _);
|
|
1245
|
+
T.added ? A += R.length : O += R.length;
|
|
1341
1246
|
} else {
|
|
1342
|
-
if (
|
|
1343
|
-
if (
|
|
1344
|
-
for (const
|
|
1345
|
-
|
|
1247
|
+
if (x)
|
|
1248
|
+
if (R.length <= c * 2 && m < b.length - 2)
|
|
1249
|
+
for (const _ of P(R))
|
|
1250
|
+
k.push(_);
|
|
1346
1251
|
else {
|
|
1347
|
-
const
|
|
1348
|
-
for (const
|
|
1349
|
-
|
|
1350
|
-
const
|
|
1351
|
-
oldStart:
|
|
1352
|
-
oldLines:
|
|
1353
|
-
newStart:
|
|
1354
|
-
newLines: A -
|
|
1355
|
-
lines:
|
|
1252
|
+
const _ = Math.min(R.length, c);
|
|
1253
|
+
for (const I of P(R.slice(0, _)))
|
|
1254
|
+
k.push(I);
|
|
1255
|
+
const N = {
|
|
1256
|
+
oldStart: x,
|
|
1257
|
+
oldLines: O - x + _,
|
|
1258
|
+
newStart: p,
|
|
1259
|
+
newLines: A - p + _,
|
|
1260
|
+
lines: k
|
|
1356
1261
|
};
|
|
1357
|
-
|
|
1262
|
+
E.push(N), x = 0, p = 0, k = [];
|
|
1358
1263
|
}
|
|
1359
|
-
|
|
1264
|
+
O += R.length, A += R.length;
|
|
1360
1265
|
}
|
|
1361
1266
|
}
|
|
1362
|
-
for (const
|
|
1363
|
-
for (let
|
|
1364
|
-
|
|
1365
|
-
`) ?
|
|
1267
|
+
for (const m of E)
|
|
1268
|
+
for (let T = 0; T < m.lines.length; T++)
|
|
1269
|
+
m.lines[T].endsWith(`
|
|
1270
|
+
`) ? m.lines[T] = m.lines[T].slice(0, -1) : (m.lines.splice(T + 1, 0, "\"), T++);
|
|
1366
1271
|
return {
|
|
1367
1272
|
oldFileName: t,
|
|
1368
1273
|
newFileName: e,
|
|
1369
1274
|
oldHeader: o,
|
|
1370
|
-
newHeader:
|
|
1371
|
-
hunks:
|
|
1275
|
+
newHeader: d,
|
|
1276
|
+
hunks: E
|
|
1372
1277
|
};
|
|
1373
1278
|
}
|
|
1374
1279
|
}
|
|
@@ -1388,38 +1293,148 @@ function fe(t) {
|
|
|
1388
1293
|
`) + `
|
|
1389
1294
|
`;
|
|
1390
1295
|
}
|
|
1391
|
-
function
|
|
1392
|
-
if (typeof
|
|
1393
|
-
const { callback:
|
|
1394
|
-
|
|
1395
|
-
c
|
|
1296
|
+
function nt(t, e, n, r, o, d, f) {
|
|
1297
|
+
if (typeof f == "function" && (f = { callback: f }), f?.callback) {
|
|
1298
|
+
const { callback: l } = f;
|
|
1299
|
+
ge(t, e, n, r, o, d, Object.assign(Object.assign({}, f), { callback: (c) => {
|
|
1300
|
+
l(c ? fe(c) : void 0);
|
|
1396
1301
|
} }));
|
|
1397
1302
|
} else {
|
|
1398
|
-
const
|
|
1399
|
-
return
|
|
1303
|
+
const l = ge(t, e, n, r, o, d, f);
|
|
1304
|
+
return l ? fe(l) : void 0;
|
|
1400
1305
|
}
|
|
1401
1306
|
}
|
|
1402
|
-
function
|
|
1307
|
+
function rt(t) {
|
|
1403
1308
|
const e = t.endsWith(`
|
|
1404
1309
|
`), n = t.split(`
|
|
1405
1310
|
`).map((r) => r + `
|
|
1406
1311
|
`);
|
|
1407
1312
|
return e ? n.pop() : n.push(n.pop().slice(0, -1)), n;
|
|
1408
1313
|
}
|
|
1314
|
+
var ie = { exports: {} };
|
|
1315
|
+
const K = new Uint32Array(65536), ot = (t, e) => {
|
|
1316
|
+
const n = t.length, r = e.length, o = 1 << n - 1;
|
|
1317
|
+
let d = -1, f = 0, l = n, c = n;
|
|
1318
|
+
for (; c--; )
|
|
1319
|
+
K[t.charCodeAt(c)] |= 1 << c;
|
|
1320
|
+
for (c = 0; c < r; c++) {
|
|
1321
|
+
let h = K[e.charCodeAt(c)];
|
|
1322
|
+
const b = h | f;
|
|
1323
|
+
h |= (h & d) + d ^ d, f |= ~(h | d), d &= h, f & o && l++, d & o && l--, f = f << 1 | 1, d = d << 1 | ~(b | f), f &= b;
|
|
1324
|
+
}
|
|
1325
|
+
for (c = n; c--; )
|
|
1326
|
+
K[t.charCodeAt(c)] = 0;
|
|
1327
|
+
return l;
|
|
1328
|
+
}, it = (t, e) => {
|
|
1329
|
+
const n = e.length, r = t.length, o = [], d = [], f = Math.ceil(n / 32), l = Math.ceil(r / 32);
|
|
1330
|
+
for (let p = 0; p < f; p++)
|
|
1331
|
+
d[p] = -1, o[p] = 0;
|
|
1332
|
+
let c = 0;
|
|
1333
|
+
for (; c < l - 1; c++) {
|
|
1334
|
+
let p = 0, k = -1;
|
|
1335
|
+
const O = c * 32, A = Math.min(32, r) + O;
|
|
1336
|
+
for (let m = O; m < A; m++)
|
|
1337
|
+
K[t.charCodeAt(m)] |= 1 << m;
|
|
1338
|
+
for (let m = 0; m < n; m++) {
|
|
1339
|
+
const T = K[e.charCodeAt(m)], R = d[m / 32 | 0] >>> m & 1, _ = o[m / 32 | 0] >>> m & 1, N = T | p, I = ((T | _) & k) + k ^ k | T | _;
|
|
1340
|
+
let i = p | ~(I | k), u = k & I;
|
|
1341
|
+
i >>> 31 ^ R && (d[m / 32 | 0] ^= 1 << m), u >>> 31 ^ _ && (o[m / 32 | 0] ^= 1 << m), i = i << 1 | R, u = u << 1 | _, k = u | ~(N | i), p = i & N;
|
|
1342
|
+
}
|
|
1343
|
+
for (let m = O; m < A; m++)
|
|
1344
|
+
K[t.charCodeAt(m)] = 0;
|
|
1345
|
+
}
|
|
1346
|
+
let h = 0, b = -1;
|
|
1347
|
+
const P = c * 32, E = Math.min(32, r - P) + P;
|
|
1348
|
+
for (let p = P; p < E; p++)
|
|
1349
|
+
K[t.charCodeAt(p)] |= 1 << p;
|
|
1350
|
+
let x = r;
|
|
1351
|
+
for (let p = 0; p < n; p++) {
|
|
1352
|
+
const k = K[e.charCodeAt(p)], O = d[p / 32 | 0] >>> p & 1, A = o[p / 32 | 0] >>> p & 1, m = k | h, T = ((k | A) & b) + b ^ b | k | A;
|
|
1353
|
+
let R = h | ~(T | b), _ = b & T;
|
|
1354
|
+
x += R >>> r - 1 & 1, x -= _ >>> r - 1 & 1, R >>> 31 ^ O && (d[p / 32 | 0] ^= 1 << p), _ >>> 31 ^ A && (o[p / 32 | 0] ^= 1 << p), R = R << 1 | O, _ = _ << 1 | A, b = _ | ~(m | R), h = R & m;
|
|
1355
|
+
}
|
|
1356
|
+
for (let p = P; p < E; p++)
|
|
1357
|
+
K[t.charCodeAt(p)] = 0;
|
|
1358
|
+
return x;
|
|
1359
|
+
}, Oe = (t, e) => {
|
|
1360
|
+
if (t.length < e.length) {
|
|
1361
|
+
const n = e;
|
|
1362
|
+
e = t, t = n;
|
|
1363
|
+
}
|
|
1364
|
+
return e.length === 0 ? t.length : t.length <= 32 ? ot(t, e) : it(t, e);
|
|
1365
|
+
}, st = (t, e) => {
|
|
1366
|
+
let n = 1 / 0, r = 0;
|
|
1367
|
+
for (let o = 0; o < e.length; o++) {
|
|
1368
|
+
const d = Oe(t, e[o]);
|
|
1369
|
+
d < n && (n = d, r = o);
|
|
1370
|
+
}
|
|
1371
|
+
return e[r];
|
|
1372
|
+
}, at = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1373
|
+
__proto__: null,
|
|
1374
|
+
closest: st,
|
|
1375
|
+
distance: Oe
|
|
1376
|
+
}, Symbol.toStringTag, { value: "Module" })), lt = /* @__PURE__ */ Se(at);
|
|
1377
|
+
var we;
|
|
1378
|
+
function ut() {
|
|
1379
|
+
return we || (we = 1, function(t, e) {
|
|
1380
|
+
(function() {
|
|
1381
|
+
var n;
|
|
1382
|
+
try {
|
|
1383
|
+
n = typeof Intl < "u" && typeof Intl.Collator < "u" ? Intl.Collator("generic", { sensitivity: "base" }) : null;
|
|
1384
|
+
} catch {
|
|
1385
|
+
console.log("Collator could not be initialized and wouldn't be used");
|
|
1386
|
+
}
|
|
1387
|
+
var r = lt, o = [], d = [], f = {
|
|
1388
|
+
/**
|
|
1389
|
+
* Calculate levenshtein distance of the two strings.
|
|
1390
|
+
*
|
|
1391
|
+
* @param str1 String the first string.
|
|
1392
|
+
* @param str2 String the second string.
|
|
1393
|
+
* @param [options] Additional options.
|
|
1394
|
+
* @param [options.useCollator] Use `Intl.Collator` for locale-sensitive string comparison.
|
|
1395
|
+
* @return Integer the levenshtein distance (0 and above).
|
|
1396
|
+
*/
|
|
1397
|
+
get: function(l, c, h) {
|
|
1398
|
+
var b = h && n && h.useCollator;
|
|
1399
|
+
if (b) {
|
|
1400
|
+
var P = l.length, E = c.length;
|
|
1401
|
+
if (P === 0) return E;
|
|
1402
|
+
if (E === 0) return P;
|
|
1403
|
+
var x, p, k, O, A;
|
|
1404
|
+
for (k = 0; k < E; ++k)
|
|
1405
|
+
o[k] = k, d[k] = c.charCodeAt(k);
|
|
1406
|
+
o[E] = E;
|
|
1407
|
+
var m;
|
|
1408
|
+
for (k = 0; k < P; ++k) {
|
|
1409
|
+
for (p = k + 1, O = 0; O < E; ++O)
|
|
1410
|
+
x = p, m = n.compare(l.charAt(k), String.fromCharCode(d[O])) === 0, p = o[O] + (m ? 0 : 1), A = x + 1, p > A && (p = A), A = o[O + 1] + 1, p > A && (p = A), o[O] = x;
|
|
1411
|
+
o[O] = p;
|
|
1412
|
+
}
|
|
1413
|
+
return p;
|
|
1414
|
+
}
|
|
1415
|
+
return r.distance(l, c);
|
|
1416
|
+
}
|
|
1417
|
+
};
|
|
1418
|
+
t !== null && t.exports === e ? t.exports = f : typeof self < "u" && typeof self.postMessage == "function" && typeof self.importScripts == "function" ? self.Levenshtein = f : typeof window < "u" && window !== null && (window.Levenshtein = f);
|
|
1419
|
+
})();
|
|
1420
|
+
}(ie, ie.exports)), ie.exports;
|
|
1421
|
+
}
|
|
1422
|
+
var ft = ut();
|
|
1423
|
+
const ct = /* @__PURE__ */ je(ft);
|
|
1409
1424
|
function dt(t, e, n = "git", r = 1) {
|
|
1410
1425
|
switch (n) {
|
|
1411
1426
|
case "git":
|
|
1412
|
-
return
|
|
1427
|
+
return ke(t, e, r);
|
|
1413
1428
|
case "object":
|
|
1414
1429
|
return pt(t, e);
|
|
1415
1430
|
case "json":
|
|
1416
1431
|
return ht(t, e);
|
|
1417
1432
|
default:
|
|
1418
|
-
return
|
|
1433
|
+
return ke(t, e, r);
|
|
1419
1434
|
}
|
|
1420
1435
|
}
|
|
1421
|
-
function
|
|
1422
|
-
const r =
|
|
1436
|
+
function ke(t, e, n = 1) {
|
|
1437
|
+
const r = xe(t), o = xe(e), l = nt(
|
|
1423
1438
|
/* oldFilename */
|
|
1424
1439
|
"",
|
|
1425
1440
|
/* newFilename */
|
|
@@ -1432,15 +1447,15 @@ function Ee(t, e, n = 1) {
|
|
|
1432
1447
|
"",
|
|
1433
1448
|
{ context: n }
|
|
1434
1449
|
).split(`
|
|
1435
|
-
`).filter((
|
|
1436
|
-
for (;
|
|
1437
|
-
for (;
|
|
1438
|
-
|
|
1439
|
-
return
|
|
1450
|
+
`).filter((c) => !c || c === "\" || c.startsWith("@@") || c.startsWith("---") || c.startsWith("+++") || c.startsWith(" ") ? !1 : !!(c.startsWith("+") || c.startsWith("-")));
|
|
1451
|
+
for (; l.length && l[0].trim() === ""; ) l.shift();
|
|
1452
|
+
for (; l.length && l[l.length - 1].trim() === ""; )
|
|
1453
|
+
l.pop();
|
|
1454
|
+
return l.join(`
|
|
1440
1455
|
`);
|
|
1441
1456
|
}
|
|
1442
1457
|
function pt(t, e) {
|
|
1443
|
-
const n =
|
|
1458
|
+
const n = Ce.diff(t, e) || [];
|
|
1444
1459
|
return JSON.stringify(n, null, 2);
|
|
1445
1460
|
}
|
|
1446
1461
|
function ht(t, e) {
|
|
@@ -1454,15 +1469,15 @@ function ht(t, e) {
|
|
|
1454
1469
|
);
|
|
1455
1470
|
}
|
|
1456
1471
|
function mt(t, e) {
|
|
1457
|
-
return typeof t == "string" && typeof e == "string" ?
|
|
1472
|
+
return typeof t == "string" && typeof e == "string" ? Re(t, e) : typeof t == "number" && typeof e == "number" ? Ae(t, e) : bt(t, e);
|
|
1458
1473
|
}
|
|
1459
|
-
function
|
|
1474
|
+
function Re(t, e) {
|
|
1460
1475
|
if (t === e) return 0;
|
|
1461
1476
|
if (t.length === 0 || e.length === 0) return 1;
|
|
1462
|
-
const n =
|
|
1477
|
+
const n = ct.get(t, e), r = Math.max(t.length, e.length);
|
|
1463
1478
|
return n / r;
|
|
1464
1479
|
}
|
|
1465
|
-
function
|
|
1480
|
+
function Ae(t, e) {
|
|
1466
1481
|
if (t === e) return 0;
|
|
1467
1482
|
if (t === 0) return 1;
|
|
1468
1483
|
const n = Math.abs(e - t), r = Math.max(Math.abs(t), Math.abs(e));
|
|
@@ -1470,42 +1485,42 @@ function De(t, e) {
|
|
|
1470
1485
|
}
|
|
1471
1486
|
function bt(t, e) {
|
|
1472
1487
|
if (t === e) return 0;
|
|
1473
|
-
const n =
|
|
1488
|
+
const n = Ce.diff(t, e) || [];
|
|
1474
1489
|
if (n.length === 0) return 0;
|
|
1475
|
-
const r =
|
|
1476
|
-
if (
|
|
1477
|
-
let
|
|
1478
|
-
for (const
|
|
1479
|
-
switch (
|
|
1490
|
+
const r = Ee(t), o = Ee(e), d = Math.max(r, o);
|
|
1491
|
+
if (d === 0) return 0;
|
|
1492
|
+
let f = 0;
|
|
1493
|
+
for (const l of n)
|
|
1494
|
+
switch (l.kind) {
|
|
1480
1495
|
case "N":
|
|
1481
|
-
|
|
1496
|
+
f += 1;
|
|
1482
1497
|
break;
|
|
1483
1498
|
case "D":
|
|
1484
|
-
|
|
1499
|
+
f += 1;
|
|
1485
1500
|
break;
|
|
1486
1501
|
case "E":
|
|
1487
|
-
if (typeof
|
|
1488
|
-
const
|
|
1489
|
-
|
|
1490
|
-
|
|
1502
|
+
if (typeof l.lhs == "string" && typeof l.rhs == "string") {
|
|
1503
|
+
const c = Re(
|
|
1504
|
+
l.lhs,
|
|
1505
|
+
l.rhs
|
|
1491
1506
|
);
|
|
1492
|
-
|
|
1493
|
-
} else if (typeof
|
|
1494
|
-
const
|
|
1495
|
-
|
|
1496
|
-
|
|
1507
|
+
f += c;
|
|
1508
|
+
} else if (typeof l.lhs == "number" && typeof l.rhs == "number") {
|
|
1509
|
+
const c = Ae(
|
|
1510
|
+
l.lhs,
|
|
1511
|
+
l.rhs
|
|
1497
1512
|
);
|
|
1498
|
-
|
|
1513
|
+
f += c;
|
|
1499
1514
|
} else
|
|
1500
|
-
|
|
1515
|
+
f += 1;
|
|
1501
1516
|
break;
|
|
1502
1517
|
case "A":
|
|
1503
|
-
|
|
1518
|
+
f += 0.5;
|
|
1504
1519
|
break;
|
|
1505
1520
|
}
|
|
1506
|
-
return Math.min(
|
|
1521
|
+
return Math.min(f / d, 1);
|
|
1507
1522
|
}
|
|
1508
|
-
function
|
|
1523
|
+
function Ee(t) {
|
|
1509
1524
|
if (t == null) return 0;
|
|
1510
1525
|
if (typeof t != "object") return 1;
|
|
1511
1526
|
if (Array.isArray(t)) return t.length;
|
|
@@ -1514,7 +1529,7 @@ function ke(t) {
|
|
|
1514
1529
|
Object.prototype.hasOwnProperty.call(t, n) && (e += 1);
|
|
1515
1530
|
return e;
|
|
1516
1531
|
}
|
|
1517
|
-
function
|
|
1532
|
+
function xe(t) {
|
|
1518
1533
|
try {
|
|
1519
1534
|
return JSON.stringify(
|
|
1520
1535
|
t,
|
|
@@ -1526,100 +1541,98 @@ function Pe(t) {
|
|
|
1526
1541
|
}
|
|
1527
1542
|
}
|
|
1528
1543
|
function vt(t, e, n) {
|
|
1529
|
-
const r = Te(), o = n?.onFeedback || r,
|
|
1544
|
+
const r = Te(), o = n?.onFeedback || r, d = n?.debounceMs ?? 3e3, f = n?.diffType ?? "git", l = n?.compareWith, c = n?.default_trigger_name ?? "auto_state_change", h = n?.ignoreInitialNullish ?? !0, b = Y(t), P = Y(!0), E = Y(t), x = Y(t == null), p = Y(
|
|
1530
1545
|
t != null
|
|
1531
1546
|
// != null catches both null and undefined
|
|
1532
|
-
),
|
|
1533
|
-
!(
|
|
1534
|
-
),
|
|
1535
|
-
(
|
|
1536
|
-
const
|
|
1537
|
-
let l;
|
|
1538
|
-
n?.vote ? typeof n.vote == "function" ? l = n.vote(E, P, S) : l = n.vote : l = S > 0.5 ? "downvote" : "upvote";
|
|
1539
|
-
const s = typeof e == "function" ? e(P) : e;
|
|
1547
|
+
), k = Y(
|
|
1548
|
+
!(h && t == null)
|
|
1549
|
+
), O = Y(null), A = Y(void 0), m = q(
|
|
1550
|
+
(R, _, N) => {
|
|
1551
|
+
const I = mt(R, _), i = dt(R, _, f), u = typeof n?.score == "function" ? n.score(R, _, I) : n?.score ?? (I > 0.5 ? 0 : 1), s = typeof e == "function" ? e(_) : e;
|
|
1540
1552
|
o({
|
|
1541
1553
|
session_id: s,
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1554
|
+
kind: "edit",
|
|
1555
|
+
source: "human",
|
|
1556
|
+
trigger_name: N,
|
|
1557
|
+
score: u,
|
|
1558
|
+
value: i,
|
|
1559
|
+
confidence: I,
|
|
1560
|
+
metadata: n?.metadata
|
|
1548
1561
|
});
|
|
1549
1562
|
},
|
|
1550
|
-
[n, e,
|
|
1551
|
-
),
|
|
1552
|
-
(
|
|
1553
|
-
const
|
|
1554
|
-
if (
|
|
1555
|
-
clearTimeout(
|
|
1556
|
-
const
|
|
1557
|
-
|
|
1558
|
-
|
|
1563
|
+
[n, e, f, o]
|
|
1564
|
+
), T = q(
|
|
1565
|
+
(R) => {
|
|
1566
|
+
const _ = R || c;
|
|
1567
|
+
if (O.current && A.current && A.current !== _) {
|
|
1568
|
+
clearTimeout(O.current);
|
|
1569
|
+
const N = E.current;
|
|
1570
|
+
m(
|
|
1571
|
+
N,
|
|
1559
1572
|
t,
|
|
1560
1573
|
A.current
|
|
1561
|
-
),
|
|
1574
|
+
), O.current = null;
|
|
1562
1575
|
}
|
|
1563
|
-
A.current =
|
|
1576
|
+
A.current = _;
|
|
1564
1577
|
},
|
|
1565
|
-
[t,
|
|
1578
|
+
[t, c, m]
|
|
1566
1579
|
);
|
|
1567
1580
|
return ce(() => {
|
|
1568
|
-
if (
|
|
1569
|
-
|
|
1581
|
+
if (P.current) {
|
|
1582
|
+
P.current = !1, b.current = t, (!h || t != null) && (E.current = t, k.current = !0);
|
|
1570
1583
|
return;
|
|
1571
1584
|
}
|
|
1572
|
-
const
|
|
1573
|
-
if (!(
|
|
1574
|
-
const
|
|
1575
|
-
!
|
|
1585
|
+
const R = b.current;
|
|
1586
|
+
if (!(l ? l(R, t) : JSON.stringify(R) === JSON.stringify(t))) {
|
|
1587
|
+
const N = h && x.current && // True initial state was nullish
|
|
1588
|
+
!p.current && // We haven't had non-nullish state before
|
|
1576
1589
|
t != null;
|
|
1577
|
-
if (t != null && (
|
|
1578
|
-
|
|
1590
|
+
if (t != null && (p.current = !0), N) {
|
|
1591
|
+
E.current = t, k.current = !0, b.current = t;
|
|
1579
1592
|
return;
|
|
1580
1593
|
}
|
|
1581
|
-
|
|
1582
|
-
const
|
|
1583
|
-
|
|
1584
|
-
|
|
1594
|
+
O.current && clearTimeout(O.current), b.current = t, O.current = setTimeout(() => {
|
|
1595
|
+
const I = E.current, i = t;
|
|
1596
|
+
k.current && m(
|
|
1597
|
+
I,
|
|
1585
1598
|
i,
|
|
1586
|
-
A.current ||
|
|
1587
|
-
),
|
|
1588
|
-
},
|
|
1599
|
+
A.current || c
|
|
1600
|
+
), O.current = null;
|
|
1601
|
+
}, d);
|
|
1589
1602
|
}
|
|
1590
1603
|
return () => {
|
|
1591
|
-
|
|
1604
|
+
O.current && clearTimeout(O.current);
|
|
1592
1605
|
};
|
|
1593
1606
|
}, [
|
|
1594
1607
|
t,
|
|
1595
1608
|
e,
|
|
1596
1609
|
n,
|
|
1597
1610
|
o,
|
|
1598
|
-
p,
|
|
1599
|
-
u,
|
|
1600
|
-
c,
|
|
1601
1611
|
f,
|
|
1602
|
-
|
|
1603
|
-
|
|
1612
|
+
d,
|
|
1613
|
+
l,
|
|
1614
|
+
c,
|
|
1615
|
+
h,
|
|
1616
|
+
m
|
|
1604
1617
|
]), {
|
|
1605
|
-
notifyChange:
|
|
1618
|
+
notifyChange: T
|
|
1606
1619
|
};
|
|
1607
1620
|
}
|
|
1608
|
-
function
|
|
1609
|
-
const [r, o] =
|
|
1610
|
-
(
|
|
1611
|
-
|
|
1621
|
+
function Et(t, e, n) {
|
|
1622
|
+
const [r, o] = X(t), { notifyChange: d } = vt(r, e, n), f = q(
|
|
1623
|
+
(l, c) => {
|
|
1624
|
+
d(c), o((h) => typeof l == "function" ? l(h) : l);
|
|
1612
1625
|
},
|
|
1613
|
-
[
|
|
1626
|
+
[d]
|
|
1614
1627
|
);
|
|
1615
|
-
return [r,
|
|
1628
|
+
return [r, f];
|
|
1616
1629
|
}
|
|
1617
1630
|
export {
|
|
1618
1631
|
ae as KeletContext,
|
|
1619
1632
|
wt as KeletProvider,
|
|
1620
|
-
|
|
1633
|
+
kt as VoteFeedback,
|
|
1621
1634
|
Te as useDefaultFeedbackHandler,
|
|
1622
|
-
|
|
1635
|
+
Et as useFeedbackState,
|
|
1623
1636
|
gt as useKelet
|
|
1624
1637
|
};
|
|
1625
1638
|
//# sourceMappingURL=feedback-ui.es.min.js.map
|