@magicfeedback/popup-sdk 1.0.12 → 1.0.13

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.mjs CHANGED
@@ -40,14 +40,14 @@ var require_magicfeedback_sdk_browser = __commonJS({
40
40
  })();
41
41
  !(function(e3) {
42
42
  !(function(t3) {
43
- var i2 = "URLSearchParams" in e3, n2 = "Symbol" in e3 && "iterator" in Symbol, a2 = "FileReader" in e3 && "Blob" in e3 && (function() {
43
+ var i2 = "URLSearchParams" in e3, n2 = "Symbol" in e3 && "iterator" in Symbol, r2 = "FileReader" in e3 && "Blob" in e3 && (function() {
44
44
  try {
45
45
  return new Blob(), true;
46
46
  } catch (e4) {
47
47
  return false;
48
48
  }
49
- })(), s = "FormData" in e3, r = "ArrayBuffer" in e3;
50
- if (r) var o = ["[object Int8Array]", "[object Uint8Array]", "[object Uint8ClampedArray]", "[object Int16Array]", "[object Uint16Array]", "[object Int32Array]", "[object Uint32Array]", "[object Float32Array]", "[object Float64Array]"], l = ArrayBuffer.isView || function(e4) {
49
+ })(), s = "FormData" in e3, a = "ArrayBuffer" in e3;
50
+ if (a) var o = ["[object Int8Array]", "[object Uint8Array]", "[object Uint8ClampedArray]", "[object Int16Array]", "[object Uint16Array]", "[object Int32Array]", "[object Uint32Array]", "[object Float32Array]", "[object Float64Array]"], l = ArrayBuffer.isView || function(e4) {
51
51
  return e4 && o.indexOf(Object.prototype.toString.call(e4)) > -1;
52
52
  };
53
53
  function d(e4) {
@@ -75,11 +75,11 @@ var require_magicfeedback_sdk_browser = __commonJS({
75
75
  this.append(t4, e4[t4]);
76
76
  }), this);
77
77
  }
78
- function h(e4) {
78
+ function m(e4) {
79
79
  if (e4.bodyUsed) return Promise.reject(new TypeError("Already read"));
80
80
  e4.bodyUsed = true;
81
81
  }
82
- function m(e4) {
82
+ function h(e4) {
83
83
  return new Promise((function(t4, i3) {
84
84
  e4.onload = function() {
85
85
  t4(e4.result);
@@ -89,31 +89,31 @@ var require_magicfeedback_sdk_browser = __commonJS({
89
89
  }));
90
90
  }
91
91
  function f(e4) {
92
- var t4 = new FileReader(), i3 = m(t4);
92
+ var t4 = new FileReader(), i3 = h(t4);
93
93
  return t4.readAsArrayBuffer(e4), i3;
94
94
  }
95
- function g(e4) {
95
+ function v(e4) {
96
96
  if (e4.slice) return e4.slice(0);
97
97
  var t4 = new Uint8Array(e4.byteLength);
98
98
  return t4.set(new Uint8Array(e4)), t4.buffer;
99
99
  }
100
- function v() {
100
+ function g() {
101
101
  return this.bodyUsed = false, this._initBody = function(e4) {
102
102
  var t4;
103
- this._bodyInit = e4, e4 ? "string" == typeof e4 ? this._bodyText = e4 : a2 && Blob.prototype.isPrototypeOf(e4) ? this._bodyBlob = e4 : s && FormData.prototype.isPrototypeOf(e4) ? this._bodyFormData = e4 : i2 && URLSearchParams.prototype.isPrototypeOf(e4) ? this._bodyText = e4.toString() : r && a2 && (t4 = e4) && DataView.prototype.isPrototypeOf(t4) ? (this._bodyArrayBuffer = g(e4.buffer), this._bodyInit = new Blob([this._bodyArrayBuffer])) : r && (ArrayBuffer.prototype.isPrototypeOf(e4) || l(e4)) ? this._bodyArrayBuffer = g(e4) : this._bodyText = e4 = Object.prototype.toString.call(e4) : this._bodyText = "", this.headers.get("content-type") || ("string" == typeof e4 ? this.headers.set("content-type", "text/plain;charset=UTF-8") : this._bodyBlob && this._bodyBlob.type ? this.headers.set("content-type", this._bodyBlob.type) : i2 && URLSearchParams.prototype.isPrototypeOf(e4) && this.headers.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8"));
104
- }, a2 && (this.blob = function() {
105
- var e4 = h(this);
103
+ this._bodyInit = e4, e4 ? "string" == typeof e4 ? this._bodyText = e4 : r2 && Blob.prototype.isPrototypeOf(e4) ? this._bodyBlob = e4 : s && FormData.prototype.isPrototypeOf(e4) ? this._bodyFormData = e4 : i2 && URLSearchParams.prototype.isPrototypeOf(e4) ? this._bodyText = e4.toString() : a && r2 && (t4 = e4) && DataView.prototype.isPrototypeOf(t4) ? (this._bodyArrayBuffer = v(e4.buffer), this._bodyInit = new Blob([this._bodyArrayBuffer])) : a && (ArrayBuffer.prototype.isPrototypeOf(e4) || l(e4)) ? this._bodyArrayBuffer = v(e4) : this._bodyText = e4 = Object.prototype.toString.call(e4) : this._bodyText = "", this.headers.get("content-type") || ("string" == typeof e4 ? this.headers.set("content-type", "text/plain;charset=UTF-8") : this._bodyBlob && this._bodyBlob.type ? this.headers.set("content-type", this._bodyBlob.type) : i2 && URLSearchParams.prototype.isPrototypeOf(e4) && this.headers.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8"));
104
+ }, r2 && (this.blob = function() {
105
+ var e4 = m(this);
106
106
  if (e4) return e4;
107
107
  if (this._bodyBlob) return Promise.resolve(this._bodyBlob);
108
108
  if (this._bodyArrayBuffer) return Promise.resolve(new Blob([this._bodyArrayBuffer]));
109
109
  if (this._bodyFormData) throw new Error("could not read FormData body as blob");
110
110
  return Promise.resolve(new Blob([this._bodyText]));
111
111
  }, this.arrayBuffer = function() {
112
- return this._bodyArrayBuffer ? h(this) || Promise.resolve(this._bodyArrayBuffer) : this.blob().then(f);
112
+ return this._bodyArrayBuffer ? m(this) || Promise.resolve(this._bodyArrayBuffer) : this.blob().then(f);
113
113
  }), this.text = function() {
114
- var e4, t4, i3, n3 = h(this);
114
+ var e4, t4, i3, n3 = m(this);
115
115
  if (n3) return n3;
116
- if (this._bodyBlob) return e4 = this._bodyBlob, i3 = m(t4 = new FileReader()), t4.readAsText(e4), i3;
116
+ if (this._bodyBlob) return e4 = this._bodyBlob, i3 = h(t4 = new FileReader()), t4.readAsText(e4), i3;
117
117
  if (this._bodyArrayBuffer) return Promise.resolve((function(e5) {
118
118
  for (var t5 = new Uint8Array(e5), i4 = new Array(t5.length), n4 = 0; n4 < t5.length; n4++) i4[n4] = String.fromCharCode(t5[n4]);
119
119
  return i4.join("");
@@ -121,7 +121,7 @@ var require_magicfeedback_sdk_browser = __commonJS({
121
121
  if (this._bodyFormData) throw new Error("could not read FormData body as text");
122
122
  return Promise.resolve(this._bodyText);
123
123
  }, s && (this.formData = function() {
124
- return this.text().then(b);
124
+ return this.text().then(E);
125
125
  }), this.json = function() {
126
126
  return this.text().then(JSON.parse);
127
127
  }, this;
@@ -157,39 +157,39 @@ var require_magicfeedback_sdk_browser = __commonJS({
157
157
  })), u(e4);
158
158
  }, n2 && (p.prototype[Symbol.iterator] = p.prototype.entries);
159
159
  var y = ["DELETE", "GET", "HEAD", "OPTIONS", "POST", "PUT"];
160
- function E(e4, t4) {
161
- var i3, n3, a3 = (t4 = t4 || {}).body;
162
- if (e4 instanceof E) {
160
+ function b(e4, t4) {
161
+ var i3, n3, r3 = (t4 = t4 || {}).body;
162
+ if (e4 instanceof b) {
163
163
  if (e4.bodyUsed) throw new TypeError("Already read");
164
- this.url = e4.url, this.credentials = e4.credentials, t4.headers || (this.headers = new p(e4.headers)), this.method = e4.method, this.mode = e4.mode, this.signal = e4.signal, a3 || null == e4._bodyInit || (a3 = e4._bodyInit, e4.bodyUsed = true);
164
+ this.url = e4.url, this.credentials = e4.credentials, t4.headers || (this.headers = new p(e4.headers)), this.method = e4.method, this.mode = e4.mode, this.signal = e4.signal, r3 || null == e4._bodyInit || (r3 = e4._bodyInit, e4.bodyUsed = true);
165
165
  } else this.url = String(e4);
166
- if (this.credentials = t4.credentials || this.credentials || "same-origin", !t4.headers && this.headers || (this.headers = new p(t4.headers)), this.method = (n3 = (i3 = t4.method || this.method || "GET").toUpperCase(), y.indexOf(n3) > -1 ? n3 : i3), this.mode = t4.mode || this.mode || null, this.signal = t4.signal || this.signal, this.referrer = null, ("GET" === this.method || "HEAD" === this.method) && a3) throw new TypeError("Body not allowed for GET or HEAD requests");
167
- this._initBody(a3);
166
+ if (this.credentials = t4.credentials || this.credentials || "same-origin", !t4.headers && this.headers || (this.headers = new p(t4.headers)), this.method = (n3 = (i3 = t4.method || this.method || "GET").toUpperCase(), y.indexOf(n3) > -1 ? n3 : i3), this.mode = t4.mode || this.mode || null, this.signal = t4.signal || this.signal, this.referrer = null, ("GET" === this.method || "HEAD" === this.method) && r3) throw new TypeError("Body not allowed for GET or HEAD requests");
167
+ this._initBody(r3);
168
168
  }
169
- function b(e4) {
169
+ function E(e4) {
170
170
  var t4 = new FormData();
171
171
  return e4.trim().split("&").forEach((function(e5) {
172
172
  if (e5) {
173
- var i3 = e5.split("="), n3 = i3.shift().replace(/\+/g, " "), a3 = i3.join("=").replace(/\+/g, " ");
174
- t4.append(decodeURIComponent(n3), decodeURIComponent(a3));
173
+ var i3 = e5.split("="), n3 = i3.shift().replace(/\+/g, " "), r3 = i3.join("=").replace(/\+/g, " ");
174
+ t4.append(decodeURIComponent(n3), decodeURIComponent(r3));
175
175
  }
176
176
  })), t4;
177
177
  }
178
- function A(e4, t4) {
178
+ function k(e4, t4) {
179
179
  t4 || (t4 = {}), this.type = "default", this.status = void 0 === t4.status ? 200 : t4.status, this.ok = this.status >= 200 && this.status < 300, this.statusText = "statusText" in t4 ? t4.statusText : "OK", this.headers = new p(t4.headers), this.url = t4.url || "", this._initBody(e4);
180
180
  }
181
- E.prototype.clone = function() {
182
- return new E(this, { body: this._bodyInit });
183
- }, v.call(E.prototype), v.call(A.prototype), A.prototype.clone = function() {
184
- return new A(this._bodyInit, { status: this.status, statusText: this.statusText, headers: new p(this.headers), url: this.url });
185
- }, A.error = function() {
186
- var e4 = new A(null, { status: 0, statusText: "" });
181
+ b.prototype.clone = function() {
182
+ return new b(this, { body: this._bodyInit });
183
+ }, g.call(b.prototype), g.call(k.prototype), k.prototype.clone = function() {
184
+ return new k(this._bodyInit, { status: this.status, statusText: this.statusText, headers: new p(this.headers), url: this.url });
185
+ }, k.error = function() {
186
+ var e4 = new k(null, { status: 0, statusText: "" });
187
187
  return e4.type = "error", e4;
188
188
  };
189
- var k = [301, 302, 303, 307, 308];
190
- A.redirect = function(e4, t4) {
191
- if (-1 === k.indexOf(t4)) throw new RangeError("Invalid status code");
192
- return new A(null, { status: t4, headers: { location: e4 } });
189
+ var A = [301, 302, 303, 307, 308];
190
+ k.redirect = function(e4, t4) {
191
+ if (-1 === A.indexOf(t4)) throw new RangeError("Invalid status code");
192
+ return new k(null, { status: t4, headers: { location: e4 } });
193
193
  }, t3.DOMException = e3.DOMException;
194
194
  try {
195
195
  new t3.DOMException();
@@ -202,8 +202,8 @@ var require_magicfeedback_sdk_browser = __commonJS({
202
202
  }
203
203
  function C(e4, i3) {
204
204
  return new Promise((function(n3, s2) {
205
- var r2 = new E(e4, i3);
206
- if (r2.signal && r2.signal.aborted) return s2(new t3.DOMException("Aborted", "AbortError"));
205
+ var a2 = new b(e4, i3);
206
+ if (a2.signal && a2.signal.aborted) return s2(new t3.DOMException("Aborted", "AbortError"));
207
207
  var o2 = new XMLHttpRequest();
208
208
  function l2() {
209
209
  o2.abort();
@@ -212,31 +212,31 @@ var require_magicfeedback_sdk_browser = __commonJS({
212
212
  var e5, t4, i4 = { status: o2.status, statusText: o2.statusText, headers: (e5 = o2.getAllResponseHeaders() || "", t4 = new p(), e5.replace(/\r?\n[\t ]+/g, " ").split(/\r?\n/).forEach((function(e6) {
213
213
  var i5 = e6.split(":"), n4 = i5.shift().trim();
214
214
  if (n4) {
215
- var a4 = i5.join(":").trim();
216
- t4.append(n4, a4);
215
+ var r4 = i5.join(":").trim();
216
+ t4.append(n4, r4);
217
217
  }
218
218
  })), t4) };
219
219
  i4.url = "responseURL" in o2 ? o2.responseURL : i4.headers.get("X-Request-URL");
220
- var a3 = "response" in o2 ? o2.response : o2.responseText;
221
- n3(new A(a3, i4));
220
+ var r3 = "response" in o2 ? o2.response : o2.responseText;
221
+ n3(new k(r3, i4));
222
222
  }, o2.onerror = function() {
223
223
  s2(new TypeError("Network request failed"));
224
224
  }, o2.ontimeout = function() {
225
225
  s2(new TypeError("Network request failed"));
226
226
  }, o2.onabort = function() {
227
227
  s2(new t3.DOMException("Aborted", "AbortError"));
228
- }, o2.open(r2.method, r2.url, true), "include" === r2.credentials ? o2.withCredentials = true : "omit" === r2.credentials && (o2.withCredentials = false), "responseType" in o2 && a2 && (o2.responseType = "blob"), r2.headers.forEach((function(e5, t4) {
228
+ }, o2.open(a2.method, a2.url, true), "include" === a2.credentials ? o2.withCredentials = true : "omit" === a2.credentials && (o2.withCredentials = false), "responseType" in o2 && r2 && (o2.responseType = "blob"), a2.headers.forEach((function(e5, t4) {
229
229
  o2.setRequestHeader(t4, e5);
230
- })), r2.signal && (r2.signal.addEventListener("abort", l2), o2.onreadystatechange = function() {
231
- 4 === o2.readyState && r2.signal.removeEventListener("abort", l2);
232
- }), o2.send(void 0 === r2._bodyInit ? null : r2._bodyInit);
230
+ })), a2.signal && (a2.signal.addEventListener("abort", l2), o2.onreadystatechange = function() {
231
+ 4 === o2.readyState && a2.signal.removeEventListener("abort", l2);
232
+ }), o2.send(void 0 === a2._bodyInit ? null : a2._bodyInit);
233
233
  }));
234
234
  }
235
- C.polyfill = true, e3.fetch || (e3.fetch = C, e3.Headers = p, e3.Request = E, e3.Response = A), t3.Headers = p, t3.Request = E, t3.Response = A, t3.fetch = C, Object.defineProperty(t3, "__esModule", { value: true });
235
+ C.polyfill = true, e3.fetch || (e3.fetch = C, e3.Headers = p, e3.Request = b, e3.Response = k), t3.Headers = p, t3.Request = b, t3.Response = k, t3.fetch = C, Object.defineProperty(t3, "__esModule", { value: true });
236
236
  })({});
237
237
  })(n), n.fetch.ponyfill = true, delete n.fetch.polyfill;
238
- var a = n;
239
- (t2 = a.fetch).default = a.fetch, t2.fetch = a.fetch, t2.Headers = a.Headers, t2.Request = a.Request, t2.Response = a.Response, e2.exports = t2;
238
+ var r = n;
239
+ (t2 = r.fetch).default = r.fetch, t2.fetch = r.fetch, t2.Headers = r.Headers, t2.Request = r.Request, t2.Response = r.Response, e2.exports = t2;
240
240
  }, 317: (e2, t2) => {
241
241
  "use strict";
242
242
  Object.defineProperty(t2, "__esModule", { value: true }), t2.HOST_API_URL_DEV = t2.HOST_API_URL = void 0, t2.HOST_API_URL = "https://api.deepdots.com/", t2.HOST_API_URL_DEV = "https://api-dev.deepdots.com/";
@@ -246,14 +246,14 @@ var require_magicfeedback_sdk_browser = __commonJS({
246
246
  return e3 && e3.__esModule ? e3 : { default: e3 };
247
247
  };
248
248
  Object.defineProperty(t2, "__esModule", { value: true });
249
- const a = n(i(927));
249
+ const r = n(i(927));
250
250
  let s = null;
251
- s || (s = (0, a.default)()), t2.default = s;
251
+ s || (s = (0, r.default)()), t2.default = s;
252
252
  }, 927: function(e2, t2, i) {
253
253
  "use strict";
254
254
  var n = this && this.__awaiter || function(e3, t3, i2, n2) {
255
- return new (i2 || (i2 = Promise))((function(a2, s2) {
256
- function r2(e4) {
255
+ return new (i2 || (i2 = Promise))((function(r2, s2) {
256
+ function a2(e4) {
257
257
  try {
258
258
  l2(n2.next(e4));
259
259
  } catch (e5) {
@@ -269,35 +269,36 @@ var require_magicfeedback_sdk_browser = __commonJS({
269
269
  }
270
270
  function l2(e4) {
271
271
  var t4;
272
- e4.done ? a2(e4.value) : (t4 = e4.value, t4 instanceof i2 ? t4 : new i2((function(e5) {
272
+ e4.done ? r2(e4.value) : (t4 = e4.value, t4 instanceof i2 ? t4 : new i2((function(e5) {
273
273
  e5(t4);
274
- }))).then(r2, o2);
274
+ }))).then(a2, o2);
275
275
  }
276
276
  l2((n2 = n2.apply(e3, t3 || [])).next());
277
277
  }));
278
278
  };
279
279
  Object.defineProperty(t2, "__esModule", { value: true });
280
- const a = i(57), s = i(665), r = i(256), o = i(313), l = i(317);
280
+ const r = i(57), s = i(665), a = i(256), o = i(313), l = i(317);
281
281
  t2.default = function() {
282
282
  const e3 = new s.Config();
283
- let t3;
283
+ let t3 = new a.Log(e3);
284
284
  return { init: function(i2) {
285
- (null == i2 ? void 0 : i2.debug) && e3.set("debug", null == i2 ? void 0 : i2.debug), e3.set("url", (null == i2 ? void 0 : i2.env) && "dev" === (null == i2 ? void 0 : i2.env) ? l.HOST_API_URL_DEV : l.HOST_API_URL), e3.set("env", null == i2 ? void 0 : i2.env), t3 = new r.Log(e3), t3.log("Initialized Magicfeedback", e3);
286
- }, send: function(i2, a2, s2, r2 = true, l2, d) {
285
+ "boolean" == typeof (null == i2 ? void 0 : i2.debug) && e3.set("debug", i2.debug), "boolean" == typeof (null == i2 ? void 0 : i2.dryRun) && e3.set("dryRun", i2.dryRun), e3.set("url", (null == i2 ? void 0 : i2.env) && "dev" === (null == i2 ? void 0 : i2.env) ? l.HOST_API_URL_DEV : l.HOST_API_URL), e3.set("env", null == i2 ? void 0 : i2.env), t3.log("Initialized Magicfeedback", e3);
286
+ }, send: function(i2, r2, s2, a2 = true, l2, d) {
287
287
  return n(this, void 0, void 0, (function* () {
288
- i2 || t3.err("No appID provided"), a2 || t3.err("No publicKey provided"), s2 || t3.err("No feedback provided"), s2.answers || s2.profile || s2.metrics || s2.metadata || t3.err("No feedback data provided");
289
- const n2 = e3.get("url"), c = { integration: i2, publicKey: a2, privateKey: d, completed: r2, id: l2, feedback: s2 };
288
+ i2 || t3.err("No appID provided"), r2 || t3.err("No publicKey provided"), s2 || t3.err("No feedback provided"), s2.answers || s2.profile || s2.metrics || s2.metadata || t3.err("No feedback data provided");
289
+ const n2 = e3.get("url"), c = { integration: i2, publicKey: r2, privateKey: d, completed: a2, id: l2, feedback: s2 };
290
290
  try {
291
- const e4 = yield (0, o.sendFeedback)(n2, c, t3);
292
- return t3.log("sent native feedback"), e4;
291
+ if (e3.get("dryRun")) return t3.log("Dry run enabled: skipping native feedback submit"), `dry-run-${Date.now()}`;
292
+ const i3 = yield (0, o.sendFeedback)(n2, c, t3);
293
+ return t3.log("sent native feedback"), i3;
293
294
  } catch (e4) {
294
295
  return t3.err("error native feedback", e4), false;
295
296
  }
296
297
  }));
297
- }, form: function(i2, n2) {
298
- return i2 || t3.err("No appID provided"), n2 || t3.err("No publicKey provided"), new a.Form(e3, i2, n2);
298
+ }, form: function(i2, n2, s2, a2) {
299
+ return i2 || t3.err("No appID provided"), n2 || t3.err("No publicKey provided"), new r.Form(e3, i2, n2, s2, a2);
299
300
  }, session: function(i2) {
300
- return i2 || t3.err("No sessionId provided"), new a.Form(e3, i2);
301
+ return i2 || t3.err("No sessionId provided"), new r.Form(e3, i2);
301
302
  } };
302
303
  };
303
304
  }, 79: (e2, t2) => {
@@ -335,7 +336,7 @@ var require_magicfeedback_sdk_browser = __commonJS({
335
336
  "use strict";
336
337
  Object.defineProperty(t2, "__esModule", { value: true }), t2.Config = void 0, t2.Config = class {
337
338
  constructor() {
338
- this.variables = {}, this.variables.env = "prod", this.variables.debug = false;
339
+ this.variables = {}, this.variables.env = "prod", this.variables.debug = false, this.variables.dryRun = false;
339
340
  }
340
341
  get(e3) {
341
342
  return this.variables[e3];
@@ -347,8 +348,8 @@ var require_magicfeedback_sdk_browser = __commonJS({
347
348
  }, 57: function(e2, t2, i) {
348
349
  "use strict";
349
350
  var n = this && this.__awaiter || function(e3, t3, i2, n2) {
350
- return new (i2 || (i2 = Promise))((function(a2, s2) {
351
- function r2(e4) {
351
+ return new (i2 || (i2 = Promise))((function(r2, s2) {
352
+ function a2(e4) {
352
353
  try {
353
354
  l2(n2.next(e4));
354
355
  } catch (e5) {
@@ -364,28 +365,28 @@ var require_magicfeedback_sdk_browser = __commonJS({
364
365
  }
365
366
  function l2(e4) {
366
367
  var t4;
367
- e4.done ? a2(e4.value) : (t4 = e4.value, t4 instanceof i2 ? t4 : new i2((function(e5) {
368
+ e4.done ? r2(e4.value) : (t4 = e4.value, t4 instanceof i2 ? t4 : new i2((function(e5) {
368
369
  e5(t4);
369
- }))).then(r2, o2);
370
+ }))).then(a2, o2);
370
371
  }
371
372
  l2((n2 = n2.apply(e3, t3 || [])).next());
372
373
  }));
373
374
  };
374
375
  Object.defineProperty(t2, "__esModule", { value: true }), t2.Form = void 0;
375
- const a = i(558), s = i(256), r = i(313), o = i(213), l = i(217), d = i(700), c = i(591), u = i(79), p = i(636);
376
+ const r = i(558), s = i(256), a = i(313), o = i(213), l = i(989), d = i(700), c = i(591), u = i(79), p = i(636);
376
377
  t2.Form = class {
377
- constructor(e3, t3, i2) {
378
- this.config = e3, this.log = new s.Log(e3), this.formOptionsConfig = { addButton: true, sendButtonText: "Send", backButtonText: "Back", nextButtonText: "Next", addSuccessScreen: true, getMetaData: true, questionFormat: "standard" }, this.selector = "", this.appId = t3, this.publicKey = i2 || "", this.url = e3.get("url"), this.id = "", this.formData = null, this.feedback = { text: "", answers: [], profile: [], metrics: [], metadata: [] }, this.history = new u.History(), this.graph = new l.PageGraph([]), this.progress = 0, this.total = 0, this.completed = false, this.timeToCompleted = 0;
378
+ constructor(e3, t3, i2, n2, r2) {
379
+ this.config = e3, this.log = new s.Log(e3), this.formOptionsConfig = { addButton: true, sendButtonText: "Send", backButtonText: "Back", nextButtonText: "Next", addSuccessScreen: true, getMetaData: true, customMetaData: [], questionFormat: "standard" }, this.selector = "", this.appId = t3, this.publicKey = i2 || "", this.url = e3.get("url"), this.id = "", this.formData = null, this.feedback = { text: "", answers: [], profile: null != n2 ? n2 : [], metrics: [], metadata: null != r2 ? r2 : [] }, this.history = new u.History(), this.graph = new l.PageGraph([]), this.progress = 0, this.total = 0, this.completed = false, this.timeToCompleted = 0;
379
380
  }
380
381
  generate(e3, t3) {
381
- var i2, a2, s2, o2, l2, d2, c2;
382
+ var i2, r2, s2, o2, l2, d2, c2;
382
383
  return n(this, void 0, void 0, (function* () {
383
384
  try {
384
385
  this.formOptionsConfig = Object.assign(Object.assign({}, this.formOptionsConfig), t3), this.selector = e3;
385
386
  let n2 = this.formData;
386
- if (void 0 !== this.formData && this.formData || (n2 = "" !== this.publicKey ? yield (0, r.getForm)(this.url, this.appId, this.publicKey, this.log) : yield (0, r.getSessionForm)(this.url, this.appId, this.log)), void 0 === n2 || !n2) throw new Error(`No data for app ${this.appId}`);
387
+ if (void 0 !== this.formData && this.formData || (n2 = "" !== this.publicKey ? yield (0, a.getForm)(this.url, this.appId, this.publicKey, this.log) : yield (0, a.getSessionForm)(this.url, this.appId, this.log)), void 0 === n2 || !n2) throw new Error(`No data for app ${this.appId}`);
387
388
  if (null === (i2 = n2.error) || void 0 === i2 ? void 0 : i2.message) throw new Error(n2.error.message);
388
- if (n2.questions = (null === (a2 = n2.questions) || void 0 === a2 ? void 0 : a2.filter(((e4) => "ACTIVE" === e4.status))) || [], n2.pages = (null === (s2 = n2.pages) || void 0 === s2 ? void 0 : s2.filter(((e4) => "ACTIVE" === e4.status))) || [], null === (o2 = n2.pages) || void 0 === o2 || o2.forEach(((e4) => {
389
+ if (n2.questions = (null === (r2 = n2.questions) || void 0 === r2 ? void 0 : r2.filter(((e4) => "ACTIVE" === e4.status))) || [], n2.pages = (null === (s2 = n2.pages) || void 0 === s2 ? void 0 : s2.filter(((e4) => "ACTIVE" === e4.status))) || [], null === (o2 = n2.pages) || void 0 === o2 || o2.forEach(((e4) => {
389
390
  var t4;
390
391
  return e4.integrationQuestions = null === (t4 = e4.integrationQuestions) || void 0 === t4 ? void 0 : t4.filter(((e5) => "ACTIVE" === e5.status));
391
392
  })), this.formData = n2, this.formData.savedAt || (this.formData.savedAt = /* @__PURE__ */ new Date(), localStorage.setItem(`magicfeedback-${this.appId}`, JSON.stringify(this.formData))), void 0 === this.formData.questions || !this.formData.questions) throw new Error(`No questions for app ${this.appId}`);
@@ -404,8 +405,8 @@ var require_magicfeedback_sdk_browser = __commonJS({
404
405
  case "MAGICSURVEY":
405
406
  this.formData.pages = [], null === (e3 = this.formData.questions) || void 0 === e3 || e3.forEach(((e4) => {
406
407
  var t4, i2;
407
- const n2 = new c.PageRoute(e4.id, e4.ref, c.OperatorType.NOEQUAL, [], c.TransitionType.PAGE, (e4.position + 1).toString(), e4.position.toString()), a2 = new d.Page(e4.position.toString(), e4.position, this.appId, [e4], [n2]);
408
- null === (i2 = null === (t4 = this.formData) || void 0 === t4 ? void 0 : t4.pages) || void 0 === i2 || i2.push(a2);
408
+ const n2 = new c.PageRoute(e4.id, e4.ref, c.OperatorType.NOEQUAL, [], c.TransitionType.PAGE, (e4.position + 1).toString(), e4.position.toString()), r2 = new d.Page(e4.position.toString(), e4.position, this.appId, [e4], [n2]);
409
+ null === (i2 = null === (t4 = this.formData) || void 0 === t4 ? void 0 : t4.pages) || void 0 === i2 || i2.push(r2);
409
410
  }));
410
411
  break;
411
412
  case "MAGICFORM":
@@ -419,25 +420,25 @@ var require_magicfeedback_sdk_browser = __commonJS({
419
420
  return e3.classList.add("magicfeedback-container"), e3.id = "magicfeedback-container-" + this.appId, e3.innerHTML = "", e3;
420
421
  }
421
422
  generateForm() {
422
- var e3, t3, i2, a2;
423
+ var e3, t3, i2, r2;
423
424
  return n(this, void 0, void 0, (function* () {
424
425
  try {
425
- if (console.log("Generating form for appId:", this.appId), !this.formData || !this.formData.pages || 0 === this.formData.pages.length) throw new Error("No form data");
426
+ if (!this.formData || !this.formData.pages || 0 === this.formData.pages.length) throw new Error("No form data");
426
427
  this.graph = new l.PageGraph(this.formData.pages.sort(((e4, t4) => e4.position - t4.position)));
427
428
  let n2 = this.generateContainer();
428
429
  const s2 = document.createElement("form");
429
430
  s2.classList.add("magicfeedback-form"), s2.id = "magicfeedback-" + this.appId, s2.addEventListener("submit", ((e4) => e4.preventDefault()));
430
- const r2 = document.createElement("div");
431
- r2.classList.add("magicfeedback-questions"), r2.id = "magicfeedback-questions-" + this.appId;
431
+ const a2 = document.createElement("div");
432
+ a2.classList.add("magicfeedback-questions"), a2.id = "magicfeedback-questions-" + this.appId;
432
433
  const d2 = this.graph.getFirstPage();
433
434
  if (!d2) throw new Error("No page found");
434
- if (this.total = this.graph.findMaxDepth(), d2.elements = (0, o.renderQuestions)(d2.questions, this.formOptionsConfig.questionFormat, null === (e3 = this.formData) || void 0 === e3 ? void 0 : e3.lang[0], null === (t3 = this.formData) || void 0 === t3 ? void 0 : t3.product, (() => this.send())), null === (i2 = d2.elements) || void 0 === i2 || i2.forEach(((e4) => r2.appendChild(e4))), s2.appendChild(r2), this.history.enqueue(d2), n2.appendChild(s2), this.progress = this.total - this.graph.findMaxDepth(d2), this.formOptionsConfig.addButton) {
435
- const e4 = (0, o.renderActions)(null === (a2 = this.formData) || void 0 === a2 ? void 0 : a2.identity, (() => this.back()), this.formOptionsConfig.sendButtonText, this.formOptionsConfig.backButtonText, this.formOptionsConfig.nextButtonText);
435
+ if (this.total = this.graph.findMaxDepth(), d2.elements = (0, o.renderQuestions)(d2.questions, this.formOptionsConfig.questionFormat, null === (e3 = this.formData) || void 0 === e3 ? void 0 : e3.lang[0], null === (t3 = this.formData) || void 0 === t3 ? void 0 : t3.product, (() => this.send())), null === (i2 = d2.elements) || void 0 === i2 || i2.forEach(((e4) => a2.appendChild(e4))), s2.appendChild(a2), this.history.enqueue(d2), n2.appendChild(s2), this.progress = this.total - this.graph.findMaxDepth(d2), this.formOptionsConfig.addButton) {
436
+ const e4 = (0, o.renderActions)(null === (r2 = this.formData) || void 0 === r2 ? void 0 : r2.identity, (() => this.back()), this.formOptionsConfig.sendButtonText, this.formOptionsConfig.backButtonText, this.formOptionsConfig.nextButtonText);
436
437
  s2.appendChild(e4);
437
438
  }
438
439
  this.formOptionsConfig.addButton && s2.addEventListener("submit", ((e4) => {
439
440
  e4.preventDefault(), this.send();
440
- })), this.timeToCompleted = (/* @__PURE__ */ new Date()).getTime() / 1e3, this.formOptionsConfig.onLoadedEvent && (yield this.formOptionsConfig.onLoadedEvent({ loading: false, progress: this.progress, total: this.total, formData: this.formData }));
441
+ })), this.timeToCompleted = Date.now(), this.formOptionsConfig.onLoadedEvent && (yield this.formOptionsConfig.onLoadedEvent({ loading: false, progress: this.progress, total: this.total, formData: this.formData, formOptionsConfig: this.formOptionsConfig }));
441
442
  } catch (e4) {
442
443
  return this.log.err(e4), void (this.formOptionsConfig.onLoadedEvent && this.formOptionsConfig.onLoadedEvent({ loading: false, error: e4 }));
443
444
  }
@@ -457,7 +458,12 @@ var require_magicfeedback_sdk_browser = __commonJS({
457
458
  }));
458
459
  }
459
460
  getMetaData() {
460
- this.feedback.metadata.push({ key: "navigator-url", value: [window.location.href] }), this.feedback.metadata.push({ key: "navigator-origin", value: [window.location.origin] }), this.feedback.metadata.push({ key: "navigator-pathname", value: [window.location.pathname] }), this.feedback.metadata.push({ key: "navigator-search", value: [window.location.search] }), this.feedback.metadata.push({ key: "navigator-user", value: [navigator.userAgent] }), this.feedback.metadata.push({ key: "navigator-language", value: [navigator.language] }), this.feedback.metadata.push({ key: "navigator-platform", value: [navigator.platform] }), this.feedback.metadata.push({ key: "navigator-appVersion", value: [navigator.appVersion] }), this.feedback.metadata.push({ key: "navigator-appName", value: [navigator.appName] }), this.feedback.metadata.push({ key: "navigator-product", value: [navigator.product] }), this.feedback.metadata.push({ key: "screen-width", value: [window.screen.width.toString()] }), this.feedback.metadata.push({ key: "screen-height", value: [window.screen.height.toString()] }), this.appId && "" === this.publicKey && this.feedback.metadata.push({ key: "MAGICFEEDBACK_SESSION", value: [this.appId] });
461
+ this.formOptionsConfig.customMetaData && (this.feedback.metadata = [...this.feedback.metadata, ...this.formOptionsConfig.customMetaData]), this.feedback.metadata.push({ key: "navigator-url", value: [window.location.href] }), this.feedback.metadata.push({ key: "navigator-origin", value: [window.location.origin] }), this.feedback.metadata.push({ key: "navigator-pathname", value: [window.location.pathname] }), this.feedback.metadata.push({ key: "navigator-search", value: [window.location.search] });
462
+ const e3 = new URLSearchParams(window.location.search);
463
+ Array.from(new Set(e3.keys())).forEach(((t3) => {
464
+ const i2 = e3.getAll(t3);
465
+ i2.length > 0 && this.feedback.metadata.push({ key: `query-${t3}`, value: i2 });
466
+ })), this.feedback.metadata.push({ key: "navigator-user", value: [navigator.userAgent] }), this.feedback.metadata.push({ key: "navigator-language", value: [navigator.language] }), this.feedback.metadata.push({ key: "navigator-platform", value: [navigator.platform] }), this.feedback.metadata.push({ key: "navigator-appVersion", value: [navigator.appVersion] }), this.feedback.metadata.push({ key: "navigator-appName", value: [navigator.appName] }), this.feedback.metadata.push({ key: "navigator-product", value: [navigator.product] }), this.feedback.metadata.push({ key: "screen-width", value: [window.screen.width.toString()] }), this.feedback.metadata.push({ key: "screen-height", value: [window.screen.height.toString()] }), this.appId && "" === this.publicKey && this.feedback.metadata.push({ key: "MAGICFEEDBACK_SESSION", value: [this.appId] });
461
467
  }
462
468
  send(e3, t3, i2) {
463
469
  return n(this, void 0, void 0, (function* () {
@@ -466,17 +472,28 @@ var require_magicfeedback_sdk_browser = __commonJS({
466
472
  i2 && (this.feedback.profile = [...this.feedback.profile, ...i2]), t3 && (this.feedback.metrics = [...this.feedback.metrics, ...t3]), e3 && (this.feedback.metadata = [...this.feedback.metadata, ...e3]), this.answer(), this.formOptionsConfig.beforeSubmitEvent && (yield this.formOptionsConfig.beforeSubmitEvent({ loading: true, progress: this.progress, total: this.total }));
467
473
  const s2 = this.history.back();
468
474
  if (!s2) throw new Error("No page found");
469
- for (const e4 of s2.questions.filter(((e5) => e5.require && ![a.FEEDBACKAPPANSWERTYPE.CONSENT, a.FEEDBACKAPPANSWERTYPE.INFO_PAGE].includes(e5.type)))) {
475
+ for (const e4 of s2.questions.filter(((e5) => e5.require && ![r.FEEDBACKAPPANSWERTYPE.CONSENT, r.FEEDBACKAPPANSWERTYPE.INFO_PAGE].includes(e5.type)))) {
470
476
  const t4 = e4.assets, i3 = this.feedback.answers.filter(((t5) => t5.key.includes(e4.ref) && !t5.key.includes("extra-option")));
471
477
  if (0 === i3.length || i3.find(((e5) => 0 === e5.value.length))) throw this.log.err(`The question ${e4.ref} is required`), new Error("No response");
472
478
  if (null == t4 ? void 0 : t4.minOptions) {
473
479
  let n3 = [];
474
480
  if ((null == t4 ? void 0 : t4.exclusiveAnswers) && (n3 = null == t4 ? void 0 : t4.exclusiveAnswers), !i3[0].value.find(((e5) => n3.includes(e5))) && i3[0].value.length < (null == t4 ? void 0 : t4.minOptions)) throw this.log.err(`The question ${e4.ref} requires at least ${null == t4 ? void 0 : t4.minOptions} options`), new Error("No response");
475
481
  }
482
+ if (e4.type === r.FEEDBACKAPPANSWERTYPE.MULTI_QUESTION_MATRIX) {
483
+ const i4 = this.feedback.answers.find(((t5) => t5.key === e4.ref));
484
+ if (!i4) throw this.log.err(`The matrix question ${e4.ref} is required`), new Error("No response");
485
+ const n3 = this.parseMatrixAnswerPre(i4), r2 = Array.isArray(null == t4 ? void 0 : t4.options) ? t4.options : [];
486
+ if (r2.length > 0) {
487
+ if (r2.find(((e5) => {
488
+ const t5 = n3.find(((t6) => t6.key === e5));
489
+ return !t5 || !Array.isArray(t5.value) || 0 === t5.value.length;
490
+ }))) throw this.log.err(`The matrix question ${e4.ref} requires an answer in every row`), new Error("No response");
491
+ } else if (0 === n3.length || n3.some(((e5) => !Array.isArray(e5.value) || 0 === e5.value.length))) throw this.log.err(`The matrix question ${e4.ref} requires an answer in every row`), new Error("No response");
492
+ }
476
493
  }
477
- const r2 = yield this.pushAnswers(false);
478
- if (!r2) throw new Error("No response");
479
- this.id = r2, yield this.processNextQuestion(n2);
494
+ const a2 = yield this.pushAnswers(false);
495
+ if (!a2) throw new Error("No response");
496
+ this.id = a2, yield this.processNextQuestion(n2);
480
497
  } catch (e4) {
481
498
  this.log.err(`An error occurred while submitting the form ${this.appId}:`, e4), this.formOptionsConfig.afterSubmitEvent && (yield this.formOptionsConfig.afterSubmitEvent({ loading: false, progress: this.progress, total: this.total, error: e4 }));
482
499
  }
@@ -484,86 +501,108 @@ var require_magicfeedback_sdk_browser = __commonJS({
484
501
  }
485
502
  answer() {
486
503
  const e3 = document.getElementById("magicfeedback-" + this.appId);
487
- if (!e3) return this.log.err(`Form "${e3}" not found.`), void (this.feedback.answers = []);
504
+ if (!e3) return this.log.err(`Form "${e3}" not found.`), this.feedback.answers = [], [];
488
505
  const t3 = this.history.back();
489
- if (!t3) throw new Error("No page found");
506
+ if (!t3) {
507
+ const t4 = e3.querySelectorAll(".magicfeedback-input"), i3 = [], n3 = {};
508
+ return t4.forEach(((e4) => {
509
+ var t5;
510
+ const r2 = e4, s3 = r2.name;
511
+ if (!s3) return;
512
+ const a2 = r2.type;
513
+ if (("radio" === a2 || "checkbox" === a2) && !r2.checked) return;
514
+ const o3 = r2.value, l3 = r2.classList[0];
515
+ if ((null == l3 ? void 0 : l3.includes("magicfeedback-priority-list")) || (null === (t5 = r2.id) || void 0 === t5 ? void 0 : t5.startsWith("priority-list-"))) return n3[s3] || (n3[s3] = []), void n3[s3].push(o3);
516
+ const d3 = "magicfeedback-consent" === l3 ? r2.checked.toString() : o3;
517
+ if (null == d3) return;
518
+ const c2 = { key: s3, value: [d3] };
519
+ i3.push(c2);
520
+ })), Object.entries(n3).forEach((([e4, t5]) => {
521
+ const n4 = t5.slice().sort(((e5, t6) => Number(e5.split(".")[0]) - Number(t6.split(".")[0])));
522
+ i3.push({ key: e4, value: n4 });
523
+ })), this.feedback.answers = i3, i3;
524
+ }
490
525
  const i2 = [];
491
526
  let n2 = false;
492
- if (e3.querySelectorAll(".magicfeedback-input").forEach(((e4) => {
493
- const s2 = t3.questions.find(((t4) => {
494
- var i3;
495
- return null === (i3 = e4.name) || void 0 === i3 ? void 0 : i3.includes(t4.ref);
496
- })), o2 = e4.type, l2 = e4.classList[0], d2 = { key: e4.name, value: [] }, c2 = "magicfeedback-consent" === l2 ? e4.checked.toString() : e4.value;
497
- if (d2.key && "" !== d2.key) {
498
- switch (null == s2 ? void 0 : s2.type) {
499
- case a.FEEDBACKAPPANSWERTYPE.EMAIL:
500
- case a.FEEDBACKAPPANSWERTYPE.TEXT:
501
- case a.FEEDBACKAPPANSWERTYPE.LONGTEXT:
502
- case a.FEEDBACKAPPANSWERTYPE.NUMBER:
503
- case a.FEEDBACKAPPANSWERTYPE.DATE:
504
- case a.FEEDBACKAPPANSWERTYPE.CONTACT:
505
- if ("" !== c2) {
506
- if ("email" === o2) {
507
- if (!(0, r.validateEmail)(c2)) {
508
- this.log.err("Invalid email"), n2 = true;
509
- break;
510
- }
511
- this.feedback.profile.push({ key: "email", value: [c2] });
512
- }
513
- d2.value.push(c2);
514
- }
515
- break;
516
- case a.FEEDBACKAPPANSWERTYPE.CONSENT:
517
- d2.value.push(String(e4.checked));
518
- break;
519
- case a.FEEDBACKAPPANSWERTYPE.POINT_SYSTEM:
520
- const t4 = e4.id;
521
- d2.value.push(`${t4}:${c2}%`);
522
- break;
523
- case a.FEEDBACKAPPANSWERTYPE.MULTIPLECHOICE:
524
- case a.FEEDBACKAPPANSWERTYPE.MULTIPLECHOISE_IMAGE:
525
- case a.FEEDBACKAPPANSWERTYPE.RATING_STAR:
526
- case a.FEEDBACKAPPANSWERTYPE.RADIO:
527
- case a.FEEDBACKAPPANSWERTYPE.RATING_EMOJI:
528
- case a.FEEDBACKAPPANSWERTYPE.RATING_NUMBER:
529
- (e4.checked || e4.id.includes("extra-option-")) && d2.value.push(c2);
530
- break;
531
- case a.FEEDBACKAPPANSWERTYPE.SELECT:
532
- d2.value.push(c2);
533
- break;
534
- case a.FEEDBACKAPPANSWERTYPE.BOOLEAN:
535
- case a.FEEDBACKAPPANSWERTYPE.MULTI_QUESTION_MATRIX:
536
- e4.checked && d2.value.push(c2);
537
- break;
538
- case a.FEEDBACKAPPANSWERTYPE.PRIORITY_LIST:
539
- d2.value.push(c2);
540
- }
541
- if ((null == i2 ? void 0 : i2.length) > 0 && (null == i2 ? void 0 : i2.find(((e5) => e5.key === d2.key)))) {
542
- const e5 = i2.findIndex(((e6) => e6.key === d2.key));
543
- i2[e5].value = [...i2[e5].value, ...d2.value];
544
- } else i2.push(d2);
527
+ const s2 = e3.querySelectorAll(".magicfeedback-input"), o2 = {}, l2 = {}, d2 = {};
528
+ if (s2.forEach(((e4) => {
529
+ const s3 = e4, c2 = t3.questions.find(((e5) => {
530
+ var t4;
531
+ return null === (t4 = s3.name) || void 0 === t4 ? void 0 : t4.includes(e5.ref);
532
+ })), u2 = s3.type, p2 = s3.classList[0], m = { key: s3.name, value: [] }, h = "magicfeedback-consent" === p2 ? s3.checked.toString() : s3.value;
533
+ if (m.key && "" !== m.key) if (m.key.startsWith("extra-option-")) "" !== h && (m.value.push(h), i2.push(m));
534
+ else switch (null == c2 ? void 0 : c2.type) {
535
+ case r.FEEDBACKAPPANSWERTYPE.EMAIL:
536
+ case r.FEEDBACKAPPANSWERTYPE.TEXT:
537
+ case r.FEEDBACKAPPANSWERTYPE.LONGTEXT:
538
+ case r.FEEDBACKAPPANSWERTYPE.NUMBER:
539
+ case r.FEEDBACKAPPANSWERTYPE.DATE:
540
+ case r.FEEDBACKAPPANSWERTYPE.CONTACT:
541
+ case r.FEEDBACKAPPANSWERTYPE.PASSWORD:
542
+ "" !== h && ("email" === u2 ? (0, a.validateEmail)(h) ? (this.feedback.profile.push({ key: "email", value: [h] }), m.value.push(h), i2.push(m)) : (this.log.err("Invalid email"), n2 = true) : (m.value.push(h), i2.push(m)));
543
+ break;
544
+ case r.FEEDBACKAPPANSWERTYPE.RADIO:
545
+ s3.checked && (m.value.push(h), i2.push(m));
546
+ break;
547
+ case r.FEEDBACKAPPANSWERTYPE.MULTIPLECHOICE:
548
+ case r.FEEDBACKAPPANSWERTYPE.MULTIPLECHOISE_IMAGE:
549
+ s3.checked && (l2[m.key] || (l2[m.key] = []), l2[m.key].push(h));
550
+ break;
551
+ case r.FEEDBACKAPPANSWERTYPE.BOOLEAN:
552
+ s3.checked && (m.value.push(h), i2.push(m));
553
+ break;
554
+ case r.FEEDBACKAPPANSWERTYPE.CONSENT:
555
+ m.value.push(s3.checked.toString()), i2.push(m);
556
+ break;
557
+ case r.FEEDBACKAPPANSWERTYPE.RATING_EMOJI:
558
+ case r.FEEDBACKAPPANSWERTYPE.RATING_NUMBER:
559
+ case r.FEEDBACKAPPANSWERTYPE.RATING_STAR:
560
+ s3.checked && (m.value.push(h), i2.push(m));
561
+ break;
562
+ case r.FEEDBACKAPPANSWERTYPE.SELECT:
563
+ "" !== h && (m.value.push(h), i2.push(m));
564
+ break;
565
+ case r.FEEDBACKAPPANSWERTYPE.POINT_SYSTEM:
566
+ "number" === u2 && s3.id && (d2[m.key] || (d2[m.key] = []), "" !== h && d2[m.key].push(`${s3.id}:${h}%`));
567
+ break;
568
+ case r.FEEDBACKAPPANSWERTYPE.PRIORITY_LIST:
569
+ "hidden" === u2 && (o2[m.key] || (o2[m.key] = []), o2[m.key].push(h));
570
+ break;
571
+ case r.FEEDBACKAPPANSWERTYPE.MULTI_QUESTION_MATRIX:
572
+ e4.checked && (m.value.push(h), i2.push(m));
573
+ case r.FEEDBACKAPPANSWERTYPE.UPLOAD_IMAGE:
574
+ case r.FEEDBACKAPPANSWERTYPE.UPLOAD_FILE:
545
575
  }
546
- })), n2) return this.feedback.answers = [], void t3.setAnswer([]);
576
+ })), n2) return [];
577
+ Object.entries(l2).forEach((([e4, t4]) => {
578
+ t4 && 0 !== t4.length && i2.push({ key: e4, value: t4 });
579
+ })), Object.entries(d2).forEach((([e4, t4]) => {
580
+ t4 && 0 !== t4.length && i2.push({ key: e4, value: t4 });
581
+ })), Object.entries(o2).forEach((([e4, t4]) => {
582
+ if (!t4 || 0 === t4.length) return;
583
+ const n3 = t4.slice().sort(((e5, t5) => Number(e5.split(".")[0]) - Number(t5.split(".")[0])));
584
+ i2.push({ key: e4, value: n3 });
585
+ }));
547
586
  try {
548
- t3.questions.filter(((e4) => e4.type === a.FEEDBACKAPPANSWERTYPE.MULTI_QUESTION_MATRIX)).forEach(((e4) => {
587
+ t3.questions.filter(((e4) => e4.type === r.FEEDBACKAPPANSWERTYPE.MULTI_QUESTION_MATRIX)).forEach(((e4) => {
549
588
  const t4 = e4.ref + "-", n3 = i2.filter(((e5) => e5.key.startsWith(t4)));
550
589
  if (0 === n3.length) return;
551
- const a2 = n3.map(((e5) => ({ key: e5.key.substring(t4.length), value: e5.value }))), s2 = { key: e4.ref, value: [JSON.stringify(a2)] };
590
+ const r2 = n3.map(((e5) => ({ key: e5.key.substring(t4.length), value: e5.value }))), s3 = { key: e4.ref, value: [JSON.stringify(r2)] };
552
591
  for (const e5 of n3) {
553
592
  const t5 = i2.findIndex(((t6) => t6.key === e5.key));
554
593
  -1 !== t5 && i2.splice(t5, 1);
555
594
  }
556
- const r2 = i2.findIndex(((t5) => t5.key === e4.ref));
557
- -1 !== r2 ? i2[r2] = s2 : i2.push(s2);
595
+ const a2 = i2.findIndex(((t5) => t5.key === e4.ref));
596
+ -1 !== a2 ? i2[a2] = s3 : i2.push(s3);
558
597
  }));
559
598
  } catch (e4) {
560
599
  this.log.err("Error agrupando MULTI_QUESTION_MATRIX", e4);
561
600
  }
562
- this.feedback.answers = i2, t3.setAnswer(i2);
601
+ return this.feedback.answers = i2, t3.setAnswer(i2), i2;
563
602
  }
564
603
  finish() {
565
604
  return n(this, void 0, void 0, (function* () {
566
- if (this.completed = true, this.timeToCompleted = (/* @__PURE__ */ new Date()).getTime() - this.timeToCompleted, this.feedback.metadata.push({ key: "time-to-complete", value: [this.timeToCompleted.toString()] }), this.formOptionsConfig.addSuccessScreen) {
605
+ if (this.completed = true, this.timeToCompleted = Date.now() - this.timeToCompleted, this.feedback.metadata.push({ key: "time-to-complete", value: [this.timeToCompleted.toString()] }), this.formOptionsConfig.addSuccessScreen) {
567
606
  const e3 = document.getElementById("magicfeedback-container-" + this.appId);
568
607
  e3.childNodes.length > 0 && e3.removeChild(e3.childNodes[0]);
569
608
  const t3 = (0, o.renderSuccess)(this.formOptionsConfig.successMessage || "Thank you for your feedback!");
@@ -582,8 +621,12 @@ var require_magicfeedback_sdk_browser = __commonJS({
582
621
  pushAnswers(e3 = false) {
583
622
  return n(this, void 0, void 0, (function* () {
584
623
  try {
624
+ if (this.config.get("dryRun")) {
625
+ const e4 = this.id || `dry-run-${this.appId}-${Date.now()}`;
626
+ return this.log.log(`Dry run enabled: skipping feedback submit for form ${this.appId}`), e4;
627
+ }
585
628
  const t3 = this.config.get("url"), i2 = { integration: this.appId, publicKey: this.publicKey, feedback: this.feedback, completed: e3 };
586
- return yield (0, r.sendFeedback)(t3, this.id ? Object.assign(Object.assign({}, i2), { sessionId: this.id }) : i2, this.log);
629
+ return yield (0, a.sendFeedback)(t3, this.id ? Object.assign(Object.assign({}, i2), { sessionId: this.id }) : i2, this.log);
587
630
  } catch (e4) {
588
631
  return this.log.err(`An error occurred while submitting the form ${this.appId}:`, e4), "";
589
632
  }
@@ -594,83 +637,82 @@ var require_magicfeedback_sdk_browser = __commonJS({
594
637
  return n(this, void 0, void 0, (function* () {
595
638
  if (!(null == e3 ? void 0 : e3.followup)) return null;
596
639
  try {
640
+ if (this.config.get("dryRun")) return this.log.log(`Dry run enabled: skipping follow up API for question ${e3.ref}`), null;
597
641
  if (0 === this.feedback.answers.length) throw new Error("No answers provided");
598
642
  const i2 = this.config.get("url"), n2 = Object.assign(Object.assign(Object.assign({ answer: null === (t3 = this.feedback.answers.find(((t4) => t4.key === e3.ref))) || void 0 === t3 ? void 0 : t3.value[0] }, "" !== this.publicKey && { publicKey: this.publicKey }), "" === this.publicKey && { campaignSessionId: this.appId }), { sessionId: this.id, question: e3 });
599
- return yield (0, r.getFollowUpQuestion)(i2, n2, this.log);
643
+ return yield (0, a.getFollowUpQuestion)(i2, n2, this.log);
600
644
  } catch (e4) {
601
645
  throw this.log.err(`An error occurred while submitting the form ${this.appId}:`, e4), e4;
602
646
  }
603
647
  }));
604
648
  }
605
649
  processNextQuestion(e3) {
606
- var t3, i2, a2;
650
+ var t3, i2, r2;
607
651
  return n(this, void 0, void 0, (function* () {
608
652
  const n2 = this.history.back();
609
653
  if (!n2) throw new Error("No page found");
610
654
  const s2 = n2.getFollowupQuestions();
611
655
  if (0 === (null == s2 ? void 0 : s2.length)) return void (yield this.renderNextQuestion(e3, n2));
612
- const r2 = [];
656
+ const a2 = [];
613
657
  for (const e4 of s2) {
614
658
  const t4 = n2.questions.find(((t5) => t5.ref === e4));
615
659
  if (t4) {
616
660
  const e5 = yield this.callFollowUpQuestion(t4);
617
- e5 && r2.push(e5);
661
+ e5 && a2.push(e5);
618
662
  }
619
663
  }
620
- if (0 === r2.length) return void (yield this.renderNextQuestion(e3, n2));
621
- const l2 = new d.Page(n2.id, n2.position, this.appId, r2, n2.edges), c2 = new p.PageNode(n2.id, n2.position, n2.edges, l2, r2, true);
622
- c2.elements = (0, o.renderQuestions)(r2, this.formOptionsConfig.questionFormat, null === (t3 = this.formData) || void 0 === t3 ? void 0 : t3.lang[0], null === (i2 = this.formData) || void 0 === i2 ? void 0 : i2.product, (() => this.send())), this.history.enqueue(c2), this.progress += 0.5, e3.innerHTML = "", null === (a2 = c2.elements) || void 0 === a2 || a2.forEach(((t4) => e3.appendChild(t4))), this.formOptionsConfig.afterSubmitEvent && (yield this.formOptionsConfig.afterSubmitEvent({ response: this.id, loading: false, progress: this.progress, total: this.total, followup: c2.isFollowup, completed: this.completed, error: null }));
664
+ if (0 === a2.length) return void (yield this.renderNextQuestion(e3, n2));
665
+ const l2 = new d.Page(n2.id, n2.position, this.appId, a2, n2.edges), c2 = new p.PageNode(n2.id, n2.position, n2.edges, l2, a2, true);
666
+ c2.elements = (0, o.renderQuestions)(a2, this.formOptionsConfig.questionFormat, null === (t3 = this.formData) || void 0 === t3 ? void 0 : t3.lang[0], null === (i2 = this.formData) || void 0 === i2 ? void 0 : i2.product, (() => this.send())), this.history.enqueue(c2), this.progress += 0.5, e3.innerHTML = "", null === (r2 = c2.elements) || void 0 === r2 || r2.forEach(((t4) => e3.appendChild(t4))), this.formOptionsConfig.afterSubmitEvent && (yield this.formOptionsConfig.afterSubmitEvent({ response: this.id, loading: false, progress: this.progress, total: this.total, followup: c2.isFollowup, completed: this.completed, error: null }));
623
667
  }));
624
668
  }
625
669
  renderNextQuestion(e3, t3) {
626
- var i2, s2, r2, l2, d2;
670
+ var i2, s2, a2, l2, d2;
627
671
  return n(this, void 0, void 0, (function* () {
628
672
  let n2 = this.graph.getNextPage(t3, this.feedback.answers);
629
673
  if (!n2) return void this.finish();
630
674
  const u2 = n2.edges.filter(((e4) => "PRECONDITIONAL" === e4.typeCondition)).sort(((e4, t4) => e4.position < t4.position ? -1 : e4.position > t4.position ? 1 : 0));
631
675
  if ((null == u2 ? void 0 : u2.length) > 0) {
632
- let t4 = null;
633
- const r3 = u2.map(((e4) => e4.questionRef));
634
- for (let e4 = this.history.size() - 1; e4 >= 0; e4--) {
635
- const n3 = this.history.get(e4);
636
- if (n3 && (t4 = null === (i2 = n3.answers) || void 0 === i2 ? void 0 : i2.find(((e5) => r3.includes(e5.key))), t4)) break;
637
- }
638
- let o2 = !u2.some(((e4) => e4.transition === c.TransitionType.ALLOW));
639
- if (t4) for (const i3 of u2) {
640
- let r4 = false;
641
- const l3 = null === (s2 = this.formData) || void 0 === s2 ? void 0 : s2.questions.find(((e4) => e4.ref === i3.questionRef)), d3 = Array.isArray(t4.value) ? t4.value : [t4.value], u3 = Array.isArray(i3.value) ? i3.value : [i3.value];
642
- if ((null == l3 ? void 0 : l3.type) === a.FEEDBACKAPPANSWERTYPE.MULTI_QUESTION_MATRIX) r4 = this.evaluateMatrixPreconditional(i3, t4);
643
- else switch (i3.typeOperator) {
644
- case "EQUAL":
645
- case "INQ":
646
- r4 = d3.some(((e4) => u3.includes(e4)));
647
- break;
648
- case "NOEQUAL":
649
- case "NINQ":
650
- r4 = d3.every(((e4) => !u3.includes(e4)));
651
- break;
652
- case "GREATER":
653
- r4 = d3.some(((e4) => Number(e4) > Number(u3[0])));
654
- break;
655
- case "LESS":
656
- r4 = d3.some(((e4) => Number(e4) < Number(u3[0])));
657
- break;
658
- case "GREATEREQUAL":
659
- r4 = d3.some(((e4) => Number(e4) >= Number(u3[0])));
660
- break;
661
- case "LESSEQUAL":
662
- r4 = d3.some(((e4) => Number(e4) <= Number(u3[0])));
676
+ const t4 = u2.some(((e4) => e4.transition === c.TransitionType.ALLOW));
677
+ let a3 = t4;
678
+ for (const t5 of u2) {
679
+ let o2;
680
+ for (let e4 = this.history.size() - 1; e4 >= 0; e4--) {
681
+ const n3 = this.history.get(e4);
682
+ if (n3 && (o2 = null === (i2 = n3.answers) || void 0 === i2 ? void 0 : i2.find(((e5) => e5.key === t5.questionRef)), o2)) break;
663
683
  }
664
- if (r4) switch (this.feedback.answers = [], i3.transition) {
665
- case c.TransitionType.NEXT:
666
- return void (n2 && (yield this.renderNextQuestion(e3, n2)));
667
- case c.TransitionType.ALLOW:
668
- o2 = true;
684
+ let l3 = false;
685
+ if (o2) {
686
+ const e4 = null === (s2 = this.formData) || void 0 === s2 ? void 0 : s2.questions.find(((e5) => e5.ref === t5.questionRef)), i3 = Array.isArray(o2.value) ? o2.value : [o2.value], n3 = Array.isArray(t5.value) ? t5.value : [t5.value];
687
+ if ((null == e4 ? void 0 : e4.type) === r.FEEDBACKAPPANSWERTYPE.MULTI_QUESTION_MATRIX) l3 = this.evaluateMatrixPreconditional(t5, o2);
688
+ else switch (t5.typeOperator) {
689
+ case "EQUAL":
690
+ case "INQ":
691
+ l3 = i3.some(((e5) => n3.includes(e5)));
692
+ break;
693
+ case "NOEQUAL":
694
+ case "NINQ":
695
+ l3 = i3.every(((e5) => !n3.includes(e5)));
696
+ break;
697
+ case "GREATER":
698
+ l3 = i3.some(((e5) => Number(e5) > Number(n3[0])));
699
+ break;
700
+ case "LESS":
701
+ l3 = i3.some(((e5) => Number(e5) < Number(n3[0])));
702
+ break;
703
+ case "GREATEREQUAL":
704
+ l3 = i3.some(((e5) => Number(e5) >= Number(n3[0])));
705
+ break;
706
+ case "LESSEQUAL":
707
+ l3 = i3.some(((e5) => Number(e5) <= Number(n3[0])));
708
+ }
669
709
  }
710
+ if (t5.transition === c.TransitionType.ALLOW) l3 || (a3 = false);
711
+ else if (t5.transition === c.TransitionType.NEXT && l3) return this.feedback.answers = [], void (n2 && (yield this.renderNextQuestion(e3, n2)));
670
712
  }
671
- if (!o2) return this.feedback.answers = [], void (n2 && (yield this.renderNextQuestion(e3, n2)));
713
+ if (t4 && !a3) return this.feedback.answers = [], void (n2 && (yield this.renderNextQuestion(e3, n2)));
672
714
  }
673
- n2.elements = (0, o.renderQuestions)(n2.questions, this.formOptionsConfig.questionFormat, null === (r2 = this.formData) || void 0 === r2 ? void 0 : r2.lang[0], null === (l2 = this.formData) || void 0 === l2 ? void 0 : l2.product, (() => this.send())), e3.innerHTML = "", null === (d2 = n2.elements) || void 0 === d2 || d2.forEach(((t4) => e3.appendChild(t4))), this.history.enqueue(n2), this.progress = this.total - this.graph.findMaxDepth(n2), this.formOptionsConfig.afterSubmitEvent && (yield this.formOptionsConfig.afterSubmitEvent({ response: this.id, loading: false, progress: this.progress, total: this.total, followup: n2.isFollowup, completed: this.completed, error: null }));
715
+ n2.elements = (0, o.renderQuestions)(n2.questions, this.formOptionsConfig.questionFormat, null === (a2 = this.formData) || void 0 === a2 ? void 0 : a2.lang[0], null === (l2 = this.formData) || void 0 === l2 ? void 0 : l2.product, (() => this.send())), e3.innerHTML = "", null === (d2 = n2.elements) || void 0 === d2 || d2.forEach(((t4) => e3.appendChild(t4))), this.history.enqueue(n2), this.progress = this.total - this.graph.findMaxDepth(n2), this.formOptionsConfig.afterSubmitEvent && (yield this.formOptionsConfig.afterSubmitEvent({ response: this.id, loading: false, progress: this.progress, total: this.total, followup: n2.isFollowup, completed: this.completed, error: null }));
674
716
  }));
675
717
  }
676
718
  back() {
@@ -684,25 +726,25 @@ var require_magicfeedback_sdk_browser = __commonJS({
684
726
  }));
685
727
  }
686
728
  previewQuestion(e3, t3, i2) {
687
- var n2, a2;
729
+ var n2, r2;
688
730
  const s2 = Array.isArray(t3) ? t3 : [t3];
689
731
  if (!s2 || 0 === s2.length) throw new Error("[MagicFeedback] No question provided for preview");
690
- const r2 = document.getElementById(e3);
691
- if (!r2) throw new Error(`[MagicFeedback] Element with ID '${e3}' not found.`);
692
- const { format: l2 = this.formOptionsConfig.questionFormat || "standard", language: d2 = (null === (n2 = this.formData) || void 0 === n2 ? void 0 : n2.lang) && this.formData.lang[0] || "en", product: c2 = (null === (a2 = this.formData) || void 0 === a2 ? void 0 : a2.product) || { customIcons: false }, clearContainer: u2 = true, wrap: p2 = true } = i2 || {};
693
- u2 && (r2.innerHTML = "");
694
- let h = [];
732
+ const a2 = document.getElementById(e3);
733
+ if (!a2) throw new Error(`[MagicFeedback] Element with ID '${e3}' not found.`);
734
+ const { format: l2 = this.formOptionsConfig.questionFormat || "standard", language: d2 = (null === (n2 = this.formData) || void 0 === n2 ? void 0 : n2.lang) && this.formData.lang[0] || "en", product: c2 = (null === (r2 = this.formData) || void 0 === r2 ? void 0 : r2.product) || { customIcons: false }, clearContainer: u2 = true, wrap: p2 = true } = i2 || {};
735
+ u2 && (a2.innerHTML = "");
736
+ let m = [];
695
737
  try {
696
- h = (0, o.renderQuestions)(s2, l2, d2, c2);
738
+ m = (0, o.renderQuestions)(s2, l2, d2, c2);
697
739
  } catch (e4) {
698
740
  throw this.log.err(e4), e4;
699
741
  }
700
- let m = r2;
742
+ let h = a2;
701
743
  if (p2) {
702
744
  const e4 = document.createElement("div");
703
- e4.classList.add("magicfeedback-preview-question"), m.appendChild(e4), m = e4;
745
+ e4.classList.add("magicfeedback-preview-question"), h.appendChild(e4), h = e4;
704
746
  }
705
- return h.forEach(((e4) => m.appendChild(e4))), r2;
747
+ return m.forEach(((e4) => h.appendChild(e4))), a2;
706
748
  }
707
749
  parseMatrixAnswerPre(e3) {
708
750
  if (!e3 || !e3.value) return [];
@@ -715,9 +757,9 @@ var require_magicfeedback_sdk_browser = __commonJS({
715
757
  return Array.isArray(e3.value) && e3.value.length > 0 && "object" == typeof e3.value[0] && null !== e3.value[0] && "key" in e3.value[0] ? e3.value : [];
716
758
  }
717
759
  evaluateMatrixPreconditional(e3, t3) {
718
- const i2 = Array.isArray(e3.value) ? e3.value : [e3.value], n2 = new Set(e3.option || []), a2 = this.parseMatrixAnswerPre(t3);
719
- if (!a2.length) return false;
720
- const s2 = n2.size > 0 ? a2.filter(((e4) => n2.has(e4.key))) : a2;
760
+ const i2 = Array.isArray(e3.value) ? e3.value : [e3.value], n2 = new Set(e3.option || []), r2 = this.parseMatrixAnswerPre(t3);
761
+ if (!r2.length) return false;
762
+ const s2 = n2.size > 0 ? r2.filter(((e4) => n2.has(e4.key))) : r2;
721
763
  if (!s2.length) return false;
722
764
  switch (e3.typeOperator) {
723
765
  case "EQUAL":
@@ -742,14 +784,14 @@ var require_magicfeedback_sdk_browser = __commonJS({
742
784
  }, 700: (e2, t2) => {
743
785
  "use strict";
744
786
  Object.defineProperty(t2, "__esModule", { value: true }), t2.Page = void 0, t2.Page = class {
745
- constructor(e3, t3, i, n, a) {
746
- this.id = e3, this.position = t3, this.generatedAt = (/* @__PURE__ */ new Date()).toISOString(), this.updatedAt = (/* @__PURE__ */ new Date()).toISOString(), this.status = "ACTIVE", this.integrationId = i, this.integrationQuestions = n, this.integrationPageRoutes = a;
787
+ constructor(e3, t3, i, n, r) {
788
+ this.id = e3, this.position = t3, this.generatedAt = (/* @__PURE__ */ new Date()).toISOString(), this.updatedAt = (/* @__PURE__ */ new Date()).toISOString(), this.status = "ACTIVE", this.integrationId = i, this.integrationQuestions = n, this.integrationPageRoutes = r;
747
789
  }
748
790
  };
749
- }, 217: (e2, t2, i) => {
791
+ }, 989: (e2, t2, i) => {
750
792
  "use strict";
751
793
  Object.defineProperty(t2, "__esModule", { value: true }), t2.PageGraph = void 0;
752
- const n = i(636), a = i(558), s = i(591);
794
+ const n = i(636), r = i(558), s = i(591);
753
795
  t2.PageGraph = class {
754
796
  constructor(e3) {
755
797
  this.nodes = /* @__PURE__ */ new Map(), this.buildGraph(e3);
@@ -757,7 +799,10 @@ var require_magicfeedback_sdk_browser = __commonJS({
757
799
  buildGraph(e3) {
758
800
  e3.forEach(((e4) => {
759
801
  var t3;
760
- e4.integrationPageRoutes && (e4.integrationPageRoutes = (null === (t3 = e4.integrationPageRoutes) || void 0 === t3 ? void 0 : t3.sort(((e5, t4) => new Date((null == e5 ? void 0 : e5.generatedAt) || "").getTime() - new Date((null == t4 ? void 0 : t4.generatedAt) || "").getTime() ? "DIRECT" === e5.typeCondition ? 1 : -1 : 0))) || []);
802
+ e4.integrationPageRoutes && (e4.integrationPageRoutes = (null === (t3 = e4.integrationPageRoutes) || void 0 === t3 ? void 0 : t3.sort(((e5, t4) => {
803
+ const i3 = new Date((null == e5 ? void 0 : e5.generatedAt) || 0).getTime(), n2 = new Date((null == t4 ? void 0 : t4.generatedAt) || 0).getTime();
804
+ return i3 !== n2 ? i3 - n2 : "DIRECT" === e5.typeCondition && "DIRECT" !== t4.typeCondition ? 1 : "DIRECT" !== e5.typeCondition && "DIRECT" === t4.typeCondition ? -1 : 0;
805
+ }))) || []);
761
806
  const i2 = new n.PageNode(e4.id, e4.position, e4.integrationPageRoutes || [], e4, e4.integrationQuestions);
762
807
  this.nodes.set(i2.id, i2);
763
808
  }));
@@ -783,28 +828,28 @@ var require_magicfeedback_sdk_browser = __commonJS({
783
828
  if (!e3) return;
784
829
  e3.edges.sort(((e4, t4) => "DIRECT" === e4.typeCondition ? 1 : "DIRECT" === t4.typeCondition ? -1 : 0));
785
830
  const n2 = e3.edges.find(((i3) => {
786
- const n3 = e3.questions.find(((e4) => e4.ref === i3.questionRef)), r = null == t3 ? void 0 : t3.filter(((e4) => e4.key === i3.questionRef));
831
+ const n3 = e3.questions.find(((e4) => e4.ref === i3.questionRef)), a = null == t3 ? void 0 : t3.filter(((e4) => e4.key === i3.questionRef));
787
832
  if ("DIRECT" === i3.typeCondition) return true;
788
- if (!r || 0 === r.length) return false;
789
- if ((null == n3 ? void 0 : n3.type) === a.FEEDBACKAPPANSWERTYPE.MULTI_QUESTION_MATRIX) return this.evaluateMatrixCondition(i3, r);
833
+ if (!a || 0 === a.length) return false;
834
+ if ((null == n3 ? void 0 : n3.type) === r.FEEDBACKAPPANSWERTYPE.MULTI_QUESTION_MATRIX) return this.evaluateMatrixCondition(i3, a);
790
835
  const o = Array.isArray(i3.value) ? i3.value : [i3.value];
791
836
  switch (i3.typeOperator) {
792
837
  case s.OperatorType.EQUAL:
793
- return r.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => o.includes(e5)))));
838
+ return a.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => o.includes(e5)))));
794
839
  case s.OperatorType.NOEQUAL:
795
- return r.every(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).every(((e5) => !o.includes(e5)))));
840
+ return a.every(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).every(((e5) => !o.includes(e5)))));
796
841
  case s.OperatorType.GREATER:
797
- return r.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => o.some(((t4) => Number(e5) > Number(t4)))))));
842
+ return a.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => o.some(((t4) => Number(e5) > Number(t4)))))));
798
843
  case s.OperatorType.LESS:
799
- return r.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => o.some(((t4) => Number(e5) < Number(t4)))))));
844
+ return a.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => o.some(((t4) => Number(e5) < Number(t4)))))));
800
845
  case s.OperatorType.GREATEREQUAL:
801
- return r.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => o.some(((t4) => Number(e5) >= Number(t4)))))));
846
+ return a.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => o.some(((t4) => Number(e5) >= Number(t4)))))));
802
847
  case s.OperatorType.LESSEQUAL:
803
- return r.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => o.some(((t4) => Number(e5) <= Number(t4)))))));
848
+ return a.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => o.some(((t4) => Number(e5) <= Number(t4)))))));
804
849
  case s.OperatorType.INQ:
805
- return r.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => o.includes(e5)))));
850
+ return a.some(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).some(((e5) => o.includes(e5)))));
806
851
  case s.OperatorType.NINQ:
807
- return r.every(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).every(((e5) => !o.includes(e5)))));
852
+ return a.every(((e4) => (Array.isArray(e4.value) ? e4.value : [e4.value]).every(((e5) => !o.includes(e5)))));
808
853
  default:
809
854
  return false;
810
855
  }
@@ -841,17 +886,17 @@ var require_magicfeedback_sdk_browser = __commonJS({
841
886
  DFSUtil(e3, t3, i2) {
842
887
  t3.add(e3);
843
888
  let n2 = i2;
844
- const a2 = [...e3.edges.filter(((e4) => e4.typeCondition !== s.ConditionType.PRECONDITIONAL)) || []], r = this.getNextEdgeByDefault(e3);
845
- if (r) {
846
- const i3 = this.getNodeById(r);
847
- i3 && !t3.has(i3) && a2.push(new s.PageRoute(i3.id, "", s.OperatorType.DEFAULT, [""], s.TransitionType.PAGE, i3.id, e3.id));
889
+ const r2 = [...e3.edges.filter(((e4) => e4.typeCondition !== s.ConditionType.PRECONDITIONAL)) || []], a = this.getNextEdgeByDefault(e3);
890
+ if (a) {
891
+ const i3 = this.getNodeById(a);
892
+ i3 && !t3.has(i3) && r2.push(new s.PageRoute(i3.id, "", s.OperatorType.DEFAULT, [""], s.TransitionType.PAGE, i3.id, e3.id));
848
893
  }
849
- for (const e4 of a2) {
894
+ for (const e4 of r2) {
850
895
  if (!e4.transitionDestiny) continue;
851
- const a3 = this.getNodeById(e4.transitionDestiny);
852
- if (a3 && !t3.has(a3)) {
853
- const e5 = i2 + 1, s2 = new Set(t3), r2 = this.DFSUtil(a3, s2, e5);
854
- n2 = Math.max(n2, r2);
896
+ const r3 = this.getNodeById(e4.transitionDestiny);
897
+ if (r3 && !t3.has(r3)) {
898
+ const e5 = i2 + 1, s2 = new Set(t3), a2 = this.DFSUtil(r3, s2, e5);
899
+ n2 = Math.max(n2, a2);
855
900
  }
856
901
  }
857
902
  return n2;
@@ -867,9 +912,9 @@ var require_magicfeedback_sdk_browser = __commonJS({
867
912
  return Array.isArray(e3.value) && e3.value.length > 0 && "object" == typeof e3.value[0] && null !== e3.value[0] && "key" in e3.value[0] ? e3.value : [];
868
913
  }
869
914
  evaluateMatrixCondition(e3, t3) {
870
- const i2 = Array.isArray(e3.value) ? e3.value : [e3.value], n2 = new Set(e3.option || []), a2 = t3[0], r = this.parseMatrixAnswer(a2);
871
- if (!r.length) return false;
872
- const o = n2.size > 0 ? r.filter(((e4) => n2.has(e4.key))) : r;
915
+ const i2 = Array.isArray(e3.value) ? e3.value : [e3.value], n2 = new Set(e3.option || []), r2 = t3[0], a = this.parseMatrixAnswer(r2);
916
+ if (!a.length) return false;
917
+ const o = n2.size > 0 ? a.filter(((e4) => n2.has(e4.key))) : a;
873
918
  if (!o.length) return false;
874
919
  switch (e3.typeOperator) {
875
920
  case s.OperatorType.EQUAL:
@@ -894,8 +939,8 @@ var require_magicfeedback_sdk_browser = __commonJS({
894
939
  }, 636: (e2, t2) => {
895
940
  "use strict";
896
941
  Object.defineProperty(t2, "__esModule", { value: true }), t2.PageNode = void 0, t2.PageNode = class {
897
- constructor(e3, t3, i, n, a, s = false) {
898
- this.answers = [], this.id = e3, this.position = t3, this.edges = i, this.data = n, this.questions = a.sort(((e4, t4) => e4.position - t4.position)), this.elements = [], this.isFollowup = s;
942
+ constructor(e3, t3, i, n, r, s = false) {
943
+ this.answers = [], this.id = e3, this.position = t3, this.edges = i, this.data = n, this.questions = r.sort(((e4, t4) => e4.position - t4.position)), this.elements = [], this.isFollowup = s;
899
944
  }
900
945
  getFollowupQuestions() {
901
946
  return this.questions.filter(((e3) => e3.followup)).map(((e3) => e3.ref));
@@ -909,14 +954,14 @@ var require_magicfeedback_sdk_browser = __commonJS({
909
954
  };
910
955
  }, 591: (e2, t2) => {
911
956
  "use strict";
912
- var i, n, a, s;
957
+ var i, n, r, s;
913
958
  Object.defineProperty(t2, "__esModule", { value: true }), t2.PageRoute = t2.StatusType = t2.OperatorType = t2.ConditionType = t2.TransitionType = void 0, (s = t2.TransitionType || (t2.TransitionType = {})).PAGE = "PAGE", s.FINISH = "FINISH", s.REDIRECT = "REDIRECT", s.NEXT = "NEXT", s.ALLOW = "ALLOW", (function(e3) {
914
959
  e3.LOGICAL = "LOGICAL", e3.DIRECT = "DIRECT", e3.PRECONDITIONAL = "PRECONDITIONAL";
915
- })(i = t2.ConditionType || (t2.ConditionType = {})), (a = t2.OperatorType || (t2.OperatorType = {})).EQUAL = "EQUAL", a.NOEQUAL = "NOEQUAL", a.GREATER = "GREATER", a.LESS = "LESS", a.GREATEREQUAL = "GREATEREQUAL", a.LESSEQUAL = "LESSEQUAL", a.INQ = "INQ", a.NINQ = "NINQ", a.DEFAULT = "DEFAULT", (function(e3) {
960
+ })(i = t2.ConditionType || (t2.ConditionType = {})), (r = t2.OperatorType || (t2.OperatorType = {})).EQUAL = "EQUAL", r.NOEQUAL = "NOEQUAL", r.GREATER = "GREATER", r.LESS = "LESS", r.GREATEREQUAL = "GREATEREQUAL", r.LESSEQUAL = "LESSEQUAL", r.INQ = "INQ", r.NINQ = "NINQ", r.DEFAULT = "DEFAULT", (function(e3) {
916
961
  e3.ACTIVE = "ACTIVE", e3.DEPRECATED = "DEPRECATED", e3.DELETE = "DELETE";
917
962
  })(n = t2.StatusType || (t2.StatusType = {})), t2.PageRoute = class {
918
- constructor(e3, t3, a2, s2, r, o, l, d, c, u) {
919
- this.id = e3, this.questionRef = t3, this.typeCondition = d || i.LOGICAL, this.typeOperator = a2, this.value = s2 || [], this.transition = r, this.transitionDestiny = o, this.status = n.ACTIVE, this.generatedAt = /* @__PURE__ */ new Date(), this.updatedAt = /* @__PURE__ */ new Date(), this.integrationPageId = l, this.position = c || 0, this.option = u || [];
963
+ constructor(e3, t3, r2, s2, a, o, l, d, c, u) {
964
+ this.id = e3, this.questionRef = t3, this.typeCondition = d || i.LOGICAL, this.typeOperator = r2, this.value = s2 || [], this.transition = a, this.transitionDestiny = o, this.status = n.ACTIVE, this.generatedAt = /* @__PURE__ */ new Date(), this.updatedAt = /* @__PURE__ */ new Date(), this.integrationPageId = l, this.position = c || 0, this.option = u || [];
920
965
  }
921
966
  };
922
967
  }, 558: (e2, t2) => {
@@ -926,6 +971,653 @@ var require_magicfeedback_sdk_browser = __commonJS({
926
971
  }, (function(e3) {
927
972
  e3.FORM = "form", e3.DIV = "div";
928
973
  })(i || (i = {}));
974
+ }, 516: (e2, t2) => {
975
+ "use strict";
976
+ Object.defineProperty(t2, "__esModule", { value: true }), t2.getUrlParam = t2.getBooleanOptions = t2.parseTitle = void 0, t2.parseTitle = function(e3, t3) {
977
+ return e3 ? "object" == typeof e3 ? e3[t3] || e3.en : e3 : "";
978
+ }, t2.getBooleanOptions = function(e3) {
979
+ switch (e3) {
980
+ case "es":
981
+ return ["S\xED", "No"];
982
+ case "fr":
983
+ return ["Oui", "Non"];
984
+ case "de":
985
+ return ["Ja", "Nein"];
986
+ case "it":
987
+ return ["S\xEC", "No"];
988
+ case "pt":
989
+ return ["Sim", "N\xE3o"];
990
+ case "nl":
991
+ return ["Ja", "Nee"];
992
+ case "pl":
993
+ return ["Tak", "Nie"];
994
+ case "ru":
995
+ return ["\u0414\u0430", "\u041D\u0435\u0442"];
996
+ case "ja":
997
+ return ["\u306F\u3044", "\u3044\u3044\u3048"];
998
+ case "zh":
999
+ return ["\u662F", "\u4E0D"];
1000
+ case "ko":
1001
+ return ["\uC608", "\uC544\uB2C8"];
1002
+ case "da":
1003
+ case "sv":
1004
+ return ["Ja", "Nej"];
1005
+ case "fi":
1006
+ return ["Kyll\xE4", "Ei"];
1007
+ case "no":
1008
+ return ["Ja", "Nei"];
1009
+ case "ar":
1010
+ return ["\u0646\u0639\u0645", "\u0644\u0627"];
1011
+ case "bn":
1012
+ return ["\u09B9\u09CD\u09AF\u09BE\u0981", "\u09A8\u09BE"];
1013
+ default:
1014
+ return ["Yes", "No"];
1015
+ }
1016
+ }, t2.getUrlParam = function(e3) {
1017
+ return new URLSearchParams(window.location.search).get(e3);
1018
+ };
1019
+ }, 559: (e2, t2) => {
1020
+ "use strict";
1021
+ function i(e3, t3, i2, n, r = false, s = true, a = "ltr", o = "row") {
1022
+ const l = document.createElement("div");
1023
+ l.classList.add("magicfeedback-rating-placeholder"), l.style.display = "flex", l.style.flexDirection = o, l.style.alignItems = "center", l.style.justifyContent = "space-between", l.style.width = r ? `calc(100% - (100% / ${t3 + 1}))` : "100%", l.style.marginRight = "auto", s && window.innerWidth < 600 && (l.style.flexDirection = "column");
1024
+ const d = document.createElement("span");
1025
+ d.textContent = null != i2 ? i2 : null, d.classList.add("magicfeedback-rating-placeholder-value"), d.style.fontSize = "15px", d.style.display = "block", d.style.minWidth = "0", d.style.overflowWrap = "anywhere", d.style.wordBreak = "break-word", d.style.textAlign = "ltr" === a ? "left" : "right", d.style.width = "50%", (s && window.innerWidth < 600 || "column" === o) && (d.textContent = `${e3} = ${i2}`, d.style.width = "100%", d.style.textAlign = "left", d.style.marginBottom = "5px");
1026
+ const c = document.createElement("span");
1027
+ return c.textContent = null != n ? n : null, c.classList.add("magicfeedback-rating-placeholder-value"), c.style.fontSize = "15px", c.style.display = "block", c.style.minWidth = "0", c.style.overflowWrap = "anywhere", c.style.wordBreak = "break-word", c.style.textAlign = "ltr" === a ? "right" : "left", c.style.width = "50%", (s && window.innerWidth < 600 || "column" === o) && (c.textContent = `${t3} = ${n}`, c.style.width = "100%", c.style.textAlign = "left", c.style.marginBottom = "5px"), "ltr" === a ? (i2 && l.appendChild(d), n && l.appendChild(c)) : (n && l.appendChild(c), i2 && l.appendChild(d)), l;
1028
+ }
1029
+ Object.defineProperty(t2, "__esModule", { value: true }), t2.createRatingNumberElement = t2.createStarRating = t2.createRatingPlaceholder = void 0, t2.createRatingPlaceholder = i, t2.createStarRating = function(e3, t3, n, r = () => {
1030
+ }, s) {
1031
+ const a = "magicfeedback-rating-star-selected", o = document.createElement("div");
1032
+ o.classList.add("magicfeedback-rating-star-container"), o.style.maxWidth = "300px", o.style.margin = "auto", o.dataset.originalSelection = "0";
1033
+ for (let t4 = 1; t4 <= 5; t4++) {
1034
+ const i2 = document.createElement("label");
1035
+ i2.classList.add("magicfeedback-rating-star-option");
1036
+ const n2 = document.createElement("input");
1037
+ n2.id = `rating-${e3}-${t4}`, n2.type = "radio", n2.name = e3, n2.value = t4.toString(), n2.style.position = "absolute", n2.style.opacity = "0", n2.style.width = "0", n2.style.height = "0", n2.classList.add("magicfeedback-input"), s && s === n2.value && (n2.checked = true), n2.addEventListener("change", (() => {
1038
+ const e4 = o.querySelectorAll(".rating__star");
1039
+ for (let t5 = 0; t5 < e4.length; t5++) t5 + 1 <= Number(n2.value) ? e4[t5].classList.contains(a) || e4[t5].classList.add(a) : e4[t5].classList.contains(a) && e4[t5].classList.remove(a);
1040
+ o.dataset.originalSelection = n2.value, r && r();
1041
+ })), i2.appendChild(n2);
1042
+ const l2 = document.createElement("label");
1043
+ l2.htmlFor = `rating-${e3}-${t4}`, l2.classList.add("rating__star"), l2.textContent = "\u2605", l2.style.fontSize = "40px", l2.style.color = "#CCCCCC", l2.style.cursor = "pointer", l2.addEventListener("mouseenter", (() => {
1044
+ const e4 = o.querySelectorAll(".rating__star"), i3 = t4 - 1;
1045
+ e4.forEach(((e5, t5) => {
1046
+ t5 <= i3 ? e5.classList.contains(a) || e5.classList.add(a) : e5.classList.contains(a) && e5.classList.remove(a);
1047
+ }));
1048
+ })), l2.addEventListener("mouseleave", (() => {
1049
+ const e4 = Number(o.dataset.originalSelection || "0");
1050
+ o.querySelectorAll(".rating__star").forEach(((t5, i3) => {
1051
+ i3 < e4 ? t5.classList.contains(a) || t5.classList.add(a) : t5.classList.contains(a) && t5.classList.remove(a);
1052
+ }));
1053
+ })), i2.appendChild(l2), o.appendChild(i2);
1054
+ }
1055
+ const l = i(1, 5, t3, n, false, false);
1056
+ return l.childElementCount > 0 && (o.classList.add("magicfeedback-rating-container--with-placeholder"), o.insertBefore(l, o.firstChild)), o;
1057
+ }, t2.createRatingNumberElement = function(e3, t3, n, r, s, a, o, l) {
1058
+ var d;
1059
+ const c = document.createElement("div");
1060
+ c.classList.add("magicfeedback-rating-number");
1061
+ const u = "ltr" === n ? r : `${r}-reverse`, p = document.createElement("div");
1062
+ p.classList.add("magicfeedback-rating-number-container"), p.classList.add(`magicfeedback-rating-number-container-${n}`), p.classList.add(`magicfeedback-rating-number-container-${r}`), p.style.display = "flex", p.style.flexDirection = u, p.setAttribute("role", "radiogroup"), p.setAttribute("aria-label", (null == t3 ? void 0 : t3.ariaLabel) || "Rating");
1063
+ const m = (null == t3 ? void 0 : t3.max) ? Number(null == t3 ? void 0 : t3.max) : 10, h = (null == t3 ? void 0 : t3.min) ? Number(null == t3 ? void 0 : t3.min) : 0, f = (null == t3 ? void 0 : t3.numberPlaceholders) || null, v = !(s || "column" === r) && ((null == t3 ? void 0 : t3.minPlaceholder) || (null == t3 ? void 0 : t3.maxPlaceholder));
1064
+ if (v) {
1065
+ const e4 = i(h, m, null == t3 ? void 0 : t3.minPlaceholder, null == t3 ? void 0 : t3.maxPlaceholder, null !== (d = null == t3 ? void 0 : t3.extraOption) && void 0 !== d && d, false, n, "row");
1066
+ e4.childElementCount > 0 && (p.classList.add("magicfeedback-rating-number-container--with-placeholder"), p.insertBefore(e4, p.firstChild));
1067
+ }
1068
+ for (let i2 = h; i2 <= m; i2++) {
1069
+ const n2 = document.createElement("div");
1070
+ n2.classList.add("magicfeedback-rating-number-option"), n2.classList.add(`magicfeedback-rating-number-option-${r}`);
1071
+ const d2 = document.createElement("label");
1072
+ d2.htmlFor = `rating-${e3}-${i2}`, d2.classList.add("magicfeedback-rating-number-option-label-container");
1073
+ let c2 = i2.toString();
1074
+ v ? f && f[i2] && !s && (d2.title = f[i2]) : f && f[i2] ? c2 += ` = ${f[i2]}` : i2 === h && (null == t3 ? void 0 : t3.minPlaceholder) ? c2 += ` = ${null == t3 ? void 0 : t3.minPlaceholder}` : i2 === m && (null == t3 ? void 0 : t3.maxPlaceholder) && (c2 += ` = ${null == t3 ? void 0 : t3.maxPlaceholder}`);
1075
+ const u2 = document.createElement("input");
1076
+ u2.id = `rating-${e3}-${i2}`, u2.type = "radio", u2.name = e3, u2.value = i2.toString(), u2.classList.add(a), u2.classList.add("magicfeedback-input"), u2.setAttribute("aria-label", `${i2}`), o && u2.addEventListener("change", (() => o())), l && l === u2.value && (u2.checked = true);
1077
+ const g = document.createElement("label");
1078
+ g.htmlFor = `rating-${e3}-${i2}`, g.textContent = c2, g.classList.add("magicfeedback-rating-number-value"), d2.appendChild(u2), d2.appendChild(g), n2.appendChild(d2), p.appendChild(n2);
1079
+ }
1080
+ if ((null == t3 ? void 0 : t3.extraOption) && (null == t3 ? void 0 : t3.extraOptionText)) {
1081
+ const i2 = document.createElement("div");
1082
+ i2.classList.add("magicfeedback-rating-number-option");
1083
+ const r2 = document.createElement("label");
1084
+ r2.htmlFor = `rating-${e3}-extra`, r2.classList.add("magicfeedback-rating-number-option-label-container");
1085
+ const s2 = document.createElement("input");
1086
+ s2.id = `rating-${e3}-extra`, s2.type = "radio", s2.name = e3, s2.value = "-", s2.classList.add(a), s2.classList.add("magicfeedback-input"), s2.setAttribute("aria-label", null == t3 ? void 0 : t3.extraOptionText), o && s2.addEventListener("change", (() => o()));
1087
+ const l2 = document.createElement("label");
1088
+ l2.htmlFor = `rating-${e3}-extra`, l2.textContent = null == t3 ? void 0 : t3.extraOptionText, l2.classList.add("magicfeedback-rating-number-value"), r2.appendChild(s2), r2.appendChild(l2), i2.appendChild(r2), "ltr" === n ? p.appendChild(i2) : p.insertBefore(i2, p.firstChild);
1089
+ }
1090
+ return c.appendChild(p), c;
1091
+ };
1092
+ }, 42: (e2, t2, i) => {
1093
+ "use strict";
1094
+ Object.defineProperty(t2, "__esModule", { value: true }), t2.getQuestionRenderer = void 0;
1095
+ const n = i(558), r = i(998), s = i(72), a = i(732), o = i(90), l = i(65), d = i(85), c = i(817), u = i(965), p = i(180), m = i(991), h = i(152), f = i(917), v = i(452), g = i(644), y = i(773), b = i(66), E = i(843), k = i(250), A = i(409), C = i(282), T = /* @__PURE__ */ new Map([[n.FEEDBACKAPPANSWERTYPE.TEXT, o.renderText], [n.FEEDBACKAPPANSWERTYPE.LONGTEXT, s.renderLongText], [n.FEEDBACKAPPANSWERTYPE.NUMBER, a.renderNumber], [n.FEEDBACKAPPANSWERTYPE.RADIO, r.renderChoice], [n.FEEDBACKAPPANSWERTYPE.MULTIPLECHOICE, r.renderChoice], [n.FEEDBACKAPPANSWERTYPE.BOOLEAN, l.renderBoolean], [n.FEEDBACKAPPANSWERTYPE.SELECT, d.renderSelect], [n.FEEDBACKAPPANSWERTYPE.DATE, c.renderDate], [n.FEEDBACKAPPANSWERTYPE.EMAIL, u.renderEmail], [n.FEEDBACKAPPANSWERTYPE.PASSWORD, p.renderPassword], [n.FEEDBACKAPPANSWERTYPE.CONSENT, m.renderConsent], [n.FEEDBACKAPPANSWERTYPE.RATING_EMOJI, h.renderRatingEmoji], [n.FEEDBACKAPPANSWERTYPE.RATING_NUMBER, f.renderRatingNumber], [n.FEEDBACKAPPANSWERTYPE.RATING_STAR, v.renderRatingStar], [n.FEEDBACKAPPANSWERTYPE.MULTI_QUESTION_MATRIX, g.renderMatrix], [n.FEEDBACKAPPANSWERTYPE.PRIORITY_LIST, y.renderPriorityList], [n.FEEDBACKAPPANSWERTYPE.POINT_SYSTEM, b.renderPointSystem], [n.FEEDBACKAPPANSWERTYPE.UPLOAD_IMAGE, E.renderUploadImage], [n.FEEDBACKAPPANSWERTYPE.UPLOAD_FILE, k.renderUploadFile], [n.FEEDBACKAPPANSWERTYPE.MULTIPLECHOISE_IMAGE, A.renderMultipleChoiceImage], [n.FEEDBACKAPPANSWERTYPE.INFO_PAGE, C.renderInfoPage]]);
1096
+ t2.getQuestionRenderer = function(e3) {
1097
+ return T.get(e3);
1098
+ };
1099
+ }, 65: (e2, t2, i) => {
1100
+ "use strict";
1101
+ Object.defineProperty(t2, "__esModule", { value: true }), t2.renderBoolean = void 0;
1102
+ const n = i(516);
1103
+ t2.renderBoolean = ({ question: e3, language: t3, urlParamValue: i2, send: r }) => {
1104
+ const { ref: s, assets: a } = e3, o = document.createElement("div"), l = "magicfeedback-radio", d = document.createElement("div");
1105
+ return d.classList.add("magicfeedback-boolean-container"), d.style.display = "flex", d.style.flexDirection = "row", d.style.justifyContent = "space-between", d.style.width = "70%", d.style.margin = "auto", ((null == a ? void 0 : a.addIcon) ? ["\u{1F44D}", "\u{1F44E}"] : (0, n.getBooleanOptions)(t3)).forEach(((e4, t4) => {
1106
+ const n2 = document.createElement("label");
1107
+ n2.classList.add("magicfeedback-boolean-option"), n2.htmlFor = `rating-${s}-${t4}`, n2.style.cursor = "pointer", n2.style.display = "flex", n2.style.justifyContent = "center", n2.style.alignItems = "center", n2.style.margin = "auto", n2.style.padding = "0", n2.style.width = "45%", n2.style.height = "38px";
1108
+ const a2 = document.createElement("label");
1109
+ a2.htmlFor = `rating-${s}-${t4}`, a2.textContent = e4, a2.style.margin = "0", a2.style.padding = "0";
1110
+ const o2 = document.createElement("input");
1111
+ o2.id = `rating-${s}-${t4}`, o2.type = "radio", o2.name = s, o2.value = ["Yes", "No"][t4], o2.classList.add(l), o2.classList.add("magicfeedback-input"), o2.style.position = "absolute", o2.style.opacity = "0", o2.style.width = "0", o2.style.height = "0", o2.style.margin = "0", o2.addEventListener("change", (() => {
1112
+ r && r();
1113
+ })), i2 && i2.toLowerCase() === o2.value.toLowerCase() && (o2.checked = true), n2.appendChild(o2), n2.appendChild(a2), d.appendChild(n2);
1114
+ })), o.appendChild(d), { element: o, elementTypeClass: l };
1115
+ };
1116
+ }, 998: (e2, t2, i) => {
1117
+ "use strict";
1118
+ Object.defineProperty(t2, "__esModule", { value: true }), t2.renderChoice = void 0;
1119
+ const n = i(558), r = i(784);
1120
+ t2.renderChoice = ({ question: e3, language: t3, urlParamValue: i2, randomPosition: s, send: a }) => {
1121
+ const { type: o, ref: l, value: d, defaultValue: c, assets: u } = e3, p = document.createElement("div"), m = "magicfeedback-" + ("MULTIPLECHOICE" === o ? "checkbox" : "radio");
1122
+ let h = d || [];
1123
+ s && (h = h.sort((() => Math.random() - 0.5)));
1124
+ let f = (null == u ? void 0 : u.exclusiveAnswers) || [];
1125
+ (null == u ? void 0 : u.extraOption) && (f = f.filter(((e4) => e4 !== u.extraOptionText))), f.length > 0 && (null == f || f.forEach(((e4) => {
1126
+ h.includes(e4) || h.push(e4);
1127
+ })));
1128
+ const v = null == u ? void 0 : u.extraOptionText;
1129
+ return (null == u ? void 0 : u.extraOption) && v && !h.includes(v) && h.push(v), h.forEach(((e4, s2) => {
1130
+ const d2 = document.createElement("div");
1131
+ d2.classList.add(`magicfeedback-${"MULTIPLECHOICE" === o ? "checkbox" : "radio"}-container`);
1132
+ const v2 = document.createElement("label"), g = document.createElement("input");
1133
+ if (g.id = `rating-${l}-${s2}`, g.type = "MULTIPLECHOICE" === o ? "checkbox" : "radio", g.name = l, g.value = e4, g.classList.add(m), g.classList.add("magicfeedback-input"), o === n.FEEDBACKAPPANSWERTYPE.MULTIPLECHOICE && (null == u ? void 0 : u.maxOptions) && (null == u ? void 0 : u.maxOptions) > 0 && g.addEventListener("change", (() => {
1134
+ document.querySelectorAll(`input[name="${l}"]:checked`).length > (null == u ? void 0 : u.maxOptions) && (g.checked = false);
1135
+ })), o === n.FEEDBACKAPPANSWERTYPE.RADIO && a && (!(null == u ? void 0 : u.extraOptionText) || (null == u ? void 0 : u.extraOptionText) && e4 !== (null == u ? void 0 : u.extraOptionText)) && g.addEventListener("change", (() => {
1136
+ a();
1137
+ })), e4 !== c && e4 !== i2 || (g.checked = true), v2.textContent = e4, v2.htmlFor = `rating-${l}-${s2}`, g.addEventListener("change", ((t4) => {
1138
+ const i3 = document.getElementById(`extra-option-${l}`);
1139
+ t4.target.checked && f.includes(e4) ? (h.forEach(((t5) => {
1140
+ t5 !== e4 && (document.querySelector(`input[value="${t5}"]`).checked = false);
1141
+ })), i3 && (i3.style.display = "none")) : f.forEach(((t5) => {
1142
+ t5 !== e4 && (document.querySelector(`input[value="${t5}"]`).checked = false);
1143
+ })), (null == u ? void 0 : u.extraOption) && e4 === (null == u ? void 0 : u.extraOptionText) && i3 && (i3.style.display = t4.target.checked ? "block" : "none");
1144
+ })), d2.appendChild(g), d2.appendChild(v2), p.appendChild(d2), (null == u ? void 0 : u.extraOption) && e4 === (null == u ? void 0 : u.extraOptionText)) {
1145
+ const e5 = document.createElement("input");
1146
+ e5.type = "text", e5.placeholder = (null == u ? void 0 : u.extraOptionPlaceholder) || r.placeholder.answer(t3 || "en"), e5.classList.add("magicfeedback-extra-option"), e5.classList.add("magicfeedback-input"), e5.id = `extra-option-${l}`, e5.name = `extra-option-${l}`, e5.style.display = "none", p.appendChild(e5);
1147
+ }
1148
+ })), { element: p, elementTypeClass: m };
1149
+ };
1150
+ }, 991: (e2, t2) => {
1151
+ "use strict";
1152
+ Object.defineProperty(t2, "__esModule", { value: true }), t2.renderConsent = void 0, t2.renderConsent = ({ question: e3, urlParamValue: t3, send: i }) => {
1153
+ const { id: n, ref: r, value: s, require: a } = e3, o = document.createElement("input");
1154
+ return o.type = "checkbox", o.id = `magicfeedback-${n}`, o.name = r, o.value = "true", o.required = a, o.classList.add("magicfeedback-consent"), o.classList.add("magicfeedback-input"), t3 && s.includes(t3) && (o.checked = true), i && o.addEventListener("change", (() => {
1155
+ i();
1156
+ })), { element: o, elementTypeClass: "magicfeedback-consent" };
1157
+ };
1158
+ }, 817: (e2, t2, i) => {
1159
+ "use strict";
1160
+ Object.defineProperty(t2, "__esModule", { value: true }), t2.renderDate = void 0;
1161
+ const n = i(784);
1162
+ t2.renderDate = ({ language: e3, placeholderText: t3, urlParamValue: i2 }) => {
1163
+ const r = document.createElement("input");
1164
+ return r.type = "date", r.placeholder = t3 || n.placeholder.date(e3 || "en"), i2 && (r.value = i2), { element: r, elementTypeClass: "magicfeedback-date" };
1165
+ };
1166
+ }, 965: (e2, t2) => {
1167
+ "use strict";
1168
+ Object.defineProperty(t2, "__esModule", { value: true }), t2.renderEmail = void 0, t2.renderEmail = ({ placeholderText: e3, urlParamValue: t3 }) => {
1169
+ const i = document.createElement("input");
1170
+ return i.type = "email", i.placeholder = e3 || "you@example.com", t3 && (i.value = t3), { element: i, elementTypeClass: "magicfeedback-email" };
1171
+ };
1172
+ }, 282: (e2, t2) => {
1173
+ "use strict";
1174
+ Object.defineProperty(t2, "__esModule", { value: true }), t2.renderInfoPage = void 0, t2.renderInfoPage = ({ question: e3, placeholderText: t3 }) => {
1175
+ var i, n;
1176
+ const r = document.createElement("div");
1177
+ if ("string" == typeof (null === (i = e3.assets) || void 0 === i ? void 0 : i.placeholder) ? "" !== e3.assets.placeholder.trim() : Boolean(null === (n = e3.assets) || void 0 === n ? void 0 : n.placeholder)) {
1178
+ const e4 = document.createElement("div");
1179
+ e4.classList.add("magicfeedback-info-message"), e4.innerHTML = t3 || "", r.appendChild(e4);
1180
+ }
1181
+ return { element: r, elementTypeClass: "magicfeedback-info-page" };
1182
+ };
1183
+ }, 72: (e2, t2, i) => {
1184
+ "use strict";
1185
+ Object.defineProperty(t2, "__esModule", { value: true }), t2.renderLongText = void 0;
1186
+ const n = i(784);
1187
+ t2.renderLongText = ({ language: e3, placeholderText: t3, urlParamValue: i2, maxCharacters: r }) => {
1188
+ const s = document.createElement("textarea");
1189
+ return s.rows = 3, r > 0 && (s.maxLength = r), s.placeholder = t3 || n.placeholder.answer(e3 || "en"), i2 && (s.value = i2), { element: s, elementTypeClass: "magicfeedback-longtext" };
1190
+ };
1191
+ }, 644: (e2, t2) => {
1192
+ "use strict";
1193
+ Object.defineProperty(t2, "__esModule", { value: true }), t2.renderMatrix = void 0, t2.renderMatrix = ({ question: e3, isPhone: t3, randomPosition: i }) => {
1194
+ const { ref: n, value: r, assets: s } = e3, a = document.createElement("div"), o = document.createElement("div");
1195
+ o.classList.add("magicfeedback-multi-question-matrix-container");
1196
+ let l = (null == s ? void 0 : s.options) || [], d = [...r], c = [];
1197
+ if (i && (l = null == l ? void 0 : l.sort((() => Math.random() - 0.5)), d = [...d].sort((() => Math.random() - 0.5))), (null == s ? void 0 : s.exclusiveAnswers) && (c = null == s ? void 0 : s.exclusiveAnswers, null == c || c.forEach(((e4) => {
1198
+ d.includes(e4) || d.push(e4);
1199
+ }))), t3) {
1200
+ const e4 = document.createElement("div");
1201
+ e4.classList.add("magicfeedback-multi-question-matrix-list"), null == l || l.forEach(((t4) => {
1202
+ const i2 = document.createElement("div");
1203
+ i2.classList.add("magicfeedback-multi-question-matrix-list-item"), i2.style.display = "flex", i2.style.flexDirection = "column", i2.style.alignItems = "flex-start", i2.style.marginBottom = "10px";
1204
+ const r2 = document.createElement("label");
1205
+ r2.classList.add("magicfeedback-multi-question-matrix-label"), r2.style.paddingBottom = "10px", r2.textContent = t4, i2.appendChild(r2), d.forEach(((e5) => {
1206
+ const r3 = document.createElement("div");
1207
+ r3.classList.add("magicfeedback-radio-container"), r3.style.display = "flex", r3.style.alignItems = "center", r3.style.justifyContent = "flex-start", r3.style.width = "99%", r3.style.margin = "5px auto";
1208
+ const s2 = document.createElement("label"), a2 = document.createElement("input");
1209
+ a2.id = `${n}-${t4}-${e5}`, a2.type = "radio", a2.name = `${n}-${t4}`, a2.value = e5, a2.classList.add("magicfeedback-input"), s2.textContent = e5, s2.htmlFor = `${n}-${t4}-${e5}`, r3.appendChild(a2), r3.appendChild(s2), i2.appendChild(r3);
1210
+ })), e4.appendChild(i2);
1211
+ })), o.appendChild(e4);
1212
+ } else {
1213
+ const e4 = document.createElement("table");
1214
+ e4.classList.add("magicfeedback-multi-question-matrix-table");
1215
+ const t4 = document.createElement("thead");
1216
+ t4.classList.add("magicfeedback-multi-question-matrix-header"), t4.style.paddingBottom = "15px";
1217
+ const i2 = document.createElement("tr"), r2 = document.createElement("th");
1218
+ i2.appendChild(r2), d.forEach(((e5) => {
1219
+ const t5 = document.createElement("th");
1220
+ t5.textContent = e5, i2.appendChild(t5);
1221
+ })), t4.appendChild(i2), e4.appendChild(t4);
1222
+ const s2 = document.createElement("tbody");
1223
+ null == l || l.forEach(((e5) => {
1224
+ const t5 = document.createElement("tr");
1225
+ t5.classList.add("magicfeedback-multi-question-matrix-row-tr");
1226
+ const i3 = document.createElement("td");
1227
+ i3.style.minWidth = "200px", i3.style.padding = "10px";
1228
+ const r3 = document.createElement("label");
1229
+ r3.classList.add("magicfeedback-multi-question-matrix-label"), r3.textContent = e5, i3.appendChild(r3), t5.appendChild(i3), d.forEach(((i4) => {
1230
+ const r4 = document.createElement("td"), s3 = document.createElement("input");
1231
+ s3.type = "radio", s3.name = `${n}-${e5}`, s3.value = i4, s3.id = `${n}-${e5}-${i4}`, s3.classList.add("magicfeedback-input"), r4.appendChild(s3), t5.appendChild(r4);
1232
+ })), s2.appendChild(t5);
1233
+ })), e4.appendChild(s2), o.appendChild(e4);
1234
+ }
1235
+ return a.appendChild(o), { element: a, elementTypeClass: "magicfeedback-multi-question-matrix" };
1236
+ };
1237
+ }, 409: (e2, t2) => {
1238
+ "use strict";
1239
+ Object.defineProperty(t2, "__esModule", { value: true }), t2.renderMultipleChoiceImage = void 0, t2.renderMultipleChoiceImage = ({ question: e3, randomPosition: t3, urlParamValue: i, send: n }) => {
1240
+ const r = document.createElement("div"), { ref: s, assets: a } = e3;
1241
+ let o = [...e3.value];
1242
+ const l = document.createElement("div");
1243
+ l.classList.add("magicfeedback-multiple-choice-image-container"), l.style.display = "flex", l.style.flexDirection = "row", l.style.flexWrap = "wrap", l.style.justifyContent = "center";
1244
+ const d = o.length;
1245
+ let c = 1, u = 1;
1246
+ if (window.innerWidth < 600) c = 1, u = d;
1247
+ else switch (d) {
1248
+ case 1:
1249
+ case 2:
1250
+ case 3:
1251
+ c = d, u = 1;
1252
+ break;
1253
+ case 4:
1254
+ case 5:
1255
+ case 6:
1256
+ u = 2, c = Math.ceil(d / u);
1257
+ break;
1258
+ case 7:
1259
+ case 8:
1260
+ case 9:
1261
+ u = 3, c = Math.ceil(d / u);
1262
+ break;
1263
+ default:
1264
+ u = 4, c = Math.ceil(d / u);
1265
+ }
1266
+ const p = void 0 !== (null == a ? void 0 : a.addTitle) && (null == a ? void 0 : a.addTitle), m = void 0 !== (null == a ? void 0 : a.multiOption) && (null == a ? void 0 : a.multiOption), h = void 0 !== (null == a ? void 0 : a.extraOption) && (null == a ? void 0 : a.extraOption);
1267
+ function f(e4) {
1268
+ try {
1269
+ const { position: t4, url: r2, value: a2 } = e4, o2 = document.createElement("div");
1270
+ o2.classList.add("magicfeedback-multiple-choice-image-option"), o2.style.width = `calc(100% / ${c} - 2px)`, o2.style.height = `calc(100% / ${u} - 2px)`, o2.style.padding = "8px", o2.style.margin = "0";
1271
+ const d2 = document.createElement("label");
1272
+ d2.classList.add("magicfeedback-image-option-label-container"), d2.htmlFor = `rating-${s}-${t4}`, d2.style.cursor = "pointer", d2.addEventListener("click", (() => {
1273
+ d2.style.border = "2px solid #000";
1274
+ }));
1275
+ const h2 = document.createElement("label");
1276
+ h2.textContent = a2, h2.classList.add("magicfeedback-multiple-choice-image-label");
1277
+ const f2 = document.createElement("input");
1278
+ f2.id = `rating-${s}-${t4}`, f2.type = m ? "checkbox" : "radio", f2.name = s, f2.value = a2, f2.style.position = "absolute", f2.style.opacity = "0", f2.style.width = "0", f2.style.height = "0", f2.classList.add("magicfeedback-input"), i && i === f2.value && (f2.checked = true), !m && n && f2.addEventListener("change", (() => {
1279
+ n();
1280
+ }));
1281
+ const v = document.createElement("img");
1282
+ v.classList.add("magicfeedback-multiple-choice-image-image"), v.src = r2, v.style.cursor = "pointer", v.style.backgroundSize = "cover", v.style.backgroundPosition = "center", v.style.width = "100%", v.style.height = "100%", v.style.objectFit = "cover", v.style.margin = "auto", d2.appendChild(f2), d2.appendChild(v), p && d2.appendChild(h2), o2.appendChild(d2), l.appendChild(o2);
1283
+ } catch (e5) {
1284
+ console.error(e5);
1285
+ }
1286
+ }
1287
+ return t3 && (o = o.sort((() => Math.random() - 0.5))), o.forEach(((e4) => f(JSON.parse(e4)))), h && (null == a ? void 0 : a.extraOptionValue) && (null == a ? void 0 : a.extraOptionValue.length) > 0 && f(null == a ? void 0 : a.extraOptionValue[0]), r.appendChild(l), { element: r, elementTypeClass: "magicfeedback-multiple-choice-image" };
1288
+ };
1289
+ }, 732: (e2, t2, i) => {
1290
+ "use strict";
1291
+ Object.defineProperty(t2, "__esModule", { value: true }), t2.renderNumber = void 0;
1292
+ const n = i(784), r = i(516);
1293
+ t2.renderNumber = ({ question: e3, format: t3, language: i2, urlParamValue: s }) => {
1294
+ const a = document.createElement("input");
1295
+ a.type = "number", a.placeholder = "slim" === t3 ? (0, r.parseTitle)(e3.title, i2) : n.placeholder.number(i2 || "en");
1296
+ const { value: o } = e3;
1297
+ return o.length && (o.sort(((e4, t4) => Number(e4) - Number(t4))), a.max = o[o.length - 1], a.min = o[0], a.value = o[0]), s && !isNaN(Number(s)) && (a.value = s), { element: a, elementTypeClass: "magicfeedback-number" };
1298
+ };
1299
+ }, 180: (e2, t2, i) => {
1300
+ "use strict";
1301
+ Object.defineProperty(t2, "__esModule", { value: true }), t2.renderPassword = void 0;
1302
+ const n = i(784);
1303
+ t2.renderPassword = ({ language: e3, placeholderText: t3, urlParamValue: i2 }) => {
1304
+ const r = document.createElement("input");
1305
+ return r.type = "password", r.placeholder = t3 || n.placeholder.password(e3 || "en"), i2 && (r.value = i2), { element: r, elementTypeClass: "magicfeedback-password" };
1306
+ };
1307
+ }, 66: (e2, t2, i) => {
1308
+ "use strict";
1309
+ Object.defineProperty(t2, "__esModule", { value: true }), t2.renderPointSystem = void 0;
1310
+ const n = i(784);
1311
+ t2.renderPointSystem = ({ question: e3, language: t3 }) => {
1312
+ const { ref: i2, value: r } = e3, s = document.createElement("div"), a = document.createElement("div");
1313
+ a.classList.add("magicfeedback-point-system-container");
1314
+ const o = document.createElement("ul");
1315
+ o.classList.add("magicfeedback-point-system-list"), o.style.padding = "0";
1316
+ const l = 100 / r.length, d = document.createElement("div");
1317
+ d.classList.add("magicfeedback-error"), d.textContent = n.placeholder.pointsystemerror(t3 || "en"), d.style.color = "#C70039", d.style.fontSize = "14px", d.style.textAlign = "right", d.style.width = "100%", d.style.display = "none";
1318
+ const c = document.createElement("div");
1319
+ return c.classList.add("magicfeedback-point-system-total"), c.textContent = "0 / 100 %", c.style.textAlign = "right", c.style.fontSize = "15px", c.style.marginTop = "5px", r.forEach(((e4, t4) => {
1320
+ const n2 = document.createElement("li");
1321
+ n2.classList.add("magicfeedback-point-system-item"), n2.style.display = "flex", n2.style.justifyContent = "space-between", n2.style.alignItems = "center", n2.style.margin = "5px";
1322
+ const r2 = document.createElement("label");
1323
+ r2.textContent = e4, r2.style.fontSize = "15px", n2.appendChild(r2);
1324
+ const s2 = document.createElement("span");
1325
+ s2.classList.add("magicfeedback-point-system-input-container");
1326
+ const a2 = document.createElement("input");
1327
+ a2.name = i2, a2.id = `${e4}`, a2.type = "number", a2.min = "0", a2.max = "100", a2.value = "0", a2.classList.add("magicfeedback-input"), a2.style.width = "40px", a2.style.border = "0", a2.style.textAlign = "center", a2.style.margin = "0 5px", a2.autofocus = 0 === t4;
1328
+ const u = document.createElement("span");
1329
+ u.textContent = "%", u.style.color = "#000", a2.addEventListener("input", (() => {
1330
+ const e5 = o.querySelectorAll("input");
1331
+ let t5 = 0;
1332
+ e5.forEach(((e6) => {
1333
+ t5 += Number(e6.value);
1334
+ })), t5 > 100 && (a2.value = `${l}%`, t5 -= Number(a2.value));
1335
+ const i3 = document.getElementById("magicfeedback-submit");
1336
+ i3 && (t5 < 100 ? (c.style.color = "orange", i3.setAttribute("disabled", "true")) : (d.style.display = "none", c.style.color = "green", i3.removeAttribute("disabled"))), c.textContent = `${t5} / 100 %`;
1337
+ })), a2.addEventListener("focus", (() => {
1338
+ const e5 = document.getElementById("magicfeedback-submit");
1339
+ e5 && (e5.setAttribute("disabled", "true"), e5.addEventListener("pointerover", (() => {
1340
+ const e6 = o.querySelectorAll("input");
1341
+ let t5 = 0;
1342
+ e6.forEach(((e7) => {
1343
+ t5 += Number(e7.value);
1344
+ })), t5 < 100 && (d.style.display = "block");
1345
+ })));
1346
+ })), s2.appendChild(a2), s2.appendChild(u), n2.appendChild(s2), o.appendChild(n2);
1347
+ })), a.appendChild(o), a.appendChild(c), a.appendChild(d), s.appendChild(a), { element: s, elementTypeClass: "magicfeedback-point-system" };
1348
+ };
1349
+ }, 773: (e2, t2) => {
1350
+ "use strict";
1351
+ Object.defineProperty(t2, "__esModule", { value: true }), t2.renderPriorityList = void 0, t2.renderPriorityList = ({ question: e3, randomPosition: t3, language: i }) => {
1352
+ var n, r, s;
1353
+ const a = document.createElement("div"), o = (function(e4) {
1354
+ const { value: t4, ref: i2, randomPosition: n2 = false, limitPriority: r2 = false, maxPriority: s2 = 0, language: a2 = "en", placeholder: o2 = "" } = e4, l = (e5) => {
1355
+ const t5 = { en: { selectUpTo: "Select up to", options: "options", thenOrder: "and then order them", selectOptions: "Select options", cancel: "Cancel", confirm: "Confirm", selectOptionNumber: "Select option #", prioritized: "Prioritized", of: "of", instruction: "Your priority list can be seen below. If you wish, you can rearrange your choices using the arrows. Click 'Next' to confirm your selection and proceed." }, es: { selectUpTo: "Selecciona hasta", options: "opciones", thenOrder: "y luego ord\xE9nalas", selectOptions: "Seleccionar opciones", cancel: "Cancelar", confirm: "Confirmar", selectOptionNumber: "Selecciona la opci\xF3n #", prioritized: "Priorizadas", of: "de", instruction: 'Tu lista priorizada se muestra abajo. Si deseas, puedes reordenar las opciones con las flechas. Haz clic en "Siguiente" para confirmar y continuar.' }, pt: { selectUpTo: "Selecione at\xE9", options: "op\xE7\xF5es", thenOrder: "e depois ordene-as", selectOptions: "Selecionar op\xE7\xF5es", cancel: "Cancelar", confirm: "Confirmar", selectOptionNumber: "Selecione a op\xE7\xE3o #", prioritized: "Priorizadas", of: "de", instruction: 'Sua lista de prioridades pode ser vista abaixo. Se quiser, voc\xEA pode reorganizar suas escolhas usando as setas. Clique em "Pr\xF3ximo" para confirmar sua sele\xE7\xE3o e continuar.' }, fr: { selectUpTo: "S\xE9lectionnez jusqu'\xE0", options: "options", thenOrder: "puis classez-les", selectOptions: "S\xE9lectionner des options", cancel: "Annuler", confirm: "Confirmer", selectOptionNumber: "S\xE9lectionnez l'option #", prioritized: "Prioris\xE9es", of: "sur", instruction: `Votre liste de priorit\xE9s est affich\xE9e ci-dessous. Si vous le souhaitez, vous pouvez r\xE9organiser vos choix \xE0 l'aide des fl\xE8ches. Cliquez sur "Suivant" pour confirmer votre s\xE9lection et continuer.` }, de: { selectUpTo: "W\xE4hlen Sie bis zu", options: "Optionen", thenOrder: "und ordnen Sie sie dann", selectOptions: "Optionen ausw\xE4hlen", cancel: "Abbrechen", confirm: "Best\xE4tigen", selectOptionNumber: "W\xE4hlen Sie Option #", prioritized: "Priorisiert", of: "von", instruction: 'Ihre Priorit\xE4tenliste wird unten angezeigt. Wenn Sie m\xF6chten, k\xF6nnen Sie Ihre Auswahl mit den Pfeilen neu anordnen. Klicken Sie auf "Weiter", um Ihre Auswahl zu best\xE4tigen und fortzufahren.' }, it: { selectUpTo: "Seleziona fino a", options: "opzioni", thenOrder: "e poi ordinali", selectOptions: "Seleziona opzioni", cancel: "Annulla", confirm: "Conferma", selectOptionNumber: "Seleziona opzione #", prioritized: "Prioritizzate", of: "di", instruction: 'La tua lista di priorit\xE0 \xE8 mostrata qui sotto. Se vuoi, puoi riordinare le tue scelte usando le frecce. Clicca su "Avanti" per confermare la selezione e continuare.' }, nl: { selectUpTo: "Selecteer tot", options: "opties", thenOrder: "en rangschik ze vervolgens", selectOptions: "Selecteer opties", cancel: "Annuleren", confirm: "Bevestigen", selectOptionNumber: "Selecteer optie #", prioritized: "Geprioriteerd", of: "van", instruction: 'Je prioriteitenlijst wordt hieronder weergegeven. Als je wilt, kun je je keuzes herschikken met behulp van de pijlen. Klik op "Volgende" om je selectie te bevestigen en door te gaan.' }, pl: { selectUpTo: "Wybierz do", options: "opcje", thenOrder: "a nast\u0119pnie je uporz\u0105dkuj", selectOptions: "Wybierz opcje", cancel: "Anuluj", confirm: "Potwierd\u017A", selectOptionNumber: "Wybierz opcj\u0119 #", prioritized: "Priorytetowe", of: "z", instruction: 'Twoja lista priorytet\xF3w jest pokazana poni\u017Cej. Je\u015Bli chcesz, mo\u017Cesz zmieni\u0107 kolejno\u015B\u0107 swoich wybor\xF3w za pomoc\u0105 strza\u0142ek. Kliknij "Dalej", aby potwierdzi\u0107 wyb\xF3r i kontynuowa\u0107.' }, ru: { selectUpTo: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0434\u043E", options: "\u0432\u0430\u0440\u0438\u0430\u043D\u0442\u043E\u0432", thenOrder: "\u0430 \u0437\u0430\u0442\u0435\u043C \u0443\u043F\u043E\u0440\u044F\u0434\u043E\u0447\u044C\u0442\u0435 \u0438\u0445", selectOptions: "\u0412\u044B\u0431\u0440\u0430\u0442\u044C \u0432\u0430\u0440\u0438\u0430\u043D\u0442\u044B", cancel: "\u041E\u0442\u043C\u0435\u043D\u0430", confirm: "\u041F\u043E\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044C", selectOptionNumber: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0432\u0430\u0440\u0438\u0430\u043D\u0442 #", prioritized: "\u041F\u0440\u0438\u043E\u0440\u0438\u0442\u0435\u0442\u044B", of: "\u0438\u0437", instruction: '\u0412\u0430\u0448 \u0441\u043F\u0438\u0441\u043E\u043A \u043F\u0440\u0438\u043E\u0440\u0438\u0442\u0435\u0442\u043E\u0432 \u043E\u0442\u043E\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044F \u043D\u0438\u0436\u0435. \u0415\u0441\u043B\u0438 \u0445\u043E\u0442\u0438\u0442\u0435, \u0432\u044B \u043C\u043E\u0436\u0435\u0442\u0435 \u0438\u0437\u043C\u0435\u043D\u0438\u0442\u044C \u043F\u043E\u0440\u044F\u0434\u043E\u043A \u0432\u0430\u0440\u0438\u0430\u043D\u0442\u043E\u0432 \u0441 \u043F\u043E\u043C\u043E\u0449\u044C\u044E \u0441\u0442\u0440\u0435\u043B\u043E\u043A. \u041D\u0430\u0436\u043C\u0438\u0442\u0435 "\u0414\u0430\u043B\u0435\u0435", \u0447\u0442\u043E\u0431\u044B \u043F\u043E\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044C \u0432\u044B\u0431\u043E\u0440 \u0438 \u043F\u0440\u043E\u0434\u043E\u043B\u0436\u0438\u0442\u044C.' }, ja: { selectUpTo: "\u6700\u5927", options: "\u500B\u306E\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\u9078\u629E", thenOrder: "\u305D\u306E\u5F8C\u4E26\u3079\u66FF\u3048\u3066\u304F\u3060\u3055\u3044", selectOptions: "\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\u9078\u629E", cancel: "\u30AD\u30E3\u30F3\u30BB\u30EB", confirm: "\u78BA\u8A8D", selectOptionNumber: "\u30AA\u30D7\u30B7\u30E7\u30F3 # \u3092\u9078\u629E", prioritized: "\u512A\u5148\u9806\u4F4D", of: "\u306E\u3046\u3061", instruction: "\u512A\u5148\u9806\u4F4D\u30EA\u30B9\u30C8\u306F\u4EE5\u4E0B\u306B\u8868\u793A\u3055\u308C\u307E\u3059\u3002\u5FC5\u8981\u306B\u5FDC\u3058\u3066\u3001\u77E2\u5370\u3092\u4F7F\u3063\u3066\u9078\u629E\u80A2\u3092\u4E26\u3079\u66FF\u3048\u308B\u3053\u3068\u304C\u3067\u304D\u307E\u3059\u3002\u300C\u6B21\u3078\u300D\u3092\u30AF\u30EA\u30C3\u30AF\u3057\u3066\u9078\u629E\u3092\u78BA\u5B9A\u3057\u3001\u7D9A\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002" }, zh: { selectUpTo: "\u6700\u591A\u9009\u62E9", options: "\u4E2A\u9009\u9879", thenOrder: "\u7136\u540E\u6392\u5E8F\u5B83\u4EEC", selectOptions: "\u9009\u62E9\u9009\u9879", cancel: "\u53D6\u6D88", confirm: "\u786E\u8BA4", selectOptionNumber: "\u9009\u62E9\u9009\u9879 #", prioritized: "\u5DF2\u4F18\u5148", of: "\u5171", instruction: "\u4F60\u7684\u4F18\u5148\u5217\u8868\u5982\u4E0B\u6240\u793A\u3002\u5982\u6709\u9700\u8981\uFF0C\u53EF\u4EE5\u4F7F\u7528\u7BAD\u5934\u91CD\u65B0\u6392\u5E8F\u9009\u9879\u3002\u70B9\u51FB\u201C\u4E0B\u4E00\u6B65\u201D\u786E\u8BA4\u9009\u62E9\u5E76\u7EE7\u7EED\u3002" }, ko: { selectUpTo: "\uCD5C\uB300", options: "\uAC1C\uC758 \uC635\uC158 \uC120\uD0DD", thenOrder: "\uADF8\uB7F0 \uB2E4\uC74C \uC815\uB82C\uD558\uC138\uC694", selectOptions: "\uC635\uC158 \uC120\uD0DD", cancel: "\uCDE8\uC18C", confirm: "\uD655\uC778", selectOptionNumber: "\uC635\uC158 # \uC120\uD0DD", prioritized: "\uC6B0\uC120\uC21C\uC704", of: "\uC911", instruction: '\uC6B0\uC120\uC21C\uC704 \uBAA9\uB85D\uC740 \uC544\uB798\uC5D0 \uD45C\uC2DC\uB429\uB2C8\uB2E4. \uC6D0\uD55C\uB2E4\uBA74 \uD654\uC0B4\uD45C\uB97C \uC0AC\uC6A9\uD574 \uC120\uD0DD \uD56D\uBAA9\uC744 \uC7AC\uC815\uB82C\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4. "\uB2E4\uC74C"\uC744 \uD074\uB9AD\uD558\uC5EC \uC120\uD0DD\uC744 \uD655\uC778\uD558\uACE0 \uACC4\uC18D\uD558\uC138\uC694.' }, ar: { selectUpTo: "\u0627\u062E\u062A\u0631 \u062D\u062A\u0649", options: "\u062E\u064A\u0627\u0631\u0627\u062A", thenOrder: "\u062B\u0645 \u0631\u062A\u0628\u0647\u0627", selectOptions: "\u0627\u062E\u062A\u0631 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A", cancel: "\u0625\u0644\u063A\u0627\u0621", confirm: "\u062A\u0623\u0643\u064A\u062F", selectOptionNumber: "\u0627\u062E\u062A\u0631 \u0627\u0644\u062E\u064A\u0627\u0631 #", prioritized: "\u062A\u0645 \u0627\u0644\u062A\u0631\u062A\u064A\u0628", of: "\u0645\u0646", instruction: '\u062A\u0638\u0647\u0631 \u0642\u0627\u0626\u0645\u0629 \u0627\u0644\u0623\u0648\u0644\u0648\u064A\u0627\u062A \u0627\u0644\u062E\u0627\u0635\u0629 \u0628\u0643 \u0623\u062F\u0646\u0627\u0647. \u0625\u0630\u0627 \u0631\u063A\u0628\u062A\u060C \u064A\u0645\u0643\u0646\u0643 \u0625\u0639\u0627\u062F\u0629 \u062A\u0631\u062A\u064A\u0628 \u0627\u062E\u062A\u064A\u0627\u0631\u0627\u062A\u0643 \u0628\u0627\u0633\u062A\u062E\u062F\u0627\u0645 \u0627\u0644\u0623\u0633\u0647\u0645. \u0627\u0646\u0642\u0631 \u0639\u0644\u0649 "\u0627\u0644\u062A\u0627\u0644\u064A" \u0644\u062A\u0623\u0643\u064A\u062F \u0627\u062E\u062A\u064A\u0627\u0631\u0643 \u0648\u0627\u0644\u0645\u062A\u0627\u0628\u0639\u0629.' }, bn: { selectUpTo: "\u09B8\u09B0\u09CD\u09AC\u09CB\u099A\u09CD\u099A \u09A8\u09BF\u09B0\u09CD\u09AC\u09BE\u099A\u09A8 \u0995\u09B0\u09C1\u09A8", options: "\u099F\u09BF \u09AC\u09BF\u0995\u09B2\u09CD\u09AA", thenOrder: "\u09A4\u09BE\u09B0\u09AA\u09B0 \u09B8\u09C7\u0997\u09C1\u09B2\u09CB \u09B8\u09BE\u099C\u09BE\u09A8", selectOptions: "\u09AC\u09BF\u0995\u09B2\u09CD\u09AA \u09A8\u09BF\u09B0\u09CD\u09AC\u09BE\u099A\u09A8 \u0995\u09B0\u09C1\u09A8", cancel: "\u09AC\u09BE\u09A4\u09BF\u09B2", confirm: "\u09A8\u09BF\u09B6\u09CD\u099A\u09BF\u09A4 \u0995\u09B0\u09C1\u09A8", selectOptionNumber: "\u09AC\u09BF\u0995\u09B2\u09CD\u09AA # \u09A8\u09BF\u09B0\u09CD\u09AC\u09BE\u099A\u09A8 \u0995\u09B0\u09C1\u09A8", prioritized: "\u0985\u0997\u09CD\u09B0\u09BE\u09A7\u09BF\u0995\u09BE\u09B0\u09AA\u09CD\u09B0\u09BE\u09AA\u09CD\u09A4", of: "\u098F\u09B0 \u09AE\u09A7\u09CD\u09AF\u09C7", instruction: "\u0986\u09AA\u09A8\u09BE\u09B0 \u0985\u0997\u09CD\u09B0\u09BE\u09A7\u09BF\u0995\u09BE\u09B0 \u09A4\u09BE\u09B2\u09BF\u0995\u09BE \u09A8\u09BF\u099A\u09C7 \u09A6\u09C7\u0996\u09BE\u09A8\u09CB \u09B9\u09AF\u09BC\u09C7\u099B\u09C7\u0964 \u099A\u09BE\u0987\u09B2\u09C7 \u09A4\u09C0\u09B0 \u099A\u09BF\u09B9\u09CD\u09A8 \u09AC\u09CD\u09AF\u09AC\u09B9\u09BE\u09B0 \u0995\u09B0\u09C7 \u0986\u09AA\u09A8\u09BE\u09B0 \u09AA\u099B\u09A8\u09CD\u09A6\u0997\u09C1\u09B2\u09CB \u09AA\u09C1\u09A8\u09B0\u09BE\u09AF\u09BC \u09B8\u09BE\u099C\u09BE\u09A4\u09C7 \u09AA\u09BE\u09B0\u09C7\u09A8\u0964 \u201C\u09AA\u09B0\u09AC\u09B0\u09CD\u09A4\u09C0\u201D \u0995\u09CD\u09B2\u09BF\u0995 \u0995\u09B0\u09C7 \u0986\u09AA\u09A8\u09BE\u09B0 \u09A8\u09BF\u09B0\u09CD\u09AC\u09BE\u099A\u09A8 \u09A8\u09BF\u09B6\u09CD\u099A\u09BF\u09A4 \u0995\u09B0\u09C1\u09A8 \u098F\u09AC\u0982 \u098F\u0997\u09BF\u09AF\u09BC\u09C7 \u09AF\u09BE\u09A8\u0964" }, da: { selectUpTo: "V\xE6lg op til", options: "muligheder", thenOrder: "og sorter dem derefter", selectOptions: "V\xE6lg muligheder", cancel: "Annuller", confirm: "Bekr\xE6ft", selectOptionNumber: "V\xE6lg mulighed #", prioritized: "Prioriteret", of: "af", instruction: 'Din prioritetsliste vises nedenfor. Hvis du \xF8nsker det, kan du omarrangere dine valg ved hj\xE6lp af pilene. Klik p\xE5 "N\xE6ste" for at bekr\xE6fte dit valg og forts\xE6tte.' }, fi: { selectUpTo: "Valitse enint\xE4\xE4n", options: "vaihtoehtoa", thenOrder: "ja j\xE4rjest\xE4 ne sitten", selectOptions: "Valitse vaihtoehdot", cancel: "Peruuta", confirm: "Vahvista", selectOptionNumber: "Valitse vaihtoehto #", prioritized: "Priorisoitu", of: " / ", instruction: 'Prioriteettilistasi n\xE4kyy alla. Voit halutessasi j\xE4rjest\xE4\xE4 valinnat uudelleen nuolien avulla. Napsauta "Seuraava" vahvistaaksesi valinnan ja jatkaaksesi.' }, sv: { selectUpTo: "V\xE4lj upp till", options: "alternativ", thenOrder: "och ordna dem sedan", selectOptions: "V\xE4lj alternativ", cancel: "Avbryt", confirm: "Bekr\xE4fta", selectOptionNumber: "V\xE4lj alternativ #", prioritized: "Prioriterat", of: "av", instruction: 'Din prioriteringslista visas nedan. Om du vill kan du ordna om dina val med hj\xE4lp av pilarna. Klicka p\xE5 "N\xE4sta" f\xF6r att bekr\xE4fta ditt val och forts\xE4tta.' }, no: { selectUpTo: "Velg opptil", options: "alternativer", thenOrder: "og ordne dem deretter", selectOptions: "Velg alternativer", cancel: "Avbryt", confirm: "Bekreft", selectOptionNumber: "Velg alternativ #", prioritized: "Prioritert", of: "av", instruction: 'Prioriteringslisten din vises nedenfor. Hvis du \xF8nsker det, kan du ordne valgene dine ved hjelp av pilene. Klikk p\xE5 "Neste" for \xE5 bekrefte valget ditt og fortsette.' } };
1356
+ return t5[t5[a2] ? a2 : "en"][e5];
1357
+ }, d = document.createElement("div");
1358
+ if (d.classList.add("magicfeedback-priority-list-container"), r2 && s2 && s2 > 0) {
1359
+ const e5 = [], r3 = document.createElement("div");
1360
+ r3.classList.add("magicfeedback-priority-list-header");
1361
+ const a3 = document.createElement("div");
1362
+ a3.classList.add("magicfeedback-priority-list-instruction"), a3.textContent = "" !== o2 ? o2 : `${l("instruction")}`, a3.style.display = "none";
1363
+ const c2 = document.createElement("button");
1364
+ c2.type = "button", c2.textContent = l("selectOptions"), c2.classList.add("magicfeedback-button"), c2.classList.add("magicfeedback-priority-list-open-btn"), r3.appendChild(c2), r3.appendChild(a3);
1365
+ const u2 = document.createElement("div");
1366
+ u2.classList.add("magicfeedback-priority-list-reorder");
1367
+ const p = document.createElement("ul");
1368
+ p.classList.add("magicfeedback-priority-list-list"), u2.appendChild(p);
1369
+ const m = () => {
1370
+ p.innerHTML = "", e5.forEach(((t5, n3) => {
1371
+ const r4 = document.createElement("li");
1372
+ r4.classList.add("magicfeedback-priority-list-item");
1373
+ const s3 = document.createElement("input");
1374
+ s3.classList.add("magicfeedback-input-magicfeedback-priority-list"), s3.classList.add("magicfeedback-input"), s3.type = "hidden", s3.id = `priority-list-${i2}`, s3.name = i2, s3.value = `${n3 + 1}. ${t5}`, r4.appendChild(s3);
1375
+ const a4 = document.createElement("label");
1376
+ a4.classList.add("magicfeedback-priority-list-item-label"), a4.textContent = `${n3 + 1}. ${t5}`, r4.appendChild(a4);
1377
+ const o3 = document.createElement("div");
1378
+ o3.classList.add("magicfeedback-priority-list-arrows");
1379
+ const l2 = document.createElement("img");
1380
+ l2.classList.add("magicfeedback-priority-list-arrow-up"), l2.src = "https://magicfeedback-c6458-dev.web.app/assets/arrow.svg", l2.style.visibility = 0 === n3 ? "hidden" : "visible";
1381
+ const d2 = document.createElement("img");
1382
+ d2.classList.add("magicfeedback-priority-list-arrow-down"), d2.src = "https://magicfeedback-c6458-dev.web.app/assets/arrow.svg", d2.style.transform = "rotate(180deg)", d2.style.visibility = n3 === e5.length - 1 ? "hidden" : "visible", l2.addEventListener("click", (() => {
1383
+ var i3, n4, o4, c3;
1384
+ const u3 = r4.previousElementSibling;
1385
+ if (u3) {
1386
+ const m2 = Number(null === (i3 = s3.value) || void 0 === i3 ? void 0 : i3.split(".")[0]) - 1;
1387
+ s3.value = `${m2}. ${t5}`, a4.textContent = `${m2}. ${t5}`, l2.style.visibility = 1 === m2 ? "hidden" : "visible", d2.style.visibility = m2 === e5.length ? "hidden" : "visible";
1388
+ const h2 = u3.querySelector(".magicfeedback-input-magicfeedback-priority-list"), f2 = u3.querySelector(".magicfeedback-priority-list-item-label"), v2 = u3.querySelector(".magicfeedback-priority-list-arrow-up"), g2 = u3.querySelector(".magicfeedback-priority-list-arrow-down");
1389
+ if (h2 && f2 && v2 && g2) {
1390
+ const t6 = Number(null === (n4 = h2.value) || void 0 === n4 ? void 0 : n4.split(".")[0]) + 1;
1391
+ h2.value = `${t6}.${null === (o4 = f2.textContent) || void 0 === o4 ? void 0 : o4.split(".")[1]}`, f2.textContent = `${t6}.${null === (c3 = f2.textContent) || void 0 === c3 ? void 0 : c3.split(".")[1]}`, v2.style.visibility = 1 === t6 ? "hidden" : "visible", g2.style.visibility = t6 === e5.length ? "hidden" : "visible";
1392
+ }
1393
+ p.insertBefore(r4, u3);
1394
+ }
1395
+ })), d2.addEventListener("click", (() => {
1396
+ var i3, n4, o4;
1397
+ const c3 = r4.nextElementSibling;
1398
+ if (c3) {
1399
+ const u3 = Number(null === (i3 = s3.value) || void 0 === i3 ? void 0 : i3.split(".")[0]) + 1;
1400
+ s3.value = `${u3}. ${t5}`, a4.textContent = `${u3}. ${t5}`, l2.style.visibility = 1 === u3 ? "hidden" : "visible", d2.style.visibility = u3 === e5.length ? "hidden" : "visible";
1401
+ const m2 = c3.querySelector(".magicfeedback-input-magicfeedback-priority-list"), h2 = c3.querySelector(".magicfeedback-priority-list-item-label"), f2 = c3.querySelector(".magicfeedback-priority-list-arrow-up"), v2 = c3.querySelector(".magicfeedback-priority-list-arrow-down");
1402
+ if (m2 && h2 && f2 && v2) {
1403
+ const t6 = Number(m2.value.split(".")[0]) - 1;
1404
+ m2.value = `${t6}.${null === (n4 = h2.textContent) || void 0 === n4 ? void 0 : n4.split(".")[1]}`, h2.textContent = `${t6}.${null === (o4 = h2.textContent) || void 0 === o4 ? void 0 : o4.split(".")[1]}`, f2.style.visibility = 1 === t6 ? "hidden" : "visible", v2.style.visibility = t6 === e5.length ? "hidden" : "visible";
1405
+ }
1406
+ p.insertBefore(c3, r4);
1407
+ }
1408
+ })), o3.appendChild(l2), o3.appendChild(d2), r4.appendChild(o3), p.appendChild(r4);
1409
+ }));
1410
+ }, h = document.createElement("div");
1411
+ h.classList.add("magicfeedback-modal-backdrop"), h.style.position = "fixed", h.style.top = "0", h.style.left = "0", h.style.width = "100vw", h.style.height = "100vh", h.style.background = "rgba(0,0,0,0.4)", h.style.display = "none", h.style.alignItems = "center", h.style.justifyContent = "center", h.style.zIndex = "9999";
1412
+ const f = document.createElement("div");
1413
+ f.classList.add("magicfeedback-modal"), f.style.background = "#fff", f.style.borderRadius = "8px", f.style.boxShadow = "0 8px 24px rgba(0,0,0,0.2)", f.style.maxWidth = "520px", f.style.width = "90%", f.style.maxHeight = "80vh", f.style.overflow = "auto", f.style.padding = "16px", f.style.position = "relative";
1414
+ const v = document.createElement("h5");
1415
+ v.classList.add("magicfeedback-modal-title");
1416
+ const g = () => Math.min(e5.length + 1, s2), y = () => {
1417
+ v.textContent = `${l("selectOptionNumber")}${g()}`;
1418
+ };
1419
+ y();
1420
+ const b = document.createElement("div");
1421
+ b.classList.add("magicfeedback-modal-list"), (n2 ? [...t4].sort((() => Math.random() - 0.5)) : [...t4]).forEach(((t5) => {
1422
+ const n3 = document.createElement("label");
1423
+ n3.classList.add("magicfeedback-modal-row");
1424
+ const r4 = document.createElement("input");
1425
+ r4.type = "checkbox", r4.classList.add("magicfeedback-input"), r4.name = `${i2}-selection`, r4.value = t5;
1426
+ const a4 = document.createElement("span");
1427
+ a4.textContent = t5, r4.addEventListener("change", (() => {
1428
+ if (r4.checked) {
1429
+ if (e5.length >= s2) return r4.checked = false, n3.classList.add("magicfeedback-warning"), void setTimeout((() => {
1430
+ n3.classList.remove("magicfeedback-warning");
1431
+ }), 800);
1432
+ e5.push(t5);
1433
+ } else {
1434
+ const i3 = e5.indexOf(t5);
1435
+ -1 !== i3 && e5.splice(i3, 1);
1436
+ }
1437
+ y(), A();
1438
+ })), n3.appendChild(r4), n3.appendChild(a4), b.appendChild(n3);
1439
+ }));
1440
+ const E = document.createElement("div");
1441
+ E.classList.add("magicfeedback-modal-actions");
1442
+ const k = document.createElement("div");
1443
+ k.classList.add("magicfeedback-modal-counter");
1444
+ const A = () => {
1445
+ const t5 = l("of");
1446
+ k.textContent = `${l("prioritized")} ${e5.length} ${t5} ${s2}`, a3.style.display = e5.length > 0 ? "block" : "none";
1447
+ };
1448
+ A();
1449
+ const C = document.createElement("button");
1450
+ C.type = "button", C.classList.add("magicfeedback-modal-close"), C.setAttribute("aria-label", l("cancel")), C.title = l("cancel"), C.textContent = "\xD7", C.style.position = "absolute", C.style.top = "8px", C.style.right = "8px", C.style.border = "none", C.style.background = "transparent", C.style.fontSize = "24px", C.style.cursor = "pointer", C.addEventListener("click", (() => {
1451
+ h.style.display = "none";
1452
+ }));
1453
+ const T = document.createElement("button");
1454
+ return T.type = "button", T.textContent = l("confirm"), T.classList.add("magicfeedback-button"), T.classList.add("magicfeedback-button-primary"), T.addEventListener("click", (() => {
1455
+ h.style.display = "none", m();
1456
+ })), E.appendChild(k), E.appendChild(T), f.appendChild(C), f.appendChild(v), f.appendChild(b), f.appendChild(E), h.appendChild(f), c2.addEventListener("click", (() => {
1457
+ h.style.display = "flex", y(), A();
1458
+ })), h.addEventListener("click", ((e6) => {
1459
+ e6.target === h && (h.style.display = "none");
1460
+ })), d.appendChild(r3), d.appendChild(u2), d.appendChild(h), m(), d;
1461
+ }
1462
+ const c = document.createElement("ul");
1463
+ c.classList.add("magicfeedback-priority-list-list");
1464
+ const u = n2 ? [...t4].sort((() => Math.random() - 0.5)) : [...t4];
1465
+ return u.forEach(((e5, t5) => {
1466
+ const n3 = document.createElement("li");
1467
+ n3.classList.add("magicfeedback-priority-list-item"), n3.style.display = "flex", n3.style.justifyContent = "space-between", n3.style.alignItems = "center", n3.style.margin = "5px";
1468
+ const r3 = document.createElement("input");
1469
+ r3.classList.add("magicfeedback-input-magicfeedback-priority-list"), r3.classList.add("magicfeedback-input"), r3.type = "hidden", r3.id = `priority-list-${i2}`, r3.name = i2, r3.value = `${t5 + 1}. ${e5}`, n3.appendChild(r3);
1470
+ const s3 = document.createElement("label");
1471
+ s3.classList.add("magicfeedback-priority-list-item-label"), s3.textContent = `${t5 + 1}. ${e5}`, n3.appendChild(s3);
1472
+ const a3 = document.createElement("div");
1473
+ a3.style.display = "flex", a3.style.alignItems = "center", a3.style.justifyContent = "space-between";
1474
+ const o3 = document.createElement("img");
1475
+ o3.classList.add("magicfeedback-priority-list-arrow-up"), o3.src = "https://magicfeedback-c6458-dev.web.app/assets/arrow.svg", o3.style.width = "20px", o3.style.height = "20px", o3.style.cursor = "pointer", o3.style.margin = "0 5px", o3.style.color = "#000", o3.style.visibility = 0 === t5 ? "hidden" : "visible", o3.addEventListener("click", (() => {
1476
+ var t6, i3, a4, d2;
1477
+ const p = n3.previousElementSibling;
1478
+ if (p) {
1479
+ const m = Number(null === (t6 = r3.value) || void 0 === t6 ? void 0 : t6.split(".")[0]) - 1;
1480
+ r3.value = `${m}. ${e5}`, s3.textContent = `${m}. ${e5}`, o3.style.visibility = 1 === m ? "hidden" : "visible", l2.style.visibility = m === u.length ? "hidden" : "visible";
1481
+ const h = p.querySelector(".magicfeedback-input-magicfeedback-priority-list"), f = p.querySelector(".magicfeedback-priority-list-item-label"), v = p.querySelector(".magicfeedback-priority-list-arrow-up"), g = p.querySelector(".magicfeedback-priority-list-arrow-down");
1482
+ if (h && f && v && g) {
1483
+ const e6 = Number(null === (i3 = h.value) || void 0 === i3 ? void 0 : i3.split(".")[0]) + 1;
1484
+ h.value = `${e6}.${null === (a4 = f.textContent) || void 0 === a4 ? void 0 : a4.split(".")[1]}`, f.textContent = `${e6}.${null === (d2 = f.textContent) || void 0 === d2 ? void 0 : d2.split(".")[1]}`, v.style.visibility = 1 === e6 ? "hidden" : "visible", g.style.visibility = e6 === u.length ? "hidden" : "visible";
1485
+ }
1486
+ c.insertBefore(n3, p);
1487
+ }
1488
+ }));
1489
+ const l2 = document.createElement("img");
1490
+ l2.classList.add("magicfeedback-priority-list-arrow-down"), l2.src = "https://magicfeedback-c6458-dev.web.app/assets/arrow.svg", l2.style.width = "20px", l2.style.height = "20px", l2.style.cursor = "pointer", l2.style.margin = "0 5px", l2.style.color = "#000", l2.style.transform = "rotate(180deg)", l2.style.visibility = t5 === u.length - 1 ? "hidden" : "visible", l2.addEventListener("click", (() => {
1491
+ var t6, i3, a4;
1492
+ const d2 = n3.nextElementSibling;
1493
+ if (d2) {
1494
+ const p = Number(null === (t6 = r3.value) || void 0 === t6 ? void 0 : t6.split(".")[0]) + 1;
1495
+ r3.value = `${p}. ${e5}`, s3.textContent = `${p}. ${e5}`, o3.style.visibility = 1 === p ? "hidden" : "visible", l2.style.visibility = p === u.length ? "hidden" : "visible";
1496
+ const m = d2.querySelector(".magicfeedback-input-magicfeedback-priority-list"), h = d2.querySelector(".magicfeedback-priority-list-item-label"), f = d2.querySelector(".magicfeedback-priority-list-arrow-up"), v = d2.querySelector(".magicfeedback-priority-list-arrow-down");
1497
+ if (m && h && f && v) {
1498
+ const e6 = Number(m.value.split(".")[0]) - 1;
1499
+ m.value = `${e6}.${null === (i3 = h.textContent) || void 0 === i3 ? void 0 : i3.split(".")[1]}`, h.textContent = `${e6}.${null === (a4 = h.textContent) || void 0 === a4 ? void 0 : a4.split(".")[1]}`, f.style.visibility = 1 === e6 ? "hidden" : "visible", v.style.visibility = e6 === u.length ? "hidden" : "visible";
1500
+ }
1501
+ c.insertBefore(d2, n3);
1502
+ }
1503
+ })), a3.appendChild(o3), a3.appendChild(l2), n3.appendChild(a3), c.appendChild(n3);
1504
+ })), d.appendChild(c), d;
1505
+ })({ value: e3.value, ref: e3.ref, randomPosition: t3, limitPriority: (null === (n = e3.assets) || void 0 === n ? void 0 : n.limitPriority) || false, maxPriority: (null === (r = e3.assets) || void 0 === r ? void 0 : r.maxPriority) || 0, placeholder: (null === (s = e3.assets) || void 0 === s ? void 0 : s.placeholder) || "", language: i || "en" });
1506
+ return a.appendChild(o), { element: a, elementTypeClass: "magicfeedback-priority-list" };
1507
+ };
1508
+ }, 152: (e2, t2, i) => {
1509
+ "use strict";
1510
+ Object.defineProperty(t2, "__esModule", { value: true }), t2.renderRatingEmoji = void 0;
1511
+ const n = i(559), r = "https://survey-dev.magicfeedback.io/assets/emojis";
1512
+ t2.renderRatingEmoji = ({ question: e3, url: t3, send: i2, urlParamValue: s }) => {
1513
+ var a;
1514
+ const { ref: o, assets: l } = e3, d = document.createElement("div"), c = "magicfeedback-rating", u = document.createElement("div");
1515
+ u.classList.add("magicfeedback-rating-container");
1516
+ const p = (null == l ? void 0 : l.max) ? Number(null == l ? void 0 : l.max) : 5, m = (null == l ? void 0 : l.min) ? Number(null == l ? void 0 : l.min) : 1, h = (0, n.createRatingPlaceholder)(m, p, null == l ? void 0 : l.minPlaceholder, null == l ? void 0 : l.maxPlaceholder, null !== (a = null == l ? void 0 : l.extraOption) && void 0 !== a && a);
1517
+ for (let e4 = m; e4 <= p; e4++) {
1518
+ const n2 = document.createElement("div");
1519
+ n2.classList.add("magicfeedback-rating-option");
1520
+ const a2 = document.createElement("label");
1521
+ a2.htmlFor = `rating-${o}-${e4}`, a2.classList.add("magicfeedback-rating-option-label-container");
1522
+ const l2 = document.createElement("label");
1523
+ l2.htmlFor = `rating-${o}-${e4}`, l2.textContent = e4.toString();
1524
+ const d2 = document.createElement("img");
1525
+ if (d2.alt = `face-${o}-${e4}`, d2.className = `rating-image${e4}`, 0 === m && 10 === p) d2.src = `${t3}/${e4}.svg`, d2.onerror = () => d2.src = `${r}/${e4}.svg`;
1526
+ else if (1 === m && 5 === p) switch (e4) {
1527
+ case 1:
1528
+ d2.src = `${t3}/1.svg`, d2.onerror = () => d2.src = `${r}/1.svg`;
1529
+ break;
1530
+ case 2:
1531
+ d2.src = `${t3}/2.svg`, d2.onerror = () => d2.src = `${r}/2.svg`;
1532
+ break;
1533
+ case 3:
1534
+ d2.src = `${t3}/6.svg`, d2.onerror = () => d2.src = `${r}/6.svg`;
1535
+ break;
1536
+ case 4:
1537
+ d2.src = `${t3}/9.svg`, d2.onerror = () => d2.src = `${r}/9.svg`;
1538
+ break;
1539
+ case 5:
1540
+ d2.src = `${t3}/10.svg`, d2.onerror = () => d2.src = `${r}/10.svg`;
1541
+ }
1542
+ else {
1543
+ const i3 = Math.round(10 / (p - m) * (e4 - m));
1544
+ d2.src = `${t3}/${i3}.svg`, d2.onerror = () => d2.src = `${r}/${i3}.svg`;
1545
+ }
1546
+ const h2 = document.createElement("input");
1547
+ h2.id = `rating-${o}-${e4}`, h2.type = "radio", h2.name = o, h2.value = e4.toString(), h2.classList.add(c), h2.classList.add("magicfeedback-input"), i2 && h2.addEventListener("change", (() => {
1548
+ i2();
1549
+ })), s && s === h2.value && (h2.checked = true), a2.appendChild(h2), a2.appendChild(d2), a2.appendChild(l2), n2.appendChild(a2), u.appendChild(n2);
1550
+ }
1551
+ if ((null == l ? void 0 : l.extraOption) && (null == l ? void 0 : l.extraOptionText)) {
1552
+ const e4 = document.createElement("div");
1553
+ e4.classList.add("magicfeedback-rating-option");
1554
+ const t4 = document.createElement("label");
1555
+ t4.htmlFor = `rating-${o}-extra`, t4.classList.add("magicfeedback-rating-option-label-container");
1556
+ const n2 = document.createElement("label");
1557
+ n2.htmlFor = `rating-${o}-extra`, n2.textContent = null == l ? void 0 : l.extraOptionText;
1558
+ const r2 = document.createElement("img");
1559
+ r2.src = "https://magicfeedback-c6458-dev.web.app/assets/question.svg", r2.alt = `face-${o}-extra`, r2.className = "magicfeedback-rating-image-extra";
1560
+ const s2 = document.createElement("input");
1561
+ s2.id = `rating-${o}-extra`, s2.type = "radio", s2.name = o, s2.value = "-", s2.classList.add(c), s2.classList.add("magicfeedback-input"), i2 && s2.addEventListener("change", (() => {
1562
+ i2();
1563
+ })), t4.appendChild(s2), t4.appendChild(r2), t4.appendChild(n2), e4.appendChild(t4), u.appendChild(e4);
1564
+ }
1565
+ return h.childElementCount > 0 && (u.classList.add("magicfeedback-rating-container--with-placeholder"), u.insertBefore(h, u.firstChild)), d.appendChild(u), { element: d, elementTypeClass: c };
1566
+ };
1567
+ }, 917: (e2, t2, i) => {
1568
+ "use strict";
1569
+ Object.defineProperty(t2, "__esModule", { value: true }), t2.renderRatingNumber = void 0;
1570
+ const n = i(559);
1571
+ t2.renderRatingNumber = ({ question: e3, order: t3, direction: i2, isPhone: r, send: s, urlParamValue: a }) => {
1572
+ const o = "magicfeedback-rating-number";
1573
+ return { element: (0, n.createRatingNumberElement)(e3.ref, e3.assets, t3, i2, r, o, s, a), elementTypeClass: o };
1574
+ };
1575
+ }, 452: (e2, t2, i) => {
1576
+ "use strict";
1577
+ Object.defineProperty(t2, "__esModule", { value: true }), t2.renderRatingStar = void 0;
1578
+ const n = i(559);
1579
+ t2.renderRatingStar = ({ question: e3, send: t3, urlParamValue: i2 }) => {
1580
+ var r, s;
1581
+ const a = document.createElement("div"), o = (0, n.createStarRating)(e3.ref, null === (r = e3.assets) || void 0 === r ? void 0 : r.minPlaceholder, null === (s = e3.assets) || void 0 === s ? void 0 : s.maxPlaceholder, t3, i2);
1582
+ return a.appendChild(o), { element: a, elementTypeClass: "magicfeedback-rating-star" };
1583
+ };
1584
+ }, 85: (e2, t2, i) => {
1585
+ "use strict";
1586
+ Object.defineProperty(t2, "__esModule", { value: true }), t2.renderSelect = void 0;
1587
+ const n = i(516);
1588
+ t2.renderSelect = ({ question: e3, format: t3, language: i2, urlParamValue: r, send: s }) => {
1589
+ const { title: a, value: o, defaultValue: l } = e3, d = document.createElement("select"), c = document.createElement("option");
1590
+ return c.value = "", c.text = "slim" === t3 ? (0, n.parseTitle)(a, i2) : l || "Select an option", c.disabled = true, c.selected = true, d.appendChild(c), o.forEach(((e4) => {
1591
+ const t4 = document.createElement("option");
1592
+ t4.value = e4, t4.text = e4, d.appendChild(t4);
1593
+ })), r && o.includes(r) && (d.value = r), s && d.addEventListener("change", (() => {
1594
+ s();
1595
+ })), { element: d, elementTypeClass: "magicfeedback-select" };
1596
+ };
1597
+ }, 90: (e2, t2, i) => {
1598
+ "use strict";
1599
+ Object.defineProperty(t2, "__esModule", { value: true }), t2.renderText = void 0;
1600
+ const n = i(784);
1601
+ t2.renderText = ({ language: e3, placeholderText: t3, urlParamValue: i2, send: r }) => {
1602
+ const s = document.createElement("input");
1603
+ return s.type = "text", s.placeholder = t3 || n.placeholder.answer(e3 || "en"), i2 && (s.value = i2), s.addEventListener("keyup", ((e4) => {
1604
+ e4.preventDefault(), "Enter" === e4.key && r && r();
1605
+ })), { element: s, elementTypeClass: "magicfeedback-text" };
1606
+ };
1607
+ }, 250: (e2, t2) => {
1608
+ "use strict";
1609
+ Object.defineProperty(t2, "__esModule", { value: true }), t2.renderUploadFile = void 0, t2.renderUploadFile = ({ question: e3 }) => {
1610
+ var t3, i;
1611
+ const n = document.createElement("input");
1612
+ return n.type = "file", n.required = e3.require, n.multiple = (null === (t3 = e3.assets) || void 0 === t3 ? void 0 : t3.multiple) || false, n.maxLength = (null === (i = e3.assets) || void 0 === i ? void 0 : i.maxFiles) || 1, { element: n, elementTypeClass: "magicfeedback-upload-file" };
1613
+ };
1614
+ }, 843: (e2, t2) => {
1615
+ "use strict";
1616
+ Object.defineProperty(t2, "__esModule", { value: true }), t2.renderUploadImage = void 0, t2.renderUploadImage = ({ question: e3 }) => {
1617
+ var t3, i;
1618
+ const n = document.createElement("input");
1619
+ return n.type = "file", n.accept = "image/*", n.required = e3.require, n.multiple = (null === (t3 = e3.assets) || void 0 === t3 ? void 0 : t3.multiple) || false, n.maxLength = (null === (i = e3.assets) || void 0 === i ? void 0 : i.maxFiles) || 1, { element: n, elementTypeClass: "magicfeedback-upload-image" };
1620
+ };
929
1621
  }, 857: (e2, t2) => {
930
1622
  "use strict";
931
1623
  Object.defineProperty(t2, "__esModule", { value: true }), t2.endpoints = void 0, t2.endpoints = { sdk: { app: (e3, t3) => `sdk/app/${e3}/${t3}`, app_info: (e3, t3) => `sdk/app/${e3}/${t3}/info`, session: (e3) => `sdk/app/session/${e3}/info`, feedback: "sdk/feedback", followUpQuestion: "sdk/followUpQuestion" } };
@@ -1055,534 +1747,79 @@ var require_magicfeedback_sdk_browser = __commonJS({
1055
1747
  }, 213: (e2, t2, i) => {
1056
1748
  "use strict";
1057
1749
  Object.defineProperty(t2, "__esModule", { value: true }), t2.renderStartMessage = t2.renderSuccess = t2.renderError = t2.renderActions = t2.renderQuestions = void 0;
1058
- const n = i(558), a = i(784), s = "https://survey-dev.magicfeedback.io/assets/emojis";
1059
- function r(e3, t3) {
1060
- return e3 ? "object" == typeof e3 ? e3[t3] || e3.en : e3 : "";
1061
- }
1062
- function o(e3, t3, i2, n2, a2, s2 = true, r2 = "ltr", o2 = "row") {
1063
- const l = document.createElement("div");
1064
- l.classList.add("magicfeedback-rating-placeholder"), l.style.display = "flex", l.style.flexDirection = o2, l.style.alignItems = "center", l.style.justifyContent = "space-between", l.style.width = a2 ? `calc(100% - (100% / ${t3 + 1}))` : "100%", l.style.marginRight = "auto", s2 && window.innerWidth < 600 && (l.style.flexDirection = "column");
1065
- const d = document.createElement("span");
1066
- d.textContent = i2, d.classList.add("magicfeedback-rating-placeholder-value"), d.style.fontSize = "15px", d.style.textAlign = "ltr" === r2 ? "left" : "right", d.style.width = "50%", (s2 && window.innerWidth < 600 || "column" === o2) && (d.textContent = `${e3} = ${i2}`, d.style.width = "100%", d.style.textAlign = "left", d.style.marginBottom = "5px");
1067
- const c = document.createElement("span");
1068
- return c.textContent = n2, c.classList.add("magicfeedback-rating-placeholder-value"), c.style.fontSize = "15px", c.style.textAlign = "ltr" === r2 ? "right" : "left", c.style.width = "50%", (s2 && window.innerWidth < 600 || "column" === o2) && (c.textContent = `${t3} = ${n2}`, c.style.width = "100%", c.style.textAlign = "left", c.style.marginBottom = "5px"), "ltr" === r2 ? (i2 && l.appendChild(d), n2 && l.appendChild(c)) : (n2 && l.appendChild(c), i2 && l.appendChild(d)), l;
1069
- }
1070
- t2.renderQuestions = function e3(t3, i2 = "standard", l = "en", d = { customIcons: false }, c) {
1750
+ const n = i(42), r = i(516), s = { small: "1rem", medium: "1.2rem", large: "1.5rem" };
1751
+ t2.renderQuestions = function e3(t3, i2 = "standard", a = "en", o = { customIcons: false }, l) {
1071
1752
  if (!t3) throw new Error("[MagicFeedback] No questions provided");
1072
- const u = [], { customIcons: p, id: h } = d;
1073
- return t3.forEach(((m) => {
1074
- var f, g;
1075
- if ((null === (g = null === (f = null == m ? void 0 : m.questionType) || void 0 === f ? void 0 : f.conf) || void 0 === g ? void 0 : g.length) > 0) {
1753
+ const d = [], { customIcons: c, id: u } = o;
1754
+ return t3.forEach(((p) => {
1755
+ var m, h;
1756
+ if ((null === (h = null === (m = null == p ? void 0 : p.questionType) || void 0 === m ? void 0 : m.conf) || void 0 === h ? void 0 : h.length) > 0) {
1076
1757
  let t4 = document.createElement("div");
1077
1758
  t4.classList.add("magicfeedback-div");
1078
1759
  const n2 = document.createElement("label");
1079
- n2.setAttribute("for", `magicfeedback-${m.id}`), n2.textContent = r(m.title, l), n2.classList.add("magicfeedback-label"), t4.appendChild(n2), m.questionType.conf.forEach(((e4) => {
1080
- e4.ref = m.ref, m.assets[e4.id] && (e4.assets = { placeholder: m.assets[e4.id] });
1081
- })), e3(m.questionType.conf, i2, l, d, c).forEach(((e4) => {
1760
+ n2.setAttribute("for", `magicfeedback-${p.id}`), n2.textContent = (0, r.parseTitle)(p.title, a), n2.classList.add("magicfeedback-label"), t4.appendChild(n2), p.questionType.conf.forEach(((e4) => {
1761
+ e4.ref = p.ref, p.assets[e4.id] && (e4.assets = { placeholder: p.assets[e4.id] });
1762
+ })), e3(p.questionType.conf, i2, a, o, l).forEach(((e4) => {
1082
1763
  t4.appendChild(e4);
1083
- })), u.push(t4);
1764
+ })), d.push(t4);
1084
1765
  } else {
1085
- const e4 = (function(e5, t4, i3, l2, d2) {
1086
- var c2, u2, p2;
1087
- let h2, m2, { id: f2, title: g2, type: v, ref: y, require: E, value: b, defaultValue: A, assets: k } = e5, C = document.createElement("div");
1088
- C.classList.add("magicfeedback-div");
1089
- const T = window.innerWidth < 600, x = "slim" === t4 ? r(g2, i3) : null == k ? void 0 : k.placeholder, w = (N = y, new URLSearchParams(window.location.search).get(N)), L = (null == k ? void 0 : k.maxCharacters) || 0, P = void 0 !== (null == k ? void 0 : k.randomPosition) && (null == k ? void 0 : k.randomPosition), S = (null == k ? void 0 : k.direction) || "row", O = (null == k ? void 0 : k.order) || "ltr";
1090
- var N;
1091
- switch (v) {
1092
- case n.FEEDBACKAPPANSWERTYPE.TEXT:
1093
- h2 = document.createElement("input"), h2.type = "text", h2.placeholder = x || a.placeholder.answer(i3 || "en"), w && (h2.value = w), h2.addEventListener("keyup", ((e6) => {
1094
- e6.preventDefault(), console.log(e6.key, e6), "Enter" === e6.key && d2 && d2();
1095
- })), m2 = "magicfeedback-text";
1096
- break;
1097
- case n.FEEDBACKAPPANSWERTYPE.LONGTEXT:
1098
- h2 = document.createElement("textarea"), h2.rows = 3, L > 0 && (h2.maxLength = L), h2.placeholder = x || a.placeholder.answer(i3 || "en"), w && (h2.value = w), m2 = "magicfeedback-longtext";
1099
- break;
1100
- case n.FEEDBACKAPPANSWERTYPE.NUMBER:
1101
- h2 = document.createElement("input"), h2.type = "number", h2.placeholder = "slim" === t4 ? r(g2, i3) : a.placeholder.number(i3 || "en"), m2 = "magicfeedback-number", b.length && (b.sort(((e6, t5) => Number(e6) - Number(t5))), h2.max = b[b.length - 1], h2.min = b[0], h2.value = b[0]), w && !isNaN(Number(w)) && (h2.value = w);
1102
- break;
1103
- case n.FEEDBACKAPPANSWERTYPE.RADIO:
1104
- case n.FEEDBACKAPPANSWERTYPE.MULTIPLECHOICE:
1105
- h2 = document.createElement("div"), m2 = "magicfeedback-" + ("MULTIPLECHOICE" === v ? "checkbox" : "radio");
1106
- let R = b || [];
1107
- P && (R = R.sort((() => Math.random() - 0.5)));
1108
- let $ = (null == k ? void 0 : k.exclusiveAnswers) || [];
1109
- (null == k ? void 0 : k.extraOption) && ($ = $.filter(((e6) => e6 !== k.extraOptionText))), $.length > 0 && (null == $ || $.forEach(((e6) => {
1110
- R.includes(e6) || R.push(e6);
1111
- }))), (null == k ? void 0 : k.extraOption) && !R.includes(null == k ? void 0 : k.extraOptionText) && R.push(null == k ? void 0 : k.extraOptionText), R.forEach(((e6, t5) => {
1112
- const s2 = document.createElement("div");
1113
- s2.classList.add(`magicfeedback-${"MULTIPLECHOICE" === v ? "checkbox" : "radio"}-container`);
1114
- const r2 = document.createElement("label"), o2 = document.createElement("input");
1115
- if (o2.id = `rating-${y}-${t5}`, o2.type = "MULTIPLECHOICE" === v ? "checkbox" : "radio", o2.name = y, o2.value = e6, o2.classList.add(m2), o2.classList.add("magicfeedback-input"), v === n.FEEDBACKAPPANSWERTYPE.MULTIPLECHOICE && (null == k ? void 0 : k.maxOptions) && (null == k ? void 0 : k.maxOptions) > 0 && o2.addEventListener("change", (() => {
1116
- document.querySelectorAll(`input[name="${y}"]:checked`).length > (null == k ? void 0 : k.maxOptions) && (o2.checked = false);
1117
- })), v === n.FEEDBACKAPPANSWERTYPE.RADIO && d2 && (!(null == k ? void 0 : k.extraOptionText) || (null == k ? void 0 : k.extraOptionText) && e6 !== (null == k ? void 0 : k.extraOptionText)) && o2.addEventListener("change", (() => {
1118
- d2();
1119
- })), e6 !== A && e6 !== w || (o2.checked = true), r2.textContent = e6, r2.htmlFor = `rating-${y}-${t5}`, o2.addEventListener("change", ((t6) => {
1120
- const i4 = document.getElementById(`extra-option-${y}`);
1121
- t6.target.checked && $.includes(e6) ? (console.log("exclusiveAnswers", $, e6), R.forEach(((t7) => {
1122
- t7 !== e6 && (document.querySelector(`input[value="${t7}"]`).checked = false);
1123
- })), i4 && (i4.style.display = "none")) : $.forEach(((t7) => {
1124
- t7 !== e6 && (document.querySelector(`input[value="${t7}"]`).checked = false);
1125
- })), (null == k ? void 0 : k.extraOption) && e6 === (null == k ? void 0 : k.extraOptionText) && i4 && (i4.style.display = t6.target.checked ? "block" : "none");
1126
- })), s2.appendChild(o2), s2.appendChild(r2), h2.appendChild(s2), (null == k ? void 0 : k.extraOption) && e6 === (null == k ? void 0 : k.extraOptionText)) {
1127
- const e7 = document.createElement("input");
1128
- e7.type = "text", e7.placeholder = (null == k ? void 0 : k.extraOptionPlaceholder) || a.placeholder.answer(i3 || "en"), e7.classList.add("magicfeedback-extra-option"), e7.classList.add("magicfeedback-input"), e7.id = `extra-option-${y}`, e7.name = `extra-option-${y}`, e7.style.display = "none", h2.appendChild(e7);
1129
- }
1130
- }));
1131
- break;
1132
- case n.FEEDBACKAPPANSWERTYPE.BOOLEAN:
1133
- h2 = document.createElement("div"), m2 = "magicfeedback-radio";
1134
- const _ = document.createElement("div");
1135
- _.classList.add("magicfeedback-boolean-container"), _.style.display = "flex", _.style.flexDirection = "row", _.style.justifyContent = "space-between", _.style.width = "70%", _.style.margin = "auto", ((null == k ? void 0 : k.addIcon) ? ["\u{1F44D}", "\u{1F44E}"] : (function(e6) {
1136
- switch (e6) {
1137
- case "es":
1138
- return ["S\xED", "No"];
1139
- case "fr":
1140
- return ["Oui", "Non"];
1141
- case "de":
1142
- return ["Ja", "Nein"];
1143
- case "it":
1144
- return ["S\xEC", "No"];
1145
- case "pt":
1146
- return ["Sim", "N\xE3o"];
1147
- case "nl":
1148
- return ["Ja", "Nee"];
1149
- case "pl":
1150
- return ["Tak", "Nie"];
1151
- case "ru":
1152
- return ["\u0414\u0430", "\u041D\u0435\u0442"];
1153
- case "ja":
1154
- return ["\u306F\u3044", "\u3044\u3044\u3048"];
1155
- case "zh":
1156
- return ["\u662F", "\u4E0D"];
1157
- case "ko":
1158
- return ["\uC608", "\uC544\uB2C8"];
1159
- case "da":
1160
- case "sv":
1161
- return ["Ja", "Nej"];
1162
- case "fi":
1163
- return ["Kyll\xE4", "Ei"];
1164
- case "no":
1165
- return ["Ja", "Nei"];
1166
- case "ar":
1167
- return ["\u0646\u0639\u0645", "\u0644\u0627"];
1168
- case "bn":
1169
- return ["\u09B9\u09CD\u09AF\u09BE\u0981", "\u09A8\u09BE"];
1170
- default:
1171
- return ["Yes", "No"];
1172
- }
1173
- })(i3)).forEach(((e6, t5) => {
1174
- const i4 = document.createElement("label");
1175
- i4.classList.add("magicfeedback-boolean-option"), i4.htmlFor = `rating-${y}-${t5}`, i4.style.cursor = "pointer", i4.style.border = "1px solid #000", i4.style.display = "flex", i4.style.justifyContent = "center", i4.style.alignItems = "center", i4.style.margin = "auto", i4.style.padding = "0", i4.style.width = "45%", i4.style.height = "38px";
1176
- const n2 = document.createElement("label");
1177
- n2.htmlFor = `rating-${y}-${t5}`, n2.textContent = e6, n2.style.margin = "0", n2.style.padding = "0";
1178
- const a2 = document.createElement("input");
1179
- a2.id = `rating-${y}-${t5}`, a2.type = "radio", a2.name = y, a2.value = ["Yes", "No"][t5], a2.classList.add(m2), a2.classList.add("magicfeedback-input"), a2.style.position = "absolute", a2.style.opacity = "0", a2.style.width = "0", a2.style.height = "0", a2.style.margin = "0", a2.addEventListener("change", (() => {
1180
- d2 && d2();
1181
- })), w && w.toLowerCase() === a2.value.toLowerCase() && (a2.checked = true), i4.appendChild(a2), i4.appendChild(n2), _.appendChild(i4);
1182
- })), h2.appendChild(_);
1183
- break;
1184
- case n.FEEDBACKAPPANSWERTYPE.RATING_EMOJI:
1185
- h2 = document.createElement("div"), m2 = "magicfeedback-rating";
1186
- const F = document.createElement("div");
1187
- F.classList.add("magicfeedback-rating-container");
1188
- const M = (null == k ? void 0 : k.max) ? Number(null == k ? void 0 : k.max) : 5, B = (null == k ? void 0 : k.min) ? Number(null == k ? void 0 : k.min) : 1, U = o(B, M, null == k ? void 0 : k.minPlaceholder, null == k ? void 0 : k.maxPlaceholder, null == k ? void 0 : k.extraOption);
1189
- for (let ce = B; ce <= M; ce++) {
1190
- const ue = document.createElement("div");
1191
- ue.classList.add("magicfeedback-rating-option");
1192
- const pe = document.createElement("label");
1193
- pe.htmlFor = `rating-${y}-${ce}`, pe.classList.add("magicfeedback-rating-option-label-container");
1194
- const he = document.createElement("label");
1195
- he.htmlFor = `rating-${y}-${ce}`, he.textContent = ce.toString();
1196
- const me = document.createElement("img");
1197
- if (me.alt = `face-${y}-${ce}`, me.className = `rating-image${ce}`, 0 === B && 10 === M) me.src = `${l2}/${ce}.svg`, me.onerror = () => me.src = `${s}/${ce}.svg`;
1198
- else if (1 === B && 5 === M) switch (ce) {
1199
- case 1:
1200
- me.src = `${l2}/1.svg`, me.onerror = () => me.src = `${s}/1.svg`;
1201
- break;
1202
- case 2:
1203
- me.src = `${l2}/2.svg`, me.onerror = () => me.src = `${s}/2.svg`;
1204
- break;
1205
- case 3:
1206
- me.src = `${l2}/6.svg`, me.onerror = () => me.src = `${s}/6.svg`;
1207
- break;
1208
- case 4:
1209
- me.src = `${l2}/9.svg`, me.onerror = () => me.src = `${s}/9.svg`;
1210
- break;
1211
- case 5:
1212
- me.src = `${l2}/10.svg`, me.onerror = () => me.src = `${s}/10.svg`;
1213
- }
1214
- else {
1215
- const ge = Math.round(10 / (M - B) * (ce - B));
1216
- me.src = `${l2}/${ge}.svg`, me.onerror = () => me.src = `${s}/${ge}.svg`;
1217
- }
1218
- const fe = document.createElement("input");
1219
- fe.id = `rating-${y}-${ce}`, fe.type = "radio", fe.name = y, fe.value = ce.toString(), fe.classList.add(m2), fe.classList.add("magicfeedback-input"), d2 && fe.addEventListener("change", (() => {
1220
- d2();
1221
- })), w && w === fe.value && (fe.checked = true), pe.appendChild(fe), pe.appendChild(me), pe.appendChild(he), ue.appendChild(pe), F.appendChild(ue);
1222
- }
1223
- if ((null == k ? void 0 : k.extraOption) && (null == k ? void 0 : k.extraOptionText)) {
1224
- const ve = document.createElement("div");
1225
- ve.classList.add("magicfeedback-rating-option");
1226
- const ye = document.createElement("label");
1227
- ye.htmlFor = `rating-${y}-extra`, ye.classList.add("magicfeedback-rating-option-label-container");
1228
- const Ee = document.createElement("label");
1229
- Ee.htmlFor = `rating-${y}-extra`, Ee.textContent = null == k ? void 0 : k.extraOptionText;
1230
- const be = document.createElement("img");
1231
- be.src = "https://magicfeedback-c6458-dev.web.app/assets/question.svg", be.alt = `face-${y}-extra`, be.className = "magicfeedback-rating-image-extra";
1232
- const Ae = document.createElement("input");
1233
- Ae.id = `rating-${y}-extra`, Ae.type = "radio", Ae.name = y, Ae.value = "-", Ae.classList.add(m2), Ae.classList.add("magicfeedback-input"), d2 && Ae.addEventListener("change", (() => {
1234
- d2();
1235
- })), ye.appendChild(Ae), ye.appendChild(be), ye.appendChild(Ee), ve.appendChild(ye), F.appendChild(ve);
1236
- }
1237
- h2.appendChild(U), h2.appendChild(F);
1238
- break;
1239
- case n.FEEDBACKAPPANSWERTYPE.RATING_NUMBER:
1240
- m2 = "magicfeedback-rating-number", h2 = (function(e6, t5, i4, n2, a2, s2, r2, o2) {
1241
- const l3 = document.createElement("div");
1242
- l3.classList.add("magicfeedback-rating-number");
1243
- const d3 = "ltr" === i4 ? n2 : `${n2}-reverse`, c3 = document.createElement("div");
1244
- c3.classList.add("magicfeedback-rating-number-container"), c3.classList.add(`magicfeedback-rating-number-container-${i4}`), c3.classList.add(`magicfeedback-rating-number-container-${n2}`), c3.style.display = "flex", c3.style.flexDirection = d3, c3.setAttribute("role", "radiogroup"), c3.setAttribute("aria-label", (null == t5 ? void 0 : t5.ariaLabel) || "Rating");
1245
- const u3 = (null == t5 ? void 0 : t5.max) ? Number(null == t5 ? void 0 : t5.max) : 10, p3 = (null == t5 ? void 0 : t5.min) ? Number(null == t5 ? void 0 : t5.min) : 0, h3 = !(a2 || "column" === n2);
1246
- for (let i5 = p3; i5 <= u3; i5++) {
1247
- const a3 = document.createElement("div");
1248
- a3.classList.add("magicfeedback-rating-number-option"), a3.classList.add(`magicfeedback-rating-number-option-${n2}`);
1249
- const l4 = document.createElement("label");
1250
- if (l4.htmlFor = `rating-${e6}-${i5}`, l4.classList.add("magicfeedback-rating-number-option-label-container"), h3 && (l4.style.position = "relative", l4.style.overflow = "visible"), h3) {
1251
- const e7 = document.createElement("span");
1252
- e7.classList.add("magicfeedback-rating-number-cap"), e7.classList.add("magicfeedback-rating-placeholder-value"), e7.style.fontSize = "14px", e7.style.whiteSpace = "nowrap", e7.style.wordBreak = "normal", i5 === p3 && (null == t5 ? void 0 : t5.minPlaceholder) ? (e7.textContent = t5.minPlaceholder, e7.dataset.capType = "min") : i5 === u3 && (null == t5 ? void 0 : t5.maxPlaceholder) ? (e7.textContent = t5.maxPlaceholder, e7.dataset.capType = "max") : e7.dataset.capType = "mid", l4.appendChild(e7);
1253
- }
1254
- let d4 = i5.toString();
1255
- h3 || (i5 === p3 && (null == t5 ? void 0 : t5.minPlaceholder) && (d4 += ` = ${null == t5 ? void 0 : t5.minPlaceholder}`), i5 === u3 && (null == t5 ? void 0 : t5.maxPlaceholder) && (d4 += ` = ${null == t5 ? void 0 : t5.maxPlaceholder}`));
1256
- const m3 = document.createElement("input");
1257
- m3.id = `rating-${e6}-${i5}`, m3.type = "radio", m3.name = e6, m3.value = i5.toString(), m3.classList.add(s2), m3.classList.add("magicfeedback-input"), m3.setAttribute("aria-label", `${i5}`), r2 && m3.addEventListener("change", (() => r2())), o2 && o2 === m3.value && (m3.checked = true);
1258
- const f3 = document.createElement("label");
1259
- f3.htmlFor = `rating-${e6}-${i5}`, f3.textContent = d4, f3.classList.add("magicfeedback-rating-number-value"), l4.appendChild(m3), l4.appendChild(f3), a3.appendChild(l4), c3.appendChild(a3);
1260
- }
1261
- if ((null == t5 ? void 0 : t5.extraOption) && (null == t5 ? void 0 : t5.extraOptionText)) {
1262
- const n3 = document.createElement("div");
1263
- n3.classList.add("magicfeedback-rating-number-option");
1264
- const a3 = document.createElement("label");
1265
- if (a3.htmlFor = `rating-${e6}-extra`, a3.classList.add("magicfeedback-rating-number-option-label-container"), h3 && (a3.style.position = "relative", a3.style.overflow = "visible"), h3) {
1266
- const e7 = document.createElement("span");
1267
- e7.classList.add("magicfeedback-rating-number-cap"), e7.dataset.capType = "extra", e7.style.fontSize = "12px", e7.style.whiteSpace = "nowrap", e7.style.wordBreak = "normal", a3.appendChild(e7);
1268
- }
1269
- const o3 = document.createElement("input");
1270
- o3.id = `rating-${e6}-extra`, o3.type = "radio", o3.name = e6, o3.value = "-", o3.classList.add(s2), o3.classList.add("magicfeedback-input"), o3.setAttribute("aria-label", null == t5 ? void 0 : t5.extraOptionText), r2 && o3.addEventListener("change", (() => r2()));
1271
- const l4 = document.createElement("label");
1272
- l4.htmlFor = `rating-${e6}-extra`, l4.textContent = null == t5 ? void 0 : t5.extraOptionText, l4.classList.add("magicfeedback-rating-number-value"), a3.appendChild(o3), a3.appendChild(l4), n3.appendChild(a3), "ltr" === i4 ? c3.appendChild(n3) : c3.insertBefore(n3, c3.firstChild);
1273
- }
1274
- return l3.appendChild(c3), h3 && requestAnimationFrame((() => {
1275
- const e7 = Array.from(c3.querySelectorAll(".magicfeedback-rating-number-cap"));
1276
- if (0 === e7.length) return;
1277
- let t6 = 0;
1278
- e7.forEach(((e8) => {
1279
- var i5;
1280
- if (null === (i5 = e8.textContent) || void 0 === i5 ? void 0 : i5.trim()) {
1281
- const i6 = e8.getBoundingClientRect().height || 0;
1282
- i6 > t6 && (t6 = i6);
1283
- }
1284
- })), c3.style.position = "relative", c3.style.paddingTop = `${0 === t6 ? "42" : t6 + 6}px`, e7.forEach(((e8) => {
1285
- const n3 = e8.getBoundingClientRect().height || 0;
1286
- console.log(t6, n3, 6), e8.style.position = "absolute", e8.style.top = `-${0 === t6 ? "42" : t6 + n3}px`, e8.style.zIndex = "1", e8.style.pointerEvents = "none", e8.style.padding = "0", e8.style.boxSizing = "border-box", e8.style.whiteSpace = "nowrap", e8.style.wordBreak = "normal", e8.style.maxWidth = "none", e8.style.width = "max-content";
1287
- const a3 = e8.dataset.capType;
1288
- "min" === a3 ? ("ltr" === i4 ? (e8.style.left = "10px", e8.style.textAlign = "left") : (e8.style.right = "10px", e8.style.textAlign = "right"), e8.style.transform = "none") : "max" === a3 ? ("ltr" === i4 ? (e8.style.right = "10px", e8.style.textAlign = "right") : (e8.style.left = "10px", e8.style.textAlign = "left"), e8.style.transform = "none") : (e8.style.left = "50%", e8.style.transform = "translateX(-50%)", e8.style.textAlign = "center");
1289
- })), c3.style.overflow = "visible";
1290
- })), l3;
1291
- })(y, k, O, S, T, m2, d2, w);
1292
- break;
1293
- case n.FEEDBACKAPPANSWERTYPE.RATING_STAR:
1294
- h2 = document.createElement("div"), m2 = "magicfeedback-rating-star";
1295
- const q = (function(e6, t5, i4, n2 = () => {
1296
- }, a2) {
1297
- const s2 = "magicfeedback-rating-star-selected", r2 = document.createElement("div");
1298
- r2.classList.add("magicfeedback-rating-star-container"), r2.style.maxWidth = "300px", r2.style.margin = "auto", r2.dataset.originalSelection = "0";
1299
- for (let t6 = 1; t6 <= 5; t6++) {
1300
- const i5 = document.createElement("label");
1301
- i5.classList.add("magicfeedback-rating-star-option");
1302
- const o2 = document.createElement("input");
1303
- o2.id = `rating-${e6}-${t6}`, o2.type = "radio", o2.name = e6, o2.value = t6.toString(), o2.style.position = "absolute", o2.style.opacity = "0", o2.style.width = "0", o2.style.height = "0", o2.classList.add("magicfeedback-input"), a2 && a2 === o2.value && (o2.checked = true), o2.addEventListener("change", (() => {
1304
- const e7 = r2.querySelectorAll(".rating__star");
1305
- for (let t7 = 0; t7 < e7.length; t7++) t7 + 1 <= Number(o2.value) ? e7[t7].classList.contains(s2) || e7[t7].classList.add(s2) : e7[t7].classList.contains(s2) && e7[t7].classList.remove(s2);
1306
- r2.dataset.originalSelection = o2.value, n2 && n2();
1307
- })), i5.appendChild(o2);
1308
- const l3 = document.createElement("label");
1309
- l3.htmlFor = `rating-${e6}-${t6}`, l3.classList.add("rating__star"), l3.textContent = "\u2605", l3.style.fontSize = "40px", l3.style.color = "#CCCCCC", l3.style.cursor = "pointer", l3.addEventListener("mouseenter", (() => {
1310
- const e7 = r2.querySelectorAll(".rating__star"), i6 = t6 - 1;
1311
- e7.forEach(((e8, t7) => {
1312
- t7 <= i6 ? e8.classList.contains(s2) || e8.classList.add(s2) : e8.classList.contains(s2) && e8.classList.remove(s2);
1313
- }));
1314
- })), l3.addEventListener("mouseleave", (() => {
1315
- const e7 = Number(r2.dataset.originalSelection || "0");
1316
- r2.querySelectorAll(".rating__star").forEach(((t7, i6) => {
1317
- i6 < e7 ? t7.classList.contains(s2) || t7.classList.add(s2) : t7.classList.contains(s2) && t7.classList.remove(s2);
1318
- }));
1319
- })), i5.appendChild(l3), r2.appendChild(i5);
1320
- }
1321
- return r2.appendChild(o(1, 5, t5, i4, false, false)), r2;
1322
- })(y, null == k ? void 0 : k.minPlaceholder, null == k ? void 0 : k.maxPlaceholder, d2, w);
1323
- h2.appendChild(q);
1324
- break;
1325
- case n.FEEDBACKAPPANSWERTYPE.MULTIPLECHOISE_IMAGE:
1326
- let V = function(e6) {
1327
- try {
1328
- const { position: t5, url: i4, value: n2 } = e6, a2 = document.createElement("label");
1329
- a2.classList.add("magicfeedback-multiple-choice-image-option"), a2.style.width = `calc( ${100 / W}% - 10px)`, a2.style.height = `calc( ${100 / K}% - 10px)`, a2.style.margin = "5px";
1330
- const s2 = document.createElement("label");
1331
- s2.htmlFor = `rating-${y}-${t5}`, s2.classList.add("magicfeedback-image-option-label-container"), s2.style.display = "flex", s2.style.flexDirection = "column", s2.addEventListener("mouseover", (() => {
1332
- s2.style.border = "2px solid #000";
1333
- })), s2.addEventListener("mouseout", (() => {
1334
- s2.style.border = "none";
1335
- })), s2.addEventListener("click", (() => {
1336
- s2.style.border = "2px solid #000";
1337
- }));
1338
- const r2 = document.createElement("label");
1339
- r2.textContent = n2, r2.classList.add("magicfeedback-multiple-choice-image-label");
1340
- const o2 = document.createElement("input");
1341
- o2.id = `rating-${y}-${t5}`, o2.type = Y ? "checkbox" : "radio", o2.name = y, o2.value = n2, o2.style.position = "absolute", o2.style.opacity = "0", o2.style.width = "0", o2.style.height = "0", o2.classList.add("magicfeedback-input"), w && w === o2.value && (o2.checked = true), !Y && d2 && o2.addEventListener("change", (() => {
1342
- console.log("send"), d2();
1343
- }));
1344
- const l3 = document.createElement("img");
1345
- l3.classList.add("magicfeedback-multiple-choice-image-image"), l3.src = i4, l3.style.cursor = "pointer", l3.style.backgroundSize = "cover", l3.style.backgroundPosition = "center", l3.style.width = "100%", l3.style.height = "100%", l3.style.objectFit = "cover", l3.style.margin = "auto", s2.appendChild(o2), s2.appendChild(l3), G && s2.appendChild(r2), a2.appendChild(s2), j.appendChild(a2);
1346
- } catch (e7) {
1347
- console.error(e7);
1348
- }
1349
- };
1350
- h2 = document.createElement("div"), m2 = "magicfeedback-multiple-choice-image";
1351
- const j = document.createElement("div");
1352
- j.classList.add("magicfeedback-multiple-choice-image-container"), j.style.display = "flex", j.style.flexDirection = "row", j.style.flexWrap = "wrap", j.style.justifyContent = "center";
1353
- const Q = b.length;
1354
- let W = 1, K = 1;
1355
- if (window.innerWidth < 600) W = 1, K = Q;
1356
- else switch (Q) {
1357
- case 1:
1358
- case 2:
1359
- case 3:
1360
- W = Q, K = 1;
1361
- break;
1362
- case 4:
1363
- case 5:
1364
- case 6:
1365
- K = 2, W = Math.ceil(Q / K);
1366
- break;
1367
- case 7:
1368
- case 8:
1369
- case 9:
1370
- K = 3, W = Math.ceil(Q / K);
1371
- break;
1372
- default:
1373
- K = 4, W = Math.ceil(Q / K);
1374
- }
1375
- const G = void 0 !== (null == k ? void 0 : k.addTitle) && (null == k ? void 0 : k.addTitle), Y = void 0 !== (null == k ? void 0 : k.multiOption) && (null == k ? void 0 : k.multiOption), H = void 0 !== (null == k ? void 0 : k.extraOption) && (null == k ? void 0 : k.extraOption);
1376
- P && (b = b.sort((() => Math.random() - 0.5))), b.forEach(((e6) => V(JSON.parse(e6)))), H && (null == k ? void 0 : k.extraOptionValue) && (null == k ? void 0 : k.extraOptionValue.length) > 0 && V(null == k ? void 0 : k.extraOptionValue[0]), h2.appendChild(j);
1377
- break;
1378
- case n.FEEDBACKAPPANSWERTYPE.SELECT:
1379
- h2 = document.createElement("select"), m2 = "magicfeedback-select";
1380
- const X = document.createElement("option");
1381
- X.value = "", X.text = "slim" === t4 ? r(g2, i3) : A || "Select an option", X.disabled = true, X.selected = true, h2.appendChild(X), b.forEach(((e6) => {
1382
- const t5 = document.createElement("option");
1383
- t5.value = e6, t5.text = e6, h2.appendChild(t5);
1384
- })), w && b.includes(w) && (h2.value = w), d2 && h2.addEventListener("change", (() => {
1385
- d2();
1386
- }));
1387
- break;
1388
- case n.FEEDBACKAPPANSWERTYPE.DATE:
1389
- h2 = document.createElement("input"), h2.type = "date", h2.required = E, h2.placeholder = x || a.placeholder.date(i3 || "en"), m2 = "magicfeedback-date", w && (h2.value = w);
1390
- break;
1391
- case n.FEEDBACKAPPANSWERTYPE.CONSENT:
1392
- h2 = document.createElement("input"), m2 = "magicfeedback-consent", h2.type = "checkbox", h2.id = `magicfeedback-${f2}`, h2.name = y, h2.value = "true", h2.required = E, h2.classList.add("magicfeedback-consent"), h2.classList.add("magicfeedback-input"), w && b.includes(w) && (h2.checked = true), d2 && h2.addEventListener("change", (() => {
1393
- d2();
1394
- }));
1395
- break;
1396
- case n.FEEDBACKAPPANSWERTYPE.EMAIL:
1397
- h2 = document.createElement("input"), h2.type = "email", h2.required = E, h2.placeholder = x || "you@example.com", m2 = "magicfeedback-email", w && (h2.value = w);
1398
- break;
1399
- case n.FEEDBACKAPPANSWERTYPE.PASSWORD:
1400
- h2 = document.createElement("input"), h2.type = "password", h2.required = E, h2.placeholder = x || a.placeholder.password(i3 || "en"), m2 = "magicfeedback-password", w && (h2.value = w);
1401
- break;
1402
- case n.FEEDBACKAPPANSWERTYPE.MULTI_QUESTION_MATRIX:
1403
- h2 = document.createElement("div"), m2 = "magicfeedback-multi-question-matrix";
1404
- const z = document.createElement("div");
1405
- z.classList.add("magicfeedback-multi-question-matrix-container");
1406
- let J = (null == k ? void 0 : k.options) || [], Z = [...b], ee = [];
1407
- if (P && (J = null == J ? void 0 : J.sort((() => Math.random() - 0.5)), Z = [...Z].sort((() => Math.random() - 0.5))), (null == k ? void 0 : k.exclusiveAnswers) && (ee = null == k ? void 0 : k.exclusiveAnswers, null == ee || ee.forEach(((e6) => {
1408
- Z.includes(e6) || Z.push(e6);
1409
- }))), window.innerWidth < 600) {
1410
- const ke = document.createElement("div");
1411
- ke.classList.add("magicfeedback-multi-question-matrix-list"), null == J || J.forEach(((e6) => {
1412
- const t5 = document.createElement("div");
1413
- t5.classList.add("magicfeedback-multi-question-matrix-list-item"), t5.style.display = "flex", t5.style.flexDirection = "column", t5.style.alignItems = "flex-start", t5.style.marginBottom = "10px";
1414
- const i4 = document.createElement("label");
1415
- i4.classList.add("magicfeedback-multi-question-matrix-label"), i4.style.paddingBottom = "10px", i4.textContent = e6, t5.appendChild(i4), Z.forEach(((i5) => {
1416
- const n2 = document.createElement("div");
1417
- n2.classList.add("magicfeedback-radio-container"), n2.style.display = "flex", n2.style.alignItems = "center", n2.style.justifyContent = "flex-start", n2.style.width = "99%", n2.style.margin = "5px auto";
1418
- const a2 = document.createElement("label"), s2 = document.createElement("input");
1419
- s2.id = `${y}-${e6}-${i5}`, s2.type = "radio", s2.name = `${y}-${e6}`, s2.value = i5, s2.classList.add("magicfeedback-input"), a2.textContent = i5, a2.htmlFor = `${y}-${e6}-${i5}`, n2.appendChild(s2), n2.appendChild(a2), t5.appendChild(n2);
1420
- })), ke.appendChild(t5);
1421
- })), z.appendChild(ke);
1422
- } else {
1423
- const Ce = document.createElement("table");
1424
- Ce.classList.add("magicfeedback-multi-question-matrix-table");
1425
- const Te = document.createElement("thead");
1426
- Te.classList.add("magicfeedback-multi-question-matrix-header"), Te.style.paddingBottom = "15px";
1427
- const xe = document.createElement("tr"), we = document.createElement("th");
1428
- xe.appendChild(we), Z.forEach(((e6) => {
1429
- const t5 = document.createElement("th");
1430
- t5.textContent = e6, xe.appendChild(t5);
1431
- })), Te.appendChild(xe), Ce.appendChild(Te);
1432
- const Le = document.createElement("tbody");
1433
- null == J || J.forEach(((e6) => {
1434
- const t5 = document.createElement("tr");
1435
- t5.classList.add("magicfeedback-multi-question-matrix-row-tr");
1436
- const i4 = document.createElement("td");
1437
- i4.style.minWidth = "200px", i4.style.padding = "10px";
1438
- const n2 = document.createElement("label");
1439
- n2.classList.add("magicfeedback-multi-question-matrix-label"), n2.textContent = e6, i4.appendChild(n2), t5.appendChild(i4), Z.forEach(((i5) => {
1440
- const n3 = document.createElement("td"), a2 = document.createElement("input");
1441
- a2.type = "radio", a2.name = `${y}-${e6}`, a2.value = i5, a2.id = `${y}-${e6}-${i5}`, a2.classList.add("magicfeedback-input"), n3.appendChild(a2), t5.appendChild(n3);
1442
- })), Le.appendChild(t5);
1443
- })), Ce.appendChild(Le), z.appendChild(Ce);
1444
- }
1445
- h2.appendChild(z);
1446
- break;
1447
- case n.FEEDBACKAPPANSWERTYPE.PRIORITY_LIST:
1448
- h2 = document.createElement("div"), m2 = "magicfeedback-priority-list";
1449
- const te = document.createElement("div");
1450
- te.classList.add("magicfeedback-priority-list-container");
1451
- const ie = document.createElement("ul");
1452
- ie.classList.add("magicfeedback-priority-list-list"), P && (b = b.sort((() => Math.random() - 0.5))), b.forEach(((e6, t5) => {
1453
- const i4 = document.createElement("li");
1454
- i4.classList.add("magicfeedback-priority-list-item"), i4.style.display = "flex", i4.style.justifyContent = "space-between", i4.style.alignItems = "center", i4.style.margin = "5px";
1455
- const n2 = document.createElement("input");
1456
- n2.classList.add("magicfeedback-input-magicfeedback-priority-list"), n2.classList.add("magicfeedback-input"), n2.type = "hidden", n2.id = `priority-list-${y}`, n2.name = y, n2.value = `${t5 + 1}. ${e6}`, i4.appendChild(n2);
1457
- const a2 = document.createElement("label");
1458
- a2.classList.add("magicfeedback-priority-list-item-label"), a2.textContent = `${t5 + 1}. ${e6}`, i4.appendChild(a2);
1459
- const s2 = document.createElement("div");
1460
- s2.style.display = "flex", s2.style.alignItems = "center", s2.style.justifyContent = "space-between";
1461
- const r2 = document.createElement("img");
1462
- r2.classList.add("magicfeedback-priority-list-arrow-up"), r2.src = "https://magicfeedback-c6458-dev.web.app/assets/arrow.svg", r2.style.width = "20px", r2.style.height = "20px", r2.style.cursor = "pointer", r2.style.margin = "0 5px", r2.style.color = "#000", r2.style.visibility = 0 === t5 ? "hidden" : "visible", r2.addEventListener("click", (() => {
1463
- var t6, s3, l3, d3;
1464
- const c3 = i4.previousElementSibling;
1465
- if (c3) {
1466
- const u3 = Number(null === (t6 = n2.value) || void 0 === t6 ? void 0 : t6.split(".")[0]) - 1;
1467
- n2.value = `${u3}. ${e6}`, a2.textContent = `${u3}. ${e6}`, r2.style.visibility = 1 === u3 ? "hidden" : "visible", o2.style.visibility = u3 === b.length ? "hidden" : "visible";
1468
- const p3 = c3.querySelector(".magicfeedback-input-magicfeedback-priority-list"), h3 = c3.querySelector(".magicfeedback-priority-list-item-label"), m3 = c3.querySelector(".magicfeedback-priority-list-arrow-up"), f3 = c3.querySelector(".magicfeedback-priority-list-arrow-down");
1469
- if (p3 && h3 && m3 && f3) {
1470
- const e7 = Number(null === (s3 = p3.value) || void 0 === s3 ? void 0 : s3.split(".")[0]) + 1;
1471
- p3.value = `${e7}.${null === (l3 = h3.textContent) || void 0 === l3 ? void 0 : l3.split(".")[1]}`, h3.textContent = `${e7}.${null === (d3 = h3.textContent) || void 0 === d3 ? void 0 : d3.split(".")[1]}`, m3.style.visibility = 1 === e7 ? "hidden" : "visible", f3.style.visibility = e7 === b.length ? "hidden" : "visible";
1472
- }
1473
- ie.insertBefore(i4, c3);
1474
- }
1475
- })), s2.appendChild(r2);
1476
- const o2 = document.createElement("img");
1477
- o2.classList.add("magicfeedback-priority-list-arrow-down"), o2.src = "https://magicfeedback-c6458-dev.web.app/assets/arrow.svg", o2.style.width = "20px", o2.style.height = "20px", o2.style.cursor = "pointer", o2.style.margin = "0 5px", o2.style.color = "#000", o2.style.transform = "rotate(180deg)", o2.style.visibility = t5 === b.length - 1 ? "hidden" : "visible", o2.addEventListener("click", (() => {
1478
- var t6, s3, l3;
1479
- const d3 = i4.nextElementSibling;
1480
- if (d3) {
1481
- const c3 = Number(null === (t6 = n2.value) || void 0 === t6 ? void 0 : t6.split(".")[0]) + 1;
1482
- n2.value = c3.toString(), a2.textContent = `${c3.toString()}. ${e6}`, r2.style.visibility = 1 === c3 ? "hidden" : "visible", o2.style.visibility = c3 === b.length ? "hidden" : "visible";
1483
- const u3 = d3.querySelector(".magicfeedback-input-magicfeedback-priority-list"), p3 = d3.querySelector(".magicfeedback-priority-list-item-label"), h3 = d3.querySelector(".magicfeedback-priority-list-arrow-up"), m3 = d3.querySelector(".magicfeedback-priority-list-arrow-down");
1484
- if (u3 && p3 && h3 && m3) {
1485
- const e7 = Number(u3.value.split(".")[0]) - 1;
1486
- u3.value = `${e7}.${null === (s3 = p3.textContent) || void 0 === s3 ? void 0 : s3.split(".")[1]}`, p3.textContent = `${e7}.${null === (l3 = p3.textContent) || void 0 === l3 ? void 0 : l3.split(".")[1]}`, h3.style.visibility = 1 === e7 ? "hidden" : "visible", m3.style.visibility = e7 === b.length ? "hidden" : "visible";
1487
- }
1488
- ie.insertBefore(d3, i4);
1489
- }
1490
- })), s2.appendChild(o2), i4.appendChild(s2), ie.appendChild(i4);
1491
- })), te.appendChild(ie), h2.appendChild(te);
1492
- break;
1493
- case n.FEEDBACKAPPANSWERTYPE.POINT_SYSTEM:
1494
- h2 = document.createElement("div"), m2 = "magicfeedback-point-system";
1495
- const ne = document.createElement("div");
1496
- ne.classList.add("magicfeedback-point-system-container");
1497
- const ae = document.createElement("ul");
1498
- ae.classList.add("magicfeedback-point-system-list"), ae.style.padding = "0";
1499
- const se = 100, re = se / b.length, oe = document.createElement("div");
1500
- oe.classList.add("magicfeedback-error"), oe.textContent = a.placeholder.pointsystemerror(i3 || "en"), oe.style.color = "#C70039", oe.style.fontSize = "14px", oe.style.textAlign = "right", oe.style.width = "100%", oe.style.display = "none";
1501
- const le = document.createElement("div");
1502
- le.classList.add("magicfeedback-point-system-total"), le.textContent = "0 / 100 %", le.style.textAlign = "right", le.style.fontSize = "15px", le.style.marginTop = "5px", b.forEach(((e6, t5) => {
1503
- const i4 = document.createElement("li");
1504
- i4.classList.add("magicfeedback-point-system-item"), i4.style.display = "flex", i4.style.justifyContent = "space-between", i4.style.alignItems = "center", i4.style.margin = "5px";
1505
- const n2 = document.createElement("label");
1506
- n2.textContent = e6, n2.style.fontSize = "15px", i4.appendChild(n2);
1507
- const a2 = document.createElement("span");
1508
- a2.classList.add("magicfeedback-point-system-input-container");
1509
- const s2 = document.createElement("input");
1510
- s2.name = y, s2.id = `${e6}`, s2.type = "number", s2.min = "0", s2.max = `${se}`, s2.value = "0", s2.classList.add("magicfeedback-input"), s2.style.width = "40px", s2.style.border = "0", s2.style.textAlign = "center", s2.style.margin = "0 5px", s2.autofocus = 0 === t5;
1511
- const r2 = document.createElement("span");
1512
- r2.textContent = "%", r2.style.color = "#000", s2.addEventListener("input", (() => {
1513
- const e7 = ae.querySelectorAll("input");
1514
- let t6 = 0;
1515
- e7.forEach(((e8) => {
1516
- t6 += Number(e8.value);
1517
- })), t6 > se && (s2.value = `${re}%`, t6 -= Number(s2.value));
1518
- const i5 = document.getElementById("magicfeedback-submit");
1519
- i5 && (t6 < 100 ? (le.style.color = "orange", i5.setAttribute("disabled", "true")) : (oe.style.display = "none", le.style.color = "green", i5.removeAttribute("disabled"))), le.textContent = `${t6} / 100 %`;
1520
- })), s2.addEventListener("focus", (() => {
1521
- const e7 = document.getElementById("magicfeedback-submit");
1522
- e7 && (e7.setAttribute("disabled", "true"), e7.addEventListener("pointerover", (() => {
1523
- const e8 = ae.querySelectorAll("input");
1524
- let t6 = 0;
1525
- e8.forEach(((e9) => {
1526
- t6 += Number(e9.value);
1527
- })), t6 < 100 && (oe.style.display = "block");
1528
- })));
1529
- })), a2.appendChild(s2), a2.appendChild(r2), i4.appendChild(a2), ae.appendChild(i4);
1530
- })), ne.appendChild(ae), ne.appendChild(le), ne.appendChild(oe), h2.appendChild(ne);
1531
- break;
1532
- case n.FEEDBACKAPPANSWERTYPE.INFO_PAGE:
1533
- h2 = document.createElement("div"), m2 = "magicfeedback-info-page";
1534
- const de = document.createElement("div");
1535
- de.classList.add("magicfeedback-info-message"), de.innerHTML = x, h2.appendChild(de);
1536
- break;
1537
- case n.FEEDBACKAPPANSWERTYPE.UPLOAD_IMAGE:
1538
- h2 = document.createElement("input"), h2.type = "file", h2.accept = "image/*", h2.required = E, h2.multiple = (null == k ? void 0 : k.multiple) || false, h2.maxLength = (null == k ? void 0 : k.maxFiles) || 1, m2 = "magicfeedback-upload-image";
1539
- break;
1540
- case n.FEEDBACKAPPANSWERTYPE.UPLOAD_FILE:
1541
- h2 = document.createElement("input"), h2.type = "file", h2.required = E, h2.multiple = (null == k ? void 0 : k.multiple) || false, h2.maxLength = (null == k ? void 0 : k.maxFiles) || 1, m2 = "magicfeedback-upload-file";
1542
- break;
1543
- default:
1544
- return C;
1766
+ const e4 = (function(e5, t4, i3, a2, o2) {
1767
+ var l2, d2, c2;
1768
+ let u2, p2, { id: m2, title: h2, type: f, ref: v, require: g, defaultValue: y, assets: b } = e5, E = document.createElement("div");
1769
+ E.classList.add("magicfeedback-div");
1770
+ const k = window.innerWidth < 600, A = "slim" === t4 ? (0, r.parseTitle)(h2, i3) : null == b ? void 0 : b.placeholder, C = (0, r.getUrlParam)(v), T = (null == b ? void 0 : b.maxCharacters) || 0, P = void 0 !== (null == b ? void 0 : b.randomPosition) && (null == b ? void 0 : b.randomPosition), w = (null == b ? void 0 : b.direction) || "row", x = (null == b ? void 0 : b.order) || "ltr", O = (0, n.getQuestionRenderer)(f);
1771
+ if (!O) return E;
1772
+ {
1773
+ const n2 = O({ question: e5, format: t4, language: i3, url: a2, send: o2, isPhone: k, urlParamValue: C, placeholderText: A, maxCharacters: T, randomPosition: P, direction: w, order: x });
1774
+ u2 = n2.element, p2 = n2.elementTypeClass;
1545
1775
  }
1546
- h2.id = `magicfeedback-${f2}`, h2.setAttribute("name", y), h2.classList.add(m2), (void 0 !== A || null !== w) && (h2.value = w || A), ["RADIO", "MULTIPLECHOICE"].includes(v) || (h2.classList.add("magicfeedback-input"), h2.required = E);
1547
- const I = document.createElement("label");
1548
- I.setAttribute("for", `magicfeedback-${f2}`), I.textContent = r(g2, i3), I.classList.add("magicfeedback-label");
1549
- const D = document.createElement("label");
1550
- if (D.textContent = r(null == k ? void 0 : k.subtitle, i3), D.classList.add("magicfeedback-sublabel"), (null === (c2 = null == k ? void 0 : k.subtitleStyle) || void 0 === c2 ? void 0 : c2.includes("italic")) && (D.style.fontStyle = "italic"), (null === (u2 = null == k ? void 0 : k.subtitleStyle) || void 0 === u2 ? void 0 : u2.includes("bold")) && (D.style.fontWeight = "bold"), (null === (p2 = null == k ? void 0 : k.subtitleStyle) || void 0 === p2 ? void 0 : p2.includes("underline")) && (D.style.textDecoration = "underline"), ["CONSENT"].includes(v)) C.classList.add("magicfeedback-consent-container"), C.appendChild(h2), C.appendChild(I), C.appendChild(D);
1776
+ u2.id = `magicfeedback-${m2}`, u2.setAttribute("name", v), u2.classList.add(p2), (void 0 !== y || null !== C) && (u2.value = C || y), ["RADIO", "MULTIPLECHOICE"].includes(f) || (u2.classList.add("magicfeedback-input"), u2.required = g);
1777
+ const L = document.createElement("label");
1778
+ L.setAttribute("for", `magicfeedback-${m2}`), L.textContent = (0, r.parseTitle)(h2, i3), L.classList.add("magicfeedback-label"), (function(e6, t5) {
1779
+ if ("INFO_PAGE" !== t5.type) return;
1780
+ const { assets: i4 } = t5, n2 = (function(e7) {
1781
+ if (e7) return s[e7] || e7;
1782
+ })(null == i4 ? void 0 : i4.titleSize), r2 = (a3 = null == i4 ? void 0 : i4.titleStyle, Array.isArray(a3) ? a3 : a3 ? [a3] : []);
1783
+ var a3;
1784
+ n2 && e6.style.setProperty("font-size", n2, "important"), (null == i4 ? void 0 : i4.titleAlign) && (e6.style.setProperty("width", "100%", "important"), e6.style.setProperty("align-self", "stretch", "important"), e6.style.setProperty("text-align", i4.titleAlign, "important")), r2.includes("italic") && e6.style.setProperty("font-style", "italic", "important"), r2.includes("bold") && e6.style.setProperty("font-weight", "bold", "important"), r2.includes("underline") && e6.style.setProperty("text-decoration", "underline", "important");
1785
+ })(L, e5);
1786
+ const S = document.createElement("label");
1787
+ if (S.textContent = (0, r.parseTitle)(null == b ? void 0 : b.subtitle, i3), S.classList.add("magicfeedback-sublabel"), (null === (l2 = null == b ? void 0 : b.subtitleStyle) || void 0 === l2 ? void 0 : l2.includes("italic")) && (S.style.fontStyle = "italic"), (null === (d2 = null == b ? void 0 : b.subtitleStyle) || void 0 === d2 ? void 0 : d2.includes("bold")) && (S.style.fontWeight = "bold"), (null === (c2 = null == b ? void 0 : b.subtitleStyle) || void 0 === c2 ? void 0 : c2.includes("underline")) && (S.style.textDecoration = "underline"), ["CONSENT"].includes(f)) E.classList.add("magicfeedback-consent-container"), E.appendChild(u2), E.appendChild(L), (null == b ? void 0 : b.subtitle) && E.appendChild(S);
1551
1788
  else {
1552
- if ("slim" !== t4 && (C.appendChild(I), C.appendChild(D), void 0 !== (null == k ? void 0 : k.general) && "" !== (null == k ? void 0 : k.general))) {
1553
- const Pe = document.createElement("img");
1554
- Pe.src = null == k ? void 0 : k.general, Pe.classList.add("magicfeedback-image"), Pe.style.maxWidth = "auto", Pe.style.height = "400px", Pe.style.margin = "10px 0", C.appendChild(Pe);
1789
+ if ("slim" !== t4 && (E.appendChild(L), (null == b ? void 0 : b.subtitle) && E.appendChild(S), void 0 !== (null == b ? void 0 : b.general) && "" !== (null == b ? void 0 : b.general))) {
1790
+ const e6 = document.createElement("img");
1791
+ e6.src = null == b ? void 0 : b.general, e6.classList.add("magicfeedback-image"), e6.style.maxWidth = "auto", e6.style.height = "400px", e6.style.margin = "10px 0", E.appendChild(e6);
1555
1792
  }
1556
- if ("LONGTEXT" === v && L > 0) {
1557
- const Se = document.createElement("div");
1558
- if (Se.classList.add("magicfeedback-counter"), Se.textContent = `${h2.value.length}/${L}`, Se.style.textAlign = "right", Se.style.fontSize = "15px", Se.style.marginTop = "5px", h2.addEventListener("input", (() => {
1559
- Se.textContent = `${h2.value.length}/${L}`;
1560
- })), C.appendChild(h2), C.appendChild(Se), (null == k ? void 0 : k.extraOption) && (null == k ? void 0 : k.extraOptionText)) {
1561
- const Oe = document.createElement("div");
1562
- Oe.classList.add("magicfeedback-skip-container"), Oe.classList.add("magicfeedback-checkbox-container"), Oe.style.display = "flex", Oe.style.justifyContent = "flex-start";
1563
- const Ne = document.createElement("input");
1564
- Ne.classList.add("magicfeedback-skip"), Ne.type = "checkbox", Ne.id = `skip-${y}`, Ne.name = y, Ne.value = "-", Ne.style.cursor = "pointer";
1565
- const Ie = document.createElement("label");
1566
- Ie.htmlFor = `skip-${y}`, Ie.textContent = null == k ? void 0 : k.extraOptionText, Ie.style.fontSize = "15px", Ie.style.cursor = "pointer", Ie.style.margin = "0 5px", Ne.addEventListener("click", (() => {
1567
- h2.value = "-", d2 && d2();
1568
- })), Oe.appendChild(Ne), Oe.appendChild(Ie), C.appendChild(Oe);
1793
+ if ("LONGTEXT" === f && T > 0) {
1794
+ const e6 = document.createElement("div");
1795
+ if (e6.classList.add("magicfeedback-counter"), e6.textContent = `${u2.value.length}/${T}`, e6.style.textAlign = "right", e6.style.fontSize = "15px", e6.style.marginTop = "5px", u2.addEventListener("input", (() => {
1796
+ e6.textContent = `${u2.value.length}/${T}`;
1797
+ })), E.appendChild(u2), E.appendChild(e6), (null == b ? void 0 : b.extraOption) && (null == b ? void 0 : b.extraOptionText)) {
1798
+ const e7 = document.createElement("div");
1799
+ e7.classList.add("magicfeedback-skip-container"), e7.classList.add("magicfeedback-checkbox-container"), e7.style.display = "flex", e7.style.justifyContent = "flex-start";
1800
+ const t5 = document.createElement("input");
1801
+ t5.classList.add("magicfeedback-skip"), t5.type = "checkbox", t5.id = `skip-${v}`, t5.name = v, t5.value = "-", t5.style.cursor = "pointer";
1802
+ const i4 = document.createElement("label");
1803
+ i4.htmlFor = `skip-${v}`, i4.textContent = null == b ? void 0 : b.extraOptionText, i4.style.fontSize = "15px", i4.style.cursor = "pointer", i4.style.margin = "0 5px", t5.addEventListener("click", (() => {
1804
+ u2.value = "-", o2 && o2();
1805
+ })), e7.appendChild(t5), e7.appendChild(i4), E.appendChild(e7);
1569
1806
  }
1570
- } else C.appendChild(h2);
1807
+ } else E.appendChild(u2);
1571
1808
  }
1572
- return C;
1573
- })(m, i2, l, `${s}${p ? `/${h}` : ""}`, 1 === t3.length ? c : void 0);
1574
- u.push(e4);
1809
+ return E;
1810
+ })(p, i2, a, "https://survey-dev.magicfeedback.io/assets/emojis" + (c ? `/${u}` : ""), 1 === t3.length ? l : void 0);
1811
+ d.push(e4);
1575
1812
  }
1576
- })), u;
1577
- }, t2.renderActions = function(e3 = "", t3, i2 = "Submit", n2 = "Back", a2 = "Next") {
1813
+ })), d;
1814
+ }, t2.renderActions = function(e3 = "", t3, i2 = "Submit", n2 = "Back", r2 = "Next") {
1578
1815
  const s2 = document.createElement("div");
1579
1816
  s2.classList.add("magicfeedback-action-container");
1580
- const r2 = document.createElement("button");
1581
- r2.id = "magicfeedback-submit", r2.type = "submit", r2.classList.add("magicfeedback-submit"), r2.textContent = "MAGICSURVEY" === e3 ? a2 || "Next" : i2 || "Submit";
1582
- const o2 = document.createElement("button");
1583
- return o2.id = "magicfeedback-back", o2.type = "button", o2.classList.add("magicfeedback-back"), o2.textContent = n2 || "Back", o2.addEventListener("click", t3), o2.addEventListener("click", (() => {
1584
- r2.removeAttribute("disabled");
1585
- })), "MAGICSURVEY" === e3 && s2.appendChild(o2), s2.appendChild(r2), s2;
1817
+ const a = document.createElement("button");
1818
+ a.id = "magicfeedback-submit", a.type = "submit", a.classList.add("magicfeedback-submit"), a.textContent = "MAGICSURVEY" === e3 ? r2 || "Next" : i2 || "Submit";
1819
+ const o = document.createElement("button");
1820
+ return o.id = "magicfeedback-back", o.type = "button", o.classList.add("magicfeedback-back"), o.textContent = n2 || "Back", o.addEventListener("click", t3), o.addEventListener("click", (() => {
1821
+ a.removeAttribute("disabled");
1822
+ })), "MAGICSURVEY" === e3 && s2.appendChild(o), s2.appendChild(a), s2;
1586
1823
  }, t2.renderError = function(e3) {
1587
1824
  const t3 = document.createElement("div");
1588
1825
  return t3.classList.add("magicfeedback-error"), t3.textContent = e3, t3;
@@ -1591,20 +1828,20 @@ var require_magicfeedback_sdk_browser = __commonJS({
1591
1828
  return t3.classList.add("magicfeedback-success"), t3.textContent = e3, t3;
1592
1829
  }, t2.renderStartMessage = function(e3, t3 = false, i2 = "Go!", n2 = () => {
1593
1830
  }) {
1594
- const a2 = document.createElement("div");
1595
- a2.classList.add("magicfeedback-start-message-container");
1831
+ const r2 = document.createElement("div");
1832
+ r2.classList.add("magicfeedback-start-message-container");
1596
1833
  const s2 = document.createElement("div");
1597
- if (s2.classList.add("magicfeedback-start-message"), s2.innerHTML = e3, a2.appendChild(s2), t3) {
1834
+ if (s2.classList.add("magicfeedback-start-message"), s2.innerHTML = e3, r2.appendChild(s2), t3) {
1598
1835
  const e4 = document.createElement("button");
1599
- e4.id = "magicfeedback-start-message-button", e4.classList.add("magicfeedback-start-message-button"), e4.textContent = i2, e4.addEventListener("click", (() => n2())), a2.appendChild(e4);
1836
+ e4.id = "magicfeedback-start-message-button", e4.classList.add("magicfeedback-start-message-button"), e4.textContent = i2, e4.addEventListener("click", (() => n2())), r2.appendChild(e4);
1600
1837
  }
1601
- return a2;
1838
+ return r2;
1602
1839
  };
1603
1840
  }, 313: function(e2, t2, i) {
1604
1841
  "use strict";
1605
1842
  var n = this && this.__awaiter || function(e3, t3, i2, n2) {
1606
- return new (i2 || (i2 = Promise))((function(a2, s2) {
1607
- function r2(e4) {
1843
+ return new (i2 || (i2 = Promise))((function(r2, s2) {
1844
+ function a2(e4) {
1608
1845
  try {
1609
1846
  l2(n2.next(e4));
1610
1847
  } catch (e5) {
@@ -1620,26 +1857,26 @@ var require_magicfeedback_sdk_browser = __commonJS({
1620
1857
  }
1621
1858
  function l2(e4) {
1622
1859
  var t4;
1623
- e4.done ? a2(e4.value) : (t4 = e4.value, t4 instanceof i2 ? t4 : new i2((function(e5) {
1860
+ e4.done ? r2(e4.value) : (t4 = e4.value, t4 instanceof i2 ? t4 : new i2((function(e5) {
1624
1861
  e5(t4);
1625
- }))).then(r2, o2);
1862
+ }))).then(a2, o2);
1626
1863
  }
1627
1864
  l2((n2 = n2.apply(e3, t3 || [])).next());
1628
1865
  }));
1629
- }, a = this && this.__importDefault || function(e3) {
1866
+ }, r = this && this.__importDefault || function(e3) {
1630
1867
  return e3 && e3.__esModule ? e3 : { default: e3 };
1631
1868
  };
1632
1869
  Object.defineProperty(t2, "__esModule", { value: true }), t2.getFollowUpQuestion = t2.sendFeedback = t2.getQuestions = t2.getSessionForm = t2.getForm = t2.validateEmail = void 0;
1633
- const s = a(i(945)), r = a(i(330)), o = i(857), l = { Accept: "application/json", "Magicfeedback-Sdk-Version": r.default.version, "x-magicfeedback-parameters": window.location.search || "" };
1870
+ const s = r(i(945)), a = r(i(330)), o = i(857), l = { Accept: "application/json", "Magicfeedback-Sdk-Version": a.default.version, "x-magicfeedback-parameters": window.location.search || "" };
1634
1871
  t2.validateEmail = function(e3) {
1635
1872
  return /\S+@\S+\.\S+/.test(e3);
1636
- }, t2.getForm = function(e3, t3, i2, a2) {
1873
+ }, t2.getForm = function(e3, t3, i2, r2) {
1637
1874
  return n(this, void 0, void 0, (function* () {
1638
1875
  try {
1639
1876
  const n2 = yield (0, s.default)(e3 + o.endpoints.sdk.app_info(t3, i2), { method: "GET", headers: l });
1640
1877
  return yield n2.json();
1641
1878
  } catch (e4) {
1642
- a2.err(e4);
1879
+ r2.err(e4);
1643
1880
  }
1644
1881
  }));
1645
1882
  }, t2.getSessionForm = function(e3, t3, i2) {
@@ -1651,17 +1888,17 @@ var require_magicfeedback_sdk_browser = __commonJS({
1651
1888
  i2.err(e4);
1652
1889
  }
1653
1890
  }));
1654
- }, t2.getQuestions = function(e3, t3, i2, a2) {
1891
+ }, t2.getQuestions = function(e3, t3, i2, r2) {
1655
1892
  return n(this, void 0, void 0, (function* () {
1656
1893
  try {
1657
1894
  const n2 = yield (0, s.default)(e3 + o.endpoints.sdk.app(t3, i2), { method: "GET", headers: l });
1658
1895
  if (n2.ok) {
1659
1896
  const e4 = yield n2.json();
1660
- return a2.log(`Received questions for app ${t3}`, e4), e4;
1897
+ return r2.log(`Received questions for app ${t3}`, e4), e4;
1661
1898
  }
1662
- throw a2.err(`Failed to get questions for app ${t3}:`, n2.status, n2.statusText), new Error("[MagicFeedback] Bad response from server");
1899
+ throw r2.err(`Failed to get questions for app ${t3}:`, n2.status, n2.statusText), new Error("[MagicFeedback] Bad response from server");
1663
1900
  } catch (e4) {
1664
- return a2.err(e4), [];
1901
+ return r2.err(e4), [];
1665
1902
  }
1666
1903
  }));
1667
1904
  }, t2.sendFeedback = function(e3, t3, i2) {
@@ -1700,10 +1937,10 @@ var require_magicfeedback_sdk_browser = __commonJS({
1700
1937
  };
1701
1938
  }, 330: (e2) => {
1702
1939
  "use strict";
1703
- e2.exports = JSON.parse('{"name":"@magicfeedback/native","version":"2.1.4","main":"./dist/magicfeedback-sdk.node.js","browser":"./dist/magicfeedback-sdk.browser.js","types":"./dist/types/src/index.d.ts","repository":{"type":"git","url":"git+ssh://git@github.com/MagicFeedback/magicfeedback-sdk.git"},"author":"farias@magicfeedback.io","license":"MIT","private":false,"scripts":{"dev":"vite","build":"webpack","build:watch":"webpack --watch --mode development","publish":"npm publish --access public","publish:beta":"npm publish --access public --tag beta","publish:alpha":"npm publish --access public --tag alpha","test":"jest","test:watch":"jest --watchAll","coverage":"vitest run --coverage"},"files":["dist"],"devDependencies":{"@babel/preset-typescript":"^7.22.5","@types/node":"^17.0.21","@types/webpack":"^5.28.0","@types/webpack-node-externals":"^2.5.3","c8":"^7.11.0","copy-webpack-plugin":"^11.0.0","jest":"^29.5.0","jest-environment-jsdom":"^29.5.0","jest-fetch-mock":"^3.0.3","nock":"^13.2.4","ts-jest":"^29.1.0","ts-loader":"^9.2.7","ts-node":"^10.7.0","typescript":"^4.6.2","vite":"^2.8.0","vite-plugin-dts":"^0.9.9","vitest":"^0.5.9","webpack":"^5.70.0","webpack-cli":"^4.9.2","webpack-node-externals":"^3.0.0"},"dependencies":{"cross-fetch":"^3.1.5","is-bundling-for-browser-or-node":"^1.1.1"},"description":"MagicFeedbackAI JavaScript Library for [MagicFeedback.io](https://magicfeedback.io/)","bugs":{"url":"https://github.com/MagicFeedback/magicfeedback-sdk/issues"},"homepage":"https://github.com/MagicFeedback/magicfeedback-sdk#readme","directories":{"example":"examples","test":"test"},"style":"./dist/styles/magicfeedback-default.css"}');
1940
+ e2.exports = JSON.parse('{"name":"@magicfeedback/native","version":"2.2.1","main":"./dist/magicfeedback-sdk.node.js","browser":"./dist/magicfeedback-sdk.browser.js","types":"./dist/types/src/index.d.ts","repository":{"type":"git","url":"git+ssh://git@github.com/MagicFeedback/magicfeedback-sdk.git"},"author":"farias@magicfeedback.io","license":"MIT","private":false,"scripts":{"dev":"vite","build":"webpack","build:watch":"webpack --watch --mode development","release":"npm publish --access public","release:beta":"npm publish --access public --tag beta","release:alpha":"npm publish --access public --tag alpha","test":"jest","test:watch":"jest --watchAll","coverage":"vitest run --coverage","publish:sdk":"bash publish.sh","publish:sdk:dry-run":"NPM_DRY_RUN=1 bash publish.sh"},"files":["dist"],"devDependencies":{"@babel/preset-typescript":"^7.22.5","@types/node":"^17.0.21","@types/webpack":"^5.28.0","@types/webpack-node-externals":"^2.5.3","c8":"^7.11.0","copy-webpack-plugin":"^11.0.0","jest":"^29.5.0","jest-environment-jsdom":"^29.5.0","jest-fetch-mock":"^3.0.3","nock":"^13.2.4","ts-jest":"^29.1.0","ts-loader":"^9.2.7","ts-node":"^10.7.0","typescript":"^4.6.2","vite":"^2.8.0","vite-plugin-dts":"^0.9.9","vitest":"^0.5.9","webpack":"^5.70.0","webpack-cli":"^4.9.2","webpack-node-externals":"^3.0.0"},"dependencies":{"cross-fetch":"^3.1.5","is-bundling-for-browser-or-node":"^1.1.1"},"description":"MagicFeedbackAI JavaScript Library for [MagicFeedback.io](https://magicfeedback.io/)","bugs":{"url":"https://github.com/MagicFeedback/magicfeedback-sdk/issues"},"homepage":"https://github.com/MagicFeedback/magicfeedback-sdk#readme","directories":{"example":"examples","test":"test"},"style":"./dist/styles/magicfeedback-default.css"}');
1704
1941
  } }, t = {}, (function i(n) {
1705
- var a = t[n];
1706
- if (void 0 !== a) return a.exports;
1942
+ var r = t[n];
1943
+ if (void 0 !== r) return r.exports;
1707
1944
  var s = t[n] = { exports: {} };
1708
1945
  return e[n].call(s.exports, s, s.exports, i), s.exports;
1709
1946
  })(156).default;
@@ -1721,18 +1958,873 @@ var POPUP_TRIGGER_CONDITION_STATUSES = [
1721
1958
 
1722
1959
  // src/ui/renderPopup.ts
1723
1960
  var import_native = __toESM(require_magicfeedback_sdk_browser());
1724
- function ensureMagicFeedbackStyles(popup) {
1725
- const DATA_ATTR = "data-magicfeedback-css";
1726
- if (document.querySelector(`link[${DATA_ATTR}]`) || popup.querySelector(`link[${DATA_ATTR}]`)) {
1727
- return;
1728
- }
1729
- const link = document.createElement("link");
1730
- link.rel = "stylesheet";
1731
- link.href = "https://cdn.jsdelivr.net/npm/@magicfeedback/popup-sdk/dist/assets/assets/style.css";
1732
- link.setAttribute(DATA_ATTR, "true");
1733
- popup.appendChild(link);
1961
+
1962
+ // src/assets/style.css
1963
+ var style_default = `.magicfeedback-container {
1964
+ width: 100%;
1965
+ }
1966
+
1967
+
1968
+ .magicfeedback-success-message,
1969
+ .magicfeedback-info-message,
1970
+ .magicfeedback-start-message,
1971
+ .magicfeedback-container{
1972
+ animation-duration: 0.5s;
1973
+ animation-name: animate-fade;
1974
+ animation-delay: 0.25s;
1975
+ animation-fill-mode: backwards;
1976
+
1977
+ font-style: normal;
1978
+ text-align: justify;
1979
+ font-weight: 400;
1980
+ font-size: 1.2rem;
1981
+ color: #475569;
1982
+ line-height: 1.5;
1983
+ }
1984
+
1985
+ @keyframes animate-fade {
1986
+ 0% { opacity: 0; }
1987
+ 100% { opacity: 1; }
1988
+ }
1989
+
1990
+ .magicfeedback-form {
1991
+ display: flex;
1992
+ flex-direction: column;
1993
+ justify-content: flex-start;
1994
+ align-items: center;
1995
+ width: 100%;
1996
+ }
1997
+ .magicfeedback-questions {
1998
+ display: flex;
1999
+ flex-direction: column;
2000
+ justify-content: flex-start;
2001
+ align-items: flex-start;
2002
+ width: 100%;
2003
+ }
2004
+
2005
+ .magicfeedback-div {
2006
+ display: flex;
2007
+ flex-direction: column;
2008
+ justify-content: flex-start;
2009
+ align-items: flex-start;
2010
+ margin-bottom: 10px;
2011
+ width: 100%;
2012
+ }
2013
+
2014
+ .magicfeedback-label {
2015
+ margin-bottom: 25px;
2016
+ margin-top: 20px;
2017
+ font-weight: 400;
2018
+ font-family: inherit;
2019
+ font-size: 1.2rem;
2020
+ color: #212529;
2021
+ text-align: start;
2022
+ word-wrap: break-word;
2023
+ white-space: normal;
2024
+
2025
+ }
2026
+
2027
+ .magicfeedback-checkbox {
2028
+ display: flex;
2029
+ flex-direction: column;
2030
+ flex-wrap: wrap;
2031
+ width: 100%;
2032
+ }
2033
+
2034
+ .magicfeedback-checkbox-container {
2035
+ display: flex;
2036
+ flex-direction: row;
2037
+ justify-content: flex-start;
2038
+ align-items: center;
2039
+ margin-bottom: 5px;
2040
+ margin-top: 5px;
2041
+ }
2042
+
2043
+ .magicfeedback-radio {
2044
+ display: flex;
2045
+ flex-direction: column;
2046
+ justify-content: flex-start;
2047
+ flex-wrap: wrap;
2048
+ width: 100%;
2049
+ margin-right: 5px;
2050
+ padding: 5px;
2051
+ }
2052
+
2053
+ .magicfeedback-checkbox-container,
2054
+ .magicfeedback-radio-container {
2055
+ display: flex;
2056
+ flex-direction: row;
2057
+ justify-content: flex-start;
2058
+ align-items: center;
2059
+ margin: 5px;
2060
+ padding: 5px 0;
2061
+ background-color: #fff;
2062
+ border-radius: 5px;
2063
+ box-shadow: 0 0 3px #ccc;
2064
+ }
2065
+
2066
+ input::-webkit-outer-spin-button,
2067
+ input::-webkit-inner-spin-button {
2068
+ -webkit-appearance: none;
2069
+ -moz-appearance: textfield;
2070
+ }
2071
+
2072
+ .magicfeedback-checkbox input[type="checkbox"] {
2073
+ margin-right: 5px;
2074
+ margin-left: 5px;
2075
+ width: 20px;
2076
+ height: 20px;
2077
+ cursor: pointer;
2078
+ }
2079
+
2080
+
2081
+ .magicfeedback-checkbox label,
2082
+ .magicfeedback-radio-container label {
2083
+ margin-left: 5px;
2084
+ font-weight: 400;
2085
+ font-family: inherit;
2086
+ font-size: 16px;
2087
+ color: #212529;
2088
+ text-align: start;
2089
+ width: 100%;
2090
+ }
2091
+
2092
+ p {
2093
+ margin-bottom: 0px;
2094
+ font-size: 12px;
2095
+ }
2096
+
2097
+ h2 {
2098
+ line-height: 1.66;
2099
+ margin: 0;
2100
+ padding: 0;
2101
+ font-weight: 900;
2102
+ color: #222;
2103
+ font-family: 'Montserrat';
2104
+ font-size: 18px;
2105
+ text-transform: uppercase;
2106
+ text-align: center;
2107
+ margin-bottom: 40px;
2108
+ }
2109
+
2110
+ h6 {
2111
+ margin-bottom: 1rem;
2112
+ }
2113
+
2114
+ input[type="date"],
2115
+ input[type="text"],
2116
+ input[type="number"],
2117
+ input[type="email"],
2118
+ input[type="password"],
2119
+ textarea,
2120
+ select {
2121
+ box-sizing: border-box;
2122
+ padding: 10px;
2123
+ margin: 10px 0;
2124
+ width: 100%;
2125
+ border: 2px solid #ccc; /* Default border color - you can customize this */
2126
+ border-radius: 5px;
2127
+ font-size: 18px;
2128
+ outline: none;
2129
+ transition: border-color 0.3s ease;
2130
+ min-height: 50px;
2131
+ font-family: inherit;
2132
+ -webkit-appearance: none;
2133
+ }
2134
+
2135
+ select {
2136
+ background-image: linear-gradient(45deg, transparent 50%, gray 50%),
2137
+ linear-gradient(135deg, gray 50%, transparent 50%),
2138
+ linear-gradient(to right, #ccc, #ccc);
2139
+ background-position: calc(100% - 20px) calc(1em + 2px),
2140
+ calc(100% - 15px) calc(1em + 2px),
2141
+ calc(100% - 2.5em) 0.5em;
2142
+ background-size: 5px 5px,
2143
+ 5px 5px,
2144
+ 1px 1.5em;
2145
+ background-repeat: no-repeat;
2146
+ }
2147
+
2148
+ .magicfeedback-boolean-container {
2149
+ display: flex;
2150
+ flex-direction: row;
2151
+ justify-content: flex-start;
2152
+ align-items: center;
2153
+ margin: 10px 0;
2154
+ width: 100%;
2155
+ }
2156
+
2157
+ .magicfeedback-boolean-container label {
2158
+ margin-left: 10px;
2159
+ font-weight: 400;
2160
+ font-size: 16px;
2161
+ width: 100%;
2162
+ padding-top: 5px;
2163
+ }
2164
+
2165
+ .magicfeedback-boolean-option {
2166
+ margin-right: 10px;
2167
+ margin-left: 10px;
2168
+ width: 100%;
2169
+ height: 38px;
2170
+ border-radius: 8px;
2171
+ font-size: 16px;
2172
+ cursor: pointer;
2173
+ border: 1px solid #ced4da !important;
2174
+ }
2175
+
2176
+ .magicfeedback-boolean-option label {
2177
+ font-weight: 400;
2178
+ font-size: 16px;
2179
+ color: #475569;
2180
+ cursor: pointer;
2181
+ width: 100%;
2182
+ height: 100%;
2183
+ display: flex;
2184
+ justify-content: center;
2185
+ align-items: center;
2186
+ border-radius: inherit;
1734
2187
  }
1735
- function ensureSpinnerStyles(popup) {
2188
+
2189
+ .magicfeedback-boolean-option input[type=radio] + label:hover {
2190
+ color: #007bff;
2191
+ }
2192
+
2193
+ .magicfeedback-boolean-option input[type=radio]:checked + label {
2194
+ color: #007bff;
2195
+ background-color: #cadff8;
2196
+ }
2197
+
2198
+ input[type="radio"] {
2199
+ padding: 20px;
2200
+ margin: 10px 0 10px 15px;
2201
+ width: 40px;
2202
+ background-color: #fff;
2203
+ box-shadow: none;
2204
+ }
2205
+
2206
+ /* Style for focused input/select */
2207
+ input:focus, select:focus {
2208
+ border-color: #4CAF50; /* Highlight color when focused - you can customize this */
2209
+ }
2210
+
2211
+ /* Style for invalid input (example: validation error) */
2212
+ input.error, select.error {
2213
+ border-color: #ff3333; /* Red color for error state - you can customize this */
2214
+ }
2215
+
2216
+ .magicfeedback-action-container {
2217
+ display: flex;
2218
+ flex-direction: row;
2219
+ justify-content: space-between;
2220
+ align-items: center;
2221
+ margin-top: 10px;
2222
+ width: 100%;
2223
+ }
2224
+
2225
+ .magicfeedback-action-container .magicfeedback-submit {
2226
+ cursor: pointer;
2227
+ padding: 10px;
2228
+ margin: 10px 0;
2229
+ width: 100px;
2230
+ border-radius: 8px;
2231
+ font-size: 16px;
2232
+ outline: none;
2233
+ transition: border-color 0.3s ease;
2234
+ background-color: #1E293B;
2235
+ color: white;
2236
+ }
2237
+
2238
+ .magicfeedback-action-container .magicfeedback-back {
2239
+ cursor: pointer;
2240
+ padding: 10px;
2241
+ margin: 10px 0;
2242
+ width: 100px;
2243
+ border: 0;
2244
+ border-radius: 8px;
2245
+ font-size: 16px;
2246
+ outline: none;
2247
+ transition: border-color 0.3s ease;
2248
+ background-color: transparent;
2249
+ color: #212529;
2250
+ }
2251
+
2252
+
2253
+
2254
+ /* Rating styles */
2255
+ .magicfeedback-rating {
2256
+ width: 100%;
2257
+ }
2258
+
2259
+ .magicfeedback-rating-container {
2260
+ display: flex;
2261
+ flex-direction: row;
2262
+ justify-content: space-around;
2263
+ flex-wrap: wrap;
2264
+ align-items: center;
2265
+
2266
+ margin: 15px 5px;
2267
+ padding: 0;
2268
+
2269
+ list-style: none;
2270
+ font-size: 1.5rem;
2271
+ cursor: pointer;
2272
+ user-select: none;
2273
+ -webkit-user-select: none;
2274
+ -moz-user-select: none;
2275
+ -ms-user-select: none;
2276
+ }
2277
+
2278
+ .magicfeedback-rating-placeholder-value,
2279
+ .magicfeedback-rating-placeholder{
2280
+ text-align: center;
2281
+ align-content: center;
2282
+ justify-content: center;
2283
+ text-wrap: wrap;
2284
+ }
2285
+
2286
+ .magicfeedback-rating-option {
2287
+ margin: 0 0.5rem;
2288
+ padding: 0;
2289
+ }
2290
+
2291
+ @media (max-width: 1024px) {
2292
+ .magicfeedback-rating-option {
2293
+ margin: 10px 0;
2294
+ padding: 0;
2295
+ width: 20%;
2296
+ display: flex;
2297
+ justify-content: center;
2298
+ }
2299
+
2300
+ .magicfeedback-rating-placeholder-value {
2301
+ font-size: 0.75rem;
2302
+ margin-bottom: 1px;
2303
+ }
2304
+ .magicfeedback-rating-placeholder{
2305
+ justify-content: center;
2306
+ }
2307
+
2308
+ .magicfeedback-rating-container {
2309
+ flex-wrap: wrap;
2310
+ justify-content: flex-start;
2311
+ }
2312
+ }
2313
+
2314
+
2315
+ .magicfeedback-rating-option-label-container {
2316
+ display: flex;
2317
+ flex-direction: column;
2318
+ }
2319
+
2320
+
2321
+ .magicfeedback-rating-option-label-container label {
2322
+ display: inline-block;
2323
+ text-align: center;
2324
+ margin-bottom: 0;
2325
+ font-weight: 600;
2326
+ font-size: 18px;
2327
+ color: #475569;
2328
+ }
2329
+
2330
+ .magicfeedback-rating-option-label-container input[type=radio] {
2331
+ position: absolute;
2332
+ opacity: 0;
2333
+ width: 0;
2334
+ height: 0;
2335
+ }
2336
+
2337
+ /* IMAGE STYLES */
2338
+ .magicfeedback-rating-option-label-container input[type=radio] + img {
2339
+ cursor: pointer;
2340
+ height: 48px;
2341
+ width: 48px;
2342
+ }
2343
+
2344
+ /* LABEL STYLES */
2345
+ .magicfeedback-rating-option-label-container input[type=radio] + label {
2346
+ cursor: pointer;
2347
+ }
2348
+
2349
+ /* CHECKED STYLES */
2350
+ .magicfeedback-rating-option-label-container input[type=radio]:checked + img {
2351
+ box-shadow: #007bff 0px 1px 4px, #007BFFA0 0px 0px 0px 2px;
2352
+ border-radius: 50%;
2353
+ }
2354
+
2355
+ .magicfeedback-rating-number {
2356
+ width: 100%;
2357
+ }
2358
+ .magicfeedback-rating-container,
2359
+ .magicfeedback-rating-number-container {
2360
+ display: flex;
2361
+ flex-direction: row;
2362
+ justify-content: space-between;
2363
+ align-items: center;
2364
+
2365
+ margin: 15px 0;
2366
+ padding: 0;
2367
+
2368
+ list-style: none;
2369
+ font-size: 1.5rem;
2370
+ cursor: pointer;
2371
+ user-select: none;
2372
+ -webkit-user-select: none;
2373
+ -moz-user-select: none;
2374
+ -ms-user-select: none;
2375
+ }
2376
+
2377
+ /* Cuando hay placeholders (Very bad / Very good), el placeholder ocupa
2378
+ el 100% de la primera l\xEDnea y los boxes bajan a la siguiente */
2379
+ .magicfeedback-rating-number-container--with-placeholder {
2380
+ flex-wrap: wrap;
2381
+ align-items: flex-start;
2382
+ }
2383
+
2384
+ .magicfeedback-rating-number-container--with-placeholder .magicfeedback-rating-placeholder {
2385
+ width: 100%;
2386
+ margin-bottom: 8px;
2387
+ }
2388
+
2389
+ .magicfeedback-rating-number-container--with-placeholder .magicfeedback-rating-number-option {
2390
+ width: auto;
2391
+ flex: 1;
2392
+ }
2393
+
2394
+ .magicfeedback-rating-number-option {
2395
+ display: flex;
2396
+ flex-direction: row;
2397
+ justify-content: flex-start;
2398
+ align-items: center;
2399
+ margin: 5px;
2400
+ padding: 0;
2401
+ list-style: none;
2402
+ font-size: 1.5rem;
2403
+ cursor: pointer;
2404
+ user-select: none;
2405
+ -webkit-user-select: none;
2406
+ -moz-user-select: none;
2407
+ -ms-user-select: none;
2408
+ width: 100%;
2409
+ }
2410
+
2411
+ .magicfeedback-rating-number-option-row{
2412
+ max-width: 100% !important;
2413
+ }
2414
+
2415
+ .magicfeedback-rating-number-top-placeholder,
2416
+ .magicfeedback-rating-number-bottom-placeholder{
2417
+ text-align: center !important;
2418
+ align-content: center;
2419
+ justify-content: center;
2420
+ text-wrap: wrap;
2421
+
2422
+ font-size: 15px;
2423
+ color: #475569;
2424
+
2425
+ width: 100%;
2426
+ margin: auto;
2427
+ }
2428
+
2429
+ @media (min-width: 650px) {
2430
+ .magicfeedback-rating-number-option-row +.magicfeedback-rating-number-container-ltr:first-child,
2431
+ .magicfeedback-rating-number-option-row + +.magicfeedback-rating-number-container-rtl:last-child {
2432
+ margin-left: 0;
2433
+ width: calc(100% - 10px);
2434
+ }
2435
+
2436
+ .magicfeedback-rating-number-option-row +.magicfeedback-rating-number-container-rtl:first-child,
2437
+ .magicfeedback-rating-number-option-row + +.magicfeedback-rating-number-container-ltr:last-child {
2438
+ margin-right: 0;
2439
+ width: calc(100% - 10px);
2440
+ }
2441
+ }
2442
+
2443
+
2444
+ .magicfeedback-rating-number-option-label-container {
2445
+ display: flex;
2446
+ flex-direction: column;
2447
+ align-items: center;
2448
+ justify-content: center;
2449
+ width: 100%;
2450
+ height: 100%;
2451
+ }
2452
+
2453
+ .magicfeedback-rating-number-option-label-container label {
2454
+ display: flex;
2455
+ align-items: center;
2456
+ justify-content: center;
2457
+ white-space: nowrap;
2458
+ overflow: hidden;
2459
+ text-overflow: ellipsis;
2460
+ margin: 0 10px;
2461
+ font-weight: 600;
2462
+ font-size: 14px;
2463
+ color: #475569;
2464
+ cursor: pointer;
2465
+ width: 100%;
2466
+ height: 100%;
2467
+ min-height: 50px;
2468
+ text-align: center;
2469
+ padding: 0;
2470
+ border-radius: 4px;
2471
+ border: 1px solid #ced4da;
2472
+ background-color: rgba(246, 246, 246, 0.3);
2473
+ transition: background-color 0.15s ease-in-out;
2474
+ }
2475
+
2476
+ .magicfeedback-rating-number-option-label-container input[type=radio] {
2477
+ position: absolute;
2478
+ opacity: 0;
2479
+ width: 0;
2480
+ height: 0;
2481
+ }
2482
+
2483
+ .magicfeedback-rating-number-option-label-container input[type=radio] + label {
2484
+ cursor: pointer;
2485
+ }
2486
+
2487
+ .magicfeedback-rating-number-option-label-container input[type=radio] + label:hover,
2488
+ .magicfeedback-rating-number-option-label-container input[type=radio]:checked + label {
2489
+ color: #007bff;
2490
+ border: 1px solid #007bff;
2491
+ background-color: rgba(86, 168, 253, 0.29);
2492
+ }
2493
+
2494
+ .magicfeedback-rating-number-container-column{
2495
+ align-items: flex-start !important;
2496
+ }
2497
+
2498
+ @media (max-width: 650px) {
2499
+ .magicfeedback-rating-number-container-ltr {
2500
+ justify-content: center;
2501
+ flex-wrap: wrap;
2502
+ }
2503
+
2504
+ .magicfeedback-rating-number-container-rtl {
2505
+ justify-content: center;
2506
+ flex-wrap: wrap-reverse;
2507
+ }
2508
+
2509
+ .magicfeedback-rating-number-option {
2510
+ max-width: 100%;
2511
+ height: 55px;
2512
+ margin: 5px 0;
2513
+ }
2514
+ }
2515
+
2516
+ .magicfeedback-rating-star {
2517
+ width: 100%;
2518
+ }
2519
+
2520
+ .magicfeedback-rating-star-container {
2521
+ display: flex !important;
2522
+ flex-direction: row !important;
2523
+ justify-content: center !important;
2524
+ align-items: center !important;
2525
+ flex-wrap: wrap;
2526
+ margin: 15px 5px;
2527
+ padding: 0;
2528
+ list-style: none;
2529
+ font-size: 1.5rem;
2530
+ cursor: pointer;
2531
+ user-select: none;
2532
+ -webkit-user-select: none;
2533
+ -moz-user-select: none;
2534
+ -ms-user-select: none;
2535
+ }
2536
+
2537
+ .magicfeedback-rating-star-option:not(:checked) > .rating__star {
2538
+ float: right;
2539
+ width: 1em;
2540
+ overflow: hidden;
2541
+ white-space: nowrap;
2542
+ cursor: pointer;
2543
+ font-size: 30px;
2544
+ color: #ccc;
2545
+ margin: 0 10px;
2546
+ }
2547
+
2548
+ .magicfeedback-rating-star-option:not(:checked) > .rating__star:hover,
2549
+ .magicfeedback-rating-star-option:not(:checked) > .rating__star:hover ~ span {
2550
+ color: #deb217 !important;
2551
+ }
2552
+
2553
+ .magicfeedback-rating-star-selected {
2554
+ color: #ffc700 !important;
2555
+ }
2556
+
2557
+
2558
+ /* Style for multiple choice image */
2559
+ .magicfeedback-image-option-label-container:hover {
2560
+ cursor: pointer;
2561
+ border: 0 !important;
2562
+ }
2563
+
2564
+ .magicfeedback-image-option-label-container input[type=radio]:checked + img,
2565
+ .magicfeedback-image-option-label-container input[type=checkbox]:checked + img {
2566
+ border: 1px solid #007bff !important;
2567
+ box-shadow: 0 0 3px #007bff !important;
2568
+ }
2569
+
2570
+ .magicfeedback-image-option-label-container input[type=radio] + img,
2571
+ .magicfeedback-image-option-label-container input[type=checkbox] + img {
2572
+ border: 1px solid transparent !important;
2573
+ }
2574
+
2575
+ .magicfeedback-image-option-label-container{
2576
+ margin: 10px !important;
2577
+ height: calc(100% - 20px) !important;
2578
+ width: calc(100% - 20px) !important;
2579
+ }
2580
+
2581
+ .magicfeedback-multiple-choice-image-option {
2582
+ display: flex;
2583
+ height: auto !important;
2584
+ box-shadow: 0 0 3px #ccc;
2585
+ }
2586
+
2587
+ .magicfeedback-multiple-choice-image-label {
2588
+ font-size: 1rem;
2589
+ }
2590
+
2591
+ .magicfeedback-consent-container {
2592
+ display: flex;
2593
+ flex-direction: row;
2594
+ justify-content: flex-start;
2595
+ align-items: center;
2596
+ margin: 10px 0;
2597
+ width: 100%;
2598
+ }
2599
+
2600
+ .magicfeedback-consent-container label {
2601
+ margin-left: 10px;
2602
+ }
2603
+
2604
+ .magicfeedback-start-message-container {
2605
+ /* ... add your start message container styles here ... */
2606
+ }
2607
+
2608
+ .magicfeedback-success-message,
2609
+ .magicfeedback-info-message,
2610
+ .magicfeedback-start-message {
2611
+ margin: 35px 5px;
2612
+ }
2613
+
2614
+ .magicfeedback-success-message p,
2615
+ .magicfeedback-info-message p,
2616
+ .magicfeedback-start-message p {
2617
+ font-style: normal;
2618
+ text-align: start;
2619
+ font-weight: 400;
2620
+ font-size: 16px;
2621
+ color: #475569;
2622
+ line-height: 1.5;
2623
+ }
2624
+
2625
+ .magicfeedback-success-message img,
2626
+ .magicfeedback-info-message img,
2627
+ .magicfeedback-start-message img {
2628
+ width: 400px;
2629
+ max-width: 80%;
2630
+ height: auto;
2631
+ margin: 10px auto;
2632
+ }
2633
+
2634
+ .magicfeedback-counter,
2635
+ .magicfeedback-point-system-total {
2636
+ margin: 10px 0 0 0 !important;
2637
+ display: flex !important;
2638
+ justify-content: right !important;
2639
+ align-items: center !important;
2640
+ width: 100%;
2641
+ }
2642
+
2643
+ .magicfeedback-skip-container {
2644
+ background-color: transparent !important;
2645
+ border: 0 !important;
2646
+ color: #999999FF !important;
2647
+ padding: 0 !important;
2648
+ margin: 0 !important;
2649
+ cursor: pointer !important;
2650
+ font-size: 0.5em !important;
2651
+ font-weight: 400 !important;
2652
+ box-shadow: 0 0 0 !important;
2653
+
2654
+ &:hover {
2655
+ color: #0066ff;
2656
+ }
2657
+ }
2658
+
2659
+ .magicfeedback-skip-container input[type=checkbox] {
2660
+ border-color: #999999FF !important;
2661
+ border: 0 !important;
2662
+ cursor: pointer !important;
2663
+
2664
+ }
2665
+
2666
+ .magicfeedback-multi-question-matrix,
2667
+ .magicfeedback-point-system,
2668
+ .magicfeedback-priority-list {
2669
+ width: 100% !important;
2670
+ }
2671
+
2672
+ .magicfeedback-multi-question-matrix-container,
2673
+ .magicfeedback-point-system-container,
2674
+ .magicfeedback-priority-list-container {
2675
+ width: 100% !important;
2676
+ overflow-x: auto;
2677
+ }
2678
+
2679
+ .magicfeedback-point-system-list,
2680
+ .magicfeedback-priority-list-list,
2681
+ .magicfeedback-multi-question-matrix-table {
2682
+ width: 100% !important;
2683
+ padding: 0 !important;
2684
+ overflow-x: auto;
2685
+ }
2686
+
2687
+ .magicfeedback-multi-question-matrix {
2688
+ position: relative !important;
2689
+ }
2690
+
2691
+ .magicfeedback-multi-question-matrix-container {
2692
+ overflow: auto !important;
2693
+ padding-bottom: 10px;
2694
+ }
2695
+
2696
+ .magicfeedback-multi-question-matrix-label{
2697
+ text-align: left !important;
2698
+ }
2699
+ .magicfeedback-priority-list-item {
2700
+ display: flex;
2701
+ flex-direction: row;
2702
+ justify-content: space-between;
2703
+ align-items: center;
2704
+ padding: 10px 0 10px 10px;
2705
+
2706
+ border: 1px solid #ced4da;
2707
+ border-radius: 5px;
2708
+ margin: 10px 0 !important;
2709
+ }
2710
+
2711
+ .magicfeedback-point-system-item {
2712
+ height: 45px;
2713
+ margin: 5px 0 !important;
2714
+ }
2715
+
2716
+ .magicfeedback-point-system-item label,
2717
+ .magicfeedback-priority-list-item-label {
2718
+ font-family: inherit;
2719
+ font-size: 18px !important;
2720
+ color: #212529;
2721
+ text-align: start;
2722
+ word-wrap: break-word;
2723
+ white-space: normal;
2724
+ padding: 0 10px 0 0;
2725
+ }
2726
+
2727
+ .magicfeedback-point-system-input-container {
2728
+ padding: 0 10px 0 0;
2729
+ border-radius: 5px;
2730
+ font-size: 14px;
2731
+ border: 1px solid #ced4da;
2732
+ height: 42px;
2733
+ margin: auto 0;
2734
+ }
2735
+
2736
+ .magicfeedback-multi-question-matrix-table thead {
2737
+ margin-bottom: 20px;
2738
+ }
2739
+
2740
+ .magicfeedback-multi-question-matrix-table th{
2741
+ text-align: center;
2742
+ font-weight: 400 !important;
2743
+ font-size: 1rem !important;
2744
+ padding: 0 10px !important;
2745
+ }
2746
+
2747
+ .magicfeedback-multi-question-matrix-table th,
2748
+ .magicfeedback-multi-question-matrix-table td label,
2749
+ .magicfeedback-priority-list-arrow-up,
2750
+ .magicfeedback-priority-list-arrow-down {
2751
+ font-style: normal !important;
2752
+ font-weight: 400 !important;
2753
+ font-size: 1rem !important;
2754
+ color: #475569 !important;
2755
+ cursor: pointer !important;
2756
+ margin: 0 !important;
2757
+ line-height: inherit;
2758
+ }
2759
+
2760
+ .magicfeedback-multi-question-matrix-table tr {
2761
+ align-items: center;
2762
+ margin: 5px 0;
2763
+ }
2764
+
2765
+ .magicfeedback-multi-question-matrix-row-tr{
2766
+ border-radius: 5px;
2767
+ margin: 10px 0 !important;
2768
+ }
2769
+
2770
+ .magicfeedback-multi-question-matrix-row-tr:nth-child(odd) {
2771
+ background-color: #f1f6f6; /* Light gray background for odd rows */
2772
+ }
2773
+
2774
+ .magicfeedback-multi-question-matrix-row-tr:nth-child(even) {
2775
+ background-color: #ffffff; /* White background for even rows */
2776
+ }
2777
+
2778
+ .magicfeedback-multi-question-matrix-row-label {
2779
+ text-align: left !important;
2780
+ }
2781
+
2782
+ .magicfeedback-point-system-item span {
2783
+ color: #475569 !important;
2784
+ }
2785
+
2786
+ .magicfeedback-point-system-item input {
2787
+ padding: 0;
2788
+ margin: 0 !important;
2789
+ width: auto !important;
2790
+ min-width: 100px !important;
2791
+ height: auto !important;
2792
+ min-height: 42px;
2793
+ cursor: pointer;
2794
+ font-size: 14px;
2795
+ text-align: center !important;
2796
+ }
2797
+
2798
+ .magicfeedback-multi-question-matrix-table input {
2799
+ margin: auto !important;
2800
+ padding: 20px !important;
2801
+ width: 100% !important;
2802
+ height: 15px;
2803
+ border: 1px solid #ced4da;
2804
+ cursor: pointer;
2805
+ }
2806
+
2807
+ .magicfeedback-image{
2808
+ max-height: 400px !important;
2809
+ height: auto !important;
2810
+ max-width: 100% !important;
2811
+ margin: 10px auto !important;
2812
+ }
2813
+
2814
+ .magicfeedback-error{
2815
+ margin-top: 5px;
2816
+ }`;
2817
+
2818
+ // src/ui/renderPopup.ts
2819
+ function ensureMagicFeedbackStyles(_popup) {
2820
+ const STYLE_ID = "magicfeedback-sdk-styles";
2821
+ if (document.getElementById(STYLE_ID)) return;
2822
+ const style = document.createElement("style");
2823
+ style.id = STYLE_ID;
2824
+ style.textContent = style_default;
2825
+ document.head.appendChild(style);
2826
+ }
2827
+ function ensureSpinnerStyles(_popup) {
1736
2828
  if (document.getElementById("deepdots-spinner-styles")) return;
1737
2829
  const style = document.createElement("style");
1738
2830
  style.id = "deepdots-spinner-styles";
@@ -1741,9 +2833,9 @@ function ensureSpinnerStyles(popup) {
1741
2833
  .mf-spinner { display:flex; justify-content:center; align-items:center; padding:8px 0; }
1742
2834
  .mf-spinner-circle { width:28px; height:28px; border:3px solid #e0e6ed; border-top-color:#1E293B; border-radius:50%; animation: ddspin 0.9s linear infinite; }
1743
2835
  `;
1744
- popup.appendChild(style);
2836
+ document.head.appendChild(style);
1745
2837
  }
1746
- function ensureResponsiveStyles(popup) {
2838
+ function ensureResponsiveStyles(_popup) {
1747
2839
  if (document.getElementById("deepdots-responsive-styles")) return;
1748
2840
  const style = document.createElement("style");
1749
2841
  style.id = "deepdots-responsive-styles";
@@ -1751,11 +2843,11 @@ function ensureResponsiveStyles(popup) {
1751
2843
  /* Responsive adjustments */
1752
2844
  @media (max-width: 640px) {
1753
2845
  .deepdots-popup {
1754
- width: 100% !important;
1755
- max-width: 100% !important;
1756
- height: 90vh !important;
1757
- max-height: 100vh !important;
1758
- border-radius: 0 !important;
2846
+ width: calc(100% - 24px) !important;
2847
+ max-width: calc(100% - 24px) !important;
2848
+ height: auto !important;
2849
+ max-height: 90vh !important;
2850
+ border-radius: 12px !important;
1759
2851
  padding: calc(16px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom)) 16px !important;
1760
2852
  box-sizing: border-box;
1761
2853
  }
@@ -1779,9 +2871,9 @@ function ensureResponsiveStyles(popup) {
1779
2871
  }
1780
2872
  }
1781
2873
  `;
1782
- popup.appendChild(style);
2874
+ document.head.appendChild(style);
1783
2875
  }
1784
- async function renderPopup(container, surveyId, productId, actions, emit, onClose, env = "production") {
2876
+ async function renderPopup(container, surveyId, productId, actions, emit, onClose, env = "production", userId) {
1785
2877
  let surveyCompletedEmitted = false;
1786
2878
  let stylesInjected = false;
1787
2879
  const popup = document.createElement("div");
@@ -2065,8 +3157,14 @@ async function renderPopup(container, surveyId, productId, actions, emit, onClos
2065
3157
  setLoading(false);
2066
3158
  return;
2067
3159
  }
2068
- import_native.default.init({ debug: true, env: env === "production" ? "prod" : "dev" });
2069
- formInstance = import_native.default.form(surveyId, productId);
3160
+ import_native.default.init(
3161
+ {
3162
+ debug: true,
3163
+ env: env === "production" ? "prod" : "dev"
3164
+ }
3165
+ );
3166
+ const profile = userId ? [{ key: "external-user-id", value: [userId] }] : [];
3167
+ formInstance = import_native.default.form(surveyId, productId, profile, profile);
2070
3168
  const generateOptions = {
2071
3169
  addButton: false,
2072
3170
  getMetaData: true
@@ -2096,7 +3194,8 @@ async function renderPopup(container, surveyId, productId, actions, emit, onClos
2096
3194
  closeButton.style.color = "#fff";
2097
3195
  }
2098
3196
  if (s.buttonSecondaryColor) {
2099
- backButton.style.color = "#fff";
3197
+ backButton.style.background = "#fff";
3198
+ backButton.style.color = s.buttonSecondaryColor;
2100
3199
  backButton.style.border = `1px solid ${s.buttonSecondaryColor}`;
2101
3200
  }
2102
3201
  if (s.logo) {
@@ -2436,6 +3535,7 @@ var NoopPopupRenderer = class {
2436
3535
  var BrowserPopupRenderer = class {
2437
3536
  constructor() {
2438
3537
  this.container = null;
3538
+ this.visible = false;
2439
3539
  }
2440
3540
  init() {
2441
3541
  if (typeof document === "undefined") return;
@@ -2454,15 +3554,20 @@ var BrowserPopupRenderer = class {
2454
3554
  justify-content: center;
2455
3555
  align-items: center;
2456
3556
  `;
3557
+ }
3558
+ if (!document.body.contains(this.container)) {
2457
3559
  document.body.appendChild(this.container);
2458
3560
  }
2459
3561
  }
2460
- show(surveyId, productId, actions, emit, onClose, env = "production") {
2461
- if (!this.container) this.init();
3562
+ show(surveyId, productId, actions, emit, onClose, env = "production", userId) {
3563
+ if (this.visible) return;
3564
+ if (!this.container || !document.body.contains(this.container)) this.init();
2462
3565
  if (!this.container) return;
2463
- renderPopup(this.container, surveyId, productId, actions, emit, onClose, env);
3566
+ this.visible = true;
3567
+ renderPopup(this.container, surveyId, productId, actions, emit, onClose, env, userId);
2464
3568
  }
2465
3569
  hide() {
3570
+ this.visible = false;
2466
3571
  if (this.container) {
2467
3572
  this.container.style.display = "none";
2468
3573
  this.container.innerHTML = "";
@@ -2661,6 +3766,9 @@ var DeepdotsPopups = class {
2661
3766
  if (!skipPathCheck && !this.matchesSegmentsPath(def, pathUrl)) {
2662
3767
  return false;
2663
3768
  }
3769
+ if (!this.matchesSegmentsLang(def)) {
3770
+ return false;
3771
+ }
2664
3772
  const cooldowns = def.cooldown || [];
2665
3773
  if (cooldowns.length && !cooldowns.every((cooldown) => this.evaluateCooldown(def, cooldown))) {
2666
3774
  return false;
@@ -2669,6 +3777,20 @@ var DeepdotsPopups = class {
2669
3777
  if (!legacyConditions.length) return true;
2670
3778
  return legacyConditions.every((condition) => this.evaluateLegacyCondition(def, condition));
2671
3779
  }
3780
+ matchesSegmentsLang(def) {
3781
+ const langs = def.segments?.lang;
3782
+ if (!langs || langs.length === 0) return true;
3783
+ const browserLang = (typeof navigator !== "undefined" ? navigator.language : "").toLowerCase();
3784
+ if (!browserLang) {
3785
+ this.debug("No navigator.language available for lang comparison", { popupId: def.id, langs });
3786
+ return true;
3787
+ }
3788
+ const matches = langs.some((lang) => browserLang.startsWith(lang.toLowerCase()));
3789
+ if (!matches) {
3790
+ this.debug("Lang mismatch for popup", { popupId: def.id, langs, browserLang });
3791
+ }
3792
+ return matches;
3793
+ }
2672
3794
  matchesSegmentsPath(def, pathUrl) {
2673
3795
  const paths = def.segments?.path;
2674
3796
  if (!paths || paths.length === 0) return true;
@@ -2945,6 +4067,7 @@ var DeepdotsPopups = class {
2945
4067
  }
2946
4068
  /** Render the popup UI */
2947
4069
  renderPopup(surveyId, productId, actions) {
4070
+ const userId = this.config?.userId;
2948
4071
  if (this.renderer) {
2949
4072
  this.renderer.show(
2950
4073
  surveyId,
@@ -2952,7 +4075,8 @@ var DeepdotsPopups = class {
2952
4075
  actions,
2953
4076
  (type, id, payload) => this.emitEvent(type, id, payload),
2954
4077
  () => this.hidePopup(),
2955
- this.env
4078
+ this.env,
4079
+ userId
2956
4080
  );
2957
4081
  return;
2958
4082
  }
@@ -2964,7 +4088,8 @@ var DeepdotsPopups = class {
2964
4088
  actions,
2965
4089
  (type, id, payload) => this.emitEvent(type, id, payload),
2966
4090
  () => this.hidePopup(),
2967
- this.env
4091
+ this.env,
4092
+ userId
2968
4093
  );
2969
4094
  }
2970
4095
  /** Hide the popup */
@@ -2993,7 +4118,7 @@ var DeepdotsPopups = class {
2993
4118
  const popupId = popupIdFromData || this.surveyToPopupId.get(surveyId);
2994
4119
  if (popupId) {
2995
4120
  const userIdFromData = data?.userId;
2996
- void this.postPopupEvent(type === "popup_shown" ? "opened" : "completed", popupId, userIdFromData || this.config?.userId);
4121
+ void this.postPopupEvent(type === "popup_shown" ? "SHOWED" /* SHOWED */ : "COMPLETED" /* COMPLETED */, popupId, userIdFromData || this.config?.userId);
2997
4122
  } else {
2998
4123
  this.debug("No popupId available to post event", { type, surveyId });
2999
4124
  }