@aikaara/chat-sdk 1.5.17 → 1.5.18

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.
@@ -13451,7 +13451,10 @@ function Ah() {
13451
13451
  const o = /* @__PURE__ */ new Date(), e = o.getMonth() >= 3 ? o.getFullYear() : o.getFullYear() - 1;
13452
13452
  return `${e}-${e + 1}`;
13453
13453
  }
13454
- class Ih {
13454
+ const Ih = [
13455
+ "No, I have a concerns"
13456
+ ];
13457
+ class Th {
13455
13458
  client;
13456
13459
  panel;
13457
13460
  bubble;
@@ -13521,15 +13524,13 @@ class Ih {
13521
13524
  }), this.messageList.addEventListener("message-action", (e) => {
13522
13525
  const t = e.detail;
13523
13526
  if (!t?.text) return;
13524
- if (this.shouldOpenSmartEdit(t.text)) {
13525
- this.openSmartEdit();
13526
- return;
13527
- }
13528
- const r = this.client.config.templateActionAttributes ?? {}, i = t.attributes?.action ?? {}, n = {
13527
+ const r = this.shouldOpenSmartEdit(t.text), i = this.client.config.templateActionAttributes ?? {}, n = t.attributes?.action ?? {}, s = {
13529
13528
  ...t.attributes,
13530
- action: { ...r, ...i }
13529
+ action: { ...i, ...n }
13531
13530
  };
13532
- this.handleSend(t.text, n);
13531
+ this.handleSend(t.text, s).then(() => {
13532
+ r && this.openSmartEdit();
13533
+ });
13533
13534
  });
13534
13535
  }
13535
13536
  async handleSend(e, t) {
@@ -13573,13 +13574,13 @@ class Ih {
13573
13574
  /**
13574
13575
  * True when the given quick-reply button text is listed in
13575
13576
  * `descriptor.smartEdit.openOnMessages` — i.e. clicking it should open the
13576
- * Smart Edit modal instead of posting the text. Trimmed + case-insensitive.
13577
+ * Smart Edit modal after posting the text. Trimmed + case-insensitive.
13577
13578
  */
13578
13579
  shouldOpenSmartEdit(e) {
13579
- const t = window.__aikaara_descriptor__?.smartEdit?.openOnMessages;
13580
- if (!Array.isArray(t) || t.length === 0) return !1;
13581
- const r = (n) => n.trim().toLowerCase(), i = r(e);
13582
- return t.some((n) => typeof n == "string" && r(n) === i);
13580
+ const t = window.__aikaara_descriptor__?.smartEdit?.openOnMessages, r = Array.isArray(t) ? t : Ih;
13581
+ if (!Array.isArray(r) || r.length === 0) return !1;
13582
+ const i = (s) => s.trim().toLowerCase(), n = i(e);
13583
+ return r.some((s) => typeof s == "string" && i(s) === n);
13583
13584
  }
13584
13585
  /**
13585
13586
  * Open the Smart Edit modal. It opens with an EMPTY record — never the
@@ -13688,7 +13689,7 @@ class Ih {
13688
13689
  }, 200)));
13689
13690
  }
13690
13691
  }
13691
- class Th extends HTMLElement {
13692
+ class Ch extends HTMLElement {
13692
13693
  shadow;
13693
13694
  controller = null;
13694
13695
  _config = {};
@@ -13957,7 +13958,7 @@ class Th extends HTMLElement {
13957
13958
  }
13958
13959
  async initController() {
13959
13960
  const e = this.getConfig(), t = e.transport ?? "aikaara";
13960
- (t === "aikaara" || t === "dual") && (!e.baseUrl || !e.userToken) || (this.controller?.disconnect(), this.controller = new Ih(e, this.shadow, {
13961
+ (t === "aikaara" || t === "dual") && (!e.baseUrl || !e.userToken) || (this.controller?.disconnect(), this.controller = new Th(e, this.shadow, {
13961
13962
  uploadAdapter: this._config.uploadAdapter,
13962
13963
  historyAdapter: this._config.historyAdapter
13963
13964
  }), await this.controller.connect());
@@ -13977,7 +13978,7 @@ class Th extends HTMLElement {
13977
13978
  }
13978
13979
  }
13979
13980
  }
13980
- class Ch extends HTMLElement {
13981
+ class Ph extends HTMLElement {
13981
13982
  shadow;
13982
13983
  constructor() {
13983
13984
  super(), this.shadow = this.attachShadow({ mode: "open" });
@@ -14030,12 +14031,12 @@ class Ch extends HTMLElement {
14030
14031
  t && (t.innerHTML = e);
14031
14032
  }
14032
14033
  }
14033
- const Ph = [
14034
+ const Oh = [
14034
14035
  { id: "edit-itr", label: "Edit ITR Details", icon: "edit" }
14035
14036
  ];
14036
- class Oh extends HTMLElement {
14037
+ class Mh extends HTMLElement {
14037
14038
  shadow;
14038
- actions = Ph;
14039
+ actions = Oh;
14039
14040
  menuOpen = !1;
14040
14041
  outsideClickHandler = null;
14041
14042
  static get observedAttributes() {
@@ -14261,7 +14262,7 @@ class Oh extends HTMLElement {
14261
14262
  this.setAttribute("status", e);
14262
14263
  }
14263
14264
  }
14264
- const Mh = /<\s*(br|i|b|em|strong|small|sub|sup|p|div|span|ul|ol|li|a|img|code|pre)\b/i, Lh = /&(quot|apos|amp|lt|gt|nbsp|#\d+|#x[0-9a-f]+);/i, Rh = {
14265
+ const Lh = /<\s*(br|i|b|em|strong|small|sub|sup|p|div|span|ul|ol|li|a|img|code|pre)\b/i, Rh = /&(quot|apos|amp|lt|gt|nbsp|#\d+|#x[0-9a-f]+);/i, Nh = {
14265
14266
  "&quot;": '"',
14266
14267
  "&apos;": "'",
14267
14268
  "&lt;": "<",
@@ -14269,14 +14270,14 @@ const Mh = /<\s*(br|i|b|em|strong|small|sub|sup|p|div|span|ul|ol|li|a|img|code|p
14269
14270
  "&amp;": "&",
14270
14271
  "&nbsp;": " "
14271
14272
  };
14272
- function Nh(o) {
14273
- return o.replace(/&(quot|apos|lt|gt|nbsp);/gi, (e) => Rh[e.toLowerCase()] ?? e).replace(/&#(\d+);/g, (e, t) => String.fromCharCode(parseInt(t, 10))).replace(/&#x([0-9a-f]+);/gi, (e, t) => String.fromCharCode(parseInt(t, 16))).replace(/&amp;/gi, "&");
14273
+ function jh(o) {
14274
+ return o.replace(/&(quot|apos|lt|gt|nbsp);/gi, (e) => Nh[e.toLowerCase()] ?? e).replace(/&#(\d+);/g, (e, t) => String.fromCharCode(parseInt(t, 10))).replace(/&#x([0-9a-f]+);/gi, (e, t) => String.fromCharCode(parseInt(t, 16))).replace(/&amp;/gi, "&");
14274
14275
  }
14275
14276
  function zt(o) {
14276
- if (Mh.test(o))
14277
+ if (Lh.test(o))
14277
14278
  return o;
14278
- const e = Lh.test(o) ? Nh(o) : o;
14279
- let t = jh(e);
14279
+ const e = Rh.test(o) ? jh(o) : o;
14280
+ let t = Uh(e);
14280
14281
  return t = t.replace(/```(\w*)\n([\s\S]*?)```/g, (r, i, n) => `<pre><code>${n.trim()}</code></pre>`), t = t.replace(/`([^`]+)`/g, "<code>$1</code>"), t = t.replace(/\*\*(.+?)\*\*/g, "<strong>$1</strong>"), t = t.replace(/\*(.+?)\*/g, "<em>$1</em>"), t = t.replace(
14281
14282
  /\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)/g,
14282
14283
  '<a href="$2" target="_self" rel="noopener noreferrer">$1</a>'
@@ -14288,7 +14289,7 @@ function zt(o) {
14288
14289
  }
14289
14290
  ), t = t.replace(/\n/g, "<br>"), t;
14290
14291
  }
