@qikbar/qikbar 0.0.25 → 0.1.0

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.
Files changed (89) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +92 -0
  3. package/dist/ai/agent.d.ts +42 -0
  4. package/dist/ai/byok.d.ts +29 -0
  5. package/dist/ai/index.d.ts +8 -0
  6. package/dist/ai/providers.d.ts +82 -0
  7. package/dist/ai/sse.d.ts +9 -0
  8. package/dist/ai.js +36 -0
  9. package/dist/ai.js.map +7 -0
  10. package/dist/chunks/bar-D5CSPT3U.js +2031 -0
  11. package/dist/chunks/bar-D5CSPT3U.js.map +7 -0
  12. package/dist/chunks/chunk-2ADXL7KQ.js +358 -0
  13. package/dist/chunks/chunk-2ADXL7KQ.js.map +7 -0
  14. package/dist/chunks/chunk-6TC6G2C5.js +107 -0
  15. package/dist/chunks/chunk-6TC6G2C5.js.map +7 -0
  16. package/dist/chunks/chunk-HBBSETRF.js +153 -0
  17. package/dist/chunks/chunk-HBBSETRF.js.map +7 -0
  18. package/dist/chunks/chunk-I77YSUJN.js +104 -0
  19. package/dist/chunks/chunk-I77YSUJN.js.map +7 -0
  20. package/dist/chunks/chunk-IJ3WUM3T.js +544 -0
  21. package/dist/chunks/chunk-IJ3WUM3T.js.map +7 -0
  22. package/dist/chunks/chunk-MPTP2EWW.js +8 -0
  23. package/dist/chunks/chunk-MPTP2EWW.js.map +7 -0
  24. package/dist/chunks/chunk-N4Y2Z6YD.js +69 -0
  25. package/dist/chunks/chunk-N4Y2Z6YD.js.map +7 -0
  26. package/dist/chunks/chunk-PQEHV3D4.js +124 -0
  27. package/dist/chunks/chunk-PQEHV3D4.js.map +7 -0
  28. package/dist/chunks/chunk-VXTYD56F.js +453 -0
  29. package/dist/chunks/chunk-VXTYD56F.js.map +7 -0
  30. package/dist/chunks/chunk-YCVJQ7U3.js +52 -0
  31. package/dist/chunks/chunk-YCVJQ7U3.js.map +7 -0
  32. package/dist/core/define.d.ts +40 -0
  33. package/dist/core/frecency.d.ts +16 -0
  34. package/dist/core/hotkeys.d.ts +39 -0
  35. package/dist/core/lazy.d.ts +48 -0
  36. package/dist/core/search.d.ts +42 -0
  37. package/dist/core/storage.d.ts +5 -0
  38. package/dist/core/types.d.ts +601 -0
  39. package/dist/extensions/index.d.ts +30 -0
  40. package/dist/extensions/math.d.ts +14 -0
  41. package/dist/extensions.js +476 -0
  42. package/dist/extensions.js.map +7 -0
  43. package/dist/index.d.ts +27 -0
  44. package/dist/index.js +67 -0
  45. package/dist/index.js.map +7 -0
  46. package/dist/qikbar.global.js +259 -0
  47. package/dist/qikbar.global.js.map +7 -0
  48. package/dist/react/index.d.ts +66 -0
  49. package/dist/react.js +119 -0
  50. package/dist/react.js.map +7 -0
  51. package/dist/server/index.d.ts +47 -0
  52. package/dist/server.js +93 -0
  53. package/dist/server.js.map +7 -0
  54. package/dist/styles.css +222 -0
  55. package/dist/theme.d.ts +5 -0
  56. package/dist/theme.js +20 -0
  57. package/dist/theme.js.map +7 -0
  58. package/dist/ui/bar.d.ts +252 -0
  59. package/dist/ui/dom.d.ts +21 -0
  60. package/dist/ui/icons.d.ts +88 -0
  61. package/dist/ui/markdown.d.ts +8 -0
  62. package/dist/ui/nav.d.ts +8 -0
  63. package/dist/ui/styles.d.ts +6 -0
  64. package/dist/ui/themes.d.ts +27 -0
  65. package/dist/ui/views.d.ts +148 -0
  66. package/dist/utils.d.ts +10 -0
  67. package/dist/utils.js +50 -0
  68. package/dist/utils.js.map +7 -0
  69. package/package.json +88 -43
  70. package/dist/qikbar.es.js +0 -8748
  71. package/dist/qikbar.umd.js +0 -113
  72. package/dist/types/boot.d.ts +0 -72
  73. package/dist/types/index.d.ts +0 -1
  74. package/dist/types/init.d.ts +0 -2
  75. package/dist/types/main.d.ts +0 -4
  76. package/dist/types/shared/AsyncRoot.d.ts +0 -5
  77. package/dist/types/shared/CommandFooter.d.ts +0 -5
  78. package/dist/types/shared/Crumbs.d.ts +0 -6
  79. package/dist/types/shared/Details.d.ts +0 -3
  80. package/dist/types/shared/ErrorBoundary.d.ts +0 -15
  81. package/dist/types/shared/Icon.d.ts +0 -4
  82. package/dist/types/shared/List.d.ts +0 -30
  83. package/dist/types/shared/Qikbar.d.ts +0 -5
  84. package/dist/types/shared/Root.d.ts +0 -4
  85. package/dist/types/shared/Search.d.ts +0 -1
  86. package/dist/types/shared/commandContext.d.ts +0 -8
  87. package/dist/types/shared/useDebounce.d.ts +0 -1
  88. package/dist/types/utils/liquid.d.ts +0 -4
  89. package/dist/types/vite-env.d.ts +0 -1
