@hadoku/jobplatform 3.42.86 → 3.42.88

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.
@@ -1,4168 +0,0 @@
1
- import { jsxs as g, jsx as s, Fragment as Fe } from "react/jsx-runtime";
2
- import { createRoot as wa } from "react-dom/client";
3
- import { logger as Ot } from "@wolffm/logger/client";
4
- import * as p from "react";
5
- import { useState as N, useRef as Te, useEffect as z, useCallback as se, useId as _a, useMemo as fe, Suspense as tt, lazy as me } from "react";
6
- import { LoadingSkeleton as ka, AppHeader as Ra } from "@wolffm/task-ui-components";
7
- import { HadokuThemeRoot as Na, useHadokuTheme as ja } from "@wolffm/themes";
8
- var wt = "popstate";
9
- function _t(e) {
10
- return typeof e == "object" && e != null && "pathname" in e && "search" in e && "hash" in e && "state" in e && "key" in e;
11
- }
12
- function Ca(e = {}) {
13
- function t(r, o) {
14
- let {
15
- pathname: i = "/",
16
- search: l = "",
17
- hash: c = ""
18
- } = ke(r.location.hash.substring(1));
19
- return !i.startsWith("/") && !i.startsWith(".") && (i = "/" + i), at(
20
- "",
21
- { pathname: i, search: l, hash: c },
22
- // state defaults to `null` because `window.history.state` does
23
- o.state && o.state.usr || null,
24
- o.state && o.state.key || "default"
25
- );
26
- }
27
- function a(r, o) {
28
- let i = r.document.querySelector("base"), l = "";
29
- if (i && i.getAttribute("href")) {
30
- let c = r.location.href, u = c.indexOf("#");
31
- l = u === -1 ? c : c.slice(0, u);
32
- }
33
- return l + "#" + (typeof o == "string" ? o : $e(o));
34
- }
35
- function n(r, o) {
36
- X(
37
- r.pathname.charAt(0) === "/",
38
- `relative pathnames are not supported in hash history.push(${JSON.stringify(
39
- o
40
- )})`
41
- );
42
- }
43
- return Sa(
44
- t,
45
- a,
46
- n,
47
- e
48
- );
49
- }
50
- function I(e, t) {
51
- if (e === !1 || e === null || typeof e > "u")
52
- throw new Error(t);
53
- }
54
- function X(e, t) {
55
- if (!e) {
56
- typeof console < "u" && console.warn(t);
57
- try {
58
- throw new Error(t);
59
- } catch {
60
- }
61
- }
62
- }
63
- function Ea() {
64
- return Math.random().toString(36).substring(2, 10);
65
- }
66
- function kt(e, t) {
67
- return {
68
- usr: e.state,
69
- key: e.key,
70
- idx: t,
71
- masked: e.unstable_mask ? {
72
- pathname: e.pathname,
73
- search: e.search,
74
- hash: e.hash
75
- } : void 0
76
- };
77
- }
78
- function at(e, t, a = null, n, r) {
79
- return {
80
- pathname: typeof e == "string" ? e : e.pathname,
81
- search: "",
82
- hash: "",
83
- ...typeof t == "string" ? ke(t) : t,
84
- state: a,
85
- // TODO: This could be cleaned up. push/replace should probably just take
86
- // full Locations now and avoid the need to run through this flow at all
87
- // But that's a pretty big refactor to the current test suite so going to
88
- // keep as is for the time being and just let any incoming keys take precedence
89
- key: t && t.key || n || Ea(),
90
- unstable_mask: r
91
- };
92
- }
93
- function $e({
94
- pathname: e = "/",
95
- search: t = "",
96
- hash: a = ""
97
- }) {
98
- return t && t !== "?" && (e += t.charAt(0) === "?" ? t : "?" + t), a && a !== "#" && (e += a.charAt(0) === "#" ? a : "#" + a), e;
99
- }
100
- function ke(e) {
101
- let t = {};
102
- if (e) {
103
- let a = e.indexOf("#");
104
- a >= 0 && (t.hash = e.substring(a), e = e.substring(0, a));
105
- let n = e.indexOf("?");
106
- n >= 0 && (t.search = e.substring(n), e = e.substring(0, n)), e && (t.pathname = e);
107
- }
108
- return t;
109
- }
110
- function Sa(e, t, a, n = {}) {
111
- let { window: r = document.defaultView, v5Compat: o = !1 } = n, i = r.history, l = "POP", c = null, u = h();
112
- u == null && (u = 0, i.replaceState({ ...i.state, idx: u }, ""));
113
- function h() {
114
- return (i.state || { idx: null }).idx;
115
- }
116
- function d() {
117
- l = "POP";
118
- let f = h(), C = f == null ? null : f - u;
119
- u = f, c && c({ action: l, location: m.location, delta: C });
120
- }
121
- function v(f, C) {
122
- l = "PUSH";
123
- let w = _t(f) ? f : at(m.location, f, C);
124
- a && a(w, f), u = h() + 1;
125
- let R = kt(w, u), L = m.createHref(w.unstable_mask || w);
126
- try {
127
- i.pushState(R, "", L);
128
- } catch (x) {
129
- if (x instanceof DOMException && x.name === "DataCloneError")
130
- throw x;
131
- r.location.assign(L);
132
- }
133
- o && c && c({ action: l, location: m.location, delta: 1 });
134
- }
135
- function b(f, C) {
136
- l = "REPLACE";
137
- let w = _t(f) ? f : at(m.location, f, C);
138
- a && a(w, f), u = h();
139
- let R = kt(w, u), L = m.createHref(w.unstable_mask || w);
140
- i.replaceState(R, "", L), o && c && c({ action: l, location: m.location, delta: 0 });
141
- }
142
- function _(f) {
143
- return Pa(f);
144
- }
145
- let m = {
146
- get action() {
147
- return l;
148
- },
149
- get location() {
150
- return e(r, i);
151
- },
152
- listen(f) {
153
- if (c)
154
- throw new Error("A history only accepts one active listener");
155
- return r.addEventListener(wt, d), c = f, () => {
156
- r.removeEventListener(wt, d), c = null;
157
- };
158
- },
159
- createHref(f) {
160
- return t(r, f);
161
- },
162
- createURL: _,
163
- encodeLocation(f) {
164
- let C = _(f);
165
- return {
166
- pathname: C.pathname,
167
- search: C.search,
168
- hash: C.hash
169
- };
170
- },
171
- push: v,
172
- replace: b,
173
- go(f) {
174
- return i.go(f);
175
- }
176
- };
177
- return m;
178
- }
179
- function Pa(e, t = !1) {
180
- let a = "http://localhost";
181
- typeof window < "u" && (a = window.location.origin !== "null" ? window.location.origin : window.location.href), I(a, "No window.location.(origin|href) available to create URL");
182
- let n = typeof e == "string" ? e : $e(e);
183
- return n = n.replace(/ $/, "%20"), !t && n.startsWith("//") && (n = a + n), new URL(n, a);
184
- }
185
- function Dt(e, t, a = "/") {
186
- return xa(e, t, a, !1);
187
- }
188
- function xa(e, t, a, n) {
189
- let r = typeof t == "string" ? ke(t) : t, o = ue(r.pathname || "/", a);
190
- if (o == null)
191
- return null;
192
- let i = Ft(e);
193
- $a(i);
194
- let l = null;
195
- for (let c = 0; l == null && c < i.length; ++c) {
196
- let u = Ha(o);
197
- l = Ma(
198
- i[c],
199
- u,
200
- n
201
- );
202
- }
203
- return l;
204
- }
205
- function Ft(e, t = [], a = [], n = "", r = !1) {
206
- let o = (i, l, c = r, u) => {
207
- let h = {
208
- relativePath: u === void 0 ? i.path || "" : u,
209
- caseSensitive: i.caseSensitive === !0,
210
- childrenIndex: l,
211
- route: i
212
- };
213
- if (h.relativePath.startsWith("/")) {
214
- if (!h.relativePath.startsWith(n) && c)
215
- return;
216
- I(
217
- h.relativePath.startsWith(n),
218
- `Absolute route path "${h.relativePath}" nested under path "${n}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`
219
- ), h.relativePath = h.relativePath.slice(n.length);
220
- }
221
- let d = re([n, h.relativePath]), v = a.concat(h);
222
- i.children && i.children.length > 0 && (I(
223
- // Our types know better, but runtime JS may not!
224
- // @ts-expect-error
225
- i.index !== !0,
226
- `Index routes must not have child routes. Please remove all child routes from route path "${d}".`
227
- ), Ft(
228
- i.children,
229
- t,
230
- v,
231
- d,
232
- c
233
- )), !(i.path == null && !i.index) && t.push({
234
- path: d,
235
- score: Ua(d, i.index),
236
- routesMeta: v
237
- });
238
- };
239
- return e.forEach((i, l) => {
240
- if (i.path === "" || !i.path?.includes("?"))
241
- o(i, l);
242
- else
243
- for (let c of Ut(i.path))
244
- o(i, l, !0, c);
245
- }), t;
246
- }
247
- function Ut(e) {
248
- let t = e.split("/");
249
- if (t.length === 0) return [];
250
- let [a, ...n] = t, r = a.endsWith("?"), o = a.replace(/\?$/, "");
251
- if (n.length === 0)
252
- return r ? [o, ""] : [o];
253
- let i = Ut(n.join("/")), l = [];
254
- return l.push(
255
- ...i.map(
256
- (c) => c === "" ? o : [o, c].join("/")
257
- )
258
- ), r && l.push(...i), l.map(
259
- (c) => e.startsWith("/") && c === "" ? "/" : c
260
- );
261
- }
262
- function $a(e) {
263
- e.sort(
264
- (t, a) => t.score !== a.score ? a.score - t.score : Ia(
265
- t.routesMeta.map((n) => n.childrenIndex),
266
- a.routesMeta.map((n) => n.childrenIndex)
267
- )
268
- );
269
- }
270
- var La = /^:[\w-]+$/, Ta = 3, Aa = 2, Oa = 1, Da = 10, Fa = -2, Rt = (e) => e === "*";
271
- function Ua(e, t) {
272
- let a = e.split("/"), n = a.length;
273
- return a.some(Rt) && (n += Fa), t && (n += Aa), a.filter((r) => !Rt(r)).reduce(
274
- (r, o) => r + (La.test(o) ? Ta : o === "" ? Oa : Da),
275
- n
276
- );
277
- }
278
- function Ia(e, t) {
279
- return e.length === t.length && e.slice(0, -1).every((n, r) => n === t[r]) ? (
280
- // If two routes are siblings, we should try to match the earlier sibling
281
- // first. This allows people to have fine-grained control over the matching
282
- // behavior by simply putting routes with identical paths in the order they
283
- // want them tried.
284
- e[e.length - 1] - t[t.length - 1]
285
- ) : (
286
- // Otherwise, it doesn't really make sense to rank non-siblings by index,
287
- // so they sort equally.
288
- 0
289
- );
290
- }
291
- function Ma(e, t, a = !1) {
292
- let { routesMeta: n } = e, r = {}, o = "/", i = [];
293
- for (let l = 0; l < n.length; ++l) {
294
- let c = n[l], u = l === n.length - 1, h = o === "/" ? t : t.slice(o.length) || "/", d = Be(
295
- { path: c.relativePath, caseSensitive: c.caseSensitive, end: u },
296
- h
297
- ), v = c.route;
298
- if (!d && u && a && !n[n.length - 1].route.index && (d = Be(
299
- {
300
- path: c.relativePath,
301
- caseSensitive: c.caseSensitive,
302
- end: !1
303
- },
304
- h
305
- )), !d)
306
- return null;
307
- Object.assign(r, d.params), i.push({
308
- // TODO: Can this as be avoided?
309
- params: r,
310
- pathname: re([o, d.pathname]),
311
- pathnameBase: Ka(
312
- re([o, d.pathnameBase])
313
- ),
314
- route: v
315
- }), d.pathnameBase !== "/" && (o = re([o, d.pathnameBase]));
316
- }
317
- return i;
318
- }
319
- function Be(e, t) {
320
- typeof e == "string" && (e = { path: e, caseSensitive: !1, end: !0 });
321
- let [a, n] = Ba(
322
- e.path,
323
- e.caseSensitive,
324
- e.end
325
- ), r = t.match(a);
326
- if (!r) return null;
327
- let o = r[0], i = o.replace(/(.)\/+$/, "$1"), l = r.slice(1);
328
- return {
329
- params: n.reduce(
330
- (u, { paramName: h, isOptional: d }, v) => {
331
- if (h === "*") {
332
- let _ = l[v] || "";
333
- i = o.slice(0, o.length - _.length).replace(/(.)\/+$/, "$1");
334
- }
335
- const b = l[v];
336
- return d && !b ? u[h] = void 0 : u[h] = (b || "").replace(/%2F/g, "/"), u;
337
- },
338
- {}
339
- ),
340
- pathname: o,
341
- pathnameBase: i,
342
- pattern: e
343
- };
344
- }
345
- function Ba(e, t = !1, a = !0) {
346
- X(
347
- e === "*" || !e.endsWith("*") || e.endsWith("/*"),
348
- `Route path "${e}" will be treated as if it were "${e.replace(/\*$/, "/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/, "/*")}".`
349
- );
350
- let n = [], r = "^" + e.replace(/\/*\*?$/, "").replace(/^\/*/, "/").replace(/[\\.*+^${}|()[\]]/g, "\\$&").replace(
351
- /\/:([\w-]+)(\?)?/g,
352
- (i, l, c, u, h) => {
353
- if (n.push({ paramName: l, isOptional: c != null }), c) {
354
- let d = h.charAt(u + i.length);
355
- return d && d !== "/" ? "/([^\\/]*)" : "(?:/([^\\/]*))?";
356
- }
357
- return "/([^\\/]+)";
358
- }
359
- ).replace(/\/([\w-]+)\?(\/|$)/g, "(/$1)?$2");
360
- return e.endsWith("*") ? (n.push({ paramName: "*" }), r += e === "*" || e === "/*" ? "(.*)$" : "(?:\\/(.+)|\\/*)$") : a ? r += "\\/*$" : e !== "" && e !== "/" && (r += "(?:(?=\\/|$))"), [new RegExp(r, t ? void 0 : "i"), n];
361
- }
362
- function Ha(e) {
363
- try {
364
- return e.split("/").map((t) => decodeURIComponent(t).replace(/\//g, "%2F")).join("/");
365
- } catch (t) {
366
- return X(
367
- !1,
368
- `The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`
369
- ), e;
370
- }
371
- }
372
- function ue(e, t) {
373
- if (t === "/") return e;
374
- if (!e.toLowerCase().startsWith(t.toLowerCase()))
375
- return null;
376
- let a = t.endsWith("/") ? t.length - 1 : t.length, n = e.charAt(a);
377
- return n && n !== "/" ? null : e.slice(a) || "/";
378
- }
379
- var Wa = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
380
- function Ja(e, t = "/") {
381
- let {
382
- pathname: a,
383
- search: n = "",
384
- hash: r = ""
385
- } = typeof e == "string" ? ke(e) : e, o;
386
- return a ? (a = It(a), a.startsWith("/") ? o = Nt(a.substring(1), "/") : o = Nt(a, t)) : o = t, {
387
- pathname: o,
388
- search: Va(n),
389
- hash: Ga(r)
390
- };
391
- }
392
- function Nt(e, t) {
393
- let a = He(t).split("/");
394
- return e.split("/").forEach((r) => {
395
- r === ".." ? a.length > 1 && a.pop() : r !== "." && a.push(r);
396
- }), a.length > 1 ? a.join("/") : "/";
397
- }
398
- function ze(e, t, a, n) {
399
- return `Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(
400
- n
401
- )}]. Please separate it out to the \`to.${a}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`;
402
- }
403
- function qa(e) {
404
- return e.filter(
405
- (t, a) => a === 0 || t.route.path && t.route.path.length > 0
406
- );
407
- }
408
- function ct(e) {
409
- let t = qa(e);
410
- return t.map(
411
- (a, n) => n === t.length - 1 ? a.pathname : a.pathnameBase
412
- );
413
- }
414
- function We(e, t, a, n = !1) {
415
- let r;
416
- typeof e == "string" ? r = ke(e) : (r = { ...e }, I(
417
- !r.pathname || !r.pathname.includes("?"),
418
- ze("?", "pathname", "search", r)
419
- ), I(
420
- !r.pathname || !r.pathname.includes("#"),
421
- ze("#", "pathname", "hash", r)
422
- ), I(
423
- !r.search || !r.search.includes("#"),
424
- ze("#", "search", "hash", r)
425
- ));
426
- let o = e === "" || r.pathname === "", i = o ? "/" : r.pathname, l;
427
- if (i == null)
428
- l = a;
429
- else {
430
- let d = t.length - 1;
431
- if (!n && i.startsWith("..")) {
432
- let v = i.split("/");
433
- for (; v[0] === ".."; )
434
- v.shift(), d -= 1;
435
- r.pathname = v.join("/");
436
- }
437
- l = d >= 0 ? t[d] : "/";
438
- }
439
- let c = Ja(r, l), u = i && i !== "/" && i.endsWith("/"), h = (o || i === ".") && a.endsWith("/");
440
- return !c.pathname.endsWith("/") && (u || h) && (c.pathname += "/"), c;
441
- }
442
- var It = (e) => e.replace(/\/\/+/g, "/"), re = (e) => It(e.join("/")), He = (e) => e.replace(/\/+$/, ""), Ka = (e) => He(e).replace(/^\/*/, "/"), Va = (e) => !e || e === "?" ? "" : e.startsWith("?") ? e : "?" + e, Ga = (e) => !e || e === "#" ? "" : e.startsWith("#") ? e : "#" + e, za = class {
443
- constructor(e, t, a, n = !1) {
444
- this.status = e, this.statusText = t || "", this.internal = n, a instanceof Error ? (this.data = a.toString(), this.error = a) : this.data = a;
445
- }
446
- };
447
- function Ya(e) {
448
- return e != null && typeof e.status == "number" && typeof e.statusText == "string" && typeof e.internal == "boolean" && "data" in e;
449
- }
450
- function Qa(e) {
451
- let t = e.map((a) => a.route.path).filter(Boolean);
452
- return re(t) || "/";
453
- }
454
- var Mt = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u";
455
- function Bt(e, t) {
456
- let a = e;
457
- if (typeof a != "string" || !Wa.test(a))
458
- return {
459
- absoluteURL: void 0,
460
- isExternal: !1,
461
- to: a
462
- };
463
- let n = a, r = !1;
464
- if (Mt)
465
- try {
466
- let o = new URL(window.location.href), i = a.startsWith("//") ? new URL(o.protocol + a) : new URL(a), l = ue(i.pathname, t);
467
- i.origin === o.origin && l != null ? a = l + i.search + i.hash : r = !0;
468
- } catch {
469
- X(
470
- !1,
471
- `<Link to="${a}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`
472
- );
473
- }
474
- return {
475
- absoluteURL: n,
476
- isExternal: r,
477
- to: a
478
- };
479
- }
480
- Object.getOwnPropertyNames(Object.prototype).sort().join("\0");
481
- var Ht = [
482
- "POST",
483
- "PUT",
484
- "PATCH",
485
- "DELETE"
486
- ];
487
- new Set(
488
- Ht
489
- );
490
- var Xa = [
491
- "GET",
492
- ...Ht
493
- ];
494
- new Set(Xa);
495
- var Ee = p.createContext(null);
496
- Ee.displayName = "DataRouter";
497
- var Je = p.createContext(null);
498
- Je.displayName = "DataRouterState";
499
- var Wt = p.createContext(!1);
500
- function Za() {
501
- return p.useContext(Wt);
502
- }
503
- var Jt = p.createContext({
504
- isTransitioning: !1
505
- });
506
- Jt.displayName = "ViewTransition";
507
- var en = p.createContext(
508
- /* @__PURE__ */ new Map()
509
- );
510
- en.displayName = "Fetchers";
511
- var tn = p.createContext(null);
512
- tn.displayName = "Await";
513
- var Z = p.createContext(
514
- null
515
- );
516
- Z.displayName = "Navigation";
517
- var Ae = p.createContext(
518
- null
519
- );
520
- Ae.displayName = "Location";
521
- var ae = p.createContext({
522
- outlet: null,
523
- matches: [],
524
- isDataRoute: !1
525
- });
526
- ae.displayName = "Route";
527
- var ut = p.createContext(null);
528
- ut.displayName = "RouteError";
529
- var qt = "REACT_ROUTER_ERROR", an = "REDIRECT", nn = "ROUTE_ERROR_RESPONSE";
530
- function rn(e) {
531
- if (e.startsWith(`${qt}:${an}:{`))
532
- try {
533
- let t = JSON.parse(e.slice(28));
534
- if (typeof t == "object" && t && typeof t.status == "number" && typeof t.statusText == "string" && typeof t.location == "string" && typeof t.reloadDocument == "boolean" && typeof t.replace == "boolean")
535
- return t;
536
- } catch {
537
- }
538
- }
539
- function on(e) {
540
- if (e.startsWith(
541
- `${qt}:${nn}:{`
542
- ))
543
- try {
544
- let t = JSON.parse(e.slice(40));
545
- if (typeof t == "object" && t && typeof t.status == "number" && typeof t.statusText == "string")
546
- return new za(
547
- t.status,
548
- t.statusText,
549
- t.data
550
- );
551
- } catch {
552
- }
553
- }
554
- function sn(e, { relative: t } = {}) {
555
- I(
556
- Se(),
557
- // TODO: This error is probably because they somehow have 2 versions of the
558
- // router loaded. We can help them understand how to avoid that.
559
- "useHref() may be used only in the context of a <Router> component."
560
- );
561
- let { basename: a, navigator: n } = p.useContext(Z), { hash: r, pathname: o, search: i } = Oe(e, { relative: t }), l = o;
562
- return a !== "/" && (l = o === "/" ? a : re([a, o])), n.createHref({ pathname: l, search: i, hash: r });
563
- }
564
- function Se() {
565
- return p.useContext(Ae) != null;
566
- }
567
- function ee() {
568
- return I(
569
- Se(),
570
- // TODO: This error is probably because they somehow have 2 versions of the
571
- // router loaded. We can help them understand how to avoid that.
572
- "useLocation() may be used only in the context of a <Router> component."
573
- ), p.useContext(Ae).location;
574
- }
575
- var Kt = "You should call navigate() in a React.useEffect(), not when your component is first rendered.";
576
- function Vt(e) {
577
- p.useContext(Z).static || p.useLayoutEffect(e);
578
- }
579
- function ye() {
580
- let { isDataRoute: e } = p.useContext(ae);
581
- return e ? kn() : ln();
582
- }
583
- function ln() {
584
- I(
585
- Se(),
586
- // TODO: This error is probably because they somehow have 2 versions of the
587
- // router loaded. We can help them understand how to avoid that.
588
- "useNavigate() may be used only in the context of a <Router> component."
589
- );
590
- let e = p.useContext(Ee), { basename: t, navigator: a } = p.useContext(Z), { matches: n } = p.useContext(ae), { pathname: r } = ee(), o = JSON.stringify(ct(n)), i = p.useRef(!1);
591
- return Vt(() => {
592
- i.current = !0;
593
- }), p.useCallback(
594
- (c, u = {}) => {
595
- if (X(i.current, Kt), !i.current) return;
596
- if (typeof c == "number") {
597
- a.go(c);
598
- return;
599
- }
600
- let h = We(
601
- c,
602
- JSON.parse(o),
603
- r,
604
- u.relative === "path"
605
- );
606
- e == null && t !== "/" && (h.pathname = h.pathname === "/" ? t : re([t, h.pathname])), (u.replace ? a.replace : a.push)(
607
- h,
608
- u.state,
609
- u
610
- );
611
- },
612
- [
613
- t,
614
- a,
615
- o,
616
- r,
617
- e
618
- ]
619
- );
620
- }
621
- var Gt = p.createContext(null);
622
- function cn() {
623
- return p.useContext(Gt);
624
- }
625
- function un(e) {
626
- let t = p.useContext(ae).outlet;
627
- return p.useMemo(
628
- () => t && /* @__PURE__ */ p.createElement(Gt.Provider, { value: e }, t),
629
- [t, e]
630
- );
631
- }
632
- function zt() {
633
- let { matches: e } = p.useContext(ae), t = e[e.length - 1];
634
- return t ? t.params : {};
635
- }
636
- function Oe(e, { relative: t } = {}) {
637
- let { matches: a } = p.useContext(ae), { pathname: n } = ee(), r = JSON.stringify(ct(a));
638
- return p.useMemo(
639
- () => We(
640
- e,
641
- JSON.parse(r),
642
- n,
643
- t === "path"
644
- ),
645
- [e, r, n, t]
646
- );
647
- }
648
- function dn(e, t) {
649
- return Yt(e, t);
650
- }
651
- function Yt(e, t, a) {
652
- I(
653
- Se(),
654
- // TODO: This error is probably because they somehow have 2 versions of the
655
- // router loaded. We can help them understand how to avoid that.
656
- "useRoutes() may be used only in the context of a <Router> component."
657
- );
658
- let { navigator: n } = p.useContext(Z), { matches: r } = p.useContext(ae), o = r[r.length - 1], i = o ? o.params : {}, l = o ? o.pathname : "/", c = o ? o.pathnameBase : "/", u = o && o.route;
659
- {
660
- let f = u && u.path || "";
661
- Xt(
662
- l,
663
- !u || f.endsWith("*") || f.endsWith("*?"),
664
- `You rendered descendant <Routes> (or called \`useRoutes()\`) at "${l}" (under <Route path="${f}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
665
-
666
- Please change the parent <Route path="${f}"> to <Route path="${f === "/" ? "*" : `${f}/*`}">.`
667
- );
668
- }
669
- let h = ee(), d;
670
- if (t) {
671
- let f = typeof t == "string" ? ke(t) : t;
672
- I(
673
- c === "/" || f.pathname?.startsWith(c),
674
- `When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${f.pathname}" was given in the \`location\` prop.`
675
- ), d = f;
676
- } else
677
- d = h;
678
- let v = d.pathname || "/", b = v;
679
- if (c !== "/") {
680
- let f = c.replace(/^\//, "").split("/");
681
- b = "/" + v.replace(/^\//, "").split("/").slice(f.length).join("/");
682
- }
683
- let _ = Dt(e, { pathname: b });
684
- X(
685
- u || _ != null,
686
- `No routes matched location "${d.pathname}${d.search}${d.hash}" `
687
- ), X(
688
- _ == null || _[_.length - 1].route.element !== void 0 || _[_.length - 1].route.Component !== void 0 || _[_.length - 1].route.lazy !== void 0,
689
- `Matched leaf route at location "${d.pathname}${d.search}${d.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`
690
- );
691
- let m = yn(
692
- _ && _.map(
693
- (f) => Object.assign({}, f, {
694
- params: Object.assign({}, i, f.params),
695
- pathname: re([
696
- c,
697
- // Re-encode pathnames that were decoded inside matchRoutes.
698
- // Pre-encode `%`, `?` and `#` ahead of `encodeLocation` because it uses
699
- // `new URL()` internally and we need to prevent it from treating
700
- // them as separators
701
- n.encodeLocation ? n.encodeLocation(
702
- f.pathname.replace(/%/g, "%25").replace(/\?/g, "%3F").replace(/#/g, "%23")
703
- ).pathname : f.pathname
704
- ]),
705
- pathnameBase: f.pathnameBase === "/" ? c : re([
706
- c,
707
- // Re-encode pathnames that were decoded inside matchRoutes
708
- // Pre-encode `%`, `?` and `#` ahead of `encodeLocation` because it uses
709
- // `new URL()` internally and we need to prevent it from treating
710
- // them as separators
711
- n.encodeLocation ? n.encodeLocation(
712
- f.pathnameBase.replace(/%/g, "%25").replace(/\?/g, "%3F").replace(/#/g, "%23")
713
- ).pathname : f.pathnameBase
714
- ])
715
- })
716
- ),
717
- r,
718
- a
719
- );
720
- return t && m ? /* @__PURE__ */ p.createElement(
721
- Ae.Provider,
722
- {
723
- value: {
724
- location: {
725
- pathname: "/",
726
- search: "",
727
- hash: "",
728
- state: null,
729
- key: "default",
730
- unstable_mask: void 0,
731
- ...d
732
- },
733
- navigationType: "POP"
734
- /* Pop */
735
- }
736
- },
737
- m
738
- ) : m;
739
- }
740
- function pn() {
741
- let e = _n(), t = Ya(e) ? `${e.status} ${e.statusText}` : e instanceof Error ? e.message : JSON.stringify(e), a = e instanceof Error ? e.stack : null, n = "rgba(200,200,200, 0.5)", r = { padding: "0.5rem", backgroundColor: n }, o = { padding: "2px 4px", backgroundColor: n }, i = null;
742
- return console.error(
743
- "Error handled by React Router default ErrorBoundary:",
744
- e
745
- ), i = /* @__PURE__ */ p.createElement(p.Fragment, null, /* @__PURE__ */ p.createElement("p", null, "💿 Hey developer 👋"), /* @__PURE__ */ p.createElement("p", null, "You can provide a way better UX than this when your app throws errors by providing your own ", /* @__PURE__ */ p.createElement("code", { style: o }, "ErrorBoundary"), " or", " ", /* @__PURE__ */ p.createElement("code", { style: o }, "errorElement"), " prop on your route.")), /* @__PURE__ */ p.createElement(p.Fragment, null, /* @__PURE__ */ p.createElement("h2", null, "Unexpected Application Error!"), /* @__PURE__ */ p.createElement("h3", { style: { fontStyle: "italic" } }, t), a ? /* @__PURE__ */ p.createElement("pre", { style: r }, a) : null, i);
746
- }
747
- var hn = /* @__PURE__ */ p.createElement(pn, null), Qt = class extends p.Component {
748
- constructor(e) {
749
- super(e), this.state = {
750
- location: e.location,
751
- revalidation: e.revalidation,
752
- error: e.error
753
- };
754
- }
755
- static getDerivedStateFromError(e) {
756
- return { error: e };
757
- }
758
- static getDerivedStateFromProps(e, t) {
759
- return t.location !== e.location || t.revalidation !== "idle" && e.revalidation === "idle" ? {
760
- error: e.error,
761
- location: e.location,
762
- revalidation: e.revalidation
763
- } : {
764
- error: e.error !== void 0 ? e.error : t.error,
765
- location: t.location,
766
- revalidation: e.revalidation || t.revalidation
767
- };
768
- }
769
- componentDidCatch(e, t) {
770
- this.props.onError ? this.props.onError(e, t) : console.error(
771
- "React Router caught the following error during render",
772
- e
773
- );
774
- }
775
- render() {
776
- let e = this.state.error;
777
- if (this.context && typeof e == "object" && e && "digest" in e && typeof e.digest == "string") {
778
- const a = on(e.digest);
779
- a && (e = a);
780
- }
781
- let t = e !== void 0 ? /* @__PURE__ */ p.createElement(ae.Provider, { value: this.props.routeContext }, /* @__PURE__ */ p.createElement(
782
- ut.Provider,
783
- {
784
- value: e,
785
- children: this.props.component
786
- }
787
- )) : this.props.children;
788
- return this.context ? /* @__PURE__ */ p.createElement(fn, { error: e }, t) : t;
789
- }
790
- };
791
- Qt.contextType = Wt;
792
- var Ye = /* @__PURE__ */ new WeakMap();
793
- function fn({
794
- children: e,
795
- error: t
796
- }) {
797
- let { basename: a } = p.useContext(Z);
798
- if (typeof t == "object" && t && "digest" in t && typeof t.digest == "string") {
799
- let n = rn(t.digest);
800
- if (n) {
801
- let r = Ye.get(t);
802
- if (r) throw r;
803
- let o = Bt(n.location, a);
804
- if (Mt && !Ye.get(t))
805
- if (o.isExternal || n.reloadDocument)
806
- window.location.href = o.absoluteURL || o.to;
807
- else {
808
- const i = Promise.resolve().then(
809
- () => window.__reactRouterDataRouter.navigate(o.to, {
810
- replace: n.replace
811
- })
812
- );
813
- throw Ye.set(t, i), i;
814
- }
815
- return /* @__PURE__ */ p.createElement(
816
- "meta",
817
- {
818
- httpEquiv: "refresh",
819
- content: `0;url=${o.absoluteURL || o.to}`
820
- }
821
- );
822
- }
823
- }
824
- return e;
825
- }
826
- function mn({ routeContext: e, match: t, children: a }) {
827
- let n = p.useContext(Ee);
828
- return n && n.static && n.staticContext && (t.route.errorElement || t.route.ErrorBoundary) && (n.staticContext._deepestRenderedBoundaryId = t.route.id), /* @__PURE__ */ p.createElement(ae.Provider, { value: e }, a);
829
- }
830
- function yn(e, t = [], a) {
831
- let n = a?.state;
832
- if (e == null) {
833
- if (!n)
834
- return null;
835
- if (n.errors)
836
- e = n.matches;
837
- else if (t.length === 0 && !n.initialized && n.matches.length > 0)
838
- e = n.matches;
839
- else
840
- return null;
841
- }
842
- let r = e, o = n?.errors;
843
- if (o != null) {
844
- let h = r.findIndex(
845
- (d) => d.route.id && o?.[d.route.id] !== void 0
846
- );
847
- I(
848
- h >= 0,
849
- `Could not find a matching route for errors on route IDs: ${Object.keys(
850
- o
851
- ).join(",")}`
852
- ), r = r.slice(
853
- 0,
854
- Math.min(r.length, h + 1)
855
- );
856
- }
857
- let i = !1, l = -1;
858
- if (a && n) {
859
- i = n.renderFallback;
860
- for (let h = 0; h < r.length; h++) {
861
- let d = r[h];
862
- if ((d.route.HydrateFallback || d.route.hydrateFallbackElement) && (l = h), d.route.id) {
863
- let { loaderData: v, errors: b } = n, _ = d.route.loader && !v.hasOwnProperty(d.route.id) && (!b || b[d.route.id] === void 0);
864
- if (d.route.lazy || _) {
865
- a.isStatic && (i = !0), l >= 0 ? r = r.slice(0, l + 1) : r = [r[0]];
866
- break;
867
- }
868
- }
869
- }
870
- }
871
- let c = a?.onError, u = n && c ? (h, d) => {
872
- c(h, {
873
- location: n.location,
874
- params: n.matches?.[0]?.params ?? {},
875
- unstable_pattern: Qa(n.matches),
876
- errorInfo: d
877
- });
878
- } : void 0;
879
- return r.reduceRight(
880
- (h, d, v) => {
881
- let b, _ = !1, m = null, f = null;
882
- n && (b = o && d.route.id ? o[d.route.id] : void 0, m = d.route.errorElement || hn, i && (l < 0 && v === 0 ? (Xt(
883
- "route-fallback",
884
- !1,
885
- "No `HydrateFallback` element provided to render during initial hydration"
886
- ), _ = !0, f = null) : l === v && (_ = !0, f = d.route.hydrateFallbackElement || null)));
887
- let C = t.concat(r.slice(0, v + 1)), w = () => {
888
- let R;
889
- return b ? R = m : _ ? R = f : d.route.Component ? R = /* @__PURE__ */ p.createElement(d.route.Component, null) : d.route.element ? R = d.route.element : R = h, /* @__PURE__ */ p.createElement(
890
- mn,
891
- {
892
- match: d,
893
- routeContext: {
894
- outlet: h,
895
- matches: C,
896
- isDataRoute: n != null
897
- },
898
- children: R
899
- }
900
- );
901
- };
902
- return n && (d.route.ErrorBoundary || d.route.errorElement || v === 0) ? /* @__PURE__ */ p.createElement(
903
- Qt,
904
- {
905
- location: n.location,
906
- revalidation: n.revalidation,
907
- component: m,
908
- error: b,
909
- children: w(),
910
- routeContext: { outlet: null, matches: C, isDataRoute: !0 },
911
- onError: u
912
- }
913
- ) : w();
914
- },
915
- null
916
- );
917
- }
918
- function dt(e) {
919
- return `${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
920
- }
921
- function gn(e) {
922
- let t = p.useContext(Ee);
923
- return I(t, dt(e)), t;
924
- }
925
- function vn(e) {
926
- let t = p.useContext(Je);
927
- return I(t, dt(e)), t;
928
- }
929
- function bn(e) {
930
- let t = p.useContext(ae);
931
- return I(t, dt(e)), t;
932
- }
933
- function pt(e) {
934
- let t = bn(e), a = t.matches[t.matches.length - 1];
935
- return I(
936
- a.route.id,
937
- `${e} can only be used on routes that contain a unique "id"`
938
- ), a.route.id;
939
- }
940
- function wn() {
941
- return pt(
942
- "useRouteId"
943
- /* UseRouteId */
944
- );
945
- }
946
- function _n() {
947
- let e = p.useContext(ut), t = vn(
948
- "useRouteError"
949
- /* UseRouteError */
950
- ), a = pt(
951
- "useRouteError"
952
- /* UseRouteError */
953
- );
954
- return e !== void 0 ? e : t.errors?.[a];
955
- }
956
- function kn() {
957
- let { router: e } = gn(
958
- "useNavigate"
959
- /* UseNavigateStable */
960
- ), t = pt(
961
- "useNavigate"
962
- /* UseNavigateStable */
963
- ), a = p.useRef(!1);
964
- return Vt(() => {
965
- a.current = !0;
966
- }), p.useCallback(
967
- async (r, o = {}) => {
968
- X(a.current, Kt), a.current && (typeof r == "number" ? await e.navigate(r) : await e.navigate(r, { fromRouteId: t, ...o }));
969
- },
970
- [e, t]
971
- );
972
- }
973
- var jt = {};
974
- function Xt(e, t, a) {
975
- !t && !jt[e] && (jt[e] = !0, X(!1, a));
976
- }
977
- p.memo(Rn);
978
- function Rn({
979
- routes: e,
980
- future: t,
981
- state: a,
982
- isStatic: n,
983
- onError: r
984
- }) {
985
- return Yt(e, void 0, { state: a, isStatic: n, onError: r });
986
- }
987
- function Zt({
988
- to: e,
989
- replace: t,
990
- state: a,
991
- relative: n
992
- }) {
993
- I(
994
- Se(),
995
- // TODO: This error is probably because they somehow have 2 versions of
996
- // the router loaded. We can help them understand how to avoid that.
997
- "<Navigate> may be used only in the context of a <Router> component."
998
- );
999
- let { static: r } = p.useContext(Z);
1000
- X(
1001
- !r,
1002
- "<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change."
1003
- );
1004
- let { matches: o } = p.useContext(ae), { pathname: i } = ee(), l = ye(), c = We(
1005
- e,
1006
- ct(o),
1007
- i,
1008
- n === "path"
1009
- ), u = JSON.stringify(c);
1010
- return p.useEffect(() => {
1011
- l(JSON.parse(u), { replace: t, state: a, relative: n });
1012
- }, [l, u, n, t, a]), null;
1013
- }
1014
- function ea(e) {
1015
- return un(e.context);
1016
- }
1017
- function Y(e) {
1018
- I(
1019
- !1,
1020
- "A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>."
1021
- );
1022
- }
1023
- function Nn({
1024
- basename: e = "/",
1025
- children: t = null,
1026
- location: a,
1027
- navigationType: n = "POP",
1028
- navigator: r,
1029
- static: o = !1,
1030
- unstable_useTransitions: i
1031
- }) {
1032
- I(
1033
- !Se(),
1034
- "You cannot render a <Router> inside another <Router>. You should never have more than one in your app."
1035
- );
1036
- let l = e.replace(/^\/*/, "/"), c = p.useMemo(
1037
- () => ({
1038
- basename: l,
1039
- navigator: r,
1040
- static: o,
1041
- unstable_useTransitions: i,
1042
- future: {}
1043
- }),
1044
- [l, r, o, i]
1045
- );
1046
- typeof a == "string" && (a = ke(a));
1047
- let {
1048
- pathname: u = "/",
1049
- search: h = "",
1050
- hash: d = "",
1051
- state: v = null,
1052
- key: b = "default",
1053
- unstable_mask: _
1054
- } = a, m = p.useMemo(() => {
1055
- let f = ue(u, l);
1056
- return f == null ? null : {
1057
- location: {
1058
- pathname: f,
1059
- search: h,
1060
- hash: d,
1061
- state: v,
1062
- key: b,
1063
- unstable_mask: _
1064
- },
1065
- navigationType: n
1066
- };
1067
- }, [
1068
- l,
1069
- u,
1070
- h,
1071
- d,
1072
- v,
1073
- b,
1074
- n,
1075
- _
1076
- ]);
1077
- return X(
1078
- m != null,
1079
- `<Router basename="${l}"> is not able to match the URL "${u}${h}${d}" because it does not start with the basename, so the <Router> won't render anything.`
1080
- ), m == null ? null : /* @__PURE__ */ p.createElement(Z.Provider, { value: c }, /* @__PURE__ */ p.createElement(Ae.Provider, { children: t, value: m }));
1081
- }
1082
- function jn({
1083
- children: e,
1084
- location: t
1085
- }) {
1086
- return dn(nt(e), t);
1087
- }
1088
- function nt(e, t = []) {
1089
- let a = [];
1090
- return p.Children.forEach(e, (n, r) => {
1091
- if (!p.isValidElement(n))
1092
- return;
1093
- let o = [...t, r];
1094
- if (n.type === p.Fragment) {
1095
- a.push.apply(
1096
- a,
1097
- nt(n.props.children, o)
1098
- );
1099
- return;
1100
- }
1101
- I(
1102
- n.type === Y,
1103
- `[${typeof n.type == "string" ? n.type : n.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`
1104
- ), I(
1105
- !n.props.index || !n.props.children,
1106
- "An index route cannot have child routes."
1107
- );
1108
- let i = {
1109
- id: n.props.id || o.join("-"),
1110
- caseSensitive: n.props.caseSensitive,
1111
- element: n.props.element,
1112
- Component: n.props.Component,
1113
- index: n.props.index,
1114
- path: n.props.path,
1115
- middleware: n.props.middleware,
1116
- loader: n.props.loader,
1117
- action: n.props.action,
1118
- hydrateFallbackElement: n.props.hydrateFallbackElement,
1119
- HydrateFallback: n.props.HydrateFallback,
1120
- errorElement: n.props.errorElement,
1121
- ErrorBoundary: n.props.ErrorBoundary,
1122
- hasErrorBoundary: n.props.hasErrorBoundary === !0 || n.props.ErrorBoundary != null || n.props.errorElement != null,
1123
- shouldRevalidate: n.props.shouldRevalidate,
1124
- handle: n.props.handle,
1125
- lazy: n.props.lazy
1126
- };
1127
- n.props.children && (i.children = nt(
1128
- n.props.children,
1129
- o
1130
- )), a.push(i);
1131
- }), a;
1132
- }
1133
- var Ue = "get", Ie = "application/x-www-form-urlencoded";
1134
- function qe(e) {
1135
- return typeof HTMLElement < "u" && e instanceof HTMLElement;
1136
- }
1137
- function Cn(e) {
1138
- return qe(e) && e.tagName.toLowerCase() === "button";
1139
- }
1140
- function En(e) {
1141
- return qe(e) && e.tagName.toLowerCase() === "form";
1142
- }
1143
- function Sn(e) {
1144
- return qe(e) && e.tagName.toLowerCase() === "input";
1145
- }
1146
- function Pn(e) {
1147
- return !!(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey);
1148
- }
1149
- function xn(e, t) {
1150
- return e.button === 0 && // Ignore everything but left clicks
1151
- (!t || t === "_self") && // Let browser handle "target=_blank" etc.
1152
- !Pn(e);
1153
- }
1154
- function rt(e = "") {
1155
- return new URLSearchParams(
1156
- typeof e == "string" || Array.isArray(e) || e instanceof URLSearchParams ? e : Object.keys(e).reduce((t, a) => {
1157
- let n = e[a];
1158
- return t.concat(
1159
- Array.isArray(n) ? n.map((r) => [a, r]) : [[a, n]]
1160
- );
1161
- }, [])
1162
- );
1163
- }
1164
- function $n(e, t) {
1165
- let a = rt(e);
1166
- return t && t.forEach((n, r) => {
1167
- a.has(r) || t.getAll(r).forEach((o) => {
1168
- a.append(r, o);
1169
- });
1170
- }), a;
1171
- }
1172
- var De = null;
1173
- function Ln() {
1174
- if (De === null)
1175
- try {
1176
- new FormData(
1177
- document.createElement("form"),
1178
- // @ts-expect-error if FormData supports the submitter parameter, this will throw
1179
- 0
1180
- ), De = !1;
1181
- } catch {
1182
- De = !0;
1183
- }
1184
- return De;
1185
- }
1186
- var Tn = /* @__PURE__ */ new Set([
1187
- "application/x-www-form-urlencoded",
1188
- "multipart/form-data",
1189
- "text/plain"
1190
- ]);
1191
- function Qe(e) {
1192
- return e != null && !Tn.has(e) ? (X(
1193
- !1,
1194
- `"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Ie}"`
1195
- ), null) : e;
1196
- }
1197
- function An(e, t) {
1198
- let a, n, r, o, i;
1199
- if (En(e)) {
1200
- let l = e.getAttribute("action");
1201
- n = l ? ue(l, t) : null, a = e.getAttribute("method") || Ue, r = Qe(e.getAttribute("enctype")) || Ie, o = new FormData(e);
1202
- } else if (Cn(e) || Sn(e) && (e.type === "submit" || e.type === "image")) {
1203
- let l = e.form;
1204
- if (l == null)
1205
- throw new Error(
1206
- 'Cannot submit a <button> or <input type="submit"> without a <form>'
1207
- );
1208
- let c = e.getAttribute("formaction") || l.getAttribute("action");
1209
- if (n = c ? ue(c, t) : null, a = e.getAttribute("formmethod") || l.getAttribute("method") || Ue, r = Qe(e.getAttribute("formenctype")) || Qe(l.getAttribute("enctype")) || Ie, o = new FormData(l, e), !Ln()) {
1210
- let { name: u, type: h, value: d } = e;
1211
- if (h === "image") {
1212
- let v = u ? `${u}.` : "";
1213
- o.append(`${v}x`, "0"), o.append(`${v}y`, "0");
1214
- } else u && o.append(u, d);
1215
- }
1216
- } else {
1217
- if (qe(e))
1218
- throw new Error(
1219
- 'Cannot submit element that is not <form>, <button>, or <input type="submit|image">'
1220
- );
1221
- a = Ue, n = null, r = Ie, i = e;
1222
- }
1223
- return o && r === "text/plain" && (i = o, o = void 0), { action: n, method: a.toLowerCase(), encType: r, formData: o, body: i };
1224
- }
1225
- Object.getOwnPropertyNames(Object.prototype).sort().join("\0");
1226
- function ht(e, t) {
1227
- if (e === !1 || e === null || typeof e > "u")
1228
- throw new Error(t);
1229
- }
1230
- function ta(e, t, a, n) {
1231
- let r = typeof e == "string" ? new URL(
1232
- e,
1233
- // This can be called during the SSR flow via PrefetchPageLinksImpl so
1234
- // don't assume window is available
1235
- typeof window > "u" ? "server://singlefetch/" : window.location.origin
1236
- ) : e;
1237
- return a ? r.pathname.endsWith("/") ? r.pathname = `${r.pathname}_.${n}` : r.pathname = `${r.pathname}.${n}` : r.pathname === "/" ? r.pathname = `_root.${n}` : t && ue(r.pathname, t) === "/" ? r.pathname = `${He(t)}/_root.${n}` : r.pathname = `${He(r.pathname)}.${n}`, r;
1238
- }
1239
- async function On(e, t) {
1240
- if (e.id in t)
1241
- return t[e.id];
1242
- try {
1243
- let a = await import(
1244
- /* @vite-ignore */
1245
- /* webpackIgnore: true */
1246
- e.module
1247
- );
1248
- return t[e.id] = a, a;
1249
- } catch (a) {
1250
- return console.error(
1251
- `Error loading route module \`${e.module}\`, reloading page...`
1252
- ), console.error(a), window.__reactRouterContext && window.__reactRouterContext.isSpaMode, window.location.reload(), new Promise(() => {
1253
- });
1254
- }
1255
- }
1256
- function Dn(e) {
1257
- return e == null ? !1 : e.href == null ? e.rel === "preload" && typeof e.imageSrcSet == "string" && typeof e.imageSizes == "string" : typeof e.rel == "string" && typeof e.href == "string";
1258
- }
1259
- async function Fn(e, t, a) {
1260
- let n = await Promise.all(
1261
- e.map(async (r) => {
1262
- let o = t.routes[r.route.id];
1263
- if (o) {
1264
- let i = await On(o, a);
1265
- return i.links ? i.links() : [];
1266
- }
1267
- return [];
1268
- })
1269
- );
1270
- return Bn(
1271
- n.flat(1).filter(Dn).filter((r) => r.rel === "stylesheet" || r.rel === "preload").map(
1272
- (r) => r.rel === "stylesheet" ? { ...r, rel: "prefetch", as: "style" } : { ...r, rel: "prefetch" }
1273
- )
1274
- );
1275
- }
1276
- function Ct(e, t, a, n, r, o) {
1277
- let i = (c, u) => a[u] ? c.route.id !== a[u].route.id : !0, l = (c, u) => (
1278
- // param change, /users/123 -> /users/456
1279
- a[u].pathname !== c.pathname || // splat param changed, which is not present in match.path
1280
- // e.g. /files/images/avatar.jpg -> files/finances.xls
1281
- a[u].route.path?.endsWith("*") && a[u].params["*"] !== c.params["*"]
1282
- );
1283
- return o === "assets" ? t.filter(
1284
- (c, u) => i(c, u) || l(c, u)
1285
- ) : o === "data" ? t.filter((c, u) => {
1286
- let h = n.routes[c.route.id];
1287
- if (!h || !h.hasLoader)
1288
- return !1;
1289
- if (i(c, u) || l(c, u))
1290
- return !0;
1291
- if (c.route.shouldRevalidate) {
1292
- let d = c.route.shouldRevalidate({
1293
- currentUrl: new URL(
1294
- r.pathname + r.search + r.hash,
1295
- window.origin
1296
- ),
1297
- currentParams: a[0]?.params || {},
1298
- nextUrl: new URL(e, window.origin),
1299
- nextParams: c.params,
1300
- defaultShouldRevalidate: !0
1301
- });
1302
- if (typeof d == "boolean")
1303
- return d;
1304
- }
1305
- return !0;
1306
- }) : [];
1307
- }
1308
- function Un(e, t, { includeHydrateFallback: a } = {}) {
1309
- return In(
1310
- e.map((n) => {
1311
- let r = t.routes[n.route.id];
1312
- if (!r) return [];
1313
- let o = [r.module];
1314
- return r.clientActionModule && (o = o.concat(r.clientActionModule)), r.clientLoaderModule && (o = o.concat(r.clientLoaderModule)), a && r.hydrateFallbackModule && (o = o.concat(r.hydrateFallbackModule)), r.imports && (o = o.concat(r.imports)), o;
1315
- }).flat(1)
1316
- );
1317
- }
1318
- function In(e) {
1319
- return [...new Set(e)];
1320
- }
1321
- function Mn(e) {
1322
- let t = {}, a = Object.keys(e).sort();
1323
- for (let n of a)
1324
- t[n] = e[n];
1325
- return t;
1326
- }
1327
- function Bn(e, t) {
1328
- let a = /* @__PURE__ */ new Set();
1329
- return new Set(t), e.reduce((n, r) => {
1330
- let o = JSON.stringify(Mn(r));
1331
- return a.has(o) || (a.add(o), n.push({ key: o, link: r })), n;
1332
- }, []);
1333
- }
1334
- function ft() {
1335
- let e = p.useContext(Ee);
1336
- return ht(
1337
- e,
1338
- "You must render this element inside a <DataRouterContext.Provider> element"
1339
- ), e;
1340
- }
1341
- function Hn() {
1342
- let e = p.useContext(Je);
1343
- return ht(
1344
- e,
1345
- "You must render this element inside a <DataRouterStateContext.Provider> element"
1346
- ), e;
1347
- }
1348
- var mt = p.createContext(void 0);
1349
- mt.displayName = "FrameworkContext";
1350
- function yt() {
1351
- let e = p.useContext(mt);
1352
- return ht(
1353
- e,
1354
- "You must render this element inside a <HydratedRouter> element"
1355
- ), e;
1356
- }
1357
- function Wn(e, t) {
1358
- let a = p.useContext(mt), [n, r] = p.useState(!1), [o, i] = p.useState(!1), { onFocus: l, onBlur: c, onMouseEnter: u, onMouseLeave: h, onTouchStart: d } = t, v = p.useRef(null);
1359
- p.useEffect(() => {
1360
- if (e === "render" && i(!0), e === "viewport") {
1361
- let m = (C) => {
1362
- C.forEach((w) => {
1363
- i(w.isIntersecting);
1364
- });
1365
- }, f = new IntersectionObserver(m, { threshold: 0.5 });
1366
- return v.current && f.observe(v.current), () => {
1367
- f.disconnect();
1368
- };
1369
- }
1370
- }, [e]), p.useEffect(() => {
1371
- if (n) {
1372
- let m = setTimeout(() => {
1373
- i(!0);
1374
- }, 100);
1375
- return () => {
1376
- clearTimeout(m);
1377
- };
1378
- }
1379
- }, [n]);
1380
- let b = () => {
1381
- r(!0);
1382
- }, _ = () => {
1383
- r(!1), i(!1);
1384
- };
1385
- return a ? e !== "intent" ? [o, v, {}] : [
1386
- o,
1387
- v,
1388
- {
1389
- onFocus: xe(l, b),
1390
- onBlur: xe(c, _),
1391
- onMouseEnter: xe(u, b),
1392
- onMouseLeave: xe(h, _),
1393
- onTouchStart: xe(d, b)
1394
- }
1395
- ] : [!1, v, {}];
1396
- }
1397
- function xe(e, t) {
1398
- return (a) => {
1399
- e && e(a), a.defaultPrevented || t(a);
1400
- };
1401
- }
1402
- function Jn({ page: e, ...t }) {
1403
- let a = Za(), { router: n } = ft(), r = p.useMemo(
1404
- () => Dt(n.routes, e, n.basename),
1405
- [n.routes, e, n.basename]
1406
- );
1407
- return r ? a ? /* @__PURE__ */ p.createElement(Kn, { page: e, matches: r, ...t }) : /* @__PURE__ */ p.createElement(Vn, { page: e, matches: r, ...t }) : null;
1408
- }
1409
- function qn(e) {
1410
- let { manifest: t, routeModules: a } = yt(), [n, r] = p.useState([]);
1411
- return p.useEffect(() => {
1412
- let o = !1;
1413
- return Fn(e, t, a).then(
1414
- (i) => {
1415
- o || r(i);
1416
- }
1417
- ), () => {
1418
- o = !0;
1419
- };
1420
- }, [e, t, a]), n;
1421
- }
1422
- function Kn({
1423
- page: e,
1424
- matches: t,
1425
- ...a
1426
- }) {
1427
- let n = ee(), { future: r } = yt(), { basename: o } = ft(), i = p.useMemo(() => {
1428
- if (e === n.pathname + n.search + n.hash)
1429
- return [];
1430
- let l = ta(
1431
- e,
1432
- o,
1433
- r.unstable_trailingSlashAwareDataRequests,
1434
- "rsc"
1435
- ), c = !1, u = [];
1436
- for (let h of t)
1437
- typeof h.route.shouldRevalidate == "function" ? c = !0 : u.push(h.route.id);
1438
- return c && u.length > 0 && l.searchParams.set("_routes", u.join(",")), [l.pathname + l.search];
1439
- }, [
1440
- o,
1441
- r.unstable_trailingSlashAwareDataRequests,
1442
- e,
1443
- n,
1444
- t
1445
- ]);
1446
- return /* @__PURE__ */ p.createElement(p.Fragment, null, i.map((l) => /* @__PURE__ */ p.createElement("link", { key: l, rel: "prefetch", as: "fetch", href: l, ...a })));
1447
- }
1448
- function Vn({
1449
- page: e,
1450
- matches: t,
1451
- ...a
1452
- }) {
1453
- let n = ee(), { future: r, manifest: o, routeModules: i } = yt(), { basename: l } = ft(), { loaderData: c, matches: u } = Hn(), h = p.useMemo(
1454
- () => Ct(
1455
- e,
1456
- t,
1457
- u,
1458
- o,
1459
- n,
1460
- "data"
1461
- ),
1462
- [e, t, u, o, n]
1463
- ), d = p.useMemo(
1464
- () => Ct(
1465
- e,
1466
- t,
1467
- u,
1468
- o,
1469
- n,
1470
- "assets"
1471
- ),
1472
- [e, t, u, o, n]
1473
- ), v = p.useMemo(() => {
1474
- if (e === n.pathname + n.search + n.hash)
1475
- return [];
1476
- let m = /* @__PURE__ */ new Set(), f = !1;
1477
- if (t.forEach((w) => {
1478
- let R = o.routes[w.route.id];
1479
- !R || !R.hasLoader || (!h.some((L) => L.route.id === w.route.id) && w.route.id in c && i[w.route.id]?.shouldRevalidate || R.hasClientLoader ? f = !0 : m.add(w.route.id));
1480
- }), m.size === 0)
1481
- return [];
1482
- let C = ta(
1483
- e,
1484
- l,
1485
- r.unstable_trailingSlashAwareDataRequests,
1486
- "data"
1487
- );
1488
- return f && m.size > 0 && C.searchParams.set(
1489
- "_routes",
1490
- t.filter((w) => m.has(w.route.id)).map((w) => w.route.id).join(",")
1491
- ), [C.pathname + C.search];
1492
- }, [
1493
- l,
1494
- r.unstable_trailingSlashAwareDataRequests,
1495
- c,
1496
- n,
1497
- o,
1498
- h,
1499
- t,
1500
- e,
1501
- i
1502
- ]), b = p.useMemo(
1503
- () => Un(d, o),
1504
- [d, o]
1505
- ), _ = qn(d);
1506
- return /* @__PURE__ */ p.createElement(p.Fragment, null, v.map((m) => /* @__PURE__ */ p.createElement("link", { key: m, rel: "prefetch", as: "fetch", href: m, ...a })), b.map((m) => /* @__PURE__ */ p.createElement("link", { key: m, rel: "modulepreload", href: m, ...a })), _.map(({ key: m, link: f }) => (
1507
- // these don't spread `linkProps` because they are full link descriptors
1508
- // already with their own props
1509
- /* @__PURE__ */ p.createElement(
1510
- "link",
1511
- {
1512
- key: m,
1513
- nonce: a.nonce,
1514
- ...f,
1515
- crossOrigin: f.crossOrigin ?? a.crossOrigin
1516
- }
1517
- )
1518
- )));
1519
- }
1520
- function Gn(...e) {
1521
- return (t) => {
1522
- e.forEach((a) => {
1523
- typeof a == "function" ? a(t) : a != null && (a.current = t);
1524
- });
1525
- };
1526
- }
1527
- var zn = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u";
1528
- try {
1529
- zn && (window.__reactRouterVersion = // @ts-expect-error
1530
- "7.14.1");
1531
- } catch {
1532
- }
1533
- function Yn({
1534
- basename: e,
1535
- children: t,
1536
- unstable_useTransitions: a,
1537
- window: n
1538
- }) {
1539
- let r = p.useRef();
1540
- r.current == null && (r.current = Ca({ window: n, v5Compat: !0 }));
1541
- let o = r.current, [i, l] = p.useState({
1542
- action: o.action,
1543
- location: o.location
1544
- }), c = p.useCallback(
1545
- (u) => {
1546
- a === !1 ? l(u) : p.startTransition(() => l(u));
1547
- },
1548
- [a]
1549
- );
1550
- return p.useLayoutEffect(() => o.listen(c), [o, c]), /* @__PURE__ */ p.createElement(
1551
- Nn,
1552
- {
1553
- basename: e,
1554
- children: t,
1555
- location: i.location,
1556
- navigationType: i.action,
1557
- navigator: o,
1558
- unstable_useTransitions: a
1559
- }
1560
- );
1561
- }
1562
- var aa = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i, he = p.forwardRef(
1563
- function({
1564
- onClick: t,
1565
- discover: a = "render",
1566
- prefetch: n = "none",
1567
- relative: r,
1568
- reloadDocument: o,
1569
- replace: i,
1570
- unstable_mask: l,
1571
- state: c,
1572
- target: u,
1573
- to: h,
1574
- preventScrollReset: d,
1575
- viewTransition: v,
1576
- unstable_defaultShouldRevalidate: b,
1577
- ..._
1578
- }, m) {
1579
- let { basename: f, navigator: C, unstable_useTransitions: w } = p.useContext(Z), R = typeof h == "string" && aa.test(h), L = Bt(h, f);
1580
- h = L.to;
1581
- let x = sn(h, { relative: r }), D = ee(), W = null;
1582
- if (l) {
1583
- let T = We(
1584
- l,
1585
- [],
1586
- D.unstable_mask ? D.unstable_mask.pathname : "/",
1587
- !0
1588
- );
1589
- f !== "/" && (T.pathname = T.pathname === "/" ? f : re([f, T.pathname])), W = C.createHref(T);
1590
- }
1591
- let [B, P, A] = Wn(
1592
- n,
1593
- _
1594
- ), M = er(h, {
1595
- replace: i,
1596
- unstable_mask: l,
1597
- state: c,
1598
- target: u,
1599
- preventScrollReset: d,
1600
- relative: r,
1601
- viewTransition: v,
1602
- unstable_defaultShouldRevalidate: b,
1603
- unstable_useTransitions: w
1604
- });
1605
- function k(T) {
1606
- t && t(T), T.defaultPrevented || M(T);
1607
- }
1608
- let F = !(L.isExternal || o), H = (
1609
- // eslint-disable-next-line jsx-a11y/anchor-has-content
1610
- /* @__PURE__ */ p.createElement(
1611
- "a",
1612
- {
1613
- ..._,
1614
- ...A,
1615
- href: (F ? W : void 0) || L.absoluteURL || x,
1616
- onClick: F ? k : t,
1617
- ref: Gn(m, P),
1618
- target: u,
1619
- "data-discover": !R && a === "render" ? "true" : void 0
1620
- }
1621
- )
1622
- );
1623
- return B && !R ? /* @__PURE__ */ p.createElement(p.Fragment, null, H, /* @__PURE__ */ p.createElement(Jn, { page: x })) : H;
1624
- }
1625
- );
1626
- he.displayName = "Link";
1627
- var Qn = p.forwardRef(
1628
- function({
1629
- "aria-current": t = "page",
1630
- caseSensitive: a = !1,
1631
- className: n = "",
1632
- end: r = !1,
1633
- style: o,
1634
- to: i,
1635
- viewTransition: l,
1636
- children: c,
1637
- ...u
1638
- }, h) {
1639
- let d = Oe(i, { relative: u.relative }), v = ee(), b = p.useContext(Je), { navigator: _, basename: m } = p.useContext(Z), f = b != null && // Conditional usage is OK here because the usage of a data router is static
1640
- // eslint-disable-next-line react-hooks/rules-of-hooks
1641
- or(d) && l === !0, C = _.encodeLocation ? _.encodeLocation(d).pathname : d.pathname, w = v.pathname, R = b && b.navigation && b.navigation.location ? b.navigation.location.pathname : null;
1642
- a || (w = w.toLowerCase(), R = R ? R.toLowerCase() : null, C = C.toLowerCase()), R && m && (R = ue(R, m) || R);
1643
- const L = C !== "/" && C.endsWith("/") ? C.length - 1 : C.length;
1644
- let x = w === C || !r && w.startsWith(C) && w.charAt(L) === "/", D = R != null && (R === C || !r && R.startsWith(C) && R.charAt(C.length) === "/"), W = {
1645
- isActive: x,
1646
- isPending: D,
1647
- isTransitioning: f
1648
- }, B = x ? t : void 0, P;
1649
- typeof n == "function" ? P = n(W) : P = [
1650
- n,
1651
- x ? "active" : null,
1652
- D ? "pending" : null,
1653
- f ? "transitioning" : null
1654
- ].filter(Boolean).join(" ");
1655
- let A = typeof o == "function" ? o(W) : o;
1656
- return /* @__PURE__ */ p.createElement(
1657
- he,
1658
- {
1659
- ...u,
1660
- "aria-current": B,
1661
- className: P,
1662
- ref: h,
1663
- style: A,
1664
- to: i,
1665
- viewTransition: l
1666
- },
1667
- typeof c == "function" ? c(W) : c
1668
- );
1669
- }
1670
- );
1671
- Qn.displayName = "NavLink";
1672
- var Xn = p.forwardRef(
1673
- ({
1674
- discover: e = "render",
1675
- fetcherKey: t,
1676
- navigate: a,
1677
- reloadDocument: n,
1678
- replace: r,
1679
- state: o,
1680
- method: i = Ue,
1681
- action: l,
1682
- onSubmit: c,
1683
- relative: u,
1684
- preventScrollReset: h,
1685
- viewTransition: d,
1686
- unstable_defaultShouldRevalidate: v,
1687
- ...b
1688
- }, _) => {
1689
- let { unstable_useTransitions: m } = p.useContext(Z), f = nr(), C = rr(l, { relative: u }), w = i.toLowerCase() === "get" ? "get" : "post", R = typeof l == "string" && aa.test(l), L = (x) => {
1690
- if (c && c(x), x.defaultPrevented) return;
1691
- x.preventDefault();
1692
- let D = x.nativeEvent.submitter, W = D?.getAttribute("formmethod") || i, B = () => f(D || x.currentTarget, {
1693
- fetcherKey: t,
1694
- method: W,
1695
- navigate: a,
1696
- replace: r,
1697
- state: o,
1698
- relative: u,
1699
- preventScrollReset: h,
1700
- viewTransition: d,
1701
- unstable_defaultShouldRevalidate: v
1702
- });
1703
- m && a !== !1 ? p.startTransition(() => B()) : B();
1704
- };
1705
- return /* @__PURE__ */ p.createElement(
1706
- "form",
1707
- {
1708
- ref: _,
1709
- method: w,
1710
- action: C,
1711
- onSubmit: n ? c : L,
1712
- ...b,
1713
- "data-discover": !R && e === "render" ? "true" : void 0
1714
- }
1715
- );
1716
- }
1717
- );
1718
- Xn.displayName = "Form";
1719
- function Zn(e) {
1720
- return `${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
1721
- }
1722
- function na(e) {
1723
- let t = p.useContext(Ee);
1724
- return I(t, Zn(e)), t;
1725
- }
1726
- function er(e, {
1727
- target: t,
1728
- replace: a,
1729
- unstable_mask: n,
1730
- state: r,
1731
- preventScrollReset: o,
1732
- relative: i,
1733
- viewTransition: l,
1734
- unstable_defaultShouldRevalidate: c,
1735
- unstable_useTransitions: u
1736
- } = {}) {
1737
- let h = ye(), d = ee(), v = Oe(e, { relative: i });
1738
- return p.useCallback(
1739
- (b) => {
1740
- if (xn(b, t)) {
1741
- b.preventDefault();
1742
- let _ = a !== void 0 ? a : $e(d) === $e(v), m = () => h(e, {
1743
- replace: _,
1744
- unstable_mask: n,
1745
- state: r,
1746
- preventScrollReset: o,
1747
- relative: i,
1748
- viewTransition: l,
1749
- unstable_defaultShouldRevalidate: c
1750
- });
1751
- u ? p.startTransition(() => m()) : m();
1752
- }
1753
- },
1754
- [
1755
- d,
1756
- h,
1757
- v,
1758
- a,
1759
- n,
1760
- r,
1761
- t,
1762
- e,
1763
- o,
1764
- i,
1765
- l,
1766
- c,
1767
- u
1768
- ]
1769
- );
1770
- }
1771
- function ra(e) {
1772
- X(
1773
- typeof URLSearchParams < "u",
1774
- "You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params."
1775
- );
1776
- let t = p.useRef(rt(e)), a = p.useRef(!1), n = ee(), r = p.useMemo(
1777
- () => (
1778
- // Only merge in the defaults if we haven't yet called setSearchParams.
1779
- // Once we call that we want those to take precedence, otherwise you can't
1780
- // remove a param with setSearchParams({}) if it has an initial value
1781
- $n(
1782
- n.search,
1783
- a.current ? null : t.current
1784
- )
1785
- ),
1786
- [n.search]
1787
- ), o = ye(), i = p.useCallback(
1788
- (l, c) => {
1789
- const u = rt(
1790
- typeof l == "function" ? l(new URLSearchParams(r)) : l
1791
- );
1792
- a.current = !0, o("?" + u, c);
1793
- },
1794
- [o, r]
1795
- );
1796
- return [r, i];
1797
- }
1798
- var tr = 0, ar = () => `__${String(++tr)}__`;
1799
- function nr() {
1800
- let { router: e } = na(
1801
- "useSubmit"
1802
- /* UseSubmit */
1803
- ), { basename: t } = p.useContext(Z), a = wn(), n = e.fetch, r = e.navigate;
1804
- return p.useCallback(
1805
- async (o, i = {}) => {
1806
- let { action: l, method: c, encType: u, formData: h, body: d } = An(
1807
- o,
1808
- t
1809
- );
1810
- if (i.navigate === !1) {
1811
- let v = i.fetcherKey || ar();
1812
- await n(v, a, i.action || l, {
1813
- unstable_defaultShouldRevalidate: i.unstable_defaultShouldRevalidate,
1814
- preventScrollReset: i.preventScrollReset,
1815
- formData: h,
1816
- body: d,
1817
- formMethod: i.method || c,
1818
- formEncType: i.encType || u,
1819
- flushSync: i.flushSync
1820
- });
1821
- } else
1822
- await r(i.action || l, {
1823
- unstable_defaultShouldRevalidate: i.unstable_defaultShouldRevalidate,
1824
- preventScrollReset: i.preventScrollReset,
1825
- formData: h,
1826
- body: d,
1827
- formMethod: i.method || c,
1828
- formEncType: i.encType || u,
1829
- replace: i.replace,
1830
- state: i.state,
1831
- fromRouteId: a,
1832
- flushSync: i.flushSync,
1833
- viewTransition: i.viewTransition
1834
- });
1835
- },
1836
- [n, r, t, a]
1837
- );
1838
- }
1839
- function rr(e, { relative: t } = {}) {
1840
- let { basename: a } = p.useContext(Z), n = p.useContext(ae);
1841
- I(n, "useFormAction must be used inside a RouteContext");
1842
- let [r] = n.matches.slice(-1), o = { ...Oe(e || ".", { relative: t }) }, i = ee();
1843
- if (e == null) {
1844
- o.search = i.search;
1845
- let l = new URLSearchParams(o.search), c = l.getAll("index");
1846
- if (c.some((h) => h === "")) {
1847
- l.delete("index"), c.filter((d) => d).forEach((d) => l.append("index", d));
1848
- let h = l.toString();
1849
- o.search = h ? `?${h}` : "";
1850
- }
1851
- }
1852
- return (!e || e === ".") && r.route.index && (o.search = o.search ? o.search.replace(/^\?/, "?index&") : "?index"), a !== "/" && (o.pathname = o.pathname === "/" ? a : re([a, o.pathname])), $e(o);
1853
- }
1854
- function or(e, { relative: t } = {}) {
1855
- let a = p.useContext(Jt);
1856
- I(
1857
- a != null,
1858
- "`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?"
1859
- );
1860
- let { basename: n } = na(
1861
- "useViewTransitionState"
1862
- /* useViewTransitionState */
1863
- ), r = Oe(e, { relative: t });
1864
- if (!a.isTransitioning)
1865
- return !1;
1866
- let o = ue(a.currentLocation.pathname, n) || a.currentLocation.pathname, i = ue(a.nextLocation.pathname, n) || a.nextLocation.pathname;
1867
- return Be(r.pathname, i) != null || Be(r.pathname, o) != null;
1868
- }
1869
- function O(e, t = !1) {
1870
- const a = { Accept: "application/json" };
1871
- return t && (a["Content-Type"] = "application/json"), a;
1872
- }
1873
- const Re = "/jobplatform/api", Et = ["junior", "mid", "senior", "staff", "principal", "fellow"], St = ["manager", "senior_manager", "director", "vp", "cxo"], sr = {
1874
- junior: "Junior",
1875
- mid: "Mid",
1876
- senior: "Senior",
1877
- staff: "Staff",
1878
- principal: "Principal",
1879
- fellow: "Distinguished / Fellow",
1880
- manager: "Manager",
1881
- senior_manager: "Senior Manager",
1882
- director: "Director",
1883
- vp: "VP / Head of",
1884
- cxo: "C-level"
1885
- };
1886
- class _e extends Error {
1887
- constructor(t, a) {
1888
- super(t), this.status = a, this.name = "ProfilesApiError";
1889
- }
1890
- }
1891
- async function Ne(e) {
1892
- const t = await e.json();
1893
- if (!e.ok || !t.success || !t.data)
1894
- throw new _e(
1895
- t.message ?? t.error ?? `HTTP ${e.status}`,
1896
- e.status
1897
- );
1898
- return t.data;
1899
- }
1900
- async function ir(e) {
1901
- const t = await fetch(`${Re}/profiles`, {
1902
- method: "GET",
1903
- headers: O(),
1904
- credentials: "include"
1905
- });
1906
- return (await Ne(t)).profiles;
1907
- }
1908
- async function lr(e, t) {
1909
- const a = await fetch(`${Re}/profiles`, {
1910
- method: "POST",
1911
- headers: O(t, !0),
1912
- credentials: "include",
1913
- body: JSON.stringify(e)
1914
- });
1915
- return (await Ne(a)).profile;
1916
- }
1917
- async function cr(e, t, a) {
1918
- const n = await fetch(`${Re}/profiles/${encodeURIComponent(e)}`, {
1919
- method: "PUT",
1920
- headers: O(a, !0),
1921
- credentials: "include",
1922
- body: JSON.stringify(t)
1923
- });
1924
- return (await Ne(n)).profile;
1925
- }
1926
- async function ur(e, t) {
1927
- const a = await fetch(`${Re}/profiles/${encodeURIComponent(e)}`, {
1928
- method: "DELETE",
1929
- headers: O(),
1930
- credentials: "include"
1931
- });
1932
- await Ne(a);
1933
- }
1934
- async function dr(e, t) {
1935
- const a = await fetch(`${Re}/profiles/${encodeURIComponent(e)}/companies`, {
1936
- method: "GET",
1937
- headers: O(),
1938
- credentials: "include"
1939
- });
1940
- return (await Ne(a)).companies;
1941
- }
1942
- async function pr(e, t, a) {
1943
- const n = await fetch(`${Re}/profiles/${encodeURIComponent(e)}/companies`, {
1944
- method: "POST",
1945
- headers: O(a, !0),
1946
- credentials: "include",
1947
- body: JSON.stringify(t)
1948
- });
1949
- return Ne(n);
1950
- }
1951
- async function hr(e, t, a) {
1952
- const n = await fetch(
1953
- `${Re}/profiles/${encodeURIComponent(e)}/companies/${encodeURIComponent(t)}`,
1954
- { method: "DELETE", headers: O(), credentials: "include" }
1955
- );
1956
- await Ne(n);
1957
- }
1958
- const Q = /* @__PURE__ */ new Map(), fr = 120;
1959
- function mr() {
1960
- for (; Q.size > fr; ) {
1961
- const e = Q.keys().next();
1962
- if (e.done) return;
1963
- Q.delete(e.value);
1964
- }
1965
- }
1966
- const yr = 3e4;
1967
- function Me(e, t, { onStale: a, maxAgeMs: n = yr } = {}) {
1968
- const r = Q.get(e);
1969
- if (r && "value" in r) {
1970
- const i = Date.now() - r.at < n;
1971
- if (a?.(r.value, i), i) return Promise.resolve(r.value);
1972
- }
1973
- if (r?.inflight) return r.inflight;
1974
- const o = t().then((i) => (Q.delete(e), Q.set(e, { value: i, at: Date.now() }), mr(), i)).catch((i) => {
1975
- const l = Q.get(e);
1976
- throw l ? Q.set(e, { value: l.value, at: l.at }) : Q.delete(e), i;
1977
- });
1978
- return Q.set(e, r ? { ...r, inflight: o } : { inflight: o }), o;
1979
- }
1980
- function Pt(e) {
1981
- const t = Q.get(e);
1982
- return t && "value" in t ? t.value : void 0;
1983
- }
1984
- function Le(e) {
1985
- for (const t of [...Q.keys()])
1986
- t.startsWith(e) && Q.delete(t);
1987
- }
1988
- function Ke(e, t, { enabled: a = !0, maxAgeMs: n } = {}) {
1989
- const [r, o] = N(
1990
- () => a ? Pt(e) : void 0
1991
- ), [i, l] = N(!1), [c, u] = N(null), [h, d] = N(0), v = Te(t);
1992
- return v.current = t, z(() => {
1993
- if (!a) {
1994
- l(!1);
1995
- return;
1996
- }
1997
- let b = !1;
1998
- u(null);
1999
- const _ = Pt(e);
2000
- return _ !== void 0 && o(_), l(!0), Me(e, () => v.current(), {
2001
- maxAgeMs: n,
2002
- onStale: (m, f) => {
2003
- b || (o(m), f && l(!1));
2004
- }
2005
- }).then((m) => {
2006
- b || o(m);
2007
- }).catch((m) => {
2008
- b || u(m);
2009
- }).finally(() => {
2010
- b || l(!1);
2011
- }), () => {
2012
- b = !0;
2013
- };
2014
- }, [e, a, n, h]), {
2015
- data: r,
2016
- loading: a && r === void 0 && c === null,
2017
- refreshing: i,
2018
- error: c,
2019
- reload: () => d((b) => b + 1)
2020
- };
2021
- }
2022
- function gr() {
2023
- const e = window.location.pathname + window.location.search + window.location.hash;
2024
- return `/auth?return=${encodeURIComponent(e)}`;
2025
- }
2026
- function vr({
2027
- auth: e,
2028
- selectedId: t,
2029
- onSelect: a,
2030
- onNew: n,
2031
- onEdit: r,
2032
- reloadKey: o,
2033
- onResolved: i
2034
- }) {
2035
- const [l, c] = N(null), u = e.signedIn, {
2036
- data: h,
2037
- loading: d,
2038
- error: v,
2039
- reload: b
2040
- } = Ke(`profiles:${o ?? 0}`, () => ir(), { enabled: u }), _ = h ?? [], m = l ?? (v ? v instanceof _e ? v.message : "Failed to load profiles" : null), f = !u || !d;
2041
- z(() => {
2042
- f && i?.(_.length);
2043
- }, [f, _.length, i]), z(() => {
2044
- if (!d) {
2045
- if (_.length === 0) {
2046
- t !== null && a(null);
2047
- return;
2048
- }
2049
- _.find((w) => w.id === t) || a(_[0].id);
2050
- }
2051
- }, [d, _, t, a]);
2052
- const C = async (w) => {
2053
- const R = w.is_default ? "Hide the default profile? It won’t come back (your edits/deletion are remembered)." : "Delete this profile?";
2054
- if (window.confirm(R)) {
2055
- c(null);
2056
- try {
2057
- await ur(w.id, e), Le("profiles:"), b();
2058
- } catch (L) {
2059
- c(L instanceof _e ? L.message : "Failed to delete profile");
2060
- }
2061
- }
2062
- };
2063
- return u ? /* @__PURE__ */ g("aside", { className: "jp-sidebar", children: [
2064
- /* @__PURE__ */ g("div", { className: "jp-sidebar__header", children: [
2065
- /* @__PURE__ */ s("h2", { children: "Profiles" }),
2066
- /* @__PURE__ */ s("button", { type: "button", className: "jp-sidebar__new", onClick: n, children: "+ New" })
2067
- ] }),
2068
- m && /* @__PURE__ */ s("p", { className: "jp-error", children: m }),
2069
- d ? /* @__PURE__ */ s("p", { className: "jp-muted", children: "Loading…" }) : _.length === 0 ? /* @__PURE__ */ s("p", { className: "jp-muted", children: "No profiles yet. Create one to start scoring jobs." }) : /* @__PURE__ */ s("ul", { className: "jp-sidebar__list", children: _.map((w) => {
2070
- const R = w.id === t;
2071
- return /* @__PURE__ */ g(
2072
- "li",
2073
- {
2074
- className: R ? "jp-sidebar__item jp-sidebar__item--active" : "jp-sidebar__item",
2075
- children: [
2076
- /* @__PURE__ */ g(
2077
- "button",
2078
- {
2079
- type: "button",
2080
- className: "jp-sidebar__item-main",
2081
- onClick: () => a(w.id),
2082
- children: [
2083
- /* @__PURE__ */ g("span", { className: "jp-sidebar__item-name", children: [
2084
- w.name,
2085
- w.is_default && /* @__PURE__ */ s("span", { className: "jp-sidebar__badge", children: "default" })
2086
- ] }),
2087
- /* @__PURE__ */ g("span", { className: "jp-sidebar__item-meta", children: [
2088
- w.keywords.length,
2089
- " kw · ",
2090
- w.remote_pref
2091
- ] })
2092
- ]
2093
- }
2094
- ),
2095
- /* @__PURE__ */ g("div", { className: "jp-sidebar__item-actions", children: [
2096
- /* @__PURE__ */ s(
2097
- "button",
2098
- {
2099
- type: "button",
2100
- className: "jp-sidebar__item-edit",
2101
- onClick: () => r(w),
2102
- "aria-label": `Edit ${w.name}`,
2103
- children: "✎"
2104
- }
2105
- ),
2106
- /* @__PURE__ */ s(
2107
- "button",
2108
- {
2109
- type: "button",
2110
- className: "jp-sidebar__item-remove",
2111
- onClick: () => {
2112
- C(w);
2113
- },
2114
- "aria-label": w.is_default ? `Hide ${w.name}` : `Delete ${w.name}`,
2115
- children: "×"
2116
- }
2117
- )
2118
- ] })
2119
- ]
2120
- },
2121
- w.id
2122
- );
2123
- }) })
2124
- ] }) : /* @__PURE__ */ g("aside", { className: "jp-sidebar", children: [
2125
- /* @__PURE__ */ s("div", { className: "jp-sidebar__header", children: /* @__PURE__ */ s("h2", { children: "Profiles" }) }),
2126
- /* @__PURE__ */ s("p", { className: "jp-muted", children: "The feed to the right is the whole public corpus, newest first. Sign in to rank it against your own profile — keywords, IC or manager track, level and remote preference — and to track which jobs you’ve looked at." }),
2127
- /* @__PURE__ */ s("a", { className: "jp-sidebar__signin", href: gr(), children: "Sign in" })
2128
- ] });
2129
- }
2130
- const q = "/jobplatform/api";
2131
- class ne extends Error {
2132
- constructor(t, a) {
2133
- super(t), this.status = a, this.name = "JobsApiError";
2134
- }
2135
- }
2136
- async function K(e) {
2137
- const t = await e.json();
2138
- if (!e.ok || !t.success || !t.data)
2139
- throw new ne(t.message ?? t.error ?? `HTTP ${e.status}`, e.status);
2140
- return t.data;
2141
- }
2142
- async function br(e, t) {
2143
- const a = new URLSearchParams();
2144
- e.profile_id && a.set("profile_id", e.profile_id), e.state && a.set("state", e.state), e.hide_dismissed && a.set("hide_dismissed", "true"), e.hide_queued && a.set("hide_queued", "true"), e.page && a.set("page", String(e.page)), e.limit && a.set("limit", String(e.limit)), e.sort && a.set("sort", e.sort), e.min_score !== void 0 && a.set("min_score", String(e.min_score)), e.min_salary !== void 0 && a.set("min_salary", String(e.min_salary)), e.workplace && a.set("workplace", e.workplace), e.near && (a.set("near", e.near), e.radius_miles && a.set("radius_miles", String(e.radius_miles)), e.include_remote === !1 && a.set("include_remote", "false"));
2145
- const n = `${q}/jobs${a.toString() ? `?${a}` : ""}`, r = await fetch(n, {
2146
- method: "GET",
2147
- headers: O(),
2148
- credentials: "include"
2149
- });
2150
- return K(r);
2151
- }
2152
- async function Xe(e, t) {
2153
- const a = new URLSearchParams();
2154
- e.keyword && a.set("keyword", e.keyword), e.track && a.set("track", e.track), e.level && a.set("level", e.level);
2155
- const n = await fetch(`${q}/jobs/preflight?${a}`, {
2156
- method: "GET",
2157
- headers: O(),
2158
- credentials: "include"
2159
- });
2160
- return (await K(n)).count;
2161
- }
2162
- async function wr(e, t, a) {
2163
- const n = t ? `?profile_id=${encodeURIComponent(t)}` : "", r = await fetch(`${q}/jobs/${encodeURIComponent(e)}${n}`, {
2164
- method: "GET",
2165
- headers: O(),
2166
- credentials: "include"
2167
- });
2168
- return (await K(r)).job;
2169
- }
2170
- async function _r(e, t, a, n) {
2171
- const r = await fetch(`${q}/jobs/${encodeURIComponent(e)}/state`, {
2172
- method: "PUT",
2173
- headers: O(a, !0),
2174
- credentials: "include",
2175
- body: JSON.stringify(n ? { state: t, variant_slug: n } : { state: t })
2176
- });
2177
- return K(r);
2178
- }
2179
- async function xt(e, t, a, n) {
2180
- const r = await fetch(`${q}/jobs/${encodeURIComponent(e)}/feedback`, {
2181
- method: "PUT",
2182
- headers: O(n, !0),
2183
- credentials: "include",
2184
- body: JSON.stringify({ vote: t, reasons: a })
2185
- });
2186
- return K(r);
2187
- }
2188
- async function kr(e, t) {
2189
- const a = await fetch(`${q}/jobs/${encodeURIComponent(e)}/feedback`, {
2190
- method: "DELETE",
2191
- headers: O(),
2192
- credentials: "include"
2193
- });
2194
- return K(a);
2195
- }
2196
- async function Rr(e, t, a) {
2197
- const n = await fetch(`${q}/jobs/${encodeURIComponent(e)}/resume`, {
2198
- method: "POST",
2199
- headers: O(t, !0),
2200
- credentials: "include",
2201
- body: JSON.stringify({})
2202
- });
2203
- return K(n);
2204
- }
2205
- async function Nr(e, t, a) {
2206
- const n = await fetch(`${q}/jobs/${encodeURIComponent(e)}/cover-letter`, {
2207
- method: "POST",
2208
- headers: O(t, !0),
2209
- credentials: "include",
2210
- body: JSON.stringify({})
2211
- });
2212
- return K(n);
2213
- }
2214
- async function oa(e, t, a) {
2215
- const n = await fetch(`${q}/jobs/${encodeURIComponent(e)}/packet-link`, {
2216
- method: "POST",
2217
- headers: O(a, !0),
2218
- credentials: "include",
2219
- body: JSON.stringify(t)
2220
- });
2221
- return K(n);
2222
- }
2223
- async function sa(e, t, a) {
2224
- const n = await fetch(`${q}/jobs/${encodeURIComponent(e)}/application-extras`, {
2225
- method: "POST",
2226
- headers: O(a, !0),
2227
- credentials: "include",
2228
- body: JSON.stringify(t)
2229
- });
2230
- return K(n);
2231
- }
2232
- async function xo(e) {
2233
- const t = await fetch(`${q}/jobs/packets`, {
2234
- method: "GET",
2235
- headers: O(),
2236
- credentials: "include"
2237
- });
2238
- return (await K(t)).packets;
2239
- }
2240
- async function ia(e, t = "review", a) {
2241
- const n = await fetch(`${q}/jobs/${encodeURIComponent(e)}/apply`, {
2242
- method: "POST",
2243
- headers: { "Content-Type": "application/json", ...O() },
2244
- credentials: "include",
2245
- body: JSON.stringify({ mode: t })
2246
- });
2247
- return (await K(n)).application;
2248
- }
2249
- async function $o(e, t) {
2250
- const n = await fetch(`${q}/applications`, {
2251
- method: "GET",
2252
- headers: O(),
2253
- credentials: "include"
2254
- });
2255
- return (await K(n)).applications;
2256
- }
2257
- async function Lo(e, t) {
2258
- const a = await fetch(`${q}/applications/${encodeURIComponent(e)}/approve`, {
2259
- method: "POST",
2260
- headers: O(),
2261
- credentials: "include"
2262
- });
2263
- return (await K(a)).application;
2264
- }
2265
- async function To(e) {
2266
- const t = await fetch(`${q}/unanswered-questions`, {
2267
- method: "GET",
2268
- headers: O(),
2269
- credentials: "include"
2270
- });
2271
- return (await K(t)).questions;
2272
- }
2273
- async function Ao(e) {
2274
- const t = await fetch(`${q}/application-answers`, {
2275
- method: "GET",
2276
- headers: O(),
2277
- credentials: "include"
2278
- });
2279
- return (await K(t)).answers;
2280
- }
2281
- async function Oo(e, t, a) {
2282
- const n = await fetch(`${q}/application-answers`, {
2283
- method: "PUT",
2284
- headers: { ...O(), "Content-Type": "application/json" },
2285
- credentials: "include",
2286
- body: JSON.stringify({ question: e, answer: t })
2287
- });
2288
- return (await K(n)).answer;
2289
- }
2290
- async function Do(e, t) {
2291
- const a = await fetch(
2292
- `${q}/application-answers/${encodeURIComponent(e)}`,
2293
- { method: "DELETE", headers: O(), credentials: "include" }
2294
- );
2295
- return (await K(a)).answers;
2296
- }
2297
- async function Fo(e) {
2298
- const t = await fetch(`${q}/verification-codes`, {
2299
- method: "GET",
2300
- headers: O(),
2301
- credentials: "include"
2302
- });
2303
- return (await K(t)).codes;
2304
- }
2305
- const jr = "/jobplatform/api";
2306
- class ot extends Error {
2307
- constructor(t, a) {
2308
- super(t), this.status = a, this.name = "CompaniesApiError";
2309
- }
2310
- }
2311
- async function Cr(e) {
2312
- const t = await e.json();
2313
- if (!e.ok || !t.success || !t.data)
2314
- throw new ot(
2315
- t.message ?? t.error ?? `HTTP ${e.status}`,
2316
- e.status
2317
- );
2318
- return t.data;
2319
- }
2320
- async function Er(e, t) {
2321
- const a = await fetch(`${jr}/companies/match`, {
2322
- method: "POST",
2323
- headers: O(t, !0),
2324
- credentials: "include",
2325
- body: JSON.stringify({ names: e })
2326
- });
2327
- return (await Cr(a)).results;
2328
- }
2329
- function $t(e) {
2330
- const t = /* @__PURE__ */ new Set(), a = [];
2331
- for (const n of e.split(/[,\n]+/)) {
2332
- const r = n.trim();
2333
- r && !t.has(r.toLowerCase()) && (t.add(r.toLowerCase()), a.push(r));
2334
- }
2335
- return a;
2336
- }
2337
- function Sr(e) {
2338
- return e ? `https://www.google.com/s2/favicons?domain=${encodeURIComponent(e)}&sz=64` : null;
2339
- }
2340
- function Pr({ auth: e, profileId: t, onCompaniesChanged: a }) {
2341
- const [n, r] = N(null), [o, i] = N(""), [l, c] = N(!1), [u, h] = N(null), [d, v] = N(null), [b, _] = N(null), {
2342
- data: m,
2343
- loading: f,
2344
- error: C,
2345
- reload: w
2346
- } = Ke(
2347
- `profile-companies:${t ?? ""}`,
2348
- () => dr(t ?? ""),
2349
- { enabled: !!t }
2350
- ), R = t ? m ?? [] : [], L = n ?? (C ? C instanceof _e ? C.message : "Failed to load companies" : null), x = se(() => {
2351
- Le(`profile-companies:${t ?? ""}`), w();
2352
- }, [t, w]);
2353
- z(() => {
2354
- h(null);
2355
- }, [t]);
2356
- const D = (k, F) => `${k}:${F}`, W = new Set(R.map((k) => D(k.ats, k.slug))), B = async (k, F, H) => {
2357
- if (!(!t || b)) {
2358
- r(null), v(null);
2359
- try {
2360
- await pr(
2361
- t,
2362
- { ats: k, slug: F, display_name: H.trim() || F },
2363
- e
2364
- ), x(), a?.();
2365
- } catch (T) {
2366
- const V = T instanceof ot || T instanceof _e ? T.message : "Failed to add company";
2367
- throw v(V), T;
2368
- }
2369
- }
2370
- }, P = async (k) => {
2371
- k.preventDefault();
2372
- const F = $t(o);
2373
- if (!(F.length === 0 || l)) {
2374
- c(!0), v(null), h(null);
2375
- try {
2376
- h(await Er(F, e));
2377
- } catch (H) {
2378
- v(H instanceof ot ? H.message : "Failed to look up company");
2379
- } finally {
2380
- c(!1);
2381
- }
2382
- }
2383
- }, A = async (k) => {
2384
- if (!k.matched || !k.ats || !k.slug) return;
2385
- const F = D(k.ats, k.slug);
2386
- _(F);
2387
- try {
2388
- await B(k.ats, k.slug, k.company_name ?? k.query);
2389
- } catch {
2390
- } finally {
2391
- _(null);
2392
- }
2393
- }, M = async (k) => {
2394
- if (t) {
2395
- r(null);
2396
- try {
2397
- await hr(t, k, e), x(), a?.();
2398
- } catch (F) {
2399
- r(F instanceof _e ? F.message : "Failed to remove company");
2400
- }
2401
- }
2402
- };
2403
- return t ? /* @__PURE__ */ g("div", { className: "job-platform__companies", children: [
2404
- /* @__PURE__ */ g("form", { className: "job-platform__companies-form", onSubmit: (k) => {
2405
- P(k);
2406
- }, children: [
2407
- /* @__PURE__ */ s(
2408
- "input",
2409
- {
2410
- type: "text",
2411
- placeholder: "Add a company by name (e.g. Scale AI, OpenAI, Ramp)",
2412
- value: o,
2413
- onChange: (k) => i(k.target.value),
2414
- disabled: l,
2415
- "aria-label": "Company name"
2416
- }
2417
- ),
2418
- /* @__PURE__ */ s("button", { type: "submit", disabled: l || $t(o).length === 0, children: l ? "Finding…" : "Find" })
2419
- ] }),
2420
- d && /* @__PURE__ */ s("p", { className: "job-platform__companies-error", children: d }),
2421
- u && /* @__PURE__ */ s("div", { className: "job-platform__match-results", children: u.map((k) => {
2422
- const F = k.ats && k.slug ? D(k.ats, k.slug) : k.query, H = k.ats && k.slug ? W.has(F) : !1, T = Sr(k.domain), V = k.matched && k.n_jobs === 0;
2423
- return k.matched ? /* @__PURE__ */ g(
2424
- "div",
2425
- {
2426
- className: V ? "job-platform__match-card job-platform__match-card--warn" : "job-platform__match-card",
2427
- children: [
2428
- /* @__PURE__ */ g("div", { className: "job-platform__match-head", children: [
2429
- T && /* @__PURE__ */ s(
2430
- "img",
2431
- {
2432
- className: "job-platform__match-favicon",
2433
- src: T,
2434
- alt: "",
2435
- width: 20,
2436
- height: 20,
2437
- onError: (G) => {
2438
- G.currentTarget.style.display = "none";
2439
- }
2440
- }
2441
- ),
2442
- /* @__PURE__ */ s("strong", { className: "job-platform__match-name", children: k.company_name }),
2443
- /* @__PURE__ */ s("span", { className: "job-platform__probe-ats", children: k.ats }),
2444
- /* @__PURE__ */ g("span", { className: "job-platform__match-meta", children: [
2445
- k.slug,
2446
- " · ",
2447
- k.n_jobs,
2448
- " job",
2449
- k.n_jobs === 1 ? "" : "s"
2450
- ] })
2451
- ] }),
2452
- k.sample_titles.length > 0 && /* @__PURE__ */ s("p", { className: "job-platform__probe-titles", children: k.sample_titles.slice(0, 5).join(" · ") }),
2453
- V && /* @__PURE__ */ g("p", { className: "job-platform__match-warn", children: [
2454
- "⚠ 0 open roles — can’t confirm this is the right company (the board may be stale or a different one on ",
2455
- k.ats,
2456
- "). Add anyway if you’re sure."
2457
- ] }),
2458
- /* @__PURE__ */ s(
2459
- "button",
2460
- {
2461
- type: "button",
2462
- className: "job-platform__match-confirm",
2463
- onClick: () => {
2464
- A(k);
2465
- },
2466
- disabled: H || b !== null,
2467
- children: H ? "Added ✓" : b === F ? "Adding…" : V ? "Add anyway" : "Confirm & add"
2468
- }
2469
- )
2470
- ]
2471
- },
2472
- F
2473
- ) : /* @__PURE__ */ g(
2474
- "div",
2475
- {
2476
- className: "job-platform__match-card job-platform__match-card--empty",
2477
- children: [
2478
- "No board found for ",
2479
- /* @__PURE__ */ s("strong", { children: k.query }),
2480
- " on greenhouse, lever, or ashby — it may use an ATS we don’t scrape yet (e.g. Workday) or a different slug."
2481
- ]
2482
- },
2483
- k.query
2484
- );
2485
- }) }),
2486
- f ? /* @__PURE__ */ s("p", { className: "job-platform__companies-empty", children: "Loading…" }) : R.length === 0 ? /* @__PURE__ */ s("p", { className: "job-platform__companies-empty", children: "No companies yet. This profile scores the whole corpus until you add some." }) : /* @__PURE__ */ s("ul", { className: "job-platform__companies-list", children: R.map((k) => /* @__PURE__ */ g("li", { className: "job-platform__companies-item", children: [
2487
- /* @__PURE__ */ g("div", { className: "job-platform__companies-item-main", children: [
2488
- /* @__PURE__ */ s("strong", { children: k.display_name }),
2489
- /* @__PURE__ */ g("span", { className: "job-platform__companies-item-meta", children: [
2490
- k.ats,
2491
- " · ",
2492
- k.slug
2493
- ] })
2494
- ] }),
2495
- /* @__PURE__ */ s(
2496
- "button",
2497
- {
2498
- type: "button",
2499
- className: "job-platform__companies-item-remove",
2500
- onClick: () => {
2501
- M(k.id);
2502
- },
2503
- "aria-label": `Remove ${k.display_name}`,
2504
- children: "Remove"
2505
- }
2506
- )
2507
- ] }, k.id)) }),
2508
- L && /* @__PURE__ */ s("p", { className: "job-platform__companies-error", children: L })
2509
- ] }) : /* @__PURE__ */ s("p", { className: "job-platform__companies-empty", children: "Save the profile first, then add the companies it should track." });
2510
- }
2511
- const Ze = 15 * 6e4, xr = [
2512
- { value: "either", label: "Either", hint: "No constraint — both tracks in the feed" },
2513
- { value: "ic", label: "IC", hint: "No direct reports" },
2514
- { value: "manager", label: "Manager", hint: "Has direct reports" }
2515
- ];
2516
- function Lt(e) {
2517
- return e === "ic" ? Et : e === "manager" ? St : [...Et, ...St];
2518
- }
2519
- function et({ count: e }) {
2520
- return e === null ? null : e === "loading" ? /* @__PURE__ */ s("span", { className: "jp-editor__count jp-editor__count--loading", children: "…" }) : /* @__PURE__ */ g("span", { className: e === 0 ? "jp-editor__count jp-editor__count--zero" : "jp-editor__count", children: [
2521
- e,
2522
- " job",
2523
- e === 1 ? "" : "s"
2524
- ] });
2525
- }
2526
- function $r({ auth: e, initial: t, onClose: a, onSaved: n, onCompaniesChanged: r }) {
2527
- const [o, i] = N(t?.id ?? null), [l, c] = N(t?.name ?? ""), [u, h] = N(t?.keywords ?? []), [d, v] = N(""), [b, _] = N(t?.track ?? "either"), [m, f] = N(t?.levels ?? []), [C, w] = N(t?.remote_pref ?? "any"), [R, L] = N(!1), [x, D] = N(null), [W, B] = N(!1), [P, A] = N({}), [M, k] = N({}), [F, H] = N(null), T = se(
2528
- async (y) => {
2529
- A((j) => ({ ...j, [y]: "loading" }));
2530
- try {
2531
- const j = await Me(
2532
- `preflight:kw:${y}`,
2533
- () => Xe({ keyword: y }, e),
2534
- { maxAgeMs: Ze }
2535
- );
2536
- A((U) => ({ ...U, [y]: j }));
2537
- } catch {
2538
- A((j) => ({ ...j, [y]: null }));
2539
- }
2540
- },
2541
- [e]
2542
- ), V = se(
2543
- async (y) => {
2544
- k((j) => ({ ...j, [y]: "loading" }));
2545
- try {
2546
- const j = await Me(
2547
- `preflight:level:${y}`,
2548
- () => Xe({ level: y }, e),
2549
- { maxAgeMs: Ze }
2550
- );
2551
- k((U) => ({ ...U, [y]: j }));
2552
- } catch {
2553
- k((j) => ({ ...j, [y]: null }));
2554
- }
2555
- },
2556
- [e]
2557
- ), G = Te(!1);
2558
- z(() => {
2559
- if (!G.current) {
2560
- G.current = !0;
2561
- for (const y of u) T(y);
2562
- for (const y of m) V(y);
2563
- }
2564
- }, [u, m, T, V]), z(() => {
2565
- if (b === "either") {
2566
- H(null);
2567
- return;
2568
- }
2569
- let y = !1;
2570
- return H("loading"), Me(`preflight:track:${b}`, () => Xe({ track: b }), {
2571
- maxAgeMs: Ze
2572
- }).then((j) => !y && H(j)).catch(() => !y && H(null)), () => {
2573
- y = !0;
2574
- };
2575
- }, [b, e]), z(() => {
2576
- const y = (j) => {
2577
- j.key === "Escape" && a();
2578
- };
2579
- return window.addEventListener("keydown", y), () => window.removeEventListener("keydown", y);
2580
- }, [a]);
2581
- const oe = (y) => {
2582
- const j = y.split(",").map((U) => U.trim()).filter(Boolean);
2583
- j.length && (h((U) => {
2584
- const de = new Set(U.map((pe) => pe.toLowerCase())), Pe = [...U];
2585
- for (const pe of j)
2586
- de.has(pe.toLowerCase()) || (de.add(pe.toLowerCase()), Pe.push(pe), T(pe));
2587
- return Pe;
2588
- }), v(""));
2589
- }, ie = (y) => {
2590
- y.key === "Enter" || y.key === "," ? (y.preventDefault(), oe(d)) : y.key === "Backspace" && !d && u.length && h((j) => j.slice(0, -1));
2591
- }, ge = (y) => h((j) => j.filter((U) => U !== y)), ve = (y) => f((j) => j.includes(y) ? j.filter((U) => U !== y) : (M[y] === void 0 && V(y), [...j, y])), Ce = (y) => {
2592
- _(y);
2593
- const j = Lt(y);
2594
- f((U) => U.filter((de) => j.includes(de)));
2595
- }, be = () => {
2596
- const y = d.trim() ? [
2597
- ...u,
2598
- ...d.split(",").map((j) => j.trim()).filter(Boolean)
2599
- ] : u;
2600
- return {
2601
- name: l.trim(),
2602
- keywords: y,
2603
- track: b,
2604
- levels: m,
2605
- remote_pref: C
2606
- };
2607
- }, le = async () => {
2608
- if (!(!l.trim() || R)) {
2609
- L(!0), D(null);
2610
- try {
2611
- const y = be();
2612
- if (o) {
2613
- const j = await cr(o, y, e);
2614
- n(j), a();
2615
- } else {
2616
- const j = await lr(y, e);
2617
- i(j.id), h(j.keywords), n(j), B(!0);
2618
- }
2619
- } catch (y) {
2620
- D(y instanceof _e ? y.message : "Failed to save profile");
2621
- } finally {
2622
- L(!1);
2623
- }
2624
- }
2625
- };
2626
- return /* @__PURE__ */ s("div", { className: "jp-editor-backdrop", onClick: (y) => {
2627
- y.target === y.currentTarget && a();
2628
- }, children: /* @__PURE__ */ g(
2629
- "div",
2630
- {
2631
- className: "jp-editor",
2632
- role: "dialog",
2633
- "aria-modal": "true",
2634
- "aria-label": o ? "Edit profile" : "New profile",
2635
- children: [
2636
- /* @__PURE__ */ g("div", { className: "jp-editor__header", children: [
2637
- /* @__PURE__ */ s("h2", { className: "jp-editor__title", children: t ? "Edit profile" : "New profile" }),
2638
- /* @__PURE__ */ s(
2639
- "button",
2640
- {
2641
- type: "button",
2642
- className: "jp-editor__close",
2643
- onClick: a,
2644
- "aria-label": "Close editor",
2645
- children: "×"
2646
- }
2647
- )
2648
- ] }),
2649
- /* @__PURE__ */ g("div", { className: "jp-editor__body", children: [
2650
- /* @__PURE__ */ g("section", { className: "jp-editor__section", children: [
2651
- /* @__PURE__ */ s("label", { className: "jp-editor__field-label", htmlFor: "jp-editor-name", children: "Name" }),
2652
- /* @__PURE__ */ s(
2653
- "input",
2654
- {
2655
- id: "jp-editor-name",
2656
- type: "text",
2657
- className: "jp-editor__text",
2658
- value: l,
2659
- onChange: (y) => c(y.target.value),
2660
- placeholder: "Senior SWE — AI/ML"
2661
- }
2662
- )
2663
- ] }),
2664
- /* @__PURE__ */ g("section", { className: "jp-editor__section", children: [
2665
- /* @__PURE__ */ g("div", { className: "jp-editor__section-head", children: [
2666
- /* @__PURE__ */ s("span", { className: "jp-editor__field-label", children: "Keywords" }),
2667
- /* @__PURE__ */ s("span", { className: "jp-editor__hint", children: "Each keyword is scraped and scored — the count is live corpus matches." })
2668
- ] }),
2669
- /* @__PURE__ */ g("div", { className: "jp-chips", children: [
2670
- u.map((y) => /* @__PURE__ */ g("span", { className: "jp-chip", children: [
2671
- y,
2672
- /* @__PURE__ */ s(et, { count: P[y] ?? null }),
2673
- /* @__PURE__ */ s("button", { type: "button", onClick: () => ge(y), "aria-label": `Remove ${y}`, children: "×" })
2674
- ] }, y)),
2675
- /* @__PURE__ */ s(
2676
- "input",
2677
- {
2678
- className: "jp-chips__input",
2679
- value: d,
2680
- onChange: (y) => v(y.target.value),
2681
- onKeyDown: ie,
2682
- onBlur: () => oe(d),
2683
- placeholder: u.length ? "Add…" : "python, llm, distributed systems"
2684
- }
2685
- )
2686
- ] })
2687
- ] }),
2688
- /* @__PURE__ */ g("section", { className: "jp-editor__section", children: [
2689
- /* @__PURE__ */ g("div", { className: "jp-editor__section-head", children: [
2690
- /* @__PURE__ */ s("span", { className: "jp-editor__field-label", children: "Track" }),
2691
- /* @__PURE__ */ s("span", { className: "jp-editor__hint", children: "Does the role have direct reports? A hard filter — jobs on the other track don’t appear in this profile’s feed at all." })
2692
- ] }),
2693
- /* @__PURE__ */ s("div", { className: "jp-role-picker", role: "radiogroup", "aria-label": "Track", children: xr.map((y) => {
2694
- const j = b === y.value;
2695
- return /* @__PURE__ */ g(
2696
- "button",
2697
- {
2698
- type: "button",
2699
- role: "radio",
2700
- "aria-checked": j,
2701
- title: y.hint,
2702
- className: j ? "jp-role-opt jp-role-opt--on" : "jp-role-opt",
2703
- onClick: () => Ce(y.value),
2704
- children: [
2705
- y.label,
2706
- j && y.value !== "either" && /* @__PURE__ */ s(et, { count: F })
2707
- ]
2708
- },
2709
- y.value
2710
- );
2711
- }) })
2712
- ] }),
2713
- /* @__PURE__ */ g("section", { className: "jp-editor__section", children: [
2714
- /* @__PURE__ */ g("div", { className: "jp-editor__section-head", children: [
2715
- /* @__PURE__ */ s("span", { className: "jp-editor__field-label", children: "Levels" }),
2716
- /* @__PURE__ */ s("span", { className: "jp-editor__hint", children: "Rungs on the ladder. Scored by distance — one rung off still counts, two doesn’t. Pick none to ignore level entirely." })
2717
- ] }),
2718
- /* @__PURE__ */ s("div", { className: "jp-role-picker", children: Lt(b).map((y) => {
2719
- const j = m.includes(y);
2720
- return /* @__PURE__ */ g(
2721
- "button",
2722
- {
2723
- type: "button",
2724
- className: j ? "jp-role-opt jp-role-opt--on" : "jp-role-opt",
2725
- onClick: () => ve(y),
2726
- "aria-pressed": j,
2727
- children: [
2728
- sr[y],
2729
- j && /* @__PURE__ */ s(et, { count: M[y] ?? null })
2730
- ]
2731
- },
2732
- y
2733
- );
2734
- }) })
2735
- ] }),
2736
- /* @__PURE__ */ g("section", { className: "jp-editor__section", children: [
2737
- /* @__PURE__ */ s("label", { className: "jp-editor__field-label", htmlFor: "jp-editor-remote", children: "Remote preference" }),
2738
- /* @__PURE__ */ g(
2739
- "select",
2740
- {
2741
- id: "jp-editor-remote",
2742
- className: "jp-editor__text",
2743
- value: C,
2744
- onChange: (y) => w(y.target.value),
2745
- children: [
2746
- /* @__PURE__ */ s("option", { value: "any", children: "Any" }),
2747
- /* @__PURE__ */ s("option", { value: "remote", children: "Remote" }),
2748
- /* @__PURE__ */ s("option", { value: "hybrid", children: "Hybrid" }),
2749
- /* @__PURE__ */ s("option", { value: "onsite", children: "Onsite" })
2750
- ]
2751
- }
2752
- )
2753
- ] }),
2754
- /* @__PURE__ */ g("section", { className: "jp-editor__section", children: [
2755
- /* @__PURE__ */ g("div", { className: "jp-editor__section-head", children: [
2756
- /* @__PURE__ */ s("span", { className: "jp-editor__field-label", children: "Companies" }),
2757
- /* @__PURE__ */ s("span", { className: "jp-editor__hint", children: "Optional. Empty = score the whole corpus; add companies to scope the feed." })
2758
- ] }),
2759
- o ? /* @__PURE__ */ s(
2760
- Pr,
2761
- {
2762
- auth: e,
2763
- profileId: o,
2764
- onCompaniesChanged: r
2765
- }
2766
- ) : /* @__PURE__ */ s("p", { className: "job-platform__companies-empty", children: "Create the profile first (below), then add the companies it should track." })
2767
- ] })
2768
- ] }),
2769
- x && /* @__PURE__ */ s("p", { className: "jp-editor__error", children: x }),
2770
- /* @__PURE__ */ g("div", { className: "jp-editor__footer", children: [
2771
- W && !x && /* @__PURE__ */ s("span", { className: "jp-editor__saved", children: "Saved — add companies above, or close." }),
2772
- /* @__PURE__ */ s("button", { type: "button", className: "jp-editor__cancel", onClick: a, children: o ? "Close" : "Cancel" }),
2773
- /* @__PURE__ */ s(
2774
- "button",
2775
- {
2776
- type: "button",
2777
- className: "jp-editor__save",
2778
- onClick: () => {
2779
- le();
2780
- },
2781
- disabled: R || !l.trim(),
2782
- children: R ? "Saving…" : o ? "Save changes" : "Create profile"
2783
- }
2784
- )
2785
- ] })
2786
- ]
2787
- }
2788
- ) });
2789
- }
2790
- const Lr = "/jobplatform/api";
2791
- async function je(e, t, a = {}, n = !1) {
2792
- const r = await fetch(`${Lr}${e}`, {
2793
- ...a,
2794
- headers: O(t, n),
2795
- credentials: "include"
2796
- }), o = await r.json();
2797
- if (!r.ok || !o.success || !o.data)
2798
- throw new ne(o.message ?? o.error ?? `HTTP ${r.status}`, r.status);
2799
- return o.data;
2800
- }
2801
- function la(e, t) {
2802
- return { method: e, body: JSON.stringify(t) };
2803
- }
2804
- async function Uo(e) {
2805
- return (await je("/applicant-profile", e)).profile;
2806
- }
2807
- async function Io(e, t) {
2808
- return (await je(
2809
- "/applicant-profile",
2810
- t,
2811
- la("PUT", { profile: e }),
2812
- !0
2813
- )).updated_at;
2814
- }
2815
- async function Mo(e) {
2816
- return (await je("/blocked-companies", e)).companies;
2817
- }
2818
- async function Tr(e, t) {
2819
- return (await je(
2820
- "/blocked-companies",
2821
- t,
2822
- la("PUT", { company: e }),
2823
- !0
2824
- )).company;
2825
- }
2826
- async function Bo(e, t) {
2827
- await je(
2828
- `/blocked-companies?company=${encodeURIComponent(e)}`,
2829
- t,
2830
- { method: "DELETE" }
2831
- );
2832
- }
2833
- async function Ar(e, t) {
2834
- return (await je(
2835
- `/locations?q=${encodeURIComponent(e)}&limit=8`,
2836
- t
2837
- )).locations;
2838
- }
2839
- async function Ho(e) {
2840
- return je("/insights", e);
2841
- }
2842
- const Or = [10, 25, 50, 100], st = "jobplatform:near";
2843
- function Dr() {
2844
- try {
2845
- const e = window.localStorage.getItem(st);
2846
- if (!e) return null;
2847
- const t = JSON.parse(e);
2848
- return t.place?.key && t.place.label && typeof t.radius == "number" ? { place: t.place, radius: t.radius, includeRemote: t.includeRemote !== !1 } : null;
2849
- } catch {
2850
- return null;
2851
- }
2852
- }
2853
- function Fr(e) {
2854
- try {
2855
- e ? window.localStorage.setItem(st, JSON.stringify(e)) : window.localStorage.removeItem(st);
2856
- } catch {
2857
- }
2858
- }
2859
- function Ur({
2860
- auth: e,
2861
- value: t,
2862
- onChange: a
2863
- }) {
2864
- const n = _a(), [r, o] = N(""), [i, l] = N([]), c = (u) => {
2865
- Fr(u), a(u);
2866
- };
2867
- return z(() => {
2868
- const u = r.trim();
2869
- if (u.length < 2) {
2870
- l([]);
2871
- return;
2872
- }
2873
- let h = !1;
2874
- const d = setTimeout(() => {
2875
- Ar(u, e).then(
2876
- (v) => {
2877
- h || l(v);
2878
- },
2879
- () => {
2880
- }
2881
- );
2882
- }, 200);
2883
- return () => {
2884
- h = !0, clearTimeout(d);
2885
- };
2886
- }, [r, e]), t ? /* @__PURE__ */ g("div", { className: "jp-near", "data-testid": "near-filter", children: [
2887
- /* @__PURE__ */ g("span", { className: "jp-near__chip", children: [
2888
- "Near ",
2889
- t.place.label,
2890
- /* @__PURE__ */ s(
2891
- "button",
2892
- {
2893
- type: "button",
2894
- className: "jp-near__clear",
2895
- "aria-label": `Stop filtering near ${t.place.label}`,
2896
- onClick: () => c(null),
2897
- children: "×"
2898
- }
2899
- )
2900
- ] }),
2901
- /* @__PURE__ */ g("label", { className: "jp-jobs__filter", children: [
2902
- "Within",
2903
- /* @__PURE__ */ s(
2904
- "select",
2905
- {
2906
- value: t.radius,
2907
- onChange: (u) => c({ ...t, radius: Number(u.target.value) }),
2908
- children: Or.map((u) => /* @__PURE__ */ g("option", { value: u, children: [
2909
- u,
2910
- " mi"
2911
- ] }, u))
2912
- }
2913
- )
2914
- ] }),
2915
- /* @__PURE__ */ g("label", { className: "jp-jobs__filter", children: [
2916
- /* @__PURE__ */ s(
2917
- "input",
2918
- {
2919
- type: "checkbox",
2920
- checked: t.includeRemote,
2921
- onChange: (u) => c({ ...t, includeRemote: u.target.checked })
2922
- }
2923
- ),
2924
- "Include remote"
2925
- ] })
2926
- ] }) : /* @__PURE__ */ g("label", { className: "jp-jobs__filter", "data-testid": "near-filter", children: [
2927
- "Near",
2928
- /* @__PURE__ */ s(
2929
- "input",
2930
- {
2931
- type: "search",
2932
- className: "jp-near__input",
2933
- list: n,
2934
- value: r,
2935
- placeholder: "City",
2936
- onChange: (u) => {
2937
- const h = u.target.value, d = i.find((v) => v.label === h);
2938
- d ? (o(""), c({ place: d, radius: 25, includeRemote: !0 })) : o(h);
2939
- }
2940
- }
2941
- ),
2942
- /* @__PURE__ */ s("datalist", { id: n, children: i.map((u) => /* @__PURE__ */ s("option", { value: u.label }, u.key)) })
2943
- ] });
2944
- }
2945
- async function Ir(e, t, a) {
2946
- const n = await Rr(e, t);
2947
- let r = "";
2948
- try {
2949
- r = (await sa(
2950
- e,
2951
- { resume_markdown: n.resume_markdown },
2952
- t
2953
- )).cover_letter_markdown || (await Nr(e, t)).cover_letter_markdown;
2954
- } catch {
2955
- }
2956
- const { url: o, slug: i } = await oa(
2957
- e,
2958
- {
2959
- resume_markdown: n.resume_markdown,
2960
- ...r ? { cover_letter_markdown: r } : {}
2961
- },
2962
- t
2963
- );
2964
- return { slug: i, url: o, resume: n.resume_markdown, coverLetter: r };
2965
- }
2966
- async function Mr(e, t, a) {
2967
- a({ phase: "queueing" });
2968
- try {
2969
- await ia(e, "review", t), a({ phase: "queued" });
2970
- } catch (n) {
2971
- a({
2972
- phase: "error",
2973
- error: n instanceof ne || n instanceof Error ? n.message : "Failed to hand this to the runner"
2974
- });
2975
- }
2976
- }
2977
- const Br = [
2978
- { reason: "pay", label: "Pay too low" },
2979
- { reason: "location", label: "Wrong location" },
2980
- { reason: "stack", label: "Wrong stack" },
2981
- { reason: "domain", label: "Boring domain" },
2982
- { reason: "level", label: "Wrong level" },
2983
- { reason: "company", label: "Company" },
2984
- { reason: "other", label: "Other" }
2985
- ], Hr = [
2986
- { reason: "domain", label: "Exciting domain" },
2987
- { reason: "comp", label: "Great comp" },
2988
- { reason: "fit", label: "Great fit" },
2989
- { reason: "company", label: "Dream company" },
2990
- { reason: "other", label: "Other" }
2991
- ];
2992
- function ca({
2993
- jobId: e,
2994
- auth: t,
2995
- vote: a,
2996
- reasons: n,
2997
- onVoteChange: r,
2998
- disabled: o,
2999
- align: i = "end"
3000
- }) {
3001
- const [l, c] = N(null), u = Te(null), h = (m) => {
3002
- if (a === m) {
3003
- const w = n;
3004
- c(null), r(e, null, []), kr(e).catch(() => r(e, m, w));
3005
- return;
3006
- }
3007
- const f = a, C = n;
3008
- r(e, m, []), xt(e, m, [], t).catch(() => r(e, f, C)), c(m);
3009
- }, d = (m, f) => {
3010
- const C = n, w = C.includes(f) ? C.filter((R) => R !== f) : [...C, f];
3011
- r(e, m, w), xt(e, m, w, t).catch(() => r(e, m, C));
3012
- };
3013
- return /* @__PURE__ */ g(
3014
- "div",
3015
- {
3016
- ref: u,
3017
- className: `jp-vote${i === "start" ? " jp-vote--start" : ""}`,
3018
- onBlur: (m) => {
3019
- u.current?.contains(m.relatedTarget) || c(null);
3020
- },
3021
- onKeyDown: (m) => {
3022
- m.key === "Escape" && l !== null && (m.stopPropagation(), c(null));
3023
- },
3024
- onClick: (m) => m.stopPropagation(),
3025
- children: [
3026
- /* @__PURE__ */ s(
3027
- "button",
3028
- {
3029
- type: "button",
3030
- className: `jp-vote__thumb jp-vote__thumb--up${a === 1 ? " jp-vote__thumb--active" : ""}`,
3031
- disabled: o,
3032
- onClick: () => h(1),
3033
- "aria-pressed": a === 1,
3034
- "aria-label": a === 1 ? "Clear upvote" : "Upvote",
3035
- title: a === 1 ? "Clear upvote" : "Upvote",
3036
- "data-testid": "vote-up",
3037
- children: "👍"
3038
- }
3039
- ),
3040
- /* @__PURE__ */ s(
3041
- "button",
3042
- {
3043
- type: "button",
3044
- className: `jp-vote__thumb jp-vote__thumb--down${a === -1 ? " jp-vote__thumb--active" : ""}`,
3045
- disabled: o,
3046
- onClick: () => h(-1),
3047
- "aria-pressed": a === -1,
3048
- "aria-label": a === -1 ? "Clear downvote" : "Downvote",
3049
- title: a === -1 ? "Clear downvote" : "Downvote",
3050
- "data-testid": "vote-down",
3051
- children: "👎"
3052
- }
3053
- ),
3054
- l !== null && /* @__PURE__ */ s("div", { className: "jp-vote__reasons", role: "menu", "aria-label": "Why?", "data-testid": "vote-reasons", children: (l === -1 ? Br : Hr).map(({ reason: m, label: f }) => /* @__PURE__ */ s(
3055
- "button",
3056
- {
3057
- type: "button",
3058
- role: "menuitemcheckbox",
3059
- "aria-checked": n.includes(m),
3060
- className: `jp-vote__reason${n.includes(m) ? " jp-vote__reason--active" : ""}`,
3061
- onClick: () => d(l, m),
3062
- "data-testid": `vote-reason-${m}`,
3063
- children: f
3064
- },
3065
- m
3066
- )) })
3067
- ]
3068
- }
3069
- );
3070
- }
3071
- function Wr(e, t) {
3072
- if (e === null && t === null) return null;
3073
- const a = (n) => n >= 1e3 ? `$${Math.round(n / 1e3)}k` : `$${n}`;
3074
- return e && t ? `${a(e)}–${a(t)}` : a(e ?? t);
3075
- }
3076
- function Jr(e) {
3077
- if (!e) return null;
3078
- const t = new Date(e), a = Math.floor((Date.now() - t.getTime()) / 864e5);
3079
- return a === 0 ? "today" : a === 1 ? "yesterday" : a < 30 ? `${a}d ago` : t.toLocaleDateString();
3080
- }
3081
- const qr = {
3082
- queued: "Queued",
3083
- filled: "Filled",
3084
- approved: "Approved",
3085
- submitted: "Submitted",
3086
- needs_manual: "Needs you",
3087
- failed: "Failed",
3088
- job_closed: "Closed"
3089
- }, Kr = {
3090
- idle: "Apply",
3091
- waiting: "…",
3092
- preparing: "…",
3093
- queueing: "…",
3094
- queued: "Queued",
3095
- error: "Retry"
3096
- };
3097
- function Vr(e) {
3098
- return e >= 0.75 ? "high" : e >= 0.5 ? "mid" : "low";
3099
- }
3100
- function Gr({
3101
- job: e,
3102
- showScore: t,
3103
- auth: a,
3104
- vote: n,
3105
- voteReasons: r,
3106
- onClick: o,
3107
- onVote: i,
3108
- onApply: l,
3109
- applyStatus: c
3110
- }) {
3111
- const u = Wr(e.salary_min, e.salary_max), h = Jr(e.posted_date ?? e.scraped_at), d = t ? Vr(e.score) : null, v = e.state && e.state !== "new", b = e.state !== null && e.state !== void 0, _ = b, m = e.application_status ? "queued" : c?.phase ?? "idle", f = m === "waiting" || m === "preparing" || m === "queueing", C = ["jp-jobcard"];
3112
- d && C.push(`jp-jobcard--score-${d}`), v && C.push(`jp-jobcard--state-${e.state}`), n === -1 && C.push("jp-jobcard--downvoted");
3113
- const w = d ? `jp-jobcard__score jp-jobcard__score--${d}` : "jp-jobcard__score";
3114
- return (
3115
- // Not a <button>: the vote thumbs live inside the card, and buttons can't
3116
- // nest. role+tabIndex+keydown keep it clickable and keyboard-activatable.
3117
- /* @__PURE__ */ g(
3118
- "div",
3119
- {
3120
- role: "button",
3121
- tabIndex: 0,
3122
- className: C.join(" "),
3123
- onClick: o,
3124
- onKeyDown: (R) => {
3125
- R.target === R.currentTarget && (R.key === "Enter" || R.key === " ") && (R.preventDefault(), o());
3126
- },
3127
- children: [
3128
- /* @__PURE__ */ g("div", { className: "jp-jobcard__top", children: [
3129
- /* @__PURE__ */ s("span", { className: "jp-jobcard__title", children: e.title }),
3130
- /* @__PURE__ */ g("div", { className: "jp-jobcard__top-right", children: [
3131
- v && /* @__PURE__ */ s(
3132
- "span",
3133
- {
3134
- className: `jp-jobcard__state jp-jobcard__state--${e.state}`,
3135
- "data-testid": "card-state-badge",
3136
- children: e.state
3137
- }
3138
- ),
3139
- t && /* @__PURE__ */ s("span", { className: w, children: e.score.toFixed(2) }),
3140
- b && /* @__PURE__ */ s(
3141
- ca,
3142
- {
3143
- jobId: e.id,
3144
- auth: a,
3145
- vote: n,
3146
- reasons: r,
3147
- onVoteChange: i
3148
- }
3149
- )
3150
- ] })
3151
- ] }),
3152
- /* @__PURE__ */ g("div", { className: "jp-jobcard__meta", children: [
3153
- /* @__PURE__ */ s("span", { className: "jp-jobcard__company", children: e.company }),
3154
- /* @__PURE__ */ s("span", { className: "jp-jobcard__sep", children: "·" }),
3155
- /* @__PURE__ */ s("span", { children: e.location || "location unknown" }),
3156
- e.workplace_type && e.workplace_type !== "unknown" && /* @__PURE__ */ g(Fe, { children: [
3157
- /* @__PURE__ */ s("span", { className: "jp-jobcard__sep", children: "·" }),
3158
- /* @__PURE__ */ s("span", { children: e.workplace_type })
3159
- ] })
3160
- ] }),
3161
- /* @__PURE__ */ g("div", { className: "jp-jobcard__footer", children: [
3162
- u && /* @__PURE__ */ s("span", { className: "jp-jobcard__salary", children: u }),
3163
- e.url ? /* @__PURE__ */ g(
3164
- "a",
3165
- {
3166
- className: "jp-jobcard__source jp-jobcard__source--link",
3167
- href: e.url,
3168
- target: "_blank",
3169
- rel: "noopener noreferrer",
3170
- onClick: (R) => R.stopPropagation(),
3171
- title: "Open the original posting",
3172
- children: [
3173
- e.source_site,
3174
- " ↗"
3175
- ]
3176
- }
3177
- ) : /* @__PURE__ */ s("span", { className: "jp-jobcard__source", children: "added by hand" }),
3178
- h && /* @__PURE__ */ s("span", { children: h }),
3179
- /* @__PURE__ */ s(
3180
- "button",
3181
- {
3182
- type: "button",
3183
- className: `jp-jobcard__apply jp-jobcard__apply--${m}`,
3184
- "data-testid": "card-apply",
3185
- disabled: !_ || f || m === "queued",
3186
- title: _ ? "Build the application packet and hand it to the form runner" : "Sign in to hand postings to the runner",
3187
- onClick: (R) => {
3188
- R.stopPropagation(), _ && l(e.id);
3189
- },
3190
- children: e.application_status ? qr[e.application_status] : Kr[m]
3191
- }
3192
- )
3193
- ] })
3194
- ]
3195
- }
3196
- )
3197
- );
3198
- }
3199
- const zr = [
3200
- { value: "", label: "All" },
3201
- { value: "new", label: "New" },
3202
- { value: "interested", label: "Interested" },
3203
- { value: "saved", label: "Saved" },
3204
- { value: "applied", label: "Applied" },
3205
- { value: "interviewing", label: "Interviewing" },
3206
- { value: "offered", label: "Offered" },
3207
- { value: "rejected", label: "Rejected" },
3208
- { value: "dismissed", label: "Dismissed" }
3209
- ];
3210
- function Yr({
3211
- auth: e,
3212
- profileId: t,
3213
- onSelect: a,
3214
- refreshKey: n,
3215
- voteOverrides: r,
3216
- onVote: o,
3217
- stateOverrides: i,
3218
- awaitingProfile: l
3219
- }) {
3220
- const [c, u] = N(1), [h, d] = N({}), [v, b] = N("score"), [_, m] = N(""), [f, C] = N(""), [w, R] = N(!0), [L, x] = N(""), [D, W] = N(Dr), B = 25, P = w && f === "", A = !t && v === "score" ? "date" : v, M = fe(
3221
- () => ({
3222
- profile_id: t ?? void 0,
3223
- state: f || void 0,
3224
- page: c,
3225
- limit: B,
3226
- sort: A,
3227
- workplace: L || void 0,
3228
- near: D?.place.key,
3229
- radius_miles: D?.radius,
3230
- include_remote: D?.includeRemote,
3231
- // A posting handed to the runner belongs under Applications and Packets
3232
- // from that point on. Leaving it in the feed offered an Apply button that
3233
- // would queue it a second time.
3234
- hide_queued: !0
3235
- }),
3236
- [t, f, c, B, A, L, D]
3237
- ), {
3238
- data: k,
3239
- loading: F,
3240
- refreshing: H,
3241
- error: T
3242
- } = Ke(`jobs:${n ?? 0}:${JSON.stringify(M)}`, () => br(M), {
3243
- enabled: !l
3244
- }), V = fe(() => k?.jobs ?? [], [k]), G = k?.total ?? 0, oe = T ? T instanceof ne ? T.message : "Failed to load jobs" : null;
3245
- z(() => {
3246
- u(1);
3247
- }, [t, A, f, L, D]);
3248
- const ie = fe(
3249
- () => V.map((E) => i[E.id] ? { ...E, state: i[E.id] } : E),
3250
- [V, i]
3251
- ), ge = fe(() => {
3252
- const E = new Set(
3253
- Object.entries(h).filter(([, j]) => j.phase === "queued").map(([j]) => j)
3254
- );
3255
- let y = P ? ie.filter((j) => j.state !== "dismissed") : ie;
3256
- if (y = y.filter((j) => !E.has(j.id) && !j.application_status), _.trim()) {
3257
- const j = _.toLowerCase();
3258
- y = y.filter(
3259
- (U) => U.title.toLowerCase().includes(j) || U.company.toLowerCase().includes(j) || U.location.toLowerCase().includes(j)
3260
- );
3261
- }
3262
- return y;
3263
- }, [ie, _, P, h]), ve = se(
3264
- (E) => {
3265
- Mr(
3266
- E,
3267
- e,
3268
- (y) => d((j) => ({ ...j, [E]: y }))
3269
- );
3270
- },
3271
- [e]
3272
- ), Ce = fe(() => {
3273
- const E = Object.values(h).filter((y) => y.phase === "error");
3274
- return E.length === 0 ? null : /* @__PURE__ */ s("p", { className: "jp-error", children: E.length === 1 ? E[0].error : `${E.length} postings failed — press Retry.` });
3275
- }, [h]), be = Math.max(1, Math.ceil(G / B)), le = ie.some((E) => E.state !== null && E.state !== void 0);
3276
- return /* @__PURE__ */ g("div", { className: "jp-jobs", children: [
3277
- /* @__PURE__ */ g("div", { className: "jp-jobs__filters", children: [
3278
- /* @__PURE__ */ s(
3279
- "input",
3280
- {
3281
- type: "search",
3282
- placeholder: "Search title / company / location",
3283
- value: _,
3284
- onChange: (E) => m(E.target.value),
3285
- className: "jp-jobs__search"
3286
- }
3287
- ),
3288
- /* @__PURE__ */ g("label", { className: "jp-jobs__filter", children: [
3289
- "Sort",
3290
- /* @__PURE__ */ g("select", { value: A, onChange: (E) => b(E.target.value), children: [
3291
- t && /* @__PURE__ */ s("option", { value: "score", children: "Score" }),
3292
- t && /* @__PURE__ */ s("option", { value: "comp", children: "Comp lens" }),
3293
- t && /* @__PURE__ */ s("option", { value: "interest", children: "Interest lens" }),
3294
- t && /* @__PURE__ */ s("option", { value: "relevance", children: "Relevance lens" }),
3295
- /* @__PURE__ */ s("option", { value: "date", children: "Date" }),
3296
- /* @__PURE__ */ s("option", { value: "salary", children: "Salary" })
3297
- ] })
3298
- ] }),
3299
- /* @__PURE__ */ g("label", { className: "jp-jobs__filter", children: [
3300
- "Workplace",
3301
- /* @__PURE__ */ g(
3302
- "select",
3303
- {
3304
- value: L,
3305
- onChange: (E) => x(E.target.value),
3306
- children: [
3307
- /* @__PURE__ */ s("option", { value: "", children: "All" }),
3308
- /* @__PURE__ */ s("option", { value: "remote", children: "Remote" }),
3309
- /* @__PURE__ */ s("option", { value: "hybrid", children: "Hybrid" }),
3310
- /* @__PURE__ */ s("option", { value: "onsite", children: "Onsite" })
3311
- ]
3312
- }
3313
- )
3314
- ] }),
3315
- /* @__PURE__ */ s(Ur, { auth: e, value: D, onChange: W }),
3316
- le && /* @__PURE__ */ g("label", { className: "jp-jobs__filter", children: [
3317
- "State",
3318
- /* @__PURE__ */ s(
3319
- "select",
3320
- {
3321
- value: f,
3322
- onChange: (E) => C(E.target.value),
3323
- children: zr.map((E) => /* @__PURE__ */ s("option", { value: E.value, children: E.label }, E.value || "all"))
3324
- }
3325
- )
3326
- ] }),
3327
- le && f === "" && /* @__PURE__ */ g("label", { className: "jp-jobs__filter", children: [
3328
- /* @__PURE__ */ s(
3329
- "input",
3330
- {
3331
- type: "checkbox",
3332
- checked: w,
3333
- onChange: (E) => R(E.target.checked)
3334
- }
3335
- ),
3336
- "Hide dismissed"
3337
- ] })
3338
- ] }),
3339
- !t && /* @__PURE__ */ s("p", { className: "jp-muted", children: e.signedIn ? "No profile selected. Showing all jobs, unscored. Pick or create a profile to see its companies’ jobs, scored and ranked." : "Showing every job in the corpus, newest first. Scoring and ranking need a profile, which needs an account." }),
3340
- oe && /* @__PURE__ */ s("p", { className: "jp-error", children: oe }),
3341
- Ce,
3342
- F ? /* @__PURE__ */ s("p", { className: "jp-muted", children: "Loading jobs…" }) : ge.length === 0 ? /* @__PURE__ */ s("p", { className: "jp-muted", children: G === 0 ? "No jobs match your filters." : "No matches for the current search." }) : /* @__PURE__ */ s("ul", { className: "jp-jobs__list", "data-refreshing": H ? "true" : void 0, children: ge.map((E) => {
3343
- const y = r[E.id], j = y ? y.vote : E.vote ?? null, U = y ? y.reasons : E.vote_reasons ?? [];
3344
- return /* @__PURE__ */ s("li", { children: /* @__PURE__ */ s(
3345
- Gr,
3346
- {
3347
- job: E,
3348
- showScore: !!t,
3349
- auth: e,
3350
- vote: j,
3351
- voteReasons: U,
3352
- onClick: () => a(E.id, j),
3353
- onVote: o,
3354
- onApply: ve,
3355
- applyStatus: h[E.id]
3356
- }
3357
- ) }, E.id);
3358
- }) }),
3359
- G > B && /* @__PURE__ */ g("div", { className: "jp-jobs__pagination", children: [
3360
- /* @__PURE__ */ s("button", { type: "button", disabled: c <= 1, onClick: () => u((E) => E - 1), children: "← Prev" }),
3361
- /* @__PURE__ */ g("span", { children: [
3362
- "Page ",
3363
- c,
3364
- " / ",
3365
- be,
3366
- " · ",
3367
- G,
3368
- " total"
3369
- ] }),
3370
- /* @__PURE__ */ s("button", { type: "button", disabled: c >= be, onClick: () => u((E) => E + 1), children: "Next →" })
3371
- ] })
3372
- ] });
3373
- }
3374
- const Qr = /* @__PURE__ */ new Set([
3375
- "a",
3376
- "b",
3377
- "blockquote",
3378
- "br",
3379
- "code",
3380
- "div",
3381
- "em",
3382
- "h1",
3383
- "h2",
3384
- "h3",
3385
- "h4",
3386
- "h5",
3387
- "h6",
3388
- "hr",
3389
- "i",
3390
- "li",
3391
- "ol",
3392
- "p",
3393
- "pre",
3394
- "span",
3395
- "strong",
3396
- "sub",
3397
- "sup",
3398
- "table",
3399
- "tbody",
3400
- "td",
3401
- "th",
3402
- "thead",
3403
- "tr",
3404
- "u",
3405
- "ul"
3406
- ]), Xr = /* @__PURE__ */ new Set([
3407
- "script",
3408
- "style",
3409
- "iframe",
3410
- "object",
3411
- "embed",
3412
- "noscript",
3413
- "template",
3414
- "svg",
3415
- "math",
3416
- "head",
3417
- "title",
3418
- "form",
3419
- "select",
3420
- "textarea",
3421
- "button"
3422
- ]);
3423
- function Zr(e) {
3424
- if (!e) return null;
3425
- try {
3426
- const t = new URL(e, "https://invalid.example/");
3427
- return t.origin === "https://invalid.example" ? null : t.protocol === "https:" || t.protocol === "http:" ? t.href : null;
3428
- } catch {
3429
- return null;
3430
- }
3431
- }
3432
- function it(e, t, a) {
3433
- for (const n of Array.from(e.childNodes)) {
3434
- if (n.nodeType === Node.TEXT_NODE) {
3435
- t.appendChild(a.createTextNode(n.textContent ?? ""));
3436
- continue;
3437
- }
3438
- if (n.nodeType !== Node.ELEMENT_NODE) continue;
3439
- const r = n, o = r.tagName.toLowerCase();
3440
- if (Xr.has(o)) continue;
3441
- if (!Qr.has(o)) {
3442
- it(r, t, a);
3443
- continue;
3444
- }
3445
- const i = a.createElement(o);
3446
- if (o === "a") {
3447
- const l = Zr(r.getAttribute("href"));
3448
- l && (i.setAttribute("href", l), i.setAttribute("target", "_blank"), i.setAttribute("rel", "noopener noreferrer nofollow"));
3449
- }
3450
- it(r, i, a), t.appendChild(i);
3451
- }
3452
- }
3453
- function eo(e) {
3454
- const t = new DOMParser().parseFromString(e, "text/html"), a = document.implementation.createHTMLDocument(""), n = a.createElement("div");
3455
- return it(t.body, n, a), n.innerHTML;
3456
- }
3457
- const to = me(
3458
- () => import("./ApplicationTracking-bbzp3tjm.js").then((e) => ({ default: e.ApplicationTracking }))
3459
- ), ao = me(
3460
- () => import("./ClipboardPalette-BQPzevMu.js").then((e) => ({ default: e.ClipboardPalette }))
3461
- ), Tt = {
3462
- relevance: "Relevance",
3463
- level_match: "Level",
3464
- geo_fit: "Geo/Remote",
3465
- comp_fit: "Comp",
3466
- stack_fit: "Stack",
3467
- domain_interest: "Interest",
3468
- discipline_factor: "Discipline"
3469
- }, no = [
3470
- [
3471
- { state: "interested", label: "Interested", verb: "Mark interested" },
3472
- { state: "saved", label: "Saved", verb: "Save" },
3473
- { state: "dismissed", label: "Dismissed", verb: "Dismiss" }
3474
- ],
3475
- [
3476
- { state: "applied", label: "Applied", verb: "Mark applied" },
3477
- { state: "interviewing", label: "Interviewing", verb: "Interviewing" },
3478
- { state: "offered", label: "Offered", verb: "Offer" },
3479
- { state: "rejected", label: "Rejected", verb: "Rejected" }
3480
- ]
3481
- ];
3482
- function ro({ text: e }) {
3483
- return e ? /<(p|br|div|li|ul|ol|h[1-6])\b/i.test(e) ? /* @__PURE__ */ s(
3484
- "div",
3485
- {
3486
- className: "jp-drawer__description",
3487
- dangerouslySetInnerHTML: { __html: eo(e) }
3488
- }
3489
- ) : /* @__PURE__ */ s("div", { className: "jp-drawer__description jp-drawer__description--plain", children: e }) : /* @__PURE__ */ s("p", { className: "jp-drawer__description jp-muted", children: /* @__PURE__ */ s("em", { children: "No description" }) });
3490
- }
3491
- function ce({
3492
- label: e,
3493
- value: t,
3494
- rows: a = 4,
3495
- hint: n
3496
- }) {
3497
- const [r, o] = N(!1), i = Te(null);
3498
- return z(
3499
- () => () => {
3500
- i.current && clearTimeout(i.current);
3501
- },
3502
- []
3503
- ), /* @__PURE__ */ g("div", { className: "jp-drawer__kit-field", children: [
3504
- /* @__PURE__ */ g("div", { className: "jp-drawer__kit-field-head", children: [
3505
- /* @__PURE__ */ s("span", { className: "jp-drawer__kit-field-label", children: e }),
3506
- n && /* @__PURE__ */ s("span", { className: "jp-muted jp-drawer__kit-field-hint", children: n }),
3507
- /* @__PURE__ */ s("button", { type: "button", className: "jp-drawer__kit-copy", onClick: () => {
3508
- navigator.clipboard?.writeText(t).then(() => {
3509
- o(!0), i.current && clearTimeout(i.current), i.current = setTimeout(() => o(!1), 2e3);
3510
- });
3511
- }, children: r ? "Copied ✓" : "Copy" })
3512
- ] }),
3513
- /* @__PURE__ */ s(
3514
- "textarea",
3515
- {
3516
- className: "jp-drawer__packet-text",
3517
- readOnly: !0,
3518
- rows: a,
3519
- value: t,
3520
- onFocus: (c) => c.currentTarget.select()
3521
- }
3522
- )
3523
- ] });
3524
- }
3525
- function oo({ tier: e, verified: t }) {
3526
- if (t)
3527
- return /* @__PURE__ */ s("p", { className: "jp-apply-tier jp-apply-tier--verified", children: "Auto-apply verified — the runner has filled a form on this board before." });
3528
- const n = {
3529
- supported: "The runner should be able to fill this form; it has not driven this board yet.",
3530
- embedded: "This employer hosts its own careers page, but the form underneath is one the runner knows. Not tried on this board yet.",
3531
- unsupported: "No adapter for this ATS — this one is by hand.",
3532
- unknown: null
3533
- }[e];
3534
- return n ? /* @__PURE__ */ s("p", { className: `jp-apply-tier jp-apply-tier--${e}`, children: n }) : null;
3535
- }
3536
- function so({
3537
- auth: e,
3538
- jobId: t,
3539
- profileId: a,
3540
- initialVote: n,
3541
- onClose: r,
3542
- onStateChange: o,
3543
- onVoteChange: i,
3544
- onTrackingChange: l,
3545
- onCompanyBlocked: c
3546
- }) {
3547
- const [u, h] = N(null), [d, v] = N(null), [b, _] = N(null), [m, f] = N(n ?? null), [C, w] = N([]), [R, L] = N(!1), [x, D] = N(null), [W, B] = N(null), [P, A] = N(null), [M, k] = N(null), [F, H] = N(!1), [T, V] = N(null), [G, oe] = N(null), [ie, ge] = N(!1), [ve, Ce] = N(!1), [be, le] = N(null), [E, y] = N(null), [j, U] = N(!1), [de, Pe] = N(!1), [pe, gt] = N(!1), {
3548
- data: $,
3549
- loading: ua,
3550
- error: Ve
3551
- } = Ke(
3552
- `job:${t}:${a ?? ""}`,
3553
- () => wr(t, a ?? void 0)
3554
- ), vt = u ?? (Ve ? Ve instanceof ne ? Ve.message : "Failed to load job" : null);
3555
- z(() => {
3556
- h(null), v(null), f(n ?? null), D(null), B(null), A(null), k(null), V(null), oe(null), Ce(!1), le(null), y(null), U(!1), gt(!1);
3557
- }, [t, a, n]), z(() => {
3558
- $ && v($.state);
3559
- }, [$]), z(() => {
3560
- const S = (J) => {
3561
- J.key === "Escape" && r();
3562
- };
3563
- return window.addEventListener("keydown", S), () => window.removeEventListener("keydown", S);
3564
- }, [r]);
3565
- const da = async (S) => {
3566
- if (!b) {
3567
- _(S), h(null);
3568
- try {
3569
- const te = await _r(t, S, e, S === "applied" ? G ?? void 0 : void 0);
3570
- v(te.state), Le(`job:${t}:`), o?.(t, te.state);
3571
- } catch (J) {
3572
- h(J instanceof ne ? J.message : "Failed to update state");
3573
- } finally {
3574
- _(null);
3575
- }
3576
- }
3577
- }, bt = async () => {
3578
- if (R) return null;
3579
- L(!0), B(null), k(null), A(null), V(null), oe(null), y(null), U(!1);
3580
- try {
3581
- const S = await Ir(t, e, () => {
3582
- });
3583
- D({ resume: S.resume, coverLetter: S.coverLetter }), V(S.url), oe(S.slug);
3584
- try {
3585
- const J = await sa(t, { resume_markdown: S.resume }, e);
3586
- A(J);
3587
- } catch (J) {
3588
- k(
3589
- J instanceof ne ? J.message : "Failed to generate the application kit"
3590
- );
3591
- }
3592
- return S.slug;
3593
- } catch (S) {
3594
- return B(S instanceof ne ? S.message : "Failed to generate résumé"), null;
3595
- } finally {
3596
- L(!1);
3597
- }
3598
- }, pa = () => {
3599
- bt();
3600
- }, ha = async () => {
3601
- if (!(!x || F)) {
3602
- H(!0), y(null);
3603
- try {
3604
- const { url: S, slug: J } = await oa(
3605
- t,
3606
- { resume_markdown: x.resume, cover_letter_markdown: x.coverLetter },
3607
- e
3608
- );
3609
- V(S), oe(J);
3610
- } catch (S) {
3611
- y(S instanceof ne ? S.message : "Failed to create link");
3612
- } finally {
3613
- H(!1);
3614
- }
3615
- }
3616
- };
3617
- async function fa() {
3618
- ge(!0), le(null);
3619
- try {
3620
- if (!(G ?? await bt())) {
3621
- le(
3622
- "The application packet could not be built, so there is nothing to queue — see the error above."
3623
- );
3624
- return;
3625
- }
3626
- await ia(t, "review", e), Ce(!0);
3627
- } catch (S) {
3628
- le(S instanceof ne ? S.message : "Failed to queue the application");
3629
- } finally {
3630
- ge(!1);
3631
- }
3632
- }
3633
- const ma = async () => {
3634
- if (!(!$ || de)) {
3635
- Pe(!0), h(null);
3636
- try {
3637
- await Tr($.company, e), gt(!0), Le("blocked-companies"), c?.($.company);
3638
- } catch (S) {
3639
- h(S instanceof ne ? S.message : "Failed to hide the company");
3640
- } finally {
3641
- Pe(!1);
3642
- }
3643
- }
3644
- }, ya = () => {
3645
- T && navigator.clipboard?.writeText(T).then(
3646
- () => {
3647
- U(!0), setTimeout(() => U(!1), 2e3);
3648
- },
3649
- () => y("Copy failed — select the link and copy manually")
3650
- );
3651
- }, we = d !== null;
3652
- return /* @__PURE__ */ g(Fe, { children: [
3653
- /* @__PURE__ */ s("div", { className: "jp-drawer-backdrop", onClick: r }),
3654
- /* @__PURE__ */ g("aside", { className: "jp-drawer", role: "dialog", "aria-labelledby": "jp-drawer-title", children: [
3655
- /* @__PURE__ */ s("div", { className: "jp-drawer__header", children: /* @__PURE__ */ s("button", { type: "button", className: "jp-drawer__close", onClick: r, "aria-label": "Close", children: "×" }) }),
3656
- ua && /* @__PURE__ */ s("p", { className: "jp-muted", children: "Loading…" }),
3657
- vt && /* @__PURE__ */ s("p", { className: "jp-error", children: vt }),
3658
- $ && /* @__PURE__ */ g(Fe, { children: [
3659
- /* @__PURE__ */ s("h2", { id: "jp-drawer-title", className: "jp-drawer__title", children: $.title }),
3660
- /* @__PURE__ */ g("p", { className: "jp-drawer__company", children: [
3661
- $.company,
3662
- " · ",
3663
- $.location || "location unknown",
3664
- $.workplace_type && $.workplace_type !== "unknown" && ` · ${$.workplace_type}`
3665
- ] }),
3666
- /* @__PURE__ */ g("div", { className: "jp-drawer__facts", children: [
3667
- /* @__PURE__ */ s("span", { children: $.source_site }),
3668
- $.job_type && $.job_type !== "unknown" && /* @__PURE__ */ s("span", { children: $.job_type }),
3669
- ($.salary_min || $.salary_max) && /* @__PURE__ */ g("span", { children: [
3670
- "$",
3671
- $.salary_min ?? "?",
3672
- " – $",
3673
- $.salary_max ?? "?"
3674
- ] }),
3675
- $.posted_date && /* @__PURE__ */ g("span", { children: [
3676
- "Posted ",
3677
- $.posted_date
3678
- ] }),
3679
- d && d !== "new" && /* @__PURE__ */ s(
3680
- "span",
3681
- {
3682
- className: `jp-drawer__facts-state jp-drawer__facts-state--${d}`,
3683
- "data-testid": "drawer-state-badge",
3684
- children: d
3685
- }
3686
- )
3687
- ] }),
3688
- a && /* @__PURE__ */ g("section", { className: "jp-drawer__section", children: [
3689
- /* @__PURE__ */ s("h3", { children: "Score breakdown" }),
3690
- /* @__PURE__ */ g("div", { className: "jp-drawer__score-total", children: [
3691
- "Total: ",
3692
- /* @__PURE__ */ s("strong", { children: $.score.toFixed(2) })
3693
- ] }),
3694
- /* @__PURE__ */ s("ul", { className: "jp-drawer__breakdown", children: Object.keys(Tt).map((S) => /* @__PURE__ */ g("li", { children: [
3695
- /* @__PURE__ */ s("span", { className: "jp-drawer__breakdown-label", children: Tt[S] }),
3696
- /* @__PURE__ */ s("div", { className: "jp-drawer__breakdown-bar", children: /* @__PURE__ */ s(
3697
- "div",
3698
- {
3699
- className: "jp-drawer__breakdown-fill",
3700
- style: { width: `${Math.min(100, $.score_breakdown[S] * 100)}%` }
3701
- }
3702
- ) }),
3703
- /* @__PURE__ */ s("span", { className: "jp-drawer__breakdown-value", children: $.score_breakdown[S].toFixed(2) })
3704
- ] }, S)) })
3705
- ] }),
3706
- /* @__PURE__ */ g("section", { className: "jp-drawer__section", children: [
3707
- /* @__PURE__ */ s("h3", { children: "Description" }),
3708
- /* @__PURE__ */ s(ro, { text: $.description })
3709
- ] }),
3710
- /* @__PURE__ */ g("section", { className: "jp-drawer__section", children: [
3711
- /* @__PURE__ */ s("h3", { children: "Triage" }),
3712
- !we && /* @__PURE__ */ s("p", { className: "jp-muted", children: "Sign in to track your interest in this job." }),
3713
- /* @__PURE__ */ s("div", { className: "jp-drawer__vote", children: /* @__PURE__ */ s(
3714
- ca,
3715
- {
3716
- jobId: t,
3717
- auth: e,
3718
- vote: m,
3719
- reasons: C,
3720
- disabled: !we,
3721
- align: "start",
3722
- onVoteChange: (S, J, te) => {
3723
- f(J), w(te), i?.(S, J, te);
3724
- }
3725
- }
3726
- ) }),
3727
- no.map((S, J) => /* @__PURE__ */ s("div", { className: "jp-drawer__actions jp-drawer__actions--states", children: S.map(({ state: te, label: ga, verb: va }) => {
3728
- const Ge = d === te, ba = b === te;
3729
- return /* @__PURE__ */ s(
3730
- "button",
3731
- {
3732
- type: "button",
3733
- className: `jp-drawer__cta jp-drawer__cta--state-${te}${Ge ? " jp-drawer__cta--active" : ""}`,
3734
- disabled: !we || b !== null,
3735
- onClick: () => {
3736
- da(te);
3737
- },
3738
- "aria-pressed": Ge,
3739
- "data-testid": `state-action-${te}`,
3740
- children: ba ? "…" : Ge ? ga : va
3741
- },
3742
- te
3743
- );
3744
- }) }, J)),
3745
- we && /* @__PURE__ */ s("p", { className: "jp-drawer__block", children: pe ? /* @__PURE__ */ g("span", { "data-testid": "company-blocked", children: [
3746
- $.company,
3747
- " is hidden from your feed. Undo it on the Profile tab."
3748
- ] }) : /* @__PURE__ */ s(
3749
- "button",
3750
- {
3751
- type: "button",
3752
- className: "jp-drawer__link",
3753
- onClick: () => {
3754
- ma();
3755
- },
3756
- disabled: de,
3757
- "data-testid": "block-company",
3758
- children: de ? "Hiding…" : `Hide every ${$.company} posting from my feed`
3759
- }
3760
- ) })
3761
- ] }),
3762
- d && d !== "new" && /* @__PURE__ */ s(tt, { fallback: /* @__PURE__ */ s("p", { className: "jp-muted", children: "Loading tracking…" }), children: /* @__PURE__ */ s(
3763
- to,
3764
- {
3765
- auth: e,
3766
- jobId: t,
3767
- state: d,
3768
- tracking: $.tracking,
3769
- onChanged: () => l?.()
3770
- },
3771
- t
3772
- ) }),
3773
- /* @__PURE__ */ g("section", { className: "jp-drawer__section", children: [
3774
- /* @__PURE__ */ s("h3", { children: "Apply" }),
3775
- /* @__PURE__ */ s(oo, { tier: $.apply_tier, verified: $.apply_verified }),
3776
- we && /* @__PURE__ */ s(tt, { fallback: null, children: /* @__PURE__ */ s(ao, { auth: e }) }),
3777
- /* @__PURE__ */ g("div", { className: "jp-drawer__actions", children: [
3778
- ($.application_url ?? $.url) && /* @__PURE__ */ g(
3779
- "a",
3780
- {
3781
- className: "jp-drawer__cta jp-drawer__cta--primary",
3782
- href: $.application_url ?? $.url ?? void 0,
3783
- target: "_blank",
3784
- rel: "noopener noreferrer",
3785
- children: [
3786
- "Apply on ",
3787
- $.source_site
3788
- ]
3789
- }
3790
- ),
3791
- /* @__PURE__ */ s(
3792
- "button",
3793
- {
3794
- type: "button",
3795
- className: "jp-drawer__cta",
3796
- onClick: pa,
3797
- disabled: !we || R,
3798
- "data-testid": "prepare-application",
3799
- children: R ? "Preparing…" : x ? "Regenerate application" : "Prepare application"
3800
- }
3801
- )
3802
- ] }),
3803
- W && /* @__PURE__ */ s("p", { className: "jp-error", children: W }),
3804
- /* @__PURE__ */ g("div", { className: "jp-drawer__apply", children: [
3805
- /* @__PURE__ */ s(
3806
- "button",
3807
- {
3808
- type: "button",
3809
- className: "jp-drawer__cta jp-drawer__cta--primary",
3810
- onClick: () => {
3811
- fa();
3812
- },
3813
- disabled: !we || ie || ve || R,
3814
- "data-testid": "queue-application",
3815
- title: G ? "Queue this application for the form runner" : "Builds the application packet, then queues it for the form runner",
3816
- children: ve ? "Queued ✓" : ie ? G ? "Queueing…" : "Preparing, then queueing…" : "Hand to runner"
3817
- }
3818
- ),
3819
- /* @__PURE__ */ s("span", { className: "jp-muted", children: ve ? "Fills, then waits for your approval." : "Review mode — nothing is sent without your approval." })
3820
- ] }),
3821
- be && /* @__PURE__ */ s("p", { className: "jp-error", children: be }),
3822
- x && /* @__PURE__ */ g("div", { className: "jp-drawer__packet", children: [
3823
- /* @__PURE__ */ s(ce, { label: "Tailored résumé", value: x.resume, rows: 12 }),
3824
- x.coverLetter && /* @__PURE__ */ s(ce, { label: "Cover letter", value: x.coverLetter, rows: 12 }),
3825
- /* @__PURE__ */ s("div", { className: "jp-drawer__packet-link", children: T ? /* @__PURE__ */ g(Fe, { children: [
3826
- /* @__PURE__ */ s(
3827
- "input",
3828
- {
3829
- className: "jp-drawer__packet-link-input",
3830
- readOnly: !0,
3831
- value: T,
3832
- onFocus: (S) => S.currentTarget.select(),
3833
- "aria-label": "Shareable packet link"
3834
- }
3835
- ),
3836
- /* @__PURE__ */ s("button", { type: "button", className: "jp-drawer__cta", onClick: ya, children: j ? "Copied ✓" : "Copy" }),
3837
- /* @__PURE__ */ s(
3838
- "a",
3839
- {
3840
- className: "jp-drawer__cta",
3841
- href: T,
3842
- target: "_blank",
3843
- rel: "noopener noreferrer",
3844
- children: "Open"
3845
- }
3846
- )
3847
- ] }) : /* @__PURE__ */ s(
3848
- "button",
3849
- {
3850
- type: "button",
3851
- className: "jp-drawer__cta jp-drawer__cta--primary",
3852
- onClick: () => {
3853
- ha();
3854
- },
3855
- disabled: F || !x.coverLetter,
3856
- children: F ? "Creating link…" : "Create shareable link"
3857
- }
3858
- ) }),
3859
- E && /* @__PURE__ */ s("p", { className: "jp-error", children: E }),
3860
- R && !P && /* @__PURE__ */ s("p", { className: "jp-muted", children: "Preparing the rest of the kit…" }),
3861
- M && /* @__PURE__ */ s("p", { className: "jp-error", children: M }),
3862
- P && /* @__PURE__ */ g("div", { className: "jp-drawer__kit", children: [
3863
- /* @__PURE__ */ s(ce, { label: "Intro email", value: P.intro_email, rows: 8 }),
3864
- /* @__PURE__ */ s(ce, { label: "Why this role", value: P.why_hook, rows: 3 }),
3865
- P.screening_answers.map((S, J) => /* @__PURE__ */ s(ce, { label: S.q, value: S.a, rows: 4 }, J)),
3866
- /* @__PURE__ */ s(
3867
- ce,
3868
- {
3869
- label: "Expected compensation",
3870
- value: P.salary_line,
3871
- rows: 2
3872
- }
3873
- ),
3874
- /* @__PURE__ */ s(
3875
- ce,
3876
- {
3877
- label: "LinkedIn note",
3878
- value: P.linkedin_note,
3879
- rows: 3,
3880
- hint: `${P.linkedin_note.length}/300`
3881
- }
3882
- ),
3883
- /* @__PURE__ */ s(
3884
- ce,
3885
- {
3886
- label: "Phone-screen talking points",
3887
- value: P.talking_points.map((S) => `• ${S}`).join(`
3888
- `),
3889
- rows: Math.max(3, P.talking_points.length)
3890
- }
3891
- ),
3892
- /* @__PURE__ */ s(
3893
- ce,
3894
- {
3895
- label: "Standard fields",
3896
- value: P.standard_fields,
3897
- rows: 8,
3898
- hint: "name · contact · work auth"
3899
- }
3900
- )
3901
- ] })
3902
- ] })
3903
- ] })
3904
- ] })
3905
- ] })
3906
- ] });
3907
- }
3908
- const io = me(
3909
- () => import("./ApplicationsList-CFkiDX0c.js").then((e) => ({ default: e.ApplicationsList }))
3910
- ), lo = me(
3911
- () => import("./PacketsList-DItubaj_.js").then((e) => ({ default: e.PacketsList }))
3912
- ), co = me(
3913
- () => import("./PacketDetail-DsXglN6f.js").then((e) => ({ default: e.PacketDetail }))
3914
- ), uo = me(
3915
- () => import("./PipelineBoard-DMvVuVsB.js").then((e) => ({ default: e.PipelineBoard }))
3916
- ), po = me(
3917
- () => import("./InsightsPage-D0C-YVru.js").then((e) => ({ default: e.InsightsPage }))
3918
- ), ho = me(
3919
- () => import("./ProfilePage-fP4Xtxnl.js").then((e) => ({ default: e.ProfilePage }))
3920
- ), fo = /* @__PURE__ */ s("p", { className: "jp-muted", children: "Loading…" });
3921
- function mo(e = {}) {
3922
- const t = Te(null);
3923
- return /* @__PURE__ */ s(Na, { theme: e.theme, containerRef: t, children: /* @__PURE__ */ s(yo, { ...e, containerRef: t }) });
3924
- }
3925
- function yo(e) {
3926
- const { containerRef: t } = e, a = !!e.userType && e.userType !== "public", n = fe(() => ({ signedIn: a }), [a]), [r] = N(() => window.matchMedia ? window.matchMedia("(prefers-color-scheme: dark)").matches : !1), { theme: o, isDarkTheme: i, isThemeReady: l, isInitialThemeLoad: c } = ja();
3927
- return c && !l ? /* @__PURE__ */ s(ka, { isDarkTheme: r }) : /* @__PURE__ */ s(
3928
- "main",
3929
- {
3930
- ref: t,
3931
- className: "job-platform-container",
3932
- "data-theme": o,
3933
- "data-dark-theme": i ? "true" : "false",
3934
- children: /* @__PURE__ */ s(Yn, { children: /* @__PURE__ */ g("div", { className: "job-platform", children: [
3935
- /* @__PURE__ */ s(Ra, { title: e.appName ?? "Job Platform" }),
3936
- /* @__PURE__ */ s(go, {}),
3937
- /* @__PURE__ */ s(tt, { fallback: fo, children: /* @__PURE__ */ g(jn, { children: [
3938
- /* @__PURE__ */ g(Y, { element: /* @__PURE__ */ s(Ro, { auth: n }), children: [
3939
- /* @__PURE__ */ s(Y, { index: !0, element: null }),
3940
- /* @__PURE__ */ s(Y, { path: "jobs/:jobId", element: /* @__PURE__ */ s(At, { auth: n, base: "/" }) })
3941
- ] }),
3942
- /* @__PURE__ */ g(Y, { path: "pipeline", element: /* @__PURE__ */ s(vo, { auth: n }), children: [
3943
- /* @__PURE__ */ s(Y, { index: !0, element: null }),
3944
- /* @__PURE__ */ s(
3945
- Y,
3946
- {
3947
- path: "jobs/:jobId",
3948
- element: /* @__PURE__ */ s(At, { auth: n, base: "/pipeline" })
3949
- }
3950
- )
3951
- ] }),
3952
- /* @__PURE__ */ s(Y, { path: "applications", element: /* @__PURE__ */ s(bo, { auth: n }) }),
3953
- /* @__PURE__ */ s(Y, { path: "packets", element: /* @__PURE__ */ s(wo, { auth: n }) }),
3954
- /* @__PURE__ */ s(
3955
- Y,
3956
- {
3957
- path: "insights",
3958
- element: /* @__PURE__ */ s("section", { className: "jp-main", children: /* @__PURE__ */ s(po, { auth: n }) })
3959
- }
3960
- ),
3961
- /* @__PURE__ */ s(
3962
- Y,
3963
- {
3964
- path: "profile",
3965
- element: /* @__PURE__ */ s("section", { className: "jp-main", children: /* @__PURE__ */ s(ho, { auth: n }) })
3966
- }
3967
- ),
3968
- /* @__PURE__ */ s(Y, { path: "packets/:jobId/:slug", element: /* @__PURE__ */ s(_o, { auth: n }) }),
3969
- /* @__PURE__ */ s(Y, { path: "*", element: /* @__PURE__ */ s(Zt, { to: "/", replace: !0 }) })
3970
- ] }) })
3971
- ] }) })
3972
- }
3973
- );
3974
- }
3975
- function go() {
3976
- const { pathname: e } = ee(), t = e.startsWith("/packets") ? "packets" : e.startsWith("/applications") ? "applications" : e.startsWith("/pipeline") ? "pipeline" : e.startsWith("/insights") ? "insights" : e.startsWith("/profile") ? "profile" : "feed";
3977
- return /* @__PURE__ */ g("nav", { className: "job-platform__nav", children: [
3978
- /* @__PURE__ */ s(he, { to: "/", className: t === "feed" ? "active" : void 0, children: "Feed" }),
3979
- /* @__PURE__ */ s(he, { to: "/pipeline", className: t === "pipeline" ? "active" : void 0, children: "Pipeline" }),
3980
- /* @__PURE__ */ s(he, { to: "/applications", className: t === "applications" ? "active" : void 0, children: "Applications" }),
3981
- /* @__PURE__ */ s(he, { to: "/packets", className: t === "packets" ? "active" : void 0, children: "Packets" }),
3982
- /* @__PURE__ */ s(he, { to: "/insights", className: t === "insights" ? "active" : void 0, children: "Insights" }),
3983
- /* @__PURE__ */ s(he, { to: "/profile", className: t === "profile" ? "active" : void 0, children: "Profile" })
3984
- ] });
3985
- }
3986
- function vo({ auth: e }) {
3987
- const t = ye(), [a, n] = N(0), r = se(() => n((i) => i + 1), []), o = fe(
3988
- () => ({ onJobStateChanged: r, onTrackingChanged: r }),
3989
- [r]
3990
- );
3991
- return /* @__PURE__ */ g("section", { className: "jp-main", children: [
3992
- /* @__PURE__ */ s(
3993
- uo,
3994
- {
3995
- auth: e,
3996
- reloadKey: a,
3997
- onSelect: (i) => {
3998
- t(`/pipeline/jobs/${encodeURIComponent(i)}`);
3999
- }
4000
- }
4001
- ),
4002
- /* @__PURE__ */ s(ea, { context: o })
4003
- ] });
4004
- }
4005
- function bo({ auth: e }) {
4006
- return /* @__PURE__ */ s("section", { className: "jp-main", children: /* @__PURE__ */ s(io, { auth: e }) });
4007
- }
4008
- function wo({ auth: e }) {
4009
- const t = ye();
4010
- return /* @__PURE__ */ s("section", { className: "jp-main", children: /* @__PURE__ */ s(
4011
- lo,
4012
- {
4013
- auth: e,
4014
- onSelect: (a) => {
4015
- t(
4016
- `/packets/${encodeURIComponent(a.job_id)}/${encodeURIComponent(a.variant_slug)}`
4017
- );
4018
- }
4019
- }
4020
- ) });
4021
- }
4022
- function _o({ auth: e }) {
4023
- const { jobId: t, slug: a } = zt(), n = ye();
4024
- return !t || !a ? /* @__PURE__ */ s(Zt, { to: "/packets", replace: !0 }) : /* @__PURE__ */ s(co, { auth: e, jobId: t, slug: a, onClose: () => {
4025
- n("/packets");
4026
- } });
4027
- }
4028
- const lt = "jobplatform:last-profile";
4029
- function ko() {
4030
- try {
4031
- return window.localStorage.getItem(lt);
4032
- } catch {
4033
- return null;
4034
- }
4035
- }
4036
- function Ro({ auth: e }) {
4037
- const [t, a] = ra(), n = ye(), r = se(
4038
- (P) => {
4039
- try {
4040
- P ? window.localStorage.setItem(lt, P) : window.localStorage.removeItem(lt);
4041
- } catch {
4042
- }
4043
- a(
4044
- (A) => {
4045
- const M = new URLSearchParams(A);
4046
- return P ? M.set("profile", P) : M.delete("profile"), M;
4047
- },
4048
- { replace: !0 }
4049
- );
4050
- },
4051
- [a]
4052
- ), [o] = N(() => t.get("profile") ? null : ko());
4053
- z(() => {
4054
- o && !t.get("profile") && r(o);
4055
- }, [o, t, r]);
4056
- const i = t.get("profile") ?? o, [l, c] = N(!1), u = se((P) => c(P === 0), []), h = e.signedIn && !i && !l, [d, v] = N(0), b = se(() => {
4057
- Le("jobs:"), v((P) => P + 1);
4058
- }, []), [_, m] = N({}), f = se(
4059
- (P, A) => m((M) => ({ ...M, [P]: A })),
4060
- []
4061
- ), [C, w] = N({}), R = se(
4062
- (P, A, M) => {
4063
- w((k) => ({ ...k, [P]: { vote: A, reasons: M } }));
4064
- },
4065
- []
4066
- ), [L, x] = N(null), [D, W] = N(0), B = fe(
4067
- () => ({ onJobStateChanged: f, onJobVoted: R, onCompanyBlocked: b }),
4068
- [f, R, b]
4069
- );
4070
- return /* @__PURE__ */ g("div", { className: "jp-dashboard", children: [
4071
- /* @__PURE__ */ s(
4072
- vr,
4073
- {
4074
- auth: e,
4075
- selectedId: i,
4076
- onSelect: r,
4077
- onNew: () => x({ mode: "new" }),
4078
- onEdit: (P) => x({ mode: "edit", profile: P }),
4079
- reloadKey: D,
4080
- onResolved: u
4081
- }
4082
- ),
4083
- /* @__PURE__ */ s("section", { className: "jp-main", children: /* @__PURE__ */ s(
4084
- Yr,
4085
- {
4086
- auth: e,
4087
- profileId: i,
4088
- refreshKey: d,
4089
- voteOverrides: C,
4090
- onVote: R,
4091
- stateOverrides: _,
4092
- awaitingProfile: h,
4093
- onSelect: (P, A) => {
4094
- const M = i ? `?profile=${encodeURIComponent(i)}` : "";
4095
- n(`/jobs/${encodeURIComponent(P)}${M}`, { state: { vote: A } });
4096
- }
4097
- }
4098
- ) }),
4099
- /* @__PURE__ */ s(ea, { context: B }),
4100
- L && /* @__PURE__ */ s(
4101
- $r,
4102
- {
4103
- auth: e,
4104
- initial: L.mode === "edit" ? L.profile : null,
4105
- onClose: () => x(null),
4106
- onSaved: (P) => {
4107
- W((A) => A + 1), r(P.id), b();
4108
- },
4109
- onCompaniesChanged: b
4110
- }
4111
- )
4112
- ] });
4113
- }
4114
- function At({ auth: e, base: t }) {
4115
- const { jobId: a } = zt(), [n] = ra(), r = n.get("profile"), o = ye(), i = ee(), l = cn();
4116
- if (!a) return null;
4117
- const c = i.state?.vote ?? null;
4118
- return /* @__PURE__ */ s(
4119
- so,
4120
- {
4121
- auth: e,
4122
- jobId: a,
4123
- profileId: r,
4124
- initialVote: c,
4125
- onClose: () => {
4126
- const h = r ? `?profile=${encodeURIComponent(r)}` : "";
4127
- o(`${t}${h}`);
4128
- },
4129
- onStateChange: (h, d) => l.onJobStateChanged(h, d),
4130
- onVoteChange: l.onJobVoted,
4131
- onTrackingChange: l.onTrackingChanged,
4132
- onCompanyBlocked: l.onCompanyBlocked
4133
- }
4134
- );
4135
- }
4136
- function Wo(e, t = {}) {
4137
- const a = wa(e);
4138
- a.render(/* @__PURE__ */ s(mo, { ...t })), e.__root = a, Ot.info("[job-platform] Mounted successfully", { theme: t.theme });
4139
- }
4140
- function Jo(e) {
4141
- e.__root?.unmount(), Ot.info("[job-platform] Unmounted successfully");
4142
- }
4143
- export {
4144
- ro as D,
4145
- ne as J,
4146
- Ao as a,
4147
- Fo as b,
4148
- $o as c,
4149
- Lo as d,
4150
- xo as e,
4151
- Do as f,
4152
- wr as g,
4153
- _r as h,
4154
- Le as i,
4155
- Ho as j,
4156
- Uo as k,
4157
- To as l,
4158
- Mo as m,
4159
- Io as n,
4160
- Tr as o,
4161
- Bo as p,
4162
- je as q,
4163
- la as r,
4164
- Oo as s,
4165
- Wo as t,
4166
- Ke as u,
4167
- Jo as v
4168
- };