14291
- function jh(o) {
14292
+ function Uh(o) {
14292
14293
  const e = {
14293
14294
  "&": "&amp;",
14294
14295
  "<": "&lt;",
@@ -14298,7 +14299,7 @@ function jh(o) {
14298
14299
  };
14299
14300
  return o.replace(/[&<>"']/g, (t) => e[t]);
14300
14301
  }
14301
- const Uh = /* @__PURE__ */ new Set([
14302
+ const Dh = /* @__PURE__ */ new Set([
14302
14303
  "p",
14303
14304
  "br",
14304
14305
  "hr",
@@ -14333,7 +14334,7 @@ const Uh = /* @__PURE__ */ new Set([
14333
14334
  "tr",
14334
14335
  "th",
14335
14336
  "td"
14336
- ]), Dh = {
14337
+ ]), Bh = {
14337
14338
  a: /* @__PURE__ */ new Set(["href", "target", "rel"]),
14338
14339
  img: /* @__PURE__ */ new Set(["src", "alt", "width", "height"]),
14339
14340
  code: /* @__PURE__ */ new Set(["class"]),
@@ -14350,12 +14351,12 @@ function $l(o) {
14350
14351
  for (const t of e)
14351
14352
  if (t.nodeType === Node.ELEMENT_NODE) {
14352
14353
  const r = t, i = r.tagName.toLowerCase();
14353
- if (!Uh.has(i)) {
14354
+ if (!Dh.has(i)) {
14354
14355
  const a = document.createTextNode(r.textContent || "");
14355
14356
  o.replaceChild(a, t);
14356
14357
  continue;
14357
14358
  }
14358
- const n = Dh[i] || /* @__PURE__ */ new Set(), s = Array.from(r.attributes);
14359
+ const n = Bh[i] || /* @__PURE__ */ new Set(), s = Array.from(r.attributes);
14359
14360
  for (const a of s)
14360
14361
  n.has(a.name) || r.removeAttribute(a.name);
14361
14362
  if (r.hasAttribute("href")) {
@@ -14365,7 +14366,7 @@ function $l(o) {
14365
14366
  $l(t);
14366
14367
  }
14367
14368
  }
14368
- function Bh(o, e = {}) {
14369
+ function Fh(o, e = {}) {
14369
14370
  const { width: t = 600, height: r = 700, closeOnTypes: i } = e, n = Math.round(window.screenX + (window.outerWidth - t) / 2), s = Math.round(window.screenY + (window.outerHeight - r) / 2), a = window.open(
14370
14371
  o,
14371
14372
  "aikaara_popup",
@@ -14383,7 +14384,7 @@ function Bh(o, e = {}) {
14383
14384
  }, 500);
14384
14385
  return a;
14385
14386
  }
14386
- function Fh(o) {
14387
+ function $h(o) {
14387
14388
  const e = Date.now() - o.getTime(), t = Math.round(e / 1e3);
14388
14389
  if (t < 5) return "just now";
14389
14390
  if (t < 60) return `${t}s ago`;
@@ -14394,7 +14395,7 @@ function Fh(o) {
14394
14395
  const n = Math.round(i / 24);
14395
14396
  return n === 1 ? "Yesterday" : n < 7 ? `${n} d ago` : o.toLocaleDateString(void 0, { month: "short", day: "2-digit" });
14396
14397
  }
14397
- class $h extends HTMLElement {
14398
+ class qh extends HTMLElement {
14398
14399
  shadow;
14399
14400
  container;
14400
14401
  welcomeMessage = "";
@@ -14647,7 +14648,7 @@ class $h extends HTMLElement {
14647
14648
  if (n.role === "user") {
14648
14649
  const s = n.metadata?.attributes?.action;
14649
14650
  if (s) {
14650
- const a = qh(s);
14651
+ const a = Hh(s);
14651
14652
  if (s.message_id && t.set(s.message_id, a), Object.keys(a).length > 0)
14652
14653
  for (let l = i - 1; l >= 0; l--) {
14653
14654
  const c = e[l];
@@ -14785,7 +14786,7 @@ class $h extends HTMLElement {
14785
14786
  case "date":
14786
14787
  return r;
14787
14788
  case "relative":
14788
- return Fh(t);
14789
+ return $h(t);
14789
14790
  case "time-24":
14790
14791
  return t.toLocaleTimeString(void 0, { hour: "2-digit", minute: "2-digit", hour12: !1 });
14791
14792
  case "time-seconds":
@@ -14811,7 +14812,7 @@ class $h extends HTMLElement {
14811
14812
  return;
14812
14813
  }
14813
14814
  if (i === "popup") {
14814
- Bh(e);
14815
+ Fh(e);
14815
14816
  return;
14816
14817
  }
14817
14818
  const n = this.getOrCreateModal(), s = r?.title ?? t ?? "Link";
@@ -14819,7 +14820,7 @@ class $h extends HTMLElement {
14819
14820
  requestAnimationFrame(() => n.show?.(e, s));
14820
14821
  return;
14821
14822
  }
14822
- const a = Hh(e), l = ql(r.fetch.url, a), c = {
14823
+ const a = Wh(e), l = ql(r.fetch.url, a), c = {
14823
14824
  accept: "application/json",
14824
14825
  ...r.fetch.headers ?? {}
14825
14826
  }, u = r.fetch.authHeader ?? "session";
@@ -14865,7 +14866,7 @@ class $h extends HTMLElement {
14865
14866
  return e || (e = document.createElement("aikaara-link-modal"), document.body.appendChild(e)), e;
14866
14867
  }
14867
14868
  }
14868
- function qh(o) {
14869
+ function Hh(o) {
14869
14870
  const e = /* @__PURE__ */ new Set(["message_id", "formAction", "requestType"]), t = {};
14870
14871
  for (const [r, i] of Object.entries(o))
14871
14872
  e.has(r) || (Array.isArray(i) && i.every((n) => typeof n == "string") ? t[r] = i : typeof i == "string" && (t[r] = [i]));
@@ -14875,7 +14876,7 @@ function Ys(o, e) {
14875
14876
  const t = e.replace(/[.+^${}()|[\]\\]/g, "\\$&");
14876
14877
  return new RegExp("^" + t.replace(/\*/g, ".*").replace(/\?/g, ".") + "$", "i").test(o);
14877
14878
  }
14878
- function Hh(o) {
14879
+ function Wh(o) {
14879
14880
  try {
14880
14881
  const e = new URL(o), t = {};
14881
14882
  return e.searchParams.forEach((r, i) => {
@@ -14898,7 +14899,7 @@ function ho(o, e) {
14898
14899
  }
14899
14900
  return o;
14900
14901
  }
14901
- class Wh extends HTMLElement {
14902
+ class zh extends HTMLElement {
14902
14903
  shadow;
14903
14904
  templatePayload = null;
14904
14905
  attachments = [];
@@ -15014,7 +15015,7 @@ class Wh extends HTMLElement {
15014
15015
  renderAttachments() {
15015
15016
  return this.attachments.length ? `<div class="attachments">${this.attachments.map(
15016
15017
  (t) => `<a class="attachment" href="${Js(t.fileUrl)}" target="_blank" rel="noopener noreferrer">
15017
- 📎 ${zh(t.fileName)}
15018
+ 📎 ${Vh(t.fileName)}
15018
15019
  </a>`
15019
15020
  ).join("")}</div>` : "";
15020
15021
  }
@@ -15022,10 +15023,10 @@ class Wh extends HTMLElement {
15022
15023
  function Js(o) {
15023
15024
  return String(o).replace(/[&<>"']/g, (e) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" })[e]);
15024
15025
  }
15025
- function zh(o) {
15026
+ function Vh(o) {
15026
15027
  return String(o).replace(/[&<>]/g, (e) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;" })[e]);
15027
15028
  }
15028
- class Vh extends HTMLElement {
15029
+ class Kh extends HTMLElement {
15029
15030
  shadow;
15030
15031
  textarea;
15031
15032
  sendBtn;
@@ -15176,7 +15177,7 @@ class Vh extends HTMLElement {
15176
15177
  this.textarea.style.height = "auto", this.textarea.style.height = Math.min(this.textarea.scrollHeight, 120) + "px";
15177
15178
  }
15178
15179
  }
15179
- class Kh extends HTMLElement {
15180
+ class Gh extends HTMLElement {
15180
15181
  shadow;
15181
15182
  constructor() {
15182
15183
  super(), this.shadow = this.attachShadow({ mode: "open" });
@@ -15225,7 +15226,7 @@ class Kh extends HTMLElement {
15225
15226
  this.removeAttribute("visible");
15226
15227
  }
15227
15228
  }
15228
- class Gh extends HTMLElement {
15229
+ class Yh extends HTMLElement {
15229
15230
  shadow;
15230
15231
  bubble;
15231
15232
  constructor() {
@@ -15290,7 +15291,7 @@ class Gh extends HTMLElement {
15290
15291
  this.bubble?.classList.remove("cursor");
15291
15292
  }
15292
15293
  }
15293
- class Yh extends HTMLElement {
15294
+ class Jh extends HTMLElement {
15294
15295
  shadow;
15295
15296
  container;
15296
15297
  dismissTimer = null;
@@ -15363,7 +15364,7 @@ function Hl(o) {
15363
15364
  });
15364
15365
  return un.set(o, t), t;
15365
15366
  }
15366
- function Jh(o, e = 5e3) {
15367
+ function Qh(o, e = 5e3) {
15367
15368
  return new Promise((t, r) => {
15368
15369
  const i = setTimeout(() => r(new Error(`Custom element <${o}> not registered within ${e}ms`)), e);
15369
15370
  customElements.whenDefined(o).then(() => {
@@ -15371,14 +15372,14 @@ function Jh(o, e = 5e3) {
15371
15372
  });
15372
15373
  });
15373
15374
  }
15374
- const Qh = {
15375
+ const Xh = {
15375
15376
  "aikaara-template-payment-link": () => import("./AikaaraPaymentLink-ZYn2r5t-.mjs").then(({ registerAikaaraPaymentLink: o }) => o())
15376
15377
  };
15377
- function Xh(o) {
15378
+ function Zh(o) {
15378
15379
  const e = `template:${o}`, t = window.__aikaara_descriptor__?.components?.[e];
15379
15380
  return t && t.kind === "iife-element" ? { render: t.tag, scriptUrl: t.scriptUrl, props: t.props } : window.__aikaara_descriptor__?.templates?.[o];
15380
15381
  }
15381
- class Zh extends HTMLElement {
15382
+ class ef extends HTMLElement {
15382
15383
  shadow;
15383
15384
  payloadData = null;
15384
15385
  innerMessage = "";
@@ -15402,7 +15403,7 @@ class Zh extends HTMLElement {
15402
15403
  this.render(), this.addEventListener("template-action", (e) => {
15403
15404
  const t = e.detail, r = this.getAttribute("message-id");
15404
15405
  if (r && t?.attributes?.action) {
15405
- const i = rf(t.attributes.action);
15406
+ const i = nf(t.attributes.action);
15406
15407
  if (Object.keys(i).length > 0)
15407
15408
  try {
15408
15409
  localStorage.setItem(`aikaara_form:${r}`, JSON.stringify(i));
@@ -15478,8 +15479,8 @@ class Zh extends HTMLElement {
15478
15479
  <slot></slot>
15479
15480
  `; this.firstChild; ) this.removeChild(this.firstChild);
15480
15481
  if (!e) return;
15481
- const r = t ? Xh(t) : void 0, i = r?.render ?? (t ? `aikaara-template-${t}` : `aikaara-template-${e}`), n = Qh[i];
15482
- if (n && !customElements.get(i) ? n().then(() => this.render()).catch((s) => console.warn(`[aikaara-template-renderer] native template ${i} failed to load`, s)) : r?.scriptUrl && !customElements.get(i) && Hl(r.scriptUrl).then(() => Jh(i)).then(() => this.render()).catch((s) => console.warn(`[aikaara-template-renderer] failed to lazy-load ${r.scriptUrl}`, s)), customElements.get(i)) {
15482
+ const r = t ? Zh(t) : void 0, i = r?.render ?? (t ? `aikaara-template-${t}` : `aikaara-template-${e}`), n = Xh[i];
15483
+ if (n && !customElements.get(i) ? n().then(() => this.render()).catch((s) => console.warn(`[aikaara-template-renderer] native template ${i} failed to load`, s)) : r?.scriptUrl && !customElements.get(i) && Hl(r.scriptUrl).then(() => Qh(i)).then(() => this.render()).catch((s) => console.warn(`[aikaara-template-renderer] failed to lazy-load ${r.scriptUrl}`, s)), customElements.get(i)) {
15483
15484
  const s = document.createElement(i);
15484
15485
  if (r?.props) {
15485
15486
  for (const [a, l] of Object.entries(r.props))
@@ -15566,7 +15567,7 @@ class Zh extends HTMLElement {
15566
15567
  */
15567
15568
  mountLinkButton(e) {
15568
15569
  const t = this.renderGen;
15569
- import("./AikaaraLinkButton-Bb9q5Tpg.mjs").then(({ registerAikaaraLinkButton: r, AikaaraLinkButton: i }) => {
15570
+ import("./AikaaraLinkButton-IeGomyIc.mjs").then(({ registerAikaaraLinkButton: r, AikaaraLinkButton: i }) => {
15570
15571
  if (t !== this.renderGen) return;
15571
15572
  r();
15572
15573
  const n = document.createElement("aikaara-link-button");
@@ -15575,7 +15576,7 @@ class Zh extends HTMLElement {
15575
15576
  url: e.url ?? "",
15576
15577
  openLinkInNewTab: e.openLinkInNewTab,
15577
15578
  orderId: e.orderId,
15578
- extra: tf(e),
15579
+ extra: rf(e),
15579
15580
  messageId: this.getAttribute("message-id") ?? void 0
15580
15581
  }), this.appendChild(n);
15581
15582
  });
@@ -15585,26 +15586,26 @@ class Zh extends HTMLElement {
15585
15586
  t.setPayload(e), this.appendChild(t);
15586
15587
  }
15587
15588
  }
15588
- const ef = /* @__PURE__ */ new Set([
15589
+ const tf = /* @__PURE__ */ new Set([
15589
15590
  "type",
15590
15591
  "url",
15591
15592
  "name",
15592
15593
  "openLinkInNewTab",
15593
15594
  "orderId"
15594
15595
  ]);
15595
- function tf(o) {
15596
+ function rf(o) {
15596
15597
  const e = {};
15597
15598
  for (const [t, r] of Object.entries(o))
15598
- ef.has(t) || (e[t] = r);
15599
+ tf.has(t) || (e[t] = r);
15599
15600
  return e;
15600
15601
  }
15601
- function rf(o) {
15602
+ function nf(o) {
15602
15603
  const e = /* @__PURE__ */ new Set(["message_id", "formAction", "requestType", "serviceType"]), t = {};
15603
15604
  for (const [r, i] of Object.entries(o))
15604
15605
  e.has(r) || (Array.isArray(i) && i.every((n) => typeof n == "string") ? t[r] = i : typeof i == "string" && (t[r] = [i]));
15605
15606
  return t;
15606
15607
  }
15607
- class nf extends HTMLElement {
15608
+ class of extends HTMLElement {
15608
15609
  shadow;
15609
15610
  static get observedAttributes() {
15610
15611
  return ["text", "subtext"];
@@ -15653,7 +15654,7 @@ class nf extends HTMLElement {
15653
15654
  function Qs(o) {
15654
15655
  return String(o).replace(/[&<>]/g, (e) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;" })[e]);
15655
15656
  }
15656
- class of extends HTMLElement {
15657
+ class sf extends HTMLElement {
15657
15658
  shadow;
15658
15659
  data = null;
15659
15660
  selected = /* @__PURE__ */ new Set();
@@ -15878,7 +15879,7 @@ function Mt(o) {
15878
15879
  function dn(o) {
15879
15880
  return String(o).replace(/[&<>"']/g, (e) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" })[e]);
15880
15881
  }
15881
- class sf extends HTMLElement {
15882
+ class af extends HTMLElement {
15882
15883
  shadow;
15883
15884
  data = null;
15884
15885
  constructor() {
@@ -15947,14 +15948,14 @@ class sf extends HTMLElement {
15947
15948
  button:hover { background: var(--aikaara-submit-hover-bg, var(--aikaara-primary-hover, #4f46e5)); }
15948
15949
  button:disabled { opacity: var(--aikaara-submit-disabled-opacity, 0.5); cursor: not-allowed; }
15949
15950
  </style>
15950
- <button type="button">${af(e)}</button>
15951
+ <button type="button">${lf(e)}</button>
15951
15952
  `, this.shadow.querySelector("button").addEventListener("click", () => this.handleClick());
15952
15953
  }
15953
15954
  }
15954
- function af(o) {
15955
+ function lf(o) {
15955
15956
  return String(o).replace(/[&<>]/g, (e) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;" })[e]);
15956
15957
  }
15957
- class lf extends HTMLElement {
15958
+ class cf extends HTMLElement {
15958
15959
  shadow;
15959
15960
  data = null;
15960
15961
  dismissed = !1;
@@ -16046,7 +16047,7 @@ class lf extends HTMLElement {
16046
16047
  function hn(o) {
16047
16048
  return String(o).replace(/[&<>]/g, (e) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;" })[e]);
16048
16049
  }
16049
- class cf extends HTMLElement {
16050
+ class uf extends HTMLElement {
16050
16051
  shadow;
16051
16052
  data = null;
16052
16053
  _value = "";
@@ -16153,7 +16154,7 @@ function rr(o) {
16153
16154
  (e) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" })[e]
16154
16155
  );
16155
16156
  }
16156
- class uf extends HTMLElement {
16157
+ class df extends HTMLElement {
16157
16158
  static get observedAttributes() {
16158
16159
  return ["slug", "user-id", "user-name", "user-token", "department-id", "config-base", "api-key"];
16159
16160
  }
@@ -16207,7 +16208,7 @@ class uf extends HTMLElement {
16207
16208
  const l = Object.keys(n).length > 0 ? n : void 0;
16208
16209
  return this.mountInflight = (async () => {
16209
16210
  try {
16210
- this.mounted = await zf({
16211
+ this.mounted = await Vf({
16211
16212
  container: this,
16212
16213
  slug: e,
16213
16214
  configBase: this.getAttribute("config-base") ?? void 0,
@@ -16236,7 +16237,7 @@ class uf extends HTMLElement {
16236
16237
  })(), this.mountInflight;
16237
16238
  }
16238
16239
  }
16239
- class df extends HTMLElement {
16240
+ class hf extends HTMLElement {
16240
16241
  shadow;
16241
16242
  root = null;
16242
16243
  iframe = null;
@@ -16353,7 +16354,7 @@ class df extends HTMLElement {
16353
16354
  });
16354
16355
  }
16355
16356
  }
16356
- const hf = [
16357
+ const ff = [
16357
16358
  { label: "Self-filing guidance" },
16358
16359
  { label: "Smart tax suggestions" },
16359
16360
  { label: "Auto-fetch 26AS / AIS" },
@@ -16361,7 +16362,7 @@ const hf = [
16361
16362
  { label: "Dedicated tax expert" },
16362
16363
  { label: "End-to-end filing" },
16363
16364
  { label: "Document handling" }
16364
- ], ff = [
16365
+ ], pf = [
16365
16366
  {
16366
16367
  label: "DIY",
16367
16368
  match: ["DIY", "DIY_SALARY"],
@@ -16384,11 +16385,11 @@ const hf = [
16384
16385
  features: [!0, !0, !0, !0, !0, !0, !0]
16385
16386
  }
16386
16387
  ];
16387
- class pf extends HTMLElement {
16388
+ class mf extends HTMLElement {
16388
16389
  shadow;
16389
16390
  data = null;
16390
- columns = ff;
16391
- features = hf;
16391
+ columns = pf;
16392
+ features = ff;
16392
16393
  constructor() {
16393
16394
  super(), this.shadow = this.attachShadow({ mode: "open" });
16394
16395
  }
@@ -16521,7 +16522,7 @@ function fn(o) {
16521
16522
  (e) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" })[e]
16522
16523
  );
16523
16524
  }
16524
- class mf extends HTMLElement {
16525
+ class gf extends HTMLElement {
16525
16526
  shadow;
16526
16527
  root = null;
16527
16528
  schemas = [];
@@ -16612,7 +16613,7 @@ class mf extends HTMLElement {
16612
16613
  `;
16613
16614
  const r = this.shadow.querySelector(".modal-body"), i = this.schemas.map(
16614
16615
  (s) => `
16615
- <button class="chip" type="button" data-section-id="${bf(s.id)}">
16616
+ <button class="chip" type="button" data-section-id="${yf(s.id)}">
16616
16617
  <span class="chip-icon">${s.icon ?? "📄"}</span>
16617
16618
  <span class="chip-label">${Zs(s.title)}</span>
16618
16619
  </button>`
@@ -16645,7 +16646,7 @@ class mf extends HTMLElement {
16645
16646
  e.classList.remove("view-picker"), e.classList.add("view-form");
16646
16647
  const t = this.schemas.find((n) => n.id === this.activeSectionId), r = this.shadow.querySelector(".modal-header");
16647
16648
  r.innerHTML = `
16648
- <button class="icon-btn back-btn" type="button" aria-label="Back">${gf}</button>
16649
+ <button class="icon-btn back-btn" type="button" aria-label="Back">${bf}</button>
16649
16650
  <div class="modal-title">${Zs(t?.title ?? "Edit")}</div>
16650
16651
  <button class="icon-btn close-btn" type="button" aria-label="Close">${Xs}</button>
16651
16652
  `;
@@ -16821,14 +16822,14 @@ class mf extends HTMLElement {
16821
16822
  `;
16822
16823
  }
16823
16824
  }
16824
- const Xs = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>', gf = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="19" y1="12" x2="5" y2="12"/><polyline points="12 19 5 12 12 5"/></svg>';
16825
- function bf(o) {
16825
+ const Xs = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>', bf = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="19" y1="12" x2="5" y2="12"/><polyline points="12 19 5 12 12 5"/></svg>';
16826
+ function yf(o) {
16826
16827
  return o.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
16827
16828
  }
16828
16829
  function Zs(o) {
16829
16830
  return o.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
16830
16831
  }
16831
- class yf extends HTMLElement {
16832
+ class vf extends HTMLElement {
16832
16833
  shadow;
16833
16834
  schema = null;
16834
16835
  value = {};
@@ -17323,33 +17324,33 @@ function dt(o) {
17323
17324
  function ze(o) {
17324
17325
  return o.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
17325
17326
  }
17326
- function vf() {
17327
+ function wf() {
17327
17328
  const o = [
17328
- ["aikaara-chat-widget", Th],
17329
- ["aikaara-chat-bubble", Ch],
17330
- ["aikaara-chat-header", Oh],
17331
- ["aikaara-message-list", $h],
17332
- ["aikaara-message-bubble", Wh],
17333
- ["aikaara-chat-input", Vh],
17334
- ["aikaara-typing-indicator", Kh],
17335
- ["aikaara-streaming-message", Gh],
17336
- ["aikaara-error-banner", Yh],
17337
- ["aikaara-template-renderer", Zh],
17338
- ["aikaara-system-pill", nf],
17339
- ["aikaara-option-list", of],
17340
- ["aikaara-submit-action", sf],
17341
- ["aikaara-modal-action", lf],
17342
- ["aikaara-text-input", cf],
17343
- ["aikaara-chat", uf],
17344
- ["aikaara-link-modal", df],
17345
- ["aikaara-compare-plans", pf],
17346
- ["aikaara-smart-edit-modal", mf],
17347
- ["aikaara-schema-form", yf]
17329
+ ["aikaara-chat-widget", Ch],
17330
+ ["aikaara-chat-bubble", Ph],
17331
+ ["aikaara-chat-header", Mh],
17332
+ ["aikaara-message-list", qh],
17333
+ ["aikaara-message-bubble", zh],
17334
+ ["aikaara-chat-input", Kh],
17335
+ ["aikaara-typing-indicator", Gh],
17336
+ ["aikaara-streaming-message", Yh],
17337
+ ["aikaara-error-banner", Jh],
17338
+ ["aikaara-template-renderer", ef],
17339
+ ["aikaara-system-pill", of],
17340
+ ["aikaara-option-list", sf],
17341
+ ["aikaara-submit-action", af],
17342
+ ["aikaara-modal-action", cf],
17343
+ ["aikaara-text-input", uf],
17344
+ ["aikaara-chat", df],
17345
+ ["aikaara-link-modal", hf],
17346
+ ["aikaara-compare-plans", mf],
17347
+ ["aikaara-smart-edit-modal", gf],
17348
+ ["aikaara-schema-form", vf]
17348
17349
  ];
17349
17350
  for (const [e, t] of o)
17350
17351
  customElements.get(e) || customElements.define(e, t);
17351
17352
  }
17352
- vf();
17353
+ wf();
17353
17354
  function br(o, e, t = "") {
17354
17355
  if (!e) return t;
17355
17356
  const r = e.split(".");
@@ -17375,7 +17376,7 @@ function ea(o) {
17375
17376
  async function Kt(o) {
17376
17377
  return typeof o == "function" ? await o() : o;
17377
17378
  }
17378
- class wf {
17379
+ class _f {
17379
17380
  constructor(e, t) {
17380
17381
  this.descriptor = e, this.sessionToken = t;
17381
17382
  }
@@ -17426,10 +17427,10 @@ class wf {
17426
17427
  return this.cache = { token: d, requestId: g, fullName: f, userId: b, expiresAt: y }, this.cache;
17427
17428
  }
17428
17429
  }
17429
- async function _f(o) {
17430
+ async function kf(o) {
17430
17431
  const e = {};
17431
17432
  for (const t of o.spec) {
17432
- const r = await kf(t, o.providers);
17433
+ const r = await xf(t, o.providers);
17433
17434
  if (r !== void 0 && r !== "")
17434
17435
  e[t.name] = r;
17435
17436
  else {
@@ -17442,11 +17443,11 @@ async function _f(o) {
17442
17443
  }
17443
17444
  return e;
17444
17445
  }
17445
- async function kf(o, e) {
17446
+ async function xf(o, e) {
17446
17447
  const t = o.key ?? o.name;
17447
17448
  switch (o.source) {
17448
17449
  case "cookie":
17449
- return xf(t);
17450
+ return Sf(t);
17450
17451
  case "localStorage":
17451
17452
  return yr(() => window.localStorage.getItem(t) ?? void 0);
17452
17453
  case "sessionStorage":
@@ -17454,7 +17455,7 @@ async function kf(o, e) {
17454
17455
  case "url_param":
17455
17456
  return yr(() => new URL(window.location.href).searchParams.get(t) ?? void 0);
17456
17457
  case "header_meta":
17457
- return yr(() => document.querySelector(`meta[name="${Sf(t)}"]`)?.content ?? void 0);
17458
+ return yr(() => document.querySelector(`meta[name="${Ef(t)}"]`)?.content ?? void 0);
17458
17459
  case "callback": {
17459
17460
  const r = e?.[o.name];
17460
17461
  if (!r) return;
@@ -17465,7 +17466,7 @@ async function kf(o, e) {
17465
17466
  return;
17466
17467
  }
17467
17468
  }
17468
- function xf(o) {
17469
+ function Sf(o) {
17469
17470
  if (typeof document > "u") return;
17470
17471
  const e = encodeURIComponent(o), t = document.cookie ? document.cookie.split("; ") : [];
17471
17472
  for (const r of t) {
@@ -17487,11 +17488,11 @@ function yr(o) {
17487
17488
  return;
17488
17489
  }
17489
17490
  }
17490
- function Sf(o) {
17491
+ function Ef(o) {
17491
17492
  return o.replace(/["\\]/g, "\\$&");
17492
17493
  }
17493
- const Ef = 1800;
17494
- class Af {
17494
+ const Af = 1800;
17495
+ class If {
17495
17496
  constructor(e) {
17496
17497
  this.opts = e, this.cache = this.loadCache();
17497
17498
  }
@@ -17520,7 +17521,7 @@ class Af {
17520
17521
  throw new Error(
17521
17522
  "[aikaara-chat-sdk] SsoExchangeAdapter.exchange() requires descriptor.sso.collect; v2 partner-token flow should be handled by TokenDiscoveryReader instead."
17522
17523
  );
17523
- const e = await _f({
17524
+ const e = await kf({
17524
17525
  spec: this.opts.descriptor.collect,
17525
17526
  providers: this.opts.providers
17526
17527
  }), t = JSON.stringify({ credentials: e }), r = {
@@ -17558,7 +17559,7 @@ class Af {
17558
17559
  return this.cache = u, this.persistCache(u), u;
17559
17560
  }
17560
17561
  computeExpiry() {
17561
- const e = this.opts.descriptor.cacheTtlSec ?? Ef;
17562
+ const e = this.opts.descriptor.cacheTtlSec ?? Af;
17562
17563
  if (!(!this.opts.descriptor.cacheKey || e <= 0))
17563
17564
  return Date.now() + e * 1e3;
17564
17565
  }
@@ -17591,8 +17592,8 @@ class Af {
17591
17592
  }
17592
17593
  }
17593
17594
  }
17594
- const If = 3e4, Tf = 2e3, Cf = 100;
17595
- async function Pf(o) {
17595
+ const Tf = 3e4, Cf = 2e3, Pf = 100;
17596
+ async function Of(o) {
17596
17597
  const { descriptor: e } = o, t = e.tokenSourceConfig ?? {};
17597
17598
  switch (e.tokenSource) {
17598
17599
  case "init": {
@@ -17601,37 +17602,37 @@ async function Pf(o) {
17601
17602
  return { token: o.initToken, source: "init" };
17602
17603
  }
17603
17604
  case "query": {
17604
- const r = typeof t.key == "string" && t.key ? t.key : "token", i = Mf(r);
17605
+ const r = typeof t.key == "string" && t.key ? t.key : "token", i = Lf(r);
17605
17606
  if (!i) throw new Xe("query", `?${r}= not present`);
17606
17607
  return { token: i, source: "query" };
17607
17608
  }
17608
17609
  case "hash": {
17609
- const r = typeof t.key == "string" && t.key ? t.key : "token", i = Lf(r);
17610
+ const r = typeof t.key == "string" && t.key ? t.key : "token", i = Rf(r);
17610
17611
  if (!i) throw new Xe("hash", `#${r}= not present`);
17611
17612
  return { token: i, source: "hash" };
17612
17613
  }
17613
17614
  case "postmsg": {
17614
- const r = typeof t.type == "string" ? t.type : "", i = typeof t.key == "string" && t.key ? t.key : "token", n = Df(typeof t.origins == "string" ? t.origins : ""), s = typeof t.timeoutMs == "number" && t.timeoutMs > 0 ? t.timeoutMs : If;
17615
- return { token: await Uf({ type: r, key: i, origins: n, timeoutMs: s }), source: "postmsg" };
17615
+ const r = typeof t.type == "string" ? t.type : "", i = typeof t.key == "string" && t.key ? t.key : "token", n = Bf(typeof t.origins == "string" ? t.origins : ""), s = typeof t.timeoutMs == "number" && t.timeoutMs > 0 ? t.timeoutMs : Tf;
17616
+ return { token: await Df({ type: r, key: i, origins: n, timeoutMs: s }), source: "postmsg" };
17616
17617
  }
17617
17618
  case "cookie": {
17618
17619
  const r = typeof t.name == "string" && t.name ? t.name : "";
17619
17620
  if (!r) throw new Xe("cookie", "cookie.name not configured");
17620
- const i = Rf(r);
17621
+ const i = Nf(r);
17621
17622
  if (!i) throw new Xe("cookie", `cookie "${r}" not set`);
17622
17623
  return { token: i, source: "cookie" };
17623
17624
  }
17624
17625
  case "storage": {
17625
17626
  const r = t.store === "session" ? "session" : "local", i = typeof t.key == "string" && t.key ? t.key : "", n = typeof t.path == "string" ? t.path : "";
17626
17627
  if (!i) throw new Xe("storage", "storage.key not configured");
17627
- const s = Nf(r, i, n);
17628
+ const s = jf(r, i, n);
17628
17629
  if (!s) throw new Xe("storage", `${r}Storage["${i}"] not set`);
17629
17630
  return { token: s, source: "storage" };
17630
17631
  }
17631
17632
  case "global": {
17632
17633
  const r = typeof t.path == "string" ? t.path : "";
17633
17634
  if (!r) throw new Xe("global", "global.path not configured");
17634
- const i = typeof t.timeoutMs == "number" && t.timeoutMs > 0 ? t.timeoutMs : Tf, n = typeof t.intervalMs == "number" && t.intervalMs > 0 ? t.intervalMs : Cf, s = await jf(r, i, n);
17635
+ const i = typeof t.timeoutMs == "number" && t.timeoutMs > 0 ? t.timeoutMs : Cf, n = typeof t.intervalMs == "number" && t.intervalMs > 0 ? t.intervalMs : Pf, s = await Uf(r, i, n);
17635
17636
  if (!s) throw new Xe("global", `window.${r} not present`);
17636
17637
  return { token: s, source: "global" };
17637
17638
  }
@@ -17644,7 +17645,7 @@ async function Pf(o) {
17644
17645
  }
17645
17646
  }
17646
17647
  }
17647
- class Of {
17648
+ class Mf {
17648
17649
  constructor(e) {
17649
17650
  this.opts = e;
17650
17651
  }
@@ -17655,7 +17656,7 @@ class Of {
17655
17656
  /** Resolve the token. Returns cache if present. */
17656
17657
  async get() {
17657
17658
  if (this.cached) return this.cached;
17658
- const e = await Pf(this.opts);
17659
+ const e = await Of(this.opts);
17659
17660
  return this.cached = e, e;
17660
17661
  }
17661
17662
  /**
@@ -17672,7 +17673,7 @@ class Xe extends Error {
17672
17673
  super(`[aikaara-chat-sdk] token-discovery (${e}): ${t}`), this.source = e, this.name = "TokenDiscoveryError";
17673
17674
  }
17674
17675
  }
17675
- function Mf(o) {
17676
+ function Lf(o) {
17676
17677
  if (!(typeof window > "u"))
17677
17678
  try {
17678
17679
  const e = window.location.search.slice(1);
@@ -17686,7 +17687,7 @@ function Mf(o) {
17686
17687
  return;
17687
17688
  }
17688
17689
  }
17689
- function Lf(o) {
17690
+ function Rf(o) {
17690
17691
  if (!(typeof window > "u"))
17691
17692
  try {
17692
17693
  const e = window.location.hash.replace(/^#/, "");
@@ -17695,7 +17696,7 @@ function Lf(o) {
17695
17696
  return;
17696
17697
  }
17697
17698
  }
17698
- function Rf(o) {
17699
+ function Nf(o) {
17699
17700
  if (typeof document > "u") return;
17700
17701
  const e = encodeURIComponent(o), t = document.cookie ? document.cookie.split("; ") : [];
17701
17702
  for (const r of t) {
@@ -17710,7 +17711,7 @@ function Rf(o) {
17710
17711
  }
17711
17712
  }
17712
17713
  }
17713
- function Nf(o, e, t) {
17714
+ function jf(o, e, t) {
17714
17715
  if (!(typeof window > "u"))
17715
17716
  try {
17716
17717
  const i = (o === "session" ? window.sessionStorage : window.localStorage).getItem(e);
@@ -17728,7 +17729,7 @@ function Nf(o, e, t) {
17728
17729
  return;
17729
17730
  }
17730
17731
  }
17731
- async function jf(o, e, t) {
17732
+ async function Uf(o, e, t) {
17732
17733
  if (typeof window > "u") return;
17733
17734
  const r = Date.now() + e;
17734
17735
  for (; Date.now() < r; ) {
@@ -17743,7 +17744,7 @@ async function jf(o, e, t) {
17743
17744
  await new Promise((n) => setTimeout(n, t));
17744
17745
  }
17745
17746
  }
17746
- function Uf(o) {
17747
+ function Df(o) {
17747
17748
  return new Promise((e, t) => {
17748
17749
  if (typeof window > "u") {
17749
17750
  t(new Xe("postmsg", "no window"));
@@ -17765,7 +17766,7 @@ function Uf(o) {
17765
17766
  window.addEventListener("message", n);
17766
17767
  });
17767
17768
  }
17768
- function Df(o) {
17769
+ function Bf(o) {
17769
17770
  return o ? o.split(/[,\s]+/).map((e) => e.trim()).filter(Boolean) : [];
17770
17771
  }
17771
17772
  function Wl(o, e) {
@@ -17779,7 +17780,7 @@ function Wl(o, e) {
17779
17780
  return;
17780
17781
  return r;
17781
17782
  }
17782
- function Bf() {
17783
+ function Ff() {
17783
17784
  const o = typeof crypto < "u" ? crypto : null;
17784
17785
  if (o?.randomUUID) return o.randomUUID();
17785
17786
  if (o?.getRandomValues) {
@@ -17793,9 +17794,9 @@ function Bf() {
17793
17794
  return (e === "x" ? t : t & 3 | 8).toString(16);
17794
17795
  });
17795
17796
  }
17796
- const Ff = "aikaara_chat:requestId";
17797
+ const $f = "aikaara_chat:requestId";
17797
17798
  function Co(o, e, t) {
17798
- const r = `${Ff}:${o}:${e}`;
17799
+ const r = `${$f}:${o}:${e}`;
17799
17800
  return t ? `${r}:${t}` : r;
17800
17801
  }
17801
17802
  function zl(o, e, t) {
@@ -17805,13 +17806,13 @@ function zl(o, e, t) {
17805
17806
  return null;
17806
17807
  }
17807
17808
  }
17808
- function $f(o, e, t, r) {
17809
+ function qf(o, e, t, r) {
17809
17810
  try {
17810
17811
  localStorage.setItem(Co(o, e, r), t);
17811
17812
  } catch {
17812
17813
  }
17813
17814
  }
17814
- function Vf(o, e, t) {
17815
+ function Kf(o, e, t) {
17815
17816
  try {
17816
17817
  localStorage.removeItem(Co(o, e, t));
17817
17818
  } catch {
@@ -17860,7 +17861,7 @@ async function fo(o, e, t = "before-chat") {
17860
17861
  _ = x;
17861
17862
  break;
17862
17863
  }
17863
- if (y = x.status, w = await x.text().catch(() => ""), m < c.length && qf(y, w)) {
17864
+ if (y = x.status, w = await x.text().catch(() => ""), m < c.length && Hf(y, w)) {
17864
17865
  const S = c[m++];
17865
17866
  console.warn(
17866
17867
  `[aikaara-chat-sdk] preflight #${u} ${g} ${p} → ${y} (transient). Retry #${m} in ${S}ms.`
@@ -17914,7 +17915,7 @@ async function fo(o, e, t = "before-chat") {
17914
17915
  }
17915
17916
  return { captured: l };
17916
17917
  }
17917
- async function Kf(o) {
17918
+ async function Gf(o) {
17918
17919
  const e = o.steps ?? [];
17919
17920
  return e.some((r) => r.trigger === "on-method-select") ? (await fo(
17920
17921
  e,
@@ -17930,7 +17931,7 @@ async function Kf(o) {
17930
17931
  "on-method-select"
17931
17932
  )).captured : {};
17932
17933
  }
17933
- function qf(o, e) {
17934
+ function Hf(o, e) {
17934
17935
  if (o === 503 || o === 504 || o === 502) return !0;
17935
17936
  if (o === 401 || o === 403) return e.trim().length === 0;
17936
17937
  if (o === 500) {
@@ -17956,7 +17957,7 @@ async function Vl(o, e) {
17956
17957
  return r;
17957
17958
  }
17958
17959
  function Kl(o, e) {
17959
- return o.replace("{projectId}", e).replace("{uuid}", Bf().replace(/-/g, ""));
17960
+ return o.replace("{projectId}", e).replace("{uuid}", Ff().replace(/-/g, ""));
17960
17961
  }
17961
17962
  function Gl(o) {
17962
17963
  const e = o._preload;
@@ -17968,7 +17969,7 @@ function Gl(o) {
17968
17969
  );
17969
17970
  t.length !== 0 && Promise.allSettled(t.map((r) => Hl(r)));
17970
17971
  }
17971
- async function Hf(o) {
17972
+ async function Wf(o) {
17972
17973
  const e = {
17973
17974
  ...o.config ?? (o.configUrl ? await Vl(o.configUrl, o.configHeaders) : {}),
17974
17975
  ...o.overrides ?? {}
@@ -17978,7 +17979,7 @@ async function Hf(o) {
17978
17979
  if ((t === "tiledesk" || t === "dual") && !r)
17979
17980
  throw new Error("mount: descriptor.tiledesk is required for tiledesk/dual transport");
17980
17981
  const i = r?.projectId ?? "", n = o.identity.userId, s = o.conversationScope || void 0, a = o.forceNewConversation ? null : zl(n, i, s), l = r?.requestIdTemplate ?? "support-group-{projectId}-{uuid}", c = o.conversationId ?? a ?? Kl(l, i);
17981
- (o.conversationId || !a || o.forceNewConversation) && i && $f(n, i, c, s);
17982
+ (o.conversationId || !a || o.forceNewConversation) && i && qf(n, i, c, s);
17982
17983
  const u = await o.tokenProvider(), d = o.tokenProvider, p = o.historyTokenProvider ?? d, g = r ? {
17983
17984
  mqttEndpoint: r.mqttEndpoint,
17984
17985
  jwtToken: u,
@@ -18066,13 +18067,13 @@ async function Hf(o) {
18066
18067
  }
18067
18068
  };
18068
18069
  }
18069
- function Wf(o) {
18070
+ function zf(o) {
18070
18071
  if (typeof o != "string") return o;
18071
18072
  const e = document.querySelector(o);
18072
18073
  if (!e) throw new Error(`mountFromSlug: container "${o}" not found`);
18073
18074
  return e;
18074
18075
  }
18075
- async function zf(o) {
18076
+ async function Vf(o) {
18076
18077
  const e = (o.configBase ?? "https://api.aikaara.com").replace(/\/$/, ""), t = `${e}/api/v1/widget_configs/${encodeURIComponent(o.slug)}`;
18077
18078
  let r = null;
18078
18079
  try {
@@ -18114,7 +18115,8 @@ async function zf(o) {
18114
18115
  // Published so Smart Edit (smartEditApi.ts) can read the API base + the
18115
18116
  // partner headers without a separate context provider.
18116
18117
  api: i.api,
18117
- auth: i.auth
18118
+ auth: i.auth,
18119
+ smartEdit: i.smartEdit ?? n.__aikaara_descriptor__?.smartEdit
18118
18120
  }, !i.auth)
18119
18121
  throw new Error(
18120
18122
  `mountFromSlug: widget_configs/${o.slug} descriptor must include "auth" block`
@@ -18122,7 +18124,7 @@ async function zf(o) {
18122
18124
  let s = null, a = o.user.id, l = o.user.name, c = "", u = o.user.token, d = null;
18123
18125
  const p = await Kt(o.user.token).catch(() => ""), g = typeof p == "string" && p.length > 0;
18124
18126
  if (!g && i.sso?.tokenSource) {
18125
- d = new Of({
18127
+ d = new Mf({
18126
18128
  descriptor: {
18127
18129
  provider: i.sso.provider,
18128
18130
  flow: i.sso.flow,
@@ -18139,7 +18141,7 @@ async function zf(o) {
18139
18141
  u = async () => (await d.get()).token, o.user.identity && !o.user.identity.partnerToken && (o.user.identity.partnerToken = I.token);
18140
18142
  } else if (!g && i.sso && i.sso.collect && i.sso.collect.length > 0) {
18141
18143
  const I = `${e}/api/v1/projects/by-slug/${encodeURIComponent(o.slug)}/sso_exchange`;
18142
- s = await new Af({
18144
+ s = await new If({
18143
18145
  descriptor: i.sso,
18144
18146
  providers: o.user.credentialProviders,
18145
18147
  exchangeUrl: I
@@ -18161,7 +18163,7 @@ async function zf(o) {
18161
18163
  }
18162
18164
  I.captured.userId && (a = I.captured.userId), I.captured.requestId && (b = I.captured.requestId);
18163
18165
  }
18164
- const y = new wf(i.auth, u);
18166
+ const y = new _f(i.auth, u);
18165
18167
  if (f) {
18166
18168
  const I = i.tiledesk?.projectId ?? "", P = I ? zl(a, I) : null, O = i.tiledesk?.requestIdTemplate ?? "support-group-{projectId}-{uuid}", B = P ?? (I ? Kl(O, I) : "");
18167
18169
  y.prime(f, { requestId: B, fullName: l });
@@ -18192,8 +18194,8 @@ async function zf(o) {
18192
18194
  fieldName: x.fieldName,
18193
18195
  extraFields: x.extraFields,
18194
18196
  headers: async () => ({ authorization: await v() })
18195
- }) : void 0), E = await Hf({
18196
- container: Wf(o.container),
18197
+ }) : void 0), E = await Wf({
18198
+ container: zf(o.container),
18197
18199
  config: i,
18198
18200
  // SSO-issued Aikaara user token, used by the ActionCable transport.
18199
18201
  // Tiledesk-only widgets ignore this; falls back to `userId` inside `mount`.
@@ -18249,50 +18251,50 @@ async function zf(o) {
18249
18251
  }
18250
18252
  export {
18251
18253
  Po as A,
18252
- zf as B,
18254
+ Vf as B,
18253
18255
  Yl as C,
18254
- Hf as D,
18256
+ Wf as D,
18255
18257
  ta as E,
18256
18258
  Rl as F,
18257
- Kf as G,
18258
- Bh as H,
18259
- uf as I,
18260
- pf as J,
18261
- df as K,
18262
- lf as L,
18259
+ Gf as G,
18260
+ Fh as H,
18261
+ df as I,
18262
+ mf as J,
18263
+ hf as K,
18264
+ cf as L,
18263
18265
  ac as M,
18264
- of as N,
18265
- yf as O,
18266
- mf as P,
18267
- sf as Q,
18268
- nf as R,
18269
- wf as S,
18266
+ sf as N,
18267
+ vf as O,
18268
+ gf as P,
18269
+ af as Q,
18270
+ of as R,
18271
+ _f as S,
18270
18272
  _d as T,
18271
- Zh as U,
18272
- cf as V,
18273
- Ch as a,
18273
+ ef as U,
18274
+ uf as V,
18275
+ Ph as a,
18274
18276
  Id as b,
18275
- Oh as c,
18276
- Vh as d,
18277
- Th as e,
18278
- Yh as f,
18279
- Wh as g,
18280
- $h as h,
18281
- Gh as i,
18282
- Kh as j,
18277
+ Mh as c,
18278
+ Kh as d,
18279
+ Ch as e,
18280
+ Jh as f,
18281
+ zh as g,
18282
+ qh as h,
18283
+ Yh as i,
18284
+ Gh as j,
18283
18285
  sc as k,
18284
18286
  oc as l,
18285
18287
  lc as m,
18286
- Af as n,
18288
+ If as n,
18287
18289
  Xe as o,
18288
- Of as p,
18289
- Vf as q,
18290
- vf as r,
18291
- _f as s,
18290
+ Mf as p,
18291
+ Kf as q,
18292
+ wf as r,
18293
+ kf as s,
18292
18294
  Nl as t,
18293
18295
  Od as u,
18294
18296
  Ld as v,
18295
- Pf as w,
18297
+ Of as w,
18296
18298
  Ed as x,
18297
18299
  Sd as y,
18298
18300
  xd as z