@hadoku/resume-bot 3.15.57 → 3.15.59

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/builder.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { jsxs as c, jsx as a } from "react/jsx-runtime";
2
2
  import { createRoot as Z } from "react-dom/client";
3
3
  import { logger as E } from "@wolffm/logger/client";
4
- import { useState as d, useRef as ee, useEffect as W, useMemo as D } from "react";
5
- class H extends Error {
4
+ import { useState as d, useRef as ee, useEffect as M, useMemo as D } from "react";
5
+ class G extends Error {
6
6
  constructor(s, l) {
7
7
  super(s), this.status = l, this.name = "BuilderApiError";
8
8
  }
@@ -11,7 +11,7 @@ let X = "";
11
11
  function re(e) {
12
12
  X = e.replace(/\/+$/, "");
13
13
  }
14
- async function j(e, s) {
14
+ async function O(e, s) {
15
15
  const l = await fetch(`${X}/builder${e}`, {
16
16
  ...s,
17
17
  credentials: "include",
@@ -20,28 +20,28 @@ async function j(e, s) {
20
20
  if (!l.ok) {
21
21
  let i = `${l.status}`;
22
22
  try {
23
- const u = await l.json();
24
- i = u.message ? `${u.error}: ${u.message}` : u.error ?? i;
23
+ const b = await l.json();
24
+ i = b.message ? `${b.error}: ${b.message}` : b.error ?? i;
25
25
  } catch {
26
26
  }
27
- throw new H(i, l.status);
27
+ throw new G(i, l.status);
28
28
  }
29
29
  return await l.json();
30
30
  }
31
31
  function ae() {
32
- return j("/blocks");
32
+ return O("/blocks");
33
33
  }
34
34
  function oe(e) {
35
- return j(`/blocks/${encodeURIComponent(e.id)}`, {
35
+ return O(`/blocks/${encodeURIComponent(e.id)}`, {
36
36
  method: "PUT",
37
37
  body: JSON.stringify(e)
38
38
  });
39
39
  }
40
40
  function te(e) {
41
- return j(`/blocks/${encodeURIComponent(e)}`, { method: "DELETE" });
41
+ return O(`/blocks/${encodeURIComponent(e)}`, { method: "DELETE" });
42
42
  }
43
43
  function ne(e, s) {
44
- return j(`/feedback/${encodeURIComponent(e)}`, {
44
+ return O(`/feedback/${encodeURIComponent(e)}`, {
45
45
  method: "POST",
46
46
  body: JSON.stringify({ text: s })
47
47
  });
@@ -54,30 +54,30 @@ const le = [
54
54
  "summary",
55
55
  "header"
56
56
  ];
57
- function M({
57
+ function J({
58
58
  block: e,
59
59
  feedback: s,
60
60
  existingIds: l,
61
61
  isNew: i = !1,
62
- onSave: u,
62
+ onSave: b,
63
63
  onDelete: p,
64
- onCancel: O,
64
+ onCancel: j,
65
65
  onFeedback: R,
66
66
  onTagClick: I
67
67
  }) {
68
- const [b, m] = d(e), [y, _] = d(e.tags.join(" ")), [N, g] = d(!1), [B, f] = d(null), [A, v] = d(s?.text ?? ""), [F, k] = d(""), x = ee(void 0);
69
- W(() => {
70
- i || (m(e), _(e.tags.join(" ")));
68
+ const [u, h] = d(e), [y, _] = d(e.tags.join(" ")), [N, g] = d(!1), [B, f] = d(null), [A, v] = d(s?.text ?? ""), [F, k] = d(""), x = ee(void 0);
69
+ M(() => {
70
+ i || (h(e), _(e.tags.join(" ")));
71
71
  }, [e, i]);
72
- const w = i || JSON.stringify({ ...b, tags: C(y) }) !== JSON.stringify(e);
72
+ const w = i || JSON.stringify({ ...u, tags: C(y) }) !== JSON.stringify(e);
73
73
  function C(o) {
74
74
  return [...new Set(o.split(/[\s,]+/).filter(Boolean))];
75
75
  }
76
- const T = i && (!/^[a-z0-9][a-z0-9-]*$/.test(b.id) || l.includes(b.id));
76
+ const T = i && (!/^[a-z0-9][a-z0-9-]*$/.test(u.id) || l.includes(u.id));
77
77
  async function S() {
78
78
  g(!0), f(null);
79
79
  try {
80
- await u({ ...b, tags: C(y) });
80
+ await b({ ...u, tags: C(y) });
81
81
  } catch (o) {
82
82
  f(o instanceof Error ? o.message : "Save failed");
83
83
  } finally {
@@ -110,16 +110,16 @@ function M({
110
110
  {
111
111
  className: "rb-block__id-input",
112
112
  placeholder: "block-id (kebab-case)",
113
- value: b.id,
114
- onChange: (o) => m({ ...b, id: o.target.value })
113
+ value: u.id,
114
+ onChange: (o) => h({ ...u, id: o.target.value })
115
115
  }
116
- ) : /* @__PURE__ */ a("span", { className: "rb-block__id", children: b.id }),
116
+ ) : /* @__PURE__ */ a("span", { className: "rb-block__id", children: u.id }),
117
117
  /* @__PURE__ */ a(
118
118
  "select",
119
119
  {
120
120
  className: "rb-block__type",
121
- value: b.type,
122
- onChange: (o) => m({ ...b, type: o.target.value }),
121
+ value: u.type,
122
+ onChange: (o) => h({ ...u, type: o.target.value }),
123
123
  children: le.map((o) => /* @__PURE__ */ a("option", { value: o, children: o }, o))
124
124
  }
125
125
  ),
@@ -136,8 +136,8 @@ function M({
136
136
  type: "number",
137
137
  min: 0,
138
138
  max: 10,
139
- value: b.priority,
140
- onChange: (o) => m({ ...b, priority: Number(o.target.value) })
139
+ value: u.priority,
140
+ onChange: (o) => h({ ...u, priority: Number(o.target.value) })
141
141
  }
142
142
  )
143
143
  ]
@@ -149,8 +149,8 @@ function M({
149
149
  {
150
150
  className: "rb-block__title",
151
151
  placeholder: "title (review label — not rendered into the resume)",
152
- value: b.title,
153
- onChange: (o) => m({ ...b, title: o.target.value })
152
+ value: u.title,
153
+ onChange: (o) => h({ ...u, title: o.target.value })
154
154
  }
155
155
  ),
156
156
  /* @__PURE__ */ a("div", { className: "rb-block__chips", children: C(y).map((o) => /* @__PURE__ */ a(
@@ -179,8 +179,8 @@ function M({
179
179
  className: "rb-block__content",
180
180
  rows: 8,
181
181
  placeholder: "content (markdown)",
182
- value: b.content,
183
- onChange: (o) => m({ ...b, content: o.target.value })
182
+ value: u.content,
183
+ onChange: (o) => h({ ...u, content: o.target.value })
184
184
  }
185
185
  ),
186
186
  /* @__PURE__ */ c("div", { className: "rb-block__actions", children: [
@@ -196,7 +196,7 @@ function M({
196
196
  children: N ? "Saving…" : i ? "Create" : "Save"
197
197
  }
198
198
  ),
199
- i ? /* @__PURE__ */ a("button", { type: "button", className: "rb-builder__btn", onClick: O, children: "Cancel" }) : /* @__PURE__ */ a(
199
+ i ? /* @__PURE__ */ a("button", { type: "button", className: "rb-builder__btn", onClick: j, children: "Cancel" }) : /* @__PURE__ */ a(
200
200
  "button",
201
201
  {
202
202
  type: "button",
@@ -240,32 +240,37 @@ function q(e) {
240
240
  ...i
241
241
  } : { userId: ce, userType: s, name: l, scope: "none", ...i };
242
242
  }
243
- async function G(e, s) {
243
+ var de = 3e3;
244
+ async function H(e, s) {
244
245
  const l = {};
245
246
  s && (l["X-User-Key"] = s);
247
+ const i = new AbortController(), b = setTimeout(() => i.abort(), de);
246
248
  try {
247
- const i = await fetch(e, {
249
+ const p = await fetch(e, {
248
250
  method: "GET",
249
251
  headers: l,
250
252
  credentials: "include",
251
- cache: "no-store"
253
+ cache: "no-store",
254
+ signal: i.signal
252
255
  });
253
- return i.ok ? await i.json() : null;
256
+ return p.ok ? await p.json() : null;
254
257
  } catch {
255
258
  return null;
259
+ } finally {
260
+ clearTimeout(b);
256
261
  }
257
262
  }
258
- function de() {
263
+ function be() {
259
264
  const e = globalThis.location;
260
265
  return e && (e.protocol === "http:" || e.protocol === "https:") ? "/session/whoami" : `${ie.replace(/\/prefs$/, "")}/session/whoami`;
261
266
  }
262
- async function be(e = {}) {
263
- const s = e.whoamiUrl ?? de();
267
+ async function ue(e = {}) {
268
+ const s = e.whoamiUrl ?? be();
264
269
  if (e.userKey)
265
- return q(await G(s, e.userKey));
270
+ return q(await H(s, e.userKey));
266
271
  const l = globalThis;
267
272
  let i = l[K];
268
- i || (i = G(s), l[K] = i);
273
+ i || (i = H(s), l[K] = i);
269
274
  try {
270
275
  return q(await i);
271
276
  } catch {
@@ -277,12 +282,12 @@ function P() {
277
282
  const e = encodeURIComponent(window.location.pathname + window.location.search);
278
283
  window.location.replace(`/auth?return=${e}`);
279
284
  }
280
- function ue() {
285
+ function pe() {
281
286
  const [e, s] = d("checking"), [l, i] = d(null);
282
- return W(() => {
283
- let u = !1;
284
- return be().then((p) => {
285
- if (!u) {
287
+ return M(() => {
288
+ let b = !1;
289
+ return ue().then((p) => {
290
+ if (!b) {
286
291
  if (p.userType === "admin") {
287
292
  i(p.name ?? null), s("authorized");
288
293
  return;
@@ -290,15 +295,15 @@ function ue() {
290
295
  E.info("[builder] not admin, redirecting to sign in", { userType: p.userType }), s("redirecting"), P();
291
296
  }
292
297
  }).catch((p) => {
293
- u || (E.error("[builder] whoami failed", {
298
+ b || (E.error("[builder] whoami failed", {
294
299
  error: p instanceof Error ? p.message : String(p)
295
300
  }), s("redirecting"), P());
296
301
  }), () => {
297
- u = !0;
302
+ b = !0;
298
303
  };
299
304
  }, []), { status: e, name: l };
300
305
  }
301
- const pe = [
306
+ const me = [
302
307
  "experience",
303
308
  "project",
304
309
  "skills",
@@ -312,21 +317,21 @@ function U(e) {
312
317
  function he() {
313
318
  return { id: "", type: "experience", tags: [], title: "", content: "", priority: 5 };
314
319
  }
315
- function me() {
316
- const { status: e, name: s } = ue(), [l, i] = d([]), [u, p] = d({}), [O, R] = d(!0), [I, b] = d(null), [m, y] = d(""), [_, N] = d(""), [g, B] = d(/* @__PURE__ */ new Set()), [f, A] = d(!0), [v, F] = d("order"), [k, x] = d(null);
317
- W(() => {
320
+ function ge() {
321
+ const { status: e, name: s } = pe(), [l, i] = d([]), [b, p] = d({}), [j, R] = d(!0), [I, u] = d(null), [h, y] = d(""), [_, N] = d(""), [g, B] = d(/* @__PURE__ */ new Set()), [f, A] = d(!0), [v, F] = d("order"), [k, x] = d(null);
322
+ M(() => {
318
323
  if (e !== "authorized") return;
319
324
  let r = !1;
320
325
  return ae().then((t) => {
321
326
  r || (i(t.blocks), p(t.feedback));
322
327
  }).catch((t) => {
323
328
  if (r) return;
324
- if (t instanceof H && (t.status === 401 || t.status === 403)) {
329
+ if (t instanceof G && (t.status === 401 || t.status === 403)) {
325
330
  P();
326
331
  return;
327
332
  }
328
333
  const n = t instanceof Error ? t.message : "Failed to load blocks";
329
- b(n), E.error("[builder] load failed", { error: n });
334
+ u(n), E.error("[builder] load failed", { error: n });
330
335
  }).finally(() => {
331
336
  r || R(!1);
332
337
  }), () => {
@@ -343,17 +348,17 @@ function me() {
343
348
  ),
344
349
  [w]
345
350
  ), T = D(() => {
346
- const r = m.trim().toLowerCase();
351
+ const r = h.trim().toLowerCase();
347
352
  let t = l.filter((n) => {
348
353
  if (_ && n.type !== _ || r && !(n.id + n.title + n.content).toLowerCase().includes(r)) return !1;
349
354
  if (g.size) {
350
- const h = [...g].filter((z) => n.tags.includes(z)).length;
351
- if (f ? h !== g.size : h === 0) return !1;
355
+ const m = [...g].filter((z) => n.tags.includes(z)).length;
356
+ if (f ? m !== g.size : m === 0) return !1;
352
357
  }
353
358
  return !0;
354
359
  });
355
- return v === "priority" ? t = [...t].sort((n, h) => h.priority - n.priority) : v === "type" ? t = [...t].sort((n, h) => n.type.localeCompare(h.type)) : v === "feedback" && (t = [...t].sort((n, h) => (u[h.id] ? 1 : 0) - (u[n.id] ? 1 : 0))), t;
356
- }, [l, m, _, g, f, v, u]);
360
+ return v === "priority" ? t = [...t].sort((n, m) => m.priority - n.priority) : v === "type" ? t = [...t].sort((n, m) => n.type.localeCompare(m.type)) : v === "feedback" && (t = [...t].sort((n, m) => (b[m.id] ? 1 : 0) - (b[n.id] ? 1 : 0))), t;
361
+ }, [l, h, _, g, f, v, b]);
357
362
  function S(r) {
358
363
  B((t) => {
359
364
  const n = new Set(t);
@@ -362,11 +367,11 @@ function me() {
362
367
  }
363
368
  async function $(r, t) {
364
369
  const { block: n } = await oe(r);
365
- i((h) => {
366
- const z = h.findIndex((V) => V.id === n.id);
367
- if (z === -1) return [...h, n];
368
- const J = [...h];
369
- return J[z] = n, J;
370
+ i((m) => {
371
+ const z = m.findIndex((V) => V.id === n.id);
372
+ if (z === -1) return [...m, n];
373
+ const W = [...m];
374
+ return W[z] = n, W;
370
375
  }), t && x(null);
371
376
  }
372
377
  async function L(r) {
@@ -380,7 +385,7 @@ function me() {
380
385
  const r = new Blob([JSON.stringify(l, null, 2)], { type: "application/json" }), t = URL.createObjectURL(r), n = document.createElement("a");
381
386
  n.href = t, n.download = "blocks.json", n.click(), URL.revokeObjectURL(t);
382
387
  }
383
- return e === "checking" ? /* @__PURE__ */ a("p", { className: "rb-builder__status", children: "Checking access…" }) : e === "redirecting" ? /* @__PURE__ */ a("p", { className: "rb-builder__status", children: "Redirecting to sign in…" }) : O ? /* @__PURE__ */ a("p", { className: "rb-builder__status", children: "Loading blocks…" }) : I ? /* @__PURE__ */ a("p", { className: "rb-builder__status rb-builder__status--error", children: I }) : /* @__PURE__ */ c("div", { className: "rb-builder", children: [
388
+ return e === "checking" ? /* @__PURE__ */ a("p", { className: "rb-builder__status", children: "Checking access…" }) : e === "redirecting" ? /* @__PURE__ */ a("p", { className: "rb-builder__status", children: "Redirecting to sign in…" }) : j ? /* @__PURE__ */ a("p", { className: "rb-builder__status", children: "Loading blocks…" }) : I ? /* @__PURE__ */ a("p", { className: "rb-builder__status rb-builder__status--error", children: I }) : /* @__PURE__ */ c("div", { className: "rb-builder", children: [
384
389
  /* @__PURE__ */ c("div", { className: "rb-builder__toolbar", children: [
385
390
  /* @__PURE__ */ c("header", { className: "rb-builder__header", children: [
386
391
  /* @__PURE__ */ a("h1", { children: "Resume Builder" }),
@@ -414,7 +419,7 @@ function me() {
414
419
  {
415
420
  type: "search",
416
421
  placeholder: "Search id, title, content…",
417
- value: m,
422
+ value: h,
418
423
  onChange: (r) => y(r.target.value),
419
424
  className: "rb-builder__search"
420
425
  }
@@ -427,7 +432,7 @@ function me() {
427
432
  className: "rb-builder__select",
428
433
  children: [
429
434
  /* @__PURE__ */ a("option", { value: "", children: "all types" }),
430
- pe.map((r) => /* @__PURE__ */ a("option", { value: r, children: r }, r))
435
+ me.map((r) => /* @__PURE__ */ a("option", { value: r, children: r }, r))
431
436
  ]
432
437
  }
433
438
  ),
@@ -488,7 +493,7 @@ function me() {
488
493
  ] }),
489
494
  /* @__PURE__ */ c("div", { className: "rb-builder__list", children: [
490
495
  k && /* @__PURE__ */ a(
491
- M,
496
+ J,
492
497
  {
493
498
  block: k,
494
499
  feedback: void 0,
@@ -502,10 +507,10 @@ function me() {
502
507
  "__new__"
503
508
  ),
504
509
  T.map((r) => /* @__PURE__ */ a(
505
- M,
510
+ J,
506
511
  {
507
512
  block: r,
508
- feedback: u[r.id],
513
+ feedback: b[r.id],
509
514
  existingIds: l.map((t) => t.id),
510
515
  onSave: (t) => $(t, !1),
511
516
  onDelete: () => L(r.id),
@@ -517,22 +522,22 @@ function me() {
517
522
  ] })
518
523
  ] });
519
524
  }
520
- const ge = "#resume-builder-root{height:100vh;overflow-y:auto}.rb-builder{box-sizing:border-box;max-width:1000px;margin:0 auto;padding:0 var(--hdk-space-lg) var(--hdk-space-3xl);color:var(--color-text);font-size:var(--hdk-text-sm)}.rb-builder *,.rb-builder *:before,.rb-builder *:after{box-sizing:border-box}.rb-builder__status{padding:var(--hdk-space-lg);color:var(--color-text-secondary)}.rb-builder__status--error{border-left:3px solid var(--color-danger);padding-left:.5rem;color:var(--color-text)}.rb-builder__toolbar{position:sticky;top:0;z-index:5;background:var(--color-bg);padding-top:var(--hdk-space-lg);margin-bottom:var(--hdk-space-lg);border-bottom:1px solid var(--color-border)}.rb-builder__header{display:flex;align-items:center;gap:var(--hdk-space-md);flex-wrap:wrap;margin-bottom:var(--hdk-space-md)}.rb-builder__header h1{font-size:var(--hdk-text-lg);margin:0;line-height:1.2}.rb-builder__count{color:var(--color-text-secondary);font-variant-numeric:tabular-nums}.rb-builder__whoami{margin-left:auto;color:var(--color-text-secondary);font-size:var(--hdk-text-xs);white-space:nowrap}.rb-builder__whoami-name{color:var(--color-text);font-weight:600}.rb-builder__header-actions{margin-left:auto;display:flex;gap:var(--hdk-space-sm)}.rb-builder__whoami+.rb-builder__header-actions{margin-left:var(--hdk-space-md)}.rb-builder__controls{display:flex;gap:var(--hdk-space-sm);flex-wrap:wrap;align-items:center;margin-bottom:var(--hdk-space-sm)}.rb-builder__search{flex:1 1 220px;min-width:200px}.rb-builder__andmode{display:flex;align-items:center;gap:.4rem;color:var(--color-text-secondary);white-space:nowrap;cursor:pointer;user-select:none}.rb-builder__andmode input{accent-color:var(--color-primary)}.rb-builder__legend{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hdk-space-md);padding:var(--hdk-space-sm) 0;color:var(--color-text-secondary);font-size:var(--hdk-text-xs)}.rb-builder__legend-item{display:inline-flex;align-items:center;gap:.4rem;white-space:nowrap}.rb-builder__legend-dot{width:.7rem;height:.7rem;border-radius:999px;border:1px solid var(--color-neutral);background:var(--color-neutral);flex:none}.rb-builder__legend-dot--tech{border-color:var(--color-success);background:var(--color-success)}.rb-builder__legend-dot--layer{border-color:var(--color-primary);background:var(--color-primary)}.rb-builder__legend-dot--story{border-color:var(--color-warning);background:var(--color-warning)}.rb-builder__search,.rb-builder__select,.rb-block__id-input,.rb-block__title,.rb-block__tags-input,.rb-block__type,.rb-block__prio input,.rb-block__content,.rb-block__feedback textarea{background:var(--color-bg);color:var(--color-text);border:1px solid var(--color-border);border-radius:var(--hdk-radius-sm);padding:.45rem .6rem;font-family:inherit;font-size:var(--hdk-text-sm);line-height:1.4}.rb-builder__search:focus,.rb-builder__select:focus,.rb-block__id-input:focus,.rb-block__title:focus,.rb-block__tags-input:focus,.rb-block__type:focus,.rb-block__prio input:focus,.rb-block__content:focus,.rb-block__feedback textarea:focus{outline:none;border-color:var(--color-primary);box-shadow:var(--hdk-shadow-focus)}.rb-builder__tagbar{display:flex;flex-wrap:wrap;gap:.4rem;max-height:116px;overflow-y:auto;padding:var(--hdk-space-sm) 0 var(--hdk-space-md)}.rb-tag{display:inline-flex;align-items:center;gap:.35rem;padding:.15rem .55rem;border-radius:999px;border:1px solid var(--color-neutral);background:var(--color-neutral-bg);color:var(--color-on-neutral-bg);font-size:var(--hdk-text-xs);line-height:1.5;cursor:pointer;font-family:ui-monospace,monospace;transition:background .12s ease,color .12s ease}.rb-tag:hover{background:color-mix(in srgb,currentcolor 15%,transparent)}.rb-tag--tech{border-color:var(--color-success);background:var(--color-success-bg);color:var(--color-on-success-bg)}.rb-tag--layer{border-color:var(--color-primary);background:var(--color-primary-bg);color:var(--color-on-primary-bg)}.rb-tag--story{border-color:var(--color-warning);background:var(--color-warning-bg);color:var(--color-on-warning-bg)}.rb-tag--active{background:var(--color-neutral);color:var(--color-on-neutral)}.rb-tag--tech.rb-tag--active{background:var(--color-success);color:var(--color-on-success)}.rb-tag--layer.rb-tag--active{background:var(--color-primary);color:var(--color-on-primary)}.rb-tag--story.rb-tag--active{background:var(--color-warning);color:var(--color-on-warning)}.rb-tag--active .rb-tag__n{color:inherit}.rb-tag__n{opacity:.75;font-size:.9em;font-variant-numeric:tabular-nums}.rb-builder__list{display:flex;flex-direction:column;gap:var(--hdk-space-md)}.rb-block{border:1px solid var(--color-border);border-left:3px solid transparent;border-radius:var(--hdk-radius-sm);padding:var(--hdk-space-md);display:flex;flex-direction:column;gap:var(--hdk-space-sm);background:var(--color-bg-card);box-shadow:var(--hdk-shadow-sm)}.rb-block--has-feedback{border-left-color:var(--color-success)}.rb-block--dirty{border-left-color:var(--color-warning)}.rb-block__row{display:flex;align-items:center;gap:var(--hdk-space-sm)}.rb-block__id{font-family:ui-monospace,monospace;color:var(--color-text);font-weight:600;word-break:break-all}.rb-block__id-input{flex:1;font-family:ui-monospace,monospace}.rb-block__type{flex:none}.rb-block__prio{display:flex;align-items:center;gap:.4rem;margin-left:auto;color:var(--color-text-secondary);white-space:nowrap}.rb-block__prio input{width:3.5rem;text-align:center}.rb-block__title{width:100%}.rb-block__content{width:100%;resize:vertical;min-height:8rem;font-family:ui-monospace,monospace;line-height:1.5}.rb-block__chips{display:flex;flex-wrap:wrap;gap:.35rem}.rb-block__chips:empty{display:none}.rb-block__tags-input{width:100%;font-family:ui-monospace,monospace}.rb-block__actions{display:flex;align-items:center;flex-wrap:wrap;gap:var(--hdk-space-sm);margin-top:.15rem}.rb-block__hint{color:var(--color-text-secondary);font-size:var(--hdk-text-xs)}.rb-block__hint--error{border-left:3px solid var(--color-danger);padding-left:.5rem;color:var(--color-text)}.rb-block__feedback{display:flex;align-items:flex-start;gap:var(--hdk-space-sm);padding-top:var(--hdk-space-sm);margin-top:var(--hdk-space-xs);border-top:1px dashed var(--color-border)}.rb-block__feedback textarea{flex:1;resize:vertical}.rb-block__fb-status{color:var(--color-text-secondary);font-size:var(--hdk-text-xs);white-space:nowrap;padding-top:.5rem}.rb-builder__btn{display:inline-flex;align-items:center;justify-content:center;gap:.4rem;padding:.45rem .9rem;border-radius:var(--hdk-radius-sm);border:1px solid var(--color-border);background:var(--color-bg-card);color:var(--color-text);cursor:pointer;font-family:inherit;font-size:var(--hdk-text-sm);font-weight:500;line-height:1.4;white-space:nowrap;transition:background .12s ease,border-color .12s ease,opacity .12s ease}.rb-builder__btn:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-text-secondary)}.rb-builder__btn:focus-visible{outline:none;box-shadow:var(--hdk-shadow-focus)}.rb-builder__btn:disabled{opacity:.45;cursor:not-allowed}.rb-builder__btn--primary{background:var(--color-primary);border-color:var(--color-primary);color:var(--color-on-primary)}.rb-builder__btn--primary:hover:not(:disabled){background:var(--color-primary-dark);border-color:var(--color-primary-dark)}.rb-builder__btn--danger{color:var(--color-text);border-color:var(--color-danger);background:transparent}.rb-builder__btn--danger:hover:not(:disabled){background:var(--color-danger);border-color:var(--color-danger);color:var(--color-on-danger)}";
521
- function _e() {
525
+ const _e = "#resume-builder-root{height:100vh;overflow-y:auto}.rb-builder{box-sizing:border-box;max-width:1000px;margin:0 auto;padding:0 var(--hdk-space-lg) var(--hdk-space-3xl);color:var(--color-text);font-size:var(--hdk-text-sm)}.rb-builder *,.rb-builder *:before,.rb-builder *:after{box-sizing:border-box}.rb-builder__status{padding:var(--hdk-space-lg);color:var(--color-text-secondary)}.rb-builder__status--error{border-left:3px solid var(--color-danger);padding-left:.5rem;color:var(--color-text)}.rb-builder__toolbar{position:sticky;top:0;z-index:5;background:var(--color-bg);padding-top:var(--hdk-space-lg);margin-bottom:var(--hdk-space-lg);border-bottom:1px solid var(--color-border)}.rb-builder__header{display:flex;align-items:center;gap:var(--hdk-space-md);flex-wrap:wrap;margin-bottom:var(--hdk-space-md)}.rb-builder__header h1{font-size:var(--hdk-text-lg);margin:0;line-height:1.2}.rb-builder__count{color:var(--color-text-secondary);font-variant-numeric:tabular-nums}.rb-builder__whoami{margin-left:auto;color:var(--color-text-secondary);font-size:var(--hdk-text-xs);white-space:nowrap}.rb-builder__whoami-name{color:var(--color-text);font-weight:600}.rb-builder__header-actions{margin-left:auto;display:flex;gap:var(--hdk-space-sm)}.rb-builder__whoami+.rb-builder__header-actions{margin-left:var(--hdk-space-md)}.rb-builder__controls{display:flex;gap:var(--hdk-space-sm);flex-wrap:wrap;align-items:center;margin-bottom:var(--hdk-space-sm)}.rb-builder__search{flex:1 1 220px;min-width:200px}.rb-builder__andmode{display:flex;align-items:center;gap:.4rem;color:var(--color-text-secondary);white-space:nowrap;cursor:pointer;user-select:none}.rb-builder__andmode input{accent-color:var(--color-primary)}.rb-builder__legend{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hdk-space-md);padding:var(--hdk-space-sm) 0;color:var(--color-text-secondary);font-size:var(--hdk-text-xs)}.rb-builder__legend-item{display:inline-flex;align-items:center;gap:.4rem;white-space:nowrap}.rb-builder__legend-dot{width:.7rem;height:.7rem;border-radius:999px;border:1px solid var(--color-neutral);background:var(--color-neutral);flex:none}.rb-builder__legend-dot--tech{border-color:var(--color-success);background:var(--color-success)}.rb-builder__legend-dot--layer{border-color:var(--color-primary);background:var(--color-primary)}.rb-builder__legend-dot--story{border-color:var(--color-warning);background:var(--color-warning)}.rb-builder__search,.rb-builder__select,.rb-block__id-input,.rb-block__title,.rb-block__tags-input,.rb-block__type,.rb-block__prio input,.rb-block__content,.rb-block__feedback textarea{background:var(--color-bg);color:var(--color-text);border:1px solid var(--color-border);border-radius:var(--hdk-radius-sm);padding:.45rem .6rem;font-family:inherit;font-size:var(--hdk-text-sm);line-height:1.4}.rb-builder__search:focus,.rb-builder__select:focus,.rb-block__id-input:focus,.rb-block__title:focus,.rb-block__tags-input:focus,.rb-block__type:focus,.rb-block__prio input:focus,.rb-block__content:focus,.rb-block__feedback textarea:focus{outline:none;border-color:var(--color-primary);box-shadow:var(--hdk-shadow-focus)}.rb-builder__tagbar{display:flex;flex-wrap:wrap;gap:.4rem;max-height:116px;overflow-y:auto;padding:var(--hdk-space-sm) 0 var(--hdk-space-md)}.rb-tag{display:inline-flex;align-items:center;gap:.35rem;padding:.15rem .55rem;border-radius:999px;border:1px solid var(--color-neutral);background:var(--color-neutral-bg);color:var(--color-on-neutral-bg);font-size:var(--hdk-text-xs);line-height:1.5;cursor:pointer;font-family:ui-monospace,monospace;transition:background .12s ease,color .12s ease}.rb-tag:hover{background:color-mix(in srgb,currentcolor 15%,transparent)}.rb-tag--tech{border-color:var(--color-success);background:var(--color-success-bg);color:var(--color-on-success-bg)}.rb-tag--layer{border-color:var(--color-primary);background:var(--color-primary-bg);color:var(--color-on-primary-bg)}.rb-tag--story{border-color:var(--color-warning);background:var(--color-warning-bg);color:var(--color-on-warning-bg)}.rb-tag--active{background:var(--color-neutral);color:var(--color-on-neutral)}.rb-tag--tech.rb-tag--active{background:var(--color-success);color:var(--color-on-success)}.rb-tag--layer.rb-tag--active{background:var(--color-primary);color:var(--color-on-primary)}.rb-tag--story.rb-tag--active{background:var(--color-warning);color:var(--color-on-warning)}.rb-tag--active .rb-tag__n{color:inherit}.rb-tag__n{opacity:.75;font-size:.9em;font-variant-numeric:tabular-nums}.rb-builder__list{display:flex;flex-direction:column;gap:var(--hdk-space-md)}.rb-block{border:1px solid var(--color-border);border-left:3px solid transparent;border-radius:var(--hdk-radius-sm);padding:var(--hdk-space-md);display:flex;flex-direction:column;gap:var(--hdk-space-sm);background:var(--color-bg-card);box-shadow:var(--hdk-shadow-sm)}.rb-block--has-feedback{border-left-color:var(--color-success)}.rb-block--dirty{border-left-color:var(--color-warning)}.rb-block__row{display:flex;align-items:center;gap:var(--hdk-space-sm)}.rb-block__id{font-family:ui-monospace,monospace;color:var(--color-text);font-weight:600;word-break:break-all}.rb-block__id-input{flex:1;font-family:ui-monospace,monospace}.rb-block__type{flex:none}.rb-block__prio{display:flex;align-items:center;gap:.4rem;margin-left:auto;color:var(--color-text-secondary);white-space:nowrap}.rb-block__prio input{width:3.5rem;text-align:center}.rb-block__title{width:100%}.rb-block__content{width:100%;resize:vertical;min-height:8rem;font-family:ui-monospace,monospace;line-height:1.5}.rb-block__chips{display:flex;flex-wrap:wrap;gap:.35rem}.rb-block__chips:empty{display:none}.rb-block__tags-input{width:100%;font-family:ui-monospace,monospace}.rb-block__actions{display:flex;align-items:center;flex-wrap:wrap;gap:var(--hdk-space-sm);margin-top:.15rem}.rb-block__hint{color:var(--color-text-secondary);font-size:var(--hdk-text-xs)}.rb-block__hint--error{border-left:3px solid var(--color-danger);padding-left:.5rem;color:var(--color-text)}.rb-block__feedback{display:flex;align-items:flex-start;gap:var(--hdk-space-sm);padding-top:var(--hdk-space-sm);margin-top:var(--hdk-space-xs);border-top:1px dashed var(--color-border)}.rb-block__feedback textarea{flex:1;resize:vertical}.rb-block__fb-status{color:var(--color-text-secondary);font-size:var(--hdk-text-xs);white-space:nowrap;padding-top:.5rem}.rb-builder__btn{display:inline-flex;align-items:center;justify-content:center;gap:.4rem;padding:.45rem .9rem;border-radius:var(--hdk-radius-sm);border:1px solid var(--color-border);background:var(--color-bg-card);color:var(--color-text);cursor:pointer;font-family:inherit;font-size:var(--hdk-text-sm);font-weight:500;line-height:1.4;white-space:nowrap;transition:background .12s ease,border-color .12s ease,opacity .12s ease}.rb-builder__btn:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-text-secondary)}.rb-builder__btn:focus-visible{outline:none;box-shadow:var(--hdk-shadow-focus)}.rb-builder__btn:disabled{opacity:.45;cursor:not-allowed}.rb-builder__btn--primary{background:var(--color-primary);border-color:var(--color-primary);color:var(--color-on-primary)}.rb-builder__btn--primary:hover:not(:disabled){background:var(--color-primary-dark);border-color:var(--color-primary-dark)}.rb-builder__btn--danger{color:var(--color-text);border-color:var(--color-danger);background:transparent}.rb-builder__btn--danger:hover:not(:disabled){background:var(--color-danger);border-color:var(--color-danger);color:var(--color-on-danger)}";
526
+ function fe() {
522
527
  if (document.getElementById("rb-builder-styles")) return;
523
528
  const e = document.createElement("style");
524
- e.id = "rb-builder-styles", e.textContent = ge, document.head.appendChild(e);
529
+ e.id = "rb-builder-styles", e.textContent = _e, document.head.appendChild(e);
525
530
  }
526
- function xe(e, s) {
527
- _e(), re(s.apiBaseUrl);
531
+ function we(e, s) {
532
+ fe(), re(s.apiBaseUrl);
528
533
  const l = Z(e);
529
- l.render(/* @__PURE__ */ a(me, {})), e.__root = l, E.info("[resume-builder] Mounted", { apiBaseUrl: s.apiBaseUrl });
534
+ l.render(/* @__PURE__ */ a(ge, {})), e.__root = l, E.info("[resume-builder] Mounted", { apiBaseUrl: s.apiBaseUrl });
530
535
  }
531
- function we(e) {
536
+ function Ne(e) {
532
537
  e.__root?.unmount(), E.info("[resume-builder] Unmounted");
533
538
  }
534
539
  export {
535
- xe as mount,
536
- we as unmount
540
+ we as mount,
541
+ Ne as unmount
537
542
  };
538
543
  //# sourceMappingURL=builder.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"builder.js","sources":["../src/builder/api.ts","../src/builder/BlockCard.tsx","../node_modules/.pnpm/@wolffm+prefs-client@1.1.23_react@19.2.0_zod@4.1.12/node_modules/@wolffm/prefs-client/dist/index.js","../src/builder/useBuilderAuth.ts","../src/builder/BuilderApp.tsx","../src/builder/entry.tsx"],"sourcesContent":["// Admin builder API client. All calls go through the edge-router (same-origin,\n// credentials:'include') so the caller's admin session cookie is resolved into\n// the X-Hadoku-Tier: admin stamp the worker's requireMinTier('admin') needs.\n\nexport type BlockType = 'experience' | 'project' | 'skills' | 'education' | 'summary' | 'header'\n\nexport interface ResumeBlock {\n id: string\n type: BlockType\n tags: string[]\n title: string\n content: string\n priority: number\n}\n\nexport interface FeedbackEntry {\n text: string\n updated: string\n}\nexport type Feedback = Record<string, FeedbackEntry>\n\nexport class BuilderApiError extends Error {\n constructor(\n message: string,\n readonly status: number\n ) {\n super(message)\n this.name = 'BuilderApiError'\n }\n}\n\n// The API root ('/resume/api'); builder endpoints are appended to it directly.\nlet baseUrl = ''\nexport function setBuilderApiBaseUrl(url: string): void {\n baseUrl = url.replace(/\\/+$/, '')\n}\n\nasync function req<T>(path: string, init?: RequestInit): Promise<T> {\n const res = await fetch(`${baseUrl}/builder${path}`, {\n ...init,\n credentials: 'include',\n headers: { 'Content-Type': 'application/json', ...(init?.headers ?? {}) }\n })\n if (!res.ok) {\n let detail = `${res.status}`\n try {\n const body = (await res.json()) as { error?: string; message?: string }\n detail = body.message ? `${body.error}: ${body.message}` : (body.error ?? detail)\n } catch {\n /* non-JSON error body */\n }\n throw new BuilderApiError(detail, res.status)\n }\n return (await res.json()) as T\n}\n\nexport function fetchBlocks(): Promise<{ blocks: ResumeBlock[]; feedback: Feedback }> {\n return req('/blocks')\n}\n\nexport function saveBlock(block: ResumeBlock): Promise<{ block: ResumeBlock }> {\n return req(`/blocks/${encodeURIComponent(block.id)}`, {\n method: 'PUT',\n body: JSON.stringify(block)\n })\n}\n\nexport function deleteBlock(id: string): Promise<{ deleted: true; id: string }> {\n return req(`/blocks/${encodeURIComponent(id)}`, { method: 'DELETE' })\n}\n\nexport function reorderBlocks(ids: string[]): Promise<{ ids: string[] }> {\n return req('/reorder', { method: 'PUT', body: JSON.stringify({ ids }) })\n}\n\nexport function saveFeedback(id: string, text: string): Promise<{ feedback: Feedback }> {\n return req(`/feedback/${encodeURIComponent(id)}`, {\n method: 'POST',\n body: JSON.stringify({ text })\n })\n}\n","import { useEffect, useRef, useState } from 'react'\nimport { facetOf } from './BuilderApp'\nimport type { BlockType, FeedbackEntry, ResumeBlock } from './api'\n\nconst BLOCK_TYPES: BlockType[] = [\n 'experience',\n 'project',\n 'skills',\n 'education',\n 'summary',\n 'header'\n]\n\ninterface Props {\n block: ResumeBlock\n feedback: FeedbackEntry | undefined\n existingIds: string[]\n isNew?: boolean\n onSave: (block: ResumeBlock) => Promise<void>\n onDelete?: () => Promise<void>\n onCancel?: () => void\n onFeedback: (id: string, text: string) => Promise<void>\n onTagClick: (tag: string) => void\n}\n\nexport function BlockCard({\n block,\n feedback,\n existingIds,\n isNew = false,\n onSave,\n onDelete,\n onCancel,\n onFeedback,\n onTagClick\n}: Props) {\n const [draft, setDraft] = useState<ResumeBlock>(block)\n const [tagsText, setTagsText] = useState(block.tags.join(' '))\n const [saving, setSaving] = useState(false)\n const [saveError, setSaveError] = useState<string | null>(null)\n const [fbText, setFbText] = useState(feedback?.text ?? '')\n const [fbStatus, setFbStatus] = useState('')\n const fbTimer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined)\n\n // Keep the draft in sync if the saved block changes underneath us (e.g. after\n // a successful save re-normalises it), but not while the user is mid-edit.\n useEffect(() => {\n if (!isNew) {\n setDraft(block)\n setTagsText(block.tags.join(' '))\n }\n }, [block, isNew])\n\n const dirty =\n isNew || JSON.stringify({ ...draft, tags: parseTags(tagsText) }) !== JSON.stringify(block)\n\n function parseTags(text: string): string[] {\n return [...new Set(text.split(/[\\s,]+/).filter(Boolean))]\n }\n\n const idInvalid =\n isNew && (!/^[a-z0-9][a-z0-9-]*$/.test(draft.id) || existingIds.includes(draft.id))\n\n async function handleSave() {\n setSaving(true)\n setSaveError(null)\n try {\n await onSave({ ...draft, tags: parseTags(tagsText) })\n } catch (err) {\n setSaveError(err instanceof Error ? err.message : 'Save failed')\n } finally {\n setSaving(false)\n }\n }\n\n async function handleDelete() {\n if (!onDelete) return\n if (!confirm(`Delete block \"${block.id}\"? This removes it from the live resume.`)) return\n setSaving(true)\n try {\n await onDelete()\n } catch (err) {\n setSaveError(err instanceof Error ? err.message : 'Delete failed')\n setSaving(false)\n }\n }\n\n function onFbChange(text: string) {\n setFbText(text)\n setFbStatus('typing…')\n clearTimeout(fbTimer.current)\n fbTimer.current = setTimeout(() => {\n onFeedback(block.id, text)\n .then(() => setFbStatus(text.trim() ? 'saved ✓' : ''))\n .catch(() => setFbStatus('save failed'))\n }, 600)\n }\n\n return (\n <div\n className={`rb-block${feedback ? ' rb-block--has-feedback' : ''}${dirty ? ' rb-block--dirty' : ''}`}\n >\n <div className=\"rb-block__row\">\n {isNew ? (\n <input\n className=\"rb-block__id-input\"\n placeholder=\"block-id (kebab-case)\"\n value={draft.id}\n onChange={e => setDraft({ ...draft, id: e.target.value })}\n />\n ) : (\n <span className=\"rb-block__id\">{draft.id}</span>\n )}\n <select\n className=\"rb-block__type\"\n value={draft.type}\n onChange={e => setDraft({ ...draft, type: e.target.value as BlockType })}\n >\n {BLOCK_TYPES.map(t => (\n <option key={t} value={t}>\n {t}\n </option>\n ))}\n </select>\n <label\n className=\"rb-block__prio\"\n title=\"Priority — how strongly you want this block in a tailored resume. Higher sorts first; a ranking hint, not a hard rule.\"\n >\n prio\n <input\n type=\"number\"\n min={0}\n max={10}\n value={draft.priority}\n onChange={e => setDraft({ ...draft, priority: Number(e.target.value) })}\n />\n </label>\n </div>\n\n <input\n className=\"rb-block__title\"\n placeholder=\"title (review label — not rendered into the resume)\"\n value={draft.title}\n onChange={e => setDraft({ ...draft, title: e.target.value })}\n />\n\n <div className=\"rb-block__chips\">\n {parseTags(tagsText).map(t => (\n <button\n type=\"button\"\n key={t}\n className={`rb-tag rb-tag--${facetOf(t)}`}\n onClick={() => onTagClick(t)}\n title=\"filter by this tag\"\n >\n {t}\n </button>\n ))}\n </div>\n <input\n className=\"rb-block__tags-input\"\n placeholder=\"tags (space or comma separated, e.g. tech:python story:scale)\"\n value={tagsText}\n onChange={e => setTagsText(e.target.value)}\n />\n\n <textarea\n className=\"rb-block__content\"\n rows={8}\n placeholder=\"content (markdown)\"\n value={draft.content}\n onChange={e => setDraft({ ...draft, content: e.target.value })}\n />\n\n <div className=\"rb-block__actions\">\n <button\n type=\"button\"\n className=\"rb-builder__btn rb-builder__btn--primary\"\n onClick={() => {\n void handleSave()\n }}\n disabled={saving || !dirty || idInvalid}\n >\n {saving ? 'Saving…' : isNew ? 'Create' : 'Save'}\n </button>\n {isNew ? (\n <button type=\"button\" className=\"rb-builder__btn\" onClick={onCancel}>\n Cancel\n </button>\n ) : (\n <button\n type=\"button\"\n className=\"rb-builder__btn rb-builder__btn--danger\"\n onClick={() => {\n void handleDelete()\n }}\n disabled={saving}\n >\n Delete\n </button>\n )}\n {idInvalid && <span className=\"rb-block__hint\">id must be unique kebab-case</span>}\n {saveError && <span className=\"rb-block__hint rb-block__hint--error\">{saveError}</span>}\n </div>\n\n {!isNew && (\n <div className=\"rb-block__feedback\">\n <textarea\n rows={2}\n placeholder=\"review note (autosaves)…\"\n value={fbText}\n onChange={e => onFbChange(e.target.value)}\n />\n <span className=\"rb-block__fb-status\">{fbStatus}</span>\n </div>\n )}\n </div>\n )\n}\n","// src/constants.ts\nvar PREFS_API_BASE = \"https://hadoku.me/prefs\";\nvar CACHE_KEY_PREFIX = \"prefs-cache\";\nvar SAVE_DEBOUNCE_MS = 1e3;\n\n// src/storage.ts\nvar localStorageAdapter = {\n get(key) {\n if (typeof window === \"undefined\") return Promise.resolve(null);\n try {\n return Promise.resolve(window.localStorage.getItem(key));\n } catch {\n return Promise.resolve(null);\n }\n },\n set(key, value) {\n if (typeof window === \"undefined\") return Promise.resolve();\n try {\n window.localStorage.setItem(key, value);\n } catch {\n }\n return Promise.resolve();\n },\n remove(key) {\n if (typeof window === \"undefined\") return Promise.resolve();\n try {\n window.localStorage.removeItem(key);\n } catch {\n }\n return Promise.resolve();\n }\n};\nvar memoryStorage = () => {\n const store = /* @__PURE__ */ new Map();\n return {\n get(key) {\n return Promise.resolve(store.get(key) ?? null);\n },\n set(key, value) {\n store.set(key, value);\n return Promise.resolve();\n },\n remove(key) {\n store.delete(key);\n return Promise.resolve();\n }\n };\n};\nvar sessionStorageWrite = (key, value) => {\n if (typeof window === \"undefined\") return;\n try {\n window.sessionStorage.setItem(key, value);\n } catch {\n }\n};\nfunction readCapacitorGlobal() {\n return globalThis.Capacitor;\n}\nfunction capacitorStorage() {\n const cap = readCapacitorGlobal();\n if (!cap?.isNativePlatform?.()) return null;\n const prefs = cap.Plugins?.Preferences;\n if (!prefs) return null;\n return {\n async get(key) {\n const { value } = await prefs.get({ key });\n return value ?? null;\n },\n async set(key, value) {\n await prefs.set({ key, value });\n },\n async remove(key) {\n await prefs.remove({ key });\n }\n };\n}\nfunction detectStorage() {\n return capacitorStorage() ?? localStorageAdapter;\n}\n\n// src/get-device-id.ts\nvar DEVICE_ID_KEY = \"hadoku_device_id\";\nasync function getDeviceId(storage = localStorageAdapter) {\n const existing = await storage.get(DEVICE_ID_KEY);\n if (existing && isUuid(existing)) {\n return existing;\n }\n const fresh = mintUuid();\n await storage.set(DEVICE_ID_KEY, fresh);\n return fresh;\n}\nfunction mintUuid() {\n const c = globalThis.crypto;\n if (c?.randomUUID) {\n return c.randomUUID();\n }\n return \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\".replace(/[xy]/g, (ch) => {\n const r = Math.random() * 16 | 0;\n const v = ch === \"x\" ? r : r & 3 | 8;\n return v.toString(16);\n });\n}\nvar UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\nfunction isUuid(s) {\n return UUID_RE.test(s);\n}\n\n// src/whoami.ts\nvar ANON_USER_ID = \"anon\";\nvar WHOAMI_GLOBAL = \"__hadokuWhoami\";\nvar SESSION_SCOPE_PREFIX = \"sess:\";\nvar UNSCOPED_ID = \"unscoped\";\nfunction adaptWhoami(body) {\n if (!body || body.valid === false) {\n return { userId: ANON_USER_ID, userType: \"public\", scope: \"anon\" };\n }\n const userType = body.userType === \"admin\" || body.userType === \"wife\" || body.userType === \"service\" || body.userType === \"friend\" || body.userType === \"member\" || body.userType === \"public\" ? body.userType : \"public\";\n const name = typeof body.name === \"string\" ? body.name : null;\n const verified = body.verified === true ? { verified: true } : {};\n if (typeof body.userId === \"string\" && body.userId) {\n return { userId: body.userId, userType, name, scope: \"user\", ...verified };\n }\n if (typeof body.sessionId === \"string\" && body.sessionId) {\n return {\n userId: `${SESSION_SCOPE_PREFIX}${body.sessionId}`,\n userType,\n name,\n scope: \"session\",\n ...verified\n };\n }\n return { userId: UNSCOPED_ID, userType, name, scope: \"none\", ...verified };\n}\nasync function fetchWhoamiRaw(url, userKey) {\n const headers = {};\n if (userKey) {\n headers[\"X-User-Key\"] = userKey;\n }\n try {\n const resp = await fetch(url, {\n method: \"GET\",\n headers,\n credentials: \"include\",\n cache: \"no-store\"\n });\n if (!resp.ok) return null;\n return await resp.json();\n } catch {\n return null;\n }\n}\nfunction defaultWhoamiUrl() {\n const loc = globalThis.location;\n if (loc && (loc.protocol === \"http:\" || loc.protocol === \"https:\")) return \"/session/whoami\";\n return `${PREFS_API_BASE.replace(/\\/prefs$/, \"\")}/session/whoami`;\n}\nasync function whoami(opts = {}) {\n const url = opts.whoamiUrl ?? defaultWhoamiUrl();\n if (opts.userKey) {\n return adaptWhoami(await fetchWhoamiRaw(url, opts.userKey));\n }\n const g = globalThis;\n let shared = g[WHOAMI_GLOBAL];\n if (!shared) {\n shared = fetchWhoamiRaw(url);\n g[WHOAMI_GLOBAL] = shared;\n }\n try {\n return adaptWhoami(await shared);\n } catch {\n return { userId: ANON_USER_ID, userType: \"public\", scope: \"anon\" };\n }\n}\n\n// src/client.ts\nfunction createPrefsClient(opts) {\n const apiBase = opts.apiBase ?? PREFS_API_BASE;\n const mirrorOnRead = opts.mirrorBootstrapOnRead ?? false;\n const storage = opts.storage ?? detectStorage();\n const listeners = /* @__PURE__ */ new Set();\n const migrations = opts.migrations ?? [];\n const defaults = opts.defaults ?? {};\n const bootstrapMap = opts.bootstrapToSessionStorage ?? {};\n let userId = null;\n let identityScope = \"anon\";\n let wroteWhileAnon = false;\n let deviceId = opts.deviceId ?? null;\n let currentBlob = null;\n let userVersion = 0;\n let deviceVersion = 0;\n let pendingPatch = {};\n let pendingScope = \"user\";\n const dirtyFields = /* @__PURE__ */ new Set();\n let saveTimer = null;\n let savePromise = null;\n let initPromise = null;\n let bcast = null;\n let destroyed = false;\n const broadcastId = `${Math.random().toString(36).slice(2)}-${Date.now()}`;\n function ensureInit() {\n if (initPromise) return initPromise;\n initPromise = (async () => {\n const who = await whoami({\n userKey: opts.userKey,\n // An EXPLICIT apiBase (a non-prod environment) names where identity lives\n // too. With none, leave it to whoami()'s default — same-origin in a\n // browser — rather than pinning the hadoku.me constant (#419).\n ...opts.apiBase ? { whoamiUrl: `${opts.apiBase.replace(/\\/prefs$/, \"\")}/session/whoami` } : {}\n });\n userId = who.userId;\n identityScope = who.scope;\n if (!deviceId) {\n deviceId = await getDeviceId(storage);\n }\n const cached = await readCache();\n if (cached) {\n userVersion = cached.userVersion;\n deviceVersion = cached.deviceVersion;\n currentBlob = applyDefaultsAndParse(cached.blob);\n if (mirrorOnRead) mirrorBootstrap(currentBlob);\n notify(currentBlob);\n }\n if (canPersist() && typeof BroadcastChannel !== \"undefined\") {\n bcast = new BroadcastChannel(`prefs:${userId}:${opts.appId}`);\n bcast.addEventListener(\"message\", onBroadcast);\n }\n })();\n return initPromise;\n }\n function buildHeaders() {\n const h = { \"Content-Type\": \"application/json\" };\n if (opts.userKey) h[\"X-User-Key\"] = opts.userKey;\n if (deviceId) h[\"X-Device-Id\"] = deviceId;\n return h;\n }\n async function fetchFromServer() {\n const resp = await fetch(`${apiBase}/api/v1/${opts.appId}`, {\n method: \"GET\",\n headers: buildHeaders(),\n credentials: \"include\"\n });\n if (!resp.ok) {\n throw new Error(`prefs-api GET failed: ${resp.status}`);\n }\n return await resp.json();\n }\n async function putToServer(scope, patch, expectedVersion) {\n const resp = await fetch(`${apiBase}/api/v1/${opts.appId}`, {\n method: \"PUT\",\n headers: buildHeaders(),\n credentials: \"include\",\n body: JSON.stringify({\n scope,\n patch,\n expectedVersion\n })\n });\n if (resp.status === 409) {\n const body2 = await resp.json();\n if (body2.current) {\n return { ok: false, conflict: body2.current };\n }\n throw new Error(\"prefs-api 409 without current-state body\");\n }\n if (!resp.ok) {\n throw new Error(`prefs-api PUT failed: ${resp.status}`);\n }\n const body = await resp.json();\n return { ok: true, row: body, scope: body.scope };\n }\n function cacheKey() {\n return `${CACHE_KEY_PREFIX}:${userId ?? ANON_USER_ID}:${opts.appId}`;\n }\n function canPersist() {\n return identityScope !== \"none\";\n }\n function canSync() {\n return identityScope === \"user\" || identityScope === \"session\";\n }\n async function readCache() {\n if (!canPersist()) return null;\n const raw = await storage.get(cacheKey());\n if (!raw) return null;\n try {\n const parsed = JSON.parse(raw);\n if (parsed && typeof parsed === \"object\" && parsed.blob && typeof parsed.blob === \"object\") {\n return parsed;\n }\n } catch {\n }\n return null;\n }\n async function writeCache(env) {\n if (!canPersist()) return;\n await storage.set(cacheKey(), JSON.stringify(env));\n }\n function applyDefaultsAndParse(rawBlob) {\n let withDefaults = { ...defaults, ...rawBlob };\n for (const m of migrations) {\n withDefaults = m(withDefaults);\n }\n const result = opts.schema.safeParse(withDefaults);\n if (result.success) {\n return result.data;\n }\n const fallback = opts.schema.safeParse({ ...defaults });\n return fallback.success ? fallback.data : withDefaults;\n }\n function mirrorBootstrap(blob) {\n for (const [field, sessionKey] of Object.entries(bootstrapMap)) {\n if (typeof sessionKey !== \"string\" || !sessionKey) continue;\n const value = blob[field];\n if (typeof value === \"string\") {\n sessionStorageWrite(sessionKey, value);\n }\n }\n }\n function notify(blob) {\n for (const l of listeners) {\n try {\n l(blob);\n } catch {\n }\n }\n }\n function broadcast(blob) {\n if (!bcast) return;\n try {\n bcast.postMessage({ source: broadcastId, blob });\n } catch {\n }\n }\n function onBroadcast(ev) {\n const data = ev.data;\n if (!data || data.source === broadcastId || !data.blob) return;\n const reconciled = reconcileDirty(data.blob);\n currentBlob = applyDefaultsAndParse(reconciled);\n if (mirrorOnRead) mirrorBootstrap(currentBlob);\n notify(currentBlob);\n }\n function reconcileDirty(remote) {\n if (dirtyFields.size === 0 || !currentBlob) return remote;\n const local = currentBlob;\n const reconciled = { ...remote };\n for (const field of dirtyFields) {\n if (field in local) reconciled[field] = local[field];\n }\n return reconciled;\n }\n async function refreshFromServer() {\n if (!canSync()) {\n if (currentBlob === null) {\n currentBlob = applyDefaultsAndParse({});\n if (mirrorOnRead) mirrorBootstrap(currentBlob);\n notify(currentBlob);\n }\n return;\n }\n const server = await fetchFromServer();\n userVersion = server.user?.version ?? 0;\n deviceVersion = server.device?.version ?? 0;\n const merged = reconcileDirty(server.merged ?? {});\n currentBlob = applyDefaultsAndParse(merged);\n await writeCache({\n blob: merged,\n userVersion,\n deviceVersion,\n cachedAt: Date.now()\n });\n if (mirrorOnRead) mirrorBootstrap(currentBlob);\n notify(currentBlob);\n broadcast(currentBlob);\n }\n function scheduleFlush() {\n if (saveTimer) clearTimeout(saveTimer);\n saveTimer = setTimeout(() => {\n void flushPending();\n }, SAVE_DEBOUNCE_MS);\n }\n async function flushPending() {\n if (Object.keys(pendingPatch).length === 0) return;\n if (savePromise) {\n await savePromise;\n }\n const patchSnapshot = pendingPatch;\n const scopeSnapshot = pendingScope;\n pendingPatch = {};\n if (saveTimer) {\n clearTimeout(saveTimer);\n saveTimer = null;\n }\n if (!canSync()) {\n for (const key of Object.keys(patchSnapshot)) {\n if (!(key in pendingPatch)) dirtyFields.delete(key);\n }\n return;\n }\n const expectedVersion = scopeSnapshot === \"user\" ? userVersion : deviceVersion;\n savePromise = (async () => {\n try {\n const result = await putToServer(scopeSnapshot, patchSnapshot, expectedVersion);\n if (result.ok) {\n if (result.scope === \"user\") {\n userVersion = result.row.version;\n } else {\n deviceVersion = result.row.version;\n }\n await refreshFromServer();\n } else {\n if (scopeSnapshot === \"user\") {\n userVersion = result.conflict.version;\n } else {\n deviceVersion = result.conflict.version;\n }\n await refreshFromServer();\n }\n for (const key of Object.keys(patchSnapshot)) {\n if (!(key in pendingPatch)) dirtyFields.delete(key);\n }\n } catch {\n pendingPatch = { ...patchSnapshot, ...pendingPatch };\n pendingScope = scopeSnapshot;\n } finally {\n savePromise = null;\n }\n })();\n await savePromise;\n }\n const client = {\n appId: opts.appId,\n async read() {\n await ensureInit();\n if (currentBlob === null) {\n try {\n await refreshFromServer();\n } catch {\n currentBlob = applyDefaultsAndParse({});\n }\n } else {\n void refreshFromServer().catch(() => {\n });\n }\n return currentBlob ?? applyDefaultsAndParse({});\n },\n async save(patch, saveOpts) {\n await ensureInit();\n const scope = saveOpts?.scope ?? \"user\";\n if (identityScope === \"anon\") wroteWhileAnon = true;\n const base = currentBlob ?? {};\n const nextBlob = applyDefaultsAndParse({ ...base, ...patch });\n currentBlob = nextBlob;\n await writeCache({\n blob: { ...base, ...patch },\n userVersion,\n deviceVersion,\n cachedAt: Date.now()\n });\n mirrorBootstrap(nextBlob);\n notify(nextBlob);\n broadcast(nextBlob);\n if (Object.keys(pendingPatch).length > 0 && pendingScope !== scope) {\n await flushPending();\n }\n pendingPatch = { ...pendingPatch, ...patch };\n pendingScope = scope;\n for (const key of Object.keys(patch)) dirtyFields.add(key);\n if (saveOpts?.expectedVersion !== void 0) {\n await flushPending();\n } else {\n scheduleFlush();\n }\n },\n subscribe(listener) {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n },\n async promoteAnonPrefsToUser() {\n if (!wroteWhileAnon) return;\n const anonKey = `${CACHE_KEY_PREFIX}:${ANON_USER_ID}:${opts.appId}`;\n const raw = await storage.get(anonKey);\n if (!raw) return;\n let anon;\n try {\n anon = JSON.parse(raw);\n } catch {\n return;\n }\n if (!anon.blob || Object.keys(anon.blob).length === 0) return;\n await ensureInit();\n const server = await fetchFromServer();\n if (server.user) {\n await refreshFromServer();\n await storage.remove(anonKey);\n return;\n }\n await putToServer(\"user\", anon.blob, 0);\n await refreshFromServer();\n await storage.remove(anonKey);\n },\n async flush() {\n await flushPending();\n },\n destroy() {\n if (destroyed) return;\n destroyed = true;\n if (saveTimer) clearTimeout(saveTimer);\n if (bcast) bcast.close();\n listeners.clear();\n }\n };\n return client;\n}\nexport {\n ANON_USER_ID,\n CACHE_KEY_PREFIX,\n DEVICE_ID_KEY,\n PREFS_API_BASE,\n SAVE_DEBOUNCE_MS,\n capacitorStorage,\n createPrefsClient,\n detectStorage,\n getDeviceId,\n localStorageAdapter,\n memoryStorage,\n sessionStorageWrite,\n whoami\n};\n","import { useEffect, useState } from 'react'\nimport { whoami } from '@wolffm/prefs-client'\nimport { logger } from '@wolffm/logger/client'\n\n// Ecosystem auth, matching the command station (hadoku_site ContactAdmin):\n// resolve the caller's tier via edge-router's /session/whoami, and on anything\n// short of admin bounce to the shared /auth sign-in page rather than showing a\n// custom \"enter a key\" dead-end. /auth accepts a valid key (POST /session/create)\n// and redirects back to `return`. No app-specific key handling lives here.\n\n/** Send the browser to the ecosystem sign-in page, returning here afterwards. */\nexport function redirectToAuth(): void {\n if (typeof window === 'undefined') return\n const ret = encodeURIComponent(window.location.pathname + window.location.search)\n window.location.replace(`/auth?return=${ret}`)\n}\n\nexport type AuthStatus = 'checking' | 'authorized' | 'redirecting'\n\nexport interface BuilderAuth {\n status: AuthStatus\n /** Display name from the key registry once authorized (null if unnamed). */\n name: string | null\n}\n\nexport function useBuilderAuth(): BuilderAuth {\n const [status, setStatus] = useState<AuthStatus>('checking')\n const [name, setName] = useState<string | null>(null)\n\n useEffect(() => {\n let cancelled = false\n whoami()\n .then(who => {\n if (cancelled) return\n if (who.userType === 'admin') {\n setName(who.name ?? null)\n setStatus('authorized')\n return\n }\n logger.info('[builder] not admin, redirecting to sign in', { userType: who.userType })\n setStatus('redirecting')\n redirectToAuth()\n })\n .catch((err: unknown) => {\n // whoami() itself never rejects (it degrades to public), but stay\n // defensive: any failure means \"not signed in\" → sign-in page.\n if (cancelled) return\n logger.error('[builder] whoami failed', {\n error: err instanceof Error ? err.message : String(err)\n })\n setStatus('redirecting')\n redirectToAuth()\n })\n return () => {\n cancelled = true\n }\n }, [])\n\n return { status, name }\n}\n","import { useEffect, useMemo, useState } from 'react'\nimport { logger } from '@wolffm/logger/client'\nimport {\n fetchBlocks,\n saveBlock,\n deleteBlock as apiDeleteBlock,\n saveFeedback,\n BuilderApiError,\n type ResumeBlock,\n type BlockType,\n type Feedback\n} from './api'\nimport { BlockCard } from './BlockCard'\nimport { useBuilderAuth, redirectToAuth } from './useBuilderAuth'\n\nconst BLOCK_TYPES: BlockType[] = [\n 'experience',\n 'project',\n 'skills',\n 'education',\n 'summary',\n 'header'\n]\n\nexport function facetOf(tag: string): 'tech' | 'layer' | 'story' | 'plain' {\n if (tag.startsWith('tech:')) return 'tech'\n if (tag.startsWith('layer:')) return 'layer'\n if (tag.startsWith('story:')) return 'story'\n return 'plain'\n}\n\ntype SortMode = 'order' | 'priority' | 'type' | 'feedback'\n\nfunction emptyBlock(): ResumeBlock {\n return { id: '', type: 'experience', tags: [], title: '', content: '', priority: 5 }\n}\n\nexport function BuilderApp() {\n const { status: authStatus, name: adminName } = useBuilderAuth()\n const [blocks, setBlocks] = useState<ResumeBlock[]>([])\n const [feedback, setFeedback] = useState<Feedback>({})\n const [loading, setLoading] = useState(true)\n const [error, setError] = useState<string | null>(null)\n\n // Filters\n const [search, setSearch] = useState('')\n const [typeFilter, setTypeFilter] = useState<'' | BlockType>('')\n const [activeTags, setActiveTags] = useState<Set<string>>(new Set())\n const [andMode, setAndMode] = useState(true)\n const [sort, setSort] = useState<SortMode>('order')\n\n const [creating, setCreating] = useState<ResumeBlock | null>(null)\n\n useEffect(() => {\n if (authStatus !== 'authorized') return\n let cancelled = false\n fetchBlocks()\n .then(res => {\n if (cancelled) return\n setBlocks(res.blocks)\n setFeedback(res.feedback)\n })\n .catch((err: unknown) => {\n if (cancelled) return\n // Session lapsed between the whoami check and this call → bounce to\n // sign-in, same as the initial gate. Everything else is a real error.\n if (err instanceof BuilderApiError && (err.status === 401 || err.status === 403)) {\n redirectToAuth()\n return\n }\n const msg = err instanceof Error ? err.message : 'Failed to load blocks'\n setError(msg)\n logger.error('[builder] load failed', { error: msg })\n })\n .finally(() => {\n if (!cancelled) setLoading(false)\n })\n return () => {\n cancelled = true\n }\n }, [authStatus])\n\n const tagCounts = useMemo(() => {\n const counts = new Map<string, number>()\n for (const b of blocks) for (const t of b.tags) counts.set(t, (counts.get(t) ?? 0) + 1)\n return counts\n }, [blocks])\n\n const sortedTags = useMemo(\n () =>\n [...tagCounts.keys()].sort(\n (a, b) => facetOf(a).localeCompare(facetOf(b)) || a.localeCompare(b)\n ),\n [tagCounts]\n )\n\n const visible = useMemo(() => {\n const q = search.trim().toLowerCase()\n let v = blocks.filter(b => {\n if (typeFilter && b.type !== typeFilter) return false\n if (q && !(b.id + b.title + b.content).toLowerCase().includes(q)) return false\n if (activeTags.size) {\n const hits = [...activeTags].filter(t => b.tags.includes(t)).length\n if (andMode ? hits !== activeTags.size : hits === 0) return false\n }\n return true\n })\n if (sort === 'priority') v = [...v].sort((a, b) => b.priority - a.priority)\n else if (sort === 'type') v = [...v].sort((a, b) => a.type.localeCompare(b.type))\n else if (sort === 'feedback')\n v = [...v].sort((a, b) => (feedback[b.id] ? 1 : 0) - (feedback[a.id] ? 1 : 0))\n return v\n }, [blocks, search, typeFilter, activeTags, andMode, sort, feedback])\n\n function toggleTag(tag: string) {\n setActiveTags(prev => {\n const next = new Set(prev)\n if (next.has(tag)) next.delete(tag)\n else next.add(tag)\n return next\n })\n }\n\n async function handleSave(block: ResumeBlock, isNew: boolean): Promise<void> {\n const { block: saved } = await saveBlock(block)\n setBlocks(prev => {\n const idx = prev.findIndex(b => b.id === saved.id)\n if (idx === -1) return [...prev, saved]\n const copy = [...prev]\n copy[idx] = saved\n return copy\n })\n if (isNew) setCreating(null)\n }\n\n async function handleDelete(id: string): Promise<void> {\n await apiDeleteBlock(id)\n setBlocks(prev => prev.filter(b => b.id !== id))\n }\n\n async function handleFeedback(id: string, text: string): Promise<void> {\n const res = await saveFeedback(id, text)\n setFeedback(res.feedback)\n }\n\n function exportJson() {\n const blob = new Blob([JSON.stringify(blocks, null, 2)], { type: 'application/json' })\n const url = URL.createObjectURL(blob)\n const a = document.createElement('a')\n a.href = url\n a.download = 'blocks.json'\n a.click()\n URL.revokeObjectURL(url)\n }\n\n if (authStatus === 'checking') return <p className=\"rb-builder__status\">Checking access…</p>\n if (authStatus === 'redirecting')\n return <p className=\"rb-builder__status\">Redirecting to sign in…</p>\n if (loading) return <p className=\"rb-builder__status\">Loading blocks…</p>\n if (error) return <p className=\"rb-builder__status rb-builder__status--error\">{error}</p>\n\n return (\n <div className=\"rb-builder\">\n <div className=\"rb-builder__toolbar\">\n <header className=\"rb-builder__header\">\n <h1>Resume Builder</h1>\n <div className=\"rb-builder__count\">\n {visible.length} / {blocks.length} blocks\n </div>\n {adminName && (\n <div className=\"rb-builder__whoami\">\n Signed in as <span className=\"rb-builder__whoami-name\">{adminName}</span>\n </div>\n )}\n <div className=\"rb-builder__header-actions\">\n <button type=\"button\" onClick={exportJson} className=\"rb-builder__btn\">\n Export blocks.json\n </button>\n <button\n type=\"button\"\n onClick={() => setCreating(emptyBlock())}\n className=\"rb-builder__btn rb-builder__btn--primary\"\n disabled={creating !== null}\n >\n + New block\n </button>\n </div>\n </header>\n\n <div className=\"rb-builder__controls\">\n <input\n type=\"search\"\n placeholder=\"Search id, title, content…\"\n value={search}\n onChange={e => setSearch(e.target.value)}\n className=\"rb-builder__search\"\n />\n <select\n value={typeFilter}\n onChange={e => setTypeFilter(e.target.value as '' | BlockType)}\n className=\"rb-builder__select\"\n >\n <option value=\"\">all types</option>\n {BLOCK_TYPES.map(t => (\n <option key={t} value={t}>\n {t}\n </option>\n ))}\n </select>\n <select\n value={sort}\n onChange={e => setSort(e.target.value as SortMode)}\n className=\"rb-builder__select\"\n >\n <option value=\"order\">render order</option>\n <option value=\"priority\">priority ↓</option>\n <option value=\"type\">type</option>\n <option value=\"feedback\">has feedback</option>\n </select>\n <label className=\"rb-builder__andmode\">\n <input type=\"checkbox\" checked={andMode} onChange={e => setAndMode(e.target.checked)} />\n match all tags\n </label>\n </div>\n\n <div className=\"rb-builder__legend\">\n <span className=\"rb-builder__legend-item\">\n <span className=\"rb-builder__legend-dot rb-builder__legend-dot--tech\" />\n tech:\n </span>\n <span className=\"rb-builder__legend-item\">\n <span className=\"rb-builder__legend-dot rb-builder__legend-dot--layer\" />\n layer:\n </span>\n <span className=\"rb-builder__legend-item\">\n <span className=\"rb-builder__legend-dot rb-builder__legend-dot--story\" />\n story:\n </span>\n <span className=\"rb-builder__legend-item\">\n <span className=\"rb-builder__legend-dot rb-builder__legend-dot--plain\" />\n other / always\n </span>\n <span className=\"rb-builder__legend-item\">\n <strong>prio</strong>&nbsp;= how strongly you want a block (sort/rank hint)\n </span>\n </div>\n\n <div className=\"rb-builder__tagbar\">\n {sortedTags.map(t => (\n <button\n type=\"button\"\n key={t}\n onClick={() => toggleTag(t)}\n className={`rb-tag rb-tag--${facetOf(t)}${activeTags.has(t) ? ' rb-tag--active' : ''}`}\n >\n {t}\n <span className=\"rb-tag__n\">{tagCounts.get(t)}</span>\n </button>\n ))}\n </div>\n </div>\n\n <div className=\"rb-builder__list\">\n {creating && (\n <BlockCard\n key=\"__new__\"\n block={creating}\n feedback={undefined}\n isNew\n existingIds={blocks.map(b => b.id)}\n onSave={b => handleSave(b, true)}\n onCancel={() => setCreating(null)}\n onFeedback={handleFeedback}\n onTagClick={toggleTag}\n />\n )}\n {visible.map(b => (\n <BlockCard\n key={b.id}\n block={b}\n feedback={feedback[b.id]}\n existingIds={blocks.map(x => x.id)}\n onSave={block => handleSave(block, false)}\n onDelete={() => handleDelete(b.id)}\n onFeedback={handleFeedback}\n onTagClick={toggleTag}\n />\n ))}\n </div>\n </div>\n )\n}\n","import { createRoot, type Root } from 'react-dom/client'\nimport { logger } from '@wolffm/logger/client'\nimport { BuilderApp } from './BuilderApp'\nimport { setBuilderApiBaseUrl } from './api'\n// CSS is inlined into the bundle (not emitted as a separate asset) so builder.js\n// is fully self-contained — it can be served from /mf/resume/builder.js and\n// mounted by a bare page with no <link> wiring. Theme tokens come from the host\n// page; builder.css references them with fallbacks so it degrades standalone.\nimport builderCss from './builder.css?inline'\n\nfunction injectStyles() {\n if (document.getElementById('rb-builder-styles')) return\n const style = document.createElement('style')\n style.id = 'rb-builder-styles'\n style.textContent = builderCss\n document.head.appendChild(style)\n}\n\nexport interface ResumeBuilderProps {\n theme?: string\n /** API root, e.g. '/resume/api' — the builder calls ${apiBaseUrl}/builder/*. */\n apiBaseUrl: string\n}\n\ninterface BuilderElement extends HTMLElement {\n __root?: Root\n}\n\nexport function mount(el: HTMLElement, props: ResumeBuilderProps) {\n injectStyles()\n setBuilderApiBaseUrl(props.apiBaseUrl)\n const root = createRoot(el)\n root.render(<BuilderApp />)\n ;(el as BuilderElement).__root = root\n logger.info('[resume-builder] Mounted', { apiBaseUrl: props.apiBaseUrl })\n}\n\nexport function unmount(el: HTMLElement) {\n ;(el as BuilderElement).__root?.unmount()\n logger.info('[resume-builder] Unmounted')\n}\n"],"names":["BuilderApiError","message","status","baseUrl","setBuilderApiBaseUrl","url","req","path","init","res","detail","body","fetchBlocks","saveBlock","block","deleteBlock","id","saveFeedback","text","BLOCK_TYPES","BlockCard","feedback","existingIds","isNew","onSave","onDelete","onCancel","onFeedback","onTagClick","draft","setDraft","useState","tagsText","setTagsText","saving","setSaving","saveError","setSaveError","fbText","setFbText","fbStatus","setFbStatus","fbTimer","useRef","useEffect","dirty","parseTags","idInvalid","handleSave","err","handleDelete","onFbChange","jsxs","jsx","e","t","facetOf","PREFS_API_BASE","ANON_USER_ID","WHOAMI_GLOBAL","SESSION_SCOPE_PREFIX","UNSCOPED_ID","adaptWhoami","userType","name","verified","fetchWhoamiRaw","userKey","headers","resp","defaultWhoamiUrl","loc","whoami","opts","g","shared","redirectToAuth","ret","useBuilderAuth","setStatus","setName","cancelled","who","logger","tag","emptyBlock","BuilderApp","authStatus","adminName","blocks","setBlocks","setFeedback","loading","setLoading","error","setError","search","setSearch","typeFilter","setTypeFilter","activeTags","setActiveTags","andMode","setAndMode","sort","setSort","creating","setCreating","msg","tagCounts","useMemo","counts","b","sortedTags","a","visible","q","v","hits","toggleTag","prev","next","saved","idx","copy","apiDeleteBlock","handleFeedback","exportJson","blob","x","injectStyles","style","builderCss","mount","el","props","root","createRoot","unmount"],"mappings":";;;;AAqBO,MAAMA,UAAwB,MAAM;AAAA,EACzC,YACEC,GACSC,GACT;AACA,UAAMD,CAAO,GAFJ,KAAA,SAAAC,GAGT,KAAK,OAAO;AAAA,EACd;AACF;AAGA,IAAIC,IAAU;AACP,SAASC,GAAqBC,GAAmB;AACtD,EAAAF,IAAUE,EAAI,QAAQ,QAAQ,EAAE;AAClC;AAEA,eAAeC,EAAOC,GAAcC,GAAgC;AAClE,QAAMC,IAAM,MAAM,MAAM,GAAGN,CAAO,WAAWI,CAAI,IAAI;AAAA,IACnD,GAAGC;AAAA,IACH,aAAa;AAAA,IACb,SAAS,EAAE,gBAAgB,oBAAoB,GAAIA,GAAM,WAAW,CAAA,EAAC;AAAA,EAAG,CACzE;AACD,MAAI,CAACC,EAAI,IAAI;AACX,QAAIC,IAAS,GAAGD,EAAI,MAAM;AAC1B,QAAI;AACF,YAAME,IAAQ,MAAMF,EAAI,KAAA;AACxB,MAAAC,IAASC,EAAK,UAAU,GAAGA,EAAK,KAAK,KAAKA,EAAK,OAAO,KAAMA,EAAK,SAASD;AAAA,IAC5E,QAAQ;AAAA,IAER;AACA,UAAM,IAAIV,EAAgBU,GAAQD,EAAI,MAAM;AAAA,EAC9C;AACA,SAAQ,MAAMA,EAAI,KAAA;AACpB;AAEO,SAASG,KAAsE;AACpF,SAAON,EAAI,SAAS;AACtB;AAEO,SAASO,GAAUC,GAAqD;AAC7E,SAAOR,EAAI,WAAW,mBAAmBQ,EAAM,EAAE,CAAC,IAAI;AAAA,IACpD,QAAQ;AAAA,IACR,MAAM,KAAK,UAAUA,CAAK;AAAA,EAAA,CAC3B;AACH;AAEO,SAASC,GAAYC,GAAoD;AAC9E,SAAOV,EAAI,WAAW,mBAAmBU,CAAE,CAAC,IA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,EAAAL,GAAA,GACA9H,GAAqBmI,EAAM,UAAU;AACrC,QAAMC,IAAOC,EAAWH,CAAE;AAC1B,EAAAE,EAAK,OAAO,gBAAAnF,EAACiC,IAAA,CAAA,CAAW,CAAE,GACxBgD,EAAsB,SAASE,GACjCrD,EAAO,KAAK,4BAA4B,EAAE,YAAYoD,EAAM,YAAY;AAC1E;AAEO,SAASG,GAAQJ,GAAiB;AACrC,EAAAA,EAAsB,QAAQ,QAAA,GAChCnD,EAAO,KAAK,4BAA4B;AAC1C;","x_google_ignoreList":[2]}
1
+ {"version":3,"file":"builder.js","sources":["../src/builder/api.ts","../src/builder/BlockCard.tsx","../node_modules/.pnpm/@wolffm+prefs-client@1.1.24_react@19.2.0_zod@4.1.12/node_modules/@wolffm/prefs-client/dist/index.js","../src/builder/useBuilderAuth.ts","../src/builder/BuilderApp.tsx","../src/builder/entry.tsx"],"sourcesContent":["// Admin builder API client. All calls go through the edge-router (same-origin,\n// credentials:'include') so the caller's admin session cookie is resolved into\n// the X-Hadoku-Tier: admin stamp the worker's requireMinTier('admin') needs.\n\nexport type BlockType = 'experience' | 'project' | 'skills' | 'education' | 'summary' | 'header'\n\nexport interface ResumeBlock {\n id: string\n type: BlockType\n tags: string[]\n title: string\n content: string\n priority: number\n}\n\nexport interface FeedbackEntry {\n text: string\n updated: string\n}\nexport type Feedback = Record<string, FeedbackEntry>\n\nexport class BuilderApiError extends Error {\n constructor(\n message: string,\n readonly status: number\n ) {\n super(message)\n this.name = 'BuilderApiError'\n }\n}\n\n// The API root ('/resume/api'); builder endpoints are appended to it directly.\nlet baseUrl = ''\nexport function setBuilderApiBaseUrl(url: string): void {\n baseUrl = url.replace(/\\/+$/, '')\n}\n\nasync function req<T>(path: string, init?: RequestInit): Promise<T> {\n const res = await fetch(`${baseUrl}/builder${path}`, {\n ...init,\n credentials: 'include',\n headers: { 'Content-Type': 'application/json', ...(init?.headers ?? {}) }\n })\n if (!res.ok) {\n let detail = `${res.status}`\n try {\n const body = (await res.json()) as { error?: string; message?: string }\n detail = body.message ? `${body.error}: ${body.message}` : (body.error ?? detail)\n } catch {\n /* non-JSON error body */\n }\n throw new BuilderApiError(detail, res.status)\n }\n return (await res.json()) as T\n}\n\nexport function fetchBlocks(): Promise<{ blocks: ResumeBlock[]; feedback: Feedback }> {\n return req('/blocks')\n}\n\nexport function saveBlock(block: ResumeBlock): Promise<{ block: ResumeBlock }> {\n return req(`/blocks/${encodeURIComponent(block.id)}`, {\n method: 'PUT',\n body: JSON.stringify(block)\n })\n}\n\nexport function deleteBlock(id: string): Promise<{ deleted: true; id: string }> {\n return req(`/blocks/${encodeURIComponent(id)}`, { method: 'DELETE' })\n}\n\nexport function reorderBlocks(ids: string[]): Promise<{ ids: string[] }> {\n return req('/reorder', { method: 'PUT', body: JSON.stringify({ ids }) })\n}\n\nexport function saveFeedback(id: string, text: string): Promise<{ feedback: Feedback }> {\n return req(`/feedback/${encodeURIComponent(id)}`, {\n method: 'POST',\n body: JSON.stringify({ text })\n })\n}\n","import { useEffect, useRef, useState } from 'react'\nimport { facetOf } from './BuilderApp'\nimport type { BlockType, FeedbackEntry, ResumeBlock } from './api'\n\nconst BLOCK_TYPES: BlockType[] = [\n 'experience',\n 'project',\n 'skills',\n 'education',\n 'summary',\n 'header'\n]\n\ninterface Props {\n block: ResumeBlock\n feedback: FeedbackEntry | undefined\n existingIds: string[]\n isNew?: boolean\n onSave: (block: ResumeBlock) => Promise<void>\n onDelete?: () => Promise<void>\n onCancel?: () => void\n onFeedback: (id: string, text: string) => Promise<void>\n onTagClick: (tag: string) => void\n}\n\nexport function BlockCard({\n block,\n feedback,\n existingIds,\n isNew = false,\n onSave,\n onDelete,\n onCancel,\n onFeedback,\n onTagClick\n}: Props) {\n const [draft, setDraft] = useState<ResumeBlock>(block)\n const [tagsText, setTagsText] = useState(block.tags.join(' '))\n const [saving, setSaving] = useState(false)\n const [saveError, setSaveError] = useState<string | null>(null)\n const [fbText, setFbText] = useState(feedback?.text ?? '')\n const [fbStatus, setFbStatus] = useState('')\n const fbTimer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined)\n\n // Keep the draft in sync if the saved block changes underneath us (e.g. after\n // a successful save re-normalises it), but not while the user is mid-edit.\n useEffect(() => {\n if (!isNew) {\n setDraft(block)\n setTagsText(block.tags.join(' '))\n }\n }, [block, isNew])\n\n const dirty =\n isNew || JSON.stringify({ ...draft, tags: parseTags(tagsText) }) !== JSON.stringify(block)\n\n function parseTags(text: string): string[] {\n return [...new Set(text.split(/[\\s,]+/).filter(Boolean))]\n }\n\n const idInvalid =\n isNew && (!/^[a-z0-9][a-z0-9-]*$/.test(draft.id) || existingIds.includes(draft.id))\n\n async function handleSave() {\n setSaving(true)\n setSaveError(null)\n try {\n await onSave({ ...draft, tags: parseTags(tagsText) })\n } catch (err) {\n setSaveError(err instanceof Error ? err.message : 'Save failed')\n } finally {\n setSaving(false)\n }\n }\n\n async function handleDelete() {\n if (!onDelete) return\n if (!confirm(`Delete block \"${block.id}\"? This removes it from the live resume.`)) return\n setSaving(true)\n try {\n await onDelete()\n } catch (err) {\n setSaveError(err instanceof Error ? err.message : 'Delete failed')\n setSaving(false)\n }\n }\n\n function onFbChange(text: string) {\n setFbText(text)\n setFbStatus('typing…')\n clearTimeout(fbTimer.current)\n fbTimer.current = setTimeout(() => {\n onFeedback(block.id, text)\n .then(() => setFbStatus(text.trim() ? 'saved ✓' : ''))\n .catch(() => setFbStatus('save failed'))\n }, 600)\n }\n\n return (\n <div\n className={`rb-block${feedback ? ' rb-block--has-feedback' : ''}${dirty ? ' rb-block--dirty' : ''}`}\n >\n <div className=\"rb-block__row\">\n {isNew ? (\n <input\n className=\"rb-block__id-input\"\n placeholder=\"block-id (kebab-case)\"\n value={draft.id}\n onChange={e => setDraft({ ...draft, id: e.target.value })}\n />\n ) : (\n <span className=\"rb-block__id\">{draft.id}</span>\n )}\n <select\n className=\"rb-block__type\"\n value={draft.type}\n onChange={e => setDraft({ ...draft, type: e.target.value as BlockType })}\n >\n {BLOCK_TYPES.map(t => (\n <option key={t} value={t}>\n {t}\n </option>\n ))}\n </select>\n <label\n className=\"rb-block__prio\"\n title=\"Priority — how strongly you want this block in a tailored resume. Higher sorts first; a ranking hint, not a hard rule.\"\n >\n prio\n <input\n type=\"number\"\n min={0}\n max={10}\n value={draft.priority}\n onChange={e => setDraft({ ...draft, priority: Number(e.target.value) })}\n />\n </label>\n </div>\n\n <input\n className=\"rb-block__title\"\n placeholder=\"title (review label — not rendered into the resume)\"\n value={draft.title}\n onChange={e => setDraft({ ...draft, title: e.target.value })}\n />\n\n <div className=\"rb-block__chips\">\n {parseTags(tagsText).map(t => (\n <button\n type=\"button\"\n key={t}\n className={`rb-tag rb-tag--${facetOf(t)}`}\n onClick={() => onTagClick(t)}\n title=\"filter by this tag\"\n >\n {t}\n </button>\n ))}\n </div>\n <input\n className=\"rb-block__tags-input\"\n placeholder=\"tags (space or comma separated, e.g. tech:python story:scale)\"\n value={tagsText}\n onChange={e => setTagsText(e.target.value)}\n />\n\n <textarea\n className=\"rb-block__content\"\n rows={8}\n placeholder=\"content (markdown)\"\n value={draft.content}\n onChange={e => setDraft({ ...draft, content: e.target.value })}\n />\n\n <div className=\"rb-block__actions\">\n <button\n type=\"button\"\n className=\"rb-builder__btn rb-builder__btn--primary\"\n onClick={() => {\n void handleSave()\n }}\n disabled={saving || !dirty || idInvalid}\n >\n {saving ? 'Saving…' : isNew ? 'Create' : 'Save'}\n </button>\n {isNew ? (\n <button type=\"button\" className=\"rb-builder__btn\" onClick={onCancel}>\n Cancel\n </button>\n ) : (\n <button\n type=\"button\"\n className=\"rb-builder__btn rb-builder__btn--danger\"\n onClick={() => {\n void handleDelete()\n }}\n disabled={saving}\n >\n Delete\n </button>\n )}\n {idInvalid && <span className=\"rb-block__hint\">id must be unique kebab-case</span>}\n {saveError && <span className=\"rb-block__hint rb-block__hint--error\">{saveError}</span>}\n </div>\n\n {!isNew && (\n <div className=\"rb-block__feedback\">\n <textarea\n rows={2}\n placeholder=\"review note (autosaves)…\"\n value={fbText}\n onChange={e => onFbChange(e.target.value)}\n />\n <span className=\"rb-block__fb-status\">{fbStatus}</span>\n </div>\n )}\n </div>\n )\n}\n","// src/constants.ts\nvar PREFS_API_BASE = \"https://hadoku.me/prefs\";\nvar CACHE_KEY_PREFIX = \"prefs-cache\";\nvar SAVE_DEBOUNCE_MS = 1e3;\n\n// src/storage.ts\nvar localStorageAdapter = {\n get(key) {\n if (typeof window === \"undefined\") return Promise.resolve(null);\n try {\n return Promise.resolve(window.localStorage.getItem(key));\n } catch {\n return Promise.resolve(null);\n }\n },\n set(key, value) {\n if (typeof window === \"undefined\") return Promise.resolve();\n try {\n window.localStorage.setItem(key, value);\n } catch {\n }\n return Promise.resolve();\n },\n remove(key) {\n if (typeof window === \"undefined\") return Promise.resolve();\n try {\n window.localStorage.removeItem(key);\n } catch {\n }\n return Promise.resolve();\n }\n};\nvar memoryStorage = () => {\n const store = /* @__PURE__ */ new Map();\n return {\n get(key) {\n return Promise.resolve(store.get(key) ?? null);\n },\n set(key, value) {\n store.set(key, value);\n return Promise.resolve();\n },\n remove(key) {\n store.delete(key);\n return Promise.resolve();\n }\n };\n};\nvar sessionStorageWrite = (key, value) => {\n if (typeof window === \"undefined\") return;\n try {\n window.sessionStorage.setItem(key, value);\n } catch {\n }\n};\nfunction readCapacitorGlobal() {\n return globalThis.Capacitor;\n}\nfunction capacitorStorage() {\n const cap = readCapacitorGlobal();\n if (!cap?.isNativePlatform?.()) return null;\n const prefs = cap.Plugins?.Preferences;\n if (!prefs) return null;\n return {\n async get(key) {\n const { value } = await prefs.get({ key });\n return value ?? null;\n },\n async set(key, value) {\n await prefs.set({ key, value });\n },\n async remove(key) {\n await prefs.remove({ key });\n }\n };\n}\nfunction detectStorage() {\n return capacitorStorage() ?? localStorageAdapter;\n}\n\n// src/get-device-id.ts\nvar DEVICE_ID_KEY = \"hadoku_device_id\";\nasync function getDeviceId(storage = localStorageAdapter) {\n const existing = await storage.get(DEVICE_ID_KEY);\n if (existing && isUuid(existing)) {\n return existing;\n }\n const fresh = mintUuid();\n await storage.set(DEVICE_ID_KEY, fresh);\n return fresh;\n}\nfunction mintUuid() {\n const c = globalThis.crypto;\n if (c?.randomUUID) {\n return c.randomUUID();\n }\n return \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\".replace(/[xy]/g, (ch) => {\n const r = Math.random() * 16 | 0;\n const v = ch === \"x\" ? r : r & 3 | 8;\n return v.toString(16);\n });\n}\nvar UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\nfunction isUuid(s) {\n return UUID_RE.test(s);\n}\n\n// src/whoami.ts\nvar ANON_USER_ID = \"anon\";\nvar WHOAMI_GLOBAL = \"__hadokuWhoami\";\nvar SESSION_SCOPE_PREFIX = \"sess:\";\nvar UNSCOPED_ID = \"unscoped\";\nfunction adaptWhoami(body) {\n if (!body || body.valid === false) {\n return { userId: ANON_USER_ID, userType: \"public\", scope: \"anon\" };\n }\n const userType = body.userType === \"admin\" || body.userType === \"wife\" || body.userType === \"service\" || body.userType === \"friend\" || body.userType === \"member\" || body.userType === \"public\" ? body.userType : \"public\";\n const name = typeof body.name === \"string\" ? body.name : null;\n const verified = body.verified === true ? { verified: true } : {};\n if (typeof body.userId === \"string\" && body.userId) {\n return { userId: body.userId, userType, name, scope: \"user\", ...verified };\n }\n if (typeof body.sessionId === \"string\" && body.sessionId) {\n return {\n userId: `${SESSION_SCOPE_PREFIX}${body.sessionId}`,\n userType,\n name,\n scope: \"session\",\n ...verified\n };\n }\n return { userId: UNSCOPED_ID, userType, name, scope: \"none\", ...verified };\n}\nvar WHOAMI_TIMEOUT_MS = 3e3;\nasync function fetchWhoamiRaw(url, userKey) {\n const headers = {};\n if (userKey) {\n headers[\"X-User-Key\"] = userKey;\n }\n const ctrl = new AbortController();\n const timer = setTimeout(() => ctrl.abort(), WHOAMI_TIMEOUT_MS);\n try {\n const resp = await fetch(url, {\n method: \"GET\",\n headers,\n credentials: \"include\",\n cache: \"no-store\",\n signal: ctrl.signal\n });\n if (!resp.ok) return null;\n return await resp.json();\n } catch {\n return null;\n } finally {\n clearTimeout(timer);\n }\n}\nfunction defaultWhoamiUrl() {\n const loc = globalThis.location;\n if (loc && (loc.protocol === \"http:\" || loc.protocol === \"https:\")) return \"/session/whoami\";\n return `${PREFS_API_BASE.replace(/\\/prefs$/, \"\")}/session/whoami`;\n}\nasync function whoami(opts = {}) {\n const url = opts.whoamiUrl ?? defaultWhoamiUrl();\n if (opts.userKey) {\n return adaptWhoami(await fetchWhoamiRaw(url, opts.userKey));\n }\n const g = globalThis;\n let shared = g[WHOAMI_GLOBAL];\n if (!shared) {\n shared = fetchWhoamiRaw(url);\n g[WHOAMI_GLOBAL] = shared;\n }\n try {\n return adaptWhoami(await shared);\n } catch {\n return { userId: ANON_USER_ID, userType: \"public\", scope: \"anon\" };\n }\n}\n\n// src/client.ts\nfunction createPrefsClient(opts) {\n const apiBase = opts.apiBase ?? PREFS_API_BASE;\n const mirrorOnRead = opts.mirrorBootstrapOnRead ?? false;\n const storage = opts.storage ?? detectStorage();\n const listeners = /* @__PURE__ */ new Set();\n const migrations = opts.migrations ?? [];\n const defaults = opts.defaults ?? {};\n const bootstrapMap = opts.bootstrapToSessionStorage ?? {};\n let userId = null;\n let identityScope = \"anon\";\n let wroteWhileAnon = false;\n let deviceId = opts.deviceId ?? null;\n let currentBlob = null;\n let userVersion = 0;\n let deviceVersion = 0;\n let pendingPatch = {};\n let pendingScope = \"user\";\n const dirtyFields = /* @__PURE__ */ new Set();\n let saveTimer = null;\n let savePromise = null;\n let initPromise = null;\n let bcast = null;\n let destroyed = false;\n const broadcastId = `${Math.random().toString(36).slice(2)}-${Date.now()}`;\n function ensureInit() {\n if (initPromise) return initPromise;\n initPromise = (async () => {\n const who = await whoami({\n userKey: opts.userKey,\n // An EXPLICIT apiBase (a non-prod environment) names where identity lives\n // too. With none, leave it to whoami()'s default — same-origin in a\n // browser — rather than pinning the hadoku.me constant (#419).\n ...opts.apiBase ? { whoamiUrl: `${opts.apiBase.replace(/\\/prefs$/, \"\")}/session/whoami` } : {}\n });\n userId = who.userId;\n identityScope = who.scope;\n if (!deviceId) {\n deviceId = await getDeviceId(storage);\n }\n const cached = await readCache();\n if (cached) {\n userVersion = cached.userVersion;\n deviceVersion = cached.deviceVersion;\n currentBlob = applyDefaultsAndParse(cached.blob);\n if (mirrorOnRead) mirrorBootstrap(currentBlob);\n notify(currentBlob);\n }\n if (canPersist() && typeof BroadcastChannel !== \"undefined\") {\n bcast = new BroadcastChannel(`prefs:${userId}:${opts.appId}`);\n bcast.addEventListener(\"message\", onBroadcast);\n }\n })();\n return initPromise;\n }\n function buildHeaders() {\n const h = { \"Content-Type\": \"application/json\" };\n if (opts.userKey) h[\"X-User-Key\"] = opts.userKey;\n if (deviceId) h[\"X-Device-Id\"] = deviceId;\n return h;\n }\n async function fetchFromServer() {\n const resp = await fetch(`${apiBase}/api/v1/${opts.appId}`, {\n method: \"GET\",\n headers: buildHeaders(),\n credentials: \"include\"\n });\n if (!resp.ok) {\n throw new Error(`prefs-api GET failed: ${resp.status}`);\n }\n return await resp.json();\n }\n async function putToServer(scope, patch, expectedVersion) {\n const resp = await fetch(`${apiBase}/api/v1/${opts.appId}`, {\n method: \"PUT\",\n headers: buildHeaders(),\n credentials: \"include\",\n body: JSON.stringify({\n scope,\n patch,\n expectedVersion\n })\n });\n if (resp.status === 409) {\n const body2 = await resp.json();\n if (body2.current) {\n return { ok: false, conflict: body2.current };\n }\n throw new Error(\"prefs-api 409 without current-state body\");\n }\n if (!resp.ok) {\n throw new Error(`prefs-api PUT failed: ${resp.status}`);\n }\n const body = await resp.json();\n return { ok: true, row: body, scope: body.scope };\n }\n function cacheKey() {\n return `${CACHE_KEY_PREFIX}:${userId ?? ANON_USER_ID}:${opts.appId}`;\n }\n function canPersist() {\n return identityScope !== \"none\";\n }\n function canSync() {\n return identityScope === \"user\" || identityScope === \"session\";\n }\n async function readCache() {\n if (!canPersist()) return null;\n const raw = await storage.get(cacheKey());\n if (!raw) return null;\n try {\n const parsed = JSON.parse(raw);\n if (parsed && typeof parsed === \"object\" && parsed.blob && typeof parsed.blob === \"object\") {\n return parsed;\n }\n } catch {\n }\n return null;\n }\n async function writeCache(env) {\n if (!canPersist()) return;\n await storage.set(cacheKey(), JSON.stringify(env));\n }\n function applyDefaultsAndParse(rawBlob) {\n let withDefaults = { ...defaults, ...rawBlob };\n for (const m of migrations) {\n withDefaults = m(withDefaults);\n }\n const result = opts.schema.safeParse(withDefaults);\n if (result.success) {\n return result.data;\n }\n const fallback = opts.schema.safeParse({ ...defaults });\n return fallback.success ? fallback.data : withDefaults;\n }\n function mirrorBootstrap(blob) {\n for (const [field, sessionKey] of Object.entries(bootstrapMap)) {\n if (typeof sessionKey !== \"string\" || !sessionKey) continue;\n const value = blob[field];\n if (typeof value === \"string\") {\n sessionStorageWrite(sessionKey, value);\n }\n }\n }\n function notify(blob) {\n for (const l of listeners) {\n try {\n l(blob);\n } catch {\n }\n }\n }\n function broadcast(blob) {\n if (!bcast) return;\n try {\n bcast.postMessage({ source: broadcastId, blob });\n } catch {\n }\n }\n function onBroadcast(ev) {\n const data = ev.data;\n if (!data || data.source === broadcastId || !data.blob) return;\n const reconciled = reconcileDirty(data.blob);\n currentBlob = applyDefaultsAndParse(reconciled);\n if (mirrorOnRead) mirrorBootstrap(currentBlob);\n notify(currentBlob);\n }\n function reconcileDirty(remote) {\n if (dirtyFields.size === 0 || !currentBlob) return remote;\n const local = currentBlob;\n const reconciled = { ...remote };\n for (const field of dirtyFields) {\n if (field in local) reconciled[field] = local[field];\n }\n return reconciled;\n }\n async function refreshFromServer() {\n if (!canSync()) {\n if (currentBlob === null) {\n currentBlob = applyDefaultsAndParse({});\n if (mirrorOnRead) mirrorBootstrap(currentBlob);\n notify(currentBlob);\n }\n return;\n }\n const server = await fetchFromServer();\n userVersion = server.user?.version ?? 0;\n deviceVersion = server.device?.version ?? 0;\n const merged = reconcileDirty(server.merged ?? {});\n currentBlob = applyDefaultsAndParse(merged);\n await writeCache({\n blob: merged,\n userVersion,\n deviceVersion,\n cachedAt: Date.now()\n });\n if (mirrorOnRead) mirrorBootstrap(currentBlob);\n notify(currentBlob);\n broadcast(currentBlob);\n }\n function scheduleFlush() {\n if (saveTimer) clearTimeout(saveTimer);\n saveTimer = setTimeout(() => {\n void flushPending();\n }, SAVE_DEBOUNCE_MS);\n }\n async function flushPending() {\n if (Object.keys(pendingPatch).length === 0) return;\n if (savePromise) {\n await savePromise;\n }\n const patchSnapshot = pendingPatch;\n const scopeSnapshot = pendingScope;\n pendingPatch = {};\n if (saveTimer) {\n clearTimeout(saveTimer);\n saveTimer = null;\n }\n if (!canSync()) {\n for (const key of Object.keys(patchSnapshot)) {\n if (!(key in pendingPatch)) dirtyFields.delete(key);\n }\n return;\n }\n const expectedVersion = scopeSnapshot === \"user\" ? userVersion : deviceVersion;\n savePromise = (async () => {\n try {\n const result = await putToServer(scopeSnapshot, patchSnapshot, expectedVersion);\n if (result.ok) {\n if (result.scope === \"user\") {\n userVersion = result.row.version;\n } else {\n deviceVersion = result.row.version;\n }\n await refreshFromServer();\n } else {\n if (scopeSnapshot === \"user\") {\n userVersion = result.conflict.version;\n } else {\n deviceVersion = result.conflict.version;\n }\n await refreshFromServer();\n }\n for (const key of Object.keys(patchSnapshot)) {\n if (!(key in pendingPatch)) dirtyFields.delete(key);\n }\n } catch {\n pendingPatch = { ...patchSnapshot, ...pendingPatch };\n pendingScope = scopeSnapshot;\n } finally {\n savePromise = null;\n }\n })();\n await savePromise;\n }\n const client = {\n appId: opts.appId,\n async read() {\n await ensureInit();\n if (currentBlob === null) {\n try {\n await refreshFromServer();\n } catch {\n currentBlob = applyDefaultsAndParse({});\n }\n } else {\n void refreshFromServer().catch(() => {\n });\n }\n return currentBlob ?? applyDefaultsAndParse({});\n },\n async save(patch, saveOpts) {\n await ensureInit();\n const scope = saveOpts?.scope ?? \"user\";\n if (identityScope === \"anon\") wroteWhileAnon = true;\n const base = currentBlob ?? {};\n const nextBlob = applyDefaultsAndParse({ ...base, ...patch });\n currentBlob = nextBlob;\n await writeCache({\n blob: { ...base, ...patch },\n userVersion,\n deviceVersion,\n cachedAt: Date.now()\n });\n mirrorBootstrap(nextBlob);\n notify(nextBlob);\n broadcast(nextBlob);\n if (Object.keys(pendingPatch).length > 0 && pendingScope !== scope) {\n await flushPending();\n }\n pendingPatch = { ...pendingPatch, ...patch };\n pendingScope = scope;\n for (const key of Object.keys(patch)) dirtyFields.add(key);\n if (saveOpts?.expectedVersion !== void 0) {\n await flushPending();\n } else {\n scheduleFlush();\n }\n },\n subscribe(listener) {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n },\n async promoteAnonPrefsToUser() {\n if (!wroteWhileAnon) return;\n const anonKey = `${CACHE_KEY_PREFIX}:${ANON_USER_ID}:${opts.appId}`;\n const raw = await storage.get(anonKey);\n if (!raw) return;\n let anon;\n try {\n anon = JSON.parse(raw);\n } catch {\n return;\n }\n if (!anon.blob || Object.keys(anon.blob).length === 0) return;\n await ensureInit();\n const server = await fetchFromServer();\n if (server.user) {\n await refreshFromServer();\n await storage.remove(anonKey);\n return;\n }\n await putToServer(\"user\", anon.blob, 0);\n await refreshFromServer();\n await storage.remove(anonKey);\n },\n async flush() {\n await flushPending();\n },\n destroy() {\n if (destroyed) return;\n destroyed = true;\n if (saveTimer) clearTimeout(saveTimer);\n if (bcast) bcast.close();\n listeners.clear();\n }\n };\n return client;\n}\nexport {\n ANON_USER_ID,\n CACHE_KEY_PREFIX,\n DEVICE_ID_KEY,\n PREFS_API_BASE,\n SAVE_DEBOUNCE_MS,\n capacitorStorage,\n createPrefsClient,\n detectStorage,\n getDeviceId,\n localStorageAdapter,\n memoryStorage,\n sessionStorageWrite,\n whoami\n};\n","import { useEffect, useState } from 'react'\nimport { whoami } from '@wolffm/prefs-client'\nimport { logger } from '@wolffm/logger/client'\n\n// Ecosystem auth, matching the command station (hadoku_site ContactAdmin):\n// resolve the caller's tier via edge-router's /session/whoami, and on anything\n// short of admin bounce to the shared /auth sign-in page rather than showing a\n// custom \"enter a key\" dead-end. /auth accepts a valid key (POST /session/create)\n// and redirects back to `return`. No app-specific key handling lives here.\n\n/** Send the browser to the ecosystem sign-in page, returning here afterwards. */\nexport function redirectToAuth(): void {\n if (typeof window === 'undefined') return\n const ret = encodeURIComponent(window.location.pathname + window.location.search)\n window.location.replace(`/auth?return=${ret}`)\n}\n\nexport type AuthStatus = 'checking' | 'authorized' | 'redirecting'\n\nexport interface BuilderAuth {\n status: AuthStatus\n /** Display name from the key registry once authorized (null if unnamed). */\n name: string | null\n}\n\nexport function useBuilderAuth(): BuilderAuth {\n const [status, setStatus] = useState<AuthStatus>('checking')\n const [name, setName] = useState<string | null>(null)\n\n useEffect(() => {\n let cancelled = false\n whoami()\n .then(who => {\n if (cancelled) return\n if (who.userType === 'admin') {\n setName(who.name ?? null)\n setStatus('authorized')\n return\n }\n logger.info('[builder] not admin, redirecting to sign in', { userType: who.userType })\n setStatus('redirecting')\n redirectToAuth()\n })\n .catch((err: unknown) => {\n // whoami() itself never rejects (it degrades to public), but stay\n // defensive: any failure means \"not signed in\" → sign-in page.\n if (cancelled) return\n logger.error('[builder] whoami failed', {\n error: err instanceof Error ? err.message : String(err)\n })\n setStatus('redirecting')\n redirectToAuth()\n })\n return () => {\n cancelled = true\n }\n }, [])\n\n return { status, name }\n}\n","import { useEffect, useMemo, useState } from 'react'\nimport { logger } from '@wolffm/logger/client'\nimport {\n fetchBlocks,\n saveBlock,\n deleteBlock as apiDeleteBlock,\n saveFeedback,\n BuilderApiError,\n type ResumeBlock,\n type BlockType,\n type Feedback\n} from './api'\nimport { BlockCard } from './BlockCard'\nimport { useBuilderAuth, redirectToAuth } from './useBuilderAuth'\n\nconst BLOCK_TYPES: BlockType[] = [\n 'experience',\n 'project',\n 'skills',\n 'education',\n 'summary',\n 'header'\n]\n\nexport function facetOf(tag: string): 'tech' | 'layer' | 'story' | 'plain' {\n if (tag.startsWith('tech:')) return 'tech'\n if (tag.startsWith('layer:')) return 'layer'\n if (tag.startsWith('story:')) return 'story'\n return 'plain'\n}\n\ntype SortMode = 'order' | 'priority' | 'type' | 'feedback'\n\nfunction emptyBlock(): ResumeBlock {\n return { id: '', type: 'experience', tags: [], title: '', content: '', priority: 5 }\n}\n\nexport function BuilderApp() {\n const { status: authStatus, name: adminName } = useBuilderAuth()\n const [blocks, setBlocks] = useState<ResumeBlock[]>([])\n const [feedback, setFeedback] = useState<Feedback>({})\n const [loading, setLoading] = useState(true)\n const [error, setError] = useState<string | null>(null)\n\n // Filters\n const [search, setSearch] = useState('')\n const [typeFilter, setTypeFilter] = useState<'' | BlockType>('')\n const [activeTags, setActiveTags] = useState<Set<string>>(new Set())\n const [andMode, setAndMode] = useState(true)\n const [sort, setSort] = useState<SortMode>('order')\n\n const [creating, setCreating] = useState<ResumeBlock | null>(null)\n\n useEffect(() => {\n if (authStatus !== 'authorized') return\n let cancelled = false\n fetchBlocks()\n .then(res => {\n if (cancelled) return\n setBlocks(res.blocks)\n setFeedback(res.feedback)\n })\n .catch((err: unknown) => {\n if (cancelled) return\n // Session lapsed between the whoami check and this call → bounce to\n // sign-in, same as the initial gate. Everything else is a real error.\n if (err instanceof BuilderApiError && (err.status === 401 || err.status === 403)) {\n redirectToAuth()\n return\n }\n const msg = err instanceof Error ? err.message : 'Failed to load blocks'\n setError(msg)\n logger.error('[builder] load failed', { error: msg })\n })\n .finally(() => {\n if (!cancelled) setLoading(false)\n })\n return () => {\n cancelled = true\n }\n }, [authStatus])\n\n const tagCounts = useMemo(() => {\n const counts = new Map<string, number>()\n for (const b of blocks) for (const t of b.tags) counts.set(t, (counts.get(t) ?? 0) + 1)\n return counts\n }, [blocks])\n\n const sortedTags = useMemo(\n () =>\n [...tagCounts.keys()].sort(\n (a, b) => facetOf(a).localeCompare(facetOf(b)) || a.localeCompare(b)\n ),\n [tagCounts]\n )\n\n const visible = useMemo(() => {\n const q = search.trim().toLowerCase()\n let v = blocks.filter(b => {\n if (typeFilter && b.type !== typeFilter) return false\n if (q && !(b.id + b.title + b.content).toLowerCase().includes(q)) return false\n if (activeTags.size) {\n const hits = [...activeTags].filter(t => b.tags.includes(t)).length\n if (andMode ? hits !== activeTags.size : hits === 0) return false\n }\n return true\n })\n if (sort === 'priority') v = [...v].sort((a, b) => b.priority - a.priority)\n else if (sort === 'type') v = [...v].sort((a, b) => a.type.localeCompare(b.type))\n else if (sort === 'feedback')\n v = [...v].sort((a, b) => (feedback[b.id] ? 1 : 0) - (feedback[a.id] ? 1 : 0))\n return v\n }, [blocks, search, typeFilter, activeTags, andMode, sort, feedback])\n\n function toggleTag(tag: string) {\n setActiveTags(prev => {\n const next = new Set(prev)\n if (next.has(tag)) next.delete(tag)\n else next.add(tag)\n return next\n })\n }\n\n async function handleSave(block: ResumeBlock, isNew: boolean): Promise<void> {\n const { block: saved } = await saveBlock(block)\n setBlocks(prev => {\n const idx = prev.findIndex(b => b.id === saved.id)\n if (idx === -1) return [...prev, saved]\n const copy = [...prev]\n copy[idx] = saved\n return copy\n })\n if (isNew) setCreating(null)\n }\n\n async function handleDelete(id: string): Promise<void> {\n await apiDeleteBlock(id)\n setBlocks(prev => prev.filter(b => b.id !== id))\n }\n\n async function handleFeedback(id: string, text: string): Promise<void> {\n const res = await saveFeedback(id, text)\n setFeedback(res.feedback)\n }\n\n function exportJson() {\n const blob = new Blob([JSON.stringify(blocks, null, 2)], { type: 'application/json' })\n const url = URL.createObjectURL(blob)\n const a = document.createElement('a')\n a.href = url\n a.download = 'blocks.json'\n a.click()\n URL.revokeObjectURL(url)\n }\n\n if (authStatus === 'checking') return <p className=\"rb-builder__status\">Checking access…</p>\n if (authStatus === 'redirecting')\n return <p className=\"rb-builder__status\">Redirecting to sign in…</p>\n if (loading) return <p className=\"rb-builder__status\">Loading blocks…</p>\n if (error) return <p className=\"rb-builder__status rb-builder__status--error\">{error}</p>\n\n return (\n <div className=\"rb-builder\">\n <div className=\"rb-builder__toolbar\">\n <header className=\"rb-builder__header\">\n <h1>Resume Builder</h1>\n <div className=\"rb-builder__count\">\n {visible.length} / {blocks.length} blocks\n </div>\n {adminName && (\n <div className=\"rb-builder__whoami\">\n Signed in as <span className=\"rb-builder__whoami-name\">{adminName}</span>\n </div>\n )}\n <div className=\"rb-builder__header-actions\">\n <button type=\"button\" onClick={exportJson} className=\"rb-builder__btn\">\n Export blocks.json\n </button>\n <button\n type=\"button\"\n onClick={() => setCreating(emptyBlock())}\n className=\"rb-builder__btn rb-builder__btn--primary\"\n disabled={creating !== null}\n >\n + New block\n </button>\n </div>\n </header>\n\n <div className=\"rb-builder__controls\">\n <input\n type=\"search\"\n placeholder=\"Search id, title, content…\"\n value={search}\n onChange={e => setSearch(e.target.value)}\n className=\"rb-builder__search\"\n />\n <select\n value={typeFilter}\n onChange={e => setTypeFilter(e.target.value as '' | BlockType)}\n className=\"rb-builder__select\"\n >\n <option value=\"\">all types</option>\n {BLOCK_TYPES.map(t => (\n <option key={t} value={t}>\n {t}\n </option>\n ))}\n </select>\n <select\n value={sort}\n onChange={e => setSort(e.target.value as SortMode)}\n className=\"rb-builder__select\"\n >\n <option value=\"order\">render order</option>\n <option value=\"priority\">priority ↓</option>\n <option value=\"type\">type</option>\n <option value=\"feedback\">has feedback</option>\n </select>\n <label className=\"rb-builder__andmode\">\n <input type=\"checkbox\" checked={andMode} onChange={e => setAndMode(e.target.checked)} />\n match all tags\n </label>\n </div>\n\n <div className=\"rb-builder__legend\">\n <span className=\"rb-builder__legend-item\">\n <span className=\"rb-builder__legend-dot rb-builder__legend-dot--tech\" />\n tech:\n </span>\n <span className=\"rb-builder__legend-item\">\n <span className=\"rb-builder__legend-dot rb-builder__legend-dot--layer\" />\n layer:\n </span>\n <span className=\"rb-builder__legend-item\">\n <span className=\"rb-builder__legend-dot rb-builder__legend-dot--story\" />\n story:\n </span>\n <span className=\"rb-builder__legend-item\">\n <span className=\"rb-builder__legend-dot rb-builder__legend-dot--plain\" />\n other / always\n </span>\n <span className=\"rb-builder__legend-item\">\n <strong>prio</strong>&nbsp;= how strongly you want a block (sort/rank hint)\n </span>\n </div>\n\n <div className=\"rb-builder__tagbar\">\n {sortedTags.map(t => (\n <button\n type=\"button\"\n key={t}\n onClick={() => toggleTag(t)}\n className={`rb-tag rb-tag--${facetOf(t)}${activeTags.has(t) ? ' rb-tag--active' : ''}`}\n >\n {t}\n <span className=\"rb-tag__n\">{tagCounts.get(t)}</span>\n </button>\n ))}\n </div>\n </div>\n\n <div className=\"rb-builder__list\">\n {creating && (\n <BlockCard\n key=\"__new__\"\n block={creating}\n feedback={undefined}\n isNew\n existingIds={blocks.map(b => b.id)}\n onSave={b => handleSave(b, true)}\n onCancel={() => setCreating(null)}\n onFeedback={handleFeedback}\n onTagClick={toggleTag}\n />\n )}\n {visible.map(b => (\n <BlockCard\n key={b.id}\n block={b}\n feedback={feedback[b.id]}\n existingIds={blocks.map(x => x.id)}\n onSave={block => handleSave(block, false)}\n onDelete={() => handleDelete(b.id)}\n onFeedback={handleFeedback}\n onTagClick={toggleTag}\n />\n ))}\n </div>\n </div>\n )\n}\n","import { createRoot, type Root } from 'react-dom/client'\nimport { logger } from '@wolffm/logger/client'\nimport { BuilderApp } from './BuilderApp'\nimport { setBuilderApiBaseUrl } from './api'\n// CSS is inlined into the bundle (not emitted as a separate asset) so builder.js\n// is fully self-contained — it can be served from /mf/resume/builder.js and\n// mounted by a bare page with no <link> wiring. Theme tokens come from the host\n// page; builder.css references them with fallbacks so it degrades standalone.\nimport builderCss from './builder.css?inline'\n\nfunction injectStyles() {\n if (document.getElementById('rb-builder-styles')) return\n const style = document.createElement('style')\n style.id = 'rb-builder-styles'\n style.textContent = builderCss\n document.head.appendChild(style)\n}\n\nexport interface ResumeBuilderProps {\n theme?: string\n /** API root, e.g. '/resume/api' — the builder calls ${apiBaseUrl}/builder/*. */\n apiBaseUrl: string\n}\n\ninterface BuilderElement extends HTMLElement {\n __root?: Root\n}\n\nexport function mount(el: HTMLElement, props: ResumeBuilderProps) {\n injectStyles()\n setBuilderApiBaseUrl(props.apiBaseUrl)\n const root = createRoot(el)\n root.render(<BuilderApp />)\n ;(el as BuilderElement).__root = root\n logger.info('[resume-builder] Mounted', { apiBaseUrl: props.apiBaseUrl })\n}\n\nexport function unmount(el: HTMLElement) {\n ;(el as BuilderElement).__root?.unmount()\n logger.info('[resume-builder] Unmounted')\n}\n"],"names":["BuilderApiError","message","status","baseUrl","setBuilderApiBaseUrl","url","req","path","init","res","detail","body","fetchBlocks","saveBlock","block","deleteBlock","id","saveFeedback","text","BLOCK_TYPES","BlockCard","feedback","existingIds","isNew","onSave","onDelete","onCancel","onFeedback","onTagClick","draft","setDraft","useState","tagsText","setTagsText","saving","setSaving","saveError","setSaveError","fbText","setFbText","fbStatus","setFbStatus","fbTimer","useRef","useEffect","dirty","parseTags","idInvalid","handleSave","err","handleDelete","onFbChange","jsxs","jsx","e","t","facetOf","PREFS_API_BASE","ANON_USER_ID","WHOAMI_GLOBAL","SESSION_SCOPE_PREFIX","UNSCOPED_ID","adaptWhoami","userType","name","verified","WHOAMI_TIMEOUT_MS","fetchWhoamiRaw","userKey","headers","ctrl","timer","resp","defaultWhoamiUrl","loc","whoami","opts","g","shared","redirectToAuth","ret","useBuilderAuth","setStatus","setName","cancelled","who","logger","tag","emptyBlock","BuilderApp","authStatus","adminName","blocks","setBlocks","setFeedback","loading","setLoading","error","setError","search","setSearch","typeFilter","setTypeFilter","activeTags","setActiveTags","andMode","setAndMode","sort","setSort","creating","setCreating","msg","tagCounts","useMemo","counts","b","sortedTags","a","visible","q","v","hits","toggleTag","prev","next","saved","idx","copy","apiDeleteBlock","handleFeedback","exportJson","blob","x","injectStyles","style","builderCss","mount","el","props","root","createRoot","unmount"],"mappings":";;;;AAqBO,MAAMA,UAAwB,MAAM;AAAA,EACzC,YACEC,GACSC,GACT;AACA,UAAMD,CAAO,GAFJ,KAAA,SAAAC,GAGT,KAAK,OA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,EAAK,OAAO,gBAAAtF,EAACoC,IAAA,CAAA,CAAW,CAAE,GACxBgD,EAAsB,SAASE,GACjCrD,EAAO,KAAK,4BAA4B,EAAE,YAAYoD,EAAM,YAAY;AAC1E;AAEO,SAASG,GAAQJ,GAAiB;AACrC,EAAAA,EAAsB,QAAQ,QAAA,GAChCnD,EAAO,KAAK,4BAA4B;AAC1C;","x_google_ignoreList":[2]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hadoku/resume-bot",
3
- "version": "3.15.57",
4
- "gitHead": "53820d7dafa3281fc3011bd5914bb944200ed400",
3
+ "version": "3.15.59",
4
+ "gitHead": "194990bdcf041d7a23d72234aa69bd92e1192784",
5
5
  "description": "AI-powered conversational interface for interactive resume exploration",
6
6
  "license": "MIT",
7
7
  "type": "module",
@@ -34,8 +34,8 @@
34
34
  "react-dom": "^19.0.0"
35
35
  },
36
36
  "dependencies": {
37
- "@wolffm/prefs-client": "npm:@hadoku/prefs-client@^1.1.23",
38
- "@wolffm/worker-utils": "npm:@hadoku/worker-utils@^1.7.18",
37
+ "@wolffm/prefs-client": "npm:@hadoku/prefs-client@^1.1.24",
38
+ "@wolffm/worker-utils": "npm:@hadoku/worker-utils@^1.7.19",
39
39
  "hono": "^4.11.4",
40
40
  "openai": "^6.21.0",
41
41
  "pdf-lib": "^1.17.1",