@ai-matrx/vault 0.1.46 → 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,7 +1750,7 @@ function TotpRow({ port, item, onChanged }) {
1750
1750
  VaultRow,
1751
1751
  {
1752
1752
  label: "Authenticator",
1753
- className: "@max-[24rem]/otprow:grid-cols-[4.5rem_minmax(0,1fr)_auto]",
1753
+ className: "@max-[24rem]/otprow:grid-cols-[5.25rem_minmax(0,1fr)_auto] @max-[24rem]/otprow:gap-x-1 @max-[24rem]/otprow:px-2",
1754
1754
  actions: /* @__PURE__ */ jsxs7(Fragment5, { children: [
1755
1755
  a.enabled ? /* @__PURE__ */ jsx8("span", { className: "hidden @[24rem]/otprow:contents", "data-copy-code-button": "", children: /* @__PURE__ */ jsx8(CopyCodeButton, { live, label: item.name }) }) : null,
1756
1756
  menu
@@ -2789,6 +2789,7 @@ function orderOrganizations(orgs, items, recentItemIds) {
2789
2789
  const group = (o) => recent.has(o.id) ? 0 : (counts.get(o.id) ?? 0) > 0 ? 1 : 2;
2790
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));
2791
2791
  }
2792
+ var HINT_LENGTH = 8;
2792
2793
  function organizationHints(orgs) {
2793
2794
  const groups = /* @__PURE__ */ new Map();
2794
2795
  for (const o of orgs) {
@@ -2798,12 +2799,11 @@ function organizationHints(orgs) {
2798
2799
  const hints = /* @__PURE__ */ new Map();
2799
2800
  for (const group of groups.values()) {
2800
2801
  if (group.length < 2) continue;
2801
- const longest = Math.max(...group.map((o) => o.id.length));
2802
- const fragment = (o, n2) => o.id.slice(0, n2);
2803
- let n = 8;
2804
- while (n < longest && new Set(group.map((o) => fragment(o, n))).size < group.length) n += 1;
2805
- const useSuffix = new Set(group.map((o) => fragment(o, n))).size < group.length;
2806
- 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));
2807
2807
  }
2808
2808
  return hints;
2809
2809
  }