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