@ai-matrx/vault 0.1.45 → 0.1.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1750,6 +1750,7 @@ function TotpRow({ port, item, onChanged }) {
1750
1750
  VaultRow,
1751
1751
  {
1752
1752
  label: "Authenticator",
1753
+ className: "@max-[24rem]/otprow:grid-cols-[5.25rem_minmax(0,1fr)_auto] @max-[24rem]/otprow:gap-x-1 @max-[24rem]/otprow:px-2",
1753
1754
  actions: /* @__PURE__ */ jsxs7(Fragment5, { children: [
1754
1755
  a.enabled ? /* @__PURE__ */ jsx8("span", { className: "hidden @[24rem]/otprow:contents", "data-copy-code-button": "", children: /* @__PURE__ */ jsx8(CopyCodeButton, { live, label: item.name }) }) : null,
1755
1756
  menu
@@ -2788,6 +2789,7 @@ function orderOrganizations(orgs, items, recentItemIds) {
2788
2789
  const group = (o) => recent.has(o.id) ? 0 : (counts.get(o.id) ?? 0) > 0 ? 1 : 2;
2789
2790
  return [...orgs].sort((a, b) => group(a) - group(b) || (recent.get(a.id) ?? 0) - (recent.get(b.id) ?? 0) || a.name.localeCompare(b.name, void 0, { sensitivity: "base" }) || a.id.localeCompare(b.id));
2790
2791
  }
2792
+ var HINT_LENGTH = 8;
2791
2793
  function organizationHints(orgs) {
2792
2794
  const groups = /* @__PURE__ */ new Map();
2793
2795
  for (const o of orgs) {
@@ -2797,12 +2799,11 @@ function organizationHints(orgs) {
2797
2799
  const hints = /* @__PURE__ */ new Map();
2798
2800
  for (const group of groups.values()) {
2799
2801
  if (group.length < 2) continue;
2800
- const longest = Math.max(...group.map((o) => o.id.length));
2801
- const fragment = (o, n2) => o.id.slice(0, n2);
2802
- let n = 8;
2803
- while (n < longest && new Set(group.map((o) => fragment(o, n))).size < group.length) n += 1;
2804
- const useSuffix = new Set(group.map((o) => fragment(o, n))).size < group.length;
2805
- for (const o of group) hints.set(o.id, useSuffix ? o.id.slice(-8) : fragment(o, n));
2802
+ const distinct = (pick2) => new Set(group.map(pick2)).size === group.length;
2803
+ const head = (o) => o.id.slice(0, HINT_LENGTH);
2804
+ const tail = (o) => `\u2026${o.id.slice(-HINT_LENGTH)}`;
2805
+ const pick = distinct(head) || !distinct(tail) ? head : tail;
2806
+ for (const o of group) hints.set(o.id, pick(o));
2806
2807
  }
2807
2808
  return hints;
2808
2809
  }