@velastack/patterns 0.0.6 → 0.0.8

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,15 +1,15 @@
1
- import re from "prettier";
2
- import ae from "prettier-plugin-svelte";
3
- function oe(t) {
1
+ import Qt from "prettier";
2
+ import te from "prettier-plugin-svelte";
3
+ function ee(t) {
4
4
  return t.language === "ts" || t.language === "svelte" || t.path.endsWith(".json");
5
5
  }
6
- async function se(t) {
7
- if (!oe(t))
6
+ async function ne(t) {
7
+ if (!ee(t))
8
8
  return t;
9
9
  try {
10
- const e = await re.format(t.content, {
10
+ const e = await Qt.format(t.content, {
11
11
  filepath: t.path,
12
- plugins: [ae]
12
+ plugins: [te]
13
13
  });
14
14
  return {
15
15
  ...t,
@@ -20,7 +20,7 @@ async function se(t) {
20
20
  }
21
21
  }
22
22
  async function ct(t) {
23
- return Promise.all(t.map((e) => se(e)));
23
+ return Promise.all(t.map((e) => ne(e)));
24
24
  }
25
25
  async function k(t) {
26
26
  const [e, n] = await Promise.all([
@@ -37,8 +37,8 @@ function mt(t, e) {
37
37
  var n = Object.keys(t);
38
38
  if (Object.getOwnPropertySymbols) {
39
39
  var r = Object.getOwnPropertySymbols(t);
40
- e && (r = r.filter(function(a) {
41
- return Object.getOwnPropertyDescriptor(t, a).enumerable;
40
+ e && (r = r.filter(function(o) {
41
+ return Object.getOwnPropertyDescriptor(t, o).enumerable;
42
42
  })), n.push.apply(n, r);
43
43
  }
44
44
  return n;
@@ -47,21 +47,21 @@ function ut(t) {
47
47
  for (var e = 1; e < arguments.length; e++) {
48
48
  var n = arguments[e] != null ? arguments[e] : {};
49
49
  e % 2 ? mt(Object(n), !0).forEach(function(r) {
50
- ie(t, r, n[r]);
50
+ re(t, r, n[r]);
51
51
  }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : mt(Object(n)).forEach(function(r) {
52
52
  Object.defineProperty(t, r, Object.getOwnPropertyDescriptor(n, r));
53
53
  });
54
54
  }
55
55
  return t;
56
56
  }
57
- function ie(t, e, n) {
58
- return e = le(e), e in t ? Object.defineProperty(t, e, { value: n, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = n, t;
57
+ function re(t, e, n) {
58
+ return e = ae(e), e in t ? Object.defineProperty(t, e, { value: n, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = n, t;
59
59
  }
60
- function le(t) {
61
- var e = ce(t, "string");
60
+ function ae(t) {
61
+ var e = oe(t, "string");
62
62
  return typeof e == "symbol" ? e : String(e);
63
63
  }
64
- function ce(t, e) {
64
+ function oe(t, e) {
65
65
  if (typeof t != "object" || t === null) return t;
66
66
  var n = t[Symbol.toPrimitive];
67
67
  if (n !== void 0) {
@@ -71,20 +71,20 @@ function ce(t, e) {
71
71
  }
72
72
  return (e === "string" ? String : Number)(t);
73
73
  }
74
- const p = zt({});
75
- function zt(t) {
76
- return e.withOptions = (n) => zt(ut(ut({}, t), n)), e;
74
+ const p = Rt({});
75
+ function Rt(t) {
76
+ return e.withOptions = (n) => Rt(ut(ut({}, t), n)), e;
77
77
  function e(n, ...r) {
78
- const a = typeof n == "string" ? [n] : n.raw, {
78
+ const o = typeof n == "string" ? [n] : n.raw, {
79
79
  alignValues: s = !1,
80
80
  escapeSpecialCharacters: i = Array.isArray(n),
81
- trimWhitespace: o = !0
81
+ trimWhitespace: a = !0
82
82
  } = t;
83
83
  let c = "";
84
- for (let f = 0; f < a.length; f++) {
85
- let g = a[f];
84
+ for (let f = 0; f < o.length; f++) {
85
+ let g = o[f];
86
86
  if (i && (g = g.replace(/\\\n[ \t]*/g, "").replace(/\\`/g, "`").replace(/\\\$/g, "$").replace(/\\\{/g, "{")), c += g, f < r.length) {
87
- const x = s ? me(r[f], c) : r[f];
87
+ const x = s ? se(r[f], c) : r[f];
88
88
  c += x;
89
89
  }
90
90
  }
@@ -103,7 +103,7 @@ function zt(t) {
103
103
  c = m.map((g) => g[0] === " " || g[0] === " " ? g.slice(f) : g).join(`
104
104
  `);
105
105
  }
106
- return o && (c = c.trim()), i && (c = c.replace(/\\n/g, `
106
+ return a && (c = c.trim()), i && (c = c.replace(/\\n/g, `
107
107
  `).replace(/\\t/g, " ").replace(/\\r/g, "\r").replace(/\\v/g, "\v").replace(/\\b/g, "\b").replace(/\\f/g, "\f").replace(/\\0/g, "\0").replace(/\\x([\da-fA-F]{2})/g, (f, g) => String.fromCharCode(parseInt(g, 16))).replace(/\\u\{([\da-fA-F]{1,6})\}/g, (f, g) => String.fromCodePoint(parseInt(g, 16))).replace(/\\u([\da-fA-F]{4})/g, (f, g) => String.fromCharCode(parseInt(g, 16)))), typeof Bun < "u" && (c = c.replace(
108
108
  // Matches e.g. \\u{1f60a} or \\u5F1F
109
109
  /\\u(?:\{([\da-fA-F]{1,6})\}|([\da-fA-F]{4}))/g,
@@ -115,20 +115,20 @@ function zt(t) {
115
115
  )), c;
116
116
  }
117
117
  }
118
- function me(t, e) {
118
+ function se(t, e) {
119
119
  if (typeof t != "string" || !t.includes(`
120
120
  `))
121
121
  return t;
122
122
  const r = e.slice(e.lastIndexOf(`
123
123
  `) + 1).match(/^(\s+)/);
124
124
  if (r) {
125
- const a = r[1];
125
+ const o = r[1];
126
126
  return t.replace(/\n/g, `
127
- ${a}`);
127
+ ${o}`);
128
128
  }
129
129
  return t;
130
130
  }
131
- function Dt(t, e) {
131
+ function Et(t, e) {
132
132
  return t.startsWith(e) ? t.slice(e.length) : t.replace(/^\.\//, "");
133
133
  }
134
134
  function j(t) {
@@ -147,7 +147,7 @@ function pt(t) {
147
147
  }
148
148
  );
149
149
  }
150
- const ue = {
150
+ const ie = {
151
151
  text: ["form", "input"],
152
152
  number: ["form", "input"],
153
153
  email: ["form", "input"],
@@ -162,7 +162,7 @@ const ue = {
162
162
  url: ["form", "input"],
163
163
  editor: ["form", "textarea"],
164
164
  autodate: ["form", "input"]
165
- }, pe = {
165
+ }, le = {
166
166
  form: ['import * as Form from "$lib/components/ui/form";'],
167
167
  "file-form": ['import * as FileForm from "$lib/components/ui/file-form";'],
168
168
  multiselect: [
@@ -176,13 +176,13 @@ const ue = {
176
176
  geopoint: ['import { GeopointInput } from "$lib/components/ui/geopoint";'],
177
177
  button: ['import { Button } from "$lib/components/ui/button";']
178
178
  };
179
- function R(t) {
179
+ function M(t) {
180
180
  return `$formData.${t.name}`;
181
181
  }
182
- function L(t) {
182
+ function O(t) {
183
183
  return t.inputProps ? Object.entries(t.inputProps).flatMap(([e, n]) => n == null || n === !1 ? [] : n === !0 ? [` ${e}`] : [` ${e}=${JSON.stringify(String(n))}`]).join("") : "";
184
184
  }
185
- function P(t) {
185
+ function R(t) {
186
186
  return t.labelAside ? p`
187
187
  <div class="flex justify-between">
188
188
  <Form.Label>${t.title}</Form.Label>
@@ -190,68 +190,68 @@ function P(t) {
190
190
  </div>
191
191
  ` : `<Form.Label>${t.title}</Form.Label>`;
192
192
  }
193
- function z(t, e) {
193
+ function T(t, e) {
194
194
  const n = t.required ? " required" : "";
195
195
  return p`
196
196
  <Form.Field {form} name="${t.name}" class="col-span-1">
197
197
  <Form.Control>
198
198
  {#snippet children({ props })}
199
- ${P(t)}
200
- <Input {...props} type="${e}" bind:value={${R(t)}}${n}${L(t)} />
199
+ ${R(t)}
200
+ <Input {...props} type="${e}" bind:value={${M(t)}}${n}${O(t)} />
201
201
  {/snippet}
202
202
  </Form.Control>
203
203
  <Form.FieldErrors class="contents text-destructive" />
204
204
  </Form.Field>
205
205
  `;
206
206
  }
207
- function de(t) {
207
+ function ce(t) {
208
208
  const e = t.required ? " required" : "";
209
209
  return p`
210
210
  <Form.Field {form} name="${t.name}" class="col-span-2">
211
211
  <Form.Control>
212
212
  {#snippet children({ props })}
213
- ${P(t)}
214
- <Textarea {...props} bind:value={${R(t)}}${e}${L(t)} />
213
+ ${R(t)}
214
+ <Textarea {...props} bind:value={${M(t)}}${e}${O(t)} />
215
215
  {/snippet}
216
216
  </Form.Control>
217
217
  <Form.FieldErrors class="contents text-destructive" />
218
218
  </Form.Field>
219
219
  `;
220
220
  }
221
- function fe(t) {
221
+ function me(t) {
222
222
  const e = t.required ? " required" : "";
223
223
  return p`
224
224
  <Form.Field {form} name="${t.name}" class="col-span-1 flex items-start space-x-2">
225
225
  <Form.Control>
226
226
  {#snippet children({ props })}
227
- <Checkbox {...props} bind:checked={${R(t)}}${e}${L(t)} />
228
- ${P(t)}
227
+ <Checkbox {...props} bind:checked={${M(t)}}${e}${O(t)} />
228
+ ${R(t)}
229
229
  {/snippet}
230
230
  </Form.Control>
231
231
  <Form.FieldErrors class="contents text-destructive" />
232
232
  </Form.Field>
233
233
  `;
234
234
  }
235
- function he(t) {
235
+ function ue(t) {
236
236
  return p`
237
237
  <Form.Field {form} name="${t.name}" class="col-span-1">
238
238
  <Form.Control>
239
239
  {#snippet children({ props })}
240
- ${P(t)}
241
- <GeopointInput {...props} bind:value={${R(t)}} />
240
+ ${R(t)}
241
+ <GeopointInput {...props} bind:value={${M(t)}} />
242
242
  {/snippet}
243
243
  </Form.Control>
244
244
  <Form.FieldErrors class="contents text-destructive" />
245
245
  </Form.Field>
246
246
  `;
247
247
  }
248
- function ge(t) {
248
+ function pe(t) {
249
249
  const e = t.required ? " required" : "", n = t.maxSelect > 1 ? "Multiple" : "Single";
250
250
  return p`
251
251
  <FileForm.Field {form} name="${t.name}" class="col-span-1">
252
252
  <Form.Control>
253
253
  {#snippet children({ props })}
254
- ${P(t)}
254
+ ${R(t)}
255
255
  <FileForm.${n}>
256
256
  {#snippet display({ file, filename, onremove })}
257
257
  <div class="flex gap-2 justify-between items-center">
@@ -263,7 +263,7 @@ function ge(t) {
263
263
  </div>
264
264
  {/snippet}
265
265
  {#snippet input()}
266
- <FileForm.Input {...props}${e}${L(t)} />
266
+ <FileForm.Input {...props}${e}${O(t)} />
267
267
  {/snippet}
268
268
  </FileForm.${n}>
269
269
  {/snippet}
@@ -272,8 +272,8 @@ function ge(t) {
272
272
  </FileForm.Field>
273
273
  `;
274
274
  }
275
- function be(t) {
276
- const e = t.maxSelect > 1 ? "multiple" : "single", n = t.required ? " required" : "", r = t.maxSelect > 1 ? "Select options" : "Select an option", a = t.options.map(
275
+ function de(t) {
276
+ const e = t.maxSelect > 1 ? "multiple" : "single", n = t.required ? " required" : "", r = t.maxSelect > 1 ? "Select options" : "Select an option", o = t.options.map(
277
277
  (s) => `<MultiSelect.Item value=${JSON.stringify(s.value)} label={${t.name}Labels[${JSON.stringify(s.value)}].label} />`
278
278
  ).join(`
279
279
  `);
@@ -281,9 +281,9 @@ function be(t) {
281
281
  <MultiSelect.Field {form} type="${e}" name="${t.name}"${n} class="col-span-1">
282
282
  <Form.Control>
283
283
  {#snippet children({ props })}
284
- ${P(t)}
284
+ ${R(t)}
285
285
  <MultiSelect.Trigger class="w-full justify-between">
286
- <MultiSelect.Input bind:value={${R(t)}} placeholder="${r}" {...props}>
286
+ <MultiSelect.Input bind:value={${M(t)}} placeholder="${r}" {...props}>
287
287
  {#snippet children({ selected })}
288
288
  <div class="flex flex-wrap gap-1">
289
289
  {#each selected as value}
@@ -301,7 +301,7 @@ function be(t) {
301
301
  <Command.Input autofocus placeholder="Search..." />
302
302
  <Command.Empty>No options found</Command.Empty>
303
303
  <Command.Group>
304
- ${a}
304
+ ${o}
305
305
  </Command.Group>
306
306
  </Command.Root>
307
307
  </MultiSelect.Content>
@@ -310,15 +310,15 @@ function be(t) {
310
310
  </MultiSelect.Field>
311
311
  `;
312
312
  }
313
- function ve(t) {
314
- const e = t.maxSelect > 1 ? "multiple" : "single", n = t.maxSelect > 1 ? `Select ${t.relatedModel.pluralDisplayName.toLowerCase()}` : `Select ${t.relatedModel.displayName.toLowerCase()}`, r = `Search ${t.relatedModel.pluralDisplayName.toLowerCase()}...`, a = `No ${t.relatedModel.pluralDisplayName.toLowerCase()} found`, s = t.relatedModel.name, i = t.relatedModel.pluralName;
313
+ function fe(t) {
314
+ const e = t.maxSelect > 1 ? "multiple" : "single", n = t.maxSelect > 1 ? `Select ${t.relatedModel.pluralDisplayName.toLowerCase()}` : `Select ${t.relatedModel.displayName.toLowerCase()}`, r = `Search ${t.relatedModel.pluralDisplayName.toLowerCase()}...`, o = `No ${t.relatedModel.pluralDisplayName.toLowerCase()} found`, s = t.relatedModel.name, i = t.relatedModel.pluralName;
315
315
  return p`
316
316
  <MultiSelect.Field {form} type="${e}" name="${t.name}" class="col-span-1">
317
317
  <Form.Control>
318
318
  {#snippet children({ props })}
319
319
  <Form.Label>${t.title}</Form.Label>
320
320
  <MultiSelect.Trigger class="w-full justify-between">
321
- <MultiSelect.Input bind:value={${R(t)}} placeholder="${n}" {...props}>
321
+ <MultiSelect.Input bind:value={${M(t)}} placeholder="${n}" {...props}>
322
322
  {#snippet children({ selected })}
323
323
  <div class="flex flex-wrap gap-1">
324
324
  {#each selected as value}
@@ -335,7 +335,7 @@ function ve(t) {
335
335
  <MultiSelect.Content class="p-0">
336
336
  <Command.Root>
337
337
  <Command.Input autofocus placeholder="${r}" />
338
- <Command.Empty>${a}</Command.Empty>
338
+ <Command.Empty>${o}</Command.Empty>
339
339
  <Command.Group>
340
340
  {#each data.${i} as ${s}}
341
341
  <MultiSelect.Item value={${s}.id} label={${s}.${t.displayField}} />
@@ -348,13 +348,13 @@ function ve(t) {
348
348
  </MultiSelect.Field>
349
349
  `;
350
350
  }
351
- function we(t) {
351
+ function he(t) {
352
352
  return p`
353
353
  <Form.Field {form} name="${t.name}" class="col-span-1">
354
354
  <Form.Control>
355
355
  {#snippet children({ props })}
356
- ${P(t)}
357
- <Input {...props} type="text" value={${R(t)}}${L(t)} readonly />
356
+ ${R(t)}
357
+ <Input {...props} type="text" value={${M(t)}}${O(t)} readonly />
358
358
  {/snippet}
359
359
  </Form.Control>
360
360
  <Form.FieldErrors class="contents text-destructive" />
@@ -364,37 +364,37 @@ function we(t) {
364
364
  function et(t) {
365
365
  switch (t.type) {
366
366
  case "text":
367
- return z(t, "text");
367
+ return T(t, "text");
368
368
  case "number":
369
- return z(t, "number");
369
+ return T(t, "number");
370
370
  case "date":
371
- return z(t, "date");
371
+ return T(t, "date");
372
372
  case "email":
373
- return z(t, "email");
373
+ return T(t, "email");
374
374
  case "password":
375
- return z(t, "password");
375
+ return T(t, "password");
376
376
  case "url":
377
- return z(t, "url");
377
+ return T(t, "url");
378
378
  case "autodate":
379
- return we(t);
379
+ return he(t);
380
380
  case "editor":
381
381
  case "json":
382
- return de(t);
382
+ return ce(t);
383
383
  case "bool":
384
- return fe(t);
384
+ return me(t);
385
385
  case "geoPoint":
386
- return he(t);
386
+ return ue(t);
387
387
  case "file":
388
- return ge(t);
388
+ return pe(t);
389
389
  case "select":
390
- return be(t);
390
+ return de(t);
391
391
  case "relation":
392
- return ve(t);
392
+ return fe(t);
393
393
  default:
394
394
  return t;
395
395
  }
396
396
  }
397
- function At(t) {
397
+ function It(t) {
398
398
  const e = t.options.map(
399
399
  (n) => p`
400
400
  ${JSON.stringify(n.value)}: {
@@ -410,14 +410,14 @@ function At(t) {
410
410
  } as const;
411
411
  `;
412
412
  }
413
- function O(t) {
414
- const e = t.flatMap((n) => ue[n.type]);
413
+ function L(t) {
414
+ const e = t.flatMap((n) => ie[n.type]);
415
415
  return [...new Set(e)];
416
416
  }
417
417
  function nt(t) {
418
- return [...new Set(t.flatMap((e) => pe[e]))];
418
+ return [...new Set(t.flatMap((e) => le[e]))];
419
419
  }
420
- function M(t, e) {
420
+ function P(t, e) {
421
421
  return `data.${t.name}.${e.name}`;
422
422
  }
423
423
  function J(t, e, n) {
@@ -428,8 +428,8 @@ function J(t, e, n) {
428
428
  </div>
429
429
  `;
430
430
  }
431
- function ye(t, e) {
432
- const n = M(t, e), r = `<p class="text-muted-foreground">{new Date(${n}).toLocaleDateString()}</p>`, a = e.required ? r : p`
431
+ function ge(t, e) {
432
+ const n = P(t, e), r = `<p class="text-muted-foreground">{new Date(${n}).toLocaleDateString()}</p>`, o = e.required ? r : p`
433
433
  {#if ${n}}
434
434
  ${r}
435
435
  {/if}
@@ -437,16 +437,16 @@ function ye(t, e) {
437
437
  return p`
438
438
  <div class="space-y-2">
439
439
  <h3 class="font-medium leading-none">${e.title}</h3>
440
- ${a}
440
+ ${o}
441
441
  </div>
442
442
  `;
443
443
  }
444
- function xe(t, e) {
445
- const n = M(t, e), r = p`
444
+ function be(t, e) {
445
+ const n = P(t, e), r = p`
446
446
  <a href={${n}} target="_blank" rel="noopener noreferrer">
447
447
  {${n}}
448
448
  </a>
449
- `, a = e.required ? r : p`
449
+ `, o = e.required ? r : p`
450
450
  {#if ${n}}
451
451
  ${r}
452
452
  {/if}
@@ -455,13 +455,13 @@ function xe(t, e) {
455
455
  <div class="space-y-2">
456
456
  <h3 class="font-medium leading-none">${e.title}</h3>
457
457
  <p class="text-muted-foreground">
458
- ${a}
458
+ ${o}
459
459
  </p>
460
460
  </div>
461
461
  `;
462
462
  }
463
- function $e(t, e) {
464
- const n = M(t, e);
463
+ function ve(t, e) {
464
+ const n = P(t, e);
465
465
  if (e.maxSelect > 1)
466
466
  return p`
467
467
  <div class="space-y-2">
@@ -471,7 +471,7 @@ function $e(t, e) {
471
471
  {/each}
472
472
  </div>
473
473
  `;
474
- const r = `<Badge variant="outline" class="mr-1">{${e.name}Labels[${n}].label}</Badge>`, a = e.required ? r : p`
474
+ const r = `<Badge variant="outline" class="mr-1">{${e.name}Labels[${n}].label}</Badge>`, o = e.required ? r : p`
475
475
  {#if ${n}}
476
476
  ${r}
477
477
  {/if}
@@ -479,12 +479,12 @@ function $e(t, e) {
479
479
  return p`
480
480
  <div class="space-y-2">
481
481
  <h3 class="font-medium leading-none">${e.title}</h3>
482
- ${a}
482
+ ${o}
483
483
  </div>
484
484
  `;
485
485
  }
486
- function Fe(t, e) {
487
- const n = M(t, e);
486
+ function we(t, e) {
487
+ const n = P(t, e);
488
488
  return e.maxSelect > 1 ? p`
489
489
  <div class="space-y-2">
490
490
  <h3 class="font-medium leading-none">${e.title}</h3>
@@ -529,11 +529,11 @@ function Fe(t, e) {
529
529
  </div>
530
530
  `;
531
531
  }
532
- function Ce(t) {
532
+ function ye(t) {
533
533
  return `/${t.relatedModel.routeSegment}`;
534
534
  }
535
- function _e(t, e) {
536
- const n = `data.${t.name}.expand?.${e.name}`, r = Ce(e);
535
+ function xe(t, e) {
536
+ const n = `data.${t.name}.expand?.${e.name}`, r = ye(e);
537
537
  return e.maxSelect > 1 ? p`
538
538
  <div class="space-y-2">
539
539
  <h3 class="font-medium leading-none">${e.title}</h3>
@@ -560,8 +560,8 @@ function _e(t, e) {
560
560
  </div>
561
561
  `;
562
562
  }
563
- function Se(t, e) {
564
- const n = M(t, e), r = p`
563
+ function $e(t, e) {
564
+ const n = P(t, e), r = p`
565
565
  {#await import("$lib/components/ui/leaflet/leaflet.svelte")}
566
566
  <div class="h-56.25 w-full bg-input rounded-md"></div>
567
567
  {:then { default: Leaflet }}
@@ -570,7 +570,7 @@ function Se(t, e) {
570
570
  <p class="text-muted-foreground">
571
571
  {${n}?.lat.toFixed(6)}, {${n}?.lon.toFixed(6)}
572
572
  </p>
573
- `, a = e.required ? r : p`
573
+ `, o = e.required ? r : p`
574
574
  {#if ${n}}
575
575
  ${r}
576
576
  {/if}
@@ -578,17 +578,17 @@ function Se(t, e) {
578
578
  return p`
579
579
  <div class="space-y-2">
580
580
  <h3 class="font-medium leading-none">${e.title}</h3>
581
- ${a}
581
+ ${o}
582
582
  </div>
583
583
  `;
584
584
  }
585
- function ke(t, e) {
585
+ function Ce(t, e) {
586
586
  switch (e.type) {
587
587
  case "text":
588
588
  case "number":
589
589
  case "email":
590
590
  case "editor":
591
- return J(t, e, `{${M(t, e)}}`);
591
+ return J(t, e, `{${P(t, e)}}`);
592
592
  case "password":
593
593
  return p`
594
594
  <div class="space-y-2">
@@ -602,31 +602,31 @@ function ke(t, e) {
602
602
  return J(
603
603
  t,
604
604
  e,
605
- `{${M(t, e)} ? "Yes" : "No"}`
605
+ `{${P(t, e)} ? "Yes" : "No"}`
606
606
  );
607
607
  case "date":
608
608
  case "autodate":
609
- return ye(t, e);
609
+ return ge(t, e);
610
610
  case "url":
611
- return xe(t, e);
611
+ return be(t, e);
612
612
  case "select":
613
- return $e(t, e);
613
+ return ve(t, e);
614
614
  case "file":
615
- return Fe(t, e);
615
+ return we(t, e);
616
616
  case "json":
617
- return J(t, e, `{JSON.stringify(${M(t, e)})}`);
617
+ return J(t, e, `{JSON.stringify(${P(t, e)})}`);
618
618
  case "geoPoint":
619
- return Se(t, e);
619
+ return $e(t, e);
620
620
  case "relation":
621
- return _e(t, e);
621
+ return xe(t, e);
622
622
  default:
623
623
  return e;
624
624
  }
625
625
  }
626
- const Me = new RegExp("([\\p{Ll}\\d])(\\p{Lu})", "gu"), Re = new RegExp("(\\p{Lu})([\\p{Lu}][\\p{Ll}])", "gu"), Pe = new RegExp("(\\d)\\p{Ll}|(\\p{L})\\d", "u"), Ee = /[^\p{L}\d]+/giu, dt = "$1\0$2", ft = "";
627
- function Nt(t) {
626
+ const Fe = new RegExp("([\\p{Ll}\\d])(\\p{Lu})", "gu"), Se = new RegExp("(\\p{Lu})([\\p{Lu}][\\p{Ll}])", "gu"), _e = new RegExp("(\\d)\\p{Ll}|(\\p{L})\\d", "u"), ke = /[^\p{L}\d]+/giu, dt = "$1\0$2", ft = "";
627
+ function zt(t) {
628
628
  let e = t.trim();
629
- e = e.replace(Me, dt).replace(Re, dt), e = e.replace(Ee, "\0");
629
+ e = e.replace(Fe, dt).replace(Se, dt), e = e.replace(ke, "\0");
630
630
  let n = 0, r = e.length;
631
631
  for (; e.charAt(n) === "\0"; )
632
632
  n++;
@@ -636,38 +636,38 @@ function Nt(t) {
636
636
  r--;
637
637
  return e.slice(n, r).split(/\0/g);
638
638
  }
639
- function Ie(t) {
640
- const e = Nt(t);
639
+ function Pe(t) {
640
+ const e = zt(t);
641
641
  for (let n = 0; n < e.length; n++) {
642
- const r = e[n], a = Pe.exec(r);
643
- if (a) {
644
- const s = a.index + (a[1] ?? a[2]).length;
642
+ const r = e[n], o = _e.exec(r);
643
+ if (o) {
644
+ const s = o.index + (o[1] ?? o[2]).length;
645
645
  e.splice(n, 1, r.slice(0, s), r.slice(s));
646
646
  }
647
647
  }
648
648
  return e;
649
649
  }
650
- function Bt(t, e) {
651
- const [n, r, a] = G(t, e);
652
- return n + r.map(H(e == null ? void 0 : e.locale)).join((e == null ? void 0 : e.delimiter) ?? " ") + a;
650
+ function Tt(t, e) {
651
+ const [n, r, o] = G(t, e);
652
+ return n + r.map(H(e == null ? void 0 : e.locale)).join((e == null ? void 0 : e.delimiter) ?? " ") + o;
653
653
  }
654
654
  function N(t, e) {
655
- const [n, r, a] = G(t, e), s = H(e == null ? void 0 : e.locale), i = at(e == null ? void 0 : e.locale), o = jt(s, i);
656
- return n + r.map((c, m) => m === 0 ? s(c) : o(c, m)).join("") + a;
655
+ const [n, r, o] = G(t, e), s = H(e == null ? void 0 : e.locale), i = at(e == null ? void 0 : e.locale), a = Dt(s, i);
656
+ return n + r.map((c, m) => m === 0 ? s(c) : a(c, m)).join("") + o;
657
657
  }
658
- function Te(t, e) {
659
- const [n, r, a] = G(t, e), s = H(e == null ? void 0 : e.locale), i = at(e == null ? void 0 : e.locale), o = jt(s, i);
660
- return n + r.map(o).join("") + a;
658
+ function Me(t, e) {
659
+ const [n, r, o] = G(t, e), s = H(e == null ? void 0 : e.locale), i = at(e == null ? void 0 : e.locale), a = Dt(s, i);
660
+ return n + r.map(a).join("") + o;
661
661
  }
662
662
  function rt(t, e) {
663
- const [n, r, a] = G(t, e), s = H(e == null ? void 0 : e.locale), i = at(e == null ? void 0 : e.locale);
664
- return n + r.map(Ae(s, i)).join(" ") + a;
663
+ const [n, r, o] = G(t, e), s = H(e == null ? void 0 : e.locale), i = at(e == null ? void 0 : e.locale);
664
+ return n + r.map(Ie(s, i)).join(" ") + o;
665
665
  }
666
- function ze(t, e) {
667
- return Bt(t, { delimiter: "-", ...e });
666
+ function Re(t, e) {
667
+ return Tt(t, { delimiter: "-", ...e });
668
668
  }
669
- function De(t, e) {
670
- return Bt(t, { delimiter: "_", ...e });
669
+ function Ee(t, e) {
670
+ return Tt(t, { delimiter: "_", ...e });
671
671
  }
672
672
  function H(t) {
673
673
  return t === !1 ? (e) => e.toLowerCase() : (e) => e.toLocaleLowerCase(t);
@@ -675,29 +675,29 @@ function H(t) {
675
675
  function at(t) {
676
676
  return (e) => e.toLocaleUpperCase(t);
677
677
  }
678
- function Ae(t, e) {
678
+ function Ie(t, e) {
679
679
  return (n) => `${e(n[0])}${t(n.slice(1))}`;
680
680
  }
681
- function jt(t, e) {
681
+ function Dt(t, e) {
682
682
  return (n, r) => {
683
- const a = n[0];
684
- return (r > 0 && a >= "0" && a <= "9" ? "_" + a : e(a)) + t(n.slice(1));
683
+ const o = n[0];
684
+ return (r > 0 && o >= "0" && o <= "9" ? "_" + o : e(o)) + t(n.slice(1));
685
685
  };
686
686
  }
687
687
  function G(t, e = {}) {
688
- const n = e.split ?? (e.separateNumbers ? Ie : Nt), r = e.prefixCharacters ?? ft, a = e.suffixCharacters ?? ft;
688
+ const n = e.split ?? (e.separateNumbers ? Pe : zt), r = e.prefixCharacters ?? ft, o = e.suffixCharacters ?? ft;
689
689
  let s = 0, i = t.length;
690
690
  for (; s < t.length; ) {
691
- const o = t.charAt(s);
692
- if (!r.includes(o))
691
+ const a = t.charAt(s);
692
+ if (!r.includes(a))
693
693
  break;
694
694
  s++;
695
695
  }
696
696
  for (; i > s; ) {
697
- const o = i - 1, c = t.charAt(o);
698
- if (!a.includes(c))
697
+ const a = i - 1, c = t.charAt(a);
698
+ if (!o.includes(c))
699
699
  break;
700
- i = o;
700
+ i = a;
701
701
  }
702
702
  return [
703
703
  t.slice(0, s),
@@ -705,20 +705,20 @@ function G(t, e = {}) {
705
705
  t.slice(i)
706
706
  ];
707
707
  }
708
- function Ne(t) {
708
+ function ze(t) {
709
709
  return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
710
710
  }
711
- function Be(t) {
711
+ function Te(t) {
712
712
  throw new Error('Could not dynamically require "' + t + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
713
713
  }
714
- var V = { exports: {} }, je = V.exports, ht;
715
- function Le() {
714
+ var V = { exports: {} }, De = V.exports, ht;
715
+ function Ae() {
716
716
  return ht || (ht = 1, (function(t, e) {
717
717
  (function(n, r) {
718
- typeof Be == "function" ? t.exports = r() : n.pluralize = r();
719
- })(je, function() {
720
- var n = [], r = [], a = {}, s = {}, i = {};
721
- function o(l) {
718
+ typeof Te == "function" ? t.exports = r() : n.pluralize = r();
719
+ })(De, function() {
720
+ var n = [], r = [], o = {}, s = {}, i = {};
721
+ function a(l) {
722
722
  return typeof l == "string" ? new RegExp("^" + l + "$", "i") : l;
723
723
  }
724
724
  function c(l, d) {
@@ -731,28 +731,28 @@ function Le() {
731
731
  }
732
732
  function h(l, d) {
733
733
  return l.replace(d[0], function(w, $) {
734
- var F = m(d[1], arguments);
735
- return c(w === "" ? l[$ - 1] : w, F);
734
+ var C = m(d[1], arguments);
735
+ return c(w === "" ? l[$ - 1] : w, C);
736
736
  });
737
737
  }
738
738
  function f(l, d, w) {
739
- if (!l.length || a.hasOwnProperty(l))
739
+ if (!l.length || o.hasOwnProperty(l))
740
740
  return d;
741
741
  for (var $ = w.length; $--; ) {
742
- var F = w[$];
743
- if (F[0].test(d)) return h(d, F);
742
+ var C = w[$];
743
+ if (C[0].test(d)) return h(d, C);
744
744
  }
745
745
  return d;
746
746
  }
747
747
  function g(l, d, w) {
748
748
  return function($) {
749
- var F = $.toLowerCase();
750
- return d.hasOwnProperty(F) ? c($, F) : l.hasOwnProperty(F) ? c($, l[F]) : f(F, $, w);
749
+ var C = $.toLowerCase();
750
+ return d.hasOwnProperty(C) ? c($, C) : l.hasOwnProperty(C) ? c($, l[C]) : f(C, $, w);
751
751
  };
752
752
  }
753
753
  function x(l, d, w, $) {
754
- return function(F) {
755
- var I = F.toLowerCase();
754
+ return function(C) {
755
+ var I = C.toLowerCase();
756
756
  return d.hasOwnProperty(I) ? !0 : l.hasOwnProperty(I) ? !1 : f(I, I, w) === I;
757
757
  };
758
758
  }
@@ -777,12 +777,12 @@ function Le() {
777
777
  i,
778
778
  r
779
779
  ), u.addPluralRule = function(l, d) {
780
- n.push([o(l), d]);
780
+ n.push([a(l), d]);
781
781
  }, u.addSingularRule = function(l, d) {
782
- r.push([o(l), d]);
782
+ r.push([a(l), d]);
783
783
  }, u.addUncountableRule = function(l) {
784
784
  if (typeof l == "string") {
785
- a[l.toLowerCase()] = !0;
785
+ o[l.toLowerCase()] = !0;
786
786
  return;
787
787
  }
788
788
  u.addPluralRule(l, "$0"), u.addSingularRule(l, "$0");
@@ -1011,8 +1011,8 @@ function Le() {
1011
1011
  });
1012
1012
  })(V)), V.exports;
1013
1013
  }
1014
- var Oe = Le();
1015
- const S = /* @__PURE__ */ Ne(Oe), Pa = "data", Ea = "migrations", qe = "(app)", Ue = /* @__PURE__ */ new Set([
1014
+ var Ne = Ae();
1015
+ const _ = /* @__PURE__ */ ze(Ne), Na = "data", Ba = "migrations", Be = "(app)", je = /* @__PURE__ */ new Set([
1016
1016
  "break",
1017
1017
  "case",
1018
1018
  "catch",
@@ -1064,7 +1064,7 @@ const S = /* @__PURE__ */ Ne(Oe), Pa = "data", Ea = "migrations", qe = "(app)",
1064
1064
  "async",
1065
1065
  "arguments",
1066
1066
  "constructor"
1067
- ]), Ve = {
1067
+ ]), Oe = {
1068
1068
  function: "fn",
1069
1069
  interface: "iface",
1070
1070
  type: "type_",
@@ -1114,7 +1114,7 @@ const S = /* @__PURE__ */ Ne(Oe), Pa = "data", Ea = "migrations", qe = "(app)",
1114
1114
  constructor: "ctor"
1115
1115
  };
1116
1116
  function Z(t) {
1117
- return Ue.has(t) ? Ve[t] ?? `${t}_` : t;
1117
+ return je.has(t) ? Oe[t] ?? `${t}_` : t;
1118
1118
  }
1119
1119
  function K(t) {
1120
1120
  if (!/^[a-zA-Z][a-zA-Z0-9-_/]*$/.test(t))
@@ -1122,24 +1122,24 @@ function K(t) {
1122
1122
  "Model path must start with a letter and contain only alphanumeric characters, dash, slash, or underscore"
1123
1123
  );
1124
1124
  }
1125
- function He(t) {
1126
- return t.features.auth ? `src/routes/${qe}` : "src/routes";
1125
+ function Le(t) {
1126
+ return t.features.auth ? `src/routes/${Be}` : "src/routes";
1127
1127
  }
1128
1128
  function E(t, e) {
1129
- const n = t.split("/"), r = n[n.length - 1], a = n.slice(0, -1), s = S.singular(rt(r)), i = S.plural(s), o = N(s), c = ze(i), m = [...a, c].join("/");
1129
+ const n = t.split("/"), r = n[n.length - 1], o = n.slice(0, -1), s = _.singular(rt(r)), i = _.plural(s), a = N(s), c = Re(i), m = [...o, c].join("/");
1130
1130
  return {
1131
- name: Z(o),
1131
+ name: Z(a),
1132
1132
  pluralName: Z(N(i)),
1133
- typeName: Te(s),
1134
- tableName: De(i),
1133
+ typeName: Me(s),
1134
+ tableName: Ee(i),
1135
1135
  displayName: s,
1136
1136
  pluralDisplayName: i,
1137
- schemaName: `${Z(o)}Schema`,
1137
+ schemaName: `${Z(a)}Schema`,
1138
1138
  routeSegment: m,
1139
- routesDir: He(e)
1139
+ routesDir: Le(e)
1140
1140
  };
1141
1141
  }
1142
- function Ge(t) {
1142
+ function qe(t) {
1143
1143
  const e = `${t.routesDir}/${t.routeSegment}`;
1144
1144
  return {
1145
1145
  list: e,
@@ -1148,7 +1148,7 @@ function Ge(t) {
1148
1148
  edit: `${e}/[id]/edit`
1149
1149
  };
1150
1150
  }
1151
- function Ke(t) {
1151
+ function Ue(t) {
1152
1152
  const e = `/${t.routeSegment}`;
1153
1153
  return {
1154
1154
  list: e,
@@ -1157,7 +1157,7 @@ function Ke(t) {
1157
1157
  edit: `${e}/[id]/edit`
1158
1158
  };
1159
1159
  }
1160
- const We = [
1160
+ const Ve = [
1161
1161
  "title",
1162
1162
  "name",
1163
1163
  "label",
@@ -1191,24 +1191,24 @@ const We = [
1191
1191
  "url",
1192
1192
  "id"
1193
1193
  ];
1194
- function Xe(t) {
1195
- for (const e of We)
1194
+ function He(t) {
1195
+ for (const e of Ve)
1196
1196
  if (t.some((n) => n.name === e))
1197
1197
  return e;
1198
1198
  return "id";
1199
1199
  }
1200
- function Ye(t) {
1200
+ function Ge(t) {
1201
1201
  return t.map((e) => e.name).filter((e) => !e.startsWith("_"));
1202
1202
  }
1203
- function Je(t) {
1203
+ function Ke(t) {
1204
1204
  return Object.fromEntries(t.map((e) => [e.name, e.id]));
1205
1205
  }
1206
- function Lt(t) {
1206
+ function At(t) {
1207
1207
  return Object.fromEntries(
1208
- t.map((e) => [e.name, Xe(e.fields)])
1208
+ t.map((e) => [e.name, He(e.fields)])
1209
1209
  );
1210
1210
  }
1211
- const Ze = [
1211
+ const We = [
1212
1212
  "user",
1213
1213
  "owner",
1214
1214
  "created_by",
@@ -1228,12 +1228,12 @@ function gt(t) {
1228
1228
  operator: "="
1229
1229
  };
1230
1230
  }
1231
- function Qe(t, e, n = {}) {
1232
- const r = new Set((n.authCollections ?? ["users"]).map(D)), a = new Set(
1233
- (n.userFieldHints ?? Ze).map(D)
1234
- ), s = n.maxDepth ?? 8, i = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
1231
+ function Xe(t, e, n = {}) {
1232
+ const r = new Set((n.authCollections ?? ["users"]).map(D)), o = new Set(
1233
+ (n.userFieldHints ?? We).map(D)
1234
+ ), s = n.maxDepth ?? 8, i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map();
1235
1235
  for (const b of t)
1236
- i.set(b.name, b), o.set(b.id, b);
1236
+ i.set(b.name, b), a.set(b.id, b);
1237
1237
  if (!i.has(e))
1238
1238
  return gt(e);
1239
1239
  if (r.has(D(e)))
@@ -1245,24 +1245,24 @@ function Qe(t, e, n = {}) {
1245
1245
  };
1246
1246
  function c(b) {
1247
1247
  const v = D(b);
1248
- return v === "user" ? 50 : a.has(v) ? 20 : 0;
1248
+ return v === "user" ? 50 : o.has(v) ? 20 : 0;
1249
1249
  }
1250
1250
  function m(b) {
1251
1251
  const v = i.get(b);
1252
1252
  if (!(v != null && v.fields)) return [];
1253
- const C = [];
1253
+ const F = [];
1254
1254
  for (const y of v.fields) {
1255
1255
  if (y.type !== "relation" || !y.collectionId) continue;
1256
- const T = o.get(y.collectionId);
1257
- T && C.push({
1256
+ const z = a.get(y.collectionId);
1257
+ z && F.push({
1258
1258
  from: b,
1259
1259
  fieldName: y.name,
1260
- to: T.name,
1260
+ to: z.name,
1261
1261
  isMulti: !!(y.maxSelect && y.maxSelect > 1),
1262
1262
  hintScore: c(y.name)
1263
1263
  });
1264
1264
  }
1265
- return C.sort((y, T) => y.fieldName.localeCompare(T.fieldName)), C;
1265
+ return F.sort((y, z) => y.fieldName.localeCompare(z.fieldName)), F;
1266
1266
  }
1267
1267
  function h(b) {
1268
1268
  return r.has(D(b));
@@ -1274,41 +1274,41 @@ function Qe(t, e, n = {}) {
1274
1274
  return h(b[b.length - 1].to);
1275
1275
  }
1276
1276
  function g(b) {
1277
- const v = b[b.length - 1], C = v.isMulti ? 1 : 0, y = b.every((Y) => !Y.isMulti) ? 1 : 0, T = b.reduce((Y, ne) => Y + ne.hintScore, 0), ee = D(v.fieldName) === "user" ? 1 : 0;
1278
- return 100 * b.length + 50 * C - 40 * ee - 15 * y - T;
1277
+ const v = b[b.length - 1], F = v.isMulti ? 1 : 0, y = b.every((Y) => !Y.isMulti) ? 1 : 0, z = b.reduce((Y, Zt) => Y + Zt.hintScore, 0), Jt = D(v.fieldName) === "user" ? 1 : 0;
1278
+ return 100 * b.length + 50 * F - 40 * Jt - 15 * y - z;
1279
1279
  }
1280
1280
  function x(b) {
1281
1281
  return b.map((v) => `${v.from}.${v.fieldName}->${v.to}`).join("|");
1282
1282
  }
1283
1283
  const u = [], l = /* @__PURE__ */ new Set([e]);
1284
- function d(b, v, C) {
1285
- if (!(C > s)) {
1284
+ function d(b, v, F) {
1285
+ if (!(F > s)) {
1286
1286
  if (v.length > 0 && h(v[v.length - 1].to) && f(v)) {
1287
1287
  u.push([...v]);
1288
1288
  return;
1289
1289
  }
1290
1290
  for (const y of m(b))
1291
- l.has(y.to) || y.isMulti && !h(y.to) || (l.add(y.to), v.push(y), d(y.to, v, C + 1), v.pop(), l.delete(y.to));
1291
+ l.has(y.to) || y.isMulti && !h(y.to) || (l.add(y.to), v.push(y), d(y.to, v, F + 1), v.pop(), l.delete(y.to));
1292
1292
  }
1293
1293
  }
1294
1294
  if (d(e, [], 0), u.length === 0)
1295
1295
  return gt(e);
1296
1296
  u.sort((b, v) => {
1297
- const C = g(b) - g(v);
1298
- return C !== 0 ? C : x(b).localeCompare(x(v));
1297
+ const F = g(b) - g(v);
1298
+ return F !== 0 ? F : x(b).localeCompare(x(v));
1299
1299
  });
1300
- const w = u[0], $ = w.map((b) => b.fieldName), F = [e, ...w.map((b) => b.to)], lt = w[w.length - 1].isMulti ? "?=" : "=", Qt = $.join("."), te = n.includeRootPrefix ? (n.rootPrefix ?? e) + "." : "";
1300
+ const w = u[0], $ = w.map((b) => b.fieldName), C = [e, ...w.map((b) => b.to)], lt = w[w.length - 1].isMulti ? "?=" : "=", Xt = $.join("."), Yt = n.includeRootPrefix ? (n.rootPrefix ?? e) + "." : "";
1301
1301
  return {
1302
- rule: `@request.auth.id ${lt} ${te}${Qt}.id`,
1303
- ownershipChainCollections: F,
1302
+ rule: `@request.auth.id ${lt} ${Yt}${Xt}.id`,
1303
+ ownershipChainCollections: C,
1304
1304
  ownershipChainFields: $,
1305
1305
  operator: lt
1306
1306
  };
1307
1307
  }
1308
- function tn(t) {
1308
+ function Ye(t) {
1309
1309
  let e = null, n = !1, r = 0;
1310
- for (let a = 0; a < t.length; a++) {
1311
- const s = t[a];
1310
+ for (let o = 0; o < t.length; o++) {
1311
+ const s = t[o];
1312
1312
  if (n) {
1313
1313
  n = !1;
1314
1314
  continue;
@@ -1334,7 +1334,7 @@ function tn(t) {
1334
1334
  continue;
1335
1335
  }
1336
1336
  if (s === ":" && r === 0)
1337
- return [t.slice(0, a), t.slice(a + 1)];
1337
+ return [t.slice(0, o), t.slice(o + 1)];
1338
1338
  }
1339
1339
  return [t, ""];
1340
1340
  }
@@ -1345,62 +1345,62 @@ function bt(t) {
1345
1345
  function vt(t) {
1346
1346
  let e = -1, n = null, r = !1;
1347
1347
  for (let i = 0; i < t.length; i++) {
1348
- const o = t[i];
1348
+ const a = t[i];
1349
1349
  if (r) {
1350
1350
  r = !1;
1351
1351
  continue;
1352
1352
  }
1353
1353
  if (n) {
1354
- if (o === "\\") {
1354
+ if (a === "\\") {
1355
1355
  r = !0;
1356
1356
  continue;
1357
1357
  }
1358
- o === n && (n = null);
1358
+ a === n && (n = null);
1359
1359
  continue;
1360
1360
  }
1361
- if (o === '"' || o === "'") {
1362
- n = o;
1361
+ if (a === '"' || a === "'") {
1362
+ n = a;
1363
1363
  continue;
1364
1364
  }
1365
- if (o === ":") {
1365
+ if (a === ":") {
1366
1366
  e = i;
1367
1367
  break;
1368
1368
  }
1369
1369
  }
1370
- let a, s;
1371
- return e >= 0 ? (a = t.slice(0, e).trim(), s = t.slice(e + 1).trim()) : (a = t.trim(), s = a), { label: bt(s), value: bt(a) };
1370
+ let o, s;
1371
+ return e >= 0 ? (o = t.slice(0, e).trim(), s = t.slice(e + 1).trim()) : (o = t.trim(), s = o), { label: bt(s), value: bt(o) };
1372
1372
  }
1373
- function en(t) {
1373
+ function Je(t) {
1374
1374
  const e = [];
1375
- let n = "", r = null, a = !1;
1375
+ let n = "", r = null, o = !1;
1376
1376
  for (let i = 0; i < t.length; i++) {
1377
- const o = t[i];
1378
- if (a) {
1379
- n += o, a = !1;
1377
+ const a = t[i];
1378
+ if (o) {
1379
+ n += a, o = !1;
1380
1380
  continue;
1381
1381
  }
1382
1382
  if (r) {
1383
- if (o === "\\") {
1384
- a = !0, n += o;
1383
+ if (a === "\\") {
1384
+ o = !0, n += a;
1385
1385
  continue;
1386
1386
  }
1387
- if (o === r) {
1388
- r = null, n += o;
1387
+ if (a === r) {
1388
+ r = null, n += a;
1389
1389
  continue;
1390
1390
  }
1391
- n += o;
1391
+ n += a;
1392
1392
  continue;
1393
1393
  }
1394
- if (o === '"' || o === "'") {
1395
- r = o, n += o;
1394
+ if (a === '"' || a === "'") {
1395
+ r = a, n += a;
1396
1396
  continue;
1397
1397
  }
1398
- if (o === ",") {
1398
+ if (a === ",") {
1399
1399
  const c = n.trim();
1400
1400
  c.length > 0 && e.push(vt(c)), n = "";
1401
1401
  continue;
1402
1402
  }
1403
- n += o;
1403
+ n += a;
1404
1404
  }
1405
1405
  const s = n.trim();
1406
1406
  return s.length > 0 && e.push(vt(s)), e;
@@ -1418,24 +1418,24 @@ const wt = {
1418
1418
  datetime: "date",
1419
1419
  timestamp: "date"
1420
1420
  };
1421
- function nn(t) {
1421
+ function Ze(t) {
1422
1422
  const e = t.endsWith("!");
1423
1423
  let n = e ? t.slice(0, -1) : t, r = [];
1424
1424
  if (n.startsWith("select(") && n.endsWith(")")) {
1425
- const a = n.slice(7, -1);
1426
- r = en(a), n = "select";
1425
+ const o = n.slice(7, -1);
1426
+ r = Je(o), n = "select";
1427
1427
  }
1428
1428
  return n === "files" ? { type: "file", required: e, selectOptions: r } : (n in wt && (n = wt[n]), { type: n, required: e, selectOptions: r });
1429
1429
  }
1430
1430
  function yt(t) {
1431
- const e = S.singular(t), n = S.plural(e);
1431
+ const e = _.singular(t), n = _.plural(e);
1432
1432
  return t === n ? 99 : 1;
1433
1433
  }
1434
- function q(t, e, n, r, a, s) {
1435
- const i = E(e, s), o = S.singular(t), c = S.plural(o);
1434
+ function q(t, e, n, r, o, s) {
1435
+ const i = E(e, s), a = _.singular(t), c = _.plural(a);
1436
1436
  return {
1437
1437
  collectionId: r[e],
1438
- displayField: a[e] ?? "id",
1438
+ displayField: o[e] ?? "id",
1439
1439
  relatedModel: i,
1440
1440
  singularRelationName: N(
1441
1441
  `${n.displayName} ${i.displayName}`
@@ -1446,22 +1446,22 @@ function q(t, e, n, r, a, s) {
1446
1446
  maxSelect: t === c ? 999 : 1
1447
1447
  };
1448
1448
  }
1449
- function rn(t, e, n, r, a) {
1450
- const s = rt(t), { type: i, required: o, selectOptions: c } = e, m = Ye(r), h = Je(r), f = Lt(r), g = m.map((u) => S.singular(u));
1451
- if (a.features.auth && i === "current_user" && h.users) {
1449
+ function Qe(t, e, n, r, o) {
1450
+ const s = rt(t), { type: i, required: a, selectOptions: c } = e, m = Ge(r), h = Ke(r), f = At(r), g = m.map((u) => _.singular(u));
1451
+ if (o.features.auth && i === "current_user" && h.users) {
1452
1452
  const u = q(
1453
1453
  t,
1454
1454
  "users",
1455
1455
  n,
1456
1456
  h,
1457
1457
  f,
1458
- a
1458
+ o
1459
1459
  );
1460
1460
  return {
1461
1461
  type: "relation",
1462
1462
  name: t,
1463
1463
  title: s,
1464
- required: o,
1464
+ required: a,
1465
1465
  collectionId: u.collectionId,
1466
1466
  maxSelect: 1,
1467
1467
  displayField: u.displayField,
@@ -1477,14 +1477,14 @@ function rn(t, e, n, r, a) {
1477
1477
  throw new Error(
1478
1478
  `Invalid autodate field: ${t}. Must be one of created/created_at/updated/updated_at.`
1479
1479
  );
1480
- return { type: "autodate", name: t, title: s, required: o, onCreate: u, onUpdate: l };
1480
+ return { type: "autodate", name: t, title: s, required: a, onCreate: u, onUpdate: l };
1481
1481
  }
1482
1482
  if (i === "select")
1483
1483
  return {
1484
1484
  type: "select",
1485
1485
  name: t,
1486
1486
  title: s,
1487
- required: o,
1487
+ required: a,
1488
1488
  maxSelect: yt(t),
1489
1489
  options: c
1490
1490
  };
@@ -1493,11 +1493,11 @@ function rn(t, e, n, r, a) {
1493
1493
  type: "file",
1494
1494
  name: t,
1495
1495
  title: s,
1496
- required: o,
1496
+ required: a,
1497
1497
  maxSelect: yt(t)
1498
1498
  };
1499
1499
  if (i === "relation") {
1500
- const u = S.singular(t), l = S.plural(u);
1500
+ const u = _.singular(t), l = _.plural(u);
1501
1501
  if (!m.includes(l))
1502
1502
  throw new Error(
1503
1503
  `Invalid relation field: ${t}. Must be one of ${m.join(", ")} (singular or plural)`
@@ -1508,13 +1508,13 @@ function rn(t, e, n, r, a) {
1508
1508
  n,
1509
1509
  h,
1510
1510
  f,
1511
- a
1511
+ o
1512
1512
  );
1513
1513
  return {
1514
1514
  type: "relation",
1515
1515
  name: t,
1516
1516
  title: s,
1517
- required: o,
1517
+ required: a,
1518
1518
  ...d,
1519
1519
  isCurrentUser: !1
1520
1520
  };
@@ -1526,19 +1526,19 @@ function rn(t, e, n, r, a) {
1526
1526
  n,
1527
1527
  h,
1528
1528
  f,
1529
- a
1529
+ o
1530
1530
  );
1531
1531
  return {
1532
1532
  type: "relation",
1533
1533
  name: t,
1534
1534
  title: s,
1535
- required: o,
1535
+ required: a,
1536
1536
  ...u,
1537
1537
  isCurrentUser: !1
1538
1538
  };
1539
1539
  }
1540
1540
  if (g.includes(i)) {
1541
- const u = S.plural(i);
1541
+ const u = _.plural(i);
1542
1542
  if (m.includes(u)) {
1543
1543
  const l = q(
1544
1544
  t,
@@ -1546,13 +1546,13 @@ function rn(t, e, n, r, a) {
1546
1546
  n,
1547
1547
  h,
1548
1548
  f,
1549
- a
1549
+ o
1550
1550
  );
1551
1551
  return {
1552
1552
  type: "relation",
1553
1553
  name: t,
1554
1554
  title: s,
1555
- required: o,
1555
+ required: a,
1556
1556
  collectionId: l.collectionId,
1557
1557
  displayField: l.displayField,
1558
1558
  relatedModel: l.relatedModel,
@@ -1579,7 +1579,7 @@ function rn(t, e, n, r, a) {
1579
1579
  "select",
1580
1580
  "file",
1581
1581
  "relation",
1582
- ...a.features.auth ? ["current_user"] : [],
1582
+ ...o.features.auth ? ["current_user"] : [],
1583
1583
  ...m
1584
1584
  ])
1585
1585
  ];
@@ -1598,31 +1598,31 @@ function rn(t, e, n, r, a) {
1598
1598
  throw new Error(
1599
1599
  `Invalid field type: ${i}. Valid types are: ${x.join(", ").replace("relation", "references")}`
1600
1600
  );
1601
- return { type: i, name: t, title: s, required: o };
1601
+ return { type: i, name: t, title: s, required: a };
1602
1602
  }
1603
- function an(t, e, n, r) {
1604
- const a = [];
1603
+ function tn(t, e, n, r) {
1604
+ const o = [];
1605
1605
  for (const i of t) {
1606
- const [o, c] = tn(i);
1607
- if (!o || !c)
1606
+ const [a, c] = Ye(i);
1607
+ if (!a || !c)
1608
1608
  throw new Error(
1609
1609
  `Invalid field format: ${i}. Expected format: name:type or name:type!`
1610
1610
  );
1611
- if (!/^[a-zA-Z][a-zA-Z0-9]*$/.test(o))
1611
+ if (!/^[a-zA-Z][a-zA-Z0-9]*$/.test(a))
1612
1612
  throw new Error(
1613
- `Invalid field name: ${o}. Must start with a letter and contain only alphanumeric characters`
1613
+ `Invalid field name: ${a}. Must start with a letter and contain only alphanumeric characters`
1614
1614
  );
1615
- const m = nn(c);
1616
- a.push(rn(o, m, e, n, r));
1615
+ const m = Ze(c);
1616
+ o.push(Qe(a, m, e, n, r));
1617
1617
  }
1618
- const s = r.features.auth ? Qe(
1618
+ const s = r.features.auth ? Xe(
1619
1619
  [
1620
1620
  ...n,
1621
1621
  {
1622
1622
  id: "new",
1623
1623
  name: e.tableName,
1624
1624
  type: "base",
1625
- fields: a.map((i) => ({
1625
+ fields: o.map((i) => ({
1626
1626
  name: i.name,
1627
1627
  type: i.type,
1628
1628
  collectionId: i.type === "relation" ? i.collectionId : void 0,
@@ -1632,20 +1632,20 @@ function an(t, e, n, r) {
1632
1632
  ],
1633
1633
  e.tableName
1634
1634
  ) : void 0;
1635
- return { fields: a, auth: s };
1635
+ return { fields: o, auth: s };
1636
1636
  }
1637
1637
  async function W(t, e, n) {
1638
1638
  let r;
1639
1639
  if (n.env === "runtime") {
1640
- const { getCollections: a } = await import("./env.runtime-wPrXEoHB.js");
1641
- r = await a();
1640
+ const { getCollections: o } = await import("./env.runtime-sHetoQ7B.js");
1641
+ r = await o();
1642
1642
  } else {
1643
- const { getPreviewCollections: a } = await import("./env.preview-HlXZOEL4.js");
1644
- r = a(n);
1643
+ const { getPreviewCollections: o } = await import("./env.preview-HlXZOEL4.js");
1644
+ r = o(n);
1645
1645
  }
1646
- return an(t, e, r, n);
1646
+ return tn(t, e, r, n);
1647
1647
  }
1648
- const on = "2024-01-01T00:00:00.000Z";
1648
+ const en = "2024-01-01T00:00:00.000Z";
1649
1649
  class B {
1650
1650
  constructor(e) {
1651
1651
  this.expression = e;
@@ -1659,7 +1659,7 @@ function Q(t) {
1659
1659
  ([n, r]) => `${JSON.stringify(n)}: ${tt(r)}`
1660
1660
  ).join(", ")} }`;
1661
1661
  }
1662
- function sn(t) {
1662
+ function nn(t) {
1663
1663
  switch (t) {
1664
1664
  case "text":
1665
1665
  case "number":
@@ -1698,8 +1698,8 @@ function sn(t) {
1698
1698
  function A(t, e) {
1699
1699
  return t.replace("[id]", `\${${e}}`);
1700
1700
  }
1701
- function Ot(t, e, n) {
1702
- var r, a, s;
1701
+ function Nt(t, e, n) {
1702
+ var r, o, s;
1703
1703
  switch (t.type) {
1704
1704
  case "text":
1705
1705
  case "editor":
@@ -1709,7 +1709,7 @@ function Ot(t, e, n) {
1709
1709
  case "bool":
1710
1710
  return !0;
1711
1711
  case "date":
1712
- return on;
1712
+ return en;
1713
1713
  case "email":
1714
1714
  return `test-${t.name}@example.com`;
1715
1715
  case "password":
@@ -1721,7 +1721,7 @@ function Ot(t, e, n) {
1721
1721
  case "geoPoint":
1722
1722
  return n.forForm ? JSON.stringify({ lat: 40.7128, lon: -74.006 }) : { lat: 40.7128, lon: -74.006 };
1723
1723
  case "select": {
1724
- const i = ((a = (r = t.options) == null ? void 0 : r[0]) == null ? void 0 : a.value) ?? "default";
1724
+ const i = ((o = (r = t.options) == null ? void 0 : r[0]) == null ? void 0 : o.value) ?? "default";
1725
1725
  return t.maxSelect && t.maxSelect > 1 ? [i] : i;
1726
1726
  }
1727
1727
  case "relation": {
@@ -1739,69 +1739,69 @@ function Ot(t, e, n) {
1739
1739
  }
1740
1740
  function xt(t, e, n) {
1741
1741
  const r = {};
1742
- for (const a of t) {
1743
- if (a.type === "file" || a.type === "autodate")
1742
+ for (const o of t) {
1743
+ if (o.type === "file" || o.type === "autodate")
1744
1744
  continue;
1745
- if (n.authEnabled && a.type === "relation" && a.isCurrentUser) {
1746
- n.forForm || (r[a.name] = new B("context.user.id"));
1745
+ if (n.authEnabled && o.type === "relation" && o.isCurrentUser) {
1746
+ n.forForm || (r[o.name] = new B("context.user.id"));
1747
1747
  continue;
1748
1748
  }
1749
- const s = Ot(a, e, n);
1750
- s !== void 0 && (r[a.name] = s);
1749
+ const s = Nt(o, e, n);
1750
+ s !== void 0 && (r[o.name] = s);
1751
1751
  }
1752
1752
  return r;
1753
1753
  }
1754
- function ln(t, e, n) {
1755
- var a;
1754
+ function rn(t, e, n) {
1755
+ var o;
1756
1756
  const r = {};
1757
1757
  for (const s of t) {
1758
1758
  if (s.system || s.name === "id")
1759
1759
  continue;
1760
- const i = sn(s.type);
1760
+ const i = nn(s.type);
1761
1761
  if (!i || i === "file" || i === "autodate" || i === "relation" && !s.collectionId)
1762
1762
  continue;
1763
- let o;
1763
+ let a;
1764
1764
  if (i === "relation")
1765
- o = s.collectionId ? new B(
1765
+ a = s.collectionId ? new B(
1766
1766
  e[s.collectionId] ?? '"missing-relation-id"'
1767
1767
  ) : void 0;
1768
1768
  else if (i === "select") {
1769
- const c = ((a = s.values) == null ? void 0 : a[0]) ?? "default";
1770
- o = (s.maxSelect ?? 1) > 1 ? [c] : c;
1769
+ const c = ((o = s.values) == null ? void 0 : o[0]) ?? "default";
1770
+ a = (s.maxSelect ?? 1) > 1 ? [c] : c;
1771
1771
  } else
1772
- o = Ot(
1772
+ a = Nt(
1773
1773
  { name: s.name, type: i },
1774
1774
  e,
1775
1775
  { forForm: !1, authEnabled: n.features.auth }
1776
1776
  );
1777
- o !== void 0 && (r[s.name] = o);
1777
+ a !== void 0 && (r[s.name] = a);
1778
1778
  }
1779
1779
  return r;
1780
1780
  }
1781
- function cn(t) {
1781
+ function an(t) {
1782
1782
  t.email = new B(
1783
1783
  "`test-${Math.random().toString(36).slice(2)}@example.com`"
1784
1784
  ), t.password = "password", t.passwordConfirm = "password";
1785
1785
  }
1786
- function mn(t, e) {
1786
+ function on(t, e) {
1787
1787
  if (!t)
1788
1788
  return [];
1789
- const n = new Map(e.map((o) => [o.id, o])), r = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), s = [], i = (o) => {
1790
- if (r.has(o) || a.has(o))
1789
+ const n = new Map(e.map((a) => [a.id, a])), r = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), s = [], i = (a) => {
1790
+ if (r.has(a) || o.has(a))
1791
1791
  return;
1792
- const c = n.get(o);
1792
+ const c = n.get(a);
1793
1793
  if (c) {
1794
- a.add(o);
1794
+ o.add(a);
1795
1795
  for (const m of c.fields)
1796
1796
  m.type !== "relation" || !m.collectionId || i(m.collectionId);
1797
- a.delete(o), r.add(o), s.push(c);
1797
+ o.delete(a), r.add(a), s.push(c);
1798
1798
  }
1799
1799
  };
1800
- for (const o of t.fields)
1801
- o.type !== "relation" || !o.collectionId || i(o.collectionId);
1800
+ for (const a of t.fields)
1801
+ a.type !== "relation" || !a.collectionId || i(a.collectionId);
1802
1802
  return s;
1803
1803
  }
1804
- function un(t, e) {
1804
+ function sn(t, e) {
1805
1805
  if (!e.has(t))
1806
1806
  return e.add(t), t;
1807
1807
  let n = 2;
@@ -1810,7 +1810,7 @@ function un(t, e) {
1810
1810
  const r = `${t}${n}`;
1811
1811
  return e.add(r), r;
1812
1812
  }
1813
- function pn(t, e) {
1813
+ function ln(t, e) {
1814
1814
  return {
1815
1815
  id: `generated-${t.tableName}`,
1816
1816
  name: t.tableName,
@@ -1832,25 +1832,25 @@ function pn(t, e) {
1832
1832
  } : { name: n.name, type: n.type })
1833
1833
  };
1834
1834
  }
1835
- function qt(t, e, n, r) {
1836
- const a = r.find((l) => l.name === t.tableName) ?? pn(t, e), s = mn(a, r).filter(
1835
+ function Bt(t, e, n, r) {
1836
+ const o = r.find((l) => l.name === t.tableName) ?? ln(t, e), s = on(o, r).filter(
1837
1837
  (l) => !(n.features.auth && l.name === "users")
1838
- ), i = {}, o = [], c = /* @__PURE__ */ new Set();
1838
+ ), i = {}, a = [], c = /* @__PURE__ */ new Set();
1839
1839
  for (const l of s) {
1840
- const d = un(E(l.name, n).name, c);
1841
- o.push({ varName: d, collection: l }), i[l.id] = `${d}.id`;
1840
+ const d = sn(E(l.name, n).name, c);
1841
+ a.push({ varName: d, collection: l }), i[l.id] = `${d}.id`;
1842
1842
  }
1843
- const m = o.length ? `${o.map((l) => `let ${l.varName}: { id: string };`).join(`
1843
+ const m = a.length ? `${a.map((l) => `let ${l.varName}: { id: string };`).join(`
1844
1844
  `)}
1845
1845
 
1846
- ` : "", h = o.map(({ varName: l, collection: d }) => {
1847
- const w = ln(
1846
+ ` : "", h = a.map(({ varName: l, collection: d }) => {
1847
+ const w = rn(
1848
1848
  d.fields,
1849
1849
  i,
1850
1850
  n
1851
1851
  );
1852
- return d.type === "auth" && cn(w), `${l} = await context.admin.collection("${d.name}").create(${Q(w)});`;
1853
- }), f = o.slice().reverse().map(
1852
+ return d.type === "auth" && an(w), `${l} = await context.admin.collection("${d.name}").create(${Q(w)});`;
1853
+ }), f = a.slice().reverse().map(
1854
1854
  ({ varName: l, collection: d }) => `await context.admin.collection("${d.name}").delete(${l}.id);`
1855
1855
  ), g = n.features.auth ? "context.agent" : "context.request", x = n.features.auth ? `await context.agent.authenticateUser();
1856
1856
  ` : "";
@@ -1885,8 +1885,8 @@ function qt(t, e, n, r) {
1885
1885
  )
1886
1886
  };
1887
1887
  }
1888
- function dn(t, e, n, r, a) {
1889
- const { declarations: s, setupSection: i, requestAgent: o, modelDbData: c, modelFormData: m } = qt(t, n, r, a);
1888
+ function cn(t, e, n, r, o) {
1889
+ const { declarations: s, setupSection: i, requestAgent: a, modelDbData: c, modelFormData: m } = Bt(t, n, r, o);
1890
1890
  return p`
1891
1891
  import { afterEach, beforeEach, describe, expect, it } from "vitest";
1892
1892
 
@@ -1895,24 +1895,24 @@ function dn(t, e, n, r, a) {
1895
1895
 
1896
1896
  describe("GET ${e.list}", () => {
1897
1897
  it("should return a 200 status code", async (context) => {
1898
- const response = await ${o}.get("${e.list}");
1898
+ const response = await ${a}.get("${e.list}");
1899
1899
  expect(response.status).toBe(200);
1900
1900
  });
1901
1901
  });
1902
1902
 
1903
1903
  describe("GET ${e.new}", () => {
1904
1904
  it("should return a 200 status code", async (context) => {
1905
- const response = await ${o}.get("${e.new}");
1905
+ const response = await ${a}.get("${e.new}");
1906
1906
  expect(response.status).toBe(200);
1907
1907
  });
1908
1908
  });
1909
1909
 
1910
1910
  describe("POST ${e.new}", () => {
1911
1911
  it("should create a new ${t.displayName.toLowerCase()}", async (context) => {
1912
- const response = await ${o}.post("${e.new}").type("form").send(${m});
1912
+ const response = await ${a}.post("${e.new}").type("form").send(${m});
1913
1913
  expect(response.body.status).toBe(303);
1914
1914
 
1915
- const response2 = await ${o}.get(response.body.location);
1915
+ const response2 = await ${a}.get(response.body.location);
1916
1916
  expect(response2.status).toBe(200);
1917
1917
  });
1918
1918
  });
@@ -1920,12 +1920,12 @@ function dn(t, e, n, r, a) {
1920
1920
  describe("GET ${e.show}", () => {
1921
1921
  it("should return a 200 status code", async (context) => {
1922
1922
  const { id } = await context.admin.collection("${t.tableName}").create(${c});
1923
- const response = await ${o}.get(\`${A(e.show, "id")}\`);
1923
+ const response = await ${a}.get(\`${A(e.show, "id")}\`);
1924
1924
  expect(response.status).toBe(200);
1925
1925
  });
1926
1926
 
1927
1927
  it("should return a 404 status code", async (context) => {
1928
- const response = await ${o}.get("${e.show.replace("[id]", "non-existent")}");
1928
+ const response = await ${a}.get("${e.show.replace("[id]", "non-existent")}");
1929
1929
  expect(response.status).toBe(404);
1930
1930
  });
1931
1931
  });
@@ -1933,10 +1933,10 @@ function dn(t, e, n, r, a) {
1933
1933
  describe("POST ${e.show}", () => {
1934
1934
  it("should delete a ${t.displayName.toLowerCase()}", async (context) => {
1935
1935
  const { id } = await context.admin.collection("${t.tableName}").create(${c});
1936
- const response = await ${o}.post(\`${A(e.show, "id")}\`).type("form");
1936
+ const response = await ${a}.post(\`${A(e.show, "id")}\`).type("form");
1937
1937
  expect(response.body.status).toBe(303);
1938
1938
 
1939
- const response2 = await ${o}.get(\`${A(e.show, "id")}\`);
1939
+ const response2 = await ${a}.get(\`${A(e.show, "id")}\`);
1940
1940
  expect(response2.status).toBe(404);
1941
1941
  });
1942
1942
  });
@@ -1944,7 +1944,7 @@ function dn(t, e, n, r, a) {
1944
1944
  describe("GET ${e.edit}", () => {
1945
1945
  it("should return a 200 status code", async (context) => {
1946
1946
  const { id } = await context.admin.collection("${t.tableName}").create(${c});
1947
- const response = await ${o}.get(\`${A(e.edit, "id")}\`);
1947
+ const response = await ${a}.get(\`${A(e.edit, "id")}\`);
1948
1948
  expect(response.status).toBe(200);
1949
1949
  });
1950
1950
  });
@@ -1952,7 +1952,7 @@ function dn(t, e, n, r, a) {
1952
1952
  describe("POST ${e.edit}", () => {
1953
1953
  it("should update a ${t.displayName.toLowerCase()}", async (context) => {
1954
1954
  const { id } = await context.admin.collection("${t.tableName}").create(${c});
1955
- const response = await ${o}
1955
+ const response = await ${a}
1956
1956
  .post(\`${A(e.edit, "id")}\`)
1957
1957
  .type("form")
1958
1958
  .send(${m});
@@ -1963,8 +1963,8 @@ function dn(t, e, n, r, a) {
1963
1963
  });
1964
1964
  `;
1965
1965
  }
1966
- function fn(t, e, n, r, a) {
1967
- const { declarations: s, setupSection: i, requestAgent: o, modelFormData: c } = qt(t, n, r, a);
1966
+ function mn(t, e, n, r, o) {
1967
+ const { declarations: s, setupSection: i, requestAgent: a, modelFormData: c } = Bt(t, n, r, o);
1968
1968
  return p`
1969
1969
  import { afterEach, beforeEach, describe, expect, it } from "vitest";
1970
1970
 
@@ -1973,52 +1973,44 @@ function fn(t, e, n, r, a) {
1973
1973
 
1974
1974
  describe("GET ${e}", () => {
1975
1975
  it("should return a 200 status code", async (context) => {
1976
- const response = await ${o}.get("${e}");
1976
+ const response = await ${a}.get("${e}");
1977
1977
  expect(response.status).toBe(200);
1978
1978
  });
1979
1979
  });
1980
1980
 
1981
1981
  describe("POST ${e}", () => {
1982
1982
  it("should submit the form successfully", async (context) => {
1983
- const response = await ${o}.post("${e}").type("form").send(${c});
1983
+ const response = await ${a}.post("${e}").type("form").send(${c});
1984
1984
  expect(response.body.status).toBe(200);
1985
1985
  });
1986
1986
  });
1987
1987
  });
1988
1988
  `;
1989
1989
  }
1990
- var $t = Object.freeze, hn = Object.defineProperty, gn = (t, e) => $t(hn(t, "raw", { value: $t(t.slice()) })), Ft;
1991
- const Ct = 2, bn = 3;
1992
- function vn(t, e) {
1993
- const n = t.replace(/^\/+|\/+$/g, ""), r = `${e}/${n}`, a = `/${n}`;
1990
+ var $t = Object.freeze, un = Object.defineProperty, pn = (t, e) => $t(un(t, "raw", { value: $t(t.slice()) })), Ct;
1991
+ function dn(t, e) {
1992
+ const n = t.replace(/^\/+|\/+$/g, ""), r = `${e}/${n}`, o = `/${n}`;
1994
1993
  return {
1995
- pagePath: `${r}/new`,
1996
- pageUrl: `${a}/new`
1994
+ pagePath: r,
1995
+ pageUrl: o
1997
1996
  };
1998
1997
  }
1999
- function wn(t) {
2000
- if (t.length <= Ct)
2001
- throw new Error(
2002
- "Invalid command arguments. Expected: generate form <model> <fields...>"
2003
- );
2004
- const [e, n] = t;
2005
- if (e !== "generate" || n !== "form")
2006
- throw new Error(
2007
- `Invalid command "${t.join(" ")}". Expected to start with "generate form".`
2008
- );
2009
- const r = t[Ct], a = t.slice(bn);
2010
- if (a.length === 0)
1998
+ function fn(t) {
1999
+ const [e, ...n] = t;
2000
+ if (!e)
2001
+ throw new Error("Invalid command arguments. Expected: <model> <fields...>");
2002
+ if (n.length === 0)
2011
2003
  throw new Error("At least one field definition is required.");
2012
- return { modelPath: r, fields: a };
2004
+ return { modelPath: e, fields: n };
2013
2005
  }
2014
- function Ut(t) {
2006
+ function jt(t) {
2015
2007
  return t.some((e) => e.type === "file");
2016
2008
  }
2017
- function yn(t) {
2009
+ function hn(t) {
2018
2010
  return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t) ? t : `'${t}'`;
2019
2011
  }
2020
- function _t(t) {
2021
- const e = t.type === "select" ? `[${t.options.map((a) => JSON.stringify(a.value)).join(", ")}]` : "";
2012
+ function Ft(t) {
2013
+ const e = t.type === "select" ? `[${t.options.map((o) => JSON.stringify(o.value)).join(", ")}]` : "";
2022
2014
  let n;
2023
2015
  switch (t.type) {
2024
2016
  case "text":
@@ -2073,13 +2065,13 @@ function _t(t) {
2073
2065
  }
2074
2066
  return ["text"].includes(t.type) ? t.required ? `${n}.nonempty()` : `${n}.optional()` : t.required || t.type === "geoPoint" ? n : t.type === "file" && t.maxSelect <= 1 ? `${n}.optional().default("")` : `${n}.optional()`;
2075
2067
  }
2076
- function xn(t) {
2068
+ function gn(t) {
2077
2069
  const e = [];
2078
2070
  for (const n of t) {
2079
2071
  if (n.type === "file" && n.maxSelect > 1) {
2080
2072
  e.push({
2081
2073
  name: n.name,
2082
- schema: _t({ ...n, required: !1 })
2074
+ schema: Ft({ ...n, required: !1 })
2083
2075
  }), e.push({
2084
2076
  name: `${n.name}+`,
2085
2077
  schema: "z.instanceof(File).array().optional()"
@@ -2089,12 +2081,12 @@ function xn(t) {
2089
2081
  });
2090
2082
  continue;
2091
2083
  }
2092
- e.push({ name: n.name, schema: _t(n) });
2084
+ e.push({ name: n.name, schema: Ft(n) });
2093
2085
  }
2094
2086
  return e;
2095
2087
  }
2096
- function $n(t, e) {
2097
- const n = xn(e).map((r) => `${yn(r.name)}: ${r.schema}`).join(`,
2088
+ function bn(t, e) {
2089
+ const n = gn(e).map((r) => `${hn(r.name)}: ${r.schema}`).join(`,
2098
2090
  `);
2099
2091
  return p`
2100
2092
  import { z } from "zod/v3";
@@ -2104,8 +2096,8 @@ function $n(t, e) {
2104
2096
  });
2105
2097
  `;
2106
2098
  }
2107
- function Fn(t, e) {
2108
- const n = O(e), r = [
2099
+ function vn(t, e) {
2100
+ const n = L(e), r = [
2109
2101
  'import { untrack } from "svelte";',
2110
2102
  'import { superForm } from "sveltekit-superforms";',
2111
2103
  'import { zodClient } from "sveltekit-superforms/adapters";',
@@ -2114,10 +2106,10 @@ function Fn(t, e) {
2114
2106
  ];
2115
2107
  return [...new Set(r)];
2116
2108
  }
2117
- function Cn(t, e) {
2109
+ function wn(t, e) {
2118
2110
  const r = e.filter(
2119
- (a) => a.type === "select"
2120
- ).map((a) => At(a)).join(`
2111
+ (o) => o.type === "select"
2112
+ ).map((o) => It(o)).join(`
2121
2113
 
2122
2114
  `);
2123
2115
  return p`
@@ -2130,11 +2122,11 @@ function Cn(t, e) {
2130
2122
  const { form: formData } = form;
2131
2123
  `;
2132
2124
  }
2133
- function _n(t, e) {
2134
- const n = Fn(t, e).join(`
2135
- `), r = Cn(t, e), a = e.map((i) => et(i)).join(`
2136
- `), s = Ut(e) ? ' enctype="multipart/form-data"' : "";
2137
- return p(Ft || (Ft = gn([`
2125
+ function yn(t, e) {
2126
+ const n = vn(t, e).join(`
2127
+ `), r = wn(t, e), o = e.map((i) => et(i)).join(`
2128
+ `), s = jt(e) ? ' enctype="multipart/form-data"' : "";
2129
+ return p(Ct || (Ct = pn([`
2138
2130
  <script lang="ts">
2139
2131
  `, `
2140
2132
 
@@ -2157,10 +2149,10 @@ function _n(t, e) {
2157
2149
  </form>
2158
2150
  </div>
2159
2151
  </section>
2160
- `])), n, r, t.displayName, s, a);
2152
+ `])), n, r, t.displayName, s, o);
2161
2153
  }
2162
- function Sn(t, e) {
2163
- const n = Ut(e), r = p`
2154
+ function xn(t, e) {
2155
+ const n = jt(e), r = p`
2164
2156
  import { fail, superValidate${n ? ", withFiles" : ""} } from "sveltekit-superforms";
2165
2157
  import { zod } from "sveltekit-superforms/adapters";
2166
2158
  import { ${t.schemaName} } from "$lib/schemas/${t.name}";
@@ -2196,18 +2188,26 @@ function U(t, e) {
2196
2188
  content: e
2197
2189
  };
2198
2190
  }
2199
- async function kn(t) {
2200
- const { modelPath: e, fields: n } = wn(t.argv);
2191
+ async function $n(t) {
2192
+ const { modelPath: e, fields: n } = fn(t.argv);
2201
2193
  K(e);
2202
- const r = E(e, t), s = (await W(n, r, t)).fields, { pagePath: i, pageUrl: o } = vn(e, r.routesDir), c = t.env === "runtime" ? await (await import("./env.runtime-wPrXEoHB.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(t), m = [
2203
- U(`${i}/+page.svelte`, _n(r, s)),
2204
- U(`${i}/+page.server.ts`, Sn(r, s)),
2194
+ const r = E(e, t), s = (await W(n, r, t)).fields, { pagePath: i, pageUrl: a } = dn(e, r.routesDir), c = t.env === "runtime" ? await (await import("./env.runtime-sHetoQ7B.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(
2195
+ t
2196
+ ), m = [
2197
+ U(`${i}/+page.svelte`, yn(r, s)),
2198
+ U(`${i}/+page.server.ts`, xn(r, s)),
2205
2199
  U(
2206
2200
  `${i}/server.test.ts`,
2207
- fn(r, o, s, t, c)
2201
+ mn(
2202
+ r,
2203
+ a,
2204
+ s,
2205
+ t,
2206
+ c
2207
+ )
2208
2208
  ),
2209
- U(`src/lib/schemas/${r.name}.ts`, $n(r, s))
2210
- ], h = O(s);
2209
+ U(`src/lib/schemas/${r.name}.ts`, bn(r, s))
2210
+ ], h = L(s);
2211
2211
  return {
2212
2212
  creates: m,
2213
2213
  modifies: [],
@@ -2217,16 +2217,20 @@ async function kn(t) {
2217
2217
  collections: []
2218
2218
  };
2219
2219
  }
2220
- const Mn = "generate-form";
2221
- async function Rn(t) {
2222
- const e = await kn(t);
2220
+ const Cn = "generate-form", Fn = "1.0.7", Sn = "src/patterns/generate/form", _n = "/generate/form";
2221
+ async function kn(t) {
2222
+ const e = await $n(t);
2223
2223
  if (t.env !== "runtime")
2224
2224
  return k(e);
2225
2225
  const { writeResult: n } = await import("./write-result-DG5OAbe1.js");
2226
2226
  return n(await k(e), t);
2227
2227
  }
2228
2228
  const Pn = {
2229
- slug: Mn,
2229
+ version: Fn,
2230
+ slug: Cn,
2231
+ source: Sn,
2232
+ docs: _n,
2233
+ plan: "open",
2230
2234
  title: "Generate a form",
2231
2235
  summary: "Generates a form.",
2232
2236
  categories: ["forms"],
@@ -2237,8 +2241,8 @@ const Pn = {
2237
2241
  argv: ["contact", "name:text", "email:email", "message:editor"]
2238
2242
  },
2239
2243
  baseline: "velastack",
2240
- generate: Rn
2241
- }, En = ["text"], In = {
2244
+ generate: kn
2245
+ }, Mn = ["text"], Rn = {
2242
2246
  string: "text",
2243
2247
  boolean: "bool",
2244
2248
  geopoint: "geoPoint",
@@ -2265,11 +2269,11 @@ const Pn = {
2265
2269
  geoPoint: "geoPoint",
2266
2270
  relation: "relation"
2267
2271
  };
2268
- function Tn(t) {
2272
+ function En(t) {
2269
2273
  return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t) ? t : `'${t}'`;
2270
2274
  }
2271
- function zn(t, e) {
2272
- const n = t.type === "select" ? `[${(t.options ?? []).map((a) => JSON.stringify(a.value)).join(", ")}]` : "";
2275
+ function In(t, e) {
2276
+ const n = t.type === "select" ? `[${(t.options ?? []).map((o) => JSON.stringify(o.value)).join(", ")}]` : "";
2273
2277
  let r;
2274
2278
  switch (t.type) {
2275
2279
  case "text":
@@ -2327,57 +2331,57 @@ function zn(t, e) {
2327
2331
  default:
2328
2332
  return t.type;
2329
2333
  }
2330
- return En.includes(t.type) ? t.required ? `${r}.nonempty()` : `${r}.optional()` : t.required || t.type === "geoPoint" ? r : t.type === "file" && (t.maxSelect ?? 1) <= 1 ? `${r}.optional().default("")` : `${r}.optional()`;
2334
+ return Mn.includes(t.type) ? t.required ? `${r}.nonempty()` : `${r}.optional()` : t.required || t.type === "geoPoint" ? r : t.type === "file" && (t.maxSelect ?? 1) <= 1 ? `${r}.optional().default("")` : `${r}.optional()`;
2331
2335
  }
2332
2336
  function ot(t, e, n) {
2333
2337
  const r = [];
2334
2338
  n.includeModelFields && (r.push({ name: "id", type: "text", required: !1 }), r.push({ name: "collectionId", type: "text", required: !1 }));
2335
- for (const o of e) {
2336
- if (o.type === "file" && o.maxSelect > 1) {
2337
- r.push({ ...o, required: !1 }), r.push({ name: `${o.name}+`, type: "file", required: !1, maxSelect: 999 }), r.push({ name: `${o.name}-`, type: "file", required: !1, maxSelect: 999 });
2339
+ for (const a of e) {
2340
+ if (a.type === "file" && a.maxSelect > 1) {
2341
+ r.push({ ...a, required: !1 }), r.push({ name: `${a.name}+`, type: "file", required: !1, maxSelect: 999 }), r.push({ name: `${a.name}-`, type: "file", required: !1, maxSelect: 999 });
2338
2342
  continue;
2339
2343
  }
2340
- r.push(o);
2344
+ r.push(a);
2341
2345
  }
2342
- const a = r.map((o) => `${Tn(o.name)}: ${zn(o, n)}`).join(`,
2346
+ const o = r.map((a) => `${En(a.name)}: ${In(a, n)}`).join(`,
2343
2347
  `), s = n.includeModelFields ? `
2344
2348
  import type { Schemas } from "pocketbase-svelte";` : "", i = n.includeModelFields ? ` satisfies Schemas["${t.tableName}"]` : "";
2345
2349
  return p`
2346
2350
  import { z } from "zod/v3";${s}
2347
2351
 
2348
2352
  export const ${t.schemaName} = z.object({
2349
- ${a}
2353
+ ${o}
2350
2354
  })${i};
2351
2355
  `;
2352
2356
  }
2353
- function Dn(t) {
2354
- const e = In[t];
2357
+ function zn(t) {
2358
+ const e = Rn[t];
2355
2359
  if (!e)
2356
2360
  throw new Error(`Unsupported collection field type "${t}" when generating from collection`);
2357
2361
  return e;
2358
2362
  }
2359
2363
  function st(t, e, n) {
2360
- const r = e.find((o) => o.name === t.tableName);
2364
+ const r = e.find((a) => a.name === t.tableName);
2361
2365
  if (!r)
2362
2366
  throw new Error(`Collection "${t.tableName}" not found`);
2363
- const a = Lt(e), s = new Map(e.map((o) => [o.id, o])), i = [];
2364
- for (const o of r.fields) {
2365
- if (o.name === "id" || o.system)
2367
+ const o = At(e), s = new Map(e.map((a) => [a.id, a])), i = [];
2368
+ for (const a of r.fields) {
2369
+ if (a.name === "id" || a.system)
2366
2370
  continue;
2367
- const c = Dn(o.type), m = !!o.required, h = rt(o.name);
2371
+ const c = zn(a.type), m = !!a.required, h = rt(a.name);
2368
2372
  if (c === "relation") {
2369
- const f = o.collectionId ? s.get(o.collectionId) : void 0;
2373
+ const f = a.collectionId ? s.get(a.collectionId) : void 0;
2370
2374
  if (!f)
2371
2375
  continue;
2372
2376
  const g = E(f.name, n);
2373
2377
  i.push({
2374
- name: o.name,
2378
+ name: a.name,
2375
2379
  title: h,
2376
2380
  type: "relation",
2377
2381
  required: m,
2378
2382
  collectionId: f.id,
2379
- maxSelect: o.maxSelect ?? 1,
2380
- displayField: a[f.name] ?? "id",
2383
+ maxSelect: a.maxSelect ?? 1,
2384
+ displayField: o[f.name] ?? "id",
2381
2385
  relatedModel: g,
2382
2386
  singularRelationName: N(
2383
2387
  `${t.displayName} ${g.displayName}`
@@ -2385,62 +2389,62 @@ function st(t, e, n) {
2385
2389
  pluralRelationName: N(
2386
2390
  `${t.displayName} ${g.pluralDisplayName}`
2387
2391
  ),
2388
- isCurrentUser: n.features.auth && f.name === "users" && /user|owner|author/i.test(o.name)
2392
+ isCurrentUser: n.features.auth && f.name === "users" && /user|owner|author/i.test(a.name)
2389
2393
  });
2390
2394
  continue;
2391
2395
  }
2392
2396
  if (c === "select") {
2393
2397
  i.push({
2394
- name: o.name,
2398
+ name: a.name,
2395
2399
  title: h,
2396
2400
  type: "select",
2397
2401
  required: m,
2398
- maxSelect: o.maxSelect ?? 1,
2399
- options: (o.values ?? []).map((f) => ({ label: f, value: f }))
2402
+ maxSelect: a.maxSelect ?? 1,
2403
+ options: (a.values ?? []).map((f) => ({ label: f, value: f }))
2400
2404
  });
2401
2405
  continue;
2402
2406
  }
2403
2407
  if (c === "file") {
2404
2408
  i.push({
2405
- name: o.name,
2409
+ name: a.name,
2406
2410
  title: h,
2407
2411
  type: "file",
2408
2412
  required: m,
2409
- maxSelect: o.maxSelect ?? 1
2413
+ maxSelect: a.maxSelect ?? 1
2410
2414
  });
2411
2415
  continue;
2412
2416
  }
2413
2417
  if (c === "autodate") {
2414
2418
  i.push({
2415
- name: o.name,
2419
+ name: a.name,
2416
2420
  title: h,
2417
2421
  type: "autodate",
2418
2422
  required: m,
2419
- onCreate: o.onCreate ?? o.name.includes("create"),
2420
- onUpdate: o.onUpdate ?? o.name.includes("update")
2423
+ onCreate: a.onCreate ?? a.name.includes("create"),
2424
+ onUpdate: a.onUpdate ?? a.name.includes("update")
2421
2425
  });
2422
2426
  continue;
2423
2427
  }
2424
2428
  i.push({
2425
- name: o.name,
2429
+ name: a.name,
2426
2430
  title: h,
2427
2431
  type: c,
2428
2432
  required: m
2429
2433
  });
2430
2434
  }
2431
- return i.filter((o) => o.name !== "id");
2435
+ return i.filter((a) => a.name !== "id");
2432
2436
  }
2433
- function Vt(t) {
2437
+ function Ot(t) {
2434
2438
  const e = t.filter((n) => n.type === "relation").map((n) => n.name);
2435
2439
  return e.length > 0 ? e.join(",") : void 0;
2436
2440
  }
2437
- function Ht(t) {
2441
+ function Lt(t) {
2438
2442
  const e = /* @__PURE__ */ new Set(), n = [];
2439
2443
  for (const r of t)
2440
2444
  r.type === "relation" && (e.has(r.relatedModel.tableName) || (e.add(r.relatedModel.tableName), n.push(r.relatedModel)));
2441
2445
  return n;
2442
2446
  }
2443
- function An(t) {
2447
+ function Tn(t) {
2444
2448
  const e = {
2445
2449
  name: t.name,
2446
2450
  type: t.type,
@@ -2463,7 +2467,7 @@ function An(t) {
2463
2467
  onUpdate: t.onUpdate
2464
2468
  } : e;
2465
2469
  }
2466
- function Gt(t, e, n) {
2470
+ function qt(t, e, n) {
2467
2471
  const r = n ? {
2468
2472
  listRule: n.rule,
2469
2473
  viewRule: n.rule,
@@ -2475,71 +2479,72 @@ function Gt(t, e, n) {
2475
2479
  name: t.tableName,
2476
2480
  type: "base",
2477
2481
  ...r,
2478
- fields: e.map(An)
2482
+ fields: e.map(Tn)
2479
2483
  };
2480
2484
  }
2481
- const St = 2, Nn = 3;
2482
- function Bn(t) {
2483
- if (t.length <= St)
2484
- throw new Error(
2485
- "Invalid command arguments. Expected: generate resource <model> [fields...]"
2486
- );
2487
- const [e, n] = t;
2488
- if (e !== "generate" || n !== "resource")
2485
+ function Dn(t) {
2486
+ const [e, ...n] = t;
2487
+ if (!e)
2489
2488
  throw new Error(
2490
- `Invalid command "${t.join(" ")}". Expected to start with "generate resource".`
2489
+ "Invalid command arguments. Expected: <model> [fields...]"
2491
2490
  );
2492
- const r = t[St], a = t.slice(Nn);
2493
- return { modelPath: r, fields: a };
2491
+ return { modelPath: e, fields: n };
2494
2492
  }
2495
- function jn(t, e) {
2493
+ function An(t, e) {
2496
2494
  return {
2497
2495
  path: t,
2498
2496
  language: j(t),
2499
2497
  content: e
2500
2498
  };
2501
2499
  }
2502
- async function Ln(t, e, n) {
2500
+ async function Nn(t, e, n) {
2503
2501
  K(e);
2504
2502
  const r = E(e, t);
2505
2503
  if (n.length > 0) {
2506
2504
  const i = await W(n, r, t);
2507
2505
  return { model: r, fields: i.fields, auth: i.auth, shouldCreateCollection: !0 };
2508
2506
  }
2509
- const a = t.env === "runtime" ? await (await import("./env.runtime-wPrXEoHB.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(t), s = st(r, a, t);
2507
+ const o = t.env === "runtime" ? await (await import("./env.runtime-sHetoQ7B.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(t), s = st(r, o, t);
2510
2508
  return { model: r, fields: s, auth: void 0, shouldCreateCollection: !1 };
2511
2509
  }
2512
- async function On(t) {
2513
- const { modelPath: e, fields: n } = Bn(t.argv), { model: r, fields: a, auth: s, shouldCreateCollection: i } = await Ln(
2510
+ async function Bn(t) {
2511
+ const { modelPath: e, fields: n } = Dn(t.argv), { model: r, fields: o, auth: s, shouldCreateCollection: i } = await Nn(
2514
2512
  t,
2515
2513
  e,
2516
2514
  n
2517
- ), o = `src/lib/schemas/${r.name}.ts`, c = ot(r, a, {
2515
+ ), a = `src/lib/schemas/${r.name}.ts`, c = ot(r, o, {
2518
2516
  includeModelFields: !0,
2519
2517
  forForm: !0
2520
2518
  });
2521
2519
  return {
2522
- creates: [jn(o, c)],
2520
+ creates: [An(a, c)],
2523
2521
  modifies: [],
2524
2522
  deletes: [],
2525
2523
  components: [],
2526
2524
  packages: [],
2527
- collections: i ? [Gt(r, a, s)] : []
2525
+ collections: i ? [qt(r, o, s)] : []
2528
2526
  };
2529
2527
  }
2530
- const qn = "generate-resource";
2528
+ const jn = "generate-resource", On = "1.0.7", Ln = "src/patterns/generate/resource", qn = "/generate/resource";
2531
2529
  async function Un(t) {
2532
- const e = await On(t);
2530
+ const e = await Bn(t);
2533
2531
  if (t.env !== "runtime")
2534
2532
  return k(e);
2535
- const { createCollections: n } = await import("./collections-Q0--CN0k.js"), r = await n(e.collections, t), a = {
2533
+ const { createCollections: n } = await import("./collections-BIx6tDrV.js"), r = await n(
2534
+ e.collections,
2535
+ t
2536
+ ), o = {
2536
2537
  ...e,
2537
2538
  creates: [...e.creates, ...r]
2538
2539
  }, { writeResult: s } = await import("./write-result-DG5OAbe1.js");
2539
- return s(await k(a), t);
2540
+ return s(await k(o), t);
2540
2541
  }
2541
2542
  const Vn = {
2542
- slug: qn,
2543
+ version: On,
2544
+ slug: jn,
2545
+ source: Ln,
2546
+ docs: qn,
2547
+ plan: "open",
2543
2548
  title: "Generate a resource",
2544
2549
  summary: "Generates model schema resources.",
2545
2550
  categories: ["data"],
@@ -2552,54 +2557,48 @@ const Vn = {
2552
2557
  baseline: "velastack",
2553
2558
  generate: Un
2554
2559
  };
2555
- var kt = Object.freeze, Hn = Object.defineProperty, X = (t, e) => kt(Hn(t, "raw", { value: kt(e || t.slice()) })), Mt, Rt, Pt, Et;
2556
- const It = 2, Gn = 3;
2557
- function Kn(t) {
2558
- if (t.length <= It)
2559
- throw new Error(
2560
- "Invalid command arguments. Expected: generate scaffold <model> [fields...]"
2561
- );
2562
- const [e, n] = t;
2563
- if (e !== "generate" || n !== "scaffold")
2560
+ var St = Object.freeze, Hn = Object.defineProperty, X = (t, e) => St(Hn(t, "raw", { value: St(e || t.slice()) })), _t, kt, Pt, Mt;
2561
+ function Gn(t) {
2562
+ const [e, ...n] = t;
2563
+ if (!e)
2564
2564
  throw new Error(
2565
- `Invalid command "${t.join(" ")}". Expected to start with "generate scaffold".`
2565
+ "Invalid command arguments. Expected: <model> [fields...]"
2566
2566
  );
2567
- const r = t[It], a = t.slice(Gn);
2568
- return { modelPath: r, fields: a };
2567
+ return { modelPath: e, fields: n };
2569
2568
  }
2570
- function _(t, e) {
2569
+ function S(t, e) {
2571
2570
  return {
2572
2571
  path: t,
2573
2572
  language: j(t),
2574
2573
  content: e
2575
2574
  };
2576
2575
  }
2577
- function Kt(t) {
2576
+ function Ut(t) {
2578
2577
  return t.some((e) => e.type === "file");
2579
2578
  }
2580
- function Wt(t) {
2579
+ function Vt(t) {
2581
2580
  return [...new Set(t.filter(Boolean))];
2582
2581
  }
2583
2582
  function it(t) {
2584
2583
  return t.filter(
2585
2584
  (e) => e.type === "select"
2586
- ).map((e) => At(e)).join(`
2585
+ ).map((e) => It(e)).join(`
2587
2586
 
2588
2587
  `);
2589
2588
  }
2590
- function Xt(t, e) {
2591
- return Ht(t).map(
2589
+ function Ht(t, e) {
2590
+ return Lt(t).map(
2592
2591
  (n) => `const ${n.pluralName} = await ${e}.collection("${n.tableName}").getFullList();`
2593
2592
  ).join(`
2594
2593
  `);
2595
2594
  }
2596
- function Yt(t) {
2597
- return Ht(t).map((e) => e.pluralName).join(", ");
2595
+ function Gt(t) {
2596
+ return Lt(t).map((e) => e.pluralName).join(", ");
2598
2597
  }
2599
- function Wn(t) {
2598
+ function Kn(t) {
2600
2599
  return t.features.auth ? "locals.pb" : "locals.admin";
2601
2600
  }
2602
- function Jt(t, e, n = !1) {
2601
+ function Kt(t, e, n = !1) {
2603
2602
  const r = it(e);
2604
2603
  return p`
2605
2604
  ${r}
@@ -2612,21 +2611,21 @@ function Jt(t, e, n = !1) {
2612
2611
  const { form: formData } = form;
2613
2612
  `;
2614
2613
  }
2615
- function Xn(t, e, n) {
2616
- const r = n.some((o) => o.type === "select"), a = Wt([
2614
+ function Wn(t, e, n) {
2615
+ const r = n.some((a) => a.type === "select"), o = Vt([
2617
2616
  'import { untrack } from "svelte";',
2618
2617
  'import { superForm } from "sveltekit-superforms";',
2619
2618
  'import { zodClient } from "sveltekit-superforms/adapters";',
2620
2619
  `import { ${t.schemaName} } from "$lib/schemas/${t.name}";`,
2621
- ...nt(O(n)),
2620
+ ...nt(L(n)),
2622
2621
  'import { Button } from "$lib/components/ui/button";',
2623
2622
  'import ArrowLeftIcon from "@lucide/svelte/icons/arrow-left";',
2624
2623
  'import * as Form from "$lib/components/ui/form";',
2625
2624
  r ? 'import type { Models } from "pocketbase-svelte";' : ""
2626
2625
  ]).join(`
2627
- `), s = n.map((o) => et(o)).join(`
2628
- `), i = Kt(n) ? ' enctype="multipart/form-data"' : "";
2629
- return p(Mt || (Mt = X([`
2626
+ `), s = n.map((a) => et(a)).join(`
2627
+ `), i = Ut(n) ? ' enctype="multipart/form-data"' : "";
2628
+ return p(_t || (_t = X([`
2630
2629
  <script lang="ts">
2631
2630
  `, `
2632
2631
  `, `
@@ -2653,23 +2652,23 @@ function Xn(t, e, n) {
2653
2652
  </form>
2654
2653
  </div>
2655
2654
  </section>
2656
- `])), a, Jt(t, n), t.displayName.toLowerCase(), e.list, i, s, e.list);
2655
+ `])), o, Kt(t, n), t.displayName.toLowerCase(), e.list, i, s, e.list);
2657
2656
  }
2658
- function Yn(t, e, n) {
2659
- const r = n.some((o) => o.type === "select"), a = Wt([
2657
+ function Xn(t, e, n) {
2658
+ const r = n.some((a) => a.type === "select"), o = Vt([
2660
2659
  'import { untrack } from "svelte";',
2661
2660
  'import { superForm } from "sveltekit-superforms";',
2662
2661
  'import { zodClient } from "sveltekit-superforms/adapters";',
2663
2662
  `import { ${t.schemaName} } from "$lib/schemas/${t.name}";`,
2664
- ...nt(O(n)),
2663
+ ...nt(L(n)),
2665
2664
  'import { Button } from "$lib/components/ui/button";',
2666
2665
  'import ArrowLeftIcon from "@lucide/svelte/icons/arrow-left";',
2667
2666
  'import * as Form from "$lib/components/ui/form";',
2668
2667
  r ? 'import type { Models } from "pocketbase-svelte";' : ""
2669
2668
  ]).join(`
2670
- `), s = n.map((o) => et(o)).join(`
2671
- `), i = Kt(n) ? ' enctype="multipart/form-data"' : "";
2672
- return p(Rt || (Rt = X([`
2669
+ `), s = n.map((a) => et(a)).join(`
2670
+ `), i = Ut(n) ? ' enctype="multipart/form-data"' : "";
2671
+ return p(kt || (kt = X([`
2673
2672
  <script lang="ts">
2674
2673
  `, `
2675
2674
  `, `
@@ -2723,20 +2722,20 @@ function Yn(t, e, n) {
2723
2722
  </form>
2724
2723
  </div>
2725
2724
  </section>
2726
- `])), a, Jt(t, n, !0), t.displayName.toLowerCase(), e.list, i, s, e.list);
2725
+ `])), o, Kt(t, n, !0), t.displayName.toLowerCase(), e.list, i, s, e.list);
2727
2726
  }
2728
- function Jn(t, e, n) {
2729
- const r = n.some((o) => o.type === "select"), a = r ? `${it(n)}` : "", s = n.map((o) => {
2727
+ function Yn(t, e, n) {
2728
+ const r = n.some((a) => a.type === "select"), o = r ? `${it(n)}` : "", s = n.map((a) => {
2730
2729
  let c = "{ getValue }", m = "{ value: getValue() }";
2731
- return o.type === "relation" && (c = "{ getValue, row }", m = `{ value: getValue(), expanded: row.original.expand?.${o.name}, displayField: "${o.displayField}" }`), o.type === "select" && (m = `{ value: getValue(), options: ${o.name}Labels }`), o.type === "file" && (c = "{ getValue, row }", m = "{ value: getValue(), collectionId: row.original.collectionId, id: row.original.id }"), p`
2732
- columnHelper.accessor("${o.name}", {
2733
- header: ({ column }) => renderComponent(ColumnHeader, { column, title: "${o.title}" }),
2734
- cell: (${c}) => renderComponent(Cells.${o.type.charAt(0).toUpperCase() + o.type.slice(1)}Cell, ${m})
2730
+ return a.type === "relation" && (c = "{ getValue, row }", m = `{ value: getValue(), expanded: row.original.expand?.${a.name}, displayField: "${a.displayField}" }`), a.type === "select" && (m = `{ value: getValue(), options: ${a.name}Labels }`), a.type === "file" && (c = "{ getValue, row }", m = "{ value: getValue(), collectionId: row.original.collectionId, id: row.original.id }"), p`
2731
+ columnHelper.accessor("${a.name}", {
2732
+ header: ({ column }) => renderComponent(ColumnHeader, { column, title: "${a.title}" }),
2733
+ cell: (${c}) => renderComponent(Cells.${a.type.charAt(0).toUpperCase() + a.type.slice(1)}Cell, ${m})
2735
2734
  })
2736
2735
  `;
2737
2736
  }).join(`,
2738
- `), i = n.filter((o) => o.type === "select").map(
2739
- (o) => `<FacetedFilter column={table.getColumn("${o.name}")!} title="${o.title}" options={Object.values(${o.name}Labels)} />`
2737
+ `), i = n.filter((a) => a.type === "select").map(
2738
+ (a) => `<FacetedFilter column={table.getColumn("${a.name}")!} title="${a.title}" options={Object.values(${a.name}Labels)} />`
2740
2739
  ).join(`
2741
2740
  `);
2742
2741
  return p(Pt || (Pt = X([`
@@ -3113,21 +3112,21 @@ function Jn(t, e, n) {
3113
3112
  <Pagination {table} />
3114
3113
  </div>
3115
3114
  </section>
3116
- `])), r ? 'import { FacetedFilter } from "$lib/components/ui/faceted-filter";' : "", a, t.tableName, s, n.length > 0 ? "," : "", e.list, e.list, e.list, t.pluralName, t.pluralDisplayName, e.new, t.displayName.toLowerCase(), t.pluralDisplayName.toLowerCase(), i, e.new, t.displayName.toLowerCase());
3115
+ `])), r ? 'import { FacetedFilter } from "$lib/components/ui/faceted-filter";' : "", o, t.tableName, s, n.length > 0 ? "," : "", e.list, e.list, e.list, t.pluralName, t.pluralDisplayName, e.new, t.displayName.toLowerCase(), t.pluralDisplayName.toLowerCase(), i, e.new, t.displayName.toLowerCase());
3117
3116
  }
3118
- function Zn(t, e, n) {
3119
- const r = Vt(e), a = r ? `{ expand: "${r}" }` : "";
3117
+ function Jn(t, e, n) {
3118
+ const r = Ot(e), o = r ? `{ expand: "${r}" }` : "";
3120
3119
  return p`
3121
3120
  export const load = async ({ locals }) => {
3122
- const ${t.pluralName} = await ${n}.collection("${t.tableName}").getFullList(${a});
3121
+ const ${t.pluralName} = await ${n}.collection("${t.tableName}").getFullList(${o});
3123
3122
  return { ${t.pluralName} };
3124
3123
  };
3125
3124
  `;
3126
3125
  }
3127
- function Qn(t, e, n, r, a) {
3128
- const s = Xt(n, r), i = Yt(n), o = i ? `, ${i}` : "", c = n.find(
3126
+ function Zn(t, e, n, r, o) {
3127
+ const s = Ht(n, r), i = Gt(n), a = i ? `, ${i}` : "", c = n.find(
3129
3128
  (h) => h.type === "relation" && h.isCurrentUser
3130
- ), m = a && c ? p`
3129
+ ), m = o && c ? p`
3131
3130
  {
3132
3131
  ...form.data,
3133
3132
  ${c.name}: locals.pb.authStore.record?.id
@@ -3142,7 +3141,7 @@ function Qn(t, e, n, r, a) {
3142
3141
 
3143
3142
  export const load = async ({ locals }) => {
3144
3143
  ${s}
3145
- return { form: await superValidate(zod(${t.schemaName}))${o} };
3144
+ return { form: await superValidate(zod(${t.schemaName}))${a} };
3146
3145
  };
3147
3146
 
3148
3147
  export const actions = {
@@ -3166,8 +3165,8 @@ function Qn(t, e, n, r, a) {
3166
3165
  };
3167
3166
  `;
3168
3167
  }
3169
- function tr(t, e, n, r) {
3170
- const a = Vt(n), s = a ? `, { expand: "${a}" }` : "";
3168
+ function Qn(t, e, n, r) {
3169
+ const o = Ot(n), s = o ? `, { expand: "${o}" }` : "";
3171
3170
  return p`
3172
3171
  import { error, redirect } from "@sveltejs/kit";
3173
3172
 
@@ -3188,17 +3187,17 @@ function tr(t, e, n, r) {
3188
3187
  };
3189
3188
  `;
3190
3189
  }
3191
- function er(t, e, n) {
3192
- const r = n.some((m) => m.type === "select"), a = n.some((m) => m.type === "relation"), s = n.some((m) => m.type === "file"), i = [
3190
+ function tr(t, e, n) {
3191
+ const r = n.some((m) => m.type === "select"), o = n.some((m) => m.type === "relation"), s = n.some((m) => m.type === "file"), i = [
3193
3192
  'import { Button } from "$lib/components/ui/button";',
3194
3193
  'import ArrowLeftIcon from "@lucide/svelte/icons/arrow-left";',
3195
- r || a ? 'import { Badge } from "$lib/components/ui/badge";' : "",
3196
- a ? 'import CircleArrowRightIcon from "@lucide/svelte/icons/circle-arrow-right";' : "",
3194
+ r || o ? 'import { Badge } from "$lib/components/ui/badge";' : "",
3195
+ o ? 'import CircleArrowRightIcon from "@lucide/svelte/icons/circle-arrow-right";' : "",
3197
3196
  s ? 'import FileIcon from "@lucide/svelte/icons/file";' : ""
3198
3197
  ].filter(Boolean).join(`
3199
- `), o = it(n), c = n.map((m) => ke(t, m)).join(`
3198
+ `), a = it(n), c = n.map((m) => Ce(t, m)).join(`
3200
3199
  `);
3201
- return p(Et || (Et = X([`
3200
+ return p(Mt || (Mt = X([`
3202
3201
  <script lang="ts">
3203
3202
  `, `
3204
3203
  `, `
@@ -3230,10 +3229,10 @@ function er(t, e, n) {
3230
3229
  </div>
3231
3230
  </div>
3232
3231
  </section>
3233
- `])), i, o, t.displayName, e.list, c, e.list, t.name);
3232
+ `])), i, a, t.displayName, e.list, c, e.list, t.name);
3234
3233
  }
3235
- function nr(t, e, n, r) {
3236
- const a = Xt(n, r), s = Yt(n), i = s ? `, ${s}` : "";
3234
+ function er(t, e, n, r) {
3235
+ const o = Ht(n, r), s = Gt(n), i = s ? `, ${s}` : "";
3237
3236
  return p`
3238
3237
  import { error, fail, redirect } from "@sveltejs/kit";
3239
3238
  import { setPocketbaseErrors, setDefaultData } from "@velastack/pocketbase";
@@ -3248,7 +3247,7 @@ function nr(t, e, n, r) {
3248
3247
  } catch {
3249
3248
  throw error(404, "Not found");
3250
3249
  }
3251
- ${a}
3250
+ ${o}
3252
3251
  return { form: await superValidate(${t.name}, zod(${t.schemaName}))${i} };
3253
3252
  };
3254
3253
 
@@ -3274,9 +3273,9 @@ function nr(t, e, n, r) {
3274
3273
  };
3275
3274
  `;
3276
3275
  }
3277
- async function rr(t, e, n) {
3276
+ async function nr(t, e, n) {
3278
3277
  K(e);
3279
- const r = E(e, t), a = t.env === "runtime" ? await (await import("./env.runtime-wPrXEoHB.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(t);
3278
+ const r = E(e, t), o = t.env === "runtime" ? await (await import("./env.runtime-sHetoQ7B.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(t);
3280
3279
  if (n.length > 0) {
3281
3280
  const i = await W(n, r, t);
3282
3281
  return {
@@ -3284,64 +3283,64 @@ async function rr(t, e, n) {
3284
3283
  fields: i.fields,
3285
3284
  auth: i.auth,
3286
3285
  shouldCreateCollection: !0,
3287
- collections: a
3286
+ collections: o
3288
3287
  };
3289
3288
  }
3290
- const s = st(r, a, t);
3289
+ const s = st(r, o, t);
3291
3290
  return {
3292
3291
  model: r,
3293
3292
  fields: s,
3294
3293
  auth: void 0,
3295
3294
  shouldCreateCollection: !1,
3296
- collections: a
3295
+ collections: o
3297
3296
  };
3298
3297
  }
3299
- async function ar(t) {
3300
- const { modelPath: e, fields: n } = Kn(t.argv), { model: r, fields: a, auth: s, shouldCreateCollection: i, collections: o } = await rr(t, e, n), c = Ge(r), m = Ke(r), h = Wn(t), f = a.filter(
3298
+ async function rr(t) {
3299
+ const { modelPath: e, fields: n } = Gn(t.argv), { model: r, fields: o, auth: s, shouldCreateCollection: i, collections: a } = await nr(t, e, n), c = qe(r), m = Ue(r), h = Kn(t), f = o.filter(
3301
3300
  (u) => !(u.type === "relation" && u.isCurrentUser)
3302
3301
  ), g = [
3303
- _(
3302
+ S(
3304
3303
  `src/lib/schemas/${r.name}.ts`,
3305
- ot(r, a, {
3304
+ ot(r, o, {
3306
3305
  includeModelFields: !0,
3307
3306
  forForm: !0
3308
3307
  })
3309
3308
  ),
3310
- _(
3309
+ S(
3311
3310
  `${c.list}/+page.server.ts`,
3312
- Zn(r, f, h)
3311
+ Jn(r, f, h)
3313
3312
  ),
3314
- _(
3313
+ S(
3315
3314
  `${c.list}/+page.svelte`,
3316
- Jn(r, m, f)
3315
+ Yn(r, m, f)
3317
3316
  ),
3318
- _(
3317
+ S(
3319
3318
  `${c.new}/+page.server.ts`,
3320
- Qn(r, m, f, h, t.features.auth)
3319
+ Zn(r, m, f, h, t.features.auth)
3321
3320
  ),
3322
- _(`${c.new}/+page.svelte`, Xn(r, m, f)),
3323
- _(
3321
+ S(`${c.new}/+page.svelte`, Wn(r, m, f)),
3322
+ S(
3324
3323
  `${c.show}/+page.server.ts`,
3325
- tr(r, m, f, h)
3324
+ Qn(r, m, f, h)
3326
3325
  ),
3327
- _(
3326
+ S(
3328
3327
  `${c.show}/+page.svelte`,
3329
- er(r, m, f)
3328
+ tr(r, m, f)
3330
3329
  ),
3331
- _(
3330
+ S(
3332
3331
  `${c.edit}/+page.server.ts`,
3333
- nr(r, m, f, h)
3332
+ er(r, m, f, h)
3334
3333
  ),
3335
- _(
3334
+ S(
3336
3335
  `${c.edit}/+page.svelte`,
3337
- Yn(r, m, f)
3336
+ Xn(r, m, f)
3338
3337
  ),
3339
- _(
3338
+ S(
3340
3339
  `${c.list}/server.test.ts`,
3341
- dn(r, m, a, t, o)
3340
+ cn(r, m, o, t, a)
3342
3341
  )
3343
3342
  ], x = [
3344
- ...O(f),
3343
+ ...L(f),
3345
3344
  "button",
3346
3345
  "table",
3347
3346
  "data-table",
@@ -3364,22 +3363,29 @@ async function ar(t) {
3364
3363
  deletes: [],
3365
3364
  components: [...new Set(x)],
3366
3365
  packages: [],
3367
- collections: i ? [Gt(r, a, s)] : []
3366
+ collections: i ? [qt(r, o, s)] : []
3368
3367
  };
3369
3368
  }
3370
- const or = "generate-scaffold";
3371
- async function sr(t) {
3372
- const e = await ar(t);
3369
+ const ar = "generate-scaffold", or = "1.0.7", sr = "src/patterns/generate/scaffold", ir = "/generate/scaffold";
3370
+ async function lr(t) {
3371
+ const e = await rr(t);
3373
3372
  if (t.env !== "runtime")
3374
3373
  return k(e);
3375
- const { createCollections: n } = await import("./collections-Q0--CN0k.js"), r = await n(e.collections, t), a = {
3374
+ const { createCollections: n } = await import("./collections-BIx6tDrV.js"), r = await n(
3375
+ e.collections,
3376
+ t
3377
+ ), o = {
3376
3378
  ...e,
3377
3379
  creates: [...e.creates, ...r]
3378
3380
  }, { writeResult: s } = await import("./write-result-DG5OAbe1.js");
3379
- return s(await k(a), t);
3380
- }
3381
- const ir = {
3382
- slug: or,
3381
+ return s(await k(o), t);
3382
+ }
3383
+ const cr = {
3384
+ version: or,
3385
+ slug: ar,
3386
+ source: sr,
3387
+ docs: ir,
3388
+ plan: "open",
3383
3389
  title: "Generate a scaffold",
3384
3390
  summary: "Generates CRUD routes and schema.",
3385
3391
  categories: ["data", "forms"],
@@ -3390,49 +3396,44 @@ const ir = {
3390
3396
  argv: ["contact", "name:text", "email:email"]
3391
3397
  },
3392
3398
  baseline: "velastack",
3393
- generate: sr
3394
- }, Tt = 2, lr = 3;
3395
- function cr(t) {
3396
- if (t.length <= Tt)
3397
- throw new Error(
3398
- "Invalid command arguments. Expected: generate schema <model> [fields...]"
3399
- );
3400
- const [e, n] = t;
3401
- if (e !== "generate" || n !== "schema")
3399
+ generate: lr
3400
+ };
3401
+ function mr(t) {
3402
+ const [e, ...n] = t;
3403
+ if (!e)
3402
3404
  throw new Error(
3403
- `Invalid command "${t.join(" ")}". Expected to start with "generate schema".`
3405
+ "Invalid command arguments. Expected: <model> [fields...]"
3404
3406
  );
3405
- const r = t[Tt], a = t.slice(lr);
3406
- return { modelPath: r, fields: a };
3407
+ return { modelPath: e, fields: n };
3407
3408
  }
3408
- function mr(t, e) {
3409
+ function ur(t, e) {
3409
3410
  return {
3410
3411
  path: t,
3411
3412
  language: j(t),
3412
3413
  content: e
3413
3414
  };
3414
3415
  }
3415
- async function ur(t, e, n) {
3416
+ async function pr(t, e, n) {
3416
3417
  K(e);
3417
3418
  const r = E(e, t);
3418
3419
  if (n.length > 0) {
3419
3420
  const i = await W(n, r, t);
3420
3421
  return { model: r, fields: i.fields, includeModelFields: !1 };
3421
3422
  }
3422
- const a = t.env === "runtime" ? await (await import("./env.runtime-wPrXEoHB.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(t), s = st(r, a, t);
3423
+ const o = t.env === "runtime" ? await (await import("./env.runtime-sHetoQ7B.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(t), s = st(r, o, t);
3423
3424
  return { model: r, fields: s, includeModelFields: !0 };
3424
3425
  }
3425
- async function pr(t) {
3426
- const { modelPath: e, fields: n } = cr(t.argv), { model: r, fields: a, includeModelFields: s } = await ur(
3426
+ async function dr(t) {
3427
+ const { modelPath: e, fields: n } = mr(t.argv), { model: r, fields: o, includeModelFields: s } = await pr(
3427
3428
  t,
3428
3429
  e,
3429
3430
  n
3430
- ), i = `src/lib/schemas/${r.name}.ts`, o = ot(r, a, {
3431
+ ), i = `src/lib/schemas/${r.name}.ts`, a = ot(r, o, {
3431
3432
  includeModelFields: s,
3432
3433
  forForm: !0
3433
3434
  });
3434
3435
  return {
3435
- creates: [mr(i, o)],
3436
+ creates: [ur(i, a)],
3436
3437
  modifies: [],
3437
3438
  deletes: [],
3438
3439
  components: [],
@@ -3440,16 +3441,20 @@ async function pr(t) {
3440
3441
  collections: []
3441
3442
  };
3442
3443
  }
3443
- const dr = "generate-schema";
3444
- async function fr(t) {
3445
- const e = await pr(t);
3444
+ const fr = "generate-schema", hr = "1.0.7", gr = "src/patterns/generate/schema", br = "/generate/schema";
3445
+ async function vr(t) {
3446
+ const e = await dr(t);
3446
3447
  if (t.env !== "runtime")
3447
3448
  return k(e);
3448
3449
  const { writeResult: n } = await import("./write-result-DG5OAbe1.js");
3449
3450
  return n(await k(e), t);
3450
3451
  }
3451
- const hr = {
3452
- slug: dr,
3452
+ const wr = {
3453
+ version: hr,
3454
+ slug: fr,
3455
+ source: gr,
3456
+ docs: br,
3457
+ plan: "open",
3453
3458
  title: "Generate a schema",
3454
3459
  summary: "Generates a zod schema.",
3455
3460
  categories: ["data"],
@@ -3460,8 +3465,8 @@ const hr = {
3460
3465
  argv: ["contact", "name:text", "email:email"]
3461
3466
  },
3462
3467
  baseline: "velastack",
3463
- generate: fr
3464
- }, gr = `<script lang="ts" module>
3468
+ generate: vr
3469
+ }, yr = `<script lang="ts" module>
3465
3470
  import HomeIcon from '@lucide/svelte/icons/home';
3466
3471
 
3467
3472
  let data = {
@@ -3517,7 +3522,7 @@ const hr = {
3517
3522
  <NavUser {user} />
3518
3523
  </Sidebar.Footer>
3519
3524
  </Sidebar.Root>
3520
- `, br = `<script lang="ts">
3525
+ `, xr = `<script lang="ts">
3521
3526
  import type { Component } from 'svelte';
3522
3527
  import * as Sidebar from '$lib/components/ui/sidebar';
3523
3528
  import { page } from '$app/state';
@@ -3557,7 +3562,7 @@ const hr = {
3557
3562
  {/each}
3558
3563
  </Sidebar.Menu>
3559
3564
  </Sidebar.Group>
3560
- `, vr = `<script lang="ts" module>
3565
+ `, $r = `<script lang="ts" module>
3561
3566
  import Settings2Icon from '@lucide/svelte/icons/settings-2';
3562
3567
 
3563
3568
  let data = {
@@ -3676,7 +3681,7 @@ const hr = {
3676
3681
  </DropdownMenu.Root>
3677
3682
  </Sidebar.MenuItem>
3678
3683
  </Sidebar.Menu>
3679
- `, wr = `<script lang="ts">
3684
+ `, Cr = `<script lang="ts">
3680
3685
  import { cn } from '$lib/utils';
3681
3686
  import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
3682
3687
  import { DropdownMenu as DropdownMenuPrimitive } from 'bits-ui';
@@ -3704,7 +3709,7 @@ const hr = {
3704
3709
  {@render children?.()}
3705
3710
  </div>
3706
3711
  {/if}
3707
- `, yr = `<script lang="ts">
3712
+ `, Fr = `<script lang="ts">
3708
3713
  import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
3709
3714
  import { getContext } from 'svelte';
3710
3715
  import { AUTH_MENU_CONTEXT_KEY, type AuthMenuContext } from './context.js';
@@ -3720,7 +3725,7 @@ const hr = {
3720
3725
  {:else}
3721
3726
  {@render children?.()}
3722
3727
  {/if}
3723
- `, xr = `<script lang="ts">
3728
+ `, Sr = `<script lang="ts">
3724
3729
  import { goto } from '$app/navigation';
3725
3730
  import * as DropdownMenu from '$lib/components/ui/dropdown-menu';
3726
3731
  import { Button } from '$lib/components/ui/button';
@@ -3756,7 +3761,7 @@ const hr = {
3756
3761
  {@render children?.()}
3757
3762
  </Button>
3758
3763
  {/if}
3759
- `, $r = `<script lang="ts">
3764
+ `, _r = `<script lang="ts">
3760
3765
  import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
3761
3766
  import { getContext } from 'svelte';
3762
3767
  import { AUTH_MENU_CONTEXT_KEY, type AuthMenuContext } from './context.js';
@@ -3770,7 +3775,7 @@ const hr = {
3770
3775
  {@render children?.()}
3771
3776
  </DropdownMenu.Label>
3772
3777
  {/if}
3773
- `, Fr = `<script lang="ts">
3778
+ `, kr = `<script lang="ts">
3774
3779
  import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
3775
3780
  import { getContext } from 'svelte';
3776
3781
  import { AUTH_MENU_CONTEXT_KEY, type AuthMenuContext } from './context.js';
@@ -3782,7 +3787,7 @@ const hr = {
3782
3787
  {#if isDesktop}
3783
3788
  <DropdownMenu.Separator {...restProps} />
3784
3789
  {/if}
3785
- `, Cr = `<script lang="ts">
3790
+ `, Pr = `<script lang="ts">
3786
3791
  import { cn } from '$lib/utils';
3787
3792
  import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
3788
3793
  import { getContext } from 'svelte';
@@ -3796,7 +3801,7 @@ const hr = {
3796
3801
  {#if isDesktop}
3797
3802
  <DropdownMenu.Trigger class={cn('inline-flex', className)} {...restProps} />
3798
3803
  {/if}
3799
- `, _r = `<script lang="ts">
3804
+ `, Mr = `<script lang="ts">
3800
3805
  import { page } from '$app/state';
3801
3806
  import { browser } from '$app/environment';
3802
3807
  import { onMount, setContext } from 'svelte';
@@ -3842,12 +3847,12 @@ const hr = {
3842
3847
  {:else}
3843
3848
  {@render guest?.()}
3844
3849
  {/if}
3845
- `, Sr = `export type AuthMenuContext = {
3850
+ `, Rr = `export type AuthMenuContext = {
3846
3851
  isDesktop: boolean;
3847
3852
  };
3848
3853
 
3849
3854
  export const AUTH_MENU_CONTEXT_KEY = Symbol('auth-menu-context');
3850
- `, kr = `import Root from './auth-menu.svelte';
3855
+ `, Er = `import Root from './auth-menu.svelte';
3851
3856
  import Content from './auth-menu-content.svelte';
3852
3857
  import Trigger from './auth-menu-trigger.svelte';
3853
3858
  import Group from './auth-menu-group.svelte';
@@ -3856,12 +3861,12 @@ import Separator from './auth-menu-separator.svelte';
3856
3861
  import Item from './auth-menu-item.svelte';
3857
3862
 
3858
3863
  export { Root, Content, Trigger, Group, Label, Separator, Item };
3859
- `, Mr = `import { z } from 'zod/v3';
3864
+ `, Ir = `import { z } from 'zod/v3';
3860
3865
 
3861
3866
  export const changeEmailSchema = z.object({
3862
3867
  email: z.string().email()
3863
3868
  });
3864
- `, Rr = `import { z } from 'zod/v3';
3869
+ `, zr = `import { z } from 'zod/v3';
3865
3870
 
3866
3871
  export const changePasswordSchema = z
3867
3872
  .object({
@@ -3872,16 +3877,16 @@ export const changePasswordSchema = z
3872
3877
  message: "Passwords don't match",
3873
3878
  path: ['passwordConfirm']
3874
3879
  });
3875
- `, Pr = `import { z } from 'zod/v3';
3880
+ `, Tr = `import { z } from 'zod/v3';
3876
3881
  export const confirmEmailChangeSchema = z.object({
3877
3882
  password: z.string()
3878
3883
  });
3879
- `, Er = `import { z } from 'zod/v3';
3884
+ `, Dr = `import { z } from 'zod/v3';
3880
3885
  export const confirmResetSchema = z.object({
3881
3886
  password: z.string(),
3882
3887
  passwordConfirm: z.string()
3883
3888
  });
3884
- `, Ir = `import { z } from 'zod/v3';
3889
+ `, Ar = `import { z } from 'zod/v3';
3885
3890
 
3886
3891
  const otpSchema = z.object({
3887
3892
  type: z.literal('otp'),
@@ -3900,35 +3905,35 @@ const oAuth2Schema = z.object({
3900
3905
  });
3901
3906
 
3902
3907
  export const loginSchema = z.discriminatedUnion('type', [otpSchema, passwordSchema, oAuth2Schema]);
3903
- `, Tr = `import { z } from 'zod/v3';
3908
+ `, Nr = `import { z } from 'zod/v3';
3904
3909
  export const otpSchema = z.object({
3905
3910
  otp: z.string()
3906
3911
  });
3907
- `, zr = `import { z } from 'zod/v3';
3912
+ `, Br = `import { z } from 'zod/v3';
3908
3913
 
3909
3914
  export const profileSchema = z.object({
3910
3915
  name: z.string().optional(),
3911
3916
  avatar: z.union([z.instanceof(File), z.string()]).optional(),
3912
3917
  emailVisibility: z.boolean().optional()
3913
3918
  });
3914
- `, Dr = `import { z } from 'zod/v3';
3919
+ `, jr = `import { z } from 'zod/v3';
3915
3920
  export const resetSchema = z.object({
3916
3921
  email: z.string().email()
3917
3922
  });
3918
- `, Ar = `import { z } from 'zod/v3';
3923
+ `, Or = `import { z } from 'zod/v3';
3919
3924
 
3920
3925
  export const signupSchema = z.object({
3921
3926
  email: z.string().email(),
3922
3927
  password: z.string(),
3923
3928
  passwordConfirm: z.string()
3924
3929
  });
3925
- `, Nr = `export const load = ({ locals }) => {
3930
+ `, Lr = `export const load = ({ locals }) => {
3926
3931
  const user = locals.pb.authStore.record!;
3927
3932
  const breadcrumbs = [{ title: 'Home', url: '/dashboard' }];
3928
3933
 
3929
3934
  return { user, breadcrumbs };
3930
3935
  };
3931
- `, Br = `<script lang="ts">
3936
+ `, qr = `<script lang="ts">
3932
3937
  import * as Sidebar from '$lib/components/ui/sidebar';
3933
3938
  import { Separator } from '$lib/components/ui/separator';
3934
3939
  import AppSidebar from '$lib/components/app-sidebar.svelte';
@@ -3978,7 +3983,7 @@ export const signupSchema = z.object({
3978
3983
  background-color: var(--color-sidebar);
3979
3984
  }
3980
3985
  </style>
3981
- `, jr = "", Lr = `import { describe, it, expect } from 'vitest';
3986
+ `, Ur = "", Vr = `import { describe, it, expect } from 'vitest';
3982
3987
  import type { Match } from '@velastack/pocketbase';
3983
3988
  import type { RouteId } from './$types';
3984
3989
 
@@ -3995,14 +4000,14 @@ describe('dashboard', () => {
3995
4000
  expect(response.status).toBe(200);
3996
4001
  });
3997
4002
  });
3998
- `, Or = `export const load = async ({ parent }) => {
4003
+ `, Hr = `export const load = async ({ parent }) => {
3999
4004
  const { breadcrumbs } = await parent();
4000
4005
 
4001
4006
  return {
4002
4007
  breadcrumbs: [...breadcrumbs, { title: 'Settings', url: '/settings' }]
4003
4008
  };
4004
4009
  };
4005
- `, qr = `import { superValidate, fail, withFiles } from 'sveltekit-superforms';
4010
+ `, Gr = `import { superValidate, fail, withFiles } from 'sveltekit-superforms';
4006
4011
  import { zod } from 'sveltekit-superforms/adapters';
4007
4012
  import { setFlash } from 'sveltekit-flash-message/server';
4008
4013
  import { profileSchema } from '$lib/schemas/profile';
@@ -4071,7 +4076,7 @@ export const actions = {
4071
4076
  return {};
4072
4077
  }
4073
4078
  };
4074
- `, Ur = `<script lang="ts">
4079
+ `, Kr = `<script lang="ts">
4075
4080
  import { untrack } from 'svelte';
4076
4081
  import { superForm } from 'sveltekit-superforms';
4077
4082
  import { zodClient } from 'sveltekit-superforms/adapters';
@@ -4349,7 +4354,7 @@ export const actions = {
4349
4354
  </form>
4350
4355
  </div>
4351
4356
  </div>
4352
- `, Vr = `import { fail, superValidate } from 'sveltekit-superforms';
4357
+ `, Wr = `import { fail, superValidate } from 'sveltekit-superforms';
4353
4358
  import { zod } from 'sveltekit-superforms/adapters';
4354
4359
  import { confirmEmailChangeSchema } from '$lib/schemas/confirmEmailChange';
4355
4360
  import { redirect } from '@sveltejs/kit';
@@ -4376,7 +4381,7 @@ export const actions = {
4376
4381
  return redirect(303, '/login');
4377
4382
  }
4378
4383
  };
4379
- `, Hr = `<script lang="ts">
4384
+ `, Xr = `<script lang="ts">
4380
4385
  import { untrack } from 'svelte';
4381
4386
  import { Button } from '$lib/components/ui/button';
4382
4387
  import * as Card from '$lib/components/ui/card';
@@ -4444,7 +4449,7 @@ export const actions = {
4444
4449
  </div>
4445
4450
  </div>
4446
4451
  </div>
4447
- `, Gr = `import { describe, it, expect } from 'vitest';
4452
+ `, Yr = `import { describe, it, expect } from 'vitest';
4448
4453
  import type { Match } from '@velastack/pocketbase';
4449
4454
  import type { RouteId } from './$types';
4450
4455
 
@@ -4456,7 +4461,7 @@ describe('GET /confirm-email-change/[token]', () => {
4456
4461
  expect(response.status).toBe(200);
4457
4462
  });
4458
4463
  });
4459
- `, Kr = `import { fail, superValidate } from 'sveltekit-superforms';
4464
+ `, Jr = `import { fail, superValidate } from 'sveltekit-superforms';
4460
4465
  import { zod } from 'sveltekit-superforms/adapters';
4461
4466
  import { confirmResetSchema } from '$lib/schemas/confirmReset';
4462
4467
  import { redirect } from '@sveltejs/kit';
@@ -4485,7 +4490,7 @@ export const actions = {
4485
4490
  return redirect(303, '/login');
4486
4491
  }
4487
4492
  };
4488
- `, Wr = `<script lang="ts">
4493
+ `, Zr = `<script lang="ts">
4489
4494
  import { untrack } from 'svelte';
4490
4495
  import { Button } from '$lib/components/ui/button';
4491
4496
  import * as Card from '$lib/components/ui/card';
@@ -4569,7 +4574,7 @@ export const actions = {
4569
4574
  </div>
4570
4575
  </div>
4571
4576
  </div>
4572
- `, Xr = `import { describe, it, expect } from 'vitest';
4577
+ `, Qr = `import { describe, it, expect } from 'vitest';
4573
4578
  import type { Match } from '@velastack/pocketbase';
4574
4579
  import type { RouteId } from './$types';
4575
4580
 
@@ -4579,7 +4584,7 @@ describe('GET /confirm-reset/[token]', () => {
4579
4584
  expect(response.status).toBe(200);
4580
4585
  });
4581
4586
  });
4582
- `, Yr = `import { redirect } from '@sveltejs/kit';
4587
+ `, ta = `import { redirect } from '@sveltejs/kit';
4583
4588
  import { setFlash } from 'sveltekit-flash-message/server';
4584
4589
 
4585
4590
  export const GET = async ({ params, locals, cookies }) => {
@@ -4598,7 +4603,7 @@ export const GET = async ({ params, locals, cookies }) => {
4598
4603
  setFlash({ type: 'toast', message }, cookies);
4599
4604
  redirect(303, redirectPath);
4600
4605
  };
4601
- `, Jr = `import { describe, it, expect } from 'vitest';
4606
+ `, ea = `import { describe, it, expect } from 'vitest';
4602
4607
  import type { Match } from '@velastack/pocketbase';
4603
4608
  import type { RouteId } from './$types';
4604
4609
 
@@ -4611,7 +4616,7 @@ describe('GET /confirm-verification/[token]', () => {
4611
4616
  expect(response.headers['location']).toBe('/login');
4612
4617
  });
4613
4618
  });
4614
- `, Zr = `import { fail, superValidate, message } from 'sveltekit-superforms';
4619
+ `, na = `import { fail, superValidate, message } from 'sveltekit-superforms';
4615
4620
  import { zod } from 'sveltekit-superforms/adapters';
4616
4621
  import { loginSchema } from '$lib/schemas/login';
4617
4622
  import { redirect } from '@sveltejs/kit';
@@ -4672,7 +4677,7 @@ export const actions = {
4672
4677
  redirect(303, redirectUrl);
4673
4678
  }
4674
4679
  };
4675
- `, Qr = `<script lang="ts">
4680
+ `, ra = `<script lang="ts">
4676
4681
  import { untrack } from 'svelte';
4677
4682
  import { Button } from '$lib/components/ui/button';
4678
4683
  import * as Card from '$lib/components/ui/card';
@@ -4855,7 +4860,7 @@ export const actions = {
4855
4860
  </div>
4856
4861
  </div>
4857
4862
  </div>
4858
- `, ta = `import { describe, it, expect } from 'vitest';
4863
+ `, aa = `import { describe, it, expect } from 'vitest';
4859
4864
  import * as devalue from 'devalue';
4860
4865
  import type { Match } from '@velastack/pocketbase';
4861
4866
  import type { RouteId } from './$types';
@@ -4902,14 +4907,14 @@ describe('POST /login', () => {
4902
4907
  expect(data.form.message.text).toBe('Failed to authenticate.');
4903
4908
  });
4904
4909
  });
4905
- `, ea = `import { redirect } from '@sveltejs/kit';
4910
+ `, oa = `import { redirect } from '@sveltejs/kit';
4906
4911
 
4907
4912
  export const POST = ({ cookies, locals }) => {
4908
4913
  locals.pb.authStore.clear();
4909
4914
  locals.pb.authStore.clearCookie(cookies);
4910
4915
  throw redirect(303, '/');
4911
4916
  };
4912
- `, na = `import { describe, it, expect } from 'vitest';
4917
+ `, sa = `import { describe, it, expect } from 'vitest';
4913
4918
  import type { Match } from '@velastack/pocketbase';
4914
4919
  import type { RouteId } from './$types';
4915
4920
 
@@ -4921,7 +4926,7 @@ describe('POST /logout', () => {
4921
4926
  expect(response.headers.location).toBe('/');
4922
4927
  });
4923
4928
  });
4924
- `, ra = `import { fail, message, superValidate } from 'sveltekit-superforms';
4929
+ `, ia = `import { fail, message, superValidate } from 'sveltekit-superforms';
4925
4930
  import { zod } from 'sveltekit-superforms/adapters';
4926
4931
  import { otpSchema } from '$lib/schemas/otp';
4927
4932
  import { redirect } from '@sveltejs/kit';
@@ -4962,7 +4967,7 @@ export const actions = {
4962
4967
  redirect(303, redirectUrl);
4963
4968
  }
4964
4969
  };
4965
- `, aa = `<script lang="ts">
4970
+ `, la = `<script lang="ts">
4966
4971
  import { untrack } from 'svelte';
4967
4972
  import { Button } from '$lib/components/ui/button';
4968
4973
  import * as Card from '$lib/components/ui/card';
@@ -5028,7 +5033,7 @@ export const actions = {
5028
5033
  </div>
5029
5034
  </div>
5030
5035
  </div>
5031
- `, oa = `import { describe, it, expect } from 'vitest';
5036
+ `, ca = `import { describe, it, expect } from 'vitest';
5032
5037
  import type { Match } from '@velastack/pocketbase';
5033
5038
  import type { RouteId } from './$types';
5034
5039
 
@@ -5048,7 +5053,7 @@ describe('POST /otp/[token]', () => {
5048
5053
  expect(response.body.status).toBe(400);
5049
5054
  });
5050
5055
  });
5051
- `, sa = `import { fail, superValidate } from 'sveltekit-superforms';
5056
+ `, ma = `import { fail, superValidate } from 'sveltekit-superforms';
5052
5057
  import { zod } from 'sveltekit-superforms/adapters';
5053
5058
  import { resetSchema } from '$lib/schemas/reset';
5054
5059
  import { redirect } from '@sveltejs/kit';
@@ -5076,7 +5081,7 @@ export const actions = {
5076
5081
  return { form };
5077
5082
  }
5078
5083
  };
5079
- `, ia = `<script lang="ts">
5084
+ `, ua = `<script lang="ts">
5080
5085
  import { untrack } from 'svelte';
5081
5086
  import { Button } from '$lib/components/ui/button';
5082
5087
  import * as Card from '$lib/components/ui/card';
@@ -5143,7 +5148,7 @@ export const actions = {
5143
5148
  </div>
5144
5149
  </div>
5145
5150
  </div>
5146
- `, la = `import { describe, it, expect } from 'vitest';
5151
+ `, pa = `import { describe, it, expect } from 'vitest';
5147
5152
  import type { Match } from '@velastack/pocketbase';
5148
5153
  import type { RouteId } from './$types';
5149
5154
 
@@ -5163,7 +5168,7 @@ describe('POST /reset', () => {
5163
5168
  expect(response.body.status).toBe(200);
5164
5169
  });
5165
5170
  });
5166
- `, ca = `import { redirect } from '@sveltejs/kit';
5171
+ `, da = `import { redirect } from '@sveltejs/kit';
5167
5172
  import { fail, superValidate } from 'sveltekit-superforms';
5168
5173
  import { zod } from 'sveltekit-superforms/adapters';
5169
5174
  import { setFlash } from 'sveltekit-flash-message/server';
@@ -5219,7 +5224,7 @@ export const actions = {
5219
5224
  return redirect(303, redirectUrl);
5220
5225
  }
5221
5226
  };
5222
- `, ma = `<script lang="ts">
5227
+ `, fa = `<script lang="ts">
5223
5228
  import { untrack } from 'svelte';
5224
5229
  import { Button } from '$lib/components/ui/button';
5225
5230
  import * as Card from '$lib/components/ui/card';
@@ -5386,7 +5391,7 @@ export const actions = {
5386
5391
  </div>
5387
5392
  </div>
5388
5393
  </div>
5389
- `, ua = `import { describe, it, expect } from 'vitest';
5394
+ `, ha = `import { describe, it, expect } from 'vitest';
5390
5395
  import type { Match } from '@velastack/pocketbase';
5391
5396
  import * as devalue from 'devalue';
5392
5397
  import type { RouteId } from './$types';
@@ -5442,67 +5447,67 @@ describe('POST /signup', () => {
5442
5447
  expect(data.form.errors.email[0]).toBe('Value must be unique.');
5443
5448
  });
5444
5449
  });
5445
- `, pa = /* @__PURE__ */ Object.assign({
5446
- "./creates/src/lib/components/app-sidebar.svelte": gr,
5447
- "./creates/src/lib/components/nav-main.svelte": br,
5448
- "./creates/src/lib/components/nav-user.svelte": vr,
5449
- "./creates/src/lib/components/ui/auth-menu/auth-menu-content.svelte": wr,
5450
- "./creates/src/lib/components/ui/auth-menu/auth-menu-group.svelte": yr,
5451
- "./creates/src/lib/components/ui/auth-menu/auth-menu-item.svelte": xr,
5452
- "./creates/src/lib/components/ui/auth-menu/auth-menu-label.svelte": $r,
5453
- "./creates/src/lib/components/ui/auth-menu/auth-menu-separator.svelte": Fr,
5454
- "./creates/src/lib/components/ui/auth-menu/auth-menu-trigger.svelte": Cr,
5455
- "./creates/src/lib/components/ui/auth-menu/auth-menu.svelte": _r,
5456
- "./creates/src/lib/components/ui/auth-menu/context.ts": Sr,
5457
- "./creates/src/lib/components/ui/auth-menu/index.ts": kr,
5458
- "./creates/src/lib/schemas/changeEmail.ts": Mr,
5459
- "./creates/src/lib/schemas/changePassword.ts": Rr,
5460
- "./creates/src/lib/schemas/confirmEmailChange.ts": Pr,
5461
- "./creates/src/lib/schemas/confirmReset.ts": Er,
5462
- "./creates/src/lib/schemas/login.ts": Ir,
5463
- "./creates/src/lib/schemas/otp.ts": Tr,
5464
- "./creates/src/lib/schemas/profile.ts": zr,
5465
- "./creates/src/lib/schemas/reset.ts": Dr,
5466
- "./creates/src/lib/schemas/signup.ts": Ar,
5467
- "./creates/src/routes/(app)/+layout.server.ts": Nr,
5468
- "./creates/src/routes/(app)/+layout.svelte": Br,
5469
- "./creates/src/routes/(app)/dashboard/+page.svelte": jr,
5470
- "./creates/src/routes/(app)/dashboard/server.test.ts": Lr,
5471
- "./creates/src/routes/(app)/settings/+layout.server.ts": Or,
5472
- "./creates/src/routes/(app)/settings/+page.server.ts": qr,
5473
- "./creates/src/routes/(app)/settings/+page.svelte": Ur,
5474
- "./creates/src/routes/(public)/confirm-email-change/[token]/+page.server.ts": Vr,
5475
- "./creates/src/routes/(public)/confirm-email-change/[token]/+page.svelte": Hr,
5476
- "./creates/src/routes/(public)/confirm-email-change/[token]/server.test.ts": Gr,
5477
- "./creates/src/routes/(public)/confirm-reset/[token]/+page.server.ts": Kr,
5478
- "./creates/src/routes/(public)/confirm-reset/[token]/+page.svelte": Wr,
5479
- "./creates/src/routes/(public)/confirm-reset/[token]/server.test.ts": Xr,
5480
- "./creates/src/routes/(public)/confirm-verification/[token]/+server.ts": Yr,
5481
- "./creates/src/routes/(public)/confirm-verification/[token]/server.test.ts": Jr,
5482
- "./creates/src/routes/(public)/login/+page.server.ts": Zr,
5483
- "./creates/src/routes/(public)/login/+page.svelte": Qr,
5484
- "./creates/src/routes/(public)/login/server.test.ts": ta,
5485
- "./creates/src/routes/(public)/logout/+server.ts": ea,
5486
- "./creates/src/routes/(public)/logout/server.test.ts": na,
5487
- "./creates/src/routes/(public)/otp/[token]/+page.server.ts": ra,
5488
- "./creates/src/routes/(public)/otp/[token]/+page.svelte": aa,
5489
- "./creates/src/routes/(public)/otp/[token]/server.test.ts": oa,
5490
- "./creates/src/routes/(public)/reset/+page.server.ts": sa,
5491
- "./creates/src/routes/(public)/reset/+page.svelte": ia,
5492
- "./creates/src/routes/(public)/reset/server.test.ts": la,
5493
- "./creates/src/routes/(public)/signup/+page.server.ts": ca,
5494
- "./creates/src/routes/(public)/signup/+page.svelte": ma,
5495
- "./creates/src/routes/(public)/signup/server.test.ts": ua
5496
- }), da = "./creates/";
5497
- async function fa(t) {
5498
- const e = Object.entries(pa).map(([a, s]) => {
5499
- const i = Dt(a, da);
5450
+ `, ga = /* @__PURE__ */ Object.assign({
5451
+ "./creates/src/lib/components/app-sidebar.svelte": yr,
5452
+ "./creates/src/lib/components/nav-main.svelte": xr,
5453
+ "./creates/src/lib/components/nav-user.svelte": $r,
5454
+ "./creates/src/lib/components/ui/auth-menu/auth-menu-content.svelte": Cr,
5455
+ "./creates/src/lib/components/ui/auth-menu/auth-menu-group.svelte": Fr,
5456
+ "./creates/src/lib/components/ui/auth-menu/auth-menu-item.svelte": Sr,
5457
+ "./creates/src/lib/components/ui/auth-menu/auth-menu-label.svelte": _r,
5458
+ "./creates/src/lib/components/ui/auth-menu/auth-menu-separator.svelte": kr,
5459
+ "./creates/src/lib/components/ui/auth-menu/auth-menu-trigger.svelte": Pr,
5460
+ "./creates/src/lib/components/ui/auth-menu/auth-menu.svelte": Mr,
5461
+ "./creates/src/lib/components/ui/auth-menu/context.ts": Rr,
5462
+ "./creates/src/lib/components/ui/auth-menu/index.ts": Er,
5463
+ "./creates/src/lib/schemas/changeEmail.ts": Ir,
5464
+ "./creates/src/lib/schemas/changePassword.ts": zr,
5465
+ "./creates/src/lib/schemas/confirmEmailChange.ts": Tr,
5466
+ "./creates/src/lib/schemas/confirmReset.ts": Dr,
5467
+ "./creates/src/lib/schemas/login.ts": Ar,
5468
+ "./creates/src/lib/schemas/otp.ts": Nr,
5469
+ "./creates/src/lib/schemas/profile.ts": Br,
5470
+ "./creates/src/lib/schemas/reset.ts": jr,
5471
+ "./creates/src/lib/schemas/signup.ts": Or,
5472
+ "./creates/src/routes/(app)/+layout.server.ts": Lr,
5473
+ "./creates/src/routes/(app)/+layout.svelte": qr,
5474
+ "./creates/src/routes/(app)/dashboard/+page.svelte": Ur,
5475
+ "./creates/src/routes/(app)/dashboard/server.test.ts": Vr,
5476
+ "./creates/src/routes/(app)/settings/+layout.server.ts": Hr,
5477
+ "./creates/src/routes/(app)/settings/+page.server.ts": Gr,
5478
+ "./creates/src/routes/(app)/settings/+page.svelte": Kr,
5479
+ "./creates/src/routes/(public)/confirm-email-change/[token]/+page.server.ts": Wr,
5480
+ "./creates/src/routes/(public)/confirm-email-change/[token]/+page.svelte": Xr,
5481
+ "./creates/src/routes/(public)/confirm-email-change/[token]/server.test.ts": Yr,
5482
+ "./creates/src/routes/(public)/confirm-reset/[token]/+page.server.ts": Jr,
5483
+ "./creates/src/routes/(public)/confirm-reset/[token]/+page.svelte": Zr,
5484
+ "./creates/src/routes/(public)/confirm-reset/[token]/server.test.ts": Qr,
5485
+ "./creates/src/routes/(public)/confirm-verification/[token]/+server.ts": ta,
5486
+ "./creates/src/routes/(public)/confirm-verification/[token]/server.test.ts": ea,
5487
+ "./creates/src/routes/(public)/login/+page.server.ts": na,
5488
+ "./creates/src/routes/(public)/login/+page.svelte": ra,
5489
+ "./creates/src/routes/(public)/login/server.test.ts": aa,
5490
+ "./creates/src/routes/(public)/logout/+server.ts": oa,
5491
+ "./creates/src/routes/(public)/logout/server.test.ts": sa,
5492
+ "./creates/src/routes/(public)/otp/[token]/+page.server.ts": ia,
5493
+ "./creates/src/routes/(public)/otp/[token]/+page.svelte": la,
5494
+ "./creates/src/routes/(public)/otp/[token]/server.test.ts": ca,
5495
+ "./creates/src/routes/(public)/reset/+page.server.ts": ma,
5496
+ "./creates/src/routes/(public)/reset/+page.svelte": ua,
5497
+ "./creates/src/routes/(public)/reset/server.test.ts": pa,
5498
+ "./creates/src/routes/(public)/signup/+page.server.ts": da,
5499
+ "./creates/src/routes/(public)/signup/+page.svelte": fa,
5500
+ "./creates/src/routes/(public)/signup/server.test.ts": ha
5501
+ }), ba = "./creates/";
5502
+ async function va(t) {
5503
+ const e = Object.entries(ga).map(([o, s]) => {
5504
+ const i = Et(o, ba);
5500
5505
  return {
5501
5506
  path: i,
5502
5507
  language: j(i),
5503
5508
  content: s
5504
5509
  };
5505
- }).sort((a, s) => a.path.localeCompare(s.path)), n = [
5510
+ }).sort((o, s) => o.path.localeCompare(s.path)), n = [
5506
5511
  "sidebar",
5507
5512
  "breadcrumb",
5508
5513
  "separator",
@@ -5587,7 +5592,7 @@ async function fa(t) {
5587
5592
  ]
5588
5593
  };
5589
5594
  }
5590
- const ha = `/// <reference path="../pb_data/types.d.ts" />
5595
+ const wa = `/// <reference path="../pb_data/types.d.ts" />
5591
5596
  migrate(
5592
5597
  (app) => {
5593
5598
  const collection = new Collection({
@@ -5773,7 +5778,7 @@ migrate(
5773
5778
  return app.delete(collection);
5774
5779
  }
5775
5780
  );
5776
- `, ga = `/// <reference path="../pb_data/types.d.ts" />
5781
+ `, ya = `/// <reference path="../pb_data/types.d.ts" />
5777
5782
  migrate(
5778
5783
  (app) => {
5779
5784
  const collection = app.findCollectionByNameOrId('_pb_users_auth_');
@@ -5828,7 +5833,7 @@ migrate(
5828
5833
  return app.save(collection);
5829
5834
  }
5830
5835
  );
5831
- `, ba = `import {
5836
+ `, xa = `import {
5832
5837
  POCKETBASE_URL,
5833
5838
  POCKETBASE_SUPERUSER_EMAIL,
5834
5839
  POCKETBASE_SUPERUSER_PASSWORD
@@ -5841,7 +5846,7 @@ export const handle = handlePocketbase({
5841
5846
  superuserPassword: POCKETBASE_SUPERUSER_PASSWORD,
5842
5847
  auth: { protectedRoutes: ['/(app)'] }
5843
5848
  });
5844
- `, va = `<script lang="ts">
5849
+ `, $a = `<script lang="ts">
5845
5850
  import { toggleMode } from 'mode-watcher';
5846
5851
  import * as Navbar from '$lib/components/ui/navbar';
5847
5852
  import { Button } from '$lib/components/ui/button';
@@ -5943,26 +5948,26 @@ export const handle = handlePocketbase({
5943
5948
  @apply container mx-auto max-w-7xl px-4 py-8 w-full;
5944
5949
  }
5945
5950
  </style>
5946
- `, wa = `import { loadFlash } from "sveltekit-flash-message/server";
5951
+ `, Ca = `import { loadFlash } from "sveltekit-flash-message/server";
5947
5952
 
5948
5953
  export const load = loadFlash(async ({ locals }) => {
5949
5954
  return {
5950
5955
  user: locals.pb.authStore.record,
5951
5956
  };
5952
5957
  });
5953
- `, ya = /* @__PURE__ */ Object.assign({
5954
- "./preview-modifies/migrations/1776099881_created_oauth_accounts.js": ha,
5955
- "./preview-modifies/migrations/1776099881_updated_users.js": ga,
5956
- "./preview-modifies/src/hooks.server.ts": ba,
5957
- "./preview-modifies/src/routes/(public)/root-layout.svelte": va,
5958
- "./preview-modifies/src/routes/+layout.server.ts": wa
5959
- }), xa = "./preview-modifies/";
5960
- async function $a(t) {
5961
- const e = Object.entries(ya).map(([n, r]) => {
5962
- const a = Dt(n, xa);
5958
+ `, Fa = /* @__PURE__ */ Object.assign({
5959
+ "./preview-modifies/migrations/1776099881_created_oauth_accounts.js": wa,
5960
+ "./preview-modifies/migrations/1776099881_updated_users.js": ya,
5961
+ "./preview-modifies/src/hooks.server.ts": xa,
5962
+ "./preview-modifies/src/routes/(public)/root-layout.svelte": $a,
5963
+ "./preview-modifies/src/routes/+layout.server.ts": Ca
5964
+ }), Sa = "./preview-modifies/";
5965
+ async function _a(t) {
5966
+ const e = Object.entries(Fa).map(([n, r]) => {
5967
+ const o = Et(n, Sa);
5963
5968
  return {
5964
- path: a,
5965
- language: j(a),
5969
+ path: o,
5970
+ language: j(o),
5966
5971
  content: r
5967
5972
  };
5968
5973
  }).sort((n, r) => n.path.localeCompare(r.path));
@@ -5975,18 +5980,25 @@ async function $a(t) {
5975
5980
  collections: []
5976
5981
  };
5977
5982
  }
5978
- const Fa = "enable-auth";
5979
- async function Ca(t) {
5980
- const e = await fa(t);
5983
+ const ka = "enable-auth", Pa = "1.0.7", Ma = "src/patterns/enable/auth", Ra = "/enable/auth";
5984
+ async function Ea(t) {
5985
+ const e = await va(t);
5981
5986
  if (t.env === "preview") {
5982
- const s = await $a();
5987
+ const s = await _a();
5983
5988
  return k(pt([e, s]));
5984
5989
  }
5985
- const { generate: n } = await import("./generate.runtime-BT46R-FS.js"), r = await n(t), { writeResult: a } = await import("./write-result-DG5OAbe1.js");
5986
- return a(await k(pt([e, r])), t);
5990
+ const { generate: n } = await import("./generate.runtime-B5wEl4BS.js"), r = await n(t), { writeResult: o } = await import("./write-result-DG5OAbe1.js");
5991
+ return o(
5992
+ await k(pt([e, r])),
5993
+ t
5994
+ );
5987
5995
  }
5988
- const _a = {
5989
- slug: Fa,
5996
+ const Ia = {
5997
+ version: Pa,
5998
+ slug: ka,
5999
+ source: Ma,
6000
+ docs: Ra,
6001
+ plan: "open",
5990
6002
  title: "Enable authentication",
5991
6003
  summary: "Enables authentication.",
5992
6004
  categories: ["authentication"],
@@ -6004,26 +6016,25 @@ const _a = {
6004
6016
  argv: []
6005
6017
  },
6006
6018
  baseline: "velastack",
6007
- generate: Ca
6008
- }, Zt = [
6019
+ generate: Ea
6020
+ }, Wt = [
6009
6021
  Pn,
6010
- hr,
6022
+ wr,
6011
6023
  Vn,
6012
- ir,
6013
- _a
6014
- ], Sa = Zt.reduce(
6015
- (t, e) => (t[e.slug] = e, t),
6016
- {}
6017
- ), Ia = {
6024
+ cr,
6025
+ Ia
6026
+ ], za = Object.fromEntries(
6027
+ Wt.map((t) => [t.slug, t])
6028
+ ), ja = {
6018
6029
  version: "0.1.0",
6019
- patterns: Zt,
6020
- bySlug: Sa
6030
+ patterns: Wt,
6031
+ bySlug: za
6021
6032
  };
6022
6033
  export {
6023
- Pa as D,
6024
- Ea as M,
6034
+ Na as D,
6035
+ Ba as M,
6025
6036
  p as d,
6026
- Ia as i,
6037
+ ja as i,
6027
6038
  j as l
6028
6039
  };
6029
- //# sourceMappingURL=index-CbDX3h_c.js.map
6040
+ //# sourceMappingURL=index-BP2ybpuw.js.map