@@ -0,0 +1,453 @@
1
+ import {
2
+ __publicField
3
+ } from "./chunk-MPTP2EWW.js";
4
+
5
+ // src/core/frecency.ts
6
+ var Frecency = class {
7
+ constructor(storage) {
8
+ __publicField(this, "storage", storage);
9
+ __publicField(this, "entries");
10
+ this.entries = storage.get("frecency") ?? {};
11
+ }
12
+ record(id) {
13
+ let e = this.entries[id] ?? { c: 0, t: 0 };
14
+ e.c++, e.t = Date.now(), this.entries[id] = e;
15
+ let keys = Object.keys(this.entries);
16
+ if (keys.length > 200) {
17
+ keys.sort((a, b) => this.entries[a].t - this.entries[b].t);
18
+ for (let k of keys.slice(0, keys.length - 200)) delete this.entries[k];
19
+ }
20
+ this.storage.set("frecency", this.entries);
21
+ }
22
+ /** A score in [0, 1). */
23
+ score(id) {
24
+ let e = this.entries[id];
25
+ if (!e) return 0;
26
+ let decay = Math.pow(0.5, (Date.now() - e.t) / 2592e5), raw = Math.log2(1 + e.c) * decay;
27
+ return raw / (1 + raw);
28
+ }
29
+ /** Ids sorted by score, best first. */
30
+ top(limit) {
31
+ return Object.keys(this.entries).map((id) => [id, this.score(id)]).filter(([, s]) => s > 0.02).sort((a, b) => b[1] - a[1]).slice(0, limit).map(([id]) => id);
32
+ }
33
+ clear() {
34
+ this.entries = {}, this.storage.remove("frecency");
35
+ }
36
+ };
37
+
38
+ // src/core/search.ts
39
+ var SEPARATORS = /* @__PURE__ */ new Set([" ", "-", "_", ".", "/", ":", "\\", "(", "[", "{", ",", "@", "#", '"', "'", ">", "|", "+", "&"]);
40
+ function normalize(text) {
41
+ let lower = text.toLowerCase();
42
+ if (!/[^\u0000-\u007f]/.test(lower)) return lower;
43
+ let stripped = lower.normalize("NFD").replace(/[̀-ͯ]/g, "");
44
+ return stripped.length === lower.length ? stripped : lower;
45
+ }
46
+ function charBonus(target, index) {
47
+ if (index === 0) return 14;
48
+ let prev = target[index - 1];
49
+ if (SEPARATORS.has(prev)) return 10;
50
+ let ch = target[index];
51
+ return prev !== prev.toUpperCase() && ch !== ch.toLowerCase() ? 8 : /[0-9]/.test(ch) && !/[0-9]/.test(prev) ? 10 / 2 : 0;
52
+ }
53
+ function scorePositions(query, target, positions) {
54
+ let score = 0, prev = -2, streak = 0;
55
+ for (let k = 0; k < positions.length; k++) {
56
+ let p = positions[k], s = 16 + charBonus(target, p);
57
+ if (p === prev + 1)
58
+ streak++, s += 6 + Math.min(streak, 3);
59
+ else if (streak = 0, k > 0) {
60
+ let gap = p - prev - 1;
61
+ s -= 3 + 1 * Math.min(gap - 1, 12);
62
+ }
63
+ target[p] === query[k] && (s += 1), score += s, prev = p;
64
+ }
65
+ return score;
66
+ }
67
+ function fuzzyMatch(query, target, targetNorm = normalize(target)) {
68
+ let m = query.length, n = targetNorm.length;
69
+ if (m === 0) return { score: 0, positions: [] };
70
+ if (m > n) return null;
71
+ if (targetNorm === query)
72
+ return { score: 1, positions: Array.from({ length: m }, (_, i) => i) };
73
+ let qi = 0, end = -1;
74
+ for (let i = 0; i < n; i++)
75
+ if (targetNorm[i] === query[qi] && (qi++, qi === m)) {
76
+ end = i;
77
+ break;
78
+ }
79
+ if (end < 0) return null;
80
+ qi = m - 1;
81
+ let start = end;
82
+ for (let i = end; i >= 0; i--)
83
+ if (targetNorm[i] === query[qi] && (qi--, qi < 0)) {
84
+ start = i;
85
+ break;
86
+ }
87
+ let bestPositions = greedyFrom(query, target, targetNorm, start), best = bestPositions ? scorePositions(query, target, bestPositions) : -1 / 0, tries = 0;
88
+ for (let i = 0; i < n - m + 1 && tries < 4; i++) {
89
+ if (i === start || targetNorm[i] !== query[0] || charBonus(target, i) === 0) continue;
90
+ tries++;
91
+ let candidate = greedyFrom(query, target, targetNorm, i);
92
+ if (!candidate) continue;
93
+ let s = scorePositions(query, target, candidate);
94
+ s > best && (best = s, bestPositions = candidate);
95
+ }
96
+ if (!bestPositions) return null;
97
+ let idx = targetNorm.indexOf(query);
98
+ for (let t = 0; idx >= 0 && t < 4; t++) {
99
+ let sub = Array.from({ length: m }, (_, i) => idx + i), s = scorePositions(query, target, sub);
100
+ s > best && (best = s, bestPositions = sub), idx = targetNorm.indexOf(query, idx + 1);
101
+ }
102
+ let lengthPenalty = Math.min((n - m) * 0.15, 6), score = (best - lengthPenalty) / (m * 37);
103
+ for (let k = 0; k < bestPositions.length; k++) {
104
+ let p = bestPositions[k];
105
+ (k === 0 || p !== bestPositions[k - 1] + 1) && charBonus(target, p) === 0 && (score *= 0.72);
106
+ }
107
+ return score = Math.max(0.01, Math.min(0.99, score)), { score, positions: bestPositions };
108
+ }
109
+ function greedyFrom(query, target, targetNorm, start) {
110
+ let m = query.length, positions = [], qi = 0;
111
+ for (let i = start; i < targetNorm.length && qi < m; i++)
112
+ if (targetNorm[i] === query[qi]) {
113
+ if (qi > 0 && charBonus(target, i) === 0 && i !== positions[positions.length - 1] + 1) {
114
+ let better = findBoundary(targetNorm, target, query, qi, i + 1);
115
+ better >= 0 && (i = better);
116
+ }
117
+ positions.push(i), qi++;
118
+ }
119
+ return qi === m ? positions : null;
120
+ }
121
+ function findBoundary(targetNorm, target, query, qi, from) {
122
+ let ch = query[qi], remaining = query.length - qi;
123
+ for (let j = from; j <= targetNorm.length - remaining; j++)
124
+ if (targetNorm[j] === ch && charBonus(target, j) > 0) {
125
+ let k = qi + 1;
126
+ for (let t = j + 1; t < targetNorm.length && k < query.length; t++) targetNorm[t] === query[k] && k++;
127
+ return k === query.length ? j : -1;
128
+ }
129
+ return -1;
130
+ }
131
+ function charMask(s) {
132
+ let m = 0;
133
+ for (let i = 0; i < s.length; i++) {
134
+ let c = s.charCodeAt(i);
135
+ c >= 97 && c <= 122 ? m |= 1 << c - 97 : c >= 48 && c <= 57 && (m |= 1 << 26);
136
+ }
137
+ return m;
138
+ }
139
+ var prepared = /* @__PURE__ */ new WeakMap();
140
+ function prepare(item) {
141
+ let p = prepared.get(item);
142
+ return (!p || p.title !== item.title) && (p = {
143
+ mask: 0,
144
+ title: item.title,
145
+ titleNorm: normalize(item.title),
146
+ subtitle: item.subtitle ? normalize(item.subtitle) : "",
147
+ keywords: item.keywords ? item.keywords.map(normalize) : [],
148
+ section: item.section ? normalize(item.section) : "",
149
+ description: item.description ? normalize(item.description) : ""
150
+ }, p.mask = charMask(`${p.titleNorm} ${p.subtitle} ${p.keywords.join(" ")} ${p.section} ${p.description}`), prepared.set(item, p)), p;
151
+ }
152
+ function matchItem(item, query) {
153
+ let q = normalize(query.trim());
154
+ return q ? matchPrepared(item, q, q.split(/\s+/).filter(Boolean), charMask(q)) : { score: 0, positions: [] };
155
+ }
156
+ function matchPrepared(item, q, tokens, qm) {
157
+ let p = prepare(item);
158
+ if ((qm & p.mask) !== qm) return null;
159
+ let whole = fuzzyMatch(q, p.title, p.titleNorm), tokenScore = 0, positions = /* @__PURE__ */ new Set(), tokensMatched = !0;
160
+ if (tokens.length > 1 || !whole) {
161
+ for (let token of tokens) {
162
+ let best = 0, t = fuzzyMatch(token, p.title, p.titleNorm);
163
+ if (t) {
164
+ best = t.score;
165
+ for (let pos of t.positions) positions.add(pos);
166
+ }
167
+ for (let kw of p.keywords) {
168
+ let k = fuzzyMatch(token, kw, kw);
169
+ k && k.score * 0.88 > best && (best = k.score * 0.88);
170
+ }
171
+ if (p.subtitle) {
172
+ let s = fuzzyMatch(token, p.subtitle, p.subtitle);
173
+ s && s.score * 0.7 > best && (best = s.score * 0.7);
174
+ }
175
+ if (p.section) {
176
+ let s = fuzzyMatch(token, p.section, p.section);
177
+ s && s.score * 0.5 > best && (best = s.score * 0.5);
178
+ }
179
+ if (best === 0 && p.description && token.length > 2 && p.description.includes(token) && (best = 0.3), best === 0) {
180
+ tokensMatched = !1;
181
+ break;
182
+ }
183
+ tokenScore += best;
184
+ }
185
+ tokenScore /= tokens.length;
186
+ }
187
+ let score = 0, finalPositions = [];
188
+ if (whole && whole.score >= tokenScore)
189
+ score = whole.score, finalPositions = whole.positions;
190
+ else if (tokensMatched && tokenScore > 0)
191
+ score = tokenScore * 0.95, finalPositions = [...positions].sort((a, b) => a - b);
192
+ else if (whole)
193
+ score = whole.score, finalPositions = whole.positions;
194
+ else
195
+ return null;
196
+ return p.titleNorm.startsWith(q) && (score = Math.min(0.995, score + 0.15)), { score, positions: finalPositions };
197
+ }
198
+ function rank(items, query, options = {}) {
199
+ let { boost, limit, threshold = 0.05 } = options, out = [], q = normalize(query.trim()), tokens = q.split(/\s+/).filter(Boolean), qm = charMask(q);
200
+ for (let item of items) {
201
+ let m = q ? matchPrepared(item, q, tokens, qm) : { score: 0, positions: [] };
202
+ if (!m || q && m.score < threshold) continue;
203
+ let score = m.score + (item.priority ?? 0) * 0.1;
204
+ boost && (score += boost(item)), out.push({ item, score, positions: m.positions });
205
+ }
206
+ let indexed = out.map((r, i) => [r, i]);
207
+ indexed.sort((a, b) => b[0].score - a[0].score || a[1] - b[1]);
208
+ let sorted = indexed.map((x) => x[0]), top = sorted[0]?.score ?? 0;
209
+ return q.length >= 3 && top >= 0.6 && (sorted = sorted.filter((r) => r.score >= top * 0.55)), limit ? sorted.slice(0, limit) : sorted;
210
+ }
211
+
212
+ // src/ui/icons.ts
213
+ var icons = {
214
+ search: '<circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/>',
215
+ command: '<path d="M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3"/>',
216
+ "arrow-right": '<path d="M5 12h14"/><path d="m12 5 7 7-7 7"/>',
217
+ "arrow-left": '<path d="M19 12H5"/><path d="m12 19-7-7 7-7"/>',
218
+ "arrow-up-right": '<path d="M7 17 17 7"/><path d="M7 7h10v10"/>',
219
+ "chevron-right": '<path d="m9 18 6-6-6-6"/>',
220
+ "chevron-left": '<path d="m15 18-6-6 6-6"/>',
221
+ "chevron-down": '<path d="m6 9 6 6 6-6"/>',
222
+ "corner-down-left": '<path d="M20 4v7a4 4 0 0 1-4 4H4"/><path d="m9 10-5 5 5 5"/>',
223
+ external: '<path d="M15 3h6v6"/><path d="M10 14 21 3"/><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/>',
224
+ link: '<path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/>',
225
+ copy: '<rect x="8" y="8" width="14" height="14" rx="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/>',
226
+ check: '<path d="M20 6 9 17l-5-5"/>',
227
+ x: '<path d="M18 6 6 18"/><path d="m6 6 12 12"/>',
228
+ plus: '<path d="M5 12h14"/><path d="M12 5v14"/>',
229
+ minus: '<path d="M5 12h14"/>',
230
+ home: '<path d="m3 10 9-7 9 7v10a2 2 0 0 1-2 2h-4v-7H9v7H5a2 2 0 0 1-2-2z"/>',
231
+ settings: '<path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"/><circle cx="12" cy="12" r="3"/>',
232
+ user: '<circle cx="12" cy="8" r="4"/><path d="M20 21a8 8 0 0 0-16 0"/>',
233
+ users: '<path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M22 21v-2a4 4 0 0 0-3-3.87"/><path d="M16 3.13a4 4 0 0 1 0 7.75"/>',
234
+ file: '<path d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5z"/><path d="M14 2v6h6"/>',
235
+ "file-text": '<path d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5z"/><path d="M14 2v6h6"/><path d="M16 13H8"/><path d="M16 17H8"/><path d="M10 9H8"/>',
236
+ folder: '<path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/>',
237
+ book: '<path d="M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H20v20H6.5a2.5 2.5 0 0 1 0-5H20"/>',
238
+ bookmark: '<path d="m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z"/>',
239
+ star: '<path d="m12 2 3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01z"/>',
240
+ heart: '<path d="M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z"/>',
241
+ clock: '<circle cx="12" cy="12" r="10"/><path d="M12 6v6l4 2"/>',
242
+ history: '<path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/><path d="M12 7v5l4 2"/>',
243
+ calendar: '<rect x="3" y="4" width="18" height="18" rx="2"/><path d="M16 2v4"/><path d="M8 2v4"/><path d="M3 10h18"/>',
244
+ calculator: '<rect x="4" y="2" width="16" height="20" rx="2"/><path d="M8 6h8"/><path d="M16 14v4"/><path d="M16 10h.01"/><path d="M12 10h.01"/><path d="M8 10h.01"/><path d="M12 14h.01"/><path d="M8 14h.01"/><path d="M12 18h.01"/><path d="M8 18h.01"/>',
245
+ sun: '<circle cx="12" cy="12" r="4"/><path d="M12 2v2"/><path d="M12 20v2"/><path d="m4.93 4.93 1.41 1.41"/><path d="m17.66 17.66 1.41 1.41"/><path d="M2 12h2"/><path d="M20 12h2"/><path d="m6.34 17.66-1.41 1.41"/><path d="m19.07 4.93-1.41 1.41"/>',
246
+ moon: '<path d="M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"/>',
247
+ monitor: '<rect x="2" y="3" width="20" height="14" rx="2"/><path d="M8 21h8"/><path d="M12 17v4"/>',
248
+ palette: '<circle cx="13.5" cy="6.5" r=".5" fill="currentColor"/><circle cx="17.5" cy="10.5" r=".5" fill="currentColor"/><circle cx="8.5" cy="7.5" r=".5" fill="currentColor"/><circle cx="6.5" cy="12.5" r=".5" fill="currentColor"/><path d="M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.93 0 1.65-.75 1.65-1.69 0-.44-.18-.84-.44-1.13-.29-.29-.44-.65-.44-1.13a1.64 1.64 0 0 1 1.67-1.67h2c3.05 0 5.56-2.5 5.56-5.55C21.97 6.01 17.46 2 12 2z"/>',
249
+ sparkles: '<path d="M9.94 15.5A2 2 0 0 0 8.5 14.06l-6.14-1.58a.5.5 0 0 1 0-.96L8.5 9.94A2 2 0 0 0 9.94 8.5l1.58-6.14a.5.5 0 0 1 .96 0L14.06 8.5A2 2 0 0 0 15.5 9.94l6.14 1.58a.5.5 0 0 1 0 .96L15.5 14.06a2 2 0 0 0-1.44 1.44l-1.58 6.14a.5.5 0 0 1-.96 0z"/><path d="M20 3v4"/><path d="M22 5h-4"/>',
250
+ bot: '<path d="M12 8V4H8"/><rect x="4" y="8" width="16" height="12" rx="2"/><path d="M2 14h2"/><path d="M20 14h2"/><path d="M15 13v2"/><path d="M9 13v2"/>',
251
+ message: '<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/>',
252
+ send: '<path d="m22 2-7 20-4-9-9-4Z"/><path d="M22 2 11 13"/>',
253
+ mail: '<rect x="2" y="4" width="20" height="16" rx="2"/><path d="m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"/>',
254
+ bell: '<path d="M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9"/><path d="M10.3 21a1.94 1.94 0 0 0 3.4 0"/>',
255
+ "credit-card": '<rect x="2" y="5" width="20" height="14" rx="2"/><path d="M2 10h20"/>',
256
+ key: '<circle cx="7.5" cy="15.5" r="5.5"/><path d="m21 2-9.6 9.6"/><path d="m15.5 7.5 3 3L22 7l-3-3"/>',
257
+ lock: '<rect x="3" y="11" width="18" height="11" rx="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/>',
258
+ "log-out": '<path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"/><path d="m16 17 5-5-5-5"/><path d="M21 12H9"/>',
259
+ trash: '<path d="M3 6h18"/><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/>',
260
+ pencil: '<path d="M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z"/>',
261
+ eye: '<path d="M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z"/><circle cx="12" cy="12" r="3"/>',
262
+ download: '<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><path d="m7 10 5 5 5-5"/><path d="M12 15V3"/>',
263
+ upload: '<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><path d="m17 8-5-5-5 5"/><path d="M12 3v12"/>',
264
+ refresh: '<path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"/><path d="M21 3v5h-5"/><path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"/><path d="M8 16H3v5"/>',
265
+ filter: '<path d="M22 3H2l8 9.46V19l4 2v-8.54z"/>',
266
+ globe: '<circle cx="12" cy="12" r="10"/><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"/><path d="M2 12h20"/>',
267
+ code: '<path d="m16 18 6-6-6-6"/><path d="m8 6-6 6 6 6"/>',
268
+ terminal: '<path d="m4 17 6-6-6-6"/><path d="M12 19h8"/>',
269
+ hash: '<path d="M4 9h16"/><path d="M4 15h16"/><path d="M10 3 8 21"/><path d="M16 3l-2 18"/>',
270
+ zap: '<path d="M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"/>',
271
+ layers: '<path d="m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z"/><path d="m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65"/><path d="m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65"/>',
272
+ grid: '<rect x="3" y="3" width="7" height="7" rx="1"/><rect x="14" y="3" width="7" height="7" rx="1"/><rect x="14" y="14" width="7" height="7" rx="1"/><rect x="3" y="14" width="7" height="7" rx="1"/>',
273
+ list: '<path d="M8 6h13"/><path d="M8 12h13"/><path d="M8 18h13"/><path d="M3 6h.01"/><path d="M3 12h.01"/><path d="M3 18h.01"/>',
274
+ image: '<rect x="3" y="3" width="18" height="18" rx="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.09-3.09a2 2 0 0 0-2.82 0L6 21"/>',
275
+ "git-branch": '<path d="M6 3v12"/><circle cx="18" cy="6" r="3"/><circle cx="6" cy="18" r="3"/><path d="M18 9a9 9 0 0 1-9 9"/>',
276
+ package: '<path d="m7.5 4.27 9 5.15"/><path d="M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"/><path d="m3.3 7 8.7 5 8.7-5"/><path d="M12 22V12"/>',
277
+ puzzle: '<path d="M19.44 7.85c-.05.38.09.76.36 1.02l1.57 1.57c.47.47.7 1.08.7 1.7s-.23 1.23-.7 1.7l-1.61 1.61a.98.98 0 0 1-.84.28c-.47-.07-.8-.48-.97-.92a2.5 2.5 0 1 0-3.21 3.21c.44.17.85.5.92.97a.98.98 0 0 1-.28.84l-1.61 1.61c-.47.47-1.08.7-1.7.7s-1.23-.23-1.7-.7l-1.57-1.57a1.2 1.2 0 0 0-1.02-.36c-.47.07-.8.48-.97.92a2.5 2.5 0 1 1-3.21-3.21c.44-.17.85-.5.92-.97a1.2 1.2 0 0 0-.36-1.02L2.7 13.7A2.4 2.4 0 0 1 2 12c0-.62.24-1.23.7-1.7l1.57-1.57c.26-.27.64-.4 1.02-.36.47.07.8.48.97.92a2.5 2.5 0 1 0 3.21-3.21c-.44-.17-.85-.5-.92-.97a1.2 1.2 0 0 1 .36-1.02L10.3 2.7c.47-.47 1.08-.7 1.7-.7s1.23.23 1.7.7l1.57 1.57c.26.27.64.4 1.02.36.47-.07.8-.48.97-.92a2.5 2.5 0 1 1 3.21 3.21c-.44.17-.85.5-.92.97Z"/>',
278
+ info: '<circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/>',
279
+ alert: '<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><path d="M12 9v4"/><path d="M12 17h.01"/>',
280
+ "check-circle": '<circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/>',
281
+ "x-circle": '<circle cx="12" cy="12" r="10"/><path d="m15 9-6 6"/><path d="m9 9 6 6"/>',
282
+ loader: '<path d="M21 12a9 9 0 1 1-6.22-8.56"/>',
283
+ circle: '<circle cx="12" cy="12" r="9"/>',
284
+ dot: '<circle cx="12" cy="12" r="4" fill="currentColor"/>',
285
+ "more-horizontal": '<circle cx="12" cy="12" r="1"/><circle cx="19" cy="12" r="1"/><circle cx="5" cy="12" r="1"/>',
286
+ "layout-dashboard": '<rect x="3" y="3" width="7" height="9" rx="1"/><rect x="14" y="3" width="7" height="5" rx="1"/><rect x="14" y="12" width="7" height="9" rx="1"/><rect x="3" y="16" width="7" height="5" rx="1"/>',
287
+ "bar-chart": '<path d="M3 3v18h18"/><path d="M18 17V9"/><path d="M13 17V5"/><path d="M8 17v-3"/>',
288
+ inbox: '<path d="M22 12h-6l-2 3h-4l-2-3H2"/><path d="M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"/>',
289
+ tag: '<path d="M12.59 2.59A2 2 0 0 0 11.17 2H4a2 2 0 0 0-2 2v7.17a2 2 0 0 0 .59 1.42l8.7 8.7a2.43 2.43 0 0 0 3.42 0l6.58-6.58a2.43 2.43 0 0 0 0-3.42z"/><circle cx="7.5" cy="7.5" r=".5" fill="currentColor"/>',
290
+ languages: '<path d="m5 8 6 6"/><path d="m4 14 6-6 2-3"/><path d="M2 5h12"/><path d="M7 2h1"/><path d="m22 22-5-10-5 10"/><path d="M14 18h6"/>',
291
+ wand: '<path d="m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72"/><path d="m14 7 3 3"/><path d="M5 6v4"/><path d="M19 14v4"/><path d="M10 2v2"/><path d="M7 8H3"/><path d="M21 16h-4"/><path d="M11 3H9"/>',
292
+ keyboard: '<rect x="2" y="4" width="20" height="16" rx="2"/><path d="M6 8h.01"/><path d="M10 8h.01"/><path d="M14 8h.01"/><path d="M18 8h.01"/><path d="M8 12h.01"/><path d="M12 12h.01"/><path d="M16 12h.01"/><path d="M7 16h10"/>',
293
+ github: '<path d="M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4"/><path d="M9 18c-4.51 2-5-2-7-2"/>'
294
+ };
295
+ function iconSvg(name, size = 16) {
296
+ let body = icons[name];
297
+ if (body)
298
+ return `<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${body}</svg>`;
299
+ }
300
+
301
+ // src/ui/nav.ts
302
+ async function copyText(text) {
303
+ try {
304
+ return await navigator.clipboard.writeText(text), !0;
305
+ } catch {
306
+ try {
307
+ let ta = document.createElement("textarea");
308
+ ta.value = text, ta.setAttribute("readonly", ""), ta.style.cssText = "position:fixed;top:-1000px;opacity:0", document.body.append(ta), ta.select();
309
+ let ok = document.execCommand("copy");
310
+ return ta.remove(), ok;
311
+ } catch {
312
+ return !1;
313
+ }
314
+ }
315
+ }
316
+ function defaultNavigate(href, newTab) {
317
+ if (newTab) {
318
+ window.open(href, "_blank", "noopener");
319
+ return;
320
+ }
321
+ let existing = [...document.querySelectorAll("a[href]")].find(
322
+ (a2) => a2.getAttribute("href") === href && !a2.closest(".qb-root") && (!a2.target || a2.target === "_self") && !a2.hasAttribute("download")
323
+ );
324
+ if (existing) {
325
+ existing.click();
326
+ return;
327
+ }
328
+ let a = document.createElement("a");
329
+ a.href = href, a.style.display = "none", document.body.append(a), a.click(), a.remove();
330
+ }
331
+
332
+ // src/ui/markdown.ts
333
+ var ESC = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" };
334
+ function escapeHtml(s) {
335
+ return s.replace(/[&<>"']/g, (c) => ESC[c]);
336
+ }
337
+ function safeUrl(url) {
338
+ let u = url.trim();
339
+ return /^(https?:|mailto:|tel:|#|\/|\.\.?\/)/i.test(u) || /^data:image\/(png|jpe?g|gif|webp|avif);/i.test(u) || !/^[a-z][a-z0-9+.-]*:/i.test(u) ? u : null;
340
+ }
341
+ function inline(src) {
342
+ let codes = [], s = src.replace(/(`+)([\s\S]*?[^`])\1(?!`)/g, (_, __, code) => (codes.push(`<code>${escapeHtml(code.trim())}</code>`), `\0${codes.length - 1}\0`));
343
+ return s = escapeHtml(s), s = s.replace(/!\[([^\]]*)\]\(([^)\s]+)(?:\s+&quot;([^&]*)&quot;)?\)/g, (m, alt, url) => {
344
+ let safe = safeUrl(unescape(url));
345
+ return safe ? `<img src="${escapeHtml(safe)}" alt="${alt}" loading="lazy">` : m;
346
+ }), s = s.replace(/\[([^\]]+)\]\(([^)\s]+)(?:\s+&quot;([^&]*)&quot;)?\)/g, (m, text, url) => {
347
+ let safe = safeUrl(unescape(url));
348
+ if (!safe) return text;
349
+ let external = /^https?:/i.test(safe);
350
+ return `<a href="${escapeHtml(safe)}"${external ? ' target="_blank" rel="noopener noreferrer"' : ""}>${text}</a>`;
351
+ }), s = s.replace(/(^|[\s(])(https?:\/\/[^\s<)]+[^\s<).,;:!?'"])/g, (_, pre, url) => `${pre}<a href="${url}" target="_blank" rel="noopener noreferrer">${url}</a>`), s = s.replace(/\*\*([^*]+)\*\*|__([^_]+)__/g, (_, a, b) => `<strong>${a ?? b}</strong>`), s = s.replace(/(^|[^*\w])\*([^*\s][^*]*?)\*(?!\w)/g, "$1<em>$2</em>"), s = s.replace(/(^|[^_\w])_([^_\s][^_]*?)_(?!\w)/g, "$1<em>$2</em>"), s = s.replace(/~~([^~]+)~~/g, "<del>$1</del>"), s = s.replace(/ {2,}\n|\\\n/g, "<br>"), s.replace(/\u0000(\d+)\u0000/g, (_, i) => codes[Number(i)]);
352
+ }
353
+ function unescape(s) {
354
+ return s.replace(/&amp;/g, "&").replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/&lt;/g, "<").replace(/&gt;/g, ">");
355
+ }
356
+ function renderMarkdown(md) {
357
+ let lines = md.replace(/\r\n?/g, `
358
+ `).split(`
359
+ `), out = [], para = [], lists = [], i = 0, flushPara = () => {
360
+ para.length && (out.push(`<p>${inline(para.join(`
361
+ `))}</p>`), para = []);
362
+ }, closeLists = (toIndent = -1) => {
363
+ for (; lists.length && lists[lists.length - 1].indent > toIndent; )
364
+ out.push(`</li></${lists.pop().type}>`);
365
+ };
366
+ for (; i < lines.length; ) {
367
+ let line = lines[i], fence = line.match(/^\s*(```+|~~~+)\s*([\w+#.-]*)/);
368
+ if (fence) {
369
+ flushPara(), closeLists();
370
+ let marker = fence[1], lang = fence[2] ?? "", body = [];
371
+ for (i++; i < lines.length && !lines[i].trim().startsWith(marker); ) body.push(lines[i++]);
372
+ i++, out.push(
373
+ `<div class="qb-code"><div class="qb-code-head"><span>${escapeHtml(lang)}</span><button type="button" class="qb-code-copy" data-qb-copy>Copy</button></div><pre><code${lang ? ` class="language-${escapeHtml(lang)}"` : ""}>${escapeHtml(body.join(`
374
+ `))}</code></pre></div>`
375
+ );
376
+ continue;
377
+ }
378
+ if (!line.trim()) {
379
+ flushPara();
380
+ let next = lines[i + 1] ?? "";
381
+ !/^\s*([-*+]|\d+[.)])\s+/.test(next) && !/^\s{2,}\S/.test(next) && closeLists(), i++;
382
+ continue;
383
+ }
384
+ let heading = line.match(/^(#{1,6})\s+(.*?)\s*#*\s*$/);
385
+ if (heading) {
386
+ flushPara(), closeLists();
387
+ let level = heading[1].length;
388
+ out.push(`<h${level}>${inline(heading[2])}</h${level}>`), i++;
389
+ continue;
390
+ }
391
+ if (/^\s*([-*_])(\s*\1){2,}\s*$/.test(line)) {
392
+ flushPara(), closeLists(), out.push("<hr>"), i++;
393
+ continue;
394
+ }
395
+ if (/^\s*>/.test(line)) {
396
+ flushPara(), closeLists();
397
+ let body = [];
398
+ for (; i < lines.length && /^\s*>/.test(lines[i]); ) body.push(lines[i++].replace(/^\s*>\s?/, ""));
399
+ out.push(`<blockquote>${renderMarkdown(body.join(`
400
+ `))}</blockquote>`);
401
+ continue;
402
+ }
403
+ if (line.includes("|") && /^\s*\|?\s*:?-{2,}:?\s*(\|\s*:?-{2,}:?\s*)*\|?\s*$/.test(lines[i + 1] ?? "")) {
404
+ flushPara(), closeLists();
405
+ let split = (l) => l.trim().replace(/^\||\|$/g, "").split("|").map((c) => c.trim()), head = split(line), aligns = split(lines[i + 1]).map((c) => c.startsWith(":") && c.endsWith(":") ? "center" : c.endsWith(":") ? "right" : "");
406
+ i += 2;
407
+ let rows = [];
408
+ for (; i < lines.length && lines[i].includes("|") && lines[i].trim(); ) rows.push(split(lines[i++]));
409
+ let cell = (tag, c, j) => `<${tag}${aligns[j] ? ` style="text-align:${aligns[j]}"` : ""}>${inline(c)}</${tag}>`;
410
+ out.push(
411
+ `<div class="qb-table"><table><thead><tr>${head.map((c, j) => cell("th", c, j)).join("")}</tr></thead><tbody>${rows.map((r) => `<tr>${r.map((c, j) => cell("td", c, j)).join("")}</tr>`).join("")}</tbody></table></div>`
412
+ );
413
+ continue;
414
+ }
415
+ let li = line.match(/^(\s*)([-*+]|\d+[.)])\s+(.*)$/);
416
+ if (li) {
417
+ flushPara();
418
+ let indent = li[1].length, type = /\d/.test(li[2]) ? "ol" : "ul", top = lists[lists.length - 1];
419
+ if (!top || indent > top.indent) {
420
+ let start = type === "ol" && parseInt(li[2], 10) !== 1 ? ` start="${parseInt(li[2], 10)}"` : "";
421
+ out.push(`<${type}${start}><li>`), lists.push({ type, indent });
422
+ } else {
423
+ closeLists(indent);
424
+ let current = lists[lists.length - 1];
425
+ current && current.type !== type ? (out.push(`</li></${lists.pop().type}><${type}><li>`), lists.push({ type, indent })) : current ? out.push("</li><li>") : (out.push(`<${type}><li>`), lists.push({ type, indent }));
426
+ }
427
+ let text = li[3], task = text.match(/^\[([ xX])\]\s+(.*)$/);
428
+ task ? text = `<input type="checkbox" disabled${task[1] !== " " ? " checked" : ""}> ${inline(task[2])}` : text = inline(text), i++;
429
+ let cont = [];
430
+ for (; i < lines.length && /^\s{2,}\S/.test(lines[i]) && !/^\s*([-*+]|\d+[.)])\s+/.test(lines[i]); ) cont.push(lines[i++].trim());
431
+ out.push(text + (cont.length ? ` ${inline(cont.join(`
432
+ `))}` : ""));
433
+ continue;
434
+ }
435
+ closeLists(), para.push(line), i++;
436
+ }
437
+ return flushPara(), closeLists(), out.join("");
438
+ }
439
+
440
+ export {
441
+ Frecency,
442
+ normalize,
443
+ fuzzyMatch,
444
+ matchItem,
445
+ rank,
446
+ icons,
447
+ iconSvg,
448
+ copyText,
449
+ defaultNavigate,
450
+ escapeHtml,
451
+ renderMarkdown
452
+ };
453
+ //# sourceMappingURL=chunk-VXTYD56F.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/core/frecency.ts", "../../src/core/search.ts", "../../src/ui/icons.ts", "../../src/ui/nav.ts", "../../src/ui/markdown.ts"],
4
+ "sourcesContent": ["import type { ScopedStorage } from './types.js'\n\ninterface Entry {\n /** Use count. */\n c: number\n /** Last used (ms). */\n t: number\n}\n\nconst HALF_LIFE = 1000 * 60 * 60 * 24 * 3 // 3 days\nconst MAX_ENTRIES = 200\n\n/**\n * Tracks how often and how recently items are used, to rank them higher\n * and show them as \"Recent\".\n */\nexport class Frecency {\n private entries: Record<string, Entry>\n\n constructor(private storage: ScopedStorage) {\n this.entries = storage.get<Record<string, Entry>>('frecency') ?? {}\n }\n\n record(id: string) {\n const e = this.entries[id] ?? { c: 0, t: 0 }\n e.c++\n e.t = Date.now()\n this.entries[id] = e\n const keys = Object.keys(this.entries)\n if (keys.length > MAX_ENTRIES) {\n keys.sort((a, b) => this.entries[a]!.t - this.entries[b]!.t)\n for (const k of keys.slice(0, keys.length - MAX_ENTRIES)) delete this.entries[k]\n }\n this.storage.set('frecency', this.entries)\n }\n\n /** A score in [0, 1). */\n score(id: string): number {\n const e = this.entries[id]\n if (!e) return 0\n const decay = Math.pow(0.5, (Date.now() - e.t) / HALF_LIFE)\n const raw = Math.log2(1 + e.c) * decay\n return raw / (1 + raw)\n }\n\n /** Ids sorted by score, best first. */\n top(limit: number): string[] {\n return Object.keys(this.entries)\n .map((id) => [id, this.score(id)] as const)\n .filter(([, s]) => s > 0.02)\n .sort((a, b) => b[1] - a[1])\n .slice(0, limit)\n .map(([id]) => id)\n }\n\n clear() {\n this.entries = {}\n this.storage.remove('frecency')\n }\n}\n", "/**\n * A small, fast fuzzy matcher tuned for command palettes.\n *\n * It favours matches at word boundaries, camelCase humps and consecutive runs\n * (\"gs\" \u2192 \"**G**it **S**tatus\", \"set\" \u2192 \"**Set**tings\"), runs in linear time\n * per field and needs no index build step.\n */\n\nimport type { Item } from './types.js'\n\nexport interface FuzzyMatch {\n /** 0 (bad) \u2026 1 (exact). */\n score: number\n /** Indices of matched characters in the target. */\n positions: number[]\n}\n\nconst SCORE_MATCH = 16\nconst BONUS_FIRST = 14\nconst BONUS_BOUNDARY = 10\nconst BONUS_CAMEL = 8\nconst BONUS_CONSECUTIVE = 6\nconst PENALTY_GAP_START = 3\nconst PENALTY_GAP_EXTENSION = 1\nconst MAX_PER_CHAR = SCORE_MATCH + BONUS_FIRST + BONUS_CONSECUTIVE + 1\n\nconst SEPARATORS = new Set([' ', '-', '_', '.', '/', ':', '\\\\', '(', '[', '{', ',', '@', '#', '\"', \"'\", '>', '|', '+', '&'])\n\n/** Lowercase and strip diacritics, keeping indices aligned with the original string. */\nexport function normalize(text: string): string {\n const lower = text.toLowerCase()\n // Fast path for ASCII.\n // eslint-disable-next-line no-control-regex\n if (!/[^\\u0000-\\u007f]/.test(lower)) return lower\n const stripped = lower.normalize('NFD').replace(/[\u0300-\u036F]/g, '')\n return stripped.length === lower.length ? stripped : lower\n}\n\nfunction charBonus(target: string, index: number): number {\n if (index === 0) return BONUS_FIRST\n const prev = target[index - 1]!\n if (SEPARATORS.has(prev)) return BONUS_BOUNDARY\n const ch = target[index]!\n if (prev !== prev.toUpperCase() && ch !== ch.toLowerCase()) return BONUS_CAMEL\n if (/[0-9]/.test(ch) && !/[0-9]/.test(prev)) return BONUS_BOUNDARY / 2\n return 0\n}\n\nfunction scorePositions(query: string, target: string, positions: number[]): number {\n let score = 0\n let prev = -2\n let streak = 0\n for (let k = 0; k < positions.length; k++) {\n const p = positions[k]!\n let s = SCORE_MATCH + charBonus(target, p)\n if (p === prev + 1) {\n streak++\n s += BONUS_CONSECUTIVE + Math.min(streak, 3)\n } else {\n streak = 0\n if (k > 0) {\n const gap = p - prev - 1\n s -= PENALTY_GAP_START + PENALTY_GAP_EXTENSION * Math.min(gap - 1, 12)\n }\n }\n if (target[p] === query[k]) s += 1\n score += s\n prev = p\n }\n return score\n}\n\n/**\n * Match `query` against `target`.\n * `query` must already be normalized (see `normalize`); `targetNorm` defaults to `normalize(target)`.\n */\nexport function fuzzyMatch(query: string, target: string, targetNorm: string = normalize(target)): FuzzyMatch | null {\n const m = query.length\n const n = targetNorm.length\n if (m === 0) return { score: 0, positions: [] }\n if (m > n) return null\n\n if (targetNorm === query) {\n return { score: 1, positions: Array.from({ length: m }, (_, i) => i) }\n }\n\n // 1. Forward pass: is the query a subsequence? Find the earliest end.\n let qi = 0\n let end = -1\n for (let i = 0; i < n; i++) {\n if (targetNorm[i] === query[qi]) {\n qi++\n if (qi === m) {\n end = i\n break\n }\n }\n }\n if (end < 0) return null\n\n // 2. Backward pass from `end` to find the tightest start.\n qi = m - 1\n let start = end\n for (let i = end; i >= 0; i--) {\n if (targetNorm[i] === query[qi]) {\n qi--\n if (qi < 0) {\n start = i\n break\n }\n }\n }\n\n // 3. Greedy forward passes from the tight window and from word boundaries,\n // preferring boundary characters. Keep the best.\n let bestPositions = greedyFrom(query, target, targetNorm, start)\n let best = bestPositions ? scorePositions(query, target, bestPositions) : -Infinity\n let tries = 0\n for (let i = 0; i < n - m + 1 && tries < 4; i++) {\n if (i === start || targetNorm[i] !== query[0] || charBonus(target, i) === 0) continue\n tries++\n const candidate = greedyFrom(query, target, targetNorm, i)\n if (!candidate) continue\n const s = scorePositions(query, target, candidate)\n if (s > best) {\n best = s\n bestPositions = candidate\n }\n }\n if (!bestPositions) return null\n\n // 4. Contiguous substring matches often beat scattered ones; check the first few.\n let idx = targetNorm.indexOf(query)\n for (let t = 0; idx >= 0 && t < 4; t++) {\n const sub = Array.from({ length: m }, (_, i) => idx + i)\n const s = scorePositions(query, target, sub)\n if (s > best) {\n best = s\n bestPositions = sub\n }\n idx = targetNorm.indexOf(query, idx + 1)\n }\n\n // Prefer shorter targets slightly.\n const lengthPenalty = Math.min((n - m) * 0.15, 6)\n let score = (best - lengthPenalty) / (m * MAX_PER_CHAR)\n // Each run of matched characters that starts mid-word is a weak signal\n // (\"set\" in \"Use SysTEm Theme\"); acronyms and word prefixes are not.\n for (let k = 0; k < bestPositions.length; k++) {\n const p = bestPositions[k]!\n if ((k === 0 || p !== bestPositions[k - 1]! + 1) && charBonus(target, p) === 0) score *= 0.72\n }\n score = Math.max(0.01, Math.min(0.99, score))\n return { score, positions: bestPositions }\n}\n\nfunction greedyFrom(query: string, target: string, targetNorm: string, start: number): number[] | null {\n const m = query.length\n const positions: number[] = []\n let qi = 0\n for (let i = start; i < targetNorm.length && qi < m; i++) {\n if (targetNorm[i] !== query[qi]) continue\n // Not at a boundary and not continuing a run: jump to a later boundary match if one fits.\n if (qi > 0 && charBonus(target, i) === 0 && i !== positions[positions.length - 1]! + 1) {\n const better = findBoundary(targetNorm, target, query, qi, i + 1)\n if (better >= 0) i = better\n }\n positions.push(i)\n qi++\n }\n return qi === m ? positions : null\n}\n\nfunction findBoundary(targetNorm: string, target: string, query: string, qi: number, from: number): number {\n const ch = query[qi]\n const remaining = query.length - qi\n for (let j = from; j <= targetNorm.length - remaining; j++) {\n if (targetNorm[j] === ch && charBonus(target, j) > 0) {\n // Ensure the rest of the query still fits after j.\n let k = qi + 1\n for (let t = j + 1; t < targetNorm.length && k < query.length; t++) if (targetNorm[t] === query[k]) k++\n if (k === query.length) return j\n return -1\n }\n }\n return -1\n}\n\n// \u2500\u2500\u2500 Item ranking \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n/** Bitmask of the letters/digits in a string, for fast rejection. */\nfunction charMask(s: string): number {\n let m = 0\n for (let i = 0; i < s.length; i++) {\n const c = s.charCodeAt(i)\n if (c >= 97 && c <= 122) m |= 1 << (c - 97)\n else if (c >= 48 && c <= 57) m |= 1 << 26\n }\n return m\n}\n\ninterface Prepared {\n mask: number\n title: string\n titleNorm: string\n subtitle: string\n keywords: string[]\n section: string\n description: string\n}\n\nconst prepared = new WeakMap<Item, Prepared>()\n\nfunction prepare(item: Item): Prepared {\n let p = prepared.get(item)\n if (!p || p.title !== item.title) {\n p = {\n mask: 0,\n title: item.title,\n titleNorm: normalize(item.title),\n subtitle: item.subtitle ? normalize(item.subtitle) : '',\n keywords: item.keywords ? item.keywords.map(normalize) : [],\n section: item.section ? normalize(item.section) : '',\n description: item.description ? normalize(item.description) : '',\n }\n p.mask = charMask(`${p.titleNorm} ${p.subtitle} ${p.keywords.join(' ')} ${p.section} ${p.description}`)\n prepared.set(item, p)\n }\n return p\n}\n\nexport interface ItemMatch {\n score: number\n /** Matched character indices in the title, for highlighting. */\n positions: number[]\n}\n\n/** Score an item against a query. Returns null when it doesn't match. */\nexport function matchItem(item: Item, query: string): ItemMatch | null {\n const q = normalize(query.trim())\n if (!q) return { score: 0, positions: [] }\n return matchPrepared(item, q, q.split(/\\s+/).filter(Boolean), charMask(q))\n}\n\nfunction matchPrepared(item: Item, q: string, tokens: string[], qm: number): ItemMatch | null {\n const p = prepare(item)\n if ((qm & p.mask) !== qm) return null\n\n // Whole-query title match first (handles spaces naturally).\n const whole = fuzzyMatch(q, p.title, p.titleNorm)\n\n let tokenScore = 0\n const positions = new Set<number>()\n let tokensMatched = true\n if (tokens.length > 1 || !whole) {\n for (const token of tokens) {\n let best = 0\n const t = fuzzyMatch(token, p.title, p.titleNorm)\n if (t) {\n best = t.score\n for (const pos of t.positions) positions.add(pos)\n }\n for (const kw of p.keywords) {\n const k = fuzzyMatch(token, kw, kw)\n if (k && k.score * 0.88 > best) best = k.score * 0.88\n }\n if (p.subtitle) {\n const s = fuzzyMatch(token, p.subtitle, p.subtitle)\n if (s && s.score * 0.7 > best) best = s.score * 0.7\n }\n if (p.section) {\n const s = fuzzyMatch(token, p.section, p.section)\n if (s && s.score * 0.5 > best) best = s.score * 0.5\n }\n if (best === 0 && p.description && token.length > 2 && p.description.includes(token)) best = 0.3\n if (best === 0) {\n tokensMatched = false\n break\n }\n tokenScore += best\n }\n tokenScore /= tokens.length\n }\n\n let score = 0\n let finalPositions: number[] = []\n if (whole && whole.score >= tokenScore) {\n score = whole.score\n finalPositions = whole.positions\n } else if (tokensMatched && tokenScore > 0) {\n score = tokenScore * 0.95\n finalPositions = [...positions].sort((a, b) => a - b)\n } else if (whole) {\n score = whole.score\n finalPositions = whole.positions\n } else {\n return null\n }\n\n // Strong prefix bonus.\n if (p.titleNorm.startsWith(q)) score = Math.min(0.995, score + 0.15)\n return { score, positions: finalPositions }\n}\n\nexport interface RankedItem<T extends Item = Item> {\n item: T\n score: number\n positions: number[]\n}\n\nexport interface RankOptions {\n /** Extra score per item (e.g. frecency), added after matching. */\n boost?: (item: Item) => number\n limit?: number\n /** Drop matches below this score. Default 0.05. */\n threshold?: number\n}\n\n/** Filter and sort items by relevance to `query`. Stable for equal scores. */\nexport function rank<T extends Item>(items: readonly T[], query: string, options: RankOptions = {}): RankedItem<T>[] {\n const { boost, limit, threshold = 0.05 } = options\n const out: RankedItem<T>[] = []\n const q = normalize(query.trim())\n const tokens = q.split(/\\s+/).filter(Boolean)\n const qm = charMask(q)\n for (const item of items) {\n const m = q ? matchPrepared(item, q, tokens, qm) : { score: 0, positions: [] }\n if (!m || (q && m.score < threshold)) continue\n let score = m.score + (item.priority ?? 0) * 0.1\n if (boost) score += boost(item)\n out.push({ item, score, positions: m.positions })\n }\n // Index-stable sort.\n const indexed = out.map((r, i) => [r, i] as const)\n indexed.sort((a, b) => b[0].score - a[0].score || a[1] - b[1])\n let sorted = indexed.map((x) => x[0])\n // With a strong match present, drop scattered low-quality matches.\n const top = sorted[0]?.score ?? 0\n if (q.length >= 3 && top >= 0.6) sorted = sorted.filter((r) => r.score >= top * 0.55)\n return limit ? sorted.slice(0, limit) : sorted\n}\n", "/**\n * Built-in icon set (24\u00D724, stroke based, Lucide-compatible geometry).\n * Use by name: `icon: \"settings\"`.\n */\nexport const icons = {\n search: '<circle cx=\"11\" cy=\"11\" r=\"7\"/><path d=\"m20 20-3.5-3.5\"/>',\n command: '<path d=\"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3\"/>',\n 'arrow-right': '<path d=\"M5 12h14\"/><path d=\"m12 5 7 7-7 7\"/>',\n 'arrow-left': '<path d=\"M19 12H5\"/><path d=\"m12 19-7-7 7-7\"/>',\n 'arrow-up-right': '<path d=\"M7 17 17 7\"/><path d=\"M7 7h10v10\"/>',\n 'chevron-right': '<path d=\"m9 18 6-6-6-6\"/>',\n 'chevron-left': '<path d=\"m15 18-6-6 6-6\"/>',\n 'chevron-down': '<path d=\"m6 9 6 6 6-6\"/>',\n 'corner-down-left': '<path d=\"M20 4v7a4 4 0 0 1-4 4H4\"/><path d=\"m9 10-5 5 5 5\"/>',\n external: '<path d=\"M15 3h6v6\"/><path d=\"M10 14 21 3\"/><path d=\"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6\"/>',\n link: '<path d=\"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71\"/><path d=\"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71\"/>',\n copy: '<rect x=\"8\" y=\"8\" width=\"14\" height=\"14\" rx=\"2\"/><path d=\"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\"/>',\n check: '<path d=\"M20 6 9 17l-5-5\"/>',\n x: '<path d=\"M18 6 6 18\"/><path d=\"m6 6 12 12\"/>',\n plus: '<path d=\"M5 12h14\"/><path d=\"M12 5v14\"/>',\n minus: '<path d=\"M5 12h14\"/>',\n home: '<path d=\"m3 10 9-7 9 7v10a2 2 0 0 1-2 2h-4v-7H9v7H5a2 2 0 0 1-2-2z\"/>',\n settings:\n '<path d=\"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z\"/><circle cx=\"12\" cy=\"12\" r=\"3\"/>',\n user: '<circle cx=\"12\" cy=\"8\" r=\"4\"/><path d=\"M20 21a8 8 0 0 0-16 0\"/>',\n users: '<path d=\"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2\"/><circle cx=\"9\" cy=\"7\" r=\"4\"/><path d=\"M22 21v-2a4 4 0 0 0-3-3.87\"/><path d=\"M16 3.13a4 4 0 0 1 0 7.75\"/>',\n file: '<path d=\"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5z\"/><path d=\"M14 2v6h6\"/>',\n 'file-text':\n '<path d=\"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5z\"/><path d=\"M14 2v6h6\"/><path d=\"M16 13H8\"/><path d=\"M16 17H8\"/><path d=\"M10 9H8\"/>',\n folder: '<path d=\"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z\"/>',\n book: '<path d=\"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H20v20H6.5a2.5 2.5 0 0 1 0-5H20\"/>',\n bookmark: '<path d=\"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z\"/>',\n star: '<path d=\"m12 2 3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01z\"/>',\n heart: '<path d=\"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z\"/>',\n clock: '<circle cx=\"12\" cy=\"12\" r=\"10\"/><path d=\"M12 6v6l4 2\"/>',\n history: '<path d=\"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8\"/><path d=\"M3 3v5h5\"/><path d=\"M12 7v5l4 2\"/>',\n calendar: '<rect x=\"3\" y=\"4\" width=\"18\" height=\"18\" rx=\"2\"/><path d=\"M16 2v4\"/><path d=\"M8 2v4\"/><path d=\"M3 10h18\"/>',\n calculator:\n '<rect x=\"4\" y=\"2\" width=\"16\" height=\"20\" rx=\"2\"/><path d=\"M8 6h8\"/><path d=\"M16 14v4\"/><path d=\"M16 10h.01\"/><path d=\"M12 10h.01\"/><path d=\"M8 10h.01\"/><path d=\"M12 14h.01\"/><path d=\"M8 14h.01\"/><path d=\"M12 18h.01\"/><path d=\"M8 18h.01\"/>',\n sun: '<circle cx=\"12\" cy=\"12\" r=\"4\"/><path d=\"M12 2v2\"/><path d=\"M12 20v2\"/><path d=\"m4.93 4.93 1.41 1.41\"/><path d=\"m17.66 17.66 1.41 1.41\"/><path d=\"M2 12h2\"/><path d=\"M20 12h2\"/><path d=\"m6.34 17.66-1.41 1.41\"/><path d=\"m19.07 4.93-1.41 1.41\"/>',\n moon: '<path d=\"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z\"/>',\n monitor: '<rect x=\"2\" y=\"3\" width=\"20\" height=\"14\" rx=\"2\"/><path d=\"M8 21h8\"/><path d=\"M12 17v4\"/>',\n palette:\n '<circle cx=\"13.5\" cy=\"6.5\" r=\".5\" fill=\"currentColor\"/><circle cx=\"17.5\" cy=\"10.5\" r=\".5\" fill=\"currentColor\"/><circle cx=\"8.5\" cy=\"7.5\" r=\".5\" fill=\"currentColor\"/><circle cx=\"6.5\" cy=\"12.5\" r=\".5\" fill=\"currentColor\"/><path d=\"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.93 0 1.65-.75 1.65-1.69 0-.44-.18-.84-.44-1.13-.29-.29-.44-.65-.44-1.13a1.64 1.64 0 0 1 1.67-1.67h2c3.05 0 5.56-2.5 5.56-5.55C21.97 6.01 17.46 2 12 2z\"/>',\n sparkles:\n '<path d=\"M9.94 15.5A2 2 0 0 0 8.5 14.06l-6.14-1.58a.5.5 0 0 1 0-.96L8.5 9.94A2 2 0 0 0 9.94 8.5l1.58-6.14a.5.5 0 0 1 .96 0L14.06 8.5A2 2 0 0 0 15.5 9.94l6.14 1.58a.5.5 0 0 1 0 .96L15.5 14.06a2 2 0 0 0-1.44 1.44l-1.58 6.14a.5.5 0 0 1-.96 0z\"/><path d=\"M20 3v4\"/><path d=\"M22 5h-4\"/>',\n bot: '<path d=\"M12 8V4H8\"/><rect x=\"4\" y=\"8\" width=\"16\" height=\"12\" rx=\"2\"/><path d=\"M2 14h2\"/><path d=\"M20 14h2\"/><path d=\"M15 13v2\"/><path d=\"M9 13v2\"/>',\n message: '<path d=\"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z\"/>',\n send: '<path d=\"m22 2-7 20-4-9-9-4Z\"/><path d=\"M22 2 11 13\"/>',\n mail: '<rect x=\"2\" y=\"4\" width=\"20\" height=\"16\" rx=\"2\"/><path d=\"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7\"/>',\n bell: '<path d=\"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9\"/><path d=\"M10.3 21a1.94 1.94 0 0 0 3.4 0\"/>',\n 'credit-card': '<rect x=\"2\" y=\"5\" width=\"20\" height=\"14\" rx=\"2\"/><path d=\"M2 10h20\"/>',\n key: '<circle cx=\"7.5\" cy=\"15.5\" r=\"5.5\"/><path d=\"m21 2-9.6 9.6\"/><path d=\"m15.5 7.5 3 3L22 7l-3-3\"/>',\n lock: '<rect x=\"3\" y=\"11\" width=\"18\" height=\"11\" rx=\"2\"/><path d=\"M7 11V7a5 5 0 0 1 10 0v4\"/>',\n 'log-out': '<path d=\"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4\"/><path d=\"m16 17 5-5-5-5\"/><path d=\"M21 12H9\"/>',\n trash: '<path d=\"M3 6h18\"/><path d=\"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6\"/><path d=\"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2\"/>',\n pencil: '<path d=\"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z\"/>',\n eye: '<path d=\"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z\"/><circle cx=\"12\" cy=\"12\" r=\"3\"/>',\n download: '<path d=\"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4\"/><path d=\"m7 10 5 5 5-5\"/><path d=\"M12 15V3\"/>',\n upload: '<path d=\"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4\"/><path d=\"m17 8-5-5-5 5\"/><path d=\"M12 3v12\"/>',\n refresh: '<path d=\"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8\"/><path d=\"M21 3v5h-5\"/><path d=\"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16\"/><path d=\"M8 16H3v5\"/>',\n filter: '<path d=\"M22 3H2l8 9.46V19l4 2v-8.54z\"/>',\n globe: '<circle cx=\"12\" cy=\"12\" r=\"10\"/><path d=\"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20\"/><path d=\"M2 12h20\"/>',\n code: '<path d=\"m16 18 6-6-6-6\"/><path d=\"m8 6-6 6 6 6\"/>',\n terminal: '<path d=\"m4 17 6-6-6-6\"/><path d=\"M12 19h8\"/>',\n hash: '<path d=\"M4 9h16\"/><path d=\"M4 15h16\"/><path d=\"M10 3 8 21\"/><path d=\"M16 3l-2 18\"/>',\n zap: '<path d=\"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z\"/>',\n layers: '<path d=\"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z\"/><path d=\"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65\"/><path d=\"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65\"/>',\n grid: '<rect x=\"3\" y=\"3\" width=\"7\" height=\"7\" rx=\"1\"/><rect x=\"14\" y=\"3\" width=\"7\" height=\"7\" rx=\"1\"/><rect x=\"14\" y=\"14\" width=\"7\" height=\"7\" rx=\"1\"/><rect x=\"3\" y=\"14\" width=\"7\" height=\"7\" rx=\"1\"/>',\n list: '<path d=\"M8 6h13\"/><path d=\"M8 12h13\"/><path d=\"M8 18h13\"/><path d=\"M3 6h.01\"/><path d=\"M3 12h.01\"/><path d=\"M3 18h.01\"/>',\n image: '<rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"2\"/><circle cx=\"9\" cy=\"9\" r=\"2\"/><path d=\"m21 15-3.09-3.09a2 2 0 0 0-2.82 0L6 21\"/>',\n 'git-branch': '<path d=\"M6 3v12\"/><circle cx=\"18\" cy=\"6\" r=\"3\"/><circle cx=\"6\" cy=\"18\" r=\"3\"/><path d=\"M18 9a9 9 0 0 1-9 9\"/>',\n package: '<path d=\"m7.5 4.27 9 5.15\"/><path d=\"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z\"/><path d=\"m3.3 7 8.7 5 8.7-5\"/><path d=\"M12 22V12\"/>',\n puzzle: '<path d=\"M19.44 7.85c-.05.38.09.76.36 1.02l1.57 1.57c.47.47.7 1.08.7 1.7s-.23 1.23-.7 1.7l-1.61 1.61a.98.98 0 0 1-.84.28c-.47-.07-.8-.48-.97-.92a2.5 2.5 0 1 0-3.21 3.21c.44.17.85.5.92.97a.98.98 0 0 1-.28.84l-1.61 1.61c-.47.47-1.08.7-1.7.7s-1.23-.23-1.7-.7l-1.57-1.57a1.2 1.2 0 0 0-1.02-.36c-.47.07-.8.48-.97.92a2.5 2.5 0 1 1-3.21-3.21c.44-.17.85-.5.92-.97a1.2 1.2 0 0 0-.36-1.02L2.7 13.7A2.4 2.4 0 0 1 2 12c0-.62.24-1.23.7-1.7l1.57-1.57c.26-.27.64-.4 1.02-.36.47.07.8.48.97.92a2.5 2.5 0 1 0 3.21-3.21c-.44-.17-.85-.5-.92-.97a1.2 1.2 0 0 1 .36-1.02L10.3 2.7c.47-.47 1.08-.7 1.7-.7s1.23.23 1.7.7l1.57 1.57c.26.27.64.4 1.02.36.47-.07.8-.48.97-.92a2.5 2.5 0 1 1 3.21 3.21c-.44.17-.85.5-.92.97Z\"/>',\n info: '<circle cx=\"12\" cy=\"12\" r=\"10\"/><path d=\"M12 16v-4\"/><path d=\"M12 8h.01\"/>',\n alert: '<path d=\"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3\"/><path d=\"M12 9v4\"/><path d=\"M12 17h.01\"/>',\n 'check-circle': '<circle cx=\"12\" cy=\"12\" r=\"10\"/><path d=\"m9 12 2 2 4-4\"/>',\n 'x-circle': '<circle cx=\"12\" cy=\"12\" r=\"10\"/><path d=\"m15 9-6 6\"/><path d=\"m9 9 6 6\"/>',\n loader: '<path d=\"M21 12a9 9 0 1 1-6.22-8.56\"/>',\n circle: '<circle cx=\"12\" cy=\"12\" r=\"9\"/>',\n dot: '<circle cx=\"12\" cy=\"12\" r=\"4\" fill=\"currentColor\"/>',\n 'more-horizontal': '<circle cx=\"12\" cy=\"12\" r=\"1\"/><circle cx=\"19\" cy=\"12\" r=\"1\"/><circle cx=\"5\" cy=\"12\" r=\"1\"/>',\n 'layout-dashboard': '<rect x=\"3\" y=\"3\" width=\"7\" height=\"9\" rx=\"1\"/><rect x=\"14\" y=\"3\" width=\"7\" height=\"5\" rx=\"1\"/><rect x=\"14\" y=\"12\" width=\"7\" height=\"9\" rx=\"1\"/><rect x=\"3\" y=\"16\" width=\"7\" height=\"5\" rx=\"1\"/>',\n 'bar-chart': '<path d=\"M3 3v18h18\"/><path d=\"M18 17V9\"/><path d=\"M13 17V5\"/><path d=\"M8 17v-3\"/>',\n inbox: '<path d=\"M22 12h-6l-2 3h-4l-2-3H2\"/><path d=\"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z\"/>',\n tag: '<path d=\"M12.59 2.59A2 2 0 0 0 11.17 2H4a2 2 0 0 0-2 2v7.17a2 2 0 0 0 .59 1.42l8.7 8.7a2.43 2.43 0 0 0 3.42 0l6.58-6.58a2.43 2.43 0 0 0 0-3.42z\"/><circle cx=\"7.5\" cy=\"7.5\" r=\".5\" fill=\"currentColor\"/>',\n languages: '<path d=\"m5 8 6 6\"/><path d=\"m4 14 6-6 2-3\"/><path d=\"M2 5h12\"/><path d=\"M7 2h1\"/><path d=\"m22 22-5-10-5 10\"/><path d=\"M14 18h6\"/>',\n wand: '<path d=\"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72\"/><path d=\"m14 7 3 3\"/><path d=\"M5 6v4\"/><path d=\"M19 14v4\"/><path d=\"M10 2v2\"/><path d=\"M7 8H3\"/><path d=\"M21 16h-4\"/><path d=\"M11 3H9\"/>',\n keyboard: '<rect x=\"2\" y=\"4\" width=\"20\" height=\"16\" rx=\"2\"/><path d=\"M6 8h.01\"/><path d=\"M10 8h.01\"/><path d=\"M14 8h.01\"/><path d=\"M18 8h.01\"/><path d=\"M8 12h.01\"/><path d=\"M12 12h.01\"/><path d=\"M16 12h.01\"/><path d=\"M7 16h10\"/>',\n github:\n '<path d=\"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4\"/><path d=\"M9 18c-4.51 2-5-2-7-2\"/>',\n} as const\n\nexport type IconName = keyof typeof icons\n\nexport function iconSvg(name: string, size = 16): string | undefined {\n const body = (icons as Record<string, string>)[name]\n if (!body) return undefined\n return `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"${size}\" height=\"${size}\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">${body}</svg>`\n}\n", "export async function copyText(text: string): Promise<boolean> {\n try {\n await navigator.clipboard.writeText(text)\n return true\n } catch {\n try {\n const ta = document.createElement('textarea')\n ta.value = text\n ta.setAttribute('readonly', '')\n ta.style.cssText = 'position:fixed;top:-1000px;opacity:0'\n document.body.append(ta)\n ta.select()\n const ok = document.execCommand('copy')\n ta.remove()\n return ok\n } catch {\n return false\n }\n }\n}\n\n/**\n * Default router: click an existing link to the same href (so framework link\n * handlers run), otherwise click a temporary anchor (picked up by routers that\n * intercept anchor clicks, like SvelteKit, Astro, Nuxt, Turbo) or fall back to a\n * normal navigation.\n */\nexport function defaultNavigate(href: string, newTab: boolean) {\n if (newTab) {\n window.open(href, '_blank', 'noopener')\n return\n }\n const existing = [...document.querySelectorAll<HTMLAnchorElement>('a[href]')].find(\n (a) => a.getAttribute('href') === href && !a.closest('.qb-root') && (!a.target || a.target === '_self') && !a.hasAttribute('download'),\n )\n if (existing) {\n existing.click()\n return\n }\n const a = document.createElement('a')\n a.href = href\n a.style.display = 'none'\n document.body.append(a)\n a.click()\n a.remove()\n}\n", "/**\n * A small, safe Markdown renderer for detail views and AI answers.\n * All input is escaped; raw HTML is never passed through.\n * Supports headings, paragraphs, emphasis, inline code, fenced code blocks,\n * links, images, block quotes, ordered/unordered/task lists, tables and rules.\n */\n\nconst ESC: Record<string, string> = { '&': '&amp;', '<': '&lt;', '>': '&gt;', '\"': '&quot;', \"'\": '&#39;' }\n\nexport function escapeHtml(s: string): string {\n return s.replace(/[&<>\"']/g, (c) => ESC[c]!)\n}\n\nfunction safeUrl(url: string): string | null {\n const u = url.trim()\n if (/^(https?:|mailto:|tel:|#|\\/|\\.\\.?\\/)/i.test(u)) return u\n if (/^data:image\\/(png|jpe?g|gif|webp|avif);/i.test(u)) return u\n if (!/^[a-z][a-z0-9+.-]*:/i.test(u)) return u // relative\n return null\n}\n\nfunction inline(src: string): string {\n // Protect code spans first.\n const codes: string[] = []\n let s = src.replace(/(`+)([\\s\\S]*?[^`])\\1(?!`)/g, (_, __, code: string) => {\n codes.push(`<code>${escapeHtml(code.trim())}</code>`)\n return `\\u0000${codes.length - 1}\\u0000`\n })\n s = escapeHtml(s)\n // Images ![alt](src)\n s = s.replace(/!\\[([^\\]]*)\\]\\(([^)\\s]+)(?:\\s+&quot;([^&]*)&quot;)?\\)/g, (m, alt: string, url: string) => {\n const safe = safeUrl(unescape(url))\n return safe ? `<img src=\"${escapeHtml(safe)}\" alt=\"${alt}\" loading=\"lazy\">` : m\n })\n // Links [text](url)\n s = s.replace(/\\[([^\\]]+)\\]\\(([^)\\s]+)(?:\\s+&quot;([^&]*)&quot;)?\\)/g, (m, text: string, url: string) => {\n const safe = safeUrl(unescape(url))\n if (!safe) return text\n const external = /^https?:/i.test(safe)\n return `<a href=\"${escapeHtml(safe)}\"${external ? ' target=\"_blank\" rel=\"noopener noreferrer\"' : ''}>${text}</a>`\n })\n // Autolinks\n s = s.replace(/(^|[\\s(])(https?:\\/\\/[^\\s<)]+[^\\s<).,;:!?'\"])/g, (_, pre: string, url: string) => `${pre}<a href=\"${url}\" target=\"_blank\" rel=\"noopener noreferrer\">${url}</a>`)\n // Bold, italic, strikethrough\n s = s.replace(/\\*\\*([^*]+)\\*\\*|__([^_]+)__/g, (_, a, b) => `<strong>${a ?? b}</strong>`)\n s = s.replace(/(^|[^*\\w])\\*([^*\\s][^*]*?)\\*(?!\\w)/g, '$1<em>$2</em>')\n s = s.replace(/(^|[^_\\w])_([^_\\s][^_]*?)_(?!\\w)/g, '$1<em>$2</em>')\n s = s.replace(/~~([^~]+)~~/g, '<del>$1</del>')\n // Hard line breaks\n s = s.replace(/ {2,}\\n|\\\\\\n/g, '<br>')\n // eslint-disable-next-line no-control-regex\n return s.replace(/\\u0000(\\d+)\\u0000/g, (_, i) => codes[Number(i)]!)\n}\n\nfunction unescape(s: string): string {\n return s.replace(/&amp;/g, '&').replace(/&quot;/g, '\"').replace(/&#39;/g, \"'\").replace(/&lt;/g, '<').replace(/&gt;/g, '>')\n}\n\ninterface ListFrame {\n type: 'ul' | 'ol'\n indent: number\n}\n\nexport function renderMarkdown(md: string): string {\n const lines = md.replace(/\\r\\n?/g, '\\n').split('\\n')\n const out: string[] = []\n let para: string[] = []\n const lists: ListFrame[] = []\n let i = 0\n\n const flushPara = () => {\n if (para.length) {\n out.push(`<p>${inline(para.join('\\n'))}</p>`)\n para = []\n }\n }\n const closeLists = (toIndent = -1) => {\n while (lists.length && lists[lists.length - 1]!.indent > toIndent) {\n out.push(`</li></${lists.pop()!.type}>`)\n }\n }\n\n while (i < lines.length) {\n const line = lines[i]!\n\n // Fenced code\n const fence = line.match(/^\\s*(```+|~~~+)\\s*([\\w+#.-]*)/)\n if (fence) {\n flushPara()\n closeLists()\n const marker = fence[1]!\n const lang = fence[2] ?? ''\n const body: string[] = []\n i++\n while (i < lines.length && !lines[i]!.trim().startsWith(marker)) body.push(lines[i++]!)\n i++\n out.push(\n `<div class=\"qb-code\"><div class=\"qb-code-head\"><span>${escapeHtml(lang)}</span><button type=\"button\" class=\"qb-code-copy\" data-qb-copy>Copy</button></div><pre><code${lang ? ` class=\"language-${escapeHtml(lang)}\"` : ''}>${escapeHtml(body.join('\\n'))}</code></pre></div>`,\n )\n continue\n }\n\n if (!line.trim()) {\n flushPara()\n // A blank line inside a list keeps the list open if the next line continues it.\n const next = lines[i + 1] ?? ''\n if (!/^\\s*([-*+]|\\d+[.)])\\s+/.test(next) && !/^\\s{2,}\\S/.test(next)) closeLists()\n i++\n continue\n }\n\n // Heading\n const heading = line.match(/^(#{1,6})\\s+(.*?)\\s*#*\\s*$/)\n if (heading) {\n flushPara()\n closeLists()\n const level = heading[1]!.length\n out.push(`<h${level}>${inline(heading[2]!)}</h${level}>`)\n i++\n continue\n }\n\n // Horizontal rule\n if (/^\\s*([-*_])(\\s*\\1){2,}\\s*$/.test(line)) {\n flushPara()\n closeLists()\n out.push('<hr>')\n i++\n continue\n }\n\n // Block quote\n if (/^\\s*>/.test(line)) {\n flushPara()\n closeLists()\n const body: string[] = []\n while (i < lines.length && /^\\s*>/.test(lines[i]!)) body.push(lines[i++]!.replace(/^\\s*>\\s?/, ''))\n out.push(`<blockquote>${renderMarkdown(body.join('\\n'))}</blockquote>`)\n continue\n }\n\n // Table\n if (line.includes('|') && /^\\s*\\|?\\s*:?-{2,}:?\\s*(\\|\\s*:?-{2,}:?\\s*)*\\|?\\s*$/.test(lines[i + 1] ?? '')) {\n flushPara()\n closeLists()\n const split = (l: string) =>\n l\n .trim()\n .replace(/^\\||\\|$/g, '')\n .split('|')\n .map((c) => c.trim())\n const head = split(line)\n const aligns = split(lines[i + 1]!).map((c) => (c.startsWith(':') && c.endsWith(':') ? 'center' : c.endsWith(':') ? 'right' : ''))\n i += 2\n const rows: string[][] = []\n while (i < lines.length && lines[i]!.includes('|') && lines[i]!.trim()) rows.push(split(lines[i++]!))\n const cell = (tag: string, c: string, j: number) => `<${tag}${aligns[j] ? ` style=\"text-align:${aligns[j]}\"` : ''}>${inline(c)}</${tag}>`\n out.push(\n `<div class=\"qb-table\"><table><thead><tr>${head.map((c, j) => cell('th', c, j)).join('')}</tr></thead><tbody>${rows\n .map((r) => `<tr>${r.map((c, j) => cell('td', c, j)).join('')}</tr>`)\n .join('')}</tbody></table></div>`,\n )\n continue\n }\n\n // List item\n const li = line.match(/^(\\s*)([-*+]|\\d+[.)])\\s+(.*)$/)\n if (li) {\n flushPara()\n const indent = li[1]!.length\n const type: 'ul' | 'ol' = /\\d/.test(li[2]!) ? 'ol' : 'ul'\n const top = lists[lists.length - 1]\n if (!top || indent > top.indent) {\n const start = type === 'ol' && parseInt(li[2]!, 10) !== 1 ? ` start=\"${parseInt(li[2]!, 10)}\"` : ''\n out.push(`<${type}${start}><li>`)\n lists.push({ type, indent })\n } else {\n closeLists(indent)\n const current = lists[lists.length - 1]\n if (current && current.type !== type) {\n out.push(`</li></${lists.pop()!.type}><${type}><li>`)\n lists.push({ type, indent })\n } else if (current) {\n out.push('</li><li>')\n } else {\n out.push(`<${type}><li>`)\n lists.push({ type, indent })\n }\n }\n let text = li[3]!\n const task = text.match(/^\\[([ xX])\\]\\s+(.*)$/)\n if (task) text = `<input type=\"checkbox\" disabled${task[1] !== ' ' ? ' checked' : ''}> ${inline(task[2]!)}`\n else text = inline(text)\n // Continuation lines\n i++\n const cont: string[] = []\n while (i < lines.length && /^\\s{2,}\\S/.test(lines[i]!) && !/^\\s*([-*+]|\\d+[.)])\\s+/.test(lines[i]!)) cont.push(lines[i++]!.trim())\n out.push(text + (cont.length ? ` ${inline(cont.join('\\n'))}` : ''))\n continue\n }\n\n closeLists()\n para.push(line)\n i++\n }\n flushPara()\n closeLists()\n return out.join('')\n}\n"],
5
+ "mappings": ";;;;;AAgBO,IAAM,WAAN,MAAe;AAAA,EAGpB,YAAoB,SAAwB;AAAxB;AAFpB,wBAAQ;AAGN,SAAK,UAAU,QAAQ,IAA2B,UAAU,KAAK,CAAC;AAAA,EACpE;AAAA,EAEA,OAAO,IAAY;AACjB,QAAM,IAAI,KAAK,QAAQ,EAAE,KAAK,EAAE,GAAG,GAAG,GAAG,EAAE;AAC3C,MAAE,KACF,EAAE,IAAI,KAAK,IAAI,GACf,KAAK,QAAQ,EAAE,IAAI;AACnB,QAAM,OAAO,OAAO,KAAK,KAAK,OAAO;AACrC,QAAI,KAAK,SAAS,KAAa;AAC7B,WAAK,KAAK,CAAC,GAAG,MAAM,KAAK,QAAQ,CAAC,EAAG,IAAI,KAAK,QAAQ,CAAC,EAAG,CAAC;AAC3D,eAAW,KAAK,KAAK,MAAM,GAAG,KAAK,SAAS,GAAW,EAAG,QAAO,KAAK,QAAQ,CAAC;AAAA,IACjF;AACA,SAAK,QAAQ,IAAI,YAAY,KAAK,OAAO;AA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