@aikaara/chat-sdk 1.4.27 → 1.4.28

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.
@@ -11965,7 +11965,7 @@ function Ah(s) {
11965
11965
  }
11966
11966
  };
11967
11967
  }
11968
- const Ih = "^[A-Z]{4}0[A-Z0-9]{6}$", Th = {
11968
+ const Ih = "^[A-Z]{4}[0-9]{5}[A-Z]$", Th = "^[A-Z]{4}0[A-Z0-9]{6}$", Ch = {
11969
11969
  id: "salary-hra",
11970
11970
  title: "Salary / HRA / Allowances",
11971
11971
  icon: "💰",
@@ -11973,18 +11973,35 @@ const Ih = "^[A-Z]{4}0[A-Z0-9]{6}$", Th = {
11973
11973
  repeatable: { maxCount: 4, labelTemplate: "Employer {index}" },
11974
11974
  entryIcon: "🏢",
11975
11975
  fields: [
11976
+ {
11977
+ id: "employerDetails",
11978
+ type: "group",
11979
+ title: "Employer Details",
11980
+ fields: [
11981
+ { id: "employerName", type: "text", label: "Employer Name", required: !0 },
11982
+ {
11983
+ id: "employerTan",
11984
+ type: "text",
11985
+ // Optional: the pattern check only fires on a non-empty value, so a
11986
+ // blank TAN saves cleanly while a malformed one is still caught.
11987
+ label: "TAN (Tax Deduction Account Number)",
11988
+ pattern: Ih,
11989
+ maxLength: 10
11990
+ }
11991
+ ]
11992
+ },
11976
11993
  {
11977
11994
  id: "salaryComponents",
11978
11995
  type: "group",
11979
11996
  title: "Salary Components",
11980
11997
  fields: [
11981
11998
  { id: "grossSalary", type: "number", label: "Gross Salary (Total)", currency: "₹", min: 0 },
11982
- { id: "totalTdsDeposited", type: "number", label: "TDS Deducted by Employer", currency: "₹", min: 0 }
11999
+ { id: "totalTdsDeposited", type: "number", label: "TDS Deducted", currency: "₹", min: 0 }
11983
12000
  ]
11984
12001
  }
11985
12002
  ],
11986
12003
  submitLabel: "Save"
11987
- }, Ch = {
12004
+ }, Oh = {
11988
12005
  id: "other-sources",
11989
12006
  title: "Income from Other Sources",
11990
12007
  icon: "💵",
@@ -12009,7 +12026,7 @@ const Ih = "^[A-Z]{4}0[A-Z0-9]{6}$", Th = {
12009
12026
  }
12010
12027
  ],
12011
12028
  submitLabel: "Save"
12012
- }, Oh = {
12029
+ }, Ph = {
12013
12030
  id: "business-profession",
12014
12031
  title: "Business / Profession",
12015
12032
  icon: "💼",
@@ -12027,7 +12044,7 @@ const Ih = "^[A-Z]{4}0[A-Z0-9]{6}$", Th = {
12027
12044
  }
12028
12045
  ],
12029
12046
  submitLabel: "Save"
12030
- }, Ph = {
12047
+ }, Mh = {
12031
12048
  id: "bank-details",
12032
12049
  title: "Personal / Bank Details",
12033
12050
  icon: "🏦",
@@ -12039,7 +12056,7 @@ const Ih = "^[A-Z]{4}0[A-Z0-9]{6}$", Th = {
12039
12056
  fields: [
12040
12057
  { id: "aadhaarNumber", type: "text", label: "Aadhaar Number", maxLength: 12 },
12041
12058
  { id: "bankAccountNumber", type: "text", label: "Bank Account Number", required: !0 },
12042
- { id: "bankIfscCode", type: "text", label: "IFSC Code", required: !0, pattern: Ih, maxLength: 11 }
12059
+ { id: "bankIfscCode", type: "text", label: "IFSC Code", required: !0, pattern: Th, maxLength: 11 }
12043
12060
  ]
12044
12061
  }
12045
12062
  // Hidden for now — re-enable to restore the Immovable Assets group.
@@ -12060,11 +12077,11 @@ const Ih = "^[A-Z]{4}0[A-Z0-9]{6}$", Th = {
12060
12077
  // },
12061
12078
  ],
12062
12079
  submitLabel: "Save"
12063
- }, Mh = [
12064
- Th,
12065
- Oh,
12080
+ }, Rh = [
12066
12081
  Ch,
12067
- Ph
12082
+ Ph,
12083
+ Oh,
12084
+ Mh
12068
12085
  // Hidden for now — re-enable to restore the full set:
12069
12086
  // capitalGains,
12070
12087
  // cryptoIncome,
@@ -12075,7 +12092,7 @@ const Ih = "^[A-Z]{4}0[A-Z0-9]{6}$", Th = {
12075
12092
  // taxPaidTds,
12076
12093
  // haveAQuestion,
12077
12094
  ];
12078
- function Rh(s, e) {
12095
+ function Lh(s, e) {
12079
12096
  const t = s || {}, r = {
12080
12097
  userId: lr(e.userId),
12081
12098
  assessmentYear: e.assessmentYear,
@@ -12096,9 +12113,9 @@ function Rh(s, e) {
12096
12113
  amount: Ce(t.immovableAssetCost)
12097
12114
  };
12098
12115
  Object.values(o).some((a) => a !== void 0) && (r.immovableAsset = [o]);
12099
- const n = nn(t.hpDetails, Lh);
12116
+ const n = nn(t.hpDetails, Nh);
12100
12117
  n.length && (r.hpDetails = n);
12101
- const i = nn(t.salaryDetails, Nh);
12118
+ const i = nn(t.salaryDetails, jh);
12102
12119
  if (i.length) {
12103
12120
  r.salaryIncome = i;
12104
12121
  const a = nn(t.salaryDetails, (c) => ({
@@ -12111,13 +12128,13 @@ function Rh(s, e) {
12111
12128
  }
12112
12129
  return Wr(r);
12113
12130
  }
12114
- function Lh(s) {
12131
+ function Nh(s) {
12115
12132
  const e = {
12116
12133
  loanType: "HOME_LOAN",
12117
12134
  loanTakenFrom: Pe(s.loanTakenFrom),
12118
12135
  bankOrInstituteName: Pe(s.lenderName),
12119
12136
  loanAccountNo: Pe(s.loanAccountNumber),
12120
- loanSanctionDate: Fh(s.sanctionDate),
12137
+ loanSanctionDate: $h(s.sanctionDate),
12121
12138
  totalLoanAmount: Ce(s.totalLoanAmount),
12122
12139
  interest: Ce(s.homeLoanInterest)
12123
12140
  }, t = Object.entries(e).some(([r, o]) => r !== "loanType" && o !== void 0);
@@ -12138,7 +12155,7 @@ function Lh(s) {
12138
12155
  loanDetails: t ? [e] : void 0
12139
12156
  };
12140
12157
  }
12141
- function Nh(s) {
12158
+ function jh(s) {
12142
12159
  return {
12143
12160
  grossSalaryIncome: Ce(s.grossSalary),
12144
12161
  salary: Ce(s.basicSalary),
@@ -12154,7 +12171,7 @@ function Nh(s) {
12154
12171
  }
12155
12172
  };
12156
12173
  }
12157
- function jh(s, e) {
12174
+ function Uh(s, e) {
12158
12175
  const t = [];
12159
12176
  for (const r of s) {
12160
12177
  const o = Pe(r.employerName), n = Pe(r.employerTan), i = Ce(r.grossSalary), a = Ce(r.basicSalary), l = Ce(r.totalTdsDeposited);
@@ -12173,7 +12190,7 @@ function jh(s, e) {
12173
12190
  salary: t
12174
12191
  } : null;
12175
12192
  }
12176
- function Uh(s, e) {
12193
+ function Bh(s, e) {
12177
12194
  const t = Pe(s.aadhaarNumber), r = Pe(s.bankAccountNumber), o = Pe(s.bankIfscCode);
12178
12195
  return t === void 0 && r === void 0 && o === void 0 ? null : {
12179
12196
  userId: lr(e.userId),
@@ -12182,7 +12199,7 @@ function Uh(s, e) {
12182
12199
  bankDetails: [{ bankAccountNumber: r, bankIfscCode: o }]
12183
12200
  };
12184
12201
  }
12185
- function Bh(s, e) {
12202
+ function Dh(s, e) {
12186
12203
  return {
12187
12204
  userId: lr(e.userId),
12188
12205
  assessmentYear: e.assessmentYear,
@@ -12192,7 +12209,7 @@ function Bh(s, e) {
12192
12209
  anyOtherIncome: Ce(s.anyOtherIncome) ?? 0
12193
12210
  };
12194
12211
  }
12195
- function Dh(s, e) {
12212
+ function Fh(s, e) {
12196
12213
  const t = Pe(s.businessType), r = Pe(s.natureOfBusiness), o = Ce(s.grossReceipts);
12197
12214
  return t === void 0 && r === void 0 && o === void 0 ? null : {
12198
12215
  userId: lr(e.userId),
@@ -12225,7 +12242,7 @@ function Pe(s) {
12225
12242
  function lo(s) {
12226
12243
  return s === !0 || s === !1 ? s : void 0;
12227
12244
  }
12228
- function Fh(s) {
12245
+ function $h(s) {
12229
12246
  const e = Pe(s);
12230
12247
  if (e)
12231
12248
  return e.includes("T") ? e : /^\d{4}-\d{2}-\d{2}$/.test(e) ? `${e}T00:00:00Z` : e;
@@ -12251,10 +12268,10 @@ function Wr(s) {
12251
12268
  }
12252
12269
  return s;
12253
12270
  }
12254
- function $h(s) {
12271
+ function qh(s) {
12255
12272
  const e = s && typeof s == "object" ? s : {}, t = {}, r = Ve(e.employers), o = Ve(e.taxPaid?.onSalary);
12256
12273
  r.length && (t.salaryDetails = r.map((u) => {
12257
- const h = on(u.salary), p = on(u.perquisites), b = on(u.profitsInLieuOfSalaryType), d = h + p + b, g = Hh(u.allowance);
12274
+ const h = on(u.salary), p = on(u.perquisites), b = on(u.profitsInLieuOfSalaryType), d = h + p + b, g = Wh(u.allowance);
12258
12275
  return {
12259
12276
  employerName: Le(u.employerName),
12260
12277
  employerTan: Le(u.employerTAN),
@@ -12265,7 +12282,7 @@ function $h(s) {
12265
12282
  leaveTravelAllowance: g.lta,
12266
12283
  leaveEncashment: g.leaveEncashment,
12267
12284
  anyOtherAllowance: g.other,
12268
- totalTdsDeposited: qh(u, o, r) ?? Ue(u.totalTdsDeposited)
12285
+ totalTdsDeposited: Hh(u, o, r) ?? Ue(u.totalTdsDeposited)
12269
12286
  };
12270
12287
  }));
12271
12288
  const n = Ve(e.houseProperties);
@@ -12312,7 +12329,7 @@ function $h(s) {
12312
12329
  function on(s) {
12313
12330
  return Ve(s).reduce((e, t) => e + (Ue(t.taxableAmount) ?? 0), 0);
12314
12331
  }
12315
- function qh(s, e, t) {
12332
+ function Hh(s, e, t) {
12316
12333
  if (!e.length) return;
12317
12334
  const r = Le(s.employerTAN)?.trim().toUpperCase();
12318
12335
  if (r) {
@@ -12327,7 +12344,7 @@ function qh(s, e, t) {
12327
12344
  if (t.length === 1 && e.length === 1)
12328
12345
  return Ue(e[0].totalTdsDeposited);
12329
12346
  }
12330
- function Hh(s) {
12347
+ function Wh(s) {
12331
12348
  const e = Ve(s);
12332
12349
  if (!e.length) return {};
12333
12350
  let t, r, o, n;
@@ -12382,23 +12399,23 @@ function sn() {
12382
12399
  return console.warn(
12383
12400
  "[smart-edit] API disabled: window.__aikaara_runtime__.getChatJwt is missing — the chat was not mounted via the SDK mountFromSlug path."
12384
12401
  ), null;
12385
- const t = s.__aikaara_descriptor__ ?? {}, r = Jh(t);
12402
+ const t = s.__aikaara_descriptor__ ?? {}, r = Qh(t);
12386
12403
  if (!r)
12387
12404
  return console.warn(
12388
12405
  "[smart-edit] API disabled: could not resolve a TaxBuddy API host from the descriptor (cloud / upload / pan / leader endpoints)."
12389
12406
  ), null;
12390
- const o = Qh(e.slug), n = typeof o?.tenantJwt == "string" ? o.tenantJwt : "", i = e.getChatJwt, a = async () => n || await i(), l = (o && o.userId != null && o.userId !== "" ? String(o.userId) : Zh(e.identity)) || void 0;
12407
+ const o = Xh(e.slug), n = typeof o?.tenantJwt == "string" ? o.tenantJwt : "", i = e.getChatJwt, a = async () => n || await i(), l = (o && o.userId != null && o.userId !== "" ? String(o.userId) : ed(e.identity)) || void 0;
12391
12408
  return console.info("[smart-edit] API config — base:", r, "· userId:", l ?? "(none)"), {
12392
12409
  baseUrl: r,
12393
12410
  getToken: a,
12394
- headers: Xh(t.auth?.headers),
12395
- assessmentYear: t.itr?.assessmentYear || ed(),
12411
+ headers: Zh(t.auth?.headers),
12412
+ assessmentYear: t.itr?.assessmentYear || td(),
12396
12413
  isRevised: "N",
12397
12414
  userId: l,
12398
12415
  submitUrl: t.itr?.automationSubmitUrl || void 0
12399
12416
  };
12400
12417
  }
12401
- async function Wh(s) {
12418
+ async function zh(s) {
12402
12419
  const e = await s.getToken(), t = s.userId;
12403
12420
  if (!t)
12404
12421
  throw new Error(
@@ -12416,10 +12433,10 @@ async function Wh(s) {
12416
12433
  const o = await r.text().catch(() => "");
12417
12434
  throw new Error(`[smart-edit] GET /itr/latest-itr → ${r.status} ${o.slice(0, 200)}`);
12418
12435
  }
12419
- return $h(Ao(await r.json().catch(() => ({}))));
12436
+ return qh(Ao(await r.json().catch(() => ({}))));
12420
12437
  }
12421
- async function zh(s, e) {
12422
- const t = await s.getToken(), r = s.userId, o = Rh(e, {
12438
+ async function Vh(s, e) {
12439
+ const t = await s.getToken(), r = s.userId, o = Lh(e, {
12423
12440
  userId: r,
12424
12441
  assessmentYear: s.assessmentYear,
12425
12442
  isRevised: s.isRevised
@@ -12441,16 +12458,16 @@ async function zh(s, e) {
12441
12458
  }
12442
12459
  return Ao(await a.json().catch(() => ({})));
12443
12460
  }
12444
- async function Vh(s, e) {
12461
+ async function Kh(s, e) {
12445
12462
  return Qr(s, `${s.baseUrl}/itr/v1/automation/salary`, e);
12446
12463
  }
12447
- async function Kh(s, e) {
12464
+ async function Gh(s, e) {
12448
12465
  return Qr(s, `${s.baseUrl}/itr/v1/automation/bank-aadhaar`, e);
12449
12466
  }
12450
- async function Gh(s, e) {
12467
+ async function Yh(s, e) {
12451
12468
  return Qr(s, s.submitUrl || `${s.baseUrl}/itr/v1/automation/data`, e);
12452
12469
  }
12453
- async function Yh(s, e) {
12470
+ async function Jh(s, e) {
12454
12471
  return Qr(s, s.submitUrl || `${s.baseUrl}/itr/v1/automation/data`, e);
12455
12472
  }
12456
12473
  async function Qr(s, e, t) {
@@ -12468,7 +12485,7 @@ async function Qr(s, e, t) {
12468
12485
  }
12469
12486
  return Ao(await n.json().catch(() => ({})));
12470
12487
  }
12471
- function Jh(s) {
12488
+ function Qh(s) {
12472
12489
  const e = [
12473
12490
  s.cloud?.listEndpoint,
12474
12491
  s.cloud?.downloadEndpoint,
@@ -12486,7 +12503,7 @@ function Jh(s) {
12486
12503
  }
12487
12504
  return null;
12488
12505
  }
12489
- function Qh(s) {
12506
+ function Xh(s) {
12490
12507
  if (!s || typeof localStorage > "u") return null;
12491
12508
  try {
12492
12509
  const e = localStorage.getItem(`aikaara_sso:${s}`);
@@ -12497,7 +12514,7 @@ function Qh(s) {
12497
12514
  return null;
12498
12515
  }
12499
12516
  }
12500
- function Xh(s) {
12517
+ function Zh(s) {
12501
12518
  const e = {};
12502
12519
  if (!s) return e;
12503
12520
  const t = /^(authorization|content-type|accept)$/i;
@@ -12505,7 +12522,7 @@ function Xh(s) {
12505
12522
  !t.test(r) && typeof o == "string" && (e[r] = o);
12506
12523
  return e;
12507
12524
  }
12508
- function Zh(s) {
12525
+ function ed(s) {
12509
12526
  if (!s) return;
12510
12527
  const e = s.userId ?? s.id ?? s.ext_uid ?? s.extUid;
12511
12528
  return e == null || e === "" ? void 0 : String(e);
@@ -12517,11 +12534,11 @@ function Ao(s) {
12517
12534
  }
12518
12535
  return {};
12519
12536
  }
12520
- function ed() {
12537
+ function td() {
12521
12538
  const s = /* @__PURE__ */ new Date(), e = s.getMonth() >= 3 ? s.getFullYear() : s.getFullYear() - 1;
12522
12539
  return `${e}-${e + 1}`;
12523
12540
  }
12524
- class td {
12541
+ class rd {
12525
12542
  client;
12526
12543
  panel;
12527
12544
  bubble;
@@ -12660,11 +12677,11 @@ class td {
12660
12677
  */
12661
12678
  async openSmartEdit() {
12662
12679
  const e = this.ensureSmartEditModal();
12663
- e.open({ schemas: Mh, data: {} });
12680
+ e.open({ schemas: Rh, data: {} });
12664
12681
  const t = sn();
12665
12682
  if (!(!t || !t.baseUrl))
12666
12683
  try {
12667
- const r = await Wh(t);
12684
+ const r = await zh(t);
12668
12685
  e.setData(r);
12669
12686
  } catch (r) {
12670
12687
  console.warn("[smart-edit] fetch failed", r), this.errorBanner.show(
@@ -12697,16 +12714,16 @@ class td {
12697
12714
  const o = { userId: r.userId, assessmentYear: r.assessmentYear };
12698
12715
  try {
12699
12716
  if (e === "salary-hra") {
12700
- const n = Array.isArray(t.salaryDetails) ? t.salaryDetails : [], i = jh(n, o);
12701
- i && await Vh(r, i);
12717
+ const n = Array.isArray(t.salaryDetails) ? t.salaryDetails : [], i = Uh(n, o);
12718
+ i && await Kh(r, i);
12702
12719
  } else if (e === "bank-details") {
12703
- const n = Uh(t, o);
12704
- n && await Kh(r, n);
12720
+ const n = Bh(t, o);
12721
+ n && await Gh(r, n);
12705
12722
  } else if (e === "other-sources")
12706
- await Gh(r, Bh(t, o));
12723
+ await Yh(r, Dh(t, o));
12707
12724
  else if (e === "business-profession") {
12708
- const n = Dh(t, o);
12709
- n && await Yh(r, n);
12725
+ const n = Fh(t, o);
12726
+ n && await Jh(r, n);
12710
12727
  }
12711
12728
  } catch (n) {
12712
12729
  console.warn("[smart-edit] section save failed", e, n), this.errorBanner.show("Failed to save. Please try again.", 4e3);
@@ -12726,7 +12743,7 @@ class td {
12726
12743
  return;
12727
12744
  }
12728
12745
  try {
12729
- await zh(t, e);
12746
+ await Vh(t, e);
12730
12747
  } catch (r) {
12731
12748
  console.warn("[smart-edit] save failed", r), this.errorBanner.show(
12732
12749
  "Failed to save your ITR details. Please try again.",
@@ -12742,7 +12759,7 @@ class td {
12742
12759
  }, 200)));
12743
12760
  }
12744
12761
  }
12745
- class rd extends HTMLElement {
12762
+ class nd extends HTMLElement {
12746
12763
  shadow;
12747
12764
  controller = null;
12748
12765
  _config = {};
@@ -13011,7 +13028,7 @@ class rd extends HTMLElement {
13011
13028
  }
13012
13029
  async initController() {
13013
13030
  const e = this.getConfig(), t = e.transport ?? "aikaara";
13014
- (t === "aikaara" || t === "dual") && (!e.baseUrl || !e.userToken) || (this.controller?.disconnect(), this.controller = new td(e, this.shadow, {
13031
+ (t === "aikaara" || t === "dual") && (!e.baseUrl || !e.userToken) || (this.controller?.disconnect(), this.controller = new rd(e, this.shadow, {
13015
13032
  uploadAdapter: this._config.uploadAdapter,
13016
13033
  historyAdapter: this._config.historyAdapter
13017
13034
  }), await this.controller.connect());
@@ -13031,7 +13048,7 @@ class rd extends HTMLElement {
13031
13048
  }
13032
13049
  }
13033
13050
  }
13034
- class nd extends HTMLElement {
13051
+ class id extends HTMLElement {
13035
13052
  shadow;
13036
13053
  constructor() {
13037
13054
  super(), this.shadow = this.attachShadow({ mode: "open" });
@@ -13084,12 +13101,12 @@ class nd extends HTMLElement {
13084
13101
  t && (t.innerHTML = e);
13085
13102
  }
13086
13103
  }
13087
- const id = [
13104
+ const od = [
13088
13105
  { id: "edit-itr", label: "Edit ITR Details", icon: "edit" }
13089
13106
  ];
13090
- class od extends HTMLElement {
13107
+ class sd extends HTMLElement {
13091
13108
  shadow;
13092
- actions = id;
13109
+ actions = od;
13093
13110
  menuOpen = !1;
13094
13111
  outsideClickHandler = null;
13095
13112
  static get observedAttributes() {
@@ -13315,7 +13332,7 @@ class od extends HTMLElement {
13315
13332
  this.setAttribute("status", e);
13316
13333
  }
13317
13334
  }
13318
- const sd = /<\s*(br|i|b|em|strong|small|sub|sup|p|div|span|ul|ol|li|a|img|code|pre)\b/i, ad = /&(quot|apos|amp|lt|gt|nbsp|#\d+|#x[0-9a-f]+);/i, ld = {
13335
+ const ad = /<\s*(br|i|b|em|strong|small|sub|sup|p|div|span|ul|ol|li|a|img|code|pre)\b/i, ld = /&(quot|apos|amp|lt|gt|nbsp|#\d+|#x[0-9a-f]+);/i, cd = {
13319
13336
  "&quot;": '"',
13320
13337
  "&apos;": "'",
13321
13338
  "&lt;": "<",
@@ -13323,14 +13340,14 @@ const sd = /<\s*(br|i|b|em|strong|small|sub|sup|p|div|span|ul|ol|li|a|img|code|p
13323
13340
  "&amp;": "&",
13324
13341
  "&nbsp;": " "
13325
13342
  };
13326
- function cd(s) {
13327
- return s.replace(/&(quot|apos|lt|gt|nbsp);/gi, (e) => ld[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, "&");
13343
+ function ud(s) {
13344
+ return s.replace(/&(quot|apos|lt|gt|nbsp);/gi, (e) => cd[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, "&");
13328
13345
  }
13329
13346
  function $t(s) {
13330
- if (sd.test(s))
13347
+ if (ad.test(s))
13331
13348
  return s;
13332
- const e = ad.test(s) ? cd(s) : s;
13333
- let t = ud(e);
13349
+ const e = ld.test(s) ? ud(s) : s;
13350
+ let t = hd(e);
13334
13351
  return t = t.replace(/```(\w*)\n([\s\S]*?)```/g, (r, o, 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(
13335
13352
  /\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)/g,
13336
13353
  '<a href="$2" target="_self" rel="noopener noreferrer">$1</a>'
@@ -13342,7 +13359,7 @@ function $t(s) {
13342
13359
  }
13343
13360
  ), t = t.replace(/\n/g, "<br>"), t;
13344
13361
  }
13345
- function ud(s) {
13362
+ function hd(s) {
13346
13363
  const e = {
13347
13364
  "&": "&amp;",
13348
13365
  "<": "&lt;",
@@ -13352,7 +13369,7 @@ function ud(s) {
13352
13369
  };
13353
13370
  return s.replace(/[&<>"']/g, (t) => e[t]);
13354
13371
  }
13355
- const hd = /* @__PURE__ */ new Set([
13372
+ const dd = /* @__PURE__ */ new Set([
13356
13373
  "p",
13357
13374
  "br",
13358
13375
  "hr",
@@ -13387,7 +13404,7 @@ const hd = /* @__PURE__ */ new Set([
13387
13404
  "tr",
13388
13405
  "th",
13389
13406
  "td"
13390
- ]), dd = {
13407
+ ]), fd = {
13391
13408
  a: /* @__PURE__ */ new Set(["href", "target", "rel"]),
13392
13409
  img: /* @__PURE__ */ new Set(["src", "alt", "width", "height"]),
13393
13410
  code: /* @__PURE__ */ new Set(["class"]),
@@ -13404,12 +13421,12 @@ function Ll(s) {
13404
13421
  for (const t of e)
13405
13422
  if (t.nodeType === Node.ELEMENT_NODE) {
13406
13423
  const r = t, o = r.tagName.toLowerCase();
13407
- if (!hd.has(o)) {
13424
+ if (!dd.has(o)) {
13408
13425
  const a = document.createTextNode(r.textContent || "");
13409
13426
  s.replaceChild(a, t);
13410
13427
  continue;
13411
13428
  }
13412
- const n = dd[o] || /* @__PURE__ */ new Set(), i = Array.from(r.attributes);
13429
+ const n = fd[o] || /* @__PURE__ */ new Set(), i = Array.from(r.attributes);
13413
13430
  for (const a of i)
13414
13431
  n.has(a.name) || r.removeAttribute(a.name);
13415
13432
  if (r.hasAttribute("href")) {
@@ -13419,7 +13436,7 @@ function Ll(s) {
13419
13436
  Ll(t);
13420
13437
  }
13421
13438
  }
13422
- function fd(s, e = {}) {
13439
+ function pd(s, e = {}) {
13423
13440
  const { width: t = 600, height: r = 700, closeOnTypes: o } = e, n = Math.round(window.screenX + (window.outerWidth - t) / 2), i = Math.round(window.screenY + (window.outerHeight - r) / 2), a = window.open(
13424
13441
  s,
13425
13442
  "aikaara_popup",
@@ -13437,7 +13454,7 @@ function fd(s, e = {}) {
13437
13454
  }, 500);
13438
13455
  return a;
13439
13456
  }
13440
- function pd(s) {
13457
+ function md(s) {
13441
13458
  const e = Date.now() - s.getTime(), t = Math.round(e / 1e3);
13442
13459
  if (t < 5) return "just now";
13443
13460
  if (t < 60) return `${t}s ago`;
@@ -13448,7 +13465,7 @@ function pd(s) {
13448
13465
  const n = Math.round(o / 24);
13449
13466
  return n === 1 ? "Yesterday" : n < 7 ? `${n} d ago` : s.toLocaleDateString(void 0, { month: "short", day: "2-digit" });
13450
13467
  }
13451
- class md extends HTMLElement {
13468
+ class gd extends HTMLElement {
13452
13469
  shadow;
13453
13470
  container;
13454
13471
  welcomeMessage = "";
@@ -13701,7 +13718,7 @@ class md extends HTMLElement {
13701
13718
  if (n.role === "user") {
13702
13719
  const i = n.metadata?.attributes?.action;
13703
13720
  if (i) {
13704
- const a = gd(i);
13721
+ const a = bd(i);
13705
13722
  if (i.message_id && t.set(i.message_id, a), Object.keys(a).length > 0)
13706
13723
  for (let l = o - 1; l >= 0; l--) {
13707
13724
  const c = e[l];
@@ -13839,7 +13856,7 @@ class md extends HTMLElement {
13839
13856
  case "date":
13840
13857
  return r;
13841
13858
  case "relative":
13842
- return pd(t);
13859
+ return md(t);
13843
13860
  case "time-24":
13844
13861
  return t.toLocaleTimeString(void 0, { hour: "2-digit", minute: "2-digit", hour12: !1 });
13845
13862
  case "time-seconds":
@@ -13865,7 +13882,7 @@ class md extends HTMLElement {
13865
13882
  return;
13866
13883
  }
13867
13884
  if (o === "popup") {
13868
- fd(e);
13885
+ pd(e);
13869
13886
  return;
13870
13887
  }
13871
13888
  const n = this.getOrCreateModal(), i = r?.title ?? t ?? "Link";
@@ -13873,7 +13890,7 @@ class md extends HTMLElement {
13873
13890
  requestAnimationFrame(() => n.show?.(e, i));
13874
13891
  return;
13875
13892
  }
13876
- const a = bd(e), l = Nl(r.fetch.url, a), c = {
13893
+ const a = yd(e), l = Nl(r.fetch.url, a), c = {
13877
13894
  accept: "application/json",
13878
13895
  ...r.fetch.headers ?? {}
13879
13896
  }, u = r.fetch.authHeader ?? "session";
@@ -13919,7 +13936,7 @@ class md extends HTMLElement {
13919
13936
  return e || (e = document.createElement("aikaara-link-modal"), document.body.appendChild(e)), e;
13920
13937
  }
13921
13938
  }
13922
- function gd(s) {
13939
+ function bd(s) {
13923
13940
  const e = /* @__PURE__ */ new Set(["message_id", "formAction", "requestType"]), t = {};
13924
13941
  for (const [r, o] of Object.entries(s))
13925
13942
  e.has(r) || (Array.isArray(o) && o.every((n) => typeof n == "string") ? t[r] = o : typeof o == "string" && (t[r] = [o]));
@@ -13929,7 +13946,7 @@ function zs(s, e) {
13929
13946
  const t = e.replace(/[.+^${}()|[\]\\]/g, "\\$&");
13930
13947
  return new RegExp("^" + t.replace(/\*/g, ".*").replace(/\?/g, ".") + "$", "i").test(s);
13931
13948
  }
13932
- function bd(s) {
13949
+ function yd(s) {
13933
13950
  try {
13934
13951
  const e = new URL(s), t = {};
13935
13952
  return e.searchParams.forEach((r, o) => {
@@ -13952,7 +13969,7 @@ function co(s, e) {
13952
13969
  }
13953
13970
  return s;
13954
13971
  }
13955
- class yd extends HTMLElement {
13972
+ class vd extends HTMLElement {
13956
13973
  shadow;
13957
13974
  templatePayload = null;
13958
13975
  attachments = [];
@@ -14068,7 +14085,7 @@ class yd extends HTMLElement {
14068
14085
  renderAttachments() {
14069
14086
  return this.attachments.length ? `<div class="attachments">${this.attachments.map(
14070
14087
  (t) => `<a class="attachment" href="${Vs(t.fileUrl)}" target="_blank" rel="noopener noreferrer">
14071
- 📎 ${vd(t.fileName)}
14088
+ 📎 ${wd(t.fileName)}
14072
14089
  </a>`
14073
14090
  ).join("")}</div>` : "";
14074
14091
  }
@@ -14076,10 +14093,10 @@ class yd extends HTMLElement {
14076
14093
  function Vs(s) {
14077
14094
  return String(s).replace(/[&<>"']/g, (e) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" })[e]);
14078
14095
  }
14079
- function vd(s) {
14096
+ function wd(s) {
14080
14097
  return String(s).replace(/[&<>]/g, (e) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;" })[e]);
14081
14098
  }
14082
- class wd extends HTMLElement {
14099
+ class _d extends HTMLElement {
14083
14100
  shadow;
14084
14101
  textarea;
14085
14102
  sendBtn;
@@ -14230,7 +14247,7 @@ class wd extends HTMLElement {
14230
14247
  this.textarea.style.height = "auto", this.textarea.style.height = Math.min(this.textarea.scrollHeight, 120) + "px";
14231
14248
  }
14232
14249
  }
14233
- class _d extends HTMLElement {
14250
+ class kd extends HTMLElement {
14234
14251
  shadow;
14235
14252
  constructor() {
14236
14253
  super(), this.shadow = this.attachShadow({ mode: "open" });
@@ -14279,7 +14296,7 @@ class _d extends HTMLElement {
14279
14296
  this.removeAttribute("visible");
14280
14297
  }
14281
14298
  }
14282
- class kd extends HTMLElement {
14299
+ class xd extends HTMLElement {
14283
14300
  shadow;
14284
14301
  bubble;
14285
14302
  constructor() {
@@ -14344,7 +14361,7 @@ class kd extends HTMLElement {
14344
14361
  this.bubble?.classList.remove("cursor");
14345
14362
  }
14346
14363
  }
14347
- class xd extends HTMLElement {
14364
+ class Sd extends HTMLElement {
14348
14365
  shadow;
14349
14366
  container;
14350
14367
  dismissTimer = null;
@@ -14417,7 +14434,7 @@ function jl(s) {
14417
14434
  });
14418
14435
  return an.set(s, t), t;
14419
14436
  }
14420
- function Sd(s, e = 5e3) {
14437
+ function Ed(s, e = 5e3) {
14421
14438
  return new Promise((t, r) => {
14422
14439
  const o = setTimeout(() => r(new Error(`Custom element <${s}> not registered within ${e}ms`)), e);
14423
14440
  customElements.whenDefined(s).then(() => {
@@ -14425,14 +14442,14 @@ function Sd(s, e = 5e3) {
14425
14442
  });
14426
14443
  });
14427
14444
  }
14428
- const Ed = {
14445
+ const Ad = {
14429
14446
  "aikaara-template-payment-link": () => import("./AikaaraPaymentLink-C82ApGKH.mjs").then(({ registerAikaaraPaymentLink: s }) => s())
14430
14447
  };
14431
- function Ad(s) {
14448
+ function Id(s) {
14432
14449
  const e = `template:${s}`, t = window.__aikaara_descriptor__?.components?.[e];
14433
14450
  return t && t.kind === "iife-element" ? { render: t.tag, scriptUrl: t.scriptUrl, props: t.props } : window.__aikaara_descriptor__?.templates?.[s];
14434
14451
  }
14435
- class Id extends HTMLElement {
14452
+ class Td extends HTMLElement {
14436
14453
  shadow;
14437
14454
  payloadData = null;
14438
14455
  innerMessage = "";
@@ -14456,7 +14473,7 @@ class Id extends HTMLElement {
14456
14473
  this.render(), this.addEventListener("template-action", (e) => {
14457
14474
  const t = e.detail, r = this.getAttribute("message-id");
14458
14475
  if (r && t?.attributes?.action) {
14459
- const o = Od(t.attributes.action);
14476
+ const o = Pd(t.attributes.action);
14460
14477
  if (Object.keys(o).length > 0)
14461
14478
  try {
14462
14479
  localStorage.setItem(`aikaara_form:${r}`, JSON.stringify(o));
@@ -14532,8 +14549,8 @@ class Id extends HTMLElement {
14532
14549
  <slot></slot>
14533
14550
  `; this.firstChild; ) this.removeChild(this.firstChild);
14534
14551
  if (!e) return;
14535
- const r = t ? Ad(t) : void 0, o = r?.render ?? (t ? `aikaara-template-${t}` : `aikaara-template-${e}`), n = Ed[o];
14536
- if (n && !customElements.get(o) ? n().then(() => this.render()).catch((i) => console.warn(`[aikaara-template-renderer] native template ${o} failed to load`, i)) : r?.scriptUrl && !customElements.get(o) && jl(r.scriptUrl).then(() => Sd(o)).then(() => this.render()).catch((i) => console.warn(`[aikaara-template-renderer] failed to lazy-load ${r.scriptUrl}`, i)), customElements.get(o)) {
14552
+ const r = t ? Id(t) : void 0, o = r?.render ?? (t ? `aikaara-template-${t}` : `aikaara-template-${e}`), n = Ad[o];
14553
+ if (n && !customElements.get(o) ? n().then(() => this.render()).catch((i) => console.warn(`[aikaara-template-renderer] native template ${o} failed to load`, i)) : r?.scriptUrl && !customElements.get(o) && jl(r.scriptUrl).then(() => Ed(o)).then(() => this.render()).catch((i) => console.warn(`[aikaara-template-renderer] failed to lazy-load ${r.scriptUrl}`, i)), customElements.get(o)) {
14537
14554
  const i = document.createElement(o);
14538
14555
  if (r?.props) {
14539
14556
  for (const [a, l] of Object.entries(r.props))
@@ -14620,7 +14637,7 @@ class Id extends HTMLElement {
14620
14637
  */
14621
14638
  mountLinkButton(e) {
14622
14639
  const t = this.renderGen;
14623
- import("./AikaaraLinkButton-D2YN-kYl.mjs").then(({ registerAikaaraLinkButton: r, AikaaraLinkButton: o }) => {
14640
+ import("./AikaaraLinkButton-5TmYshmj.mjs").then(({ registerAikaaraLinkButton: r, AikaaraLinkButton: o }) => {
14624
14641
  if (t !== this.renderGen) return;
14625
14642
  r();
14626
14643
  const n = document.createElement("aikaara-link-button");
@@ -14629,7 +14646,7 @@ class Id extends HTMLElement {
14629
14646
  url: e.url ?? "",
14630
14647
  openLinkInNewTab: e.openLinkInNewTab,
14631
14648
  orderId: e.orderId,
14632
- extra: Cd(e),
14649
+ extra: Od(e),
14633
14650
  messageId: this.getAttribute("message-id") ?? void 0
14634
14651
  }), this.appendChild(n);
14635
14652
  });
@@ -14639,26 +14656,26 @@ class Id extends HTMLElement {
14639
14656
  t.setPayload(e), this.appendChild(t);
14640
14657
  }
14641
14658
  }
14642
- const Td = /* @__PURE__ */ new Set([
14659
+ const Cd = /* @__PURE__ */ new Set([
14643
14660
  "type",
14644
14661
  "url",
14645
14662
  "name",
14646
14663
  "openLinkInNewTab",
14647
14664
  "orderId"
14648
14665
  ]);
14649
- function Cd(s) {
14666
+ function Od(s) {
14650
14667
  const e = {};
14651
14668
  for (const [t, r] of Object.entries(s))
14652
- Td.has(t) || (e[t] = r);
14669
+ Cd.has(t) || (e[t] = r);
14653
14670
  return e;
14654
14671
  }
14655
- function Od(s) {
14672
+ function Pd(s) {
14656
14673
  const e = /* @__PURE__ */ new Set(["message_id", "formAction", "requestType", "serviceType"]), t = {};
14657
14674
  for (const [r, o] of Object.entries(s))
14658
14675
  e.has(r) || (Array.isArray(o) && o.every((n) => typeof n == "string") ? t[r] = o : typeof o == "string" && (t[r] = [o]));
14659
14676
  return t;
14660
14677
  }
14661
- class Pd extends HTMLElement {
14678
+ class Md extends HTMLElement {
14662
14679
  shadow;
14663
14680
  static get observedAttributes() {
14664
14681
  return ["text", "subtext"];
@@ -14707,7 +14724,7 @@ class Pd extends HTMLElement {
14707
14724
  function Ks(s) {
14708
14725
  return String(s).replace(/[&<>]/g, (e) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;" })[e]);
14709
14726
  }
14710
- class Md extends HTMLElement {
14727
+ class Rd extends HTMLElement {
14711
14728
  shadow;
14712
14729
  data = null;
14713
14730
  selected = /* @__PURE__ */ new Set();
@@ -14932,7 +14949,7 @@ function It(s) {
14932
14949
  function ln(s) {
14933
14950
  return String(s).replace(/[&<>"']/g, (e) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" })[e]);
14934
14951
  }
14935
- class Rd extends HTMLElement {
14952
+ class Ld extends HTMLElement {
14936
14953
  shadow;
14937
14954
  data = null;
14938
14955
  constructor() {
@@ -15001,14 +15018,14 @@ class Rd extends HTMLElement {
15001
15018
  button:hover { background: var(--aikaara-submit-hover-bg, var(--aikaara-primary-hover, #4f46e5)); }
15002
15019
  button:disabled { opacity: var(--aikaara-submit-disabled-opacity, 0.5); cursor: not-allowed; }
15003
15020
  </style>
15004
- <button type="button">${Ld(e)}</button>
15021
+ <button type="button">${Nd(e)}</button>
15005
15022
  `, this.shadow.querySelector("button").addEventListener("click", () => this.handleClick());
15006
15023
  }
15007
15024
  }
15008
- function Ld(s) {
15025
+ function Nd(s) {
15009
15026
  return String(s).replace(/[&<>]/g, (e) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;" })[e]);
15010
15027
  }
15011
- class Nd extends HTMLElement {
15028
+ class jd extends HTMLElement {
15012
15029
  shadow;
15013
15030
  data = null;
15014
15031
  dismissed = !1;
@@ -15100,7 +15117,7 @@ class Nd extends HTMLElement {
15100
15117
  function cn(s) {
15101
15118
  return String(s).replace(/[&<>]/g, (e) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;" })[e]);
15102
15119
  }
15103
- class jd extends HTMLElement {
15120
+ class Ud extends HTMLElement {
15104
15121
  shadow;
15105
15122
  data = null;
15106
15123
  _value = "";
@@ -15207,7 +15224,7 @@ function Xt(s) {
15207
15224
  (e) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" })[e]
15208
15225
  );
15209
15226
  }
15210
- class Ud extends HTMLElement {
15227
+ class Bd extends HTMLElement {
15211
15228
  static get observedAttributes() {
15212
15229
  return ["slug", "user-id", "user-name", "user-token", "department-id", "config-base", "api-key"];
15213
15230
  }
@@ -15261,7 +15278,7 @@ class Ud extends HTMLElement {
15261
15278
  const l = Object.keys(n).length > 0 ? n : void 0;
15262
15279
  return this.mountInflight = (async () => {
15263
15280
  try {
15264
- this.mounted = await vf({
15281
+ this.mounted = await wf({
15265
15282
  container: this,
15266
15283
  slug: e,
15267
15284
  configBase: this.getAttribute("config-base") ?? void 0,
@@ -15290,7 +15307,7 @@ class Ud extends HTMLElement {
15290
15307
  })(), this.mountInflight;
15291
15308
  }
15292
15309
  }
15293
- class Bd extends HTMLElement {
15310
+ class Dd extends HTMLElement {
15294
15311
  shadow;
15295
15312
  root = null;
15296
15313
  iframe = null;
@@ -15407,7 +15424,7 @@ class Bd extends HTMLElement {
15407
15424
  });
15408
15425
  }
15409
15426
  }
15410
- const Dd = [
15427
+ const Fd = [
15411
15428
  { label: "Self-filing guidance" },
15412
15429
  { label: "Smart tax suggestions" },
15413
15430
  { label: "Auto-fetch 26AS / AIS" },
@@ -15415,7 +15432,7 @@ const Dd = [
15415
15432
  { label: "Dedicated tax expert" },
15416
15433
  { label: "End-to-end filing" },
15417
15434
  { label: "Document handling" }
15418
- ], Fd = [
15435
+ ], $d = [
15419
15436
  {
15420
15437
  label: "DIY",
15421
15438
  match: ["DIY", "DIY_SALARY"],
@@ -15438,11 +15455,11 @@ const Dd = [
15438
15455
  features: [!0, !0, !0, !0, !0, !0, !0]
15439
15456
  }
15440
15457
  ];
15441
- class $d extends HTMLElement {
15458
+ class qd extends HTMLElement {
15442
15459
  shadow;
15443
15460
  data = null;
15444
- columns = Fd;
15445
- features = Dd;
15461
+ columns = $d;
15462
+ features = Fd;
15446
15463
  constructor() {
15447
15464
  super(), this.shadow = this.attachShadow({ mode: "open" });
15448
15465
  }
@@ -15575,7 +15592,7 @@ function un(s) {
15575
15592
  (e) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" })[e]
15576
15593
  );
15577
15594
  }
15578
- class qd extends HTMLElement {
15595
+ class Hd extends HTMLElement {
15579
15596
  shadow;
15580
15597
  root = null;
15581
15598
  schemas = [];
@@ -15666,7 +15683,7 @@ class qd extends HTMLElement {
15666
15683
  `;
15667
15684
  const r = this.shadow.querySelector(".modal-body"), o = this.schemas.map(
15668
15685
  (i) => `
15669
- <button class="chip" type="button" data-section-id="${Wd(i.id)}">
15686
+ <button class="chip" type="button" data-section-id="${zd(i.id)}">
15670
15687
  <span class="chip-icon">${i.icon ?? "📄"}</span>
15671
15688
  <span class="chip-label">${Ys(i.title)}</span>
15672
15689
  </button>`
@@ -15699,7 +15716,7 @@ class qd extends HTMLElement {
15699
15716
  e.classList.remove("view-picker"), e.classList.add("view-form");
15700
15717
  const t = this.schemas.find((n) => n.id === this.activeSectionId), r = this.shadow.querySelector(".modal-header");
15701
15718
  r.innerHTML = `
15702
- <button class="icon-btn back-btn" type="button" aria-label="Back">${Hd}</button>
15719
+ <button class="icon-btn back-btn" type="button" aria-label="Back">${Wd}</button>
15703
15720
  <div class="modal-title">${Ys(t?.title ?? "Edit")}</div>
15704
15721
  <button class="icon-btn close-btn" type="button" aria-label="Close">${Gs}</button>
15705
15722
  `;
@@ -15875,14 +15892,14 @@ class qd extends HTMLElement {
15875
15892
  `;
15876
15893
  }
15877
15894
  }
15878
- const Gs = '<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>', Hd = '<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>';
15879
- function Wd(s) {
15895
+ const Gs = '<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>', Wd = '<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>';
15896
+ function zd(s) {
15880
15897
  return s.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
15881
15898
  }
15882
15899
  function Ys(s) {
15883
15900
  return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
15884
15901
  }
15885
- class zd extends HTMLElement {
15902
+ class Vd extends HTMLElement {
15886
15903
  shadow;
15887
15904
  schema = null;
15888
15905
  value = {};
@@ -16292,33 +16309,33 @@ function Tt(s) {
16292
16309
  function Qe(s) {
16293
16310
  return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
16294
16311
  }
16295
- function Vd() {
16312
+ function Kd() {
16296
16313
  const s = [
16297
- ["aikaara-chat-widget", rd],
16298
- ["aikaara-chat-bubble", nd],
16299
- ["aikaara-chat-header", od],
16300
- ["aikaara-message-list", md],
16301
- ["aikaara-message-bubble", yd],
16302
- ["aikaara-chat-input", wd],
16303
- ["aikaara-typing-indicator", _d],
16304
- ["aikaara-streaming-message", kd],
16305
- ["aikaara-error-banner", xd],
16306
- ["aikaara-template-renderer", Id],
16307
- ["aikaara-system-pill", Pd],
16308
- ["aikaara-option-list", Md],
16309
- ["aikaara-submit-action", Rd],
16310
- ["aikaara-modal-action", Nd],
16311
- ["aikaara-text-input", jd],
16312
- ["aikaara-chat", Ud],
16313
- ["aikaara-link-modal", Bd],
16314
- ["aikaara-compare-plans", $d],
16315
- ["aikaara-smart-edit-modal", qd],
16316
- ["aikaara-schema-form", zd]
16314
+ ["aikaara-chat-widget", nd],
16315
+ ["aikaara-chat-bubble", id],
16316
+ ["aikaara-chat-header", sd],
16317
+ ["aikaara-message-list", gd],
16318
+ ["aikaara-message-bubble", vd],
16319
+ ["aikaara-chat-input", _d],
16320
+ ["aikaara-typing-indicator", kd],
16321
+ ["aikaara-streaming-message", xd],
16322
+ ["aikaara-error-banner", Sd],
16323
+ ["aikaara-template-renderer", Td],
16324
+ ["aikaara-system-pill", Md],
16325
+ ["aikaara-option-list", Rd],
16326
+ ["aikaara-submit-action", Ld],
16327
+ ["aikaara-modal-action", jd],
16328
+ ["aikaara-text-input", Ud],
16329
+ ["aikaara-chat", Bd],
16330
+ ["aikaara-link-modal", Dd],
16331
+ ["aikaara-compare-plans", qd],
16332
+ ["aikaara-smart-edit-modal", Hd],
16333
+ ["aikaara-schema-form", Vd]
16317
16334
  ];
16318
16335
  for (const [e, t] of s)
16319
16336
  customElements.get(e) || customElements.define(e, t);
16320
16337
  }
16321
- Vd();
16338
+ Kd();
16322
16339
  function pr(s, e, t = "") {
16323
16340
  if (!e) return t;
16324
16341
  const r = e.split(".");
@@ -16344,7 +16361,7 @@ function Js(s) {
16344
16361
  async function Ht(s) {
16345
16362
  return typeof s == "function" ? await s() : s;
16346
16363
  }
16347
- class Kd {
16364
+ class Gd {
16348
16365
  constructor(e, t) {
16349
16366
  this.descriptor = e, this.sessionToken = t;
16350
16367
  }
@@ -16395,10 +16412,10 @@ class Kd {
16395
16412
  return this.cache = { token: h, requestId: b, fullName: d, userId: g, expiresAt: y }, this.cache;
16396
16413
  }
16397
16414
  }
16398
- async function Gd(s) {
16415
+ async function Yd(s) {
16399
16416
  const e = {};
16400
16417
  for (const t of s.spec) {
16401
- const r = await Yd(t, s.providers);
16418
+ const r = await Jd(t, s.providers);
16402
16419
  if (r !== void 0 && r !== "")
16403
16420
  e[t.name] = r;
16404
16421
  else {
@@ -16411,11 +16428,11 @@ async function Gd(s) {
16411
16428
  }
16412
16429
  return e;
16413
16430
  }
16414
- async function Yd(s, e) {
16431
+ async function Jd(s, e) {
16415
16432
  const t = s.key ?? s.name;
16416
16433
  switch (s.source) {
16417
16434
  case "cookie":
16418
- return Jd(t);
16435
+ return Qd(t);
16419
16436
  case "localStorage":
16420
16437
  return mr(() => window.localStorage.getItem(t) ?? void 0);
16421
16438
  case "sessionStorage":
@@ -16423,7 +16440,7 @@ async function Yd(s, e) {
16423
16440
  case "url_param":
16424
16441
  return mr(() => new URL(window.location.href).searchParams.get(t) ?? void 0);
16425
16442
  case "header_meta":
16426
- return mr(() => document.querySelector(`meta[name="${Qd(t)}"]`)?.content ?? void 0);
16443
+ return mr(() => document.querySelector(`meta[name="${Xd(t)}"]`)?.content ?? void 0);
16427
16444
  case "callback": {
16428
16445
  const r = e?.[s.name];
16429
16446
  if (!r) return;
@@ -16434,7 +16451,7 @@ async function Yd(s, e) {
16434
16451
  return;
16435
16452
  }
16436
16453
  }
16437
- function Jd(s) {
16454
+ function Qd(s) {
16438
16455
  if (typeof document > "u") return;
16439
16456
  const e = encodeURIComponent(s), t = document.cookie ? document.cookie.split("; ") : [];
16440
16457
  for (const r of t) {
@@ -16456,11 +16473,11 @@ function mr(s) {
16456
16473
  return;
16457
16474
  }
16458
16475
  }
16459
- function Qd(s) {
16476
+ function Xd(s) {
16460
16477
  return s.replace(/["\\]/g, "\\$&");
16461
16478
  }
16462
- const Xd = 1800;
16463
- class Zd {
16479
+ const Zd = 1800;
16480
+ class ef {
16464
16481
  constructor(e) {
16465
16482
  this.opts = e, this.cache = this.loadCache();
16466
16483
  }
@@ -16489,7 +16506,7 @@ class Zd {
16489
16506
  throw new Error(
16490
16507
  "[aikaara-chat-sdk] SsoExchangeAdapter.exchange() requires descriptor.sso.collect; v2 partner-token flow should be handled by TokenDiscoveryReader instead."
16491
16508
  );
16492
- const e = await Gd({
16509
+ const e = await Yd({
16493
16510
  spec: this.opts.descriptor.collect,
16494
16511
  providers: this.opts.providers
16495
16512
  }), t = JSON.stringify({ credentials: e }), r = {
@@ -16527,7 +16544,7 @@ class Zd {
16527
16544
  return this.cache = u, this.persistCache(u), u;
16528
16545
  }
16529
16546
  computeExpiry() {
16530
- const e = this.opts.descriptor.cacheTtlSec ?? Xd;
16547
+ const e = this.opts.descriptor.cacheTtlSec ?? Zd;
16531
16548
  if (!(!this.opts.descriptor.cacheKey || e <= 0))
16532
16549
  return Date.now() + e * 1e3;
16533
16550
  }
@@ -16560,8 +16577,8 @@ class Zd {
16560
16577
  }
16561
16578
  }
16562
16579
  }
16563
- const ef = 3e4, tf = 2e3, rf = 100;
16564
- async function nf(s) {
16580
+ const tf = 3e4, rf = 2e3, nf = 100;
16581
+ async function of(s) {
16565
16582
  const { descriptor: e } = s, t = e.tokenSourceConfig ?? {};
16566
16583
  switch (e.tokenSource) {
16567
16584
  case "init": {
@@ -16570,37 +16587,37 @@ async function nf(s) {
16570
16587
  return { token: s.initToken, source: "init" };
16571
16588
  }
16572
16589
  case "query": {
16573
- const r = typeof t.key == "string" && t.key ? t.key : "token", o = sf(r);
16590
+ const r = typeof t.key == "string" && t.key ? t.key : "token", o = af(r);
16574
16591
  if (!o) throw new Xe("query", `?${r}= not present`);
16575
16592
  return { token: o, source: "query" };
16576
16593
  }
16577
16594
  case "hash": {
16578
- const r = typeof t.key == "string" && t.key ? t.key : "token", o = af(r);
16595
+ const r = typeof t.key == "string" && t.key ? t.key : "token", o = lf(r);
16579
16596
  if (!o) throw new Xe("hash", `#${r}= not present`);
16580
16597
  return { token: o, source: "hash" };
16581
16598
  }
16582
16599
  case "postmsg": {
16583
- const r = typeof t.type == "string" ? t.type : "", o = typeof t.key == "string" && t.key ? t.key : "token", n = df(typeof t.origins == "string" ? t.origins : ""), i = typeof t.timeoutMs == "number" && t.timeoutMs > 0 ? t.timeoutMs : ef;
16584
- return { token: await hf({ type: r, key: o, origins: n, timeoutMs: i }), source: "postmsg" };
16600
+ const r = typeof t.type == "string" ? t.type : "", o = typeof t.key == "string" && t.key ? t.key : "token", n = ff(typeof t.origins == "string" ? t.origins : ""), i = typeof t.timeoutMs == "number" && t.timeoutMs > 0 ? t.timeoutMs : tf;
16601
+ return { token: await df({ type: r, key: o, origins: n, timeoutMs: i }), source: "postmsg" };
16585
16602
  }
16586
16603
  case "cookie": {
16587
16604
  const r = typeof t.name == "string" && t.name ? t.name : "";
16588
16605
  if (!r) throw new Xe("cookie", "cookie.name not configured");
16589
- const o = lf(r);
16606
+ const o = cf(r);
16590
16607
  if (!o) throw new Xe("cookie", `cookie "${r}" not set`);
16591
16608
  return { token: o, source: "cookie" };
16592
16609
  }
16593
16610
  case "storage": {
16594
16611
  const r = t.store === "session" ? "session" : "local", o = typeof t.key == "string" && t.key ? t.key : "", n = typeof t.path == "string" ? t.path : "";
16595
16612
  if (!o) throw new Xe("storage", "storage.key not configured");
16596
- const i = cf(r, o, n);
16613
+ const i = uf(r, o, n);
16597
16614
  if (!i) throw new Xe("storage", `${r}Storage["${o}"] not set`);
16598
16615
  return { token: i, source: "storage" };
16599
16616
  }
16600
16617
  case "global": {
16601
16618
  const r = typeof t.path == "string" ? t.path : "";
16602
16619
  if (!r) throw new Xe("global", "global.path not configured");
16603
- const o = typeof t.timeoutMs == "number" && t.timeoutMs > 0 ? t.timeoutMs : tf, n = typeof t.intervalMs == "number" && t.intervalMs > 0 ? t.intervalMs : rf, i = await uf(r, o, n);
16620
+ const o = typeof t.timeoutMs == "number" && t.timeoutMs > 0 ? t.timeoutMs : rf, n = typeof t.intervalMs == "number" && t.intervalMs > 0 ? t.intervalMs : nf, i = await hf(r, o, n);
16604
16621
  if (!i) throw new Xe("global", `window.${r} not present`);
16605
16622
  return { token: i, source: "global" };
16606
16623
  }
@@ -16613,7 +16630,7 @@ async function nf(s) {
16613
16630
  }
16614
16631
  }
16615
16632
  }
16616
- class of {
16633
+ class sf {
16617
16634
  constructor(e) {
16618
16635
  this.opts = e;
16619
16636
  }
@@ -16624,7 +16641,7 @@ class of {
16624
16641
  /** Resolve the token. Returns cache if present. */
16625
16642
  async get() {
16626
16643
  if (this.cached) return this.cached;
16627
- const e = await nf(this.opts);
16644
+ const e = await of(this.opts);
16628
16645
  return this.cached = e, e;
16629
16646
  }
16630
16647
  /**
@@ -16641,7 +16658,7 @@ class Xe extends Error {
16641
16658
  super(`[aikaara-chat-sdk] token-discovery (${e}): ${t}`), this.source = e, this.name = "TokenDiscoveryError";
16642
16659
  }
16643
16660
  }
16644
- function sf(s) {
16661
+ function af(s) {
16645
16662
  if (!(typeof window > "u"))
16646
16663
  try {
16647
16664
  const e = window.location.search.slice(1);
@@ -16655,7 +16672,7 @@ function sf(s) {
16655
16672
  return;
16656
16673
  }
16657
16674
  }
16658
- function af(s) {
16675
+ function lf(s) {
16659
16676
  if (!(typeof window > "u"))
16660
16677
  try {
16661
16678
  const e = window.location.hash.replace(/^#/, "");
@@ -16664,7 +16681,7 @@ function af(s) {
16664
16681
  return;
16665
16682
  }
16666
16683
  }
16667
- function lf(s) {
16684
+ function cf(s) {
16668
16685
  if (typeof document > "u") return;
16669
16686
  const e = encodeURIComponent(s), t = document.cookie ? document.cookie.split("; ") : [];
16670
16687
  for (const r of t) {
@@ -16679,7 +16696,7 @@ function lf(s) {
16679
16696
  }
16680
16697
  }
16681
16698
  }
16682
- function cf(s, e, t) {
16699
+ function uf(s, e, t) {
16683
16700
  if (!(typeof window > "u"))
16684
16701
  try {
16685
16702
  const o = (s === "session" ? window.sessionStorage : window.localStorage).getItem(e);
@@ -16697,7 +16714,7 @@ function cf(s, e, t) {
16697
16714
  return;
16698
16715
  }
16699
16716
  }
16700
- async function uf(s, e, t) {
16717
+ async function hf(s, e, t) {
16701
16718
  if (typeof window > "u") return;
16702
16719
  const r = Date.now() + e;
16703
16720
  for (; Date.now() < r; ) {
@@ -16712,7 +16729,7 @@ async function uf(s, e, t) {
16712
16729
  await new Promise((n) => setTimeout(n, t));
16713
16730
  }
16714
16731
  }
16715
- function hf(s) {
16732
+ function df(s) {
16716
16733
  return new Promise((e, t) => {
16717
16734
  if (typeof window > "u") {
16718
16735
  t(new Xe("postmsg", "no window"));
@@ -16734,7 +16751,7 @@ function hf(s) {
16734
16751
  window.addEventListener("message", n);
16735
16752
  });
16736
16753
  }
16737
- function df(s) {
16754
+ function ff(s) {
16738
16755
  return s ? s.split(/[,\s]+/).map((e) => e.trim()).filter(Boolean) : [];
16739
16756
  }
16740
16757
  function Ul(s, e) {
@@ -16748,7 +16765,7 @@ function Ul(s, e) {
16748
16765
  return;
16749
16766
  return r;
16750
16767
  }
16751
- function ff() {
16768
+ function pf() {
16752
16769
  const s = typeof crypto < "u" ? crypto : null;
16753
16770
  if (s?.randomUUID) return s.randomUUID();
16754
16771
  if (s?.getRandomValues) {
@@ -16762,9 +16779,9 @@ function ff() {
16762
16779
  return (e === "x" ? t : t & 3 | 8).toString(16);
16763
16780
  });
16764
16781
  }
16765
- const pf = "aikaara_chat:requestId";
16782
+ const mf = "aikaara_chat:requestId";
16766
16783
  function Io(s, e, t) {
16767
- const r = `${pf}:${s}:${e}`;
16784
+ const r = `${mf}:${s}:${e}`;
16768
16785
  return t ? `${r}:${t}` : r;
16769
16786
  }
16770
16787
  function Bl(s, e, t) {
@@ -16774,13 +16791,13 @@ function Bl(s, e, t) {
16774
16791
  return null;
16775
16792
  }
16776
16793
  }
16777
- function mf(s, e, t, r) {
16794
+ function gf(s, e, t, r) {
16778
16795
  try {
16779
16796
  localStorage.setItem(Io(s, e, r), t);
16780
16797
  } catch {
16781
16798
  }
16782
16799
  }
16783
- function wf(s, e, t) {
16800
+ function _f(s, e, t) {
16784
16801
  try {
16785
16802
  localStorage.removeItem(Io(s, e, t));
16786
16803
  } catch {
@@ -16829,7 +16846,7 @@ async function uo(s, e, t = "before-chat") {
16829
16846
  _ = x;
16830
16847
  break;
16831
16848
  }
16832
- if (y = x.status, w = await x.text().catch(() => ""), m < c.length && gf(y, w)) {
16849
+ if (y = x.status, w = await x.text().catch(() => ""), m < c.length && bf(y, w)) {
16833
16850
  const E = c[m++];
16834
16851
  console.warn(
16835
16852
  `[aikaara-chat-sdk] preflight #${u} ${b} ${p} → ${y} (transient). Retry #${m} in ${E}ms.`
@@ -16883,7 +16900,7 @@ async function uo(s, e, t = "before-chat") {
16883
16900
  }
16884
16901
  return { captured: l };
16885
16902
  }
16886
- async function _f(s) {
16903
+ async function kf(s) {
16887
16904
  const e = s.steps ?? [];
16888
16905
  return e.some((r) => r.trigger === "on-method-select") ? (await uo(
16889
16906
  e,
@@ -16899,7 +16916,7 @@ async function _f(s) {
16899
16916
  "on-method-select"
16900
16917
  )).captured : {};
16901
16918
  }
16902
- function gf(s, e) {
16919
+ function bf(s, e) {
16903
16920
  if (s === 503 || s === 504 || s === 502) return !0;
16904
16921
  if (s === 401 || s === 403) return e.trim().length === 0;
16905
16922
  if (s === 500) {
@@ -16925,7 +16942,7 @@ async function Dl(s, e) {
16925
16942
  return r;
16926
16943
  }
16927
16944
  function Fl(s, e) {
16928
- return s.replace("{projectId}", e).replace("{uuid}", ff().replace(/-/g, ""));
16945
+ return s.replace("{projectId}", e).replace("{uuid}", pf().replace(/-/g, ""));
16929
16946
  }
16930
16947
  function $l(s) {
16931
16948
  const e = s._preload;
@@ -16937,7 +16954,7 @@ function $l(s) {
16937
16954
  );
16938
16955
  t.length !== 0 && Promise.allSettled(t.map((r) => jl(r)));
16939
16956
  }
16940
- async function bf(s) {
16957
+ async function yf(s) {
16941
16958
  const e = {
16942
16959
  ...s.config ?? (s.configUrl ? await Dl(s.configUrl, s.configHeaders) : {}),
16943
16960
  ...s.overrides ?? {}
@@ -16947,7 +16964,7 @@ async function bf(s) {
16947
16964
  if ((t === "tiledesk" || t === "dual") && !r)
16948
16965
  throw new Error("mount: descriptor.tiledesk is required for tiledesk/dual transport");
16949
16966
  const o = r?.projectId ?? "", n = s.identity.userId, i = s.conversationScope || void 0, a = s.forceNewConversation ? null : Bl(n, o, i), l = r?.requestIdTemplate ?? "support-group-{projectId}-{uuid}", c = s.conversationId ?? a ?? Fl(l, o);
16950
- (s.conversationId || !a || s.forceNewConversation) && o && mf(n, o, c, i);
16967
+ (s.conversationId || !a || s.forceNewConversation) && o && gf(n, o, c, i);
16951
16968
  const u = await s.tokenProvider(), h = s.tokenProvider, p = s.historyTokenProvider ?? h, b = r ? {
16952
16969
  mqttEndpoint: r.mqttEndpoint,
16953
16970
  jwtToken: u,
@@ -17035,13 +17052,13 @@ async function bf(s) {
17035
17052
  }
17036
17053
  };
17037
17054
  }
17038
- function yf(s) {
17055
+ function vf(s) {
17039
17056
  if (typeof s != "string") return s;
17040
17057
  const e = document.querySelector(s);
17041
17058
  if (!e) throw new Error(`mountFromSlug: container "${s}" not found`);
17042
17059
  return e;
17043
17060
  }
17044
- async function vf(s) {
17061
+ async function wf(s) {
17045
17062
  const e = (s.configBase ?? "https://api.aikaara.com").replace(/\/$/, ""), t = `${e}/api/v1/widget_configs/${encodeURIComponent(s.slug)}`;
17046
17063
  let r = null;
17047
17064
  try {
@@ -17091,7 +17108,7 @@ async function vf(s) {
17091
17108
  let i = null, a = s.user.id, l = s.user.name, c = "", u = s.user.token, h = null;
17092
17109
  const p = await Ht(s.user.token).catch(() => ""), b = typeof p == "string" && p.length > 0;
17093
17110
  if (!b && o.sso?.tokenSource) {
17094
- h = new of({
17111
+ h = new sf({
17095
17112
  descriptor: {
17096
17113
  provider: o.sso.provider,
17097
17114
  flow: o.sso.flow,
@@ -17108,7 +17125,7 @@ async function vf(s) {
17108
17125
  u = async () => (await h.get()).token, s.user.identity && !s.user.identity.partnerToken && (s.user.identity.partnerToken = I.token);
17109
17126
  } else if (!b && o.sso && o.sso.collect && o.sso.collect.length > 0) {
17110
17127
  const I = `${e}/api/v1/projects/by-slug/${encodeURIComponent(s.slug)}/sso_exchange`;
17111
- i = await new Zd({
17128
+ i = await new ef({
17112
17129
  descriptor: o.sso,
17113
17130
  providers: s.user.credentialProviders,
17114
17131
  exchangeUrl: I
@@ -17130,7 +17147,7 @@ async function vf(s) {
17130
17147
  }
17131
17148
  I.captured.userId && (a = I.captured.userId), I.captured.requestId && (g = I.captured.requestId);
17132
17149
  }
17133
- const y = new Kd(o.auth, u);
17150
+ const y = new Gd(o.auth, u);
17134
17151
  if (d) {
17135
17152
  const I = o.tiledesk?.projectId ?? "", O = I ? Bl(a, I) : null, P = o.tiledesk?.requestIdTemplate ?? "support-group-{projectId}-{uuid}", j = O ?? (I ? Fl(P, I) : "");
17136
17153
  y.prime(d, { requestId: j, fullName: l });
@@ -17161,8 +17178,8 @@ async function vf(s) {
17161
17178
  fieldName: x.fieldName,
17162
17179
  extraFields: x.extraFields,
17163
17180
  headers: async () => ({ authorization: await v() })
17164
- }) : void 0), S = await bf({
17165
- container: yf(s.container),
17181
+ }) : void 0), S = await yf({
17182
+ container: vf(s.container),
17166
17183
  config: o,
17167
17184
  // SSO-issued Aikaara user token, used by the ActionCable transport.
17168
17185
  // Tiledesk-only widgets ignore this; falls back to `userId` inside `mount`.
@@ -17218,50 +17235,50 @@ async function vf(s) {
17218
17235
  }
17219
17236
  export {
17220
17237
  To as A,
17221
- vf as B,
17238
+ wf as B,
17222
17239
  ql as C,
17223
- bf as D,
17240
+ yf as D,
17224
17241
  Qs as E,
17225
17242
  Ol as F,
17226
- _f as G,
17227
- fd as H,
17228
- Ud as I,
17229
- $d as J,
17230
- Bd as K,
17231
- Nd as L,
17243
+ kf as G,
17244
+ pd as H,
17245
+ Bd as I,
17246
+ qd as J,
17247
+ Dd as K,
17248
+ jd as L,
17232
17249
  ec as M,
17233
- Md as N,
17234
- zd as O,
17235
- qd as P,
17236
- Rd as Q,
17237
- Pd as R,
17238
- Kd as S,
17250
+ Rd as N,
17251
+ Vd as O,
17252
+ Hd as P,
17253
+ Ld as Q,
17254
+ Md as R,
17255
+ Gd as S,
17239
17256
  ph as T,
17240
- Id as U,
17241
- jd as V,
17242
- nd as a,
17257
+ Td as U,
17258
+ Ud as V,
17259
+ id as a,
17243
17260
  wh as b,
17244
- od as c,
17245
- wd as d,
17246
- rd as e,
17247
- xd as f,
17248
- yd as g,
17249
- md as h,
17250
- kd as i,
17251
- _d as j,
17261
+ sd as c,
17262
+ _d as d,
17263
+ nd as e,
17264
+ Sd as f,
17265
+ vd as g,
17266
+ gd as h,
17267
+ xd as i,
17268
+ kd as j,
17252
17269
  Zl as k,
17253
17270
  Xl as l,
17254
17271
  tc as m,
17255
- Zd as n,
17272
+ ef as n,
17256
17273
  Xe as o,
17257
- of as p,
17258
- wf as q,
17259
- Vd as r,
17260
- Gd as s,
17274
+ sf as p,
17275
+ _f as q,
17276
+ Kd as r,
17277
+ Yd as s,
17261
17278
  Pl as t,
17262
17279
  Sh as u,
17263
17280
  Ah as v,
17264
- nf as w,
17281
+ of as w,
17265
17282
  yh as x,
17266
17283
  bh as y,
17267
17284
  gh as z