@metricshift/react 1.3.0 → 1.5.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/dist/index.esm.js CHANGED
@@ -1,5 +1,8 @@
1
- import Je, { useState as Y, useRef as Ue, useEffect as Ve, createContext as gr, useContext as vr } from "react";
2
- var Pe = { exports: {} }, se = {};
1
+ var mr = Object.defineProperty;
2
+ var Sr = (n, o, c) => o in n ? mr(n, o, { enumerable: !0, configurable: !0, writable: !0, value: c }) : n[o] = c;
3
+ var z = (n, o, c) => Sr(n, typeof o != "symbol" ? o + "" : o, c);
4
+ import oe, { useState as Q, useRef as je, useEffect as ae, createContext as jr, useContext as Er } from "react";
5
+ var Ee = { exports: {} }, te = {};
3
6
  /**
4
7
  * @license React
5
8
  * react-jsx-runtime.production.min.js
@@ -9,21 +12,21 @@ var Pe = { exports: {} }, se = {};
9
12
  * This source code is licensed under the MIT license found in the
10
13
  * LICENSE file in the root directory of this source tree.
11
14
  */
12
- var qe;
13
- function hr() {
14
- if (qe) return se;
15
- qe = 1;
16
- var p = Je, m = Symbol.for("react.element"), C = Symbol.for("react.fragment"), c = Object.prototype.hasOwnProperty, b = p.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, o = { key: !0, ref: !0, __self: !0, __source: !0 };
17
- function R(x, g, j) {
18
- var v, S = {}, T = null, F = null;
19
- j !== void 0 && (T = "" + j), g.key !== void 0 && (T = "" + g.key), g.ref !== void 0 && (F = g.ref);
20
- for (v in g) c.call(g, v) && !o.hasOwnProperty(v) && (S[v] = g[v]);
21
- if (x && x.defaultProps) for (v in g = x.defaultProps, g) S[v] === void 0 && (S[v] = g[v]);
22
- return { $$typeof: m, type: x, key: T, ref: F, props: S, _owner: b.current };
15
+ var Ye;
16
+ function wr() {
17
+ if (Ye) return te;
18
+ Ye = 1;
19
+ var n = oe, o = Symbol.for("react.element"), c = Symbol.for("react.fragment"), i = Object.prototype.hasOwnProperty, f = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, t = { key: !0, ref: !0, __self: !0, __source: !0 };
20
+ function l(u, p, g) {
21
+ var v, S = {}, R = null, M = null;
22
+ g !== void 0 && (R = "" + g), p.key !== void 0 && (R = "" + p.key), p.ref !== void 0 && (M = p.ref);
23
+ for (v in p) i.call(p, v) && !t.hasOwnProperty(v) && (S[v] = p[v]);
24
+ if (u && u.defaultProps) for (v in p = u.defaultProps, p) S[v] === void 0 && (S[v] = p[v]);
25
+ return { $$typeof: o, type: u, key: R, ref: M, props: S, _owner: f.current };
23
26
  }
24
- return se.Fragment = C, se.jsx = R, se.jsxs = R, se;
27
+ return te.Fragment = c, te.jsx = l, te.jsxs = l, te;
25
28
  }
26
- var le = {};
29
+ var ne = {};
27
30
  /**
28
31
  * @license React
29
32
  * react-jsx-runtime.development.js
@@ -33,91 +36,91 @@ var le = {};
33
36
  * This source code is licensed under the MIT license found in the
34
37
  * LICENSE file in the root directory of this source tree.
35
38
  */
36
- var He;
37
- function xr() {
38
- return He || (He = 1, process.env.NODE_ENV !== "production" && function() {
39
- var p = Je, m = Symbol.for("react.element"), C = Symbol.for("react.portal"), c = Symbol.for("react.fragment"), b = Symbol.for("react.strict_mode"), o = Symbol.for("react.profiler"), R = Symbol.for("react.provider"), x = Symbol.for("react.context"), g = Symbol.for("react.forward_ref"), j = Symbol.for("react.suspense"), v = Symbol.for("react.suspense_list"), S = Symbol.for("react.memo"), T = Symbol.for("react.lazy"), F = Symbol.for("react.offscreen"), B = Symbol.iterator, A = "@@iterator";
40
- function q(e) {
39
+ var qe;
40
+ function _r() {
41
+ return qe || (qe = 1, process.env.NODE_ENV !== "production" && function() {
42
+ var n = oe, o = Symbol.for("react.element"), c = Symbol.for("react.portal"), i = Symbol.for("react.fragment"), f = Symbol.for("react.strict_mode"), t = Symbol.for("react.profiler"), l = Symbol.for("react.provider"), u = Symbol.for("react.context"), p = Symbol.for("react.forward_ref"), g = Symbol.for("react.suspense"), v = Symbol.for("react.suspense_list"), S = Symbol.for("react.memo"), R = Symbol.for("react.lazy"), M = Symbol.for("react.offscreen"), A = Symbol.iterator, Z = "@@iterator";
43
+ function Y(e) {
41
44
  if (e === null || typeof e != "object")
42
45
  return null;
43
- var r = B && e[B] || e[A];
46
+ var r = A && e[A] || e[Z];
44
47
  return typeof r == "function" ? r : null;
45
48
  }
46
- var I = p.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
47
- function f(e) {
49
+ var _ = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
50
+ function E(e) {
48
51
  {
49
- for (var r = arguments.length, t = new Array(r > 1 ? r - 1 : 0), a = 1; a < r; a++)
50
- t[a - 1] = arguments[a];
51
- re("error", e, t);
52
+ for (var r = arguments.length, a = new Array(r > 1 ? r - 1 : 0), d = 1; d < r; d++)
53
+ a[d - 1] = arguments[d];
54
+ V("error", e, a);
52
55
  }
53
56
  }
54
- function re(e, r, t) {
57
+ function V(e, r, a) {
55
58
  {
56
- var a = I.ReactDebugCurrentFrame, u = a.getStackAddendum();
57
- u !== "" && (r += "%s", t = t.concat([u]));
58
- var d = t.map(function(l) {
59
- return String(l);
59
+ var d = _.ReactDebugCurrentFrame, x = d.getStackAddendum();
60
+ x !== "" && (r += "%s", a = a.concat([x]));
61
+ var b = a.map(function(y) {
62
+ return String(y);
60
63
  });
61
- d.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, d);
64
+ b.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, b);
62
65
  }
63
66
  }
64
- var i = !1, _ = !1, ce = !1, ue = !1, fe = !1, te;
65
- te = Symbol.for("react.module.reference");
66
- function de(e) {
67
- return !!(typeof e == "string" || typeof e == "function" || e === c || e === o || fe || e === b || e === j || e === v || ue || e === F || i || _ || ce || typeof e == "object" && e !== null && (e.$$typeof === T || e.$$typeof === S || e.$$typeof === R || e.$$typeof === x || e.$$typeof === g || // This needs to include all possible module reference object
67
+ var q = !1, W = !1, O = !1, H = !1, J = !1, m;
68
+ m = Symbol.for("react.module.reference");
69
+ function L(e) {
70
+ return !!(typeof e == "string" || typeof e == "function" || e === i || e === t || J || e === f || e === g || e === v || H || e === M || q || W || O || typeof e == "object" && e !== null && (e.$$typeof === R || e.$$typeof === S || e.$$typeof === l || e.$$typeof === u || e.$$typeof === p || // This needs to include all possible module reference object
68
71
  // types supported by any Flight configuration anywhere since
69
72
  // we don't know which Flight build this will end up being used
70
73
  // with.
71
- e.$$typeof === te || e.getModuleId !== void 0));
74
+ e.$$typeof === m || e.getModuleId !== void 0));
72
75
  }
73
- function pe(e, r, t) {
74
- var a = e.displayName;
75
- if (a)
76
- return a;
77
- var u = r.displayName || r.name || "";
78
- return u !== "" ? t + "(" + u + ")" : t;
76
+ function $(e, r, a) {
77
+ var d = e.displayName;
78
+ if (d)
79
+ return d;
80
+ var x = r.displayName || r.name || "";
81
+ return x !== "" ? a + "(" + x + ")" : a;
79
82
  }
80
- function be(e) {
83
+ function K(e) {
81
84
  return e.displayName || "Context";
82
85
  }
83
- function O(e) {
86
+ function F(e) {
84
87
  if (e == null)
85
88
  return null;
86
- if (typeof e.tag == "number" && f("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
89
+ if (typeof e.tag == "number" && E("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
87
90
  return e.displayName || e.name || null;
88
91
  if (typeof e == "string")
89
92
  return e;
90
93
  switch (e) {
91
- case c:
94
+ case i:
92
95
  return "Fragment";
93
- case C:
96
+ case c:
94
97
  return "Portal";
95
- case o:
98
+ case t:
96
99
  return "Profiler";
97
- case b:
100
+ case f:
98
101
  return "StrictMode";
99
- case j:
102
+ case g:
100
103
  return "Suspense";
101
104
  case v:
102
105
  return "SuspenseList";
103
106
  }
104
107
  if (typeof e == "object")
105
108
  switch (e.$$typeof) {
106
- case x:
109
+ case u:
107
110
  var r = e;
108
- return be(r) + ".Consumer";
109
- case R:
110
- var t = e;
111
- return be(t._context) + ".Provider";
112
- case g:
113
- return pe(e, e.render, "ForwardRef");
111
+ return K(r) + ".Consumer";
112
+ case l:
113
+ var a = e;
114
+ return K(a._context) + ".Provider";
115
+ case p:
116
+ return $(e, e.render, "ForwardRef");
114
117
  case S:
115
- var a = e.displayName || null;
116
- return a !== null ? a : O(e.type) || "Memo";
117
- case T: {
118
- var u = e, d = u._payload, l = u._init;
118
+ var d = e.displayName || null;
119
+ return d !== null ? d : F(e.type) || "Memo";
120
+ case R: {
121
+ var x = e, b = x._payload, y = x._init;
119
122
  try {
120
- return O(l(d));
123
+ return F(y(b));
121
124
  } catch {
122
125
  return null;
123
126
  }
@@ -125,18 +128,18 @@ function xr() {
125
128
  }
126
129
  return null;
127
130
  }
128
- var M = Object.assign, L = 0, ge, ve, ne, he, H, xe, J;
129
- function K() {
131
+ var I = Object.assign, B = 0, ee, ie, se, le, D, C, we;
132
+ function _e() {
130
133
  }
131
- K.__reactDisabledLog = !0;
132
- function N() {
134
+ _e.__reactDisabledLog = !0;
135
+ function He() {
133
136
  {
134
- if (L === 0) {
135
- ge = console.log, ve = console.info, ne = console.warn, he = console.error, H = console.group, xe = console.groupCollapsed, J = console.groupEnd;
137
+ if (B === 0) {
138
+ ee = console.log, ie = console.info, se = console.warn, le = console.error, D = console.group, C = console.groupCollapsed, we = console.groupEnd;
136
139
  var e = {
137
140
  configurable: !0,
138
141
  enumerable: !0,
139
- value: K,
142
+ value: _e,
140
143
  writable: !0
141
144
  };
142
145
  Object.defineProperties(console, {
@@ -149,332 +152,332 @@ function xr() {
149
152
  groupEnd: e
150
153
  });
151
154
  }
152
- L++;
155
+ B++;
153
156
  }
154
157
  }
155
- function ae() {
158
+ function Je() {
156
159
  {
157
- if (L--, L === 0) {
160
+ if (B--, B === 0) {
158
161
  var e = {
159
162
  configurable: !0,
160
163
  enumerable: !0,
161
164
  writable: !0
162
165
  };
163
166
  Object.defineProperties(console, {
164
- log: M({}, e, {
165
- value: ge
167
+ log: I({}, e, {
168
+ value: ee
166
169
  }),
167
- info: M({}, e, {
168
- value: ve
170
+ info: I({}, e, {
171
+ value: ie
169
172
  }),
170
- warn: M({}, e, {
171
- value: ne
173
+ warn: I({}, e, {
174
+ value: se
172
175
  }),
173
- error: M({}, e, {
174
- value: he
176
+ error: I({}, e, {
177
+ value: le
175
178
  }),
176
- group: M({}, e, {
177
- value: H
179
+ group: I({}, e, {
180
+ value: D
178
181
  }),
179
- groupCollapsed: M({}, e, {
180
- value: xe
182
+ groupCollapsed: I({}, e, {
183
+ value: C
181
184
  }),
182
- groupEnd: M({}, e, {
183
- value: J
185
+ groupEnd: I({}, e, {
186
+ value: we
184
187
  })
185
188
  });
186
189
  }
187
- L < 0 && f("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
190
+ B < 0 && E("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
188
191
  }
189
192
  }
190
- var W = I.ReactCurrentDispatcher, z;
191
- function $(e, r, t) {
193
+ var pe = _.ReactCurrentDispatcher, he;
194
+ function ce(e, r, a) {
192
195
  {
193
- if (z === void 0)
196
+ if (he === void 0)
194
197
  try {
195
198
  throw Error();
196
- } catch (u) {
197
- var a = u.stack.trim().match(/\n( *(at )?)/);
198
- z = a && a[1] || "";
199
+ } catch (x) {
200
+ var d = x.stack.trim().match(/\n( *(at )?)/);
201
+ he = d && d[1] || "";
199
202
  }
200
203
  return `
201
- ` + z + e;
204
+ ` + he + e;
202
205
  }
203
206
  }
204
- var oe = !1, ie;
207
+ var ge = !1, ue;
205
208
  {
206
- var Se = typeof WeakMap == "function" ? WeakMap : Map;
207
- ie = new Se();
209
+ var Ke = typeof WeakMap == "function" ? WeakMap : Map;
210
+ ue = new Ke();
208
211
  }
209
- function ye(e, r) {
210
- if (!e || oe)
212
+ function Re(e, r) {
213
+ if (!e || ge)
211
214
  return "";
212
215
  {
213
- var t = ie.get(e);
214
- if (t !== void 0)
215
- return t;
216
+ var a = ue.get(e);
217
+ if (a !== void 0)
218
+ return a;
216
219
  }
217
- var a;
218
- oe = !0;
219
- var u = Error.prepareStackTrace;
220
- Error.prepareStackTrace = void 0;
221
220
  var d;
222
- d = W.current, W.current = null, N();
221
+ ge = !0;
222
+ var x = Error.prepareStackTrace;
223
+ Error.prepareStackTrace = void 0;
224
+ var b;
225
+ b = pe.current, pe.current = null, He();
223
226
  try {
224
227
  if (r) {
225
- var l = function() {
228
+ var y = function() {
226
229
  throw Error();
227
230
  };
228
- if (Object.defineProperty(l.prototype, "props", {
231
+ if (Object.defineProperty(y.prototype, "props", {
229
232
  set: function() {
230
233
  throw Error();
231
234
  }
232
235
  }), typeof Reflect == "object" && Reflect.construct) {
233
236
  try {
234
- Reflect.construct(l, []);
235
- } catch (w) {
236
- a = w;
237
+ Reflect.construct(y, []);
238
+ } catch (T) {
239
+ d = T;
237
240
  }
238
- Reflect.construct(e, [], l);
241
+ Reflect.construct(e, [], y);
239
242
  } else {
240
243
  try {
241
- l.call();
242
- } catch (w) {
243
- a = w;
244
+ y.call();
245
+ } catch (T) {
246
+ d = T;
244
247
  }
245
- e.call(l.prototype);
248
+ e.call(y.prototype);
246
249
  }
247
250
  } else {
248
251
  try {
249
252
  throw Error();
250
- } catch (w) {
251
- a = w;
253
+ } catch (T) {
254
+ d = T;
252
255
  }
253
256
  e();
254
257
  }
255
- } catch (w) {
256
- if (w && a && typeof w.stack == "string") {
257
- for (var s = w.stack.split(`
258
- `), k = a.stack.split(`
259
- `), h = s.length - 1, y = k.length - 1; h >= 1 && y >= 0 && s[h] !== k[y]; )
260
- y--;
261
- for (; h >= 1 && y >= 0; h--, y--)
262
- if (s[h] !== k[y]) {
263
- if (h !== 1 || y !== 1)
258
+ } catch (T) {
259
+ if (T && d && typeof T.stack == "string") {
260
+ for (var h = T.stack.split(`
261
+ `), k = d.stack.split(`
262
+ `), j = h.length - 1, w = k.length - 1; j >= 1 && w >= 0 && h[j] !== k[w]; )
263
+ w--;
264
+ for (; j >= 1 && w >= 0; j--, w--)
265
+ if (h[j] !== k[w]) {
266
+ if (j !== 1 || w !== 1)
264
267
  do
265
- if (h--, y--, y < 0 || s[h] !== k[y]) {
268
+ if (j--, w--, w < 0 || h[j] !== k[w]) {
266
269
  var P = `
267
- ` + s[h].replace(" at new ", " at ");
268
- return e.displayName && P.includes("<anonymous>") && (P = P.replace("<anonymous>", e.displayName)), typeof e == "function" && ie.set(e, P), P;
270
+ ` + h[j].replace(" at new ", " at ");
271
+ return e.displayName && P.includes("<anonymous>") && (P = P.replace("<anonymous>", e.displayName)), typeof e == "function" && ue.set(e, P), P;
269
272
  }
270
- while (h >= 1 && y >= 0);
273
+ while (j >= 1 && w >= 0);
271
274
  break;
272
275
  }
273
276
  }
274
277
  } finally {
275
- oe = !1, W.current = d, ae(), Error.prepareStackTrace = u;
278
+ ge = !1, pe.current = b, Je(), Error.prepareStackTrace = x;
276
279
  }
277
- var ee = e ? e.displayName || e.name : "", V = ee ? $(ee) : "";
278
- return typeof e == "function" && ie.set(e, V), V;
280
+ var X = e ? e.displayName || e.name : "", N = X ? ce(X) : "";
281
+ return typeof e == "function" && ue.set(e, N), N;
279
282
  }
280
- function ke(e, r, t) {
281
- return ye(e, !1);
283
+ function Ge(e, r, a) {
284
+ return Re(e, !1);
282
285
  }
283
- function Re(e) {
286
+ function Xe(e) {
284
287
  var r = e.prototype;
285
288
  return !!(r && r.isReactComponent);
286
289
  }
287
- function G(e, r, t) {
290
+ function fe(e, r, a) {
288
291
  if (e == null)
289
292
  return "";
290
293
  if (typeof e == "function")
291
- return ye(e, Re(e));
294
+ return Re(e, Xe(e));
292
295
  if (typeof e == "string")
293
- return $(e);
296
+ return ce(e);
294
297
  switch (e) {
295
- case j:
296
- return $("Suspense");
298
+ case g:
299
+ return ce("Suspense");
297
300
  case v:
298
- return $("SuspenseList");
301
+ return ce("SuspenseList");
299
302
  }
300
303
  if (typeof e == "object")
301
304
  switch (e.$$typeof) {
302
- case g:
303
- return ke(e.render);
305
+ case p:
306
+ return Ge(e.render);
304
307
  case S:
305
- return G(e.type, r, t);
306
- case T: {
307
- var a = e, u = a._payload, d = a._init;
308
+ return fe(e.type, r, a);
309
+ case R: {
310
+ var d = e, x = d._payload, b = d._init;
308
311
  try {
309
- return G(d(u), r, t);
312
+ return fe(b(x), r, a);
310
313
  } catch {
311
314
  }
312
315
  }
313
316
  }
314
317
  return "";
315
318
  }
316
- var U = Object.prototype.hasOwnProperty, me = {}, Ee = I.ReactDebugCurrentFrame;
317
- function X(e) {
319
+ var re = Object.prototype.hasOwnProperty, ke = {}, Ce = _.ReactDebugCurrentFrame;
320
+ function de(e) {
318
321
  if (e) {
319
- var r = e._owner, t = G(e.type, e._source, r ? r.type : null);
320
- Ee.setExtraStackFrame(t);
322
+ var r = e._owner, a = fe(e.type, e._source, r ? r.type : null);
323
+ Ce.setExtraStackFrame(a);
321
324
  } else
322
- Ee.setExtraStackFrame(null);
325
+ Ce.setExtraStackFrame(null);
323
326
  }
324
- function Oe(e, r, t, a, u) {
327
+ function Qe(e, r, a, d, x) {
325
328
  {
326
- var d = Function.call.bind(U);
327
- for (var l in e)
328
- if (d(e, l)) {
329
- var s = void 0;
329
+ var b = Function.call.bind(re);
330
+ for (var y in e)
331
+ if (b(e, y)) {
332
+ var h = void 0;
330
333
  try {
331
- if (typeof e[l] != "function") {
332
- var k = Error((a || "React class") + ": " + t + " type `" + l + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[l] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
334
+ if (typeof e[y] != "function") {
335
+ var k = Error((d || "React class") + ": " + a + " type `" + y + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[y] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
333
336
  throw k.name = "Invariant Violation", k;
334
337
  }
335
- s = e[l](r, l, a, t, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
336
- } catch (h) {
337
- s = h;
338
+ h = e[y](r, y, d, a, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
339
+ } catch (j) {
340
+ h = j;
338
341
  }
339
- s && !(s instanceof Error) && (X(u), f("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", a || "React class", t, l, typeof s), X(null)), s instanceof Error && !(s.message in me) && (me[s.message] = !0, X(u), f("Failed %s type: %s", t, s.message), X(null));
342
+ h && !(h instanceof Error) && (de(x), E("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", d || "React class", a, y, typeof h), de(null)), h instanceof Error && !(h.message in ke) && (ke[h.message] = !0, de(x), E("Failed %s type: %s", a, h.message), de(null));
340
343
  }
341
344
  }
342
345
  }
343
- var E = Array.isArray;
344
- function D(e) {
345
- return E(e);
346
+ var Ze = Array.isArray;
347
+ function ye(e) {
348
+ return Ze(e);
346
349
  }
347
- function Q(e) {
350
+ function er(e) {
348
351
  {
349
- var r = typeof Symbol == "function" && Symbol.toStringTag, t = r && e[Symbol.toStringTag] || e.constructor.name || "Object";
350
- return t;
352
+ var r = typeof Symbol == "function" && Symbol.toStringTag, a = r && e[Symbol.toStringTag] || e.constructor.name || "Object";
353
+ return a;
351
354
  }
352
355
  }
353
- function Ge(e) {
356
+ function rr(e) {
354
357
  try {
355
- return Fe(e), !1;
358
+ return Te(e), !1;
356
359
  } catch {
357
360
  return !0;
358
361
  }
359
362
  }
360
- function Fe(e) {
363
+ function Te(e) {
361
364
  return "" + e;
362
365
  }
363
- function Ie(e) {
364
- if (Ge(e))
365
- return f("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Q(e)), Fe(e);
366
+ function Pe(e) {
367
+ if (rr(e))
368
+ return E("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", er(e)), Te(e);
366
369
  }
367
- var Me = I.ReactCurrentOwner, Xe = {
370
+ var Oe = _.ReactCurrentOwner, tr = {
368
371
  key: !0,
369
372
  ref: !0,
370
373
  __self: !0,
371
374
  __source: !0
372
- }, Ae, De;
373
- function Qe(e) {
374
- if (U.call(e, "ref")) {
375
+ }, Fe, Ie;
376
+ function nr(e) {
377
+ if (re.call(e, "ref")) {
375
378
  var r = Object.getOwnPropertyDescriptor(e, "ref").get;
376
379
  if (r && r.isReactWarning)
377
380
  return !1;
378
381
  }
379
382
  return e.ref !== void 0;
380
383
  }
381
- function Ze(e) {
382
- if (U.call(e, "key")) {
384
+ function or(e) {
385
+ if (re.call(e, "key")) {
383
386
  var r = Object.getOwnPropertyDescriptor(e, "key").get;
384
387
  if (r && r.isReactWarning)
385
388
  return !1;
386
389
  }
387
390
  return e.key !== void 0;
388
391
  }
389
- function er(e, r) {
390
- typeof e.ref == "string" && Me.current;
392
+ function ar(e, r) {
393
+ typeof e.ref == "string" && Oe.current;
391
394
  }
392
- function rr(e, r) {
395
+ function ir(e, r) {
393
396
  {
394
- var t = function() {
395
- Ae || (Ae = !0, f("%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://reactjs.org/link/special-props)", r));
397
+ var a = function() {
398
+ Fe || (Fe = !0, E("%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://reactjs.org/link/special-props)", r));
396
399
  };
397
- t.isReactWarning = !0, Object.defineProperty(e, "key", {
398
- get: t,
400
+ a.isReactWarning = !0, Object.defineProperty(e, "key", {
401
+ get: a,
399
402
  configurable: !0
400
403
  });
401
404
  }
402
405
  }
403
- function tr(e, r) {
406
+ function sr(e, r) {
404
407
  {
405
- var t = function() {
406
- De || (De = !0, f("%s: `ref` 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://reactjs.org/link/special-props)", r));
408
+ var a = function() {
409
+ Ie || (Ie = !0, E("%s: `ref` 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://reactjs.org/link/special-props)", r));
407
410
  };
408
- t.isReactWarning = !0, Object.defineProperty(e, "ref", {
409
- get: t,
411
+ a.isReactWarning = !0, Object.defineProperty(e, "ref", {
412
+ get: a,
410
413
  configurable: !0
411
414
  });
412
415
  }
413
416
  }
414
- var nr = function(e, r, t, a, u, d, l) {
415
- var s = {
417
+ var lr = function(e, r, a, d, x, b, y) {
418
+ var h = {
416
419
  // This tag allows us to uniquely identify this as a React Element
417
- $$typeof: m,
420
+ $$typeof: o,
418
421
  // Built-in properties that belong on the element
419
422
  type: e,
420
423
  key: r,
421
- ref: t,
422
- props: l,
424
+ ref: a,
425
+ props: y,
423
426
  // Record the component responsible for creating this element.
424
- _owner: d
427
+ _owner: b
425
428
  };
426
- return s._store = {}, Object.defineProperty(s._store, "validated", {
429
+ return h._store = {}, Object.defineProperty(h._store, "validated", {
427
430
  configurable: !1,
428
431
  enumerable: !1,
429
432
  writable: !0,
430
433
  value: !1
431
- }), Object.defineProperty(s, "_self", {
434
+ }), Object.defineProperty(h, "_self", {
432
435
  configurable: !1,
433
436
  enumerable: !1,
434
437
  writable: !1,
435
- value: a
436
- }), Object.defineProperty(s, "_source", {
438
+ value: d
439
+ }), Object.defineProperty(h, "_source", {
437
440
  configurable: !1,
438
441
  enumerable: !1,
439
442
  writable: !1,
440
- value: u
441
- }), Object.freeze && (Object.freeze(s.props), Object.freeze(s)), s;
443
+ value: x
444
+ }), Object.freeze && (Object.freeze(h.props), Object.freeze(h)), h;
442
445
  };
443
- function ar(e, r, t, a, u) {
446
+ function cr(e, r, a, d, x) {
444
447
  {
445
- var d, l = {}, s = null, k = null;
446
- t !== void 0 && (Ie(t), s = "" + t), Ze(r) && (Ie(r.key), s = "" + r.key), Qe(r) && (k = r.ref, er(r, u));
447
- for (d in r)
448
- U.call(r, d) && !Xe.hasOwnProperty(d) && (l[d] = r[d]);
448
+ var b, y = {}, h = null, k = null;
449
+ a !== void 0 && (Pe(a), h = "" + a), or(r) && (Pe(r.key), h = "" + r.key), nr(r) && (k = r.ref, ar(r, x));
450
+ for (b in r)
451
+ re.call(r, b) && !tr.hasOwnProperty(b) && (y[b] = r[b]);
449
452
  if (e && e.defaultProps) {
450
- var h = e.defaultProps;
451
- for (d in h)
452
- l[d] === void 0 && (l[d] = h[d]);
453
+ var j = e.defaultProps;
454
+ for (b in j)
455
+ y[b] === void 0 && (y[b] = j[b]);
453
456
  }
454
- if (s || k) {
455
- var y = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
456
- s && rr(l, y), k && tr(l, y);
457
+ if (h || k) {
458
+ var w = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
459
+ h && ir(y, w), k && sr(y, w);
457
460
  }
458
- return nr(e, s, k, u, a, Me.current, l);
461
+ return lr(e, h, k, x, d, Oe.current, y);
459
462
  }
460
463
  }
461
- var je = I.ReactCurrentOwner, We = I.ReactDebugCurrentFrame;
462
- function Z(e) {
464
+ var xe = _.ReactCurrentOwner, Me = _.ReactDebugCurrentFrame;
465
+ function G(e) {
463
466
  if (e) {
464
- var r = e._owner, t = G(e.type, e._source, r ? r.type : null);
465
- We.setExtraStackFrame(t);
467
+ var r = e._owner, a = fe(e.type, e._source, r ? r.type : null);
468
+ Me.setExtraStackFrame(a);
466
469
  } else
467
- We.setExtraStackFrame(null);
470
+ Me.setExtraStackFrame(null);
468
471
  }
469
- var _e;
470
- _e = !1;
471
- function we(e) {
472
- return typeof e == "object" && e !== null && e.$$typeof === m;
472
+ var ve;
473
+ ve = !1;
474
+ function be(e) {
475
+ return typeof e == "object" && e !== null && e.$$typeof === o;
473
476
  }
474
- function ze() {
477
+ function Ae() {
475
478
  {
476
- if (je.current) {
477
- var e = O(je.current.type);
479
+ if (xe.current) {
480
+ var e = F(xe.current.type);
478
481
  if (e)
479
482
  return `
480
483
 
@@ -483,281 +486,774 @@ Check the render method of \`` + e + "`.";
483
486
  return "";
484
487
  }
485
488
  }
486
- function or(e) {
489
+ function ur(e) {
487
490
  return "";
488
491
  }
489
492
  var $e = {};
490
- function ir(e) {
493
+ function fr(e) {
491
494
  {
492
- var r = ze();
495
+ var r = Ae();
493
496
  if (!r) {
494
- var t = typeof e == "string" ? e : e.displayName || e.name;
495
- t && (r = `
497
+ var a = typeof e == "string" ? e : e.displayName || e.name;
498
+ a && (r = `
496
499
 
497
- Check the top-level render call using <` + t + ">.");
500
+ Check the top-level render call using <` + a + ">.");
498
501
  }
499
502
  return r;
500
503
  }
501
504
  }
502
- function Ye(e, r) {
505
+ function De(e, r) {
503
506
  {
504
507
  if (!e._store || e._store.validated || e.key != null)
505
508
  return;
506
509
  e._store.validated = !0;
507
- var t = ir(r);
508
- if ($e[t])
510
+ var a = fr(r);
511
+ if ($e[a])
509
512
  return;
510
- $e[t] = !0;
511
- var a = "";
512
- e && e._owner && e._owner !== je.current && (a = " It was passed a child from " + O(e._owner.type) + "."), Z(e), f('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', t, a), Z(null);
513
+ $e[a] = !0;
514
+ var d = "";
515
+ e && e._owner && e._owner !== xe.current && (d = " It was passed a child from " + F(e._owner.type) + "."), G(e), E('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', a, d), G(null);
513
516
  }
514
517
  }
515
- function Be(e, r) {
518
+ function We(e, r) {
516
519
  {
517
520
  if (typeof e != "object")
518
521
  return;
519
- if (D(e))
520
- for (var t = 0; t < e.length; t++) {
521
- var a = e[t];
522
- we(a) && Ye(a, r);
522
+ if (ye(e))
523
+ for (var a = 0; a < e.length; a++) {
524
+ var d = e[a];
525
+ be(d) && De(d, r);
523
526
  }
524
- else if (we(e))
527
+ else if (be(e))
525
528
  e._store && (e._store.validated = !0);
526
529
  else if (e) {
527
- var u = q(e);
528
- if (typeof u == "function" && u !== e.entries)
529
- for (var d = u.call(e), l; !(l = d.next()).done; )
530
- we(l.value) && Ye(l.value, r);
530
+ var x = Y(e);
531
+ if (typeof x == "function" && x !== e.entries)
532
+ for (var b = x.call(e), y; !(y = b.next()).done; )
533
+ be(y.value) && De(y.value, r);
531
534
  }
532
535
  }
533
536
  }
534
- function sr(e) {
537
+ function dr(e) {
535
538
  {
536
539
  var r = e.type;
537
540
  if (r == null || typeof r == "string")
538
541
  return;
539
- var t;
542
+ var a;
540
543
  if (typeof r == "function")
541
- t = r.propTypes;
542
- else if (typeof r == "object" && (r.$$typeof === g || // Note: Memo only checks outer props here.
544
+ a = r.propTypes;
545
+ else if (typeof r == "object" && (r.$$typeof === p || // Note: Memo only checks outer props here.
543
546
  // Inner props are checked in the reconciler.
544
547
  r.$$typeof === S))
545
- t = r.propTypes;
548
+ a = r.propTypes;
546
549
  else
547
550
  return;
548
- if (t) {
549
- var a = O(r);
550
- Oe(t, e.props, "prop", a, e);
551
- } else if (r.PropTypes !== void 0 && !_e) {
552
- _e = !0;
553
- var u = O(r);
554
- f("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", u || "Unknown");
551
+ if (a) {
552
+ var d = F(r);
553
+ Qe(a, e.props, "prop", d, e);
554
+ } else if (r.PropTypes !== void 0 && !ve) {
555
+ ve = !0;
556
+ var x = F(r);
557
+ E("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", x || "Unknown");
555
558
  }
556
- typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && f("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
559
+ typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && E("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
557
560
  }
558
561
  }
559
- function lr(e) {
562
+ function pr(e) {
560
563
  {
561
- for (var r = Object.keys(e.props), t = 0; t < r.length; t++) {
562
- var a = r[t];
563
- if (a !== "children" && a !== "key") {
564
- Z(e), f("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", a), Z(null);
564
+ for (var r = Object.keys(e.props), a = 0; a < r.length; a++) {
565
+ var d = r[a];
566
+ if (d !== "children" && d !== "key") {
567
+ G(e), E("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", d), G(null);
565
568
  break;
566
569
  }
567
570
  }
568
- e.ref !== null && (Z(e), f("Invalid attribute `ref` supplied to `React.Fragment`."), Z(null));
571
+ e.ref !== null && (G(e), E("Invalid attribute `ref` supplied to `React.Fragment`."), G(null));
569
572
  }
570
573
  }
571
574
  var Le = {};
572
- function Ne(e, r, t, a, u, d) {
575
+ function ze(e, r, a, d, x, b) {
573
576
  {
574
- var l = de(e);
575
- if (!l) {
576
- var s = "";
577
- (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (s += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
578
- var k = or();
579
- k ? s += k : s += ze();
580
- var h;
581
- e === null ? h = "null" : D(e) ? h = "array" : e !== void 0 && e.$$typeof === m ? (h = "<" + (O(e.type) || "Unknown") + " />", s = " Did you accidentally export a JSX literal instead of a component?") : h = typeof e, f("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", h, s);
577
+ var y = L(e);
578
+ if (!y) {
579
+ var h = "";
580
+ (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (h += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
581
+ var k = ur();
582
+ k ? h += k : h += Ae();
583
+ var j;
584
+ e === null ? j = "null" : ye(e) ? j = "array" : e !== void 0 && e.$$typeof === o ? (j = "<" + (F(e.type) || "Unknown") + " />", h = " Did you accidentally export a JSX literal instead of a component?") : j = typeof e, E("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", j, h);
582
585
  }
583
- var y = ar(e, r, t, u, d);
584
- if (y == null)
585
- return y;
586
- if (l) {
586
+ var w = cr(e, r, a, x, b);
587
+ if (w == null)
588
+ return w;
589
+ if (y) {
587
590
  var P = r.children;
588
591
  if (P !== void 0)
589
- if (a)
590
- if (D(P)) {
591
- for (var ee = 0; ee < P.length; ee++)
592
- Be(P[ee], e);
592
+ if (d)
593
+ if (ye(P)) {
594
+ for (var X = 0; X < P.length; X++)
595
+ We(P[X], e);
593
596
  Object.freeze && Object.freeze(P);
594
597
  } else
595
- f("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
598
+ E("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
596
599
  else
597
- Be(P, e);
600
+ We(P, e);
598
601
  }
599
- if (U.call(r, "key")) {
600
- var V = O(e), w = Object.keys(r).filter(function(br) {
602
+ if (re.call(r, "key")) {
603
+ var N = F(e), T = Object.keys(r).filter(function(br) {
601
604
  return br !== "key";
602
- }), Ce = w.length > 0 ? "{key: someKey, " + w.join(": ..., ") + ": ...}" : "{key: someKey}";
603
- if (!Le[V + Ce]) {
604
- var pr = w.length > 0 ? "{" + w.join(": ..., ") + ": ...}" : "{}";
605
- f(`A props object containing a "key" prop is being spread into JSX:
605
+ }), me = T.length > 0 ? "{key: someKey, " + T.join(": ..., ") + ": ...}" : "{key: someKey}";
606
+ if (!Le[N + me]) {
607
+ var vr = T.length > 0 ? "{" + T.join(": ..., ") + ": ...}" : "{}";
608
+ E(`A props object containing a "key" prop is being spread into JSX:
606
609
  let props = %s;
607
610
  <%s {...props} />
608
611
  React keys must be passed directly to JSX without using spread:
609
612
  let props = %s;
610
- <%s key={someKey} {...props} />`, Ce, V, pr, V), Le[V + Ce] = !0;
613
+ <%s key={someKey} {...props} />`, me, N, vr, N), Le[N + me] = !0;
611
614
  }
612
615
  }
613
- return e === c ? lr(y) : sr(y), y;
616
+ return e === i ? pr(w) : dr(w), w;
614
617
  }
615
618
  }
616
- function cr(e, r, t) {
617
- return Ne(e, r, t, !0);
619
+ function hr(e, r, a) {
620
+ return ze(e, r, a, !0);
618
621
  }
619
- function ur(e, r, t) {
620
- return Ne(e, r, t, !1);
622
+ function gr(e, r, a) {
623
+ return ze(e, r, a, !1);
621
624
  }
622
- var fr = ur, dr = cr;
623
- le.Fragment = c, le.jsx = fr, le.jsxs = dr;
624
- }()), le;
625
+ var yr = gr, xr = hr;
626
+ ne.Fragment = i, ne.jsx = yr, ne.jsxs = xr;
627
+ }()), ne;
625
628
  }
626
- process.env.NODE_ENV === "production" ? Pe.exports = hr() : Pe.exports = xr();
627
- var n = Pe.exports;
628
- const yr = ({
629
- isOpen: p,
630
- onClose: m,
631
- onSubmit: C
629
+ process.env.NODE_ENV === "production" ? Ee.exports = wr() : Ee.exports = _r();
630
+ var s = Ee.exports;
631
+ const Rr = ({ label: n, fieldId: o, required: c, children: i }) => /* @__PURE__ */ s.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "6px" }, children: [
632
+ /* @__PURE__ */ s.jsxs(
633
+ "label",
634
+ {
635
+ htmlFor: o,
636
+ style: {
637
+ fontSize: "13px",
638
+ fontWeight: 500,
639
+ color: "#374151"
640
+ },
641
+ children: [
642
+ n,
643
+ c && /* @__PURE__ */ s.jsx("span", { style: { color: "#ef4444", marginLeft: "3px" }, children: "*" })
644
+ ]
645
+ }
646
+ ),
647
+ i
648
+ ] }), Be = ({ field: n, value: o, onChange: c, disabled: i, multiline: f }) => {
649
+ const t = {
650
+ width: "100%",
651
+ padding: "8px 10px",
652
+ border: "1px solid #e5e7eb",
653
+ borderRadius: "8px",
654
+ fontSize: "14px",
655
+ fontFamily: "inherit",
656
+ outline: "none",
657
+ opacity: i ? 0.6 : 1,
658
+ boxSizing: "border-box",
659
+ transition: "border-color 0.15s"
660
+ };
661
+ return f ? /* @__PURE__ */ s.jsx(
662
+ "textarea",
663
+ {
664
+ id: n.id,
665
+ value: o,
666
+ placeholder: n.placeholder,
667
+ required: n.required,
668
+ disabled: i,
669
+ rows: 4,
670
+ onChange: (l) => c(l.target.value),
671
+ style: { ...t, resize: "vertical", minHeight: "88px" },
672
+ onFocus: (l) => l.target.style.borderColor = "#3b82f6",
673
+ onBlur: (l) => l.target.style.borderColor = "#e5e7eb"
674
+ }
675
+ ) : /* @__PURE__ */ s.jsx(
676
+ "input",
677
+ {
678
+ id: n.id,
679
+ type: n.id.includes("email") ? "email" : "text",
680
+ value: o,
681
+ placeholder: n.placeholder,
682
+ required: n.required,
683
+ disabled: i,
684
+ onChange: (l) => c(l.target.value),
685
+ style: t,
686
+ onFocus: (l) => l.target.style.borderColor = "#3b82f6",
687
+ onBlur: (l) => l.target.style.borderColor = "#e5e7eb"
688
+ }
689
+ );
690
+ }, kr = ({ field: n, value: o, onChange: c, disabled: i, primaryColor: f = "#fbbf24" }) => /* @__PURE__ */ s.jsx(
691
+ "div",
692
+ {
693
+ role: "group",
694
+ "aria-label": n.label,
695
+ style: { display: "flex", gap: "6px" },
696
+ children: [1, 2, 3, 4, 5].map((t) => /* @__PURE__ */ s.jsx(
697
+ "button",
698
+ {
699
+ type: "button",
700
+ disabled: i,
701
+ "aria-label": `Rate ${t} stars`,
702
+ "aria-pressed": o === t,
703
+ onClick: () => c(t),
704
+ style: {
705
+ background: "none",
706
+ border: "none",
707
+ fontSize: "26px",
708
+ cursor: i ? "not-allowed" : "pointer",
709
+ padding: "0",
710
+ color: o !== null && o >= t ? f : "#d1d5db",
711
+ transition: "transform 0.15s, color 0.15s",
712
+ opacity: i ? 0.6 : 1
713
+ },
714
+ onMouseEnter: (l) => {
715
+ i || (l.currentTarget.style.transform = "scale(1.2)");
716
+ },
717
+ onMouseLeave: (l) => {
718
+ i || (l.currentTarget.style.transform = "scale(1)");
719
+ },
720
+ children: "★"
721
+ },
722
+ t
723
+ ))
724
+ }
725
+ ), Cr = ({ field: n, value: o, onChange: c, disabled: i }) => /* @__PURE__ */ s.jsxs("div", { children: [
726
+ /* @__PURE__ */ s.jsx(
727
+ "div",
728
+ {
729
+ style: {
730
+ display: "flex",
731
+ gap: "4px",
732
+ flexWrap: "wrap"
733
+ },
734
+ children: Array.from({ length: 11 }, (f, t) => {
735
+ const l = o === t, u = t >= 9 ? "#16a34a" : t >= 7 ? "#d97706" : "#dc2626";
736
+ return /* @__PURE__ */ s.jsx(
737
+ "button",
738
+ {
739
+ type: "button",
740
+ disabled: i,
741
+ "aria-label": `Score ${t}`,
742
+ "aria-pressed": l,
743
+ onClick: () => c(t),
744
+ style: {
745
+ width: "40px",
746
+ height: "40px",
747
+ borderRadius: "8px",
748
+ border: `1.5px solid ${l ? u : "#e5e7eb"}`,
749
+ backgroundColor: l ? u : "#ffffff",
750
+ color: l ? "#ffffff" : "#374151",
751
+ fontSize: "13px",
752
+ fontWeight: 600,
753
+ cursor: i ? "not-allowed" : "pointer",
754
+ opacity: i ? 0.6 : 1,
755
+ transition: "all 0.15s",
756
+ flexShrink: 0
757
+ },
758
+ onMouseEnter: (p) => {
759
+ !i && !l && (p.currentTarget.style.borderColor = u, p.currentTarget.style.backgroundColor = `${u}10`);
760
+ },
761
+ onMouseLeave: (p) => {
762
+ !i && !l && (p.currentTarget.style.borderColor = "#e5e7eb", p.currentTarget.style.backgroundColor = "#ffffff");
763
+ },
764
+ children: t
765
+ },
766
+ t
767
+ );
768
+ })
769
+ }
770
+ ),
771
+ /* @__PURE__ */ s.jsxs(
772
+ "div",
773
+ {
774
+ style: {
775
+ display: "flex",
776
+ justifyContent: "space-between",
777
+ marginTop: "6px",
778
+ fontSize: "11px",
779
+ color: "#9ca3af"
780
+ },
781
+ children: [
782
+ /* @__PURE__ */ s.jsx("span", { children: n.lowLabel ?? "Not likely" }),
783
+ /* @__PURE__ */ s.jsx("span", { children: n.highLabel ?? "Very likely" })
784
+ ]
785
+ }
786
+ )
787
+ ] }), Tr = [
788
+ "😞",
789
+ "😕",
790
+ "😐",
791
+ "😊",
792
+ "😄"
793
+ ], Pr = ({ field: n, value: o, onChange: c, disabled: i }) => {
794
+ const f = n.emojiScale ?? Tr;
795
+ return /* @__PURE__ */ s.jsx("div", { style: { display: "flex", gap: "8px", justifyContent: "center" }, children: f.map((t, l) => {
796
+ const u = l + 1, p = o === u;
797
+ return /* @__PURE__ */ s.jsx(
798
+ "button",
799
+ {
800
+ type: "button",
801
+ disabled: i,
802
+ "aria-label": `Score ${u}`,
803
+ "aria-pressed": p,
804
+ onClick: () => c(u),
805
+ style: {
806
+ background: "none",
807
+ border: `1.5px solid ${p ? "#6b7280" : "transparent"}`,
808
+ borderRadius: "12px",
809
+ padding: "6px 8px",
810
+ fontSize: "28px",
811
+ cursor: i ? "not-allowed" : "pointer",
812
+ opacity: i ? 0.6 : p ? 1 : 0.5,
813
+ transform: p ? "scale(1.2)" : "scale(1)",
814
+ transition: "all 0.15s"
815
+ },
816
+ onMouseEnter: (g) => {
817
+ i || (g.currentTarget.style.opacity = "1");
818
+ },
819
+ onMouseLeave: (g) => {
820
+ i || (g.currentTarget.style.opacity = p ? "1" : "0.5");
821
+ },
822
+ children: t
823
+ },
824
+ u
825
+ );
826
+ }) });
827
+ }, Or = ({ field: n, value: o, onChange: c, disabled: i }) => /* @__PURE__ */ s.jsxs(
828
+ "select",
829
+ {
830
+ id: n.id,
831
+ value: o,
832
+ disabled: i,
833
+ required: n.required,
834
+ onChange: (f) => c(f.target.value),
835
+ style: {
836
+ width: "100%",
837
+ padding: "8px 10px",
838
+ border: "1px solid #e5e7eb",
839
+ borderRadius: "8px",
840
+ fontSize: "14px",
841
+ fontFamily: "inherit",
842
+ backgroundColor: "#ffffff",
843
+ cursor: i ? "not-allowed" : "pointer",
844
+ opacity: i ? 0.6 : 1,
845
+ outline: "none"
846
+ },
847
+ children: [
848
+ /* @__PURE__ */ s.jsx("option", { value: "", children: "Select an option…" }),
849
+ (n.options ?? []).map((f) => /* @__PURE__ */ s.jsx("option", { value: f, children: f }, f))
850
+ ]
851
+ }
852
+ ), Fr = ({ field: n, value: o, onChange: c, disabled: i }) => {
853
+ const f = (t) => {
854
+ const l = o.includes(t) ? o.filter((u) => u !== t) : [...o, t];
855
+ c(l);
856
+ };
857
+ return /* @__PURE__ */ s.jsx("div", { style: { display: "flex", flexDirection: "column", gap: "6px" }, children: (n.options ?? []).map((t) => /* @__PURE__ */ s.jsxs(
858
+ "label",
859
+ {
860
+ style: {
861
+ display: "flex",
862
+ alignItems: "center",
863
+ gap: "8px",
864
+ fontSize: "14px",
865
+ color: "#374151",
866
+ cursor: i ? "not-allowed" : "pointer",
867
+ opacity: i ? 0.6 : 1
868
+ },
869
+ children: [
870
+ /* @__PURE__ */ s.jsx(
871
+ "input",
872
+ {
873
+ type: "checkbox",
874
+ checked: o.includes(t),
875
+ disabled: i,
876
+ onChange: () => f(t),
877
+ style: { width: "15px", height: "15px", cursor: "inherit" }
878
+ }
879
+ ),
880
+ t
881
+ ]
882
+ },
883
+ t
884
+ )) });
885
+ }, Ir = ({ value: n, onChange: o, disabled: c, primaryColor: i = "#3b82f6" }) => /* @__PURE__ */ s.jsx("div", { style: { display: "flex", gap: "10px" }, children: [
886
+ { label: "Yes", val: !0 },
887
+ { label: "No", val: !1 }
888
+ ].map(({ label: f, val: t }) => {
889
+ const l = n === t;
890
+ return /* @__PURE__ */ s.jsx(
891
+ "button",
892
+ {
893
+ type: "button",
894
+ disabled: c,
895
+ onClick: () => o(t),
896
+ style: {
897
+ padding: "8px 24px",
898
+ borderRadius: "8px",
899
+ border: `1.5px solid ${l ? i : "#e5e7eb"}`,
900
+ backgroundColor: l ? i : "#ffffff",
901
+ color: l ? "#ffffff" : "#374151",
902
+ fontSize: "14px",
903
+ fontWeight: 500,
904
+ cursor: c ? "not-allowed" : "pointer",
905
+ opacity: c ? 0.6 : 1,
906
+ transition: "all 0.15s"
907
+ },
908
+ children: f
909
+ },
910
+ f
911
+ );
912
+ }) }), Mr = ({
913
+ fields: n,
914
+ values: o,
915
+ onChange: c,
916
+ disabled: i = !1,
917
+ primaryColor: f
918
+ }) => /* @__PURE__ */ s.jsx("div", { style: { display: "flex", flexDirection: "column", gap: "16px" }, children: n.map((t) => {
919
+ const l = o[t.id];
920
+ return /* @__PURE__ */ s.jsxs(
921
+ Rr,
922
+ {
923
+ label: t.label,
924
+ fieldId: t.id,
925
+ required: t.required,
926
+ children: [
927
+ t.type === "textarea" && /* @__PURE__ */ s.jsx(
928
+ Be,
929
+ {
930
+ field: t,
931
+ value: l ?? "",
932
+ onChange: (u) => c(t.id, u),
933
+ disabled: i,
934
+ multiline: !0
935
+ }
936
+ ),
937
+ t.type === "text" && /* @__PURE__ */ s.jsx(
938
+ Be,
939
+ {
940
+ field: t,
941
+ value: l ?? "",
942
+ onChange: (u) => c(t.id, u),
943
+ disabled: i
944
+ }
945
+ ),
946
+ t.type === "rating" && /* @__PURE__ */ s.jsx(
947
+ kr,
948
+ {
949
+ field: t,
950
+ value: l ?? null,
951
+ onChange: (u) => c(t.id, u),
952
+ disabled: i,
953
+ primaryColor: f
954
+ }
955
+ ),
956
+ t.type === "nps" && /* @__PURE__ */ s.jsx(
957
+ Cr,
958
+ {
959
+ field: t,
960
+ value: l ?? null,
961
+ onChange: (u) => c(t.id, u),
962
+ disabled: i,
963
+ primaryColor: f
964
+ }
965
+ ),
966
+ t.type === "csat" && /* @__PURE__ */ s.jsx(
967
+ Pr,
968
+ {
969
+ field: t,
970
+ value: l ?? null,
971
+ onChange: (u) => c(t.id, u),
972
+ disabled: i
973
+ }
974
+ ),
975
+ t.type === "select" && /* @__PURE__ */ s.jsx(
976
+ Or,
977
+ {
978
+ field: t,
979
+ value: l ?? "",
980
+ onChange: (u) => c(t.id, u),
981
+ disabled: i
982
+ }
983
+ ),
984
+ t.type === "multiselect" && /* @__PURE__ */ s.jsx(
985
+ Fr,
986
+ {
987
+ field: t,
988
+ value: l ?? [],
989
+ onChange: (u) => c(t.id, u),
990
+ disabled: i
991
+ }
992
+ ),
993
+ t.type === "boolean" && /* @__PURE__ */ s.jsx(
994
+ Ir,
995
+ {
996
+ field: t,
997
+ value: l === void 0 ? null : l,
998
+ onChange: (u) => c(t.id, u),
999
+ disabled: i,
1000
+ primaryColor: f
1001
+ }
1002
+ )
1003
+ ]
1004
+ },
1005
+ t.id
1006
+ );
1007
+ }) });
1008
+ function Ar(n) {
1009
+ const [o, c] = Q({});
1010
+ return { values: o, handleChange: (l, u) => {
1011
+ c((p) => ({ ...p, [l]: u }));
1012
+ }, validate: () => {
1013
+ for (const l of n) {
1014
+ if (!l.required) continue;
1015
+ const u = o[l.id];
1016
+ if (u == null || u === "" || Array.isArray(u) && u.length === 0)
1017
+ return `"${l.label}" is required`;
1018
+ }
1019
+ return null;
1020
+ }, reset: () => c({}) };
1021
+ }
1022
+ const Kr = [
1023
+ {
1024
+ id: "nps_score",
1025
+ type: "nps",
1026
+ label: "How likely are you to recommend us to a friend or colleague?",
1027
+ required: !0,
1028
+ lowLabel: "Not likely",
1029
+ highLabel: "Very likely"
1030
+ },
1031
+ {
1032
+ id: "nps_reason",
1033
+ type: "textarea",
1034
+ label: "What is the main reason for your score?",
1035
+ placeholder: "Tell us more…",
1036
+ required: !1
1037
+ }
1038
+ ], Gr = [
1039
+ {
1040
+ id: "csat_score",
1041
+ type: "csat",
1042
+ label: "How satisfied are you with your experience today?",
1043
+ required: !0,
1044
+ emojiScale: ["😞", "😕", "😐", "😊", "😄"]
1045
+ },
1046
+ {
1047
+ id: "csat_comment",
1048
+ type: "textarea",
1049
+ label: "Any other thoughts?",
1050
+ placeholder: "Optional — share anything on your mind.",
1051
+ required: !1
1052
+ }
1053
+ ], Ne = [
1054
+ {
1055
+ id: "feedback_type",
1056
+ type: "select",
1057
+ label: "Type",
1058
+ required: !1,
1059
+ options: ["General feedback", "Bug report", "Feature request", "Question", "Praise"]
1060
+ },
1061
+ {
1062
+ id: "rating",
1063
+ type: "rating",
1064
+ label: "Rating (optional)",
1065
+ required: !1
1066
+ },
1067
+ {
1068
+ id: "text",
1069
+ type: "textarea",
1070
+ label: "Your feedback",
1071
+ placeholder: "Tell us what you think…",
1072
+ required: !0
1073
+ },
1074
+ {
1075
+ id: "user_name",
1076
+ type: "text",
1077
+ label: "Name (optional)",
1078
+ placeholder: "Your name",
1079
+ required: !1
1080
+ },
1081
+ {
1082
+ id: "user_email",
1083
+ type: "text",
1084
+ label: "Email (optional)",
1085
+ placeholder: "you@example.com",
1086
+ required: !1
1087
+ }
1088
+ ], $r = ({
1089
+ isOpen: n,
1090
+ onClose: o,
1091
+ onSubmit: c,
1092
+ projectId: i,
1093
+ fields: f = Ne,
1094
+ appearance: t = {},
1095
+ widgetType: l = "general"
632
1096
  }) => {
633
- const [c, b] = Y({
634
- text: "",
635
- rating: void 0,
636
- feedbackType: "general",
637
- userEmail: "",
638
- userName: ""
639
- }), [o, R] = Y(!1), [x, g] = Y("idle"), [j, v] = Y(""), [S, T] = Y(!1), F = Ue(null), B = Ue(null);
640
- Ve(() => (p ? (T(!0), document.body.style.overflow = "hidden", setTimeout(() => {
641
- var i;
642
- (i = B.current) == null || i.focus();
1097
+ const [u, p] = Q(!1), [g, v] = Q(!1), [S, R] = Q("idle"), [M, A] = Q(""), Z = je(null), Y = je(null), { values: _, handleChange: E, validate: V, reset: q } = Ar(f), W = t.primaryColor ?? "#111827";
1098
+ ae(() => (n ? (p(!0), document.body.style.overflow = "hidden", setTimeout(() => {
1099
+ var m;
1100
+ return (m = Y.current) == null ? void 0 : m.focus();
643
1101
  }, 150)) : document.body.style.overflow = "unset", () => {
644
1102
  document.body.style.overflow = "unset";
645
- }), [p]), Ve(() => {
646
- const i = (_) => {
647
- _.key === "Escape" && p && !o && A();
1103
+ }), [n]), ae(() => {
1104
+ const m = (L) => {
1105
+ L.key === "Escape" && n && !g && O();
648
1106
  };
649
- return p && document.addEventListener("keydown", i), () => {
650
- document.removeEventListener("keydown", i);
651
- };
652
- }, [p, o]);
653
- const A = () => {
654
- T(!1), setTimeout(() => {
655
- m(), setTimeout(() => {
656
- b({
657
- text: "",
658
- rating: void 0,
659
- feedbackType: "general",
660
- userEmail: "",
661
- userName: ""
662
- }), g("idle"), v("");
1107
+ return n && document.addEventListener("keydown", m), () => document.removeEventListener("keydown", m);
1108
+ }, [n, g]);
1109
+ const O = () => {
1110
+ p(!1), setTimeout(() => {
1111
+ o(), setTimeout(() => {
1112
+ q(), R("idle"), A("");
663
1113
  }, 100);
664
1114
  }, 200);
665
- }, q = async (i) => {
666
- if (i.preventDefault(), !c.text.trim()) {
667
- v("Please enter your feedback");
1115
+ }, H = async (m) => {
1116
+ m.preventDefault();
1117
+ const L = V();
1118
+ if (L) {
1119
+ A(L);
668
1120
  return;
669
1121
  }
670
- R(!0), v("");
1122
+ v(!0), A("");
671
1123
  try {
672
- await C(c), g("success"), setTimeout(() => {
673
- A();
674
- }, 2e3);
675
- } catch (_) {
676
- g("error"), v(_ instanceof Error ? _.message : "Failed to submit feedback");
1124
+ const $ = {
1125
+ project_id: i,
1126
+ fields: _,
1127
+ widget_type: l,
1128
+ source: "sdk",
1129
+ page_url: window.location.href,
1130
+ page_title: document.title,
1131
+ user_agent: navigator.userAgent,
1132
+ // Hoist common identity fields to top-level for backend compat
1133
+ user_email: typeof _.user_email == "string" ? _.user_email : void 0,
1134
+ user_name: typeof _.user_name == "string" ? _.user_name : void 0,
1135
+ user_identifier: typeof _.user_email == "string" && _.user_email || typeof _.user_name == "string" && _.user_name || "anonymous"
1136
+ };
1137
+ await c($), R("success"), setTimeout(() => O(), 2e3);
1138
+ } catch ($) {
1139
+ R("error"), A(
1140
+ $ instanceof Error ? $.message : "Failed to submit feedback"
1141
+ );
677
1142
  } finally {
678
- R(!1);
1143
+ v(!1);
679
1144
  }
1145
+ }, J = (m) => {
1146
+ m.target === m.currentTarget && !g && O();
680
1147
  };
681
- if (!p) return null;
682
- const I = (i) => {
683
- i.target === i.currentTarget && !o && A();
684
- }, f = {
685
- position: "fixed",
686
- top: 0,
687
- left: 0,
688
- right: 0,
689
- bottom: 0,
690
- backgroundColor: "rgba(0, 0, 0, 0.5)",
691
- display: "flex",
692
- alignItems: "center",
693
- justifyContent: "center",
694
- zIndex: 1e4,
695
- padding: "16px",
696
- opacity: S ? 1 : 0,
697
- transition: "opacity 0.2s ease-in-out"
698
- }, re = {
699
- backgroundColor: "white",
700
- borderRadius: "12px",
701
- padding: "24px",
702
- maxWidth: "500px",
703
- width: "100%",
704
- maxHeight: "90vh",
705
- overflowY: "auto",
706
- boxShadow: "0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)",
707
- transform: S ? "scale(1)" : "scale(0.95)",
708
- opacity: S ? 1 : 0,
709
- transition: "all 0.2s ease-in-out"
710
- };
711
- return /* @__PURE__ */ n.jsx(
1148
+ return n ? /* @__PURE__ */ s.jsx(
712
1149
  "div",
713
1150
  {
714
- onClick: I,
715
- style: f,
1151
+ onClick: J,
716
1152
  role: "dialog",
717
1153
  "aria-modal": "true",
718
- "aria-labelledby": "feedback-modal-title",
719
- children: /* @__PURE__ */ n.jsxs(
1154
+ "aria-labelledby": "ms-modal-title",
1155
+ style: {
1156
+ position: "fixed",
1157
+ inset: 0,
1158
+ backgroundColor: "rgba(0,0,0,0.5)",
1159
+ display: "flex",
1160
+ alignItems: "center",
1161
+ justifyContent: "center",
1162
+ zIndex: 1e4,
1163
+ padding: "16px",
1164
+ opacity: u ? 1 : 0,
1165
+ transition: "opacity 0.2s ease-in-out"
1166
+ },
1167
+ children: /* @__PURE__ */ s.jsxs(
720
1168
  "div",
721
1169
  {
722
- ref: F,
723
- style: re,
724
- onClick: (i) => i.stopPropagation(),
1170
+ ref: Z,
1171
+ onClick: (m) => m.stopPropagation(),
1172
+ style: {
1173
+ backgroundColor: "#ffffff",
1174
+ borderRadius: "16px",
1175
+ padding: "24px",
1176
+ maxWidth: "480px",
1177
+ width: "100%",
1178
+ maxHeight: "90vh",
1179
+ overflowY: "auto",
1180
+ boxShadow: "0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04)",
1181
+ transform: u ? "scale(1)" : "scale(0.95)",
1182
+ opacity: u ? 1 : 0,
1183
+ transition: "all 0.2s ease-in-out"
1184
+ },
725
1185
  children: [
726
- /* @__PURE__ */ n.jsxs("div", { style: { marginBottom: "24px", display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
727
- /* @__PURE__ */ n.jsx(
728
- "h2",
729
- {
730
- id: "feedback-modal-title",
731
- style: { fontSize: "20px", fontWeight: "600", margin: 0, color: "#111827" },
732
- children: "Send Feedback"
733
- }
734
- ),
735
- /* @__PURE__ */ n.jsx(
736
- "button",
737
- {
738
- onClick: A,
739
- disabled: o,
740
- "aria-label": "Close feedback form",
741
- style: {
742
- background: "none",
743
- border: "none",
744
- fontSize: "24px",
745
- cursor: o ? "not-allowed" : "pointer",
746
- color: "#6b7280",
747
- padding: "0",
748
- lineHeight: "1",
749
- opacity: o ? 0.5 : 1,
750
- transition: "color 0.2s"
751
- },
752
- onMouseEnter: (i) => !o && (i.currentTarget.style.color = "#111827"),
753
- onMouseLeave: (i) => !o && (i.currentTarget.style.color = "#6b7280"),
754
- children: "×"
755
- }
756
- )
757
- ] }),
758
- x === "success" && /* @__PURE__ */ n.jsxs(
1186
+ /* @__PURE__ */ s.jsxs(
759
1187
  "div",
760
1188
  {
1189
+ style: {
1190
+ display: "flex",
1191
+ justifyContent: "space-between",
1192
+ alignItems: "flex-start",
1193
+ marginBottom: "8px"
1194
+ },
1195
+ children: [
1196
+ /* @__PURE__ */ s.jsxs("div", { ref: Y, tabIndex: -1, children: [
1197
+ /* @__PURE__ */ s.jsx(
1198
+ "h2",
1199
+ {
1200
+ id: "ms-modal-title",
1201
+ style: {
1202
+ fontSize: "18px",
1203
+ fontWeight: 600,
1204
+ margin: 0,
1205
+ color: "#111827"
1206
+ },
1207
+ children: t.welcomeTitle ?? "Share your feedback"
1208
+ }
1209
+ ),
1210
+ t.welcomeSubtitle && /* @__PURE__ */ s.jsx(
1211
+ "p",
1212
+ {
1213
+ style: {
1214
+ fontSize: "13px",
1215
+ color: "#6b7280",
1216
+ marginTop: "4px"
1217
+ },
1218
+ children: t.welcomeSubtitle
1219
+ }
1220
+ )
1221
+ ] }),
1222
+ /* @__PURE__ */ s.jsx(
1223
+ "button",
1224
+ {
1225
+ onClick: O,
1226
+ disabled: g,
1227
+ "aria-label": "Close feedback form",
1228
+ style: {
1229
+ background: "none",
1230
+ border: "none",
1231
+ fontSize: "22px",
1232
+ cursor: g ? "not-allowed" : "pointer",
1233
+ color: "#9ca3af",
1234
+ lineHeight: 1,
1235
+ padding: "0 0 0 12px",
1236
+ opacity: g ? 0.5 : 1,
1237
+ transition: "color 0.15s",
1238
+ flexShrink: 0
1239
+ },
1240
+ onMouseEnter: (m) => {
1241
+ g || (m.currentTarget.style.color = "#111827");
1242
+ },
1243
+ onMouseLeave: (m) => {
1244
+ g || (m.currentTarget.style.color = "#9ca3af");
1245
+ },
1246
+ children: "×"
1247
+ }
1248
+ )
1249
+ ]
1250
+ }
1251
+ ),
1252
+ S === "success" && /* @__PURE__ */ s.jsxs(
1253
+ "div",
1254
+ {
1255
+ role: "status",
1256
+ "aria-live": "polite",
761
1257
  style: {
762
1258
  backgroundColor: "#d1fae5",
763
1259
  border: "1px solid #6ee7b7",
@@ -765,22 +1261,22 @@ const yr = ({
765
1261
  padding: "12px",
766
1262
  marginBottom: "16px",
767
1263
  color: "#065f46",
1264
+ fontSize: "14px",
768
1265
  display: "flex",
769
1266
  alignItems: "center",
770
- gap: "8px",
771
- animation: "slideIn 0.3s ease-out"
1267
+ gap: "8px"
772
1268
  },
773
- role: "status",
774
- "aria-live": "polite",
775
1269
  children: [
776
- /* @__PURE__ */ n.jsx("span", { style: { fontSize: "18px" }, children: "✓" }),
777
- /* @__PURE__ */ n.jsx("span", { children: "Thank you! Your feedback has been submitted." })
1270
+ /* @__PURE__ */ s.jsx("span", { children: "✓" }),
1271
+ /* @__PURE__ */ s.jsx("span", { children: t.successMessage ?? "Thank you! Your feedback has been submitted." })
778
1272
  ]
779
1273
  }
780
1274
  ),
781
- j && /* @__PURE__ */ n.jsxs(
1275
+ M && /* @__PURE__ */ s.jsxs(
782
1276
  "div",
783
1277
  {
1278
+ role: "alert",
1279
+ "aria-live": "assertive",
784
1280
  style: {
785
1281
  backgroundColor: "#fee2e2",
786
1282
  border: "1px solid #fca5a5",
@@ -788,534 +1284,494 @@ const yr = ({
788
1284
  padding: "12px",
789
1285
  marginBottom: "16px",
790
1286
  color: "#991b1b",
1287
+ fontSize: "14px",
791
1288
  display: "flex",
792
1289
  alignItems: "center",
793
1290
  gap: "8px"
794
1291
  },
795
- role: "alert",
796
- "aria-live": "assertive",
797
1292
  children: [
798
- /* @__PURE__ */ n.jsx("span", { style: { fontSize: "18px" }, children: "⚠" }),
799
- /* @__PURE__ */ n.jsx("span", { children: j })
1293
+ /* @__PURE__ */ s.jsx("span", { children: "⚠" }),
1294
+ /* @__PURE__ */ s.jsx("span", { children: M })
800
1295
  ]
801
1296
  }
802
1297
  ),
803
- /* @__PURE__ */ n.jsxs("form", { onSubmit: q, children: [
804
- /* @__PURE__ */ n.jsxs("div", { style: { marginBottom: "16px" }, children: [
805
- /* @__PURE__ */ n.jsx(
806
- "label",
807
- {
808
- htmlFor: "feedback-type",
809
- style: { display: "block", marginBottom: "8px", fontSize: "14px", fontWeight: "500", color: "#374151" },
810
- children: "Type"
811
- }
812
- ),
813
- /* @__PURE__ */ n.jsxs(
814
- "select",
815
- {
816
- id: "feedback-type",
817
- value: c.feedbackType,
818
- onChange: (i) => b({ ...c, feedbackType: i.target.value }),
819
- disabled: o,
820
- style: {
821
- width: "100%",
822
- padding: "8px 12px",
823
- border: "1px solid #d1d5db",
824
- borderRadius: "6px",
825
- fontSize: "14px",
826
- backgroundColor: "white",
827
- cursor: o ? "not-allowed" : "pointer",
828
- opacity: o ? 0.6 : 1
829
- },
830
- children: [
831
- /* @__PURE__ */ n.jsx("option", { value: "general", children: "General Feedback" }),
832
- /* @__PURE__ */ n.jsx("option", { value: "bug", children: "Bug Report" }),
833
- /* @__PURE__ */ n.jsx("option", { value: "feature_request", children: "Feature Request" }),
834
- /* @__PURE__ */ n.jsx("option", { value: "question", children: "Question" }),
835
- /* @__PURE__ */ n.jsx("option", { value: "praise", children: "Praise" })
836
- ]
837
- }
838
- )
839
- ] }),
840
- /* @__PURE__ */ n.jsxs("div", { style: { marginBottom: "16px" }, children: [
841
- /* @__PURE__ */ n.jsx("label", { style: { display: "block", marginBottom: "8px", fontSize: "14px", fontWeight: "500", color: "#374151" }, children: "Rating (optional)" }),
842
- /* @__PURE__ */ n.jsx("div", { style: { display: "flex", gap: "8px" }, role: "group", "aria-label": "Rating", children: [1, 2, 3, 4, 5].map((i) => /* @__PURE__ */ n.jsx(
843
- "button",
844
- {
845
- type: "button",
846
- onClick: () => b({ ...c, rating: i }),
847
- disabled: o,
848
- "aria-label": `Rate ${i} stars`,
849
- "aria-pressed": c.rating === i,
850
- style: {
851
- background: "none",
852
- border: "none",
853
- fontSize: "28px",
854
- cursor: o ? "not-allowed" : "pointer",
855
- padding: "0",
856
- color: c.rating && c.rating >= i ? "#fbbf24" : "#d1d5db",
857
- transition: "all 0.2s",
858
- opacity: o ? 0.6 : 1,
859
- transform: "scale(1)"
860
- },
861
- onMouseEnter: (_) => !o && (_.currentTarget.style.transform = "scale(1.2)"),
862
- onMouseLeave: (_) => !o && (_.currentTarget.style.transform = "scale(1)"),
863
- children: "★"
864
- },
865
- i
866
- )) })
867
- ] }),
868
- /* @__PURE__ */ n.jsxs("div", { style: { marginBottom: "16px" }, children: [
869
- /* @__PURE__ */ n.jsxs(
870
- "label",
871
- {
872
- htmlFor: "feedback-text",
873
- style: { display: "block", marginBottom: "8px", fontSize: "14px", fontWeight: "500", color: "#374151" },
874
- children: [
875
- "Your Feedback ",
876
- /* @__PURE__ */ n.jsx("span", { style: { color: "#ef4444" }, children: "*" })
877
- ]
878
- }
879
- ),
880
- /* @__PURE__ */ n.jsx(
881
- "textarea",
882
- {
883
- id: "feedback-text",
884
- ref: B,
885
- value: c.text,
886
- onChange: (i) => b({ ...c, text: i.target.value }),
887
- placeholder: "Tell us what you think...",
888
- required: !0,
889
- disabled: o,
890
- rows: 4,
891
- "aria-required": "true",
892
- style: {
893
- width: "100%",
894
- padding: "8px 12px",
895
- border: "1px solid #d1d5db",
896
- borderRadius: "6px",
897
- fontSize: "14px",
898
- resize: "vertical",
899
- fontFamily: "inherit",
900
- opacity: o ? 0.6 : 1,
901
- cursor: o ? "not-allowed" : "text"
902
- }
903
- }
904
- )
905
- ] }),
906
- /* @__PURE__ */ n.jsxs("div", { style: { marginBottom: "16px" }, children: [
907
- /* @__PURE__ */ n.jsx(
908
- "label",
909
- {
910
- htmlFor: "feedback-name",
911
- style: { display: "block", marginBottom: "8px", fontSize: "14px", fontWeight: "500", color: "#374151" },
912
- children: "Name (optional)"
913
- }
914
- ),
915
- /* @__PURE__ */ n.jsx(
916
- "input",
917
- {
918
- id: "feedback-name",
919
- type: "text",
920
- value: c.userName,
921
- onChange: (i) => b({ ...c, userName: i.target.value }),
922
- placeholder: "Your name",
923
- disabled: o,
924
- style: {
925
- width: "100%",
926
- padding: "8px 12px",
927
- border: "1px solid #d1d5db",
928
- borderRadius: "6px",
929
- fontSize: "14px",
930
- opacity: o ? 0.6 : 1
931
- }
932
- }
933
- )
934
- ] }),
935
- /* @__PURE__ */ n.jsxs("div", { style: { marginBottom: "24px" }, children: [
936
- /* @__PURE__ */ n.jsx(
937
- "label",
938
- {
939
- htmlFor: "feedback-email",
940
- style: { display: "block", marginBottom: "8px", fontSize: "14px", fontWeight: "500", color: "#374151" },
941
- children: "Email (optional)"
942
- }
943
- ),
944
- /* @__PURE__ */ n.jsx(
945
- "input",
946
- {
947
- id: "feedback-email",
948
- type: "email",
949
- value: c.userEmail,
950
- onChange: (i) => b({ ...c, userEmail: i.target.value }),
951
- placeholder: "your@email.com",
952
- disabled: o,
953
- style: {
954
- width: "100%",
955
- padding: "8px 12px",
956
- border: "1px solid #d1d5db",
957
- borderRadius: "6px",
958
- fontSize: "14px",
959
- opacity: o ? 0.6 : 1
1298
+ /* @__PURE__ */ s.jsxs(
1299
+ "form",
1300
+ {
1301
+ onSubmit: H,
1302
+ style: { display: "flex", flexDirection: "column", gap: "0" },
1303
+ children: [
1304
+ /* @__PURE__ */ s.jsx(
1305
+ Mr,
1306
+ {
1307
+ fields: f,
1308
+ values: _,
1309
+ onChange: E,
1310
+ disabled: g || S === "success",
1311
+ primaryColor: W
960
1312
  }
961
- }
962
- )
963
- ] }),
964
- /* @__PURE__ */ n.jsxs("div", { style: { display: "flex", gap: "12px", justifyContent: "flex-end" }, children: [
965
- /* @__PURE__ */ n.jsx(
966
- "button",
967
- {
968
- type: "button",
969
- onClick: A,
970
- disabled: o,
971
- style: {
972
- padding: "10px 20px",
973
- border: "1px solid #d1d5db",
974
- borderRadius: "6px",
975
- backgroundColor: "white",
976
- color: "#374151",
977
- fontSize: "14px",
978
- fontWeight: "500",
979
- cursor: o ? "not-allowed" : "pointer",
980
- opacity: o ? 0.5 : 1,
981
- transition: "all 0.2s"
982
- },
983
- onMouseEnter: (i) => !o && (i.currentTarget.style.backgroundColor = "#f9fafb"),
984
- onMouseLeave: (i) => !o && (i.currentTarget.style.backgroundColor = "white"),
985
- children: "Cancel"
986
- }
987
- ),
988
- /* @__PURE__ */ n.jsxs(
989
- "button",
990
- {
991
- type: "submit",
992
- disabled: o || x === "success",
993
- style: {
994
- padding: "10px 20px",
995
- border: "none",
996
- borderRadius: "6px",
997
- backgroundColor: x === "success" ? "#10b981" : "#3b82f6",
998
- color: "white",
999
- fontSize: "14px",
1000
- fontWeight: "500",
1001
- cursor: o || x === "success" ? "not-allowed" : "pointer",
1002
- opacity: o ? 0.7 : 1,
1003
- transition: "all 0.2s",
1004
- display: "flex",
1005
- alignItems: "center",
1006
- gap: "8px"
1007
- },
1008
- children: [
1009
- o && /* @__PURE__ */ n.jsx(
1010
- "span",
1011
- {
1012
- style: {
1013
- display: "inline-block",
1014
- width: "14px",
1015
- height: "14px",
1016
- border: "2px solid #ffffff",
1017
- borderTopColor: "transparent",
1018
- borderRadius: "50%",
1019
- animation: "spin 0.6s linear infinite"
1313
+ ),
1314
+ /* @__PURE__ */ s.jsxs(
1315
+ "div",
1316
+ {
1317
+ style: {
1318
+ display: "flex",
1319
+ justifyContent: "space-between",
1320
+ alignItems: "center",
1321
+ marginTop: "24px"
1322
+ },
1323
+ children: [
1324
+ t.showBranding !== !1 && /* @__PURE__ */ s.jsx("span", { style: { fontSize: "11px", color: "#d1d5db" }, children: "Powered by MetricShift" }),
1325
+ /* @__PURE__ */ s.jsxs(
1326
+ "div",
1327
+ {
1328
+ style: {
1329
+ display: "flex",
1330
+ gap: "10px",
1331
+ marginLeft: "auto"
1332
+ },
1333
+ children: [
1334
+ /* @__PURE__ */ s.jsx(
1335
+ "button",
1336
+ {
1337
+ type: "button",
1338
+ onClick: O,
1339
+ disabled: g,
1340
+ style: {
1341
+ padding: "9px 18px",
1342
+ border: "1px solid #e5e7eb",
1343
+ borderRadius: "9999px",
1344
+ backgroundColor: "#ffffff",
1345
+ color: "#374151",
1346
+ fontSize: "14px",
1347
+ fontWeight: 500,
1348
+ cursor: g ? "not-allowed" : "pointer",
1349
+ opacity: g ? 0.5 : 1,
1350
+ transition: "background-color 0.15s"
1351
+ },
1352
+ onMouseEnter: (m) => {
1353
+ g || (m.currentTarget.style.backgroundColor = "#f9fafb");
1354
+ },
1355
+ onMouseLeave: (m) => {
1356
+ g || (m.currentTarget.style.backgroundColor = "#ffffff");
1357
+ },
1358
+ children: "Cancel"
1359
+ }
1360
+ ),
1361
+ /* @__PURE__ */ s.jsxs(
1362
+ "button",
1363
+ {
1364
+ type: "submit",
1365
+ disabled: g || S === "success",
1366
+ style: {
1367
+ padding: "9px 18px",
1368
+ border: "none",
1369
+ borderRadius: "9999px",
1370
+ backgroundColor: S === "success" ? "#10b981" : W,
1371
+ color: "#ffffff",
1372
+ fontSize: "14px",
1373
+ fontWeight: 500,
1374
+ cursor: g || S === "success" ? "not-allowed" : "pointer",
1375
+ opacity: g ? 0.7 : 1,
1376
+ transition: "opacity 0.15s",
1377
+ display: "flex",
1378
+ alignItems: "center",
1379
+ gap: "8px"
1380
+ },
1381
+ children: [
1382
+ g && /* @__PURE__ */ s.jsx(
1383
+ "span",
1384
+ {
1385
+ style: {
1386
+ display: "inline-block",
1387
+ width: "13px",
1388
+ height: "13px",
1389
+ border: "2px solid #ffffff",
1390
+ borderTopColor: "transparent",
1391
+ borderRadius: "50%",
1392
+ animation: "ms-spin 0.6s linear infinite"
1393
+ }
1394
+ }
1395
+ ),
1396
+ g ? "Sending…" : S === "success" ? "✓ Sent!" : "Submit"
1397
+ ]
1398
+ }
1399
+ )
1400
+ ]
1020
1401
  }
1021
- }
1022
- ),
1023
- /* @__PURE__ */ n.jsx("span", { children: o ? "Sending..." : x === "success" ? "✓ Sent!" : "Send Feedback" })
1024
- ]
1025
- }
1026
- )
1027
- ] })
1028
- ] }),
1029
- /* @__PURE__ */ n.jsx("style", { children: `
1030
- @keyframes spin {
1402
+ )
1403
+ ]
1404
+ }
1405
+ )
1406
+ ]
1407
+ }
1408
+ ),
1409
+ /* @__PURE__ */ s.jsx("style", { children: `
1410
+ @keyframes ms-spin {
1031
1411
  to { transform: rotate(360deg); }
1032
1412
  }
1033
- @keyframes slideIn {
1034
- from {
1035
- opacity: 0;
1036
- transform: translateY(-10px);
1037
- }
1038
- to {
1039
- opacity: 1;
1040
- transform: translateY(0);
1041
- }
1042
- }
1043
1413
  ` })
1044
1414
  ]
1045
1415
  }
1046
1416
  )
1047
1417
  }
1418
+ ) : null;
1419
+ };
1420
+ class Dr {
1421
+ constructor() {
1422
+ z(this, "listeners", /* @__PURE__ */ new Set());
1423
+ }
1424
+ on(o) {
1425
+ return this.listeners.add(o), () => this.listeners.delete(o);
1426
+ }
1427
+ emit(o) {
1428
+ this.listeners.forEach((c) => c(o));
1429
+ }
1430
+ clear() {
1431
+ this.listeners.clear();
1432
+ }
1433
+ }
1434
+ const U = new Dr(), Wr = "msw_";
1435
+ function Ue(n, o) {
1436
+ return `${Wr}${n}_${o}`;
1437
+ }
1438
+ function Lr(n) {
1439
+ try {
1440
+ return localStorage.getItem(Ue(n, "shown")) === "1";
1441
+ } catch {
1442
+ return !1;
1443
+ }
1444
+ }
1445
+ function zr(n) {
1446
+ try {
1447
+ localStorage.setItem(Ue(n, "shown"), "1");
1448
+ } catch {
1449
+ }
1450
+ }
1451
+ class Yr {
1452
+ constructor(o, c, i = {}) {
1453
+ z(this, "projectId");
1454
+ z(this, "trigger");
1455
+ z(this, "session");
1456
+ z(this, "cleanupFns", []);
1457
+ z(this, "fired", !1);
1458
+ this.projectId = o, this.trigger = c, this.session = i;
1459
+ }
1460
+ start() {
1461
+ if (!(this.session.showOnce && Lr(this.projectId)))
1462
+ switch (this.trigger.type) {
1463
+ case "auto":
1464
+ this.fire();
1465
+ break;
1466
+ case "delay": {
1467
+ const o = this.trigger.delay ?? 3e3, c = setTimeout(() => this.fire(), o);
1468
+ this.cleanupFns.push(() => clearTimeout(c));
1469
+ break;
1470
+ }
1471
+ }
1472
+ }
1473
+ // Called by MetricShift.open() for manual trigger
1474
+ fireManual(o) {
1475
+ this.fire(o);
1476
+ }
1477
+ fire(o) {
1478
+ this.fired || (this.fired = !0, this.session.showOnce && zr(this.projectId), U.emit({ type: "open", payload: { flowId: o } }));
1479
+ }
1480
+ // Reset fired state — allows re-triggering after close if showOnce is false
1481
+ reset() {
1482
+ this.fired = !1;
1483
+ }
1484
+ // Tear down all listeners and timers
1485
+ destroy() {
1486
+ this.cleanupFns.forEach((o) => o()), this.cleanupFns = [];
1487
+ }
1488
+ }
1489
+ const Ve = jr(null), qr = () => {
1490
+ const n = Er(Ve);
1491
+ if (!n)
1492
+ throw new Error("useMetricShift must be used within MetricShiftProvider");
1493
+ return n;
1494
+ };
1495
+ let Se = null;
1496
+ const Br = {
1497
+ init: (n) => {
1498
+ Se = {
1499
+ apiUrl: "https://metricshift-sdk-be-production.up.railway.app",
1500
+ ...n
1501
+ }, console.log("✅ MetricShift SDK initialised", {
1502
+ projectId: n.projectId,
1503
+ apiUrl: Se.apiUrl
1504
+ });
1505
+ },
1506
+ open: (n) => {
1507
+ U.emit({ type: "open", payload: { flowId: n } });
1508
+ },
1509
+ close: () => {
1510
+ U.emit({ type: "close" });
1511
+ },
1512
+ trigger: (n) => {
1513
+ U.emit({ type: "trigger", payload: { eventName: n } });
1514
+ },
1515
+ getConfig: () => Se
1516
+ }, Xr = ({
1517
+ config: n,
1518
+ children: o
1519
+ }) => {
1520
+ const [c, i] = Q(!1), f = je(null), t = n.widget ?? {}, l = t.trigger ?? { type: "manual" }, u = t.session ?? {};
1521
+ ae(() => {
1522
+ Br.init(n);
1523
+ }, []), ae(() => U.on((S) => {
1524
+ var R;
1525
+ S.type === "open" && i(!0), S.type === "close" && (i(!1), (R = f.current) == null || R.reset());
1526
+ }), []), ae(() => {
1527
+ const v = new Yr(n.projectId, l, u);
1528
+ return f.current = v, v.start(), () => v.destroy();
1529
+ }, [n.projectId]);
1530
+ const p = (v) => {
1531
+ U.emit({ type: "open", payload: { flowId: v } });
1532
+ }, g = () => {
1533
+ U.emit({ type: "close" });
1534
+ };
1535
+ return /* @__PURE__ */ s.jsx(
1536
+ Ve.Provider,
1537
+ {
1538
+ value: { config: n, isOpen: c, openWidget: p, closeWidget: g },
1539
+ children: o
1540
+ }
1048
1541
  );
1049
1542
  };
1050
- async function mr(p, m, C) {
1051
- const c = {
1543
+ async function Nr(n, o, c) {
1544
+ const i = {
1052
1545
  "Content-Type": "application/json"
1053
1546
  };
1054
- C && (c.Authorization = `Bearer ${C}`);
1547
+ c && (i.Authorization = `Bearer ${c}`);
1055
1548
  try {
1056
- const b = await fetch(`${p}/api/feedback`, {
1549
+ const f = await fetch(`${n}/api/feedback`, {
1057
1550
  method: "POST",
1058
- headers: c,
1059
- body: JSON.stringify(m)
1551
+ headers: i,
1552
+ body: JSON.stringify(o)
1060
1553
  });
1061
- if (!b.ok) {
1062
- const o = await b.json().catch(() => ({}));
1063
- throw new Error(o.message || `HTTP ${b.status}: ${b.statusText}`);
1554
+ if (!f.ok) {
1555
+ const t = await f.json().catch(() => ({}));
1556
+ throw new Error(t.message || `HTTP ${f.status}: ${f.statusText}`);
1064
1557
  }
1065
- return await b.json();
1066
- } catch (b) {
1067
- throw b instanceof Error ? b : new Error("Failed to submit feedback");
1558
+ return await f.json();
1559
+ } catch (f) {
1560
+ throw f instanceof Error ? f : new Error("Failed to submit feedback");
1068
1561
  }
1069
1562
  }
1070
- const Er = (p, m = 0.12) => {
1071
- const C = /^#([0-9a-fA-F]{6})$/.exec(p);
1072
- if (!C) return p;
1073
- const c = parseInt(C[1], 16), b = Math.max(0, Math.min(255, Math.round((c >> 16 & 255) * (1 - m)))), o = Math.max(0, Math.min(255, Math.round((c >> 8 & 255) * (1 - m)))), R = Math.max(0, Math.min(255, Math.round((c & 255) * (1 - m)))), x = (g) => g.toString(16).padStart(2, "0");
1074
- return `#${x(b)}${x(o)}${x(R)}`;
1075
- }, kr = ({
1076
- projectId: p,
1077
- apiKey: m,
1078
- apiUrl: C = "https://metricshift-sdk-be-production.up.railway.app",
1079
- // Text & display
1080
- buttonText: c = "Feedback",
1081
- subtitleText: b,
1082
- showIcon: o = !1,
1083
- // Avatar
1084
- avatarSrc: R,
1085
- avatarAlt: x,
1086
- avatarSize: g = 40,
1087
- // Position & size
1088
- position: j = "bottom-right",
1089
- size: v = "medium",
1090
- // Legacy styling / overrides
1091
- buttonColor: S,
1092
- buttonHoverColor: T,
1093
- buttonTextColor: F,
1094
- customStyles: B,
1095
- customClassName: A = "",
1096
- // New styling API
1097
- variant: q = "outline",
1098
- accentColor: I,
1099
- // Behavior
1100
- disabled: f = !1,
1101
- autoOpen: re = !1,
1102
- // Callbacks
1103
- onOpen: i,
1104
- onClose: _,
1105
- onSuccess: ce,
1106
- onError: ue
1563
+ const Ur = (n, o = 0.12) => {
1564
+ const c = /^#([0-9a-fA-F]{6})$/.exec(n);
1565
+ if (!c) return n;
1566
+ const i = parseInt(c[1], 16), f = Math.max(0, Math.round((i >> 16 & 255) * (1 - o))), t = Math.max(0, Math.round((i >> 8 & 255) * (1 - o))), l = Math.max(0, Math.round((i & 255) * (1 - o))), u = (p) => p.toString(16).padStart(2, "0");
1567
+ return `#${u(f)}${u(t)}${u(l)}`;
1568
+ }, Qr = ({
1569
+ projectId: n,
1570
+ apiKey: o,
1571
+ apiUrl: c = "https://metricshift-sdk-be-production.up.railway.app",
1572
+ fields: i = Ne,
1573
+ widgetType: f = "general",
1574
+ appearance: t = {},
1575
+ onOpen: l,
1576
+ onClose: u,
1577
+ onSuccess: p,
1578
+ onError: g
1107
1579
  }) => {
1108
- const [fe, te] = Y(re), [de, pe] = Y(!1), [be, O] = Y(!1), M = () => {
1109
- f || (te(!0), i == null || i());
1110
- }, L = () => {
1111
- te(!1), _ == null || _();
1112
- }, ge = async (E) => {
1580
+ let v = !1, S = () => {
1581
+ }, R = () => {
1582
+ };
1583
+ try {
1584
+ const D = qr();
1585
+ v = D.isOpen, S = D.openWidget, R = D.closeWidget;
1586
+ } catch {
1587
+ const [D, C] = oe.useState(!1);
1588
+ v = D, S = () => C(!0), R = () => C(!1);
1589
+ }
1590
+ const [M, A] = oe.useState(!1), [Z, Y] = oe.useState(!1), {
1591
+ buttonText: _ = "Feedback",
1592
+ subtitleText: E,
1593
+ variant: V = "outline",
1594
+ primaryColor: q = "#111827",
1595
+ position: W = "bottom-right",
1596
+ avatarSrc: O,
1597
+ avatarAlt: H,
1598
+ avatarSize: J = 40
1599
+ } = t, m = q, L = Ur(q);
1600
+ let $ = "#ffffff", K = "#f3f4f6", F = q, I = "rgba(15,23,42,0.08)";
1601
+ V === "solid" ? ($ = m, K = L, F = "#ffffff", I = "transparent") : V === "ghost" && ($ = "transparent", K = "#f3f4f6", I = "transparent");
1602
+ const B = W === "inline" ? { position: "relative" } : {
1603
+ position: "fixed",
1604
+ zIndex: 9999,
1605
+ ...W.includes("bottom") ? { bottom: "20px" } : { top: "20px" },
1606
+ ...W.includes("right") ? { right: "20px" } : { left: "20px" }
1607
+ }, ee = W !== "inline" ? "0 12px 30px rgba(15,23,42,0.12)" : "none", ie = () => {
1608
+ S(), l == null || l();
1609
+ }, se = () => {
1610
+ R(), u == null || u();
1611
+ }, le = async (D) => {
1113
1612
  try {
1114
- const D = {
1115
- ...E,
1116
- project_id: p,
1117
- page_url: window.location.href,
1118
- page_title: document.title,
1119
- user_agent: navigator.userAgent,
1120
- user_identifier: E.userEmail || "anonymous",
1121
- user_email: E.userEmail,
1122
- user_name: E.userName,
1123
- feedback_type: E.feedbackType
1124
- }, Q = await mr(C, D, m);
1125
- ce && (Q != null && Q.id) && ce(Q.id);
1126
- } catch (D) {
1127
- throw ue && D instanceof Error && ue(D), D;
1128
- }
1129
- }, ve = {
1130
- small: {
1131
- padding: "6px 14px",
1132
- fontSize: "13px",
1133
- iconSize: "14px"
1134
- },
1135
- medium: {
1136
- padding: "10px 18px",
1137
- fontSize: "15px",
1138
- iconSize: "18px"
1139
- },
1140
- large: {
1141
- padding: "14px 24px",
1142
- fontSize: "17px",
1143
- iconSize: "22px"
1613
+ const C = await Nr(c, D, o);
1614
+ p && (C != null && C.id) && p(C.id);
1615
+ } catch (C) {
1616
+ throw g && C instanceof Error && g(C), C;
1144
1617
  }
1145
- }, ne = !!R, he = () => {
1146
- if (j === "inline")
1147
- return {
1148
- position: "relative"
1149
- };
1150
- const E = {
1151
- position: "fixed",
1152
- zIndex: 9999
1153
- };
1154
- return j.includes("bottom") ? E.bottom = "20px" : E.top = "20px", j.includes("right") ? E.right = "20px" : E.left = "20px", E;
1155
- }, H = ve[v], xe = he(), J = I ?? S ?? "#111827", K = j !== "inline" ? "0 12px 30px rgba(15, 23, 42, 0.12)" : "none";
1156
- let N = "#ffffff", ae = "#f3f4f6", W = F || J, z = "rgba(15, 23, 42, 0.08)", $ = 1;
1157
- q === "solid" ? (N = S || J, ae = T || Er(N, 0.12), W = F || "#ffffff", z = "transparent", $ = 0) : q === "ghost" && (N = "transparent", ae = "#f3f4f6", W = F || J, z = "transparent", $ = 0);
1158
- const oe = {
1159
- // hosts can override these via .ms-feedback-button selector
1160
- "--ms-feedback-bg": N,
1161
- "--ms-feedback-color": W,
1162
- "--ms-feedback-border": z,
1163
- "--ms-feedback-radius": "9999px",
1164
- "--ms-feedback-shadow": K
1165
- }, Se = ne ? {
1166
- small: "8px 14px",
1167
- medium: "12px 18px",
1168
- large: "16px 24px"
1169
- }[v] : H.padding, ye = {
1170
- ...oe,
1171
- padding: Se,
1172
- backgroundColor: de && !f ? ae : N,
1173
- color: W,
1174
- border: $ ? `1px solid ${z}` : "1px solid transparent",
1175
- borderRadius: "9999px",
1176
- fontSize: H.fontSize,
1177
- fontWeight: 600,
1178
- cursor: f ? "not-allowed" : "pointer",
1179
- display: "flex",
1180
- alignItems: "center",
1181
- justifyContent: "center",
1182
- gap: "8px",
1183
- boxShadow: be ? `${K}, 0 0 0 3px rgba(59,130,246,0.45)` : K,
1184
- transition: "all 0.2s ease",
1185
- opacity: f ? 0.6 : 1,
1186
- transform: de && !f ? "translateY(-2px)" : "translateY(0)",
1187
- outline: "none",
1188
- position: "relative",
1189
- ...B
1190
- }, ke = {
1191
- fontSize: H.iconSize,
1192
- lineHeight: 1,
1193
- display: "flex",
1194
- alignItems: "center"
1195
- }, Re = {
1196
- display: "flex",
1197
- flexDirection: "column",
1198
- alignItems: "flex-start",
1199
- lineHeight: 1.2
1200
- }, G = {
1201
- fontWeight: 600,
1202
- fontSize: "inherit"
1203
- }, U = {
1204
- marginTop: "2px",
1205
- fontWeight: 400,
1206
- fontSize: "12px",
1207
- opacity: 0.9
1208
- }, me = {
1209
- ...xe,
1210
- display: "inline-flex",
1211
- alignItems: "center",
1212
- justifyContent: "center"
1213
- }, Ee = {
1214
- position: "absolute",
1215
- top: 0,
1216
- left: "50%",
1217
- transform: "translate(-50%, -75%)",
1218
- // lifted higher
1219
- width: g,
1220
- height: g,
1221
- borderRadius: "9999px",
1222
- overflow: "hidden",
1223
- boxShadow: "0 8px 22px rgba(15,23,42,0.22)",
1224
- border: "2px solid #ffffff",
1225
- backgroundColor: "#e5e7eb",
1226
- display: "flex",
1227
- alignItems: "center",
1228
- justifyContent: "center",
1229
- zIndex: 1,
1230
- pointerEvents: "none"
1231
- }, X = {
1232
- width: "100%",
1233
- height: "100%",
1234
- objectFit: "cover"
1235
1618
  };
1236
- return /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
1237
- /* @__PURE__ */ n.jsxs("div", { style: me, children: [
1238
- ne && /* @__PURE__ */ n.jsx("div", { style: Ee, "aria-hidden": x ? void 0 : !0, children: R && /* @__PURE__ */ n.jsx(
1239
- "img",
1240
- {
1241
- src: R,
1242
- alt: x || "",
1243
- style: X
1244
- }
1245
- ) }),
1246
- /* @__PURE__ */ n.jsxs(
1247
- "button",
1248
- {
1249
- onClick: M,
1250
- onMouseEnter: () => !f && pe(!0),
1251
- onMouseLeave: () => !f && pe(!1),
1252
- onFocus: () => O(!0),
1253
- onBlur: () => O(!1),
1254
- disabled: f,
1255
- className: `ms-feedback-button ${A}`.trim(),
1256
- style: ye,
1257
- "aria-label": "Open feedback form",
1258
- "aria-pressed": fe,
1259
- "aria-disabled": f,
1260
- role: "button",
1261
- tabIndex: f ? -1 : 0,
1262
- onKeyDown: (E) => {
1263
- !f && (E.key === "Enter" || E.key === " ") && (E.preventDefault(), M());
1264
- },
1265
- children: [
1266
- o && /* @__PURE__ */ n.jsx("span", { style: ke, "aria-hidden": "true", children: "💬" }),
1267
- /* @__PURE__ */ n.jsxs("div", { style: Re, children: [
1268
- /* @__PURE__ */ n.jsx("span", { style: G, children: c }),
1269
- b && /* @__PURE__ */ n.jsx("span", { style: U, children: b })
1270
- ] })
1271
- ]
1272
- }
1273
- )
1274
- ] }),
1275
- /* @__PURE__ */ n.jsx(
1276
- yr,
1619
+ return /* @__PURE__ */ s.jsxs(s.Fragment, { children: [
1620
+ /* @__PURE__ */ s.jsxs(
1621
+ "div",
1277
1622
  {
1278
- isOpen: fe,
1279
- onClose: L,
1280
- onSubmit: ge
1623
+ style: {
1624
+ ...B,
1625
+ display: "inline-flex",
1626
+ alignItems: "center",
1627
+ justifyContent: "center"
1628
+ },
1629
+ children: [
1630
+ O && /* @__PURE__ */ s.jsx(
1631
+ "div",
1632
+ {
1633
+ "aria-hidden": !H,
1634
+ style: {
1635
+ position: "absolute",
1636
+ top: 0,
1637
+ left: "50%",
1638
+ transform: "translate(-50%, -75%)",
1639
+ width: J,
1640
+ height: J,
1641
+ borderRadius: "9999px",
1642
+ overflow: "hidden",
1643
+ boxShadow: "0 8px 22px rgba(15,23,42,0.22)",
1644
+ border: "2px solid #ffffff",
1645
+ backgroundColor: "#e5e7eb",
1646
+ pointerEvents: "none",
1647
+ zIndex: 1
1648
+ },
1649
+ children: /* @__PURE__ */ s.jsx(
1650
+ "img",
1651
+ {
1652
+ src: O,
1653
+ alt: H ?? "",
1654
+ style: { width: "100%", height: "100%", objectFit: "cover" }
1655
+ }
1656
+ )
1657
+ }
1658
+ ),
1659
+ /* @__PURE__ */ s.jsx(
1660
+ "button",
1661
+ {
1662
+ type: "button",
1663
+ onClick: ie,
1664
+ onMouseEnter: () => A(!0),
1665
+ onMouseLeave: () => A(!1),
1666
+ onFocus: () => Y(!0),
1667
+ onBlur: () => Y(!1),
1668
+ "aria-label": "Open feedback form",
1669
+ "aria-pressed": v,
1670
+ className: "ms-feedback-button",
1671
+ style: {
1672
+ padding: O ? "12px 18px" : "10px 18px",
1673
+ backgroundColor: M ? K : $,
1674
+ color: F,
1675
+ border: `1px solid ${I}`,
1676
+ borderRadius: "9999px",
1677
+ fontSize: "15px",
1678
+ fontWeight: 600,
1679
+ cursor: "pointer",
1680
+ display: "flex",
1681
+ alignItems: "center",
1682
+ justifyContent: "center",
1683
+ gap: "8px",
1684
+ boxShadow: Z ? `${ee}, 0 0 0 3px rgba(59,130,246,0.45)` : ee,
1685
+ transition: "all 0.2s ease",
1686
+ transform: M ? "translateY(-2px)" : "translateY(0)",
1687
+ outline: "none"
1688
+ },
1689
+ children: /* @__PURE__ */ s.jsxs(
1690
+ "div",
1691
+ {
1692
+ style: {
1693
+ display: "flex",
1694
+ flexDirection: "column",
1695
+ alignItems: "flex-start",
1696
+ lineHeight: 1.2
1697
+ },
1698
+ children: [
1699
+ /* @__PURE__ */ s.jsx("span", { style: { fontWeight: 600, fontSize: "15px" }, children: _ }),
1700
+ E && /* @__PURE__ */ s.jsx(
1701
+ "span",
1702
+ {
1703
+ style: {
1704
+ marginTop: "2px",
1705
+ fontWeight: 400,
1706
+ fontSize: "12px",
1707
+ opacity: 0.9
1708
+ },
1709
+ children: E
1710
+ }
1711
+ )
1712
+ ]
1713
+ }
1714
+ )
1715
+ }
1716
+ )
1717
+ ]
1718
+ }
1719
+ ),
1720
+ /* @__PURE__ */ s.jsx(
1721
+ $r,
1722
+ {
1723
+ isOpen: v,
1724
+ onClose: se,
1725
+ onSubmit: le,
1726
+ projectId: n,
1727
+ fields: i,
1728
+ appearance: t,
1729
+ widgetType: f
1281
1730
  }
1282
1731
  )
1283
1732
  ] });
1284
- }, Ke = gr(null), Rr = () => {
1285
- const p = vr(Ke);
1286
- if (!p)
1287
- throw new Error("useMetricShift must be used within MetricShiftProvider");
1288
- return p;
1289
- }, jr = ({
1290
- config: p,
1291
- children: m
1292
- }) => /* @__PURE__ */ n.jsx(Ke.Provider, { value: p, children: m });
1293
- let Te = null;
1294
- const _r = {
1295
- /**
1296
- * Initialize the MetricShift SDK
1297
- * @param config - SDK configuration
1298
- */
1299
- init: (p) => {
1300
- Te = {
1301
- apiUrl: "http://localhost:3000",
1302
- ...p
1303
- }, console.log("✅ MetricShift SDK initialized", {
1304
- projectId: p.projectId,
1305
- apiUrl: Te.apiUrl
1306
- });
1307
- },
1308
- /**
1309
- * Get current SDK configuration
1310
- */
1311
- getConfig: () => Te
1312
- };
1733
+ }, Vr = "msw_";
1734
+ class Zr {
1735
+ constructor(o) {
1736
+ z(this, "projectId");
1737
+ this.projectId = o;
1738
+ }
1739
+ key(o) {
1740
+ return `${Vr}${this.projectId}_${o}`;
1741
+ }
1742
+ hasShownBefore() {
1743
+ try {
1744
+ return localStorage.getItem(this.key("shown")) === "1";
1745
+ } catch {
1746
+ return !1;
1747
+ }
1748
+ }
1749
+ markShown() {
1750
+ try {
1751
+ localStorage.setItem(this.key("shown"), "1");
1752
+ } catch {
1753
+ }
1754
+ }
1755
+ clearShown() {
1756
+ try {
1757
+ localStorage.removeItem(this.key("shown"));
1758
+ } catch {
1759
+ }
1760
+ }
1761
+ }
1313
1762
  export {
1314
- kr as FeedbackButton,
1315
- yr as FeedbackModal,
1316
- _r as MetricShift,
1317
- jr as MetricShiftProvider,
1318
- mr as submitFeedback,
1319
- Rr as useMetricShift
1763
+ Gr as CSAT_PRESET,
1764
+ Qr as FeedbackButton,
1765
+ $r as FeedbackModal,
1766
+ Mr as FormRenderer,
1767
+ Ne as GENERAL_PRESET,
1768
+ Br as MetricShift,
1769
+ Xr as MetricShiftProvider,
1770
+ Kr as NPS_PRESET,
1771
+ Zr as SessionManager,
1772
+ Yr as TriggerEngine,
1773
+ U as eventBus,
1774
+ Ar as useFormState,
1775
+ qr as useMetricShift
1320
1776
  };
1321
1777
  //# sourceMappingURL=index.esm.js.map