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